@p4code/cli 0.8.37 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/{binCli-mInzhqSL.mjs → binCli-k72_SR2Z.mjs} +2556 -2301
  3. package/dist/client/.vite/manifest.json +2008 -2048
  4. package/dist/client/assets/{2NI2N5EU-DVsZziQ3.js → 2NI2N5EU-DPAxyySd.js} +2 -2
  5. package/dist/client/assets/{4UO7MD6I-Cs3yBe-m.js → 4UO7MD6I-C0aflwpw.js} +2 -2
  6. package/dist/client/assets/{5B3SVYGG-CxW0L1iX.js → 5B3SVYGG-hhn6T1ru.js} +2 -2
  7. package/dist/client/assets/{5GK6JWQ2-Cb25PEnx.js → 5GK6JWQ2-BQ0OdoZ6.js} +2 -2
  8. package/dist/client/assets/{5N7A7DKN-udLyT643.js → 5N7A7DKN-BR8rdHwZ.js} +2 -2
  9. package/dist/client/assets/{5OC2THR4-DqD-reis.js → 5OC2THR4-DVDBlcjJ.js} +2 -2
  10. package/dist/client/assets/{5S6HY5KT-Cy7mIKKq.js → 5S6HY5KT-CjtOXys8.js} +2 -2
  11. package/dist/client/assets/{6IMQ5BUJ-Qu9PVsT7.js → 6IMQ5BUJ-Bpy1Geo9.js} +2 -2
  12. package/dist/client/assets/{6OLKWJ4F-BYzZS9mf.js → 6OLKWJ4F-D2naWV4i.js} +2 -2
  13. package/dist/client/assets/{74OO7NKP-h3ga2-vb.js → 74OO7NKP-CceNos-7.js} +2 -2
  14. package/dist/client/assets/{75O6YZUN-ByAK3P56.js → 75O6YZUN-CnXm_L8w.js} +2 -2
  15. package/dist/client/assets/{77XECAW3-D_lZqaZv.js → 77XECAW3-ECBcD47O.js} +2 -2
  16. package/dist/client/assets/{ABYRPUBD-BPWfXZyu.js → ABYRPUBD-B4F4wZam.js} +2 -2
  17. package/dist/client/assets/AlertDialogRoot-D5eL1YFA.js +2 -0
  18. package/dist/client/assets/{AnimatedHeight-D0-6CAPr.js → AnimatedHeight-BZhIfVtA.js} +2 -2
  19. package/dist/client/assets/AuthSurfaceShell-DR9yRrzS.js +2 -0
  20. package/dist/client/assets/{BB2UYUI2-CGgafKC2.js → BB2UYUI2-Cae7rC8c.js} +2 -2
  21. package/dist/client/assets/{BUM34MOA-Cn4iaSBT.js → BUM34MOA-DBDboDOb.js} +2 -2
  22. package/dist/client/assets/{CEQABKGZ-CmBEfzh3.js → CEQABKGZ-C6UutqUy.js} +2 -2
  23. package/dist/client/assets/{CXAC5362-xibpmz3Y.js → CXAC5362-BnZlf1Fg.js} +2 -2
  24. package/dist/client/assets/{ChatGptUsageButton-DU3PVHJW.js → ChatGptUsageButton-3K5PpaVk.js} +2 -2
  25. package/dist/client/assets/{ChatMarkdown-D-cNSjFn.js → ChatMarkdown-EK5C8Dje.js} +7 -7
  26. package/dist/client/assets/{CheckboxIndicator-CZCy38xt.js → CheckboxIndicator-DZ8vBLEv.js} +2 -2
  27. package/dist/client/assets/{ClippedText-D_rM_XDj.js → ClippedText-Dswe5Mb4.js} +2 -2
  28. package/dist/client/assets/CodexSetupSection.logic-BepCZ25p.js +2 -0
  29. package/dist/client/assets/{ComboboxClear-tOmMpuVi.js → ComboboxClear-By718biy.js} +2 -2
  30. package/dist/client/assets/{ComboboxGroupLabel-CgZZIHwV.js → ComboboxGroupLabel-DjWIIS5_.js} +2 -2
  31. package/dist/client/assets/{CommandBlock-6rjypfVF.js → CommandBlock-C967hvdK.js} +2 -2
  32. package/dist/client/assets/{ComposerPromptEditor-Dxfhec2W.js → ComposerPromptEditor-kPs79YCA.js} +10 -10
  33. package/dist/client/assets/{CompositeRoot-Bsb8efI6.js → CompositeRoot-BFPe8O0M.js} +2 -2
  34. package/dist/client/assets/{ConnectionDiagnosisDetails-Q0M5gCCf.js → ConnectionDiagnosisDetails-B5VXf5lv.js} +2 -2
  35. package/dist/client/assets/{ConnectionStatusDot-DAuD0jkU.js → ConnectionStatusDot-wmgCjAfF.js} +2 -2
  36. package/dist/client/assets/{DRLTVNUE-BVseXOzv.js → DRLTVNUE-Du8kYl_L.js} +2 -2
  37. package/dist/client/assets/{DYY6UVD2-Bz33D3dq.js → DYY6UVD2-DxjEuWNy.js} +2 -2
  38. package/dist/client/assets/{DevicePanel-CsSQr7vQ.js → DevicePanel-YEBH-Vqd.js} +2 -2
  39. package/dist/client/assets/DeviceSetup-CAlj40rJ.js +2 -0
  40. package/dist/client/assets/{DialogTitle-bcvBtKP-.js → DialogTitle-DNp9zThp.js} +2 -2
  41. package/dist/client/assets/{DiffCommentAnnotation-bhzNqujM.js → DiffCommentAnnotation-BOk2MTlv.js} +2 -2
  42. package/dist/client/assets/{DiffFileTree-BySeJqhq.js → DiffFileTree-Dg3cvfi5.js} +2 -2
  43. package/dist/client/assets/{DiffPanel-CCFas4eA.js → DiffPanel-fTHMPAQJ.js} +2 -2
  44. package/dist/client/assets/{DiffWorkerPoolProvider-CkkqWbz-.js → DiffWorkerPoolProvider-CqmToECA.js} +3 -3
  45. package/dist/client/assets/{EmbeddedDesign-iuThcPT3.js → EmbeddedDesign-BXKBSCcw.js} +2 -2
  46. package/dist/client/assets/{EnvironmentMachineIcon-iUmoTUYt.js → EnvironmentMachineIcon-DBWK6C8T.js} +2 -2
  47. package/dist/client/assets/{ExpandableText-ByCx68yv.js → ExpandableText-B9cfY7p2.js} +2 -2
  48. package/dist/client/assets/{FNOVOB4O-DK3iet1g.js → FNOVOB4O-BeMBYVRF.js} +2 -2
  49. package/dist/client/assets/{FieldControl-DtsEariK.js → FieldControl-BOrs67_f.js} +2 -2
  50. package/dist/client/assets/{FileDiff-Bu2BSqBV.js → FileDiff-DW1zPAn5.js} +2 -2
  51. package/dist/client/assets/{FilePreviewPanel-8cI8gciT.js → FilePreviewPanel-CTTCKfik.js} +10 -10
  52. package/dist/client/assets/{FoldedSettingsSection-RYq8GTvV.js → FoldedSettingsSection-ClboCRR4.js} +2 -2
  53. package/dist/client/assets/{FormContext-CIK8MKa2.js → FormContext-DcLeIpxJ.js} +2 -2
  54. package/dist/client/assets/{HDGCDEEZ-B_J1N6RY.js → HDGCDEEZ-DtsLNbcM.js} +2 -2
  55. package/dist/client/assets/{HSJLKHB7-B2SbZQUf.js → HSJLKHB7-Cj1_K-Mg.js} +2 -2
  56. package/dist/client/assets/{Icons-xsXA_L6w.js → Icons-B1qw9fnR.js} +2 -2
  57. package/dist/client/assets/Input-DQflEYBs.js +2 -0
  58. package/dist/client/assets/JZOYTAAL-BrzaFmLe.js +1 -0
  59. package/dist/client/assets/{K3MD6TGW-VU68yYxr.js → K3MD6TGW-SNOidZ8r.js} +2 -2
  60. package/dist/client/assets/{K7RP3OMA-zaD_NBVC.js → K7RP3OMA-CpajkG5B.js} +2 -2
  61. package/dist/client/assets/{KeybindingsSettings.logic-BJe27xmi.js → KeybindingsSettings.logic-BA5WG7V2.js} +2 -2
  62. package/dist/client/assets/{LHDIQX7Q-DCLqoRGy.js → LHDIQX7Q-CAyO0Nv9.js} +2 -2
  63. package/dist/client/assets/{LUXOKEGN-CmxZpSzC.js → LUXOKEGN-Dp60gO-M.js} +2 -2
  64. package/dist/client/assets/{MathTypeset-Hhqwg4PF.js → MathTypeset-DG9QDH3a.js} +2 -2
  65. package/dist/client/assets/{N3JZAHOW-Cev8Cn9M.js → N3JZAHOW-CPZZhC9o.js} +2 -2
  66. package/dist/client/assets/{NUIALGQ3-CV92Kt25.js → NUIALGQ3-Bapg3pv1.js} +2 -2
  67. package/dist/client/assets/{NoProjectsHero-CMqIlSNl.js → NoProjectsHero-DunzHVd0.js} +2 -2
  68. package/dist/client/assets/{O65XPQGZ-bGyTGMsB.js → O65XPQGZ-BmLVfB2-.js} +2 -2
  69. package/dist/client/assets/{O7XIQ6OM-DVdEfB1N.js → O7XIQ6OM-BzZlSmaP.js} +2 -2
  70. package/dist/client/assets/{OFQON5FD-Ca_CNS26.js → OFQON5FD-Ciy1Dfj8.js} +2 -2
  71. package/dist/client/assets/{P4ConnectAccountPages-Buss2oTL.js → P4ConnectAccountPages-DO-fCpTN.js} +2 -2
  72. package/dist/client/assets/{P4ConnectSidebarSignIn-D1n4y6Gq.js → P4ConnectSidebarSignIn-7hkM7xr7.js} +2 -2
  73. package/dist/client/assets/{PJQHF43J-B__IdKwP.js → PJQHF43J-CTTmTIhc.js} +2 -2
  74. package/dist/client/assets/{PanelLayoutControls-EIunk_2Q.js → PanelLayoutControls-clP6N7xc.js} +7 -7
  75. package/dist/client/assets/{PierreEntryIcon-GQImyog1.js → PierreEntryIcon-wm-IkF2y.js} +2 -2
  76. package/dist/client/assets/{PopoverHandle-Cj5egwXv.js → PopoverHandle-CqjlXffy.js} +2 -2
  77. package/dist/client/assets/PreviewPanel-fTwWXayK.js +2 -0
  78. package/dist/client/assets/{ProjectDefaultsSettings-DX2Kf-tx.js → ProjectDefaultsSettings-DABlQCRQ.js} +2 -2
  79. package/dist/client/assets/{ProjectFavicon-OMOnEzVu.js → ProjectFavicon-zExdjKgc.js} +3 -3
  80. package/dist/client/assets/{ProjectIconPickerDialog-Q4GkqwDs.js → ProjectIconPickerDialog-D4Br81iW.js} +2 -2
  81. package/dist/client/assets/{ProjectMonogram-Br5sgd24.js → ProjectMonogram-Ba70a8_s.js} +2 -2
  82. package/dist/client/assets/{ProviderAuthTerminal-Q584HoOn.js → ProviderAuthTerminal-Gf_5AaPE.js} +2 -2
  83. package/dist/client/assets/{ProviderModelPicker-JNM9nJs_.js → ProviderModelPicker-DrfK42fH.js} +2 -2
  84. package/dist/client/assets/{ProviderSettingsForm-CdiKhrJE.js → ProviderSettingsForm-CXVYrIzw.js} +2 -2
  85. package/dist/client/assets/{PullRequestCodeTab-Co76Qf6Z.js → PullRequestCodeTab-DaXxo4Bs.js} +3 -3
  86. package/dist/client/assets/{RHNBAITX-Oryl0UiR.js → RHNBAITX-DKMeuR6R.js} +2 -2
  87. package/dist/client/assets/{ReadOnlySourcePreview-aUjexBVb.js → ReadOnlySourcePreview-DPJWK3HJ.js} +2 -2
  88. package/dist/client/assets/{RenderErrorBoundary-Oe5BzG3n.js → RenderErrorBoundary-BI5KBtsb.js} +2 -2
  89. package/dist/client/assets/{SLD4V6NK-DbsINoTD.js → SLD4V6NK-CR4aIcpx.js} +2 -2
  90. package/dist/client/assets/ScheduledTasksSettings-CTHyd4UX.js +4 -0
  91. package/dist/client/assets/{ScopedSwitch-D8-FelRH.js → ScopedSwitch-De6GoQiO.js} +2 -2
  92. package/dist/client/assets/{ScrollAreaCorner-nnFi-Ecx.js → ScrollAreaCorner-DF4GCx0d.js} +2 -2
  93. package/dist/client/assets/{SecretInput-CqAhFuNO.js → SecretInput-Dg6ZsU9p.js} +2 -2
  94. package/dist/client/assets/{SelectScrollUpArrow-BQJrvk31.js → SelectScrollUpArrow-DeRXucOo.js} +2 -2
  95. package/dist/client/assets/{SettingsPanels-CNgY_ZPe.js → SettingsPanels-D6e2byZQ.js} +8 -8
  96. package/dist/client/assets/{SettingsPanels.logic-Dr_NyHjE.js → SettingsPanels.logic-BSXSdFru.js} +2 -2
  97. package/dist/client/assets/{SettingsScopeNotice-BFxCBOnl.js → SettingsScopeNotice-MbxDDMZ9.js} +2 -2
  98. package/dist/client/assets/SidebarStageBackdrop-B0F--sat.js +2 -0
  99. package/dist/client/assets/{T3PCR2KE-2R1FY5zG.js → T3PCR2KE-C0_7R2Oa.js} +2 -2
  100. package/dist/client/assets/{TKWO2OVW-BjhIZzCe.js → TKWO2OVW-DqJmzuhq.js} +2 -2
  101. package/dist/client/assets/{TSHNXIZL-B_cvoUct.js → TSHNXIZL-CmCl4WMk.js} +2 -2
  102. package/dist/client/assets/ThemeEditorPanel-IhSXPcO9.js +5 -0
  103. package/dist/client/assets/{ThreadTerminalDrawer-DHoyxd6-.js → ThreadTerminalDrawer-DnOstFPr.js} +4 -4
  104. package/dist/client/assets/TooltipViewport-DJXNIjFt.js +2 -0
  105. package/dist/client/assets/{UQJE5E4I-2r98lr05.js → UQJE5E4I-U1f_Qxq0.js} +2 -2
  106. package/dist/client/assets/{USNYFO5S-CvTI5t_o.js → USNYFO5S-BFU1s0-x.js} +2 -2
  107. package/dist/client/assets/{Virtualizer-BgcEI5KE.js → Virtualizer-CI2uidEs.js} +2 -2
  108. package/dist/client/assets/{WEVWDWVA-U7ygIdf3.js → WEVWDWVA-DVuH1I8D.js} +2 -2
  109. package/dist/client/assets/{WorkspaceBreadcrumb-_zND61qF.js → WorkspaceBreadcrumb-Dr-p0Dtn.js} +2 -2
  110. package/dist/client/assets/{WorkspacePageContainer-LYv_7Qc0.js → WorkspacePageContainer-MDWEFwmu.js} +2 -2
  111. package/dist/client/assets/{WorkspacePageHeader-B_0ute56.js → WorkspacePageHeader-CNcKDaqG.js} +2 -2
  112. package/dist/client/assets/{X5RFHQXM-D4S0_b0W.js → X5RFHQXM-DhiPjZ2I.js} +2 -2
  113. package/dist/client/assets/{X62E3GBT-CrIC4h9P.js → X62E3GBT-BoEmDIYA.js} +2 -2
  114. package/dist/client/assets/{XBNEOJTC-D2_RQZjM.js → XBNEOJTC-ACchb7zJ.js} +2 -2
  115. package/dist/client/assets/{YHV2MVVZ-BmAcJLBt.js → YHV2MVVZ-WIW1NclZ.js} +2 -2
  116. package/dist/client/assets/{YURCZMG2-RCCTu3bv.js → YURCZMG2-D8PyipKA.js} +2 -2
  117. package/dist/client/assets/{YVG2LODB-Cvp0Ei-1.js → YVG2LODB-BQvBC9bF.js} +2 -2
  118. package/dist/client/assets/_chat-DDGjgFMR.js +45 -0
  119. package/dist/client/assets/{_chat.design-DX1VqYkX.js → _chat.design-DjIqnlVZ.js} +2 -2
  120. package/dist/client/assets/{_chat.index-Dzh3d42S.js → _chat.index-Dku1iZH1.js} +2 -2
  121. package/dist/client/assets/{_chat.new-BHRvXFPr.js → _chat.new-8-cjg5K7.js} +3 -3
  122. package/dist/client/assets/_chat.pull-requests-DVfSewSZ.js +2 -0
  123. package/dist/client/assets/{alert-BN-r9V4f.js → alert-DpVw79VA.js} +2 -2
  124. package/dist/client/assets/{assetUrls-B6vsSVWR.js → assetUrls-BOJMUK_1.js} +2 -2
  125. package/dist/client/assets/{assets-CID0y4Uv.js → assets-6zZLBDZw.js} +2 -2
  126. package/dist/client/assets/{browserHistoryStore-CK4YsfkQ.js → browserHistoryStore-TJXTYA-V.js} +2 -2
  127. package/dist/client/assets/{browserLinkTarget-BJ30b4-s.js → browserLinkTarget-DRbX4L_9.js} +2 -2
  128. package/dist/client/assets/{checkbox-BJhN1L_L.js → checkbox-4yBjrqWQ.js} +2 -2
  129. package/dist/client/assets/{color-picker-D2LwMwlZ.js → color-picker-B6JEgpDa.js} +2 -2
  130. package/dist/client/assets/{combobox-Cw2-7qyI.js → combobox-CKWbcPIR.js} +2 -2
  131. package/dist/client/assets/{command-BIELTYJu.js → command-D8XZec1r.js} +2 -2
  132. package/dist/client/assets/{connect-D4llmZsa.js → connect-Dp9BB7ev.js} +2 -2
  133. package/dist/client/assets/{connect-agent-BlR0FAbF.js → connect-agent-DkbIqI-8.js} +2 -2
  134. package/dist/client/assets/{design-Cdl1XCBU.js → design-Dn5DzqF2.js} +2 -2
  135. package/dist/client/assets/{device-Bc5H3PTz.js → device-dylO5xoO.js} +2 -2
  136. package/dist/client/assets/{dialog-BRtKKGzk.js → dialog-_vbB7RKH.js} +2 -2
  137. package/dist/client/assets/{diffRendering-DtBTalAD.js → diffRendering-MXukhqw1.js} +2 -2
  138. package/dist/client/assets/{dist-oE_MNxpZ.js → dist-ceTe_mn7.js} +3 -3
  139. package/dist/client/assets/{draft-input-vviXwx5Q.js → draft-input-C-u_3cDw.js} +2 -2
  140. package/dist/client/assets/{duoViewer-kcp00m8a.js → duoViewer-C0aL6Kyr.js} +2 -2
  141. package/dist/client/assets/{dynamic-C8_ODyue.js → dynamic-DTzzXo3L.js} +2 -2
  142. package/dist/client/assets/{embeddedScripts-skldQmE1.js → embeddedScripts-DcWCyBxX.js} +2 -2
  143. package/dist/client/assets/{empty-rC3eYvxq.js → empty-BlKDGTzb.js} +2 -2
  144. package/dist/client/assets/{entities-B8Vupv5g.js → entities-eRiwvW2F.js} +2 -2
  145. package/dist/client/assets/{fileLinks-BoyzENAX.js → fileLinks-CYejoXPq.js} +2 -2
  146. package/dist/client/assets/{fileTreeExpansion-DndrZZAD.js → fileTreeExpansion-wG1G7D6R.js} +2 -2
  147. package/dist/client/assets/{getDiffFileInput-C1QBFdFu.js → getDiffFileInput-CzeweGHs.js} +2 -2
  148. package/dist/client/assets/{guideRunStore-BgFFILxA.js → guideRunStore-DAYN2Zd7.js} +2 -2
  149. package/dist/client/assets/{htmlRender-ddkOIEbT.js → htmlRender-C3rZ0xgC.js} +2 -2
  150. package/dist/client/assets/{index-BwdieRvq.js → index-DA9og9YW.js} +3 -3
  151. package/dist/client/assets/{input-BYd74ook.js → input-DXGWoa4O.js} +2 -2
  152. package/dist/client/assets/{input-group-DMFlSk_7.js → input-group-De0xZXfc.js} +2 -2
  153. package/dist/client/assets/{kbd-rp5mX21h.js → kbd-WWNLIkTn.js} +2 -2
  154. package/dist/client/assets/{keybindings-B_kRk5Fi.js → keybindings-DAHl8jIl.js} +2 -2
  155. package/dist/client/assets/{lazy-CeaQ3-Fj.js → lazy-Ccs3klKO.js} +4 -4
  156. package/dist/client/assets/{lazyRouteComponent-COYyJY2H.js → lazyRouteComponent-BU0ER5FO.js} +2 -2
  157. package/dist/client/assets/{link-CsXnX9WM.js → link-C3TbL1do.js} +2 -2
  158. package/dist/client/assets/{linkedPrompt-B5iI7U8H.js → linkedPrompt-BJh0Yqud.js} +2 -2
  159. package/dist/client/assets/main-DjrB0l0D.css +2 -0
  160. package/dist/client/assets/main-DleJeMZO.js +37 -0
  161. package/dist/client/assets/{mediaReference-ZW7gfO5X.js → mediaReference-BbSbhpkR.js} +2 -2
  162. package/dist/client/assets/{mediaSource-DsT6G6Wm.js → mediaSource-B_75uvyp.js} +2 -2
  163. package/dist/client/assets/{number-field-CEA6qXbs.js → number-field-qEfih146.js} +2 -2
  164. package/dist/client/assets/{observeResize-DSyLC8QK.js → observeResize-DzSkewug.js} +2 -2
  165. package/dist/client/assets/{onboarding-BPkAEHBV.js → onboarding-1Zg3fM0A.js} +2 -2
  166. package/dist/client/assets/{openFileInPreview-CGM83ICx.js → openFileInPreview-CiPuDrfB.js} +2 -2
  167. package/dist/client/assets/{p4ProjectFile-CwpteA7b.js → p4ProjectFile-BVKW5TIA.js} +2 -2
  168. package/dist/client/assets/{pair-D9v8gc0o.js → pair-DUv1mY4i.js} +2 -2
  169. package/dist/client/assets/{pendingSendStore-BuEVrrEM.js → pendingSendStore-BFVsboDn.js} +2 -2
  170. package/dist/client/assets/{phoneViewer-CNE0SVmy.js → phoneViewer-CStYy_tX.js} +2 -2
  171. package/dist/client/assets/{pierre-icons-ChDlOt-h.js → pierre-icons-D3vWvKqU.js} +2 -2
  172. package/dist/client/assets/{popover-BjUpdrKu.js → popover-CogH2zM4.js} +2 -2
  173. package/dist/client/assets/{preview-DHLYKEKb.js → preview-O1ZL8Awg.js} +2 -2
  174. package/dist/client/assets/{preview-3EscFepc.js → preview-ipLyyv_l.js} +2 -2
  175. package/dist/client/assets/{previewMiniPlayerStore-DHjQeV1U.js → previewMiniPlayerStore-C5z1mN8S.js} +2 -2
  176. package/dist/client/assets/{primary-NcsmRI6j.js → primary-CMBPxKMH.js} +2 -2
  177. package/dist/client/assets/{primaryCloudLinkState-DkXIVBHW.js → primaryCloudLinkState-CER468V5.js} +2 -2
  178. package/dist/client/assets/{projectFilesQueryState-0jxJ50Qq.js → projectFilesQueryState-D4FdR3Xm.js} +2 -2
  179. package/dist/client/assets/{projectScriptEditor-CMGXoIEJ.js → projectScriptEditor-4wQTbXvz.js} +2 -2
  180. package/dist/client/assets/{providerSkills-4hnESoi_.js → providerSkills-D3rxPB_g.js} +2 -2
  181. package/dist/client/assets/{pullRequestDetail.logic-sbOM8yDW.js → pullRequestDetail.logic-Bkh57WzV.js} +2 -2
  182. package/dist/client/assets/{pullRequestIcons-B7Om_B_D.js → pullRequestIcons-DPbMXqGp.js} +2 -2
  183. package/dist/client/assets/{pullRequestReviewStore-CIL8WfOG.js → pullRequestReviewStore-BAxwf6rl.js} +2 -2
  184. package/dist/client/assets/{pullRequests-CMTRCOu7.js → pullRequests-DggtcbhA.js} +2 -2
  185. package/dist/client/assets/{queries-hhl_J8u9.js → queries-DJfKGsHe.js} +2 -2
  186. package/dist/client/assets/{query-CfGzD8v6.js → query-B3Zo1YOE.js} +2 -2
  187. package/dist/client/assets/{radio-group-up2QNXjf.js → radio-group-l1Zl-3hQ.js} +2 -2
  188. package/dist/client/assets/{renderScheduler-Dgqqs-EX.js → renderScheduler-BgGYA97h.js} +2 -2
  189. package/dist/client/assets/{rightPanelStore-CGF0-d-1.js → rightPanelStore-Cv1U3yrU.js} +2 -2
  190. package/dist/client/assets/{runtime-Ca_Z-vg5.js → runtime-BOlBBevr.js} +3 -3
  191. package/dist/client/assets/{runtime-OeWFs5Hf.js → runtime-CeFhsGnm.js} +3 -3
  192. package/dist/client/assets/{runtimeModeConfig-BTG9FTYe.js → runtimeModeConfig-BQ0QCQhj.js} +2 -2
  193. package/dist/client/assets/{scheduledTasksSettings.logic-BeuOnCov.js → scheduledTasksSettings.logic-BpOBCcOk.js} +2 -2
  194. package/dist/client/assets/{scroll-area-BNQKEZbp.js → scroll-area-CQNIjQ8U.js} +2 -2
  195. package/dist/client/assets/{select-D_zHR42Y.js → select-Cbpdz6n3.js} +2 -2
  196. package/dist/client/assets/{selfImproveFindings-CAZ0j1GD.js → selfImproveFindings-CT79AgdK.js} +2 -2
  197. package/dist/client/assets/{server-6nKYyc8r.js → server-DvWrfyUO.js} +2 -2
  198. package/dist/client/assets/{session-BxUdP61p.js → session-D3gY-tOR.js} +2 -2
  199. package/dist/client/assets/{session-logic-Dr1plzXe.js → session-logic-OeNFZd_V.js} +3 -3
  200. package/dist/client/assets/{settings-DE_hSu0q.js → settings-C6gUwixG.js} +2 -2
  201. package/dist/client/assets/{settings.appearance-C--uy4It.js → settings.appearance-BdGq8dkT.js} +2 -2
  202. package/dist/client/assets/settings.archived-DobN7ZtC.js +2 -0
  203. package/dist/client/assets/{settings.computer-use-DhnqPqMm.js → settings.computer-use-DTAvnNqQ.js} +2 -2
  204. package/dist/client/assets/settings.connections-CZD-0BNX.js +2 -0
  205. package/dist/client/assets/settings.data-controls-CTVHY8Rd.js +2 -0
  206. package/dist/client/assets/{settings.decisions-CU-6rIpn.js → settings.decisions-D3zMITNw.js} +2 -2
  207. package/dist/client/assets/{settings.designs-DHYhhG4k.js → settings.designs-DWeI1d2s.js} +2 -2
  208. package/dist/client/assets/{settings.diagnostics-csgW1_E8.js → settings.diagnostics-CqC6fhz6.js} +2 -2
  209. package/dist/client/assets/{settings.general-CeBkrL9-.js → settings.general-BDEcQVI4.js} +2 -2
  210. package/dist/client/assets/{settings.integrations-DqSYBosl.js → settings.integrations-BmqNoylk.js} +2 -2
  211. package/dist/client/assets/{settings.keybindings-C7D1i238.js → settings.keybindings-Mt7J5TKC.js} +2 -2
  212. package/dist/client/assets/{settings.open-source-licenses-6oFDgAt7.js → settings.open-source-licenses-Dvex7Jce.js} +2 -2
  213. package/dist/client/assets/{settings.plugins-DfM65Xio.js → settings.plugins-BAFed2wY.js} +4 -4
  214. package/dist/client/assets/settings.projects-DhuXD_vx.js +4 -0
  215. package/dist/client/assets/settings.providers-D_-kNRqH.js +3 -0
  216. package/dist/client/assets/{settings.scheduled-tasks-Csi8wfij.js → settings.scheduled-tasks-Z4aprmEO.js} +2 -2
  217. package/dist/client/assets/settings.snap-shot-o0bdbS5t.js +2 -0
  218. package/dist/client/assets/settings.source-control-CwJzBnSu.js +2 -0
  219. package/dist/client/assets/{settings.storage-DTcg-0aj.js → settings.storage-B4ahmlhx.js} +2 -2
  220. package/dist/client/assets/{settingsLayout-4ySvFdXb.js → settingsLayout-DrhqvTJ8.js} +3 -3
  221. package/dist/client/assets/{sidebar-CHDwV4Ca.js → sidebar-BhJqncti.js} +2 -2
  222. package/dist/client/assets/{sidebarProjectGrouping-BcOVY8p-.js → sidebarProjectGrouping-DDt6qTcu.js} +2 -2
  223. package/dist/client/assets/{skeleton-BcLPbojY.js → skeleton-CFtayHTe.js} +2 -2
  224. package/dist/client/assets/{sourceControl-CPrl7cyO.js → sourceControl-Dqo9EYNC.js} +2 -2
  225. package/dist/client/assets/{sourceControlClients-oNOd36Cq.js → sourceControlClients-DGnHi6Rd.js} +2 -2
  226. package/dist/client/assets/{spinner-_ourbdVb.js → spinner-BZh9P0sD.js} +2 -2
  227. package/dist/client/assets/{terminal-links-DuZi4b83.js → terminal-links-CFKe0iu0.js} +2 -2
  228. package/dist/client/assets/{terminalSessions-D0vbdqqx.js → terminalSessions-BykgTNwT.js} +2 -2
  229. package/dist/client/assets/{textarea-DlXXDHPJ.js → textarea-hXQFbdrS.js} +2 -2
  230. package/dist/client/assets/themePalette-MbAn2gqj.js +5 -0
  231. package/dist/client/assets/{toast-DXWclCrr.js → toast-C61oyZY1.js} +2 -2
  232. package/dist/client/assets/{toggle-Dofc34s2.js → toggle-B03MQDgB.js} +2 -2
  233. package/dist/client/assets/{toggle-group-CYKsfBbD.js → toggle-group-yF5GZ53o.js} +2 -2
  234. package/dist/client/assets/{tooltip-CY3W5y-f.js → tooltip-ChmjT8Ns.js} +2 -2
  235. package/dist/client/assets/uiStateStore-DL8OsPjd.js +2 -0
  236. package/dist/client/assets/{usage-DQcgd75_.js → usage-DATBL2Du.js} +2 -2
  237. package/dist/client/assets/{usageAccess-CCSxXl9X.js → usageAccess-kgUHYKOw.js} +2 -2
  238. package/dist/client/assets/{usageFormat-ByjmRjTe.js → usageFormat-D5Mz5ugL.js} +2 -2
  239. package/dist/client/assets/{usageShortcuts-DOWm0Vo9.js → usageShortcuts-mAekk3eG.js} +2 -2
  240. package/dist/client/assets/{use-atom-command-vqjL7n-x.js → use-atom-command-Bt7x9oO0.js} +2 -2
  241. package/dist/client/assets/{useAriaLabelledBy-B7FNFpmO.js → useAriaLabelledBy-DjNn9irU.js} +2 -2
  242. package/dist/client/assets/useHandleNewThread-BOKOo2wA.js +2 -0
  243. package/dist/client/assets/{useLocation-B_XV0lDx.js → useLocation-Cwv1HZ3K.js} +2 -2
  244. package/dist/client/assets/{useNavigate-BWqAWfiZ.js → useNavigate-Cdrlv-yJ.js} +2 -2
  245. package/dist/client/assets/{useNavigateBack-C52nbvbb.js → useNavigateBack-CwjQ4iuL.js} +2 -2
  246. package/dist/client/assets/{useP4ConnectAuthPrompt-DKhdNYj8.js → useP4ConnectAuthPrompt-D63n-MFC.js} +2 -2
  247. package/dist/client/assets/{useParams-ekGanxxb.js → useParams-C5D_t-0u.js} +2 -2
  248. package/dist/client/assets/{usePermissionStatus-CWV_yoZe.js → usePermissionStatus-CKmeNk61.js} +2 -2
  249. package/dist/client/assets/{usePullRequestActions-DxtkLQ5D.js → usePullRequestActions-D53oZord.js} +2 -2
  250. package/dist/client/assets/{useRegisterFieldControl-BAJIcFiO.js → useRegisterFieldControl-DUs9w2Me.js} +2 -2
  251. package/dist/client/assets/{useScopedModelAvailability-815e0x20.js → useScopedModelAvailability-CeAUx0qZ.js} +2 -2
  252. package/dist/client/assets/useSettings-VTow9ZEM.js +3 -0
  253. package/dist/client/assets/utils-CBe1bHL7.js +37 -0
  254. package/dist/client/assets/{vcsRefInvalidation-CW_MIqdt.js → vcsRefInvalidation-B2f3qDSR.js} +2 -2
  255. package/dist/client/assets/{welcome-k7S47hyM.js → welcome-CQgOocvj.js} +2 -2
  256. package/dist/client/index.html +1 -1
  257. package/dist/{renderer-Ay-1ojn7.mjs → renderer-BBWgEvuE.mjs} +2 -2
  258. package/dist/{runtime-bP6MSuMS.mjs → runtime-DNjlpJkJ.mjs} +286 -242
  259. package/package.json +1 -1
  260. package/dist/client/assets/AlertDialogRoot-BSP6M0Mu.js +0 -2
  261. package/dist/client/assets/AuthSurfaceShell-30QvY1bI.js +0 -2
  262. package/dist/client/assets/CodexSetupSection.logic-g6_GE4bw.js +0 -2
  263. package/dist/client/assets/DeviceSetup-Cl7L9wsi.js +0 -2
  264. package/dist/client/assets/Input-D3Qi4jCN.js +0 -2
  265. package/dist/client/assets/JZOYTAAL-BlxFvoz4.js +0 -1
  266. package/dist/client/assets/PreviewPanel-BkFeksTl.js +0 -2
  267. package/dist/client/assets/ScheduledTasksSettings-1uXNtcPA.js +0 -4
  268. package/dist/client/assets/ThemeEditorPanel-B7MiqZ90.js +0 -5
  269. package/dist/client/assets/TooltipViewport-ThbbZQDo.js +0 -2
  270. package/dist/client/assets/_chat-CwO3_WVM.js +0 -45
  271. package/dist/client/assets/_chat.pull-requests-BZilN1TK.js +0 -2
  272. package/dist/client/assets/composer-logic-P-jVPXi4.js +0 -6
  273. package/dist/client/assets/composerDraftUploads-S66xDlS0.js +0 -2
  274. package/dist/client/assets/main-DdVSHl80.css +0 -2
  275. package/dist/client/assets/main-VfCRP294.js +0 -29
  276. package/dist/client/assets/settings.archived-D-55XnxQ.js +0 -2
  277. package/dist/client/assets/settings.connections-BPVLazeK.js +0 -2
  278. package/dist/client/assets/settings.data-controls-CIzGvqCI.js +0 -2
  279. package/dist/client/assets/settings.projects-CeoZzdMW.js +0 -4
  280. package/dist/client/assets/settings.providers-BBgppyE3.js +0 -3
  281. package/dist/client/assets/settings.snap-shot-BdVdSIJy.js +0 -2
  282. package/dist/client/assets/settings.source-control-Bme3qg7j.js +0 -2
  283. package/dist/client/assets/themePalette-VIM7Gehx.js +0 -5
  284. package/dist/client/assets/uiStateStore-CdkBStdp.js +0 -6
  285. package/dist/client/assets/useHandleNewThread-BYNZXzR_.js +0 -2
  286. package/dist/client/assets/useSettings-gPlpTIWi.js +0 -3
  287. package/dist/client/assets/utils-DhUt689t.js +0 -37
@@ -1,2 +0,0 @@
1
- import{i as e}from"./SettingsPanels-CNgY_ZPe.js";var t=e;export{t as component};
2
- //# sourceMappingURL=settings.archived-D-55XnxQ.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{$_ as i,$n as a,$p as o,$x as s,B_ as c,Dl as l,Gy as u,H_ as d,J_ as f,Kl as p,L_ as m,Md as h,Pd as g,Q_ as _,S_ as v,U_ as y,Uc as b,W_ as x,X_ as S,Y_ as C,Yn as w,Yp as T,Z_ as E,Zo as D,_C as O,aE as k,af as A,ar as j,as as M,cE as N,cb as P,cr as F,dr as I,dx as ee,ev as te,fr as ne,iE as re,is as ie,jm as ae,kv as oe,lr as se,nr as ce,nv as le,om as ue,ps as de,q_ as fe,ql as L,rh as pe,rr as me,rv as he,sr as ge,sv as R,t as _e,tE as ve,tr as ye,ts as be,tv as xe,ur as Se,us as z,v_ as Ce,xx as we,z_ as Te,zf as Ee}from"./utils-DhUt689t.js";import{Dt as B,Et as De,F as Oe,Ht as ke,On as Ae,Ot as je,R as Me,Ut as Ne,W as Pe,jt as V,kt as H,o as Fe,on as Ie,tt as Le,w as Re,x as ze}from"./runtime-OeWFs5Hf.js";import{E as Be,Et as Ve,F as He,Mt as Ue,Ot as We,S as U,_ as Ge,jt as Ke,t as W}from"./runtime-Ca_Z-vg5.js";import{a as qe,c as Je,o as Ye,s as Xe,t as Ze}from"./select-D_zHR42Y.js";import{t as G}from"./spinner-_ourbdVb.js";import{i as K,p as Qe}from"./toast-DXWclCrr.js";import{A as $e,D as et,E as tt,O as nt,b as rt,c as q,et as it,s as at,v as ot}from"./useSettings-gPlpTIWi.js";import{f as st,h as ct,s as lt}from"./server-6nKYyc8r.js";import{a as ut,i as dt,n as J,s as ft}from"./session-BxUdP61p.js";import{n as pt}from"./query-CfGzD8v6.js";import{t as mt}from"./use-atom-command-vqjL7n-x.js";import{t as Y}from"./toastHelpers-DxXYm50b.js";import{i as ht,r as gt}from"./timestampFormat-wac2e_Jz.js";import{a as _t,n as vt,t as yt}from"./tooltip-CY3W5y-f.js";import{t as bt}from"./textarea-DlXXDHPJ.js";import{t as xt}from"./input-BYd74ook.js";import{t as St}from"./scroll-area-BNQKEZbp.js";import{a as Ct,c as wt,i as Tt,l as Et,n as Dt,o as Ot,r as kt,s as At,t as jt}from"./dialog-BRtKKGzk.js";import{n as Mt}from"./P4ConnectAccountPages-Buss2oTL.js";import{a as Nt,i as Pt,o as Ft,r as It,t as Lt}from"./empty-rC3eYvxq.js";import{t as Rt}from"./AnimatedHeight-D0-6CAPr.js";import{C as zt,_ as Bt,w as Vt,y as Ht}from"./keybindings-B_kRk5Fi.js";import{i as Ut,o as Wt,t as Gt}from"./popover-BjUpdrKu.js";import{t as Kt}from"./checkbox-BJhN1L_L.js";import{_ as qt,a as Jt,c as Yt,d as Xt,f as Zt,g as Qt,i as $t,l as en,p as tn,r as nn,s as rn,u as an,v as on}from"./uiStateStore-CdkBStdp.js";import{n as sn,t as X}from"./EnvironmentMachineIcon-iUmoTUYt.js";import{r as cn,t as ln}from"./alert-BN-r9V4f.js";import{a as un,i as dn,s as fn,u as pn}from"./settingsLayout-4ySvFdXb.js";import{_ as mn,b as hn,g as gn,h as _n,v as vn,x as yn,y as bn}from"./command-BIELTYJu.js";import{t as xn}from"./ConnectionStatusDot-DAuD0jkU.js";import{a as Sn,n as Cn,o as wn,s as Tn,t as En}from"./primary-NcsmRI6j.js";import{n as Dn,t as On}from"./onboarding-BPkAEHBV.js";import{Ar as kn,Er as An,Fr as jn,Gn as Mn,Ir as Nn,Jn as Pn,Jt as Fn,Kn as In,Kt as Ln,Mr as Rn,Nr as zn,Or as Bn,Pr as Vn,Qn as Hn,T as Un,Tr as Wn,Wt as Gn,Xn as Kn,Yn as qn,Zn as Jn,_r as Yn,ga as Xn,gr as Zn,ha as Qn,hr as $n,ir as er,jr as tr,kr as nr,li as rr,mr as ir,qn as ar,qt as or,ui as sr,va as cr}from"./main-VfCRP294.js";import{i as lr,n as ur,r as dr}from"./ConnectionDiagnosisDetails-Q0M5gCCf.js";import{t as fr}from"./FoldedSettingsSection-RYq8GTvV.js";var Z=n(),pr=[{scope:f,title:`View environment`,description:`Read threads, status, checkpoints, and configuration.`},{scope:fe,title:`Operate tasks`,description:`Start, update, and stop tasks.`},{scope:i,title:`Change environment settings`,description:`Edit environment preferences and keybindings.`},{scope:S,title:`Manage providers`,description:`Configure, install, sign in to, and update providers and usage sources.`},{scope:d,title:`Maintain environment`,description:`Update the server and control environment processes.`},{scope:C,title:`Control previews`,description:`Open browser previews and host browser automation.`},{scope:c,title:`View diagnostics and usage`,description:`Read process diagnostics, resource history, and usage totals.`},{scope:he,title:`View terminals`,description:`Read existing terminal output and status.`},{scope:le,title:`Use terminals`,description:`Create terminals and send input to running shells.`},{scope:te,title:`Change source control`,description:`Commit, push, manage branches and repositories, and change pull requests.`},{scope:y,title:`Read files`,description:`Browse host files, search workspaces, and inspect local changes.`},{scope:x,title:`Write files`,description:`Edit workspace files and save plans to disk.`},{scope:m,title:`View access`,description:`Inspect pairing links and authorized clients.`},{scope:Te,title:`Manage access`,description:`Issue and revoke credentials for other clients.`},{scope:E,title:`View relay`,description:`Inspect managed relay connectivity.`},{scope:_,title:`Manage relay`,description:`Change managed tunnel connectivity.`}],Q=e(r(),1);function mr(e){let t=(0,Z.c)(4),{environmentId:n,connected:r,routeContext:i}=e,a=i!==void 0&&i,o=ut(n),s;return t[0]!==r||t[1]!==a||t[2]!==o?(s=r&&!o.hasError&&!o.isPending&&o.data?.authenticated?(0,Q.jsxs)(`div`,{className:`space-y-3 py-3 text-xs`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:a?`These permissions apply to your active route. Other routes may have different permissions.`:`These permissions apply to this client’s current connection.`}),(0,Q.jsx)(`ul`,{className:`grid gap-x-6 gap-y-2 sm:grid-cols-2`,children:pr.map(e=>{let{scope:t,title:n}=e;return(0,Q.jsxs)(`li`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsx)(`span`,{children:n}),(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:R(o.data,t)?`Allowed`:`Not granted`})]},t)})})]}):(0,Q.jsx)(`p`,{className:`py-3 text-xs text-muted-foreground`,children:`Permissions not checked. Connect to this environment to view this session’s permissions.`}),t[0]=r,t[1]=a,t[2]=o,t[3]=s):s=t[3],s}var $=e(t(),1);function hr(e,t){let n=new URL(e);return n.pathname=`/pair`,Ue(n,t).toString()}function gr(e,t){return new URL(e).protocol===`https:`?U({host:e,token:t}):null}function _r(){let e=(0,Z.c)(48),t=window.desktopBridge?.setLocalEnvironmentEnabled,[n]=(0,$.useState)(vr),[r,i]=(0,$.useState)(!1),[a,o]=(0,$.useState)(!1),[s,c]=(0,$.useState)(null);if(!t)return null;let l;e[0]===n?l=e[1]:(l=async()=>{o(!0),c(null);try{await t(!n)}catch(e){let t=e;c(t instanceof Error?t.message:`Couldn't change this setting.`),o(!1)}},e[0]=n,e[1]=l);let u=l,d;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=er(`local-environment`),e[2]=d):d=e[2];let f=n?`Run agents on this computer. Turn off to use P4 Code only with remote environments.`:`Turned off. Agents only run in remote environments.`,p;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>i(!0),e[3]=p):p=e[3];let m;e[4]!==n||e[5]!==a?(m=(0,Q.jsx)(cr,{checked:n,disabled:a,onCheckedChange:p,"aria-label":`Local environment`}),e[4]=n,e[5]=a,e[6]=m):m=e[6];let h;e[7]!==f||e[8]!==m?(h=(0,Q.jsx)(un,{...d,description:f,control:m}),e[7]=f,e[8]=m,e[9]=h):h=e[9];let g;e[10]===a?g=e[11]:(g=e=>{a||(i(e),e||c(null))},e[10]=a,e[11]=g);let _=n?`Turn off local environment?`:`Turn on local environment?`,v;e[12]===_?v=e[13]:(v=(0,Q.jsx)(Nn,{children:_}),e[12]=_,e[13]=v);let y=n?`P4 Code will restart without running a server on this computer. Any agents and terminals running here will stop, and other devices will no longer be able to connect to this computer. Your projects, history, and remote environments are unaffected.`:`P4 Code will restart and start running a server on this computer again.`,b;e[14]===y?b=e[15]:(b=(0,Q.jsx)(Rn,{children:y}),e[14]=y,e[15]=b);let x;e[16]!==b||e[17]!==v?(x=(0,Q.jsxs)(Vn,{children:[v,b]}),e[16]=b,e[17]=v,e[18]=x):x=e[18];let S;e[19]===s?S=e[20]:(S=s?(0,Q.jsx)(`p`,{className:`px-6 pb-4 text-sm text-destructive`,children:s}):null,e[19]=s,e[20]=S);let C;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(I,{variant:`outline`}),e[21]=C):C=e[21];let w;e[22]===a?w=e[23]:(w=(0,Q.jsx)(tr,{disabled:a,render:C,children:`Cancel`}),e[22]=a,e[23]=w);let T=n?`destructive`:`default`,E;e[24]===u?E=e[25]:(E=()=>void u(),e[24]=u,e[25]=E);let D;e[26]!==n||e[27]!==a?(D=a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Restarting…`]}):n?`Restart and turn off`:`Restart and turn on`,e[26]=n,e[27]=a,e[28]=D):D=e[28];let O;e[29]!==a||e[30]!==T||e[31]!==E||e[32]!==D?(O=(0,Q.jsx)(I,{variant:T,disabled:a,onClick:E,children:D}),e[29]=a,e[30]=T,e[31]=E,e[32]=D,e[33]=O):O=e[33];let k;e[34]!==w||e[35]!==O?(k=(0,Q.jsxs)(zn,{children:[w,O]}),e[34]=w,e[35]=O,e[36]=k):k=e[36];let A;e[37]!==x||e[38]!==S||e[39]!==k?(A=(0,Q.jsxs)(jn,{children:[x,S,k]}),e[37]=x,e[38]=S,e[39]=k,e[40]=A):A=e[40];let j;e[41]!==r||e[42]!==A||e[43]!==g?(j=(0,Q.jsx)(kn,{open:r,onOpenChange:g,children:A}),e[41]=r,e[42]=A,e[43]=g,e[44]=j):j=e[44];let M;return e[45]!==j||e[46]!==h?(M=(0,Q.jsxs)(Q.Fragment,{children:[h,j]}),e[45]=j,e[46]=h,e[47]=M):M=e[47],M}function vr(){return!Re()}function yr(e){return e.serverConfig===null?`Connect to this environment to change its icon.`:e.serverConfig.environment.capabilities.environmentIcon===!0?e.operateAccess===`granted`?null:`Your session on this environment cannot change its settings.`:`This environment's server is too old to keep an icon. Update it to choose one.`}function br(e){let t=(0,Z.c)(27),{environmentId:n,serverConfig:r}=e,i=rt(n),o=dt(n,`settings:write`)?`granted`:`denied`,s;t[0]!==o||t[1]!==r?(s=yr({serverConfig:r,operateAccess:o}),t[0]=o,t[1]=r,t[2]=s):s=t[2];let c=s,u=r?.environment.platform.machine??`server`,d;t[3]===r?d=t[4]:(d=l(r),t[3]=r,t[4]=d);let f=d,p;t[5]===f?p=t[6]:(p=(0,Q.jsxs)(se,{children:[(0,Q.jsx)(sn,{kind:f}),`Icon`]}),t[5]=f,t[6]=p);let m;t[7]===c?m=t[8]:(m=c===null?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(a,{disabled:!0,className:`whitespace-normal`,children:c}),(0,Q.jsx)(j,{})]}),t[7]=c,t[8]=m);let h;t[9]!==u||t[10]!==c||t[11]!==i?(h=e=>{c===null&&v(e)&&i({environmentIcon:e===u?null:e})},t[9]=u,t[10]=c,t[11]=i,t[12]=h):h=t[12];let g;t[13]!==u||t[14]!==c||t[15]!==r?.environment?(g=Ce.map(e=>(0,Q.jsx)(me,{value:e,disabled:c!==null,children:(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(sn,{kind:e,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:X[e]}),e===u?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:r?.environment.platform.machine?`detected`:`default`}):null]})},e)),t[13]=u,t[14]=c,t[15]=r?.environment,t[16]=g):g=t[16];let _;t[17]!==f||t[18]!==h||t[19]!==g?(_=(0,Q.jsx)(ce,{value:f,onValueChange:h,children:g}),t[17]=f,t[18]=h,t[19]=g,t[20]=_):_=t[20];let y;t[21]!==m||t[22]!==_?(y=(0,Q.jsxs)(F,{children:[m,_]}),t[21]=m,t[22]=_,t[23]=y):y=t[23];let b;return t[24]!==p||t[25]!==y?(b=(0,Q.jsxs)(ge,{children:[p,y]}),t[24]=p,t[25]=y,t[26]=b):b=t[26],b}function xr(e){let t=(0,Z.c)(31),{environment:n,onAddRoute:r}=e,i=H(n.entry),a=i.map(Cr),[o,s]=(0,$.useState)(null),c=o!==null&&o.length===a.length&&o.some((e,t)=>e!==a[t])?[...o]:a,l=new Map(i.map(Sr)),u=c.flatMap(e=>l.get(e)??[]),d=ft(n.environmentId),f;t[0]!==n.connection||t[1]!==d._tag||t[2]!==d.value?(f=d._tag===`Some`&&n.connection.phase===`connected`?B(d.value.target):null,t[0]=n.connection,t[1]=d._tag,t[2]=d.value,t[3]=f):f=t[3];let p=f,m=mt(ct.reorderRoutes,`Reorder routes`),h=mt(ct.removeRoute,`Remove route`),g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g={activationConstraint:{distance:4}},t[4]=g):g=t[4];let _;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_={coordinateGetter:rn},t[5]=_):_=t[5];let v=qt(Qt(Zt,g),Qt(Xt,_)),y;t[6]!==n.environmentId||t[7]!==h?(y=async e=>{let t=De(e);await it(`Remove ${je(e)} route?${t===null?``:`\n${t}`}`,{variant:`destructive`})===!0&&await h({environmentId:n.environmentId,routeId:B(e.target)})},t[6]=n.environmentId,t[7]=h,t[8]=y):y=t[8];let b=y,x=e=>{if(e.over===null||e.active.id===e.over.id)return;let t=Jt(c,c.indexOf(String(e.active.id)),c.indexOf(String(e.over.id)));s(t),m({environmentId:n.environmentId,routeIds:t}).then(e=>{e._tag===`Failure`&&s(null)})},S=an,C=tn,w;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(w=[sr,rr],t[9]=w):w=t[9];let E=$t,D=en,O=`Routes to ${n.label}, preferred first`,k=u.map((e,t)=>(0,Q.jsx)(wr,{route:e,position:t+1,inUse:B(e.target)===p,removable:u.length>1&&!V(e),onRemove:()=>void b(e)},B(e.target))),A;t[10]!==k||t[11]!==O?(A=(0,Q.jsx)(`ol`,{"aria-label":O,children:k}),t[10]=k,t[11]=O,t[12]=A):A=t[12];let j;t[13]!==E||t[14]!==c||t[15]!==A||t[16]!==D?(j=(0,Q.jsx)(E,{items:c,strategy:D,children:A}),t[13]=E,t[14]=c,t[15]=A,t[16]=D,t[17]=j):j=t[17];let M;t[18]!==S||t[19]!==x||t[20]!==v||t[21]!==j||t[22]!==C||t[23]!==w?(M=(0,Q.jsx)(S,{sensors:v,collisionDetection:C,modifiers:w,onDragEnd:x,children:j}),t[18]=S,t[19]=x,t[20]=v,t[21]=j,t[22]=C,t[23]=w,t[24]=M):M=t[24];let N;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(T,{className:`size-3`}),t[25]=N):N=t[25];let P;t[26]===r?P=t[27]:(P=(0,Q.jsx)(`div`,{className:`-ml-1.5 pt-1`,children:(0,Q.jsxs)(I,{size:`xs`,variant:`ghost-muted`,onClick:r,children:[N,`Add route`]})}),t[26]=r,t[27]=P);let F;return t[28]!==M||t[29]!==P?(F=(0,Q.jsxs)(`div`,{className:`mt-2 border-t border-border/50 py-2`,children:[M,P]}),t[28]=M,t[29]=P,t[30]=F):F=t[30],F}function Sr(e){return[B(e.target),e]}function Cr(e){return B(e.target)}function wr(e){let t=(0,Z.c)(43),{route:n,position:r,inUse:i,removable:a,onRemove:o}=e,s;t[0]===n.target?s=t[1]:(s=B(n.target),t[0]=n.target,t[1]=s);let c=s,l;t[2]===n?l=t[3]:(l=je(n),t[2]=n,t[3]=l);let u=l,d;t[4]===n?d=t[5]:(d=De(n),t[4]=n,t[5]=d);let f=d,p;t[6]===c?p=t[7]:(p={id:c},t[6]=c,t[7]=p);let{attributes:m,listeners:h,setNodeRef:g,setActivatorNodeRef:_,transform:v,transition:y,isDragging:b}=Yt(p),x;t[8]===v?x=t[9]:(x=on.Translate.toString(v),t[8]=v,t[9]=x);let S;t[10]!==x||t[11]!==y?(S={transform:x,transition:y},t[10]=x,t[11]=y,t[12]=S):S=t[12];let C=b&&`relative z-10 rounded-md bg-background shadow-md`,w;t[13]===C?w=t[14]:(w=_e(`flex items-center gap-2 py-2`,C),t[13]=C,t[14]=w);let T;t[15]===i?T=t[16]:(T=i?(0,Q.jsx)(`span`,{className:`rounded-sm bg-success/12 px-1 text-2xs font-normal text-success-foreground`,children:`In use`}):null,t[15]=i,t[16]=T);let E;t[17]!==u||t[18]!==T?(E=(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[u,T]}),t[17]=u,t[18]=T,t[19]=E):E=t[19];let D;t[20]!==f||t[21]!==n?(D=f===null?null:(0,Q.jsxs)(`p`,{className:`truncate text-2xs text-muted-foreground`,children:[f,V(n)?` · found automatically`:``]}),t[20]=f,t[21]=n,t[22]=D):D=t[22];let O;t[23]!==E||t[24]!==D?(O=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[E,D]}),t[23]=E,t[24]=D,t[25]=O):O=t[25];let k=`Reorder ${u}, position ${r}`,A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(Ee,{className:`size-3.5`}),t[26]=A):A=t[26];let j;t[27]!==m||t[28]!==h||t[29]!==_||t[30]!==k?(j=(0,Q.jsx)(`button`,{type:`button`,ref:_,...m,...h,"aria-label":k,className:`flex size-6 shrink-0 cursor-grab touch-none items-center justify-center rounded text-muted-foreground/70 outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring active:cursor-grabbing`,children:A}),t[27]=m,t[28]=h,t[29]=_,t[30]=k,t[31]=j):j=t[31];let M;t[32]!==u||t[33]!==o||t[34]!==a?(M=a?(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(I,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":`Remove ${u} route`,onClick:o}),children:(0,Q.jsx)(pe,{className:`size-3`})}),(0,Q.jsx)(vt,{side:`top`,children:`Remove route`})]}):null,t[32]=u,t[33]=o,t[34]=a,t[35]=M):M=t[35];let N;return t[36]!==g||t[37]!==O||t[38]!==j||t[39]!==M||t[40]!==S||t[41]!==w?(N=(0,Q.jsxs)(`li`,{ref:g,style:S,className:w,children:[O,j,M]}),t[36]=g,t[37]=O,t[38]=j,t[39]=M,t[40]=S,t[41]=w,t[42]=N):N=t[42],N}function Tr(e){let t=e.username?`${e.username}@${e.hostname}`:e.hostname;return e.port?`${t}:${e.port}`:t}function Er(e,t=null){let{entry:n}=e;if(n.target._tag===`PrimaryConnectionTarget`)return`This machine`;let r=H(n);if(r.length>1){let e=t===null?void 0:r.find(e=>B(e.target)===B(t));return e===void 0?je(r[0]):`via ${je(e)}`}return e.relayManaged?`P4 Connect`:Ge(n.target)?`WSL`:n.target._tag===`SshConnectionTarget`&&k(n.profile)&&n.profile.value._tag===`SshConnectionProfile`?`SSH ${Tr(n.profile.value.target)}`:e.displayUrl??`Remote link`}function Dr(e){let t=(0,Z.c)(23),{kind:n,label:r,subtitle:i,below:a,detail:o,dimmed:s,className:c,children:l}=e,u=s!==void 0&&s&&`opacity-60`,d;t[0]!==c||t[1]!==u?(d=_e(`grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 px-3 py-2.5 sm:px-4`,u,c),t[0]=c,t[1]=u,t[2]=d):d=t[2];let f;t[3]===n?f=t[4]:(f=(0,Q.jsx)(sn,{"aria-hidden":!0,kind:n,className:`size-4 text-muted-foreground`}),t[3]=n,t[4]=f);let p;t[5]===r?p=t[6]:(p=(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground`,children:r}),t[5]=r,t[6]=p);let m;t[7]===i?m=t[8]:(m=(0,Q.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:i}),t[7]=i,t[8]=m);let h;t[9]!==a||t[10]!==p||t[11]!==m?(h=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[p,m,a]}),t[9]=a,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]===l?g=t[14]:(g=(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:l}),t[13]=l,t[14]=g);let _;t[15]===o?_=t[16]:(_=o?(0,Q.jsx)(`div`,{className:`col-span-2 col-start-2 min-w-0`,children:o}):null,t[15]=o,t[16]=_);let v;return t[17]!==d||t[18]!==f||t[19]!==h||t[20]!==g||t[21]!==_?(v=(0,Q.jsxs)(`div`,{className:d,children:[f,h,g,_]}),t[17]=d,t[18]=f,t[19]=h,t[20]=g,t[21]=_,t[22]=v):v=t[22],v}var Or=[{value:100,label:`Prefer`},{value:50,label:`Normal`},{value:25,label:`Less often`},{value:0,label:`Manual only`}];function kr(e){return e===void 0||e===50?50:e===0?0:e<50?25:100}function Ar(e){return Or.find(t=>t.value===e).label}function jr(e,t){let n=e.flatMap(e=>{let n=kr(t[e.environmentId]);return n===50?[]:[`${e.label} ${Ar(n).toLowerCase()}`]});return n.length===0?null:n.join(` · `)}function Mr(e){let t=(0,Z.c)(27),{environments:n}=e,r=at(),i=q(),a=ot();if(n.length<2)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=er(`load-balancing`),t[0]=o):o=t[0];let{id:s,title:c}=o,u;t[1]!==n||t[2]!==r.loadBalancingEnabled||t[3]!==r.loadBalancingWeights?(u=r.loadBalancingEnabled?jr(n,r.loadBalancingWeights):`Off`,t[1]=n,t[2]=r.loadBalancingEnabled,t[3]=r.loadBalancingWeights,t[4]=u):u=t[4];let d=!i,f;t[5]===a?f=t[6]:(f=e=>a({loadBalancingEnabled:e}),t[5]=a,t[6]=f);let p;t[7]!==r.loadBalancingEnabled||t[8]!==d||t[9]!==f?(p=(0,Q.jsx)(cr,{"aria-label":`Automatically balance load`,checked:r.loadBalancingEnabled,disabled:d,onCheckedChange:f}),t[7]=r.loadBalancingEnabled,t[8]=d,t[9]=f,t[10]=p):p=t[10];let m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(`p`,{className:`px-3 py-2.5 text-xs text-muted-foreground sm:px-4`,children:`New threads in shared projects start on the machine with the most free CPU and memory, weighted by each machine's preference.`}),t[11]=m):m=t[11];let h;if(t[12]!==n||t[13]!==r.loadBalancingEnabled||t[14]!==r.loadBalancingWeights||t[15]!==i||t[16]!==a){let e;t[18]!==r.loadBalancingEnabled||t[19]!==r.loadBalancingWeights||t[20]!==i||t[21]!==a?(e=e=>(0,Q.jsx)(Dr,{kind:l(e.serverConfig),label:e.label,subtitle:Er(e),children:(0,Q.jsxs)(Ze,{items:Or,value:kr(r.loadBalancingWeights[e.environmentId]),disabled:!i||!r.loadBalancingEnabled,onValueChange:t=>{t!==null&&a({loadBalancingWeights:{...r.loadBalancingWeights,[e.environmentId]:t}})},children:[(0,Q.jsx)(Xe,{size:`xs`,className:`w-32`,"aria-label":`${e.label} load preference`,children:(0,Q.jsx)(Je,{})}),(0,Q.jsx)(Ye,{align:`end`,alignItemWithTrigger:!1,children:Or.map(Nr)})]})},e.environmentId),t[18]=r.loadBalancingEnabled,t[19]=r.loadBalancingWeights,t[20]=i,t[21]=a,t[22]=e):e=t[22],h=n.map(e),t[12]=n,t[13]=r.loadBalancingEnabled,t[14]=r.loadBalancingWeights,t[15]=i,t[16]=a,t[17]=h}else h=t[17];let g;return t[23]!==u||t[24]!==p||t[25]!==h?(g=(0,Q.jsxs)(fr,{id:s,title:c,summary:u,control:p,children:[m,h]}),t[23]=u,t[24]=p,t[25]=h,t[26]=g):g=t[26],g}function Nr(e){let{value:t,label:n}=e;return(0,Q.jsx)(qe,{value:t,children:n},t)}var Pr=[{value:`off`,label:`Off`},{value:`read`,label:`Read PRs`},{value:`read-write`,label:`Read and act`}],Fr={"read-write":`read and act`,read:`read PRs`};function Ir(e){let t=[`read-write`,`read`].flatMap(t=>{let n=e.filter(e=>e.permission===t);return n.length===0?[]:[`${n.map(e=>e.label).join(`, `)} ${Fr[t]}`]});return t.length===0?null:t.join(` · `)}function Lr(e){let t=(0,Z.c)(19),{environments:n}=e,r=be(ct.githubRoutingPermissionsValueAtom),i=be(ct.catalogValueAtom),a=mt(ct.setGitHubRoutingPermission),[o,s]=(0,$.useState)(!1);if(n.length<2)return null;let c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=er(`github-routing`),t[0]=c):c=t[0];let{id:u,title:d}=c,f;t[1]!==n||t[2]!==r?(f=Ir(n.map(e=>({label:e.label,permission:Ne(e.entry,r)})))??`Off`,t[1]=n,t[2]=r,t[3]=f):f=t[3];let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`p`,{className:`px-3 py-2.5 text-xs text-muted-foreground sm:px-4`,children:`Machines you trust here can read PR data through each other's GitHub access. Enable both machines. Read and act may use broader permissions than the machine that owns them. This applies only to this device.`}),t[4]=p):p=t[4];let m;if(t[5]!==i||t[6]!==n||t[7]!==r||t[8]!==o||t[9]!==a){let e;t[11]!==i||t[12]!==r||t[13]!==o||t[14]!==a?(e=e=>(0,Q.jsx)(Dr,{kind:l(e.serverConfig),label:e.label,subtitle:Er(e),children:(0,Q.jsxs)(Ze,{items:Pr,value:Ne(e.entry,r),disabled:!i.isReady||o||ke(e.entry)===null,onValueChange:t=>{t!==null&&(s(!0),a({environmentId:e.environmentId,permission:t}).then(e=>{s(!1),e._tag===`Failure`&&K.add({type:`error`,title:`Could not save GitHub routing permission`})}))},children:[(0,Q.jsx)(Xe,{size:`xs`,className:`w-32`,"aria-label":`${e.label} GitHub routing`,children:(0,Q.jsx)(Je,{})}),(0,Q.jsx)(Ye,{align:`end`,alignItemWithTrigger:!1,children:Pr.map(Rr)})]})},e.environmentId),t[11]=i,t[12]=r,t[13]=o,t[14]=a,t[15]=e):e=t[15],m=n.map(e),t[5]=i,t[6]=n,t[7]=r,t[8]=o,t[9]=a,t[10]=m}else m=t[10];let h;return t[16]!==f||t[17]!==m?(h=(0,Q.jsxs)(fr,{id:u,title:d,summary:f,children:[p,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}function Rr(e){let{value:t,label:n}=e;return(0,Q.jsx)(qe,{value:t,children:n},t)}function zr(e){let t=(0,Z.c)(26),{environmentLabel:n,onCancel:r,onConfirm:i}=e,a=Mt(),[o,s]=(0,$.useState)(n);n!==null&&n!==o&&s(n);let c=a.open,l=n!==null,u;t[0]===r?u=t[1]:(u=e=>{e||r()},t[0]=r,t[1]=u);let d;t[2]===o?d=t[3]:(d=(0,Q.jsxs)(Nn,{children:[`Remove `,o,` from this device?`]}),t[2]=o,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(Rn,{children:`This forgets its pairing, credentials, and cached threads here.`}),t[4]=f):f=t[4];let p;t[5]!==r||t[6]!==c?(p=c?(0,Q.jsx)(ne,{onClick:()=>{r(),c()},children:`P4 Connect settings`}):`P4 Connect settings`,t[5]=r,t[6]=c,t[7]=p):p=t[7];let m;t[8]===p?m=t[9]:(m=(0,Q.jsxs)(Rn,{children:[`It stays on your P4 Connect account and keeps its host space. Deregister it in`,` `,p,` `,`to free it.`]}),t[8]=p,t[9]=m);let h;t[10]!==d||t[11]!==m?(h=(0,Q.jsxs)(Vn,{children:[d,f,m]}),t[10]=d,t[11]=m,t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(tr,{render:(0,Q.jsx)(I,{variant:`outline`}),children:`Cancel`}),t[13]=g):g=t[13];let _;t[14]===i?_=t[15]:(_=(0,Q.jsxs)(zn,{children:[g,(0,Q.jsx)(I,{variant:`destructive`,onClick:i,children:`Remove from this device`})]}),t[14]=i,t[15]=_);let v;t[16]!==h||t[17]!==_?(v=(0,Q.jsxs)(jn,{children:[h,_]}),t[16]=h,t[17]=_,t[18]=v):v=t[18];let y;t[19]!==l||t[20]!==v||t[21]!==u?(y=(0,Q.jsx)(kn,{open:l,onOpenChange:u,children:v}),t[19]=l,t[20]=v,t[21]=u,t[22]=y):y=t[22];let b;return t[23]!==a.portals||t[24]!==y?(b=(0,Q.jsxs)(Q.Fragment,{children:[y,a.portals]}),t[23]=a.portals,t[24]=y,t[25]=b):b=t[25],b}var Br={pairingLinks:[],clientSessions:[]};function Vr(e,t,n){let r=n(t);return[...e.filter(e=>n(e)!==r),t]}function Hr(e,t){switch(t.type){case`snapshot`:return t.payload;case`pairingLinkUpserted`:return{...e,pairingLinks:Vr(e.pairingLinks,t.payload,e=>e.id)};case`pairingLinkRemoved`:return{...e,pairingLinks:e.pairingLinks.filter(e=>e.id!==t.payload.id)};case`clientUpserted`:return{...e,clientSessions:Vr(e.clientSessions,t.payload,e=>e.sessionId)};case`clientRemoved`:return{...e,clientSessions:e.clientSessions.filter(e=>e.sessionId!==t.payload.sessionId)}}}function Ur(e,t){let n=Hr(e,t);return[n,[{version:1,revision:t.revision,type:`snapshot`,payload:n}]]}function Wr(e){return{accessChanges:Oe(e,{label:`environment-data:server:auth-access-changes`,subscribe:e=>Le(b.subscribeAuthAccess,{}).pipe(oe(()=>Br,Ur))})}}var Gr=Wr(W),Kr=3e4,qr=class extends P()(`DesktopNetworkAccessUnavailableError`,{}){get message(){return`Desktop network access is unavailable.`}},Jr=class extends P()(`DesktopServerExposureStateLoadError`,{cause:u()}){get message(){return`Failed to load desktop server exposure state.`}},Yr=class extends P()(`DesktopAdvertisedEndpointsLoadError`,{cause:u()}){get message(){return`Failed to load advertised desktop endpoints.`}};function Xr(){return typeof window>`u`?void 0:window.desktopBridge}function Zr(e){let t=s(`loadDesktopNetworkAccess`)(function*(){let t=e();if(!t)return yield*new qr;let[n,r]=yield*we([O({try:()=>t.getServerExposureState(),catch:e=>new Jr({cause:e})}),O({try:()=>t.getAdvertisedEndpoints(),catch:e=>new Yr({cause:e})})],{concurrency:`unbounded`});return{advertisedEndpoints:r,serverExposureState:n}});return M(t()).pipe(z({staleTime:Kr,revalidateOnMount:!0}),ie,de(`desktop:network-access`))}var Qr=Zr(Xr);function $r(){D.refresh(Qr)}function ei(e,t){let n=t.trim().toLowerCase();if(n.length===0)return e;let r=[],i=[];for(let t of e){let e=t.alias.toLowerCase();e.startsWith(n)?r.push(t):e.includes(n)&&i.push(t)}return[...r,...i]}var ti=class extends P()(`DesktopSshDiscoveryUnavailableError`,{}){get message(){return`Desktop SSH host discovery is unavailable.`}},ni=class extends P()(`DesktopSshDiscoveryError`,{cause:u()}){get message(){return`Failed to discover SSH hosts.`}};function ri(){return typeof window>`u`?void 0:window.desktopBridge}function ii(e){let t=s(`discoverDesktopSshHosts`)(function*(){let t=e();return t?yield*O({try:()=>t.discoverSshHosts(),catch:e=>new ni({cause:e})}):yield*new ti});return M(t()).pipe(z({staleTime:3e4,revalidateOnMount:!0}),ie,de(`desktop:ssh-hosts`))}var ai=ii(ri),oi=443,si=[],ci=[],li=`backend:default-wsl`,ui=`backend:wsl-off`,di=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function fi(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:di.format(t)}function pi(e){let t=(0,Z.c)(13),{scopes:n,label:r}=e,i=`${n.length} ${n.length===1?`scope`:`scopes`}`,a=`${r}: show ${i}`,o;t[0]===a?o=t[1]:(o=(0,Q.jsx)(`button`,{type:`button`,"aria-label":a,className:`cursor-help underline decoration-border underline-offset-2 outline-hidden hover:text-foreground focus-visible:text-foreground`}),t[0]=a,t[1]=o);let s;t[2]!==i||t[3]!==o?(s=(0,Q.jsx)(Wt,{openOnHover:!0,delay:250,closeDelay:100,render:o,children:i}),t[2]=i,t[3]=o,t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(`p`,{className:`mb-1 font-medium`,children:`Granted scopes`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=n.map(mi),t[6]=n,t[7]=l);let u;t[8]===l?u=t[9]:(u=(0,Q.jsxs)(Ut,{side:`top`,align:`start`,tooltipStyle:!0,className:`w-max max-w-80 whitespace-normal`,children:[c,(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:l})]}),t[8]=l,t[9]=u);let d;return t[10]!==s||t[11]!==u?(d=(0,Q.jsxs)(Gt,{children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function mi(e){return(0,Q.jsx)(`code`,{className:`font-mono text-foreground/85`,children:e},e)}function hi(e){let t=e.host.trim();if(t.length===0)throw Error(`SSH host or alias is required.`);let n=t,r=e.username.trim()||null,i=null,a=n.lastIndexOf(`@`);if(a>0){let e=n.slice(0,a).trim();n=n.slice(a+1).trim(),!r&&e.length>0&&(r=e)}let o=/^\[([^\]]+)\](?::(\d+))?$/u.exec(n);if(o)n=o[1].trim(),o[2]&&(i=Number.parseInt(o[2],10));else{let e=n.split(`:`);e.length===2&&/^\d+$/u.test(e[1]??``)&&(n=e[0].trim(),i=Number.parseInt(e[1],10))}let s=e.port.trim();if(s.length>0&&(i=Number.parseInt(s,10)),n.length===0)throw Error(`SSH host or alias is required.`);if(i!==null&&(!Number.isInteger(i)||i<=0||i>65535))throw Error(`SSH port must be between 1 and 65535.`);return{alias:n,hostname:n,username:r,port:i}}function gi(e){let t=e.trim();if(!t)return null;try{let e=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//u.test(t)||t.startsWith(`//`)?t:`https://${t}`,n=new URL(e,window.location.origin),r=Be(n);if(r)return{host:r.host,pairingCode:r.token};let i=Ke(n);return i?{host:n.origin,pairingCode:i}:null}catch{return null}}function _i(e){let t=gi(e.host);if(t)return t;let n=e.host.trim(),r=e.pairingCode.trim();if(!n)throw Error(`Enter a backend host.`);if(!r)throw Error(`Enter a pairing code.`);return{host:n,pairingCode:r}}function vi(e){let t=`Failed to connect SSH host.`;return(e instanceof Error?e.message:t).replace(/^Error invoking remote method 'desktop:ensure-ssh-environment':\s*/u,``).replace(/^Ssh[A-Za-z]+Error:\s*/u,``).trim()||t}var yi=`first:rounded-t-xl last:rounded-b-xl px-3 py-2.5 sm:px-4`;function bi(e){return Ln}function xi(e,t){return e===`endpoint-rail`?_e(`relative first:rounded-t-xl last:rounded-b-xl px-3 py-3 sm:px-4`,!t&&`bg-muted/15`):_e(yi,!t&&`bg-muted/24`)}function Si(e){return[...e].toSorted((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime())}function Ci(e,t){return[`${e.length} ${e.length===1?`client`:`clients`}`,t.length>0?`${t.length} ${t.length===1?`pairing link`:`pairing links`}`:null].filter(e=>e!==null).join(` · `)}function wi(e){return[...e].toSorted((e,t)=>e.current===t.current?e.connected===t.connected?new Date(t.issuedAt).getTime()-new Date(e.issuedAt).getTime():e.connected?-1:1:e.current?-1:1)}function Ti(e){return{...e,scopes:e.permissions??e.scopes,createdAt:ee(e.createdAt),expiresAt:ee(e.expiresAt)}}function Ei(e){return{...e,scopes:e.permissions??e.scopes,issuedAt:ee(e.issuedAt),expiresAt:ee(e.expiresAt),lastConnectedAt:e.lastConnectedAt===null?null:ee(e.lastConnectedAt)}}function Di(e,t){let n=e.filter(e=>e.status!==`unavailable`);if(t){let e=n.find(e=>ki(e)===t);if(e)return e}return n.find(e=>e.isDefault)??n.find(e=>e.reachability!==`loopback`)??n.find(e=>e.compatibility.hostedHttpsApp===`compatible`)??null}function Oi(e){return e.id.startsWith(`tailscale-magicdns:`)}function ki(e){if(e.id.startsWith(`desktop-loopback:`))return`desktop-core:loopback:http`;if(e.id.startsWith(`desktop-lan:`))return`desktop-core:lan:http`;if(e.id.startsWith(`tailscale-ip:`))return`tailscale:ip:http`;if(Oi(e))return`tailscale:magicdns:https`;let t=`unknown`;try{t=new URL(e.httpBaseUrl).protocol.replace(/:$/u,``)}catch{}return`${e.provider.id}:${e.reachability}:${t}:${e.label}`}function Ai(e,t){return e.compatibility.hostedHttpsApp===`compatible`?gr(e.httpBaseUrl,t)??hr(e.httpBaseUrl,t):hr(e.httpBaseUrl,t)}function ji(e){let t=new URL(`/pair`,window.location.href);return Ue(t,e).toString()}function Mi(e){try{let t=new URL(e);return t.pathname===`/pair`&&t.searchParams.has(`host`)}catch{return!1}}function Ni(e,t){if(Mi(t))return`Opens the hosted app, no install needed`;switch(e.reachability){case`lan`:return`Devices on the same network`;case`private-network`:return`Devices on your private network`;case`public`:return`Reachable from anywhere`;case`loopback`:return`Clients on this machine`}}var Pi=(0,$.memo)(function(e){let t=(0,Z.c)(135),{pairingLink:n,credential:r,endpointUrl:i,endpoints:a,defaultEndpointKey:s,presentation:c,revokingPairingLinkId:l,onRevoke:u,canRevoke:d}=e,f=c===void 0?`current`:c,p=pn(1e3),m=new Date(n.expiresAt).getTime(),[h,g]=(0,$.useState)(!1),[_,v]=(0,$.useState)(!1),[y,b]=(0,$.useState)(null),x=(0,$.useId)(),S;t[0]===r?S=t[1]:(S=r?ji(r):null,t[0]=r,t[1]=S);let C=S,w;t[2]!==r||t[3]!==i?(w=r&&i!=null&&i!==``?gr(i,r):null,t[2]=r,t[3]=i,t[4]=w):w=t[4];let T=w,E;if(t[5]!==r||t[6]!==s||t[7]!==a){let e=Di(a,s);E=e&&r?Ai(e,r):null,t[5]=r,t[6]=s,t[7]=a,t[8]=E}else E=t[8];let D=E,O;if(t[9]!==r||t[10]!==a){bb0:{let e=[];if(!r){O=e;break bb0}for(let t of a){if(t.status===`unavailable`)continue;let n=Ai(t,r);e.push({id:t.id,preferenceKey:ki(t),label:t.label,url:n,detail:Ni(t,n),qrShareable:ar(t)})}O=e}t[9]=r,t[10]=a,t[11]=O}else O=t[11];let k=O,A;t[12]!==r||t[13]!==C||t[14]!==D||t[15]!==i||t[16]!==T?(A=D??(r&&i!=null&&i!==``?T??hr(i,r):ze(window.location.hostname)?null:C),t[12]=r,t[13]=C,t[14]=D,t[15]=i,t[16]=T,t[17]=A):A=t[17];let j=A,[M,N]=(0,$.useState)(null),P=M??j??r??``,F=P!==r,ee=F&&Mi(P),te=k.find(e=>e.url===P)?.qrShareable??!0,ne=typeof window<`u`&&window.isSecureContext&&navigator.clipboard?.writeText!=null,re;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(re={onCopy:ra,onError:(e,t)=>{let{value:n,kind:r}=t;N(n),g(!0),K.add(Y({type:`error`,title:ne?r===`hosted-link`?`Could not copy hosted app link`:r===`link`?`Could not copy pairing URL`:`Could not copy pairing code`:`Clipboard copy unavailable`,description:ne?e.message:`Showing the full value instead.`}))}},t[18]=re):re=t[18];let{copyToClipboard:ie}=Qe(re),ae;t[19]===ie?ae=t[20]:(ae=(e,t)=>{ie(e,{value:e,kind:t})},t[19]=ie,t[20]=ae);let oe=ae,se=ia,ce;t[21]!==oe||t[22]!==r?(ce=()=>{r&&oe(r,`code`)},t[21]=oe,t[22]=r,t[23]=ce):ce=t[23];let le=ce,ue;t[24]===n.expiresAt?ue=t[25]:(ue=fi(n.expiresAt),t[24]=n.expiresAt,t[25]=ue);let de=ue,fe=n.label??`Pairing link`,L;t[26]!==s||t[27]!==k||t[28]!==y?(L=qn(k,y,s),t[26]=s,t[27]=k,t[28]=y,t[29]=L):L=t[29];let pe=L,me=pe?.url??j,he=pe?.qrShareable??!0;if(m<=p)return null;let ge;t[30]===f?ge=t[31]:(ge=bi(f),t[30]=f,t[31]=ge);let R;t[32]===n.createdAt?R=t[33]:(R=fi(n.createdAt),t[32]=n.createdAt,t[33]=R);let ve=`Link created at ${R}`,ye;t[34]===ve?ye=t[35]:(ye=(0,Q.jsx)(xn,{tooltipText:ve,dotClassName:`bg-warning`}),t[34]=ve,t[35]=ye);let be;t[36]===fe?be=t[37]:(be=(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:fe}),t[36]=fe,t[37]=be);let xe;t[38]!==ye||t[39]!==be?(xe=(0,Q.jsxs)(`div`,{className:`flex min-h-5 items-center gap-1.5`,children:[ye,be]}),t[38]=ye,t[39]=be,t[40]=xe):xe=t[40];let Se;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Q.jsx)(`span`,{}),t[41]=Se):Se=t[41];let z;t[42]!==p||t[43]!==n.expiresAt?(z=ht(n.expiresAt,p),t[42]=p,t[43]=n.expiresAt,t[44]=z):z=t[44];let Ce;t[45]===z?Ce=t[46]:(Ce=(0,Q.jsx)(_t,{render:Se,children:z}),t[45]=z,t[46]=Ce);let we;t[47]===de?we=t[48]:(we=(0,Q.jsx)(vt,{side:`top`,children:de}),t[47]=de,t[48]=we);let Te;t[49]!==Ce||t[50]!==we?(Te=(0,Q.jsxs)(yt,{children:[Ce,we]}),t[49]=Ce,t[50]=we,t[51]=Te):Te=t[51];let Ee;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Q.jsx)(`span`,{"aria-hidden":!0,children:` · `}),t[52]=Ee):Ee=t[52];let B;t[53]===n.scopes?B=t[54]:(B=(0,Q.jsx)(pi,{scopes:n.scopes,label:`Pairing link scopes`}),t[53]=n.scopes,t[54]=B);let De;t[55]!==Te||t[56]!==B?(De=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[Te,Ee,B]}),t[55]=Te,t[56]=B,t[57]=De):De=t[57];let Oe;t[58]!==r||t[59]!==j?(Oe=r?j===null?(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Copy the token and pair from another client using this backend's reachable host.`}):null:(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Create a new link to share from this client.`}),t[58]=r,t[59]=j,t[60]=Oe):Oe=t[60];let ke;t[61]!==xe||t[62]!==De||t[63]!==Oe?(ke=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[xe,De,Oe]}),t[61]=xe,t[62]=De,t[63]=Oe,t[64]=ke):ke=t[64];let Ae;t[65]!==_||t[66]!==x||t[67]!==j?(Ae=j&&ne?(0,Q.jsxs)(I,{size:`xs`,variant:`outline`,"aria-expanded":_,"aria-controls":x,onClick:()=>v(aa),children:[(0,Q.jsx)(o,{"aria-hidden":!0}),`Share`]}):null,t[65]=_,t[66]=x,t[67]=j,t[68]=Ae):Ae=t[68];let je=r!==void 0&&h,Me;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(Me=e=>{g(e),e||N(null)},t[69]=Me):Me=t[69];let Ne;t[70]!==r||t[71]!==le||t[72]!==j?(Ne=r?ne?j?null:(0,Q.jsx)(I,{size:`xs`,variant:`outline`,onClick:le,children:`Copy code`}):(0,Q.jsx)(Et,{render:(0,Q.jsx)(I,{size:`xs`,variant:`outline`}),children:j?`Show link`:`Show code`}):null,t[70]=r,t[71]=le,t[72]=j,t[73]=Ne):Ne=t[73];let Pe=F?ee?`Hosted app pairing link`:`Pairing link`:`Pairing code`,V;t[74]===Pe?V=t[75]:(V=(0,Q.jsx)(wt,{children:Pe}),t[74]=Pe,t[75]=V);let H=F?ee?`Clipboard copy is unavailable here. Open or manually copy this hosted app link on the device you want to connect.`:`Clipboard copy is unavailable here. Open or manually copy this full pairing URL on the device you want to connect.`:`Clipboard copy is unavailable here. Manually copy this code into another client.`,Fe;t[76]===H?Fe=t[77]:(Fe=(0,Q.jsx)(kt,{children:H}),t[76]=H,t[77]=Fe);let Ie;t[78]!==V||t[79]!==Fe?(Ie=(0,Q.jsxs)(Ct,{children:[V,Fe]}),t[78]=V,t[79]=Fe,t[80]=Ie):Ie=t[80];let Le=F?4:3,Re;t[81]!==P||t[82]!==Le?(Re=(0,Q.jsx)(bt,{readOnly:!0,value:P,rows:Le,onFocus:oa,onClick:sa}),t[81]=P,t[82]=Le,t[83]=Re):Re=t[83];let Be;t[84]!==te||t[85]!==F||t[86]!==P?(Be=F&&te?(0,Q.jsx)(`div`,{className:`flex justify-center rounded-xl border border-border/60 bg-muted/30 p-4`,children:(0,Q.jsx)(Un,{value:P,size:132,level:`M`,marginSize:2,title:`Pairing link — scan to open on another device`})}):null,t[84]=te,t[85]=F,t[86]=P,t[87]=Be):Be=t[87];let Ve;t[88]!==Re||t[89]!==Be?(Ve=(0,Q.jsxs)(Ot,{children:[Re,Be]}),t[88]=Re,t[89]=Be,t[90]=Ve):Ve=t[90];let He;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Q.jsx)(I,{variant:`outline`,onClick:()=>g(!1),children:`Done`}),t[91]=He):He=t[91];let Ue;t[92]===le?Ue=t[93]:(Ue=ne?(0,Q.jsx)(I,{variant:`outline`,onClick:le,children:`Copy code`}):null,t[92]=le,t[93]=Ue);let We;t[94]===Ue?We=t[95]:(We=(0,Q.jsxs)(Tt,{variant:`bare`,children:[He,Ue]}),t[94]=Ue,t[95]=We);let U;t[96]!==Ie||t[97]!==Ve||t[98]!==We?(U=(0,Q.jsxs)(At,{className:`max-w-md`,children:[Ie,Ve,We]}),t[96]=Ie,t[97]=Ve,t[98]=We,t[99]=U):U=t[99];let Ge;t[100]!==je||t[101]!==Ne||t[102]!==U?(Ge=(0,Q.jsxs)(jt,{open:je,onOpenChange:Me,children:[Ne,U]}),t[100]=je,t[101]=Ne,t[102]=U,t[103]=Ge):Ge=t[103];let Ke=!d||l===n.id,W;t[104]!==u||t[105]!==n.id?(W=()=>void u(n.id),t[104]=u,t[105]=n.id,t[106]=W):W=t[106];let qe=l===n.id?`Revoking…`:`Revoke`,Je;t[107]!==Ke||t[108]!==W||t[109]!==qe?(Je=(0,Q.jsx)(I,{size:`xs`,variant:`destructive-outline`,disabled:Ke,onClick:W,children:qe}),t[107]=Ke,t[108]=W,t[109]=qe,t[110]=Je):Je=t[110];let Ye;t[111]!==Ae||t[112]!==Ge||t[113]!==Je?(Ye=(0,Q.jsxs)(`div`,{className:`flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end`,children:[Ae,Ge,Je]}),t[111]=Ae,t[112]=Ge,t[113]=Je,t[114]=Ye):Ye=t[114];let Xe;t[115]!==ke||t[116]!==Ye?(Xe=(0,Q.jsxs)(`div`,{className:or,children:[ke,Ye]}),t[115]=ke,t[116]=Ye,t[117]=Xe):Xe=t[117];let Ze=_&&me!==null,G;t[118]!==he||t[119]!==oe||t[120]!==k||t[121]!==le||t[122]!==me||t[123]!==x||t[124]!==pe?.id?(G=me===null?null:(0,Q.jsxs)(`div`,{id:x,className:`mt-3 flex flex-col gap-4 border-t border-border/50 pt-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[k.length>1?(0,Q.jsxs)(`div`,{className:`space-y-1.5`,role:`radiogroup`,"aria-label":`Endpoint the pairing QR code and URL use`,children:[(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Reach this machine via`}),k.map(e=>{let t=e.id===pe?.id;return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,className:_e(`flex w-full items-baseline gap-2 rounded-lg border px-2.5 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,t?`border-foreground/60 bg-muted/30`:`border-border/50 hover:bg-muted/20`),onClick:()=>b(e.id),children:[(0,Q.jsx)(`span`,{className:_e(`text-xs font-medium`,t?`text-foreground`:`text-muted-foreground`),children:e.label}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-2xs text-muted-foreground/70`,children:e.detail})]},e.id)})]}):null,(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-muted/30 px-2.5 py-1.5`,children:[(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-2xs text-muted-foreground`,children:me})}),(0,Q.jsx)(vt,{side:`top`,children:me})]}),(0,Q.jsx)(I,{size:`xs`,variant:`ghost`,className:`shrink-0`,onClick:()=>oe(me,se(me)),children:`Copy link`})]}),(0,Q.jsx)(I,{size:`xs`,variant:`ghost`,onClick:le,children:`Copy code only`})]}),he?(0,Q.jsx)(`div`,{className:`w-fit shrink-0 self-center rounded-xl bg-white p-3 sm:self-start`,children:(0,Q.jsx)(Un,{value:me,size:168,level:`M`,marginSize:1,title:`Pairing link — scan to open on another device`})}):(0,Q.jsx)(`div`,{className:`flex size-[192px] shrink-0 items-center justify-center self-center rounded-xl border border-border/50 p-4 sm:self-start`,children:(0,Q.jsx)(`p`,{className:`text-center text-2xs text-muted-foreground/70`,children:`No QR for this endpoint. Another device scanning a loopback link would dial itself; copy the URL for use on this machine instead.`})})]}),t[118]=he,t[119]=oe,t[120]=k,t[121]=le,t[122]=me,t[123]=x,t[124]=pe?.id,t[125]=G):G=t[125];let $e;t[126]===G?$e=t[127]:($e=(0,Q.jsx)(Xn,{children:G}),t[126]=G,t[127]=$e);let et;t[128]!==Ze||t[129]!==$e?(et=(0,Q.jsx)(Qn,{open:Ze,children:$e}),t[128]=Ze,t[129]=$e,t[130]=et):et=t[130];let tt;return t[131]!==ge||t[132]!==Xe||t[133]!==et?(tt=(0,Q.jsxs)(`div`,{className:ge,children:[Xe,et]}),t[131]=ge,t[132]=Xe,t[133]=et,t[134]=tt):tt=t[134],tt}),Fi=(0,$.memo)(function(e){let t=(0,Z.c)(54),{clientSession:n,presentation:r,revokingClientSessionId:i,onRevokeSession:a,canRevoke:o}=e,s=r===void 0?`current`:r,c=pn(1e3),l=n.current||n.connected,u=n.lastConnectedAt,d;t[0]!==l||t[1]!==u||t[2]!==c?(d=l?u?`Connected for ${gt(u,c)}`:`Connected`:u?`Last connected at ${fi(u)}`:`Not connected yet.`,t[0]=l,t[1]=u,t[2]=c,t[3]=d):d=t[3];let f=d,p;t[4]===n.client.deviceType?p=t[5]:(p=n.client.deviceType===`unknown`?null:n.client.deviceType[0]?.toUpperCase()+n.client.deviceType.slice(1),t[4]=n.client.deviceType,t[5]=p);let m=n.client.os??null,h=n.client.browser??null,g=n.client.ipAddress??null,_;t[6]!==p||t[7]!==m||t[8]!==h||t[9]!==g?(_=[p,m,h,g].filter(ca),t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_):_=t[10];let v=_,y;t[11]!==n.client.browser||t[12]!==n.client.label||t[13]!==n.client.os||t[14]!==n.subject?(y=n.client.label??([n.client.os,n.client.browser].filter(Boolean).join(` · `)||n.subject),t[11]=n.client.browser,t[12]=n.client.label,t[13]=n.client.os,t[14]=n.subject,t[15]=y):y=t[15];let b=y,x;t[16]===s?x=t[17]:(x=bi(s),t[16]=s,t[17]=x);let S=l?`bg-success`:`bg-muted-foreground/30`,C=l?`bg-success/60 duration-2000`:null,w;t[18]!==f||t[19]!==S||t[20]!==C?(w=(0,Q.jsx)(xn,{tooltipText:f,dotClassName:S,pingClassName:C}),t[18]=f,t[19]=S,t[20]=C,t[21]=w):w=t[21];let T;t[22]===b?T=t[23]:(T=(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:b}),t[22]=b,t[23]=T);let E;t[24]===n.current?E=t[25]:(E=n.current?(0,Q.jsx)(`span`,{className:`text-3xs text-muted-foreground/80 rounded-md border border-border/50 bg-muted/50 px-1 py-0.5`,children:`This device`}):null,t[24]=n.current,t[25]=E);let D;t[26]!==w||t[27]!==T||t[28]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex min-h-5 items-center gap-1.5`,children:[w,T,E]}),t[26]=w,t[27]=T,t[28]=E,t[29]=D):D=t[29];let O;t[30]===v?O=t[31]:(O=v.length>0?(0,Q.jsxs)(Q.Fragment,{children:[v.join(` · `),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:` · `})]}):null,t[30]=v,t[31]=O);let k;t[32]===n.scopes?k=t[33]:(k=(0,Q.jsx)(pi,{scopes:n.scopes,label:`Client scopes`}),t[32]=n.scopes,t[33]=k);let A;t[34]!==O||t[35]!==k?(A=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[O,k]}),t[34]=O,t[35]=k,t[36]=A):A=t[36];let j;t[37]!==D||t[38]!==A?(j=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[D,A]}),t[37]=D,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==o||t[41]!==n.current||t[42]!==n.sessionId||t[43]!==a||t[44]!==i?(M=n.current?null:(0,Q.jsx)(I,{size:`xs`,variant:`destructive-outline`,disabled:!o||i===n.sessionId,onClick:()=>void a(n.sessionId),children:i===n.sessionId?`Revoking…`:`Revoke`}),t[40]=o,t[41]=n.current,t[42]=n.sessionId,t[43]=a,t[44]=i,t[45]=M):M=t[45];let N;t[46]===M?N=t[47]:(N=(0,Q.jsx)(`div`,{className:`flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end`,children:M}),t[46]=M,t[47]=N);let P;t[48]!==j||t[49]!==N?(P=(0,Q.jsxs)(`div`,{className:or,children:[j,N]}),t[48]=j,t[49]=N,t[50]=P):P=t[50];let F;return t[51]!==P||t[52]!==x?(F=(0,Q.jsx)(`div`,{className:x,children:P}),t[51]=P,t[52]=x,t[53]=F):F=t[53],F}),Ii=(0,$.memo)(function({onPairingLinkCreated:e,clientSessions:t,isRevokingOtherClients:n,onRevokeOtherClients:r,delegatableScopes:i}){let a=nt(),[o,s]=(0,$.useState)(!1),[l,u]=(0,$.useState)(``),[d,p]=(0,$.useState)([...xe]),m=d.filter(e=>i.includes(e)),[h,g]=(0,$.useState)(!1),_=(0,$.useCallback)(async()=>{if(a!==null&&m.length!==0&&J(a,`access:write`)&&m.every(e=>J(a,e))){g(!0);try{e(await Cn({label:l,scopes:m})),u(``),p(xe.filter(e=>i.includes(e))),s(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to create pairing URL.`;K.add(Y({type:`error`,title:`Could not create pairing URL`,description:t}))}finally{g(!1)}}},[i,e,l,a,m]),v=(0,$.useCallback)((e,t)=>{p(n=>Kn(n,e,t))},[]);return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(I,{size:`xs`,variant:`destructive-outline`,disabled:n||!In(t),onClick:()=>void r(),children:n?`Revoking…`:`Revoke others`}),(0,Q.jsxs)(jt,{open:o,onOpenChange:e=>{s(e),e||(u(``),p(xe.filter(e=>i.includes(e))))},children:[(0,Q.jsx)(Et,{render:(0,Q.jsxs)(I,{size:`xs`,variant:`default`,children:[(0,Q.jsx)(T,{className:`size-3`}),`Create link`]})}),(0,Q.jsxs)(At,{className:`max-w-md`,children:[(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(wt,{children:`Create pairing link`}),(0,Q.jsx)(kt,{children:`Generate a one-time link that another device can use to pair with this backend as an authorized client.`})]}),(0,Q.jsxs)(Ot,{children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Client label (optional)`}),(0,Q.jsx)(xt,{value:l,onChange:e=>u(e.target.value),placeholder:`e.g. Living room iPad`,disabled:h,autoFocus:!0})]}),(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-xs font-medium text-foreground`,children:`Permissions`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Limit what the paired client can do.`})]}),(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Q.jsx)(I,{size:`xs`,variant:`outline`,disabled:h,onClick:()=>p([f,y,c,he].filter(e=>i.includes(e))),children:`Read only`}),(0,Q.jsx)(I,{size:`xs`,variant:`outline`,disabled:h,onClick:()=>p(xe.filter(e=>i.includes(e))),children:`Standard`})]})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-border/60 rounded-lg border border-input bg-muted/25`,children:pr.filter(({scope:e})=>i.includes(e)).map(({scope:e,title:t,description:n})=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-3 py-2.5 transition-colors hover:bg-muted/40`,children:[(0,Q.jsx)(Kt,{className:`mt-0.5`,checked:d.includes(e),disabled:h,onCheckedChange:t=>v(e,t===!0)}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-xs font-medium text-foreground`,children:t}),(0,Q.jsx)(`span`,{className:`block text-xs leading-snug text-muted-foreground`,children:n})]})]},e))}),m.length===0?(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:`Select at least one permission.`}):m.includes(`access:write`)?(0,Q.jsx)(`p`,{className:`text-xs text-warning`,children:`This client can create or revoke access for other devices.`}):null]})]}),(0,Q.jsxs)(Tt,{variant:`bare`,children:[(0,Q.jsx)(I,{variant:`outline`,disabled:h,onClick:()=>s(!1),children:`Cancel`}),(0,Q.jsx)(I,{disabled:h||m.length===0,onClick:()=>void _(),children:h?`Creating…`:`Create link`})]})]})]})]})}),Li=(0,$.memo)(function(e){let t=(0,Z.c)(39),{endpointUrl:n,endpoints:r,defaultEndpointKey:i,presentation:a,isLoading:o,pairingLinks:s,createdPairingCredentials:c,clientSessions:l,revokingPairingLinkId:u,revokingClientSessionId:d,onRevokePairingLink:f,onRevokeClientSession:p,canRevoke:m}=e,h=a===void 0?`current`:a,g;if(t[0]!==m||t[1]!==c||t[2]!==i||t[3]!==n||t[4]!==r||t[5]!==f||t[6]!==s||t[7]!==h||t[8]!==u){let e;t[10]!==m||t[11]!==c||t[12]!==i||t[13]!==n||t[14]!==r||t[15]!==f||t[16]!==h||t[17]!==u?(e=e=>(0,Q.jsx)(Pi,{pairingLink:e,credential:c.get(e.id),endpointUrl:n,endpoints:r,defaultEndpointKey:i,presentation:h,revokingPairingLinkId:u,onRevoke:f,canRevoke:m},e.id),t[10]=m,t[11]=c,t[12]=i,t[13]=n,t[14]=r,t[15]=f,t[16]=h,t[17]=u,t[18]=e):e=t[18],g=s.map(e),t[0]=m,t[1]=c,t[2]=i,t[3]=n,t[4]=r,t[5]=f,t[6]=s,t[7]=h,t[8]=u,t[9]=g}else g=t[9];let _;if(t[19]!==m||t[20]!==l||t[21]!==p||t[22]!==h||t[23]!==d){let e;t[25]!==m||t[26]!==p||t[27]!==h||t[28]!==d?(e=e=>(0,Q.jsx)(Fi,{clientSession:e,presentation:h,revokingClientSessionId:d,onRevokeSession:p,canRevoke:m},e.sessionId),t[25]=m,t[26]=p,t[27]=h,t[28]=d,t[29]=e):e=t[29],_=l.map(e),t[19]=m,t[20]=l,t[21]=p,t[22]=h,t[23]=d,t[24]=_}else _=t[24];let v;t[30]!==l.length||t[31]!==o||t[32]!==s.length||t[33]!==h?(v=s.length===0&&l.length===0&&!o?(0,Q.jsx)(`div`,{className:bi(h),children:(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground/60`,children:`No pairing links or client sessions.`})}):null,t[30]=l.length,t[31]=o,t[32]=s.length,t[33]=h,t[34]=v):v=t[34];let y;return t[35]!==g||t[36]!==_||t[37]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[g,_,v]}),t[35]=g,t[36]=_,t[37]=v,t[38]=y):y=t[38],y}),Ri=(0,$.memo)(function(e){let t=(0,Z.c)(50),{endpoint:n,isDefault:r,presentation:i,onSetDefault:a,onSetupTailscaleServe:o,onDisableTailscaleServe:s,isUpdatingTailscaleServe:c}=e,l=i===void 0?`current`:i,u=n.status===`available`,d;t[0]===n?d=t[1]:(d=Oi(n)&&n.status!==`available`,t[0]=n,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=Oi(n)&&n.status===`available`,t[2]=n,t[3]=p);let m=p,h=!f,g=l===`endpoint-rail`,_;t[4]!==u||t[5]!==l?(_=xi(l,u),t[4]=u,t[5]=l,t[6]=_):_=t[6];let v;t[7]!==r||t[8]!==g?(v=g&&r?(0,Q.jsx)(`span`,{className:`absolute inset-y-2 left-0 w-1 rounded-r-full bg-primary`,"aria-hidden":!0}):null,t[7]=r,t[8]=g,t[9]=v):v=t[9];let y;t[10]===n.label?y=t[11]:(y=(0,Q.jsx)(`h3`,{className:`shrink-0 text-sm leading-5 font-medium text-foreground`,children:n.label}),t[10]=n.label,t[11]=y);let b;t[12]!==n.httpBaseUrl||t[13]!==h?(b=h?(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(`p`,{className:`min-w-0 truncate text-xs leading-5 text-muted-foreground`,children:n.httpBaseUrl})}),(0,Q.jsx)(vt,{side:`top`,children:n.httpBaseUrl})]}):null,t[12]=n.httpBaseUrl,t[13]=h,t[14]=b):b=t[14];let x;t[15]===u?x=t[16]:(x=u?null:(0,Q.jsx)(`span`,{className:`shrink-0 rounded-md border border-border/70 px-1 py-0.5 text-3xs text-muted-foreground`,children:`Setup required`}),t[15]=u,t[16]=x);let S;t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-3`,children:[y,b,x]}),t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20];let C;t[21]===r?C=t[22]:(C=r?(0,Q.jsx)(`span`,{className:`rounded-md border border-primary/30 bg-primary/10 px-1 py-0.5 text-3xs text-primary`,children:`Default`}):null,t[21]=r,t[22]=C);let w;t[23]!==n||t[24]!==c||t[25]!==f||t[26]!==o?(w=f?(0,Q.jsx)(I,{size:`xs`,variant:`outline`,onClick:()=>o(n),disabled:c,children:c?`Restarting…`:`Setup`}):null,t[23]=n,t[24]=c,t[25]=f,t[26]=o,t[27]=w):w=t[27];let T;t[28]!==m||t[29]!==n||t[30]!==c||t[31]!==s?(T=m?(0,Q.jsx)(I,{size:`xs`,variant:`destructive-outline`,onClick:()=>s(n),disabled:c,children:c?`Restarting…`:`Disable`}):null,t[28]=m,t[29]=n,t[30]=c,t[31]=s,t[32]=T):T=t[32];let E;t[33]!==n||t[34]!==r||t[35]!==f||t[36]!==a?(E=!f&&!r?(0,Q.jsx)(I,{size:`xs`,variant:`outline`,onClick:()=>a(n),children:`Set as default`}):null,t[33]=n,t[34]=r,t[35]=f,t[36]=a,t[37]=E):E=t[37];let D;t[38]!==C||t[39]!==w||t[40]!==T||t[41]!==E?(D=(0,Q.jsxs)(`div`,{className:`ml-auto flex min-h-6 shrink-0 items-center justify-end gap-2`,children:[C,w,T,E]}),t[38]=C,t[39]=w,t[40]=T,t[41]=E,t[42]=D):D=t[42];let O;t[43]!==D||t[44]!==S?(O=(0,Q.jsxs)(`div`,{className:`flex min-h-6 min-w-0 flex-col gap-2 sm:-my-0.5 sm:flex-row sm:items-center`,children:[S,D]}),t[43]=D,t[44]=S,t[45]=O):O=t[45];let k;return t[46]!==O||t[47]!==_||t[48]!==v?(k=(0,Q.jsxs)(`div`,{className:_,children:[v,O]}),t[46]=O,t[47]=_,t[48]=v,t[49]=k):k=t[49],k});function zi(e){let t=(0,Z.c)(14),{endpoint:n,hiddenEndpointCount:r,expanded:i,onToggleExpanded:a,fallback:o}=e;if(!n)return o;let s;t[0]===n.httpBaseUrl?s=t[1]:(s=(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:n.httpBaseUrl}),t[0]=n.httpBaseUrl,t[1]=s);let c;t[2]!==i||t[3]!==r?(c=r>0?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:i?`Hide`:`+${r}`}):null,t[2]=i,t[3]=r,t[4]=c):c=t[4];let l;t[5]!==s||t[6]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[s,c]}),t[5]=s,t[6]=c,t[7]=l):l=t[7];let u=l,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(`span`,{className:`shrink-0`,children:`Reachable at`}),t[8]=d):d=t[8];let f;return t[9]!==i||t[10]!==r||t[11]!==a||t[12]!==u?(f=(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-baseline gap-1`,children:[d,r>0?(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex min-w-0 max-w-full items-baseline gap-2 border-b border-dotted border-muted-foreground/60 text-left text-muted-foreground underline-offset-4 hover:border-foreground hover:text-foreground`,onClick:a,"aria-expanded":i,children:u}):(0,Q.jsx)(`span`,{className:`inline-flex min-w-0 max-w-full items-baseline gap-2`,children:u})]}),t[9]=i,t[10]=r,t[11]=a,t[12]=u,t[13]=f):f=t[13],f}function Bi(e){if(!e.entry.enabled&&e.connection.phase!==`unsupported`)return{text:`Off`,tone:`muted`};let{connection:t}=e;switch(t.phase){case`connected`:return{text:`Connected`,tone:`muted`};case`connecting`:return{text:`Connecting`,tone:`muted`};case`reconnecting`:return{text:t.error?`Reconnecting: ${t.error}`:`Reconnecting`,tone:`error`};case`unsupported`:return{text:`Client not supported`,tone:`muted`};case`error`:return{text:t.error?`Connection failed: ${t.error}`:`Connection failed`,tone:`error`};case`offline`:return{text:`Offline`,tone:`muted`};case`available`:return{text:`Not connected`,tone:`muted`}}}function Vi(e){let t=(0,Z.c)(177),{environment:n,removingEnvironmentId:r,onSetEnabled:i,onRemove:o,onAddRoute:s}=e,[c,u]=(0,$.useState)(!1),[d,f]=(0,$.useState)(!1),[p,m]=(0,$.useState)(!1),g=n.environmentId,_=n.connection.phase===`unsupported`,v=n.entry.enabled&&!_,y=n.connection.phase===`connected`,b=r===g,x=n.connection.traceId,S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S={target:`trace ID`,onCopy:Xi,onError:Yi},t[0]=S):S=t[0];let{copyToClipboard:C}=Qe(S),T;t[1]===C?T=t[2]:(T=e=>{C(e,{traceId:e})},t[1]=C,t[2]=T);let E=T,D;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D={target:`MCP URL`,onCopy:Ji,onError:qi},t[3]=D):D=t[3];let{copyToClipboard:O}=Qe(D),k;t[4]===n.serverConfig?k=t[5]:(k=Wn(n.serverConfig),t[4]=n.serverConfig,t[5]=k);let M=k,P;t[6]===g?P=t[7]:(P=st.updateStateAtom(g),t[6]=g,t[7]=P);let F=be(P),ee=F.status===`running`&&F.stage===`resuming`,te;t[8]===n?te=t[9]:(te=Bi(n),t[8]=n,t[9]=te);let ne=te,re=n.serverConfig?.environment.serverVersion??null,ie=$e(),ae;t[10]!==g||t[11]!==ie.environments?(ae=ve(ie.environments.get(g)?.status??N())?.descriptor,t[10]=g,t[11]=ie.environments,t[12]=ae):ae=t[12];let oe=ae,[se,ce]=(0,$.useState)(oe);oe!==void 0&&oe!==se&&ce(oe);let le;t[13]!==g||t[14]!==ie.environments?(le=ie.environments.get(g)?.environment.endpoint.httpBaseUrl,t[13]=g,t[14]=ie.environments,t[15]=le):le=t[15];let de=le,[fe,L]=(0,$.useState)(de);de!==void 0&&de!==fe&&L(de);let pe=mt(ct.retryNow),{diagnosis:me,state:he,relayOnly:ge}=lr(n),R=ee?null:me,xe=ft(g),z=y&&xe._tag===`Some`?xe.value.target:null,Ce=de??fe,we;t[16]!==z||t[17]!==n.entry||t[18]!==Ce?(we=We({entry:n.entry,relayHttpBaseUrl:Ce,connectedTarget:z}),t[16]=z,t[17]=n.entry,t[18]=Ce,t[19]=we):we=t[19];let Te=we,Ee;t[20]!==n.serverConfig||t[21]!==se?(Ee=n.serverConfig??(se===void 0?null:{environment:se}),t[20]=n.serverConfig,t[21]=se,t[22]=Ee):Ee=t[22];let B;t[23]===Ee?B=t[24]:(B=l(Ee),t[23]=Ee,t[24]=B);let De=B,Oe;t[25]===n.entry?Oe=t[26]:(Oe=H(n.entry),t[25]=n.entry,t[26]=Oe);let ke=Oe.length,Ae;t[27]!==z||t[28]!==n?(Ae=Er(n,z),t[27]=z,t[28]=n,t[29]=Ae):Ae=t[29];let je=R?null:ee?`Restarting`:ne.text,Me=v&&M?re:null,Ne;t[30]!==Ae||t[31]!==je||t[32]!==Me?(Ne=[Ae,je,Me].filter(Ki),t[30]=Ae,t[31]=je,t[32]=Me,t[33]=Ne):Ne=t[33];let Pe=Ne.join(` · `),V=v&&y&&M!==null&&(F.status===`idle`||F.status===`failed`),Fe;t[34]!==v||t[35]!==n.connection||t[36]!==_?(Fe=_?n.connection.error??Ve(n.connection):v?Ve(n.connection):`Switched off`,t[34]=v,t[35]=n.connection,t[36]=_,t[37]=Fe):Fe=t[37];let Ie=`${Fe}${M?`\nUpdate available: ${M.serverVersion} → ${M.clientVersion}`:``}`,Le=n.label,Re=!v,ze=v&&ne.tone===`error`&&!ee&&!R&&`text-destructive`,Be;t[38]===ze?Be=t[39]:(Be=_e(`min-w-0 truncate`,ze),t[38]=ze,t[39]=Be);let Ue;t[40]===Be?Ue=t[41]:(Ue=(0,Q.jsx)(`span`,{className:Be}),t[40]=Be,t[41]=Ue);let U;t[42]!==Ie||t[43]!==Pe||t[44]!==Ue?(U=(0,Q.jsx)(_t,{payload:Ie,render:Ue,children:Pe}),t[42]=Ie,t[43]=Pe,t[44]=Ue,t[45]=U):U=t[45];let Ge;t[46]===Ie?Ge=t[47]:(Ge=(0,Q.jsx)(vt,{side:`top`,className:`whitespace-pre-wrap`,children:Ie}),t[46]=Ie,t[47]=Ge);let Ke;t[48]!==U||t[49]!==Ge?(Ke=(0,Q.jsxs)(yt,{children:[U,Ge]}),t[48]=U,t[49]=Ge,t[50]=Ke):Ke=t[50];let W;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0`,children:`·`}),t[51]=W):W=t[51];let qe;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(qe=()=>u(Gi),t[52]=qe):qe=t[52];let Je=ke===1?`Routes`:`${ke} routes`,Ye=c&&`rotate-90`,Xe;t[53]===Ye?Xe=t[54]:(Xe=_e(`size-3 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,Ye),t[53]=Ye,t[54]=Xe);let Ze;t[55]===Xe?Ze=t[56]:(Ze=(0,Q.jsx)(h,{"aria-hidden":!0,className:Xe}),t[55]=Xe,t[56]=Ze);let G;t[57]!==c||t[58]!==Je||t[59]!==Ze?(G=(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":c,onClick:qe,className:`inline-flex shrink-0 items-center gap-0.5 rounded-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,children:[Je,Ze]}),t[57]=c,t[58]=Je,t[59]=Ze,t[60]=G):G=t[60];let K;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0`,children:`·`}),t[61]=K):K=t[61];let et=`remote-permissions-${g}`,tt;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(tt=()=>f(Wi),t[62]=tt):tt=t[62];let nt=d&&`rotate-90`,rt;t[63]===nt?rt=t[64]:(rt=_e(`size-3 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,nt),t[63]=nt,t[64]=rt);let q;t[65]===rt?q=t[66]:(q=(0,Q.jsx)(h,{"aria-hidden":!0,className:rt}),t[65]=rt,t[66]=q);let it;t[67]!==d||t[68]!==et||t[69]!==q?(it=(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":d,"aria-controls":et,onClick:tt,className:`inline-flex shrink-0 items-center gap-0.5 rounded-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,children:[`Permissions`,q]}),t[67]=d,t[68]=et,t[69]=q,t[70]=it):it=t[70];let at;t[71]!==Ke||t[72]!==G||t[73]!==it?(at=(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[Ke,W,G,K,it]}),t[71]=Ke,t[72]=G,t[73]=it,t[74]=at):at=t[74];let ot;t[75]!==he||t[76]!==R||t[77]!==p?(ot=R?(0,Q.jsx)(dr,{diagnosis:R,retryAt:he.phase===`backoff`?he.retryAt:null,attempt:he.attempt,expanded:p,onToggle:()=>m(Ui)}):null,t[75]=he,t[76]=R,t[77]=p,t[78]=ot):ot=t[78];let lt;t[79]===F?lt=t[80]:(lt=F.status===`idle`?null:(0,Q.jsx)(`div`,{className:`mt-1 max-w-md`,children:(0,Q.jsx)(Zn,{state:F})}),t[79]=F,t[80]=lt);let ut;t[81]!==ot||t[82]!==lt?(ut=(0,Q.jsxs)(Q.Fragment,{children:[ot,lt]}),t[81]=ot,t[82]=lt,t[83]=ut):ut=t[83];let dt;t[84]!==R||t[85]!==p||t[86]!==n||t[87]!==g||t[88]!==s||t[89]!==ge||t[90]!==pe?(dt=R&&p?(0,Q.jsx)(ur,{hostLabel:n.label,diagnosis:R,onRetry:()=>void pe(g),onAddRoute:ge?()=>s(n):null}):null,t[84]=R,t[85]=p,t[86]=n,t[87]=g,t[88]=s,t[89]=ge,t[90]=pe,t[91]=dt):dt=t[91];let J;t[92]!==n||t[93]!==s||t[94]!==c?(J=c&&(0,Q.jsx)(xr,{environment:n,onAddRoute:()=>s(n)}),t[92]=n,t[93]=s,t[94]=c,t[95]=J):J=t[95];let pt;t[96]!==g||t[97]!==y||t[98]!==d?(pt=d&&(0,Q.jsx)(`div`,{id:`remote-permissions-${g}`,className:`mt-2 border-t border-border/50`,children:(0,Q.jsx)(mr,{environmentId:g,connected:y,routeContext:!0})}),t[96]=g,t[97]=y,t[98]=d,t[99]=pt):pt=t[99];let Y;t[100]!==dt||t[101]!==J||t[102]!==pt?(Y=(0,Q.jsxs)(Q.Fragment,{children:[dt,J,pt]}),t[100]=dt,t[101]=J,t[102]=pt,t[103]=Y):Y=t[103];let ht;t[104]!==n.entry.serverUpdateRequired||t[105]!==n.label||t[106]!==g||t[107]!==se?.serverVersion||t[108]!==F.status||t[109]!==_?(ht=_&&n.entry.serverUpdateRequired===!0&&F.status!==`running`?(0,Q.jsx)(ir,{environmentId:g,serverLabel:`${n.label} server`,fromVersion:se?.serverVersion,targetVersion:He,label:F.status===`failed`?`Retry update`:`Update`}):null,t[104]=n.entry.serverUpdateRequired,t[105]=n.label,t[106]=g,t[107]=se?.serverVersion,t[108]=F.status,t[109]=_,t[110]=ht):ht=t[110];let gt;t[111]!==n.label||t[112]!==n.serverConfig||t[113]!==g||t[114]!==F.status||t[115]!==V||t[116]!==M?(gt=V?(0,Q.jsx)($n,{environmentId:g,serverLabel:`${n.label} server`,selfUpdate:An(n.serverConfig),installation:n.serverConfig?.environment.capabilities.serverInstallation,desktopAppUpdate:Bn(n.serverConfig),threadContinuation:nr(n.serverConfig),targetVersion:M.clientVersion,label:F.status===`failed`?`Retry update`:`Update`,appearance:`icon`}):null,t[111]=n.label,t[112]=n.serverConfig,t[113]=g,t[114]=F.status,t[115]=V,t[116]=M,t[117]=gt):gt=t[117];let bt=b||_,xt=`${v?`Switch off`:`Switch on`} ${n.label}`,St;t[118]!==g||t[119]!==i?(St=e=>i(g,e),t[118]=g,t[119]=i,t[120]=St):St=t[120];let Ct;t[121]!==v||t[122]!==bt||t[123]!==xt||t[124]!==St?(Ct=(0,Q.jsx)(_t,{render:(0,Q.jsx)(cr,{size:`sm`,checked:v,disabled:bt,"aria-label":xt,onCheckedChange:St})}),t[121]=v,t[122]=bt,t[123]=xt,t[124]=St,t[125]=Ct):Ct=t[125];let wt=_?`Client not supported`:v?`Switch off`:`Switch on`,Tt;t[126]===wt?Tt=t[127]:(Tt=(0,Q.jsx)(vt,{side:`top`,children:wt}),t[126]=wt,t[127]=Tt);let Et;t[128]!==Ct||t[129]!==Tt?(Et=(0,Q.jsxs)(yt,{children:[Ct,Tt]}),t[128]=Ct,t[129]=Tt,t[130]=Et):Et=t[130];let Dt=`More actions for ${n.label}`,Ot;t[131]!==b||t[132]!==Dt?(Ot=(0,Q.jsx)(I,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,disabled:b,"aria-label":Dt}),t[131]=b,t[132]=Dt,t[133]=Ot):Ot=t[133];let kt;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(kt=(0,Q.jsx)(A,{className:`size-3.5`}),t[134]=kt):kt=t[134];let At;t[135]===Ot?At=t[136]:(At=(0,Q.jsx)(Se,{render:Ot,children:kt}),t[135]=Ot,t[136]=At);let jt;t[137]!==n.serverConfig||t[138]!==g?(jt=(0,Q.jsx)(br,{environmentId:g,serverConfig:n.serverConfig}),t[137]=n.serverConfig,t[138]=g,t[139]=jt):jt=t[139];let Mt,Nt;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(Mt=()=>u(Hi),Nt=(0,Q.jsx)(ue,{}),t[140]=Mt,t[141]=Nt):(Mt=t[140],Nt=t[141]);let Pt=c?`Hide routes`:`Routes`,Ft;t[142]===Pt?Ft=t[143]:(Ft=(0,Q.jsxs)(a,{onClick:Mt,children:[Nt,Pt]}),t[142]=Pt,t[143]=Ft);let It;t[144]!==O||t[145]!==Te?(It=Te?(0,Q.jsx)(a,{onClick:()=>O(Te,{url:Te}),children:`Copy MCP URL`}):null,t[144]=O,t[145]=Te,t[146]=It):It=t[146];let Lt;t[147]!==E||t[148]!==x?(Lt=x?(0,Q.jsx)(a,{onClick:()=>E(x),children:`Copy trace ID`}):null,t[147]=E,t[148]=x,t[149]=Lt):Lt=t[149];let Rt;t[150]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=(0,Q.jsx)(j,{}),t[150]=Rt):Rt=t[150];let zt;t[151]!==n||t[152]!==o?(zt=()=>o(n),t[151]=n,t[152]=o,t[153]=zt):zt=t[153];let Bt=b?`Removing…`:`Remove from this device…`,Vt;t[154]!==zt||t[155]!==Bt?(Vt=(0,Q.jsx)(a,{variant:`destructive`,onClick:zt,children:Bt}),t[154]=zt,t[155]=Bt,t[156]=Vt):Vt=t[156];let Ht;t[157]!==jt||t[158]!==Ft||t[159]!==It||t[160]!==Lt||t[161]!==Vt?(Ht=(0,Q.jsxs)(ye,{align:`end`,children:[jt,Ft,It,Lt,Rt,Vt]}),t[157]=jt,t[158]=Ft,t[159]=It,t[160]=Lt,t[161]=Vt,t[162]=Ht):Ht=t[162];let Ut;t[163]!==At||t[164]!==Ht?(Ut=(0,Q.jsxs)(w,{children:[At,Ht]}),t[163]=At,t[164]=Ht,t[165]=Ut):Ut=t[165];let Wt;return t[166]!==n.label||t[167]!==De||t[168]!==Re||t[169]!==at||t[170]!==ut||t[171]!==Y||t[172]!==ht||t[173]!==gt||t[174]!==Et||t[175]!==Ut?(Wt=(0,Q.jsxs)(Dr,{kind:De,label:Le,dimmed:Re,subtitle:at,below:ut,detail:Y,children:[ht,gt,Et,Ut]}),t[166]=n.label,t[167]=De,t[168]=Re,t[169]=at,t[170]=ut,t[171]=Y,t[172]=ht,t[173]=gt,t[174]=Et,t[175]=Ut,t[176]=Wt):Wt=t[176],Wt}function Hi(e){return!e}function Ui(e){return!e}function Wi(e){return!e}function Gi(e){return!e}function Ki(e){return e!==null}function qi(e){K.add(Y({type:`error`,title:`Could not copy MCP URL`,description:e.message}))}function Ji(e){let{url:t}=e;K.add({type:`success`,title:`MCP URL copied`,description:`Add it to an agent, e.g. claude mcp add --transport http p4 ${t}`})}function Yi(e){K.add(Y({type:`error`,title:`Could not copy trace ID`,description:e.message}))}function Xi(e){let{traceId:t}=e;K.add({type:`success`,title:`Trace ID copied`,description:t})}function Zi(e){let t=(0,Z.c)(10),{checked:n,disabled:r,disabledReason:i,onCheckedChange:a,ariaLabel:o}=e,s=o===void 0?`Enable P4 Connect`:o,c;t[0]===a?c=t[1]:(c=a?{onCheckedChange:a}:{},t[0]=a,t[1]=c);let l;t[2]!==s||t[3]!==n||t[4]!==r||t[5]!==c?(l=(0,Q.jsx)(cr,{"aria-label":s,checked:n,disabled:r,...c}),t[2]=s,t[3]=n,t[4]=r,t[5]=c,t[6]=l):l=t[6];let u=l,d;return t[7]!==u||t[8]!==i?(d=i?(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(`span`,{className:`inline-flex`,children:u})}),(0,Q.jsx)(vt,{side:`top`,children:i})]}):u,t[7]=u,t[8]=i,t[9]=d):d=t[9],d}function Qi(e){let t=(0,Z.c)(53),{canManageRelay:n}=e,r=nt(),{isSignedIn:i,linkState:a,linkRevoked:o,managedTunnelActive:s,managedTunnelOutOfSync:c,publishAgentActivity:l,holdWebhooksWhileOffline:u,operationError:d,reconcileCloudState:f}=Fn(),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(!1),v=i?n?null:`Your session does not have permission to manage P4 Connect access.`:`Sign in to P4 Connect to manage this environment.`,y=m||g,b=(0,$.useEffectEvent)(a.refresh),x;t[0]===b?x=t[1]:(x=()=>{let e=window.setInterval(()=>b(),3e4);return()=>window.clearInterval(e)},t[0]=b,t[1]=x);let S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[2]=S):S=t[2],(0,$.useEffect)(x,S);let C=s?a.data?.reachability:void 0,w;t[3]===C?w=t[4]:(w=C?.status===`reachable`?L(C):C?.status===`unreachable`?(0,Q.jsxs)(`span`,{className:`block text-destructive`,children:[[C.reason,C.hint,`Fix: ${C.fix}`].filter(Boolean).join(` `),` `,(0,Q.jsx)(`a`,{href:p(C.cause),target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:`More info`})]}):null,t[3]=C,t[4]=w);let T=w,E;t[5]!==r||t[6]!==l||t[7]!==f?(E=async e=>{r!==null&&J(r,`relay:write`)&&(h(!0),await f({managedTunnel:e,publish:l})&&K.add({type:`success`,title:e?`P4 Connect linked`:l?`P4 Connect tunnel disabled`:`P4 Connect unlinked`,description:e?`This environment is available through P4 Connect.`:l?`The managed tunnel was removed. Agent activity publishing stays on.`:`This environment is no longer available through P4 Connect.`}),h(!1))},t[5]=r,t[6]=l,t[7]=f,t[8]=E):E=t[8];let D=E,O;t[9]!==s||t[10]!==r||t[11]!==f?(O=async e=>{r!==null&&J(r,`relay:write`)&&(_(!0),await f({managedTunnel:s,publish:e})&&K.add({type:`success`,title:e?`Agent activity enabled`:`Agent activity disabled`,description:e?`This environment publishes agent activity to your mobile clients.`:`This environment will stop publishing agent activity.`}),_(!1))},t[9]=s,t[10]=r,t[11]=f,t[12]=O):O=t[12];let k=O,A;t[13]!==s||t[14]!==l||t[15]!==f?(A=async e=>{_(!0),await f({managedTunnel:s,publish:l,holdWebhooksWhileOffline:e})&&K.add({type:`success`,title:e?`Webhooks held while offline`:`Webhooks no longer held`,description:e?`P4 Connect keeps webhook requests for up to 24 hours while this environment is offline.`:`Requests to an offline environment now fail. Anything already held is still delivered.`}),_(!1)},t[13]=s,t[14]=l,t[15]=f,t[16]=A):A=t[16];let j=A,M;t[17]!==n||t[18]!==v||t[19]!==y||t[20]!==i||t[21]!==o||t[22]!==s||t[23]!==c||t[24]!==d||t[25]!==a.data||t[26]!==a.error||t[27]!==a.isPending||t[28]!==C?.status||t[29]!==T||t[30]!==D?(M=window.desktopBridge?(0,Q.jsx)(un,{title:er(`p4-connect`).title,description:o?`This environment was removed from P4 Connect. Turn it on to link it again.`:s?C?.status===`unreachable`?`P4 Connect is on, but other devices cannot reach this environment.`:C?.status===`reachable`?`This environment is available to your other devices through P4 Connect.`:`P4 Connect is on. Reachability has not been checked yet.`:c?`P4 Connect is out of sync. This environment is linked only to publish agent activity, so other devices cannot connect. Turn P4 Connect on to repair it.`:`Make this environment available to your other devices through P4 Connect.`,status:d??a.error??T,control:(0,Q.jsx)(Zi,{checked:s,disabled:!n||!i||a.data===null||a.isPending||y,disabledReason:v,onCheckedChange:e=>void D(e)})}):o?(0,Q.jsx)(un,{title:er(`p4-connect`).title,description:"This environment was removed from P4 Connect. Run `p4c connect link` on the host to link it again."}):null,t[17]=n,t[18]=v,t[19]=y,t[20]=i,t[21]=o,t[22]=s,t[23]=c,t[24]=d,t[25]=a.data,t[26]=a.error,t[27]=a.isPending,t[28]=C?.status,t[29]=T,t[30]=D,t[31]=M):M=t[31];let N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=er(`publish-agent-activity`),t[32]=N):N=t[32];let P=!n||!i||a.data===null||a.isPending||y,F;t[33]===k?F=t[34]:(F=e=>void k(e),t[33]=k,t[34]=F);let I;t[35]!==v||t[36]!==l||t[37]!==F||t[38]!==P?(I=(0,Q.jsx)(un,{title:N.title,description:`Send activity to mobile notifications and Live Activities without P4 Connect.`,control:(0,Q.jsx)(Zi,{ariaLabel:`Publish agent activity to mobile clients`,checked:l,disabled:P,disabledReason:v,onCheckedChange:F})}),t[35]=v,t[36]=l,t[37]=F,t[38]=P,t[39]=I):I=t[39];let ee;t[40]!==n||t[41]!==v||t[42]!==u||t[43]!==y||t[44]!==i||t[45]!==s||t[46]!==a.isPending||t[47]!==j?(ee=s?(0,Q.jsx)(un,{title:er(`hold-webhooks-while-offline`).title,description:`Keep webhook requests for up to 24 hours while this environment is offline, then deliver them. Off: P4 Connect only forwards requests and stores nothing.`,control:(0,Q.jsx)(Zi,{ariaLabel:`Hold webhook requests while this environment is offline`,checked:u,disabled:!n||!i||a.isPending||y,disabledReason:v,onCheckedChange:e=>void j(e)})}):null,t[40]=n,t[41]=v,t[42]=u,t[43]=y,t[44]=i,t[45]=s,t[46]=a.isPending,t[47]=j,t[48]=ee):ee=t[48];let te;return t[49]!==I||t[50]!==ee||t[51]!==M?(te=(0,Q.jsxs)(Q.Fragment,{children:[M,I,ee]}),t[49]=I,t[50]=ee,t[51]=M,t[52]=te):te=t[52],te}function $i(e){let t=(0,Z.c)(3),{canReadRelay:n,canManageRelay:r}=e;if(!Fe())return null;if(!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(un,{title:`P4 Connect`,description:`To edit these settings, pair this connection with both View relay and Manage relay permissions.`}),t[0]=e):e=t[0],e}let i;return t[1]===r?i=t[2]:(i=(0,Q.jsx)(Qi,{canManageRelay:r}),t[1]=r,t[2]=i),i}function ea(e){let t=(0,Z.c)(4),{cloudEnabled:n}=e,r=n===void 0||n,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Nt,{variant:`icon`,children:(0,Q.jsx)(g,{})}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Ft,{children:`No saved remote environments`}),t[1]=a):a=t[1];let o=r?`Click “Add environment” to pair another environment, or connect one from P4 Connect.`:`Click “Add environment” to pair another environment.`,s;return t[2]===o?s=t[3]:(s=(0,Q.jsxs)(Lt,{className:`min-h-52`,children:[i,(0,Q.jsxs)(Pt,{children:[a,(0,Q.jsx)(It,{children:o})]})]}),t[2]=o,t[3]=s),s}function ta(e){let t=(0,Z.c)(3),{primaryEnvironmentId:n,savedEnvironments:r}=e,i;return t[0]!==n||t[1]!==r?(i=Fe()?(0,Q.jsx)(Gn,{primaryEnvironmentId:n,savedEnvironments:r,empty:(0,Q.jsx)(ea,{})}):r.length===0?(0,Q.jsx)(ea,{cloudEnabled:!1}):null,t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function na(){let e=window.desktopBridge,t=be(lt),{environments:n}=tt(),r=et(),i=mt(On,{reportFailure:!1}),a=mt(Dn,{reportFailure:!1}),o=mt(ct.remove,{reportFailure:!1}),s=mt(ct.register,{reportFailure:!1}),c=$e(),u=mt(ct.setEnabled,{reportFailure:!1}),f=r?.environmentId??null,p=En(),v=p.data?.authenticated?p.data.permissions??p.data.scopes??null:null,y=e?null:p.data?.auth.policy??null,b=(0,$.useMemo)(()=>n.filter(e=>e.entry.target._tag!==`PrimaryConnectionTarget`),[n]),x=(0,$.useMemo)(()=>b.filter(e=>!Ge(e.entry.target)),[b]),S=(0,$.useMemo)(()=>M(e=>b.map(t=>({environment:t,updateStatus:e(st.updateStateAtom(t.environmentId)).status}))),[b]),C=be(S),D=(0,$.useMemo)(()=>C.flatMap(({environment:e,updateStatus:t})=>{let n=Wn(e.serverConfig),r=An(e.serverConfig),i=Bn(e.serverConfig);return!n||t===`running`||!e.entry.enabled||e.connection.phase!==`connected`||Ge(e.entry.target)||r===null||r===`desktop-managed`&&!i?[]:[{environmentId:e.environmentId,serverLabel:e.label,selfUpdate:r,installation:e.serverConfig?.environment.capabilities.serverInstallation,desktopAppUpdate:i,threadContinuation:nr(e.serverConfig),continueThreadsAfterServerUpdate:e.serverConfig?.settings.continueThreadsAfterServerUpdate??!1,targetVersion:n.clientVersion}]}),[C]),O=(0,$.useMemo)(()=>[...r?[r]:[],...b.filter(e=>e.entry.enabled)],[r,b]),k=(0,$.useMemo)(()=>{let e=new Set;for(let t of b){let n=t.entry.profile;if(t.entry.target._tag!==`SshConnectionTarget`||re(n)||n.value._tag!==`SshConnectionProfile`)continue;let r=n.value.target;e.add(r.alias),e.add(Tr(r))}return e},[b]),[j,N]=(0,$.useState)(null),[P,F]=(0,$.useState)(null),[ee,te]=(0,$.useState)(()=>new Map),ne=(0,$.useCallback)(e=>{te(t=>new Map(t).set(e.id,e.credential))},[]),[ie,oe]=(0,$.useState)(null),[se,ce]=(0,$.useState)(null),[le,ue]=(0,$.useState)(!1),[de,fe]=(0,$.useState)(!1),[L,pe]=(0,$.useState)(null),[me,he]=(0,$.useState)(`remote`),[ge,R]=(0,$.useState)(``),[ve,xe]=(0,$.useState)(``),[z,Ce]=(0,$.useState)(``),[we,Ee]=(0,$.useState)(``),[B,De]=(0,$.useState)(``),[Oe,ke]=(0,$.useState)(!1),je=(0,$.useRef)(void 0),[Ne,V]=(0,$.useState)(null),[H,Le]=(0,$.useState)(!1),[ze,Be]=(0,$.useState)(null),[Ve,He]=(0,$.useState)(!1),[Ue,We]=(0,$.useState)(!1),[U,Ke]=(0,$.useState)(!1),[W,Qe]=(0,$.useState)(!1),[nt,rt]=(0,$.useState)(null),[q,at]=(0,$.useState)(null),ot=q!==null,[ut,ft]=(0,$.useState)(null),[ht,gt]=(0,$.useState)(!1),[bt,Mt]=(0,$.useState)(String(oi)),[Nt,Pt]=(0,$.useState)(null),Ft=r?.serverConfig??null,It=Wn(Ft),Lt=be(st.updateStateAtom(f)),[Ut,Wt]=(0,$.useState)(!1),Gt=nn(e=>e.defaultAdvertisedEndpointKey),Kt=nn(e=>e.setDefaultAdvertisedEndpointKey),qt=dt(f,m),Jt=dt(f,Te),Yt=dt(f,E),Xt=dt(f,d),Zt=dt(f,_),Qt=!Re()&&Xt,$t=pt(qt&&f!==null?Gr.accessChanges({environmentId:f,input:null}):null),en=pt(Qt&&e?Qr:null),tn=e!==void 0&&de&&me===`ssh`,rn=pt(tn?ai:null),an=rn.refresh;(0,$.useEffect)(()=>{tn&&an()},[tn,an]);let on=pt(Qt&&e?Jn:null),X=on.data,pn=nt??on.error,xn=on.isPending&&on.data===null,Cn=rn.data??ci,Fn=(0,$.useMemo)(()=>Cn.filter(e=>{let t=Tr(e);return!k.has(e.alias)&&!k.has(t)}),[Cn,k]),In=(0,$.useMemo)(()=>ei(Fn,z),[z,Fn]),Ln=rn.isPending&&rn.data===null,Un=rn.error,Gn=e!==void 0&&(Ln||Fn.length>0),Kn=en.data?.serverExposureState??null,qn=en.data?.advertisedEndpoints??si,Xn=j??en.error,Qn=P??$t.error,rr=$t.isPending&&$t.data===null,ir=(0,$.useMemo)(()=>{let e=$t.data;return e?.type===`snapshot`?Si(e.payload.pairingLinks.map(e=>Ti(e))):[]},[$t.data]),ar=(0,$.useMemo)(()=>{let e=$t.data;return e?.type===`snapshot`?wi(e.payload.clientSessions.map(e=>Ei(e))):[]},[$t.data]),or=e?Kn?.mode===`network-accessible`:y===`remote-reachable`,sr=bt.trim(),lr=Number(sr),ur=/^\d+$/u.test(sr)&&Number.isInteger(lr)&&lr>=1&&lr<=65535,dr=(0,$.useMemo)(()=>{if(!ut)return null;if(!ur||lr===oi)return ut.httpBaseUrl;try{let e=new URL(ut.httpBaseUrl);return e.port=String(lr),e.toString().replace(/\/$/u,``)}catch{return ut.httpBaseUrl}},[ur,lr,ut]),Z=(0,$.useCallback)(async t=>{if(e&&f!==null&&J(f,`environment:maintain`)){He(!0),N(null);try{await e.setServerExposureMode(t?`network-accessible`:`local-only`),$r(),We(!1),He(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to update network exposure.`;We(!1),N(t),K.add(Y({type:`error`,title:`Could not update network access`,description:t})),He(!1)}}},[e,f]),pr=(0,$.useCallback)(()=>{Nt!==null&&Z(Nt===`network-accessible`)},[Z,Nt]),hr=(0,$.useCallback)(async()=>{if(e&&f!==null&&J(f,`environment:maintain`)&&ur){Ke(!0),N(null);try{await e.setTailscaleServeEnabled({enabled:!0,port:lr}),$r(),ft(null)}catch(e){let t=e instanceof Error?e.message:`Failed to configure Tailscale HTTPS.`;N(t),K.add(Y({type:`error`,title:`Could not set up Tailscale HTTPS`,description:t}))}finally{Ke(!1)}}},[e,ur,lr,f]),gr=(0,$.useCallback)(e=>{Mt(String(Kn?.tailscaleServePort??oi)),ft(e)},[Kn?.tailscaleServePort]),vr=(0,$.useCallback)(async()=>{if(e&&f!==null&&J(f,`environment:maintain`)){Ke(!0),N(null);try{await e.setTailscaleServeEnabled({enabled:!1,port:Kn?.tailscaleServePort??oi}),$r(),gt(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to disable Tailscale HTTPS.`;N(t),K.add(Y({type:`error`,title:`Could not disable Tailscale HTTPS`,description:t}))}finally{Ke(!1)}}},[e,Kn,f]),yr=(0,$.useCallback)(e=>{gt(!0)},[]),xr=(0,$.useCallback)(async e=>{if(f!==null&&J(f,`access:write`)){oe(e),F(null);try{await Tn(e)}catch(e){let t=e instanceof Error?e.message:`Failed to revoke pairing link.`;F(t),K.add(Y({type:`error`,title:`Could not revoke pairing link`,description:t}))}finally{oe(null)}}},[f]),Sr=(0,$.useCallback)(async e=>{if(f!==null&&J(f,`access:write`)){ce(e),F(null);try{await wn(e)}catch(e){let t=e instanceof Error?e.message:`Failed to revoke client access.`;F(t),K.add(Y({type:`error`,title:`Could not revoke client access`,description:t}))}finally{ce(null)}}},[f]),Cr=(0,$.useCallback)(async()=>{if(f!==null&&J(f,`access:write`)){ue(!0),F(null);try{let e=await Sn();K.add({type:`success`,title:e===1?`Revoked 1 other client`:`Revoked ${e} clients`,description:`Other paired clients will need a new pairing link before reconnecting.`})}catch(e){let t=e instanceof Error?e.message:`Failed to revoke other clients.`;F(t),K.add(Y({type:`error`,title:`Could not revoke other clients`,description:t}))}finally{ue(!1)}}},[f]),wr=(0,$.useCallback)(async e=>{Le(!0),V(null);let t=await a({target:e,label:``,...L?{expectedEnvironmentId:L.environmentId}:{}});if(t._tag===`Failure`){Me(t)||V(vi(Pe(t))),Le(!1);return}R(``),xe(``),Ce(``),Ee(``),De(``),fe(!1),K.add({type:`success`,title:L?`Route added`:`Environment connected`,description:L?`${L.label} can now be reached over SSH ${e.alias}.`:`${e.alias} is ready over an SSH-managed tunnel.`}),Le(!1)},[a,L]),Er=(0,$.useCallback)(async()=>{if(me===`ssh`){let e;try{e=hi({host:z,username:we,port:B})}catch(e){V(vi(e));return}await wr(e);return}Le(!0),V(null);let e;try{e=_i({host:ge,pairingCode:ve})}catch(e){let t=e instanceof Error?e.message:`Failed to add backend.`;V(t),K.add(Y({type:`error`,title:`Could not add backend`,description:t})),Le(!1);return}let t=await i({...e,...L?{expectedEnvironmentId:L.environmentId}:{}});if(t._tag===`Failure`){if(!Me(t)){let e=Pe(t),n=e instanceof Error?e.message:`Failed to add backend.`;V(n),K.add(Y({type:`error`,title:`Could not add backend`,description:n}))}Le(!1);return}R(``),xe(``),Ce(``),Ee(``),De(``),fe(!1),K.add(L?{type:`success`,title:`Route added`,description:`${L.label} now has another way to connect.`}:{type:`success`,title:`Backend added`,description:`The environment is saved and will reconnect on app startup.`}),Le(!1)},[L,i,wr,ge,me,ve,z,B,we]),Dr=(0,$.useCallback)(e=>{e.nativeEvent.isComposing||e.keyCode===229||e.key===`Enter`&&z.trim().length>0&&(e.preventDefault(),Er())},[Er,z]),Or=(0,$.useCallback)(async t=>{if(H||!e)return;Le(!0),V(null),Ce(t.alias);let n;try{n=await e.resolveSshHost(t.alias)}catch(e){V(vi(e)),Le(!1);return}Ee(n.username??``),De(n.port===null?``:String(n.port)),await wr(n)},[wr,e,H]),kr=(0,$.useCallback)(e=>{if(e.nativeEvent.isComposing||e.keyCode===229)return;let n=Oe&&Gn;if(n){let n=Bt(e,t,{platform:navigator.platform,context:{modelPickerOpen:!1}}),r=Vt(n??``),i=r===null?void 0:In[r];if(i){e.preventDefault(),e.stopPropagation(),ke(!1),Or(i);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation();return}}let r=n&&je.current!==void 0;!e.defaultPrevented&&!r&&e.key===`Enter`&&z.trim().length>0&&(e.preventDefault(),Er())},[In,Er,Or,Gn,t,z,Oe]),Ar=(0,$.useCallback)(async(e,t)=>{V(null);let n=await u({environmentId:e,enabled:t});if(n._tag===`Failure`&&!Me(n)){let e=Pe(n),r=e instanceof Error?e.message:`Failed to switch the backend ${t?`on`:`off`}.`;V(r),K.add(Y({type:`error`,title:`Could not switch backend ${t?`on`:`off`}`,description:r}))}},[u]),jr=(0,$.useCallback)(async e=>{let t=e.environmentId;Be(t),V(null);let n=await o(t);if(Be(null),n._tag===`Failure`&&!Me(n)){let e=Pe(n),t=e instanceof Error?e.message:`Failed to remove backend.`;V(t),K.add(Y({type:`error`,title:`Could not remove backend`,description:t}))}},[o]),[Nr,Pr]=(0,$.useState)(null),Fr=(0,$.useCallback)(async e=>{if(e.relayManaged&&Fe()){Pr(e);return}await it(`Remove ${e.label} from this device?\nThis forgets its pairing, credentials, and cached threads here. Switch it off instead to keep it saved.`,{variant:`destructive`})===!0&&await jr(e)},[jr]),Ir=ir,Rr=(0,$.useMemo)(()=>qn.find(Oi)??null,[qn]),Br=(0,$.useMemo)(()=>or?qn.filter(e=>!Oi(e)):[],[qn,or]),Vr=(0,$.useMemo)(()=>Rr?[...Br,Rr]:Br,[Rr,Br]),Hr=(0,$.useMemo)(()=>Di(Br,Gt),[Gt,Br]),Ur=(0,$.useMemo)(()=>Hr??Di(Rr?[Rr]:[],Gt),[Gt,Hr,Rr]),Wr=Ur?ki(Ur):null,Kr=(0,$.useCallback)(e=>{Kt(ki(e))},[Kt]),qr=(0,$.useCallback)(e=>{let t=gi(e);if(t){R(t.host),xe(t.pairingCode);return}R(e)},[]),Jr=e=>{let t=me===e.mode;return(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":t,className:_e(`group flex min-h-24 items-start gap-3 rounded-lg border p-4 text-left`,t?`border-primary/50 bg-primary/5`:`border-border/60 hover:bg-muted/40`),disabled:H,onClick:()=>{he(e.mode)},children:[e.icon?(0,Q.jsx)(`span`,{className:_e(`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md border`,t?`border-primary/30 bg-primary/10 text-primary`:`border-border/70 bg-background text-muted-foreground group-hover:text-foreground`),children:e.icon}):null,(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]})},Yr=()=>(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Host`}),(0,Q.jsx)(xt,{value:ge,onChange:e=>qr(e.target.value),placeholder:`backend.example.com`,disabled:H,spellCheck:!1})]}),(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Pairing code`}),(0,Q.jsx)(xt,{value:ve,onChange:e=>xe(e.target.value),placeholder:`PAIRCODE`,disabled:H,spellCheck:!1})]})]}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`span`,{className:`mt-1 block text-2xs text-muted-foreground`,children:`Paste a full pairing URL here to fill both fields automatically.`})})]}),Xr=L!==null&&!L.relayManaged&&c.environments.has(L.environmentId)?c.environments.get(L.environmentId).environment:null,Zr=async()=>{if(Xr===null||L===null)return;Le(!0);let e=await s(new Ie({target:new Ae({environmentId:Xr.environmentId,label:L.label})}));if(Le(!1),e._tag===`Failure`){if(!Me(e)){let t=Pe(e);V(t instanceof Error?t.message:`Could not add the route.`)}return}fe(!1),K.add({type:`success`,title:`Route added`,description:`${L.label} falls back to P4 Connect when its other routes are unreachable.`})},ti=()=>(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[Xr===null?null:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This machine is on your P4 Connect account. Use it as a fallback route.`}),(0,Q.jsx)(I,{size:`xs`,variant:`outline`,disabled:H,onClick:()=>void Zr(),children:`Add P4 Connect`})]}),Yr(),Ne?(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:Ne}):null,(0,Q.jsxs)(I,{variant:`outline`,className:`w-full`,disabled:H,onClick:()=>void Er(),children:[(0,Q.jsx)(T,{className:`size-3.5`}),H?`Adding…`:L?`Add route`:`Add environment`]})]}),ni=()=>(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`block`,children:[(0,Q.jsx)(`label`,{htmlFor:`saved-backend-ssh-host`,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`SSH host or alias`}),(0,Q.jsxs)(gn,{items:In,itemToStringValue:e=>e.alias,mode:`none`,openOnInputClick:!0,open:Oe,onOpenChange:ke,onItemHighlighted:e=>{je.current=e},value:z,onValueChange:(e,t)=>{if(Ce(e),t.reason!==`item-press`)return;let n=In.find(t=>t.alias===e);n&&Or(n)},children:[(0,Q.jsx)(vn,{id:`saved-backend-ssh-host`,onKeyDown:kr,placeholder:`Search hosts or type devbox`,disabled:H,spellCheck:!1}),Gn?(0,Q.jsx)(yn,{children:Ln?(0,Q.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:`Loading hosts…`}):In.length>0?(0,Q.jsx)(hn,{className:`max-h-72`,children:In.map((e,n)=>{let r=Tr(e),i=n<9?zt(n):null,a=i?Ht(t,i,navigator.platform):null;return(0,Q.jsxs)(bn,{value:e,className:`h-8 min-h-8 whitespace-nowrap`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium`,children:e.alias}),r===e.alias?(0,Q.jsx)(`span`,{className:`flex-1`}):(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted-foreground`,children:r}),a?(0,Q.jsx)(_n,{className:`shrink-0`,children:a}):null]},`${e.alias}:${e.hostname}:${e.port??``}`)})}):(0,Q.jsxs)(mn,{className:`break-all`,children:[`No hosts match "`,z.trim(),`".`]})}):null]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_7rem]`,children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Username`}),(0,Q.jsx)(xt,{value:we,onChange:e=>Ee(e.target.value),onKeyDown:Dr,placeholder:`root`,disabled:H,spellCheck:!1})]}),(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Port`}),(0,Q.jsx)(xt,{value:B,onChange:e=>De(e.target.value),onKeyDown:Dr,placeholder:`22`,inputMode:`numeric`,disabled:H,spellCheck:!1})]})]}),Ne||Un?(0,Q.jsx)(ln,{variant:`error`,children:(0,Q.jsx)(cn,{children:Ne??Un})}):null,(0,Q.jsxs)(I,{variant:`outline`,className:`w-full`,disabled:H,onClick:()=>void Er(),children:[(0,Q.jsx)(T,{className:`size-3.5`}),H?`Adding…`:L?`Add route`:`Add environment`]})]})}),ri=()=>(0,Q.jsx)(cr,{checked:Kn?.mode===`network-accessible`,disabled:!Kn||Ve,onCheckedChange:e=>{Pt(e?`network-accessible`:`local-only`),We(!0)},"aria-label":`Enable network access`}),ii=e=>Ut?Br.map(t=>{let n=ki(t);return(0,Q.jsx)(Ri,{endpoint:t,isDefault:n===Wr,presentation:e,onSetDefault:Kr,onSetupTailscaleServe:gr,onDisableTailscaleServe:yr,isUpdatingTailscaleServe:U},t.id)}):null,di=(0,$.useCallback)(async t=>{if(e&&f!==null&&J(f,`environment:maintain`)){Qe(!0),rt(null);try{await t(),Hn()}catch(e){let t=e instanceof Error?e.message:`Failed to update WSL backend.`;rt(t),K.add(Y({type:`error`,title:`Could not change WSL backend`,description:t})),Hn()}finally{Qe(!1)}}},[e,f]),fi=(0,$.useCallback)(()=>{rt(null),Hn()},[]),pi=(0,$.useMemo)(()=>n.some(e=>Ge(e.entry.target)),[n]),mi=(0,$.useCallback)(t=>{if(!e||!X)return;let n=X.distros.find(e=>e.isDefault)?.name??null;if(t===ui){if(!X.enabled&&!X.wslOnly)return;let t=X.wslOnly;if(pi||t){at({kind:`disable`,wasWslOnly:t});return}di(()=>e.setWslBackendEnabled(!1));return}let r=t===li?null:t,i=r??n;if(!X.enabled){at({kind:`enable`,nextDistro:r});return}if((X.distro??n)!==i){if(pi||X.wslOnly){at({kind:`distro`,nextDistro:r});return}di(()=>e.setWslDistro(r))}},[di,e,X,pi]),yi=(0,$.useCallback)(t=>{if(!e||!q||q.kind!==`enable`)return;let n=q.nextDistro;at(null);let r=X?.distro??null;di(()=>Mn({bridge:e,mode:t,nextDistro:n,persistedDistro:r}))},[di,e,X,q]),xi=(0,$.useCallback)(t=>{e&&X&&X.wslOnly!==t&&at({kind:`wsl-only`,nextValue:t})},[e,X]),Ai=(0,$.useCallback)(()=>{if(!e||!q)return;let t=q;if(t.kind!==`enable`){if(at(null),t.kind===`disable`){di(async()=>{let n=await e.setWslBackendEnabled(!1);return t.wasWslOnly?await e.setWslOnly(!1):n});return}if(t.kind===`distro`){di(()=>e.setWslDistro(t.nextDistro));return}di(()=>e.setWslOnly(t.nextValue))}},[di,e,q]),ji=()=>{if(!X)return Pn({state:null,error:pn})&&Qt?(0,Q.jsx)(un,{...er(`wsl-backend`),description:`Couldn't load the WSL backend state.`,status:(0,Q.jsx)(`span`,{className:`block text-destructive`,children:pn}),control:(0,Q.jsx)(I,{size:`sm`,variant:`outline`,onClick:fi,disabled:xn,children:xn?`Retrying…`:`Retry`})}):null;if(!Pn({state:X,error:pn}))return null;if(!X.available)return(0,Q.jsx)(un,{...er(`wsl-backend`),description:`WSL is unavailable, so Windows is running instead. Turn WSL off to clear this preference.`,status:pn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:pn}):null,control:(0,Q.jsx)(I,{size:`sm`,variant:`outline`,disabled:W,onClick:()=>mi(ui),children:`Switch to Windows`})});let e=X.distros.find(e=>e.isDefault)?.name??null,t=X.enabled?X.distro??e??li:ui,n=t===ui?`Off`:t===li?`Default distro`:t;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(un,{...er(`wsl-backend`),description:`Run the selected WSL distro alongside Windows. Projects remain on their current filesystem.`,status:pn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:pn}):X.preflightError?(0,Q.jsxs)(`span`,{className:`block text-destructive`,children:[`WSL backend couldn't start: `,X.preflightError]}):null,control:(0,Q.jsxs)(Ze,{value:t,onValueChange:e=>{typeof e==`string`&&mi(e)},children:[(0,Q.jsx)(Xe,{size:`sm`,className:`w-full sm:w-56`,"aria-label":`WSL backend`,disabled:W,children:(0,Q.jsx)(Je,{children:n})}),(0,Q.jsxs)(Ye,{align:`end`,alignItemWithTrigger:!1,children:[(0,Q.jsx)(qe,{hideIndicator:!0,value:ui,children:`Off`}),X.distros.length===0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(qe,{hideIndicator:!0,value:li,children:`Default distro`}),X.distro===null?null:(0,Q.jsx)(qe,{hideIndicator:!0,value:X.distro,children:X.distro})]}):X.distros.map(e=>(0,Q.jsxs)(qe,{hideIndicator:!0,value:e.name,children:[e.name,e.isDefault?` (default)`:``]},e.name))]})]})}),X.enabled?(0,Q.jsx)(un,{title:`WSL only`,description:`Run only the WSL backend. P4 Code restarts when this changes.`,className:`bg-muted/20 pl-7 sm:pl-8`,control:(0,Q.jsx)(cr,{checked:X.wslOnly,disabled:W,onCheckedChange:e=>xi(e),"aria-label":`Run WSL only`})}):null]})},Mi=()=>(0,Q.jsx)(un,{title:er(`tailscale-https`).title,description:Rr?Rr.status===`available`?Rr.httpBaseUrl:`Use Tailscale Serve to expose this backend through a MagicDNS HTTPS URL.`:`Start Tailscale to set up HTTPS access through MagicDNS.`,control:Rr?(0,Q.jsx)(cr,{checked:Rr.status===`available`,disabled:U,onCheckedChange:e=>{if(e){gr(Rr);return}yr(Rr)},"aria-label":`Enable Tailscale HTTPS`}):null}),Ni=e=>(0,Q.jsxs)(Q.Fragment,{children:[Qn?(0,Q.jsx)(`div`,{className:bi(e),children:(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:Qn})}):null,(0,Q.jsx)(Li,{endpointUrl:Kn?.endpointUrl,endpoints:Vr,defaultEndpointKey:Wr,presentation:e,isLoading:rr,pairingLinks:Ir,createdPairingCredentials:ee,clientSessions:ar,revokingPairingLinkId:ie,revokingClientSessionId:se,onRevokePairingLink:xr,onRevokeClientSession:Sr,canRevoke:Jt})]}),Pi=()=>(0,Q.jsx)(un,{title:er(`network-access`).title,description:or?(0,Q.jsx)(zi,{endpoint:Hr,hiddenEndpointCount:Math.max(Br.length-1,0),expanded:Ut,onToggleExpanded:()=>Wt(e=>!e),fallback:Kn?.endpointUrl?`Reachable at ${Kn.endpointUrl}`:Kn?.advertisedHost?`Exposed on all interfaces. Pairing links use ${Kn.advertisedHost}.`:`Exposed on all interfaces.`}):Kn?`Limited to this machine.`:`Loading…`,status:Xn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:Xn}):null,control:ri()}),Fi=()=>(0,Q.jsx)(un,{title:er(`network-access`).title,description:e?`This connection cannot view or change network exposure.`:y===`remote-reachable`?`Remote access is already configured. Change network exposure where the server starts.`:y===`loopback-browser`?`Only this machine can connect. Restart with a non-loopback host for remote pairing.`:`Network exposure information is unavailable.`,control:!e&&(y===`remote-reachable`||y===`loopback-browser`)?(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(`span`,{className:`inline-flex`,children:(0,Q.jsx)(cr,{checked:or,disabled:!0,"aria-label":`Enable network access`})})}),(0,Q.jsx)(vt,{side:`top`,children:`Network exposure changes restart the backend and must be controlled where the server process is launched.`})]}):void 0}),Bi=(0,Q.jsx)(Q.Fragment,{children:f===null?(0,Q.jsxs)(fn,{...er(`connections-environment`),children:[(0,Q.jsx)(un,{title:`No environment selected`,description:`Connect an environment to view its settings and access.`}),(0,Q.jsx)(_r,{}),Yt||Zt?(0,Q.jsx)($i,{canReadRelay:Yt,canManageRelay:Zt}):null]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(fn,{...er(`connections-environment`),title:r?.label??(e?`This machine`:`Primary environment`),icon:(0,Q.jsx)(sn,{"aria-hidden":!0,kind:Ft?l(Ft):`desktop`,className:`size-4`}),headerAction:f===null?null:(0,Q.jsxs)(w,{children:[(0,Q.jsx)(Se,{render:(0,Q.jsx)(I,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":`More actions for this machine`}),children:(0,Q.jsx)(A,{className:`size-3.5`})}),(0,Q.jsx)(ye,{align:`end`,children:(0,Q.jsx)(br,{environmentId:f,serverConfig:Ft})})]}),children:[(0,Q.jsx)(_r,{}),Qt?(0,Q.jsx)(un,{title:`Version`,description:Lt.status===`idle`?[Ft?.environment.serverVersion??null,r?.displayUrl??null].filter(e=>e!==null).join(` · `)||`Loading…`:(0,Q.jsx)(Zn,{state:Lt}),control:It&&f!==null&&Lt.status!==`running`?(0,Q.jsx)($n,{size:`sm`,environmentId:f,serverLabel:r?`${r.label} server`:`server`,selfUpdate:An(Ft),installation:Ft?.environment.capabilities.serverInstallation,desktopAppUpdate:Bn(Ft),threadContinuation:nr(Ft),targetVersion:It.clientVersion,label:Lt.status===`failed`?`Retry update`:`Update to ${It.clientVersion}`}):Lt.status===`idle`&&Ft?(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Up to date`}):void 0}):null,Qt&&e?(0,Q.jsxs)(Q.Fragment,{children:[Pi(),ii(`endpoint-rail`),Mi(),ji(),Yt||Zt?(0,Q.jsx)($i,{canReadRelay:Yt,canManageRelay:Zt}):null]}):Qt?(0,Q.jsxs)(Q.Fragment,{children:[Fi(),Yt||Zt?(0,Q.jsx)($i,{canReadRelay:Yt,canManageRelay:Zt}):null]}):null,r?(0,Q.jsxs)(`details`,{className:`group px-3 sm:px-4`,children:[(0,Q.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center gap-2 rounded-md text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring [&::-webkit-details-marker]:hidden`,children:[`Permissions`,(0,Q.jsx)(h,{"aria-hidden":!0,className:`size-3 text-muted-foreground group-open:rotate-90`})]}),(0,Q.jsx)(mr,{environmentId:r.environmentId,connected:r.connection.phase===`connected`})]}):null]}),qt||Jt?(0,Q.jsx)(fr,{id:`authorized-clients`,title:`Authorized clients`,summary:Ci(ar,Ir),control:Jt?(0,Q.jsx)(Ii,{delegatableScopes:v??[],onPairingLinkCreated:ne,clientSessions:qt&&$t.error===null&&$t.data?.type===`snapshot`?ar:null,isRevokingOtherClients:le,onRevokeOtherClients:Cr}):void 0,children:(0,Q.jsx)(St,{scrollFade:!0,chainVerticalScroll:!0,className:`max-h-[22.5rem]`,"data-testid":`authorized-clients-scroll-area`,children:qt?Ni(`current`):(0,Q.jsx)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:`This connection can create access links but cannot view authorized clients.`})})}):null,(0,Q.jsx)(kn,{open:Ue&&Qt,onOpenChange:e=>{Ve||We(e)},onOpenChangeComplete:e=>{e||Pt(null)},children:(0,Q.jsxs)(jn,{children:[(0,Q.jsxs)(Vn,{children:[(0,Q.jsx)(Nn,{children:Nt===`network-accessible`?`Enable network access?`:`Disable network access?`}),(0,Q.jsx)(Rn,{children:Nt===`network-accessible`?`Let your other devices connect to P4 Code over the network. Pair devices to give them access. P4 Code will restart.`:`Devices connected over your local network will disconnect. Existing tunnels, such as P4 Connect or Tailscale HTTPS, keep working. P4 Code will restart.`})]}),(0,Q.jsxs)(zn,{children:[(0,Q.jsx)(tr,{disabled:Ve,render:(0,Q.jsx)(I,{variant:`outline`,disabled:Ve}),children:(0,Q.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:`Cancel`})}),(0,Q.jsxs)(I,{variant:`default`,onClick:pr,disabled:!Qt||Nt===null||Ve,children:[Ve&&(0,Q.jsx)(G,{size:`sm`}),(0,Q.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:Ve?`Restarting…`:Nt===`network-accessible`?`Restart and enable`:`Restart and disable`})]})]})]})}),(0,Q.jsx)(kn,{open:ot&&Qt,onOpenChange:e=>{W||e||at(null)},children:(0,Q.jsxs)(jn,{children:[(0,Q.jsxs)(Vn,{children:[(0,Q.jsx)(Nn,{children:q?.kind===`disable`?q.wasWslOnly?`Turn off WSL and switch back to Windows?`:`Disable WSL backend?`:q?.kind===`distro`?`Switch WSL distro?`:q?.kind===`enable`?`Start the WSL backend`:q?.nextValue?`Run only the WSL backend?`:`Re-enable the Windows backend?`}),(0,Q.jsx)(Rn,{children:q?.kind===`disable`?q.wasWslOnly?`P4 Code will restart on the Windows backend. Threads and projects opened against WSL stay safe inside the distro and become available again when you re-enable WSL.`:`The WSL backend will stop. Threads and projects opened against WSL stay safe inside the distro, but they'll be unavailable in P4 Code until you re-enable WSL.`:q?.kind===`distro`?`P4 Code will restart the WSL backend on the new distro. Sessions still running on the current distro will be interrupted.`:q?.kind===`enable`?`Run the WSL backend alongside the Windows one, or stop the Windows backend and use only WSL? You can change this later from Settings.`:q?.nextValue?`P4 Code will restart and start only the WSL backend. Your Windows-side projects won't be accessible until you turn this off again.`:`P4 Code will restart and bring the Windows backend back up alongside WSL.`})]}),(0,Q.jsxs)(zn,{children:[(0,Q.jsx)(tr,{disabled:W,render:(0,Q.jsx)(I,{variant:`outline`,disabled:W}),children:`Cancel`}),q?.kind===`enable`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(I,{variant:`outline`,onClick:()=>yi(`wsl-only`),disabled:W||!Qt,children:W?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Applying…`]}):`Use only WSL`}),(0,Q.jsx)(I,{variant:`default`,onClick:()=>yi(`both`),disabled:W||!Qt,children:W?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Applying…`]}):`Run both backends`})]}):(0,Q.jsx)(I,{variant:q?.kind===`disable`||q?.kind===`wsl-only`&&q.nextValue?`destructive`:`default`,onClick:Ai,disabled:W||!Qt,children:W?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Applying…`]}):q?.kind===`disable`?q.wasWslOnly?`Switch to Windows`:`Disable WSL`:q?.kind===`distro`?`Switch distro`:q?.nextValue?`Restart and enable`:`Restart and disable`})]})]})}),(0,Q.jsx)(kn,{open:ht&&Qt,onOpenChange:e=>{U||gt(e)},children:(0,Q.jsxs)(jn,{children:[(0,Q.jsxs)(Vn,{children:[(0,Q.jsx)(Nn,{children:`Disable Tailscale HTTPS?`}),(0,Q.jsx)(Rn,{children:`P4 Code will restart the local backend without Tailscale Serve.`})]}),(0,Q.jsxs)(zn,{children:[(0,Q.jsx)(tr,{disabled:U,render:(0,Q.jsx)(I,{variant:`outline`,disabled:U}),children:`Cancel`}),(0,Q.jsx)(I,{variant:`destructive`,onClick:()=>void vr(),disabled:U||!Qt,children:U?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Restarting…`]}):`Restart and disable`})]})]})}),(0,Q.jsx)(jt,{open:ut!==null,onOpenChange:e=>{U||e||ft(null)},children:(0,Q.jsxs)(At,{className:`max-w-md`,children:[(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(wt,{children:`Set up Tailscale HTTPS?`}),(0,Q.jsx)(kt,{children:`P4 Code will restart the local backend with Tailscale Serve enabled and ask Tailscale to proxy HTTPS traffic to this backend.`})]}),(0,Q.jsxs)(Ot,{children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`HTTPS port`}),(0,Q.jsx)(xt,{className:`mt-2`,type:`number`,inputMode:`numeric`,min:1,max:65535,step:1,value:bt,onChange:e=>Mt(e.target.value),disabled:U})]}),ur?null:(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-destructive`,children:`Enter a port from 1 to 65535.`}),(0,Q.jsxs)(`div`,{className:`rounded-md border border-border/70 bg-muted/20 px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`HTTPS endpoint`}),(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm text-foreground`,children:dr??`Pending MagicDNS endpoint`})}),dr?(0,Q.jsx)(vt,{side:`top`,children:dr}):null]})]})]}),(0,Q.jsxs)(Tt,{children:[(0,Q.jsx)(Dt,{disabled:U,render:(0,Q.jsx)(I,{variant:`outline`,disabled:U}),children:`Cancel`}),(0,Q.jsx)(I,{onClick:()=>void hr(),disabled:U||!ur,children:U?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Restarting…`]}):`Enable`})]})]})})]})});return(0,Q.jsxs)(dn,{children:[Bi,(0,Q.jsxs)(fn,{...er(`remote-environments`),title:`Environments`,headerAction:(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[D.length>0?(0,Q.jsx)(Yn,{targets:D,variant:`ghost-muted`}):null,(0,Q.jsxs)(jt,{open:de,onOpenChange:e=>{fe(e),e?pe(null):V(null)},children:[(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(Et,{render:(0,Q.jsxs)(I,{size:`xs`,variant:`ghost-muted`,"aria-label":`Add environment`,children:[(0,Q.jsx)(T,{className:`size-3`}),(0,Q.jsx)(`span`,{children:`Add environment`})]})})}),(0,Q.jsx)(vt,{side:`top`,children:`Add environment`})]}),(0,Q.jsxs)(At,{className:`max-h-[80dvh] sm:max-w-3xl`,children:[(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(wt,{children:L?`Add a route to ${L.label}`:`Add Environment`}),(0,Q.jsx)(kt,{children:L?`Pair this machine again over another address, such as its Tailscale name. It joins the existing routes instead of adding a second machine.`:`Pair another environment to this client.`})]}),(0,Q.jsx)(Ot,{children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Jr({mode:`remote`,title:`Remote link`,description:`Enter a backend host and pairing code.`,icon:(0,Q.jsx)(g,{"aria-hidden":!0,className:`size-4`})}),e?Jr({mode:`ssh`,title:`SSH`,description:`Use local SSH config, agent, and tunnels for the backend.`,icon:(0,Q.jsx)(ae,{"aria-hidden":!0,className:`size-4`})}):null]}),(0,Q.jsx)(Rt,{children:me===`ssh`?ni():ti()})]})})]})]})]}),children:[x.map(e=>(0,Q.jsx)(Vi,{environment:e,removingEnvironmentId:ze,onSetEnabled:Ar,onRemove:Fr,onAddRoute:e=>{pe(e),V(null),fe(!0)}},e.environmentId)),(0,Q.jsx)(ta,{primaryEnvironmentId:f,savedEnvironments:b})]}),Fe()?(0,Q.jsx)(zr,{environmentLabel:Nr?.label??null,onCancel:()=>Pr(null),onConfirm:()=>{Nr&&(Pr(null),jr(Nr))}}):null,(0,Q.jsx)(Mr,{environments:O}),(0,Q.jsx)(Lr,{environments:O})]})}function ra(e){let{kind:t}=e;K.add({type:`success`,title:t===`hosted-link`?`Hosted app link copied`:t===`link`?`Pairing URL copied`:`Pairing code copied`,description:t===`hosted-link`?`Open it in the browser on the device you want to connect.`:t===`link`?`Open it in the client you want to pair to this environment.`:`Paste it into another client to finish pairing.`})}function ia(e){return Mi(e)?`hosted-link`:`link`}function aa(e){return!e}function oa(e){return e.currentTarget.select()}function sa(e){return e.currentTarget.select()}function ca(e){return e!==null}var la=na;export{la as component};
2
- //# sourceMappingURL=settings.connections-BPVLazeK.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-DH3P2YXY.js";import{t as n}from"./jsx-runtime-BnjsACtP.js";import{Qs as r,dr as i,q_ as a,ts as o}from"./utils-DhUt689t.js";import{W as s}from"./runtime-OeWFs5Hf.js";import{A as c,J as l,V as u,q as d}from"./entities-B8Vupv5g.js";import{Gt as f,Ht as p}from"./runtime-Ca_Z-vg5.js";import{t as m}from"./link-CsXnX9WM.js";import{q as h}from"./useSettings-gPlpTIWi.js";import{o as g}from"./session-BxUdP61p.js";import{g as _}from"./queries-hhl_J8u9.js";import{r as v}from"./SettingsPanels-CNgY_ZPe.js";import{i as y}from"./assetUrls-B6vsSVWR.js";import{_ as b,x}from"./composer-logic-P-jVPXi4.js";import{h as S}from"./composerDraftUploads-S66xDlS0.js";import{V as C,a as w,i as T,s as E}from"./settingsLayout-4ySvFdXb.js";import{t as D}from"./legalLinks-C4VP5hPh.js";var O=e(t(),1),k=e(n(),1);function A(){let{scope:e,search:t,connectedEnvironments:n}=C(),A=c(),j=o((0,O.useMemo)(()=>d({environmentIds:e.environmentIds,shellStateValueAtom:l.stateValueAtom}),[e.environmentIds])),M=x(e.environmentIds),N=g(n,a),{changedSettingLabels:P,restoreDefaults:F}=v(),I=S(u.archive,{reportFailure:!1}),{deleteThread:L}=b(),R=y(_.v2.threadProjection,{reportFailure:!1}),[z,B]=(0,O.useState)(null),V=(0,O.useRef)(!1),[H,U]=(0,O.useState)(null),[W,G]=(0,O.useState)(null),K=e.kind===`project`||e.kind===`checkout`?new Set(e.members.map(e=>`${e.environmentId}:${e.id}`)):null,q=[...new Map([...A,...M.snapshots.flatMap(({environmentId:e,snapshot:t})=>t.threads.map(t=>p(e,t)))].filter(t=>e.environmentIds.includes(t.environmentId)&&(K===null||K.has(`${t.environmentId}:${t.projectId}`))).map(e=>[`${e.environmentId}:${e.id}`,e])).values()],J=q.filter(e=>e.archivedAt===null&&f(e.runtime)),Y=j&&e.environmentIds.length>0&&!M.isLoading&&!M.error&&e.environmentIds.every(e=>n.some(t=>t.environmentId===e)&&M.snapshots.some(t=>t.environmentId===e)),X=Y&&e.environmentIds.every(e=>N.has(e)),Z=async t=>{if(V.current)return;V.current=!0,B(t===`export`?t:`confirm`),U(null),G(null);let n=t===`archive`?J:q,i=0;try{if(t!==`export`&&!await h().dialogs.confirm(t===`delete`?`Permanently delete all ${n.length} chats in ${e.label}, including archived chats? This cannot be undone.`:`Archive ${n.length} inactive chats in ${e.label}? Active chats stay open. You can restore archived chats later.`,{variant:t===`delete`?`destructive`:`default`}))return;B(t);let a=[];for(let e of n){let n=r(e.environmentId,e.id);if(t===`export`){let t=await R({environmentId:e.environmentId,input:{threadId:e.id}});if(t._tag===`Failure`)throw s(t);a.push({environmentId:e.environmentId,thread:t.value.thread,messages:t.value.messages})}else{let r=t===`archive`?await I({environmentId:e.environmentId,input:{threadId:e.id}}):await L(n);if(r._tag===`Failure`)throw s(r)}i++}if(t===`export`){let e=URL.createObjectURL(new Blob([JSON.stringify({version:1,exportedAt:new Date().toISOString(),conversations:a},null,2)],{type:`application/json`})),t=document.createElement(`a`);t.href=e,t.download=`p4-chats-${new Date().toISOString().slice(0,10)}.json`,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)}U(`${i} chats ${t===`archive`?`archived`:t===`delete`?`deleted`:`exported`}.`)}catch(e){G(`${i} of ${n.length} completed. ${e instanceof Error?e.message:`The action failed. Try again.`}`)}finally{M.refresh(),V.current=!1,B(null)}};return(0,k.jsxs)(T,{width:`wide`,children:[(0,k.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Data controls`}),(0,k.jsxs)(E,{title:`Data controls`,hideTitle:!0,id:`data-controls`,children:[(0,k.jsx)(w,{title:`Connected devices and access`,description:`Manage pairing links, devices, and access to your environments.`,control:(0,k.jsx)(i,{variant:`soft`,size:`sm`,render:(0,k.jsx)(m,{to:`/settings/connections`,search:t}),children:`Manage`})}),(0,k.jsx)(w,{title:`Model training`,description:`Your provider account controls how it uses your chats. P4 cannot change that preference for you.`,control:(0,k.jsx)(i,{variant:`soft`,size:`sm`,render:(0,k.jsx)(m,{to:`/settings/providers`,search:t}),children:`Providers`})}),(0,k.jsx)(w,{title:`Network access`,description:`Manage how devices connect to your P4 server.`,control:(0,k.jsx)(i,{variant:`soft`,size:`sm`,render:(0,k.jsx)(m,{to:`/settings/connections`,search:t}),children:`Manage`})}),(0,k.jsx)(w,{title:`Reset preferences`,description:`Restore default appearance and behavior settings. Your chats and provider credentials are kept.`,control:(0,k.jsx)(i,{variant:`destructive-outline`,size:`sm`,disabled:!!z||!P.length,onClick:()=>void F(),children:`Reset`})}),(0,k.jsx)(w,{title:`MCP access`,description:`Manage the MCP servers available to agents and their sign-ins.`,control:(0,k.jsx)(i,{variant:`soft`,size:`sm`,render:(0,k.jsx)(m,{to:`/settings/plugins`,hash:`mcp-servers`,search:t}),children:`Manage`})}),(0,k.jsx)(w,{title:`Archived chats`,control:(0,k.jsx)(i,{variant:`soft`,size:`sm`,render:(0,k.jsx)(m,{to:`/settings/archived`,search:t}),children:`Manage`})}),(0,k.jsx)(w,{title:`Archive all chats`,description:`Archives inactive chats in the selected scope.`,control:(0,k.jsx)(i,{variant:`soft`,size:`sm`,disabled:!!z||!X||!J.length,onClick:()=>void Z(`archive`),children:z===`archive`?`Archiving…`:`Archive all`})}),(0,k.jsx)(w,{title:`Delete all chats`,description:`Permanently deletes chats in the selected scope, including the archive.`,control:(0,k.jsx)(i,{variant:`destructive-outline`,size:`sm`,disabled:!!z||!X||!q.length,onClick:()=>void Z(`delete`),children:z===`delete`?`Deleting…`:`Delete all`})}),(0,k.jsx)(w,{title:`Export chat data`,description:`Download chat metadata and messages as JSON. Attachment files and tool output are not included.`,control:(0,k.jsx)(i,{variant:`soft`,size:`sm`,disabled:!!z||!Y||!q.length,onClick:()=>void Z(`export`),children:z===`export`?`Exporting…`:`Export`})}),(0,k.jsx)(w,{title:`Privacy policy`,control:(0,k.jsx)(i,{variant:`soft`,size:`sm`,render:(0,k.jsx)(`a`,{href:D,target:`_blank`,rel:`noreferrer`}),children:`Read`})})]}),W||M.error?(0,k.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-foreground`,children:W??M.error}):null,H?(0,k.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:H}):null,Y?null:(0,k.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect all environments in this scope and wait for chats to load to use bulk actions.`})]})}var j=A;export{j as component};
2
- //# sourceMappingURL=settings.data-controls-CIzGvqCI.js.map
@@ -1,4 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectIconPickerDialog-Q4GkqwDs.js","assets/react-DH3P2YXY.js","assets/jsx-runtime-BnjsACtP.js","assets/utils-DhUt689t.js","assets/activity-BT9zGwI4.js","assets/createLucideIcon-BRvysHna.js","assets/Icon-BiSXef-P.js","assets/alarm-clock-DLm_0oDD.js","assets/app-window-CBNJqZPl.js","assets/archive-D_14z4Xm.js","assets/arrow-down-up-Tu6B2hri.js","assets/arrow-down-Bo_WAMYh.js","assets/arrow-left-Ba8eq_9S.js","assets/arrow-right-left-DyJucsB1.js","assets/arrow-right-Bg4mlTrk.js","assets/arrow-up-down-AigUcA_4.js","assets/arrow-up-left-C6F8l2kC.js","assets/arrow-up-right-BNXlwlzJ.js","assets/arrow-up-D4kutFpL.js","assets/battery-DdftvRcq.js","assets/bell-4pS2DvJU.js","assets/blocks-N48yRCu0.js","assets/book-open-m1zikk07.js","assets/bookmark-DCumPe18.js","assets/bot-C71zefL3.js","assets/box-N7KHNXgQ.js","assets/bug-_77C5nd4.js","assets/calendar-arrow-down-tK2df2Gr.js","assets/calendar-arrow-up-DoqzmS-b.js","assets/calendar-clock-D24iG-gJ.js","assets/calendar-CuDpKI2e.js","assets/camera-CRxcom4Z.js","assets/chart-no-axes-column-CWRXr09M.js","assets/check-Cs_SSACZ.js","assets/chevron-down-Do9qqNbR.js","assets/chevron-left-D56AngEd.js","assets/chevron-right-CcbZ6PxZ.js","assets/chevron-up-CZEzk9UW.js","assets/chevrons-left-right-ellipsis-BuDdURW0.js","assets/chevrons-up-down-CMYBD15h.js","assets/chromium-IRgsGkxl.js","assets/circle-alert-Rh3WFq8P.js","assets/circle-arrow-up-CBkBThPI.js","assets/circle-check-Davl0yih.js","assets/circle-dashed-Divqvc3s.js","assets/circle-dot-DDXvyPkX.js","assets/circle-slash-BHppGVB2.js","assets/circle-x-DCG47j33.js","assets/circle-BXaepj2J.js","assets/clock-3-BjqRuWmx.js","assets/clock-BZce7MqL.js","assets/cloud-download-Cw2Qyeof.js","assets/cloud-upload-Bbq2IGQX.js","assets/cloud-Cnpuf424.js","assets/code-xml-C7_RVxwx.js","assets/code-C8ZFD3fi.js","assets/columns-2-R7e6oP5f.js","assets/copy-C6t_ZU58.js","assets/corner-left-up-CIgtHeD1.js","assets/corner-up-right-BWhPHx5s.js","assets/cpu-4YV41FL_.js","assets/database-0EoDfSWv.js","assets/download-CfEwtjBn.js","assets/earth-B0lYBmT1.js","assets/ellipsis-vertical-BM1Lc1f1.js","assets/ellipsis-CSD7gEuG.js","assets/external-link-Df6uBnqH.js","assets/eye-off-D5GkPp8X.js","assets/eye-DlWBkL1d.js","assets/file-braces-DycW5IfR.js","assets/file-code-corner-Bph0gpk_.js","assets/file-diff-uE_kfwjO.js","assets/file-search-BxZuGCW_.js","assets/file-spreadsheet-BDzNPY8g.js","assets/file-text-Bn72KOhu.js","assets/file-DHjVYhLT.js","assets/files-DsO7Sg8V.js","assets/film-Bbn0ceXE.js","assets/flask-conical-Cg6idKdH.js","assets/folder-closed-D6kbWc3q.js","assets/folder-cog-CBSQaLA2.js","assets/folder-git-2-n1sLmp_t.js","assets/folder-git-DCVI-R4l.js","assets/folder-open-Bu-nFCGY.js","assets/folder-plus-wg03g0vP.js","assets/folder-tree-FUExeKOH.js","assets/folder-Cieksypr.js","assets/gauge-Cgf0xSWC.js","assets/git-branch-plus-GXmZfN57.js","assets/git-branch-BWQfoO37.js","assets/git-commit-horizontal-BI_Z5Kib.js","assets/git-fork-CK2oK4JM.js","assets/git-merge-CH86CpaI.js","assets/git-pull-request-arrow-BYmuTHnq.js","assets/git-pull-request-closed-EzDnMgeA.js","assets/git-pull-request-draft-DbMmZ9EC.js","assets/globe-DHq8q48U.js","assets/grip-vertical-sTbvrVma.js","assets/hammer-BnFrycrq.js","assets/hard-drive-CnhXqMSu.js","assets/hat-glasses-C1sL_lJD.js","assets/history-BOloOry4.js","assets/house-LvUaI36y.js","assets/image-DFl_i29V.js","assets/inbox-Bfua4pqw.js","assets/info-Bwtivk15.js","assets/keyboard-C94dd8zf.js","assets/laptop-BJfWDOqH.js","assets/layers-BczY2xKh.js","assets/lightbulb-AbDNyk1F.js","assets/link-2-J9n7Ukgt.js","assets/link-iM9yOrD5.js","assets/list-checks--PgwqWme.js","assets/list-filter-C7uwdO5w.js","assets/list-ordered-JmJCtT6d.js","assets/list-todo-BOZtqLIw.js","assets/list-BNel2JmV.js","assets/loader-circle-DOPuwGUy.js","assets/lock-open-qdfB-3sG.js","assets/lock-CNeMaiIX.js","assets/log-in-DuxSLs9h.js","assets/mail-DrFNo5rr.js","assets/maximize-2-C4jSdiqI.js","assets/maximize-BKkQJR3r.js","assets/memory-stick-yVhfpVno.js","assets/message-circle-question-mark-qR5q6Xbi.js","assets/message-circle-qu3riBnu.js","assets/message-square-dashed-BDjE-epL.js","assets/message-square-off-BF3vA0b4.js","assets/message-square-text-CfjrqiSr.js","assets/message-square-warning-6MHWBWO6.js","assets/message-square-B2NO3ViY.js","assets/messages-square-BDA1tcVi.js","assets/minimize-2-D1qaBNiP.js","assets/minus-DVH2v7vL.js","assets/monitor-DYdSXGUQ.js","assets/moon-z0kk2bkY.js","assets/mouse-pointer-2-BzC5PGDm.js","assets/mouse-pointer-click-_zj1O0gg.js","assets/octagon-alert-BQp6gUkE.js","assets/package-plus-DaYcLmCH.js","assets/package-BDRaz7Ff.js","assets/paintbrush-Cd3ye7YJ.js","assets/palette-DWDYvvRF.js","assets/panel-bottom-DX8HINCH.js","assets/panel-left-aKsqIRJO.js","assets/panel-right-XrDzcWDK.js","assets/paperclip-BAtVoM2Q.js","assets/panels-top-left-ug17nD5b.js","assets/pen-line-BtsHFcuV.js","assets/pencil-ruler-u4ck96IX.js","assets/pencil-CS36_8K6.js","assets/picture-in-picture-2-CTTZM7s_.js","assets/pilcrow-B0pICPe4.js","assets/pin-B28emPdt.js","assets/play-utur7gJ1.js","assets/plug-2-BbsYUlrD.js","assets/plus-BFikiw2m.js","assets/plug-Cz_1a3P7.js","assets/power-lnBvrj1p.js","assets/presentation-DuhP07nk.js","assets/puzzle-_xVT2Tkf.js","assets/qr-code-8OyojaA-.js","assets/quote-CY1r_9f2.js","assets/radio-tower-CQ9UBgC-.js","assets/redo-2-CMJUpQN9.js","assets/refresh-cw-Bb4DfPZ_.js","assets/rotate-ccw-DIk8O74I.js","assets/rotate-cw-BCqL9vBU.js","assets/route-DDK4p_jp.js","assets/rows-3-KtFgL-bn.js","assets/scale-BWqluNv-.js","assets/search-2NYXmfL3.js","assets/send-Usbx4MSt.js","assets/server-C5VT7--0.js","assets/settings-2-CG9Vl9Oj.js","assets/settings-CSrjOUO8.js","assets/shield-check-BhnliHga.js","assets/shield-question-mark-DJzZ_XtG.js","assets/shield-Bo3bXsl5.js","assets/sliders-horizontal-CbQdxecl.js","assets/smartphone-DLXjLUvY.js","assets/smile-plus-B6sk7n9M.js","assets/sparkles-D72pVUsJ.js","assets/square-arrow-out-up-right-D4Y8_c2a.js","assets/square-pen-B9IATJSK.js","assets/square-split-horizontal-BEBi5lgX.js","assets/square-split-vertical-BvRRvh2L.js","assets/square-terminal-MebNo2O3.js","assets/square-ChD_5l-9.js","assets/star-BFGG9hcF.js","assets/sun-CV31Z7e1.js","assets/tag-DAyj5h5G.js","assets/target-DRkzkaHT.js","assets/terminal-Dbk8nKIT.js","assets/text-align-start-BlQ02nAY.js","assets/text-search-CmNwvT1W.js","assets/text-wrap-Y7SHIazH.js","assets/ticket-B3TOD4z9.js","assets/trash-2-vrfXuXSc.js","assets/trending-down-0HJRpRPf.js","assets/trending-up-B0AABrFJ.js","assets/triangle-alert-DcIYyjDc.js","assets/type-CcxvYAFU.js","assets/undo-2-CbzuoKHe.js","assets/unlink-2-Cu9CVRNc.js","assets/unplug-D0qX6EAT.js","assets/upload-_7gAV2BZ.js","assets/user-check-vIX5oc4W.js","assets/user-lock-Bz0imDJs.js","assets/user-plus-6mh3DQc1.js","assets/user-round-x-Dyi0-TdA.js","assets/user-round-CdU_AaX_.js","assets/users-CfjzCdxE.js","assets/wifi-off-DzVPlURa.js","assets/workflow-DbsdAT4Y.js","assets/wrench-Bjp_8iLx.js","assets/x-CJgPyqpa.js","assets/zap-C_GfNMdZ.js","assets/toggle-group-CYKsfBbD.js","assets/CompositeRoot-Bsb8efI6.js","assets/toggle-Dofc34s2.js","assets/input-BYd74ook.js","assets/Input-D3Qi4jCN.js","assets/FieldControl-DtsEariK.js","assets/useRegisterFieldControl-BAJIcFiO.js","assets/scroll-area-BNQKEZbp.js","assets/ScrollAreaCorner-nnFi-Ecx.js","assets/CSPContext-DGVCKkcb.js","assets/dialog-BRtKKGzk.js","assets/DialogTitle-bcvBtKP-.js","assets/ProjectMonogram-Br5sgd24.js","assets/dynamic-C8_ODyue.js","assets/index-BwdieRvq.js"])))=>i.map(i=>d[i]);
2
- import{a as e,t}from"./react-DH3P2YXY.js";import{t as n}from"./index-BwdieRvq.js";import{n as r,t as i}from"./jsx-runtime-BnjsACtP.js";import{$_ as a,$n as o,Ad as s,D as c,Ds as l,Lm as u,My as d,Pw as f,Qn as p,Qs as m,Yn as h,Yp as g,Zn as _,Zs as v,ar as y,av as b,bs as x,dr as S,jc as C,n as w,on as T,pm as E,q_ as D,qf as O,r as k,tr as ee,ts as A,ur as te}from"./utils-DhUt689t.js";import{R as ne,U as j,W as re,z as M}from"./runtime-OeWFs5Hf.js";import{A as N,F as ie,G as P,w as F}from"./entities-B8Vupv5g.js";import{On as I}from"./runtime-Ca_Z-vg5.js";import{t as L}from"./useNavigate-BWqAWfiZ.js";import{t as R}from"./useLocation-B_XV0lDx.js";import{i as z}from"./toast-DXWclCrr.js";import{E as ae,J as B,K as V,O as oe}from"./useSettings-gPlpTIWi.js";import{f as H,s as U}from"./server-6nKYyc8r.js";import{n as W,o as G}from"./session-BxUdP61p.js";import{t as K}from"./use-atom-command-vqjL7n-x.js";import{t as q}from"./toastHelpers-DxXYm50b.js";import{t as J}from"./input-BYd74ook.js";import{n as Y}from"./assetUrls-B6vsSVWR.js";import{D as X,E as se,O as ce,j as le,y as ue}from"./keybindings-B_kRk5Fi.js";import{t as de}from"./PierreEntryIcon-GQImyog1.js";import{t as fe}from"./ProjectFavicon-OMOnEzVu.js";import{d as pe}from"./projectFilesQueryState-0jxJ50Qq.js";import{n as me}from"./p4ProjectFile-CwpteA7b.js";import{h as he,n as ge}from"./composerDraftUploads-S66xDlS0.js";import{r as _e,t as ve}from"./alert-BN-r9V4f.js";import{L as ye,U as be,V as xe,a as Z,i as Se,r as Ce,s as we}from"./settingsLayout-4ySvFdXb.js";import{i as Te,o as Ee,r as De}from"./command-BIELTYJu.js";import{dn as Oe,in as ke,pn as Ae}from"./main-VfCRP294.js";import{c as je,f as Me,i as Ne,n as Pe,o as Fe,r as Ie,s as Le,t as Re}from"./projectScriptEditor-CMGXoIEJ.js";import{t as ze}from"./ProjectDefaultsSettings-DX2Kf-tx.js";import{t as Be}from"./SettingsScopeNotice-BFxCBOnl.js";var Ve=r(),Q=e(t(),1),$=e(i(),1);function He(e){let t=(0,Ve.c)(14),n=(0,Q.useRef)(null),[r,i]=(0,Q.useState)(We),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),l,u;t[0]===r?(l=t[1],u=t[2]):(l=()=>{let e=n.current;if(r||!e)return;let t=new IntersectionObserver(e=>{e.some(Ue)&&i(!0)});return t.observe(e),()=>t.disconnect()},u=[r],t[0]=r,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d;t[3]!==r||t[4]!==e.cwd||t[5]!==e.path?(d=r?{_tag:`draft-workspace-file`,cwd:e.cwd,path:e.path}:null,t[3]=r,t[4]=e.cwd,t[5]=e.path,t[6]=d):d=t[6];let f=Y(e.environmentId,d),p=f._tag===`Success`?f.url:null,m=p!==null&&s!==p,h=m&&a===p,g=h?null:e.fallback,_;t[7]!==h||t[8]!==m||t[9]!==p?(_=m?(0,$.jsx)(`img`,{alt:``,className:`absolute max-h-8 max-w-8 rounded-sm object-contain${h?``:` invisible`}`,decoding:`async`,loading:`lazy`,onError:()=>c(p),onLoad:()=>o(p),src:p},p):null,t[7]=h,t[8]=m,t[9]=p,t[10]=_):_=t[10];let v;return t[11]!==g||t[12]!==_?(v=(0,$.jsxs)(`span`,{ref:n,className:`relative flex size-8 shrink-0 items-center justify-center`,children:[g,_]}),t[11]=g,t[12]=_,t[13]=v):v=t[13],v}function Ue(e){return e.isIntersecting}function We(){return typeof IntersectionObserver>`u`}function Ge(e,t,n){return t||(n?e.trim()?`Searching project files…`:`Indexing project files…`:e.trim()?`No matching image files.`:`No image files found.`)}function Ke(e,t){return!k(t)||I(e)}function qe(e){let[t,n]=(0,Q.useState)(``),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),s=pe(e.environmentId,e.cwd,t,200,{imageOnly:!0}),{resolvedTheme:c}=V(),l=A(U),u=e.onPickExternal,d=w(typeof navigator>`u`?``:navigator.platform),f=(0,Q.useMemo)(()=>ke(s.entries,s.matchedQuery).map(t=>({kind:`action`,value:`project-favicon:${t.path}`,searchTerms:[t.name,t.path],title:t.name,description:t.path,icon:(0,$.jsx)(He,{cwd:e.cwd,environmentId:e.environmentId,fallback:(0,$.jsx)(de,{pathValue:t.path,kind:`file`,theme:c}),path:t.path}),run:async()=>e.onSelect(t.path)})),[e.cwd,e.environmentId,e.onSelect,c,s.entries,s.matchedQuery]);return(0,$.jsx)(De,{open:e.open,onOpenChange:e.onOpenChange,children:e.open?(0,$.jsx)(Te,{"aria-label":`Choose project icon`,className:`overflow-hidden`,onBackdropPointerDown:()=>e.onOpenChange(!1),children:(0,$.jsx)(Ae,{"aria-label":`Choose project icon`,autoHighlight:`always`,escapeLabel:`Close`,footerActionLabel:`Select icon`,footerTrailing:u?(0,$.jsx)(Ee,{disabled:a,onClick:()=>{o(!0),u().then(t=>{t&&(e.onOpenChange(!1),e.onSelect(t))}).catch(e=>{z.add({type:`error`,title:`Could not open image picker`,description:e instanceof Error?e.message:`An error occurred.`})}).finally(()=>o(!1))},children:`Open in ${d}`}):null,inputProps:{placeholder:`Search image files…`},mode:`none`,onItemHighlighted:e=>{i(typeof e==`string`?e:null)},onValueChange:e=>{i(null),n(e)},panelSize:`tall-list`,testId:`project-favicon-picker`,value:t,children:(0,$.jsx)(Oe,{groups:f.length>0?[{value:`project-favicon-files`,label:e.projectName,items:f}]:[],highlightedItemValue:r,isActionsOnly:!1,keybindings:l,onExecuteItem:t=>{t.kind===`action`&&(e.onOpenChange(!1),t.run())},emptyStateMessage:Ge(t,s.error,s.isPending)})})}):null})}function Je(e){let t=(0,Ve.c)(10),{scripts:n,keybindings:r,disabled:i,onEdit:a}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`p`,{className:`px-3 py-2 text-base text-muted-foreground sm:px-4 sm:text-sm`,children:`No actions configured.`}),t[0]=e):e=t[0],e}let o;if(t[1]!==i||t[2]!==r||t[3]!==a||t[4]!==n){let e;t[6]!==i||t[7]!==r||t[8]!==a?(e=e=>{let t=ue(r,X(e.id));return(0,$.jsx)(Z,{className:`group py-2`,title:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Ie,{icon:e.icon,className:`size-4 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),e.runOnWorktreeCreate?(0,$.jsx)(`span`,{className:`shrink-0 rounded-sm border border-border/60 px-1.5 py-px text-2xs font-normal text-muted-foreground`,children:`setup`}):null,e.runOnSettle?(0,$.jsx)(`span`,{className:`shrink-0 rounded-sm border border-border/60 px-1.5 py-px text-2xs font-normal text-muted-foreground`,children:`on settle`}):null,e.previewUrl?(0,$.jsx)(`span`,{className:`shrink-0 rounded-sm border border-border/60 px-1.5 py-px text-2xs font-normal text-muted-foreground max-sm:hidden`,children:`preview · desktop only`}):null]}),description:(0,$.jsx)(`code`,{className:`block max-w-full truncate font-mono`,children:e.command}),control:(0,$.jsxs)($.Fragment,{children:[t?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t}):null,(0,$.jsx)(`span`,{className:`flex shrink-0 opacity-0 group-focus-within:opacity-100 group-hover:opacity-100`,children:(0,$.jsx)(S,{size:`icon-xs`,variant:`ghost-muted`,"aria-label":`Edit ${e.name}`,disabled:i,onClick:()=>a(e),children:(0,$.jsx)(E,{className:`size-3.5`})})})]})},e.id)},t[6]=i,t[7]=r,t[8]=a,t[9]=e):e=t[9],o=n.map(e),t[1]=i,t[2]=r,t[3]=a,t[4]=n,t[5]=o}else o=t[5];return o}function Ye(e){if(e._tag===`Failure`&&!ne(e)){let t=re(e);z.add({type:`error`,title:`Failed to save project actions`,description:t instanceof Error?t.message:`An error occurred.`})}return M(e,()=>void 0)}function Xe(e){let t=F(),[n,r]=(0,Q.useState)(!1),i=(0,Q.useRef)(!1),o=K(H.updateSettings,`project actions update`),s=K(H.upsertKeybinding,`action shortcut update`),c=K(H.removeKeybinding,`action shortcut removal`);async function u(n,u,d){if(i.current||e.length===0){let e=`No available machine, or another action change is saving.`;return z.add({type:`error`,title:`Actions not saved`,description:e}),x(f(Error(e)))}if(e.some(({environmentId:e})=>!W(e,`settings:write`)))return Ye(x(f(new b({requiredScope:a,message:`This connection cannot change environment settings.`}))));i.current=!0,r(!0);try{for(let{environmentId:r,settings:i,keybindings:a,project:l}of e){let e=l?Me(i,l):i.defaultProjectScripts,f=n(e),p=f??i.defaultProjectScripts,m=await o({environmentId:r,input:{patch:l?{projectSettingsOverrides:{[l.id]:f===null?me(i,l.id,[`defaultProjectScripts`]):{...i.projectSettingsOverrides[l.id],defaultProjectScripts:f}}}:{defaultProjectScripts:f??[]}}});if(m._tag===`Failure`)return Ye(m);let h=u?[u]:e.filter(e=>!p.some(t=>t.id===e.id)).map(e=>e.id);for(let e of h){let n=X(e),o=je(a,n),u=o?Le({keybinding:o,command:n}):null,p=Le({keybinding:d,command:n}),m=!f?.some(t=>t.id===e)&&(l&&i.defaultProjectScripts.some(t=>t.id===e)||Object.entries(i.projectSettingsOverrides).some(([t,n])=>t!==l?.id&&n.defaultProjectScripts?.some(t=>t.id===e))||t.some(t=>t.environmentId===r&&t.id!==l?.id&&(l?Me(i,t):t.scripts).some(t=>t.id===e))),h=p?await s({environmentId:r,input:u&&u.key!==p.key?{...p,replace:u}:p}):u&&!m?await c({environmentId:r,input:u}):null;if(h?._tag===`Failure`)return Ye(h)}}return l(void 0)}finally{i.current=!1,r(!1)}}function d(n,r){let i=[...t.flatMap(e=>e.scripts.map(e=>e.id)),...e.flatMap(({settings:e,project:t})=>[...e.defaultProjectScripts,...Object.values(e.projectSettingsOverrides).flatMap(e=>e.defaultProjectScripts??[]),...t?.scripts??[]].map(e=>e.id))],a=n??ce(r.name,i),o=se(a,r);return u(e=>{let t=e.map(e=>e.id===a?o:le(e,r));return n===null?[...t,o]:t},a,r.keybinding)}return{saving:n,persist:u,submit:d}}function Ze(){let e=(0,Ve.c)(67),{scope:t,targets:n,target:r}=xe(),{environments:i}=ae(),a=t.kind===`project`||t.kind===`checkout`,c;e[0]!==i||e[1]!==r?(c=r?i.find(e=>e.environmentId===r.environmentId)?.serverConfig:void 0,e[0]=i,e[1]=r,e[2]=c):c=e[2];let l=c,u;e[3]===r?.settings.defaultProjectScripts?u=e[4]:(u=r?.settings.defaultProjectScripts??[],e[3]=r?.settings.defaultProjectScripts,e[4]=u);let f=u,m=l?.keybindings??C,v;if(e[5]!==f||e[6]!==n){let t;e[8]===f?t=e[9]:(t=e=>JSON.stringify(e.settings.defaultProjectScripts)!==JSON.stringify(f),e[8]=f,e[9]=t),v=n.some(t),e[5]=f,e[6]=n,e[7]=v}else v=e[7];let b=v,x=ye(),[w,T]=(0,Q.useState)(null),E,D,O;e[10]!==i||e[11]!==a||e[12]!==t.members||e[13]!==n?(E=new Map(a?t.members.map($e):[]),D=Xe,O=n.flatMap(e=>{let t=i.find(t=>t.environmentId===e.environmentId);if(!t?.serverConfig)return[];let n=e.projectId?E.get(e.projectId):void 0;return n&&t.serverConfig.environment?.capabilities.projectSettingsOverrides!==!0?[]:[{environmentId:e.environmentId,settings:t.serverConfig.settings,keybindings:t.serverConfig.keybindings,...n?{project:n}:{}}]}),e[10]=i,e[11]=a,e[12]=t.members,e[13]=n,e[14]=E,e[15]=D,e[16]=O):(E=e[14],D=e[15],O=e[16]);let{saving:k,persist:A,submit:j}=D(O),M;e[17]!==E||e[18]!==r?(M=r?.projectId?E.get(r.projectId):void 0,e[17]=E,e[18]=r,e[19]=M):M=e[19];let N=M,ie;e[20]===N?.environmentId?ie=e[21]:(ie=N?.environmentId??d.make(`none`),e[20]=N?.environmentId,e[21]=ie);let P=Fe(ie,N?.workspaceRoot??null),F;if(e[22]!==P.scripts||e[23]!==f){let t;e[25]===f?t=e[26]:(t=e=>!f.some(t=>t.command===e.command||t.name.toLowerCase()===e.name.toLowerCase()),e[25]=f,e[26]=t),F=P.scripts.filter(t),e[22]=P.scripts,e[23]=f,e[24]=F}else F=e[24];let I=F,L;e[27]===j?L=e[28]:(L=async e=>{let t={name:e.name,command:e.command,icon:e.icon??`play`,runOnWorktreeCreate:e.runOnWorktreeCreate??!1,waitForSetup:e.runOnWorktreeCreate===!0&&e.async===!1,runOnSettle:e.runOnSettle??!1,keybinding:null,previewUrl:e.previewUrl??null,autoOpenPreview:e.previewUrl?e.autoOpenPreview??!1:!1},n=await j(null,t);if(n._tag===`Failure`&&!ne(n)){let e=re(n);T({scriptId:null,initial:t,error:e instanceof Error?e.message:`Failed to import action.`})}},e[27]=j,e[28]=L);let R=L,z;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(z=[`defaultProjectScripts`],e[29]=z):z=e[29];let B;e[30]===A?B=e[31]:(B=()=>void A(Qe),e[30]=A,e[31]=B);let V;e[32]!==x||e[33]!==R||e[34]!==I||e[35]!==k?(V=I.length>0?(0,$.jsxs)(h,{children:[(0,$.jsxs)(te,{render:(0,$.jsx)(S,{id:`import-scripts`,size:`xs`,variant:`ghost`,disabled:k||!x,type:`button`}),children:[`Import scripts`,(0,$.jsx)(s,{className:`size-3.5`})]}),(0,$.jsxs)(ee,{align:`end`,children:[(0,$.jsxs)(_,{children:[(0,$.jsx)(p,{children:`Import from p4.json`}),(0,$.jsx)(`p`,{className:`px-2 pb-2 text-pretty text-sm text-muted-foreground`,children:`Add actions declared by this checkout without editing them first.`})]}),(0,$.jsx)(y,{}),I.map(e=>(0,$.jsxs)(o,{onClick:()=>void R(e),children:[(0,$.jsx)(Ie,{icon:e.icon??`play`,className:`size-4 shrink-0`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate font-medium`,children:e.name}),(0,$.jsx)(`div`,{className:`truncate font-mono text-muted-foreground`,children:e.command})]})]},`${e.name} ${e.command}`))]})]}):null,e[32]=x,e[33]=R,e[34]=I,e[35]=k,e[36]=V):V=e[36];let oe=k||!x||n.length===0,H,U;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>T({scriptId:null,initial:Re}),U=(0,$.jsx)(g,{className:`size-3.5`}),e[37]=H,e[38]=U):(H=e[37],U=e[38]);let W;e[39]===oe?W=e[40]:(W=(0,$.jsxs)(S,{size:`xs`,variant:`outline`,disabled:oe,onClick:H,children:[U,`Add action`]}),e[39]=oe,e[40]=W);let G;e[41]!==V||e[42]!==W?(G=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[V,W]}),e[41]=V,e[42]=W,e[43]=G):G=e[43];let K;e[44]!==b||e[45]!==B||e[46]!==G?(K=(0,$.jsx)(Z,{serverScoped:!0,settingKeys:z,mixed:b,title:`Actions`,description:`Commands that run in this project's checkout or its worktree, with optional shortcuts.`,onResetOverride:B,control:G}),e[44]=b,e[45]=B,e[46]=G,e[47]=K):K=e[47];let q;e[48]!==x||e[49]!==m||e[50]!==b||e[51]!==k||e[52]!==f?(q=b?(0,$.jsx)(Z,{title:`Different actions across environments`,description:`Choose one environment to edit its list. Adding an action here adds it on every selected environment.`}):(0,$.jsx)(Je,{scripts:f,keybindings:m,disabled:k||!x,onEdit:e=>T(Ne(e,m))}),e[48]=x,e[49]=m,e[50]=b,e[51]=k,e[52]=f,e[53]=q):q=e[53];let J;e[54]===P.status?J=e[55]:(J=P.status===`invalid`?(0,$.jsx)(Z,{title:`p4.json is invalid`,description:`A p4.json exists in this checkout but fails to parse, so every action and icon it declares is ignored. Check the JSON syntax and icon values.`,className:`text-warning`}):null,e[54]=P.status,e[55]=J);let Y;e[56]!==A||e[57]!==w||e[58]!==f||e[59]!==j||e[60]!==r?(Y=r&&(0,$.jsx)(Pe,{environmentId:r.environmentId,editScope:`settings:write`,request:w,scripts:f,onSubmit:j,onDelete:e=>void A(t=>t.filter(t=>t.id!==e),e,null),onClose:()=>T(null)}),e[56]=A,e[57]=w,e[58]=f,e[59]=j,e[60]=r,e[61]=Y):Y=e[61];let X;return e[62]!==K||e[63]!==q||e[64]!==J||e[65]!==Y?(X=(0,$.jsxs)(we,{id:`project-actions`,title:`Actions`,children:[K,q,J,Y]}),e[62]=K,e[63]=q,e[64]=J,e[65]=Y,e[66]=X):X=e[66],X}function Qe(){return null}function $e(e){return[e.id,e]}function et(e,t,n){return n&&e.some(e=>e!==t)}var tt=(0,Q.lazy)(()=>n(()=>import(`./ProjectIconPickerDialog-Q4GkqwDs.js`).then(e=>({default:e.ProjectIconPickerDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233])));function nt(e){return`${e.environmentId}:${e.id}`}function rt(e){let t=(0,Ve.c)(34),{projectKey:n,environmentId:r,checkoutKey:i}=e,a=r===void 0?null:r,o=i===void 0?null:i,s=be(),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={from:`/settings`},t[0]=c):c=t[0];let l=L(c),u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={select:at},t[1]=u):u=t[1];let d=R(u),f;t[2]!==s||t[3]!==n?(f=s.find(e=>e.projectKey===n)??null,t[2]=s,t[3]=n,t[4]=f):f=t[4];let p=f,m;t[5]!==o||t[6]!==a||t[7]!==p?.memberProjects?(m=p?.memberProjects.filter(e=>(a===null||e.environmentId===a)&&(o===null||e.physicalProjectKey===o))??[],t[5]=o,t[6]=a,t[7]=p?.memberProjects,t[8]=m):m=t[8];let h=m,g=(0,Q.useRef)(null),_,v;t[9]!==o||t[10]!==a||t[11]!==h||t[12]!==p?(_=()=>{p&&h.length!==0&&(g.current={key:p.projectKey,environmentId:a,checkoutKey:o,memberKeys:h.map(it)})},v=[p,h,a,o],t[9]=o,t[10]=a,t[11]=h,t[12]=p,t[13]=_,t[14]=v):(_=t[13],v=t[14]),(0,Q.useEffect)(_,v);let y,b;if(t[15]!==o||t[16]!==a||t[17]!==s||t[18]!==h.length||t[19]!==l||t[20]!==d||t[21]!==n?(b=()=>{if(h.length>0)return;let e=g.current;if(e?.key!==n||e.environmentId!==a||e.checkoutKey!==o)return;let t=s.find(t=>t.memberProjects.some(t=>e.memberKeys.includes(t.physicalProjectKey)));t&&l({to:d,search:()=>({project:t.projectKey,machine:a??void 0,checkout:o??void 0}),replace:!0,hashScrollIntoView:!1})},y=[s,l,d,n,h.length,a,o],t[15]=o,t[16]=a,t[17]=s,t[18]=h.length,t[19]=l,t[20]=d,t[21]=n,t[22]=y,t[23]=b):(y=t[22],b=t[23]),(0,Q.useEffect)(b,y),!p){let e=s.length===0?`Add a project from the sidebar to configure it here.`:`This project is no longer available.`,n;return t[24]===e?n=t[25]:(n=(0,$.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-sm text-muted-foreground`,children:e}),t[24]=e,t[25]=n),n}if(h.length===0){let e;return t[26]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`p`,{className:`p-8 text-sm text-muted-foreground`,children:`This checkout is no longer available in the selected project and environment.`}),t[26]=e):e=t[26],e}let x;t[27]!==h||t[28]!==p?(x={...p,memberProjects:h,environmentId:h[0].environmentId,id:h[0].id},t[27]=h,t[28]=p,t[29]=x):x=t[29];let S=x,C=`${p.projectKey}:${a??`all`}:${o??`all`}`,w=h.length<p.memberProjects.length,T;return t[30]!==S||t[31]!==C||t[32]!==w?(T=(0,$.jsx)(ot,{group:S,hasOtherMembers:w},C),t[30]=S,t[31]=C,t[32]=w,t[33]=T):T=t[33],T}function it(e){return e.physicalProjectKey}function at(e){return e.pathname}function ot({group:e,hasOtherMembers:t}){let n=L({from:`/settings`}),r=oe(),{environments:i}=ae(),a=(0,Q.useMemo)(()=>new Map(i.map(e=>[e.environmentId,e])),[i]),o=G(e.memberProjects,D),s=e.memberProjects.every(e=>o.has(e.environmentId)),d=e.memberProjects.find(e=>a.get(e.environmentId)?.serverConfig!=null)??e.memberProjects[0],p=N(),h=he(P.update,{reportFailure:!1}),g=he(P.delete,{reportFailure:!1}),_=(0,Q.useRef)(!1),y=d.faviconPath??null,b=d.projectIcon??null,C=typeof window<`u`&&e.memberProjects.every(e=>e.environmentId===r&&Ke(e.workspaceRoot,navigator.platform))?window.desktopBridge?.pickProjectFavicon:void 0,w=(0,Q.useCallback)((e,t)=>{if(t._tag!==`Failure`||ne(t))return;let n=re(t);z.add(q({type:`error`,title:e,description:n instanceof Error?n.message:`An error occurred.`}))},[]),E=(0,Q.useCallback)((e,t)=>{let n=e.find(e=>!W(e.environmentId,D));if(!n)return null;let r=x(f(Error(`This connection cannot change projects in ${n.environmentLabel??`this environment`}.`)));return w(t,r),r},[w]),k=(0,Q.useCallback)(async(t,n)=>{let r=E(e.memberProjects,n);if(r)return r;let i=e.memberProjects.find(e=>{let t=a.get(e.environmentId);return t?.connection.phase!==`connected`||!t.serverConfig});if(i){let e=Error(`Connect ${i.environmentLabel??`the selected environment`} and try again.`),t=x(f(e));return w(n,t),t}for(let r of e.memberProjects){let i=E([r],n);if(i)return i;let a=M(await h({environmentId:r.environmentId,input:{projectId:r.id,...t}}),()=>void 0);if(a._tag===`Failure`)return w(e.memberProjects.length>1?`${n} on ${r.environmentLabel??`the current environment`}`:n,a),a}return l(void 0)},[E,a,e.memberProjects,w,h]),ee=(0,Q.useCallback)(async(t,n)=>{let r=t.trim();if(!r){z.add({type:`warning`,title:`Project title cannot be empty`});return}et(e.memberProjects.map(e=>e.title),r,n)&&await k({title:r},`Failed to rename project`)},[e.memberProjects,k]),[A,te]=T(!s),[F,I]=T(!s),[R,V]=(0,Q.useState)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useCallback)(async e=>{if(!H.current){H.current=!0,V(!0);try{await k(e,`Failed to update project icon`)}finally{H.current=!1,V(!1)}}},[k]),K=e.memberProjects.length>1,Y=(0,Q.useCallback)(async r=>{if(E(r,`Failed to remove project`))return;let i=B();if(!i)return;let a=new Set(r.map(nt)),o=p.filter(e=>a.has(`${e.environmentId}:${e.projectId}`)),s=r.length===e.memberProjects.length,l=t||!s?`checkout`:`project`,u=r.length===1?r[0]:null,d=u?.title??e.displayName,f=await j(()=>i.dialogs.confirm([o.length>0?`Remove ${l} "${d}" and delete its ${o.length} thread${o.length===1?``:`s`}?`:`Remove ${l} "${d}"?`,...u?[`Path: ${u.workspaceRoot}`,...u.environmentLabel?[`Environment: ${u.environmentLabel}`]:[]]:[`This removes ${r.length} grouped project entries.`],...o.length>0?[`This permanently clears conversation history for those threads and any archived threads.`]:[`This permanently clears any archived conversation history.`],s&&!t?`This removes only the project entries, not the files on disk.`:`Other entries in this grouped project are unaffected.`,`This action cannot be undone.`].join(`
3
- `),{variant:`destructive`}));if(f._tag===`Failure`||!f.value||E(r,`Failed to remove project`))return;let h=c.getState();for(let e of r){if(E([e],`Failed to remove project`))return;let t=o.filter(t=>t.environmentId===e.environmentId&&t.projectId===e.id),n=M(await g({environmentId:e.environmentId,input:{projectId:e.id,force:!0}}),()=>void 0);if(n._tag===`Failure`){w(`Failed to remove "${e.title}"`,n);return}let r=v(e.environmentId,e.id);await ie(r),ge(r,t.map(e=>m(e.environmentId,e.id)));let i=h.getDraftThreadByProjectRef(r);i&&h.clearDraftThread(i.draftId),h.clearProjectDraftThreadId(r)}s&&!t&&n({to:`/`,replace:!0})},[E,g,e.displayName,e.memberProjects.length,t,n,w,p]),X=(0,$.jsx)(we,{title:`Checkouts`,children:e.memberProjects.map(e=>(0,$.jsx)(Z,{title:e.environmentLabel??`Environment`,description:e.workspaceRoot,control:(0,$.jsx)(S,{size:`sm`,variant:`outline`,disabled:!o.has(e.environmentId),onClick:()=>void Y([e]),"aria-label":`Remove checkout ${e.workspaceRoot}`,children:`Remove`})},e.physicalProjectKey))});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(Se,{className:`gap-6`,children:[(0,$.jsxs)(ve,{variant:`info`,children:[(0,$.jsx)(O,{"aria-hidden":!0}),(0,$.jsx)(_e,{children:`Can't find a setting? Keep this project picked above and hop to any other settings page.`})]}),(0,$.jsxs)(we,{id:`project-overview`,title:`Project`,hideTitle:!0,children:[s?null:(0,$.jsx)(`p`,{className:`px-3 py-2 text-sm text-muted-foreground sm:px-4`,children:e.memberProjects.length>1?`Shared settings require permission to change every checkout in this group.`:`This connection cannot change this project.`}),(0,$.jsx)(Z,{title:`Name`,description:`The shared name for this project group in the sidebar and thread lists.`,control:(0,$.jsx)(J,{size:`sm`,className:`w-full sm:w-64`,"aria-label":`Project name`,disabled:!s,defaultValue:e.displayName,onChange:()=>{_.current=!0},onBlur:e=>{let t=_.current;_.current=!1,ee(e.currentTarget.value,t)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()}},`${e.projectKey}:${e.displayName}`)}),(0,$.jsx)(Z,{title:`Project icon`,description:b?.kind===`lucide`?`${b.name} · ${b.color}`:b?.kind===`monogram`?`${b.text} · ${b.color}`:b?.kind===`emoji`?b.emoji:y??`Automatic`,resetAction:e.memberProjects.some(e=>e.faviconPath!=null||e.projectIcon!=null)?(0,$.jsx)(Ce,{label:`project icon`,disabled:R||!s,onClick:()=>void U({faviconPath:null,projectIcon:null})}):null,control:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(fe,{project:d,className:`size-6`}),(0,$.jsx)(S,{size:`sm`,variant:`outline`,type:`button`,"aria-label":`Choose a project icon`,disabled:R||!s,onClick:()=>I(!0),children:`Choose icon`}),(0,$.jsx)(S,{size:`sm`,variant:`outline`,type:`button`,"aria-label":`Choose a project icon file`,disabled:R||!s,onClick:()=>te(!0),children:`Choose file`})]})})]}),(0,$.jsx)(ze,{category:`project`}),(0,$.jsx)(Ze,{}),K?X:null,(0,$.jsx)(we,{title:`Danger`,children:(0,$.jsx)(Z,{title:t?`Remove checkout`:e.memberProjects.length>1?`Remove this project everywhere`:`Remove project`,description:t?`Deletes the selected machine's checkout entries and their threads. Other machines and files on disk are not touched.`:e.memberProjects.length>1?`Deletes all ${e.memberProjects.length} checkout entries and their threads on every machine. Files on disk are not touched.`:`Deletes the project entry and its threads. Files on disk are not touched.`,control:(0,$.jsxs)(S,{size:`sm`,variant:`destructive-outline`,disabled:!s,onClick:()=>void Y(e.memberProjects),children:[(0,$.jsx)(u,{}),t?`Remove checkout`:e.memberProjects.length>1?`Remove all entries`:`Remove project`]})})})]}),(0,$.jsx)(qe,{cwd:d.workspaceRoot,environmentId:d.environmentId,onOpenChange:te,...C?{onPickExternal:()=>C(d.workspaceRoot)}:{},onSelect:e=>void U({faviconPath:e,projectIcon:null}),open:A&&s,projectName:e.displayName},`${d.environmentId}:${d.workspaceRoot}:${A}`),F&&s?(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(tt,{current:b,projectName:d.title,open:!0,onOpenChange:I,onSelect:e=>void U({faviconPath:null,projectIcon:e})})}):null]})}function st(){let e=(0,Ve.c)(7),{search:t,scope:n}=xe(),r=n.kind===`project`||n.kind===`checkout`||n.kind===`unavailable`&&(n.reason===`project-missing`||n.reason===`checkout-missing`),i;return e[0]!==r||e[1]!==n.kind||e[2]!==n.message||e[3]!==t.checkout||e[4]!==t.machine||e[5]!==t.project?(i=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:t.project&&r?(0,$.jsx)(rt,{projectKey:t.project,environmentId:t.machine?d.make(t.machine):null,checkoutKey:t.checkout??null}):n.kind===`unavailable`?(0,$.jsx)(Se,{children:(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.message})}):(0,$.jsx)(Be,{target:`project`,children:`Choose a project to manage its name, icon, checkouts and actions.`})}),e[0]=r,e[1]=n.kind,e[2]=n.message,e[3]=t.checkout,e[4]=t.machine,e[5]=t.project,e[6]=i):i=e[6],i}var ct=st;export{ct as component};
4
- //# sourceMappingURL=settings.projects-CeoZzdMW.js.map