@p4code/cli 0.9.24 → 0.9.26
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/{AcpMcpStdioBridge-BNuxv1nx.mjs → AcpMcpStdioBridge-DLEEBpNR.mjs} +4 -4
- package/dist/AcpMcpStdioBridge-Dozbm_3J.mjs +3 -0
- package/dist/{Effect-BrI3bavz.mjs → Effect-DwQPN8rO.mjs} +35 -2
- package/dist/{Schema-06GeVid5.mjs → Schema-CdYZrGX6.mjs} +24 -3
- package/dist/{Stream-DKSvHopl.mjs → Stream-F-Z4HJeD.mjs} +2 -2
- package/dist/{TraceDiagnostics-Dk5M3WAT.mjs → TraceDiagnostics-D1Qz3qce.mjs} +18 -7
- package/dist/bin.mjs +2 -2
- package/dist/{binCli-CBzw8eZx.mjs → binCli-CcEaWLAR.mjs} +11 -11
- package/dist/claude-history-worker.mjs +1 -1
- package/dist/{claudeHistoryWorker-BZBBGtSw.mjs → claudeHistoryWorker-Bf24F_k8.mjs} +1 -1
- package/dist/{claudeHistoryWorker-DlhW7K2f.mjs → claudeHistoryWorker-DOjYf4xB.mjs} +4 -4
- package/dist/client/.vite/manifest.json +2259 -2257
- package/dist/client/assets/{2NI2N5EU-Dz1H18lO.js → 2NI2N5EU--LXjbTE-.js} +2 -2
- package/dist/client/assets/{4UO7MD6I-DxZW-JIQ.js → 4UO7MD6I-D_jr6_IV.js} +2 -2
- package/dist/client/assets/{5B3SVYGG-Cl2owg_V.js → 5B3SVYGG-tThUTA_S.js} +2 -2
- package/dist/client/assets/{5GK6JWQ2-A0G_mE3E.js → 5GK6JWQ2-BCuuAhKJ.js} +2 -2
- package/dist/client/assets/{5N7A7DKN-Bd00cghV.js → 5N7A7DKN-rdPMRoZL.js} +2 -2
- package/dist/client/assets/{5OC2THR4-ytZLjDMp.js → 5OC2THR4-gvpm3IL0.js} +2 -2
- package/dist/client/assets/{5S6HY5KT-XbqbgHxv.js → 5S6HY5KT-CWanNmdR.js} +2 -2
- package/dist/client/assets/{6IMQ5BUJ-BtndAY2_.js → 6IMQ5BUJ-1sguTKZ9.js} +2 -2
- package/dist/client/assets/{6OLKWJ4F-DNXmh00R.js → 6OLKWJ4F-9loy41nw.js} +2 -2
- package/dist/client/assets/{74OO7NKP-DbprmlDc.js → 74OO7NKP-ukQR6jKi.js} +2 -2
- package/dist/client/assets/{75O6YZUN-DZ_5zRwt.js → 75O6YZUN-BjBd5LQ0.js} +2 -2
- package/dist/client/assets/{77XECAW3-CgSkQSMJ.js → 77XECAW3-Ccw2Y7VD.js} +2 -2
- package/dist/client/assets/{ABYRPUBD-ucE-F8EO.js → ABYRPUBD-CvqVJLPf.js} +2 -2
- package/dist/client/assets/AlertDialogRoot-CimqRgXh.js +2 -0
- package/dist/client/assets/{AnimatedHeight-B2j_NXft.js → AnimatedHeight-Dwarin_V.js} +2 -2
- package/dist/client/assets/{AuthSurfaceShell-DqI-KrrY.js → AuthSurfaceShell-BvGaTutU.js} +2 -2
- package/dist/client/assets/{BB2UYUI2-CXw0vAgW.js → BB2UYUI2-Drnmium_.js} +2 -2
- package/dist/client/assets/{BUM34MOA-DBHGisGU.js → BUM34MOA-AkPmeijf.js} +2 -2
- package/dist/client/assets/{CEQABKGZ-MGn88wbo.js → CEQABKGZ-BNUlDSIK.js} +2 -2
- package/dist/client/assets/{CXAC5362-C1Fk1A6g.js → CXAC5362-Bmar3Iii.js} +2 -2
- package/dist/client/assets/{ChatGptUsageButton-_JZfpkEi.js → ChatGptUsageButton-D6Iy8SVv.js} +2 -2
- package/dist/client/assets/ChatMarkdown-DHhJpg3q.js +49 -0
- package/dist/client/assets/{CheckboxIndicator-DFCs5GRD.js → CheckboxIndicator-DbA95VlZ.js} +2 -2
- package/dist/client/assets/{ClippedText-BIwvWMlV.js → ClippedText-UM8CaEu4.js} +2 -2
- package/dist/client/assets/{CodexSetupSection.logic-B8uhmM78.js → CodexSetupSection.logic-kKJPABQZ.js} +2 -2
- package/dist/client/assets/{CollapsiblePanel-CsWNZ7jo.js → CollapsiblePanel-C1iRr4kZ.js} +2 -2
- package/dist/client/assets/{ComboboxClear-Cv9NZFNr.js → ComboboxClear-DaifQLU5.js} +2 -2
- package/dist/client/assets/{ComboboxGroupLabel-BPe0M6wJ.js → ComboboxGroupLabel-C03JGZRD.js} +2 -2
- package/dist/client/assets/{CommandBlock-BJ2nHWe_.js → CommandBlock-DH_L_Tgo.js} +2 -2
- package/dist/client/assets/{CompositeRoot-RcqGhRAf.js → CompositeRoot-B1DTZCNU.js} +2 -2
- package/dist/client/assets/{ConnectAgentSurface-kcWh3f_f.js → ConnectAgentSurface-C5bZc2ZR.js} +2 -2
- package/dist/client/assets/{ConnectionStatusDot-DIUevPBM.js → ConnectionStatusDot-CCTiSlHA.js} +2 -2
- package/dist/client/assets/{DRLTVNUE-CmpBRyx_.js → DRLTVNUE-BqWUfmRf.js} +2 -2
- package/dist/client/assets/{DYY6UVD2-rvY-xhxe.js → DYY6UVD2-CyRsghfa.js} +2 -2
- package/dist/client/assets/{DevicePanel-Bkrn90hU.js → DevicePanel-DocID7hH.js} +2 -2
- package/dist/client/assets/{DeviceSetup-BQvNWMm0.js → DeviceSetup-CX2OWVB9.js} +2 -2
- package/dist/client/assets/{DialogRoot-Dg58-QOq.js → DialogRoot-D64NsaiW.js} +2 -2
- package/dist/client/assets/{DialogTitle-CSaaIBpP.js → DialogTitle-CYefNdHm.js} +2 -2
- package/dist/client/assets/{DiffCommentAnnotation-eHSeIufV.js → DiffCommentAnnotation-ChKqFxt5.js} +2 -2
- package/dist/client/assets/{DiffFileTree-opfyNeFz.js → DiffFileTree-B6AgzOXX.js} +2 -2
- package/dist/client/assets/{DiffPanel-C4ySgbUg.js → DiffPanel-DKAHtq5x.js} +2 -2
- package/dist/client/assets/{DiffWorkerPoolProvider-BwOTmWKP.js → DiffWorkerPoolProvider-CK3y5UA1.js} +3 -3
- package/dist/client/assets/{EmbeddedDesign-BW5Rcxmc.js → EmbeddedDesign-Bj-kkArq.js} +5 -5
- package/dist/client/assets/{EnvironmentMachineIcon-DM48TG2x.js → EnvironmentMachineIcon-CJ30kzSK.js} +2 -2
- package/dist/client/assets/{ExpandableText-CYFNBBpY.js → ExpandableText-CBPvhWvZ.js} +2 -2
- package/dist/client/assets/{FNOVOB4O-B8vuCGFt.js → FNOVOB4O-DYXYw-b1.js} +2 -2
- package/dist/client/assets/{FieldControl-DHSVFpKc.js → FieldControl-CkgERQaU.js} +2 -2
- package/dist/client/assets/{FileDiff-CZk9prBc.js → FileDiff-BLuBewdN.js} +2 -2
- package/dist/client/assets/{FilePreviewPanel-BcCGkQ__.js → FilePreviewPanel-DWNimHTU.js} +4 -4
- package/dist/client/assets/{FoldedSettingsSection-COBhgfnb.js → FoldedSettingsSection-C3cuD_W9.js} +2 -2
- package/dist/client/assets/{HDGCDEEZ-DRcTM9ws.js → HDGCDEEZ-7WPyPcLr.js} +2 -2
- package/dist/client/assets/{HSJLKHB7-Dh4X6CJ4.js → HSJLKHB7-t8_OkffK.js} +2 -2
- package/dist/client/assets/{Icons-DpgbzNj8.js → Icons-BUrn1Fzo.js} +2 -2
- package/dist/client/assets/Input-Gb8KV9DV.js +2 -0
- package/dist/client/assets/{IntervalSecondsField-D0j2uU5s.js → IntervalSecondsField-D9JXVV-s.js} +2 -2
- package/dist/client/assets/JZOYTAAL-BzA5Kg5m.js +1 -0
- package/dist/client/assets/{K3MD6TGW-uz2CK9vb.js → K3MD6TGW-DoqPvoaq.js} +2 -2
- package/dist/client/assets/{K7RP3OMA-uWbuKqQP.js → K7RP3OMA--ZFOkyEG.js} +2 -2
- package/dist/client/assets/KeybindingsSettings.logic-CMs7OPcH.js +2 -0
- package/dist/client/assets/{LHDIQX7Q-BaUgpa7I.js → LHDIQX7Q-hUqw2I9B.js} +2 -2
- package/dist/client/assets/{LUXOKEGN-C-Usmwyz.js → LUXOKEGN-Dvu_mp-q.js} +2 -2
- package/dist/client/assets/{LinkMachineSelect-CB99X8v3.js → LinkMachineSelect-SHXPDP_g.js} +2 -2
- package/dist/client/assets/MathTypeset-C02HYdjx.css +1 -0
- package/dist/client/assets/{MathTypeset-Dv2b-uiV.js → MathTypeset-TM-3r0WA.js} +2 -2
- package/dist/client/assets/{ModelLiveLayer-DIrV--mW.js → ModelLiveLayer-Bb-7OhJ9.js} +3 -3
- package/dist/client/assets/{N3JZAHOW-CLD7n6Za.js → N3JZAHOW-LjhhJ-00.js} +2 -2
- package/dist/client/assets/{NUIALGQ3-CVI_F8c-.js → NUIALGQ3-Dg1KXz02.js} +2 -2
- package/dist/client/assets/{NoProjectsHero-CAoW0Xej.js → NoProjectsHero-D0OPZtzO.js} +2 -2
- package/dist/client/assets/{O65XPQGZ-g6xpsO0r.js → O65XPQGZ-BxaJR80d.js} +2 -2
- package/dist/client/assets/{O7XIQ6OM-CBkPdCIB.js → O7XIQ6OM-CCXPxMuU.js} +2 -2
- package/dist/client/assets/{OFQON5FD-DpM-bsDn.js → OFQON5FD-WUMBXQkX.js} +2 -2
- package/dist/client/assets/{P4ConnectAccountPages-CCjWOetO.js → P4ConnectAccountPages-BNK6s-RS.js} +2 -2
- package/dist/client/assets/{P4ConnectSidebarSignIn-CfEPRRB6.js → P4ConnectSidebarSignIn-CWW40SMl.js} +2 -2
- package/dist/client/assets/{PJQHF43J-Sp1j42CR.js → PJQHF43J-BrNjCaLl.js} +2 -2
- package/dist/client/assets/{PanelLayoutControls-CcdUv-ij.js → PanelLayoutControls-DiXjRWIw.js} +7 -7
- package/dist/client/assets/{PierreEntryIcon-vf9Z0_eJ.js → PierreEntryIcon-D29_Ylm_.js} +2 -2
- package/dist/client/assets/{PopoverHandle-s36xVlsK.js → PopoverHandle-BgggGdpn.js} +2 -2
- package/dist/client/assets/PreviewPanel-DutKwWE7.js +2 -0
- package/dist/client/assets/{ProjectDefaultsSettings-TlEARfjk.js → ProjectDefaultsSettings-DMfJN66D.js} +2 -2
- package/dist/client/assets/{ProjectFavicon-Dd4p_a9n.js → ProjectFavicon-DFI1NI3D.js} +3 -3
- package/dist/client/assets/{ProjectIconPickerDialog-D5UkwTkD.js → ProjectIconPickerDialog-BqGWzrTc.js} +2 -2
- package/dist/client/assets/{ProjectMonogram-Aw_ZBtDB.js → ProjectMonogram-D4xxVtw8.js} +2 -2
- package/dist/client/assets/{ProviderAuthTerminal-Cw2WcQr1.js → ProviderAuthTerminal-CRSvI-Og.js} +2 -2
- package/dist/client/assets/ProviderModelPicker-D73G0AKf.js +2 -0
- package/dist/client/assets/{ProviderSettingsForm-DaeugImp.js → ProviderSettingsForm-DchD8HSN.js} +2 -2
- package/dist/client/assets/{PullRequestCodeTab-DdfQeIIl.js → PullRequestCodeTab-BdXdTg-d.js} +3 -3
- package/dist/client/assets/{RHNBAITX-DQfv99hf.js → RHNBAITX-PsYrngSs.js} +2 -2
- package/dist/client/assets/{ReadOnlySourcePreview-Vvv9UVOM.js → ReadOnlySourcePreview-8jLKmc3M.js} +2 -2
- package/dist/client/assets/{RedactedSensitiveText-bQSbv34p.js → RedactedSensitiveText-DhV2Jdu8.js} +2 -2
- package/dist/client/assets/{RenderErrorBoundary-4-dgp9K8.js → RenderErrorBoundary-56lc2IQ3.js} +3 -3
- package/dist/client/assets/{RightPanelResizeHandle-B6vIzqA0.js → RightPanelResizeHandle-ClzdYxWw.js} +2 -2
- package/dist/client/assets/{SLD4V6NK-BKBt5rH4.js → SLD4V6NK-CxidvPXU.js} +2 -2
- package/dist/client/assets/{ScheduledTasksSettings-Dbz9TZ6o.js → ScheduledTasksSettings-BdMCgBm5.js} +5 -5
- package/dist/client/assets/{ScopedSwitch-D1e9m-dH.js → ScopedSwitch-CwnjCta_.js} +2 -2
- package/dist/client/assets/{ScrollAreaCorner-Cn2VDisz.js → ScrollAreaCorner-CfTQYjCW.js} +2 -2
- package/dist/client/assets/{SecretInput-C6zW-8wI.js → SecretInput-BYfVbTLh.js} +2 -2
- package/dist/client/assets/{SelectScrollUpArrow-C40FP3vq.js → SelectScrollUpArrow-BE0-tVtP.js} +2 -2
- package/dist/client/assets/{SelfImproveSettingsSection-WXBG9l_4.js → SelfImproveSettingsSection-DsqFeICK.js} +2 -2
- package/dist/client/assets/{SettingsPanels-BEtJwC6n.js → SettingsPanels-D_rJsyjt.js} +14 -14
- package/dist/client/assets/{SettingsPanels.logic-y95n8OOO.js → SettingsPanels.logic-BTJUBh-T.js} +2 -2
- package/dist/client/assets/{SettingsScopeNotice-DE1t1kw-.js → SettingsScopeNotice-CAVvn3pQ.js} +2 -2
- package/dist/client/assets/{SidebarStageBackdrop-CYLpofvt.js → SidebarStageBackdrop-DdxWuxIk.js} +2 -2
- package/dist/client/assets/{T3PCR2KE-BryFgp5Q.js → T3PCR2KE-BtQsKjM5.js} +2 -2
- package/dist/client/assets/{TKWO2OVW-DcRjYaVG.js → TKWO2OVW-CeYF-suq.js} +2 -2
- package/dist/client/assets/{TSHNXIZL-hAylFob1.js → TSHNXIZL-FQ7ZWHEn.js} +2 -2
- package/dist/client/assets/{ThemeEditorPanel-DeGNehj1.js → ThemeEditorPanel-BJucNhy-.js} +2 -2
- package/dist/client/assets/{ThreadDetailsItemsMenu-D0mfEKtW.js → ThreadDetailsItemsMenu-CRBBIuc7.js} +10 -10
- package/dist/client/assets/ThreadTerminalDrawer-Ci0mbLzJ.js +5 -0
- package/dist/client/assets/{TooltipProvider-DQ0TF9NB.js → TooltipProvider-BH5ni_Lo.js} +2 -2
- package/dist/client/assets/{UQJE5E4I-BfaZIz58.js → UQJE5E4I-CeqBk-r6.js} +2 -2
- package/dist/client/assets/{USNYFO5S-jOq8Kcgw.js → USNYFO5S-_1m41tJt.js} +2 -2
- package/dist/client/assets/{Virtualizer-B3FSTwJv.js → Virtualizer-DLB0FYm-.js} +2 -2
- package/dist/client/assets/{WEVWDWVA-1T3GTRY3.js → WEVWDWVA-DmSV8HLL.js} +2 -2
- package/dist/client/assets/{WorkspaceBreadcrumb-Dno2N8Xd.js → WorkspaceBreadcrumb-DQkeBQUl.js} +2 -2
- package/dist/client/assets/{WorkspacePageContainer-OLpcgD_f.js → WorkspacePageContainer-D2rx9iDg.js} +2 -2
- package/dist/client/assets/{WorkspacePageHeader-Bn0m4gpR.js → WorkspacePageHeader-D8-RIRjQ.js} +2 -2
- package/dist/client/assets/{X5RFHQXM-CaiE8-NB.js → X5RFHQXM-BUdDYXox.js} +2 -2
- package/dist/client/assets/{X62E3GBT-CKnjYZvp.js → X62E3GBT-BbQ7FmNB.js} +2 -2
- package/dist/client/assets/{XBNEOJTC-DF-d22o-.js → XBNEOJTC-BLEZA-vx.js} +2 -2
- package/dist/client/assets/{YHV2MVVZ-VSj4WI2u.js → YHV2MVVZ-DM2RTtkR.js} +2 -2
- package/dist/client/assets/{YURCZMG2-C9wxlavt.js → YURCZMG2-D5w6cPMY.js} +2 -2
- package/dist/client/assets/{YVG2LODB-JRtigNQC.js → YVG2LODB-BkLbsaCo.js} +2 -2
- package/dist/client/assets/_chat-CKMs-ajx.js +47 -0
- package/dist/client/assets/{_chat.design-DxTdYmIe.js → _chat.design-CpqXODBn.js} +2 -2
- package/dist/client/assets/{_chat.index-CNIRuBqG.js → _chat.index-B0eOfZAf.js} +2 -2
- package/dist/client/assets/_chat.new-CqLuDynd.js +4 -0
- package/dist/client/assets/{_chat.pull-requests-C6rdgLS9.js → _chat.pull-requests-C4Eo8GDQ.js} +2 -2
- package/dist/client/assets/{alert-CfhQnxcL.js → alert-D1O9oex3.js} +2 -2
- package/dist/client/assets/{alert-dialog-Dn_PRSFU.js → alert-dialog-3XDceRWv.js} +2 -2
- package/dist/client/assets/{assetUrls-BMizLezw.js → assetUrls-Dq0gsqWs.js} +2 -2
- package/dist/client/assets/{assets-DT0KoRIr.js → assets-C3_UZib9.js} +2 -2
- package/dist/client/assets/{browserHistoryStore-xnY5QhfE.js → browserHistoryStore-CVCo7qfb.js} +2 -2
- package/dist/client/assets/{browserLinkTarget-CH-4nkAf.js → browserLinkTarget-CopcRHna.js} +2 -2
- package/dist/client/assets/{checkbox-iFzfBLKr.js → checkbox-CxRqp4sO.js} +2 -2
- package/dist/client/assets/{color-picker-W1NtR7ha.js → color-picker-CvbP7BS3.js} +2 -2
- package/dist/client/assets/{combobox-B0IMIA-1.js → combobox-CuyUAuiC.js} +2 -2
- package/dist/client/assets/command-4bqVdX0m.js +2 -0
- package/dist/client/assets/{connect-BflmwHyv.js → connect-DFGquf-O.js} +2 -2
- package/dist/client/assets/connect-agent-Db5rxxY1.js +2 -0
- package/dist/client/assets/{design-B_bv-H7n.js → design-DzoN9JgQ.js} +2 -2
- package/dist/client/assets/{device-i4SkE05R.js → device-H2MyT_kA.js} +2 -2
- package/dist/client/assets/{dialog-DFlZvvht.js → dialog-CrLVN_m6.js} +2 -2
- package/dist/client/assets/{diffPanelStore-CGdPbp5I.js → diffPanelStore-CxnPNigi.js} +2 -2
- package/dist/client/assets/{diffRendering-B7lkQ5_O.js → diffRendering-cyTQV5bk.js} +2 -2
- package/dist/client/assets/{dist-BvS7KgJD.js → dist-J7s-H61h.js} +3 -3
- package/dist/client/assets/{draft-input-1HTN8QVo.js → draft-input-UuEBPJE8.js} +2 -2
- package/dist/client/assets/{duoViewer-DbnFva5H.js → duoViewer-C3DQnADY.js} +2 -2
- package/dist/client/assets/{dynamic-DmVpEfW3.js → dynamic-PDa6LTqb.js} +2 -2
- package/dist/client/assets/{embeddedScripts-D0-ABFFC.js → embeddedScripts-BDzRNXSL.js} +2 -2
- package/dist/client/assets/{empty-Dn5VI2Xk.js → empty-YMXgQbNI.js} +2 -2
- package/dist/client/assets/entities-HOBDIiHK.js +2 -0
- package/dist/client/assets/fileLinks-BlT4My6t.js +2 -0
- package/dist/client/assets/{fileTreeExpansion-Bp5eLBXI.js → fileTreeExpansion-D5nN-Oqd.js} +2 -2
- package/dist/client/assets/{getDiffFileInput-CKgGUEGl.js → getDiffFileInput-4gToQuSl.js} +2 -2
- package/dist/client/assets/{htmlRender-BdsR_7vV.js → htmlRender-CUGVJXGf.js} +2 -2
- package/dist/client/assets/{index-DQKD4Lk2.js → index-C04a0SKq.js} +3 -3
- package/dist/client/assets/{input-yaZxaTds.js → input-DxHa9qj5.js} +2 -2
- package/dist/client/assets/{input-group-B1TOCtDG.js → input-group-_rAbDbys.js} +2 -2
- package/dist/client/assets/katex-B940_AAO.js +258 -0
- package/dist/client/assets/{kbd-R7rkirqT.js → kbd-DjUfNaix.js} +2 -2
- package/dist/client/assets/{keybindings-CrlWqd5q.js → keybindings-8_1sqf8s.js} +2 -2
- package/dist/client/assets/{lazy-C5ansoaW.js → lazy-C1dqAep6.js} +4 -4
- package/dist/client/assets/{lazyRouteComponent-BxpFJiXB.js → lazyRouteComponent-DLamKhHF.js} +2 -2
- package/dist/client/assets/{link-2ZiGGBbw.js → link-D1nkgCv7.js} +2 -2
- package/dist/client/assets/{linkedPrompt-CwNmoWmu.js → linkedPrompt-Quysf0mk.js} +2 -2
- package/dist/client/assets/main-BFdCLmkY.js +39 -0
- package/dist/client/assets/main-BQBpA03z.css +2 -0
- package/dist/client/assets/mediaReference-D19Dzoh3.js +2 -0
- package/dist/client/assets/mediaSource-DfsR3T70.js +2 -0
- package/dist/client/assets/{modelScene-D8CdQkcp.js → modelScene-CcF-Uii-.js} +2 -2
- package/dist/client/assets/{number-field-DNna9ps3.js → number-field-CALZZPio.js} +2 -2
- package/dist/client/assets/{observeResize-Cz6dJUG2.js → observeResize-DLmefMqO.js} +2 -2
- package/dist/client/assets/{onboarding-BG6FdUUU.js → onboarding-plATuZco.js} +2 -2
- package/dist/client/assets/{openFileInPreview-BaemzSTr.js → openFileInPreview-BCGQQ_Ia.js} +2 -2
- package/dist/client/assets/{p4ProjectFile-O_tvpvNW.js → p4ProjectFile-DCNJ4pTp.js} +2 -2
- package/dist/client/assets/{pair-BNIczJXa.js → pair-umv6-haX.js} +2 -2
- package/dist/client/assets/{pendingSendStore-Cc6n4Xji.js → pendingSendStore-CgfQk4GV.js} +2 -2
- package/dist/client/assets/{phoneViewer-CqawjVDW.js → phoneViewer-DJWjzgFc.js} +2 -2
- package/dist/client/assets/{pierre-icons-BfZ11Q2h.js → pierre-icons-fv1goMS6.js} +2 -2
- package/dist/client/assets/{popover-DnYfrQly.js → popover-DxCAIK62.js} +2 -2
- package/dist/client/assets/preview-Ce5ECOHv.js +2 -0
- package/dist/client/assets/{preview-Bi-hPWTp.js → preview-x1tmlUez.js} +2 -2
- package/dist/client/assets/{previewMiniPlayerStore-W10VSM09.js → previewMiniPlayerStore-CEd7VI6J.js} +2 -2
- package/dist/client/assets/{primary-CDuW5QwW.js → primary-DcnaBKM0.js} +2 -2
- package/dist/client/assets/{primaryCloudLinkState-BONYlcei.js → primaryCloudLinkState-TS0IW37f.js} +2 -2
- package/dist/client/assets/{projectFilesQueryState-Ck4wjfaq.js → projectFilesQueryState-DKw9S3nn.js} +2 -2
- package/dist/client/assets/{projectScriptEditor-DgVU8tRa.js → projectScriptEditor-DT7-Ivvb.js} +2 -2
- package/dist/client/assets/{providerSkills-Dfc0PY_E.js → providerSkills-G8ld9nNp.js} +2 -2
- package/dist/client/assets/pullRequestDetail.logic-Dm3mx1US.js +10 -0
- package/dist/client/assets/{pullRequestIcons-DwblWS4R.js → pullRequestIcons-D8rnFTkk.js} +2 -2
- package/dist/client/assets/{pullRequestReviewStore-Cc4bHb4o.js → pullRequestReviewStore-C45fih_P.js} +2 -2
- package/dist/client/assets/{pullRequests-BSjV3BBU.js → pullRequests-euX1Ch2G.js} +2 -2
- package/dist/client/assets/queries-DNRXml7d.js +2 -0
- package/dist/client/assets/query-Bw8YoCbO.js +2 -0
- package/dist/client/assets/{radio-group-EK7EPCn2.js → radio-group-DpD3XHAp.js} +2 -2
- package/dist/client/assets/{relay-Ceq0htTl.js → relay-YiJpGyaO.js} +2 -2
- package/dist/client/assets/{relayFailureReason-DfHD60Z_.js → relayFailureReason-Baxcpnas.js} +2 -2
- package/dist/client/assets/{renderScheduler-BGJGU9W9.js → renderScheduler-BuGbk7RK.js} +2 -2
- package/dist/client/assets/{rightPanelStore-AjYoRisO.js → rightPanelStore-BF1zmmXM.js} +2 -2
- package/dist/client/assets/runtime-DIAcbMTc.js +9 -0
- package/dist/client/assets/{runtimeModeConfig-Oh86kRYJ.js → runtimeModeConfig-4g_-_dE2.js} +2 -2
- package/dist/client/assets/{scheduledTasksSettings.logic-h-rZbNI3.js → scheduledTasksSettings.logic-BOrkdeD3.js} +3 -3
- package/dist/client/assets/{scroll-area-DhDCLqyU.js → scroll-area-CokPD3-i.js} +2 -2
- package/dist/client/assets/{select-CNcZzYBl.js → select-CxYi0YMi.js} +2 -2
- package/dist/client/assets/{selfImproveFindings-CvQXlaMJ.js → selfImproveFindings-CE-lxRTw.js} +2 -2
- package/dist/client/assets/{server-Bw1ZPPkk.js → server-BNjk2K1j.js} +2 -2
- package/dist/client/assets/{session-YEQs2e4k.js → session-DMNo4Bh3.js} +2 -2
- package/dist/client/assets/{session-logic-BOQRidTa.js → session-logic-CELyWJ1v.js} +4 -4
- package/dist/client/assets/{settings-Dj9xov5g.js → settings-Bt6o5coA.js} +2 -2
- package/dist/client/assets/{settings.appearance-BFkpCG_N.js → settings.appearance-pkRxkhgs.js} +2 -2
- package/dist/client/assets/settings.archived-OjOh5b0A.js +2 -0
- package/dist/client/assets/{settings.computer-use-Bi6Yznts.js → settings.computer-use-Dh6Z2-Jg.js} +2 -2
- package/dist/client/assets/settings.connections-F3LWiK8-.js +2 -0
- package/dist/client/assets/{settings.data-controls-CMPajamk.js → settings.data-controls-DgOo9a4b.js} +2 -2
- package/dist/client/assets/{settings.decisions-BaYWexvw.js → settings.decisions-lQFEkC9t.js} +2 -2
- package/dist/client/assets/settings.designs-C1tyiETD.js +2 -0
- package/dist/client/assets/settings.diagnostics-kp_wJw6e.js +2 -0
- package/dist/client/assets/{settings.general-BqeVFfxZ.js → settings.general-B5Kke4t3.js} +2 -2
- package/dist/client/assets/{settings.integrations-CYmWtYZT.js → settings.integrations-CjiKCDy_.js} +2 -2
- package/dist/client/assets/{settings.keybindings-Rdl8b88k.js → settings.keybindings-CouYSmxE.js} +2 -2
- package/dist/client/assets/{settings.open-source-licenses-C-Brz8iy.js → settings.open-source-licenses-CHFTLx1q.js} +2 -2
- package/dist/client/assets/settings.plugins-StUBBho3.js +5 -0
- package/dist/client/assets/{settings.projects-BTKNVvto.js → settings.projects-B_SxK9Cl.js} +4 -4
- package/dist/client/assets/settings.providers-Ch16WkgV.js +3 -0
- package/dist/client/assets/{settings.scheduled-tasks-Da_-twWT.js → settings.scheduled-tasks-KNcUc94O.js} +2 -2
- package/dist/client/assets/{settings.secrets-B_ZY_xsv.js → settings.secrets-2aMmfgKR.js} +2 -2
- package/dist/client/assets/{settings.snap-shot-lnIAMmUa.js → settings.snap-shot-B5cEBXZD.js} +2 -2
- package/dist/client/assets/settings.source-control-G_TX95re.js +2 -0
- package/dist/client/assets/settings.storage-BdNNKm9m.js +2 -0
- package/dist/client/assets/settingsLayout-CzGbLP4v.js +3 -0
- package/dist/client/assets/{sidebar-BUDllWET.js → sidebar-ovj9EiR4.js} +2 -2
- package/dist/client/assets/{sidebarProjectGrouping-xYoX3lLq.js → sidebarProjectGrouping-DT6LCDEX.js} +2 -2
- package/dist/client/assets/{skeleton-C6O21cqb.js → skeleton-0IEb3e4e.js} +2 -2
- package/dist/client/assets/sourceControl-CPobWWHq.js +2 -0
- package/dist/client/assets/{sourceControlClients-C3cHOUoL.js → sourceControlClients-4PlkytxQ.js} +2 -2
- package/dist/client/assets/{spinner-m1uNq_wW.js → spinner-7CSKKESP.js} +2 -2
- package/dist/client/assets/src-BVovWpja.js +15 -0
- package/dist/client/assets/{terminal-links-CxLXIwP1.js → terminal-links-BTdovUFa.js} +2 -2
- package/dist/client/assets/{terminalSessions-CXGA3pch.js → terminalSessions-EUiRWJti.js} +2 -2
- package/dist/client/assets/{textarea-xZYMC9X5.js → textarea-DMmmmGA1.js} +2 -2
- package/dist/client/assets/{themePalette-BcMO2M90.js → themePalette-C7ZOgucT.js} +2 -2
- package/dist/client/assets/{threadCheckpoints-DUorxvL1.js → threadCheckpoints-DjIk4Kvg.js} +2 -2
- package/dist/client/assets/{toggle-DumCe7R7.js → toggle-4vFx94TS.js} +2 -2
- package/dist/client/assets/{toggle-group-CzE2mG-B.js → toggle-group-d6H735Xi.js} +2 -2
- package/dist/client/assets/{tooltip-BhCWnsdW.js → tooltip-CGvxq8k3.js} +2 -2
- package/dist/client/assets/{uiStateStore-JOwhQqDV.js → uiStateStore-MbQdhAPp.js} +2 -2
- package/dist/client/assets/{usage-Blib8u_-.js → usage-Da_tm2dn.js} +2 -2
- package/dist/client/assets/{usageAccess-COKmar79.js → usageAccess-B-HGPPkp.js} +2 -2
- package/dist/client/assets/{usageFormat-2913AogD.js → usageFormat-DcON9Kz_.js} +2 -2
- package/dist/client/assets/{usageShortcuts-U_aRtpf7.js → usageShortcuts-B_o9XxKX.js} +2 -2
- package/dist/client/assets/{use-atom-command-DkmE-pw9.js → use-atom-command-C4Tyb1VL.js} +2 -2
- package/dist/client/assets/{useAriaLabelledBy-BiZIzNf7.js → useAriaLabelledBy-CcwjH1QH.js} +2 -2
- package/dist/client/assets/useHandleNewThread-Qb_yy6KY.js +2 -0
- package/dist/client/assets/{useLocation-BXwb7I1F.js → useLocation-CIvcNoeU.js} +2 -2
- package/dist/client/assets/{useNavigate-P1p3Es15.js → useNavigate-DVrOlf8m.js} +2 -2
- package/dist/client/assets/{useNavigateBack-D02Al7yk.js → useNavigateBack-Dmf0SIc3.js} +2 -2
- package/dist/client/assets/{useP4ConnectAuthPrompt-4l_tJOsn.js → useP4ConnectAuthPrompt-BPXqJdyY.js} +2 -2
- package/dist/client/assets/{useParams-DsmZTF__.js → useParams-BeJIRxxE.js} +2 -2
- package/dist/client/assets/{usePermissionStatus-DeJYBk6u.js → usePermissionStatus-Cx1Wuwk0.js} +2 -2
- package/dist/client/assets/{usePopupViewport-BBKn7x_4.js → usePopupViewport-OR_PF2s-.js} +2 -2
- package/dist/client/assets/{usePullRequestActions-DtDOHLgX.js → usePullRequestActions-B_Nrg846.js} +2 -2
- package/dist/client/assets/{useRegisterFieldControl-DkFmgEzw.js → useRegisterFieldControl-B72Afmil.js} +2 -2
- package/dist/client/assets/{useScopedModelAvailability-B-vTMNh_.js → useScopedModelAvailability-DVQ42jT4.js} +2 -2
- package/dist/client/assets/{useSettings-Dp27sUML.js → useSettings-BWMcQzC-.js} +2 -2
- package/dist/client/assets/{utils-BVnIIHXP.js → utils-DFNDxNZi.js} +21 -21
- package/dist/client/assets/{vcsRefInvalidation-DU1ipBl9.js → vcsRefInvalidation-CV8dYgi0.js} +2 -2
- package/dist/client/assets/{welcome-CmsT2lJW.js → welcome-BxhPM21H.js} +2 -2
- package/dist/client/index.html +1 -1
- package/dist/client/third-party-licenses.json +1 -1
- package/dist/{mcpResponsePayloads-C8W7Qyxk.mjs → mcpResponsePayloads-SwQXsZoI.mjs} +3 -3
- package/dist/{preview-iNdhUsAa.mjs → preview-BGylKXB6.mjs} +235 -101
- package/dist/{renderer-DKOOIEoX.mjs → renderer-CQkeNW9b.mjs} +2 -2
- package/dist/{runtime-Bm_EVnst.mjs → runtime-O5AWAEzD.mjs} +3 -3
- package/dist/{runtimeLayer-hDhX2kHB.mjs → runtimeLayer-C-Fo4HWH.mjs} +1 -1
- package/dist/{runtimeLayer-CZ8Ru7Ia.mjs → runtimeLayer-ChPBglJB.mjs} +2298 -1209
- package/dist/{sdk-CcrYY4k4.mjs → sdk-C8tgjyIq.mjs} +29609 -23199
- package/dist/{server-qfCj2NpU.mjs → server-CsS0d2BE.mjs} +358 -88
- package/dist/{sha2-Daa2Fiv1.mjs → sha2-BjjJcoUu.mjs} +449 -24
- package/package.json +1 -1
- package/dist/AcpMcpStdioBridge-C9Ry_oCI.mjs +0 -3
- package/dist/client/assets/AlertDialogRoot-CNpt8h9w.js +0 -2
- package/dist/client/assets/ChatMarkdown-DO_2fTqM.js +0 -49
- package/dist/client/assets/Input-BT2VVALp.js +0 -2
- package/dist/client/assets/JZOYTAAL-BCzM9Qh2.js +0 -1
- package/dist/client/assets/KeybindingsSettings.logic-oAUXQqts.js +0 -2
- package/dist/client/assets/MathTypeset-DEcVZfaU.css +0 -1
- package/dist/client/assets/PreviewPanel-DIVx5x1H.js +0 -2
- package/dist/client/assets/ProviderModelPicker-rRVcFLyP.js +0 -2
- package/dist/client/assets/ThreadTerminalDrawer-B77-xYz_.js +0 -5
- package/dist/client/assets/_chat-BA5cbHxE.js +0 -47
- package/dist/client/assets/_chat.new-Bw2VR60x.js +0 -4
- package/dist/client/assets/command-BdVxwZ8D.js +0 -2
- package/dist/client/assets/connect-agent-AVHGyda5.js +0 -2
- package/dist/client/assets/entities-JWl3bvMT.js +0 -2
- package/dist/client/assets/fileLinks-Y3tOmcmb.js +0 -2
- package/dist/client/assets/katex-DJhrJSbw.js +0 -258
- package/dist/client/assets/main-43D2LVmx.js +0 -38
- package/dist/client/assets/main-Rpw_0nEx.css +0 -2
- package/dist/client/assets/mediaReference-Bh7Pydqp.js +0 -2
- package/dist/client/assets/mediaSource-Do7lCSv7.js +0 -2
- package/dist/client/assets/preview-Dd9kGZBH.js +0 -2
- package/dist/client/assets/pullRequestDetail.logic-Dy7e4vh2.js +0 -10
- package/dist/client/assets/queries-BQAICaPF.js +0 -2
- package/dist/client/assets/query-DFSffMGJ.js +0 -2
- package/dist/client/assets/runtime-vb0YwEUc.js +0 -9
- package/dist/client/assets/settings.archived-D96oQP2t.js +0 -2
- package/dist/client/assets/settings.connections-C7OGFqf1.js +0 -2
- package/dist/client/assets/settings.designs-t7-jewWy.js +0 -2
- package/dist/client/assets/settings.diagnostics-qkp4kADk.js +0 -2
- package/dist/client/assets/settings.plugins-DAvzBYum.js +0 -5
- package/dist/client/assets/settings.providers-r89DCT90.js +0 -3
- package/dist/client/assets/settings.source-control-BIPVuyIo.js +0 -2
- package/dist/client/assets/settings.storage-vvoP_prr.js +0 -2
- package/dist/client/assets/settingsLayout-DaKDuaST.js +0 -3
- package/dist/client/assets/sourceControl-gh0Nj17P.js +0 -2
- package/dist/client/assets/src-DHn7yNZx.js +0 -15
- package/dist/client/assets/useHandleNewThread-C1YHLGL_.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{$c as i,$l as a,Hu as o,Jo as s,Ju as c,Ou as l,Tu as u,hr as d,md as f,ml as p,mr as m,nu as h,ru as g,t as _,tl as v}from"./utils-DFNDxNZi.js";import{Qi as y,Tg as b,Vm as x,Xi as S,_g as ee,ju as C,ra as w,ug as T,vg as te,xg as ne}from"./src-BVovWpja.js";import{Ar as re,Tr as ie}from"./runtime-DIAcbMTc.js";import{m as E,p as D,u as O}from"./TooltipProvider-BH5ni_Lo.js";import{a as k,m as A}from"./relay-YiJpGyaO.js";import{O as j,q as ae}from"./useSettings-BWMcQzC-.js";import{f as M}from"./server-BNjk2K1j.js";import{i as oe,n as N,t as se}from"./session-DMNo4Bh3.js";import{n as P}from"./query-Bw8YoCbO.js";import{t as ce}from"./use-atom-command-C4Tyb1VL.js";import{a as le,o as ue,u as de}from"./timestampFormat-Dq7sHZpd.js";import{a as F,n as I,t as L}from"./tooltip-CGvxq8k3.js";import{n as fe,t as R}from"./toggle-group-d6H735Xi.js";import{t as pe}from"./input-DxHa9qj5.js";import{t as z}from"./scroll-area-CokPD3-i.js";import{L as me,U as he,i as ge,s as B,u as _e}from"./settingsLayout-CzGbLP4v.js";import{t as ve}from"./ConnectionStatusDot-CCTiSlHA.js";import{Io as ye,gn as V,ha as be,zo as H}from"./main-BFdCLmkY.js";import{t as xe}from"./usageAccess-B-HGPPkp.js";import{t as Se}from"./ExpandableText-CBPvhWvZ.js";import{t as Ce}from"./SettingsScopeNotice-CAVvn3pQ.js";var U=n(),W=e(r(),1);function we(e){let t=(0,U.c)(19),{disabled:n,onSignal:r}=e,i;t[0]===r?i=t[1]:(i=()=>r(`SIGINT`),t[0]=r,t[1]=i);let a;t[2]!==n||t[3]!==i?(a=(0,W.jsx)(F,{render:(0,W.jsx)(d,{disabled:n,"aria-label":`Send SIGINT`,tone:`muted`,onClick:i,children:`INT`})}),t[2]=n,t[3]=i,t[4]=a):a=t[4];let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,W.jsx)(I,{side:`top`,children:`Send SIGINT`}),t[5]=o):o=t[5];let s;t[6]===a?s=t[7]:(s=(0,W.jsxs)(L,{children:[a,o]}),t[6]=a,t[7]=s);let c;t[8]===r?c=t[9]:(c=()=>r(`SIGKILL`),t[8]=r,t[9]=c);let l;t[10]!==n||t[11]!==c?(l=(0,W.jsx)(F,{render:(0,W.jsx)(d,{disabled:n,"aria-label":`Send SIGKILL`,tone:`destructive`,onClick:c,children:`KILL`})}),t[10]=n,t[11]=c,t[12]=l):l=t[12];let u;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,W.jsx)(I,{side:`top`,children:`Send SIGKILL`}),t[13]=u):u=t[13];let f;t[14]===l?f=t[15]:(f=(0,W.jsxs)(L,{children:[l,u]}),t[14]=l,t[15]=f);let p;return t[16]!==s||t[17]!==f?(p=(0,W.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[s,f]}),t[16]=s,t[17]=f,t[18]=p):p=t[18],p}var G=e(t(),1);function Te(e){let t=j(),n=e===void 0?t?.environmentId??null:e,r=oe(n,S),i=P(n===null||!r?null:M.resourceTelemetry({environmentId:n,input:{}})),a=ce(M.retryResourceTelemetry,{reportFailure:!1}),o=(0,G.useCallback)(async()=>{if(n===null)throw Error(`No environment is selected.`);if(!N(n,`environment:maintain`)||!N(n,`diagnostics:read`))throw Error(`This connection cannot restart the resource monitor.`);let e=await a({environmentId:n,input:{}});if(e._tag===`Failure`)throw x(e.cause);return i.refresh(),e.value.snapshot},[n,a]);return{...i,retry:o}}function Ee(e,t){let n=(0,U.c)(4),r=j(),i=t===void 0?r?.environmentId??null:t,a=oe(i,S),o;return n[0]!==a||n[1]!==i||n[2]!==e?(o=i===null||!a?null:M.resourceTelemetryHistory({environmentId:i,input:e}),n[0]=a,n[1]=i,n[2]=e,n[3]=o):o=n[3],P(o)}function De(e){return`${e.identity.pid}:${e.identity.startTimeMs}`}function Oe(e,t){let n=new Map;for(let t of e){let e=n.get(t.ppid)??[];e.push(t),n.set(t.ppid,e)}let r=new Set,i=e=>{for(let t of n.get(e)??[]){let e=De(t);r.has(e)||(r.add(e),i(t.identity.pid))}};for(let n of e)t.has(De(n))&&i(n.identity.pid);return e.filter(e=>!r.has(De(e)))}function ke(e){return e.nativeStatus===null&&e.error!==null||e.nativeStatus===`degraded`||e.nativeStatus===`unavailable`||e.nativeStatus===`stopped`}function K(e){return e.value<=0?0:Math.max(e.minimumVisiblePercent,e.value/Math.max(1,e.max)*100)}function Ae(e){return Math.max(1,...e.map(e=>e.avgCpuPercent))}var q=[{label:`5m`,windowMs:3e5,bucketMs:15e3},{label:`15m`,windowMs:9e5,bucketMs:3e4},{label:`30m`,windowMs:18e5,bucketMs:6e4},{label:`1h`,windowMs:36e5,bucketMs:12e4}];function J(e){return`${V(e)}/s`}function je(e){let t=e/1e3;if(t<60)return`${t.toFixed(t>=10?1:2).replace(/\.0+$/,``)}s`;let n=t/60;return n<60?`${n.toFixed(n>=10?1:2).replace(/\.0+$/,``)}m`:`${(n/60).toFixed(2).replace(/\.0+$/,``)}h`}function Me(e){return e<1e3?`${Math.round(e)} µs`:e<1e6?`${(e/1e3).toFixed(2).replace(/\.0+$/,``)} ms`:`${(e/1e6).toFixed(2).replace(/\.0+$/,``)} s`}function Ne(e){if(e<1e3)return`${Math.max(0,Math.round(e))} ms`;let t=e/1e3;return`${t.toLocaleString(void 0,{maximumFractionDigits:1})} ${t===1?`second`:`seconds`}`}function Pe(e){return`${e.identity.pid}:${e.identity.startTimeMs}`}function Fe(e){return`${e.identity.pid}:${e.identity.startTimeMs}`}function Ie(e){if(e.name.trim())return e.name;let t=(e.command.trim().split(/\s+/)[0]??e.command).replace(/^['"]|['"]$/g,``);return t.split(/[\\/]/).findLast(e=>e.length>0)??t}function Le(e){switch(e){case`server`:return`Server`;case`server-child`:return`Backend child`;case`provider-root`:return`Provider`;case`terminal-root`:return`Terminal`;case`electron-main`:return`Electron main`;case`electron-renderer`:return`Renderer`;case`electron-gpu`:return`GPU`;case`electron-utility`:return`Electron utility`;case`resource-monitor`:return`Monitor`;case`unknown-p4`:return`P4 process`}}function Re(e){return e===`resource-monitor`?`bg-warning`:e.startsWith(`electron-`)?`bg-info`:e===`server`?`bg-violet-500`:`bg-success`}function ze(e){switch(e){case`storage`:return`Storage bytes`;case`logical`:return`Logical bytes`;case`all-io`:return`All I/O bytes`;case`unavailable`:return`Unavailable`}}function Be(e,t){return e===`true`?t.true:e===`false`?t.false:`Unknown`}function Ve(e){return e===`healthy`?`default`:e===`starting`||e===`degraded`?`warning`:`danger`}function He(e){let t=(0,U.c)(20),{label:n,status:r,presentation:i}=e,a;t[0]!==i?.tone||t[1]!==r?(a=i?.tone??Ve(r),t[0]=i?.tone,t[1]=r,t[2]=a):a=t[2];let o=a,s=o===`neutral`&&`border-border/70 bg-muted/45 text-muted-foreground`,c=o==="default"&&`border-success/25 bg-success/10 text-success-foreground`,l=o===`warning`&&`border-warning/30 bg-warning/10 text-warning-foreground`,u=o===`danger`&&`border-destructive/30 bg-destructive/10 text-destructive`,d;t[3]!==s||t[4]!==c||t[5]!==l||t[6]!==u?(d=_(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-3xs font-semibold uppercase tracking-widest`,s,c,l,u),t[3]=s,t[4]=c,t[5]=l,t[6]=u,t[7]=d):d=t[7];let f=o===`neutral`&&`bg-muted-foreground/55`,p=o==="default"&&`bg-success`,m=o===`warning`&&`bg-warning`,h=o===`danger`&&`bg-destructive`,g;t[8]!==h||t[9]!==f||t[10]!==p||t[11]!==m?(g=_(`size-1.5 rounded-full`,f,p,m,h),t[8]=h,t[9]=f,t[10]=p,t[11]=m,t[12]=g):g=t[12];let v;t[13]===g?v=t[14]:(v=(0,W.jsx)(`span`,{className:g}),t[13]=g,t[14]=v);let y=i?.label??r,b;return t[15]!==n||t[16]!==v||t[17]!==y||t[18]!==d?(b=(0,W.jsxs)(`span`,{className:d,children:[v,n,` `,y]}),t[15]=n,t[16]=v,t[17]=y,t[18]=d,t[19]=b):b=t[19],b}function Ue(e){let t=(0,U.c)(9),{sampledAt:n}=e;if(_e(),!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,W.jsx)(`span`,{className:`text-2xs text-muted-foreground/55`,children:`Waiting for sample`}),t[0]=e):e=t[0],e}let r;t[1]===n?r=t[2]:(r=le(C(n)),t[1]=n,t[2]=r);let i=r;if(!i){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,W.jsx)(`span`,{className:`text-2xs text-muted-foreground/55`,children:`Waiting for sample`}),t[3]=e):e=t[3],e}let a;t[4]===i.value?a=t[5]:(a=(0,W.jsx)(`span`,{className:`font-mono tabular-nums`,children:i.value}),t[4]=i.value,t[5]=a);let o=i.suffix?` ${i.suffix}`:``,s;return t[6]!==a||t[7]!==o?(s=(0,W.jsxs)(`span`,{className:`text-2xs text-muted-foreground/60`,children:[`Updated `,a,o]}),t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function Y(e){let t=(0,U.c)(19),{icon:n,label:r,value:i,detail:a,tone:o}=e,s=o===void 0?`default`:o,c;t[0]===n?c=t[1]:(c=(0,W.jsx)(`span`,{className:`text-muted-foreground/55 transition-colors group-hover:text-foreground/65`,children:n}),t[0]=n,t[1]=c);let l;t[2]===r?l=t[3]:(l=(0,W.jsx)(`span`,{className:`truncate`,children:r}),t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-3xs font-semibold uppercase tracking-widest text-muted-foreground/70`,children:[c,l]}),t[4]=c,t[5]=l,t[6]=u):u=t[6];let d=s===`warning`&&`text-warning-foreground`,f=s===`danger`&&`text-destructive`,p;t[7]!==d||t[8]!==f?(p=_(`mt-2.5 truncate font-mono text-2xl font-semibold tracking-tighter tabular-nums text-foreground`,d,f),t[7]=d,t[8]=f,t[9]=p):p=t[9];let m;t[10]!==p||t[11]!==i?(m=(0,W.jsx)(`div`,{className:p,children:i}),t[10]=p,t[11]=i,t[12]=m):m=t[12];let h;t[13]===a?h=t[14]:(h=a?(0,W.jsx)(`div`,{className:`mt-1.5 truncate text-3xs text-muted-foreground/60`,children:a}):null,t[13]=a,t[14]=h);let g;return t[15]!==u||t[16]!==m||t[17]!==h?(g=(0,W.jsxs)(`div`,{className:`group min-w-0 px-4 py-4 sm:px-5`,children:[u,m,h]}),t[15]=u,t[16]=m,t[17]=h,t[18]=g):g=t[18],g}function We(e){let t=(0,U.c)(37),{label:n,accentClass:r,aggregate:i}=e,a;t[0]===r?a=t[1]:(a=_(`absolute inset-x-5 top-0 h-0.5 rounded-full opacity-75`,r),t[0]=r,t[1]=a);let o;t[2]===a?o=t[3]:(o=(0,W.jsx)(`span`,{className:a}),t[2]=a,t[3]=o);let s;t[4]===n?s=t[5]:(s=(0,W.jsx)(`div`,{className:`text-3xs font-semibold uppercase tracking-widest text-muted-foreground/75`,children:n}),t[4]=n,t[5]=s);let c=i.processCount===1?`process`:`processes`,l;t[6]!==i.processCount||t[7]!==c?(l=(0,W.jsxs)(`div`,{className:`rounded-md bg-muted/55 px-1.5 py-0.5 font-mono text-3xs tabular-nums text-muted-foreground/70`,children:[i.processCount,` `,c]}),t[6]=i.processCount,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==s||t[10]!==l?(u=(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[s,l]}),t[9]=s,t[10]=l,t[11]=u):u=t[11];let d;t[12]===i.currentCpuPercent?d=t[13]:(d=i.currentCpuPercent.toFixed(1),t[12]=i.currentCpuPercent,t[13]=d);let f=`${d}%`,p;t[14]===f?p=t[15]:(p=(0,W.jsx)(Ge,{label:`CPU`,value:f}),t[14]=f,t[15]=p);let m;t[16]===i.currentRssBytes?m=t[17]:(m=V(i.currentRssBytes),t[16]=i.currentRssBytes,t[17]=m);let h;t[18]===m?h=t[19]:(h=(0,W.jsx)(Ge,{label:`Memory`,value:m}),t[18]=m,t[19]=h);let g;t[20]===i.ioReadBytesPerSecond?g=t[21]:(g=J(i.ioReadBytesPerSecond),t[20]=i.ioReadBytesPerSecond,t[21]=g);let v;t[22]===g?v=t[23]:(v=(0,W.jsx)(Ge,{label:`Read`,value:g}),t[22]=g,t[23]=v);let y;t[24]===i.ioWriteBytesPerSecond?y=t[25]:(y=J(i.ioWriteBytesPerSecond),t[24]=i.ioWriteBytesPerSecond,t[25]=y);let b;t[26]===y?b=t[27]:(b=(0,W.jsx)(Ge,{label:`Write`,value:y}),t[26]=y,t[27]=b);let x;t[28]!==h||t[29]!==v||t[30]!==b||t[31]!==p?(x=(0,W.jsxs)(`div`,{className:`mt-3.5 grid grid-cols-2 gap-x-4 gap-y-2.5`,children:[p,h,v,b]}),t[28]=h,t[29]=v,t[30]=b,t[31]=p,t[32]=x):x=t[32];let S;return t[33]!==x||t[34]!==o||t[35]!==u?(S=(0,W.jsxs)(`div`,{className:`relative overflow-hidden border-t border-border/60 px-4 py-4 first:border-t-0 md:border-t-0 md:border-l md:first:border-l-0 sm:px-5`,children:[o,u,x]}),t[33]=x,t[34]=o,t[35]=u,t[36]=S):S=t[36],S}function Ge(e){let t=(0,U.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,W.jsx)(`div`,{className:`text-3xs font-semibold uppercase tracking-widest text-muted-foreground/45`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,W.jsx)(`div`,{className:`truncate font-mono text-xs font-medium tabular-nums text-foreground/90`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,W.jsxs)(`div`,{className:`min-w-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Ke(e){let t=(0,U.c)(21),{label:n,health:r}=e,i;t[0]!==r.lastError||t[1]!==r.status?(i=r.status===`unavailable`&&T(r.lastError,Ye),t[0]=r.lastError,t[1]=r.status,t[2]=i):i=t[2];let a=i,o;t[3]===n?o=t[4]:(o=(0,W.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:n}),t[3]=n,t[4]=o);let s;t[5]!==a||t[6]!==r.lastError?(s=a?`Available when this page runs inside the desktop app.`:b(r.lastError,{onNone:Je,onSome:qe}),t[5]=a,t[6]=r.lastError,t[7]=s):s=t[7];let c;t[8]===s?c=t[9]:(c=(0,W.jsx)(`div`,{className:`mt-1 text-2xs leading-relaxed text-muted-foreground/65`,children:s}),t[8]=s,t[9]=c);let l;t[10]!==o||t[11]!==c?(l=(0,W.jsxs)(`div`,{className:`min-w-0`,children:[o,c]}),t[10]=o,t[11]=c,t[12]=l):l=t[12];let u;t[13]===a?u=t[14]:(u=a?{label:`Desktop only`,tone:`neutral`}:void 0,t[13]=a,t[14]=u);let d;t[15]!==r.status||t[16]!==u?(d=(0,W.jsx)(He,{label:``,status:r.status,presentation:u}),t[15]=r.status,t[16]=u,t[17]=d):d=t[17];let f;return t[18]!==l||t[19]!==d?(f=(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-t border-border/50 py-3 first:border-t-0`,children:[l,d]}),t[18]=l,t[19]=d,t[20]=f):f=t[20],f}function qe(e){return e}function Je(){return`No reported errors`}function Ye(e){return e.includes(`'web' mode`)}function X(e){let t=(0,U.c)(10),{label:n,value:r,valueClassName:i}=e,a;t[0]===n?a=t[1]:(a=(0,W.jsx)(`span`,{className:`text-2xs text-muted-foreground/75`,children:n}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=_(`min-w-0 truncate text-right font-mono text-2xs tabular-nums text-foreground/85`,i),t[2]=i,t[3]=o);let s;t[4]!==o||t[5]!==r?(s=(0,W.jsx)(`span`,{className:o,children:r}),t[4]=o,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==a||t[8]!==s?(c=(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-t border-border/50 py-2.5 first:border-t-0`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function Xe(e){let t=(0,U.c)(8),{selectedWindowMs:n,onSelect:r}=e,i=String(n),a;t[0]===i?a=t[1]:(a=[i],t[0]=i,t[1]=a);let o;t[2]===r?o=t[3]:(o=e=>{let t=q.find(t=>String(t.windowMs)===e[0]);t&&r(t.windowMs)},t[2]=r,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=q.map(Ze),t[4]=s):s=t[4];let c;return t[5]!==a||t[6]!==o?(c=(0,W.jsx)(fe,{"aria-label":`Resource history period`,variant:`segmented`,value:a,onValueChange:o,children:s}),t[5]=a,t[6]=o,t[7]=c):c=t[7],c}function Ze(e){return(0,W.jsx)(R,{value:String(e.windowMs),children:e.label},e.windowMs)}function Qe(e){let t=(0,U.c)(15),{buckets:n}=e,r,i,a,o;if(t[0]!==n){let e=Ae(n),s=Math.max(1,...n.map($e));a=`border-t border-border/60 px-4 py-4 sm:px-5`;let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:`h-1.5 w-3 rounded-full bg-foreground/70`}),` CPU average`]}),t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:`h-1.5 w-3 rounded-full bg-info/70`}),` I/O reads`]}),t[6]=l):l=t[6],t[7]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,W.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-x-4 gap-y-1 text-3xs text-muted-foreground/65`,children:[c,l,(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:`h-1.5 w-3 rounded-full bg-warning/80`}),` I/O writes`]})]}),t[7]=o):o=t[7],r=`flex h-32 items-end gap-1 overflow-hidden rounded-lg border border-border/40 bg-muted/8 px-2 pt-3 pb-2`,i=n.map(t=>{let n=K({value:t.avgCpuPercent,max:e,minimumVisiblePercent:2}),r=K({value:t.ioReadBytes,max:s,minimumVisiblePercent:1}),i=K({value:t.ioWriteBytes,max:s,minimumVisiblePercent:1});return(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.jsxs)(`div`,{className:`grid h-full min-w-1 flex-1 grid-cols-3 items-end gap-px`,children:[(0,W.jsx)(`span`,{className:`block rounded-t-sm bg-foreground/65`,style:{height:`${n}%`}}),(0,W.jsx)(`span`,{className:`block rounded-t-sm bg-info/70`,style:{height:`${r}%`}}),(0,W.jsx)(`span`,{className:`block rounded-t-sm bg-warning/80`,style:{height:`${i}%`}})]})}),(0,W.jsx)(I,{side:`top`,className:`text-left`,children:(0,W.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,W.jsxs)(`div`,{children:[`CPU avg `,t.avgCpuPercent.toFixed(1),`%`]}),(0,W.jsxs)(`div`,{children:[`CPU peak `,t.maxCpuPercent.toFixed(1),`%`]}),(0,W.jsxs)(`div`,{children:[`Read `,V(t.ioReadBytes)]}),(0,W.jsxs)(`div`,{children:[`Write `,V(t.ioWriteBytes)]})]})})]},C(t.startedAt))}),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o}else r=t[1],i=t[2],a=t[3],o=t[4];let s;t[8]!==r||t[9]!==i?(s=(0,W.jsx)(`div`,{className:r,children:i}),t[8]=r,t[9]=i,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==o||t[13]!==s?(c=(0,W.jsxs)(`div`,{className:a,children:[o,s]}),t[11]=a,t[12]=o,t[13]=s,t[14]=c):c=t[14],c}function $e(e){return e.ioReadBytes+e.ioWriteBytes}function et(e){let t=(0,U.c)(26),{process:n,collapsed:r,onToggle:i}=e,a;t[0]===n?a=t[1]:(a=Ie(n),t[0]=n,t[1]=a);let o=a,s=n.childPids.length>0,c=`${Math.min(n.depth,7)*10}px`,l;t[2]===c?l=t[3]:(l={paddingLeft:c},t[2]=c,t[3]=l);let u;t[4]!==r||t[5]!==s||t[6]!==o||t[7]!==i||t[8]!==n?(u=s?(0,W.jsx)(m,{size:`icon-micro`,variant:`ghost-muted`,onClick:()=>i(n),"aria-label":r?`Expand ${o}`:`Collapse ${o}`,children:(0,W.jsx)(O,{className:`size-3.5`,icon:r?E:D})}):(0,W.jsx)(`span`,{className:`size-5`,"aria-hidden":!0}),t[4]=r,t[5]=s,t[6]=o,t[7]=i,t[8]=n,t[9]=u):u=t[9];let d;t[10]===n.category?d=t[11]:(d=_(`size-1.5 rounded-full`,Re(n.category)),t[10]=n.category,t[11]=d);let f;t[12]===d?f=t[13]:(f=(0,W.jsx)(`span`,{className:d}),t[12]=d,t[13]=f);let p;t[14]===o?p=t[15]:(p=(0,W.jsx)(F,{render:(0,W.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:o})}),t[14]=o,t[15]=p);let h=n.command||n.name,g;t[16]===h?g=t[17]:(g=(0,W.jsx)(I,{side:`top`,variant:`code`,children:h}),t[16]=h,t[17]=g);let v;t[18]!==p||t[19]!==g?(v=(0,W.jsxs)(L,{children:[p,g]}),t[18]=p,t[19]=g,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==l||t[23]!==u||t[24]!==f?(y=(0,W.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[1.25rem_0.375rem_minmax(0,1fr)] items-center gap-2`,style:l,children:[u,f,v]}),t[21]=v,t[22]=l,t[23]=u,t[24]=f,t[25]=y):y=t[25],y}function tt(e){return e.category===`server-child`||e.category===`provider-root`||e.category===`terminal-root`}function nt(e){let t=(0,U.c)(10),{process:n,canMaintainEnvironment:r,signalingKeys:i,onSignal:a}=e;if(!tt(n)){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,W.jsx)(`span`,{className:`text-3xs text-muted-foreground/35`,children:`—`}),t[0]=e):e=t[0],e}let o;t[1]!==n||t[2]!==i?(o=i.has(Pe(n)),t[1]=n,t[2]=i,t[3]=o):o=t[3];let s=!r||o,c;t[4]!==a||t[5]!==n?(c=e=>a(n,e),t[4]=a,t[5]=n,t[6]=c):c=t[6];let l;return t[7]!==s||t[8]!==c?(l=(0,W.jsx)(we,{disabled:s,onSignal:c}),t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function rt(e){let t=(0,U.c)(22),{processes:n,canMaintainEnvironment:r,signalingKeys:i,onSignal:a}=e,[o,s]=(0,G.useState)(it),c;t[0]!==o||t[1]!==n?(c=Oe(n,o),t[0]=o,t[1]=n,t[2]=c):c=t[2];let l=c,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{let t=Pe(e);s(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},t[3]=u):u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,W.jsxs)(`colgroup`,{children:[(0,W.jsx)(`col`,{className:`w-[20%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[7%]`}),(0,W.jsx)(`col`,{className:`w-[8%]`}),(0,W.jsx)(`col`,{className:`w-[9%]`}),(0,W.jsx)(`col`,{className:`w-[9%]`}),(0,W.jsx)(`col`,{className:`w-[9%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[8%]`}),(0,W.jsx)(`col`,{className:`w-[6%]`}),(0,W.jsx)(`col`,{className:`w-[4%]`})]}),t[4]=f):f=t[4];let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,W.jsx)(`thead`,{className:`sticky top-0 z-10 border-b border-border/60 bg-card text-3xs uppercase tracking-widest text-muted-foreground/65`,children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{className:`px-4 py-2 font-semibold sm:pl-5`,children:`Process`}),(0,W.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Category`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`CPU`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`CPU Time`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Memory`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Read/s`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Write/s`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Read Total`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Write Total`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`PID`}),(0,W.jsx)(`th`,{className:`px-2 py-2 text-right font-semibold sm:pr-4`,children:`Kill`})]})}),t[5]=p):p=t[5];let m;t[6]===l.length?m=t[7]:(m=l.length===0?(0,W.jsx)(`tr`,{children:(0,W.jsx)(`td`,{colSpan:11,className:`px-4 py-5 text-xs text-muted-foreground sm:px-5`,children:`Waiting for the native process monitor.`})}):null,t[6]=l.length,t[7]=m);let h;if(t[8]!==r||t[9]!==o||t[10]!==a||t[11]!==i||t[12]!==l){let e;t[14]!==r||t[15]!==o||t[16]!==a||t[17]!==i?(e=e=>(0,W.jsxs)(`tr`,{className:`hover:bg-muted/20`,children:[(0,W.jsx)(`td`,{className:`px-4 py-2 sm:pl-5`,children:(0,W.jsx)(et,{process:e,collapsed:o.has(Pe(e)),onToggle:d})}),(0,W.jsx)(`td`,{className:`truncate px-3 py-2 text-2xs text-muted-foreground`,children:Le(e.category)}),(0,W.jsxs)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:[e.cpuPercent.toFixed(1),`%`]}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:je(e.cpuTimeMs)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:V(e.residentBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-info-foreground`,children:J(e.ioReadBytesPerSecond)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-warning-foreground`,children:J(e.ioWriteBytesPerSecond)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-muted-foreground`,children:V(e.ioReadBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-muted-foreground`,children:(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.jsx)(`span`,{children:V(e.ioWriteBytes)})}),(0,W.jsx)(I,{side:`top`,children:ze(e.ioSemantics)})]})}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-muted-foreground`,children:e.identity.pid}),(0,W.jsx)(`td`,{className:`px-2 py-2 text-right sm:pr-4`,children:(0,W.jsx)(nt,{process:e,canMaintainEnvironment:r,signalingKeys:i,onSignal:a})})]},Pe(e)),t[14]=r,t[15]=o,t[16]=a,t[17]=i,t[18]=e):e=t[18],h=l.map(e),t[8]=r,t[9]=o,t[10]=a,t[11]=i,t[12]=l,t[13]=h}else h=t[13];let g;return t[19]!==m||t[20]!==h?(g=(0,W.jsx)(`div`,{className:`border-t border-border/60`,children:(0,W.jsx)(z,{chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`max-h-[min(68vh,48rem)] w-full max-w-full`,children:(0,W.jsxs)(`table`,{className:`w-full min-w-[1320px] table-fixed text-left text-xs`,children:[f,p,(0,W.jsxs)(`tbody`,{className:`divide-y divide-border/50`,children:[m,h]})]})})}),t[19]=m,t[20]=h,t[21]=g):g=t[21],g}function it(){return new Set}function at(e){let t=(0,U.c)(9),{processes:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,W.jsxs)(`colgroup`,{children:[(0,W.jsx)(`col`,{className:`w-[24%]`}),(0,W.jsx)(`col`,{className:`w-[11%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[11%]`}),(0,W.jsx)(`col`,{className:`w-[11%]`}),(0,W.jsx)(`col`,{className:`w-[11%]`}),(0,W.jsx)(`col`,{className:`w-[7%]`}),(0,W.jsx)(`col`,{className:`w-[5%]`})]}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,W.jsx)(`thead`,{className:`sticky top-0 z-10 border-b border-border/60 bg-card text-3xs uppercase tracking-widest text-muted-foreground/65`,children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{className:`px-4 py-2 font-semibold sm:pl-5`,children:`Process`}),(0,W.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Category`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`CPU Time`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Peak CPU`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Peak Mem`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Read`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Write`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Samples`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold sm:pr-5`,children:`PID`})]})}),t[1]=i):i=t[1];let a;t[2]===n.length?a=t[3]:(a=n.length===0?(0,W.jsx)(`tr`,{children:(0,W.jsx)(`td`,{colSpan:9,className:`px-4 py-5 text-xs text-muted-foreground sm:px-5`,children:`No retained process samples in this window.`})}):null,t[2]=n.length,t[3]=a);let o;t[4]===n?o=t[5]:(o=n.map(ot),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==o?(s=(0,W.jsx)(`div`,{className:`border-t border-border/60`,children:(0,W.jsx)(z,{chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`max-h-[28rem] w-full max-w-full`,children:(0,W.jsxs)(`table`,{className:`w-full min-w-[1020px] table-fixed text-left text-xs`,children:[r,i,(0,W.jsxs)(`tbody`,{className:`divide-y divide-border/50`,children:[a,o]})]})})}),t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function ot(e){return(0,W.jsxs)(`tr`,{className:`hover:bg-muted/20`,children:[(0,W.jsx)(`td`,{className:`px-4 py-2 sm:pl-5`,children:(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.jsx)(`span`,{className:`block truncate font-medium text-foreground`,children:e.name||e.command})}),(0,W.jsx)(I,{side:`top`,variant:`code`,children:e.command||e.name})]})}),(0,W.jsx)(`td`,{className:`truncate px-3 py-2 text-2xs text-muted-foreground`,children:Le(e.category)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:je(e.cpuTimeMs)}),(0,W.jsxs)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:[e.maxCpuPercent.toFixed(1),`%`]}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:V(e.peakRssBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-info-foreground`,children:V(e.ioReadBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-warning-foreground`,children:V(e.ioWriteBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-muted-foreground`,children:e.sampleCount}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-muted-foreground sm:pr-5`,children:e.identity.pid})]},Fe(e))}function st(e){let t=(0,U.c)(9),{entries:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,W.jsxs)(`colgroup`,{children:[(0,W.jsx)(`col`,{className:`w-[22%]`}),(0,W.jsx)(`col`,{className:`w-[28%]`}),(0,W.jsx)(`col`,{className:`w-[14%]`}),(0,W.jsx)(`col`,{className:`w-[14%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[12%]`})]}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,W.jsx)(`thead`,{className:`border-b border-border/60 text-3xs uppercase tracking-widest text-muted-foreground/65`,children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{className:`px-4 py-2 font-semibold sm:pl-5`,children:`Component`}),(0,W.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Operation`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Logical Read`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Logical Write`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Count`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold sm:pr-5`,children:`Time`})]})}),t[1]=i):i=t[1];let a;t[2]===n.length?a=t[3]:(a=n.length===0?(0,W.jsx)(`tr`,{children:(0,W.jsx)(`td`,{colSpan:6,className:`px-4 py-5 text-xs text-muted-foreground sm:px-5`,children:`No instrumented application I/O has been recorded yet.`})}):null,t[2]=n.length,t[3]=a);let o;t[4]===n?o=t[5]:(o=n.map(ct),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==o?(s=(0,W.jsx)(`div`,{className:`overflow-x-auto border-t border-border/60`,children:(0,W.jsxs)(`table`,{className:`w-full min-w-[720px] table-fixed text-left text-xs`,children:[r,i,(0,W.jsxs)(`tbody`,{className:`divide-y divide-border/50`,children:[a,o]})]})}),t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function ct(e){return(0,W.jsxs)(`tr`,{className:`hover:bg-muted/20`,children:[(0,W.jsx)(`td`,{className:`truncate px-4 py-2 font-medium text-foreground sm:pl-5`,children:e.component}),(0,W.jsx)(`td`,{className:`truncate px-3 py-2 text-muted-foreground`,children:e.operation}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-info-foreground`,children:V(e.logicalReadBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-warning-foreground`,children:V(e.logicalWriteBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:e.count}),(0,W.jsxs)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-muted-foreground sm:pr-5`,children:[(e.durationMs/1e3).toFixed(2).replace(/\.0+$/,``),`s`]})]},`${e.component}:${e.operation}`)}function lt({environmentId:e}){let[t,n]=(0,G.useState)(9e5),r=q.find(e=>e.windowMs===t)??q[1],a=oe(e,y),s=Te(e),c=s.retry,u=Ee({windowMs:r.windowMs,bucketMs:r.bucketMs},e),d=u.refresh,_=(0,G.useRef)({environmentId:e,windowMs:t,refreshHistory:d});(0,G.useEffect)(()=>{_.current={environmentId:e,windowMs:t,refreshHistory:d}},[e,t,d]);let x=ce(M.signalProcess,{reportFailure:!1}),[S,C]=(0,G.useState)(()=>new Set),w=(0,G.useRef)(new Set),T=(0,G.useRef)(e);(0,G.useEffect)(()=>(T.current=e,()=>{T.current=null}),[e]);let[ne,E]=(0,G.useState)(!1),D=s.data,O=D?.groups.allP4,A=(0,G.useCallback)(async(e,t)=>{let n=T.current;if(n===null||!N(n,`environment:maintain`))return;let r=Pe(e);if(w.current.has(r))return;let i=new Set(w.current).add(r);w.current=i,C(i);let a=()=>{let e=new Set(w.current);e.delete(r),w.current=e,C(e)};if(t===`SIGKILL`){let n=!1;try{n=await ae().dialogs.confirm(`Send SIGKILL to process ${e.identity.pid}? This cannot be handled by the process.`,{variant:`destructive`})}catch(e){a(),k.add({type:`error`,title:`Could not confirm signal`,description:e instanceof Error?e.message:`Failed to send ${t}.`});return}if(!n){a();return}}T.current!==n||!N(n,`environment:maintain`)?a():x({environmentId:n,input:{pid:e.identity.pid,startTimeMs:e.identity.startTimeMs,signal:t}}).then(n=>{if(n._tag===`Failure`){if(ie(n))return;throw re(n)}n.value.signaled||k.add({type:`error`,title:`Could not send ${t}`,description:ee(n.value.message,()=>`Failed to send ${t} to process ${e.identity.pid}.`)})}).catch(e=>{k.add({type:`error`,title:`Could not send ${t}`,description:e instanceof Error?e.message:`Failed to send ${t}.`})}).finally(()=>{a()})},[x]),j=(0,G.useCallback)(()=>{let e=T.current;e!==null&&N(e,`environment:maintain`)&&(E(!0),c().then(()=>{d();let n=_.current;T.current===e&&n.environmentId===e&&n.windowMs!==t&&n.refreshHistory()}).catch(e=>{k.add({type:`error`,title:`Could not restart resource monitor`,description:e instanceof Error?e.message:`The resource monitor retry failed.`})}).finally(()=>{E(!1)}))},[c]),se=D?te(D.speedLimitPercent):null,P=ke({nativeStatus:D?.health.native.status??null,error:s.error}),le=D!==null&&(D.power.onBattery!==`unknown`||D.power.lowPowerMode!==`unknown`||D.power.idle!==`unknown`||D.power.locked!==`unknown`||D.power.thermalState!==`unknown`);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B,{title:`Resource monitor`,icon:(0,W.jsx)(i,{className:`size-4 text-muted-foreground`}),headerAction:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[D?(0,W.jsx)(He,{label:`Native`,status:D.health.native.status}):null,(0,W.jsx)(Ue,{sampledAt:D?.readAt??null}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.jsx)(m,{size:`icon-micro`,variant:`ghost`,disabled:s.isPending,onClick:s.refresh,"aria-label":`Refresh resource telemetry`,children:(0,W.jsx)(H,{size:`xs`,refreshing:s.isPending})})}),(0,W.jsx)(I,{side:`top`,children:`Refresh telemetry snapshot`})]})]}),children:(0,W.jsxs)(`div`,{className:`overflow-hidden rounded-[inherit]`,children:[(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border/60 bg-linear-to-r from-muted/45 via-muted/20 to-transparent px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-5`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-3xs font-semibold uppercase tracking-widest text-muted-foreground/70`,children:`P4 system footprint`}),(0,W.jsx)(`p`,{className:`mt-1 max-w-xl text-xs leading-relaxed text-muted-foreground`,children:`Live native counters for the server, providers, terminals, desktop processes, and the monitor itself.`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-3xs text-muted-foreground/65`,children:[(0,W.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`}),`Sampling every `,D?Ne(D.sampleIntervalMs):`...`]})]}),(0,W.jsxs)(`div`,{className:`grid grid-cols-2 divide-x divide-y divide-border/55 md:grid-cols-3`,children:[(0,W.jsx)(Y,{icon:(0,W.jsx)(h,{className:`size-3.5`}),label:`Current CPU`,value:O?`${O.currentCpuPercent.toFixed(1)}%`:`...`,detail:O?`${je(O.cpuTimeMs)} observed CPU time`:void 0}),(0,W.jsx)(Y,{icon:(0,W.jsx)(f,{className:`size-3.5`}),label:`Resident memory`,value:O?V(O.currentRssBytes):`...`,detail:O?`${V(O.peakRssBytes)} combined process peaks`:void 0}),(0,W.jsx)(Y,{icon:(0,W.jsx)(i,{className:`size-3.5`}),label:`Process count`,value:O?String(O.processCount):`...`,detail:O?`${O.processStarts} starts · ${O.processExits} exits`:void 0}),(0,W.jsx)(Y,{icon:(0,W.jsx)(o,{className:`size-3.5`}),label:`Read throughput`,value:O?J(O.ioReadBytesPerSecond):`...`,detail:O?`${V(O.ioReadBytes)} observed`:void 0}),(0,W.jsx)(Y,{icon:(0,W.jsx)(g,{className:`size-3.5`}),label:`Write throughput`,value:O?J(O.ioWriteBytesPerSecond):`...`,detail:O?`${V(O.ioWriteBytes)} observed`:void 0,tone:O&&O.ioWriteBytesPerSecond>=10485760?`danger`:O&&O.ioWriteBytesPerSecond>=1048576?`warning`:`default`}),(0,W.jsx)(Y,{icon:(0,W.jsx)(l,{className:`size-3.5`}),label:`CPU speed limit`,value:D?se===null?`Unknown`:`${se.toFixed(0)}%`:`...`,detail:D?`${D.power.thermalState} thermal state`:void 0,tone:se!==null&&se<80?`warning`:`default`})]}),s.error?(0,W.jsxs)(`div`,{className:`flex items-start gap-2 border-t border-destructive/20 bg-destructive/5 px-4 py-3 text-xs text-destructive sm:px-5`,children:[(0,W.jsx)(v,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:s.error})]}):null,D?(0,W.jsxs)(`div`,{className:`grid border-t border-border/60 bg-muted/10 md:grid-cols-3`,children:[(0,W.jsx)(We,{label:`Backend + agents`,accentClass:`bg-success/80`,aggregate:D.groups.backend}),(0,W.jsx)(We,{label:`Desktop`,accentClass:`bg-info/80`,aggregate:D.groups.electron}),(0,W.jsx)(We,{label:`Monitor overhead`,accentClass:`bg-warning/80`,aggregate:D.groups.monitor})]}):null]})}),(0,W.jsx)(B,{title:`Host & collection`,icon:(0,W.jsx)(l,{className:`size-4 text-muted-foreground`}),headerAction:P?(0,W.jsxs)(m,{size:`xs`,variant:`outline`,disabled:ne,onClick:j,children:[(0,W.jsx)(H,{size:`xs`,refreshing:ne}),`Retry monitor`]}):null,children:(0,W.jsxs)(`div`,{className:`grid overflow-hidden rounded-[inherit] md:grid-cols-2 md:divide-x md:divide-border/60`,children:[(0,W.jsxs)(`div`,{className:`px-4 py-4 sm:px-5`,children:[(0,W.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-3xs font-semibold uppercase tracking-widest text-muted-foreground/70`,children:[(0,W.jsx)(`span`,{className:`flex size-6 items-center justify-center rounded-md bg-muted/60`,children:(0,W.jsx)(p,{className:`size-3.5`})}),`Host state`]}),le&&D?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(X,{label:`Power source`,value:Be(D.power.onBattery,{true:`Battery`,false:`External power`})}),(0,W.jsx)(X,{label:`Low power mode`,value:Be(D.power.lowPowerMode,{true:`Enabled`,false:`Disabled`})}),(0,W.jsx)(X,{label:`Idle`,value:`${Be(D.power.idle,{true:`Idle`,false:`Active`})}${D.power.idleSeconds===null?``:` · ${Math.round(D.power.idleSeconds)}s`}`}),(0,W.jsx)(X,{label:`Session`,value:D.power.suspended?`Suspended`:Be(D.power.locked,{true:`Locked`,false:`Unlocked`})}),(0,W.jsx)(X,{label:`Thermal`,value:D.power.thermalState,valueClassName:D.power.thermalState===`serious`||D.power.thermalState===`critical`?`text-destructive`:void 0})]}):(0,W.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/70 bg-muted/20 px-4 py-5`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:`Desktop host signals not connected`}),(0,W.jsx)(`p`,{className:`mt-1.5 max-w-sm text-2xs leading-relaxed text-muted-foreground/70`,children:`Power, idle, lock, and thermal state are supplied by the desktop host. Process telemetry remains fully active in this browser session.`})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border/60 px-4 py-4 md:border-t-0 sm:px-5`,children:[(0,W.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-3xs font-semibold uppercase tracking-widest text-muted-foreground/70`,children:[(0,W.jsx)(`span`,{className:`flex size-6 items-center justify-center rounded-md bg-muted/60`,children:(0,W.jsx)(l,{className:`size-3.5`})}),`Collection health`]}),D?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Ke,{label:`Native process monitor`,health:D.health.native}),(0,W.jsx)(Ke,{label:`Electron main process`,health:D.health.desktop}),(0,W.jsx)(X,{label:`Collection time`,value:Me(D.health.collectionDurationMicros)}),(0,W.jsx)(X,{label:`Process scan`,value:`${D.health.retainedProcessCount}/${D.health.scannedProcessCount} retained`}),(0,W.jsx)(X,{label:`Inaccessible`,value:String(D.health.inaccessibleProcessCount),valueClassName:D.health.inaccessibleProcessCount>0?`text-warning-foreground`:void 0}),(0,W.jsx)(X,{label:`Sidecar`,value:b(D.health.sidecarVersion,{onNone:()=>`Unavailable`,onSome:e=>`${e}${b(D.health.sidecarPid,{onNone:()=>``,onSome:e=>` · PID ${e}`})}`})}),(0,W.jsx)(X,{label:`Restarts`,value:String(D.health.restartCount)})]}):(0,W.jsx)(`div`,{className:`py-4 text-xs text-muted-foreground`,children:`Waiting for collector health.`})]})]})}),(0,W.jsx)(B,{title:`Resource timeline`,icon:(0,W.jsx)(o,{className:`size-4 text-muted-foreground`}),headerAction:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(Xe,{selectedWindowMs:t,onSelect:n}),(0,W.jsx)(m,{size:`icon-micro`,variant:`ghost`,disabled:u.isPending,onClick:u.refresh,"aria-label":`Refresh resource history`,children:(0,W.jsx)(H,{size:`xs`,refreshing:u.isPending})})]}),children:(0,W.jsxs)(`div`,{className:`overflow-hidden rounded-[inherit]`,children:[u.error?(0,W.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-destructive/20 bg-destructive/5 px-4 py-3 text-xs text-destructive sm:px-5`,children:[(0,W.jsx)(v,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:u.error})]}):null,(0,W.jsx)(Qe,{buckets:u.data?.buckets??[]}),(0,W.jsx)(at,{processes:u.data?.topProcesses??[]})]})}),(0,W.jsx)(B,{title:`Live process tree`,icon:(0,W.jsx)(h,{className:`size-4 text-muted-foreground`}),headerAction:D?(0,W.jsxs)(`span`,{className:`text-3xs text-muted-foreground/55`,children:[`Identity: `,(0,W.jsx)(`span`,{className:`font-mono`,children:`PID + start time`})]}):null,children:(0,W.jsx)(`div`,{className:`overflow-hidden rounded-[inherit]`,children:(0,W.jsx)(rt,{processes:D?.processes??[],canMaintainEnvironment:a,signalingKeys:S,onSignal:A})})}),(0,W.jsx)(B,{title:`Instrumented application I/O`,icon:(0,W.jsx)(g,{className:`size-4 text-muted-foreground`}),headerAction:(0,W.jsx)(`span`,{className:`text-3xs text-muted-foreground/55`,children:`Logical bytes by operation`}),children:(0,W.jsxs)(`div`,{className:`overflow-hidden rounded-[inherit]`,children:[(0,W.jsx)(`div`,{className:`bg-muted/15 px-4 py-3 text-2xs leading-relaxed text-muted-foreground sm:px-5`,children:`Native counters identify which process is reading or writing. These application-level counters identify known P4 Code operations so process spikes can be correlated with specific persistence and logging paths.`}),(0,W.jsx)(st,{entries:D?.attribution.entries??[]})]})})]})}var ut=[{key:`otlpTracesUrl`,label:`Traces`,signal:`traces`},{key:`otlpMetricsUrl`,label:`Metrics`,signal:`metrics`},{key:`otlpLogsUrl`,label:`Logs`,signal:`logs`}],dt=e=>/^https?:\/\/./i.test(e);function ft(e,t){if(e===``)return{label:`Off`,dot:`bg-muted-foreground/40`};if(t?.url!==e)return{label:`Not checked`,dot:`bg-muted-foreground/40`};let{result:n}=t;if(n===null)return{label:`Checking…`,dot:`bg-warning`};switch(n._tag){case`Accepted`:return{label:`Connected · ${Math.round(n.latencyMs)} ms`,dot:`bg-success`};case`Rejected`:return{label:`Rejected · HTTP ${n.status}`,dot:`bg-destructive`};case`Unreachable`:return{label:n.timedOut?`Timed out`:`Unreachable`,dot:`bg-destructive`}}}function pt(){let e=(0,U.c)(3),{environment:t,scope:n}=he();if(n.kind!==`environment`||!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsx)(B,{title:`OpenTelemetry export`,id:`telemetry-export`,children:(0,W.jsx)(Ce,{target:`environment`,children:`Choose one environment to configure its telemetry exports.`})}),e[0]=t):t=e[0],t}let r;return e[1]===t.environmentId?r=e[2]:(r=(0,W.jsx)(mt,{},t.environmentId),e[1]=t.environmentId,e[2]=r),r}function mt(){let{environment:e}=he(),t=me(e=>e.observability),[n,r]=(0,G.useState)({}),[i,a]=(0,G.useState)(!1),[o,c]=(0,G.useState)(null),l=e?.environmentId,u=s(M.checkOtlpEndpoint.permissionAtom(l??null)),d=u&&e?.serverConfig?.environment.capabilities.otlpEndpointCheck===!0,[f,p]=(0,G.useState)(()=>Object.fromEntries(ut.filter(({key:e})=>dt(t[e])).map(({key:e})=>[e,{url:t[e],result:null}]))),h=ce(M.updateSettings,{reportFailure:!0}),g=ce(M.checkOtlpEndpoint),_={...t,...n},v=ut.filter(({key:e})=>_[e].trim()!==t[e]),y=v.length>0,b=e?.serverConfig?.observability,x=async(e,t,n)=>{if(!l)return;let r=await g({environmentId:l,input:{signal:t,url:n}});p(t=>{if(t[e]?.url!==n||t[e].result!==null)return t;let i={...t};return r._tag===`Success`?i[e]={url:n,result:r.value}:delete i[e],i})},S=(e,t,n)=>{dt(n)&&(p(t=>({...t,[e]:{url:n,result:null}})),x(e,t,n))},ee=(0,G.useEffectEvent)(()=>{for(let{key:e,signal:t}of ut){let n=f[e];n?.result===null&&x(e,t,n.url)}});return(0,G.useEffect)(()=>{d&&ee()},[d]),(0,W.jsx)(B,{title:`OpenTelemetry export`,id:`telemetry-export`,children:(0,W.jsxs)(`form`,{className:`grid gap-4 px-4 py-4 sm:px-5`,onSubmit:async t=>{if(t.preventDefault(),e&&!i){a(!0),c(null);try{(await h({environmentId:e.environmentId,input:{patch:{observability:Object.fromEntries(v.map(({key:e})=>[e,_[e]]))}}}))._tag===`Success`&&(r({}),c(`Saved. Restart the server to apply.`))}finally{a(!1)}}},children:[(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Send traces, metrics, and logs to an OTLP HTTP receiver. Restart the server to apply. Environment variables override these settings.`}),!u&&(0,W.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`This connection lacks permission to change settings on`,` `,e?.label??`the selected environment`,`.`]}),ut.map(({key:e,label:n,signal:a})=>{let o=_[e].trim(),s=d?ft(o,f[e]):null;return(0,W.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[s&&(0,W.jsx)(ve,{dotClassName:s.dot}),(0,W.jsxs)(be,{htmlFor:e,children:[n,` endpoint`]})]}),s&&(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s.label})]}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(pe,{id:e,size:`sm`,type:`url`,pattern:`[Hh][Tt][Tt][Pp][Ss]?://.*`,title:`Enter an HTTP or HTTPS endpoint, or leave empty to disable export.`,placeholder:`http://localhost:4318/v1/${a}`,value:_[e],disabled:i||!u,onChange:n=>{let i=n.target.value;r(n=>{let r={...n,[e]:i};return i.trim()===t[e]&&delete r[e],r}),c(null)}}),d&&(0,W.jsx)(m,{type:`button`,size:`sm`,variant:`outline`,disabled:!dt(o)||f[e]?.result===null,onClick:()=>void S(e,a,o),children:`Test`})]}),t[e]!==(b?.[e]??``)&&(0,W.jsxs)(`p`,{className:`break-all text-xs text-muted-foreground`,children:[`Running: `,b?.[e]||`Disabled`]})]},e)}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,W.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:o}),(0,W.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,W.jsx)(m,{type:`button`,size:`xs`,variant:`outline`,disabled:!y||i||!u,onClick:()=>{if(r({}),c(null),d)for(let{key:e,signal:n}of ut)f[e]?.url!==t[e]&&S(e,n,t[e])},children:`Discard`}),(0,W.jsx)(m,{type:`submit`,size:`xs`,disabled:!y||i||!u,children:i?`Saving…`:`Save`})]})]})]})})}var ht=new Intl.NumberFormat;function Z(e){return ht.format(e)}function Q(e){return e<1e3?`${Math.round(e)} ms`:`${(e/1e3).toFixed(e>=1e4?1:2).replace(/\.0+$/,``)} s`}function gt(e){return e?ue(C(e)):`No trace records`}function _t(e){return gt(e).replaceAll(` `,`\xA0`)}function vt(e){return e.length<=32?e:`${e.slice(0,18)}...${e.slice(-10)}`}function yt(e){return e?.includes(`not a live descendant`)??!1}function $(e){let t=(0,U.c)(17),{label:n,value:r,tooltip:i,tone:a}=e,o=a===void 0?`default`:a,s;t[0]===n?s=t[1]:(s=(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),t[0]=n,t[1]=s);let l;t[2]!==n||t[3]!==i?(l=i?(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.jsx)(`button`,{type:`button`,className:`cursor-pointer inline-flex size-3.5 shrink-0 items-center justify-center rounded-sm text-muted-foreground/60 hover:text-foreground`,"aria-label":`${n} details`,children:(0,W.jsx)(c,{className:`size-3`})})}),(0,W.jsx)(I,{side:`top`,children:i})]}):null,t[2]=n,t[3]=i,t[4]=l):l=t[4];let u;t[5]!==s||t[6]!==l?(u=(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-2xs font-medium uppercase tracking-widest text-muted-foreground/70`,children:[s,l]}),t[5]=s,t[6]=l,t[7]=u):u=t[7];let d=o===`warning`&&`text-warning-foreground`,f=o===`danger`&&`text-destructive`,p;t[8]!==d||t[9]!==f?(p=_(`mt-1 truncate font-mono text-lg font-semibold tabular-nums text-foreground`,d,f),t[8]=d,t[9]=f,t[10]=p):p=t[10];let m;t[11]!==p||t[12]!==r?(m=(0,W.jsx)(`div`,{className:p,children:r}),t[11]=p,t[12]=r,t[13]=m):m=t[13];let h;return t[14]!==u||t[15]!==m?(h=(0,W.jsxs)(`div`,{className:`min-w-0 border-border/60 px-4 py-3 sm:px-5`,children:[u,m]}),t[14]=u,t[15]=m,t[16]=h):h=t[16],h}function bt(e){let t=(0,U.c)(6),{children:n}=e,r,i,a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,W.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 left-1/2 w-px bg-border/60`,"aria-hidden":!0}),i=(0,W.jsx)(`span`,{className:`pointer-events-none absolute inset-x-0 top-1/2 h-px bg-border/60 sm:hidden`,"aria-hidden":!0}),a=(0,W.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 left-1/4 hidden w-px bg-border/60 sm:block`,"aria-hidden":!0}),o=(0,W.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 left-3/4 hidden w-px bg-border/60 sm:block`,"aria-hidden":!0}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):(r=t[0],i=t[1],a=t[2],o=t[3]);let s;return t[4]===n?s=t[5]:(s=(0,W.jsxs)(`div`,{className:`relative grid grid-cols-2 sm:grid-cols-4`,children:[r,i,a,o,n]}),t[4]=n,t[5]=s),s}function xt(e){let t=(0,U.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,W.jsx)(`div`,{className:`px-4 py-4 text-xs text-muted-foreground sm:px-5`,children:n}),t[0]=n,t[1]=r),r}function St(e){let t=(0,U.c)(21),{headers:n,children:r,minTableWidth:i,columnWidths:a}=e,o=i===void 0?`min-w-[640px]`:i,s=a&&`table-fixed`,c;t[0]!==o||t[1]!==s?(c=_(`w-full text-left text-xs`,o,s),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l;t[3]!==a||t[4]!==n?(l=a?(0,W.jsx)(`colgroup`,{children:n.map((e,t)=>(0,W.jsx)(`col`,{className:a[t]},e))}):null,t[3]=a,t[4]=n,t[5]=l):l=t[5];let u;if(t[6]!==a||t[7]!==n){let e;t[9]!==a||t[10]!==n.length?(e=(e,t)=>(0,W.jsx)(`th`,{className:_(`whitespace-nowrap px-4 py-2.5 font-semibold first:sm:pl-5 last:sm:pr-5`,!a&&t===n.length-1&&`w-px`),children:e.replaceAll(` `,`\xA0`)},e),t[9]=a,t[10]=n.length,t[11]=e):e=t[11],u=n.map(e),t[6]=a,t[7]=n,t[8]=u}else u=t[8];let d;t[12]===u?d=t[13]:(d=(0,W.jsx)(`thead`,{className:`border-b border-border/60 text-2xs uppercase tracking-widest text-muted-foreground/70`,children:(0,W.jsx)(`tr`,{children:u})}),t[12]=u,t[13]=d);let f;t[14]===r?f=t[15]:(f=(0,W.jsx)(`tbody`,{className:`divide-y divide-border/60`,children:r}),t[14]=r,t[15]=f);let p;return t[16]!==c||t[17]!==l||t[18]!==d||t[19]!==f?(p=(0,W.jsx)(z,{radius:`none`,chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`w-full max-w-full`,children:(0,W.jsxs)(`table`,{className:c,children:[l,d,f]})}),t[16]=c,t[17]=l,t[18]=d,t[19]=f,t[20]=p):p=t[20],p}function Ct(e){let t=(0,U.c)(25),{traceId:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={target:`trace ID`,timeout:1200},t[0]=r):r=t[0];let{copyToClipboard:i,isCopied:o}=A(r),s;t[1]===n?s=t[2]:(s=vt(n),t[1]=n,t[2]=s);let c;t[3]===s?c=t[4]:(c=(0,W.jsx)(F,{render:(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-2xs`,children:s})}),t[3]=s,t[4]=c);let l;t[5]===n?l=t[6]:(l=(0,W.jsx)(I,{side:`top`,variant:`code`,children:n}),t[5]=n,t[6]=l);let u;t[7]!==c||t[8]!==l?(u=(0,W.jsxs)(L,{children:[c,l]}),t[7]=c,t[8]=l,t[9]=u):u=t[9];let d=o?`Copied trace ID`:`Copy trace ID`,f;t[10]!==i||t[11]!==n?(f=()=>i(n),t[10]=i,t[11]=n,t[12]=f):f=t[12];let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,W.jsx)(a,{className:`size-3`}),t[13]=p):p=t[13];let h;t[14]!==d||t[15]!==f?(h=(0,W.jsx)(F,{render:(0,W.jsx)(m,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":d,onClick:f,children:p})}),t[14]=d,t[15]=f,t[16]=h):h=t[16];let g=o?`Copied`:`Copy full trace ID`,_;t[17]===g?_=t[18]:(_=(0,W.jsx)(I,{side:`top`,children:g}),t[17]=g,t[18]=_);let v;t[19]!==_||t[20]!==h?(v=(0,W.jsxs)(L,{children:[h,_]}),t[19]=_,t[20]=h,t[21]=v):v=t[21];let y;return t[22]!==v||t[23]!==u?(y=(0,W.jsxs)(`div`,{className:`flex w-full min-w-0 max-w-full items-center gap-2`,children:[u,v]}),t[22]=v,t[23]=u,t[24]=y):y=t[24],y}function wt(e){let t=e.trim().split(/\s+/)[0];if(!t)return e;let n=t.replace(/^['"]|['"]$/g,``);return n.split(/[\\/]/).filter(Boolean).at(-1)??n}function Tt(e){return e.depth>0?`Subprocess`:/\b(codex|claude|opencode|cursor)\b/i.test(e.command)?`Agent`:`Process`}function Et(e){let t=(0,U.c)(22),{process:n,isExpanded:r,onToggle:i}=e,a;t[0]===n.command?a=t[1]:(a=wt(n.command),t[0]=n.command,t[1]=a);let o=a,s=n.childPids.length>0,c=`${Math.min(n.depth,6)*10}px`,l;t[2]===c?l=t[3]:(l={paddingLeft:c},t[2]=c,t[3]=l);let u;t[4]!==s||t[5]!==r||t[6]!==o||t[7]!==i||t[8]!==n.pid?(u=s?(0,W.jsx)(m,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":r?`Collapse ${o}`:`Expand ${o}`,onClick:()=>i(n.pid),children:(0,W.jsx)(O,{className:`size-3.5`,icon:r?D:E})}):(0,W.jsx)(`span`,{className:`size-5 shrink-0`,"aria-hidden":`true`}),t[4]=s,t[5]=r,t[6]=o,t[7]=i,t[8]=n.pid,t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,W.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-success/80`}),t[10]=d):d=t[10];let f;t[11]===o?f=t[12]:(f=(0,W.jsx)(F,{render:(0,W.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:o})}),t[11]=o,t[12]=f);let p;t[13]===n.command?p=t[14]:(p=(0,W.jsx)(I,{side:`top`,variant:`code`,children:n.command}),t[13]=n.command,t[14]=p);let h;t[15]!==f||t[16]!==p?(h=(0,W.jsxs)(L,{children:[f,p]}),t[15]=f,t[16]=p,t[17]=h):h=t[17];let g;return t[18]!==l||t[19]!==u||t[20]!==h?(g=(0,W.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[1.25rem_0.375rem_minmax(0,1fr)] items-center gap-2`,style:l,children:[u,d,h]}),t[18]=l,t[19]=u,t[20]=h,t[21]=g):g=t[21],g}function Dt(e){let t=(0,U.c)(18),{processes:n,canMaintainEnvironment:r,signalingPid:i,onSignal:a,emptyLabel:o}=e,[s,c]=(0,G.useState)(Ot),l;if(t[0]!==s||t[1]!==n){l=[];let e=null;for(let t of n){if(e!==null){if(t.depth>e)continue;e=null}l.push(t),s.has(t.pid)&&(e=t.depth)}t[0]=s,t[1]=n,t[2]=l}else l=t[2];let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[3]=d):d=t[3];let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,W.jsxs)(`colgroup`,{children:[(0,W.jsx)(`col`,{className:`w-[24%]`}),(0,W.jsx)(`col`,{className:`w-[8%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[33%]`}),(0,W.jsx)(`col`,{className:`w-[8%]`}),(0,W.jsx)(`col`,{className:`w-[11%]`}),(0,W.jsx)(`col`,{className:`w-[6%]`})]}),t[4]=p):p=t[4];let m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,W.jsx)(`thead`,{className:`sticky top-0 z-10 border-b border-border/60 bg-card text-2xs uppercase tracking-widest text-muted-foreground/70`,children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{className:`px-4 py-2 font-semibold sm:pl-5`,children:`Name`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`CPU`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Memory`}),(0,W.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Command`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`PID`}),(0,W.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Type`}),(0,W.jsx)(`th`,{className:`p-2 text-right font-semibold sm:pr-4`,children:`Kill`})]})}),t[5]=m):m=t[5];let h;t[6]!==o||t[7]!==u.length?(h=u.length===0?(0,W.jsx)(`tr`,{children:(0,W.jsx)(`td`,{colSpan:7,className:`px-4 py-4 text-xs text-muted-foreground sm:px-5`,children:o??`No live descendant processes found.`})}):null,t[6]=o,t[7]=u.length,t[8]=h):h=t[8];let g;t[9]!==r||t[10]!==s||t[11]!==a||t[12]!==i||t[13]!==u?(g=u.map(e=>(0,W.jsxs)(`tr`,{className:`hover:bg-muted/20`,children:[(0,W.jsx)(`td`,{className:`px-4 py-2 align-middle sm:pl-5`,children:(0,W.jsx)(Et,{process:e,isExpanded:!s.has(e.pid),onToggle:f})}),(0,W.jsxs)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:[e.cpuPercent.toFixed(1),`%`]}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:V(e.rssBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 align-middle text-muted-foreground`,children:(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.jsx)(`span`,{className:`block truncate`,children:e.command})}),(0,W.jsx)(I,{side:`top`,variant:`code`,children:e.command})]})}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums text-muted-foreground`,children:e.pid}),(0,W.jsx)(`td`,{className:`truncate px-3 py-2 align-middle text-muted-foreground`,children:Tt(e)}),(0,W.jsx)(`td`,{className:`p-2 align-middle sm:pr-4`,children:(0,W.jsx)(we,{disabled:!r||i===e.pid,onSignal:t=>a(e.pid,t)})})]},e.pid)),t[9]=r,t[10]=s,t[11]=a,t[12]=i,t[13]=u,t[14]=g):g=t[14];let _;return t[15]!==h||t[16]!==g?(_=(0,W.jsx)(`div`,{className:`border-t border-border/60`,children:(0,W.jsx)(z,{radius:`none`,chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`max-h-[min(64vh,44rem)] w-full max-w-full`,children:(0,W.jsxs)(`table`,{className:`w-full min-w-[1040px] table-fixed text-left text-xs`,children:[p,m,(0,W.jsxs)(`tbody`,{className:`divide-y divide-border/50`,children:[h,g]})]})})}),t[15]=h,t[16]=g,t[17]=_):_=t[17],_}function Ot(){return new Set}var kt=[{label:`5m`,windowMs:3e5,bucketMs:3e4},{label:`15m`,windowMs:9e5,bucketMs:6e4},{label:`30m`,windowMs:18e5,bucketMs:12e4},{label:`1h`,windowMs:36e5,bucketMs:3e5}];function At(e){if(e<60)return`${e.toFixed(e>=10?1:2).replace(/\.0+$/,``)}s`;let t=e/60;return t<60?`${t.toFixed(t>=10?1:2).replace(/\.0+$/,``)}m`:`${(t/60).toFixed(2).replace(/\.0+$/,``)}h`}function jt(e){let t=wt(e);return t.length>42?`${t.slice(0,39)}...`:t}function Mt(e){let t=(0,U.c)(21),{process:n,visualDepth:r}=e,i;t[0]===n.command?i=t[1]:(i=jt(n.command),t[0]=n.command,t[1]=i);let a=i,o=`${Math.min(r,6)*10}px`,s;t[2]===o?s=t[3]:(s={paddingLeft:o},t[2]=o,t[3]=s);let c=`${n.isServerRoot?`Root`:`Child`} process ${a}`,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,W.jsx)(`span`,{className:`size-5 shrink-0`,"aria-hidden":`true`}),t[4]=l):l=t[4];let u=n.isServerRoot?`bg-warning/90`:`bg-success/80`,d;t[5]===u?d=t[6]:(d=_(`size-1.5 shrink-0 rounded-full`,u),t[5]=u,t[6]=d);let f;t[7]===d?f=t[8]:(f=(0,W.jsx)(`span`,{className:d}),t[7]=d,t[8]=f);let p;t[9]===a?p=t[10]:(p=(0,W.jsx)(F,{render:(0,W.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:a})}),t[9]=a,t[10]=p);let m;t[11]===n.command?m=t[12]:(m=(0,W.jsx)(I,{side:`top`,variant:`code`,children:n.command}),t[11]=n.command,t[12]=m);let h;t[13]!==m||t[14]!==p?(h=(0,W.jsxs)(L,{children:[p,m]}),t[13]=m,t[14]=p,t[15]=h):h=t[15];let g;return t[16]!==h||t[17]!==s||t[18]!==c||t[19]!==f?(g=(0,W.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[1.25rem_0.375rem_minmax(0,1fr)] items-center gap-2`,style:s,"aria-label":c,children:[l,f,h]}),t[16]=h,t[17]=s,t[18]=c,t[19]=f,t[20]=g):g=t[20],g}function Nt(e){let t=(0,U.c)(9),{buckets:n}=e,r;t[0]===n?r=t[1]:(r=Math.max(1,...n.map(Pt)),t[0]=n,t[1]=r);let i=r,a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=Math.max(2,e.maxCpuPercent/i*100),n=Math.max(2,e.avgCpuPercent/i*100);return(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.jsx)(`div`,{className:`flex h-full min-w-1 flex-1 items-end`,children:(0,W.jsxs)(`div`,{className:`relative h-full w-full`,"aria-label":`Average CPU ${e.avgCpuPercent.toFixed(1)}%, peak CPU ${e.maxCpuPercent.toFixed(1)}%`,children:[(0,W.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 rounded-t-sm bg-foreground/15 transition-colors`,style:{height:`${t}%`}}),(0,W.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 rounded-t-sm bg-foreground/60 transition-colors`,style:{height:`${n}%`}})]})})}),(0,W.jsxs)(I,{side:`top`,children:[`Avg `,e.avgCpuPercent.toFixed(1),`%, peak `,e.maxCpuPercent.toFixed(1),`%`]})]},C(e.startedAt))},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,W.jsx)(`div`,{className:`border-t border-border/60 px-4 py-3 sm:px-5`,children:(0,W.jsx)(`div`,{className:`flex h-28 items-end gap-1 overflow-hidden rounded-sm bg-muted/10 p-2`,children:a})}),t[7]=a,t[8]=o),o}function Pt(e){return e.maxCpuPercent}function Ft(e){let t=(0,U.c)(8),{selectedWindowMs:n,onSelect:r}=e,i=String(n),a;t[0]===i?a=t[1]:(a=[i],t[0]=i,t[1]=a);let o;t[2]===r?o=t[3]:(o=e=>{let t=kt.find(t=>String(t.windowMs)===e[0]);t&&r(t.windowMs)},t[2]=r,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=kt.map(It),t[4]=s):s=t[4];let c;return t[5]!==a||t[6]!==o?(c=(0,W.jsx)(fe,{"aria-label":`Process history period`,variant:`segmented`,value:a,onValueChange:o,children:s}),t[5]=a,t[6]=o,t[7]=c):c=t[7],c}function It(e){return(0,W.jsx)(R,{value:String(e.windowMs),children:e.label},e.windowMs)}function Lt(e){let t=(0,U.c)(13),{processes:n,emptyLabel:r}=e,i=n.reduce(Rt,null),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,W.jsxs)(`colgroup`,{children:[(0,W.jsx)(`col`,{className:`w-[24%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[16%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`})]}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,W.jsx)(`thead`,{className:`sticky top-0 z-10 border-b border-border/60 bg-card text-2xs uppercase tracking-widest text-muted-foreground/70`,children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{className:`px-4 py-2 font-semibold sm:pl-5`,children:`Process`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`CPU Time`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Current`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Average`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Peak`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Max Mem`}),(0,W.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Command`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold sm:pr-5`,children:`PID`})]})}),t[1]=o):o=t[1];let s;t[2]!==r||t[3]!==n.length?(s=n.length===0?(0,W.jsx)(`tr`,{children:(0,W.jsx)(`td`,{colSpan:8,className:`px-4 py-4 text-xs text-muted-foreground sm:px-5`,children:r})}):null,t[2]=r,t[3]=n.length,t[4]=s):s=t[4];let c;if(t[5]!==n||t[6]!==i){let e;t[8]===i?e=t[9]:(e=e=>(0,W.jsxs)(`tr`,{className:`hover:bg-muted/20`,children:[(0,W.jsx)(`td`,{className:`px-4 py-2 align-middle sm:pl-5`,children:(0,W.jsx)(Mt,{process:e,visualDepth:e.isServerRoot||i===null?0:Math.max(1,e.depth-i+1)})}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:At(e.cpuSecondsApprox)}),(0,W.jsxs)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:[e.currentCpuPercent.toFixed(1),`%`]}),(0,W.jsxs)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:[e.avgCpuPercent.toFixed(1),`%`]}),(0,W.jsxs)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:[e.maxCpuPercent.toFixed(1),`%`]}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:V(e.maxRssBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 align-middle text-muted-foreground`,children:(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.jsx)(`span`,{className:`block truncate`,children:e.command})}),(0,W.jsx)(I,{side:`top`,variant:`code`,children:e.command})]})}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums text-muted-foreground sm:pr-5`,children:e.pid})]},e.processKey),t[8]=i,t[9]=e),c=n.map(e),t[5]=n,t[6]=i,t[7]=c}else c=t[7];let l;return t[10]!==s||t[11]!==c?(l=(0,W.jsx)(`div`,{className:`border-t border-border/60`,children:(0,W.jsx)(z,{chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`max-h-[min(64vh,44rem)] w-full max-w-full`,children:(0,W.jsxs)(`table`,{className:`w-full min-w-[980px] table-fixed text-left text-xs`,children:[a,o,(0,W.jsxs)(`tbody`,{className:`divide-y divide-border/50`,children:[s,c]})]})})}),t[10]=s,t[11]=c,t[12]=l):l=t[12],l}function Rt(e,t){return t.isServerRoot?e:e===null?t.depth:Math.min(e,t.depth)}function zt(e){let t=(0,U.c)(7),{checkedAt:n}=e;_e();let r;t[0]===n?r=t[1]:(r=de(n?C(n):null),t[0]=n,t[1]=r);let i=r;if(i.status===`missing`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,W.jsx)(`span`,{className:`text-2xs text-muted-foreground/50`,children:`Checking`}),t[2]=e):e=t[2],e}if(i.status===`invalid`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,W.jsx)(`span`,{className:`text-2xs text-muted-foreground/50`,children:`Checked unavailable`}),t[3]=e):e=t[3],e}let a;return t[4]!==i.suffix||t[5]!==i.value?(a=(0,W.jsx)(`span`,{className:`text-2xs text-muted-foreground/60`,children:i.suffix?(0,W.jsxs)(W.Fragment,{children:[`Checked `,(0,W.jsx)(`span`,{className:`font-mono tabular-nums`,children:i.value}),` `,i.suffix]}):(0,W.jsxs)(W.Fragment,{children:[`Checked `,i.value]})}),t[4]=i.suffix,t[5]=i.value,t[6]=a):a=t[6],a}function Bt(e){let t=(0,U.c)(12),{isPending:n,label:r,onClick:i}=e,a;t[0]===n?a=t[1]:(a=(0,W.jsx)(H,{refreshing:n}),t[0]=n,t[1]=a);let o;t[2]!==n||t[3]!==r||t[4]!==i||t[5]!==a?(o=(0,W.jsx)(F,{render:(0,W.jsx)(m,{size:`icon-xs`,variant:`ghost-muted`,disabled:n,onClick:i,"aria-label":r,children:a})}),t[2]=n,t[3]=r,t[4]=i,t[5]=a,t[6]=o):o=t[6];let s;t[7]===r?s=t[8]:(s=(0,W.jsx)(I,{side:`top`,children:r}),t[7]=r,t[8]=s);let c;return t[9]!==o||t[10]!==s?(c=(0,W.jsxs)(L,{children:[o,s]}),t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function Vt(){let{environment:e}=he(),t=e?.environmentId??null,n=oe(t,y),r=e?.serverConfig?.observability,i=e?.serverConfig?.availableEditors,a=oe(t,w),o=P(t===null?null:se.sessionStateAtom(t)),s=xe({connectionPhase:e?.connection.phase??`available`,session:o.data,hasSessionError:o.error!==null}),c=s.canReadDiagnostics,l=ce(M.signalProcess,{reportFailure:!1}),d=ye(t,i??[]),[f,p]=(0,G.useState)(9e5),h=kt.find(e=>e.windowMs===f)??kt[1],{data:g,error:b,isPending:x,refresh:S}=P(t===null||!c?null:M.traceDiagnostics({environmentId:t,input:{}})),{data:T,error:E,isPending:D,refresh:O}=P(t===null||!c?null:M.processDiagnostics({environmentId:t,input:{}})),{data:A,error:j,isPending:le,refresh:ue}=P(t===null||!c?null:M.processResourceHistory({environmentId:t,input:{windowMs:h.windowMs,bucketMs:h.bucketMs}})),[de,fe]=(0,G.useState)(!1),[R,pe]=(0,G.useState)(null),[me,_e]=(0,G.useState)(null),ve=(0,G.useRef)(null),be=(0,G.useRef)(t),H=(0,G.useRef)(T);(0,G.useEffect)(()=>{H.current=T},[T]),(0,G.useEffect)(()=>(be.current=t,()=>{be.current=null}),[t]);let Ce=(0,G.useCallback)(()=>{let e=r?.logsDirectoryPath??null;e&&t!==null&&N(t,`orchestration:operate`)&&(fe(!0),pe(null),(async()=>{let t=await d(e);if(fe(!1),t._tag===`Failure`&&!ie(t)){let e=re(t);pe(e instanceof Error?e.message:`Unable to open logs folder.`)}})())},[t,r?.logsDirectoryPath,d]),U=x&&g===null,we=D&&T===null,Te=le&&A===null,[Ee,De]=(0,G.useState)(null);Ee!==t&&c&&!U&&!we&&!Te&&De(t);let Oe=(0,G.useCallback)(async(e,t)=>{let n=be.current,r=H.current?.processes.find(t=>t.pid===e);if(n===null||r===void 0||!N(n,`environment:maintain`)||ve.current!==null)return;ve.current=e,_e(e);let i=()=>{ve.current=null,_e(null)};if(t===`SIGKILL`){let n=!1;try{n=await ae().dialogs.confirm(`Send SIGKILL to process ${e}? This cannot be handled by the process.`,{variant:`destructive`})}catch(e){i(),k.add({type:`error`,title:`Could not confirm signal`,description:e instanceof Error?e.message:`Failed to send ${t}.`});return}if(!n){i();return}}let a=be.current;if(a===null||a!==n||!N(a,`environment:maintain`))i();else if(H.current?.processes.find(t=>t.pid===e)?.startTimeMs!==r.startTimeMs)i();else try{let i=await l({environmentId:n,input:{pid:e,startTimeMs:r.startTimeMs,signal:t}});if(i._tag===`Failure`){if(!ie(i)){let e=re(i);k.add({type:`error`,title:`Could not send ${t}`,description:e instanceof Error?e.message:`Failed to send ${t}.`})}return}if(!i.value.signaled){let e=ne(i.value.message);if(O(),yt(e)){k.add({type:`info`,title:`Process already exited`,description:`The process is not a child of the P4 Code server. It might already have exited.`});return}k.add({type:`error`,title:`Could not send ${t}`,description:e??`Failed to send ${t}.`});return}O()}finally{i()}},[O,l]),ke=T?te(T.error):null,K=A?te(A.error):null,Ae=g?te(g.error):null,q=g?ee(g.partialFailure,()=>!1):!1;return c?(0,W.jsxs)(ge,{width:`expanded`,className:`gap-10`,children:[(0,W.jsx)(lt,{environmentId:t}),(0,W.jsxs)(B,{title:`Live Processes`,headerAction:(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(zt,{checkedAt:T?.readAt??null}),(0,W.jsx)(Bt,{isPending:D,label:`Refresh process diagnostics`,onClick:O})]}),children:[(0,W.jsxs)(bt,{children:[(0,W.jsx)($,{label:`Child Processes`,value:T?Z(T.processCount):`...`}),(0,W.jsx)($,{label:`CPU`,value:T?`${T.totalCpuPercent.toFixed(1)}%`:`...`,tooltip:`Total CPU across live child processes of the current server process. The desktop shell and other parent processes are not included.`}),(0,W.jsx)($,{label:`Memory`,value:T?V(T.totalRssBytes):`...`,tooltip:`Total resident memory across live child processes of the current server process. The desktop shell and other parent processes are not included.`}),(0,W.jsx)($,{label:`Server PID`,value:T?String(T.serverPid):`...`})]}),ke||E?(0,W.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 px-4 py-3 text-xs text-muted-foreground sm:px-5`,children:[ke?(0,W.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,W.jsx)(v,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:ke.message})]}):null,E?(0,W.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,W.jsx)(v,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:E})]}):null]}):null,(0,W.jsx)(Dt,{processes:T?.processes??[],canMaintainEnvironment:n,signalingPid:me,onSignal:Oe,emptyLabel:we?`Loading live processes...`:`No live descendant processes found.`})]}),(0,W.jsxs)(B,{title:`Resource History`,headerAction:(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(Ft,{selectedWindowMs:f,onSelect:p}),(0,W.jsx)(zt,{checkedAt:A?.readAt??null}),(0,W.jsx)(Bt,{isPending:le,label:`Refresh resource history`,onClick:ue})]}),children:[(0,W.jsxs)(bt,{children:[(0,W.jsx)($,{label:`CPU Time`,value:A?At(A.totalCpuSecondsApprox):`...`,tooltip:`Approximate active CPU time for the P4 Code server root process and its descendants during the selected window. It grows only while sampled processes use CPU and older samples leave as the window moves.`}),(0,W.jsx)($,{label:`Samples`,value:A?Z(A.retainedSampleCount):`...`,tooltip:`In-memory process samples retained by the server. The server samples only while diagnostics is open, and this resets when the server restarts.`}),(0,W.jsx)($,{label:`Interval`,value:A?A.sampleIntervalMs===0?`On demand`:Q(A.sampleIntervalMs):`...`}),(0,W.jsx)($,{label:`Processes`,value:A?Z(A.topProcesses.length):`...`})]}),K||j?(0,W.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 px-4 py-3 text-xs text-muted-foreground sm:px-5`,children:[K?(0,W.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,W.jsx)(v,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:K.message})]}):null,j?(0,W.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,W.jsx)(v,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:j})]}):null]}):null,(0,W.jsx)(Nt,{buckets:A?.buckets??[]}),(0,W.jsx)(Lt,{processes:A?.topProcesses??[],emptyLabel:Te?`Collecting process resource samples...`:`No process resource samples found for this window.`})]}),(0,W.jsxs)(B,{title:`Trace Diagnostics`,headerAction:(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(zt,{checkedAt:g?.readAt??null}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.jsx)(m,{size:`icon-xs`,variant:`ghost-muted`,disabled:!a||!r?.logsDirectoryPath||de,onClick:Ce,"aria-label":`Open logs folder`,children:(0,W.jsx)(u,{})})}),(0,W.jsx)(I,{side:`top`,children:`Open logs folder`})]}),(0,W.jsx)(Bt,{isPending:x,label:`Refresh trace diagnostics`,onClick:S})]}),children:[(0,W.jsxs)(bt,{children:[(0,W.jsx)($,{label:`Spans`,value:g?Z(g.recordCount):`...`}),(0,W.jsx)($,{label:`Failures`,value:g?Z(g.failureCount):`...`,tone:g&&g.failureCount>0?`danger`:`default`}),(0,W.jsx)($,{label:`Slow Spans`,value:g?Z(g.slowSpanCount):`...`,tooltip:g?`Spans with a duration of ${Q(g.slowSpanThresholdMs)} or longer.`:`Spans at or above the configured slow-span threshold.`,tone:g&&g.slowSpanCount>0?`warning`:`default`}),(0,W.jsx)($,{label:`Parse Errors`,value:g?Z(g.parseErrorCount):`...`,tone:g&&g.parseErrorCount>0?`warning`:`default`})]}),R||Ae||b?(0,W.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 px-4 py-3 text-xs text-muted-foreground sm:px-5`,children:[R?(0,W.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,W.jsx)(v,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:R})]}):null,Ae?(0,W.jsxs)(`div`,{className:_(`flex items-start gap-2`,q?`text-warning-foreground`:`text-destructive`),children:[(0,W.jsx)(v,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:q?`Some trace files could not be read, so diagnostics may be incomplete. ${Ae.message}`:Ae.message})]}):null,b?(0,W.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,W.jsx)(v,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:b})]}):null]}):null]}),(0,W.jsx)(B,{title:`Latest Failures`,children:g&&g.latestFailures.length>0?(0,W.jsx)(St,{headers:[`Span`,`Cause`,`Duration`,`Ended`],children:g.latestFailures.map(e=>(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`td`,{className:`px-4 py-3 align-top text-xs font-medium text-foreground first:sm:pl-5`,children:e.name}),(0,W.jsx)(`td`,{className:`max-w-[360px] px-4 py-3 align-top text-muted-foreground`,children:(0,W.jsx)(Se,{text:e.cause})}),(0,W.jsx)(`td`,{className:`px-4 py-3 align-top font-mono tabular-nums`,children:Q(e.durationMs)}),(0,W.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums text-muted-foreground last:sm:pr-5`,children:_t(e.endedAt)})]},`${e.traceId}:${e.spanId}`))}):(0,W.jsx)(xt,{label:U?`Loading failures...`:`No failed spans found.`})}),(0,W.jsx)(B,{title:`Most Common Failures`,children:g&&g.commonFailures.length>0?(0,W.jsx)(St,{headers:[`Span`,`Count`,`Cause`,`Last Seen`],minTableWidth:`min-w-[760px]`,children:g.commonFailures.map(e=>(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`td`,{className:`px-4 py-3 align-top text-xs font-medium text-foreground first:sm:pl-5`,children:e.name}),(0,W.jsx)(`td`,{className:`px-4 py-3 align-top font-mono tabular-nums`,children:Z(e.count)}),(0,W.jsx)(`td`,{className:`max-w-[360px] px-4 py-3 align-top text-muted-foreground`,children:(0,W.jsx)(Se,{text:e.cause})}),(0,W.jsx)(`td`,{className:`w-px whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums text-muted-foreground last:sm:pr-5`,children:_t(e.lastSeenAt)})]},`${e.name}:${e.cause}`))}):(0,W.jsx)(xt,{label:U?`Loading failure groups...`:`No repeated failures found.`})}),(0,W.jsx)(B,{title:`Slowest Spans`,children:g&&g.slowestSpans.length>0?(0,W.jsx)(St,{headers:[`Span`,`Duration`,`Ended`,`Trace`],minTableWidth:`min-w-[900px]`,columnWidths:[`w-[44%]`,`w-[14%]`,`w-[12%]`,`w-[30%]`],children:g.slowestSpans.map(e=>(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`td`,{className:`px-4 py-3 align-top text-xs font-medium text-foreground first:sm:pl-5`,children:e.name}),(0,W.jsx)(`td`,{className:`px-4 py-3 align-top font-mono tabular-nums`,children:Q(e.durationMs)}),(0,W.jsx)(`td`,{className:`w-px whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums text-muted-foreground`,children:_t(e.endedAt)}),(0,W.jsx)(`td`,{className:`min-w-0 whitespace-nowrap px-4 py-3 align-top text-muted-foreground last:sm:pr-5`,children:(0,W.jsx)(Ct,{traceId:e.traceId})})]},`${e.traceId}:${e.spanId}`))}):(0,W.jsx)(xt,{label:U?`Loading slow spans...`:`No spans found.`})}),(0,W.jsx)(B,{title:`Span Logs`,children:g&&g.latestWarningAndErrorLogs.length>0?(0,W.jsx)(z,{radius:`none`,chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`w-full max-w-full`,children:(0,W.jsxs)(`table`,{className:`w-full min-w-[920px] table-fixed text-left text-xs`,children:[(0,W.jsxs)(`colgroup`,{children:[(0,W.jsx)(`col`,{className:`w-[11%]`}),(0,W.jsx)(`col`,{className:`w-[9%]`}),(0,W.jsx)(`col`,{className:`w-[24%]`}),(0,W.jsx)(`col`,{className:`w-[26%]`}),(0,W.jsx)(`col`,{className:`w-[30%]`})]}),(0,W.jsx)(`thead`,{className:`border-b border-border/60 text-2xs uppercase tracking-widest text-muted-foreground/70`,children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{className:`whitespace-nowrap px-4 py-2.5 font-semibold sm:pl-5`,children:`Time`}),(0,W.jsx)(`th`,{className:`whitespace-nowrap px-4 py-2.5 font-semibold`,children:`Level`}),(0,W.jsx)(`th`,{className:`whitespace-nowrap px-4 py-2.5 font-semibold`,children:`Span`}),(0,W.jsx)(`th`,{className:`whitespace-nowrap px-4 py-2.5 font-semibold`,children:`Message`}),(0,W.jsx)(`th`,{className:`whitespace-nowrap px-4 py-2.5 font-semibold sm:pr-5`,children:`Trace`})]})}),(0,W.jsx)(`tbody`,{className:`divide-y divide-border/60`,children:g.latestWarningAndErrorLogs.map(e=>(0,W.jsxs)(`tr`,{className:`hover:bg-muted/15`,children:[(0,W.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums text-muted-foreground sm:pl-5`,children:_t(e.seenAt)}),(0,W.jsx)(`td`,{className:`px-4 py-3 align-top`,children:(0,W.jsx)(`span`,{className:`inline-flex rounded bg-muted px-1.5 py-0.5 font-mono text-2xs font-medium uppercase text-foreground/80`,children:e.level})}),(0,W.jsx)(`td`,{className:`px-4 py-3 align-top`,children:(0,W.jsx)(`div`,{className:`truncate font-medium text-foreground`,children:e.spanName})}),(0,W.jsx)(`td`,{className:`px-4 py-3 align-top text-muted-foreground`,children:(0,W.jsx)(Se,{collapsedClassName:`line-clamp-2`,expandLabel:`Show full message`,text:e.message})}),(0,W.jsx)(`td`,{className:`min-w-0 whitespace-nowrap px-4 py-3 align-top text-muted-foreground sm:pr-5`,children:(0,W.jsx)(Ct,{traceId:e.traceId})})]},`${e.traceId}:${e.spanId}:${C(e.seenAt)}:${e.message}`))})]})}):(0,W.jsx)(xt,{label:U?`Loading recent logs...`:`No warnings or errors found.`})}),(0,W.jsx)(B,{title:`Top Span Names`,children:g&&g.topSpansByCount.length>0?(0,W.jsx)(St,{headers:[`Span`,`Count`,`Failures`,`Average`,`Max`],minTableWidth:`min-w-[760px]`,columnWidths:[`w-[48%]`,`w-[13%]`,`w-[13%]`,`w-[13%]`,`w-[13%]`],children:g.topSpansByCount.map(e=>(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`td`,{className:`px-4 py-3 align-top text-xs font-medium text-foreground first:sm:pl-5`,children:e.name}),(0,W.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums`,children:Z(e.count)}),(0,W.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums`,children:Z(e.failureCount)}),(0,W.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums`,children:Q(e.averageDurationMs)}),(0,W.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums last:sm:pr-5`,children:Q(e.maxDurationMs)})]},e.name))}):(0,W.jsx)(xt,{label:U?`Loading span names...`:`No spans found.`})}),Ee===t&&(0,W.jsx)(pt,{})]}):(0,W.jsx)(ge,{children:(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t===null?`Connect an environment to see diagnostics.`:s.isPending?`Checking diagnostics access…`:s.error})})}var Ht=Vt;export{Ht as component};
|
|
2
|
+
//# sourceMappingURL=settings.diagnostics-kp_wJw6e.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./react-BUfh6y28.js";import{n as t,t as n}from"./jsx-runtime-DJeoFXNw.js";import{n as r}from"./SettingsPanels-
|
|
2
|
-
//# sourceMappingURL=settings.general-
|
|
1
|
+
import{a as e}from"./react-BUfh6y28.js";import{n as t,t as n}from"./jsx-runtime-DJeoFXNw.js";import{n as r}from"./SettingsPanels-D_rJsyjt.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.general-B5Kke4t3.js.map
|
package/dist/client/assets/{settings.integrations-CYmWtYZT.js → settings.integrations-CjiKCDy_.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{$n as i,Hu as a,Jl as o,Od as s,Ol as c,Td as l,Xn as u,Zd as d,Zn as f,er as p,fr as m,hr as h,il as g,iu as _,l as v,mr as y,op as b,rr as x,sl as S,sr as C,t as w,tr as T,wd as E}from"./utils-BVnIIHXP.js";import{Cg as D,Hr as O,Jr as k,Kr as A,Lr as j,Mn as M,Nn as N,Rr as P,Sn as F,Vm as I,Wr as L,Xr as R,Yr as z,cc as B,hl as V,jn as ee,la as H,lc as U,v as te,wn as ne,xn as re,y as ie}from"./src-DHn7yNZx.js";import{Dr as ae}from"./runtime-vb0YwEUc.js";import{w as oe}from"./entities-JWl3bvMT.js";import{a as se,r as W,t as ce}from"./number-field-DNna9ps3.js";import{a as G,c as le,i as ue,o as K,r as de,s as fe,t as pe}from"./select-CNcZzYBl.js";import{t as me}from"./spinner-m1uNq_wW.js";import{a as q}from"./relay-Ceq0htTl.js";import{D as he,J as ge,O as _e,c as ve,o as ye,r as be,s as J,x as Y}from"./useSettings-Dp27sUML.js";import{f as xe}from"./server-Bw1ZPPkk.js";import{i as Se,n as Ce}from"./session-YEQs2e4k.js";import{t as we}from"./query-DFSffMGJ.js";import{t as Te}from"./use-atom-command-DkmE-pw9.js";import{t as Ee}from"./env-BfPir1X4.js";import{a as De,n as Oe,t as ke}from"./tooltip-BhCWnsdW.js";import{t as Ae}from"./input-yaZxaTds.js";import{a as je,c as Me,i as Ne,n as Pe,o as Fe,r as Ie,s as Le,t as Re}from"./dialog-DFlZvvht.js";import{i as ze,t as Be}from"./device-i4SkE05R.js";import{a as Ve,d as He,i as Ue,n as We,o as Ge,t as Ke,u as qe}from"./DeviceSetup-BQvNWMm0.js";import{a as Je,i as Ye,o as Xe,t as Ze}from"./popover-DnYfrQly.js";import{t as Qe}from"./AnimatedHeight-B2j_NXft.js";import{i as $e,n as et}from"./Icons-DpgbzNj8.js";import{t as tt}from"./preview-Dd9kGZBH.js";import{r as nt}from"./preview-Bi-hPWTp.js";import{a as rt,i as it,n as at,o as ot,r as st,s as ct,t as lt}from"./alert-dialog-Dn_PRSFU.js";import{F as ut,R as dt,V as ft,a as X,c as pt,i as mt,r as ht,s as gt,w as _t}from"./settingsLayout-DaKDuaST.js";import{$a as vt,Lr as yt,No as bt,Qa as xt,Uo as St,oo as Ct}from"./main-43D2LVmx.js";import{t as wt}from"./ProjectDefaultsSettings-TlEARfjk.js";import{t as Tt}from"./draft-input-1HTN8QVo.js";import{t as Et}from"./ScopedSwitch-D1e9m-dH.js";import{t as Dt}from"./SecretInput-C6zW-8wI.js";import{n as Ot,r as kt,t as At}from"./usePermissionStatus-DeJYBk6u.js";var Z=n(),Q=e(r(),1);function jt(e){let t=(0,Z.c)(27),{tools:n,action:r,kind:i,owner:a,error:o}=e,s=i?n?.[i]:void 0,c;t[0]===s?c=t[1]:(c=s?.runningVersion??(s?.installedVersions.includes(s.requiredVersion)?s.requiredVersion:s?.installedVersions.toSorted(Mt).at(-1)),t[0]=s,t[1]=c);let l=c,u=i===`hub`?`Device hub`:`Agent device`,d=i?`${u}: ${l?`version ${l}`:s?`not installed`:`version unknown`}. Show details`:void 0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(h,{tone:`muted`}),t[2]=f):f=t[2];let p=i?l?`v${l}`:s?`Not installed`:`Version unknown`:o?`Versions unavailable`:`Versions`,m;t[3]!==d||t[4]!==p?(m=(0,Q.jsx)(Xe,{"aria-label":d,render:f,children:p}),t[3]=d,t[4]=p,t[5]=m):m=t[5];let g=i?u:`Device tools`,_;t[6]===g?_=t[7]:(_=(0,Q.jsx)(Je,{children:g}),t[6]=g,t[7]=_);let v;t[8]!==i||t[9]!==u||t[10]!==n?(v=n?(0,Q.jsx)(`div`,{className:`mt-4 divide-y divide-border/50`,children:[[`Device hub`,n.hub],[`Agent device`,n.agent]].filter(e=>{let[t]=e;return!i||t===u}).map(e=>{let[t,n]=e;return(0,Q.jsxs)(`div`,{className:`space-y-2 py-3 first:pt-0 last:pb-0`,children:[i?null:(0,Q.jsx)(`p`,{className:`text-xs font-medium`,children:t}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 text-xs`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Running`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.runningVersion??`Not running`}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Required`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.requiredVersion}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Installed`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono break-words`,children:n.installedVersions.join(`, `)||`None`})]})]},t)})}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Versions have not been checked.`}),t[8]=i,t[9]=u,t[10]=n,t[11]=v):v=t[11];let y=a?`Managed by ${a}. `:``,b;t[12]===y?b=t[13]:(b=(0,Q.jsxs)(`p`,{className:`mt-4 border-t border-border/50 pt-3 text-xs text-muted-foreground`,children:[y,`Tools update automatically on this host when needed.`]}),t[12]=y,t[13]=b);let x;t[14]===o?x=t[15]:(x=o?(0,Q.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-destructive`,children:o}):null,t[14]=o,t[15]=x);let S;t[16]===r?S=t[17]:(S=r?(0,Q.jsx)(`div`,{className:`mt-3`,children:r}):null,t[16]=r,t[17]=S);let C;t[18]!==b||t[19]!==x||t[20]!==S||t[21]!==_||t[22]!==v?(C=(0,Q.jsxs)(Ye,{align:`end`,width:`md`,children:[_,v,b,x,S]}),t[18]=b,t[19]=x,t[20]=S,t[21]=_,t[22]=v,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==m?(w=(0,Q.jsxs)(Ze,{children:[m,C]}),t[24]=C,t[25]=m,t[26]=w):w=t[26],w}function Mt(e,t){return e.localeCompare(t,void 0,{numeric:!0})}var $=e(t(),1);function Nt(e,t,n,r=t){let i=(e,t)=>e.target===t.target&&e.port===t.port&&e.identityFile===t.identityFile,a=t=>{let n=e.filter(e=>i(e,t));if(n.length>1)throw Error(`Multiple hosts match this SSH destination. Select the environment to edit its hosts.`);return n[0]},o=e.find(e=>e.id===r.id)??a(r)??(n?void 0:a(t));return n?e.filter(e=>e.id!==o?.id):o?e.map(e=>e.id===o.id?{...t,id:o.id}:e):[...e,t]}function Pt(e){let t=(0,Z.c)(4),{platforms:n}=e,r;t[0]===n?r=t[1]:(r=n.map(Ft),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:r}),t[2]=r,t[3]=i),i}function Ft(e){return(0,Q.jsxs)(ke,{children:[(0,Q.jsxs)(De,{render:(0,Q.jsx)(`span`,{tabIndex:0,className:`inline-flex items-center gap-1`}),children:[e.available?(0,Q.jsx)(c,{className:`size-3`}):(0,Q.jsx)(E,{className:`size-3`}),e.platform===`ios`?`iOS`:`Android`,` `,e.available?`available`:`unavailable`]}),(0,Q.jsx)(Oe,{children:e.reason??(e.platform===`ios`?`iOS available`:`Android available`)})]},e.platform)}var It=V(U);function Lt(e){let{identityFile:t,...n}=e;return It({...n,...t?.trim()?{identityFile:t.trim()}:{}})}function Rt(e){return JSON.stringify([e.target.trim(),e.port,e.identityFile?.trim()||void 0])}async function zt(e,t,n,r){await Promise.all(e.map(async e=>{r(e.environmentId,{status:`pending`});try{if(!e.connected)throw Error(`Environment disconnected`);let i=await n(e.environmentId,t);r(e.environmentId,i.kind===`local`?{status:`local`}:{status:`connected`,platforms:i.platforms,...i.tools?{tools:i.tools}:{}})}catch(t){r(e.environmentId,{status:`failed`,error:t instanceof Error?t.message:String(t)})}}))}function Bt(e){let t=Te(Be.testHost,{reportFailure:!1}),[n,r]=(0,$.useState)({}),i=(0,$.useRef)(new Set);return{checks:n,testConnection:async n=>{let a=Rt(n);if(i.current.has(a))return;i.current.add(a),r(e=>({...e,[a]:{}}));let o={};try{return await zt(e,n,async(e,n)=>{if(!Ce(e,`settings:write`))throw Error(`This connection cannot test device hosts.`);let r=await t({environmentId:e,input:n});if(r._tag===`Failure`)throw ae(r);return r.value},(e,t)=>{o[e]=t,r(n=>({...n,[a]:{...n[a],[e]:t}}))}),o}finally{i.current.delete(a)}}}}function Vt(e){let t=(0,Z.c)(107),{host:n,isNew:r,targets:i,busy:a,onSave:o,onClose:s}=e,[u,d]=(0,$.useState)(n),{checks:f,testConnection:p}=Bt(i),m=f[Rt(u)],h=Object.values(m??{}).some(Ut),g,_;t[0]===u?(g=t[1],_=t[2]):(g=Lt({...u,label:u.label.trim()||u.target}),_=D(g),t[0]=u,t[1]=g,t[2]=_);let v=_,x;t[3]===m?x=t[4]:(x=Object.values(m??{}).filter(Ht),t[3]=m,t[4]=x);let S=x.length,C;t[5]!==a||t[6]!==s?(C=e=>{!e&&!a&&s()},t[5]=a,t[6]=s,t[7]=C):C=t[7];let w=!a,T;t[8]!==a||t[9]!==h||t[10]!==u.label||t[11]!==g||t[12]!==o?(T=(0,Q.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),D(g)&&u.label.trim()&&!a&&!h&&o(g.value)}}),t[8]=a,t[9]=h,t[10]=u.label,t[11]=g,t[12]=o,t[13]=T):T=t[13];let E=r?`Add device host`:`Edit device host`,O;t[14]===E?O=t[15]:(O=(0,Q.jsx)(Me,{children:E}),t[14]=E,t[15]=O);let k=i.length===1?`Connect from ${i[0]?.label}.`:`Connect from ${i.length} selected environments.`,A;t[16]===k?A=t[17]:(A=(0,Q.jsxs)(Ie,{children:[k,` `,`Hosts on the same machine are skipped.`]}),t[16]=k,t[17]=A);let j;t[18]!==O||t[19]!==A?(j=(0,Q.jsxs)(je,{children:[O,A]}),t[18]=O,t[19]=A,t[20]=j):j=t[20];let M;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(`span`,{children:`Name`}),t[21]=M):M=t[21];let N;t[22]===u?N=t[23]:(N=e=>d({...u,label:e.target.value}),t[22]=u,t[23]=N);let P;t[24]!==a||t[25]!==u.label||t[26]!==N?(P=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[M,(0,Q.jsx)(Ae,{autoFocus:!0,required:!0,value:u.label,disabled:a,onChange:N,placeholder:`Mac mini`})]}),t[24]=a,t[25]=u.label,t[26]=N,t[27]=P):P=t[27];let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(`span`,{children:`SSH target`}),t[28]=F):F=t[28];let I;t[29]===u?I=t[30]:(I=e=>d({...u,target:e.target.value}),t[29]=u,t[30]=I);let L;t[31]!==a||t[32]!==u.target||t[33]!==I?(L=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[F,(0,Q.jsx)(Ae,{required:!0,value:u.target,disabled:a,onChange:I,placeholder:`user@host or SSH alias`})]}),t[31]=a,t[32]=u.target,t[33]=I,t[34]=L):L=t[34];let R=n.port!==void 0||n.identityFile!==void 0||void 0,z;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:`SSH options`}),t[35]=z):z=t[35];let B;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(`span`,{children:`Identity file`}),t[36]=B):B=t[36];let V=u.identityFile??``,ee;t[37]===u?ee=t[38]:(ee=e=>{let{identityFile:t,...n}=u;d(e.target.value?{...n,identityFile:e.target.value}:n)},t[37]=u,t[38]=ee);let H;t[39]!==a||t[40]!==V||t[41]!==ee?(H=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[B,(0,Q.jsx)(Ae,{value:V,disabled:a,onChange:ee,placeholder:`SSH config default`})]}),t[39]=a,t[40]=V,t[41]=ee,t[42]=H):H=t[42];let U;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(`span`,{children:`Port`}),t[43]=U):U=t[43];let te=u.port??``,ne;t[44]===u?ne=t[45]:(ne=e=>{let{port:t,...n}=u;d(e.target.value?{...n,port:Number(e.target.value)}:n)},t[44]=u,t[45]=ne);let re;t[46]!==a||t[47]!==te||t[48]!==ne?(re=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[U,(0,Q.jsx)(Ae,{type:`number`,min:1,max:65535,value:te,disabled:a,onChange:ne,placeholder:`Default`})]}),t[46]=a,t[47]=te,t[48]=ne,t[49]=re):re=t[49];let ie;t[50]!==H||t[51]!==re?(ie=(0,Q.jsxs)(`div`,{className:`mt-3 grid grid-cols-[minmax(0,1fr)_7rem] gap-3`,children:[H,re]}),t[50]=H,t[51]=re,t[52]=ie):ie=t[52];let ae;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Optional. Resolved separately on each environment.`}),t[53]=ae):ae=t[53];let oe;t[54]!==R||t[55]!==ie?(oe=(0,Q.jsxs)(`details`,{open:R,className:`text-sm`,children:[z,ie,ae]}),t[54]=R,t[55]=ie,t[56]=oe):oe=t[56];let se=h?`Checking environments…`:m?S?`${S} of ${i.length} failed`:`Connection checks passed`:`Check access before saving`,W;t[57]===se?W=t[58]:(W=(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:se}),t[57]=se,t[58]=W);let ce=a||h||!v,G;t[59]!==g||t[60]!==p?(G=()=>{D(g)&&p(g.value)},t[59]=g,t[60]=p,t[61]=G):G=t[61];let le;t[62]===h?le=t[63]:(le=h?(0,Q.jsx)(me,{size:`xs`}):null,t[62]=h,t[63]=le);let ue;t[64]!==ce||t[65]!==G||t[66]!==le?(ue=(0,Q.jsxs)(y,{type:`button`,size:`sm`,variant:`outline`,disabled:ce,onClick:G,children:[le,` Test connection`]}),t[64]=ce,t[65]=G,t[66]=le,t[67]=ue):ue=t[67];let K;t[68]!==W||t[69]!==ue?(K=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-2.5`,children:[W,ue]}),t[68]=W,t[69]=ue,t[70]=K):K=t[70];let de;t[71]!==m||t[72]!==i?(de=m?(0,Q.jsx)(`ul`,{className:`border-t border-border/60 divide-y divide-border/40`,children:i.map(e=>{let t=m[e.environmentId];return t?(0,Q.jsxs)(`li`,{className:`px-3 py-2.5 text-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:e.label}),(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-1.5 ${t.status===`failed`?`text-destructive`:`text-muted-foreground`}`,children:t.status===`pending`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(me,{size:`xs`}),` Checking…`]}):t.status===`local`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`size-3`}),` Already available locally`]}):t.status===`failed`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(b,{className:`size-3`}),` Failed`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(c,{className:`size-3`}),` Connected`]})})]}),t.status===`connected`?(0,Q.jsx)(`div`,{className:`mt-1.5`,children:(0,Q.jsx)(Pt,{platforms:t.platforms})}):null,t.status===`failed`?(0,Q.jsxs)(`details`,{className:`mt-1.5 text-muted-foreground`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:`Show error`}),(0,Q.jsx)(`p`,{className:`mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-words`,children:t.error})]}):null]},e.environmentId):null})}):null,t[71]=m,t[72]=i,t[73]=de):de=t[73];let fe;t[74]!==K||t[75]!==de?(fe=(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/60`,children:[K,de]}),t[74]=K,t[75]=de,t[76]=fe):fe=t[76];let pe;t[77]!==P||t[78]!==L||t[79]!==oe||t[80]!==fe?(pe=(0,Q.jsxs)(Fe,{children:[P,L,oe,fe]}),t[77]=P,t[78]=L,t[79]=oe,t[80]=fe,t[81]=pe):pe=t[81];let q;t[82]!==a||t[83]!==s?(q=(0,Q.jsx)(y,{type:`button`,variant:`ghost`,disabled:a,onClick:s,children:`Cancel`}),t[82]=a,t[83]=s,t[84]=q):q=t[84];let he;t[85]!==a||t[86]!==h||t[87]!==u.label||t[88]!==v?(he=a||h||!v||!u.label.trim(),t[85]=a,t[86]=h,t[87]=u.label,t[88]=v,t[89]=he):he=t[89];let ge;t[90]===a?ge=t[91]:(ge=a?(0,Q.jsx)(me,{size:`xs`}):null,t[90]=a,t[91]=ge);let _e;t[92]!==he||t[93]!==ge?(_e=(0,Q.jsxs)(y,{type:`submit`,disabled:he,children:[ge,` Save host`]}),t[92]=he,t[93]=ge,t[94]=_e):_e=t[94];let ve;t[95]!==q||t[96]!==_e?(ve=(0,Q.jsxs)(Ne,{children:[q,_e]}),t[95]=q,t[96]=_e,t[97]=ve):ve=t[97];let ye;t[98]!==j||t[99]!==pe||t[100]!==w||t[101]!==ve||t[102]!==T?(ye=(0,Q.jsxs)(Le,{showCloseButton:w,render:T,children:[j,pe,ve]}),t[98]=j,t[99]=pe,t[100]=w,t[101]=ve,t[102]=T,t[103]=ye):ye=t[103];let be;return t[104]!==C||t[105]!==ye?(be=(0,Q.jsx)(Re,{open:!0,onOpenChange:C,children:ye}),t[104]=C,t[105]=ye,t[106]=be):be=t[106],be}function Ht(e){return e.status===`failed`}function Ut(e){return e.status===`pending`}function Wt(e){let{scope:t,environments:n,connectedEnvironments:r}=ft(),i=Se(e.environmentId,H),a=t.kind===`project`||t.kind===`checkout`,o=Te(xe.updateSettings,{reportFailure:!1}),[s,c]=(0,$.useState)(null),[l,u]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),m=n.map(e=>({environmentId:e.environmentId,label:e.label,connected:e.connection.phase===`connected`})),{checks:h,testConnection:g}=Bt(m),_=async(t,r=!1,i=t)=>{if(e.environmentId&&!a){p(!0);try{let e=await Promise.allSettled(n.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!Ce(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return o({environmentId:e.environmentId,input:{patch:{deviceHosts:Nt(e.serverConfig.settings.deviceHosts,t,r,i)}}})})),a=n.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});a.length===0?c(null):q.add({type:`error`,title:`Device hosts not saved on all environments`,description:`Could not update ${a.map(e=>e.label).join(`, `)}.`})}finally{p(!1)}}};return(0,Q.jsx)(X,{id:`device-hosts`,title:`Device hosts`,serverScoped:!0,settingKeys:[`deviceHosts`],description:`Add remote machines with simulator or emulator runtimes installed, and the selected environments will connect over SSH and set up device tools automatically.`,control:(0,Q.jsxs)(y,{size:`sm`,variant:`outline`,disabled:!i||a||f||!e.environmentId||s!==null,onClick:()=>{u(null),c({kind:`ssh`,id:v(),label:``,target:``})},children:[(0,Q.jsx)(d,{className:`size-3.5`}),` Add host`]}),children:(0,Q.jsx)(`div`,{className:`pt-3 pb-2`,children:e.environmentId?(0,Q.jsxs)(Q.Fragment,{children:[r.map(e=>(0,Q.jsxs)(`div`,{children:[r.length>1?(0,Q.jsx)(`p`,{className:`pt-3 pb-1 text-xs font-medium text-muted-foreground`,children:e.label}):null,(0,Q.jsx)(Gt,{environmentLabel:e.label,environmentId:e.environmentId,hosts:e.serverConfig?.settings.deviceHosts??[],busy:!i||a||f,checks:h,testConnection:async e=>{let t=await g(e);if(!t)return;let n=m.filter(e=>t[e.environmentId]?.status===`failed`);return q.add({type:n.length?`error`:`success`,title:n.length?`${e.label}: ${n.length} of ${m.length} environments failed`:`${e.label}: connection checks passed`,description:n.length?`Could not connect from ${n.map(e=>e.label).join(`, `)}.`:`Connected or already available locally on each selected environment.`}),t},onEdit:e=>{u(e),c(e)},onRemove:e=>void _(e,!0)})]},e.environmentId)),s?(0,Q.jsx)(Vt,{host:s,isNew:l===null,targets:m,busy:f,onSave:e=>void _(e,!1,l??e),onClose:()=>c(null)},s.id):null]}):(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect a selected environment to manage device hosts.`})})})}function Gt(e){let t=(0,Z.c)(28),{environmentLabel:n,environmentId:r,hosts:i,busy:a,onEdit:o,onRemove:c,checks:l,testConnection:u}=e,{state:d}=ze(r),p=Te(Be.list),[h,g]=(0,$.useState)(null),_;t[0]===i.length?_=t[1]:(_=i.length===0?(0,Q.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`No device hosts.`}):null,t[0]=i.length,t[1]=_);let v;if(t[2]!==a||t[3]!==l||t[4]!==r||t[5]!==n||t[6]!==i||t[7]!==o||t[8]!==c||t[9]!==p||t[10]!==h||t[11]!==d||t[12]!==u){let e;t[14]!==a||t[15]!==l||t[16]!==r||t[17]!==n||t[18]!==o||t[19]!==c||t[20]!==p||t[21]!==h||t[22]!==d||t[23]!==u?(e=e=>{let t=d.hostStatuses[e.id],i=l[Rt(e)]?.[r],_=(i?.status===`connected`?i.platforms:void 0)??d.hosts.find(t=>t.id===e.id)?.platforms??[],v=i?.status===`pending`?`Checking connection…`:t?.status===`installing`?`Installing device support…`:t?.status===`starting`?`Connecting…`:null,b=i?.status===`failed`?i.error:i?.status===`local`?void 0:t?.status===`failed`?t.detail:void 0;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/50 py-2.5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.label}),_.filter(qt).map(Kt)]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.target}),(0,Q.jsx)(jt,{owner:n,error:d.hosts.find(t=>t.id===e.id)?.toolInspectionError,tools:d.hosts.find(t=>t.id===e.id)?.tools??(i?.status===`connected`?i.tools:void 0)}),i?.status===`local`?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Already available locally`}):null,b?(0,Q.jsx)(`div`,{className:`mt-1`,role:`status`,children:(0,Q.jsxs)(`details`,{className:`text-xs text-destructive`,children:[(0,Q.jsx)(`summary`,{children:`Connection failed`}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words`,children:b})]})}):null]}),v?(0,Q.jsxs)(`span`,{role:`status`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(me,{size:`xs`}),v]}):null,(0,Q.jsxs)(f,{children:[(0,Q.jsx)(m,{render:(0,Q.jsx)(y,{size:`icon-sm`,variant:`ghost-muted`,disabled:a,"aria-label":e.label+` options`}),children:(0,Q.jsx)(s,{})}),(0,Q.jsxs)(x,{align:`end`,children:[(0,Q.jsx)(T,{onClick:()=>{o(e)},children:`Edit`}),(0,Q.jsx)(T,{variant:`destructive`,onClick:()=>c(e),children:`Remove`})]})]}),t?.status===`failed`&&d.supportsHostRetry&&d.hostStatus!==`disabled`?(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:a||h!==null,onClick:()=>{g(e.id),p({environmentId:r,input:{retryHostId:e.id}}).finally(()=>g(null))},children:h===e.id?`Retrying…`:`Retry`}):(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:a||v!==null,onClick:()=>void u(e),children:`Test connection`})]},e.id)},t[14]=a,t[15]=l,t[16]=r,t[17]=n,t[18]=o,t[19]=c,t[20]=p,t[21]=h,t[22]=d,t[23]=u,t[24]=e):e=t[24],v=i.map(e),t[2]=a,t[3]=l,t[4]=r,t[5]=n,t[6]=i,t[7]=o,t[8]=c,t[9]=p,t[10]=h,t[11]=d,t[12]=u,t[13]=v}else v=t[13];let b;return t[25]!==_||t[26]!==v?(b=(0,Q.jsxs)(Q.Fragment,{children:[_,v]}),t[25]=_,t[26]=v,t[27]=b):b=t[27],b}function Kt(e){return(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(`span`,{tabIndex:0,role:`img`,"aria-label":e.platform===`ios`?`iOS available`:`Android available`,className:`shrink-0 text-muted-foreground`}),children:e.platform===`ios`?(0,Q.jsx)($e,{className:`size-3.5 -translate-y-px`}):(0,Q.jsx)(et,{className:`size-3.5`})}),(0,Q.jsx)(Oe,{children:e.platform===`ios`?`iOS available`:`Android available`})]},e.platform)}function qt(e){return e.available}var Jt=V(B),Yt=e=>({kind:`eas`,id:e,label:`EAS Simulator`,accessToken:``,maxSessionMinutes:30,idleMinutes:10,maxConcurrentSessions:2});function Xt(e,t,n){return n?e.filter(e=>e.id!==t.id):e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?t:e):[...e,t]}function Zt(e){return`Up to ${e.maxConcurrentSessions===1?`1 session`:`${e.maxConcurrentSessions} sessions`} at once, each stopped after ${e.maxSessionMinutes} min or ${e.idleMinutes} idle min`}var Qt=`thread-project`,$t={settings:`the access token saved here`,env:`EXPO_TOKEN on the server`,"eas-login":`the server's eas login`},en=e=>{let t=I(e);return t instanceof Error?t.message:String(t)};function tn(e){let t=(0,Z.c)(24),{scope:n,connectedEnvironments:r}=ft(),i=Se(e.environmentId,H),a=n.kind===`project`||n.kind===`checkout`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={reportFailure:!1},t[0]=s):s=t[0];let c=Te(xe.updateSettings,s),l;t[1]===e.environmentId?l=t[2]:(l=t=>t.environmentId===e.environmentId,t[1]=e.environmentId,t[2]=l);let u=r.find(l)?.serverConfig?.settings.easDeviceHosts??[],[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(!1),g=!i||a||m||!e.environmentId,_=async(t,n)=>{if(!e.environmentId||!Ce(e.environmentId,`settings:write`))return;h(!0);let r=await c({environmentId:e.environmentId,input:{patch:{easDeviceHosts:Xt(u,t,n)}}});h(!1),r._tag===`Success`?p(null):q.add({type:`error`,title:n?`EAS host not removed`:`EAS host not saved`,description:en(r.cause)})},b=X,x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=[`easDeviceHosts`],t[3]=x):x=t[3];let S=g||f!==null,C;t[4]===p?C=t[5]:(C=()=>p({host:Yt(v()),isNew:!0}),t[4]=p,t[5]=C);let w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(d,{className:`size-3.5`}),t[6]=w):w=t[6];let T;t[7]!==S||t[8]!==C?(T=(0,Q.jsxs)(y,{size:`sm`,variant:`outline`,disabled:S,onClick:C,children:[w,` Add EAS host`]}),t[7]=S,t[8]=C,t[9]=T):T=t[9];let E=u.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No EAS hosts.`}):(0,Q.jsx)(`ul`,{className:`divide-y divide-border/40`,children:u.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2.5 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 truncate font-medium`,children:[(0,Q.jsx)(o,{className:`size-3.5 shrink-0`}),` `,e.label]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:Zt(e)})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,Q.jsx)(y,{size:`sm`,variant:`ghost`,disabled:g,onClick:()=>p({host:e,isNew:!1}),children:`Edit`}),(0,Q.jsx)(y,{size:`sm`,variant:`ghost-destructive`,disabled:g,onClick:()=>void _(e,!0),children:`Remove`})]})]},e.id))}),D;t[10]!==m||t[11]!==f||t[12]!==e.environmentId||t[13]!==_||t[14]!==p?(D=f&&e.environmentId?(0,Q.jsx)(nn,{environmentId:e.environmentId,host:f.host,isNew:f.isNew,busy:m,onSave:e=>void _(e,!1),onClose:()=>p(null)},f.host.id):null,t[10]=m,t[11]=f,t[12]=e.environmentId,t[13]=_,t[14]=p,t[15]=D):D=t[15];let O;t[16]!==E||t[17]!==D?(O=(0,Q.jsxs)(`div`,{className:`pt-3 pb-2`,children:[E,D]}),t[16]=E,t[17]=D,t[18]=O):O=t[18];let k;return t[19]!==b||t[20]!==T||t[21]!==O||t[22]!==x?(k=(0,Q.jsx)(b,{id:`eas-device-hosts`,title:`EAS Simulator`,serverScoped:!0,settingKeys:x,description:`Run iOS Simulators and Android emulators in Expo's cloud. Sessions bill the Expo account until they stop, so each host caps their number and length. Editing or removing a host stops them.`,control:T,children:O}),t[19]=b,t[20]=T,t[21]=O,t[22]=x,t[23]=k):k=t[23],k}function nn(e){let t=(0,Z.c)(135),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=Te(Be.easAccount,n),[i,a]=(0,$.useState)(e.host),o=(0,$.useId)(),s;t[1]===e.host.accessToken?s=t[2]:(s=e.host.accessToken?{kind:`saved`}:{kind:`cleared`},t[1]=e.host.accessToken,t[2]=s);let[c,l]=(0,$.useState)(s),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u={status:`checking`},t[3]=u):u=t[3];let[d,f]=(0,$.useState)(u),p,m;t[4]!==i||t[5]!==e.host.accessToken||t[6]!==c.kind||t[7]!==c.value?(p={...i,label:i.label.trim(),accessToken:c.kind===`saved`?e.host.accessToken:c.kind===`new`?c.value:``},m=D(Jt(p)),t[4]=i,t[5]=e.host.accessToken,t[6]=c.kind,t[7]=c.value,t[8]=p,t[9]=m):(p=t[8],m=t[9]);let h=m,g=h?null:i.maxSessionMinutes>0&&i.idleMinutes>=i.maxSessionMinutes?`Idle minutes must be smaller than session minutes.`:`Give the host a label and limits within the ranges shown.`,_;t[10]!==d.account||t[11]!==d.status?(_=d.status===`signed-in`?d.account.apps:[],t[10]=d.account,t[11]=d.status,t[12]=_):_=t[12];let v=_,x=(0,$.useRef)(0),S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>{x.current+=1,f({status:`idle`})},t[13]=S):S=t[13];let C=S,w;t[14]!==r||t[15]!==e.environmentId||t[16]!==e.host.id||t[17]!==e.isNew||t[18]!==c.kind||t[19]!==c.value?(w=async()=>{let t=x.current+=1,n=await r({environmentId:e.environmentId,input:{...c.kind===`saved`&&!e.isNew?{hostId:e.host.id}:{},...c.kind===`new`?{accessToken:c.value}:c.kind===`cleared`?{accessToken:``}:{}}});t===x.current&&f(n._tag===`Success`?{status:`signed-in`,account:n.value}:{status:`failed`,error:en(n.cause)})},t[14]=r,t[15]=e.environmentId,t[16]=e.host.id,t[17]=e.isNew,t[18]=c.kind,t[19]=c.value,t[20]=w):w=t[20];let T=w,E;t[21]===T?E=t[22]:(E=()=>{f({status:`checking`}),T()},t[21]=T,t[22]=E);let O=E,k;t[23]===T?k=t[24]:(k=()=>void T(),t[23]=T,t[24]=k);let A=(0,$.useEffectEvent)(k),j;t[25]===A?j=t[26]:(j=()=>{A()},t[25]=A,t[26]=j);let M;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(M=[],t[27]=M):M=t[27],(0,$.useEffect)(j,M);let N;t[28]!==i||t[29]!==e.busy?(N=(t,n,r)=>(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,Q.jsx)(`span`,{children:n}),(0,Q.jsx)(Ae,{type:`number`,min:1,max:r,value:i[t],disabled:e.busy,onChange:e=>{let n=Number(e.target.value);a(e=>({...e,[t]:n}))}})]}),t[28]=i,t[29]=e.busy,t[30]=N):N=t[30];let P=N,F;t[31]===e?F=t[32]:(F=t=>{!t&&!e.busy&&e.onClose()},t[31]=e,t[32]=F);let I=!e.busy,L;t[33]!==p||t[34]!==e||t[35]!==h?(L=t=>{t.preventDefault(),h&&!e.busy&&e.onSave(p)},t[33]=p,t[34]=e,t[35]=h,t[36]=L):L=t[36];let R=e.isNew?`Add EAS host`:`Edit EAS host`,z;t[37]===R?z=t[38]:(z=(0,Q.jsx)(Me,{children:R}),t[37]=R,t[38]=z);let B;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(Ie,{children:`The environment's server signs in to Expo and starts the sessions. Without a token here it uses EXPO_TOKEN, then its eas login.`}),t[39]=B):B=t[39];let V;t[40]===z?V=t[41]:(V=(0,Q.jsxs)(je,{children:[z,B]}),t[40]=z,t[41]=V);let ee;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(`span`,{children:`Name`}),t[42]=ee):ee=t[42];let H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{let t=e.target.value;a(e=>({...e,label:t}))},t[43]=H):H=t[43];let U;t[44]!==i.label||t[45]!==e.busy?(U=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[ee,(0,Q.jsx)(Ae,{autoFocus:!0,required:!0,value:i.label,disabled:e.busy,onChange:H})]}),t[44]=i.label,t[45]=e.busy,t[46]=U):U=t[46];let te;t[47]===o?te=t[48]:(te=(0,Q.jsx)(`label`,{htmlFor:o,className:`block`,children:`Expo access token`}),t[47]=o,t[48]=te);let ne=c.kind===`saved`,re=c.kind===`new`?c.value:``,ie;t[49]===e.host.accessToken?ie=t[50]:(ie=t=>{let n=t.target.value;l(n?{kind:`new`,value:n}:e.host.accessToken?{kind:`saved`}:{kind:`cleared`}),C()},t[49]=e.host.accessToken,t[50]=ie);let ae;t[51]!==e.busy||t[52]!==ne||t[53]!==re||t[54]!==ie||t[55]!==o?(ae=(0,Q.jsx)(Dt,{id:o,className:`min-w-0 flex-1`,configured:ne,value:re,disabled:e.busy,placeholder:`Optional`,onChange:ie}),t[51]=e.busy,t[52]=ne,t[53]=re,t[54]=ie,t[55]=o,t[56]=ae):ae=t[56];let oe;t[57]===c.kind?oe=t[58]:(oe=c.kind===`cleared`?null:(0,Q.jsx)(y,{type:`button`,size:`icon-sm`,variant:`ghost-destructive`,"aria-label":`Clear access token`,onClick:()=>{l({kind:`cleared`}),C()},children:(0,Q.jsx)(b,{className:`size-3.5`})}),t[57]=c.kind,t[58]=oe);let se;t[59]!==ae||t[60]!==oe?(se=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ae,oe]}),t[59]=ae,t[60]=oe,t[61]=se):se=t[61];let W;t[62]!==te||t[63]!==se?(W=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[te,se]}),t[62]=te,t[63]=se,t[64]=W):W=t[64];let ce=d.status===`signed-in`?`Signed in as ${d.account.signedInAs} with ${$t[d.account.credentialSource]}.`:d.status===`failed`?d.error:d.status===`checking`?`Checking the Expo account…`:`Check the Expo account before choosing a project.`,ue;t[65]===ce?ue=t[66]:(ue=(0,Q.jsx)(`p`,{role:`status`,className:`min-w-0 text-xs text-muted-foreground`,children:ce}),t[65]=ce,t[66]=ue);let de=e.busy||d.status===`checking`,q;t[67]===O?q=t[68]:(q=()=>void O(),t[67]=O,t[68]=q);let he;t[69]===d.status?he=t[70]:(he=d.status===`checking`?(0,Q.jsx)(me,{size:`xs`}):null,t[69]=d.status,t[70]=he);let ge;t[71]!==de||t[72]!==q||t[73]!==he?(ge=(0,Q.jsxs)(y,{type:`button`,size:`sm`,variant:`outline`,disabled:de,onClick:q,children:[he,` Check account`]}),t[71]=de,t[72]=q,t[73]=he,t[74]=ge):ge=t[74];let _e;t[75]!==ue||t[76]!==ge?(_e=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border/60 px-3 py-2.5`,children:[ue,ge]}),t[75]=ue,t[76]=ge,t[77]=_e):_e=t[77];let ve;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Q.jsx)(`span`,{children:`EAS project`}),t[78]=ve):ve=t[78];let ye=i.appId??Qt,be=e.busy,J;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(J=e=>{typeof e==`string`&&a(t=>{let{appId:n,...r}=t;return e===Qt?r:{...r,appId:e}})},t[79]=J):J=t[79];let Y;t[80]===v?Y=t[81]:(Y=(0,Q.jsx)(fe,{size:`sm`,"aria-label":`EAS project`,children:(0,Q.jsx)(le,{children:e=>e===Qt?`From the thread's project`:v.find(t=>t.id===e)?.fullName??e})}),t[80]=v,t[81]=Y);let xe;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Q.jsx)(G,{value:Qt,children:`From the thread's project`}),t[82]=xe):xe=t[82];let Se;t[83]!==v||t[84]!==i.appId?(Se=i.appId&&!v.some(e=>e.id===i.appId)?(0,Q.jsx)(G,{value:i.appId,children:i.appId}):null,t[83]=v,t[84]=i.appId,t[85]=Se):Se=t[85];let Ce;t[86]===v?Ce=t[87]:(Ce=v.map(rn),t[86]=v,t[87]=Ce);let we;t[88]!==Se||t[89]!==Ce?(we=(0,Q.jsxs)(K,{children:[xe,Se,Ce]}),t[88]=Se,t[89]=Ce,t[90]=we):we=t[90];let Ee;t[91]!==e.busy||t[92]!==ye||t[93]!==Y||t[94]!==we?(Ee=(0,Q.jsxs)(pe,{value:ye,disabled:be,onValueChange:J,children:[Y,we]}),t[91]=e.busy,t[92]=ye,t[93]=Y,t[94]=we,t[95]=Ee):Ee=t[95];let De;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Sessions bill the project's Expo account. "From the thread's project" reads extra.eas.projectId from the project's app config.`}),t[96]=De):De=t[96];let Oe;t[97]===Ee?Oe=t[98]:(Oe=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[ve,Ee,De]}),t[97]=Ee,t[98]=Oe);let ke;t[99]===P?ke=t[100]:(ke=(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 text-sm`,children:[P(`maxConcurrentSessions`,`Sessions at once`,20),P(`maxSessionMinutes`,`Session minutes`,115),P(`idleMinutes`,`Idle minutes`,60)]}),t[99]=P,t[100]=ke);let Pe=e.isNew?null:` Saving restarts this host, which stops its running sessions.`,ze;t[101]===Pe?ze=t[102]:(ze=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Expo allows sessions of up to 40 minutes on free accounts and 115 on paid ones, and ends one after the idle minutes without activity, so idle minutes must be smaller than session minutes.`,Pe]}),t[101]=Pe,t[102]=ze);let Ve;t[103]===g?Ve=t[104]:(Ve=g===null?null:(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,role:`alert`,children:g}),t[103]=g,t[104]=Ve);let He;t[105]!==U||t[106]!==W||t[107]!==_e||t[108]!==Oe||t[109]!==ke||t[110]!==ze||t[111]!==Ve?(He=(0,Q.jsxs)(Fe,{children:[U,W,_e,Oe,ke,ze,Ve]}),t[105]=U,t[106]=W,t[107]=_e,t[108]=Oe,t[109]=ke,t[110]=ze,t[111]=Ve,t[112]=He):He=t[112];let Ue;t[113]!==e.busy||t[114]!==e.onClose?(Ue=(0,Q.jsx)(y,{type:`button`,variant:`ghost`,disabled:e.busy,onClick:e.onClose,children:`Cancel`}),t[113]=e.busy,t[114]=e.onClose,t[115]=Ue):Ue=t[115];let We=e.busy||!h,Ge;t[116]===e.busy?Ge=t[117]:(Ge=e.busy?(0,Q.jsx)(me,{size:`xs`}):null,t[116]=e.busy,t[117]=Ge);let Ke;t[118]!==We||t[119]!==Ge?(Ke=(0,Q.jsxs)(y,{type:`submit`,disabled:We,children:[Ge,` Save host`]}),t[118]=We,t[119]=Ge,t[120]=Ke):Ke=t[120];let qe;t[121]!==Ue||t[122]!==Ke?(qe=(0,Q.jsxs)(Ne,{children:[Ue,Ke]}),t[121]=Ue,t[122]=Ke,t[123]=qe):qe=t[123];let Je;t[124]!==L||t[125]!==V||t[126]!==He||t[127]!==qe?(Je=(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-col`,onSubmit:L,children:[V,He,qe]}),t[124]=L,t[125]=V,t[126]=He,t[127]=qe,t[128]=Je):Je=t[128];let Ye;t[129]!==I||t[130]!==Je?(Ye=(0,Q.jsx)(Le,{showCloseButton:I,children:Je}),t[129]=I,t[130]=Je,t[131]=Ye):Ye=t[131];let Xe;return t[132]!==F||t[133]!==Ye?(Xe=(0,Q.jsx)(Re,{open:!0,onOpenChange:F,children:Ye}),t[132]=F,t[133]=Ye,t[134]=Xe):Xe=t[134],Xe}function rn(e){return(0,Q.jsx)(G,{value:e.id,children:e.fullName},e.id)}function an(e,t){if(e)return{kind:`new`};let n=t[0];return n?{kind:`existing`,profileId:n.id}:{kind:`new`}}function on(e,t,n){if(e.kind===`new`)return{kind:`new`,profileId:t};let r=n.find(t=>t.id===e.profileId);if(r!==void 0)return{kind:`existing`,profileId:e.profileId,name:r.name}}function sn(e){return e.step!==`importing`}function cn(e){return e.unavailable===`browserRunning`?{step:`quit`}:e.unavailable===`needsFullDiskAccess`?{step:`fullDiskAccess`,resume:`configure`}:e.unavailable===void 0?e.profiles.length===0?{step:`blocked`,reason:`unknownSourceProfile`}:{step:`configure`}:{step:`blocked`,reason:e.unavailable}}function ln(e){return e.kind===`imported`?{step:`done`,imported:e.imported,skipped:e.skipped,skippedDomains:e.skippedDomains,targetName:e.targetName}:e.reason===`browserRunning`?{step:`quit`}:e.reason===`needsFullDiskAccess`?{step:`fullDiskAccess`,resume:`import`,checked:!0}:{step:`blocked`,reason:e.reason}}function un(e){return e===void 0?{step:`blocked`,reason:`unknownSource`}:cn(e)}function dn(e){let t=un(e);return t.step===`fullDiskAccess`?{...t,checked:!0}:t}function fn(e,t){return t.profiles.some(t=>t.directory===e)?e:t.profiles[0]?.directory??``}function pn(e){switch(e){case`needsKeychainApproval`:case`keychainItemMissing`:case`keychainUnavailable`:case`readFailed`:case`sessionUnavailable`:case`profileNotSaved`:return!0;default:return!1}}function mn(e){return e.length===0?``:e.length===1?e[0]:e.length<=3?`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`:`${e.slice(0,3).join(`, `)} and ${e.length-3} more`}function hn(e){let t=(0,Z.c)(46),{source:n,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,onImport:o,onRefreshSource:s,onOpenFullDiskAccessSettings:c,onCheckFullDiskAccess:l,onClose:u}=e,[d,f]=(0,$.useState)(n),p;t[0]===n?p=t[1]:(p=()=>cn(n),t[0]=n,t[1]=p);let[m,h]=(0,$.useState)(p),g;t[2]===n.profiles[0]?.directory?g=t[3]:(g=()=>n.profiles[0]?.directory??``,t[2]=n.profiles[0]?.directory,t[3]=g);let[_,y]=(0,$.useState)(g),b;t[4]!==a||t[5]!==i?(b=()=>an(a,i),t[4]=a,t[5]=i,t[6]=b):b=t[6];let[x,S]=(0,$.useState)(b),[C,w]=(0,$.useState)(),T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=v(),t[7]=T):T=t[7];let E=(0,$.useRef)(`profile-${T}`),D=(0,$.useRef)(!1),O;t[8]!==o||t[9]!==_||t[10]!==x||t[11]!==i?(O=()=>{if(D.current)return;let e=on(x,E.current,i);e===void 0?(w(`That profile is no longer available. Choose where to import these cookies.`),h({step:`configure`})):(w(void 0),D.current=!0,h({step:`importing`}),o({sourceProfileDirectory:_,target:e}).then(e=>h(ln(e))).catch(()=>h({step:`blocked`,reason:`readFailed`})).finally(()=>{D.current=!1}))},t[8]=o,t[9]=_,t[10]=x,t[11]=i,t[12]=O):O=t[12];let k=O,A;t[13]===s?A=t[14]:(A=(e,t)=>{h({step:`checking`,check:e}),s().then(e=>{e&&(f(e),y(t=>fn(t,e))),h(t(e))}).catch(()=>h({step:`blocked`,reason:`readFailed`}))},t[13]=s,t[14]=A);let j=A,M;t[15]===j?M=t[16]:(M=()=>j(`browser`,un),t[15]=j,t[16]=M);let N=M,P;t[17]===j?P=t[18]:(P=()=>j(`fullDiskAccess`,dn),t[17]=j,t[18]=P);let F=P,I;t[19]!==u||t[20]!==m?(I=e=>e||!sn(m)?void 0:u(),t[19]=u,t[20]=m,t[21]=I):I=t[21];let L;t[22]===m?L=t[23]:(L=sn(m),t[22]=m,t[23]=L);let R;t[24]!==a||t[25]!==r||t[26]!==l||t[27]!==u||t[28]!==c||t[29]!==s||t[30]!==N||t[31]!==F||t[32]!==k||t[33]!==d||t[34]!==_||t[35]!==m||t[36]!==x||t[37]!==C||t[38]!==i?(R=m.step===`quit`?(0,Q.jsx)(gn,{source:d,onCancel:u,onRechecked:N}):m.step===`fullDiskAccess`?(0,Q.jsx)(yn,{source:d,onCancel:u,onOpenSettings:c,onCheck:l??(async()=>{let e=await s();return e!==void 0&&e.unavailable===void 0}),onGranted:m.resume===`import`?k:F,stillRequired:m.checked===!0}):m.step===`importing`?(0,Q.jsx)(Sn,{}):m.step===`checking`?(0,Q.jsx)(Cn,{sourceName:d.name,check:m.check}):m.step===`done`?(0,Q.jsx)(wn,{...m,destinationEnvironmentName:r,onClose:u}):m.step===`blocked`?(0,Q.jsx)(Tn,{source:d,reason:m.reason,onClose:u,onRetry:pn(m.reason)?k:void 0}):(0,Q.jsx)(bn,{source:d,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:_,onSourceProfileChange:y,target:x,onTargetChange:e=>{S(e),w(void 0)},targetError:C,onCancel:u,onImport:k}),t[24]=a,t[25]=r,t[26]=l,t[27]=u,t[28]=c,t[29]=s,t[30]=N,t[31]=F,t[32]=k,t[33]=d,t[34]=_,t[35]=m,t[36]=x,t[37]=C,t[38]=i,t[39]=R):R=t[39];let z;t[40]!==L||t[41]!==R?(z=(0,Q.jsx)(Le,{className:`max-w-lg`,showCloseButton:L,children:R}),t[40]=L,t[41]=R,t[42]=z):z=t[42];let B;return t[43]!==z||t[44]!==I?(B=(0,Q.jsx)(Re,{open:!0,onOpenChange:I,children:z}),t[43]=z,t[44]=I,t[45]=B):B=t[45],B}function gn(e){let t=(0,Z.c)(12),{source:n,onCancel:r,onRechecked:i}=e,a;t[0]===n.name?a=t[1]:(a=(0,Q.jsxs)(je,{children:[(0,Q.jsxs)(Me,{children:[`Quit `,n.name,` to import`]}),(0,Q.jsxs)(Ie,{children:[n.name,` is open, so its cookies can’t be read yet. Quit it, then continue.`]})]}),t[0]=n.name,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(y,{variant:`outline`,onClick:r,children:`Cancel`}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(y,{onClick:i,children:`I’ve quit it`}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(Ne,{children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function _n(e){if(e!==void 0)return e===0?`no cookies`:`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function vn(e){return`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function yn(e){let t=(0,Z.c)(43),{source:n,onCancel:r,onOpenSettings:i,onGranted:o,stillRequired:s,onCheck:c}=e,[l,u]=(0,$.useState)(!1),[d,f]=(0,$.useState)(null),p;t[0]===c?p=t[1]:(p=async()=>({fullDiskAccess:await c()}),t[0]=c,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m={fullDiskAccess:!1},t[2]=m):m=t[2];let h=At(p,m),g;t[3]!==i||t[4]!==l?(g=()=>{l||(u(!0),f(null),Promise.resolve().then(i).catch(()=>f(`Could not open System Settings. Try Allow again.`)).finally(()=>u(!1)))},t[3]=i,t[4]=l,t[5]=g):g=t[5];let _=g,v;t[6]===n.name?v=t[7]:(v=(0,Q.jsxs)(je,{children:[(0,Q.jsxs)(Me,{children:[`Let P4 Code read `,n.name,`’s cookies`]}),(0,Q.jsxs)(Ie,{children:[`To import cookies from `,n.name,`, P4 Code needs Full Disk Access. Turn it on in System Settings, then come back to finish the import — you can revoke it again once the import is done.`]})]}),t[6]=n.name,t[7]=v);let b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(a,{className:`size-8 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[8]=b):b=t[8];let x=`Read ${n.name}'s cookies for this import.`,S;t[9]===_?S=t[10]:(S=()=>void _(),t[9]=_,t[10]=S);let C;t[11]!==h.status.fullDiskAccess||t[12]!==x||t[13]!==S?(C=[{id:`fullDiskAccess`,icon:b,title:`Full Disk Access`,description:x,granted:h.status.fullDiskAccess,onAllow:S}],t[11]=h.status.fullDiskAccess,t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]!==l||t[16]!==C?(w=(0,Q.jsx)(Ot,{busy:l,permissions:C}),t[15]=l,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==d||t[19]!==h.error?(T=d||h.error?(0,Q.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:d??h.error}):null,t[18]=d,t[19]=h.error,t[20]=T):T=t[20];let E;t[21]!==h||t[22]!==s?(E=h.isReady([`fullDiskAccess`])?null:(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:s?`Access is still required. Quit and reopen P4 Code if you just allowed it, then retry the import.`:`If access doesn't update after you allow it, quit and reopen P4 Code, then retry the import.`}),t[21]=h,t[22]=s,t[23]=E):E=t[23];let D;t[24]!==T||t[25]!==E||t[26]!==w?(D=(0,Q.jsxs)(Fe,{children:[w,T,E]}),t[24]=T,t[25]=E,t[26]=w,t[27]=D):D=t[27];let O;t[28]===r?O=t[29]:(O=(0,Q.jsx)(y,{variant:`outline`,onClick:r,children:`Cancel`}),t[28]=r,t[29]=O);let k;t[30]===h?k=t[31]:(k=h.isReady([`fullDiskAccess`]),t[30]=h,t[31]=k);let A;t[32]!==o||t[33]!==l||t[34]!==k?(A=(0,Q.jsx)(kt,{ready:k,busy:l,onClick:o,children:`Continue`}),t[32]=o,t[33]=l,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==O||t[37]!==A?(j=(0,Q.jsxs)(Ne,{children:[O,A]}),t[36]=O,t[37]=A,t[38]=j):j=t[38];let M;return t[39]!==D||t[40]!==j||t[41]!==v?(M=(0,Q.jsxs)(Q.Fragment,{children:[v,D,j]}),t[39]=D,t[40]=j,t[41]=v,t[42]=M):M=t[42],M}function bn(e){let t=(0,Z.c)(59),{source:n,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:o,onSourceProfileChange:s,target:c,targetError:l,onTargetChange:u,onCancel:d,onImport:f}=e,p;t[0]!==c.kind||t[1]!==c.profileId||t[2]!==i?(p=c.kind===`existing`&&!i.some(e=>e.id===c.profileId),t[0]=c.kind,t[1]=c.profileId,t[2]=i,t[3]=p):p=t[3];let m=p,h=c.kind===`new`&&!a,_=l??(m?`That profile is no longer available. Choose where to import these cookies.`:h?`You've reached the profile limit. Choose an existing profile to import into.`:void 0),v;t[4]===n.name?v=t[5]:(v=(0,Q.jsxs)(Me,{children:[`Import from `,n.name]}),t[4]=n.name,t[5]=v);let b;t[6]===r?b=t[7]:(b=(0,Q.jsxs)(Ie,{children:[`Choose which cookies to import for `,r,`.`]}),t[6]=r,t[7]=b);let x;t[8]!==v||t[9]!==b?(x=(0,Q.jsxs)(je,{children:[v,b]}),t[8]=v,t[9]=b,t[10]=x):x=t[10];let C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`From`}),t[11]=C):C=t[11];let w;if(t[12]!==s||t[13]!==n.profiles||t[14]!==o){let e;t[16]!==s||t[17]!==o?(e=e=>(0,Q.jsx)(xn,{selected:o===e.directory,title:e.name,subtitle:_n(e.cookieCount),onSelect:()=>s(e.directory)},e.directory),t[16]=s,t[17]=o,t[18]=e):e=t[18],w=n.profiles.map(e),t[12]=s,t[13]=n.profiles,t[14]=o,t[15]=w}else w=t[15];let T;t[19]===w?T=t[20]:(T=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[C,w]}),t[19]=w,t[20]=T);let E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center text-muted-foreground`,children:[(0,Q.jsx)(g,{className:`size-4 sm:hidden`}),(0,Q.jsx)(S,{className:`hidden size-4 sm:block`})]}),t[21]=E):E=t[21];let D;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Into`}),t[22]=D):D=t[22];let O;t[23]!==a||t[24]!==u||t[25]!==c.kind?(O=a?(0,Q.jsx)(xn,{selected:c.kind===`new`,title:`New profile`,subtitle:`Created for these cookies`,onSelect:()=>u({kind:`new`})}):null,t[23]=a,t[24]=u,t[25]=c.kind,t[26]=O):O=t[26];let k;if(t[27]!==u||t[28]!==c.kind||t[29]!==c.profileId||t[30]!==i){let e;t[32]!==u||t[33]!==c.kind||t[34]!==c.profileId?(e=e=>(0,Q.jsx)(xn,{selected:c.kind===`existing`&&c.profileId===e.id,title:e.name,subtitle:`Existing profile`,onSelect:()=>u({kind:`existing`,profileId:e.id})},e.id),t[32]=u,t[33]=c.kind,t[34]=c.profileId,t[35]=e):e=t[35],k=i.map(e),t[27]=u,t[28]=c.kind,t[29]=c.profileId,t[30]=i,t[31]=k}else k=t[31];let A;t[36]!==O||t[37]!==k?(A=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[D,O,k]}),t[36]=O,t[37]=k,t[38]=A):A=t[38];let j;t[39]!==A||t[40]!==T?(j=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4`,children:[T,E,A]}),t[39]=A,t[40]=T,t[41]=j):j=t[41];let M;t[42]===_?M=t[43]:(M=_?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-destructive`,children:_}):null,t[42]=_,t[43]=M);let N;t[44]!==j||t[45]!==M?(N=(0,Q.jsxs)(Fe,{children:[j,M]}),t[44]=j,t[45]=M,t[46]=N):N=t[46];let P;t[47]===d?P=t[48]:(P=(0,Q.jsx)(y,{variant:`outline`,onClick:d,children:`Cancel`}),t[47]=d,t[48]=P);let F=o===``||m||h,I;t[49]!==f||t[50]!==F?(I=(0,Q.jsx)(y,{disabled:F,onClick:f,children:`Import`}),t[49]=f,t[50]=F,t[51]=I):I=t[51];let L;t[52]!==P||t[53]!==I?(L=(0,Q.jsxs)(Ne,{children:[P,I]}),t[52]=P,t[53]=I,t[54]=L):L=t[54];let R;return t[55]!==N||t[56]!==L||t[57]!==x?(R=(0,Q.jsxs)(Q.Fragment,{children:[x,N,L]}),t[55]=N,t[56]=L,t[57]=x,t[58]=R):R=t[58],R}function xn(e){let t=(0,Z.c)(22),{selected:n,title:r,subtitle:i,onSelect:a}=e,o=n?`border-primary bg-primary/8`:`border-border/60 hover:border-border hover:bg-muted/40`,s;t[0]===o?s=t[1]:(s=w(`flex w-full cursor-pointer items-center justify-between gap-3 rounded-lg border px-3 py-2 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,o),t[0]=o,t[1]=s);let l;t[2]===r?l=t[3]:(l=(0,Q.jsx)(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:r}),t[2]=r,t[3]=l);let u;t[4]===i?u=t[5]:(u=i?(0,Q.jsx)(`span`,{className:`block truncate text-xs tabular-nums text-muted-foreground`,children:i}):null,t[4]=i,t[5]=u);let d;t[6]!==l||t[7]!==u?(d=(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[l,u]}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f=n?`border-primary bg-primary text-primary-foreground`:`border-input`,p;t[9]===f?p=t[10]:(p=w(`grid size-4 shrink-0 place-items-center rounded-full border`,f),t[9]=f,t[10]=p);let m;t[11]===n?m=t[12]:(m=n?(0,Q.jsx)(c,{className:`size-2.5`}):null,t[11]=n,t[12]=m);let h;t[13]!==p||t[14]!==m?(h=(0,Q.jsx)(`span`,{className:p,children:m}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==a||t[17]!==n||t[18]!==s||t[19]!==d||t[20]!==h?(g=(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:a,className:s,children:[d,h]}),t[16]=a,t[17]=n,t[18]=s,t[19]=d,t[20]=h,t[21]=g):g=t[21],g}function Sn(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(je,{children:[(0,Q.jsx)(Me,{children:`Importing cookies`}),(0,Q.jsx)(Ie,{children:`This may take a moment.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[t,(0,Q.jsx)(Fe,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,Q.jsx)(me,{size:`md`,tone:`muted`}),(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Importing…`})]})})]}),e[1]=n):n=e[1],n}function Cn(e){let t=(0,Z.c)(13),{sourceName:n,check:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsxs)(Me,{children:[`Checking `,n]}),t[0]=n,t[1]=i);let a=r===`fullDiskAccess`?`Checking Full Disk Access.`:`Checking whether the browser has closed.`,o;t[2]===a?o=t[3]:(o=(0,Q.jsx)(Ie,{children:a}),t[2]=a,t[3]=o);let s;t[4]!==i||t[5]!==o?(s=(0,Q.jsxs)(je,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6];let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(me,{size:`md`,tone:`muted`}),t[7]=c):c=t[7];let l=r===`fullDiskAccess`?`Checking access…`:`Checking…`,u;t[8]===l?u=t[9]:(u=(0,Q.jsx)(Fe,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[c,(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:l})]})}),t[8]=l,t[9]=u);let d;return t[10]!==s||t[11]!==u?(d=(0,Q.jsxs)(Q.Fragment,{children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function wn(e){let t=(0,Z.c)(24),{imported:n,skipped:r,skippedDomains:i,targetName:a,destinationEnvironmentName:o,onClose:s}=e,c;t[0]!==n||t[1]!==r?(c=n>0?`Imported ${vn(n)}`:r>0?`Skipped ${vn(r)}`:`No cookies found`,t[0]=n,t[1]=r,t[2]=c):c=t[2];let l;t[3]===c?l=t[4]:(l=(0,Q.jsx)(Me,{children:c}),t[3]=c,t[4]=l);let u;t[5]!==o||t[6]!==n||t[7]!==r||t[8]!==a?(u=n>0?`Added to ${a} for ${o}.${r>0?` ${vn(r)} skipped.`:``}`:r>0?`No cookies were imported for ${o}.`:`There were no cookies to import for ${o}.`,t[5]=o,t[6]=n,t[7]=r,t[8]=a,t[9]=u):u=t[9];let d;t[10]===u?d=t[11]:(d=(0,Q.jsx)(Ie,{children:u}),t[10]=u,t[11]=d);let f;t[12]!==l||t[13]!==d?(f=(0,Q.jsxs)(je,{children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=i.length>0?(0,Q.jsxs)(Fe,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Skipped`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-foreground`,children:mn(i)})]}):null,t[15]=i,t[16]=p);let m;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(y,{}),t[17]=m):m=t[17];let h;t[18]===s?h=t[19]:(h=(0,Q.jsx)(Ne,{children:(0,Q.jsx)(Pe,{render:m,onClick:s,children:`Done`})}),t[18]=s,t[19]=h);let g;return t[20]!==f||t[21]!==p||t[22]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[f,p,h]}),t[20]=f,t[21]=p,t[22]=h,t[23]=g):g=t[23],g}function Tn(e){let t=(0,Z.c)(17),{source:n,reason:r,onClose:i,onRetry:a}=e,o;t[0]===n.name?o=t[1]:(o=(0,Q.jsxs)(Me,{children:[`Couldn’t import from `,n.name]}),t[0]=n.name,t[1]=o);let s=te[r],c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(Ie,{children:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c?(l=(0,Q.jsxs)(je,{children:[o,c]}),t[4]=o,t[5]=c,t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=(0,Q.jsx)(y,{variant:`outline`,onClick:i,children:`Close`}),t[7]=i,t[8]=u);let d;t[9]===a?d=t[10]:(d=a?(0,Q.jsx)(y,{onClick:a,children:`Try again`}):null,t[9]=a,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,Q.jsxs)(Ne,{children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==l||t[15]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[l,f]}),t[14]=l,t[15]=f,t[16]=p):p=t[16],p}var En=`fill`,Dn=`responsive`;async function On(e,t,n,r){let i=e===null?[]:t,a=r?.environmentIds??[];if(i.length===0&&a.length===0)throw Error(`Browser profile data is not available to clear.`);await Promise.all([...i.flatMap(t=>[e.clearCookies(t,n),e.clearCache(t,n)]),...a.map(e=>r.clear(e,n))])}function kn(e,t,n,r=0){return(e||r>0)&&t&&n>0}var An={width:1280,height:800},jn={useGrouping:!1},Mn={system:`System`,light:`Light`,dark:`Dark`},Nn=e=>`${Math.round(e*100)}%`,Pn=class extends Error{constructor(){super(`Browser profile limit reached.`),this.name=`ProfileLimitReachedError`}},Fn=e=>{let t=String(e?.message??``);return ie.literals.find(e=>t.includes(`failed: ${e}.`))??`readFailed`},In=e=>e._tag===`fill`?En:e._tag===`preset`&&vt.some(t=>t.id===e.presetId)?e.presetId:Dn,Ln=e=>{let t=In(e);return t===En?`Fill panel`:t===Dn?`Responsive`:vt.find(e=>e.id===t)?.label??`Responsive`},Rn=e=>Number.isInteger(e)&&e>=240&&e<=3840,zn=e=>({...e,width:e.height,height:e.width});function Bn(e){let t=(0,Z.c)(42),{disabled:n}=e,r=J(Hn),i=Y(),a=r._tag===`fill`?null:r,o=a?.width??An.width,s=a?.height??An.height,c;t[0]!==o||t[1]!==s?(c={width:o,height:s},t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]!==a?.height||t[4]!==a?.width||t[5]!==i?(u=e=>{if(e===En){i({browserDefaultViewport:P});return}if(e===Dn){i({browserDefaultViewport:{_tag:`freeform`,width:a?.width??An.width,height:a?.height??An.height}});return}let t=vt.find(t=>t.id===e);t&&i({browserDefaultViewport:{_tag:`preset`,width:t.width,height:t.height,presetId:t.id}})},t[3]=a?.height,t[4]=a?.width,t[5]=i,t[6]=u):u=t[6];let d=u,f;t[7]!==l||t[8]!==a||t[9]!==i?(f=(e,t)=>{if(t===null||!Rn(t))return;let n={...l,[e]:t};n.width*n.height>8294400||a&&n.width===a.width&&n.height===a.height||i({browserDefaultViewport:{_tag:`freeform`,...n}})},t[7]=l,t[8]=a,t[9]=i,t[10]=f):f=t[10];let p=f,m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=yt(`browser-default-viewport`),t[11]=m):m=t[11];let h;t[12]!==n||t[13]!==i||t[14]!==r._tag?(h=!n&&r._tag!==N._tag?(0,Q.jsx)(ht,{label:`default browser viewport`,onClick:()=>i({browserDefaultViewport:N})}):null,t[12]=n,t[13]=i,t[14]=r._tag,t[15]=h):h=t[15];let g;t[16]===r?g=t[17]:(g=In(r),t[16]=r,t[17]=g);let _;t[18]===r?_=t[19]:(_=Ln(r),t[18]=r,t[19]=_);let v;t[20]===_?v=t[21]:(v=(0,Q.jsx)(fe,{size:`sm`,className:`w-full min-w-0 sm:w-44`,"aria-label":`Default browser viewport`,children:(0,Q.jsx)(le,{children:_})}),t[20]=_,t[21]=v);let b,x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(G,{value:En,children:`Fill panel`}),x=(0,Q.jsx)(G,{value:Dn,children:`Responsive`}),t[22]=b,t[23]=x):(b=t[22],x=t[23]);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(K,{align:`end`,alignItemWithTrigger:!1,children:[b,x,(0,Q.jsxs)(de,{children:[(0,Q.jsx)(ue,{children:`Standard`}),vt.map(Vn)]})]}),t[24]=S):S=t[24];let C;t[25]!==n||t[26]!==d||t[27]!==v||t[28]!==g?(C=(0,Q.jsxs)(pe,{value:g,onValueChange:d,disabled:n,children:[v,S]}),t[25]=n,t[26]=d,t[27]=v,t[28]=g,t[29]=C):C=t[29];let w;t[30]!==p||t[31]!==n||t[32]!==l||t[33]!==a||t[34]!==i?(w=a?(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(ce,{value:l.width,min:240,max:O,disabled:n,format:jn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`width`,e),children:(0,Q.jsx)(W,{children:(0,Q.jsx)(se,{"aria-label":`Default viewport width`})})}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`×`}),(0,Q.jsx)(ce,{value:l.height,min:240,max:O,disabled:n,format:jn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`height`,e),children:(0,Q.jsx)(W,{children:(0,Q.jsx)(se,{"aria-label":`Default viewport height`})})}),(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(y,{size:`icon-sm`,variant:`ghost-muted`,disabled:n,"aria-label":`Rotate to ${l.height>=l.width?`landscape`:`portrait`}`,onClick:()=>i({browserDefaultViewport:zn(a)}),children:(0,Q.jsx)(xt,{})})}),(0,Q.jsx)(Oe,{side:`top`,children:`Rotate`})]})]}):null,t[30]=p,t[31]=n,t[32]=l,t[33]=a,t[34]=i,t[35]=w):w=t[35];let T;t[36]!==C||t[37]!==w?(T=(0,Q.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-end gap-2 sm:w-auto`,children:[C,w]}),t[36]=C,t[37]=w,t[38]=T):T=t[38];let E;return t[39]!==T||t[40]!==h?(E=(0,Q.jsx)(X,{...m,description:`Tab size for you and agents. Fill fits the panel; other sizes show the device toolbar.`,resetAction:h,control:T}),t[39]=T,t[40]=h,t[41]=E):E=t[41],E}function Vn(e){return(0,Q.jsx)(G,{value:e.id,children:(0,Q.jsxs)(`span`,{className:`flex w-full items-center justify-between gap-5`,children:[(0,Q.jsx)(`span`,{children:e.label}),(0,Q.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:e.detail})]})},e.id)}function Hn(e){return e.browserDefaultViewport}function Un(e){let t=(0,Z.c)(20),{disabled:n}=e,r=J(Gn),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-default-zoom`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==i||t[3]!==r?(o=!n&&r!==1?(0,Q.jsx)(ht,{label:`default browser zoom`,onClick:()=>i({browserDefaultZoomFactor:1})}):null,t[1]=n,t[2]=i,t[3]=r,t[4]=o):o=t[4];let s=String(r),c;t[5]===i?c=t[6]:(c=e=>{let t=L.find(t=>String(t)===e);t!==void 0&&i({browserDefaultZoomFactor:t})},t[5]=i,t[6]=c);let l;t[7]===r?l=t[8]:(l=Nn(r),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser zoom`,children:(0,Q.jsx)(le,{children:l})}),t[9]=l,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:L.map(Wn)}),t[11]=d):d=t[11];let f;t[12]!==n||t[13]!==s||t[14]!==c||t[15]!==u?(f=(0,Q.jsxs)(pe,{disabled:n,value:s,onValueChange:c,children:[u,d]}),t[12]=n,t[13]=s,t[14]=c,t[15]=u,t[16]=f):f=t[16];let p;return t[17]!==o||t[18]!==f?(p=(0,Q.jsx)(X,{...a,description:`Page zoom applied to new browser tabs.`,resetAction:o,control:f}),t[17]=o,t[18]=f,t[19]=p):p=t[19],p}function Wn(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:String(e),children:Nn(e)},e)}function Gn(e){return e.browserDefaultZoomFactor}function Kn(e){let t=(0,Z.c)(18),{disabled:n}=e,r=J(Jn),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-default-appearance`),t[0]=a):a=t[0];let o;t[1]!==r||t[2]!==n||t[3]!==i?(o=!n&&r!==`system`?(0,Q.jsx)(ht,{label:`default browser appearance`,onClick:()=>i({browserDefaultAppearance:j})}):null,t[1]=r,t[2]=n,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>{(e===`system`||e===`light`||e===`dark`)&&i({browserDefaultAppearance:e})},t[5]=i,t[6]=s);let c=Mn[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser appearance`,children:(0,Q.jsx)(le,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:Object.entries(Mn).map(qn)}),t[9]=u):u=t[9];let d;t[10]!==r||t[11]!==n||t[12]!==s||t[13]!==l?(d=(0,Q.jsxs)(pe,{disabled:n,value:r,onValueChange:s,children:[l,u]}),t[10]=r,t[11]=n,t[12]=s,t[13]=l,t[14]=d):d=t[14];let f;return t[15]!==o||t[16]!==d?(f=(0,Q.jsx)(X,{...a,description:`The color scheme pages are told to prefer. System follows your OS setting.`,resetAction:o,control:d}),t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function qn(e){let[t,n]=e;return(0,Q.jsx)(G,{hideIndicator:!0,value:t,children:n},t)}function Jn(e){return e.browserDefaultAppearance}function Yn(e){let t=(0,Z.c)(17),{disabled:n}=e,r=J(Zn),i=J(Xn),a=Y(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=yt(`browser-recording-key-presses`),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=e=>a({browserRecordingShowKeyPresses:!!e}),t[1]=a,t[2]=s);let c;t[3]!==n||t[4]!==r||t[5]!==s?(c=(0,Q.jsx)(X,{...o,description:`Show pressed keys and shortcuts in new recordings. Password fields are excluded.`,control:(0,Q.jsx)(bt,{disabled:n,checked:r,"aria-label":`Show key presses in recordings`,onCheckedChange:s})}),t[3]=n,t[4]=r,t[5]=s,t[6]=c):c=t[6];let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=yt(`browser-recording-mouse-presses`),t[7]=l):l=t[7];let u;t[8]===a?u=t[9]:(u=e=>a({browserRecordingShowMousePresses:!!e}),t[8]=a,t[9]=u);let d;t[10]!==n||t[11]!==i||t[12]!==u?(d=(0,Q.jsx)(X,{...l,description:`Highlight mouse presses and held buttons in new recordings.`,control:(0,Q.jsx)(bt,{disabled:n,checked:i,"aria-label":`Show mouse presses in recordings`,onCheckedChange:u})}),t[10]=n,t[11]=i,t[12]=u,t[13]=d):d=t[13];let f;return t[14]!==c||t[15]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[c,d]}),t[14]=c,t[15]=d,t[16]=f):f=t[16],f}function Xn(e){return e.browserRecordingShowMousePresses}function Zn(e){return e.browserRecordingShowKeyPresses}function Qn(e){let t=(0,Z.c)(18),{disabled:n}=e,r=J(er),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-recording-frame-rate`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==r||t[3]!==i?(o=!n&&r!==30?(0,Q.jsx)(ht,{label:`browser recording frame rate`,onClick:()=>i({browserRecordingFrameRate:30})}):null,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s=String(r),c;t[5]===i?c=t[6]:(c=e=>{let t=F.find(t=>String(t)===e);t!==void 0&&i({browserRecordingFrameRate:t})},t[5]=i,t[6]=c);let l;t[7]===r?l=t[8]:(l=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Browser recording frame rate`,children:(0,Q.jsxs)(le,{children:[r,` fps`]})}),t[7]=r,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:F.map($n)}),t[9]=u):u=t[9];let d;t[10]!==n||t[11]!==s||t[12]!==c||t[13]!==l?(d=(0,Q.jsxs)(pe,{disabled:n,value:s,onValueChange:c,children:[l,u]}),t[10]=n,t[11]=s,t[12]=c,t[13]=l,t[14]=d):d=t[14];let f;return t[15]!==o||t[16]!==d?(f=(0,Q.jsx)(X,{...a,description:`Maximum recording rate. 30 fps saves CPU and storage; 60 fps is smoother.`,resetAction:o,control:d}),t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function $n(e){return(0,Q.jsxs)(G,{hideIndicator:!0,value:String(e),children:[e,` fps`]},e)}function er(e){return e.browserRecordingFrameRate}var tr={system:`Your default browser`,app:`P4 Code`};function nr(e){let t=(0,Z.c)(19),{disabled:n}=e,r=J(ir),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-link-target`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==r||t[3]!==i?(o=!n&&r!==`system`?(0,Q.jsx)(ht,{label:`link target`,onClick:()=>i({browserLinkTarget:ee})}):null,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>{(e===`system`||e===`app`)&&i({browserLinkTarget:e})},t[5]=i,t[6]=s);let c=tr[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Open links in`,children:(0,Q.jsx)(le,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.keys(tr),t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:u.map(rr)}),t[10]=d):d=t[10];let f;t[11]!==n||t[12]!==r||t[13]!==s||t[14]!==l?(f=(0,Q.jsxs)(pe,{disabled:n,value:r,onValueChange:s,children:[l,d]}),t[11]=n,t[12]=r,t[13]=s,t[14]=l,t[15]=f):f=t[15];let p;return t[16]!==o||t[17]!==f?(p=(0,Q.jsx)(X,{...a,description:`Where links in the chat and terminal open. Hold ⌘ or Ctrl while clicking a link to open it in your default browser either way.`,resetAction:o,control:f}),t[16]=o,t[17]=f,t[18]=p):p=t[18],p}function rr(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:e,children:tr[e]},e)}function ir(e){return e.browserLinkTarget}var ar={duckduckgo:`DuckDuckGo`,google:`Google`,bing:`Bing`,brave:`Brave Search`,kagi:`Kagi`,ecosia:`Ecosia`,custom:`Custom`};function or(){let e=(0,Z.c)(24),t=J(lr),n=J(cr),r=Y(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=yt(`browser-search-engine`),e[0]=i):i=e[0];let a;e[1]!==n||e[2]!==t||e[3]!==r?(a=t!==`duckduckgo`||n!==``?(0,Q.jsx)(ht,{label:`search engine`,onClick:()=>r({browserSearchEngine:M,browserCustomSearchUrl:``})}):null,e[1]=n,e[2]=t,e[3]=r,e[4]=a):a=e[4];let o;e[5]===r?o=e[6]:(o=e=>{let t=ne.literals.find(t=>t===e);t!==void 0&&r({browserSearchEngine:t})},e[5]=r,e[6]=o);let s=ar[t],c;e[7]===s?c=e[8]:(c=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Search engine`,children:(0,Q.jsx)(le,{children:s})}),e[7]=s,e[8]=c);let l;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:ne.literals.map(sr)}),e[9]=l):l=e[9];let u;e[10]!==t||e[11]!==o||e[12]!==c?(u=(0,Q.jsxs)(pe,{value:t,onValueChange:o,children:[c,l]}),e[10]=t,e[11]=o,e[12]=c,e[13]=u):u=e[13];let d;e[14]!==a||e[15]!==u?(d=(0,Q.jsx)(X,{...i,description:`What the address bar searches when you type something that isn't a URL.`,resetAction:a,control:u}),e[14]=a,e[15]=u,e[16]=d):d=e[16];let f;e[17]!==n||e[18]!==t||e[19]!==r?(f=t===`custom`?(0,Q.jsx)(X,{title:`Custom search URL`,description:`Use %s where the search terms go.`,status:nt(n)?void 0:`Enter an http or https URL containing %s. Searches use DuckDuckGo until then.`,control:(0,Q.jsx)(Tt,{nativeInput:!0,size:`sm`,className:`w-full sm:w-64`,"aria-label":`Custom search URL`,placeholder:`https://example.com/search?q=%s`,autoCapitalize:`none`,spellCheck:!1,maxLength:re,value:n,onCommit:e=>r({browserCustomSearchUrl:e.trim()})})}):null,e[17]=n,e[18]=t,e[19]=r,e[20]=f):f=e[20];let p;return e[21]!==d||e[22]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[d,f]}),e[21]=d,e[22]=f,e[23]=p):p=e[23],p}function sr(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:e,children:ar[e]},e)}function cr(e){return e.browserCustomSearchUrl}function lr(e){return e.browserSearchEngine}function ur(){let e=(0,Z.c)(12),t=J(dr),n=Y(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=yt(`pull-request-links-open-in-app`),e[0]=r):r=e[0];let i;e[1]!==t||e[2]!==n?(i=t?null:(0,Q.jsx)(ht,{label:`open pull requests in P4 Code`,onClick:()=>n({pullRequestLinksOpenInApp:!0})}),e[1]=t,e[2]=n,e[3]=i):i=e[3];let a;e[4]===n?a=e[5]:(a=e=>n({pullRequestLinksOpenInApp:!!e}),e[4]=n,e[5]=a);let o;e[6]!==t||e[7]!==a?(o=(0,Q.jsx)(bt,{checked:t,onCheckedChange:a,"aria-label":`Open pull requests in P4 Code`}),e[6]=t,e[7]=a,e[8]=o):o=e[8];let s;return e[9]!==i||e[10]!==o?(s=(0,Q.jsx)(X,{...r,description:`Clicking a pull request link opens it in P4 Code. Turn off to open pull request links like any other link, on GitHub or your git host.`,resetAction:i,control:o}),e[9]=i,e[10]=o,e[11]=s):s=e[11],s}function dr(e){return e.pullRequestLinksOpenInApp}function fr(){let e=(0,Z.c)(7),{search:t,environment:n}=ft(),r=ut(),i=n?.connection.phase===`connected`&&n.serverConfig!==null?n.environmentId:null,a;e[0]===t?a=e[1]:(a=JSON.stringify(t),e[0]=t,e[1]=a);let o=`${i}:${a}`,s;return e[2]!==i||e[3]!==r.enableAgentDeviceAccess||e[4]!==r.enableDeviceSupport||e[5]!==o?(s=(0,Q.jsx)(gt,{id:`devices`,title:`Devices`,children:(0,Q.jsx)(pr,{environmentId:i,enabled:r.enableDeviceSupport,agentAccessEnabled:r.enableAgentDeviceAccess},o)}),e[2]=i,e[3]=r.enableAgentDeviceAccess,e[4]=r.enableDeviceSupport,e[5]=o,e[6]=s):s=e[6],s}function pr({environmentId:e,enabled:t,agentAccessEnabled:n}){let r=Se(e,H),{state:i,loaded:a}=ze(e),{scope:o,environments:s,connectedEnvironments:c}=ft(),l=dt(),u=o.kind===`project`||o.kind===`checkout`,d=c.some(e=>e.serverConfig?.settings.enableDeviceSupport),f=Te(Be.configure,{reportFailure:!1}),p=Te(Be.list,{reportFailure:!1}),[m,h]=(0,$.useState)(null),g=i.hostStatus===`installing`||i.hostStatus===`starting`,v=i.hosts.some(e=>e.kind===`local`&&!e.platforms.some(e=>e.available)),[b,x]=(0,$.useState)(!1);b&&!t&&x(!1),t&&!b&&(i.hostStatus===`ready`||v)&&m!==`hub`&&x(!0);let S=async(t,n)=>{if(e&&Ce(e,`settings:write`)){h(t);try{let e=await Promise.allSettled(s.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!Ce(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return f({environmentId:e.environmentId,input:{...n,...n.enabled?{onboardingCompleted:!0}:{}}})})),t=s.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});t.length>0&&q.add({type:`error`,title:`Device settings not saved on all environments`,description:`Could not update ${t.map(e=>e.label).join(`, `)}.`})}finally{h(null)}}},[C,w]=(0,$.useState)(null),T=i.hosts.find(e=>e.kind===`local`)?.tools,E=e=>{let t=T?.[e];return i.supportsToolUpdate&&t?!t.installedVersions.includes(t.requiredVersion):!1},D=(t,n=!1)=>{e&&(w(null),h(`update-${t}`),p({environmentId:e,input:{updateTool:t}}).then(e=>{if(e._tag===`Failure`){let r=we(e.cause);w({tool:t,message:r}),n&&q.add({type:`error`,title:r})}}).finally(()=>h(null)))},O=t=>{e&&(h(t),p({environmentId:e,input:{inspectOnly:!0}}).finally(()=>h(null)))},k=t=>{let n=E(t);if(!n&&!i.supportsToolInspection)return null;let r=m===`update-${t}`||m===`check-${t}`,a=n?`Update to v${T?.[t].requiredVersion}`:`Check ${t===`hub`?`device hub`:`agent device`} version`;return(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(y,{size:`icon-xs`,variant:`ghost-muted`,disabled:!e||m!==null||g,"aria-label":a,onClick:()=>n?D(t,!0):O(`check-${t}`)}),children:(0,Q.jsxs)(`span`,{className:`grid *:col-start-1 *:row-start-1 *:transition-[opacity,scale] *:duration-150 *:ease-out motion-reduce:*:transition-none`,children:[(0,Q.jsx)(`span`,{className:n&&!r?void 0:`scale-75 opacity-0`,children:(0,Q.jsx)(_,{"aria-hidden":!0})}),(0,Q.jsx)(`span`,{className:n&&!r?`scale-75 opacity-0`:void 0,children:(0,Q.jsx)(St,{refreshing:r})})]})}),(0,Q.jsx)(Oe,{side:`top`,children:a})]})},A=t=>{let n=T?.[t];return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&E(t)?(0,Q.jsx)(y,{size:`sm`,disabled:!e||m!==null||g,onClick:()=>D(t),children:m===`update-${t}`?`Updating…`:`Update`}):null,i.supportsToolInspection?(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:!e||m!==null||g,onClick:()=>O(`check`),children:m===`check`?`Checking…`:`Check versions`}):null]}),C?.tool===t?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:C.message}):null]})};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{...yt(`device-hub`),serverScoped:!0,settingKeys:[`enableDeviceSupport`],description:Ge,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(jt,{action:A(`hub`),kind:`hub`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),k(`hub`),m===`hub`?(0,Q.jsx)(We,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(Et,{settingKeys:[`enableDeviceSupport`],checked:t,disabled:!r||u||!a||!e||g||m!==null,"aria-label":`Device hub`,onCheckedChange:e=>void S(`hub`,{enabled:!!e,...e?{}:{agentAccessEnabled:!1}})})]})}),(0,Q.jsx)(Qe,{children:b?(0,Q.jsx)(X,{...yt(`device-platform-support`),description:c.length>1?`Status for ${c.find(t=>t.environmentId===e)?.label}. Select an environment to inspect its simulator support.`:void 0,status:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2`,children:[(0,Q.jsx)(Ue,{compact:!0,platform:`iOS`,status:qe(i,`ios`)}),(0,Q.jsx)(Ue,{compact:!0,platform:`Android`,status:qe(i,`android`)})]}),control:(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:!e||!t||g||m!==null,onClick:()=>{e&&(h(`check`),p({environmentId:e,input:{}}).finally(()=>h(null)))},children:m===`check`?`Checking…`:`Refresh`})}):null}),(0,Q.jsx)(X,{...yt(`agent-device-access`),serverScoped:!0,settingKeys:[`enableAgentDeviceAccess`],description:Ve,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(jt,{action:A(`agent`),kind:`agent`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),k(`agent`),m===`agent`?(0,Q.jsx)(Ke,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(Et,{settingKeys:[`enableAgentDeviceAccess`],checked:n,disabled:!r||c.length===0||!u&&(!a||!d||g)||m!==null,"aria-label":`Agent device access`,onCheckedChange:e=>u?l({enableAgentDeviceAccess:!!e}):void S(`agent`,{agentAccessEnabled:!!e})})]})}),e?(0,Q.jsx)(He,{state:{...i,hosts:i.hosts.filter(e=>e.kind===`local`)},environmentId:e}):null,(0,Q.jsx)(Wt,{environmentId:e}),i.supportsEasHosts?(0,Q.jsx)(tn,{environmentId:e}):null]})}function mr(e){let t=(0,Z.c)(14),{disabled:n}=e,r=J(hr),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-auto-show-floating-preview`),t[0]=a):a=t[0];let o;t[1]!==r||t[2]!==n||t[3]!==i?(o=!n&&r!==!0?(0,Q.jsx)(ht,{label:`auto-show floating preview`,onClick:()=>i({browserAutoShowFloatingPreview:!0})}):null,t[1]=r,t[2]=n,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>i({browserAutoShowFloatingPreview:!!e}),t[5]=i,t[6]=s);let c;t[7]!==r||t[8]!==n||t[9]!==s?(c=(0,Q.jsx)(bt,{disabled:n,checked:r,onCheckedChange:s,"aria-label":`Auto-show floating preview`}),t[7]=r,t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;return t[11]!==o||t[12]!==c?(l=(0,Q.jsx)(X,{...a,description:`Show the floating preview when an agent opens a browser or device unless the agent says otherwise.`,resetAction:o,control:c}),t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function hr(e){return e.browserAutoShowFloatingPreview}function gr({disabled:e}){let t=J(e=>e.browserProfiles),n=J(e=>e.browserDefaultProfileId),r=ve(),a=Y(),{environments:o,isReady:c}=he(),l=_e(),[h,g]=(0,$.useState)(null),[_,b]=(0,$.useState)(null),[S,E]=(0,$.useState)(null),[D,O]=(0,$.useState)(null),[j,M]=(0,$.useState)(null),[N,P]=(0,$.useState)(!1),F=oe(),I=Te(tt.clearProfile,{reportFailure:!1}),L={environmentIds:o.map(e=>e.environmentId).filter(e=>F.get(e)?.environment.capabilities.serverBrowser===!0),clear:async(e,t)=>{let n=await I({environmentId:e,input:{profileId:t}});if(n._tag===`Failure`)throw ae(n)}},B=kn(Ct!==null,c,o.length,L.environmentIds.length),V=(0,$.useRef)(!1),[ee,H]=(0,$.useState)(!1),U=e||!r,te=R(t).filter(e=>e.kind!==`incognito`),ne=k(te,n)?.id??`default`,re=e=>{if(!r||V.current)return;let t=be().browserProfiles;if(t.length>=24)return;let n=R(t),i=new Set(n.map(e=>e.name)),o=e;for(let t=2;i.has(o);t+=1)o=`${e} ${t}`;let s={id:`profile-${v()}`,name:o,kind:`persistent`};return a({browserProfiles:[...t,s]}),s},ie=(e,t)=>{if(!r||V.current)return;let n=t.trim().slice(0,48);if(n===``)return;let i=be().browserProfiles;a({browserProfiles:i.map(t=>t.id===e?{...t,name:n}:t)})},se=(e,t)=>{r&&!V.current&&(B?On(Ct,o.map(e=>e.environmentId),e,L).then(()=>{q.add({type:`success`,title:`Cleared ${t}'s cookies and cache`})}).catch(()=>{q.add({type:`error`,title:`Could not clear ${t}'s data`})}):q.add({type:`error`,title:`Could not clear ${t}'s data`,description:`You're not connected to a server yet.`}))},W=async e=>{if(!r||V.current)return;if(!B){M(`Connect to an environment before removing this profile.`);return}M(null),P(!0);try{await On(Ct,c?o.map(e=>e.environmentId):[],e,L)}catch{M(`Profile data could not be deleted. Try again.`),P(!1);return}let t=be();a({browserProfiles:t.browserProfiles.filter(t=>t.id!==e),...t.browserDefaultProfileId===e?{browserDefaultProfileId:A}:{}}),P(!1),E(null)},ce=(h??[]).filter(e=>e.unavailable!==`notInstalled`&&e.unavailable!==`unsupportedPlatform`),G=(0,$.useCallback)(()=>{Ct&&Ct.listBrowserImportSources().then(g).catch(()=>g(e=>e??[]))},[]),le=async(e,t,n)=>{if(!Ct||!r)return{kind:`blocked`,reason:`sessionUnavailable`};if(n.target.kind===`existing`&&!R(be().browserProfiles).some(e=>e.id===n.target.profileId)||V.current)return{kind:`blocked`,reason:`readFailed`};V.current=!0,H(!0);try{let r=await Ct.importBrowserCookies({environmentId:t,sourceId:e.id,sourceProfileDirectory:n.sourceProfileDirectory,targetProfileId:n.target.profileId});if(n.target.kind===`existing`&&!R(be().browserProfiles).some(e=>e.id===n.target.profileId))return{kind:`blocked`,reason:`readFailed`};let i;if(n.target.kind===`new`){if(r.imported>0)try{i=(await ye(t=>{if(t.browserProfiles.find(e=>e.id===n.target.profileId))return t;if(t.browserProfiles.length>=24)throw new Pn;let r=new Set(R(t.browserProfiles).map(e=>e.name)),i=e.name;for(let t=2;r.has(i);t+=1)i=`${e.name} ${t}`;return{...t,browserProfiles:[...t.browserProfiles,{id:n.target.profileId,name:i,kind:`persistent`}]}})).browserProfiles.find(e=>e.id===n.target.profileId)?.name??e.name}catch(r){await On(Ct,[t],n.target.profileId).catch(()=>void 0);let i=r instanceof Pn?`profileLimitReached`:`profileNotSaved`;throw Error(`Importing cookies from ${e.id} failed: ${i}.`,{cause:r})}else i=e.name}else i=n.target.name;return{kind:`imported`,imported:r.imported,skipped:r.skipped,skippedDomains:r.skippedDomains,targetName:i}}catch(e){return{kind:`blocked`,reason:Fn(e)}}finally{V.current=!1,H(!1)}},ue=async e=>{if(Ct)try{let t=await Ct.listBrowserImportSources();return g(t),t.find(t=>t.id===e)}catch{return}},K=t.length>=24;return(0,Q.jsxs)(X,{...yt(`browser-profiles`),description:`Profiles separate cookies and logins. Incognito data is cleared when the app closes.`,control:(0,Q.jsxs)(f,{onOpenChange:e=>e&&G(),children:[(0,Q.jsxs)(m,{render:(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:U||ee}),children:[(0,Q.jsx)(d,{}),`Add profile`]}),(0,Q.jsxs)(x,{align:`end`,children:[(0,Q.jsx)(T,{disabled:!r||K,onClick:()=>re(`New profile`),children:`Blank profile`}),K?(0,Q.jsx)(T,{disabled:!0,children:`You’ve reached the profile limit`}):null,(0,Q.jsx)(C,{}),(0,Q.jsxs)(i,{children:[(0,Q.jsx)(p,{children:`Import from`}),h===null?(0,Q.jsx)(T,{disabled:!0,children:`Looking for browsers…`}):ce.length===0?(0,Q.jsx)(T,{disabled:!0,children:`No supported browsers found`}):(0,Q.jsxs)(Q.Fragment,{children:[ce.map(e=>(0,Q.jsx)(T,{disabled:!r||l==null,onClick:()=>{r&&l!=null&&b({source:e,environmentId:l.environmentId,environmentName:_t({isPrimary:!0,environmentId:l.environmentId,runtimeLabel:l.label})})},children:e.name},e.id)),l==null?(0,Q.jsx)(T,{disabled:!0,children:`Connect to an environment to import cookies`}):null]})]})]})]}),children:[(0,Q.jsx)(`div`,{className:`mt-2 mb-2 overflow-hidden rounded-lg border border-border/60`,children:te.map((e,t)=>{let n=z(e.id),i=e.id===ne;return(0,Q.jsxs)(`div`,{className:w(`flex items-center gap-3 px-3 py-2`,t>0&&`border-t border-border/60`),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[n?(0,Q.jsx)(`span`,{className:w(`truncate text-sm text-foreground`,U&&`opacity-64`),children:e.name}):(0,Q.jsx)(Tt,{nativeInput:!0,size:`sm`,className:`w-full max-w-56`,"aria-label":`Rename ${e.name}`,disabled:U||ee,maxLength:48,value:e.name,onCommit:t=>ie(e.id,t)}),i?(0,Q.jsx)(`span`,{className:w(`flex`,U&&`opacity-64`),children:(0,Q.jsx)(u,{children:`Default`})}):null]}),(0,Q.jsxs)(f,{children:[(0,Q.jsx)(m,{render:(0,Q.jsx)(y,{size:`icon-xs`,variant:`ghost-muted`,disabled:U||ee,"aria-label":`${e.name} options`}),children:(0,Q.jsx)(s,{})}),(0,Q.jsxs)(x,{align:`end`,children:[(0,Q.jsx)(T,{disabled:!r||i,onClick:()=>{r&&a({browserDefaultProfileId:e.id})},children:`Set as default`}),(0,Q.jsx)(T,{disabled:!r||!B,onClick:()=>{L.environmentIds.length>0?O(e):se(e.id,e.name)},children:`Clear cookies and cache`}),n?null:(0,Q.jsx)(T,{variant:`destructive`,disabled:!r||!B,onClick:()=>{r&&E(e)},children:`Remove profile and data`}),B?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(C,{}),(0,Q.jsx)(T,{disabled:!0,children:c?`Connect to an environment to clear profile data`:`Checking environments…`})]})]})]})]},e.id)})}),(0,Q.jsx)(lt,{open:S!==null,onOpenChange:e=>{!e&&!N&&(E(null),M(null))},children:(0,Q.jsxs)(ot,{children:[(0,Q.jsxs)(rt,{children:[(0,Q.jsxs)(ct,{children:[`Remove “`,S?.name,`”?`]}),(0,Q.jsx)(st,{children:`Its cookies and logins are deleted. Desktop tabs already open in this profile stay open until you close them; server browser tabs close now.`}),j?(0,Q.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-destructive`,children:j}):null,B?null:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect to an environment to remove this profile and its data.`})]}),(0,Q.jsxs)(it,{children:[(0,Q.jsx)(at,{disabled:N,render:(0,Q.jsx)(y,{variant:`outline`,disabled:N}),children:`Cancel`}),(0,Q.jsx)(y,{variant:`destructive`,disabled:N||!r||!B,onClick:()=>{S&&r&&B&&W(S.id)},children:N?`Removing…`:`Remove profile`})]})]})}),(0,Q.jsx)(lt,{open:D!==null,onOpenChange:e=>{e||O(null)},children:(0,Q.jsxs)(ot,{children:[(0,Q.jsxs)(rt,{children:[(0,Q.jsxs)(ct,{children:[`Clear “`,D?.name,`”’s cookies and cache?`]}),(0,Q.jsx)(st,{children:`You are signed out of its sites. Server browser tabs open in this profile close now.`})]}),(0,Q.jsxs)(it,{children:[(0,Q.jsx)(at,{render:(0,Q.jsx)(y,{variant:`outline`}),children:`Cancel`}),(0,Q.jsx)(y,{variant:`destructive`,onClick:()=>{D&&se(D.id,D.name),O(null)},children:`Clear data`})]})]})}),_?(0,Q.jsx)(hn,{source:_.source,destinationEnvironmentName:_.environmentName,targetProfiles:te.map(e=>({id:e.id,name:e.name})),canCreateProfile:r&&!K,onImport:e=>le(_.source,_.environmentId,e),onRefreshSource:()=>ue(_.source.id),onCheckFullDiskAccess:window.desktopBridge?.checkSystemPermission?()=>window.desktopBridge.checkSystemPermission(`full-disk-access`):void 0,onOpenFullDiskAccessSettings:async()=>{await ge()?.shell.openSystemSettings(`full-disk-access`).catch(()=>{q.add({type:`error`,title:`Could not open System Settings`,description:`Open Privacy & Security → Full Disk Access manually.`})})},onClose:()=>b(null)}):null]})}function _r(){let e=(0,Z.c)(3),t=!Ee,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(gr,{disabled:t}),(0,Q.jsx)(Bn,{disabled:t}),(0,Q.jsx)(Un,{disabled:t}),(0,Q.jsx)(Kn,{disabled:t}),(0,Q.jsx)(Qn,{disabled:t}),(0,Q.jsx)(Yn,{disabled:t}),(0,Q.jsx)(nr,{disabled:t}),(0,Q.jsx)(mr,{disabled:t})]}),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(wt,{category:`integrations`}),e[1]=i):i=e[1];let a;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(mt,{children:[i,(0,Q.jsxs)(gt,{id:`browser`,title:`Browser`,children:[t?(0,Q.jsx)(pt,{message:`Only available in the desktop app.`,children:r}):r,(0,Q.jsx)(or,{}),(0,Q.jsx)(ur,{})]}),(0,Q.jsx)(fr,{})]}),e[2]=a):a=e[2],a}var vr=_r;export{vr as component};
|
|
2
|
-
//# sourceMappingURL=settings.integrations-
|
|
1
|
+
import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{$n as i,Hu as a,Jl as o,Od as s,Ol as c,Td as l,Xn as u,Zd as d,Zn as f,er as p,fr as m,hr as h,il as g,iu as _,l as v,mr as y,op as b,rr as x,sl as S,sr as C,t as w,tr as T,wd as E}from"./utils-DFNDxNZi.js";import{Cg as D,Hr as O,Jr as k,Kr as A,Lr as j,Mn as M,Nn as N,Rr as P,Sn as F,Vm as I,Wr as L,Xr as R,Yr as z,cc as B,hl as V,jn as ee,la as H,lc as U,v as te,wn as ne,xn as re,y as ie}from"./src-BVovWpja.js";import{Ar as ae}from"./runtime-DIAcbMTc.js";import{w as oe}from"./entities-HOBDIiHK.js";import{a as se,r as W,t as ce}from"./number-field-CALZZPio.js";import{a as G,c as le,i as ue,o as K,r as de,s as fe,t as pe}from"./select-CxYi0YMi.js";import{t as me}from"./spinner-7CSKKESP.js";import{a as q}from"./relay-YiJpGyaO.js";import{D as he,J as ge,O as _e,c as ve,o as ye,r as be,s as J,x as Y}from"./useSettings-BWMcQzC-.js";import{f as xe}from"./server-BNjk2K1j.js";import{i as Se,n as Ce}from"./session-DMNo4Bh3.js";import{t as we}from"./query-Bw8YoCbO.js";import{t as Te}from"./use-atom-command-C4Tyb1VL.js";import{t as Ee}from"./env-BfPir1X4.js";import{a as De,n as Oe,t as ke}from"./tooltip-CGvxq8k3.js";import{t as Ae}from"./input-DxHa9qj5.js";import{a as je,c as Me,i as Ne,n as Pe,o as Fe,r as Ie,s as Le,t as Re}from"./dialog-CrLVN_m6.js";import{i as ze,t as Be}from"./device-H2MyT_kA.js";import{a as Ve,d as He,i as Ue,n as We,o as Ge,t as Ke,u as qe}from"./DeviceSetup-CX2OWVB9.js";import{a as Je,i as Ye,o as Xe,t as Ze}from"./popover-DxCAIK62.js";import{t as Qe}from"./AnimatedHeight-Dwarin_V.js";import{i as $e,n as et}from"./Icons-BUrn1Fzo.js";import{t as tt}from"./preview-Ce5ECOHv.js";import{r as nt}from"./preview-x1tmlUez.js";import{a as rt,i as it,n as at,o as ot,r as st,s as ct,t as lt}from"./alert-dialog-3XDceRWv.js";import{B as ut,E as dt,L as ft,U as pt,a as X,c as mt,i as ht,r as gt,s as _t}from"./settingsLayout-CzGbLP4v.js";import{Ja as vt,Lr as yt,Ya as bt,ko as xt,no as St,zo as Ct}from"./main-BFdCLmkY.js";import{t as wt}from"./ProjectDefaultsSettings-DMfJN66D.js";import{t as Tt}from"./draft-input-UuEBPJE8.js";import{t as Et}from"./ScopedSwitch-CwnjCta_.js";import{t as Dt}from"./SecretInput-BYfVbTLh.js";import{n as Ot,r as kt,t as At}from"./usePermissionStatus-Cx1Wuwk0.js";var Z=n(),Q=e(r(),1);function jt(e){let t=(0,Z.c)(27),{tools:n,action:r,kind:i,owner:a,error:o}=e,s=i?n?.[i]:void 0,c;t[0]===s?c=t[1]:(c=s?.runningVersion??(s?.installedVersions.includes(s.requiredVersion)?s.requiredVersion:s?.installedVersions.toSorted(Mt).at(-1)),t[0]=s,t[1]=c);let l=c,u=i===`hub`?`Device hub`:`Agent device`,d=i?`${u}: ${l?`version ${l}`:s?`not installed`:`version unknown`}. Show details`:void 0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(h,{tone:`muted`}),t[2]=f):f=t[2];let p=i?l?`v${l}`:s?`Not installed`:`Version unknown`:o?`Versions unavailable`:`Versions`,m;t[3]!==d||t[4]!==p?(m=(0,Q.jsx)(Xe,{"aria-label":d,render:f,children:p}),t[3]=d,t[4]=p,t[5]=m):m=t[5];let g=i?u:`Device tools`,_;t[6]===g?_=t[7]:(_=(0,Q.jsx)(Je,{children:g}),t[6]=g,t[7]=_);let v;t[8]!==i||t[9]!==u||t[10]!==n?(v=n?(0,Q.jsx)(`div`,{className:`mt-4 divide-y divide-border/50`,children:[[`Device hub`,n.hub],[`Agent device`,n.agent]].filter(e=>{let[t]=e;return!i||t===u}).map(e=>{let[t,n]=e;return(0,Q.jsxs)(`div`,{className:`space-y-2 py-3 first:pt-0 last:pb-0`,children:[i?null:(0,Q.jsx)(`p`,{className:`text-xs font-medium`,children:t}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 text-xs`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Running`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.runningVersion??`Not running`}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Required`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.requiredVersion}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Installed`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono break-words`,children:n.installedVersions.join(`, `)||`None`})]})]},t)})}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Versions have not been checked.`}),t[8]=i,t[9]=u,t[10]=n,t[11]=v):v=t[11];let y=a?`Managed by ${a}. `:``,b;t[12]===y?b=t[13]:(b=(0,Q.jsxs)(`p`,{className:`mt-4 border-t border-border/50 pt-3 text-xs text-muted-foreground`,children:[y,`Tools update automatically on this host when needed.`]}),t[12]=y,t[13]=b);let x;t[14]===o?x=t[15]:(x=o?(0,Q.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-destructive`,children:o}):null,t[14]=o,t[15]=x);let S;t[16]===r?S=t[17]:(S=r?(0,Q.jsx)(`div`,{className:`mt-3`,children:r}):null,t[16]=r,t[17]=S);let C;t[18]!==b||t[19]!==x||t[20]!==S||t[21]!==_||t[22]!==v?(C=(0,Q.jsxs)(Ye,{align:`end`,width:`md`,children:[_,v,b,x,S]}),t[18]=b,t[19]=x,t[20]=S,t[21]=_,t[22]=v,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==m?(w=(0,Q.jsxs)(Ze,{children:[m,C]}),t[24]=C,t[25]=m,t[26]=w):w=t[26],w}function Mt(e,t){return e.localeCompare(t,void 0,{numeric:!0})}var $=e(t(),1);function Nt(e,t,n,r=t){let i=(e,t)=>e.target===t.target&&e.port===t.port&&e.identityFile===t.identityFile,a=t=>{let n=e.filter(e=>i(e,t));if(n.length>1)throw Error(`Multiple hosts match this SSH destination. Select the environment to edit its hosts.`);return n[0]},o=e.find(e=>e.id===r.id)??a(r)??(n?void 0:a(t));return n?e.filter(e=>e.id!==o?.id):o?e.map(e=>e.id===o.id?{...t,id:o.id}:e):[...e,t]}function Pt(e){let t=(0,Z.c)(4),{platforms:n}=e,r;t[0]===n?r=t[1]:(r=n.map(Ft),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:r}),t[2]=r,t[3]=i),i}function Ft(e){return(0,Q.jsxs)(ke,{children:[(0,Q.jsxs)(De,{render:(0,Q.jsx)(`span`,{tabIndex:0,className:`inline-flex items-center gap-1`}),children:[e.available?(0,Q.jsx)(c,{className:`size-3`}):(0,Q.jsx)(E,{className:`size-3`}),e.platform===`ios`?`iOS`:`Android`,` `,e.available?`available`:`unavailable`]}),(0,Q.jsx)(Oe,{children:e.reason??(e.platform===`ios`?`iOS available`:`Android available`)})]},e.platform)}var It=V(U);function Lt(e){let{identityFile:t,...n}=e;return It({...n,...t?.trim()?{identityFile:t.trim()}:{}})}function Rt(e){return JSON.stringify([e.target.trim(),e.port,e.identityFile?.trim()||void 0])}async function zt(e,t,n,r){await Promise.all(e.map(async e=>{r(e.environmentId,{status:`pending`});try{if(!e.connected)throw Error(`Environment disconnected`);let i=await n(e.environmentId,t);r(e.environmentId,i.kind===`local`?{status:`local`}:{status:`connected`,platforms:i.platforms,...i.tools?{tools:i.tools}:{}})}catch(t){r(e.environmentId,{status:`failed`,error:t instanceof Error?t.message:String(t)})}}))}function Bt(e){let t=Te(Be.testHost,{reportFailure:!1}),[n,r]=(0,$.useState)({}),i=(0,$.useRef)(new Set);return{checks:n,testConnection:async n=>{let a=Rt(n);if(i.current.has(a))return;i.current.add(a),r(e=>({...e,[a]:{}}));let o={};try{return await zt(e,n,async(e,n)=>{if(!Ce(e,`settings:write`))throw Error(`This connection cannot test device hosts.`);let r=await t({environmentId:e,input:n});if(r._tag===`Failure`)throw ae(r);return r.value},(e,t)=>{o[e]=t,r(n=>({...n,[a]:{...n[a],[e]:t}}))}),o}finally{i.current.delete(a)}}}}function Vt(e){let t=(0,Z.c)(107),{host:n,isNew:r,targets:i,busy:a,onSave:o,onClose:s}=e,[u,d]=(0,$.useState)(n),{checks:f,testConnection:p}=Bt(i),m=f[Rt(u)],h=Object.values(m??{}).some(Ut),g,_;t[0]===u?(g=t[1],_=t[2]):(g=Lt({...u,label:u.label.trim()||u.target}),_=D(g),t[0]=u,t[1]=g,t[2]=_);let v=_,x;t[3]===m?x=t[4]:(x=Object.values(m??{}).filter(Ht),t[3]=m,t[4]=x);let S=x.length,C;t[5]!==a||t[6]!==s?(C=e=>{!e&&!a&&s()},t[5]=a,t[6]=s,t[7]=C):C=t[7];let w=!a,T;t[8]!==a||t[9]!==h||t[10]!==u.label||t[11]!==g||t[12]!==o?(T=(0,Q.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),D(g)&&u.label.trim()&&!a&&!h&&o(g.value)}}),t[8]=a,t[9]=h,t[10]=u.label,t[11]=g,t[12]=o,t[13]=T):T=t[13];let E=r?`Add device host`:`Edit device host`,O;t[14]===E?O=t[15]:(O=(0,Q.jsx)(Me,{children:E}),t[14]=E,t[15]=O);let k=i.length===1?`Connect from ${i[0]?.label}.`:`Connect from ${i.length} selected environments.`,A;t[16]===k?A=t[17]:(A=(0,Q.jsxs)(Ie,{children:[k,` `,`Hosts on the same machine are skipped.`]}),t[16]=k,t[17]=A);let j;t[18]!==O||t[19]!==A?(j=(0,Q.jsxs)(je,{children:[O,A]}),t[18]=O,t[19]=A,t[20]=j):j=t[20];let M;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(`span`,{children:`Name`}),t[21]=M):M=t[21];let N;t[22]===u?N=t[23]:(N=e=>d({...u,label:e.target.value}),t[22]=u,t[23]=N);let P;t[24]!==a||t[25]!==u.label||t[26]!==N?(P=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[M,(0,Q.jsx)(Ae,{autoFocus:!0,required:!0,value:u.label,disabled:a,onChange:N,placeholder:`Mac mini`})]}),t[24]=a,t[25]=u.label,t[26]=N,t[27]=P):P=t[27];let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(`span`,{children:`SSH target`}),t[28]=F):F=t[28];let I;t[29]===u?I=t[30]:(I=e=>d({...u,target:e.target.value}),t[29]=u,t[30]=I);let L;t[31]!==a||t[32]!==u.target||t[33]!==I?(L=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[F,(0,Q.jsx)(Ae,{required:!0,value:u.target,disabled:a,onChange:I,placeholder:`user@host or SSH alias`})]}),t[31]=a,t[32]=u.target,t[33]=I,t[34]=L):L=t[34];let R=n.port!==void 0||n.identityFile!==void 0||void 0,z;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:`SSH options`}),t[35]=z):z=t[35];let B;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(`span`,{children:`Identity file`}),t[36]=B):B=t[36];let V=u.identityFile??``,ee;t[37]===u?ee=t[38]:(ee=e=>{let{identityFile:t,...n}=u;d(e.target.value?{...n,identityFile:e.target.value}:n)},t[37]=u,t[38]=ee);let H;t[39]!==a||t[40]!==V||t[41]!==ee?(H=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[B,(0,Q.jsx)(Ae,{value:V,disabled:a,onChange:ee,placeholder:`SSH config default`})]}),t[39]=a,t[40]=V,t[41]=ee,t[42]=H):H=t[42];let U;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(`span`,{children:`Port`}),t[43]=U):U=t[43];let te=u.port??``,ne;t[44]===u?ne=t[45]:(ne=e=>{let{port:t,...n}=u;d(e.target.value?{...n,port:Number(e.target.value)}:n)},t[44]=u,t[45]=ne);let re;t[46]!==a||t[47]!==te||t[48]!==ne?(re=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[U,(0,Q.jsx)(Ae,{type:`number`,min:1,max:65535,value:te,disabled:a,onChange:ne,placeholder:`Default`})]}),t[46]=a,t[47]=te,t[48]=ne,t[49]=re):re=t[49];let ie;t[50]!==H||t[51]!==re?(ie=(0,Q.jsxs)(`div`,{className:`mt-3 grid grid-cols-[minmax(0,1fr)_7rem] gap-3`,children:[H,re]}),t[50]=H,t[51]=re,t[52]=ie):ie=t[52];let ae;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Optional. Resolved separately on each environment.`}),t[53]=ae):ae=t[53];let oe;t[54]!==R||t[55]!==ie?(oe=(0,Q.jsxs)(`details`,{open:R,className:`text-sm`,children:[z,ie,ae]}),t[54]=R,t[55]=ie,t[56]=oe):oe=t[56];let se=h?`Checking environments…`:m?S?`${S} of ${i.length} failed`:`Connection checks passed`:`Check access before saving`,W;t[57]===se?W=t[58]:(W=(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:se}),t[57]=se,t[58]=W);let ce=a||h||!v,G;t[59]!==g||t[60]!==p?(G=()=>{D(g)&&p(g.value)},t[59]=g,t[60]=p,t[61]=G):G=t[61];let le;t[62]===h?le=t[63]:(le=h?(0,Q.jsx)(me,{size:`xs`}):null,t[62]=h,t[63]=le);let ue;t[64]!==ce||t[65]!==G||t[66]!==le?(ue=(0,Q.jsxs)(y,{type:`button`,size:`sm`,variant:`outline`,disabled:ce,onClick:G,children:[le,` Test connection`]}),t[64]=ce,t[65]=G,t[66]=le,t[67]=ue):ue=t[67];let K;t[68]!==W||t[69]!==ue?(K=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-2.5`,children:[W,ue]}),t[68]=W,t[69]=ue,t[70]=K):K=t[70];let de;t[71]!==m||t[72]!==i?(de=m?(0,Q.jsx)(`ul`,{className:`border-t border-border/60 divide-y divide-border/40`,children:i.map(e=>{let t=m[e.environmentId];return t?(0,Q.jsxs)(`li`,{className:`px-3 py-2.5 text-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:e.label}),(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-1.5 ${t.status===`failed`?`text-destructive`:`text-muted-foreground`}`,children:t.status===`pending`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(me,{size:`xs`}),` Checking…`]}):t.status===`local`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`size-3`}),` Already available locally`]}):t.status===`failed`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(b,{className:`size-3`}),` Failed`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(c,{className:`size-3`}),` Connected`]})})]}),t.status===`connected`?(0,Q.jsx)(`div`,{className:`mt-1.5`,children:(0,Q.jsx)(Pt,{platforms:t.platforms})}):null,t.status===`failed`?(0,Q.jsxs)(`details`,{className:`mt-1.5 text-muted-foreground`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:`Show error`}),(0,Q.jsx)(`p`,{className:`mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-words`,children:t.error})]}):null]},e.environmentId):null})}):null,t[71]=m,t[72]=i,t[73]=de):de=t[73];let fe;t[74]!==K||t[75]!==de?(fe=(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/60`,children:[K,de]}),t[74]=K,t[75]=de,t[76]=fe):fe=t[76];let pe;t[77]!==P||t[78]!==L||t[79]!==oe||t[80]!==fe?(pe=(0,Q.jsxs)(Fe,{children:[P,L,oe,fe]}),t[77]=P,t[78]=L,t[79]=oe,t[80]=fe,t[81]=pe):pe=t[81];let q;t[82]!==a||t[83]!==s?(q=(0,Q.jsx)(y,{type:`button`,variant:`ghost`,disabled:a,onClick:s,children:`Cancel`}),t[82]=a,t[83]=s,t[84]=q):q=t[84];let he;t[85]!==a||t[86]!==h||t[87]!==u.label||t[88]!==v?(he=a||h||!v||!u.label.trim(),t[85]=a,t[86]=h,t[87]=u.label,t[88]=v,t[89]=he):he=t[89];let ge;t[90]===a?ge=t[91]:(ge=a?(0,Q.jsx)(me,{size:`xs`}):null,t[90]=a,t[91]=ge);let _e;t[92]!==he||t[93]!==ge?(_e=(0,Q.jsxs)(y,{type:`submit`,disabled:he,children:[ge,` Save host`]}),t[92]=he,t[93]=ge,t[94]=_e):_e=t[94];let ve;t[95]!==q||t[96]!==_e?(ve=(0,Q.jsxs)(Ne,{children:[q,_e]}),t[95]=q,t[96]=_e,t[97]=ve):ve=t[97];let ye;t[98]!==j||t[99]!==pe||t[100]!==w||t[101]!==ve||t[102]!==T?(ye=(0,Q.jsxs)(Le,{showCloseButton:w,render:T,children:[j,pe,ve]}),t[98]=j,t[99]=pe,t[100]=w,t[101]=ve,t[102]=T,t[103]=ye):ye=t[103];let be;return t[104]!==C||t[105]!==ye?(be=(0,Q.jsx)(Re,{open:!0,onOpenChange:C,children:ye}),t[104]=C,t[105]=ye,t[106]=be):be=t[106],be}function Ht(e){return e.status===`failed`}function Ut(e){return e.status===`pending`}function Wt(e){let{scope:t,environments:n,connectedEnvironments:r}=pt(),i=Se(e.environmentId,H),a=t.kind===`project`||t.kind===`checkout`,o=Te(xe.updateSettings,{reportFailure:!1}),[s,c]=(0,$.useState)(null),[l,u]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),m=n.map(e=>({environmentId:e.environmentId,label:e.label,connected:e.connection.phase===`connected`})),{checks:h,testConnection:g}=Bt(m),_=async(t,r=!1,i=t)=>{if(e.environmentId&&!a){p(!0);try{let e=await Promise.allSettled(n.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!Ce(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return o({environmentId:e.environmentId,input:{patch:{deviceHosts:Nt(e.serverConfig.settings.deviceHosts,t,r,i)}}})})),a=n.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});a.length===0?c(null):q.add({type:`error`,title:`Device hosts not saved on all environments`,description:`Could not update ${a.map(e=>e.label).join(`, `)}.`})}finally{p(!1)}}};return(0,Q.jsx)(X,{id:`device-hosts`,title:`Device hosts`,serverScoped:!0,settingKeys:[`deviceHosts`],description:`Add remote machines with simulator or emulator runtimes installed, and the selected environments will connect over SSH and set up device tools automatically.`,control:(0,Q.jsxs)(y,{size:`sm`,variant:`outline`,disabled:!i||a||f||!e.environmentId||s!==null,onClick:()=>{u(null),c({kind:`ssh`,id:v(),label:``,target:``})},children:[(0,Q.jsx)(d,{className:`size-3.5`}),` Add host`]}),children:(0,Q.jsx)(`div`,{className:`pt-3 pb-2`,children:e.environmentId?(0,Q.jsxs)(Q.Fragment,{children:[r.map(e=>(0,Q.jsxs)(`div`,{children:[r.length>1?(0,Q.jsx)(`p`,{className:`pt-3 pb-1 text-xs font-medium text-muted-foreground`,children:e.label}):null,(0,Q.jsx)(Gt,{environmentLabel:e.label,environmentId:e.environmentId,hosts:e.serverConfig?.settings.deviceHosts??[],busy:!i||a||f,checks:h,testConnection:async e=>{let t=await g(e);if(!t)return;let n=m.filter(e=>t[e.environmentId]?.status===`failed`);return q.add({type:n.length?`error`:`success`,title:n.length?`${e.label}: ${n.length} of ${m.length} environments failed`:`${e.label}: connection checks passed`,description:n.length?`Could not connect from ${n.map(e=>e.label).join(`, `)}.`:`Connected or already available locally on each selected environment.`}),t},onEdit:e=>{u(e),c(e)},onRemove:e=>void _(e,!0)})]},e.environmentId)),s?(0,Q.jsx)(Vt,{host:s,isNew:l===null,targets:m,busy:f,onSave:e=>void _(e,!1,l??e),onClose:()=>c(null)},s.id):null]}):(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect a selected environment to manage device hosts.`})})})}function Gt(e){let t=(0,Z.c)(28),{environmentLabel:n,environmentId:r,hosts:i,busy:a,onEdit:o,onRemove:c,checks:l,testConnection:u}=e,{state:d}=ze(r),p=Te(Be.list),[h,g]=(0,$.useState)(null),_;t[0]===i.length?_=t[1]:(_=i.length===0?(0,Q.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`No device hosts.`}):null,t[0]=i.length,t[1]=_);let v;if(t[2]!==a||t[3]!==l||t[4]!==r||t[5]!==n||t[6]!==i||t[7]!==o||t[8]!==c||t[9]!==p||t[10]!==h||t[11]!==d||t[12]!==u){let e;t[14]!==a||t[15]!==l||t[16]!==r||t[17]!==n||t[18]!==o||t[19]!==c||t[20]!==p||t[21]!==h||t[22]!==d||t[23]!==u?(e=e=>{let t=d.hostStatuses[e.id],i=l[Rt(e)]?.[r],_=(i?.status===`connected`?i.platforms:void 0)??d.hosts.find(t=>t.id===e.id)?.platforms??[],v=i?.status===`pending`?`Checking connection…`:t?.status===`installing`?`Installing device support…`:t?.status===`starting`?`Connecting…`:null,b=i?.status===`failed`?i.error:i?.status===`local`?void 0:t?.status===`failed`?t.detail:void 0;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/50 py-2.5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.label}),_.filter(qt).map(Kt)]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.target}),(0,Q.jsx)(jt,{owner:n,error:d.hosts.find(t=>t.id===e.id)?.toolInspectionError,tools:d.hosts.find(t=>t.id===e.id)?.tools??(i?.status===`connected`?i.tools:void 0)}),i?.status===`local`?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Already available locally`}):null,b?(0,Q.jsx)(`div`,{className:`mt-1`,role:`status`,children:(0,Q.jsxs)(`details`,{className:`text-xs text-destructive`,children:[(0,Q.jsx)(`summary`,{children:`Connection failed`}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words`,children:b})]})}):null]}),v?(0,Q.jsxs)(`span`,{role:`status`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(me,{size:`xs`}),v]}):null,(0,Q.jsxs)(f,{children:[(0,Q.jsx)(m,{render:(0,Q.jsx)(y,{size:`icon-sm`,variant:`ghost-muted`,disabled:a,"aria-label":e.label+` options`}),children:(0,Q.jsx)(s,{})}),(0,Q.jsxs)(x,{align:`end`,children:[(0,Q.jsx)(T,{onClick:()=>{o(e)},children:`Edit`}),(0,Q.jsx)(T,{variant:`destructive`,onClick:()=>c(e),children:`Remove`})]})]}),t?.status===`failed`&&d.supportsHostRetry&&d.hostStatus!==`disabled`?(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:a||h!==null,onClick:()=>{g(e.id),p({environmentId:r,input:{retryHostId:e.id}}).finally(()=>g(null))},children:h===e.id?`Retrying…`:`Retry`}):(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:a||v!==null,onClick:()=>void u(e),children:`Test connection`})]},e.id)},t[14]=a,t[15]=l,t[16]=r,t[17]=n,t[18]=o,t[19]=c,t[20]=p,t[21]=h,t[22]=d,t[23]=u,t[24]=e):e=t[24],v=i.map(e),t[2]=a,t[3]=l,t[4]=r,t[5]=n,t[6]=i,t[7]=o,t[8]=c,t[9]=p,t[10]=h,t[11]=d,t[12]=u,t[13]=v}else v=t[13];let b;return t[25]!==_||t[26]!==v?(b=(0,Q.jsxs)(Q.Fragment,{children:[_,v]}),t[25]=_,t[26]=v,t[27]=b):b=t[27],b}function Kt(e){return(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(`span`,{tabIndex:0,role:`img`,"aria-label":e.platform===`ios`?`iOS available`:`Android available`,className:`shrink-0 text-muted-foreground`}),children:e.platform===`ios`?(0,Q.jsx)($e,{className:`size-3.5 -translate-y-px`}):(0,Q.jsx)(et,{className:`size-3.5`})}),(0,Q.jsx)(Oe,{children:e.platform===`ios`?`iOS available`:`Android available`})]},e.platform)}function qt(e){return e.available}var Jt=V(B),Yt=e=>({kind:`eas`,id:e,label:`EAS Simulator`,accessToken:``,maxSessionMinutes:30,idleMinutes:10,maxConcurrentSessions:2});function Xt(e,t,n){return n?e.filter(e=>e.id!==t.id):e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?t:e):[...e,t]}function Zt(e){return`Up to ${e.maxConcurrentSessions===1?`1 session`:`${e.maxConcurrentSessions} sessions`} at once, each stopped after ${e.maxSessionMinutes} min or ${e.idleMinutes} idle min`}var Qt=`thread-project`,$t={settings:`the access token saved here`,env:`EXPO_TOKEN on the server`,"eas-login":`the server's eas login`},en=e=>{let t=I(e);return t instanceof Error?t.message:String(t)};function tn(e){let t=(0,Z.c)(24),{scope:n,connectedEnvironments:r}=pt(),i=Se(e.environmentId,H),a=n.kind===`project`||n.kind===`checkout`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={reportFailure:!1},t[0]=s):s=t[0];let c=Te(xe.updateSettings,s),l;t[1]===e.environmentId?l=t[2]:(l=t=>t.environmentId===e.environmentId,t[1]=e.environmentId,t[2]=l);let u=r.find(l)?.serverConfig?.settings.easDeviceHosts??[],[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(!1),g=!i||a||m||!e.environmentId,_=async(t,n)=>{if(!e.environmentId||!Ce(e.environmentId,`settings:write`))return;h(!0);let r=await c({environmentId:e.environmentId,input:{patch:{easDeviceHosts:Xt(u,t,n)}}});h(!1),r._tag===`Success`?p(null):q.add({type:`error`,title:n?`EAS host not removed`:`EAS host not saved`,description:en(r.cause)})},b=X,x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=[`easDeviceHosts`],t[3]=x):x=t[3];let S=g||f!==null,C;t[4]===p?C=t[5]:(C=()=>p({host:Yt(v()),isNew:!0}),t[4]=p,t[5]=C);let w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(d,{className:`size-3.5`}),t[6]=w):w=t[6];let T;t[7]!==S||t[8]!==C?(T=(0,Q.jsxs)(y,{size:`sm`,variant:`outline`,disabled:S,onClick:C,children:[w,` Add EAS host`]}),t[7]=S,t[8]=C,t[9]=T):T=t[9];let E=u.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No EAS hosts.`}):(0,Q.jsx)(`ul`,{className:`divide-y divide-border/40`,children:u.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2.5 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 truncate font-medium`,children:[(0,Q.jsx)(o,{className:`size-3.5 shrink-0`}),` `,e.label]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:Zt(e)})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,Q.jsx)(y,{size:`sm`,variant:`ghost`,disabled:g,onClick:()=>p({host:e,isNew:!1}),children:`Edit`}),(0,Q.jsx)(y,{size:`sm`,variant:`ghost-destructive`,disabled:g,onClick:()=>void _(e,!0),children:`Remove`})]})]},e.id))}),D;t[10]!==m||t[11]!==f||t[12]!==e.environmentId||t[13]!==_||t[14]!==p?(D=f&&e.environmentId?(0,Q.jsx)(nn,{environmentId:e.environmentId,host:f.host,isNew:f.isNew,busy:m,onSave:e=>void _(e,!1),onClose:()=>p(null)},f.host.id):null,t[10]=m,t[11]=f,t[12]=e.environmentId,t[13]=_,t[14]=p,t[15]=D):D=t[15];let O;t[16]!==E||t[17]!==D?(O=(0,Q.jsxs)(`div`,{className:`pt-3 pb-2`,children:[E,D]}),t[16]=E,t[17]=D,t[18]=O):O=t[18];let k;return t[19]!==b||t[20]!==T||t[21]!==O||t[22]!==x?(k=(0,Q.jsx)(b,{id:`eas-device-hosts`,title:`EAS Simulator`,serverScoped:!0,settingKeys:x,description:`Run iOS Simulators and Android emulators in Expo's cloud. Sessions bill the Expo account until they stop, so each host caps their number and length. Editing or removing a host stops them.`,control:T,children:O}),t[19]=b,t[20]=T,t[21]=O,t[22]=x,t[23]=k):k=t[23],k}function nn(e){let t=(0,Z.c)(135),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=Te(Be.easAccount,n),[i,a]=(0,$.useState)(e.host),o=(0,$.useId)(),s;t[1]===e.host.accessToken?s=t[2]:(s=e.host.accessToken?{kind:`saved`}:{kind:`cleared`},t[1]=e.host.accessToken,t[2]=s);let[c,l]=(0,$.useState)(s),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u={status:`checking`},t[3]=u):u=t[3];let[d,f]=(0,$.useState)(u),p,m;t[4]!==i||t[5]!==e.host.accessToken||t[6]!==c.kind||t[7]!==c.value?(p={...i,label:i.label.trim(),accessToken:c.kind===`saved`?e.host.accessToken:c.kind===`new`?c.value:``},m=D(Jt(p)),t[4]=i,t[5]=e.host.accessToken,t[6]=c.kind,t[7]=c.value,t[8]=p,t[9]=m):(p=t[8],m=t[9]);let h=m,g=h?null:i.maxSessionMinutes>0&&i.idleMinutes>=i.maxSessionMinutes?`Idle minutes must be smaller than session minutes.`:`Give the host a label and limits within the ranges shown.`,_;t[10]!==d.account||t[11]!==d.status?(_=d.status===`signed-in`?d.account.apps:[],t[10]=d.account,t[11]=d.status,t[12]=_):_=t[12];let v=_,x=(0,$.useRef)(0),S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>{x.current+=1,f({status:`idle`})},t[13]=S):S=t[13];let C=S,w;t[14]!==r||t[15]!==e.environmentId||t[16]!==e.host.id||t[17]!==e.isNew||t[18]!==c.kind||t[19]!==c.value?(w=async()=>{let t=x.current+=1,n=await r({environmentId:e.environmentId,input:{...c.kind===`saved`&&!e.isNew?{hostId:e.host.id}:{},...c.kind===`new`?{accessToken:c.value}:c.kind===`cleared`?{accessToken:``}:{}}});t===x.current&&f(n._tag===`Success`?{status:`signed-in`,account:n.value}:{status:`failed`,error:en(n.cause)})},t[14]=r,t[15]=e.environmentId,t[16]=e.host.id,t[17]=e.isNew,t[18]=c.kind,t[19]=c.value,t[20]=w):w=t[20];let T=w,E;t[21]===T?E=t[22]:(E=()=>{f({status:`checking`}),T()},t[21]=T,t[22]=E);let O=E,k;t[23]===T?k=t[24]:(k=()=>void T(),t[23]=T,t[24]=k);let A=(0,$.useEffectEvent)(k),j;t[25]===A?j=t[26]:(j=()=>{A()},t[25]=A,t[26]=j);let M;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(M=[],t[27]=M):M=t[27],(0,$.useEffect)(j,M);let N;t[28]!==i||t[29]!==e.busy?(N=(t,n,r)=>(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,Q.jsx)(`span`,{children:n}),(0,Q.jsx)(Ae,{type:`number`,min:1,max:r,value:i[t],disabled:e.busy,onChange:e=>{let n=Number(e.target.value);a(e=>({...e,[t]:n}))}})]}),t[28]=i,t[29]=e.busy,t[30]=N):N=t[30];let P=N,F;t[31]===e?F=t[32]:(F=t=>{!t&&!e.busy&&e.onClose()},t[31]=e,t[32]=F);let I=!e.busy,L;t[33]!==p||t[34]!==e||t[35]!==h?(L=t=>{t.preventDefault(),h&&!e.busy&&e.onSave(p)},t[33]=p,t[34]=e,t[35]=h,t[36]=L):L=t[36];let R=e.isNew?`Add EAS host`:`Edit EAS host`,z;t[37]===R?z=t[38]:(z=(0,Q.jsx)(Me,{children:R}),t[37]=R,t[38]=z);let B;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(Ie,{children:`The environment's server signs in to Expo and starts the sessions. Without a token here it uses EXPO_TOKEN, then its eas login.`}),t[39]=B):B=t[39];let V;t[40]===z?V=t[41]:(V=(0,Q.jsxs)(je,{children:[z,B]}),t[40]=z,t[41]=V);let ee;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(`span`,{children:`Name`}),t[42]=ee):ee=t[42];let H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{let t=e.target.value;a(e=>({...e,label:t}))},t[43]=H):H=t[43];let U;t[44]!==i.label||t[45]!==e.busy?(U=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[ee,(0,Q.jsx)(Ae,{autoFocus:!0,required:!0,value:i.label,disabled:e.busy,onChange:H})]}),t[44]=i.label,t[45]=e.busy,t[46]=U):U=t[46];let te;t[47]===o?te=t[48]:(te=(0,Q.jsx)(`label`,{htmlFor:o,className:`block`,children:`Expo access token`}),t[47]=o,t[48]=te);let ne=c.kind===`saved`,re=c.kind===`new`?c.value:``,ie;t[49]===e.host.accessToken?ie=t[50]:(ie=t=>{let n=t.target.value;l(n?{kind:`new`,value:n}:e.host.accessToken?{kind:`saved`}:{kind:`cleared`}),C()},t[49]=e.host.accessToken,t[50]=ie);let ae;t[51]!==e.busy||t[52]!==ne||t[53]!==re||t[54]!==ie||t[55]!==o?(ae=(0,Q.jsx)(Dt,{id:o,className:`min-w-0 flex-1`,configured:ne,value:re,disabled:e.busy,placeholder:`Optional`,onChange:ie}),t[51]=e.busy,t[52]=ne,t[53]=re,t[54]=ie,t[55]=o,t[56]=ae):ae=t[56];let oe;t[57]===c.kind?oe=t[58]:(oe=c.kind===`cleared`?null:(0,Q.jsx)(y,{type:`button`,size:`icon-sm`,variant:`ghost-destructive`,"aria-label":`Clear access token`,onClick:()=>{l({kind:`cleared`}),C()},children:(0,Q.jsx)(b,{className:`size-3.5`})}),t[57]=c.kind,t[58]=oe);let se;t[59]!==ae||t[60]!==oe?(se=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ae,oe]}),t[59]=ae,t[60]=oe,t[61]=se):se=t[61];let W;t[62]!==te||t[63]!==se?(W=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[te,se]}),t[62]=te,t[63]=se,t[64]=W):W=t[64];let ce=d.status===`signed-in`?`Signed in as ${d.account.signedInAs} with ${$t[d.account.credentialSource]}.`:d.status===`failed`?d.error:d.status===`checking`?`Checking the Expo account…`:`Check the Expo account before choosing a project.`,ue;t[65]===ce?ue=t[66]:(ue=(0,Q.jsx)(`p`,{role:`status`,className:`min-w-0 text-xs text-muted-foreground`,children:ce}),t[65]=ce,t[66]=ue);let de=e.busy||d.status===`checking`,q;t[67]===O?q=t[68]:(q=()=>void O(),t[67]=O,t[68]=q);let he;t[69]===d.status?he=t[70]:(he=d.status===`checking`?(0,Q.jsx)(me,{size:`xs`}):null,t[69]=d.status,t[70]=he);let ge;t[71]!==de||t[72]!==q||t[73]!==he?(ge=(0,Q.jsxs)(y,{type:`button`,size:`sm`,variant:`outline`,disabled:de,onClick:q,children:[he,` Check account`]}),t[71]=de,t[72]=q,t[73]=he,t[74]=ge):ge=t[74];let _e;t[75]!==ue||t[76]!==ge?(_e=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border/60 px-3 py-2.5`,children:[ue,ge]}),t[75]=ue,t[76]=ge,t[77]=_e):_e=t[77];let ve;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Q.jsx)(`span`,{children:`EAS project`}),t[78]=ve):ve=t[78];let ye=i.appId??Qt,be=e.busy,J;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(J=e=>{typeof e==`string`&&a(t=>{let{appId:n,...r}=t;return e===Qt?r:{...r,appId:e}})},t[79]=J):J=t[79];let Y;t[80]===v?Y=t[81]:(Y=(0,Q.jsx)(fe,{size:`sm`,"aria-label":`EAS project`,children:(0,Q.jsx)(le,{children:e=>e===Qt?`From the thread's project`:v.find(t=>t.id===e)?.fullName??e})}),t[80]=v,t[81]=Y);let xe;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Q.jsx)(G,{value:Qt,children:`From the thread's project`}),t[82]=xe):xe=t[82];let Se;t[83]!==v||t[84]!==i.appId?(Se=i.appId&&!v.some(e=>e.id===i.appId)?(0,Q.jsx)(G,{value:i.appId,children:i.appId}):null,t[83]=v,t[84]=i.appId,t[85]=Se):Se=t[85];let Ce;t[86]===v?Ce=t[87]:(Ce=v.map(rn),t[86]=v,t[87]=Ce);let we;t[88]!==Se||t[89]!==Ce?(we=(0,Q.jsxs)(K,{children:[xe,Se,Ce]}),t[88]=Se,t[89]=Ce,t[90]=we):we=t[90];let Ee;t[91]!==e.busy||t[92]!==ye||t[93]!==Y||t[94]!==we?(Ee=(0,Q.jsxs)(pe,{value:ye,disabled:be,onValueChange:J,children:[Y,we]}),t[91]=e.busy,t[92]=ye,t[93]=Y,t[94]=we,t[95]=Ee):Ee=t[95];let De;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Sessions bill the project's Expo account. "From the thread's project" reads extra.eas.projectId from the project's app config.`}),t[96]=De):De=t[96];let Oe;t[97]===Ee?Oe=t[98]:(Oe=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[ve,Ee,De]}),t[97]=Ee,t[98]=Oe);let ke;t[99]===P?ke=t[100]:(ke=(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 text-sm`,children:[P(`maxConcurrentSessions`,`Sessions at once`,20),P(`maxSessionMinutes`,`Session minutes`,115),P(`idleMinutes`,`Idle minutes`,60)]}),t[99]=P,t[100]=ke);let Pe=e.isNew?null:` Saving restarts this host, which stops its running sessions.`,ze;t[101]===Pe?ze=t[102]:(ze=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Expo allows sessions of up to 40 minutes on free accounts and 115 on paid ones, and ends one after the idle minutes without activity, so idle minutes must be smaller than session minutes.`,Pe]}),t[101]=Pe,t[102]=ze);let Ve;t[103]===g?Ve=t[104]:(Ve=g===null?null:(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,role:`alert`,children:g}),t[103]=g,t[104]=Ve);let He;t[105]!==U||t[106]!==W||t[107]!==_e||t[108]!==Oe||t[109]!==ke||t[110]!==ze||t[111]!==Ve?(He=(0,Q.jsxs)(Fe,{children:[U,W,_e,Oe,ke,ze,Ve]}),t[105]=U,t[106]=W,t[107]=_e,t[108]=Oe,t[109]=ke,t[110]=ze,t[111]=Ve,t[112]=He):He=t[112];let Ue;t[113]!==e.busy||t[114]!==e.onClose?(Ue=(0,Q.jsx)(y,{type:`button`,variant:`ghost`,disabled:e.busy,onClick:e.onClose,children:`Cancel`}),t[113]=e.busy,t[114]=e.onClose,t[115]=Ue):Ue=t[115];let We=e.busy||!h,Ge;t[116]===e.busy?Ge=t[117]:(Ge=e.busy?(0,Q.jsx)(me,{size:`xs`}):null,t[116]=e.busy,t[117]=Ge);let Ke;t[118]!==We||t[119]!==Ge?(Ke=(0,Q.jsxs)(y,{type:`submit`,disabled:We,children:[Ge,` Save host`]}),t[118]=We,t[119]=Ge,t[120]=Ke):Ke=t[120];let qe;t[121]!==Ue||t[122]!==Ke?(qe=(0,Q.jsxs)(Ne,{children:[Ue,Ke]}),t[121]=Ue,t[122]=Ke,t[123]=qe):qe=t[123];let Je;t[124]!==L||t[125]!==V||t[126]!==He||t[127]!==qe?(Je=(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-col`,onSubmit:L,children:[V,He,qe]}),t[124]=L,t[125]=V,t[126]=He,t[127]=qe,t[128]=Je):Je=t[128];let Ye;t[129]!==I||t[130]!==Je?(Ye=(0,Q.jsx)(Le,{showCloseButton:I,children:Je}),t[129]=I,t[130]=Je,t[131]=Ye):Ye=t[131];let Xe;return t[132]!==F||t[133]!==Ye?(Xe=(0,Q.jsx)(Re,{open:!0,onOpenChange:F,children:Ye}),t[132]=F,t[133]=Ye,t[134]=Xe):Xe=t[134],Xe}function rn(e){return(0,Q.jsx)(G,{value:e.id,children:e.fullName},e.id)}function an(e,t){if(e)return{kind:`new`};let n=t[0];return n?{kind:`existing`,profileId:n.id}:{kind:`new`}}function on(e,t,n){if(e.kind===`new`)return{kind:`new`,profileId:t};let r=n.find(t=>t.id===e.profileId);if(r!==void 0)return{kind:`existing`,profileId:e.profileId,name:r.name}}function sn(e){return e.step!==`importing`}function cn(e){return e.unavailable===`browserRunning`?{step:`quit`}:e.unavailable===`needsFullDiskAccess`?{step:`fullDiskAccess`,resume:`configure`}:e.unavailable===void 0?e.profiles.length===0?{step:`blocked`,reason:`unknownSourceProfile`}:{step:`configure`}:{step:`blocked`,reason:e.unavailable}}function ln(e){return e.kind===`imported`?{step:`done`,imported:e.imported,skipped:e.skipped,skippedDomains:e.skippedDomains,targetName:e.targetName}:e.reason===`browserRunning`?{step:`quit`}:e.reason===`needsFullDiskAccess`?{step:`fullDiskAccess`,resume:`import`,checked:!0}:{step:`blocked`,reason:e.reason}}function un(e){return e===void 0?{step:`blocked`,reason:`unknownSource`}:cn(e)}function dn(e){let t=un(e);return t.step===`fullDiskAccess`?{...t,checked:!0}:t}function fn(e,t){return t.profiles.some(t=>t.directory===e)?e:t.profiles[0]?.directory??``}function pn(e){switch(e){case`needsKeychainApproval`:case`keychainItemMissing`:case`keychainUnavailable`:case`readFailed`:case`sessionUnavailable`:case`profileNotSaved`:return!0;default:return!1}}function mn(e){return e.length===0?``:e.length===1?e[0]:e.length<=3?`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`:`${e.slice(0,3).join(`, `)} and ${e.length-3} more`}function hn(e){let t=(0,Z.c)(46),{source:n,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,onImport:o,onRefreshSource:s,onOpenFullDiskAccessSettings:c,onCheckFullDiskAccess:l,onClose:u}=e,[d,f]=(0,$.useState)(n),p;t[0]===n?p=t[1]:(p=()=>cn(n),t[0]=n,t[1]=p);let[m,h]=(0,$.useState)(p),g;t[2]===n.profiles[0]?.directory?g=t[3]:(g=()=>n.profiles[0]?.directory??``,t[2]=n.profiles[0]?.directory,t[3]=g);let[_,y]=(0,$.useState)(g),b;t[4]!==a||t[5]!==i?(b=()=>an(a,i),t[4]=a,t[5]=i,t[6]=b):b=t[6];let[x,S]=(0,$.useState)(b),[C,w]=(0,$.useState)(),T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=v(),t[7]=T):T=t[7];let E=(0,$.useRef)(`profile-${T}`),D=(0,$.useRef)(!1),O;t[8]!==o||t[9]!==_||t[10]!==x||t[11]!==i?(O=()=>{if(D.current)return;let e=on(x,E.current,i);e===void 0?(w(`That profile is no longer available. Choose where to import these cookies.`),h({step:`configure`})):(w(void 0),D.current=!0,h({step:`importing`}),o({sourceProfileDirectory:_,target:e}).then(e=>h(ln(e))).catch(()=>h({step:`blocked`,reason:`readFailed`})).finally(()=>{D.current=!1}))},t[8]=o,t[9]=_,t[10]=x,t[11]=i,t[12]=O):O=t[12];let k=O,A;t[13]===s?A=t[14]:(A=(e,t)=>{h({step:`checking`,check:e}),s().then(e=>{e&&(f(e),y(t=>fn(t,e))),h(t(e))}).catch(()=>h({step:`blocked`,reason:`readFailed`}))},t[13]=s,t[14]=A);let j=A,M;t[15]===j?M=t[16]:(M=()=>j(`browser`,un),t[15]=j,t[16]=M);let N=M,P;t[17]===j?P=t[18]:(P=()=>j(`fullDiskAccess`,dn),t[17]=j,t[18]=P);let F=P,I;t[19]!==u||t[20]!==m?(I=e=>e||!sn(m)?void 0:u(),t[19]=u,t[20]=m,t[21]=I):I=t[21];let L;t[22]===m?L=t[23]:(L=sn(m),t[22]=m,t[23]=L);let R;t[24]!==a||t[25]!==r||t[26]!==l||t[27]!==u||t[28]!==c||t[29]!==s||t[30]!==N||t[31]!==F||t[32]!==k||t[33]!==d||t[34]!==_||t[35]!==m||t[36]!==x||t[37]!==C||t[38]!==i?(R=m.step===`quit`?(0,Q.jsx)(gn,{source:d,onCancel:u,onRechecked:N}):m.step===`fullDiskAccess`?(0,Q.jsx)(yn,{source:d,onCancel:u,onOpenSettings:c,onCheck:l??(async()=>{let e=await s();return e!==void 0&&e.unavailable===void 0}),onGranted:m.resume===`import`?k:F,stillRequired:m.checked===!0}):m.step===`importing`?(0,Q.jsx)(Sn,{}):m.step===`checking`?(0,Q.jsx)(Cn,{sourceName:d.name,check:m.check}):m.step===`done`?(0,Q.jsx)(wn,{...m,destinationEnvironmentName:r,onClose:u}):m.step===`blocked`?(0,Q.jsx)(Tn,{source:d,reason:m.reason,onClose:u,onRetry:pn(m.reason)?k:void 0}):(0,Q.jsx)(bn,{source:d,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:_,onSourceProfileChange:y,target:x,onTargetChange:e=>{S(e),w(void 0)},targetError:C,onCancel:u,onImport:k}),t[24]=a,t[25]=r,t[26]=l,t[27]=u,t[28]=c,t[29]=s,t[30]=N,t[31]=F,t[32]=k,t[33]=d,t[34]=_,t[35]=m,t[36]=x,t[37]=C,t[38]=i,t[39]=R):R=t[39];let z;t[40]!==L||t[41]!==R?(z=(0,Q.jsx)(Le,{className:`max-w-lg`,showCloseButton:L,children:R}),t[40]=L,t[41]=R,t[42]=z):z=t[42];let B;return t[43]!==z||t[44]!==I?(B=(0,Q.jsx)(Re,{open:!0,onOpenChange:I,children:z}),t[43]=z,t[44]=I,t[45]=B):B=t[45],B}function gn(e){let t=(0,Z.c)(12),{source:n,onCancel:r,onRechecked:i}=e,a;t[0]===n.name?a=t[1]:(a=(0,Q.jsxs)(je,{children:[(0,Q.jsxs)(Me,{children:[`Quit `,n.name,` to import`]}),(0,Q.jsxs)(Ie,{children:[n.name,` is open, so its cookies can’t be read yet. Quit it, then continue.`]})]}),t[0]=n.name,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(y,{variant:`outline`,onClick:r,children:`Cancel`}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(y,{onClick:i,children:`I’ve quit it`}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(Ne,{children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function _n(e){if(e!==void 0)return e===0?`no cookies`:`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function vn(e){return`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function yn(e){let t=(0,Z.c)(43),{source:n,onCancel:r,onOpenSettings:i,onGranted:o,stillRequired:s,onCheck:c}=e,[l,u]=(0,$.useState)(!1),[d,f]=(0,$.useState)(null),p;t[0]===c?p=t[1]:(p=async()=>({fullDiskAccess:await c()}),t[0]=c,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m={fullDiskAccess:!1},t[2]=m):m=t[2];let h=At(p,m),g;t[3]!==i||t[4]!==l?(g=()=>{l||(u(!0),f(null),Promise.resolve().then(i).catch(()=>f(`Could not open System Settings. Try Allow again.`)).finally(()=>u(!1)))},t[3]=i,t[4]=l,t[5]=g):g=t[5];let _=g,v;t[6]===n.name?v=t[7]:(v=(0,Q.jsxs)(je,{children:[(0,Q.jsxs)(Me,{children:[`Let P4 Code read `,n.name,`’s cookies`]}),(0,Q.jsxs)(Ie,{children:[`To import cookies from `,n.name,`, P4 Code needs Full Disk Access. Turn it on in System Settings, then come back to finish the import — you can revoke it again once the import is done.`]})]}),t[6]=n.name,t[7]=v);let b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(a,{className:`size-8 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[8]=b):b=t[8];let x=`Read ${n.name}'s cookies for this import.`,S;t[9]===_?S=t[10]:(S=()=>void _(),t[9]=_,t[10]=S);let C;t[11]!==h.status.fullDiskAccess||t[12]!==x||t[13]!==S?(C=[{id:`fullDiskAccess`,icon:b,title:`Full Disk Access`,description:x,granted:h.status.fullDiskAccess,onAllow:S}],t[11]=h.status.fullDiskAccess,t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]!==l||t[16]!==C?(w=(0,Q.jsx)(Ot,{busy:l,permissions:C}),t[15]=l,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==d||t[19]!==h.error?(T=d||h.error?(0,Q.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:d??h.error}):null,t[18]=d,t[19]=h.error,t[20]=T):T=t[20];let E;t[21]!==h||t[22]!==s?(E=h.isReady([`fullDiskAccess`])?null:(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:s?`Access is still required. Quit and reopen P4 Code if you just allowed it, then retry the import.`:`If access doesn't update after you allow it, quit and reopen P4 Code, then retry the import.`}),t[21]=h,t[22]=s,t[23]=E):E=t[23];let D;t[24]!==T||t[25]!==E||t[26]!==w?(D=(0,Q.jsxs)(Fe,{children:[w,T,E]}),t[24]=T,t[25]=E,t[26]=w,t[27]=D):D=t[27];let O;t[28]===r?O=t[29]:(O=(0,Q.jsx)(y,{variant:`outline`,onClick:r,children:`Cancel`}),t[28]=r,t[29]=O);let k;t[30]===h?k=t[31]:(k=h.isReady([`fullDiskAccess`]),t[30]=h,t[31]=k);let A;t[32]!==o||t[33]!==l||t[34]!==k?(A=(0,Q.jsx)(kt,{ready:k,busy:l,onClick:o,children:`Continue`}),t[32]=o,t[33]=l,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==O||t[37]!==A?(j=(0,Q.jsxs)(Ne,{children:[O,A]}),t[36]=O,t[37]=A,t[38]=j):j=t[38];let M;return t[39]!==D||t[40]!==j||t[41]!==v?(M=(0,Q.jsxs)(Q.Fragment,{children:[v,D,j]}),t[39]=D,t[40]=j,t[41]=v,t[42]=M):M=t[42],M}function bn(e){let t=(0,Z.c)(59),{source:n,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:o,onSourceProfileChange:s,target:c,targetError:l,onTargetChange:u,onCancel:d,onImport:f}=e,p;t[0]!==c.kind||t[1]!==c.profileId||t[2]!==i?(p=c.kind===`existing`&&!i.some(e=>e.id===c.profileId),t[0]=c.kind,t[1]=c.profileId,t[2]=i,t[3]=p):p=t[3];let m=p,h=c.kind===`new`&&!a,_=l??(m?`That profile is no longer available. Choose where to import these cookies.`:h?`You've reached the profile limit. Choose an existing profile to import into.`:void 0),v;t[4]===n.name?v=t[5]:(v=(0,Q.jsxs)(Me,{children:[`Import from `,n.name]}),t[4]=n.name,t[5]=v);let b;t[6]===r?b=t[7]:(b=(0,Q.jsxs)(Ie,{children:[`Choose which cookies to import for `,r,`.`]}),t[6]=r,t[7]=b);let x;t[8]!==v||t[9]!==b?(x=(0,Q.jsxs)(je,{children:[v,b]}),t[8]=v,t[9]=b,t[10]=x):x=t[10];let C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`From`}),t[11]=C):C=t[11];let w;if(t[12]!==s||t[13]!==n.profiles||t[14]!==o){let e;t[16]!==s||t[17]!==o?(e=e=>(0,Q.jsx)(xn,{selected:o===e.directory,title:e.name,subtitle:_n(e.cookieCount),onSelect:()=>s(e.directory)},e.directory),t[16]=s,t[17]=o,t[18]=e):e=t[18],w=n.profiles.map(e),t[12]=s,t[13]=n.profiles,t[14]=o,t[15]=w}else w=t[15];let T;t[19]===w?T=t[20]:(T=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[C,w]}),t[19]=w,t[20]=T);let E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center text-muted-foreground`,children:[(0,Q.jsx)(g,{className:`size-4 sm:hidden`}),(0,Q.jsx)(S,{className:`hidden size-4 sm:block`})]}),t[21]=E):E=t[21];let D;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Into`}),t[22]=D):D=t[22];let O;t[23]!==a||t[24]!==u||t[25]!==c.kind?(O=a?(0,Q.jsx)(xn,{selected:c.kind===`new`,title:`New profile`,subtitle:`Created for these cookies`,onSelect:()=>u({kind:`new`})}):null,t[23]=a,t[24]=u,t[25]=c.kind,t[26]=O):O=t[26];let k;if(t[27]!==u||t[28]!==c.kind||t[29]!==c.profileId||t[30]!==i){let e;t[32]!==u||t[33]!==c.kind||t[34]!==c.profileId?(e=e=>(0,Q.jsx)(xn,{selected:c.kind===`existing`&&c.profileId===e.id,title:e.name,subtitle:`Existing profile`,onSelect:()=>u({kind:`existing`,profileId:e.id})},e.id),t[32]=u,t[33]=c.kind,t[34]=c.profileId,t[35]=e):e=t[35],k=i.map(e),t[27]=u,t[28]=c.kind,t[29]=c.profileId,t[30]=i,t[31]=k}else k=t[31];let A;t[36]!==O||t[37]!==k?(A=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[D,O,k]}),t[36]=O,t[37]=k,t[38]=A):A=t[38];let j;t[39]!==A||t[40]!==T?(j=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4`,children:[T,E,A]}),t[39]=A,t[40]=T,t[41]=j):j=t[41];let M;t[42]===_?M=t[43]:(M=_?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-destructive`,children:_}):null,t[42]=_,t[43]=M);let N;t[44]!==j||t[45]!==M?(N=(0,Q.jsxs)(Fe,{children:[j,M]}),t[44]=j,t[45]=M,t[46]=N):N=t[46];let P;t[47]===d?P=t[48]:(P=(0,Q.jsx)(y,{variant:`outline`,onClick:d,children:`Cancel`}),t[47]=d,t[48]=P);let F=o===``||m||h,I;t[49]!==f||t[50]!==F?(I=(0,Q.jsx)(y,{disabled:F,onClick:f,children:`Import`}),t[49]=f,t[50]=F,t[51]=I):I=t[51];let L;t[52]!==P||t[53]!==I?(L=(0,Q.jsxs)(Ne,{children:[P,I]}),t[52]=P,t[53]=I,t[54]=L):L=t[54];let R;return t[55]!==N||t[56]!==L||t[57]!==x?(R=(0,Q.jsxs)(Q.Fragment,{children:[x,N,L]}),t[55]=N,t[56]=L,t[57]=x,t[58]=R):R=t[58],R}function xn(e){let t=(0,Z.c)(22),{selected:n,title:r,subtitle:i,onSelect:a}=e,o=n?`border-primary bg-primary/8`:`border-border/60 hover:border-border hover:bg-muted/40`,s;t[0]===o?s=t[1]:(s=w(`flex w-full cursor-pointer items-center justify-between gap-3 rounded-lg border px-3 py-2 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,o),t[0]=o,t[1]=s);let l;t[2]===r?l=t[3]:(l=(0,Q.jsx)(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:r}),t[2]=r,t[3]=l);let u;t[4]===i?u=t[5]:(u=i?(0,Q.jsx)(`span`,{className:`block truncate text-xs tabular-nums text-muted-foreground`,children:i}):null,t[4]=i,t[5]=u);let d;t[6]!==l||t[7]!==u?(d=(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[l,u]}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f=n?`border-primary bg-primary text-primary-foreground`:`border-input`,p;t[9]===f?p=t[10]:(p=w(`grid size-4 shrink-0 place-items-center rounded-full border`,f),t[9]=f,t[10]=p);let m;t[11]===n?m=t[12]:(m=n?(0,Q.jsx)(c,{className:`size-2.5`}):null,t[11]=n,t[12]=m);let h;t[13]!==p||t[14]!==m?(h=(0,Q.jsx)(`span`,{className:p,children:m}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==a||t[17]!==n||t[18]!==s||t[19]!==d||t[20]!==h?(g=(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:a,className:s,children:[d,h]}),t[16]=a,t[17]=n,t[18]=s,t[19]=d,t[20]=h,t[21]=g):g=t[21],g}function Sn(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(je,{children:[(0,Q.jsx)(Me,{children:`Importing cookies`}),(0,Q.jsx)(Ie,{children:`This may take a moment.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[t,(0,Q.jsx)(Fe,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,Q.jsx)(me,{size:`md`,tone:`muted`}),(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Importing…`})]})})]}),e[1]=n):n=e[1],n}function Cn(e){let t=(0,Z.c)(13),{sourceName:n,check:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsxs)(Me,{children:[`Checking `,n]}),t[0]=n,t[1]=i);let a=r===`fullDiskAccess`?`Checking Full Disk Access.`:`Checking whether the browser has closed.`,o;t[2]===a?o=t[3]:(o=(0,Q.jsx)(Ie,{children:a}),t[2]=a,t[3]=o);let s;t[4]!==i||t[5]!==o?(s=(0,Q.jsxs)(je,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6];let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(me,{size:`md`,tone:`muted`}),t[7]=c):c=t[7];let l=r===`fullDiskAccess`?`Checking access…`:`Checking…`,u;t[8]===l?u=t[9]:(u=(0,Q.jsx)(Fe,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[c,(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:l})]})}),t[8]=l,t[9]=u);let d;return t[10]!==s||t[11]!==u?(d=(0,Q.jsxs)(Q.Fragment,{children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function wn(e){let t=(0,Z.c)(24),{imported:n,skipped:r,skippedDomains:i,targetName:a,destinationEnvironmentName:o,onClose:s}=e,c;t[0]!==n||t[1]!==r?(c=n>0?`Imported ${vn(n)}`:r>0?`Skipped ${vn(r)}`:`No cookies found`,t[0]=n,t[1]=r,t[2]=c):c=t[2];let l;t[3]===c?l=t[4]:(l=(0,Q.jsx)(Me,{children:c}),t[3]=c,t[4]=l);let u;t[5]!==o||t[6]!==n||t[7]!==r||t[8]!==a?(u=n>0?`Added to ${a} for ${o}.${r>0?` ${vn(r)} skipped.`:``}`:r>0?`No cookies were imported for ${o}.`:`There were no cookies to import for ${o}.`,t[5]=o,t[6]=n,t[7]=r,t[8]=a,t[9]=u):u=t[9];let d;t[10]===u?d=t[11]:(d=(0,Q.jsx)(Ie,{children:u}),t[10]=u,t[11]=d);let f;t[12]!==l||t[13]!==d?(f=(0,Q.jsxs)(je,{children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=i.length>0?(0,Q.jsxs)(Fe,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Skipped`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-foreground`,children:mn(i)})]}):null,t[15]=i,t[16]=p);let m;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(y,{}),t[17]=m):m=t[17];let h;t[18]===s?h=t[19]:(h=(0,Q.jsx)(Ne,{children:(0,Q.jsx)(Pe,{render:m,onClick:s,children:`Done`})}),t[18]=s,t[19]=h);let g;return t[20]!==f||t[21]!==p||t[22]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[f,p,h]}),t[20]=f,t[21]=p,t[22]=h,t[23]=g):g=t[23],g}function Tn(e){let t=(0,Z.c)(17),{source:n,reason:r,onClose:i,onRetry:a}=e,o;t[0]===n.name?o=t[1]:(o=(0,Q.jsxs)(Me,{children:[`Couldn’t import from `,n.name]}),t[0]=n.name,t[1]=o);let s=te[r],c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(Ie,{children:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c?(l=(0,Q.jsxs)(je,{children:[o,c]}),t[4]=o,t[5]=c,t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=(0,Q.jsx)(y,{variant:`outline`,onClick:i,children:`Close`}),t[7]=i,t[8]=u);let d;t[9]===a?d=t[10]:(d=a?(0,Q.jsx)(y,{onClick:a,children:`Try again`}):null,t[9]=a,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,Q.jsxs)(Ne,{children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==l||t[15]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[l,f]}),t[14]=l,t[15]=f,t[16]=p):p=t[16],p}var En=`fill`,Dn=`responsive`;async function On(e,t,n,r){let i=e===null?[]:t,a=r?.environmentIds??[];if(i.length===0&&a.length===0)throw Error(`Browser profile data is not available to clear.`);await Promise.all([...i.flatMap(t=>[e.clearCookies(t,n),e.clearCache(t,n)]),...a.map(e=>r.clear(e,n))])}function kn(e,t,n,r=0){return(e||r>0)&&t&&n>0}var An={width:1280,height:800},jn={useGrouping:!1},Mn={system:`System`,light:`Light`,dark:`Dark`},Nn=e=>`${Math.round(e*100)}%`,Pn=class extends Error{constructor(){super(`Browser profile limit reached.`),this.name=`ProfileLimitReachedError`}},Fn=e=>{let t=String(e?.message??``);return ie.literals.find(e=>t.includes(`failed: ${e}.`))??`readFailed`},In=e=>e._tag===`fill`?En:e._tag===`preset`&&bt.some(t=>t.id===e.presetId)?e.presetId:Dn,Ln=e=>{let t=In(e);return t===En?`Fill panel`:t===Dn?`Responsive`:bt.find(e=>e.id===t)?.label??`Responsive`},Rn=e=>Number.isInteger(e)&&e>=240&&e<=3840,zn=e=>({...e,width:e.height,height:e.width});function Bn(e){let t=(0,Z.c)(42),{disabled:n}=e,r=J(Hn),i=Y(),a=r._tag===`fill`?null:r,o=a?.width??An.width,s=a?.height??An.height,c;t[0]!==o||t[1]!==s?(c={width:o,height:s},t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]!==a?.height||t[4]!==a?.width||t[5]!==i?(u=e=>{if(e===En){i({browserDefaultViewport:P});return}if(e===Dn){i({browserDefaultViewport:{_tag:`freeform`,width:a?.width??An.width,height:a?.height??An.height}});return}let t=bt.find(t=>t.id===e);t&&i({browserDefaultViewport:{_tag:`preset`,width:t.width,height:t.height,presetId:t.id}})},t[3]=a?.height,t[4]=a?.width,t[5]=i,t[6]=u):u=t[6];let d=u,f;t[7]!==l||t[8]!==a||t[9]!==i?(f=(e,t)=>{if(t===null||!Rn(t))return;let n={...l,[e]:t};n.width*n.height>8294400||a&&n.width===a.width&&n.height===a.height||i({browserDefaultViewport:{_tag:`freeform`,...n}})},t[7]=l,t[8]=a,t[9]=i,t[10]=f):f=t[10];let p=f,m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=yt(`browser-default-viewport`),t[11]=m):m=t[11];let h;t[12]!==n||t[13]!==i||t[14]!==r._tag?(h=!n&&r._tag!==N._tag?(0,Q.jsx)(gt,{label:`default browser viewport`,onClick:()=>i({browserDefaultViewport:N})}):null,t[12]=n,t[13]=i,t[14]=r._tag,t[15]=h):h=t[15];let g;t[16]===r?g=t[17]:(g=In(r),t[16]=r,t[17]=g);let _;t[18]===r?_=t[19]:(_=Ln(r),t[18]=r,t[19]=_);let v;t[20]===_?v=t[21]:(v=(0,Q.jsx)(fe,{size:`sm`,className:`w-full min-w-0 sm:w-44`,"aria-label":`Default browser viewport`,children:(0,Q.jsx)(le,{children:_})}),t[20]=_,t[21]=v);let b,x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(G,{value:En,children:`Fill panel`}),x=(0,Q.jsx)(G,{value:Dn,children:`Responsive`}),t[22]=b,t[23]=x):(b=t[22],x=t[23]);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(K,{align:`end`,alignItemWithTrigger:!1,children:[b,x,(0,Q.jsxs)(de,{children:[(0,Q.jsx)(ue,{children:`Standard`}),bt.map(Vn)]})]}),t[24]=S):S=t[24];let C;t[25]!==n||t[26]!==d||t[27]!==v||t[28]!==g?(C=(0,Q.jsxs)(pe,{value:g,onValueChange:d,disabled:n,children:[v,S]}),t[25]=n,t[26]=d,t[27]=v,t[28]=g,t[29]=C):C=t[29];let w;t[30]!==p||t[31]!==n||t[32]!==l||t[33]!==a||t[34]!==i?(w=a?(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(ce,{value:l.width,min:240,max:O,disabled:n,format:jn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`width`,e),children:(0,Q.jsx)(W,{children:(0,Q.jsx)(se,{"aria-label":`Default viewport width`})})}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`×`}),(0,Q.jsx)(ce,{value:l.height,min:240,max:O,disabled:n,format:jn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`height`,e),children:(0,Q.jsx)(W,{children:(0,Q.jsx)(se,{"aria-label":`Default viewport height`})})}),(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(y,{size:`icon-sm`,variant:`ghost-muted`,disabled:n,"aria-label":`Rotate to ${l.height>=l.width?`landscape`:`portrait`}`,onClick:()=>i({browserDefaultViewport:zn(a)}),children:(0,Q.jsx)(vt,{})})}),(0,Q.jsx)(Oe,{side:`top`,children:`Rotate`})]})]}):null,t[30]=p,t[31]=n,t[32]=l,t[33]=a,t[34]=i,t[35]=w):w=t[35];let T;t[36]!==C||t[37]!==w?(T=(0,Q.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-end gap-2 sm:w-auto`,children:[C,w]}),t[36]=C,t[37]=w,t[38]=T):T=t[38];let E;return t[39]!==T||t[40]!==h?(E=(0,Q.jsx)(X,{...m,description:`Tab size for you and agents. Fill fits the panel; other sizes show the device toolbar.`,resetAction:h,control:T}),t[39]=T,t[40]=h,t[41]=E):E=t[41],E}function Vn(e){return(0,Q.jsx)(G,{value:e.id,children:(0,Q.jsxs)(`span`,{className:`flex w-full items-center justify-between gap-5`,children:[(0,Q.jsx)(`span`,{children:e.label}),(0,Q.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:e.detail})]})},e.id)}function Hn(e){return e.browserDefaultViewport}function Un(e){let t=(0,Z.c)(20),{disabled:n}=e,r=J(Gn),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-default-zoom`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==i||t[3]!==r?(o=!n&&r!==1?(0,Q.jsx)(gt,{label:`default browser zoom`,onClick:()=>i({browserDefaultZoomFactor:1})}):null,t[1]=n,t[2]=i,t[3]=r,t[4]=o):o=t[4];let s=String(r),c;t[5]===i?c=t[6]:(c=e=>{let t=L.find(t=>String(t)===e);t!==void 0&&i({browserDefaultZoomFactor:t})},t[5]=i,t[6]=c);let l;t[7]===r?l=t[8]:(l=Nn(r),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser zoom`,children:(0,Q.jsx)(le,{children:l})}),t[9]=l,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:L.map(Wn)}),t[11]=d):d=t[11];let f;t[12]!==n||t[13]!==s||t[14]!==c||t[15]!==u?(f=(0,Q.jsxs)(pe,{disabled:n,value:s,onValueChange:c,children:[u,d]}),t[12]=n,t[13]=s,t[14]=c,t[15]=u,t[16]=f):f=t[16];let p;return t[17]!==o||t[18]!==f?(p=(0,Q.jsx)(X,{...a,description:`Page zoom applied to new browser tabs.`,resetAction:o,control:f}),t[17]=o,t[18]=f,t[19]=p):p=t[19],p}function Wn(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:String(e),children:Nn(e)},e)}function Gn(e){return e.browserDefaultZoomFactor}function Kn(e){let t=(0,Z.c)(18),{disabled:n}=e,r=J(Jn),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-default-appearance`),t[0]=a):a=t[0];let o;t[1]!==r||t[2]!==n||t[3]!==i?(o=!n&&r!==`system`?(0,Q.jsx)(gt,{label:`default browser appearance`,onClick:()=>i({browserDefaultAppearance:j})}):null,t[1]=r,t[2]=n,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>{(e===`system`||e===`light`||e===`dark`)&&i({browserDefaultAppearance:e})},t[5]=i,t[6]=s);let c=Mn[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser appearance`,children:(0,Q.jsx)(le,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:Object.entries(Mn).map(qn)}),t[9]=u):u=t[9];let d;t[10]!==r||t[11]!==n||t[12]!==s||t[13]!==l?(d=(0,Q.jsxs)(pe,{disabled:n,value:r,onValueChange:s,children:[l,u]}),t[10]=r,t[11]=n,t[12]=s,t[13]=l,t[14]=d):d=t[14];let f;return t[15]!==o||t[16]!==d?(f=(0,Q.jsx)(X,{...a,description:`The color scheme pages are told to prefer. System follows your OS setting.`,resetAction:o,control:d}),t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function qn(e){let[t,n]=e;return(0,Q.jsx)(G,{hideIndicator:!0,value:t,children:n},t)}function Jn(e){return e.browserDefaultAppearance}function Yn(e){let t=(0,Z.c)(17),{disabled:n}=e,r=J(Zn),i=J(Xn),a=Y(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=yt(`browser-recording-key-presses`),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=e=>a({browserRecordingShowKeyPresses:!!e}),t[1]=a,t[2]=s);let c;t[3]!==n||t[4]!==r||t[5]!==s?(c=(0,Q.jsx)(X,{...o,description:`Show pressed keys and shortcuts in new recordings. Password fields are excluded.`,control:(0,Q.jsx)(xt,{disabled:n,checked:r,"aria-label":`Show key presses in recordings`,onCheckedChange:s})}),t[3]=n,t[4]=r,t[5]=s,t[6]=c):c=t[6];let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=yt(`browser-recording-mouse-presses`),t[7]=l):l=t[7];let u;t[8]===a?u=t[9]:(u=e=>a({browserRecordingShowMousePresses:!!e}),t[8]=a,t[9]=u);let d;t[10]!==n||t[11]!==i||t[12]!==u?(d=(0,Q.jsx)(X,{...l,description:`Highlight mouse presses and held buttons in new recordings.`,control:(0,Q.jsx)(xt,{disabled:n,checked:i,"aria-label":`Show mouse presses in recordings`,onCheckedChange:u})}),t[10]=n,t[11]=i,t[12]=u,t[13]=d):d=t[13];let f;return t[14]!==c||t[15]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[c,d]}),t[14]=c,t[15]=d,t[16]=f):f=t[16],f}function Xn(e){return e.browserRecordingShowMousePresses}function Zn(e){return e.browserRecordingShowKeyPresses}function Qn(e){let t=(0,Z.c)(18),{disabled:n}=e,r=J(er),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-recording-frame-rate`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==r||t[3]!==i?(o=!n&&r!==30?(0,Q.jsx)(gt,{label:`browser recording frame rate`,onClick:()=>i({browserRecordingFrameRate:30})}):null,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s=String(r),c;t[5]===i?c=t[6]:(c=e=>{let t=F.find(t=>String(t)===e);t!==void 0&&i({browserRecordingFrameRate:t})},t[5]=i,t[6]=c);let l;t[7]===r?l=t[8]:(l=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Browser recording frame rate`,children:(0,Q.jsxs)(le,{children:[r,` fps`]})}),t[7]=r,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:F.map($n)}),t[9]=u):u=t[9];let d;t[10]!==n||t[11]!==s||t[12]!==c||t[13]!==l?(d=(0,Q.jsxs)(pe,{disabled:n,value:s,onValueChange:c,children:[l,u]}),t[10]=n,t[11]=s,t[12]=c,t[13]=l,t[14]=d):d=t[14];let f;return t[15]!==o||t[16]!==d?(f=(0,Q.jsx)(X,{...a,description:`Maximum recording rate. 30 fps saves CPU and storage; 60 fps is smoother.`,resetAction:o,control:d}),t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function $n(e){return(0,Q.jsxs)(G,{hideIndicator:!0,value:String(e),children:[e,` fps`]},e)}function er(e){return e.browserRecordingFrameRate}var tr={system:`Your default browser`,app:`P4 Code`};function nr(e){let t=(0,Z.c)(19),{disabled:n}=e,r=J(ir),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-link-target`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==r||t[3]!==i?(o=!n&&r!==`system`?(0,Q.jsx)(gt,{label:`link target`,onClick:()=>i({browserLinkTarget:ee})}):null,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>{(e===`system`||e===`app`)&&i({browserLinkTarget:e})},t[5]=i,t[6]=s);let c=tr[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Open links in`,children:(0,Q.jsx)(le,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.keys(tr),t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:u.map(rr)}),t[10]=d):d=t[10];let f;t[11]!==n||t[12]!==r||t[13]!==s||t[14]!==l?(f=(0,Q.jsxs)(pe,{disabled:n,value:r,onValueChange:s,children:[l,d]}),t[11]=n,t[12]=r,t[13]=s,t[14]=l,t[15]=f):f=t[15];let p;return t[16]!==o||t[17]!==f?(p=(0,Q.jsx)(X,{...a,description:`Where links in the chat and terminal open. Hold ⌘ or Ctrl while clicking a link to open it in your default browser either way.`,resetAction:o,control:f}),t[16]=o,t[17]=f,t[18]=p):p=t[18],p}function rr(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:e,children:tr[e]},e)}function ir(e){return e.browserLinkTarget}var ar={duckduckgo:`DuckDuckGo`,google:`Google`,bing:`Bing`,brave:`Brave Search`,kagi:`Kagi`,ecosia:`Ecosia`,custom:`Custom`};function or(){let e=(0,Z.c)(24),t=J(lr),n=J(cr),r=Y(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=yt(`browser-search-engine`),e[0]=i):i=e[0];let a;e[1]!==n||e[2]!==t||e[3]!==r?(a=t!==`duckduckgo`||n!==``?(0,Q.jsx)(gt,{label:`search engine`,onClick:()=>r({browserSearchEngine:M,browserCustomSearchUrl:``})}):null,e[1]=n,e[2]=t,e[3]=r,e[4]=a):a=e[4];let o;e[5]===r?o=e[6]:(o=e=>{let t=ne.literals.find(t=>t===e);t!==void 0&&r({browserSearchEngine:t})},e[5]=r,e[6]=o);let s=ar[t],c;e[7]===s?c=e[8]:(c=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Search engine`,children:(0,Q.jsx)(le,{children:s})}),e[7]=s,e[8]=c);let l;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:ne.literals.map(sr)}),e[9]=l):l=e[9];let u;e[10]!==t||e[11]!==o||e[12]!==c?(u=(0,Q.jsxs)(pe,{value:t,onValueChange:o,children:[c,l]}),e[10]=t,e[11]=o,e[12]=c,e[13]=u):u=e[13];let d;e[14]!==a||e[15]!==u?(d=(0,Q.jsx)(X,{...i,description:`What the address bar searches when you type something that isn't a URL.`,resetAction:a,control:u}),e[14]=a,e[15]=u,e[16]=d):d=e[16];let f;e[17]!==n||e[18]!==t||e[19]!==r?(f=t===`custom`?(0,Q.jsx)(X,{title:`Custom search URL`,description:`Use %s where the search terms go.`,status:nt(n)?void 0:`Enter an http or https URL containing %s. Searches use DuckDuckGo until then.`,control:(0,Q.jsx)(Tt,{nativeInput:!0,size:`sm`,className:`w-full sm:w-64`,"aria-label":`Custom search URL`,placeholder:`https://example.com/search?q=%s`,autoCapitalize:`none`,spellCheck:!1,maxLength:re,value:n,onCommit:e=>r({browserCustomSearchUrl:e.trim()})})}):null,e[17]=n,e[18]=t,e[19]=r,e[20]=f):f=e[20];let p;return e[21]!==d||e[22]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[d,f]}),e[21]=d,e[22]=f,e[23]=p):p=e[23],p}function sr(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:e,children:ar[e]},e)}function cr(e){return e.browserCustomSearchUrl}function lr(e){return e.browserSearchEngine}function ur(){let e=(0,Z.c)(12),t=J(dr),n=Y(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=yt(`pull-request-links-open-in-app`),e[0]=r):r=e[0];let i;e[1]!==t||e[2]!==n?(i=t?null:(0,Q.jsx)(gt,{label:`open pull requests in P4 Code`,onClick:()=>n({pullRequestLinksOpenInApp:!0})}),e[1]=t,e[2]=n,e[3]=i):i=e[3];let a;e[4]===n?a=e[5]:(a=e=>n({pullRequestLinksOpenInApp:!!e}),e[4]=n,e[5]=a);let o;e[6]!==t||e[7]!==a?(o=(0,Q.jsx)(xt,{checked:t,onCheckedChange:a,"aria-label":`Open pull requests in P4 Code`}),e[6]=t,e[7]=a,e[8]=o):o=e[8];let s;return e[9]!==i||e[10]!==o?(s=(0,Q.jsx)(X,{...r,description:`Clicking a pull request link opens it in P4 Code. Turn off to open pull request links like any other link, on GitHub or your git host.`,resetAction:i,control:o}),e[9]=i,e[10]=o,e[11]=s):s=e[11],s}function dr(e){return e.pullRequestLinksOpenInApp}function fr(){let e=(0,Z.c)(7),{search:t,environment:n}=pt(),r=ft(),i=n?.connection.phase===`connected`&&n.serverConfig!==null?n.environmentId:null,a;e[0]===t?a=e[1]:(a=JSON.stringify(t),e[0]=t,e[1]=a);let o=`${i}:${a}`,s;return e[2]!==i||e[3]!==r.enableAgentDeviceAccess||e[4]!==r.enableDeviceSupport||e[5]!==o?(s=(0,Q.jsx)(_t,{id:`devices`,title:`Devices`,children:(0,Q.jsx)(pr,{environmentId:i,enabled:r.enableDeviceSupport,agentAccessEnabled:r.enableAgentDeviceAccess},o)}),e[2]=i,e[3]=r.enableAgentDeviceAccess,e[4]=r.enableDeviceSupport,e[5]=o,e[6]=s):s=e[6],s}function pr({environmentId:e,enabled:t,agentAccessEnabled:n}){let r=Se(e,H),{state:i,loaded:a}=ze(e),{scope:o,environments:s,connectedEnvironments:c}=pt(),l=ut(),u=o.kind===`project`||o.kind===`checkout`,d=c.some(e=>e.serverConfig?.settings.enableDeviceSupport),f=Te(Be.configure,{reportFailure:!1}),p=Te(Be.list,{reportFailure:!1}),[m,h]=(0,$.useState)(null),g=i.hostStatus===`installing`||i.hostStatus===`starting`,v=i.hosts.some(e=>e.kind===`local`&&!e.platforms.some(e=>e.available)),[b,x]=(0,$.useState)(!1);b&&!t&&x(!1),t&&!b&&(i.hostStatus===`ready`||v)&&m!==`hub`&&x(!0);let S=async(t,n)=>{if(e&&Ce(e,`settings:write`)){h(t);try{let e=await Promise.allSettled(s.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!Ce(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return f({environmentId:e.environmentId,input:{...n,...n.enabled?{onboardingCompleted:!0}:{}}})})),t=s.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});t.length>0&&q.add({type:`error`,title:`Device settings not saved on all environments`,description:`Could not update ${t.map(e=>e.label).join(`, `)}.`})}finally{h(null)}}},[C,w]=(0,$.useState)(null),T=i.hosts.find(e=>e.kind===`local`)?.tools,E=e=>{let t=T?.[e];return i.supportsToolUpdate&&t?!t.installedVersions.includes(t.requiredVersion):!1},D=(t,n=!1)=>{e&&(w(null),h(`update-${t}`),p({environmentId:e,input:{updateTool:t}}).then(e=>{if(e._tag===`Failure`){let r=we(e.cause);w({tool:t,message:r}),n&&q.add({type:`error`,title:r})}}).finally(()=>h(null)))},O=t=>{e&&(h(t),p({environmentId:e,input:{inspectOnly:!0}}).finally(()=>h(null)))},k=t=>{let n=E(t);if(!n&&!i.supportsToolInspection)return null;let r=m===`update-${t}`||m===`check-${t}`,a=n?`Update to v${T?.[t].requiredVersion}`:`Check ${t===`hub`?`device hub`:`agent device`} version`;return(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(y,{size:`icon-xs`,variant:`ghost-muted`,disabled:!e||m!==null||g,"aria-label":a,onClick:()=>n?D(t,!0):O(`check-${t}`)}),children:(0,Q.jsxs)(`span`,{className:`grid *:col-start-1 *:row-start-1 *:transition-[opacity,scale] *:duration-150 *:ease-out motion-reduce:*:transition-none`,children:[(0,Q.jsx)(`span`,{className:n&&!r?void 0:`scale-75 opacity-0`,children:(0,Q.jsx)(_,{"aria-hidden":!0})}),(0,Q.jsx)(`span`,{className:n&&!r?`scale-75 opacity-0`:void 0,children:(0,Q.jsx)(Ct,{refreshing:r})})]})}),(0,Q.jsx)(Oe,{side:`top`,children:a})]})},A=t=>{let n=T?.[t];return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&E(t)?(0,Q.jsx)(y,{size:`sm`,disabled:!e||m!==null||g,onClick:()=>D(t),children:m===`update-${t}`?`Updating…`:`Update`}):null,i.supportsToolInspection?(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:!e||m!==null||g,onClick:()=>O(`check`),children:m===`check`?`Checking…`:`Check versions`}):null]}),C?.tool===t?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:C.message}):null]})};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{...yt(`device-hub`),serverScoped:!0,settingKeys:[`enableDeviceSupport`],description:Ge,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(jt,{action:A(`hub`),kind:`hub`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),k(`hub`),m===`hub`?(0,Q.jsx)(We,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(Et,{settingKeys:[`enableDeviceSupport`],checked:t,disabled:!r||u||!a||!e||g||m!==null,"aria-label":`Device hub`,onCheckedChange:e=>void S(`hub`,{enabled:!!e,...e?{}:{agentAccessEnabled:!1}})})]})}),(0,Q.jsx)(Qe,{children:b?(0,Q.jsx)(X,{...yt(`device-platform-support`),description:c.length>1?`Status for ${c.find(t=>t.environmentId===e)?.label}. Select an environment to inspect its simulator support.`:void 0,status:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2`,children:[(0,Q.jsx)(Ue,{compact:!0,platform:`iOS`,status:qe(i,`ios`)}),(0,Q.jsx)(Ue,{compact:!0,platform:`Android`,status:qe(i,`android`)})]}),control:(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:!e||!t||g||m!==null,onClick:()=>{e&&(h(`check`),p({environmentId:e,input:{}}).finally(()=>h(null)))},children:m===`check`?`Checking…`:`Refresh`})}):null}),(0,Q.jsx)(X,{...yt(`agent-device-access`),serverScoped:!0,settingKeys:[`enableAgentDeviceAccess`],description:Ve,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(jt,{action:A(`agent`),kind:`agent`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),k(`agent`),m===`agent`?(0,Q.jsx)(Ke,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(Et,{settingKeys:[`enableAgentDeviceAccess`],checked:n,disabled:!r||c.length===0||!u&&(!a||!d||g)||m!==null,"aria-label":`Agent device access`,onCheckedChange:e=>u?l({enableAgentDeviceAccess:!!e}):void S(`agent`,{agentAccessEnabled:!!e})})]})}),e?(0,Q.jsx)(He,{state:{...i,hosts:i.hosts.filter(e=>e.kind===`local`)},environmentId:e}):null,(0,Q.jsx)(Wt,{environmentId:e}),i.supportsEasHosts?(0,Q.jsx)(tn,{environmentId:e}):null]})}function mr(e){let t=(0,Z.c)(14),{disabled:n}=e,r=J(hr),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-auto-show-floating-preview`),t[0]=a):a=t[0];let o;t[1]!==r||t[2]!==n||t[3]!==i?(o=!n&&r!==!0?(0,Q.jsx)(gt,{label:`auto-show floating preview`,onClick:()=>i({browserAutoShowFloatingPreview:!0})}):null,t[1]=r,t[2]=n,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>i({browserAutoShowFloatingPreview:!!e}),t[5]=i,t[6]=s);let c;t[7]!==r||t[8]!==n||t[9]!==s?(c=(0,Q.jsx)(xt,{disabled:n,checked:r,onCheckedChange:s,"aria-label":`Auto-show floating preview`}),t[7]=r,t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;return t[11]!==o||t[12]!==c?(l=(0,Q.jsx)(X,{...a,description:`Show the floating preview when an agent opens a browser or device unless the agent says otherwise.`,resetAction:o,control:c}),t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function hr(e){return e.browserAutoShowFloatingPreview}function gr({disabled:e}){let t=J(e=>e.browserProfiles),n=J(e=>e.browserDefaultProfileId),r=ve(),a=Y(),{environments:o,isReady:c}=he(),l=_e(),[h,g]=(0,$.useState)(null),[_,b]=(0,$.useState)(null),[S,E]=(0,$.useState)(null),[D,O]=(0,$.useState)(null),[j,M]=(0,$.useState)(null),[N,P]=(0,$.useState)(!1),F=oe(),I=Te(tt.clearProfile,{reportFailure:!1}),L={environmentIds:o.map(e=>e.environmentId).filter(e=>F.get(e)?.environment.capabilities.serverBrowser===!0),clear:async(e,t)=>{let n=await I({environmentId:e,input:{profileId:t}});if(n._tag===`Failure`)throw ae(n)}},B=kn(St!==null,c,o.length,L.environmentIds.length),V=(0,$.useRef)(!1),[ee,H]=(0,$.useState)(!1),U=e||!r,te=R(t).filter(e=>e.kind!==`incognito`),ne=k(te,n)?.id??`default`,re=e=>{if(!r||V.current)return;let t=be().browserProfiles;if(t.length>=24)return;let n=R(t),i=new Set(n.map(e=>e.name)),o=e;for(let t=2;i.has(o);t+=1)o=`${e} ${t}`;let s={id:`profile-${v()}`,name:o,kind:`persistent`};return a({browserProfiles:[...t,s]}),s},ie=(e,t)=>{if(!r||V.current)return;let n=t.trim().slice(0,48);if(n===``)return;let i=be().browserProfiles;a({browserProfiles:i.map(t=>t.id===e?{...t,name:n}:t)})},se=(e,t)=>{r&&!V.current&&(B?On(St,o.map(e=>e.environmentId),e,L).then(()=>{q.add({type:`success`,title:`Cleared ${t}'s cookies and cache`})}).catch(()=>{q.add({type:`error`,title:`Could not clear ${t}'s data`})}):q.add({type:`error`,title:`Could not clear ${t}'s data`,description:`You're not connected to a server yet.`}))},W=async e=>{if(!r||V.current)return;if(!B){M(`Connect to an environment before removing this profile.`);return}M(null),P(!0);try{await On(St,c?o.map(e=>e.environmentId):[],e,L)}catch{M(`Profile data could not be deleted. Try again.`),P(!1);return}let t=be();a({browserProfiles:t.browserProfiles.filter(t=>t.id!==e),...t.browserDefaultProfileId===e?{browserDefaultProfileId:A}:{}}),P(!1),E(null)},ce=(h??[]).filter(e=>e.unavailable!==`notInstalled`&&e.unavailable!==`unsupportedPlatform`),G=(0,$.useCallback)(()=>{St&&St.listBrowserImportSources().then(g).catch(()=>g(e=>e??[]))},[]),le=async(e,t,n)=>{if(!St||!r)return{kind:`blocked`,reason:`sessionUnavailable`};if(n.target.kind===`existing`&&!R(be().browserProfiles).some(e=>e.id===n.target.profileId)||V.current)return{kind:`blocked`,reason:`readFailed`};V.current=!0,H(!0);try{let r=await St.importBrowserCookies({environmentId:t,sourceId:e.id,sourceProfileDirectory:n.sourceProfileDirectory,targetProfileId:n.target.profileId});if(n.target.kind===`existing`&&!R(be().browserProfiles).some(e=>e.id===n.target.profileId))return{kind:`blocked`,reason:`readFailed`};let i;if(n.target.kind===`new`){if(r.imported>0)try{i=(await ye(t=>{if(t.browserProfiles.find(e=>e.id===n.target.profileId))return t;if(t.browserProfiles.length>=24)throw new Pn;let r=new Set(R(t.browserProfiles).map(e=>e.name)),i=e.name;for(let t=2;r.has(i);t+=1)i=`${e.name} ${t}`;return{...t,browserProfiles:[...t.browserProfiles,{id:n.target.profileId,name:i,kind:`persistent`}]}})).browserProfiles.find(e=>e.id===n.target.profileId)?.name??e.name}catch(r){await On(St,[t],n.target.profileId).catch(()=>void 0);let i=r instanceof Pn?`profileLimitReached`:`profileNotSaved`;throw Error(`Importing cookies from ${e.id} failed: ${i}.`,{cause:r})}else i=e.name}else i=n.target.name;return{kind:`imported`,imported:r.imported,skipped:r.skipped,skippedDomains:r.skippedDomains,targetName:i}}catch(e){return{kind:`blocked`,reason:Fn(e)}}finally{V.current=!1,H(!1)}},ue=async e=>{if(St)try{let t=await St.listBrowserImportSources();return g(t),t.find(t=>t.id===e)}catch{return}},K=t.length>=24;return(0,Q.jsxs)(X,{...yt(`browser-profiles`),description:`Profiles separate cookies and logins. Incognito data is cleared when the app closes.`,control:(0,Q.jsxs)(f,{onOpenChange:e=>e&&G(),children:[(0,Q.jsxs)(m,{render:(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:U||ee}),children:[(0,Q.jsx)(d,{}),`Add profile`]}),(0,Q.jsxs)(x,{align:`end`,children:[(0,Q.jsx)(T,{disabled:!r||K,onClick:()=>re(`New profile`),children:`Blank profile`}),K?(0,Q.jsx)(T,{disabled:!0,children:`You’ve reached the profile limit`}):null,(0,Q.jsx)(C,{}),(0,Q.jsxs)(i,{children:[(0,Q.jsx)(p,{children:`Import from`}),h===null?(0,Q.jsx)(T,{disabled:!0,children:`Looking for browsers…`}):ce.length===0?(0,Q.jsx)(T,{disabled:!0,children:`No supported browsers found`}):(0,Q.jsxs)(Q.Fragment,{children:[ce.map(e=>(0,Q.jsx)(T,{disabled:!r||l==null,onClick:()=>{r&&l!=null&&b({source:e,environmentId:l.environmentId,environmentName:dt({isPrimary:!0,environmentId:l.environmentId,runtimeLabel:l.label})})},children:e.name},e.id)),l==null?(0,Q.jsx)(T,{disabled:!0,children:`Connect to an environment to import cookies`}):null]})]})]})]}),children:[(0,Q.jsx)(`div`,{className:`mt-2 mb-2 overflow-hidden rounded-lg border border-border/60`,children:te.map((e,t)=>{let n=z(e.id),i=e.id===ne;return(0,Q.jsxs)(`div`,{className:w(`flex items-center gap-3 px-3 py-2`,t>0&&`border-t border-border/60`),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[n?(0,Q.jsx)(`span`,{className:w(`truncate text-sm text-foreground`,U&&`opacity-64`),children:e.name}):(0,Q.jsx)(Tt,{nativeInput:!0,size:`sm`,className:`w-full max-w-56`,"aria-label":`Rename ${e.name}`,disabled:U||ee,maxLength:48,value:e.name,onCommit:t=>ie(e.id,t)}),i?(0,Q.jsx)(`span`,{className:w(`flex`,U&&`opacity-64`),children:(0,Q.jsx)(u,{children:`Default`})}):null]}),(0,Q.jsxs)(f,{children:[(0,Q.jsx)(m,{render:(0,Q.jsx)(y,{size:`icon-xs`,variant:`ghost-muted`,disabled:U||ee,"aria-label":`${e.name} options`}),children:(0,Q.jsx)(s,{})}),(0,Q.jsxs)(x,{align:`end`,children:[(0,Q.jsx)(T,{disabled:!r||i,onClick:()=>{r&&a({browserDefaultProfileId:e.id})},children:`Set as default`}),(0,Q.jsx)(T,{disabled:!r||!B,onClick:()=>{L.environmentIds.length>0?O(e):se(e.id,e.name)},children:`Clear cookies and cache`}),n?null:(0,Q.jsx)(T,{variant:`destructive`,disabled:!r||!B,onClick:()=>{r&&E(e)},children:`Remove profile and data`}),B?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(C,{}),(0,Q.jsx)(T,{disabled:!0,children:c?`Connect to an environment to clear profile data`:`Checking environments…`})]})]})]})]},e.id)})}),(0,Q.jsx)(lt,{open:S!==null,onOpenChange:e=>{!e&&!N&&(E(null),M(null))},children:(0,Q.jsxs)(ot,{children:[(0,Q.jsxs)(rt,{children:[(0,Q.jsxs)(ct,{children:[`Remove “`,S?.name,`”?`]}),(0,Q.jsx)(st,{children:`Its cookies and logins are deleted. Desktop tabs already open in this profile stay open until you close them; server browser tabs close now.`}),j?(0,Q.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-destructive`,children:j}):null,B?null:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect to an environment to remove this profile and its data.`})]}),(0,Q.jsxs)(it,{children:[(0,Q.jsx)(at,{disabled:N,render:(0,Q.jsx)(y,{variant:`outline`,disabled:N}),children:`Cancel`}),(0,Q.jsx)(y,{variant:`destructive`,disabled:N||!r||!B,onClick:()=>{S&&r&&B&&W(S.id)},children:N?`Removing…`:`Remove profile`})]})]})}),(0,Q.jsx)(lt,{open:D!==null,onOpenChange:e=>{e||O(null)},children:(0,Q.jsxs)(ot,{children:[(0,Q.jsxs)(rt,{children:[(0,Q.jsxs)(ct,{children:[`Clear “`,D?.name,`”’s cookies and cache?`]}),(0,Q.jsx)(st,{children:`You are signed out of its sites. Server browser tabs open in this profile close now.`})]}),(0,Q.jsxs)(it,{children:[(0,Q.jsx)(at,{render:(0,Q.jsx)(y,{variant:`outline`}),children:`Cancel`}),(0,Q.jsx)(y,{variant:`destructive`,onClick:()=>{D&&se(D.id,D.name),O(null)},children:`Clear data`})]})]})}),_?(0,Q.jsx)(hn,{source:_.source,destinationEnvironmentName:_.environmentName,targetProfiles:te.map(e=>({id:e.id,name:e.name})),canCreateProfile:r&&!K,onImport:e=>le(_.source,_.environmentId,e),onRefreshSource:()=>ue(_.source.id),onCheckFullDiskAccess:window.desktopBridge?.checkSystemPermission?()=>window.desktopBridge.checkSystemPermission(`full-disk-access`):void 0,onOpenFullDiskAccessSettings:async()=>{await ge()?.shell.openSystemSettings(`full-disk-access`).catch(()=>{q.add({type:`error`,title:`Could not open System Settings`,description:`Open Privacy & Security → Full Disk Access manually.`})})},onClose:()=>b(null)}):null]})}function _r(){let e=(0,Z.c)(3),t=!Ee,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(gr,{disabled:t}),(0,Q.jsx)(Bn,{disabled:t}),(0,Q.jsx)(Un,{disabled:t}),(0,Q.jsx)(Kn,{disabled:t}),(0,Q.jsx)(Qn,{disabled:t}),(0,Q.jsx)(Yn,{disabled:t}),(0,Q.jsx)(nr,{disabled:t}),(0,Q.jsx)(mr,{disabled:t})]}),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(wt,{category:`integrations`}),e[1]=i):i=e[1];let a;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(ht,{children:[i,(0,Q.jsxs)(_t,{id:`browser`,title:`Browser`,children:[t?(0,Q.jsx)(mt,{message:`Only available in the desktop app.`,children:r}):r,(0,Q.jsx)(or,{}),(0,Q.jsx)(ur,{})]}),(0,Q.jsx)(fr,{})]}),e[2]=a):a=e[2],a}var vr=_r;export{vr as component};
|
|
2
|
+
//# sourceMappingURL=settings.integrations-CjiKCDy_.js.map
|