@p4code/cli 0.8.26 → 0.8.27

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 (218) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/{binCli-DgjAnX7K.mjs → binCli-CPTSeXBG.mjs} +2 -2
  3. package/dist/client/.vite/manifest.json +1322 -1322
  4. package/dist/client/assets/{AuthSurfaceShell-B0GeuqGG.js → AuthSurfaceShell-Io9UMk5e.js} +2 -2
  5. package/dist/client/assets/{ChatGptUsageButton-BsRw7PIG.js → ChatGptUsageButton-C5QxZxAY.js} +2 -2
  6. package/dist/client/assets/{ChatMarkdown-B_7CYt1t.js → ChatMarkdown-n-Pmpt9I.js} +4 -4
  7. package/dist/client/assets/{CodexSetupSection.logic-CAeeNfjx.js → CodexSetupSection.logic-452dIoYg.js} +2 -2
  8. package/dist/client/assets/{CommandBlock-a6FR0Qjq.js → CommandBlock-BI6CIDH1.js} +2 -2
  9. package/dist/client/assets/{ComposerPromptEditor-JiLuF8sa.js → ComposerPromptEditor-3AzcmrcZ.js} +4 -4
  10. package/dist/client/assets/{DevicePanel-BCkjPnRB.js → DevicePanel-CglyhaAG.js} +2 -2
  11. package/dist/client/assets/{DeviceSetup-jQhLCRQB.js → DeviceSetup-Bazjz7NZ.js} +2 -2
  12. package/dist/client/assets/{DiffCommentAnnotation-Ce3fywCz.js → DiffCommentAnnotation-aW33-n8Z.js} +2 -2
  13. package/dist/client/assets/{DiffFileTree-Ch8ghRNl.js → DiffFileTree-BUpgXQ-A.js} +2 -2
  14. package/dist/client/assets/{DiffPanel-BYdDuPJL.js → DiffPanel-C7V9CYKL.js} +2 -2
  15. package/dist/client/assets/{DiffWorkerPoolProvider-CCTRrTde.js → DiffWorkerPoolProvider-DMh_rKAW.js} +2 -2
  16. package/dist/client/assets/{EmbeddedDesign-BasGnrZc.js → EmbeddedDesign-C5OUFTlD.js} +2 -2
  17. package/dist/client/assets/{FileDiff-HO0wYuF-.js → FileDiff-CSn7_lgS.js} +2 -2
  18. package/dist/client/assets/{FilePreviewPanel-BWAkLnOF.js → FilePreviewPanel-3-FZcESN.js} +2 -2
  19. package/dist/client/assets/{FoldedSettingsSection-itwybIpg.js → FoldedSettingsSection-f9BtRG8P.js} +2 -2
  20. package/dist/client/assets/{NoProjectsHero-1ktyCaCR.js → NoProjectsHero-BvLl09sT.js} +2 -2
  21. package/dist/client/assets/{P4ConnectAccountPages-C8kjCH2i.js → P4ConnectAccountPages-55eXXvOR.js} +2 -2
  22. package/dist/client/assets/{P4ConnectSidebarSignIn-De0TqOBv.js → P4ConnectSidebarSignIn-CJxHyKxw.js} +2 -2
  23. package/dist/client/assets/{PanelLayoutControls-CRn29ViL.js → PanelLayoutControls-BVds3zWp.js} +4 -4
  24. package/dist/client/assets/{PierreEntryIcon-DZSPzXnW.js → PierreEntryIcon-BfQvfMe4.js} +2 -2
  25. package/dist/client/assets/{PreviewPanel-CPU0sstq.js → PreviewPanel-Cj2fiJWr.js} +2 -2
  26. package/dist/client/assets/{ProjectDefaultsSettings-Ibem_Z4L.js → ProjectDefaultsSettings-CD7_iiCV.js} +2 -2
  27. package/dist/client/assets/{ProjectFavicon-CE_urBAW.js → ProjectFavicon-DZ3q6Z0H.js} +3 -3
  28. package/dist/client/assets/{ProjectIconPickerDialog-D0OZSLq9.js → ProjectIconPickerDialog-BHl4mXHB.js} +2 -2
  29. package/dist/client/assets/{ProviderAuthTerminal-Ddl4fv02.js → ProviderAuthTerminal-CFc0xySv.js} +2 -2
  30. package/dist/client/assets/{ProviderModelPicker-BTTJn7iC.js → ProviderModelPicker-C8efuVrz.js} +2 -2
  31. package/dist/client/assets/{ProviderSettingsForm-CGRf8WX5.js → ProviderSettingsForm-DFLuI_nx.js} +2 -2
  32. package/dist/client/assets/{PullRequestCodeTab-CWg3y2Hg.js → PullRequestCodeTab-DRVlxTwy.js} +2 -2
  33. package/dist/client/assets/{ReadOnlySourcePreview-B2RUv5et.js → ReadOnlySourcePreview-Bu2_ZtA-.js} +2 -2
  34. package/dist/client/assets/{RenderErrorBoundary-BE9pu802.js → RenderErrorBoundary-D4jGtlFT.js} +2 -2
  35. package/dist/client/assets/{ScheduledTasksSettings-LlwIif-M.js → ScheduledTasksSettings-C0hXWVvl.js} +2 -2
  36. package/dist/client/assets/{ScopedSwitch-DM7op4tT.js → ScopedSwitch-LBZ02wBh.js} +2 -2
  37. package/dist/client/assets/{SettingsPanels-BJZmVkq6.js → SettingsPanels-DWwikGem.js} +2 -2
  38. package/dist/client/assets/{SettingsPanels.logic-DlcMmTBT.js → SettingsPanels.logic-CZpg8aSK.js} +2 -2
  39. package/dist/client/assets/{SettingsScopeNotice-DvcB28n8.js → SettingsScopeNotice-DjEkL-Ym.js} +2 -2
  40. package/dist/client/assets/{ThemeEditorPanel-Cv_FhYYJ.js → ThemeEditorPanel-DOEkSOth.js} +2 -2
  41. package/dist/client/assets/{ThreadTerminalDrawer-B4Hx5Gtc.js → ThreadTerminalDrawer-BZX00N_c.js} +2 -2
  42. package/dist/client/assets/{Virtualizer-Dka4WQhw.js → Virtualizer-CJW8pEVT.js} +2 -2
  43. package/dist/client/assets/{_chat-71Bl4UTO.js → _chat-Ca7FuMbD.js} +5 -5
  44. package/dist/client/assets/{_chat.design-L-wLlTQh.js → _chat.design-CDj4DPmx.js} +2 -2
  45. package/dist/client/assets/{_chat.index-Cqzn3tFu.js → _chat.index-CpvSvFZH.js} +2 -2
  46. package/dist/client/assets/{_chat.new-CmqMNN1q.js → _chat.new-3bIU60mQ.js} +2 -2
  47. package/dist/client/assets/{_chat.pull-requests-Cv4Q6L5c.js → _chat.pull-requests-BTLE24EW.js} +2 -2
  48. package/dist/client/assets/{abnfDiagram-VCTEODGH-DGwfULSN.js → abnfDiagram-VCTEODGH-DS1tb4Dy.js} +2 -2
  49. package/dist/client/assets/architecture-7GRP2DOG-qKmX7534.js +1 -0
  50. package/dist/client/assets/{architectureDiagram-5GKGNRK7-fZiBVATu.js → architectureDiagram-5GKGNRK7-D0zpK53v.js} +2 -2
  51. package/dist/client/assets/{assets-Zca4LKSx.js → assets-BG_JXxWD.js} +2 -2
  52. package/dist/client/assets/{blockDiagram-I7D4REHJ-Cs_imlrU.js → blockDiagram-I7D4REHJ-SL4el5ol.js} +2 -2
  53. package/dist/client/assets/{browserHistoryStore-9YCQpJy9.js → browserHistoryStore-TYW6lOuv.js} +2 -2
  54. package/dist/client/assets/{browserLinkTarget-BnxzanaN.js → browserLinkTarget-BNoJwTBt.js} +2 -2
  55. package/dist/client/assets/{c4Diagram-7LVT6UL2-jxRP5rAE.js → c4Diagram-7LVT6UL2-CWJKC-4H.js} +2 -2
  56. package/dist/client/assets/channel-DI-bXazi.js +2 -0
  57. package/dist/client/assets/{chunk-4HAMMTFA-CD4tA6cX.js → chunk-4HAMMTFA-BPAna-Wv.js} +2 -2
  58. package/dist/client/assets/{chunk-75Z2AOVW-B4sXgwEx.js → chunk-75Z2AOVW-jKPMvGhC.js} +2 -2
  59. package/dist/client/assets/{chunk-DU6HZSFF-DMXcgXT_.js → chunk-DU6HZSFF-DQeySev0.js} +2 -2
  60. package/dist/client/assets/{chunk-F27PBJKO-CGf21cwH.js → chunk-F27PBJKO-jWPdwF7M.js} +2 -2
  61. package/dist/client/assets/{chunk-GMAD6QVW-mPVRZq9Z.js → chunk-GMAD6QVW-DpPhOysA.js} +2 -2
  62. package/dist/client/assets/{chunk-GVQU2GXP-ChBHtvjy.js → chunk-GVQU2GXP-Ci4jKLcc.js} +2 -2
  63. package/dist/client/assets/{chunk-IMKFNOWR-BtgRygmA.js → chunk-IMKFNOWR-D29vnX6w.js} +2 -2
  64. package/dist/client/assets/{chunk-L3NEJ4N5-REmklvQl.js → chunk-L3NEJ4N5-C0YH77t5.js} +2 -2
  65. package/dist/client/assets/{chunk-OSK3NFVY-m-QXUYaT.js → chunk-OSK3NFVY-DfSRnLdf.js} +2 -2
  66. package/dist/client/assets/{chunk-P2QGCYS3-CeefF5cA.js → chunk-P2QGCYS3-Bg2pIwSk.js} +2 -2
  67. package/dist/client/assets/{chunk-POPQ4Y6H-C-_RXsmg.js → chunk-POPQ4Y6H-CctNE5Wx.js} +2 -2
  68. package/dist/client/assets/{chunk-PWAF6VOD-DflyqEaS.js → chunk-PWAF6VOD-C1f1DGpf.js} +2 -2
  69. package/dist/client/assets/{chunk-SHT3W25Y-R_Fg17nt.js → chunk-SHT3W25Y-xnpqecbr.js} +2 -2
  70. package/dist/client/assets/{chunk-SVP7TREG-BTfev3Yx.js → chunk-SVP7TREG-DnMt1uxV.js} +2 -2
  71. package/dist/client/assets/{chunk-TICWLB2K-C7WGvYp1.js → chunk-TICWLB2K-Cu6mah4v.js} +2 -2
  72. package/dist/client/assets/classDiagram-ZZMXUADV-DrD0Oidb.js +2 -0
  73. package/dist/client/assets/classDiagram-v2-VYDZK3BY-DrD0Oidb.js +2 -0
  74. package/dist/client/assets/{composer-logic-De298qJ8.js → composer-logic-ByYUEP0g.js} +2 -2
  75. package/dist/client/assets/{composerDraftUploads-DojMN9dn.js → composerDraftUploads-BPBBqP0N.js} +2 -2
  76. package/dist/client/assets/{connect-agent-Dss1yfYI.js → connect-agent-BHr4rYhL.js} +2 -2
  77. package/dist/client/assets/{connect-DqGJc6Zq.js → connect-rIIk2LpN.js} +2 -2
  78. package/dist/client/assets/{cynefin-OW5HDTMX-DnGTy7Az.js → cynefin-OW5HDTMX-awGYteF9.js} +1 -1
  79. package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-va9nLZtf.js → cynefinDiagram-5FMLGOSQ-N1-lLKT-.js} +2 -2
  80. package/dist/client/assets/{dagre-GXQ25YYZ-D0QXSOGs.js → dagre-GXQ25YYZ-DCPL5qNf.js} +2 -2
  81. package/dist/client/assets/{design-C9BU7qd7.js → design-D9pNp4fS.js} +2 -2
  82. package/dist/client/assets/{device-CtPu58XW.js → device-DvcJXr0e.js} +2 -2
  83. package/dist/client/assets/{diagram-S7CK7UJ4-cEFyiWjL.js → diagram-S7CK7UJ4-DEZdO6ar.js} +2 -2
  84. package/dist/client/assets/{diagram-UQ7AKVKN-CNgu8Xrb.js → diagram-UQ7AKVKN-B2XQyTB4.js} +2 -2
  85. package/dist/client/assets/{diagram-VSXAHHWV-BPPJ-FGp.js → diagram-VSXAHHWV-DldfdFb5.js} +2 -2
  86. package/dist/client/assets/{diagram-VX7I27RA-DmmJR7mF.js → diagram-VX7I27RA-CifXMdiI.js} +2 -2
  87. package/dist/client/assets/{diagram-Z3DM3KII-B2E7hDLy.js → diagram-Z3DM3KII-jXVmEkNO.js} +2 -2
  88. package/dist/client/assets/{diffRendering-Dam20Pyq.js → diffRendering-DxGUmEvq.js} +2 -2
  89. package/dist/client/assets/{dist-BDrj9x6z.js → dist-COvLc5b4.js} +2 -2
  90. package/dist/client/assets/{duoViewer-D-r4O9JA.js → duoViewer-B50bcQwg.js} +2 -2
  91. package/dist/client/assets/{dynamic-Cog_ioOk.js → dynamic-DDCwZvn2.js} +2 -2
  92. package/dist/client/assets/{ebnfDiagram-PWID7BFC-CdqWonW-.js → ebnfDiagram-PWID7BFC-CXxPKnge.js} +2 -2
  93. package/dist/client/assets/{embeddedScripts-twbjTzvu.js → embeddedScripts-Gpq5uvk8.js} +2 -2
  94. package/dist/client/assets/{entities-BhpgabTo.js → entities-CHcmKww2.js} +2 -2
  95. package/dist/client/assets/{erDiagram-RLTQ6QDP-Cj9VHvs2.js → erDiagram-RLTQ6QDP-Bg12tmzC.js} +2 -2
  96. package/dist/client/assets/eventmodeling-NTZA5JFV-DGgBiDNH.js +1 -0
  97. package/dist/client/assets/{fileLinks-CCxqMBvI.js → fileLinks-OMeT3EGv.js} +2 -2
  98. package/dist/client/assets/{fileTreeExpansion-N_KS64dO.js → fileTreeExpansion-DlEbR8A9.js} +2 -2
  99. package/dist/client/assets/flowDiagram-HODETNUW-DvUNziGW.js +1 -0
  100. package/dist/client/assets/{ganttDiagram-EL5Y4UJY--tZCMTKs.js → ganttDiagram-EL5Y4UJY-Cg6B23Gi.js} +2 -2
  101. package/dist/client/assets/{getDiffFileInput-wQ-J_p6Q.js → getDiffFileInput-DU7M1ayK.js} +2 -2
  102. package/dist/client/assets/{gitGraph-4MIJSDKK-Dw_fdYPs.js → gitGraph-4MIJSDKK-DY1yzqnv.js} +1 -1
  103. package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-mCz7mnTd.js → gitGraphDiagram-WWUBYQGX-CuxKBsR7.js} +2 -2
  104. package/dist/client/assets/{guideRunStore-Dk9f0e_S.js → guideRunStore-CtlhC1A4.js} +2 -2
  105. package/dist/client/assets/{index-B0OiR0Ol.js → index-DT3GBOff.js} +3 -3
  106. package/dist/client/assets/{info-A6RAGUB7-Dm2Q2YW8.js → info-A6RAGUB7-FELuhJNt.js} +1 -1
  107. package/dist/client/assets/{infoDiagram-27XIBGKW-CRahhr54.js → infoDiagram-27XIBGKW-Bl4I0Plv.js} +2 -2
  108. package/dist/client/assets/{ishikawaDiagram-5VMMS53U-B8BPPaoL.js → ishikawaDiagram-5VMMS53U-UAMqnpij.js} +2 -2
  109. package/dist/client/assets/{journeyDiagram-3NMN7TZE-CyL0jLPT.js → journeyDiagram-3NMN7TZE-J6lpIBGT.js} +2 -2
  110. package/dist/client/assets/{kanban-definition-UXKFOSKX-cbdied2B.js → kanban-definition-UXKFOSKX-BAmj09Ml.js} +2 -2
  111. package/dist/client/assets/{line-qgzYahVp.js → line-BT7eNXjs.js} +2 -2
  112. package/dist/client/assets/{linkedPrompt-BZnl7hrP.js → linkedPrompt-BVuTIuW9.js} +2 -2
  113. package/dist/client/assets/{main-BgKiw-9f.js → main-CSxSeVCm.js} +7 -7
  114. package/dist/client/assets/main-CcPhKii6.css +2 -0
  115. package/dist/client/assets/{mediaReference-BhzLpYF9.js → mediaReference-4ijjnwgU.js} +2 -2
  116. package/dist/client/assets/{mediaSource-Bk_NKKP2.js → mediaSource-BBXGRYvD.js} +2 -2
  117. package/dist/client/assets/{mermaid-parser.core-Dbb1WTb8.js → mermaid-parser.core-DEiOK0ka.js} +4 -4
  118. package/dist/client/assets/{mermaid.core-Dtz8UzUI.js → mermaid.core-Bx8b2pKm.js} +5 -5
  119. package/dist/client/assets/{mindmap-definition-YA3MSWOX-D7G9MbUQ.js → mindmap-definition-YA3MSWOX-BXyIIcif.js} +2 -2
  120. package/dist/client/assets/{onboarding-CXb4LvSr.js → onboarding-D_AA7mEu.js} +2 -2
  121. package/dist/client/assets/{openFileInPreview-B8KdOFV6.js → openFileInPreview-BX2EPx-W.js} +2 -2
  122. package/dist/client/assets/{p4ProjectFile-BrXxii5J.js → p4ProjectFile-DCsCl5_0.js} +2 -2
  123. package/dist/client/assets/{packet-AYTQ26CC-3JoyTbIn.js → packet-AYTQ26CC-Bqx116EX.js} +1 -1
  124. package/dist/client/assets/{pair-B6bpqsN5.js → pair-B5LOQH2j.js} +2 -2
  125. package/dist/client/assets/{pegDiagram-XKGWAZYB-7VJjFwNR.js → pegDiagram-XKGWAZYB-BsvAGr54.js} +2 -2
  126. package/dist/client/assets/{phoneViewer-DDX1p0cN.js → phoneViewer-BT-wd3b1.js} +2 -2
  127. package/dist/client/assets/{pie-WAS4IAKB-CXeLZCFV.js → pie-WAS4IAKB-evx-Z-FQ.js} +1 -1
  128. package/dist/client/assets/{pieDiagram-E7YTZNPT-BY1P4Uer.js → pieDiagram-E7YTZNPT-CKykWbhU.js} +2 -2
  129. package/dist/client/assets/{pierre-icons-CL-szz98.js → pierre-icons-DpUmwZMv.js} +2 -2
  130. package/dist/client/assets/{preview-HJcGsd2o.js → preview-CgesrIRi.js} +2 -2
  131. package/dist/client/assets/{primary-rJDv25B2.js → primary-D90_IvSw.js} +2 -2
  132. package/dist/client/assets/{primaryCloudLinkState-CzF2gmHs.js → primaryCloudLinkState-BipC1sbg.js} +2 -2
  133. package/dist/client/assets/{projectFilesQueryState-DM9_vSRA.js → projectFilesQueryState-B0Z25WLd.js} +2 -2
  134. package/dist/client/assets/{projectScriptEditor-Pml2NkVE.js → projectScriptEditor-BAAT-cd6.js} +2 -2
  135. package/dist/client/assets/{providerSkills-waACvYAJ.js → providerSkills-WK9rr3PR.js} +2 -2
  136. package/dist/client/assets/{pullRequestDetail.logic-C-5flOlM.js → pullRequestDetail.logic-DU6FbcfP.js} +2 -2
  137. package/dist/client/assets/{pullRequests-Br_9L7m4.js → pullRequests-Cv7P2eIY.js} +2 -2
  138. package/dist/client/assets/{quadrantDiagram-AXDQQJYC-DyZq_mGc.js → quadrantDiagram-AXDQQJYC-DXX_yCol.js} +2 -2
  139. package/dist/client/assets/{queries-CuZx4Gi3.js → queries-CzWn4iT1.js} +2 -2
  140. package/dist/client/assets/{radar-RG4KPBEZ-B21YfCpU.js → radar-RG4KPBEZ-DVDYLdDv.js} +1 -1
  141. package/dist/client/assets/{railroad-74A4TZTK-CaiYAzxA.js → railroad-74A4TZTK-QbHjzV3H.js} +1 -1
  142. package/dist/client/assets/railroad-abnf-HS5TGJTU-cPiNHmv2.js +1 -0
  143. package/dist/client/assets/railroad-ebnf-LZEXJU2U-D_qTHfDb.js +1 -0
  144. package/dist/client/assets/railroad-peg-WCYAUIDC-DzNZR6g5.js +1 -0
  145. package/dist/client/assets/{railroadDiagram-O6MQD6OU-BZ0HuIrV.js → railroadDiagram-O6MQD6OU-iJ7qhNbR.js} +2 -2
  146. package/dist/client/assets/{renderScheduler-xdSjl5z7.js → renderScheduler-BLVmyLhe.js} +2 -2
  147. package/dist/client/assets/{requirementDiagram-BXWQKSXE-C4OJUf9q.js → requirementDiagram-BXWQKSXE-xiWwbUm-.js} +2 -2
  148. package/dist/client/assets/{runtime-mg6KxRIi.js → runtime-D2c--mqA.js} +3 -3
  149. package/dist/client/assets/{runtime-V62Oyi1q.js → runtime-FrzhE_LH.js} +2 -2
  150. package/dist/client/assets/{sankeyDiagram-P5KCCOFB-CDOw9Kul.js → sankeyDiagram-P5KCCOFB-0nRyou7P.js} +2 -2
  151. package/dist/client/assets/{scheduledTasksSettings.logic-CrYg_vYi.js → scheduledTasksSettings.logic-BXS7vhZ-.js} +2 -2
  152. package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-C9BMDi3Q.js → sequenceDiagram-WJ2MYXX4-CC5JdpP4.js} +2 -2
  153. package/dist/client/assets/{server-C8OpoOTL.js → server-DZYI6rhH.js} +2 -2
  154. package/dist/client/assets/{session-BAH17FBJ.js → session-DhEZhn9K.js} +2 -2
  155. package/dist/client/assets/{session-logic-BKiIVDj0.js → session-logic-6vU9tCVO.js} +2 -2
  156. package/dist/client/assets/{settings-BiLwAn9B.js → settings-DHEFuexL.js} +2 -2
  157. package/dist/client/assets/{settings.appearance-DB8azH3Q.js → settings.appearance-5kVeILsJ.js} +2 -2
  158. package/dist/client/assets/settings.archived-jwpZnQSj.js +2 -0
  159. package/dist/client/assets/{settings.computer-use-DpcKtt2q.js → settings.computer-use-B_rhtPVE.js} +2 -2
  160. package/dist/client/assets/{settings.connections-RKFcKfpz.js → settings.connections-B8NEiau5.js} +2 -2
  161. package/dist/client/assets/{settings.data-controls-NjUH57Fr.js → settings.data-controls-B9FYgTyX.js} +2 -2
  162. package/dist/client/assets/{settings.decisions-B-HjeKFr.js → settings.decisions-B2cCo6C4.js} +2 -2
  163. package/dist/client/assets/{settings.designs-DWbfEcuK.js → settings.designs-B-dMaR0b.js} +2 -2
  164. package/dist/client/assets/{settings.diagnostics-DY7e0sc8.js → settings.diagnostics-DtokU1DC.js} +2 -2
  165. package/dist/client/assets/{settings.general-dsLXGi9j.js → settings.general-CEl6ByN_.js} +2 -2
  166. package/dist/client/assets/settings.integrations-B6wNRi_e.js +2 -0
  167. package/dist/client/assets/{settings.keybindings-Bcl4KxN4.js → settings.keybindings-r4Dy4hkg.js} +2 -2
  168. package/dist/client/assets/{settings.open-source-licenses-ZP9ezdc4.js → settings.open-source-licenses-BGGKTeAP.js} +2 -2
  169. package/dist/client/assets/{settings.plugins-JjZ7Ptzj.js → settings.plugins-C6Q3vhFM.js} +2 -2
  170. package/dist/client/assets/{settings.projects-DhhMAw0F.js → settings.projects-DtZL3XlK.js} +3 -3
  171. package/dist/client/assets/{settings.providers-sowFjazx.js → settings.providers-BHl68xr7.js} +3 -3
  172. package/dist/client/assets/{settings.scheduled-tasks-BIfprPPD.js → settings.scheduled-tasks-DTxlZQAV.js} +2 -2
  173. package/dist/client/assets/{settings.snap-shot-B1go--dA.js → settings.snap-shot-CFuPNtXn.js} +2 -2
  174. package/dist/client/assets/{settings.source-control-BL1tH7qk.js → settings.source-control-DzHVHiHN.js} +2 -2
  175. package/dist/client/assets/{settings.storage-Bt_7LmzS.js → settings.storage-Bw_3CvHq.js} +2 -2
  176. package/dist/client/assets/{settingsLayout-DaLF8Hfm.js → settingsLayout-C1Jfxbij.js} +2 -2
  177. package/dist/client/assets/{sidebarProjectGrouping-DQInVNnY.js → sidebarProjectGrouping-CTN-1PEY.js} +2 -2
  178. package/dist/client/assets/{sourceControl-B9T0IPlu.js → sourceControl-Lsyqeoql.js} +2 -2
  179. package/dist/client/assets/{sourceControlClients-BgBu2ayZ.js → sourceControlClients-DQbmIpu5.js} +2 -2
  180. package/dist/client/assets/{stateDiagram-D77RDMKH-B032MgyK.js → stateDiagram-D77RDMKH-m8Y-mxXE.js} +2 -2
  181. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-Co2rfAar.js +2 -0
  182. package/dist/client/assets/{swimlanes-42K2YHIH-Bn6WbS8G.js → swimlanes-42K2YHIH-wRxafkPC.js} +2 -2
  183. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-DgApCEOp.js +9 -0
  184. package/dist/client/assets/{terminalSessions-BjIB3wg1.js → terminalSessions-CYOZNbmk.js} +2 -2
  185. package/dist/client/assets/{timeline-definition-24CTP7MA-RGCq2eyK.js → timeline-definition-24CTP7MA-rIHAblCw.js} +2 -2
  186. package/dist/client/assets/{toast-B2B2ECBW.js → toast-VoruYA6X.js} +2 -2
  187. package/dist/client/assets/{treeView-Q6P3EWNA-CkhQE3UU.js → treeView-Q6P3EWNA-Bcy74tP0.js} +1 -1
  188. package/dist/client/assets/{treemap-WGGIJYW6-DjBfz9t-.js → treemap-WGGIJYW6-CfQsmSnc.js} +1 -1
  189. package/dist/client/assets/{uiStateStore-TZf81BHB.js → uiStateStore-BvYsbiUI.js} +2 -2
  190. package/dist/client/assets/{usage-Dp-M0_Do.js → usage-DKGEF7z4.js} +2 -2
  191. package/dist/client/assets/{use-atom-command-BWLbyoVN.js → use-atom-command-DrwAZaSK.js} +2 -2
  192. package/dist/client/assets/{useHandleNewThread-DLupIP68.js → useHandleNewThread-CX2gg9sv.js} +2 -2
  193. package/dist/client/assets/{useP4ConnectAuthPrompt-C18iYCzm.js → useP4ConnectAuthPrompt-BVHt43id.js} +2 -2
  194. package/dist/client/assets/{usePullRequestActions-CWCz_AQW.js → usePullRequestActions-CKEsy23v.js} +2 -2
  195. package/dist/client/assets/{useScopedModelAvailability-D1MGYLGR.js → useScopedModelAvailability-DxkmmSwB.js} +2 -2
  196. package/dist/client/assets/{useSettings-BEKkRzL1.js → useSettings-u7ZNp27u.js} +2 -2
  197. package/dist/client/assets/{vcsRefInvalidation-Dx_cpFEA.js → vcsRefInvalidation-Cp8DmrdA.js} +2 -2
  198. package/dist/client/assets/{vennDiagram-4TSXK5OY-D0wsDnkf.js → vennDiagram-4TSXK5OY-BYWi9jUi.js} +2 -2
  199. package/dist/client/assets/{wardley-WFR3VGLG-BT7dOBGA.js → wardley-WFR3VGLG-BQv1A50b.js} +1 -1
  200. package/dist/client/assets/{wardleyDiagram-VM6X3IG4-CgbZOhZ-.js → wardleyDiagram-VM6X3IG4-Cp-BLL4g.js} +2 -2
  201. package/dist/client/assets/{welcome-D3Kttsfe.js → welcome-COe2CLyM.js} +2 -2
  202. package/dist/client/assets/{xychartDiagram-S5SC5T6Z-D3RW49u7.js → xychartDiagram-S5SC5T6Z-CNBL0I4g.js} +2 -2
  203. package/dist/client/index.html +1 -1
  204. package/package.json +1 -1
  205. package/dist/client/assets/architecture-7GRP2DOG-BVmWArUl.js +0 -1
  206. package/dist/client/assets/channel-DyV-uKW8.js +0 -2
  207. package/dist/client/assets/classDiagram-ZZMXUADV-B0NhU5d_.js +0 -2
  208. package/dist/client/assets/classDiagram-v2-VYDZK3BY-B0NhU5d_.js +0 -2
  209. package/dist/client/assets/eventmodeling-NTZA5JFV-CkU6Du-F.js +0 -1
  210. package/dist/client/assets/flowDiagram-HODETNUW-BvniDpHa.js +0 -1
  211. package/dist/client/assets/main-Dk22djvP.css +0 -2
  212. package/dist/client/assets/railroad-abnf-HS5TGJTU-ZJmaNeUq.js +0 -1
  213. package/dist/client/assets/railroad-ebnf-LZEXJU2U-C27brj-I.js +0 -1
  214. package/dist/client/assets/railroad-peg-WCYAUIDC-CukzLv2P.js +0 -1
  215. package/dist/client/assets/settings.archived-BgPgmE5p.js +0 -2
  216. package/dist/client/assets/settings.integrations-BLYy6l0O.js +0 -2
  217. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-CEPamUoD.js +0 -2
  218. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-D1eJox12.js +0 -9
@@ -0,0 +1,2 @@
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$n as n,BE as r,Bp as i,Cg as a,HT as o,Jm as s,Kn as c,Mf as l,Mw as u,O_ as d,Qu as f,R_ as p,Tg as m,Xn as h,Yd as g,Yn as _,Yu as v,Zn as y,_g as b,_p as x,bd as S,cr as C,dh as w,fg as T,fh as E,ib as D,l as O,lr as k,mE as A,mp as j,nl as M,pg as N,pp as P,qn as F,rh as I,rr as L,t as R,tl as z,ur as B,wg as ee,xg as te,yg as ne}from"./utils-B0w8dSf5.js";import{W as re}from"./runtime-D2c--mqA.js";import{T as ie}from"./entities-CHcmKww2.js";import{a as V,r as ae,t as oe}from"./number-field-j3MeOhOk.js";import{a as H,c as U,i as se,o as W,r as ce,s as G,t as K}from"./select-CqPGedM1.js";import{t as le}from"./spinner-BkmZz-kc.js";import{i as q}from"./toast-VoruYA6X.js";import{D as ue,E as de,J as fe,c as pe,o as me,r as he,s as J,x as Y}from"./useSettings-u7ZNp27u.js";import{f as ge}from"./server-DZYI6rhH.js";import{i as _e,n as ve}from"./session-DhEZhn9K.js";import{t as ye}from"./use-atom-command-DrwAZaSK.js";import{t as be}from"./env-wK1YYxA8.js";import{a as xe,n as Se,t as Ce}from"./tooltip-CuJiZzK7.js";import{t as we}from"./input-CDBTiBJx.js";import{a as Te,c as Ee,i as De,n as Oe,o as ke,r as Ae,s as je,t as Me}from"./dialog-Bdi4gsq5.js";import{i as Ne,t as Pe}from"./device-DvcJXr0e.js";import{a as Fe,c as Ie,i as Le,n as Re,o as ze,s as Be,t as Ve}from"./DeviceSetup-Bazjz7NZ.js";import{t as He}from"./AnimatedHeight-xpLZZo3s.js";import{i as Ue,n as We}from"./Icons-bbJxtd49.js";import{t as Ge}from"./preview-CgesrIRi.js";import{a as Ke,i as qe,o as Je,t as Ye}from"./popover-N-pn4OqA.js";import{B as Xe,C as Ze,L as Qe,P as $e,a as X,c as et,i as tt,r as nt,s as rt}from"./settingsLayout-C1Jfxbij.js";import{Ar as it,Ca as at,Dr as ot,Fi as st,Hi as ct,Mr as lt,Nr as ut,Or as dt,Pi as ft,jr as pt,kr as mt,pa as ht,tr as gt}from"./main-CSxSeVCm.js";import{t as _t}from"./ProjectDefaultsSettings-CD7_iiCV.js";import{t as vt}from"./draft-input-CmGR2Zc1.js";import{t as yt}from"./ScopedSwitch-LBZ02wBh.js";import{n as bt,r as xt,t as St}from"./usePermissionStatus-DBybaxyT.js";var Z=r(),Q=e(A(),1);function Ct(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(wt).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)(B,{tone:`muted`}),t[2]=f):f=t[2];let p=i?l?`v${l}`:s?`Not installed`:`Version unknown`:o?`Versions unavailable`:`Versions`,m;t[3]!==d||t[4]!==p?(m=(0,Q.jsx)(Je,{"aria-label":d,render:f,children:p}),t[3]=d,t[4]=p,t[5]=m):m=t[5];let h=i?u:`Device tools`,g;t[6]===h?g=t[7]:(g=(0,Q.jsx)(Ke,{children:h}),t[6]=h,t[7]=g);let _;t[8]!==i||t[9]!==u||t[10]!==n?(_=n?(0,Q.jsx)(`div`,{className:`mt-4 divide-y divide-border/50`,children:[[`Device hub`,n.hub],[`Agent device`,n.agent]].filter(e=>{let[t]=e;return!i||t===u}).map(e=>{let[t,n]=e;return(0,Q.jsxs)(`div`,{className:`space-y-2 py-3 first:pt-0 last:pb-0`,children:[i?null:(0,Q.jsx)(`p`,{className:`text-xs font-medium`,children:t}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 text-xs`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Running`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.runningVersion??`Not running`}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Required`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.requiredVersion}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Installed`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono break-words`,children:n.installedVersions.join(`, `)||`None`})]})]},t)})}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Versions have not been checked.`}),t[8]=i,t[9]=u,t[10]=n,t[11]=_):_=t[11];let v=a?`Managed by ${a}. `:``,y;t[12]===v?y=t[13]:(y=(0,Q.jsxs)(`p`,{className:`mt-4 border-t border-border/50 pt-3 text-xs text-muted-foreground`,children:[v,`Tools update automatically on this host when needed.`]}),t[12]=v,t[13]=y);let b;t[14]===o?b=t[15]:(b=o?(0,Q.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-destructive`,children:o}):null,t[14]=o,t[15]=b);let x;t[16]===r?x=t[17]:(x=r?(0,Q.jsx)(`div`,{className:`mt-3`,children:r}):null,t[16]=r,t[17]=x);let S;t[18]!==y||t[19]!==b||t[20]!==x||t[21]!==g||t[22]!==_?(S=(0,Q.jsxs)(qe,{align:`end`,width:`md`,children:[g,_,y,b,x]}),t[18]=y,t[19]=b,t[20]=x,t[21]=g,t[22]=_,t[23]=S):S=t[23];let C;return t[24]!==S||t[25]!==m?(C=(0,Q.jsxs)(Ye,{children:[m,S]}),t[24]=S,t[25]=m,t[26]=C):C=t[26],C}function wt(e,t){return e.localeCompare(t,void 0,{numeric:!0})}var $=e(t(),1);function Tt(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 Et(e){let t=(0,Z.c)(4),{platforms:n}=e,r;t[0]===n?r=t[1]:(r=n.map(Dt),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 Dt(e){return(0,Q.jsxs)(Ce,{children:[(0,Q.jsxs)(xe,{render:(0,Q.jsx)(`span`,{tabIndex:0,className:`inline-flex items-center gap-1`}),children:[e.available?(0,Q.jsx)(S,{className:`size-3`}):(0,Q.jsx)(P,{className:`size-3`}),e.platform===`ios`?`iOS`:`Android`,` `,e.available?`available`:`unavailable`]}),(0,Q.jsx)(Se,{children:e.reason??(e.platform===`ios`?`iOS available`:`Android available`)})]},e.platform)}var Ot=D(p);function kt(e){let{identityFile:t,...n}=e;return Ot({...n,...t?.trim()?{identityFile:t.trim()}:{}})}function At(e){return JSON.stringify([e.target.trim(),e.port,e.identityFile?.trim()||void 0])}async function jt(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 Mt(e){let t=ye(Pe.testHost,{reportFailure:!1}),[n,r]=(0,$.useState)({}),i=(0,$.useRef)(new Set);return{checks:n,testConnection:async n=>{let a=At(n);if(i.current.has(a))return;i.current.add(a),r(e=>({...e,[a]:{}}));let o={};try{return await jt(e,n,async(e,n)=>{if(!ve(e,`settings:write`))throw Error(`This connection cannot test device hosts.`);let r=await t({environmentId:e,input:n});if(r._tag===`Failure`)throw Error(u(r.cause));return r.value},(e,t)=>{o[e]=t,r(n=>({...n,[a]:{...n[a],[e]:t}}))}),o}finally{i.current.delete(a)}}}}function Nt(e){let t=(0,Z.c)(107),{host:n,isNew:r,targets:i,busy:a,onSave:c,onClose:l}=e,[u,d]=(0,$.useState)(n),{checks:f,testConnection:p}=Mt(i),m=f[At(u)],h=Object.values(m??{}).some(Ft),g,_;t[0]===u?(g=t[1],_=t[2]):(g=kt({...u,label:u.label.trim()||u.target}),_=o(g),t[0]=u,t[1]=g,t[2]=_);let v=_,y;t[3]===m?y=t[4]:(y=Object.values(m??{}).filter(Pt),t[3]=m,t[4]=y);let b=y.length,x;t[5]!==a||t[6]!==l?(x=e=>{!e&&!a&&l()},t[5]=a,t[6]=l,t[7]=x):x=t[7];let C=!a,w;t[8]!==a||t[9]!==h||t[10]!==u.label||t[11]!==g||t[12]!==c?(w=(0,Q.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),o(g)&&u.label.trim()&&!a&&!h&&c(g.value)}}),t[8]=a,t[9]=h,t[10]=u.label,t[11]=g,t[12]=c,t[13]=w):w=t[13];let T=r?`Add device host`:`Edit device host`,E;t[14]===T?E=t[15]:(E=(0,Q.jsx)(Ee,{children:T}),t[14]=T,t[15]=E);let D=i.length===1?`Connect from ${i[0]?.label}.`:`Connect from ${i.length} selected environments.`,O;t[16]===D?O=t[17]:(O=(0,Q.jsxs)(Ae,{children:[D,` `,`Hosts on the same machine are skipped.`]}),t[16]=D,t[17]=O);let A;t[18]!==E||t[19]!==O?(A=(0,Q.jsxs)(Te,{children:[E,O]}),t[18]=E,t[19]=O,t[20]=A):A=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)(we,{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)(we,{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 ee=u.identityFile??``,te;t[37]===u?te=t[38]:(te=e=>{let{identityFile:t,...n}=u;d(e.target.value?{...n,identityFile:e.target.value}:n)},t[37]=u,t[38]=te);let ne;t[39]!==a||t[40]!==ee||t[41]!==te?(ne=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[B,(0,Q.jsx)(we,{value:ee,disabled:a,onChange:te,placeholder:`SSH config default`})]}),t[39]=a,t[40]=ee,t[41]=te,t[42]=ne):ne=t[42];let re;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(`span`,{children:`Port`}),t[43]=re):re=t[43];let ie=u.port??``,V;t[44]===u?V=t[45]:(V=e=>{let{port:t,...n}=u;d(e.target.value?{...n,port:Number(e.target.value)}:n)},t[44]=u,t[45]=V);let ae;t[46]!==a||t[47]!==ie||t[48]!==V?(ae=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[re,(0,Q.jsx)(we,{type:`number`,min:1,max:65535,value:ie,disabled:a,onChange:V,placeholder:`Default`})]}),t[46]=a,t[47]=ie,t[48]=V,t[49]=ae):ae=t[49];let oe;t[50]!==ne||t[51]!==ae?(oe=(0,Q.jsxs)(`div`,{className:`mt-3 grid grid-cols-[minmax(0,1fr)_7rem] gap-3`,children:[ne,ae]}),t[50]=ne,t[51]=ae,t[52]=oe):oe=t[52];let H;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Optional. Resolved separately on each environment.`}),t[53]=H):H=t[53];let U;t[54]!==R||t[55]!==oe?(U=(0,Q.jsxs)(`details`,{open:R,className:`text-sm`,children:[z,oe,H]}),t[54]=R,t[55]=oe,t[56]=U):U=t[56];let se=h?`Checking environments…`:m?b?`${b} 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=()=>{o(g)&&p(g.value)},t[59]=g,t[60]=p,t[61]=G):G=t[61];let K;t[62]===h?K=t[63]:(K=h?(0,Q.jsx)(le,{size:`xs`}):null,t[62]=h,t[63]=K);let q;t[64]!==ce||t[65]!==G||t[66]!==K?(q=(0,Q.jsxs)(k,{type:`button`,size:`sm`,variant:`outline`,disabled:ce,onClick:G,children:[K,` Test connection`]}),t[64]=ce,t[65]=G,t[66]=K,t[67]=q):q=t[67];let ue;t[68]!==W||t[69]!==q?(ue=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-2.5`,children:[W,q]}),t[68]=W,t[69]=q,t[70]=ue):ue=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)(le,{size:`xs`}),` Checking…`]}):t.status===`local`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(j,{className:`size-3`}),` Already available locally`]}):t.status===`failed`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(s,{className:`size-3`}),` Failed`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(S,{className:`size-3`}),` Connected`]})})]}),t.status===`connected`?(0,Q.jsx)(`div`,{className:`mt-1.5`,children:(0,Q.jsx)(Et,{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]!==ue||t[75]!==de?(fe=(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/60`,children:[ue,de]}),t[74]=ue,t[75]=de,t[76]=fe):fe=t[76];let pe;t[77]!==P||t[78]!==L||t[79]!==U||t[80]!==fe?(pe=(0,Q.jsxs)(ke,{children:[P,L,U,fe]}),t[77]=P,t[78]=L,t[79]=U,t[80]=fe,t[81]=pe):pe=t[81];let me;t[82]!==a||t[83]!==l?(me=(0,Q.jsx)(k,{type:`button`,variant:`ghost`,disabled:a,onClick:l,children:`Cancel`}),t[82]=a,t[83]=l,t[84]=me):me=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 J;t[90]===a?J=t[91]:(J=a?(0,Q.jsx)(le,{size:`xs`}):null,t[90]=a,t[91]=J);let Y;t[92]!==he||t[93]!==J?(Y=(0,Q.jsxs)(k,{type:`submit`,disabled:he,children:[J,` Save host`]}),t[92]=he,t[93]=J,t[94]=Y):Y=t[94];let ge;t[95]!==me||t[96]!==Y?(ge=(0,Q.jsxs)(De,{children:[me,Y]}),t[95]=me,t[96]=Y,t[97]=ge):ge=t[97];let _e;t[98]!==A||t[99]!==pe||t[100]!==C||t[101]!==ge||t[102]!==w?(_e=(0,Q.jsxs)(je,{showCloseButton:C,render:w,children:[A,pe,ge]}),t[98]=A,t[99]=pe,t[100]=C,t[101]=ge,t[102]=w,t[103]=_e):_e=t[103];let ve;return t[104]!==x||t[105]!==_e?(ve=(0,Q.jsx)(Me,{open:!0,onOpenChange:x,children:_e}),t[104]=x,t[105]=_e,t[106]=ve):ve=t[106],ve}function Pt(e){return e.status===`failed`}function Ft(e){return e.status===`pending`}function It(e){let{scope:t,environments:n,connectedEnvironments:r}=Xe(),a=_e(e.environmentId,d),o=t.kind===`project`||t.kind===`checkout`,s=ye(ge.updateSettings,{reportFailure:!1}),[c,l]=(0,$.useState)(null),[u,f]=(0,$.useState)(null),[p,m]=(0,$.useState)(!1),h=n.map(e=>({environmentId:e.environmentId,label:e.label,connected:e.connection.phase===`connected`})),{checks:g,testConnection:_}=Mt(h),v=async(t,r=!1,i=t)=>{if(e.environmentId&&!o){m(!0);try{let e=await Promise.allSettled(n.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!ve(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return s({environmentId:e.environmentId,input:{patch:{deviceHosts:Tt(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?l(null):q.add({type:`error`,title:`Device hosts not saved on all environments`,description:`Could not update ${a.map(e=>e.label).join(`, `)}.`})}finally{m(!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)(k,{size:`sm`,variant:`outline`,disabled:!a||o||p||!e.environmentId||c!==null,onClick:()=>{f(null),l({id:O(),label:``,target:``})},children:[(0,Q.jsx)(i,{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)(Lt,{environmentLabel:e.label,environmentId:e.environmentId,hosts:e.serverConfig?.settings.deviceHosts??[],busy:!a||o||p,checks:g,testConnection:async e=>{let t=await _(e);if(!t)return;let n=h.filter(e=>t[e.environmentId]?.status===`failed`);return q.add({type:n.length?`error`:`success`,title:n.length?`${e.label}: ${n.length} of ${h.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=>{f(e),l(e)},onRemove:e=>void v(e,!0)})]},e.environmentId)),c?(0,Q.jsx)(Nt,{host:c,isNew:u===null,targets:h,busy:p,onSave:e=>void v(e,!1,u??e),onClose:()=>l(null)},c.id):null]}):(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect a selected environment to manage device hosts.`})})})}function Lt(e){let t=(0,Z.c)(28),{environmentLabel:r,environmentId:i,hosts:a,busy:o,onEdit:s,onRemove:c,checks:l,testConnection:u}=e,{state:d}=Ne(i),f=ye(Pe.list),[p,m]=(0,$.useState)(null),h;t[0]===a.length?h=t[1]:(h=a.length===0?(0,Q.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`No device hosts.`}):null,t[0]=a.length,t[1]=h);let g;if(t[2]!==o||t[3]!==l||t[4]!==i||t[5]!==r||t[6]!==a||t[7]!==s||t[8]!==c||t[9]!==f||t[10]!==p||t[11]!==d||t[12]!==u){let e;t[14]!==o||t[15]!==l||t[16]!==i||t[17]!==r||t[18]!==s||t[19]!==c||t[20]!==f||t[21]!==p||t[22]!==d||t[23]!==u?(e=e=>{let t=d.hostStatuses[e.id],a=l[At(e)]?.[i],h=(a?.status===`connected`?a.platforms:void 0)??d.hosts.find(t=>t.id===e.id)?.platforms??[],g=a?.status===`pending`?`Checking connection…`:t?.status===`installing`?`Installing device support…`:t?.status===`starting`?`Connecting…`:null,_=a?.status===`failed`?a.error:a?.status===`local`?void 0:t?.status===`failed`?t.detail:void 0;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/50 py-2.5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.label}),h.filter(zt).map(Rt)]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.target}),(0,Q.jsx)(Ct,{owner:r,error:d.hosts.find(t=>t.id===e.id)?.toolInspectionError,tools:d.hosts.find(t=>t.id===e.id)?.tools??(a?.status===`connected`?a.tools:void 0)}),a?.status===`local`?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Already available locally`}):null,_?(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:_})]})}):null]}),g?(0,Q.jsxs)(`span`,{role:`status`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(le,{size:`xs`}),g]}):null,(0,Q.jsxs)(F,{children:[(0,Q.jsx)(C,{render:(0,Q.jsx)(k,{size:`icon-sm`,variant:`ghost-muted`,disabled:o,"aria-label":e.label+` options`}),children:(0,Q.jsx)(x,{})}),(0,Q.jsxs)(n,{align:`end`,children:[(0,Q.jsx)(y,{onClick:()=>{s(e)},children:`Edit`}),(0,Q.jsx)(y,{variant:`destructive`,onClick:()=>c(e),children:`Remove`})]})]}),t?.status===`failed`&&d.supportsHostRetry&&d.hostStatus!==`disabled`?(0,Q.jsx)(k,{size:`sm`,variant:`outline`,disabled:o||p!==null,onClick:()=>{m(e.id),f({environmentId:i,input:{retryHostId:e.id}}).finally(()=>m(null))},children:p===e.id?`Retrying…`:`Retry`}):(0,Q.jsx)(k,{size:`sm`,variant:`outline`,disabled:o||g!==null,onClick:()=>void u(e),children:`Test connection`})]},e.id)},t[14]=o,t[15]=l,t[16]=i,t[17]=r,t[18]=s,t[19]=c,t[20]=f,t[21]=p,t[22]=d,t[23]=u,t[24]=e):e=t[24],g=a.map(e),t[2]=o,t[3]=l,t[4]=i,t[5]=r,t[6]=a,t[7]=s,t[8]=c,t[9]=f,t[10]=p,t[11]=d,t[12]=u,t[13]=g}else g=t[13];let _;return t[25]!==h||t[26]!==g?(_=(0,Q.jsxs)(Q.Fragment,{children:[h,g]}),t[25]=h,t[26]=g,t[27]=_):_=t[27],_}function Rt(e){return(0,Q.jsxs)(Ce,{children:[(0,Q.jsx)(xe,{render:(0,Q.jsx)(`span`,{tabIndex:0,role:`img`,"aria-label":e.platform===`ios`?`iOS available`:`Android available`,className:`shrink-0 text-muted-foreground`}),children:e.platform===`ios`?(0,Q.jsx)(Ue,{className:`size-3.5 -translate-y-px`}):(0,Q.jsx)(We,{className:`size-3.5`})}),(0,Q.jsx)(Se,{children:e.platform===`ios`?`iOS available`:`Android available`})]},e.platform)}function zt(e){return e.available}function Bt(e,t){if(e)return{kind:`new`};let n=t[0];return n?{kind:`existing`,profileId:n.id}:{kind:`new`}}function Vt(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 Ht(e){return e.step!==`importing`}function Ut(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 Wt(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 Gt(e){return e===void 0?{step:`blocked`,reason:`unknownSource`}:Ut(e)}function Kt(e){let t=Gt(e);return t.step===`fullDiskAccess`?{...t,checked:!0}:t}function qt(e,t){return t.profiles.some(t=>t.directory===e)?e:t.profiles[0]?.directory??``}function Jt(e){switch(e){case`needsKeychainApproval`:case`keychainItemMissing`:case`keychainUnavailable`:case`readFailed`:case`sessionUnavailable`:case`profileNotSaved`:return!0;default:return!1}}function Yt(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 Xt(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=()=>Ut(n),t[0]=n,t[1]=p);let[m,h]=(0,$.useState)(p),g;t[2]===n.profiles[0]?.directory?g=t[3]:(g=()=>n.profiles[0]?.directory??``,t[2]=n.profiles[0]?.directory,t[3]=g);let[_,v]=(0,$.useState)(g),y;t[4]!==a||t[5]!==i?(y=()=>Bt(a,i),t[4]=a,t[5]=i,t[6]=y):y=t[6];let[b,x]=(0,$.useState)(y),[S,C]=(0,$.useState)(),w;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(w=O(),t[7]=w):w=t[7];let T=(0,$.useRef)(`profile-${w}`),E=(0,$.useRef)(!1),D;t[8]!==o||t[9]!==_||t[10]!==b||t[11]!==i?(D=()=>{if(E.current)return;let e=Vt(b,T.current,i);if(e===void 0){C(`That profile is no longer available. Choose where to import these cookies.`),h({step:`configure`});return}C(void 0),E.current=!0,h({step:`importing`}),o({sourceProfileDirectory:_,target:e}).then(e=>h(Wt(e))).catch(()=>h({step:`blocked`,reason:`readFailed`})).finally(()=>{E.current=!1})},t[8]=o,t[9]=_,t[10]=b,t[11]=i,t[12]=D):D=t[12];let k=D,A;t[13]===s?A=t[14]:(A=(e,t)=>{h({step:`checking`,check:e}),s().then(e=>{e&&(f(e),v(t=>qt(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`,Gt),t[15]=j,t[16]=M);let N=M,P;t[17]===j?P=t[18]:(P=()=>j(`fullDiskAccess`,Kt),t[17]=j,t[18]=P);let F=P,I;t[19]!==u||t[20]!==m?(I=e=>e||!Ht(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=Ht(m),t[22]=m,t[23]=L);let R;t[24]!==a||t[25]!==r||t[26]!==l||t[27]!==u||t[28]!==c||t[29]!==s||t[30]!==N||t[31]!==F||t[32]!==k||t[33]!==d||t[34]!==_||t[35]!==m||t[36]!==b||t[37]!==S||t[38]!==i?(R=m.step===`quit`?(0,Q.jsx)(Zt,{source:d,onCancel:u,onRechecked:N}):m.step===`fullDiskAccess`?(0,Q.jsx)(en,{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)(rn,{}):m.step===`checking`?(0,Q.jsx)(an,{sourceName:d.name,check:m.check}):m.step===`done`?(0,Q.jsx)(on,{...m,destinationEnvironmentName:r,onClose:u}):m.step===`blocked`?(0,Q.jsx)(sn,{source:d,reason:m.reason,onClose:u,onRetry:Jt(m.reason)?k:void 0}):(0,Q.jsx)(tn,{source:d,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:_,onSourceProfileChange:v,target:b,onTargetChange:e=>{x(e),C(void 0)},targetError:S,onCancel:u,onImport:k}),t[24]=a,t[25]=r,t[26]=l,t[27]=u,t[28]=c,t[29]=s,t[30]=N,t[31]=F,t[32]=k,t[33]=d,t[34]=_,t[35]=m,t[36]=b,t[37]=S,t[38]=i,t[39]=R):R=t[39];let z;t[40]!==L||t[41]!==R?(z=(0,Q.jsx)(je,{className:`max-w-lg`,showCloseButton:L,children:R}),t[40]=L,t[41]=R,t[42]=z):z=t[42];let B;return t[43]!==z||t[44]!==I?(B=(0,Q.jsx)(Me,{open:!0,onOpenChange:I,children:z}),t[43]=z,t[44]=I,t[45]=B):B=t[45],B}function Zt(e){let t=(0,Z.c)(12),{source:n,onCancel:r,onRechecked:i}=e,a;t[0]===n.name?a=t[1]:(a=(0,Q.jsxs)(Te,{children:[(0,Q.jsxs)(Ee,{children:[`Quit `,n.name,` to import`]}),(0,Q.jsxs)(Ae,{children:[n.name,` is open, so its cookies can’t be read yet. Quit it, then continue.`]})]}),t[0]=n.name,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(k,{variant:`outline`,onClick:r,children:`Cancel`}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(k,{onClick:i,children:`I’ve quit it`}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(De,{children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function Qt(e){if(e!==void 0)return e===0?`no cookies`:`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function $t(e){return`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function en(e){let t=(0,Z.c)(43),{source:n,onCancel:r,onOpenSettings:i,onGranted:a,stillRequired:o,onCheck:s}=e,[c,u]=(0,$.useState)(!1),[d,f]=(0,$.useState)(null),p;t[0]===s?p=t[1]:(p=async()=>({fullDiskAccess:await s()}),t[0]=s,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m={fullDiskAccess:!1},t[2]=m):m=t[2];let h=St(p,m),g;t[3]!==i||t[4]!==c?(g=()=>{c||(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]=c,t[5]=g):g=t[5];let _=g,v;t[6]===n.name?v=t[7]:(v=(0,Q.jsxs)(Te,{children:[(0,Q.jsxs)(Ee,{children:[`Let P4 Code read `,n.name,`’s cookies`]}),(0,Q.jsxs)(Ae,{children:[`To import cookies from `,n.name,`, P4 Code needs Full Disk Access. Turn it on in System Settings, then come back to finish the import — you can revoke it again once the import is done.`]})]}),t[6]=n.name,t[7]=v);let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(l,{className:`size-8 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[8]=y):y=t[8];let b=`Read ${n.name}'s cookies for this import.`,x;t[9]===_?x=t[10]:(x=()=>void _(),t[9]=_,t[10]=x);let S;t[11]!==h.status.fullDiskAccess||t[12]!==b||t[13]!==x?(S=[{id:`fullDiskAccess`,icon:y,title:`Full Disk Access`,description:b,granted:h.status.fullDiskAccess,onAllow:x}],t[11]=h.status.fullDiskAccess,t[12]=b,t[13]=x,t[14]=S):S=t[14];let C;t[15]!==c||t[16]!==S?(C=(0,Q.jsx)(bt,{busy:c,permissions:S}),t[15]=c,t[16]=S,t[17]=C):C=t[17];let w;t[18]!==d||t[19]!==h.error?(w=d||h.error?(0,Q.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:d??h.error}):null,t[18]=d,t[19]=h.error,t[20]=w):w=t[20];let T;t[21]!==h||t[22]!==o?(T=h.isReady([`fullDiskAccess`])?null:(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:o?`Access is still required. Quit and reopen P4 Code if you just allowed it, then retry the import.`:`If access doesn't update after you allow it, quit and reopen P4 Code, then retry the import.`}),t[21]=h,t[22]=o,t[23]=T):T=t[23];let E;t[24]!==w||t[25]!==T||t[26]!==C?(E=(0,Q.jsxs)(ke,{children:[C,w,T]}),t[24]=w,t[25]=T,t[26]=C,t[27]=E):E=t[27];let D;t[28]===r?D=t[29]:(D=(0,Q.jsx)(k,{variant:`outline`,onClick:r,children:`Cancel`}),t[28]=r,t[29]=D);let O;t[30]===h?O=t[31]:(O=h.isReady([`fullDiskAccess`]),t[30]=h,t[31]=O);let A;t[32]!==a||t[33]!==c||t[34]!==O?(A=(0,Q.jsx)(xt,{ready:O,busy:c,onClick:a,children:`Continue`}),t[32]=a,t[33]=c,t[34]=O,t[35]=A):A=t[35];let j;t[36]!==D||t[37]!==A?(j=(0,Q.jsxs)(De,{children:[D,A]}),t[36]=D,t[37]=A,t[38]=j):j=t[38];let M;return t[39]!==E||t[40]!==j||t[41]!==v?(M=(0,Q.jsxs)(Q.Fragment,{children:[v,E,j]}),t[39]=E,t[40]=j,t[41]=v,t[42]=M):M=t[42],M}function tn(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:p}=e,m;t[0]!==c.kind||t[1]!==c.profileId||t[2]!==i?(m=c.kind===`existing`&&!i.some(e=>e.id===c.profileId),t[0]=c.kind,t[1]=c.profileId,t[2]=i,t[3]=m):m=t[3];let h=m,g=c.kind===`new`&&!a,_=l??(h?`That profile is no longer available. Choose where to import these cookies.`:g?`You've reached the profile limit. Choose an existing profile to import into.`:void 0),y;t[4]===n.name?y=t[5]:(y=(0,Q.jsxs)(Ee,{children:[`Import from `,n.name]}),t[4]=n.name,t[5]=y);let b;t[6]===r?b=t[7]:(b=(0,Q.jsxs)(Ae,{children:[`Choose which cookies to import for `,r,`.`]}),t[6]=r,t[7]=b);let x;t[8]!==y||t[9]!==b?(x=(0,Q.jsxs)(Te,{children:[y,b]}),t[8]=y,t[9]=b,t[10]=x):x=t[10];let S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`From`}),t[11]=S):S=t[11];let C;if(t[12]!==s||t[13]!==n.profiles||t[14]!==o){let e;t[16]!==s||t[17]!==o?(e=e=>(0,Q.jsx)(nn,{selected:o===e.directory,title:e.name,subtitle:Qt(e.cookieCount),onSelect:()=>s(e.directory)},e.directory),t[16]=s,t[17]=o,t[18]=e):e=t[18],C=n.profiles.map(e),t[12]=s,t[13]=n.profiles,t[14]=o,t[15]=C}else C=t[15];let w;t[19]===C?w=t[20]:(w=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[S,C]}),t[19]=C,t[20]=w);let T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center text-muted-foreground`,children:[(0,Q.jsx)(v,{className:`size-4 sm:hidden`}),(0,Q.jsx)(f,{className:`hidden size-4 sm:block`})]}),t[21]=T):T=t[21];let E;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Into`}),t[22]=E):E=t[22];let D;t[23]!==a||t[24]!==u||t[25]!==c.kind?(D=a?(0,Q.jsx)(nn,{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]=D):D=t[26];let O;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)(nn,{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],O=i.map(e),t[27]=u,t[28]=c.kind,t[29]=c.profileId,t[30]=i,t[31]=O}else O=t[31];let A;t[36]!==D||t[37]!==O?(A=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[E,D,O]}),t[36]=D,t[37]=O,t[38]=A):A=t[38];let j;t[39]!==A||t[40]!==w?(j=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4`,children:[w,T,A]}),t[39]=A,t[40]=w,t[41]=j):j=t[41];let M;t[42]===_?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)(ke,{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)(k,{variant:`outline`,onClick:d,children:`Cancel`}),t[47]=d,t[48]=P);let F=o===``||h||g,I;t[49]!==p||t[50]!==F?(I=(0,Q.jsx)(k,{disabled:F,onClick:p,children:`Import`}),t[49]=p,t[50]=F,t[51]=I):I=t[51];let L;t[52]!==P||t[53]!==I?(L=(0,Q.jsxs)(De,{children:[P,I]}),t[52]=P,t[53]=I,t[54]=L):L=t[54];let R;return t[55]!==N||t[56]!==L||t[57]!==x?(R=(0,Q.jsxs)(Q.Fragment,{children:[x,N,L]}),t[55]=N,t[56]=L,t[57]=x,t[58]=R):R=t[58],R}function nn(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=R(`flex w-full cursor-pointer items-center justify-between gap-3 rounded-lg border px-3 py-2 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,o),t[0]=o,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,Q.jsx)(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:r}),t[2]=r,t[3]=c);let l;t[4]===i?l=t[5]:(l=i?(0,Q.jsx)(`span`,{className:`block truncate text-xs tabular-nums text-muted-foreground`,children:i}):null,t[4]=i,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d=n?`border-primary bg-primary text-primary-foreground`:`border-input`,f;t[9]===d?f=t[10]:(f=R(`grid size-4 shrink-0 place-items-center rounded-full border`,d),t[9]=d,t[10]=f);let p;t[11]===n?p=t[12]:(p=n?(0,Q.jsx)(S,{className:`size-2.5`}):null,t[11]=n,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Q.jsx)(`span`,{className:f,children:p}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==a||t[17]!==n||t[18]!==s||t[19]!==u||t[20]!==m?(h=(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:a,className:s,children:[u,m]}),t[16]=a,t[17]=n,t[18]=s,t[19]=u,t[20]=m,t[21]=h):h=t[21],h}function rn(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(Te,{children:[(0,Q.jsx)(Ee,{children:`Importing cookies`}),(0,Q.jsx)(Ae,{children:`This may take a moment.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[t,(0,Q.jsx)(ke,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,Q.jsx)(le,{size:`md`,tone:`muted`}),(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Importing…`})]})})]}),e[1]=n):n=e[1],n}function an(e){let t=(0,Z.c)(13),{sourceName:n,check:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsxs)(Ee,{children:[`Checking `,n]}),t[0]=n,t[1]=i);let a=r===`fullDiskAccess`?`Checking Full Disk Access.`:`Checking whether the browser has closed.`,o;t[2]===a?o=t[3]:(o=(0,Q.jsx)(Ae,{children:a}),t[2]=a,t[3]=o);let s;t[4]!==i||t[5]!==o?(s=(0,Q.jsxs)(Te,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6];let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(le,{size:`md`,tone:`muted`}),t[7]=c):c=t[7];let l=r===`fullDiskAccess`?`Checking access…`:`Checking…`,u;t[8]===l?u=t[9]:(u=(0,Q.jsx)(ke,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[c,(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:l})]})}),t[8]=l,t[9]=u);let d;return t[10]!==s||t[11]!==u?(d=(0,Q.jsxs)(Q.Fragment,{children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function on(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 ${$t(n)}`:r>0?`Skipped ${$t(r)}`:`No cookies found`,t[0]=n,t[1]=r,t[2]=c):c=t[2];let l;t[3]===c?l=t[4]:(l=(0,Q.jsx)(Ee,{children:c}),t[3]=c,t[4]=l);let u;t[5]!==o||t[6]!==n||t[7]!==r||t[8]!==a?(u=n>0?`Added to ${a} for ${o}.${r>0?` ${$t(r)} skipped.`:``}`:r>0?`No cookies were imported for ${o}.`:`There were no cookies to import for ${o}.`,t[5]=o,t[6]=n,t[7]=r,t[8]=a,t[9]=u):u=t[9];let d;t[10]===u?d=t[11]:(d=(0,Q.jsx)(Ae,{children:u}),t[10]=u,t[11]=d);let f;t[12]!==l||t[13]!==d?(f=(0,Q.jsxs)(Te,{children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=i.length>0?(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Skipped`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-foreground`,children:Yt(i)})]}):null,t[15]=i,t[16]=p);let m;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(k,{}),t[17]=m):m=t[17];let h;t[18]===s?h=t[19]:(h=(0,Q.jsx)(De,{children:(0,Q.jsx)(Oe,{render:m,onClick:s,children:`Done`})}),t[18]=s,t[19]=h);let g;return t[20]!==f||t[21]!==p||t[22]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[f,p,h]}),t[20]=f,t[21]=p,t[22]=h,t[23]=g):g=t[23],g}function sn(e){let t=(0,Z.c)(17),{source:n,reason:r,onClose:i,onRetry:a}=e,o;t[0]===n.name?o=t[1]:(o=(0,Q.jsxs)(Ee,{children:[`Couldn’t import from `,n.name]}),t[0]=n.name,t[1]=o);let s=z[r],c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(Ae,{children:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c?(l=(0,Q.jsxs)(Te,{children:[o,c]}),t[4]=o,t[5]=c,t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=(0,Q.jsx)(k,{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)(k,{onClick:a,children:`Try again`}):null,t[9]=a,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,Q.jsxs)(De,{children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==l||t[15]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[l,f]}),t[14]=l,t[15]=f,t[16]=p):p=t[16],p}var cn=`fill`,ln=`responsive`;async function un(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 dn(e,t,n,r=0){return(e||r>0)&&t&&n>0}var fn={width:1280,height:800},pn={useGrouping:!1},mn={system:`System`,light:`Light`,dark:`Dark`},hn=e=>`${Math.round(e*100)}%`,gn=class extends Error{constructor(){super(`Browser profile limit reached.`),this.name=`ProfileLimitReachedError`}},_n=e=>{let t=String(e?.message??``);return M.literals.find(e=>t.includes(`failed: ${e}.`))??`readFailed`},vn=e=>e._tag===`fill`?cn:e._tag===`preset`&&st.some(t=>t.id===e.presetId)?e.presetId:ln,yn=e=>{let t=vn(e);return t===cn?`Fill panel`:t===ln?`Responsive`:st.find(e=>e.id===t)?.label??`Responsive`},bn=e=>Number.isInteger(e)&&e>=240&&e<=3840,xn=e=>({...e,width:e.height,height:e.width});function Sn(e){let t=(0,Z.c)(42),{disabled:n}=e,r=J(wn),i=Y(),a=r._tag===`fill`?null:r,o=a?.width??fn.width,s=a?.height??fn.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===cn){i({browserDefaultViewport:N});return}if(e===ln){i({browserDefaultViewport:{_tag:`freeform`,width:a?.width??fn.width,height:a?.height??fn.height}});return}let t=st.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||!bn(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=gt(`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!==E._tag?(0,Q.jsx)(nt,{label:`default browser viewport`,onClick:()=>i({browserDefaultViewport:E})}):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=vn(r),t[16]=r,t[17]=g);let _;t[18]===r?_=t[19]:(_=yn(r),t[18]=r,t[19]=_);let v;t[20]===_?v=t[21]:(v=(0,Q.jsx)(G,{size:`sm`,className:`w-full min-w-0 sm:w-44`,"aria-label":`Default browser viewport`,children:(0,Q.jsx)(U,{children:_})}),t[20]=_,t[21]=v);let y,x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(H,{value:cn,children:`Fill panel`}),x=(0,Q.jsx)(H,{value:ln,children:`Responsive`}),t[22]=y,t[23]=x):(y=t[22],x=t[23]);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(W,{align:`end`,alignItemWithTrigger:!1,children:[y,x,(0,Q.jsxs)(ce,{children:[(0,Q.jsx)(se,{children:`Standard`}),st.map(Cn)]})]}),t[24]=S):S=t[24];let C;t[25]!==n||t[26]!==d||t[27]!==v||t[28]!==g?(C=(0,Q.jsxs)(K,{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)(oe,{value:l.width,min:240,max:b,disabled:n,format:pn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`width`,e),children:(0,Q.jsx)(ae,{children:(0,Q.jsx)(V,{"aria-label":`Default viewport width`})})}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`×`}),(0,Q.jsx)(oe,{value:l.height,min:240,max:b,disabled:n,format:pn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`height`,e),children:(0,Q.jsx)(ae,{children:(0,Q.jsx)(V,{"aria-label":`Default viewport height`})})}),(0,Q.jsxs)(Ce,{children:[(0,Q.jsx)(xe,{render:(0,Q.jsx)(k,{size:`icon-sm`,variant:`ghost-muted`,disabled:n,"aria-label":`Rotate to ${l.height>=l.width?`landscape`:`portrait`}`,onClick:()=>i({browserDefaultViewport:xn(a)}),children:(0,Q.jsx)(ft,{})})}),(0,Q.jsx)(Se,{side:`top`,children:`Rotate`})]})]}):null,t[30]=p,t[31]=n,t[32]=l,t[33]=a,t[34]=i,t[35]=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 D;return t[39]!==T||t[40]!==h?(D=(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]=D):D=t[41],D}function Cn(e){return(0,Q.jsx)(H,{value:e.id,children:(0,Q.jsxs)(`span`,{className:`flex w-full items-center justify-between gap-5`,children:[(0,Q.jsx)(`span`,{children:e.label}),(0,Q.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:e.detail})]})},e.id)}function wn(e){return e.browserDefaultViewport}function Tn(e){let t=(0,Z.c)(20),{disabled:n}=e,r=J(Dn),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=gt(`browser-default-zoom`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==i||t[3]!==r?(o=!n&&r!==1?(0,Q.jsx)(nt,{label:`default browser zoom`,onClick:()=>i({browserDefaultZoomFactor:1})}):null,t[1]=n,t[2]=i,t[3]=r,t[4]=o):o=t[4];let s=String(r),c;t[5]===i?c=t[6]:(c=e=>{let t=ne.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=hn(r),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Q.jsx)(G,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser zoom`,children:(0,Q.jsx)(U,{children:l})}),t[9]=l,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(W,{align:`end`,alignItemWithTrigger:!1,children:ne.map(En)}),t[11]=d):d=t[11];let f;t[12]!==n||t[13]!==s||t[14]!==c||t[15]!==u?(f=(0,Q.jsxs)(K,{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 En(e){return(0,Q.jsx)(H,{hideIndicator:!0,value:String(e),children:hn(e)},e)}function Dn(e){return e.browserDefaultZoomFactor}function On(e){let t=(0,Z.c)(18),{disabled:n}=e,r=J(An),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=gt(`browser-default-appearance`),t[0]=a):a=t[0];let o;t[1]!==r||t[2]!==n||t[3]!==i?(o=!n&&r!==`system`?(0,Q.jsx)(nt,{label:`default browser appearance`,onClick:()=>i({browserDefaultAppearance:T})}):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)(G,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser appearance`,children:(0,Q.jsx)(U,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(W,{align:`end`,alignItemWithTrigger:!1,children:Object.entries(mn).map(kn)}),t[9]=u):u=t[9];let d;t[10]!==r||t[11]!==n||t[12]!==s||t[13]!==l?(d=(0,Q.jsxs)(K,{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 kn(e){let[t,n]=e;return(0,Q.jsx)(H,{hideIndicator:!0,value:t,children:n},t)}function An(e){return e.browserDefaultAppearance}function jn(e){let t=(0,Z.c)(17),{disabled:n}=e,r=J(Nn),i=J(Mn),a=Y(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=gt(`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)(ht,{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=gt(`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)(ht,{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 Mn(e){return e.browserRecordingShowMousePresses}function Nn(e){return e.browserRecordingShowKeyPresses}function Pn(e){let t=(0,Z.c)(18),{disabled:n}=e,r=J(In),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=gt(`browser-recording-frame-rate`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==r||t[3]!==i?(o=!n&&r!==30?(0,Q.jsx)(nt,{label:`browser recording frame rate`,onClick:()=>i({browserRecordingFrameRate:30})}):null,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s=String(r),c;t[5]===i?c=t[6]:(c=e=>{let t=I.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)(G,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Browser recording frame rate`,children:(0,Q.jsxs)(U,{children:[r,` fps`]})}),t[7]=r,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(W,{align:`end`,alignItemWithTrigger:!1,children:I.map(Fn)}),t[9]=u):u=t[9];let d;t[10]!==n||t[11]!==s||t[12]!==c||t[13]!==l?(d=(0,Q.jsxs)(K,{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 Fn(e){return(0,Q.jsxs)(H,{hideIndicator:!0,value:String(e),children:[e,` fps`]},e)}function In(e){return e.browserRecordingFrameRate}var Ln={system:`Your default browser`,app:`P4 Code`};function Rn(e){let t=(0,Z.c)(19),{disabled:n}=e,r=J(Bn),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=gt(`browser-link-target`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==r||t[3]!==i?(o=!n&&r!==`system`?(0,Q.jsx)(nt,{label:`link target`,onClick:()=>i({browserLinkTarget:w})}):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=Ln[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(G,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Open links in`,children:(0,Q.jsx)(U,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.keys(Ln),t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(W,{align:`end`,alignItemWithTrigger:!1,children:u.map(zn)}),t[10]=d):d=t[10];let f;t[11]!==n||t[12]!==r||t[13]!==s||t[14]!==l?(f=(0,Q.jsxs)(K,{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 zn(e){return(0,Q.jsx)(H,{hideIndicator:!0,value:e,children:Ln[e]},e)}function Bn(e){return e.browserLinkTarget}function Vn(){let e=(0,Z.c)(7),{search:t,environment:n}=Xe(),r=$e(),i=n?.connection.phase===`connected`&&n.serverConfig!==null?n.environmentId:null,a;e[0]===t?a=e[1]:(a=JSON.stringify(t),e[0]=t,e[1]=a);let o=`${i}:${a}`,s;return e[2]!==i||e[3]!==r.enableAgentDeviceAccess||e[4]!==r.enableDeviceSupport||e[5]!==o?(s=(0,Q.jsx)(rt,{id:`devices`,title:`Devices`,children:(0,Q.jsx)(Hn,{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 Hn({environmentId:e,enabled:t,agentAccessEnabled:n}){let r=_e(e,d),{state:i,loaded:a}=Ne(e),{scope:o,environments:s,connectedEnvironments:c}=Xe(),l=Qe(),u=o.kind===`project`||o.kind===`checkout`,f=c.some(e=>e.serverConfig?.settings.enableDeviceSupport),p=ye(Pe.configure,{reportFailure:!1}),m=ye(Pe.list,{reportFailure:!1}),[h,_]=(0,$.useState)(null),v=i.hostStatus===`installing`||i.hostStatus===`starting`,y=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`||y)&&h!==`hub`&&x(!0);let S=async(t,n)=>{if(e&&ve(e,`settings:write`)){_(t);try{let e=await Promise.allSettled(s.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!ve(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return p({environmentId:e.environmentId,input:{...n,...n.enabled?{onboardingCompleted:!0}:{}}})})),t=s.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});t.length>0&&q.add({type:`error`,title:`Device settings not saved on all environments`,description:`Could not update ${t.map(e=>e.label).join(`, `)}.`})}finally{_(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),_(`update-${t}`),m({environmentId:e,input:{updateTool:t}}).then(e=>{if(e._tag===`Failure`){let e=`Update failed. Check this host's network connection and try again.`;w({tool:t,message:e}),n&&q.add({type:`error`,title:e})}}).finally(()=>_(null)))},O=t=>{e&&(_(t),m({environmentId:e,input:{inspectOnly:!0}}).finally(()=>_(null)))},A=t=>{let n=E(t);if(!n&&!i.supportsToolInspection)return null;let r=h===`update-${t}`||h===`check-${t}`,a=n?`Update to v${T?.[t].requiredVersion}`:`Check ${t===`hub`?`device hub`:`agent device`} version`;return(0,Q.jsxs)(Ce,{children:[(0,Q.jsx)(xe,{render:(0,Q.jsx)(k,{size:`icon-xs`,variant:`ghost-muted`,disabled:!e||h!==null||v,"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)(g,{"aria-hidden":!0})}),(0,Q.jsx)(`span`,{className:n&&!r?`scale-75 opacity-0`:void 0,children:(0,Q.jsx)(at,{refreshing:r})})]})}),(0,Q.jsx)(Se,{side:`top`,children:a})]})},j=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)(k,{size:`sm`,disabled:!e||h!==null||v,onClick:()=>D(t),children:h===`update-${t}`?`Updating…`:`Update to v${n.requiredVersion}`}):null,i.supportsToolInspection?(0,Q.jsx)(k,{size:`sm`,variant:`outline`,disabled:!e||h!==null||v,onClick:()=>O(`check`),children:h===`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,{...gt(`device-hub`),serverScoped:!0,settingKeys:[`enableDeviceSupport`],description:ze,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ct,{action:j(`hub`),kind:`hub`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),A(`hub`),h===`hub`?(0,Q.jsx)(Re,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(yt,{settingKeys:[`enableDeviceSupport`],checked:t,disabled:!r||u||!a||!e||v||h!==null,"aria-label":`Device hub`,onCheckedChange:e=>void S(`hub`,{enabled:!!e,...e?{}:{agentAccessEnabled:!1}})})]})}),(0,Q.jsx)(He,{children:b?(0,Q.jsx)(X,{...gt(`device-platform-support`),description:c.length>1?`Status for ${c.find(t=>t.environmentId===e)?.label}. Select an environment to inspect its simulator support.`:void 0,status:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2`,children:[(0,Q.jsx)(Le,{compact:!0,platform:`iOS`,status:Be(i,`ios`)}),(0,Q.jsx)(Le,{compact:!0,platform:`Android`,status:Be(i,`android`)})]}),control:(0,Q.jsx)(k,{size:`sm`,variant:`outline`,disabled:!e||!t||v||h!==null,onClick:()=>{e&&(_(`check`),m({environmentId:e,input:{}}).finally(()=>_(null)))},children:h===`check`?`Checking…`:`Refresh`})}):null}),(0,Q.jsx)(X,{...gt(`agent-device-access`),serverScoped:!0,settingKeys:[`enableAgentDeviceAccess`],description:Fe,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ct,{action:j(`agent`),kind:`agent`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),A(`agent`),h===`agent`?(0,Q.jsx)(Ve,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(yt,{settingKeys:[`enableAgentDeviceAccess`],checked:n,disabled:!r||c.length===0||!u&&(!a||!f||v)||h!==null,"aria-label":`Agent device access`,onCheckedChange:e=>u?l({enableAgentDeviceAccess:!!e}):void S(`agent`,{agentAccessEnabled:!!e})})]})}),e?(0,Q.jsx)(Ie,{state:{...i,hosts:i.hosts.filter(e=>e.kind===`local`)},environmentId:e}):null,(0,Q.jsx)(It,{environmentId:e})]})}function Un(e){let t=(0,Z.c)(14),{disabled:n}=e,r=J(Wn),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=gt(`browser-auto-show-floating-preview`),t[0]=a):a=t[0];let o;t[1]!==r||t[2]!==n||t[3]!==i?(o=!n&&r!==!0?(0,Q.jsx)(nt,{label:`auto-show floating preview`,onClick:()=>i({browserAutoShowFloatingPreview:!0})}):null,t[1]=r,t[2]=n,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>i({browserAutoShowFloatingPreview:!!e}),t[5]=i,t[6]=s);let c;t[7]!==r||t[8]!==n||t[9]!==s?(c=(0,Q.jsx)(ht,{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 Wn(e){return e.browserAutoShowFloatingPreview}function Gn({disabled:e}){let t=J(e=>e.browserProfiles),r=J(e=>e.browserDefaultProfileId),o=pe(),s=Y(),{environments:l,isReady:u}=de(),d=ue(),[f,p]=(0,$.useState)(null),[g,v]=(0,$.useState)(null),[b,S]=(0,$.useState)(null),[w,T]=(0,$.useState)(null),[E,D]=(0,$.useState)(null),[A,j]=(0,$.useState)(!1),M=ie(),N=ye(Ge.clearProfile,{reportFailure:!1}),P={environmentIds:l.map(e=>e.environmentId).filter(e=>M.get(e)?.environment.capabilities.serverBrowser===!0),clear:async(e,t)=>{let n=await N({environmentId:e,input:{profileId:t}});if(n._tag===`Failure`)throw re(n)}},I=dn(ct!==null,u,l.length,P.environmentIds.length),z=(0,$.useRef)(!1),[B,ne]=(0,$.useState)(!1),V=e||!o,ae=m(t).filter(e=>e.kind!==`incognito`),oe=a(ae,r)?.id??`default`,H=e=>{if(!o||z.current)return;let t=he().browserProfiles;if(t.length>=24)return;let n=m(t),r=new Set(n.map(e=>e.name)),i=e;for(let t=2;r.has(i);t+=1)i=`${e} ${t}`;let a={id:`profile-${O()}`,name:i,kind:`persistent`};return s({browserProfiles:[...t,a]}),a},U=(e,t)=>{if(!o||z.current)return;let n=t.trim().slice(0,48);if(n===``)return;let r=he().browserProfiles;s({browserProfiles:r.map(t=>t.id===e?{...t,name:n}:t)})},se=(e,t)=>{if(o&&!z.current){if(!I){q.add({type:`error`,title:`Could not clear ${t}'s data`,description:`You're not connected to a server yet.`});return}un(ct,l.map(e=>e.environmentId),e,P).then(()=>{q.add({type:`success`,title:`Cleared ${t}'s cookies and cache`})}).catch(()=>{q.add({type:`error`,title:`Could not clear ${t}'s data`})})}},W=async e=>{if(!o||z.current)return;if(!I){D(`Connect to an environment before removing this profile.`);return}D(null),j(!0);try{await un(ct,u?l.map(e=>e.environmentId):[],e,P)}catch{D(`Profile data could not be deleted. Try again.`),j(!1);return}let t=he();s({browserProfiles:t.browserProfiles.filter(t=>t.id!==e),...t.browserDefaultProfileId===e?{browserDefaultProfileId:te}:{}}),j(!1),S(null)},ce=(f??[]).filter(e=>e.unavailable!==`notInstalled`&&e.unavailable!==`unsupportedPlatform`),G=(0,$.useCallback)(()=>{ct&&ct.listBrowserImportSources().then(p).catch(()=>p(e=>e??[]))},[]),K=async(e,t,n)=>{if(!ct||!o)return{kind:`blocked`,reason:`sessionUnavailable`};if(n.target.kind===`existing`&&!m(he().browserProfiles).some(e=>e.id===n.target.profileId)||z.current)return{kind:`blocked`,reason:`readFailed`};z.current=!0,ne(!0);try{let r=await ct.importBrowserCookies({environmentId:t,sourceId:e.id,sourceProfileDirectory:n.sourceProfileDirectory,targetProfileId:n.target.profileId});if(n.target.kind===`existing`&&!m(he().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 me(t=>{if(t.browserProfiles.find(e=>e.id===n.target.profileId))return t;if(t.browserProfiles.length>=24)throw new gn;let r=new Set(m(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 un(ct,[t],n.target.profileId).catch(()=>void 0);let i=r instanceof gn?`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:_n(e)}}finally{z.current=!1,ne(!1)}},le=async e=>{if(ct)try{let t=await ct.listBrowserImportSources();return p(t),t.find(t=>t.id===e)}catch{return}},ge=t.length>=24;return(0,Q.jsxs)(X,{...gt(`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)(C,{render:(0,Q.jsx)(k,{size:`sm`,variant:`outline`,disabled:V||B}),children:[(0,Q.jsx)(i,{}),`Add profile`]}),(0,Q.jsxs)(n,{align:`end`,children:[(0,Q.jsx)(y,{disabled:!o||ge,onClick:()=>H(`New profile`),children:`Blank profile`}),ge?(0,Q.jsx)(y,{disabled:!0,children:`You’ve reached the profile limit`}):null,(0,Q.jsx)(L,{}),(0,Q.jsxs)(_,{children:[(0,Q.jsx)(h,{children:`Import from`}),f===null?(0,Q.jsx)(y,{disabled:!0,children:`Looking for browsers…`}):ce.length===0?(0,Q.jsx)(y,{disabled:!0,children:`No supported browsers found`}):(0,Q.jsxs)(Q.Fragment,{children:[ce.map(e=>(0,Q.jsx)(y,{disabled:!o||d==null,onClick:()=>{o&&d!=null&&v({source:e,environmentId:d.environmentId,environmentName:Ze({isPrimary:!0,environmentId:d.environmentId,runtimeLabel:d.label})})},children:e.name},e.id)),d==null?(0,Q.jsx)(y,{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:ae.map((e,t)=>{let r=ee(e.id),i=e.id===oe;return(0,Q.jsxs)(`div`,{className:R(`flex items-center gap-3 px-3 py-2`,t>0&&`border-t border-border/60`),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[r?(0,Q.jsx)(`span`,{className:R(`truncate text-sm text-foreground`,V&&`opacity-64`),children:e.name}):(0,Q.jsx)(vt,{nativeInput:!0,size:`sm`,className:`w-full max-w-56`,"aria-label":`Rename ${e.name}`,disabled:V||B,maxLength:48,value:e.name,onCommit:t=>U(e.id,t)}),i?(0,Q.jsx)(`span`,{className:R(`flex`,V&&`opacity-64`),children:(0,Q.jsx)(c,{children:`Default`})}):null]}),(0,Q.jsxs)(F,{children:[(0,Q.jsx)(C,{render:(0,Q.jsx)(k,{size:`icon-xs`,variant:`ghost-muted`,disabled:V||B,"aria-label":`${e.name} options`}),children:(0,Q.jsx)(x,{})}),(0,Q.jsxs)(n,{align:`end`,children:[(0,Q.jsx)(y,{disabled:!o||i,onClick:()=>{o&&s({browserDefaultProfileId:e.id})},children:`Set as default`}),(0,Q.jsx)(y,{disabled:!o||!I,onClick:()=>{P.environmentIds.length>0?T(e):se(e.id,e.name)},children:`Clear cookies and cache`}),r?null:(0,Q.jsx)(y,{variant:`destructive`,disabled:!o||!I,onClick:()=>{o&&S(e)},children:`Remove profile and data`}),I?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(L,{}),(0,Q.jsx)(y,{disabled:!0,children:u?`Connect to an environment to clear profile data`:`Checking environments…`})]})]})]})]},e.id)})}),(0,Q.jsx)(ot,{open:b!==null,onOpenChange:e=>{!e&&!A&&(S(null),D(null))},children:(0,Q.jsxs)(lt,{children:[(0,Q.jsxs)(pt,{children:[(0,Q.jsxs)(ut,{children:[`Remove “`,b?.name,`”?`]}),(0,Q.jsx)(mt,{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.`}),E?(0,Q.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-destructive`,children:E}):null,I?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)(dt,{disabled:A,render:(0,Q.jsx)(k,{variant:`outline`,disabled:A}),children:`Cancel`}),(0,Q.jsx)(k,{variant:`destructive`,disabled:A||!o||!I,onClick:()=>{b&&o&&I&&W(b.id)},children:A?`Removing…`:`Remove profile`})]})]})}),(0,Q.jsx)(ot,{open:w!==null,onOpenChange:e=>{e||T(null)},children:(0,Q.jsxs)(lt,{children:[(0,Q.jsxs)(pt,{children:[(0,Q.jsxs)(ut,{children:[`Clear “`,w?.name,`”’s cookies and cache?`]}),(0,Q.jsx)(mt,{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)(dt,{render:(0,Q.jsx)(k,{variant:`outline`}),children:`Cancel`}),(0,Q.jsx)(k,{variant:`destructive`,onClick:()=>{w&&se(w.id,w.name),T(null)},children:`Clear data`})]})]})}),g?(0,Q.jsx)(Xt,{source:g.source,destinationEnvironmentName:g.environmentName,targetProfiles:ae.map(e=>({id:e.id,name:e.name})),canCreateProfile:o&&!ge,onImport:e=>K(g.source,g.environmentId,e),onRefreshSource:()=>le(g.source.id),onCheckFullDiskAccess:window.desktopBridge?.checkSystemPermission?()=>window.desktopBridge.checkSystemPermission(`full-disk-access`):void 0,onOpenFullDiskAccessSettings:async()=>{await fe()?.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:()=>v(null)}):null]})}function Kn(){let e=(0,Z.c)(3),t=!be,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Gn,{disabled:t}),(0,Q.jsx)(Sn,{disabled:t}),(0,Q.jsx)(Tn,{disabled:t}),(0,Q.jsx)(On,{disabled:t}),(0,Q.jsx)(Pn,{disabled:t}),(0,Q.jsx)(jn,{disabled:t}),(0,Q.jsx)(Rn,{disabled:t}),(0,Q.jsx)(Un,{disabled:t})]}),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(_t,{category:`integrations`}),e[1]=i):i=e[1];let a;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(tt,{children:[i,(0,Q.jsx)(rt,{id:`browser`,title:`Browser`,children:t?(0,Q.jsx)(et,{message:`Only available in the desktop app.`,children:r}):r}),(0,Q.jsx)(Vn,{})]}),e[2]=a):a=e[2],a}var qn=Kn;export{qn as component};
2
+ //# sourceMappingURL=settings.integrations-B6wNRi_e.js.map
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$n as n,BE as r,Bp as i,Fd as a,Jm as o,Kn as s,O_ as c,Pc as l,S_ as u,Xd as d,Zn as f,cr as p,em as m,jm as h,lr as g,mE as _,pp as v,qn as y,rf as b,t as x,xd as S}from"./utils-B0w8dSf5.js";import{R as C,W as w}from"./runtime-mg6KxRIi.js";import{a as T,c as E,o as D,s as O,t as k}from"./select-CqPGedM1.js";import{t as A}from"./useLocation-XbiRdmmb.js";import{i as j}from"./toast-B2B2ECBW.js";import{f as M}from"./server-C8OpoOTL.js";import{i as ee,n as N,o as te}from"./session-BAH17FBJ.js";import{t as P}from"./use-atom-command-BWLbyoVN.js";import{t as ne}from"./env-wK1YYxA8.js";import{a as F,n as I,t as L}from"./tooltip-CuJiZzK7.js";import{t as R}from"./toggle-DTjg9Rvs.js";import{t as re}from"./input-CDBTiBJx.js";import{i as ie}from"./keybindings-4i_VvPsX.js";import{i as ae,o as oe,t as z}from"./popover-N-pn4OqA.js";import{n as se,r as ce,t as B}from"./input-group-CHJvPXpi.js";import{n as le,t as ue}from"./kbd-BGpxKPhX.js";import{B as de,U as fe,a as pe,i as me,s as he}from"./settingsLayout-DaLF8Hfm.js";import{a as V,c as ge,f as _e,i as ve,l as ye,m as H,n as be,o as xe,p as U,r as Se,s as Ce,t as we,u as Te}from"./KeybindingsSettings.logic-DbRWYCku.js";import{ba as Ee,er as De,tr as Oe}from"./main-BgKiw-9f.js";var W=r(),G=e(t(),1),K=e(_(),1);function q(e){let t=(0,W.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(ke),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,K.jsx)(r,{children:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function ke(e){let{part:t,key:n}=e;return(0,K.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 Ae(e){let t=(0,W.c)(11),{query:n,onChange:r,inputRef:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(se,{children:(0,K.jsx)(m,{"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,K.jsxs)(B,{className:`min-w-0 basis-full **:[input]:h-9 sm:basis-0 sm:flex-1 sm:**:[input]:h-8`,children:[a,(0,K.jsx)(ce,{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 je(e,t){return e.type===t?[...je(e.left,t),...je(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 Me(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 Ne(e,t){let n=Me(e);if(!n)return e;let r={type:`identifier`,name:t};return n.negated?{type:`not`,node:r}:r}function Pe(e,t){let n=Me(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:we}}function Fe(e=`and`){return{type:e,left:Y(),right:{type:`not`,node:Y()}}}function Ie(e){let t=(0,W.c)(14),{label:n,focusable:r,className:i,children:a}=e,o=r===void 0||r?0:void 0,s;t[0]===i?s=t[1]:(s=x(`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]=s);let c;t[2]!==n||t[3]!==o||t[4]!==s?(c=(0,K.jsx)(`span`,{tabIndex:o,"aria-label":n,className:s}),t[2]=n,t[3]=o,t[4]=s,t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,K.jsx)(h,{className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]===c?u=t[8]:(u=(0,K.jsx)(F,{render:c,children:l}),t[7]=c,t[8]=u);let d;t[9]===a?d=t[10]:(d=(0,K.jsx)(I,{side:`top`,children:a}),t[9]=a,t[10]=d);let f;return t[11]!==u||t[12]!==d?(f=(0,K.jsxs)(L,{children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function Le(e){let t=(0,W.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,K.jsx)(Ie,{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 X(e){let t=(0,W.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,K.jsxs)(Ie,{label:i,children:[i,` The most recent matching binding wins when both conditions can apply.`]}),t[2]=i,t[3]=a),a}function Re(e){let t=(0,W.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,K.jsx)(E,{placeholder:`Condition`}),t[11]=d):d=t[11];let f;t[12]===i?f=t[13]:(f=i&&i.length>0?(0,K.jsx)(Le,{identifiers:i,focusable:!1}):null,t[12]=i,t[13]=f);let p;t[14]===f?p=t[15]:(p=(0,K.jsxs)(O,{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(ze),t[16]=l,t[17]=m);let h;t[18]===m?h=t[19]:(h=(0,K.jsx)(D,{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,K.jsxs)(k,{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 ze(e){return(0,K.jsx)(T,{value:e,className:`w-full`,children:(0,K.jsx)(`span`,{className:`truncate`,children:e})},e)}function Be(e){let t=(0,W.c)(14),{label:n,className:r,onRemove:i}=e,a;t[0]===r?a=t[1]:(a=x(`size-7`,r),t[0]=r,t[1]=a);let o;t[2]!==n||t[3]!==i||t[4]!==a?(o=(0,K.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,K.jsx)(v,{"aria-hidden":!0,className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]===o?c=t[8]:(c=(0,K.jsx)(F,{delay:200,render:o,children:s}),t[7]=o,t[8]=c);let l;t[9]===n?l=t[10]:(l=(0,K.jsx)(I,{side:`top`,children:n}),t[9]=n,t[10]=l);let u;return t[11]!==c||t[12]!==l?(u=(0,K.jsxs)(L,{children:[c,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function Z(e){let t=(0,W.c)(81),{node:n,variables:r,depth:a,onChange:o,onRemove:s}=e,c=a===void 0?0:a,l;if(t[0]!==c||t[1]!==n||t[2]!==o||t[3]!==s||t[4]!==r){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Me(n);if(e){let i=Ce(e.identifier)?[]:[e.identifier],a;t[6]!==n||t[7]!==o?(a=e=>o(Pe(n,e)),t[6]=n,t[7]=o,t[8]=a):a=t[8];let u=`Negate ${e.identifier}`,d;t[9]!==e||t[10]!==a||t[11]!==u?(d=(0,K.jsx)(R,{pressed:e.negated,onPressedChange:a,"aria-label":u,variant:`outline`,size:`compact`,className:`min-w-10`,children:`Not`}),t[9]=e,t[10]=a,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==n||t[14]!==o?(f=e=>o(Ne(n,e)),t[13]=n,t[14]=o,t[15]=f):f=t[15];let p;t[16]!==e||t[17]!==f||t[18]!==i||t[19]!==r?(p=(0,K.jsx)(Re,{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]!==c||t[22]!==n||t[23]!==s?(m=s?(0,K.jsx)(Be,{label:H(n,c),onRemove:s}):null,t[21]=c,t[22]=n,t[23]=s,t[24]=m):m=t[24];let h;t[25]!==d||t[26]!==p||t[27]!==m?(h=(0,K.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],l=h;break bb0}}t[0]=c,t[1]=n,t[2]=o,t[3]=s,t[4]=r,t[5]=l}else l=t[5];if(l!==Symbol.for(`react.early_return_sentinel`))return l;if(n.type===`not`){let e=c>0&&`border-border/50 bg-background/50`,i;t[29]===e?i=t[30]:(i=x(`space-y-2 rounded-lg border border-border/70 bg-muted/20 p-2`,e),t[29]=e,t[30]=i);let a;t[31]!==n||t[32]!==o?(a=(0,K.jsx)(R,{pressed:!0,onPressedChange:e=>o(e?n:n.node),"aria-label":`Negate group`,variant:`outline`,size:`compact`,className:`min-w-10`,children:`Not`}),t[31]=n,t[32]=o,t[33]=a):a=t[33];let l;t[34]!==c||t[35]!==n||t[36]!==s?(l=s?(0,K.jsx)(Be,{label:H(n,c),className:`ml-auto`,onRemove:s}):null,t[34]=c,t[35]=n,t[36]=s,t[37]=l):l=t[37];let u;t[38]!==a||t[39]!==l?(u=(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a,l]}),t[38]=a,t[39]=l,t[40]=u):u=t[40];let d,f;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(`span`,{className:`absolute top-0 bottom-0 left-1.5 w-px bg-border/70`,"aria-hidden":!0}),f=(0,K.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=c+1,m;t[43]===o?m=t[44]:(m=e=>o({type:`not`,node:e}),t[43]=o,t[44]=m);let h;t[45]!==n.node||t[46]!==p||t[47]!==m||t[48]!==r?(h=(0,K.jsxs)(`div`,{className:`relative pl-4`,children:[d,f,(0,K.jsx)(Z,{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,K.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]!==c||t[55]!==n||t[56]!==o||t[57]!==s||t[58]!==u||t[59]!==r){let e=je(n,u),a=new Map,l=e.map(e=>{let t=`${e.type}-${U(e)}`,n=a.get(t)??0;return a.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&&o(i)},_=t=>{let n=!1,r=J(e.filter(e=>!n&&e===t?(n=!0,!1):!0),u);o(r||Y())},v=t=>{if(t===u)return;let n=J(e,t);n&&o(n)},y=()=>{let t=J([...e,Y()],u);t&&o(t)},b=()=>{let t={type:u===`and`?`or`:`and`,left:Y(),right:{type:`not`,node:Y()}},n=J([...e,t],u);n&&o(n)},S=c>0&&`border-border/70 bg-background/55`;t[64]===S?p=t[65]:(p=x(`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,K.jsx)(O,{size:`compact`,className:`w-24`,children:(0,K.jsx)(E,{})}),t[66]=C):C=t[66];let w;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,K.jsxs)(D,{alignItemWithTrigger:!1,matchTriggerWidth:!1,children:[(0,K.jsx)(T,{value:`and`,children:`and`}),(0,K.jsx)(T,{value:`or`,children:`or`})]}),t[67]=w):w=t[67];let A;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,K.jsx)(i,{className:`size-3.5`}),t[68]=A):A=t[68];let j;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,K.jsx)(i,{className:`size-3.5`}),t[69]=j):j=t[69];let M;t[70]!==c||t[71]!==n||t[72]!==s?(M=s?(0,K.jsx)(Be,{label:H(n,c),className:`ml-auto`,onRemove:s}):null,t[70]=c,t[71]=n,t[72]=s,t[73]=M):M=t[73],m=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(k,{value:u,onValueChange:e=>v(e),children:[C,w]}),(0,K.jsxs)(g,{type:`button`,variant:`outline`,size:`compact`,onClick:y,children:[A,`Condition`]}),(0,K.jsxs)(g,{type:`button`,variant:`outline`,size:`compact`,onClick:b,children:[j,`Group`]}),M]}),d=`space-y-2`,f=l.map(e=>{let{child:t,key:n}=e;return(0,K.jsxs)(`div`,{className:`relative pl-4`,children:[(0,K.jsx)(`span`,{className:x(`absolute top-0 bottom-0 left-1.5 w-px`,c===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,K.jsx)(`span`,{className:x(`absolute top-4 left-1.5 h-px w-2.5`,c===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,K.jsx)(Z,{node:t,variables:r,depth:c+1,onChange:e=>h(t,e),onRemove:()=>_(t)})]},n)}),t[54]=c,t[55]=n,t[56]=o,t[57]=s,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,K.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,K.jsxs)(`div`,{className:p,children:[m,h]}),t[77]=p,t[78]=m,t[79]=h,t[80]=_):_=t[80],_}function Ve(e){let t=(0,W.c)(60),{value:n,variables:r,onChange:o,onValidityChange:s}=e,c;t[0]===n?c=t[1]:(c=U(n),t[0]=n,t[1]=c);let[l,u]=(0,G.useState)(c),d;t[2]===l?d=t[3]:(d=Te(l),t[2]=l,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]!==o||t[8]!==s?(_=e=>{u(e);let t=Te(e);s?.(t.ok),t.ok&&o(t.value)},t[7]=o,t[8]=s,t[9]=_):_=t[9];let v=_,y;t[10]!==o||t[11]!==s?(y=e=>{u(U(e)),s?.(!0),o(e)},t[10]=o,t[11]=s,t[12]=y):y=t[12];let b=y,x;t[13]!==b||t[14]!==n?(x=()=>{if(!n){b(Y());return}b({type:`and`,left:n,right: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=Fe(`or`);if(!n){b(e);return}b({type:`and`,left:n,right: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,K.jsx)(`div`,{className:`min-w-0`,children:(0,K.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,K.jsx)(i,{className:`size-3.5`}),t[20]=E):E=t[20];let D;t[21]===S?D=t[22]:(D=(0,K.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,K.jsx)(i,{className:`size-3.5`}),t[23]=O):O=t[23];let k;t[24]===w?k=t[25]:(k=(0,K.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,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,(0,K.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,ee;t[31]!==l||t[32]!==j||t[33]!==M?(ee=(0,K.jsx)(ce,{value:l,onChange:j,placeholder:`Always`,"aria-invalid":M,"aria-label":`When expression`,size:`compact`,font:`mono`}),t[31]=l,t[32]=j,t[33]=M,t[34]=ee):ee=t[34];let N;t[35]===h?N=t[36]:(N=h.length>0?(0,K.jsx)(se,{align:`inline-end`,children:(0,K.jsx)(Le,{identifiers:h})}):null,t[35]=h,t[36]=N);let te;t[37]!==ee||t[38]!==N?(te=(0,K.jsxs)(B,{children:[ee,N]}),t[37]=ee,t[38]=N,t[39]=te):te=t[39];let P;t[40]===p?P=t[41]:(P=p?(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-2xs text-destructive`,children:[(0,K.jsx)(a,{className:`size-3.5`}),p]}):null,t[40]=p,t[41]=P);let ne;t[42]!==te||t[43]!==P?(ne=(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[te,P]}),t[42]=te,t[43]=P,t[44]=ne):ne=t[44];let F;t[45]!==S||t[46]!==w||t[47]!==b||t[48]!==n||t[49]!==r?(F=n?(0,K.jsx)(Z,{node:n,variables:r,onChange:b,onRemove:()=>b(void 0)}):(0,K.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/15 p-3`,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsxs)(g,{type:`button`,size:`compact`,onClick:S,children:[(0,K.jsx)(i,{className:`size-3.5`}),`Condition`]}),(0,K.jsxs)(g,{type:`button`,variant:`outline`,size:`compact`,onClick:w,children:[(0,K.jsx)(i,{className:`size-3.5`}),`Group`]})]})}),t[45]=S,t[46]=w,t[47]=b,t[48]=n,t[49]=r,t[50]=F):F=t[50];let I;t[51]===p?I=t[52]:(I=p?(0,K.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]=I);let L;t[53]!==F||t[54]!==I?(L=(0,K.jsxs)(`div`,{className:`relative`,children:[F,I]}),t[53]=F,t[54]=I,t[55]=L):L=t[55];let R;return t[56]!==A||t[57]!==ne||t[58]!==L?(R=(0,K.jsxs)(`div`,{className:`w-[min(34rem,calc(100vw-2rem))] space-y-3`,children:[A,ne,L]}),t[56]=A,t[57]=ne,t[58]=L,t[59]=R):R=t[59],R}function He(e){return{keyDraft:e.key,whenDraft:e.binding.whenAst,isRecording:!1,isWhenDraftValid:!0}}function Q(e,t){return{...e,...t}}function Ue(e){return{command:e.command,key:e.key,...e.when.trim().length>0?{when:e.when}:{}}}function We(e){let t=(0,W.c)(27),{row:n,allRows:r,onSave:i}=e,[a,o]=(0,G.useReducer)(Q,n,He),{keyDraft:s,whenDraft:c,isRecording:l,isWhenDraftValid:u}=a,d,f,p;t[0]!==r||t[1]!==s||t[2]!==n.id||t[3]!==n.key||t[4]!==n.when||t[5]!==c?(p=U(c),d=s!==n.key||p!==n.when,f=ge(r,{rowId:n.id,key:s,when:p}),t[0]=r,t[1]=s,t[2]=n.id,t[3]=n.key,t[4]=n.when,t[5]=c,t[6]=d,t[7]=f,t[8]=p):(d=t[6],f=t[7],p=t[8]);let m=f,h;t[9]!==s||t[10]!==i||t[11]!==n||t[12]!==p?(h=()=>{i({command:n.command,key:s,when:p.trim().length>0?p:void 0,replace:Ue(n)})},t[9]=s,t[10]=i,t[11]=n,t[12]=p,t[13]=h):h=t[13];let g=h,_;t[14]!==l||t[15]!==n.key?(_=e=>{if(e.key===`Tab`&&!l)return;if(e.preventDefault(),e.key===`Escape`){o({keyDraft:n.key,isRecording:!1});return}let t=ye(e.nativeEvent,navigator.platform);t&&o({keyDraft:t,isRecording:!1})},t[14]=l,t[15]=n.key,t[16]=_):_=t[16];let v=_,y;return t[17]!==v||t[18]!==m||t[19]!==d||t[20]!==l||t[21]!==u||t[22]!==s||t[23]!==g||t[24]!==c||t[25]!==p?(y={keyDraft:s,whenDraft:c,isRecording:l,isWhenDraftValid:u,whenDraftExpression:p,isDirty:d,conflictLabels:m,setDraft:o,save:g,captureKeybinding:v},t[17]=v,t[18]=m,t[19]=d,t[20]=l,t[21]=u,t[22]=s,t[23]=g,t[24]=c,t[25]=p,t[26]=y):y=t[26],y}function Ge(e){let t=(0,W.c)(19),{row:n,editor:r,isSaving:i,pillClassName:a}=e,{keyDraft:o,isRecording:s,isDirty:c,isWhenDraftValid:l,setDraft:u,save:d,captureKeybinding:f}=r,p=!s&&o===n.key&&n.key.length>0&&!c,m;t[0]!==c||t[1]!==i||t[2]!==l||t[3]!==o||t[4]!==d?(m=c?(0,K.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]=m):m=t[5];let h;t[6]!==f||t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==n.binding||t[11]!==n.command||t[12]!==n.key||t[13]!==u||t[14]!==p?(h=p?(0,K.jsx)(`button`,{type:`button`,onClick:()=>u({isRecording:!0}),"aria-label":`Edit shortcut for ${V(n.command)}: ${ie(n.binding.shortcut)}`,className:x(`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,K.jsx)(q,{value:n.key})}):(0,K.jsx)(re,{"data-keybinding-capture":``,autoFocus:s,"aria-label":`Keybinding for ${V(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]=n.binding,t[11]=n.command,t[12]=n.key,t[13]=u,t[14]=p,t[15]=h):h=t[15];let _;return t[16]!==m||t[17]!==h?(_=(0,K.jsxs)(K.Fragment,{children:[m,h]}),t[16]=m,t[17]=h,t[18]=_):_=t[18],_}function $(e){let t=(0,W.c)(17),{label:n,expression:r,value:i,variables:a,onChange:o,onValidityChange:s}=e,c=r?`ghost`:`ghost-muted`,l;t[0]===c?l=t[1]:(l=(0,K.jsx)(g,{variant:c,size:`micro`,className:`min-w-0 shrink`}),t[0]=c,t[1]=l);let u=`Edit when clause for ${n}`,d=r||`Always`,f;t[2]===d?f=t[3]:(f=(0,K.jsx)(`span`,{className:`truncate font-mono`,children:d}),t[2]=d,t[3]=f);let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,K.jsx)(S,{className:`size-3.5 shrink-0 opacity-60`}),t[4]=p):p=t[4];let m;t[5]!==l||t[6]!==u||t[7]!==f?(m=(0,K.jsxs)(oe,{render:l,"aria-label":u,children:[f,p]}),t[5]=l,t[6]=u,t[7]=f,t[8]=m):m=t[8];let h;t[9]!==o||t[10]!==s||t[11]!==i||t[12]!==a?(h=(0,K.jsx)(ae,{align:`start`,sideOffset:6,children:(0,K.jsx)(Ve,{value:i,variables:a,onChange:o,onValidityChange:s})}),t[9]=o,t[10]=s,t[11]=i,t[12]=a,t[13]=h):h=t[13];let _;return t[14]!==m||t[15]!==h?(_=(0,K.jsxs)(z,{children:[m,h]}),t[14]=m,t[15]=h,t[16]=_):_=t[16],_}function Ke(e){let t=(0,W.c)(24),{row:r,isSaving:i,onReset:a,onRemove:o}=e,s=r.source===`Custom`&&r.defaultKey!==null,c=r.source!==`Default`;if(!s&&!c)return null;let l;t[0]===r.command?l=t[1]:(l=V(r.command),t[0]=r.command,t[1]=l);let u=`Actions for ${l}`,m;t[2]!==i||t[3]!==u?(m=(0,K.jsx)(g,{type:`button`,variant:`ghost-muted`,size:`icon-sm`,disabled:i,"aria-label":u}),t[2]=i,t[3]=u,t[4]=m):m=t[4];let h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsx)(d,{className:`size-3.5`}),t[5]=h):h=t[5];let _;t[6]===m?_=t[7]:(_=(0,K.jsx)(p,{render:m,children:h}),t[6]=m,t[7]=_);let v;t[8]!==s||t[9]!==i||t[10]!==a||t[11]!==r?(v=s?(0,K.jsx)(f,{disabled:i,onClick:()=>a(r),children:`Reset to default`}):null,t[8]=s,t[9]=i,t[10]=a,t[11]=r,t[12]=v):v=t[12];let b;t[13]!==c||t[14]!==i||t[15]!==o||t[16]!==r?(b=c?(0,K.jsx)(f,{variant:`destructive`,disabled:i,onClick:()=>o(r),children:`Remove`}):null,t[13]=c,t[14]=i,t[15]=o,t[16]=r,t[17]=b):b=t[17];let x;t[18]!==v||t[19]!==b?(x=(0,K.jsxs)(n,{align:`end`,children:[v,b]}),t[18]=v,t[19]=b,t[20]=x):x=t[20];let S;return t[21]!==_||t[22]!==x?(S=(0,K.jsxs)(y,{children:[_,x]}),t[21]=_,t[22]=x,t[23]=S):S=t[23],S}function qe(e){let t=(0,W.c)(2),{source:n}=e;if(n===`Default`)return null;let r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(s,{variant:`outline`,size:`sm`,children:n}),t[0]=n,t[1]=r),r}function Je(e){let t=(0,W.c)(13),{row:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,K.jsx)(`span`,{className:`flex items-center gap-2`}),t[0]=r):r=t[0];let i;t[1]===n.command?i=t[2]:(i=V(n.command),t[1]=n.command,t[2]=i);let a;t[3]===n.source?a=t[4]:(a=(0,K.jsx)(qe,{source:n.source}),t[3]=n.source,t[4]=a);let o;t[5]!==i||t[6]!==a?(o=(0,K.jsxs)(F,{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,K.jsx)(I,{side:`top`,children:n.command}),t[8]=n.command,t[9]=s);let c;return t[10]!==o||t[11]!==s?(c=(0,K.jsxs)(L,{children:[o,s]}),t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function Ye(e){let t=(0,W.c)(13),{row:n,editor:r,variables:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.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=V(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,K.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[a,(0,K.jsx)($,{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 Xe(e){let t=(0,W.c)(2),n;return t[0]===e?n=t[1]:(n=(0,K.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,K.jsx)(Ke,{...e})}),t[0]=e,t[1]=n),n}function Ze(e){let t=(0,W.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=We(u),f;t[4]===n?f=t[5]:(f=(0,K.jsx)(Je,{row:n}),t[4]=n,t[5]=f);let p;t[6]!==d||t[7]!==n||t[8]!==o?(p=(0,K.jsx)(Ye,{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,K.jsx)(X,{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,K.jsx)(Xe,{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,K.jsx)(Ge,{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,K.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,K.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 Qe(e){let t=(0,W.c)(30),{allRows:n,onSave:r}=e,[i,a]=(0,G.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,G.useReducer)(Q,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?V(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`){c({keyDraft:``,isRecording:!1});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 $e(e){let t=(0,W.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,K.jsx)(E,{placeholder:`Command`}),t[2]=s):s=t[2];let c;t[3]===i?c=t[4]:(c=(0,K.jsx)(O,{size:`sm`,className:i,children:s}),t[3]=i,t[4]=c);let l;t[5]===r?l=t[6]:(l=r.map(et),t[5]=r,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,K.jsx)(D,{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,K.jsxs)(k,{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 et(e){return(0,K.jsx)(T,{value:e,className:`w-full`,children:(0,K.jsx)(`span`,{className:`truncate`,children:V(e)})},e)}function tt(e){let t=(0,W.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,K.jsx)(re,{"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 nt(e){let t=(0,W.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,K.jsx)($,{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 rt(e){let t=(0,W.c)(9),{isSaving:n,onCancel:r}=e,i;t[0]!==n||t[1]!==r?(i=(0,K.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,K.jsx)(o,{className:`size-3.5`}),t[3]=a):a=t[3];let s;t[4]===i?s=t[5]:(s=(0,K.jsx)(F,{render:i,children:a}),t[4]=i,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,K.jsx)(I,{side:`top`,children:`Cancel`}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(0,K.jsxs)(L,{children:[s,c]}),t[7]=s,t[8]=l),l}function it(e){let t=(0,W.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=Qe(c),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.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,K.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[u,(0,K.jsx)(nt,{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,K.jsx)($e,{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,K.jsx)(X,{labels:l.conflictLabels}),t[10]=l.conflictLabels,t[11]=p);let m;t[12]===l?m=t[13]:(m=(0,K.jsx)(tt,{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,K.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,K.jsx)(rt,{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,K.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,K.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 at(e){let{groups:t,anchorIds:n,savingCommand:r,...i}=e;return t.map(e=>(0,K.jsx)(he,{id:`keybindings-${e.id}`,title:e.title,children:e.rows.map(e=>(0,K.jsx)(Ze,{row:e,anchorId:n.get(e.id),isSaving:r===e.command,...i},e.id))},e.id))}function ot(){let e=(0,W.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{delay:200,render:(0,K.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,K.jsx)(h,{className:`size-3.5 text-warning`})})}),(0,K.jsx)(I,{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 st(){let e=(0,W.c)(83),{environment:t,connectedEnvironments:n}=de(),r=ee(t?.environmentId??null,u),a=te(n,c),o;e[0]!==n||e[1]!==a?(o=n.length>0&&n.every(e=>a.has(e.environmentId)),e[0]=n,e[1]=a,e[2]=o):o=e[2];let s=o,d=t?.serverConfig?.keybindings,f;e[3]===d?f=e[4]:(f=d??[],e[3]=d,e[4]=f);let p;e[5]===f?p=e[6]:(p=l(f),e[5]=f,e[6]=p);let m=p,h=t?.serverConfig?.keybindingsConfigPath??null,_;e[7]===t?.serverConfig?.availableEditors?_=e[8]:(_=t?.serverConfig?.availableEditors??[],e[7]=t?.serverConfig?.availableEditors,e[8]=_);let v=_,y;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(y={reportFailure:!1},e[9]=y):y=e[9];let x=P(M.upsertKeybinding,y),S;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(S={reportFailure:!1},e[10]=S):S=e[10];let T=P(M.removeKeybinding,S),E=Ee(t?.environmentId??null,v),[D,O]=(0,G.useState)(``),k=(0,G.useRef)(null),[R,re]=(0,G.useState)(null),[ie,ae]=(0,G.useState)(!1),oe;e[11]!==m||e[12]!==D?(oe=Se(m,D),e[11]=m,e[12]=D,e[13]=oe):oe=e[13];let z=oe,se;e[14]===z?se=e[15]:(se=xe(z),e[14]=z,e[15]=se);let ce=se,B;if(e[16]!==z){B=new Map;let t=new Set;for(let e of z)t.has(e.command)||(t.add(e.command),B.set(e.id,De(e.command)));e[16]=z,e[17]=B}else B=e[17];let le=B,ue;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(ue={select:ft},e[18]=ue):ue=e[18];let pe=A(ue),[V,ge]=(0,G.useState)(pe);pe!==V&&(ge(pe),pe.startsWith(`keybinding-`)&&O(``));let _e;e[19]===m?_e=e[20]:(_e=be(m),e[19]=m,e[20]=_e);let ye=_e,H;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(H=ve(),e[21]=H):H=e[21];let U=H,Ce;e[22]!==h||e[23]!==E||e[24]!==t?(Ce=()=>{h&&t&&N(t.environmentId,`orchestration:operate`)&&(async()=>{let e=await E(h);if(e._tag===`Success`||C(e))return;let t=w(e);j.add({title:`Unable to open keybindings file`,description:t instanceof Error?t.message:`The keybindings file was not opened.`,type:`error`})})()},e[22]=h,e[23]=E,e[24]=t,e[25]=Ce):Ce=e[25];let we=Ce,Te;e[26]!==n||e[27]!==t||e[28]!==x?(Te=e=>{if(!t||!n.every(dt))return;re(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=>x({environmentId:e.environmentId,input:r})));re(null);let t=e.find(ut);if(!t){ae(!1);return}if(!C(t)){let e=w(t);j.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]=x,e[29]=Te):Te=e[29];let q=Te,ke;e[30]!==n||e[31]!==t||e[32]!==T?(ke=e=>{t&&n.every(lt)&&(re(e.command),(async()=>{let t=await Promise.all(n.map(t=>T({environmentId:t.environmentId,input:Ue(e)})));re(null);let r=t.find(ct)??t[0];if(r?._tag===`Failure`&&!C(r)){let e=w(r);j.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]=T,e[33]=ke):ke=e[33];let je=ke,J;e[34]===q?J=e[35]:(J=e=>{e.defaultKey&&q({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]=q,e[35]=J);let Me=J,Ne;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=()=>ae(!1),e[36]=Ne):Ne=e[36];let Pe=Ne,Y;e[37]!==je||e[38]!==Me||e[39]!==z||e[40]!==q?(Y={allRows:z,variables:U,onSave:q,onReset:Me,onRemove:je},e[37]=je,e[38]=Me,e[39]=z,e[40]=q,e[41]=Y):Y=e[41];let Fe=Y,Ie,Le;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=Oe(`keybindings`),Le=ne?null:(0,K.jsx)(ot,{}),e[42]=Ie,e[43]=Le):(Ie=e[42],Le=e[43]);let X;e[44]===D?X=e[45]:(X=(0,K.jsx)(Ae,{query:D,onChange:O,inputRef:k}),e[44]=D,e[45]=X);let Re=ie||!s,ze,Be;e[46]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>ae(!0),Be=(0,K.jsx)(i,{"aria-hidden":!0,className:`size-4`}),e[46]=ze,e[47]=Be):(ze=e[46],Be=e[47]);let Z;e[48]===Re?Z=e[49]:(Z=(0,K.jsxs)(g,{type:`button`,variant:`outline`,disabled:Re,onClick:ze,children:[Be,`Add keybinding`]}),e[48]=Re,e[49]=Z);let Ve=!h||!r,He;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,K.jsx)(b,{"aria-hidden":!0,className:`size-4`}),e[50]=He):He=e[50];let Q;e[51]!==we||e[52]!==Ve?(Q=(0,K.jsx)(F,{render:(0,K.jsx)(g,{type:`button`,variant:`outline`,size:`icon`,disabled:Ve,onClick:we,"aria-label":`Open keybindings.json`,children:He})}),e[51]=we,e[52]=Ve,e[53]=Q):Q=e[53];let We;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,K.jsx)(I,{side:`top`,children:`Open keybindings.json`}),e[54]=We):We=e[54];let Ge;e[55]===Q?Ge=e[56]:(Ge=(0,K.jsxs)(L,{children:[Q,We]}),e[55]=Q,e[56]=Ge);let $;e[57]!==X||e[58]!==Z||e[59]!==Ge?($=(0,K.jsx)(he,{...Ie,headerAction:Le,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-3 sm:px-4`,children:[X,Z,Ge]})}),e[57]=X,e[58]=Z,e[59]=Ge,e[60]=$):$=e[60];let Ke;e[61]!==s||e[62]!==n?(Ke=s?null:(0,K.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]=Ke):Ke=e[63];let qe=!s,Je;e[64]!==ye||e[65]!==ie||e[66]!==z||e[67]!==q||e[68]!==R?(Je=ie?(0,K.jsx)(fe,{children:(0,K.jsx)(it,{commandOptions:ye,allRows:z,variables:U,isSaving:R!==null,onSave:q,onCancel:Pe})}):null,e[64]=ye,e[65]=ie,e[66]=z,e[67]=q,e[68]=R,e[69]=Je):Je=e[69];let Ye;e[70]!==le||e[71]!==ce||e[72]!==Fe||e[73]!==R?(Ye=ce.length>0?(0,K.jsx)(at,{groups:ce,anchorIds:le,savingCommand:R,...Fe}):(0,K.jsx)(fe,{children:(0,K.jsx)(`div`,{className:`px-4 py-12 text-center text-sm text-muted-foreground`,children:`No keybindings match your search.`})}),e[70]=le,e[71]=ce,e[72]=Fe,e[73]=R,e[74]=Ye):Ye=e[74];let Xe;e[75]!==qe||e[76]!==Je||e[77]!==Ye?(Xe=(0,K.jsxs)(`div`,{inert:qe,className:`flex flex-col gap-8`,children:[Je,Ye]}),e[75]=qe,e[76]=Je,e[77]=Ye,e[78]=Xe):Xe=e[78];let Ze;return e[79]!==$||e[80]!==Ke||e[81]!==Xe?(Ze=(0,K.jsxs)(me,{children:[$,Ke,Xe]}),e[79]=$,e[80]=Ke,e[81]=Xe,e[82]=Ze):Ze=e[82],Ze}function ct(e){return e._tag===`Failure`}function lt(e){return N(e.environmentId,c)}function ut(e){return e._tag===`Failure`}function dt(e){return N(e.environmentId,c)}function ft(e){return e.hash.replace(/^#/,``)}var pt=st;export{pt as component};
2
- //# sourceMappingURL=settings.keybindings-Bcl4KxN4.js.map
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$n as n,BE as r,Bp as i,Fd as a,Jm as o,Kn as s,O_ as c,Pc as l,S_ as u,Xd as d,Zn as f,cr as p,em as m,jm as h,lr as g,mE as _,pp as v,qn as y,rf as b,t as x,xd as S}from"./utils-B0w8dSf5.js";import{R as C,W as w}from"./runtime-D2c--mqA.js";import{a as T,c as E,o as D,s as O,t as k}from"./select-CqPGedM1.js";import{t as A}from"./useLocation-XbiRdmmb.js";import{i as j}from"./toast-VoruYA6X.js";import{f as M}from"./server-DZYI6rhH.js";import{i as ee,n as N,o as te}from"./session-DhEZhn9K.js";import{t as P}from"./use-atom-command-DrwAZaSK.js";import{t as ne}from"./env-wK1YYxA8.js";import{a as F,n as I,t as L}from"./tooltip-CuJiZzK7.js";import{t as R}from"./toggle-DTjg9Rvs.js";import{t as re}from"./input-CDBTiBJx.js";import{i as ie}from"./keybindings-4i_VvPsX.js";import{i as ae,o as oe,t as z}from"./popover-N-pn4OqA.js";import{n as se,r as ce,t as B}from"./input-group-CHJvPXpi.js";import{n as le,t as ue}from"./kbd-BGpxKPhX.js";import{B as de,U as fe,a as pe,i as me,s as he}from"./settingsLayout-C1Jfxbij.js";import{a as V,c as ge,f as _e,i as ve,l as ye,m as H,n as be,o as xe,p as U,r as Se,s as Ce,t as we,u as Te}from"./KeybindingsSettings.logic-DbRWYCku.js";import{ba as Ee,er as De,tr as Oe}from"./main-CSxSeVCm.js";var W=r(),G=e(t(),1),K=e(_(),1);function q(e){let t=(0,W.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(ke),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,K.jsx)(r,{children:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function ke(e){let{part:t,key:n}=e;return(0,K.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 Ae(e){let t=(0,W.c)(11),{query:n,onChange:r,inputRef:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(se,{children:(0,K.jsx)(m,{"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,K.jsxs)(B,{className:`min-w-0 basis-full **:[input]:h-9 sm:basis-0 sm:flex-1 sm:**:[input]:h-8`,children:[a,(0,K.jsx)(ce,{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 je(e,t){return e.type===t?[...je(e.left,t),...je(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 Me(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 Ne(e,t){let n=Me(e);if(!n)return e;let r={type:`identifier`,name:t};return n.negated?{type:`not`,node:r}:r}function Pe(e,t){let n=Me(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:we}}function Fe(e=`and`){return{type:e,left:Y(),right:{type:`not`,node:Y()}}}function Ie(e){let t=(0,W.c)(14),{label:n,focusable:r,className:i,children:a}=e,o=r===void 0||r?0:void 0,s;t[0]===i?s=t[1]:(s=x(`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]=s);let c;t[2]!==n||t[3]!==o||t[4]!==s?(c=(0,K.jsx)(`span`,{tabIndex:o,"aria-label":n,className:s}),t[2]=n,t[3]=o,t[4]=s,t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,K.jsx)(h,{className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]===c?u=t[8]:(u=(0,K.jsx)(F,{render:c,children:l}),t[7]=c,t[8]=u);let d;t[9]===a?d=t[10]:(d=(0,K.jsx)(I,{side:`top`,children:a}),t[9]=a,t[10]=d);let f;return t[11]!==u||t[12]!==d?(f=(0,K.jsxs)(L,{children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function Le(e){let t=(0,W.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,K.jsx)(Ie,{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 X(e){let t=(0,W.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,K.jsxs)(Ie,{label:i,children:[i,` The most recent matching binding wins when both conditions can apply.`]}),t[2]=i,t[3]=a),a}function Re(e){let t=(0,W.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,K.jsx)(E,{placeholder:`Condition`}),t[11]=d):d=t[11];let f;t[12]===i?f=t[13]:(f=i&&i.length>0?(0,K.jsx)(Le,{identifiers:i,focusable:!1}):null,t[12]=i,t[13]=f);let p;t[14]===f?p=t[15]:(p=(0,K.jsxs)(O,{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(ze),t[16]=l,t[17]=m);let h;t[18]===m?h=t[19]:(h=(0,K.jsx)(D,{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,K.jsxs)(k,{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 ze(e){return(0,K.jsx)(T,{value:e,className:`w-full`,children:(0,K.jsx)(`span`,{className:`truncate`,children:e})},e)}function Be(e){let t=(0,W.c)(14),{label:n,className:r,onRemove:i}=e,a;t[0]===r?a=t[1]:(a=x(`size-7`,r),t[0]=r,t[1]=a);let o;t[2]!==n||t[3]!==i||t[4]!==a?(o=(0,K.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,K.jsx)(v,{"aria-hidden":!0,className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]===o?c=t[8]:(c=(0,K.jsx)(F,{delay:200,render:o,children:s}),t[7]=o,t[8]=c);let l;t[9]===n?l=t[10]:(l=(0,K.jsx)(I,{side:`top`,children:n}),t[9]=n,t[10]=l);let u;return t[11]!==c||t[12]!==l?(u=(0,K.jsxs)(L,{children:[c,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function Z(e){let t=(0,W.c)(81),{node:n,variables:r,depth:a,onChange:o,onRemove:s}=e,c=a===void 0?0:a,l;if(t[0]!==c||t[1]!==n||t[2]!==o||t[3]!==s||t[4]!==r){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Me(n);if(e){let i=Ce(e.identifier)?[]:[e.identifier],a;t[6]!==n||t[7]!==o?(a=e=>o(Pe(n,e)),t[6]=n,t[7]=o,t[8]=a):a=t[8];let u=`Negate ${e.identifier}`,d;t[9]!==e||t[10]!==a||t[11]!==u?(d=(0,K.jsx)(R,{pressed:e.negated,onPressedChange:a,"aria-label":u,variant:`outline`,size:`compact`,className:`min-w-10`,children:`Not`}),t[9]=e,t[10]=a,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==n||t[14]!==o?(f=e=>o(Ne(n,e)),t[13]=n,t[14]=o,t[15]=f):f=t[15];let p;t[16]!==e||t[17]!==f||t[18]!==i||t[19]!==r?(p=(0,K.jsx)(Re,{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]!==c||t[22]!==n||t[23]!==s?(m=s?(0,K.jsx)(Be,{label:H(n,c),onRemove:s}):null,t[21]=c,t[22]=n,t[23]=s,t[24]=m):m=t[24];let h;t[25]!==d||t[26]!==p||t[27]!==m?(h=(0,K.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],l=h;break bb0}}t[0]=c,t[1]=n,t[2]=o,t[3]=s,t[4]=r,t[5]=l}else l=t[5];if(l!==Symbol.for(`react.early_return_sentinel`))return l;if(n.type===`not`){let e=c>0&&`border-border/50 bg-background/50`,i;t[29]===e?i=t[30]:(i=x(`space-y-2 rounded-lg border border-border/70 bg-muted/20 p-2`,e),t[29]=e,t[30]=i);let a;t[31]!==n||t[32]!==o?(a=(0,K.jsx)(R,{pressed:!0,onPressedChange:e=>o(e?n:n.node),"aria-label":`Negate group`,variant:`outline`,size:`compact`,className:`min-w-10`,children:`Not`}),t[31]=n,t[32]=o,t[33]=a):a=t[33];let l;t[34]!==c||t[35]!==n||t[36]!==s?(l=s?(0,K.jsx)(Be,{label:H(n,c),className:`ml-auto`,onRemove:s}):null,t[34]=c,t[35]=n,t[36]=s,t[37]=l):l=t[37];let u;t[38]!==a||t[39]!==l?(u=(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a,l]}),t[38]=a,t[39]=l,t[40]=u):u=t[40];let d,f;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(`span`,{className:`absolute top-0 bottom-0 left-1.5 w-px bg-border/70`,"aria-hidden":!0}),f=(0,K.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=c+1,m;t[43]===o?m=t[44]:(m=e=>o({type:`not`,node:e}),t[43]=o,t[44]=m);let h;t[45]!==n.node||t[46]!==p||t[47]!==m||t[48]!==r?(h=(0,K.jsxs)(`div`,{className:`relative pl-4`,children:[d,f,(0,K.jsx)(Z,{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,K.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]!==c||t[55]!==n||t[56]!==o||t[57]!==s||t[58]!==u||t[59]!==r){let e=je(n,u),a=new Map,l=e.map(e=>{let t=`${e.type}-${U(e)}`,n=a.get(t)??0;return a.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&&o(i)},_=t=>{let n=!1,r=J(e.filter(e=>!n&&e===t?(n=!0,!1):!0),u);o(r||Y())},v=t=>{if(t===u)return;let n=J(e,t);n&&o(n)},y=()=>{let t=J([...e,Y()],u);t&&o(t)},b=()=>{let t={type:u===`and`?`or`:`and`,left:Y(),right:{type:`not`,node:Y()}},n=J([...e,t],u);n&&o(n)},S=c>0&&`border-border/70 bg-background/55`;t[64]===S?p=t[65]:(p=x(`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,K.jsx)(O,{size:`compact`,className:`w-24`,children:(0,K.jsx)(E,{})}),t[66]=C):C=t[66];let w;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,K.jsxs)(D,{alignItemWithTrigger:!1,matchTriggerWidth:!1,children:[(0,K.jsx)(T,{value:`and`,children:`and`}),(0,K.jsx)(T,{value:`or`,children:`or`})]}),t[67]=w):w=t[67];let A;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,K.jsx)(i,{className:`size-3.5`}),t[68]=A):A=t[68];let j;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,K.jsx)(i,{className:`size-3.5`}),t[69]=j):j=t[69];let M;t[70]!==c||t[71]!==n||t[72]!==s?(M=s?(0,K.jsx)(Be,{label:H(n,c),className:`ml-auto`,onRemove:s}):null,t[70]=c,t[71]=n,t[72]=s,t[73]=M):M=t[73],m=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(k,{value:u,onValueChange:e=>v(e),children:[C,w]}),(0,K.jsxs)(g,{type:`button`,variant:`outline`,size:`compact`,onClick:y,children:[A,`Condition`]}),(0,K.jsxs)(g,{type:`button`,variant:`outline`,size:`compact`,onClick:b,children:[j,`Group`]}),M]}),d=`space-y-2`,f=l.map(e=>{let{child:t,key:n}=e;return(0,K.jsxs)(`div`,{className:`relative pl-4`,children:[(0,K.jsx)(`span`,{className:x(`absolute top-0 bottom-0 left-1.5 w-px`,c===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,K.jsx)(`span`,{className:x(`absolute top-4 left-1.5 h-px w-2.5`,c===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,K.jsx)(Z,{node:t,variables:r,depth:c+1,onChange:e=>h(t,e),onRemove:()=>_(t)})]},n)}),t[54]=c,t[55]=n,t[56]=o,t[57]=s,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,K.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,K.jsxs)(`div`,{className:p,children:[m,h]}),t[77]=p,t[78]=m,t[79]=h,t[80]=_):_=t[80],_}function Ve(e){let t=(0,W.c)(60),{value:n,variables:r,onChange:o,onValidityChange:s}=e,c;t[0]===n?c=t[1]:(c=U(n),t[0]=n,t[1]=c);let[l,u]=(0,G.useState)(c),d;t[2]===l?d=t[3]:(d=Te(l),t[2]=l,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]!==o||t[8]!==s?(_=e=>{u(e);let t=Te(e);s?.(t.ok),t.ok&&o(t.value)},t[7]=o,t[8]=s,t[9]=_):_=t[9];let v=_,y;t[10]!==o||t[11]!==s?(y=e=>{u(U(e)),s?.(!0),o(e)},t[10]=o,t[11]=s,t[12]=y):y=t[12];let b=y,x;t[13]!==b||t[14]!==n?(x=()=>{if(!n){b(Y());return}b({type:`and`,left:n,right: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=Fe(`or`);if(!n){b(e);return}b({type:`and`,left:n,right: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,K.jsx)(`div`,{className:`min-w-0`,children:(0,K.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,K.jsx)(i,{className:`size-3.5`}),t[20]=E):E=t[20];let D;t[21]===S?D=t[22]:(D=(0,K.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,K.jsx)(i,{className:`size-3.5`}),t[23]=O):O=t[23];let k;t[24]===w?k=t[25]:(k=(0,K.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,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,(0,K.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,ee;t[31]!==l||t[32]!==j||t[33]!==M?(ee=(0,K.jsx)(ce,{value:l,onChange:j,placeholder:`Always`,"aria-invalid":M,"aria-label":`When expression`,size:`compact`,font:`mono`}),t[31]=l,t[32]=j,t[33]=M,t[34]=ee):ee=t[34];let N;t[35]===h?N=t[36]:(N=h.length>0?(0,K.jsx)(se,{align:`inline-end`,children:(0,K.jsx)(Le,{identifiers:h})}):null,t[35]=h,t[36]=N);let te;t[37]!==ee||t[38]!==N?(te=(0,K.jsxs)(B,{children:[ee,N]}),t[37]=ee,t[38]=N,t[39]=te):te=t[39];let P;t[40]===p?P=t[41]:(P=p?(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-2xs text-destructive`,children:[(0,K.jsx)(a,{className:`size-3.5`}),p]}):null,t[40]=p,t[41]=P);let ne;t[42]!==te||t[43]!==P?(ne=(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[te,P]}),t[42]=te,t[43]=P,t[44]=ne):ne=t[44];let F;t[45]!==S||t[46]!==w||t[47]!==b||t[48]!==n||t[49]!==r?(F=n?(0,K.jsx)(Z,{node:n,variables:r,onChange:b,onRemove:()=>b(void 0)}):(0,K.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/15 p-3`,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsxs)(g,{type:`button`,size:`compact`,onClick:S,children:[(0,K.jsx)(i,{className:`size-3.5`}),`Condition`]}),(0,K.jsxs)(g,{type:`button`,variant:`outline`,size:`compact`,onClick:w,children:[(0,K.jsx)(i,{className:`size-3.5`}),`Group`]})]})}),t[45]=S,t[46]=w,t[47]=b,t[48]=n,t[49]=r,t[50]=F):F=t[50];let I;t[51]===p?I=t[52]:(I=p?(0,K.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]=I);let L;t[53]!==F||t[54]!==I?(L=(0,K.jsxs)(`div`,{className:`relative`,children:[F,I]}),t[53]=F,t[54]=I,t[55]=L):L=t[55];let R;return t[56]!==A||t[57]!==ne||t[58]!==L?(R=(0,K.jsxs)(`div`,{className:`w-[min(34rem,calc(100vw-2rem))] space-y-3`,children:[A,ne,L]}),t[56]=A,t[57]=ne,t[58]=L,t[59]=R):R=t[59],R}function He(e){return{keyDraft:e.key,whenDraft:e.binding.whenAst,isRecording:!1,isWhenDraftValid:!0}}function Q(e,t){return{...e,...t}}function Ue(e){return{command:e.command,key:e.key,...e.when.trim().length>0?{when:e.when}:{}}}function We(e){let t=(0,W.c)(27),{row:n,allRows:r,onSave:i}=e,[a,o]=(0,G.useReducer)(Q,n,He),{keyDraft:s,whenDraft:c,isRecording:l,isWhenDraftValid:u}=a,d,f,p;t[0]!==r||t[1]!==s||t[2]!==n.id||t[3]!==n.key||t[4]!==n.when||t[5]!==c?(p=U(c),d=s!==n.key||p!==n.when,f=ge(r,{rowId:n.id,key:s,when:p}),t[0]=r,t[1]=s,t[2]=n.id,t[3]=n.key,t[4]=n.when,t[5]=c,t[6]=d,t[7]=f,t[8]=p):(d=t[6],f=t[7],p=t[8]);let m=f,h;t[9]!==s||t[10]!==i||t[11]!==n||t[12]!==p?(h=()=>{i({command:n.command,key:s,when:p.trim().length>0?p:void 0,replace:Ue(n)})},t[9]=s,t[10]=i,t[11]=n,t[12]=p,t[13]=h):h=t[13];let g=h,_;t[14]!==l||t[15]!==n.key?(_=e=>{if(e.key===`Tab`&&!l)return;if(e.preventDefault(),e.key===`Escape`){o({keyDraft:n.key,isRecording:!1});return}let t=ye(e.nativeEvent,navigator.platform);t&&o({keyDraft:t,isRecording:!1})},t[14]=l,t[15]=n.key,t[16]=_):_=t[16];let v=_,y;return t[17]!==v||t[18]!==m||t[19]!==d||t[20]!==l||t[21]!==u||t[22]!==s||t[23]!==g||t[24]!==c||t[25]!==p?(y={keyDraft:s,whenDraft:c,isRecording:l,isWhenDraftValid:u,whenDraftExpression:p,isDirty:d,conflictLabels:m,setDraft:o,save:g,captureKeybinding:v},t[17]=v,t[18]=m,t[19]=d,t[20]=l,t[21]=u,t[22]=s,t[23]=g,t[24]=c,t[25]=p,t[26]=y):y=t[26],y}function Ge(e){let t=(0,W.c)(19),{row:n,editor:r,isSaving:i,pillClassName:a}=e,{keyDraft:o,isRecording:s,isDirty:c,isWhenDraftValid:l,setDraft:u,save:d,captureKeybinding:f}=r,p=!s&&o===n.key&&n.key.length>0&&!c,m;t[0]!==c||t[1]!==i||t[2]!==l||t[3]!==o||t[4]!==d?(m=c?(0,K.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]=m):m=t[5];let h;t[6]!==f||t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==n.binding||t[11]!==n.command||t[12]!==n.key||t[13]!==u||t[14]!==p?(h=p?(0,K.jsx)(`button`,{type:`button`,onClick:()=>u({isRecording:!0}),"aria-label":`Edit shortcut for ${V(n.command)}: ${ie(n.binding.shortcut)}`,className:x(`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,K.jsx)(q,{value:n.key})}):(0,K.jsx)(re,{"data-keybinding-capture":``,autoFocus:s,"aria-label":`Keybinding for ${V(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]=n.binding,t[11]=n.command,t[12]=n.key,t[13]=u,t[14]=p,t[15]=h):h=t[15];let _;return t[16]!==m||t[17]!==h?(_=(0,K.jsxs)(K.Fragment,{children:[m,h]}),t[16]=m,t[17]=h,t[18]=_):_=t[18],_}function $(e){let t=(0,W.c)(17),{label:n,expression:r,value:i,variables:a,onChange:o,onValidityChange:s}=e,c=r?`ghost`:`ghost-muted`,l;t[0]===c?l=t[1]:(l=(0,K.jsx)(g,{variant:c,size:`micro`,className:`min-w-0 shrink`}),t[0]=c,t[1]=l);let u=`Edit when clause for ${n}`,d=r||`Always`,f;t[2]===d?f=t[3]:(f=(0,K.jsx)(`span`,{className:`truncate font-mono`,children:d}),t[2]=d,t[3]=f);let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,K.jsx)(S,{className:`size-3.5 shrink-0 opacity-60`}),t[4]=p):p=t[4];let m;t[5]!==l||t[6]!==u||t[7]!==f?(m=(0,K.jsxs)(oe,{render:l,"aria-label":u,children:[f,p]}),t[5]=l,t[6]=u,t[7]=f,t[8]=m):m=t[8];let h;t[9]!==o||t[10]!==s||t[11]!==i||t[12]!==a?(h=(0,K.jsx)(ae,{align:`start`,sideOffset:6,children:(0,K.jsx)(Ve,{value:i,variables:a,onChange:o,onValidityChange:s})}),t[9]=o,t[10]=s,t[11]=i,t[12]=a,t[13]=h):h=t[13];let _;return t[14]!==m||t[15]!==h?(_=(0,K.jsxs)(z,{children:[m,h]}),t[14]=m,t[15]=h,t[16]=_):_=t[16],_}function Ke(e){let t=(0,W.c)(24),{row:r,isSaving:i,onReset:a,onRemove:o}=e,s=r.source===`Custom`&&r.defaultKey!==null,c=r.source!==`Default`;if(!s&&!c)return null;let l;t[0]===r.command?l=t[1]:(l=V(r.command),t[0]=r.command,t[1]=l);let u=`Actions for ${l}`,m;t[2]!==i||t[3]!==u?(m=(0,K.jsx)(g,{type:`button`,variant:`ghost-muted`,size:`icon-sm`,disabled:i,"aria-label":u}),t[2]=i,t[3]=u,t[4]=m):m=t[4];let h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsx)(d,{className:`size-3.5`}),t[5]=h):h=t[5];let _;t[6]===m?_=t[7]:(_=(0,K.jsx)(p,{render:m,children:h}),t[6]=m,t[7]=_);let v;t[8]!==s||t[9]!==i||t[10]!==a||t[11]!==r?(v=s?(0,K.jsx)(f,{disabled:i,onClick:()=>a(r),children:`Reset to default`}):null,t[8]=s,t[9]=i,t[10]=a,t[11]=r,t[12]=v):v=t[12];let b;t[13]!==c||t[14]!==i||t[15]!==o||t[16]!==r?(b=c?(0,K.jsx)(f,{variant:`destructive`,disabled:i,onClick:()=>o(r),children:`Remove`}):null,t[13]=c,t[14]=i,t[15]=o,t[16]=r,t[17]=b):b=t[17];let x;t[18]!==v||t[19]!==b?(x=(0,K.jsxs)(n,{align:`end`,children:[v,b]}),t[18]=v,t[19]=b,t[20]=x):x=t[20];let S;return t[21]!==_||t[22]!==x?(S=(0,K.jsxs)(y,{children:[_,x]}),t[21]=_,t[22]=x,t[23]=S):S=t[23],S}function qe(e){let t=(0,W.c)(2),{source:n}=e;if(n===`Default`)return null;let r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(s,{variant:`outline`,size:`sm`,children:n}),t[0]=n,t[1]=r),r}function Je(e){let t=(0,W.c)(13),{row:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,K.jsx)(`span`,{className:`flex items-center gap-2`}),t[0]=r):r=t[0];let i;t[1]===n.command?i=t[2]:(i=V(n.command),t[1]=n.command,t[2]=i);let a;t[3]===n.source?a=t[4]:(a=(0,K.jsx)(qe,{source:n.source}),t[3]=n.source,t[4]=a);let o;t[5]!==i||t[6]!==a?(o=(0,K.jsxs)(F,{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,K.jsx)(I,{side:`top`,children:n.command}),t[8]=n.command,t[9]=s);let c;return t[10]!==o||t[11]!==s?(c=(0,K.jsxs)(L,{children:[o,s]}),t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function Ye(e){let t=(0,W.c)(13),{row:n,editor:r,variables:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.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=V(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,K.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[a,(0,K.jsx)($,{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 Xe(e){let t=(0,W.c)(2),n;return t[0]===e?n=t[1]:(n=(0,K.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,K.jsx)(Ke,{...e})}),t[0]=e,t[1]=n),n}function Ze(e){let t=(0,W.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=We(u),f;t[4]===n?f=t[5]:(f=(0,K.jsx)(Je,{row:n}),t[4]=n,t[5]=f);let p;t[6]!==d||t[7]!==n||t[8]!==o?(p=(0,K.jsx)(Ye,{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,K.jsx)(X,{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,K.jsx)(Xe,{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,K.jsx)(Ge,{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,K.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,K.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 Qe(e){let t=(0,W.c)(30),{allRows:n,onSave:r}=e,[i,a]=(0,G.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,G.useReducer)(Q,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?V(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`){c({keyDraft:``,isRecording:!1});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 $e(e){let t=(0,W.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,K.jsx)(E,{placeholder:`Command`}),t[2]=s):s=t[2];let c;t[3]===i?c=t[4]:(c=(0,K.jsx)(O,{size:`sm`,className:i,children:s}),t[3]=i,t[4]=c);let l;t[5]===r?l=t[6]:(l=r.map(et),t[5]=r,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,K.jsx)(D,{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,K.jsxs)(k,{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 et(e){return(0,K.jsx)(T,{value:e,className:`w-full`,children:(0,K.jsx)(`span`,{className:`truncate`,children:V(e)})},e)}function tt(e){let t=(0,W.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,K.jsx)(re,{"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 nt(e){let t=(0,W.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,K.jsx)($,{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 rt(e){let t=(0,W.c)(9),{isSaving:n,onCancel:r}=e,i;t[0]!==n||t[1]!==r?(i=(0,K.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,K.jsx)(o,{className:`size-3.5`}),t[3]=a):a=t[3];let s;t[4]===i?s=t[5]:(s=(0,K.jsx)(F,{render:i,children:a}),t[4]=i,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,K.jsx)(I,{side:`top`,children:`Cancel`}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(0,K.jsxs)(L,{children:[s,c]}),t[7]=s,t[8]=l),l}function it(e){let t=(0,W.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=Qe(c),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.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,K.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[u,(0,K.jsx)(nt,{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,K.jsx)($e,{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,K.jsx)(X,{labels:l.conflictLabels}),t[10]=l.conflictLabels,t[11]=p);let m;t[12]===l?m=t[13]:(m=(0,K.jsx)(tt,{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,K.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,K.jsx)(rt,{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,K.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,K.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 at(e){let{groups:t,anchorIds:n,savingCommand:r,...i}=e;return t.map(e=>(0,K.jsx)(he,{id:`keybindings-${e.id}`,title:e.title,children:e.rows.map(e=>(0,K.jsx)(Ze,{row:e,anchorId:n.get(e.id),isSaving:r===e.command,...i},e.id))},e.id))}function ot(){let e=(0,W.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{delay:200,render:(0,K.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,K.jsx)(h,{className:`size-3.5 text-warning`})})}),(0,K.jsx)(I,{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 st(){let e=(0,W.c)(83),{environment:t,connectedEnvironments:n}=de(),r=ee(t?.environmentId??null,u),a=te(n,c),o;e[0]!==n||e[1]!==a?(o=n.length>0&&n.every(e=>a.has(e.environmentId)),e[0]=n,e[1]=a,e[2]=o):o=e[2];let s=o,d=t?.serverConfig?.keybindings,f;e[3]===d?f=e[4]:(f=d??[],e[3]=d,e[4]=f);let p;e[5]===f?p=e[6]:(p=l(f),e[5]=f,e[6]=p);let m=p,h=t?.serverConfig?.keybindingsConfigPath??null,_;e[7]===t?.serverConfig?.availableEditors?_=e[8]:(_=t?.serverConfig?.availableEditors??[],e[7]=t?.serverConfig?.availableEditors,e[8]=_);let v=_,y;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(y={reportFailure:!1},e[9]=y):y=e[9];let x=P(M.upsertKeybinding,y),S;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(S={reportFailure:!1},e[10]=S):S=e[10];let T=P(M.removeKeybinding,S),E=Ee(t?.environmentId??null,v),[D,O]=(0,G.useState)(``),k=(0,G.useRef)(null),[R,re]=(0,G.useState)(null),[ie,ae]=(0,G.useState)(!1),oe;e[11]!==m||e[12]!==D?(oe=Se(m,D),e[11]=m,e[12]=D,e[13]=oe):oe=e[13];let z=oe,se;e[14]===z?se=e[15]:(se=xe(z),e[14]=z,e[15]=se);let ce=se,B;if(e[16]!==z){B=new Map;let t=new Set;for(let e of z)t.has(e.command)||(t.add(e.command),B.set(e.id,De(e.command)));e[16]=z,e[17]=B}else B=e[17];let le=B,ue;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(ue={select:ft},e[18]=ue):ue=e[18];let pe=A(ue),[V,ge]=(0,G.useState)(pe);pe!==V&&(ge(pe),pe.startsWith(`keybinding-`)&&O(``));let _e;e[19]===m?_e=e[20]:(_e=be(m),e[19]=m,e[20]=_e);let ye=_e,H;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(H=ve(),e[21]=H):H=e[21];let U=H,Ce;e[22]!==h||e[23]!==E||e[24]!==t?(Ce=()=>{h&&t&&N(t.environmentId,`orchestration:operate`)&&(async()=>{let e=await E(h);if(e._tag===`Success`||C(e))return;let t=w(e);j.add({title:`Unable to open keybindings file`,description:t instanceof Error?t.message:`The keybindings file was not opened.`,type:`error`})})()},e[22]=h,e[23]=E,e[24]=t,e[25]=Ce):Ce=e[25];let we=Ce,Te;e[26]!==n||e[27]!==t||e[28]!==x?(Te=e=>{if(!t||!n.every(dt))return;re(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=>x({environmentId:e.environmentId,input:r})));re(null);let t=e.find(ut);if(!t){ae(!1);return}if(!C(t)){let e=w(t);j.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]=x,e[29]=Te):Te=e[29];let q=Te,ke;e[30]!==n||e[31]!==t||e[32]!==T?(ke=e=>{t&&n.every(lt)&&(re(e.command),(async()=>{let t=await Promise.all(n.map(t=>T({environmentId:t.environmentId,input:Ue(e)})));re(null);let r=t.find(ct)??t[0];if(r?._tag===`Failure`&&!C(r)){let e=w(r);j.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]=T,e[33]=ke):ke=e[33];let je=ke,J;e[34]===q?J=e[35]:(J=e=>{e.defaultKey&&q({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]=q,e[35]=J);let Me=J,Ne;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=()=>ae(!1),e[36]=Ne):Ne=e[36];let Pe=Ne,Y;e[37]!==je||e[38]!==Me||e[39]!==z||e[40]!==q?(Y={allRows:z,variables:U,onSave:q,onReset:Me,onRemove:je},e[37]=je,e[38]=Me,e[39]=z,e[40]=q,e[41]=Y):Y=e[41];let Fe=Y,Ie,Le;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=Oe(`keybindings`),Le=ne?null:(0,K.jsx)(ot,{}),e[42]=Ie,e[43]=Le):(Ie=e[42],Le=e[43]);let X;e[44]===D?X=e[45]:(X=(0,K.jsx)(Ae,{query:D,onChange:O,inputRef:k}),e[44]=D,e[45]=X);let Re=ie||!s,ze,Be;e[46]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>ae(!0),Be=(0,K.jsx)(i,{"aria-hidden":!0,className:`size-4`}),e[46]=ze,e[47]=Be):(ze=e[46],Be=e[47]);let Z;e[48]===Re?Z=e[49]:(Z=(0,K.jsxs)(g,{type:`button`,variant:`outline`,disabled:Re,onClick:ze,children:[Be,`Add keybinding`]}),e[48]=Re,e[49]=Z);let Ve=!h||!r,He;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,K.jsx)(b,{"aria-hidden":!0,className:`size-4`}),e[50]=He):He=e[50];let Q;e[51]!==we||e[52]!==Ve?(Q=(0,K.jsx)(F,{render:(0,K.jsx)(g,{type:`button`,variant:`outline`,size:`icon`,disabled:Ve,onClick:we,"aria-label":`Open keybindings.json`,children:He})}),e[51]=we,e[52]=Ve,e[53]=Q):Q=e[53];let We;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,K.jsx)(I,{side:`top`,children:`Open keybindings.json`}),e[54]=We):We=e[54];let Ge;e[55]===Q?Ge=e[56]:(Ge=(0,K.jsxs)(L,{children:[Q,We]}),e[55]=Q,e[56]=Ge);let $;e[57]!==X||e[58]!==Z||e[59]!==Ge?($=(0,K.jsx)(he,{...Ie,headerAction:Le,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-3 sm:px-4`,children:[X,Z,Ge]})}),e[57]=X,e[58]=Z,e[59]=Ge,e[60]=$):$=e[60];let Ke;e[61]!==s||e[62]!==n?(Ke=s?null:(0,K.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]=Ke):Ke=e[63];let qe=!s,Je;e[64]!==ye||e[65]!==ie||e[66]!==z||e[67]!==q||e[68]!==R?(Je=ie?(0,K.jsx)(fe,{children:(0,K.jsx)(it,{commandOptions:ye,allRows:z,variables:U,isSaving:R!==null,onSave:q,onCancel:Pe})}):null,e[64]=ye,e[65]=ie,e[66]=z,e[67]=q,e[68]=R,e[69]=Je):Je=e[69];let Ye;e[70]!==le||e[71]!==ce||e[72]!==Fe||e[73]!==R?(Ye=ce.length>0?(0,K.jsx)(at,{groups:ce,anchorIds:le,savingCommand:R,...Fe}):(0,K.jsx)(fe,{children:(0,K.jsx)(`div`,{className:`px-4 py-12 text-center text-sm text-muted-foreground`,children:`No keybindings match your search.`})}),e[70]=le,e[71]=ce,e[72]=Fe,e[73]=R,e[74]=Ye):Ye=e[74];let Xe;e[75]!==qe||e[76]!==Je||e[77]!==Ye?(Xe=(0,K.jsxs)(`div`,{inert:qe,className:`flex flex-col gap-8`,children:[Je,Ye]}),e[75]=qe,e[76]=Je,e[77]=Ye,e[78]=Xe):Xe=e[78];let Ze;return e[79]!==$||e[80]!==Ke||e[81]!==Xe?(Ze=(0,K.jsxs)(me,{children:[$,Ke,Xe]}),e[79]=$,e[80]=Ke,e[81]=Xe,e[82]=Ze):Ze=e[82],Ze}function ct(e){return e._tag===`Failure`}function lt(e){return N(e.environmentId,c)}function ut(e){return e._tag===`Failure`}function dt(e){return N(e.environmentId,c)}function ft(e){return e.hash.replace(/^#/,``)}var pt=st;export{pt as component};
2
+ //# sourceMappingURL=settings.keybindings-r4Dy4hkg.js.map
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{BE as n,Cd as r,Zd as i,em as a,lr as o,mE as s}from"./utils-B0w8dSf5.js";import{a as c,n as l,t as u}from"./tooltip-CuJiZzK7.js";import{n as d,r as f,t as p}from"./input-group-CHJvPXpi.js";import{i as m,s as h}from"./settingsLayout-DaLF8Hfm.js";import{da as g,fa as _,ua as v}from"./main-BgKiw-9f.js";var y=e(t(),1),b=n();function x(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function S(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function C(e){if(typeof e!=`string`)return!1;try{let t=new URL(e).protocol;return t===`http:`||t===`https:`}catch{return!1}}function w(e,t){if(!x(e))throw Error(`License entry ${String(t+1)} is not an object.`);if(!S(e.bundles)||e.bundles.length===0||e.kind!==`custom`&&e.kind!==`package`||typeof e.license!=`string`||typeof e.name!=`string`||typeof e.noticeText!=`string`||e.sourceUrl!==null&&!C(e.sourceUrl)||e.version!==null&&typeof e.version!=`string`)throw Error(`License entry ${String(t+1)} has an invalid shape.`);return{bundles:e.bundles,kind:e.kind,license:e.license,name:e.name,noticeText:e.noticeText,sourceUrl:e.sourceUrl,version:e.version}}function T(e){if(!x(e)||e.schemaVersion!==1||!Array.isArray(e.entries))throw Error(`The open-source license manifest has an unsupported format.`);let t=e.entries.map(w),n=new Set;for(let e of t){let t=k(e);if(n.has(t))throw Error(`The open-source license manifest contains a duplicate entry: ${t}`);n.add(t)}return{schemaVersion:1,entries:t}}function E(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(e=>e.length>0);return n.length===0?e:e.filter(e=>{let t=[e.name,e.version,e.license,...e.bundles].filter(e=>e!==null).join(` `).toLowerCase();return n.every(e=>t.includes(e))})}var D={android:`Android`,assets:`Assets`,desktop:`Desktop`,"device-tools":`Device tools`,ios:`iOS`,mobile:`Mobile`,server:`Server`,web:`Web`};function O(e){return e.map(e=>Object.prototype.hasOwnProperty.call(D,e)?D[e]:e).join(`, `)}function k(e){return encodeURIComponent(JSON.stringify([e.kind,e.name,e.version]))}var A=e(s(),1),j;async function M(){let e=AbortSignal.timeout(3e4);try{let t=await fetch(`${`/`.replace(/\/$/,``)}/third-party-licenses.json`,{signal:e});if(!t.ok)throw Error(`The license manifest request failed with status ${String(t.status)}.`);return T(await t.json())}catch(t){throw e.aborted?Error(`The license manifest took too long to load.`,{cause:t}):t}}function N(){return j??=M().catch(e=>{throw j=void 0,e}),j}function P(e){let t=(0,b.c)(34),{entry:n,open:a,onOpenChange:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,A.jsx)(r,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-200 group-data-panel-open:rotate-90`}),t[0]=c):c=t[0];let l;t[1]===n.name?l=t[2]:(l=(0,A.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:n.name}),t[1]=n.name,t[2]=l);let u;t[3]===n.version?u=t[4]:(u=n.version?(0,A.jsx)(`code`,{className:`shrink-0 text-xs text-muted-foreground`,children:n.version}):null,t[3]=n.version,t[4]=u);let d;t[5]!==l||t[6]!==u?(d=(0,A.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[l,u]}),t[5]=l,t[6]=u,t[7]=d):d=t[7];let f=n.license,p;t[8]===n.bundles?p=t[9]:(p=O(n.bundles),t[8]=n.bundles,t[9]=p);let m;t[10]!==n.license||t[11]!==p?(m=(0,A.jsxs)(`span`,{className:`max-w-[42%] shrink-0 truncate text-xs text-muted-foreground`,children:[f,` · `,p]}),t[10]=n.license,t[11]=p,t[12]=m):m=t[12];let h;t[13]!==d||t[14]!==m?(h=(0,A.jsxs)(_,{className:`group flex min-h-10 min-w-0 flex-1 items-center gap-2.5 px-3 text-left sm:min-h-9 sm:px-4`,children:[c,d,m]}),t[13]=d,t[14]=m,t[15]=h):h=t[15];let y;t[16]!==n.name||t[17]!==n.sourceUrl?(y=n.sourceUrl?(0,A.jsx)(o,{"aria-label":`View project source for ${n.name}`,className:`me-3 shrink-0 sm:me-4`,render:(0,A.jsx)(`a`,{href:n.sourceUrl,rel:`noreferrer noopener`,target:`_blank`}),size:`icon-micro`,title:`Project source`,variant:`ghost-muted`,children:(0,A.jsx)(i,{"aria-hidden":!0,className:`size-3`})}):null,t[16]=n.name,t[17]=n.sourceUrl,t[18]=y):y=t[18];let x;t[19]!==h||t[20]!==y?(x=(0,A.jsxs)(`div`,{className:`flex min-h-10 items-center hover:bg-muted/35 sm:min-h-9`,children:[h,y]}),t[19]=h,t[20]=y,t[21]=x):x=t[21];let S;t[22]!==n.noticeText||t[23]!==a?(S=a?(0,A.jsx)(`div`,{className:`px-9 pt-1 pb-4 sm:px-10`,children:(0,A.jsx)(`pre`,{className:`max-w-[76ch] whitespace-pre-wrap break-words font-mono text-xs/5 text-foreground/80`,children:n.noticeText})}):null,t[22]=n.noticeText,t[23]=a,t[24]=S):S=t[24];let C;t[25]===S?C=t[26]:(C=(0,A.jsx)(g,{children:S}),t[25]=S,t[26]=C);let w;t[27]!==x||t[28]!==C?(w=(0,A.jsxs)(`article`,{children:[x,C]}),t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==s||t[31]!==a||t[32]!==w?(T=(0,A.jsx)(v,{open:a,onOpenChange:s,children:w}),t[30]=s,t[31]=a,t[32]=w,t[33]=T):T=t[33],T}function F(e){let t=(0,b.c)(2),{filteredCount:n,totalCount:r}=e,i=n===r?`${String(r)} notices`:`${String(n)} of ${String(r)}`,a;return t[0]===i?a=t[1]:(a=(0,A.jsx)(`p`,{className:`whitespace-nowrap text-xs font-normal text-muted-foreground tabular-nums`,children:i}),t[0]=i,t[1]=a),a}function I(e){let t=(0,b.c)(34),{query:n,onQueryChange:r,searchOpen:i,onSearchOpenChange:s,filteredCount:m,totalCount:h}=e;if(!i){let e;t[0]!==m||t[1]!==h?(e=(0,A.jsx)(F,{filteredCount:m,totalCount:h}),t[0]=m,t[1]=h,t[2]=e):e=t[2];let n;t[3]===s?n=t[4]:(n=()=>s(!0),t[3]=s,t[4]=n);let r;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,A.jsx)(a,{className:`size-3`}),t[5]=r):r=t[5];let i;t[6]===n?i=t[7]:(i=(0,A.jsx)(c,{render:(0,A.jsx)(o,{"aria-label":`Search open-source licenses`,onClick:n,size:`icon-micro`,type:`button`,variant:`ghost-muted`,children:r})}),t[6]=n,t[7]=i);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,A.jsx)(l,{side:`top`,children:`Search licenses`}),t[8]=d):d=t[8];let f;t[9]===i?f=t[10]:(f=(0,A.jsxs)(u,{children:[i,d]}),t[9]=i,t[10]=f);let p;return t[11]!==e||t[12]!==f?(p=(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e,f]}),t[11]=e,t[12]=f,t[13]=p):p=t[13],p}let g;t[14]!==m||t[15]!==h?(g=(0,A.jsx)(`div`,{className:`hidden sm:block`,children:(0,A.jsx)(F,{filteredCount:m,totalCount:h})}),t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,A.jsx)(d,{children:(0,A.jsx)(a,{"aria-hidden":!0,className:`size-3`})}),t[17]=_):_=t[17];let v;t[18]!==s||t[19]!==n.length?(v=()=>{n.length===0&&s(!1)},t[18]=s,t[19]=n.length,t[20]=v):v=t[20];let y;t[21]===r?y=t[22]:(y=e=>r(e.currentTarget.value),t[21]=r,t[22]=y);let x;t[23]!==r||t[24]!==s?(x=e=>{e.key===`Escape`&&(e.preventDefault(),r(``),s(!1))},t[23]=r,t[24]=s,t[25]=x):x=t[25];let S;t[26]!==n||t[27]!==v||t[28]!==y||t[29]!==x?(S=(0,A.jsxs)(p,{className:`w-36 sm:w-44`,children:[_,(0,A.jsx)(f,{"aria-label":`Search open-source licenses`,autoFocus:!0,onBlur:v,onChange:y,onKeyDown:x,placeholder:`Search licenses`,size:`sm`,type:`search`,value:n})]}),t[26]=n,t[27]=v,t[28]=y,t[29]=x,t[30]=S):S=t[30];let C;return t[31]!==g||t[32]!==S?(C=(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[g,S]}),t[31]=g,t[32]=S,t[33]=C):C=t[33],C}function L(e){let t=(0,b.c)(8),{message:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,A.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:`Open-source notices are unavailable`}),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=(0,A.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[i,(0,A.jsx)(`p`,{className:`max-w-[70ch] text-pretty text-xs leading-normal text-muted-foreground/80`,children:n})]}),t[1]=n,t[2]=a);let s;t[3]===r?s=t[4]:(s=(0,A.jsx)(o,{type:`button`,size:`xs`,variant:`outline`,onClick:r,children:`Try again`}),t[3]=r,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,A.jsxs)(`div`,{className:`flex flex-col items-start gap-3 px-3 py-5 sm:px-4`,children:[a,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}function R(){let e=(0,b.c)(25),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`loading`},e[0]=t):t=e[0];let[n,r]=(0,y.useState)(t),[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(null),[u,d]=(0,y.useState)(0),f;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{let e=!1;return r({status:`loading`}),N().then(t=>{e||r({status:`ready`,manifest:t})},t=>{e||r({status:`error`,message:t instanceof Error?t.message:`The license manifest could not load.`})}),()=>{e=!0}},e[1]=f):f=e[1];let p;e[2]===u?p=e[3]:(p=[u],e[2]=u,e[3]=p),(0,y.useEffect)(f,p);let g;e[4]!==n.manifest||e[5]!==n.status?(g=n.status===`ready`?n.manifest.entries:[],e[4]=n.manifest,e[5]=n.status,e[6]=g):g=e[6];let _=g,v;e[7]!==_||e[8]!==i?(v=E(_,i),e[7]=_,e[8]=i,e[9]=v):v=e[9];let x=v,S;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>d(z),e[10]=S):S=e[10];let C=S,w;e[11]!==_||e[12]!==x||e[13]!==i||e[14]!==o||e[15]!==n.status?(w=n.status===`ready`?(0,A.jsx)(I,{query:i,onQueryChange:a,searchOpen:o,onSearchOpenChange:s,filteredCount:x.length,totalCount:_.length}):null,e[11]=_,e[12]=x,e[13]=i,e[14]=o,e[15]=n.status,e[16]=w):w=e[16];let T;e[17]!==x||e[18]!==c||e[19]!==n.message||e[20]!==n.status?(T=n.status===`ready`?(0,A.jsx)(`div`,{className:`text-base sm:text-sm`,children:x.length>0?x.map(e=>{let t=k(e);return(0,A.jsx)(P,{entry:e,open:c===t,onOpenChange:e=>l(e?t:null)},t)}):(0,A.jsx)(`p`,{className:`px-3 py-8 text-center text-sm/6 text-muted-foreground sm:px-4`,children:`No licenses match that search.`})}):n.status===`error`?(0,A.jsx)(L,{message:n.message,onRetry:C}):(0,A.jsx)(`p`,{className:`px-3 py-5 text-sm/6 text-muted-foreground sm:px-4`,children:`Loading open-source notices…`}),e[17]=x,e[18]=c,e[19]=n.message,e[20]=n.status,e[21]=T):T=e[21];let D;return e[22]!==w||e[23]!==T?(D=(0,A.jsx)(m,{children:(0,A.jsx)(h,{title:`Third-party notices`,headerAction:w,children:T})}),e[22]=w,e[23]=T,e[24]=D):D=e[24],D}function z(e){return e+1}var B=R;export{B as component};
2
- //# sourceMappingURL=settings.open-source-licenses-ZP9ezdc4.js.map
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{BE as n,Cd as r,Zd as i,em as a,lr as o,mE as s}from"./utils-B0w8dSf5.js";import{a as c,n as l,t as u}from"./tooltip-CuJiZzK7.js";import{n as d,r as f,t as p}from"./input-group-CHJvPXpi.js";import{i as m,s as h}from"./settingsLayout-C1Jfxbij.js";import{da as g,fa as _,ua as v}from"./main-CSxSeVCm.js";var y=e(t(),1),b=n();function x(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function S(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function C(e){if(typeof e!=`string`)return!1;try{let t=new URL(e).protocol;return t===`http:`||t===`https:`}catch{return!1}}function w(e,t){if(!x(e))throw Error(`License entry ${String(t+1)} is not an object.`);if(!S(e.bundles)||e.bundles.length===0||e.kind!==`custom`&&e.kind!==`package`||typeof e.license!=`string`||typeof e.name!=`string`||typeof e.noticeText!=`string`||e.sourceUrl!==null&&!C(e.sourceUrl)||e.version!==null&&typeof e.version!=`string`)throw Error(`License entry ${String(t+1)} has an invalid shape.`);return{bundles:e.bundles,kind:e.kind,license:e.license,name:e.name,noticeText:e.noticeText,sourceUrl:e.sourceUrl,version:e.version}}function T(e){if(!x(e)||e.schemaVersion!==1||!Array.isArray(e.entries))throw Error(`The open-source license manifest has an unsupported format.`);let t=e.entries.map(w),n=new Set;for(let e of t){let t=k(e);if(n.has(t))throw Error(`The open-source license manifest contains a duplicate entry: ${t}`);n.add(t)}return{schemaVersion:1,entries:t}}function E(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(e=>e.length>0);return n.length===0?e:e.filter(e=>{let t=[e.name,e.version,e.license,...e.bundles].filter(e=>e!==null).join(` `).toLowerCase();return n.every(e=>t.includes(e))})}var D={android:`Android`,assets:`Assets`,desktop:`Desktop`,"device-tools":`Device tools`,ios:`iOS`,mobile:`Mobile`,server:`Server`,web:`Web`};function O(e){return e.map(e=>Object.prototype.hasOwnProperty.call(D,e)?D[e]:e).join(`, `)}function k(e){return encodeURIComponent(JSON.stringify([e.kind,e.name,e.version]))}var A=e(s(),1),j;async function M(){let e=AbortSignal.timeout(3e4);try{let t=await fetch(`${`/`.replace(/\/$/,``)}/third-party-licenses.json`,{signal:e});if(!t.ok)throw Error(`The license manifest request failed with status ${String(t.status)}.`);return T(await t.json())}catch(t){throw e.aborted?Error(`The license manifest took too long to load.`,{cause:t}):t}}function N(){return j??=M().catch(e=>{throw j=void 0,e}),j}function P(e){let t=(0,b.c)(34),{entry:n,open:a,onOpenChange:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,A.jsx)(r,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-200 group-data-panel-open:rotate-90`}),t[0]=c):c=t[0];let l;t[1]===n.name?l=t[2]:(l=(0,A.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:n.name}),t[1]=n.name,t[2]=l);let u;t[3]===n.version?u=t[4]:(u=n.version?(0,A.jsx)(`code`,{className:`shrink-0 text-xs text-muted-foreground`,children:n.version}):null,t[3]=n.version,t[4]=u);let d;t[5]!==l||t[6]!==u?(d=(0,A.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[l,u]}),t[5]=l,t[6]=u,t[7]=d):d=t[7];let f=n.license,p;t[8]===n.bundles?p=t[9]:(p=O(n.bundles),t[8]=n.bundles,t[9]=p);let m;t[10]!==n.license||t[11]!==p?(m=(0,A.jsxs)(`span`,{className:`max-w-[42%] shrink-0 truncate text-xs text-muted-foreground`,children:[f,` · `,p]}),t[10]=n.license,t[11]=p,t[12]=m):m=t[12];let h;t[13]!==d||t[14]!==m?(h=(0,A.jsxs)(_,{className:`group flex min-h-10 min-w-0 flex-1 items-center gap-2.5 px-3 text-left sm:min-h-9 sm:px-4`,children:[c,d,m]}),t[13]=d,t[14]=m,t[15]=h):h=t[15];let y;t[16]!==n.name||t[17]!==n.sourceUrl?(y=n.sourceUrl?(0,A.jsx)(o,{"aria-label":`View project source for ${n.name}`,className:`me-3 shrink-0 sm:me-4`,render:(0,A.jsx)(`a`,{href:n.sourceUrl,rel:`noreferrer noopener`,target:`_blank`}),size:`icon-micro`,title:`Project source`,variant:`ghost-muted`,children:(0,A.jsx)(i,{"aria-hidden":!0,className:`size-3`})}):null,t[16]=n.name,t[17]=n.sourceUrl,t[18]=y):y=t[18];let x;t[19]!==h||t[20]!==y?(x=(0,A.jsxs)(`div`,{className:`flex min-h-10 items-center hover:bg-muted/35 sm:min-h-9`,children:[h,y]}),t[19]=h,t[20]=y,t[21]=x):x=t[21];let S;t[22]!==n.noticeText||t[23]!==a?(S=a?(0,A.jsx)(`div`,{className:`px-9 pt-1 pb-4 sm:px-10`,children:(0,A.jsx)(`pre`,{className:`max-w-[76ch] whitespace-pre-wrap break-words font-mono text-xs/5 text-foreground/80`,children:n.noticeText})}):null,t[22]=n.noticeText,t[23]=a,t[24]=S):S=t[24];let C;t[25]===S?C=t[26]:(C=(0,A.jsx)(g,{children:S}),t[25]=S,t[26]=C);let w;t[27]!==x||t[28]!==C?(w=(0,A.jsxs)(`article`,{children:[x,C]}),t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==s||t[31]!==a||t[32]!==w?(T=(0,A.jsx)(v,{open:a,onOpenChange:s,children:w}),t[30]=s,t[31]=a,t[32]=w,t[33]=T):T=t[33],T}function F(e){let t=(0,b.c)(2),{filteredCount:n,totalCount:r}=e,i=n===r?`${String(r)} notices`:`${String(n)} of ${String(r)}`,a;return t[0]===i?a=t[1]:(a=(0,A.jsx)(`p`,{className:`whitespace-nowrap text-xs font-normal text-muted-foreground tabular-nums`,children:i}),t[0]=i,t[1]=a),a}function I(e){let t=(0,b.c)(34),{query:n,onQueryChange:r,searchOpen:i,onSearchOpenChange:s,filteredCount:m,totalCount:h}=e;if(!i){let e;t[0]!==m||t[1]!==h?(e=(0,A.jsx)(F,{filteredCount:m,totalCount:h}),t[0]=m,t[1]=h,t[2]=e):e=t[2];let n;t[3]===s?n=t[4]:(n=()=>s(!0),t[3]=s,t[4]=n);let r;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,A.jsx)(a,{className:`size-3`}),t[5]=r):r=t[5];let i;t[6]===n?i=t[7]:(i=(0,A.jsx)(c,{render:(0,A.jsx)(o,{"aria-label":`Search open-source licenses`,onClick:n,size:`icon-micro`,type:`button`,variant:`ghost-muted`,children:r})}),t[6]=n,t[7]=i);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,A.jsx)(l,{side:`top`,children:`Search licenses`}),t[8]=d):d=t[8];let f;t[9]===i?f=t[10]:(f=(0,A.jsxs)(u,{children:[i,d]}),t[9]=i,t[10]=f);let p;return t[11]!==e||t[12]!==f?(p=(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e,f]}),t[11]=e,t[12]=f,t[13]=p):p=t[13],p}let g;t[14]!==m||t[15]!==h?(g=(0,A.jsx)(`div`,{className:`hidden sm:block`,children:(0,A.jsx)(F,{filteredCount:m,totalCount:h})}),t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,A.jsx)(d,{children:(0,A.jsx)(a,{"aria-hidden":!0,className:`size-3`})}),t[17]=_):_=t[17];let v;t[18]!==s||t[19]!==n.length?(v=()=>{n.length===0&&s(!1)},t[18]=s,t[19]=n.length,t[20]=v):v=t[20];let y;t[21]===r?y=t[22]:(y=e=>r(e.currentTarget.value),t[21]=r,t[22]=y);let x;t[23]!==r||t[24]!==s?(x=e=>{e.key===`Escape`&&(e.preventDefault(),r(``),s(!1))},t[23]=r,t[24]=s,t[25]=x):x=t[25];let S;t[26]!==n||t[27]!==v||t[28]!==y||t[29]!==x?(S=(0,A.jsxs)(p,{className:`w-36 sm:w-44`,children:[_,(0,A.jsx)(f,{"aria-label":`Search open-source licenses`,autoFocus:!0,onBlur:v,onChange:y,onKeyDown:x,placeholder:`Search licenses`,size:`sm`,type:`search`,value:n})]}),t[26]=n,t[27]=v,t[28]=y,t[29]=x,t[30]=S):S=t[30];let C;return t[31]!==g||t[32]!==S?(C=(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[g,S]}),t[31]=g,t[32]=S,t[33]=C):C=t[33],C}function L(e){let t=(0,b.c)(8),{message:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,A.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:`Open-source notices are unavailable`}),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=(0,A.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[i,(0,A.jsx)(`p`,{className:`max-w-[70ch] text-pretty text-xs leading-normal text-muted-foreground/80`,children:n})]}),t[1]=n,t[2]=a);let s;t[3]===r?s=t[4]:(s=(0,A.jsx)(o,{type:`button`,size:`xs`,variant:`outline`,onClick:r,children:`Try again`}),t[3]=r,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,A.jsxs)(`div`,{className:`flex flex-col items-start gap-3 px-3 py-5 sm:px-4`,children:[a,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}function R(){let e=(0,b.c)(25),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`loading`},e[0]=t):t=e[0];let[n,r]=(0,y.useState)(t),[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(null),[u,d]=(0,y.useState)(0),f;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{let e=!1;return r({status:`loading`}),N().then(t=>{e||r({status:`ready`,manifest:t})},t=>{e||r({status:`error`,message:t instanceof Error?t.message:`The license manifest could not load.`})}),()=>{e=!0}},e[1]=f):f=e[1];let p;e[2]===u?p=e[3]:(p=[u],e[2]=u,e[3]=p),(0,y.useEffect)(f,p);let g;e[4]!==n.manifest||e[5]!==n.status?(g=n.status===`ready`?n.manifest.entries:[],e[4]=n.manifest,e[5]=n.status,e[6]=g):g=e[6];let _=g,v;e[7]!==_||e[8]!==i?(v=E(_,i),e[7]=_,e[8]=i,e[9]=v):v=e[9];let x=v,S;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>d(z),e[10]=S):S=e[10];let C=S,w;e[11]!==_||e[12]!==x||e[13]!==i||e[14]!==o||e[15]!==n.status?(w=n.status===`ready`?(0,A.jsx)(I,{query:i,onQueryChange:a,searchOpen:o,onSearchOpenChange:s,filteredCount:x.length,totalCount:_.length}):null,e[11]=_,e[12]=x,e[13]=i,e[14]=o,e[15]=n.status,e[16]=w):w=e[16];let T;e[17]!==x||e[18]!==c||e[19]!==n.message||e[20]!==n.status?(T=n.status===`ready`?(0,A.jsx)(`div`,{className:`text-base sm:text-sm`,children:x.length>0?x.map(e=>{let t=k(e);return(0,A.jsx)(P,{entry:e,open:c===t,onOpenChange:e=>l(e?t:null)},t)}):(0,A.jsx)(`p`,{className:`px-3 py-8 text-center text-sm/6 text-muted-foreground sm:px-4`,children:`No licenses match that search.`})}):n.status===`error`?(0,A.jsx)(L,{message:n.message,onRetry:C}):(0,A.jsx)(`p`,{className:`px-3 py-5 text-sm/6 text-muted-foreground sm:px-4`,children:`Loading open-source notices…`}),e[17]=x,e[18]=c,e[19]=n.message,e[20]=n.status,e[21]=T):T=e[21];let D;return e[22]!==w||e[23]!==T?(D=(0,A.jsx)(m,{children:(0,A.jsx)(h,{title:`Third-party notices`,headerAction:w,children:T})}),e[22]=w,e[23]=T,e[24]=D):D=e[24],D}function z(e){return e+1}var B=R;export{B as component};
2
+ //# sourceMappingURL=settings.open-source-licenses-BGGKTeAP.js.map
@@ -1,5 +1,5 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$n as n,$o as r,BE as i,Bp as a,Es as o,Fw as s,Jp as c,Kn as l,Om as u,RT as d,Up as f,Zn as p,Zu as m,a_ as h,cr as g,dd as _,e_ as v,em as y,gp as b,i_ as x,im as S,l as C,lb as w,lr as T,mE as E,n_ as D,o_ as O,qn as k,r_ as A,s_ as j,t as M,t_ as N,xd as P,zp as F}from"./utils-B0w8dSf5.js";import{n as I}from"./ChatMarkdown-B_7CYt1t.js";import{a as L,c as R,o as z,s as B,t as V}from"./select-CqPGedM1.js";import{t as H}from"./useLocation-XbiRdmmb.js";import{p as U}from"./toast-B2B2ECBW.js";import{C as W}from"./useSettings-BEKkRzL1.js";import{f as G}from"./server-C8OpoOTL.js";import{t as K}from"./use-atom-command-BWLbyoVN.js";import{s as q,u as ee}from"./providerSkills-waACvYAJ.js";import{a as J,n as te,t as ne}from"./tooltip-CuJiZzK7.js";import{t as re}from"./skeleton-CzpSBxtu.js";import{t as ie}from"./textarea-UGuOTqiM.js";import{n as ae,t as oe}from"./toggle-group--s5MIuQv.js";import{t as se}from"./input-CDBTiBJx.js";import{c as ce,r as le,s as ue,t as de}from"./dialog-Bdi4gsq5.js";import{i as fe,o as pe,r as me,t as he}from"./empty-DeLw5x6B.js";import{n as ge,r as _e,t as ve}from"./input-group-CHJvPXpi.js";import{a as ye}from"./projectFilesQueryState-DM9_vSRA.js";import{B as be,P as xe,U as Se,a as Ce,i as we,s as Te}from"./settingsLayout-DaLF8Hfm.js";import{Ar as Ee,Dr as De,Mr as Oe,Nr as ke,Or as Ae,jr as je,kr as Me,pa as Ne,pi as Pe,tr as Fe}from"./main-BgKiw-9f.js";import{t as Ie}from"./SecretInput-aXfqfjLk.js";var Y=i(),Le={spawn:`Failed to start`,timeout:`Timed out`,protocol:`Not an MCP server`,http:`Can't connect`,auth:`Credentials rejected`};function Re(e,t,n){if(!e.enabled)return{tone:`muted`,label:`Off`,needsSignIn:!1};if(n)return{tone:`muted`,label:`Checking…`,needsSignIn:!1};if(e.transport.type===`http`&&e.transport.auth===`oauth`&&t?.auth===`signed-out`)return{tone:`warning`,label:`Needs sign-in`,needsSignIn:!0};let r=t?.health;switch(r?.status){case`connected`:return{tone:`success`,label:`Connected · ${r.toolCount} ${r.toolCount===1?`tool`:`tools`}`,needsSignIn:!1};case`needs-auth`:return{tone:`warning`,label:`Needs sign-in`,needsSignIn:!0};case`error`:return{tone:`error`,label:Le[r.category],detail:r.message,needsSignIn:!1};default:return t?.auth===`signed-in`?{tone:`success`,label:`Signed in`,needsSignIn:!1}:{tone:`muted`,label:`Not checked`,needsSignIn:!1}}}function ze(e){let t=e.transport;if(t.type===`http`)try{let e=new URL(t.url);return`Remote · ${e.host}${e.pathname===`/`?``:e.pathname}`}catch{return`Remote`}return[t.command,...t.args].join(` `)}var X=e(t(),1),Z=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Be=e=>typeof e==`string`&&e.trim()?e:void 0,Ve=e=>{if(e!==null)try{let t=JSON.parse(e);return Z(t)?t:void 0}catch{return}},He=e=>{let t=Be(e)?.replace(/^\.\//,``);if(t!==void 0&&t.toLowerCase().endsWith(`.svg`)&&!(t.startsWith(`/`)||t.split(/[\\/]/).includes(`..`)))return t};function Ue(e,t){let n=Ve(e),r=Ve(t),i=Z(r?.interface)?r.interface:void 0,a=n?.author??r?.author,o={displayName:Be(n?.displayName)??Be(i?.displayName),description:Be(n?.description)??Be(r?.description),publisher:Be(a)??(Z(a)?Be(a.name):void 0),iconPath:He(n?.icon)??He(i?.logo)??He(i?.composerIcon)};return Object.fromEntries(Object.entries(o).filter(([,e])=>e!==void 0))}function We(e){let t=Ve(e)?.userConfig;return Z(t)?Object.entries(t).map(([e,t])=>{let n=Z(t)?t:{},r=Be(n.description);return{key:e,title:Be(n.title)??e,...r===void 0?{}:{description:r},required:n.required===!0}}):[]}var Q=e(E(),1),Ge=e=>{let t=d(o(e));return t&&!t.truncated?t.contents:null};function Ke(e){let t=(0,Y.c)(48),{environmentId:i,plugin:a,enabled:o,disabled:s,onDetails:c,onToggle:l}=e,u;t[0]!==i||t[1]!==a.path?(u=ye(i,a.path,`.claude-plugin/plugin.json`),t[0]=i,t[1]=a.path,t[2]=u):u=t[2];let d=r(u),m;t[3]!==i||t[4]!==a.path?(m=ye(i,a.path,`.codex-plugin/plugin.json`),t[3]=i,t[4]=a.path,t[5]=m):m=t[5];let h=r(m),{displayName:_,description:v,publisher:y,iconPath:x}=Ue(Ge(d),Ge(h)),S=Ge(r(ye(i,a.path,x??null))),C=x&&S?.trimStart().startsWith(`<`)?`data:image/svg+xml;charset=utf-8,${encodeURIComponent(S)}`:null,w=ee(i),E;t[6]===C?E=t[7]:(E=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`flex size-10 shrink-0 items-center justify-center rounded-xl border border-border/60 bg-muted`,children:C?(0,Q.jsx)(`img`,{src:C,alt:``,className:`size-6 object-contain`}):(0,Q.jsx)(f,{className:`size-5 text-muted-foreground`})}),t[6]=C,t[7]=E);let D=_??a.name,O;t[8]===D?O=t[9]:(O=(0,Q.jsx)(`span`,{className:`break-words text-sm font-medium`,children:D}),t[8]=D,t[9]=O);let A;t[10]===y?A=t[11]:(A=y?(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:y}):null,t[10]=y,t[11]=A);let j;t[12]!==O||t[13]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[O,A]}),t[12]=O,t[13]=A,t[14]=j):j=t[14];let M=v??`Local plugin`,N;t[15]===M?N=t[16]:(N=(0,Q.jsx)(`p`,{className:`break-words text-xs text-muted-foreground`,children:M}),t[15]=M,t[16]=N);let P;t[17]!==j||t[18]!==N?(P=(0,Q.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-1`,children:[j,N]}),t[17]=j,t[18]=N,t[19]=P):P=t[19];let F=`More for ${a.name}`,I;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(b,{"aria-hidden":!0}),t[20]=I):I=t[20];let L;t[21]===F?L=t[22]:(L=(0,Q.jsx)(J,{render:(0,Q.jsx)(g,{render:(0,Q.jsx)(T,{variant:`ghost`,size:`icon-sm`,"aria-label":F,children:I})})}),t[21]=F,t[22]=L);let R;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsx)(te,{children:`Plugin actions`}),t[23]=R):R=t[23];let z;t[24]===L?z=t[25]:(z=(0,Q.jsxs)(ne,{children:[L,R]}),t[24]=L,t[25]=z);let B;t[26]!==i||t[27]!==w||t[28]!==a.path?(B=w.capabilities.canOpenDefault?(0,Q.jsx)(p,{onClick:()=>void w.activate(`open`,{environmentId:i,filePath:a.path,workspaceRoot:void 0}),children:`Open`}):null,t[26]=i,t[27]=w,t[28]=a.path,t[29]=B):B=t[29];let V;t[30]===c?V=t[31]:(V=(0,Q.jsx)(p,{onClick:c,children:`Details`}),t[30]=c,t[31]=V);let H;t[32]!==B||t[33]!==V?(H=(0,Q.jsxs)(n,{align:`end`,children:[B,V]}),t[32]=B,t[33]=V,t[34]=H):H=t[34];let U;t[35]!==z||t[36]!==H?(U=(0,Q.jsxs)(k,{children:[z,H]}),t[35]=z,t[36]=H,t[37]=U):U=t[37];let W=`Load ${a.name}`,G;t[38]!==s||t[39]!==o||t[40]!==l||t[41]!==W?(G=(0,Q.jsx)(Ne,{"aria-label":W,checked:o,disabled:s,onCheckedChange:l}),t[38]=s,t[39]=o,t[40]=l,t[41]=W,t[42]=G):G=t[42];let K;return t[43]!==P||t[44]!==U||t[45]!==G||t[46]!==E?(K=(0,Q.jsxs)(`li`,{className:`flex items-center gap-4 py-4`,children:[E,P,U,G]}),t[43]=P,t[44]=U,t[45]=G,t[46]=E,t[47]=K):K=t[47],K}var qe=[`Personal`,`Built-in`,`Project`,`Plugins`,`Other`];function Je(e){switch(q(e)){case`personal`:return`Personal`;case`system`:return`Built-in`;case`repo`:case`project`:return`Project`;case`app`:return`Plugins`;default:return`Other`}}var Ye=[[`codex`,`Codex`],[`claudeAgent`,`Claude`],[`cursor`,`Cursor`],[`grok`,`Grok`],[`antigravity`,`Antigravity`],[`opencode`,`OpenCode`],[`muse`,`Muse`],[`pi`,`Pi`]],Xe={remote:`Remote servers aren't supported by this provider`,"working-directory":`Servers with a working directory aren't supported here`,provider:`Not supported by this provider yet`};function Ze(e){return Ye.find(([t])=>t===e)?.[1]??e}function Qe(e){switch(e){case`signed-in`:return`Signed in`;case`signed-out`:return`Not signed in`;case`unavailable`:return`Add this server to the provider's own MCP config to sign in.`;case`unknown`:return`Sign-in status unknown`}}function $e(e,t){if(!h(e))return`unavailable`;let n=t.filter(t=>t.driver===e);if(n.some(e=>e.status===`signed-in`))return`signed-in`;if(n.some(e=>e.status===`signed-out`))return`needs-sign-in`}function et(e){return Ye.map(([t,n])=>{let r=A(t,e.transport),i=j.make(t);return{driver:i,label:n,enabled:r.supported&&!e.disabledProviders.includes(i),...r.supported?{}:{unsupported:Xe[r.reason]}}})}var tt={name:``,type:`stdio`,command:``,args:``,cwd:``,url:``,auth:`none`,values:[]};function nt(e){let t=e.transport;return t.type===`stdio`?{...tt,name:e.name,type:`stdio`,command:t.command,args:t.args.join(`
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$n as n,$o as r,BE as i,Bp as a,Es as o,Fw as s,Jp as c,Kn as l,Om as u,RT as d,Up as f,Zn as p,Zu as m,a_ as h,cr as g,dd as _,e_ as v,em as y,gp as b,i_ as x,im as S,l as C,lb as w,lr as T,mE as E,n_ as D,o_ as O,qn as k,r_ as A,s_ as j,t as M,t_ as N,xd as P,zp as F}from"./utils-B0w8dSf5.js";import{n as I}from"./ChatMarkdown-n-Pmpt9I.js";import{a as L,c as R,o as z,s as B,t as V}from"./select-CqPGedM1.js";import{t as H}from"./useLocation-XbiRdmmb.js";import{p as U}from"./toast-VoruYA6X.js";import{C as W}from"./useSettings-u7ZNp27u.js";import{f as G}from"./server-DZYI6rhH.js";import{t as K}from"./use-atom-command-DrwAZaSK.js";import{s as q,u as ee}from"./providerSkills-WK9rr3PR.js";import{a as J,n as te,t as ne}from"./tooltip-CuJiZzK7.js";import{t as re}from"./skeleton-CzpSBxtu.js";import{t as ie}from"./textarea-UGuOTqiM.js";import{n as ae,t as oe}from"./toggle-group--s5MIuQv.js";import{t as se}from"./input-CDBTiBJx.js";import{c as ce,r as le,s as ue,t as de}from"./dialog-Bdi4gsq5.js";import{i as fe,o as pe,r as me,t as he}from"./empty-DeLw5x6B.js";import{n as ge,r as _e,t as ve}from"./input-group-CHJvPXpi.js";import{a as ye}from"./projectFilesQueryState-B0Z25WLd.js";import{B as be,P as xe,U as Se,a as Ce,i as we,s as Te}from"./settingsLayout-C1Jfxbij.js";import{Ar as Ee,Dr as De,Mr as Oe,Nr as ke,Or as Ae,jr as je,kr as Me,pa as Ne,pi as Pe,tr as Fe}from"./main-CSxSeVCm.js";import{t as Ie}from"./SecretInput-aXfqfjLk.js";var Y=i(),Le={spawn:`Failed to start`,timeout:`Timed out`,protocol:`Not an MCP server`,http:`Can't connect`,auth:`Credentials rejected`};function Re(e,t,n){if(!e.enabled)return{tone:`muted`,label:`Off`,needsSignIn:!1};if(n)return{tone:`muted`,label:`Checking…`,needsSignIn:!1};if(e.transport.type===`http`&&e.transport.auth===`oauth`&&t?.auth===`signed-out`)return{tone:`warning`,label:`Needs sign-in`,needsSignIn:!0};let r=t?.health;switch(r?.status){case`connected`:return{tone:`success`,label:`Connected · ${r.toolCount} ${r.toolCount===1?`tool`:`tools`}`,needsSignIn:!1};case`needs-auth`:return{tone:`warning`,label:`Needs sign-in`,needsSignIn:!0};case`error`:return{tone:`error`,label:Le[r.category],detail:r.message,needsSignIn:!1};default:return t?.auth===`signed-in`?{tone:`success`,label:`Signed in`,needsSignIn:!1}:{tone:`muted`,label:`Not checked`,needsSignIn:!1}}}function ze(e){let t=e.transport;if(t.type===`http`)try{let e=new URL(t.url);return`Remote · ${e.host}${e.pathname===`/`?``:e.pathname}`}catch{return`Remote`}return[t.command,...t.args].join(` `)}var X=e(t(),1),Z=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Be=e=>typeof e==`string`&&e.trim()?e:void 0,Ve=e=>{if(e!==null)try{let t=JSON.parse(e);return Z(t)?t:void 0}catch{return}},He=e=>{let t=Be(e)?.replace(/^\.\//,``);if(t!==void 0&&t.toLowerCase().endsWith(`.svg`)&&!(t.startsWith(`/`)||t.split(/[\\/]/).includes(`..`)))return t};function Ue(e,t){let n=Ve(e),r=Ve(t),i=Z(r?.interface)?r.interface:void 0,a=n?.author??r?.author,o={displayName:Be(n?.displayName)??Be(i?.displayName),description:Be(n?.description)??Be(r?.description),publisher:Be(a)??(Z(a)?Be(a.name):void 0),iconPath:He(n?.icon)??He(i?.logo)??He(i?.composerIcon)};return Object.fromEntries(Object.entries(o).filter(([,e])=>e!==void 0))}function We(e){let t=Ve(e)?.userConfig;return Z(t)?Object.entries(t).map(([e,t])=>{let n=Z(t)?t:{},r=Be(n.description);return{key:e,title:Be(n.title)??e,...r===void 0?{}:{description:r},required:n.required===!0}}):[]}var Q=e(E(),1),Ge=e=>{let t=d(o(e));return t&&!t.truncated?t.contents:null};function Ke(e){let t=(0,Y.c)(48),{environmentId:i,plugin:a,enabled:o,disabled:s,onDetails:c,onToggle:l}=e,u;t[0]!==i||t[1]!==a.path?(u=ye(i,a.path,`.claude-plugin/plugin.json`),t[0]=i,t[1]=a.path,t[2]=u):u=t[2];let d=r(u),m;t[3]!==i||t[4]!==a.path?(m=ye(i,a.path,`.codex-plugin/plugin.json`),t[3]=i,t[4]=a.path,t[5]=m):m=t[5];let h=r(m),{displayName:_,description:v,publisher:y,iconPath:x}=Ue(Ge(d),Ge(h)),S=Ge(r(ye(i,a.path,x??null))),C=x&&S?.trimStart().startsWith(`<`)?`data:image/svg+xml;charset=utf-8,${encodeURIComponent(S)}`:null,w=ee(i),E;t[6]===C?E=t[7]:(E=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`flex size-10 shrink-0 items-center justify-center rounded-xl border border-border/60 bg-muted`,children:C?(0,Q.jsx)(`img`,{src:C,alt:``,className:`size-6 object-contain`}):(0,Q.jsx)(f,{className:`size-5 text-muted-foreground`})}),t[6]=C,t[7]=E);let D=_??a.name,O;t[8]===D?O=t[9]:(O=(0,Q.jsx)(`span`,{className:`break-words text-sm font-medium`,children:D}),t[8]=D,t[9]=O);let A;t[10]===y?A=t[11]:(A=y?(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:y}):null,t[10]=y,t[11]=A);let j;t[12]!==O||t[13]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[O,A]}),t[12]=O,t[13]=A,t[14]=j):j=t[14];let M=v??`Local plugin`,N;t[15]===M?N=t[16]:(N=(0,Q.jsx)(`p`,{className:`break-words text-xs text-muted-foreground`,children:M}),t[15]=M,t[16]=N);let P;t[17]!==j||t[18]!==N?(P=(0,Q.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-1`,children:[j,N]}),t[17]=j,t[18]=N,t[19]=P):P=t[19];let F=`More for ${a.name}`,I;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(b,{"aria-hidden":!0}),t[20]=I):I=t[20];let L;t[21]===F?L=t[22]:(L=(0,Q.jsx)(J,{render:(0,Q.jsx)(g,{render:(0,Q.jsx)(T,{variant:`ghost`,size:`icon-sm`,"aria-label":F,children:I})})}),t[21]=F,t[22]=L);let R;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsx)(te,{children:`Plugin actions`}),t[23]=R):R=t[23];let z;t[24]===L?z=t[25]:(z=(0,Q.jsxs)(ne,{children:[L,R]}),t[24]=L,t[25]=z);let B;t[26]!==i||t[27]!==w||t[28]!==a.path?(B=w.capabilities.canOpenDefault?(0,Q.jsx)(p,{onClick:()=>void w.activate(`open`,{environmentId:i,filePath:a.path,workspaceRoot:void 0}),children:`Open`}):null,t[26]=i,t[27]=w,t[28]=a.path,t[29]=B):B=t[29];let V;t[30]===c?V=t[31]:(V=(0,Q.jsx)(p,{onClick:c,children:`Details`}),t[30]=c,t[31]=V);let H;t[32]!==B||t[33]!==V?(H=(0,Q.jsxs)(n,{align:`end`,children:[B,V]}),t[32]=B,t[33]=V,t[34]=H):H=t[34];let U;t[35]!==z||t[36]!==H?(U=(0,Q.jsxs)(k,{children:[z,H]}),t[35]=z,t[36]=H,t[37]=U):U=t[37];let W=`Load ${a.name}`,G;t[38]!==s||t[39]!==o||t[40]!==l||t[41]!==W?(G=(0,Q.jsx)(Ne,{"aria-label":W,checked:o,disabled:s,onCheckedChange:l}),t[38]=s,t[39]=o,t[40]=l,t[41]=W,t[42]=G):G=t[42];let K;return t[43]!==P||t[44]!==U||t[45]!==G||t[46]!==E?(K=(0,Q.jsxs)(`li`,{className:`flex items-center gap-4 py-4`,children:[E,P,U,G]}),t[43]=P,t[44]=U,t[45]=G,t[46]=E,t[47]=K):K=t[47],K}var qe=[`Personal`,`Built-in`,`Project`,`Plugins`,`Other`];function Je(e){switch(q(e)){case`personal`:return`Personal`;case`system`:return`Built-in`;case`repo`:case`project`:return`Project`;case`app`:return`Plugins`;default:return`Other`}}var Ye=[[`codex`,`Codex`],[`claudeAgent`,`Claude`],[`cursor`,`Cursor`],[`grok`,`Grok`],[`antigravity`,`Antigravity`],[`opencode`,`OpenCode`],[`muse`,`Muse`],[`pi`,`Pi`]],Xe={remote:`Remote servers aren't supported by this provider`,"working-directory":`Servers with a working directory aren't supported here`,provider:`Not supported by this provider yet`};function Ze(e){return Ye.find(([t])=>t===e)?.[1]??e}function Qe(e){switch(e){case`signed-in`:return`Signed in`;case`signed-out`:return`Not signed in`;case`unavailable`:return`Add this server to the provider's own MCP config to sign in.`;case`unknown`:return`Sign-in status unknown`}}function $e(e,t){if(!h(e))return`unavailable`;let n=t.filter(t=>t.driver===e);if(n.some(e=>e.status===`signed-in`))return`signed-in`;if(n.some(e=>e.status===`signed-out`))return`needs-sign-in`}function et(e){return Ye.map(([t,n])=>{let r=A(t,e.transport),i=j.make(t);return{driver:i,label:n,enabled:r.supported&&!e.disabledProviders.includes(i),...r.supported?{}:{unsupported:Xe[r.reason]}}})}var tt={name:``,type:`stdio`,command:``,args:``,cwd:``,url:``,auth:`none`,values:[]};function nt(e){let t=e.transport;return t.type===`stdio`?{...tt,name:e.name,type:`stdio`,command:t.command,args:t.args.join(`
2
2
  `),cwd:t.cwd??``,values:Object.entries(t.env).map(([e,t])=>({key:e,value:t}))}:{...tt,name:e.name,type:`http`,url:t.url,auth:t.auth,values:Object.entries(t.headers).map(([e,t])=>({key:e,value:t}))}}var rt=/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/;function it(e,t){let n=e.name.trim();if(!n)return`Enter a name.`;if(!rt.test(n)||n.length>64)return`Use letters, numbers, dashes, and underscores.`;if(n===`p4-code`)return`That name belongs to P4 Code's own server.`;if(t.has(n))return`Another server already uses that name.`;if(e.type===`stdio`&&!e.command.trim())return`Enter the command that starts it.`;if(e.type===`http`&&!/^https?:\/\/\S+$/i.test(e.url.trim()))return`Enter an http or https URL.`}function at(e,t){let n=Object.fromEntries(e.values.map(e=>[e.key.trim(),e.value]).filter(([e])=>e.length>0)),r=e.type===`stdio`?{type:`stdio`,command:e.command.trim(),args:e.args.split(`
3
3
  `).map(e=>e.trim()).filter(e=>e.length>0),env:n,...e.cwd.trim()?{cwd:e.cwd.trim()}:{}}:{type:`http`,url:e.url.trim(),headers:n,auth:e.auth};return{name:e.name.trim(),enabled:t?.enabled??!0,transport:r,disabledProviders:t?.disabledProviders??[],...t?.source===void 0?{}:{source:t.source}}}function ot(e){let t=new Map;for(let n of e){let e=n.displayName??n.driver;for(let r of n.skills){let n=`${r.scope??``}\u0000${r.name}`,i=t.get(n);i===void 0?t.set(n,{skill:r,providers:[e]}):i.providers.includes(e)||i.providers.push(e)}}return[...t.values()].toSorted((e,t)=>st(e.skill).localeCompare(st(t.skill)))}var st=e=>e.displayName??e.name.split(/[-_\s]+/).filter(e=>e.length>0).map(e=>e[0].toUpperCase()+e.slice(1)).join(` `);function ct(e){switch(e){case void 0:return;case`user`:return`Personal`;case`project`:case`repo`:return`Project`;case`system`:return`Built-in`;default:return e[0].toUpperCase()+e.slice(1)}}function lt(e){let t=/^---\r?\n[\s\S]*?\r?\n---\r?\n?/.exec(e);return(t===null?e:e.slice(t[0].length)).trimStart()}function ut(e){let t=(0,Y.c)(14),{title:n,onBack:r,onUninstall:i,children:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(m,{"aria-hidden":!0}),t[0]=o):o=t[0];let s;t[1]===r?s=t[2]:(s=(0,Q.jsxs)(T,{size:`xs`,variant:`ghost`,className:`w-fit`,onClick:r,children:[o,`Back`]}),t[1]=r,t[2]=s);let c;t[3]===n?c=t[4]:(c=(0,Q.jsx)(`h2`,{className:`min-w-0 truncate text-xl font-semibold text-foreground`,children:n}),t[3]=n,t[4]=c);let l;t[5]===i?l=t[6]:(l=i?(0,Q.jsxs)(T,{size:`sm`,variant:`destructive-outline`,onClick:i,children:[(0,Q.jsx)(u,{"aria-hidden":!0}),`Uninstall`]}):null,t[5]=i,t[6]=l);let d;t[7]!==c||t[8]!==l?(d=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[c,l]}),t[7]=c,t[8]=l,t[9]=d):d=t[9];let f;return t[10]!==a||t[11]!==s||t[12]!==d?(f=(0,Q.jsxs)(`div`,{className:`grid gap-6`,children:[s,d,a]}),t[10]=a,t[11]=s,t[12]=d,t[13]=f):f=t[13],f}function $(e){let t=(0,Y.c)(6),{label:n,htmlFor:r,children:i}=e,a;t[0]!==r||t[1]!==n?(a=(0,Q.jsx)(Pe,{htmlFor:r,children:n}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==a?(o=(0,Q.jsxs)(`div`,{className:`grid gap-2 px-4 py-4`,children:[a,i]}),t[3]=i,t[4]=a,t[5]=o):o=t[5],o}function dt(e){let t=(0,Y.c)(69),{server:n,takenNames:r,onSave:i}=e,o;t[0]===n?o=t[1]:(o=n===void 0?tt:nt(n),t[0]=n,t[1]=o);let s=o,[c,l]=(0,X.useState)(s),d;t[2]===s?d=t[3]:(d=JSON.stringify(s),t[2]=s,t[3]=d);let f=d,[p,m]=(0,X.useState)(f);f!==p&&(m(f),l(s));let h;t[4]!==c||t[5]!==r?(h=it(c,r),t[4]=c,t[5]=r,t[6]=h):h=t[6];let g=h,_;t[7]===c?_=t[8]:(_=JSON.stringify(c),t[7]=c,t[8]=_);let v=_!==f,y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>l(t=>({...t,...e})),t[9]=y):y=t[9];let b=y,x=c.type===`stdio`?`Environment variables`:`Headers`,S;t[10]===c.values?S=t[11]:(S=(e,t)=>b({values:c.values.map((n,r)=>r===e?{...n,...t}:n)}),t[10]=c.values,t[11]=S);let C=S,w;t[12]!==v||t[13]!==c||t[14]!==i||t[15]!==g||t[16]!==n?(w=e=>{e.preventDefault(),v&&g===void 0&&i(at(c,n))},t[12]=v,t[13]=c,t[14]=i,t[15]=g,t[16]=n,t[17]=w):w=t[17];let E;t[18]===n?E=t[19]:(E=n===void 0?null:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`To switch between a command and a URL, uninstall the server and add it again.`}),t[18]=n,t[19]=E);let D;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>b({name:e.target.value}),t[20]=D):D=t[20];let O;t[21]===c.name?O=t[22]:(O=(0,Q.jsx)($,{label:`Name`,htmlFor:`mcp-server-name`,children:(0,Q.jsx)(se,{id:`mcp-server-name`,placeholder:`github`,value:c.name,onChange:D})}),t[21]=c.name,t[22]=O);let k;t[23]!==c.type||t[24]!==n?(k=n===void 0?(0,Q.jsx)($,{label:`Type`,children:(0,Q.jsxs)(ae,{"aria-label":`How P4 Code reaches the server`,value:[c.type],onValueChange:e=>{let t=e[0];(t===`stdio`||t===`http`)&&b({type:t,values:[]})},children:[(0,Q.jsx)(oe,{value:`stdio`,children:`Command`}),(0,Q.jsx)(oe,{value:`http`,children:`URL`})]})}):null,t[23]=c.type,t[24]=n,t[25]=k):k=t[25];let A;t[26]!==c.args||t[27]!==c.auth||t[28]!==c.command||t[29]!==c.cwd||t[30]!==c.type||t[31]!==c.url?(A=c.type===`stdio`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($,{label:`Command`,htmlFor:`mcp-server-command`,children:(0,Q.jsx)(se,{id:`mcp-server-command`,placeholder:`npx`,value:c.command,onChange:e=>b({command:e.target.value})})}),(0,Q.jsx)($,{label:`Arguments, one per line`,htmlFor:`mcp-server-args`,children:(0,Q.jsx)(ie,{id:`mcp-server-args`,placeholder:`-y
4
4
  @modelcontextprotocol/server-postgres`,value:c.args,onChange:e=>b({args:e.target.value})})}),(0,Q.jsx)($,{label:`Working directory (optional)`,htmlFor:`mcp-server-cwd`,children:(0,Q.jsx)(se,{id:`mcp-server-cwd`,placeholder:`The session's project folder`,value:c.cwd,onChange:e=>b({cwd:e.target.value})})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($,{label:`URL`,htmlFor:`mcp-server-url`,children:(0,Q.jsx)(se,{id:`mcp-server-url`,placeholder:`https://mcp.example.com/mcp`,value:c.url,onChange:e=>b({url:e.target.value})})}),(0,Q.jsx)($,{label:`Authentication`,children:(0,Q.jsxs)(V,{value:c.auth,onValueChange:e=>{(e===`none`||e===`oauth`)&&b({auth:e})},children:[(0,Q.jsx)(B,{"aria-label":`Authentication`,children:(0,Q.jsx)(R,{children:ft})}),(0,Q.jsxs)(z,{alignItemWithTrigger:!1,children:[(0,Q.jsx)(L,{value:`none`,children:`None or headers`}),(0,Q.jsx)(L,{value:`oauth`,children:`OAuth (sign in after saving)`})]})]})})]}),t[26]=c.args,t[27]=c.auth,t[28]=c.command,t[29]=c.cwd,t[30]=c.type,t[31]=c.url,t[32]=A):A=t[32];let j;t[33]!==c.type||t[34]!==c.values||t[35]!==C||t[36]!==x?(j=c.values.map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(se,{"aria-label":`${x} name`,placeholder:c.type===`stdio`?`API_TOKEN`:`Authorization`,value:e.key,onChange:e=>C(t,{key:e.target.value})}),(0,Q.jsx)(Ie,{"aria-label":`${x} value`,placeholder:`Value`,value:e.value,onChange:e=>C(t,{value:e.target.value})}),(0,Q.jsx)(T,{size:`icon-sm`,variant:`ghost`,"aria-label":`Remove ${e.key||`row`}`,onClick:()=>b({values:c.values.filter((e,n)=>n!==t)}),children:(0,Q.jsx)(u,{"aria-hidden":!0})})]},t)),t[33]=c.type,t[34]=c.values,t[35]=C,t[36]=x,t[37]=j):j=t[37];let M;t[38]===c.values?M=t[39]:(M=()=>b({values:[...c.values,{key:``,value:``}]}),t[38]=c.values,t[39]=M);let N;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(a,{"aria-hidden":!0}),t[40]=N):N=t[40];let P=c.type===`stdio`?`variable`:`header`,F;t[41]!==M||t[42]!==P?(F=(0,Q.jsxs)(T,{variant:`soft`,onClick:M,children:[N,`Add `,P]}),t[41]=M,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==j||t[45]!==F?(I=(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[j,F]}),t[44]=j,t[45]=F,t[46]=I):I=t[46];let H;t[47]!==I||t[48]!==x?(H=(0,Q.jsx)($,{label:x,children:I}),t[47]=I,t[48]=x,t[49]=H):H=t[49];let U;t[50]!==O||t[51]!==k||t[52]!==A||t[53]!==H?(U=(0,Q.jsxs)(Se,{children:[O,k,A,H]}),t[50]=O,t[51]=k,t[52]=A,t[53]=H,t[54]=U):U=t[54];let W;t[55]!==v||t[56]!==g?(W=v&&g!==void 0?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-foreground`,children:g}):null,t[55]=v,t[56]=g,t[57]=W):W=t[57];let G=!v||g!==void 0,K=n===void 0?`Add server`:`Save`,q;t[58]!==G||t[59]!==K?(q=(0,Q.jsx)(T,{type:`submit`,disabled:G,children:K}),t[58]=G,t[59]=K,t[60]=q):q=t[60];let ee;t[61]!==W||t[62]!==q?(ee=(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[W,q]}),t[61]=W,t[62]=q,t[63]=ee):ee=t[63];let J;return t[64]!==U||t[65]!==ee||t[66]!==w||t[67]!==E?(J=(0,Q.jsxs)(`form`,{className:`grid gap-3`,onSubmit:w,children:[E,U,ee]}),t[64]=U,t[65]=ee,t[66]=w,t[67]=E,t[68]=J):J=t[68],J}function ft(e){return e===`oauth`?`OAuth (sign in after saving)`:`None or headers`}function pt(e){let t=(0,Y.c)(55),{environmentId:n,plugin:i,environmentLabel:a,onSave:s}=e,c=i?.path??``,l=i===void 0?null:`.claude-plugin/plugin.json`,u;t[0]!==n||t[1]!==c||t[2]!==l?(u=ye(n,c,l),t[0]=n,t[1]=c,t[2]=l,t[3]=u):u=t[3];let f=d(o(r(u))),p=We(i!==void 0&&f!==null&&!f.truncated?f.contents:null),m;t[4]===i?.options?m=t[5]:(m=i?.options??{},t[4]=i?.options,t[5]=m);let h=m,g=[...p,...Object.keys(h).filter(e=>!p.some(t=>t.key===e)).map(ht)],[_,v]=(0,X.useState)(i?.name??``),[y,b]=(0,X.useState)(i?.path??``),[x,S]=(0,X.useState)(h),C;t[6]!==i?.name||t[7]!==i?.path||t[8]!==h?(C=JSON.stringify([i?.name??``,i?.path??``,h]),t[6]=i?.name,t[7]=i?.path,t[8]=h,t[9]=C):C=t[9];let w=C,[E,D]=(0,X.useState)(w);w!==E&&(D(w),v(i?.name??``),b(i?.path??``),S(h));let O,k;t[10]!==_||t[11]!==x||t[12]!==y||t[13]!==i?.name||t[14]!==i?.path||t[15]!==h?(O=Object.fromEntries(Object.entries(x).filter(mt)),k=_!==(i?.name??``)||y!==(i?.path??``)||JSON.stringify(O)!==JSON.stringify(h),t[10]=_,t[11]=x,t[12]=y,t[13]=i?.name,t[14]=i?.path,t[15]=h,t[16]=O,t[17]=k):(O=t[16],k=t[17]);let A=k,j;t[18]!==_||t[19]!==y?(j=_.trim().length>0&&y.trim().startsWith(`/`),t[18]=_,t[19]=y,t[20]=j):j=t[20];let M=j,N;t[21]!==A||t[22]!==_||t[23]!==O||t[24]!==s||t[25]!==y||t[26]!==i?.enabled||t[27]!==M?(N=e=>{e.preventDefault(),A&&M&&s({name:_.trim(),path:y.trim(),enabled:i?.enabled??!0,options:O})},t[21]=A,t[22]=_,t[23]=O,t[24]=s,t[25]=y,t[26]=i?.enabled,t[27]=M,t[28]=N):N=t[28];let P;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>v(e.target.value),t[29]=P):P=t[29];let F;t[30]===_?F=t[31]:(F=(0,Q.jsx)($,{label:`Name`,htmlFor:`plugin-name`,children:(0,Q.jsx)(se,{id:`plugin-name`,value:_,onChange:P})}),t[30]=_,t[31]=F);let I=`Folder on ${a}`,L;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>b(e.target.value),t[32]=L):L=t[32];let R;t[33]===y?R=t[34]:(R=(0,Q.jsx)(se,{id:`plugin-path`,placeholder:`/Users/me/plugins/my-plugin`,value:y,onChange:L}),t[33]=y,t[34]=R);let z;t[35]!==I||t[36]!==R?(z=(0,Q.jsx)($,{label:I,htmlFor:`plugin-path`,children:R}),t[35]=I,t[36]=R,t[37]=z):z=t[37];let B=g.map(e=>(0,Q.jsx)($,{label:e.required?e.title:`${e.title} (optional)`,htmlFor:`plugin-option-${e.key}`,children:(0,Q.jsx)(Ie,{id:`plugin-option-${e.key}`,placeholder:`description`in e?e.description:void 0,value:x[e.key]??``,onChange:t=>S(n=>({...n,[e.key]:t.target.value}))})},e.key)),V;t[38]!==F||t[39]!==z||t[40]!==B?(V=(0,Q.jsxs)(Se,{children:[F,z,B]}),t[38]=F,t[39]=z,t[40]=B,t[41]=V):V=t[41];let H;t[42]!==A||t[43]!==M?(H=A&&!M?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-foreground`,children:`Enter a name and the plugin folder's full path.`}):null,t[42]=A,t[43]=M,t[44]=H):H=t[44];let U=!A||!M,W=i===void 0?`Add plugin`:`Save`,G;t[45]!==U||t[46]!==W?(G=(0,Q.jsx)(T,{type:`submit`,disabled:U,children:W}),t[45]=U,t[46]=W,t[47]=G):G=t[47];let K;t[48]!==H||t[49]!==G?(K=(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[H,G]}),t[48]=H,t[49]=G,t[50]=K):K=t[50];let q;return t[51]!==V||t[52]!==K||t[53]!==N?(q=(0,Q.jsxs)(`form`,{className:`grid gap-3`,onSubmit:N,children:[V,K]}),t[51]=V,t[52]=K,t[53]=N,t[54]=q):q=t[54],q}function mt(e){let[,t]=e;return t}function ht(e){return{key:e,title:e,required:!1}}var gt=e=>e.replace(/[\\/][^\\/]*$/,``)||`/`;function _t(e){let t=(0,Y.c)(69),{entry:i,environmentId:a,onClose:s}=e,{skill:c,providers:l}=i,u,f,m;t[0]!==a||t[1]!==c.path?(u=gt(c.path),f=r,m=ye(a,u,c.path),t[0]=a,t[1]=c.path,t[2]=u,t[3]=f,t[4]=m):(u=t[2],f=t[3],m=t[4]);let h=f(m),v;t[5]===h?v=t[6]:(v=d(o(h)),t[5]=h,t[6]=v);let y=v,x=ee(a),{copyToClipboard:S}=U(),C;t[7]!==a||t[8]!==c.path?(C={environmentId:a,filePath:c.path,workspaceRoot:void 0},t[7]=a,t[8]=c.path,t[9]=C):C=t[9];let w=C,E=c.shortDescription??c.description,D;t[10]===c.scope?D=t[11]:(D=ct(c.scope),t[10]=c.scope,t[11]=D);let O=D,A;t[12]===s?A=t[13]:(A=e=>!e&&s(),t[12]=s,t[13]=A);let j;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`flex size-12 shrink-0 items-center justify-center rounded-full border border-border/60 text-muted-foreground`,children:(0,Q.jsx)(_,{className:`size-5`})}),t[14]=j):j=t[14];let M;t[15]===c?M=t[16]:(M=st(c),t[15]=c,t[16]=M);let N=`More for ${M}`,P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(b,{"aria-hidden":!0}),t[17]=P):P=t[17];let F;t[18]===N?F=t[19]:(F=(0,Q.jsx)(g,{render:(0,Q.jsx)(T,{size:`icon-sm`,variant:`ghost`,"aria-label":N,children:P})}),t[18]=N,t[19]=F);let L;t[20]!==x||t[21]!==w?(L=x.capabilities.canOpenDefault?(0,Q.jsx)(p,{onClick:()=>void x.activate(`open`,w),children:`Open`}):null,t[20]=x,t[21]=w,t[22]=L):L=t[22];let R;t[23]!==x||t[24]!==w?(R=x.capabilities.revealLabel?(0,Q.jsx)(p,{onClick:()=>void x.activate(`reveal-in-folder`,w),children:x.capabilities.revealLabel}):null,t[23]=x,t[24]=w,t[25]=R):R=t[25];let z=y===null,B;t[26]!==S||t[27]!==y?(B=()=>y&&S(y.contents,void 0),t[26]=S,t[27]=y,t[28]=B):B=t[28];let V;t[29]!==z||t[30]!==B?(V=(0,Q.jsx)(p,{disabled:z,onClick:B,children:`Copy Markdown`}),t[29]=z,t[30]=B,t[31]=V):V=t[31];let H;t[32]!==L||t[33]!==R||t[34]!==V?(H=(0,Q.jsxs)(n,{align:`end`,children:[L,R,V]}),t[32]=L,t[33]=R,t[34]=V,t[35]=H):H=t[35];let W;t[36]!==F||t[37]!==H?(W=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3 pe-8`,children:[j,(0,Q.jsxs)(k,{children:[F,H]})]}),t[36]=F,t[37]=H,t[38]=W):W=t[38];let G;t[39]===c?G=t[40]:(G=st(c),t[39]=c,t[40]=G);let K;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`Skill`}),t[41]=K):K=t[41];let q;t[42]===G?q=t[43]:(q=(0,Q.jsxs)(ce,{children:[G,` `,K]}),t[42]=G,t[43]=q);let J;t[44]===E?J=t[45]:(J=E?(0,Q.jsx)(le,{children:E}):null,t[44]=E,t[45]=J);let te;t[46]!==q||t[47]!==J?(te=(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[q,J]}),t[46]=q,t[47]=J,t[48]=te):te=t[48];let ne;t[49]!==u||t[50]!==a||t[51]!==y||t[52]!==h?(ne=(0,Q.jsx)(`div`,{className:`max-h-[50vh] min-h-24 overflow-y-auto rounded-xl border border-border/60 bg-card/40 px-5 py-4`,children:y===null?h._tag===`Failure`?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This skill's file could not be read. It may have moved since the provider last scanned it.`}):(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(re,{className:`h-4 w-3/4`}),(0,Q.jsx)(re,{className:`h-4 w-full`}),(0,Q.jsx)(re,{className:`h-4 w-2/3`})]}):(0,Q.jsx)(I,{text:lt(y.contents),cwd:u,environmentId:a})}),t[49]=u,t[50]=a,t[51]=y,t[52]=h,t[53]=ne):ne=t[53];let ie;t[54]===l?ie=t[55]:(ie=l.join(`, `),t[54]=l,t[55]=ie);let ae=`Loaded by ${ie}`,oe;t[56]!==O||t[57]!==ae?(oe=[O,ae].filter(Boolean),t[56]=O,t[57]=ae,t[58]=oe):oe=t[58];let se=oe.join(` · `),fe;t[59]===se?fe=t[60]:(fe=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:se}),t[59]=se,t[60]=fe);let pe;t[61]!==W||t[62]!==te||t[63]!==ne||t[64]!==fe?(pe=(0,Q.jsx)(ue,{className:`max-w-2xl`,children:(0,Q.jsxs)(`div`,{className:`grid min-h-0 gap-4 p-6`,children:[W,te,ne,fe]})}),t[61]=W,t[62]=te,t[63]=ne,t[64]=fe,t[65]=pe):pe=t[65];let me;return t[66]!==pe||t[67]!==A?(me=(0,Q.jsx)(de,{open:!0,onOpenChange:A,children:pe}),t[66]=pe,t[67]=A,t[68]=me):me=t[68],me}var vt={claude:`Claude`,codex:`Codex`,cursor:`Cursor`},yt={success:`bg-success`,warning:`bg-warning`,error:`bg-destructive`,muted:`bg-muted-foreground/40`},bt={success:`text-success-foreground`,warning:`text-warning-foreground`,error:`text-destructive-foreground`,muted:`text-muted-foreground`},xt=w(v);function St(e){let t=s(e);return xt(t)&&t.reason===`rejected`?`This server only lets apps it has approved sign in, and it refused P4 Code. Sign in with a provider below instead.`:`Sign-in could not start. Check the server URL, then try again.`}function Ct(e,t,n){return e.transport.type===`http`&&(e.transport.auth===`oauth`||n?.auth===`signed-in`||t.needsSignIn)}function wt(e){let t=(0,Y.c)(13),{status:n,className:r}=e,i=bt[n.tone],a;t[0]!==r||t[1]!==i?(a=M(`flex min-w-0 items-center gap-1.5 text-xs`,i,r),t[0]=r,t[1]=i,t[2]=a):a=t[2];let o=yt[n.tone],s;t[3]===o?s=t[4]:(s=M(`size-1.5 shrink-0 rounded-full`,o),t[3]=o,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:s}),t[5]=s,t[6]=c);let l;t[7]===n.label?l=t[8]:(l=(0,Q.jsx)(`span`,{className:`truncate`,children:n.label}),t[7]=n.label,t[8]=l);let u;return t[9]!==a||t[10]!==c||t[11]!==l?(u=(0,Q.jsxs)(`span`,{className:a,children:[c,l]}),t[9]=a,t[10]=c,t[11]=l,t[12]=u):u=t[12],u}function Tt(){let e=(0,Y.c)(6),{environment:t,scope:n}=be(),r=t?.connection.phase===`connected`&&t.serverConfig!==null,i=r?t.environmentId:null,a=r&&t.serverConfig?.environment.capabilities.mcpRegistry===!0,o;return e[0]!==r||e[1]!==t||e[2]!==i||e[3]!==n||e[4]!==a?(o=(0,Q.jsx)(we,{width:`wide`,children:t===null||!r?(0,Q.jsx)(he,{children:(0,Q.jsxs)(fe,{children:[(0,Q.jsx)(pe,{children:`Connect to manage plugins and MCP servers`}),(0,Q.jsx)(me,{children:`They live on each environment. Choose a connected one above.`})]})}):!a||i===null?(0,Q.jsx)(he,{children:(0,Q.jsxs)(fe,{children:[(0,Q.jsxs)(pe,{children:[`Update `,t.label,` to manage plugins and MCP servers`]}),(0,Q.jsx)(me,{children:`This environment runs a version without them.`})]})}):(0,Q.jsx)(kt,{environmentId:i,environmentLabel:t.label,projectId:n.kind===`checkout`?n.checkout.id:n.kind===`project`?n.members.find(e=>e.environmentId===i)?.id:void 0,projectLabel:n.kind===`project`||n.kind===`checkout`?n.label:void 0},i)}),e[0]=r,e[1]=t,e[2]=i,e[3]=n,e[4]=a,e[5]=o):o=e[5],o}var Et={plugins:`Search plugins`,mcps:`Search MCP servers`,skills:`Search skills`},Dt=(e,...t)=>e===``||t.some(t=>t.toLowerCase().includes(e));function Ot(e){let t=(0,Y.c)(9),{text:n}=e,r=(0,X.useRef)(null),[i,a]=(0,X.useState)(!1),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{let t=r.current;a(e&&t!==null&&t.scrollWidth>t.clientWidth)},t[0]=o):o=t[0];let s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(`span`,{ref:r,tabIndex:0,className:`block truncate text-xs text-muted-foreground`}),t[1]=s):s=t[1];let c,l;t[2]===n?(c=t[3],l=t[4]):(c=(0,Q.jsx)(J,{render:s,children:n}),l=(0,Q.jsx)(te,{children:n}),t[2]=n,t[3]=c,t[4]=l);let u;return t[5]!==i||t[6]!==c||t[7]!==l?(u=(0,Q.jsxs)(ne,{open:i,onOpenChange:o,children:[c,l]}),t[5]=i,t[6]=c,t[7]=l,t[8]=u):u=t[8],u}function kt({environmentId:e,environmentLabel:t,projectId:i,projectLabel:a}){let o=H({select:e=>e.hash}),[s,l]=(0,X.useState)(()=>o.replace(/^#/,``)===`mcp-servers`?`mcps`:o.replace(/^#/,``)===`skills`?`skills`:`plugins`),[u,d]=(0,X.useState)(``),[m,h]=(0,X.useState)(`All categories`),v=r(G.configValueAtom(e))?.providers,w=(0,X.useMemo)(()=>ot(v??[]),[v]),[E,A]=(0,X.useState)(null),j=xe(e=>e.mcpServers),M=xe(e=>e.plugins),I=xe(e=>e.projectSettingsOverrides),U=xe(e=>e.skillOverrides),q=ee(e),re=r(G.updateSettings.permissionAtom(e)),[ie,se]=(0,X.useState)(null),ce=r(G.mcpRegistryTest.permissionAtom(e)),le=W(e),ue=K(G.updateSettings,{label:`update MCP registry`,reportFailure:!0}),de=K(G.mcpRegistryState,{reportFailure:!1}),fe=K(G.mcpRegistryTest,{label:`check MCP server`,reportFailure:!0}),pe=K(G.mcpRegistryOAuthStart,{label:`start MCP sign-in`,reportFailure:!0}),me=K(G.mcpRegistryOAuthSignOut,{label:`sign out of MCP server`,reportFailure:!0}),he=K(G.mcpRegistryDiscover,{reportFailure:!1}),ye=K(G.mcpRegistryImport,{label:`import MCP servers`,reportFailure:!0}),[be,Se]=(0,X.useState)({}),[Ce,we]=(0,X.useState)(new Set),[Pe,Ie]=(0,X.useState)([]),[Y,Le]=(0,X.useState)({kind:`list`}),Z=Y.kind!==`list`&&Y.id!==null&&(Y.kind===`server`?j[Y.id]===void 0:M[Y.id]===void 0)?{kind:`list`}:Y,[Be,Ve]=(0,X.useState)(o);if(o!==Be){Ve(o);let e=o.replace(/^#/,``);(e===`mcp-servers`||e===`plugins`||e===`skills`)&&(l(e===`mcp-servers`?`mcps`:e),Le({kind:`list`}))}let[He,Ue]=(0,X.useState)(null),We=(0,X.useRef)(new Map),[Ge,Ye]=(0,X.useState)(null),[Xe,Ze]=(0,X.useState)({}),Qe=(0,X.useMemo)(()=>Object.entries(j).map(([e,t])=>[N.make(e),t]).toSorted(([,e],[,t])=>e.name.localeCompare(t.name)),[j]),$e=(0,X.useMemo)(()=>Object.entries(M).map(([e,t])=>[D.make(e),t]),[M]),et=(0,X.useCallback)(async()=>{let t=await de({environmentId:e,input:{}});t._tag===`Success`&&Se(t.value.servers)},[e,de]),tt=(0,X.useCallback)(async()=>{if(!ce)return;let t=await he({environmentId:e,input:i===void 0?{}:{projectId:i}});t._tag===`Success`&&Ie(t.value.servers)},[ce,he,e,i]);(0,X.useEffect)(()=>{et(),tt()},[et,tt]);let nt=e=>{l(`mcps`),Le({kind:`server`,id:e})},rt=e=>{l(`plugins`),Le({kind:`plugin`,id:e})},it=t=>ue({environmentId:e,input:{patch:t}}),at=async t=>{we(e=>new Set(e).add(t));let n=await fe({environmentId:e,input:{serverId:t}});if(we(e=>{let n=new Set(e);return n.delete(t),n}),n._tag===`Success`)return Se(e=>({...e,[t]:n.value})),n.value},ct=(0,X.useEffectEvent)(async e=>{(await at(e))?.health.status===`connected`&&Ye(null)});(0,X.useEffect)(()=>{if(Ge===null)return;let e=()=>void ct(Ge);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[Ge]);let lt=async(e,t,n)=>{(await it({mcpServers:{[e]:t}}))._tag===`Success`&&(n&&Le({kind:`list`}),tt(),t.enabled&&await at(e))},$=async(t,n=!1)=>{let r=We.current.get(t);if(!n&&Ge===t&&r){window.open(r,`_blank`,`noopener,noreferrer`);return}let i=le??window.location.origin;Ze(e=>{let n={...e};return delete n[t],n});let a=await pe({environmentId:e,input:{serverId:t,origin:new URL(i,window.location.href).origin,...n?{reauthenticate:n}:{}}});if(a._tag!==`Success`){a._tag===`Failure`&&Ze(e=>({...e,[t]:St(a.cause)}));return}if(a.value.authorizationUrl===null){await at(t);return}We.current.set(t,a.value.authorizationUrl),Ye(t),window.open(a.value.authorizationUrl,`_blank`,`noopener,noreferrer`)},ft=async t=>{let n=await me({environmentId:e,input:{serverId:t}});n._tag===`Success`&&Se(e=>({...e,[t]:n.value}))},mt=(e,t,n)=>{if(i===void 0)return;let r=I[i]??{},a={...r[e]};n===void 0?delete a[t]:a[t]={enabled:n},it({projectSettingsOverrides:{[i]:{...r,[e]:a}}})},ht=async()=>{let t=He;if(Ue(null),t!==null){if(t.kind===`server`){let n=j[t.id];n?.transport.type===`http`&&n.transport.auth===`oauth`&&await me({environmentId:e,input:{serverId:t.id}}),await it({mcpServers:{[t.id]:null}})}else await it({plugins:{[t.id]:null}});Le({kind:`list`})}},gt=Pe.filter(e=>!e.alreadyAdded),yt=new Set(Qe.filter(([e])=>Z.kind!==`server`||e!==Z.id).map(([,e])=>e.name)),bt=u.trim().toLowerCase(),xt=Qe.filter(([,e])=>Dt(bt,e.name,ze(e))),Tt=$e.filter(([,e])=>Dt(bt,e.name,e.path)),kt=gt.filter(e=>Dt(bt,e.name,e.summary)),At=(e,t)=>x({mcpServers:j,plugins:M,projectSettingsOverrides:I},e,i??null,t),Mt=(e,t,n)=>{if(i!==void 0){mt(e,t,n);return}it(e===`mcpServers`?{mcpServers:{[t]:{...j[t],enabled:n}}}:{plugins:{[t]:{...M[t],enabled:n}}})},Nt=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-1`,children:[(0,Q.jsx)(`h1`,{className:`text-2xl font-semibold text-foreground`,children:`Plugins`}),(0,Q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Manage plugins, skills, and MCP servers given to agents on `,t,`.`]})]}),ce?(0,Q.jsxs)(k,{children:[(0,Q.jsx)(g,{render:(0,Q.jsxs)(T,{children:[`Add`,(0,Q.jsx)(P,{"aria-hidden":!0})]})}),(0,Q.jsxs)(n,{align:`end`,children:[(0,Q.jsxs)(p,{onClick:()=>nt(null),children:[(0,Q.jsx)(F,{"aria-hidden":!0}),`Add MCP server`]}),(0,Q.jsxs)(p,{onClick:()=>rt(null),children:[(0,Q.jsx)(f,{"aria-hidden":!0}),`Add plugin`]})]})]}):null]}),Pt=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Q.jsxs)(ae,{"aria-label":`Show`,variant:`default`,value:[s],onValueChange:e=>{let t=e[0];(t===`plugins`||t===`mcps`||t===`skills`)&&(l(t),Le({kind:`list`}))},children:[(0,Q.jsxs)(oe,{value:`plugins`,...Fe(`plugins`),children:[`Plugins `,(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:$e.length})]}),(0,Q.jsxs)(oe,{value:`mcps`,...Fe(`mcp-servers`),children:[`MCPs `,(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:Qe.length})]}),(0,Q.jsxs)(oe,{value:`skills`,...Fe(`skills`),children:[`Skills `,(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:w.length})]})]}),(0,Q.jsxs)(`div`,{className:`flex w-full gap-2 sm:w-auto`,children:[s===`skills`?(0,Q.jsx)(`div`,{className:`w-fit shrink-0`,children:(0,Q.jsxs)(V,{value:m,onValueChange:e=>e&&h(e),children:[(0,Q.jsx)(B,{"aria-label":`Skill category`,children:(0,Q.jsx)(R,{})}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(L,{value:`All categories`,children:`All categories`}),qe.filter(e=>e===`Personal`||e===`Built-in`||w.some(({skill:t})=>Je(t)===e)).map(e=>(0,Q.jsx)(L,{value:e,children:e},e))]})]})}):null,(0,Q.jsxs)(ve,{className:`min-w-0 flex-1 sm:w-56`,children:[(0,Q.jsx)(ge,{children:(0,Q.jsx)(y,{"aria-hidden":!0})}),(0,Q.jsx)(_e,{"aria-label":Et[s],placeholder:Et[s],value:u,onChange:e=>d(e.currentTarget.value)})]})]})]}),Ft=(e,t)=>(0,Q.jsxs)(ne,{children:[(0,Q.jsx)(J,{render:(0,Q.jsx)(T,{size:`icon-sm`,variant:`ghost`,"aria-label":e,onClick:t,children:(0,Q.jsx)(S,{"aria-hidden":!0})})}),(0,Q.jsx)(te,{children:e})]}),It=Tt.length===0?(0,Q.jsx)(`p`,{className:`py-6 text-sm text-muted-foreground`,children:$e.length===0?`No plugins yet. Add a Claude Code or Codex plugin folder to give its tools to your agents.`:`No plugins match your search.`}):(0,Q.jsx)(`ul`,{className:`grid gap-1`,children:Tt.map(([t,n])=>(0,Q.jsx)(Ke,{environmentId:e,plugin:n,enabled:At(`plugins`,t),disabled:!re,onDetails:()=>rt(t),onToggle:e=>Mt(`plugins`,t,e)},t))}),Lt=w.filter(({skill:e})=>(m===`All categories`||Je(e)===m)&&Dt(bt,st(e),e.name,e.shortDescription??``,e.description??``)),Rt=Lt.length===0?(0,Q.jsx)(`p`,{className:`py-6 text-sm text-muted-foreground`,children:w.length===0?`No skills found. Providers report the skills they load when they start.`:`No skills match these filters.`}):(0,Q.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Switches apply to new Claude and OpenCode sessions.`}),(0,Q.jsx)(`ul`,{className:`grid gap-1`,children:Lt.map(t=>{let r=Je(t.skill),a=(v??[]).filter(e=>O(e.driver)&&e.skills.some(e=>e.name===t.skill.name)),o=a.length?a.map(e=>e.displayName??e.driver).join(`, `):`Native settings`;return(0,Q.jsxs)(`li`,{className:`flex items-center gap-3 py-3`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`flex size-10 shrink-0 items-center justify-center rounded-full border border-border/60 text-muted-foreground`,children:(0,Q.jsx)(_,{className:`size-4`})}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>A(t),className:`w-fit break-words text-left text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:st(t.skill)}),(0,Q.jsx)(Ot,{text:t.skill.shortDescription??t.skill.description??t.skill.path}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:[r,o].filter(Boolean).join(` · `)})]}),(0,Q.jsxs)(k,{children:[(0,Q.jsxs)(ne,{children:[(0,Q.jsx)(J,{render:(0,Q.jsx)(g,{render:(0,Q.jsx)(T,{variant:`ghost`,size:`icon-sm`,"aria-label":`More for ${st(t.skill)}`,children:(0,Q.jsx)(b,{"aria-hidden":!0})})})}),(0,Q.jsx)(te,{children:`Skill actions`})]}),(0,Q.jsxs)(n,{align:`end`,children:[q.capabilities.canOpenDefault?(0,Q.jsx)(p,{onClick:()=>void q.activate(`open`,{environmentId:e,filePath:t.skill.path,workspaceRoot:void 0}),children:`Open`}):null,(0,Q.jsx)(p,{onClick:()=>A(t),children:`Details`}),i!==void 0&&I[i]?.skillOverrides?.[t.skill.name]!==void 0?(0,Q.jsx)(p,{onClick:()=>{let e=I[i]??{},n={...e.skillOverrides};delete n[t.skill.name],it({projectSettingsOverrides:{[i]:{...e,skillOverrides:n}}})},children:`Use environment setting`}):null]})]}),(0,Q.jsx)(Ne,{"aria-label":`Enable ${st(t.skill)} for ${o}`,checked:(i===void 0?void 0:I[i]?.skillOverrides?.[t.skill.name])??U[t.skill.name]??t.skill.enabled,disabled:!re||ie!==null||a.length===0,onCheckedChange:e=>{se(t.skill.name),it(i===void 0?{skillOverrides:{[t.skill.name]:e}}:{projectSettingsOverrides:{[i]:{...I[i],skillOverrides:{...I[i]?.skillOverrides,[t.skill.name]:e}}}}).finally(()=>se(null))}})]},t.skill.path)})})]}),Bt=(0,Q.jsxs)(`div`,{className:`grid gap-6`,children:[Qe.length>0?(0,Q.jsx)(Te,{title:`Servers`,children:xt.length===0?(0,Q.jsx)(`p`,{className:`px-3 text-sm text-muted-foreground sm:px-4`,children:`No MCP servers match your search.`}):(0,Q.jsx)(Q.Fragment,{children:xt.map(([e,t])=>{let r=At(`mcpServers`,e),i=Re({...t,enabled:r},be[e],Ce.has(e)),a=Xe[e],o=Ct(t,i,be[e]);return(0,Q.jsxs)(`div`,{className:`flex min-h-14 items-center gap-3 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`break-words text-sm font-medium text-foreground`,children:t.name}),i.tone===`error`||o?(0,Q.jsx)(wt,{status:i}):null,a?(0,Q.jsx)(`span`,{className:`text-xs text-destructive-foreground`,children:a}):null]}),i.needsSignIn&&ce?(0,Q.jsx)(T,{size:`xs`,variant:`outline`,onClick:()=>void $(e),children:`Authenticate`}):null,o&&!i.needsSignIn&&ce?(0,Q.jsxs)(k,{children:[(0,Q.jsxs)(ne,{children:[(0,Q.jsx)(J,{render:(0,Q.jsx)(g,{render:(0,Q.jsx)(T,{variant:`ghost`,size:`icon-sm`,"aria-label":`More for ${t.name}`,children:(0,Q.jsx)(b,{"aria-hidden":!0})})})}),(0,Q.jsx)(te,{children:`Sign-in actions`})]}),(0,Q.jsxs)(n,{align:`end`,children:[(0,Q.jsx)(p,{onClick:()=>void $(e,!0),children:`Re-authenticate`}),be[e]?.auth===`signed-in`?(0,Q.jsx)(p,{onClick:()=>void ft(e),children:`Sign out`}):null]})]}):null,Ft(`Settings for ${t.name}`,()=>nt(e)),(0,Q.jsx)(Ne,{"aria-label":`Give ${t.name} to agents`,checked:r,disabled:!ce,onCheckedChange:t=>Mt(`mcpServers`,e,t)})]},e)})})}):null,ce&&kt.length>0?(0,Q.jsx)(Te,{title:`Found in provider configs`,headerAction:(0,Q.jsx)(T,{size:`icon-xs`,variant:`ghost`,"aria-label":`Look again`,onClick:()=>void tt(),children:(0,Q.jsx)(c,{"aria-hidden":!0})}),children:(0,Q.jsx)(Q.Fragment,{children:kt.map(t=>(0,Q.jsxs)(`div`,{className:`flex min-h-14 items-center gap-3 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`break-words text-sm font-medium text-foreground`,children:t.name}),kt.filter(e=>e.name===t.name).length>1?(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(t.providers??[t.provider]).map(e=>vt[e]).join(`, `)}):null]}),(0,Q.jsx)(T,{size:`xs`,variant:`outline`,onClick:async()=>{(await ye({environmentId:e,input:{...i===void 0?{}:{projectId:i},servers:[{provider:t.provider,path:t.path,name:t.name}]}}))._tag===`Success`&&(tt(),et())},children:`Import`})]},`${t.provider}:${t.path}:${t.name}`))})}):null]}),Vt=Z.kind===`server`?(0,Q.jsxs)(ut,{title:Z.id===null?`Add MCP server`:`Update ${j[Z.id]?.name??`server`} MCP`,onBack:()=>Le({kind:`list`}),onUninstall:Z.id!==null&&ce?()=>Ue({kind:`server`,id:Z.id}):void 0,children:[(0,Q.jsx)(dt,{server:Z.id===null?void 0:j[Z.id],takenNames:yt,onSave:e=>void lt(Z.id??N.make(C()),e,Z.id===null)},Z.id??`new`),Z.id!==null&&j[Z.id]!==void 0?(0,Q.jsx)(jt,{environmentId:e,id:Z.id,server:j[Z.id],runtime:be[Z.id],checking:Ce.has(Z.id),canManage:ce,projectLabel:a,projectOverride:i===void 0?void 0:I[i]?.mcpServers?.[Z.id],awaitingSignIn:Ge===Z.id,onProviderToggle:(e,t)=>{let n=j[Z.id],r=t?n.disabledProviders.filter(t=>t!==e):[...n.disabledProviders,e];it({mcpServers:{[Z.id]:{...n,disabledProviders:r}}})},onProjectOverride:i===void 0?void 0:e=>mt(`mcpServers`,Z.id,e),signInError:Xe[Z.id],onTest:()=>void at(Z.id),onSignIn:()=>void $(Z.id),onReauthenticate:()=>void $(Z.id,!0),onSignOut:()=>void ft(Z.id)},`${e}:${Z.id}`):null]}):null,Ht=Z.kind===`plugin`?(0,Q.jsxs)(ut,{title:Z.id===null?`Add plugin`:`Update ${M[Z.id]?.name??`plugin`}`,onBack:()=>Le({kind:`list`}),onUninstall:Z.id!==null&&ce?()=>Ue({kind:`plugin`,id:Z.id}):void 0,children:[(0,Q.jsx)(pt,{environmentId:e,plugin:Z.id===null?void 0:M[Z.id],environmentLabel:t,onSave:async e=>{let t=Z.id??D.make(C());(await it({plugins:{[t]:e}}))._tag===`Success`&&Z.id===null&&Le({kind:`list`})}},Z.id??`new`),Z.id!==null&&M[Z.id]!==void 0?(0,Q.jsx)(zt,{plugin:M[Z.id],projectLabel:a,projectOverride:i===void 0?void 0:I[i]?.plugins?.[Z.id],onProjectOverride:i===void 0?void 0:e=>mt(`plugins`,Z.id,e)}):null]}):null;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`grid gap-6`,children:[Nt,Pt,Vt??Ht??(s===`plugins`?It:s===`mcps`?Bt:Rt)]}),E===null?null:(0,Q.jsx)(_t,{entry:E,environmentId:e,onClose:()=>A(null)}),(0,Q.jsx)(De,{open:He!==null,onOpenChange:e=>!e&&Ue(null),children:(0,Q.jsxs)(Oe,{children:[(0,Q.jsxs)(je,{children:[(0,Q.jsxs)(ke,{children:[`Remove`,` `,He?.kind===`server`?j[He.id]?.name??`server`:He?.kind===`plugin`?M[He.id]?.name??`plugin`:``,`?`]}),(0,Q.jsxs)(Me,{children:[`New sessions on `,t,` stop getting it. Its stored values and sign-in are deleted. Provider config files are not changed.`]})]}),(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(Ae,{render:(0,Q.jsx)(T,{variant:`outline`,children:`Cancel`})}),(0,Q.jsx)(T,{variant:`destructive`,onClick:()=>void ht(),children:`Remove`})]})]})})]})}function At(e){let t=(0,Y.c)(16),{projectLabel:n,override:r,inherited:i,onChange:a}=e,o=r?.enabled!==void 0,s=`In ${n}`,c=o?`Set for this project.`:`Follows the environment (${i?`on`:`off`}).`,l;t[0]!==a||t[1]!==o?(l=o?(0,Q.jsx)(T,{size:`xs`,variant:`ghost`,onClick:()=>a(void 0),children:`Reset`}):null,t[0]=a,t[1]=o,t[2]=l):l=t[2];let u=`Use in ${n}`,d=r?.enabled??i,f;t[3]===a?f=t[4]:(f=e=>a(e),t[3]=a,t[4]=f);let p;t[5]!==u||t[6]!==d||t[7]!==f?(p=(0,Q.jsx)(Ne,{"aria-label":u,checked:d,onCheckedChange:f}),t[5]=u,t[6]=d,t[7]=f,t[8]=p):p=t[8];let m;t[9]!==l||t[10]!==p?(m=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l,p]}),t[9]=l,t[10]=p,t[11]=m):m=t[11];let h;return t[12]!==s||t[13]!==c||t[14]!==m?(h=(0,Q.jsx)(Ce,{title:s,description:c,control:m}),t[12]=s,t[13]=c,t[14]=m,t[15]=h):h=t[15],h}function jt(e){let t=(0,Y.c)(108),{environmentId:n,id:r,server:i,runtime:a,checking:o,canManage:s,projectLabel:c,projectOverride:u,awaitingSignIn:d,signInError:f,onProviderToggle:p,onProjectOverride:m,onTest:h,onSignIn:g,onReauthenticate:_,onSignOut:v}=e,y=s&&i.transport.type===`http`&&i.transport.auth===`oauth`&&a?.auth===`signed-out`,b=Ft(n,r,y),x=b.entries,S;t[0]!==o||t[1]!==a||t[2]!==i?(S=Re(i,a,o),t[0]=o,t[1]=a,t[2]=i,t[3]=S):S=t[3];let C=S,w;t[4]===x?w=t[5]:(w=x?.filter(Nt).length??0,t[4]=x,t[5]=w);let E=w,D;t[6]!==C||t[7]!==E||t[8]!==x||t[9]!==y?(D=y?{...C,tone:`muted`,label:x===null?`Checking providers…`:E>0?`Available to ${E} ${E===1?`provider`:`providers`}`:`No providers connected`}:C,t[6]=C,t[7]=E,t[8]=x,t[9]=y,t[10]=D):D=t[10];let O=D,k,A,j,M,N,P,F;if(t[11]!==d||t[12]!==s||t[13]!==o||t[14]!==x||t[15]!==r||t[16]!==p||t[17]!==_||t[18]!==g||t[19]!==v||t[20]!==h||t[21]!==a?.auth||t[22]!==i||t[23]!==f||t[24]!==b||t[25]!==O||t[26]!==y){let e;t[34]===x?e=t[35]:(e=e=>({...e,badge:x===null||e.unsupported!==void 0?void 0:$e(e.driver,x)}),t[34]=x,t[35]=e);let n=et(i).map(e),c=i.transport.type===`http`&&a?.auth===`signed-in`,u=f??O.detail;N=`grid gap-6`,P=r;let m;t[36]===O?m=t[37]:(m=(0,Q.jsx)(wt,{status:O,className:`flex-1 text-sm`}),t[36]=O,t[37]=m);let S;t[38]!==d||t[39]!==s||t[40]!==g||t[41]!==O.needsSignIn||t[42]!==y?(S=O.needsSignIn&&s&&!y?(0,Q.jsx)(T,{size:`xs`,onClick:g,children:d?`Open sign-in again`:`Authenticate`}):null,t[38]=d,t[39]=s,t[40]=g,t[41]=O.needsSignIn,t[42]=y,t[43]=S):S=t[43];let C;t[44]!==s||t[45]!==_||t[46]!==c||t[47]!==O.needsSignIn?(C=c&&!O.needsSignIn&&s?(0,Q.jsx)(T,{size:`xs`,variant:`outline`,onClick:_,children:`Re-authenticate`}):null,t[44]=s,t[45]=_,t[46]=c,t[47]=O.needsSignIn,t[48]=C):C=t[48];let w;t[49]!==s||t[50]!==v||t[51]!==c?(w=c&&s?(0,Q.jsx)(T,{size:`xs`,variant:`ghost`,onClick:v,children:`Sign out`}):null,t[49]=s,t[50]=v,t[51]=c,t[52]=w):w=t[52];let E;t[53]!==s||t[54]!==o||t[55]!==h||t[56]!==i.enabled?(E=s&&i.enabled?(0,Q.jsx)(T,{size:`xs`,variant:`outline`,disabled:o,onClick:h,children:`Test connection`}):null,t[53]=s,t[54]=o,t[55]=h,t[56]=i.enabled,t[57]=E):E=t[57];let D;t[58]!==m||t[59]!==S||t[60]!==C||t[61]!==w||t[62]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[m,S,C,w,E]}),t[58]=m,t[59]=S,t[60]=C,t[61]=w,t[62]=E,t[63]=D):D=t[63];let I;t[64]!==d||t[65]!==O.needsSignIn||t[66]!==y?(I=O.needsSignIn&&!y?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:d?`Finish signing in in your browser, then come back here.`:y?`Sign in here to give it to every provider.`:`Agents can't reach this server until you sign in.`}):null,t[64]=d,t[65]=O.needsSignIn,t[66]=y,t[67]=I):I=t[67];let L;t[68]!==u||t[69]!==y?(L=u&&!y?(0,Q.jsx)(`p`,{className:`rounded-md bg-destructive/8 px-2.5 py-1.5 text-xs text-destructive-foreground`,children:u}):null,t[68]=u,t[69]=y,t[70]=L):L=t[70];let R;t[71]!==d||t[72]!==u||t[73]!==g||t[74]!==y?(R=y?(0,Q.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:u?`Shared sign-in unavailable`:`Shared sign-in`}),(0,Q.jsxs)(`div`,{className:`grid gap-2 pt-2`,children:[(0,Q.jsx)(`p`,{children:u??`Sign in through P4 Code to share access with every enabled provider.`}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(T,{size:`xs`,variant:`outline`,onClick:g,children:d?`Open browser`:u?`Retry shared sign-in`:`Sign in through P4 Code`})})]})]}):null,t[71]=d,t[72]=u,t[73]=g,t[74]=y,t[75]=R):R=t[75];let z;t[76]===i.source?z=t[77]:(z=i.source?(0,Q.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:`Import source`}),(0,Q.jsx)(`p`,{className:`break-all pt-2`,children:i.source.path})]}):null,t[76]=i.source,t[77]=z);let B=y?(0,Q.jsx)(Lt,{serverName:i.name,signIns:b,blocked:n.filter(Mt).length}):null;t[78]!==D||t[79]!==I||t[80]!==L||t[81]!==R||t[82]!==z||t[83]!==B?(F=(0,Q.jsx)(Te,{title:`Status`,children:(0,Q.jsx)(Se,{children:(0,Q.jsxs)(`div`,{className:`grid gap-2 px-4 py-3`,children:[D,I,L,R,z,B]})})}),t[78]=D,t[79]=I,t[80]=L,t[81]=R,t[82]=z,t[83]=B,t[84]=F):F=t[84],A=Te,M=`Providers`,k=Se;let V;t[85]!==s||t[86]!==p||t[87]!==i.name?(V=e=>(0,Q.jsx)(Ce,{title:e.label,...e.unsupported===void 0?{}:{description:e.unsupported},control:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.badge===void 0?null:(0,Q.jsx)(l,{variant:Rt[e.badge].variant,children:Rt[e.badge].label}),(0,Q.jsx)(Ne,{"aria-label":`Give ${i.name} to ${e.label}`,checked:e.enabled&&e.badge!==`unavailable`,disabled:!s||e.unsupported!==void 0||e.badge===`unavailable`,onCheckedChange:t=>p(e.driver,t)})]})},e.driver),t[85]=s,t[86]=p,t[87]=i.name,t[88]=V):V=t[88],j=n.map(V),t[11]=d,t[12]=s,t[13]=o,t[14]=x,t[15]=r,t[16]=p,t[17]=_,t[18]=g,t[19]=v,t[20]=h,t[21]=a?.auth,t[22]=i,t[23]=f,t[24]=b,t[25]=O,t[26]=y,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N,t[32]=P,t[33]=F}else k=t[27],A=t[28],j=t[29],M=t[30],N=t[31],P=t[32],F=t[33];let I;t[89]!==k||t[90]!==j?(I=(0,Q.jsx)(k,{children:j}),t[89]=k,t[90]=j,t[91]=I):I=t[91];let L;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(`p`,{className:`px-3 text-xs text-muted-foreground sm:px-4`,children:`A change reaches a thread when its provider session next starts.`}),t[92]=L):L=t[92];let R;t[93]!==A||t[94]!==M||t[95]!==I?(R=(0,Q.jsxs)(A,{title:M,children:[I,L]}),t[93]=A,t[94]=M,t[95]=I,t[96]=R):R=t[96];let z;t[97]!==m||t[98]!==c||t[99]!==u||t[100]!==i.enabled?(z=c!==void 0&&m!==void 0?(0,Q.jsx)(Te,{title:`Project`,children:(0,Q.jsx)(Se,{children:(0,Q.jsx)(At,{projectLabel:c,override:u,inherited:i.enabled,onChange:m})})}):null,t[97]=m,t[98]=c,t[99]=u,t[100]=i.enabled,t[101]=z):z=t[101];let B;return t[102]!==R||t[103]!==z||t[104]!==N||t[105]!==P||t[106]!==F?(B=(0,Q.jsxs)(`div`,{className:N,"data-server-id":P,children:[F,R,z]}),t[102]=R,t[103]=z,t[104]=N,t[105]=P,t[106]=F,t[107]=B):B=t[107],B}function Mt(e){return e.enabled&&e.badge===`unavailable`}function Nt(e){return e.status===`signed-in`}function Pt(e){let t=s(e);return xt(t)&&t.detail!==void 0?t.detail:`Sign-in could not start. Try again.`}function Ft(e,t,n){let i=K(G.mcpRegistryProviderSignInState,{reportFailure:!1}),a=K(G.mcpRegistryProviderSignInStart,{reportFailure:!1}),o=K(G.mcpRegistryProviderSignInWait,{reportFailure:!1}),s=K(G.mcpRegistryProviderSignInComplete,{reportFailure:!1}),c=K(G.mcpRegistryProviderSignInCancel,{reportFailure:!1}),l=K(G.mcpRegistryProviderSignOut,{reportFailure:!1}),u=r(G.mcpRegistryProviderSignInComplete.permissionAtom(e)),d=r(G.mcpRegistryProviderSignInCancel.permissionAtom(e)),[f,p]=(0,X.useState)(null),[m,h]=(0,X.useState)({}),[g,_]=(0,X.useState)(new Set),v=(0,X.useRef)(new Set),y=e=>p(t=>t?.map(t=>t.instanceId===e.instanceId?e:t)??null),b=(e,t)=>h(n=>{let r={...n};return t===void 0?delete r[e]:r[e]=t,r});return(0,X.useEffect)(()=>{if(!n)return;let r=!1;return i({environmentId:e,input:{serverId:t}}).then(e=>{r||p(e._tag===`Success`?e.value.providers:[])}),()=>{r=!0}},[n,e,i,t]),(0,X.useEffect)(()=>{if(!n)return;let r=!1;for(let n of f??[]){let i=n.pending;i&&o({environmentId:e,input:{serverId:t,instanceId:n.instanceId,flowId:i.flowId}}).then(e=>{r||(p(t=>t?.map(t=>{if(t.instanceId!==n.instanceId||t.pending?.flowId!==i.flowId)return t;if(e._tag===`Success`)return e.value;let{pending:r,...a}=t;return a})??null),e._tag===`Failure`?b(n.instanceId,Pt(e.cause)):e._tag===`Success`&&e.value.status!==`signed-in`&&!v.current.has(n.instanceId)&&b(n.instanceId,`Sign-in ended without connecting. Try again.`))})}return()=>{r=!0}},[n,f,e,t,o]),{entries:n?f:null,errors:m,busy:g,run:async(n,r,i)=>{if(!v.current.has(n.instanceId)){v.current.add(n.instanceId),_(new Set(v.current)),b(n.instanceId,void 0);try{let o={serverId:t,instanceId:n.instanceId};if(r===`start`){let t=await a({environmentId:e,input:o});t._tag===`Success`?(y({...n,pending:t.value}),window.open(t.value.authorizationUrl,`_blank`,`noopener,noreferrer`)):t._tag===`Failure`&&b(n.instanceId,Pt(t.cause));return}let u={...o,flowId:n.pending?.flowId??``},d=r===`complete`?await s({environmentId:e,input:{...u,callbackUrl:i.trim()}}):r===`cancel`?await c({environmentId:e,input:u}):await l({environmentId:e,input:o});d._tag===`Success`?y(d.value):d._tag===`Failure`&&b(n.instanceId,Pt(d.cause))}finally{v.current.delete(n.instanceId),_(new Set(v.current))}}},canComplete:u,canCancel:d}}function It(e){let t=(0,Y.c)(39),{entry:n,signIns:r}=e,i;t[0]!==n.displayName||t[1]!==n.driver?(i=n.displayName??Ze(n.driver),t[0]=n.displayName,t[1]=n.driver,t[2]=i):i=t[2];let a=i,[o,s]=(0,X.useState)(``),c=n.pending,l;t[3]!==n.instanceId||t[4]!==r.busy?(l=r.busy.has(n.instanceId),t[3]=n.instanceId,t[4]=r.busy,t[5]=l):l=t[5];let u=l,d=r.errors[n.instanceId],f=`mcp-callback-${n.instanceId}`,p;t[6]===a?p=t[7]:(p=(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:a}),t[6]=a,t[7]=p);let m=c?`text-warning-foreground`:n.status===`signed-in`?`text-success-foreground`:`text-muted-foreground`,h;t[8]===m?h=t[9]:(h=M(`text-xs`,m),t[8]=m,t[9]=h);let g;t[10]!==n.status||t[11]!==c?(g=c?`Waiting for sign-in`:Qe(n.status),t[10]=n.status,t[11]=c,t[12]=g):g=t[12];let _;t[13]!==h||t[14]!==g?(_=(0,Q.jsx)(`p`,{className:h,role:`status`,children:g}),t[13]=h,t[14]=g,t[15]=_):_=t[15];let v;t[16]!==p||t[17]!==_?(v=(0,Q.jsxs)(`div`,{className:`grid gap-1`,children:[p,_]}),t[16]=p,t[17]=_,t[18]=v):v=t[18];let y;t[19]!==u||t[20]!==n||t[21]!==d||t[22]!==c||t[23]!==r?(y=!c&&n.status!==`unavailable`?(0,Q.jsx)(T,{size:`xs`,variant:n.status===`signed-in`?`outline`:`default`,disabled:u,onClick:()=>void r.run(n,n.status===`signed-in`?`signOut`:`start`),children:u?`Please wait…`:n.status===`signed-in`?`Sign out`:d?`Start over`:`Sign in`}):null,t[19]=u,t[20]=n,t[21]=d,t[22]=c,t[23]=r,t[24]=y):y=t[24];let b;t[25]!==v||t[26]!==y?(b=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[v,y]}),t[25]=v,t[26]=y,t[27]=b):b=t[27];let x;t[28]!==u||t[29]!==o||t[30]!==n||t[31]!==d||t[32]!==f||t[33]!==c||t[34]!==r?(x=c?(0,Q.jsxs)(`form`,{className:`grid gap-2`,onSubmit:e=>{e.preventDefault(),o.trim()&&!u&&r.canComplete&&r.run(n,`complete`,o)},children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Approve in your browser. If it ends on a callback URL, paste that URL here.`}),(0,Q.jsx)(`label`,{htmlFor:f,className:`text-xs font-medium`,children:`Callback URL`}),(0,Q.jsx)(se,{id:f,value:o,onChange:e=>s(e.target.value),placeholder:`http://localhost:…/callback?code=…&state=…`,autoComplete:`off`,spellCheck:!1,disabled:u||!r.canComplete,"aria-invalid":!!d,"aria-describedby":d?`${f}-error`:void 0}),d?(0,Q.jsx)(`p`,{id:`${f}-error`,role:`alert`,className:`text-xs text-destructive-foreground`,children:d}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(T,{type:`submit`,size:`xs`,disabled:u||!o.trim()||!r.canComplete,children:u?`Please wait…`:`Finish sign-in`}),(0,Q.jsx)(T,{type:`button`,size:`xs`,variant:`outline`,disabled:u,onClick:()=>window.open(c.authorizationUrl,`_blank`,`noopener,noreferrer`),children:`Open browser`}),(0,Q.jsx)(T,{type:`button`,size:`xs`,variant:`ghost`,disabled:u||!r.canCancel,onClick:()=>void r.run(n,`cancel`),children:`Cancel`})]})]}):d?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive-foreground`,children:d}):null,t[28]=u,t[29]=o,t[30]=n,t[31]=d,t[32]=f,t[33]=c,t[34]=r,t[35]=x):x=t[35];let S;return t[36]!==b||t[37]!==x?(S=(0,Q.jsxs)(`div`,{className:`grid gap-2 border-t border-border pt-3`,children:[b,x]}),t[36]=b,t[37]=x,t[38]=S):S=t[38],S}function Lt(e){let t=(0,Y.c)(8),{serverName:n,signIns:r,blocked:i}=e,a;t[0]===r?a=t[1]:(a=r.entries===null?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Checking providers…`}):r.entries.length===0?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No enabled provider here can sign in to MCP servers itself.`}):r.entries.map(e=>(0,Q.jsx)(It,{entry:e,signIns:r},`${e.instanceId}:${e.pending?.flowId??`idle`}`)),t[0]=r,t[1]=a);let o;t[2]!==i||t[3]!==n?(o=i>0?(0,Q.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,Q.jsxs)(`summary`,{className:`cursor-pointer`,children:[i,` other `,i===1?`provider`:`providers`,` unavailable`]}),(0,Q.jsxs)(`p`,{className:`pt-2`,children:[`These providers need shared sign-in to use `,n,`.`]})]}):null,t[2]=i,t[3]=n,t[4]=o):o=t[4];let s;return t[5]!==a||t[6]!==o?(s=(0,Q.jsxs)(`div`,{className:`grid gap-3`,children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}var Rt={"signed-in":{variant:`success`,label:`Signed in`},"needs-sign-in":{variant:`warning`,label:`Sign in needed`},unavailable:{variant:`secondary`,label:`Unavailable`}};function zt(e){let t=(0,Y.c)(7),{plugin:n,projectLabel:r,projectOverride:i,onProjectOverride:a}=e,o;t[0]!==a||t[1]!==n||t[2]!==r||t[3]!==i?(o=r!==void 0&&a!==void 0?(0,Q.jsx)(Te,{title:`Project`,children:(0,Q.jsx)(Se,{children:(0,Q.jsx)(At,{projectLabel:r,override:i,inherited:n.enabled,onChange:a})})}):null,t[0]=a,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s;return t[5]===o?s=t[6]:(s=(0,Q.jsx)(`div`,{className:`grid gap-6`,children:o}),t[5]=o,t[6]=s),s}var Bt=Tt;export{Bt as component};
5
- //# sourceMappingURL=settings.plugins-JjZ7Ptzj.js.map
5
+ //# sourceMappingURL=settings.plugins-C6Q3vhFM.js.map