ryco-cli 0.1.25 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/dist/{GrokDriver-CduUwiOH.mjs → AcpAdapter-BemMQNbj.mjs} +102 -604
  2. package/dist/{GrokDriver-D0jraOC_.cjs → AcpAdapter-CadxcdZV.cjs} +129 -612
  3. package/dist/AcpNativeLogging-BsbZRRD7.mjs +312 -0
  4. package/dist/AcpNativeLogging-DZPZNoju.cjs +383 -0
  5. package/dist/AcpRegistryDriver-BfCPf8FX.cjs +222 -0
  6. package/dist/AcpRegistryDriver-BpXCjh9I.mjs +221 -0
  7. package/dist/{AzureDevOpsSourceControlProvider-COmd21c-.cjs → AzureDevOpsSourceControlProvider-B9N_8NJg.cjs} +14 -14
  8. package/dist/{AzureDevOpsSourceControlProvider-B_E0XXfD.mjs → AzureDevOpsSourceControlProvider-BcQO_CyW.mjs} +3 -3
  9. package/dist/{BitbucketSourceControlProvider-pUKsNXcg.mjs → BitbucketSourceControlProvider-BTUY2ZT8.mjs} +3 -3
  10. package/dist/{BitbucketSourceControlProvider-CD8IvXQK.cjs → BitbucketSourceControlProvider-C9WuwvY2.cjs} +14 -14
  11. package/dist/{BunPTY-TbHbSc8S.mjs → BunPTY-DdnqQAdw.mjs} +1 -1
  12. package/dist/{ClaudeDriver-Dry5uJfX.cjs → ClaudeDriver-BSTxNNGO.cjs} +162 -126
  13. package/dist/{ClaudeDriver-CGifBixr.mjs → ClaudeDriver-Csnp78qR.mjs} +129 -93
  14. package/dist/{CodexDriver-BzR8gA8w.cjs → CodexDriver-BK4HVNV4.cjs} +145 -60
  15. package/dist/{CodexDriver-V4CL9APE.mjs → CodexDriver-fwcV84hX.mjs} +99 -14
  16. package/dist/{CodexTextGeneration-DTrSzY-I.cjs → CodexTextGeneration-Y2GSS7f1.cjs} +145 -99
  17. package/dist/{CodexTextGeneration-DoCidwvI.mjs → CodexTextGeneration-_4aT5BHa.mjs} +141 -95
  18. package/dist/{CopilotDriver-Dt13X60f.mjs → CopilotDriver-B12ZJ-L_.mjs} +69 -7
  19. package/dist/{CopilotDriver-rLcA8PSN.cjs → CopilotDriver-C7IyIwVW.cjs} +98 -36
  20. package/dist/{CursorDriver-C3s-8s9F.cjs → CursorDriver-BWmCfJ-w.cjs} +38 -32
  21. package/dist/{CursorDriver-HIPUs7cz.mjs → CursorDriver-C_p0v-ul.mjs} +12 -6
  22. package/dist/{ForgejoSourceControlProvider-JgiyrMqp.cjs → ForgejoSourceControlProvider-DTRrllIH.cjs} +14 -14
  23. package/dist/{ForgejoSourceControlProvider-CmvOAzEG.mjs → ForgejoSourceControlProvider-DmOGJEaJ.mjs} +3 -3
  24. package/dist/{GitHubSourceControlProvider-CItCpOcC.cjs → GitHubSourceControlProvider-D-YV8WP6.cjs} +16 -17
  25. package/dist/{GitHubSourceControlProvider-BYuvbcBf.mjs → GitHubSourceControlProvider-sQGcwnr3.mjs} +6 -7
  26. package/dist/{GitLabSourceControlProvider-CMce22nU.cjs → GitLabSourceControlProvider-kKYYnpER.cjs} +14 -14
  27. package/dist/{GitLabSourceControlProvider-DZzEaVSi.mjs → GitLabSourceControlProvider-mIl-K-4F.mjs} +3 -3
  28. package/dist/GrokDriver-BFOniP_K.cjs +567 -0
  29. package/dist/GrokDriver-CDcWkiAi.mjs +552 -0
  30. package/dist/{Metrics-a1h4iBQi.mjs → Metrics-C-3MahDy.mjs} +1 -107
  31. package/dist/{Metrics-Bcb9vCAe.cjs → Metrics-DCKbdeoH.cjs} +0 -168
  32. package/dist/{NodePTY-B_p5tLYO.mjs → NodePTY-DArvQ9bX.mjs} +1 -1
  33. package/dist/{OpenCodeDriver-DxGpgtDS.cjs → OpenCodeDriver-CckbFEQJ.cjs} +459 -141
  34. package/dist/{OpenCodeDriver-Bz_uJdMA.mjs → OpenCodeDriver-CnWJHyDJ.mjs} +430 -112
  35. package/dist/SideQuestionIsolation-5eGFRW0t.mjs +26 -0
  36. package/dist/SideQuestionIsolation-DvVKZWxi.cjs +37 -0
  37. package/dist/{SourceControlProviderDiscoveryCatalog-ZtwPWoxE.mjs → SourceControlProviderDiscoveryCatalog-BVvq7liJ.mjs} +2 -1
  38. package/dist/{SourceControlProviderDiscoveryCatalog-Dm_lhrhv.cjs → SourceControlProviderDiscoveryCatalog-CyUhKJLD.cjs} +6 -5
  39. package/dist/bin.cjs +12537 -3029
  40. package/dist/bin.mjs +10444 -965
  41. package/dist/client/assets/AccountSettings-DLbcE2w-.js +1 -0
  42. package/dist/client/assets/Adobe-CNS1-UCS2-fO900upv.bcmap +0 -0
  43. package/dist/client/assets/Adobe-GB1-UCS2-BA083yIo.bcmap +0 -0
  44. package/dist/client/assets/Adobe-Japan1-UCS2-BL-4M2vS.bcmap +0 -0
  45. package/dist/client/assets/Adobe-Korea1-UCS2-BEQZuOdo.bcmap +0 -0
  46. package/dist/client/assets/AiFocusSettings-FKvdkl4P.js +1 -0
  47. package/dist/client/assets/{AnimatedHeight-DPqb09B0.js → AnimatedHeight-CbIEyMLg.js} +1 -1
  48. package/dist/client/assets/AppearanceSettings-B2LsGKmL.js +1 -0
  49. package/dist/client/assets/{BranchToolbar.logic-CHRK3hDt.js → BranchToolbar.logic-BqkvYNPk.js} +1 -1
  50. package/dist/client/assets/{BrowserPanel-2Xu08il5.js → BrowserPanel-C_C4zjrh.js} +1 -1
  51. package/dist/client/assets/ChatRightPanel-ibiQ79jI.js +195 -0
  52. package/dist/client/assets/{ChatThreadRouteView-CNww3i2J.js → ChatThreadRouteView-c7AXmbSk.js} +1 -1
  53. package/dist/client/assets/CommandPaletteDialog-DdPKN6rv.js +1 -0
  54. package/dist/client/assets/CompositeRoot-DKwS-ADi.js +1 -0
  55. package/dist/client/assets/{ComputerUseSettings-BJs7jqR0.js → ComputerUseSettings-DM17BYP5.js} +1 -1
  56. package/dist/client/assets/ConnectionsSettings-D6wysIC8.js +7 -0
  57. package/dist/client/assets/ContextHandoffEndpointLabel-CsF_maM_.js +4 -0
  58. package/dist/client/assets/{DiagnosticsSettings-BmrqOKMe.js → DiagnosticsSettings-Bq2l-C4J.js} +2 -2
  59. package/dist/client/assets/{DialogHandle-pelzaaiH.js → DialogHandle-DuKTleCw.js} +1 -1
  60. package/dist/client/assets/{DialogPopup-BLM0vN4N.js → DialogPopup-Dt7DzTWv.js} +1 -1
  61. package/dist/client/assets/DialogRoot-DRyawL6l.js +1 -0
  62. package/dist/client/assets/{DialogTitle-BvIjMtMm.js → DialogTitle-BaxfPC6e.js} +1 -1
  63. package/dist/client/assets/DialogTrigger-D0PJ8bRT.js +1 -0
  64. package/dist/client/assets/{DialogViewport-Cz0OadGI.js → DialogViewport-C3B2JZWQ.js} +1 -1
  65. package/dist/client/assets/DraftChatThreadRouteView-B8YiD5NP.js +1 -0
  66. package/dist/client/assets/ETHK-B5-H-1MLb5v9x.bcmap +0 -0
  67. package/dist/client/assets/{ExternalIdentityWeb.logic-3rlDV7lT.js → ExternalIdentityWeb.logic-CrcNfdHK.js} +1 -1
  68. package/dist/client/assets/FoxitDingbats-BaQLufoW.pfb +0 -0
  69. package/dist/client/assets/FoxitFixed-Dyd5Nipw.pfb +0 -0
  70. package/dist/client/assets/FoxitFixedBold-D5TuYRwj.pfb +0 -0
  71. package/dist/client/assets/FoxitFixedBoldItalic-BqlXQ_Yv.pfb +0 -0
  72. package/dist/client/assets/FoxitFixedItalic-DqjQkmbS.pfb +0 -0
  73. package/dist/client/assets/FoxitSerif-qbgiDIe-.pfb +0 -0
  74. package/dist/client/assets/FoxitSerifBold-DZZ4CclT.pfb +0 -0
  75. package/dist/client/assets/FoxitSerifBoldItalic-DSQtwd_X.pfb +0 -0
  76. package/dist/client/assets/FoxitSerifItalic-CQs5lx9Y.pfb +0 -0
  77. package/dist/client/assets/FoxitSymbol-BVtbc20u.pfb +0 -0
  78. package/dist/client/assets/GBK-EUC-H-CAORqCkf.bcmap +0 -0
  79. package/dist/client/assets/GBK2K-H-Cv55KPk8.bcmap +0 -0
  80. package/dist/client/assets/GBKp-EUC-H-CElrnV5g.bcmap +0 -0
  81. package/dist/client/assets/GBT-EUC-H-BTsQIL1M.bcmap +0 -0
  82. package/dist/client/assets/GBT-H-DL9h-WkS.bcmap +0 -0
  83. package/dist/client/assets/GBTpc-EUC-H-DnIh5WJ3.bcmap +0 -0
  84. package/dist/client/assets/{GlassSurface-CEVIdyfP.js → GlassSurface-CBIEgwt1.js} +1 -1
  85. package/dist/client/assets/HKscs-B5-H-CXbBbq6g.bcmap +0 -0
  86. package/dist/client/assets/{HostedConnectionControls-r9cyZPyF.js → HostedConnectionControls-DOpTlXzE.js} +1 -1
  87. package/dist/client/assets/{HostedHubRoot-BkfafJ5x.js → HostedHubRoot-C1jq8cM6.js} +2 -2
  88. package/dist/client/assets/{HostedNativeAuthorizationRoute-CqHuW853.js → HostedNativeAuthorizationRoute-Clw1DHQW.js} +2 -2
  89. package/dist/client/assets/{HostedNodeRenameDialog-C7m-nvTj.js → HostedNodeRenameDialog-Bd_Qu_ek.js} +1 -1
  90. package/dist/client/assets/{HostedRelayTrustNotice-DNZQyAX0.js → HostedRelayTrustNotice-CGcBpT9m.js} +1 -1
  91. package/dist/client/assets/{IntegrationsSettingsPanel-hul3ysgL.js → IntegrationsSettingsPanel-J0qODRW-.js} +2 -2
  92. package/dist/client/assets/KSC-Johab-H-CGtV3MPT.bcmap +0 -0
  93. package/dist/client/assets/{KeybindingsSettings-Cme6omBM.js → KeybindingsSettings-CwxIHsFy.js} +1 -1
  94. package/dist/client/assets/{LazyBrowserPanel-COJFwNK7.js → LazyBrowserPanel-VNAn6AUL.js} +2 -2
  95. package/dist/client/assets/LiberationSans-Bold-BPt4bU5Z.ttf +0 -0
  96. package/dist/client/assets/LiberationSans-BoldItalic-Bj53-jFw.ttf +0 -0
  97. package/dist/client/assets/LiberationSans-Italic-5QhGB3P9.ttf +0 -0
  98. package/dist/client/assets/LiberationSans-Regular-cbskN6YR.ttf +0 -0
  99. package/dist/client/assets/McpServersSettings-1pkIeutq.js +6 -0
  100. package/dist/client/assets/MobileSheet-DddfN8c2.js +1 -0
  101. package/dist/client/assets/{NodeSecuritySettings-CwT5nEW9.js → NodeSecuritySettings-BOIZeFZo.js} +1 -1
  102. package/dist/client/assets/OpinionatedPluginsSettings-oTIrPtIb.js +1 -0
  103. package/dist/client/assets/PdfAttachmentPreview-BCMO9OHD.js +54 -0
  104. package/dist/client/assets/{PhoneGetAppInterstitial-BBnGXVkR.js → PhoneGetAppInterstitial-0EOj-PbW.js} +1 -1
  105. package/dist/client/assets/PhoneHome-Cg7l3b1T.js +1 -0
  106. package/dist/client/assets/{PhoneSettingsSurface-DdVCndyt.js → PhoneSettingsSurface-BXAUtZ9M.js} +2 -2
  107. package/dist/client/assets/ProvidersSettingsPanel-BaJgypXu.js +1 -0
  108. package/dist/client/assets/{QuitShortcutFeedback-mF7X0WMD.js → QuitShortcutFeedback-DgJFEd6b.js} +1 -1
  109. package/dist/client/assets/{RedactedSensitiveText-DovqFcmM.js → RedactedSensitiveText-D1VC2xa7.js} +1 -1
  110. package/dist/client/assets/RootAppShell-D2RjZ9jQ.js +7 -0
  111. package/dist/client/assets/Separator-CeMncdkm.js +1 -0
  112. package/dist/client/assets/SettingsDialog-B2hEb6u8.js +2 -0
  113. package/dist/client/assets/SettingsPanels-DtWLQDne.js +3 -0
  114. package/dist/client/assets/{SettingsPanels.editor-d-rVlbeN.js → SettingsPanels.editor-DJRckD71.js} +1 -1
  115. package/dist/client/assets/SourceControlSettings-IpoZrjt5.js +1 -0
  116. package/dist/client/assets/StatisticsPage-CUpE_5Gr.js +1 -0
  117. package/dist/client/assets/StatisticsPanel-CHrAY5AP.js +1 -0
  118. package/dist/client/assets/StatisticsSettingsLink-bGWuxNG3.js +1 -0
  119. package/dist/client/assets/{ThreadTerminalDrawer-DaLrSTn9.js → ThreadTerminalDrawer-BEv83xrk.js} +3 -3
  120. package/dist/client/assets/ThreadWorkspacePanel-BdMdJVHJ.js +2073 -0
  121. package/dist/client/assets/UniCNS-UCS2-H-DWzv8UhH.bcmap +0 -0
  122. package/dist/client/assets/UniCNS-UTF16-H-Bw0JKgCq.bcmap +0 -0
  123. package/dist/client/assets/UniCNS-UTF32-H-IE_GrH2i.bcmap +0 -0
  124. package/dist/client/assets/UniCNS-UTF8-H-BbLcFh6Q.bcmap +0 -0
  125. package/dist/client/assets/UniGB-UCS2-H-D7xzRvZN.bcmap +0 -0
  126. package/dist/client/assets/UniGB-UTF16-H-DKjbEwc0.bcmap +0 -0
  127. package/dist/client/assets/UniGB-UTF32-H-Behfouj5.bcmap +0 -0
  128. package/dist/client/assets/UniGB-UTF8-H-EROft1ro.bcmap +0 -0
  129. package/dist/client/assets/UniJIS-UCS2-H-2DbZ0MaQ.bcmap +0 -0
  130. package/dist/client/assets/UniJIS-UTF16-H-BlDDPdCK.bcmap +0 -0
  131. package/dist/client/assets/UniJIS-UTF32-H-BIQPWkjv.bcmap +0 -0
  132. package/dist/client/assets/UniJIS-UTF8-H-CGusholx.bcmap +0 -0
  133. package/dist/client/assets/UniJIS2004-UTF16-H-KXixH-HI.bcmap +0 -0
  134. package/dist/client/assets/UniJIS2004-UTF32-H-CXrD-9YE.bcmap +0 -0
  135. package/dist/client/assets/UniJIS2004-UTF8-H-BkOctZjn.bcmap +0 -0
  136. package/dist/client/assets/UniJISX0213-UTF32-H-BavAhZjb.bcmap +0 -0
  137. package/dist/client/assets/UniJISX02132004-UTF32-H-DAH-AgUq.bcmap +0 -0
  138. package/dist/client/assets/UniKS-UCS2-H-YeUc7k1L.bcmap +0 -0
  139. package/dist/client/assets/UniKS-UTF16-H-B0dvB-Td.bcmap +0 -0
  140. package/dist/client/assets/UniKS-UTF32-H-olR_LtmR.bcmap +0 -0
  141. package/dist/client/assets/UniKS-UTF8-H-CbpebD-y.bcmap +0 -0
  142. package/dist/client/assets/{activity-bn_fBQGf.js → activity-BmRcsTyL.js} +1 -1
  143. package/dist/client/assets/{alert-BmLJh6DH.js → alert-C5UiA2xk.js} +1 -1
  144. package/dist/client/assets/{appChrome-Dy57Ve9N.js → appChrome-CsZ2ylc1.js} +1 -1
  145. package/dist/client/assets/{arrow-left-pzj1cbX3.js → arrow-left-CSz-z20j.js} +1 -1
  146. package/dist/client/assets/{arrow-right-BW5jU-vo.js → arrow-right-DEi91hao.js} +1 -1
  147. package/dist/client/assets/{arrow-up-right-AfC5AaSO.js → arrow-up-right-D7SpcTV9.js} +1 -1
  148. package/dist/client/assets/authorization-B1YXfej3.js +1 -0
  149. package/dist/client/assets/badge-BjvTY7-E.js +1 -0
  150. package/dist/client/assets/{bot-CsKkSRlb.js → bot-SC4UGZyw.js} +1 -1
  151. package/dist/client/assets/{capabilities-DskyVNd2.js → capabilities-BCkDNe83.js} +1 -1
  152. package/dist/client/assets/{chart-column-DhvWXIiH.js → chart-column-C08MuLgY.js} +1 -1
  153. package/dist/client/assets/chevron-right-DgB53U1_.js +1 -0
  154. package/dist/client/assets/{clipboard-copy-fJnfdl4H.js → clipboard-copy-D74Wvnon.js} +1 -1
  155. package/dist/client/assets/{data-list-_E-Al1sf.js → data-list-CZ4Utnfl.js} +1 -1
  156. package/dist/client/assets/{desktopWorkspace-DycXKuMm.js → desktopWorkspace-DVfn9ZT_.js} +1 -1
  157. package/dist/client/assets/{download-CLQzE1di.js → download-Dio40wIJ.js} +1 -1
  158. package/dist/client/assets/editorPreferences-2dG4uloq.js +1 -0
  159. package/dist/client/assets/{empty-YXFtCUDN.js → empty-6LExKYgQ.js} +1 -1
  160. package/dist/client/assets/{group-DOCkUmuY.js → group-D_mu0Kiq.js} +1 -1
  161. package/dist/client/assets/{hostedConnectionCoordinator-JZ1dLx4v.js → hostedConnectionCoordinator-YkDLnATK.js} +1 -1
  162. package/dist/client/assets/{hubRoutes-C2S5of9_.js → hubRoutes-D3quWvU7.js} +1 -1
  163. package/dist/client/assets/{index-CvRFRkBK.js → index-7MTgf8YI.js} +2 -2
  164. package/dist/client/assets/{input-C2xv8mMt.js → input-CfVJycb1.js} +1 -1
  165. package/dist/client/assets/jbig2-CNFLgX9F.wasm +0 -0
  166. package/dist/client/assets/kbd-uFa_tY-L.js +1 -0
  167. package/dist/client/assets/{key-round-CYcb9lAa.js → key-round-C-oUSjpF.js} +1 -1
  168. package/dist/client/assets/{layers-CGlOWYxu.js → layers-Co2a5C1k.js} +1 -1
  169. package/dist/client/assets/{log-out-CZW2EpNJ.js → log-out-pWFhbvwr.js} +1 -1
  170. package/dist/client/assets/{logging-BpmZOfmu.js → logging-JMrwaeZh.js} +1 -1
  171. package/dist/client/assets/main-BNPtp9Z0.css +2 -0
  172. package/dist/client/assets/main-CGeD6yVE.js +9 -0
  173. package/dist/client/assets/openjpeg-MeY6OQBn.wasm +0 -0
  174. package/dist/client/assets/{palette-CQOuNfSO.js → palette-B_6C4fD6.js} +1 -1
  175. package/dist/client/assets/pdf.worker.min-Dswkl-cV.mjs +29 -0
  176. package/dist/client/assets/{play-CPVy9wwV.js → play-DFtc9zBy.js} +1 -1
  177. package/dist/client/assets/primary-CNUdEGcv.js +2 -0
  178. package/dist/client/assets/providerDriverMeta-Cg_XLUfo.js +1 -0
  179. package/dist/client/assets/{ProviderModelPicker-DoYEUZrn.js → providerInstances-JaDrOWPZ.js} +1 -1
  180. package/dist/client/assets/providerModels-5uOq3qPC.js +1 -0
  181. package/dist/client/assets/qcms_bg-3PJi_GXR.wasm +0 -0
  182. package/dist/client/assets/{qr-code-BPqDlVMn.js → qr-code-BU354aLS.js} +1 -1
  183. package/dist/client/assets/{qr-code-C6BVTc4V.js → qr-code-DaHWf7Oq.js} +1 -1
  184. package/dist/client/assets/quickjs-eval-zJSp5SB4.wasm +0 -0
  185. package/dist/client/assets/radio-group-DKaA1eey.js +2 -0
  186. package/dist/client/assets/{refresh-cw-B5Cz1z3e.js → refresh-cw-CY5BeUEr.js} +1 -1
  187. package/dist/client/assets/runtime-BKneT96Q.js +17 -0
  188. package/dist/client/assets/{save-C7zM6ey6.js → save-DIHMjHXd.js} +1 -1
  189. package/dist/client/assets/{scroll-area-5OU_pvTW.js → scroll-area-Cq4SX9P8.js} +1 -1
  190. package/dist/client/assets/{scrollEdges-qnEXfIOg.js → scrollEdges-BaWRjrac.js} +1 -1
  191. package/dist/client/assets/{separator-B5HfRiaO.js → separator-BN705fC0.js} +1 -1
  192. package/dist/client/assets/{settingsLayout-CfKq88KD.js → settingsLayout-DQERzSce.js} +1 -1
  193. package/dist/client/assets/{sheet-B9gQDy_I.js → sheet-CFvRY7T6.js} +1 -1
  194. package/dist/client/assets/{shield-rdjnBE2Q.js → shield-Zn2kFj5M.js} +1 -1
  195. package/dist/client/assets/{shield-alert-7yBlEyOs.js → shield-alert-DMB5gKiC.js} +1 -1
  196. package/dist/client/assets/{shield-check-CnKgVJ0F.js → shield-check-DyNf6Bky.js} +1 -1
  197. package/dist/client/assets/{sidebar-BdvL1Pbj.js → sidebar-Bsh64sLK.js} +1 -1
  198. package/dist/client/assets/sidebarProjectFolders-CQbpO9ZI.js +4 -0
  199. package/dist/client/assets/{sidebarStatusText-CZKsUFBD.js → sidebarStatusText-DCo-whyK.js} +1 -1
  200. package/dist/client/assets/{skeleton-CoyLqyaB.js → skeleton-DEuowfjY.js} +1 -1
  201. package/dist/client/assets/{smartphone-CBgpMHXR.js → smartphone-BLWJ7C9-.js} +1 -1
  202. package/dist/client/assets/{sparkles-w-UZXQx1.js → sparkles-DAXDXp_s.js} +1 -1
  203. package/dist/client/assets/src-DPpEXU6w.js +14 -0
  204. package/dist/client/assets/{star-BZ-RtSFD.js → star-CjQxHYbD.js} +1 -1
  205. package/dist/client/assets/switch-LahPAvrd.js +48 -0
  206. package/dist/client/assets/{toggle-DVGrNHjq.js → toggle-45lsrmyi.js} +1 -1
  207. package/dist/client/assets/{toggle-group-CNDOfNhH.js → toggle-group-D5pl24ED.js} +1 -1
  208. package/dist/client/assets/{tokenModePresentation-CQNdC9CW.js → tokenModePresentation-CPUsUGY4.js} +1 -1
  209. package/dist/client/assets/tooltip-B8-izeMo.js +1 -0
  210. package/dist/client/assets/{unplug-CRUwFNFw.js → unplug-Bjpxv8i0.js} +1 -1
  211. package/dist/client/assets/usage-8vQUo0mr.js +1 -0
  212. package/dist/client/assets/useAppSidebarCollapsed-uwz9Hlgc.js +1 -0
  213. package/dist/client/assets/useBaseUiId-BtuL7q77.js +1 -0
  214. package/dist/client/assets/useLabelableId-N_LsKNbf.js +1 -0
  215. package/dist/client/assets/useNavigate-DADLi29i.js +1 -0
  216. package/dist/client/assets/usePhoneThreadActions-B9_HK7tn.js +1 -0
  217. package/dist/client/assets/usePopupViewport-w8BEny9j.js +1 -0
  218. package/dist/client/assets/useScrollLock-bCmUzTgK.js +1 -0
  219. package/dist/client/assets/useStatistics-DJtONxT0.js +55 -0
  220. package/dist/client/assets/useTriggerFocusGuards-C7JWO2LT.js +1 -0
  221. package/dist/client/assets/useValueChanged-DkoUO9bY.js +1 -0
  222. package/dist/client/assets/{user-round-DStbWN3z.js → user-round-DEWIPpNs.js} +1 -1
  223. package/dist/client/assets/{vscode-icons-BihBo3tb.js → vscode-icons-DTH-Vj-_.js} +1 -1
  224. package/dist/client/assets/workspaceMetadataProjection-BnpxBe8S.js +1 -0
  225. package/dist/client/assets/{wrench-BBIgGxy9.js → wrench-36WYdK_a.js} +1 -1
  226. package/dist/client/index.html +1 -1
  227. package/dist/collectUint8StreamText-BAUF-vzz.mjs +37 -0
  228. package/dist/collectUint8StreamText-vagpNUMJ.cjs +42 -0
  229. package/dist/deviceHostWorker-C-BSnmkn.mjs +167 -0
  230. package/dist/deviceHostWorker-CYnrwfrv.cjs +169 -0
  231. package/dist/git-C4iJMbBu.mjs +132 -0
  232. package/dist/git-irmB8_k7.cjs +218 -0
  233. package/dist/{makeManagedServerProvider-CwYhl_P-.mjs → makeManagedServerProvider-BINne1KE.mjs} +3 -38
  234. package/dist/{makeManagedServerProvider-Dy2Ny9tk.cjs → makeManagedServerProvider-DGbd8BhM.cjs} +1 -60
  235. package/dist/resource-monitor/ryco-resource-monitor +0 -0
  236. package/dist/resource-monitor/ryco-resource-monitor.exe +0 -0
  237. package/dist/resource-monitor/win32-arm64/ryco-resource-monitor.exe +0 -0
  238. package/dist/resource-monitor/win32-x64/ryco-resource-monitor.exe +0 -0
  239. package/dist/runtimeSession-Bj0OUcNJ.cjs +63 -0
  240. package/dist/runtimeSession-CA6cLWg0.mjs +40 -0
  241. package/dist/schemaJson-CaG1bOvo.mjs +49 -0
  242. package/dist/schemaJson-CuhFxa8p.cjs +66 -0
  243. package/dist/{collectUint8StreamText-whblCEfg.cjs → src-BlzIcnVG.cjs} +522 -116
  244. package/dist/{collectUint8StreamText-CE1Re5Ij.mjs → src-DtEOcXdl.mjs} +350 -94
  245. package/package.json +1 -1
  246. package/dist/AcpNativeLogging-CA6XYzIS.cjs +0 -5130
  247. package/dist/AcpNativeLogging-D4-VoHrq.mjs +0 -5015
  248. package/dist/client/assets/AccountSettings-Bv57-JYy.js +0 -1
  249. package/dist/client/assets/AiFocusSettings-DCPHmJpA.js +0 -1
  250. package/dist/client/assets/AppearanceSettings-EmTrtb_U.js +0 -1
  251. package/dist/client/assets/ChatRightPanel-C1VD6GCV.js +0 -194
  252. package/dist/client/assets/CommandPaletteDialog-B_f3fKp7.js +0 -1
  253. package/dist/client/assets/CompositeRoot-B40iitmH.js +0 -1
  254. package/dist/client/assets/ConnectionsSettings-B9nfvgLG.js +0 -7
  255. package/dist/client/assets/ContextHandoffEndpointLabel-BSQOArMR.js +0 -4
  256. package/dist/client/assets/DialogRoot-CY6ZzEUS.js +0 -1
  257. package/dist/client/assets/DialogTrigger-CIeVAA-a.js +0 -1
  258. package/dist/client/assets/DraftChatThreadRouteView-DMIGMESb.js +0 -1
  259. package/dist/client/assets/McpServersSettings-CPeNF8_u.js +0 -6
  260. package/dist/client/assets/MobileSheet-BZo-RAfm.js +0 -1
  261. package/dist/client/assets/OpinionatedPluginsSettings-D8A1CbMG.js +0 -1
  262. package/dist/client/assets/PhoneHome-BTKOPVjw.js +0 -1
  263. package/dist/client/assets/ProvidersSettingsPanel-ldDCPVIY.js +0 -1
  264. package/dist/client/assets/RootAppShell-CzmEWO9w.js +0 -7
  265. package/dist/client/assets/Separator-BhAVTIOc.js +0 -1
  266. package/dist/client/assets/SettingsDialog-ByXgBN0U.js +0 -2
  267. package/dist/client/assets/SettingsPanels-Bgf4vkrJ.js +0 -3
  268. package/dist/client/assets/SourceControlSettings-dKw0FaN1.js +0 -1
  269. package/dist/client/assets/StatisticsPage-C2RuqDIK.js +0 -1
  270. package/dist/client/assets/StatisticsPanel-DqoXnrhQ.js +0 -1
  271. package/dist/client/assets/StatisticsSettingsLink-C_f31sb4.js +0 -1
  272. package/dist/client/assets/ThreadWorkspacePanel-BvRZIxZQ.js +0 -2073
  273. package/dist/client/assets/authorization-7xVVtCBu.js +0 -1
  274. package/dist/client/assets/badge-DnBuGHGL.js +0 -1
  275. package/dist/client/assets/chevron-right-CITtTwME.js +0 -1
  276. package/dist/client/assets/editorPreferences-Bg624RVT.js +0 -1
  277. package/dist/client/assets/kbd-4-4mGdIa.js +0 -1
  278. package/dist/client/assets/main-CC-U8LrA.css +0 -2
  279. package/dist/client/assets/main-CzDOnLFw.js +0 -9
  280. package/dist/client/assets/primary-CjhRI8fe.js +0 -2
  281. package/dist/client/assets/providerDriverMeta-BVHpFupf.js +0 -1
  282. package/dist/client/assets/providerModels-BsybzP4P.js +0 -1
  283. package/dist/client/assets/radio-group-C8qudOQH.js +0 -2
  284. package/dist/client/assets/runtime-Bxg7k81u.js +0 -17
  285. package/dist/client/assets/sidebarProjectFolders-BH8XBqNe.js +0 -4
  286. package/dist/client/assets/src-Bi-5Nw9C.js +0 -14
  287. package/dist/client/assets/switch-CEJEmLe7.js +0 -48
  288. package/dist/client/assets/tooltip-B7Z4qomY.js +0 -1
  289. package/dist/client/assets/useAppSidebarCollapsed-wq6czkNJ.js +0 -1
  290. package/dist/client/assets/useBaseUiId-OYaGjnkh.js +0 -1
  291. package/dist/client/assets/useLabelableId-VMc-yITe.js +0 -1
  292. package/dist/client/assets/useNavigate-DVi0rBlf.js +0 -1
  293. package/dist/client/assets/usePhoneThreadActions-CwwHikjB.js +0 -1
  294. package/dist/client/assets/usePopupViewport-BcSIK_ph.js +0 -1
  295. package/dist/client/assets/useScrollLock-BQf9VYJT.js +0 -1
  296. package/dist/client/assets/useStatistics-DczKdEfy.js +0 -55
  297. package/dist/client/assets/useTriggerFocusGuards-DjP-D0_a.js +0 -1
  298. package/dist/client/assets/useValueChanged-CRwCkFdy.js +0 -1
  299. package/dist/client/assets/workspaceMetadataProjection-j3BGlVOB.js +0 -1
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/main-CC-U8LrA.css"])))=>i.map(i=>d[i]);
2
- import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./index-CvRFRkBK.js";import{Ca as r,I as i,Ma as a,P as o,Ta as s,_l as c,_r as l,wa as u,zr as d}from"./runtime-Bxg7k81u.js";import{t as f}from"./log-out-CZW2EpNJ.js";import{t as p}from"./shield-check-CnKgVJ0F.js";import{t as m}from"./smartphone-CBgpMHXR.js";import{_ as h,o as g}from"./authorization-7xVVtCBu.js";import{i as _,r as v,t as y}from"./alert-BmLJh6DH.js";var b=e(t(),1),x=c(),S=(0,b.lazy)(()=>n(()=>import(`./HostedHubRoot-BkfafJ5x.js`).then(e=>({default:e.HostedAuthenticationSurface})),__vite__mapDeps([0])));function C(e){window.location.assign(e)}function w({handoffId:e,navigate:t=C}){let n=o(e=>e.accountStatus),c=o(e=>e.account),[w,T]=(0,b.useState)(null),[E,D]=(0,b.useState)(!0),[O,k]=(0,b.useState)(null),[A,j]=(0,b.useState)(null),[M,N]=(0,b.useState)(null),P=(0,b.useRef)(null);if((0,b.useEffect)(()=>{let t=new AbortController;return D(!0),N(null),i.getNativeHandoffPresentation(e,t.signal).then(e=>T(e)).catch(e=>{t.signal.aborted||N(e instanceof h?e.message:`This device authorization is unavailable or has expired.`)}).finally(()=>{t.signal.aborted||D(!1)}),()=>t.abort()},[e]),(0,b.useEffect)(()=>{!E&&n===`authenticated`&&P.current?.focus({preventScroll:!0})},[n,E]),n!==`authenticated`||!c)return(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(S,{context:`native-authorization`,autoExternalProvider:w?.providerHint??null})});let F=async n=>{if(O===null){k(n),N(null);try{if(n===`switch-account`){await g.signOut();return}let r=n===`approve`?await i.approveNativeHandoff(e):await i.cancelNativeHandoff(e);n===`approve`&&(j({redirectUri:r.redirectUri,deviceLabel:w?.deviceLabel??`your device`}),await new Promise(e=>requestAnimationFrame(()=>e()))),t(r.redirectUri)}catch(e){n===`approve`&&j(null),N(e instanceof h?e.message:`The device authorization could not be completed.`)}finally{k(null)}}};return A===null?(0,x.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center overflow-x-hidden bg-background px-4 py-10 text-foreground sm:px-6`,children:(0,x.jsxs)(`section`,{className:`w-full max-w-md rounded-[1.5rem] border border-border bg-card p-5 shadow-2xl shadow-black/10 sm:p-7`,children:[(0,x.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,x.jsx)(`div`,{className:`flex size-11 shrink-0 items-center justify-center rounded-xl border border-border bg-background text-primary`,children:(0,x.jsx)(p,{"aria-hidden":!0,className:`size-5`})}),(0,x.jsxs)(`p`,{className:`pt-1 text-[11px] font-semibold tracking-[0.16em] text-muted-foreground uppercase`,children:[l,` Hub`]})]}),(0,x.jsx)(`h1`,{ref:P,tabIndex:-1,className:`mt-6 text-2xl font-semibold tracking-tight outline-none`,children:`Continue on this device?`}),(0,x.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-muted-foreground`,children:`Only continue if you started this connection from the Ryco app. The app receives a one-time code, never this browser session.`}),(0,x.jsxs)(`div`,{className:`mt-6 overflow-hidden rounded-2xl border border-border bg-background/65`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border px-4 py-3.5`,children:[(0,x.jsx)(m,{"aria-hidden":!0,className:`size-5 text-muted-foreground`}),(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Requesting device`}),(0,x.jsx)(`p`,{className:`truncate text-sm font-medium`,children:E?`Checking request…`:w?.deviceLabel??`Unknown device`})]})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3.5`,children:[(0,x.jsx)(`div`,{"aria-hidden":!0,className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/12 text-xs font-semibold text-primary`,children:c.displayName.trim().slice(0,1).toLocaleUpperCase()||`R`}),(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Signed in as`}),(0,x.jsx)(`p`,{className:`truncate text-sm font-medium`,children:c.displayName})]})]})]}),M?(0,x.jsxs)(y,{variant:`error`,className:`mt-4`,children:[(0,x.jsx)(u,{"aria-hidden":!0}),(0,x.jsx)(_,{children:`Authorization did not complete`}),(0,x.jsx)(v,{children:M})]}):null,(0,x.jsxs)(`div`,{className:`mt-6 space-y-2.5`,children:[(0,x.jsxs)(d,{size:`lg`,className:`min-h-11 w-full`,disabled:E||!w||O!==null,onClick:()=>void F(`approve`),children:[O===`approve`?(0,x.jsx)(s,{"aria-hidden":!0,className:`animate-spin motion-reduce:animate-none`}):(0,x.jsx)(a,{"aria-hidden":!0}),`Continue as `,c.displayName]}),(0,x.jsxs)(d,{size:`lg`,variant:`outline`,className:`min-h-11 w-full`,disabled:O!==null,onClick:()=>void F(`switch-account`),children:[O===`switch-account`?(0,x.jsx)(s,{"aria-hidden":!0,className:`animate-spin motion-reduce:animate-none`}):(0,x.jsx)(f,{"aria-hidden":!0}),`Use another account`]}),(0,x.jsxs)(d,{size:`lg`,variant:`ghost`,className:`min-h-11 w-full`,disabled:E||!w||O!==null,onClick:()=>void F(`cancel`),children:[O===`cancel`?(0,x.jsx)(s,{"aria-hidden":!0,className:`animate-spin motion-reduce:animate-none`}):(0,x.jsx)(r,{"aria-hidden":!0}),`Cancel`]})]}),(0,x.jsx)(`p`,{className:`mt-5 text-center text-xs leading-relaxed text-muted-foreground`,children:`Access remains limited to the nodes and permissions assigned to this Hub account.`})]})}):(0,x.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center overflow-hidden bg-background px-4 py-10 text-foreground sm:px-6`,children:(0,x.jsxs)(`section`,{role:`status`,"aria-live":`polite`,className:`w-full max-w-md rounded-[1.5rem] border border-border bg-card p-6 text-center shadow-2xl shadow-black/10 sm:p-8`,children:[(0,x.jsxs)(`div`,{className:`relative mx-auto flex size-24 items-center justify-center`,children:[(0,x.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-2 rounded-full bg-success/20 motion-safe:animate-ping`}),(0,x.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-0 rounded-full border border-success/25 motion-safe:animate-pulse`}),(0,x.jsx)(`span`,{className:`relative flex size-16 items-center justify-center rounded-full bg-success text-success-foreground shadow-lg shadow-success/20`,children:(0,x.jsx)(a,{"aria-hidden":!0,className:`size-8`,strokeWidth:2.5})})]}),(0,x.jsx)(`p`,{className:`mt-7 text-[11px] font-semibold tracking-[0.16em] text-success uppercase`,children:`Sign-in approved`}),(0,x.jsx)(`h1`,{className:`mt-2 text-2xl font-semibold tracking-tight`,children:`Ryco is opening`}),(0,x.jsxs)(`p`,{className:`mt-3 text-sm leading-relaxed text-muted-foreground`,children:[`Ryco is securely finishing account and node setup on `,A.deviceLabel,`. This tab can be closed when the app shows setup complete.`]}),(0,x.jsx)(`div`,{className:`mt-7 rounded-2xl border border-border bg-background/65 p-4`,children:(0,x.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-sm font-medium`,children:[(0,x.jsx)(m,{"aria-hidden":!0,className:`size-4 text-primary`}),`Waiting for the Ryco app`,(0,x.jsxs)(`span`,{className:`flex gap-1`,"aria-hidden":!0,children:[(0,x.jsx)(`span`,{className:`size-1 rounded-full bg-primary motion-safe:animate-pulse`}),(0,x.jsx)(`span`,{className:`size-1 rounded-full bg-primary motion-safe:animate-pulse [animation-delay:150ms]`}),(0,x.jsx)(`span`,{className:`size-1 rounded-full bg-primary motion-safe:animate-pulse [animation-delay:300ms]`})]})]})}),(0,x.jsx)(d,{size:`lg`,variant:`outline`,className:`mt-5 min-h-11 w-full`,onClick:()=>t(A.redirectUri),children:`Open Ryco again`})]})})}export{w as HostedNativeAuthorizationRoute};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/main-BNPtp9Z0.css"])))=>i.map(i=>d[i]);
2
+ import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./index-7MTgf8YI.js";import{Br as r,Ea as i,I as a,Na as o,P as s,Ta as c,vl as l,vr as u,wa as d}from"./runtime-BKneT96Q.js";import{t as f}from"./log-out-pWFhbvwr.js";import{t as p}from"./shield-check-DyNf6Bky.js";import{t as m}from"./smartphone-BLWJ7C9-.js";import{_ as h,o as g}from"./authorization-B1YXfej3.js";import{i as _,r as v,t as y}from"./alert-C5UiA2xk.js";var b=e(t(),1),x=l(),S=(0,b.lazy)(()=>n(()=>import(`./HostedHubRoot-C1jq8cM6.js`).then(e=>({default:e.HostedAuthenticationSurface})),__vite__mapDeps([0])));function C(e){window.location.assign(e)}function w({handoffId:e,navigate:t=C}){let n=s(e=>e.accountStatus),l=s(e=>e.account),[w,T]=(0,b.useState)(null),[E,D]=(0,b.useState)(!0),[O,k]=(0,b.useState)(null),[A,j]=(0,b.useState)(null),[M,N]=(0,b.useState)(null),P=(0,b.useRef)(null);if((0,b.useEffect)(()=>{let t=new AbortController;return D(!0),N(null),a.getNativeHandoffPresentation(e,t.signal).then(e=>T(e)).catch(e=>{t.signal.aborted||N(e instanceof h?e.message:`This device authorization is unavailable or has expired.`)}).finally(()=>{t.signal.aborted||D(!1)}),()=>t.abort()},[e]),(0,b.useEffect)(()=>{!E&&n===`authenticated`&&P.current?.focus({preventScroll:!0})},[n,E]),n!==`authenticated`||!l)return(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(S,{context:`native-authorization`,autoExternalProvider:w?.providerHint??null})});let F=async n=>{if(O===null){k(n),N(null);try{if(n===`switch-account`){await g.signOut();return}let r=n===`approve`?await a.approveNativeHandoff(e):await a.cancelNativeHandoff(e);n===`approve`&&(j({redirectUri:r.redirectUri,deviceLabel:w?.deviceLabel??`your device`}),await new Promise(e=>requestAnimationFrame(()=>e()))),t(r.redirectUri)}catch(e){n===`approve`&&j(null),N(e instanceof h?e.message:`The device authorization could not be completed.`)}finally{k(null)}}};return A===null?(0,x.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center overflow-x-hidden bg-background px-4 py-10 text-foreground sm:px-6`,children:(0,x.jsxs)(`section`,{className:`w-full max-w-md rounded-[1.5rem] border border-border bg-card p-5 shadow-2xl shadow-black/10 sm:p-7`,children:[(0,x.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,x.jsx)(`div`,{className:`flex size-11 shrink-0 items-center justify-center rounded-xl border border-border bg-background text-primary`,children:(0,x.jsx)(p,{"aria-hidden":!0,className:`size-5`})}),(0,x.jsxs)(`p`,{className:`pt-1 text-[11px] font-semibold tracking-[0.16em] text-muted-foreground uppercase`,children:[u,` Hub`]})]}),(0,x.jsx)(`h1`,{ref:P,tabIndex:-1,className:`mt-6 text-2xl font-semibold tracking-tight outline-none`,children:`Continue on this device?`}),(0,x.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-muted-foreground`,children:`Only continue if you started this connection from the Ryco app. The app receives a one-time code, never this browser session.`}),(0,x.jsxs)(`div`,{className:`mt-6 overflow-hidden rounded-2xl border border-border bg-background/65`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border px-4 py-3.5`,children:[(0,x.jsx)(m,{"aria-hidden":!0,className:`size-5 text-muted-foreground`}),(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Requesting device`}),(0,x.jsx)(`p`,{className:`truncate text-sm font-medium`,children:E?`Checking request…`:w?.deviceLabel??`Unknown device`})]})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3.5`,children:[(0,x.jsx)(`div`,{"aria-hidden":!0,className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/12 text-xs font-semibold text-primary`,children:l.displayName.trim().slice(0,1).toLocaleUpperCase()||`R`}),(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Signed in as`}),(0,x.jsx)(`p`,{className:`truncate text-sm font-medium`,children:l.displayName})]})]})]}),M?(0,x.jsxs)(y,{variant:`error`,className:`mt-4`,children:[(0,x.jsx)(c,{"aria-hidden":!0}),(0,x.jsx)(_,{children:`Authorization did not complete`}),(0,x.jsx)(v,{children:M})]}):null,(0,x.jsxs)(`div`,{className:`mt-6 space-y-2.5`,children:[(0,x.jsxs)(r,{size:`lg`,className:`min-h-11 w-full`,disabled:E||!w||O!==null,onClick:()=>void F(`approve`),children:[O===`approve`?(0,x.jsx)(i,{"aria-hidden":!0,className:`animate-spin motion-reduce:animate-none`}):(0,x.jsx)(o,{"aria-hidden":!0}),`Continue as `,l.displayName]}),(0,x.jsxs)(r,{size:`lg`,variant:`outline`,className:`min-h-11 w-full`,disabled:O!==null,onClick:()=>void F(`switch-account`),children:[O===`switch-account`?(0,x.jsx)(i,{"aria-hidden":!0,className:`animate-spin motion-reduce:animate-none`}):(0,x.jsx)(f,{"aria-hidden":!0}),`Use another account`]}),(0,x.jsxs)(r,{size:`lg`,variant:`ghost`,className:`min-h-11 w-full`,disabled:E||!w||O!==null,onClick:()=>void F(`cancel`),children:[O===`cancel`?(0,x.jsx)(i,{"aria-hidden":!0,className:`animate-spin motion-reduce:animate-none`}):(0,x.jsx)(d,{"aria-hidden":!0}),`Cancel`]})]}),(0,x.jsx)(`p`,{className:`mt-5 text-center text-xs leading-relaxed text-muted-foreground`,children:`Access remains limited to the nodes and permissions assigned to this Hub account.`})]})}):(0,x.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center overflow-hidden bg-background px-4 py-10 text-foreground sm:px-6`,children:(0,x.jsxs)(`section`,{role:`status`,"aria-live":`polite`,className:`w-full max-w-md rounded-[1.5rem] border border-border bg-card p-6 text-center shadow-2xl shadow-black/10 sm:p-8`,children:[(0,x.jsxs)(`div`,{className:`relative mx-auto flex size-24 items-center justify-center`,children:[(0,x.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-2 rounded-full bg-success/20 motion-safe:animate-ping`}),(0,x.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-0 rounded-full border border-success/25 motion-safe:animate-pulse`}),(0,x.jsx)(`span`,{className:`relative flex size-16 items-center justify-center rounded-full bg-success text-success-foreground shadow-lg shadow-success/20`,children:(0,x.jsx)(o,{"aria-hidden":!0,className:`size-8`,strokeWidth:2.5})})]}),(0,x.jsx)(`p`,{className:`mt-7 text-[11px] font-semibold tracking-[0.16em] text-success uppercase`,children:`Sign-in approved`}),(0,x.jsx)(`h1`,{className:`mt-2 text-2xl font-semibold tracking-tight`,children:`Ryco is opening`}),(0,x.jsxs)(`p`,{className:`mt-3 text-sm leading-relaxed text-muted-foreground`,children:[`Ryco is securely finishing account and node setup on `,A.deviceLabel,`. This tab can be closed when the app shows setup complete.`]}),(0,x.jsx)(`div`,{className:`mt-7 rounded-2xl border border-border bg-background/65 p-4`,children:(0,x.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-sm font-medium`,children:[(0,x.jsx)(m,{"aria-hidden":!0,className:`size-4 text-primary`}),`Waiting for the Ryco app`,(0,x.jsxs)(`span`,{className:`flex gap-1`,"aria-hidden":!0,children:[(0,x.jsx)(`span`,{className:`size-1 rounded-full bg-primary motion-safe:animate-pulse`}),(0,x.jsx)(`span`,{className:`size-1 rounded-full bg-primary motion-safe:animate-pulse [animation-delay:150ms]`}),(0,x.jsx)(`span`,{className:`size-1 rounded-full bg-primary motion-safe:animate-pulse [animation-delay:300ms]`})]})]})}),(0,x.jsx)(r,{size:`lg`,variant:`outline`,className:`mt-5 min-h-11 w-full`,onClick:()=>t(A.redirectUri),children:`Open Ryco again`})]})})}export{w as HostedNativeAuthorizationRoute};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{_l as n,zr as r}from"./runtime-Bxg7k81u.js";import{Ft as i,It as a,Mt as o,Nt as s,Pt as c,jt as l,kt as u}from"./switch-CEJEmLe7.js";import{t as d}from"./compiler-runtime-qmuS0Svy.js";import{t as f}from"./input-C2xv8mMt.js";var p=d(),m=e(t(),1),h=n(),g=100;function _(e){let t=(0,p.c)(55),{node:n,open:d,onOpenChange:_,onRename:v}=e,[y,b]=(0,m.useState)(n.label),[x,S]=(0,m.useState)(!1),[C,w]=(0,m.useState)(null),T,E;t[0]!==n.label||t[1]!==d?(T=()=>{d&&(b(n.label),S(!1),w(null))},E=[n.label,d],t[0]=n.label,t[1]=d,t[2]=T,t[3]=E):(T=t[2],E=t[3]),(0,m.useEffect)(T,E);let D;t[4]===y?D=t[5]:(D=y.trim(),t[4]=y,t[5]=D);let O=D,k=O.length===0?`Enter a device name.`:O.length>g?`Use 100 characters or fewer.`:null,A=k===null&&O!==n.label&&!x,j;t[6]!==A||t[7]!==O||t[8]!==_||t[9]!==v?(j=async()=>{if(A){S(!0),w(null);try{await v(O),_(!1)}catch(e){let t=e;w(t instanceof Error?t.message:`Unable to rename this device.`),S(!1)}}},t[6]=A,t[7]=O,t[8]=_,t[9]=v,t[10]=j):j=t[10];let M=j,N;t[11]!==_||t[12]!==x?(N=e=>{x||_(e)},t[11]=_,t[12]=x,t[13]=N):N=t[13];let P=!x,F;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,h.jsxs)(s,{children:[(0,h.jsx)(a,{children:`Rename device`}),(0,h.jsx)(l,{children:`This is the canonical name shown to everyone authorized to use this device.`})]}),t[14]=F):F=t[14];let I;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,h.jsx)(`label`,{htmlFor:`hosted-node-name`,className:`text-sm font-medium`,children:`Device name`}),t[15]=I):I=t[15];let L=k!==null||C!==null,R;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{b(e.currentTarget.value),w(null)},t[16]=R):R=t[16];let z;t[17]!==A||t[18]!==M?(z=e=>{e.key===`Enter`&&A&&M()},t[17]=A,t[18]=M,t[19]=z):z=t[19];let B;t[20]!==y||t[21]!==x||t[22]!==z||t[23]!==L?(B=(0,h.jsx)(f,{id:`hosted-node-name`,value:y,autoFocus:!0,disabled:x,"aria-invalid":L,onChange:R,onKeyDown:z}),t[20]=y,t[21]=x,t[22]=z,t[23]=L,t[24]=B):B=t[24];let V;t[25]===k?V=t[26]:(V=k?(0,h.jsx)(`p`,{className:`text-xs text-destructive`,children:k}):null,t[25]=k,t[26]=V);let H;t[27]===C?H=t[28]:(H=C?(0,h.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:C}):null,t[27]=C,t[28]=H);let U;t[29]!==B||t[30]!==V||t[31]!==H?(U=(0,h.jsxs)(c,{className:`space-y-2`,children:[I,B,V,H]}),t[29]=B,t[30]=V,t[31]=H,t[32]=U):U=t[32];let W;t[33]===_?W=t[34]:(W=()=>_(!1),t[33]=_,t[34]=W);let G;t[35]!==x||t[36]!==W?(G=(0,h.jsx)(r,{variant:`outline`,disabled:x,onClick:W,children:`Cancel`}),t[35]=x,t[36]=W,t[37]=G):G=t[37];let K=!A,q;t[38]===M?q=t[39]:(q=()=>void M(),t[38]=M,t[39]=q);let J=x?`Saving…`:`Save`,Y;t[40]!==K||t[41]!==q||t[42]!==J?(Y=(0,h.jsx)(r,{disabled:K,onClick:q,children:J}),t[40]=K,t[41]=q,t[42]=J,t[43]=Y):Y=t[43];let X;t[44]!==G||t[45]!==Y?(X=(0,h.jsxs)(o,{children:[G,Y]}),t[44]=G,t[45]=Y,t[46]=X):X=t[46];let Z;t[47]!==U||t[48]!==X||t[49]!==P?(Z=(0,h.jsxs)(i,{className:`max-w-md`,showCloseButton:P,children:[F,U,X]}),t[47]=U,t[48]=X,t[49]=P,t[50]=Z):Z=t[50];let Q;return t[51]!==d||t[52]!==Z||t[53]!==N?(Q=(0,h.jsx)(u,{open:d,onOpenChange:N,children:Z}),t[51]=d,t[52]=Z,t[53]=N,t[54]=Q):Q=t[54],Q}export{_ as t};
1
+ import{i as e,t}from"./react-SIfiwpqq.js";import{Br as n,vl as r}from"./runtime-BKneT96Q.js";import{Ft as i,It as a,Mt as o,Nt as s,Pt as c,jt as l,kt as u}from"./switch-LahPAvrd.js";import{t as d}from"./compiler-runtime-qmuS0Svy.js";import{t as f}from"./input-CfVJycb1.js";var p=d(),m=e(t(),1),h=r(),g=100;function _(e){let t=(0,p.c)(55),{node:r,open:d,onOpenChange:_,onRename:v}=e,[y,b]=(0,m.useState)(r.label),[x,S]=(0,m.useState)(!1),[C,w]=(0,m.useState)(null),T,E;t[0]!==r.label||t[1]!==d?(T=()=>{d&&(b(r.label),S(!1),w(null))},E=[r.label,d],t[0]=r.label,t[1]=d,t[2]=T,t[3]=E):(T=t[2],E=t[3]),(0,m.useEffect)(T,E);let D;t[4]===y?D=t[5]:(D=y.trim(),t[4]=y,t[5]=D);let O=D,k=O.length===0?`Enter a device name.`:O.length>g?`Use 100 characters or fewer.`:null,A=k===null&&O!==r.label&&!x,j;t[6]!==A||t[7]!==O||t[8]!==_||t[9]!==v?(j=async()=>{if(A){S(!0),w(null);try{await v(O),_(!1)}catch(e){let t=e;w(t instanceof Error?t.message:`Unable to rename this device.`),S(!1)}}},t[6]=A,t[7]=O,t[8]=_,t[9]=v,t[10]=j):j=t[10];let M=j,N;t[11]!==_||t[12]!==x?(N=e=>{x||_(e)},t[11]=_,t[12]=x,t[13]=N):N=t[13];let P=!x,F;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,h.jsxs)(s,{children:[(0,h.jsx)(a,{children:`Rename device`}),(0,h.jsx)(l,{children:`This is the canonical name shown to everyone authorized to use this device.`})]}),t[14]=F):F=t[14];let I;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,h.jsx)(`label`,{htmlFor:`hosted-node-name`,className:`text-sm font-medium`,children:`Device name`}),t[15]=I):I=t[15];let L=k!==null||C!==null,R;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{b(e.currentTarget.value),w(null)},t[16]=R):R=t[16];let z;t[17]!==A||t[18]!==M?(z=e=>{e.key===`Enter`&&A&&M()},t[17]=A,t[18]=M,t[19]=z):z=t[19];let B;t[20]!==y||t[21]!==x||t[22]!==z||t[23]!==L?(B=(0,h.jsx)(f,{id:`hosted-node-name`,value:y,autoFocus:!0,disabled:x,"aria-invalid":L,onChange:R,onKeyDown:z}),t[20]=y,t[21]=x,t[22]=z,t[23]=L,t[24]=B):B=t[24];let V;t[25]===k?V=t[26]:(V=k?(0,h.jsx)(`p`,{className:`text-xs text-destructive`,children:k}):null,t[25]=k,t[26]=V);let H;t[27]===C?H=t[28]:(H=C?(0,h.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:C}):null,t[27]=C,t[28]=H);let U;t[29]!==B||t[30]!==V||t[31]!==H?(U=(0,h.jsxs)(c,{className:`space-y-2`,children:[I,B,V,H]}),t[29]=B,t[30]=V,t[31]=H,t[32]=U):U=t[32];let W;t[33]===_?W=t[34]:(W=()=>_(!1),t[33]=_,t[34]=W);let G;t[35]!==x||t[36]!==W?(G=(0,h.jsx)(n,{variant:`outline`,disabled:x,onClick:W,children:`Cancel`}),t[35]=x,t[36]=W,t[37]=G):G=t[37];let K=!A,q;t[38]===M?q=t[39]:(q=()=>void M(),t[38]=M,t[39]=q);let J=x?`Saving…`:`Save`,Y;t[40]!==K||t[41]!==q||t[42]!==J?(Y=(0,h.jsx)(n,{disabled:K,onClick:q,children:J}),t[40]=K,t[41]=q,t[42]=J,t[43]=Y):Y=t[43];let X;t[44]!==G||t[45]!==Y?(X=(0,h.jsxs)(o,{children:[G,Y]}),t[44]=G,t[45]=Y,t[46]=X):X=t[46];let Z;t[47]!==U||t[48]!==X||t[49]!==P?(Z=(0,h.jsxs)(i,{className:`max-w-md`,showCloseButton:P,children:[F,U,X]}),t[47]=U,t[48]=X,t[49]=P,t[50]=Z):Z=t[50];let Q;return t[51]!==d||t[52]!==Z||t[53]!==N?(Q=(0,h.jsx)(u,{open:d,onOpenChange:N,children:Z}),t[51]=d,t[52]=Z,t[53]=N,t[54]=Q):Q=t[54],Q}export{_ as t};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{Tt as n,_l as r,wt as i}from"./runtime-Bxg7k81u.js";import{t as a}from"./compiler-runtime-qmuS0Svy.js";import{t as o}from"./shield-alert-7yBlEyOs.js";import{t as s}from"./shield-rdjnBE2Q.js";import{Q as c,n as l,r as u,tt as d}from"./authorization-7xVVtCBu.js";function f(e){return u(e)}function p(e){return l(e)}var m=a(),h=e(t(),1),g=()=>n().status;function _(){return(0,h.useSyncExternalStore)(i,g,g)}var v=()=>n().verificationCode;function y(){return(0,h.useSyncExternalStore)(i,v,v)}function b(e){let t=e.split(d.separator);if(t.length!==d.groups)return[];for(let e of t){if(e.length!==d.charsPerGroup)return[];for(let t of e)if(!`0123456789ABCDEFGHJKMNPQRSTVWXYZ`.includes(t))return[]}return t}d.chars*Math.log2(c.length);var x=`Compare this code with the one your node's CLI shows for this session. A match catches accidental wrong-node routing and some network interposition while the loaded code is honest; it cannot protect against the Hub operator, who serves this page, and it does not rule out someone sitting in the middle.`,S=`Settings → Connections → Node security explains what else this tab cannot check.`,C=`Compare this code with the one your node's CLI shows for this session. A match catches accidental wrong-node routing and some network interposition while the loaded code is honest. This tab pins no node identity, so that comparison is the only thing that speaks to whether the far end is your machine or the Hub standing in for it — and it cannot protect against the Hub operator, who serves this page and could serve code that completes the same handshake and displays this same code anyway. A match does not rule out someone sitting in the middle.`,w="Run `ryco e2ee sessions` on the machine running the node to read its end of the comparison.",T=`No session code is available for this channel, so there is nothing here to compare against your node's CLI.`;function E(e){return e?`inline`:`settings`}var D={inline:{advisory:x,more:S},settings:{advisory:C,more:w}};Object.keys(D);function O(e,t){if(e===null)return null;let n=b(e);if(n.length===0)return null;let{advisory:r,more:i}=D[t];return{groups:n,display:n.join(d.separator),advisory:r,more:i}}var k={unavailable:{tone:`caution`,body:`Hosted connections reach your nodes through the Ryco Hub over WSS. No node channel is open in this tab, so the Hub still forwards what you send in a form it can read, and it is expected not to log or keep it.`},negotiating:{tone:`caution`,body:`This tab is still agreeing a channel with your node and has released nothing to it yet. Until that settles, treat this connection as one the Hub can read.`},"web-unsigned":{tone:`advisory`,body:`This tab and the node it was routed to agreed a browser channel, so while the code this page is running is honest the Hub relays ciphertext instead of readable payload. It is weaker than the channel the Ryco mobile app gets, in two ways this tab cannot close. This tab pins no node identity, so it cannot tell whether the far end of that channel is your machine or the Hub standing in for it. And it cannot protect against the Hub operator, who serves every byte of this page's JavaScript and could serve code that completes the same handshake and copies your data anyway. Its downgrade check is held in memory only — empty again in every new tab and after every reload, and worth nothing against that operator. Only your node can close the plaintext path for browsers.`},legacy:{tone:`caution`,body:`This channel fell back to legacy plaintext. This tab cannot tell whether your node offered no encrypted channel or something on the path removed the offer, so treat everything sent over it as readable by the Hub, which is expected not to log or keep it. Only your node can refuse plaintext for browsers.`}};function A(e){return k[e]}Object.keys(k);var j=r();function M(e){let t=(0,m.c)(13),{compact:n}=e,r=n!==void 0&&n,i=_(),a;t[0]===i?a=t[1]:(a=A(i),t[0]=i,t[1]=a);let{tone:c,body:l}=a,u=c===`advisory`?s:o,d=c===`advisory`?`text-sky-600`:`text-amber-600`,f=r?`flex gap-2 text-xs leading-relaxed text-muted-foreground`:`flex gap-2 rounded-lg border px-3 py-2.5 text-xs leading-relaxed text-muted-foreground ${c===`advisory`?`border-sky-500/25 bg-sky-500/5`:`border-amber-500/25 bg-amber-500/5`}`,p=`mt-0.5 size-4 shrink-0 ${d}`,h;t[2]!==u||t[3]!==p?(h=(0,j.jsx)(u,{"aria-hidden":!0,className:p}),t[2]=u,t[3]=p,t[4]=h):h=t[4];let g;t[5]===l?g=t[6]:(g=(0,j.jsx)(`p`,{children:l}),t[5]=l,t[6]=g);let v;return t[7]!==i||t[8]!==f||t[9]!==h||t[10]!==g||t[11]!==c?(v=(0,j.jsxs)(`div`,{className:f,"data-hosted-relay-trust-notice":`true`,"data-e2ee-status":i,"data-tone":c,children:[h,g]}),t[7]=i,t[8]=f,t[9]=h,t[10]=g,t[11]=c,t[12]=v):v=t[12],v}export{_ as a,f as c,O as i,T as n,y as o,E as r,p as s,M as t};
1
+ import{i as e,t}from"./react-SIfiwpqq.js";import{Tt as n,vl as r,wt as i}from"./runtime-BKneT96Q.js";import{t as a}from"./compiler-runtime-qmuS0Svy.js";import{t as o}from"./shield-alert-DMB5gKiC.js";import{t as s}from"./shield-Zn2kFj5M.js";import{Q as c,n as l,r as u,tt as d}from"./authorization-B1YXfej3.js";function f(e){return u(e)}function p(e){return l(e)}var m=a(),h=e(t(),1),g=()=>n().status;function _(){return(0,h.useSyncExternalStore)(i,g,g)}var v=()=>n().verificationCode;function y(){return(0,h.useSyncExternalStore)(i,v,v)}function b(e){let t=e.split(d.separator);if(t.length!==d.groups)return[];for(let e of t){if(e.length!==d.charsPerGroup)return[];for(let t of e)if(!`0123456789ABCDEFGHJKMNPQRSTVWXYZ`.includes(t))return[]}return t}d.chars*Math.log2(c.length);var x=`Compare this code with the one your node's CLI shows for this session. A match catches accidental wrong-node routing and some network interposition while the loaded code is honest; it cannot protect against the Hub operator, who serves this page, and it does not rule out someone sitting in the middle.`,S=`Settings → Connections → Node security explains what else this tab cannot check.`,C=`Compare this code with the one your node's CLI shows for this session. A match catches accidental wrong-node routing and some network interposition while the loaded code is honest. This tab pins no node identity, so that comparison is the only thing that speaks to whether the far end is your machine or the Hub standing in for it — and it cannot protect against the Hub operator, who serves this page and could serve code that completes the same handshake and displays this same code anyway. A match does not rule out someone sitting in the middle.`,w="Run `ryco e2ee sessions` on the machine running the node to read its end of the comparison.",T=`No session code is available for this channel, so there is nothing here to compare against your node's CLI.`;function E(e){return e?`inline`:`settings`}var D={inline:{advisory:x,more:S},settings:{advisory:C,more:w}};Object.keys(D);function O(e,t){if(e===null)return null;let n=b(e);if(n.length===0)return null;let{advisory:r,more:i}=D[t];return{groups:n,display:n.join(d.separator),advisory:r,more:i}}var k={unavailable:{tone:`caution`,body:`Hosted connections reach your nodes through the Ryco Hub over WSS. No node channel is open in this tab, so the Hub still forwards what you send in a form it can read, and it is expected not to log or keep it.`},negotiating:{tone:`caution`,body:`This tab is still agreeing a channel with your node and has released nothing to it yet. Until that settles, treat this connection as one the Hub can read.`},"web-unsigned":{tone:`advisory`,body:`This tab and the node it was routed to agreed a browser channel, so while the code this page is running is honest the Hub relays ciphertext instead of readable payload. It is weaker than the channel the Ryco mobile app gets, in two ways this tab cannot close. This tab pins no node identity, so it cannot tell whether the far end of that channel is your machine or the Hub standing in for it. And it cannot protect against the Hub operator, who serves every byte of this page's JavaScript and could serve code that completes the same handshake and copies your data anyway. Its downgrade check is held in memory only — empty again in every new tab and after every reload, and worth nothing against that operator. Only your node can close the plaintext path for browsers.`},legacy:{tone:`caution`,body:`This channel fell back to legacy plaintext. This tab cannot tell whether your node offered no encrypted channel or something on the path removed the offer, so treat everything sent over it as readable by the Hub, which is expected not to log or keep it. Only your node can refuse plaintext for browsers.`}};function A(e){return k[e]}Object.keys(k);var j=r();function M(e){let t=(0,m.c)(13),{compact:n}=e,r=n!==void 0&&n,i=_(),a;t[0]===i?a=t[1]:(a=A(i),t[0]=i,t[1]=a);let{tone:c,body:l}=a,u=c===`advisory`?s:o,d=c===`advisory`?`text-sky-600`:`text-amber-600`,f=r?`flex gap-2 text-xs leading-relaxed text-muted-foreground`:`flex gap-2 rounded-lg border px-3 py-2.5 text-xs leading-relaxed text-muted-foreground ${c===`advisory`?`border-sky-500/25 bg-sky-500/5`:`border-amber-500/25 bg-amber-500/5`}`,p=`mt-0.5 size-4 shrink-0 ${d}`,h;t[2]!==u||t[3]!==p?(h=(0,j.jsx)(u,{"aria-hidden":!0,className:p}),t[2]=u,t[3]=p,t[4]=h):h=t[4];let g;t[5]===l?g=t[6]:(g=(0,j.jsx)(`p`,{children:l}),t[5]=l,t[6]=g);let v;return t[7]!==i||t[8]!==f||t[9]!==h||t[10]!==g||t[11]!==c?(v=(0,j.jsxs)(`div`,{className:f,"data-hosted-relay-trust-notice":`true`,"data-e2ee-status":i,"data-tone":c,children:[h,g]}),t[7]=i,t[8]=f,t[9]=h,t[10]=g,t[11]=c,t[12]=v):v=t[12],v}export{_ as a,f as c,O as i,T as n,y as o,E as r,p as s,M as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/main-CC-U8LrA.css"])))=>i.map(i=>d[i]);
2
- import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./index-CvRFRkBK.js";import{G as r,K as i,a}from"./primary-CjhRI8fe.js";import{c as o,ni as s,t as c}from"./src-Bi-5Nw9C.js";import{$n as l,Ma as u,Na as d,Nr as f,Oa as p,Or as m,_l as h,ea as g,gl as _,hl as v,kr as y,wa as b,zr as x}from"./runtime-Bxg7k81u.js";import{t as S}from"./switch-CEJEmLe7.js";import{t as C}from"./compiler-runtime-qmuS0Svy.js";import{t as w}from"./badge-DnBuGHGL.js";import{t as T}from"./bot-CsKkSRlb.js";import{K as E,Y as D}from"./ContextHandoffEndpointLabel-BSQOArMR.js";import{t as O}from"./chevron-right-CITtTwME.js";import{t as k}from"./key-round-CYcb9lAa.js";import{t as A}from"./refresh-cw-B5Cz1z3e.js";import{t as j}from"./save-C7zM6ey6.js";import{t as M}from"./shield-check-CnKgVJ0F.js";import{t as N}from"./unplug-CRUwFNFw.js";import{t as P}from"./wrench-BBIgGxy9.js";import{t as F}from"./toastHelpers-CSQRKo4F.js";import{t as I}from"./input-C2xv8mMt.js";import{t as L}from"./capabilities-DskyVNd2.js";import"./providerModels-BsybzP4P.js";import{r as R}from"./providerDriverMeta-BVHpFupf.js";import{Bt as z}from"./main-CzDOnLFw.js";var B={name:`cable`,size:24,node:[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]};B.node;var V=d(B),H={name:`clipboard`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]};H.node;var U=d(H),ee={name:`link-2-off`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]};ee.node;var te=d(ee),ne=()=>({integrations:[],topology:{available:!1,reason:`Not loaded.`},pairingCodes:{}}),re=(e,t)=>({integrations:t.integrations,topology:t.topology,pairingCodes:{}}),ie=(e,t)=>({...e,integrations:[...e.integrations.filter(e=>e.integration.integrationId!==t.detail.integration.integrationId),t.detail],pairingCodes:{...e.pairingCodes,[t.detail.integration.integrationId]:t.pairingCode}}),ae=(e,t)=>{let n={...e.pairingCodes};return delete n[t],{...e,integrations:e.integrations.filter(e=>e.integration.integrationId!==t),pairingCodes:n}},oe=()=>({installations:[]}),se=e=>[...e].toSorted((e,t)=>e.driver.localeCompare(t.driver)||e.createdAt.localeCompare(t.createdAt)||e.installationId.localeCompare(t.installationId)),ce=(e,t)=>({installations:se(t.installations)}),W=(e,t)=>{let n=e.installations.find(e=>e.installationId===t.installation.installationId);return n&&n.revision>t.installation.revision?e:{installations:se([...e.installations.filter(e=>e.installationId!==t.installation.installationId),t.installation])}},G=e(t(),1),K=C(),le=[50,100,200,400],ue=e=>e instanceof Error&&e.message.trim()===`Agent Control is disabled.`,de=e=>new Promise(t=>window.setTimeout(t,e));async function fe(e,t=de){for(let n of le)try{return await e()}catch(e){if(!ue(e))throw e;await t(n)}return e()}var q=h(),pe={codex:`Codex`,"claude-code":`Claude Code`,"claude-desktop":`Claude Desktop`,"generic-mcp":`Generic MCP`},me=[{capability:o.externalListProjects,label:`List allowed projects`,description:`Discover only projects inside this integration's scope.`},{capability:o.externalCreateTask,label:`Request tasks`,description:`Submit one task to Ryco's normal approval queue.`},{capability:o.externalReadTask,label:`Read own tasks`,description:`Read or wait only for tasks created by this integration.`},{capability:o.externalReadAutomations,label:`Read automations`,description:`Read bounded schedules and run outcomes inside the selected project scope.`},{capability:o.externalManageAutomations,label:`Request automations`,description:`Propose schedule changes; each due run still requires separate approval.`},{capability:o.externalReadActivity,label:`Read activity`,description:`Read bounded payload-free project and provider event summaries.`},{capability:o.externalReadDiagnostics,label:`Read diagnostics`,description:`Read redacted count-only health summaries for allowed projects.`},{capability:o.externalSharedCheckout,label:`Request shared checkout`,description:`May request the local checkout; each request still needs approval.`},{capability:o.externalFullAccess,label:`Request full access`,description:`May request a full-access runtime; each request still needs approval.`}],J=()=>({displayName:``,clientKind:`codex`,scopeKind:`all`,projectIds:``,capabilities:[o.externalListProjects,o.externalCreateTask,o.externalReadTask],expiresAt:``,rateLimitPerMinute:`60`,activeTaskLimit:`1`});function Y(e,t){f.add(F({type:`error`,title:e,description:t instanceof Error?t.message:`The request failed.`}))}function he(e,t){return[e,...t.map(e=>JSON.stringify(e))].join(` `)}function X(e){return e===null?`Never`:new Date(e).toLocaleString()}function ge(e){let t=e.integration;return t.revokedAt===null?t.expiresAt!==null&&Date.parse(t.expiresAt)<=Date.now()?{label:`Expired`,variant:`error`}:t.pairingState===`paired`?{label:`Paired`,variant:`success`}:t.pairingState===`pending`?{label:`Pairing`,variant:`warning`}:{label:`Unpaired`,variant:`outline`}:{label:`Revoked`,variant:`error`}}function _e(e){let t=e.integration;return{displayName:t.displayName,clientKind:t.clientKind,scopeKind:t.projectScope.kind,projectIds:t.projectScope.kind===`selected`?t.projectScope.projectIds.join(`, `):``,capabilities:t.capabilities,expiresAt:t.expiresAt===null?``:new Date(t.expiresAt).toISOString().slice(0,16),rateLimitPerMinute:String(t.rateLimitPerMinute),activeTaskLimit:String(t.activeTaskLimit)}}function Z(e){let t=e.projectIds.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>s.make(e)),n=e.scopeKind===`all`?{kind:`all`}:{kind:`selected`,projectIds:t},r=Number(e.rateLimitPerMinute),i=Number(e.activeTaskLimit);if(!e.displayName.trim())throw Error(`A display name is required.`);if(e.scopeKind===`selected`&&t.length===0)throw Error(`Enter at least one project ID for selected-project scope.`);if(!Number.isInteger(r)||r<1)throw Error(`Rate limit must be a positive whole number.`);if(!Number.isInteger(i)||i<1)throw Error(`Active-task limit must be a positive whole number.`);return{displayName:e.displayName.trim(),clientKind:e.clientKind,projectScope:n,capabilities:e.capabilities,expiresAt:e.expiresAt?new Date(e.expiresAt).toISOString():null,rateLimitPerMinute:r,activeTaskLimit:i}}function ve(e){let t=(0,K.c)(85),{form:n,onChange:r,clientLocked:i}=e,a=i!==void 0&&i,o;t[0]!==n||t[1]!==r?(o=e=>r({...n,displayName:e.target.value}),t[0]=n,t[1]=r,t[2]=o):o=t[2];let s;t[3]!==n.displayName||t[4]!==o?(s=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Display name`,(0,q.jsx)(I,{value:n.displayName,placeholder:`Local Codex`,onChange:o})]}),t[3]=n.displayName,t[4]=o,t[5]=s):s=t[5];let c=n.clientKind,l;t[6]!==n||t[7]!==r?(l=e=>r({...n,clientKind:e.target.value}),t[6]=n,t[7]=r,t[8]=l):l=t[8];let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.entries(pe).map(ye),t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==n.clientKind||t[12]!==l?(d=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Client`,(0,q.jsx)(`select`,{className:`h-9 rounded-lg border border-input bg-background px-3 text-sm`,value:c,disabled:a,onChange:l,children:u})]}),t[10]=a,t[11]=n.clientKind,t[12]=l,t[13]=d):d=t[13];let f;t[14]!==s||t[15]!==d?(f=(0,q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[s,d]}),t[14]=s,t[15]=d,t[16]=f):f=t[16];let p;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,q.jsx)(`legend`,{className:`text-xs font-medium`,children:`Project scope`}),t[17]=p):p=t[17];let m=n.scopeKind===`all`,h;t[18]!==n||t[19]!==r?(h=()=>r({...n,scopeKind:`all`}),t[18]=n,t[19]=r,t[20]=h):h=t[20];let g;t[21]!==m||t[22]!==h?(g=(0,q.jsx)(`input`,{type:`radio`,checked:m,onChange:h}),t[21]=m,t[22]=h,t[23]=g):g=t[23];let _;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,q.jsxs)(`span`,{children:[`All current and future projects`,(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`The client can discover every project on this local Ryco instance.`})]}),t[24]=_):_=t[24];let v;t[25]===g?v=t[26]:(v=(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[g,_]}),t[25]=g,t[26]=v);let y=n.scopeKind===`selected`,b;t[27]!==n||t[28]!==r?(b=()=>r({...n,scopeKind:`selected`}),t[27]=n,t[28]=r,t[29]=b):b=t[29];let x;t[30]!==y||t[31]!==b?(x=(0,q.jsx)(`input`,{type:`radio`,checked:y,onChange:b}),t[30]=y,t[31]=b,t[32]=x):x=t[32];let S=n.scopeKind!==`selected`,C;t[33]!==n||t[34]!==r?(C=e=>r({...n,projectIds:e.target.value}),t[33]=n,t[34]=r,t[35]=C):C=t[35];let w;t[36]!==n.projectIds||t[37]!==S||t[38]!==C?(w=(0,q.jsx)(I,{className:`mt-1.5`,value:n.projectIds,disabled:S,placeholder:`project-id-1, project-id-2`,"aria-label":`Selected project IDs`,onChange:C}),t[36]=n.projectIds,t[37]=S,t[38]=C,t[39]=w):w=t[39];let T;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:`Comma-separated stable project IDs. Unknown IDs remain inaccessible.`}),t[40]=T):T=t[40];let E;t[41]===w?E=t[42]:(E=(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Selected projects`,w,T]}),t[41]=w,t[42]=E);let D;t[43]!==x||t[44]!==E?(D=(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[x,E]}),t[43]=x,t[44]=E,t[45]=D):D=t[45];let O;t[46]!==v||t[47]!==D?(O=(0,q.jsxs)(`fieldset`,{className:`grid gap-2`,children:[p,v,D]}),t[46]=v,t[47]=D,t[48]=O):O=t[48];let k;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,q.jsx)(`legend`,{className:`text-xs font-medium`,children:`Capability grants`}),t[49]=k):k=t[49];let A;t[50]!==n||t[51]!==r?(A=me.map(e=>(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:n.capabilities.includes(e.capability),onChange:t=>r({...n,capabilities:t.target.checked?[...n.capabilities,e.capability]:n.capabilities.filter(t=>t!==e.capability)})}),(0,q.jsxs)(`span`,{children:[e.label,(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description})]})]},e.capability)),t[50]=n,t[51]=r,t[52]=A):A=t[52];let j;t[53]===A?j=t[54]:(j=(0,q.jsxs)(`fieldset`,{className:`grid gap-2`,children:[k,A]}),t[53]=A,t[54]=j);let M;t[55]!==n||t[56]!==r?(M=e=>r({...n,expiresAt:e.target.value}),t[55]=n,t[56]=r,t[57]=M):M=t[57];let N;t[58]!==n.expiresAt||t[59]!==M?(N=(0,q.jsx)(I,{type:`datetime-local`,value:n.expiresAt,onChange:M}),t[58]=n.expiresAt,t[59]=M,t[60]=N):N=t[60];let P;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,q.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`Empty means no expiry.`}),t[61]=P):P=t[61];let F;t[62]===N?F=t[63]:(F=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Expires`,N,P]}),t[62]=N,t[63]=F);let L;t[64]!==n||t[65]!==r?(L=e=>r({...n,rateLimitPerMinute:e.target.value}),t[64]=n,t[65]=r,t[66]=L):L=t[66];let R;t[67]!==n.rateLimitPerMinute||t[68]!==L?(R=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Requests per minute`,(0,q.jsx)(I,{type:`number`,min:1,max:600,value:n.rateLimitPerMinute,onChange:L})]}),t[67]=n.rateLimitPerMinute,t[68]=L,t[69]=R):R=t[69];let z;t[70]!==n||t[71]!==r?(z=e=>r({...n,activeTaskLimit:e.target.value}),t[70]=n,t[71]=r,t[72]=z):z=t[72];let B;t[73]!==n.activeTaskLimit||t[74]!==z?(B=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Concurrent active tasks`,(0,q.jsx)(I,{type:`number`,min:1,max:32,value:n.activeTaskLimit,onChange:z})]}),t[73]=n.activeTaskLimit,t[74]=z,t[75]=B):B=t[75];let V;t[76]!==F||t[77]!==R||t[78]!==B?(V=(0,q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[F,R,B]}),t[76]=F,t[77]=R,t[78]=B,t[79]=V):V=t[79];let H;return t[80]!==O||t[81]!==j||t[82]!==V||t[83]!==f?(H=(0,q.jsxs)(`div`,{className:`grid gap-4`,children:[f,O,j,V]}),t[80]=O,t[81]=j,t[82]=V,t[83]=f,t[84]=H):H=t[84],H}function ye(e){let[t,n]=e;return(0,q.jsx)(`option`,{value:t,children:n},t)}function be(){let e=_(),t=a(),n=e?.environmentId??t,[r,i]=(0,G.useState)(ne),[o,s]=(0,G.useState)(J),[c,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(null),[g,v]=(0,G.useState)(null),y=(0,G.useMemo)(()=>n===null?void 0:l(n)?.agentControl,[n]),b=(0,G.useCallback)(async()=>{if(y)try{let e=await fe(()=>y.listIntegrations());i(t=>re(t,e))}catch(e){Y(`Failed to load external integrations`,e)}},[y]);(0,G.useEffect)(()=>{b()},[b]);let S=(0,G.useCallback)(async(e,t)=>{await navigator.clipboard.writeText(t),v(e),window.setTimeout(()=>v(t=>t===e?null:t),1500)},[]),C=async()=>{if(y)try{h(`new`);let e=await y.createIntegration(Z(o));i(t=>ie(t,e)),s(J()),d(!1)}catch(e){Y(`Failed to create integration`,e)}finally{h(null)}},T=async e=>{if(y)try{h(e.integration.integrationId);let t=Z(o);await y.updateIntegration({integrationId:e.integration.integrationId,...t}),p(null),await b()}catch(e){Y(`Failed to update integration`,e)}finally{h(null)}},D=async e=>{if(!y)return;let t=e.integration.integrationId;try{h(t);let e=await y.resumeIntegrationPairing({integrationId:t});i(t=>ie(t,e))}catch(e){Y(`Failed to resume pairing`,e)}finally{h(null)}},O=async e=>{if(!y)return;let t=e.integration.integrationId;try{h(t),await y.revokeIntegration({integrationId:t}),await b()}catch(e){Y(`Failed to revoke integration`,e)}finally{h(null)}},N=async e=>{if(!y)return;let t=e.integration.integrationId;if(window.confirm(`Delete ${e.integration.displayName}? This cannot be undone.`))try{h(t),(await y.deleteIntegration({integrationId:t})).deleted&&i(e=>ae(e,t))}catch(e){Y(`Failed to delete integration`,e)}finally{h(null)}};return(0,q.jsx)(`section`,{"data-testid":`external-integrations`,className:`border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto grid w-full max-w-4xl gap-5`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(M,{className:`size-3.5`}),`Agent Control`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`External integrations`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Pair a local MCP client with a revocable identity. Every task request waits in Ryco for explicit user approval before a thread is created.`})]}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(x,{size:`icon`,variant:`outline`,"aria-label":`Refresh integrations`,onClick:()=>void b(),children:(0,q.jsx)(A,{})}),(0,q.jsxs)(x,{disabled:!y||!r.topology.available,onClick:()=>{p(null),s(J()),d(e=>!e)},children:[(0,q.jsx)(z,{}),`New integration`]})]})]}),r.topology.available?null:(0,q.jsxs)(`div`,{className:`flex gap-3 rounded-xl border border-warning/30 bg-warning/8 p-4 text-sm`,children:[(0,q.jsx)(te,{className:`mt-0.5 size-4 shrink-0 text-warning-foreground`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`font-medium`,children:`Local pairing is unavailable`}),(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[r.topology.reason??`Ryco could not prove a direct loopback-only topology.`,` `,`External setup fails closed while Ryco is remotely exposed or Hub-connected.`]})]})]}),c?(0,q.jsxs)(`div`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsx)(ve,{form:o,onChange:s}),(0,q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,q.jsx)(x,{variant:`ghost`,onClick:()=>d(!1),children:`Cancel`}),(0,q.jsxs)(x,{disabled:m===`new`,onClick:()=>void C(),children:[(0,q.jsx)(k,{}),`Create and pair`]})]})]}):null,r.integrations.length===0&&!c?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-6 text-center text-sm text-muted-foreground`,children:`No external integrations are configured.`}):null,r.integrations.map(e=>{let t=e.integration,n=ge(e),i=r.pairingCodes[t.integrationId],a=he(e.setup.pairCommand.command,e.setup.pairCommand.args),c=f===t.integrationId;return(0,q.jsxs)(`article`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h3`,{className:`font-semibold`,children:t.displayName}),(0,q.jsx)(w,{variant:n.variant,children:n.label}),(0,q.jsx)(w,{variant:`outline`,children:pe[t.clientKind]})]}),(0,q.jsx)(`p`,{className:`mt-1 font-mono text-[11px] text-muted-foreground`,children:t.integrationId})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(x,{size:`sm`,variant:`outline`,onClick:()=>{p(c?null:t.integrationId),s(_e(e))},children:c?`Close editor`:`Edit`}),(0,q.jsxs)(x,{size:`sm`,variant:`outline`,disabled:!r.topology.available||m===t.integrationId||t.revokedAt!==null,onClick:()=>void D(e),children:[(0,q.jsx)(k,{}),`Pair again`]}),(0,q.jsx)(x,{size:`sm`,variant:`outline`,disabled:m===t.integrationId||t.revokedAt!==null,onClick:()=>void O(e),children:`Revoke`}),(0,q.jsx)(x,{size:`icon-sm`,variant:`ghost`,"aria-label":`Delete ${t.displayName}`,disabled:m===t.integrationId,onClick:()=>void N(e),children:(0,q.jsx)(E,{})})]})]}),c?(0,q.jsxs)(`div`,{className:`grid gap-4 border-t pt-4`,children:[(0,q.jsx)(ve,{form:o,onChange:s}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsxs)(x,{disabled:m===t.integrationId,onClick:()=>void T(e),children:[(0,q.jsx)(j,{}),`Save changes`]})})]}):(0,q.jsxs)(`div`,{className:`grid gap-3 text-xs sm:grid-cols-2`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Project scope`}),(0,q.jsx)(`p`,{className:`mt-0.5 break-words font-medium`,children:t.projectScope.kind===`all`?`All current and future projects`:t.projectScope.projectIds.join(`, `)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Limits`}),(0,q.jsxs)(`p`,{className:`mt-0.5 font-medium`,children:[t.rateLimitPerMinute,`/minute · `,t.activeTaskCount,`/`,t.activeTaskLimit,` active`]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Expiry`}),(0,q.jsx)(`p`,{className:`mt-0.5 font-medium`,children:X(t.expiresAt)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Last used`}),(0,q.jsx)(`p`,{className:`mt-0.5 font-medium`,children:X(t.lastUsedAt)})]}),(0,q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Capabilities`}),(0,q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:t.capabilities.map(e=>(0,q.jsx)(w,{variant:`outline`,children:e},e))})]})]}),t.pairingState===`pending`?(0,q.jsxs)(`div`,{className:`grid gap-3 rounded-lg border bg-muted/20 p-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`text-sm font-medium`,children:`Finish pairing locally`}),(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Pairing code expires `,X(t.pairingCodeExpiresAt),`. The code is shown only for this ceremony; the generated MCP configuration never contains it.`]})]}),i?(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`code`,{"data-testid":`external-pairing-code`,className:`rounded bg-background px-3 py-2 font-mono text-sm tracking-[0.18em]`,children:i}),(0,q.jsxs)(x,{size:`sm`,variant:`outline`,onClick:()=>void S(`code-${t.integrationId}`,i),children:[g===`code-${t.integrationId}`?(0,q.jsx)(u,{}):(0,q.jsx)(U,{}),`Copy code`]})]}):(0,q.jsx)(`p`,{className:`text-xs text-warning-foreground`,children:`The pairing code is no longer displayed. Choose Pair again to generate a new one.`}),(0,q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium`,children:`Run this bridge command, then enter the code`}),(0,q.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,q.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded bg-background p-2 text-[11px]`,children:a}),(0,q.jsx)(x,{size:`icon-sm`,variant:`outline`,"aria-label":`Copy pairing command`,onClick:()=>void S(`pair-${t.integrationId}`,a),children:g===`pair-${t.integrationId}`?(0,q.jsx)(u,{}):(0,q.jsx)(U,{})})]})]}),(0,q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium`,children:`MCP configuration`}),(0,q.jsx)(`pre`,{"data-testid":`external-mcp-configuration`,className:`max-h-48 overflow-auto rounded bg-background p-3 text-[11px] leading-relaxed`,children:e.setup.configuration}),(0,q.jsxs)(x,{className:`justify-self-start`,size:`sm`,variant:`outline`,onClick:()=>void S(`config-${t.integrationId}`,e.setup.configuration),children:[g===`config-${t.integrationId}`?(0,q.jsx)(u,{}):(0,q.jsx)(U,{}),`Copy configuration`]})]})]}):null]},t.integrationId)})]})})}var xe=[],Se=[];function Ce(e){return e.displayName??R(e.driver)?.label??g(e.driver)}function Q(e){return e.providerDisplayName??R(e.driver)?.label??g(e.driver)}function we(e){return e.driver===`codex`?`codex`:e.driver===`claudeAgent`?`claude-code`:`generic-mcp`}function Te(e){return{...J(),displayName:`${Q(e)} Agent Control`,clientKind:we(e)}}function Ee(e,t){return e.filter(e=>e.workspaceId===t).toSorted((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0]}function De(e){if(!e)return{label:`Not connected`,variant:`outline`};switch(e.state){case`connected`:return{label:`Connected`,variant:`success`};case`repair-needed`:return{label:`Needs repair`,variant:`error`};case`disconnected`:case`revoked`:return{label:`Disconnected`,variant:`outline`};case`disconnecting`:return{label:`Disconnecting`,variant:`warning`};case`planned`:case`credential-written`:case`provider-written`:case`verifying`:return{label:`Connecting`,variant:`warning`}}}function Oe(e,t){f.add(F({type:`success`,title:e,description:t}))}function $(e,t){f.add(F({type:`error`,title:e,description:t instanceof Error?t.message:`The request failed.`}))}function ke(){let e=_(),t=a(),n=e?.environmentId??t,[r,i]=(0,G.useState)(xe),[o,s]=(0,G.useState)(Se),[c,u]=(0,G.useState)(oe),[d,f]=(0,G.useState)(null),[m,h]=(0,G.useState)(!0),[g,v]=(0,G.useState)(null),[y,S]=(0,G.useState)(null),[C,E]=(0,G.useState)(J),O=(0,G.useMemo)(()=>n===null?void 0:l(n),[n]),k=O?.agentControl,j=O?.mcp,M=(0,G.useCallback)(async()=>{if(!k||!j){h(!1);return}try{let[e,t,n]=await fe(()=>Promise.all([j.listWorkspaces(),k.listMcpInstallations(),k.listIntegrations()]));i(e.providers),s(e.workspaces),u(e=>ce(e,t)),f(n.topology)}catch(e){$(`Failed to load Agent Control providers`,e)}finally{h(!1)}},[k,j]);(0,G.useEffect)(()=>{M()},[M]);let F=async(e,t)=>{if(k)try{v(e.id);let n=t?(()=>{let{clientKind:t,...n}=Z(C);return{workspaceId:e.id,...n}})():{workspaceId:e.id},r=await k.connectMcpInstallation(n);u(e=>W(e,r)),S(null),Oe(`${Q(e)} connected`,`The credential was stored locally and was not shown to the browser.`)}catch(t){$(`Failed to connect ${Q(e)}`,t),await M()}finally{v(null)}},I=async(e,t)=>{if(k)try{v(e.id);let n=await k.repairMcpInstallation({installationId:t.installationId});u(e=>W(e,n)),Oe(`${Q(e)} repaired`)}catch(t){$(`Failed to repair ${Q(e)}`,t),await M()}finally{v(null)}},L=async(e,t)=>{if(k&&window.confirm(`Disconnect Agent Control from ${Q(e)}?`))try{v(e.id);let n=await k.disconnectMcpInstallation({installationId:t.installationId});u(e=>W(e,n)),Oe(`${Q(e)} disconnected`)}catch(t){$(`Failed to disconnect ${Q(e)}`,t),await M()}finally{v(null)}},z=o.filter(e=>e.capabilities.externalAgentControl===`available`);return(0,q.jsx)(`section`,{"data-testid":`agent-control-mcp-installations`,className:`border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto grid w-full max-w-4xl gap-8`,children:[(0,q.jsxs)(`section`,{className:`grid gap-4`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(T,{className:`size-3.5`}),`Ryco sessions`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Automatic inside Ryco`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Supported sessions started by Ryco receive Agent Control automatically. There is nothing to install in those provider profiles.`})]}),m?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border p-4 text-sm text-muted-foreground`,children:[(0,q.jsx)(D,{className:`size-4 animate-spin`}),` Loading providers…`]}):r.length===0?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`No configured provider instances were found.`}):(0,q.jsx)(`div`,{className:`divide-y overflow-hidden rounded-xl border bg-card`,children:r.map(e=>{let t=R(e.driver)?.icon??T,n=e.enabled&&e.capabilities.automaticAgentControl===`available`;return(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-4 py-3`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(t,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-sm font-medium`,children:Ce(e)}),(0,q.jsx)(`p`,{className:`mt-0.5 font-mono text-[11px] text-muted-foreground`,children:e.instanceId}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:n?`Available in every new Ryco-managed session.`:e.enabled?`This provider does not expose automatic Agent Control yet.`:`This provider instance is disabled.`})]})]}),(0,q.jsx)(w,{variant:n?`success`:`outline`,children:n?`Automatic`:e.enabled?`Unavailable`:`Disabled`})]},e.instanceId)})})]}),(0,q.jsxs)(`section`,{className:`grid gap-4`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(V,{className:`size-3.5`}),`External agents`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Connect an installed provider`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Ryco detects local provider profiles and writes their native MCP configuration. The default grants project listing and task request/read access, limited to 60 requests per minute and one active task. Every task still requires approval.`})]}),(0,q.jsx)(x,{size:`icon`,variant:`outline`,"aria-label":`Refresh Agent Control providers`,disabled:m,onClick:()=>void M(),children:(0,q.jsx)(A,{})})]}),d&&!d.available?(0,q.jsxs)(`div`,{className:`flex gap-3 rounded-xl border border-warning/30 bg-warning/8 p-4 text-sm`,children:[(0,q.jsx)(b,{className:`mt-0.5 size-4 shrink-0 text-warning-foreground`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`font-medium`,children:`Local installation is unavailable`}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:d.reason??`Ryco could not prove a direct loopback-only topology.`})]})]}):null,!m&&(!k||!j)?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`This Ryco environment does not expose provider MCP installation yet.`}):!m&&z.length===0?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`No installable provider profiles were detected. Configure a supported provider instance first, then refresh.`}):(0,q.jsx)(`div`,{className:`grid gap-3`,children:z.map(e=>{let t=Ee(c.installations,e.id),n=De(t),r=t?.state===`connected`,i=t?.state===`repair-needed`,a=g===e.id,o=y===e.id,s=R(e.driver)?.icon??V;return(0,q.jsxs)(`article`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(s,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold`,children:Q(e)}),(0,q.jsx)(w,{variant:n.variant,children:n.label})]}),(0,q.jsx)(`p`,{className:`mt-1 truncate font-mono text-[11px] text-muted-foreground`,children:e.displayPath}),(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.providerInstances.length,` configured provider`,e.providerInstances.length===1?` instance`:` instances`,t?` · MCP name ${t.serverName}`:``]})]})]}),(0,q.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2 sm:justify-end`,children:i&&t?(0,q.jsxs)(x,{size:`sm`,disabled:a||d?.available===!1,onClick:()=>void I(e,t),children:[a?(0,q.jsx)(D,{className:`animate-spin`}):(0,q.jsx)(P,{}),`Repair`]}):r&&t?(0,q.jsxs)(x,{size:`sm`,variant:`outline`,disabled:a,onClick:()=>void L(e,t),children:[a?(0,q.jsx)(D,{className:`animate-spin`}):(0,q.jsx)(N,{}),`Disconnect`]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(x,{size:`sm`,variant:`outline`,disabled:a||d?.available===!1,onClick:()=>{o?S(null):(E(Te(e)),S(e.id))},children:o?`Close`:`Customize`}),(0,q.jsxs)(x,{size:`sm`,disabled:a||d?.available===!1,onClick:()=>void F(e,!1),children:[a?(0,q.jsx)(D,{className:`animate-spin`}):(0,q.jsx)(p,{}),`Connect`]})]})})]}),t?.lastError?(0,q.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-3 text-xs text-destructive`,children:t.lastError}):null,t?.preservedUserChanges?(0,q.jsx)(`div`,{className:`rounded-lg border border-warning/30 bg-warning/8 p-3 text-xs text-warning-foreground`,children:`Ryco left this provider's MCP entry untouched because it had been edited after installation.`}):null,o?(0,q.jsxs)(`div`,{className:`grid gap-4 border-t pt-4`,children:[(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Customize the credential scope and limits before Ryco installs it. The provider profile is fixed to this detected workspace.`}),(0,q.jsx)(ve,{form:C,onChange:E,clientLocked:!0}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsxs)(x,{disabled:a||d?.available===!1,onClick:()=>void F(e,!0),children:[a?(0,q.jsx)(D,{className:`animate-spin`}):(0,q.jsx)(V,{}),`Connect with these permissions`]})})]}):null]},e.id)})})]})]})})}var Ae=(0,G.lazy)(()=>n(()=>import(`./ComputerUseSettings-BJs7jqR0.js`).then(e=>({default:e.ComputerUseSettings})),__vite__mapDeps([0])));function je(){let e=(0,K.c)(15),t=v(),n=_(),a;e[0]===n?.primary?a=e[1]:(a=r&&!i()&&n?.primary===!0,e[0]=n?.primary,e[1]=a);let o=a,s=!!window.desktopBridge?.computerUse&&(t!==`node`||o),c;e[2]===t?c=e[3]:(c=t!==`client`&&(0,q.jsx)(Me,{}),e[2]=t,e[3]=c);let l;e[4]!==o||e[5]!==t||e[6]!==n?(l=t===`node`&&n&&!o&&(0,q.jsxs)(`section`,{className:`border-b p-6 sm:p-8`,"data-settings-section":`Device permissions`,children:[(0,q.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Device permissions`}),(0,q.jsxs)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:[`To enable screen recording, accessibility, or computer use on `,n.nodeLabel,`, open Ryco on `,n.nodeLabel,` and use Settings → Integrations. Operating system permissions must be approved on that device.`]})]}),e[4]=o,e[5]=t,e[6]=n,e[7]=l):l=e[7];let u;e[8]!==s||e[9]!==t?(u=s&&(0,q.jsx)(`div`,{"data-settings-section":t===`node`?`Device permissions`:void 0,children:(0,q.jsx)(G.Suspense,{fallback:(0,q.jsx)(`p`,{className:`p-6`,children:`Loading device integrations…`}),children:(0,q.jsx)(Ae,{})})}),e[8]=s,e[9]=t,e[10]=u):u=e[10];let d;return e[11]!==c||e[12]!==l||e[13]!==u?(d=(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[c,l,u]}),e[11]=c,e[12]=l,e[13]=u,e[14]=d):d=e[14],d}function Me(){let e=(0,K.c)(25),t=m(Ne),{updateSettings:n}=y(),r=L(c.serverUpdateSettings),i,a,o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,q.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Private Agent Control`}),a=(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Private tools for every agent`}),o=(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Ryco sessions receive the tools automatically. Connect supported standalone provider profiles with one click. Every requested change still waits for explicit approval.`}),e[0]=i,e[1]=a,e[2]=o):(i=e[0],a=e[1],o=e[2]);let s=t?`Enabled. New Ryco-managed sessions receive Agent Control without changing the provider's global MCP configuration.`:`Disabled. Agent Control is unavailable to Ryco sessions and external clients.`,l;e[3]===s?l=e[4]:(l=(0,q.jsx)(`p`,{className:`mt-2 max-w-2xl text-xs leading-relaxed text-muted-foreground`,children:s}),e[3]=s,e[4]=l);let u;e[5]!==r.allowed||e[6]!==r.reason?(u=!r.allowed&&r.reason?(0,q.jsx)(`p`,{className:`mt-2 max-w-2xl text-xs leading-relaxed text-destructive`,children:r.reason}):null,e[5]=r.allowed,e[6]=r.reason,e[7]=u):u=e[7];let d;e[8]!==l||e[9]!==u?(d=(0,q.jsxs)(`div`,{children:[i,a,o,l,u]}),e[8]=l,e[9]=u,e[10]=d):d=e[10];let f=!r.allowed,p;e[11]===n?p=e[12]:(p=e=>n({agentControl:{enabled:!!e}}),e[11]=n,e[12]=p);let h;e[13]!==t||e[14]!==f||e[15]!==p?(h=(0,q.jsx)(S,{checked:t,disabled:f,onCheckedChange:p,"aria-label":`Enable Agent Control`}),e[13]=t,e[14]=f,e[15]=p,e[16]=h):h=e[16];let g;e[17]!==d||e[18]!==h?(g=(0,q.jsx)(`section`,{"data-settings-section":`Private Agent Control`,className:`scroll-mt-6 border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[d,h]})}),e[17]=d,e[18]=h,e[19]=g):g=e[19];let _;e[20]===t?_=e[21]:(_=t?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ke,{}),(0,q.jsxs)(`details`,{className:`group border-b bg-muted/5`,children:[(0,q.jsxs)(`summary`,{className:`mx-auto flex w-full max-w-4xl cursor-pointer list-none items-center gap-3 px-6 py-5 sm:px-8 [&::-webkit-details-marker]:hidden`,children:[(0,q.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(k,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block text-sm font-semibold`,children:`Advanced manual setup`}),(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Create a revocable pairing for another MCP client or a profile Ryco cannot detect.`})]}),(0,q.jsx)(O,{className:`size-4 text-muted-foreground transition-transform group-open:rotate-90`})]}),(0,q.jsx)(be,{})]})]}):null,e[20]=t,e[21]=_);let v;return e[22]!==g||e[23]!==_?(v=(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[g,_]}),e[22]=g,e[23]=_,e[24]=v):v=e[24],v}function Ne(e){return e.agentControl.enabled}export{je as IntegrationsSettingsPanel};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/main-BNPtp9Z0.css"])))=>i.map(i=>d[i]);
2
+ import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./index-7MTgf8YI.js";import{G as r,K as i,a}from"./primary-CNUdEGcv.js";import{l as o,si as s,t as c}from"./src-DPpEXU6w.js";import{$n as l,Ar as u,Br as d,Na as f,Pa as p,Pr as m,Ta as h,_l as g,gl as _,ka as v,kr as y,ta as b,vl as x}from"./runtime-BKneT96Q.js";import{t as S}from"./switch-LahPAvrd.js";import{t as C}from"./compiler-runtime-qmuS0Svy.js";import{t as w}from"./badge-BjvTY7-E.js";import{t as T}from"./bot-SC4UGZyw.js";import{K as E,Y as D}from"./ContextHandoffEndpointLabel-CsF_maM_.js";import{t as O}from"./chevron-right-DgB53U1_.js";import{t as k}from"./key-round-C-oUSjpF.js";import{t as A}from"./refresh-cw-CY5BeUEr.js";import{t as j}from"./save-DIHMjHXd.js";import{t as M}from"./shield-check-DyNf6Bky.js";import{t as N}from"./unplug-Bjpxv8i0.js";import{t as P}from"./wrench-36WYdK_a.js";import{t as F}from"./toastHelpers-CSQRKo4F.js";import{t as I}from"./input-CfVJycb1.js";import{t as L}from"./capabilities-BCkDNe83.js";import"./providerModels-5uOq3qPC.js";import{r as R}from"./providerDriverMeta-Cg_XLUfo.js";import{Bt as z}from"./main-CGeD6yVE.js";var B={name:`cable`,size:24,node:[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]};B.node;var V=p(B),H={name:`clipboard`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]};H.node;var U=p(H),ee={name:`link-2-off`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]};ee.node;var te=p(ee),ne=()=>({integrations:[],topology:{available:!1,reason:`Not loaded.`},pairingCodes:{}}),re=(e,t)=>({integrations:t.integrations,topology:t.topology,pairingCodes:{}}),ie=(e,t)=>({...e,integrations:[...e.integrations.filter(e=>e.integration.integrationId!==t.detail.integration.integrationId),t.detail],pairingCodes:{...e.pairingCodes,[t.detail.integration.integrationId]:t.pairingCode}}),ae=(e,t)=>{let n={...e.pairingCodes};return delete n[t],{...e,integrations:e.integrations.filter(e=>e.integration.integrationId!==t),pairingCodes:n}},oe=()=>({installations:[]}),se=e=>[...e].toSorted((e,t)=>e.driver.localeCompare(t.driver)||e.createdAt.localeCompare(t.createdAt)||e.installationId.localeCompare(t.installationId)),ce=(e,t)=>({installations:se(t.installations)}),W=(e,t)=>{let n=e.installations.find(e=>e.installationId===t.installation.installationId);return n&&n.revision>t.installation.revision?e:{installations:se([...e.installations.filter(e=>e.installationId!==t.installation.installationId),t.installation])}},G=e(t(),1),K=C(),le=[50,100,200,400],ue=e=>e instanceof Error&&e.message.trim()===`Agent Control is disabled.`,de=e=>new Promise(t=>window.setTimeout(t,e));async function fe(e,t=de){for(let n of le)try{return await e()}catch(e){if(!ue(e))throw e;await t(n)}return e()}var q=x(),pe={codex:`Codex`,"claude-code":`Claude Code`,"claude-desktop":`Claude Desktop`,"generic-mcp":`Generic MCP`},me=[{capability:o.externalListProjects,label:`List allowed projects`,description:`Discover only projects inside this integration's scope.`},{capability:o.externalCreateTask,label:`Request tasks`,description:`Submit one task to Ryco's normal approval queue.`},{capability:o.externalReadTask,label:`Read own tasks`,description:`Read or wait only for tasks created by this integration.`},{capability:o.externalReadAutomations,label:`Read automations`,description:`Read bounded schedules and run outcomes inside the selected project scope.`},{capability:o.externalManageAutomations,label:`Request automations`,description:`Propose schedule changes; each due run still requires separate approval.`},{capability:o.externalReadActivity,label:`Read activity`,description:`Read bounded payload-free project and provider event summaries.`},{capability:o.externalReadDiagnostics,label:`Read diagnostics`,description:`Read redacted count-only health summaries for allowed projects.`},{capability:o.externalSharedCheckout,label:`Request shared checkout`,description:`May request the local checkout; each request still needs approval.`},{capability:o.externalFullAccess,label:`Request full access`,description:`May request a full-access runtime; each request still needs approval.`}],J=()=>({displayName:``,clientKind:`codex`,scopeKind:`all`,projectIds:``,capabilities:[o.externalListProjects,o.externalCreateTask,o.externalReadTask],expiresAt:``,rateLimitPerMinute:`60`,activeTaskLimit:`1`});function Y(e,t){m.add(F({type:`error`,title:e,description:t instanceof Error?t.message:`The request failed.`}))}function he(e,t){return[e,...t.map(e=>JSON.stringify(e))].join(` `)}function X(e){return e===null?`Never`:new Date(e).toLocaleString()}function ge(e){let t=e.integration;return t.revokedAt===null?t.expiresAt!==null&&Date.parse(t.expiresAt)<=Date.now()?{label:`Expired`,variant:`error`}:t.pairingState===`paired`?{label:`Paired`,variant:`success`}:t.pairingState===`pending`?{label:`Pairing`,variant:`warning`}:{label:`Unpaired`,variant:`outline`}:{label:`Revoked`,variant:`error`}}function _e(e){let t=e.integration;return{displayName:t.displayName,clientKind:t.clientKind,scopeKind:t.projectScope.kind,projectIds:t.projectScope.kind===`selected`?t.projectScope.projectIds.join(`, `):``,capabilities:t.capabilities,expiresAt:t.expiresAt===null?``:new Date(t.expiresAt).toISOString().slice(0,16),rateLimitPerMinute:String(t.rateLimitPerMinute),activeTaskLimit:String(t.activeTaskLimit)}}function Z(e){let t=e.projectIds.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>s.make(e)),n=e.scopeKind===`all`?{kind:`all`}:{kind:`selected`,projectIds:t},r=Number(e.rateLimitPerMinute),i=Number(e.activeTaskLimit);if(!e.displayName.trim())throw Error(`A display name is required.`);if(e.scopeKind===`selected`&&t.length===0)throw Error(`Enter at least one project ID for selected-project scope.`);if(!Number.isInteger(r)||r<1)throw Error(`Rate limit must be a positive whole number.`);if(!Number.isInteger(i)||i<1)throw Error(`Active-task limit must be a positive whole number.`);return{displayName:e.displayName.trim(),clientKind:e.clientKind,projectScope:n,capabilities:e.capabilities,expiresAt:e.expiresAt?new Date(e.expiresAt).toISOString():null,rateLimitPerMinute:r,activeTaskLimit:i}}function ve(e){let t=(0,K.c)(85),{form:n,onChange:r,clientLocked:i}=e,a=i!==void 0&&i,o;t[0]!==n||t[1]!==r?(o=e=>r({...n,displayName:e.target.value}),t[0]=n,t[1]=r,t[2]=o):o=t[2];let s;t[3]!==n.displayName||t[4]!==o?(s=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Display name`,(0,q.jsx)(I,{value:n.displayName,placeholder:`Local Codex`,onChange:o})]}),t[3]=n.displayName,t[4]=o,t[5]=s):s=t[5];let c=n.clientKind,l;t[6]!==n||t[7]!==r?(l=e=>r({...n,clientKind:e.target.value}),t[6]=n,t[7]=r,t[8]=l):l=t[8];let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.entries(pe).map(ye),t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==n.clientKind||t[12]!==l?(d=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Client`,(0,q.jsx)(`select`,{className:`h-9 rounded-lg border border-input bg-background px-3 text-sm`,value:c,disabled:a,onChange:l,children:u})]}),t[10]=a,t[11]=n.clientKind,t[12]=l,t[13]=d):d=t[13];let f;t[14]!==s||t[15]!==d?(f=(0,q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[s,d]}),t[14]=s,t[15]=d,t[16]=f):f=t[16];let p;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,q.jsx)(`legend`,{className:`text-xs font-medium`,children:`Project scope`}),t[17]=p):p=t[17];let m=n.scopeKind===`all`,h;t[18]!==n||t[19]!==r?(h=()=>r({...n,scopeKind:`all`}),t[18]=n,t[19]=r,t[20]=h):h=t[20];let g;t[21]!==m||t[22]!==h?(g=(0,q.jsx)(`input`,{type:`radio`,checked:m,onChange:h}),t[21]=m,t[22]=h,t[23]=g):g=t[23];let _;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,q.jsxs)(`span`,{children:[`All current and future projects`,(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`The client can discover every project on this local Ryco instance.`})]}),t[24]=_):_=t[24];let v;t[25]===g?v=t[26]:(v=(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[g,_]}),t[25]=g,t[26]=v);let y=n.scopeKind===`selected`,b;t[27]!==n||t[28]!==r?(b=()=>r({...n,scopeKind:`selected`}),t[27]=n,t[28]=r,t[29]=b):b=t[29];let x;t[30]!==y||t[31]!==b?(x=(0,q.jsx)(`input`,{type:`radio`,checked:y,onChange:b}),t[30]=y,t[31]=b,t[32]=x):x=t[32];let S=n.scopeKind!==`selected`,C;t[33]!==n||t[34]!==r?(C=e=>r({...n,projectIds:e.target.value}),t[33]=n,t[34]=r,t[35]=C):C=t[35];let w;t[36]!==n.projectIds||t[37]!==S||t[38]!==C?(w=(0,q.jsx)(I,{className:`mt-1.5`,value:n.projectIds,disabled:S,placeholder:`project-id-1, project-id-2`,"aria-label":`Selected project IDs`,onChange:C}),t[36]=n.projectIds,t[37]=S,t[38]=C,t[39]=w):w=t[39];let T;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:`Comma-separated stable project IDs. Unknown IDs remain inaccessible.`}),t[40]=T):T=t[40];let E;t[41]===w?E=t[42]:(E=(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Selected projects`,w,T]}),t[41]=w,t[42]=E);let D;t[43]!==x||t[44]!==E?(D=(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[x,E]}),t[43]=x,t[44]=E,t[45]=D):D=t[45];let O;t[46]!==v||t[47]!==D?(O=(0,q.jsxs)(`fieldset`,{className:`grid gap-2`,children:[p,v,D]}),t[46]=v,t[47]=D,t[48]=O):O=t[48];let k;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,q.jsx)(`legend`,{className:`text-xs font-medium`,children:`Capability grants`}),t[49]=k):k=t[49];let A;t[50]!==n||t[51]!==r?(A=me.map(e=>(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:n.capabilities.includes(e.capability),onChange:t=>r({...n,capabilities:t.target.checked?[...n.capabilities,e.capability]:n.capabilities.filter(t=>t!==e.capability)})}),(0,q.jsxs)(`span`,{children:[e.label,(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description})]})]},e.capability)),t[50]=n,t[51]=r,t[52]=A):A=t[52];let j;t[53]===A?j=t[54]:(j=(0,q.jsxs)(`fieldset`,{className:`grid gap-2`,children:[k,A]}),t[53]=A,t[54]=j);let M;t[55]!==n||t[56]!==r?(M=e=>r({...n,expiresAt:e.target.value}),t[55]=n,t[56]=r,t[57]=M):M=t[57];let N;t[58]!==n.expiresAt||t[59]!==M?(N=(0,q.jsx)(I,{type:`datetime-local`,value:n.expiresAt,onChange:M}),t[58]=n.expiresAt,t[59]=M,t[60]=N):N=t[60];let P;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,q.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`Empty means no expiry.`}),t[61]=P):P=t[61];let F;t[62]===N?F=t[63]:(F=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Expires`,N,P]}),t[62]=N,t[63]=F);let L;t[64]!==n||t[65]!==r?(L=e=>r({...n,rateLimitPerMinute:e.target.value}),t[64]=n,t[65]=r,t[66]=L):L=t[66];let R;t[67]!==n.rateLimitPerMinute||t[68]!==L?(R=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Requests per minute`,(0,q.jsx)(I,{type:`number`,min:1,max:600,value:n.rateLimitPerMinute,onChange:L})]}),t[67]=n.rateLimitPerMinute,t[68]=L,t[69]=R):R=t[69];let z;t[70]!==n||t[71]!==r?(z=e=>r({...n,activeTaskLimit:e.target.value}),t[70]=n,t[71]=r,t[72]=z):z=t[72];let B;t[73]!==n.activeTaskLimit||t[74]!==z?(B=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Concurrent active tasks`,(0,q.jsx)(I,{type:`number`,min:1,max:32,value:n.activeTaskLimit,onChange:z})]}),t[73]=n.activeTaskLimit,t[74]=z,t[75]=B):B=t[75];let V;t[76]!==F||t[77]!==R||t[78]!==B?(V=(0,q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[F,R,B]}),t[76]=F,t[77]=R,t[78]=B,t[79]=V):V=t[79];let H;return t[80]!==O||t[81]!==j||t[82]!==V||t[83]!==f?(H=(0,q.jsxs)(`div`,{className:`grid gap-4`,children:[f,O,j,V]}),t[80]=O,t[81]=j,t[82]=V,t[83]=f,t[84]=H):H=t[84],H}function ye(e){let[t,n]=e;return(0,q.jsx)(`option`,{value:t,children:n},t)}function be(){let e=g(),t=a(),n=e?.environmentId??t,[r,i]=(0,G.useState)(ne),[o,s]=(0,G.useState)(J),[c,u]=(0,G.useState)(!1),[p,m]=(0,G.useState)(null),[h,_]=(0,G.useState)(null),[v,y]=(0,G.useState)(null),b=(0,G.useMemo)(()=>n===null?void 0:l(n)?.agentControl,[n]),x=(0,G.useCallback)(async()=>{if(b)try{let e=await fe(()=>b.listIntegrations());i(t=>re(t,e))}catch(e){Y(`Failed to load external integrations`,e)}},[b]);(0,G.useEffect)(()=>{x()},[x]);let S=(0,G.useCallback)(async(e,t)=>{await navigator.clipboard.writeText(t),y(e),window.setTimeout(()=>y(t=>t===e?null:t),1500)},[]),C=async()=>{if(b)try{_(`new`);let e=await b.createIntegration(Z(o));i(t=>ie(t,e)),s(J()),u(!1)}catch(e){Y(`Failed to create integration`,e)}finally{_(null)}},T=async e=>{if(b)try{_(e.integration.integrationId);let t=Z(o);await b.updateIntegration({integrationId:e.integration.integrationId,...t}),m(null),await x()}catch(e){Y(`Failed to update integration`,e)}finally{_(null)}},D=async e=>{if(!b)return;let t=e.integration.integrationId;try{_(t);let e=await b.resumeIntegrationPairing({integrationId:t});i(t=>ie(t,e))}catch(e){Y(`Failed to resume pairing`,e)}finally{_(null)}},O=async e=>{if(!b)return;let t=e.integration.integrationId;try{_(t),await b.revokeIntegration({integrationId:t}),await x()}catch(e){Y(`Failed to revoke integration`,e)}finally{_(null)}},N=async e=>{if(!b)return;let t=e.integration.integrationId;if(window.confirm(`Delete ${e.integration.displayName}? This cannot be undone.`))try{_(t),(await b.deleteIntegration({integrationId:t})).deleted&&i(e=>ae(e,t))}catch(e){Y(`Failed to delete integration`,e)}finally{_(null)}};return(0,q.jsx)(`section`,{"data-testid":`external-integrations`,className:`border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto grid w-full max-w-4xl gap-5`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(M,{className:`size-3.5`}),`Agent Control`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`External integrations`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Pair a local MCP client with a revocable identity. Every task request waits in Ryco for explicit user approval before a thread is created.`})]}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(d,{size:`icon`,variant:`outline`,"aria-label":`Refresh integrations`,onClick:()=>void x(),children:(0,q.jsx)(A,{})}),(0,q.jsxs)(d,{disabled:!b||!r.topology.available,onClick:()=>{m(null),s(J()),u(e=>!e)},children:[(0,q.jsx)(z,{}),`New integration`]})]})]}),r.topology.available?null:(0,q.jsxs)(`div`,{className:`flex gap-3 rounded-xl border border-warning/30 bg-warning/8 p-4 text-sm`,children:[(0,q.jsx)(te,{className:`mt-0.5 size-4 shrink-0 text-warning-foreground`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`font-medium`,children:`Local pairing is unavailable`}),(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[r.topology.reason??`Ryco could not prove a direct loopback-only topology.`,` `,`External setup fails closed while Ryco is remotely exposed or Hub-connected.`]})]})]}),c?(0,q.jsxs)(`div`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsx)(ve,{form:o,onChange:s}),(0,q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,q.jsx)(d,{variant:`ghost`,onClick:()=>u(!1),children:`Cancel`}),(0,q.jsxs)(d,{disabled:h===`new`,onClick:()=>void C(),children:[(0,q.jsx)(k,{}),`Create and pair`]})]})]}):null,r.integrations.length===0&&!c?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-6 text-center text-sm text-muted-foreground`,children:`No external integrations are configured.`}):null,r.integrations.map(e=>{let t=e.integration,n=ge(e),i=r.pairingCodes[t.integrationId],a=he(e.setup.pairCommand.command,e.setup.pairCommand.args),c=p===t.integrationId;return(0,q.jsxs)(`article`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h3`,{className:`font-semibold`,children:t.displayName}),(0,q.jsx)(w,{variant:n.variant,children:n.label}),(0,q.jsx)(w,{variant:`outline`,children:pe[t.clientKind]})]}),(0,q.jsx)(`p`,{className:`mt-1 font-mono text-[11px] text-muted-foreground`,children:t.integrationId})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(d,{size:`sm`,variant:`outline`,onClick:()=>{m(c?null:t.integrationId),s(_e(e))},children:c?`Close editor`:`Edit`}),(0,q.jsxs)(d,{size:`sm`,variant:`outline`,disabled:!r.topology.available||h===t.integrationId||t.revokedAt!==null,onClick:()=>void D(e),children:[(0,q.jsx)(k,{}),`Pair again`]}),(0,q.jsx)(d,{size:`sm`,variant:`outline`,disabled:h===t.integrationId||t.revokedAt!==null,onClick:()=>void O(e),children:`Revoke`}),(0,q.jsx)(d,{size:`icon-sm`,variant:`ghost`,"aria-label":`Delete ${t.displayName}`,disabled:h===t.integrationId,onClick:()=>void N(e),children:(0,q.jsx)(E,{})})]})]}),c?(0,q.jsxs)(`div`,{className:`grid gap-4 border-t pt-4`,children:[(0,q.jsx)(ve,{form:o,onChange:s}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsxs)(d,{disabled:h===t.integrationId,onClick:()=>void T(e),children:[(0,q.jsx)(j,{}),`Save changes`]})})]}):(0,q.jsxs)(`div`,{className:`grid gap-3 text-xs sm:grid-cols-2`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Project scope`}),(0,q.jsx)(`p`,{className:`mt-0.5 break-words font-medium`,children:t.projectScope.kind===`all`?`All current and future projects`:t.projectScope.projectIds.join(`, `)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Limits`}),(0,q.jsxs)(`p`,{className:`mt-0.5 font-medium`,children:[t.rateLimitPerMinute,`/minute · `,t.activeTaskCount,`/`,t.activeTaskLimit,` active`]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Expiry`}),(0,q.jsx)(`p`,{className:`mt-0.5 font-medium`,children:X(t.expiresAt)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Last used`}),(0,q.jsx)(`p`,{className:`mt-0.5 font-medium`,children:X(t.lastUsedAt)})]}),(0,q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Capabilities`}),(0,q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:t.capabilities.map(e=>(0,q.jsx)(w,{variant:`outline`,children:e},e))})]})]}),t.pairingState===`pending`?(0,q.jsxs)(`div`,{className:`grid gap-3 rounded-lg border bg-muted/20 p-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`text-sm font-medium`,children:`Finish pairing locally`}),(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Pairing code expires `,X(t.pairingCodeExpiresAt),`. The code is shown only for this ceremony; the generated MCP configuration never contains it.`]})]}),i?(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`code`,{"data-testid":`external-pairing-code`,className:`rounded bg-background px-3 py-2 font-mono text-sm tracking-[0.18em]`,children:i}),(0,q.jsxs)(d,{size:`sm`,variant:`outline`,onClick:()=>void S(`code-${t.integrationId}`,i),children:[v===`code-${t.integrationId}`?(0,q.jsx)(f,{}):(0,q.jsx)(U,{}),`Copy code`]})]}):(0,q.jsx)(`p`,{className:`text-xs text-warning-foreground`,children:`The pairing code is no longer displayed. Choose Pair again to generate a new one.`}),(0,q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium`,children:`Run this bridge command, then enter the code`}),(0,q.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,q.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded bg-background p-2 text-[11px]`,children:a}),(0,q.jsx)(d,{size:`icon-sm`,variant:`outline`,"aria-label":`Copy pairing command`,onClick:()=>void S(`pair-${t.integrationId}`,a),children:v===`pair-${t.integrationId}`?(0,q.jsx)(f,{}):(0,q.jsx)(U,{})})]})]}),(0,q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium`,children:`MCP configuration`}),(0,q.jsx)(`pre`,{"data-testid":`external-mcp-configuration`,className:`max-h-48 overflow-auto rounded bg-background p-3 text-[11px] leading-relaxed`,children:e.setup.configuration}),(0,q.jsxs)(d,{className:`justify-self-start`,size:`sm`,variant:`outline`,onClick:()=>void S(`config-${t.integrationId}`,e.setup.configuration),children:[v===`config-${t.integrationId}`?(0,q.jsx)(f,{}):(0,q.jsx)(U,{}),`Copy configuration`]})]})]}):null]},t.integrationId)})]})})}var xe=[],Se=[];function Ce(e){return e.displayName??R(e.driver)?.label??b(e.driver)}function Q(e){return e.providerDisplayName??R(e.driver)?.label??b(e.driver)}function we(e){return e.driver===`codex`?`codex`:e.driver===`claudeAgent`?`claude-code`:`generic-mcp`}function Te(e){return{...J(),displayName:`${Q(e)} Agent Control`,clientKind:we(e)}}function Ee(e,t){return e.filter(e=>e.workspaceId===t).toSorted((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0]}function De(e){if(!e)return{label:`Not connected`,variant:`outline`};switch(e.state){case`connected`:return{label:`Connected`,variant:`success`};case`repair-needed`:return{label:`Needs repair`,variant:`error`};case`disconnected`:case`revoked`:return{label:`Disconnected`,variant:`outline`};case`disconnecting`:return{label:`Disconnecting`,variant:`warning`};case`planned`:case`credential-written`:case`provider-written`:case`verifying`:return{label:`Connecting`,variant:`warning`}}}function Oe(e,t){m.add(F({type:`success`,title:e,description:t}))}function $(e,t){m.add(F({type:`error`,title:e,description:t instanceof Error?t.message:`The request failed.`}))}function ke(){let e=g(),t=a(),n=e?.environmentId??t,[r,i]=(0,G.useState)(xe),[o,s]=(0,G.useState)(Se),[c,u]=(0,G.useState)(oe),[f,p]=(0,G.useState)(null),[m,_]=(0,G.useState)(!0),[y,b]=(0,G.useState)(null),[x,S]=(0,G.useState)(null),[C,E]=(0,G.useState)(J),O=(0,G.useMemo)(()=>n===null?void 0:l(n),[n]),k=O?.agentControl,j=O?.mcp,M=(0,G.useCallback)(async()=>{if(!k||!j){_(!1);return}try{let[e,t,n]=await fe(()=>Promise.all([j.listWorkspaces(),k.listMcpInstallations(),k.listIntegrations()]));i(e.providers),s(e.workspaces),u(e=>ce(e,t)),p(n.topology)}catch(e){$(`Failed to load Agent Control providers`,e)}finally{_(!1)}},[k,j]);(0,G.useEffect)(()=>{M()},[M]);let F=async(e,t)=>{if(k)try{b(e.id);let n=t?(()=>{let{clientKind:t,...n}=Z(C);return{workspaceId:e.id,...n}})():{workspaceId:e.id},r=await k.connectMcpInstallation(n);u(e=>W(e,r)),S(null),Oe(`${Q(e)} connected`,`The credential was stored locally and was not shown to the browser.`)}catch(t){$(`Failed to connect ${Q(e)}`,t),await M()}finally{b(null)}},I=async(e,t)=>{if(k)try{b(e.id);let n=await k.repairMcpInstallation({installationId:t.installationId});u(e=>W(e,n)),Oe(`${Q(e)} repaired`)}catch(t){$(`Failed to repair ${Q(e)}`,t),await M()}finally{b(null)}},L=async(e,t)=>{if(k&&window.confirm(`Disconnect Agent Control from ${Q(e)}?`))try{b(e.id);let n=await k.disconnectMcpInstallation({installationId:t.installationId});u(e=>W(e,n)),Oe(`${Q(e)} disconnected`)}catch(t){$(`Failed to disconnect ${Q(e)}`,t),await M()}finally{b(null)}},z=o.filter(e=>e.capabilities.externalAgentControl===`available`);return(0,q.jsx)(`section`,{"data-testid":`agent-control-mcp-installations`,className:`border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto grid w-full max-w-4xl gap-8`,children:[(0,q.jsxs)(`section`,{className:`grid gap-4`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(T,{className:`size-3.5`}),`Ryco sessions`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Automatic inside Ryco`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Supported sessions started by Ryco receive Agent Control automatically. There is nothing to install in those provider profiles.`})]}),m?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border p-4 text-sm text-muted-foreground`,children:[(0,q.jsx)(D,{className:`size-4 animate-spin`}),` Loading providers…`]}):r.length===0?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`No configured provider instances were found.`}):(0,q.jsx)(`div`,{className:`divide-y overflow-hidden rounded-xl border bg-card`,children:r.map(e=>{let t=R(e.driver)?.icon??T,n=e.enabled&&e.capabilities.automaticAgentControl===`available`;return(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-4 py-3`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(t,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-sm font-medium`,children:Ce(e)}),(0,q.jsx)(`p`,{className:`mt-0.5 font-mono text-[11px] text-muted-foreground`,children:e.instanceId}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:n?`Available in every new Ryco-managed session.`:e.enabled?`This provider does not expose automatic Agent Control yet.`:`This provider instance is disabled.`})]})]}),(0,q.jsx)(w,{variant:n?`success`:`outline`,children:n?`Automatic`:e.enabled?`Unavailable`:`Disabled`})]},e.instanceId)})})]}),(0,q.jsxs)(`section`,{className:`grid gap-4`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(V,{className:`size-3.5`}),`External agents`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Connect an installed provider`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Ryco detects local provider profiles and writes their native MCP configuration. The default grants project listing and task request/read access, limited to 60 requests per minute and one active task. Every task still requires approval.`})]}),(0,q.jsx)(d,{size:`icon`,variant:`outline`,"aria-label":`Refresh Agent Control providers`,disabled:m,onClick:()=>void M(),children:(0,q.jsx)(A,{})})]}),f&&!f.available?(0,q.jsxs)(`div`,{className:`flex gap-3 rounded-xl border border-warning/30 bg-warning/8 p-4 text-sm`,children:[(0,q.jsx)(h,{className:`mt-0.5 size-4 shrink-0 text-warning-foreground`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`font-medium`,children:`Local installation is unavailable`}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:f.reason??`Ryco could not prove a direct loopback-only topology.`})]})]}):null,!m&&(!k||!j)?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`This Ryco environment does not expose provider MCP installation yet.`}):!m&&z.length===0?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`No installable provider profiles were detected. Configure a supported provider instance first, then refresh.`}):(0,q.jsx)(`div`,{className:`grid gap-3`,children:z.map(e=>{let t=Ee(c.installations,e.id),n=De(t),r=t?.state===`connected`,i=t?.state===`repair-needed`,a=y===e.id,o=x===e.id,s=R(e.driver)?.icon??V;return(0,q.jsxs)(`article`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(s,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold`,children:Q(e)}),(0,q.jsx)(w,{variant:n.variant,children:n.label})]}),(0,q.jsx)(`p`,{className:`mt-1 truncate font-mono text-[11px] text-muted-foreground`,children:e.displayPath}),(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.providerInstances.length,` configured provider`,e.providerInstances.length===1?` instance`:` instances`,t?` · MCP name ${t.serverName}`:``]})]})]}),(0,q.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2 sm:justify-end`,children:i&&t?(0,q.jsxs)(d,{size:`sm`,disabled:a||f?.available===!1,onClick:()=>void I(e,t),children:[a?(0,q.jsx)(D,{className:`animate-spin`}):(0,q.jsx)(P,{}),`Repair`]}):r&&t?(0,q.jsxs)(d,{size:`sm`,variant:`outline`,disabled:a,onClick:()=>void L(e,t),children:[a?(0,q.jsx)(D,{className:`animate-spin`}):(0,q.jsx)(N,{}),`Disconnect`]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{size:`sm`,variant:`outline`,disabled:a||f?.available===!1,onClick:()=>{o?S(null):(E(Te(e)),S(e.id))},children:o?`Close`:`Customize`}),(0,q.jsxs)(d,{size:`sm`,disabled:a||f?.available===!1,onClick:()=>void F(e,!1),children:[a?(0,q.jsx)(D,{className:`animate-spin`}):(0,q.jsx)(v,{}),`Connect`]})]})})]}),t?.lastError?(0,q.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-3 text-xs text-destructive`,children:t.lastError}):null,t?.preservedUserChanges?(0,q.jsx)(`div`,{className:`rounded-lg border border-warning/30 bg-warning/8 p-3 text-xs text-warning-foreground`,children:`Ryco left this provider's MCP entry untouched because it had been edited after installation.`}):null,o?(0,q.jsxs)(`div`,{className:`grid gap-4 border-t pt-4`,children:[(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Customize the credential scope and limits before Ryco installs it. The provider profile is fixed to this detected workspace.`}),(0,q.jsx)(ve,{form:C,onChange:E,clientLocked:!0}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsxs)(d,{disabled:a||f?.available===!1,onClick:()=>void F(e,!0),children:[a?(0,q.jsx)(D,{className:`animate-spin`}):(0,q.jsx)(V,{}),`Connect with these permissions`]})})]}):null]},e.id)})})]})]})})}var Ae=(0,G.lazy)(()=>n(()=>import(`./ComputerUseSettings-DM17BYP5.js`).then(e=>({default:e.ComputerUseSettings})),__vite__mapDeps([0])));function je(){let e=(0,K.c)(15),t=_(),n=g(),a;e[0]===n?.primary?a=e[1]:(a=r&&!i()&&n?.primary===!0,e[0]=n?.primary,e[1]=a);let o=a,s=!!window.desktopBridge?.computerUse&&(t!==`node`||o),c;e[2]===t?c=e[3]:(c=t!==`client`&&(0,q.jsx)(Me,{}),e[2]=t,e[3]=c);let l;e[4]!==o||e[5]!==t||e[6]!==n?(l=t===`node`&&n&&!o&&(0,q.jsxs)(`section`,{className:`border-b p-6 sm:p-8`,"data-settings-section":`Device permissions`,children:[(0,q.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Device permissions`}),(0,q.jsxs)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:[`To enable screen recording, accessibility, or computer use on `,n.nodeLabel,`, open Ryco on `,n.nodeLabel,` and use Settings → Integrations. Operating system permissions must be approved on that device.`]})]}),e[4]=o,e[5]=t,e[6]=n,e[7]=l):l=e[7];let u;e[8]!==s||e[9]!==t?(u=s&&(0,q.jsx)(`div`,{"data-settings-section":t===`node`?`Device permissions`:void 0,children:(0,q.jsx)(G.Suspense,{fallback:(0,q.jsx)(`p`,{className:`p-6`,children:`Loading device integrations…`}),children:(0,q.jsx)(Ae,{})})}),e[8]=s,e[9]=t,e[10]=u):u=e[10];let d;return e[11]!==c||e[12]!==l||e[13]!==u?(d=(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[c,l,u]}),e[11]=c,e[12]=l,e[13]=u,e[14]=d):d=e[14],d}function Me(){let e=(0,K.c)(25),t=y(Ne),{updateSettings:n}=u(),r=L(c.serverUpdateSettings),i,a,o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,q.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Private Agent Control`}),a=(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Private tools for every agent`}),o=(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Ryco sessions receive the tools automatically. Connect supported standalone provider profiles with one click. Routine private-session actions run directly. Destructive and security-sensitive changes require approval.`}),e[0]=i,e[1]=a,e[2]=o):(i=e[0],a=e[1],o=e[2]);let s=t?`Enabled. New Ryco-managed sessions receive Agent Control without changing the provider's global MCP configuration.`:`Disabled. Agent Control is unavailable to Ryco sessions and external clients.`,l;e[3]===s?l=e[4]:(l=(0,q.jsx)(`p`,{className:`mt-2 max-w-2xl text-xs leading-relaxed text-muted-foreground`,children:s}),e[3]=s,e[4]=l);let d;e[5]!==r.allowed||e[6]!==r.reason?(d=!r.allowed&&r.reason?(0,q.jsx)(`p`,{className:`mt-2 max-w-2xl text-xs leading-relaxed text-destructive`,children:r.reason}):null,e[5]=r.allowed,e[6]=r.reason,e[7]=d):d=e[7];let f;e[8]!==l||e[9]!==d?(f=(0,q.jsxs)(`div`,{children:[i,a,o,l,d]}),e[8]=l,e[9]=d,e[10]=f):f=e[10];let p=!r.allowed,m;e[11]===n?m=e[12]:(m=e=>n({agentControl:{enabled:!!e}}),e[11]=n,e[12]=m);let h;e[13]!==t||e[14]!==p||e[15]!==m?(h=(0,q.jsx)(S,{checked:t,disabled:p,onCheckedChange:m,"aria-label":`Enable Agent Control`}),e[13]=t,e[14]=p,e[15]=m,e[16]=h):h=e[16];let g;e[17]!==f||e[18]!==h?(g=(0,q.jsx)(`section`,{"data-settings-section":`Private Agent Control`,className:`scroll-mt-6 border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[f,h]})}),e[17]=f,e[18]=h,e[19]=g):g=e[19];let _;e[20]===t?_=e[21]:(_=t?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ke,{}),(0,q.jsxs)(`details`,{className:`group border-b bg-muted/5`,children:[(0,q.jsxs)(`summary`,{className:`mx-auto flex w-full max-w-4xl cursor-pointer list-none items-center gap-3 px-6 py-5 sm:px-8 [&::-webkit-details-marker]:hidden`,children:[(0,q.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(k,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block text-sm font-semibold`,children:`Advanced manual setup`}),(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Create a revocable pairing for another MCP client or a profile Ryco cannot detect.`})]}),(0,q.jsx)(O,{className:`size-4 text-muted-foreground transition-transform group-open:rotate-90`})]}),(0,q.jsx)(be,{})]})]}):null,e[20]=t,e[21]=_);let v;return e[22]!==g||e[23]!==_?(v=(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[g,_]}),e[22]=g,e[23]=_,e[24]=v):v=e[24],v}function Ne(e){return e.agentControl.enabled}export{je as IntegrationsSettingsPanel};
@@ -1,4 +1,4 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{vt as n}from"./primary-CjhRI8fe.js";import{$n as r,Ca as i,Hr as a,Nn as o,Nr as s,Vr as c,_l as l,al as u,bn as d,cl as f,gl as p,il as m,or as h,wa as g,zr as _}from"./runtime-Bxg7k81u.js";import{$n as v,Dt as y,ht as b,vt as x,yt as S}from"./switch-CEJEmLe7.js";import{t as C}from"./compiler-runtime-qmuS0Svy.js";import{i as w,n as T,t as E}from"./tooltip-B7Z4qomY.js";import{d as D}from"./SettingsPanels-Bgf4vkrJ.js";import{a as O,r as k}from"./editorPreferences-Bg624RVT.js";import{t as A}from"./toastHelpers-CSQRKo4F.js";import{t as j}from"./input-C2xv8mMt.js";import{i as M,n as ee,r as N}from"./settingsLayout-CfKq88KD.js";import{Bt as P,Ft as F}from"./main-CzDOnLFw.js";var I=e(t(),1),L=C(),R={terminal:{id:`terminal`,label:`Terminal`,sortWeight:10},workspace:{id:`workspace`,label:`Workspace`,sortWeight:20},diff:{id:`diff`,label:`Diff`,sortWeight:30},commandPalette:{id:`commandPalette`,label:`Command palette`,sortWeight:40},sidebar:{id:`sidebar`,label:`Sidebar`,sortWeight:50},chat:{id:`chat`,label:`Chat`,sortWeight:60},composer:{id:`composer`,label:`Composer`,sortWeight:70},editor:{id:`editor`,label:`Editor`,sortWeight:80},modelPicker:{id:`modelPicker`,label:`Model picker`,sortWeight:90},thread:{id:`thread`,label:`Threads`,sortWeight:100},script:{id:`script`,label:`Project scripts`,sortWeight:110}},z={"terminal.toggle":{title:`Toggle terminal drawer`,sortWeight:1},"terminal.split":{title:`Split terminal`,sortWeight:2},"terminal.new":{title:`New terminal`,sortWeight:3},"terminal.close":{title:`Close terminal`,sortWeight:4},"workspace.files":{title:`Open workspace files`,sortWeight:1},"workspace.review":{title:`Open workspace review`,sortWeight:2},"workspace.terminal":{title:`Open workspace terminal`,sortWeight:3},"workspace.simulator":{title:`Open iOS Simulator workspace`,sortWeight:4},"diff.toggle":{title:`Toggle diff view`,sortWeight:1},"commandPalette.toggle":{title:`Open command palette`,sortWeight:1},"sidebar.showInbox":{title:`Show Inbox sidebar`,sortWeight:1},"sidebar.showProjects":{title:`Show Projects sidebar`,sortWeight:2},"chat.new":{title:`New chat`,sortWeight:1},"chat.newLocal":{title:`New chat (local environment)`,sortWeight:2},"composer.stash":{title:`Stash prompt or open stash`,sortWeight:1},"editor.openFavorite":{title:`Open in preferred editor`,sortWeight:1},"modelPicker.toggle":{title:`Toggle model picker`,sortWeight:1},"modelPicker.jump.1":{title:`Pick model 1`,sortWeight:2},"modelPicker.jump.2":{title:`Pick model 2`,sortWeight:3},"modelPicker.jump.3":{title:`Pick model 3`,sortWeight:4},"modelPicker.jump.4":{title:`Pick model 4`,sortWeight:5},"modelPicker.jump.5":{title:`Pick model 5`,sortWeight:6},"modelPicker.jump.6":{title:`Pick model 6`,sortWeight:7},"modelPicker.jump.7":{title:`Pick model 7`,sortWeight:8},"modelPicker.jump.8":{title:`Pick model 8`,sortWeight:9},"modelPicker.jump.9":{title:`Pick model 9`,sortWeight:10},"thread.find":{title:`Find in current thread`,sortWeight:1},"thread.pinToggle":{title:`Pin or unpin current thread`,sortWeight:2},"thread.previous":{title:`Previous thread`,sortWeight:3},"thread.next":{title:`Next thread`,sortWeight:4},"thread.jump.1":{title:`Jump to thread 1`,sortWeight:5},"thread.jump.2":{title:`Jump to thread 2`,sortWeight:6},"thread.jump.3":{title:`Jump to thread 3`,sortWeight:7},"thread.jump.4":{title:`Jump to thread 4`,sortWeight:8},"thread.jump.5":{title:`Jump to thread 5`,sortWeight:9},"thread.jump.6":{title:`Jump to thread 6`,sortWeight:10},"thread.jump.7":{title:`Jump to thread 7`,sortWeight:11},"thread.jump.8":{title:`Jump to thread 8`,sortWeight:12},"thread.jump.9":{title:`Jump to thread 9`,sortWeight:13}};function B(e){let t=e.indexOf(`.`),n=t===-1?e:e.slice(0,t);return n===`script`?R.script:R[n]??R.script}function V(e,t){let n=B(e),r=z[e];if(r)return{category:n,title:r.title,sortWeight:r.sortWeight};let i=e.match(/^script\.([a-z0-9][a-z0-9-]*)\.run$/)?.[1]??e;return{category:n,title:t??`Run: ${i}`,sortWeight:100}}var H=[{id:`always`,label:`Always`,value:void 0},{id:`terminalFocus`,label:`Terminal focused`,value:`terminalFocus`},{id:`notTerminalFocus`,label:`Not in terminal`,value:`!terminalFocus`},{id:`terminalOpen`,label:`Terminal open`,value:`terminalOpen`},{id:`notTerminalOpen`,label:`Terminal not open`,value:`!terminalOpen`},{id:`modelPickerOpen`,label:`Model picker open`,value:`modelPickerOpen`},{id:`commandPaletteOpen`,label:`Command palette open`,value:`commandPaletteOpen`},{id:`composerFocus`,label:`Composer focused`,value:`composerFocus`},{id:`notComposerFocus`,label:`Not in composer`,value:`!composerFocus`}],U=new Map(H.map(e=>[e.value,e])),W=new Map(H.map(e=>[e.value===void 0?void 0:e.value.replace(/\s+/g,``),e]));function G(e){return e===void 0?U.get(void 0):U.get(e)||W.get(e.replace(/\s+/g,``))}function K(e){let t=G(e);return t?t.label:e??`Always`}function q(e){if(e)switch(e.type){case`identifier`:return e.name;case`not`:return`!${q(e.node)}`;case`and`:return`(${q(e.left)} && ${q(e.right)})`;case`or`:return`(${q(e.left)} || ${q(e.right)})`}}function te(e,t){return(e===void 0?``:e.replace(/\s+/g,``))===(t===void 0?``:t.replace(/\s+/g,``))}function ne(e,t){let n=e[t];if(!n)return[];let r=[];return e.forEach((e,i)=>{i!==t&&e.command!==n.command&&e.key===n.key&&te(e.when,n.when)&&r.push({key:n.key,otherCommand:e.command,otherWhen:e.when})}),r}function re(e){let t=new Map;return e.forEach((n,r)=>{let i=ne(e,r);if(i.length===0)return;let a=e[r].command,o=t.get(a)??[];o.push(...i),t.set(a,o)}),t}function J(e){return/mac|iphone|ipad|ipod/i.test(e)}var ie=new Set([`control`,`shift`,`alt`,`altgraph`,`meta`,`os`,`hyper`,`super`,`fn`,`capslock`,`numlock`,`scrolllock`]),ae=new Set([`escape`,`tab`,`enter`]);function oe(e,t){let n=e.toLowerCase();if(n===` `||n===`spacebar`)return`space`;if(n===`esc`)return`escape`;if(n===`arrowup`)return`up`;if(n===`arrowdown`)return`down`;if(n===`arrowleft`)return`left`;if(n===`arrowright`)return`right`;if(t){let e=t.match(/^Digit(\d)$/);if(e)return e[1];if(t===`BracketLeft`)return`[`;if(t===`BracketRight`)return`]`}return n}function se(e,t){let n=e.key.toLowerCase();if(ie.has(n))return null;let r=J(t?.platform??(typeof navigator<`u`?navigator.platform:``)),i=r?e.metaKey:e.ctrlKey;if(!(i||e.shiftKey||e.altKey||(r?e.ctrlKey:e.metaKey))&&ae.has(n))return null;let a=oe(e.key,e.code);return a.length===0?null:{key:a,modKey:i,metaKey:!r&&e.metaKey,ctrlKey:r&&e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey}}var ce={mod:`⌘`,meta:`⌘`,cmd:`⌘`,ctrl:`⌃`,control:`⌃`,shift:`⇧`,alt:`⌥`,option:`⌥`},le={mod:`Ctrl`,meta:`Meta`,cmd:`Meta`,ctrl:`Ctrl`,control:`Ctrl`,shift:`Shift`,alt:`Alt`,option:`Alt`},Y={space:`Space`,enter:`Enter`,escape:`Esc`,up:`↑`,down:`↓`,left:`←`,right:`→`,tab:`Tab`,backspace:`⌫`,delete:`Del`};function X(e,t){let n=J(t?.platform??(typeof navigator<`u`?navigator.platform:``))?ce:le,r=[];e.modKey&&r.push(n.mod),e.metaKey&&r.push(n.meta),e.ctrlKey&&r.push(n.ctrl),e.altKey&&r.push(n.alt),e.shiftKey&&r.push(n.shift);let i=Y[e.key]??(e.key.length===1?e.key.toUpperCase():e.key);return r.push(i),r}function ue(e){let t=[];e.modKey&&t.push(`mod`),e.metaKey&&t.push(`meta`),e.ctrlKey&&t.push(`ctrl`),e.altKey&&t.push(`alt`),e.shiftKey&&t.push(`shift`);let n=e.key===` `?`space`:e.key;return t.push(n),t.join(`+`)}var Z=l(),de=[],fe=(()=>{let e=new Map;for(let t of n){let n=`${t.key}|${t.when??``}`,r=e.get(t.command)??new Set;r.add(n),e.set(t.command,r)}return e})(),Q=new Set(n.map(e=>e.command));function pe(e,t){return`${e.command}|${e.key}|${e.when??``}|${t}`}function me(e){return{key:ue(e.shortcut),command:e.command,when:q(e.whenAst)}}function $(e){return e.map((e,t)=>({...me(e),__id:pe(e,t)}))}function he(e){return e.map(({__id:e,...t})=>t)}function ge(e){return n.filter(t=>t.command===e).map(e=>Object.assign({},e))}function _e(e,t){if(!Q.has(e))return`custom`;let n=fe.get(e);if(!n)return`custom`;if(t.length!==n.size)return`modified`;for(let e of t){let t=`${e.key}|${e.when??``}`;if(!n.has(t))return`modified`}return`default`}function ve(e,t,n){return!n||[t.toLowerCase(),e.command.toLowerCase(),e.key.toLowerCase(),K(e.when).toLowerCase()].some(e=>e.includes(n))}function ye(){return Math.random().toString(36).slice(2)}function be(){let e=p(),t=u(),n=f(),i=m(),c=typeof navigator<`u`?navigator.platform:``,l=a(c),[y,b]=(0,I.useState)(!1),[x,S]=(0,I.useState)(null),C=!e||e.primary,w=e?r(e.environmentId)?.keybindings:h().keybindings,T=(0,I.useCallback)(()=>{if(!n)return;if(!C){S(`This file lives on ${e?.nodeLabel??`the selected node`} and cannot be opened in a local editor.`);return}S(null),b(!0);let t=k(i??[]);if(!t){S(`No available editors found.`),b(!1);return}h().shell.openInEditor(n,t).catch(e=>{S(e instanceof Error?e.message:`Unable to open keybindings file.`)}).finally(()=>{b(!1)})},[i,C,n,e?.nodeLabel]),E=o(F(d)),P=(0,I.useMemo)(()=>{let e=new Set,t=new Map;for(let n of E)for(let r of n.scripts){let n=`script.${r.id}.run`;e.add(n),t.has(n)||t.set(n,`Run: ${r.name}`)}return{commandList:Array.from(e),titles:t}},[E]),L=t?.keybindings??de,[z,B]=(0,I.useState)(()=>$(L)),[H,U]=(0,I.useState)(()=>JSON.stringify(he($(L)))),W=(0,I.useRef)(!1);(0,I.useEffect)(()=>{let e=JSON.stringify(he($(L)));e!==H&&(U(e),W.current||B($(L)))},[L,H]);let G=(0,I.useCallback)(async e=>{W.current=!0;try{if(!w)throw Error(`Keybinding settings are unavailable on this node.`);await w.replaceCustom({rules:he(e)})}catch(e){s.add(A({type:`error`,title:`Could not save keybindings`,description:e instanceof Error?e.message:`An unknown error occurred.`})),B($(L))}finally{W.current=!1}},[w,L]),K=(0,I.useCallback)((e,t)=>{B(n=>{let r=n.slice(),i=r[e];if(!i)return n;let a=ue(t);return a===i.key?n:(r[e]={...i,key:a,__id:i.__id},G(r),r)})},[G]),q=(0,I.useCallback)(e=>{B(t=>{let n={command:e,key:``,when:void 0,__id:`placeholder-${ye()}`},r=(()=>{let n=-1;return t.forEach((t,r)=>{t.command===e&&(n=r)}),n})();return r===-1?[...t,n]:[...t.slice(0,r+1),n,...t.slice(r+1)]})},[]),te=(0,I.useCallback)(e=>{B(t=>{let n=t.slice();return n.splice(e,1),G(n),n})},[G]),ne=(0,I.useCallback)((e,t)=>{B(n=>{let r=n.slice(),i=r[e];return!i||(i.when??void 0)===t?n:(r[e]={...i,when:t,__id:i.__id},G(r),r)})},[G]),J=(0,I.useCallback)(e=>{B(t=>{let n=t[e];if(!n)return t;let r=n.command;if(!Q.has(r)){let n=t.slice();return n.splice(e,1),G(n),n}let i=ge(r),a=t.filter(e=>e.command!==r);for(let e of i)a.push({...e,__id:`default-${r}-${ye()}`});return G(a),a})},[G]),ie=(0,I.useCallback)(e=>{B(t=>{let n=t.filter(t=>t.command!==e);if(Q.has(e))for(let t of ge(e))n.push({...t,__id:`default-${e}-${ye()}`});return G(n),n})},[G]),ae=(0,I.useCallback)(async()=>{B([]);try{if(!w)throw Error(`Keybinding settings are unavailable on this node.`);await w.replaceCustom({rules:[]})}catch(e){s.add(A({type:`error`,title:`Could not restore default keybindings`,description:e instanceof Error?e.message:`An unknown error occurred.`})),B($(L))}},[w,L]),oe=(0,I.useRef)(new Map),se=(0,I.useCallback)(e=>{let t=oe.current.get(e);t&&(t.scrollIntoView({behavior:`smooth`,block:`center`}),t.dataset.flash=`true`,window.setTimeout(()=>{delete t.dataset.flash},1100))},[]),[ce,le]=(0,I.useState)(``),Y=(0,I.useDeferredValue)(ce.trim().toLowerCase()),X=(0,I.useMemo)(()=>re(z),[z]),fe=(0,I.useMemo)(()=>{let e=new Map;z.forEach((t,n)=>{let r=e.get(t.command);r?r.push(n):e.set(t.command,[n])});let t=new Set([...e.keys(),...Q,...P.commandList]),n=new Map;for(let r of t){let t=e.get(r)??[],i=t.map(e=>z[e]).filter(Boolean),a=V(r,P.titles.get(r)),o=_e(r,i),s={key:``,command:r,when:void 0};if(!(Y.length===0||ve(s,a.title,Y)||i.some(e=>ve(e,a.title,Y))))continue;let c={command:r,title:a.title,indicesInDraft:t,status:o},l=n.get(a.category.id);l?l.push(c):n.set(a.category.id,[c])}let r=[];for(let e of Object.values(R).toSorted((e,t)=>e.sortWeight-t.sortWeight)){let t=n.get(e.id);t&&t.length!==0&&(t.sort((e,t)=>{let n=V(e.command,P.titles.get(e.command)),r=V(t.command,P.titles.get(t.command));return n.sortWeight-r.sortWeight}),r.push({category:e,rows:t}))}return r},[z,Y,P]),pe=fe.reduce((e,t)=>e+t.rows.length,0),me=(0,I.useMemo)(()=>({platform:c,draft:z,conflictsByCommand:X,onRebind:K,onAddBinding:q,onRemoveBinding:te,onChangeWhen:ne,onResetBinding:J,onResetCommand:ie,scrollToCommand:se,rowRefs:oe}),[c,z,X,K,q,te,ne,J,ie,se]),be=t?.issues.filter(e=>e.kind.startsWith(`keybindings.`))??[],Se=(i??[]).length>0;return(0,Z.jsxs)(ee,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`span`,{className:`grid size-9 place-items-center rounded-lg bg-accent text-foreground/70`,children:(0,Z.jsx)(D,{className:`size-4`})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:`Keybindings`}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Click any shortcut and press a new combination to rebind. Press Esc to cancel, Backspace to clear.`})]})]}),(0,Z.jsxs)(_,{variant:`outline`,size:`xs`,onClick:()=>void ae(),disabled:z.length===0,children:[(0,Z.jsx)(O,{className:`size-3.5`}),`Restore defaults`]})]}),(0,Z.jsx)(M,{title:`Configuration file`,children:(0,Z.jsx)(N,{title:`Keybindings file`,description:"Open the persisted `keybindings.json` file to edit advanced bindings directly.",status:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`block break-all font-mono text-[11px] text-foreground`,children:n??`Resolving keybindings path...`}),x?(0,Z.jsx)(`span`,{className:`mt-1 block text-destructive`,children:x}):(0,Z.jsx)(`span`,{className:`mt-1 block`,children:C?Se?`Opens in your preferred editor.`:`No available editors found.`:`Stored on ${e?.nodeLabel??`the selected node`}; use an editor on that machine.`})]}),control:(0,Z.jsx)(_,{size:`xs`,variant:`outline`,disabled:!C||!n||!Se||y,onClick:T,children:y?`Opening...`:`Open file`})})}),be.length>0?(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-200`,children:[(0,Z.jsx)(g,{className:`mt-0.5 size-4 shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-0.5`,children:[be.map(e=>(0,Z.jsx)(`p`,{children:e.message},`${e.kind}-${e.message}`)),n?(0,Z.jsxs)(`p`,{className:`opacity-70`,children:[`Edit `,(0,Z.jsx)(`code`,{className:`rounded bg-amber-500/20 px-1`,children:n}),` `,`to resolve.`]}):null]})]}):null,(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(v,{className:`absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground/60`}),(0,Z.jsx)(j,{type:`search`,placeholder:`Search by command, shortcut, or when…`,className:`pl-9`,value:ce,onChange:e=>le(e.target.value)})]}),pe===0?(0,Z.jsx)(`div`,{className:`rounded-lg border border-dashed border-border/60 px-6 py-12 text-center text-sm text-muted-foreground`,children:`No commands match your search.`}):fe.map(e=>(0,Z.jsx)(M,{title:e.category.label,children:e.rows.map(e=>(0,Z.jsx)(xe,{row:e,context:me,isMac:l,scriptTitle:P.titles.get(e.command)},e.command))},e.category.id))]})}var xe=(0,I.memo)(function(e){let t=(0,L.c)(42),{row:n,context:r,isMac:i}=e,a;if(t[0]!==r||t[1]!==i||t[2]!==n.command||t[3]!==n.indicesInDraft||t[4]!==n.status||t[5]!==n.title){let e;t[7]===r.draft?e=t[8]:(e=e=>({index:e,rule:r.draft[e]}),t[7]=r.draft,t[8]=e);let o=n.indicesInDraft.map(e),s=r.conflictsByCommand.get(n.command)??[],l=s.slice(0,3),u=n.command,d;t[9]!==r.rowRefs.current||t[10]!==n.command?(d=e=>{r.rowRefs.current.set(n.command,e)},t[9]=r.rowRefs.current,t[10]=n.command,t[11]=d):d=t[11];let f;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(f=c(`group flex flex-col gap-2 border-t border-border/60 px-4 py-3 first:border-t-0 transition-colors data-[flash=true]:bg-amber-500/10 sm:px-5`),t[12]=f):f=t[12];let p;t[13]===n.title?p=t[14]:(p=(0,Z.jsx)(`span`,{className:`truncate text-[13px] font-medium tracking-tight text-foreground`,children:n.title}),t[13]=n.title,t[14]=p);let m;t[15]===n.status?m=t[16]:(m=(0,Z.jsx)(Se,{status:n.status}),t[15]=n.status,t[16]=m);let h;t[17]!==p||t[18]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p,m]}),t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;t[20]===n.command?g=t[21]:(g=(0,Z.jsx)(`code`,{className:`block truncate text-[10px] text-muted-foreground/60`,children:n.command}),t[20]=n.command,t[21]=g);let _;t[22]!==h||t[23]!==g?(_=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[h,g]}),t[22]=h,t[23]=g,t[24]=_):_=t[24];let v=o.length===0?(0,Z.jsx)(we,{draftIndex:-1,rule:{command:n.command,key:``,when:void 0},context:r,isMac:i,isPrimary:!0,isPlaceholder:!0,onAddPlaceholder:()=>r.onAddBinding(n.command)},`placeholder`):o.map((e,t)=>{let{index:n,rule:a}=e;return(0,Z.jsx)(we,{draftIndex:n,rule:a,context:r,isMac:i,isPrimary:t===0,isPlaceholder:a.key.length===0},`${n}-${a.__id}`)}),y;t[25]!==r||t[26]!==n.command||t[27]!==n.title||t[28]!==o?(y=o.length>0?(0,Z.jsxs)(E,{children:[(0,Z.jsx)(w,{render:(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r.onAddBinding(n.command),className:`inline-flex size-6 items-center justify-center rounded-md border border-dashed border-border/60 text-muted-foreground/60 transition-colors hover:border-border hover:text-foreground`,"aria-label":`Add another shortcut for ${n.title}`,children:(0,Z.jsx)(P,{className:`size-3.5`})})}),(0,Z.jsx)(T,{side:`top`,children:`Add another shortcut`})]}):null,t[25]=r,t[26]=n.command,t[27]=n.title,t[28]=o,t[29]=y):y=t[29];let b;t[30]!==r||t[31]!==n.command||t[32]!==n.status||t[33]!==n.title?(b=n.status!=="default"&&Q.has(n.command)?(0,Z.jsxs)(E,{children:[(0,Z.jsx)(w,{render:(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r.onResetCommand(n.command),className:`inline-flex size-6 items-center justify-center rounded-md text-muted-foreground/50 transition-colors hover:text-foreground`,"aria-label":`Reset ${n.title} to default`,children:(0,Z.jsx)(O,{className:`size-3.5`})})}),(0,Z.jsx)(T,{side:`top`,children:`Reset to default`})]}):null,t[30]=r,t[31]=n.command,t[32]=n.status,t[33]=n.title,t[34]=b):b=t[34];let x;t[35]!==v||t[36]!==y||t[37]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[v,y,b]}),t[35]=v,t[36]=y,t[37]=b,t[38]=x):x=t[38];let S;t[39]!==_||t[40]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[_,x]}),t[39]=_,t[40]=x,t[41]=S):S=t[41],a=(0,Z.jsxs)(`div`,{"data-keybinding-command":u,ref:d,className:f,children:[S,l.length>0?(0,Z.jsxs)(`div`,{className:`animate-in fade-in slide-in-from-top-1 flex flex-col gap-1 rounded-md border border-destructive/30 bg-destructive/10 px-2.5 py-1.5 text-[11px] text-destructive-foreground/90`,children:[l.map(e=>(0,Z.jsx)(Ce,{conflict:e,isMac:i,platform:r.platform,onSelect:()=>r.scrollToCommand(e.otherCommand)},`${e.key}-${e.otherCommand}`)),s.length>l.length?(0,Z.jsxs)(`span`,{className:`opacity-70`,children:[`+ `,s.length-l.length,` more`]}):null]}):null]}),t[0]=r,t[1]=i,t[2]=n.command,t[3]=n.indicesInDraft,t[4]=n.status,t[5]=n.title,t[6]=a}else a=t[6];return a});function Se(e){let t=(0,L.c)(5),{status:n}=e;if(n==="default")return null;let r=n===`modified`?`bg-amber-500/15 text-amber-300`:`bg-indigo-500/15 text-indigo-300`,i;t[0]===r?i=t[1]:(i=c(`rounded px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-[0.06em]`,r),t[0]=r,t[1]=i);let a=n===`modified`?`Modified`:`Custom`,o;return t[2]!==i||t[3]!==a?(o=(0,Z.jsx)(`span`,{className:i,children:a}),t[2]=i,t[3]=a,t[4]=o):o=t[4],o}function Ce(e){let t=(0,L.c)(27),{conflict:n,platform:r,isMac:i,onSelect:a}=e,o;t[0]===n.otherCommand?o=t[1]:(o=V(n.otherCommand),t[0]=n.otherCommand,t[1]=o);let s=o,c,l,u,d;if(t[2]!==n.key||t[3]!==i||t[4]!==r){let e=je(n.key),a=e?X(e,{platform:r}):[n.key];u=`flex flex-wrap items-center gap-1.5`,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(g,{className:`size-3 shrink-0 text-destructive`}),t[9]=d):d=t[9],c=`inline-flex items-center gap-0.5 font-mono`;let o;t[10]===i?o=t[11]:(o=e=>(0,Z.jsx)(De,{token:e,isMac:i},e),t[10]=i,t[11]=o),l=a.map(o),t[2]=n.key,t[3]=i,t[4]=r,t[5]=c,t[6]=l,t[7]=u,t[8]=d}else c=t[5],l=t[6],u=t[7],d=t[8];let f;t[12]!==c||t[13]!==l?(f=(0,Z.jsx)(`span`,{className:c,children:l}),t[12]=c,t[13]=l,t[14]=f):f=t[14];let p;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`span`,{children:`also bound to`}),t[15]=p):p=t[15];let m;t[16]!==s.title||t[17]!==a?(m=(0,Z.jsx)(`button`,{type:`button`,onClick:a,className:`rounded bg-destructive/20 px-1.5 py-0.5 font-medium text-destructive-foreground hover:bg-destructive/30`,children:s.title}),t[16]=s.title,t[17]=a,t[18]=m):m=t[18];let h;t[19]===n.otherWhen?h=t[20]:(h=n.otherWhen===void 0?null:(0,Z.jsxs)(`span`,{className:`opacity-70`,children:[`when `,(0,Z.jsx)(`code`,{className:`font-mono`,children:K(n.otherWhen)})]}),t[19]=n.otherWhen,t[20]=h);let _;return t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==m||t[25]!==h?(_=(0,Z.jsxs)(`div`,{className:u,children:[d,f,p,m,h]}),t[21]=u,t[22]=d,t[23]=f,t[24]=m,t[25]=h,t[26]=_):_=t[26],_}function we(e){let t=(0,L.c)(59),{draftIndex:n,rule:r,context:a,isMac:o,isPlaceholder:s,onAddPlaceholder:l}=e,[u,d]=(0,I.useState)(!1),[f,p]=(0,I.useState)(!1),m=(0,I.useRef)(null),h;bb0:{if(r.key.length===0){h=null;break bb0}let e;t[0]===r.key?e=t[1]:(e=je(r.key),t[0]=r.key,t[1]=e),h=e}let g=h,_=g?X(g,{platform:a.platform}):[],v;t[2]!==n||t[3]!==s||t[4]!==l?(v=()=>{if(s&&n===-1&&l){l(),setTimeout(Te,50);return}d(!0)},t[2]=n,t[3]=s,t[4]=l,t[5]=v):v=t[5];let y=v,b,x;t[6]!==a||t[7]!==n||t[8]!==u?(b=()=>{if(!u)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`&&!Ae(e)){d(!1);return}if(e.key===`Tab`&&!Ae(e)){d(!1);return}if(e.key===`Backspace`&&!Ae(e)){n>=0&&a.onRemoveBinding(n),d(!1);return}let t=se(e,{platform:a.platform});t&&(n>=0&&a.onRebind(n,t),p(!0),d(!1),setTimeout(()=>p(!1),220))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},x=[u,n,a],t[6]=a,t[7]=n,t[8]=u,t[9]=b,t[10]=x):(b=t[9],x=t[10]),(0,I.useEffect)(b,x);let S,C;t[11]===u?(S=t[12],C=t[13]):(S=()=>{u&&m.current?.focus()},C=[u],t[11]=u,t[12]=S,t[13]=C),(0,I.useEffect)(S,C);let w;t[14]!==u||t[15]!==y?(w=e=>{u||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),y())},t[14]=u,t[15]=y,t[16]=w):w=t[16];let T=w,E;t[17]!==a||t[18]!==n?(E=()=>{n>=0&&a.onRemoveBinding(n)},t[17]=a,t[18]=n,t[19]=E):E=t[19];let D=E;if(s&&n===-1&&_.length===0){let e;t[20]===l?e=t[21]:(e=()=>l?.(),t[20]=l,t[21]=e);let n;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(P,{className:`size-3`}),t[22]=n):n=t[22];let r;return t[23]!==T||t[24]!==e?(r=(0,Z.jsxs)(`button`,{ref:m,type:`button`,onClick:e,onKeyDown:T,className:`inline-flex h-6 items-center gap-1 rounded-md border border-dashed border-border/60 bg-transparent px-2 text-[11px] text-muted-foreground/70 transition-colors hover:border-border hover:text-foreground`,children:[n,` No shortcut — click to set`]}),t[23]=T,t[24]=e,t[25]=r):r=t[25],r}let O=`Edit shortcut for ${r.command}`,k=_.length===0&&n>=0?`true`:void 0,A=u?`kb-chip-recording border-indigo-500/60 bg-indigo-500/15 text-indigo-100 shadow-[0_0_0_4px_rgba(99,102,241,0.18)]`:f?`border-emerald-500/50 bg-emerald-500/15 text-emerald-100`:`border-border bg-muted/60 text-foreground hover:bg-muted`,j;t[26]===A?j=t[27]:(j=c(`inline-flex h-6 items-center gap-1 rounded-md border px-2 font-mono text-[11px] transition-all duration-150`,A),t[26]=A,t[27]=j);let M;t[28]===u?M=t[29]:(M=u?{animation:`keybindings-pulse 1.4s ease-in-out infinite`}:{},t[28]=u,t[29]=M);let ee=u?(0,Z.jsx)(`span`,{className:`text-[11px] tracking-[0.04em]`,children:`Press shortcut…`}):_.length===0?(0,Z.jsx)(`span`,{className:`text-muted-foreground/60`,children:`Click to set`}):_.map(e=>(0,Z.jsx)(De,{token:e,isMac:o},e)),N;t[30]!==u||t[31]!==r.when?(N=!u&&r.when!==void 0?(0,Z.jsx)(`span`,{className:`ml-1 hidden sm:inline`,children:`·`}):null,t[30]=u,t[31]=r.when,t[32]=N):N=t[32];let F;t[33]!==u||t[34]!==T||t[35]!==y||t[36]!==O||t[37]!==k||t[38]!==j||t[39]!==M||t[40]!==ee||t[41]!==N?(F=(0,Z.jsxs)(`button`,{ref:m,type:`button`,"aria-pressed":u,"aria-label":O,"data-chip-pending-record":k,onClick:y,onKeyDown:T,className:j,style:M,children:[ee,N]}),t[33]=u,t[34]=T,t[35]=y,t[36]=O,t[37]=k,t[38]=j,t[39]=M,t[40]=ee,t[41]=N,t[42]=F):F=t[42];let R;t[43]!==a||t[44]!==n?(R=e=>a.onChangeWhen(n,e),t[43]=a,t[44]=n,t[45]=R):R=t[45];let z=n<0||u,B;t[46]!==r.when||t[47]!==R||t[48]!==z?(B=(0,Z.jsx)(Oe,{currentWhen:r.when,onChange:R,disabled:z}),t[46]=r.when,t[47]=R,t[48]=z,t[49]=B):B=t[49];let V;t[50]!==n||t[51]!==D||t[52]!==u?(V=n>=0&&!u?(0,Z.jsx)(`button`,{type:`button`,onClick:D,"aria-label":`Remove this shortcut`,className:`opacity-0 transition-opacity group-hover:opacity-100 focus:opacity-100`,children:(0,Z.jsx)(i,{className:`size-3 text-muted-foreground/60 hover:text-destructive`})}):null,t[50]=n,t[51]=D,t[52]=u,t[53]=V):V=t[53];let H;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(ke,{}),t[54]=H):H=t[54];let U;return t[55]!==F||t[56]!==B||t[57]!==V?(U=(0,Z.jsxs)(`span`,{className:`relative inline-flex items-center gap-1`,children:[F,B,V,H]}),t[55]=F,t[56]=B,t[57]=V,t[58]=U):U=t[58],U}function Te(){document.querySelectorAll(`[data-chip-pending-record="true"]`).forEach(Ee)}function Ee(e){e.click()}function De(e){let t=(0,L.c)(5),{token:n,isMac:r}=e,i=r&&n.length===1&&/[⌀-⏿←-⇿]/.test(n)?`bg-transparent`:`bg-foreground/10`,a;t[0]===i?a=t[1]:(a=c(`rounded px-1 leading-none`,i),t[0]=i,t[1]=a);let o;return t[2]!==a||t[3]!==n?(o=(0,Z.jsx)(`span`,{className:a,children:n}),t[2]=a,t[3]=n,t[4]=o):o=t[4],o}function Oe(e){let t=(0,L.c)(35),{currentWhen:n,onChange:r,disabled:i}=e,a;t[0]===n?a=t[1]:(a=G(n),t[0]=n,t[1]=a);let o=a,s,l,u,d,f,p,m;if(t[2]!==n||t[3]!==i){let e=K(n);l=b,s=y,u=`button`,d=i;let r=n===void 0&&`italic opacity-70`;t[11]===r?f=t[12]:(f=c(`inline-flex h-5 items-center gap-1 rounded bg-muted/40 px-1.5 text-[10px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,r),t[11]=r,t[12]=f),p=`When: ${e}`,m=n===void 0?`always`:e.toLowerCase(),t[2]=n,t[3]=i,t[4]=s,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=p,t[10]=m}else s=t[4],l=t[5],u=t[6],d=t[7],f=t[8],p=t[9],m=t[10];let h;t[13]!==u||t[14]!==d||t[15]!==f||t[16]!==p||t[17]!==m?(h=(0,Z.jsx)(`button`,{type:u,disabled:d,className:f,"aria-label":p,children:m}),t[13]=u,t[14]=d,t[15]=f,t[16]=p,t[17]=m,t[18]=h):h=t[18];let g;t[19]!==s||t[20]!==h?(g=(0,Z.jsx)(s,{render:h}),t[19]=s,t[20]=h,t[21]=g):g=t[21];let _;t[22]!==n||t[23]!==o?(_=!o&&n!==void 0?(0,Z.jsxs)(`div`,{className:`px-2 py-1.5 text-[10px] text-muted-foreground`,children:[`Current: `,(0,Z.jsx)(`code`,{className:`font-mono`,children:n})]}):null,t[22]=n,t[23]=o,t[24]=_):_=t[24];let v;t[25]!==n||t[26]!==r?(v=H.map(e=>(0,Z.jsxs)(x,{onClick:()=>r(e.value),className:c(`flex items-center justify-between text-[12px]`,e.value===n&&`font-semibold text-foreground`),children:[(0,Z.jsx)(`span`,{children:e.label}),e.value===void 0?(0,Z.jsx)(`span`,{className:`text-[10px] text-muted-foreground/60`,children:`no condition`}):(0,Z.jsx)(`code`,{className:`text-[10px] font-mono text-muted-foreground/60`,children:e.value})]},e.id)),t[25]=n,t[26]=r,t[27]=v):v=t[27];let C;t[28]!==v||t[29]!==_?(C=(0,Z.jsxs)(S,{side:`bottom`,align:`end`,className:`min-w-[220px]`,children:[_,v]}),t[28]=v,t[29]=_,t[30]=C):C=t[30];let w;return t[31]!==l||t[32]!==C||t[33]!==g?(w=(0,Z.jsxs)(l,{children:[g,C]}),t[31]=l,t[32]=C,t[33]=g,t[34]=w):w=t[34],w}function ke(){let e=(0,L.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`style`,{children:`@keyframes keybindings-pulse {
1
+ import{i as e,t}from"./react-SIfiwpqq.js";import{vt as n}from"./primary-CNUdEGcv.js";import{$n as r,Br as i,Hr as a,Nn as o,Pr as s,Ta as c,Ur as l,_l as u,al as d,bn as f,ll as p,ol as m,or as h,vl as g,wa as _}from"./runtime-BKneT96Q.js";import{Dt as v,Qn as y,ht as b,vt as x,yt as S}from"./switch-LahPAvrd.js";import{t as C}from"./compiler-runtime-qmuS0Svy.js";import{i as w,n as T,t as E}from"./tooltip-B8-izeMo.js";import{d as D}from"./SettingsPanels-DtWLQDne.js";import{a as O,r as k}from"./editorPreferences-2dG4uloq.js";import{t as A}from"./toastHelpers-CSQRKo4F.js";import{t as j}from"./input-CfVJycb1.js";import{i as M,n as ee,r as N}from"./settingsLayout-DQERzSce.js";import{Bt as P,Ft as F}from"./main-CGeD6yVE.js";var I=e(t(),1),L=C(),R={terminal:{id:`terminal`,label:`Terminal`,sortWeight:10},workspace:{id:`workspace`,label:`Workspace`,sortWeight:20},diff:{id:`diff`,label:`Diff`,sortWeight:30},commandPalette:{id:`commandPalette`,label:`Command palette`,sortWeight:40},sidebar:{id:`sidebar`,label:`Sidebar`,sortWeight:50},chat:{id:`chat`,label:`Chat`,sortWeight:60},composer:{id:`composer`,label:`Composer`,sortWeight:70},editor:{id:`editor`,label:`Editor`,sortWeight:80},modelPicker:{id:`modelPicker`,label:`Model picker`,sortWeight:90},thread:{id:`thread`,label:`Threads`,sortWeight:100},script:{id:`script`,label:`Project scripts`,sortWeight:110}},z={"terminal.toggle":{title:`Toggle terminal drawer`,sortWeight:1},"terminal.split":{title:`Split terminal`,sortWeight:2},"terminal.new":{title:`New terminal`,sortWeight:3},"terminal.close":{title:`Close terminal`,sortWeight:4},"workspace.files":{title:`Open workspace files`,sortWeight:1},"workspace.review":{title:`Open workspace review`,sortWeight:2},"workspace.terminal":{title:`Open workspace terminal`,sortWeight:3},"workspace.simulator":{title:`Open iOS Simulator workspace`,sortWeight:4},"diff.toggle":{title:`Toggle diff view`,sortWeight:1},"commandPalette.toggle":{title:`Open command palette`,sortWeight:1},"sidebar.showInbox":{title:`Show Inbox sidebar`,sortWeight:1},"sidebar.showProjects":{title:`Show Projects sidebar`,sortWeight:2},"chat.new":{title:`New chat`,sortWeight:1},"chat.newLocal":{title:`New chat (local environment)`,sortWeight:2},"composer.stash":{title:`Stash prompt or open stash`,sortWeight:1},"editor.openFavorite":{title:`Open in preferred editor`,sortWeight:1},"modelPicker.toggle":{title:`Toggle model picker`,sortWeight:1},"modelPicker.jump.1":{title:`Pick model 1`,sortWeight:2},"modelPicker.jump.2":{title:`Pick model 2`,sortWeight:3},"modelPicker.jump.3":{title:`Pick model 3`,sortWeight:4},"modelPicker.jump.4":{title:`Pick model 4`,sortWeight:5},"modelPicker.jump.5":{title:`Pick model 5`,sortWeight:6},"modelPicker.jump.6":{title:`Pick model 6`,sortWeight:7},"modelPicker.jump.7":{title:`Pick model 7`,sortWeight:8},"modelPicker.jump.8":{title:`Pick model 8`,sortWeight:9},"modelPicker.jump.9":{title:`Pick model 9`,sortWeight:10},"thread.find":{title:`Find in current thread`,sortWeight:1},"thread.pinToggle":{title:`Pin or unpin current thread`,sortWeight:2},"thread.previous":{title:`Previous thread`,sortWeight:3},"thread.next":{title:`Next thread`,sortWeight:4},"thread.jump.1":{title:`Jump to thread 1`,sortWeight:5},"thread.jump.2":{title:`Jump to thread 2`,sortWeight:6},"thread.jump.3":{title:`Jump to thread 3`,sortWeight:7},"thread.jump.4":{title:`Jump to thread 4`,sortWeight:8},"thread.jump.5":{title:`Jump to thread 5`,sortWeight:9},"thread.jump.6":{title:`Jump to thread 6`,sortWeight:10},"thread.jump.7":{title:`Jump to thread 7`,sortWeight:11},"thread.jump.8":{title:`Jump to thread 8`,sortWeight:12},"thread.jump.9":{title:`Jump to thread 9`,sortWeight:13}};function B(e){let t=e.indexOf(`.`),n=t===-1?e:e.slice(0,t);return n===`script`?R.script:R[n]??R.script}function V(e,t){let n=B(e),r=z[e];if(r)return{category:n,title:r.title,sortWeight:r.sortWeight};let i=e.match(/^script\.([a-z0-9][a-z0-9-]*)\.run$/)?.[1]??e;return{category:n,title:t??`Run: ${i}`,sortWeight:100}}var H=[{id:`always`,label:`Always`,value:void 0},{id:`terminalFocus`,label:`Terminal focused`,value:`terminalFocus`},{id:`notTerminalFocus`,label:`Not in terminal`,value:`!terminalFocus`},{id:`terminalOpen`,label:`Terminal open`,value:`terminalOpen`},{id:`notTerminalOpen`,label:`Terminal not open`,value:`!terminalOpen`},{id:`modelPickerOpen`,label:`Model picker open`,value:`modelPickerOpen`},{id:`commandPaletteOpen`,label:`Command palette open`,value:`commandPaletteOpen`},{id:`composerFocus`,label:`Composer focused`,value:`composerFocus`},{id:`notComposerFocus`,label:`Not in composer`,value:`!composerFocus`}],U=new Map(H.map(e=>[e.value,e])),W=new Map(H.map(e=>[e.value===void 0?void 0:e.value.replace(/\s+/g,``),e]));function G(e){return e===void 0?U.get(void 0):U.get(e)||W.get(e.replace(/\s+/g,``))}function K(e){let t=G(e);return t?t.label:e??`Always`}function q(e){if(e)switch(e.type){case`identifier`:return e.name;case`not`:return`!${q(e.node)}`;case`and`:return`(${q(e.left)} && ${q(e.right)})`;case`or`:return`(${q(e.left)} || ${q(e.right)})`}}function te(e,t){return(e===void 0?``:e.replace(/\s+/g,``))===(t===void 0?``:t.replace(/\s+/g,``))}function ne(e,t){let n=e[t];if(!n)return[];let r=[];return e.forEach((e,i)=>{i!==t&&e.command!==n.command&&e.key===n.key&&te(e.when,n.when)&&r.push({key:n.key,otherCommand:e.command,otherWhen:e.when})}),r}function re(e){let t=new Map;return e.forEach((n,r)=>{let i=ne(e,r);if(i.length===0)return;let a=e[r].command,o=t.get(a)??[];o.push(...i),t.set(a,o)}),t}function J(e){return/mac|iphone|ipad|ipod/i.test(e)}var ie=new Set([`control`,`shift`,`alt`,`altgraph`,`meta`,`os`,`hyper`,`super`,`fn`,`capslock`,`numlock`,`scrolllock`]),ae=new Set([`escape`,`tab`,`enter`]);function oe(e,t){let n=e.toLowerCase();if(n===` `||n===`spacebar`)return`space`;if(n===`esc`)return`escape`;if(n===`arrowup`)return`up`;if(n===`arrowdown`)return`down`;if(n===`arrowleft`)return`left`;if(n===`arrowright`)return`right`;if(t){let e=t.match(/^Digit(\d)$/);if(e)return e[1];if(t===`BracketLeft`)return`[`;if(t===`BracketRight`)return`]`}return n}function se(e,t){let n=e.key.toLowerCase();if(ie.has(n))return null;let r=J(t?.platform??(typeof navigator<`u`?navigator.platform:``)),i=r?e.metaKey:e.ctrlKey;if(!(i||e.shiftKey||e.altKey||(r?e.ctrlKey:e.metaKey))&&ae.has(n))return null;let a=oe(e.key,e.code);return a.length===0?null:{key:a,modKey:i,metaKey:!r&&e.metaKey,ctrlKey:r&&e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey}}var ce={mod:`⌘`,meta:`⌘`,cmd:`⌘`,ctrl:`⌃`,control:`⌃`,shift:`⇧`,alt:`⌥`,option:`⌥`},le={mod:`Ctrl`,meta:`Meta`,cmd:`Meta`,ctrl:`Ctrl`,control:`Ctrl`,shift:`Shift`,alt:`Alt`,option:`Alt`},Y={space:`Space`,enter:`Enter`,escape:`Esc`,up:`↑`,down:`↓`,left:`←`,right:`→`,tab:`Tab`,backspace:`⌫`,delete:`Del`};function X(e,t){let n=J(t?.platform??(typeof navigator<`u`?navigator.platform:``))?ce:le,r=[];e.modKey&&r.push(n.mod),e.metaKey&&r.push(n.meta),e.ctrlKey&&r.push(n.ctrl),e.altKey&&r.push(n.alt),e.shiftKey&&r.push(n.shift);let i=Y[e.key]??(e.key.length===1?e.key.toUpperCase():e.key);return r.push(i),r}function ue(e){let t=[];e.modKey&&t.push(`mod`),e.metaKey&&t.push(`meta`),e.ctrlKey&&t.push(`ctrl`),e.altKey&&t.push(`alt`),e.shiftKey&&t.push(`shift`);let n=e.key===` `?`space`:e.key;return t.push(n),t.join(`+`)}var Z=g(),de=[],fe=(()=>{let e=new Map;for(let t of n){let n=`${t.key}|${t.when??``}`,r=e.get(t.command)??new Set;r.add(n),e.set(t.command,r)}return e})(),Q=new Set(n.map(e=>e.command));function pe(e,t){return`${e.command}|${e.key}|${e.when??``}|${t}`}function me(e){return{key:ue(e.shortcut),command:e.command,when:q(e.whenAst)}}function $(e){return e.map((e,t)=>({...me(e),__id:pe(e,t)}))}function he(e){return e.map(({__id:e,...t})=>t)}function ge(e){return n.filter(t=>t.command===e).map(e=>Object.assign({},e))}function _e(e,t){if(!Q.has(e))return`custom`;let n=fe.get(e);if(!n)return`custom`;if(t.length!==n.size)return`modified`;for(let e of t){let t=`${e.key}|${e.when??``}`;if(!n.has(t))return`modified`}return`default`}function ve(e,t,n){return!n||[t.toLowerCase(),e.command.toLowerCase(),e.key.toLowerCase(),K(e.when).toLowerCase()].some(e=>e.includes(n))}function ye(){return Math.random().toString(36).slice(2)}function be(){let e=u(),t=m(),n=p(),a=d(),g=typeof navigator<`u`?navigator.platform:``,_=l(g),[v,b]=(0,I.useState)(!1),[x,S]=(0,I.useState)(null),C=!e||e.primary,w=e?r(e.environmentId)?.keybindings:h().keybindings,T=(0,I.useCallback)(()=>{if(!n)return;if(!C){S(`This file lives on ${e?.nodeLabel??`the selected node`} and cannot be opened in a local editor.`);return}S(null),b(!0);let t=k(a??[]);if(!t){S(`No available editors found.`),b(!1);return}h().shell.openInEditor(n,t).catch(e=>{S(e instanceof Error?e.message:`Unable to open keybindings file.`)}).finally(()=>{b(!1)})},[a,C,n,e?.nodeLabel]),E=o(F(f)),P=(0,I.useMemo)(()=>{let e=new Set,t=new Map;for(let n of E)for(let r of n.scripts){let n=`script.${r.id}.run`;e.add(n),t.has(n)||t.set(n,`Run: ${r.name}`)}return{commandList:Array.from(e),titles:t}},[E]),L=t?.keybindings??de,[z,B]=(0,I.useState)(()=>$(L)),[H,U]=(0,I.useState)(()=>JSON.stringify(he($(L)))),W=(0,I.useRef)(!1);(0,I.useEffect)(()=>{let e=JSON.stringify(he($(L)));e!==H&&(U(e),W.current||B($(L)))},[L,H]);let G=(0,I.useCallback)(async e=>{W.current=!0;try{if(!w)throw Error(`Keybinding settings are unavailable on this node.`);await w.replaceCustom({rules:he(e)})}catch(e){s.add(A({type:`error`,title:`Could not save keybindings`,description:e instanceof Error?e.message:`An unknown error occurred.`})),B($(L))}finally{W.current=!1}},[w,L]),K=(0,I.useCallback)((e,t)=>{B(n=>{let r=n.slice(),i=r[e];if(!i)return n;let a=ue(t);return a===i.key?n:(r[e]={...i,key:a,__id:i.__id},G(r),r)})},[G]),q=(0,I.useCallback)(e=>{B(t=>{let n={command:e,key:``,when:void 0,__id:`placeholder-${ye()}`},r=(()=>{let n=-1;return t.forEach((t,r)=>{t.command===e&&(n=r)}),n})();return r===-1?[...t,n]:[...t.slice(0,r+1),n,...t.slice(r+1)]})},[]),te=(0,I.useCallback)(e=>{B(t=>{let n=t.slice();return n.splice(e,1),G(n),n})},[G]),ne=(0,I.useCallback)((e,t)=>{B(n=>{let r=n.slice(),i=r[e];return!i||(i.when??void 0)===t?n:(r[e]={...i,when:t,__id:i.__id},G(r),r)})},[G]),J=(0,I.useCallback)(e=>{B(t=>{let n=t[e];if(!n)return t;let r=n.command;if(!Q.has(r)){let n=t.slice();return n.splice(e,1),G(n),n}let i=ge(r),a=t.filter(e=>e.command!==r);for(let e of i)a.push({...e,__id:`default-${r}-${ye()}`});return G(a),a})},[G]),ie=(0,I.useCallback)(e=>{B(t=>{let n=t.filter(t=>t.command!==e);if(Q.has(e))for(let t of ge(e))n.push({...t,__id:`default-${e}-${ye()}`});return G(n),n})},[G]),ae=(0,I.useCallback)(async()=>{B([]);try{if(!w)throw Error(`Keybinding settings are unavailable on this node.`);await w.replaceCustom({rules:[]})}catch(e){s.add(A({type:`error`,title:`Could not restore default keybindings`,description:e instanceof Error?e.message:`An unknown error occurred.`})),B($(L))}},[w,L]),oe=(0,I.useRef)(new Map),se=(0,I.useCallback)(e=>{let t=oe.current.get(e);t&&(t.scrollIntoView({behavior:`smooth`,block:`center`}),t.dataset.flash=`true`,window.setTimeout(()=>{delete t.dataset.flash},1100))},[]),[ce,le]=(0,I.useState)(``),Y=(0,I.useDeferredValue)(ce.trim().toLowerCase()),X=(0,I.useMemo)(()=>re(z),[z]),fe=(0,I.useMemo)(()=>{let e=new Map;z.forEach((t,n)=>{let r=e.get(t.command);r?r.push(n):e.set(t.command,[n])});let t=new Set([...e.keys(),...Q,...P.commandList]),n=new Map;for(let r of t){let t=e.get(r)??[],i=t.map(e=>z[e]).filter(Boolean),a=V(r,P.titles.get(r)),o=_e(r,i),s={key:``,command:r,when:void 0};if(!(Y.length===0||ve(s,a.title,Y)||i.some(e=>ve(e,a.title,Y))))continue;let c={command:r,title:a.title,indicesInDraft:t,status:o},l=n.get(a.category.id);l?l.push(c):n.set(a.category.id,[c])}let r=[];for(let e of Object.values(R).toSorted((e,t)=>e.sortWeight-t.sortWeight)){let t=n.get(e.id);t&&t.length!==0&&(t.sort((e,t)=>{let n=V(e.command,P.titles.get(e.command)),r=V(t.command,P.titles.get(t.command));return n.sortWeight-r.sortWeight}),r.push({category:e,rows:t}))}return r},[z,Y,P]),pe=fe.reduce((e,t)=>e+t.rows.length,0),me=(0,I.useMemo)(()=>({platform:g,draft:z,conflictsByCommand:X,onRebind:K,onAddBinding:q,onRemoveBinding:te,onChangeWhen:ne,onResetBinding:J,onResetCommand:ie,scrollToCommand:se,rowRefs:oe}),[g,z,X,K,q,te,ne,J,ie,se]),be=t?.issues.filter(e=>e.kind.startsWith(`keybindings.`))??[],Se=(a??[]).length>0;return(0,Z.jsxs)(ee,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`span`,{className:`grid size-9 place-items-center rounded-lg bg-accent text-foreground/70`,children:(0,Z.jsx)(D,{className:`size-4`})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:`Keybindings`}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Click any shortcut and press a new combination to rebind. Press Esc to cancel, Backspace to clear.`})]})]}),(0,Z.jsxs)(i,{variant:`outline`,size:`xs`,onClick:()=>void ae(),disabled:z.length===0,children:[(0,Z.jsx)(O,{className:`size-3.5`}),`Restore defaults`]})]}),(0,Z.jsx)(M,{title:`Configuration file`,children:(0,Z.jsx)(N,{title:`Keybindings file`,description:"Open the persisted `keybindings.json` file to edit advanced bindings directly.",status:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`block break-all font-mono text-[11px] text-foreground`,children:n??`Resolving keybindings path...`}),x?(0,Z.jsx)(`span`,{className:`mt-1 block text-destructive`,children:x}):(0,Z.jsx)(`span`,{className:`mt-1 block`,children:C?Se?`Opens in your preferred editor.`:`No available editors found.`:`Stored on ${e?.nodeLabel??`the selected node`}; use an editor on that machine.`})]}),control:(0,Z.jsx)(i,{size:`xs`,variant:`outline`,disabled:!C||!n||!Se||v,onClick:T,children:v?`Opening...`:`Open file`})})}),be.length>0?(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-200`,children:[(0,Z.jsx)(c,{className:`mt-0.5 size-4 shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-0.5`,children:[be.map(e=>(0,Z.jsx)(`p`,{children:e.message},`${e.kind}-${e.message}`)),n?(0,Z.jsxs)(`p`,{className:`opacity-70`,children:[`Edit `,(0,Z.jsx)(`code`,{className:`rounded bg-amber-500/20 px-1`,children:n}),` `,`to resolve.`]}):null]})]}):null,(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(y,{className:`absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground/60`}),(0,Z.jsx)(j,{type:`search`,placeholder:`Search by command, shortcut, or when…`,className:`pl-9`,value:ce,onChange:e=>le(e.target.value)})]}),pe===0?(0,Z.jsx)(`div`,{className:`rounded-lg border border-dashed border-border/60 px-6 py-12 text-center text-sm text-muted-foreground`,children:`No commands match your search.`}):fe.map(e=>(0,Z.jsx)(M,{title:e.category.label,children:e.rows.map(e=>(0,Z.jsx)(xe,{row:e,context:me,isMac:_,scriptTitle:P.titles.get(e.command)},e.command))},e.category.id))]})}var xe=(0,I.memo)(function(e){let t=(0,L.c)(42),{row:n,context:r,isMac:i}=e,o;if(t[0]!==r||t[1]!==i||t[2]!==n.command||t[3]!==n.indicesInDraft||t[4]!==n.status||t[5]!==n.title){let e;t[7]===r.draft?e=t[8]:(e=e=>({index:e,rule:r.draft[e]}),t[7]=r.draft,t[8]=e);let s=n.indicesInDraft.map(e),c=r.conflictsByCommand.get(n.command)??[],l=c.slice(0,3),u=n.command,d;t[9]!==r.rowRefs.current||t[10]!==n.command?(d=e=>{r.rowRefs.current.set(n.command,e)},t[9]=r.rowRefs.current,t[10]=n.command,t[11]=d):d=t[11];let f;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(f=a(`group flex flex-col gap-2 border-t border-border/60 px-4 py-3 first:border-t-0 transition-colors data-[flash=true]:bg-amber-500/10 sm:px-5`),t[12]=f):f=t[12];let p;t[13]===n.title?p=t[14]:(p=(0,Z.jsx)(`span`,{className:`truncate text-[13px] font-medium tracking-tight text-foreground`,children:n.title}),t[13]=n.title,t[14]=p);let m;t[15]===n.status?m=t[16]:(m=(0,Z.jsx)(Se,{status:n.status}),t[15]=n.status,t[16]=m);let h;t[17]!==p||t[18]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p,m]}),t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;t[20]===n.command?g=t[21]:(g=(0,Z.jsx)(`code`,{className:`block truncate text-[10px] text-muted-foreground/60`,children:n.command}),t[20]=n.command,t[21]=g);let _;t[22]!==h||t[23]!==g?(_=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[h,g]}),t[22]=h,t[23]=g,t[24]=_):_=t[24];let v=s.length===0?(0,Z.jsx)(we,{draftIndex:-1,rule:{command:n.command,key:``,when:void 0},context:r,isMac:i,isPrimary:!0,isPlaceholder:!0,onAddPlaceholder:()=>r.onAddBinding(n.command)},`placeholder`):s.map((e,t)=>{let{index:n,rule:a}=e;return(0,Z.jsx)(we,{draftIndex:n,rule:a,context:r,isMac:i,isPrimary:t===0,isPlaceholder:a.key.length===0},`${n}-${a.__id}`)}),y;t[25]!==r||t[26]!==n.command||t[27]!==n.title||t[28]!==s?(y=s.length>0?(0,Z.jsxs)(E,{children:[(0,Z.jsx)(w,{render:(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r.onAddBinding(n.command),className:`inline-flex size-6 items-center justify-center rounded-md border border-dashed border-border/60 text-muted-foreground/60 transition-colors hover:border-border hover:text-foreground`,"aria-label":`Add another shortcut for ${n.title}`,children:(0,Z.jsx)(P,{className:`size-3.5`})})}),(0,Z.jsx)(T,{side:`top`,children:`Add another shortcut`})]}):null,t[25]=r,t[26]=n.command,t[27]=n.title,t[28]=s,t[29]=y):y=t[29];let b;t[30]!==r||t[31]!==n.command||t[32]!==n.status||t[33]!==n.title?(b=n.status!=="default"&&Q.has(n.command)?(0,Z.jsxs)(E,{children:[(0,Z.jsx)(w,{render:(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r.onResetCommand(n.command),className:`inline-flex size-6 items-center justify-center rounded-md text-muted-foreground/50 transition-colors hover:text-foreground`,"aria-label":`Reset ${n.title} to default`,children:(0,Z.jsx)(O,{className:`size-3.5`})})}),(0,Z.jsx)(T,{side:`top`,children:`Reset to default`})]}):null,t[30]=r,t[31]=n.command,t[32]=n.status,t[33]=n.title,t[34]=b):b=t[34];let x;t[35]!==v||t[36]!==y||t[37]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[v,y,b]}),t[35]=v,t[36]=y,t[37]=b,t[38]=x):x=t[38];let S;t[39]!==_||t[40]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[_,x]}),t[39]=_,t[40]=x,t[41]=S):S=t[41],o=(0,Z.jsxs)(`div`,{"data-keybinding-command":u,ref:d,className:f,children:[S,l.length>0?(0,Z.jsxs)(`div`,{className:`animate-in fade-in slide-in-from-top-1 flex flex-col gap-1 rounded-md border border-destructive/30 bg-destructive/10 px-2.5 py-1.5 text-[11px] text-destructive-foreground/90`,children:[l.map(e=>(0,Z.jsx)(Ce,{conflict:e,isMac:i,platform:r.platform,onSelect:()=>r.scrollToCommand(e.otherCommand)},`${e.key}-${e.otherCommand}`)),c.length>l.length?(0,Z.jsxs)(`span`,{className:`opacity-70`,children:[`+ `,c.length-l.length,` more`]}):null]}):null]}),t[0]=r,t[1]=i,t[2]=n.command,t[3]=n.indicesInDraft,t[4]=n.status,t[5]=n.title,t[6]=o}else o=t[6];return o});function Se(e){let t=(0,L.c)(5),{status:n}=e;if(n==="default")return null;let r=n===`modified`?`bg-amber-500/15 text-amber-300`:`bg-indigo-500/15 text-indigo-300`,i;t[0]===r?i=t[1]:(i=a(`rounded px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-[0.06em]`,r),t[0]=r,t[1]=i);let o=n===`modified`?`Modified`:`Custom`,s;return t[2]!==i||t[3]!==o?(s=(0,Z.jsx)(`span`,{className:i,children:o}),t[2]=i,t[3]=o,t[4]=s):s=t[4],s}function Ce(e){let t=(0,L.c)(27),{conflict:n,platform:r,isMac:i,onSelect:a}=e,o;t[0]===n.otherCommand?o=t[1]:(o=V(n.otherCommand),t[0]=n.otherCommand,t[1]=o);let s=o,l,u,d,f;if(t[2]!==n.key||t[3]!==i||t[4]!==r){let e=je(n.key),a=e?X(e,{platform:r}):[n.key];d=`flex flex-wrap items-center gap-1.5`,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(c,{className:`size-3 shrink-0 text-destructive`}),t[9]=f):f=t[9],l=`inline-flex items-center gap-0.5 font-mono`;let o;t[10]===i?o=t[11]:(o=e=>(0,Z.jsx)(De,{token:e,isMac:i},e),t[10]=i,t[11]=o),u=a.map(o),t[2]=n.key,t[3]=i,t[4]=r,t[5]=l,t[6]=u,t[7]=d,t[8]=f}else l=t[5],u=t[6],d=t[7],f=t[8];let p;t[12]!==l||t[13]!==u?(p=(0,Z.jsx)(`span`,{className:l,children:u}),t[12]=l,t[13]=u,t[14]=p):p=t[14];let m;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`span`,{children:`also bound to`}),t[15]=m):m=t[15];let h;t[16]!==s.title||t[17]!==a?(h=(0,Z.jsx)(`button`,{type:`button`,onClick:a,className:`rounded bg-destructive/20 px-1.5 py-0.5 font-medium text-destructive-foreground hover:bg-destructive/30`,children:s.title}),t[16]=s.title,t[17]=a,t[18]=h):h=t[18];let g;t[19]===n.otherWhen?g=t[20]:(g=n.otherWhen===void 0?null:(0,Z.jsxs)(`span`,{className:`opacity-70`,children:[`when `,(0,Z.jsx)(`code`,{className:`font-mono`,children:K(n.otherWhen)})]}),t[19]=n.otherWhen,t[20]=g);let _;return t[21]!==d||t[22]!==f||t[23]!==p||t[24]!==h||t[25]!==g?(_=(0,Z.jsxs)(`div`,{className:d,children:[f,p,m,h,g]}),t[21]=d,t[22]=f,t[23]=p,t[24]=h,t[25]=g,t[26]=_):_=t[26],_}function we(e){let t=(0,L.c)(59),{draftIndex:n,rule:r,context:i,isMac:o,isPlaceholder:s,onAddPlaceholder:c}=e,[l,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)(!1),p=(0,I.useRef)(null),m;bb0:{if(r.key.length===0){m=null;break bb0}let e;t[0]===r.key?e=t[1]:(e=je(r.key),t[0]=r.key,t[1]=e),m=e}let h=m,g=h?X(h,{platform:i.platform}):[],v;t[2]!==n||t[3]!==s||t[4]!==c?(v=()=>{if(s&&n===-1&&c){c(),setTimeout(Te,50);return}u(!0)},t[2]=n,t[3]=s,t[4]=c,t[5]=v):v=t[5];let y=v,b,x;t[6]!==i||t[7]!==n||t[8]!==l?(b=()=>{if(!l)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`&&!Ae(e)){u(!1);return}if(e.key===`Tab`&&!Ae(e)){u(!1);return}if(e.key===`Backspace`&&!Ae(e)){n>=0&&i.onRemoveBinding(n),u(!1);return}let t=se(e,{platform:i.platform});t&&(n>=0&&i.onRebind(n,t),f(!0),u(!1),setTimeout(()=>f(!1),220))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},x=[l,n,i],t[6]=i,t[7]=n,t[8]=l,t[9]=b,t[10]=x):(b=t[9],x=t[10]),(0,I.useEffect)(b,x);let S,C;t[11]===l?(S=t[12],C=t[13]):(S=()=>{l&&p.current?.focus()},C=[l],t[11]=l,t[12]=S,t[13]=C),(0,I.useEffect)(S,C);let w;t[14]!==l||t[15]!==y?(w=e=>{l||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),y())},t[14]=l,t[15]=y,t[16]=w):w=t[16];let T=w,E;t[17]!==i||t[18]!==n?(E=()=>{n>=0&&i.onRemoveBinding(n)},t[17]=i,t[18]=n,t[19]=E):E=t[19];let D=E;if(s&&n===-1&&g.length===0){let e;t[20]===c?e=t[21]:(e=()=>c?.(),t[20]=c,t[21]=e);let n;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(P,{className:`size-3`}),t[22]=n):n=t[22];let r;return t[23]!==T||t[24]!==e?(r=(0,Z.jsxs)(`button`,{ref:p,type:`button`,onClick:e,onKeyDown:T,className:`inline-flex h-6 items-center gap-1 rounded-md border border-dashed border-border/60 bg-transparent px-2 text-[11px] text-muted-foreground/70 transition-colors hover:border-border hover:text-foreground`,children:[n,` No shortcut — click to set`]}),t[23]=T,t[24]=e,t[25]=r):r=t[25],r}let O=`Edit shortcut for ${r.command}`,k=g.length===0&&n>=0?`true`:void 0,A=l?`kb-chip-recording border-indigo-500/60 bg-indigo-500/15 text-indigo-100 shadow-[0_0_0_4px_rgba(99,102,241,0.18)]`:d?`border-emerald-500/50 bg-emerald-500/15 text-emerald-100`:`border-border bg-muted/60 text-foreground hover:bg-muted`,j;t[26]===A?j=t[27]:(j=a(`inline-flex h-6 items-center gap-1 rounded-md border px-2 font-mono text-[11px] transition-all duration-150`,A),t[26]=A,t[27]=j);let M;t[28]===l?M=t[29]:(M=l?{animation:`keybindings-pulse 1.4s ease-in-out infinite`}:{},t[28]=l,t[29]=M);let ee=l?(0,Z.jsx)(`span`,{className:`text-[11px] tracking-[0.04em]`,children:`Press shortcut…`}):g.length===0?(0,Z.jsx)(`span`,{className:`text-muted-foreground/60`,children:`Click to set`}):g.map(e=>(0,Z.jsx)(De,{token:e,isMac:o},e)),N;t[30]!==l||t[31]!==r.when?(N=!l&&r.when!==void 0?(0,Z.jsx)(`span`,{className:`ml-1 hidden sm:inline`,children:`·`}):null,t[30]=l,t[31]=r.when,t[32]=N):N=t[32];let F;t[33]!==l||t[34]!==T||t[35]!==y||t[36]!==O||t[37]!==k||t[38]!==j||t[39]!==M||t[40]!==ee||t[41]!==N?(F=(0,Z.jsxs)(`button`,{ref:p,type:`button`,"aria-pressed":l,"aria-label":O,"data-chip-pending-record":k,onClick:y,onKeyDown:T,className:j,style:M,children:[ee,N]}),t[33]=l,t[34]=T,t[35]=y,t[36]=O,t[37]=k,t[38]=j,t[39]=M,t[40]=ee,t[41]=N,t[42]=F):F=t[42];let R;t[43]!==i||t[44]!==n?(R=e=>i.onChangeWhen(n,e),t[43]=i,t[44]=n,t[45]=R):R=t[45];let z=n<0||l,B;t[46]!==r.when||t[47]!==R||t[48]!==z?(B=(0,Z.jsx)(Oe,{currentWhen:r.when,onChange:R,disabled:z}),t[46]=r.when,t[47]=R,t[48]=z,t[49]=B):B=t[49];let V;t[50]!==n||t[51]!==D||t[52]!==l?(V=n>=0&&!l?(0,Z.jsx)(`button`,{type:`button`,onClick:D,"aria-label":`Remove this shortcut`,className:`opacity-0 transition-opacity group-hover:opacity-100 focus:opacity-100`,children:(0,Z.jsx)(_,{className:`size-3 text-muted-foreground/60 hover:text-destructive`})}):null,t[50]=n,t[51]=D,t[52]=l,t[53]=V):V=t[53];let H;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(ke,{}),t[54]=H):H=t[54];let U;return t[55]!==F||t[56]!==B||t[57]!==V?(U=(0,Z.jsxs)(`span`,{className:`relative inline-flex items-center gap-1`,children:[F,B,V,H]}),t[55]=F,t[56]=B,t[57]=V,t[58]=U):U=t[58],U}function Te(){document.querySelectorAll(`[data-chip-pending-record="true"]`).forEach(Ee)}function Ee(e){e.click()}function De(e){let t=(0,L.c)(5),{token:n,isMac:r}=e,i=r&&n.length===1&&/[⌀-⏿←-⇿]/.test(n)?`bg-transparent`:`bg-foreground/10`,o;t[0]===i?o=t[1]:(o=a(`rounded px-1 leading-none`,i),t[0]=i,t[1]=o);let s;return t[2]!==o||t[3]!==n?(s=(0,Z.jsx)(`span`,{className:o,children:n}),t[2]=o,t[3]=n,t[4]=s):s=t[4],s}function Oe(e){let t=(0,L.c)(35),{currentWhen:n,onChange:r,disabled:i}=e,o;t[0]===n?o=t[1]:(o=G(n),t[0]=n,t[1]=o);let s=o,c,l,u,d,f,p,m;if(t[2]!==n||t[3]!==i){let e=K(n);l=b,c=v,u=`button`,d=i;let r=n===void 0&&`italic opacity-70`;t[11]===r?f=t[12]:(f=a(`inline-flex h-5 items-center gap-1 rounded bg-muted/40 px-1.5 text-[10px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,r),t[11]=r,t[12]=f),p=`When: ${e}`,m=n===void 0?`always`:e.toLowerCase(),t[2]=n,t[3]=i,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=p,t[10]=m}else c=t[4],l=t[5],u=t[6],d=t[7],f=t[8],p=t[9],m=t[10];let h;t[13]!==u||t[14]!==d||t[15]!==f||t[16]!==p||t[17]!==m?(h=(0,Z.jsx)(`button`,{type:u,disabled:d,className:f,"aria-label":p,children:m}),t[13]=u,t[14]=d,t[15]=f,t[16]=p,t[17]=m,t[18]=h):h=t[18];let g;t[19]!==c||t[20]!==h?(g=(0,Z.jsx)(c,{render:h}),t[19]=c,t[20]=h,t[21]=g):g=t[21];let _;t[22]!==n||t[23]!==s?(_=!s&&n!==void 0?(0,Z.jsxs)(`div`,{className:`px-2 py-1.5 text-[10px] text-muted-foreground`,children:[`Current: `,(0,Z.jsx)(`code`,{className:`font-mono`,children:n})]}):null,t[22]=n,t[23]=s,t[24]=_):_=t[24];let y;t[25]!==n||t[26]!==r?(y=H.map(e=>(0,Z.jsxs)(x,{onClick:()=>r(e.value),className:a(`flex items-center justify-between text-[12px]`,e.value===n&&`font-semibold text-foreground`),children:[(0,Z.jsx)(`span`,{children:e.label}),e.value===void 0?(0,Z.jsx)(`span`,{className:`text-[10px] text-muted-foreground/60`,children:`no condition`}):(0,Z.jsx)(`code`,{className:`text-[10px] font-mono text-muted-foreground/60`,children:e.value})]},e.id)),t[25]=n,t[26]=r,t[27]=y):y=t[27];let C;t[28]!==y||t[29]!==_?(C=(0,Z.jsxs)(S,{side:`bottom`,align:`end`,className:`min-w-[220px]`,children:[_,y]}),t[28]=y,t[29]=_,t[30]=C):C=t[30];let w;return t[31]!==l||t[32]!==C||t[33]!==g?(w=(0,Z.jsxs)(l,{children:[g,C]}),t[31]=l,t[32]=C,t[33]=g,t[34]=w):w=t[34],w}function ke(){let e=(0,L.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`style`,{children:`@keyframes keybindings-pulse {
2
2
  0%, 100% { box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15); }
3
3
  50% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0.30); }
4
4
  }
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/main-CC-U8LrA.css"])))=>i.map(i=>d[i]);
2
- import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./index-CvRFRkBK.js";import{Na as r,_l as i}from"./runtime-Bxg7k81u.js";import{t as a}from"./compiler-runtime-qmuS0Svy.js";var o={name:`folder-open`,size:24,node:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]};o.node;var s=r(o),c=a(),l=e(t(),1),u=i(),d=(0,l.lazy)(()=>n(()=>import(`./BrowserPanel-2Xu08il5.js`).then(e=>({default:e.BrowserPanel})),__vite__mapDeps([0])));function f(e){let t=(0,c.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-muted-foreground`,children:`Loading browser…`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,u.jsx)(l.Suspense,{fallback:n,children:(0,u.jsx)(d,{...e})}),t[1]=e,t[2]=r),r}export{s as n,f as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/main-BNPtp9Z0.css"])))=>i.map(i=>d[i]);
2
+ import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./index-7MTgf8YI.js";import{Pa as r,vl as i}from"./runtime-BKneT96Q.js";import{t as a}from"./compiler-runtime-qmuS0Svy.js";var o={name:`folder-open`,size:24,node:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]};o.node;var s=r(o),c=a(),l=e(t(),1),u=i(),d=(0,l.lazy)(()=>n(()=>import(`./BrowserPanel-C_C4zjrh.js`).then(e=>({default:e.BrowserPanel})),__vite__mapDeps([0])));function f(e){let t=(0,c.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-muted-foreground`,children:`Loading browser…`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,u.jsx)(l.Suspense,{fallback:n,children:(0,u.jsx)(d,{...e})}),t[1]=e,t[2]=r),r}export{s as n,f as t};
@@ -0,0 +1,6 @@
1
+ import{i as e,t}from"./react-SIfiwpqq.js";import{_ as n,g as r}from"./src-DPpEXU6w.js";import{$n as i,Br as a,Hr as o,Ma as s,Pa as c,Pr as l,Ta as u,_l as d,ka as f,or as p,ta as m,vl as h}from"./runtime-BKneT96Q.js";import{Ft as g,It as _,Mt as v,Nt as y,Pt as b,Yn as x,Zn as S,jt as C,kt as w,st as T,t as E}from"./switch-LahPAvrd.js";import{t as D}from"./compiler-runtime-qmuS0Svy.js";import{i as ee,n as te,t as ne}from"./tooltip-B8-izeMo.js";import{a as O,c as k,n as A,o as j,s as M,t as N}from"./badge-BjvTY7-E.js";import{K as re,Y as P}from"./ContextHandoffEndpointLabel-CsF_maM_.js";import{t as F}from"./refresh-cw-CY5BeUEr.js";import{t as I}from"./save-DIHMjHXd.js";import{t as L}from"./wrench-36WYdK_a.js";import{t as R}from"./toastHelpers-CSQRKo4F.js";import{t as z}from"./input-CfVJycb1.js";import"./providerModels-5uOq3qPC.js";import{r as B}from"./providerDriverMeta-Cg_XLUfo.js";import{Bt as V}from"./main-CGeD6yVE.js";var H={name:`earth`,size:24,node:[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]],aliases:[`globe-2`]};H.node;var ie=c(H),U={name:`log-in`,size:24,node:[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]};U.node;var ae=c(U),W=e(t(),1),G=D(),K=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function q(){return{name:``,transport:`stdio`,command:``,argsText:``,cwd:``,url:``,bearerTokenEnvVar:``,envText:``,envVarsText:``,httpHeadersText:``,envHttpHeadersText:``,enabled:!0,required:!1,startupTimeoutSec:``,toolTimeoutSec:``,enabledToolsText:``,disabledToolsText:``,oauthScopesText:``,secretFields:[],clearedSecretFields:[]}}function J(e){return e.join(`
2
+ `)}function Y(e){return Object.entries(e).map(([e,t])=>`${e}=${t}`).join(`
3
+ `)}function oe(e){let t=e.config;return{name:e.name,transport:t.transport===`http`?`http`:`stdio`,command:t.command??``,argsText:J(t.args),cwd:t.cwd??``,url:t.url??``,bearerTokenEnvVar:t.bearerTokenEnvVar??``,envText:Y(t.env),envVarsText:J(t.envVars),httpHeadersText:Y(t.httpHeaders),envHttpHeadersText:Y(t.envHttpHeaders),enabled:t.enabled,required:t.required??!1,startupTimeoutSec:t.startupTimeoutSec?.toString()??``,toolTimeoutSec:t.toolTimeoutSec?.toString()??``,enabledToolsText:J(t.enabledTools),disabledToolsText:J(t.disabledTools),oauthScopesText:J(t.oauthScopes),secretFields:Object.entries(t.secretFields??{}).filter(([,e])=>e===`present`).map(([e])=>e).toSorted(),clearedSecretFields:[]}}function se(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0)}function ce(e){let t={};for(let n of se(e)){let e=n.indexOf(`=`);if(e<=0)continue;let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();r.length>0&&(t[r]=i)}return t}function le(e){let t=e.trim();if(!t)return;let n=Number(t);return Number.isFinite(n)&&n>0?n:NaN}function ue(e){let t=e.name.trim();if(!K.test(t))return`Server name must start with a letter and use only letters, numbers, dashes, and underscores.`;if(e.transport===`stdio`&&e.command.trim().length===0)return`Stdio servers need a command.`;if(e.transport===`http`&&e.url.trim().length===0)return`HTTP servers need a URL.`;for(let[t,n]of[[`Startup timeout`,e.startupTimeoutSec],[`Tool timeout`,e.toolTimeoutSec]]){let e=le(n);if(Number.isNaN(e))return`${t} must be a positive number.`}return null}function de(e){let t=le(e.startupTimeoutSec),n=le(e.toolTimeoutSec);return{transport:e.transport,command:e.command.trim(),args:se(e.argsText),cwd:e.cwd.trim()||null,url:e.url.trim(),bearerTokenEnvVar:e.bearerTokenEnvVar.trim()||null,env:ce(e.envText),envVars:se(e.envVarsText),httpHeaders:ce(e.httpHeadersText),envHttpHeaders:ce(e.envHttpHeadersText),enabled:e.enabled,required:e.required,...t===void 0||Number.isNaN(t)?{}:{startupTimeoutSec:t},...n===void 0||Number.isNaN(n)?{}:{toolTimeoutSec:n},enabledTools:se(e.enabledToolsText),disabledTools:se(e.disabledToolsText),oauthScopes:se(e.oauthScopesText)}}function fe(e){return Object.fromEntries(e.secretFields.map(t=>[t,e.clearedSecretFields.includes(t)?{action:`clear`}:{action:`retain`}]))}function pe(e){let t=e.config;return t.transport===`http`?t.url||`HTTP`:t.transport===`stdio`?[t.command,...t.args].filter(Boolean).join(` `)||`stdio`:`Configured outside the known MCP schema`}var X=h(),me=[],he=[];function Z(e){if(!e)throw Error(`MCP settings are unavailable before a backend is paired.`);return e}function Q(e,t){l.add(R({type:`error`,title:e,description:t instanceof Error?t.message:`An error occurred.`}))}function ge(e){switch(e){case`user`:return`User config`;case`project`:return`Project`;case`system`:return`System`;case`managed`:return`Managed`;case`mixed`:return`Mixed`;case`unknown`:return`Unknown`}}function _e(e){return e.startupStatus===`failed`?`error`:e.startupStatus===`disabled`?`outline`:e.authStatus===`notLoggedIn`?`warning`:e.startupStatus===`ready`?`success`:`outline`}function ve(e){return e.startupStatus===`disabled`?`Disabled`:e.startupStatus===`failed`?`Failed`:e.authStatus===`notLoggedIn`?`Login needed`:e.startupStatus===`ready`?`Ready`:`Unknown`}function ye(e){return e.enabled?e.status===`managed`?`success`:e.status===`external`?`warning`:`outline`:`outline`}function be(e){if(!e.enabled)return`Disabled`;switch(e.status){case`managed`:return`Managed`;case`external`:return`External config`;case`unsupported`:return`Not wired`}}function xe(e){return e.displayName??B(e.driver)?.label??m(e.driver)}function Se(e){return e?e.providerDisplayName??B(e.driver)?.label??m(e.driver):`the provider`}function $(e){let t=(0,G.c)(5),n;t[0]===e.label?n=t[1]:(n=(0,X.jsx)(`span`,{children:e.label}),t[0]=e.label,t[1]=n);let r;return t[2]!==e.children||t[3]!==n?(r=(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-foreground/80`,children:[n,e.children]}),t[2]=e.children,t[3]=n,t[4]=r):r=t[4],r}function Ce(e){let t=(0,G.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground/70`,children:n}),t[0]=n,t[1]=r),r}function we(e){let t=(0,G.c)(5),{value:n,onChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={value:`stdio`,label:`Stdio`,icon:x},t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=[i,{value:`http`,label:`HTTP`,icon:ie}],t[1]=a):a=t[1];let s;return t[2]!==r||t[3]!==n?(s=(0,X.jsx)(`div`,{className:`grid grid-cols-2 rounded-lg border bg-muted/30 p-1`,children:a.map(e=>{let t=e.icon,i=n===e.value;return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>r(e.value),className:o(`flex h-8 items-center justify-center gap-2 rounded-md text-xs font-medium transition-colors`,i?`bg-background text-foreground shadow-xs`:`text-muted-foreground`),children:[(0,X.jsx)(t,{className:`size-3.5`}),e.label]},e.value)})}),t[2]=r,t[3]=n,t[4]=s):s=t[4],s}function Te({open:e,server:t,providerName:n,onOpenChange:r,onSubmit:i}){let[o,s]=(0,W.useState)(()=>q()),[c,l]=(0,W.useState)(null),[d,f]=(0,W.useState)(!1),p=t!==null;(0,W.useEffect)(()=>{e&&(s(t?oe(t):q()),l(null))},[e,t]);let m=(e,t)=>{s(n=>({...n,[e]:t}))},h=async()=>{let e=ue(o);if(e){l(e);return}f(!0);try{await i(o),r(!1)}catch(e){Q(`Failed to save MCP server`,e)}finally{f(!1)}};return(0,X.jsx)(w,{open:e,onOpenChange:r,children:(0,X.jsxs)(g,{className:`max-w-2xl`,bottomStickOnMobile:!1,children:[(0,X.jsxs)(y,{children:[(0,X.jsx)(_,{children:p?`Edit MCP server`:`Add MCP server`}),(0,X.jsxs)(C,{children:[`Configuration is written through `,n,`'s native MCP management surface. Existing secret values are never loaded into this form and are retained unless you enter replacements with the same keys.`]})]}),(0,X.jsxs)(b,{className:`space-y-5`,children:[(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-[1fr_12rem]`,children:[(0,X.jsx)($,{label:`Server name`,children:(0,X.jsx)(z,{value:o.name,disabled:p,onChange:e=>m(`name`,e.target.value),placeholder:`github`,spellCheck:!1})}),(0,X.jsx)($,{label:`Transport`,children:(0,X.jsx)(we,{value:o.transport,onChange:e=>m(`transport`,e)})})]}),o.transport===`stdio`?(0,X.jsxs)(`div`,{className:`grid gap-4`,children:[(0,X.jsx)($,{label:`Command`,children:(0,X.jsx)(z,{value:o.command,onChange:e=>m(`command`,e.target.value),placeholder:`npx`,spellCheck:!1})}),(0,X.jsxs)($,{label:`Arguments`,children:[(0,X.jsx)(T,{value:o.argsText,onChange:e=>m(`argsText`,e.target.value),placeholder:`-y
4
+ @modelcontextprotocol/server-filesystem
5
+ /tmp/project`,spellCheck:!1}),(0,X.jsx)(Ce,{children:`One argument per line.`})]}),(0,X.jsx)($,{label:`Working directory`,children:(0,X.jsx)(z,{value:o.cwd,onChange:e=>m(`cwd`,e.target.value),placeholder:`/path/to/project`,spellCheck:!1})})]}):(0,X.jsxs)(`div`,{className:`grid gap-4`,children:[(0,X.jsx)($,{label:`URL`,children:(0,X.jsx)(z,{value:o.url,onChange:e=>m(`url`,e.target.value),placeholder:`https://mcp.example.com/mcp`,spellCheck:!1})}),(0,X.jsx)($,{label:`Bearer token env var`,children:(0,X.jsx)(z,{value:o.bearerTokenEnvVar,onChange:e=>m(`bearerTokenEnvVar`,e.target.value),placeholder:`MCP_TOKEN`,spellCheck:!1})}),(0,X.jsxs)($,{label:`HTTP headers`,children:[(0,X.jsx)(T,{value:o.httpHeadersText,onChange:e=>m(`httpHeadersText`,e.target.value),placeholder:`X-Client=ryco`,spellCheck:!1}),(0,X.jsx)(Ce,{children:`Static headers as KEY=VALUE lines.`})]}),(0,X.jsxs)($,{label:`Env-backed HTTP headers`,children:[(0,X.jsx)(T,{value:o.envHttpHeadersText,onChange:e=>m(`envHttpHeadersText`,e.target.value),placeholder:`Authorization=GITHUB_TOKEN`,spellCheck:!1}),(0,X.jsx)(Ce,{children:`Header name to environment variable name, one per line.`})]})]}),(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,X.jsxs)($,{label:`Environment values`,children:[(0,X.jsx)(T,{value:o.envText,onChange:e=>m(`envText`,e.target.value),placeholder:`API_BASE=https://example.com`,spellCheck:!1}),(0,X.jsx)(Ce,{children:`KEY=VALUE lines stored by the selected provider.`})]}),(0,X.jsxs)($,{label:`Environment allow-list`,children:[(0,X.jsx)(T,{value:o.envVarsText,onChange:e=>m(`envVarsText`,e.target.value),placeholder:`GITHUB_TOKEN
6
+ SENTRY_AUTH_TOKEN`,spellCheck:!1}),(0,X.jsx)(Ce,{children:`One env var name per line.`})]})]}),(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,X.jsx)($,{label:`Startup timeout seconds`,children:(0,X.jsx)(z,{value:o.startupTimeoutSec,onChange:e=>m(`startupTimeoutSec`,e.target.value),inputMode:`decimal`,placeholder:`10`})}),(0,X.jsx)($,{label:`Tool timeout seconds`,children:(0,X.jsx)(z,{value:o.toolTimeoutSec,onChange:e=>m(`toolTimeoutSec`,e.target.value),inputMode:`decimal`,placeholder:`60`})})]}),(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,X.jsx)($,{label:`Enabled tools`,children:(0,X.jsx)(T,{value:o.enabledToolsText,onChange:e=>m(`enabledToolsText`,e.target.value),spellCheck:!1})}),(0,X.jsx)($,{label:`Disabled tools`,children:(0,X.jsx)(T,{value:o.disabledToolsText,onChange:e=>m(`disabledToolsText`,e.target.value),spellCheck:!1})}),(0,X.jsx)($,{label:`OAuth scopes`,children:(0,X.jsx)(T,{value:o.oauthScopesText,onChange:e=>m(`oauthScopesText`,e.target.value),spellCheck:!1})})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5 border-t pt-4`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-xs font-medium text-foreground/80`,children:[(0,X.jsx)(E,{checked:o.enabled,onCheckedChange:e=>m(`enabled`,!!e)}),`Enabled`]}),(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-xs font-medium text-foreground/80`,children:[(0,X.jsx)(E,{checked:o.required,onCheckedChange:e=>m(`required`,!!e)}),`Required`]})]}),o.secretFields.length>0?(0,X.jsxs)(`fieldset`,{className:`grid gap-2 border-t pt-4`,children:[(0,X.jsx)(`legend`,{className:`text-xs font-medium`,children:`Stored secret fields`}),(0,X.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground/70`,children:`Values remain inside the provider configuration and are never loaded by this page. Select a field only when you want it removed on save.`}),o.secretFields.map(e=>(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:o.clearedSecretFields.includes(e),onChange:t=>m(`clearedSecretFields`,t.target.checked?[...o.clearedSecretFields,e]:o.clearedSecretFields.filter(t=>t!==e))}),`Clear `,(0,X.jsx)(`code`,{className:`font-mono`,children:e})]},e))]}):null,c?(0,X.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive/6 px-3 py-2 text-xs text-destructive-foreground`,children:[(0,X.jsx)(u,{className:`mt-0.5 size-3.5`}),(0,X.jsx)(`span`,{children:c})]}):null]}),(0,X.jsxs)(v,{children:[(0,X.jsx)(a,{variant:`outline`,onClick:()=>r(!1),disabled:d,children:`Cancel`}),(0,X.jsxs)(a,{onClick:()=>void h(),disabled:d,children:[d?(0,X.jsx)(P,{className:`animate-spin`}):(0,X.jsx)(I,{}),`Save`]})]})]})})}function Ee(e){let t=(0,G.c)(18),{workspaces:n,selectedWorkspaceId:r,onChange:i}=e;if(n.length<=1||!r)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===r?e=t[4]:(e=e=>e.id===r,t[3]=r,t[4]=e),a=n.find(e),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o=a,s;t[5]===i?s=t[6]:(s=e=>{e&&i(e)},t[5]=i,t[6]=s);let c=o?.displayPath??`Select workspace`,l;t[7]===c?l=t[8]:(l=(0,X.jsx)(M,{className:`w-full sm:w-72`,"aria-label":`MCP workspace`,children:(0,X.jsx)(k,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===n?u=t[10]:(u=n.map(De),t[9]=n,t[10]=u);let d;t[11]===u?d=t[12]:(d=(0,X.jsx)(j,{align:`end`,alignItemWithTrigger:!1,children:u}),t[11]=u,t[12]=d);let f;return t[13]!==r||t[14]!==s||t[15]!==l||t[16]!==d?(f=(0,X.jsxs)(A,{value:r,onValueChange:s,children:[l,d]}),t[13]=r,t[14]=s,t[15]=l,t[16]=d,t[17]=f):f=t[17],f}function De(e){return(0,X.jsx)(O,{hideIndicator:!0,value:e.id,children:(0,X.jsx)(`span`,{className:`truncate`,children:e.displayPath})},e.id)}function Oe(e){let t=(0,G.c)(10),{providers:n,selectedWorkspaceId:r,onSelectWorkspace:i}=e;if(n.length===0)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(`div`,{className:`border-b px-4 py-3`,children:(0,X.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Provider MCP support`})}),t[0]=o):o=t[0];let s;if(t[1]!==i||t[2]!==n||t[3]!==r){let e;t[5]!==i||t[6]!==r?(e=e=>{let t=B(e.driver),n=t?.icon??S,o=e.workspaceId!==void 0&&e.workspaceId===r,s=e.workspaceId!==void 0&&!o;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,X.jsxs)(`div`,{className:`relative mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg border bg-background`,children:[(0,X.jsx)(n,{className:`size-4 text-muted-foreground`}),e.accentColor?(0,X.jsx)(`span`,{className:`absolute -right-0.5 -bottom-0.5 size-2.5 rounded-full border border-background`,style:{backgroundColor:e.accentColor}}):null]}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium`,children:xe(e)}),(0,X.jsx)(`span`,{className:`font-mono text-[11px] text-muted-foreground/70`,children:e.instanceId})]}),(0,X.jsx)(`p`,{className:`mt-1 max-w-2xl text-xs leading-relaxed text-muted-foreground/80`,children:e.message})]})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 sm:justify-end`,children:[(0,X.jsx)(N,{variant:ye(e),children:be(e)}),e.workspaceId?(0,X.jsxs)(a,{size:`xs`,variant:o?`secondary`:`outline`,disabled:!s,onClick:()=>{e.workspaceId&&i(e.workspaceId)},children:[t?.label??m(e.driver),` `,`workspace`]}):null]})]},e.instanceId)},t[5]=i,t[6]=r,t[7]=e):e=t[7],s=n.map(e),t[1]=i,t[2]=n,t[3]=r,t[4]=s}else s=t[4];let c;return t[8]===s?c=t[9]:(c=(0,X.jsxs)(`section`,{className:`overflow-hidden rounded-lg border bg-card text-card-foreground shadow-sm/4`,children:[o,(0,X.jsx)(`div`,{className:`divide-y`,children:s})]}),t[8]=s,t[9]=c),c}function ke(e){let t=(0,G.c)(20),{server:n}=e;if(n.tools.length===0&&n.resources.length===0&&n.resourceTemplates.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:`No tools or resources reported.`}),t[0]=e):e=t[0],e}let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(`h4`,{className:`mb-1.5 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Tools`}),t[1]=r):r=t[1];let i;t[2]===n.tools?i=t[3]:(i=n.tools.slice(0,12).map(Me),t[2]=n.tools,t[3]=i);let a;t[4]===i?a=t[5]:(a=(0,X.jsxs)(`div`,{children:[r,(0,X.jsx)(`div`,{className:`space-y-1`,children:i})]}),t[4]=i,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(`h4`,{className:`mb-1.5 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Resources`}),t[6]=o):o=t[6];let s;t[7]===n.resources?s=t[8]:(s=n.resources.slice(0,10).map(je),t[7]=n.resources,t[8]=s);let c;t[9]===s?c=t[10]:(c=(0,X.jsxs)(`div`,{children:[o,(0,X.jsx)(`div`,{className:`space-y-1`,children:s})]}),t[9]=s,t[10]=c);let l;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(`h4`,{className:`mb-1.5 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Templates`}),t[11]=l):l=t[11];let u;t[12]===n.resourceTemplates?u=t[13]:(u=n.resourceTemplates.slice(0,10).map(Ae),t[12]=n.resourceTemplates,t[13]=u);let d;t[14]===u?d=t[15]:(d=(0,X.jsxs)(`div`,{children:[l,(0,X.jsx)(`div`,{className:`space-y-1`,children:u})]}),t[14]=u,t[15]=d);let f;return t[16]!==a||t[17]!==c||t[18]!==d?(f=(0,X.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[a,c,d]}),t[16]=a,t[17]=c,t[18]=d,t[19]=f):f=t[19],f}function Ae(e){return(0,X.jsxs)(`div`,{className:`rounded-md border bg-background/60 px-2 py-1.5`,children:[(0,X.jsx)(`div`,{className:`truncate text-xs font-medium`,children:e.title??e.name}),(0,X.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground/75`,children:e.uriTemplate})]},e.uriTemplate)}function je(e){return(0,X.jsxs)(`div`,{className:`rounded-md border bg-background/60 px-2 py-1.5`,children:[(0,X.jsx)(`div`,{className:`truncate text-xs font-medium`,children:e.title??e.name}),(0,X.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground/75`,children:e.uri})]},e.uri)}function Me(e){return(0,X.jsxs)(`div`,{className:`rounded-md border bg-background/60 px-2 py-1.5`,children:[(0,X.jsx)(`div`,{className:`truncate text-xs font-medium`,children:e.title??e.name}),e.description?(0,X.jsx)(`div`,{className:`line-clamp-2 text-[11px] text-muted-foreground/75`,children:e.description}):null]},e.name)}function Ne(e){let t=(0,G.c)(88),{server:n,capabilities:r,writable:i,mutating:c,onToggleEnabled:l,onEdit:u,onRemove:d,onOauthLogin:f}=e,[p,m]=(0,W.useState)(!1),h;t[0]===n?h=t[1]:(h=pe(n),t[0]=n,t[1]=h);let g=h,_=r.inventory===`available`,v=_?`${n.tools.length} tools · ${n.resources.length+n.resourceTemplates.length} resources`:`Inventory not available`,y;t[2]===n.config.transport?y=t[3]:(y=n.config.transport===`http`?(0,X.jsx)(ie,{className:`size-4 text-muted-foreground`}):(0,X.jsx)(x,{className:`size-4 text-muted-foreground`}),t[2]=n.config.transport,t[3]=y);let b;t[4]===n.name?b=t[5]:(b=(0,X.jsx)(`h3`,{className:`truncate text-sm font-semibold`,children:n.name}),t[4]=n.name,t[5]=b);let S;t[6]!==y||t[7]!==b?(S=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[y,b]}),t[6]=y,t[7]=b,t[8]=S):S=t[8];let C;t[9]===n?C=t[10]:(C=_e(n),t[9]=n,t[10]=C);let w;t[11]===n?w=t[12]:(w=ve(n),t[11]=n,t[12]=w);let T;t[13]!==C||t[14]!==w?(T=(0,X.jsx)(N,{variant:C,children:w}),t[13]=C,t[14]=w,t[15]=T):T=t[15];let D;t[16]===n.source?D=t[17]:(D=ge(n.source),t[16]=n.source,t[17]=D);let O;t[18]===D?O=t[19]:(O=(0,X.jsx)(N,{variant:`outline`,children:D}),t[18]=D,t[19]=O);let k;t[20]!==S||t[21]!==T||t[22]!==O?(k=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[S,T,O]}),t[20]=S,t[21]=T,t[22]=O,t[23]=k):k=t[23];let A;t[24]===g?A=t[25]:(A=(0,X.jsx)(`p`,{className:`mt-1 truncate font-mono text-[11px] text-muted-foreground/80`,children:g}),t[24]=g,t[25]=A);let j;t[26]===n.config.transport?j=t[27]:(j=n.config.transport.toUpperCase(),t[26]=n.config.transport,t[27]=j);let M;t[28]===j?M=t[29]:(M=(0,X.jsx)(`span`,{children:j}),t[28]=j,t[29]=M);let P;t[30]===v?P=t[31]:(P=(0,X.jsx)(`span`,{children:v}),t[30]=v,t[31]=P);let F;t[32]===n.authStatus?F=t[33]:(F=(0,X.jsxs)(`span`,{children:[`Auth: `,n.authStatus]}),t[32]=n.authStatus,t[33]=F);let I;t[34]!==M||t[35]!==P||t[36]!==F?(I=(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2 text-[11px] text-muted-foreground`,children:[M,P,F]}),t[34]=M,t[35]=P,t[36]=F,t[37]=I):I=t[37];let L;t[38]===n.error?L=t[39]:(L=n.error?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-destructive`,children:n.error}):null,t[38]=n.error,t[39]=L);let R;t[40]!==k||t[41]!==A||t[42]!==I||t[43]!==L?(R=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[k,A,I,L]}),t[40]=k,t[41]=A,t[42]=I,t[43]=L,t[44]=R):R=t[44];let z;t[45]!==r.oauth||t[46]!==c||t[47]!==f||t[48]!==n?(z=r.oauth===`available`&&n.authStatus===`notLoggedIn`?(0,X.jsxs)(ne,{children:[(0,X.jsx)(ee,{render:(0,X.jsx)(a,{size:`icon-sm`,variant:`outline`,disabled:c,onClick:()=>f(n),"aria-label":`Log in to ${n.name}`,children:(0,X.jsx)(ae,{})})}),(0,X.jsx)(te,{children:`Start OAuth login`})]}):null,t[45]=r.oauth,t[46]=c,t[47]=f,t[48]=n,t[49]=z):z=t[49];let B;t[50]!==r.upsert||t[51]!==c||t[52]!==u||t[53]!==n||t[54]!==i?(B=i&&r.upsert===`available`?(0,X.jsx)(a,{size:`sm`,variant:`outline`,onClick:()=>u(n),disabled:c,children:`Edit`}):null,t[50]=r.upsert,t[51]=c,t[52]=u,t[53]=n,t[54]=i,t[55]=B):B=t[55];let V;t[56]!==r.remove||t[57]!==c||t[58]!==d||t[59]!==n||t[60]!==i?(V=i&&r.remove===`available`?(0,X.jsxs)(ne,{children:[(0,X.jsx)(ee,{render:(0,X.jsx)(a,{size:`icon-sm`,variant:`destructive-outline`,disabled:c,onClick:()=>d(n),"aria-label":`Remove ${n.name}`,children:(0,X.jsx)(re,{})})}),(0,X.jsx)(te,{children:`Remove server`})]}):null,t[56]=r.remove,t[57]=c,t[58]=d,t[59]=n,t[60]=i,t[61]=V):V=t[61];let H;t[62]!==r.enableDisable||t[63]!==c||t[64]!==l||t[65]!==n||t[66]!==i?(H=i&&r.enableDisable===`available`?(0,X.jsx)(E,{checked:n.config.enabled,disabled:c,onCheckedChange:e=>l(n,!!e),"aria-label":`Enable ${n.name}`}):null,t[62]=r.enableDisable,t[63]=c,t[64]=l,t[65]=n,t[66]=i,t[67]=H):H=t[67];let U;t[68]!==p||t[69]!==_||t[70]!==n.name?(U=_?(0,X.jsx)(a,{size:`icon-sm`,variant:`ghost`,onClick:()=>m(Pe),"aria-label":`Toggle ${n.name} inventory`,children:(0,X.jsx)(s,{className:o(`transition-transform`,p&&`rotate-180`)})}):null,t[68]=p,t[69]=_,t[70]=n.name,t[71]=U):U=t[71];let K;t[72]!==z||t[73]!==B||t[74]!==V||t[75]!==H||t[76]!==U?(K=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[z,B,V,H,U]}),t[72]=z,t[73]=B,t[74]=V,t[75]=H,t[76]=U,t[77]=K):K=t[77];let q;t[78]!==R||t[79]!==K?(q=(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-start sm:justify-between`,children:[R,K]}),t[78]=R,t[79]=K,t[80]=q):q=t[80];let J;t[81]!==p||t[82]!==_||t[83]!==n?(J=p&&_?(0,X.jsx)(`div`,{className:`border-t bg-muted/20 p-4`,children:(0,X.jsx)(ke,{server:n})}):null,t[81]=p,t[82]=_,t[83]=n,t[84]=J):J=t[84];let Y;return t[85]!==q||t[86]!==J?(Y=(0,X.jsxs)(`article`,{className:`rounded-lg border bg-card text-card-foreground shadow-sm/4`,children:[q,J]}),t[85]=q,t[86]=J,t[87]=Y):Y=t[87],Y}function Pe(e){return!e}function Fe(){let e=d(),t=(0,W.useMemo)(()=>e?i(e.environmentId)?.mcp:p().mcp,[e]),[s,c]=(0,W.useState)(null),[m,h]=(0,W.useState)(null),[g,_]=(0,W.useState)(null),[v,y]=(0,W.useState)(!0),[b,x]=(0,W.useState)(!1),[C,w]=(0,W.useState)(null),[T,E]=(0,W.useState)(!1),[D,O]=(0,W.useState)(null),[k,A]=(0,W.useState)(null),j=s?.workspaces??me,M=s?.providers??he,N=(0,W.useMemo)(()=>j.find(e=>e.id===m)??null,[m,j]),re=N?.capabilities,I=Se(N),z=(0,W.useCallback)(async(e,r)=>{r?.quiet||x(!0),A(null);try{let r=await Z(t).listServers({workspaceId:n.make(e),detail:`full`});_(r)}catch(e){A(e instanceof Error?e.message:`Failed to load MCP servers.`),Q(`Failed to load MCP servers`,e)}finally{x(!1)}},[t]),B=(0,W.useCallback)(async()=>{y(!0),A(null);try{let e=await Z(t).listWorkspaces();c(e);let n=e.workspaces.find(e=>e.id===m)?.id??e.workspaces[0]?.id??null;h(n),n?await z(n,{quiet:!0}):_(null)}catch(e){A(e instanceof Error?e.message:`Failed to load MCP workspaces.`),Q(`Failed to load MCP workspaces`,e)}finally{y(!1)}},[z,t,m]);(0,W.useEffect)(()=>{B()},[B]);let H=async()=>{if(!m){await B();return}await z(m)},ie=async()=>{if(m){x(!0);try{let e=await Z(t).reloadServers({workspaceId:n.make(m)});_(e),l.add(R({type:`success`,title:`MCP servers reloaded`}))}catch(e){Q(`Failed to reload MCP servers`,e)}finally{x(!1)}}},U=async e=>{if(!m)return;let i=await Z(t).upsertServer({workspaceId:n.make(m),name:r.make(e.name.trim()),config:de(e),secretMutations:fe(e)});_(i),l.add(R({type:`success`,title:`MCP server saved`}))},ae=async(e,r)=>{if(m){w(e.name);try{let i=await Z(t).setServerEnabled({workspaceId:n.make(m),name:e.name,enabled:r});_(i)}catch(e){Q(`Failed to update MCP server`,e)}finally{w(null)}}},G=async e=>{if(m&&await p().dialogs.confirm(`Remove MCP server "${e.name}"?`)){w(e.name);try{let r=await Z(t).removeServer({workspaceId:n.make(m),name:e.name});_(r),l.add(R({type:`success`,title:`MCP server removed`}))}catch(e){Q(`Failed to remove MCP server`,e)}finally{w(null)}}},K=async e=>{if(m){w(e.name);try{let r=await Z(t).startOauthLogin({workspaceId:n.make(m),serverName:e.name,scopes:e.config.oauthScopes});await p().shell.openExternal(r.authorizationUrl),l.add(R({type:`success`,title:`OAuth login opened`}))}catch(e){Q(`Failed to start OAuth login`,e)}finally{w(null)}}},q=()=>{O(null),E(!0)},J=e=>{O(e),E(!0)};return(0,X.jsxs)(`div`,{className:`flex-1 p-6 sm:p-8`,children:[(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6`,children:[(0,X.jsxs)(`header`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,X.jsx)(S,{className:`size-3.5`}),`Provider MCP`]}),(0,X.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`MCP Servers`}),(0,X.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Manage MCP servers through each provider's native configuration surface. Controls appear only when that provider exposes a reliable operation.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(Ee,{workspaces:j,selectedWorkspaceId:m,onChange:e=>{h(e),z(e)}}),(0,X.jsxs)(ne,{children:[(0,X.jsx)(ee,{render:(0,X.jsx)(a,{size:`icon`,variant:`outline`,onClick:()=>void H(),disabled:v||b,"aria-label":`Refresh MCP servers`,children:(0,X.jsx)(F,{className:o((v||b)&&`animate-spin`)})})}),(0,X.jsx)(te,{children:`Refresh`})]}),re?.reload===`available`?(0,X.jsxs)(a,{variant:`outline`,disabled:!m||b,onClick:()=>void ie(),children:[(0,X.jsx)(L,{}),`Reload`]}):null,re?.upsert===`available`?(0,X.jsxs)(a,{disabled:!m,onClick:q,children:[(0,X.jsx)(V,{}),`Add server`]}):null]})]}),(0,X.jsx)(Oe,{providers:M,selectedWorkspaceId:m,onSelectWorkspace:e=>{h(e),z(e)}}),N?(0,X.jsxs)(`div`,{className:`rounded-lg border bg-muted/20 px-4 py-3 text-xs text-muted-foreground`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,X.jsx)(`span`,{className:`min-w-0 break-all font-mono`,children:N.displayPath}),(0,X.jsxs)(`span`,{children:[N.nativeScope,` scope · `,N.formatGeneration]}),(0,X.jsxs)(`span`,{children:[`Used by`,` `,N.providerInstances.map(e=>e.displayName??e.instanceId).join(`, `)]})]}),g?.configPath?(0,X.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px] text-muted-foreground/70`,children:g.configPath}):null]}):null,s?.issues.length?(0,X.jsx)(`div`,{className:`space-y-2 rounded-lg border border-warning/30 bg-warning/6 p-3`,children:s.issues.map(e=>(0,X.jsxs)(`div`,{className:`flex gap-2 text-xs`,children:[(0,X.jsx)(u,{className:`mt-0.5 size-3.5 text-warning-foreground`}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.instanceId}),`: `,e.message]})]},`${e.instanceId}:${e.message}`))}):null,k?(0,X.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/6 p-3 text-sm text-destructive-foreground`,children:k}):null,N?(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[N.capabilities.health===`available`?null:(0,X.jsxs)(`span`,{children:[`Live health is not reported by `,I,`.`]}),N.capabilities.inventory===`available`?null:(0,X.jsx)(`span`,{children:`Tool and resource inventory is unavailable.`}),N.capabilities.enableDisable===`available`?null:(0,X.jsx)(`span`,{children:`Individual enable/disable is not supported.`})]}):null,v?(0,X.jsx)(`div`,{className:`flex min-h-48 items-center justify-center rounded-lg border border-dashed`,children:(0,X.jsx)(P,{className:`size-5 animate-spin text-muted-foreground`})}):j.length===0?(0,X.jsxs)(`div`,{className:`rounded-lg border border-dashed p-8 text-center`,children:[(0,X.jsx)(S,{className:`mx-auto size-7 text-muted-foreground/60`}),(0,X.jsx)(`h3`,{className:`mt-3 text-sm font-semibold`,children:`No MCP provider profiles`}),(0,X.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm text-muted-foreground/80`,children:`Add or enable a provider instance with a supported MCP configuration surface.`})]}):g?.servers.length===0?(0,X.jsxs)(`div`,{className:`rounded-lg border border-dashed p-8 text-center`,children:[(0,X.jsx)(f,{className:`mx-auto size-7 text-muted-foreground/60`}),(0,X.jsx)(`h3`,{className:`mt-3 text-sm font-semibold`,children:`No MCP servers configured`}),(0,X.jsxs)(`p`,{className:`mx-auto mt-1 max-w-md text-sm text-muted-foreground/80`,children:[`Add a stdio or HTTP server to make its tools available to `,I,`sessions.`]}),re?.upsert===`available`?(0,X.jsxs)(a,{className:`mt-4`,onClick:q,children:[(0,X.jsx)(V,{}),`Add server`]}):null]}):(0,X.jsx)(`div`,{className:`grid gap-3`,children:g?.servers.map(e=>(0,X.jsx)(Ne,{server:e,capabilities:re??{readConfiguration:`unavailable`,upsert:`unavailable`,remove:`unavailable`,enableDisable:`unavailable`,reload:`unavailable`,health:`unavailable`,inventory:`unavailable`,oauth:`unavailable`,externalAgentControl:`unavailable`,automaticAgentControl:`unavailable`,scopes:[]},writable:e.source===`user`||e.source===`project`&&N?.nativeScope===`project`,mutating:C===e.name,onToggleEnabled:(e,t)=>void ae(e,t),onEdit:J,onRemove:e=>void G(e),onOauthLogin:e=>void K(e)},e.name))})]}),(0,X.jsx)(Te,{open:T,server:D,providerName:I,onOpenChange:E,onSubmit:U})]})}export{Fe as McpServersSettings};
@@ -0,0 +1 @@
1
+ import{i as e,t}from"./react-SIfiwpqq.js";import{$c as n,Ao as r,Bc as i,Br as a,Gc as o,Go as s,Hr as c,Mc as l,Nc as u,Qc as d,Tc as f,To as p,bc as m,dc as h,ds as g,gs as _,hs as v,is as y,jc as b,ns as x,os as S,qc as C,rl as w,rs as T,ss as E,tc as D,ts as O,vc as k,vl as A,wa as j,yc as M,zc as N}from"./runtime-BKneT96Q.js";import{t as P}from"./compiler-runtime-qmuS0Svy.js";import{f as F}from"./usePopupViewport-w8BEny9j.js";import{p as I,s as L}from"./useScrollLock-bCmUzTgK.js";import{i as R,n as z,o as B,s as V,t as ee}from"./DialogViewport-C3B2JZWQ.js";import{n as H,r as te,t as ne}from"./DialogTitle-BaxfPC6e.js";import{t as re}from"./useControlled-DQwgzrEC.js";import{t as ie}from"./GlassSurface-CBIEgwt1.js";var U=e(t(),1),W=P(),G=120;function K(e){let t=e.replace(/\s+/gu,` `).trim();return t.length<=G?t:`${t.slice(0,119)}…`}var q=A();function J(e){let t=(0,W.c)(37),{label:n,icon:r,secondaryText:i,trailing:a,disabled:o,disabledReason:s,destructive:l,selected:u,onClick:d,className:f}=e,p=o!==void 0&&o,m=l!==void 0&&l,h=(0,U.useId)(),g;t[0]!==p||t[1]!==s?(g=p&&s?K(s):null,t[0]=p,t[1]=s,t[2]=g):g=t[2];let _=g,v=`${h}-label`,y=`${h}-secondary`,b=`${h}-trailing`,x=`${h}-reason`,S=i?y:null,C=a?b:null,w;t[3]!==v||t[4]!==S||t[5]!==C?(w=[v,S,C].filter(Y),t[3]=v,t[4]=S,t[5]=C,t[6]=w):w=t[6];let T=w.join(` `),E=_?T:void 0,D=_?x:void 0,O=m&&!p&&`text-destructive`,k=u&&`bg-accent/60 font-medium`,A;t[7]!==f||t[8]!==k||t[9]!==O?(A=c(`flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:text-muted-foreground/60`,O,k,f),t[7]=f,t[8]=k,t[9]=O,t[10]=A):A=t[10];let j;t[11]!==n||t[12]!==v?(j=(0,q.jsx)(`span`,{id:v,className:`truncate`,children:n}),t[11]=n,t[12]=v,t[13]=j):j=t[13];let M;t[14]!==y||t[15]!==i?(M=i?(0,q.jsx)(`span`,{id:y,className:`truncate text-xs text-muted-foreground`,children:i}):null,t[14]=y,t[15]=i,t[16]=M):M=t[16];let N;t[17]!==_||t[18]!==x?(N=_?(0,q.jsx)(`span`,{id:x,className:`truncate text-xs text-muted-foreground/80`,children:_}):null,t[17]=_,t[18]=x,t[19]=N):N=t[19];let P;t[20]!==j||t[21]!==M||t[22]!==N?(P=(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[j,M,N]}),t[20]=j,t[21]=M,t[22]=N,t[23]=P):P=t[23];let F;t[24]!==a||t[25]!==b?(F=a?(0,q.jsx)(`span`,{id:b,className:`flex shrink-0 items-center gap-2`,children:a}):null,t[24]=a,t[25]=b,t[26]=F):F=t[26];let I;return t[27]!==p||t[28]!==r||t[29]!==d||t[30]!==u||t[31]!==A||t[32]!==P||t[33]!==F||t[34]!==E||t[35]!==D?(I=(0,q.jsxs)(`button`,{type:`button`,disabled:p,"aria-labelledby":E,"aria-describedby":D,"aria-pressed":u,className:A,"data-slot":`mobile-list-row`,onClick:d,children:[r,P,F]}),t[27]=p,t[28]=r,t[29]=d,t[30]=u,t[31]=A,t[32]=P,t[33]=F,t[34]=E,t[35]=D,t[36]=I):I=t[36],I}function Y(e){return e!==null}var ae=`--nested-drawers`,oe=`--drawer-height`,se=`--drawer-frontmost-height`,ce=`--drawer-swipe-movement-x`,le=`--drawer-swipe-movement-y`,X=`--drawer-snap-point-offset`,ue=`--drawer-swipe-strength`,de=`--drawer-swipe-progress`,fe=U.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=V(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`),d={open:c,transitionStatus:s.useState(`transitionStatus`)};return v(`div`,e,{state:d,ref:[s.context.backdropRef,t],stateAttributesMapping:D,props:[{role:`presentation`,hidden:!u,style:{pointerEvents:c?void 0:`none`,userSelect:`none`,WebkitUserSelect:`none`,[de]:`0`,[ue]:`1`}},o],enabled:a||!l})}),pe=te,me=`data-drawer-content`,he=U.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return V(),v(`div`,e,{ref:t,props:[{[me]:``},a]})}),ge=H,_e=U.createContext(void 0);function ve(){return U.useContext(_e)}var ye=`data-expanded`,be=`data-nested-drawer-open`,Z=`data-nested-drawer-swiping`,xe=`data-swipe-dismiss`,Se=`data-swipe-direction`,Ce=`data-swiping`,we=U.createContext(void 0);function Te(e){let t=U.useContext(we);if(e!==!0&&t===void 0)throw Error(d(90));return t}function Ee(e,t){let n=e+t;return n>=0?t:-Math.sqrt(-n)-e}function Q(e,t,n){if(!Number.isFinite(t)||t<=0)return null;if(typeof e==`number`)return Number.isFinite(e)?e<=1?S(e,0,1)*t:e:null;let r=e.trim();if(r.endsWith(`px`)){let e=Number.parseFloat(r);return Number.isFinite(e)?e:null}if(r.endsWith(`rem`)){let e=Number.parseFloat(r);return Number.isFinite(e)?e*n:null}return null}function De(e,t){let n=-1,r=1/0;for(let i=0;i<e.length;i+=1){let a=Math.abs(e[i]-t);a<r&&(r=a,n=i)}return n}function Oe(){let e=V(),{snapPoints:t,activeSnapPoint:r,setActiveSnapPoint:i,popupHeight:a}=Te(),o=e.useState(`viewportElement`),[s,c]=U.useState(0),[l,d]=U.useState(16),f=C(()=>{let e=u(o).documentElement;c(o?o.offsetHeight:e.clientHeight);let t=parseFloat(getComputedStyle(e).fontSize);Number.isFinite(t)&&d(t)});n(()=>{if(f(),!o||typeof ResizeObserver!=`function`)return;let e=new ResizeObserver(f);return e.observe(o),()=>{e.disconnect()}},[f,o]);let p=U.useMemo(()=>{if(!t||t.length===0||s<=0||a<=0)return[];let e=Math.min(a,s),n=t.map(t=>{let n=Q(t,s,l);if(n===null)return null;let r=S(n,0,e);return{value:t,height:r,offset:Math.max(0,a-r)}}).filter(e=>!!e);if(n.length<=1)return n;let r=[],i=[];for(let e=n.length-1;e>=0;--e){let t=n[e];i.some(e=>Math.abs(e-t.height)<=1)||(i.push(t.height),r.push(t))}return r.reverse(),r},[a,l,t,s]);return{snapPoints:t,activeSnapPoint:r,setActiveSnapPoint:i,popupHeight:a,viewportHeight:s,resolvedSnapPoints:p,activeSnapPointOffset:U.useMemo(()=>{if(r===null)return;let e=p.find(e=>Object.is(e.value,r));if(e)return e;let t=Math.min(a,s),n=Q(r,s,l);if(n===null)return;let i=S(n,0,t);return p[De(p.map(e=>e.height),i)]},[r,a,p,l,s])?.offset??null}}var ke=U.createContext(null);function Ae(){return U.useContext(ke)}var je=!1;function Me(){je||=(typeof CSS<`u`&&`registerProperty`in CSS&&([ce,le,X].forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),[{name:de,initialValue:`0`},{name:ue,initialValue:`1`}].forEach(({name:e,initialValue:t})=>{try{CSS.registerProperty({name:e,syntax:`<number>`,inherits:!1,initialValue:t})}catch{}})),!0)}var Ne={...D,expanded(e){return e?{[ye]:``}:null},nestedDrawerOpen(e){return e?{[be]:``}:null},nestedDrawerSwiping(e){return e?{[Z]:``}:null},swipeDirection(e){return{[Se]:e}},swiping(e){return e?{[Ce]:``}:null}},$=U.forwardRef(function(e,t){let{render:r,className:i,style:a,finalFocus:o,initialFocus:s,...c}=e,l=V(),u=l.context.popupRef,{swipeDirection:d,frontmostHeight:f,hasNestedDrawer:p,nestedSwiping:m,nestedSwipeProgressStore:h,onPopupHeightChange:_,notifyParentFrontmostHeight:y,notifyParentHasNestedDrawer:b}=Te(),x=l.useState(`descriptionElementId`),S=l.useState(`disablePointerDismissal`),T=l.useState(`floatingRootContext`),E=l.useState(`popupProps`),D=l.useState(`modal`),O=l.useState(`mounted`),k=l.useState(`nested`),A=l.useState(`nestedOpenDrawerCount`),j=l.useState(`transitionStatus`),M=l.useState(`open`),N=l.useState(`openMethod`),P=l.useState(`titleElementId`),R=l.useState(`role`),z=T.useState(`floatingId`),ee=c.id??z,H=Ae();B();let{snapPoints:te,activeSnapPoint:ne,activeSnapPointOffset:re}=Oe(),ie=A>0,W=H?.swiping??!1,G=H?.swipeStrength??null,[K,J]=U.useState(0),Y=U.useRef(0),ce=C(()=>{let e=u.current;if(!e)return;let t=e.offsetHeight;if(Y.current>0&&f>Y.current&&t>Y.current)return;if(Y.current>0&&p){let e=Y.current;J(e),_(e);return}let n=t;n!==Y.current&&(Y.current=n,J(n),_(n))});n(()=>{if(!O){Y.current=0,J(0),_(0);return}let e=u.current;if(!e||(Me(),ce(),typeof ResizeObserver!=`function`))return;let t=new ResizeObserver(ce);return t.observe(e),()=>{t.disconnect()}},[ce,O,ie,_,u]),n(()=>{let e=()=>{let e=u.current;if(!e)return;let t=h.getSnapshot();t>0?e.style.setProperty(de,`${t}`):e.style.setProperty(de,`0`)};e();let t=h.subscribe(e),n=u.current;return()=>{t(),n&&n.style.setProperty(de,`0`)}},[h,u]),n(()=>{if(M)return y?.(f),()=>{y?.(0)}},[f,M,y]),n(()=>{if(b)return b(M||j===`ending`),()=>{b(!1)}},[b,M,j]),g({open:M,ref:u,onComplete(){M&&l.context.onOpenChangeComplete?.(!0)}});let fe=s===void 0?u:s,pe=l.useStateSetter(`popupElement`),me={open:M,nested:k,transitionStatus:j,expanded:ne===1,nestedDrawerOpen:ie,nestedDrawerSwiping:m,swipeDirection:d,swiping:W},he;K&&(p||j===`ending`)&&(he=`${K}px`);let ge=te&&te.length>0&&(d===`down`||d===`up`),_e=null;ge&&re!==null&&(_e=d===`up`?-re:re);let ve=H?H.getDragStyles():w;if(ge&&d===`down`){let e=re??0,t=Number.parseFloat(String(ve[le]));ve=W&&Number.isFinite(t)?{...ve,transform:void 0,[le]:`${Ee(e,t)}px`}:{...ve,transform:void 0}}let ye=v(`div`,e,{state:me,props:[E,{id:ee,"aria-labelledby":P,"aria-describedby":x,role:R,...F,hidden:!O,onKeyDown(e){L.has(e.key)&&e.stopPropagation()},style:{...ve,[de]:`0`,[ae]:A,[oe]:he,[X]:typeof _e==`number`?`${_e}px`:`0px`,[se]:f?`${f}px`:void 0,[ue]:typeof G==`number`&&Number.isFinite(G)&&G>0?`${G}`:`1`}},c],ref:[t,u,pe],stateAttributesMapping:Ne});return(0,q.jsx)(I,{context:T,openInteractionType:N,disabled:!O,closeOnFocusOut:!S,initialFocus:fe,returnFocus:o,modal:D!==!1,restoreFocus:`popup`,children:ye})}),Pe=R,Fe,Ie;function Le(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d=null,swipeDirection:f=`down`,snapToSequentialPoints:m=!1,snapPoints:h,snapPoint:g,defaultSnapPoint:_,onSnapPointChange:v}=e,y=Te(!0),b=y?.onNestedSwipeProgressChange,x=y?.onNestedFrontmostHeightChange,S=y?.onNestedSwipingChange,w=y?.onNestedDrawerPresenceChange,[T,E]=U.useState(0),[D,O]=U.useState(0),[k,A]=U.useState(!1),[j,M]=U.useState(!1),[N]=U.useState(Re),P=_===void 0?h?.[0]??null:_,F=g!==void 0,[I,L]=re({controlled:g,default:P,name:`Drawer`,state:`snapPoint`}),R=U.useRef(!1),B=U.useRef(!1),V=C((e,t)=>{let n=t??p(`none`);v?.(e,n),!n.isCanceled&&L(e)}),ee=U.useMemo(()=>F||!h||h.length===0?I:I===null||!h.some(e=>Object.is(e,I))?P:I,[I,F,P,h]),H=C(e=>{E(e),!R.current&&e>0&&O(e)}),te=C(e=>{if(e>0){R.current=!0,O(e);return}R.current=!1,T>0&&O(T)}),ne=C(e=>{A(e)}),ie=C(e=>{N.set(e),b?.(e)}),W=C(e=>{M(e),S?.(e)}),G=C((e,t)=>{i?.(e,t),!t.isCanceled&&!e&&h&&h.length>0&&V(P,p(t.reason,t.event,t.trigger))}),K=U.useMemo(()=>({swipeDirection:f,swipeAreaActiveRef:B,snapToSequentialPoints:m,snapPoints:h,activeSnapPoint:ee,setActiveSnapPoint:V,frontmostHeight:D,popupHeight:T,hasNestedDrawer:k,nestedSwiping:j,nestedSwipeProgressStore:N,onNestedDrawerPresenceChange:ne,onPopupHeightChange:H,onNestedFrontmostHeightChange:te,onNestedSwipingChange:W,onNestedSwipeProgressChange:ie,notifyParentFrontmostHeight:x,notifyParentSwipingChange:S,notifyParentSwipeProgressChange:b,notifyParentHasNestedDrawer:w}),[ee,D,k,j,N,w,b,S,x,ne,te,ie,W,H,T,V,h,m,B,f]),J=typeof t==`function`?e=>(0,q.jsxs)(U.Fragment,{children:[Fe||=(0,q.jsx)(ze,{}),t(e)]}):(0,q.jsxs)(U.Fragment,{children:[Ie||=(0,q.jsx)(ze,{}),t]}),Y=z(`drawer`,{open:n,defaultOpen:r,onOpenChange:G,onOpenChangeComplete:a,disablePointerDismissal:o,modal:s,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d,children:J});return(0,q.jsx)(we.Provider,{value:K,children:Y})}function Re(){let e=0,t=new Set;return{getSnapshot:()=>e,set(n){let r=Number.isFinite(n)?n:0;r!==e&&(e=r,t.forEach(e=>{e()}))},subscribe(e){return t.add(e),()=>{t.delete(e)}}}}function ze(){let e=ve(),t=V(!1),i=e?.setDrawerOpen,a=e?.removeDrawer,o=t.useState(`open`),s=t.useState(`nestedOpenDialogCount`),c=t.useState(`popupElement`),u=s===0;return n(()=>{if(a)return()=>{a(t)}},[a,t]),n(()=>{i?.(t,o)},[o,i,t]),U.useEffect(()=>{if(!o||!u||!f)return;let e=N(c).CloseWatcher;if(!e)return;function n(e){t.select(`open`)&&t.setOpen(!1,p(r,e))}let i=new e,a=l(i,`close`,n);return()=>{a(),i.destroy()}},[t,u,o,c]),null}var Be=ne,Ve=e(o(),1),He=`data-nested-dialog-open`,Ue=U.createContext(void 0);function We(){return U.useContext(Ue)}var Ge=10,Ke=.5,qe=.5,Je=300,Ye=4,Xe=.2,Ze=4,Qe=80,$e=360,et=.1,tt=6,nt=2,rt=`[${me}]`,it=U.forwardRef(function(e,t){let{render:r,className:a,style:o,children:c,...d}=e,f=V(),g=f.context.popupRef,v=f.context.backdropRef,{swipeDirection:w,notifyParentSwipingChange:E,notifyParentSwipeProgressChange:D,frontmostHeight:k,snapToSequentialPoints:A,swipeAreaActiveRef:j}=Te(),N=ve(),{snapPoints:P,resolvedSnapPoints:F,activeSnapPoint:I,activeSnapPointOffset:L,setActiveSnapPoint:R,popupHeight:z}=Oe(),B=f.useState(`open`),H=f.useState(`mounted`),te=f.useState(`nested`),ne=f.useState(`nestedOpenDrawerCount`),re=f.useState(`viewportElement`),ie=f.useState(`popupElement`),W=N?.visualStateStore,G=ne>0,K=w===`left`||w===`right`?`horizontal`:`vertical`,J=K===`vertical`,Y=J?`horizontal`:`vertical`,[ae,se]=U.useState(null),X=U.useRef(void 0),ue=U.useRef(null),fe=b(),pe=U.useRef(!1),me=U.useRef(!1),he=U.useRef(``),ge=U.useRef(!1),_e=U.useRef(!1),ye=U.useRef(null),be=We(),Z=U.useMemo(()=>{if(!P||P.length<2||F.length<2||w!==`down`&&w!==`up`)return null;let e=F.map(e=>e.offset).sort((e,t)=>e-t),t=e[0];return{minOffset:t,range:e[1]-t}},[F,P,w]),Se=U.useMemo(()=>!Z||L===null?null:S((L-Z.minOffset)/Z.range,0,1),[L,Z]),Ce=U.useMemo(()=>P&&P.length>0&&(w===`down`||w===`up`)?w===`down`?[`down`,`up`]:[`up`,`down`]:[w],[P,w]),we=C(e=>{g.current?.toggleAttribute(xe,e),v.current?.toggleAttribute(xe,e)}),Q=C(()=>{we(!1),g.current?.removeAttribute(h),se(null)}),Ae=C(()=>{me.current&&(me.current=!1,E?.(!1))}),je=C((e,t,n)=>{let r=B&&!te&&t,i=r?e:0,a=B&&t?e:0;n&&D&&(D(a),a<=0&&Ae()),W?.set({swipeProgress:i,frontmostHeight:i>0?k:0});let o=v.current;if(!o)return;let s=r&&i>0;o.style.setProperty(de,s?`${i}`:`0`),s&&k>0?o.style.setProperty(oe,`${k}px`):o.style.removeProperty(oe)});function Me(e,t,n,r,i,a,o,s){let c=ct(e,t);if(c<=0)return null;let l=((t===`down`||t===`up`)&&P&&P.length>0?L??0:0)+O(t,n,r),u=Math.max(0,c-l);if(u<=0)return null;let d=O(t,o,s),f=Math.abs(d)>0?d:O(t,i,a);if(f<=Xe)return null;let p=S(f,Xe,Ze);return et+(S(u/p,Qe,$e)-Qe)/280*.9}function Ne(e){if(me.current||!e)return;let t=e.direction??w,n=O(t,e.deltaX,e.deltaY);Math.abs(n)<Ge||(me.current=!0,E?.(!0))}let $=x({enabled:H&&!G,directions:Ce,elementRef:f.context.popupRef,ignoreSelectorWhenTouch:!1,ignoreScrollableAncestors:!0,movementCssVars:{x:ce,y:le},onSwipeStart(e){if(`touches`in e||e.pointerType===`touch`)return;let t=g.current,n=u(t).getSelection?.();if(!n||n.isCollapsed)return;let r=i(n.anchorNode)?n.anchorNode:n.anchorNode?.parentElement,a=i(n.focusNode)?n.focusNode:n.focusNode?.parentElement;(M(t,r)||M(t,a))&&n.removeAllRanges()},onSwipingChange(e){pe.current=e,at(f.context.backdropRef.current,e),!e&&!D&&Ae()},swipeThreshold({element:e,direction:t}){return lt(e,t)},canStart(e,t){let n=f.context.popupRef.current;if(!n)return!1;let r=n.ownerDocument,i=T(n.getRootNode(),e.x,e.y);if(!i||!M(n,i))return!1;let a=t.nativeEvent;return!((`touches`in a||a.pointerType===`touch`)&&pt(r,n))},onProgress(e,t){let n=pe.current;n&&Ne(t);let r=!!(P&&P.length>0);if(n&&w===`down`&&r&&t){let e=f.context.popupRef.current;e&&(e.style.removeProperty(`transform`),e.style.setProperty(le,`${Ee(L??0,t.deltaY)}px`))}let i=e;if(Z&&z>0){let e=L??Z.minOffset;n&&t&&Number.isFinite(t.deltaY)?i=(e=>S((e-Z.minOffset)/Z.range,0,1))(S(e+t.deltaY,0,z)):Se!==null&&(i=Se)}n||(D?.(0),Ae()),je(i,!0,n)},onRelease({event:e,deltaX:t,deltaY:n,direction:r,velocityX:i,velocityY:a,releaseVelocityX:o,releaseVelocityY:c}){let l=f.context.popupRef.current;if(!l){Q();return}let u=l;function d(e){Ae(),we(!0),u.style.removeProperty(`transition`),u.setAttribute(h,``),Ve.flushSync(()=>{se(Me(u,e,t,n,i,a,o,c))})}if(!P||P.length===0){if(!r){Q();return}let e=O(r,t,n);if(e<=0)return Q(),!1;if(O(r,i,a)>=Ke)return d(r),!0;let o=e>lt(u,r);return o?d(r):Q(),o}if(w!==`down`&&w!==`up`){Q();return}if(!z)return Q(),!1;if(F.length===0){Q();return}let m=w===`down`?n:-n,g=Math.sign(m),_=w===`down`?c:-c,v=w===`down`?a:-a,y=_;if(g!==0&&Math.abs(m)>=Ge){let e=Math.sign(y);e!==0&&e!==g&&(y=v)}let b=L??0,x=S(b+m,0,z),C=Math.abs(y)>=qe?S(y,-4,Ye)*Je:0,T=A?x:S(x+C,0,z),E=p(s,e),D=()=>(je(0,!0,!0),Q(),!1),k=e=>(R(e.value,E),D()),j=e=>r?(R(null,E),E.isCanceled?D():(X.current=I,d(w),!0)):k(e);if(A){let e=[...F].sort((e,t)=>e.offset-t.offset),t=e.map(e=>e.offset),n=De(t,b),r=e[De(t,T)],i=Math.sign(y),a=g!==0&&i!==0&&i===g&&Math.abs(y)>=qe,o=T;if(a){let t=S(n+g,0,e.length-1);if(t!==n){let n=e[t];(g>0?T<n.offset:T>n.offset)&&(r=n,o=n.offset)}else if(g>0)return j(r)}return Math.abs(o-z)<Math.abs(o-r.offset)?j(r):k(r)}let M=F[De(F.map(e=>e.offset),T)];return y>=Ke&&m>0||Math.abs(T-z)<Math.abs(T-M.offset)?j(M):k(M)},onDismiss(e){W?.set({swipeProgress:0,frontmostHeight:0});let t=f.context.backdropRef.current;t&&(t.style.setProperty(de,`0`),t.style.removeProperty(oe));let n=p(s,e);if(f.setOpen(!1,n),n.isCanceled){let t=X.current;t!==void 0&&R(t,p(s,e)),X.current=void 0,ue.current?.(),Q();return}if(f.select(`open`)){let t=e;fe.request(()=>{if(f.select(`open`)){let e=X.current;e!==void 0&&R(e,p(s,t)),X.current=void 0,Q(),ue.current?.()}else X.current=void 0});return}X.current=void 0,we(!0)}}),Pe=$.getPointerProps(),Fe=$.getTouchProps(),{moveNative:Ie,reset:Le}=$;ue.current=Le,U.useEffect(()=>{let e=re??ie;if(!e)return;let t=e,n=u(t);function r(e,r,i){let a=J?i.clientY-r.lastY:i.clientX-r.lastX;if(e.touches.length===2||pt(n,t)||!B||!H||G||_t(r,e,i,J))return;let o=r.scrollTarget;if(!o||o===n.documentElement||o===n.body){e.cancelable&&e.preventDefault(),e.stopPropagation(),Ie(e,t);return}if(!vt(o,K)){e.cancelable&&e.preventDefault(),e.stopPropagation();return}if(a!==0){let t=xt(o,K,w,a);r.allowSwipe?e.cancelable&&e.preventDefault():e.cancelable&&t?(r.allowSwipe=!0,e.preventDefault()):r.allowSwipe=!1}r.allowSwipe===!0&&(e.stopPropagation(),Ie(e,t))}function i(e){if(be?.onTouchMove(e),_e.current)return;let t=ye.current,n=e.touches[0];n&&t&&(r(e,t,n),gt(t,n))}return l(n,`touchmove`,i,{passive:!1,capture:!0})},[H,G,B,ie,J,K,w,Ie,re,be]),n(()=>{Z&&!$.swiping&&je(!B||te?0:Se??0,!0,!1)},[je,k,te,D,B,Se,Z,$.swiping,f,W]),n(()=>{if(D)return B||D(0),()=>{D(0)}},[D,B]),n(()=>{B&&(j.current||Le(),Q())},[Q,B,Le,j]),n(()=>{let e=v.current;return()=>{W?.set({swipeProgress:0,frontmostHeight:0}),at(e,!1);let t=v.current;t!==e&&at(t,!1),Ae()}},[v,Ae,W]);let Re=U.useMemo(()=>({swiping:$.swiping,getDragStyles:$.getDragStyles,swipeStrength:ae??null,setSwipeDismissed:we}),[we,$.getDragStyles,$.swiping,ae]);function ze(e){_e.current=e,ye.current=null}function Be(){ze(!1),he.current=``,ge.current=!1}function Ue(e){return he.current=``,e.pointerType!==`touch`}return(0,q.jsx)(ee,{ref:t,className:a,style:o,render:r,..._(d,{onPointerDown(e){if(he.current=e.pointerType,ge.current=e.pointerType===`pen`,!B||!H||G)return;let t=T(e.currentTarget.getRootNode(),e.clientX,e.clientY);ot(t)||st(t)||e.pointerType!==`touch`&&Pe.onPointerDown?.(e)},onPointerMove(e){e.pointerType!==`touch`&&Pe.onPointerMove?.(e)},onPointerUp(e){Ue(e)&&Pe.onPointerUp?.(e)},onPointerCancel(e){Ue(e)&&Pe.onPointerCancel?.(e)},onTouchStart(e){if(he.current===`pen`&&ge.current){ge.current=!1,ze(!1);return}if(!B||!H||G){ze(!1);return}let t=e.touches[0];if(!t)return;if(ht(e)){ze(!1);return}let n=e.currentTarget,r=T(n.getRootNode(),t.clientX,t.clientY),a=m(e.nativeEvent),o=i(a)?a:n;if(!M(n,o)){ze(!0);return}if(be?.onTouchStart(e),ot(r)){ze(!0);return}_e.current=!1;let s=y(o,n,K),c=y(o,n,Y)!=null,l=null;s&&(l=bt(s,K,w)?null:!1),ye.current={startX:t.clientX,startY:t.clientY,lastX:t.clientX,lastY:t.clientY,scrollTarget:s,hasCrossAxisScrollableContent:c,allowSwipe:l,preserveNativeCrossAxisScroll:!1,drawerAxisAttributed:!1},Fe.onTouchStart?.(e)},onTouchEnd(e){be?.onTouchEnd(e),Be(),Fe.onTouchEnd?.(e)},onTouchCancel(e){be?.onTouchCancel(),Be(),Fe.onTouchCancel?.(e)},[He]:void 0}),children:(0,q.jsx)(ke.Provider,{value:Re,children:c})})});function at(e,t){e?.toggleAttribute(Ce,t)}function ot(e){return!!e?.closest(E)}function st(e){return!!e?.closest(rt)}function ct(e,t){return t===`left`||t===`right`?e.offsetWidth:e.offsetHeight}function lt(e,t){return Math.max(ct(e,t)*.5,Ge)}function ut(e,t){return e instanceof t.HTMLInputElement&&e.type===`range`}function dt(e){return e.tagName===`INPUT`||e.tagName===`TEXTAREA`}function ft(e,t){let n=i(e.anchorNode)?e.anchorNode:e.anchorNode?.parentElement,r=i(e.focusNode)?e.focusNode:e.focusNode?.parentElement;return e.containsNode(t,!0)||M(t,n)||M(t,r)}function pt(e,t){let n=k(e);if(n&&M(t,n)&&dt(n)){let{selectionStart:e,selectionEnd:t}=n;if(e!=null&&t!=null&&e<t)return!0}let r=e.getSelection?.();return!r||r.isCollapsed?!1:ft(r,t)}function mt(e,t){return e.composedPath().some(e=>ut(e,t))}function ht(e){return mt(e.nativeEvent,N(e.currentTarget))}function gt(e,t){e.lastX=t.clientX,e.lastY=t.clientY}function _t(e,t,n,r){if(e.preserveNativeCrossAxisScroll)return!0;if(e.drawerAxisAttributed||e.allowSwipe===!0||!e.hasCrossAxisScrollableContent)return!1;if(!t.cancelable)return e.preserveNativeCrossAxisScroll=!0,!0;let i=r?n.clientY-e.startY:n.clientX-e.startX,a=r?n.clientX-e.startX:n.clientY-e.startY,o=Math.abs(i),s=Math.abs(a);return s>=tt&&s>o+nt?(e.preserveNativeCrossAxisScroll=!0,!0):o>=tt?(e.drawerAxisAttributed=!0,!1):!0}function vt(e,t){return yt(e,t).max>0}function yt(e,t){if(t===`vertical`){let t=Math.max(0,e.scrollHeight-e.clientHeight);return{offset:e.scrollTop,max:t}}let n=Math.max(0,e.scrollWidth-e.clientWidth);return{offset:e.scrollLeft,max:n}}function bt(e,t,n){let r=St(n,t),{offset:i,max:a}=yt(e,t);return r?i<=0:i>=a}function xt(e,t,n,r){return(St(n,t)?r>0:r<0)&&bt(e,t,n)}function St(e,t){return t===`vertical`?e===`down`:e===`right`}var Ct=.5,wt=1,Tt=[Ct,wt];function Et(e){return e===`medium`?Ct:wt}function Dt(e){return e==null?null:e===Ct?`medium`:`large`}function Ot(e){let t=(0,W.c)(23),{open:n,onOpenChange:r,label:i,detent:o,onDetentChange:s,activeDetent:l,className:u,children:d}=e,f=o===void 0?`large`:o,p;t[0]===f?p=t[1]:(p=Et(f),t[0]=f,t[1]=p);let m;t[2]===l?m=t[3]:(m=l===void 0?{}:{snapPoint:l===null?null:Et(l)},t[2]=l,t[3]=m);let h;t[4]===s?h=t[5]:(h=e=>s?.(Dt(e)),t[4]=s,t[5]=h);let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,q.jsx)(fe,{className:c(`app-sheet-backdrop fixed inset-0 z-50 backdrop-blur-sm`,`transition-opacity duration-[var(--app-motion-duration-sheet)] ease-[var(--app-motion-ease)] data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none`),"data-slot":`mobile-sheet-backdrop`}),t[6]=g):g=t[6];let _;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=c(`pointer-events-auto fixed inset-0 z-50 flex flex-col justify-end pt-12`,`pb-[var(--app-keyboard-inset,0px)]`),t[7]=_):_=t[7];let v;t[8]===u?v=t[9]:(v=c(ie(`sheet`),`pointer-events-auto flex max-h-full min-h-0 w-full min-w-0 flex-col rounded-t-2xl border-t not-dark:bg-clip-padding text-popover-foreground shadow-lg/5`,`pb-safe pl-safe pr-safe`,`translate-y-[calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y,0px))] data-ending-style:translate-y-full data-starting-style:translate-y-full`,`transition-[translate,scale] duration-[var(--app-motion-duration-sheet)] ease-[var(--app-motion-ease)] will-change-transform motion-reduce:transition-none`,`data-nested-drawer-open:scale-96`,u),t[8]=u,t[9]=v);let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,q.jsx)(`span`,{"aria-hidden":!0,className:`mx-auto mt-2 mb-1 h-1 w-9 shrink-0 rounded-full bg-muted-foreground/32`,"data-slot":`mobile-sheet-grabber`}),t[10]=y):y=t[10];let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,q.jsx)(pe,{"aria-label":`Close`,className:`absolute end-2 top-2 z-20`,"data-slot":`mobile-sheet-close`,render:(0,q.jsx)(a,{size:`icon`,variant:`ghost`}),children:(0,q.jsx)(j,{})}),t[11]=b):b=t[11];let x;t[12]!==d||t[13]!==i||t[14]!==v?(x=(0,q.jsxs)(Pe,{children:[g,(0,q.jsx)(it,{className:_,"data-slot":`mobile-sheet-viewport`,children:(0,q.jsxs)($,{"aria-label":i,className:v,"data-slot":`sheet-popup`,"data-mobile-sheet":``,onKeyDown:kt,children:[y,d,b]})})]}),t[12]=d,t[13]=i,t[14]=v,t[15]=x):x=t[15];let S;return t[16]!==r||t[17]!==n||t[18]!==x||t[19]!==p||t[20]!==m||t[21]!==h?(S=(0,q.jsx)(Le,{open:n,onOpenChange:r,swipeDirection:`down`,snapPoints:Tt,defaultSnapPoint:p,...m,onSnapPointChange:h,children:x}),t[16]=r,t[17]=n,t[18]=x,t[19]=p,t[20]=m,t[21]=h,t[22]=S):S=t[22],S}function kt(e){e.stopPropagation()}function At(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=c(`flex shrink-0 flex-col gap-1 px-4 pt-2 pe-11 pb-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,q.jsx)(`div`,{className:i,"data-slot":`mobile-sheet-header`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function jt(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=c(`truncate font-heading font-semibold text-base leading-tight`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,q.jsx)(Be,{className:i,"data-slot":`mobile-sheet-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Mt(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=c(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,q.jsx)(ge,{className:i,"data-slot":`mobile-sheet-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Nt(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=c(`min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 pb-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,q.jsx)(he,{className:i,"data-slot":`mobile-sheet-panel`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Pt(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=c(`flex shrink-0 flex-col-reverse gap-2 px-4 pt-3 pb-2 sm:flex-row`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,q.jsx)(`div`,{className:i,"data-slot":`mobile-sheet-footer`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}export{Nt as a,K as c,At as i,Mt as n,jt as o,Pt as r,J as s,Ot as t};