@p4code/cli 0.8.24 → 0.8.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/{binCli-DNod5652.mjs → binCli-DgjAnX7K.mjs} +610 -480
  3. package/dist/client/.vite/manifest.json +2246 -2246
  4. package/dist/client/assets/AlertDialogRoot-uMQTdBRo.js +2 -0
  5. package/dist/client/assets/{AnimatedHeight-wZzihILs.js → AnimatedHeight-xpLZZo3s.js} +2 -2
  6. package/dist/client/assets/{AuthSurfaceShell-Wwq6fM9A.js → AuthSurfaceShell-B0GeuqGG.js} +2 -2
  7. package/dist/client/assets/{CSPContext-BjqtxKhA.js → CSPContext-BOMhNaNg.js} +2 -2
  8. package/dist/client/assets/{ChatGptUsageButton-8lmdyDiG.js → ChatGptUsageButton-BsRw7PIG.js} +2 -2
  9. package/dist/client/assets/ChatMarkdown-B_7CYt1t.js +65 -0
  10. package/dist/client/assets/{CheckboxIndicator-CuZi7Ixm.js → CheckboxIndicator-CtJqB7ns.js} +2 -2
  11. package/dist/client/assets/{ClippedText-DPgP0ObI.js → ClippedText-DoAq5p0h.js} +2 -2
  12. package/dist/client/assets/{CodexSetupSection.logic-oYzzgIWo.js → CodexSetupSection.logic-CAeeNfjx.js} +2 -2
  13. package/dist/client/assets/{ComboboxClear-zheEdyAa.js → ComboboxClear-gWUoU_9i.js} +2 -2
  14. package/dist/client/assets/{ComboboxGroupLabel-BxCdL7I3.js → ComboboxGroupLabel-PqwekxYO.js} +2 -2
  15. package/dist/client/assets/{CommandBlock-ByCjpPww.js → CommandBlock-a6FR0Qjq.js} +2 -2
  16. package/dist/client/assets/ComposerPromptEditor-JiLuF8sa.js +204 -0
  17. package/dist/client/assets/{CompositeRoot-Bg5KGYGp.js → CompositeRoot-DXqEvNI3.js} +2 -2
  18. package/dist/client/assets/{ConnectionStatusDot-Bx8Imvqc.js → ConnectionStatusDot-DsDhJub7.js} +2 -2
  19. package/dist/client/assets/{DesignPageTile-ClF5Va3g.js → DesignPageTile-6OCPIqLU.js} +2 -2
  20. package/dist/client/assets/DevicePanel-BCkjPnRB.js +2 -0
  21. package/dist/client/assets/{DeviceSetup-Dm9ZbkMC.js → DeviceSetup-jQhLCRQB.js} +2 -2
  22. package/dist/client/assets/{DialogTitle-CVP748Gv.js → DialogTitle-B_iSZXaO.js} +2 -2
  23. package/dist/client/assets/{DiffCommentAnnotation-Dx-VhoLU.js → DiffCommentAnnotation-Ce3fywCz.js} +3 -3
  24. package/dist/client/assets/{DiffFileTree-BgjyfH71.js → DiffFileTree-Ch8ghRNl.js} +2 -2
  25. package/dist/client/assets/DiffPanel-BYdDuPJL.js +2 -0
  26. package/dist/client/assets/{DiffWorkerPoolProvider-C_yNvh6o.js → DiffWorkerPoolProvider-CCTRrTde.js} +3 -3
  27. package/dist/client/assets/{EmbeddedDesign-DDApp-WI.js → EmbeddedDesign-BasGnrZc.js} +4 -4
  28. package/dist/client/assets/{EnvironmentMachineIcon-B2v_GWgB.js → EnvironmentMachineIcon-CmWYXtho.js} +2 -2
  29. package/dist/client/assets/{ExpandableText-fJVIbCvG.js → ExpandableText-BgfA9yOq.js} +2 -2
  30. package/dist/client/assets/{FieldControl-mq4xNgmP.js → FieldControl-D-HuGl-Y.js} +2 -2
  31. package/dist/client/assets/{FileDiff-B_422yEN.js → FileDiff-HO0wYuF-.js} +2 -2
  32. package/dist/client/assets/{FilePreviewPanel-B26lXYsA.js → FilePreviewPanel-BWAkLnOF.js} +9 -9
  33. package/dist/client/assets/{FoldedSettingsSection-TLqDB_1b.js → FoldedSettingsSection-itwybIpg.js} +2 -2
  34. package/dist/client/assets/{FormContext-Vtmj_mkP.js → FormContext-D41axClw.js} +2 -2
  35. package/dist/client/assets/{Icons-C0Zjws-3.js → Icons-bbJxtd49.js} +2 -2
  36. package/dist/client/assets/Input-BcEftKLM.js +2 -0
  37. package/dist/client/assets/{KeybindingsSettings.logic-D-GClV-c.js → KeybindingsSettings.logic-DbRWYCku.js} +2 -2
  38. package/dist/client/assets/{NoProjectsHero-Bx1X9Us-.js → NoProjectsHero-1ktyCaCR.js} +2 -2
  39. package/dist/client/assets/{P4ConnectAccountPages-BWvaLOY-.js → P4ConnectAccountPages-C8kjCH2i.js} +2 -2
  40. package/dist/client/assets/{P4ConnectSidebarSignIn-C8z-Gfq5.js → P4ConnectSidebarSignIn-De0TqOBv.js} +2 -2
  41. package/dist/client/assets/PanelLayoutControls-CRn29ViL.js +216 -0
  42. package/dist/client/assets/{PierreEntryIcon-Ddl-VPd4.js → PierreEntryIcon-DZSPzXnW.js} +2 -2
  43. package/dist/client/assets/{PopoverHandle-BT83XTq9.js → PopoverHandle-BUkWn6lX.js} +2 -2
  44. package/dist/client/assets/PreviewPanel-CPU0sstq.js +2 -0
  45. package/dist/client/assets/ProjectDefaultsSettings-Ibem_Z4L.js +2 -0
  46. package/dist/client/assets/{ProjectFavicon-BDaMxno-.js → ProjectFavicon-CE_urBAW.js} +3 -3
  47. package/dist/client/assets/{ProjectIconPickerDialog-Be5IQyyr.js → ProjectIconPickerDialog-D0OZSLq9.js} +2 -2
  48. package/dist/client/assets/{ProjectMonogram-BUy_N1of.js → ProjectMonogram-C1SBXbLc.js} +2 -2
  49. package/dist/client/assets/{ProviderAuthTerminal-BFGd236-.js → ProviderAuthTerminal-Ddl4fv02.js} +2 -2
  50. package/dist/client/assets/ProviderModelPicker-BTTJn7iC.js +2 -0
  51. package/dist/client/assets/{ProviderSettingsForm-D6u9dY73.js → ProviderSettingsForm-CGRf8WX5.js} +2 -2
  52. package/dist/client/assets/{PullRequestCodeTab-hXtKZAP9.js → PullRequestCodeTab-CWg3y2Hg.js} +3 -3
  53. package/dist/client/assets/{ReadOnlySourcePreview-CDLZaWo2.js → ReadOnlySourcePreview-B2RUv5et.js} +2 -2
  54. package/dist/client/assets/{RenderErrorBoundary-BkcvpgEh.js → RenderErrorBoundary-BE9pu802.js} +2 -2
  55. package/dist/client/assets/ScheduledTasksSettings-LlwIif-M.js +4 -0
  56. package/dist/client/assets/{ScopedSwitch-yznbaSh9.js → ScopedSwitch-DM7op4tT.js} +2 -2
  57. package/dist/client/assets/{ScrollAreaCorner-3gSiyg8H.js → ScrollAreaCorner-CpFtD7m1.js} +2 -2
  58. package/dist/client/assets/{SecretInput-itt3KL-b.js → SecretInput-aXfqfjLk.js} +2 -2
  59. package/dist/client/assets/{SelectScrollUpArrow-D_o_f6Fh.js → SelectScrollUpArrow-CMpd0Jm1.js} +2 -2
  60. package/dist/client/assets/{SettingsPanels-DdhZ2nXb.js → SettingsPanels-BJZmVkq6.js} +6 -6
  61. package/dist/client/assets/{SettingsPanels.logic-DIuWE5Xf.js → SettingsPanels.logic-DlcMmTBT.js} +2 -2
  62. package/dist/client/assets/{SettingsScopeNotice-D8K81IzP.js → SettingsScopeNotice-DvcB28n8.js} +2 -2
  63. package/dist/client/assets/{ThemeEditorPanel-ePX4nwaV.js → ThemeEditorPanel-Cv_FhYYJ.js} +3 -3
  64. package/dist/client/assets/{ThreadTerminalDrawer-5z4y3z0y.js → ThreadTerminalDrawer-B4Hx5Gtc.js} +4 -4
  65. package/dist/client/assets/TooltipViewport-BkvH9Kzg.js +2 -0
  66. package/dist/client/assets/{Virtualizer-DEM6HN7-.js → Virtualizer-Dka4WQhw.js} +2 -2
  67. package/dist/client/assets/{WorkspaceBreadcrumb-B5ZV6VNj.js → WorkspaceBreadcrumb-DnyZiGsn.js} +2 -2
  68. package/dist/client/assets/{WorkspacePageContainer-BTN44jG6.js → WorkspacePageContainer-OhHg0688.js} +2 -2
  69. package/dist/client/assets/{WorkspacePageHeader-BaCxaW-R.js → WorkspacePageHeader-BUVfTGMv.js} +2 -2
  70. package/dist/client/assets/_chat-71Bl4UTO.js +45 -0
  71. package/dist/client/assets/{_chat.design-CQ52N70I.js → _chat.design-L-wLlTQh.js} +2 -2
  72. package/dist/client/assets/{_chat.index-SFAYIX_P.js → _chat.index-Cqzn3tFu.js} +2 -2
  73. package/dist/client/assets/{_chat.new-BO6oEisx.js → _chat.new-CmqMNN1q.js} +3 -3
  74. package/dist/client/assets/_chat.pull-requests-Cv4Q6L5c.js +2 -0
  75. package/dist/client/assets/{abnfDiagram-VCTEODGH-DhiN6SMz.js → abnfDiagram-VCTEODGH-DGwfULSN.js} +2 -2
  76. package/dist/client/assets/{alert-CdZT7d18.js → alert-D4hu_q2y.js} +2 -2
  77. package/dist/client/assets/architecture-7GRP2DOG-BVmWArUl.js +1 -0
  78. package/dist/client/assets/{architectureDiagram-5GKGNRK7-bs37U5FM.js → architectureDiagram-5GKGNRK7-fZiBVATu.js} +2 -2
  79. package/dist/client/assets/{assets-BU-ex_t8.js → assets-Zca4LKSx.js} +2 -2
  80. package/dist/client/assets/{blockDiagram-I7D4REHJ-Bz9mN89n.js → blockDiagram-I7D4REHJ-Cs_imlrU.js} +2 -2
  81. package/dist/client/assets/{browserHistoryStore-KDG9Uz1t.js → browserHistoryStore-9YCQpJy9.js} +2 -2
  82. package/dist/client/assets/{browserLinkTarget-DmKK3HY0.js → browserLinkTarget-BnxzanaN.js} +2 -2
  83. package/dist/client/assets/{c4Diagram-7LVT6UL2-CtkHQd_E.js → c4Diagram-7LVT6UL2-jxRP5rAE.js} +2 -2
  84. package/dist/client/assets/channel-DyV-uKW8.js +2 -0
  85. package/dist/client/assets/{checkbox-Q0bv8RvC.js → checkbox-PYOAN-IL.js} +2 -2
  86. package/dist/client/assets/{chunk-4HAMMTFA-BtUnQAH6.js → chunk-4HAMMTFA-CD4tA6cX.js} +2 -2
  87. package/dist/client/assets/{chunk-75Z2AOVW-CwSe19lZ.js → chunk-75Z2AOVW-B4sXgwEx.js} +2 -2
  88. package/dist/client/assets/{chunk-DU6HZSFF-Bwy7A0TF.js → chunk-DU6HZSFF-DMXcgXT_.js} +2 -2
  89. package/dist/client/assets/{chunk-F27PBJKO-CVsi2uk3.js → chunk-F27PBJKO-CGf21cwH.js} +2 -2
  90. package/dist/client/assets/{chunk-GMAD6QVW-CVzXn5Hv.js → chunk-GMAD6QVW-mPVRZq9Z.js} +2 -2
  91. package/dist/client/assets/{chunk-GVQU2GXP-7pPJVhuz.js → chunk-GVQU2GXP-ChBHtvjy.js} +2 -2
  92. package/dist/client/assets/{chunk-IMKFNOWR-D-dmx49n.js → chunk-IMKFNOWR-BtgRygmA.js} +2 -2
  93. package/dist/client/assets/{chunk-L3NEJ4N5-DEJnMXSk.js → chunk-L3NEJ4N5-REmklvQl.js} +2 -2
  94. package/dist/client/assets/{chunk-OSK3NFVY-CBtNmbZ8.js → chunk-OSK3NFVY-m-QXUYaT.js} +2 -2
  95. package/dist/client/assets/{chunk-P2QGCYS3-TNHN3Sve.js → chunk-P2QGCYS3-CeefF5cA.js} +2 -2
  96. package/dist/client/assets/{chunk-POPQ4Y6H-1cq1nl-Z.js → chunk-POPQ4Y6H-C-_RXsmg.js} +2 -2
  97. package/dist/client/assets/{chunk-PWAF6VOD-B85KpsBk.js → chunk-PWAF6VOD-DflyqEaS.js} +2 -2
  98. package/dist/client/assets/{chunk-SHT3W25Y-3tA2UDk1.js → chunk-SHT3W25Y-R_Fg17nt.js} +2 -2
  99. package/dist/client/assets/{chunk-SVP7TREG-CHzBNDDY.js → chunk-SVP7TREG-BTfev3Yx.js} +2 -2
  100. package/dist/client/assets/{chunk-TICWLB2K-MeLbkhnz.js → chunk-TICWLB2K-C7WGvYp1.js} +2 -2
  101. package/dist/client/assets/classDiagram-ZZMXUADV-B0NhU5d_.js +2 -0
  102. package/dist/client/assets/classDiagram-v2-VYDZK3BY-B0NhU5d_.js +2 -0
  103. package/dist/client/assets/{color-picker-BWZhsiZJ.js → color-picker-D4_JMCD4.js} +2 -2
  104. package/dist/client/assets/{combobox-BdGKdc6i.js → combobox-CJgXDxx7.js} +2 -2
  105. package/dist/client/assets/{command-CIj8Rufv.js → command-Bdd9mlwd.js} +2 -2
  106. package/dist/client/assets/{composer-logic-DyIi6K9e.js → composer-logic-De298qJ8.js} +4 -4
  107. package/dist/client/assets/{composerDraftUploads-BEFyD-t4.js → composerDraftUploads-DojMN9dn.js} +2 -2
  108. package/dist/client/assets/{connect-BUAMGrjt.js → connect-DqGJc6Zq.js} +2 -2
  109. package/dist/client/assets/{connect-agent-BNwEsc4t.js → connect-agent-Dss1yfYI.js} +2 -2
  110. package/dist/client/assets/{cynefin-OW5HDTMX-DTUXnTov.js → cynefin-OW5HDTMX-DnGTy7Az.js} +1 -1
  111. package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-Cd9_EwZX.js → cynefinDiagram-5FMLGOSQ-va9nLZtf.js} +2 -2
  112. package/dist/client/assets/{dagre-GXQ25YYZ-D0hUgab8.js → dagre-GXQ25YYZ-D0QXSOGs.js} +2 -2
  113. package/dist/client/assets/{design-DaqMSnWJ.js → design-C9BU7qd7.js} +2 -2
  114. package/dist/client/assets/{device-DnfWBPpo.js → device-CtPu58XW.js} +2 -2
  115. package/dist/client/assets/{diagram-S7CK7UJ4-DY-wIVhL.js → diagram-S7CK7UJ4-cEFyiWjL.js} +2 -2
  116. package/dist/client/assets/{diagram-UQ7AKVKN-CmWAx8wR.js → diagram-UQ7AKVKN-CNgu8Xrb.js} +2 -2
  117. package/dist/client/assets/{diagram-VSXAHHWV-DvIYORJP.js → diagram-VSXAHHWV-BPPJ-FGp.js} +2 -2
  118. package/dist/client/assets/{diagram-VX7I27RA-Dj3l0KCm.js → diagram-VX7I27RA-DmmJR7mF.js} +2 -2
  119. package/dist/client/assets/{diagram-Z3DM3KII-ClP8dtWB.js → diagram-Z3DM3KII-B2E7hDLy.js} +2 -2
  120. package/dist/client/assets/{dialog-Cgb4jap2.js → dialog-Bdi4gsq5.js} +2 -2
  121. package/dist/client/assets/{diffRendering-BWY0g219.js → diffRendering-Dam20Pyq.js} +2 -2
  122. package/dist/client/assets/{discovery-list-DXkskf2A.js → discovery-list-CPLxz_C8.js} +2 -2
  123. package/dist/client/assets/{dist-C5JAYxip.js → dist-BDrj9x6z.js} +3 -3
  124. package/dist/client/assets/{draft-input-DQxVE9YJ.js → draft-input-CmGR2Zc1.js} +2 -2
  125. package/dist/client/assets/{duoViewer-fztyITHM.js → duoViewer-D-r4O9JA.js} +2 -2
  126. package/dist/client/assets/{dynamic-CnYAeR9T.js → dynamic-Cog_ioOk.js} +3 -3
  127. package/dist/client/assets/{ebnfDiagram-PWID7BFC-DtbBVfJO.js → ebnfDiagram-PWID7BFC-CdqWonW-.js} +2 -2
  128. package/dist/client/assets/{embeddedScripts-Bf2j7tmA.js → embeddedScripts-twbjTzvu.js} +2 -2
  129. package/dist/client/assets/{empty-DHl8_LXy.js → empty-DeLw5x6B.js} +2 -2
  130. package/dist/client/assets/{entities-BJgMc8pv.js → entities-BhpgabTo.js} +2 -2
  131. package/dist/client/assets/{erDiagram-RLTQ6QDP-Dm2mBAGp.js → erDiagram-RLTQ6QDP-Cj9VHvs2.js} +2 -2
  132. package/dist/client/assets/eventmodeling-NTZA5JFV-CkU6Du-F.js +1 -0
  133. package/dist/client/assets/{fileLinks-C9oYzhXv.js → fileLinks-CCxqMBvI.js} +2 -2
  134. package/dist/client/assets/{fileTreeExpansion-CpkONCrM.js → fileTreeExpansion-N_KS64dO.js} +2 -2
  135. package/dist/client/assets/flowDiagram-HODETNUW-BvniDpHa.js +1 -0
  136. package/dist/client/assets/{ganttDiagram-EL5Y4UJY-D4UHegQH.js → ganttDiagram-EL5Y4UJY--tZCMTKs.js} +2 -2
  137. package/dist/client/assets/{getDiffFileInput-BKRfCrth.js → getDiffFileInput-wQ-J_p6Q.js} +2 -2
  138. package/dist/client/assets/{gitGraph-4MIJSDKK-BUhEDO22.js → gitGraph-4MIJSDKK-Dw_fdYPs.js} +1 -1
  139. package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-BwJT0OjN.js → gitGraphDiagram-WWUBYQGX-mCz7mnTd.js} +2 -2
  140. package/dist/client/assets/{guideRunStore-DkBR0CPU.js → guideRunStore-Dk9f0e_S.js} +2 -2
  141. package/dist/client/assets/hat-glasses-D7AuONMv.js +2 -0
  142. package/dist/client/assets/{htmlRender-BUb_wWp9.js → htmlRender-CSsSEPs1.js} +2 -2
  143. package/dist/client/assets/{index-BYQ1ybfT.js → index-B0OiR0Ol.js} +3 -3
  144. package/dist/client/assets/{info-A6RAGUB7-scwAD75p.js → info-A6RAGUB7-Dm2Q2YW8.js} +1 -1
  145. package/dist/client/assets/{infoDiagram-27XIBGKW-BgR5Wn6l.js → infoDiagram-27XIBGKW-CRahhr54.js} +2 -2
  146. package/dist/client/assets/{input-D_jxqXLR.js → input-CDBTiBJx.js} +2 -2
  147. package/dist/client/assets/{input-group-BM_USnbh.js → input-group-CHJvPXpi.js} +2 -2
  148. package/dist/client/assets/{ishikawaDiagram-5VMMS53U-BOnOvOet.js → ishikawaDiagram-5VMMS53U-B8BPPaoL.js} +2 -2
  149. package/dist/client/assets/{journeyDiagram-3NMN7TZE-B1wXWe62.js → journeyDiagram-3NMN7TZE-CyL0jLPT.js} +2 -2
  150. package/dist/client/assets/{kanban-definition-UXKFOSKX-DI-FwQ_D.js → kanban-definition-UXKFOSKX-cbdied2B.js} +2 -2
  151. package/dist/client/assets/{kbd-B2uytHus.js → kbd-BGpxKPhX.js} +2 -2
  152. package/dist/client/assets/{keybindings-CqjUKNRx.js → keybindings-4i_VvPsX.js} +2 -2
  153. package/dist/client/assets/{lazyRouteComponent-CByGrW41.js → lazyRouteComponent-DehCr3JG.js} +2 -2
  154. package/dist/client/assets/{line-c6BqGnEH.js → line-qgzYahVp.js} +2 -2
  155. package/dist/client/assets/{link-BjP3qTK9.js → link-DQSgeAPg.js} +2 -2
  156. package/dist/client/assets/{linkedPrompt-DjSidfRe.js → linkedPrompt-BZnl7hrP.js} +2 -2
  157. package/dist/client/assets/{main-4dRVuXx2.js → main-BgKiw-9f.js} +19 -19
  158. package/dist/client/assets/main-Dk22djvP.css +2 -0
  159. package/dist/client/assets/{mediaReference-CWzBBNFa.js → mediaReference-BhzLpYF9.js} +2 -2
  160. package/dist/client/assets/{mediaSource-CHfRwmOf.js → mediaSource-Bk_NKKP2.js} +2 -2
  161. package/dist/client/assets/{mermaid-parser.core-DOOH_cP_.js → mermaid-parser.core-Dbb1WTb8.js} +4 -4
  162. package/dist/client/assets/{mermaid.core-9Tao6ZdD.js → mermaid.core-Dtz8UzUI.js} +5 -5
  163. package/dist/client/assets/{mindmap-definition-YA3MSWOX-CqmRXnVH.js → mindmap-definition-YA3MSWOX-D7G9MbUQ.js} +2 -2
  164. package/dist/client/assets/number-field-j3MeOhOk.js +2 -0
  165. package/dist/client/assets/{observeResize-jHx61cGA.js → observeResize-3DufCT68.js} +2 -2
  166. package/dist/client/assets/{onboarding-BmDFkmWD.js → onboarding-CXb4LvSr.js} +2 -2
  167. package/dist/client/assets/{openFileInPreview-DF_vZEIK.js → openFileInPreview-B8KdOFV6.js} +2 -2
  168. package/dist/client/assets/{p4ProjectFile-YfIRB1xP.js → p4ProjectFile-BrXxii5J.js} +2 -2
  169. package/dist/client/assets/{packet-AYTQ26CC-B8LkZ5j3.js → packet-AYTQ26CC-3JoyTbIn.js} +1 -1
  170. package/dist/client/assets/{pair-DSE8uuft.js → pair-B6bpqsN5.js} +2 -2
  171. package/dist/client/assets/{pegDiagram-XKGWAZYB-CS17GwTP.js → pegDiagram-XKGWAZYB-7VJjFwNR.js} +2 -2
  172. package/dist/client/assets/{pendingSendStore-CaGsppQi.js → pendingSendStore-DWZwD8Qe.js} +2 -2
  173. package/dist/client/assets/{phoneViewer-CYzqv5af.js → phoneViewer-DDX1p0cN.js} +2 -2
  174. package/dist/client/assets/{pie-WAS4IAKB-B0WBcNHW.js → pie-WAS4IAKB-CXeLZCFV.js} +1 -1
  175. package/dist/client/assets/{pieDiagram-E7YTZNPT-Bk2IwUHp.js → pieDiagram-E7YTZNPT-BY1P4Uer.js} +2 -2
  176. package/dist/client/assets/{pierre-icons-CY4HbMoq.js → pierre-icons-CL-szz98.js} +2 -2
  177. package/dist/client/assets/{popover-2XJd3KEJ.js → popover-N-pn4OqA.js} +2 -2
  178. package/dist/client/assets/{preview-8bBtJM5H.js → preview-DL8QWLgw.js} +2 -2
  179. package/dist/client/assets/{preview-B5v36DP8.js → preview-HJcGsd2o.js} +2 -2
  180. package/dist/client/assets/{previewMiniPlayerStore-DMd0mA7a.js → previewMiniPlayerStore--CyDShCc.js} +2 -2
  181. package/dist/client/assets/primary-rJDv25B2.js +2 -0
  182. package/dist/client/assets/{primaryCloudLinkState-CJSCsrUH.js → primaryCloudLinkState-CzF2gmHs.js} +2 -2
  183. package/dist/client/assets/{projectFilesQueryState-DltGYM_H.js → projectFilesQueryState-DM9_vSRA.js} +2 -2
  184. package/dist/client/assets/{projectScriptEditor-CZb_iNq3.js → projectScriptEditor-Pml2NkVE.js} +2 -2
  185. package/dist/client/assets/{providerSkills-Ct4SZ-mY.js → providerSkills-waACvYAJ.js} +2 -2
  186. package/dist/client/assets/{pullRequestDetail.logic-COstpMB1.js → pullRequestDetail.logic-C-5flOlM.js} +2 -2
  187. package/dist/client/assets/{pullRequestIcons-e8EZW8_y.js → pullRequestIcons-B9gjoHK4.js} +2 -2
  188. package/dist/client/assets/{pullRequestReviewStore-DJx8EOVl.js → pullRequestReviewStore-DuoLLEGp.js} +2 -2
  189. package/dist/client/assets/{pullRequests-ClG7PJe0.js → pullRequests-Br_9L7m4.js} +2 -2
  190. package/dist/client/assets/{quadrantDiagram-AXDQQJYC-B0vWHjBG.js → quadrantDiagram-AXDQQJYC-DyZq_mGc.js} +2 -2
  191. package/dist/client/assets/queries-CuZx4Gi3.js +2 -0
  192. package/dist/client/assets/query-DrtB5w10.js +2 -0
  193. package/dist/client/assets/{radar-RG4KPBEZ-DmYBXYPt.js → radar-RG4KPBEZ-B21YfCpU.js} +1 -1
  194. package/dist/client/assets/{radio-group-BNV16qlg.js → radio-group-D5b1YnNe.js} +2 -2
  195. package/dist/client/assets/{railroad-74A4TZTK-D-4grcyc.js → railroad-74A4TZTK-CaiYAzxA.js} +1 -1
  196. package/dist/client/assets/railroad-abnf-HS5TGJTU-ZJmaNeUq.js +1 -0
  197. package/dist/client/assets/railroad-ebnf-LZEXJU2U-C27brj-I.js +1 -0
  198. package/dist/client/assets/railroad-peg-WCYAUIDC-CukzLv2P.js +1 -0
  199. package/dist/client/assets/{railroadDiagram-O6MQD6OU-C7n4Qist.js → railroadDiagram-O6MQD6OU-BZ0HuIrV.js} +2 -2
  200. package/dist/client/assets/{renderScheduler-DrstEe4y.js → renderScheduler-xdSjl5z7.js} +2 -2
  201. package/dist/client/assets/{requirementDiagram-BXWQKSXE-BYX3uen6.js → requirementDiagram-BXWQKSXE-C4OJUf9q.js} +2 -2
  202. package/dist/client/assets/{rightPanelStore-XfAJpUIA.js → rightPanelStore-BLSD3K6s.js} +2 -2
  203. package/dist/client/assets/{runtime-CArTL2GH.js → runtime-V62Oyi1q.js} +2 -2
  204. package/dist/client/assets/{runtime-Cj24N7je.js → runtime-mg6KxRIi.js} +3 -3
  205. package/dist/client/assets/runtimeModeConfig-CSStNUjU.js +2 -0
  206. package/dist/client/assets/{sankeyDiagram-P5KCCOFB-tAgp-_Ny.js → sankeyDiagram-P5KCCOFB-CDOw9Kul.js} +2 -2
  207. package/dist/client/assets/{scheduledTasksSettings.logic-zleH3iJ_.js → scheduledTasksSettings.logic-CrYg_vYi.js} +2 -2
  208. package/dist/client/assets/{scroll-area-DORwTFtw.js → scroll-area-CT3H0nmo.js} +2 -2
  209. package/dist/client/assets/{select-Bsag72zE.js → select-CqPGedM1.js} +2 -2
  210. package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-DlvnWAh_.js → sequenceDiagram-WJ2MYXX4-C9BMDi3Q.js} +2 -2
  211. package/dist/client/assets/{server-Vynm5NwP.js → server-C8OpoOTL.js} +2 -2
  212. package/dist/client/assets/{session-DyiiEN5g.js → session-BAH17FBJ.js} +2 -2
  213. package/dist/client/assets/{session-logic-B8t9Dfk3.js → session-logic-BKiIVDj0.js} +2 -2
  214. package/dist/client/assets/{settings-CjeBlT1I.js → settings-BiLwAn9B.js} +2 -2
  215. package/dist/client/assets/settings.appearance-DB8azH3Q.js +2 -0
  216. package/dist/client/assets/settings.archived-BgPgmE5p.js +2 -0
  217. package/dist/client/assets/{settings.computer-use-S7DPGiAx.js → settings.computer-use-DpcKtt2q.js} +2 -2
  218. package/dist/client/assets/settings.connections-RKFcKfpz.js +2 -0
  219. package/dist/client/assets/{settings.data-controls-Bj1pQ5cL.js → settings.data-controls-NjUH57Fr.js} +2 -2
  220. package/dist/client/assets/{settings.decisions-BufUBcem.js → settings.decisions-B-HjeKFr.js} +2 -2
  221. package/dist/client/assets/{settings.designs-bWCNQca4.js → settings.designs-DWbfEcuK.js} +2 -2
  222. package/dist/client/assets/{settings.diagnostics-Dx_NdxOm.js → settings.diagnostics-DY7e0sc8.js} +2 -2
  223. package/dist/client/assets/settings.general-dsLXGi9j.js +2 -0
  224. package/dist/client/assets/settings.integrations-BLYy6l0O.js +2 -0
  225. package/dist/client/assets/{settings.keybindings-DrBH8mlK.js → settings.keybindings-Bcl4KxN4.js} +2 -2
  226. package/dist/client/assets/{settings.open-source-licenses-B3CGE-JI.js → settings.open-source-licenses-ZP9ezdc4.js} +2 -2
  227. package/dist/client/assets/{settings.plugins-BGUgmDOY.js → settings.plugins-JjZ7Ptzj.js} +4 -4
  228. package/dist/client/assets/settings.projects-DhhMAw0F.js +4 -0
  229. package/dist/client/assets/settings.providers-sowFjazx.js +3 -0
  230. package/dist/client/assets/settings.scheduled-tasks-BIfprPPD.js +2 -0
  231. package/dist/client/assets/{settings.snap-shot-C2X5_E0H.js → settings.snap-shot-B1go--dA.js} +2 -2
  232. package/dist/client/assets/{settings.source-control-Dvac_5mZ.js → settings.source-control-BL1tH7qk.js} +2 -2
  233. package/dist/client/assets/{settings.storage-1JdpL3lo.js → settings.storage-Bt_7LmzS.js} +2 -2
  234. package/dist/client/assets/{settingsLayout-CuUCC6iL.js → settingsLayout-DaLF8Hfm.js} +3 -3
  235. package/dist/client/assets/{sidebar-CV_a9dPF.js → sidebar-BopQa8qy.js} +2 -2
  236. package/dist/client/assets/{sidebarProjectGrouping-r5ezKRMx.js → sidebarProjectGrouping-DQInVNnY.js} +2 -2
  237. package/dist/client/assets/{skeleton-Bq50sEah.js → skeleton-CzpSBxtu.js} +2 -2
  238. package/dist/client/assets/{sourceControl-b1QZpCro.js → sourceControl-B9T0IPlu.js} +2 -2
  239. package/dist/client/assets/{sourceControlClients-DUvOeR-2.js → sourceControlClients-BgBu2ayZ.js} +2 -2
  240. package/dist/client/assets/{spinner-Bzrp5oww.js → spinner-BkmZz-kc.js} +2 -2
  241. package/dist/client/assets/square-plus-B9j2jkOq.js +2 -0
  242. package/dist/client/assets/{standalone-page-BGqmgLmI.js → standalone-page-CpVawPkl.js} +2 -2
  243. package/dist/client/assets/{stateDiagram-D77RDMKH-BOgNCEU1.js → stateDiagram-D77RDMKH-B032MgyK.js} +2 -2
  244. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-CEPamUoD.js +2 -0
  245. package/dist/client/assets/{swimlanes-42K2YHIH-BZG7hJb7.js → swimlanes-42K2YHIH-Bn6WbS8G.js} +2 -2
  246. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-D1eJox12.js +9 -0
  247. package/dist/client/assets/{terminal-links-DHw7nXFF.js → terminal-links-D1lZWzBL.js} +2 -2
  248. package/dist/client/assets/{terminalSessions-BHzkH7av.js → terminalSessions-BjIB3wg1.js} +2 -2
  249. package/dist/client/assets/{textarea-wDfYVvpo.js → textarea-UGuOTqiM.js} +2 -2
  250. package/dist/client/assets/{themePalette-CLR_iiPi.js → themePalette-DELPwUM7.js} +2 -2
  251. package/dist/client/assets/{timeline-definition-24CTP7MA-B5YiUA25.js → timeline-definition-24CTP7MA-RGCq2eyK.js} +2 -2
  252. package/dist/client/assets/toast-B2B2ECBW.js +2 -0
  253. package/dist/client/assets/{toggle-ExdxBJoI.js → toggle-DTjg9Rvs.js} +2 -2
  254. package/dist/client/assets/{toggle-group-Clz6KDtW.js → toggle-group--s5MIuQv.js} +2 -2
  255. package/dist/client/assets/{tooltip-D-SzZpgJ.js → tooltip-CuJiZzK7.js} +2 -2
  256. package/dist/client/assets/{treeView-Q6P3EWNA-Cb4H3xoG.js → treeView-Q6P3EWNA-CkhQE3UU.js} +1 -1
  257. package/dist/client/assets/{treemap-WGGIJYW6-BdpTgSX1.js → treemap-WGGIJYW6-DjBfz9t-.js} +1 -1
  258. package/dist/client/assets/{uiStateStore-DoJ0IbwQ.js → uiStateStore-TZf81BHB.js} +2 -2
  259. package/dist/client/assets/usage-Dp-M0_Do.js +2 -0
  260. package/dist/client/assets/{usageAccess-ZgmQIiWk.js → usageAccess-CkJJNWUS.js} +2 -2
  261. package/dist/client/assets/{usageFormat-C54RJiV9.js → usageFormat-CUKLjyKC.js} +2 -2
  262. package/dist/client/assets/{usageShortcuts-B3af64g0.js → usageShortcuts-DMVEjVe8.js} +2 -2
  263. package/dist/client/assets/{use-atom-command-D34CFqu3.js → use-atom-command-BWLbyoVN.js} +2 -2
  264. package/dist/client/assets/{useAriaLabelledBy-BG5RCb1o.js → useAriaLabelledBy-B4zsIPk4.js} +2 -2
  265. package/dist/client/assets/{useHandleNewThread-DtUtwJAY.js → useHandleNewThread-DLupIP68.js} +2 -2
  266. package/dist/client/assets/{useLocation-7uJHNdPS.js → useLocation-XbiRdmmb.js} +2 -2
  267. package/dist/client/assets/useNavigate-CSxB1zLo.js +2 -0
  268. package/dist/client/assets/{useNavigateBack-DpCLZais.js → useNavigateBack-BDMTgSKu.js} +2 -2
  269. package/dist/client/assets/{useP4ConnectAuthPrompt-D4kHnZ3Q.js → useP4ConnectAuthPrompt-C18iYCzm.js} +2 -2
  270. package/dist/client/assets/{useParams-Br7l7qPU.js → useParams-DNmNCHjx.js} +2 -2
  271. package/dist/client/assets/{usePermissionStatus-SyBwmFSK.js → usePermissionStatus-DBybaxyT.js} +2 -2
  272. package/dist/client/assets/{usePullRequestActions-BypvA9CK.js → usePullRequestActions-CWCz_AQW.js} +3 -3
  273. package/dist/client/assets/{useRegisterFieldControl-qXOWsCr5.js → useRegisterFieldControl-Cuo8UAhZ.js} +2 -2
  274. package/dist/client/assets/useScopedModelAvailability-D1MGYLGR.js +2 -0
  275. package/dist/client/assets/useSettings-BEKkRzL1.js +3 -0
  276. package/dist/client/assets/utils-B0w8dSf5.js +37 -0
  277. package/dist/client/assets/{vcsRefInvalidation-hPKz3TmL.js → vcsRefInvalidation-Dx_cpFEA.js} +2 -2
  278. package/dist/client/assets/{vennDiagram-4TSXK5OY-D4zvlwrY.js → vennDiagram-4TSXK5OY-D0wsDnkf.js} +2 -2
  279. package/dist/client/assets/{wardley-WFR3VGLG-Cscy0eBS.js → wardley-WFR3VGLG-BT7dOBGA.js} +1 -1
  280. package/dist/client/assets/{wardleyDiagram-VM6X3IG4-od5X9Ppf.js → wardleyDiagram-VM6X3IG4-CgbZOhZ-.js} +2 -2
  281. package/dist/client/assets/{welcome-7UQgfS5x.js → welcome-D3Kttsfe.js} +2 -2
  282. package/dist/client/assets/{xychartDiagram-S5SC5T6Z-KWfWaW4I.js → xychartDiagram-S5SC5T6Z-D3RW49u7.js} +2 -2
  283. package/dist/client/index.html +1 -1
  284. package/package.json +1 -1
  285. package/dist/client/assets/AlertDialogRoot-Cc8kVCUa.js +0 -2
  286. package/dist/client/assets/ChatMarkdown-Cd3yE4VU.js +0 -65
  287. package/dist/client/assets/ComposerPromptEditor-4EkkS1N5.js +0 -204
  288. package/dist/client/assets/DevicePanel-DWlHQcLW.js +0 -2
  289. package/dist/client/assets/DiffPanel-tZN29mdM.js +0 -2
  290. package/dist/client/assets/Input-B0ah2lnC.js +0 -2
  291. package/dist/client/assets/PanelLayoutControls-C2deQDB2.js +0 -216
  292. package/dist/client/assets/PreviewPanel-8NDLwOfI.js +0 -2
  293. package/dist/client/assets/ProjectDefaultsSettings-DN1GxlYC.js +0 -2
  294. package/dist/client/assets/ProviderModelPicker-DMtMvBKn.js +0 -2
  295. package/dist/client/assets/ScheduledTasksSettings-BJyFxVyR.js +0 -4
  296. package/dist/client/assets/TooltipViewport-DJ2VRKCt.js +0 -2
  297. package/dist/client/assets/_chat-C0vR23gu.js +0 -45
  298. package/dist/client/assets/_chat.pull-requests-BfyCJw7Q.js +0 -2
  299. package/dist/client/assets/architecture-7GRP2DOG-Yd6b7qRF.js +0 -1
  300. package/dist/client/assets/channel-DrCQqhMU.js +0 -2
  301. package/dist/client/assets/classDiagram-ZZMXUADV-MCjIu9oU.js +0 -2
  302. package/dist/client/assets/classDiagram-v2-VYDZK3BY-MCjIu9oU.js +0 -2
  303. package/dist/client/assets/eventmodeling-NTZA5JFV-rDo_pcJr.js +0 -1
  304. package/dist/client/assets/flowDiagram-HODETNUW-C55XBPww.js +0 -1
  305. package/dist/client/assets/hat-glasses-XqtwpGM5.js +0 -2
  306. package/dist/client/assets/main-Dwir4BoC.css +0 -2
  307. package/dist/client/assets/number-field-Dj0uYTJQ.js +0 -2
  308. package/dist/client/assets/primary-BKQnuXrW.js +0 -2
  309. package/dist/client/assets/queries-BWcz-n4a.js +0 -2
  310. package/dist/client/assets/query-BFP47tsD.js +0 -2
  311. package/dist/client/assets/railroad-abnf-HS5TGJTU-6H_zYY6R.js +0 -1
  312. package/dist/client/assets/railroad-ebnf-LZEXJU2U-DYahAqN_.js +0 -1
  313. package/dist/client/assets/railroad-peg-WCYAUIDC-CdcgHAXA.js +0 -1
  314. package/dist/client/assets/runtimeModeConfig-sQBlbgY3.js +0 -2
  315. package/dist/client/assets/settings.appearance-DUvYlE0y.js +0 -2
  316. package/dist/client/assets/settings.archived-B5WGVqfk.js +0 -2
  317. package/dist/client/assets/settings.connections-DJEqNVad.js +0 -2
  318. package/dist/client/assets/settings.general-BQ6775Hi.js +0 -2
  319. package/dist/client/assets/settings.integrations-CgxBXw6p.js +0 -2
  320. package/dist/client/assets/settings.projects-BJ1cpGGM.js +0 -4
  321. package/dist/client/assets/settings.providers-D2I5mNzk.js +0 -3
  322. package/dist/client/assets/settings.scheduled-tasks-D8hRaqp8.js +0 -2
  323. package/dist/client/assets/square-plus-CeFmBUPF.js +0 -2
  324. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-D00LPIWv.js +0 -2
  325. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-vkEAWikD.js +0 -9
  326. package/dist/client/assets/toast-B3hjhWRf.js +0 -2
  327. package/dist/client/assets/usage-C2lJ6qWL.js +0 -2
  328. package/dist/client/assets/useNavigate-DCj963r2.js +0 -2
  329. package/dist/client/assets/useScopedModelAvailability-YXOv7_8D.js +0 -2
  330. package/dist/client/assets/useSettings-BcmuuiTp.js +0 -3
  331. package/dist/client/assets/utils-hgbJ2TVM.js +0 -37
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$a as n,Ao as r,Ba as i,Da as a,Ea as o,Fa as s,Fn as c,Ga as l,Ha as u,In as d,Ja as f,La as p,Oa as m,Oo as h,RE as g,So as _,Vn as v,_a as y,aa as b,ca as x,co as S,da as C,eo as w,fp as T,ga as ee,ia as E,ko as D,mE as O,no as k,oa as A,oo as j,ra as M,ro as N,t as P,to as te,va as F,wr as ne,za as re,zn as ie,zp as ae}from"./utils-hgbJ2TVM.js";import{t as oe}from"./useRegisterFieldControl-qXOWsCr5.js";import{t as se}from"./FormContext-Vtmj_mkP.js";import{a as ce}from"./CSPContext-BjqtxKhA.js";var I=e(t());function le(){let[,e]=I.useState({});return I.useCallback(()=>{e({})},[])}var ue=I.createContext(void 0);function de(){let e=I.useContext(ue);if(e===void 0)throw Error(r(43));return e}var L={inputValue:()=>null,value:()=>null,...v},fe=new Map;function R(e,t){let n=JSON.stringify({locale:e,options:t}),r=fe.get(n);if(r)return r;let i=new Intl.NumberFormat(e,t);return fe.set(n,i),i}function z(e,t,n){return e==null?``:R(t,n).format(e)}function pe(e,t,n){return z(e,t,{...n,maximumFractionDigits:20})}var B=[`零`,`〇`,`一`,`二`,`三`,`四`,`五`,`六`,`七`,`八`,`九`],me={零:`0`,〇:`0`,一:`1`,二:`2`,三:`3`,四:`4`,五:`5`,六:`6`,七:`7`,八:`8`,九:`9`},he=[`٠`,`١`,`٢`,`٣`,`٤`,`٥`,`٦`,`٧`,`٨`,`٩`],V=[`۰`,`۱`,`۲`,`۳`,`۴`,`۵`,`۶`,`۷`,`۸`,`۹`],H=[`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],ge=[`%`,`٪`,`%`,`﹪`],_e=[`‰`,`؉`],ve=[`−`,`-`,`‒`,`–`,`—`,`﹣`],U=[`+`,`﹢`],ye=RegExp(`[${he.join(``)}]`,`g`),W=RegExp(`[${V.join(``)}]`,`g`),be=RegExp(`[${H.join(``)}]`,`g`),xe=RegExp(`[${B.join(``)}]`,`g`),G=RegExp(`[${ge.join(``)}]`),K=RegExp(`[${_e.join(``)}]`),Se=/[٠١٢٣٤٥٦٧٨٩]/,Ce=/[۰۱۲۳۴۵۶۷۸۹]/,we=/[零〇一二三四五六七八九]/,Te=RegExp(`[${H.join(``)}]`),Ee=[`.`,`,`,`.`,`,`,`٫`,`٬`],De=/\p{Zs}/u,Oe=[`+`,...U],ke=[`-`,...ve],q=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),Ae=e=>e.replace(/[-\\\]^]/g,e=>`\\${e}`),je=e=>`[${e.map(Ae).join(``)}]`,Me=je([`-`].concat(ve)),Ne=je([`+`].concat(U)),Pe=new RegExp(Me,`gu`),J=new RegExp(Ne,`gu`),Y=new RegExp(Me),X=new RegExp(Ne);function Fe(e,t){let n=R(e,t).formatToParts(11111.1),r={};return n.forEach(e=>{r[e.type]=e.value}),R(e).formatToParts(.1).forEach(e=>{e.type===`decimal`&&(r[e.type]=e.value)}),r}function Z(e,t,n){if(e==null)return null;let r=String(e).replace(/\p{Cf}/gu,``).trim();r=r.replace(Pe,`-`).replace(J,`+`);let i=!1,a=r.match(/([+-])\s*$/);a&&(a[1]===`-`&&(i=!0),r=r.replace(/([+-])\s*$/,``));let o=r.match(/^\s*([+-])/);o&&(o[1]===`-`&&(i=!0),r=r.replace(/^\s*[+-]/,``));let s=t;s===void 0&&(Se.test(r)||Ce.test(r)?s=`ar`:we.test(r)&&(s=`zh`));let{group:c,decimal:l,currency:u}=Fe(s,n),d=R(s,n).formatToParts(1).filter(e=>e.type===`unit`).map(e=>q(e.value)),f=d.length?new RegExp(d.join(`|`),`g`):null,p=null;c&&(p=/\p{Zs}/u.test(c)?/\p{Zs}/gu:c===`'`||c===`’`?/['’]/g:new RegExp(q(c),`g`));let m=[{regex:c?p:null,replacement:``},{regex:l?new RegExp(q(l),`g`):null,replacement:`.`},{regex:/./g,replacement:`.`},{regex:/,/g,replacement:``},{regex:/٫/g,replacement:`.`},{regex:/٬/g,replacement:``},{regex:u?new RegExp(q(u),`g`):null,replacement:``},{regex:f,replacement:``},{regex:ye,replacement:e=>String(he.indexOf(e))},{regex:W,replacement:e=>String(V.indexOf(e))},{regex:be,replacement:e=>String(H.indexOf(e))},{regex:xe,replacement:e=>me[e]}].reduce((e,{regex:t,replacement:n})=>t?e.replace(t,n):e,r),h=m.lastIndexOf(`.`);if(h!==-1&&(m=`${m.slice(0,h).replace(/\./g,``)}.${m.slice(h+1).replace(/\./g,``)}`),/^[-+]?Infinity$/i.test(r)||/[∞]/.test(r))return null;let g=(i?`-`:``)+m,_=parseFloat(g),v=n?.style,y=v===`unit`&&n?.unit===`percent`,b=G.test(e)||v===`percent`;return K.test(e)?_/=1e3:!y&&b&&(_/=100),Number.isNaN(_)?null:_}var Ie=1e-10;function Le(e){let t=R(`en-US`).resolvedOptions(),n=e?.minimumFractionDigits??t.minimumFractionDigits??0;return{maximumFractionDigits:Math.max(e?.maximumFractionDigits??t.maximumFractionDigits??20,n),minimumFractionDigits:n}}function Re(e,t){if(!Number.isFinite(e))return e;let n=Math.min(Math.max(t,0),20);return Number(e.toFixed(n))}function Q(e,t){let{maximumFractionDigits:n}=Le(t);return Re(e,n)}function ze(e,t,n,r=`directional`){if(n===0)return e;let i=Math.abs(n),a=Math.sign(n),o=i*Ie*a,s=r===`nearest`?n:i,c=(e-t+o)/s,l;return l=r===`nearest`?Math.round(c):a>0?Math.floor(c):Math.ceil(c),t+l*(r===`nearest`?n:i)}function Be(e,{step:t,minWithDefault:n,maxWithDefault:r,minWithZeroDefault:i,format:a,snapOnStep:o,small:s,clamp:c}){if(e===null)return e;let l=c?ce(e,n,r):e;if(t!=null&&o){if(t===0)return Q(l,a);let e=i;return!s&&n!==-(2**53-1)&&(e=n),Q(ze(l,e,t,s?`nearest`:`directional`),a)}return Q(l,a)}var $=e(O()),Ve=I.forwardRef(function(e,t){let{id:n,min:r,max:o,smallStep:u=.1,step:d=1,largeStep:f=10,required:p=!1,disabled:m=!1,readOnly:g=!1,form:v,name:y,defaultValue:w,value:T,onValueChange:ee,onValueCommitted:D,allowWheelScrub:O=!1,snapOnStep:k=!1,allowOutOfRange:j=!1,format:N,locale:P,render:te,className:F,inputRef:ne,style:ae,...oe}=e,{setDirty:se,validityData:ce,disabled:de,setFilled:fe,invalid:R,name:pe,state:B,validation:me,shouldValidateOnChange:he}=ie(),V=de||m,H=pe??y,ve=d===`any`?1:d,[U,ye]=I.useState(!1),W=r??-(2**53-1),be=o??2**53-1,xe=r??0,G=N?.style,K=I.useRef(null),Se=h(ne,me.inputRef),Ce=c({id:n}),[we,Te]=l({controlled:T,default:w,name:`NumberField`,state:`value`}),q=we??null,Ae=A(q);re(()=>{fe(q!==null)},[fe,q]);let je=le(),Me=A(N),Ne=I.useRef(!1),Pe=i((e,t)=>{Ne.current=!1,D?.(e,t)}),J=I.useRef(!0),Y=I.useRef(null),[X,Z]=I.useState(()=>T===void 0?z(q,P,N):He(q,P,N)),[Ie,Le]=I.useState(`numeric`),Re=i(()=>{let{decimal:e,group:t,currency:n,literal:r}=Fe(P,N),i=new Set;Ee.forEach(e=>i.add(e)),e&&i.add(e),t&&(i.add(t),De.test(t)&&i.add(` `));let a=G===`percent`||G===`unit`&&N?.unit===`percent`,o=G===`percent`||G===`unit`&&N?.unit===`permille`;return a&&ge.forEach(e=>i.add(e)),o&&_e.forEach(e=>i.add(e)),G===`currency`&&n&&i.add(n),r&&(Array.from(r).forEach(e=>i.add(e)),De.test(r)&&i.add(` `)),Oe.forEach(e=>i.add(e)),W<0&&ke.forEach(e=>i.add(e)),i}),Q=i(e=>e?.altKey?u:e?.shiftKey?f:ve),ze=i((e,t)=>{let n=t.event,r=t.direction,i=t.reason,a=!j||i!==`input-change`&&i!==`input-blur`&&i!==`input-paste`&&i!==`input-clear`&&i!==`none`,o=Be(e,{step:r?Q(n)*r:void 0,format:Me.current,minWithDefault:W,maxWithDefault:be,minWithZeroDefault:xe,snapOnStep:k,small:n?.altKey??!1,clamp:a}),s=t.reason===`input-change`||t.reason===`input-clear`||t.reason===`input-blur`||t.reason===`input-paste`||t.reason===`none`,c=o!==q||s&&(e!==q||J.current===!1);if(c){if(Y.current=o,ee?.(o,t),t.isCanceled)return c;Te(o),se(o!==ce.initialValue),Ne.current=!0}return J.current&&Z(z(o,P,N)),je(),c}),Ve=i((e,{direction:t,currentValue:n,event:i,reason:o})=>{let s=n??Ae.current,c=typeof s==`number`?s+e*t:Math.max(0,r??0);return ze(c,a(o,i,void 0,{direction:t}))});re(function(){if(!J.current)return;let e=T===void 0?z(q,P,N):He(q,P,N);e!==X&&Z(e)}),re(function(){if(!s)return;let e=`text`;W>=0&&(e=`decimal`),Le(e)},[W,G]),I.useEffect(function(){let e=K.current;if(V||g||!O||!e)return;function t(e){if(e.ctrlKey||C(b(K.current))!==K.current)return;e.preventDefault(),J.current=!0;let t=Q(e)??1;Ve(t,{direction:e.deltaY>0?-1:1,event:e,reason:`wheel`})}return x(e,`wheel`,t)},[O,Ve,V,g,Q]);let Ue=I.useMemo(()=>({...B,disabled:V,readOnly:g,required:p,value:q,inputValue:X,scrubbing:U}),[B,V,g,p,q,X,U]),We=I.useMemo(()=>({inputRef:K,inputValue:X,value:q,minWithDefault:W,maxWithDefault:be,disabled:V,readOnly:g,id:Ce,setValue:ze,incrementValue:Ve,getStepAmount:Q,allowInputSyncRef:J,formatOptionsRef:Me,valueRef:Ae,lastChangedValueRef:Y,hasPendingCommitRef:Ne,name:H,required:p,invalid:R,inputMode:Ie,getAllowedNonNumericKeys:Re,min:r,max:o,setInputValue:Z,locale:P,isScrubbing:U,setIsScrubbing:ye,state:Ue,onValueCommitted:Pe}),[K,X,q,W,be,V,g,Ce,ze,Ve,Q,Me,Ae,H,p,R,Ie,Re,r,o,Z,P,U,Ue,Pe]),Ge=_(`div`,e,{ref:t,state:Ue,props:oe,stateAttributesMapping:L});return(0,$.jsxs)(ue.Provider,{value:We,children:[Ge,(0,$.jsx)(`input`,{...me.getInputValidationProps({onFocus(){K.current?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||V||g){e.preventBaseUIHandler?.();return}let t=e.currentTarget.valueAsNumber,n=Number.isNaN(t)?null:t,r=a(S,e.nativeEvent);se(n!==ce.initialValue),ze(n,r),he()&&me.commit(n)}}),ref:Se,type:`number`,form:v,name:H,value:q??``,min:r,max:o,step:d,disabled:V,required:p,"aria-hidden":!0,tabIndex:-1,style:H?E:M,suppressHydrationWarning:!0})]})});function He(e,t,n){return n?.maximumFractionDigits!=null||n?.minimumFractionDigits!=null?z(e,t,n):pe(e,t,n)}var Ue=I.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=de();return _(`div`,e,{ref:t,state:o,props:[{role:`group`},a],stateAttributesMapping:L})}),We=0,Ge=class e extends y{static create(){return new e}start(e,t){this.clear(),this.currentId=setInterval(()=>{t()},e)}clear=()=>{this.currentId!==We&&(clearInterval(this.currentId),this.currentId=We)}};function Ke(){let e=D(Ge.create).current;return o(e.disposeEffect),e}var qe=60,Je=400,Ye=8,Xe=50,Ze=3;function Qe(e){return e===`touch`||e===`pen`}function $e(e){let{disabled:t,readOnly:n=!1,tick:r,onStop:a,tickDelay:o=qe,startDelay:s=Je,scrollDistance:c=Ye,elementRef:l}=e,d=F(),f=Ke(),p=F(),m=I.useRef(!1),h=I.useRef(0),g=I.useRef({x:0,y:0}),_=I.useRef(!1),v=I.useRef(!1),y=I.useRef(``),b=I.useRef(()=>{}),S=i(()=>{p.clear(),d.clear(),f.clear(),b.current(),h.current=0});function C(e){S();let t=l.current;if(!t)return;let n=u(t);function i(e){e.preventDefault()}if(b.current=x(n,`contextmenu`,i),x(n,`pointerup`,e=>{m.current=!1,S(),a?.(e)},{once:!0}),!r(e)){S();return}d.start(s,()=>{f.start(o,()=>{r(e)||S()})})}return I.useEffect(()=>()=>S(),[S]),{pointerHandlers:{onTouchStart(){_.current=!0},onTouchEnd(){_.current=!1},onPointerDown(e){let r=!e.button||e.button===0;e.defaultPrevented||!r||t||n||(y.current=e.pointerType,v.current=!1,m.current=!0,g.current={x:e.clientX,y:e.clientY},Qe(e.pointerType)?p.start(Xe,()=>{let t=h.current;h.current=0,m.current&&t<Ze?(C(e.nativeEvent),v.current=!0):(v.current=!1,S())}):(e.preventDefault(),C(e.nativeEvent)))},onPointerUp(e){Qe(e.pointerType)&&(m.current=!1)},onPointerMove(e){if(t||n||!Qe(e.pointerType)||!m.current)return;h.current!=null&&(h.current+=1);let{x:r,y:i}=g.current,a=r-e.clientX,o=i-e.clientY;a**2+o**2>c**2&&S()},onMouseEnter(e){e.defaultPrevented||t||n||!m.current||_.current||Qe(y.current)||C(e.nativeEvent)},onMouseLeave(){_.current||S()},onMouseUp(){_.current||S()}},shouldSkipClick:i(e=>e.defaultPrevented?!0:Qe(y.current)?v.current:e.detail!==0)}}function et(e){return e===`touch`||e===`pen`}function tt(e){let{allowInputSyncRef:t,disabled:r,formatOptionsRef:i,getStepAmount:o,id:s,incrementValue:c,inputRef:l,inputValue:u,isIncrement:d,locale:p,readOnly:h,setValue:g,valueRef:_,lastChangedValueRef:v,onValueCommitted:y}=e,b=d?n:f;function x(e){t.current=!0;let n=Z(u,p,i.current);n!==null&&(_.current=n,g(n,a(b,e,void 0,{direction:d?1:-1})))}let{pointerHandlers:S,shouldSkipClick:C}=$e({disabled:r||h,elementRef:l,tickDelay:60,startDelay:400,scrollDistance:8,tick(e){let t=o(e)??1;return c(t,{direction:d?1:-1,event:e,reason:b})},onStop(e){let t=v.current??_.current;y(t,m(b,e))}});return{disabled:r,"aria-readonly":h||void 0,"aria-label":d?`Increase`:`Decrease`,"aria-controls":s,tabIndex:-1,style:{WebkitUserSelect:`none`,userSelect:`none`},...S,onClick(e){let t=r||h;if(e.defaultPrevented||t||C(e))return;x(e.nativeEvent);let n=o(e)??1,i=_.current;c(n,{direction:d?1:-1,event:e.nativeEvent,reason:b});let a=v.current??_.current;a!==i&&y(a,m(b,e.nativeEvent))},onPointerDown(e){let t=!e.button||e.button===0;e.defaultPrevented||h||!t||r||(x(e.nativeEvent),et(e.pointerType)||l.current?.focus(),S.onPointerDown(e))}}}var nt=I.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,style:o,...s}=e,{allowInputSyncRef:c,disabled:l,formatOptionsRef:u,getStepAmount:d,id:f,incrementValue:m,inputRef:h,inputValue:g,locale:v,maxWithDefault:y,readOnly:b,setValue:x,state:S,value:C,valueRef:w,lastChangedValueRef:T,onValueCommitted:ee}=de(),E=i||l||C!=null&&C>=y,D=tt({isIncrement:!0,inputRef:h,inputValue:g,disabled:E,readOnly:b,id:f,setValue:x,getStepAmount:d,incrementValue:m,allowInputSyncRef:c,formatOptionsRef:u,valueRef:w,locale:v,lastChangedValueRef:T,onValueCommitted:ee}),{getButtonProps:O,buttonRef:k}=p({disabled:E,native:a,focusableWhenDisabled:!0}),A=I.useMemo(()=>({...S,disabled:E}),[S,E]);return _(`button`,e,{ref:[t,k],state:A,props:[D,s,O],stateAttributesMapping:L})}),rt=I.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,style:o,...s}=e,{allowInputSyncRef:c,disabled:l,formatOptionsRef:u,getStepAmount:d,id:f,incrementValue:m,inputRef:h,inputValue:g,minWithDefault:v,readOnly:y,setValue:b,state:x,value:S,valueRef:C,locale:w,lastChangedValueRef:T,onValueCommitted:ee}=de(),E=i||l||S!=null&&S<=v,D=tt({isIncrement:!1,inputRef:h,inputValue:g,disabled:E,readOnly:y,id:f,setValue:b,getStepAmount:d,incrementValue:m,allowInputSyncRef:c,formatOptionsRef:u,valueRef:C,locale:w,lastChangedValueRef:T,onValueCommitted:ee}),{getButtonProps:O,buttonRef:k}=p({disabled:E,native:a,focusableWhenDisabled:!0}),A=I.useMemo(()=>({...x,disabled:E}),[x,E]);return _(`button`,e,{ref:[t,k],state:A,props:[D,s,O],stateAttributesMapping:L})}),it={...v,...L},at=new Set([`Backspace`,`Delete`,`ArrowLeft`,`ArrowRight`,`Tab`,`Enter`,`Escape`]),ot=I.forwardRef(function(e,t){let{render:n,className:r,style:i,...o}=e,{allowInputSyncRef:s,disabled:c,formatOptionsRef:l,getAllowedNonNumericKeys:u,getStepAmount:f,id:p,incrementValue:h,inputMode:g,inputValue:v,max:y,min:b,name:x,readOnly:S,required:C,setValue:T,state:E,setInputValue:D,locale:O,inputRef:A,value:M,onValueCommitted:P,lastChangedValueRef:F,hasPendingCommitRef:re,valueRef:ae}=de(),{clearErrors:ce}=se(),{validationMode:le,setTouched:ue,setFocused:L,invalid:fe,shouldValidateOnChange:R,validation:B}=ie(),{labelId:me}=d(),he=I.useRef(!1),V=I.useRef(!1);return oe(A,p,M),ne(M,e=>{let t=R();if(ce(x),t&&B.commit(M),!(e===M||t)){if(V.current){V.current=!1;return}B.commit(M,!0)}}),_(`input`,e,{ref:[t,A],state:E,props:[{id:p,required:C,disabled:c,readOnly:S,inputMode:g,value:v,type:`text`,autoComplete:`off`,autoCorrect:`off`,spellCheck:`false`,"aria-roledescription":`Number field`,"aria-invalid":fe||void 0,"aria-labelledby":me,suppressHydrationWarning:!0,onFocus(e){if(e.defaultPrevented||S||c||(L(!0),he.current))return;he.current=!0;let t=e.currentTarget,n=t.value.length;t.setSelectionRange(n,n)},onBlur(e){if(e.defaultPrevented||S||c)return;ue(!0),L(!1);let t=!s.current,n=re.current;if(s.current=!0,v.trim()===``){T(null,a(k,e.nativeEvent)),le===`onBlur`&&B.commit(null),P(null,m(k,e.nativeEvent));return}let r=l.current,i=Z(v,O,r);if(i===null)return;let o=r?.maximumFractionDigits!=null||r?.minimumFractionDigits!=null,u=r?.maximumFractionDigits,d=o&&typeof u==`number`?Number(i.toFixed(u)):i,f=m(w,e.nativeEvent),p=M!==d,h=t||p||n;le===`onBlur`&&B.commit(d),p&&(V.current=!0,T(d,a(w,e.nativeEvent))),h&&P(d,f);let g=z(d,O,r);(o||i!==M||v!==pe(i,O,r))&&v!==g&&D(g)},onChange(e){if(e.nativeEvent.defaultPrevented)return;s.current=!1;let t=e.currentTarget.value;if(t.trim()===``){D(t),T(null,a(k,e.nativeEvent));return}let n=u();if(!Array.from(t).every(e=>{let t=e>=`0`&&e<=`9`,r=Se.test(e),i=we.test(e),a=Ce.test(e),o=Te.test(e),s=Y.test(e);return t||r||i||a||o||s||n.has(e)}))return;let r=Z(t,O,l.current);D(t),r!==null&&T(r,a(te,e.nativeEvent))},onKeyDown(e){if(e.defaultPrevented||S||c)return;let t=e.nativeEvent;s.current=!0;let n=u(),r=n.has(e.key),{decimal:i,currency:o,percentSign:d}=Fe(O,l.current),p=e.currentTarget.selectionStart,g=e.currentTarget.selectionEnd,_=p===0&&g===v.length,x=e=>p!=null&&g!=null&&e>=p&&e<g;if(Y.test(e.key)&&Array.from(n).some(e=>Y.test(e||``))){let e=v.search(Pe),t=e!=null&&e!==-1&&x(e);r=!(Y.test(v)||X.test(v))||_||t}if(X.test(e.key)&&Array.from(n).some(e=>X.test(e||``))){let e=v.search(J),t=e!=null&&e!==-1&&x(e);r=!(Y.test(v)||X.test(v))||_||t}[i,o,d].forEach(t=>{if(e.key===t){let e=v.indexOf(t),n=x(e);r=!v.includes(t)||_||n}});let C=e.key>=`0`&&e.key<=`9`,w=Se.test(e.key),E=we.test(e.key),D=Ce.test(e.key),k=Te.test(e.key),A=at.has(e.key);if(e.which===229||e.altKey||e.ctrlKey||e.metaKey||r||C||w||k||E||D||A)return;let M=Z(v,O,l.current),N=f(e)??1;ee(e);let te=m(j,t);e.key===`ArrowUp`?(h(N,{direction:1,currentValue:M,event:t,reason:j}),P(F.current??ae.current,te)):e.key===`ArrowDown`?(h(N,{direction:-1,currentValue:M,event:t,reason:j}),P(F.current??ae.current,te)):e.key===`Home`&&b!=null?(T(b,a(j,t)),P(F.current??ae.current,te)):e.key===`End`&&y!=null&&(T(y,a(j,t)),P(F.current??ae.current,te))},onPaste(e){if(e.defaultPrevented||S||c)return;e.preventDefault();let t=(e.clipboardData||window.Clipboard).getData(`text/plain`),n=Z(t,O,l.current);n!==null&&(s.current=!1,T(n,a(N,e.nativeEvent)),D(t))}},B.getValidationProps(),o],stateAttributesMapping:it})}),st=g();function ct(e){let t=(0,st.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({id:r,className:n,size:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s=I.useId(),c=r??s,l;t[5]===n?l=t[6]:(l=P(`flex w-full flex-col items-start gap-2`,n),t[5]=n,t[6]=l);let u;return t[7]!==c||t[8]!==i||t[9]!==o||t[10]!==l?(u=(0,$.jsx)(Ve,{className:l,"data-size":o,"data-slot":`number-field`,id:c,...i}),t[7]=c,t[8]=i,t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function lt(e){let t=(0,st.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,shape:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o=a===`pill`&&`overflow-hidden rounded-xl before:rounded-xl`,s=a===`soft`&&`rounded-lg border-transparent bg-accent shadow-none before:hidden dark:bg-accent`,c;t[4]!==n||t[5]!==o||t[6]!==s?(c=P(`relative flex w-full justify-between rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-data-disabled:not-focus-within:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-inset has-aria-invalid:border-destructive/36 has-autofill:bg-foreground/4 focus-within:has-aria-invalid:border-destructive/64 focus-within:has-aria-invalid:ring-destructive/48 data-disabled:pointer-events-none data-disabled:opacity-64 sm:text-sm dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-aria-invalid:ring-destructive/24 dark:not-data-disabled:not-focus-within:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 [[data-disabled],:focus-within,[aria-invalid]]:shadow-none`,o,s,n),t[4]=n,t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==r||t[9]!==c?(l=(0,$.jsx)(Ue,{className:c,"data-slot":`number-field-group`,...r}),t[8]=r,t[9]=c,t[10]=l):l=t[10],l}function ut(e){let t=(0,st.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=P(`relative flex shrink-0 cursor-pointer items-center justify-center rounded-s-[calc(var(--radius-lg)-1px)] in-data-[size=sm]:px-[calc(--spacing(2.5)-1px)] in-data-[size=compact]:w-8 in-data-[size=compact]:px-0 px-[calc(--spacing(3)-1px)] transition-colors pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:bg-accent`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(T,{}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,$.jsx)(rt,{className:i,"data-slot":`number-field-decrement`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function dt(e){let t=(0,st.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=P(`relative flex shrink-0 cursor-pointer items-center justify-center rounded-e-[calc(var(--radius-lg)-1px)] in-data-[size=sm]:px-[calc(--spacing(2.5)-1px)] in-data-[size=compact]:w-8 in-data-[size=compact]:px-0 px-[calc(--spacing(3)-1px)] transition-colors pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:bg-accent`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(ae,{}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,$.jsx)(nt,{className:i,"data-slot":`number-field-increment`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function ft(e){let t=(0,st.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=P(`h-8.5 in-data-[size=compact]:h-8 in-data-[size=compact]:px-0 in-data-[size=compact]:leading-8 sm:in-data-[size=compact]:h-8 sm:in-data-[size=compact]:leading-8 in-data-[size=lg]:h-9.5 in-data-[size=sm]:h-7.5 w-full min-w-0 grow bg-transparent in-data-[size=sm]:px-[calc(--spacing(2.5)-1px)] px-[calc(--spacing(3)-1px)] text-center tabular-nums in-data-[size=lg]:leading-9.5 in-data-[size=sm]:leading-7.5 leading-8.5 outline-none [transition:background-color_5000000s_ease-in-out_0s] sm:h-7.5 sm:in-data-[size=lg]:h-8.5 sm:in-data-[size=sm]:h-6.5 sm:in-data-[size=lg]:leading-8.5 sm:in-data-[size=sm]:leading-8.5 sm:leading-7.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(ot,{className:i,"data-slot":`number-field-input`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}export{ft as a,dt as i,ut as n,lt as r,ct as t};
2
- //# sourceMappingURL=number-field-Dj0uYTJQ.js.map
@@ -1,2 +0,0 @@
1
- import{$o as e,Es as t,Fw as n,Gy as r,Il as i,KS as a,Nx as o,Ny as s,Oy as c,RE as l,RT as ee,Ry as u,Vy as d,WS as f,Yo as p,_S as m,cs as h,ds as g,gb as _,jl as v,lb as y,rs as b,ss as x,ug as S}from"./utils-hgbJ2TVM.js";import{b as C,n as w,w as T}from"./runtime-Cj24N7je.js";import{At as te,Ot as E}from"./runtime-CArTL2GH.js";var D=s([`fetch-session-state`,`exchange-bootstrap-credential`,`fetch-environment-descriptor`,`create-pairing-credential`,`list-pairing-links`,`revoke-pairing-link`,`list-client-sessions`,`revoke-client-session`,`revoke-other-client-sessions`]),O=class e extends r()(`PrimaryEnvironmentRequestError`,{operation:D,status:u,pairingLinkId:_(d),sessionId:_(d),cause:c()}){static fromCause(t){let n=U(t.cause)??500;return new e({operation:t.operation,status:n,...t.pairingLinkId===void 0?{}:{pairingLinkId:t.pairingLinkId},...t.sessionId===void 0?{}:{sessionId:t.sessionId},cause:t.cause})}get message(){return`Primary environment request failed during ${this.operation} (HTTP ${this.status}).`}},ne=y(O),k=class extends r()(`PrimaryEnvironmentPairingCredentialRejectedError`,{providedLength:u,cause:c()}){get message(){return`Invalid pairing token. Check the token and try again.`}};y(k);var A=class extends r()(`PrimaryEnvironmentAuthSessionTimeoutError`,{timeoutMs:u,elapsedMs:u}){get message(){return`Timed out waiting for authenticated session after bootstrap.`}},j=class extends r()(`PrimaryEnvironmentPairingCredentialRequiredError`,{providedLength:u}){get message(){return`Enter a pairing token to continue.`}},M=y(i),N=null,P=null,F=!1,I=2e3,L=100;function R(){return E(new URL(window.location.href))}function z(){let e=new URL(window.location.href),t=te(e);t.toString()!==e.toString()&&window.history.replaceState({},document.title,t.toString())}function B(){let e=R();return e?(z(),e):null}function V(){let e=(window.desktopBridge?.getLocalEnvironmentBootstraps()??[]).find(e=>e.id===v);return typeof e?.bootstrapToken==`string`&&e.bootstrapToken.length>0?e.bootstrapToken:null}async function H(){return X(async()=>{try{return await w(C.pipe(o(e=>e.auth.session({headers:{}}))))}catch(e){throw O.fromCause({operation:`fetch-session-state`,cause:e})}})}function U(e){return M(e)?W(e):S(e)&&e.response!==void 0?e.response.status:null}function W(e){switch(e._tag){case`EnvironmentRequestInvalidError`:return 400;case`EnvironmentAuthInvalidError`:return 401;case`EnvironmentScopeRequiredError`:case`EnvironmentOperationForbiddenError`:return 403;case`EnvironmentResourceNotFoundError`:return 404;case`EnvironmentInternalError`:return 500}}async function G(e){return X(async()=>{try{return await w(C.pipe(o(t=>t.auth.browserSession({payload:{credential:e}}))))}catch(t){throw M(t)&&t._tag===`EnvironmentAuthInvalidError`&&t.reason===`invalid_credential`?new k({providedLength:e.length,cause:t}):O.fromCause({operation:`exchange-bootstrap-credential`,cause:t})}})}async function K(){let e=Date.now();for(;;){let t=await H();if(t.authenticated)return t;let n=Date.now()-e;if(n>=I)throw new A({timeoutMs:I,elapsedMs:n});await Z(L)}}var q=new Set([502,503,504]),J=15e3,Y=500;async function X(e){let t=Date.now();for(;;)try{return await e()}catch(e){if(!re(e)||Date.now()-t>=J)throw e;await Z(Y)}}function Z(e){return new Promise(t=>{setTimeout(t,e)})}function re(e){return ne(e)?q.has(e.status):e instanceof TypeError||e instanceof DOMException&&e.name===`AbortError`}async function Q(e){let t=await H();if(t.authenticated&&!e)return{status:`authenticated`};let n=e??V();if(!n)return{status:`requires-auth`,auth:t.auth};try{return await G(n),await K(),{status:`authenticated`}}catch(e){return{status:`requires-auth`,auth:t.auth,errorMessage:e instanceof Error?e.message:`Authentication failed.`}}}async function ie(e){let t=e.trim();if(!t)throw new j({providedLength:e.length});P=null,await G(t),await K(),P={status:`authenticated`},N=null,F=!1,z()}async function ae(e){let t=e?.label?.trim();try{return await w(C.pipe(o(n=>n.auth.pairingCredential({headers:{},payload:{...t?{label:t}:{},...e?.scopes?{scopes:e.scopes}:{}}}))))}catch(e){throw O.fromCause({operation:`create-pairing-credential`,cause:e})}}async function oe(e){try{await w(C.pipe(o(t=>t.auth.revokePairingLink({headers:{},payload:{id:e}}))))}catch(t){throw O.fromCause({operation:`revoke-pairing-link`,pairingLinkId:e,cause:t})}}async function se(e){try{await w(C.pipe(o(t=>t.auth.revokeClient({headers:{},payload:{sessionId:e}}))))}catch(t){throw O.fromCause({operation:`revoke-client-session`,sessionId:e,cause:t})}}async function ce(){try{return(await w(C.pipe(o(e=>e.auth.revokeOtherClients({headers:{}}))))).revokedCount}catch(e){throw O.fromCause({operation:`revoke-other-client-sessions`,cause:e})}}async function le(){if(window.location.pathname.replace(/\/+$/,``)===`/pair`?R()&&(F=!0):F=!1,F)return{status:`requires-auth`,auth:(await H()).auth};let e=B(),t=N;if(e)P=null;else{if(t)return t;if(P?.status===`authenticated`)return P}let n=t?t.catch(()=>void 0).then(()=>(P=null,Q(e))):Q(e);return N=n,n.then(e=>(N===n&&e.status===`authenticated`&&(P=e),e)).finally(()=>{N===n&&(N=null)})}var ue=l(),$=b(a(()=>T()?f(null):m(H))).pipe(h({staleTime:5e3,revalidateOnMount:!0}),x(3e5),g(`primary-environment:session`));function de(){p.refresh($)}function fe(){let r=(0,ue.c)(8),i=e($),a=pe,o=null;if(i._tag===`Failure`){let e;r[0]===i.cause?e=r[1]:(e=n(i.cause),r[0]=i.cause,r[1]=e);let t=e;o=t instanceof Error?t.message:`Could not read environment session.`}let s;r[2]===i?s=r[3]:(s=ee(t(i)),r[2]=i,r[3]=s);let c;return r[4]!==o||r[5]!==i.waiting||r[6]!==s?(c={data:s,error:o,isPending:i.waiting,refresh:a},r[4]=o,r[5]=i.waiting,r[6]=s,r[7]=c):c=r[7],c}function pe(){de()}export{ce as a,z as c,le as i,ie as l,ae as n,se as o,R as r,oe as s,fe as t};
2
- //# sourceMappingURL=primary-BKQnuXrW.js.map
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$o as n,$w as r,AT as i,B_ as a,Cs as o,Es as s,Ex as c,Fw as l,GT as u,Gy as d,Ix as f,JS as p,KS as m,KT as h,Kx as g,Ky as _,Ly as v,Nx as y,Ny as b,Ox as x,Oy as ee,Pv as te,Q_ as ne,Qb as re,RE as ie,RT as ae,Ry as oe,SC as se,Sv as ce,TT as le,Ty as ue,VT as de,Vc as S,Vy as C,WS as w,WT as fe,XS as pe,X_ as me,Yo as he,Yy as ge,_w as _e,ab as ve,bS as ye,cb as be,cv as xe,cx as T,ds as E,ex as Se,hl as Ce,hy as D,ib as we,kv as Te,lv as O,ml as Ee,ms as De,mv as Oe,nS as k,nT as ke,ns as Ae,oC as je,pS as Me,pv as Ne,qS as A,rs as j,rv as Pe,sl as Fe,ss as Ie,su as M,sx as N,ts as P,vs as Le,vx as F,ww as Re,xv as ze,yC as Be,z_ as Ve}from"./utils-hgbJ2TVM.js";import{F as He,I as Ue,J as We,M as I,N as L,P as R,Z as Ge,_t as z,et as Ke,it as qe,ot as Je,pt as Ye,qt as Xe,st as Ze,tt as Qe}from"./runtime-Cj24N7je.js";import{a as B,i as V,n as $e,r as et,s as tt,t as nt}from"./vcsRefInvalidation-hPKz3TmL.js";import{G as rt,W as it}from"./entities-BJgMc8pv.js";import{t as H}from"./runtime-CArTL2GH.js";import{n as U}from"./query-BFP47tsD.js";var W=ie(),at=be(_([ue(D),Fe.fields.query])),ot=we(at);function st(e,t){return JSON.stringify([[...e].sort((e,t)=>e.localeCompare(t)),t])}function ct(e){return ot(e)}function lt(e){return JSON.stringify([e.environmentId,e.threadId])}function ut(e){return P(t=>j(n=>{let r=ct(t);if(de(r))return{matches:[],isLoading:!1};let[i,a]=r.value,o=[],c=!1;for(let t of i){let r=n(e.getSearchAtom(t,a));c||=r.waiting;let i=ae(s(r));i!==null&&o.push(...i.matches.map(e=>({...e,environmentId:t})))}return{matches:o,isLoading:c}}).pipe(E(`${e.labelPrefix}:${t}`)))}var G=e(t(),1);function dt(e){return{v2:{dispatchCommand:I(e,{label:`environment-data:orchestration-v2:dispatch-command`,tag:M.dispatchCommand}),threadProjection:L(e,{label:`environment-data:orchestration-v2:thread-projection`,tag:M.getThreadProjection,staleTimeMs:0,idleTtlMs:0}),shell:R(e,{label:`environment-data:orchestration-v2:shell`,tag:M.subscribeShell}),thread:R(e,{label:`environment-data:orchestration-v2:thread`,tag:M.subscribeThread,idleTtlMs:0})},turnDiff:L(e,{label:`environment-data:orchestration:turn-diff`,tag:M.getTurnDiff}),workflowScript:L(e,{label:`environment-data:orchestration:workflow-script`,tag:M.getWorkflowScript,staleTimeMs:3e5,idleTtlMs:3e5}),stopWorkflow:I(e,{label:`environment-data:orchestration:stop-workflow`,tag:M.stopWorkflow}),rankUserInput:I(e,{label:`environment-data:orchestration:rank-user-input`,tag:S.userInputRank,concurrency:{mode:`singleFlight`,key:({environmentId:e,input:t})=>JSON.stringify([e,t])}}),turnItem:L(e,{label:`environment-data:orchestration:turn-item`,tag:M.getTurnItem,staleTimeMs:6e4,idleTtlMs:6e4}),fullThreadDiff:L(e,{label:`environment-data:orchestration:full-thread-diff`,tag:M.getFullThreadDiff}),threadFind:L(e,{label:`environment-data:orchestration:thread-find`,tag:M.searchThread,staleTimeMs:0,idleTtlMs:0}),threadFindProgressive:R(e,{label:`environment-data:orchestration:thread-find-progressive`,tag:M.searchThreadStream,completeWhen:e=>e.complete!==!1,idleTtlMs:0}),threadSearch:L(e,{label:`environment-data:orchestration:thread-search`,tag:M.searchThreads,staleTimeMs:3e4,idleTtlMs:6e4}),archivedShellSnapshot:L(e,{label:`environment-data:orchestration:archived-shell-snapshot`,tag:M.getArchivedShellSnapshot})}}var K=dt(H),ft=96;function pt(e){let t=e.at(-1);return e.length>1&&t?.waiting===!0&&de(s(t))}function mt({previousScrollTop:e,scrollTop:t,scrollHeight:n,clientHeight:r,distanceThreshold:i=ft}){return e===null||t<=e?!1:n-t-r<=i}var ht=RegExp(`^p4c[-/][0-9a-f]{8}$`);function gt(e){let t=e.indexOf(`/`);return t<=0||t===e.length-1?e:e.slice(t+1)}function _t(e){return ht.test(e.trim().toLowerCase())}function vt(e){return e.trim().replace(/[ \t\n\r\f\v]+/g,`-`)}var yt={hasUpstream:!1,aheadCount:0,behindCount:0,aheadOfDefaultCount:0,pr:null};function q(e,t){return{...e,...t??yt}}function bt(e){return{hasUpstream:e.hasUpstream,aheadCount:e.aheadCount,behindCount:e.behindCount,...e.aheadOfDefaultCount===void 0?{}:{aheadOfDefaultCount:e.aheadOfDefaultCount},pr:e.pr}}function xt(e){return{isRepo:e.isRepo,...e.sourceControlProvider?{sourceControlProvider:e.sourceControlProvider}:{},hasPrimaryRemote:e.hasPrimaryRemote,isDefaultRef:e.isDefaultRef,refName:e.refName,hasWorkingTreeChanges:e.hasWorkingTreeChanges,workingTree:e.workingTree,...e.branchChanges?{branchChanges:e.branchChanges}:{}}}function St(e,t){switch(t._tag){case`snapshot`:return q(t.local,t.remote);case`localUpdated`:return q(t.local,e?bt(e):null);case`remoteUpdated`:return q(e===null?{isRepo:!0,hasPrimaryRemote:!1,isDefaultRef:!1,refName:null,hasWorkingTreeChanges:!1,workingTree:{files:[],insertions:0,deletions:0}}:xt(e),t.remote)}}var Ct=b([`refresh_status`,`run_change_request`,`pull`,`switch_ref`,`create_ref`,`create_worktree`,`init`,`publish_repository`,`prepare_pull_request_thread`]),J=class extends d()(`VcsActionUnavailableError`,{operation:Ct,environmentId:v(D),cwd:v(C)}){get message(){return`Source control operation '${this.operation.replaceAll(`_`,` `)}' is unavailable.`}},wt=class extends d()(`VcsActionRemoteFailureError`,{actionId:C,transportActionId:C,action:Ce,environmentId:D,cwd:C,phase:v(Ee),remoteMessageLength:oe}){get message(){let e=this.phase===null?`execution`:this.phase;return`Source control action '${this.action}' failed during ${e}.`}},Tt=class extends d()(`VcsActionMissingTerminalEventError`,{actionId:C,transportActionId:C,action:Ce,environmentId:D,cwd:C}){get message(){return`Source control action '${this.action}' ended without a terminal result.`}},Et=class extends d()(`VcsActionTargetKeyParseError`,{keyLength:oe,cause:ee()}){get message(){return`Invalid source control action target key (${this.keyLength} characters).`}};ge([wt,Tt]);var Y=Object.freeze({isRunning:!1,operation:null,actionId:null,action:null,currentLabel:null,currentPhaseLabel:null,hookName:null,lastOutputLine:null,phaseStartedAtMs:null,hookStartedAtMs:null,error:null}),Dt=()=>Se(re()),Ot=0,kt=ve(_([D,C])),X=P(e=>j(Y).pipe(Ae,E(`vcs-action:${e}`))),At=j(Y).pipe(Ae,E(`vcs-action:null`));function Z(e){return e.environmentId===null||e.cwd===null?null:JSON.stringify([e.environmentId,e.cwd])}function jt(e){try{let[t,n]=kt(JSON.parse(e));return{environmentId:t,cwd:n}}catch(t){throw new Et({keyLength:e.length,cause:t})}}function Mt(e){let t=Z(e);return t===null?At:X(t)}function Nt(){return Ot+=1,`local-vcs-action:${Ot}`}function Pt(e){let t=e.actionId??Nt(),n=Dt();return{...Y,isRunning:!0,operation:e.operation,actionId:t,currentLabel:e.label,currentPhaseLabel:e.label,phaseStartedAtMs:n}}function Ft(e,t,n){return{...Y,operation:e,actionId:t,error:n instanceof Error?n.message:`Source control action failed.`}}function It(e,t){let n=JSON.stringify([e.environmentId,e.cwd]);return`${n.length}:${n}${t}`}function Lt(e,t,n,r){return r.actionId!==t||r.cwd!==e.cwd?null:{...r,actionId:n}}function Rt(e,t){return m(()=>{let n=null;return e.pipe(ce(e=>{let r=Lt(t.target,t.transportActionId,t.actionId,e);return r===null?je:((r.kind===`action_finished`||r.kind===`action_failed`)&&(n=r),t.onProgress(r))}),y(()=>n?.kind===`action_finished`?w(n.result):n?.kind===`action_failed`?x(new wt({actionId:t.actionId,transportActionId:t.transportActionId,action:n.action,environmentId:t.target.environmentId,cwd:t.target.cwd,phase:n.phase,remoteMessageLength:n.message.length})):x(new Tt({actionId:t.actionId,transportActionId:t.transportActionId,action:t.action,environmentId:t.target.environmentId,cwd:t.target.cwd}))))})}function zt(e,t){if(e.actionId!==t.actionId)return e;let n=Dt();switch(t.kind){case`action_started`:return{...e,isRunning:!0,actionId:t.actionId,action:t.action,operation:`run_change_request`,phaseStartedAtMs:n,hookStartedAtMs:null,hookName:null,lastOutputLine:null,error:null};case`phase_started`:return{...e,isRunning:!0,actionId:t.actionId,action:t.action,operation:`run_change_request`,currentLabel:t.label,currentPhaseLabel:t.label,phaseStartedAtMs:n,hookStartedAtMs:null,hookName:null,lastOutputLine:null,error:null};case`hook_started`:return{...e,isRunning:!0,actionId:t.actionId,action:t.action,operation:`run_change_request`,currentLabel:`Running ${t.hookName}...`,hookName:t.hookName,hookStartedAtMs:n,lastOutputLine:null,error:null};case`hook_output`:return{...e,isRunning:!0,actionId:t.actionId,action:t.action,operation:`run_change_request`,lastOutputLine:t.text,error:null};case`hook_finished`:return{...e,isRunning:!0,actionId:t.actionId,action:t.action,operation:`run_change_request`,currentLabel:e.currentPhaseLabel,hookName:null,hookStartedAtMs:null,lastOutputLine:null,error:null};case`action_finished`:return{...e,isRunning:!0,actionId:t.actionId,action:t.action,operation:`run_change_request`,error:null};case`action_failed`:return{...e,isRunning:!0,actionId:t.actionId,action:t.action,operation:`run_change_request`,error:t.message}}}function Bt(e){let t=new Map,n=n=>{let r=Z(n),i=r??JSON.stringify([`vcs-action-target:unavailable`,n.environmentId,n.cwd]),a=t.get(i);if(a!==void 0)return a;let o=r===null?null:jt(r),s=r===null?At:X(r),l=Ue(e,{label:`vcs-action:run-stacked:${i}`,scheduler:B,concurrency:{mode:`serial`,key:()=>i},execute:(t,r)=>{if(o===null)return x(new J({operation:`run_change_request`,environmentId:n.environmentId,cwd:n.cwd}));let i=It(o,t.actionId);r.set(s,Pt({operation:`run_change_request`,label:`Running source control action`,actionId:t.actionId}));let a={actionId:i,cwd:o.cwd,action:t.action,...t.commitMessage?{commitMessage:t.commitMessage}:{},...t.featureBranch?{featureBranch:!0}:{},...t.filePaths?.length?{filePaths:[...t.filePaths]}:{},...t.threadId===void 0?{}:{threadId:t.threadId},...t.projectId===void 0?{}:{projectId:t.projectId}},l=A(()=>{r.get(s).actionId===t.actionId&&r.set(s,Y)});return Rt(Ze(o.environmentId,Ke(S.gitRunStackedAction,a)),{target:o,transportActionId:i,actionId:t.actionId,action:t.action,onProgress:e=>A(()=>{let n=r.get(s);if(n.actionId===t.actionId&&(r.set(s,zt(n,e)),t.onProgress!==void 0))try{t.onProgress(e)}catch{}})}).pipe(ye(We,{authorize:(t,n,i)=>qe(e,n).authorize(r,t,i)}),c(nt(r,o)),p(()=>l),pe(e=>A(()=>{let n=r.get(s);n.actionId===t.actionId&&n.isRunning&&r.set(s,Ft(`run_change_request`,t.actionId,e))})),Me(()=>l))}});return t.set(i,l),l},r=(e,t,n)=>{let r=Z(t);if(r===null)return;let i=X(r);e.set(i,n(e.get(i)))};return{stateAtom:Mt,runStackedAction:e=>n(e),track:async(e,t,n,r)=>{let i=Z(t);if(i===null)return Le(_e(new J({operation:n.operation,environmentId:t.environmentId,cwd:t.cwd})));let a=X(i),s=Pt(n);e.set(a,s);let c=await r();return e.get(a).actionId===s.actionId&&(o(c)||Re(c.cause)?e.set(a,Y):e.get(a).actionId===s.actionId&&e.set(a,Ft(n.operation,s.actionId,l(c.cause)))),c},resetError:(e,t,n)=>{r(e,t,e=>!e.isRunning&&e.operation===n?Y:e)}}}var Vt=100,Ht=3e4,Ut=1e4,Wt=Be(`1 second`).pipe(se(({duration:e})=>w(r(e,ke(30)))));function Gt(e){return e.query===void 0&&e.cursor===void 0&&e.includeMatchingRemoteRefs===void 0&&e.refKind===void 0&&e.limit===Vt}var Kt=f(`CachedVcsRefsState.commitRefresh`)(function*(e,t,n){return yield*et(n.environmentId,g(function*(){let r=$e({environmentId:n.environmentId}),i=e.get(r);if(i.revision!==n.expectedRevision)return!1;let a=i.persistedCacheReadable;return n.persist&&(a||=yield*t.clearVcsRefs(n.environmentId).pipe(T(!0),F(e=>k(`Could not recover invalidated cached Git refs.`).pipe(N({environmentId:n.environmentId,cwd:n.cwd,...z(e)}),T(!1)))),yield*t.saveVcsRefs(n.environmentId,n.cwd,n.refs).pipe(F(e=>k(`Could not persist cached Git refs.`).pipe(N({environmentId:n.environmentId,cwd:n.cwd,...z(e)})))),a!==i.persistedCacheReadable&&e.update(r,e=>e.revision===n.expectedRevision?{...e,persistedCacheReadable:a}:e)),!0}))}),qt=f(`CachedVcsRefsState.makeChanges`)(function*(e,t,n,r=!0){let o=yield*Ye,s=yield*Xe,c=o.target.environmentId,l=Gt(e),d=l&&r?yield*s.loadVcsRefs(c,e.cwd).pipe(F(t=>k(`Could not load cached Git refs.`).pipe(N({environmentId:c,cwd:e.cwd,...z(t)}),T(u())))):u(),p=f(`CachedVcsRefsState.refresh`)(function*(){let r=yield*Ge(S.vcsListRefs,e).pipe(ye(Ye,o)),i=s.saveVcsRefs(c,e.cwd,r).pipe(F(t=>k(`Could not persist cached Git refs.`).pipe(N({environmentId:c,cwd:e.cwd,...z(t)}))));return t===void 0||n===void 0?(l&&(yield*i),h(r)):(yield*Kt(n,s,{environmentId:c,cwd:e.cwd,refs:r,expectedRevision:t,persist:l}))?h(r):u()}),m=O(w(d)).pipe(xe(e=>fe(e,{onNone:()=>le,onSome:i}))),g=ne(O(a(o.state)),Ve(o.state)).pipe(Ne(e=>e.phase===`connected`?e.generation:null),me,Te(t=>t===null?Pe:O(p().pipe(pe(t=>k(`Could not refresh Git refs.`).pipe(N({environmentId:c,cwd:e.cwd,...z(t)}))))).pipe(ze(Wt),xe(e=>fe(e,{onNone:()=>le,onSome:i})))));return ne(m,g)});function Jt(e,t,n,r){return Je(e,te(g(function*(){return yield*qt(t,n,yield*De,r)})))}function Yt(e){let t=P(t=>{let[n,r]=JSON.parse(t);return e.atom(e=>{let t=e($e({environmentId:n}));return Jt(n,r,t.revision,t.persistedCacheReadable)}).pipe(Ie(Ht),E(`environment-data:vcs:list-refs:${t}`))}),n=e=>t(JSON.stringify([e.environmentId,e.input])),r=(e,t)=>nt(t,{environmentId:e.environmentId,cwd:e.input.cwd});return{listRefs:n,status:He(e,{label:`environment-data:vcs:status`,idleTtlMs:Ut,subscribe:e=>Qe(S.subscribeVcsStatus,e).pipe(Oe(()=>null,(e,t)=>{let n=St(e,t);return[n,[n]]}))}),pull:I(e,{label:`environment-data:vcs:pull`,tag:S.vcsPull,scheduler:B,concurrency:V,onSettled:r}),refreshStatus:I(e,{label:`environment-data:vcs:refresh-status`,tag:S.vcsRefreshStatus,scheduler:B,concurrency:V,onSettled:r}),createWorktree:I(e,{label:`environment-data:vcs:create-worktree`,tag:S.vcsCreateWorktree,scheduler:B,concurrency:V,onSettled:r}),worktreeSetup:R(e,{label:`environment-data:vcs:worktree-setup`,tag:S.subscribeWorktreeSetup,idleTtlMs:Ut}),cancelWorktreeSetup:I(e,{label:`environment-data:vcs:cancel-worktree-setup`,tag:S.worktreeSetupCancel}),removeWorktree:I(e,{label:`environment-data:vcs:remove-worktree`,tag:S.vcsRemoveWorktree,scheduler:B,concurrency:V,onSettled:r}),createRef:I(e,{label:`environment-data:vcs:create-ref`,tag:S.vcsCreateRef,scheduler:B,concurrency:V,onSettled:r}),switchRef:I(e,{label:`environment-data:vcs:switch-ref`,tag:S.vcsSwitchRef,scheduler:B,concurrency:V,onSettled:r}),init:I(e,{label:`environment-data:vcs:init`,tag:S.vcsInit,scheduler:B,concurrency:V,onSettled:r})}}var Xt=Yt(H),Zt=Bt(H),Qt=120,$t=80,en=120,tn=500,nn=200,rn=100,an=[],on=[],sn=[],Q=[void 0],cn=Object.freeze([]),ln=j({matches:cn,isLoading:!1}).pipe(E(`web:thread-search:empty`)),un=ut({getSearchAtom:(e,t)=>K.threadSearch({environmentId:e,input:{query:t}}),labelPrefix:`web:thread-search`});function $(e,t){let n=(0,W.c)(4),[r,i]=(0,G.useState)(e),a,o;return n[0]!==t||n[1]!==e?(a=()=>{let n=window.setTimeout(()=>{i(e)},t);return()=>{window.clearTimeout(n)}},o=[t,e],n[0]=t,n[1]=e,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,G.useEffect)(a,o),r}function dn(e,t){let r=(0,W.c)(11),i;r[0]===t?i=r[1]:(i=t.trim(),r[0]=t,r[1]=i);let a=i,o=$(a,nn),s=e.length>0&&a.length>=2,c=s&&a===o?o:null,l;r[2]!==e||r[3]!==c?(l=c===null?null:st(e,c),r[2]=e,r[3]=c,r[4]=l):l=r[4];let u=l,d;r[5]===u?d=r[6]:(d=u===null?ln:un(u),r[5]=u,r[6]=d);let f=n(d),p=s&&a!==o,m=p?cn:f.matches,h=c??``,g=s&&(p||f.isLoading),_;return r[7]!==m||r[8]!==h||r[9]!==g?(_={matches:m,query:h,isPending:g},r[7]=m,r[8]=h,r[9]=g,r[10]=_):_=r[10],_}function fn(e){let t=e.query?.trim()??``,r=e.environmentId!==null&&e.cwd!==null?JSON.stringify([e.environmentId,e.cwd,t]):null,[i,a]=(0,G.useState)({targetKey:r,cursors:Q}),o=i.targetKey===r?i.cursors:Q,c=(0,G.useMemo)(()=>e.environmentId!==null&&e.cwd!==null?o.map(n=>Xt.listRefs({environmentId:e.environmentId,input:{cwd:e.cwd,...t.length>0?{query:t}:{},...n===void 0?{}:{cursor:n},limit:rn}})):[],[o,t,e.cwd,e.environmentId]),u=(0,G.useMemo)(()=>j(e=>c.map(t=>e(t))).pipe(E(`web:vcs-ref-pages:${r??`empty`}`)),[c,r]),d=n(u),f=d.flatMap(e=>{let t=ae(s(e));return t===null?[]:[t]}),p=new Map;for(let e of f)for(let t of e.refs)p.set(t.name,t);let m=f[0]??null,h=f.at(-1)??null,g=m===null||h===null?null:{refs:[...p.values()],isRepo:m.isRepo,hasPrimaryRemote:m.hasPrimaryRemote,nextCursor:h.nextCursor,totalCount:Math.max(...f.map(e=>e.totalCount))},_=d.find(e=>e._tag===`Failure`),v=pt(d),y=_?._tag===`Failure`?(()=>{let e=l(_.cause);return e instanceof Error&&e.message.trim().length>0?e.message:`Failed to load refs.`})():null,b=(0,G.useCallback)(()=>{let e=c[0];a({targetKey:r,cursors:Q}),e!==void 0&&he.refresh(e)},[c,r]),x=(0,G.useCallback)(()=>{r!==null&&g?.nextCursor!==null&&g?.nextCursor!==void 0&&a(e=>{let t=e.targetKey===r?e.cursors:Q;return t.includes(g.nextCursor)?{targetKey:r,cursors:t}:{targetKey:r,cursors:[...t,g.nextCursor]}})},[g?.nextCursor,r]);return{data:g,refs:g?.refs??an,error:y,isPending:d.some(e=>e.waiting),isFetchingNextPage:v,refresh:b,loadNext:x}}function pn(e,t){return e.environmentId===t.environmentId&&e.cwd===t.cwd&&e.query===t.query&&e.kind===t.kind&&e.imageOnly===t.imageOnly}function mn(e,t,n){let r=(0,W.c)(32),i=n?.allowEmptyQuery===!0,a;r[0]===e.query?a=r[1]:(a=e.query==null?null:e.query.trim(),r[0]=e.query,r[1]=a);let o;r[2]!==a||r[3]!==e.cwd||r[4]!==e.environmentId||r[5]!==e.imageOnly||r[6]!==e.kind?(o={environmentId:e.environmentId,cwd:e.cwd,query:a,kind:e.kind,imageOnly:e.imageOnly},r[2]=a,r[3]=e.cwd,r[4]=e.environmentId,r[5]=e.imageOnly,r[6]=e.kind,r[7]=o):o=r[7];let s=o,c=$(s,Qt),l=tt(c.environmentId),{canReadFiles:u}=l,d,f,p;r[8]!==i||r[9]!==u||r[10]!==c.cwd||r[11]!==c.environmentId||r[12]!==c.imageOnly||r[13]!==c.kind||r[14]!==c.query||r[15]!==t?(d=c.environmentId!==null&&c.cwd!==null&&c.query!==null&&(i||c.query.length>0)?{environmentId:c.environmentId,input:{cwd:c.cwd,query:c.query,limit:t,...c.kind?{kind:c.kind}:{},...c.imageOnly?{imageOnly:!0}:{}}}:null,f=U,p=u&&d!==null?rt.searchEntries(d):null,r[8]=i,r[9]=u,r[10]=c.cwd,r[11]=c.environmentId,r[12]=c.imageOnly,r[13]=c.kind,r[14]=c.query,r[15]=t,r[16]=d,r[17]=f,r[18]=p):(d=r[16],f=r[17],p=r[18]);let m=f(p),h=d!==null,g=m.data?.entries??on,_=!h||l.isPending?null:u?m.error:l.error??`This connection cannot search host files.`,v;r[19]!==c||r[20]!==l.isPending||r[21]!==h||r[22]!==s||r[23]!==m.isPending?(v=!pn(s,c)||h&&(l.isPending||m.isPending),r[19]=c,r[20]=l.isPending,r[21]=h,r[22]=s,r[23]=m.isPending,r[24]=v):v=r[24];let y=c.query??``,b=m.data?.truncated??!1,x;return r[25]!==m.refresh||r[26]!==g||r[27]!==_||r[28]!==v||r[29]!==y||r[30]!==b?(x={entries:g,error:_,isPending:v,searchedQuery:y,truncated:b,refresh:m.refresh},r[25]=m.refresh,r[26]=g,r[27]=_,r[28]=v,r[29]=y,r[30]=b,r[31]=x):x=r[31],x}function hn(e){return mn(e,$t)}function gn(e){let t=(0,W.c)(20),n=e.environmentId!==null&&e.cwd!==null,r=tt(e.environmentId),i=n&&r.canReadFiles,a=n&&r.isPending,o=e.query,s;t[0]===o?s=t[1]:(s=o.trim(),t[0]=o,t[1]=s);let c=s.length>0,l=$(o,en),u;t[2]!==i||t[3]!==l||t[4]!==c||t[5]!==e.caseSensitive||t[6]!==e.cwd||t[7]!==e.environmentId||t[8]!==e.useRegex||t[9]!==e.wholeWord?(u=i&&e.environmentId!==null&&e.cwd!==null&&c&&l.trim().length>0?it({environmentId:e.environmentId,input:{cwd:e.cwd,query:l,limit:tn,caseSensitive:e.caseSensitive,wholeWord:e.wholeWord,useRegex:e.useRegex}}):null,t[2]=i,t[3]=l,t[4]=c,t[5]=e.caseSensitive,t[6]=e.cwd,t[7]=e.environmentId,t[8]=e.useRegex,t[9]=e.wholeWord,t[10]=u):u=t[10];let d=U(u),f=d.data?.matches??sn,p=!n||a?null:i?d.error:r.error??`This connection cannot search host files.`,m=a||i&&c&&(o!==l||d.isPending),h=d.data?.truncated??!1,g=e.useRegex&&d.data?.regexFallbackError!==void 0,_;return t[11]!==i||t[12]!==c||t[13]!==a||t[14]!==f||t[15]!==p||t[16]!==m||t[17]!==h||t[18]!==g?(_={canReadFiles:i,isCheckingAccess:a,matches:f,error:p,isPending:m,hasQuery:c,truncated:h,invalidRegex:g},t[11]=i,t[12]=c,t[13]=a,t[14]=f,t[15]=p,t[16]=m,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function _n(e,t){let n=t?.enabled!==!1&&e.environmentId!==null&&e.threadId!==null&&e.fromTurnCount!==null&&e.toTurnCount!==null,r=n&&e.fromTurnCount===0?{environmentId:e.environmentId,input:{threadId:e.threadId,toTurnCount:e.toTurnCount,ignoreWhitespace:e.ignoreWhitespace}}:null,i=n&&e.fromTurnCount!==0?{environmentId:e.environmentId,input:{threadId:e.threadId,fromTurnCount:e.fromTurnCount,toTurnCount:e.toTurnCount,ignoreWhitespace:e.ignoreWhitespace}}:null,a=U(r===null?null:K.fullThreadDiff(r)),o=U(i===null?null:K.turnDiff(i));return r===null?o:a}function vn(e){let t=(0,W.c)(2),n;return t[0]===e?n=t[1]:(n=e===null?null:K.turnItem({environmentId:e.environmentId,input:{threadId:e.threadId,itemId:e.itemId,revision:e.revision}}),t[0]=e,t[1]=n),U(n)}export{lt as _,gn as a,vn as c,J as d,gt as f,K as g,mt as h,fn as i,Zt as l,vt as m,hn as n,mn as o,_t as p,$ as r,dn as s,_n as t,Xt as u};
2
- //# sourceMappingURL=queries-BWcz-n4a.js.map
@@ -1,2 +0,0 @@
1
- import{$o as e,Es as t,Fw as n,Qo as r,RE as i,RT as a,Ss as o,bw as s,ds as c,rs as l}from"./utils-hgbJ2TVM.js";var u=i(),d=l(o(!1)).pipe(c(`web-environment-query:empty`));function f(e){let t=n(e);return t instanceof Error&&t.message.trim().length>0?t.message:`The environment request failed.`}function p(n){let i=(0,u.c)(20),o=n??d,c=e(o),l=r(o),p;i[0]===c?p=i[1]:(p=a(t(c)),i[0]=c,i[1]=p);let m;i[2]!==c._tag||i[3]!==c.previousSuccess||i[4]!==c.timestamp?(m=c._tag===`Success`?c.timestamp:c._tag===`Failure`?a(c.previousSuccess)?.timestamp??0:0,i[2]=c._tag,i[3]=c.previousSuccess,i[4]=c.timestamp,i[5]=m):m=i[5];let h;i[6]!==c._tag||i[7]!==c.cause?(h=c._tag===`Failure`?f(c.cause):null,i[6]=c._tag,i[7]=c.cause,i[8]=h):h=i[8];let g;i[9]!==c._tag||i[10]!==c.cause?(g=c._tag===`Failure`?a(s(c.cause)):null,i[9]=c._tag,i[10]=c.cause,i[11]=g):g=i[11];let _=n!==null&&c.waiting,v=c._tag===`Success`,y;return i[12]!==l||i[13]!==p||i[14]!==m||i[15]!==h||i[16]!==g||i[17]!==_||i[18]!==v?(y={data:p,dataUpdatedAt:m,error:h,failure:g,isPending:_,isSuccess:v,refresh:l},i[12]=l,i[13]=p,i[14]=m,i[15]=h,i[16]=g,i[17]=_,i[18]=v,i[19]=y):y=i[19],y}export{p as n,f as t};
2
- //# sourceMappingURL=query-BFP47tsD.js.map
@@ -1 +0,0 @@
1
- import"./chunk-FOHPRMQF-DzxwRta7.js";import{m as e}from"./mermaid-parser.core-DOOH_cP_.js";export{e as createRailroadAbnfServices};
@@ -1 +0,0 @@
1
- import"./chunk-FOHPRMQF-DzxwRta7.js";import{f as e}from"./mermaid-parser.core-DOOH_cP_.js";export{e as createRailroadEbnfServices};
@@ -1 +0,0 @@
1
- import"./chunk-FOHPRMQF-DzxwRta7.js";import{u as e}from"./mermaid-parser.core-DOOH_cP_.js";export{e as createRailroadPegServices};
@@ -1,2 +0,0 @@
1
- import{Ap as e,Xf as t,Zf as n,um as r}from"./utils-hgbJ2TVM.js";var i={"approval-required":{label:`Supervised`,description:`Ask before commands and file changes.`,icon:t},"auto-accept-edits":{label:`Auto-accept edits`,description:`Auto-approve edits, ask before other actions.`,icon:e},auto:{label:`Auto`,description:`Supported providers approve routine actions; others still ask.`,icon:r},"full-access":{label:`Full access`,description:`Allow commands and edits without prompts.`,icon:n}},a=Object.keys(i);export{a as n,i as t};
2
- //# sourceMappingURL=runtimeModeConfig-sQBlbgY3.js.map
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{RE as t,mE as n}from"./utils-hgbJ2TVM.js";import{t as r}from"./SettingsPanels-DdhZ2nXb.js";var i=t(),a=e(n());function o(){let e=(0,i.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,a.jsx)(r,{}),e[0]=t):t=e[0],t}export{o as component};
2
- //# sourceMappingURL=settings.appearance-DUvYlE0y.js.map
@@ -1,2 +0,0 @@
1
- import{i as e}from"./SettingsPanels-DdhZ2nXb.js";var t=e;export{t as component};
2
- //# sourceMappingURL=settings.archived-B5WGVqfk.js.map
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$n as n,$o as r,A_ as i,Af as a,C_ as o,Cd as s,D_ as c,E_ as l,GT as u,Gy as d,HT as f,I_ as p,Ix as m,Jb as h,Jm as g,M_ as _,O_ as v,Oy as y,RE as b,RT as x,S_ as S,Sl as C,Sm as w,T_ as T,Td as E,Up as D,VT as O,Vc as k,Xd as A,Xp as j,Yo as M,Zg as N,Zn as P,__ as F,ar as ee,cr as te,cs as ne,ds as re,eC as ie,er as ae,f_ as oe,h_ as se,ix as ce,j_ as le,k_ as ue,lr as I,mE as de,m_ as fe,mv as pe,ns as L,or as me,qg as he,qn as ge,rr as _e,rs as ve,sr as ye,t as be,tr as xe,ur as Se,v_ as Ce,w_ as R,y_ as we,zp as Te}from"./utils-hgbJ2TVM.js";import{Dt as z,Et as Ee,F as De,Ht as Oe,On as ke,Ot as Ae,R as je,Ut as Me,W as Ne,jt as Pe,kt as Fe,o as Ie,on as Le,tt as B,w as Re,x as V}from"./runtime-Cj24N7je.js";import{Ct as ze,E as Be,F as Ve,Ot as H,S as He,Tt as Ue,_ as We,kt as U,t as W}from"./runtime-CArTL2GH.js";import{a as Ge,c as Ke,o as qe,s as Je,t as Ye}from"./select-Bsag72zE.js";import{t as G}from"./spinner-Bzrp5oww.js";import{i as K,p as Xe}from"./toast-B3hjhWRf.js";import{A as Ze,D as Qe,E as $e,O as q,b as et,c as tt,et as nt,s as rt,v as J}from"./useSettings-BcmuuiTp.js";import{f as it,h as at,s as ot}from"./server-Vynm5NwP.js";import{a as st,i as ct,n as lt,s as ut}from"./session-DyiiEN5g.js";import{n as dt}from"./query-BFP47tsD.js";import{t as ft}from"./use-atom-command-D34CFqu3.js";import{n as Y}from"./toastHelpers-Dsph6LwL.js";import{i as pt,r as mt}from"./timestampFormat-wac2e_Jz.js";import{a as ht,n as gt,t as _t}from"./tooltip-D-SzZpgJ.js";import{t as vt}from"./textarea-wDfYVvpo.js";import{t as yt}from"./input-D_jxqXLR.js";import{t as bt}from"./scroll-area-DORwTFtw.js";import{a as xt,c as St,i as Ct,l as wt,n as Tt,o as Et,r as Dt,s as Ot,t as kt}from"./dialog-Cgb4jap2.js";import{n as At}from"./P4ConnectAccountPages-BWvaLOY-.js";import{a as jt,i as Mt,o as Nt,r as Pt,t as Ft}from"./empty-DHl8_LXy.js";import{t as It}from"./AnimatedHeight-wZzihILs.js";import{C as Lt,_ as Rt,w as zt,y as Bt}from"./keybindings-CqjUKNRx.js";import{i as Vt,o as Ht,t as Ut}from"./popover-2XJd3KEJ.js";import{t as Wt}from"./checkbox-Q0bv8RvC.js";import{_ as Gt,a as Kt,c as qt,d as Jt,f as Yt,g as Xt,i as Zt,l as Qt,p as $t,r as en,s as tn,u as nn,v as rn}from"./uiStateStore-DoJ0IbwQ.js";import{n as an,t as on}from"./EnvironmentMachineIcon-B2v_GWgB.js";import{r as sn,t as cn}from"./alert-CdZT7d18.js";import{a as ln,i as un,s as dn,u as fn}from"./settingsLayout-CuUCC6iL.js";import{_ as pn,b as mn,g as hn,h as gn,v as _n,x as vn,y as yn}from"./command-CIj8Rufv.js";import{t as X}from"./ConnectionStatusDot-Bx8Imvqc.js";import{a as bn,n as xn,o as Sn,s as Cn,t as wn}from"./primary-BKQnuXrW.js";import{n as Tn,t as En}from"./onboarding-BmDFkmWD.js";import{Ar as Dn,Cr as On,Dr as kn,Er as An,Gn as jn,Hn as Mn,Jn as Nn,Jt as Pn,Kn as Fn,Kt as In,Mr as Ln,Nr as Rn,Or as zn,Sr as Bn,T as Vn,Tr as Hn,Un,Wn,Wt as Gn,Yn as Kn,ai as qn,da as Jn,dr as Yn,fr as Xn,ii as Zn,jr as Qn,kr as $n,mr as er,pa as tr,pr as nr,qn as rr,qt as ir,tr as ar,ua as or}from"./main-4dRVuXx2.js";import{t as sr}from"./FoldedSettingsSection-TLqDB_1b.js";var Z=b(),cr=[{scope:o,title:`View environment`,description:`Read threads, status, checkpoints, and configuration.`},{scope:S,title:`Operate tasks`,description:`Start, update, and stop tasks.`},{scope:v,title:`Change environment settings`,description:`Edit environment preferences and keybindings.`},{scope:T,title:`Manage providers`,description:`Configure, install, sign in to, and update providers and usage sources.`},{scope:F,title:`Maintain environment`,description:`Update the server and control environment processes.`},{scope:R,title:`Control previews`,description:`Open browser previews and host browser automation.`},{scope:se,title:`View diagnostics and usage`,description:`Read process diagnostics, resource history, and usage totals.`},{scope:_,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:ue,title:`Change source control`,description:`Commit, push, manage branches and repositories, and change pull requests.`},{scope:Ce,title:`Read files`,description:`Browse host files, search workspaces, and inspect local changes.`},{scope:we,title:`Write files`,description:`Edit workspace files and save plans to disk.`},{scope:oe,title:`View access`,description:`Inspect pairing links and authorized clients.`},{scope:fe,title:`Manage access`,description:`Issue and revoke credentials for other clients.`},{scope:l,title:`View relay`,description:`Inspect managed relay connectivity.`},{scope:c,title:`Manage relay`,description:`Change managed tunnel connectivity.`}],Q=e(de(),1);function lr(e){let t=(0,Z.c)(4),{environmentId:n,connected:r,routeContext:i}=e,a=i!==void 0&&i,o=st(n),s;return t[0]!==r||t[1]!==a||t[2]!==o?(s=r&&!o.hasError&&!o.isPending&&o.data?.authenticated?(0,Q.jsxs)(`div`,{className:`space-y-3 py-3 text-xs`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:a?`These permissions apply to your active route. Other routes may have different permissions.`:`These permissions apply to this client’s current connection.`}),(0,Q.jsx)(`ul`,{className:`grid gap-x-6 gap-y-2 sm:grid-cols-2`,children:cr.map(e=>{let{scope:t,title:n}=e;return(0,Q.jsxs)(`li`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsx)(`span`,{children:n}),(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:p(o.data,t)?`Allowed`:`Not granted`})]},t)})})]}):(0,Q.jsx)(`p`,{className:`py-3 text-xs text-muted-foreground`,children:`Permissions not checked. Connect to this environment to view this session’s permissions.`}),t[0]=r,t[1]=a,t[2]=o,t[3]=s):s=t[3],s}var $=e(t(),1);function ur(e,t){let n=new URL(e);return n.pathname=`/pair`,U(n,t).toString()}function dr(e,t){return new URL(e).protocol===`https:`?He({host:e,token:t}):null}function fr(){let e=(0,Z.c)(48),t=window.desktopBridge?.setLocalEnvironmentEnabled,[n]=(0,$.useState)(pr),[r,i]=(0,$.useState)(!1),[a,o]=(0,$.useState)(!1),[s,c]=(0,$.useState)(null);if(!t)return null;let l;e[0]===n?l=e[1]:(l=async()=>{o(!0),c(null);try{await t(!n)}catch(e){let t=e;c(t instanceof Error?t.message:`Couldn't change this setting.`),o(!1)}},e[0]=n,e[1]=l);let u=l,d;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=ar(`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)(tr,{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)(ln,{...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)(Rn,{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)($n,{children:y}),e[14]=y,e[15]=b);let x;e[16]!==b||e[17]!==v?(x=(0,Q.jsxs)(Qn,{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)(zn,{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)(Dn,{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)(Ln,{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 pr(){return!Re()}function mr(e){return e.serverConfig===null?`Connect to this environment to change its icon.`:e.serverConfig.environment.capabilities.environmentIcon===!0?e.operateAccess===`granted`?null:`Your session on this environment cannot change its settings.`:`This environment's server is too old to keep an icon. Update it to choose one.`}function hr(e){let t=(0,Z.c)(27),{environmentId:n,serverConfig:r}=e,i=et(n),a=ct(n,`settings:write`)?`granted`:`denied`,o;t[0]!==a||t[1]!==r?(o=mr({serverConfig:r,operateAccess:a}),t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c=r?.environment.platform.machine??`server`,l;t[3]===r?l=t[4]:(l=C(r),t[3]=r,t[4]=l);let u=l,d;t[5]===u?d=t[6]:(d=(0,Q.jsxs)(ye,{children:[(0,Q.jsx)(an,{kind:u}),`Icon`]}),t[5]=u,t[6]=d);let f;t[7]===s?f=t[8]:(f=s===null?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(P,{disabled:!0,className:`whitespace-normal`,children:s}),(0,Q.jsx)(_e,{})]}),t[7]=s,t[8]=f);let p;t[9]!==c||t[10]!==s||t[11]!==i?(p=e=>{s===null&&N(e)&&i({environmentIcon:e===c?null:e})},t[9]=c,t[10]=s,t[11]=i,t[12]=p):p=t[12];let m;t[13]!==c||t[14]!==s||t[15]!==r?.environment?(m=he.map(e=>(0,Q.jsx)(xe,{value:e,disabled:s!==null,children:(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(an,{kind:e,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:on[e]}),e===c?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:r?.environment.platform.machine?`detected`:`default`}):null]})},e)),t[13]=c,t[14]=s,t[15]=r?.environment,t[16]=m):m=t[16];let h;t[17]!==u||t[18]!==p||t[19]!==m?(h=(0,Q.jsx)(ae,{value:u,onValueChange:p,children:m}),t[17]=u,t[18]=p,t[19]=m,t[20]=h):h=t[20];let g;t[21]!==f||t[22]!==h?(g=(0,Q.jsxs)(me,{children:[f,h]}),t[21]=f,t[22]=h,t[23]=g):g=t[23];let _;return t[24]!==d||t[25]!==g?(_=(0,Q.jsxs)(ee,{children:[d,g]}),t[24]=d,t[25]=g,t[26]=_):_=t[26],_}function gr(e){let t=(0,Z.c)(31),{environment:n,onAddRoute:r}=e,i=Fe(n.entry),a=i.map(vr),[o,s]=(0,$.useState)(null),c=o!==null&&o.length===a.length&&o.some((e,t)=>e!==a[t])?[...o]:a,l=new Map(i.map(_r)),u=c.flatMap(e=>l.get(e)??[]),d=ut(n.environmentId),f;t[0]!==n.connection||t[1]!==d._tag||t[2]!==d.value?(f=d._tag===`Some`&&n.connection.phase===`connected`?z(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=ft(at.reorderRoutes,`Reorder routes`),h=ft(at.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:tn},t[5]=_):_=t[5];let v=Gt(Xt(Yt,g),Xt(Jt,_)),y;t[6]!==n.environmentId||t[7]!==h?(y=async e=>{let t=Ee(e);await nt(`Remove ${Ae(e)} route?${t===null?``:`\n${t}`}`,{variant:`destructive`})===!0&&await h({environmentId:n.environmentId,routeId:z(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=Kt(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=nn,C=$t,w;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(w=[qn,Zn],t[9]=w):w=t[9];let T=Zt,E=Qt,D=`Routes to ${n.label}, preferred first`,O=u.map((e,t)=>(0,Q.jsx)(yr,{route:e,position:t+1,inUse:z(e.target)===p,removable:u.length>1&&!Pe(e),onRemove:()=>void b(e)},z(e.target))),k;t[10]!==O||t[11]!==D?(k=(0,Q.jsx)(`ol`,{"aria-label":D,children:O}),t[10]=O,t[11]=D,t[12]=k):k=t[12];let A;t[13]!==T||t[14]!==c||t[15]!==k||t[16]!==E?(A=(0,Q.jsx)(T,{items:c,strategy:E,children:k}),t[13]=T,t[14]=c,t[15]=k,t[16]=E,t[17]=A):A=t[17];let j;t[18]!==S||t[19]!==x||t[20]!==v||t[21]!==A||t[22]!==C||t[23]!==w?(j=(0,Q.jsx)(S,{sensors:v,collisionDetection:C,modifiers:w,onDragEnd:x,children:A}),t[18]=S,t[19]=x,t[20]=v,t[21]=A,t[22]=C,t[23]=w,t[24]=j):j=t[24];let M;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(Te,{className:`size-3`}),t[25]=M):M=t[25];let N;t[26]===r?N=t[27]:(N=(0,Q.jsx)(`div`,{className:`-ml-1.5 pt-1`,children:(0,Q.jsxs)(I,{size:`xs`,variant:`ghost-muted`,onClick:r,children:[M,`Add route`]})}),t[26]=r,t[27]=N);let P;return t[28]!==j||t[29]!==N?(P=(0,Q.jsxs)(`div`,{className:`mt-2 border-t border-border/50 py-2`,children:[j,N]}),t[28]=j,t[29]=N,t[30]=P):P=t[30],P}function _r(e){return[z(e.target),e]}function vr(e){return z(e.target)}function yr(e){let t=(0,Z.c)(43),{route:n,position:r,inUse:i,removable:o,onRemove:s}=e,c;t[0]===n.target?c=t[1]:(c=z(n.target),t[0]=n.target,t[1]=c);let l=c,u;t[2]===n?u=t[3]:(u=Ae(n),t[2]=n,t[3]=u);let d=u,f;t[4]===n?f=t[5]:(f=Ee(n),t[4]=n,t[5]=f);let p=f,m;t[6]===l?m=t[7]:(m={id:l},t[6]=l,t[7]=m);let{attributes:h,listeners:_,setNodeRef:v,setActivatorNodeRef:y,transform:b,transition:x,isDragging:S}=qt(m),C;t[8]===b?C=t[9]:(C=rn.Translate.toString(b),t[8]=b,t[9]=C);let w;t[10]!==C||t[11]!==x?(w={transform:C,transition:x},t[10]=C,t[11]=x,t[12]=w):w=t[12];let T=S&&`relative z-10 rounded-md bg-background shadow-md`,E;t[13]===T?E=t[14]:(E=be(`flex items-center gap-2 py-2`,T),t[13]=T,t[14]=E);let D;t[15]===i?D=t[16]:(D=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]=D);let O;t[17]!==d||t[18]!==D?(O=(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[d,D]}),t[17]=d,t[18]=D,t[19]=O):O=t[19];let k;t[20]!==p||t[21]!==n?(k=p===null?null:(0,Q.jsxs)(`p`,{className:`truncate text-2xs text-muted-foreground`,children:[p,Pe(n)?` · found automatically`:``]}),t[20]=p,t[21]=n,t[22]=k):k=t[22];let A;t[23]!==O||t[24]!==k?(A=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[O,k]}),t[23]=O,t[24]=k,t[25]=A):A=t[25];let j=`Reorder ${d}, position ${r}`,M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(a,{className:`size-3.5`}),t[26]=M):M=t[26];let N;t[27]!==h||t[28]!==_||t[29]!==y||t[30]!==j?(N=(0,Q.jsx)(`button`,{type:`button`,ref:y,...h,..._,"aria-label":j,className:`flex size-6 shrink-0 cursor-grab touch-none items-center justify-center rounded text-muted-foreground/70 outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring active:cursor-grabbing`,children:M}),t[27]=h,t[28]=_,t[29]=y,t[30]=j,t[31]=N):N=t[31];let P;t[32]!==d||t[33]!==s||t[34]!==o?(P=o?(0,Q.jsxs)(_t,{children:[(0,Q.jsx)(ht,{render:(0,Q.jsx)(I,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":`Remove ${d} route`,onClick:s}),children:(0,Q.jsx)(g,{className:`size-3`})}),(0,Q.jsx)(gt,{side:`top`,children:`Remove route`})]}):null,t[32]=d,t[33]=s,t[34]=o,t[35]=P):P=t[35];let F;return t[36]!==v||t[37]!==A||t[38]!==N||t[39]!==P||t[40]!==w||t[41]!==E?(F=(0,Q.jsxs)(`li`,{ref:v,style:w,className:E,children:[A,N,P]}),t[36]=v,t[37]=A,t[38]=N,t[39]=P,t[40]=w,t[41]=E,t[42]=F):F=t[42],F}function br(e){let t=e.username?`${e.username}@${e.hostname}`:e.hostname;return e.port?`${t}:${e.port}`:t}function xr(e,t=null){let{entry:n}=e;if(n.target._tag===`PrimaryConnectionTarget`)return`This machine`;let r=Fe(n);if(r.length>1){let e=t===null?void 0:r.find(e=>z(e.target)===z(t));return e===void 0?Ae(r[0]):`via ${Ae(e)}`}return e.relayManaged?`P4 Connect`:We(n.target)?`WSL`:n.target._tag===`SshConnectionTarget`&&f(n.profile)&&n.profile.value._tag===`SshConnectionProfile`?`SSH ${br(n.profile.value.target)}`:e.displayUrl??`Remote link`}function Sr(e){let t=(0,Z.c)(23),{kind:n,label:r,subtitle:i,below:a,detail:o,dimmed:s,className:c,children:l}=e,u=s!==void 0&&s&&`opacity-60`,d;t[0]!==c||t[1]!==u?(d=be(`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)(an,{"aria-hidden":!0,kind:n,className:`size-4 text-muted-foreground`}),t[3]=n,t[4]=f);let p;t[5]===r?p=t[6]:(p=(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground`,children:r}),t[5]=r,t[6]=p);let m;t[7]===i?m=t[8]:(m=(0,Q.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:i}),t[7]=i,t[8]=m);let h;t[9]!==a||t[10]!==p||t[11]!==m?(h=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[p,m,a]}),t[9]=a,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]===l?g=t[14]:(g=(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:l}),t[13]=l,t[14]=g);let _;t[15]===o?_=t[16]:(_=o?(0,Q.jsx)(`div`,{className:`col-span-2 col-start-2 min-w-0`,children:o}):null,t[15]=o,t[16]=_);let v;return t[17]!==d||t[18]!==f||t[19]!==h||t[20]!==g||t[21]!==_?(v=(0,Q.jsxs)(`div`,{className:d,children:[f,h,g,_]}),t[17]=d,t[18]=f,t[19]=h,t[20]=g,t[21]=_,t[22]=v):v=t[22],v}var Cr=[{value:100,label:`Prefer`},{value:50,label:`Normal`},{value:25,label:`Less often`},{value:0,label:`Manual only`}];function wr(e){return e===void 0||e===50?50:e===0?0:e<50?25:100}function Tr(e){return Cr.find(t=>t.value===e).label}function Er(e,t){let n=e.flatMap(e=>{let n=wr(t[e.environmentId]);return n===50?[]:[`${e.label} ${Tr(n).toLowerCase()}`]});return n.length===0?null:n.join(` · `)}function Dr(e){let t=(0,Z.c)(27),{environments:n}=e,r=rt(),i=tt(),a=J();if(n.length<2)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=ar(`load-balancing`),t[0]=o):o=t[0];let{id:s,title:c}=o,l;t[1]!==n||t[2]!==r.loadBalancingEnabled||t[3]!==r.loadBalancingWeights?(l=r.loadBalancingEnabled?Er(n,r.loadBalancingWeights):`Off`,t[1]=n,t[2]=r.loadBalancingEnabled,t[3]=r.loadBalancingWeights,t[4]=l):l=t[4];let u=!i,d;t[5]===a?d=t[6]:(d=e=>a({loadBalancingEnabled:e}),t[5]=a,t[6]=d);let f;t[7]!==r.loadBalancingEnabled||t[8]!==u||t[9]!==d?(f=(0,Q.jsx)(tr,{"aria-label":`Automatically balance load`,checked:r.loadBalancingEnabled,disabled:u,onCheckedChange:d}),t[7]=r.loadBalancingEnabled,t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`p`,{className:`px-3 py-2.5 text-xs text-muted-foreground sm:px-4`,children:`New threads in shared projects start on the machine with the most free CPU and memory, weighted by each machine's preference.`}),t[11]=p):p=t[11];let m;if(t[12]!==n||t[13]!==r.loadBalancingEnabled||t[14]!==r.loadBalancingWeights||t[15]!==i||t[16]!==a){let e;t[18]!==r.loadBalancingEnabled||t[19]!==r.loadBalancingWeights||t[20]!==i||t[21]!==a?(e=e=>(0,Q.jsx)(Sr,{kind:C(e.serverConfig),label:e.label,subtitle:xr(e),children:(0,Q.jsxs)(Ye,{items:Cr,value:wr(r.loadBalancingWeights[e.environmentId]),disabled:!i||!r.loadBalancingEnabled,onValueChange:t=>{t!==null&&a({loadBalancingWeights:{...r.loadBalancingWeights,[e.environmentId]:t}})},children:[(0,Q.jsx)(Je,{size:`xs`,className:`w-32`,"aria-label":`${e.label} load preference`,children:(0,Q.jsx)(Ke,{})}),(0,Q.jsx)(qe,{align:`end`,alignItemWithTrigger:!1,children:Cr.map(Or)})]})},e.environmentId),t[18]=r.loadBalancingEnabled,t[19]=r.loadBalancingWeights,t[20]=i,t[21]=a,t[22]=e):e=t[22],m=n.map(e),t[12]=n,t[13]=r.loadBalancingEnabled,t[14]=r.loadBalancingWeights,t[15]=i,t[16]=a,t[17]=m}else m=t[17];let h;return t[23]!==l||t[24]!==f||t[25]!==m?(h=(0,Q.jsxs)(sr,{id:s,title:c,summary:l,control:f,children:[p,m]}),t[23]=l,t[24]=f,t[25]=m,t[26]=h):h=t[26],h}function Or(e){let{value:t,label:n}=e;return(0,Q.jsx)(Ge,{value:t,children:n},t)}var kr=[{value:`off`,label:`Off`},{value:`read`,label:`Read PRs`},{value:`read-write`,label:`Read and act`}],Ar={"read-write":`read and act`,read:`read PRs`};function jr(e){let t=[`read-write`,`read`].flatMap(t=>{let n=e.filter(e=>e.permission===t);return n.length===0?[]:[`${n.map(e=>e.label).join(`, `)} ${Ar[t]}`]});return t.length===0?null:t.join(` · `)}function Mr(e){let t=(0,Z.c)(19),{environments:n}=e,i=r(at.githubRoutingPermissionsValueAtom),a=r(at.catalogValueAtom),o=ft(at.setGitHubRoutingPermission),[s,c]=(0,$.useState)(!1);if(n.length<2)return null;let l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=ar(`github-routing`),t[0]=l):l=t[0];let{id:u,title:d}=l,f;t[1]!==n||t[2]!==i?(f=jr(n.map(e=>({label:e.label,permission:Me(e.entry,i)})))??`Off`,t[1]=n,t[2]=i,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]!==a||t[6]!==n||t[7]!==i||t[8]!==s||t[9]!==o){let e;t[11]!==a||t[12]!==i||t[13]!==s||t[14]!==o?(e=e=>(0,Q.jsx)(Sr,{kind:C(e.serverConfig),label:e.label,subtitle:xr(e),children:(0,Q.jsxs)(Ye,{items:kr,value:Me(e.entry,i),disabled:!a.isReady||s||Oe(e.entry)===null,onValueChange:t=>{t!==null&&(c(!0),o({environmentId:e.environmentId,permission:t}).then(e=>{c(!1),e._tag===`Failure`&&K.add({type:`error`,title:`Could not save GitHub routing permission`})}))},children:[(0,Q.jsx)(Je,{size:`xs`,className:`w-32`,"aria-label":`${e.label} GitHub routing`,children:(0,Q.jsx)(Ke,{})}),(0,Q.jsx)(qe,{align:`end`,alignItemWithTrigger:!1,children:kr.map(Nr)})]})},e.environmentId),t[11]=a,t[12]=i,t[13]=s,t[14]=o,t[15]=e):e=t[15],m=n.map(e),t[5]=a,t[6]=n,t[7]=i,t[8]=s,t[9]=o,t[10]=m}else m=t[10];let h;return t[16]!==f||t[17]!==m?(h=(0,Q.jsxs)(sr,{id:u,title:d,summary:f,children:[p,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}function Nr(e){let{value:t,label:n}=e;return(0,Q.jsx)(Ge,{value:t,children:n},t)}function Pr(e){let t=(0,Z.c)(26),{environmentLabel:n,onCancel:r,onConfirm:i}=e,a=At(),[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)(Rn,{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)($n,{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)(Se,{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)($n,{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)(Qn,{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)(zn,{render:(0,Q.jsx)(I,{variant:`outline`}),children:`Cancel`}),t[13]=g):g=t[13];let _;t[14]===i?_=t[15]:(_=(0,Q.jsxs)(Dn,{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)(Ln,{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 Fr={pairingLinks:[],clientSessions:[]};function Ir(e,t,n){let r=n(t);return[...e.filter(e=>n(e)!==r),t]}function Lr(e,t){switch(t.type){case`snapshot`:return t.payload;case`pairingLinkUpserted`:return{...e,pairingLinks:Ir(e.pairingLinks,t.payload,e=>e.id)};case`pairingLinkRemoved`:return{...e,pairingLinks:e.pairingLinks.filter(e=>e.id!==t.payload.id)};case`clientUpserted`:return{...e,clientSessions:Ir(e.clientSessions,t.payload,e=>e.sessionId)};case`clientRemoved`:return{...e,clientSessions:e.clientSessions.filter(e=>e.sessionId!==t.payload.sessionId)}}}function Rr(e,t){let n=Lr(e,t);return[n,[{version:1,revision:t.revision,type:`snapshot`,payload:n}]]}function zr(e){return{accessChanges:De(e,{label:`environment-data:server:auth-access-changes`,subscribe:e=>B(k.subscribeAuthAccess,{}).pipe(pe(()=>Fr,Rr))})}}var Br=zr(W),Vr=3e4,Hr=class extends d()(`DesktopNetworkAccessUnavailableError`,{}){get message(){return`Desktop network access is unavailable.`}},Ur=class extends d()(`DesktopServerExposureStateLoadError`,{cause:y()}){get message(){return`Failed to load desktop server exposure state.`}},Wr=class extends d()(`DesktopAdvertisedEndpointsLoadError`,{cause:y()}){get message(){return`Failed to load advertised desktop endpoints.`}};function Gr(){return typeof window>`u`?void 0:window.desktopBridge}function Kr(e){let t=m(`loadDesktopNetworkAccess`)(function*(){let t=e();if(!t)return yield*new Hr;let[n,r]=yield*ce([ie({try:()=>t.getServerExposureState(),catch:e=>new Ur({cause:e})}),ie({try:()=>t.getAdvertisedEndpoints(),catch:e=>new Wr({cause:e})})],{concurrency:`unbounded`});return{advertisedEndpoints:r,serverExposureState:n}});return ve(t()).pipe(ne({staleTime:Vr,revalidateOnMount:!0}),L,re(`desktop:network-access`))}var qr=Kr(Gr);function Jr(){M.refresh(qr)}function Yr(e,t){let n=t.trim().toLowerCase();if(n.length===0)return e;let r=[],i=[];for(let t of e){let e=t.alias.toLowerCase();e.startsWith(n)?r.push(t):e.includes(n)&&i.push(t)}return[...r,...i]}var Xr=class extends d()(`DesktopSshDiscoveryUnavailableError`,{}){get message(){return`Desktop SSH host discovery is unavailable.`}},Zr=class extends d()(`DesktopSshDiscoveryError`,{cause:y()}){get message(){return`Failed to discover SSH hosts.`}};function Qr(){return typeof window>`u`?void 0:window.desktopBridge}function $r(e){let t=m(`discoverDesktopSshHosts`)(function*(){let t=e();return t?yield*ie({try:()=>t.discoverSshHosts(),catch:e=>new Zr({cause:e})}):yield*new Xr});return ve(t()).pipe(ne({staleTime:3e4,revalidateOnMount:!0}),L,re(`desktop:ssh-hosts`))}var ei=$r(Qr),ti=443,ni=[],ri=[],ii=`backend:default-wsl`,ai=`backend:wsl-off`,oi=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function si(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:oi.format(t)}function ci(e){let t=(0,Z.c)(13),{scopes:n,label:r}=e,i=`${n.length} ${n.length===1?`scope`:`scopes`}`,a=`${r}: show ${i}`,o;t[0]===a?o=t[1]:(o=(0,Q.jsx)(`button`,{type:`button`,"aria-label":a,className:`cursor-help underline decoration-border underline-offset-2 outline-hidden hover:text-foreground focus-visible:text-foreground`}),t[0]=a,t[1]=o);let s;t[2]!==i||t[3]!==o?(s=(0,Q.jsx)(Ht,{openOnHover:!0,delay:250,closeDelay:100,render:o,children:i}),t[2]=i,t[3]=o,t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(`p`,{className:`mb-1 font-medium`,children:`Granted scopes`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=n.map(li),t[6]=n,t[7]=l);let u;t[8]===l?u=t[9]:(u=(0,Q.jsxs)(Vt,{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)(Ut,{children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function li(e){return(0,Q.jsx)(`code`,{className:`font-mono text-foreground/85`,children:e},e)}function ui(e){let t=e.host.trim();if(t.length===0)throw Error(`SSH host or alias is required.`);let n=t,r=e.username.trim()||null,i=null,a=n.lastIndexOf(`@`);if(a>0){let e=n.slice(0,a).trim();n=n.slice(a+1).trim(),!r&&e.length>0&&(r=e)}let o=/^\[([^\]]+)\](?::(\d+))?$/u.exec(n);if(o)n=o[1].trim(),o[2]&&(i=Number.parseInt(o[2],10));else{let e=n.split(`:`);e.length===2&&/^\d+$/u.test(e[1]??``)&&(n=e[0].trim(),i=Number.parseInt(e[1],10))}let s=e.port.trim();if(s.length>0&&(i=Number.parseInt(s,10)),n.length===0)throw Error(`SSH host or alias is required.`);if(i!==null&&(!Number.isInteger(i)||i<=0||i>65535))throw Error(`SSH port must be between 1 and 65535.`);return{alias:n,hostname:n,username:r,port:i}}function di(e){let t=e.trim();if(!t)return null;try{let e=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//u.test(t)||t.startsWith(`//`)?t:`https://${t}`,n=new URL(e,window.location.origin),r=Be(n);if(r)return{host:r.host,pairingCode:r.token};let i=H(n);return i?{host:n.origin,pairingCode:i}:null}catch{return null}}function fi(e){let t=di(e.host);if(t)return t;let n=e.host.trim(),r=e.pairingCode.trim();if(!n)throw Error(`Enter a backend host.`);if(!r)throw Error(`Enter a pairing code.`);return{host:n,pairingCode:r}}function pi(e){let t=`Failed to connect SSH host.`;return(e instanceof Error?e.message:t).replace(/^Error invoking remote method 'desktop:ensure-ssh-environment':\s*/u,``).replace(/^Ssh[A-Za-z]+Error:\s*/u,``).trim()||t}var mi=`first:rounded-t-xl last:rounded-b-xl px-3 py-2.5 sm:px-4`;function hi(e){return In}function gi(e,t){return e===`endpoint-rail`?be(`relative first:rounded-t-xl last:rounded-b-xl px-3 py-3 sm:px-4`,!t&&`bg-muted/15`):be(mi,!t&&`bg-muted/24`)}function _i(e){return[...e].toSorted((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime())}function vi(e,t){return[`${e.length} ${e.length===1?`client`:`clients`}`,t.length>0?`${t.length} ${t.length===1?`pairing link`:`pairing links`}`:null].filter(e=>e!==null).join(` · `)}function yi(e){return[...e].toSorted((e,t)=>e.current===t.current?e.connected===t.connected?new Date(t.issuedAt).getTime()-new Date(e.issuedAt).getTime():e.connected?-1:1:e.current?-1:1)}function bi(e){return{...e,scopes:e.permissions??e.scopes,createdAt:h(e.createdAt),expiresAt:h(e.expiresAt)}}function xi(e){return{...e,scopes:e.permissions??e.scopes,issuedAt:h(e.issuedAt),expiresAt:h(e.expiresAt),lastConnectedAt:e.lastConnectedAt===null?null:h(e.lastConnectedAt)}}function Si(e,t){let n=e.filter(e=>e.status!==`unavailable`);if(t){let e=n.find(e=>wi(e)===t);if(e)return e}return n.find(e=>e.isDefault)??n.find(e=>e.reachability!==`loopback`)??n.find(e=>e.compatibility.hostedHttpsApp===`compatible`)??null}function Ci(e){return e.id.startsWith(`tailscale-magicdns:`)}function wi(e){if(e.id.startsWith(`desktop-loopback:`))return`desktop-core:loopback:http`;if(e.id.startsWith(`desktop-lan:`))return`desktop-core:lan:http`;if(e.id.startsWith(`tailscale-ip:`))return`tailscale:ip:http`;if(Ci(e))return`tailscale:magicdns:https`;let t=`unknown`;try{t=new URL(e.httpBaseUrl).protocol.replace(/:$/u,``)}catch{}return`${e.provider.id}:${e.reachability}:${t}:${e.label}`}function Ti(e,t){return e.compatibility.hostedHttpsApp===`compatible`?dr(e.httpBaseUrl,t)??ur(e.httpBaseUrl,t):ur(e.httpBaseUrl,t)}function Ei(e){let t=new URL(`/pair`,window.location.href);return U(t,e).toString()}function Di(e){try{let t=new URL(e);return t.pathname===`/pair`&&t.searchParams.has(`host`)}catch{return!1}}function Oi(e,t){if(Di(t))return`Opens the hosted app, no install needed`;switch(e.reachability){case`lan`:return`Devices on the same network`;case`private-network`:return`Devices on your private network`;case`public`:return`Reachable from anywhere`;case`loopback`:return`Clients on this machine`}}var ki=(0,$.memo)(function(e){let t=(0,Z.c)(135),{pairingLink:n,credential:r,endpointUrl:i,endpoints:a,defaultEndpointKey:o,presentation:s,revokingPairingLinkId:c,onRevoke:l,canRevoke:u}=e,d=s===void 0?`current`:s,f=fn(1e3),p=new Date(n.expiresAt).getTime(),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(!1),[v,y]=(0,$.useState)(null),b=(0,$.useId)(),x;t[0]===r?x=t[1]:(x=r?Ei(r):null,t[0]=r,t[1]=x);let S=x,C;t[2]!==r||t[3]!==i?(C=r&&i!=null&&i!==``?dr(i,r):null,t[2]=r,t[3]=i,t[4]=C):C=t[4];let w=C,T;if(t[5]!==r||t[6]!==o||t[7]!==a){let e=Si(a,o);T=e&&r?Ti(e,r):null,t[5]=r,t[6]=o,t[7]=a,t[8]=T}else T=t[8];let E=T,O;if(t[9]!==r||t[10]!==a){bb0:{let e=[];if(!r){O=e;break bb0}for(let t of a){if(t.status===`unavailable`)continue;let n=Ti(t,r);e.push({id:t.id,preferenceKey:wi(t),label:t.label,url:n,detail:Oi(t,n),qrShareable:Wn(t)})}O=e}t[9]=r,t[10]=a,t[11]=O}else O=t[11];let k=O,A;t[12]!==r||t[13]!==S||t[14]!==E||t[15]!==i||t[16]!==w?(A=E??(r&&i!=null&&i!==``?w??ur(i,r):V(window.location.hostname)?null:S),t[12]=r,t[13]=S,t[14]=E,t[15]=i,t[16]=w,t[17]=A):A=t[17];let j=A,[M,N]=(0,$.useState)(null),P=M??j??r??``,F=P!==r,ee=F&&Di(P),te=k.find(e=>e.url===P)?.qrShareable??!0,ne=typeof window<`u`&&window.isSecureContext&&navigator.clipboard?.writeText!=null,re;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(re={onCopy:Zi,onError:(e,t)=>{let{value:n,kind:r}=t;N(n),h(!0),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}=Xe(re),ae;t[19]===ie?ae=t[20]:(ae=(e,t)=>{ie(e,{value:e,kind:t})},t[19]=ie,t[20]=ae);let oe=ae,se=Qi,ce;t[21]!==oe||t[22]!==r?(ce=()=>{r&&oe(r,`code`)},t[21]=oe,t[22]=r,t[23]=ce):ce=t[23];let le=ce,ue;t[24]===n.expiresAt?ue=t[25]:(ue=si(n.expiresAt),t[24]=n.expiresAt,t[25]=ue);let de=ue,fe=n.label??`Pairing link`,pe;t[26]!==o||t[27]!==k||t[28]!==v?(pe=Fn(k,v,o),t[26]=o,t[27]=k,t[28]=v,t[29]=pe):pe=t[29];let L=pe,me=L?.url??j,he=L?.qrShareable??!0;if(p<=f)return null;let ge;t[30]===d?ge=t[31]:(ge=hi(d),t[30]=d,t[31]=ge);let _e;t[32]===n.createdAt?_e=t[33]:(_e=si(n.createdAt),t[32]=n.createdAt,t[33]=_e);let ve=`Link created at ${_e}`,ye;t[34]===ve?ye=t[35]:(ye=(0,Q.jsx)(X,{tooltipText:ve,dotClassName:`bg-warning`}),t[34]=ve,t[35]=ye);let xe;t[36]===fe?xe=t[37]:(xe=(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:fe}),t[36]=fe,t[37]=xe);let Se;t[38]!==ye||t[39]!==xe?(Se=(0,Q.jsxs)(`div`,{className:`flex min-h-5 items-center gap-1.5`,children:[ye,xe]}),t[38]=ye,t[39]=xe,t[40]=Se):Se=t[40];let Ce;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Q.jsx)(`span`,{}),t[41]=Ce):Ce=t[41];let R;t[42]!==f||t[43]!==n.expiresAt?(R=pt(n.expiresAt,f),t[42]=f,t[43]=n.expiresAt,t[44]=R):R=t[44];let we;t[45]===R?we=t[46]:(we=(0,Q.jsx)(ht,{render:Ce,children:R}),t[45]=R,t[46]=we);let Te;t[47]===de?Te=t[48]:(Te=(0,Q.jsx)(gt,{side:`top`,children:de}),t[47]=de,t[48]=Te);let z;t[49]!==we||t[50]!==Te?(z=(0,Q.jsxs)(_t,{children:[we,Te]}),t[49]=we,t[50]=Te,t[51]=z):z=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 De;t[53]===n.scopes?De=t[54]:(De=(0,Q.jsx)(ci,{scopes:n.scopes,label:`Pairing link scopes`}),t[53]=n.scopes,t[54]=De);let Oe;t[55]!==z||t[56]!==De?(Oe=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[z,Ee,De]}),t[55]=z,t[56]=De,t[57]=Oe):Oe=t[57];let ke;t[58]!==r||t[59]!==j?(ke=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]=ke):ke=t[60];let Ae;t[61]!==Se||t[62]!==Oe||t[63]!==ke?(Ae=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[Se,Oe,ke]}),t[61]=Se,t[62]=Oe,t[63]=ke,t[64]=Ae):Ae=t[64];let je;t[65]!==g||t[66]!==b||t[67]!==j?(je=j&&ne?(0,Q.jsxs)(I,{size:`xs`,variant:`outline`,"aria-expanded":g,"aria-controls":b,onClick:()=>_($i),children:[(0,Q.jsx)(D,{"aria-hidden":!0}),`Share`]}):null,t[65]=g,t[66]=b,t[67]=j,t[68]=je):je=t[68];let Me=r!==void 0&&m,Ne;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=e=>{h(e),e||N(null)},t[69]=Ne):Ne=t[69];let Pe;t[70]!==r||t[71]!==le||t[72]!==j?(Pe=r?ne?j?null:(0,Q.jsx)(I,{size:`xs`,variant:`outline`,onClick:le,children:`Copy code`}):(0,Q.jsx)(wt,{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]=Pe):Pe=t[73];let Fe=F?ee?`Hosted app pairing link`:`Pairing link`:`Pairing code`,Ie;t[74]===Fe?Ie=t[75]:(Ie=(0,Q.jsx)(St,{children:Fe}),t[74]=Fe,t[75]=Ie);let Le=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.`,B;t[76]===Le?B=t[77]:(B=(0,Q.jsx)(Dt,{children:Le}),t[76]=Le,t[77]=B);let Re;t[78]!==Ie||t[79]!==B?(Re=(0,Q.jsxs)(xt,{children:[Ie,B]}),t[78]=Ie,t[79]=B,t[80]=Re):Re=t[80];let ze=F?4:3,Be;t[81]!==P||t[82]!==ze?(Be=(0,Q.jsx)(vt,{readOnly:!0,value:P,rows:ze,onFocus:ea,onClick:ta}),t[81]=P,t[82]=ze,t[83]=Be):Be=t[83];let Ve;t[84]!==te||t[85]!==F||t[86]!==P?(Ve=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)(Vn,{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]=Ve):Ve=t[87];let H;t[88]!==Be||t[89]!==Ve?(H=(0,Q.jsxs)(Et,{children:[Be,Ve]}),t[88]=Be,t[89]=Ve,t[90]=H):H=t[90];let He;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Q.jsx)(I,{variant:`outline`,onClick:()=>h(!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)(Ct,{variant:`bare`,children:[He,Ue]}),t[94]=Ue,t[95]=We);let U;t[96]!==Re||t[97]!==H||t[98]!==We?(U=(0,Q.jsxs)(Ot,{className:`max-w-md`,children:[Re,H,We]}),t[96]=Re,t[97]=H,t[98]=We,t[99]=U):U=t[99];let W;t[100]!==Me||t[101]!==Pe||t[102]!==U?(W=(0,Q.jsxs)(kt,{open:Me,onOpenChange:Ne,children:[Pe,U]}),t[100]=Me,t[101]=Pe,t[102]=U,t[103]=W):W=t[103];let Ge=!u||c===n.id,Ke;t[104]!==l||t[105]!==n.id?(Ke=()=>void l(n.id),t[104]=l,t[105]=n.id,t[106]=Ke):Ke=t[106];let qe=c===n.id?`Revoking…`:`Revoke`,Je;t[107]!==Ge||t[108]!==Ke||t[109]!==qe?(Je=(0,Q.jsx)(I,{size:`xs`,variant:`destructive-outline`,disabled:Ge,onClick:Ke,children:qe}),t[107]=Ge,t[108]=Ke,t[109]=qe,t[110]=Je):Je=t[110];let Ye;t[111]!==je||t[112]!==W||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:[je,W,Je]}),t[111]=je,t[112]=W,t[113]=Je,t[114]=Ye):Ye=t[114];let G;t[115]!==Ae||t[116]!==Ye?(G=(0,Q.jsxs)(`div`,{className:ir,children:[Ae,Ye]}),t[115]=Ae,t[116]=Ye,t[117]=G):G=t[117];let Ze=g&&me!==null,Qe;t[118]!==he||t[119]!==oe||t[120]!==k||t[121]!==le||t[122]!==me||t[123]!==b||t[124]!==L?.id?(Qe=me===null?null:(0,Q.jsxs)(`div`,{id:b,className:`mt-3 flex flex-col gap-4 border-t border-border/50 pt-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[k.length>1?(0,Q.jsxs)(`div`,{className:`space-y-1.5`,role:`radiogroup`,"aria-label":`Endpoint the pairing QR code and URL use`,children:[(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Reach this machine via`}),k.map(e=>{let t=e.id===L?.id;return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,className:be(`flex w-full items-baseline gap-2 rounded-lg border px-2.5 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,t?`border-foreground/60 bg-muted/30`:`border-border/50 hover:bg-muted/20`),onClick:()=>y(e.id),children:[(0,Q.jsx)(`span`,{className:be(`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)(_t,{children:[(0,Q.jsx)(ht,{render:(0,Q.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-2xs text-muted-foreground`,children:me})}),(0,Q.jsx)(gt,{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)(Vn,{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]=b,t[124]=L?.id,t[125]=Qe):Qe=t[125];let $e;t[126]===Qe?$e=t[127]:($e=(0,Q.jsx)(Jn,{children:Qe}),t[126]=Qe,t[127]=$e);let q;t[128]!==Ze||t[129]!==$e?(q=(0,Q.jsx)(or,{open:Ze,children:$e}),t[128]=Ze,t[129]=$e,t[130]=q):q=t[130];let et;return t[131]!==ge||t[132]!==G||t[133]!==q?(et=(0,Q.jsxs)(`div`,{className:ge,children:[G,q]}),t[131]=ge,t[132]=G,t[133]=q,t[134]=et):et=t[134],et}),Ai=(0,$.memo)(function(e){let t=(0,Z.c)(54),{clientSession:n,presentation:r,revokingClientSessionId:i,onRevokeSession:a,canRevoke:o}=e,s=r===void 0?`current`:r,c=fn(1e3),l=n.current||n.connected,u=n.lastConnectedAt,d;t[0]!==l||t[1]!==u||t[2]!==c?(d=l?u?`Connected for ${mt(u,c)}`:`Connected`:u?`Last connected at ${si(u)}`:`Not connected yet.`,t[0]=l,t[1]=u,t[2]=c,t[3]=d):d=t[3];let f=d,p;t[4]===n.client.deviceType?p=t[5]:(p=n.client.deviceType===`unknown`?null:n.client.deviceType[0]?.toUpperCase()+n.client.deviceType.slice(1),t[4]=n.client.deviceType,t[5]=p);let m=n.client.os??null,h=n.client.browser??null,g=n.client.ipAddress??null,_;t[6]!==p||t[7]!==m||t[8]!==h||t[9]!==g?(_=[p,m,h,g].filter(na),t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_):_=t[10];let v=_,y;t[11]!==n.client.browser||t[12]!==n.client.label||t[13]!==n.client.os||t[14]!==n.subject?(y=n.client.label??([n.client.os,n.client.browser].filter(Boolean).join(` · `)||n.subject),t[11]=n.client.browser,t[12]=n.client.label,t[13]=n.client.os,t[14]=n.subject,t[15]=y):y=t[15];let b=y,x;t[16]===s?x=t[17]:(x=hi(s),t[16]=s,t[17]=x);let S=l?`bg-success`:`bg-muted-foreground/30`,C=l?`bg-success/60 duration-2000`:null,w;t[18]!==f||t[19]!==S||t[20]!==C?(w=(0,Q.jsx)(X,{tooltipText:f,dotClassName:S,pingClassName:C}),t[18]=f,t[19]=S,t[20]=C,t[21]=w):w=t[21];let T;t[22]===b?T=t[23]:(T=(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:b}),t[22]=b,t[23]=T);let E;t[24]===n.current?E=t[25]:(E=n.current?(0,Q.jsx)(`span`,{className:`text-3xs text-muted-foreground/80 rounded-md border border-border/50 bg-muted/50 px-1 py-0.5`,children:`This device`}):null,t[24]=n.current,t[25]=E);let D;t[26]!==w||t[27]!==T||t[28]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex min-h-5 items-center gap-1.5`,children:[w,T,E]}),t[26]=w,t[27]=T,t[28]=E,t[29]=D):D=t[29];let O;t[30]===v?O=t[31]:(O=v.length>0?(0,Q.jsxs)(Q.Fragment,{children:[v.join(` · `),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:` · `})]}):null,t[30]=v,t[31]=O);let k;t[32]===n.scopes?k=t[33]:(k=(0,Q.jsx)(ci,{scopes:n.scopes,label:`Client scopes`}),t[32]=n.scopes,t[33]=k);let A;t[34]!==O||t[35]!==k?(A=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[O,k]}),t[34]=O,t[35]=k,t[36]=A):A=t[36];let j;t[37]!==D||t[38]!==A?(j=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[D,A]}),t[37]=D,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==o||t[41]!==n.current||t[42]!==n.sessionId||t[43]!==a||t[44]!==i?(M=n.current?null:(0,Q.jsx)(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:ir,children:[j,N]}),t[48]=j,t[49]=N,t[50]=P):P=t[50];let F;return t[51]!==P||t[52]!==x?(F=(0,Q.jsx)(`div`,{className:x,children:P}),t[51]=P,t[52]=x,t[53]=F):F=t[53],F}),ji=(0,$.memo)(function({onPairingLinkCreated:e,clientSessions:t,isRevokingOtherClients:n,onRevokeOtherClients:r,delegatableScopes:a}){let s=q(),[c,l]=(0,$.useState)(!1),[u,d]=(0,$.useState)(``),[f,p]=(0,$.useState)([...i]),m=f.filter(e=>a.includes(e)),[h,g]=(0,$.useState)(!1),v=(0,$.useCallback)(async()=>{if(s!==null&&m.length!==0&&lt(s,`access:write`)&&m.every(e=>lt(s,e))){g(!0);try{e(await xn({label:u,scopes:m})),d(``),p(i.filter(e=>a.includes(e))),l(!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)}}},[a,e,u,s,m]),y=(0,$.useCallback)((e,t)=>{p(n=>rr(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||!Un(t),onClick:()=>void r(),children:n?`Revoking…`:`Revoke others`}),(0,Q.jsxs)(kt,{open:c,onOpenChange:e=>{l(e),e||(d(``),p(i.filter(e=>a.includes(e))))},children:[(0,Q.jsx)(wt,{render:(0,Q.jsxs)(I,{size:`xs`,variant:`default`,children:[(0,Q.jsx)(Te,{className:`size-3`}),`Create link`]})}),(0,Q.jsxs)(Ot,{className:`max-w-md`,children:[(0,Q.jsxs)(xt,{children:[(0,Q.jsx)(St,{children:`Create pairing link`}),(0,Q.jsx)(Dt,{children:`Generate a one-time link that another device can use to pair with this backend as an authorized client.`})]}),(0,Q.jsxs)(Et,{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)(yt,{value:u,onChange:e=>d(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([o,Ce,se,_].filter(e=>a.includes(e))),children:`Read only`}),(0,Q.jsx)(I,{size:`xs`,variant:`outline`,disabled:h,onClick:()=>p(i.filter(e=>a.includes(e))),children:`Standard`})]})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-border/60 rounded-lg border border-input bg-muted/25`,children:cr.filter(({scope:e})=>a.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)(Wt,{className:`mt-0.5`,checked:f.includes(e),disabled:h,onCheckedChange:t=>y(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)(Ct,{variant:`bare`,children:[(0,Q.jsx)(I,{variant:`outline`,disabled:h,onClick:()=>l(!1),children:`Cancel`}),(0,Q.jsx)(I,{disabled:h||m.length===0,onClick:()=>void v(),children:h?`Creating…`:`Create link`})]})]})]})]})}),Mi=(0,$.memo)(function(e){let t=(0,Z.c)(39),{endpointUrl:n,endpoints:r,defaultEndpointKey:i,presentation:a,isLoading:o,pairingLinks:s,createdPairingCredentials:c,clientSessions:l,revokingPairingLinkId:u,revokingClientSessionId:d,onRevokePairingLink:f,onRevokeClientSession:p,canRevoke:m}=e,h=a===void 0?`current`:a,g;if(t[0]!==m||t[1]!==c||t[2]!==i||t[3]!==n||t[4]!==r||t[5]!==f||t[6]!==s||t[7]!==h||t[8]!==u){let e;t[10]!==m||t[11]!==c||t[12]!==i||t[13]!==n||t[14]!==r||t[15]!==f||t[16]!==h||t[17]!==u?(e=e=>(0,Q.jsx)(ki,{pairingLink:e,credential:c.get(e.id),endpointUrl:n,endpoints:r,defaultEndpointKey:i,presentation:h,revokingPairingLinkId:u,onRevoke:f,canRevoke:m},e.id),t[10]=m,t[11]=c,t[12]=i,t[13]=n,t[14]=r,t[15]=f,t[16]=h,t[17]=u,t[18]=e):e=t[18],g=s.map(e),t[0]=m,t[1]=c,t[2]=i,t[3]=n,t[4]=r,t[5]=f,t[6]=s,t[7]=h,t[8]=u,t[9]=g}else g=t[9];let _;if(t[19]!==m||t[20]!==l||t[21]!==p||t[22]!==h||t[23]!==d){let e;t[25]!==m||t[26]!==p||t[27]!==h||t[28]!==d?(e=e=>(0,Q.jsx)(Ai,{clientSession:e,presentation:h,revokingClientSessionId:d,onRevokeSession:p,canRevoke:m},e.sessionId),t[25]=m,t[26]=p,t[27]=h,t[28]=d,t[29]=e):e=t[29],_=l.map(e),t[19]=m,t[20]=l,t[21]=p,t[22]=h,t[23]=d,t[24]=_}else _=t[24];let v;t[30]!==l.length||t[31]!==o||t[32]!==s.length||t[33]!==h?(v=s.length===0&&l.length===0&&!o?(0,Q.jsx)(`div`,{className:hi(h),children:(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground/60`,children:`No pairing links or client sessions.`})}):null,t[30]=l.length,t[31]=o,t[32]=s.length,t[33]=h,t[34]=v):v=t[34];let y;return t[35]!==g||t[36]!==_||t[37]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[g,_,v]}),t[35]=g,t[36]=_,t[37]=v,t[38]=y):y=t[38],y}),Ni=(0,$.memo)(function(e){let t=(0,Z.c)(50),{endpoint:n,isDefault:r,presentation:i,onSetDefault:a,onSetupTailscaleServe:o,onDisableTailscaleServe:s,isUpdatingTailscaleServe:c}=e,l=i===void 0?`current`:i,u=n.status===`available`,d;t[0]===n?d=t[1]:(d=Ci(n)&&n.status!==`available`,t[0]=n,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=Ci(n)&&n.status===`available`,t[2]=n,t[3]=p);let m=p,h=!f,g=l===`endpoint-rail`,_;t[4]!==u||t[5]!==l?(_=gi(l,u),t[4]=u,t[5]=l,t[6]=_):_=t[6];let v;t[7]!==r||t[8]!==g?(v=g&&r?(0,Q.jsx)(`span`,{className:`absolute inset-y-2 left-0 w-1 rounded-r-full bg-primary`,"aria-hidden":!0}):null,t[7]=r,t[8]=g,t[9]=v):v=t[9];let y;t[10]===n.label?y=t[11]:(y=(0,Q.jsx)(`h3`,{className:`shrink-0 text-sm leading-5 font-medium text-foreground`,children:n.label}),t[10]=n.label,t[11]=y);let b;t[12]!==n.httpBaseUrl||t[13]!==h?(b=h?(0,Q.jsxs)(_t,{children:[(0,Q.jsx)(ht,{render:(0,Q.jsx)(`p`,{className:`min-w-0 truncate text-xs leading-5 text-muted-foreground`,children:n.httpBaseUrl})}),(0,Q.jsx)(gt,{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 Pi(e){let t=(0,Z.c)(14),{endpoint:n,hiddenEndpointCount:r,expanded:i,onToggleExpanded:a,fallback:o}=e;if(!n)return o;let s;t[0]===n.httpBaseUrl?s=t[1]:(s=(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:n.httpBaseUrl}),t[0]=n.httpBaseUrl,t[1]=s);let c;t[2]!==i||t[3]!==r?(c=r>0?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:i?`Hide`:`+${r}`}):null,t[2]=i,t[3]=r,t[4]=c):c=t[4];let l;t[5]!==s||t[6]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[s,c]}),t[5]=s,t[6]=c,t[7]=l):l=t[7];let u=l,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(`span`,{className:`shrink-0`,children:`Reachable at`}),t[8]=d):d=t[8];let f;return t[9]!==i||t[10]!==r||t[11]!==a||t[12]!==u?(f=(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-baseline gap-1`,children:[d,r>0?(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex min-w-0 max-w-full items-baseline gap-2 border-b border-dotted border-muted-foreground/60 text-left text-muted-foreground underline-offset-4 hover:border-foreground hover:text-foreground`,onClick:a,"aria-expanded":i,children:u}):(0,Q.jsx)(`span`,{className:`inline-flex min-w-0 max-w-full items-baseline gap-2`,children:u})]}),t[9]=i,t[10]=r,t[11]=a,t[12]=u,t[13]=f):f=t[13],f}function Fi(e){if(!e.entry.enabled&&e.connection.phase!==`unsupported`)return{text:`Off`,tone:`muted`};let{connection:t}=e;switch(t.phase){case`connected`:return{text:`Connected`,tone:`muted`};case`connecting`:return{text:`Connecting`,tone:`muted`};case`reconnecting`:return{text:t.error?`Reconnecting: ${t.error}`:`Reconnecting`,tone:`error`};case`unsupported`:return{text:`Client not supported`,tone:`muted`};case`error`:return{text:t.error?`Connection failed: ${t.error}`:`Connection failed`,tone:`error`};case`offline`:return{text:`Offline`,tone:`muted`};case`available`:return{text:`Not connected`,tone:`muted`}}}function Ii(e){let t=(0,Z.c)(161),{environment:i,removingEnvironmentId:a,onSetEnabled:o,onRemove:c,onAddRoute:l}=e,[d,f]=(0,$.useState)(!1),[p,m]=(0,$.useState)(!1),h=i.environmentId,g=i.connection.phase===`unsupported`,_=i.entry.enabled&&!g,v=i.connection.phase===`connected`,y=a===h,b=i.connection.traceId,S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S={target:`trace ID`,onCopy:Wi,onError:Ui},t[0]=S):S=t[0];let{copyToClipboard:w}=Xe(S),T;t[1]===w?T=t[2]:(T=e=>{w(e,{traceId:e})},t[1]=w,t[2]=T);let E=T,D;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D={target:`MCP URL`,onCopy:Hi,onError:Vi},t[3]=D):D=t[3];let{copyToClipboard:O}=Xe(D),k;t[4]===i.serverConfig?k=t[5]:(k=Bn(i.serverConfig),t[4]=i.serverConfig,t[5]=k);let M=k,N;t[6]===h?N=t[7]:(N=it.updateStateAtom(h),t[6]=h,t[7]=N);let F=r(N),ee=F.status===`running`&&F.stage===`resuming`,ne;t[8]===i?ne=t[9]:(ne=Fi(i),t[8]=i,t[9]=ne);let re=ne,ie=i.serverConfig?.environment.serverVersion??null,ae=Ze(),oe;t[10]!==h||t[11]!==ae.environments?(oe=x(ae.environments.get(h)?.status??u())?.descriptor,t[10]=h,t[11]=ae.environments,t[12]=oe):oe=t[12];let se=oe,[ce,le]=(0,$.useState)(se);se!==void 0&&se!==ce&&le(se);let ue;t[13]!==h||t[14]!==ae.environments?(ue=ae.environments.get(h)?.environment.endpoint.httpBaseUrl,t[13]=h,t[14]=ae.environments,t[15]=ue):ue=t[15];let de=ue,[fe,pe]=(0,$.useState)(de);de!==void 0&&de!==fe&&pe(de);let L=ut(h),me=v&&L._tag===`Some`?L.value.target:null,he=de??fe,ve;t[16]!==me||t[17]!==i.entry||t[18]!==he?(ve=Ue({entry:i.entry,relayHttpBaseUrl:he,connectedTarget:me}),t[16]=me,t[17]=i.entry,t[18]=he,t[19]=ve):ve=t[19];let ye=ve,xe;t[20]!==i.serverConfig||t[21]!==ce?(xe=i.serverConfig??(ce===void 0?null:{environment:ce}),t[20]=i.serverConfig,t[21]=ce,t[22]=xe):xe=t[22];let Se;t[23]===xe?Se=t[24]:(Se=C(xe),t[23]=xe,t[24]=Se);let Ce=Se,R;t[25]===i.entry?R=t[26]:(R=Fe(i.entry),t[25]=i.entry,t[26]=R);let we=R.length,Te;t[27]!==me||t[28]!==i?(Te=xr(i,me),t[27]=me,t[28]=i,t[29]=Te):Te=t[29];let z=ee?`Restarting`:re.text,Ee=_&&M?ie:null,De;t[30]!==Te||t[31]!==z||t[32]!==Ee?(De=[Te,z,Ee].filter(Bi),t[30]=Te,t[31]=z,t[32]=Ee,t[33]=De):De=t[33];let Oe=De.join(` · `),ke=_&&v&&M!==null&&(F.status===`idle`||F.status===`failed`),Ae;t[34]!==_||t[35]!==i.connection||t[36]!==g?(Ae=g?i.connection.error??ze(i.connection):_?ze(i.connection):`Switched off`,t[34]=_,t[35]=i.connection,t[36]=g,t[37]=Ae):Ae=t[37];let je=`${Ae}${M?`\nUpdate available: ${M.serverVersion} → ${M.clientVersion}`:``}`,Me=i.label,Ne=!_,Pe=_&&re.tone===`error`&&!ee&&`text-destructive`,Ie;t[38]===Pe?Ie=t[39]:(Ie=be(`min-w-0 truncate`,Pe),t[38]=Pe,t[39]=Ie);let Le;t[40]===Ie?Le=t[41]:(Le=(0,Q.jsx)(`span`,{className:Ie}),t[40]=Ie,t[41]=Le);let B;t[42]!==je||t[43]!==Oe||t[44]!==Le?(B=(0,Q.jsx)(ht,{payload:je,render:Le,children:Oe}),t[42]=je,t[43]=Oe,t[44]=Le,t[45]=B):B=t[45];let Re;t[46]===je?Re=t[47]:(Re=(0,Q.jsx)(gt,{side:`top`,className:`whitespace-pre-wrap`,children:je}),t[46]=je,t[47]=Re);let V;t[48]!==B||t[49]!==Re?(V=(0,Q.jsxs)(_t,{children:[B,Re]}),t[48]=B,t[49]=Re,t[50]=V):V=t[50];let Be;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0`,children:`·`}),t[51]=Be):Be=t[51];let H;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>f(zi),t[52]=H):H=t[52];let He=we===1?`Routes`:`${we} routes`,We=d&&`rotate-90`,U;t[53]===We?U=t[54]:(U=be(`size-3 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,We),t[53]=We,t[54]=U);let W;t[55]===U?W=t[56]:(W=(0,Q.jsx)(s,{"aria-hidden":!0,className:U}),t[55]=U,t[56]=W);let Ge;t[57]!==d||t[58]!==He||t[59]!==W?(Ge=(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":d,onClick:H,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:[He,W]}),t[57]=d,t[58]=He,t[59]=W,t[60]=Ge):Ge=t[60];let Ke;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0`,children:`·`}),t[61]=Ke):Ke=t[61];let qe=`remote-permissions-${h}`,Je;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Je=()=>m(Ri),t[62]=Je):Je=t[62];let Ye=p&&`rotate-90`,G;t[63]===Ye?G=t[64]:(G=be(`size-3 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,Ye),t[63]=Ye,t[64]=G);let K;t[65]===G?K=t[66]:(K=(0,Q.jsx)(s,{"aria-hidden":!0,className:G}),t[65]=G,t[66]=K);let Qe;t[67]!==p||t[68]!==qe||t[69]!==K?(Qe=(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":p,"aria-controls":qe,onClick:Je,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`,K]}),t[67]=p,t[68]=qe,t[69]=K,t[70]=Qe):Qe=t[70];let $e;t[71]!==V||t[72]!==Ge||t[73]!==Qe?($e=(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[V,Be,Ge,Ke,Qe]}),t[71]=V,t[72]=Ge,t[73]=Qe,t[74]=$e):$e=t[74];let q;t[75]===F?q=t[76]:(q=F.status===`idle`?null:(0,Q.jsx)(`div`,{className:`mt-1 max-w-md`,children:(0,Q.jsx)(nr,{state:F})}),t[75]=F,t[76]=q);let et;t[77]!==i||t[78]!==l||t[79]!==d?(et=d&&(0,Q.jsx)(gr,{environment:i,onAddRoute:()=>l(i)}),t[77]=i,t[78]=l,t[79]=d,t[80]=et):et=t[80];let tt;t[81]!==h||t[82]!==v||t[83]!==p?(tt=p&&(0,Q.jsx)(`div`,{id:`remote-permissions-${h}`,className:`mt-2 border-t border-border/50`,children:(0,Q.jsx)(lr,{environmentId:h,connected:v,routeContext:!0})}),t[81]=h,t[82]=v,t[83]=p,t[84]=tt):tt=t[84];let nt;t[85]!==et||t[86]!==tt?(nt=(0,Q.jsxs)(Q.Fragment,{children:[et,tt]}),t[85]=et,t[86]=tt,t[87]=nt):nt=t[87];let rt;t[88]!==i.entry.serverUpdateRequired||t[89]!==i.label||t[90]!==h||t[91]!==ce?.serverVersion||t[92]!==F.status||t[93]!==g?(rt=g&&i.entry.serverUpdateRequired===!0&&F.status!==`running`?(0,Q.jsx)(Yn,{environmentId:h,serverLabel:`${i.label} server`,fromVersion:ce?.serverVersion,targetVersion:Ve,label:F.status===`failed`?`Retry update`:`Update`}):null,t[88]=i.entry.serverUpdateRequired,t[89]=i.label,t[90]=h,t[91]=ce?.serverVersion,t[92]=F.status,t[93]=g,t[94]=rt):rt=t[94];let J;t[95]!==i.label||t[96]!==i.serverConfig||t[97]!==h||t[98]!==F.status||t[99]!==ke||t[100]!==M?(J=ke?(0,Q.jsx)(Xn,{environmentId:h,serverLabel:`${i.label} server`,selfUpdate:On(i.serverConfig),installation:i.serverConfig?.environment.capabilities.serverInstallation,desktopAppUpdate:Hn(i.serverConfig),threadContinuation:An(i.serverConfig),targetVersion:M.clientVersion,label:F.status===`failed`?`Retry update`:`Update`,appearance:`icon`}):null,t[95]=i.label,t[96]=i.serverConfig,t[97]=h,t[98]=F.status,t[99]=ke,t[100]=M,t[101]=J):J=t[101];let at=y||g,ot=`${_?`Switch off`:`Switch on`} ${i.label}`,st;t[102]!==h||t[103]!==o?(st=e=>o(h,e),t[102]=h,t[103]=o,t[104]=st):st=t[104];let ct;t[105]!==_||t[106]!==at||t[107]!==ot||t[108]!==st?(ct=(0,Q.jsx)(ht,{render:(0,Q.jsx)(tr,{size:`sm`,checked:_,disabled:at,"aria-label":ot,onCheckedChange:st})}),t[105]=_,t[106]=at,t[107]=ot,t[108]=st,t[109]=ct):ct=t[109];let lt=g?`Client not supported`:_?`Switch off`:`Switch on`,dt;t[110]===lt?dt=t[111]:(dt=(0,Q.jsx)(gt,{side:`top`,children:lt}),t[110]=lt,t[111]=dt);let ft;t[112]!==ct||t[113]!==dt?(ft=(0,Q.jsxs)(_t,{children:[ct,dt]}),t[112]=ct,t[113]=dt,t[114]=ft):ft=t[114];let Y=`More actions for ${i.label}`,pt;t[115]!==y||t[116]!==Y?(pt=(0,Q.jsx)(I,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,disabled:y,"aria-label":Y}),t[115]=y,t[116]=Y,t[117]=pt):pt=t[117];let mt;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,Q.jsx)(A,{className:`size-3.5`}),t[118]=mt):mt=t[118];let vt;t[119]===pt?vt=t[120]:(vt=(0,Q.jsx)(te,{render:pt,children:mt}),t[119]=pt,t[120]=vt);let yt;t[121]!==i.serverConfig||t[122]!==h?(yt=(0,Q.jsx)(hr,{environmentId:h,serverConfig:i.serverConfig}),t[121]=i.serverConfig,t[122]=h,t[123]=yt):yt=t[123];let bt,xt;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(bt=()=>f(Li),xt=(0,Q.jsx)(j,{}),t[124]=bt,t[125]=xt):(bt=t[124],xt=t[125]);let St=d?`Hide routes`:`Routes`,Ct;t[126]===St?Ct=t[127]:(Ct=(0,Q.jsxs)(P,{onClick:bt,children:[xt,St]}),t[126]=St,t[127]=Ct);let wt;t[128]!==O||t[129]!==ye?(wt=ye?(0,Q.jsx)(P,{onClick:()=>O(ye,{url:ye}),children:`Copy MCP URL`}):null,t[128]=O,t[129]=ye,t[130]=wt):wt=t[130];let Tt;t[131]!==E||t[132]!==b?(Tt=b?(0,Q.jsx)(P,{onClick:()=>E(b),children:`Copy trace ID`}):null,t[131]=E,t[132]=b,t[133]=Tt):Tt=t[133];let Et;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(Et=(0,Q.jsx)(_e,{}),t[134]=Et):Et=t[134];let Dt;t[135]!==i||t[136]!==c?(Dt=()=>c(i),t[135]=i,t[136]=c,t[137]=Dt):Dt=t[137];let Ot=y?`Removing…`:`Remove from this device…`,kt;t[138]!==Dt||t[139]!==Ot?(kt=(0,Q.jsx)(P,{variant:`destructive`,onClick:Dt,children:Ot}),t[138]=Dt,t[139]=Ot,t[140]=kt):kt=t[140];let At;t[141]!==yt||t[142]!==Ct||t[143]!==wt||t[144]!==Tt||t[145]!==kt?(At=(0,Q.jsxs)(n,{align:`end`,children:[yt,Ct,wt,Tt,Et,kt]}),t[141]=yt,t[142]=Ct,t[143]=wt,t[144]=Tt,t[145]=kt,t[146]=At):At=t[146];let jt;t[147]!==vt||t[148]!==At?(jt=(0,Q.jsxs)(ge,{children:[vt,At]}),t[147]=vt,t[148]=At,t[149]=jt):jt=t[149];let Mt;return t[150]!==i.label||t[151]!==Ce||t[152]!==Ne||t[153]!==$e||t[154]!==q||t[155]!==nt||t[156]!==rt||t[157]!==J||t[158]!==ft||t[159]!==jt?(Mt=(0,Q.jsxs)(Sr,{kind:Ce,label:Me,dimmed:Ne,subtitle:$e,below:q,detail:nt,children:[rt,J,ft,jt]}),t[150]=i.label,t[151]=Ce,t[152]=Ne,t[153]=$e,t[154]=q,t[155]=nt,t[156]=rt,t[157]=J,t[158]=ft,t[159]=jt,t[160]=Mt):Mt=t[160],Mt}function Li(e){return!e}function Ri(e){return!e}function zi(e){return!e}function Bi(e){return e!==null}function Vi(e){K.add(Y({type:`error`,title:`Could not copy MCP URL`,description:e.message}))}function Hi(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 Ui(e){K.add(Y({type:`error`,title:`Could not copy trace ID`,description:e.message}))}function Wi(e){let{traceId:t}=e;K.add({type:`success`,title:`Trace ID copied`,description:t})}function Gi(e){let t=(0,Z.c)(10),{checked:n,disabled:r,disabledReason:i,onCheckedChange:a,ariaLabel:o}=e,s=o===void 0?`Enable P4 Connect`:o,c;t[0]===a?c=t[1]:(c=a?{onCheckedChange:a}:{},t[0]=a,t[1]=c);let l;t[2]!==s||t[3]!==n||t[4]!==r||t[5]!==c?(l=(0,Q.jsx)(tr,{"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)(_t,{children:[(0,Q.jsx)(ht,{render:(0,Q.jsx)(`span`,{className:`inline-flex`,children:u})}),(0,Q.jsx)(gt,{side:`top`,children:i})]}):u,t[7]=u,t[8]=i,t[9]=d):d=t[9],d}function Ki(e){let t=(0,Z.c)(44),{canManageRelay:n}=e,r=q(),{isSignedIn:i,linkState:a,linkRevoked:o,managedTunnelActive:s,managedTunnelOutOfSync:c,publishAgentActivity:l,holdWebhooksWhileOffline:u,operationError:d,reconcileCloudState:f}=Pn(),[p,m]=(0,$.useState)(!1),[h,g]=(0,$.useState)(!1),_=i?n?null:`Your session does not have permission to manage P4 Connect access.`:`Sign in to P4 Connect to manage this environment.`,v=p||h,y;t[0]!==r||t[1]!==l||t[2]!==f?(y=async e=>{r!==null&&lt(r,`relay:write`)&&(m(!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.`}),m(!1))},t[0]=r,t[1]=l,t[2]=f,t[3]=y):y=t[3];let b=y,x;t[4]!==s||t[5]!==r||t[6]!==f?(x=async e=>{r!==null&&lt(r,`relay:write`)&&(g(!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.`}),g(!1))},t[4]=s,t[5]=r,t[6]=f,t[7]=x):x=t[7];let S=x,C;t[8]!==s||t[9]!==l||t[10]!==f?(C=async e=>{g(!0),await f({managedTunnel:s,publish:l,holdWebhooksWhileOffline:e})&&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.`}),g(!1)},t[8]=s,t[9]=l,t[10]=f,t[11]=C):C=t[11];let w=C,T;t[12]!==n||t[13]!==_||t[14]!==v||t[15]!==i||t[16]!==o||t[17]!==s||t[18]!==c||t[19]!==d||t[20]!==a||t[21]!==b?(T=window.desktopBridge?(0,Q.jsx)(ln,{title:ar(`p4-connect`).title,description:o?`This environment was removed from P4 Connect. Turn it on to link it again.`:s?`This environment is available to your other devices through P4 Connect.`:c?`P4 Connect is out of sync. This environment is linked only to publish agent activity, so other devices cannot connect. Turn P4 Connect on to repair it.`:`Make this environment available to your other devices through P4 Connect.`,status:d??a.error,control:(0,Q.jsx)(Gi,{checked:s,disabled:!n||!i||a.data===null||a.isPending||v,disabledReason:_,onCheckedChange:e=>void b(e)})}):o?(0,Q.jsx)(ln,{title:ar(`p4-connect`).title,description:"This environment was removed from P4 Connect. Run `p4c connect link` on the host to link it again."}):null,t[12]=n,t[13]=_,t[14]=v,t[15]=i,t[16]=o,t[17]=s,t[18]=c,t[19]=d,t[20]=a,t[21]=b,t[22]=T):T=t[22];let E;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(E=ar(`publish-agent-activity`),t[23]=E):E=t[23];let D=!n||!i||a.data===null||a.isPending||v,O;t[24]===S?O=t[25]:(O=e=>void S(e),t[24]=S,t[25]=O);let k;t[26]!==_||t[27]!==l||t[28]!==D||t[29]!==O?(k=(0,Q.jsx)(ln,{title:E.title,description:`Send activity to mobile notifications and Live Activities without P4 Connect.`,control:(0,Q.jsx)(Gi,{ariaLabel:`Publish agent activity to mobile clients`,checked:l,disabled:D,disabledReason:_,onCheckedChange:O})}),t[26]=_,t[27]=l,t[28]=D,t[29]=O,t[30]=k):k=t[30];let A;t[31]!==n||t[32]!==_||t[33]!==u||t[34]!==v||t[35]!==i||t[36]!==s||t[37]!==a||t[38]!==w?(A=s?(0,Q.jsx)(ln,{title:ar(`hold-webhooks-while-offline`).title,description:`Keep webhook requests for up to 24 hours while this environment is offline, then deliver them. Off: P4 Connect only forwards requests and stores nothing.`,control:(0,Q.jsx)(Gi,{ariaLabel:`Hold webhook requests while this environment is offline`,checked:u,disabled:!n||!i||a.isPending||v,disabledReason:_,onCheckedChange:e=>void w(e)})}):null,t[31]=n,t[32]=_,t[33]=u,t[34]=v,t[35]=i,t[36]=s,t[37]=a,t[38]=w,t[39]=A):A=t[39];let j;return t[40]!==T||t[41]!==k||t[42]!==A?(j=(0,Q.jsxs)(Q.Fragment,{children:[T,k,A]}),t[40]=T,t[41]=k,t[42]=A,t[43]=j):j=t[43],j}function qi(e){let t=(0,Z.c)(3),{canReadRelay:n,canManageRelay:r}=e;if(!Ie())return null;if(!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(ln,{title:`P4 Connect`,description:`To edit these settings, pair this connection with both View relay and Manage relay permissions.`}),t[0]=e):e=t[0],e}let i;return t[1]===r?i=t[2]:(i=(0,Q.jsx)(Ki,{canManageRelay:r}),t[1]=r,t[2]=i),i}function Ji(e){let t=(0,Z.c)(4),{cloudEnabled:n}=e,r=n===void 0||n,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(jt,{variant:`icon`,children:(0,Q.jsx)(E,{})}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Nt,{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)(Ft,{className:`min-h-52`,children:[i,(0,Q.jsxs)(Mt,{children:[a,(0,Q.jsx)(Pt,{children:o})]})]}),t[2]=o,t[3]=s),s}function Yi(e){let t=(0,Z.c)(3),{primaryEnvironmentId:n,savedEnvironments:r}=e,i;return t[0]!==n||t[1]!==r?(i=Ie()?(0,Q.jsx)(Gn,{primaryEnvironmentId:n,savedEnvironments:r,empty:(0,Q.jsx)(Ji,{})}):r.length===0?(0,Q.jsx)(Ji,{cloudEnabled:!1}):null,t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function Xi(){let e=window.desktopBridge,t=r(ot),{environments:i}=$e(),a=Qe(),o=ft(En,{reportFailure:!1}),u=ft(Tn,{reportFailure:!1}),d=ft(at.remove,{reportFailure:!1}),f=ft(at.register,{reportFailure:!1}),p=Ze(),m=ft(at.setEnabled,{reportFailure:!1}),h=a?.environmentId??null,g=wn(),_=g.data?.authenticated?g.data.permissions??g.data.scopes??null:null,v=e?null:g.data?.auth.policy??null,y=(0,$.useMemo)(()=>i.filter(e=>e.entry.target._tag!==`PrimaryConnectionTarget`),[i]),b=(0,$.useMemo)(()=>y.filter(e=>!We(e.entry.target)),[y]),x=(0,$.useMemo)(()=>ve(e=>y.map(t=>({environment:t,updateStatus:e(it.updateStateAtom(t.environmentId)).status}))),[y]),S=r(x),T=(0,$.useMemo)(()=>S.flatMap(({environment:e,updateStatus:t})=>{let n=Bn(e.serverConfig),r=On(e.serverConfig),i=Hn(e.serverConfig);return!n||t===`running`||!e.entry.enabled||e.connection.phase!==`connected`||We(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:An(e.serverConfig),continueThreadsAfterServerUpdate:e.serverConfig?.settings.continueThreadsAfterServerUpdate??!1,targetVersion:n.clientVersion}]}),[S]),D=(0,$.useMemo)(()=>[...a?[a]:[],...y.filter(e=>e.entry.enabled)],[a,y]),k=(0,$.useMemo)(()=>{let e=new Set;for(let t of y){let n=t.entry.profile;if(t.entry.target._tag!==`SshConnectionTarget`||O(n)||n.value._tag!==`SshConnectionProfile`)continue;let r=n.value.target;e.add(r.alias),e.add(br(r))}return e},[y]),[j,M]=(0,$.useState)(null),[N,P]=(0,$.useState)(null),[ee,ne]=(0,$.useState)(()=>new Map),re=(0,$.useCallback)(e=>{ne(t=>new Map(t).set(e.id,e.credential))},[]),[ie,ae]=(0,$.useState)(null),[se,ce]=(0,$.useState)(null),[le,ue]=(0,$.useState)(!1),[de,pe]=(0,$.useState)(!1),[L,me]=(0,$.useState)(null),[he,_e]=(0,$.useState)(`remote`),[ye,xe]=(0,$.useState)(``),[Se,Ce]=(0,$.useState)(``),[R,we]=(0,$.useState)(``),[z,Ee]=(0,$.useState)(``),[De,Oe]=(0,$.useState)(``),[Ae,Me]=(0,$.useState)(!1),Pe=(0,$.useRef)(void 0),[Fe,B]=(0,$.useState)(null),[V,ze]=(0,$.useState)(!1),[Be,Ve]=(0,$.useState)(null),[H,He]=(0,$.useState)(!1),[Ue,U]=(0,$.useState)(!1),[W,Xe]=(0,$.useState)(!1),[q,et]=(0,$.useState)(!1),[tt,rt]=(0,$.useState)(null),[J,st]=(0,$.useState)(null),ut=J!==null,[pt,mt]=(0,$.useState)(null),[vt,At]=(0,$.useState)(!1),[jt,Mt]=(0,$.useState)(String(ti)),[Nt,Pt]=(0,$.useState)(null),Ft=a?.serverConfig??null,Vt=Bn(Ft),Ht=r(it.updateStateAtom(h)),[Ut,Wt]=(0,$.useState)(!1),Gt=en(e=>e.defaultAdvertisedEndpointKey),Kt=en(e=>e.setDefaultAdvertisedEndpointKey),qt=ct(h,oe),Jt=ct(h,fe),Yt=ct(h,l),Xt=ct(h,F),Zt=ct(h,c),Qt=!Re()&&Xt,$t=dt(qt&&h!==null?Br.accessChanges({environmentId:h,input:null}):null),tn=dt(Qt&&e?qr:null),nn=e!==void 0&&de&&he===`ssh`,rn=dt(nn?ei:null),on=rn.refresh;(0,$.useEffect)(()=>{nn&&on()},[nn,on]);let fn=dt(Qt&&e?Nn:null),X=fn.data,xn=tt??fn.error,Pn=fn.isPending&&fn.data===null,Fn=rn.data??ri,In=(0,$.useMemo)(()=>Fn.filter(e=>{let t=br(e);return!k.has(e.alias)&&!k.has(t)}),[Fn,k]),Vn=(0,$.useMemo)(()=>Yr(In,R),[R,In]),Un=rn.isPending&&rn.data===null,Wn=rn.error,Gn=e!==void 0&&(Un||In.length>0),qn=tn.data?.serverExposureState??null,Jn=tn.data?.advertisedEndpoints??ni,Yn=j??tn.error,Zn=N??$t.error,rr=$t.isPending&&$t.data===null,ir=(0,$.useMemo)(()=>{let e=$t.data;return e?.type===`snapshot`?_i(e.payload.pairingLinks.map(e=>bi(e))):[]},[$t.data]),or=(0,$.useMemo)(()=>{let e=$t.data;return e?.type===`snapshot`?yi(e.payload.clientSessions.map(e=>xi(e))):[]},[$t.data]),Z=e?qn?.mode===`network-accessible`:v===`remote-reachable`,cr=jt.trim(),ur=Number(cr),dr=/^\d+$/u.test(cr)&&Number.isInteger(ur)&&ur>=1&&ur<=65535,pr=(0,$.useMemo)(()=>{if(!pt)return null;if(!dr||ur===ti)return pt.httpBaseUrl;try{let e=new URL(pt.httpBaseUrl);return e.port=String(ur),e.toString().replace(/\/$/u,``)}catch{return pt.httpBaseUrl}},[dr,ur,pt]),mr=(0,$.useCallback)(async t=>{if(e&&h!==null&&lt(h,`environment:maintain`)){He(!0),M(null);try{await e.setServerExposureMode(t?`network-accessible`:`local-only`),Jr(),U(!1),He(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to update network exposure.`;U(!1),M(t),K.add(Y({type:`error`,title:`Could not update network access`,description:t})),He(!1)}}},[e,h]),gr=(0,$.useCallback)(()=>{Nt!==null&&mr(Nt===`network-accessible`)},[mr,Nt]),_r=(0,$.useCallback)(async()=>{if(e&&h!==null&&lt(h,`environment:maintain`)&&dr){Xe(!0),M(null);try{await e.setTailscaleServeEnabled({enabled:!0,port:ur}),Jr(),mt(null)}catch(e){let t=e instanceof Error?e.message:`Failed to configure Tailscale HTTPS.`;M(t),K.add(Y({type:`error`,title:`Could not set up Tailscale HTTPS`,description:t}))}finally{Xe(!1)}}},[e,dr,ur,h]),vr=(0,$.useCallback)(e=>{Mt(String(qn?.tailscaleServePort??ti)),mt(e)},[qn?.tailscaleServePort]),yr=(0,$.useCallback)(async()=>{if(e&&h!==null&&lt(h,`environment:maintain`)){Xe(!0),M(null);try{await e.setTailscaleServeEnabled({enabled:!1,port:qn?.tailscaleServePort??ti}),Jr(),At(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to disable Tailscale HTTPS.`;M(t),K.add(Y({type:`error`,title:`Could not disable Tailscale HTTPS`,description:t}))}finally{Xe(!1)}}},[e,qn,h]),xr=(0,$.useCallback)(e=>{At(!0)},[]),Sr=(0,$.useCallback)(async e=>{if(h!==null&&lt(h,`access:write`)){ae(e),P(null);try{await Cn(e)}catch(e){let t=e instanceof Error?e.message:`Failed to revoke pairing link.`;P(t),K.add(Y({type:`error`,title:`Could not revoke pairing link`,description:t}))}finally{ae(null)}}},[h]),Cr=(0,$.useCallback)(async e=>{if(h!==null&&lt(h,`access:write`)){ce(e),P(null);try{await Sn(e)}catch(e){let t=e instanceof Error?e.message:`Failed to revoke client access.`;P(t),K.add(Y({type:`error`,title:`Could not revoke client access`,description:t}))}finally{ce(null)}}},[h]),wr=(0,$.useCallback)(async()=>{if(h!==null&&lt(h,`access:write`)){ue(!0),P(null);try{let e=await bn();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.`;P(t),K.add(Y({type:`error`,title:`Could not revoke other clients`,description:t}))}finally{ue(!1)}}},[h]),Tr=(0,$.useCallback)(async e=>{ze(!0),B(null);let t=await u({target:e,label:``,...L?{expectedEnvironmentId:L.environmentId}:{}});if(t._tag===`Failure`){je(t)||B(pi(Ne(t))),ze(!1);return}xe(``),Ce(``),we(``),Ee(``),Oe(``),pe(!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.`}),ze(!1)},[u,L]),Er=(0,$.useCallback)(async()=>{if(he===`ssh`){let e;try{e=ui({host:R,username:z,port:De})}catch(e){B(pi(e));return}await Tr(e);return}ze(!0),B(null);let e;try{e=fi({host:ye,pairingCode:Se})}catch(e){let t=e instanceof Error?e.message:`Failed to add backend.`;B(t),K.add(Y({type:`error`,title:`Could not add backend`,description:t})),ze(!1);return}let t=await o({...e,...L?{expectedEnvironmentId:L.environmentId}:{}});if(t._tag===`Failure`){if(!je(t)){let e=Ne(t),n=e instanceof Error?e.message:`Failed to add backend.`;B(n),K.add(Y({type:`error`,title:`Could not add backend`,description:n}))}ze(!1);return}xe(``),Ce(``),we(``),Ee(``),Oe(``),pe(!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.`}),ze(!1)},[L,o,Tr,ye,he,Se,R,De,z]),Or=(0,$.useCallback)(e=>{e.nativeEvent.isComposing||e.keyCode===229||e.key===`Enter`&&R.trim().length>0&&(e.preventDefault(),Er())},[Er,R]),kr=(0,$.useCallback)(async t=>{if(V||!e)return;ze(!0),B(null),we(t.alias);let n;try{n=await e.resolveSshHost(t.alias)}catch(e){B(pi(e)),ze(!1);return}Ee(n.username??``),Oe(n.port===null?``:String(n.port)),await Tr(n)},[Tr,e,V]),Ar=(0,$.useCallback)(e=>{if(e.nativeEvent.isComposing||e.keyCode===229)return;let n=Ae&&Gn;if(n){let n=Rt(e,t,{platform:navigator.platform,context:{modelPickerOpen:!1}}),r=zt(n??``),i=r===null?void 0:Vn[r];if(i){e.preventDefault(),e.stopPropagation(),Me(!1),kr(i);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation();return}}let r=n&&Pe.current!==void 0;!e.defaultPrevented&&!r&&e.key===`Enter`&&R.trim().length>0&&(e.preventDefault(),Er())},[Vn,Er,kr,Gn,t,R,Ae]),jr=(0,$.useCallback)(async(e,t)=>{B(null);let n=await m({environmentId:e,enabled:t});if(n._tag===`Failure`&&!je(n)){let e=Ne(n),r=e instanceof Error?e.message:`Failed to switch the backend ${t?`on`:`off`}.`;B(r),K.add(Y({type:`error`,title:`Could not switch backend ${t?`on`:`off`}`,description:r}))}},[m]),Nr=(0,$.useCallback)(async e=>{let t=e.environmentId;Ve(t),B(null);let n=await d(t);if(Ve(null),n._tag===`Failure`&&!je(n)){let e=Ne(n),t=e instanceof Error?e.message:`Failed to remove backend.`;B(t),K.add(Y({type:`error`,title:`Could not remove backend`,description:t}))}},[d]),[Fr,Ir]=(0,$.useState)(null),Lr=(0,$.useCallback)(async e=>{if(e.relayManaged&&Ie()){Ir(e);return}await nt(`Remove ${e.label} from this device?\nThis forgets its pairing, credentials, and cached threads here. Switch it off instead to keep it saved.`,{variant:`destructive`})===!0&&await Nr(e)},[Nr]),Rr=ir,zr=(0,$.useMemo)(()=>Jn.find(Ci)??null,[Jn]),Vr=(0,$.useMemo)(()=>Z?Jn.filter(e=>!Ci(e)):[],[Jn,Z]),Hr=(0,$.useMemo)(()=>zr?[...Vr,zr]:Vr,[zr,Vr]),Ur=(0,$.useMemo)(()=>Si(Vr,Gt),[Gt,Vr]),Wr=(0,$.useMemo)(()=>Ur??Si(zr?[zr]:[],Gt),[Gt,Ur,zr]),Gr=Wr?wi(Wr):null,Kr=(0,$.useCallback)(e=>{Kt(wi(e))},[Kt]),Xr=(0,$.useCallback)(e=>{let t=di(e);if(t){xe(t.host),Ce(t.pairingCode);return}xe(e)},[]),Zr=e=>{let t=he===e.mode;return(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":t,className:be(`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:V,onClick:()=>{_e(e.mode)},children:[e.icon?(0,Q.jsx)(`span`,{className:be(`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md border`,t?`border-primary/30 bg-primary/10 text-primary`:`border-border/70 bg-background text-muted-foreground group-hover:text-foreground`),children:e.icon}):null,(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]})},Qr=()=>(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Host`}),(0,Q.jsx)(yt,{value:ye,onChange:e=>Xr(e.target.value),placeholder:`backend.example.com`,disabled:V,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)(yt,{value:Se,onChange:e=>Ce(e.target.value),placeholder:`PAIRCODE`,disabled:V,spellCheck:!1})]})]}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`span`,{className:`mt-1 block text-2xs text-muted-foreground`,children:`Paste a full pairing URL here to fill both fields automatically.`})})]}),$r=L!==null&&!L.relayManaged&&p.environments.has(L.environmentId)?p.environments.get(L.environmentId).environment:null,oi=async()=>{if($r===null||L===null)return;ze(!0);let e=await f(new Le({target:new ke({environmentId:$r.environmentId,label:L.label})}));if(ze(!1),e._tag===`Failure`){if(!je(e)){let t=Ne(e);B(t instanceof Error?t.message:`Could not add the route.`)}return}pe(!1),K.add({type:`success`,title:`Route added`,description:`${L.label} falls back to P4 Connect when its other routes are unreachable.`})},si=()=>(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[$r===null?null:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This machine is on your P4 Connect account. Use it as a fallback route.`}),(0,Q.jsx)(I,{size:`xs`,variant:`outline`,disabled:V,onClick:()=>void oi(),children:`Add P4 Connect`})]}),Qr(),Fe?(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:Fe}):null,(0,Q.jsxs)(I,{variant:`outline`,className:`w-full`,disabled:V,onClick:()=>void Er(),children:[(0,Q.jsx)(Te,{className:`size-3.5`}),V?`Adding…`:L?`Add route`:`Add environment`]})]}),ci=()=>(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`block`,children:[(0,Q.jsx)(`label`,{htmlFor:`saved-backend-ssh-host`,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`SSH host or alias`}),(0,Q.jsxs)(hn,{items:Vn,itemToStringValue:e=>e.alias,mode:`none`,openOnInputClick:!0,open:Ae,onOpenChange:Me,onItemHighlighted:e=>{Pe.current=e},value:R,onValueChange:(e,t)=>{if(we(e),t.reason!==`item-press`)return;let n=Vn.find(t=>t.alias===e);n&&kr(n)},children:[(0,Q.jsx)(_n,{id:`saved-backend-ssh-host`,onKeyDown:Ar,placeholder:`Search hosts or type devbox`,disabled:V,spellCheck:!1}),Gn?(0,Q.jsx)(vn,{children:Un?(0,Q.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:`Loading hosts…`}):Vn.length>0?(0,Q.jsx)(mn,{className:`max-h-72`,children:Vn.map((e,n)=>{let r=br(e),i=n<9?Lt(n):null,a=i?Bt(t,i,navigator.platform):null;return(0,Q.jsxs)(yn,{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)(gn,{className:`shrink-0`,children:a}):null]},`${e.alias}:${e.hostname}:${e.port??``}`)})}):(0,Q.jsxs)(pn,{className:`break-all`,children:[`No hosts match "`,R.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)(yt,{value:z,onChange:e=>Ee(e.target.value),onKeyDown:Or,placeholder:`root`,disabled:V,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)(yt,{value:De,onChange:e=>Oe(e.target.value),onKeyDown:Or,placeholder:`22`,inputMode:`numeric`,disabled:V,spellCheck:!1})]})]}),Fe||Wn?(0,Q.jsx)(cn,{variant:`error`,children:(0,Q.jsx)(sn,{children:Fe??Wn})}):null,(0,Q.jsxs)(I,{variant:`outline`,className:`w-full`,disabled:V,onClick:()=>void Er(),children:[(0,Q.jsx)(Te,{className:`size-3.5`}),V?`Adding…`:L?`Add route`:`Add environment`]})]})}),li=()=>(0,Q.jsx)(tr,{checked:qn?.mode===`network-accessible`,disabled:!qn||H,onCheckedChange:e=>{Pt(e?`network-accessible`:`local-only`),U(!0)},"aria-label":`Enable network access`}),mi=e=>Ut?Vr.map(t=>{let n=wi(t);return(0,Q.jsx)(Ni,{endpoint:t,isDefault:n===Gr,presentation:e,onSetDefault:Kr,onSetupTailscaleServe:vr,onDisableTailscaleServe:xr,isUpdatingTailscaleServe:W},t.id)}):null,gi=(0,$.useCallback)(async t=>{if(e&&h!==null&&lt(h,`environment:maintain`)){et(!0),rt(null);try{await t(),Kn()}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})),Kn()}finally{et(!1)}}},[e,h]),Ti=(0,$.useCallback)(()=>{rt(null),Kn()},[]),Ei=(0,$.useMemo)(()=>i.some(e=>We(e.entry.target)),[i]),Di=(0,$.useCallback)(t=>{if(!e||!X)return;let n=X.distros.find(e=>e.isDefault)?.name??null;if(t===ai){if(!X.enabled&&!X.wslOnly)return;let t=X.wslOnly;if(Ei||t){st({kind:`disable`,wasWslOnly:t});return}gi(()=>e.setWslBackendEnabled(!1));return}let r=t===ii?null:t,i=r??n;if(!X.enabled){st({kind:`enable`,nextDistro:r});return}if((X.distro??n)!==i){if(Ei||X.wslOnly){st({kind:`distro`,nextDistro:r});return}gi(()=>e.setWslDistro(r))}},[gi,e,X,Ei]),Oi=(0,$.useCallback)(t=>{if(!e||!J||J.kind!==`enable`)return;let n=J.nextDistro;st(null);let r=X?.distro??null;gi(()=>Mn({bridge:e,mode:t,nextDistro:n,persistedDistro:r}))},[gi,e,X,J]),ki=(0,$.useCallback)(t=>{e&&X&&X.wslOnly!==t&&st({kind:`wsl-only`,nextValue:t})},[e,X]),Ai=(0,$.useCallback)(()=>{if(!e||!J)return;let t=J;if(t.kind!==`enable`){if(st(null),t.kind===`disable`){gi(async()=>{let n=await e.setWslBackendEnabled(!1);return t.wasWslOnly?await e.setWslOnly(!1):n});return}if(t.kind===`distro`){gi(()=>e.setWslDistro(t.nextDistro));return}gi(()=>e.setWslOnly(t.nextValue))}},[gi,e,J]),Fi=()=>{if(!X)return jn({state:null,error:xn})&&Qt?(0,Q.jsx)(ln,{...ar(`wsl-backend`),description:`Couldn't load the WSL backend state.`,status:(0,Q.jsx)(`span`,{className:`block text-destructive`,children:xn}),control:(0,Q.jsx)(I,{size:`sm`,variant:`outline`,onClick:Ti,disabled:Pn,children:Pn?`Retrying…`:`Retry`})}):null;if(!jn({state:X,error:xn}))return null;if(!X.available)return(0,Q.jsx)(ln,{...ar(`wsl-backend`),description:`WSL is unavailable, so Windows is running instead. Turn WSL off to clear this preference.`,status:xn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:xn}):null,control:(0,Q.jsx)(I,{size:`sm`,variant:`outline`,disabled:q,onClick:()=>Di(ai),children:`Switch to Windows`})});let e=X.distros.find(e=>e.isDefault)?.name??null,t=X.enabled?X.distro??e??ii:ai,n=t===ai?`Off`:t===ii?`Default distro`:t;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ln,{...ar(`wsl-backend`),description:`Run the selected WSL distro alongside Windows. Projects remain on their current filesystem.`,status:xn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:xn}):X.preflightError?(0,Q.jsxs)(`span`,{className:`block text-destructive`,children:[`WSL backend couldn't start: `,X.preflightError]}):null,control:(0,Q.jsxs)(Ye,{value:t,onValueChange:e=>{typeof e==`string`&&Di(e)},children:[(0,Q.jsx)(Je,{size:`sm`,className:`w-full sm:w-56`,"aria-label":`WSL backend`,disabled:q,children:(0,Q.jsx)(Ke,{children:n})}),(0,Q.jsxs)(qe,{align:`end`,alignItemWithTrigger:!1,children:[(0,Q.jsx)(Ge,{hideIndicator:!0,value:ai,children:`Off`}),X.distros.length===0?(0,Q.jsx)(Ge,{hideIndicator:!0,value:ii,children:`Default distro`}):X.distros.map(e=>(0,Q.jsxs)(Ge,{hideIndicator:!0,value:e.name,children:[e.name,e.isDefault?` (default)`:``]},e.name))]})]})}),X.enabled?(0,Q.jsx)(ln,{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)(tr,{checked:X.wslOnly,disabled:q,onCheckedChange:e=>ki(e),"aria-label":`Run WSL only`})}):null]})},Li=()=>(0,Q.jsx)(ln,{title:ar(`tailscale-https`).title,description:zr?zr.status===`available`?zr.httpBaseUrl:`Use Tailscale Serve to expose this backend through a MagicDNS HTTPS URL.`:`Start Tailscale to set up HTTPS access through MagicDNS.`,control:zr?(0,Q.jsx)(tr,{checked:zr.status===`available`,disabled:W,onCheckedChange:e=>{if(e){vr(zr);return}xr(zr)},"aria-label":`Enable Tailscale HTTPS`}):null}),Ri=e=>(0,Q.jsxs)(Q.Fragment,{children:[Zn?(0,Q.jsx)(`div`,{className:hi(e),children:(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:Zn})}):null,(0,Q.jsx)(Mi,{endpointUrl:qn?.endpointUrl,endpoints:Hr,defaultEndpointKey:Gr,presentation:e,isLoading:rr,pairingLinks:Rr,createdPairingCredentials:ee,clientSessions:or,revokingPairingLinkId:ie,revokingClientSessionId:se,onRevokePairingLink:Sr,onRevokeClientSession:Cr,canRevoke:Jt})]}),zi=()=>(0,Q.jsx)(ln,{title:ar(`network-access`).title,description:Z?(0,Q.jsx)(Pi,{endpoint:Ur,hiddenEndpointCount:Math.max(Vr.length-1,0),expanded:Ut,onToggleExpanded:()=>Wt(e=>!e),fallback:qn?.endpointUrl?`Reachable at ${qn.endpointUrl}`:qn?.advertisedHost?`Exposed on all interfaces. Pairing links use ${qn.advertisedHost}.`:`Exposed on all interfaces.`}):qn?`Limited to this machine.`:`Loading…`,status:Yn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:Yn}):null,control:li()}),Bi=()=>(0,Q.jsx)(ln,{title:ar(`network-access`).title,description:e?`This connection cannot view or change network exposure.`:v===`remote-reachable`?`Remote access is already configured. Change network exposure where the server starts.`:v===`loopback-browser`?`Only this machine can connect. Restart with a non-loopback host for remote pairing.`:`Network exposure information is unavailable.`,control:!e&&(v===`remote-reachable`||v===`loopback-browser`)?(0,Q.jsxs)(_t,{children:[(0,Q.jsx)(ht,{render:(0,Q.jsx)(`span`,{className:`inline-flex`,children:(0,Q.jsx)(tr,{checked:Z,disabled:!0,"aria-label":`Enable network access`})})}),(0,Q.jsx)(gt,{side:`top`,children:`Network exposure changes restart the backend and must be controlled where the server process is launched.`})]}):void 0}),Vi=(0,Q.jsx)(Q.Fragment,{children:h===null?(0,Q.jsxs)(dn,{...ar(`connections-environment`),children:[(0,Q.jsx)(ln,{title:`No environment selected`,description:`Connect an environment to view its settings and access.`}),(0,Q.jsx)(fr,{}),Yt||Zt?(0,Q.jsx)(qi,{canReadRelay:Yt,canManageRelay:Zt}):null]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(dn,{...ar(`connections-environment`),title:a?.label??(e?`This machine`:`Primary environment`),icon:(0,Q.jsx)(an,{"aria-hidden":!0,kind:Ft?C(Ft):`desktop`,className:`size-4`}),headerAction:h===null?null:(0,Q.jsxs)(ge,{children:[(0,Q.jsx)(te,{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)(n,{align:`end`,children:(0,Q.jsx)(hr,{environmentId:h,serverConfig:Ft})})]}),children:[(0,Q.jsx)(fr,{}),Qt?(0,Q.jsx)(ln,{title:`Version`,description:Ht.status===`idle`?[Ft?.environment.serverVersion??null,a?.displayUrl??null].filter(e=>e!==null).join(` · `)||`Loading…`:(0,Q.jsx)(nr,{state:Ht}),control:Vt&&h!==null&&Ht.status!==`running`?(0,Q.jsx)(Xn,{size:`sm`,environmentId:h,serverLabel:a?`${a.label} server`:`server`,selfUpdate:On(Ft),installation:Ft?.environment.capabilities.serverInstallation,desktopAppUpdate:Hn(Ft),threadContinuation:An(Ft),targetVersion:Vt.clientVersion,label:Ht.status===`failed`?`Retry update`:`Update to ${Vt.clientVersion}`}):Ht.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:[zi(),mi(`endpoint-rail`),Li(),Fi(),Yt||Zt?(0,Q.jsx)(qi,{canReadRelay:Yt,canManageRelay:Zt}):null]}):Qt?(0,Q.jsxs)(Q.Fragment,{children:[Bi(),Yt||Zt?(0,Q.jsx)(qi,{canReadRelay:Yt,canManageRelay:Zt}):null]}):null,a?(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)(s,{"aria-hidden":!0,className:`size-3 text-muted-foreground group-open:rotate-90`})]}),(0,Q.jsx)(lr,{environmentId:a.environmentId,connected:a.connection.phase===`connected`})]}):null]}),qt||Jt?(0,Q.jsx)(sr,{id:`authorized-clients`,title:`Authorized clients`,summary:vi(or,Rr),control:Jt?(0,Q.jsx)(ji,{delegatableScopes:_??[],onPairingLinkCreated:re,clientSessions:qt&&$t.error===null&&$t.data?.type===`snapshot`?or:null,isRevokingOtherClients:le,onRevokeOtherClients:wr}):void 0,children:(0,Q.jsx)(bt,{scrollFade:!0,chainVerticalScroll:!0,className:`max-h-[22.5rem]`,"data-testid":`authorized-clients-scroll-area`,children:qt?Ri(`current`):(0,Q.jsx)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:`This connection can create access links but cannot view authorized clients.`})})}):null,(0,Q.jsx)(kn,{open:Ue&&Qt,onOpenChange:e=>{H||U(e)},onOpenChangeComplete:e=>{e||Pt(null)},children:(0,Q.jsxs)(Ln,{children:[(0,Q.jsxs)(Qn,{children:[(0,Q.jsx)(Rn,{children:Nt===`network-accessible`?`Enable network access?`:`Disable network access?`}),(0,Q.jsx)($n,{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)(Dn,{children:[(0,Q.jsx)(zn,{disabled:H,render:(0,Q.jsx)(I,{variant:`outline`,disabled:H}),children:(0,Q.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:`Cancel`})}),(0,Q.jsxs)(I,{variant:`default`,onClick:gr,disabled:!Qt||Nt===null||H,children:[H&&(0,Q.jsx)(G,{size:`sm`}),(0,Q.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:H?`Restarting…`:Nt===`network-accessible`?`Restart and enable`:`Restart and disable`})]})]})]})}),(0,Q.jsx)(kn,{open:ut&&Qt,onOpenChange:e=>{q||e||st(null)},children:(0,Q.jsxs)(Ln,{children:[(0,Q.jsxs)(Qn,{children:[(0,Q.jsx)(Rn,{children:J?.kind===`disable`?J.wasWslOnly?`Turn off WSL and switch back to Windows?`:`Disable WSL backend?`:J?.kind===`distro`?`Switch WSL distro?`:J?.kind===`enable`?`Start the WSL backend`:J?.nextValue?`Run only the WSL backend?`:`Re-enable the Windows backend?`}),(0,Q.jsx)($n,{children:J?.kind===`disable`?J.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.`:J?.kind===`distro`?`P4 Code will restart the WSL backend on the new distro. Sessions still running on the current distro will be interrupted.`:J?.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.`:J?.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)(Dn,{children:[(0,Q.jsx)(zn,{disabled:q,render:(0,Q.jsx)(I,{variant:`outline`,disabled:q}),children:`Cancel`}),J?.kind===`enable`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(I,{variant:`outline`,onClick:()=>Oi(`wsl-only`),disabled:q||!Qt,children:q?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Applying…`]}):`Use only WSL`}),(0,Q.jsx)(I,{variant:`default`,onClick:()=>Oi(`both`),disabled:q||!Qt,children:q?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Applying…`]}):`Run both backends`})]}):(0,Q.jsx)(I,{variant:J?.kind===`disable`||J?.kind===`wsl-only`&&J.nextValue?`destructive`:`default`,onClick:Ai,disabled:q||!Qt,children:q?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Applying…`]}):J?.kind===`disable`?J.wasWslOnly?`Switch to Windows`:`Disable WSL`:J?.kind===`distro`?`Switch distro`:J?.nextValue?`Restart and enable`:`Restart and disable`})]})]})}),(0,Q.jsx)(kn,{open:vt&&Qt,onOpenChange:e=>{W||At(e)},children:(0,Q.jsxs)(Ln,{children:[(0,Q.jsxs)(Qn,{children:[(0,Q.jsx)(Rn,{children:`Disable Tailscale HTTPS?`}),(0,Q.jsx)($n,{children:`P4 Code will restart the local backend without Tailscale Serve.`})]}),(0,Q.jsxs)(Dn,{children:[(0,Q.jsx)(zn,{disabled:W,render:(0,Q.jsx)(I,{variant:`outline`,disabled:W}),children:`Cancel`}),(0,Q.jsx)(I,{variant:`destructive`,onClick:()=>void yr(),disabled:W||!Qt,children:W?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Restarting…`]}):`Restart and disable`})]})]})}),(0,Q.jsx)(kt,{open:pt!==null,onOpenChange:e=>{W||e||mt(null)},children:(0,Q.jsxs)(Ot,{className:`max-w-md`,children:[(0,Q.jsxs)(xt,{children:[(0,Q.jsx)(St,{children:`Set up Tailscale HTTPS?`}),(0,Q.jsx)(Dt,{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)(Et,{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)(yt,{className:`mt-2`,type:`number`,inputMode:`numeric`,min:1,max:65535,step:1,value:jt,onChange:e=>Mt(e.target.value),disabled:W})]}),dr?null:(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-destructive`,children:`Enter a port from 1 to 65535.`}),(0,Q.jsxs)(`div`,{className:`rounded-md border border-border/70 bg-muted/20 px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`HTTPS endpoint`}),(0,Q.jsxs)(_t,{children:[(0,Q.jsx)(ht,{render:(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm text-foreground`,children:pr??`Pending MagicDNS endpoint`})}),pr?(0,Q.jsx)(gt,{side:`top`,children:pr}):null]})]})]}),(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(Tt,{disabled:W,render:(0,Q.jsx)(I,{variant:`outline`,disabled:W}),children:`Cancel`}),(0,Q.jsx)(I,{onClick:()=>void _r(),disabled:W||!dr,children:W?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Restarting…`]}):`Enable`})]})]})})]})});return(0,Q.jsxs)(un,{children:[Vi,(0,Q.jsxs)(dn,{...ar(`remote-environments`),title:`Environments`,headerAction:(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[T.length>0?(0,Q.jsx)(er,{targets:T,variant:`ghost-muted`}):null,(0,Q.jsxs)(kt,{open:de,onOpenChange:e=>{pe(e),e?me(null):B(null)},children:[(0,Q.jsxs)(_t,{children:[(0,Q.jsx)(ht,{render:(0,Q.jsx)(wt,{render:(0,Q.jsxs)(I,{size:`xs`,variant:`ghost-muted`,"aria-label":`Add environment`,children:[(0,Q.jsx)(Te,{className:`size-3`}),(0,Q.jsx)(`span`,{children:`Add environment`})]})})}),(0,Q.jsx)(gt,{side:`top`,children:`Add environment`})]}),(0,Q.jsxs)(Ot,{className:`max-h-[80dvh] sm:max-w-3xl`,children:[(0,Q.jsxs)(xt,{children:[(0,Q.jsx)(St,{children:L?`Add a route to ${L.label}`:`Add Environment`}),(0,Q.jsx)(Dt,{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)(Et,{children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Zr({mode:`remote`,title:`Remote link`,description:`Enter a backend host and pairing code.`,icon:(0,Q.jsx)(E,{"aria-hidden":!0,className:`size-4`})}),e?Zr({mode:`ssh`,title:`SSH`,description:`Use local SSH config, agent, and tunnels for the backend.`,icon:(0,Q.jsx)(w,{"aria-hidden":!0,className:`size-4`})}):null]}),(0,Q.jsx)(It,{children:he===`ssh`?ci():si()})]})})]})]})]}),children:[b.map(e=>(0,Q.jsx)(Ii,{environment:e,removingEnvironmentId:Be,onSetEnabled:jr,onRemove:Lr,onAddRoute:e=>{me(e),B(null),pe(!0)}},e.environmentId)),(0,Q.jsx)(Yi,{primaryEnvironmentId:h,savedEnvironments:y})]}),Ie()?(0,Q.jsx)(Pr,{environmentLabel:Fr?.label??null,onCancel:()=>Ir(null),onConfirm:()=>{Fr&&(Ir(null),Nr(Fr))}}):null,(0,Q.jsx)(Dr,{environments:D}),(0,Q.jsx)(Mr,{environments:D})]})}function Zi(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 Qi(e){return Di(e)?`hosted-link`:`link`}function $i(e){return!e}function ea(e){return e.currentTarget.select()}function ta(e){return e.currentTarget.select()}function na(e){return e!==null}var ra=Xi;export{ra as component};
2
- //# sourceMappingURL=settings.connections-DJEqNVad.js.map
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{RE as t,mE as n}from"./utils-hgbJ2TVM.js";import{n as r}from"./SettingsPanels-DdhZ2nXb.js";var i=t(),a=e(n());function o(){let e=(0,i.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,a.jsx)(r,{}),e[0]=t):t=e[0],t}export{o as component};
2
- //# sourceMappingURL=settings.general-BQ6775Hi.js.map
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$n as n,Cg as r,HT as i,Jm as a,Kn as o,Mf as s,Mw as c,O_ as l,Qu as u,RE as d,R_ as f,Tg as p,Xn as m,Yn as h,Yu as g,Zn as _,_g as v,bd as y,cr as b,dh as x,fg as S,fh as C,fp as w,gp as T,ib as E,l as D,lr as O,mE as k,nl as A,pg as j,pp as M,qn as N,rh as P,rr as F,t as I,tl as L,ur as R,wg as z,xg as ee,yg as te,zp as ne}from"./utils-hgbJ2TVM.js";import{W as re}from"./runtime-Cj24N7je.js";import{T as ie}from"./entities-BJgMc8pv.js";import{a as ae,r as B,t as V}from"./number-field-Dj0uYTJQ.js";import{a as H,c as oe,i as se,o as ce,r as le,s as ue,t as U}from"./select-Bsag72zE.js";import{t as de}from"./spinner-Bzrp5oww.js";import{i as W}from"./toast-B3hjhWRf.js";import{D as fe,E as pe,J as me,c as he,o as ge,r as G,s as K,x as q}from"./useSettings-BcmuuiTp.js";import{f as _e}from"./server-Vynm5NwP.js";import{i as J,n as ve}from"./session-DyiiEN5g.js";import{t as ye}from"./use-atom-command-D34CFqu3.js";import{t as be}from"./env-wK1YYxA8.js";import{a as xe,n as Se,t as Ce}from"./tooltip-D-SzZpgJ.js";import{t as we}from"./input-D_jxqXLR.js";import{a as Te,c as Ee,i as De,n as Oe,o as ke,r as Ae,s as je,t as Me}from"./dialog-Cgb4jap2.js";import{i as Ne,t as Pe}from"./device-DnfWBPpo.js";import{a as Fe,c as Ie,i as Le,n as Re,o as ze,s as Be,t as Ve}from"./DeviceSetup-Dm9ZbkMC.js";import{t as He}from"./AnimatedHeight-wZzihILs.js";import{i as Ue,n as We}from"./Icons-C0Zjws-3.js";import{t as Ge}from"./preview-B5v36DP8.js";import{a as Ke,i as qe,o as Je,t as Ye}from"./popover-2XJd3KEJ.js";import{B as Xe,C as Ze,L as Qe,P as $e,a as Y,c as et,i as tt,r as nt,s as rt}from"./settingsLayout-CuUCC6iL.js";import{Ar as it,Dr as at,Fi as ot,Hi as st,Mr as ct,Nr as lt,Or as ut,Pi as dt,jr as ft,kr as pt,pa as mt,tr as X}from"./main-4dRVuXx2.js";import{t as ht}from"./ProjectDefaultsSettings-DN1GxlYC.js";import{t as gt}from"./draft-input-DQxVE9YJ.js";import{t as _t}from"./ScopedSwitch-yznbaSh9.js";import{n as vt,r as yt,t as bt}from"./usePermissionStatus-SyBwmFSK.js";var Z=d(),Q=e(k(),1);function xt(e){let t=(0,Z.c)(27),{tools:n,action:r,kind:i,owner:a,error:o}=e,s=i?n?.[i]:void 0,c;t[0]===s?c=t[1]:(c=s?.runningVersion??(s?.installedVersions.includes(s.requiredVersion)?s.requiredVersion:s?.installedVersions.toSorted(St).at(-1)),t[0]=s,t[1]=c);let l=c,u=i===`hub`?`Device hub`:`Agent device`,d=i?`${u}: ${l?`version ${l}`:s?`not installed`:`version unknown`}. Show details`:void 0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(R,{tone:`muted`}),t[2]=f):f=t[2];let p=i?l?`v${l}`:s?`Not installed`:`Version unknown`:o?`Versions unavailable`:`Versions`,m;t[3]!==d||t[4]!==p?(m=(0,Q.jsx)(Je,{"aria-label":d,render:f,children:p}),t[3]=d,t[4]=p,t[5]=m):m=t[5];let h=i?u:`Device tools`,g;t[6]===h?g=t[7]:(g=(0,Q.jsx)(Ke,{children:h}),t[6]=h,t[7]=g);let _;t[8]!==i||t[9]!==u||t[10]!==n?(_=n?(0,Q.jsx)(`div`,{className:`mt-4 divide-y divide-border/50`,children:[[`Device hub`,n.hub],[`Agent device`,n.agent]].filter(e=>{let[t]=e;return!i||t===u}).map(e=>{let[t,n]=e;return(0,Q.jsxs)(`div`,{className:`space-y-2 py-3 first:pt-0 last:pb-0`,children:[i?null:(0,Q.jsx)(`p`,{className:`text-xs font-medium`,children:t}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 text-xs`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Running`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.runningVersion??`Not running`}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Required`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.requiredVersion}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Installed`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono break-words`,children:n.installedVersions.join(`, `)||`None`})]})]},t)})}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Versions have not been checked.`}),t[8]=i,t[9]=u,t[10]=n,t[11]=_):_=t[11];let v=a?`Managed by ${a}. `:``,y;t[12]===v?y=t[13]:(y=(0,Q.jsxs)(`p`,{className:`mt-4 border-t border-border/50 pt-3 text-xs text-muted-foreground`,children:[v,`Tools update automatically on this host when needed.`]}),t[12]=v,t[13]=y);let b;t[14]===o?b=t[15]:(b=o?(0,Q.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-destructive`,children:o}):null,t[14]=o,t[15]=b);let x;t[16]===r?x=t[17]:(x=r?(0,Q.jsx)(`div`,{className:`mt-3`,children:r}):null,t[16]=r,t[17]=x);let S;t[18]!==y||t[19]!==b||t[20]!==x||t[21]!==g||t[22]!==_?(S=(0,Q.jsxs)(qe,{align:`end`,width:`md`,children:[g,_,y,b,x]}),t[18]=y,t[19]=b,t[20]=x,t[21]=g,t[22]=_,t[23]=S):S=t[23];let C;return t[24]!==S||t[25]!==m?(C=(0,Q.jsxs)(Ye,{children:[m,S]}),t[24]=S,t[25]=m,t[26]=C):C=t[26],C}function St(e,t){return e.localeCompare(t,void 0,{numeric:!0})}var $=e(t(),1);function Ct(e,t,n,r=t){let i=(e,t)=>e.target===t.target&&e.port===t.port&&e.identityFile===t.identityFile,a=t=>{let n=e.filter(e=>i(e,t));if(n.length>1)throw Error(`Multiple hosts match this SSH destination. Select the environment to edit its hosts.`);return n[0]},o=e.find(e=>e.id===r.id)??a(r)??(n?void 0:a(t));return n?e.filter(e=>e.id!==o?.id):o?e.map(e=>e.id===o.id?{...t,id:o.id}:e):[...e,t]}function wt(e){let t=(0,Z.c)(4),{platforms:n}=e,r;t[0]===n?r=t[1]:(r=n.map(Tt),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:r}),t[2]=r,t[3]=i),i}function Tt(e){return(0,Q.jsxs)(Ce,{children:[(0,Q.jsxs)(xe,{render:(0,Q.jsx)(`span`,{tabIndex:0,className:`inline-flex items-center gap-1`}),children:[e.available?(0,Q.jsx)(y,{className:`size-3`}):(0,Q.jsx)(w,{className:`size-3`}),e.platform===`ios`?`iOS`:`Android`,` `,e.available?`available`:`unavailable`]}),(0,Q.jsx)(Se,{children:e.reason??(e.platform===`ios`?`iOS available`:`Android available`)})]},e.platform)}var Et=E(f);function Dt(e){let{identityFile:t,...n}=e;return Et({...n,...t?.trim()?{identityFile:t.trim()}:{}})}function Ot(e){return JSON.stringify([e.target.trim(),e.port,e.identityFile?.trim()||void 0])}async function kt(e,t,n,r){await Promise.all(e.map(async e=>{r(e.environmentId,{status:`pending`});try{if(!e.connected)throw Error(`Environment disconnected`);let i=await n(e.environmentId,t);r(e.environmentId,i.kind===`local`?{status:`local`}:{status:`connected`,platforms:i.platforms,...i.tools?{tools:i.tools}:{}})}catch(t){r(e.environmentId,{status:`failed`,error:t instanceof Error?t.message:String(t)})}}))}function At(e){let t=ye(Pe.testHost,{reportFailure:!1}),[n,r]=(0,$.useState)({}),i=(0,$.useRef)(new Set);return{checks:n,testConnection:async n=>{let a=Ot(n);if(i.current.has(a))return;i.current.add(a),r(e=>({...e,[a]:{}}));let o={};try{return await kt(e,n,async(e,n)=>{if(!ve(e,`settings:write`))throw Error(`This connection cannot test device hosts.`);let r=await t({environmentId:e,input:n});if(r._tag===`Failure`)throw Error(c(r.cause));return r.value},(e,t)=>{o[e]=t,r(n=>({...n,[a]:{...n[a],[e]:t}}))}),o}finally{i.current.delete(a)}}}}function jt(e){let t=(0,Z.c)(107),{host:n,isNew:r,targets:o,busy:s,onSave:c,onClose:l}=e,[u,d]=(0,$.useState)(n),{checks:f,testConnection:p}=At(o),m=f[Ot(u)],h=Object.values(m??{}).some(Nt),g,_;t[0]===u?(g=t[1],_=t[2]):(g=Dt({...u,label:u.label.trim()||u.target}),_=i(g),t[0]=u,t[1]=g,t[2]=_);let v=_,b;t[3]===m?b=t[4]:(b=Object.values(m??{}).filter(Mt),t[3]=m,t[4]=b);let x=b.length,S;t[5]!==s||t[6]!==l?(S=e=>{!e&&!s&&l()},t[5]=s,t[6]=l,t[7]=S):S=t[7];let C=!s,w;t[8]!==s||t[9]!==h||t[10]!==u.label||t[11]!==g||t[12]!==c?(w=(0,Q.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),i(g)&&u.label.trim()&&!s&&!h&&c(g.value)}}),t[8]=s,t[9]=h,t[10]=u.label,t[11]=g,t[12]=c,t[13]=w):w=t[13];let T=r?`Add device host`:`Edit device host`,E;t[14]===T?E=t[15]:(E=(0,Q.jsx)(Ee,{children:T}),t[14]=T,t[15]=E);let D=o.length===1?`Connect from ${o[0]?.label}.`:`Connect from ${o.length} selected environments.`,k;t[16]===D?k=t[17]:(k=(0,Q.jsxs)(Ae,{children:[D,` `,`Hosts on the same machine are skipped.`]}),t[16]=D,t[17]=k);let A;t[18]!==E||t[19]!==k?(A=(0,Q.jsxs)(Te,{children:[E,k]}),t[18]=E,t[19]=k,t[20]=A):A=t[20];let j;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(`span`,{children:`Name`}),t[21]=j):j=t[21];let N;t[22]===u?N=t[23]:(N=e=>d({...u,label:e.target.value}),t[22]=u,t[23]=N);let P;t[24]!==s||t[25]!==u.label||t[26]!==N?(P=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[j,(0,Q.jsx)(we,{autoFocus:!0,required:!0,value:u.label,disabled:s,onChange:N,placeholder:`Mac mini`})]}),t[24]=s,t[25]=u.label,t[26]=N,t[27]=P):P=t[27];let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(`span`,{children:`SSH target`}),t[28]=F):F=t[28];let I;t[29]===u?I=t[30]:(I=e=>d({...u,target:e.target.value}),t[29]=u,t[30]=I);let L;t[31]!==s||t[32]!==u.target||t[33]!==I?(L=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[F,(0,Q.jsx)(we,{required:!0,value:u.target,disabled:s,onChange:I,placeholder:`user@host or SSH alias`})]}),t[31]=s,t[32]=u.target,t[33]=I,t[34]=L):L=t[34];let R=n.port!==void 0||n.identityFile!==void 0||void 0,z;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:`SSH options`}),t[35]=z):z=t[35];let ee;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(`span`,{children:`Identity file`}),t[36]=ee):ee=t[36];let te=u.identityFile??``,ne;t[37]===u?ne=t[38]:(ne=e=>{let{identityFile:t,...n}=u;d(e.target.value?{...n,identityFile:e.target.value}:n)},t[37]=u,t[38]=ne);let re;t[39]!==s||t[40]!==te||t[41]!==ne?(re=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[ee,(0,Q.jsx)(we,{value:te,disabled:s,onChange:ne,placeholder:`SSH config default`})]}),t[39]=s,t[40]=te,t[41]=ne,t[42]=re):re=t[42];let ie;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Q.jsx)(`span`,{children:`Port`}),t[43]=ie):ie=t[43];let ae=u.port??``,B;t[44]===u?B=t[45]:(B=e=>{let{port:t,...n}=u;d(e.target.value?{...n,port:Number(e.target.value)}:n)},t[44]=u,t[45]=B);let V;t[46]!==s||t[47]!==ae||t[48]!==B?(V=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[ie,(0,Q.jsx)(we,{type:`number`,min:1,max:65535,value:ae,disabled:s,onChange:B,placeholder:`Default`})]}),t[46]=s,t[47]=ae,t[48]=B,t[49]=V):V=t[49];let H;t[50]!==re||t[51]!==V?(H=(0,Q.jsxs)(`div`,{className:`mt-3 grid grid-cols-[minmax(0,1fr)_7rem] gap-3`,children:[re,V]}),t[50]=re,t[51]=V,t[52]=H):H=t[52];let oe;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Optional. Resolved separately on each environment.`}),t[53]=oe):oe=t[53];let se;t[54]!==R||t[55]!==H?(se=(0,Q.jsxs)(`details`,{open:R,className:`text-sm`,children:[z,H,oe]}),t[54]=R,t[55]=H,t[56]=se):se=t[56];let ce=h?`Checking environments…`:m?x?`${x} of ${o.length} failed`:`Connection checks passed`:`Check access before saving`,le;t[57]===ce?le=t[58]:(le=(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:ce}),t[57]=ce,t[58]=le);let ue=s||h||!v,U;t[59]!==g||t[60]!==p?(U=()=>{i(g)&&p(g.value)},t[59]=g,t[60]=p,t[61]=U):U=t[61];let W;t[62]===h?W=t[63]:(W=h?(0,Q.jsx)(de,{size:`xs`}):null,t[62]=h,t[63]=W);let fe;t[64]!==ue||t[65]!==U||t[66]!==W?(fe=(0,Q.jsxs)(O,{type:`button`,size:`sm`,variant:`outline`,disabled:ue,onClick:U,children:[W,` Test connection`]}),t[64]=ue,t[65]=U,t[66]=W,t[67]=fe):fe=t[67];let pe;t[68]!==le||t[69]!==fe?(pe=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-2.5`,children:[le,fe]}),t[68]=le,t[69]=fe,t[70]=pe):pe=t[70];let me;t[71]!==m||t[72]!==o?(me=m?(0,Q.jsx)(`ul`,{className:`border-t border-border/60 divide-y divide-border/40`,children:o.map(e=>{let t=m[e.environmentId];return t?(0,Q.jsxs)(`li`,{className:`px-3 py-2.5 text-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:e.label}),(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-1.5 ${t.status===`failed`?`text-destructive`:`text-muted-foreground`}`,children:t.status===`pending`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(de,{size:`xs`}),` Checking…`]}):t.status===`local`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(M,{className:`size-3`}),` Already available locally`]}):t.status===`failed`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(a,{className:`size-3`}),` Failed`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{className:`size-3`}),` Connected`]})})]}),t.status===`connected`?(0,Q.jsx)(`div`,{className:`mt-1.5`,children:(0,Q.jsx)(wt,{platforms:t.platforms})}):null,t.status===`failed`?(0,Q.jsxs)(`details`,{className:`mt-1.5 text-muted-foreground`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:`Show error`}),(0,Q.jsx)(`p`,{className:`mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-words`,children:t.error})]}):null]},e.environmentId):null})}):null,t[71]=m,t[72]=o,t[73]=me):me=t[73];let he;t[74]!==pe||t[75]!==me?(he=(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/60`,children:[pe,me]}),t[74]=pe,t[75]=me,t[76]=he):he=t[76];let ge;t[77]!==P||t[78]!==L||t[79]!==se||t[80]!==he?(ge=(0,Q.jsxs)(ke,{children:[P,L,se,he]}),t[77]=P,t[78]=L,t[79]=se,t[80]=he,t[81]=ge):ge=t[81];let G;t[82]!==s||t[83]!==l?(G=(0,Q.jsx)(O,{type:`button`,variant:`ghost`,disabled:s,onClick:l,children:`Cancel`}),t[82]=s,t[83]=l,t[84]=G):G=t[84];let K;t[85]!==s||t[86]!==h||t[87]!==u.label||t[88]!==v?(K=s||h||!v||!u.label.trim(),t[85]=s,t[86]=h,t[87]=u.label,t[88]=v,t[89]=K):K=t[89];let q;t[90]===s?q=t[91]:(q=s?(0,Q.jsx)(de,{size:`xs`}):null,t[90]=s,t[91]=q);let _e;t[92]!==K||t[93]!==q?(_e=(0,Q.jsxs)(O,{type:`submit`,disabled:K,children:[q,` Save host`]}),t[92]=K,t[93]=q,t[94]=_e):_e=t[94];let J;t[95]!==G||t[96]!==_e?(J=(0,Q.jsxs)(De,{children:[G,_e]}),t[95]=G,t[96]=_e,t[97]=J):J=t[97];let ve;t[98]!==A||t[99]!==ge||t[100]!==C||t[101]!==J||t[102]!==w?(ve=(0,Q.jsxs)(je,{showCloseButton:C,render:w,children:[A,ge,J]}),t[98]=A,t[99]=ge,t[100]=C,t[101]=J,t[102]=w,t[103]=ve):ve=t[103];let ye;return t[104]!==S||t[105]!==ve?(ye=(0,Q.jsx)(Me,{open:!0,onOpenChange:S,children:ve}),t[104]=S,t[105]=ve,t[106]=ye):ye=t[106],ye}function Mt(e){return e.status===`failed`}function Nt(e){return e.status===`pending`}function Pt(e){let{scope:t,environments:n,connectedEnvironments:r}=Xe(),i=J(e.environmentId,l),a=t.kind===`project`||t.kind===`checkout`,o=ye(_e.updateSettings,{reportFailure:!1}),[s,c]=(0,$.useState)(null),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),m=n.map(e=>({environmentId:e.environmentId,label:e.label,connected:e.connection.phase===`connected`})),{checks:h,testConnection:g}=At(m),_=async(t,r=!1,i=t)=>{if(e.environmentId&&!a){p(!0);try{let e=await Promise.allSettled(n.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!ve(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return o({environmentId:e.environmentId,input:{patch:{deviceHosts:Ct(e.serverConfig.settings.deviceHosts,t,r,i)}}})})),a=n.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});a.length===0?c(null):W.add({type:`error`,title:`Device hosts not saved on all environments`,description:`Could not update ${a.map(e=>e.label).join(`, `)}.`})}finally{p(!1)}}};return(0,Q.jsx)(Y,{id:`device-hosts`,title:`Device hosts`,serverScoped:!0,settingKeys:[`deviceHosts`],description:`Add remote machines with simulator or emulator runtimes installed, and the selected environments will connect over SSH and set up device tools automatically.`,control:(0,Q.jsxs)(O,{size:`sm`,variant:`outline`,disabled:!i||a||f||!e.environmentId||s!==null,onClick:()=>{d(null),c({id:D(),label:``,target:``})},children:[(0,Q.jsx)(ne,{className:`size-3.5`}),` Add host`]}),children:(0,Q.jsx)(`div`,{className:`pt-3 pb-2`,children:e.environmentId?(0,Q.jsxs)(Q.Fragment,{children:[r.map(e=>(0,Q.jsxs)(`div`,{children:[r.length>1?(0,Q.jsx)(`p`,{className:`pt-3 pb-1 text-xs font-medium text-muted-foreground`,children:e.label}):null,(0,Q.jsx)(Ft,{environmentLabel:e.label,environmentId:e.environmentId,hosts:e.serverConfig?.settings.deviceHosts??[],busy:!i||a||f,checks:h,testConnection:async e=>{let t=await g(e);if(!t)return;let n=m.filter(e=>t[e.environmentId]?.status===`failed`);return W.add({type:n.length?`error`:`success`,title:n.length?`${e.label}: ${n.length} of ${m.length} environments failed`:`${e.label}: connection checks passed`,description:n.length?`Could not connect from ${n.map(e=>e.label).join(`, `)}.`:`Connected or already available locally on each selected environment.`}),t},onEdit:e=>{d(e),c(e)},onRemove:e=>void _(e,!0)})]},e.environmentId)),s?(0,Q.jsx)(jt,{host:s,isNew:u===null,targets:m,busy:f,onSave:e=>void _(e,!1,u??e),onClose:()=>c(null)},s.id):null]}):(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect a selected environment to manage device hosts.`})})})}function Ft(e){let t=(0,Z.c)(28),{environmentLabel:r,environmentId:i,hosts:a,busy:o,onEdit:s,onRemove:c,checks:l,testConnection:u}=e,{state:d}=Ne(i),f=ye(Pe.list),[p,m]=(0,$.useState)(null),h;t[0]===a.length?h=t[1]:(h=a.length===0?(0,Q.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`No device hosts.`}):null,t[0]=a.length,t[1]=h);let g;if(t[2]!==o||t[3]!==l||t[4]!==i||t[5]!==r||t[6]!==a||t[7]!==s||t[8]!==c||t[9]!==f||t[10]!==p||t[11]!==d||t[12]!==u){let e;t[14]!==o||t[15]!==l||t[16]!==i||t[17]!==r||t[18]!==s||t[19]!==c||t[20]!==f||t[21]!==p||t[22]!==d||t[23]!==u?(e=e=>{let t=d.hostStatuses[e.id],a=l[Ot(e)]?.[i],h=(a?.status===`connected`?a.platforms:void 0)??d.hosts.find(t=>t.id===e.id)?.platforms??[],g=a?.status===`pending`?`Checking connection…`:t?.status===`installing`?`Installing device support…`:t?.status===`starting`?`Connecting…`:null,v=a?.status===`failed`?a.error:a?.status===`local`?void 0:t?.status===`failed`?t.detail:void 0;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/50 py-2.5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.label}),h.filter(Lt).map(It)]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.target}),(0,Q.jsx)(xt,{owner:r,error:d.hosts.find(t=>t.id===e.id)?.toolInspectionError,tools:d.hosts.find(t=>t.id===e.id)?.tools??(a?.status===`connected`?a.tools:void 0)}),a?.status===`local`?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Already available locally`}):null,v?(0,Q.jsx)(`div`,{className:`mt-1`,role:`status`,children:(0,Q.jsxs)(`details`,{className:`text-xs text-destructive`,children:[(0,Q.jsx)(`summary`,{children:`Connection failed`}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words`,children:v})]})}):null]}),g?(0,Q.jsxs)(`span`,{role:`status`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(de,{size:`xs`}),g]}):null,(0,Q.jsxs)(N,{children:[(0,Q.jsx)(b,{render:(0,Q.jsx)(O,{size:`icon-sm`,variant:`ghost-muted`,disabled:o,"aria-label":e.label+` options`}),children:(0,Q.jsx)(T,{})}),(0,Q.jsxs)(n,{align:`end`,children:[(0,Q.jsx)(_,{onClick:()=>{s(e)},children:`Edit`}),(0,Q.jsx)(_,{variant:`destructive`,onClick:()=>c(e),children:`Remove`})]})]}),t?.status===`failed`&&d.supportsHostRetry&&d.hostStatus!==`disabled`?(0,Q.jsx)(O,{size:`sm`,variant:`outline`,disabled:o||p!==null,onClick:()=>{m(e.id),f({environmentId:i,input:{retryHostId:e.id}}).finally(()=>m(null))},children:p===e.id?`Retrying…`:`Retry`}):(0,Q.jsx)(O,{size:`sm`,variant:`outline`,disabled:o||g!==null,onClick:()=>void u(e),children:`Test connection`})]},e.id)},t[14]=o,t[15]=l,t[16]=i,t[17]=r,t[18]=s,t[19]=c,t[20]=f,t[21]=p,t[22]=d,t[23]=u,t[24]=e):e=t[24],g=a.map(e),t[2]=o,t[3]=l,t[4]=i,t[5]=r,t[6]=a,t[7]=s,t[8]=c,t[9]=f,t[10]=p,t[11]=d,t[12]=u,t[13]=g}else g=t[13];let v;return t[25]!==h||t[26]!==g?(v=(0,Q.jsxs)(Q.Fragment,{children:[h,g]}),t[25]=h,t[26]=g,t[27]=v):v=t[27],v}function It(e){return(0,Q.jsxs)(Ce,{children:[(0,Q.jsx)(xe,{render:(0,Q.jsx)(`span`,{tabIndex:0,role:`img`,"aria-label":e.platform===`ios`?`iOS available`:`Android available`,className:`shrink-0 text-muted-foreground`}),children:e.platform===`ios`?(0,Q.jsx)(Ue,{className:`size-3.5 -translate-y-px`}):(0,Q.jsx)(We,{className:`size-3.5`})}),(0,Q.jsx)(Se,{children:e.platform===`ios`?`iOS available`:`Android available`})]},e.platform)}function Lt(e){return e.available}function Rt(e,t){if(e)return{kind:`new`};let n=t[0];return n?{kind:`existing`,profileId:n.id}:{kind:`new`}}function zt(e,t,n){if(e.kind===`new`)return{kind:`new`,profileId:t};let r=n.find(t=>t.id===e.profileId);if(r!==void 0)return{kind:`existing`,profileId:e.profileId,name:r.name}}function Bt(e){return e.step!==`importing`}function Vt(e){return e.unavailable===`browserRunning`?{step:`quit`}:e.unavailable===`needsFullDiskAccess`?{step:`fullDiskAccess`,resume:`configure`}:e.unavailable===void 0?e.profiles.length===0?{step:`blocked`,reason:`unknownSourceProfile`}:{step:`configure`}:{step:`blocked`,reason:e.unavailable}}function Ht(e){return e.kind===`imported`?{step:`done`,imported:e.imported,skipped:e.skipped,skippedDomains:e.skippedDomains,targetName:e.targetName}:e.reason===`browserRunning`?{step:`quit`}:e.reason===`needsFullDiskAccess`?{step:`fullDiskAccess`,resume:`import`,checked:!0}:{step:`blocked`,reason:e.reason}}function Ut(e){return e===void 0?{step:`blocked`,reason:`unknownSource`}:Vt(e)}function Wt(e){let t=Ut(e);return t.step===`fullDiskAccess`?{...t,checked:!0}:t}function Gt(e,t){return t.profiles.some(t=>t.directory===e)?e:t.profiles[0]?.directory??``}function Kt(e){switch(e){case`needsKeychainApproval`:case`keychainItemMissing`:case`keychainUnavailable`:case`readFailed`:case`sessionUnavailable`:case`profileNotSaved`:return!0;default:return!1}}function qt(e){return e.length===0?``:e.length===1?e[0]:e.length<=3?`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`:`${e.slice(0,3).join(`, `)} and ${e.length-3} more`}function Jt(e){let t=(0,Z.c)(46),{source:n,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,onImport:o,onRefreshSource:s,onOpenFullDiskAccessSettings:c,onCheckFullDiskAccess:l,onClose:u}=e,[d,f]=(0,$.useState)(n),p;t[0]===n?p=t[1]:(p=()=>Vt(n),t[0]=n,t[1]=p);let[m,h]=(0,$.useState)(p),g;t[2]===n.profiles[0]?.directory?g=t[3]:(g=()=>n.profiles[0]?.directory??``,t[2]=n.profiles[0]?.directory,t[3]=g);let[_,v]=(0,$.useState)(g),y;t[4]!==a||t[5]!==i?(y=()=>Rt(a,i),t[4]=a,t[5]=i,t[6]=y):y=t[6];let[b,x]=(0,$.useState)(y),[S,C]=(0,$.useState)(),w;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(w=D(),t[7]=w):w=t[7];let T=(0,$.useRef)(`profile-${w}`),E=(0,$.useRef)(!1),O;t[8]!==o||t[9]!==_||t[10]!==b||t[11]!==i?(O=()=>{if(E.current)return;let e=zt(b,T.current,i);if(e===void 0){C(`That profile is no longer available. Choose where to import these cookies.`),h({step:`configure`});return}C(void 0),E.current=!0,h({step:`importing`}),o({sourceProfileDirectory:_,target:e}).then(e=>h(Ht(e))).catch(()=>h({step:`blocked`,reason:`readFailed`})).finally(()=>{E.current=!1})},t[8]=o,t[9]=_,t[10]=b,t[11]=i,t[12]=O):O=t[12];let k=O,A;t[13]===s?A=t[14]:(A=(e,t)=>{h({step:`checking`,check:e}),s().then(e=>{e&&(f(e),v(t=>Gt(t,e))),h(t(e))}).catch(()=>h({step:`blocked`,reason:`readFailed`}))},t[13]=s,t[14]=A);let j=A,M;t[15]===j?M=t[16]:(M=()=>j(`browser`,Ut),t[15]=j,t[16]=M);let N=M,P;t[17]===j?P=t[18]:(P=()=>j(`fullDiskAccess`,Wt),t[17]=j,t[18]=P);let F=P,I;t[19]!==u||t[20]!==m?(I=e=>e||!Bt(m)?void 0:u(),t[19]=u,t[20]=m,t[21]=I):I=t[21];let L;t[22]===m?L=t[23]:(L=Bt(m),t[22]=m,t[23]=L);let R;t[24]!==a||t[25]!==r||t[26]!==l||t[27]!==u||t[28]!==c||t[29]!==s||t[30]!==N||t[31]!==F||t[32]!==k||t[33]!==d||t[34]!==_||t[35]!==m||t[36]!==b||t[37]!==S||t[38]!==i?(R=m.step===`quit`?(0,Q.jsx)(Yt,{source:d,onCancel:u,onRechecked:N}):m.step===`fullDiskAccess`?(0,Q.jsx)(Qt,{source:d,onCancel:u,onOpenSettings:c,onCheck:l??(async()=>{let e=await s();return e!==void 0&&e.unavailable===void 0}),onGranted:m.resume===`import`?k:F,stillRequired:m.checked===!0}):m.step===`importing`?(0,Q.jsx)(tn,{}):m.step===`checking`?(0,Q.jsx)(nn,{sourceName:d.name,check:m.check}):m.step===`done`?(0,Q.jsx)(rn,{...m,destinationEnvironmentName:r,onClose:u}):m.step===`blocked`?(0,Q.jsx)(an,{source:d,reason:m.reason,onClose:u,onRetry:Kt(m.reason)?k:void 0}):(0,Q.jsx)($t,{source:d,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:_,onSourceProfileChange:v,target:b,onTargetChange:e=>{x(e),C(void 0)},targetError:S,onCancel:u,onImport:k}),t[24]=a,t[25]=r,t[26]=l,t[27]=u,t[28]=c,t[29]=s,t[30]=N,t[31]=F,t[32]=k,t[33]=d,t[34]=_,t[35]=m,t[36]=b,t[37]=S,t[38]=i,t[39]=R):R=t[39];let z;t[40]!==L||t[41]!==R?(z=(0,Q.jsx)(je,{className:`max-w-lg`,showCloseButton:L,children:R}),t[40]=L,t[41]=R,t[42]=z):z=t[42];let ee;return t[43]!==z||t[44]!==I?(ee=(0,Q.jsx)(Me,{open:!0,onOpenChange:I,children:z}),t[43]=z,t[44]=I,t[45]=ee):ee=t[45],ee}function Yt(e){let t=(0,Z.c)(12),{source:n,onCancel:r,onRechecked:i}=e,a;t[0]===n.name?a=t[1]:(a=(0,Q.jsxs)(Te,{children:[(0,Q.jsxs)(Ee,{children:[`Quit `,n.name,` to import`]}),(0,Q.jsxs)(Ae,{children:[n.name,` is open, so its cookies can’t be read yet. Quit it, then continue.`]})]}),t[0]=n.name,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(O,{variant:`outline`,onClick:r,children:`Cancel`}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(O,{onClick:i,children:`I’ve quit it`}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(De,{children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function Xt(e){if(e!==void 0)return e===0?`no cookies`:`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function Zt(e){return`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function Qt(e){let t=(0,Z.c)(43),{source:n,onCancel:r,onOpenSettings:i,onGranted:a,stillRequired:o,onCheck:c}=e,[l,u]=(0,$.useState)(!1),[d,f]=(0,$.useState)(null),p;t[0]===c?p=t[1]:(p=async()=>({fullDiskAccess:await c()}),t[0]=c,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m={fullDiskAccess:!1},t[2]=m):m=t[2];let h=bt(p,m),g;t[3]!==i||t[4]!==l?(g=()=>{l||(u(!0),f(null),Promise.resolve().then(i).catch(()=>f(`Could not open System Settings. Try Allow again.`)).finally(()=>u(!1)))},t[3]=i,t[4]=l,t[5]=g):g=t[5];let _=g,v;t[6]===n.name?v=t[7]:(v=(0,Q.jsxs)(Te,{children:[(0,Q.jsxs)(Ee,{children:[`Let P4 Code read `,n.name,`’s cookies`]}),(0,Q.jsxs)(Ae,{children:[`To import cookies from `,n.name,`, P4 Code needs Full Disk Access. Turn it on in System Settings, then come back to finish the import — you can revoke it again once the import is done.`]})]}),t[6]=n.name,t[7]=v);let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(s,{className:`size-8 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[8]=y):y=t[8];let b=`Read ${n.name}'s cookies for this import.`,x;t[9]===_?x=t[10]:(x=()=>void _(),t[9]=_,t[10]=x);let S;t[11]!==h.status.fullDiskAccess||t[12]!==b||t[13]!==x?(S=[{id:`fullDiskAccess`,icon:y,title:`Full Disk Access`,description:b,granted:h.status.fullDiskAccess,onAllow:x}],t[11]=h.status.fullDiskAccess,t[12]=b,t[13]=x,t[14]=S):S=t[14];let C;t[15]!==l||t[16]!==S?(C=(0,Q.jsx)(vt,{busy:l,permissions:S}),t[15]=l,t[16]=S,t[17]=C):C=t[17];let w;t[18]!==d||t[19]!==h.error?(w=d||h.error?(0,Q.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:d??h.error}):null,t[18]=d,t[19]=h.error,t[20]=w):w=t[20];let T;t[21]!==h||t[22]!==o?(T=h.isReady([`fullDiskAccess`])?null:(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:o?`Access is still required. Quit and reopen P4 Code if you just allowed it, then retry the import.`:`If access doesn't update after you allow it, quit and reopen P4 Code, then retry the import.`}),t[21]=h,t[22]=o,t[23]=T):T=t[23];let E;t[24]!==w||t[25]!==T||t[26]!==C?(E=(0,Q.jsxs)(ke,{children:[C,w,T]}),t[24]=w,t[25]=T,t[26]=C,t[27]=E):E=t[27];let D;t[28]===r?D=t[29]:(D=(0,Q.jsx)(O,{variant:`outline`,onClick:r,children:`Cancel`}),t[28]=r,t[29]=D);let k;t[30]===h?k=t[31]:(k=h.isReady([`fullDiskAccess`]),t[30]=h,t[31]=k);let A;t[32]!==a||t[33]!==l||t[34]!==k?(A=(0,Q.jsx)(yt,{ready:k,busy:l,onClick:a,children:`Continue`}),t[32]=a,t[33]=l,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==D||t[37]!==A?(j=(0,Q.jsxs)(De,{children:[D,A]}),t[36]=D,t[37]=A,t[38]=j):j=t[38];let M;return t[39]!==E||t[40]!==j||t[41]!==v?(M=(0,Q.jsxs)(Q.Fragment,{children:[v,E,j]}),t[39]=E,t[40]=j,t[41]=v,t[42]=M):M=t[42],M}function $t(e){let t=(0,Z.c)(59),{source:n,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:o,onSourceProfileChange:s,target:c,targetError:l,onTargetChange:d,onCancel:f,onImport:p}=e,m;t[0]!==c.kind||t[1]!==c.profileId||t[2]!==i?(m=c.kind===`existing`&&!i.some(e=>e.id===c.profileId),t[0]=c.kind,t[1]=c.profileId,t[2]=i,t[3]=m):m=t[3];let h=m,_=c.kind===`new`&&!a,v=l??(h?`That profile is no longer available. Choose where to import these cookies.`:_?`You've reached the profile limit. Choose an existing profile to import into.`:void 0),y;t[4]===n.name?y=t[5]:(y=(0,Q.jsxs)(Ee,{children:[`Import from `,n.name]}),t[4]=n.name,t[5]=y);let b;t[6]===r?b=t[7]:(b=(0,Q.jsxs)(Ae,{children:[`Choose which cookies to import for `,r,`.`]}),t[6]=r,t[7]=b);let x;t[8]!==y||t[9]!==b?(x=(0,Q.jsxs)(Te,{children:[y,b]}),t[8]=y,t[9]=b,t[10]=x):x=t[10];let S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`From`}),t[11]=S):S=t[11];let C;if(t[12]!==s||t[13]!==n.profiles||t[14]!==o){let e;t[16]!==s||t[17]!==o?(e=e=>(0,Q.jsx)(en,{selected:o===e.directory,title:e.name,subtitle:Xt(e.cookieCount),onSelect:()=>s(e.directory)},e.directory),t[16]=s,t[17]=o,t[18]=e):e=t[18],C=n.profiles.map(e),t[12]=s,t[13]=n.profiles,t[14]=o,t[15]=C}else C=t[15];let w;t[19]===C?w=t[20]:(w=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[S,C]}),t[19]=C,t[20]=w);let T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center text-muted-foreground`,children:[(0,Q.jsx)(g,{className:`size-4 sm:hidden`}),(0,Q.jsx)(u,{className:`hidden size-4 sm:block`})]}),t[21]=T):T=t[21];let E;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Into`}),t[22]=E):E=t[22];let D;t[23]!==a||t[24]!==d||t[25]!==c.kind?(D=a?(0,Q.jsx)(en,{selected:c.kind===`new`,title:`New profile`,subtitle:`Created for these cookies`,onSelect:()=>d({kind:`new`})}):null,t[23]=a,t[24]=d,t[25]=c.kind,t[26]=D):D=t[26];let k;if(t[27]!==d||t[28]!==c.kind||t[29]!==c.profileId||t[30]!==i){let e;t[32]!==d||t[33]!==c.kind||t[34]!==c.profileId?(e=e=>(0,Q.jsx)(en,{selected:c.kind===`existing`&&c.profileId===e.id,title:e.name,subtitle:`Existing profile`,onSelect:()=>d({kind:`existing`,profileId:e.id})},e.id),t[32]=d,t[33]=c.kind,t[34]=c.profileId,t[35]=e):e=t[35],k=i.map(e),t[27]=d,t[28]=c.kind,t[29]=c.profileId,t[30]=i,t[31]=k}else k=t[31];let A;t[36]!==D||t[37]!==k?(A=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[E,D,k]}),t[36]=D,t[37]=k,t[38]=A):A=t[38];let j;t[39]!==A||t[40]!==w?(j=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4`,children:[w,T,A]}),t[39]=A,t[40]=w,t[41]=j):j=t[41];let M;t[42]===v?M=t[43]:(M=v?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-destructive`,children:v}):null,t[42]=v,t[43]=M);let N;t[44]!==j||t[45]!==M?(N=(0,Q.jsxs)(ke,{children:[j,M]}),t[44]=j,t[45]=M,t[46]=N):N=t[46];let P;t[47]===f?P=t[48]:(P=(0,Q.jsx)(O,{variant:`outline`,onClick:f,children:`Cancel`}),t[47]=f,t[48]=P);let F=o===``||h||_,I;t[49]!==p||t[50]!==F?(I=(0,Q.jsx)(O,{disabled:F,onClick:p,children:`Import`}),t[49]=p,t[50]=F,t[51]=I):I=t[51];let L;t[52]!==P||t[53]!==I?(L=(0,Q.jsxs)(De,{children:[P,I]}),t[52]=P,t[53]=I,t[54]=L):L=t[54];let R;return t[55]!==N||t[56]!==L||t[57]!==x?(R=(0,Q.jsxs)(Q.Fragment,{children:[x,N,L]}),t[55]=N,t[56]=L,t[57]=x,t[58]=R):R=t[58],R}function en(e){let t=(0,Z.c)(22),{selected:n,title:r,subtitle:i,onSelect:a}=e,o=n?`border-primary bg-primary/8`:`border-border/60 hover:border-border hover:bg-muted/40`,s;t[0]===o?s=t[1]:(s=I(`flex w-full cursor-pointer items-center justify-between gap-3 rounded-lg border px-3 py-2 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,o),t[0]=o,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,Q.jsx)(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:r}),t[2]=r,t[3]=c);let l;t[4]===i?l=t[5]:(l=i?(0,Q.jsx)(`span`,{className:`block truncate text-xs tabular-nums text-muted-foreground`,children:i}):null,t[4]=i,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d=n?`border-primary bg-primary text-primary-foreground`:`border-input`,f;t[9]===d?f=t[10]:(f=I(`grid size-4 shrink-0 place-items-center rounded-full border`,d),t[9]=d,t[10]=f);let p;t[11]===n?p=t[12]:(p=n?(0,Q.jsx)(y,{className:`size-2.5`}):null,t[11]=n,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Q.jsx)(`span`,{className:f,children:p}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==a||t[17]!==n||t[18]!==s||t[19]!==u||t[20]!==m?(h=(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:a,className:s,children:[u,m]}),t[16]=a,t[17]=n,t[18]=s,t[19]=u,t[20]=m,t[21]=h):h=t[21],h}function tn(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(Te,{children:[(0,Q.jsx)(Ee,{children:`Importing cookies`}),(0,Q.jsx)(Ae,{children:`This may take a moment.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[t,(0,Q.jsx)(ke,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,Q.jsx)(de,{size:`md`,tone:`muted`}),(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Importing…`})]})})]}),e[1]=n):n=e[1],n}function nn(e){let t=(0,Z.c)(13),{sourceName:n,check:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsxs)(Ee,{children:[`Checking `,n]}),t[0]=n,t[1]=i);let a=r===`fullDiskAccess`?`Checking Full Disk Access.`:`Checking whether the browser has closed.`,o;t[2]===a?o=t[3]:(o=(0,Q.jsx)(Ae,{children:a}),t[2]=a,t[3]=o);let s;t[4]!==i||t[5]!==o?(s=(0,Q.jsxs)(Te,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6];let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(de,{size:`md`,tone:`muted`}),t[7]=c):c=t[7];let l=r===`fullDiskAccess`?`Checking access…`:`Checking…`,u;t[8]===l?u=t[9]:(u=(0,Q.jsx)(ke,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[c,(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:l})]})}),t[8]=l,t[9]=u);let d;return t[10]!==s||t[11]!==u?(d=(0,Q.jsxs)(Q.Fragment,{children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function rn(e){let t=(0,Z.c)(24),{imported:n,skipped:r,skippedDomains:i,targetName:a,destinationEnvironmentName:o,onClose:s}=e,c;t[0]!==n||t[1]!==r?(c=n>0?`Imported ${Zt(n)}`:r>0?`Skipped ${Zt(r)}`:`No cookies found`,t[0]=n,t[1]=r,t[2]=c):c=t[2];let l;t[3]===c?l=t[4]:(l=(0,Q.jsx)(Ee,{children:c}),t[3]=c,t[4]=l);let u;t[5]!==o||t[6]!==n||t[7]!==r||t[8]!==a?(u=n>0?`Added to ${a} for ${o}.${r>0?` ${Zt(r)} skipped.`:``}`:r>0?`No cookies were imported for ${o}.`:`There were no cookies to import for ${o}.`,t[5]=o,t[6]=n,t[7]=r,t[8]=a,t[9]=u):u=t[9];let d;t[10]===u?d=t[11]:(d=(0,Q.jsx)(Ae,{children:u}),t[10]=u,t[11]=d);let f;t[12]!==l||t[13]!==d?(f=(0,Q.jsxs)(Te,{children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=i.length>0?(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Skipped`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-foreground`,children:qt(i)})]}):null,t[15]=i,t[16]=p);let m;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(O,{}),t[17]=m):m=t[17];let h;t[18]===s?h=t[19]:(h=(0,Q.jsx)(De,{children:(0,Q.jsx)(Oe,{render:m,onClick:s,children:`Done`})}),t[18]=s,t[19]=h);let g;return t[20]!==f||t[21]!==p||t[22]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[f,p,h]}),t[20]=f,t[21]=p,t[22]=h,t[23]=g):g=t[23],g}function an(e){let t=(0,Z.c)(17),{source:n,reason:r,onClose:i,onRetry:a}=e,o;t[0]===n.name?o=t[1]:(o=(0,Q.jsxs)(Ee,{children:[`Couldn’t import from `,n.name]}),t[0]=n.name,t[1]=o);let s=L[r],c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(Ae,{children:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c?(l=(0,Q.jsxs)(Te,{children:[o,c]}),t[4]=o,t[5]=c,t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=(0,Q.jsx)(O,{variant:`outline`,onClick:i,children:`Close`}),t[7]=i,t[8]=u);let d;t[9]===a?d=t[10]:(d=a?(0,Q.jsx)(O,{onClick:a,children:`Try again`}):null,t[9]=a,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,Q.jsxs)(De,{children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==l||t[15]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[l,f]}),t[14]=l,t[15]=f,t[16]=p):p=t[16],p}var on=`fill`,sn=`responsive`;async function cn(e,t,n,r){let i=e===null?[]:t,a=r?.environmentIds??[];if(i.length===0&&a.length===0)throw Error(`Browser profile data is not available to clear.`);await Promise.all([...i.flatMap(t=>[e.clearCookies(t,n),e.clearCache(t,n)]),...a.map(e=>r.clear(e,n))])}function ln(e,t,n,r=0){return(e||r>0)&&t&&n>0}var un={width:1280,height:800},dn={useGrouping:!1},fn={system:`System`,light:`Light`,dark:`Dark`},pn=e=>`${Math.round(e*100)}%`,mn=class extends Error{constructor(){super(`Browser profile limit reached.`),this.name=`ProfileLimitReachedError`}},hn=e=>{let t=String(e?.message??``);return A.literals.find(e=>t.includes(`failed: ${e}.`))??`readFailed`},gn=e=>e._tag===`fill`?on:e._tag===`preset`&&ot.some(t=>t.id===e.presetId)?e.presetId:sn,_n=e=>{let t=gn(e);return t===on?`Fill panel`:t===sn?`Responsive`:ot.find(e=>e.id===t)?.label??`Responsive`},vn=e=>Number.isInteger(e)&&e>=240&&e<=3840,yn=e=>({...e,width:e.height,height:e.width});function bn(e){let t=(0,Z.c)(42),{disabled:n}=e,r=K(Sn),i=q(),a=r._tag===`fill`?null:r,o=a?.width??un.width,s=a?.height??un.height,c;t[0]!==o||t[1]!==s?(c={width:o,height:s},t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]!==a?.height||t[4]!==a?.width||t[5]!==i?(u=e=>{if(e===on){i({browserDefaultViewport:j});return}if(e===sn){i({browserDefaultViewport:{_tag:`freeform`,width:a?.width??un.width,height:a?.height??un.height}});return}let t=ot.find(t=>t.id===e);t&&i({browserDefaultViewport:{_tag:`preset`,width:t.width,height:t.height,presetId:t.id}})},t[3]=a?.height,t[4]=a?.width,t[5]=i,t[6]=u):u=t[6];let d=u,f;t[7]!==l||t[8]!==a||t[9]!==i?(f=(e,t)=>{if(t===null||!vn(t))return;let n={...l,[e]:t};n.width*n.height>8294400||a&&n.width===a.width&&n.height===a.height||i({browserDefaultViewport:{_tag:`freeform`,...n}})},t[7]=l,t[8]=a,t[9]=i,t[10]=f):f=t[10];let p=f,m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=X(`browser-default-viewport`),t[11]=m):m=t[11];let h;t[12]!==n||t[13]!==i||t[14]!==r._tag?(h=!n&&r._tag!==C._tag?(0,Q.jsx)(nt,{label:`default browser viewport`,onClick:()=>i({browserDefaultViewport:C})}):null,t[12]=n,t[13]=i,t[14]=r._tag,t[15]=h):h=t[15];let g;t[16]===r?g=t[17]:(g=gn(r),t[16]=r,t[17]=g);let _;t[18]===r?_=t[19]:(_=_n(r),t[18]=r,t[19]=_);let y;t[20]===_?y=t[21]:(y=(0,Q.jsx)(ue,{size:`sm`,className:`w-full min-w-0 sm:w-44`,"aria-label":`Default browser viewport`,children:(0,Q.jsx)(oe,{children:_})}),t[20]=_,t[21]=y);let b,x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(H,{value:on,children:`Fill panel`}),x=(0,Q.jsx)(H,{value:sn,children:`Responsive`}),t[22]=b,t[23]=x):(b=t[22],x=t[23]);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(ce,{align:`end`,alignItemWithTrigger:!1,children:[b,x,(0,Q.jsxs)(le,{children:[(0,Q.jsx)(se,{children:`Standard`}),ot.map(xn)]})]}),t[24]=S):S=t[24];let w;t[25]!==n||t[26]!==d||t[27]!==y||t[28]!==g?(w=(0,Q.jsxs)(U,{value:g,onValueChange:d,disabled:n,children:[y,S]}),t[25]=n,t[26]=d,t[27]=y,t[28]=g,t[29]=w):w=t[29];let T;t[30]!==p||t[31]!==n||t[32]!==l||t[33]!==a||t[34]!==i?(T=a?(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(V,{value:l.width,min:240,max:v,disabled:n,format:dn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`width`,e),children:(0,Q.jsx)(B,{children:(0,Q.jsx)(ae,{"aria-label":`Default viewport width`})})}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`×`}),(0,Q.jsx)(V,{value:l.height,min:240,max:v,disabled:n,format:dn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`height`,e),children:(0,Q.jsx)(B,{children:(0,Q.jsx)(ae,{"aria-label":`Default viewport height`})})}),(0,Q.jsxs)(Ce,{children:[(0,Q.jsx)(xe,{render:(0,Q.jsx)(O,{size:`icon-sm`,variant:`ghost-muted`,disabled:n,"aria-label":`Rotate to ${l.height>=l.width?`landscape`:`portrait`}`,onClick:()=>i({browserDefaultViewport:yn(a)}),children:(0,Q.jsx)(dt,{})})}),(0,Q.jsx)(Se,{side:`top`,children:`Rotate`})]})]}):null,t[30]=p,t[31]=n,t[32]=l,t[33]=a,t[34]=i,t[35]=T):T=t[35];let E;t[36]!==w||t[37]!==T?(E=(0,Q.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-end gap-2 sm:w-auto`,children:[w,T]}),t[36]=w,t[37]=T,t[38]=E):E=t[38];let D;return t[39]!==E||t[40]!==h?(D=(0,Q.jsx)(Y,{...m,description:`Tab size for you and agents. Fill fits the panel; other sizes show the device toolbar.`,resetAction:h,control:E}),t[39]=E,t[40]=h,t[41]=D):D=t[41],D}function xn(e){return(0,Q.jsx)(H,{value:e.id,children:(0,Q.jsxs)(`span`,{className:`flex w-full items-center justify-between gap-5`,children:[(0,Q.jsx)(`span`,{children:e.label}),(0,Q.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:e.detail})]})},e.id)}function Sn(e){return e.browserDefaultViewport}function Cn(e){let t=(0,Z.c)(20),{disabled:n}=e,r=K(Tn),i=q(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=X(`browser-default-zoom`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==i||t[3]!==r?(o=!n&&r!==1?(0,Q.jsx)(nt,{label:`default browser zoom`,onClick:()=>i({browserDefaultZoomFactor:1})}):null,t[1]=n,t[2]=i,t[3]=r,t[4]=o):o=t[4];let s=String(r),c;t[5]===i?c=t[6]:(c=e=>{let t=te.find(t=>String(t)===e);t!==void 0&&i({browserDefaultZoomFactor:t})},t[5]=i,t[6]=c);let l;t[7]===r?l=t[8]:(l=pn(r),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Q.jsx)(ue,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser zoom`,children:(0,Q.jsx)(oe,{children:l})}),t[9]=l,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(ce,{align:`end`,alignItemWithTrigger:!1,children:te.map(wn)}),t[11]=d):d=t[11];let f;t[12]!==n||t[13]!==s||t[14]!==c||t[15]!==u?(f=(0,Q.jsxs)(U,{disabled:n,value:s,onValueChange:c,children:[u,d]}),t[12]=n,t[13]=s,t[14]=c,t[15]=u,t[16]=f):f=t[16];let p;return t[17]!==o||t[18]!==f?(p=(0,Q.jsx)(Y,{...a,description:`Page zoom applied to new browser tabs.`,resetAction:o,control:f}),t[17]=o,t[18]=f,t[19]=p):p=t[19],p}function wn(e){return(0,Q.jsx)(H,{hideIndicator:!0,value:String(e),children:pn(e)},e)}function Tn(e){return e.browserDefaultZoomFactor}function En(e){let t=(0,Z.c)(18),{disabled:n}=e,r=K(On),i=q(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=X(`browser-default-appearance`),t[0]=a):a=t[0];let o;t[1]!==r||t[2]!==n||t[3]!==i?(o=!n&&r!==`system`?(0,Q.jsx)(nt,{label:`default browser appearance`,onClick:()=>i({browserDefaultAppearance:S})}):null,t[1]=r,t[2]=n,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>{(e===`system`||e===`light`||e===`dark`)&&i({browserDefaultAppearance:e})},t[5]=i,t[6]=s);let c=fn[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(ue,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser appearance`,children:(0,Q.jsx)(oe,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(ce,{align:`end`,alignItemWithTrigger:!1,children:Object.entries(fn).map(Dn)}),t[9]=u):u=t[9];let d;t[10]!==r||t[11]!==n||t[12]!==s||t[13]!==l?(d=(0,Q.jsxs)(U,{disabled:n,value:r,onValueChange:s,children:[l,u]}),t[10]=r,t[11]=n,t[12]=s,t[13]=l,t[14]=d):d=t[14];let f;return t[15]!==o||t[16]!==d?(f=(0,Q.jsx)(Y,{...a,description:`The color scheme pages are told to prefer. System follows your OS setting.`,resetAction:o,control:d}),t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function Dn(e){let[t,n]=e;return(0,Q.jsx)(H,{hideIndicator:!0,value:t,children:n},t)}function On(e){return e.browserDefaultAppearance}function kn(e){let t=(0,Z.c)(17),{disabled:n}=e,r=K(jn),i=K(An),a=q(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=X(`browser-recording-key-presses`),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=e=>a({browserRecordingShowKeyPresses:!!e}),t[1]=a,t[2]=s);let c;t[3]!==n||t[4]!==r||t[5]!==s?(c=(0,Q.jsx)(Y,{...o,description:`Show pressed keys and shortcuts in new recordings. Password fields are excluded.`,control:(0,Q.jsx)(mt,{disabled:n,checked:r,"aria-label":`Show key presses in recordings`,onCheckedChange:s})}),t[3]=n,t[4]=r,t[5]=s,t[6]=c):c=t[6];let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=X(`browser-recording-mouse-presses`),t[7]=l):l=t[7];let u;t[8]===a?u=t[9]:(u=e=>a({browserRecordingShowMousePresses:!!e}),t[8]=a,t[9]=u);let d;t[10]!==n||t[11]!==i||t[12]!==u?(d=(0,Q.jsx)(Y,{...l,description:`Highlight mouse presses and held buttons in new recordings.`,control:(0,Q.jsx)(mt,{disabled:n,checked:i,"aria-label":`Show mouse presses in recordings`,onCheckedChange:u})}),t[10]=n,t[11]=i,t[12]=u,t[13]=d):d=t[13];let f;return t[14]!==c||t[15]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[c,d]}),t[14]=c,t[15]=d,t[16]=f):f=t[16],f}function An(e){return e.browserRecordingShowMousePresses}function jn(e){return e.browserRecordingShowKeyPresses}function Mn(e){let t=(0,Z.c)(18),{disabled:n}=e,r=K(Pn),i=q(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=X(`browser-recording-frame-rate`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==r||t[3]!==i?(o=!n&&r!==30?(0,Q.jsx)(nt,{label:`browser recording frame rate`,onClick:()=>i({browserRecordingFrameRate:30})}):null,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s=String(r),c;t[5]===i?c=t[6]:(c=e=>{let t=P.find(t=>String(t)===e);t!==void 0&&i({browserRecordingFrameRate:t})},t[5]=i,t[6]=c);let l;t[7]===r?l=t[8]:(l=(0,Q.jsx)(ue,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Browser recording frame rate`,children:(0,Q.jsxs)(oe,{children:[r,` fps`]})}),t[7]=r,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(ce,{align:`end`,alignItemWithTrigger:!1,children:P.map(Nn)}),t[9]=u):u=t[9];let d;t[10]!==n||t[11]!==s||t[12]!==c||t[13]!==l?(d=(0,Q.jsxs)(U,{disabled:n,value:s,onValueChange:c,children:[l,u]}),t[10]=n,t[11]=s,t[12]=c,t[13]=l,t[14]=d):d=t[14];let f;return t[15]!==o||t[16]!==d?(f=(0,Q.jsx)(Y,{...a,description:`Maximum recording rate. 30 fps saves CPU and storage; 60 fps is smoother.`,resetAction:o,control:d}),t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function Nn(e){return(0,Q.jsxs)(H,{hideIndicator:!0,value:String(e),children:[e,` fps`]},e)}function Pn(e){return e.browserRecordingFrameRate}var Fn={system:`Your default browser`,app:`P4 Code`};function In(e){let t=(0,Z.c)(19),{disabled:n}=e,r=K(Rn),i=q(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=X(`browser-link-target`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==r||t[3]!==i?(o=!n&&r!==`system`?(0,Q.jsx)(nt,{label:`link target`,onClick:()=>i({browserLinkTarget:x})}):null,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>{(e===`system`||e===`app`)&&i({browserLinkTarget:e})},t[5]=i,t[6]=s);let c=Fn[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(ue,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Open links in`,children:(0,Q.jsx)(oe,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.keys(Fn),t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(ce,{align:`end`,alignItemWithTrigger:!1,children:u.map(Ln)}),t[10]=d):d=t[10];let f;t[11]!==n||t[12]!==r||t[13]!==s||t[14]!==l?(f=(0,Q.jsxs)(U,{disabled:n,value:r,onValueChange:s,children:[l,d]}),t[11]=n,t[12]=r,t[13]=s,t[14]=l,t[15]=f):f=t[15];let p;return t[16]!==o||t[17]!==f?(p=(0,Q.jsx)(Y,{...a,description:`Where links in the chat and terminal open. Hold ⌘ or Ctrl while clicking a link to open it in your default browser either way.`,resetAction:o,control:f}),t[16]=o,t[17]=f,t[18]=p):p=t[18],p}function Ln(e){return(0,Q.jsx)(H,{hideIndicator:!0,value:e,children:Fn[e]},e)}function Rn(e){return e.browserLinkTarget}function zn(){let e=(0,Z.c)(7),{search:t,environment:n}=Xe(),r=$e(),i=n?.connection.phase===`connected`&&n.serverConfig!==null?n.environmentId:null,a;e[0]===t?a=e[1]:(a=JSON.stringify(t),e[0]=t,e[1]=a);let o=`${i}:${a}`,s;return e[2]!==i||e[3]!==r.enableAgentDeviceAccess||e[4]!==r.enableDeviceSupport||e[5]!==o?(s=(0,Q.jsx)(rt,{id:`devices`,title:`Devices`,children:(0,Q.jsx)(Bn,{environmentId:i,enabled:r.enableDeviceSupport,agentAccessEnabled:r.enableAgentDeviceAccess},o)}),e[2]=i,e[3]=r.enableAgentDeviceAccess,e[4]=r.enableDeviceSupport,e[5]=o,e[6]=s):s=e[6],s}function Bn({environmentId:e,enabled:t,agentAccessEnabled:n}){let r=J(e,l),{state:i,loaded:a}=Ne(e),{scope:o,environments:s,connectedEnvironments:c}=Xe(),u=Qe(),d=o.kind===`project`||o.kind===`checkout`,f=c.some(e=>e.serverConfig?.settings.enableDeviceSupport),p=ye(Pe.configure,{reportFailure:!1}),m=ye(Pe.list,{reportFailure:!1}),[h,g]=(0,$.useState)(null),_=i.hostStatus===`installing`||i.hostStatus===`starting`,v=i.hosts.some(e=>e.kind===`local`&&!e.platforms.some(e=>e.available)),[y,b]=(0,$.useState)(!1);y&&!t&&b(!1),t&&!y&&(i.hostStatus===`ready`||v)&&h!==`hub`&&b(!0);let x=async(t,n)=>{if(e&&ve(e,`settings:write`)){g(t);try{let e=await Promise.allSettled(s.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!ve(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return p({environmentId:e.environmentId,input:{...n,...n.enabled?{onboardingCompleted:!0}:{}}})})),t=s.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});t.length>0&&W.add({type:`error`,title:`Device settings not saved on all environments`,description:`Could not update ${t.map(e=>e.label).join(`, `)}.`})}finally{g(null)}}},[S,C]=(0,$.useState)(null),w=i.hosts.find(e=>e.kind===`local`)?.tools,T=t=>{let n=w?.[t],r=n&&!n.installedVersions.includes(n.requiredVersion);return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[i.supportsToolUpdate&&r?(0,Q.jsx)(O,{size:`sm`,disabled:!e||h!==null||_,onClick:()=>{e&&(C(null),g(`update-${t}`),m({environmentId:e,input:{updateTool:t}}).then(e=>{e._tag===`Failure`&&C({tool:t,message:`Update failed. Check this host's network connection and try again.`})}).finally(()=>g(null)))},children:h===`update-${t}`?`Updating…`:`Update to v${n.requiredVersion}`}):null,i.supportsToolInspection?(0,Q.jsx)(O,{size:`sm`,variant:`outline`,disabled:!e||h!==null||_,onClick:()=>{e&&(g(`check`),m({environmentId:e,input:{inspectOnly:!0}}).finally(()=>g(null)))},children:h===`check`?`Checking…`:`Check versions`}):null]}),S?.tool===t?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:S.message}):null]})};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Y,{...X(`device-hub`),serverScoped:!0,settingKeys:[`enableDeviceSupport`],description:ze,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xt,{action:T(`hub`),kind:`hub`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),h===`hub`?(0,Q.jsx)(Re,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(_t,{settingKeys:[`enableDeviceSupport`],checked:t,disabled:!r||d||!a||!e||_||h!==null,"aria-label":`Device hub`,onCheckedChange:e=>void x(`hub`,{enabled:!!e,...e?{}:{agentAccessEnabled:!1}})})]})}),(0,Q.jsx)(He,{children:y?(0,Q.jsx)(Y,{...X(`device-platform-support`),description:c.length>1?`Status for ${c.find(t=>t.environmentId===e)?.label}. Select an environment to inspect its simulator support.`:void 0,status:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2`,children:[(0,Q.jsx)(Le,{compact:!0,platform:`iOS`,status:Be(i,`ios`)}),(0,Q.jsx)(Le,{compact:!0,platform:`Android`,status:Be(i,`android`)})]}),control:(0,Q.jsx)(O,{size:`sm`,variant:`outline`,disabled:!e||!t||_||h!==null,onClick:()=>{e&&(g(`check`),m({environmentId:e,input:{}}).finally(()=>g(null)))},children:h===`check`?`Checking…`:`Refresh`})}):null}),(0,Q.jsx)(Y,{...X(`agent-device-access`),serverScoped:!0,settingKeys:[`enableAgentDeviceAccess`],description:Fe,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xt,{action:T(`agent`),kind:`agent`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),h===`agent`?(0,Q.jsx)(Ve,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(_t,{settingKeys:[`enableAgentDeviceAccess`],checked:n,disabled:!r||c.length===0||!d&&(!a||!f||_)||h!==null,"aria-label":`Agent device access`,onCheckedChange:e=>d?u({enableAgentDeviceAccess:!!e}):void x(`agent`,{agentAccessEnabled:!!e})})]})}),e?(0,Q.jsx)(Ie,{state:{...i,hosts:i.hosts.filter(e=>e.kind===`local`)},environmentId:e}):null,(0,Q.jsx)(Pt,{environmentId:e})]})}function Vn(e){let t=(0,Z.c)(14),{disabled:n}=e,r=K(Hn),i=q(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=X(`browser-auto-show-floating-preview`),t[0]=a):a=t[0];let o;t[1]!==r||t[2]!==n||t[3]!==i?(o=!n&&r!==!0?(0,Q.jsx)(nt,{label:`auto-show floating preview`,onClick:()=>i({browserAutoShowFloatingPreview:!0})}):null,t[1]=r,t[2]=n,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>i({browserAutoShowFloatingPreview:!!e}),t[5]=i,t[6]=s);let c;t[7]!==r||t[8]!==n||t[9]!==s?(c=(0,Q.jsx)(mt,{disabled:n,checked:r,onCheckedChange:s,"aria-label":`Auto-show floating preview`}),t[7]=r,t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;return t[11]!==o||t[12]!==c?(l=(0,Q.jsx)(Y,{...a,description:`Show the floating preview when an agent opens a browser or device unless the agent says otherwise.`,resetAction:o,control:c}),t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function Hn(e){return e.browserAutoShowFloatingPreview}function Un({disabled:e}){let t=K(e=>e.browserProfiles),i=K(e=>e.browserDefaultProfileId),a=he(),s=q(),{environments:c,isReady:l}=pe(),u=fe(),[d,f]=(0,$.useState)(null),[g,v]=(0,$.useState)(null),[y,x]=(0,$.useState)(null),[S,C]=(0,$.useState)(null),[w,E]=(0,$.useState)(null),[k,A]=(0,$.useState)(!1),j=ie(),M=ye(Ge.clearProfile,{reportFailure:!1}),P={environmentIds:c.map(e=>e.environmentId).filter(e=>j.get(e)?.environment.capabilities.serverBrowser===!0),clear:async(e,t)=>{let n=await M({environmentId:e,input:{profileId:t}});if(n._tag===`Failure`)throw re(n)}},L=ln(st!==null,l,c.length,P.environmentIds.length),R=(0,$.useRef)(!1),[te,ae]=(0,$.useState)(!1),B=e||!a,V=p(t).filter(e=>e.kind!==`incognito`),H=r(V,i)?.id??`default`,oe=e=>{if(!a||R.current)return;let t=G().browserProfiles;if(t.length>=24)return;let n=p(t),r=new Set(n.map(e=>e.name)),i=e;for(let t=2;r.has(i);t+=1)i=`${e} ${t}`;let o={id:`profile-${D()}`,name:i,kind:`persistent`};return s({browserProfiles:[...t,o]}),o},se=(e,t)=>{if(!a||R.current)return;let n=t.trim().slice(0,48);if(n===``)return;let r=G().browserProfiles;s({browserProfiles:r.map(t=>t.id===e?{...t,name:n}:t)})},ce=(e,t)=>{if(a&&!R.current){if(!L){W.add({type:`error`,title:`Could not clear ${t}'s data`,description:`You're not connected to a server yet.`});return}cn(st,c.map(e=>e.environmentId),e,P).then(()=>{W.add({type:`success`,title:`Cleared ${t}'s cookies and cache`})}).catch(()=>{W.add({type:`error`,title:`Could not clear ${t}'s data`})})}},le=async e=>{if(!a||R.current)return;if(!L){E(`Connect to an environment before removing this profile.`);return}E(null),A(!0);try{await cn(st,l?c.map(e=>e.environmentId):[],e,P)}catch{E(`Profile data could not be deleted. Try again.`),A(!1);return}let t=G();s({browserProfiles:t.browserProfiles.filter(t=>t.id!==e),...t.browserDefaultProfileId===e?{browserDefaultProfileId:ee}:{}}),A(!1),x(null)},ue=(d??[]).filter(e=>e.unavailable!==`notInstalled`&&e.unavailable!==`unsupportedPlatform`),U=(0,$.useCallback)(()=>{st&&st.listBrowserImportSources().then(f).catch(()=>f(e=>e??[]))},[]),de=async(e,t,n)=>{if(!st||!a)return{kind:`blocked`,reason:`sessionUnavailable`};if(n.target.kind===`existing`&&!p(G().browserProfiles).some(e=>e.id===n.target.profileId)||R.current)return{kind:`blocked`,reason:`readFailed`};R.current=!0,ae(!0);try{let r=await st.importBrowserCookies({environmentId:t,sourceId:e.id,sourceProfileDirectory:n.sourceProfileDirectory,targetProfileId:n.target.profileId});if(n.target.kind===`existing`&&!p(G().browserProfiles).some(e=>e.id===n.target.profileId))return{kind:`blocked`,reason:`readFailed`};let i;if(n.target.kind===`new`){if(r.imported>0)try{i=(await ge(t=>{if(t.browserProfiles.find(e=>e.id===n.target.profileId))return t;if(t.browserProfiles.length>=24)throw new mn;let r=new Set(p(t.browserProfiles).map(e=>e.name)),i=e.name;for(let t=2;r.has(i);t+=1)i=`${e.name} ${t}`;return{...t,browserProfiles:[...t.browserProfiles,{id:n.target.profileId,name:i,kind:`persistent`}]}})).browserProfiles.find(e=>e.id===n.target.profileId)?.name??e.name}catch(r){await cn(st,[t],n.target.profileId).catch(()=>void 0);let i=r instanceof mn?`profileLimitReached`:`profileNotSaved`;throw Error(`Importing cookies from ${e.id} failed: ${i}.`,{cause:r})}else i=e.name}else i=n.target.name;return{kind:`imported`,imported:r.imported,skipped:r.skipped,skippedDomains:r.skippedDomains,targetName:i}}catch(e){return{kind:`blocked`,reason:hn(e)}}finally{R.current=!1,ae(!1)}},_e=async e=>{if(st)try{let t=await st.listBrowserImportSources();return f(t),t.find(t=>t.id===e)}catch{return}},J=t.length>=24;return(0,Q.jsxs)(Y,{...X(`browser-profiles`),description:`Profiles separate cookies and logins. Incognito data is cleared when the app closes.`,control:(0,Q.jsxs)(N,{onOpenChange:e=>e&&U(),children:[(0,Q.jsxs)(b,{render:(0,Q.jsx)(O,{size:`sm`,variant:`outline`,disabled:B||te}),children:[(0,Q.jsx)(ne,{}),`Add profile`]}),(0,Q.jsxs)(n,{align:`end`,children:[(0,Q.jsx)(_,{disabled:!a||J,onClick:()=>oe(`New profile`),children:`Blank profile`}),J?(0,Q.jsx)(_,{disabled:!0,children:`You’ve reached the profile limit`}):null,(0,Q.jsx)(F,{}),(0,Q.jsxs)(h,{children:[(0,Q.jsx)(m,{children:`Import from`}),d===null?(0,Q.jsx)(_,{disabled:!0,children:`Looking for browsers…`}):ue.length===0?(0,Q.jsx)(_,{disabled:!0,children:`No supported browsers found`}):(0,Q.jsxs)(Q.Fragment,{children:[ue.map(e=>(0,Q.jsx)(_,{disabled:!a||u==null,onClick:()=>{a&&u!=null&&v({source:e,environmentId:u.environmentId,environmentName:Ze({isPrimary:!0,environmentId:u.environmentId,runtimeLabel:u.label})})},children:e.name},e.id)),u==null?(0,Q.jsx)(_,{disabled:!0,children:`Connect to an environment to import cookies`}):null]})]})]})]}),children:[(0,Q.jsx)(`div`,{className:`mt-2 mb-2 overflow-hidden rounded-lg border border-border/60`,children:V.map((e,t)=>{let r=z(e.id),i=e.id===H;return(0,Q.jsxs)(`div`,{className:I(`flex items-center gap-3 px-3 py-2`,t>0&&`border-t border-border/60`),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[r?(0,Q.jsx)(`span`,{className:I(`truncate text-sm text-foreground`,B&&`opacity-64`),children:e.name}):(0,Q.jsx)(gt,{nativeInput:!0,size:`sm`,className:`w-full max-w-56`,"aria-label":`Rename ${e.name}`,disabled:B||te,maxLength:48,value:e.name,onCommit:t=>se(e.id,t)}),i?(0,Q.jsx)(`span`,{className:I(`flex`,B&&`opacity-64`),children:(0,Q.jsx)(o,{children:`Default`})}):null]}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(b,{render:(0,Q.jsx)(O,{size:`icon-xs`,variant:`ghost-muted`,disabled:B||te,"aria-label":`${e.name} options`}),children:(0,Q.jsx)(T,{})}),(0,Q.jsxs)(n,{align:`end`,children:[(0,Q.jsx)(_,{disabled:!a||i,onClick:()=>{a&&s({browserDefaultProfileId:e.id})},children:`Set as default`}),(0,Q.jsx)(_,{disabled:!a||!L,onClick:()=>{P.environmentIds.length>0?C(e):ce(e.id,e.name)},children:`Clear cookies and cache`}),r?null:(0,Q.jsx)(_,{variant:`destructive`,disabled:!a||!L,onClick:()=>{a&&x(e)},children:`Remove profile and data`}),L?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(F,{}),(0,Q.jsx)(_,{disabled:!0,children:l?`Connect to an environment to clear profile data`:`Checking environments…`})]})]})]})]},e.id)})}),(0,Q.jsx)(at,{open:y!==null,onOpenChange:e=>{!e&&!k&&(x(null),E(null))},children:(0,Q.jsxs)(ct,{children:[(0,Q.jsxs)(ft,{children:[(0,Q.jsxs)(lt,{children:[`Remove “`,y?.name,`”?`]}),(0,Q.jsx)(pt,{children:`Its cookies and logins are deleted. Desktop tabs already open in this profile stay open until you close them; server browser tabs close now.`}),w?(0,Q.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-destructive`,children:w}):null,L?null:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect to an environment to remove this profile and its data.`})]}),(0,Q.jsxs)(it,{children:[(0,Q.jsx)(ut,{disabled:k,render:(0,Q.jsx)(O,{variant:`outline`,disabled:k}),children:`Cancel`}),(0,Q.jsx)(O,{variant:`destructive`,disabled:k||!a||!L,onClick:()=>{y&&a&&L&&le(y.id)},children:k?`Removing…`:`Remove profile`})]})]})}),(0,Q.jsx)(at,{open:S!==null,onOpenChange:e=>{e||C(null)},children:(0,Q.jsxs)(ct,{children:[(0,Q.jsxs)(ft,{children:[(0,Q.jsxs)(lt,{children:[`Clear “`,S?.name,`”’s cookies and cache?`]}),(0,Q.jsx)(pt,{children:`You are signed out of its sites. Server browser tabs open in this profile close now.`})]}),(0,Q.jsxs)(it,{children:[(0,Q.jsx)(ut,{render:(0,Q.jsx)(O,{variant:`outline`}),children:`Cancel`}),(0,Q.jsx)(O,{variant:`destructive`,onClick:()=>{S&&ce(S.id,S.name),C(null)},children:`Clear data`})]})]})}),g?(0,Q.jsx)(Jt,{source:g.source,destinationEnvironmentName:g.environmentName,targetProfiles:V.map(e=>({id:e.id,name:e.name})),canCreateProfile:a&&!J,onImport:e=>de(g.source,g.environmentId,e),onRefreshSource:()=>_e(g.source.id),onCheckFullDiskAccess:window.desktopBridge?.checkSystemPermission?()=>window.desktopBridge.checkSystemPermission(`full-disk-access`):void 0,onOpenFullDiskAccessSettings:async()=>{await me()?.shell.openSystemSettings(`full-disk-access`).catch(()=>{W.add({type:`error`,title:`Could not open System Settings`,description:`Open Privacy & Security → Full Disk Access manually.`})})},onClose:()=>v(null)}):null]})}function Wn(){let e=(0,Z.c)(3),t=!be,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Un,{disabled:t}),(0,Q.jsx)(bn,{disabled:t}),(0,Q.jsx)(Cn,{disabled:t}),(0,Q.jsx)(En,{disabled:t}),(0,Q.jsx)(Mn,{disabled:t}),(0,Q.jsx)(kn,{disabled:t}),(0,Q.jsx)(In,{disabled:t}),(0,Q.jsx)(Vn,{disabled:t})]}),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(ht,{category:`integrations`}),e[1]=i):i=e[1];let a;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(tt,{children:[i,(0,Q.jsx)(rt,{id:`browser`,title:`Browser`,children:t?(0,Q.jsx)(et,{message:`Only available in the desktop app.`,children:r}):r}),(0,Q.jsx)(zn,{})]}),e[2]=a):a=e[2],a}var Gn=Wn;export{Gn as component};
2
- //# sourceMappingURL=settings.integrations-CgxBXw6p.js.map