@p4code/cli 0.9.23 → 0.9.24

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 (195) hide show
  1. package/dist/{TraceDiagnostics-DY_cYrzB.mjs → TraceDiagnostics-Dk5M3WAT.mjs} +2 -2
  2. package/dist/bin.mjs +1 -1
  3. package/dist/{binCli-Bou3rWgW.mjs → binCli-CBzw8eZx.mjs} +5 -5
  4. package/dist/client/.vite/manifest.json +1106 -1106
  5. package/dist/client/assets/{2NI2N5EU-B3GKfpTJ.js → 2NI2N5EU-Dz1H18lO.js} +2 -2
  6. package/dist/client/assets/{4UO7MD6I-D1jV-2l8.js → 4UO7MD6I-DxZW-JIQ.js} +2 -2
  7. package/dist/client/assets/{5B3SVYGG-CiUCamIk.js → 5B3SVYGG-Cl2owg_V.js} +2 -2
  8. package/dist/client/assets/{5GK6JWQ2-t3RHg90Y.js → 5GK6JWQ2-A0G_mE3E.js} +2 -2
  9. package/dist/client/assets/{5N7A7DKN-QVdNnUVu.js → 5N7A7DKN-Bd00cghV.js} +2 -2
  10. package/dist/client/assets/{5OC2THR4-CxE7bwzV.js → 5OC2THR4-ytZLjDMp.js} +2 -2
  11. package/dist/client/assets/{5S6HY5KT-msIIAX0G.js → 5S6HY5KT-XbqbgHxv.js} +2 -2
  12. package/dist/client/assets/{6IMQ5BUJ-BzYnQ5qg.js → 6IMQ5BUJ-BtndAY2_.js} +2 -2
  13. package/dist/client/assets/{6OLKWJ4F-AQyY5TLk.js → 6OLKWJ4F-DNXmh00R.js} +2 -2
  14. package/dist/client/assets/{74OO7NKP-CCpQBxNH.js → 74OO7NKP-DbprmlDc.js} +2 -2
  15. package/dist/client/assets/{75O6YZUN-D3WwLu8s.js → 75O6YZUN-DZ_5zRwt.js} +2 -2
  16. package/dist/client/assets/{77XECAW3-C6PMMrkh.js → 77XECAW3-CgSkQSMJ.js} +2 -2
  17. package/dist/client/assets/{ABYRPUBD-BmXVPnuD.js → ABYRPUBD-ucE-F8EO.js} +2 -2
  18. package/dist/client/assets/{AuthSurfaceShell-DDT8iJWE.js → AuthSurfaceShell-DqI-KrrY.js} +2 -2
  19. package/dist/client/assets/{BB2UYUI2-C_DXRsEF.js → BB2UYUI2-CXw0vAgW.js} +2 -2
  20. package/dist/client/assets/{BUM34MOA-sLk4tJuF.js → BUM34MOA-DBHGisGU.js} +2 -2
  21. package/dist/client/assets/{CEQABKGZ-DsLeCUfk.js → CEQABKGZ-MGn88wbo.js} +2 -2
  22. package/dist/client/assets/{CXAC5362-6czpP5mH.js → CXAC5362-C1Fk1A6g.js} +2 -2
  23. package/dist/client/assets/{ChatGptUsageButton-BElkMe1K.js → ChatGptUsageButton-_JZfpkEi.js} +2 -2
  24. package/dist/client/assets/{ChatMarkdown-pRUIhpGi.js → ChatMarkdown-DO_2fTqM.js} +5 -5
  25. package/dist/client/assets/{CodexSetupSection.logic-3MrEmFzD.js → CodexSetupSection.logic-B8uhmM78.js} +2 -2
  26. package/dist/client/assets/{CommandBlock-DUs3JB3r.js → CommandBlock-BJ2nHWe_.js} +2 -2
  27. package/dist/client/assets/{ConnectAgentSurface-BG30oBmC.js → ConnectAgentSurface-kcWh3f_f.js} +2 -2
  28. package/dist/client/assets/{DRLTVNUE-CAWKPVio.js → DRLTVNUE-CmpBRyx_.js} +2 -2
  29. package/dist/client/assets/{DYY6UVD2-HB9mYAbb.js → DYY6UVD2-rvY-xhxe.js} +2 -2
  30. package/dist/client/assets/{DevicePanel-BAT6BS-V.js → DevicePanel-Bkrn90hU.js} +2 -2
  31. package/dist/client/assets/{DeviceSetup-ClD1wdY1.js → DeviceSetup-BQvNWMm0.js} +2 -2
  32. package/dist/client/assets/{DiffCommentAnnotation-BjI2rZNS.js → DiffCommentAnnotation-eHSeIufV.js} +2 -2
  33. package/dist/client/assets/{DiffFileTree-C6VB4VCo.js → DiffFileTree-opfyNeFz.js} +2 -2
  34. package/dist/client/assets/{DiffPanel-pkAdnqL7.js → DiffPanel-C4ySgbUg.js} +2 -2
  35. package/dist/client/assets/{DiffWorkerPoolProvider-CPwS1D4h.js → DiffWorkerPoolProvider-BwOTmWKP.js} +2 -2
  36. package/dist/client/assets/{EmbeddedDesign-DOevokgh.js → EmbeddedDesign-BW5Rcxmc.js} +4 -4
  37. package/dist/client/assets/{FNOVOB4O-BkKBPKb-.js → FNOVOB4O-B8vuCGFt.js} +2 -2
  38. package/dist/client/assets/{FileDiff-CdxU7jjH.js → FileDiff-CZk9prBc.js} +2 -2
  39. package/dist/client/assets/{FilePreviewPanel-Bz8HETIa.js → FilePreviewPanel-BcCGkQ__.js} +2 -2
  40. package/dist/client/assets/{FoldedSettingsSection-IyrJlpO8.js → FoldedSettingsSection-COBhgfnb.js} +2 -2
  41. package/dist/client/assets/{HDGCDEEZ-BW-K6GhK.js → HDGCDEEZ-DRcTM9ws.js} +2 -2
  42. package/dist/client/assets/{HSJLKHB7-B8h6fviS.js → HSJLKHB7-Dh4X6CJ4.js} +2 -2
  43. package/dist/client/assets/{IntervalSecondsField-BaJ1qNX-.js → IntervalSecondsField-D0j2uU5s.js} +2 -2
  44. package/dist/client/assets/JZOYTAAL-BCzM9Qh2.js +1 -0
  45. package/dist/client/assets/{K3MD6TGW-BTpBxr8x.js → K3MD6TGW-uz2CK9vb.js} +2 -2
  46. package/dist/client/assets/{K7RP3OMA-DcsmGbRM.js → K7RP3OMA-uWbuKqQP.js} +2 -2
  47. package/dist/client/assets/{LHDIQX7Q-NOcjEUQY.js → LHDIQX7Q-BaUgpa7I.js} +2 -2
  48. package/dist/client/assets/{LUXOKEGN-BWJqFZst.js → LUXOKEGN-C-Usmwyz.js} +2 -2
  49. package/dist/client/assets/{LinkMachineSelect-Dp6FC1LE.js → LinkMachineSelect-CB99X8v3.js} +2 -2
  50. package/dist/client/assets/{MathTypeset-DHPwWtff.js → MathTypeset-Dv2b-uiV.js} +2 -2
  51. package/dist/client/assets/{ModelLiveLayer-D3x6mJFP.js → ModelLiveLayer-DIrV--mW.js} +3 -3
  52. package/dist/client/assets/{N3JZAHOW-oDX5VWgR.js → N3JZAHOW-CLD7n6Za.js} +2 -2
  53. package/dist/client/assets/{NUIALGQ3-DbqxE7KO.js → NUIALGQ3-CVI_F8c-.js} +2 -2
  54. package/dist/client/assets/{NoProjectsHero-Dk-rv5RI.js → NoProjectsHero-CAoW0Xej.js} +2 -2
  55. package/dist/client/assets/{O65XPQGZ-Cys4qXjc.js → O65XPQGZ-g6xpsO0r.js} +2 -2
  56. package/dist/client/assets/{O7XIQ6OM-aLdTRbRJ.js → O7XIQ6OM-CBkPdCIB.js} +2 -2
  57. package/dist/client/assets/{OFQON5FD-DpC8rm9Y.js → OFQON5FD-DpM-bsDn.js} +2 -2
  58. package/dist/client/assets/{P4ConnectAccountPages-C-GbG9lk.js → P4ConnectAccountPages-CCjWOetO.js} +2 -2
  59. package/dist/client/assets/{P4ConnectSidebarSignIn-DepXmk4f.js → P4ConnectSidebarSignIn-CfEPRRB6.js} +2 -2
  60. package/dist/client/assets/{PJQHF43J-CUbFewuD.js → PJQHF43J-Sp1j42CR.js} +2 -2
  61. package/dist/client/assets/{PanelLayoutControls-CKWjLO_e.js → PanelLayoutControls-CcdUv-ij.js} +4 -4
  62. package/dist/client/assets/{PierreEntryIcon-CVKV5qfT.js → PierreEntryIcon-vf9Z0_eJ.js} +2 -2
  63. package/dist/client/assets/{PreviewPanel-B-ty1_ZL.js → PreviewPanel-DIVx5x1H.js} +2 -2
  64. package/dist/client/assets/{ProjectDefaultsSettings-vF_5kxVM.js → ProjectDefaultsSettings-TlEARfjk.js} +2 -2
  65. package/dist/client/assets/{ProjectFavicon-BEsCcLjN.js → ProjectFavicon-Dd4p_a9n.js} +3 -3
  66. package/dist/client/assets/{ProjectIconPickerDialog-D1_gSlWW.js → ProjectIconPickerDialog-D5UkwTkD.js} +2 -2
  67. package/dist/client/assets/{ProviderAuthTerminal-cNp7I_XV.js → ProviderAuthTerminal-Cw2WcQr1.js} +2 -2
  68. package/dist/client/assets/{ProviderModelPicker-CCCH-TiQ.js → ProviderModelPicker-rRVcFLyP.js} +2 -2
  69. package/dist/client/assets/{ProviderSettingsForm-CV7sAQy3.js → ProviderSettingsForm-DaeugImp.js} +2 -2
  70. package/dist/client/assets/{PullRequestCodeTab-DjChxC-1.js → PullRequestCodeTab-DdfQeIIl.js} +2 -2
  71. package/dist/client/assets/{RHNBAITX-CEZ1jYAC.js → RHNBAITX-DQfv99hf.js} +2 -2
  72. package/dist/client/assets/{ReadOnlySourcePreview-Dw9TzXZ2.js → ReadOnlySourcePreview-Vvv9UVOM.js} +2 -2
  73. package/dist/client/assets/{RenderErrorBoundary-Dbb6Gs8P.js → RenderErrorBoundary-4-dgp9K8.js} +2 -2
  74. package/dist/client/assets/{SLD4V6NK-BXmFkBHB.js → SLD4V6NK-BKBt5rH4.js} +2 -2
  75. package/dist/client/assets/{ScheduledTasksSettings-TjoGUXvC.js → ScheduledTasksSettings-Dbz9TZ6o.js} +2 -2
  76. package/dist/client/assets/{ScopedSwitch-C8qSHRkU.js → ScopedSwitch-D1e9m-dH.js} +2 -2
  77. package/dist/client/assets/{SelfImproveSettingsSection-BhUO-XvV.js → SelfImproveSettingsSection-WXBG9l_4.js} +2 -2
  78. package/dist/client/assets/{SettingsPanels-DFPZUI9O.js → SettingsPanels-BEtJwC6n.js} +2 -2
  79. package/dist/client/assets/{SettingsPanels.logic-5bLleFhd.js → SettingsPanels.logic-y95n8OOO.js} +2 -2
  80. package/dist/client/assets/{SettingsScopeNotice-VgBZL2zg.js → SettingsScopeNotice-DE1t1kw-.js} +2 -2
  81. package/dist/client/assets/{SidebarStageBackdrop-DvPzZM_j.js → SidebarStageBackdrop-CYLpofvt.js} +2 -2
  82. package/dist/client/assets/{T3PCR2KE-bp9TnTiq.js → T3PCR2KE-BryFgp5Q.js} +2 -2
  83. package/dist/client/assets/{TKWO2OVW-Cyskzdq0.js → TKWO2OVW-DcRjYaVG.js} +2 -2
  84. package/dist/client/assets/{TSHNXIZL-Dp3os6bG.js → TSHNXIZL-hAylFob1.js} +2 -2
  85. package/dist/client/assets/{ThemeEditorPanel-B1RklhEA.js → ThemeEditorPanel-DeGNehj1.js} +2 -2
  86. package/dist/client/assets/{ThreadDetailsItemsMenu-BOMU-3M3.js → ThreadDetailsItemsMenu-D0mfEKtW.js} +4 -4
  87. package/dist/client/assets/{ThreadTerminalDrawer-BmwBVDGv.js → ThreadTerminalDrawer-B77-xYz_.js} +2 -2
  88. package/dist/client/assets/{UQJE5E4I-DDRoojS_.js → UQJE5E4I-BfaZIz58.js} +2 -2
  89. package/dist/client/assets/{USNYFO5S-BvyU-aXY.js → USNYFO5S-jOq8Kcgw.js} +2 -2
  90. package/dist/client/assets/{Virtualizer-DFzJCTxQ.js → Virtualizer-B3FSTwJv.js} +2 -2
  91. package/dist/client/assets/{WEVWDWVA-DTuHUaDF.js → WEVWDWVA-1T3GTRY3.js} +2 -2
  92. package/dist/client/assets/{X5RFHQXM-D9IKIoIk.js → X5RFHQXM-CaiE8-NB.js} +2 -2
  93. package/dist/client/assets/{X62E3GBT-BBXkOa6O.js → X62E3GBT-CKnjYZvp.js} +2 -2
  94. package/dist/client/assets/{XBNEOJTC-D743Jp_H.js → XBNEOJTC-DF-d22o-.js} +2 -2
  95. package/dist/client/assets/{YHV2MVVZ-DZBsjjLM.js → YHV2MVVZ-VSj4WI2u.js} +2 -2
  96. package/dist/client/assets/{YURCZMG2-ByezMSr0.js → YURCZMG2-C9wxlavt.js} +2 -2
  97. package/dist/client/assets/{YVG2LODB-DrsC56GM.js → YVG2LODB-JRtigNQC.js} +2 -2
  98. package/dist/client/assets/{_chat-BrgTPEvH.js → _chat-BA5cbHxE.js} +5 -5
  99. package/dist/client/assets/{_chat.design-CgGDbdSU.js → _chat.design-DxTdYmIe.js} +2 -2
  100. package/dist/client/assets/{_chat.index-BjAR62fj.js → _chat.index-CNIRuBqG.js} +2 -2
  101. package/dist/client/assets/{_chat.new-SjhrzHWl.js → _chat.new-Bw2VR60x.js} +2 -2
  102. package/dist/client/assets/{_chat.pull-requests-BixugchU.js → _chat.pull-requests-C6rdgLS9.js} +2 -2
  103. package/dist/client/assets/{assetUrls-Bn1N9LX7.js → assetUrls-BMizLezw.js} +2 -2
  104. package/dist/client/assets/{assets-Lf7mgwY7.js → assets-DT0KoRIr.js} +2 -2
  105. package/dist/client/assets/{browserHistoryStore-Ciy-Cygo.js → browserHistoryStore-xnY5QhfE.js} +2 -2
  106. package/dist/client/assets/{browserLinkTarget-DKVi8qup.js → browserLinkTarget-CH-4nkAf.js} +2 -2
  107. package/dist/client/assets/{connect-C605Zs89.js → connect-BflmwHyv.js} +2 -2
  108. package/dist/client/assets/connect-agent-AVHGyda5.js +2 -0
  109. package/dist/client/assets/{design-BNHLz8I2.js → design-B_bv-H7n.js} +2 -2
  110. package/dist/client/assets/{device-CwiofvsD.js → device-i4SkE05R.js} +2 -2
  111. package/dist/client/assets/{diffRendering-DJnBG6ZN.js → diffRendering-B7lkQ5_O.js} +2 -2
  112. package/dist/client/assets/{dist-D1XCsn7e.js → dist-BvS7KgJD.js} +2 -2
  113. package/dist/client/assets/{duoViewer-CQpxZewd.js → duoViewer-DbnFva5H.js} +2 -2
  114. package/dist/client/assets/{dynamic-DHrzmb9Z.js → dynamic-DmVpEfW3.js} +2 -2
  115. package/dist/client/assets/{embeddedScripts-D7WC0N_7.js → embeddedScripts-D0-ABFFC.js} +2 -2
  116. package/dist/client/assets/{entities-CjoTQlW3.js → entities-JWl3bvMT.js} +2 -2
  117. package/dist/client/assets/{fileLinks-BZkPwsEY.js → fileLinks-Y3tOmcmb.js} +2 -2
  118. package/dist/client/assets/{fileTreeExpansion-DHPBKDpm.js → fileTreeExpansion-Bp5eLBXI.js} +2 -2
  119. package/dist/client/assets/{getDiffFileInput-D-dpZLfC.js → getDiffFileInput-CKgGUEGl.js} +2 -2
  120. package/dist/client/assets/{index-Cq59P2HC.js → index-DQKD4Lk2.js} +3 -3
  121. package/dist/client/assets/{lazy-BH4rgIwO.js → lazy-C5ansoaW.js} +4 -4
  122. package/dist/client/assets/{linkedPrompt-BTa8Gs9-.js → linkedPrompt-CwNmoWmu.js} +2 -2
  123. package/dist/client/assets/{main-xhw8F2iL.js → main-43D2LVmx.js} +7 -7
  124. package/dist/client/assets/{mediaReference-B7ym_1-U.js → mediaReference-Bh7Pydqp.js} +2 -2
  125. package/dist/client/assets/{mediaSource-GtWYcfeZ.js → mediaSource-Do7lCSv7.js} +2 -2
  126. package/dist/client/assets/{modelScene-uWeIf_CC.js → modelScene-D8CdQkcp.js} +2 -2
  127. package/dist/client/assets/{onboarding-CxDppAGc.js → onboarding-BG6FdUUU.js} +2 -2
  128. package/dist/client/assets/{openFileInPreview-MLuDI8fu.js → openFileInPreview-BaemzSTr.js} +2 -2
  129. package/dist/client/assets/{p4ProjectFile-DlnfrOnm.js → p4ProjectFile-O_tvpvNW.js} +2 -2
  130. package/dist/client/assets/{pair-BJWvIdrD.js → pair-BNIczJXa.js} +2 -2
  131. package/dist/client/assets/{phoneViewer-OFK_ThS_.js → phoneViewer-CqawjVDW.js} +2 -2
  132. package/dist/client/assets/{pierre-icons-BYPQj09G.js → pierre-icons-BfZ11Q2h.js} +2 -2
  133. package/dist/client/assets/{preview-CxFR-vue.js → preview-Dd9kGZBH.js} +2 -2
  134. package/dist/client/assets/{primary-CCmKskNP.js → primary-CDuW5QwW.js} +2 -2
  135. package/dist/client/assets/{primaryCloudLinkState-DDs0gJOh.js → primaryCloudLinkState-BONYlcei.js} +2 -2
  136. package/dist/client/assets/{projectFilesQueryState-DzjMtjuq.js → projectFilesQueryState-Ck4wjfaq.js} +2 -2
  137. package/dist/client/assets/{projectScriptEditor-C2NTRQLs.js → projectScriptEditor-DgVU8tRa.js} +2 -2
  138. package/dist/client/assets/{providerSkills-gNPMp_MW.js → providerSkills-Dfc0PY_E.js} +2 -2
  139. package/dist/client/assets/{pullRequestDetail.logic-BZNLZTdt.js → pullRequestDetail.logic-Dy7e4vh2.js} +2 -2
  140. package/dist/client/assets/{pullRequests-DAMVEVGR.js → pullRequests-BSjV3BBU.js} +2 -2
  141. package/dist/client/assets/{queries-ckipBW-f.js → queries-BQAICaPF.js} +2 -2
  142. package/dist/client/assets/{relay-BLgoNhyd.js → relay-Ceq0htTl.js} +2 -2
  143. package/dist/client/assets/{relayFailureReason-COnjzJFI.js → relayFailureReason-DfHD60Z_.js} +2 -2
  144. package/dist/client/assets/{renderScheduler-BCOEl9SF.js → renderScheduler-BGJGU9W9.js} +2 -2
  145. package/dist/client/assets/{runtime-CbYvES7U.js → runtime-vb0YwEUc.js} +3 -3
  146. package/dist/client/assets/{scheduledTasksSettings.logic-DBMDVdjk.js → scheduledTasksSettings.logic-h-rZbNI3.js} +2 -2
  147. package/dist/client/assets/{server-CEMcTnD1.js → server-Bw1ZPPkk.js} +2 -2
  148. package/dist/client/assets/{session-Ces3Ebxl.js → session-YEQs2e4k.js} +2 -2
  149. package/dist/client/assets/{session-logic-DoE1Q_f_.js → session-logic-BOQRidTa.js} +2 -2
  150. package/dist/client/assets/{settings-DfyN3nPg.js → settings-Dj9xov5g.js} +2 -2
  151. package/dist/client/assets/{settings.appearance-DKdqiS33.js → settings.appearance-BFkpCG_N.js} +2 -2
  152. package/dist/client/assets/settings.archived-D96oQP2t.js +2 -0
  153. package/dist/client/assets/{settings.computer-use-B9Lvx9ml.js → settings.computer-use-Bi6Yznts.js} +2 -2
  154. package/dist/client/assets/{settings.connections-CeVMC9_Q.js → settings.connections-C7OGFqf1.js} +2 -2
  155. package/dist/client/assets/{settings.data-controls-C50d8Y1p.js → settings.data-controls-CMPajamk.js} +2 -2
  156. package/dist/client/assets/{settings.decisions-IKWdsPJP.js → settings.decisions-BaYWexvw.js} +2 -2
  157. package/dist/client/assets/{settings.designs-DYK1fORq.js → settings.designs-t7-jewWy.js} +2 -2
  158. package/dist/client/assets/{settings.diagnostics-DDQ_8Jca.js → settings.diagnostics-qkp4kADk.js} +2 -2
  159. package/dist/client/assets/{settings.general-c8Ls4Mz6.js → settings.general-BqeVFfxZ.js} +2 -2
  160. package/dist/client/assets/{settings.integrations-Bx78DSgB.js → settings.integrations-CYmWtYZT.js} +2 -2
  161. package/dist/client/assets/{settings.keybindings-CBhgDtMa.js → settings.keybindings-Rdl8b88k.js} +2 -2
  162. package/dist/client/assets/{settings.open-source-licenses-CgHCMsAt.js → settings.open-source-licenses-C-Brz8iy.js} +2 -2
  163. package/dist/client/assets/{settings.plugins-1AVunwAZ.js → settings.plugins-DAvzBYum.js} +2 -2
  164. package/dist/client/assets/{settings.projects-voo-H787.js → settings.projects-BTKNVvto.js} +3 -3
  165. package/dist/client/assets/{settings.providers-BWjGRXNt.js → settings.providers-r89DCT90.js} +3 -3
  166. package/dist/client/assets/{settings.scheduled-tasks-czvZRhu8.js → settings.scheduled-tasks-Da_-twWT.js} +2 -2
  167. package/dist/client/assets/{settings.secrets-B4BGlz80.js → settings.secrets-B_ZY_xsv.js} +2 -2
  168. package/dist/client/assets/{settings.snap-shot-d8VTC1Lv.js → settings.snap-shot-lnIAMmUa.js} +2 -2
  169. package/dist/client/assets/{settings.source-control-Df0azAck.js → settings.source-control-BIPVuyIo.js} +2 -2
  170. package/dist/client/assets/{settings.storage-CAwfhCbA.js → settings.storage-vvoP_prr.js} +2 -2
  171. package/dist/client/assets/{settingsLayout-D5Mded9h.js → settingsLayout-DaKDuaST.js} +2 -2
  172. package/dist/client/assets/{sidebarProjectGrouping-Dt_irkWm.js → sidebarProjectGrouping-xYoX3lLq.js} +2 -2
  173. package/dist/client/assets/{sourceControl-CgxDQG5w.js → sourceControl-gh0Nj17P.js} +2 -2
  174. package/dist/client/assets/{sourceControlClients-Bg3Of7DX.js → sourceControlClients-C3cHOUoL.js} +2 -2
  175. package/dist/client/assets/{terminal-links-C2FjxVhS.js → terminal-links-CxLXIwP1.js} +2 -2
  176. package/dist/client/assets/{terminalSessions-DBYKcIE6.js → terminalSessions-CXGA3pch.js} +2 -2
  177. package/dist/client/assets/{uiStateStore-B25zCY_s.js → uiStateStore-JOwhQqDV.js} +2 -2
  178. package/dist/client/assets/{usage-DdBC08dx.js → usage-Blib8u_-.js} +2 -2
  179. package/dist/client/assets/{use-atom-command-DWabKYXN.js → use-atom-command-DkmE-pw9.js} +2 -2
  180. package/dist/client/assets/{useHandleNewThread-DTgcUVdd.js → useHandleNewThread-C1YHLGL_.js} +2 -2
  181. package/dist/client/assets/{useP4ConnectAuthPrompt-DKYJHISj.js → useP4ConnectAuthPrompt-4l_tJOsn.js} +2 -2
  182. package/dist/client/assets/{usePullRequestActions-BGugTe1S.js → usePullRequestActions-DtDOHLgX.js} +2 -2
  183. package/dist/client/assets/{useScopedModelAvailability-LgMepA3M.js → useScopedModelAvailability-B-vTMNh_.js} +2 -2
  184. package/dist/client/assets/{useSettings-hYzrsDTp.js → useSettings-Dp27sUML.js} +2 -2
  185. package/dist/client/assets/{vcsRefInvalidation-C5gDWck3.js → vcsRefInvalidation-DU1ipBl9.js} +2 -2
  186. package/dist/client/assets/{welcome-CQrdWD2c.js → welcome-CmsT2lJW.js} +2 -2
  187. package/dist/client/index.html +1 -1
  188. package/dist/{preview-C_kKbIjf.mjs → preview-iNdhUsAa.mjs} +2 -2
  189. package/dist/{runtimeLayer-DQ7pD9BT.mjs → runtimeLayer-CZ8Ru7Ia.mjs} +20 -12
  190. package/dist/{runtimeLayer-Go0xTEaW.mjs → runtimeLayer-hDhX2kHB.mjs} +1 -1
  191. package/dist/{server-DQ0wuuLG.mjs → server-qfCj2NpU.mjs} +4 -4
  192. package/package.json +1 -1
  193. package/dist/client/assets/JZOYTAAL-DbSUKTwO.js +0 -1
  194. package/dist/client/assets/connect-agent-Cy1G_UzI.js +0 -2
  195. package/dist/client/assets/settings.archived-DDSjJTCo.js +0 -2
@@ -1,2 +1,2 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{$n as i,Hu as a,Jl as o,Od as s,Ol as c,Td as l,Xn as u,Zd as d,Zn as f,er as p,fr as m,hr as h,il as g,iu as _,l as v,mr as y,op as b,rr as x,sl as S,sr as C,t as w,tr as T,wd as E}from"./utils-BVnIIHXP.js";import{Cg as D,Hr as O,Jr as k,Kr as A,Lr as j,Mn as M,Nn as N,Rr as P,Sn as F,Vm as I,Wr as L,Xr as R,Yr as z,cc as B,hl as V,jn as ee,la as H,lc as U,v as te,wn as ne,xn as re,y as ie}from"./src-DHn7yNZx.js";import{Dr as ae}from"./runtime-CbYvES7U.js";import{w as oe}from"./entities-CjoTQlW3.js";import{a as se,r as W,t as ce}from"./number-field-DNna9ps3.js";import{a as G,c as le,i as ue,o as K,r as de,s as fe,t as pe}from"./select-CNcZzYBl.js";import{t as me}from"./spinner-m1uNq_wW.js";import{a as q}from"./relay-BLgoNhyd.js";import{D as he,J as ge,O as _e,c as ve,o as ye,r as be,s as J,x as Y}from"./useSettings-hYzrsDTp.js";import{f as xe}from"./server-CEMcTnD1.js";import{i as Se,n as Ce}from"./session-Ces3Ebxl.js";import{t as we}from"./query-DFSffMGJ.js";import{t as Te}from"./use-atom-command-DWabKYXN.js";import{t as Ee}from"./env-BfPir1X4.js";import{a as De,n as Oe,t as ke}from"./tooltip-BhCWnsdW.js";import{t as Ae}from"./input-yaZxaTds.js";import{a as je,c as Me,i as Ne,n as Pe,o as Fe,r as Ie,s as Le,t as Re}from"./dialog-DFlZvvht.js";import{i as ze,t as Be}from"./device-CwiofvsD.js";import{a as Ve,d as He,i as Ue,n as We,o as Ge,t as Ke,u as qe}from"./DeviceSetup-ClD1wdY1.js";import{a as Je,i as Ye,o as Xe,t as Ze}from"./popover-DnYfrQly.js";import{t as Qe}from"./AnimatedHeight-B2j_NXft.js";import{i as $e,n as et}from"./Icons-DpgbzNj8.js";import{t as tt}from"./preview-CxFR-vue.js";import{r as nt}from"./preview-Bi-hPWTp.js";import{a as rt,i as it,n as at,o as ot,r as st,s as ct,t as lt}from"./alert-dialog-Dn_PRSFU.js";import{F as ut,R as dt,V as ft,a as X,c as pt,i as mt,r as ht,s as gt,w as _t}from"./settingsLayout-D5Mded9h.js";import{$a as vt,Lr as yt,No as bt,Qa as xt,Uo as St,oo as Ct}from"./main-xhw8F2iL.js";import{t as wt}from"./ProjectDefaultsSettings-vF_5kxVM.js";import{t as Tt}from"./draft-input-1HTN8QVo.js";import{t as Et}from"./ScopedSwitch-C8qSHRkU.js";import{t as Dt}from"./SecretInput-C6zW-8wI.js";import{n as Ot,r as kt,t as At}from"./usePermissionStatus-DeJYBk6u.js";var Z=n(),Q=e(r(),1);function jt(e){let t=(0,Z.c)(27),{tools:n,action:r,kind:i,owner:a,error:o}=e,s=i?n?.[i]:void 0,c;t[0]===s?c=t[1]:(c=s?.runningVersion??(s?.installedVersions.includes(s.requiredVersion)?s.requiredVersion:s?.installedVersions.toSorted(Mt).at(-1)),t[0]=s,t[1]=c);let l=c,u=i===`hub`?`Device hub`:`Agent device`,d=i?`${u}: ${l?`version ${l}`:s?`not installed`:`version unknown`}. Show details`:void 0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(h,{tone:`muted`}),t[2]=f):f=t[2];let p=i?l?`v${l}`:s?`Not installed`:`Version unknown`:o?`Versions unavailable`:`Versions`,m;t[3]!==d||t[4]!==p?(m=(0,Q.jsx)(Xe,{"aria-label":d,render:f,children:p}),t[3]=d,t[4]=p,t[5]=m):m=t[5];let g=i?u:`Device tools`,_;t[6]===g?_=t[7]:(_=(0,Q.jsx)(Je,{children:g}),t[6]=g,t[7]=_);let v;t[8]!==i||t[9]!==u||t[10]!==n?(v=n?(0,Q.jsx)(`div`,{className:`mt-4 divide-y divide-border/50`,children:[[`Device hub`,n.hub],[`Agent device`,n.agent]].filter(e=>{let[t]=e;return!i||t===u}).map(e=>{let[t,n]=e;return(0,Q.jsxs)(`div`,{className:`space-y-2 py-3 first:pt-0 last:pb-0`,children:[i?null:(0,Q.jsx)(`p`,{className:`text-xs font-medium`,children:t}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 text-xs`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Running`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.runningVersion??`Not running`}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Required`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.requiredVersion}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Installed`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono break-words`,children:n.installedVersions.join(`, `)||`None`})]})]},t)})}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Versions have not been checked.`}),t[8]=i,t[9]=u,t[10]=n,t[11]=v):v=t[11];let y=a?`Managed by ${a}. `:``,b;t[12]===y?b=t[13]:(b=(0,Q.jsxs)(`p`,{className:`mt-4 border-t border-border/50 pt-3 text-xs text-muted-foreground`,children:[y,`Tools update automatically on this host when needed.`]}),t[12]=y,t[13]=b);let x;t[14]===o?x=t[15]:(x=o?(0,Q.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-destructive`,children:o}):null,t[14]=o,t[15]=x);let S;t[16]===r?S=t[17]:(S=r?(0,Q.jsx)(`div`,{className:`mt-3`,children:r}):null,t[16]=r,t[17]=S);let C;t[18]!==b||t[19]!==x||t[20]!==S||t[21]!==_||t[22]!==v?(C=(0,Q.jsxs)(Ye,{align:`end`,width:`md`,children:[_,v,b,x,S]}),t[18]=b,t[19]=x,t[20]=S,t[21]=_,t[22]=v,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==m?(w=(0,Q.jsxs)(Ze,{children:[m,C]}),t[24]=C,t[25]=m,t[26]=w):w=t[26],w}function Mt(e,t){return e.localeCompare(t,void 0,{numeric:!0})}var $=e(t(),1);function Nt(e,t,n,r=t){let i=(e,t)=>e.target===t.target&&e.port===t.port&&e.identityFile===t.identityFile,a=t=>{let n=e.filter(e=>i(e,t));if(n.length>1)throw Error(`Multiple hosts match this SSH destination. Select the environment to edit its hosts.`);return n[0]},o=e.find(e=>e.id===r.id)??a(r)??(n?void 0:a(t));return n?e.filter(e=>e.id!==o?.id):o?e.map(e=>e.id===o.id?{...t,id:o.id}:e):[...e,t]}function Pt(e){let t=(0,Z.c)(4),{platforms:n}=e,r;t[0]===n?r=t[1]:(r=n.map(Ft),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:r}),t[2]=r,t[3]=i),i}function Ft(e){return(0,Q.jsxs)(ke,{children:[(0,Q.jsxs)(De,{render:(0,Q.jsx)(`span`,{tabIndex:0,className:`inline-flex items-center gap-1`}),children:[e.available?(0,Q.jsx)(c,{className:`size-3`}):(0,Q.jsx)(E,{className:`size-3`}),e.platform===`ios`?`iOS`:`Android`,` `,e.available?`available`:`unavailable`]}),(0,Q.jsx)(Oe,{children:e.reason??(e.platform===`ios`?`iOS available`:`Android available`)})]},e.platform)}var It=V(U);function Lt(e){let{identityFile:t,...n}=e;return It({...n,...t?.trim()?{identityFile:t.trim()}:{}})}function Rt(e){return JSON.stringify([e.target.trim(),e.port,e.identityFile?.trim()||void 0])}async function zt(e,t,n,r){await Promise.all(e.map(async e=>{r(e.environmentId,{status:`pending`});try{if(!e.connected)throw Error(`Environment disconnected`);let i=await n(e.environmentId,t);r(e.environmentId,i.kind===`local`?{status:`local`}:{status:`connected`,platforms:i.platforms,...i.tools?{tools:i.tools}:{}})}catch(t){r(e.environmentId,{status:`failed`,error:t instanceof Error?t.message:String(t)})}}))}function Bt(e){let t=Te(Be.testHost,{reportFailure:!1}),[n,r]=(0,$.useState)({}),i=(0,$.useRef)(new Set);return{checks:n,testConnection:async n=>{let a=Rt(n);if(i.current.has(a))return;i.current.add(a),r(e=>({...e,[a]:{}}));let o={};try{return await zt(e,n,async(e,n)=>{if(!Ce(e,`settings:write`))throw Error(`This connection cannot test device hosts.`);let r=await t({environmentId:e,input:n});if(r._tag===`Failure`)throw ae(r);return r.value},(e,t)=>{o[e]=t,r(n=>({...n,[a]:{...n[a],[e]:t}}))}),o}finally{i.current.delete(a)}}}}function Vt(e){let t=(0,Z.c)(107),{host:n,isNew:r,targets:i,busy:a,onSave:o,onClose:s}=e,[u,d]=(0,$.useState)(n),{checks:f,testConnection:p}=Bt(i),m=f[Rt(u)],h=Object.values(m??{}).some(Ut),g,_;t[0]===u?(g=t[1],_=t[2]):(g=Lt({...u,label:u.label.trim()||u.target}),_=D(g),t[0]=u,t[1]=g,t[2]=_);let v=_,x;t[3]===m?x=t[4]:(x=Object.values(m??{}).filter(Ht),t[3]=m,t[4]=x);let S=x.length,C;t[5]!==a||t[6]!==s?(C=e=>{!e&&!a&&s()},t[5]=a,t[6]=s,t[7]=C):C=t[7];let w=!a,T;t[8]!==a||t[9]!==h||t[10]!==u.label||t[11]!==g||t[12]!==o?(T=(0,Q.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),D(g)&&u.label.trim()&&!a&&!h&&o(g.value)}}),t[8]=a,t[9]=h,t[10]=u.label,t[11]=g,t[12]=o,t[13]=T):T=t[13];let E=r?`Add device host`:`Edit device host`,O;t[14]===E?O=t[15]:(O=(0,Q.jsx)(Me,{children:E}),t[14]=E,t[15]=O);let k=i.length===1?`Connect from ${i[0]?.label}.`:`Connect from ${i.length} selected environments.`,A;t[16]===k?A=t[17]:(A=(0,Q.jsxs)(Ie,{children:[k,` `,`Hosts on the same machine are skipped.`]}),t[16]=k,t[17]=A);let j;t[18]!==O||t[19]!==A?(j=(0,Q.jsxs)(je,{children:[O,A]}),t[18]=O,t[19]=A,t[20]=j):j=t[20];let M;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(`span`,{children:`Name`}),t[21]=M):M=t[21];let N;t[22]===u?N=t[23]:(N=e=>d({...u,label:e.target.value}),t[22]=u,t[23]=N);let P;t[24]!==a||t[25]!==u.label||t[26]!==N?(P=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[M,(0,Q.jsx)(Ae,{autoFocus:!0,required:!0,value:u.label,disabled:a,onChange:N,placeholder:`Mac mini`})]}),t[24]=a,t[25]=u.label,t[26]=N,t[27]=P):P=t[27];let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(`span`,{children:`SSH target`}),t[28]=F):F=t[28];let I;t[29]===u?I=t[30]:(I=e=>d({...u,target:e.target.value}),t[29]=u,t[30]=I);let L;t[31]!==a||t[32]!==u.target||t[33]!==I?(L=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[F,(0,Q.jsx)(Ae,{required:!0,value:u.target,disabled:a,onChange:I,placeholder:`user@host or SSH alias`})]}),t[31]=a,t[32]=u.target,t[33]=I,t[34]=L):L=t[34];let R=n.port!==void 0||n.identityFile!==void 0||void 0,z;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:`SSH options`}),t[35]=z):z=t[35];let B;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(`span`,{children:`Identity file`}),t[36]=B):B=t[36];let V=u.identityFile??``,ee;t[37]===u?ee=t[38]:(ee=e=>{let{identityFile:t,...n}=u;d(e.target.value?{...n,identityFile:e.target.value}:n)},t[37]=u,t[38]=ee);let H;t[39]!==a||t[40]!==V||t[41]!==ee?(H=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[B,(0,Q.jsx)(Ae,{value:V,disabled:a,onChange:ee,placeholder:`SSH config default`})]}),t[39]=a,t[40]=V,t[41]=ee,t[42]=H):H=t[42];let U;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(`span`,{children:`Port`}),t[43]=U):U=t[43];let te=u.port??``,ne;t[44]===u?ne=t[45]:(ne=e=>{let{port:t,...n}=u;d(e.target.value?{...n,port:Number(e.target.value)}:n)},t[44]=u,t[45]=ne);let re;t[46]!==a||t[47]!==te||t[48]!==ne?(re=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[U,(0,Q.jsx)(Ae,{type:`number`,min:1,max:65535,value:te,disabled:a,onChange:ne,placeholder:`Default`})]}),t[46]=a,t[47]=te,t[48]=ne,t[49]=re):re=t[49];let ie;t[50]!==H||t[51]!==re?(ie=(0,Q.jsxs)(`div`,{className:`mt-3 grid grid-cols-[minmax(0,1fr)_7rem] gap-3`,children:[H,re]}),t[50]=H,t[51]=re,t[52]=ie):ie=t[52];let ae;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Optional. Resolved separately on each environment.`}),t[53]=ae):ae=t[53];let oe;t[54]!==R||t[55]!==ie?(oe=(0,Q.jsxs)(`details`,{open:R,className:`text-sm`,children:[z,ie,ae]}),t[54]=R,t[55]=ie,t[56]=oe):oe=t[56];let se=h?`Checking environments…`:m?S?`${S} of ${i.length} failed`:`Connection checks passed`:`Check access before saving`,W;t[57]===se?W=t[58]:(W=(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:se}),t[57]=se,t[58]=W);let ce=a||h||!v,G;t[59]!==g||t[60]!==p?(G=()=>{D(g)&&p(g.value)},t[59]=g,t[60]=p,t[61]=G):G=t[61];let le;t[62]===h?le=t[63]:(le=h?(0,Q.jsx)(me,{size:`xs`}):null,t[62]=h,t[63]=le);let ue;t[64]!==ce||t[65]!==G||t[66]!==le?(ue=(0,Q.jsxs)(y,{type:`button`,size:`sm`,variant:`outline`,disabled:ce,onClick:G,children:[le,` Test connection`]}),t[64]=ce,t[65]=G,t[66]=le,t[67]=ue):ue=t[67];let K;t[68]!==W||t[69]!==ue?(K=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-2.5`,children:[W,ue]}),t[68]=W,t[69]=ue,t[70]=K):K=t[70];let de;t[71]!==m||t[72]!==i?(de=m?(0,Q.jsx)(`ul`,{className:`border-t border-border/60 divide-y divide-border/40`,children:i.map(e=>{let t=m[e.environmentId];return t?(0,Q.jsxs)(`li`,{className:`px-3 py-2.5 text-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:e.label}),(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-1.5 ${t.status===`failed`?`text-destructive`:`text-muted-foreground`}`,children:t.status===`pending`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(me,{size:`xs`}),` Checking…`]}):t.status===`local`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`size-3`}),` Already available locally`]}):t.status===`failed`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(b,{className:`size-3`}),` Failed`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(c,{className:`size-3`}),` Connected`]})})]}),t.status===`connected`?(0,Q.jsx)(`div`,{className:`mt-1.5`,children:(0,Q.jsx)(Pt,{platforms:t.platforms})}):null,t.status===`failed`?(0,Q.jsxs)(`details`,{className:`mt-1.5 text-muted-foreground`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:`Show error`}),(0,Q.jsx)(`p`,{className:`mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-words`,children:t.error})]}):null]},e.environmentId):null})}):null,t[71]=m,t[72]=i,t[73]=de):de=t[73];let fe;t[74]!==K||t[75]!==de?(fe=(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/60`,children:[K,de]}),t[74]=K,t[75]=de,t[76]=fe):fe=t[76];let pe;t[77]!==P||t[78]!==L||t[79]!==oe||t[80]!==fe?(pe=(0,Q.jsxs)(Fe,{children:[P,L,oe,fe]}),t[77]=P,t[78]=L,t[79]=oe,t[80]=fe,t[81]=pe):pe=t[81];let q;t[82]!==a||t[83]!==s?(q=(0,Q.jsx)(y,{type:`button`,variant:`ghost`,disabled:a,onClick:s,children:`Cancel`}),t[82]=a,t[83]=s,t[84]=q):q=t[84];let he;t[85]!==a||t[86]!==h||t[87]!==u.label||t[88]!==v?(he=a||h||!v||!u.label.trim(),t[85]=a,t[86]=h,t[87]=u.label,t[88]=v,t[89]=he):he=t[89];let ge;t[90]===a?ge=t[91]:(ge=a?(0,Q.jsx)(me,{size:`xs`}):null,t[90]=a,t[91]=ge);let _e;t[92]!==he||t[93]!==ge?(_e=(0,Q.jsxs)(y,{type:`submit`,disabled:he,children:[ge,` Save host`]}),t[92]=he,t[93]=ge,t[94]=_e):_e=t[94];let ve;t[95]!==q||t[96]!==_e?(ve=(0,Q.jsxs)(Ne,{children:[q,_e]}),t[95]=q,t[96]=_e,t[97]=ve):ve=t[97];let ye;t[98]!==j||t[99]!==pe||t[100]!==w||t[101]!==ve||t[102]!==T?(ye=(0,Q.jsxs)(Le,{showCloseButton:w,render:T,children:[j,pe,ve]}),t[98]=j,t[99]=pe,t[100]=w,t[101]=ve,t[102]=T,t[103]=ye):ye=t[103];let be;return t[104]!==C||t[105]!==ye?(be=(0,Q.jsx)(Re,{open:!0,onOpenChange:C,children:ye}),t[104]=C,t[105]=ye,t[106]=be):be=t[106],be}function Ht(e){return e.status===`failed`}function Ut(e){return e.status===`pending`}function Wt(e){let{scope:t,environments:n,connectedEnvironments:r}=ft(),i=Se(e.environmentId,H),a=t.kind===`project`||t.kind===`checkout`,o=Te(xe.updateSettings,{reportFailure:!1}),[s,c]=(0,$.useState)(null),[l,u]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),m=n.map(e=>({environmentId:e.environmentId,label:e.label,connected:e.connection.phase===`connected`})),{checks:h,testConnection:g}=Bt(m),_=async(t,r=!1,i=t)=>{if(e.environmentId&&!a){p(!0);try{let e=await Promise.allSettled(n.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!Ce(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return o({environmentId:e.environmentId,input:{patch:{deviceHosts:Nt(e.serverConfig.settings.deviceHosts,t,r,i)}}})})),a=n.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});a.length===0?c(null):q.add({type:`error`,title:`Device hosts not saved on all environments`,description:`Could not update ${a.map(e=>e.label).join(`, `)}.`})}finally{p(!1)}}};return(0,Q.jsx)(X,{id:`device-hosts`,title:`Device hosts`,serverScoped:!0,settingKeys:[`deviceHosts`],description:`Add remote machines with simulator or emulator runtimes installed, and the selected environments will connect over SSH and set up device tools automatically.`,control:(0,Q.jsxs)(y,{size:`sm`,variant:`outline`,disabled:!i||a||f||!e.environmentId||s!==null,onClick:()=>{u(null),c({kind:`ssh`,id:v(),label:``,target:``})},children:[(0,Q.jsx)(d,{className:`size-3.5`}),` Add host`]}),children:(0,Q.jsx)(`div`,{className:`pt-3 pb-2`,children:e.environmentId?(0,Q.jsxs)(Q.Fragment,{children:[r.map(e=>(0,Q.jsxs)(`div`,{children:[r.length>1?(0,Q.jsx)(`p`,{className:`pt-3 pb-1 text-xs font-medium text-muted-foreground`,children:e.label}):null,(0,Q.jsx)(Gt,{environmentLabel:e.label,environmentId:e.environmentId,hosts:e.serverConfig?.settings.deviceHosts??[],busy:!i||a||f,checks:h,testConnection:async e=>{let t=await g(e);if(!t)return;let n=m.filter(e=>t[e.environmentId]?.status===`failed`);return q.add({type:n.length?`error`:`success`,title:n.length?`${e.label}: ${n.length} of ${m.length} environments failed`:`${e.label}: connection checks passed`,description:n.length?`Could not connect from ${n.map(e=>e.label).join(`, `)}.`:`Connected or already available locally on each selected environment.`}),t},onEdit:e=>{u(e),c(e)},onRemove:e=>void _(e,!0)})]},e.environmentId)),s?(0,Q.jsx)(Vt,{host:s,isNew:l===null,targets:m,busy:f,onSave:e=>void _(e,!1,l??e),onClose:()=>c(null)},s.id):null]}):(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect a selected environment to manage device hosts.`})})})}function Gt(e){let t=(0,Z.c)(28),{environmentLabel:n,environmentId:r,hosts:i,busy:a,onEdit:o,onRemove:c,checks:l,testConnection:u}=e,{state:d}=ze(r),p=Te(Be.list),[h,g]=(0,$.useState)(null),_;t[0]===i.length?_=t[1]:(_=i.length===0?(0,Q.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`No device hosts.`}):null,t[0]=i.length,t[1]=_);let v;if(t[2]!==a||t[3]!==l||t[4]!==r||t[5]!==n||t[6]!==i||t[7]!==o||t[8]!==c||t[9]!==p||t[10]!==h||t[11]!==d||t[12]!==u){let e;t[14]!==a||t[15]!==l||t[16]!==r||t[17]!==n||t[18]!==o||t[19]!==c||t[20]!==p||t[21]!==h||t[22]!==d||t[23]!==u?(e=e=>{let t=d.hostStatuses[e.id],i=l[Rt(e)]?.[r],_=(i?.status===`connected`?i.platforms:void 0)??d.hosts.find(t=>t.id===e.id)?.platforms??[],v=i?.status===`pending`?`Checking connection…`:t?.status===`installing`?`Installing device support…`:t?.status===`starting`?`Connecting…`:null,b=i?.status===`failed`?i.error:i?.status===`local`?void 0:t?.status===`failed`?t.detail:void 0;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/50 py-2.5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.label}),_.filter(qt).map(Kt)]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.target}),(0,Q.jsx)(jt,{owner:n,error:d.hosts.find(t=>t.id===e.id)?.toolInspectionError,tools:d.hosts.find(t=>t.id===e.id)?.tools??(i?.status===`connected`?i.tools:void 0)}),i?.status===`local`?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Already available locally`}):null,b?(0,Q.jsx)(`div`,{className:`mt-1`,role:`status`,children:(0,Q.jsxs)(`details`,{className:`text-xs text-destructive`,children:[(0,Q.jsx)(`summary`,{children:`Connection failed`}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words`,children:b})]})}):null]}),v?(0,Q.jsxs)(`span`,{role:`status`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(me,{size:`xs`}),v]}):null,(0,Q.jsxs)(f,{children:[(0,Q.jsx)(m,{render:(0,Q.jsx)(y,{size:`icon-sm`,variant:`ghost-muted`,disabled:a,"aria-label":e.label+` options`}),children:(0,Q.jsx)(s,{})}),(0,Q.jsxs)(x,{align:`end`,children:[(0,Q.jsx)(T,{onClick:()=>{o(e)},children:`Edit`}),(0,Q.jsx)(T,{variant:`destructive`,onClick:()=>c(e),children:`Remove`})]})]}),t?.status===`failed`&&d.supportsHostRetry&&d.hostStatus!==`disabled`?(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:a||h!==null,onClick:()=>{g(e.id),p({environmentId:r,input:{retryHostId:e.id}}).finally(()=>g(null))},children:h===e.id?`Retrying…`:`Retry`}):(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:a||v!==null,onClick:()=>void u(e),children:`Test connection`})]},e.id)},t[14]=a,t[15]=l,t[16]=r,t[17]=n,t[18]=o,t[19]=c,t[20]=p,t[21]=h,t[22]=d,t[23]=u,t[24]=e):e=t[24],v=i.map(e),t[2]=a,t[3]=l,t[4]=r,t[5]=n,t[6]=i,t[7]=o,t[8]=c,t[9]=p,t[10]=h,t[11]=d,t[12]=u,t[13]=v}else v=t[13];let b;return t[25]!==_||t[26]!==v?(b=(0,Q.jsxs)(Q.Fragment,{children:[_,v]}),t[25]=_,t[26]=v,t[27]=b):b=t[27],b}function Kt(e){return(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(`span`,{tabIndex:0,role:`img`,"aria-label":e.platform===`ios`?`iOS available`:`Android available`,className:`shrink-0 text-muted-foreground`}),children:e.platform===`ios`?(0,Q.jsx)($e,{className:`size-3.5 -translate-y-px`}):(0,Q.jsx)(et,{className:`size-3.5`})}),(0,Q.jsx)(Oe,{children:e.platform===`ios`?`iOS available`:`Android available`})]},e.platform)}function qt(e){return e.available}var Jt=V(B),Yt=e=>({kind:`eas`,id:e,label:`EAS Simulator`,accessToken:``,maxSessionMinutes:30,idleMinutes:10,maxConcurrentSessions:2});function Xt(e,t,n){return n?e.filter(e=>e.id!==t.id):e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?t:e):[...e,t]}function Zt(e){return`Up to ${e.maxConcurrentSessions===1?`1 session`:`${e.maxConcurrentSessions} sessions`} at once, each stopped after ${e.maxSessionMinutes} min or ${e.idleMinutes} idle min`}var Qt=`thread-project`,$t={settings:`the access token saved here`,env:`EXPO_TOKEN on the server`,"eas-login":`the server's eas login`},en=e=>{let t=I(e);return t instanceof Error?t.message:String(t)};function tn(e){let t=(0,Z.c)(24),{scope:n,connectedEnvironments:r}=ft(),i=Se(e.environmentId,H),a=n.kind===`project`||n.kind===`checkout`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={reportFailure:!1},t[0]=s):s=t[0];let c=Te(xe.updateSettings,s),l;t[1]===e.environmentId?l=t[2]:(l=t=>t.environmentId===e.environmentId,t[1]=e.environmentId,t[2]=l);let u=r.find(l)?.serverConfig?.settings.easDeviceHosts??[],[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(!1),g=!i||a||m||!e.environmentId,_=async(t,n)=>{if(!e.environmentId||!Ce(e.environmentId,`settings:write`))return;h(!0);let r=await c({environmentId:e.environmentId,input:{patch:{easDeviceHosts:Xt(u,t,n)}}});h(!1),r._tag===`Success`?p(null):q.add({type:`error`,title:n?`EAS host not removed`:`EAS host not saved`,description:en(r.cause)})},b=X,x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=[`easDeviceHosts`],t[3]=x):x=t[3];let S=g||f!==null,C;t[4]===p?C=t[5]:(C=()=>p({host:Yt(v()),isNew:!0}),t[4]=p,t[5]=C);let w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(d,{className:`size-3.5`}),t[6]=w):w=t[6];let T;t[7]!==S||t[8]!==C?(T=(0,Q.jsxs)(y,{size:`sm`,variant:`outline`,disabled:S,onClick:C,children:[w,` Add EAS host`]}),t[7]=S,t[8]=C,t[9]=T):T=t[9];let E=u.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No EAS hosts.`}):(0,Q.jsx)(`ul`,{className:`divide-y divide-border/40`,children:u.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2.5 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 truncate font-medium`,children:[(0,Q.jsx)(o,{className:`size-3.5 shrink-0`}),` `,e.label]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:Zt(e)})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,Q.jsx)(y,{size:`sm`,variant:`ghost`,disabled:g,onClick:()=>p({host:e,isNew:!1}),children:`Edit`}),(0,Q.jsx)(y,{size:`sm`,variant:`ghost-destructive`,disabled:g,onClick:()=>void _(e,!0),children:`Remove`})]})]},e.id))}),D;t[10]!==m||t[11]!==f||t[12]!==e.environmentId||t[13]!==_||t[14]!==p?(D=f&&e.environmentId?(0,Q.jsx)(nn,{environmentId:e.environmentId,host:f.host,isNew:f.isNew,busy:m,onSave:e=>void _(e,!1),onClose:()=>p(null)},f.host.id):null,t[10]=m,t[11]=f,t[12]=e.environmentId,t[13]=_,t[14]=p,t[15]=D):D=t[15];let O;t[16]!==E||t[17]!==D?(O=(0,Q.jsxs)(`div`,{className:`pt-3 pb-2`,children:[E,D]}),t[16]=E,t[17]=D,t[18]=O):O=t[18];let k;return t[19]!==b||t[20]!==T||t[21]!==O||t[22]!==x?(k=(0,Q.jsx)(b,{id:`eas-device-hosts`,title:`EAS Simulator`,serverScoped:!0,settingKeys:x,description:`Run iOS Simulators and Android emulators in Expo's cloud. Sessions bill the Expo account until they stop, so each host caps their number and length. Editing or removing a host stops them.`,control:T,children:O}),t[19]=b,t[20]=T,t[21]=O,t[22]=x,t[23]=k):k=t[23],k}function nn(e){let t=(0,Z.c)(135),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=Te(Be.easAccount,n),[i,a]=(0,$.useState)(e.host),o=(0,$.useId)(),s;t[1]===e.host.accessToken?s=t[2]:(s=e.host.accessToken?{kind:`saved`}:{kind:`cleared`},t[1]=e.host.accessToken,t[2]=s);let[c,l]=(0,$.useState)(s),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u={status:`checking`},t[3]=u):u=t[3];let[d,f]=(0,$.useState)(u),p,m;t[4]!==i||t[5]!==e.host.accessToken||t[6]!==c.kind||t[7]!==c.value?(p={...i,label:i.label.trim(),accessToken:c.kind===`saved`?e.host.accessToken:c.kind===`new`?c.value:``},m=D(Jt(p)),t[4]=i,t[5]=e.host.accessToken,t[6]=c.kind,t[7]=c.value,t[8]=p,t[9]=m):(p=t[8],m=t[9]);let h=m,g=h?null:i.maxSessionMinutes>0&&i.idleMinutes>=i.maxSessionMinutes?`Idle minutes must be smaller than session minutes.`:`Give the host a label and limits within the ranges shown.`,_;t[10]!==d.account||t[11]!==d.status?(_=d.status===`signed-in`?d.account.apps:[],t[10]=d.account,t[11]=d.status,t[12]=_):_=t[12];let v=_,x=(0,$.useRef)(0),S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>{x.current+=1,f({status:`idle`})},t[13]=S):S=t[13];let C=S,w;t[14]!==r||t[15]!==e.environmentId||t[16]!==e.host.id||t[17]!==e.isNew||t[18]!==c.kind||t[19]!==c.value?(w=async()=>{let t=x.current+=1,n=await r({environmentId:e.environmentId,input:{...c.kind===`saved`&&!e.isNew?{hostId:e.host.id}:{},...c.kind===`new`?{accessToken:c.value}:c.kind===`cleared`?{accessToken:``}:{}}});t===x.current&&f(n._tag===`Success`?{status:`signed-in`,account:n.value}:{status:`failed`,error:en(n.cause)})},t[14]=r,t[15]=e.environmentId,t[16]=e.host.id,t[17]=e.isNew,t[18]=c.kind,t[19]=c.value,t[20]=w):w=t[20];let T=w,E;t[21]===T?E=t[22]:(E=()=>{f({status:`checking`}),T()},t[21]=T,t[22]=E);let O=E,k;t[23]===T?k=t[24]:(k=()=>void T(),t[23]=T,t[24]=k);let A=(0,$.useEffectEvent)(k),j;t[25]===A?j=t[26]:(j=()=>{A()},t[25]=A,t[26]=j);let M;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(M=[],t[27]=M):M=t[27],(0,$.useEffect)(j,M);let N;t[28]!==i||t[29]!==e.busy?(N=(t,n,r)=>(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,Q.jsx)(`span`,{children:n}),(0,Q.jsx)(Ae,{type:`number`,min:1,max:r,value:i[t],disabled:e.busy,onChange:e=>{let n=Number(e.target.value);a(e=>({...e,[t]:n}))}})]}),t[28]=i,t[29]=e.busy,t[30]=N):N=t[30];let P=N,F;t[31]===e?F=t[32]:(F=t=>{!t&&!e.busy&&e.onClose()},t[31]=e,t[32]=F);let I=!e.busy,L;t[33]!==p||t[34]!==e||t[35]!==h?(L=t=>{t.preventDefault(),h&&!e.busy&&e.onSave(p)},t[33]=p,t[34]=e,t[35]=h,t[36]=L):L=t[36];let R=e.isNew?`Add EAS host`:`Edit EAS host`,z;t[37]===R?z=t[38]:(z=(0,Q.jsx)(Me,{children:R}),t[37]=R,t[38]=z);let B;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(Ie,{children:`The environment's server signs in to Expo and starts the sessions. Without a token here it uses EXPO_TOKEN, then its eas login.`}),t[39]=B):B=t[39];let V;t[40]===z?V=t[41]:(V=(0,Q.jsxs)(je,{children:[z,B]}),t[40]=z,t[41]=V);let ee;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(`span`,{children:`Name`}),t[42]=ee):ee=t[42];let H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{let t=e.target.value;a(e=>({...e,label:t}))},t[43]=H):H=t[43];let U;t[44]!==i.label||t[45]!==e.busy?(U=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[ee,(0,Q.jsx)(Ae,{autoFocus:!0,required:!0,value:i.label,disabled:e.busy,onChange:H})]}),t[44]=i.label,t[45]=e.busy,t[46]=U):U=t[46];let te;t[47]===o?te=t[48]:(te=(0,Q.jsx)(`label`,{htmlFor:o,className:`block`,children:`Expo access token`}),t[47]=o,t[48]=te);let ne=c.kind===`saved`,re=c.kind===`new`?c.value:``,ie;t[49]===e.host.accessToken?ie=t[50]:(ie=t=>{let n=t.target.value;l(n?{kind:`new`,value:n}:e.host.accessToken?{kind:`saved`}:{kind:`cleared`}),C()},t[49]=e.host.accessToken,t[50]=ie);let ae;t[51]!==e.busy||t[52]!==ne||t[53]!==re||t[54]!==ie||t[55]!==o?(ae=(0,Q.jsx)(Dt,{id:o,className:`min-w-0 flex-1`,configured:ne,value:re,disabled:e.busy,placeholder:`Optional`,onChange:ie}),t[51]=e.busy,t[52]=ne,t[53]=re,t[54]=ie,t[55]=o,t[56]=ae):ae=t[56];let oe;t[57]===c.kind?oe=t[58]:(oe=c.kind===`cleared`?null:(0,Q.jsx)(y,{type:`button`,size:`icon-sm`,variant:`ghost-destructive`,"aria-label":`Clear access token`,onClick:()=>{l({kind:`cleared`}),C()},children:(0,Q.jsx)(b,{className:`size-3.5`})}),t[57]=c.kind,t[58]=oe);let se;t[59]!==ae||t[60]!==oe?(se=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ae,oe]}),t[59]=ae,t[60]=oe,t[61]=se):se=t[61];let W;t[62]!==te||t[63]!==se?(W=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[te,se]}),t[62]=te,t[63]=se,t[64]=W):W=t[64];let ce=d.status===`signed-in`?`Signed in as ${d.account.signedInAs} with ${$t[d.account.credentialSource]}.`:d.status===`failed`?d.error:d.status===`checking`?`Checking the Expo account…`:`Check the Expo account before choosing a project.`,ue;t[65]===ce?ue=t[66]:(ue=(0,Q.jsx)(`p`,{role:`status`,className:`min-w-0 text-xs text-muted-foreground`,children:ce}),t[65]=ce,t[66]=ue);let de=e.busy||d.status===`checking`,q;t[67]===O?q=t[68]:(q=()=>void O(),t[67]=O,t[68]=q);let he;t[69]===d.status?he=t[70]:(he=d.status===`checking`?(0,Q.jsx)(me,{size:`xs`}):null,t[69]=d.status,t[70]=he);let ge;t[71]!==de||t[72]!==q||t[73]!==he?(ge=(0,Q.jsxs)(y,{type:`button`,size:`sm`,variant:`outline`,disabled:de,onClick:q,children:[he,` Check account`]}),t[71]=de,t[72]=q,t[73]=he,t[74]=ge):ge=t[74];let _e;t[75]!==ue||t[76]!==ge?(_e=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border/60 px-3 py-2.5`,children:[ue,ge]}),t[75]=ue,t[76]=ge,t[77]=_e):_e=t[77];let ve;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Q.jsx)(`span`,{children:`EAS project`}),t[78]=ve):ve=t[78];let ye=i.appId??Qt,be=e.busy,J;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(J=e=>{typeof e==`string`&&a(t=>{let{appId:n,...r}=t;return e===Qt?r:{...r,appId:e}})},t[79]=J):J=t[79];let Y;t[80]===v?Y=t[81]:(Y=(0,Q.jsx)(fe,{size:`sm`,"aria-label":`EAS project`,children:(0,Q.jsx)(le,{children:e=>e===Qt?`From the thread's project`:v.find(t=>t.id===e)?.fullName??e})}),t[80]=v,t[81]=Y);let xe;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Q.jsx)(G,{value:Qt,children:`From the thread's project`}),t[82]=xe):xe=t[82];let Se;t[83]!==v||t[84]!==i.appId?(Se=i.appId&&!v.some(e=>e.id===i.appId)?(0,Q.jsx)(G,{value:i.appId,children:i.appId}):null,t[83]=v,t[84]=i.appId,t[85]=Se):Se=t[85];let Ce;t[86]===v?Ce=t[87]:(Ce=v.map(rn),t[86]=v,t[87]=Ce);let we;t[88]!==Se||t[89]!==Ce?(we=(0,Q.jsxs)(K,{children:[xe,Se,Ce]}),t[88]=Se,t[89]=Ce,t[90]=we):we=t[90];let Ee;t[91]!==e.busy||t[92]!==ye||t[93]!==Y||t[94]!==we?(Ee=(0,Q.jsxs)(pe,{value:ye,disabled:be,onValueChange:J,children:[Y,we]}),t[91]=e.busy,t[92]=ye,t[93]=Y,t[94]=we,t[95]=Ee):Ee=t[95];let De;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Sessions bill the project's Expo account. "From the thread's project" reads extra.eas.projectId from the project's app config.`}),t[96]=De):De=t[96];let Oe;t[97]===Ee?Oe=t[98]:(Oe=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[ve,Ee,De]}),t[97]=Ee,t[98]=Oe);let ke;t[99]===P?ke=t[100]:(ke=(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 text-sm`,children:[P(`maxConcurrentSessions`,`Sessions at once`,20),P(`maxSessionMinutes`,`Session minutes`,115),P(`idleMinutes`,`Idle minutes`,60)]}),t[99]=P,t[100]=ke);let Pe=e.isNew?null:` Saving restarts this host, which stops its running sessions.`,ze;t[101]===Pe?ze=t[102]:(ze=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Expo allows sessions of up to 40 minutes on free accounts and 115 on paid ones, and ends one after the idle minutes without activity, so idle minutes must be smaller than session minutes.`,Pe]}),t[101]=Pe,t[102]=ze);let Ve;t[103]===g?Ve=t[104]:(Ve=g===null?null:(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,role:`alert`,children:g}),t[103]=g,t[104]=Ve);let He;t[105]!==U||t[106]!==W||t[107]!==_e||t[108]!==Oe||t[109]!==ke||t[110]!==ze||t[111]!==Ve?(He=(0,Q.jsxs)(Fe,{children:[U,W,_e,Oe,ke,ze,Ve]}),t[105]=U,t[106]=W,t[107]=_e,t[108]=Oe,t[109]=ke,t[110]=ze,t[111]=Ve,t[112]=He):He=t[112];let Ue;t[113]!==e.busy||t[114]!==e.onClose?(Ue=(0,Q.jsx)(y,{type:`button`,variant:`ghost`,disabled:e.busy,onClick:e.onClose,children:`Cancel`}),t[113]=e.busy,t[114]=e.onClose,t[115]=Ue):Ue=t[115];let We=e.busy||!h,Ge;t[116]===e.busy?Ge=t[117]:(Ge=e.busy?(0,Q.jsx)(me,{size:`xs`}):null,t[116]=e.busy,t[117]=Ge);let Ke;t[118]!==We||t[119]!==Ge?(Ke=(0,Q.jsxs)(y,{type:`submit`,disabled:We,children:[Ge,` Save host`]}),t[118]=We,t[119]=Ge,t[120]=Ke):Ke=t[120];let qe;t[121]!==Ue||t[122]!==Ke?(qe=(0,Q.jsxs)(Ne,{children:[Ue,Ke]}),t[121]=Ue,t[122]=Ke,t[123]=qe):qe=t[123];let Je;t[124]!==L||t[125]!==V||t[126]!==He||t[127]!==qe?(Je=(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-col`,onSubmit:L,children:[V,He,qe]}),t[124]=L,t[125]=V,t[126]=He,t[127]=qe,t[128]=Je):Je=t[128];let Ye;t[129]!==I||t[130]!==Je?(Ye=(0,Q.jsx)(Le,{showCloseButton:I,children:Je}),t[129]=I,t[130]=Je,t[131]=Ye):Ye=t[131];let Xe;return t[132]!==F||t[133]!==Ye?(Xe=(0,Q.jsx)(Re,{open:!0,onOpenChange:F,children:Ye}),t[132]=F,t[133]=Ye,t[134]=Xe):Xe=t[134],Xe}function rn(e){return(0,Q.jsx)(G,{value:e.id,children:e.fullName},e.id)}function an(e,t){if(e)return{kind:`new`};let n=t[0];return n?{kind:`existing`,profileId:n.id}:{kind:`new`}}function on(e,t,n){if(e.kind===`new`)return{kind:`new`,profileId:t};let r=n.find(t=>t.id===e.profileId);if(r!==void 0)return{kind:`existing`,profileId:e.profileId,name:r.name}}function sn(e){return e.step!==`importing`}function cn(e){return e.unavailable===`browserRunning`?{step:`quit`}:e.unavailable===`needsFullDiskAccess`?{step:`fullDiskAccess`,resume:`configure`}:e.unavailable===void 0?e.profiles.length===0?{step:`blocked`,reason:`unknownSourceProfile`}:{step:`configure`}:{step:`blocked`,reason:e.unavailable}}function ln(e){return e.kind===`imported`?{step:`done`,imported:e.imported,skipped:e.skipped,skippedDomains:e.skippedDomains,targetName:e.targetName}:e.reason===`browserRunning`?{step:`quit`}:e.reason===`needsFullDiskAccess`?{step:`fullDiskAccess`,resume:`import`,checked:!0}:{step:`blocked`,reason:e.reason}}function un(e){return e===void 0?{step:`blocked`,reason:`unknownSource`}:cn(e)}function dn(e){let t=un(e);return t.step===`fullDiskAccess`?{...t,checked:!0}:t}function fn(e,t){return t.profiles.some(t=>t.directory===e)?e:t.profiles[0]?.directory??``}function pn(e){switch(e){case`needsKeychainApproval`:case`keychainItemMissing`:case`keychainUnavailable`:case`readFailed`:case`sessionUnavailable`:case`profileNotSaved`:return!0;default:return!1}}function mn(e){return e.length===0?``:e.length===1?e[0]:e.length<=3?`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`:`${e.slice(0,3).join(`, `)} and ${e.length-3} more`}function hn(e){let t=(0,Z.c)(46),{source:n,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,onImport:o,onRefreshSource:s,onOpenFullDiskAccessSettings:c,onCheckFullDiskAccess:l,onClose:u}=e,[d,f]=(0,$.useState)(n),p;t[0]===n?p=t[1]:(p=()=>cn(n),t[0]=n,t[1]=p);let[m,h]=(0,$.useState)(p),g;t[2]===n.profiles[0]?.directory?g=t[3]:(g=()=>n.profiles[0]?.directory??``,t[2]=n.profiles[0]?.directory,t[3]=g);let[_,y]=(0,$.useState)(g),b;t[4]!==a||t[5]!==i?(b=()=>an(a,i),t[4]=a,t[5]=i,t[6]=b):b=t[6];let[x,S]=(0,$.useState)(b),[C,w]=(0,$.useState)(),T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=v(),t[7]=T):T=t[7];let E=(0,$.useRef)(`profile-${T}`),D=(0,$.useRef)(!1),O;t[8]!==o||t[9]!==_||t[10]!==x||t[11]!==i?(O=()=>{if(D.current)return;let e=on(x,E.current,i);e===void 0?(w(`That profile is no longer available. Choose where to import these cookies.`),h({step:`configure`})):(w(void 0),D.current=!0,h({step:`importing`}),o({sourceProfileDirectory:_,target:e}).then(e=>h(ln(e))).catch(()=>h({step:`blocked`,reason:`readFailed`})).finally(()=>{D.current=!1}))},t[8]=o,t[9]=_,t[10]=x,t[11]=i,t[12]=O):O=t[12];let k=O,A;t[13]===s?A=t[14]:(A=(e,t)=>{h({step:`checking`,check:e}),s().then(e=>{e&&(f(e),y(t=>fn(t,e))),h(t(e))}).catch(()=>h({step:`blocked`,reason:`readFailed`}))},t[13]=s,t[14]=A);let j=A,M;t[15]===j?M=t[16]:(M=()=>j(`browser`,un),t[15]=j,t[16]=M);let N=M,P;t[17]===j?P=t[18]:(P=()=>j(`fullDiskAccess`,dn),t[17]=j,t[18]=P);let F=P,I;t[19]!==u||t[20]!==m?(I=e=>e||!sn(m)?void 0:u(),t[19]=u,t[20]=m,t[21]=I):I=t[21];let L;t[22]===m?L=t[23]:(L=sn(m),t[22]=m,t[23]=L);let R;t[24]!==a||t[25]!==r||t[26]!==l||t[27]!==u||t[28]!==c||t[29]!==s||t[30]!==N||t[31]!==F||t[32]!==k||t[33]!==d||t[34]!==_||t[35]!==m||t[36]!==x||t[37]!==C||t[38]!==i?(R=m.step===`quit`?(0,Q.jsx)(gn,{source:d,onCancel:u,onRechecked:N}):m.step===`fullDiskAccess`?(0,Q.jsx)(yn,{source:d,onCancel:u,onOpenSettings:c,onCheck:l??(async()=>{let e=await s();return e!==void 0&&e.unavailable===void 0}),onGranted:m.resume===`import`?k:F,stillRequired:m.checked===!0}):m.step===`importing`?(0,Q.jsx)(Sn,{}):m.step===`checking`?(0,Q.jsx)(Cn,{sourceName:d.name,check:m.check}):m.step===`done`?(0,Q.jsx)(wn,{...m,destinationEnvironmentName:r,onClose:u}):m.step===`blocked`?(0,Q.jsx)(Tn,{source:d,reason:m.reason,onClose:u,onRetry:pn(m.reason)?k:void 0}):(0,Q.jsx)(bn,{source:d,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:_,onSourceProfileChange:y,target:x,onTargetChange:e=>{S(e),w(void 0)},targetError:C,onCancel:u,onImport:k}),t[24]=a,t[25]=r,t[26]=l,t[27]=u,t[28]=c,t[29]=s,t[30]=N,t[31]=F,t[32]=k,t[33]=d,t[34]=_,t[35]=m,t[36]=x,t[37]=C,t[38]=i,t[39]=R):R=t[39];let z;t[40]!==L||t[41]!==R?(z=(0,Q.jsx)(Le,{className:`max-w-lg`,showCloseButton:L,children:R}),t[40]=L,t[41]=R,t[42]=z):z=t[42];let B;return t[43]!==z||t[44]!==I?(B=(0,Q.jsx)(Re,{open:!0,onOpenChange:I,children:z}),t[43]=z,t[44]=I,t[45]=B):B=t[45],B}function gn(e){let t=(0,Z.c)(12),{source:n,onCancel:r,onRechecked:i}=e,a;t[0]===n.name?a=t[1]:(a=(0,Q.jsxs)(je,{children:[(0,Q.jsxs)(Me,{children:[`Quit `,n.name,` to import`]}),(0,Q.jsxs)(Ie,{children:[n.name,` is open, so its cookies can’t be read yet. Quit it, then continue.`]})]}),t[0]=n.name,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(y,{variant:`outline`,onClick:r,children:`Cancel`}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(y,{onClick:i,children:`I’ve quit it`}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(Ne,{children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function _n(e){if(e!==void 0)return e===0?`no cookies`:`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function vn(e){return`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function yn(e){let t=(0,Z.c)(43),{source:n,onCancel:r,onOpenSettings:i,onGranted:o,stillRequired:s,onCheck:c}=e,[l,u]=(0,$.useState)(!1),[d,f]=(0,$.useState)(null),p;t[0]===c?p=t[1]:(p=async()=>({fullDiskAccess:await c()}),t[0]=c,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m={fullDiskAccess:!1},t[2]=m):m=t[2];let h=At(p,m),g;t[3]!==i||t[4]!==l?(g=()=>{l||(u(!0),f(null),Promise.resolve().then(i).catch(()=>f(`Could not open System Settings. Try Allow again.`)).finally(()=>u(!1)))},t[3]=i,t[4]=l,t[5]=g):g=t[5];let _=g,v;t[6]===n.name?v=t[7]:(v=(0,Q.jsxs)(je,{children:[(0,Q.jsxs)(Me,{children:[`Let P4 Code read `,n.name,`’s cookies`]}),(0,Q.jsxs)(Ie,{children:[`To import cookies from `,n.name,`, P4 Code needs Full Disk Access. Turn it on in System Settings, then come back to finish the import — you can revoke it again once the import is done.`]})]}),t[6]=n.name,t[7]=v);let b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(a,{className:`size-8 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[8]=b):b=t[8];let x=`Read ${n.name}'s cookies for this import.`,S;t[9]===_?S=t[10]:(S=()=>void _(),t[9]=_,t[10]=S);let C;t[11]!==h.status.fullDiskAccess||t[12]!==x||t[13]!==S?(C=[{id:`fullDiskAccess`,icon:b,title:`Full Disk Access`,description:x,granted:h.status.fullDiskAccess,onAllow:S}],t[11]=h.status.fullDiskAccess,t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]!==l||t[16]!==C?(w=(0,Q.jsx)(Ot,{busy:l,permissions:C}),t[15]=l,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==d||t[19]!==h.error?(T=d||h.error?(0,Q.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:d??h.error}):null,t[18]=d,t[19]=h.error,t[20]=T):T=t[20];let E;t[21]!==h||t[22]!==s?(E=h.isReady([`fullDiskAccess`])?null:(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:s?`Access is still required. Quit and reopen P4 Code if you just allowed it, then retry the import.`:`If access doesn't update after you allow it, quit and reopen P4 Code, then retry the import.`}),t[21]=h,t[22]=s,t[23]=E):E=t[23];let D;t[24]!==T||t[25]!==E||t[26]!==w?(D=(0,Q.jsxs)(Fe,{children:[w,T,E]}),t[24]=T,t[25]=E,t[26]=w,t[27]=D):D=t[27];let O;t[28]===r?O=t[29]:(O=(0,Q.jsx)(y,{variant:`outline`,onClick:r,children:`Cancel`}),t[28]=r,t[29]=O);let k;t[30]===h?k=t[31]:(k=h.isReady([`fullDiskAccess`]),t[30]=h,t[31]=k);let A;t[32]!==o||t[33]!==l||t[34]!==k?(A=(0,Q.jsx)(kt,{ready:k,busy:l,onClick:o,children:`Continue`}),t[32]=o,t[33]=l,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==O||t[37]!==A?(j=(0,Q.jsxs)(Ne,{children:[O,A]}),t[36]=O,t[37]=A,t[38]=j):j=t[38];let M;return t[39]!==D||t[40]!==j||t[41]!==v?(M=(0,Q.jsxs)(Q.Fragment,{children:[v,D,j]}),t[39]=D,t[40]=j,t[41]=v,t[42]=M):M=t[42],M}function bn(e){let t=(0,Z.c)(59),{source:n,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:o,onSourceProfileChange:s,target:c,targetError:l,onTargetChange:u,onCancel:d,onImport:f}=e,p;t[0]!==c.kind||t[1]!==c.profileId||t[2]!==i?(p=c.kind===`existing`&&!i.some(e=>e.id===c.profileId),t[0]=c.kind,t[1]=c.profileId,t[2]=i,t[3]=p):p=t[3];let m=p,h=c.kind===`new`&&!a,_=l??(m?`That profile is no longer available. Choose where to import these cookies.`:h?`You've reached the profile limit. Choose an existing profile to import into.`:void 0),v;t[4]===n.name?v=t[5]:(v=(0,Q.jsxs)(Me,{children:[`Import from `,n.name]}),t[4]=n.name,t[5]=v);let b;t[6]===r?b=t[7]:(b=(0,Q.jsxs)(Ie,{children:[`Choose which cookies to import for `,r,`.`]}),t[6]=r,t[7]=b);let x;t[8]!==v||t[9]!==b?(x=(0,Q.jsxs)(je,{children:[v,b]}),t[8]=v,t[9]=b,t[10]=x):x=t[10];let C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`From`}),t[11]=C):C=t[11];let w;if(t[12]!==s||t[13]!==n.profiles||t[14]!==o){let e;t[16]!==s||t[17]!==o?(e=e=>(0,Q.jsx)(xn,{selected:o===e.directory,title:e.name,subtitle:_n(e.cookieCount),onSelect:()=>s(e.directory)},e.directory),t[16]=s,t[17]=o,t[18]=e):e=t[18],w=n.profiles.map(e),t[12]=s,t[13]=n.profiles,t[14]=o,t[15]=w}else w=t[15];let T;t[19]===w?T=t[20]:(T=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[C,w]}),t[19]=w,t[20]=T);let E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center text-muted-foreground`,children:[(0,Q.jsx)(g,{className:`size-4 sm:hidden`}),(0,Q.jsx)(S,{className:`hidden size-4 sm:block`})]}),t[21]=E):E=t[21];let D;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Into`}),t[22]=D):D=t[22];let O;t[23]!==a||t[24]!==u||t[25]!==c.kind?(O=a?(0,Q.jsx)(xn,{selected:c.kind===`new`,title:`New profile`,subtitle:`Created for these cookies`,onSelect:()=>u({kind:`new`})}):null,t[23]=a,t[24]=u,t[25]=c.kind,t[26]=O):O=t[26];let k;if(t[27]!==u||t[28]!==c.kind||t[29]!==c.profileId||t[30]!==i){let e;t[32]!==u||t[33]!==c.kind||t[34]!==c.profileId?(e=e=>(0,Q.jsx)(xn,{selected:c.kind===`existing`&&c.profileId===e.id,title:e.name,subtitle:`Existing profile`,onSelect:()=>u({kind:`existing`,profileId:e.id})},e.id),t[32]=u,t[33]=c.kind,t[34]=c.profileId,t[35]=e):e=t[35],k=i.map(e),t[27]=u,t[28]=c.kind,t[29]=c.profileId,t[30]=i,t[31]=k}else k=t[31];let A;t[36]!==O||t[37]!==k?(A=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[D,O,k]}),t[36]=O,t[37]=k,t[38]=A):A=t[38];let j;t[39]!==A||t[40]!==T?(j=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4`,children:[T,E,A]}),t[39]=A,t[40]=T,t[41]=j):j=t[41];let M;t[42]===_?M=t[43]:(M=_?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-destructive`,children:_}):null,t[42]=_,t[43]=M);let N;t[44]!==j||t[45]!==M?(N=(0,Q.jsxs)(Fe,{children:[j,M]}),t[44]=j,t[45]=M,t[46]=N):N=t[46];let P;t[47]===d?P=t[48]:(P=(0,Q.jsx)(y,{variant:`outline`,onClick:d,children:`Cancel`}),t[47]=d,t[48]=P);let F=o===``||m||h,I;t[49]!==f||t[50]!==F?(I=(0,Q.jsx)(y,{disabled:F,onClick:f,children:`Import`}),t[49]=f,t[50]=F,t[51]=I):I=t[51];let L;t[52]!==P||t[53]!==I?(L=(0,Q.jsxs)(Ne,{children:[P,I]}),t[52]=P,t[53]=I,t[54]=L):L=t[54];let R;return t[55]!==N||t[56]!==L||t[57]!==x?(R=(0,Q.jsxs)(Q.Fragment,{children:[x,N,L]}),t[55]=N,t[56]=L,t[57]=x,t[58]=R):R=t[58],R}function xn(e){let t=(0,Z.c)(22),{selected:n,title:r,subtitle:i,onSelect:a}=e,o=n?`border-primary bg-primary/8`:`border-border/60 hover:border-border hover:bg-muted/40`,s;t[0]===o?s=t[1]:(s=w(`flex w-full cursor-pointer items-center justify-between gap-3 rounded-lg border px-3 py-2 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,o),t[0]=o,t[1]=s);let l;t[2]===r?l=t[3]:(l=(0,Q.jsx)(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:r}),t[2]=r,t[3]=l);let u;t[4]===i?u=t[5]:(u=i?(0,Q.jsx)(`span`,{className:`block truncate text-xs tabular-nums text-muted-foreground`,children:i}):null,t[4]=i,t[5]=u);let d;t[6]!==l||t[7]!==u?(d=(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[l,u]}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f=n?`border-primary bg-primary text-primary-foreground`:`border-input`,p;t[9]===f?p=t[10]:(p=w(`grid size-4 shrink-0 place-items-center rounded-full border`,f),t[9]=f,t[10]=p);let m;t[11]===n?m=t[12]:(m=n?(0,Q.jsx)(c,{className:`size-2.5`}):null,t[11]=n,t[12]=m);let h;t[13]!==p||t[14]!==m?(h=(0,Q.jsx)(`span`,{className:p,children:m}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==a||t[17]!==n||t[18]!==s||t[19]!==d||t[20]!==h?(g=(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:a,className:s,children:[d,h]}),t[16]=a,t[17]=n,t[18]=s,t[19]=d,t[20]=h,t[21]=g):g=t[21],g}function Sn(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(je,{children:[(0,Q.jsx)(Me,{children:`Importing cookies`}),(0,Q.jsx)(Ie,{children:`This may take a moment.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[t,(0,Q.jsx)(Fe,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,Q.jsx)(me,{size:`md`,tone:`muted`}),(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Importing…`})]})})]}),e[1]=n):n=e[1],n}function Cn(e){let t=(0,Z.c)(13),{sourceName:n,check:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsxs)(Me,{children:[`Checking `,n]}),t[0]=n,t[1]=i);let a=r===`fullDiskAccess`?`Checking Full Disk Access.`:`Checking whether the browser has closed.`,o;t[2]===a?o=t[3]:(o=(0,Q.jsx)(Ie,{children:a}),t[2]=a,t[3]=o);let s;t[4]!==i||t[5]!==o?(s=(0,Q.jsxs)(je,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6];let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(me,{size:`md`,tone:`muted`}),t[7]=c):c=t[7];let l=r===`fullDiskAccess`?`Checking access…`:`Checking…`,u;t[8]===l?u=t[9]:(u=(0,Q.jsx)(Fe,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[c,(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:l})]})}),t[8]=l,t[9]=u);let d;return t[10]!==s||t[11]!==u?(d=(0,Q.jsxs)(Q.Fragment,{children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function wn(e){let t=(0,Z.c)(24),{imported:n,skipped:r,skippedDomains:i,targetName:a,destinationEnvironmentName:o,onClose:s}=e,c;t[0]!==n||t[1]!==r?(c=n>0?`Imported ${vn(n)}`:r>0?`Skipped ${vn(r)}`:`No cookies found`,t[0]=n,t[1]=r,t[2]=c):c=t[2];let l;t[3]===c?l=t[4]:(l=(0,Q.jsx)(Me,{children:c}),t[3]=c,t[4]=l);let u;t[5]!==o||t[6]!==n||t[7]!==r||t[8]!==a?(u=n>0?`Added to ${a} for ${o}.${r>0?` ${vn(r)} skipped.`:``}`:r>0?`No cookies were imported for ${o}.`:`There were no cookies to import for ${o}.`,t[5]=o,t[6]=n,t[7]=r,t[8]=a,t[9]=u):u=t[9];let d;t[10]===u?d=t[11]:(d=(0,Q.jsx)(Ie,{children:u}),t[10]=u,t[11]=d);let f;t[12]!==l||t[13]!==d?(f=(0,Q.jsxs)(je,{children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=i.length>0?(0,Q.jsxs)(Fe,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Skipped`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-foreground`,children:mn(i)})]}):null,t[15]=i,t[16]=p);let m;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(y,{}),t[17]=m):m=t[17];let h;t[18]===s?h=t[19]:(h=(0,Q.jsx)(Ne,{children:(0,Q.jsx)(Pe,{render:m,onClick:s,children:`Done`})}),t[18]=s,t[19]=h);let g;return t[20]!==f||t[21]!==p||t[22]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[f,p,h]}),t[20]=f,t[21]=p,t[22]=h,t[23]=g):g=t[23],g}function Tn(e){let t=(0,Z.c)(17),{source:n,reason:r,onClose:i,onRetry:a}=e,o;t[0]===n.name?o=t[1]:(o=(0,Q.jsxs)(Me,{children:[`Couldn’t import from `,n.name]}),t[0]=n.name,t[1]=o);let s=te[r],c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(Ie,{children:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c?(l=(0,Q.jsxs)(je,{children:[o,c]}),t[4]=o,t[5]=c,t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=(0,Q.jsx)(y,{variant:`outline`,onClick:i,children:`Close`}),t[7]=i,t[8]=u);let d;t[9]===a?d=t[10]:(d=a?(0,Q.jsx)(y,{onClick:a,children:`Try again`}):null,t[9]=a,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,Q.jsxs)(Ne,{children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==l||t[15]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[l,f]}),t[14]=l,t[15]=f,t[16]=p):p=t[16],p}var En=`fill`,Dn=`responsive`;async function On(e,t,n,r){let i=e===null?[]:t,a=r?.environmentIds??[];if(i.length===0&&a.length===0)throw Error(`Browser profile data is not available to clear.`);await Promise.all([...i.flatMap(t=>[e.clearCookies(t,n),e.clearCache(t,n)]),...a.map(e=>r.clear(e,n))])}function kn(e,t,n,r=0){return(e||r>0)&&t&&n>0}var An={width:1280,height:800},jn={useGrouping:!1},Mn={system:`System`,light:`Light`,dark:`Dark`},Nn=e=>`${Math.round(e*100)}%`,Pn=class extends Error{constructor(){super(`Browser profile limit reached.`),this.name=`ProfileLimitReachedError`}},Fn=e=>{let t=String(e?.message??``);return ie.literals.find(e=>t.includes(`failed: ${e}.`))??`readFailed`},In=e=>e._tag===`fill`?En:e._tag===`preset`&&vt.some(t=>t.id===e.presetId)?e.presetId:Dn,Ln=e=>{let t=In(e);return t===En?`Fill panel`:t===Dn?`Responsive`:vt.find(e=>e.id===t)?.label??`Responsive`},Rn=e=>Number.isInteger(e)&&e>=240&&e<=3840,zn=e=>({...e,width:e.height,height:e.width});function Bn(e){let t=(0,Z.c)(42),{disabled:n}=e,r=J(Hn),i=Y(),a=r._tag===`fill`?null:r,o=a?.width??An.width,s=a?.height??An.height,c;t[0]!==o||t[1]!==s?(c={width:o,height:s},t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]!==a?.height||t[4]!==a?.width||t[5]!==i?(u=e=>{if(e===En){i({browserDefaultViewport:P});return}if(e===Dn){i({browserDefaultViewport:{_tag:`freeform`,width:a?.width??An.width,height:a?.height??An.height}});return}let t=vt.find(t=>t.id===e);t&&i({browserDefaultViewport:{_tag:`preset`,width:t.width,height:t.height,presetId:t.id}})},t[3]=a?.height,t[4]=a?.width,t[5]=i,t[6]=u):u=t[6];let d=u,f;t[7]!==l||t[8]!==a||t[9]!==i?(f=(e,t)=>{if(t===null||!Rn(t))return;let n={...l,[e]:t};n.width*n.height>8294400||a&&n.width===a.width&&n.height===a.height||i({browserDefaultViewport:{_tag:`freeform`,...n}})},t[7]=l,t[8]=a,t[9]=i,t[10]=f):f=t[10];let p=f,m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=yt(`browser-default-viewport`),t[11]=m):m=t[11];let h;t[12]!==n||t[13]!==i||t[14]!==r._tag?(h=!n&&r._tag!==N._tag?(0,Q.jsx)(ht,{label:`default browser viewport`,onClick:()=>i({browserDefaultViewport:N})}):null,t[12]=n,t[13]=i,t[14]=r._tag,t[15]=h):h=t[15];let g;t[16]===r?g=t[17]:(g=In(r),t[16]=r,t[17]=g);let _;t[18]===r?_=t[19]:(_=Ln(r),t[18]=r,t[19]=_);let v;t[20]===_?v=t[21]:(v=(0,Q.jsx)(fe,{size:`sm`,className:`w-full min-w-0 sm:w-44`,"aria-label":`Default browser viewport`,children:(0,Q.jsx)(le,{children:_})}),t[20]=_,t[21]=v);let b,x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(G,{value:En,children:`Fill panel`}),x=(0,Q.jsx)(G,{value:Dn,children:`Responsive`}),t[22]=b,t[23]=x):(b=t[22],x=t[23]);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(K,{align:`end`,alignItemWithTrigger:!1,children:[b,x,(0,Q.jsxs)(de,{children:[(0,Q.jsx)(ue,{children:`Standard`}),vt.map(Vn)]})]}),t[24]=S):S=t[24];let C;t[25]!==n||t[26]!==d||t[27]!==v||t[28]!==g?(C=(0,Q.jsxs)(pe,{value:g,onValueChange:d,disabled:n,children:[v,S]}),t[25]=n,t[26]=d,t[27]=v,t[28]=g,t[29]=C):C=t[29];let w;t[30]!==p||t[31]!==n||t[32]!==l||t[33]!==a||t[34]!==i?(w=a?(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(ce,{value:l.width,min:240,max:O,disabled:n,format:jn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`width`,e),children:(0,Q.jsx)(W,{children:(0,Q.jsx)(se,{"aria-label":`Default viewport width`})})}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`×`}),(0,Q.jsx)(ce,{value:l.height,min:240,max:O,disabled:n,format:jn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`height`,e),children:(0,Q.jsx)(W,{children:(0,Q.jsx)(se,{"aria-label":`Default viewport height`})})}),(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(y,{size:`icon-sm`,variant:`ghost-muted`,disabled:n,"aria-label":`Rotate to ${l.height>=l.width?`landscape`:`portrait`}`,onClick:()=>i({browserDefaultViewport:zn(a)}),children:(0,Q.jsx)(xt,{})})}),(0,Q.jsx)(Oe,{side:`top`,children:`Rotate`})]})]}):null,t[30]=p,t[31]=n,t[32]=l,t[33]=a,t[34]=i,t[35]=w):w=t[35];let T;t[36]!==C||t[37]!==w?(T=(0,Q.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-end gap-2 sm:w-auto`,children:[C,w]}),t[36]=C,t[37]=w,t[38]=T):T=t[38];let E;return t[39]!==T||t[40]!==h?(E=(0,Q.jsx)(X,{...m,description:`Tab size for you and agents. Fill fits the panel; other sizes show the device toolbar.`,resetAction:h,control:T}),t[39]=T,t[40]=h,t[41]=E):E=t[41],E}function Vn(e){return(0,Q.jsx)(G,{value:e.id,children:(0,Q.jsxs)(`span`,{className:`flex w-full items-center justify-between gap-5`,children:[(0,Q.jsx)(`span`,{children:e.label}),(0,Q.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:e.detail})]})},e.id)}function Hn(e){return e.browserDefaultViewport}function Un(e){let t=(0,Z.c)(20),{disabled:n}=e,r=J(Gn),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-default-zoom`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==i||t[3]!==r?(o=!n&&r!==1?(0,Q.jsx)(ht,{label:`default browser zoom`,onClick:()=>i({browserDefaultZoomFactor:1})}):null,t[1]=n,t[2]=i,t[3]=r,t[4]=o):o=t[4];let s=String(r),c;t[5]===i?c=t[6]:(c=e=>{let t=L.find(t=>String(t)===e);t!==void 0&&i({browserDefaultZoomFactor:t})},t[5]=i,t[6]=c);let l;t[7]===r?l=t[8]:(l=Nn(r),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser zoom`,children:(0,Q.jsx)(le,{children:l})}),t[9]=l,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:L.map(Wn)}),t[11]=d):d=t[11];let f;t[12]!==n||t[13]!==s||t[14]!==c||t[15]!==u?(f=(0,Q.jsxs)(pe,{disabled:n,value:s,onValueChange:c,children:[u,d]}),t[12]=n,t[13]=s,t[14]=c,t[15]=u,t[16]=f):f=t[16];let p;return t[17]!==o||t[18]!==f?(p=(0,Q.jsx)(X,{...a,description:`Page zoom applied to new browser tabs.`,resetAction:o,control:f}),t[17]=o,t[18]=f,t[19]=p):p=t[19],p}function Wn(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:String(e),children:Nn(e)},e)}function Gn(e){return e.browserDefaultZoomFactor}function Kn(e){let t=(0,Z.c)(18),{disabled:n}=e,r=J(Jn),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-default-appearance`),t[0]=a):a=t[0];let o;t[1]!==r||t[2]!==n||t[3]!==i?(o=!n&&r!==`system`?(0,Q.jsx)(ht,{label:`default browser appearance`,onClick:()=>i({browserDefaultAppearance:j})}):null,t[1]=r,t[2]=n,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>{(e===`system`||e===`light`||e===`dark`)&&i({browserDefaultAppearance:e})},t[5]=i,t[6]=s);let c=Mn[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser appearance`,children:(0,Q.jsx)(le,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:Object.entries(Mn).map(qn)}),t[9]=u):u=t[9];let d;t[10]!==r||t[11]!==n||t[12]!==s||t[13]!==l?(d=(0,Q.jsxs)(pe,{disabled:n,value:r,onValueChange:s,children:[l,u]}),t[10]=r,t[11]=n,t[12]=s,t[13]=l,t[14]=d):d=t[14];let f;return t[15]!==o||t[16]!==d?(f=(0,Q.jsx)(X,{...a,description:`The color scheme pages are told to prefer. System follows your OS setting.`,resetAction:o,control:d}),t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function qn(e){let[t,n]=e;return(0,Q.jsx)(G,{hideIndicator:!0,value:t,children:n},t)}function Jn(e){return e.browserDefaultAppearance}function Yn(e){let t=(0,Z.c)(17),{disabled:n}=e,r=J(Zn),i=J(Xn),a=Y(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=yt(`browser-recording-key-presses`),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=e=>a({browserRecordingShowKeyPresses:!!e}),t[1]=a,t[2]=s);let c;t[3]!==n||t[4]!==r||t[5]!==s?(c=(0,Q.jsx)(X,{...o,description:`Show pressed keys and shortcuts in new recordings. Password fields are excluded.`,control:(0,Q.jsx)(bt,{disabled:n,checked:r,"aria-label":`Show key presses in recordings`,onCheckedChange:s})}),t[3]=n,t[4]=r,t[5]=s,t[6]=c):c=t[6];let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=yt(`browser-recording-mouse-presses`),t[7]=l):l=t[7];let u;t[8]===a?u=t[9]:(u=e=>a({browserRecordingShowMousePresses:!!e}),t[8]=a,t[9]=u);let d;t[10]!==n||t[11]!==i||t[12]!==u?(d=(0,Q.jsx)(X,{...l,description:`Highlight mouse presses and held buttons in new recordings.`,control:(0,Q.jsx)(bt,{disabled:n,checked:i,"aria-label":`Show mouse presses in recordings`,onCheckedChange:u})}),t[10]=n,t[11]=i,t[12]=u,t[13]=d):d=t[13];let f;return t[14]!==c||t[15]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[c,d]}),t[14]=c,t[15]=d,t[16]=f):f=t[16],f}function Xn(e){return e.browserRecordingShowMousePresses}function Zn(e){return e.browserRecordingShowKeyPresses}function Qn(e){let t=(0,Z.c)(18),{disabled:n}=e,r=J(er),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-recording-frame-rate`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==r||t[3]!==i?(o=!n&&r!==30?(0,Q.jsx)(ht,{label:`browser recording frame rate`,onClick:()=>i({browserRecordingFrameRate:30})}):null,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s=String(r),c;t[5]===i?c=t[6]:(c=e=>{let t=F.find(t=>String(t)===e);t!==void 0&&i({browserRecordingFrameRate:t})},t[5]=i,t[6]=c);let l;t[7]===r?l=t[8]:(l=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Browser recording frame rate`,children:(0,Q.jsxs)(le,{children:[r,` fps`]})}),t[7]=r,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:F.map($n)}),t[9]=u):u=t[9];let d;t[10]!==n||t[11]!==s||t[12]!==c||t[13]!==l?(d=(0,Q.jsxs)(pe,{disabled:n,value:s,onValueChange:c,children:[l,u]}),t[10]=n,t[11]=s,t[12]=c,t[13]=l,t[14]=d):d=t[14];let f;return t[15]!==o||t[16]!==d?(f=(0,Q.jsx)(X,{...a,description:`Maximum recording rate. 30 fps saves CPU and storage; 60 fps is smoother.`,resetAction:o,control:d}),t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function $n(e){return(0,Q.jsxs)(G,{hideIndicator:!0,value:String(e),children:[e,` fps`]},e)}function er(e){return e.browserRecordingFrameRate}var tr={system:`Your default browser`,app:`P4 Code`};function nr(e){let t=(0,Z.c)(19),{disabled:n}=e,r=J(ir),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-link-target`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==r||t[3]!==i?(o=!n&&r!==`system`?(0,Q.jsx)(ht,{label:`link target`,onClick:()=>i({browserLinkTarget:ee})}):null,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>{(e===`system`||e===`app`)&&i({browserLinkTarget:e})},t[5]=i,t[6]=s);let c=tr[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Open links in`,children:(0,Q.jsx)(le,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.keys(tr),t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:u.map(rr)}),t[10]=d):d=t[10];let f;t[11]!==n||t[12]!==r||t[13]!==s||t[14]!==l?(f=(0,Q.jsxs)(pe,{disabled:n,value:r,onValueChange:s,children:[l,d]}),t[11]=n,t[12]=r,t[13]=s,t[14]=l,t[15]=f):f=t[15];let p;return t[16]!==o||t[17]!==f?(p=(0,Q.jsx)(X,{...a,description:`Where links in the chat and terminal open. Hold ⌘ or Ctrl while clicking a link to open it in your default browser either way.`,resetAction:o,control:f}),t[16]=o,t[17]=f,t[18]=p):p=t[18],p}function rr(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:e,children:tr[e]},e)}function ir(e){return e.browserLinkTarget}var ar={duckduckgo:`DuckDuckGo`,google:`Google`,bing:`Bing`,brave:`Brave Search`,kagi:`Kagi`,ecosia:`Ecosia`,custom:`Custom`};function or(){let e=(0,Z.c)(24),t=J(lr),n=J(cr),r=Y(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=yt(`browser-search-engine`),e[0]=i):i=e[0];let a;e[1]!==n||e[2]!==t||e[3]!==r?(a=t!==`duckduckgo`||n!==``?(0,Q.jsx)(ht,{label:`search engine`,onClick:()=>r({browserSearchEngine:M,browserCustomSearchUrl:``})}):null,e[1]=n,e[2]=t,e[3]=r,e[4]=a):a=e[4];let o;e[5]===r?o=e[6]:(o=e=>{let t=ne.literals.find(t=>t===e);t!==void 0&&r({browserSearchEngine:t})},e[5]=r,e[6]=o);let s=ar[t],c;e[7]===s?c=e[8]:(c=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Search engine`,children:(0,Q.jsx)(le,{children:s})}),e[7]=s,e[8]=c);let l;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:ne.literals.map(sr)}),e[9]=l):l=e[9];let u;e[10]!==t||e[11]!==o||e[12]!==c?(u=(0,Q.jsxs)(pe,{value:t,onValueChange:o,children:[c,l]}),e[10]=t,e[11]=o,e[12]=c,e[13]=u):u=e[13];let d;e[14]!==a||e[15]!==u?(d=(0,Q.jsx)(X,{...i,description:`What the address bar searches when you type something that isn't a URL.`,resetAction:a,control:u}),e[14]=a,e[15]=u,e[16]=d):d=e[16];let f;e[17]!==n||e[18]!==t||e[19]!==r?(f=t===`custom`?(0,Q.jsx)(X,{title:`Custom search URL`,description:`Use %s where the search terms go.`,status:nt(n)?void 0:`Enter an http or https URL containing %s. Searches use DuckDuckGo until then.`,control:(0,Q.jsx)(Tt,{nativeInput:!0,size:`sm`,className:`w-full sm:w-64`,"aria-label":`Custom search URL`,placeholder:`https://example.com/search?q=%s`,autoCapitalize:`none`,spellCheck:!1,maxLength:re,value:n,onCommit:e=>r({browserCustomSearchUrl:e.trim()})})}):null,e[17]=n,e[18]=t,e[19]=r,e[20]=f):f=e[20];let p;return e[21]!==d||e[22]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[d,f]}),e[21]=d,e[22]=f,e[23]=p):p=e[23],p}function sr(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:e,children:ar[e]},e)}function cr(e){return e.browserCustomSearchUrl}function lr(e){return e.browserSearchEngine}function ur(){let e=(0,Z.c)(12),t=J(dr),n=Y(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=yt(`pull-request-links-open-in-app`),e[0]=r):r=e[0];let i;e[1]!==t||e[2]!==n?(i=t?null:(0,Q.jsx)(ht,{label:`open pull requests in P4 Code`,onClick:()=>n({pullRequestLinksOpenInApp:!0})}),e[1]=t,e[2]=n,e[3]=i):i=e[3];let a;e[4]===n?a=e[5]:(a=e=>n({pullRequestLinksOpenInApp:!!e}),e[4]=n,e[5]=a);let o;e[6]!==t||e[7]!==a?(o=(0,Q.jsx)(bt,{checked:t,onCheckedChange:a,"aria-label":`Open pull requests in P4 Code`}),e[6]=t,e[7]=a,e[8]=o):o=e[8];let s;return e[9]!==i||e[10]!==o?(s=(0,Q.jsx)(X,{...r,description:`Clicking a pull request link opens it in P4 Code. Turn off to open pull request links like any other link, on GitHub or your git host.`,resetAction:i,control:o}),e[9]=i,e[10]=o,e[11]=s):s=e[11],s}function dr(e){return e.pullRequestLinksOpenInApp}function fr(){let e=(0,Z.c)(7),{search:t,environment:n}=ft(),r=ut(),i=n?.connection.phase===`connected`&&n.serverConfig!==null?n.environmentId:null,a;e[0]===t?a=e[1]:(a=JSON.stringify(t),e[0]=t,e[1]=a);let o=`${i}:${a}`,s;return e[2]!==i||e[3]!==r.enableAgentDeviceAccess||e[4]!==r.enableDeviceSupport||e[5]!==o?(s=(0,Q.jsx)(gt,{id:`devices`,title:`Devices`,children:(0,Q.jsx)(pr,{environmentId:i,enabled:r.enableDeviceSupport,agentAccessEnabled:r.enableAgentDeviceAccess},o)}),e[2]=i,e[3]=r.enableAgentDeviceAccess,e[4]=r.enableDeviceSupport,e[5]=o,e[6]=s):s=e[6],s}function pr({environmentId:e,enabled:t,agentAccessEnabled:n}){let r=Se(e,H),{state:i,loaded:a}=ze(e),{scope:o,environments:s,connectedEnvironments:c}=ft(),l=dt(),u=o.kind===`project`||o.kind===`checkout`,d=c.some(e=>e.serverConfig?.settings.enableDeviceSupport),f=Te(Be.configure,{reportFailure:!1}),p=Te(Be.list,{reportFailure:!1}),[m,h]=(0,$.useState)(null),g=i.hostStatus===`installing`||i.hostStatus===`starting`,v=i.hosts.some(e=>e.kind===`local`&&!e.platforms.some(e=>e.available)),[b,x]=(0,$.useState)(!1);b&&!t&&x(!1),t&&!b&&(i.hostStatus===`ready`||v)&&m!==`hub`&&x(!0);let S=async(t,n)=>{if(e&&Ce(e,`settings:write`)){h(t);try{let e=await Promise.allSettled(s.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!Ce(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return f({environmentId:e.environmentId,input:{...n,...n.enabled?{onboardingCompleted:!0}:{}}})})),t=s.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});t.length>0&&q.add({type:`error`,title:`Device settings not saved on all environments`,description:`Could not update ${t.map(e=>e.label).join(`, `)}.`})}finally{h(null)}}},[C,w]=(0,$.useState)(null),T=i.hosts.find(e=>e.kind===`local`)?.tools,E=e=>{let t=T?.[e];return i.supportsToolUpdate&&t?!t.installedVersions.includes(t.requiredVersion):!1},D=(t,n=!1)=>{e&&(w(null),h(`update-${t}`),p({environmentId:e,input:{updateTool:t}}).then(e=>{if(e._tag===`Failure`){let r=we(e.cause);w({tool:t,message:r}),n&&q.add({type:`error`,title:r})}}).finally(()=>h(null)))},O=t=>{e&&(h(t),p({environmentId:e,input:{inspectOnly:!0}}).finally(()=>h(null)))},k=t=>{let n=E(t);if(!n&&!i.supportsToolInspection)return null;let r=m===`update-${t}`||m===`check-${t}`,a=n?`Update to v${T?.[t].requiredVersion}`:`Check ${t===`hub`?`device hub`:`agent device`} version`;return(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(y,{size:`icon-xs`,variant:`ghost-muted`,disabled:!e||m!==null||g,"aria-label":a,onClick:()=>n?D(t,!0):O(`check-${t}`)}),children:(0,Q.jsxs)(`span`,{className:`grid *:col-start-1 *:row-start-1 *:transition-[opacity,scale] *:duration-150 *:ease-out motion-reduce:*:transition-none`,children:[(0,Q.jsx)(`span`,{className:n&&!r?void 0:`scale-75 opacity-0`,children:(0,Q.jsx)(_,{"aria-hidden":!0})}),(0,Q.jsx)(`span`,{className:n&&!r?`scale-75 opacity-0`:void 0,children:(0,Q.jsx)(St,{refreshing:r})})]})}),(0,Q.jsx)(Oe,{side:`top`,children:a})]})},A=t=>{let n=T?.[t];return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&E(t)?(0,Q.jsx)(y,{size:`sm`,disabled:!e||m!==null||g,onClick:()=>D(t),children:m===`update-${t}`?`Updating…`:`Update`}):null,i.supportsToolInspection?(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:!e||m!==null||g,onClick:()=>O(`check`),children:m===`check`?`Checking…`:`Check versions`}):null]}),C?.tool===t?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:C.message}):null]})};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{...yt(`device-hub`),serverScoped:!0,settingKeys:[`enableDeviceSupport`],description:Ge,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(jt,{action:A(`hub`),kind:`hub`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),k(`hub`),m===`hub`?(0,Q.jsx)(We,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(Et,{settingKeys:[`enableDeviceSupport`],checked:t,disabled:!r||u||!a||!e||g||m!==null,"aria-label":`Device hub`,onCheckedChange:e=>void S(`hub`,{enabled:!!e,...e?{}:{agentAccessEnabled:!1}})})]})}),(0,Q.jsx)(Qe,{children:b?(0,Q.jsx)(X,{...yt(`device-platform-support`),description:c.length>1?`Status for ${c.find(t=>t.environmentId===e)?.label}. Select an environment to inspect its simulator support.`:void 0,status:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2`,children:[(0,Q.jsx)(Ue,{compact:!0,platform:`iOS`,status:qe(i,`ios`)}),(0,Q.jsx)(Ue,{compact:!0,platform:`Android`,status:qe(i,`android`)})]}),control:(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:!e||!t||g||m!==null,onClick:()=>{e&&(h(`check`),p({environmentId:e,input:{}}).finally(()=>h(null)))},children:m===`check`?`Checking…`:`Refresh`})}):null}),(0,Q.jsx)(X,{...yt(`agent-device-access`),serverScoped:!0,settingKeys:[`enableAgentDeviceAccess`],description:Ve,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(jt,{action:A(`agent`),kind:`agent`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),k(`agent`),m===`agent`?(0,Q.jsx)(Ke,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(Et,{settingKeys:[`enableAgentDeviceAccess`],checked:n,disabled:!r||c.length===0||!u&&(!a||!d||g)||m!==null,"aria-label":`Agent device access`,onCheckedChange:e=>u?l({enableAgentDeviceAccess:!!e}):void S(`agent`,{agentAccessEnabled:!!e})})]})}),e?(0,Q.jsx)(He,{state:{...i,hosts:i.hosts.filter(e=>e.kind===`local`)},environmentId:e}):null,(0,Q.jsx)(Wt,{environmentId:e}),i.supportsEasHosts?(0,Q.jsx)(tn,{environmentId:e}):null]})}function mr(e){let t=(0,Z.c)(14),{disabled:n}=e,r=J(hr),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-auto-show-floating-preview`),t[0]=a):a=t[0];let o;t[1]!==r||t[2]!==n||t[3]!==i?(o=!n&&r!==!0?(0,Q.jsx)(ht,{label:`auto-show floating preview`,onClick:()=>i({browserAutoShowFloatingPreview:!0})}):null,t[1]=r,t[2]=n,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>i({browserAutoShowFloatingPreview:!!e}),t[5]=i,t[6]=s);let c;t[7]!==r||t[8]!==n||t[9]!==s?(c=(0,Q.jsx)(bt,{disabled:n,checked:r,onCheckedChange:s,"aria-label":`Auto-show floating preview`}),t[7]=r,t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;return t[11]!==o||t[12]!==c?(l=(0,Q.jsx)(X,{...a,description:`Show the floating preview when an agent opens a browser or device unless the agent says otherwise.`,resetAction:o,control:c}),t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function hr(e){return e.browserAutoShowFloatingPreview}function gr({disabled:e}){let t=J(e=>e.browserProfiles),n=J(e=>e.browserDefaultProfileId),r=ve(),a=Y(),{environments:o,isReady:c}=he(),l=_e(),[h,g]=(0,$.useState)(null),[_,b]=(0,$.useState)(null),[S,E]=(0,$.useState)(null),[D,O]=(0,$.useState)(null),[j,M]=(0,$.useState)(null),[N,P]=(0,$.useState)(!1),F=oe(),I=Te(tt.clearProfile,{reportFailure:!1}),L={environmentIds:o.map(e=>e.environmentId).filter(e=>F.get(e)?.environment.capabilities.serverBrowser===!0),clear:async(e,t)=>{let n=await I({environmentId:e,input:{profileId:t}});if(n._tag===`Failure`)throw ae(n)}},B=kn(Ct!==null,c,o.length,L.environmentIds.length),V=(0,$.useRef)(!1),[ee,H]=(0,$.useState)(!1),U=e||!r,te=R(t).filter(e=>e.kind!==`incognito`),ne=k(te,n)?.id??`default`,re=e=>{if(!r||V.current)return;let t=be().browserProfiles;if(t.length>=24)return;let n=R(t),i=new Set(n.map(e=>e.name)),o=e;for(let t=2;i.has(o);t+=1)o=`${e} ${t}`;let s={id:`profile-${v()}`,name:o,kind:`persistent`};return a({browserProfiles:[...t,s]}),s},ie=(e,t)=>{if(!r||V.current)return;let n=t.trim().slice(0,48);if(n===``)return;let i=be().browserProfiles;a({browserProfiles:i.map(t=>t.id===e?{...t,name:n}:t)})},se=(e,t)=>{r&&!V.current&&(B?On(Ct,o.map(e=>e.environmentId),e,L).then(()=>{q.add({type:`success`,title:`Cleared ${t}'s cookies and cache`})}).catch(()=>{q.add({type:`error`,title:`Could not clear ${t}'s data`})}):q.add({type:`error`,title:`Could not clear ${t}'s data`,description:`You're not connected to a server yet.`}))},W=async e=>{if(!r||V.current)return;if(!B){M(`Connect to an environment before removing this profile.`);return}M(null),P(!0);try{await On(Ct,c?o.map(e=>e.environmentId):[],e,L)}catch{M(`Profile data could not be deleted. Try again.`),P(!1);return}let t=be();a({browserProfiles:t.browserProfiles.filter(t=>t.id!==e),...t.browserDefaultProfileId===e?{browserDefaultProfileId:A}:{}}),P(!1),E(null)},ce=(h??[]).filter(e=>e.unavailable!==`notInstalled`&&e.unavailable!==`unsupportedPlatform`),G=(0,$.useCallback)(()=>{Ct&&Ct.listBrowserImportSources().then(g).catch(()=>g(e=>e??[]))},[]),le=async(e,t,n)=>{if(!Ct||!r)return{kind:`blocked`,reason:`sessionUnavailable`};if(n.target.kind===`existing`&&!R(be().browserProfiles).some(e=>e.id===n.target.profileId)||V.current)return{kind:`blocked`,reason:`readFailed`};V.current=!0,H(!0);try{let r=await Ct.importBrowserCookies({environmentId:t,sourceId:e.id,sourceProfileDirectory:n.sourceProfileDirectory,targetProfileId:n.target.profileId});if(n.target.kind===`existing`&&!R(be().browserProfiles).some(e=>e.id===n.target.profileId))return{kind:`blocked`,reason:`readFailed`};let i;if(n.target.kind===`new`){if(r.imported>0)try{i=(await ye(t=>{if(t.browserProfiles.find(e=>e.id===n.target.profileId))return t;if(t.browserProfiles.length>=24)throw new Pn;let r=new Set(R(t.browserProfiles).map(e=>e.name)),i=e.name;for(let t=2;r.has(i);t+=1)i=`${e.name} ${t}`;return{...t,browserProfiles:[...t.browserProfiles,{id:n.target.profileId,name:i,kind:`persistent`}]}})).browserProfiles.find(e=>e.id===n.target.profileId)?.name??e.name}catch(r){await On(Ct,[t],n.target.profileId).catch(()=>void 0);let i=r instanceof Pn?`profileLimitReached`:`profileNotSaved`;throw Error(`Importing cookies from ${e.id} failed: ${i}.`,{cause:r})}else i=e.name}else i=n.target.name;return{kind:`imported`,imported:r.imported,skipped:r.skipped,skippedDomains:r.skippedDomains,targetName:i}}catch(e){return{kind:`blocked`,reason:Fn(e)}}finally{V.current=!1,H(!1)}},ue=async e=>{if(Ct)try{let t=await Ct.listBrowserImportSources();return g(t),t.find(t=>t.id===e)}catch{return}},K=t.length>=24;return(0,Q.jsxs)(X,{...yt(`browser-profiles`),description:`Profiles separate cookies and logins. Incognito data is cleared when the app closes.`,control:(0,Q.jsxs)(f,{onOpenChange:e=>e&&G(),children:[(0,Q.jsxs)(m,{render:(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:U||ee}),children:[(0,Q.jsx)(d,{}),`Add profile`]}),(0,Q.jsxs)(x,{align:`end`,children:[(0,Q.jsx)(T,{disabled:!r||K,onClick:()=>re(`New profile`),children:`Blank profile`}),K?(0,Q.jsx)(T,{disabled:!0,children:`You’ve reached the profile limit`}):null,(0,Q.jsx)(C,{}),(0,Q.jsxs)(i,{children:[(0,Q.jsx)(p,{children:`Import from`}),h===null?(0,Q.jsx)(T,{disabled:!0,children:`Looking for browsers…`}):ce.length===0?(0,Q.jsx)(T,{disabled:!0,children:`No supported browsers found`}):(0,Q.jsxs)(Q.Fragment,{children:[ce.map(e=>(0,Q.jsx)(T,{disabled:!r||l==null,onClick:()=>{r&&l!=null&&b({source:e,environmentId:l.environmentId,environmentName:_t({isPrimary:!0,environmentId:l.environmentId,runtimeLabel:l.label})})},children:e.name},e.id)),l==null?(0,Q.jsx)(T,{disabled:!0,children:`Connect to an environment to import cookies`}):null]})]})]})]}),children:[(0,Q.jsx)(`div`,{className:`mt-2 mb-2 overflow-hidden rounded-lg border border-border/60`,children:te.map((e,t)=>{let n=z(e.id),i=e.id===ne;return(0,Q.jsxs)(`div`,{className:w(`flex items-center gap-3 px-3 py-2`,t>0&&`border-t border-border/60`),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[n?(0,Q.jsx)(`span`,{className:w(`truncate text-sm text-foreground`,U&&`opacity-64`),children:e.name}):(0,Q.jsx)(Tt,{nativeInput:!0,size:`sm`,className:`w-full max-w-56`,"aria-label":`Rename ${e.name}`,disabled:U||ee,maxLength:48,value:e.name,onCommit:t=>ie(e.id,t)}),i?(0,Q.jsx)(`span`,{className:w(`flex`,U&&`opacity-64`),children:(0,Q.jsx)(u,{children:`Default`})}):null]}),(0,Q.jsxs)(f,{children:[(0,Q.jsx)(m,{render:(0,Q.jsx)(y,{size:`icon-xs`,variant:`ghost-muted`,disabled:U||ee,"aria-label":`${e.name} options`}),children:(0,Q.jsx)(s,{})}),(0,Q.jsxs)(x,{align:`end`,children:[(0,Q.jsx)(T,{disabled:!r||i,onClick:()=>{r&&a({browserDefaultProfileId:e.id})},children:`Set as default`}),(0,Q.jsx)(T,{disabled:!r||!B,onClick:()=>{L.environmentIds.length>0?O(e):se(e.id,e.name)},children:`Clear cookies and cache`}),n?null:(0,Q.jsx)(T,{variant:`destructive`,disabled:!r||!B,onClick:()=>{r&&E(e)},children:`Remove profile and data`}),B?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(C,{}),(0,Q.jsx)(T,{disabled:!0,children:c?`Connect to an environment to clear profile data`:`Checking environments…`})]})]})]})]},e.id)})}),(0,Q.jsx)(lt,{open:S!==null,onOpenChange:e=>{!e&&!N&&(E(null),M(null))},children:(0,Q.jsxs)(ot,{children:[(0,Q.jsxs)(rt,{children:[(0,Q.jsxs)(ct,{children:[`Remove “`,S?.name,`”?`]}),(0,Q.jsx)(st,{children:`Its cookies and logins are deleted. Desktop tabs already open in this profile stay open until you close them; server browser tabs close now.`}),j?(0,Q.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-destructive`,children:j}):null,B?null:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect to an environment to remove this profile and its data.`})]}),(0,Q.jsxs)(it,{children:[(0,Q.jsx)(at,{disabled:N,render:(0,Q.jsx)(y,{variant:`outline`,disabled:N}),children:`Cancel`}),(0,Q.jsx)(y,{variant:`destructive`,disabled:N||!r||!B,onClick:()=>{S&&r&&B&&W(S.id)},children:N?`Removing…`:`Remove profile`})]})]})}),(0,Q.jsx)(lt,{open:D!==null,onOpenChange:e=>{e||O(null)},children:(0,Q.jsxs)(ot,{children:[(0,Q.jsxs)(rt,{children:[(0,Q.jsxs)(ct,{children:[`Clear “`,D?.name,`”’s cookies and cache?`]}),(0,Q.jsx)(st,{children:`You are signed out of its sites. Server browser tabs open in this profile close now.`})]}),(0,Q.jsxs)(it,{children:[(0,Q.jsx)(at,{render:(0,Q.jsx)(y,{variant:`outline`}),children:`Cancel`}),(0,Q.jsx)(y,{variant:`destructive`,onClick:()=>{D&&se(D.id,D.name),O(null)},children:`Clear data`})]})]})}),_?(0,Q.jsx)(hn,{source:_.source,destinationEnvironmentName:_.environmentName,targetProfiles:te.map(e=>({id:e.id,name:e.name})),canCreateProfile:r&&!K,onImport:e=>le(_.source,_.environmentId,e),onRefreshSource:()=>ue(_.source.id),onCheckFullDiskAccess:window.desktopBridge?.checkSystemPermission?()=>window.desktopBridge.checkSystemPermission(`full-disk-access`):void 0,onOpenFullDiskAccessSettings:async()=>{await ge()?.shell.openSystemSettings(`full-disk-access`).catch(()=>{q.add({type:`error`,title:`Could not open System Settings`,description:`Open Privacy & Security → Full Disk Access manually.`})})},onClose:()=>b(null)}):null]})}function _r(){let e=(0,Z.c)(3),t=!Ee,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(gr,{disabled:t}),(0,Q.jsx)(Bn,{disabled:t}),(0,Q.jsx)(Un,{disabled:t}),(0,Q.jsx)(Kn,{disabled:t}),(0,Q.jsx)(Qn,{disabled:t}),(0,Q.jsx)(Yn,{disabled:t}),(0,Q.jsx)(nr,{disabled:t}),(0,Q.jsx)(mr,{disabled:t})]}),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(wt,{category:`integrations`}),e[1]=i):i=e[1];let a;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(mt,{children:[i,(0,Q.jsxs)(gt,{id:`browser`,title:`Browser`,children:[t?(0,Q.jsx)(pt,{message:`Only available in the desktop app.`,children:r}):r,(0,Q.jsx)(or,{}),(0,Q.jsx)(ur,{})]}),(0,Q.jsx)(fr,{})]}),e[2]=a):a=e[2],a}var vr=_r;export{vr as component};
2
- //# sourceMappingURL=settings.integrations-Bx78DSgB.js.map
1
+ import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{$n as i,Hu as a,Jl as o,Od as s,Ol as c,Td as l,Xn as u,Zd as d,Zn as f,er as p,fr as m,hr as h,il as g,iu as _,l as v,mr as y,op as b,rr as x,sl as S,sr as C,t as w,tr as T,wd as E}from"./utils-BVnIIHXP.js";import{Cg as D,Hr as O,Jr as k,Kr as A,Lr as j,Mn as M,Nn as N,Rr as P,Sn as F,Vm as I,Wr as L,Xr as R,Yr as z,cc as B,hl as V,jn as ee,la as H,lc as U,v as te,wn as ne,xn as re,y as ie}from"./src-DHn7yNZx.js";import{Dr as ae}from"./runtime-vb0YwEUc.js";import{w as oe}from"./entities-JWl3bvMT.js";import{a as se,r as W,t as ce}from"./number-field-DNna9ps3.js";import{a as G,c as le,i as ue,o as K,r as de,s as fe,t as pe}from"./select-CNcZzYBl.js";import{t as me}from"./spinner-m1uNq_wW.js";import{a as q}from"./relay-Ceq0htTl.js";import{D as he,J as ge,O as _e,c as ve,o as ye,r as be,s as J,x as Y}from"./useSettings-Dp27sUML.js";import{f as xe}from"./server-Bw1ZPPkk.js";import{i as Se,n as Ce}from"./session-YEQs2e4k.js";import{t as we}from"./query-DFSffMGJ.js";import{t as Te}from"./use-atom-command-DkmE-pw9.js";import{t as Ee}from"./env-BfPir1X4.js";import{a as De,n as Oe,t as ke}from"./tooltip-BhCWnsdW.js";import{t as Ae}from"./input-yaZxaTds.js";import{a as je,c as Me,i as Ne,n as Pe,o as Fe,r as Ie,s as Le,t as Re}from"./dialog-DFlZvvht.js";import{i as ze,t as Be}from"./device-i4SkE05R.js";import{a as Ve,d as He,i as Ue,n as We,o as Ge,t as Ke,u as qe}from"./DeviceSetup-BQvNWMm0.js";import{a as Je,i as Ye,o as Xe,t as Ze}from"./popover-DnYfrQly.js";import{t as Qe}from"./AnimatedHeight-B2j_NXft.js";import{i as $e,n as et}from"./Icons-DpgbzNj8.js";import{t as tt}from"./preview-Dd9kGZBH.js";import{r as nt}from"./preview-Bi-hPWTp.js";import{a as rt,i as it,n as at,o as ot,r as st,s as ct,t as lt}from"./alert-dialog-Dn_PRSFU.js";import{F as ut,R as dt,V as ft,a as X,c as pt,i as mt,r as ht,s as gt,w as _t}from"./settingsLayout-DaKDuaST.js";import{$a as vt,Lr as yt,No as bt,Qa as xt,Uo as St,oo as Ct}from"./main-43D2LVmx.js";import{t as wt}from"./ProjectDefaultsSettings-TlEARfjk.js";import{t as Tt}from"./draft-input-1HTN8QVo.js";import{t as Et}from"./ScopedSwitch-D1e9m-dH.js";import{t as Dt}from"./SecretInput-C6zW-8wI.js";import{n as Ot,r as kt,t as At}from"./usePermissionStatus-DeJYBk6u.js";var Z=n(),Q=e(r(),1);function jt(e){let t=(0,Z.c)(27),{tools:n,action:r,kind:i,owner:a,error:o}=e,s=i?n?.[i]:void 0,c;t[0]===s?c=t[1]:(c=s?.runningVersion??(s?.installedVersions.includes(s.requiredVersion)?s.requiredVersion:s?.installedVersions.toSorted(Mt).at(-1)),t[0]=s,t[1]=c);let l=c,u=i===`hub`?`Device hub`:`Agent device`,d=i?`${u}: ${l?`version ${l}`:s?`not installed`:`version unknown`}. Show details`:void 0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(h,{tone:`muted`}),t[2]=f):f=t[2];let p=i?l?`v${l}`:s?`Not installed`:`Version unknown`:o?`Versions unavailable`:`Versions`,m;t[3]!==d||t[4]!==p?(m=(0,Q.jsx)(Xe,{"aria-label":d,render:f,children:p}),t[3]=d,t[4]=p,t[5]=m):m=t[5];let g=i?u:`Device tools`,_;t[6]===g?_=t[7]:(_=(0,Q.jsx)(Je,{children:g}),t[6]=g,t[7]=_);let v;t[8]!==i||t[9]!==u||t[10]!==n?(v=n?(0,Q.jsx)(`div`,{className:`mt-4 divide-y divide-border/50`,children:[[`Device hub`,n.hub],[`Agent device`,n.agent]].filter(e=>{let[t]=e;return!i||t===u}).map(e=>{let[t,n]=e;return(0,Q.jsxs)(`div`,{className:`space-y-2 py-3 first:pt-0 last:pb-0`,children:[i?null:(0,Q.jsx)(`p`,{className:`text-xs font-medium`,children:t}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 text-xs`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Running`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.runningVersion??`Not running`}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Required`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.requiredVersion}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Installed`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono break-words`,children:n.installedVersions.join(`, `)||`None`})]})]},t)})}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Versions have not been checked.`}),t[8]=i,t[9]=u,t[10]=n,t[11]=v):v=t[11];let y=a?`Managed by ${a}. `:``,b;t[12]===y?b=t[13]:(b=(0,Q.jsxs)(`p`,{className:`mt-4 border-t border-border/50 pt-3 text-xs text-muted-foreground`,children:[y,`Tools update automatically on this host when needed.`]}),t[12]=y,t[13]=b);let x;t[14]===o?x=t[15]:(x=o?(0,Q.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-destructive`,children:o}):null,t[14]=o,t[15]=x);let S;t[16]===r?S=t[17]:(S=r?(0,Q.jsx)(`div`,{className:`mt-3`,children:r}):null,t[16]=r,t[17]=S);let C;t[18]!==b||t[19]!==x||t[20]!==S||t[21]!==_||t[22]!==v?(C=(0,Q.jsxs)(Ye,{align:`end`,width:`md`,children:[_,v,b,x,S]}),t[18]=b,t[19]=x,t[20]=S,t[21]=_,t[22]=v,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==m?(w=(0,Q.jsxs)(Ze,{children:[m,C]}),t[24]=C,t[25]=m,t[26]=w):w=t[26],w}function Mt(e,t){return e.localeCompare(t,void 0,{numeric:!0})}var $=e(t(),1);function Nt(e,t,n,r=t){let i=(e,t)=>e.target===t.target&&e.port===t.port&&e.identityFile===t.identityFile,a=t=>{let n=e.filter(e=>i(e,t));if(n.length>1)throw Error(`Multiple hosts match this SSH destination. Select the environment to edit its hosts.`);return n[0]},o=e.find(e=>e.id===r.id)??a(r)??(n?void 0:a(t));return n?e.filter(e=>e.id!==o?.id):o?e.map(e=>e.id===o.id?{...t,id:o.id}:e):[...e,t]}function Pt(e){let t=(0,Z.c)(4),{platforms:n}=e,r;t[0]===n?r=t[1]:(r=n.map(Ft),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:r}),t[2]=r,t[3]=i),i}function Ft(e){return(0,Q.jsxs)(ke,{children:[(0,Q.jsxs)(De,{render:(0,Q.jsx)(`span`,{tabIndex:0,className:`inline-flex items-center gap-1`}),children:[e.available?(0,Q.jsx)(c,{className:`size-3`}):(0,Q.jsx)(E,{className:`size-3`}),e.platform===`ios`?`iOS`:`Android`,` `,e.available?`available`:`unavailable`]}),(0,Q.jsx)(Oe,{children:e.reason??(e.platform===`ios`?`iOS available`:`Android available`)})]},e.platform)}var It=V(U);function Lt(e){let{identityFile:t,...n}=e;return It({...n,...t?.trim()?{identityFile:t.trim()}:{}})}function Rt(e){return JSON.stringify([e.target.trim(),e.port,e.identityFile?.trim()||void 0])}async function zt(e,t,n,r){await Promise.all(e.map(async e=>{r(e.environmentId,{status:`pending`});try{if(!e.connected)throw Error(`Environment disconnected`);let i=await n(e.environmentId,t);r(e.environmentId,i.kind===`local`?{status:`local`}:{status:`connected`,platforms:i.platforms,...i.tools?{tools:i.tools}:{}})}catch(t){r(e.environmentId,{status:`failed`,error:t instanceof Error?t.message:String(t)})}}))}function Bt(e){let t=Te(Be.testHost,{reportFailure:!1}),[n,r]=(0,$.useState)({}),i=(0,$.useRef)(new Set);return{checks:n,testConnection:async n=>{let a=Rt(n);if(i.current.has(a))return;i.current.add(a),r(e=>({...e,[a]:{}}));let o={};try{return await zt(e,n,async(e,n)=>{if(!Ce(e,`settings:write`))throw Error(`This connection cannot test device hosts.`);let r=await t({environmentId:e,input:n});if(r._tag===`Failure`)throw ae(r);return r.value},(e,t)=>{o[e]=t,r(n=>({...n,[a]:{...n[a],[e]:t}}))}),o}finally{i.current.delete(a)}}}}function Vt(e){let t=(0,Z.c)(107),{host:n,isNew:r,targets:i,busy:a,onSave:o,onClose:s}=e,[u,d]=(0,$.useState)(n),{checks:f,testConnection:p}=Bt(i),m=f[Rt(u)],h=Object.values(m??{}).some(Ut),g,_;t[0]===u?(g=t[1],_=t[2]):(g=Lt({...u,label:u.label.trim()||u.target}),_=D(g),t[0]=u,t[1]=g,t[2]=_);let v=_,x;t[3]===m?x=t[4]:(x=Object.values(m??{}).filter(Ht),t[3]=m,t[4]=x);let S=x.length,C;t[5]!==a||t[6]!==s?(C=e=>{!e&&!a&&s()},t[5]=a,t[6]=s,t[7]=C):C=t[7];let w=!a,T;t[8]!==a||t[9]!==h||t[10]!==u.label||t[11]!==g||t[12]!==o?(T=(0,Q.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),D(g)&&u.label.trim()&&!a&&!h&&o(g.value)}}),t[8]=a,t[9]=h,t[10]=u.label,t[11]=g,t[12]=o,t[13]=T):T=t[13];let E=r?`Add device host`:`Edit device host`,O;t[14]===E?O=t[15]:(O=(0,Q.jsx)(Me,{children:E}),t[14]=E,t[15]=O);let k=i.length===1?`Connect from ${i[0]?.label}.`:`Connect from ${i.length} selected environments.`,A;t[16]===k?A=t[17]:(A=(0,Q.jsxs)(Ie,{children:[k,` `,`Hosts on the same machine are skipped.`]}),t[16]=k,t[17]=A);let j;t[18]!==O||t[19]!==A?(j=(0,Q.jsxs)(je,{children:[O,A]}),t[18]=O,t[19]=A,t[20]=j):j=t[20];let M;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(`span`,{children:`Name`}),t[21]=M):M=t[21];let N;t[22]===u?N=t[23]:(N=e=>d({...u,label:e.target.value}),t[22]=u,t[23]=N);let P;t[24]!==a||t[25]!==u.label||t[26]!==N?(P=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[M,(0,Q.jsx)(Ae,{autoFocus:!0,required:!0,value:u.label,disabled:a,onChange:N,placeholder:`Mac mini`})]}),t[24]=a,t[25]=u.label,t[26]=N,t[27]=P):P=t[27];let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(`span`,{children:`SSH target`}),t[28]=F):F=t[28];let I;t[29]===u?I=t[30]:(I=e=>d({...u,target:e.target.value}),t[29]=u,t[30]=I);let L;t[31]!==a||t[32]!==u.target||t[33]!==I?(L=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[F,(0,Q.jsx)(Ae,{required:!0,value:u.target,disabled:a,onChange:I,placeholder:`user@host or SSH alias`})]}),t[31]=a,t[32]=u.target,t[33]=I,t[34]=L):L=t[34];let R=n.port!==void 0||n.identityFile!==void 0||void 0,z;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:`SSH options`}),t[35]=z):z=t[35];let B;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(`span`,{children:`Identity file`}),t[36]=B):B=t[36];let V=u.identityFile??``,ee;t[37]===u?ee=t[38]:(ee=e=>{let{identityFile:t,...n}=u;d(e.target.value?{...n,identityFile:e.target.value}:n)},t[37]=u,t[38]=ee);let H;t[39]!==a||t[40]!==V||t[41]!==ee?(H=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[B,(0,Q.jsx)(Ae,{value:V,disabled:a,onChange:ee,placeholder:`SSH config default`})]}),t[39]=a,t[40]=V,t[41]=ee,t[42]=H):H=t[42];let U;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(`span`,{children:`Port`}),t[43]=U):U=t[43];let te=u.port??``,ne;t[44]===u?ne=t[45]:(ne=e=>{let{port:t,...n}=u;d(e.target.value?{...n,port:Number(e.target.value)}:n)},t[44]=u,t[45]=ne);let re;t[46]!==a||t[47]!==te||t[48]!==ne?(re=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[U,(0,Q.jsx)(Ae,{type:`number`,min:1,max:65535,value:te,disabled:a,onChange:ne,placeholder:`Default`})]}),t[46]=a,t[47]=te,t[48]=ne,t[49]=re):re=t[49];let ie;t[50]!==H||t[51]!==re?(ie=(0,Q.jsxs)(`div`,{className:`mt-3 grid grid-cols-[minmax(0,1fr)_7rem] gap-3`,children:[H,re]}),t[50]=H,t[51]=re,t[52]=ie):ie=t[52];let ae;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Optional. Resolved separately on each environment.`}),t[53]=ae):ae=t[53];let oe;t[54]!==R||t[55]!==ie?(oe=(0,Q.jsxs)(`details`,{open:R,className:`text-sm`,children:[z,ie,ae]}),t[54]=R,t[55]=ie,t[56]=oe):oe=t[56];let se=h?`Checking environments…`:m?S?`${S} of ${i.length} failed`:`Connection checks passed`:`Check access before saving`,W;t[57]===se?W=t[58]:(W=(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:se}),t[57]=se,t[58]=W);let ce=a||h||!v,G;t[59]!==g||t[60]!==p?(G=()=>{D(g)&&p(g.value)},t[59]=g,t[60]=p,t[61]=G):G=t[61];let le;t[62]===h?le=t[63]:(le=h?(0,Q.jsx)(me,{size:`xs`}):null,t[62]=h,t[63]=le);let ue;t[64]!==ce||t[65]!==G||t[66]!==le?(ue=(0,Q.jsxs)(y,{type:`button`,size:`sm`,variant:`outline`,disabled:ce,onClick:G,children:[le,` Test connection`]}),t[64]=ce,t[65]=G,t[66]=le,t[67]=ue):ue=t[67];let K;t[68]!==W||t[69]!==ue?(K=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-2.5`,children:[W,ue]}),t[68]=W,t[69]=ue,t[70]=K):K=t[70];let de;t[71]!==m||t[72]!==i?(de=m?(0,Q.jsx)(`ul`,{className:`border-t border-border/60 divide-y divide-border/40`,children:i.map(e=>{let t=m[e.environmentId];return t?(0,Q.jsxs)(`li`,{className:`px-3 py-2.5 text-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:e.label}),(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-1.5 ${t.status===`failed`?`text-destructive`:`text-muted-foreground`}`,children:t.status===`pending`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(me,{size:`xs`}),` Checking…`]}):t.status===`local`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`size-3`}),` Already available locally`]}):t.status===`failed`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(b,{className:`size-3`}),` Failed`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(c,{className:`size-3`}),` Connected`]})})]}),t.status===`connected`?(0,Q.jsx)(`div`,{className:`mt-1.5`,children:(0,Q.jsx)(Pt,{platforms:t.platforms})}):null,t.status===`failed`?(0,Q.jsxs)(`details`,{className:`mt-1.5 text-muted-foreground`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:`Show error`}),(0,Q.jsx)(`p`,{className:`mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-words`,children:t.error})]}):null]},e.environmentId):null})}):null,t[71]=m,t[72]=i,t[73]=de):de=t[73];let fe;t[74]!==K||t[75]!==de?(fe=(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/60`,children:[K,de]}),t[74]=K,t[75]=de,t[76]=fe):fe=t[76];let pe;t[77]!==P||t[78]!==L||t[79]!==oe||t[80]!==fe?(pe=(0,Q.jsxs)(Fe,{children:[P,L,oe,fe]}),t[77]=P,t[78]=L,t[79]=oe,t[80]=fe,t[81]=pe):pe=t[81];let q;t[82]!==a||t[83]!==s?(q=(0,Q.jsx)(y,{type:`button`,variant:`ghost`,disabled:a,onClick:s,children:`Cancel`}),t[82]=a,t[83]=s,t[84]=q):q=t[84];let he;t[85]!==a||t[86]!==h||t[87]!==u.label||t[88]!==v?(he=a||h||!v||!u.label.trim(),t[85]=a,t[86]=h,t[87]=u.label,t[88]=v,t[89]=he):he=t[89];let ge;t[90]===a?ge=t[91]:(ge=a?(0,Q.jsx)(me,{size:`xs`}):null,t[90]=a,t[91]=ge);let _e;t[92]!==he||t[93]!==ge?(_e=(0,Q.jsxs)(y,{type:`submit`,disabled:he,children:[ge,` Save host`]}),t[92]=he,t[93]=ge,t[94]=_e):_e=t[94];let ve;t[95]!==q||t[96]!==_e?(ve=(0,Q.jsxs)(Ne,{children:[q,_e]}),t[95]=q,t[96]=_e,t[97]=ve):ve=t[97];let ye;t[98]!==j||t[99]!==pe||t[100]!==w||t[101]!==ve||t[102]!==T?(ye=(0,Q.jsxs)(Le,{showCloseButton:w,render:T,children:[j,pe,ve]}),t[98]=j,t[99]=pe,t[100]=w,t[101]=ve,t[102]=T,t[103]=ye):ye=t[103];let be;return t[104]!==C||t[105]!==ye?(be=(0,Q.jsx)(Re,{open:!0,onOpenChange:C,children:ye}),t[104]=C,t[105]=ye,t[106]=be):be=t[106],be}function Ht(e){return e.status===`failed`}function Ut(e){return e.status===`pending`}function Wt(e){let{scope:t,environments:n,connectedEnvironments:r}=ft(),i=Se(e.environmentId,H),a=t.kind===`project`||t.kind===`checkout`,o=Te(xe.updateSettings,{reportFailure:!1}),[s,c]=(0,$.useState)(null),[l,u]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),m=n.map(e=>({environmentId:e.environmentId,label:e.label,connected:e.connection.phase===`connected`})),{checks:h,testConnection:g}=Bt(m),_=async(t,r=!1,i=t)=>{if(e.environmentId&&!a){p(!0);try{let e=await Promise.allSettled(n.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!Ce(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return o({environmentId:e.environmentId,input:{patch:{deviceHosts:Nt(e.serverConfig.settings.deviceHosts,t,r,i)}}})})),a=n.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});a.length===0?c(null):q.add({type:`error`,title:`Device hosts not saved on all environments`,description:`Could not update ${a.map(e=>e.label).join(`, `)}.`})}finally{p(!1)}}};return(0,Q.jsx)(X,{id:`device-hosts`,title:`Device hosts`,serverScoped:!0,settingKeys:[`deviceHosts`],description:`Add remote machines with simulator or emulator runtimes installed, and the selected environments will connect over SSH and set up device tools automatically.`,control:(0,Q.jsxs)(y,{size:`sm`,variant:`outline`,disabled:!i||a||f||!e.environmentId||s!==null,onClick:()=>{u(null),c({kind:`ssh`,id:v(),label:``,target:``})},children:[(0,Q.jsx)(d,{className:`size-3.5`}),` Add host`]}),children:(0,Q.jsx)(`div`,{className:`pt-3 pb-2`,children:e.environmentId?(0,Q.jsxs)(Q.Fragment,{children:[r.map(e=>(0,Q.jsxs)(`div`,{children:[r.length>1?(0,Q.jsx)(`p`,{className:`pt-3 pb-1 text-xs font-medium text-muted-foreground`,children:e.label}):null,(0,Q.jsx)(Gt,{environmentLabel:e.label,environmentId:e.environmentId,hosts:e.serverConfig?.settings.deviceHosts??[],busy:!i||a||f,checks:h,testConnection:async e=>{let t=await g(e);if(!t)return;let n=m.filter(e=>t[e.environmentId]?.status===`failed`);return q.add({type:n.length?`error`:`success`,title:n.length?`${e.label}: ${n.length} of ${m.length} environments failed`:`${e.label}: connection checks passed`,description:n.length?`Could not connect from ${n.map(e=>e.label).join(`, `)}.`:`Connected or already available locally on each selected environment.`}),t},onEdit:e=>{u(e),c(e)},onRemove:e=>void _(e,!0)})]},e.environmentId)),s?(0,Q.jsx)(Vt,{host:s,isNew:l===null,targets:m,busy:f,onSave:e=>void _(e,!1,l??e),onClose:()=>c(null)},s.id):null]}):(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect a selected environment to manage device hosts.`})})})}function Gt(e){let t=(0,Z.c)(28),{environmentLabel:n,environmentId:r,hosts:i,busy:a,onEdit:o,onRemove:c,checks:l,testConnection:u}=e,{state:d}=ze(r),p=Te(Be.list),[h,g]=(0,$.useState)(null),_;t[0]===i.length?_=t[1]:(_=i.length===0?(0,Q.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`No device hosts.`}):null,t[0]=i.length,t[1]=_);let v;if(t[2]!==a||t[3]!==l||t[4]!==r||t[5]!==n||t[6]!==i||t[7]!==o||t[8]!==c||t[9]!==p||t[10]!==h||t[11]!==d||t[12]!==u){let e;t[14]!==a||t[15]!==l||t[16]!==r||t[17]!==n||t[18]!==o||t[19]!==c||t[20]!==p||t[21]!==h||t[22]!==d||t[23]!==u?(e=e=>{let t=d.hostStatuses[e.id],i=l[Rt(e)]?.[r],_=(i?.status===`connected`?i.platforms:void 0)??d.hosts.find(t=>t.id===e.id)?.platforms??[],v=i?.status===`pending`?`Checking connection…`:t?.status===`installing`?`Installing device support…`:t?.status===`starting`?`Connecting…`:null,b=i?.status===`failed`?i.error:i?.status===`local`?void 0:t?.status===`failed`?t.detail:void 0;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/50 py-2.5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.label}),_.filter(qt).map(Kt)]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.target}),(0,Q.jsx)(jt,{owner:n,error:d.hosts.find(t=>t.id===e.id)?.toolInspectionError,tools:d.hosts.find(t=>t.id===e.id)?.tools??(i?.status===`connected`?i.tools:void 0)}),i?.status===`local`?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Already available locally`}):null,b?(0,Q.jsx)(`div`,{className:`mt-1`,role:`status`,children:(0,Q.jsxs)(`details`,{className:`text-xs text-destructive`,children:[(0,Q.jsx)(`summary`,{children:`Connection failed`}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words`,children:b})]})}):null]}),v?(0,Q.jsxs)(`span`,{role:`status`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(me,{size:`xs`}),v]}):null,(0,Q.jsxs)(f,{children:[(0,Q.jsx)(m,{render:(0,Q.jsx)(y,{size:`icon-sm`,variant:`ghost-muted`,disabled:a,"aria-label":e.label+` options`}),children:(0,Q.jsx)(s,{})}),(0,Q.jsxs)(x,{align:`end`,children:[(0,Q.jsx)(T,{onClick:()=>{o(e)},children:`Edit`}),(0,Q.jsx)(T,{variant:`destructive`,onClick:()=>c(e),children:`Remove`})]})]}),t?.status===`failed`&&d.supportsHostRetry&&d.hostStatus!==`disabled`?(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:a||h!==null,onClick:()=>{g(e.id),p({environmentId:r,input:{retryHostId:e.id}}).finally(()=>g(null))},children:h===e.id?`Retrying…`:`Retry`}):(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:a||v!==null,onClick:()=>void u(e),children:`Test connection`})]},e.id)},t[14]=a,t[15]=l,t[16]=r,t[17]=n,t[18]=o,t[19]=c,t[20]=p,t[21]=h,t[22]=d,t[23]=u,t[24]=e):e=t[24],v=i.map(e),t[2]=a,t[3]=l,t[4]=r,t[5]=n,t[6]=i,t[7]=o,t[8]=c,t[9]=p,t[10]=h,t[11]=d,t[12]=u,t[13]=v}else v=t[13];let b;return t[25]!==_||t[26]!==v?(b=(0,Q.jsxs)(Q.Fragment,{children:[_,v]}),t[25]=_,t[26]=v,t[27]=b):b=t[27],b}function Kt(e){return(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(`span`,{tabIndex:0,role:`img`,"aria-label":e.platform===`ios`?`iOS available`:`Android available`,className:`shrink-0 text-muted-foreground`}),children:e.platform===`ios`?(0,Q.jsx)($e,{className:`size-3.5 -translate-y-px`}):(0,Q.jsx)(et,{className:`size-3.5`})}),(0,Q.jsx)(Oe,{children:e.platform===`ios`?`iOS available`:`Android available`})]},e.platform)}function qt(e){return e.available}var Jt=V(B),Yt=e=>({kind:`eas`,id:e,label:`EAS Simulator`,accessToken:``,maxSessionMinutes:30,idleMinutes:10,maxConcurrentSessions:2});function Xt(e,t,n){return n?e.filter(e=>e.id!==t.id):e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?t:e):[...e,t]}function Zt(e){return`Up to ${e.maxConcurrentSessions===1?`1 session`:`${e.maxConcurrentSessions} sessions`} at once, each stopped after ${e.maxSessionMinutes} min or ${e.idleMinutes} idle min`}var Qt=`thread-project`,$t={settings:`the access token saved here`,env:`EXPO_TOKEN on the server`,"eas-login":`the server's eas login`},en=e=>{let t=I(e);return t instanceof Error?t.message:String(t)};function tn(e){let t=(0,Z.c)(24),{scope:n,connectedEnvironments:r}=ft(),i=Se(e.environmentId,H),a=n.kind===`project`||n.kind===`checkout`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={reportFailure:!1},t[0]=s):s=t[0];let c=Te(xe.updateSettings,s),l;t[1]===e.environmentId?l=t[2]:(l=t=>t.environmentId===e.environmentId,t[1]=e.environmentId,t[2]=l);let u=r.find(l)?.serverConfig?.settings.easDeviceHosts??[],[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(!1),g=!i||a||m||!e.environmentId,_=async(t,n)=>{if(!e.environmentId||!Ce(e.environmentId,`settings:write`))return;h(!0);let r=await c({environmentId:e.environmentId,input:{patch:{easDeviceHosts:Xt(u,t,n)}}});h(!1),r._tag===`Success`?p(null):q.add({type:`error`,title:n?`EAS host not removed`:`EAS host not saved`,description:en(r.cause)})},b=X,x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=[`easDeviceHosts`],t[3]=x):x=t[3];let S=g||f!==null,C;t[4]===p?C=t[5]:(C=()=>p({host:Yt(v()),isNew:!0}),t[4]=p,t[5]=C);let w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(d,{className:`size-3.5`}),t[6]=w):w=t[6];let T;t[7]!==S||t[8]!==C?(T=(0,Q.jsxs)(y,{size:`sm`,variant:`outline`,disabled:S,onClick:C,children:[w,` Add EAS host`]}),t[7]=S,t[8]=C,t[9]=T):T=t[9];let E=u.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No EAS hosts.`}):(0,Q.jsx)(`ul`,{className:`divide-y divide-border/40`,children:u.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2.5 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 truncate font-medium`,children:[(0,Q.jsx)(o,{className:`size-3.5 shrink-0`}),` `,e.label]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:Zt(e)})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,Q.jsx)(y,{size:`sm`,variant:`ghost`,disabled:g,onClick:()=>p({host:e,isNew:!1}),children:`Edit`}),(0,Q.jsx)(y,{size:`sm`,variant:`ghost-destructive`,disabled:g,onClick:()=>void _(e,!0),children:`Remove`})]})]},e.id))}),D;t[10]!==m||t[11]!==f||t[12]!==e.environmentId||t[13]!==_||t[14]!==p?(D=f&&e.environmentId?(0,Q.jsx)(nn,{environmentId:e.environmentId,host:f.host,isNew:f.isNew,busy:m,onSave:e=>void _(e,!1),onClose:()=>p(null)},f.host.id):null,t[10]=m,t[11]=f,t[12]=e.environmentId,t[13]=_,t[14]=p,t[15]=D):D=t[15];let O;t[16]!==E||t[17]!==D?(O=(0,Q.jsxs)(`div`,{className:`pt-3 pb-2`,children:[E,D]}),t[16]=E,t[17]=D,t[18]=O):O=t[18];let k;return t[19]!==b||t[20]!==T||t[21]!==O||t[22]!==x?(k=(0,Q.jsx)(b,{id:`eas-device-hosts`,title:`EAS Simulator`,serverScoped:!0,settingKeys:x,description:`Run iOS Simulators and Android emulators in Expo's cloud. Sessions bill the Expo account until they stop, so each host caps their number and length. Editing or removing a host stops them.`,control:T,children:O}),t[19]=b,t[20]=T,t[21]=O,t[22]=x,t[23]=k):k=t[23],k}function nn(e){let t=(0,Z.c)(135),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=Te(Be.easAccount,n),[i,a]=(0,$.useState)(e.host),o=(0,$.useId)(),s;t[1]===e.host.accessToken?s=t[2]:(s=e.host.accessToken?{kind:`saved`}:{kind:`cleared`},t[1]=e.host.accessToken,t[2]=s);let[c,l]=(0,$.useState)(s),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u={status:`checking`},t[3]=u):u=t[3];let[d,f]=(0,$.useState)(u),p,m;t[4]!==i||t[5]!==e.host.accessToken||t[6]!==c.kind||t[7]!==c.value?(p={...i,label:i.label.trim(),accessToken:c.kind===`saved`?e.host.accessToken:c.kind===`new`?c.value:``},m=D(Jt(p)),t[4]=i,t[5]=e.host.accessToken,t[6]=c.kind,t[7]=c.value,t[8]=p,t[9]=m):(p=t[8],m=t[9]);let h=m,g=h?null:i.maxSessionMinutes>0&&i.idleMinutes>=i.maxSessionMinutes?`Idle minutes must be smaller than session minutes.`:`Give the host a label and limits within the ranges shown.`,_;t[10]!==d.account||t[11]!==d.status?(_=d.status===`signed-in`?d.account.apps:[],t[10]=d.account,t[11]=d.status,t[12]=_):_=t[12];let v=_,x=(0,$.useRef)(0),S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>{x.current+=1,f({status:`idle`})},t[13]=S):S=t[13];let C=S,w;t[14]!==r||t[15]!==e.environmentId||t[16]!==e.host.id||t[17]!==e.isNew||t[18]!==c.kind||t[19]!==c.value?(w=async()=>{let t=x.current+=1,n=await r({environmentId:e.environmentId,input:{...c.kind===`saved`&&!e.isNew?{hostId:e.host.id}:{},...c.kind===`new`?{accessToken:c.value}:c.kind===`cleared`?{accessToken:``}:{}}});t===x.current&&f(n._tag===`Success`?{status:`signed-in`,account:n.value}:{status:`failed`,error:en(n.cause)})},t[14]=r,t[15]=e.environmentId,t[16]=e.host.id,t[17]=e.isNew,t[18]=c.kind,t[19]=c.value,t[20]=w):w=t[20];let T=w,E;t[21]===T?E=t[22]:(E=()=>{f({status:`checking`}),T()},t[21]=T,t[22]=E);let O=E,k;t[23]===T?k=t[24]:(k=()=>void T(),t[23]=T,t[24]=k);let A=(0,$.useEffectEvent)(k),j;t[25]===A?j=t[26]:(j=()=>{A()},t[25]=A,t[26]=j);let M;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(M=[],t[27]=M):M=t[27],(0,$.useEffect)(j,M);let N;t[28]!==i||t[29]!==e.busy?(N=(t,n,r)=>(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,Q.jsx)(`span`,{children:n}),(0,Q.jsx)(Ae,{type:`number`,min:1,max:r,value:i[t],disabled:e.busy,onChange:e=>{let n=Number(e.target.value);a(e=>({...e,[t]:n}))}})]}),t[28]=i,t[29]=e.busy,t[30]=N):N=t[30];let P=N,F;t[31]===e?F=t[32]:(F=t=>{!t&&!e.busy&&e.onClose()},t[31]=e,t[32]=F);let I=!e.busy,L;t[33]!==p||t[34]!==e||t[35]!==h?(L=t=>{t.preventDefault(),h&&!e.busy&&e.onSave(p)},t[33]=p,t[34]=e,t[35]=h,t[36]=L):L=t[36];let R=e.isNew?`Add EAS host`:`Edit EAS host`,z;t[37]===R?z=t[38]:(z=(0,Q.jsx)(Me,{children:R}),t[37]=R,t[38]=z);let B;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(Ie,{children:`The environment's server signs in to Expo and starts the sessions. Without a token here it uses EXPO_TOKEN, then its eas login.`}),t[39]=B):B=t[39];let V;t[40]===z?V=t[41]:(V=(0,Q.jsxs)(je,{children:[z,B]}),t[40]=z,t[41]=V);let ee;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(`span`,{children:`Name`}),t[42]=ee):ee=t[42];let H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{let t=e.target.value;a(e=>({...e,label:t}))},t[43]=H):H=t[43];let U;t[44]!==i.label||t[45]!==e.busy?(U=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[ee,(0,Q.jsx)(Ae,{autoFocus:!0,required:!0,value:i.label,disabled:e.busy,onChange:H})]}),t[44]=i.label,t[45]=e.busy,t[46]=U):U=t[46];let te;t[47]===o?te=t[48]:(te=(0,Q.jsx)(`label`,{htmlFor:o,className:`block`,children:`Expo access token`}),t[47]=o,t[48]=te);let ne=c.kind===`saved`,re=c.kind===`new`?c.value:``,ie;t[49]===e.host.accessToken?ie=t[50]:(ie=t=>{let n=t.target.value;l(n?{kind:`new`,value:n}:e.host.accessToken?{kind:`saved`}:{kind:`cleared`}),C()},t[49]=e.host.accessToken,t[50]=ie);let ae;t[51]!==e.busy||t[52]!==ne||t[53]!==re||t[54]!==ie||t[55]!==o?(ae=(0,Q.jsx)(Dt,{id:o,className:`min-w-0 flex-1`,configured:ne,value:re,disabled:e.busy,placeholder:`Optional`,onChange:ie}),t[51]=e.busy,t[52]=ne,t[53]=re,t[54]=ie,t[55]=o,t[56]=ae):ae=t[56];let oe;t[57]===c.kind?oe=t[58]:(oe=c.kind===`cleared`?null:(0,Q.jsx)(y,{type:`button`,size:`icon-sm`,variant:`ghost-destructive`,"aria-label":`Clear access token`,onClick:()=>{l({kind:`cleared`}),C()},children:(0,Q.jsx)(b,{className:`size-3.5`})}),t[57]=c.kind,t[58]=oe);let se;t[59]!==ae||t[60]!==oe?(se=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ae,oe]}),t[59]=ae,t[60]=oe,t[61]=se):se=t[61];let W;t[62]!==te||t[63]!==se?(W=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[te,se]}),t[62]=te,t[63]=se,t[64]=W):W=t[64];let ce=d.status===`signed-in`?`Signed in as ${d.account.signedInAs} with ${$t[d.account.credentialSource]}.`:d.status===`failed`?d.error:d.status===`checking`?`Checking the Expo account…`:`Check the Expo account before choosing a project.`,ue;t[65]===ce?ue=t[66]:(ue=(0,Q.jsx)(`p`,{role:`status`,className:`min-w-0 text-xs text-muted-foreground`,children:ce}),t[65]=ce,t[66]=ue);let de=e.busy||d.status===`checking`,q;t[67]===O?q=t[68]:(q=()=>void O(),t[67]=O,t[68]=q);let he;t[69]===d.status?he=t[70]:(he=d.status===`checking`?(0,Q.jsx)(me,{size:`xs`}):null,t[69]=d.status,t[70]=he);let ge;t[71]!==de||t[72]!==q||t[73]!==he?(ge=(0,Q.jsxs)(y,{type:`button`,size:`sm`,variant:`outline`,disabled:de,onClick:q,children:[he,` Check account`]}),t[71]=de,t[72]=q,t[73]=he,t[74]=ge):ge=t[74];let _e;t[75]!==ue||t[76]!==ge?(_e=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border/60 px-3 py-2.5`,children:[ue,ge]}),t[75]=ue,t[76]=ge,t[77]=_e):_e=t[77];let ve;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Q.jsx)(`span`,{children:`EAS project`}),t[78]=ve):ve=t[78];let ye=i.appId??Qt,be=e.busy,J;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(J=e=>{typeof e==`string`&&a(t=>{let{appId:n,...r}=t;return e===Qt?r:{...r,appId:e}})},t[79]=J):J=t[79];let Y;t[80]===v?Y=t[81]:(Y=(0,Q.jsx)(fe,{size:`sm`,"aria-label":`EAS project`,children:(0,Q.jsx)(le,{children:e=>e===Qt?`From the thread's project`:v.find(t=>t.id===e)?.fullName??e})}),t[80]=v,t[81]=Y);let xe;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Q.jsx)(G,{value:Qt,children:`From the thread's project`}),t[82]=xe):xe=t[82];let Se;t[83]!==v||t[84]!==i.appId?(Se=i.appId&&!v.some(e=>e.id===i.appId)?(0,Q.jsx)(G,{value:i.appId,children:i.appId}):null,t[83]=v,t[84]=i.appId,t[85]=Se):Se=t[85];let Ce;t[86]===v?Ce=t[87]:(Ce=v.map(rn),t[86]=v,t[87]=Ce);let we;t[88]!==Se||t[89]!==Ce?(we=(0,Q.jsxs)(K,{children:[xe,Se,Ce]}),t[88]=Se,t[89]=Ce,t[90]=we):we=t[90];let Ee;t[91]!==e.busy||t[92]!==ye||t[93]!==Y||t[94]!==we?(Ee=(0,Q.jsxs)(pe,{value:ye,disabled:be,onValueChange:J,children:[Y,we]}),t[91]=e.busy,t[92]=ye,t[93]=Y,t[94]=we,t[95]=Ee):Ee=t[95];let De;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Sessions bill the project's Expo account. "From the thread's project" reads extra.eas.projectId from the project's app config.`}),t[96]=De):De=t[96];let Oe;t[97]===Ee?Oe=t[98]:(Oe=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[ve,Ee,De]}),t[97]=Ee,t[98]=Oe);let ke;t[99]===P?ke=t[100]:(ke=(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 text-sm`,children:[P(`maxConcurrentSessions`,`Sessions at once`,20),P(`maxSessionMinutes`,`Session minutes`,115),P(`idleMinutes`,`Idle minutes`,60)]}),t[99]=P,t[100]=ke);let Pe=e.isNew?null:` Saving restarts this host, which stops its running sessions.`,ze;t[101]===Pe?ze=t[102]:(ze=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Expo allows sessions of up to 40 minutes on free accounts and 115 on paid ones, and ends one after the idle minutes without activity, so idle minutes must be smaller than session minutes.`,Pe]}),t[101]=Pe,t[102]=ze);let Ve;t[103]===g?Ve=t[104]:(Ve=g===null?null:(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,role:`alert`,children:g}),t[103]=g,t[104]=Ve);let He;t[105]!==U||t[106]!==W||t[107]!==_e||t[108]!==Oe||t[109]!==ke||t[110]!==ze||t[111]!==Ve?(He=(0,Q.jsxs)(Fe,{children:[U,W,_e,Oe,ke,ze,Ve]}),t[105]=U,t[106]=W,t[107]=_e,t[108]=Oe,t[109]=ke,t[110]=ze,t[111]=Ve,t[112]=He):He=t[112];let Ue;t[113]!==e.busy||t[114]!==e.onClose?(Ue=(0,Q.jsx)(y,{type:`button`,variant:`ghost`,disabled:e.busy,onClick:e.onClose,children:`Cancel`}),t[113]=e.busy,t[114]=e.onClose,t[115]=Ue):Ue=t[115];let We=e.busy||!h,Ge;t[116]===e.busy?Ge=t[117]:(Ge=e.busy?(0,Q.jsx)(me,{size:`xs`}):null,t[116]=e.busy,t[117]=Ge);let Ke;t[118]!==We||t[119]!==Ge?(Ke=(0,Q.jsxs)(y,{type:`submit`,disabled:We,children:[Ge,` Save host`]}),t[118]=We,t[119]=Ge,t[120]=Ke):Ke=t[120];let qe;t[121]!==Ue||t[122]!==Ke?(qe=(0,Q.jsxs)(Ne,{children:[Ue,Ke]}),t[121]=Ue,t[122]=Ke,t[123]=qe):qe=t[123];let Je;t[124]!==L||t[125]!==V||t[126]!==He||t[127]!==qe?(Je=(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-col`,onSubmit:L,children:[V,He,qe]}),t[124]=L,t[125]=V,t[126]=He,t[127]=qe,t[128]=Je):Je=t[128];let Ye;t[129]!==I||t[130]!==Je?(Ye=(0,Q.jsx)(Le,{showCloseButton:I,children:Je}),t[129]=I,t[130]=Je,t[131]=Ye):Ye=t[131];let Xe;return t[132]!==F||t[133]!==Ye?(Xe=(0,Q.jsx)(Re,{open:!0,onOpenChange:F,children:Ye}),t[132]=F,t[133]=Ye,t[134]=Xe):Xe=t[134],Xe}function rn(e){return(0,Q.jsx)(G,{value:e.id,children:e.fullName},e.id)}function an(e,t){if(e)return{kind:`new`};let n=t[0];return n?{kind:`existing`,profileId:n.id}:{kind:`new`}}function on(e,t,n){if(e.kind===`new`)return{kind:`new`,profileId:t};let r=n.find(t=>t.id===e.profileId);if(r!==void 0)return{kind:`existing`,profileId:e.profileId,name:r.name}}function sn(e){return e.step!==`importing`}function cn(e){return e.unavailable===`browserRunning`?{step:`quit`}:e.unavailable===`needsFullDiskAccess`?{step:`fullDiskAccess`,resume:`configure`}:e.unavailable===void 0?e.profiles.length===0?{step:`blocked`,reason:`unknownSourceProfile`}:{step:`configure`}:{step:`blocked`,reason:e.unavailable}}function ln(e){return e.kind===`imported`?{step:`done`,imported:e.imported,skipped:e.skipped,skippedDomains:e.skippedDomains,targetName:e.targetName}:e.reason===`browserRunning`?{step:`quit`}:e.reason===`needsFullDiskAccess`?{step:`fullDiskAccess`,resume:`import`,checked:!0}:{step:`blocked`,reason:e.reason}}function un(e){return e===void 0?{step:`blocked`,reason:`unknownSource`}:cn(e)}function dn(e){let t=un(e);return t.step===`fullDiskAccess`?{...t,checked:!0}:t}function fn(e,t){return t.profiles.some(t=>t.directory===e)?e:t.profiles[0]?.directory??``}function pn(e){switch(e){case`needsKeychainApproval`:case`keychainItemMissing`:case`keychainUnavailable`:case`readFailed`:case`sessionUnavailable`:case`profileNotSaved`:return!0;default:return!1}}function mn(e){return e.length===0?``:e.length===1?e[0]:e.length<=3?`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`:`${e.slice(0,3).join(`, `)} and ${e.length-3} more`}function hn(e){let t=(0,Z.c)(46),{source:n,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,onImport:o,onRefreshSource:s,onOpenFullDiskAccessSettings:c,onCheckFullDiskAccess:l,onClose:u}=e,[d,f]=(0,$.useState)(n),p;t[0]===n?p=t[1]:(p=()=>cn(n),t[0]=n,t[1]=p);let[m,h]=(0,$.useState)(p),g;t[2]===n.profiles[0]?.directory?g=t[3]:(g=()=>n.profiles[0]?.directory??``,t[2]=n.profiles[0]?.directory,t[3]=g);let[_,y]=(0,$.useState)(g),b;t[4]!==a||t[5]!==i?(b=()=>an(a,i),t[4]=a,t[5]=i,t[6]=b):b=t[6];let[x,S]=(0,$.useState)(b),[C,w]=(0,$.useState)(),T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=v(),t[7]=T):T=t[7];let E=(0,$.useRef)(`profile-${T}`),D=(0,$.useRef)(!1),O;t[8]!==o||t[9]!==_||t[10]!==x||t[11]!==i?(O=()=>{if(D.current)return;let e=on(x,E.current,i);e===void 0?(w(`That profile is no longer available. Choose where to import these cookies.`),h({step:`configure`})):(w(void 0),D.current=!0,h({step:`importing`}),o({sourceProfileDirectory:_,target:e}).then(e=>h(ln(e))).catch(()=>h({step:`blocked`,reason:`readFailed`})).finally(()=>{D.current=!1}))},t[8]=o,t[9]=_,t[10]=x,t[11]=i,t[12]=O):O=t[12];let k=O,A;t[13]===s?A=t[14]:(A=(e,t)=>{h({step:`checking`,check:e}),s().then(e=>{e&&(f(e),y(t=>fn(t,e))),h(t(e))}).catch(()=>h({step:`blocked`,reason:`readFailed`}))},t[13]=s,t[14]=A);let j=A,M;t[15]===j?M=t[16]:(M=()=>j(`browser`,un),t[15]=j,t[16]=M);let N=M,P;t[17]===j?P=t[18]:(P=()=>j(`fullDiskAccess`,dn),t[17]=j,t[18]=P);let F=P,I;t[19]!==u||t[20]!==m?(I=e=>e||!sn(m)?void 0:u(),t[19]=u,t[20]=m,t[21]=I):I=t[21];let L;t[22]===m?L=t[23]:(L=sn(m),t[22]=m,t[23]=L);let R;t[24]!==a||t[25]!==r||t[26]!==l||t[27]!==u||t[28]!==c||t[29]!==s||t[30]!==N||t[31]!==F||t[32]!==k||t[33]!==d||t[34]!==_||t[35]!==m||t[36]!==x||t[37]!==C||t[38]!==i?(R=m.step===`quit`?(0,Q.jsx)(gn,{source:d,onCancel:u,onRechecked:N}):m.step===`fullDiskAccess`?(0,Q.jsx)(yn,{source:d,onCancel:u,onOpenSettings:c,onCheck:l??(async()=>{let e=await s();return e!==void 0&&e.unavailable===void 0}),onGranted:m.resume===`import`?k:F,stillRequired:m.checked===!0}):m.step===`importing`?(0,Q.jsx)(Sn,{}):m.step===`checking`?(0,Q.jsx)(Cn,{sourceName:d.name,check:m.check}):m.step===`done`?(0,Q.jsx)(wn,{...m,destinationEnvironmentName:r,onClose:u}):m.step===`blocked`?(0,Q.jsx)(Tn,{source:d,reason:m.reason,onClose:u,onRetry:pn(m.reason)?k:void 0}):(0,Q.jsx)(bn,{source:d,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:_,onSourceProfileChange:y,target:x,onTargetChange:e=>{S(e),w(void 0)},targetError:C,onCancel:u,onImport:k}),t[24]=a,t[25]=r,t[26]=l,t[27]=u,t[28]=c,t[29]=s,t[30]=N,t[31]=F,t[32]=k,t[33]=d,t[34]=_,t[35]=m,t[36]=x,t[37]=C,t[38]=i,t[39]=R):R=t[39];let z;t[40]!==L||t[41]!==R?(z=(0,Q.jsx)(Le,{className:`max-w-lg`,showCloseButton:L,children:R}),t[40]=L,t[41]=R,t[42]=z):z=t[42];let B;return t[43]!==z||t[44]!==I?(B=(0,Q.jsx)(Re,{open:!0,onOpenChange:I,children:z}),t[43]=z,t[44]=I,t[45]=B):B=t[45],B}function gn(e){let t=(0,Z.c)(12),{source:n,onCancel:r,onRechecked:i}=e,a;t[0]===n.name?a=t[1]:(a=(0,Q.jsxs)(je,{children:[(0,Q.jsxs)(Me,{children:[`Quit `,n.name,` to import`]}),(0,Q.jsxs)(Ie,{children:[n.name,` is open, so its cookies can’t be read yet. Quit it, then continue.`]})]}),t[0]=n.name,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(y,{variant:`outline`,onClick:r,children:`Cancel`}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(y,{onClick:i,children:`I’ve quit it`}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(Ne,{children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function _n(e){if(e!==void 0)return e===0?`no cookies`:`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function vn(e){return`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function yn(e){let t=(0,Z.c)(43),{source:n,onCancel:r,onOpenSettings:i,onGranted:o,stillRequired:s,onCheck:c}=e,[l,u]=(0,$.useState)(!1),[d,f]=(0,$.useState)(null),p;t[0]===c?p=t[1]:(p=async()=>({fullDiskAccess:await c()}),t[0]=c,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m={fullDiskAccess:!1},t[2]=m):m=t[2];let h=At(p,m),g;t[3]!==i||t[4]!==l?(g=()=>{l||(u(!0),f(null),Promise.resolve().then(i).catch(()=>f(`Could not open System Settings. Try Allow again.`)).finally(()=>u(!1)))},t[3]=i,t[4]=l,t[5]=g):g=t[5];let _=g,v;t[6]===n.name?v=t[7]:(v=(0,Q.jsxs)(je,{children:[(0,Q.jsxs)(Me,{children:[`Let P4 Code read `,n.name,`’s cookies`]}),(0,Q.jsxs)(Ie,{children:[`To import cookies from `,n.name,`, P4 Code needs Full Disk Access. Turn it on in System Settings, then come back to finish the import — you can revoke it again once the import is done.`]})]}),t[6]=n.name,t[7]=v);let b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(a,{className:`size-8 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[8]=b):b=t[8];let x=`Read ${n.name}'s cookies for this import.`,S;t[9]===_?S=t[10]:(S=()=>void _(),t[9]=_,t[10]=S);let C;t[11]!==h.status.fullDiskAccess||t[12]!==x||t[13]!==S?(C=[{id:`fullDiskAccess`,icon:b,title:`Full Disk Access`,description:x,granted:h.status.fullDiskAccess,onAllow:S}],t[11]=h.status.fullDiskAccess,t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]!==l||t[16]!==C?(w=(0,Q.jsx)(Ot,{busy:l,permissions:C}),t[15]=l,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==d||t[19]!==h.error?(T=d||h.error?(0,Q.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:d??h.error}):null,t[18]=d,t[19]=h.error,t[20]=T):T=t[20];let E;t[21]!==h||t[22]!==s?(E=h.isReady([`fullDiskAccess`])?null:(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:s?`Access is still required. Quit and reopen P4 Code if you just allowed it, then retry the import.`:`If access doesn't update after you allow it, quit and reopen P4 Code, then retry the import.`}),t[21]=h,t[22]=s,t[23]=E):E=t[23];let D;t[24]!==T||t[25]!==E||t[26]!==w?(D=(0,Q.jsxs)(Fe,{children:[w,T,E]}),t[24]=T,t[25]=E,t[26]=w,t[27]=D):D=t[27];let O;t[28]===r?O=t[29]:(O=(0,Q.jsx)(y,{variant:`outline`,onClick:r,children:`Cancel`}),t[28]=r,t[29]=O);let k;t[30]===h?k=t[31]:(k=h.isReady([`fullDiskAccess`]),t[30]=h,t[31]=k);let A;t[32]!==o||t[33]!==l||t[34]!==k?(A=(0,Q.jsx)(kt,{ready:k,busy:l,onClick:o,children:`Continue`}),t[32]=o,t[33]=l,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==O||t[37]!==A?(j=(0,Q.jsxs)(Ne,{children:[O,A]}),t[36]=O,t[37]=A,t[38]=j):j=t[38];let M;return t[39]!==D||t[40]!==j||t[41]!==v?(M=(0,Q.jsxs)(Q.Fragment,{children:[v,D,j]}),t[39]=D,t[40]=j,t[41]=v,t[42]=M):M=t[42],M}function bn(e){let t=(0,Z.c)(59),{source:n,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:o,onSourceProfileChange:s,target:c,targetError:l,onTargetChange:u,onCancel:d,onImport:f}=e,p;t[0]!==c.kind||t[1]!==c.profileId||t[2]!==i?(p=c.kind===`existing`&&!i.some(e=>e.id===c.profileId),t[0]=c.kind,t[1]=c.profileId,t[2]=i,t[3]=p):p=t[3];let m=p,h=c.kind===`new`&&!a,_=l??(m?`That profile is no longer available. Choose where to import these cookies.`:h?`You've reached the profile limit. Choose an existing profile to import into.`:void 0),v;t[4]===n.name?v=t[5]:(v=(0,Q.jsxs)(Me,{children:[`Import from `,n.name]}),t[4]=n.name,t[5]=v);let b;t[6]===r?b=t[7]:(b=(0,Q.jsxs)(Ie,{children:[`Choose which cookies to import for `,r,`.`]}),t[6]=r,t[7]=b);let x;t[8]!==v||t[9]!==b?(x=(0,Q.jsxs)(je,{children:[v,b]}),t[8]=v,t[9]=b,t[10]=x):x=t[10];let C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`From`}),t[11]=C):C=t[11];let w;if(t[12]!==s||t[13]!==n.profiles||t[14]!==o){let e;t[16]!==s||t[17]!==o?(e=e=>(0,Q.jsx)(xn,{selected:o===e.directory,title:e.name,subtitle:_n(e.cookieCount),onSelect:()=>s(e.directory)},e.directory),t[16]=s,t[17]=o,t[18]=e):e=t[18],w=n.profiles.map(e),t[12]=s,t[13]=n.profiles,t[14]=o,t[15]=w}else w=t[15];let T;t[19]===w?T=t[20]:(T=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[C,w]}),t[19]=w,t[20]=T);let E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center text-muted-foreground`,children:[(0,Q.jsx)(g,{className:`size-4 sm:hidden`}),(0,Q.jsx)(S,{className:`hidden size-4 sm:block`})]}),t[21]=E):E=t[21];let D;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Into`}),t[22]=D):D=t[22];let O;t[23]!==a||t[24]!==u||t[25]!==c.kind?(O=a?(0,Q.jsx)(xn,{selected:c.kind===`new`,title:`New profile`,subtitle:`Created for these cookies`,onSelect:()=>u({kind:`new`})}):null,t[23]=a,t[24]=u,t[25]=c.kind,t[26]=O):O=t[26];let k;if(t[27]!==u||t[28]!==c.kind||t[29]!==c.profileId||t[30]!==i){let e;t[32]!==u||t[33]!==c.kind||t[34]!==c.profileId?(e=e=>(0,Q.jsx)(xn,{selected:c.kind===`existing`&&c.profileId===e.id,title:e.name,subtitle:`Existing profile`,onSelect:()=>u({kind:`existing`,profileId:e.id})},e.id),t[32]=u,t[33]=c.kind,t[34]=c.profileId,t[35]=e):e=t[35],k=i.map(e),t[27]=u,t[28]=c.kind,t[29]=c.profileId,t[30]=i,t[31]=k}else k=t[31];let A;t[36]!==O||t[37]!==k?(A=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[D,O,k]}),t[36]=O,t[37]=k,t[38]=A):A=t[38];let j;t[39]!==A||t[40]!==T?(j=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4`,children:[T,E,A]}),t[39]=A,t[40]=T,t[41]=j):j=t[41];let M;t[42]===_?M=t[43]:(M=_?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-destructive`,children:_}):null,t[42]=_,t[43]=M);let N;t[44]!==j||t[45]!==M?(N=(0,Q.jsxs)(Fe,{children:[j,M]}),t[44]=j,t[45]=M,t[46]=N):N=t[46];let P;t[47]===d?P=t[48]:(P=(0,Q.jsx)(y,{variant:`outline`,onClick:d,children:`Cancel`}),t[47]=d,t[48]=P);let F=o===``||m||h,I;t[49]!==f||t[50]!==F?(I=(0,Q.jsx)(y,{disabled:F,onClick:f,children:`Import`}),t[49]=f,t[50]=F,t[51]=I):I=t[51];let L;t[52]!==P||t[53]!==I?(L=(0,Q.jsxs)(Ne,{children:[P,I]}),t[52]=P,t[53]=I,t[54]=L):L=t[54];let R;return t[55]!==N||t[56]!==L||t[57]!==x?(R=(0,Q.jsxs)(Q.Fragment,{children:[x,N,L]}),t[55]=N,t[56]=L,t[57]=x,t[58]=R):R=t[58],R}function xn(e){let t=(0,Z.c)(22),{selected:n,title:r,subtitle:i,onSelect:a}=e,o=n?`border-primary bg-primary/8`:`border-border/60 hover:border-border hover:bg-muted/40`,s;t[0]===o?s=t[1]:(s=w(`flex w-full cursor-pointer items-center justify-between gap-3 rounded-lg border px-3 py-2 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,o),t[0]=o,t[1]=s);let l;t[2]===r?l=t[3]:(l=(0,Q.jsx)(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:r}),t[2]=r,t[3]=l);let u;t[4]===i?u=t[5]:(u=i?(0,Q.jsx)(`span`,{className:`block truncate text-xs tabular-nums text-muted-foreground`,children:i}):null,t[4]=i,t[5]=u);let d;t[6]!==l||t[7]!==u?(d=(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[l,u]}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f=n?`border-primary bg-primary text-primary-foreground`:`border-input`,p;t[9]===f?p=t[10]:(p=w(`grid size-4 shrink-0 place-items-center rounded-full border`,f),t[9]=f,t[10]=p);let m;t[11]===n?m=t[12]:(m=n?(0,Q.jsx)(c,{className:`size-2.5`}):null,t[11]=n,t[12]=m);let h;t[13]!==p||t[14]!==m?(h=(0,Q.jsx)(`span`,{className:p,children:m}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==a||t[17]!==n||t[18]!==s||t[19]!==d||t[20]!==h?(g=(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:a,className:s,children:[d,h]}),t[16]=a,t[17]=n,t[18]=s,t[19]=d,t[20]=h,t[21]=g):g=t[21],g}function Sn(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(je,{children:[(0,Q.jsx)(Me,{children:`Importing cookies`}),(0,Q.jsx)(Ie,{children:`This may take a moment.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[t,(0,Q.jsx)(Fe,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,Q.jsx)(me,{size:`md`,tone:`muted`}),(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Importing…`})]})})]}),e[1]=n):n=e[1],n}function Cn(e){let t=(0,Z.c)(13),{sourceName:n,check:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsxs)(Me,{children:[`Checking `,n]}),t[0]=n,t[1]=i);let a=r===`fullDiskAccess`?`Checking Full Disk Access.`:`Checking whether the browser has closed.`,o;t[2]===a?o=t[3]:(o=(0,Q.jsx)(Ie,{children:a}),t[2]=a,t[3]=o);let s;t[4]!==i||t[5]!==o?(s=(0,Q.jsxs)(je,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6];let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(me,{size:`md`,tone:`muted`}),t[7]=c):c=t[7];let l=r===`fullDiskAccess`?`Checking access…`:`Checking…`,u;t[8]===l?u=t[9]:(u=(0,Q.jsx)(Fe,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[c,(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:l})]})}),t[8]=l,t[9]=u);let d;return t[10]!==s||t[11]!==u?(d=(0,Q.jsxs)(Q.Fragment,{children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function wn(e){let t=(0,Z.c)(24),{imported:n,skipped:r,skippedDomains:i,targetName:a,destinationEnvironmentName:o,onClose:s}=e,c;t[0]!==n||t[1]!==r?(c=n>0?`Imported ${vn(n)}`:r>0?`Skipped ${vn(r)}`:`No cookies found`,t[0]=n,t[1]=r,t[2]=c):c=t[2];let l;t[3]===c?l=t[4]:(l=(0,Q.jsx)(Me,{children:c}),t[3]=c,t[4]=l);let u;t[5]!==o||t[6]!==n||t[7]!==r||t[8]!==a?(u=n>0?`Added to ${a} for ${o}.${r>0?` ${vn(r)} skipped.`:``}`:r>0?`No cookies were imported for ${o}.`:`There were no cookies to import for ${o}.`,t[5]=o,t[6]=n,t[7]=r,t[8]=a,t[9]=u):u=t[9];let d;t[10]===u?d=t[11]:(d=(0,Q.jsx)(Ie,{children:u}),t[10]=u,t[11]=d);let f;t[12]!==l||t[13]!==d?(f=(0,Q.jsxs)(je,{children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=i.length>0?(0,Q.jsxs)(Fe,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Skipped`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-foreground`,children:mn(i)})]}):null,t[15]=i,t[16]=p);let m;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(y,{}),t[17]=m):m=t[17];let h;t[18]===s?h=t[19]:(h=(0,Q.jsx)(Ne,{children:(0,Q.jsx)(Pe,{render:m,onClick:s,children:`Done`})}),t[18]=s,t[19]=h);let g;return t[20]!==f||t[21]!==p||t[22]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[f,p,h]}),t[20]=f,t[21]=p,t[22]=h,t[23]=g):g=t[23],g}function Tn(e){let t=(0,Z.c)(17),{source:n,reason:r,onClose:i,onRetry:a}=e,o;t[0]===n.name?o=t[1]:(o=(0,Q.jsxs)(Me,{children:[`Couldn’t import from `,n.name]}),t[0]=n.name,t[1]=o);let s=te[r],c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(Ie,{children:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c?(l=(0,Q.jsxs)(je,{children:[o,c]}),t[4]=o,t[5]=c,t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=(0,Q.jsx)(y,{variant:`outline`,onClick:i,children:`Close`}),t[7]=i,t[8]=u);let d;t[9]===a?d=t[10]:(d=a?(0,Q.jsx)(y,{onClick:a,children:`Try again`}):null,t[9]=a,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,Q.jsxs)(Ne,{children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==l||t[15]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[l,f]}),t[14]=l,t[15]=f,t[16]=p):p=t[16],p}var En=`fill`,Dn=`responsive`;async function On(e,t,n,r){let i=e===null?[]:t,a=r?.environmentIds??[];if(i.length===0&&a.length===0)throw Error(`Browser profile data is not available to clear.`);await Promise.all([...i.flatMap(t=>[e.clearCookies(t,n),e.clearCache(t,n)]),...a.map(e=>r.clear(e,n))])}function kn(e,t,n,r=0){return(e||r>0)&&t&&n>0}var An={width:1280,height:800},jn={useGrouping:!1},Mn={system:`System`,light:`Light`,dark:`Dark`},Nn=e=>`${Math.round(e*100)}%`,Pn=class extends Error{constructor(){super(`Browser profile limit reached.`),this.name=`ProfileLimitReachedError`}},Fn=e=>{let t=String(e?.message??``);return ie.literals.find(e=>t.includes(`failed: ${e}.`))??`readFailed`},In=e=>e._tag===`fill`?En:e._tag===`preset`&&vt.some(t=>t.id===e.presetId)?e.presetId:Dn,Ln=e=>{let t=In(e);return t===En?`Fill panel`:t===Dn?`Responsive`:vt.find(e=>e.id===t)?.label??`Responsive`},Rn=e=>Number.isInteger(e)&&e>=240&&e<=3840,zn=e=>({...e,width:e.height,height:e.width});function Bn(e){let t=(0,Z.c)(42),{disabled:n}=e,r=J(Hn),i=Y(),a=r._tag===`fill`?null:r,o=a?.width??An.width,s=a?.height??An.height,c;t[0]!==o||t[1]!==s?(c={width:o,height:s},t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]!==a?.height||t[4]!==a?.width||t[5]!==i?(u=e=>{if(e===En){i({browserDefaultViewport:P});return}if(e===Dn){i({browserDefaultViewport:{_tag:`freeform`,width:a?.width??An.width,height:a?.height??An.height}});return}let t=vt.find(t=>t.id===e);t&&i({browserDefaultViewport:{_tag:`preset`,width:t.width,height:t.height,presetId:t.id}})},t[3]=a?.height,t[4]=a?.width,t[5]=i,t[6]=u):u=t[6];let d=u,f;t[7]!==l||t[8]!==a||t[9]!==i?(f=(e,t)=>{if(t===null||!Rn(t))return;let n={...l,[e]:t};n.width*n.height>8294400||a&&n.width===a.width&&n.height===a.height||i({browserDefaultViewport:{_tag:`freeform`,...n}})},t[7]=l,t[8]=a,t[9]=i,t[10]=f):f=t[10];let p=f,m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=yt(`browser-default-viewport`),t[11]=m):m=t[11];let h;t[12]!==n||t[13]!==i||t[14]!==r._tag?(h=!n&&r._tag!==N._tag?(0,Q.jsx)(ht,{label:`default browser viewport`,onClick:()=>i({browserDefaultViewport:N})}):null,t[12]=n,t[13]=i,t[14]=r._tag,t[15]=h):h=t[15];let g;t[16]===r?g=t[17]:(g=In(r),t[16]=r,t[17]=g);let _;t[18]===r?_=t[19]:(_=Ln(r),t[18]=r,t[19]=_);let v;t[20]===_?v=t[21]:(v=(0,Q.jsx)(fe,{size:`sm`,className:`w-full min-w-0 sm:w-44`,"aria-label":`Default browser viewport`,children:(0,Q.jsx)(le,{children:_})}),t[20]=_,t[21]=v);let b,x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(G,{value:En,children:`Fill panel`}),x=(0,Q.jsx)(G,{value:Dn,children:`Responsive`}),t[22]=b,t[23]=x):(b=t[22],x=t[23]);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(K,{align:`end`,alignItemWithTrigger:!1,children:[b,x,(0,Q.jsxs)(de,{children:[(0,Q.jsx)(ue,{children:`Standard`}),vt.map(Vn)]})]}),t[24]=S):S=t[24];let C;t[25]!==n||t[26]!==d||t[27]!==v||t[28]!==g?(C=(0,Q.jsxs)(pe,{value:g,onValueChange:d,disabled:n,children:[v,S]}),t[25]=n,t[26]=d,t[27]=v,t[28]=g,t[29]=C):C=t[29];let w;t[30]!==p||t[31]!==n||t[32]!==l||t[33]!==a||t[34]!==i?(w=a?(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(ce,{value:l.width,min:240,max:O,disabled:n,format:jn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`width`,e),children:(0,Q.jsx)(W,{children:(0,Q.jsx)(se,{"aria-label":`Default viewport width`})})}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`×`}),(0,Q.jsx)(ce,{value:l.height,min:240,max:O,disabled:n,format:jn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`height`,e),children:(0,Q.jsx)(W,{children:(0,Q.jsx)(se,{"aria-label":`Default viewport height`})})}),(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(y,{size:`icon-sm`,variant:`ghost-muted`,disabled:n,"aria-label":`Rotate to ${l.height>=l.width?`landscape`:`portrait`}`,onClick:()=>i({browserDefaultViewport:zn(a)}),children:(0,Q.jsx)(xt,{})})}),(0,Q.jsx)(Oe,{side:`top`,children:`Rotate`})]})]}):null,t[30]=p,t[31]=n,t[32]=l,t[33]=a,t[34]=i,t[35]=w):w=t[35];let T;t[36]!==C||t[37]!==w?(T=(0,Q.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-end gap-2 sm:w-auto`,children:[C,w]}),t[36]=C,t[37]=w,t[38]=T):T=t[38];let E;return t[39]!==T||t[40]!==h?(E=(0,Q.jsx)(X,{...m,description:`Tab size for you and agents. Fill fits the panel; other sizes show the device toolbar.`,resetAction:h,control:T}),t[39]=T,t[40]=h,t[41]=E):E=t[41],E}function Vn(e){return(0,Q.jsx)(G,{value:e.id,children:(0,Q.jsxs)(`span`,{className:`flex w-full items-center justify-between gap-5`,children:[(0,Q.jsx)(`span`,{children:e.label}),(0,Q.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:e.detail})]})},e.id)}function Hn(e){return e.browserDefaultViewport}function Un(e){let t=(0,Z.c)(20),{disabled:n}=e,r=J(Gn),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-default-zoom`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==i||t[3]!==r?(o=!n&&r!==1?(0,Q.jsx)(ht,{label:`default browser zoom`,onClick:()=>i({browserDefaultZoomFactor:1})}):null,t[1]=n,t[2]=i,t[3]=r,t[4]=o):o=t[4];let s=String(r),c;t[5]===i?c=t[6]:(c=e=>{let t=L.find(t=>String(t)===e);t!==void 0&&i({browserDefaultZoomFactor:t})},t[5]=i,t[6]=c);let l;t[7]===r?l=t[8]:(l=Nn(r),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser zoom`,children:(0,Q.jsx)(le,{children:l})}),t[9]=l,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:L.map(Wn)}),t[11]=d):d=t[11];let f;t[12]!==n||t[13]!==s||t[14]!==c||t[15]!==u?(f=(0,Q.jsxs)(pe,{disabled:n,value:s,onValueChange:c,children:[u,d]}),t[12]=n,t[13]=s,t[14]=c,t[15]=u,t[16]=f):f=t[16];let p;return t[17]!==o||t[18]!==f?(p=(0,Q.jsx)(X,{...a,description:`Page zoom applied to new browser tabs.`,resetAction:o,control:f}),t[17]=o,t[18]=f,t[19]=p):p=t[19],p}function Wn(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:String(e),children:Nn(e)},e)}function Gn(e){return e.browserDefaultZoomFactor}function Kn(e){let t=(0,Z.c)(18),{disabled:n}=e,r=J(Jn),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-default-appearance`),t[0]=a):a=t[0];let o;t[1]!==r||t[2]!==n||t[3]!==i?(o=!n&&r!==`system`?(0,Q.jsx)(ht,{label:`default browser appearance`,onClick:()=>i({browserDefaultAppearance:j})}):null,t[1]=r,t[2]=n,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>{(e===`system`||e===`light`||e===`dark`)&&i({browserDefaultAppearance:e})},t[5]=i,t[6]=s);let c=Mn[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser appearance`,children:(0,Q.jsx)(le,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:Object.entries(Mn).map(qn)}),t[9]=u):u=t[9];let d;t[10]!==r||t[11]!==n||t[12]!==s||t[13]!==l?(d=(0,Q.jsxs)(pe,{disabled:n,value:r,onValueChange:s,children:[l,u]}),t[10]=r,t[11]=n,t[12]=s,t[13]=l,t[14]=d):d=t[14];let f;return t[15]!==o||t[16]!==d?(f=(0,Q.jsx)(X,{...a,description:`The color scheme pages are told to prefer. System follows your OS setting.`,resetAction:o,control:d}),t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function qn(e){let[t,n]=e;return(0,Q.jsx)(G,{hideIndicator:!0,value:t,children:n},t)}function Jn(e){return e.browserDefaultAppearance}function Yn(e){let t=(0,Z.c)(17),{disabled:n}=e,r=J(Zn),i=J(Xn),a=Y(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=yt(`browser-recording-key-presses`),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=e=>a({browserRecordingShowKeyPresses:!!e}),t[1]=a,t[2]=s);let c;t[3]!==n||t[4]!==r||t[5]!==s?(c=(0,Q.jsx)(X,{...o,description:`Show pressed keys and shortcuts in new recordings. Password fields are excluded.`,control:(0,Q.jsx)(bt,{disabled:n,checked:r,"aria-label":`Show key presses in recordings`,onCheckedChange:s})}),t[3]=n,t[4]=r,t[5]=s,t[6]=c):c=t[6];let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=yt(`browser-recording-mouse-presses`),t[7]=l):l=t[7];let u;t[8]===a?u=t[9]:(u=e=>a({browserRecordingShowMousePresses:!!e}),t[8]=a,t[9]=u);let d;t[10]!==n||t[11]!==i||t[12]!==u?(d=(0,Q.jsx)(X,{...l,description:`Highlight mouse presses and held buttons in new recordings.`,control:(0,Q.jsx)(bt,{disabled:n,checked:i,"aria-label":`Show mouse presses in recordings`,onCheckedChange:u})}),t[10]=n,t[11]=i,t[12]=u,t[13]=d):d=t[13];let f;return t[14]!==c||t[15]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[c,d]}),t[14]=c,t[15]=d,t[16]=f):f=t[16],f}function Xn(e){return e.browserRecordingShowMousePresses}function Zn(e){return e.browserRecordingShowKeyPresses}function Qn(e){let t=(0,Z.c)(18),{disabled:n}=e,r=J(er),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-recording-frame-rate`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==r||t[3]!==i?(o=!n&&r!==30?(0,Q.jsx)(ht,{label:`browser recording frame rate`,onClick:()=>i({browserRecordingFrameRate:30})}):null,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s=String(r),c;t[5]===i?c=t[6]:(c=e=>{let t=F.find(t=>String(t)===e);t!==void 0&&i({browserRecordingFrameRate:t})},t[5]=i,t[6]=c);let l;t[7]===r?l=t[8]:(l=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Browser recording frame rate`,children:(0,Q.jsxs)(le,{children:[r,` fps`]})}),t[7]=r,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:F.map($n)}),t[9]=u):u=t[9];let d;t[10]!==n||t[11]!==s||t[12]!==c||t[13]!==l?(d=(0,Q.jsxs)(pe,{disabled:n,value:s,onValueChange:c,children:[l,u]}),t[10]=n,t[11]=s,t[12]=c,t[13]=l,t[14]=d):d=t[14];let f;return t[15]!==o||t[16]!==d?(f=(0,Q.jsx)(X,{...a,description:`Maximum recording rate. 30 fps saves CPU and storage; 60 fps is smoother.`,resetAction:o,control:d}),t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function $n(e){return(0,Q.jsxs)(G,{hideIndicator:!0,value:String(e),children:[e,` fps`]},e)}function er(e){return e.browserRecordingFrameRate}var tr={system:`Your default browser`,app:`P4 Code`};function nr(e){let t=(0,Z.c)(19),{disabled:n}=e,r=J(ir),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-link-target`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==r||t[3]!==i?(o=!n&&r!==`system`?(0,Q.jsx)(ht,{label:`link target`,onClick:()=>i({browserLinkTarget:ee})}):null,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>{(e===`system`||e===`app`)&&i({browserLinkTarget:e})},t[5]=i,t[6]=s);let c=tr[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Open links in`,children:(0,Q.jsx)(le,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.keys(tr),t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:u.map(rr)}),t[10]=d):d=t[10];let f;t[11]!==n||t[12]!==r||t[13]!==s||t[14]!==l?(f=(0,Q.jsxs)(pe,{disabled:n,value:r,onValueChange:s,children:[l,d]}),t[11]=n,t[12]=r,t[13]=s,t[14]=l,t[15]=f):f=t[15];let p;return t[16]!==o||t[17]!==f?(p=(0,Q.jsx)(X,{...a,description:`Where links in the chat and terminal open. Hold ⌘ or Ctrl while clicking a link to open it in your default browser either way.`,resetAction:o,control:f}),t[16]=o,t[17]=f,t[18]=p):p=t[18],p}function rr(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:e,children:tr[e]},e)}function ir(e){return e.browserLinkTarget}var ar={duckduckgo:`DuckDuckGo`,google:`Google`,bing:`Bing`,brave:`Brave Search`,kagi:`Kagi`,ecosia:`Ecosia`,custom:`Custom`};function or(){let e=(0,Z.c)(24),t=J(lr),n=J(cr),r=Y(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=yt(`browser-search-engine`),e[0]=i):i=e[0];let a;e[1]!==n||e[2]!==t||e[3]!==r?(a=t!==`duckduckgo`||n!==``?(0,Q.jsx)(ht,{label:`search engine`,onClick:()=>r({browserSearchEngine:M,browserCustomSearchUrl:``})}):null,e[1]=n,e[2]=t,e[3]=r,e[4]=a):a=e[4];let o;e[5]===r?o=e[6]:(o=e=>{let t=ne.literals.find(t=>t===e);t!==void 0&&r({browserSearchEngine:t})},e[5]=r,e[6]=o);let s=ar[t],c;e[7]===s?c=e[8]:(c=(0,Q.jsx)(fe,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Search engine`,children:(0,Q.jsx)(le,{children:s})}),e[7]=s,e[8]=c);let l;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(K,{align:`end`,alignItemWithTrigger:!1,children:ne.literals.map(sr)}),e[9]=l):l=e[9];let u;e[10]!==t||e[11]!==o||e[12]!==c?(u=(0,Q.jsxs)(pe,{value:t,onValueChange:o,children:[c,l]}),e[10]=t,e[11]=o,e[12]=c,e[13]=u):u=e[13];let d;e[14]!==a||e[15]!==u?(d=(0,Q.jsx)(X,{...i,description:`What the address bar searches when you type something that isn't a URL.`,resetAction:a,control:u}),e[14]=a,e[15]=u,e[16]=d):d=e[16];let f;e[17]!==n||e[18]!==t||e[19]!==r?(f=t===`custom`?(0,Q.jsx)(X,{title:`Custom search URL`,description:`Use %s where the search terms go.`,status:nt(n)?void 0:`Enter an http or https URL containing %s. Searches use DuckDuckGo until then.`,control:(0,Q.jsx)(Tt,{nativeInput:!0,size:`sm`,className:`w-full sm:w-64`,"aria-label":`Custom search URL`,placeholder:`https://example.com/search?q=%s`,autoCapitalize:`none`,spellCheck:!1,maxLength:re,value:n,onCommit:e=>r({browserCustomSearchUrl:e.trim()})})}):null,e[17]=n,e[18]=t,e[19]=r,e[20]=f):f=e[20];let p;return e[21]!==d||e[22]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[d,f]}),e[21]=d,e[22]=f,e[23]=p):p=e[23],p}function sr(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:e,children:ar[e]},e)}function cr(e){return e.browserCustomSearchUrl}function lr(e){return e.browserSearchEngine}function ur(){let e=(0,Z.c)(12),t=J(dr),n=Y(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=yt(`pull-request-links-open-in-app`),e[0]=r):r=e[0];let i;e[1]!==t||e[2]!==n?(i=t?null:(0,Q.jsx)(ht,{label:`open pull requests in P4 Code`,onClick:()=>n({pullRequestLinksOpenInApp:!0})}),e[1]=t,e[2]=n,e[3]=i):i=e[3];let a;e[4]===n?a=e[5]:(a=e=>n({pullRequestLinksOpenInApp:!!e}),e[4]=n,e[5]=a);let o;e[6]!==t||e[7]!==a?(o=(0,Q.jsx)(bt,{checked:t,onCheckedChange:a,"aria-label":`Open pull requests in P4 Code`}),e[6]=t,e[7]=a,e[8]=o):o=e[8];let s;return e[9]!==i||e[10]!==o?(s=(0,Q.jsx)(X,{...r,description:`Clicking a pull request link opens it in P4 Code. Turn off to open pull request links like any other link, on GitHub or your git host.`,resetAction:i,control:o}),e[9]=i,e[10]=o,e[11]=s):s=e[11],s}function dr(e){return e.pullRequestLinksOpenInApp}function fr(){let e=(0,Z.c)(7),{search:t,environment:n}=ft(),r=ut(),i=n?.connection.phase===`connected`&&n.serverConfig!==null?n.environmentId:null,a;e[0]===t?a=e[1]:(a=JSON.stringify(t),e[0]=t,e[1]=a);let o=`${i}:${a}`,s;return e[2]!==i||e[3]!==r.enableAgentDeviceAccess||e[4]!==r.enableDeviceSupport||e[5]!==o?(s=(0,Q.jsx)(gt,{id:`devices`,title:`Devices`,children:(0,Q.jsx)(pr,{environmentId:i,enabled:r.enableDeviceSupport,agentAccessEnabled:r.enableAgentDeviceAccess},o)}),e[2]=i,e[3]=r.enableAgentDeviceAccess,e[4]=r.enableDeviceSupport,e[5]=o,e[6]=s):s=e[6],s}function pr({environmentId:e,enabled:t,agentAccessEnabled:n}){let r=Se(e,H),{state:i,loaded:a}=ze(e),{scope:o,environments:s,connectedEnvironments:c}=ft(),l=dt(),u=o.kind===`project`||o.kind===`checkout`,d=c.some(e=>e.serverConfig?.settings.enableDeviceSupport),f=Te(Be.configure,{reportFailure:!1}),p=Te(Be.list,{reportFailure:!1}),[m,h]=(0,$.useState)(null),g=i.hostStatus===`installing`||i.hostStatus===`starting`,v=i.hosts.some(e=>e.kind===`local`&&!e.platforms.some(e=>e.available)),[b,x]=(0,$.useState)(!1);b&&!t&&x(!1),t&&!b&&(i.hostStatus===`ready`||v)&&m!==`hub`&&x(!0);let S=async(t,n)=>{if(e&&Ce(e,`settings:write`)){h(t);try{let e=await Promise.allSettled(s.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!Ce(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return f({environmentId:e.environmentId,input:{...n,...n.enabled?{onboardingCompleted:!0}:{}}})})),t=s.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});t.length>0&&q.add({type:`error`,title:`Device settings not saved on all environments`,description:`Could not update ${t.map(e=>e.label).join(`, `)}.`})}finally{h(null)}}},[C,w]=(0,$.useState)(null),T=i.hosts.find(e=>e.kind===`local`)?.tools,E=e=>{let t=T?.[e];return i.supportsToolUpdate&&t?!t.installedVersions.includes(t.requiredVersion):!1},D=(t,n=!1)=>{e&&(w(null),h(`update-${t}`),p({environmentId:e,input:{updateTool:t}}).then(e=>{if(e._tag===`Failure`){let r=we(e.cause);w({tool:t,message:r}),n&&q.add({type:`error`,title:r})}}).finally(()=>h(null)))},O=t=>{e&&(h(t),p({environmentId:e,input:{inspectOnly:!0}}).finally(()=>h(null)))},k=t=>{let n=E(t);if(!n&&!i.supportsToolInspection)return null;let r=m===`update-${t}`||m===`check-${t}`,a=n?`Update to v${T?.[t].requiredVersion}`:`Check ${t===`hub`?`device hub`:`agent device`} version`;return(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(y,{size:`icon-xs`,variant:`ghost-muted`,disabled:!e||m!==null||g,"aria-label":a,onClick:()=>n?D(t,!0):O(`check-${t}`)}),children:(0,Q.jsxs)(`span`,{className:`grid *:col-start-1 *:row-start-1 *:transition-[opacity,scale] *:duration-150 *:ease-out motion-reduce:*:transition-none`,children:[(0,Q.jsx)(`span`,{className:n&&!r?void 0:`scale-75 opacity-0`,children:(0,Q.jsx)(_,{"aria-hidden":!0})}),(0,Q.jsx)(`span`,{className:n&&!r?`scale-75 opacity-0`:void 0,children:(0,Q.jsx)(St,{refreshing:r})})]})}),(0,Q.jsx)(Oe,{side:`top`,children:a})]})},A=t=>{let n=T?.[t];return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&E(t)?(0,Q.jsx)(y,{size:`sm`,disabled:!e||m!==null||g,onClick:()=>D(t),children:m===`update-${t}`?`Updating…`:`Update`}):null,i.supportsToolInspection?(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:!e||m!==null||g,onClick:()=>O(`check`),children:m===`check`?`Checking…`:`Check versions`}):null]}),C?.tool===t?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:C.message}):null]})};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{...yt(`device-hub`),serverScoped:!0,settingKeys:[`enableDeviceSupport`],description:Ge,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(jt,{action:A(`hub`),kind:`hub`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),k(`hub`),m===`hub`?(0,Q.jsx)(We,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(Et,{settingKeys:[`enableDeviceSupport`],checked:t,disabled:!r||u||!a||!e||g||m!==null,"aria-label":`Device hub`,onCheckedChange:e=>void S(`hub`,{enabled:!!e,...e?{}:{agentAccessEnabled:!1}})})]})}),(0,Q.jsx)(Qe,{children:b?(0,Q.jsx)(X,{...yt(`device-platform-support`),description:c.length>1?`Status for ${c.find(t=>t.environmentId===e)?.label}. Select an environment to inspect its simulator support.`:void 0,status:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2`,children:[(0,Q.jsx)(Ue,{compact:!0,platform:`iOS`,status:qe(i,`ios`)}),(0,Q.jsx)(Ue,{compact:!0,platform:`Android`,status:qe(i,`android`)})]}),control:(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:!e||!t||g||m!==null,onClick:()=>{e&&(h(`check`),p({environmentId:e,input:{}}).finally(()=>h(null)))},children:m===`check`?`Checking…`:`Refresh`})}):null}),(0,Q.jsx)(X,{...yt(`agent-device-access`),serverScoped:!0,settingKeys:[`enableAgentDeviceAccess`],description:Ve,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(jt,{action:A(`agent`),kind:`agent`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),k(`agent`),m===`agent`?(0,Q.jsx)(Ke,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(Et,{settingKeys:[`enableAgentDeviceAccess`],checked:n,disabled:!r||c.length===0||!u&&(!a||!d||g)||m!==null,"aria-label":`Agent device access`,onCheckedChange:e=>u?l({enableAgentDeviceAccess:!!e}):void S(`agent`,{agentAccessEnabled:!!e})})]})}),e?(0,Q.jsx)(He,{state:{...i,hosts:i.hosts.filter(e=>e.kind===`local`)},environmentId:e}):null,(0,Q.jsx)(Wt,{environmentId:e}),i.supportsEasHosts?(0,Q.jsx)(tn,{environmentId:e}):null]})}function mr(e){let t=(0,Z.c)(14),{disabled:n}=e,r=J(hr),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=yt(`browser-auto-show-floating-preview`),t[0]=a):a=t[0];let o;t[1]!==r||t[2]!==n||t[3]!==i?(o=!n&&r!==!0?(0,Q.jsx)(ht,{label:`auto-show floating preview`,onClick:()=>i({browserAutoShowFloatingPreview:!0})}):null,t[1]=r,t[2]=n,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>i({browserAutoShowFloatingPreview:!!e}),t[5]=i,t[6]=s);let c;t[7]!==r||t[8]!==n||t[9]!==s?(c=(0,Q.jsx)(bt,{disabled:n,checked:r,onCheckedChange:s,"aria-label":`Auto-show floating preview`}),t[7]=r,t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;return t[11]!==o||t[12]!==c?(l=(0,Q.jsx)(X,{...a,description:`Show the floating preview when an agent opens a browser or device unless the agent says otherwise.`,resetAction:o,control:c}),t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function hr(e){return e.browserAutoShowFloatingPreview}function gr({disabled:e}){let t=J(e=>e.browserProfiles),n=J(e=>e.browserDefaultProfileId),r=ve(),a=Y(),{environments:o,isReady:c}=he(),l=_e(),[h,g]=(0,$.useState)(null),[_,b]=(0,$.useState)(null),[S,E]=(0,$.useState)(null),[D,O]=(0,$.useState)(null),[j,M]=(0,$.useState)(null),[N,P]=(0,$.useState)(!1),F=oe(),I=Te(tt.clearProfile,{reportFailure:!1}),L={environmentIds:o.map(e=>e.environmentId).filter(e=>F.get(e)?.environment.capabilities.serverBrowser===!0),clear:async(e,t)=>{let n=await I({environmentId:e,input:{profileId:t}});if(n._tag===`Failure`)throw ae(n)}},B=kn(Ct!==null,c,o.length,L.environmentIds.length),V=(0,$.useRef)(!1),[ee,H]=(0,$.useState)(!1),U=e||!r,te=R(t).filter(e=>e.kind!==`incognito`),ne=k(te,n)?.id??`default`,re=e=>{if(!r||V.current)return;let t=be().browserProfiles;if(t.length>=24)return;let n=R(t),i=new Set(n.map(e=>e.name)),o=e;for(let t=2;i.has(o);t+=1)o=`${e} ${t}`;let s={id:`profile-${v()}`,name:o,kind:`persistent`};return a({browserProfiles:[...t,s]}),s},ie=(e,t)=>{if(!r||V.current)return;let n=t.trim().slice(0,48);if(n===``)return;let i=be().browserProfiles;a({browserProfiles:i.map(t=>t.id===e?{...t,name:n}:t)})},se=(e,t)=>{r&&!V.current&&(B?On(Ct,o.map(e=>e.environmentId),e,L).then(()=>{q.add({type:`success`,title:`Cleared ${t}'s cookies and cache`})}).catch(()=>{q.add({type:`error`,title:`Could not clear ${t}'s data`})}):q.add({type:`error`,title:`Could not clear ${t}'s data`,description:`You're not connected to a server yet.`}))},W=async e=>{if(!r||V.current)return;if(!B){M(`Connect to an environment before removing this profile.`);return}M(null),P(!0);try{await On(Ct,c?o.map(e=>e.environmentId):[],e,L)}catch{M(`Profile data could not be deleted. Try again.`),P(!1);return}let t=be();a({browserProfiles:t.browserProfiles.filter(t=>t.id!==e),...t.browserDefaultProfileId===e?{browserDefaultProfileId:A}:{}}),P(!1),E(null)},ce=(h??[]).filter(e=>e.unavailable!==`notInstalled`&&e.unavailable!==`unsupportedPlatform`),G=(0,$.useCallback)(()=>{Ct&&Ct.listBrowserImportSources().then(g).catch(()=>g(e=>e??[]))},[]),le=async(e,t,n)=>{if(!Ct||!r)return{kind:`blocked`,reason:`sessionUnavailable`};if(n.target.kind===`existing`&&!R(be().browserProfiles).some(e=>e.id===n.target.profileId)||V.current)return{kind:`blocked`,reason:`readFailed`};V.current=!0,H(!0);try{let r=await Ct.importBrowserCookies({environmentId:t,sourceId:e.id,sourceProfileDirectory:n.sourceProfileDirectory,targetProfileId:n.target.profileId});if(n.target.kind===`existing`&&!R(be().browserProfiles).some(e=>e.id===n.target.profileId))return{kind:`blocked`,reason:`readFailed`};let i;if(n.target.kind===`new`){if(r.imported>0)try{i=(await ye(t=>{if(t.browserProfiles.find(e=>e.id===n.target.profileId))return t;if(t.browserProfiles.length>=24)throw new Pn;let r=new Set(R(t.browserProfiles).map(e=>e.name)),i=e.name;for(let t=2;r.has(i);t+=1)i=`${e.name} ${t}`;return{...t,browserProfiles:[...t.browserProfiles,{id:n.target.profileId,name:i,kind:`persistent`}]}})).browserProfiles.find(e=>e.id===n.target.profileId)?.name??e.name}catch(r){await On(Ct,[t],n.target.profileId).catch(()=>void 0);let i=r instanceof Pn?`profileLimitReached`:`profileNotSaved`;throw Error(`Importing cookies from ${e.id} failed: ${i}.`,{cause:r})}else i=e.name}else i=n.target.name;return{kind:`imported`,imported:r.imported,skipped:r.skipped,skippedDomains:r.skippedDomains,targetName:i}}catch(e){return{kind:`blocked`,reason:Fn(e)}}finally{V.current=!1,H(!1)}},ue=async e=>{if(Ct)try{let t=await Ct.listBrowserImportSources();return g(t),t.find(t=>t.id===e)}catch{return}},K=t.length>=24;return(0,Q.jsxs)(X,{...yt(`browser-profiles`),description:`Profiles separate cookies and logins. Incognito data is cleared when the app closes.`,control:(0,Q.jsxs)(f,{onOpenChange:e=>e&&G(),children:[(0,Q.jsxs)(m,{render:(0,Q.jsx)(y,{size:`sm`,variant:`outline`,disabled:U||ee}),children:[(0,Q.jsx)(d,{}),`Add profile`]}),(0,Q.jsxs)(x,{align:`end`,children:[(0,Q.jsx)(T,{disabled:!r||K,onClick:()=>re(`New profile`),children:`Blank profile`}),K?(0,Q.jsx)(T,{disabled:!0,children:`You’ve reached the profile limit`}):null,(0,Q.jsx)(C,{}),(0,Q.jsxs)(i,{children:[(0,Q.jsx)(p,{children:`Import from`}),h===null?(0,Q.jsx)(T,{disabled:!0,children:`Looking for browsers…`}):ce.length===0?(0,Q.jsx)(T,{disabled:!0,children:`No supported browsers found`}):(0,Q.jsxs)(Q.Fragment,{children:[ce.map(e=>(0,Q.jsx)(T,{disabled:!r||l==null,onClick:()=>{r&&l!=null&&b({source:e,environmentId:l.environmentId,environmentName:_t({isPrimary:!0,environmentId:l.environmentId,runtimeLabel:l.label})})},children:e.name},e.id)),l==null?(0,Q.jsx)(T,{disabled:!0,children:`Connect to an environment to import cookies`}):null]})]})]})]}),children:[(0,Q.jsx)(`div`,{className:`mt-2 mb-2 overflow-hidden rounded-lg border border-border/60`,children:te.map((e,t)=>{let n=z(e.id),i=e.id===ne;return(0,Q.jsxs)(`div`,{className:w(`flex items-center gap-3 px-3 py-2`,t>0&&`border-t border-border/60`),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[n?(0,Q.jsx)(`span`,{className:w(`truncate text-sm text-foreground`,U&&`opacity-64`),children:e.name}):(0,Q.jsx)(Tt,{nativeInput:!0,size:`sm`,className:`w-full max-w-56`,"aria-label":`Rename ${e.name}`,disabled:U||ee,maxLength:48,value:e.name,onCommit:t=>ie(e.id,t)}),i?(0,Q.jsx)(`span`,{className:w(`flex`,U&&`opacity-64`),children:(0,Q.jsx)(u,{children:`Default`})}):null]}),(0,Q.jsxs)(f,{children:[(0,Q.jsx)(m,{render:(0,Q.jsx)(y,{size:`icon-xs`,variant:`ghost-muted`,disabled:U||ee,"aria-label":`${e.name} options`}),children:(0,Q.jsx)(s,{})}),(0,Q.jsxs)(x,{align:`end`,children:[(0,Q.jsx)(T,{disabled:!r||i,onClick:()=>{r&&a({browserDefaultProfileId:e.id})},children:`Set as default`}),(0,Q.jsx)(T,{disabled:!r||!B,onClick:()=>{L.environmentIds.length>0?O(e):se(e.id,e.name)},children:`Clear cookies and cache`}),n?null:(0,Q.jsx)(T,{variant:`destructive`,disabled:!r||!B,onClick:()=>{r&&E(e)},children:`Remove profile and data`}),B?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(C,{}),(0,Q.jsx)(T,{disabled:!0,children:c?`Connect to an environment to clear profile data`:`Checking environments…`})]})]})]})]},e.id)})}),(0,Q.jsx)(lt,{open:S!==null,onOpenChange:e=>{!e&&!N&&(E(null),M(null))},children:(0,Q.jsxs)(ot,{children:[(0,Q.jsxs)(rt,{children:[(0,Q.jsxs)(ct,{children:[`Remove “`,S?.name,`”?`]}),(0,Q.jsx)(st,{children:`Its cookies and logins are deleted. Desktop tabs already open in this profile stay open until you close them; server browser tabs close now.`}),j?(0,Q.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-destructive`,children:j}):null,B?null:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect to an environment to remove this profile and its data.`})]}),(0,Q.jsxs)(it,{children:[(0,Q.jsx)(at,{disabled:N,render:(0,Q.jsx)(y,{variant:`outline`,disabled:N}),children:`Cancel`}),(0,Q.jsx)(y,{variant:`destructive`,disabled:N||!r||!B,onClick:()=>{S&&r&&B&&W(S.id)},children:N?`Removing…`:`Remove profile`})]})]})}),(0,Q.jsx)(lt,{open:D!==null,onOpenChange:e=>{e||O(null)},children:(0,Q.jsxs)(ot,{children:[(0,Q.jsxs)(rt,{children:[(0,Q.jsxs)(ct,{children:[`Clear “`,D?.name,`”’s cookies and cache?`]}),(0,Q.jsx)(st,{children:`You are signed out of its sites. Server browser tabs open in this profile close now.`})]}),(0,Q.jsxs)(it,{children:[(0,Q.jsx)(at,{render:(0,Q.jsx)(y,{variant:`outline`}),children:`Cancel`}),(0,Q.jsx)(y,{variant:`destructive`,onClick:()=>{D&&se(D.id,D.name),O(null)},children:`Clear data`})]})]})}),_?(0,Q.jsx)(hn,{source:_.source,destinationEnvironmentName:_.environmentName,targetProfiles:te.map(e=>({id:e.id,name:e.name})),canCreateProfile:r&&!K,onImport:e=>le(_.source,_.environmentId,e),onRefreshSource:()=>ue(_.source.id),onCheckFullDiskAccess:window.desktopBridge?.checkSystemPermission?()=>window.desktopBridge.checkSystemPermission(`full-disk-access`):void 0,onOpenFullDiskAccessSettings:async()=>{await ge()?.shell.openSystemSettings(`full-disk-access`).catch(()=>{q.add({type:`error`,title:`Could not open System Settings`,description:`Open Privacy & Security → Full Disk Access manually.`})})},onClose:()=>b(null)}):null]})}function _r(){let e=(0,Z.c)(3),t=!Ee,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(gr,{disabled:t}),(0,Q.jsx)(Bn,{disabled:t}),(0,Q.jsx)(Un,{disabled:t}),(0,Q.jsx)(Kn,{disabled:t}),(0,Q.jsx)(Qn,{disabled:t}),(0,Q.jsx)(Yn,{disabled:t}),(0,Q.jsx)(nr,{disabled:t}),(0,Q.jsx)(mr,{disabled:t})]}),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(wt,{category:`integrations`}),e[1]=i):i=e[1];let a;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(mt,{children:[i,(0,Q.jsxs)(gt,{id:`browser`,title:`Browser`,children:[t?(0,Q.jsx)(pt,{message:`Only available in the desktop app.`,children:r}):r,(0,Q.jsx)(or,{}),(0,Q.jsx)(ur,{})]}),(0,Q.jsx)(fr,{})]}),e[2]=a):a=e[2],a}var vr=_r;export{vr as component};
2
+ //# sourceMappingURL=settings.integrations-CYmWtYZT.js.map
@@ -1,2 +1,2 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Ea as i,Hf as a,Lc as o,Wl as s,Xn as c,Zd as l,Zn as u,au as d,df as f,fr as p,fu as m,kl as h,mr as g,op as _,rr as v,t as y,tr as b,wd as x}from"./utils-BVnIIHXP.js";import{la as S,ra as C}from"./src-DHn7yNZx.js";import{Dr as w,Sr as T}from"./runtime-CbYvES7U.js";import{a as E,c as D,o as O,s as k,t as A}from"./select-CNcZzYBl.js";import{t as j}from"./useLocation-BXwb7I1F.js";import{a as M}from"./relay-BLgoNhyd.js";import{f as N}from"./server-CEMcTnD1.js";import{i as P,n as F,o as ee}from"./session-Ces3Ebxl.js";import{t as I}from"./use-atom-command-DWabKYXN.js";import{t as L}from"./env-BfPir1X4.js";import{a as R,n as z,t as B}from"./tooltip-BhCWnsdW.js";import{t as te}from"./toggle-DumCe7R7.js";import{t as ne}from"./input-yaZxaTds.js";import{i as re,o as ie,t as V}from"./popover-DnYfrQly.js";import{i as ae}from"./keybindings-CrlWqd5q.js";import{n as oe,r as se,t as ce}from"./input-group-B1TOCtDG.js";import{n as le,t as ue}from"./kbd-R7rkirqT.js";import{G as de,V as fe,a as pe,i as me,s as he}from"./settingsLayout-D5Mded9h.js";import{a as H,c as ge,f as _e,i as ve,l as ye,m as be,n as xe,o as Se,p as U,r as Ce,s as we,t as Te,u as W}from"./KeybindingsSettings.logic-oAUXQqts.js";import{Bo as Ee,Ir as De,Lr as Oe}from"./main-xhw8F2iL.js";var G=n(),K=e(t(),1),ke=e(i(),1),q=e(r(),1);function Ae(e){let t=(0,G.c)(6),{value:n}=e,r,i;if(t[0]!==n){let e=new Map,a=n.split(`+`).map(t=>{let n=e.get(t)??0;return e.set(t,n+1),{part:t,key:n===0?t:`${t}-${n}`}});r=le,i=a.map(je),t[0]=n,t[1]=r,t[2]=i}else r=t[1],i=t[2];let a;return t[3]!==r||t[4]!==i?(a=(0,q.jsx)(r,{children:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function je(e){let{part:t,key:n}=e;return(0,q.jsx)(ue,{children:t===`mod`?navigator.platform.toLowerCase().includes(`mac`)?`⌘`:`Ctrl`:t===`shift`?`⇧`:t===`alt`?navigator.platform.toLowerCase().includes(`mac`)?`⌥`:`Alt`:t===`ctrl`?`⌃`:t.length===1?t.toUpperCase():t},n)}function Me(e){let t=(0,G.c)(11),{query:n,onChange:r,inputRef:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(oe,{children:(0,q.jsx)(f,{"aria-hidden":!0,className:`size-3.5`})}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=e=>r(e.currentTarget.value),t[1]=r,t[2]=o);let s;t[3]!==r||t[4]!==n?(s=e=>{e.key===`Escape`&&(e.preventDefault(),n.length>0?r(``):e.currentTarget.blur())},t[3]=r,t[4]=n,t[5]=s):s=t[5];let c;return t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==s?(c=(0,q.jsxs)(ce,{className:`min-w-0 basis-full **:[input]:h-9 sm:basis-0 sm:flex-1 sm:**:[input]:h-8`,children:[a,(0,q.jsx)(se,{ref:i,type:`search`,value:n,onChange:o,onKeyDown:s,placeholder:`Search keybindings`,"aria-label":`Search keybindings`,size:`sm`})]}),t[6]=i,t[7]=n,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function Ne(e,t){return e.type===t?[...Ne(e.left,t),...Ne(e.right,t)]:[e]}function J(e,t){let n=e[0];if(n)return e.slice(1).reduce((e,n)=>({type:t,left:e,right:n}),n)}function Pe(e){return e.type===`identifier`?{identifier:e.name,negated:!1}:e.type===`not`&&e.node.type===`identifier`?{identifier:e.node.name,negated:!0}:null}function Fe(e,t){let n=Pe(e);if(!n)return e;let r={type:`identifier`,name:t};return n.negated?{type:`not`,node:r}:r}function Ie(e,t){let n=Pe(e);if(!n)return t?{type:`not`,node:e}:e;let r={type:`identifier`,name:n.identifier};return t?{type:`not`,node:r}:r}function Y(){return{type:`identifier`,name:Te}}function Le(e=`and`){return{type:e,left:Y(),right:{type:`not`,node:Y()}}}function X(e){let t=(0,G.c)(14),{label:n,focusable:r,className:i,children:o}=e,s=r===void 0||r?0:void 0,c;t[0]===i?c=t[1]:(c=y(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-warning outline-none transition-colors hover:bg-warning/10 focus-visible:ring-3 focus-visible:ring-inset focus-visible:ring-warning/25`,i),t[0]=i,t[1]=c);let l;t[2]!==n||t[3]!==s||t[4]!==c?(l=(0,q.jsx)(`span`,{tabIndex:s,"aria-label":n,className:c}),t[2]=n,t[3]=s,t[4]=c,t[5]=l):l=t[5];let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.jsx)(a,{className:`size-3.5`}),t[6]=u):u=t[6];let d;t[7]===l?d=t[8]:(d=(0,q.jsx)(R,{render:l,children:u}),t[7]=l,t[8]=d);let f;t[9]===o?f=t[10]:(f=(0,q.jsx)(z,{side:`top`,children:o}),t[9]=o,t[10]=f);let p;return t[11]!==d||t[12]!==f?(p=(0,q.jsxs)(B,{children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13],p}function Re(e){let t=(0,G.c)(5),{identifiers:n,focusable:r}=e,i=r===void 0||r;if(n.length===0)return null;let a;t[0]===n?a=t[1]:(a=n.length===1?`Unknown condition: ${n[0]}`:`Unknown conditions: ${n.join(`, `)}`,t[0]=n,t[1]=a);let o=a,s;return t[2]!==i||t[3]!==o?(s=(0,q.jsx)(X,{label:o,focusable:i,className:`size-4.5`,children:`P4 Code does not recognize this condition yet. It can still be saved, but it may not match unless the runtime provides it.`}),t[2]=i,t[3]=o,t[4]=s):s=t[4],s}function ze(e){let t=(0,G.c)(4),{labels:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.length===1?`Conflicts with ${n[0]}.`:`Conflicts with ${n.slice(0,3).join(`, `)}${n.length>3?`, and more`:``}.`,t[0]=n,t[1]=r);let i=r,a;return t[2]===i?a=t[3]:(a=(0,q.jsxs)(X,{label:i,children:[i,` The most recent matching binding wins when both conditions can apply.`]}),t[2]=i,t[3]=a),a}function Be(e){let t=(0,G.c)(25),{value:n,variables:r,unknownIdentifiers:i,onChange:a}=e,o;if(t[0]!==n||t[1]!==r){let e;t[3]===n?e=t[4]:(e=e=>e===n,t[3]=n,t[4]=e),o=r.find(e),t[0]=n,t[1]=r,t[2]=o}else o=t[2];let s=o,c;t[5]!==s||t[6]!==n||t[7]!==r?(c=s||r.some(e=>e===n)?r:[n,...r],t[5]=s,t[6]=n,t[7]=r,t[8]=c):c=t[8];let l=c,u;t[9]===a?u=t[10]:(u=e=>e&&a(e),t[9]=a,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,q.jsx)(D,{placeholder:`Condition`}),t[11]=d):d=t[11];let f;t[12]===i?f=t[13]:(f=i&&i.length>0?(0,q.jsx)(Re,{identifiers:i,focusable:!1}):null,t[12]=i,t[13]=f);let p;t[14]===f?p=t[15]:(p=(0,q.jsxs)(k,{size:`compact`,className:`min-w-0 flex-1`,children:[d,f]}),t[14]=f,t[15]=p);let m;t[16]===l?m=t[17]:(m=l.map(Ve),t[16]=l,t[17]=m);let h;t[18]===m?h=t[19]:(h=(0,q.jsx)(O,{alignItemWithTrigger:!1,matchTriggerWidth:!1,className:`max-h-72`,children:m}),t[18]=m,t[19]=h);let g;return t[20]!==u||t[21]!==p||t[22]!==h||t[23]!==n?(g=(0,q.jsxs)(A,{value:n,onValueChange:u,children:[p,h]}),t[20]=u,t[21]=p,t[22]=h,t[23]=n,t[24]=g):g=t[24],g}function Ve(e){return(0,q.jsx)(E,{value:e,className:`w-full`,children:(0,q.jsx)(`span`,{className:`truncate`,children:e})},e)}function He(e){let t=(0,G.c)(14),{label:n,className:r,onRemove:i}=e,a;t[0]===r?a=t[1]:(a=y(`size-7`,r),t[0]=r,t[1]=a);let o;t[2]!==n||t[3]!==i||t[4]!==a?(o=(0,q.jsx)(g,{type:`button`,variant:`ghost`,size:`icon-sm`,className:a,"aria-label":n,onClick:i}),t[2]=n,t[3]=i,t[4]=a,t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,q.jsx)(x,{"aria-hidden":!0,className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]===o?c=t[8]:(c=(0,q.jsx)(R,{delay:200,render:o,children:s}),t[7]=o,t[8]=c);let l;t[9]===n?l=t[10]:(l=(0,q.jsx)(z,{side:`top`,children:n}),t[9]=n,t[10]=l);let u;return t[11]!==c||t[12]!==l?(u=(0,q.jsxs)(B,{children:[c,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function Ue(e){let t=(0,G.c)(81),{node:n,variables:r,depth:i,onChange:a,onRemove:o}=e,s=i===void 0?0:i,c;if(t[0]!==s||t[1]!==n||t[2]!==a||t[3]!==o||t[4]!==r){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Pe(n);if(e){let i=we(e.identifier)?[]:[e.identifier],l;t[6]!==n||t[7]!==a?(l=e=>a(Ie(n,e)),t[6]=n,t[7]=a,t[8]=l):l=t[8];let u=`Negate ${e.identifier}`,d;t[9]!==e||t[10]!==l||t[11]!==u?(d=(0,q.jsx)(te,{pressed:e.negated,onPressedChange:l,"aria-label":u,variant:`outline`,size:`compact`,className:`min-w-10`,children:`Not`}),t[9]=e,t[10]=l,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==n||t[14]!==a?(f=e=>a(Fe(n,e)),t[13]=n,t[14]=a,t[15]=f):f=t[15];let p;t[16]!==e||t[17]!==f||t[18]!==i||t[19]!==r?(p=(0,q.jsx)(Be,{value:e.identifier,variables:r,unknownIdentifiers:i,onChange:f}),t[16]=e,t[17]=f,t[18]=i,t[19]=r,t[20]=p):p=t[20];let m;t[21]!==s||t[22]!==n||t[23]!==o?(m=o?(0,q.jsx)(He,{label:be(n,s),onRemove:o}):null,t[21]=s,t[22]=n,t[23]=o,t[24]=m):m=t[24];let h;t[25]!==d||t[26]!==p||t[27]!==m?(h=(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border/70 bg-background/60 px-2 py-2`,children:[d,p,m]}),t[25]=d,t[26]=p,t[27]=m,t[28]=h):h=t[28],c=h;break bb0}}t[0]=s,t[1]=n,t[2]=a,t[3]=o,t[4]=r,t[5]=c}else c=t[5];if(c!==Symbol.for(`react.early_return_sentinel`))return c;if(n.type===`not`){let e=s>0&&`border-border/50 bg-background/50`,i;t[29]===e?i=t[30]:(i=y(`space-y-2 rounded-lg border border-border/70 bg-muted/20 p-2`,e),t[29]=e,t[30]=i);let c;t[31]!==n||t[32]!==a?(c=(0,q.jsx)(te,{pressed:!0,onPressedChange:e=>a(e?n:n.node),"aria-label":`Negate group`,variant:`outline`,size:`compact`,className:`min-w-10`,children:`Not`}),t[31]=n,t[32]=a,t[33]=c):c=t[33];let l;t[34]!==s||t[35]!==n||t[36]!==o?(l=o?(0,q.jsx)(He,{label:be(n,s),className:`ml-auto`,onRemove:o}):null,t[34]=s,t[35]=n,t[36]=o,t[37]=l):l=t[37];let u;t[38]!==c||t[39]!==l?(u=(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c,l]}),t[38]=c,t[39]=l,t[40]=u):u=t[40];let d,f;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,q.jsx)(`span`,{className:`absolute top-0 bottom-0 left-1.5 w-px bg-border/70`,"aria-hidden":!0}),f=(0,q.jsx)(`span`,{className:`absolute top-4 left-1.5 h-px w-2.5 bg-border/70`,"aria-hidden":!0}),t[41]=d,t[42]=f):(d=t[41],f=t[42]);let p=s+1,m;t[43]===a?m=t[44]:(m=e=>a({type:`not`,node:e}),t[43]=a,t[44]=m);let h;t[45]!==n.node||t[46]!==p||t[47]!==m||t[48]!==r?(h=(0,q.jsxs)(`div`,{className:`relative pl-4`,children:[d,f,(0,q.jsx)(Ue,{node:n.node,variables:r,depth:p,onChange:m})]}),t[45]=n.node,t[46]=p,t[47]=m,t[48]=r,t[49]=h):h=t[49];let g;return t[50]!==h||t[51]!==i||t[52]!==u?(g=(0,q.jsxs)(`div`,{className:i,children:[u,h]}),t[50]=h,t[51]=i,t[52]=u,t[53]=g):g=t[53],g}let u=n.type===`or`?`or`:`and`,d,f,p,m;if(t[54]!==s||t[55]!==n||t[56]!==a||t[57]!==o||t[58]!==u||t[59]!==r){let e=Ne(n,u),i=new Map,c=e.map(e=>{let t=`${e.type}-${U(e)}`,n=i.get(t)??0;return i.set(t,n+1),{child:e,key:n===0?t:`${t}-${n}`}}),h=(t,n)=>{let r=!1,i=J(e.map(e=>!r&&e===t?(r=!0,n):e),u);i&&a(i)},_=t=>{let n=!1,r=J(e.filter(e=>!n&&e===t?(n=!0,!1):!0),u);a(r||Y())},v=t=>{if(t===u)return;let n=J(e,t);n&&a(n)},b=()=>{let t=J([...e,Y()],u);t&&a(t)},x=()=>{let t={type:u===`and`?`or`:`and`,left:Y(),right:{type:`not`,node:Y()}},n=J([...e,t],u);n&&a(n)},S=s>0&&`border-border/70 bg-background/55`;t[64]===S?p=t[65]:(p=y(`space-y-2 rounded-lg border border-border/60 bg-muted/10 p-2`,S),t[64]=S,t[65]=p);let C;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,q.jsx)(k,{size:`compact`,className:`w-24`,children:(0,q.jsx)(D,{})}),t[66]=C):C=t[66];let w;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,q.jsxs)(O,{alignItemWithTrigger:!1,matchTriggerWidth:!1,children:[(0,q.jsx)(E,{value:`and`,children:`and`}),(0,q.jsx)(E,{value:`or`,children:`or`})]}),t[67]=w):w=t[67];let T;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(l,{className:`size-3.5`}),t[68]=T):T=t[68];let j;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,q.jsx)(l,{className:`size-3.5`}),t[69]=j):j=t[69];let M;t[70]!==s||t[71]!==n||t[72]!==o?(M=o?(0,q.jsx)(He,{label:be(n,s),className:`ml-auto`,onRemove:o}):null,t[70]=s,t[71]=n,t[72]=o,t[73]=M):M=t[73],m=(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsxs)(A,{value:u,onValueChange:e=>v(e),children:[C,w]}),(0,q.jsxs)(g,{type:`button`,variant:`outline`,size:`compact`,onClick:b,children:[T,`Condition`]}),(0,q.jsxs)(g,{type:`button`,variant:`outline`,size:`compact`,onClick:x,children:[j,`Group`]}),M]}),d=`space-y-2`,f=c.map(e=>{let{child:t,key:n}=e;return(0,q.jsxs)(`div`,{className:`relative pl-4`,children:[(0,q.jsx)(`span`,{className:y(`absolute top-0 bottom-0 left-1.5 w-px`,s===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,q.jsx)(`span`,{className:y(`absolute top-4 left-1.5 h-px w-2.5`,s===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,q.jsx)(Ue,{node:t,variables:r,depth:s+1,onChange:e=>h(t,e),onRemove:()=>_(t)})]},n)}),t[54]=s,t[55]=n,t[56]=a,t[57]=o,t[58]=u,t[59]=r,t[60]=d,t[61]=f,t[62]=p,t[63]=m}else d=t[60],f=t[61],p=t[62],m=t[63];let h;t[74]!==d||t[75]!==f?(h=(0,q.jsx)(`div`,{className:d,children:f}),t[74]=d,t[75]=f,t[76]=h):h=t[76];let _;return t[77]!==p||t[78]!==m||t[79]!==h?(_=(0,q.jsxs)(`div`,{className:p,children:[m,h]}),t[77]=p,t[78]=m,t[79]=h,t[80]=_):_=t[80],_}function We(e){let t=(0,G.c)(60),{value:n,variables:r,onChange:i,onValidityChange:a}=e,o;t[0]===n?o=t[1]:(o=U(n),t[0]=n,t[1]=o);let[c,u]=(0,K.useState)(o),d;t[2]===c?d=t[3]:(d=W(c),t[2]=c,t[3]=d);let f=d,p=f.ok?null:f.message,m;t[4]!==f.ok||t[5]!==f.value?(m=f.ok?_e(f.value):[],t[4]=f.ok,t[5]=f.value,t[6]=m):m=t[6];let h=m,_;t[7]!==i||t[8]!==a?(_=e=>{u(e);let t=W(e);a?.(t.ok),t.ok&&i(t.value)},t[7]=i,t[8]=a,t[9]=_):_=t[9];let v=_,y;t[10]!==i||t[11]!==a?(y=e=>{u(U(e)),a?.(!0),i(e)},t[10]=i,t[11]=a,t[12]=y):y=t[12];let b=y,x;t[13]!==b||t[14]!==n?(x=()=>{b(n?{type:`and`,left:n,right:Y()}:Y())},t[13]=b,t[14]=n,t[15]=x):x=t[15];let S=x,C;t[16]!==b||t[17]!==n?(C=()=>{let e=Le(`or`);b(n?{type:`and`,left:n,right:e}:e)},t[16]=b,t[17]=n,t[18]=C):C=t[18];let w=C,T;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(`div`,{className:`min-w-0`,children:(0,q.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:`When`})}),t[19]=T):T=t[19];let E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,q.jsx)(l,{className:`size-3.5`}),t[20]=E):E=t[20];let D;t[21]===S?D=t[22]:(D=(0,q.jsxs)(g,{type:`button`,variant:`outline`,size:`compact`,onClick:S,children:[E,`Condition`]}),t[21]=S,t[22]=D);let O;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,q.jsx)(l,{className:`size-3.5`}),t[23]=O):O=t[23];let k;t[24]===w?k=t[25]:(k=(0,q.jsxs)(g,{type:`button`,variant:`outline`,size:`compact`,onClick:w,children:[O,`Group`]}),t[24]=w,t[25]=k);let A;t[26]!==D||t[27]!==k?(A=(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[D,k]})]}),t[26]=D,t[27]=k,t[28]=A):A=t[28];let j;t[29]===v?j=t[30]:(j=e=>v(e.currentTarget.value),t[29]=v,t[30]=j);let M=!!p,N;t[31]!==c||t[32]!==j||t[33]!==M?(N=(0,q.jsx)(se,{value:c,onChange:j,placeholder:`Always`,"aria-invalid":M,"aria-label":`When expression`,size:`compact`,font:`mono`}),t[31]=c,t[32]=j,t[33]=M,t[34]=N):N=t[34];let P;t[35]===h?P=t[36]:(P=h.length>0?(0,q.jsx)(oe,{align:`inline-end`,children:(0,q.jsx)(Re,{identifiers:h})}):null,t[35]=h,t[36]=P);let F;t[37]!==N||t[38]!==P?(F=(0,q.jsxs)(ce,{children:[N,P]}),t[37]=N,t[38]=P,t[39]=F):F=t[39];let ee;t[40]===p?ee=t[41]:(ee=p?(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-2xs text-destructive`,children:[(0,q.jsx)(s,{className:`size-3.5`}),p]}):null,t[40]=p,t[41]=ee);let I;t[42]!==F||t[43]!==ee?(I=(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[F,ee]}),t[42]=F,t[43]=ee,t[44]=I):I=t[44];let L;t[45]!==S||t[46]!==w||t[47]!==b||t[48]!==n||t[49]!==r?(L=n?(0,q.jsx)(Ue,{node:n,variables:r,onChange:b,onRemove:()=>b(void 0)}):(0,q.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/15 p-3`,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsxs)(g,{type:`button`,size:`compact`,onClick:S,children:[(0,q.jsx)(l,{className:`size-3.5`}),`Condition`]}),(0,q.jsxs)(g,{type:`button`,variant:`outline`,size:`compact`,onClick:w,children:[(0,q.jsx)(l,{className:`size-3.5`}),`Group`]})]})}),t[45]=S,t[46]=w,t[47]=b,t[48]=n,t[49]=r,t[50]=L):L=t[50];let R;t[51]===p?R=t[52]:(R=p?(0,q.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center rounded-lg border border-destructive/30 bg-background/75 p-4 text-center text-xs text-destructive backdrop-blur-xs`,children:`Fix the expression above to continue editing visually.`}):null,t[51]=p,t[52]=R);let z;t[53]!==L||t[54]!==R?(z=(0,q.jsxs)(`div`,{className:`relative`,children:[L,R]}),t[53]=L,t[54]=R,t[55]=z):z=t[55];let B;return t[56]!==A||t[57]!==I||t[58]!==z?(B=(0,q.jsxs)(`div`,{className:`w-[min(34rem,calc(100vw-2rem))] space-y-3`,children:[A,I,z]}),t[56]=A,t[57]=I,t[58]=z,t[59]=B):B=t[59],B}function Ge(e){return{keyDraft:e.key,whenDraft:e.binding.whenAst,isRecording:!1,isWhenDraftValid:!0}}function Z(e,t){return{...e,...t}}function Ke(e){return{command:e.command,key:e.key,...e.when.trim().length>0?{when:e.when}:{}}}function Q(e){let t=(0,G.c)(27),{row:n,allRows:r,onSave:i}=e,[a,o]=(0,K.useReducer)(Z,n,Ge),s=(0,K.useRef)(null),{keyDraft:c,whenDraft:l,isRecording:u,isWhenDraftValid:d}=a,f,p,m;t[0]!==r||t[1]!==c||t[2]!==n.id||t[3]!==n.key||t[4]!==n.when||t[5]!==l?(m=U(l),f=c!==n.key||m!==n.when,p=ge(r,{rowId:n.id,key:c,when:m}),t[0]=r,t[1]=c,t[2]=n.id,t[3]=n.key,t[4]=n.when,t[5]=l,t[6]=f,t[7]=p,t[8]=m):(f=t[6],p=t[7],m=t[8]);let h=p,g;t[9]!==c||t[10]!==i||t[11]!==n||t[12]!==m?(g=()=>{i({command:n.command,key:c,when:m.trim().length>0?m:void 0,replace:Ke(n)})},t[9]=c,t[10]=i,t[11]=n,t[12]=m,t[13]=g):g=t[13];let _=g,v;t[14]!==u||t[15]!==n.key?(v=e=>{if(e.key===`Tab`&&!u)return;if(e.preventDefault(),e.key===`Escape`){e.stopPropagation();let t=e.currentTarget;(0,ke.flushSync)(()=>o({keyDraft:n.key,isRecording:!1})),s.current?s.current.focus():t.blur();return}let t=ye(e.nativeEvent,navigator.platform);t&&o({keyDraft:t,isRecording:!1})},t[14]=u,t[15]=n.key,t[16]=v):v=t[16];let y=v,b;return t[17]!==y||t[18]!==h||t[19]!==f||t[20]!==u||t[21]!==d||t[22]!==c||t[23]!==_||t[24]!==l||t[25]!==m?(b={keyDraft:c,whenDraft:l,isRecording:u,isWhenDraftValid:d,whenDraftExpression:m,isDirty:f,conflictLabels:h,setDraft:o,save:_,captureKeybinding:y,pillRef:s},t[17]=y,t[18]=h,t[19]=f,t[20]=u,t[21]=d,t[22]=c,t[23]=_,t[24]=l,t[25]=m,t[26]=b):b=t[26],b}function qe(e){let t=(0,G.c)(20),{row:n,editor:r,isSaving:i,pillClassName:a}=e,{keyDraft:o,isRecording:s,isDirty:c,isWhenDraftValid:l,setDraft:u,save:d,captureKeybinding:f,pillRef:p}=r,m=!s&&o===n.key&&n.key.length>0&&!c,h;t[0]!==c||t[1]!==i||t[2]!==l||t[3]!==o||t[4]!==d?(h=c?(0,q.jsx)(g,{size:`sm`,disabled:i||o.trim().length===0||!l,onClick:d,children:i?`Saving`:`Save`}):null,t[0]=c,t[1]=i,t[2]=l,t[3]=o,t[4]=d,t[5]=h):h=t[5];let _;t[6]!==f||t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==p||t[11]!==n.binding||t[12]!==n.command||t[13]!==n.key||t[14]!==u||t[15]!==m?(_=m?(0,q.jsx)(`button`,{ref:p,type:`button`,onClick:()=>u({isRecording:!0}),"aria-label":`Edit shortcut for ${H(n.command)}: ${ae(n.binding.shortcut)}`,className:y(`inline-flex h-8 cursor-pointer items-center rounded-md border border-transparent px-1.5 sm:h-7 outline-none transition-colors hover:border-border/70 hover:bg-accent focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-inset focus-visible:ring-ring/24`,a),children:(0,q.jsx)(Ae,{value:n.key})}):(0,q.jsx)(ne,{"data-keybinding-capture":``,autoFocus:s,"aria-label":`Keybinding for ${H(n.command)}`,value:s?``:o,placeholder:s?`Press shortcut`:`Unassigned`,size:`sm`,font:`mono`,className:`w-44`,onFocus:()=>u({isRecording:!0}),onBlur:()=>u({isRecording:!1}),onChange:e=>u({keyDraft:e.currentTarget.value}),onKeyDown:f}),t[6]=f,t[7]=s,t[8]=o,t[9]=a,t[10]=p,t[11]=n.binding,t[12]=n.command,t[13]=n.key,t[14]=u,t[15]=m,t[16]=_):_=t[16];let v;return t[17]!==h||t[18]!==_?(v=(0,q.jsxs)(q.Fragment,{children:[h,_]}),t[17]=h,t[18]=_,t[19]=v):v=t[19],v}function Je(e){let t=(0,G.c)(20),{label:n,expression:r,value:i,variables:a,onChange:o,onValidityChange:s}=e,c;t[0]===s?c=t[1]:(c=e=>{e||s(!0)},t[0]=s,t[1]=c);let l=c,u=r?`ghost`:`ghost-muted`,d;t[2]===u?d=t[3]:(d=(0,q.jsx)(g,{variant:u,size:`micro`,className:`min-w-0 shrink`}),t[2]=u,t[3]=d);let f=`Edit when clause for ${n}`,p=r||`Always`,m;t[4]===p?m=t[5]:(m=(0,q.jsx)(`span`,{className:`truncate font-mono`,children:p}),t[4]=p,t[5]=m);let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,q.jsx)(h,{className:`size-3.5 shrink-0 opacity-60`}),t[6]=_):_=t[6];let v;t[7]!==d||t[8]!==f||t[9]!==m?(v=(0,q.jsxs)(ie,{render:d,"aria-label":f,children:[m,_]}),t[7]=d,t[8]=f,t[9]=m,t[10]=v):v=t[10];let y;t[11]!==o||t[12]!==s||t[13]!==i||t[14]!==a?(y=(0,q.jsx)(re,{align:`start`,sideOffset:6,children:(0,q.jsx)(We,{value:i,variables:a,onChange:o,onValidityChange:s})}),t[11]=o,t[12]=s,t[13]=i,t[14]=a,t[15]=y):y=t[15];let b;return t[16]!==l||t[17]!==v||t[18]!==y?(b=(0,q.jsxs)(V,{onOpenChange:l,children:[v,y]}),t[16]=l,t[17]=v,t[18]=y,t[19]=b):b=t[19],b}function Ye(e){let t=(0,G.c)(24),{row:n,isSaving:r,onReset:i,onRemove:a}=e,o=n.source===`Custom`&&n.defaultKey!==null,s=n.source!==`Default`;if(!o&&!s)return null;let c;t[0]===n.command?c=t[1]:(c=H(n.command),t[0]=n.command,t[1]=c);let l=`Actions for ${c}`,f;t[2]!==r||t[3]!==l?(f=(0,q.jsx)(g,{type:`button`,variant:`ghost-muted`,size:`icon-sm`,disabled:r,"aria-label":l}),t[2]=r,t[3]=l,t[4]=f):f=t[4];let m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,q.jsx)(d,{className:`size-3.5`}),t[5]=m):m=t[5];let h;t[6]===f?h=t[7]:(h=(0,q.jsx)(p,{render:f,children:m}),t[6]=f,t[7]=h);let _;t[8]!==o||t[9]!==r||t[10]!==i||t[11]!==n?(_=o?(0,q.jsx)(b,{disabled:r,onClick:()=>i(n),children:`Reset to default`}):null,t[8]=o,t[9]=r,t[10]=i,t[11]=n,t[12]=_):_=t[12];let y;t[13]!==s||t[14]!==r||t[15]!==a||t[16]!==n?(y=s?(0,q.jsx)(b,{variant:`destructive`,disabled:r,onClick:()=>a(n),children:`Remove`}):null,t[13]=s,t[14]=r,t[15]=a,t[16]=n,t[17]=y):y=t[17];let x;t[18]!==_||t[19]!==y?(x=(0,q.jsxs)(v,{align:`end`,children:[_,y]}),t[18]=_,t[19]=y,t[20]=x):x=t[20];let S;return t[21]!==h||t[22]!==x?(S=(0,q.jsxs)(u,{children:[h,x]}),t[21]=h,t[22]=x,t[23]=S):S=t[23],S}function Xe(e){let t=(0,G.c)(2),{source:n}=e;if(n===`Default`)return null;let r;return t[0]===n?r=t[1]:(r=(0,q.jsx)(c,{variant:`outline`,size:`sm`,children:n}),t[0]=n,t[1]=r),r}function $(e){let t=(0,G.c)(13),{row:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,q.jsx)(`span`,{className:`flex items-center gap-2`}),t[0]=r):r=t[0];let i;t[1]===n.command?i=t[2]:(i=H(n.command),t[1]=n.command,t[2]=i);let a;t[3]===n.source?a=t[4]:(a=(0,q.jsx)(Xe,{source:n.source}),t[3]=n.source,t[4]=a);let o;t[5]!==i||t[6]!==a?(o=(0,q.jsxs)(R,{render:r,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7];let s;t[8]===n.command?s=t[9]:(s=(0,q.jsx)(z,{side:`top`,children:n.command}),t[8]=n.command,t[9]=s);let c;return t[10]!==o||t[11]!==s?(c=(0,q.jsxs)(B,{children:[o,s]}),t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function Ze(e){let t=(0,G.c)(13),{row:n,editor:r,variables:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(`span`,{className:`text-xs leading-none text-muted-foreground/70`,children:`When`}),t[0]=a):a=t[0];let o;t[1]===n.command?o=t[2]:(o=H(n.command),t[1]=n.command,t[2]=o);let s,c;t[3]===r?(s=t[4],c=t[5]):(s=e=>r.setDraft({whenDraft:e}),c=e=>r.setDraft({isWhenDraftValid:e}),t[3]=r,t[4]=s,t[5]=c);let l;return t[6]!==r.whenDraft||t[7]!==r.whenDraftExpression||t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==i?(l=(0,q.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[a,(0,q.jsx)(Je,{label:o,expression:r.whenDraftExpression,value:r.whenDraft,variables:i,onChange:s,onValidityChange:c})]}),t[6]=r.whenDraft,t[7]=r.whenDraftExpression,t[8]=o,t[9]=s,t[10]=c,t[11]=i,t[12]=l):l=t[12],l}function Qe(e){let t=(0,G.c)(2),n;return t[0]===e?n=t[1]:(n=(0,q.jsx)(`span`,{className:`flex items-center opacity-0 transition-opacity group-focus-within/row:opacity-100 group-hover/row:opacity-100 has-data-popup-open:opacity-100 pointer-coarse:opacity-100`,children:(0,q.jsx)(Ye,{...e})}),t[0]=e,t[1]=n),n}function $e(e){let t=(0,G.c)(30),{row:n,isSaving:r,anchorId:i,allRows:a,variables:o,onSave:s,onReset:c,onRemove:l}=e,u;t[0]!==a||t[1]!==s||t[2]!==n?(u={row:n,allRows:a,onSave:s},t[0]=a,t[1]=s,t[2]=n,t[3]=u):u=t[3];let d=Q(u),f;t[4]===n?f=t[5]:(f=(0,q.jsx)($,{row:n}),t[4]=n,t[5]=f);let p;t[6]!==d||t[7]!==n||t[8]!==o?(p=(0,q.jsx)(Ze,{row:n,editor:d,variables:o}),t[6]=d,t[7]=n,t[8]=o,t[9]=p):p=t[9];let m;t[10]===d.conflictLabels?m=t[11]:(m=(0,q.jsx)(ze,{labels:d.conflictLabels}),t[10]=d.conflictLabels,t[11]=m);let h;t[12]!==r||t[13]!==l||t[14]!==c||t[15]!==n?(h=(0,q.jsx)(Qe,{row:n,isSaving:r,onReset:c,onRemove:l}),t[12]=r,t[13]=l,t[14]=c,t[15]=n,t[16]=h):h=t[16];let g;t[17]!==d||t[18]!==r||t[19]!==n?(g=(0,q.jsx)(qe,{row:n,editor:d,isSaving:r,pillClassName:`-mr-1.5`}),t[17]=d,t[18]=r,t[19]=n,t[20]=g):g=t[20];let _;t[21]!==m||t[22]!==h||t[23]!==g?(_=(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[m,h,g]}),t[21]=m,t[22]=h,t[23]=g,t[24]=_):_=t[24];let v;return t[25]!==i||t[26]!==f||t[27]!==p||t[28]!==_?(v=(0,q.jsx)(pe,{id:i,className:`group/row rounded-none`,title:f,description:p,control:_}),t[25]=i,t[26]=f,t[27]=p,t[28]=_,t[29]=v):v=t[29],v}function et(e){let t=(0,G.c)(30),{allRows:n,onSave:r}=e,[i,a]=(0,K.useState)(``),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={keyDraft:``,whenDraft:void 0,isRecording:!1,isWhenDraftValid:!0},t[0]=o):o=t[0];let[s,c]=(0,K.useReducer)(Z,o),{keyDraft:l,whenDraft:u,isRecording:d,isWhenDraftValid:f}=s,p,m;t[1]!==n||t[2]!==l||t[3]!==u?(m=U(u),p=ge(n,{rowId:`new`,key:l,when:m}),t[1]=n,t[2]=l,t[3]=u,t[4]=p,t[5]=m):(p=t[4],m=t[5]);let h=p,g;t[6]===i?g=t[7]:(g=i?H(i):`new keybinding`,t[6]=i,t[7]=g);let _=g,v;t[8]!==i||t[9]!==f||t[10]!==l?(v=!!i&&l.trim().length>0&&f,t[8]=i,t[9]=f,t[10]=l,t[11]=v):v=t[11];let y=v,b;t[12]!==i||t[13]!==l||t[14]!==r||t[15]!==m?(b=()=>{i&&r({command:i,key:l,...m.trim().length>0?{when:m}:{}})},t[12]=i,t[13]=l,t[14]=r,t[15]=m,t[16]=b):b=t[16];let x=b,S;t[17]===d?S=t[18]:(S=e=>{if(e.key===`Tab`&&!d)return;if(e.preventDefault(),e.key===`Escape`){e.stopPropagation(),c({keyDraft:``,isRecording:!1}),e.currentTarget.blur();return}let t=ye(e.nativeEvent,navigator.platform);t&&c({keyDraft:t,isRecording:!1})},t[17]=d,t[18]=S);let C=S,w;return t[19]!==y||t[20]!==C||t[21]!==i||t[22]!==_||t[23]!==h||t[24]!==d||t[25]!==l||t[26]!==x||t[27]!==u||t[28]!==m?(w={commandDraft:i,setCommandDraft:a,keyDraft:l,whenDraft:u,whenDraftExpression:m,isRecording:d,conflictLabels:h,commandLabelText:_,canSave:y,setDraft:c,save:x,captureKeybinding:C},t[19]=y,t[20]=C,t[21]=i,t[22]=_,t[23]=h,t[24]=d,t[25]=l,t[26]=x,t[27]=u,t[28]=m,t[29]=w):w=t[29],w}function tt(e){let t=(0,G.c)(14),{draft:n,commandOptions:r,className:i}=e,a=n.commandDraft,o;t[0]===n?o=t[1]:(o=e=>n.setCommandDraft(e),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,q.jsx)(D,{placeholder:`Command`}),t[2]=s):s=t[2];let c;t[3]===i?c=t[4]:(c=(0,q.jsx)(k,{size:`sm`,className:i,children:s}),t[3]=i,t[4]=c);let l;t[5]===r?l=t[6]:(l=r.map(nt),t[5]=r,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,q.jsx)(O,{alignItemWithTrigger:!1,matchTriggerWidth:!1,className:`max-h-72`,children:l}),t[7]=l,t[8]=u);let d;return t[9]!==n.commandDraft||t[10]!==o||t[11]!==c||t[12]!==u?(d=(0,q.jsxs)(A,{value:a,onValueChange:o,children:[c,u]}),t[9]=n.commandDraft,t[10]=o,t[11]=c,t[12]=u,t[13]=d):d=t[13],d}function nt(e){return(0,q.jsx)(E,{value:e,className:`w-full`,children:(0,q.jsx)(`span`,{className:`truncate`,children:H(e)})},e)}function rt(e){let t=(0,G.c)(14),{draft:n,autoFocus:r,className:i}=e,a=r!==void 0&&r,o=`Keybinding for ${n.commandLabelText}`,s=n.isRecording?``:n.keyDraft,c=n.isRecording?`Press shortcut`:`Unassigned`,l,u,d;t[0]===n?(l=t[1],u=t[2],d=t[3]):(l=()=>n.setDraft({isRecording:!0}),u=()=>n.setDraft({isRecording:!1}),d=e=>n.setDraft({keyDraft:e.currentTarget.value}),t[0]=n,t[1]=l,t[2]=u,t[3]=d);let f;return t[4]!==a||t[5]!==i||t[6]!==n.captureKeybinding||t[7]!==o||t[8]!==s||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d?(f=(0,q.jsx)(ne,{"data-keybinding-capture":``,autoFocus:a,"aria-label":o,value:s,placeholder:c,size:`sm`,font:`mono`,className:i,onFocus:l,onBlur:u,onChange:d,onKeyDown:n.captureKeybinding}),t[4]=a,t[5]=i,t[6]=n.captureKeybinding,t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function it(e){let t=(0,G.c)(10),{draft:n,variables:r}=e,i,a;t[0]===n?(i=t[1],a=t[2]):(i=e=>n.setDraft({whenDraft:e}),a=e=>n.setDraft({isWhenDraftValid:e}),t[0]=n,t[1]=i,t[2]=a);let o;return t[3]!==n.commandLabelText||t[4]!==n.whenDraft||t[5]!==n.whenDraftExpression||t[6]!==i||t[7]!==a||t[8]!==r?(o=(0,q.jsx)(Je,{label:n.commandLabelText,expression:n.whenDraftExpression,value:n.whenDraft,variables:r,onChange:i,onValidityChange:a}),t[3]=n.commandLabelText,t[4]=n.whenDraft,t[5]=n.whenDraftExpression,t[6]=i,t[7]=a,t[8]=r,t[9]=o):o=t[9],o}function at(e){let t=(0,G.c)(9),{isSaving:n,onCancel:r}=e,i;t[0]!==n||t[1]!==r?(i=(0,q.jsx)(g,{type:`button`,variant:`ghost-muted`,size:`icon-sm`,disabled:n,"aria-label":`Cancel new keybinding`,onClick:r}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(_,{className:`size-3.5`}),t[3]=a):a=t[3];let o;t[4]===i?o=t[5]:(o=(0,q.jsx)(R,{render:i,children:a}),t[4]=i,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,q.jsx)(z,{side:`top`,children:`Cancel`}),t[6]=s):s=t[6];let c;return t[7]===o?c=t[8]:(c=(0,q.jsxs)(B,{children:[o,s]}),t[7]=o,t[8]=c),c}function ot(e){let t=(0,G.c)(30),{commandOptions:n,allRows:r,variables:i,isSaving:a,onSave:o,onCancel:s}=e,c;t[0]!==r||t[1]!==o?(c={allRows:r,onSave:o},t[0]=r,t[1]=o,t[2]=c):c=t[2];let l=et(c),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.jsx)(`span`,{className:`text-xs leading-none text-muted-foreground/70`,children:`When`}),t[3]=u):u=t[3];let d;t[4]!==l||t[5]!==i?(d=(0,q.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[u,(0,q.jsx)(it,{draft:l,variables:i})]}),t[4]=l,t[5]=i,t[6]=d):d=t[6];let f;t[7]!==n||t[8]!==l?(f=(0,q.jsx)(tt,{draft:l,commandOptions:n,className:`w-56`}),t[7]=n,t[8]=l,t[9]=f):f=t[9];let p;t[10]===l.conflictLabels?p=t[11]:(p=(0,q.jsx)(ze,{labels:l.conflictLabels}),t[10]=l.conflictLabels,t[11]=p);let m;t[12]===l?m=t[13]:(m=(0,q.jsx)(rt,{draft:l,className:`w-44`}),t[12]=l,t[13]=m);let h=a||!l.canSave,_=a?`Saving`:`Save`,v;t[14]!==l.save||t[15]!==h||t[16]!==_?(v=(0,q.jsx)(g,{size:`sm`,disabled:h,onClick:l.save,children:_}),t[14]=l.save,t[15]=h,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==s?(y=(0,q.jsx)(at,{isSaving:a,onCancel:s}),t[18]=a,t[19]=s,t[20]=y):y=t[20];let b;t[21]!==f||t[22]!==p||t[23]!==m||t[24]!==v||t[25]!==y?(b=(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[f,p,m,v,y]}),t[21]=f,t[22]=p,t[23]=m,t[24]=v,t[25]=y,t[26]=b):b=t[26];let x;return t[27]!==b||t[28]!==d?(x=(0,q.jsx)(pe,{className:`bg-muted/15`,title:`New keybinding`,description:d,control:b}),t[27]=b,t[28]=d,t[29]=x):x=t[29],x}function st(e){let{groups:t,anchorIds:n,savingCommand:r,...i}=e;return t.map(e=>(0,q.jsx)(he,{id:`keybindings-${e.id}`,title:e.title,children:e.rows.map(e=>(0,q.jsx)($e,{row:e,anchorId:n.get(e.id),isSaving:r===e.command,...i},e.id))},e.id))}function ct(){let e=(0,G.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsxs)(B,{children:[(0,q.jsx)(R,{delay:200,render:(0,q.jsx)(g,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":`The browser may claim some shortcuts first. The desktop app receives them all.`,children:(0,q.jsx)(a,{className:`size-3.5 text-warning`})})}),(0,q.jsx)(z,{side:`top`,className:`max-w-72`,children:`The browser may claim some shortcuts first. The desktop app receives them all.`})]}),e[0]=t):t=e[0],t}function lt(){let e=(0,G.c)(83),{environment:t,connectedEnvironments:n}=fe(),r=P(t?.environmentId??null,C),i=ee(n,S),a;e[0]!==n||e[1]!==i?(a=n.length>0&&n.every(e=>i.has(e.environmentId)),e[0]=n,e[1]=i,e[2]=a):a=e[2];let s=a,c=t?.serverConfig?.keybindings,u;e[3]===c?u=e[4]:(u=c??[],e[3]=c,e[4]=u);let d;e[5]===u?d=e[6]:(d=o(u),e[5]=u,e[6]=d);let f=d,p=t?.serverConfig?.keybindingsConfigPath??null,h;e[7]===t?.serverConfig?.availableEditors?h=e[8]:(h=t?.serverConfig?.availableEditors??[],e[7]=t?.serverConfig?.availableEditors,e[8]=h);let _=h,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(v={reportFailure:!1},e[9]=v):v=e[9];let y=I(N.upsertKeybinding,v),b;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(b={reportFailure:!1},e[10]=b):b=e[10];let x=I(N.removeKeybinding,b),E=Ee(t?.environmentId??null,_),[D,O]=(0,K.useState)(``),k=(0,K.useRef)(null),[A,te]=(0,K.useState)(null),[ne,re]=(0,K.useState)(!1),ie;e[11]!==f||e[12]!==D?(ie=Ce(f,D),e[11]=f,e[12]=D,e[13]=ie):ie=e[13];let V=ie,ae;e[14]===V?ae=e[15]:(ae=Se(V),e[14]=V,e[15]=ae);let oe=ae,se;if(e[16]!==V){se=new Map;let t=new Set;for(let e of V)t.has(e.command)||(t.add(e.command),se.set(e.id,De(e.command)));e[16]=V,e[17]=se}else se=e[17];let ce=se,le;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(le={select:mt},e[18]=le):le=e[18];let ue=j(le),[pe,H]=(0,K.useState)(ue);ue!==pe&&(H(ue),ue.startsWith(`keybinding-`)&&O(``));let ge;e[19]===f?ge=e[20]:(ge=xe(f),e[19]=f,e[20]=ge);let _e=ge,ye;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(ye=ve(),e[21]=ye):ye=e[21];let be=ye,U;e[22]!==p||e[23]!==E||e[24]!==t?(U=()=>{p&&t&&F(t.environmentId,`orchestration:operate`)&&(async()=>{let e=await E(p);if(e._tag===`Success`||T(e))return;let t=w(e);M.add({title:`Unable to open keybindings file`,description:t instanceof Error?t.message:`The keybindings file was not opened.`,type:`error`})})()},e[22]=p,e[23]=E,e[24]=t,e[25]=U):U=e[25];let we=U,Te;e[26]!==n||e[27]!==t||e[28]!==y?(Te=e=>{if(!t||!n.every(pt))return;te(e.command);let r={command:e.command,key:e.key.trim(),...e.when?.trim()?{when:e.when.trim()}:{},...e.replace?{replace:e.replace}:{}};(async()=>{let e=await Promise.all(n.map(e=>y({environmentId:e.environmentId,input:r})));te(null);let t=e.find(ft);if(!t)re(!1);else if(!T(t)){let e=w(t);M.add({title:`Unable to save keybinding`,description:e instanceof Error?e.message:`The keybinding was not saved.`,type:`error`})}})()},e[26]=n,e[27]=t,e[28]=y,e[29]=Te):Te=e[29];let W=Te,ke;e[30]!==n||e[31]!==t||e[32]!==x?(ke=e=>{t&&n.every(dt)&&(te(e.command),(async()=>{let t=await Promise.all(n.map(t=>x({environmentId:t.environmentId,input:Ke(e)})));te(null);let r=t.find(ut)??t[0];if(r?._tag===`Failure`&&!T(r)){let e=w(r);M.add({title:`Unable to remove keybinding`,description:e instanceof Error?e.message:`The keybinding was not removed.`,type:`error`})}})())},e[30]=n,e[31]=t,e[32]=x,e[33]=ke):ke=e[33];let Ae=ke,je;e[34]===W?je=e[35]:(je=e=>{e.defaultKey&&W({command:e.command,key:e.defaultKey,when:e.defaultWhen.trim().length>0?e.defaultWhen:void 0,replace:{command:e.command,key:e.key,...e.when.trim().length>0?{when:e.when}:{}}})},e[34]=W,e[35]=je);let Ne=je,J;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>re(!1),e[36]=J):J=e[36];let Pe=J,Fe;e[37]!==Ae||e[38]!==Ne||e[39]!==V||e[40]!==W?(Fe={allRows:V,variables:be,onSave:W,onReset:Ne,onRemove:Ae},e[37]=Ae,e[38]=Ne,e[39]=V,e[40]=W,e[41]=Fe):Fe=e[41];let Ie=Fe,Y,Le;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Y=Oe(`keybindings`),Le=L?null:(0,q.jsx)(ct,{}),e[42]=Y,e[43]=Le):(Y=e[42],Le=e[43]);let X;e[44]===D?X=e[45]:(X=(0,q.jsx)(Me,{query:D,onChange:O,inputRef:k}),e[44]=D,e[45]=X);let Re=ne||!s,ze,Be;e[46]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>re(!0),Be=(0,q.jsx)(l,{"aria-hidden":!0,className:`size-4`}),e[46]=ze,e[47]=Be):(ze=e[46],Be=e[47]);let Ve;e[48]===Re?Ve=e[49]:(Ve=(0,q.jsxs)(g,{type:`button`,variant:`outline`,disabled:Re,onClick:ze,children:[Be,`Add keybinding`]}),e[48]=Re,e[49]=Ve);let He=!p||!r,Ue;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,q.jsx)(m,{"aria-hidden":!0,className:`size-4`}),e[50]=Ue):Ue=e[50];let We;e[51]!==we||e[52]!==He?(We=(0,q.jsx)(R,{render:(0,q.jsx)(g,{type:`button`,variant:`outline`,size:`icon`,disabled:He,onClick:we,"aria-label":`Open keybindings.json`,children:Ue})}),e[51]=we,e[52]=He,e[53]=We):We=e[53];let Ge;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,q.jsx)(z,{side:`top`,children:`Open keybindings.json`}),e[54]=Ge):Ge=e[54];let Z;e[55]===We?Z=e[56]:(Z=(0,q.jsxs)(B,{children:[We,Ge]}),e[55]=We,e[56]=Z);let Q;e[57]!==X||e[58]!==Ve||e[59]!==Z?(Q=(0,q.jsx)(he,{...Y,headerAction:Le,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-3 sm:px-4`,children:[X,Ve,Z]})}),e[57]=X,e[58]=Ve,e[59]=Z,e[60]=Q):Q=e[60];let qe;e[61]!==s||e[62]!==n?(qe=s?null:(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n.length===0?`Connect an environment to change keybindings.`:`This connection can view keybindings but cannot change them.`}),e[61]=s,e[62]=n,e[63]=qe):qe=e[63];let Je=!s,Ye;e[64]!==_e||e[65]!==ne||e[66]!==V||e[67]!==W||e[68]!==A?(Ye=ne?(0,q.jsx)(de,{children:(0,q.jsx)(ot,{commandOptions:_e,allRows:V,variables:be,isSaving:A!==null,onSave:W,onCancel:Pe})}):null,e[64]=_e,e[65]=ne,e[66]=V,e[67]=W,e[68]=A,e[69]=Ye):Ye=e[69];let Xe;e[70]!==ce||e[71]!==oe||e[72]!==Ie||e[73]!==A?(Xe=oe.length>0?(0,q.jsx)(st,{groups:oe,anchorIds:ce,savingCommand:A,...Ie}):(0,q.jsx)(de,{children:(0,q.jsx)(`div`,{className:`px-4 py-12 text-center text-sm text-muted-foreground`,children:`No keybindings match your search.`})}),e[70]=ce,e[71]=oe,e[72]=Ie,e[73]=A,e[74]=Xe):Xe=e[74];let $;e[75]!==Je||e[76]!==Ye||e[77]!==Xe?($=(0,q.jsxs)(`div`,{inert:Je,className:`flex flex-col gap-8`,children:[Ye,Xe]}),e[75]=Je,e[76]=Ye,e[77]=Xe,e[78]=$):$=e[78];let Ze;return e[79]!==Q||e[80]!==qe||e[81]!==$?(Ze=(0,q.jsxs)(me,{children:[Q,qe,$]}),e[79]=Q,e[80]=qe,e[81]=$,e[82]=Ze):Ze=e[82],Ze}function ut(e){return e._tag===`Failure`}function dt(e){return F(e.environmentId,S)}function ft(e){return e._tag===`Failure`}function pt(e){return F(e.environmentId,S)}function mt(e){return e.hash.replace(/^#/,``)}var ht=lt;export{ht as component};
2
- //# sourceMappingURL=settings.keybindings-CBhgDtMa.js.map
1
+ import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Ea as i,Hf as a,Lc as o,Wl as s,Xn as c,Zd as l,Zn as u,au as d,df as f,fr as p,fu as m,kl as h,mr as g,op as _,rr as v,t as y,tr as b,wd as x}from"./utils-BVnIIHXP.js";import{la as S,ra as C}from"./src-DHn7yNZx.js";import{Dr as w,Sr as T}from"./runtime-vb0YwEUc.js";import{a as E,c as D,o as O,s as k,t as A}from"./select-CNcZzYBl.js";import{t as j}from"./useLocation-BXwb7I1F.js";import{a as M}from"./relay-Ceq0htTl.js";import{f as N}from"./server-Bw1ZPPkk.js";import{i as P,n as F,o as ee}from"./session-YEQs2e4k.js";import{t as I}from"./use-atom-command-DkmE-pw9.js";import{t as L}from"./env-BfPir1X4.js";import{a as R,n as z,t as B}from"./tooltip-BhCWnsdW.js";import{t as te}from"./toggle-DumCe7R7.js";import{t as ne}from"./input-yaZxaTds.js";import{i as re,o as ie,t as V}from"./popover-DnYfrQly.js";import{i as ae}from"./keybindings-CrlWqd5q.js";import{n as oe,r as se,t as ce}from"./input-group-B1TOCtDG.js";import{n as le,t as ue}from"./kbd-R7rkirqT.js";import{G as de,V as fe,a as pe,i as me,s as he}from"./settingsLayout-DaKDuaST.js";import{a as H,c as ge,f as _e,i as ve,l as ye,m as be,n as xe,o as Se,p as U,r as Ce,s as we,t as Te,u as W}from"./KeybindingsSettings.logic-oAUXQqts.js";import{Bo as Ee,Ir as De,Lr as Oe}from"./main-43D2LVmx.js";var G=n(),K=e(t(),1),ke=e(i(),1),q=e(r(),1);function Ae(e){let t=(0,G.c)(6),{value:n}=e,r,i;if(t[0]!==n){let e=new Map,a=n.split(`+`).map(t=>{let n=e.get(t)??0;return e.set(t,n+1),{part:t,key:n===0?t:`${t}-${n}`}});r=le,i=a.map(je),t[0]=n,t[1]=r,t[2]=i}else r=t[1],i=t[2];let a;return t[3]!==r||t[4]!==i?(a=(0,q.jsx)(r,{children:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function je(e){let{part:t,key:n}=e;return(0,q.jsx)(ue,{children:t===`mod`?navigator.platform.toLowerCase().includes(`mac`)?`⌘`:`Ctrl`:t===`shift`?`⇧`:t===`alt`?navigator.platform.toLowerCase().includes(`mac`)?`⌥`:`Alt`:t===`ctrl`?`⌃`:t.length===1?t.toUpperCase():t},n)}function Me(e){let t=(0,G.c)(11),{query:n,onChange:r,inputRef:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(oe,{children:(0,q.jsx)(f,{"aria-hidden":!0,className:`size-3.5`})}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=e=>r(e.currentTarget.value),t[1]=r,t[2]=o);let s;t[3]!==r||t[4]!==n?(s=e=>{e.key===`Escape`&&(e.preventDefault(),n.length>0?r(``):e.currentTarget.blur())},t[3]=r,t[4]=n,t[5]=s):s=t[5];let c;return t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==s?(c=(0,q.jsxs)(ce,{className:`min-w-0 basis-full **:[input]:h-9 sm:basis-0 sm:flex-1 sm:**:[input]:h-8`,children:[a,(0,q.jsx)(se,{ref:i,type:`search`,value:n,onChange:o,onKeyDown:s,placeholder:`Search keybindings`,"aria-label":`Search keybindings`,size:`sm`})]}),t[6]=i,t[7]=n,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function Ne(e,t){return e.type===t?[...Ne(e.left,t),...Ne(e.right,t)]:[e]}function J(e,t){let n=e[0];if(n)return e.slice(1).reduce((e,n)=>({type:t,left:e,right:n}),n)}function Pe(e){return e.type===`identifier`?{identifier:e.name,negated:!1}:e.type===`not`&&e.node.type===`identifier`?{identifier:e.node.name,negated:!0}:null}function Fe(e,t){let n=Pe(e);if(!n)return e;let r={type:`identifier`,name:t};return n.negated?{type:`not`,node:r}:r}function Ie(e,t){let n=Pe(e);if(!n)return t?{type:`not`,node:e}:e;let r={type:`identifier`,name:n.identifier};return t?{type:`not`,node:r}:r}function Y(){return{type:`identifier`,name:Te}}function Le(e=`and`){return{type:e,left:Y(),right:{type:`not`,node:Y()}}}function X(e){let t=(0,G.c)(14),{label:n,focusable:r,className:i,children:o}=e,s=r===void 0||r?0:void 0,c;t[0]===i?c=t[1]:(c=y(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-warning outline-none transition-colors hover:bg-warning/10 focus-visible:ring-3 focus-visible:ring-inset focus-visible:ring-warning/25`,i),t[0]=i,t[1]=c);let l;t[2]!==n||t[3]!==s||t[4]!==c?(l=(0,q.jsx)(`span`,{tabIndex:s,"aria-label":n,className:c}),t[2]=n,t[3]=s,t[4]=c,t[5]=l):l=t[5];let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.jsx)(a,{className:`size-3.5`}),t[6]=u):u=t[6];let d;t[7]===l?d=t[8]:(d=(0,q.jsx)(R,{render:l,children:u}),t[7]=l,t[8]=d);let f;t[9]===o?f=t[10]:(f=(0,q.jsx)(z,{side:`top`,children:o}),t[9]=o,t[10]=f);let p;return t[11]!==d||t[12]!==f?(p=(0,q.jsxs)(B,{children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13],p}function Re(e){let t=(0,G.c)(5),{identifiers:n,focusable:r}=e,i=r===void 0||r;if(n.length===0)return null;let a;t[0]===n?a=t[1]:(a=n.length===1?`Unknown condition: ${n[0]}`:`Unknown conditions: ${n.join(`, `)}`,t[0]=n,t[1]=a);let o=a,s;return t[2]!==i||t[3]!==o?(s=(0,q.jsx)(X,{label:o,focusable:i,className:`size-4.5`,children:`P4 Code does not recognize this condition yet. It can still be saved, but it may not match unless the runtime provides it.`}),t[2]=i,t[3]=o,t[4]=s):s=t[4],s}function ze(e){let t=(0,G.c)(4),{labels:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.length===1?`Conflicts with ${n[0]}.`:`Conflicts with ${n.slice(0,3).join(`, `)}${n.length>3?`, and more`:``}.`,t[0]=n,t[1]=r);let i=r,a;return t[2]===i?a=t[3]:(a=(0,q.jsxs)(X,{label:i,children:[i,` The most recent matching binding wins when both conditions can apply.`]}),t[2]=i,t[3]=a),a}function Be(e){let t=(0,G.c)(25),{value:n,variables:r,unknownIdentifiers:i,onChange:a}=e,o;if(t[0]!==n||t[1]!==r){let e;t[3]===n?e=t[4]:(e=e=>e===n,t[3]=n,t[4]=e),o=r.find(e),t[0]=n,t[1]=r,t[2]=o}else o=t[2];let s=o,c;t[5]!==s||t[6]!==n||t[7]!==r?(c=s||r.some(e=>e===n)?r:[n,...r],t[5]=s,t[6]=n,t[7]=r,t[8]=c):c=t[8];let l=c,u;t[9]===a?u=t[10]:(u=e=>e&&a(e),t[9]=a,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,q.jsx)(D,{placeholder:`Condition`}),t[11]=d):d=t[11];let f;t[12]===i?f=t[13]:(f=i&&i.length>0?(0,q.jsx)(Re,{identifiers:i,focusable:!1}):null,t[12]=i,t[13]=f);let p;t[14]===f?p=t[15]:(p=(0,q.jsxs)(k,{size:`compact`,className:`min-w-0 flex-1`,children:[d,f]}),t[14]=f,t[15]=p);let m;t[16]===l?m=t[17]:(m=l.map(Ve),t[16]=l,t[17]=m);let h;t[18]===m?h=t[19]:(h=(0,q.jsx)(O,{alignItemWithTrigger:!1,matchTriggerWidth:!1,className:`max-h-72`,children:m}),t[18]=m,t[19]=h);let g;return t[20]!==u||t[21]!==p||t[22]!==h||t[23]!==n?(g=(0,q.jsxs)(A,{value:n,onValueChange:u,children:[p,h]}),t[20]=u,t[21]=p,t[22]=h,t[23]=n,t[24]=g):g=t[24],g}function Ve(e){return(0,q.jsx)(E,{value:e,className:`w-full`,children:(0,q.jsx)(`span`,{className:`truncate`,children:e})},e)}function He(e){let t=(0,G.c)(14),{label:n,className:r,onRemove:i}=e,a;t[0]===r?a=t[1]:(a=y(`size-7`,r),t[0]=r,t[1]=a);let o;t[2]!==n||t[3]!==i||t[4]!==a?(o=(0,q.jsx)(g,{type:`button`,variant:`ghost`,size:`icon-sm`,className:a,"aria-label":n,onClick:i}),t[2]=n,t[3]=i,t[4]=a,t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,q.jsx)(x,{"aria-hidden":!0,className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]===o?c=t[8]:(c=(0,q.jsx)(R,{delay:200,render:o,children:s}),t[7]=o,t[8]=c);let l;t[9]===n?l=t[10]:(l=(0,q.jsx)(z,{side:`top`,children:n}),t[9]=n,t[10]=l);let u;return t[11]!==c||t[12]!==l?(u=(0,q.jsxs)(B,{children:[c,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function Ue(e){let t=(0,G.c)(81),{node:n,variables:r,depth:i,onChange:a,onRemove:o}=e,s=i===void 0?0:i,c;if(t[0]!==s||t[1]!==n||t[2]!==a||t[3]!==o||t[4]!==r){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Pe(n);if(e){let i=we(e.identifier)?[]:[e.identifier],l;t[6]!==n||t[7]!==a?(l=e=>a(Ie(n,e)),t[6]=n,t[7]=a,t[8]=l):l=t[8];let u=`Negate ${e.identifier}`,d;t[9]!==e||t[10]!==l||t[11]!==u?(d=(0,q.jsx)(te,{pressed:e.negated,onPressedChange:l,"aria-label":u,variant:`outline`,size:`compact`,className:`min-w-10`,children:`Not`}),t[9]=e,t[10]=l,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==n||t[14]!==a?(f=e=>a(Fe(n,e)),t[13]=n,t[14]=a,t[15]=f):f=t[15];let p;t[16]!==e||t[17]!==f||t[18]!==i||t[19]!==r?(p=(0,q.jsx)(Be,{value:e.identifier,variables:r,unknownIdentifiers:i,onChange:f}),t[16]=e,t[17]=f,t[18]=i,t[19]=r,t[20]=p):p=t[20];let m;t[21]!==s||t[22]!==n||t[23]!==o?(m=o?(0,q.jsx)(He,{label:be(n,s),onRemove:o}):null,t[21]=s,t[22]=n,t[23]=o,t[24]=m):m=t[24];let h;t[25]!==d||t[26]!==p||t[27]!==m?(h=(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border/70 bg-background/60 px-2 py-2`,children:[d,p,m]}),t[25]=d,t[26]=p,t[27]=m,t[28]=h):h=t[28],c=h;break bb0}}t[0]=s,t[1]=n,t[2]=a,t[3]=o,t[4]=r,t[5]=c}else c=t[5];if(c!==Symbol.for(`react.early_return_sentinel`))return c;if(n.type===`not`){let e=s>0&&`border-border/50 bg-background/50`,i;t[29]===e?i=t[30]:(i=y(`space-y-2 rounded-lg border border-border/70 bg-muted/20 p-2`,e),t[29]=e,t[30]=i);let c;t[31]!==n||t[32]!==a?(c=(0,q.jsx)(te,{pressed:!0,onPressedChange:e=>a(e?n:n.node),"aria-label":`Negate group`,variant:`outline`,size:`compact`,className:`min-w-10`,children:`Not`}),t[31]=n,t[32]=a,t[33]=c):c=t[33];let l;t[34]!==s||t[35]!==n||t[36]!==o?(l=o?(0,q.jsx)(He,{label:be(n,s),className:`ml-auto`,onRemove:o}):null,t[34]=s,t[35]=n,t[36]=o,t[37]=l):l=t[37];let u;t[38]!==c||t[39]!==l?(u=(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c,l]}),t[38]=c,t[39]=l,t[40]=u):u=t[40];let d,f;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,q.jsx)(`span`,{className:`absolute top-0 bottom-0 left-1.5 w-px bg-border/70`,"aria-hidden":!0}),f=(0,q.jsx)(`span`,{className:`absolute top-4 left-1.5 h-px w-2.5 bg-border/70`,"aria-hidden":!0}),t[41]=d,t[42]=f):(d=t[41],f=t[42]);let p=s+1,m;t[43]===a?m=t[44]:(m=e=>a({type:`not`,node:e}),t[43]=a,t[44]=m);let h;t[45]!==n.node||t[46]!==p||t[47]!==m||t[48]!==r?(h=(0,q.jsxs)(`div`,{className:`relative pl-4`,children:[d,f,(0,q.jsx)(Ue,{node:n.node,variables:r,depth:p,onChange:m})]}),t[45]=n.node,t[46]=p,t[47]=m,t[48]=r,t[49]=h):h=t[49];let g;return t[50]!==h||t[51]!==i||t[52]!==u?(g=(0,q.jsxs)(`div`,{className:i,children:[u,h]}),t[50]=h,t[51]=i,t[52]=u,t[53]=g):g=t[53],g}let u=n.type===`or`?`or`:`and`,d,f,p,m;if(t[54]!==s||t[55]!==n||t[56]!==a||t[57]!==o||t[58]!==u||t[59]!==r){let e=Ne(n,u),i=new Map,c=e.map(e=>{let t=`${e.type}-${U(e)}`,n=i.get(t)??0;return i.set(t,n+1),{child:e,key:n===0?t:`${t}-${n}`}}),h=(t,n)=>{let r=!1,i=J(e.map(e=>!r&&e===t?(r=!0,n):e),u);i&&a(i)},_=t=>{let n=!1,r=J(e.filter(e=>!n&&e===t?(n=!0,!1):!0),u);a(r||Y())},v=t=>{if(t===u)return;let n=J(e,t);n&&a(n)},b=()=>{let t=J([...e,Y()],u);t&&a(t)},x=()=>{let t={type:u===`and`?`or`:`and`,left:Y(),right:{type:`not`,node:Y()}},n=J([...e,t],u);n&&a(n)},S=s>0&&`border-border/70 bg-background/55`;t[64]===S?p=t[65]:(p=y(`space-y-2 rounded-lg border border-border/60 bg-muted/10 p-2`,S),t[64]=S,t[65]=p);let C;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,q.jsx)(k,{size:`compact`,className:`w-24`,children:(0,q.jsx)(D,{})}),t[66]=C):C=t[66];let w;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,q.jsxs)(O,{alignItemWithTrigger:!1,matchTriggerWidth:!1,children:[(0,q.jsx)(E,{value:`and`,children:`and`}),(0,q.jsx)(E,{value:`or`,children:`or`})]}),t[67]=w):w=t[67];let T;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(l,{className:`size-3.5`}),t[68]=T):T=t[68];let j;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,q.jsx)(l,{className:`size-3.5`}),t[69]=j):j=t[69];let M;t[70]!==s||t[71]!==n||t[72]!==o?(M=o?(0,q.jsx)(He,{label:be(n,s),className:`ml-auto`,onRemove:o}):null,t[70]=s,t[71]=n,t[72]=o,t[73]=M):M=t[73],m=(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsxs)(A,{value:u,onValueChange:e=>v(e),children:[C,w]}),(0,q.jsxs)(g,{type:`button`,variant:`outline`,size:`compact`,onClick:b,children:[T,`Condition`]}),(0,q.jsxs)(g,{type:`button`,variant:`outline`,size:`compact`,onClick:x,children:[j,`Group`]}),M]}),d=`space-y-2`,f=c.map(e=>{let{child:t,key:n}=e;return(0,q.jsxs)(`div`,{className:`relative pl-4`,children:[(0,q.jsx)(`span`,{className:y(`absolute top-0 bottom-0 left-1.5 w-px`,s===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,q.jsx)(`span`,{className:y(`absolute top-4 left-1.5 h-px w-2.5`,s===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,q.jsx)(Ue,{node:t,variables:r,depth:s+1,onChange:e=>h(t,e),onRemove:()=>_(t)})]},n)}),t[54]=s,t[55]=n,t[56]=a,t[57]=o,t[58]=u,t[59]=r,t[60]=d,t[61]=f,t[62]=p,t[63]=m}else d=t[60],f=t[61],p=t[62],m=t[63];let h;t[74]!==d||t[75]!==f?(h=(0,q.jsx)(`div`,{className:d,children:f}),t[74]=d,t[75]=f,t[76]=h):h=t[76];let _;return t[77]!==p||t[78]!==m||t[79]!==h?(_=(0,q.jsxs)(`div`,{className:p,children:[m,h]}),t[77]=p,t[78]=m,t[79]=h,t[80]=_):_=t[80],_}function We(e){let t=(0,G.c)(60),{value:n,variables:r,onChange:i,onValidityChange:a}=e,o;t[0]===n?o=t[1]:(o=U(n),t[0]=n,t[1]=o);let[c,u]=(0,K.useState)(o),d;t[2]===c?d=t[3]:(d=W(c),t[2]=c,t[3]=d);let f=d,p=f.ok?null:f.message,m;t[4]!==f.ok||t[5]!==f.value?(m=f.ok?_e(f.value):[],t[4]=f.ok,t[5]=f.value,t[6]=m):m=t[6];let h=m,_;t[7]!==i||t[8]!==a?(_=e=>{u(e);let t=W(e);a?.(t.ok),t.ok&&i(t.value)},t[7]=i,t[8]=a,t[9]=_):_=t[9];let v=_,y;t[10]!==i||t[11]!==a?(y=e=>{u(U(e)),a?.(!0),i(e)},t[10]=i,t[11]=a,t[12]=y):y=t[12];let b=y,x;t[13]!==b||t[14]!==n?(x=()=>{b(n?{type:`and`,left:n,right:Y()}:Y())},t[13]=b,t[14]=n,t[15]=x):x=t[15];let S=x,C;t[16]!==b||t[17]!==n?(C=()=>{let e=Le(`or`);b(n?{type:`and`,left:n,right:e}:e)},t[16]=b,t[17]=n,t[18]=C):C=t[18];let w=C,T;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(`div`,{className:`min-w-0`,children:(0,q.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:`When`})}),t[19]=T):T=t[19];let E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,q.jsx)(l,{className:`size-3.5`}),t[20]=E):E=t[20];let D;t[21]===S?D=t[22]:(D=(0,q.jsxs)(g,{type:`button`,variant:`outline`,size:`compact`,onClick:S,children:[E,`Condition`]}),t[21]=S,t[22]=D);let O;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,q.jsx)(l,{className:`size-3.5`}),t[23]=O):O=t[23];let k;t[24]===w?k=t[25]:(k=(0,q.jsxs)(g,{type:`button`,variant:`outline`,size:`compact`,onClick:w,children:[O,`Group`]}),t[24]=w,t[25]=k);let A;t[26]!==D||t[27]!==k?(A=(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[D,k]})]}),t[26]=D,t[27]=k,t[28]=A):A=t[28];let j;t[29]===v?j=t[30]:(j=e=>v(e.currentTarget.value),t[29]=v,t[30]=j);let M=!!p,N;t[31]!==c||t[32]!==j||t[33]!==M?(N=(0,q.jsx)(se,{value:c,onChange:j,placeholder:`Always`,"aria-invalid":M,"aria-label":`When expression`,size:`compact`,font:`mono`}),t[31]=c,t[32]=j,t[33]=M,t[34]=N):N=t[34];let P;t[35]===h?P=t[36]:(P=h.length>0?(0,q.jsx)(oe,{align:`inline-end`,children:(0,q.jsx)(Re,{identifiers:h})}):null,t[35]=h,t[36]=P);let F;t[37]!==N||t[38]!==P?(F=(0,q.jsxs)(ce,{children:[N,P]}),t[37]=N,t[38]=P,t[39]=F):F=t[39];let ee;t[40]===p?ee=t[41]:(ee=p?(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-2xs text-destructive`,children:[(0,q.jsx)(s,{className:`size-3.5`}),p]}):null,t[40]=p,t[41]=ee);let I;t[42]!==F||t[43]!==ee?(I=(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[F,ee]}),t[42]=F,t[43]=ee,t[44]=I):I=t[44];let L;t[45]!==S||t[46]!==w||t[47]!==b||t[48]!==n||t[49]!==r?(L=n?(0,q.jsx)(Ue,{node:n,variables:r,onChange:b,onRemove:()=>b(void 0)}):(0,q.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/15 p-3`,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsxs)(g,{type:`button`,size:`compact`,onClick:S,children:[(0,q.jsx)(l,{className:`size-3.5`}),`Condition`]}),(0,q.jsxs)(g,{type:`button`,variant:`outline`,size:`compact`,onClick:w,children:[(0,q.jsx)(l,{className:`size-3.5`}),`Group`]})]})}),t[45]=S,t[46]=w,t[47]=b,t[48]=n,t[49]=r,t[50]=L):L=t[50];let R;t[51]===p?R=t[52]:(R=p?(0,q.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center rounded-lg border border-destructive/30 bg-background/75 p-4 text-center text-xs text-destructive backdrop-blur-xs`,children:`Fix the expression above to continue editing visually.`}):null,t[51]=p,t[52]=R);let z;t[53]!==L||t[54]!==R?(z=(0,q.jsxs)(`div`,{className:`relative`,children:[L,R]}),t[53]=L,t[54]=R,t[55]=z):z=t[55];let B;return t[56]!==A||t[57]!==I||t[58]!==z?(B=(0,q.jsxs)(`div`,{className:`w-[min(34rem,calc(100vw-2rem))] space-y-3`,children:[A,I,z]}),t[56]=A,t[57]=I,t[58]=z,t[59]=B):B=t[59],B}function Ge(e){return{keyDraft:e.key,whenDraft:e.binding.whenAst,isRecording:!1,isWhenDraftValid:!0}}function Z(e,t){return{...e,...t}}function Ke(e){return{command:e.command,key:e.key,...e.when.trim().length>0?{when:e.when}:{}}}function Q(e){let t=(0,G.c)(27),{row:n,allRows:r,onSave:i}=e,[a,o]=(0,K.useReducer)(Z,n,Ge),s=(0,K.useRef)(null),{keyDraft:c,whenDraft:l,isRecording:u,isWhenDraftValid:d}=a,f,p,m;t[0]!==r||t[1]!==c||t[2]!==n.id||t[3]!==n.key||t[4]!==n.when||t[5]!==l?(m=U(l),f=c!==n.key||m!==n.when,p=ge(r,{rowId:n.id,key:c,when:m}),t[0]=r,t[1]=c,t[2]=n.id,t[3]=n.key,t[4]=n.when,t[5]=l,t[6]=f,t[7]=p,t[8]=m):(f=t[6],p=t[7],m=t[8]);let h=p,g;t[9]!==c||t[10]!==i||t[11]!==n||t[12]!==m?(g=()=>{i({command:n.command,key:c,when:m.trim().length>0?m:void 0,replace:Ke(n)})},t[9]=c,t[10]=i,t[11]=n,t[12]=m,t[13]=g):g=t[13];let _=g,v;t[14]!==u||t[15]!==n.key?(v=e=>{if(e.key===`Tab`&&!u)return;if(e.preventDefault(),e.key===`Escape`){e.stopPropagation();let t=e.currentTarget;(0,ke.flushSync)(()=>o({keyDraft:n.key,isRecording:!1})),s.current?s.current.focus():t.blur();return}let t=ye(e.nativeEvent,navigator.platform);t&&o({keyDraft:t,isRecording:!1})},t[14]=u,t[15]=n.key,t[16]=v):v=t[16];let y=v,b;return t[17]!==y||t[18]!==h||t[19]!==f||t[20]!==u||t[21]!==d||t[22]!==c||t[23]!==_||t[24]!==l||t[25]!==m?(b={keyDraft:c,whenDraft:l,isRecording:u,isWhenDraftValid:d,whenDraftExpression:m,isDirty:f,conflictLabels:h,setDraft:o,save:_,captureKeybinding:y,pillRef:s},t[17]=y,t[18]=h,t[19]=f,t[20]=u,t[21]=d,t[22]=c,t[23]=_,t[24]=l,t[25]=m,t[26]=b):b=t[26],b}function qe(e){let t=(0,G.c)(20),{row:n,editor:r,isSaving:i,pillClassName:a}=e,{keyDraft:o,isRecording:s,isDirty:c,isWhenDraftValid:l,setDraft:u,save:d,captureKeybinding:f,pillRef:p}=r,m=!s&&o===n.key&&n.key.length>0&&!c,h;t[0]!==c||t[1]!==i||t[2]!==l||t[3]!==o||t[4]!==d?(h=c?(0,q.jsx)(g,{size:`sm`,disabled:i||o.trim().length===0||!l,onClick:d,children:i?`Saving`:`Save`}):null,t[0]=c,t[1]=i,t[2]=l,t[3]=o,t[4]=d,t[5]=h):h=t[5];let _;t[6]!==f||t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==p||t[11]!==n.binding||t[12]!==n.command||t[13]!==n.key||t[14]!==u||t[15]!==m?(_=m?(0,q.jsx)(`button`,{ref:p,type:`button`,onClick:()=>u({isRecording:!0}),"aria-label":`Edit shortcut for ${H(n.command)}: ${ae(n.binding.shortcut)}`,className:y(`inline-flex h-8 cursor-pointer items-center rounded-md border border-transparent px-1.5 sm:h-7 outline-none transition-colors hover:border-border/70 hover:bg-accent focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-inset focus-visible:ring-ring/24`,a),children:(0,q.jsx)(Ae,{value:n.key})}):(0,q.jsx)(ne,{"data-keybinding-capture":``,autoFocus:s,"aria-label":`Keybinding for ${H(n.command)}`,value:s?``:o,placeholder:s?`Press shortcut`:`Unassigned`,size:`sm`,font:`mono`,className:`w-44`,onFocus:()=>u({isRecording:!0}),onBlur:()=>u({isRecording:!1}),onChange:e=>u({keyDraft:e.currentTarget.value}),onKeyDown:f}),t[6]=f,t[7]=s,t[8]=o,t[9]=a,t[10]=p,t[11]=n.binding,t[12]=n.command,t[13]=n.key,t[14]=u,t[15]=m,t[16]=_):_=t[16];let v;return t[17]!==h||t[18]!==_?(v=(0,q.jsxs)(q.Fragment,{children:[h,_]}),t[17]=h,t[18]=_,t[19]=v):v=t[19],v}function Je(e){let t=(0,G.c)(20),{label:n,expression:r,value:i,variables:a,onChange:o,onValidityChange:s}=e,c;t[0]===s?c=t[1]:(c=e=>{e||s(!0)},t[0]=s,t[1]=c);let l=c,u=r?`ghost`:`ghost-muted`,d;t[2]===u?d=t[3]:(d=(0,q.jsx)(g,{variant:u,size:`micro`,className:`min-w-0 shrink`}),t[2]=u,t[3]=d);let f=`Edit when clause for ${n}`,p=r||`Always`,m;t[4]===p?m=t[5]:(m=(0,q.jsx)(`span`,{className:`truncate font-mono`,children:p}),t[4]=p,t[5]=m);let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,q.jsx)(h,{className:`size-3.5 shrink-0 opacity-60`}),t[6]=_):_=t[6];let v;t[7]!==d||t[8]!==f||t[9]!==m?(v=(0,q.jsxs)(ie,{render:d,"aria-label":f,children:[m,_]}),t[7]=d,t[8]=f,t[9]=m,t[10]=v):v=t[10];let y;t[11]!==o||t[12]!==s||t[13]!==i||t[14]!==a?(y=(0,q.jsx)(re,{align:`start`,sideOffset:6,children:(0,q.jsx)(We,{value:i,variables:a,onChange:o,onValidityChange:s})}),t[11]=o,t[12]=s,t[13]=i,t[14]=a,t[15]=y):y=t[15];let b;return t[16]!==l||t[17]!==v||t[18]!==y?(b=(0,q.jsxs)(V,{onOpenChange:l,children:[v,y]}),t[16]=l,t[17]=v,t[18]=y,t[19]=b):b=t[19],b}function Ye(e){let t=(0,G.c)(24),{row:n,isSaving:r,onReset:i,onRemove:a}=e,o=n.source===`Custom`&&n.defaultKey!==null,s=n.source!==`Default`;if(!o&&!s)return null;let c;t[0]===n.command?c=t[1]:(c=H(n.command),t[0]=n.command,t[1]=c);let l=`Actions for ${c}`,f;t[2]!==r||t[3]!==l?(f=(0,q.jsx)(g,{type:`button`,variant:`ghost-muted`,size:`icon-sm`,disabled:r,"aria-label":l}),t[2]=r,t[3]=l,t[4]=f):f=t[4];let m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,q.jsx)(d,{className:`size-3.5`}),t[5]=m):m=t[5];let h;t[6]===f?h=t[7]:(h=(0,q.jsx)(p,{render:f,children:m}),t[6]=f,t[7]=h);let _;t[8]!==o||t[9]!==r||t[10]!==i||t[11]!==n?(_=o?(0,q.jsx)(b,{disabled:r,onClick:()=>i(n),children:`Reset to default`}):null,t[8]=o,t[9]=r,t[10]=i,t[11]=n,t[12]=_):_=t[12];let y;t[13]!==s||t[14]!==r||t[15]!==a||t[16]!==n?(y=s?(0,q.jsx)(b,{variant:`destructive`,disabled:r,onClick:()=>a(n),children:`Remove`}):null,t[13]=s,t[14]=r,t[15]=a,t[16]=n,t[17]=y):y=t[17];let x;t[18]!==_||t[19]!==y?(x=(0,q.jsxs)(v,{align:`end`,children:[_,y]}),t[18]=_,t[19]=y,t[20]=x):x=t[20];let S;return t[21]!==h||t[22]!==x?(S=(0,q.jsxs)(u,{children:[h,x]}),t[21]=h,t[22]=x,t[23]=S):S=t[23],S}function Xe(e){let t=(0,G.c)(2),{source:n}=e;if(n===`Default`)return null;let r;return t[0]===n?r=t[1]:(r=(0,q.jsx)(c,{variant:`outline`,size:`sm`,children:n}),t[0]=n,t[1]=r),r}function $(e){let t=(0,G.c)(13),{row:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,q.jsx)(`span`,{className:`flex items-center gap-2`}),t[0]=r):r=t[0];let i;t[1]===n.command?i=t[2]:(i=H(n.command),t[1]=n.command,t[2]=i);let a;t[3]===n.source?a=t[4]:(a=(0,q.jsx)(Xe,{source:n.source}),t[3]=n.source,t[4]=a);let o;t[5]!==i||t[6]!==a?(o=(0,q.jsxs)(R,{render:r,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7];let s;t[8]===n.command?s=t[9]:(s=(0,q.jsx)(z,{side:`top`,children:n.command}),t[8]=n.command,t[9]=s);let c;return t[10]!==o||t[11]!==s?(c=(0,q.jsxs)(B,{children:[o,s]}),t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function Ze(e){let t=(0,G.c)(13),{row:n,editor:r,variables:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(`span`,{className:`text-xs leading-none text-muted-foreground/70`,children:`When`}),t[0]=a):a=t[0];let o;t[1]===n.command?o=t[2]:(o=H(n.command),t[1]=n.command,t[2]=o);let s,c;t[3]===r?(s=t[4],c=t[5]):(s=e=>r.setDraft({whenDraft:e}),c=e=>r.setDraft({isWhenDraftValid:e}),t[3]=r,t[4]=s,t[5]=c);let l;return t[6]!==r.whenDraft||t[7]!==r.whenDraftExpression||t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==i?(l=(0,q.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[a,(0,q.jsx)(Je,{label:o,expression:r.whenDraftExpression,value:r.whenDraft,variables:i,onChange:s,onValidityChange:c})]}),t[6]=r.whenDraft,t[7]=r.whenDraftExpression,t[8]=o,t[9]=s,t[10]=c,t[11]=i,t[12]=l):l=t[12],l}function Qe(e){let t=(0,G.c)(2),n;return t[0]===e?n=t[1]:(n=(0,q.jsx)(`span`,{className:`flex items-center opacity-0 transition-opacity group-focus-within/row:opacity-100 group-hover/row:opacity-100 has-data-popup-open:opacity-100 pointer-coarse:opacity-100`,children:(0,q.jsx)(Ye,{...e})}),t[0]=e,t[1]=n),n}function $e(e){let t=(0,G.c)(30),{row:n,isSaving:r,anchorId:i,allRows:a,variables:o,onSave:s,onReset:c,onRemove:l}=e,u;t[0]!==a||t[1]!==s||t[2]!==n?(u={row:n,allRows:a,onSave:s},t[0]=a,t[1]=s,t[2]=n,t[3]=u):u=t[3];let d=Q(u),f;t[4]===n?f=t[5]:(f=(0,q.jsx)($,{row:n}),t[4]=n,t[5]=f);let p;t[6]!==d||t[7]!==n||t[8]!==o?(p=(0,q.jsx)(Ze,{row:n,editor:d,variables:o}),t[6]=d,t[7]=n,t[8]=o,t[9]=p):p=t[9];let m;t[10]===d.conflictLabels?m=t[11]:(m=(0,q.jsx)(ze,{labels:d.conflictLabels}),t[10]=d.conflictLabels,t[11]=m);let h;t[12]!==r||t[13]!==l||t[14]!==c||t[15]!==n?(h=(0,q.jsx)(Qe,{row:n,isSaving:r,onReset:c,onRemove:l}),t[12]=r,t[13]=l,t[14]=c,t[15]=n,t[16]=h):h=t[16];let g;t[17]!==d||t[18]!==r||t[19]!==n?(g=(0,q.jsx)(qe,{row:n,editor:d,isSaving:r,pillClassName:`-mr-1.5`}),t[17]=d,t[18]=r,t[19]=n,t[20]=g):g=t[20];let _;t[21]!==m||t[22]!==h||t[23]!==g?(_=(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[m,h,g]}),t[21]=m,t[22]=h,t[23]=g,t[24]=_):_=t[24];let v;return t[25]!==i||t[26]!==f||t[27]!==p||t[28]!==_?(v=(0,q.jsx)(pe,{id:i,className:`group/row rounded-none`,title:f,description:p,control:_}),t[25]=i,t[26]=f,t[27]=p,t[28]=_,t[29]=v):v=t[29],v}function et(e){let t=(0,G.c)(30),{allRows:n,onSave:r}=e,[i,a]=(0,K.useState)(``),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={keyDraft:``,whenDraft:void 0,isRecording:!1,isWhenDraftValid:!0},t[0]=o):o=t[0];let[s,c]=(0,K.useReducer)(Z,o),{keyDraft:l,whenDraft:u,isRecording:d,isWhenDraftValid:f}=s,p,m;t[1]!==n||t[2]!==l||t[3]!==u?(m=U(u),p=ge(n,{rowId:`new`,key:l,when:m}),t[1]=n,t[2]=l,t[3]=u,t[4]=p,t[5]=m):(p=t[4],m=t[5]);let h=p,g;t[6]===i?g=t[7]:(g=i?H(i):`new keybinding`,t[6]=i,t[7]=g);let _=g,v;t[8]!==i||t[9]!==f||t[10]!==l?(v=!!i&&l.trim().length>0&&f,t[8]=i,t[9]=f,t[10]=l,t[11]=v):v=t[11];let y=v,b;t[12]!==i||t[13]!==l||t[14]!==r||t[15]!==m?(b=()=>{i&&r({command:i,key:l,...m.trim().length>0?{when:m}:{}})},t[12]=i,t[13]=l,t[14]=r,t[15]=m,t[16]=b):b=t[16];let x=b,S;t[17]===d?S=t[18]:(S=e=>{if(e.key===`Tab`&&!d)return;if(e.preventDefault(),e.key===`Escape`){e.stopPropagation(),c({keyDraft:``,isRecording:!1}),e.currentTarget.blur();return}let t=ye(e.nativeEvent,navigator.platform);t&&c({keyDraft:t,isRecording:!1})},t[17]=d,t[18]=S);let C=S,w;return t[19]!==y||t[20]!==C||t[21]!==i||t[22]!==_||t[23]!==h||t[24]!==d||t[25]!==l||t[26]!==x||t[27]!==u||t[28]!==m?(w={commandDraft:i,setCommandDraft:a,keyDraft:l,whenDraft:u,whenDraftExpression:m,isRecording:d,conflictLabels:h,commandLabelText:_,canSave:y,setDraft:c,save:x,captureKeybinding:C},t[19]=y,t[20]=C,t[21]=i,t[22]=_,t[23]=h,t[24]=d,t[25]=l,t[26]=x,t[27]=u,t[28]=m,t[29]=w):w=t[29],w}function tt(e){let t=(0,G.c)(14),{draft:n,commandOptions:r,className:i}=e,a=n.commandDraft,o;t[0]===n?o=t[1]:(o=e=>n.setCommandDraft(e),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,q.jsx)(D,{placeholder:`Command`}),t[2]=s):s=t[2];let c;t[3]===i?c=t[4]:(c=(0,q.jsx)(k,{size:`sm`,className:i,children:s}),t[3]=i,t[4]=c);let l;t[5]===r?l=t[6]:(l=r.map(nt),t[5]=r,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,q.jsx)(O,{alignItemWithTrigger:!1,matchTriggerWidth:!1,className:`max-h-72`,children:l}),t[7]=l,t[8]=u);let d;return t[9]!==n.commandDraft||t[10]!==o||t[11]!==c||t[12]!==u?(d=(0,q.jsxs)(A,{value:a,onValueChange:o,children:[c,u]}),t[9]=n.commandDraft,t[10]=o,t[11]=c,t[12]=u,t[13]=d):d=t[13],d}function nt(e){return(0,q.jsx)(E,{value:e,className:`w-full`,children:(0,q.jsx)(`span`,{className:`truncate`,children:H(e)})},e)}function rt(e){let t=(0,G.c)(14),{draft:n,autoFocus:r,className:i}=e,a=r!==void 0&&r,o=`Keybinding for ${n.commandLabelText}`,s=n.isRecording?``:n.keyDraft,c=n.isRecording?`Press shortcut`:`Unassigned`,l,u,d;t[0]===n?(l=t[1],u=t[2],d=t[3]):(l=()=>n.setDraft({isRecording:!0}),u=()=>n.setDraft({isRecording:!1}),d=e=>n.setDraft({keyDraft:e.currentTarget.value}),t[0]=n,t[1]=l,t[2]=u,t[3]=d);let f;return t[4]!==a||t[5]!==i||t[6]!==n.captureKeybinding||t[7]!==o||t[8]!==s||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d?(f=(0,q.jsx)(ne,{"data-keybinding-capture":``,autoFocus:a,"aria-label":o,value:s,placeholder:c,size:`sm`,font:`mono`,className:i,onFocus:l,onBlur:u,onChange:d,onKeyDown:n.captureKeybinding}),t[4]=a,t[5]=i,t[6]=n.captureKeybinding,t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function it(e){let t=(0,G.c)(10),{draft:n,variables:r}=e,i,a;t[0]===n?(i=t[1],a=t[2]):(i=e=>n.setDraft({whenDraft:e}),a=e=>n.setDraft({isWhenDraftValid:e}),t[0]=n,t[1]=i,t[2]=a);let o;return t[3]!==n.commandLabelText||t[4]!==n.whenDraft||t[5]!==n.whenDraftExpression||t[6]!==i||t[7]!==a||t[8]!==r?(o=(0,q.jsx)(Je,{label:n.commandLabelText,expression:n.whenDraftExpression,value:n.whenDraft,variables:r,onChange:i,onValidityChange:a}),t[3]=n.commandLabelText,t[4]=n.whenDraft,t[5]=n.whenDraftExpression,t[6]=i,t[7]=a,t[8]=r,t[9]=o):o=t[9],o}function at(e){let t=(0,G.c)(9),{isSaving:n,onCancel:r}=e,i;t[0]!==n||t[1]!==r?(i=(0,q.jsx)(g,{type:`button`,variant:`ghost-muted`,size:`icon-sm`,disabled:n,"aria-label":`Cancel new keybinding`,onClick:r}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(_,{className:`size-3.5`}),t[3]=a):a=t[3];let o;t[4]===i?o=t[5]:(o=(0,q.jsx)(R,{render:i,children:a}),t[4]=i,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,q.jsx)(z,{side:`top`,children:`Cancel`}),t[6]=s):s=t[6];let c;return t[7]===o?c=t[8]:(c=(0,q.jsxs)(B,{children:[o,s]}),t[7]=o,t[8]=c),c}function ot(e){let t=(0,G.c)(30),{commandOptions:n,allRows:r,variables:i,isSaving:a,onSave:o,onCancel:s}=e,c;t[0]!==r||t[1]!==o?(c={allRows:r,onSave:o},t[0]=r,t[1]=o,t[2]=c):c=t[2];let l=et(c),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.jsx)(`span`,{className:`text-xs leading-none text-muted-foreground/70`,children:`When`}),t[3]=u):u=t[3];let d;t[4]!==l||t[5]!==i?(d=(0,q.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[u,(0,q.jsx)(it,{draft:l,variables:i})]}),t[4]=l,t[5]=i,t[6]=d):d=t[6];let f;t[7]!==n||t[8]!==l?(f=(0,q.jsx)(tt,{draft:l,commandOptions:n,className:`w-56`}),t[7]=n,t[8]=l,t[9]=f):f=t[9];let p;t[10]===l.conflictLabels?p=t[11]:(p=(0,q.jsx)(ze,{labels:l.conflictLabels}),t[10]=l.conflictLabels,t[11]=p);let m;t[12]===l?m=t[13]:(m=(0,q.jsx)(rt,{draft:l,className:`w-44`}),t[12]=l,t[13]=m);let h=a||!l.canSave,_=a?`Saving`:`Save`,v;t[14]!==l.save||t[15]!==h||t[16]!==_?(v=(0,q.jsx)(g,{size:`sm`,disabled:h,onClick:l.save,children:_}),t[14]=l.save,t[15]=h,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==s?(y=(0,q.jsx)(at,{isSaving:a,onCancel:s}),t[18]=a,t[19]=s,t[20]=y):y=t[20];let b;t[21]!==f||t[22]!==p||t[23]!==m||t[24]!==v||t[25]!==y?(b=(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[f,p,m,v,y]}),t[21]=f,t[22]=p,t[23]=m,t[24]=v,t[25]=y,t[26]=b):b=t[26];let x;return t[27]!==b||t[28]!==d?(x=(0,q.jsx)(pe,{className:`bg-muted/15`,title:`New keybinding`,description:d,control:b}),t[27]=b,t[28]=d,t[29]=x):x=t[29],x}function st(e){let{groups:t,anchorIds:n,savingCommand:r,...i}=e;return t.map(e=>(0,q.jsx)(he,{id:`keybindings-${e.id}`,title:e.title,children:e.rows.map(e=>(0,q.jsx)($e,{row:e,anchorId:n.get(e.id),isSaving:r===e.command,...i},e.id))},e.id))}function ct(){let e=(0,G.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsxs)(B,{children:[(0,q.jsx)(R,{delay:200,render:(0,q.jsx)(g,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":`The browser may claim some shortcuts first. The desktop app receives them all.`,children:(0,q.jsx)(a,{className:`size-3.5 text-warning`})})}),(0,q.jsx)(z,{side:`top`,className:`max-w-72`,children:`The browser may claim some shortcuts first. The desktop app receives them all.`})]}),e[0]=t):t=e[0],t}function lt(){let e=(0,G.c)(83),{environment:t,connectedEnvironments:n}=fe(),r=P(t?.environmentId??null,C),i=ee(n,S),a;e[0]!==n||e[1]!==i?(a=n.length>0&&n.every(e=>i.has(e.environmentId)),e[0]=n,e[1]=i,e[2]=a):a=e[2];let s=a,c=t?.serverConfig?.keybindings,u;e[3]===c?u=e[4]:(u=c??[],e[3]=c,e[4]=u);let d;e[5]===u?d=e[6]:(d=o(u),e[5]=u,e[6]=d);let f=d,p=t?.serverConfig?.keybindingsConfigPath??null,h;e[7]===t?.serverConfig?.availableEditors?h=e[8]:(h=t?.serverConfig?.availableEditors??[],e[7]=t?.serverConfig?.availableEditors,e[8]=h);let _=h,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(v={reportFailure:!1},e[9]=v):v=e[9];let y=I(N.upsertKeybinding,v),b;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(b={reportFailure:!1},e[10]=b):b=e[10];let x=I(N.removeKeybinding,b),E=Ee(t?.environmentId??null,_),[D,O]=(0,K.useState)(``),k=(0,K.useRef)(null),[A,te]=(0,K.useState)(null),[ne,re]=(0,K.useState)(!1),ie;e[11]!==f||e[12]!==D?(ie=Ce(f,D),e[11]=f,e[12]=D,e[13]=ie):ie=e[13];let V=ie,ae;e[14]===V?ae=e[15]:(ae=Se(V),e[14]=V,e[15]=ae);let oe=ae,se;if(e[16]!==V){se=new Map;let t=new Set;for(let e of V)t.has(e.command)||(t.add(e.command),se.set(e.id,De(e.command)));e[16]=V,e[17]=se}else se=e[17];let ce=se,le;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(le={select:mt},e[18]=le):le=e[18];let ue=j(le),[pe,H]=(0,K.useState)(ue);ue!==pe&&(H(ue),ue.startsWith(`keybinding-`)&&O(``));let ge;e[19]===f?ge=e[20]:(ge=xe(f),e[19]=f,e[20]=ge);let _e=ge,ye;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(ye=ve(),e[21]=ye):ye=e[21];let be=ye,U;e[22]!==p||e[23]!==E||e[24]!==t?(U=()=>{p&&t&&F(t.environmentId,`orchestration:operate`)&&(async()=>{let e=await E(p);if(e._tag===`Success`||T(e))return;let t=w(e);M.add({title:`Unable to open keybindings file`,description:t instanceof Error?t.message:`The keybindings file was not opened.`,type:`error`})})()},e[22]=p,e[23]=E,e[24]=t,e[25]=U):U=e[25];let we=U,Te;e[26]!==n||e[27]!==t||e[28]!==y?(Te=e=>{if(!t||!n.every(pt))return;te(e.command);let r={command:e.command,key:e.key.trim(),...e.when?.trim()?{when:e.when.trim()}:{},...e.replace?{replace:e.replace}:{}};(async()=>{let e=await Promise.all(n.map(e=>y({environmentId:e.environmentId,input:r})));te(null);let t=e.find(ft);if(!t)re(!1);else if(!T(t)){let e=w(t);M.add({title:`Unable to save keybinding`,description:e instanceof Error?e.message:`The keybinding was not saved.`,type:`error`})}})()},e[26]=n,e[27]=t,e[28]=y,e[29]=Te):Te=e[29];let W=Te,ke;e[30]!==n||e[31]!==t||e[32]!==x?(ke=e=>{t&&n.every(dt)&&(te(e.command),(async()=>{let t=await Promise.all(n.map(t=>x({environmentId:t.environmentId,input:Ke(e)})));te(null);let r=t.find(ut)??t[0];if(r?._tag===`Failure`&&!T(r)){let e=w(r);M.add({title:`Unable to remove keybinding`,description:e instanceof Error?e.message:`The keybinding was not removed.`,type:`error`})}})())},e[30]=n,e[31]=t,e[32]=x,e[33]=ke):ke=e[33];let Ae=ke,je;e[34]===W?je=e[35]:(je=e=>{e.defaultKey&&W({command:e.command,key:e.defaultKey,when:e.defaultWhen.trim().length>0?e.defaultWhen:void 0,replace:{command:e.command,key:e.key,...e.when.trim().length>0?{when:e.when}:{}}})},e[34]=W,e[35]=je);let Ne=je,J;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>re(!1),e[36]=J):J=e[36];let Pe=J,Fe;e[37]!==Ae||e[38]!==Ne||e[39]!==V||e[40]!==W?(Fe={allRows:V,variables:be,onSave:W,onReset:Ne,onRemove:Ae},e[37]=Ae,e[38]=Ne,e[39]=V,e[40]=W,e[41]=Fe):Fe=e[41];let Ie=Fe,Y,Le;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Y=Oe(`keybindings`),Le=L?null:(0,q.jsx)(ct,{}),e[42]=Y,e[43]=Le):(Y=e[42],Le=e[43]);let X;e[44]===D?X=e[45]:(X=(0,q.jsx)(Me,{query:D,onChange:O,inputRef:k}),e[44]=D,e[45]=X);let Re=ne||!s,ze,Be;e[46]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>re(!0),Be=(0,q.jsx)(l,{"aria-hidden":!0,className:`size-4`}),e[46]=ze,e[47]=Be):(ze=e[46],Be=e[47]);let Ve;e[48]===Re?Ve=e[49]:(Ve=(0,q.jsxs)(g,{type:`button`,variant:`outline`,disabled:Re,onClick:ze,children:[Be,`Add keybinding`]}),e[48]=Re,e[49]=Ve);let He=!p||!r,Ue;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,q.jsx)(m,{"aria-hidden":!0,className:`size-4`}),e[50]=Ue):Ue=e[50];let We;e[51]!==we||e[52]!==He?(We=(0,q.jsx)(R,{render:(0,q.jsx)(g,{type:`button`,variant:`outline`,size:`icon`,disabled:He,onClick:we,"aria-label":`Open keybindings.json`,children:Ue})}),e[51]=we,e[52]=He,e[53]=We):We=e[53];let Ge;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,q.jsx)(z,{side:`top`,children:`Open keybindings.json`}),e[54]=Ge):Ge=e[54];let Z;e[55]===We?Z=e[56]:(Z=(0,q.jsxs)(B,{children:[We,Ge]}),e[55]=We,e[56]=Z);let Q;e[57]!==X||e[58]!==Ve||e[59]!==Z?(Q=(0,q.jsx)(he,{...Y,headerAction:Le,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-3 sm:px-4`,children:[X,Ve,Z]})}),e[57]=X,e[58]=Ve,e[59]=Z,e[60]=Q):Q=e[60];let qe;e[61]!==s||e[62]!==n?(qe=s?null:(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n.length===0?`Connect an environment to change keybindings.`:`This connection can view keybindings but cannot change them.`}),e[61]=s,e[62]=n,e[63]=qe):qe=e[63];let Je=!s,Ye;e[64]!==_e||e[65]!==ne||e[66]!==V||e[67]!==W||e[68]!==A?(Ye=ne?(0,q.jsx)(de,{children:(0,q.jsx)(ot,{commandOptions:_e,allRows:V,variables:be,isSaving:A!==null,onSave:W,onCancel:Pe})}):null,e[64]=_e,e[65]=ne,e[66]=V,e[67]=W,e[68]=A,e[69]=Ye):Ye=e[69];let Xe;e[70]!==ce||e[71]!==oe||e[72]!==Ie||e[73]!==A?(Xe=oe.length>0?(0,q.jsx)(st,{groups:oe,anchorIds:ce,savingCommand:A,...Ie}):(0,q.jsx)(de,{children:(0,q.jsx)(`div`,{className:`px-4 py-12 text-center text-sm text-muted-foreground`,children:`No keybindings match your search.`})}),e[70]=ce,e[71]=oe,e[72]=Ie,e[73]=A,e[74]=Xe):Xe=e[74];let $;e[75]!==Je||e[76]!==Ye||e[77]!==Xe?($=(0,q.jsxs)(`div`,{inert:Je,className:`flex flex-col gap-8`,children:[Ye,Xe]}),e[75]=Je,e[76]=Ye,e[77]=Xe,e[78]=$):$=e[78];let Ze;return e[79]!==Q||e[80]!==qe||e[81]!==$?(Ze=(0,q.jsxs)(me,{children:[Q,qe,$]}),e[79]=Q,e[80]=qe,e[81]=$,e[82]=Ze):Ze=e[82],Ze}function ut(e){return e._tag===`Failure`}function dt(e){return F(e.environmentId,S)}function ft(e){return e._tag===`Failure`}function pt(e){return F(e.environmentId,S)}function mt(e){return e.hash.replace(/^#/,``)}var ht=lt;export{ht as component};
2
+ //# sourceMappingURL=settings.keybindings-Rdl8b88k.js.map