decocms 4.95.2 → 4.96.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/dist/client/assets/{AlertCircle-8aL2p4Jm.js → AlertCircle-COm2lZmB.js} +1 -1
  2. package/dist/client/assets/{AreaChart-CH1JlaHA.js → AreaChart-BHulL81d.js} +1 -1
  3. package/dist/client/assets/{ArrowRight-BmTkQdSS.js → ArrowRight-BBZ4k1tZ.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-BRv6jMcd.js → ArrowUp-CIDj-geR.js} +1 -1
  5. package/dist/client/assets/{ArrowUpRight-DgWDf4bB.js → ArrowUpRight-CZl49s-_.js} +1 -1
  6. package/dist/client/assets/{Check-xlx8bieA.js → Check-BCiV8JPd.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-BhHr7P8S.js → CheckCircle-BrCHMLmT.js} +1 -1
  8. package/dist/client/assets/{ChevronDown-z_OgoJuG.js → ChevronDown-DMrJ8qUd.js} +1 -1
  9. package/dist/client/assets/{ChevronRight-HByc-_dD.js → ChevronRight-DQPMDbxY.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-C0dubflE.js → ChevronUp-B4eyFU9D.js} +1 -1
  11. package/dist/client/assets/{Copy01-BhLnIcPa.js → Copy01-B5PsaZtC.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-9e8whEmO.js → DotsVertical-CaiMMtiU.js} +1 -1
  13. package/dist/client/assets/{Eye-Dmrq3Yx3.js → Eye-BtZsG05u.js} +1 -1
  14. package/dist/client/assets/{FilterLines-LxfJFt1s.js → FilterLines-R3LckEdX.js} +1 -1
  15. package/dist/client/assets/{Globe01-C1OI0rNn.js → Globe01-BBalwuJ-.js} +1 -1
  16. package/dist/client/assets/{Globe04-D37KO3Rl.js → Globe04-BoTer0PL.js} +1 -1
  17. package/dist/client/assets/{HardDrive-xaUFGQWK.js → HardDrive-B-gJ3Ugg.js} +1 -1
  18. package/dist/client/assets/{Image01-D2MElAgS.js → Image01-vVeK01uU.js} +1 -1
  19. package/dist/client/assets/{Key01-CJ4v8ToT.js → Key01-LGwwdQ_o.js} +1 -1
  20. package/dist/client/assets/{LayoutLeft-BXx4559W.js → LayoutLeft-DSvzQ3F0.js} +1 -1
  21. package/dist/client/assets/{LinkExternal01-RdFrwyl0.js → LinkExternal01-DAa_z87G.js} +1 -1
  22. package/dist/client/assets/{Monitor01-ByOW8gCA.js → Monitor01-Cp0O-ipq.js} +1 -1
  23. package/dist/client/assets/{Package-BApyVZZF.js → Package-Do8Z10X9.js} +1 -1
  24. package/dist/client/assets/{Palette-gwCbQEVd.js → Palette-BxScKXfV.js} +1 -1
  25. package/dist/client/assets/{Play-CRcD5urt.js → Play-DxmYkTCO.js} +1 -1
  26. package/dist/client/assets/{Plus-CpvaryXc.js → Plus-DdMyRgmA.js} +1 -1
  27. package/dist/client/assets/{SearchLg-BLbYMh4R.js → SearchLg-Cuf8OlKN.js} +1 -1
  28. package/dist/client/assets/{SearchMd-BbTMkDIb.js → SearchMd-DXtYkdlk.js} +1 -1
  29. package/dist/client/assets/{Settings02-CoD4T3JT.js → Settings02-7Lan3xs5.js} +1 -1
  30. package/dist/client/assets/{Shield01-BSQ914Nd.js → Shield01-DA0MY5vq.js} +1 -1
  31. package/dist/client/assets/{Star01-B_ldc-QG.js → Star01-DOEEbMVN.js} +1 -1
  32. package/dist/client/assets/{Stars01-BEQN6TZj.js → Stars01-C_W_4866.js} +1 -1
  33. package/dist/client/assets/{Stars02-wl-TgjVw.js → Stars02-D0cgeCkL.js} +1 -1
  34. package/dist/client/assets/{Sun-DcglW2RF.js → Sun-DWZWERXA.js} +1 -1
  35. package/dist/client/assets/{SwitchHorizontal01-BjhVVVE7.js → SwitchHorizontal01-Du8IH-As.js} +1 -1
  36. package/dist/client/assets/{Tool01-F8NWFSUY.js → Tool01-l46KKmTp.js} +1 -1
  37. package/dist/client/assets/{Tool02-CYQFsqUw.js → Tool02-Bedsr6M0.js} +1 -1
  38. package/dist/client/assets/{Trash01-CFIi5PAY.js → Trash01--AWxA30K.js} +1 -1
  39. package/dist/client/assets/{TrendUp01-B11vKIzx.js → TrendUp01-BYfwoU6O.js} +1 -1
  40. package/dist/client/assets/{Upload01-CYv9Q0Sh.js → Upload01-D8P_FbUI.js} +1 -1
  41. package/dist/client/assets/{User01-BHW_CvWq.js → User01-5weGoSXw.js} +1 -1
  42. package/dist/client/assets/{Users01-CVvGtppm.js → Users01-DZAmzF4m.js} +1 -1
  43. package/dist/client/assets/{Users03-Bg-uyP8J.js → Users03-CHsFtqWs.js} +1 -1
  44. package/dist/client/assets/{X-B9OMbRgI.js → X-CxPemOwM.js} +1 -1
  45. package/dist/client/assets/{XCircle-z2zpbAQl.js → XCircle-CDWV_SjD.js} +1 -1
  46. package/dist/client/assets/{XClose-Bvx5TP10.js → XClose-Bg6DW9hR.js} +1 -1
  47. package/dist/client/assets/{Zap-CaoQpAZT.js → Zap-rnKuI319.js} +1 -1
  48. package/dist/client/assets/{ZapSquare-NmRRaYpN.js → ZapSquare-C99XNWC0.js} +1 -1
  49. package/dist/client/assets/{ZoomOut-Bjuv5wtp.js → ZoomOut-BtgkZIdX.js} +1 -1
  50. package/dist/client/assets/{access-gate-CSvdc98W.js → access-gate-D8KChbp3.js} +1 -1
  51. package/dist/client/assets/{add-section-modal-BlKiDhBw.js → add-section-modal-CKg7cLJG.js} +1 -1
  52. package/dist/client/assets/{agent-icon-kMrNxjYJ.js → agent-icon-BT1zF5P3.js} +1 -1
  53. package/dist/client/assets/{agents-list-4wX4J2kJ.js → agents-list-BR8AXMAN.js} +1 -1
  54. package/dist/client/assets/{ai-providers-Dj7ASIds.js → ai-providers-B0qYRWtH.js} +1 -1
  55. package/dist/client/assets/{alert-dialog-lT11Jsbj.js → alert-dialog-DEnhZkxC.js} +1 -1
  56. package/dist/client/assets/{alert-CgsPHe2o.js → alert-jpiPBvPb.js} +1 -1
  57. package/dist/client/assets/{app-editor-B3W7tylT.js → app-editor-ymCUniB3.js} +1 -1
  58. package/dist/client/assets/{auth-CaW_gj1t.js → auth-Dpm13msT.js} +1 -1
  59. package/dist/client/assets/{auth-catchall-CWTTCQsz.js → auth-catchall-Dp-Z6OBK.js} +1 -1
  60. package/dist/client/assets/{auth-entry-IJFQq8w-.js → auth-entry-Iv9irsmg.js} +1 -1
  61. package/dist/client/assets/{auth-split-layout-C25aJ8eh.js → auth-split-layout-DUy5YYuI.js} +1 -1
  62. package/dist/client/assets/{authenticate-and-persist-oauth-jkSUOcu8.js → authenticate-and-persist-oauth-tFM75nwm.js} +1 -1
  63. package/dist/client/assets/{automation-list-row-QQUoi2db.js → automation-list-row-PSWL7lW8.js} +1 -1
  64. package/dist/client/assets/{automation-runs-Cs7mheBT.js → automation-runs-D7nJ8Op4.js} +1 -1
  65. package/dist/client/assets/{automations-BzzWpoAs.js → automations-DnlehJe2.js} +1 -1
  66. package/dist/client/assets/{autosend-CSO0mWVp.js → autosend-5yjjVuXH.js} +1 -1
  67. package/dist/client/assets/{avatar-BHNRf2BK.js → avatar-Dd_lcUPB.js} +1 -1
  68. package/dist/client/assets/{badge-0FaSmMEN.js → badge-BnJCnUD8.js} +1 -1
  69. package/dist/client/assets/{block-document-BV8UCOiY.js → block-document-C0l7PNZ0.js} +1 -1
  70. package/dist/client/assets/{brand-context-CnL-EXLr.js → brand-context-DU_mswaw.js} +1 -1
  71. package/dist/client/assets/{buckets-BhRo2ooL.js → buckets-BFFyGGeL.js} +1 -1
  72. package/dist/client/assets/{bulk-category-panel-CzxYutCW.js → bulk-category-panel-B8kTStQq.js} +1 -1
  73. package/dist/client/assets/{calendar-ajXRpj7H.js → calendar-DtjbMMgU.js} +1 -1
  74. package/dist/client/assets/{capability-load-error-D08tgLJn.js → capability-load-error-BmpPvd8c.js} +1 -1
  75. package/dist/client/assets/{card-CxpjTUKu.js → card-BwdKy-hR.js} +1 -1
  76. package/dist/client/assets/{category-editor-VzyKXFmI.js → category-editor-Czkxrk9G.js} +1 -1
  77. package/dist/client/assets/{chat-context-BKkLQtRB.js → chat-context-BHNmEZsh.js} +1 -1
  78. package/dist/client/assets/{checkbox-9SStA5q1.js → checkbox-BferAkrG.js} +1 -1
  79. package/dist/client/assets/{cli-auth-success-DMtwNV80.js → cli-auth-success-DTV-1TPc.js} +1 -1
  80. package/dist/client/assets/{collection-detail-CjiPw-t8.js → collection-detail-DXVEHtg9.js} +1 -1
  81. package/dist/client/assets/{collection-display-button-BkQRfMlH.js → collection-display-button-k8fcuck5.js} +1 -1
  82. package/dist/client/assets/{collection-search-DZDCl18y.js → collection-search-Bpntk__o.js} +1 -1
  83. package/dist/client/assets/{collection-table-wrapper-3CLNdiVr.js → collection-table-wrapper-BHhNorkb.js} +1 -1
  84. package/dist/client/assets/{collection-tabs-C2iwwrh8.js → collection-tabs-C8z4HcKC.js} +1 -1
  85. package/dist/client/assets/{command-Dv4-KFR5.js → command-gbaqtfOq.js} +1 -1
  86. package/dist/client/assets/{commerce-onboarding-Cw_rAIUN.js → commerce-onboarding-8viMUGwZ.js} +1 -1
  87. package/dist/client/assets/{companions-core-AOH9czLM.js → companions-core-BtjdkIUe.js} +1 -1
  88. package/dist/client/assets/{connect-Cqt8XvcG.js → connect-Diu8OWo2.js} +1 -1
  89. package/dist/client/assets/{connect-desktop-dialog-CcP2o0mO.js → connect-desktop-dialog-BI2A8aVe.js} +1 -1
  90. package/dist/client/assets/{connection-card-DSeJr6d2.js → connection-card-e6lVAOde.js} +1 -1
  91. package/dist/client/assets/{connection-detail-D0NuPfPl.js → connection-detail-CIahkRzz.js} +1 -1
  92. package/dist/client/assets/{connection-form-helpers-Ce26XCbs.js → connection-form-helpers-DITTUByC.js} +1 -1
  93. package/dist/client/assets/{connections-CaxsgoYU.js → connections-CtqoWFfL.js} +1 -1
  94. package/dist/client/assets/{decopilot-sse-pool-DWXTDK7c.js → decopilot-sse-pool-BBRtwl-P.js} +1 -1
  95. package/dist/client/assets/{dialog-B8iPXZfB.js → dialog-CkrS5RCd.js} +1 -1
  96. package/dist/client/assets/{domain-settings-DkOZ5_VY.js → domain-settings-Ime3dkR3.js} +1 -1
  97. package/dist/client/assets/{drawer-D5z1QpZ1.js → drawer-DvI0Qijj.js} +1 -1
  98. package/dist/client/assets/{dropdown-menu-D3W9Mypw.js → dropdown-menu-DNr9TTIb.js} +1 -1
  99. package/dist/client/assets/{empty-state-B0XUVWqe.js → empty-state-B9-HAyiA.js} +1 -1
  100. package/dist/client/assets/{extract-connection-data-ChcGsUj8.js → extract-connection-data-BWpGE_oz.js} +1 -1
  101. package/dist/client/assets/{file-explorer-DIO_SQJ1.js → file-explorer-Dw5LCrgo.js} +1 -1
  102. package/dist/client/assets/{file-type-icon-CICh64eJ.js → file-type-icon-vfT_G6Zj.js} +1 -1
  103. package/dist/client/assets/{files-Cql2muKm.js → files-BJH0SQpm.js} +1 -1
  104. package/dist/client/assets/{form-BbtpCekf.js → form-CWd6cwuX.js} +1 -1
  105. package/dist/client/assets/{general-DPD4y6iK.js → general-DJMbTsHe.js} +1 -1
  106. package/dist/client/assets/{github-repo-picker-qhKlxIkP.js → github-repo-picker-1uhdNA5f.js} +1 -1
  107. package/dist/client/assets/{hooks-QkqjVdn8.js → hooks-NSDTMWs-.js} +1 -1
  108. package/dist/client/assets/{index-Bz75jbQc.js → index-1k1ZgyY2.js} +1 -1
  109. package/dist/client/assets/{index-BUJePXEL.js → index-BKfETFDv.js} +1 -1
  110. package/dist/client/assets/{index-DFylQUoD.js → index-BYku3pS6.js} +3 -3
  111. package/dist/client/assets/{index-BdfBtWtk.js → index-BZl6Yjy6.js} +1 -1
  112. package/dist/client/assets/{index-B72iIhnj.js → index-BeANJeGc.js} +1 -1
  113. package/dist/client/assets/{index-D7GpXBZi.js → index-By0soqWM.js} +1 -1
  114. package/dist/client/assets/{index-DyxjlEL3.js → index-CIXONVZs.js} +1 -1
  115. package/dist/client/assets/{index-CfAl6qA3.js → index-D-XSdETh.js} +3 -3
  116. package/dist/client/assets/{index-BD3KwOs3.js → index-DH9MgJbR.js} +17 -17
  117. package/dist/client/assets/{index-BDQNsoxm.js → index-DKxw5xrT.js} +1 -1
  118. package/dist/client/assets/{index-BmTD_ujn.js → index-DR38oPBI.js} +1 -1
  119. package/dist/client/assets/{index-krar3iag.js → index-WZvNIEEB.js} +1 -1
  120. package/dist/client/assets/{index-CwSqgILb.js → index-hmPz641L.js} +5 -5
  121. package/dist/client/assets/{index-DCLh1sVt.js → index-rO-ko2ge.js} +1 -1
  122. package/dist/client/assets/{index-redirect-BIF-9n41.js → index-redirect-B6ZpCR3T.js} +1 -1
  123. package/dist/client/assets/{input-C96iFBVQ.js → input-dDAZFkLF.js} +1 -1
  124. package/dist/client/assets/{integration-icon-B1RhpoYr.js → integration-icon-VNiWpAhZ.js} +1 -1
  125. package/dist/client/assets/{invite-member-dialog-xjgZGOB2.js → invite-member-dialog-DsHfzkxK.js} +1 -1
  126. package/dist/client/assets/{label-Dyml5mFF.js → label-BmPwCD_l.js} +1 -1
  127. package/dist/client/assets/{layout-DDL4dMPD.js → layout-DX4nDTJN.js} +1 -1
  128. package/dist/client/assets/{login-CoR8jNzG.js → login-Bpmn3bRq.js} +1 -1
  129. package/dist/client/assets/{mcp-oauth-C3_4QnQD.js → mcp-oauth-BvWzv6R3.js} +1 -1
  130. package/dist/client/assets/{members-Bq1eH0V7.js → members-CvY7l2p2.js} +1 -1
  131. package/dist/client/assets/{monaco-editor-CzUxXwGN.js → monaco-editor-Bxt-NT-s.js} +1 -1
  132. package/dist/client/assets/{monitoring-stats-row-B0DrzvEt.js → monitoring-stats-row-Bw3Qs8aI.js} +1 -1
  133. package/dist/client/assets/{multi-select-rPe-eyDx.js → multi-select-D-5dBUIt.js} +1 -1
  134. package/dist/client/assets/{oauth-callback-BrUhk0Wa.js → oauth-callback-BHO8YYiH.js} +1 -1
  135. package/dist/client/assets/{oauth-callback-ai-provider-B8YVCFyJ.js → oauth-callback-ai-provider-CBs27o62.js} +1 -1
  136. package/dist/client/assets/{onboarding-COoyusCG.js → onboarding-LCK0GlA6.js} +1 -1
  137. package/dist/client/assets/{org-install-JAHRkU5h.js → org-install-CuV8yF0y.js} +1 -1
  138. package/dist/client/assets/{org-layout-D60pVxIN.js → org-layout-Dgqk8431.js} +1 -1
  139. package/dist/client/assets/{organization-choice-C6Ls0A49.js → organization-choice-ddszcl29.js} +1 -1
  140. package/dist/client/assets/{orgs-DztT5sab.js → orgs-DufzicID.js} +1 -1
  141. package/dist/client/assets/{page-seo-form-B_P0EHl2.js → page-seo-form-COYTHkH9.js} +1 -1
  142. package/dist/client/assets/page-seo-sheet-aLVdF1tb.js +1 -0
  143. package/dist/client/assets/{popover-CNhMnjco.js → popover-C8gRT3GW.js} +1 -1
  144. package/dist/client/assets/{post-editor-D_xoTmn-.js → post-editor-DMGIlsJ2.js} +1 -1
  145. package/dist/client/assets/{primitives-CBYGlggB.js → primitives-CW0rjr7o.js} +1 -1
  146. package/dist/client/assets/{profile-cvRYji9N.js → profile-vVj33K8v.js} +1 -1
  147. package/dist/client/assets/project-app-view-I4N5pReP.js +1 -0
  148. package/dist/client/assets/record-editor-D7YqqopM.js +1 -0
  149. package/dist/client/assets/redirect-editor-DCUiD3lS.js +1 -0
  150. package/dist/client/assets/registry-B-0jQMAj.js +2 -0
  151. package/dist/client/assets/{registry-layout-bAxFNLjy.js → registry-layout-uYP2Lvbu.js} +1 -1
  152. package/dist/client/assets/{reports-CQcFaphb.js → reports-BCDMvvdE.js} +1 -1
  153. package/dist/client/assets/{require-capability-DxlH57sg.js → require-capability-9VgaDJSJ.js} +1 -1
  154. package/dist/client/assets/{required-auth-layout-C-fhbIaJ.js → required-auth-layout-VsTkxfCS.js} +1 -1
  155. package/dist/client/assets/{reset-password-DNx83PQG.js → reset-password-DpuX0cSk.js} +1 -1
  156. package/dist/client/assets/{roles-BHDPkFyx.js → roles-DmaZnjWg.js} +1 -1
  157. package/dist/client/assets/{search-input-DzbdykkS.js → search-input-D7phSujf.js} +1 -1
  158. package/dist/client/assets/{secrets-BiPQdzxP.js → secrets-C-ygV5y9.js} +1 -1
  159. package/dist/client/assets/{sections-editor-DtTXEdpr.js → sections-editor-CMDgI3ik.js} +1 -1
  160. package/dist/client/assets/{select-DfWJsEeW.js → select-CeW7yHMj.js} +1 -1
  161. package/dist/client/assets/{select-model-va_ybRaj.js → select-model-Nlqu5of2.js} +1 -1
  162. package/dist/client/assets/{self-tool-result-BYn91ML_.js → self-tool-result-ultMyMuP.js} +1 -1
  163. package/dist/client/assets/{seo-editor-DhB9wLXc.js → seo-editor-D0VY3_J7.js} +1 -1
  164. package/dist/client/assets/{settings-layout-C0ekeOOv.js → settings-layout-CoLOV4DY.js} +1 -1
  165. package/dist/client/assets/{settings-section-ZxnBfBdb.js → settings-section-fqO3o6gl.js} +1 -1
  166. package/dist/client/assets/{shell-controls-CWv-6pxT.js → shell-controls-BEt2AaZK.js} +1 -1
  167. package/dist/client/assets/{shell-layout-B3ubQVJp.js → shell-layout-BfDa_CT8.js} +1 -1
  168. package/dist/client/assets/{sidebar-Bmfjcji7.js → sidebar-CRFVq_6w.js} +1 -1
  169. package/dist/client/assets/{skeleton-DYsdfnWI.js → skeleton-B-abedhD.js} +1 -1
  170. package/dist/client/assets/{sso-DxE0pH8a.js → sso-DhV6za_F.js} +1 -1
  171. package/dist/client/assets/{store-DQtXE3rO.js → store-DTvOFS2p.js} +1 -1
  172. package/dist/client/assets/store-registry-6t04IniW.js +2 -0
  173. package/dist/client/assets/{studio-tools-CZ0lHHg8.js → studio-tools-ChuxRuTE.js} +1 -1
  174. package/dist/client/assets/{switch-C8NVFCle.js → switch-DOL3wv5X.js} +1 -1
  175. package/dist/client/assets/{table-rrhMpufJ.js → table-Dweajfa-.js} +1 -1
  176. package/dist/client/assets/{tabs-Zz7_UEQN.js → tabs-H5KA397C.js} +1 -1
  177. package/dist/client/assets/{textarea-Q9mIBUV-.js → textarea-Cvp1qBxI.js} +1 -1
  178. package/dist/client/assets/{toggle-group-B8ZzagA8.js → toggle-group-CRMtYk6L.js} +1 -1
  179. package/dist/client/assets/{toolbar-1oJVDPdM.js → toolbar-DAFTE9EF.js} +1 -1
  180. package/dist/client/assets/{toolbar-icon-button-CqHN6MBe.js → toolbar-icon-button-BsKWMRpA.js} +1 -1
  181. package/dist/client/assets/{tooltip-lvzwcxmr.js → tooltip-DnEd2RfI.js} +1 -1
  182. package/dist/client/assets/{use-ai-providers-DLA17X4H.js → use-ai-providers-nmouRZCd.js} +1 -1
  183. package/dist/client/assets/{use-api-keys-ZZNQlaQa.js → use-api-keys-DDbXztgz.js} +1 -1
  184. package/dist/client/assets/{use-automations-CtAoOh2g.js → use-automations-CCAO_j8s.js} +1 -1
  185. package/dist/client/assets/{use-autosave-Dj0woe8W.js → use-autosave-hJHkY54k.js} +1 -1
  186. package/dist/client/assets/{use-capability-x07oRB_v.js → use-capability-BDfn_mmF.js} +1 -1
  187. package/dist/client/assets/{use-clock-tick-Cdnpjga1.js → use-clock-tick-BkRkMCfm.js} +1 -1
  188. package/dist/client/assets/{use-collections-DJ2e88Xq.js → use-collections-nHSnEcq_.js} +1 -1
  189. package/dist/client/assets/{use-connection-CawdsRuN.js → use-connection-DwFoylnd.js} +1 -1
  190. package/dist/client/assets/{use-copy-aPelM9gN.js → use-copy-C4VdME-X.js} +1 -1
  191. package/dist/client/assets/{use-create-virtual-mcp-D42LRs4W.js → use-create-virtual-mcp-D3JcLono.js} +1 -1
  192. package/dist/client/assets/{use-debounced-autosave-D46G2Nb3.js → use-debounced-autosave-mB4IjVJo.js} +1 -1
  193. package/dist/client/assets/{use-debounced-value-U6TK_cAJ.js → use-debounced-value-uLp5fr5d.js} +1 -1
  194. package/dist/client/assets/{use-deco-credits-tLUAgc-O.js → use-deco-credits-feU0kWea.js} +1 -1
  195. package/dist/client/assets/{use-decopilot-events-zHZ5c1US.js → use-decopilot-events-Bm6NlJ0e.js} +1 -1
  196. package/dist/client/assets/{use-delete-connection-B0eSidiK.js → use-delete-connection-BIJaDBxe.js} +1 -1
  197. package/dist/client/assets/{use-deployment-admin-C0wf5iR9.js → use-deployment-admin-BxwaOUYt.js} +1 -1
  198. package/dist/client/assets/{use-file-configs-D6OQvi29.js → use-file-configs-B9Q22DiT.js} +1 -1
  199. package/dist/client/assets/{use-infinite-scroll-DgeL9DrI.js → use-infinite-scroll-BW6tJUN7.js} +1 -1
  200. package/dist/client/assets/{use-join-requests-DYt3ADmT.js → use-join-requests-29G5oopw.js} +1 -1
  201. package/dist/client/assets/{use-mcp-auth-status-mlZiRJgT.js → use-mcp-auth-status-jWXMiVvz.js} +1 -1
  202. package/dist/client/assets/{use-mcp-client-CAtCw6yl.js → use-mcp-client-BRb4dnPI.js} +1 -1
  203. package/dist/client/assets/{use-mcp-tools-BkyW84hu.js → use-mcp-tools-CWEnAqVn.js} +1 -1
  204. package/dist/client/assets/{use-members-BPomUDuY.js → use-members-CK7dbfXy.js} +1 -1
  205. package/dist/client/assets/{use-mobile-D0KrjV8M.js → use-mobile-Cnw8TO8w.js} +1 -1
  206. package/dist/client/assets/{use-navigate-to-agent-CYMIGICl.js → use-navigate-to-agent-CGlqFZD-.js} +1 -1
  207. package/dist/client/assets/{use-org-auth-client-BY7CXLsN.js → use-org-auth-client-CHi-WaYM.js} +1 -1
  208. package/dist/client/assets/{use-org-sso-BNL5m012.js → use-org-sso-CRAQ4Sgq.js} +1 -1
  209. package/dist/client/assets/{use-organization-roles-DP7VZAnw.js → use-organization-roles-Cl6yLMxT.js} +1 -1
  210. package/dist/client/assets/{use-organization-settings-Btln8Py9.js → use-organization-settings-qUhh6e_h.js} +1 -1
  211. package/dist/client/assets/{use-registry-app-DGmz0d5i.js → use-registry-app-DbLALnf6.js} +1 -1
  212. package/dist/client/assets/{use-registry-connections-BNAx72pz.js → use-registry-connections-Ce-C-NcA.js} +1 -1
  213. package/dist/client/assets/{use-secrets-Brx7T76W.js → use-secrets-CXMdT-xv.js} +1 -1
  214. package/dist/client/assets/{use-status-sounds-WASJAR7W.js → use-status-sounds-aivdtBxm.js} +1 -1
  215. package/dist/client/assets/{use-t-Ca0ZB4W6.js → use-t-Dvqa2ly7.js} +1 -1
  216. package/dist/client/assets/{use-view-mode-CcZjEdUn.js → use-view-mode-xdz1x-Nz.js} +1 -1
  217. package/dist/client/assets/{use-virtual-mcp--wK0dI9I.js → use-virtual-mcp-DdUP8VhI.js} +1 -1
  218. package/dist/client/assets/useInfiniteQuery-Cwb8c_M5.js +1 -0
  219. package/dist/client/assets/{useRouterState-G26gh0wT.js → useRouterState-ESlSE622.js} +1 -1
  220. package/dist/client/assets/useSuspenseInfiniteQuery-ewSysDwF.js +1 -0
  221. package/dist/client/assets/{users-Cd08kHgh.js → users-QmFLnYGo.js} +1 -1
  222. package/dist/client/assets/{variant-calendar-DuJ3EROs.js → variant-calendar-Caw3v_Tp.js} +1 -1
  223. package/dist/client/assets/{view-mode-toggle-IMXhdpcC.js → view-mode-toggle-CnqHztA-.js} +1 -1
  224. package/dist/client/index.html +1 -1
  225. package/dist/server/cli.js +1 -1
  226. package/dist/server/server.js +1 -1
  227. package/package.json +1 -1
  228. package/dist/client/assets/page-seo-sheet-DHzmRm4L.js +0 -1
  229. package/dist/client/assets/project-app-view-CBEQxExF.js +0 -1
  230. package/dist/client/assets/record-editor-PW0VGnvH.js +0 -1
  231. package/dist/client/assets/redirect-editor-DsFvTbg2.js +0 -1
  232. package/dist/client/assets/registry-CvDjs0_s.js +0 -2
  233. package/dist/client/assets/store-registry-DJ5jwwgh.js +0 -2
  234. package/dist/client/assets/useInfiniteQuery-BT7hVNXg.js +0 -1
  235. package/dist/client/assets/useSuspenseInfiniteQuery-CIkQZwY0.js +0 -1
@@ -1 +1 @@
1
- import{c as C,j as t,r as y,B as M,l as j}from"./index-CfAl6qA3.js";import{a as D,h as S,D as I,d as R,e as T}from"./dialog-B8iPXZfB.js";import{u as _,S as A}from"./chat-context-BKkLQtRB.js";import{i as B}from"./Check-xlx8bieA.js";import{a as E}from"./Copy01-BhLnIcPa.js";function N(n){const e=C.c(3),{size:l}=n,o=l===void 0?16:l;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("path",{d:"M13 12L18.5 5M7.63965 3L12.5 12L13.6865 3M4.48381 6.71679L11.9872 12M3 12L11.9872 12.473M12.2244 13.177L7 20M4.84194 16.8682L11.2824 12.9758M11.5 21L12.665 13.177M21 14L13.1846 12.668M21 10.5788L13 12.3223M16.779 19.646L12.8876 13.3772M19.3566 18.207L13.313 12.9893"}),e[0]=i):i=e[0];let s;return e[1]!==o?(s=t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:o,height:o,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i}),e[1]=o,e[2]=s):s=e[2],s}function w(n){const e=C.c(3),{size:l}=n,o=l===void 0?16:l;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("path",{clipRule:"evenodd",d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"}),e[0]=i):i=e[0];let s;return e[1]!==o?(s=t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:o,height:o,fill:"currentColor",fillRule:"evenodd","aria-hidden":"true",children:i}),e[1]=o,e[2]=s):s=e[2],s}const $={"claude-code":{label:"Claude Code",Icon:N},codex:{label:"Codex",Icon:w}};function Y(n){return(n&&$[n])??null}const L="bunx decocms@latest link",k=[{capability:"claude-code",label:"Claude Code",description:"Runs through the Claude Code CLI",icon:t.jsx(N,{size:18})},{capability:"codex",label:"Codex",description:"Runs through the Codex CLI",icon:t.jsx(w,{size:18})}];function q(n){return k.filter(e=>n.includes(e.capability)).map(e=>e.label)}function F(n){const e=C.c(23),{open:l,onOpenChange:o}=n;let i;e[0]!==l?(i={fast:l},e[0]=l,e[1]=i):i=e[1];const s=_(i),[h,v]=y.useState(!1),z=s.hostname??s.machineId??"Your desktop",g=s.online?`Connected to ${z}`:"Connect your desktop";let a;e[2]!==g?(a=t.jsx(D,{children:g}),e[2]=g,e[3]=a):a=e[3];const b=s.online?"This machine provides the following local agents.":"Run this command in your desktop terminal. The dialog will close once your desktop is online.";let c;e[4]!==b?(c=t.jsx(S,{children:b}),e[4]=b,e[5]=c):c=e[5];let r;e[6]!==a||e[7]!==c?(r=t.jsxs(I,{children:[a,c]}),e[6]=a,e[7]=c,e[8]=r):r=e[8];let d;e[9]!==h||e[10]!==s.online?(d=!s.online&&t.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-sm",children:[t.jsx("span",{className:"flex-1",children:L}),t.jsx(M,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard.writeText(L),v(!0),setTimeout(()=>v(!1),1500)},children:h?t.jsx(B,{size:14}):t.jsx(E,{size:14})})]}),e[9]=h,e[10]=s.online,e[11]=d):d=e[11];let m;e[12]!==s.capabilities||e[13]!==s.online?(m=s.online?t.jsx("div",{className:"flex flex-col gap-3 text-sm",children:t.jsx("div",{className:"flex flex-col gap-2",children:k.map(x=>{const f=s.capabilities.includes(x.capability);return t.jsxs("div",{className:j("flex items-center gap-3 rounded-md border px-3 py-2",f?"border-border bg-background text-foreground":"border-border/60 bg-muted/40 text-muted-foreground"),children:[t.jsx("div",{className:j("flex size-6 items-center justify-center",f?"text-foreground":"text-muted-foreground"),children:x.icon}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"font-medium",children:x.label}),t.jsx("p",{className:"text-xs text-muted-foreground",children:f?x.description:"Not detected"})]}),t.jsx("span",{className:j("size-2 rounded-full",f?"bg-success":"bg-muted-foreground/30")})]},x.capability)})})}):t.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t.jsx(A,{size:"sm"}),"Waiting for desktop…"]}),e[12]=s.capabilities,e[13]=s.online,e[14]=m):m=e[14];let u;e[15]!==r||e[16]!==d||e[17]!==m?(u=t.jsxs(R,{className:"sm:max-w-md",children:[r,d,m]}),e[15]=r,e[16]=d,e[17]=m,e[18]=u):u=e[18];let p;return e[19]!==o||e[20]!==l||e[21]!==u?(p=t.jsx(T,{open:l,onOpenChange:o,children:u}),e[19]=o,e[20]=l,e[21]=u,e[22]=p):p=e[22],p}export{F as C,N as a,w as b,Y as l,q as v};
1
+ import{c as C,j as t,r as y,B as M,l as j}from"./index-D-XSdETh.js";import{a as D,h as S,D as I,d as R,e as T}from"./dialog-CkrS5RCd.js";import{u as _,S as A}from"./chat-context-BHNmEZsh.js";import{i as B}from"./Check-BCiV8JPd.js";import{a as E}from"./Copy01-B5PsaZtC.js";function N(n){const e=C.c(3),{size:l}=n,o=l===void 0?16:l;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("path",{d:"M13 12L18.5 5M7.63965 3L12.5 12L13.6865 3M4.48381 6.71679L11.9872 12M3 12L11.9872 12.473M12.2244 13.177L7 20M4.84194 16.8682L11.2824 12.9758M11.5 21L12.665 13.177M21 14L13.1846 12.668M21 10.5788L13 12.3223M16.779 19.646L12.8876 13.3772M19.3566 18.207L13.313 12.9893"}),e[0]=i):i=e[0];let s;return e[1]!==o?(s=t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:o,height:o,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i}),e[1]=o,e[2]=s):s=e[2],s}function w(n){const e=C.c(3),{size:l}=n,o=l===void 0?16:l;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("path",{clipRule:"evenodd",d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"}),e[0]=i):i=e[0];let s;return e[1]!==o?(s=t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:o,height:o,fill:"currentColor",fillRule:"evenodd","aria-hidden":"true",children:i}),e[1]=o,e[2]=s):s=e[2],s}const $={"claude-code":{label:"Claude Code",Icon:N},codex:{label:"Codex",Icon:w}};function Y(n){return(n&&$[n])??null}const L="bunx decocms@latest link",k=[{capability:"claude-code",label:"Claude Code",description:"Runs through the Claude Code CLI",icon:t.jsx(N,{size:18})},{capability:"codex",label:"Codex",description:"Runs through the Codex CLI",icon:t.jsx(w,{size:18})}];function q(n){return k.filter(e=>n.includes(e.capability)).map(e=>e.label)}function F(n){const e=C.c(23),{open:l,onOpenChange:o}=n;let i;e[0]!==l?(i={fast:l},e[0]=l,e[1]=i):i=e[1];const s=_(i),[h,v]=y.useState(!1),z=s.hostname??s.machineId??"Your desktop",g=s.online?`Connected to ${z}`:"Connect your desktop";let a;e[2]!==g?(a=t.jsx(D,{children:g}),e[2]=g,e[3]=a):a=e[3];const b=s.online?"This machine provides the following local agents.":"Run this command in your desktop terminal. The dialog will close once your desktop is online.";let c;e[4]!==b?(c=t.jsx(S,{children:b}),e[4]=b,e[5]=c):c=e[5];let r;e[6]!==a||e[7]!==c?(r=t.jsxs(I,{children:[a,c]}),e[6]=a,e[7]=c,e[8]=r):r=e[8];let d;e[9]!==h||e[10]!==s.online?(d=!s.online&&t.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-sm",children:[t.jsx("span",{className:"flex-1",children:L}),t.jsx(M,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard.writeText(L),v(!0),setTimeout(()=>v(!1),1500)},children:h?t.jsx(B,{size:14}):t.jsx(E,{size:14})})]}),e[9]=h,e[10]=s.online,e[11]=d):d=e[11];let m;e[12]!==s.capabilities||e[13]!==s.online?(m=s.online?t.jsx("div",{className:"flex flex-col gap-3 text-sm",children:t.jsx("div",{className:"flex flex-col gap-2",children:k.map(x=>{const f=s.capabilities.includes(x.capability);return t.jsxs("div",{className:j("flex items-center gap-3 rounded-md border px-3 py-2",f?"border-border bg-background text-foreground":"border-border/60 bg-muted/40 text-muted-foreground"),children:[t.jsx("div",{className:j("flex size-6 items-center justify-center",f?"text-foreground":"text-muted-foreground"),children:x.icon}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"font-medium",children:x.label}),t.jsx("p",{className:"text-xs text-muted-foreground",children:f?x.description:"Not detected"})]}),t.jsx("span",{className:j("size-2 rounded-full",f?"bg-success":"bg-muted-foreground/30")})]},x.capability)})})}):t.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t.jsx(A,{size:"sm"}),"Waiting for desktop…"]}),e[12]=s.capabilities,e[13]=s.online,e[14]=m):m=e[14];let u;e[15]!==r||e[16]!==d||e[17]!==m?(u=t.jsxs(R,{className:"sm:max-w-md",children:[r,d,m]}),e[15]=r,e[16]=d,e[17]=m,e[18]=u):u=e[18];let p;return e[19]!==o||e[20]!==l||e[21]!==u?(p=t.jsx(T,{open:l,onOpenChange:o,children:u}),e[19]=o,e[20]=l,e[21]=u,e[22]=p):p=e[22],p}export{F as C,N as a,w as b,Y as l,q as v};
@@ -1 +1 @@
1
- import{c as M,C as $,aY as L,K as k,l as w,j as I}from"./index-CfAl6qA3.js";import{u as D}from"./use-registry-connections-BNAx72pz.js";import{c as K}from"./use-organization-settings-Btln8Py9.js";import{S as E,j as Q}from"./use-mcp-client-CAtCw6yl.js";import{u as F}from"./useInfiniteQuery-BT7hVNXg.js";import{i as H,f as Y}from"./extract-connection-data-ChcGsUj8.js";import{r as q,R as G}from"./retry-CErkP7V6.js";import{g as T}from"./connection-slug-eyAPH6o3.js";import{C as U}from"./card-CxpjTUKu.js";import{I as V}from"./integration-icon-B1RhpoYr.js";function ue(){const s=M.c(6),e=D(),t=K(),a=$().project.enabledPlugins??[];let o;if(s[0]!==a||s[1]!==t||s[2]!==e){let l;s[4]!==t?(l=r=>t(r.id),s[4]=t,s[5]=l):l=s[5],o=e.filter(l).map(X),a.includes("private-registry")&&t(E)&&o.push({id:E,title:"Private Registry",icon:null}),s[0]=a,s[1]=t,s[2]=e,s[3]=o}else o=s[3];return o}function X(s){return{id:s.id,title:s.title,icon:s.icon}}const z=24,_=3;function A(s){return s.id.includes("community-registry")}function B(s){const e=s?.trim().split(/\s+/).filter(Boolean)??[];if(e.length===0)return;const t=[["title"],["description"],["name"],["server","title"]];return{operator:"or",conditions:e.flatMap(a=>t.map(o=>({field:o,operator:"contains",value:a})))}}function S(s,e,t,a,o){const l=s.map(u=>u.id).sort().join(","),r=B(o),{data:p,fetchNextPage:d,hasNextPage:m,isFetchingNextPage:g,isLoading:C}=F({queryKey:k.storeDiscovery(e,`${l}:${o??""}`),queryFn:async({pageParam:u})=>{const n=u??{};return await Promise.all(s.map(async i=>{const h=n[i.id];if(h==="EXHAUSTED")return{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:[]};const j=H(i.id,e);try{return await q(async()=>{let f=null;try{f=await Q({connectionId:i.id,orgId:e,orgSlug:t});const x={limit:z};h&&(x.cursor=h),r&&(x.where=r);const N=await f.callTool({name:j,arguments:x}),v=N.structuredContent??N,P=v.nextCursor||v.cursor||void 0,b=Y(v?[v]:[]);return{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:b,nextCursor:P}}finally{await f?.close().catch(()=>{})}},{maxAttempts:_,minTimeout:0,maxTimeout:1e3,jitter:0})}catch(f){return console.warn(`[useMergedStoreDiscovery] Registry "${i.title}" (${i.id}) failed after ${_} attempts:`,f instanceof G?f.cause:f),{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:[]}}}))},initialPageParam:{},getNextPageParam:u=>{const n={};let c=!1;for(const i of u)i.registryId&&(i.nextCursor?(n[i.registryId]=i.nextCursor,c=!0):n[i.registryId]="EXHAUSTED");return c?n:void 0},staleTime:3600*1e3,placeholderData:L,retry:!1,enabled:s.length>0}),y=[];if(p?.pages)for(const u of p.pages)for(const n of u)for(const c of n.items)y.push({...c,_sourceName:c._sourceName??n.registryTitle,_sourceIcon:c._sourceIcon??n.registryIcon,_registryId:c._registryId??n.registryId});return{items:y,hasMore:m??!1,isLoadingMore:g,isInitialLoading:C,fetchNextPage:()=>{m&&!g&&d()}}}function fe(s,e){const t=M.c(16),{org:a}=$();let o;t[0]!==s?(o=s.filter(Z),t[0]=s,t[1]=o):o=t[1];const l=o;let r;t[2]!==s?(r=s.filter(W),t[2]=s,t[3]=r):r=t[3];const p=r,d=S(l,a.id,a.slug,!0,e),m=S(p,a.id,a.slug,!0,e);let g;if(t[4]!==m.items||t[5]!==d.items){const h=new Set;g=[];const j=[...d.items,...m.items];for(const f of j){const x=`${f._registryId}:${f.id}`;h.has(x)||(h.add(x),g.push(f))}t[4]=m.items,t[5]=d.items,t[6]=g}else g=t[6];const C=d.isInitialLoading||m.isInitialLoading,y=d.isLoadingMore||m.isLoadingMore,u=d.hasMore||m.hasMore;let n;t[7]!==m||t[8]!==d?(n=()=>{d.hasMore&&d.fetchNextPage(),m.hasMore&&m.fetchNextPage()},t[7]=m,t[8]=d,t[9]=n):n=t[9];const c=n;let i;return t[10]!==u||t[11]!==C||t[12]!==y||t[13]!==g||t[14]!==c?(i={items:g,hasMore:u,isLoadingMore:y,isInitialLoading:C,loadMore:c},t[10]=u,t[11]=C,t[12]=y,t[13]=g,t[14]=c,t[15]=i):i=t[15],i}function W(s){return A(s)}function Z(s){return!A(s)}function me(s){const e=new Map;for(const o of s){const l=T(o),r=e.get(l);r?r.push(o):e.set(l,[o])}const t=[],a=new Set;for(const o of s){const l=T(o);if(a.has(l))continue;a.add(l);const r=e.get(l),p=r[0];r.length===1?t.push({type:"single",connection:p}):t.push({type:"group",key:l,icon:p.icon,title:p.app_name?p.title.replace(/\s*\(\d+\)\s*$/,""):p.title,connections:r})}return t}function de(s){const e=M.c(37),{connection:t,onClick:a,headerActions:o,headerActionsAlwaysVisible:l,body:r,footer:p,className:d,fallbackIcon:m}=s,g=l===void 0?!1:l,C=a&&"hover:bg-muted/50";let y;e[0]!==d||e[1]!==C?(y=w("cursor-pointer transition-colors group overflow-hidden flex flex-col h-full",C,d),e[0]=d,e[1]=C,e[2]=y):y=e[2];let u;e[3]!==t.icon||e[4]!==t.title||e[5]!==m?(u=I.jsx(V,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:m}),e[3]=t.icon,e[4]=t.title,e[5]=m,e[6]=u):u=e[6];let n;e[7]!==o||e[8]!==g?(n=o&&I.jsx("div",{className:w("transition-opacity",!g&&"sm:opacity-0 sm:group-hover:opacity-100"),onClick:O,children:o}),e[7]=o,e[8]=g,e[9]=n):n=e[9];let c;e[10]!==n?(c=I.jsx("div",{className:"relative",children:n}),e[10]=n,e[11]=c):c=e[11];let i;e[12]!==u||e[13]!==c?(i=I.jsxs("div",{className:"flex items-start justify-between",children:[u,c]}),e[12]=u,e[13]=c,e[14]=i):i=e[14];let h;e[15]!==t.title?(h=I.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:t.title}),e[15]=t.title,e[16]=h):h=e[16];const j=t.description||"No description";let f;e[17]!==j?(f=I.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:j}),e[17]=j,e[18]=f):f=e[18];let x;e[19]!==f||e[20]!==h?(x=I.jsxs("div",{className:"flex flex-col gap-1",children:[h,f]}),e[19]=f,e[20]=h,e[21]=x):x=e[21];let N;e[22]!==r?(N=r&&I.jsx("div",{children:r}),e[22]=r,e[23]=N):N=e[23];let v;e[24]!==x||e[25]!==N||e[26]!==i?(v=I.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[i,x,N]}),e[24]=x,e[25]=N,e[26]=i,e[27]=v):v=e[27];let P;e[28]!==p?(P=p&&I.jsx("div",{className:"border-t border-border mt-auto",children:I.jsx("div",{className:"h-14 flex items-center p-4.5",onClick:J,children:p})}),e[28]=p,e[29]=P):P=e[29];let b;e[30]!==v||e[31]!==P?(b=I.jsxs("div",{className:"flex flex-col flex-1",children:[v,P]}),e[30]=v,e[31]=P,e[32]=b):b=e[32];let R;return e[33]!==a||e[34]!==b||e[35]!==y?(R=I.jsx(U,{className:y,onClick:a,children:b}),e[33]=a,e[34]=b,e[35]=y,e[36]=R):R=e[36],R}function J(s){return s.stopPropagation()}function O(s){return s.stopPropagation()}export{de as C,fe as a,me as g,ue as u};
1
+ import{c as M,C as $,aY as L,K as k,l as w,j as I}from"./index-D-XSdETh.js";import{u as D}from"./use-registry-connections-Ce-C-NcA.js";import{c as K}from"./use-organization-settings-qUhh6e_h.js";import{S as E,j as Q}from"./use-mcp-client-BRb4dnPI.js";import{u as F}from"./useInfiniteQuery-Cwb8c_M5.js";import{i as H,f as Y}from"./extract-connection-data-BWpGE_oz.js";import{r as q,R as G}from"./retry-CErkP7V6.js";import{g as T}from"./connection-slug-eyAPH6o3.js";import{C as U}from"./card-BwdKy-hR.js";import{I as V}from"./integration-icon-VNiWpAhZ.js";function ue(){const s=M.c(6),e=D(),t=K(),a=$().project.enabledPlugins??[];let o;if(s[0]!==a||s[1]!==t||s[2]!==e){let l;s[4]!==t?(l=r=>t(r.id),s[4]=t,s[5]=l):l=s[5],o=e.filter(l).map(X),a.includes("private-registry")&&t(E)&&o.push({id:E,title:"Private Registry",icon:null}),s[0]=a,s[1]=t,s[2]=e,s[3]=o}else o=s[3];return o}function X(s){return{id:s.id,title:s.title,icon:s.icon}}const z=24,_=3;function A(s){return s.id.includes("community-registry")}function B(s){const e=s?.trim().split(/\s+/).filter(Boolean)??[];if(e.length===0)return;const t=[["title"],["description"],["name"],["server","title"]];return{operator:"or",conditions:e.flatMap(a=>t.map(o=>({field:o,operator:"contains",value:a})))}}function S(s,e,t,a,o){const l=s.map(u=>u.id).sort().join(","),r=B(o),{data:p,fetchNextPage:d,hasNextPage:m,isFetchingNextPage:g,isLoading:C}=F({queryKey:k.storeDiscovery(e,`${l}:${o??""}`),queryFn:async({pageParam:u})=>{const n=u??{};return await Promise.all(s.map(async i=>{const h=n[i.id];if(h==="EXHAUSTED")return{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:[]};const j=H(i.id,e);try{return await q(async()=>{let f=null;try{f=await Q({connectionId:i.id,orgId:e,orgSlug:t});const x={limit:z};h&&(x.cursor=h),r&&(x.where=r);const N=await f.callTool({name:j,arguments:x}),v=N.structuredContent??N,P=v.nextCursor||v.cursor||void 0,b=Y(v?[v]:[]);return{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:b,nextCursor:P}}finally{await f?.close().catch(()=>{})}},{maxAttempts:_,minTimeout:0,maxTimeout:1e3,jitter:0})}catch(f){return console.warn(`[useMergedStoreDiscovery] Registry "${i.title}" (${i.id}) failed after ${_} attempts:`,f instanceof G?f.cause:f),{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:[]}}}))},initialPageParam:{},getNextPageParam:u=>{const n={};let c=!1;for(const i of u)i.registryId&&(i.nextCursor?(n[i.registryId]=i.nextCursor,c=!0):n[i.registryId]="EXHAUSTED");return c?n:void 0},staleTime:3600*1e3,placeholderData:L,retry:!1,enabled:s.length>0}),y=[];if(p?.pages)for(const u of p.pages)for(const n of u)for(const c of n.items)y.push({...c,_sourceName:c._sourceName??n.registryTitle,_sourceIcon:c._sourceIcon??n.registryIcon,_registryId:c._registryId??n.registryId});return{items:y,hasMore:m??!1,isLoadingMore:g,isInitialLoading:C,fetchNextPage:()=>{m&&!g&&d()}}}function fe(s,e){const t=M.c(16),{org:a}=$();let o;t[0]!==s?(o=s.filter(Z),t[0]=s,t[1]=o):o=t[1];const l=o;let r;t[2]!==s?(r=s.filter(W),t[2]=s,t[3]=r):r=t[3];const p=r,d=S(l,a.id,a.slug,!0,e),m=S(p,a.id,a.slug,!0,e);let g;if(t[4]!==m.items||t[5]!==d.items){const h=new Set;g=[];const j=[...d.items,...m.items];for(const f of j){const x=`${f._registryId}:${f.id}`;h.has(x)||(h.add(x),g.push(f))}t[4]=m.items,t[5]=d.items,t[6]=g}else g=t[6];const C=d.isInitialLoading||m.isInitialLoading,y=d.isLoadingMore||m.isLoadingMore,u=d.hasMore||m.hasMore;let n;t[7]!==m||t[8]!==d?(n=()=>{d.hasMore&&d.fetchNextPage(),m.hasMore&&m.fetchNextPage()},t[7]=m,t[8]=d,t[9]=n):n=t[9];const c=n;let i;return t[10]!==u||t[11]!==C||t[12]!==y||t[13]!==g||t[14]!==c?(i={items:g,hasMore:u,isLoadingMore:y,isInitialLoading:C,loadMore:c},t[10]=u,t[11]=C,t[12]=y,t[13]=g,t[14]=c,t[15]=i):i=t[15],i}function W(s){return A(s)}function Z(s){return!A(s)}function me(s){const e=new Map;for(const o of s){const l=T(o),r=e.get(l);r?r.push(o):e.set(l,[o])}const t=[],a=new Set;for(const o of s){const l=T(o);if(a.has(l))continue;a.add(l);const r=e.get(l),p=r[0];r.length===1?t.push({type:"single",connection:p}):t.push({type:"group",key:l,icon:p.icon,title:p.app_name?p.title.replace(/\s*\(\d+\)\s*$/,""):p.title,connections:r})}return t}function de(s){const e=M.c(37),{connection:t,onClick:a,headerActions:o,headerActionsAlwaysVisible:l,body:r,footer:p,className:d,fallbackIcon:m}=s,g=l===void 0?!1:l,C=a&&"hover:bg-muted/50";let y;e[0]!==d||e[1]!==C?(y=w("cursor-pointer transition-colors group overflow-hidden flex flex-col h-full",C,d),e[0]=d,e[1]=C,e[2]=y):y=e[2];let u;e[3]!==t.icon||e[4]!==t.title||e[5]!==m?(u=I.jsx(V,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:m}),e[3]=t.icon,e[4]=t.title,e[5]=m,e[6]=u):u=e[6];let n;e[7]!==o||e[8]!==g?(n=o&&I.jsx("div",{className:w("transition-opacity",!g&&"sm:opacity-0 sm:group-hover:opacity-100"),onClick:O,children:o}),e[7]=o,e[8]=g,e[9]=n):n=e[9];let c;e[10]!==n?(c=I.jsx("div",{className:"relative",children:n}),e[10]=n,e[11]=c):c=e[11];let i;e[12]!==u||e[13]!==c?(i=I.jsxs("div",{className:"flex items-start justify-between",children:[u,c]}),e[12]=u,e[13]=c,e[14]=i):i=e[14];let h;e[15]!==t.title?(h=I.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:t.title}),e[15]=t.title,e[16]=h):h=e[16];const j=t.description||"No description";let f;e[17]!==j?(f=I.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:j}),e[17]=j,e[18]=f):f=e[18];let x;e[19]!==f||e[20]!==h?(x=I.jsxs("div",{className:"flex flex-col gap-1",children:[h,f]}),e[19]=f,e[20]=h,e[21]=x):x=e[21];let N;e[22]!==r?(N=r&&I.jsx("div",{children:r}),e[22]=r,e[23]=N):N=e[23];let v;e[24]!==x||e[25]!==N||e[26]!==i?(v=I.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[i,x,N]}),e[24]=x,e[25]=N,e[26]=i,e[27]=v):v=e[27];let P;e[28]!==p?(P=p&&I.jsx("div",{className:"border-t border-border mt-auto",children:I.jsx("div",{className:"h-14 flex items-center p-4.5",onClick:J,children:p})}),e[28]=p,e[29]=P):P=e[29];let b;e[30]!==v||e[31]!==P?(b=I.jsxs("div",{className:"flex flex-col flex-1",children:[v,P]}),e[30]=v,e[31]=P,e[32]=b):b=e[32];let R;return e[33]!==a||e[34]!==b||e[35]!==y?(R=I.jsx(U,{className:y,onClick:a,children:b}),e[33]=a,e[34]=b,e[35]=y,e[36]=R):R=e[36],R}function J(s){return s.stopPropagation()}function O(s){return s.stopPropagation()}export{de as C,fe as a,me as g,ue as u};
@@ -1 +1 @@
1
- import{H as he,af as Ae,b3 as $e,I as le,ad as De,c as P,j as t,i as ge,B as U,r as K,l as je,C as J,v as Pe,K as se,b as Y,aI as ce,z as Oe,b4 as Me,E as ze,e as Ee,b5 as Ve,n as Ue,M as Re,J as Fe,t as G,b6 as Le}from"./index-CfAl6qA3.js";import{g as He}from"./extract-connection-data-ChcGsUj8.js";import{E as ve}from"./empty-state-B0XUVWqe.js";import{E as Be,c as We,r as Xe,b as qe,d as Ge}from"./connection-form-helpers-Ce26XCbs.js";import{c as Ke,S as Qe,V as Je}from"./index-krar3iag.js";import{u as be,T as Ye}from"./use-mcp-auth-status-mlZiRJgT.js";import{a as Ze}from"./use-members-BPomUDuY.js";import{A as et}from"./avatar-BHNRf2BK.js";import{a as Ne,b as ye,u as tt}from"./use-connection-CawdsRuN.js";import{u as _e}from"./use-mcp-client-CAtCw6yl.js";import{a as st}from"./use-mcp-tools-BkyW84hu.js";import{c as nt,C as ot,a as it,d as rt}from"./AreaChart-CH1JlaHA.js";import{i as at,a as lt}from"./mcp-oauth-C3_4QnQD.js";import{I as ne}from"./integration-icon-B1RhpoYr.js";import{s as ct}from"./Plus-CpvaryXc.js";import{R as dt,S as mt,az as ut,b as xt}from"./agent-icon-kMrNxjYJ.js";import{a as Ce,s as pt}from"./Settings02-CoD4T3JT.js";import{s as re}from"./Trash01-CFIi5PAY.js";import{q as ft,p as ht,o as gt,m as jt,n as vt}from"./sidebar-Bmfjcji7.js";import{F as L,b as H,c as B,d as V,f as W,e as bt,a as Nt}from"./form-BbtpCekf.js";import{I as X}from"./input-C96iFBVQ.js";import{u as yt,D as _t}from"./use-delete-connection-B0eSidiK.js";import{c as Ct,B as St,a as wt,C as kt}from"./monitoring-stats-row-B0DrzvEt.js";import{u as Tt}from"./studio-tools-CZ0lHHg8.js";import{u as It}from"./use-virtual-mcp--wK0dI9I.js";import{i as Se}from"./ChevronRight-HByc-_dD.js";import{a as we}from"./Users03-Bg-uyP8J.js";import{c as Z,b as At,T as ee,a as $t}from"./tabs-Zz7_UEQN.js";import{g as ke}from"./connection-slug-eyAPH6o3.js";import{n as Dt}from"./ZapSquare-NmRRaYpN.js";import{c as Pt}from"./Tool01-F8NWFSUY.js";import{g as ae,M as Ot}from"./index-BD3KwOs3.js";import{C as Mt}from"./collection-search-DZDCl18y.js";import{C as zt}from"./card-CxpjTUKu.js";import{B as Et}from"./badge-0FaSmMEN.js";import{D as Vt,a as Ut,c as Rt,d as de}from"./dropdown-menu-D3W9Mypw.js";import{S as me,a as ue,b as xe,c as pe,d as F}from"./select-DfWJsEeW.js";import{i as Ft}from"./CheckCircle-BhHr7P8S.js";import{t as Lt}from"./ChevronDown-z_OgoJuG.js";import{n as Ht}from"./Tool02-CYQFsqUw.js";import{s as te}from"./Star01-B_ldc-QG.js";import{s as Bt}from"./XClose-Bvx5TP10.js";import"./index-B72iIhnj.js";import"./ZoomOut-Bjuv5wtp.js";import"./Key01-CJ4v8ToT.js";import"./auth-CaW_gj1t.js";import"./use-registry-connections-BNAx72pz.js";import"./use-organization-settings-Btln8Py9.js";import"./index-BdfBtWtk.js";import"./index-DCLh1sVt.js";import"./popover-CNhMnjco.js";import"./tooltip-lvzwcxmr.js";import"./Check-xlx8bieA.js";import"./SearchMd-BbTMkDIb.js";import"./use-mobile-D0KrjV8M.js";import"./use-create-virtual-mcp-D42LRs4W.js";import"./use-navigate-to-agent-CYMIGICl.js";import"./hooks-QkqjVdn8.js";import"./decopilot-sse-pool-DWXTDK7c.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./Eye-Dmrq3Yx3.js";import"./use-org-auth-client-BY7CXLsN.js";import"./User01-BHW_CvWq.js";import"./use-collections-DJ2e88Xq.js";import"./AlertCircle-8aL2p4Jm.js";import"./ArrowUp-BRv6jMcd.js";import"./ArrowRight-BmTkQdSS.js";import"./ArrowUpRight-DgWDf4bB.js";import"./TrendUp01-B11vKIzx.js";import"./ChevronUp-C0dubflE.js";import"./DotsVertical-9e8whEmO.js";import"./Stars02-wl-TgjVw.js";import"./Copy01-BhLnIcPa.js";import"./Globe01-C1OI0rNn.js";import"./FilterLines-LxfJFt1s.js";import"./Globe04-D37KO3Rl.js";import"./SwitchHorizontal01-BjhVVVE7.js";import"./HardDrive-xaUFGQWK.js";import"./Image01-D2MElAgS.js";import"./LayoutLeft-BXx4559W.js";import"./XCircle-z2zpbAQl.js";import"./LinkExternal01-RdFrwyl0.js";import"./Monitor01-ByOW8gCA.js";import"./Sun-DcglW2RF.js";import"./Package-BApyVZZF.js";import"./Palette-gwCbQEVd.js";import"./Play-CRcD5urt.js";import"./SearchLg-BLbYMh4R.js";import"./Shield01-BSQ914Nd.js";import"./Stars01-BEQN6TZj.js";import"./Upload01-CYv9Q0Sh.js";import"./Users01-CVvGtppm.js";import"./X-B9OMbRgI.js";import"./Zap-CaoQpAZT.js";import"./label-Dyml5mFF.js";import"./alert-dialog-lT11Jsbj.js";const Wt=he({scopes:De(le()).describe("List of scopes available"),stateSchema:Ae(le(),$e()).describe("JSON Schema (draft-07) defining the state structure")}),Xt=[{name:"MCP_CONFIGURATION",inputSchema:he({}),outputSchema:Wt}];function qt(s){const e=P.c(46),{instance:n,onConfigure:i,onAuthenticate:r,onDelete:o,onToggleStatus:a}=s;let d;e[0]!==n.id?(d={connectionId:n.id},e[0]=n.id,e[1]=d):d=e[1];const l=be(d),x=!(n.connection_type==="VIRTUAL")&&l.supportsOAuth&&!l.isAuthenticated,p=n.status!=="active",c=x||p?"border-destructive/50 bg-destructive/5":"border-transparent";let h;e[2]!==c?(h=je("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",c),e[2]=c,e[3]=h):h=e[3];let g;e[4]!==n.icon||e[5]!==n.title?(g=t.jsx(ne,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=g):g=e[6];let v;e[7]!==n.title?(v=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=v):v=e[8];let b;e[9]!==n.status||e[10]!==p||e[11]!==x?(b=x?t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}):p?t.jsx("span",{className:"text-xs text-destructive font-medium",children:n.status==="error"?"Disabled (error)":"Disabled"}):null,e[9]=n.status,e[10]=p,e[11]=x,e[12]=b):b=e[12];let j;e[13]!==v||e[14]!==b?(j=t.jsxs("div",{className:"flex-1 min-w-0",children:[v,b]}),e[13]=v,e[14]=b,e[15]=j):j=e[15];let N;e[16]!==n||e[17]!==x||e[18]!==r?(N=x&&t.jsx(U,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>r(n),children:"Authorize"}),e[16]=n,e[17]=x,e[18]=r,e[19]=N):N=e[19];let T;e[20]!==n||e[21]!==p||e[22]!==a?(T=p?t.jsxs(U,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>a(n,"active"),children:[t.jsx(dt,{size:13}),"Enable"]}):t.jsx(U,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>a(n,"inactive"),title:"Disable",children:t.jsx(mt,{size:13})}),e[20]=n,e[21]=p,e[22]=a,e[23]=T):T=e[23];let S;e[24]!==n||e[25]!==i?(S=()=>i(n),e[24]=n,e[25]=i,e[26]=S):S=e[26];let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(Ce,{size:13}),e[27]=y):y=e[27];let I;e[28]!==S?(I=t.jsx(U,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:S,title:"Configure",children:y}),e[28]=S,e[29]=I):I=e[29];let _;e[30]!==n||e[31]!==o?(_=()=>o(n),e[30]=n,e[31]=o,e[32]=_):_=e[32];let k;e[33]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(re,{size:13}),e[33]=k):k=e[33];let C;e[34]!==_?(C=t.jsx(U,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:_,title:"Delete",children:k}),e[34]=_,e[35]=C):C=e[35];let f;e[36]!==I||e[37]!==C||e[38]!==N||e[39]!==T?(f=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[N,T,I,C]}),e[36]=I,e[37]=C,e[38]=N,e[39]=T,e[40]=f):f=e[40];let w;return e[41]!==f||e[42]!==h||e[43]!==g||e[44]!==j?(w=t.jsxs("div",{className:h,children:[g,j,f]}),e[41]=f,e[42]=h,e[43]=g,e[44]=j,e[45]=w):w=e[45],w}function Gt(s){const e=P.c(15),{instance:n,onConfigure:i}=s;let r;e[0]!==n.icon||e[1]!==n.title?(r=t.jsx(ne,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=r):r=e[2];let o;e[3]!==n.title?(o=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",children:n.title})}),e[3]=n.title,e[4]=o):o=e[4];let a;e[5]!==n||e[6]!==i?(a=()=>i(n),e[5]=n,e[6]=i,e[7]=a):a=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Ce,{size:13}),e[8]=d):d=e[8];let l;e[9]!==a?(l=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(U,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a,title:"Configure",children:d})}),e[9]=a,e[10]=l):l=e[10];let u;return e[11]!==r||e[12]!==o||e[13]!==l?(u=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[r,o,l]}),e[11]=r,e[12]=o,e[13]=l,e[14]=u):u=e[14],u}function Kt(s){const e=P.c(27),{instances:n,onConfigure:i,onAuthenticate:r,onDelete:o,onToggleStatus:a,onAdd:d,isAdding:l}=s;if(n.length===0)return null;const u=n.length===1?"Instance":"Instances";let x;e[0]!==u?(x=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:u}),e[0]=u,e[1]=x):x=e[1];let p;e[2]!==l?(p=l?t.jsx(ge,{size:13,className:"animate-spin"}):t.jsx(ct,{size:13}),e[2]=l,e[3]=p):p=e[3];let c;e[4]!==l||e[5]!==d||e[6]!==p?(c=t.jsxs(U,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:d,disabled:l,children:[p,"Add instance"]}),e[4]=l,e[5]=d,e[6]=p,e[7]=c):c=e[7];let h;e[8]!==x||e[9]!==c?(h=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[x,c]}),e[8]=x,e[9]=c,e[10]=h):h=e[10];let g;if(e[11]!==n||e[12]!==r||e[13]!==i||e[14]!==o||e[15]!==a){let j;e[17]!==r||e[18]!==i||e[19]!==o||e[20]!==a?(j=N=>t.jsx(K.Suspense,{fallback:t.jsx(Gt,{instance:N,onConfigure:i}),children:t.jsx(qt,{instance:N,onConfigure:i,onAuthenticate:r,onDelete:o,onToggleStatus:a})},N.id),e[17]=r,e[18]=i,e[19]=o,e[20]=a,e[21]=j):j=e[21],g=n.map(j),e[11]=n,e[12]=r,e[13]=i,e[14]=o,e[15]=a,e[16]=g}else g=e[16];let v;e[22]!==g?(v=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:g}),e[22]=g,e[23]=v):v=e[23];let b;return e[24]!==h||e[25]!==v?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[h,v]}),e[24]=h,e[25]=v,e[26]=b):b=e[26],b}function Qt(s,e=3){const n=new Map;for(const i of s){if(!i.isError)continue;const r=(i.errorMessage??"").trim()||"Unknown error";n.set(r,(n.get(r)??0)+1)}return[...n.entries()].map(([i,r])=>({message:i,count:r})).sort((i,r)=>r.count-i.count).slice(0,e)}const Jt=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function Yt(s){const e=new Date,n=new Date(e);return s==="7d"?n.setDate(n.getDate()-7):s==="14d"?n.setDate(n.getDate()-14):n.setDate(n.getDate()-30),{startDate:n,endDate:e}}const Zt={calls:{label:"Tool calls"},errors:{label:"Errors"}};function es(s){const e=P.c(1),{connectionId:n,orgId:i,timeframe:r}=s,o=Tt(),a=Yt(r),{data:d}=Pe({queryKey:se.connectionActivity(n,r,i),queryFn:async()=>await o.call("MONITORING_LOGS_LIST",{startDate:a.startDate.toISOString(),endDate:a.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}),staleTime:3e5}),l=Ct(d?.logs??[],a),u=l.data,x=l.totalCalls>0,p=Qt(d?.logs??[]),c=l.totalCalls>0?Math.round(l.totalErrors/l.totalCalls*100):0;let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[0]=h):h=e[0],t.jsxs("div",{children:[t.jsxs("div",{className:"flex gap-6 px-5 pb-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:l.totalCalls.toLocaleString()}),h]}),l.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:l.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),l.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(l.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),x?t.jsxs("div",{children:[t.jsx(nt,{config:Zt,className:"h-16 w-full",children:t.jsxs(St,{data:u,barCategoryGap:"4%",children:[t.jsx(ot,{content:t.jsx(it,{labelFormatter:ns}),cursor:{fill:"var(--muted)"}}),t.jsx(wt,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:u.map(ss)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[u.length-1]?.label})]})]}):t.jsx("div",{className:"h-20 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-muted-foreground/60",children:"No activity in this period"})}),p.length>0&&t.jsxs("div",{className:"px-5 py-4 border-t border-border",children:[t.jsxs("p",{className:"text-xs font-medium text-muted-foreground mb-2",children:["Top errors",c>0?` · ${c}% of calls failed`:""]}),t.jsx("ul",{className:"space-y-1.5",children:p.map(ts)})]})]})}function ts(s){return t.jsxs("li",{className:"flex items-start gap-2 text-xs",children:[t.jsxs("span",{className:"tabular-nums text-destructive font-medium shrink-0",children:[s.count.toLocaleString(),"×"]}),t.jsx("span",{className:"text-muted-foreground truncate",title:s.message,children:s.message})]},s.message)}function ss(s,e){return t.jsx(kt,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function ns(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function os(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{children:[t.jsx("div",{className:"flex gap-6 px-5 pb-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx("div",{className:"h-7 w-16 rounded-md bg-muted animate-pulse"}),t.jsx("div",{className:"h-3 w-14 rounded bg-muted animate-pulse"})]})}),t.jsx("div",{className:"h-20 w-full rounded-md bg-muted animate-pulse"})]}),s[0]=e):e=s[0],e}function is(s){const e=P.c(13),{connectionId:n}=s,[i,r]=K.useState("14d"),{org:o}=J();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=a):a=e[0];let d;e[1]!==i?(d=Jt.map(c=>t.jsx("button",{type:"button",onClick:()=>r(c.value),className:je("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",i===c.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:c.label},c.value)),e[1]=i,e[2]=d):d=e[2];let l;e[3]!==d?(l=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[a,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:d})]}),e[3]=d,e[4]=l):l=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(os,{}),e[5]=u):u=e[5];let x;e[6]!==n||e[7]!==o.id||e[8]!==i?(x=t.jsx(K.Suspense,{fallback:u,children:t.jsx(es,{connectionId:n,orgId:o.id,timeframe:i})}),e[6]=n,e[7]=o.id,e[8]=i,e[9]=x):x=e[9];let p;return e[10]!==l||e[11]!==x?(p=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[l,x]}),e[10]=l,e[11]=x,e[12]=p):p=e[12],p}function rs(s){const e=P.c(15),{virtualMcp:n,org:i}=s,r=Y();let o;e[0]!==r||e[1]!==i||e[2]!==n.id?(o=()=>{const p=crypto.randomUUID();r({to:"/$org/$taskId",params:{org:i,taskId:p},search:{virtualmcpid:n.id}})},e[0]=r,e[1]=i,e[2]=n.id,e[3]=o):o=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(we,{size:16}),e[4]=a):a=e[4];let d;e[5]!==n.icon||e[6]!==n.title?(d=t.jsx(ne,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:a}),e[5]=n.icon,e[6]=n.title,e[7]=d):d=e[7];let l;e[8]!==n.title?(l=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=l):l=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(Se,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[10]=u):u=e[10];let x;return e[11]!==o||e[12]!==d||e[13]!==l?(x=t.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group text-left w-full",children:[d,l,u]}),e[11]=o,e[12]=d,e[13]=l,e[14]=x):x=e[14],x}function as(s){const e=P.c(7),{virtualMcps:n,org:i}=s;let r;if(e[0]!==i||e[1]!==n){let a;e[3]!==i?(a=d=>t.jsx(rs,{virtualMcp:d,org:i},d.id),e[3]=i,e[4]=a):a=e[4],r=n.map(a),e[0]=i,e[1]=n,e[2]=r}else r=e[2];let o;return e[5]!==r?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:r})}),e[5]=r,e[6]=o):o=e[6],o}function ls(s){const e=P.c(7),{connection:n}=s,{org:i}=J();let r;e[0]!==n.id?(r={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=r):r=e[1];const o=It(r);if(!(o.length>0)){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(t.Fragment,{}),e[2]=u):u=e[2],u}let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("div",{className:"px-5 py-4 border-b border-border",children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Used by agents"})}),e[3]=d):d=e[3];let l;return e[4]!==i.slug||e[5]!==o?(l=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[d,t.jsx("div",{className:"px-5 py-4",children:t.jsx(as,{virtualMcps:o,org:i.slug})})]}),e[4]=i.slug,e[5]=o,e[6]=l):l=e[6],l}function cs(s){const e=P.c(31),{tools:n,connectionId:i,org:r}=s,o=Y(),{org:a}=J();let d;e[0]!==i||e[1]!==a.id||e[2]!==a.slug?(d={connectionId:i,orgId:a.id,orgSlug:a.slug},e[0]=i,e[1]=a.id,e[2]=a.slug,e[3]=d):d=e[3];const l=_e(d),u=Ne(i);let x;e[4]!==u||e[5]!==i?(x=u?ke(u):i,e[4]=u,e[5]=i,e[6]=x):x=e[6];const p=x,[c,h]=K.useState("");let g,v,b,j;if(e[7]!==p||e[8]!==l||e[9]!==o||e[10]!==r||e[11]!==c||e[12]!==n){const S=(n??[]).filter(ds),y=c.toLowerCase().trim(),I=y?S.filter(f=>f.name.toLowerCase().includes(y)||f.description&&f.description.toLowerCase().includes(y)):S;let _;e[17]!==p||e[18]!==o||e[19]!==r?(_=f=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(f.name)}})},e[17]=p,e[18]=o,e[19]=r,e[20]=_):_=e[20];const k=_;b="flex flex-col h-full overflow-hidden";let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=f=>{f.key==="Escape"&&(h(""),f.target.blur())},e[21]=C):C=e[21],e[22]!==c?(j=t.jsx(Mt,{value:c,onChange:h,placeholder:"Search apps...",onKeyDown:C}),e[22]=c,e[23]=j):j=e[23],g="flex-1 overflow-auto p-5",v=I.length===0?t.jsx(ve,{image:null,title:c?"No apps found":"No apps available",description:c?"Try adjusting your search terms":"This connection doesn't have any tools with interactive UIs yet."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:I.map(f=>{const w=ae(f._meta);return t.jsxs(zt,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>k(f),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(Ot,{resourceURI:w,toolInfo:{tool:f},displayMode:"inline",minHeight:200,maxHeight:200,client:l})}),t.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:f.name}),t.jsx(Ye,{annotations:f.annotations,_meta:f._meta})]}),f.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:f.description})]})]},f.name)})}),e[7]=p,e[8]=l,e[9]=o,e[10]=r,e[11]=c,e[12]=n,e[13]=g,e[14]=v,e[15]=b,e[16]=j}else g=e[13],v=e[14],b=e[15],j=e[16];let N;e[24]!==g||e[25]!==v?(N=t.jsx("div",{className:g,children:v}),e[24]=g,e[25]=v,e[26]=N):N=e[26];let T;return e[27]!==b||e[28]!==j||e[29]!==N?(T=t.jsxs("div",{className:b,children:[j,N]}),e[27]=b,e[28]=j,e[29]=N,e[30]=T):T=e[30],T}function ds(s){return!!ae(s._meta)}function Te(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=a=>a.charAt(0).toUpperCase()+a.slice(1),i=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),r=e.map(n),o=e[e.length-1];return r.length>=2&&o&&i.has(o)?[r.pop(),...r].join(" "):r.join(" ")}function ie(s){const e=P.c(2),{label:n}=s;let i;return e[0]!==n?(i=t.jsx("div",{className:"px-5 py-8 text-center",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",n," available."]})}),e[0]=n,e[1]=i):i=e[1],i}function ms(s){const e=P.c(50),{tools:n,prompts:i,resources:r,connectionId:o,org:a}=s;let d;e[0]!==i?(d=i===void 0?[]:i,e[0]=i,e[1]=d):d=e[1];const l=d;let u;e[2]!==r?(u=r===void 0?[]:r,e[2]=r,e[3]=u):u=e[3];const x=u,p=Y(),c=Ne(o??"");let h;e[4]!==c||e[5]!==o?(h=c?ke(c):o,e[4]=c,e[5]=o,e[6]=h):h=e[6];const g=h;let v;e[7]!==g||e[8]!==o||e[9]!==p||e[10]!==a?(v=function($){!o||!a||p({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:a,appSlug:g,collectionName:"tools",itemId:encodeURIComponent($)}})},e[7]=g,e[8]=o,e[9]=p,e[10]=a,e[11]=v):v=e[11];const b=v;let j;e[12]!==o||e[13]!==a||e[14]!==n?(j=o&&a&&n.some(ps),e[12]=o,e[13]=a,e[14]=n,e[15]=j):j=e[15];const N=j;if(n.length+l.length+x.length===0){let m;return e[16]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:"Capabilities"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"No capabilities discovered yet. The connection may still be connecting."})]}),e[16]=m):m=e[16],m}let S;e[17]!==n.length?(S=t.jsxs(Z,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=S):S=e[18];let y;e[19]!==N?(y=N&&t.jsx(Z,{value:"apps",variant:"underline",children:"UI"}),e[19]=N,e[20]=y):y=e[20];let I,_;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(Z,{value:"prompts",variant:"underline",children:"Prompts"}),_=t.jsx(Z,{value:"resources",variant:"underline",children:"Resources"}),e[21]=I,e[22]=_):(I=e[21],_=e[22]);let k;e[23]!==S||e[24]!==y?(k=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(At,{variant:"underline",className:"gap-1",children:[S,y,I,_]})}),e[23]=S,e[24]=y,e[25]=k):k=e[25];let C;e[26]!==b||e[27]!==n?(C=n.length>0?n.map(m=>t.jsxs("button",{type:"button",className:"w-full flex items-start gap-3 px-5 py-3 text-left hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>b(m.name),children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(Pt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Te(m.name)}),m.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:m.description})]}),t.jsx(Se,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},m.name)):t.jsx(ie,{label:"tools"}),e[26]=b,e[27]=n,e[28]=C):C=e[28];let f;e[29]!==C?(f=t.jsx(ee,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:C})}),e[29]=C,e[30]=f):f=e[30];let w;e[31]!==o||e[32]!==N||e[33]!==a||e[34]!==n?(w=N&&t.jsx(ee,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(cs,{tools:n,connectionId:o,org:a})}),e[31]=o,e[32]=N,e[33]=a,e[34]=n,e[35]=w):w=e[35];let M;e[36]!==l?(M=l.length>0?l.map(xs):t.jsx(ie,{label:"prompts"}),e[36]=l,e[37]=M):M=e[37];let O;e[38]!==M?(O=t.jsx(ee,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:M})}),e[38]=M,e[39]=O):O=e[39];let A;e[40]!==x?(A=x.length>0?x.map(us):t.jsx(ie,{label:"resources"}),e[40]=x,e[41]=A):A=e[41];let z;e[42]!==A?(z=t.jsx(ee,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:A})}),e[42]=A,e[43]=z):z=e[43];let R;return e[44]!==k||e[45]!==f||e[46]!==w||e[47]!==O||e[48]!==z?(R=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs($t,{defaultValue:"tools",variant:"underline",children:[k,f,w,O,z]})}),e[44]=k,e[45]=f,e[46]=w,e[47]=O,e[48]=z,e[49]=R):R=e[49],R}function us(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(ut,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:s.name}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description}),s.uri&&t.jsx("div",{className:"text-xs text-muted-foreground/60 font-mono mt-0.5 truncate",children:s.uri})]})]},s.uri??s.name)}function xs(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(Dt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Te(s.name)}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description})]})]},s.name)}function ps(s){return ae(s._meta)}function fs(s){const e=P.c(13),{connection:n,displayTitle:i}=s,r=i??n.title;let o;e[0]!==n.icon||e[1]!==r?(o=t.jsx(ne,{icon:n.icon,name:r,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=r,e[2]=o):o=e[2];let a;e[3]!==r?(a=t.jsx("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:t.jsx("h1",{className:"text-lg md:text-xl font-semibold tracking-tight text-foreground leading-none",children:r})}),e[3]=r,e[4]=a):a=e[4];let d;e[5]!==n.description?(d=n.description&&t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed line-clamp-2",children:n.description}),e[5]=n.description,e[6]=d):d=e[6];let l;e[7]!==a||e[8]!==d?(l=t.jsxs("div",{className:"flex-1 min-w-0",children:[a,d]}),e[7]=a,e[8]=d,e[9]=l):l=e[9];let u;return e[10]!==o||e[11]!==l?(u=t.jsxs("div",{className:"flex items-center gap-4 md:gap-6 py-5 md:py-7 px-4 md:px-8 bg-background border-b border-border shrink-0",children:[o,l]}),e[10]=o,e[11]=l,e[12]=u):u=e[12],u}function hs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:i,onRemoveOAuth:r}){const o=ce({control:s.control,name:"ui_type"}),a=ce({control:s.control,name:"connection_url"}),{stdioEnabled:d}=Oe(),l=(()=>{if(typeof a!="string"||!a)return!1;try{const c=new URL(a);return c.hostname==="api.githubcopilot.com"&&c.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),u=d||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",p=x?Me(e.connection_url):null;return x?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(we,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),p&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),t.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:t.jsx("code",{className:"text-sm text-muted-foreground",children:p})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(L,{control:s.control,name:"ui_type",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),o!=="NPX"&&o!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(me,{value:c.value,onValueChange:c.onChange,children:[t.jsx(V,{children:t.jsxs(ue,{className:"h-full! w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(te,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(xe,{})]})}),t.jsxs(pe,{children:[t.jsx(F,{value:"HTTP",children:"HTTP"}),t.jsx(F,{value:"SSE",children:"SSE"}),t.jsx(F,{value:"Websocket",children:"Websocket"}),u&&t.jsxs(t.Fragment,{children:[t.jsx(F,{value:"NPX",children:"NPX Package"}),t.jsx(F,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(L,{control:s.control,name:"connection_url",render:({field:h})=>t.jsx(H,{className:"flex-1 min-w-0",children:t.jsx(V,{children:t.jsx(X,{placeholder:"https://example.com/mcp",...h,value:h.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(me,{value:c.value,onValueChange:c.onChange,children:[t.jsx(V,{children:t.jsx(ue,{className:"h-10",children:t.jsx(xe,{})})}),t.jsxs(pe,{children:[t.jsx(F,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(te,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(F,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(te,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(F,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(te,{className:"w-4 h-4"}),"Websocket"]})}),u&&t.jsxs(t.Fragment,{children:[t.jsx(F,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ht,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(F,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(xt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(W,{})]})}),o==="NPX"&&t.jsx(L,{control:s.control,name:"npx_package",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(V,{children:t.jsx(X,{placeholder:"@perplexity-ai/mcp-server",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),o==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(L,{control:s.control,name:"stdio_command",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(V,{children:t.jsx(X,{placeholder:"node, bun, python...",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),t.jsx(L,{control:s.control,name:"stdio_args",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(V,{children:t.jsx(X,{placeholder:"arg1 arg2 --flag value",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(W,{})]})})]}),t.jsx(L,{control:s.control,name:"stdio_cwd",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(V,{children:t.jsx(X,{placeholder:"/path/to/project (optional)",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(L,{control:s.control,name:"env_vars",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(V,{children:t.jsx(Be,{value:c.value??[],onChange:c.onChange})}),t.jsx(W,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(L,{control:s.control,name:"connection_token",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:l?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Vt,{children:[t.jsx(Ut,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Et,{variant:"success",className:"gap-1.5",children:[t.jsx(Ft,{size:12}),"Authenticated via OAuth",t.jsx(Lt,{size:12})]})})}),t.jsxs(Rt,{align:"start",children:[t.jsxs(de,{onClick:i,children:[t.jsx(pt,{size:16}),"Re-authenticate"]}),t.jsxs(de,{variant:"destructive",onClick:r,children:[t.jsx(re,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&c.value===null?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>c.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(Bt,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(X,{type:"password",placeholder:l?"Paste your GitHub PAT":"Enter access token...",...c,value:c.value||"",className:"h-10 rounded-lg"})}),l&&t.jsxs(bt,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(W,{})]})})]})}function gs(s){return s.command==="npx"}function js(s){return s.args?.find(e=>!e.startsWith("-"))??""}function vs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function fe(s,e){const n={title:s.title,description:s.description??"",icon:s.icon??null,configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&Le(s.connection_headers)){const i=s.connection_headers,r=Xe(i.envVars);if(gs(i)){const a=js(i);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:a,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const o=vs(i);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:o.command,stdio_args:o.args,stdio_cwd:o.cwd,env_vars:r}}return{...n,ui_type:s.connection_type,connection_url:s.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function bs(s){let e,n=null,i=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=qe(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",r=Ge(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",i=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...i&&{connection_token:i},...r&&{connection_headers:r},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function Ns({connection:s,connectionId:e,org:n,isUpdating:i,tools:r,prompts:o,resources:a,siblings:d}){const l=Y({from:"/$org/settings/connections/$appSlug"}),u=Ue(),x=ye(),{org:p}=J(),c=yt({onSuccess:()=>{d.length<=1&&l({to:"/$org/settings/connections",params:{org:n}})}}),[h,g]=K.useState(null),[v,b]=K.useState(!1),j=be({connectionId:e}),{data:N}=Ze(),T=N?.data?.members??[],S=h??s,y=T.find(m=>m.userId===S.created_by),_=s?.connection_type==="VIRTUAL"||j.isAuthenticated,k={...s,tools:r},C=Ke(k,Xt),f=Re({resolver:Fe(We),values:fe(h??s)}),w=f.formState.isDirty,M=async()=>{if(!await f.trigger())return;const $=f.getValues(),E=bs($),D=h?.id??e;await x.update.mutateAsync({id:D,data:E}),f.reset($)},O=()=>{f.reset(fe(h??s))},A=async m=>{const $=s.configuration_scopes?.length?s.configuration_scopes.join(" "):void 0,{token:E,tokenInfo:D,error:Q}=await lt({connectionId:m,orgSlug:p.slug,...$?{scope:$}:{}});if(Q||!E){G.error(`Authentication failed: ${Q}`);return}if(D)try{const q=await fetch(`/api/${p.slug}/connections/${m}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:D.accessToken,refreshToken:D.refreshToken,expiresIn:D.expiresIn,scope:D.scope,clientId:D.clientId,clientSecret:D.clientSecret,tokenEndpoint:D.tokenEndpoint})});if(!q.ok)console.error("Failed to save OAuth token:",await q.text()),await x.update.mutateAsync({id:m,data:{connection_token:E}});else try{await x.update.mutateAsync({id:m,data:{}})}catch(Ie){console.warn("Failed to refresh connection tools after OAuth:",Ie)}}catch(q){console.error("Error saving OAuth token:",q),await x.update.mutateAsync({id:m,data:{connection_token:E}})}else await x.update.mutateAsync({id:m,data:{connection_token:E}});const oe=new URL(`/api/${p.slug}/mcp/${m}`,window.location.origin);await u.invalidateQueries({queryKey:se.isMCPAuthenticated(oe.href,null)}),await u.invalidateQueries({queryKey:se.mcpClientPrefix()}),G.success("Authentication successful")},z=()=>A(s.id),R=async()=>{try{const m=await fetch(`/api/${p.slug}/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!m.ok){const E=await m.text();G.error(`Failed to remove OAuth: ${E}`);return}const $=new URL(`/api/${p.slug}/mcp/${s.id}`,window.location.origin);await u.invalidateQueries({queryKey:se.isMCPAuthenticated($.href,null)}),G.success("OAuth removed. You can now re-authenticate with a different account.")}catch(m){console.error("Error removing OAuth token:",m),G.error("Failed to remove OAuth")}};return t.jsxs(t.Fragment,{children:[t.jsx(_t,{...c}),t.jsx(ft,{open:h!==null,onOpenChange:m=>{m||g(null)},children:t.jsxs(ht,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(gt,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(jt,{className:"text-base",children:h?.title??s.title}),t.jsx(vt,{className:"text-xs",children:"Update URL, authentication, and other settings"}),y&&t.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Connected by"}),t.jsx(et,{url:y.user?.image??void 0,fallback:y.user?.name??y.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:y.user?.name||y.user?.email})]})]}),t.jsxs(Nt,{...f,children:[t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 md:px-6 md:py-5 flex flex-col gap-4 md:gap-6",children:[t.jsxs("div",{className:"flex flex-col gap-3 md:gap-4",children:[t.jsx(L,{control:f.control,name:"title",render:({field:m})=>t.jsxs(H,{children:[t.jsx(B,{children:"Name"}),t.jsx(V,{children:t.jsx(X,{...m})}),t.jsx(W,{})]})}),t.jsx(L,{control:f.control,name:"description",render:({field:m})=>t.jsxs(H,{children:[t.jsx(B,{children:"Description"}),t.jsx(V,{children:t.jsx(X,{...m,value:m.value||""})}),t.jsx(W,{})]})})]}),t.jsx(hs,{form:f,connection:h??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:z,onRemoveOAuth:R}),t.jsx(Qe,{connection:h??s,form:f,hasMcpBinding:C,isMCPAuthenticated:_,supportsOAuth:j.supportsOAuth,isServerError:j.isServerError,onAuthenticate:z,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(U,{onClick:M,disabled:!w||i,className:"flex-1",children:i?"Saving…":"Save changes"}),w&&t.jsx(U,{variant:"outline",onClick:O,children:"Undo"}),t.jsxs(U,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const m=h??s;g(null),c.requestDelete(m)},children:[t.jsx(re,{size:15}),"Delete"]})]})]},h?.id??s.id)]})}),t.jsx(Je,{hideHeader:!0,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(fs,{connection:s,displayTitle:(()=>{const m=d[0]??s;return m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.title})()}),t.jsx("div",{className:"flex-1 overflow-auto @container",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-2 gap-5 p-6",children:[t.jsx(is,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(Kt,{instances:d,onConfigure:m=>g(m),onAuthenticate:m=>A(m.id),onDelete:m=>c.requestDelete(m),onToggleStatus:async(m,$)=>{try{await x.update.mutateAsync({id:m.id,data:{status:$}}),G.success($==="active"?"Connection enabled":"Connection disabled")}catch{G.error("Failed to update connection")}},isAdding:v,onAdd:async()=>{b(!0);try{const m=d[0]??s,$=m.title.replace(/\s*\(\d+\)\s*$/,""),E=d.length+1,D=`${$} (${E})`,Q=He("conn");await x.create.mutateAsync({id:Q,title:D,description:m.description??null,connection_type:m.connection_type,connection_url:m.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:m.created_by,organization_id:m.organization_id,icon:m.icon??null,app_name:m.app_name??null,app_id:m.app_id??null,connection_headers:m.connection_headers??null,oauth_config:null,configuration_state:m.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const oe=new URL(`/api/${p.slug}/mcp/${Q}`,window.location.origin),q=await at({url:oe.href,token:null,orgId:p.id});q.supportsOAuth&&!q.isAuthenticated&&await A(Q)}finally{b(!1)}}}),t.jsx(ls,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ms,{tools:r,prompts:o,resources:a,connectionId:e,org:n})})]})})]})})]})}function ys(){const s=P.c(39);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/settings/connections/$appSlug"},s[0]=e):e=s[0];const n=Y(e);let i;s[1]===Symbol.for("react.memo_cache_sentinel")?(i={from:"/shell/$org/settings/connections/$appSlug"},s[1]=i):i=s[1];const{appSlug:r,org:o}=Ee(i),{org:a}=J(),d=ye();let l;s[2]!==r?(l={slug:r},s[2]=r,s[3]=l):l=s[3];const u=tt(l),x=u[0]??null,p=x?.id??"",c=p||null;let h;s[4]!==a.id||s[5]!==a.slug||s[6]!==c?(h={connectionId:c,orgId:a.id,orgSlug:a.slug},s[4]=a.id,s[5]=a.slug,s[6]=c,s[7]=h):h=s[7];const g=_e(h);let v;s[8]!==g?(v={client:g},s[8]=g,s[9]=v):v=s[9];const{data:b}=st(v);let j;if(s[10]!==x?.tools||s[11]!==p||s[12]!==u||s[13]!==b){const A=b?b.tools.map(Ts):(x?.tools??[]).map(ks);e:{if(u.length<=1){j=A;break e}const z=new Set,R=[],m=Ss;for(const $ of u){const E=$.id===p?A:m($.tools);for(const D of E)z.has(D.name)||(z.add(D.name),R.push(D))}j=R.length>0?R:A}s[10]=x?.tools,s[11]=p,s[12]=u,s[13]=b,s[14]=j}else j=s[14];const N=j;let T;s[15]!==g?(T={client:g},s[15]=g,s[16]=T):T=s[16];const{data:S}=rt(T);let y;s[17]!==g?(y={client:g},s[17]=g,s[18]=y):y=s[18];const{data:I}=Ve(y);let _;s[19]!==S?.prompts?(_=S?.prompts??[],s[19]=S?.prompts,s[20]=_):_=s[20];let k;s[21]!==_?(k=_.map(Cs),s[21]=_,s[22]=k):k=s[22];const C=k;let f;s[23]!==I?.resources?(f=I?.resources??[],s[23]=I?.resources,s[24]=f):f=s[24];let w;s[25]!==f?(w=f.map(_s),s[25]=f,s[26]=w):w=s[26];const M=w;if(!x){let A;return s[27]!==n||s[28]!==o?(A=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(ve,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(U,{variant:"outline",onClick:()=>n({to:"/$org/settings/connections",params:{org:o}}),children:"Back to connections"})})}),s[27]=n,s[28]=o,s[29]=A):A=s[29],A}let O;return s[30]!==d.update.isPending||s[31]!==N||s[32]!==x||s[33]!==p||s[34]!==o||s[35]!==C||s[36]!==M||s[37]!==u?(O=t.jsx(Ns,{org:o,connection:x,connectionId:p,isUpdating:d.update.isPending,tools:N,prompts:C,resources:M,siblings:u}),s[30]=d.update.isPending,s[31]=N,s[32]=x,s[33]=p,s[34]=o,s[35]=C,s[36]=M,s[37]=u,s[38]=O):O=s[38],O}function _s(s){return{name:s.name,description:s.description,uri:s.uri}}function Cs(s){return{name:s.name,description:s.description}}function Ss(s){return(s??[]).map(ws)}function ws(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ks(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ts(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Is(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ze,{children:t.jsx(K.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(ge,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(ys,{})})}),s[0]=e):e=s[0],e}function yo(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Is,{}),s[0]=e):e=s[0],e}export{yo as default};
1
+ import{H as he,af as Ae,b3 as $e,I as le,ad as De,c as P,j as t,i as ge,B as U,r as K,l as je,C as J,v as Pe,K as se,b as Y,aI as ce,z as Oe,b4 as Me,E as ze,e as Ee,b5 as Ve,n as Ue,M as Re,J as Fe,t as G,b6 as Le}from"./index-D-XSdETh.js";import{g as He}from"./extract-connection-data-BWpGE_oz.js";import{E as ve}from"./empty-state-B9-HAyiA.js";import{E as Be,c as We,r as Xe,b as qe,d as Ge}from"./connection-form-helpers-DITTUByC.js";import{c as Ke,S as Qe,V as Je}from"./index-WZvNIEEB.js";import{u as be,T as Ye}from"./use-mcp-auth-status-jWXMiVvz.js";import{a as Ze}from"./use-members-CK7dbfXy.js";import{A as et}from"./avatar-Dd_lcUPB.js";import{a as Ne,b as ye,u as tt}from"./use-connection-DwFoylnd.js";import{u as _e}from"./use-mcp-client-BRb4dnPI.js";import{a as st}from"./use-mcp-tools-CWEnAqVn.js";import{c as nt,C as ot,a as it,d as rt}from"./AreaChart-BHulL81d.js";import{i as at,a as lt}from"./mcp-oauth-BvWzv6R3.js";import{I as ne}from"./integration-icon-VNiWpAhZ.js";import{s as ct}from"./Plus-DdMyRgmA.js";import{R as dt,S as mt,az as ut,b as xt}from"./agent-icon-BT1zF5P3.js";import{a as Ce,s as pt}from"./Settings02-7Lan3xs5.js";import{s as re}from"./Trash01--AWxA30K.js";import{q as ft,p as ht,o as gt,m as jt,n as vt}from"./sidebar-CRFVq_6w.js";import{F as L,b as H,c as B,d as V,f as W,e as bt,a as Nt}from"./form-CWd6cwuX.js";import{I as X}from"./input-dDAZFkLF.js";import{u as yt,D as _t}from"./use-delete-connection-BIJaDBxe.js";import{c as Ct,B as St,a as wt,C as kt}from"./monitoring-stats-row-Bw3Qs8aI.js";import{u as Tt}from"./studio-tools-ChuxRuTE.js";import{u as It}from"./use-virtual-mcp-DdUP8VhI.js";import{i as Se}from"./ChevronRight-DQPMDbxY.js";import{a as we}from"./Users03-CHsFtqWs.js";import{c as Z,b as At,T as ee,a as $t}from"./tabs-H5KA397C.js";import{g as ke}from"./connection-slug-eyAPH6o3.js";import{n as Dt}from"./ZapSquare-C99XNWC0.js";import{c as Pt}from"./Tool01-l46KKmTp.js";import{g as ae,M as Ot}from"./index-DH9MgJbR.js";import{C as Mt}from"./collection-search-Bpntk__o.js";import{C as zt}from"./card-BwdKy-hR.js";import{B as Et}from"./badge-BnJCnUD8.js";import{D as Vt,a as Ut,c as Rt,d as de}from"./dropdown-menu-DNr9TTIb.js";import{S as me,a as ue,b as xe,c as pe,d as F}from"./select-CeW7yHMj.js";import{i as Ft}from"./CheckCircle-BrCHMLmT.js";import{t as Lt}from"./ChevronDown-DMrJ8qUd.js";import{n as Ht}from"./Tool02-Bedsr6M0.js";import{s as te}from"./Star01-DOEEbMVN.js";import{s as Bt}from"./XClose-Bg6DW9hR.js";import"./index-BeANJeGc.js";import"./ZoomOut-BtgkZIdX.js";import"./Key01-LGwwdQ_o.js";import"./auth-Dpm13msT.js";import"./use-registry-connections-Ce-C-NcA.js";import"./use-organization-settings-qUhh6e_h.js";import"./index-BZl6Yjy6.js";import"./index-rO-ko2ge.js";import"./popover-C8gRT3GW.js";import"./tooltip-DnEd2RfI.js";import"./Check-BCiV8JPd.js";import"./SearchMd-DXtYkdlk.js";import"./use-mobile-Cnw8TO8w.js";import"./use-create-virtual-mcp-D3JcLono.js";import"./use-navigate-to-agent-CGlqFZD-.js";import"./hooks-NSDTMWs-.js";import"./decopilot-sse-pool-BBRtwl-P.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./Eye-BtZsG05u.js";import"./use-org-auth-client-CHi-WaYM.js";import"./User01-5weGoSXw.js";import"./use-collections-nHSnEcq_.js";import"./AlertCircle-COm2lZmB.js";import"./ArrowUp-CIDj-geR.js";import"./ArrowRight-BBZ4k1tZ.js";import"./ArrowUpRight-CZl49s-_.js";import"./TrendUp01-BYfwoU6O.js";import"./ChevronUp-B4eyFU9D.js";import"./DotsVertical-CaiMMtiU.js";import"./Stars02-D0cgeCkL.js";import"./Copy01-B5PsaZtC.js";import"./Globe01-BBalwuJ-.js";import"./FilterLines-R3LckEdX.js";import"./Globe04-BoTer0PL.js";import"./SwitchHorizontal01-Du8IH-As.js";import"./HardDrive-B-gJ3Ugg.js";import"./Image01-vVeK01uU.js";import"./LayoutLeft-DSvzQ3F0.js";import"./XCircle-CDWV_SjD.js";import"./LinkExternal01-DAa_z87G.js";import"./Monitor01-Cp0O-ipq.js";import"./Sun-DWZWERXA.js";import"./Package-Do8Z10X9.js";import"./Palette-BxScKXfV.js";import"./Play-DxmYkTCO.js";import"./SearchLg-Cuf8OlKN.js";import"./Shield01-DA0MY5vq.js";import"./Stars01-C_W_4866.js";import"./Upload01-D8P_FbUI.js";import"./Users01-DZAmzF4m.js";import"./X-CxPemOwM.js";import"./Zap-rnKuI319.js";import"./label-BmPwCD_l.js";import"./alert-dialog-DEnhZkxC.js";const Wt=he({scopes:De(le()).describe("List of scopes available"),stateSchema:Ae(le(),$e()).describe("JSON Schema (draft-07) defining the state structure")}),Xt=[{name:"MCP_CONFIGURATION",inputSchema:he({}),outputSchema:Wt}];function qt(s){const e=P.c(46),{instance:n,onConfigure:i,onAuthenticate:r,onDelete:o,onToggleStatus:a}=s;let d;e[0]!==n.id?(d={connectionId:n.id},e[0]=n.id,e[1]=d):d=e[1];const l=be(d),x=!(n.connection_type==="VIRTUAL")&&l.supportsOAuth&&!l.isAuthenticated,p=n.status!=="active",c=x||p?"border-destructive/50 bg-destructive/5":"border-transparent";let h;e[2]!==c?(h=je("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",c),e[2]=c,e[3]=h):h=e[3];let g;e[4]!==n.icon||e[5]!==n.title?(g=t.jsx(ne,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=g):g=e[6];let v;e[7]!==n.title?(v=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=v):v=e[8];let b;e[9]!==n.status||e[10]!==p||e[11]!==x?(b=x?t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}):p?t.jsx("span",{className:"text-xs text-destructive font-medium",children:n.status==="error"?"Disabled (error)":"Disabled"}):null,e[9]=n.status,e[10]=p,e[11]=x,e[12]=b):b=e[12];let j;e[13]!==v||e[14]!==b?(j=t.jsxs("div",{className:"flex-1 min-w-0",children:[v,b]}),e[13]=v,e[14]=b,e[15]=j):j=e[15];let N;e[16]!==n||e[17]!==x||e[18]!==r?(N=x&&t.jsx(U,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>r(n),children:"Authorize"}),e[16]=n,e[17]=x,e[18]=r,e[19]=N):N=e[19];let T;e[20]!==n||e[21]!==p||e[22]!==a?(T=p?t.jsxs(U,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>a(n,"active"),children:[t.jsx(dt,{size:13}),"Enable"]}):t.jsx(U,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>a(n,"inactive"),title:"Disable",children:t.jsx(mt,{size:13})}),e[20]=n,e[21]=p,e[22]=a,e[23]=T):T=e[23];let S;e[24]!==n||e[25]!==i?(S=()=>i(n),e[24]=n,e[25]=i,e[26]=S):S=e[26];let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(Ce,{size:13}),e[27]=y):y=e[27];let I;e[28]!==S?(I=t.jsx(U,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:S,title:"Configure",children:y}),e[28]=S,e[29]=I):I=e[29];let _;e[30]!==n||e[31]!==o?(_=()=>o(n),e[30]=n,e[31]=o,e[32]=_):_=e[32];let k;e[33]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(re,{size:13}),e[33]=k):k=e[33];let C;e[34]!==_?(C=t.jsx(U,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:_,title:"Delete",children:k}),e[34]=_,e[35]=C):C=e[35];let f;e[36]!==I||e[37]!==C||e[38]!==N||e[39]!==T?(f=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[N,T,I,C]}),e[36]=I,e[37]=C,e[38]=N,e[39]=T,e[40]=f):f=e[40];let w;return e[41]!==f||e[42]!==h||e[43]!==g||e[44]!==j?(w=t.jsxs("div",{className:h,children:[g,j,f]}),e[41]=f,e[42]=h,e[43]=g,e[44]=j,e[45]=w):w=e[45],w}function Gt(s){const e=P.c(15),{instance:n,onConfigure:i}=s;let r;e[0]!==n.icon||e[1]!==n.title?(r=t.jsx(ne,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=r):r=e[2];let o;e[3]!==n.title?(o=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",children:n.title})}),e[3]=n.title,e[4]=o):o=e[4];let a;e[5]!==n||e[6]!==i?(a=()=>i(n),e[5]=n,e[6]=i,e[7]=a):a=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Ce,{size:13}),e[8]=d):d=e[8];let l;e[9]!==a?(l=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(U,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a,title:"Configure",children:d})}),e[9]=a,e[10]=l):l=e[10];let u;return e[11]!==r||e[12]!==o||e[13]!==l?(u=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[r,o,l]}),e[11]=r,e[12]=o,e[13]=l,e[14]=u):u=e[14],u}function Kt(s){const e=P.c(27),{instances:n,onConfigure:i,onAuthenticate:r,onDelete:o,onToggleStatus:a,onAdd:d,isAdding:l}=s;if(n.length===0)return null;const u=n.length===1?"Instance":"Instances";let x;e[0]!==u?(x=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:u}),e[0]=u,e[1]=x):x=e[1];let p;e[2]!==l?(p=l?t.jsx(ge,{size:13,className:"animate-spin"}):t.jsx(ct,{size:13}),e[2]=l,e[3]=p):p=e[3];let c;e[4]!==l||e[5]!==d||e[6]!==p?(c=t.jsxs(U,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:d,disabled:l,children:[p,"Add instance"]}),e[4]=l,e[5]=d,e[6]=p,e[7]=c):c=e[7];let h;e[8]!==x||e[9]!==c?(h=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[x,c]}),e[8]=x,e[9]=c,e[10]=h):h=e[10];let g;if(e[11]!==n||e[12]!==r||e[13]!==i||e[14]!==o||e[15]!==a){let j;e[17]!==r||e[18]!==i||e[19]!==o||e[20]!==a?(j=N=>t.jsx(K.Suspense,{fallback:t.jsx(Gt,{instance:N,onConfigure:i}),children:t.jsx(qt,{instance:N,onConfigure:i,onAuthenticate:r,onDelete:o,onToggleStatus:a})},N.id),e[17]=r,e[18]=i,e[19]=o,e[20]=a,e[21]=j):j=e[21],g=n.map(j),e[11]=n,e[12]=r,e[13]=i,e[14]=o,e[15]=a,e[16]=g}else g=e[16];let v;e[22]!==g?(v=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:g}),e[22]=g,e[23]=v):v=e[23];let b;return e[24]!==h||e[25]!==v?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[h,v]}),e[24]=h,e[25]=v,e[26]=b):b=e[26],b}function Qt(s,e=3){const n=new Map;for(const i of s){if(!i.isError)continue;const r=(i.errorMessage??"").trim()||"Unknown error";n.set(r,(n.get(r)??0)+1)}return[...n.entries()].map(([i,r])=>({message:i,count:r})).sort((i,r)=>r.count-i.count).slice(0,e)}const Jt=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function Yt(s){const e=new Date,n=new Date(e);return s==="7d"?n.setDate(n.getDate()-7):s==="14d"?n.setDate(n.getDate()-14):n.setDate(n.getDate()-30),{startDate:n,endDate:e}}const Zt={calls:{label:"Tool calls"},errors:{label:"Errors"}};function es(s){const e=P.c(1),{connectionId:n,orgId:i,timeframe:r}=s,o=Tt(),a=Yt(r),{data:d}=Pe({queryKey:se.connectionActivity(n,r,i),queryFn:async()=>await o.call("MONITORING_LOGS_LIST",{startDate:a.startDate.toISOString(),endDate:a.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}),staleTime:3e5}),l=Ct(d?.logs??[],a),u=l.data,x=l.totalCalls>0,p=Qt(d?.logs??[]),c=l.totalCalls>0?Math.round(l.totalErrors/l.totalCalls*100):0;let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[0]=h):h=e[0],t.jsxs("div",{children:[t.jsxs("div",{className:"flex gap-6 px-5 pb-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:l.totalCalls.toLocaleString()}),h]}),l.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:l.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),l.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(l.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),x?t.jsxs("div",{children:[t.jsx(nt,{config:Zt,className:"h-16 w-full",children:t.jsxs(St,{data:u,barCategoryGap:"4%",children:[t.jsx(ot,{content:t.jsx(it,{labelFormatter:ns}),cursor:{fill:"var(--muted)"}}),t.jsx(wt,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:u.map(ss)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[u.length-1]?.label})]})]}):t.jsx("div",{className:"h-20 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-muted-foreground/60",children:"No activity in this period"})}),p.length>0&&t.jsxs("div",{className:"px-5 py-4 border-t border-border",children:[t.jsxs("p",{className:"text-xs font-medium text-muted-foreground mb-2",children:["Top errors",c>0?` · ${c}% of calls failed`:""]}),t.jsx("ul",{className:"space-y-1.5",children:p.map(ts)})]})]})}function ts(s){return t.jsxs("li",{className:"flex items-start gap-2 text-xs",children:[t.jsxs("span",{className:"tabular-nums text-destructive font-medium shrink-0",children:[s.count.toLocaleString(),"×"]}),t.jsx("span",{className:"text-muted-foreground truncate",title:s.message,children:s.message})]},s.message)}function ss(s,e){return t.jsx(kt,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function ns(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function os(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{children:[t.jsx("div",{className:"flex gap-6 px-5 pb-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx("div",{className:"h-7 w-16 rounded-md bg-muted animate-pulse"}),t.jsx("div",{className:"h-3 w-14 rounded bg-muted animate-pulse"})]})}),t.jsx("div",{className:"h-20 w-full rounded-md bg-muted animate-pulse"})]}),s[0]=e):e=s[0],e}function is(s){const e=P.c(13),{connectionId:n}=s,[i,r]=K.useState("14d"),{org:o}=J();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=a):a=e[0];let d;e[1]!==i?(d=Jt.map(c=>t.jsx("button",{type:"button",onClick:()=>r(c.value),className:je("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",i===c.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:c.label},c.value)),e[1]=i,e[2]=d):d=e[2];let l;e[3]!==d?(l=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[a,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:d})]}),e[3]=d,e[4]=l):l=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(os,{}),e[5]=u):u=e[5];let x;e[6]!==n||e[7]!==o.id||e[8]!==i?(x=t.jsx(K.Suspense,{fallback:u,children:t.jsx(es,{connectionId:n,orgId:o.id,timeframe:i})}),e[6]=n,e[7]=o.id,e[8]=i,e[9]=x):x=e[9];let p;return e[10]!==l||e[11]!==x?(p=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[l,x]}),e[10]=l,e[11]=x,e[12]=p):p=e[12],p}function rs(s){const e=P.c(15),{virtualMcp:n,org:i}=s,r=Y();let o;e[0]!==r||e[1]!==i||e[2]!==n.id?(o=()=>{const p=crypto.randomUUID();r({to:"/$org/$taskId",params:{org:i,taskId:p},search:{virtualmcpid:n.id}})},e[0]=r,e[1]=i,e[2]=n.id,e[3]=o):o=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(we,{size:16}),e[4]=a):a=e[4];let d;e[5]!==n.icon||e[6]!==n.title?(d=t.jsx(ne,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:a}),e[5]=n.icon,e[6]=n.title,e[7]=d):d=e[7];let l;e[8]!==n.title?(l=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=l):l=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(Se,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[10]=u):u=e[10];let x;return e[11]!==o||e[12]!==d||e[13]!==l?(x=t.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group text-left w-full",children:[d,l,u]}),e[11]=o,e[12]=d,e[13]=l,e[14]=x):x=e[14],x}function as(s){const e=P.c(7),{virtualMcps:n,org:i}=s;let r;if(e[0]!==i||e[1]!==n){let a;e[3]!==i?(a=d=>t.jsx(rs,{virtualMcp:d,org:i},d.id),e[3]=i,e[4]=a):a=e[4],r=n.map(a),e[0]=i,e[1]=n,e[2]=r}else r=e[2];let o;return e[5]!==r?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:r})}),e[5]=r,e[6]=o):o=e[6],o}function ls(s){const e=P.c(7),{connection:n}=s,{org:i}=J();let r;e[0]!==n.id?(r={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=r):r=e[1];const o=It(r);if(!(o.length>0)){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(t.Fragment,{}),e[2]=u):u=e[2],u}let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("div",{className:"px-5 py-4 border-b border-border",children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Used by agents"})}),e[3]=d):d=e[3];let l;return e[4]!==i.slug||e[5]!==o?(l=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[d,t.jsx("div",{className:"px-5 py-4",children:t.jsx(as,{virtualMcps:o,org:i.slug})})]}),e[4]=i.slug,e[5]=o,e[6]=l):l=e[6],l}function cs(s){const e=P.c(31),{tools:n,connectionId:i,org:r}=s,o=Y(),{org:a}=J();let d;e[0]!==i||e[1]!==a.id||e[2]!==a.slug?(d={connectionId:i,orgId:a.id,orgSlug:a.slug},e[0]=i,e[1]=a.id,e[2]=a.slug,e[3]=d):d=e[3];const l=_e(d),u=Ne(i);let x;e[4]!==u||e[5]!==i?(x=u?ke(u):i,e[4]=u,e[5]=i,e[6]=x):x=e[6];const p=x,[c,h]=K.useState("");let g,v,b,j;if(e[7]!==p||e[8]!==l||e[9]!==o||e[10]!==r||e[11]!==c||e[12]!==n){const S=(n??[]).filter(ds),y=c.toLowerCase().trim(),I=y?S.filter(f=>f.name.toLowerCase().includes(y)||f.description&&f.description.toLowerCase().includes(y)):S;let _;e[17]!==p||e[18]!==o||e[19]!==r?(_=f=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(f.name)}})},e[17]=p,e[18]=o,e[19]=r,e[20]=_):_=e[20];const k=_;b="flex flex-col h-full overflow-hidden";let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=f=>{f.key==="Escape"&&(h(""),f.target.blur())},e[21]=C):C=e[21],e[22]!==c?(j=t.jsx(Mt,{value:c,onChange:h,placeholder:"Search apps...",onKeyDown:C}),e[22]=c,e[23]=j):j=e[23],g="flex-1 overflow-auto p-5",v=I.length===0?t.jsx(ve,{image:null,title:c?"No apps found":"No apps available",description:c?"Try adjusting your search terms":"This connection doesn't have any tools with interactive UIs yet."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:I.map(f=>{const w=ae(f._meta);return t.jsxs(zt,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>k(f),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(Ot,{resourceURI:w,toolInfo:{tool:f},displayMode:"inline",minHeight:200,maxHeight:200,client:l})}),t.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:f.name}),t.jsx(Ye,{annotations:f.annotations,_meta:f._meta})]}),f.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:f.description})]})]},f.name)})}),e[7]=p,e[8]=l,e[9]=o,e[10]=r,e[11]=c,e[12]=n,e[13]=g,e[14]=v,e[15]=b,e[16]=j}else g=e[13],v=e[14],b=e[15],j=e[16];let N;e[24]!==g||e[25]!==v?(N=t.jsx("div",{className:g,children:v}),e[24]=g,e[25]=v,e[26]=N):N=e[26];let T;return e[27]!==b||e[28]!==j||e[29]!==N?(T=t.jsxs("div",{className:b,children:[j,N]}),e[27]=b,e[28]=j,e[29]=N,e[30]=T):T=e[30],T}function ds(s){return!!ae(s._meta)}function Te(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=a=>a.charAt(0).toUpperCase()+a.slice(1),i=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),r=e.map(n),o=e[e.length-1];return r.length>=2&&o&&i.has(o)?[r.pop(),...r].join(" "):r.join(" ")}function ie(s){const e=P.c(2),{label:n}=s;let i;return e[0]!==n?(i=t.jsx("div",{className:"px-5 py-8 text-center",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",n," available."]})}),e[0]=n,e[1]=i):i=e[1],i}function ms(s){const e=P.c(50),{tools:n,prompts:i,resources:r,connectionId:o,org:a}=s;let d;e[0]!==i?(d=i===void 0?[]:i,e[0]=i,e[1]=d):d=e[1];const l=d;let u;e[2]!==r?(u=r===void 0?[]:r,e[2]=r,e[3]=u):u=e[3];const x=u,p=Y(),c=Ne(o??"");let h;e[4]!==c||e[5]!==o?(h=c?ke(c):o,e[4]=c,e[5]=o,e[6]=h):h=e[6];const g=h;let v;e[7]!==g||e[8]!==o||e[9]!==p||e[10]!==a?(v=function($){!o||!a||p({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:a,appSlug:g,collectionName:"tools",itemId:encodeURIComponent($)}})},e[7]=g,e[8]=o,e[9]=p,e[10]=a,e[11]=v):v=e[11];const b=v;let j;e[12]!==o||e[13]!==a||e[14]!==n?(j=o&&a&&n.some(ps),e[12]=o,e[13]=a,e[14]=n,e[15]=j):j=e[15];const N=j;if(n.length+l.length+x.length===0){let m;return e[16]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:"Capabilities"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"No capabilities discovered yet. The connection may still be connecting."})]}),e[16]=m):m=e[16],m}let S;e[17]!==n.length?(S=t.jsxs(Z,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=S):S=e[18];let y;e[19]!==N?(y=N&&t.jsx(Z,{value:"apps",variant:"underline",children:"UI"}),e[19]=N,e[20]=y):y=e[20];let I,_;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(Z,{value:"prompts",variant:"underline",children:"Prompts"}),_=t.jsx(Z,{value:"resources",variant:"underline",children:"Resources"}),e[21]=I,e[22]=_):(I=e[21],_=e[22]);let k;e[23]!==S||e[24]!==y?(k=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(At,{variant:"underline",className:"gap-1",children:[S,y,I,_]})}),e[23]=S,e[24]=y,e[25]=k):k=e[25];let C;e[26]!==b||e[27]!==n?(C=n.length>0?n.map(m=>t.jsxs("button",{type:"button",className:"w-full flex items-start gap-3 px-5 py-3 text-left hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>b(m.name),children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(Pt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Te(m.name)}),m.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:m.description})]}),t.jsx(Se,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},m.name)):t.jsx(ie,{label:"tools"}),e[26]=b,e[27]=n,e[28]=C):C=e[28];let f;e[29]!==C?(f=t.jsx(ee,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:C})}),e[29]=C,e[30]=f):f=e[30];let w;e[31]!==o||e[32]!==N||e[33]!==a||e[34]!==n?(w=N&&t.jsx(ee,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(cs,{tools:n,connectionId:o,org:a})}),e[31]=o,e[32]=N,e[33]=a,e[34]=n,e[35]=w):w=e[35];let M;e[36]!==l?(M=l.length>0?l.map(xs):t.jsx(ie,{label:"prompts"}),e[36]=l,e[37]=M):M=e[37];let O;e[38]!==M?(O=t.jsx(ee,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:M})}),e[38]=M,e[39]=O):O=e[39];let A;e[40]!==x?(A=x.length>0?x.map(us):t.jsx(ie,{label:"resources"}),e[40]=x,e[41]=A):A=e[41];let z;e[42]!==A?(z=t.jsx(ee,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:A})}),e[42]=A,e[43]=z):z=e[43];let R;return e[44]!==k||e[45]!==f||e[46]!==w||e[47]!==O||e[48]!==z?(R=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs($t,{defaultValue:"tools",variant:"underline",children:[k,f,w,O,z]})}),e[44]=k,e[45]=f,e[46]=w,e[47]=O,e[48]=z,e[49]=R):R=e[49],R}function us(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(ut,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:s.name}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description}),s.uri&&t.jsx("div",{className:"text-xs text-muted-foreground/60 font-mono mt-0.5 truncate",children:s.uri})]})]},s.uri??s.name)}function xs(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(Dt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Te(s.name)}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description})]})]},s.name)}function ps(s){return ae(s._meta)}function fs(s){const e=P.c(13),{connection:n,displayTitle:i}=s,r=i??n.title;let o;e[0]!==n.icon||e[1]!==r?(o=t.jsx(ne,{icon:n.icon,name:r,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=r,e[2]=o):o=e[2];let a;e[3]!==r?(a=t.jsx("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:t.jsx("h1",{className:"text-lg md:text-xl font-semibold tracking-tight text-foreground leading-none",children:r})}),e[3]=r,e[4]=a):a=e[4];let d;e[5]!==n.description?(d=n.description&&t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed line-clamp-2",children:n.description}),e[5]=n.description,e[6]=d):d=e[6];let l;e[7]!==a||e[8]!==d?(l=t.jsxs("div",{className:"flex-1 min-w-0",children:[a,d]}),e[7]=a,e[8]=d,e[9]=l):l=e[9];let u;return e[10]!==o||e[11]!==l?(u=t.jsxs("div",{className:"flex items-center gap-4 md:gap-6 py-5 md:py-7 px-4 md:px-8 bg-background border-b border-border shrink-0",children:[o,l]}),e[10]=o,e[11]=l,e[12]=u):u=e[12],u}function hs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:i,onRemoveOAuth:r}){const o=ce({control:s.control,name:"ui_type"}),a=ce({control:s.control,name:"connection_url"}),{stdioEnabled:d}=Oe(),l=(()=>{if(typeof a!="string"||!a)return!1;try{const c=new URL(a);return c.hostname==="api.githubcopilot.com"&&c.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),u=d||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",p=x?Me(e.connection_url):null;return x?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(we,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),p&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),t.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:t.jsx("code",{className:"text-sm text-muted-foreground",children:p})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(L,{control:s.control,name:"ui_type",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),o!=="NPX"&&o!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(me,{value:c.value,onValueChange:c.onChange,children:[t.jsx(V,{children:t.jsxs(ue,{className:"h-full! w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(te,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(xe,{})]})}),t.jsxs(pe,{children:[t.jsx(F,{value:"HTTP",children:"HTTP"}),t.jsx(F,{value:"SSE",children:"SSE"}),t.jsx(F,{value:"Websocket",children:"Websocket"}),u&&t.jsxs(t.Fragment,{children:[t.jsx(F,{value:"NPX",children:"NPX Package"}),t.jsx(F,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(L,{control:s.control,name:"connection_url",render:({field:h})=>t.jsx(H,{className:"flex-1 min-w-0",children:t.jsx(V,{children:t.jsx(X,{placeholder:"https://example.com/mcp",...h,value:h.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(me,{value:c.value,onValueChange:c.onChange,children:[t.jsx(V,{children:t.jsx(ue,{className:"h-10",children:t.jsx(xe,{})})}),t.jsxs(pe,{children:[t.jsx(F,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(te,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(F,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(te,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(F,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(te,{className:"w-4 h-4"}),"Websocket"]})}),u&&t.jsxs(t.Fragment,{children:[t.jsx(F,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ht,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(F,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(xt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(W,{})]})}),o==="NPX"&&t.jsx(L,{control:s.control,name:"npx_package",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(V,{children:t.jsx(X,{placeholder:"@perplexity-ai/mcp-server",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),o==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(L,{control:s.control,name:"stdio_command",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(V,{children:t.jsx(X,{placeholder:"node, bun, python...",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),t.jsx(L,{control:s.control,name:"stdio_args",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(V,{children:t.jsx(X,{placeholder:"arg1 arg2 --flag value",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(W,{})]})})]}),t.jsx(L,{control:s.control,name:"stdio_cwd",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(V,{children:t.jsx(X,{placeholder:"/path/to/project (optional)",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(L,{control:s.control,name:"env_vars",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(V,{children:t.jsx(Be,{value:c.value??[],onChange:c.onChange})}),t.jsx(W,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(L,{control:s.control,name:"connection_token",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:l?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Vt,{children:[t.jsx(Ut,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Et,{variant:"success",className:"gap-1.5",children:[t.jsx(Ft,{size:12}),"Authenticated via OAuth",t.jsx(Lt,{size:12})]})})}),t.jsxs(Rt,{align:"start",children:[t.jsxs(de,{onClick:i,children:[t.jsx(pt,{size:16}),"Re-authenticate"]}),t.jsxs(de,{variant:"destructive",onClick:r,children:[t.jsx(re,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&c.value===null?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>c.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(Bt,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(X,{type:"password",placeholder:l?"Paste your GitHub PAT":"Enter access token...",...c,value:c.value||"",className:"h-10 rounded-lg"})}),l&&t.jsxs(bt,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(W,{})]})})]})}function gs(s){return s.command==="npx"}function js(s){return s.args?.find(e=>!e.startsWith("-"))??""}function vs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function fe(s,e){const n={title:s.title,description:s.description??"",icon:s.icon??null,configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&Le(s.connection_headers)){const i=s.connection_headers,r=Xe(i.envVars);if(gs(i)){const a=js(i);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:a,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const o=vs(i);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:o.command,stdio_args:o.args,stdio_cwd:o.cwd,env_vars:r}}return{...n,ui_type:s.connection_type,connection_url:s.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function bs(s){let e,n=null,i=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=qe(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",r=Ge(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",i=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...i&&{connection_token:i},...r&&{connection_headers:r},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function Ns({connection:s,connectionId:e,org:n,isUpdating:i,tools:r,prompts:o,resources:a,siblings:d}){const l=Y({from:"/$org/settings/connections/$appSlug"}),u=Ue(),x=ye(),{org:p}=J(),c=yt({onSuccess:()=>{d.length<=1&&l({to:"/$org/settings/connections",params:{org:n}})}}),[h,g]=K.useState(null),[v,b]=K.useState(!1),j=be({connectionId:e}),{data:N}=Ze(),T=N?.data?.members??[],S=h??s,y=T.find(m=>m.userId===S.created_by),_=s?.connection_type==="VIRTUAL"||j.isAuthenticated,k={...s,tools:r},C=Ke(k,Xt),f=Re({resolver:Fe(We),values:fe(h??s)}),w=f.formState.isDirty,M=async()=>{if(!await f.trigger())return;const $=f.getValues(),E=bs($),D=h?.id??e;await x.update.mutateAsync({id:D,data:E}),f.reset($)},O=()=>{f.reset(fe(h??s))},A=async m=>{const $=s.configuration_scopes?.length?s.configuration_scopes.join(" "):void 0,{token:E,tokenInfo:D,error:Q}=await lt({connectionId:m,orgSlug:p.slug,...$?{scope:$}:{}});if(Q||!E){G.error(`Authentication failed: ${Q}`);return}if(D)try{const q=await fetch(`/api/${p.slug}/connections/${m}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:D.accessToken,refreshToken:D.refreshToken,expiresIn:D.expiresIn,scope:D.scope,clientId:D.clientId,clientSecret:D.clientSecret,tokenEndpoint:D.tokenEndpoint})});if(!q.ok)console.error("Failed to save OAuth token:",await q.text()),await x.update.mutateAsync({id:m,data:{connection_token:E}});else try{await x.update.mutateAsync({id:m,data:{}})}catch(Ie){console.warn("Failed to refresh connection tools after OAuth:",Ie)}}catch(q){console.error("Error saving OAuth token:",q),await x.update.mutateAsync({id:m,data:{connection_token:E}})}else await x.update.mutateAsync({id:m,data:{connection_token:E}});const oe=new URL(`/api/${p.slug}/mcp/${m}`,window.location.origin);await u.invalidateQueries({queryKey:se.isMCPAuthenticated(oe.href,null)}),await u.invalidateQueries({queryKey:se.mcpClientPrefix()}),G.success("Authentication successful")},z=()=>A(s.id),R=async()=>{try{const m=await fetch(`/api/${p.slug}/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!m.ok){const E=await m.text();G.error(`Failed to remove OAuth: ${E}`);return}const $=new URL(`/api/${p.slug}/mcp/${s.id}`,window.location.origin);await u.invalidateQueries({queryKey:se.isMCPAuthenticated($.href,null)}),G.success("OAuth removed. You can now re-authenticate with a different account.")}catch(m){console.error("Error removing OAuth token:",m),G.error("Failed to remove OAuth")}};return t.jsxs(t.Fragment,{children:[t.jsx(_t,{...c}),t.jsx(ft,{open:h!==null,onOpenChange:m=>{m||g(null)},children:t.jsxs(ht,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(gt,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(jt,{className:"text-base",children:h?.title??s.title}),t.jsx(vt,{className:"text-xs",children:"Update URL, authentication, and other settings"}),y&&t.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Connected by"}),t.jsx(et,{url:y.user?.image??void 0,fallback:y.user?.name??y.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:y.user?.name||y.user?.email})]})]}),t.jsxs(Nt,{...f,children:[t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 md:px-6 md:py-5 flex flex-col gap-4 md:gap-6",children:[t.jsxs("div",{className:"flex flex-col gap-3 md:gap-4",children:[t.jsx(L,{control:f.control,name:"title",render:({field:m})=>t.jsxs(H,{children:[t.jsx(B,{children:"Name"}),t.jsx(V,{children:t.jsx(X,{...m})}),t.jsx(W,{})]})}),t.jsx(L,{control:f.control,name:"description",render:({field:m})=>t.jsxs(H,{children:[t.jsx(B,{children:"Description"}),t.jsx(V,{children:t.jsx(X,{...m,value:m.value||""})}),t.jsx(W,{})]})})]}),t.jsx(hs,{form:f,connection:h??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:z,onRemoveOAuth:R}),t.jsx(Qe,{connection:h??s,form:f,hasMcpBinding:C,isMCPAuthenticated:_,supportsOAuth:j.supportsOAuth,isServerError:j.isServerError,onAuthenticate:z,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(U,{onClick:M,disabled:!w||i,className:"flex-1",children:i?"Saving…":"Save changes"}),w&&t.jsx(U,{variant:"outline",onClick:O,children:"Undo"}),t.jsxs(U,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const m=h??s;g(null),c.requestDelete(m)},children:[t.jsx(re,{size:15}),"Delete"]})]})]},h?.id??s.id)]})}),t.jsx(Je,{hideHeader:!0,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(fs,{connection:s,displayTitle:(()=>{const m=d[0]??s;return m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.title})()}),t.jsx("div",{className:"flex-1 overflow-auto @container",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-2 gap-5 p-6",children:[t.jsx(is,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(Kt,{instances:d,onConfigure:m=>g(m),onAuthenticate:m=>A(m.id),onDelete:m=>c.requestDelete(m),onToggleStatus:async(m,$)=>{try{await x.update.mutateAsync({id:m.id,data:{status:$}}),G.success($==="active"?"Connection enabled":"Connection disabled")}catch{G.error("Failed to update connection")}},isAdding:v,onAdd:async()=>{b(!0);try{const m=d[0]??s,$=m.title.replace(/\s*\(\d+\)\s*$/,""),E=d.length+1,D=`${$} (${E})`,Q=He("conn");await x.create.mutateAsync({id:Q,title:D,description:m.description??null,connection_type:m.connection_type,connection_url:m.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:m.created_by,organization_id:m.organization_id,icon:m.icon??null,app_name:m.app_name??null,app_id:m.app_id??null,connection_headers:m.connection_headers??null,oauth_config:null,configuration_state:m.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const oe=new URL(`/api/${p.slug}/mcp/${Q}`,window.location.origin),q=await at({url:oe.href,token:null,orgId:p.id});q.supportsOAuth&&!q.isAuthenticated&&await A(Q)}finally{b(!1)}}}),t.jsx(ls,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ms,{tools:r,prompts:o,resources:a,connectionId:e,org:n})})]})})]})})]})}function ys(){const s=P.c(39);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/settings/connections/$appSlug"},s[0]=e):e=s[0];const n=Y(e);let i;s[1]===Symbol.for("react.memo_cache_sentinel")?(i={from:"/shell/$org/settings/connections/$appSlug"},s[1]=i):i=s[1];const{appSlug:r,org:o}=Ee(i),{org:a}=J(),d=ye();let l;s[2]!==r?(l={slug:r},s[2]=r,s[3]=l):l=s[3];const u=tt(l),x=u[0]??null,p=x?.id??"",c=p||null;let h;s[4]!==a.id||s[5]!==a.slug||s[6]!==c?(h={connectionId:c,orgId:a.id,orgSlug:a.slug},s[4]=a.id,s[5]=a.slug,s[6]=c,s[7]=h):h=s[7];const g=_e(h);let v;s[8]!==g?(v={client:g},s[8]=g,s[9]=v):v=s[9];const{data:b}=st(v);let j;if(s[10]!==x?.tools||s[11]!==p||s[12]!==u||s[13]!==b){const A=b?b.tools.map(Ts):(x?.tools??[]).map(ks);e:{if(u.length<=1){j=A;break e}const z=new Set,R=[],m=Ss;for(const $ of u){const E=$.id===p?A:m($.tools);for(const D of E)z.has(D.name)||(z.add(D.name),R.push(D))}j=R.length>0?R:A}s[10]=x?.tools,s[11]=p,s[12]=u,s[13]=b,s[14]=j}else j=s[14];const N=j;let T;s[15]!==g?(T={client:g},s[15]=g,s[16]=T):T=s[16];const{data:S}=rt(T);let y;s[17]!==g?(y={client:g},s[17]=g,s[18]=y):y=s[18];const{data:I}=Ve(y);let _;s[19]!==S?.prompts?(_=S?.prompts??[],s[19]=S?.prompts,s[20]=_):_=s[20];let k;s[21]!==_?(k=_.map(Cs),s[21]=_,s[22]=k):k=s[22];const C=k;let f;s[23]!==I?.resources?(f=I?.resources??[],s[23]=I?.resources,s[24]=f):f=s[24];let w;s[25]!==f?(w=f.map(_s),s[25]=f,s[26]=w):w=s[26];const M=w;if(!x){let A;return s[27]!==n||s[28]!==o?(A=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(ve,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(U,{variant:"outline",onClick:()=>n({to:"/$org/settings/connections",params:{org:o}}),children:"Back to connections"})})}),s[27]=n,s[28]=o,s[29]=A):A=s[29],A}let O;return s[30]!==d.update.isPending||s[31]!==N||s[32]!==x||s[33]!==p||s[34]!==o||s[35]!==C||s[36]!==M||s[37]!==u?(O=t.jsx(Ns,{org:o,connection:x,connectionId:p,isUpdating:d.update.isPending,tools:N,prompts:C,resources:M,siblings:u}),s[30]=d.update.isPending,s[31]=N,s[32]=x,s[33]=p,s[34]=o,s[35]=C,s[36]=M,s[37]=u,s[38]=O):O=s[38],O}function _s(s){return{name:s.name,description:s.description,uri:s.uri}}function Cs(s){return{name:s.name,description:s.description}}function Ss(s){return(s??[]).map(ws)}function ws(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ks(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ts(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Is(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ze,{children:t.jsx(K.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(ge,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(ys,{})})}),s[0]=e):e=s[0],e}function yo(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Is,{}),s[0]=e):e=s[0],e}export{yo as default};
@@ -1 +1 @@
1
- import{H as R,af as V,b3 as A,I as a,ad as j,ae as z,c as L,j as u,B as C}from"./index-CfAl6qA3.js";import{I as H}from"./input-C96iFBVQ.js";import{s as W}from"./Plus-CpvaryXc.js";import{s as q}from"./Trash01-CFIi5PAY.js";const K=R({key:a().min(1,"Key is required"),value:a()}),M=R({title:a().min(1,"Name is required"),description:a().nullable().optional(),icon:a().nullable().optional(),ui_type:z(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:a().optional(),connection_token:a().nullable().optional(),npx_package:a().optional(),stdio_command:a().optional(),stdio_args:a().optional(),stdio_cwd:a().optional(),env_vars:j(K).optional(),configuration_scopes:j(a()).nullable().optional(),configuration_state:V(a(),A()).nullable().optional()}).refine(n=>n.ui_type==="NPX"?!!n.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(n=>n.ui_type==="STDIO"?!!n.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(n=>n.ui_type==="HTTP"||n.ui_type==="SSE"||n.ui_type==="Websocket"?!!n.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function $(n){const e=n.toLowerCase();return!!(["secret","password","passwd","credential","private","token","bearer","jwt","refresh","session","api_key","apikey","auth_key","access_key","secret_key","private_key","service_key","encryption_key","signing_key","license_key","auth","oauth","client_secret","app_secret","webhook","signing","signature","database_url","db_url","mongo_uri","redis_url","postgres_url","mysql_url","connection_string","dsn","service_role","anon_key","supabase_key","openai","anthropic","stripe","twilio","sendgrid","resend","firebase","sentry","datadog","newrelic","new_relic","pplx","replicate","pinecone","cohere","hugging","hf_token","gh_token","npm_token","certificate","cert","ssl","tls","encryption","salt","hash","hmac","personal_access","github_pat","gitlab_pat","bitbucket_pat"].some(s=>e.includes(s))||["sk_","rk_","whsec_","pk_live","sk_live"].some(s=>e.startsWith(s))||["_key","_secret","_token","_password","_auth","_pat"].some(s=>e.endsWith(s)))}function X(n){const e=L.c(34),{value:t,onChange:r,keyPlaceholder:o,valuePlaceholder:s,className:v}=n,m=o===void 0?"VARIABLE_NAME":o,_=s===void 0?"value...":s;let b;e[0]!==r||e[1]!==t?(b=()=>{r([...t,{key:"",value:""}])},e[0]=r,e[1]=t,e[2]=b):b=e[2];const S=b;let x;e[3]!==r||e[4]!==t?(x=l=>{r(t.filter((p,i)=>i!==l))},e[3]=r,e[4]=t,e[5]=x):x=e[5];const g=x;let P;e[6]!==r||e[7]!==t?(P=(l,p)=>{const i=[...t],c=i[l];c&&(i[l]={key:p,value:c.value},r(i))},e[6]=r,e[7]=t,e[8]=P):P=e[8];const y=P;let w;e[9]!==r||e[10]!==t?(w=(l,p)=>{const i=[...t],c=i[l];c&&(i[l]={key:c.key,value:p},r(i))},e[9]=r,e[10]=t,e[11]=w):w=e[11];const k=w;let d;if(e[12]!==y||e[13]!==g||e[14]!==k||e[15]!==m||e[16]!==t||e[17]!==_){let l;e[19]!==y||e[20]!==g||e[21]!==k||e[22]!==m||e[23]!==_?(l=(p,i)=>u.jsxs("div",{className:"flex gap-2 items-center",children:[u.jsx(H,{placeholder:m,value:p.key,onChange:c=>y(i,c.target.value),className:"h-10 rounded-lg flex-1 font-mono text-sm"}),u.jsx(H,{type:$(p.key)?"password":"text",placeholder:_,value:p.value,onChange:c=>k(i,c.target.value),className:"h-10 rounded-lg flex-1"}),u.jsx(C,{type:"button",variant:"ghost",size:"icon",className:"h-10 w-10 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>g(i),children:u.jsx(q,{size:16})})]},i),e[19]=y,e[20]=g,e[21]=k,e[22]=m,e[23]=_,e[24]=l):l=e[24],d=t.map(l),e[12]=y,e[13]=g,e[14]=k,e[15]=m,e[16]=t,e[17]=_,e[18]=d}else d=e[18];let T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=u.jsx(W,{size:16,className:"mr-1"}),e[25]=T):T=e[25];let f;e[26]!==S?(f=u.jsxs(C,{type:"button",variant:"outline",size:"sm",className:"w-full h-9 text-muted-foreground",onClick:S,children:[T,"Add Environment Variable"]}),e[26]=S,e[27]=f):f=e[27];let h;e[28]!==d||e[29]!==f?(h=u.jsxs("div",{className:"flex flex-col gap-2",children:[d,f]}),e[28]=d,e[29]=f,e[30]=h):h=e[30];let E;return e[31]!==v||e[32]!==h?(E=u.jsx("div",{className:v,children:h}),e[31]=v,e[32]=h,e[33]=E):E=e[33],E}function I(n){const e={};for(const{key:t,value:r}of n)t.trim()&&(e[t.trim()]=r);return e}function D(n){return n?Object.entries(n).map(([e,t])=>({key:e,value:t})):[]}function N(n){const e=n.trim();if(!e)return"";try{const t=new URL(e),r=t.pathname.length>1?t.pathname.replace(/\/+$/,""):t.pathname;return`${t.origin}${r}`}catch{return e.replace(/\/+$/,"")}}function F(n){const e=n.trim().split(/\s+/).filter(Boolean);if(e.length<2)return null;const t=e[0]?.toLowerCase();if(t!=="npx"&&t!=="bunx")return null;const o=e.slice(1).find(s=>!s.startsWith("-"));return o?{packageName:o}:null}function Y(n){const{uiType:e}=n,t=N(n.connectionUrl??"");if((e==="HTTP"||e==="SSE"||e==="Websocket")&&t===N("https://api.githubcopilot.com/mcp/"))return{id:"github",title:"GitHub",description:"GitHub Copilot MCP",token:{label:"GitHub PAT",placeholder:"github_pat_…",helperText:"Paste a GitHub Personal Access Token (PAT)"}};const r=(n.npxPackage??"").trim();return e==="NPX"&&r==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function J(n){if(n.registryItems.length===0||n.uiType!=="HTTP"&&n.uiType!=="SSE"&&n.uiType!=="Websocket")return null;const e=N(n.connectionUrl??"");if(!e)return null;const t=n.registryItems.find(s=>(s.server?.remotes??[]).some(m=>N(m.url??"")===e));if(!t)return null;const r=t.title||t.name||t.server?.title||t.server?.name||"",o=t.server?.description||t.description||t.summary||null;return r?{id:"registry",title:r,description:o}:null}function Q(n,e){const t={command:"npx",args:["-y",n]},r=I(e);return Object.keys(r).length>0&&(t.envVars=r),t}function Z(n,e,t,r){const o={command:n};e.trim()&&(o.args=e.trim().split(/\s+/)),t?.trim()&&(o.cwd=t.trim());const s=I(r);return Object.keys(s).length>0&&(o.envVars=s),o}export{X as E,J as a,Q as b,M as c,Z as d,Y as i,F as p,D as r};
1
+ import{H as R,af as V,b3 as A,I as a,ad as j,ae as z,c as L,j as u,B as C}from"./index-D-XSdETh.js";import{I as H}from"./input-dDAZFkLF.js";import{s as W}from"./Plus-DdMyRgmA.js";import{s as q}from"./Trash01--AWxA30K.js";const K=R({key:a().min(1,"Key is required"),value:a()}),M=R({title:a().min(1,"Name is required"),description:a().nullable().optional(),icon:a().nullable().optional(),ui_type:z(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:a().optional(),connection_token:a().nullable().optional(),npx_package:a().optional(),stdio_command:a().optional(),stdio_args:a().optional(),stdio_cwd:a().optional(),env_vars:j(K).optional(),configuration_scopes:j(a()).nullable().optional(),configuration_state:V(a(),A()).nullable().optional()}).refine(n=>n.ui_type==="NPX"?!!n.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(n=>n.ui_type==="STDIO"?!!n.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(n=>n.ui_type==="HTTP"||n.ui_type==="SSE"||n.ui_type==="Websocket"?!!n.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function $(n){const e=n.toLowerCase();return!!(["secret","password","passwd","credential","private","token","bearer","jwt","refresh","session","api_key","apikey","auth_key","access_key","secret_key","private_key","service_key","encryption_key","signing_key","license_key","auth","oauth","client_secret","app_secret","webhook","signing","signature","database_url","db_url","mongo_uri","redis_url","postgres_url","mysql_url","connection_string","dsn","service_role","anon_key","supabase_key","openai","anthropic","stripe","twilio","sendgrid","resend","firebase","sentry","datadog","newrelic","new_relic","pplx","replicate","pinecone","cohere","hugging","hf_token","gh_token","npm_token","certificate","cert","ssl","tls","encryption","salt","hash","hmac","personal_access","github_pat","gitlab_pat","bitbucket_pat"].some(s=>e.includes(s))||["sk_","rk_","whsec_","pk_live","sk_live"].some(s=>e.startsWith(s))||["_key","_secret","_token","_password","_auth","_pat"].some(s=>e.endsWith(s)))}function X(n){const e=L.c(34),{value:t,onChange:r,keyPlaceholder:o,valuePlaceholder:s,className:v}=n,m=o===void 0?"VARIABLE_NAME":o,_=s===void 0?"value...":s;let b;e[0]!==r||e[1]!==t?(b=()=>{r([...t,{key:"",value:""}])},e[0]=r,e[1]=t,e[2]=b):b=e[2];const S=b;let x;e[3]!==r||e[4]!==t?(x=l=>{r(t.filter((p,i)=>i!==l))},e[3]=r,e[4]=t,e[5]=x):x=e[5];const g=x;let P;e[6]!==r||e[7]!==t?(P=(l,p)=>{const i=[...t],c=i[l];c&&(i[l]={key:p,value:c.value},r(i))},e[6]=r,e[7]=t,e[8]=P):P=e[8];const y=P;let w;e[9]!==r||e[10]!==t?(w=(l,p)=>{const i=[...t],c=i[l];c&&(i[l]={key:c.key,value:p},r(i))},e[9]=r,e[10]=t,e[11]=w):w=e[11];const k=w;let d;if(e[12]!==y||e[13]!==g||e[14]!==k||e[15]!==m||e[16]!==t||e[17]!==_){let l;e[19]!==y||e[20]!==g||e[21]!==k||e[22]!==m||e[23]!==_?(l=(p,i)=>u.jsxs("div",{className:"flex gap-2 items-center",children:[u.jsx(H,{placeholder:m,value:p.key,onChange:c=>y(i,c.target.value),className:"h-10 rounded-lg flex-1 font-mono text-sm"}),u.jsx(H,{type:$(p.key)?"password":"text",placeholder:_,value:p.value,onChange:c=>k(i,c.target.value),className:"h-10 rounded-lg flex-1"}),u.jsx(C,{type:"button",variant:"ghost",size:"icon",className:"h-10 w-10 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>g(i),children:u.jsx(q,{size:16})})]},i),e[19]=y,e[20]=g,e[21]=k,e[22]=m,e[23]=_,e[24]=l):l=e[24],d=t.map(l),e[12]=y,e[13]=g,e[14]=k,e[15]=m,e[16]=t,e[17]=_,e[18]=d}else d=e[18];let T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=u.jsx(W,{size:16,className:"mr-1"}),e[25]=T):T=e[25];let f;e[26]!==S?(f=u.jsxs(C,{type:"button",variant:"outline",size:"sm",className:"w-full h-9 text-muted-foreground",onClick:S,children:[T,"Add Environment Variable"]}),e[26]=S,e[27]=f):f=e[27];let h;e[28]!==d||e[29]!==f?(h=u.jsxs("div",{className:"flex flex-col gap-2",children:[d,f]}),e[28]=d,e[29]=f,e[30]=h):h=e[30];let E;return e[31]!==v||e[32]!==h?(E=u.jsx("div",{className:v,children:h}),e[31]=v,e[32]=h,e[33]=E):E=e[33],E}function I(n){const e={};for(const{key:t,value:r}of n)t.trim()&&(e[t.trim()]=r);return e}function D(n){return n?Object.entries(n).map(([e,t])=>({key:e,value:t})):[]}function N(n){const e=n.trim();if(!e)return"";try{const t=new URL(e),r=t.pathname.length>1?t.pathname.replace(/\/+$/,""):t.pathname;return`${t.origin}${r}`}catch{return e.replace(/\/+$/,"")}}function F(n){const e=n.trim().split(/\s+/).filter(Boolean);if(e.length<2)return null;const t=e[0]?.toLowerCase();if(t!=="npx"&&t!=="bunx")return null;const o=e.slice(1).find(s=>!s.startsWith("-"));return o?{packageName:o}:null}function Y(n){const{uiType:e}=n,t=N(n.connectionUrl??"");if((e==="HTTP"||e==="SSE"||e==="Websocket")&&t===N("https://api.githubcopilot.com/mcp/"))return{id:"github",title:"GitHub",description:"GitHub Copilot MCP",token:{label:"GitHub PAT",placeholder:"github_pat_…",helperText:"Paste a GitHub Personal Access Token (PAT)"}};const r=(n.npxPackage??"").trim();return e==="NPX"&&r==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function J(n){if(n.registryItems.length===0||n.uiType!=="HTTP"&&n.uiType!=="SSE"&&n.uiType!=="Websocket")return null;const e=N(n.connectionUrl??"");if(!e)return null;const t=n.registryItems.find(s=>(s.server?.remotes??[]).some(m=>N(m.url??"")===e));if(!t)return null;const r=t.title||t.name||t.server?.title||t.server?.name||"",o=t.server?.description||t.description||t.summary||null;return r?{id:"registry",title:r,description:o}:null}function Q(n,e){const t={command:"npx",args:["-y",n]},r=I(e);return Object.keys(r).length>0&&(t.envVars=r),t}function Z(n,e,t,r){const o={command:n};e.trim()&&(o.args=e.trim().split(/\s+/)),t?.trim()&&(o.cwd=t.trim());const s=I(r);return Object.keys(s).length>0&&(o.envVars=s),o}export{X as E,J as a,Q as b,M as c,Z as d,Y as i,F as p,D as r};
@@ -1 +1 @@
1
- import{r as V,c as ne,j as t,B as K,i as ae,p as te,l as ge,E as Ge,C as be,b as _e,u as Qe,a as Ne,z as Je,G as Ye,D as Ze,M as et,J as tt,n as nt,t as U,K as st}from"./index-CfAl6qA3.js";import{a as De,b as ot,g as it,e as rt}from"./extract-connection-data-ChcGsUj8.js";import{C as lt}from"./collection-display-button-BkQRfMlH.js";import{S as ct}from"./search-input-DzbdykkS.js";import{C as at}from"./collection-tabs-C2iwwrh8.js";import{C as Ce,u as dt,a as ke,g as mt}from"./connection-card-DSeJr6d2.js";import{E as ut}from"./empty-state-B0XUVWqe.js";import{P as me}from"./index-B72iIhnj.js";import{u as pt,D as gt}from"./use-delete-connection-B0eSidiK.js";import{u as ye}from"./use-capability-x07oRB_v.js";import{u as ht}from"./use-infinite-scroll-DgeL9DrI.js";import{u as xt}from"./use-view-mode-CcZjEdUn.js";import{g as pe}from"./connection-slug-eyAPH6o3.js";import{c as Ae,d as Te,b as we,A as Ie,e as Pe,g as $e,a as Oe,f as Le}from"./alert-dialog-lT11Jsbj.js";import{n as he}from"./Tool02-CYQFsqUw.js";import{D as Me,a as Fe,h as ze,c as Ve,d as Ee,e as Be}from"./dialog-B8iPXZfB.js";import{D as ft,a as jt,c as yt,b as Ct,d as St,e as vt,f as bt}from"./drawer-D5z1QpZ1.js";import{u as _t}from"./use-mobile-D0KrjV8M.js";import{F as Q,b as J,c as Y,d as Z,f as ee,a as Se}from"./form-BbtpCekf.js";import{I as ie}from"./input-C96iFBVQ.js";import{S as Nt,a as Dt,b as kt,c as At,d as ce}from"./select-DfWJsEeW.js";import{T as Tt}from"./textarea-Q9mIBUV-.js";import{b as Ke,u as wt}from"./use-connection-CawdsRuN.js";import{u as It}from"./use-virtual-mcp--wK0dI9I.js";import{u as Pt}from"./studio-tools-CZ0lHHg8.js";import{s as je}from"./Star01-B_ldc-QG.js";import{s as He}from"./Plus-CpvaryXc.js";import{S as $t,R as Ot,ay as Lt,b as Mt}from"./agent-icon-kMrNxjYJ.js";import{s as Re}from"./XClose-Bvx5TP10.js";import{i as ue,a as ve,E as Ft,c as zt,p as Vt,b as Et,d as Bt}from"./connection-form-helpers-Ce26XCbs.js";import{a as Kt}from"./authenticate-and-persist-oauth-jkSUOcu8.js";import{I as Ht}from"./integration-icon-B1RhpoYr.js";import{C as Ue}from"./checkbox-9SStA5q1.js";import{d as re,a as Rt,D as Ut,c as Wt}from"./dropdown-menu-D3W9Mypw.js";import{i as Xt}from"./DotsVertical-9e8whEmO.js";import{s as We}from"./Eye-Dmrq3Yx3.js";import{s as Xe}from"./Trash01-CFIi5PAY.js";import"./use-mcp-client-CAtCw6yl.js";import"./auth-CaW_gj1t.js";import"./ArrowUp-BRv6jMcd.js";import"./Check-xlx8bieA.js";import"./SwitchHorizontal01-BjhVVVE7.js";import"./tooltip-lvzwcxmr.js";import"./view-mode-toggle-IMXhdpcC.js";import"./badge-0FaSmMEN.js";import"./SearchMd-BbTMkDIb.js";import"./use-registry-connections-BNAx72pz.js";import"./use-organization-settings-Btln8Py9.js";import"./useInfiniteQuery-BT7hVNXg.js";import"./retry-CErkP7V6.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./card-CxpjTUKu.js";import"./sidebar-Bmfjcji7.js";import"./LayoutLeft-BXx4559W.js";import"./X-B9OMbRgI.js";import"./label-Dyml5mFF.js";import"./ChevronDown-z_OgoJuG.js";import"./ChevronUp-C0dubflE.js";import"./use-collections-DJ2e88Xq.js";import"./AlertCircle-8aL2p4Jm.js";import"./Tool01-F8NWFSUY.js";import"./Settings02-CoD4T3JT.js";import"./ArrowRight-BmTkQdSS.js";import"./ArrowUpRight-DgWDf4bB.js";import"./TrendUp01-B11vKIzx.js";import"./ZapSquare-NmRRaYpN.js";import"./ZoomOut-Bjuv5wtp.js";import"./Users03-Bg-uyP8J.js";import"./CheckCircle-BhHr7P8S.js";import"./ChevronRight-HByc-_dD.js";import"./Stars02-wl-TgjVw.js";import"./Copy01-BhLnIcPa.js";import"./Globe01-C1OI0rNn.js";import"./FilterLines-LxfJFt1s.js";import"./Globe04-D37KO3Rl.js";import"./HardDrive-xaUFGQWK.js";import"./Image01-D2MElAgS.js";import"./Key01-CJ4v8ToT.js";import"./XCircle-z2zpbAQl.js";import"./LinkExternal01-RdFrwyl0.js";import"./Monitor01-ByOW8gCA.js";import"./Sun-DcglW2RF.js";import"./Package-BApyVZZF.js";import"./Palette-gwCbQEVd.js";import"./Play-CRcD5urt.js";import"./SearchLg-BLbYMh4R.js";import"./Shield01-BSQ914Nd.js";import"./Stars01-BEQN6TZj.js";import"./Upload01-CYv9Q0Sh.js";import"./User01-BHW_CvWq.js";import"./Users01-CVvGtppm.js";import"./Zap-CaoQpAZT.js";import"./mcp-oauth-C3_4QnQD.js";function qt(f){const e=`deco-filters-${f}`,[n,a]=V.useState(()=>{try{const s=globalThis.localStorage?.getItem(e);if(s)return JSON.parse(s)}catch(s){console.error("Failed to parse stored filters:",s)}return[]});return[n,s=>{a(s);try{globalThis.localStorage?.setItem(e,JSON.stringify(s))}catch(i){console.error("Failed to save filters:",i)}}]}function Gt(f){const e=ne.c(7),[n,a]=V.useState(f),[o,s]=V.useState(f?"desc":null);let i;e[0]!==o||e[1]!==n?(i=j=>{n!==j?(a(j),s("asc")):o==="asc"?s("desc"):o==="desc"&&(a(void 0),s(null))},e[0]=o,e[1]=n,e[2]=i):i=e[2];const l=i;let d;return e[3]!==l||e[4]!==o||e[5]!==n?(d={sortKey:n,sortDirection:o,handleSort:l},e[3]=l,e[4]=o,e[5]=n,e[6]=d):d=e[6],d}function Qt(f){const e=ne.c(20),{namespace:n,resource:a,defaultSortKey:o,defaultViewMode:s}=f,i=o===void 0?"title":o,l=s===void 0?"table":s,[d,j]=V.useState(""),y=V.useDeferredValue(d),C=`${n}-${a}`,[S,u]=qt(C),p=`mesh-${a}-filter-visible-${n}`;let c;e[0]!==p?(c=()=>globalThis.localStorage?.getItem(p)==="true",e[0]=p,e[1]=c):c=e[1];const[v,_]=V.useState(c);let b;e[2]!==p?(b=F=>{_(F),globalThis.localStorage?.setItem(p,String(F))},e[2]=p,e[3]=b):b=e[3];const w=b;let D;e[4]!==v||e[5]!==w?(D=()=>{w(!v)},e[4]=v,e[5]=w,e[6]=D):D=e[6];const r=D,[I,$]=xt(`mesh-${a}-${n}`,l),{sortKey:L,sortDirection:T,handleSort:O}=Gt(i),k=L;let M;return e[7]!==v||e[8]!==S||e[9]!==O||e[10]!==d||e[11]!==y||e[12]!==w||e[13]!==u||e[14]!==$||e[15]!==T||e[16]!==k||e[17]!==r||e[18]!==I?(M={search:d,searchTerm:y,setSearch:j,filters:S,setFilters:u,filterBarVisible:v,setFilterBarVisible:w,toggleFilterBar:r,viewMode:I,setViewMode:$,sortKey:k,sortDirection:T,handleSort:O},e[7]=v,e[8]=S,e[9]=O,e[10]=d,e[11]=y,e[12]=w,e[13]=u,e[14]=$,e[15]=T,e[16]=k,e[17]=r,e[18]=I,e[19]=M):M=e[19],M}function Jt(f){const e=ne.c(20),{open:n,onOpenChange:a,count:o,onConfirm:s}=f,i=o!==1?"s":"";let l;e[0]!==o||e[1]!==i?(l=t.jsxs(Ae,{children:["Delete ",o," connection",i,"?"]}),e[0]=o,e[1]=i,e[2]=l):l=e[2];const d=o!==1?"s":"";let j;e[3]!==d?(j=t.jsxs(Te,{children:["This will permanently delete the selected connection",d,". This action cannot be undone."]}),e[3]=d,e[4]=j):j=e[4];let y;e[5]!==l||e[6]!==j?(y=t.jsxs(we,{children:[l,j]}),e[5]=l,e[6]=j,e[7]=y):y=e[7];let C;e[8]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Ie,{children:"Cancel"}),e[8]=C):C=e[8];const S=o!==1?"s":"";let u;e[9]!==o||e[10]!==s||e[11]!==S?(u=t.jsxs(Pe,{children:[C,t.jsxs($e,{onClick:s,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:["Delete ",o," connection",S]})]}),e[9]=o,e[10]=s,e[11]=S,e[12]=u):u=e[12];let p;e[13]!==y||e[14]!==u?(p=t.jsxs(Oe,{children:[y,u]}),e[13]=y,e[14]=u,e[15]=p):p=e[15];let c;return e[16]!==a||e[17]!==n||e[18]!==p?(c=t.jsx(Le,{open:n,onOpenChange:a,children:p}),e[16]=a,e[17]=n,e[18]=p,e[19]=c):c=e[19],c}function Yt(f){return f._registryId?.includes("community-registry")===!0}function Zt(f){const e=ne.c(58),{item:n,canManage:a,allConnections:o,connectedAppNames:s,connectingItemId:i,onNavigateConnected:l,onConnect:d}=f,[j,y]=V.useState(!1),[C,S]=V.useState(null);let u,p;e[0]!==s||e[1]!==n?(u=De(n)??"",p=s.has(u),e[0]=s,e[1]=n,e[2]=u,e[3]=p):(u=e[2],p=e[3]);const c=p,v=n._meta?.["mcp.mesh"],_=v?.friendlyName||v?.friendly_name||n.server?.title||n.title||n.server?.name||n.name||n.id||"",b=n.server?.description||n.description||null;let w;e[4]!==n.server?.icons?.[0]?.src||e[5]!==n.server?.repository?(w=n.server?.icons?.[0]?.src||ot(n.server?.repository)||null,e[4]=n.server?.icons?.[0]?.src,e[5]=n.server?.repository,e[6]=w):w=e[6];const D=w;let r;if(e[7]!==o||e[8]!==u){let A;e[10]!==u?(A=oe=>oe.connection_type!=="VIRTUAL"&&oe.app_name===u,e[10]=u,e[11]=A):A=e[11],r=o.filter(A),e[7]=o,e[8]=u,e[9]=r}else r=e[9];const I=r;let $;e[12]!==n?($=Yt(n),e[12]=n,e[13]=$):$=e[13];const L=$;let T,O;e[14]!==I||e[15]!==a||e[16]!==L||e[17]!==c||e[18]!==n||e[19]!==d||e[20]!==l?(T=()=>{if(c){const A=I[0];A&&l(A);return}a&&O()},O=()=>{L?(S("connect"),y(!0)):d(n)},e[14]=I,e[15]=a,e[16]=L,e[17]=c,e[18]=n,e[19]=d,e[20]=l,e[21]=T,e[22]=O):(T=e[21],O=e[22]);let k;e[23]!==n||e[24]!==d||e[25]!==C?(k=()=>{te("connections_community_warning_confirmed",{registry_item_id:n.id}),y(!1),C==="connect"&&d(n),S(null)},e[23]=n,e[24]=d,e[25]=C,e[26]=k):k=e[26];const M=k;let F;e[27]!==b||e[28]!==D||e[29]!==_?(F={title:_,description:b,icon:D},e[27]=b,e[28]=D,e[29]=_,e[30]=F):F=e[30];let q;e[31]===Symbol.for("react.memo_cache_sentinel")?(q=t.jsx(he,{}),e[31]=q):q=e[31];let R;e[32]!==L||e[33]!==n._sourceIcon?(R=L&&n._sourceIcon&&t.jsx("img",{src:n._sourceIcon,alt:"Community",className:"size-4 rounded-sm object-contain"}),e[32]=L,e[33]=n._sourceIcon,e[34]=R):R=e[34];let W;e[35]!==a||e[36]!==i||e[37]!==O||e[38]!==c||e[39]!==n.id?(W=c?t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}):a&&t.jsx(K,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:i!==null,onClick:A=>{A.stopPropagation(),O()},children:i===n.id?t.jsx(ae,{size:14,className:"animate-spin"}):"Connect"}),e[35]=a,e[36]=i,e[37]=O,e[38]=c,e[39]=n.id,e[40]=W):W=e[40];let g;e[41]!==R||e[42]!==W?(g=t.jsxs("div",{className:"flex items-center gap-2",children:[R,W]}),e[41]=R,e[42]=W,e[43]=g):g=e[43];let N;e[44]!==T||e[45]!==g||e[46]!==F?(N=t.jsx(Ce,{connection:F,fallbackIcon:q,onClick:T,headerActionsAlwaysVisible:!0,headerActions:g}),e[44]=T,e[45]=g,e[46]=F,e[47]=N):N=e[47];let z;e[48]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsxs(we,{children:[t.jsx(Ae,{children:"Community MCP Server"}),t.jsx(Te,{children:"This MCP server is from the Community MCP Registry and is not maintained or verified by Deco. Community servers may have varying levels of quality, security, and reliability. Proceed with caution and review the server details before connecting."})]}),e[48]=z):z=e[48];let H;e[49]===Symbol.for("react.memo_cache_sentinel")?(H=t.jsx(Ie,{children:"Cancel"}),e[49]=H):H=e[49];let E;e[50]!==M?(E=t.jsxs(Oe,{children:[z,t.jsxs(Pe,{children:[H,t.jsx($e,{onClick:M,children:"Continue"})]})]}),e[50]=M,e[51]=E):E=e[51];let h;e[52]!==j||e[53]!==E?(h=t.jsx(Le,{open:j,onOpenChange:y,children:E}),e[52]=j,e[53]=E,e[54]=h):h=e[54];let P;return e[55]!==N||e[56]!==h?(P=t.jsxs(t.Fragment,{children:[N,h]}),e[55]=N,e[56]=h,e[57]=P):P=e[57],P}function qe(f){const e=ne.c(8),{selectionMode:n,children:a}=f,o=n?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100";let s;e[0]!==o?(s=ge("overflow-hidden transition-all duration-150 ease-out",o),e[0]=o,e[1]=s):s=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Rt,{asChild:!0,children:t.jsx(K,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:tn,children:t.jsx(Xt,{size:20})})}),e[2]=i):i=e[2];let l;e[3]!==a?(l=t.jsxs(Ut,{children:[i,t.jsx(Wt,{align:"end",onClick:en,children:a})]}),e[3]=a,e[4]=l):l=e[4];let d;return e[5]!==s||e[6]!==l?(d=t.jsx("div",{className:s,children:l}),e[5]=s,e[6]=l,e[7]=d):d=e[7],d}function en(f){return f.stopPropagation()}function tn(f){return f.stopPropagation()}function nn(f){const e=ne.c(49),{group:n,onOpen:a,selectionMode:o,selectedIds:s,onToggleSelect:i}=f;let l;if(e[0]!==n.connections||e[1]!==s){let k;e[3]!==s?(k=M=>s.has(M.id),e[3]=s,e[4]=k):k=e[4],l=n.connections.every(k),e[0]=n.connections,e[1]=s,e[2]=l}else l=e[2];const d=l;let j;if(e[5]!==n.connections||e[6]!==s){let k;e[8]!==s?(k=M=>s.has(M.id),e[8]=s,e[9]=k):k=e[9],j=n.connections.some(k),e[5]=n.connections,e[6]=s,e[7]=j}else j=e[7];const y=j;let C;e[10]!==d||e[11]!==n.connections||e[12]!==i||e[13]!==s?(C=()=>{for(const k of n.connections)d?s.has(k.id)&&i(k.id):s.has(k.id)||i(k.id)},e[10]=d,e[11]=n.connections,e[12]=i,e[13]=s,e[14]=C):C=e[14];const S=C,u=`${n.connections.length} instances`;let p;e[15]!==n.icon||e[16]!==n.title||e[17]!==u?(p={title:n.title,icon:n.icon,description:u},e[15]=n.icon,e[16]=n.title,e[17]=u,e[18]=p):p=e[18];let c;e[19]!==a||e[20]!==o||e[21]!==S?(c=()=>o?S():a(),e[19]=a,e[20]=o,e[21]=S,e[22]=c):c=e[22];const v=o&&d&&"ring-2 ring-primary",_=o&&y&&!d&&"ring-1 ring-primary/50";let b;e[23]!==v||e[24]!==_?(b=ge(v,_),e[23]=v,e[24]=_,e[25]=b):b=e[25];let w;e[26]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(he,{}),e[26]=w):w=e[26];let D;e[27]!==d||e[28]!==n.connections.length||e[29]!==o||e[30]!==y||e[31]!==S?(D=o?t.jsx(Ue,{checked:d?!0:y?"indeterminate":!1,onCheckedChange:S}):t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsxs("span",{className:"text-xs text-muted-foreground font-normal tabular-nums",children:["x",n.connections.length]})]}),e[27]=d,e[28]=n.connections.length,e[29]=o,e[30]=y,e[31]=S,e[32]=D):D=e[32];let r;e[33]!==a?(r=k=>{k.stopPropagation(),a()},e[33]=a,e[34]=r):r=e[34];let I;e[35]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(We,{size:16}),e[35]=I):I=e[35];let $;e[36]!==r?($=t.jsxs(re,{onClick:r,children:[I,"Open"]}),e[36]=r,e[37]=$):$=e[37];let L;e[38]!==o||e[39]!==$?(L=t.jsx(qe,{selectionMode:o,children:$}),e[38]=o,e[39]=$,e[40]=L):L=e[40];let T;e[41]!==D||e[42]!==L?(T=t.jsxs("div",{className:"flex items-center gap-1",children:[D,L]}),e[41]=D,e[42]=L,e[43]=T):T=e[43];let O;return e[44]!==T||e[45]!==p||e[46]!==c||e[47]!==b?(O=t.jsx(t.Fragment,{children:t.jsx(Ce,{connection:p,onClick:c,className:b,fallbackIcon:w,headerActionsAlwaysVisible:!0,headerActions:T})}),e[44]=T,e[45]=p,e[46]=c,e[47]=b,e[48]=O):O=e[48],O}function sn(f){const e=ne.c(29),{connection:n,isSelected:a,selectionMode:o,canManage:s,canManageAgents:i,onToggleSelect:l,onOpen:d,onToggleStatus:j,onDelete:y}=f;let C;e[0]!==a||e[1]!==l||e[2]!==o?(C=o?t.jsx(Ue,{checked:a,onCheckedChange:l,onClick:on}):t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),e[0]=a,e[1]=l,e[2]=o,e[3]=C):C=e[3];let S;e[4]!==d?(S=D=>{D.stopPropagation(),d()},e[4]=d,e[5]=S):S=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(We,{size:16}),e[6]=u):u=e[6];let p;e[7]!==S?(p=t.jsxs(re,{onClick:S,children:[u,"Open"]}),e[7]=S,e[8]=p):p=e[8];let c;e[9]!==s||e[10]!==i||e[11]!==l?(c=(s||i)&&t.jsxs(re,{onClick:D=>{D.stopPropagation(),l()},children:[t.jsx(Lt,{size:16}),"Select"]}),e[9]=s,e[10]=i,e[11]=l,e[12]=c):c=e[12];let v;e[13]!==s||e[14]!==n||e[15]!==j?(v=s&&(n.status==="active"?t.jsxs(re,{onClick:D=>{D.stopPropagation(),j("inactive")},children:[t.jsx($t,{size:16}),"Disable"]}):t.jsxs(re,{onClick:D=>{D.stopPropagation(),j("active")},children:[t.jsx(Ot,{size:16}),"Enable"]})),e[13]=s,e[14]=n,e[15]=j,e[16]=v):v=e[16];let _;e[17]!==s||e[18]!==y?(_=s&&t.jsxs(re,{variant:"destructive",onClick:D=>{D.stopPropagation(),y()},children:[t.jsx(Xe,{size:16}),"Delete"]}),e[17]=s,e[18]=y,e[19]=_):_=e[19];let b;e[20]!==o||e[21]!==p||e[22]!==c||e[23]!==v||e[24]!==_?(b=t.jsxs(qe,{selectionMode:o,children:[p,c,v,_]}),e[20]=o,e[21]=p,e[22]=c,e[23]=v,e[24]=_,e[25]=b):b=e[25];let w;return e[26]!==C||e[27]!==b?(w=t.jsxs("div",{className:"flex items-center gap-1",children:[C,b]}),e[26]=C,e[27]=b,e[28]=w):w=e[28],w}function on(f){return f.stopPropagation()}function rn(f){const e=ne.c(23),{count:n,total:a,canManage:o,canManageAgents:s,onSelectAll:i,onDeselectAll:l,onDelete:d,onAddToAgent:j,onToggleStatus:y,onCancel:C}=f;if(n===0)return null;let S;e[0]!==n?(S=t.jsxs("div",{className:"text-xs text-muted-foreground pr-1 tabular-nums",children:[n," selected"]}),e[0]=n,e[1]=S):S=e[1];let u;e[2]!==n||e[3]!==l||e[4]!==i||e[5]!==a?(u=n<a?t.jsxs(K,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:i,children:["Select all (",a,")"]}):t.jsx(K,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:l,children:"Clear selection"}),e[2]=n,e[3]=l,e[4]=i,e[5]=a,e[6]=u):u=e[6];let p;e[7]!==s||e[8]!==j?(p=s&&t.jsxs(K,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:j,children:[t.jsx(He,{size:13}),"Add to Agent"]}),e[7]=s,e[8]=j,e[9]=p):p=e[9];let c;e[10]!==o||e[11]!==d||e[12]!==y?(c=o&&t.jsxs(t.Fragment,{children:[t.jsx(K,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>y("active"),children:"Enable"}),t.jsx(K,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>y("inactive"),children:"Disable"}),t.jsxs(K,{variant:"destructive",size:"sm",className:"h-7 text-xs px-2",onClick:d,children:[t.jsx(Xe,{size:13}),"Delete"]})]}),e[10]=o,e[11]=d,e[12]=y,e[13]=c):c=e[13];let v;e[14]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(Re,{size:13}),e[14]=v):v=e[14];let _;e[15]!==C?(_=t.jsx(K,{variant:"ghost",size:"sm",className:"h-7 text-xs px-2",onClick:C,children:v}),e[15]=C,e[16]=_):_=e[16];let b;return e[17]!==S||e[18]!==u||e[19]!==p||e[20]!==c||e[21]!==_?(b=t.jsx("div",{className:"fixed bottom-4 left-1/2 z-50 -translate-x-1/2",children:t.jsxs("div",{className:"rounded-xl border border-border bg-background/95 shadow-lg backdrop-blur px-3 py-2 flex items-center gap-2",children:[S,u,p,c,_]})}),e[17]=S,e[18]=u,e[19]=p,e[20]=c,e[21]=_,e[22]=b):b=e[22],b}function ln(f){const e=ne.c(25),{open:n,onOpenChange:a,agents:o,onConfirm:s}=f,[i,l]=V.useState(null);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsxs(Me,{children:[t.jsx(Fe,{children:"Add to Agent"}),t.jsx(ze,{children:"Select an agent to add the selected connections to."})]}),e[0]=d):d=e[0];let j;e[1]!==o||e[2]!==i?(j=o.length===0?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No agents found"}):o.map(b=>t.jsxs("button",{type:"button",onClick:()=>l(b.id),className:ge("flex items-center gap-3 w-full rounded-md px-3 py-2 text-left transition-colors",i===b.id?"bg-primary/10 ring-1 ring-primary":"hover:bg-muted/50"),children:[t.jsx(Ht,{icon:b.icon,name:b.title,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:b.title}),b.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:b.description})]})]},b.id)),e[1]=o,e[2]=i,e[3]=j):j=e[3];let y;e[4]!==j?(y=t.jsx("div",{className:"max-h-60 overflow-auto py-2 space-y-1",children:j}),e[4]=j,e[5]=y):y=e[5];let C;e[6]!==a?(C=t.jsx(K,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e[6]=a,e[7]=C):C=e[7];const S=!i;let u;e[8]!==s||e[9]!==a||e[10]!==i?(u=()=>{i&&(s(i),a(!1),l(null))},e[8]=s,e[9]=a,e[10]=i,e[11]=u):u=e[11];let p;e[12]!==S||e[13]!==u?(p=t.jsx(K,{disabled:S,onClick:u,children:"Add"}),e[12]=S,e[13]=u,e[14]=p):p=e[14];let c;e[15]!==C||e[16]!==p?(c=t.jsxs(Ve,{children:[C,p]}),e[15]=C,e[16]=p,e[17]=c):c=e[17];let v;e[18]!==y||e[19]!==c?(v=t.jsxs(Ee,{className:"sm:max-w-[400px]",children:[d,y,c]}),e[18]=y,e[19]=c,e[20]=v):v=e[20];let _;return e[21]!==a||e[22]!==n||e[23]!==v?(_=t.jsx(Be,{open:n,onOpenChange:a,children:v}),e[21]=a,e[22]=n,e[23]=v,e[24]=_):_=e[24],_}function cn({listState:f,activeTab:e,typeFilter:n,statusFilter:a,registryFilter:o,enabledRegistries:s}){const{org:i}=be(),l=nt(),d=_e(),{data:j}=Ne.useSession(),y=Ke(),C=wt(f),S=pt(),{granted:u}=ye("connections:manage"),{granted:p}=ye("agents:manage"),[c,v]=V.useState(new Set),_=c.size>0,[b,w]=V.useState(!1),[D,r]=V.useState(!1),[I,$]=V.useState(null),L=It(),T=C.filter(m=>!(n!=="ALL"&&m.connection_type!==n||a!=="ALL"&&m.status!==a)),O=mt(T),k=m=>{v(x=>{const B=new Set(x);return B.has(m)?B.delete(m):B.add(m),B})},M=()=>{v(new Set)},F=ke(s,f.searchTerm),q=F.items,R=ht(F.loadMore,F.hasMore,F.isLoadingMore),W=new Set(C.filter(m=>m.app_name).map(m=>m.app_name)),g=o==="ALL"||s.some(m=>m.id===o)?o:"ALL",N=f.search.length>0,z=e==="all"||N?q.filter(m=>{if(g!=="ALL"&&m._registryId!==g)return!1;if(N){const x=De(m);if(x&&W.has(x))return!1}return!0}):[],H=e==="connected"||N?O:[],E=async m=>{if(!(!i||!j?.user?.id)){te("connection_add_clicked",{action:"connect_new",registry_item_id:m.id,source:"connections_page"}),$(m.id);try{const x=rt(m,i.id,j.user.id,{remoteIndex:0}),B=x.connection_type==="STDIO",G=!!x.connection_url,X=B&&x.connection_headers&&typeof x.connection_headers=="object"&&"command"in x.connection_headers;if(!G&&!X){U.error("This MCP Server cannot be connected: no connection method available"),$(null);return}const{id:se}=await y.create.mutateAsync(x),le=await Kt({connectionId:se,orgId:i.id,orgSlug:i.slug,persistFallback:fe=>y.update.mutateAsync({id:se,data:{connection_token:fe}}).then(()=>{})});if(le.ran&&!le.ok){te("connection_oauth_failed",{connection_id:se,flow:"connections_page_connect",error:le.error??"no_token"}),U.error(`Authentication failed: ${le.error??"no token received"}`);return}if(le.ran){te("connection_oauth_succeeded",{connection_id:se,flow:"connections_page_connect"});const fe=new URL(`/api/${i.slug}/mcp/${se}`,window.location.origin);await l.invalidateQueries({queryKey:st.isMCPAuthenticated(fe.href,null)}),P(),U.success("Authentication successful")}U.success("Connected successfully")}catch(x){U.error(`Failed to connect: ${x instanceof Error?x.message:String(x)}`)}finally{$(null)}}},h=Pt(),P=()=>{l.invalidateQueries({predicate:m=>{const x=m.queryKey;return x[1]===i.id&&x[3]==="collection"&&x[4]==="CONNECTIONS"}})},A=async()=>{w(!1);const m=[...c];te("connections_bulk_delete",{count:m.length});let x=0;for(const B of m)try{await h.call("COLLECTION_CONNECTIONS_DELETE",{id:B,force:!0}),x++}catch{}P(),U.success(`Deleted ${x} connection${x!==1?"s":""}`),M()},oe=async(m,x)=>{try{await y.update.mutateAsync({id:m,data:{status:x}}),P(),U.success(x==="active"?"Connection enabled":"Connection disabled")}catch{U.error("Failed to update connection")}},xe=async m=>{const x=[...c];te("connections_bulk_status_toggled",{count:x.length,to_status:m});let B=0;for(const G of x)try{await y.update.mutateAsync({id:G,data:{status:m}}),B++}catch{}P(),U.success(`${m==="active"?"Enabled":"Disabled"} ${B} connection${B!==1?"s":""}`),M()},de=async m=>{const x=L.find(X=>X.id===m);if(!x)return;te("connections_bulk_add_to_agent",{agent_id:m,count:c.size});const B=new Set(x.connections.map(X=>X.connection_id)),G=[...c].filter(X=>!B.has(X)).map(X=>({connection_id:X,selected_tools:null,selected_resources:null,selected_prompts:null}));if(G.length===0){U.info("All selected connections are already in that agent");return}try{await h.call("COLLECTION_VIRTUAL_MCP_UPDATE",{id:m,data:{connections:[...x.connections,...G]}}),l.invalidateQueries({predicate:X=>{const se=X.queryKey;return se[1]===i.id&&se[3]==="collection"&&se[4]==="VIRTUAL_MCP"}}),U.success(`Added ${G.length} connection${G.length!==1?"s":""} to "${x.title}"`),M()}catch{U.error("Failed to add connections to agent")}};return t.jsxs(t.Fragment,{children:[t.jsx(gt,{...S}),t.jsx(Jt,{open:b,onOpenChange:w,count:c.size,onConfirm:A}),t.jsx(ln,{open:D,onOpenChange:r,agents:L,onConfirm:de}),F.isInitialLoading&&e==="all"?t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ae,{size:32,className:"animate-spin text-muted-foreground"})}):t.jsx("div",{children:(N?z.length===0&&T.length===0:e==="all"?z.length===0:T.length===0)?t.jsx(ut,{image:t.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:"No Connections found",description:f.search?`No Connections match "${f.search}"`:u?"Create a connection to get started.":"Ask an organization admin to add one."}):t.jsxs("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:[H.map(m=>{if(m.type==="group")return t.jsx(nn,{group:m,onOpen:()=>{d({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:m.key}})},selectionMode:_,selectedIds:c,onToggleSelect:k},m.key);const x=m.connection,B=c.has(x.id);return t.jsx(Ce,{connection:x,fallbackIcon:t.jsx(he,{}),onClick:()=>_?k(x.id):d({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:pe(x)}}),className:ge(B&&"ring-2 ring-primary bg-primary/5"),headerActionsAlwaysVisible:!0,headerActions:t.jsx(sn,{connection:x,isSelected:B,selectionMode:_,canManage:u,canManageAgents:p,onToggleSelect:()=>k(x.id),onOpen:()=>d({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:pe(x)}}),onToggleStatus:G=>oe(x.id,G),onDelete:()=>S.requestDelete(x)})},x.id)}),z.map(m=>t.jsx(Zt,{item:m,canManage:u,allConnections:C,connectedAppNames:W,connectingItemId:I,onNavigateConnected:x=>d({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:pe(x)}}),onConnect:E},`catalog-${m._registryId}:${m.id}`)),(e==="all"||N)&&s.length>0&&t.jsx("div",{ref:R,className:"col-span-full h-4"}),(e==="all"||N)&&F.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(ae,{size:24,className:"animate-spin text-muted-foreground"})})]})}),_&&t.jsx(rn,{count:c.size,total:T.length,canManage:u,canManageAgents:p,onSelectAll:()=>{v(new Set(T.map(m=>m.id)))},onDeselectAll:()=>v(new Set),onDelete:()=>w(!0),onAddToAgent:()=>r(!0),onToggleStatus:xe,onCancel:M})]})}function an(){const{org:f}=be(),e=_e(),n=Qe({strict:!1}),{data:a}=Ne.useSession(),{stdioEnabled:o}=Je(),s=_t(),{granted:i}=ye("connections:manage"),l=Qt({namespace:f.slug,resource:"connections"}),d=Ke(),[j,y]=Ye(Ze.connectionsTab(f.slug),g=>n.tab==="all"||n.tab==="connected"?n.tab:g??"all"),[C,S]=V.useState("ALL"),[u,p]=V.useState("ALL"),[c,v]=V.useState("ALL"),_=dt(),w=ke(_,l.searchTerm).items,D=l.search!==l.searchTerm,r=et({resolver:tt(zt),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),I=r.watch("ui_type"),$=r.watch("connection_url"),L=r.watch("npx_package"),T=ue({uiType:I,connectionUrl:$??"",npxPackage:L??""})??ve({uiType:I,connectionUrl:$??"",registryItems:w}),O=i&&n.action==="create",k=()=>{te("connections_custom_dialog_opened",{source:"connections_page"}),e({to:"/$org/settings/connections",params:{org:f.slug},search:{action:"create"}})},M=()=>{e({to:"/$org/settings/connections",params:{org:f.slug},search:{}})},F=async g=>{let N,z=null,H=null,E=null;g.ui_type==="NPX"?(N="STDIO",z="",E=Et(g.npx_package||"",g.env_vars||[])):g.ui_type==="STDIO"?(N="STDIO",z="",E=Bt(g.stdio_command||"",g.stdio_args||"",g.stdio_cwd,g.env_vars||[])):(N=g.ui_type,z=g.connection_url||"",H=g.connection_token||null);const h=it("conn");te("connection_custom_created",{connection_type:N,ui_type:g.ui_type}),await d.create.mutateAsync({id:h,title:g.title,description:g.description||null,connection_type:N,connection_url:z,connection_token:H,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:a?.user?.id||"system",organization_id:f.id,icon:g.icon??null,app_name:null,app_id:null,connection_headers:E,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),M(),r.reset(),e({to:"/$org/settings/connections/$appSlug",params:{org:f.slug,appSlug:pe({app_name:null,connection_url:z,title:g.title,id:h})}})},q=g=>{g||(O&&M(),r.reset())},R=g=>{const N=g.trim();if(!N)return;const z=!!r.formState.dirtyFields.title,H=!!r.formState.dirtyFields.description,E=!!r.formState.dirtyFields.env_vars,h=A=>{if(A&&(!z&&!r.getValues("title").trim()&&A.title&&r.setValue("title",A.title,{shouldDirty:!1}),!H&&!(r.getValues("description")??"").trim()&&A.description&&r.setValue("description",A.description,{shouldDirty:!1}),!E&&A.envVarKeys?.length)){const oe=r.getValues("env_vars")??[],xe=new Set(oe.map(m=>m.key)),de=A.envVarKeys.filter(m=>!xe.has(m));de.length>0&&r.setValue("env_vars",[...oe,...de.map(m=>({key:m,value:""}))],{shouldDirty:!0})}},P=Vt(N);if(P&&o){r.setValue("ui_type","NPX",{shouldDirty:!0}),r.setValue("npx_package",P.packageName,{shouldDirty:!0}),r.setValue("connection_url","",{shouldDirty:!0}),r.setValue("connection_token",null,{shouldDirty:!0}),h(ue({uiType:"NPX",npxPackage:P.packageName}));return}if(N.startsWith("http://")||N.startsWith("https://")){const A=I==="HTTP"||I==="SSE"||I==="Websocket"?I:"HTTP";r.setValue("ui_type",A,{shouldDirty:!0}),r.setValue("connection_url",N,{shouldDirty:!0}),h(ue({uiType:A,connectionUrl:N})??ve({uiType:A,connectionUrl:N,registryItems:w}));return}I==="NPX"&&h(ue({uiType:"NPX",npxPackage:N}))},W=i?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(K,{variant:"outline",onClick:k,children:[t.jsx(He,{size:14,className:"sm:hidden"}),t.jsx("span",{className:"hidden sm:inline",children:"Custom Connection"})]})}):null;return t.jsx(t.Fragment,{children:t.jsxs(me,{children:[(()=>{const g="Create Connection",N="Create a custom connection in your organization. Fill in the details below.",z=r.formState.isSubmitting?"Saving...":"Create Connection",H=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(Q,{control:r.control,name:"ui_type",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Type *"}),t.jsxs(Nt,{value:h.value,onValueChange:h.onChange,children:[t.jsx(Z,{children:t.jsx(Dt,{children:t.jsx(kt,{})})}),t.jsxs(At,{children:[t.jsx(ce,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(je,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(ce,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(je,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(ce,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(je,{className:"w-4 h-4"}),"Websocket"]})}),o&&t.jsxs(t.Fragment,{children:[t.jsx(ce,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(he,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(ce,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Mt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(ee,{})]})}),I==="NPX"&&t.jsx(Q,{control:r.control,name:"npx_package",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"NPM Package *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"@perplexity-ai/mcp-server",...h,value:h.value??"",onPaste:P=>{const A=P.clipboardData.getData("text");A&&(P.preventDefault(),r.setValue("npx_package",A.trim(),{shouldDirty:!0}),R(A))},onBlur:P=>{R(P.target.value),h.onBlur()}})}),t.jsx(ee,{})]})}),I==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(Q,{control:r.control,name:"stdio_command",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Command *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"node, bun, python...",...h,value:h.value??""})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:r.control,name:"stdio_args",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Arguments"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"arg1 arg2 --flag value",...h,value:h.value??""})}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:r.control,name:"stdio_cwd",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Working Directory"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"/path/to/project (optional)",...h,value:h.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),t.jsx(ee,{})]})})]}),(I==="NPX"||I==="STDIO")&&t.jsx(Q,{control:r.control,name:"env_vars",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Environment Variables"}),t.jsx(Z,{children:t.jsx(Ft,{value:h.value??[],onChange:h.onChange})}),t.jsx(ee,{})]})}),I!=="NPX"&&I!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{control:r.control,name:"connection_url",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"URL *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"https://example.com/mcp",...h,value:h.value??"",onPaste:P=>{const A=P.clipboardData.getData("text");A&&(P.preventDefault(),r.setValue("connection_url",A.trim(),{shouldDirty:!0}),R(A))},onBlur:P=>{R(P.target.value),h.onBlur()}})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:r.control,name:"connection_token",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:T?.token?.label??"Token (optional)"}),t.jsx(Z,{children:t.jsx(ie,{type:"password",placeholder:T?.token?.placeholder??"Bearer token or API key",...h,value:h.value??""})}),T?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[T.token.helperText,T.id==="github"&&t.jsxs(t.Fragment,{children:[" ","·"," ",t.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:r.control,name:"title",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Name *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"My Connection",...h})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:r.control,name:"description",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Description"}),t.jsx(Z,{children:t.jsx(Tt,{placeholder:"A brief description of this connection",rows:3,...h,value:h.value??""})}),t.jsx(ee,{})]})})]}),E=O;return s?t.jsx(ft,{open:E,onOpenChange:q,children:t.jsxs(jt,{className:"max-h-[90vh]",children:[t.jsx(yt,{className:"pb-2",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx(Ct,{children:g}),t.jsx(St,{className:"mt-1",children:N})]}),t.jsx(vt,{asChild:!0,children:t.jsx(K,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(Re,{size:16})})})]})}),t.jsx(Se,{...r,children:t.jsxs("form",{onSubmit:r.handleSubmit(F),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:H}),t.jsx(bt,{children:t.jsx(K,{type:"submit",disabled:r.formState.isSubmitting,className:"w-full",children:z})})]})})]})}):t.jsx(Be,{open:E,onOpenChange:q,children:t.jsxs(Ee,{className:"sm:max-w-[525px]",children:[t.jsxs(Me,{children:[t.jsx(Fe,{children:g}),t.jsx(ze,{children:N})]}),t.jsx(Se,{...r,children:t.jsxs("form",{onSubmit:r.handleSubmit(F),children:[t.jsx("div",{className:"py-4",children:H}),t.jsxs(Ve,{children:[t.jsx(K,{type:"button",variant:"outline",onClick:()=>q(!1),children:"Cancel"}),t.jsx(K,{type:"submit",disabled:r.formState.isSubmitting,className:"min-w-40",children:z})]})]})})]})})})(),t.jsx(me.Content,{children:t.jsx(me.Body,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(me.Title,{children:"Connections"}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ct,{value:l.search,onChange:l.setSearch,placeholder:"Search for a connection",className:"w-full md:w-[375px]",onKeyDown:g=>{g.key==="Escape"&&(l.setSearch(""),g.target.blur())}}),t.jsx(lt,{sortKey:l.sortKey,sortDirection:l.sortDirection,onSort:l.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"updated_by",label:"Updated by"},{id:"updated_at",label:"Updated"}],filters:[{label:"Type",value:C,onChange:g=>S(g||"ALL"),options:[{id:"ALL",label:"All"},{id:"HTTP",label:"HTTP"},{id:"SSE",label:"SSE"},{id:"Websocket",label:"WebSocket"},{id:"STDIO",label:"STDIO"}]},{label:"Status",value:u,onChange:g=>p(g||"ALL"),options:[{id:"ALL",label:"All"},{id:"active",label:"Active"},{id:"inactive",label:"Inactive"},{id:"error",label:"Error"}]},..._.length>1?[{label:"Registry",value:c,onChange:g=>v(g||"ALL"),options:[{id:"ALL",label:"All registries"},..._.map(g=>({id:g.id,label:g.id.includes("community-registry")?"Community MCP Registry":g.title}))]}]:[]]})]}),W]}),t.jsx(at,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:j,onTabChange:g=>{const N=g;N!==j&&te("connections_page_tab_changed",{to_tab:N}),y(N)}}),t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ae,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx("div",{style:{opacity:D?.5:1,transition:D?"opacity 0.2s 0.2s linear":"opacity 0s 0s linear",pointerEvents:D?"none":"auto"},children:t.jsx(cn,{listState:l,activeTab:j,typeFilter:C,statusFilter:u,registryFilter:c,enabledRegistries:_})})})]})})})]})})}function Qs(){const f=ne.c(1);let e;return f[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ge,{children:t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ae,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(an,{})})}),f[0]=e):e=f[0],e}export{Qs as default};
1
+ import{r as V,c as ne,j as t,B as K,i as ae,p as te,l as ge,E as Ge,C as be,b as _e,u as Qe,a as Ne,z as Je,G as Ye,D as Ze,M as et,J as tt,n as nt,t as U,K as st}from"./index-D-XSdETh.js";import{a as De,b as ot,g as it,e as rt}from"./extract-connection-data-BWpGE_oz.js";import{C as lt}from"./collection-display-button-k8fcuck5.js";import{S as ct}from"./search-input-D7phSujf.js";import{C as at}from"./collection-tabs-C8z4HcKC.js";import{C as Ce,u as dt,a as ke,g as mt}from"./connection-card-e6lVAOde.js";import{E as ut}from"./empty-state-B9-HAyiA.js";import{P as me}from"./index-BeANJeGc.js";import{u as pt,D as gt}from"./use-delete-connection-BIJaDBxe.js";import{u as ye}from"./use-capability-BDfn_mmF.js";import{u as ht}from"./use-infinite-scroll-BW6tJUN7.js";import{u as xt}from"./use-view-mode-xdz1x-Nz.js";import{g as pe}from"./connection-slug-eyAPH6o3.js";import{c as Ae,d as Te,b as we,A as Ie,e as Pe,g as $e,a as Oe,f as Le}from"./alert-dialog-DEnhZkxC.js";import{n as he}from"./Tool02-Bedsr6M0.js";import{D as Me,a as Fe,h as ze,c as Ve,d as Ee,e as Be}from"./dialog-CkrS5RCd.js";import{D as ft,a as jt,c as yt,b as Ct,d as St,e as vt,f as bt}from"./drawer-DvI0Qijj.js";import{u as _t}from"./use-mobile-Cnw8TO8w.js";import{F as Q,b as J,c as Y,d as Z,f as ee,a as Se}from"./form-CWd6cwuX.js";import{I as ie}from"./input-dDAZFkLF.js";import{S as Nt,a as Dt,b as kt,c as At,d as ce}from"./select-CeW7yHMj.js";import{T as Tt}from"./textarea-Cvp1qBxI.js";import{b as Ke,u as wt}from"./use-connection-DwFoylnd.js";import{u as It}from"./use-virtual-mcp-DdUP8VhI.js";import{u as Pt}from"./studio-tools-ChuxRuTE.js";import{s as je}from"./Star01-DOEEbMVN.js";import{s as He}from"./Plus-DdMyRgmA.js";import{S as $t,R as Ot,ay as Lt,b as Mt}from"./agent-icon-BT1zF5P3.js";import{s as Re}from"./XClose-Bg6DW9hR.js";import{i as ue,a as ve,E as Ft,c as zt,p as Vt,b as Et,d as Bt}from"./connection-form-helpers-DITTUByC.js";import{a as Kt}from"./authenticate-and-persist-oauth-tFM75nwm.js";import{I as Ht}from"./integration-icon-VNiWpAhZ.js";import{C as Ue}from"./checkbox-BferAkrG.js";import{d as re,a as Rt,D as Ut,c as Wt}from"./dropdown-menu-DNr9TTIb.js";import{i as Xt}from"./DotsVertical-CaiMMtiU.js";import{s as We}from"./Eye-BtZsG05u.js";import{s as Xe}from"./Trash01--AWxA30K.js";import"./use-mcp-client-BRb4dnPI.js";import"./auth-Dpm13msT.js";import"./ArrowUp-CIDj-geR.js";import"./Check-BCiV8JPd.js";import"./SwitchHorizontal01-Du8IH-As.js";import"./tooltip-DnEd2RfI.js";import"./view-mode-toggle-CnqHztA-.js";import"./badge-BnJCnUD8.js";import"./SearchMd-DXtYkdlk.js";import"./use-registry-connections-Ce-C-NcA.js";import"./use-organization-settings-qUhh6e_h.js";import"./useInfiniteQuery-Cwb8c_M5.js";import"./retry-CErkP7V6.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./card-BwdKy-hR.js";import"./sidebar-CRFVq_6w.js";import"./LayoutLeft-DSvzQ3F0.js";import"./X-CxPemOwM.js";import"./label-BmPwCD_l.js";import"./ChevronDown-DMrJ8qUd.js";import"./ChevronUp-B4eyFU9D.js";import"./use-collections-nHSnEcq_.js";import"./AlertCircle-COm2lZmB.js";import"./Tool01-l46KKmTp.js";import"./Settings02-7Lan3xs5.js";import"./ArrowRight-BBZ4k1tZ.js";import"./ArrowUpRight-CZl49s-_.js";import"./TrendUp01-BYfwoU6O.js";import"./ZapSquare-C99XNWC0.js";import"./ZoomOut-BtgkZIdX.js";import"./Users03-CHsFtqWs.js";import"./CheckCircle-BrCHMLmT.js";import"./ChevronRight-DQPMDbxY.js";import"./Stars02-D0cgeCkL.js";import"./Copy01-B5PsaZtC.js";import"./Globe01-BBalwuJ-.js";import"./FilterLines-R3LckEdX.js";import"./Globe04-BoTer0PL.js";import"./HardDrive-B-gJ3Ugg.js";import"./Image01-vVeK01uU.js";import"./Key01-LGwwdQ_o.js";import"./XCircle-CDWV_SjD.js";import"./LinkExternal01-DAa_z87G.js";import"./Monitor01-Cp0O-ipq.js";import"./Sun-DWZWERXA.js";import"./Package-Do8Z10X9.js";import"./Palette-BxScKXfV.js";import"./Play-DxmYkTCO.js";import"./SearchLg-Cuf8OlKN.js";import"./Shield01-DA0MY5vq.js";import"./Stars01-C_W_4866.js";import"./Upload01-D8P_FbUI.js";import"./User01-5weGoSXw.js";import"./Users01-DZAmzF4m.js";import"./Zap-rnKuI319.js";import"./mcp-oauth-BvWzv6R3.js";function qt(f){const e=`deco-filters-${f}`,[n,a]=V.useState(()=>{try{const s=globalThis.localStorage?.getItem(e);if(s)return JSON.parse(s)}catch(s){console.error("Failed to parse stored filters:",s)}return[]});return[n,s=>{a(s);try{globalThis.localStorage?.setItem(e,JSON.stringify(s))}catch(i){console.error("Failed to save filters:",i)}}]}function Gt(f){const e=ne.c(7),[n,a]=V.useState(f),[o,s]=V.useState(f?"desc":null);let i;e[0]!==o||e[1]!==n?(i=j=>{n!==j?(a(j),s("asc")):o==="asc"?s("desc"):o==="desc"&&(a(void 0),s(null))},e[0]=o,e[1]=n,e[2]=i):i=e[2];const l=i;let d;return e[3]!==l||e[4]!==o||e[5]!==n?(d={sortKey:n,sortDirection:o,handleSort:l},e[3]=l,e[4]=o,e[5]=n,e[6]=d):d=e[6],d}function Qt(f){const e=ne.c(20),{namespace:n,resource:a,defaultSortKey:o,defaultViewMode:s}=f,i=o===void 0?"title":o,l=s===void 0?"table":s,[d,j]=V.useState(""),y=V.useDeferredValue(d),C=`${n}-${a}`,[S,u]=qt(C),p=`mesh-${a}-filter-visible-${n}`;let c;e[0]!==p?(c=()=>globalThis.localStorage?.getItem(p)==="true",e[0]=p,e[1]=c):c=e[1];const[v,_]=V.useState(c);let b;e[2]!==p?(b=F=>{_(F),globalThis.localStorage?.setItem(p,String(F))},e[2]=p,e[3]=b):b=e[3];const w=b;let D;e[4]!==v||e[5]!==w?(D=()=>{w(!v)},e[4]=v,e[5]=w,e[6]=D):D=e[6];const r=D,[I,$]=xt(`mesh-${a}-${n}`,l),{sortKey:L,sortDirection:T,handleSort:O}=Gt(i),k=L;let M;return e[7]!==v||e[8]!==S||e[9]!==O||e[10]!==d||e[11]!==y||e[12]!==w||e[13]!==u||e[14]!==$||e[15]!==T||e[16]!==k||e[17]!==r||e[18]!==I?(M={search:d,searchTerm:y,setSearch:j,filters:S,setFilters:u,filterBarVisible:v,setFilterBarVisible:w,toggleFilterBar:r,viewMode:I,setViewMode:$,sortKey:k,sortDirection:T,handleSort:O},e[7]=v,e[8]=S,e[9]=O,e[10]=d,e[11]=y,e[12]=w,e[13]=u,e[14]=$,e[15]=T,e[16]=k,e[17]=r,e[18]=I,e[19]=M):M=e[19],M}function Jt(f){const e=ne.c(20),{open:n,onOpenChange:a,count:o,onConfirm:s}=f,i=o!==1?"s":"";let l;e[0]!==o||e[1]!==i?(l=t.jsxs(Ae,{children:["Delete ",o," connection",i,"?"]}),e[0]=o,e[1]=i,e[2]=l):l=e[2];const d=o!==1?"s":"";let j;e[3]!==d?(j=t.jsxs(Te,{children:["This will permanently delete the selected connection",d,". This action cannot be undone."]}),e[3]=d,e[4]=j):j=e[4];let y;e[5]!==l||e[6]!==j?(y=t.jsxs(we,{children:[l,j]}),e[5]=l,e[6]=j,e[7]=y):y=e[7];let C;e[8]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Ie,{children:"Cancel"}),e[8]=C):C=e[8];const S=o!==1?"s":"";let u;e[9]!==o||e[10]!==s||e[11]!==S?(u=t.jsxs(Pe,{children:[C,t.jsxs($e,{onClick:s,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:["Delete ",o," connection",S]})]}),e[9]=o,e[10]=s,e[11]=S,e[12]=u):u=e[12];let p;e[13]!==y||e[14]!==u?(p=t.jsxs(Oe,{children:[y,u]}),e[13]=y,e[14]=u,e[15]=p):p=e[15];let c;return e[16]!==a||e[17]!==n||e[18]!==p?(c=t.jsx(Le,{open:n,onOpenChange:a,children:p}),e[16]=a,e[17]=n,e[18]=p,e[19]=c):c=e[19],c}function Yt(f){return f._registryId?.includes("community-registry")===!0}function Zt(f){const e=ne.c(58),{item:n,canManage:a,allConnections:o,connectedAppNames:s,connectingItemId:i,onNavigateConnected:l,onConnect:d}=f,[j,y]=V.useState(!1),[C,S]=V.useState(null);let u,p;e[0]!==s||e[1]!==n?(u=De(n)??"",p=s.has(u),e[0]=s,e[1]=n,e[2]=u,e[3]=p):(u=e[2],p=e[3]);const c=p,v=n._meta?.["mcp.mesh"],_=v?.friendlyName||v?.friendly_name||n.server?.title||n.title||n.server?.name||n.name||n.id||"",b=n.server?.description||n.description||null;let w;e[4]!==n.server?.icons?.[0]?.src||e[5]!==n.server?.repository?(w=n.server?.icons?.[0]?.src||ot(n.server?.repository)||null,e[4]=n.server?.icons?.[0]?.src,e[5]=n.server?.repository,e[6]=w):w=e[6];const D=w;let r;if(e[7]!==o||e[8]!==u){let A;e[10]!==u?(A=oe=>oe.connection_type!=="VIRTUAL"&&oe.app_name===u,e[10]=u,e[11]=A):A=e[11],r=o.filter(A),e[7]=o,e[8]=u,e[9]=r}else r=e[9];const I=r;let $;e[12]!==n?($=Yt(n),e[12]=n,e[13]=$):$=e[13];const L=$;let T,O;e[14]!==I||e[15]!==a||e[16]!==L||e[17]!==c||e[18]!==n||e[19]!==d||e[20]!==l?(T=()=>{if(c){const A=I[0];A&&l(A);return}a&&O()},O=()=>{L?(S("connect"),y(!0)):d(n)},e[14]=I,e[15]=a,e[16]=L,e[17]=c,e[18]=n,e[19]=d,e[20]=l,e[21]=T,e[22]=O):(T=e[21],O=e[22]);let k;e[23]!==n||e[24]!==d||e[25]!==C?(k=()=>{te("connections_community_warning_confirmed",{registry_item_id:n.id}),y(!1),C==="connect"&&d(n),S(null)},e[23]=n,e[24]=d,e[25]=C,e[26]=k):k=e[26];const M=k;let F;e[27]!==b||e[28]!==D||e[29]!==_?(F={title:_,description:b,icon:D},e[27]=b,e[28]=D,e[29]=_,e[30]=F):F=e[30];let q;e[31]===Symbol.for("react.memo_cache_sentinel")?(q=t.jsx(he,{}),e[31]=q):q=e[31];let R;e[32]!==L||e[33]!==n._sourceIcon?(R=L&&n._sourceIcon&&t.jsx("img",{src:n._sourceIcon,alt:"Community",className:"size-4 rounded-sm object-contain"}),e[32]=L,e[33]=n._sourceIcon,e[34]=R):R=e[34];let W;e[35]!==a||e[36]!==i||e[37]!==O||e[38]!==c||e[39]!==n.id?(W=c?t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}):a&&t.jsx(K,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:i!==null,onClick:A=>{A.stopPropagation(),O()},children:i===n.id?t.jsx(ae,{size:14,className:"animate-spin"}):"Connect"}),e[35]=a,e[36]=i,e[37]=O,e[38]=c,e[39]=n.id,e[40]=W):W=e[40];let g;e[41]!==R||e[42]!==W?(g=t.jsxs("div",{className:"flex items-center gap-2",children:[R,W]}),e[41]=R,e[42]=W,e[43]=g):g=e[43];let N;e[44]!==T||e[45]!==g||e[46]!==F?(N=t.jsx(Ce,{connection:F,fallbackIcon:q,onClick:T,headerActionsAlwaysVisible:!0,headerActions:g}),e[44]=T,e[45]=g,e[46]=F,e[47]=N):N=e[47];let z;e[48]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsxs(we,{children:[t.jsx(Ae,{children:"Community MCP Server"}),t.jsx(Te,{children:"This MCP server is from the Community MCP Registry and is not maintained or verified by Deco. Community servers may have varying levels of quality, security, and reliability. Proceed with caution and review the server details before connecting."})]}),e[48]=z):z=e[48];let H;e[49]===Symbol.for("react.memo_cache_sentinel")?(H=t.jsx(Ie,{children:"Cancel"}),e[49]=H):H=e[49];let E;e[50]!==M?(E=t.jsxs(Oe,{children:[z,t.jsxs(Pe,{children:[H,t.jsx($e,{onClick:M,children:"Continue"})]})]}),e[50]=M,e[51]=E):E=e[51];let h;e[52]!==j||e[53]!==E?(h=t.jsx(Le,{open:j,onOpenChange:y,children:E}),e[52]=j,e[53]=E,e[54]=h):h=e[54];let P;return e[55]!==N||e[56]!==h?(P=t.jsxs(t.Fragment,{children:[N,h]}),e[55]=N,e[56]=h,e[57]=P):P=e[57],P}function qe(f){const e=ne.c(8),{selectionMode:n,children:a}=f,o=n?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100";let s;e[0]!==o?(s=ge("overflow-hidden transition-all duration-150 ease-out",o),e[0]=o,e[1]=s):s=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Rt,{asChild:!0,children:t.jsx(K,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:tn,children:t.jsx(Xt,{size:20})})}),e[2]=i):i=e[2];let l;e[3]!==a?(l=t.jsxs(Ut,{children:[i,t.jsx(Wt,{align:"end",onClick:en,children:a})]}),e[3]=a,e[4]=l):l=e[4];let d;return e[5]!==s||e[6]!==l?(d=t.jsx("div",{className:s,children:l}),e[5]=s,e[6]=l,e[7]=d):d=e[7],d}function en(f){return f.stopPropagation()}function tn(f){return f.stopPropagation()}function nn(f){const e=ne.c(49),{group:n,onOpen:a,selectionMode:o,selectedIds:s,onToggleSelect:i}=f;let l;if(e[0]!==n.connections||e[1]!==s){let k;e[3]!==s?(k=M=>s.has(M.id),e[3]=s,e[4]=k):k=e[4],l=n.connections.every(k),e[0]=n.connections,e[1]=s,e[2]=l}else l=e[2];const d=l;let j;if(e[5]!==n.connections||e[6]!==s){let k;e[8]!==s?(k=M=>s.has(M.id),e[8]=s,e[9]=k):k=e[9],j=n.connections.some(k),e[5]=n.connections,e[6]=s,e[7]=j}else j=e[7];const y=j;let C;e[10]!==d||e[11]!==n.connections||e[12]!==i||e[13]!==s?(C=()=>{for(const k of n.connections)d?s.has(k.id)&&i(k.id):s.has(k.id)||i(k.id)},e[10]=d,e[11]=n.connections,e[12]=i,e[13]=s,e[14]=C):C=e[14];const S=C,u=`${n.connections.length} instances`;let p;e[15]!==n.icon||e[16]!==n.title||e[17]!==u?(p={title:n.title,icon:n.icon,description:u},e[15]=n.icon,e[16]=n.title,e[17]=u,e[18]=p):p=e[18];let c;e[19]!==a||e[20]!==o||e[21]!==S?(c=()=>o?S():a(),e[19]=a,e[20]=o,e[21]=S,e[22]=c):c=e[22];const v=o&&d&&"ring-2 ring-primary",_=o&&y&&!d&&"ring-1 ring-primary/50";let b;e[23]!==v||e[24]!==_?(b=ge(v,_),e[23]=v,e[24]=_,e[25]=b):b=e[25];let w;e[26]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(he,{}),e[26]=w):w=e[26];let D;e[27]!==d||e[28]!==n.connections.length||e[29]!==o||e[30]!==y||e[31]!==S?(D=o?t.jsx(Ue,{checked:d?!0:y?"indeterminate":!1,onCheckedChange:S}):t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsxs("span",{className:"text-xs text-muted-foreground font-normal tabular-nums",children:["x",n.connections.length]})]}),e[27]=d,e[28]=n.connections.length,e[29]=o,e[30]=y,e[31]=S,e[32]=D):D=e[32];let r;e[33]!==a?(r=k=>{k.stopPropagation(),a()},e[33]=a,e[34]=r):r=e[34];let I;e[35]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(We,{size:16}),e[35]=I):I=e[35];let $;e[36]!==r?($=t.jsxs(re,{onClick:r,children:[I,"Open"]}),e[36]=r,e[37]=$):$=e[37];let L;e[38]!==o||e[39]!==$?(L=t.jsx(qe,{selectionMode:o,children:$}),e[38]=o,e[39]=$,e[40]=L):L=e[40];let T;e[41]!==D||e[42]!==L?(T=t.jsxs("div",{className:"flex items-center gap-1",children:[D,L]}),e[41]=D,e[42]=L,e[43]=T):T=e[43];let O;return e[44]!==T||e[45]!==p||e[46]!==c||e[47]!==b?(O=t.jsx(t.Fragment,{children:t.jsx(Ce,{connection:p,onClick:c,className:b,fallbackIcon:w,headerActionsAlwaysVisible:!0,headerActions:T})}),e[44]=T,e[45]=p,e[46]=c,e[47]=b,e[48]=O):O=e[48],O}function sn(f){const e=ne.c(29),{connection:n,isSelected:a,selectionMode:o,canManage:s,canManageAgents:i,onToggleSelect:l,onOpen:d,onToggleStatus:j,onDelete:y}=f;let C;e[0]!==a||e[1]!==l||e[2]!==o?(C=o?t.jsx(Ue,{checked:a,onCheckedChange:l,onClick:on}):t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),e[0]=a,e[1]=l,e[2]=o,e[3]=C):C=e[3];let S;e[4]!==d?(S=D=>{D.stopPropagation(),d()},e[4]=d,e[5]=S):S=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(We,{size:16}),e[6]=u):u=e[6];let p;e[7]!==S?(p=t.jsxs(re,{onClick:S,children:[u,"Open"]}),e[7]=S,e[8]=p):p=e[8];let c;e[9]!==s||e[10]!==i||e[11]!==l?(c=(s||i)&&t.jsxs(re,{onClick:D=>{D.stopPropagation(),l()},children:[t.jsx(Lt,{size:16}),"Select"]}),e[9]=s,e[10]=i,e[11]=l,e[12]=c):c=e[12];let v;e[13]!==s||e[14]!==n||e[15]!==j?(v=s&&(n.status==="active"?t.jsxs(re,{onClick:D=>{D.stopPropagation(),j("inactive")},children:[t.jsx($t,{size:16}),"Disable"]}):t.jsxs(re,{onClick:D=>{D.stopPropagation(),j("active")},children:[t.jsx(Ot,{size:16}),"Enable"]})),e[13]=s,e[14]=n,e[15]=j,e[16]=v):v=e[16];let _;e[17]!==s||e[18]!==y?(_=s&&t.jsxs(re,{variant:"destructive",onClick:D=>{D.stopPropagation(),y()},children:[t.jsx(Xe,{size:16}),"Delete"]}),e[17]=s,e[18]=y,e[19]=_):_=e[19];let b;e[20]!==o||e[21]!==p||e[22]!==c||e[23]!==v||e[24]!==_?(b=t.jsxs(qe,{selectionMode:o,children:[p,c,v,_]}),e[20]=o,e[21]=p,e[22]=c,e[23]=v,e[24]=_,e[25]=b):b=e[25];let w;return e[26]!==C||e[27]!==b?(w=t.jsxs("div",{className:"flex items-center gap-1",children:[C,b]}),e[26]=C,e[27]=b,e[28]=w):w=e[28],w}function on(f){return f.stopPropagation()}function rn(f){const e=ne.c(23),{count:n,total:a,canManage:o,canManageAgents:s,onSelectAll:i,onDeselectAll:l,onDelete:d,onAddToAgent:j,onToggleStatus:y,onCancel:C}=f;if(n===0)return null;let S;e[0]!==n?(S=t.jsxs("div",{className:"text-xs text-muted-foreground pr-1 tabular-nums",children:[n," selected"]}),e[0]=n,e[1]=S):S=e[1];let u;e[2]!==n||e[3]!==l||e[4]!==i||e[5]!==a?(u=n<a?t.jsxs(K,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:i,children:["Select all (",a,")"]}):t.jsx(K,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:l,children:"Clear selection"}),e[2]=n,e[3]=l,e[4]=i,e[5]=a,e[6]=u):u=e[6];let p;e[7]!==s||e[8]!==j?(p=s&&t.jsxs(K,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:j,children:[t.jsx(He,{size:13}),"Add to Agent"]}),e[7]=s,e[8]=j,e[9]=p):p=e[9];let c;e[10]!==o||e[11]!==d||e[12]!==y?(c=o&&t.jsxs(t.Fragment,{children:[t.jsx(K,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>y("active"),children:"Enable"}),t.jsx(K,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>y("inactive"),children:"Disable"}),t.jsxs(K,{variant:"destructive",size:"sm",className:"h-7 text-xs px-2",onClick:d,children:[t.jsx(Xe,{size:13}),"Delete"]})]}),e[10]=o,e[11]=d,e[12]=y,e[13]=c):c=e[13];let v;e[14]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(Re,{size:13}),e[14]=v):v=e[14];let _;e[15]!==C?(_=t.jsx(K,{variant:"ghost",size:"sm",className:"h-7 text-xs px-2",onClick:C,children:v}),e[15]=C,e[16]=_):_=e[16];let b;return e[17]!==S||e[18]!==u||e[19]!==p||e[20]!==c||e[21]!==_?(b=t.jsx("div",{className:"fixed bottom-4 left-1/2 z-50 -translate-x-1/2",children:t.jsxs("div",{className:"rounded-xl border border-border bg-background/95 shadow-lg backdrop-blur px-3 py-2 flex items-center gap-2",children:[S,u,p,c,_]})}),e[17]=S,e[18]=u,e[19]=p,e[20]=c,e[21]=_,e[22]=b):b=e[22],b}function ln(f){const e=ne.c(25),{open:n,onOpenChange:a,agents:o,onConfirm:s}=f,[i,l]=V.useState(null);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsxs(Me,{children:[t.jsx(Fe,{children:"Add to Agent"}),t.jsx(ze,{children:"Select an agent to add the selected connections to."})]}),e[0]=d):d=e[0];let j;e[1]!==o||e[2]!==i?(j=o.length===0?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No agents found"}):o.map(b=>t.jsxs("button",{type:"button",onClick:()=>l(b.id),className:ge("flex items-center gap-3 w-full rounded-md px-3 py-2 text-left transition-colors",i===b.id?"bg-primary/10 ring-1 ring-primary":"hover:bg-muted/50"),children:[t.jsx(Ht,{icon:b.icon,name:b.title,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:b.title}),b.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:b.description})]})]},b.id)),e[1]=o,e[2]=i,e[3]=j):j=e[3];let y;e[4]!==j?(y=t.jsx("div",{className:"max-h-60 overflow-auto py-2 space-y-1",children:j}),e[4]=j,e[5]=y):y=e[5];let C;e[6]!==a?(C=t.jsx(K,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e[6]=a,e[7]=C):C=e[7];const S=!i;let u;e[8]!==s||e[9]!==a||e[10]!==i?(u=()=>{i&&(s(i),a(!1),l(null))},e[8]=s,e[9]=a,e[10]=i,e[11]=u):u=e[11];let p;e[12]!==S||e[13]!==u?(p=t.jsx(K,{disabled:S,onClick:u,children:"Add"}),e[12]=S,e[13]=u,e[14]=p):p=e[14];let c;e[15]!==C||e[16]!==p?(c=t.jsxs(Ve,{children:[C,p]}),e[15]=C,e[16]=p,e[17]=c):c=e[17];let v;e[18]!==y||e[19]!==c?(v=t.jsxs(Ee,{className:"sm:max-w-[400px]",children:[d,y,c]}),e[18]=y,e[19]=c,e[20]=v):v=e[20];let _;return e[21]!==a||e[22]!==n||e[23]!==v?(_=t.jsx(Be,{open:n,onOpenChange:a,children:v}),e[21]=a,e[22]=n,e[23]=v,e[24]=_):_=e[24],_}function cn({listState:f,activeTab:e,typeFilter:n,statusFilter:a,registryFilter:o,enabledRegistries:s}){const{org:i}=be(),l=nt(),d=_e(),{data:j}=Ne.useSession(),y=Ke(),C=wt(f),S=pt(),{granted:u}=ye("connections:manage"),{granted:p}=ye("agents:manage"),[c,v]=V.useState(new Set),_=c.size>0,[b,w]=V.useState(!1),[D,r]=V.useState(!1),[I,$]=V.useState(null),L=It(),T=C.filter(m=>!(n!=="ALL"&&m.connection_type!==n||a!=="ALL"&&m.status!==a)),O=mt(T),k=m=>{v(x=>{const B=new Set(x);return B.has(m)?B.delete(m):B.add(m),B})},M=()=>{v(new Set)},F=ke(s,f.searchTerm),q=F.items,R=ht(F.loadMore,F.hasMore,F.isLoadingMore),W=new Set(C.filter(m=>m.app_name).map(m=>m.app_name)),g=o==="ALL"||s.some(m=>m.id===o)?o:"ALL",N=f.search.length>0,z=e==="all"||N?q.filter(m=>{if(g!=="ALL"&&m._registryId!==g)return!1;if(N){const x=De(m);if(x&&W.has(x))return!1}return!0}):[],H=e==="connected"||N?O:[],E=async m=>{if(!(!i||!j?.user?.id)){te("connection_add_clicked",{action:"connect_new",registry_item_id:m.id,source:"connections_page"}),$(m.id);try{const x=rt(m,i.id,j.user.id,{remoteIndex:0}),B=x.connection_type==="STDIO",G=!!x.connection_url,X=B&&x.connection_headers&&typeof x.connection_headers=="object"&&"command"in x.connection_headers;if(!G&&!X){U.error("This MCP Server cannot be connected: no connection method available"),$(null);return}const{id:se}=await y.create.mutateAsync(x),le=await Kt({connectionId:se,orgId:i.id,orgSlug:i.slug,persistFallback:fe=>y.update.mutateAsync({id:se,data:{connection_token:fe}}).then(()=>{})});if(le.ran&&!le.ok){te("connection_oauth_failed",{connection_id:se,flow:"connections_page_connect",error:le.error??"no_token"}),U.error(`Authentication failed: ${le.error??"no token received"}`);return}if(le.ran){te("connection_oauth_succeeded",{connection_id:se,flow:"connections_page_connect"});const fe=new URL(`/api/${i.slug}/mcp/${se}`,window.location.origin);await l.invalidateQueries({queryKey:st.isMCPAuthenticated(fe.href,null)}),P(),U.success("Authentication successful")}U.success("Connected successfully")}catch(x){U.error(`Failed to connect: ${x instanceof Error?x.message:String(x)}`)}finally{$(null)}}},h=Pt(),P=()=>{l.invalidateQueries({predicate:m=>{const x=m.queryKey;return x[1]===i.id&&x[3]==="collection"&&x[4]==="CONNECTIONS"}})},A=async()=>{w(!1);const m=[...c];te("connections_bulk_delete",{count:m.length});let x=0;for(const B of m)try{await h.call("COLLECTION_CONNECTIONS_DELETE",{id:B,force:!0}),x++}catch{}P(),U.success(`Deleted ${x} connection${x!==1?"s":""}`),M()},oe=async(m,x)=>{try{await y.update.mutateAsync({id:m,data:{status:x}}),P(),U.success(x==="active"?"Connection enabled":"Connection disabled")}catch{U.error("Failed to update connection")}},xe=async m=>{const x=[...c];te("connections_bulk_status_toggled",{count:x.length,to_status:m});let B=0;for(const G of x)try{await y.update.mutateAsync({id:G,data:{status:m}}),B++}catch{}P(),U.success(`${m==="active"?"Enabled":"Disabled"} ${B} connection${B!==1?"s":""}`),M()},de=async m=>{const x=L.find(X=>X.id===m);if(!x)return;te("connections_bulk_add_to_agent",{agent_id:m,count:c.size});const B=new Set(x.connections.map(X=>X.connection_id)),G=[...c].filter(X=>!B.has(X)).map(X=>({connection_id:X,selected_tools:null,selected_resources:null,selected_prompts:null}));if(G.length===0){U.info("All selected connections are already in that agent");return}try{await h.call("COLLECTION_VIRTUAL_MCP_UPDATE",{id:m,data:{connections:[...x.connections,...G]}}),l.invalidateQueries({predicate:X=>{const se=X.queryKey;return se[1]===i.id&&se[3]==="collection"&&se[4]==="VIRTUAL_MCP"}}),U.success(`Added ${G.length} connection${G.length!==1?"s":""} to "${x.title}"`),M()}catch{U.error("Failed to add connections to agent")}};return t.jsxs(t.Fragment,{children:[t.jsx(gt,{...S}),t.jsx(Jt,{open:b,onOpenChange:w,count:c.size,onConfirm:A}),t.jsx(ln,{open:D,onOpenChange:r,agents:L,onConfirm:de}),F.isInitialLoading&&e==="all"?t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ae,{size:32,className:"animate-spin text-muted-foreground"})}):t.jsx("div",{children:(N?z.length===0&&T.length===0:e==="all"?z.length===0:T.length===0)?t.jsx(ut,{image:t.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:"No Connections found",description:f.search?`No Connections match "${f.search}"`:u?"Create a connection to get started.":"Ask an organization admin to add one."}):t.jsxs("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:[H.map(m=>{if(m.type==="group")return t.jsx(nn,{group:m,onOpen:()=>{d({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:m.key}})},selectionMode:_,selectedIds:c,onToggleSelect:k},m.key);const x=m.connection,B=c.has(x.id);return t.jsx(Ce,{connection:x,fallbackIcon:t.jsx(he,{}),onClick:()=>_?k(x.id):d({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:pe(x)}}),className:ge(B&&"ring-2 ring-primary bg-primary/5"),headerActionsAlwaysVisible:!0,headerActions:t.jsx(sn,{connection:x,isSelected:B,selectionMode:_,canManage:u,canManageAgents:p,onToggleSelect:()=>k(x.id),onOpen:()=>d({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:pe(x)}}),onToggleStatus:G=>oe(x.id,G),onDelete:()=>S.requestDelete(x)})},x.id)}),z.map(m=>t.jsx(Zt,{item:m,canManage:u,allConnections:C,connectedAppNames:W,connectingItemId:I,onNavigateConnected:x=>d({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:pe(x)}}),onConnect:E},`catalog-${m._registryId}:${m.id}`)),(e==="all"||N)&&s.length>0&&t.jsx("div",{ref:R,className:"col-span-full h-4"}),(e==="all"||N)&&F.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(ae,{size:24,className:"animate-spin text-muted-foreground"})})]})}),_&&t.jsx(rn,{count:c.size,total:T.length,canManage:u,canManageAgents:p,onSelectAll:()=>{v(new Set(T.map(m=>m.id)))},onDeselectAll:()=>v(new Set),onDelete:()=>w(!0),onAddToAgent:()=>r(!0),onToggleStatus:xe,onCancel:M})]})}function an(){const{org:f}=be(),e=_e(),n=Qe({strict:!1}),{data:a}=Ne.useSession(),{stdioEnabled:o}=Je(),s=_t(),{granted:i}=ye("connections:manage"),l=Qt({namespace:f.slug,resource:"connections"}),d=Ke(),[j,y]=Ye(Ze.connectionsTab(f.slug),g=>n.tab==="all"||n.tab==="connected"?n.tab:g??"all"),[C,S]=V.useState("ALL"),[u,p]=V.useState("ALL"),[c,v]=V.useState("ALL"),_=dt(),w=ke(_,l.searchTerm).items,D=l.search!==l.searchTerm,r=et({resolver:tt(zt),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),I=r.watch("ui_type"),$=r.watch("connection_url"),L=r.watch("npx_package"),T=ue({uiType:I,connectionUrl:$??"",npxPackage:L??""})??ve({uiType:I,connectionUrl:$??"",registryItems:w}),O=i&&n.action==="create",k=()=>{te("connections_custom_dialog_opened",{source:"connections_page"}),e({to:"/$org/settings/connections",params:{org:f.slug},search:{action:"create"}})},M=()=>{e({to:"/$org/settings/connections",params:{org:f.slug},search:{}})},F=async g=>{let N,z=null,H=null,E=null;g.ui_type==="NPX"?(N="STDIO",z="",E=Et(g.npx_package||"",g.env_vars||[])):g.ui_type==="STDIO"?(N="STDIO",z="",E=Bt(g.stdio_command||"",g.stdio_args||"",g.stdio_cwd,g.env_vars||[])):(N=g.ui_type,z=g.connection_url||"",H=g.connection_token||null);const h=it("conn");te("connection_custom_created",{connection_type:N,ui_type:g.ui_type}),await d.create.mutateAsync({id:h,title:g.title,description:g.description||null,connection_type:N,connection_url:z,connection_token:H,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:a?.user?.id||"system",organization_id:f.id,icon:g.icon??null,app_name:null,app_id:null,connection_headers:E,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),M(),r.reset(),e({to:"/$org/settings/connections/$appSlug",params:{org:f.slug,appSlug:pe({app_name:null,connection_url:z,title:g.title,id:h})}})},q=g=>{g||(O&&M(),r.reset())},R=g=>{const N=g.trim();if(!N)return;const z=!!r.formState.dirtyFields.title,H=!!r.formState.dirtyFields.description,E=!!r.formState.dirtyFields.env_vars,h=A=>{if(A&&(!z&&!r.getValues("title").trim()&&A.title&&r.setValue("title",A.title,{shouldDirty:!1}),!H&&!(r.getValues("description")??"").trim()&&A.description&&r.setValue("description",A.description,{shouldDirty:!1}),!E&&A.envVarKeys?.length)){const oe=r.getValues("env_vars")??[],xe=new Set(oe.map(m=>m.key)),de=A.envVarKeys.filter(m=>!xe.has(m));de.length>0&&r.setValue("env_vars",[...oe,...de.map(m=>({key:m,value:""}))],{shouldDirty:!0})}},P=Vt(N);if(P&&o){r.setValue("ui_type","NPX",{shouldDirty:!0}),r.setValue("npx_package",P.packageName,{shouldDirty:!0}),r.setValue("connection_url","",{shouldDirty:!0}),r.setValue("connection_token",null,{shouldDirty:!0}),h(ue({uiType:"NPX",npxPackage:P.packageName}));return}if(N.startsWith("http://")||N.startsWith("https://")){const A=I==="HTTP"||I==="SSE"||I==="Websocket"?I:"HTTP";r.setValue("ui_type",A,{shouldDirty:!0}),r.setValue("connection_url",N,{shouldDirty:!0}),h(ue({uiType:A,connectionUrl:N})??ve({uiType:A,connectionUrl:N,registryItems:w}));return}I==="NPX"&&h(ue({uiType:"NPX",npxPackage:N}))},W=i?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(K,{variant:"outline",onClick:k,children:[t.jsx(He,{size:14,className:"sm:hidden"}),t.jsx("span",{className:"hidden sm:inline",children:"Custom Connection"})]})}):null;return t.jsx(t.Fragment,{children:t.jsxs(me,{children:[(()=>{const g="Create Connection",N="Create a custom connection in your organization. Fill in the details below.",z=r.formState.isSubmitting?"Saving...":"Create Connection",H=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(Q,{control:r.control,name:"ui_type",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Type *"}),t.jsxs(Nt,{value:h.value,onValueChange:h.onChange,children:[t.jsx(Z,{children:t.jsx(Dt,{children:t.jsx(kt,{})})}),t.jsxs(At,{children:[t.jsx(ce,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(je,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(ce,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(je,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(ce,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(je,{className:"w-4 h-4"}),"Websocket"]})}),o&&t.jsxs(t.Fragment,{children:[t.jsx(ce,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(he,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(ce,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Mt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(ee,{})]})}),I==="NPX"&&t.jsx(Q,{control:r.control,name:"npx_package",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"NPM Package *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"@perplexity-ai/mcp-server",...h,value:h.value??"",onPaste:P=>{const A=P.clipboardData.getData("text");A&&(P.preventDefault(),r.setValue("npx_package",A.trim(),{shouldDirty:!0}),R(A))},onBlur:P=>{R(P.target.value),h.onBlur()}})}),t.jsx(ee,{})]})}),I==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(Q,{control:r.control,name:"stdio_command",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Command *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"node, bun, python...",...h,value:h.value??""})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:r.control,name:"stdio_args",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Arguments"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"arg1 arg2 --flag value",...h,value:h.value??""})}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:r.control,name:"stdio_cwd",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Working Directory"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"/path/to/project (optional)",...h,value:h.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),t.jsx(ee,{})]})})]}),(I==="NPX"||I==="STDIO")&&t.jsx(Q,{control:r.control,name:"env_vars",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Environment Variables"}),t.jsx(Z,{children:t.jsx(Ft,{value:h.value??[],onChange:h.onChange})}),t.jsx(ee,{})]})}),I!=="NPX"&&I!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{control:r.control,name:"connection_url",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"URL *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"https://example.com/mcp",...h,value:h.value??"",onPaste:P=>{const A=P.clipboardData.getData("text");A&&(P.preventDefault(),r.setValue("connection_url",A.trim(),{shouldDirty:!0}),R(A))},onBlur:P=>{R(P.target.value),h.onBlur()}})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:r.control,name:"connection_token",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:T?.token?.label??"Token (optional)"}),t.jsx(Z,{children:t.jsx(ie,{type:"password",placeholder:T?.token?.placeholder??"Bearer token or API key",...h,value:h.value??""})}),T?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[T.token.helperText,T.id==="github"&&t.jsxs(t.Fragment,{children:[" ","·"," ",t.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:r.control,name:"title",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Name *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"My Connection",...h})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:r.control,name:"description",render:({field:h})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Description"}),t.jsx(Z,{children:t.jsx(Tt,{placeholder:"A brief description of this connection",rows:3,...h,value:h.value??""})}),t.jsx(ee,{})]})})]}),E=O;return s?t.jsx(ft,{open:E,onOpenChange:q,children:t.jsxs(jt,{className:"max-h-[90vh]",children:[t.jsx(yt,{className:"pb-2",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx(Ct,{children:g}),t.jsx(St,{className:"mt-1",children:N})]}),t.jsx(vt,{asChild:!0,children:t.jsx(K,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(Re,{size:16})})})]})}),t.jsx(Se,{...r,children:t.jsxs("form",{onSubmit:r.handleSubmit(F),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:H}),t.jsx(bt,{children:t.jsx(K,{type:"submit",disabled:r.formState.isSubmitting,className:"w-full",children:z})})]})})]})}):t.jsx(Be,{open:E,onOpenChange:q,children:t.jsxs(Ee,{className:"sm:max-w-[525px]",children:[t.jsxs(Me,{children:[t.jsx(Fe,{children:g}),t.jsx(ze,{children:N})]}),t.jsx(Se,{...r,children:t.jsxs("form",{onSubmit:r.handleSubmit(F),children:[t.jsx("div",{className:"py-4",children:H}),t.jsxs(Ve,{children:[t.jsx(K,{type:"button",variant:"outline",onClick:()=>q(!1),children:"Cancel"}),t.jsx(K,{type:"submit",disabled:r.formState.isSubmitting,className:"min-w-40",children:z})]})]})})]})})})(),t.jsx(me.Content,{children:t.jsx(me.Body,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(me.Title,{children:"Connections"}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ct,{value:l.search,onChange:l.setSearch,placeholder:"Search for a connection",className:"w-full md:w-[375px]",onKeyDown:g=>{g.key==="Escape"&&(l.setSearch(""),g.target.blur())}}),t.jsx(lt,{sortKey:l.sortKey,sortDirection:l.sortDirection,onSort:l.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"updated_by",label:"Updated by"},{id:"updated_at",label:"Updated"}],filters:[{label:"Type",value:C,onChange:g=>S(g||"ALL"),options:[{id:"ALL",label:"All"},{id:"HTTP",label:"HTTP"},{id:"SSE",label:"SSE"},{id:"Websocket",label:"WebSocket"},{id:"STDIO",label:"STDIO"}]},{label:"Status",value:u,onChange:g=>p(g||"ALL"),options:[{id:"ALL",label:"All"},{id:"active",label:"Active"},{id:"inactive",label:"Inactive"},{id:"error",label:"Error"}]},..._.length>1?[{label:"Registry",value:c,onChange:g=>v(g||"ALL"),options:[{id:"ALL",label:"All registries"},..._.map(g=>({id:g.id,label:g.id.includes("community-registry")?"Community MCP Registry":g.title}))]}]:[]]})]}),W]}),t.jsx(at,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:j,onTabChange:g=>{const N=g;N!==j&&te("connections_page_tab_changed",{to_tab:N}),y(N)}}),t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ae,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx("div",{style:{opacity:D?.5:1,transition:D?"opacity 0.2s 0.2s linear":"opacity 0s 0s linear",pointerEvents:D?"none":"auto"},children:t.jsx(cn,{listState:l,activeTab:j,typeFilter:C,statusFilter:u,registryFilter:c,enabledRegistries:_})})})]})})})]})})}function Qs(){const f=ne.c(1);let e;return f[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ge,{children:t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ae,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(an,{})})}),f[0]=e):e=f[0],e}export{Qs as default};
@@ -1 +1 @@
1
- import"./index-CfAl6qA3.js";import{e as k}from"./backoff-CrEUbyZT.js";const v={STEP:"decopilot.step",FINISH:"decopilot.finish",THREAD_STATUS:"decopilot.thread.status"},h=Object.values(v),R="super-agent",S="task-board.item.updated",b="task-board.item.deleted",N=3e4,g=1e3;function O(n){const{buildUrl:d,eventTypes:u,name:a,crossTab:f=!1}=n,o=new Map,i=f&&typeof BroadcastChannel<"u"&&typeof navigator<"u"&&typeof navigator.locks<"u";if(i&&!a)throw new Error("createSSESubscription: `name` is required when crossTab");function l(e,t){e.bootDone=!0;for(const s of e.handlers)try{s(t)}catch{}}function p(e){for(const t of e.reconnectHandlers)try{t()}catch{}}function E(e){const t=new EventSource(d(e.key));e.es=t,t.onopen=()=>{e.reconnectAttempt=0,e.bootDone&&(p(e),e.channel?.postMessage({kind:"reconnect"})),e.bootDone=!0},t.onerror=()=>{e.es===t&&t.readyState===EventSource.CLOSED&&m(e)};const s=r=>{e.channel?.postMessage({kind:"event",type:r.type,data:r.data}),l(e,r)};for(const r of u)t.addEventListener(r,s)}function m(e){if(e.refCount<=0||e.reconnectTimer)return;const t=k(N,g,e.reconnectAttempt,2,0);e.reconnectAttempt++,e.reconnectTimer=setTimeout(()=>{e.reconnectTimer=null,!(e.refCount<=0||!e.isLeader)&&(e.es?.close(),E(e))},t)}function T(e){if(e.refCount<=0){e.releaseLeadership?.(),e.releaseLeadership=null;return}e.isLeader=!0,E(e)}function L(e){if(!i){T(e);return}e.lockAbort=new AbortController,navigator.locks.request(`sse-leader:${a}:${e.key}`,{signal:e.lockAbort.signal},()=>new Promise(t=>{e.releaseLeadership=t,T(e)})).catch(()=>{})}function w(e,t){t.kind==="event"?l(e,new MessageEvent(t.type,{data:t.data})):t.kind==="reconnect"&&p(e)}function D(e){const t=o.get(e);if(t)return t;const s={key:e,refCount:0,handlers:new Set,reconnectHandlers:new Set,bootDone:!1,es:null,isLeader:!1,reconnectAttempt:0,reconnectTimer:null,channel:null,lockAbort:null,releaseLeadership:null};if(o.set(e,s),i){const r=new BroadcastChannel(`sse:${a}:${e}`);r.onmessage=c=>w(s,c.data),s.channel=r}return L(s),s}function y(e){e.reconnectTimer&&(clearTimeout(e.reconnectTimer),e.reconnectTimer=null),e.es?.close(),e.es=null,e.releaseLeadership?.(),e.releaseLeadership=null,e.lockAbort?.abort(),e.lockAbort=null,e.channel?.close(),e.channel=null,o.delete(e.key)}return{subscribe(e,t,s){const r=D(e);r.refCount++,r.handlers.add(t),s&&r.reconnectHandlers.add(s);let c=!1;return()=>{c||(c=!0,r.handlers.delete(t),s&&r.reconnectHandlers.delete(s),r.refCount--,r.refCount<=0&&y(r))}}}}function A(n,d){const u=new Set(d);return{subscribe(a,f,o){const i=l=>{u.has(l.type)&&f(l)};return n.subscribe(a,i,o)}}}const _=[...h,S,b],M=_,P=_,C=O({name:"watch",buildUrl:n=>`/api/${encodeURIComponent(n)}/watch?types=${M.join(",")}`,eventTypes:P,crossTab:!0}),H=A(C,[...h]),U=A(C,[S,b]),V=H;export{v as D,R as S,b as T,V as d,U as t};
1
+ import"./index-D-XSdETh.js";import{e as k}from"./backoff-CrEUbyZT.js";const v={STEP:"decopilot.step",FINISH:"decopilot.finish",THREAD_STATUS:"decopilot.thread.status"},h=Object.values(v),R="super-agent",S="task-board.item.updated",b="task-board.item.deleted",N=3e4,g=1e3;function O(n){const{buildUrl:d,eventTypes:u,name:a,crossTab:f=!1}=n,o=new Map,i=f&&typeof BroadcastChannel<"u"&&typeof navigator<"u"&&typeof navigator.locks<"u";if(i&&!a)throw new Error("createSSESubscription: `name` is required when crossTab");function l(e,t){e.bootDone=!0;for(const s of e.handlers)try{s(t)}catch{}}function p(e){for(const t of e.reconnectHandlers)try{t()}catch{}}function E(e){const t=new EventSource(d(e.key));e.es=t,t.onopen=()=>{e.reconnectAttempt=0,e.bootDone&&(p(e),e.channel?.postMessage({kind:"reconnect"})),e.bootDone=!0},t.onerror=()=>{e.es===t&&t.readyState===EventSource.CLOSED&&m(e)};const s=r=>{e.channel?.postMessage({kind:"event",type:r.type,data:r.data}),l(e,r)};for(const r of u)t.addEventListener(r,s)}function m(e){if(e.refCount<=0||e.reconnectTimer)return;const t=k(N,g,e.reconnectAttempt,2,0);e.reconnectAttempt++,e.reconnectTimer=setTimeout(()=>{e.reconnectTimer=null,!(e.refCount<=0||!e.isLeader)&&(e.es?.close(),E(e))},t)}function T(e){if(e.refCount<=0){e.releaseLeadership?.(),e.releaseLeadership=null;return}e.isLeader=!0,E(e)}function L(e){if(!i){T(e);return}e.lockAbort=new AbortController,navigator.locks.request(`sse-leader:${a}:${e.key}`,{signal:e.lockAbort.signal},()=>new Promise(t=>{e.releaseLeadership=t,T(e)})).catch(()=>{})}function w(e,t){t.kind==="event"?l(e,new MessageEvent(t.type,{data:t.data})):t.kind==="reconnect"&&p(e)}function D(e){const t=o.get(e);if(t)return t;const s={key:e,refCount:0,handlers:new Set,reconnectHandlers:new Set,bootDone:!1,es:null,isLeader:!1,reconnectAttempt:0,reconnectTimer:null,channel:null,lockAbort:null,releaseLeadership:null};if(o.set(e,s),i){const r=new BroadcastChannel(`sse:${a}:${e}`);r.onmessage=c=>w(s,c.data),s.channel=r}return L(s),s}function y(e){e.reconnectTimer&&(clearTimeout(e.reconnectTimer),e.reconnectTimer=null),e.es?.close(),e.es=null,e.releaseLeadership?.(),e.releaseLeadership=null,e.lockAbort?.abort(),e.lockAbort=null,e.channel?.close(),e.channel=null,o.delete(e.key)}return{subscribe(e,t,s){const r=D(e);r.refCount++,r.handlers.add(t),s&&r.reconnectHandlers.add(s);let c=!1;return()=>{c||(c=!0,r.handlers.delete(t),s&&r.reconnectHandlers.delete(s),r.refCount--,r.refCount<=0&&y(r))}}}}function A(n,d){const u=new Set(d);return{subscribe(a,f,o){const i=l=>{u.has(l.type)&&f(l)};return n.subscribe(a,i,o)}}}const _=[...h,S,b],M=_,P=_,C=O({name:"watch",buildUrl:n=>`/api/${encodeURIComponent(n)}/watch?types=${M.join(",")}`,eventTypes:P,crossTab:!0}),H=A(C,[...h]),U=A(C,[S,b]),V=H;export{v as D,R as S,b as T,V as d,U as t};