decocms 2.292.2 → 2.293.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 (238) hide show
  1. package/dist/client/assets/{AlertCircle-De2C9wZC.js → AlertCircle-DnJbX_0w.js} +1 -1
  2. package/dist/client/assets/{ArrowNarrowLeft-bSu4Kz2F.js → ArrowNarrowLeft-M9-X6Sxy.js} +1 -1
  3. package/dist/client/assets/{ArrowUpRight-DT3QLsvt.js → ArrowUpRight-BQK-oA7E.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-BIi7toDZ.js → CheckCircle-BTDGGZJo.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-DmIUGcFl.js → ChevronDown-D098IDk9.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-CIh2nJ4L.js → ChevronRight-DIr3-XeU.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-BYOoc7wr.js → ChevronUp-qt4sL4uC.js} +1 -1
  8. package/dist/client/assets/{Container-BerLGLgK.js → Container-BvdKvtbe.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-CDho1dav.js → DotsVertical-DGFUAKYN.js} +1 -1
  10. package/dist/client/assets/{LinkExternal01-CcTNZj2P.js → LinkExternal01-CS_vTEL0.js} +1 -1
  11. package/dist/client/assets/{Lock01-B-vCOiSg.js → Lock01-DepQhBci.js} +1 -1
  12. package/dist/client/assets/{Palette-CqW3vcqn.js → Palette-SeD4BOqL.js} +1 -1
  13. package/dist/client/assets/{Play-CrdOw1Iv.js → Play-B2WhNMxb.js} +1 -1
  14. package/dist/client/assets/{Plus-Zv0hv0Vg.js → Plus-6a_0gFD5.js} +1 -1
  15. package/dist/client/assets/{RefreshCcw01-COL3SGLi.js → RefreshCcw01-CmGHOB_j.js} +1 -1
  16. package/dist/client/assets/{SearchMd-BjteSZXQ.js → SearchMd-B4RJoOIR.js} +1 -1
  17. package/dist/client/assets/{Settings02-w5kxVqcK.js → Settings02-86F4b3dQ.js} +1 -1
  18. package/dist/client/assets/{Shield01-DodcxEya.js → Shield01-CzaXyqoU.js} +1 -1
  19. package/dist/client/assets/{Star01-BhFELsp4.js → Star01-BsL_E8DX.js} +1 -1
  20. package/dist/client/assets/{Sun-DY_ADcda.js → Sun-CoYtwe4c.js} +1 -1
  21. package/dist/client/assets/{Tool01-B5mm7tYF.js → Tool01-Cxeqfwwz.js} +1 -1
  22. package/dist/client/assets/{Trash01-DuRnWn1E.js → Trash01-Crqeojj8.js} +1 -1
  23. package/dist/client/assets/{User01-CQoJwY3u.js → User01-lfQ-qZIG.js} +1 -1
  24. package/dist/client/assets/{Users03-DfcHW1oz.js → Users03-BEcIfaLP.js} +1 -1
  25. package/dist/client/assets/{X-Bgfd1eh0.js → X-DSm8Y-S-.js} +1 -1
  26. package/dist/client/assets/{XCircle-DUufUsoh.js → XCircle-D0NNu2cU.js} +1 -1
  27. package/dist/client/assets/{XClose-BQJEwJET.js → XClose-8tp9nQPE.js} +1 -1
  28. package/dist/client/assets/{Zap-CDLB-lxK.js → Zap-GnwBp_Qp.js} +1 -1
  29. package/dist/client/assets/{ZapSquare-BFGlmWLE.js → ZapSquare-DgxRVJjy.js} +1 -1
  30. package/dist/client/assets/accordion-CJq3HBrS.js +1 -0
  31. package/dist/client/assets/agent-icon-DxobcFDr.js +1 -0
  32. package/dist/client/assets/agents-list-eEeKypKu.js +1 -0
  33. package/dist/client/assets/ai-providers-D_bgIPsh.js +1 -0
  34. package/dist/client/assets/{alert-dialog-rItivTOb.js → alert-dialog-CscciHzk.js} +2 -2
  35. package/dist/client/assets/{auth-catchall-BGNYNNAk.js → auth-catchall-DZZidYw0.js} +1 -1
  36. package/dist/client/assets/{automation-list-row-lCQuQb2Q.js → automation-list-row-Br_pkbGs.js} +1 -1
  37. package/dist/client/assets/automations-Ch3eQvio.js +1 -0
  38. package/dist/client/assets/{avatar-UVBUP_wG.js → avatar-BQ09Qk0Z.js} +1 -1
  39. package/dist/client/assets/{badge-nX1O9Qf1.js → badge-Clg4Tzdw.js} +1 -1
  40. package/dist/client/assets/brand-context-DZl3n4iE.js +1 -0
  41. package/dist/client/assets/{card-B6kxnNb0.js → card-DUOq7Rl6.js} +1 -1
  42. package/dist/client/assets/chat-context-CfrtTY3a.js +31 -0
  43. package/dist/client/assets/{checkbox-CTi7T5x-.js → checkbox-D2GZcsVt.js} +1 -1
  44. package/dist/client/assets/collection-detail-ChjtG6Ga.js +1 -0
  45. package/dist/client/assets/collection-display-button-BZwsY1Wv.js +1 -0
  46. package/dist/client/assets/{collection-search-BVB_BOr-.js → collection-search-CzSQR8Hb.js} +1 -1
  47. package/dist/client/assets/{collection-search-DHiaU-oT.js → collection-search-DW3g3zGc.js} +1 -1
  48. package/dist/client/assets/{collection-table-wrapper-Cqd6KCzo.js → collection-table-wrapper-B84Op-Zk.js} +1 -1
  49. package/dist/client/assets/{collection-tabs-CczYJtOJ.js → collection-tabs-DVyOXsXh.js} +1 -1
  50. package/dist/client/assets/{collections-Czgjy6V_.js → collections-CzE8C7FB.js} +1 -1
  51. package/dist/client/assets/{command-C1riJax0.js → command-ChcvD0z3.js} +1 -1
  52. package/dist/client/assets/{connection-card-MQF8JSkw.js → connection-card-C2vEoZIt.js} +1 -1
  53. package/dist/client/assets/connection-detail-BGY9VwYa.js +1 -0
  54. package/dist/client/assets/connection-form-helpers-CgA-QNzF.js +1 -0
  55. package/dist/client/assets/connections-DRgi7C4U.js +1 -0
  56. package/dist/client/assets/{constants-CMKJaZow.js → constants-CrD_AMxD.js} +1 -1
  57. package/dist/client/assets/{constants-puxzW8Tt.js → constants-nJzh8CYx.js} +2 -2
  58. package/dist/client/assets/{dialog-CAwNCLeY.js → dialog-CVDAkUpR.js} +1 -1
  59. package/dist/client/assets/domain-settings-ClmaftJG.js +1 -0
  60. package/dist/client/assets/{drawer-Co7qhpAL.js → drawer-CFg3CiQr.js} +1 -1
  61. package/dist/client/assets/dropdown-menu-gP2-wJTw.js +1 -0
  62. package/dist/client/assets/dynamic-plugin-layout-DZA29J1C.js +1 -0
  63. package/dist/client/assets/{empty-state-DIogXxVN.js → empty-state-C2PUUqhT.js} +1 -1
  64. package/dist/client/assets/{empty-state-Bio4MAFs.js → empty-state-CPpC79-7.js} +1 -1
  65. package/dist/client/assets/{extract-connection-data-BFIbyEiI.js → extract-connection-data-5g73Imwy.js} +1 -1
  66. package/dist/client/assets/features-CeA9UMCz.js +1 -0
  67. package/dist/client/assets/form-yPmbpUVF.js +1 -0
  68. package/dist/client/assets/general-CX6-dTKZ.js +1 -0
  69. package/dist/client/assets/index-B3vDeqTk.js +1 -0
  70. package/dist/client/assets/{index-DFoLVe7P.js → index-BYM0cbyk.js} +3 -3
  71. package/dist/client/assets/{index-BiFex3ig.js → index-BdUJIICa.js} +1 -1
  72. package/dist/client/assets/index-BzSFWy5-.js +189 -0
  73. package/dist/client/assets/index-C3hSkh4S.js +1 -0
  74. package/dist/client/assets/index-CXbGCxBV.js +547 -0
  75. package/dist/client/assets/{index-mWgQ602E.js → index-CfanpUI7.js} +3 -3
  76. package/dist/client/assets/{index-BhZeUpb1.js → index-CqrrK0SQ.js} +1 -1
  77. package/dist/client/assets/{index-DcnXzgrr.js → index-CsTWePfc.js} +1 -1
  78. package/dist/client/assets/index-DImBkhtD.js +1 -0
  79. package/dist/client/assets/index-Dbs2wH7N.js +1 -0
  80. package/dist/client/assets/index-DkZMRzTR.js +1 -0
  81. package/dist/client/assets/index-Dkaetwrr.js +142 -0
  82. package/dist/client/assets/{index-DdEYcoGw.js → index-Dlk19fTc.js} +1 -1
  83. package/dist/client/assets/index-b9vWbQjO.js +1 -0
  84. package/dist/client/assets/{index-C4KOdiuW.js → index-gKZjkMnf.js} +26 -26
  85. package/dist/client/assets/{infiniteQueryObserver-DS8PEXT3.js → infiniteQueryObserver-B9PWohpE.js} +1 -1
  86. package/dist/client/assets/{input-DrxCctpM.js → input-Cet4kRAV.js} +1 -1
  87. package/dist/client/assets/{integration-icon-B-ypwxt-.js → integration-icon-BYjt2zM8.js} +1 -1
  88. package/dist/client/assets/{label-qumw5kFa.js → label-CaWfIbuT.js} +1 -1
  89. package/dist/client/assets/layout-BgwHTi9m.js +1 -0
  90. package/dist/client/assets/lean-canvas-recruit-modal-CNtMOKiS.js +116 -0
  91. package/dist/client/assets/{login-zoPe2LeA.js → login-DDBhfkxa.js} +1 -1
  92. package/dist/client/assets/{members-BrCn_crL.js → members-CpZry3vM.js} +1 -1
  93. package/dist/client/assets/{monaco-editor-C80vYwBa.js → monaco-editor-D2GSkzL1.js} +1 -1
  94. package/dist/client/assets/{monitoring-stats-row-DoiRCC4f.js → monitoring-stats-row-B9-AgFrN.js} +1 -1
  95. package/dist/client/assets/{oauth-callback-CNmuoGWl.js → oauth-callback-ZTQDmTMI.js} +1 -1
  96. package/dist/client/assets/{oauth-callback-ai-provider-CsQrJZmR.js → oauth-callback-ai-provider-Gd1uARX2.js} +1 -1
  97. package/dist/client/assets/{onboarding-C7clLSW8.js → onboarding-8fDDt_RN.js} +1 -1
  98. package/dist/client/assets/{org-layout-BmM2YD3_.js → org-layout-Bw77z4Sw.js} +1 -1
  99. package/dist/client/assets/org-plugin-layout-BIXLREf_.js +1 -0
  100. package/dist/client/assets/{task-status-DhB__zcV.js → pair-CSF6pLZy.js} +40 -40
  101. package/dist/client/assets/plugin-empty-state-D452cObw.js +1 -0
  102. package/dist/client/assets/plugin-header-DesRdhcy.js +1 -0
  103. package/dist/client/assets/{plugin-layout-BZBMQxU7.js → plugin-layout-cW34W41Y.js} +1 -1
  104. package/dist/client/assets/{popover-BdnMz9At.js → popover-dpRZqzOJ.js} +1 -1
  105. package/dist/client/assets/profile-AXVJhA8D.js +1 -0
  106. package/dist/client/assets/project-app-view-C0WWCGe_.js +1 -0
  107. package/dist/client/assets/registry-91e7KTfr.js +2 -0
  108. package/dist/client/assets/{registry-layout-DF08kMn2.js → registry-layout-DWruz43b.js} +1 -1
  109. package/dist/client/assets/required-auth-layout-DVgyyuV-.js +1 -0
  110. package/dist/client/assets/{reset-password-KFV68Ks-.js → reset-password-jjqpZRxZ.js} +1 -1
  111. package/dist/client/assets/roles-Bf8vBKyU.js +1 -0
  112. package/dist/client/assets/scroll-area-CH9Vosbx.js +1 -0
  113. package/dist/client/assets/{search-input-CbSuDoZL.js → search-input-BTdLweUR.js} +1 -1
  114. package/dist/client/assets/select-B6R2tTSM.js +1 -0
  115. package/dist/client/assets/{select-model-BLp2y3cG.js → select-model-BMdrDFa3.js} +1 -1
  116. package/dist/client/assets/settings-layout-CnrVmFqe.js +1 -0
  117. package/dist/client/assets/{settings-section-CKsKmGWh.js → settings-section-Z9FmAPIg.js} +1 -1
  118. package/dist/client/assets/shell-layout-DaB5J-du.js +1 -0
  119. package/dist/client/assets/{skeleton-BKGbLlxs.js → skeleton-BhVqr-eG.js} +1 -1
  120. package/dist/client/assets/sso-DZJw-CAn.js +1 -0
  121. package/dist/client/assets/store-D-L6Gt6i.js +1 -0
  122. package/dist/client/assets/store-registry-DdZCk03l.js +2 -0
  123. package/dist/client/assets/{switch-DNv5M4ZB.js → switch-D_DqyrYW.js} +1 -1
  124. package/dist/client/assets/{table-CaLu-Lo8.js → table-D1_6e_tY.js} +1 -1
  125. package/dist/client/assets/{tabs-Ds3m3VsK.js → tabs-Bu_QsdLq.js} +1 -1
  126. package/dist/client/assets/task-status-DKnoaN0K.js +1 -0
  127. package/dist/client/assets/{textarea-D8dnqUDV.js → textarea-BPX5qWaA.js} +1 -1
  128. package/dist/client/assets/{toggle-group-DiaVR0jE.js → toggle-group-BJxlfhsN.js} +1 -1
  129. package/dist/client/assets/tools-list-CjPOU8GA.js +1 -0
  130. package/dist/client/assets/tooltip-DlUl6zVU.js +1 -0
  131. package/dist/client/assets/{types-Cj_XQKsH.js → types-CUVoLk-m.js} +6 -6
  132. package/dist/client/assets/{use-ai-providers-CiKg1J6I.js → use-ai-providers-CKSasQTP.js} +1 -1
  133. package/dist/client/assets/{use-collections-BgcKlAB6.js → use-collections-DKaygmj-.js} +1 -1
  134. package/dist/client/assets/{use-connection-D0OofLda.js → use-connection-DLwIHVYP.js} +1 -1
  135. package/dist/client/assets/{use-copy-DU9Tefqq.js → use-copy-CLL1wnsg.js} +1 -1
  136. package/dist/client/assets/use-create-virtual-mcp-B693GvUD.js +1 -0
  137. package/dist/client/assets/{use-decopilot-events-ClmBUkq4.js → use-decopilot-events-NXGOEGvZ.js} +1 -1
  138. package/dist/client/assets/{use-delete-connection-D8siAEqJ.js → use-delete-connection-DN8HxHVx.js} +1 -1
  139. package/dist/client/assets/{use-infinite-scroll-8BgvLQv0.js → use-infinite-scroll-B32XN73V.js} +1 -1
  140. package/dist/client/assets/{use-list-state-BEoAeszV.js → use-list-state-Cwr5OloB.js} +1 -1
  141. package/dist/client/assets/{use-mcp-tools-D1ScXFUK.js → use-mcp-tools-CyPVbfii.js} +1 -1
  142. package/dist/client/assets/{use-members-BzwLO50s.js → use-members-C8bjIWu8.js} +1 -1
  143. package/dist/client/assets/use-navigate-to-agent-DuF5pNCT.js +1 -0
  144. package/dist/client/assets/{use-org-sso-D0nq7yh3.js → use-org-sso-pbiXxD33.js} +1 -1
  145. package/dist/client/assets/{use-organization-roles-Dl9VoSUw.js → use-organization-roles-7NVaQG9M.js} +1 -1
  146. package/dist/client/assets/{use-organization-settings-C1HGFbFZ.js → use-organization-settings-DpXizr85.js} +1 -1
  147. package/dist/client/assets/{use-registry-connections-DzXuLNdG.js → use-registry-connections-BFqaVIUz.js} +1 -1
  148. package/dist/client/assets/{use-status-sounds-BC_OJyRi.js → use-status-sounds-DVyydX5_.js} +1 -1
  149. package/dist/client/assets/{use-tasks-BtGSWUvO.js → use-tasks-tzb1zUeQ.js} +1 -1
  150. package/dist/client/assets/use-view-mode-D9sT86SW.js +1 -0
  151. package/dist/client/assets/{use-virtual-mcp-D1fXVRo5.js → use-virtual-mcp-SIWEo5E_.js} +1 -1
  152. package/dist/client/assets/useInfiniteQuery-B3rxurAJ.js +1 -0
  153. package/dist/client/assets/useSuspenseInfiniteQuery-KPnhOQU0.js +1 -0
  154. package/dist/client/assets/{user-DAufXs4h.js → user-DxM-AJLw.js} +1 -1
  155. package/dist/client/assets/view-mode-toggle-CussfoqD.js +1 -0
  156. package/dist/client/assets/workflow-a5DJAs_-.js +1 -0
  157. package/dist/client/assets/workflow-detail-DqMXf6Es.js +1 -0
  158. package/dist/client/index.html +1 -1
  159. package/dist/server/cli.js +1 -1
  160. package/package.json +1 -1
  161. package/dist/client/assets/accordion-zVtel299.js +0 -1
  162. package/dist/client/assets/agent-icon-DSfidSus.js +0 -1
  163. package/dist/client/assets/agents-list-vffTTABq.js +0 -1
  164. package/dist/client/assets/ai-providers-t0YXr9kj.js +0 -1
  165. package/dist/client/assets/automations-C7xJbJSO.js +0 -1
  166. package/dist/client/assets/brand-context-7PuYXROc.js +0 -1
  167. package/dist/client/assets/chat-context-KGI8H-cg.js +0 -30
  168. package/dist/client/assets/collection-detail-D_GfRl2U.js +0 -1
  169. package/dist/client/assets/collection-display-button-DtLA-_Qf.js +0 -1
  170. package/dist/client/assets/connection-detail-Kmft9f88.js +0 -1
  171. package/dist/client/assets/connection-form-helpers-DMZ5iUjm.js +0 -1
  172. package/dist/client/assets/connections-Qfmncrnr.js +0 -1
  173. package/dist/client/assets/domain-settings-ZwlKCgS9.js +0 -1
  174. package/dist/client/assets/dropdown-menu-CiJ99ly5.js +0 -1
  175. package/dist/client/assets/dynamic-plugin-layout-SGNBzqAT.js +0 -1
  176. package/dist/client/assets/features-QRbg1n3B.js +0 -1
  177. package/dist/client/assets/form-FdRX5pG1.js +0 -1
  178. package/dist/client/assets/general-Cc1ql58y.js +0 -1
  179. package/dist/client/assets/github-repo-picker-QAmOQiwy.js +0 -116
  180. package/dist/client/assets/index-L8A_STvx.js +0 -1
  181. package/dist/client/assets/index-SoZ9vkB3.js +0 -735
  182. package/dist/client/assets/index-mcaIOSGF.js +0 -1
  183. package/dist/client/assets/layout-BHQW603q.js +0 -1
  184. package/dist/client/assets/org-plugin-layout-Csh0KNUp.js +0 -1
  185. package/dist/client/assets/plugin-empty-state-DxSYI7WM.js +0 -1
  186. package/dist/client/assets/plugin-header-D0WCyAas.js +0 -1
  187. package/dist/client/assets/profile-BZlcE9Y0.js +0 -1
  188. package/dist/client/assets/project-app-view-B8g2l52t.js +0 -1
  189. package/dist/client/assets/registry-oDwGjrMT.js +0 -2
  190. package/dist/client/assets/required-auth-layout-DAzAQKek.js +0 -1
  191. package/dist/client/assets/roles-CMvkTrhY.js +0 -1
  192. package/dist/client/assets/scroll-area-BlUv7zcB.js +0 -142
  193. package/dist/client/assets/select-W23RccQR.js +0 -1
  194. package/dist/client/assets/settings-layout-b1Br3189.js +0 -1
  195. package/dist/client/assets/shell-layout-BUuy9S_L.js +0 -1
  196. package/dist/client/assets/sso-aoLg93_m.js +0 -1
  197. package/dist/client/assets/store-DGgyYg8C.js +0 -1
  198. package/dist/client/assets/store-registry-Dbm0_etm.js +0 -2
  199. package/dist/client/assets/tools-list-CVgYt-8F.js +0 -1
  200. package/dist/client/assets/use-create-virtual-mcp-DAB2T3vN.js +0 -1
  201. package/dist/client/assets/use-mobile-DvmdhkH5.js +0 -1
  202. package/dist/client/assets/use-navigate-to-agent-Dg24R1Fh.js +0 -1
  203. package/dist/client/assets/use-view-mode-BnyE0_EO.js +0 -1
  204. package/dist/client/assets/useInfiniteQuery-H3t_tPfZ.js +0 -1
  205. package/dist/client/assets/useSuspenseInfiniteQuery-BAnABuH7.js +0 -1
  206. package/dist/client/assets/view-mode-toggle-LshbVzEB.js +0 -1
  207. package/dist/client/assets/workflow-Dt2CIq6i.js +0 -1
  208. package/dist/client/assets/workflow-detail-BZ0JnpLY.js +0 -1
  209. package/dist/server/node_modules/pg-int8/LICENSE +0 -13
  210. package/dist/server/node_modules/pg-int8/README.md +0 -16
  211. package/dist/server/node_modules/pg-int8/index.js +0 -100
  212. package/dist/server/node_modules/pg-int8/package.json +0 -24
  213. package/dist/server/node_modules/postgres-array/index.d.ts +0 -4
  214. package/dist/server/node_modules/postgres-array/index.js +0 -97
  215. package/dist/server/node_modules/postgres-array/license +0 -21
  216. package/dist/server/node_modules/postgres-array/package.json +0 -35
  217. package/dist/server/node_modules/postgres-array/readme.md +0 -43
  218. package/dist/server/node_modules/postgres-bytea/index.js +0 -33
  219. package/dist/server/node_modules/postgres-bytea/license +0 -21
  220. package/dist/server/node_modules/postgres-bytea/package.json +0 -34
  221. package/dist/server/node_modules/postgres-bytea/readme.md +0 -34
  222. package/dist/server/node_modules/postgres-date/index.js +0 -116
  223. package/dist/server/node_modules/postgres-date/license +0 -21
  224. package/dist/server/node_modules/postgres-date/package.json +0 -33
  225. package/dist/server/node_modules/postgres-date/readme.md +0 -49
  226. package/dist/server/node_modules/split2/LICENSE +0 -13
  227. package/dist/server/node_modules/split2/README.md +0 -85
  228. package/dist/server/node_modules/split2/bench.js +0 -27
  229. package/dist/server/node_modules/split2/index.js +0 -141
  230. package/dist/server/node_modules/split2/package.json +0 -39
  231. package/dist/server/node_modules/split2/test.js +0 -409
  232. package/dist/server/node_modules/xtend/.jshintrc +0 -30
  233. package/dist/server/node_modules/xtend/LICENSE +0 -20
  234. package/dist/server/node_modules/xtend/README.md +0 -32
  235. package/dist/server/node_modules/xtend/immutable.js +0 -19
  236. package/dist/server/node_modules/xtend/mutable.js +0 -17
  237. package/dist/server/node_modules/xtend/package.json +0 -55
  238. package/dist/server/node_modules/xtend/test.js +0 -103
@@ -1 +0,0 @@
1
- import{v as he,aI as Te,aJ as Ie,y as le,aK as Ae,e as $,j as t,l as ge,B as H,r as G,c as je,s as te,V as De,K as oe,f as Q,aL as ce,u as $e,aM as Pe,E as Oe,g as Me,o as ze,x as Ve,w as Ee,a0 as Ue,aN as Fe,z as q,a1 as Le}from"./index-C4KOdiuW.js";import{g as Re}from"./constants-CMKJaZow.js";import{E as ve}from"./empty-state-Bio4MAFs.js";import{E as Be,c as He,r as We,b as Xe,d as Ge}from"./connection-form-helpers-DMZ5iUjm.js";import{c as Ke,S as qe}from"./index-L8A_STvx.js";import{u as be,T as Qe}from"./tools-list-CVgYt-8F.js";import{u as Je}from"./use-members-BzwLO50s.js";import{A as Ye}from"./avatar-UVBUP_wG.js";import{b as Ne,a as ye,u as Ze}from"./use-connection-D0OofLda.js";import{u as ie,S as et}from"./constants-puxzW8Tt.js";import{b as tt}from"./use-mcp-tools-D1ScXFUK.js";import{g as ae,M as st,a as nt}from"./types-Cj_XQKsH.js";import{b as Y,c as ot,a as Z,T as it,d as at}from"./tabs-Ds3m3VsK.js";import{I as se}from"./integration-icon-B-ypwxt-.js";import{s as rt}from"./Plus-Zv0hv0Vg.js";import{a as _e}from"./Settings02-w5kxVqcK.js";import{s as re}from"./Trash01-DuRnWn1E.js";import{p as lt,o as ct,r as dt,n as mt,s as ut}from"./index-mcaIOSGF.js";import{a as U,b as F,c as R,d as V,e as B,f as xt,F as pt}from"./form-FdRX5pG1.js";import{I as X}from"./input-DrxCctpM.js";import{u as ft,D as ht}from"./use-delete-connection-D8siAEqJ.js";import{V as gt}from"./layout-BHQW603q.js";import{c as jt,C as vt,B as bt,a as Nt,b as yt,d as _t,e as Ct}from"./monitoring-stats-row-DoiRCC4f.js";import{u as St}from"./use-virtual-mcp-D1fXVRo5.js";import{i as Ce}from"./ChevronRight-CIh2nJ4L.js";import{a as Se}from"./Users03-DfcHW1oz.js";import{g as we}from"./connection-slug-eyAPH6o3.js";import{n as wt}from"./ZapSquare-BFGlmWLE.js";import{T as kt,b as Tt}from"./agent-icon-DSfidSus.js";import{b as It}from"./Tool01-B5mm7tYF.js";import{C as At}from"./collection-search-BVB_BOr-.js";import{C as Dt}from"./card-B6kxnNb0.js";import{B as $t}from"./badge-nX1O9Qf1.js";import{c as Pt,d as Ot,e as Mt,D as de}from"./dropdown-menu-CiJ99ly5.js";import{a as me,c as ue,d as xe,S as pe,b as E}from"./select-W23RccQR.js";import{i as zt}from"./CheckCircle-BIi7toDZ.js";import{t as Vt}from"./ChevronDown-DmIUGcFl.js";import{n as Et}from"./Container-BerLGLgK.js";import{s as ee}from"./Star01-BhFELsp4.js";import{a as Ut}from"./RefreshCcw01-COL3SGLi.js";import{s as Ft}from"./XClose-BQJEwJET.js";import"./collections-Czgjy6V_.js";import"./SearchMd-BjteSZXQ.js";import"./index-DdEYcoGw.js";import"./index-BiFex3ig.js";import"./extract-connection-data-BFIbyEiI.js";import"./use-registry-connections-DzXuLNdG.js";import"./use-organization-settings-C1HGFbFZ.js";import"./index-DcnXzgrr.js";import"./popover-BdnMz9At.js";import"./use-mobile-DvmdhkH5.js";import"./use-create-virtual-mcp-DAB2T3vN.js";import"./use-navigate-to-agent-Dg24R1Fh.js";import"./User01-CQoJwY3u.js";import"./use-collections-BgcKlAB6.js";import"./X-Bgfd1eh0.js";import"./label-qumw5kFa.js";import"./alert-dialog-rItivTOb.js";import"./AlertCircle-De2C9wZC.js";import"./ArrowNarrowLeft-bSu4Kz2F.js";import"./XCircle-DUufUsoh.js";import"./ArrowUpRight-DT3QLsvt.js";import"./ChevronUp-BYOoc7wr.js";import"./DotsVertical-CDho1dav.js";import"./Palette-CqW3vcqn.js";import"./LinkExternal01-CcTNZj2P.js";import"./Lock01-B-vCOiSg.js";import"./Sun-DY_ADcda.js";import"./Play-CrdOw1Iv.js";import"./Shield01-DodcxEya.js";import"./Zap-CDLB-lxK.js";const Lt=he({scopes:Ae(le()).describe("List of scopes available"),stateSchema:Te(le(),Ie()).describe("JSON Schema (draft-07) defining the state structure")}),Rt=[{name:"MCP_CONFIGURATION",inputSchema:he({}),outputSchema:Lt}];function Bt(s){const e=$.c(39),{instance:n,onConfigure:i,onAuthenticate:r,onDelete:o}=s;let c;e[0]!==n.id?(c={connectionId:n.id},e[0]=n.id,e[1]=c):c=e[1];const d=be(c),l=!(n.connection_type==="VIRTUAL")&&d.supportsOAuth&&!d.isAuthenticated,u=l?"border-destructive/50 bg-destructive/5":"border-transparent";let p;e[2]!==u?(p=je("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",u),e[2]=u,e[3]=p):p=e[3];let a;e[4]!==n.icon||e[5]!==n.title?(a=t.jsx(se,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=a):a=e[6];let f;e[7]!==n.title?(f=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=f):f=e[8];let h;e[9]!==l?(h=l&&t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}),e[9]=l,e[10]=h):h=e[10];let b;e[11]!==f||e[12]!==h?(b=t.jsxs("div",{className:"flex-1 min-w-0",children:[f,h]}),e[11]=f,e[12]=h,e[13]=b):b=e[13];let j;e[14]!==n||e[15]!==l||e[16]!==r?(j=l&&t.jsx(H,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>r(n),children:"Authorize"}),e[14]=n,e[15]=l,e[16]=r,e[17]=j):j=e[17];let v;e[18]!==n||e[19]!==i?(v=()=>i(n),e[18]=n,e[19]=i,e[20]=v):v=e[20];let S;e[21]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(_e,{size:13}),e[21]=S):S=e[21];let I;e[22]!==v?(I=t.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:v,title:"Configure",children:S}),e[22]=v,e[23]=I):I=e[23];let N;e[24]!==n||e[25]!==o?(N=()=>o(n),e[24]=n,e[25]=o,e[26]=N):N=e[26];let w;e[27]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(re,{size:13}),e[27]=w):w=e[27];let k;e[28]!==N?(k=t.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:N,title:"Delete",children:w}),e[28]=N,e[29]=k):k=e[29];let _;e[30]!==I||e[31]!==k||e[32]!==j?(_=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[j,I,k]}),e[30]=I,e[31]=k,e[32]=j,e[33]=_):_=e[33];let T;return e[34]!==_||e[35]!==p||e[36]!==a||e[37]!==b?(T=t.jsxs("div",{className:p,children:[a,b,_]}),e[34]=_,e[35]=p,e[36]=a,e[37]=b,e[38]=T):T=e[38],T}function Ht(s){const e=$.c(15),{instance:n,onConfigure:i}=s;let r;e[0]!==n.icon||e[1]!==n.title?(r=t.jsx(se,{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 c;e[5]!==n||e[6]!==i?(c=()=>i(n),e[5]=n,e[6]=i,e[7]=c):c=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(_e,{size:13}),e[8]=d):d=e[8];let m;e[9]!==c?(m=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:c,title:"Configure",children:d})}),e[9]=c,e[10]=m):m=e[10];let l;return e[11]!==r||e[12]!==o||e[13]!==m?(l=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[r,o,m]}),e[11]=r,e[12]=o,e[13]=m,e[14]=l):l=e[14],l}function Wt(s){const e=$.c(25),{instances:n,onConfigure:i,onAuthenticate:r,onDelete:o,onAdd:c,isAdding:d}=s;if(n.length===0)return null;const m=n.length===1?"Instance":"Instances";let l;e[0]!==m?(l=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:m}),e[0]=m,e[1]=l):l=e[1];let u;e[2]!==d?(u=d?t.jsx(ge,{size:13,className:"animate-spin"}):t.jsx(rt,{size:13}),e[2]=d,e[3]=u):u=e[3];let p;e[4]!==d||e[5]!==c||e[6]!==u?(p=t.jsxs(H,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:c,disabled:d,children:[u,"Add instance"]}),e[4]=d,e[5]=c,e[6]=u,e[7]=p):p=e[7];let a;e[8]!==l||e[9]!==p?(a=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[l,p]}),e[8]=l,e[9]=p,e[10]=a):a=e[10];let f;if(e[11]!==n||e[12]!==r||e[13]!==i||e[14]!==o){let j;e[16]!==r||e[17]!==i||e[18]!==o?(j=v=>t.jsx(G.Suspense,{fallback:t.jsx(Ht,{instance:v,onConfigure:i}),children:t.jsx(Bt,{instance:v,onConfigure:i,onAuthenticate:r,onDelete:o})},v.id),e[16]=r,e[17]=i,e[18]=o,e[19]=j):j=e[19],f=n.map(j),e[11]=n,e[12]=r,e[13]=i,e[14]=o,e[15]=f}else f=e[15];let h;e[20]!==f?(h=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:f}),e[20]=f,e[21]=h):h=e[21];let b;return e[22]!==a||e[23]!==h?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[a,h]}),e[22]=a,e[23]=h,e[24]=b):b=e[24],b}const Xt=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function Gt(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 Kt={calls:{label:"Tool calls"},errors:{label:"Errors"}};function qt(s){const e=$.c(3),{connectionId:n,orgId:i,timeframe:r}=s;let o;e[0]!==i?(o={connectionId:et,orgId:i},e[0]=i,e[1]=o):o=e[1];const c=ie(o),d=Gt(r),{data:m}=De({queryKey:oe.connectionActivity(n,r,i),queryFn:async()=>{const f=await c.callTool({name:"MONITORING_LOGS_LIST",arguments:{startDate:d.startDate.toISOString(),endDate:d.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}});return f.structuredContent??f},staleTime:3e5}),l=jt(m?.logs??[],d),u=l.data,p=l.totalCalls>0;let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[2]=a):a=e[2],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()}),a]}),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"})]})]}),p?t.jsxs("div",{children:[t.jsx(vt,{config:Kt,className:"h-16 w-full",children:t.jsxs(bt,{data:u,barCategoryGap:"4%",children:[t.jsx(Nt,{content:t.jsx(yt,{labelFormatter:Jt}),cursor:{fill:"var(--muted)"}}),t.jsx(_t,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:u.map(Qt)})]})}),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"})})]})}function Qt(s,e){return t.jsx(Ct,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function Jt(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function Yt(){const s=$.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 Zt(s){const e=$.c(13),{connectionId:n}=s,[i,r]=G.useState("14d"),{org:o}=te();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=c):c=e[0];let d;e[1]!==i?(d=Xt.map(a=>t.jsx("button",{type:"button",onClick:()=>r(a.value),className:je("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",i===a.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:a.label},a.value)),e[1]=i,e[2]=d):d=e[2];let m;e[3]!==d?(m=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[c,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:d})]}),e[3]=d,e[4]=m):m=e[4];let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Yt,{}),e[5]=l):l=e[5];let u;e[6]!==n||e[7]!==o.id||e[8]!==i?(u=t.jsx(G.Suspense,{fallback:l,children:t.jsx(qt,{connectionId:n,orgId:o.id,timeframe:i})}),e[6]=n,e[7]=o.id,e[8]=i,e[9]=u):u=e[9];let p;return e[10]!==m||e[11]!==u?(p=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[m,u]}),e[10]=m,e[11]=u,e[12]=p):p=e[12],p}function es(s){const e=$.c(15),{virtualMcp:n,org:i}=s,r=Q();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 c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Se,{size:16}),e[4]=c):c=e[4];let d;e[5]!==n.icon||e[6]!==n.title?(d=t.jsx(se,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:c}),e[5]=n.icon,e[6]=n.title,e[7]=d):d=e[7];let m;e[8]!==n.title?(m=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=m):m=e[9];let l;e[10]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Ce,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[10]=l):l=e[10];let u;return e[11]!==o||e[12]!==d||e[13]!==m?(u=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,m,l]}),e[11]=o,e[12]=d,e[13]=m,e[14]=u):u=e[14],u}function ts(s){const e=$.c(7),{virtualMcps:n,org:i}=s;let r;if(e[0]!==i||e[1]!==n){let c;e[3]!==i?(c=d=>t.jsx(es,{virtualMcp:d,org:i},d.id),e[3]=i,e[4]=c):c=e[4],r=n.map(c),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 ss(s){const e=$.c(7),{connection:n}=s,{org:i}=te();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=St(r);if(!(o.length>0)){let l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(t.Fragment,{}),e[2]=l):l=e[2],l}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 m;return e[4]!==i.slug||e[5]!==o?(m=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(ts,{virtualMcps:o,org:i.slug})})]}),e[4]=i.slug,e[5]=o,e[6]=m):m=e[6],m}function ns(s){const e=$.c(30),{tools:n,connectionId:i,org:r}=s,o=Q(),{org:c}=te();let d;e[0]!==i||e[1]!==c.id?(d={connectionId:i,orgId:c.id},e[0]=i,e[1]=c.id,e[2]=d):d=e[2];const m=ie(d),l=Ne(i);let u;e[3]!==l||e[4]!==i?(u=l?we(l):i,e[3]=l,e[4]=i,e[5]=u):u=e[5];const p=u,[a,f]=G.useState("");let h,b,j,v;if(e[6]!==p||e[7]!==m||e[8]!==o||e[9]!==r||e[10]!==a||e[11]!==n){const N=(n??[]).filter(os),w=a.toLowerCase().trim(),k=w?N.filter(g=>g.name.toLowerCase().includes(w)||g.description&&g.description.toLowerCase().includes(w)):N;let _;e[16]!==p||e[17]!==o||e[18]!==r?(_=g=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(g.name)}})},e[16]=p,e[17]=o,e[18]=r,e[19]=_):_=e[19];const T=_;j="flex flex-col h-full overflow-hidden";let y;e[20]===Symbol.for("react.memo_cache_sentinel")?(y=g=>{g.key==="Escape"&&(f(""),g.target.blur())},e[20]=y):y=e[20],e[21]!==a?(v=t.jsx(At,{value:a,onChange:f,placeholder:"Search apps...",onKeyDown:y}),e[21]=a,e[22]=v):v=e[22],h="flex-1 overflow-auto p-5",b=k.length===0?t.jsx(ve,{image:null,title:a?"No apps found":"No apps available",description:a?"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:k.map(g=>{const P=ae(g._meta);return t.jsxs(Dt,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>T(g),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(st,{resourceURI:P,toolInfo:{tool:g},displayMode:"inline",minHeight:200,maxHeight:200,client:m})}),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:g.name}),t.jsx(Qe,{annotations:g.annotations,_meta:g._meta})]}),g.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:g.description})]})]},g.name)})}),e[6]=p,e[7]=m,e[8]=o,e[9]=r,e[10]=a,e[11]=n,e[12]=h,e[13]=b,e[14]=j,e[15]=v}else h=e[12],b=e[13],j=e[14],v=e[15];let S;e[23]!==h||e[24]!==b?(S=t.jsx("div",{className:h,children:b}),e[23]=h,e[24]=b,e[25]=S):S=e[25];let I;return e[26]!==j||e[27]!==v||e[28]!==S?(I=t.jsxs("div",{className:j,children:[v,S]}),e[26]=j,e[27]=v,e[28]=S,e[29]=I):I=e[29],I}function os(s){return!!ae(s._meta)}function ke(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=c=>c.charAt(0).toUpperCase()+c.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 ne(s){const e=$.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 is(s){const e=$.c(50),{tools:n,prompts:i,resources:r,connectionId:o,org:c}=s;let d;e[0]!==i?(d=i===void 0?[]:i,e[0]=i,e[1]=d):d=e[1];const m=d;let l;e[2]!==r?(l=r===void 0?[]:r,e[2]=r,e[3]=l):l=e[3];const u=l,p=Q(),a=Ne(o??"");let f;e[4]!==a||e[5]!==o?(f=a?we(a):o,e[4]=a,e[5]=o,e[6]=f):f=e[6];const h=f;let b;e[7]!==h||e[8]!==o||e[9]!==p||e[10]!==c?(b=function(A){!o||!c||p({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:c,appSlug:h,collectionName:"tools",itemId:encodeURIComponent(A)}})},e[7]=h,e[8]=o,e[9]=p,e[10]=c,e[11]=b):b=e[11];const j=b;let v;e[12]!==o||e[13]!==c||e[14]!==n?(v=o&&c&&n.some(ls),e[12]=o,e[13]=c,e[14]=n,e[15]=v):v=e[15];const S=v;if(n.length+m.length+u.length===0){let C;return e[16]===Symbol.for("react.memo_cache_sentinel")?(C=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]=C):C=e[16],C}let N;e[17]!==n.length?(N=t.jsxs(Y,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=N):N=e[18];let w;e[19]!==S?(w=S&&t.jsx(Y,{value:"apps",variant:"underline",children:"UI"}),e[19]=S,e[20]=w):w=e[20];let k,_;e[21]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(Y,{value:"prompts",variant:"underline",children:"Prompts"}),_=t.jsx(Y,{value:"resources",variant:"underline",children:"Resources"}),e[21]=k,e[22]=_):(k=e[21],_=e[22]);let T;e[23]!==N||e[24]!==w?(T=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(ot,{variant:"underline",className:"gap-1",children:[N,w,k,_]})}),e[23]=N,e[24]=w,e[25]=T):T=e[25];let y;e[26]!==j||e[27]!==n?(y=n.length>0?n.map(C=>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:()=>j(C.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(It,{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:ke(C.name)}),C.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:C.description})]}),t.jsx(Ce,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},C.name)):t.jsx(ne,{label:"tools"}),e[26]=j,e[27]=n,e[28]=y):y=e[28];let g;e[29]!==y?(g=t.jsx(Z,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:y})}),e[29]=y,e[30]=g):g=e[30];let P;e[31]!==o||e[32]!==S||e[33]!==c||e[34]!==n?(P=S&&t.jsx(Z,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(ns,{tools:n,connectionId:o,org:c})}),e[31]=o,e[32]=S,e[33]=c,e[34]=n,e[35]=P):P=e[35];let M;e[36]!==m?(M=m.length>0?m.map(rs):t.jsx(ne,{label:"prompts"}),e[36]=m,e[37]=M):M=e[37];let O;e[38]!==M?(O=t.jsx(Z,{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 D;e[40]!==u?(D=u.length>0?u.map(as):t.jsx(ne,{label:"resources"}),e[40]=u,e[41]=D):D=e[41];let z;e[42]!==D?(z=t.jsx(Z,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:D})}),e[42]=D,e[43]=z):z=e[43];let x;return e[44]!==T||e[45]!==g||e[46]!==P||e[47]!==O||e[48]!==z?(x=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(it,{defaultValue:"tools",variant:"underline",children:[T,g,P,O,z]})}),e[44]=T,e[45]=g,e[46]=P,e[47]=O,e[48]=z,e[49]=x):x=e[49],x}function as(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(kt,{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 rs(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(wt,{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:ke(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 ls(s){return ae(s._meta)}function cs(s){const e=$.c(13),{connection:n,displayTitle:i}=s,r=i??n.title;let o;e[0]!==n.icon||e[1]!==r?(o=t.jsx(se,{icon:n.icon,name:r,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=r,e[2]=o):o=e[2];let c;e[3]!==r?(c=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]=c):c=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 m;e[7]!==c||e[8]!==d?(m=t.jsxs("div",{className:"flex-1 min-w-0",children:[c,d]}),e[7]=c,e[8]=d,e[9]=m):m=e[9];let l;return e[10]!==o||e[11]!==m?(l=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,m]}),e[10]=o,e[11]=m,e[12]=l):l=e[12],l}function ds({form:s,connection:e,hasOAuthToken:n,onReauthenticate:i,onRemoveOAuth:r}){const o=ce({control:s.control,name:"ui_type"}),c=ce({control:s.control,name:"connection_url"}),{stdioEnabled:d}=$e(),m=(()=>{if(typeof c!="string"||!c)return!1;try{const a=new URL(c);return a.hostname==="api.githubcopilot.com"&&a.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),l=d||e.connection_type==="STDIO",u=e.connection_type==="VIRTUAL",p=u?Pe(e.connection_url):null;return u?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(Se,{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(U,{control:s.control,name:"ui_type",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(R,{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:a.value,onValueChange:a.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(ee,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(xe,{})]})}),t.jsxs(pe,{children:[t.jsx(E,{value:"HTTP",children:"HTTP"}),t.jsx(E,{value:"SSE",children:"SSE"}),t.jsx(E,{value:"Websocket",children:"Websocket"}),l&&t.jsxs(t.Fragment,{children:[t.jsx(E,{value:"NPX",children:"NPX Package"}),t.jsx(E,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(U,{control:s.control,name:"connection_url",render:({field:f})=>t.jsx(F,{className:"flex-1 min-w-0",children:t.jsx(V,{children:t.jsx(X,{placeholder:"https://example.com/mcp",...f,value:f.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(me,{value:a.value,onValueChange:a.onChange,children:[t.jsx(V,{children:t.jsx(ue,{className:"h-10",children:t.jsx(xe,{})})}),t.jsxs(pe,{children:[t.jsx(E,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ee,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(E,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ee,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(E,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ee,{className:"w-4 h-4"}),"Websocket"]})}),l&&t.jsxs(t.Fragment,{children:[t.jsx(E,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Et,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(E,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Tt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(B,{})]})}),o==="NPX"&&t.jsx(U,{control:s.control,name:"npx_package",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(R,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(V,{children:t.jsx(X,{placeholder:"@perplexity-ai/mcp-server",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(B,{})]})}),o==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(U,{control:s.control,name:"stdio_command",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(R,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(V,{children:t.jsx(X,{placeholder:"node, bun, python...",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(B,{})]})}),t.jsx(U,{control:s.control,name:"stdio_args",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(R,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(V,{children:t.jsx(X,{placeholder:"arg1 arg2 --flag value",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(B,{})]})})]}),t.jsx(U,{control:s.control,name:"stdio_cwd",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(R,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(V,{children:t.jsx(X,{placeholder:"/path/to/project (optional)",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(B,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(U,{control:s.control,name:"env_vars",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(R,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(V,{children:t.jsx(Be,{value:a.value??[],onChange:a.onChange})}),t.jsx(B,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(U,{control:s.control,name:"connection_token",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(R,{className:"text-xs text-muted-foreground font-medium",children:m?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Pt,{children:[t.jsx(Ot,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs($t,{variant:"success",className:"gap-1.5",children:[t.jsx(zt,{size:12}),"Authenticated via OAuth",t.jsx(Vt,{size:12})]})})}),t.jsxs(Mt,{align:"start",children:[t.jsxs(de,{onClick:i,children:[t.jsx(Ut,{size:16}),"Re-authenticate"]}),t.jsxs(de,{variant:"destructive",onClick:r,children:[t.jsx(re,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&a.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:()=>a.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(Ft,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(X,{type:"password",placeholder:m?"Paste your GitHub PAT":"Enter access token...",...a,value:a.value||"",className:"h-10 rounded-lg"})}),m&&t.jsxs(xt,{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(B,{})]})})]})}function ms(s){return s.command==="npx"}function us(s){return s.args?.find(e=>!e.startsWith("-"))??""}function xs(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"&&Fe(s.connection_headers)){const i=s.connection_headers,r=We(i.envVars);if(ms(i)){const c=us(i);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:c,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const o=xs(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 ps(s){let e,n=null,i=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=Xe(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 fs({connection:s,connectionId:e,org:n,isUpdating:i,tools:r,prompts:o,resources:c,siblings:d}){const m=Q({from:"/$org/settings/connections/$appSlug"}),l=ze(),u=ye(),p=ft({onSuccess:()=>{d.length<=1&&m({to:"/$org/settings/connections",params:{org:n}})}}),[a,f]=G.useState(null),[h,b]=G.useState(!1),j=be({connectionId:e}),{data:v}=Je(),S=v?.data?.members??[],I=a??s,N=S.find(x=>x.userId===I.created_by),k=s?.connection_type==="VIRTUAL"||j.isAuthenticated,_={...s,tools:r},T=Ke(_,Rt),y=Ve({resolver:Ee(He),values:fe(a??s)}),g=y.formState.isDirty,P=async()=>{if(!await y.trigger())return;const C=y.getValues(),A=ps(C),W=a?.id??e;await u.update.mutateAsync({id:W,data:A}),y.reset(C)},M=()=>{y.reset(fe(a??s))},O=async x=>{const{token:C,tokenInfo:A,error:W}=await Le({connectionId:x,scope:"offline_access"});if(W||!C){q.error(`Authentication failed: ${W}`);return}if(A)try{const K=await fetch(`/api/connections/${x}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:A.accessToken,refreshToken:A.refreshToken,expiresIn:A.expiresIn,scope:A.scope,clientId:A.clientId,clientSecret:A.clientSecret,tokenEndpoint:A.tokenEndpoint})});if(!K.ok)console.error("Failed to save OAuth token:",await K.text()),await u.update.mutateAsync({id:x,data:{connection_token:C}});else try{await u.update.mutateAsync({id:x,data:{}})}catch(J){console.warn("Failed to refresh connection tools after OAuth:",J)}}catch(K){console.error("Error saving OAuth token:",K),await u.update.mutateAsync({id:x,data:{connection_token:C}})}else await u.update.mutateAsync({id:x,data:{connection_token:C}});const L=new URL(`/mcp/${x}`,window.location.origin);await l.invalidateQueries({queryKey:oe.isMCPAuthenticated(L.href,null)}),q.success("Authentication successful")},D=()=>O(s.id),z=async()=>{try{const x=await fetch(`/api/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!x.ok){const A=await x.text();q.error(`Failed to remove OAuth: ${A}`);return}const C=new URL(`/mcp/${s.id}`,window.location.origin);await l.invalidateQueries({queryKey:oe.isMCPAuthenticated(C.href,null)}),q.success("OAuth removed. You can now re-authenticate with a different account.")}catch(x){console.error("Error removing OAuth token:",x),q.error("Failed to remove OAuth")}};return t.jsxs(t.Fragment,{children:[t.jsx(ht,{...p}),t.jsx(lt,{open:a!==null,onOpenChange:x=>{x||f(null)},children:t.jsxs(ct,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(dt,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(mt,{className:"text-base",children:a?.title??s.title}),t.jsx(ut,{className:"text-xs",children:"Update URL, authentication, and other settings"}),N&&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(Ye,{url:N.user?.image??void 0,fallback:N.user?.name??N.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:N.user?.name||N.user?.email})]})]}),t.jsxs(pt,{...y,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(U,{control:y.control,name:"title",render:({field:x})=>t.jsxs(F,{children:[t.jsx(R,{children:"Name"}),t.jsx(V,{children:t.jsx(X,{...x})}),t.jsx(B,{})]})}),t.jsx(U,{control:y.control,name:"description",render:({field:x})=>t.jsxs(F,{children:[t.jsx(R,{children:"Description"}),t.jsx(V,{children:t.jsx(X,{...x,value:x.value||""})}),t.jsx(B,{})]})})]}),t.jsx(ds,{form:y,connection:a??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:D,onRemoveOAuth:z}),t.jsx(qe,{connection:a??s,form:y,hasMcpBinding:T,isMCPAuthenticated:k,supportsOAuth:j.supportsOAuth,isServerError:j.isServerError,onAuthenticate:D,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(H,{onClick:P,disabled:!g||i,className:"flex-1",children:i?"Saving…":"Save changes"}),g&&t.jsx(H,{variant:"outline",onClick:M,children:"Undo"}),t.jsxs(H,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const x=a??s;f(null),p.requestDelete(x)},children:[t.jsx(re,{size:15}),"Delete"]})]})]},a?.id??s.id)]})}),t.jsx(gt,{hideHeader:!0,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(cs,{connection:s,displayTitle:(()=>{const x=d[0]??s;return x.app_name?x.title.replace(/\s*\(\d+\)\s*$/,""):x.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(Zt,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(Wt,{instances:d,onConfigure:x=>f(x),onAuthenticate:x=>O(x.id),onDelete:x=>p.requestDelete(x),isAdding:h,onAdd:async()=>{b(!0);try{const x=d[0]??s,C=x.title.replace(/\s*\(\d+\)\s*$/,""),A=d.length+1,W=`${C} (${A})`,L=Re("conn");await u.create.mutateAsync({id:L,title:W,description:x.description??null,connection_type:x.connection_type,connection_url:x.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:x.created_by,organization_id:x.organization_id,icon:x.icon??null,app_name:x.app_name??null,app_id:x.app_id??null,connection_headers:x.connection_headers??null,oauth_config:null,configuration_state:x.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const K=new URL(`/mcp/${L}`,window.location.origin),J=await Ue({url:K.href,token:null});J.supportsOAuth&&!J.isAuthenticated&&await O(L)}finally{b(!1)}}}),t.jsx(ss,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(is,{tools:r,prompts:o,resources:c,connectionId:e,org:n})})]})})]})})]})}function hs(){const s=$.c(38);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/settings/connections/$appSlug"},s[0]=e):e=s[0];const n=Q(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}=Me(i),{org:c}=te(),d=ye();let m;s[2]!==r?(m={slug:r},s[2]=r,s[3]=m):m=s[3];const l=Ze(m),u=l[0]??null,p=u?.id??"",a=p||null;let f;s[4]!==c.id||s[5]!==a?(f={connectionId:a,orgId:c.id},s[4]=c.id,s[5]=a,s[6]=f):f=s[6];const h=ie(f);let b;s[7]!==h?(b={client:h},s[7]=h,s[8]=b):b=s[8];const{data:j}=tt(b);let v;if(s[9]!==u?.tools||s[10]!==p||s[11]!==l||s[12]!==j){const D=j?j.tools.map(ys):(u?.tools??[]).map(Ns);e:{if(l.length<=1){v=D;break e}const z=new Set,x=[],C=vs;for(const A of l){const W=A.id===p?D:C(A.tools);for(const L of W)z.has(L.name)||(z.add(L.name),x.push(L))}v=x.length>0?x:D}s[9]=u?.tools,s[10]=p,s[11]=l,s[12]=j,s[13]=v}else v=s[13];const S=v;let I;s[14]!==h?(I={client:h},s[14]=h,s[15]=I):I=s[15];const{data:N}=at(I);let w;s[16]!==h?(w={client:h},s[16]=h,s[17]=w):w=s[17];const{data:k}=nt(w);let _;s[18]!==N?.prompts?(_=N?.prompts??[],s[18]=N?.prompts,s[19]=_):_=s[19];let T;s[20]!==_?(T=_.map(js),s[20]=_,s[21]=T):T=s[21];const y=T;let g;s[22]!==k?.resources?(g=k?.resources??[],s[22]=k?.resources,s[23]=g):g=s[23];let P;s[24]!==g?(P=g.map(gs),s[24]=g,s[25]=P):P=s[25];const M=P;if(!u){let D;return s[26]!==n||s[27]!==o?(D=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(H,{variant:"outline",onClick:()=>n({to:"/$org/settings/connections",params:{org:o}}),children:"Back to connections"})})}),s[26]=n,s[27]=o,s[28]=D):D=s[28],D}let O;return s[29]!==d.update.isPending||s[30]!==S||s[31]!==u||s[32]!==p||s[33]!==o||s[34]!==y||s[35]!==M||s[36]!==l?(O=t.jsx(fs,{org:o,connection:u,connectionId:p,isUpdating:d.update.isPending,tools:S,prompts:y,resources:M,siblings:l}),s[29]=d.update.isPending,s[30]=S,s[31]=u,s[32]=p,s[33]=o,s[34]=y,s[35]=M,s[36]=l,s[37]=O):O=s[37],O}function gs(s){return{name:s.name,description:s.description,uri:s.uri}}function js(s){return{name:s.name,description:s.description}}function vs(s){return(s??[]).map(bs)}function bs(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ns(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ys(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function _s(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Oe,{children:t.jsx(G.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(hs,{})})}),s[0]=e):e=s[0],e}function Rn(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(_s,{}),s[0]=e):e=s[0],e}export{Rn as default};
@@ -1 +0,0 @@
1
- import{v as R,aI as V,aJ as A,y as a,aK as j,_ as z,e as K,j as u,B as C}from"./index-C4KOdiuW.js";import{I as H}from"./input-DrxCctpM.js";import{s as L}from"./Plus-Zv0hv0Vg.js";import{s as W}from"./Trash01-DuRnWn1E.js";const q=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(q).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=K.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(W,{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(L,{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 +0,0 @@
1
- import{e as ie,j as t,E as Ye,r as W,l as ce,s as _e,f as Se,d as Je,b as be,u as Ze,a2 as et,a3 as tt,x as nt,w as st,B,t as te,o as ot,c as re,z as G,a0 as it,a1 as lt,K as ct}from"./index-C4KOdiuW.js";import{g as rt}from"./constants-CMKJaZow.js";import{C as at}from"./collection-display-button-DtLA-_Qf.js";import{S as dt}from"./search-input-CbSuDoZL.js";import{C as mt}from"./collection-tabs-CczYJtOJ.js";import{u as ut,a as Ne,g as pt,C as fe}from"./connection-card-MQF8JSkw.js";import{E as ht}from"./empty-state-Bio4MAFs.js";import{I as xt}from"./integration-icon-B-ypwxt-.js";import{P as de}from"./index-mcaIOSGF.js";import{u as gt,D as ft}from"./use-delete-connection-D8siAEqJ.js";import{u as jt}from"./use-infinite-scroll-8BgvLQv0.js";import{u as yt}from"./use-list-state-BEoAeszV.js";import{g as ke,a as Ct,e as vt}from"./extract-connection-data-BFIbyEiI.js";import{g as ue}from"./connection-slug-eyAPH6o3.js";import{c as De,d as Ae,b as we,A as Te,e as Ie,g as Pe,a as Le,f as Oe}from"./alert-dialog-rItivTOb.js";import{C as $e}from"./checkbox-CTi7T5x-.js";import{d as Ee,c as ze,a as Fe,D as Me,e as Ve,b as Be}from"./dialog-CAwNCLeY.js";import{c as _t,b as St,D as bt,a as Nt,d as kt,e as Dt,f as At}from"./drawer-Co7qhpAL.js";import{u as wt}from"./use-mobile-DvmdhkH5.js";import{c as Ue,d as Re,e as He,D as pe}from"./dropdown-menu-CiJ99ly5.js";import{a as Q,b as Y,c as J,d as Z,e as ee,F as Ce}from"./form-FdRX5pG1.js";import{I as oe}from"./input-DrxCctpM.js";import{a as Tt,c as It,d as Pt,S as Lt,b as le}from"./select-W23RccQR.js";import{T as Ot}from"./textarea-D8dnqUDV.js";import{a as Ke,u as $t}from"./use-connection-D0OofLda.js";import{u as Et,S as zt}from"./constants-puxzW8Tt.js";import{u as Ft}from"./use-virtual-mcp-D1fXVRo5.js";import{b as Mt,S as Vt}from"./agent-icon-DSfidSus.js";import{n as he}from"./Container-BerLGLgK.js";import{i as We}from"./DotsVertical-CDho1dav.js";import{s as Xe}from"./RefreshCcw01-COL3SGLi.js";import{s as ge}from"./Star01-BhFELsp4.js";import{s as qe}from"./Plus-Zv0hv0Vg.js";import{s as Ge}from"./Trash01-DuRnWn1E.js";import{s as Qe}from"./XClose-BQJEwJET.js";import{i as me,a as ve,E as Bt,c as Ut,p as Rt,b as Ht,d as Kt}from"./connection-form-helpers-DMZ5iUjm.js";import"./collections-Czgjy6V_.js";import"./ChevronDown-DmIUGcFl.js";import"./view-mode-toggle-LshbVzEB.js";import"./badge-nX1O9Qf1.js";import"./SearchMd-BjteSZXQ.js";import"./use-registry-connections-DzXuLNdG.js";import"./use-organization-settings-C1HGFbFZ.js";import"./useInfiniteQuery-H3t_tPfZ.js";import"./infiniteQueryObserver-DS8PEXT3.js";import"./card-B6kxnNb0.js";import"./X-Bgfd1eh0.js";import"./use-view-mode-BnyE0_EO.js";import"./ChevronRight-CIh2nJ4L.js";import"./label-qumw5kFa.js";import"./ChevronUp-BYOoc7wr.js";import"./use-collections-BgcKlAB6.js";import"./AlertCircle-De2C9wZC.js";import"./Tool01-B5mm7tYF.js";import"./ArrowNarrowLeft-bSu4Kz2F.js";import"./XCircle-DUufUsoh.js";import"./ArrowUpRight-DT3QLsvt.js";import"./ZapSquare-BFGlmWLE.js";import"./Users03-DfcHW1oz.js";import"./CheckCircle-BIi7toDZ.js";import"./Palette-CqW3vcqn.js";import"./LinkExternal01-CcTNZj2P.js";import"./Lock01-B-vCOiSg.js";import"./Sun-DY_ADcda.js";import"./Play-CrdOw1Iv.js";import"./Settings02-w5kxVqcK.js";import"./Shield01-DodcxEya.js";import"./User01-CQoJwY3u.js";import"./Zap-CDLB-lxK.js";function Wt(y){const e=ie.c(51),{group:n,onOpen:g,selectionMode:m,selectedIds:d,onToggleSelect:i}=y;let v;if(e[0]!==n.connections||e[1]!==d){let j;e[3]!==d?(j=U=>d.has(U.id),e[3]=d,e[4]=j):j=e[4],v=n.connections.every(j),e[0]=n.connections,e[1]=d,e[2]=v}else v=e[2];const h=v;let _;if(e[5]!==n.connections||e[6]!==d){let j;e[8]!==d?(j=U=>d.has(U.id),e[8]=d,e[9]=j):j=e[9],_=n.connections.some(j),e[5]=n.connections,e[6]=d,e[7]=_}else _=e[7];const u=_,S=`${n.connections.length} instances`;let x;e[10]!==n.icon||e[11]!==n.title||e[12]!==S?(x={title:n.title,icon:n.icon,description:S},e[10]=n.icon,e[11]=n.title,e[12]=S,e[13]=x):x=e[13];let a;e[14]!==h||e[15]!==n.connections||e[16]!==g||e[17]!==i||e[18]!==d||e[19]!==m?(a=()=>m?(()=>{for(const j of n.connections)h?d.has(j.id)&&i(j.id):d.has(j.id)||i(j.id)})():g(),e[14]=h,e[15]=n.connections,e[16]=g,e[17]=i,e[18]=d,e[19]=m,e[20]=a):a=e[20];const p=m&&h&&"ring-2 ring-primary",f=m&&u&&!h&&"ring-1 ring-primary/50";let k;e[21]!==p||e[22]!==f?(k=re(p,f),e[21]=p,e[22]=f,e[23]=k):k=e[23];let A;e[24]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(he,{}),e[24]=A):A=e[24];let N;e[25]!==h||e[26]!==n.connections||e[27]!==i||e[28]!==d||e[29]!==m||e[30]!==u?(N=m?t.jsx($e,{checked:h?!0:u?"indeterminate":!1,onCheckedChange:()=>{for(const j of n.connections)h?d.has(j.id)&&i(j.id):d.has(j.id)||i(j.id)}}):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[25]=h,e[26]=n.connections,e[27]=i,e[28]=d,e[29]=m,e[30]=u,e[31]=N):N=e[31];const I=m?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100";let s;e[32]!==I?(s=re("overflow-hidden transition-all duration-150 ease-out",I),e[32]=I,e[33]=s):s=e[33];let D;e[34]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx(Re,{asChild:!0,children:t.jsx(B,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:qt,children:t.jsx(We,{size:20})})}),e[34]=D):D=e[34];let M;e[35]!==g?(M=j=>{j.stopPropagation(),g()},e[35]=g,e[36]=M):M=e[36];let $;e[37]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx(Xe,{size:16}),e[37]=$):$=e[37];let P;e[38]!==M?(P=t.jsxs(Ue,{children:[D,t.jsx(He,{align:"end",onClick:Xt,children:t.jsxs(pe,{onClick:M,children:[$,"Open"]})})]}),e[38]=M,e[39]=P):P=e[39];let T;e[40]!==s||e[41]!==P?(T=t.jsx("div",{className:s,children:P}),e[40]=s,e[41]=P,e[42]=T):T=e[42];let z;e[43]!==N||e[44]!==T?(z=t.jsxs("div",{className:"flex items-center gap-1",children:[N,T]}),e[43]=N,e[44]=T,e[45]=z):z=e[45];let F;return e[46]!==z||e[47]!==x||e[48]!==a||e[49]!==k?(F=t.jsx(t.Fragment,{children:t.jsx(fe,{connection:x,onClick:a,className:k,fallbackIcon:A,headerActionsAlwaysVisible:!0,headerActions:z})}),e[46]=z,e[47]=x,e[48]=a,e[49]=k,e[50]=F):F=e[50],F}function Xt(y){return y.stopPropagation()}function qt(y){return y.stopPropagation()}function Gt(y){const e=ie.c(28),{count:n,total:g,onSelectAll:m,onDeselectAll:d,onDelete:i,onAddToAgent:v,onToggleStatus:h,onCancel:_}=y;if(n===0)return null;let u;e[0]!==n?(u=t.jsxs("div",{className:"text-xs text-muted-foreground pr-1 tabular-nums",children:[n," selected"]}),e[0]=n,e[1]=u):u=e[1];let S;e[2]!==n||e[3]!==d||e[4]!==m||e[5]!==g?(S=n<g?t.jsxs(B,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:m,children:["Select all (",g,")"]}):t.jsx(B,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:d,children:"Clear selection"}),e[2]=n,e[3]=d,e[4]=m,e[5]=g,e[6]=S):S=e[6];let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(qe,{size:13}),e[7]=x):x=e[7];let a;e[8]!==v?(a=t.jsxs(B,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:v,children:[x,"Add to Agent"]}),e[8]=v,e[9]=a):a=e[9];let p;e[10]!==h?(p=t.jsx(B,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>h("active"),children:"Enable"}),e[10]=h,e[11]=p):p=e[11];let f;e[12]!==h?(f=t.jsx(B,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>h("inactive"),children:"Disable"}),e[12]=h,e[13]=f):f=e[13];let k;e[14]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(Ge,{size:13}),e[14]=k):k=e[14];let A;e[15]!==i?(A=t.jsxs(B,{variant:"destructive",size:"sm",className:"h-7 text-xs px-2",onClick:i,children:[k,"Delete"]}),e[15]=i,e[16]=A):A=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(Qe,{size:13}),e[17]=N):N=e[17];let I;e[18]!==_?(I=t.jsx(B,{variant:"ghost",size:"sm",className:"h-7 text-xs px-2",onClick:_,children:N}),e[18]=_,e[19]=I):I=e[19];let s;return e[20]!==u||e[21]!==I||e[22]!==S||e[23]!==a||e[24]!==p||e[25]!==f||e[26]!==A?(s=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:[u,S,a,p,f,A,I]})}),e[20]=u,e[21]=I,e[22]=S,e[23]=a,e[24]=p,e[25]=f,e[26]=A,e[27]=s):s=e[27],s}function Qt(y){const e=ie.c(25),{open:n,onOpenChange:g,agents:m,onConfirm:d}=y,[i,v]=W.useState(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsxs(Fe,{children:[t.jsx(Me,{children:"Add to Agent"}),t.jsx(Ve,{children:"Select an agent to add the selected connections to."})]}),e[0]=h):h=e[0];let _;e[1]!==m||e[2]!==i?(_=m.length===0?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No agents found"}):m.map(N=>t.jsxs("button",{type:"button",onClick:()=>v(N.id),className:re("flex items-center gap-3 w-full rounded-md px-3 py-2 text-left transition-colors",i===N.id?"bg-primary/10 ring-1 ring-primary":"hover:bg-muted/50"),children:[t.jsx(xt,{icon:N.icon,name:N.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:N.title}),N.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:N.description})]})]},N.id)),e[1]=m,e[2]=i,e[3]=_):_=e[3];let u;e[4]!==_?(u=t.jsx("div",{className:"max-h-60 overflow-auto py-2 space-y-1",children:_}),e[4]=_,e[5]=u):u=e[5];let S;e[6]!==g?(S=t.jsx(B,{variant:"outline",onClick:()=>g(!1),children:"Cancel"}),e[6]=g,e[7]=S):S=e[7];const x=!i;let a;e[8]!==d||e[9]!==g||e[10]!==i?(a=()=>{i&&(d(i),g(!1),v(null))},e[8]=d,e[9]=g,e[10]=i,e[11]=a):a=e[11];let p;e[12]!==x||e[13]!==a?(p=t.jsx(B,{disabled:x,onClick:a,children:"Add"}),e[12]=x,e[13]=a,e[14]=p):p=e[14];let f;e[15]!==S||e[16]!==p?(f=t.jsxs(Be,{children:[S,p]}),e[15]=S,e[16]=p,e[17]=f):f=e[17];let k;e[18]!==u||e[19]!==f?(k=t.jsxs(ze,{className:"sm:max-w-[400px]",children:[h,u,f]}),e[18]=u,e[19]=f,e[20]=k):k=e[20];let A;return e[21]!==g||e[22]!==n||e[23]!==k?(A=t.jsx(Ee,{open:n,onOpenChange:g,children:k}),e[21]=g,e[22]=n,e[23]=k,e[24]=A):A=e[24],A}function Yt(y){const e=ie.c(20),{open:n,onOpenChange:g,count:m,onConfirm:d}=y,i=m!==1?"s":"";let v;e[0]!==m||e[1]!==i?(v=t.jsxs(De,{children:["Delete ",m," connection",i,"?"]}),e[0]=m,e[1]=i,e[2]=v):v=e[2];const h=m!==1?"s":"";let _;e[3]!==h?(_=t.jsxs(Ae,{children:["This will permanently delete the selected connection",h,". This action cannot be undone."]}),e[3]=h,e[4]=_):_=e[4];let u;e[5]!==v||e[6]!==_?(u=t.jsxs(we,{children:[v,_]}),e[5]=v,e[6]=_,e[7]=u):u=e[7];let S;e[8]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(Te,{children:"Cancel"}),e[8]=S):S=e[8];const x=m!==1?"s":"";let a;e[9]!==m||e[10]!==d||e[11]!==x?(a=t.jsxs(Ie,{children:[S,t.jsxs(Pe,{onClick:d,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:["Delete ",m," connection",x]})]}),e[9]=m,e[10]=d,e[11]=x,e[12]=a):a=e[12];let p;e[13]!==u||e[14]!==a?(p=t.jsxs(Le,{children:[u,a]}),e[13]=u,e[14]=a,e[15]=p):p=e[15];let f;return e[16]!==g||e[17]!==n||e[18]!==p?(f=t.jsx(Oe,{open:n,onOpenChange:g,children:p}),e[16]=g,e[17]=n,e[18]=p,e[19]=f):f=e[19],f}function Jt(y){return y._registryId?.includes("community-registry")===!0}function Zt(y){const e=ie.c(56),{item:n,allConnections:g,connectedAppNames:m,connectingItemId:d,onNavigateConnected:i,onConnect:v}=y,[h,_]=W.useState(!1),[u,S]=W.useState(null);let x,a;e[0]!==m||e[1]!==n?(x=ke(n)??"",a=m.has(x),e[0]=m,e[1]=n,e[2]=x,e[3]=a):(x=e[2],a=e[3]);const p=a,f=n._meta?.["mcp.mesh"],k=f?.friendlyName||f?.friendly_name||n.server?.title||n.title||n.server?.name||n.name||n.id||"",A=n.server?.description||n.description||null;let N;e[4]!==n.server?.icons?.[0]?.src||e[5]!==n.server?.repository?(N=n.server?.icons?.[0]?.src||Ct(n.server?.repository)||null,e[4]=n.server?.icons?.[0]?.src,e[5]=n.server?.repository,e[6]=N):N=e[6];const I=N;let s;if(e[7]!==g||e[8]!==x){let b;e[10]!==x?(b=se=>se.connection_type!=="VIRTUAL"&&se.app_name===x,e[10]=x,e[11]=b):b=e[11],s=g.filter(b),e[7]=g,e[8]=x,e[9]=s}else s=e[9];const D=s;let M;e[12]!==n?(M=Jt(n),e[12]=n,e[13]=M):M=e[13];const $=M;let P,T;e[14]!==D||e[15]!==$||e[16]!==p||e[17]!==n||e[18]!==v||e[19]!==i?(P=()=>{if(p){const b=D[0];b&&i(b);return}T()},T=()=>{$?(S("connect"),_(!0)):v(n)},e[14]=D,e[15]=$,e[16]=p,e[17]=n,e[18]=v,e[19]=i,e[20]=P,e[21]=T):(P=e[20],T=e[21]);let z;e[22]!==n||e[23]!==v||e[24]!==u?(z=()=>{te("connections_community_warning_confirmed",{registry_item_id:n.id}),_(!1),u==="connect"&&v(n),S(null)},e[22]=n,e[23]=v,e[24]=u,e[25]=z):z=e[25];const F=z;let j;e[26]!==A||e[27]!==I||e[28]!==k?(j={title:k,description:A,icon:I},e[26]=A,e[27]=I,e[28]=k,e[29]=j):j=e[29];let U;e[30]===Symbol.for("react.memo_cache_sentinel")?(U=t.jsx(he,{}),e[30]=U):U=e[30];let R;e[31]!==$||e[32]!==n._sourceIcon?(R=$&&n._sourceIcon&&t.jsx("img",{src:n._sourceIcon,alt:"Community",className:"size-4 rounded-sm object-contain"}),e[31]=$,e[32]=n._sourceIcon,e[33]=R):R=e[33];let X;e[34]!==d||e[35]!==T||e[36]!==p||e[37]!==n.id?(X=p?t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}):t.jsx(B,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:d!==null,onClick:b=>{b.stopPropagation(),T()},children:d===n.id?t.jsx(ce,{size:14,className:"animate-spin"}):"Connect"}),e[34]=d,e[35]=T,e[36]=p,e[37]=n.id,e[38]=X):X=e[38];let o;e[39]!==R||e[40]!==X?(o=t.jsxs("div",{className:"flex items-center gap-2",children:[R,X]}),e[39]=R,e[40]=X,e[41]=o):o=e[41];let C;e[42]!==P||e[43]!==o||e[44]!==j?(C=t.jsx(fe,{connection:j,fallbackIcon:U,onClick:P,headerActionsAlwaysVisible:!0,headerActions:o}),e[42]=P,e[43]=o,e[44]=j,e[45]=C):C=e[45];let V;e[46]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsxs(we,{children:[t.jsx(De,{children:"Community MCP Server"}),t.jsx(Ae,{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[46]=V):V=e[46];let H;e[47]===Symbol.for("react.memo_cache_sentinel")?(H=t.jsx(Te,{children:"Cancel"}),e[47]=H):H=e[47];let E;e[48]!==F?(E=t.jsxs(Le,{children:[V,t.jsxs(Ie,{children:[H,t.jsx(Pe,{onClick:F,children:"Continue"})]})]}),e[48]=F,e[49]=E):E=e[49];let l;e[50]!==h||e[51]!==E?(l=t.jsx(Oe,{open:h,onOpenChange:_,children:E}),e[50]=h,e[51]=E,e[52]=l):l=e[52];let O;return e[53]!==C||e[54]!==l?(O=t.jsxs(t.Fragment,{children:[C,l]}),e[53]=C,e[54]=l,e[55]=O):O=e[55],O}function en({listState:y,activeTab:e,typeFilter:n,statusFilter:g,registryFilter:m,enabledRegistries:d}){const{org:i}=_e(),v=ot(),h=Se(),{data:_}=be.useSession(),u=Ke(),S=$t(y),x=gt(),[a,p]=W.useState(new Set),f=a.size>0,[k,A]=W.useState(!1),[N,I]=W.useState(!1),[s,D]=W.useState(null),M=Ft(),$=S.filter(c=>!(n!=="ALL"&&c.connection_type!==n||g!=="ALL"&&c.status!==g)),P=pt($),T=c=>{p(r=>{const w=new Set(r);return w.has(c)?w.delete(c):w.add(c),w})},z=()=>{p(new Set)},F=Ne(d,y.searchTerm),j=F.items,U=jt(F.loadMore,F.hasMore,F.isLoadingMore),R=new Set(S.filter(c=>c.app_name).map(c=>c.app_name)),X=m==="ALL"||d.some(c=>c.id===m)?m:"ALL",o=y.search.length>0,C=e==="all"||o?j.filter(c=>{if(X!=="ALL"&&c._registryId!==X)return!1;if(o){const r=ke(c);if(r&&R.has(r))return!1}return!0}):[],V=e==="connected"||o?P:[],H=async c=>{if(!(!i||!_?.user?.id)){te("connection_add_clicked",{action:"connect_new",registry_item_id:c.id,source:"connections_page"}),D(c.id);try{const r=vt(c,i.id,_.user.id,{remoteIndex:0}),w=r.connection_type==="STDIO",L=!!r.connection_url,q=w&&r.connection_headers&&typeof r.connection_headers=="object"&&"command"in r.connection_headers;if(!L&&!q){G.error("This MCP Server cannot be connected: no connection method available"),D(null);return}const{id:K}=await u.create.mutateAsync(r),je=new URL(`/mcp/${K}`,window.location.origin),ye=await it({url:je.href,token:null});if(ye.supportsOAuth&&!ye.isAuthenticated){const{token:ae,tokenInfo:ne,error:xe}=await lt({connectionId:K,scope:"offline_access"});if(xe||!ae){te("connection_oauth_failed",{connection_id:K,flow:"connections_page_connect",error:xe??"no_token"}),G.error(`Authentication failed: ${xe??"no token received"}`);return}else{if(te("connection_oauth_succeeded",{connection_id:K,flow:"connections_page_connect"}),ne)try{(await fetch(`/api/connections/${K}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:ne.accessToken,refreshToken:ne.refreshToken,expiresIn:ne.expiresIn,scope:ne.scope,clientId:ne.clientId,clientSecret:ne.clientSecret,tokenEndpoint:ne.tokenEndpoint})})).ok?await u.update.mutateAsync({id:K,data:{}}):await u.update.mutateAsync({id:K,data:{connection_token:ae}})}catch{await u.update.mutateAsync({id:K,data:{connection_token:ae}})}else await u.update.mutateAsync({id:K,data:{connection_token:ae}});await v.invalidateQueries({queryKey:ct.isMCPAuthenticated(je.href,null)}),G.success("Authentication successful")}}G.success("Connected successfully")}catch(r){G.error(`Failed to connect: ${r instanceof Error?r.message:String(r)}`)}finally{D(null)}}},E=Et({connectionId:zt,orgId:i.id}),l=()=>{v.invalidateQueries({predicate:c=>{const r=c.queryKey;return r[1]===i.id&&r[3]==="collection"&&r[4]==="CONNECTIONS"}})},O=async()=>{A(!1);const c=[...a];te("connections_bulk_delete",{count:c.length});let r=0;for(const w of c)try{(await E.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:w,force:!0}})).isError||r++}catch{}l(),G.success(`Deleted ${r} connection${r!==1?"s":""}`),z()},b=async c=>{const r=[...a];te("connections_bulk_status_toggled",{count:r.length,to_status:c});let w=0;for(const L of r)try{await u.update.mutateAsync({id:L,data:{status:c}}),w++}catch{}l(),G.success(`${c==="active"?"Enabled":"Disabled"} ${w} connection${w!==1?"s":""}`),z()},se=async c=>{const r=M.find(q=>q.id===c);if(!r||!E)return;te("connections_bulk_add_to_agent",{agent_id:c,count:a.size});const w=new Set(r.connections.map(q=>q.connection_id)),L=[...a].filter(q=>!w.has(q)).map(q=>({connection_id:q,selected_tools:null,selected_resources:null,selected_prompts:null}));if(L.length===0){G.info("All selected connections are already in that agent");return}try{await E.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:c,data:{connections:[...r.connections,...L]}}}),v.invalidateQueries({predicate:q=>{const K=q.queryKey;return K[1]===i.id&&K[3]==="collection"&&K[4]==="VIRTUAL_MCP"}}),G.success(`Added ${L.length} connection${L.length!==1?"s":""} to "${r.title}"`),z()}catch{G.error("Failed to add connections to agent")}};return t.jsxs(t.Fragment,{children:[t.jsx(ft,{...x}),t.jsx(Yt,{open:k,onOpenChange:A,count:a.size,onConfirm:O}),t.jsx(Qt,{open:N,onOpenChange:I,agents:M,onConfirm:se}),F.isInitialLoading&&e==="all"?t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ce,{size:32,className:"animate-spin text-muted-foreground"})}):t.jsx("div",{children:(o?C.length===0&&$.length===0:e==="all"?C.length===0:$.length===0)?t.jsx(ht,{image:t.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:"No Connections found",description:y.search?`No Connections match "${y.search}"`:"Create a connection to get started."}):t.jsxs("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:[V.map(c=>{if(c.type==="group")return t.jsx(Wt,{group:c,onOpen:()=>{h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:c.key}})},selectionMode:f,selectedIds:a,onToggleSelect:T},c.key);const r=c.connection,w=a.has(r.id);return t.jsx(fe,{connection:r,fallbackIcon:t.jsx(he,{}),onClick:()=>f?T(r.id):h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:ue(r)}}),className:re(w&&"ring-2 ring-primary bg-primary/5"),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1",children:[f?t.jsx($e,{checked:w,onCheckedChange:()=>T(r.id),onClick:L=>L.stopPropagation()}):t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsx("div",{className:re("overflow-hidden transition-all duration-150 ease-out",f?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100"),children:t.jsxs(Ue,{children:[t.jsx(Re,{asChild:!0,children:t.jsx(B,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:L=>L.stopPropagation(),children:t.jsx(We,{size:20})})}),t.jsxs(He,{align:"end",onClick:L=>L.stopPropagation(),children:[t.jsxs(pe,{onClick:L=>{L.stopPropagation(),h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:ue(r)}})},children:[t.jsx(Xe,{size:16}),"Open"]}),t.jsxs(pe,{onClick:L=>{L.stopPropagation(),T(r.id)},children:[t.jsx(Vt,{size:16}),"Select"]}),t.jsxs(pe,{variant:"destructive",onClick:L=>{L.stopPropagation(),x.requestDelete(r)},children:[t.jsx(Ge,{size:16}),"Delete"]})]})]})})]})},r.id)}),C.map(c=>t.jsx(Zt,{item:c,allConnections:S,connectedAppNames:R,connectingItemId:s,onNavigateConnected:r=>h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:ue(r)}}),onConnect:H},`catalog-${c._registryId}:${c.id}`)),(e==="all"||o)&&d.length>0&&t.jsx("div",{ref:U,className:"col-span-full h-4"}),(e==="all"||o)&&F.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(ce,{size:24,className:"animate-spin text-muted-foreground"})})]})}),f&&t.jsx(Gt,{count:a.size,total:$.length,onSelectAll:()=>{p(new Set($.map(c=>c.id)))},onDeselectAll:()=>p(new Set),onDelete:()=>A(!0),onAddToAgent:()=>I(!0),onToggleStatus:b,onCancel:z})]})}function tn(){const{org:y}=_e(),e=Se(),n=Je({strict:!1}),{data:g}=be.useSession(),{stdioEnabled:m}=Ze(),d=wt(),i=yt({namespace:y.slug,resource:"connections"}),v=Ke(),[h,_]=et(tt.connectionsTab(y.slug),o=>n.tab==="all"||n.tab==="connected"?n.tab:o??"all"),[u,S]=W.useState("ALL"),[x,a]=W.useState("ALL"),[p,f]=W.useState("ALL"),k=ut(),N=Ne(k,i.searchTerm).items,I=i.search!==i.searchTerm,s=nt({resolver:st(Ut),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),D=s.watch("ui_type"),M=s.watch("connection_url"),$=s.watch("npx_package"),P=me({uiType:D,connectionUrl:M??"",npxPackage:$??""})??ve({uiType:D,connectionUrl:M??"",registryItems:N}),T=n.action==="create",z=()=>{te("connections_custom_dialog_opened",{source:"connections_page"}),e({to:"/$org/settings/connections",params:{org:y.slug},search:{action:"create"}})},F=()=>{e({to:"/$org/settings/connections",params:{org:y.slug},search:{}})},j=async o=>{let C,V=null,H=null,E=null;o.ui_type==="NPX"?(C="STDIO",V="",E=Ht(o.npx_package||"",o.env_vars||[])):o.ui_type==="STDIO"?(C="STDIO",V="",E=Kt(o.stdio_command||"",o.stdio_args||"",o.stdio_cwd,o.env_vars||[])):(C=o.ui_type,V=o.connection_url||"",H=o.connection_token||null);const l=rt("conn");te("connection_custom_created",{connection_type:C,ui_type:o.ui_type}),await v.create.mutateAsync({id:l,title:o.title,description:o.description||null,connection_type:C,connection_url:V,connection_token:H,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:g?.user?.id||"system",organization_id:y.id,icon:o.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"}),F(),s.reset(),e({to:"/$org/settings/connections/$appSlug",params:{org:y.slug,appSlug:ue({app_name:null,connection_url:V,title:o.title,id:l})}})},U=o=>{o||(T&&F(),s.reset())},R=o=>{const C=o.trim();if(!C)return;const V=!!s.formState.dirtyFields.title,H=!!s.formState.dirtyFields.description,E=!!s.formState.dirtyFields.env_vars,l=b=>{if(b&&(!V&&!s.getValues("title").trim()&&b.title&&s.setValue("title",b.title,{shouldDirty:!1}),!H&&!(s.getValues("description")??"").trim()&&b.description&&s.setValue("description",b.description,{shouldDirty:!1}),!E&&b.envVarKeys?.length)){const se=s.getValues("env_vars")??[],c=new Set(se.map(w=>w.key)),r=b.envVarKeys.filter(w=>!c.has(w));r.length>0&&s.setValue("env_vars",[...se,...r.map(w=>({key:w,value:""}))],{shouldDirty:!0})}},O=Rt(C);if(O&&m){s.setValue("ui_type","NPX",{shouldDirty:!0}),s.setValue("npx_package",O.packageName,{shouldDirty:!0}),s.setValue("connection_url","",{shouldDirty:!0}),s.setValue("connection_token",null,{shouldDirty:!0}),l(me({uiType:"NPX",npxPackage:O.packageName}));return}if(C.startsWith("http://")||C.startsWith("https://")){const b=D==="HTTP"||D==="SSE"||D==="Websocket"?D:"HTTP";s.setValue("ui_type",b,{shouldDirty:!0}),s.setValue("connection_url",C,{shouldDirty:!0}),l(me({uiType:b,connectionUrl:C})??ve({uiType:b,connectionUrl:C,registryItems:N}));return}D==="NPX"&&l(me({uiType:"NPX",npxPackage:C}))},X=t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(B,{variant:"outline",onClick:z,children:[t.jsx(qe,{size:14,className:"sm:hidden"}),t.jsx("span",{className:"hidden sm:inline",children:"Custom Connection"})]})});return t.jsx(t.Fragment,{children:t.jsxs(de,{children:[(()=>{const o="Create Connection",C="Create a custom connection in your organization. Fill in the details below.",V=s.formState.isSubmitting?"Saving...":"Create Connection",H=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(Q,{control:s.control,name:"ui_type",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"Type *"}),t.jsxs(Tt,{value:l.value,onValueChange:l.onChange,children:[t.jsx(Z,{children:t.jsx(It,{children:t.jsx(Pt,{})})}),t.jsxs(Lt,{children:[t.jsx(le,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ge,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(le,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ge,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(le,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ge,{className:"w-4 h-4"}),"Websocket"]})}),m&&t.jsxs(t.Fragment,{children:[t.jsx(le,{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(le,{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,{})]})}),D==="NPX"&&t.jsx(Q,{control:s.control,name:"npx_package",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"NPM Package *"}),t.jsx(Z,{children:t.jsx(oe,{placeholder:"@perplexity-ai/mcp-server",...l,value:l.value??"",onPaste:O=>{const b=O.clipboardData.getData("text");b&&(O.preventDefault(),s.setValue("npx_package",b.trim(),{shouldDirty:!0}),R(b))},onBlur:O=>{R(O.target.value),l.onBlur()}})}),t.jsx(ee,{})]})}),D==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(Q,{control:s.control,name:"stdio_command",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"Command *"}),t.jsx(Z,{children:t.jsx(oe,{placeholder:"node, bun, python...",...l,value:l.value??""})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:s.control,name:"stdio_args",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"Arguments"}),t.jsx(Z,{children:t.jsx(oe,{placeholder:"arg1 arg2 --flag value",...l,value:l.value??""})}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:s.control,name:"stdio_cwd",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"Working Directory"}),t.jsx(Z,{children:t.jsx(oe,{placeholder:"/path/to/project (optional)",...l,value:l.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),t.jsx(ee,{})]})})]}),(D==="NPX"||D==="STDIO")&&t.jsx(Q,{control:s.control,name:"env_vars",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"Environment Variables"}),t.jsx(Z,{children:t.jsx(Bt,{value:l.value??[],onChange:l.onChange})}),t.jsx(ee,{})]})}),D!=="NPX"&&D!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{control:s.control,name:"connection_url",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"URL *"}),t.jsx(Z,{children:t.jsx(oe,{placeholder:"https://example.com/mcp",...l,value:l.value??"",onPaste:O=>{const b=O.clipboardData.getData("text");b&&(O.preventDefault(),s.setValue("connection_url",b.trim(),{shouldDirty:!0}),R(b))},onBlur:O=>{R(O.target.value),l.onBlur()}})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:s.control,name:"connection_token",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:P?.token?.label??"Token (optional)"}),t.jsx(Z,{children:t.jsx(oe,{type:"password",placeholder:P?.token?.placeholder??"Bearer token or API key",...l,value:l.value??""})}),P?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[P.token.helperText,P.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:s.control,name:"title",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"Name *"}),t.jsx(Z,{children:t.jsx(oe,{placeholder:"My Connection",...l})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:s.control,name:"description",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"Description"}),t.jsx(Z,{children:t.jsx(Ot,{placeholder:"A brief description of this connection",rows:3,...l,value:l.value??""})}),t.jsx(ee,{})]})})]}),E=T;return d?t.jsx(_t,{open:E,onOpenChange:U,children:t.jsxs(St,{className:"max-h-[90vh]",children:[t.jsx(bt,{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(Nt,{children:o}),t.jsx(kt,{className:"mt-1",children:C})]}),t.jsx(Dt,{asChild:!0,children:t.jsx(B,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(Qe,{size:16})})})]})}),t.jsx(Ce,{...s,children:t.jsxs("form",{onSubmit:s.handleSubmit(j),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:H}),t.jsx(At,{children:t.jsx(B,{type:"submit",disabled:s.formState.isSubmitting,className:"w-full",children:V})})]})})]})}):t.jsx(Ee,{open:E,onOpenChange:U,children:t.jsxs(ze,{className:"sm:max-w-[525px]",children:[t.jsxs(Fe,{children:[t.jsx(Me,{children:o}),t.jsx(Ve,{children:C})]}),t.jsx(Ce,{...s,children:t.jsxs("form",{onSubmit:s.handleSubmit(j),children:[t.jsx("div",{className:"py-4",children:H}),t.jsxs(Be,{children:[t.jsx(B,{type:"button",variant:"outline",onClick:()=>U(!1),children:"Cancel"}),t.jsx(B,{type:"submit",disabled:s.formState.isSubmitting,className:"min-w-40",children:V})]})]})})]})})})(),t.jsx(de.Content,{children:t.jsx(de.Body,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(de.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(dt,{value:i.search,onChange:i.setSearch,placeholder:"Search for a connection",className:"w-full md:w-[375px]",onKeyDown:o=>{o.key==="Escape"&&(i.setSearch(""),o.target.blur())}}),t.jsx(at,{sortKey:i.sortKey,sortDirection:i.sortDirection,onSort:i.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:u,onChange:o=>S(o||"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:x,onChange:o=>a(o||"ALL"),options:[{id:"ALL",label:"All"},{id:"active",label:"Active"},{id:"inactive",label:"Inactive"},{id:"error",label:"Error"}]},...k.length>1?[{label:"Registry",value:p,onChange:o=>f(o||"ALL"),options:[{id:"ALL",label:"All registries"},...k.map(o=>({id:o.id,label:o.id.includes("community-registry")?"Community MCP Registry":o.title}))]}]:[]]})]}),X]}),t.jsx(mt,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:h,onTabChange:o=>{const C=o;C!==h&&te("connections_page_tab_changed",{to_tab:C}),_(C)}}),t.jsx(W.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ce,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx("div",{style:{opacity:I?.5:1,transition:I?"opacity 0.2s 0.2s linear":"opacity 0s 0s linear",pointerEvents:I?"none":"auto"},children:t.jsx(en,{listState:i,activeTab:h,typeFilter:u,statusFilter:x,registryFilter:p,enabledRegistries:k})})})]})})})]})})}function ys(){const y=ie.c(1);let e;return y[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ye,{children:t.jsx(W.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ce,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(tn,{})})}),y[0]=e):e=y[0],e}export{ys as default};
@@ -1 +0,0 @@
1
- import{e as B,s as U,b as $,o as Y,K as L,n as H,a as k,j as s,B as q,t as p,z}from"./index-C4KOdiuW.js";import{u as M}from"./unwrap-tool-result-BYXdCQMg.js";import{S as V,u as W}from"./constants-puxzW8Tt.js";import{S as X}from"./switch-DNv5M4ZB.js";import{S as ii,a as G,b as P}from"./settings-section-CKsKmGWh.js";function si(){const i=B.c(61),{org:e}=U(),{data:K}=$.useSession(),R=Y();let C;i[0]!==e.id?(C={connectionId:V,orgId:e.id},i[0]=e.id,i[1]=C):C=i[1];const a=W(C);let r;i[2]!==e.id?(r=L.organizationDomain(e.id),i[2]=e.id,i[3]=r):r=i[3];let d;i[4]!==a?(d=async()=>{const t=await a.callTool({name:"ORGANIZATION_DOMAIN_GET",arguments:{}});return M(t)},i[4]=a,i[5]=d):d=i[5];let h;i[6]!==r||i[7]!==d?(h={queryKey:r,queryFn:d},i[6]=r,i[7]=d,i[8]=h):h=i[8];const{data:J,isPending:Z}=H(h),b=K?.user?.email??"";let I;i[9]!==b?(I=b.split("@")[1]?.toLowerCase()??"",i[9]=b,i[10]=I):I=i[10];const o=I,n=J?.domain??null,F=J?.autoJoinEnabled??!1,v=o&&o!==n;let x;i[11]!==e.id||i[12]!==R?(x=()=>R.invalidateQueries({queryKey:L.organizationDomain(e.id)}),i[11]=e.id,i[12]=R,i[13]=x):x=i[13];const l=x;let c;i[14]!==a||i[15]!==o?(c=async()=>{const t=await a.callTool({name:"ORGANIZATION_DOMAIN_SET",arguments:{domain:o,autoJoinEnabled:!1}});return M(t)},i[14]=a,i[15]=o,i[16]=c):c=i[16];let m;i[17]!==l||i[18]!==e.id||i[19]!==o?(m=()=>{p("organization_domain_claimed",{organization_id:e.id,email_domain:o}),l(),z.success("Domain claimed")},i[17]=l,i[18]=e.id,i[19]=o,i[20]=m):m=i[20];let u;i[21]!==e.id||i[22]!==o?(u=t=>{p("organization_domain_claim_failed",{organization_id:e.id,email_domain:o,error:t instanceof Error?t.message:String(t)}),z.error(t instanceof Error?t.message:"Failed to claim domain")},i[21]=e.id,i[22]=o,i[23]=u):u=i[23];let D;i[24]!==c||i[25]!==m||i[26]!==u?(D={mutationFn:c,onSuccess:m,onError:u},i[24]=c,i[25]=m,i[26]=u,i[27]=D):D=i[27];const A=k(D);let g;i[28]!==a?(g=async()=>{const t=await a.callTool({name:"ORGANIZATION_DOMAIN_CLEAR",arguments:{}});return M(t)},i[28]=a,i[29]=g):g=i[29];let f;i[30]!==n||i[31]!==l||i[32]!==e.id?(f=()=>{p("organization_domain_cleared",{organization_id:e.id,email_domain:n}),l(),z.success("Domain removed")},i[30]=n,i[31]=l,i[32]=e.id,i[33]=f):f=i[33];let _;i[34]!==n||i[35]!==e.id?(_=t=>{p("organization_domain_clear_failed",{organization_id:e.id,email_domain:n,error:t instanceof Error?t.message:String(t)}),z.error(t instanceof Error?t.message:"Failed to remove domain")},i[34]=n,i[35]=e.id,i[36]=_):_=i[36];let y;i[37]!==g||i[38]!==f||i[39]!==_?(y={mutationFn:g,onSuccess:f,onError:_},i[37]=g,i[38]=f,i[39]=_,i[40]=y):y=i[40];const N=k(y);let E;i[41]!==a||i[42]!==n||i[43]!==e.id?(E=async t=>{if(!n)return;p("organization_auto_join_toggled",{organization_id:e.id,enabled:t});const Q=await a.callTool({name:"ORGANIZATION_DOMAIN_UPDATE",arguments:{autoJoinEnabled:t}});return M(Q)},i[41]=a,i[42]=n,i[43]=e.id,i[44]=E):E=i[44];let j;i[45]!==l?(j=()=>{l(),z.success("Auto-join setting updated")},i[45]=l,i[46]=j):j=i[46];let S;i[47]!==e.id?(S=t=>{p("organization_auto_join_toggle_failed",{organization_id:e.id,error:t instanceof Error?t.message:String(t)}),z.error(t instanceof Error?t.message:"Failed to update auto-join")},i[47]=e.id,i[48]=S):S=i[48];let w;i[49]!==E||i[50]!==j||i[51]!==S?(w={mutationFn:E,onSuccess:j,onError:S},i[49]=E,i[50]=j,i[51]=S,i[52]=w):w=i[52];const O=k(w);if(Z)return null;let T;return i[53]!==F||i[54]!==v||i[55]!==N||i[56]!==n||i[57]!==A||i[58]!==O||i[59]!==o?(T=s.jsx(ii,{title:"Email domain",children:n?s.jsxs(G,{children:[s.jsx(P,{title:n,description:"Claimed domain",action:s.jsx(q,{variant:"outline",size:"sm",onClick:()=>N.mutate(),disabled:N.isPending,children:"Remove"})}),s.jsx(P,{title:"Auto-join",description:`Users with @${n} emails will automatically join this organization on signup.`,action:s.jsx(X,{checked:F,onCheckedChange:t=>O.mutate(t),disabled:O.isPending})})]}):v?s.jsx(G,{children:s.jsx(P,{title:o,description:"Let new users with matching emails auto-join this org.",action:s.jsx(q,{size:"sm",onClick:()=>A.mutate(),disabled:A.isPending,children:A.isPending?"Claiming...":"Claim domain"})})}):s.jsx(G,{children:s.jsx(P,{title:"No domain detected",description:"Sign in with a corporate email to claim a domain for your organization."})})}),i[53]=F,i[54]=v,i[55]=N,i[56]=n,i[57]=A,i[58]=O,i[59]=o,i[60]=T):T=i[60],T}export{si as D};
@@ -1 +0,0 @@
1
- import{e as c,j as d,dg as f,dh as m,c as u,di as g,dj as x,dk as v,dl as b,dm as h,dn as w,dp as j,dq as N,dr as p,$ as z,ds as _,dt as y}from"./index-C4KOdiuW.js";import{i as $}from"./ChevronDown-DmIUGcFl.js";import{i as D}from"./ChevronRight-CIh2nJ4L.js";import{a as M}from"./DotsVertical-CDho1dav.js";function C(a){const e=c.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=d.jsx(f,{"data-slot":"dropdown-menu",...t}),e[2]=t,e[3]=s):s=e[3],s}function T(a){const e=c.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=d.jsx(m,{"data-slot":"dropdown-menu-trigger",...t}),e[2]=t,e[3]=s):s=e[3],s}function E(a){const e=c.c(10);let t,s,o;e[0]!==a?({className:t,sideOffset:o,...s}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o):(t=e[1],s=e[2],o=e[3]);const n=o===void 0?4:o;let r;e[4]!==t?(r=u("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border p-1 shadow-md",t),e[4]=t,e[5]=r):r=e[5];let i;return e[6]!==s||e[7]!==n||e[8]!==r?(i=d.jsx(x,{children:d.jsx(v,{"data-slot":"dropdown-menu-content",sideOffset:n,className:r,...s})}),e[6]=s,e[7]=n,e[8]=r,e[9]=i):i=e[9],i}function G(a){const e=c.c(12);let t,s,o,n;e[0]!==a?({className:t,inset:s,variant:n,...o}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o,e[4]=n):(t=e[1],s=e[2],o=e[3],n=e[4]);const r=n===void 0?"default":n;let i;e[5]!==t?(i=u("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[5]=t,e[6]=i):i=e[6];let l;return e[7]!==s||e[8]!==o||e[9]!==i||e[10]!==r?(l=d.jsx(g,{"data-slot":"dropdown-menu-item","data-inset":s,"data-variant":r,className:i,...o}),e[7]=s,e[8]=o,e[9]=i,e[10]=r,e[11]=l):l=e[11],l}function L(a){const e=c.c(13);let t,s,o,n;e[0]!==a?({className:o,children:s,checked:t,...n}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o,e[4]=n):(t=e[1],s=e[2],o=e[3],n=e[4]);let r;e[5]!==o?(r=u("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-lg py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=r):r=e[6];let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:d.jsx(p,{children:d.jsx($,{className:"size-4"})})}),e[7]=i):i=e[7];let l;return e[8]!==t||e[9]!==s||e[10]!==n||e[11]!==r?(l=d.jsxs(h,{"data-slot":"dropdown-menu-checkbox-item",className:r,checked:t,...n,children:[i,s]}),e[8]=t,e[9]=s,e[10]=n,e[11]=r,e[12]=l):l=e[12],l}function O(a){const e=c.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=d.jsx(y,{"data-slot":"dropdown-menu-radio-group",...t}),e[2]=t,e[3]=s):s=e[3],s}function q(a){const e=c.c(11);let t,s,o;e[0]!==a?({className:s,children:t,...o}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o):(t=e[1],s=e[2],o=e[3]);let n;e[4]!==s?(n=u("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-lg py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",s),e[4]=s,e[5]=n):n=e[5];let r;e[6]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:d.jsx(p,{children:d.jsx(M,{className:"size-2 fill-current"})})}),e[6]=r):r=e[6];let i;return e[7]!==t||e[8]!==o||e[9]!==n?(i=d.jsxs(_,{"data-slot":"dropdown-menu-radio-item",className:n,...o,children:[r,t]}),e[7]=t,e[8]=o,e[9]=n,e[10]=i):i=e[10],i}function P(a){const e=c.c(10);let t,s,o;e[0]!==a?({className:t,inset:s,...o}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o):(t=e[1],s=e[2],o=e[3]);let n;e[4]!==t?(n=u("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),e[4]=t,e[5]=n):n=e[5];let r;return e[6]!==s||e[7]!==o||e[8]!==n?(r=d.jsx(b,{"data-slot":"dropdown-menu-label","data-inset":s,className:n,...o}),e[6]=s,e[7]=o,e[8]=n,e[9]=r):r=e[9],r}function A(a){const e=c.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=u("bg-border -mx-1 my-1 h-px",t),e[3]=t,e[4]=o):o=e[4];let n;return e[5]!==s||e[6]!==o?(n=d.jsx(w,{"data-slot":"dropdown-menu-separator",className:o,...s}),e[5]=s,e[6]=o,e[7]=n):n=e[7],n}function B(a){const e=c.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=d.jsx(j,{"data-slot":"dropdown-menu-sub",...t}),e[2]=t,e[3]=s):s=e[3],s}function F(a){const e=c.c(13);let t,s,o,n;e[0]!==a?({className:s,inset:o,children:t,...n}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o,e[4]=n):(t=e[1],s=e[2],o=e[3],n=e[4]);let r;e[5]!==s?(r=u("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-lg px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",s),e[5]=s,e[6]=r):r=e[6];let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(D,{className:"ml-auto size-4"}),e[7]=i):i=e[7];let l;return e[8]!==t||e[9]!==o||e[10]!==n||e[11]!==r?(l=d.jsxs(z,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:r,...n,children:[t,i]}),e[8]=t,e[9]=o,e[10]=n,e[11]=r,e[12]=l):l=e[12],l}function H(a){const e=c.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=u("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",t),e[3]=t,e[4]=o):o=e[4];let n;return e[5]!==s||e[6]!==o?(n=d.jsx(N,{"data-slot":"dropdown-menu-sub-content",className:o,...s}),e[5]=s,e[6]=o,e[7]=n):n=e[7],n}export{G as D,B as a,H as b,C as c,T as d,E as e,F as f,q as g,O as h,A as i,P as j,L as k};
@@ -1 +0,0 @@
1
- import{e as d,g as l,bM as p,j as s,O as u}from"./index-C4KOdiuW.js";import{P as c}from"./plugin-layout-BZBMQxU7.js";import"./use-connection-D0OofLda.js";import"./use-collections-BgcKlAB6.js";import"./constants-puxzW8Tt.js";import"./Settings02-w5kxVqcK.js";import"./index-mcaIOSGF.js";import"./use-mobile-DvmdhkH5.js";import"./X-Bgfd1eh0.js";function N(){const e=d.c(10);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/$taskId/$pluginId"},e[0]=n):n=e[0];const{pluginId:m}=l(n);let i;e[1]!==m?(i=p.find(r=>r.id===m),e[1]=m,e[2]=i):i=e[2];const t=i;if(t?.renderHeader&&t?.renderEmptyState&&t?.bindingName){let r;return e[3]!==t.bindingName||e[4]!==t.renderEmptyState||e[5]!==t.renderHeader?(r=s.jsx(c,{bindingName:t.bindingName,renderHeader:t.renderHeader,renderEmptyState:t.renderEmptyState}),e[3]=t.bindingName,e[4]=t.renderEmptyState,e[5]=t.renderHeader,e[6]=r):r=e[6],r}const o=t?.LayoutComponent;if(!o){let r;return e[7]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(u,{}),e[7]=r):r=e[7],r}let a;return e[8]!==o?(a=s.jsx(o,{}),e[8]=o,e[9]=a):a=e[9],a}export{N as default};
@@ -1 +0,0 @@
1
- import{e as b,s as k,o as E,bM as P,j as i,a6 as K,aG as _,K as S,z as q}from"./index-C4KOdiuW.js";import{P as j}from"./index-mcaIOSGF.js";import{d as z}from"./use-organization-settings-C1HGFbFZ.js";import{S as I}from"./switch-DNv5M4ZB.js";import{n as Q}from"./Container-BerLGLgK.js";import{b as R,S as w,a as F,d as M}from"./settings-section-CKsKmGWh.js";import"./use-mobile-DvmdhkH5.js";import"./X-Bgfd1eh0.js";import"./constants-puxzW8Tt.js";import"./card-B6kxnNb0.js";import"./ArrowUpRight-DT3QLsvt.js";function N(){const e=b.c(17),{org:t,project:s}=k(),o=E();let u;e[0]!==s.enabledPlugins?(u=s.enabledPlugins??[],e[0]=s.enabledPlugins,e[1]=u):u=e[1];const a=u,l=z();let m;e[2]!==t||e[3]!==s.slug||e[4]!==o?(m=()=>{o.invalidateQueries({queryKey:S.project(t.id,s.slug)}),o.invalidateQueries({queryKey:S.projects(t.id)}),o.invalidateQueries({predicate:n=>{const r=n.queryKey;return r[1]===t.id&&r[3]==="collection"&&r[4]==="VIRTUAL_MCP"}})},e[2]=t,e[3]=s.slug,e[4]=o,e[5]=m):m=e[5];const x=m;let g;e[6]!==x||e[7]!==l||e[8]!==a?(g=(n,r)=>{const d=new Set(a);r?d.add(n):d.delete(n),l.mutate({enabled_plugins:Array.from(d)},{onSuccess:x,onError:A})},e[6]=x,e[7]=l,e[8]=a,e[9]=g):g=e[9];const p=g,y=$,C=U;if(P.length===0){let n;return e[10]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins available."}),e[10]=n):n=e[10],n}let c;e[11]!==p||e[12]!==l||e[13]!==a?(c=P.map(n=>{const r=y(n.id),d=C(n.id),h=a.includes(n.id);return i.jsx(R,{title:r?.label??n.id,description:d??void 0,icon:i.jsx("span",{className:"text-muted-foreground [&>svg]:size-4",children:r?.icon??i.jsx(Q,{size:14})}),onClick:()=>!l.isPending&&p(n.id,!h),action:i.jsx(I,{checked:h,onCheckedChange:v=>p(n.id,v),disabled:l.isPending,onClick:T})},n.id)}),e[11]=p,e[12]=l,e[13]=a,e[14]=c):c=e[14];let f;return e[15]!==c?(f=i.jsx(w,{children:i.jsx(F,{children:c})}),e[15]=c,e[16]=f):f=e[16],f}function T(e){return e.stopPropagation()}function U(e){return P.find(s=>s.id===e)?.description??null}function $(e){const t=K.find(o=>o.pluginId===e);if(t)return{label:t.label,icon:t.items[0]?.icon};const s=_.find(o=>o.pluginId===e);return s?{label:s.label,icon:s.icon}:null}function A(e){q.error("Failed to update plugin: "+(e instanceof Error?e.message:"Unknown error"))}function D(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=i.jsx(j,{children:i.jsx(j.Content,{children:i.jsx(j.Body,{children:i.jsxs(M,{children:[i.jsx(j.Title,{children:"Plugins"}),i.jsx(N,{})]})})})}),e[0]=t):t=e[0],t}function ee(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=i.jsx(D,{}),e[0]=t):t=e[0],t}export{ee as default};
@@ -1 +0,0 @@
1
- import{bW as b,e as f,j as c,aB as C,r as d,c as p,aY as j,bX as v,bY as h}from"./index-C4KOdiuW.js";import{L as N}from"./label-qumw5kFa.js";const E=b,g=d.createContext({}),M=t=>{const e=f.c(9);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let o;e[2]!==s.name?(o={name:s.name},e[2]=s.name,e[3]=o):o=e[3];let n;e[4]!==s?(n=c.jsx(C,{...s}),e[4]=s,e[5]=n):n=e[5];let r;return e[6]!==o||e[7]!==n?(r=c.jsx(g.Provider,{value:o,children:n}),e[6]=o,e[7]=n,e[8]=r):r=e[8],r},x=()=>{const t=f.c(13),e=d.useContext(g),s=d.useContext($),{getFieldState:o}=v();let n;t[0]!==e.name?(n={name:e.name},t[0]=e.name,t[1]=n):n=t[1];const r=h(n);let a;t[2]!==e.name||t[3]!==r||t[4]!==o?(a=o(e.name,r),t[2]=e.name,t[3]=r,t[4]=o,t[5]=a):a=t[5];const l=a;if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=s,m=`${i}-form-item`,F=`${i}-form-item-description`,I=`${i}-form-item-message`;let u;return t[6]!==e.name||t[7]!==l||t[8]!==i||t[9]!==m||t[10]!==F||t[11]!==I?(u={id:i,name:e.name,formItemId:m,formDescriptionId:F,formMessageId:I,...l},t[6]=e.name,t[7]=l,t[8]=i,t[9]=m,t[10]=F,t[11]=I,t[12]=u):u=t[12],u},$=d.createContext({});function w(t){const e=f.c(13);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const n=d.useId();let r;e[3]!==n?(r={id:n},e[3]=n,e[4]=r):r=e[4];let a;e[5]!==s?(a=p("grid gap-2",s),e[5]=s,e[6]=a):a=e[6];let l;e[7]!==o||e[8]!==a?(l=c.jsx("div",{"data-slot":"form-item",className:a,...o}),e[7]=o,e[8]=a,e[9]=l):l=e[9];let i;return e[10]!==r||e[11]!==l?(i=c.jsx($.Provider,{value:r,children:l}),e[10]=r,e[11]=l,e[12]=i):i=e[12],i}function L(t){const e=f.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:n,formItemId:r}=x(),a=!!n;let l;e[3]!==s?(l=p("text-foreground data-[error=true]:text-destructive",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==r||e[6]!==o||e[7]!==a||e[8]!==l?(i=c.jsx(N,{"data-slot":"form-label","data-error":a,className:l,htmlFor:r,...o}),e[5]=r,e[6]=o,e[7]=a,e[8]=l,e[9]=i):i=e[9],i}function P(t){const e=f.c(7);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];const{error:o,formItemId:n,formDescriptionId:r,formMessageId:a}=x(),l=o?`${r} ${a}`:`${r}`,i=!!o;let m;return e[2]!==n||e[3]!==s||e[4]!==l||e[5]!==i?(m=c.jsx(j,{"data-slot":"form-control",id:n,"aria-describedby":l,"aria-invalid":i,...s}),e[2]=n,e[3]=s,e[4]=l,e[5]=i,e[6]=m):m=e[6],m}function y(t){const e=f.c(9);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{formDescriptionId:n}=x();let r;e[3]!==s?(r=p("text-muted-foreground text-sm",s),e[3]=s,e[4]=r):r=e[4];let a;return e[5]!==n||e[6]!==o||e[7]!==r?(a=c.jsx("p",{"data-slot":"form-description",id:n,className:r,...o}),e[5]=n,e[6]=o,e[7]=r,e[8]=a):a=e[8],a}function R(t){const e=f.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:n,formMessageId:r}=x(),a=n?String(n?.message??""):o.children;if(!a)return null;let l;e[3]!==s?(l=p("text-destructive text-sm",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==a||e[6]!==r||e[7]!==o||e[8]!==l?(i=c.jsx("p",{"data-slot":"form-message",id:r,className:l,...o,children:a}),e[5]=a,e[6]=r,e[7]=o,e[8]=l,e[9]=i):i=e[9],i}export{E as F,M as a,w as b,L as c,P as d,R as e,y as f};
@@ -1 +0,0 @@
1
- import{f as re,s as ce,o as de,r as U,x as me,w as ue,a as fe,t as Y,z as q,K as te,b as ge,j as s,B as H,v as xe,y as Q,e as L,c as pe,aD as he}from"./index-C4KOdiuW.js";import{P as V}from"./index-mcaIOSGF.js";import{A as be}from"./avatar-UVBUP_wG.js";import{I as je}from"./input-DrxCctpM.js";import{S as X,a as Z,b as W,c as ie,d as ve}from"./settings-section-CKsKmGWh.js";import{D as Se}from"./domain-settings-ZwlKCgS9.js";import{u as ye,a as se,D as Ne,c as Ce,S as we,v as _e,K as ze,P as De,d as Pe,C as ke,s as Ae,b as Ie,e as Ee}from"./collection-search-DHiaU-oT.js";import{W as ee,i as Te}from"./constants-puxzW8Tt.js";import{u as le}from"./use-virtual-mcp-D1fXVRo5.js";import{b as Oe,P as Re,a as Fe}from"./popover-BdnMz9At.js";import{S as Le}from"./skeleton-BKGbLlxs.js";import{Q as $e}from"./agent-icon-DSfidSus.js";import{s as Me}from"./Plus-Zv0hv0Vg.js";import{a as ae}from"./Users03-DfcHW1oz.js";import{i as Ke}from"./X-Bgfd1eh0.js";import{I as J}from"./integration-icon-B-ypwxt-.js";import{u as He,c as Ue}from"./use-organization-settings-C1HGFbFZ.js";import"./use-mobile-DvmdhkH5.js";import"./User01-CQoJwY3u.js";import"./card-B6kxnNb0.js";import"./ArrowUpRight-DT3QLsvt.js";import"./unwrap-tool-result-BYXdCQMg.js";import"./switch-DNv5M4ZB.js";import"./SearchMd-BjteSZXQ.js";import"./use-collections-BgcKlAB6.js";import"./AlertCircle-De2C9wZC.js";import"./Tool01-B5mm7tYF.js";import"./XClose-BQJEwJET.js";import"./RefreshCcw01-COL3SGLi.js";import"./ArrowNarrowLeft-bSu4Kz2F.js";import"./XCircle-DUufUsoh.js";import"./ZapSquare-BFGlmWLE.js";import"./CheckCircle-BIi7toDZ.js";import"./ChevronDown-DmIUGcFl.js";import"./ChevronRight-CIh2nJ4L.js";import"./ChevronUp-BYOoc7wr.js";import"./DotsVertical-CDho1dav.js";import"./Container-BerLGLgK.js";import"./Star01-BhFELsp4.js";import"./Palette-CqW3vcqn.js";import"./LinkExternal01-CcTNZj2P.js";import"./Lock01-B-vCOiSg.js";import"./Sun-DY_ADcda.js";import"./Play-CrdOw1Iv.js";import"./Settings02-w5kxVqcK.js";import"./Shield01-DodcxEya.js";import"./Trash01-DuRnWn1E.js";import"./Zap-CDLB-lxK.js";const qe=xe({name:Q().min(1,"Name is required").max(255,"Name is too long"),slug:Q().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:Q().optional()});function Be(t){const e=L.c(13),{value:a,onChange:i,name:f,disabled:l}=t,n=U.useRef(null);let S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S=()=>n.current?.click(),e[0]=S):S=e[0];const _=S;let c;e[1]!==i?(c=z=>{const p=z.target.files?.[0];if(!p)return;if(p.size>2097152){q.error("Image must be smaller than 2MB");return}const b=new FileReader;b.onerror=Ge,b.onloadend=()=>{b.result&&i(b.result),n.current&&(n.current.value="")},b.readAsDataURL(p)},e[1]=i,e[2]=c):c=e[2];const g=c;let o;e[3]!==l||e[4]!==g?(o=s.jsx("input",{ref:n,type:"file",accept:"image/*",onChange:g,className:"hidden",disabled:l}),e[3]=l,e[4]=g,e[5]=o):o=e[5];const u=a||void 0,d=f??"?";let m;e[6]!==u||e[7]!==d?(m=s.jsx(be,{url:u,fallback:d,shape:"square",size:"base"}),e[6]=u,e[7]=d,e[8]=m):m=e[8];let x;return e[9]!==l||e[10]!==o||e[11]!==m?(x=s.jsxs("button",{type:"button",onClick:_,disabled:l,className:"rounded-lg overflow-hidden hover:ring-2 hover:ring-border transition-all disabled:opacity-50","aria-label":"Upload organization logo",children:[o,m]}),e[9]=l,e[10]=o,e[11]=m,e[12]=x):x=e[12],x}function Ge(){return q.error("Failed to read image")}function Ve(){const t=re(),{org:e}=ce(),a=de(),[i,f]=U.useState(!1),l=me({resolver:ue(qe),values:{name:e.name??"",slug:e.slug??"",logo:e.logo??""}}),n=fe({mutationFn:async o=>{const u={name:o.name,slug:o.slug};o.logo&&(u.logo=o.logo);const d=await ge.organization.update({organizationId:e.id,data:u});if(d?.error)throw new Error(d.error.message||"Failed to update organization");return d},onSuccess:o=>{Y("organization_settings_updated",{organization_id:e.id,fields:Object.keys(l.formState.dirtyFields)}),a.invalidateQueries({queryKey:te.organizations()}),a.invalidateQueries({queryKey:te.activeOrganization(e.slug)}),q.success("Organization settings updated successfully"),o?.data?.slug&&o.data.slug!==e.slug&&t({to:"/$org/settings/general",params:{org:o.data.slug}})},onError:o=>{Y("organization_settings_update_failed",{organization_id:e.id,fields:Object.keys(l.formState.dirtyFields),error:o instanceof Error?o.message:String(o)}),q.error(o instanceof Error?o.message:"Failed to update organization")},onSettled:()=>{f(!1)}}),S=o=>{f(!0),n.mutate(o)},_=l.formState.isDirty,c=l.formState.errors,g=typeof window<"u"?`${window.location.host}/`:"";return s.jsx("form",{onSubmit:l.handleSubmit(S),className:"flex flex-col gap-3",children:s.jsx(X,{children:s.jsxs(Z,{children:[s.jsx(W,{title:"Logo",description:"Recommended size is 256x256px",action:s.jsx(Be,{value:l.watch("logo"),onChange:o=>l.setValue("logo",o??"",{shouldDirty:!0}),name:l.watch("name"),disabled:i})}),s.jsx(W,{title:"Name",action:s.jsx(je,{id:"org-name",...l.register("name"),placeholder:"Organization name",disabled:i,className:"w-[280px]"})}),s.jsx(W,{title:"URL",action:s.jsxs("div",{className:"flex items-center w-[280px] rounded-md border border-input bg-input/30 focus-within:ring-2 focus-within:ring-ring/50 overflow-hidden",children:[g&&s.jsx("span",{className:"pl-3 text-sm text-muted-foreground select-none",children:g}),s.jsx("input",{id:"org-slug",...l.register("slug"),placeholder:"my-organization",disabled:i,className:"flex-1 min-w-0 bg-transparent px-2 py-1.5 text-sm text-foreground placeholder:text-muted-foreground/60 outline-none",onChange:o=>{const u=o.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");l.setValue("slug",u,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}})]})}),(c.name||c.slug||c.logo)&&s.jsxs("div",{className:"px-5 pb-3 flex flex-col gap-1",children:[c.name&&s.jsx("p",{className:"text-xs text-destructive",children:c.name.message}),c.slug&&s.jsx("p",{className:"text-xs text-destructive",children:c.slug.message}),c.logo&&s.jsx("p",{className:"text-xs text-destructive",children:c.logo.message})]}),_&&s.jsxs(ie,{children:[s.jsx(H,{type:"button",variant:"outline",size:"sm",onClick:()=>l.reset(),disabled:i,children:"Cancel"}),s.jsx(H,{type:"submit",disabled:i,size:"sm",children:i?"Saving…":"Save"})]})]})})})}const ne=["site-editor","site-diagnostics","ai-image","ai-research"],oe=8;function Qe(t,e,a){const i=e.find(l=>l.id===t);if(i)return{id:i.id,title:i.title,icon:i.icon,kind:"template"};const f=a.find(l=>l.id===t);return f?{id:t,title:f.title,icon:f.icon??null,kind:"custom"}:{id:t,title:t,icon:null,kind:"missing"}}function We(t){const e=L.c(39),{agent:a,onRemove:i}=t;let f;e[0]!==a.id?(f={id:a.id},e[0]=a.id,e[1]=f):f=e[1];const{attributes:l,listeners:n,setNodeRef:S,transform:_,transition:c,isDragging:g}=Pe(f);let o;e[2]!==_?(o=ke.Transform.toString(_),e[2]=_,e[3]=o):o=e[3];const u=g?.5:void 0,d=g?100:void 0;let m;e[4]!==o||e[5]!==u||e[6]!==d||e[7]!==c?(m={transform:o,transition:c,opacity:u,zIndex:d},e[4]=o,e[5]=u,e[6]=d,e[7]=c,e[8]=m):m=e[8];const x=m,z=g&&"shadow-lg";let p;e[9]!==z?(p=pe("flex items-center gap-3 px-3 py-2 rounded-lg border border-border bg-background",z),e[9]=z,e[10]=p):p=e[10];const b=`Drag to reorder ${a.title}`;let D;e[11]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx($e,{size:14}),e[11]=D):D=e[11];let A;e[12]!==l||e[13]!==n||e[14]!==b?(A=s.jsx("button",{type:"button",...l,...n,className:"text-muted-foreground hover:text-foreground cursor-grab active:cursor-grabbing","aria-label":b,children:D}),e[12]=l,e[13]=n,e[14]=b,e[15]=A):A=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(ae,{size:14}),e[16]=y):y=e[16];let C;e[17]!==a.icon||e[18]!==a.title?(C=s.jsx(J,{icon:a.icon,name:a.title,size:"xs",fallbackIcon:y}),e[17]=a.icon,e[18]=a.title,e[19]=C):C=e[19];let j;e[20]!==a.title?(j=s.jsx("span",{className:"text-sm text-foreground truncate",children:a.title}),e[20]=a.title,e[21]=j):j=e[21];const w=a.kind==="template"?"Template":a.kind==="custom"?"Custom agent":"Unavailable";let h;e[22]!==w?(h=s.jsx("span",{className:"text-xs text-muted-foreground",children:w}),e[22]=w,e[23]=h):h=e[23];let v;e[24]!==j||e[25]!==h?(v=s.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[j,h]}),e[24]=j,e[25]=h,e[26]=v):v=e[26];const I=`Remove ${a.title}`;let P;e[27]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(Ke,{size:14}),e[27]=P):P=e[27];let N;e[28]!==i||e[29]!==I?(N=s.jsx("button",{type:"button",onClick:i,className:"text-muted-foreground hover:text-foreground p-1 rounded","aria-label":I,children:P}),e[28]=i,e[29]=I,e[30]=N):N=e[30];let k;return e[31]!==S||e[32]!==x||e[33]!==A||e[34]!==C||e[35]!==v||e[36]!==N||e[37]!==p?(k=s.jsxs("div",{ref:S,style:x,className:p,children:[A,C,v,N]}),e[31]=S,e[32]=x,e[33]=A,e[34]=C,e[35]=v,e[36]=N,e[37]=p,e[38]=k):k=e[38],k}function Ye(t){const e=L.c(48),{selectedIds:a,onAdd:i}=t,[f,l]=U.useState(!1),[n,S]=U.useState(""),_=le();let c;e[0]!==a?(c=new Set(a),e[0]=a,e[1]=c):c=e[1];const g=c;let o,u,d,m,x,z,p,b,D,A,y,C,j;if(e[2]!==_||e[3]!==i||e[4]!==f||e[5]!==n||e[6]!==g){const P=n.toLowerCase();m=ee.filter(r=>!g.has(r.id)&&(!n||r.title.toLowerCase().includes(P)));let N;e[20]!==g?(N=r=>r.id!==null&&!Te(r.id)&&!g.has(r.id),e[20]=g,e[21]=N):N=e[21],d=_.filter(N).filter(r=>!n||r.title.toLowerCase().includes(P));let k;e[22]!==i?(k=r=>{i(r),l(!1),S("")},e[22]=i,e[23]=k):k=e[23];const T=k;u=Oe,C=f,j=l,e[24]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Re,{asChild:!0,children:s.jsxs(H,{type:"button",variant:"outline",size:"sm",children:[s.jsx(Me,{size:14}),"Add agent"]})}),e[24]=x):x=e[24],o=Fe,D="w-[320px] p-0 overflow-hidden",A="start",e[25]!==n?(y=s.jsx(Ee,{value:n,onChange:S,placeholder:"Search agents..."}),e[25]=n,e[26]=y):y=e[26],z="max-h-[320px] overflow-y-auto p-2 flex flex-col gap-3",p=m.length>0&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground px-1",children:"Templates"}),m.map(r=>s.jsxs("button",{type:"button",onClick:()=>T(r.id),className:"flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-accent text-left",children:[s.jsx(J,{icon:r.icon,name:r.title,size:"xs"}),s.jsx("span",{className:"text-sm truncate",children:r.title})]},r.id))]}),b=d.length>0&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground px-1",children:"Custom agents"}),d.map(r=>s.jsxs("button",{type:"button",onClick:()=>T(r.id),className:"flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-accent text-left",children:[s.jsx(J,{icon:r.icon,name:r.title,size:"xs",fallbackIcon:s.jsx(ae,{size:14})}),s.jsx("span",{className:"text-sm truncate",children:r.title})]},r.id))]}),e[2]=_,e[3]=i,e[4]=f,e[5]=n,e[6]=g,e[7]=o,e[8]=u,e[9]=d,e[10]=m,e[11]=x,e[12]=z,e[13]=p,e[14]=b,e[15]=D,e[16]=A,e[17]=y,e[18]=C,e[19]=j}else o=e[7],u=e[8],d=e[9],m=e[10],x=e[11],z=e[12],p=e[13],b=e[14],D=e[15],A=e[16],y=e[17],C=e[18],j=e[19];let w;e[27]!==d||e[28]!==m.length||e[29]!==n?(w=m.length===0&&d.length===0&&s.jsx("div",{className:"text-xs text-muted-foreground text-center py-6",children:n?"No agents found":"All agents are already added"}),e[27]=d,e[28]=m.length,e[29]=n,e[30]=w):w=e[30];let h;e[31]!==w||e[32]!==z||e[33]!==p||e[34]!==b?(h=s.jsxs("div",{className:z,children:[p,b,w]}),e[31]=w,e[32]=z,e[33]=p,e[34]=b,e[35]=h):h=e[35];let v;e[36]!==o||e[37]!==h||e[38]!==D||e[39]!==A||e[40]!==y?(v=s.jsxs(o,{className:D,align:A,children:[y,h]}),e[36]=o,e[37]=h,e[38]=D,e[39]=A,e[40]=y,e[41]=v):v=e[41];let I;return e[42]!==u||e[43]!==x||e[44]!==v||e[45]!==C||e[46]!==j?(I=s.jsxs(u,{open:C,onOpenChange:j,children:[x,v]}),e[42]=u,e[43]=x,e[44]=v,e[45]=C,e[46]=j,e[47]=I):I=e[47],I}function Je(){const t=L.c(61),e=He(),a=le(),i=Ue();let f;t[0]!==e?.ids?(f=e?.ids??[...ne],t[0]=e?.ids,t[1]=f):f=t[1];const l=f,[n,S]=U.useState(l);let _;t[2]!==n||t[3]!==l?(_=n.length!==l.length||n.some((E,O)=>E!==l[O]),t[2]=n,t[3]=l,t[4]=_):_=t[4];const c=_;let g;t[5]===Symbol.for("react.memo_cache_sentinel")?(g={activationConstraint:{distance:5}},t[5]=g):g=t[5];let o;t[6]===Symbol.for("react.memo_cache_sentinel")?(o={coordinateGetter:Ae},t[6]=o):o=t[6];const u=ye(se(De,g),se(ze,o));let d;t[7]!==n?(d=E=>{const{active:O,over:R}=E;if(!R||O.id===R.id)return;const F=n.indexOf(O.id),G=n.indexOf(R.id);F===-1||G===-1||S(Ie([...n],F,G))},t[7]=n,t[8]=d):d=t[8];const m=d;let x;t[9]!==n?(x=E=>{n.includes(E)||S([...n,E])},t[9]=n,t[10]=x):x=t[10];const z=x;let p;t[11]!==n?(p=E=>{S(n.filter(O=>O!==E))},t[11]=n,t[12]=p):p=t[12];const b=p;let D;t[13]===Symbol.for("react.memo_cache_sentinel")?(D=()=>{S([...ne])},t[13]=D):D=t[13];const A=D;let y;t[14]!==n||t[15]!==i?(y=()=>{i.mutate({ids:n},{onSuccess:()=>{Y("default_home_agents_updated",{count:n.length,template_count:n.filter(Ze).length}),q.success("Default home agents updated")},onError:Xe})},t[14]=n,t[15]=i,t[16]=y):y=t[16];const C=y;let j,w,h,v,I,P,N;if(t[17]!==a||t[18]!==n||t[19]!==m||t[20]!==b||t[21]!==u||t[22]!==i.isPending){let E;t[30]!==a?(E=F=>Qe(F,ee,a),t[30]=a,t[31]=E):E=t[31];const O=n.map(E);h=Math.max(0,n.length-oe),w=X,I="Default home agents";let R;t[32]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(he,{size:14}),t[32]=R):R=t[32],t[33]!==i.isPending?(P=s.jsxs(H,{type:"button",variant:"ghost",size:"sm",onClick:A,disabled:i.isPending,children:[R,"Reset defaults"]}),t[33]=i.isPending,t[34]=P):P=t[34],j=Z,N="px-5 py-5 flex flex-col gap-3",v=O.length===0?s.jsx("div",{className:"rounded-lg border border-dashed border-border p-6 text-center text-xs text-muted-foreground",children:'No agents selected. The home view will only show "Create agent".'}):s.jsx(Ne,{sensors:u,collisionDetection:Ce,onDragEnd:m,children:s.jsx(we,{items:n,strategy:_e,children:s.jsx("div",{className:"flex flex-col gap-1.5",children:O.map((F,G)=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[G===oe&&s.jsxs("div",{className:"flex items-center gap-2 px-1 py-1 text-xs text-muted-foreground",children:[s.jsx("div",{className:"flex-1 h-px bg-border"}),s.jsx("span",{children:"Below this line is hidden on the home view"}),s.jsx("div",{className:"flex-1 h-px bg-border"})]}),s.jsx(We,{agent:F,onRemove:()=>b(F.id)})]},F.id))})})}),t[17]=a,t[18]=n,t[19]=m,t[20]=b,t[21]=u,t[22]=i.isPending,t[23]=j,t[24]=w,t[25]=h,t[26]=v,t[27]=I,t[28]=P,t[29]=N}else j=t[23],w=t[24],h=t[25],v=t[26],I=t[27],P=t[28],N=t[29];let k;t[35]!==n||t[36]!==z?(k=s.jsx(Ye,{selectedIds:n,onAdd:z}),t[35]=n,t[36]=z,t[37]=k):k=t[37];let T;t[38]!==h?(T=h>0&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:[h," agent",h===1?"":"s"," won't fit on the home view"]}),t[38]=h,t[39]=T):T=t[39];let r;t[40]!==k||t[41]!==T?(r=s.jsxs("div",{className:"flex items-center justify-between",children:[k,T]}),t[40]=k,t[41]=T,t[42]=r):r=t[42];let $;t[43]!==v||t[44]!==r||t[45]!==N?($=s.jsxs("div",{className:N,children:[v,r]}),t[43]=v,t[44]=r,t[45]=N,t[46]=$):$=t[46];let M;t[47]!==C||t[48]!==l||t[49]!==c||t[50]!==i.isPending?(M=c&&s.jsxs(ie,{children:[s.jsx(H,{type:"button",variant:"outline",onClick:()=>S(l),disabled:i.isPending,children:"Cancel"}),s.jsx(H,{type:"button",onClick:C,disabled:i.isPending,children:i.isPending?"Saving…":"Save"})]}),t[47]=C,t[48]=l,t[49]=c,t[50]=i.isPending,t[51]=M):M=t[51];let K;t[52]!==j||t[53]!==$||t[54]!==M?(K=s.jsxs(j,{children:[$,M]}),t[52]=j,t[53]=$,t[54]=M,t[55]=K):K=t[55];let B;return t[56]!==w||t[57]!==I||t[58]!==P||t[59]!==K?(B=s.jsx(w,{title:I,actions:P,children:K}),t[56]=w,t[57]=I,t[58]=P,t[59]=K,t[60]=B):B=t[60],B}function Xe(t){q.error(t instanceof Error?t.message:"Failed to update default home agents")}function Ze(t){return ee.some(e=>e.id===t)}function et(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(X,{title:"Default home agents",children:s.jsx(Z,{children:s.jsx("div",{className:"px-5 py-5 flex flex-col gap-2",children:Array.from({length:4}).map(tt)})})}),t[0]=e):e=t[0],e}function tt(t,e){return s.jsx(Le,{className:"h-12 w-full rounded-lg"},e)}function st(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(U.Suspense,{fallback:s.jsx(et,{}),children:s.jsx(Je,{})}),t[0]=e):e=t[0],e}function nt(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(V,{children:s.jsx(V.Content,{children:s.jsx(V.Body,{children:s.jsxs(ve,{children:[s.jsx(V.Title,{children:"Organization"}),s.jsx(Ve,{}),s.jsx(Se,{}),s.jsx(st,{})]})})})}),t[0]=e):e=t[0],e}function Xt(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(nt,{}),t[0]=e):e=t[0],e}export{Xt as default};
@@ -1,116 +0,0 @@
1
- import{e as M,s as z,o as ve,b as ze,r as O,K as ne,n as Fe,a as He,j as t,c as he,B as oe,t as V,z as ie,f as We,a0 as Je,a1 as Xe,az as je,C as Ze,l as xe,V as et}from"./index-C4KOdiuW.js";import{S as re,u as $,d as we,W as Be,j as ye}from"./constants-puxzW8Tt.js";import{u as Ne}from"./use-navigate-to-agent-Dg24R1Fh.js";import{c as ce,d as le,a as de,D as ue,b as tt}from"./dialog-CAwNCLeY.js";import{i as Ae}from"./RefreshCcw01-COL3SGLi.js";import{C as qe}from"./collection-search-BVB_BOr-.js";import{c as Ee,b as Se,D as Oe,a as Le}from"./drawer-Co7qhpAL.js";import{u as Re}from"./use-mobile-DvmdhkH5.js";import{I as Me}from"./integration-icon-B-ypwxt-.js";import{a as ke,u as nt}from"./use-connection-D0OofLda.js";import{u as st,d as Qe}from"./use-mcp-tools-D1ScXFUK.js";import{b as Ue,u as it}from"./use-virtual-mcp-D1fXVRo5.js";import{C as ot}from"./checkbox-CTi7T5x-.js";import{i as at}from"./Lock01-B-vCOiSg.js";import{F as rt}from"./agent-icon-DSfidSus.js";import{e as ct}from"./extract-connection-data-BFIbyEiI.js";function lt(i){return i.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function dt(){const i=await fetch("/api/deco-sites");if(!i.ok){const e=await i.json().catch(()=>({}));throw new Error(e.error??`Failed to load sites (${i.status})`)}return i.json()}function Kt(i){const e=M.c(65),{open:n,onOpenChange:a,onBack:c}=i,{org:s}=z(),l=Ne(),m=ve(),{data:f}=ze.useSession(),[x,h]=O.useState(null),[T,d]=O.useState("");let u;e[0]!==s.id?(u={connectionId:re,orgId:s.id},e[0]=s.id,e[1]=u):u=e[1];const p=$(u);let r;e[2]!==f?.user?.email?(r=ne.decoSites(f?.user?.email),e[2]=f?.user?.email,e[3]=r):r=e[3];const g=n&&!!f?.user?.email;let C;e[4]!==r||e[5]!==g?(C={queryKey:r,queryFn:dt,enabled:g,staleTime:6e4,retry:!1},e[4]=r,e[5]=g,e[6]=C):C=e[6];const{data:_,isLoading:N,error:b}=Fe(C),I=_?.sites??[];let o;e[7]!==a?(o=w=>{w||(h(null),d("")),a(w)},e[7]=a,e[8]=o):o=e[8];const y=o;let A;e[9]!==T?(A=w=>w.name.toLowerCase().includes(T.toLowerCase())||w.domains?.[0]?.domain.toLowerCase().includes(T.toLowerCase()),e[9]=T,e[10]=A):A=e[10];const v=I.filter(A),E=!x||v.some(w=>w.name===x);let j;e[11]!==p||e[12]!==s.id?(j=async w=>{V("deco_site_import_started",{site_name:w});const G=await fetch("/api/deco-sites/connection",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:w,orgId:s.id})}),D=await G.json().catch(ft);if(!G.ok)throw new Error(D.error??`Failed to create connection (${G.status})`);const L=D.connId;if(!L)throw new Error("Server did not return a connection ID");const ge=D.icon??null,te=lt(w),Pe=await p.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:w,description:"Imported from deco.cx",pinned:!0,icon:ge??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],ui:{banner:null,bannerColor:"#22C55E",icon:ge,themeColor:"#22C55E",slug:te,pinnedViews:[{connectionId:L,toolName:"file_explorer",label:"Preview",icon:null},{connectionId:L,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:L,toolName:"get_monitor_data",label:"Monitor",icon:null},{connectionId:L,toolName:"list_pull_requests",label:"Pull Requests",icon:null},{connectionId:L,toolName:"list_releases",label:"Releases",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:L,toolName:"file_explorer"}}}},connections:[{connection_id:L}]}}}),Ge=Pe.structuredContent??Pe;return{slug:te,virtualMcpId:Ge.item.id,connId:L,item:Ge.item}},e[11]=p,e[12]=s.id,e[13]=j):j=e[13];let S;e[14]!==p||e[15]!==y||e[16]!==l||e[17]!==s.id||e[18]!==m?(S=w=>{const{slug:G,virtualMcpId:D,item:L}=w;V("deco_site_import_succeeded",{site_name:L.title,virtual_mcp_id:D,slug:G}),m.setQueryData(ne.collectionItem(p,s.id,"","VIRTUAL_MCP",D),{item:L}),m.invalidateQueries({predicate:ge=>{const te=ge.queryKey;return te[1]===s.id&&te[3]==="collection"&&te[4]==="VIRTUAL_MCP"}}),m.invalidateQueries({queryKey:ne.projects(s.id)}),ie.success(`Imported ${G} from deco.cx`),y(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),l(D)},e[14]=p,e[15]=y,e[16]=l,e[17]=s.id,e[18]=m,e[19]=S):S=e[19];let k;e[20]!==j||e[21]!==S?(k={mutationFn:j,onSuccess:S,onError:mt},e[20]=j,e[21]=S,e[22]=k):k=e[22];const U=He(k),F=le,se=ce,R="sm:max-w-[900px] p-0 gap-0 overflow-hidden";let P;e[23]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(de,{className:"sr-only",children:t.jsx(ue,{children:"Import from deco.cx"})}),e[23]=P):P=e[23];let H;e[24]!==c?(H=c&&t.jsx("button",{type:"button",onClick:c,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:t.jsx(Ae,{size:18})}),e[24]=c,e[25]=H):H=e[25];let me;e[26]===Symbol.for("react.memo_cache_sentinel")?(me=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"}),e[26]=me):me=e[26];let B;e[27]!==H?(B=t.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[H,me]}),e[27]=H,e[28]=B):B=e[28];let fe;e[29]===Symbol.for("react.memo_cache_sentinel")?(fe=w=>{w.key==="Escape"&&d("")},e[29]=fe):fe=e[29];let q;e[30]!==T?(q=t.jsx("div",{children:t.jsx(qe,{value:T,onChange:d,placeholder:"Search sites...",onKeyDown:fe})}),e[30]=T,e[31]=q):q=e[31];const Ke="pb-0 min-h-[300px]";let Q;e[32]!==N?(Q=N&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),e[32]=N,e[33]=Q):Q=e[33];const _e=!N&&!b&&I.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),Ce=!N&&I.length>0&&t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[v.length===0&&t.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",T,"”"]}),v.map(w=>{const G=w.domains?.find(ut)?.domain??w.domains?.[0]?.domain,D=x===w.name;return t.jsxs("button",{type:"button",onClick:()=>h(w.name),className:he("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",D?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[t.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:w.thumb_url?t.jsx("img",{src:w.thumb_url,alt:w.name,className:"w-full h-full object-cover",loading:"lazy"}):t.jsx("div",{className:"w-full h-full bg-muted"})}),t.jsxs("div",{className:"px-4 py-3",children:[t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:w.name}),G&&t.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:G})]})]},w.name)})]});let Y;e[34]!==Q||e[35]!==_e||e[36]!==Ce?(Y=t.jsxs("div",{className:Ke,children:[Q,_e,Ce]}),e[34]=Q,e[35]=_e,e[36]=Ce,e[37]=Y):Y=e[37];let K;e[38]!==y?(K=()=>y(!1),e[38]=y,e[39]=K):K=e[39];let W;e[40]!==U.isPending||e[41]!==K?(W=t.jsx(oe,{variant:"outline",onClick:K,disabled:U.isPending,children:"Cancel"}),e[40]=U.isPending,e[41]=K,e[42]=W):W=e[42];const Ie=!x||!E||U.isPending||N;let J;e[43]!==U||e[44]!==x?(J=()=>x&&U.mutate(x),e[43]=U,e[44]=x,e[45]=J):J=e[45];const Te=U.isPending?"Importing...":"Import";let X;e[46]!==Ie||e[47]!==J||e[48]!==Te?(X=t.jsx(oe,{disabled:Ie,onClick:J,children:Te}),e[46]=Ie,e[47]=J,e[48]=Te,e[49]=X):X=e[49];let Z;e[50]!==W||e[51]!==X?(Z=t.jsxs(tt,{className:"px-8 py-5 border-t border-border",children:[W,X]}),e[50]=W,e[51]=X,e[52]=Z):Z=e[52];let ee;e[53]!==se||e[54]!==P||e[55]!==B||e[56]!==q||e[57]!==Y||e[58]!==Z?(ee=t.jsxs(se,{className:R,children:[P,B,q,Y,Z]}),e[53]=se,e[54]=P,e[55]=B,e[56]=q,e[57]=Y,e[58]=Z,e[59]=ee):ee=e[59];let pe;return e[60]!==F||e[61]!==y||e[62]!==n||e[63]!==ee?(pe=t.jsx(F,{open:n,onOpenChange:y,children:ee}),e[60]=F,e[61]=y,e[62]=n,e[63]=ee,e[64]=pe):pe=e[64],pe}function ut(i){return i.production}function mt(i){V("deco_site_import_failed",{error:i instanceof Error?i.message:"Unknown error"}),ie.error("Import failed: "+(i instanceof Error?i.message:"Unknown error"))}function ft(){return{}}function Ye(i,e){const n=M.c(11),{org:a}=z();let c;n[0]!==a.id?(c=we.REGISTRY(a.id),n[0]=a.id,n[1]=c):c=n[1];const s=c;let l;n[2]!==a.id||n[3]!==s?(l={connectionId:s,orgId:a.id},n[2]=a.id,n[3]=s,n[4]=l):l=n[4];const m=$(l);let f;n[5]!==i?(f={name:i},n[5]=i,n[6]=f):f=n[6];const x=e?.enabled??!0;let h;return n[7]!==m||n[8]!==f||n[9]!==x?(h={client:m,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:f,enabled:x,staleTime:3e5,select:pt},n[7]=m,n[8]=f,n[9]=x,n[10]=h):h=n[10],st(h)}function pt(i){return i.structuredContent?.item??null}const gt=["Full HAR capture with cache, TTFB, and request analysis","Screenshot capture for visual inspection","Page discovery via sitemap, navigation, and link crawling","SEO audit — meta tags, structured data, robots.txt","Third-party script inventory and size analysis","Dead link detection across the entire site","Deco-specific diagnostics (?__d debug mode)"];function De(i){const e=M.c(7),{onRecruit:n,isRecruiting:a,isLoading:c}=i;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a blackbox diagnostics agent that tests your storefront from the outside — no internal access needed. Give it a URL and it produces a detailed performance and health report."}),e[0]=s):s=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=l):l=e[1];let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"space-y-2",children:[l,t.jsx("ul",{className:"space-y-1.5",children:gt.map(ht)})]}),e[2]=m):m=e[2];const f=a||c,x=a?"Setting up...":"Add Site Diagnostics";let h;return e[3]!==n||e[4]!==f||e[5]!==x?(h=t.jsxs("div",{className:"flex flex-col gap-6",children:[s,m,t.jsx(oe,{onClick:n,disabled:f,className:"w-full cursor-pointer",children:x})]}),e[3]=n,e[4]=f,e[5]=x,e[6]=h):h=e[6],h}function ht(i){return t.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[t.jsx("span",{className:"text-emerald-500 mt-0.5 shrink-0",children:"+"}),i]},i)}function Wt({open:i,onOpenChange:e,existingAgent:n}){const a=Re(),{org:c}=z(),s=Ne(),l=ke(),m=Ue(),f=$({connectionId:re,orgId:c.id}),x=Qe({client:f}),[h,T]=O.useState(!1),d=Be.find(I=>I.id==="site-diagnostics"),{data:u,isLoading:p}=Ye(d.appId,{enabled:i}),r=u?.title||u?.server?.title||u?.server?.name||d.title,g=u?.server?.icons?.[0]?.src??d.icon,C=u?.server?.description??null,_=t.jsx(Me,{icon:g,name:r,size:"sm"}),N=async()=>{if(u){if(n){e(!1),s(n.id);return}T(!0);try{const I=await x.mutateAsync({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_id"],operator:"eq",value:d.appId},limit:1,offset:0}});let o;const A=I?.structuredContent?.items?.find(E=>E.app_id===d.appId);if(A)o=A.id;else{const E=u.server?.remotes?.[0]?.url;if(!E)throw new Error("Registry item is missing a remote URL for site-diagnostics");o=(await l.create.mutateAsync({title:r,description:C,icon:u.server?.icons?.[0]?.src??d.icon,connection_type:"HTTP",connection_url:E,app_name:u.server?.name??"site-diagnostics",app_id:d.appId,metadata:{type:"site-diagnostics",source:"store",registry_item_id:d.appId,verified:!0}})).id}const v=await m.create.mutateAsync({title:r,description:C,icon:g,status:"active",connections:[{connection_id:o,selected_tools:null,selected_resources:null,selected_prompts:null}],metadata:{type:"site-diagnostics",instructions:null,ui:{pinnedViews:[{connectionId:o,toolName:"diagnose",label:"diagnose",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:o,toolName:"diagnose"}}}}});V("agent_recruit_confirmed",{template_id:"site-diagnostics",agent_id:v.id}),e(!1),s(v.id)}catch(I){V("agent_recruit_failed",{template_id:"site-diagnostics",error:I instanceof Error?I.message:String(I)}),console.error("Failed to create Site Diagnostics agent:",I)}finally{T(!1)}}},b=`Add ${r}`;return a?t.jsx(Ee,{open:i,onOpenChange:e,children:t.jsxs(Se,{className:"h-[70dvh]",children:[t.jsx(Oe,{className:"px-4 pt-4 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[_,t.jsx(Le,{className:"text-xl font-semibold",children:b})]})}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:t.jsx(De,{onRecruit:N,isRecruiting:h,isLoading:p})})]})}):t.jsx(le,{open:i,onOpenChange:e,children:t.jsxs(ce,{className:"sm:max-w-[500px] p-8",children:[t.jsx(de,{className:"mb-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[_,t.jsx(ue,{className:"text-xl font-semibold",children:b})]})}),t.jsx(De,{onRecruit:N,isRecruiting:h,isLoading:p})]})})}const xt="https://sites-lean-canva.decocache.com/api/mcp",Nt=["Build and update Lean Canvas business models visually","Interactive grid UI with all 9 canvas sections","Iterative updates — add information as you discover it","Covers: Problem, Solution, Key Metrics, Unique Value Proposition","Covers: Channels, Customer Segments, Cost Structure, Revenue Streams","Unfair Advantage analysis"];function Ve(i){const e=M.c(7),{onRecruit:n,isRecruiting:a}=i;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a Lean Canvas agent that helps you build and iterate on your business model. Describe your idea and it produces a visual, structured canvas."}),e[0]=c):c=e[0];let s;e[1]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=s):s=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsxs("div",{className:"space-y-2",children:[s,t.jsx("ul",{className:"space-y-1.5",children:Nt.map(_t)})]}),e[2]=l):l=e[2];const m=a?"Setting up...":"Add Lean Canvas";let f;return e[3]!==a||e[4]!==n||e[5]!==m?(f=t.jsxs("div",{className:"flex flex-col gap-6",children:[c,l,t.jsx(oe,{onClick:n,disabled:a,className:"w-full cursor-pointer",children:m})]}),e[3]=a,e[4]=n,e[5]=m,e[6]=f):f=e[6],f}function _t(i){return t.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[t.jsx("span",{className:"text-emerald-500 mt-0.5 shrink-0",children:"+"}),i]},i)}function Jt({open:i,onOpenChange:e,existingAgent:n}){const a=Re(),{org:c}=z(),s=Ne(),l=ke(),m=Ue(),f=$({connectionId:re,orgId:c.id}),x=Qe({client:f}),[h,T]=O.useState(!1),d=Be.find(g=>g.id==="lean-canvas"),u=t.jsx(Me,{icon:d.icon,name:d.title,size:"sm"}),p=async()=>{if(n){e(!1),s(n.id);return}T(!0);try{const g=await x.mutateAsync({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_id"],operator:"eq",value:"lean-canvas"},limit:1,offset:0}});let C;const N=g?.structuredContent?.items?.find(o=>o.app_id==="lean-canvas"),b=we.SELF(c.id);N?C=N.id:C=(await l.create.mutateAsync({title:d.title,description:"Lean Canvas business model builder",icon:d.icon,connection_type:"HTTP",connection_url:xt,app_name:"lean-canvas",app_id:"lean-canvas",configuration_state:{OBJECT_STORAGE:{__type:"@deco/object-storage",value:b}},metadata:{type:"lean-canvas",source:"store",verified:!0}})).id;const I=await m.create.mutateAsync({title:d.title,description:"Lean Canvas business model builder",icon:d.icon,status:"active",connections:[{connection_id:C,selected_tools:null,selected_resources:null,selected_prompts:null},{connection_id:b,selected_tools:null,selected_resources:null,selected_prompts:null}],metadata:{type:"lean-canvas",instructions:null,ui:{pinnedViews:[{connectionId:C,toolName:"lean_canvas",label:"lean_canvas",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:C,toolName:"lean_canvas"}}}}});V("agent_recruit_confirmed",{template_id:"lean-canvas",agent_id:I.id}),e(!1),s(I.id)}catch(g){V("agent_recruit_failed",{template_id:"lean-canvas",error:g instanceof Error?g.message:String(g)}),console.error("Failed to create Lean Canvas agent:",g)}finally{T(!1)}},r=`Add ${d.title}`;return a?t.jsx(Ee,{open:i,onOpenChange:e,children:t.jsxs(Se,{className:"h-[70dvh]",children:[t.jsx(Oe,{className:"px-4 pt-4 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[u,t.jsx(Le,{className:"text-xl font-semibold",children:r})]})}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:t.jsx(Ve,{onRecruit:p,isRecruiting:h})})]})}):t.jsx(le,{open:i,onOpenChange:e,children:t.jsxs(ce,{className:"sm:max-w-[500px] p-8",children:[t.jsx(de,{className:"mb-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[u,t.jsx(ue,{className:"text-xl font-semibold",children:r})]})}),t.jsx(Ve,{onRecruit:p,isRecruiting:h})]})})}const Ct=`<role>
2
- You are the Agent Manager. You create, configure, and maintain agents (Virtual MCPs) in this workspace.
3
- </role>
4
-
5
- <capabilities>
6
- - Create new agents with appropriate connections and instructions.
7
- - Update agent configurations: instructions, connections, tool/resource/prompt selection.
8
- - List and inspect existing agents and their current setup.
9
- - Delete agents that are no longer needed.
10
- - Configure agent plugins and pinned views.
11
- - Browse available connections to help decide what to aggregate into an agent.
12
- </capabilities>
13
-
14
- <constraints>
15
- - You can list and inspect connections but cannot create, modify, or delete them.
16
- - Always confirm with the user before deleting an agent.
17
- - When adding connections to an agent, verify the connection exists by listing or getting it first.
18
- - Do not broaden an agent's scope unless the user explicitly requests it.
19
- - Preserve existing behavior when updating — apply the smallest necessary change set.
20
- </constraints>
21
-
22
- <workflows>
23
- 1. Creating an agent:
24
- a. List available connections with COLLECTION_CONNECTIONS_LIST.
25
- b. Confirm the agent's purpose, target user, and scope with the user.
26
- c. Create the agent with COLLECTION_VIRTUAL_MCP_CREATE, including a focused title, description, selected connections, and XML-structured instructions.
27
- d. Verify the saved configuration with COLLECTION_VIRTUAL_MCP_GET.
28
-
29
- 2. Updating an agent:
30
- a. Get the current agent config with COLLECTION_VIRTUAL_MCP_GET.
31
- b. If the update changes connections, verify new connections exist with COLLECTION_CONNECTIONS_GET.
32
- c. Apply changes with COLLECTION_VIRTUAL_MCP_UPDATE using the smallest change set.
33
- d. Confirm the final state with COLLECTION_VIRTUAL_MCP_GET.
34
-
35
- 3. Reviewing agents:
36
- a. List all agents with COLLECTION_VIRTUAL_MCP_LIST.
37
- b. For detailed inspection, use COLLECTION_VIRTUAL_MCP_GET on specific agents.
38
- c. Cross-reference with COLLECTION_CONNECTIONS_LIST to identify unused or missing connections.
39
- </workflows>`,It=`<role>
40
- You are the Automation Manager. You create, configure, and manage automations — background agents that run on triggers (cron schedules or events).
41
- </role>
42
-
43
- <capabilities>
44
- - Create automations with instructions, model configuration, and triggers.
45
- - Add and remove triggers (cron schedules or event-based).
46
- - Manually run automations for testing.
47
- - Update automation behavior, instructions, and model settings.
48
- - List and inspect existing automations.
49
- - Delete automations that are no longer needed.
50
- - Browse available agents and connections to configure automation targets.
51
- </capabilities>
52
-
53
- <constraints>
54
- - You can list and inspect agents and connections but cannot create, modify, or delete them.
55
- - Always confirm with the user before deleting an automation.
56
- - When assigning an agent to an automation, verify the agent exists first.
57
- - Validate cron expressions before adding cron triggers.
58
- - Warn the user about high-frequency triggers (less than 1 minute intervals).
59
- </constraints>
60
-
61
- <workflows>
62
- 1. Creating an automation:
63
- a. Clarify the automation's purpose, schedule, and expected behavior.
64
- b. If the automation targets an agent, list agents with COLLECTION_VIRTUAL_MCP_LIST and confirm the target.
65
- c. Create the automation with AUTOMATION_CREATE, including clear instructions and model config.
66
- d. Add triggers with AUTOMATION_TRIGGER_ADD (cron or event-based).
67
- e. Verify with AUTOMATION_GET.
68
-
69
- 2. Updating an automation:
70
- a. Get current config with AUTOMATION_GET.
71
- b. Apply changes with AUTOMATION_UPDATE.
72
- c. If triggers need updating, use AUTOMATION_TRIGGER_REMOVE and AUTOMATION_TRIGGER_ADD.
73
- d. Confirm the final state with AUTOMATION_GET.
74
-
75
- 3. Testing an automation:
76
- a. Get the automation config with AUTOMATION_GET to review its setup.
77
- b. Run it manually with AUTOMATION_RUN.
78
- c. Report the result to the user.
79
- </workflows>`,Tt=`<role>
80
- You are the Connection Manager. You create, configure, test, and manage MCP connections in this workspace.
81
- </role>
82
-
83
- <capabilities>
84
- - Create new connections (HTTP, SSE, STDIO types) with proper configuration.
85
- - List and inspect existing connections and their status.
86
- - Update connection details: URL, headers, authentication, metadata.
87
- - Test connection health to verify connectivity.
88
- - Delete connections that are no longer needed.
89
- </capabilities>
90
-
91
- <constraints>
92
- - Always confirm with the user before deleting a connection.
93
- - Never expose connection tokens or secrets in responses — refer to them as "configured" or "not configured."
94
- - When creating HTTP connections, validate that a URL is provided.
95
- - Test connections after creation or URL changes to verify they work.
96
- - Warn the user if deleting a connection that might be in use by agents (suggest they check first).
97
- </constraints>
98
-
99
- <workflows>
100
- 1. Creating a connection:
101
- a. Clarify the connection type (HTTP, SSE, or STDIO) and target URL/command.
102
- b. Create with COLLECTION_CONNECTIONS_CREATE, including title, description, type, and URL.
103
- c. Test the new connection with CONNECTION_TEST.
104
- d. Report the result to the user.
105
-
106
- 2. Troubleshooting a connection:
107
- a. Get the connection details with COLLECTION_CONNECTIONS_GET.
108
- b. Run CONNECTION_TEST to check health.
109
- c. If the test fails, review the configuration and suggest fixes.
110
- d. After fixes, re-test to confirm.
111
-
112
- 3. Auditing connections:
113
- a. List all connections with COLLECTION_CONNECTIONS_LIST.
114
- b. Test each connection's health with CONNECTION_TEST.
115
- c. Report which connections are healthy, erroring, or inactive.
116
- </workflows>`,yt=[{id:"studio-agent-manager",title:"Agent Manager",icon:"icon://Bot?color=violet",description:"Create, configure, and manage agents",selectedTools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_GET","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE","COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET"],instructions:Ct,getId:ye.AGENT_MANAGER},{id:"studio-automation-manager",title:"Automation Manager",icon:"icon://Zap?color=amber",description:"Create, configure, and run automations with triggers",selectedTools:["AUTOMATION_CREATE","AUTOMATION_GET","AUTOMATION_LIST","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_RUN","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET"],instructions:It,getId:ye.AUTOMATION_MANAGER},{id:"studio-connection-manager",title:"Connection Manager",icon:"icon://Link01?color=cyan",description:"Create, configure, test, and manage connections",selectedTools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE","CONNECTION_TEST"],instructions:Tt,getId:ye.CONNECTION_MANAGER}],bt=[{title:"Agent Manager",description:"Create, configure, and manage agents"},{title:"Automation Manager",description:"Create, configure, and run automations with triggers"},{title:"Connection Manager",description:"Create, configure, test, and manage connections"}];function $e(i){const e=M.c(7),{onInstall:n,isInstalling:a}=i;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Install a suite of pre-configured agents for managing your studio. Each agent is scoped to a specific domain with focused instructions."}),e[0]=c):c=e[0];let s;e[1]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Included agents"}),e[1]=s):s=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsxs("div",{className:"space-y-2",children:[s,t.jsx("ul",{className:"space-y-1.5",children:bt.map(jt)})]}),e[2]=l):l=e[2];const m=a?"Installing...":"Install Studio Pack";let f;return e[3]!==a||e[4]!==n||e[5]!==m?(f=t.jsxs("div",{className:"flex flex-col gap-6",children:[c,l,t.jsx(oe,{onClick:n,disabled:a,className:"w-full cursor-pointer",children:m})]}),e[3]=a,e[4]=n,e[5]=m,e[6]=f):f=e[6],f}function jt(i){return t.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[t.jsx("span",{className:"text-emerald-500 mt-0.5 shrink-0",children:"+"}),t.jsxs("span",{children:[t.jsx("span",{className:"text-foreground font-medium",children:i.title})," ","— ",i.description]})]},i.title)}function Xt({open:i,onOpenChange:e}){const n=Re(),{org:a}=z(),c=Ue(),s=it(),l=We(),[m,f]=O.useState(!1),x=t.jsx(Me,{icon:"icon://Package?color=blue",name:"Studio Pack",size:"sm"}),h=async()=>{f(!0);try{const d=we.SELF(a.id),u=new Set(s.map(r=>r.title));let p=0;for(const r of yt)u.has(r.title)||(await c.create.mutateAsync({title:r.title,description:r.description,icon:r.icon,status:"active",metadata:{instructions:r.instructions},connections:[{connection_id:d,selected_tools:[...r.selectedTools],selected_resources:null,selected_prompts:null}]}),p++);V("agent_recruit_confirmed",{template_id:"studio-pack",installed_count:p}),e(!1),l({to:"/$org",params:{org:a.slug}})}catch(d){V("agent_recruit_failed",{template_id:"studio-pack",error:d instanceof Error?d.message:String(d)}),console.error("Failed to install Studio Pack:",d)}finally{f(!1)}},T="Install Studio Pack";return n?t.jsx(Ee,{open:i,onOpenChange:e,children:t.jsxs(Se,{className:"h-[70dvh]",children:[t.jsx(Oe,{className:"px-4 pt-4 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[x,t.jsx(Le,{className:"text-xl font-semibold",children:T})]})}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:t.jsx($e,{onInstall:h,isInstalling:m})})]})}):t.jsx(le,{open:i,onOpenChange:e,children:t.jsxs(ce,{className:"sm:max-w-[500px] p-8",children:[t.jsx(de,{className:"mb-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[x,t.jsx(ue,{className:"text-xl font-semibold",children:T})]})}),t.jsx($e,{onInstall:h,isInstalling:m})]})})}const vt="deco/mcp-github";function wt(i){const{org:e}=z(),{data:n}=ze.useSession(),a=ke(),c=ve(),[s,l]=O.useState("idle"),[m,f]=O.useState(null),[x,h]=O.useState(null),{data:T,isLoading:d}=Ye(vt,{enabled:i.enabled}),u=O.useRef(!1);i.enabled&&T&&!d&&!u.current&&n?.user?.id&&s==="idle"&&(u.current=!0,p());async function p(){if(!(!T||!n?.user?.id||!e))try{l("installing"),f(null);const g=ct(T,e.id,n.user.id,{remoteIndex:0});if(!g.connection_url)throw new Error("Registry item is missing a remote URL for mcp-github");const{id:_}=await a.create.mutateAsync(g);l("authenticating");const N=new URL(`/mcp/${_}`,window.location.origin),b=await Je({url:N.href,token:null});if(b.supportsOAuth&&!b.isAuthenticated){const{token:I,tokenInfo:o,error:y}=await Xe({connectionId:_,scope:"offline_access"});if(y||!I){try{await a.delete.mutateAsync(_)}catch{}throw new Error(y??"No token received from GitHub")}if(o)try{(await fetch(`/api/connections/${_}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:o.accessToken,refreshToken:o.refreshToken,expiresIn:o.expiresIn,scope:o.scope,clientId:o.clientId,clientSecret:o.clientSecret,tokenEndpoint:o.tokenEndpoint})})).ok||await a.update.mutateAsync({id:_,data:{connection_token:I}})}catch{await a.update.mutateAsync({id:_,data:{connection_token:I}})}}je(c,e.id),h(g),l("ready")}catch(g){f(g instanceof Error?g.message:String(g)),l("error")}}function r(){l("idle"),f(null),h(null),u.current=!1}return i.enabled&&d&&s==="idle"?{status:"installing",error:null,connection:null,retry:r}:{status:s,error:m,connection:x,retry:r}}function ae(i){const e=M.c(4),{size:n,className:a}=i;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"}),e[0]=c):c=e[0];let s;return e[1]!==a||e[2]!==n?(s=t.jsx("svg",{width:n,height:n,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:a,children:c}),e[1]=a,e[2]=n,e[3]=s):s=e[3],s}function Zt(i){const e=M.c(21),{open:n,onOpenChange:a,title:c,hideAutoRespondCheckbox:s,onImportComplete:l}=i,m=c===void 0?"Import from GitHub":c,f=s===void 0?!1:s,[x]=Ze(),[h,T]=O.useState(null);if(!x.experimental_vibecode)return null;let d;e[0]!==m?(d=t.jsx(de,{className:"sr-only",children:t.jsx(ue,{children:m})}),e[0]=m,e[1]=d):d=e[1];let u;e[2]!==h||e[3]!==m?(u=t.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3 shrink-0",children:h?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>T(null),className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors shrink-0","aria-label":"Back to accounts",children:t.jsx(Ae,{size:16})}),t.jsx("img",{src:h.avatarUrl,alt:h.login,className:"size-5 rounded-full ring-1 ring-border shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:h.login})]}):t.jsxs(t.Fragment,{children:[t.jsx(ae,{className:"size-4 text-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:m})]})}),e[2]=h,e[3]=m,e[4]=u):u=e[4];let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(xe,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=p):p=e[5];let r;e[6]!==a?(r=()=>a(!1),e[6]=a,e[7]=r):r=e[7];let g;e[8]!==f||e[9]!==l||e[10]!==h||e[11]!==r?(g=t.jsx("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:t.jsx(O.Suspense,{fallback:p,children:t.jsx(At,{onComplete:r,selectedInstallation:h,onSelectInstallation:T,hideAutoRespondCheckbox:f,onImportComplete:l})})}),e[8]=f,e[9]=l,e[10]=h,e[11]=r,e[12]=g):g=e[12];let C;e[13]!==d||e[14]!==u||e[15]!==g?(C=t.jsxs(ce,{className:"sm:max-w-[560px] h-[85svh] sm:h-[520px] p-0 gap-0 overflow-hidden flex flex-col",children:[d,u,g]}),e[13]=d,e[14]=u,e[15]=g,e[16]=C):C=e[16];let _;return e[17]!==a||e[18]!==n||e[19]!==C?(_=t.jsx(le,{open:n,onOpenChange:a,children:C}),e[17]=a,e[18]=n,e[19]=C,e[20]=_):_=e[20],_}function At({onComplete:i,selectedInstallation:e,onSelectInstallation:n,hideAutoRespondCheckbox:a,onImportComplete:c}){const{org:s}=z(),l=ve(),m=Ne(),[f,x]=O.useState(null),[h,T]=O.useState(!0),d=a?!0:h,u=nt({slug:"mcp-github"}),p=wt({enabled:u.length===0}),r=u.length===1?u[0]??null:f,g=$({connectionId:r?.id??"",orgId:s.id}),C=$({connectionId:re,orgId:s.id}),_=async(o,y)=>{try{const v=await g.callTool({name:"get_file_contents",arguments:{owner:o.owner,repo:o.name,path:y}});if(v.isError)return null;const j=v.content?.find(S=>S.type==="resource")?.resource?.text;if(!j)return null;try{const S=JSON.parse(j);return typeof S=="string"?S:JSON.stringify(S)}catch{return j}}catch{return null}},N=(o,y)=>{Promise.all([_(y,"AGENTS.md"),_(y,"CLAUDE.md")]).then(async([A,v])=>{const E=A??v??null;E&&(await C.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:o,data:{metadata:{instructions:E}}}}),je(l,s.id))}).catch(A=>{console.error("GitHub instructions fetch failed:",A)})},b=async({virtualMcpId:o,repo:y,connectionId:A})=>{const v=await g.callTool({name:"TRIGGER_LIST",arguments:{}}),E=v.structuredContent??v,j=E.triggers?.find(R=>R.type==="github.issues.opened")??E.triggers?.find(R=>{const P=R.type.toLowerCase();return/\bissues?\./.test(P)&&(P.endsWith(".opened")||P.endsWith(".created"))});if(!j)throw new Error("No issue-created trigger exposed by GitHub connection");const S=new Set;if(Array.isArray(j.params))for(const R of j.params)S.add(R.name);else if(j.params&&typeof j.params=="object")for(const R of Object.keys(j.params))S.add(R);if(j.paramsSchema)for(const R of Object.keys(j.paramsSchema))S.add(R);const k={};S.has("repo")?k.repo=`${y.owner}/${y.name}`:(S.has("owner")&&(k.owner=y.owner),S.has("name")&&(k.name=y.name),S.has("repository")&&(k.repository=`${y.owner}/${y.name}`));const U=`A new GitHub issue has been opened in ${y.owner}/${y.name}. Read the issue details, explore the relevant code in the repository, create a new branch, implement the fix or feature requested, and open a pull request that resolves the issue. Reference the issue number in the PR description.`,F=await C.callTool({name:"AUTOMATION_CREATE",arguments:{name:`${y.name}: auto-respond to issues`,virtual_mcp_id:o,agent:{id:o},messages:U,active:!0}}),se=F.structuredContent??F;await C.callTool({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:se.id,type:"event",connection_id:A,event_type:j.type,params:k}})},I=He({mutationFn:async o=>{if(!r||!e)throw new Error("No GitHub connection or installation");const y=r.id,A=await C.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:o.name,description:o.description||"Imported from GitHub",pinned:!0,icon:null,metadata:{githubRepo:{owner:o.owner,name:o.name,url:o.url,installationId:e.installationId,connectionId:y},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"}}}},connections:[{connection_id:y}]}}}),v=A.structuredContent??A,E=v.item.id;return d&&await b({virtualMcpId:E,repo:o,connectionId:y}).catch(j=>{console.error("Failed to set up issue automation:",j),ie.warning("Imported repo, but failed to set up issue auto-response. You can add the trigger manually from the automations view.")}),{virtualMcpId:E,repo:o,connectionId:y,item:v.item}},onSuccess:({virtualMcpId:o,repo:y,connectionId:A,item:v})=>{if(l.setQueryData(ne.collectionItem(C,s.id,"","VIRTUAL_MCP",o),{item:v}),je(l,s.id),N(o,y),c){c({virtualMcpId:o,repo:y,connectionId:A});return}ie.success(`Imported ${y.name} from GitHub`),i(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),m(o)},onError:o=>{ie.error("Failed to import repo: "+(o instanceof Error?o.message:"Unknown error"))}});return p.status==="installing"||p.status==="authenticating"?t.jsx(be,{status:p.status,error:null,retry:p.retry}):p.status==="error"?t.jsx(be,{status:"error",error:p.error,retry:p.retry}):u.length===0&&p.status==="idle"?t.jsx(be,{status:"installing",error:null,retry:p.retry}):u.length>1&&!r?t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-4 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a connection"})}),u.map(o=>t.jsxs("button",{type:"button",onClick:()=>x(o),className:"flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left",children:[o.icon?t.jsx("img",{src:o.icon,alt:o.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(ae,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:o.title})]},o.id))]}):r?e?t.jsx(St,{connectionId:r.id,orgId:s.id,installation:e,onSelectRepo:o=>I.mutate(o),isSaving:I.isPending,autoRespondToIssues:h,onAutoRespondChange:T,hideAutoRespondCheckbox:a}):t.jsx(Et,{connectionId:r.id,orgId:s.id,onSelect:n,showBackButton:u.length>1,onBack:()=>x(null)}):null}function Et(i){const e=M.c(30),{connectionId:n,orgId:a,onSelect:c,showBackButton:s,onBack:l}=i;let m;e[0]!==a?(m={connectionId:re,orgId:a},e[0]=a,e[1]=m):m=e[1];const f=$(m);let x;e[2]!==n||e[3]!==a?(x=ne.githubUserOrgs(a,n),e[2]=n,e[3]=a,e[4]=x):x=e[4];let h;e[5]!==n||e[6]!==f?(h=async()=>{const o=(await f.callTool({name:"GITHUB_LIST_USER_ORGS",arguments:{connectionId:n}})).content?.[0]?.text;if(!o)throw new Error("No response from GITHUB_LIST_USER_ORGS");return JSON.parse(o)},e[5]=n,e[6]=f,e[7]=h):h=e[7];let T;e[8]!==x||e[9]!==h?(T={queryKey:x,queryFn:h},e[8]=x,e[9]=h,e[10]=T):T=e[10];const d=Fe(T);if(d.isLoading){let I;return e[11]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(xe,{size:18,className:"animate-spin text-muted-foreground"})}),e[11]=I):I=e[11],I}if(d.isError){let I;return e[12]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load GitHub accounts"})}),e[12]=I):I=e[12],I}const u=d.data;if(!u)return null;let p;e[13]!==l||e[14]!==s?(p=s&&t.jsx("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 shrink-0",children:t.jsxs("button",{type:"button",onClick:l,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ae,{size:12}),"Change connection"]})}),e[13]=l,e[14]=s,e[15]=p):p=e[15];let r;if(e[16]!==u.installations||e[17]!==c){let I;e[19]!==c?(I=o=>t.jsxs("button",{type:"button",onClick:()=>c(o),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left group",children:[t.jsx("img",{src:o.avatarUrl,alt:o.login,className:"size-7 rounded-full shrink-0 ring-1 ring-border"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium leading-none",children:o.login}),o.type==="User"&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Personal account"})]}),t.jsx("span",{className:"text-xs text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:"Select →"})]},o.installationId),e[19]=c,e[20]=I):I=e[20],r=u.installations.map(I),e[16]=u.installations,e[17]=c,e[18]=r}else r=e[18];let g;e[21]!==r?(g=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]",children:r}),e[21]=r,e[22]=g):g=e[22];const C=u.appSlug?`https://github.com/apps/${u.appSlug}/installations/new`:"https://github.com/settings/installations";let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx("span",{className:"underline underline-offset-2",children:"Install the GitHub App"}),e[23]=_):_=e[23];let N;e[24]!==C?(N=t.jsx("div",{className:"px-4 py-3 border-t border-border shrink-0",children:t.jsxs("a",{href:C,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Account not listed?"," ",_]})}),e[24]=C,e[25]=N):N=e[25];let b;return e[26]!==N||e[27]!==p||e[28]!==g?(b=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p,g,N]}),e[26]=N,e[27]=p,e[28]=g,e[29]=b):b=e[29],b}function St(i){const e=M.c(24),{connectionId:n,orgId:a,installation:c,onSelectRepo:s,isSaving:l,autoRespondToIssues:m,onAutoRespondChange:f,hideAutoRespondCheckbox:x}=i,[h,T]=O.useState(""),d=O.useDeferredValue(h),u=h!==d;let p;e[0]!==u||e[1]!==h?(p=t.jsx(qe,{placeholder:"Search repositories...",value:h,onChange:T,isSearching:u}),e[0]=u,e[1]=h,e[2]=p):p=e[2];const r=u?"opacity-40":"opacity-100";let g;e[3]!==r?(g=he("flex-1 overflow-hidden flex flex-col transition-opacity duration-150",r),e[3]=r,e[4]=g):g=e[4];let C;e[5]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(xe,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=C):C=e[5];let _;e[6]!==n||e[7]!==d||e[8]!==c||e[9]!==l||e[10]!==s||e[11]!==a?(_=t.jsx(O.Suspense,{fallback:C,children:t.jsx(Ot,{connectionId:n,orgId:a,installation:c,query:d,onSelectRepo:s,isSaving:l})}),e[6]=n,e[7]=d,e[8]=c,e[9]=l,e[10]=s,e[11]=a,e[12]=_):_=e[12];let N;e[13]!==g||e[14]!==_?(N=t.jsx("div",{className:g,children:_}),e[13]=g,e[14]=_,e[15]=N):N=e[15];let b;e[16]!==m||e[17]!==x||e[18]!==f?(b=!x&&t.jsxs("label",{className:"flex items-center gap-2 px-4 py-3 border-t border-border shrink-0 cursor-pointer select-none",children:[t.jsx(ot,{checked:m,onCheckedChange:o=>f(o===!0)}),t.jsx("span",{className:"text-xs text-foreground",children:"Auto-respond to new issues with a PR"})]}),e[16]=m,e[17]=x,e[18]=f,e[19]=b):b=e[19];let I;return e[20]!==p||e[21]!==N||e[22]!==b?(I=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p,N,b]}),e[20]=p,e[21]=N,e[22]=b,e[23]=I):I=e[23],I}function Ot(i){const e=M.c(28),{connectionId:n,orgId:a,installation:c,query:s,onSelectRepo:l,isSaving:m}=i;let f;e[0]!==n||e[1]!==a?(f={connectionId:n,orgId:a},e[0]=n,e[1]=a,e[2]=f):f=e[2];const x=$(f),h=c.type==="User"?"user":"org",T=s?`${h}:${c.login} ${s} in:name`:`${h}:${c.login}`;let d;e[3]!==n||e[4]!==c.login||e[5]!==a||e[6]!==s?(d=ne.githubOrgRepos(a,n,c.login,s),e[3]=n,e[4]=c.login,e[5]=a,e[6]=s,e[7]=d):d=e[7];let u;e[8]!==x||e[9]!==T?(u=async()=>{const N=(await x.callTool({name:"search_repositories",arguments:{query:T,page:1,perPage:30}})).content?.[0]?.text;if(!N)throw new Error("No response from search_repositories");return(JSON.parse(N).items??[]).map(Lt)},e[8]=x,e[9]=T,e[10]=u):u=e[10];let p;e[11]!==d||e[12]!==u?(p={queryKey:d,queryFn:u},e[11]=d,e[12]=u,e[13]=p):p=e[13];const{data:r}=et(p);if(r.length===0){let _;e[14]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories found"}),e[14]=_):_=e[14];let N;e[15]!==s?(N=s&&t.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Try a different search term"}),e[15]=s,e[16]=N):N=e[16];let b;return e[17]!==N?(b=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[_,N]}),e[17]=N,e[18]=b):b=e[18],b}let g;if(e[19]!==m||e[20]!==l||e[21]!==r){let _;e[23]!==m||e[24]!==l?(_=N=>t.jsxs("button",{type:"button",onClick:()=>l(N),disabled:m,className:"flex items-start gap-3 px-4 py-3 hover:bg-accent transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx(ae,{className:"size-4 text-muted-foreground mt-0.5 shrink-0"}),t.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:t.jsx("span",{className:"text-sm font-medium truncate",children:N.name})}),t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground border border-border rounded px-1.5 py-0.5 shrink-0 leading-none",children:[N.private?t.jsx(at,{size:10}):t.jsx(rt,{size:10}),N.private?"Private":"Public"]})]},N.fullName),e[23]=m,e[24]=l,e[25]=_):_=e[25],g=r.map(_),e[19]=m,e[20]=l,e[21]=r,e[22]=g}else g=e[22];let C;return e[26]!==g?(C=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden flex flex-col [scrollbar-gutter:stable]",children:g}),e[26]=g,e[27]=C):C=e[27],C}function Lt(i){return{name:i.name,fullName:i.full_name,owner:i.full_name.split("/")[0]??"",url:i.html_url,private:i.private,description:i.description,updatedAt:i.updated_at}}function be(i){const e=M.c(33),{status:n,error:a,retry:c}=i;if(n==="error"){let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"size-10 rounded-full bg-destructive/10 flex items-center justify-center",children:t.jsx(ae,{className:"size-5 text-destructive"})}),e[0]=o):o=e[0];let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx("p",{className:"text-sm font-medium",children:"Connection failed"}),e[1]=y):y=e[1];const A=a??"Something went wrong while connecting to GitHub.";let v;e[2]!==A?(v=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[y,t.jsx("p",{className:"text-xs text-muted-foreground max-w-[260px] leading-relaxed",children:A})]}),e[2]=A,e[3]=v):v=e[3];let E;e[4]!==c?(E=t.jsx("button",{type:"button",onClick:c,className:"text-xs font-medium text-foreground border border-border rounded-md px-3 py-1.5 hover:bg-accent transition-colors",children:"Try again"}),e[4]=c,e[5]=E):E=e[5];let j;return e[6]!==v||e[7]!==E?(j=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[o,v,E]}),e[6]=v,e[7]=E,e[8]=j):j=e[8],j}const s=n==="authenticating";let l;e[9]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("div",{className:"size-10 rounded-full bg-muted flex items-center justify-center",children:t.jsx(ae,{className:"size-5 text-foreground"})}),e[9]=l):l=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"relative size-10",children:[l,t.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-background flex items-center justify-center",children:t.jsx(xe,{size:12,className:"animate-spin text-muted-foreground"})})]}),e[10]=m):m=e[10];const f=s?"Authenticating with GitHub":"Setting up GitHub";let x;e[11]!==f?(x=t.jsx("p",{className:"text-sm font-medium",children:f}),e[11]=f,e[12]=x):x=e[12];const h=s?"Complete the OAuth flow in your browser":"Installing the GitHub connection...";let T;e[13]!==h?(T=t.jsx("p",{className:"text-xs text-muted-foreground",children:h}),e[13]=h,e[14]=T):T=e[14];let d;e[15]!==x||e[16]!==T?(d=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[x,T]}),e[15]=x,e[16]=T,e[17]=d):d=e[17];const u=s?"bg-muted-foreground/30":"bg-foreground animate-pulse";let p;e[18]!==u?(p=he("size-1.5 rounded-full",u),e[18]=u,e[19]=p):p=e[19];let r;e[20]!==p?(r=t.jsx("span",{className:p}),e[20]=p,e[21]=r):r=e[21];const g=s?"bg-foreground animate-pulse":"bg-muted-foreground/30";let C;e[22]!==g?(C=he("size-1.5 rounded-full",g),e[22]=g,e[23]=C):C=e[23];let _;e[24]!==C?(_=t.jsx("span",{className:C}),e[24]=C,e[25]=_):_=e[25];let N;e[26]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}),e[26]=N):N=e[26];let b;e[27]!==r||e[28]!==_?(b=t.jsxs("div",{className:"flex items-center gap-1.5",children:[r,_,N]}),e[27]=r,e[28]=_,e[29]=b):b=e[29];let I;return e[30]!==b||e[31]!==d?(I=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[m,d,b]}),e[30]=b,e[31]=d,e[32]=I):I=e[32],I}export{Zt as G,Kt as I,Jt as L,Wt as S,Xt as a,ae as b,Ye as u};