@decocms/mesh 2.130.1 → 2.131.1

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 (193) hide show
  1. package/dist/client/assets/{AlertCircle-Y6iSJK0t.js → AlertCircle-0hiOc8CZ.js} +1 -1
  2. package/dist/client/assets/{AlertOctagon-r7aH80QB.js → AlertOctagon-GN8B-INI.js} +1 -1
  3. package/dist/client/assets/AlignLeft-BgC5LMd0.js +1 -0
  4. package/dist/client/assets/{ArrowDown-DPy5cnDQ.js → ArrowDown-PNhqRNxD.js} +1 -1
  5. package/dist/client/assets/{ArrowLeft-p4dfchJF.js → ArrowLeft-wS11NpwF.js} +1 -1
  6. package/dist/client/assets/{ArrowUp-Dx6U6WtF.js → ArrowUp-CH0M2x4i.js} +1 -1
  7. package/dist/client/assets/{Check-BIaai9j0.js → Check-xLOyX88L.js} +1 -1
  8. package/dist/client/assets/{CheckCircle-DvhMgeYT.js → CheckCircle-D15lJ7XR.js} +1 -1
  9. package/dist/client/assets/{CheckDone01-kUo2KMa3.js → CheckDone01-C40blUb5.js} +1 -1
  10. package/dist/client/assets/{CheckVerified02-DfOayhlO.js → CheckVerified02-Dicrho5O.js} +1 -1
  11. package/dist/client/assets/{ChevronDown-Dyskz-ZD.js → ChevronDown-p63TAVBS.js} +1 -1
  12. package/dist/client/assets/{ChevronRight-D6p6jiry.js → ChevronRight-D_Ht_JRW.js} +1 -1
  13. package/dist/client/assets/{Clock-Dymou738.js → Clock-DrIhUE6G.js} +1 -1
  14. package/dist/client/assets/{Code01-BYnTXqsh.js → Code01-CvvU9TcF.js} +1 -1
  15. package/dist/client/assets/{Container-DBGOFJUc.js → Container-ufACj1Zy.js} +1 -1
  16. package/dist/client/assets/{Copy01-CPaHCgqg.js → Copy01-HMjceblh.js} +1 -1
  17. package/dist/client/assets/{Dataflow03-D8kdCLb1.js → Dataflow03-y0rpKbi9.js} +1 -1
  18. package/dist/client/assets/{DotsHorizontal-Ra63dU8X.js → DotsHorizontal-2R4cCOu7.js} +1 -1
  19. package/dist/client/assets/{DotsVertical-DcLEsGDj.js → DotsVertical-Bda0yV1s.js} +1 -1
  20. package/dist/client/assets/{Download01-BP0Ze81Q.js → Download01-DfNl1ci5.js} +1 -1
  21. package/dist/client/assets/{Edit01-BEBZ-Ht5.js → Edit01-BF7NKi37.js} +1 -1
  22. package/dist/client/assets/{Eye-VtlrDhJf.js → Eye-jbWvzlxk.js} +1 -1
  23. package/dist/client/assets/{File02-Dcc2k6VI.js → File02-CbYedhXN.js} +1 -1
  24. package/dist/client/assets/{File06-DCHaBaad.js → File06-BM5aCl-O.js} +1 -1
  25. package/dist/client/assets/{FilterLines-D64nKG0E.js → FilterLines-CJpyRJ7t.js} +1 -1
  26. package/dist/client/assets/{Globe01-Rd2g694_.js → Globe01-BfTcTY8o.js} +1 -1
  27. package/dist/client/assets/{Globe02-nOidPs01.js → Globe02-CGDduE0L.js} +1 -1
  28. package/dist/client/assets/{Grid01-C8gF-dWK.js → Grid01-Z7sWikL1.js} +1 -1
  29. package/dist/client/assets/{Hash02-fd4i0k8G.js → Hash02-K4dRD2dR.js} +1 -1
  30. package/dist/client/assets/{Home02-ABQZ6xOx.js → Home02-hJdk8eNH.js} +1 -1
  31. package/dist/client/assets/{Image01-BrzUQQ9K.js → Image01-CuKvPASB.js} +1 -1
  32. package/dist/client/assets/{Inbox01-DK0JkUYE.js → Inbox01-CglLjipa.js} +1 -1
  33. package/dist/client/assets/{InfoCircle-DO1owwAA.js → InfoCircle-Bb6fqYc8.js} +1 -1
  34. package/dist/client/assets/{Key01-bHmq-6W2.js → Key01-LKATn8lY.js} +1 -1
  35. package/dist/client/assets/{LinkExternal01-DyOgk9O3.js → LinkExternal01-D_U0OEXZ.js} +1 -1
  36. package/dist/client/assets/{List-mX8yEKmx.js → List-QV8E4GNR.js} +1 -1
  37. package/dist/client/assets/{Loading01-Jv8Mbea8.js → Loading01-CWvnRL6a.js} +1 -1
  38. package/dist/client/assets/{Lock01-DPx3YF5B.js → Lock01-Bwx9HnGh.js} +1 -1
  39. package/dist/client/assets/{Play-DciA3rqD.js → Play-Icpx1cq_.js} +1 -1
  40. package/dist/client/assets/{Plus-Cecv4wEo.js → Plus-C-k6EyqD.js} +1 -1
  41. package/dist/client/assets/{RefreshCcw01-Busgf2jQ.js → RefreshCcw01-DCPzxJqp.js} +1 -1
  42. package/dist/client/assets/{Rows03-CBXDKtLW.js → Rows03-BxHdq4li.js} +1 -1
  43. package/dist/client/assets/{Save01-P2clZJAi.js → Save01-SegoBYVF.js} +1 -1
  44. package/dist/client/assets/{SearchMd-CS2uMIPl.js → SearchMd-TuCoj3FU.js} +1 -1
  45. package/dist/client/assets/{Settings01-BAgxhvm4.js → Settings01-DovilCf0.js} +1 -1
  46. package/dist/client/assets/{Shield01-Dw8oloiN.js → Shield01-EZO761pG.js} +1 -1
  47. package/dist/client/assets/{Terminal-d72o721Q.js → Terminal-D1kaOGFC.js} +1 -1
  48. package/dist/client/assets/{Trash01-CKATI1mI.js → Trash01-CPjIZLEP.js} +1 -1
  49. package/dist/client/assets/{Upload01-jmiBld-4.js → Upload01-DAh3LDGl.js} +1 -1
  50. package/dist/client/assets/{Users03-CLx_Qxdb.js → Users03-C6jjP916.js} +1 -1
  51. package/dist/client/assets/{X-RC7YVNJU.js → X-tkzrbQVp.js} +1 -1
  52. package/dist/client/assets/{XCircle-BgJPZWR5.js → XCircle-Cs5fpSB3.js} +1 -1
  53. package/dist/client/assets/{XClose-D-4ELBrc.js → XClose-BvPNH9hN.js} +1 -1
  54. package/dist/client/assets/{agent-connections-preview-Dac4pEFh.js → agent-connections-preview-Dpe_MFjy.js} +1 -1
  55. package/dist/client/assets/agent-detail-DZUg4-s5.js +2 -0
  56. package/dist/client/assets/{agents-vcyOPs3U.js → agents-BWNX2LSR.js} +1 -1
  57. package/dist/client/assets/{alert-dialog-CdqWA8wc.js → alert-dialog-COYgvBCq.js} +1 -1
  58. package/dist/client/assets/{auth-catchall-B-_Zqliv.js → auth-catchall-COXncBeo.js} +1 -1
  59. package/dist/client/assets/{avatar-tLGNC2ok.js → avatar-B9DZwrpo.js} +1 -1
  60. package/dist/client/assets/{badge-0EzsH3AB.js → badge-qrWA_kLG.js} +1 -1
  61. package/dist/client/assets/{binder-w9dF9fSa.js → binder-13i_lQ0c.js} +1 -1
  62. package/dist/client/assets/{breadcrumb-BcJj21EL.js → breadcrumb-Zdkq43pK.js} +1 -1
  63. package/dist/client/assets/{card-c-CJHmFC.js → card-DD-UCxfi.js} +1 -1
  64. package/dist/client/assets/{chart-PoFYShLf.js → chart-Dtw6L5md.js} +1 -1
  65. package/dist/client/assets/{checkbox-kw1ENx9l.js → checkbox-C_Pgnv4n.js} +1 -1
  66. package/dist/client/assets/{circle-alert-orNW2INv.js → circle-alert-DdDFLH9P.js} +1 -1
  67. package/dist/client/assets/{collection-detail-DcWT7KrG.js → collection-detail-Cg75ipNi.js} +3 -3
  68. package/dist/client/assets/{collection-search-DeB-znan.js → collection-search-CxUg-xAQ.js} +1 -1
  69. package/dist/client/assets/{collection-tab-DnFTZr-h.js → collection-tab-C62wXALQ.js} +1 -1
  70. package/dist/client/assets/{collection-table-wrapper-BkrnGVuo.js → collection-table-wrapper-Bz8WElPd.js} +1 -1
  71. package/dist/client/assets/{collection-tabs-CI_dPETO.js → collection-tabs-BjWYcsD2.js} +1 -1
  72. package/dist/client/assets/{command-CtwsQYlg.js → command-wm5iG4Qy.js} +1 -1
  73. package/dist/client/assets/{connect-Cjj5OaBk.js → connect-nlKsY2am.js} +1 -1
  74. package/dist/client/assets/{connection-card-DmcuYZ2d.js → connection-card-CqQpoqHp.js} +1 -1
  75. package/dist/client/assets/connection-detail-0Jk736m3.js +1 -0
  76. package/dist/client/assets/{connections-CQQbEDkG.js → connections-Cg2j2p3f.js} +1 -1
  77. package/dist/client/assets/constants-CbHMb0-K.js +1 -0
  78. package/dist/client/assets/{constants-DyBxaLKI.js → constants-CilfzTas.js} +1 -1
  79. package/dist/client/assets/context-CkGm0UTl.js +23 -0
  80. package/dist/client/assets/{create-organization-dialog-BolmWoUA.js → create-organization-dialog-DCEdnDTn.js} +1 -1
  81. package/dist/client/assets/{create-project-dialog-MbK1spLU.js → create-project-dialog-BWnYbbO8.js} +1 -1
  82. package/dist/client/assets/{dialog-L8ZakXii.js → dialog-iHT0i0tz.js} +1 -1
  83. package/dist/client/assets/{dropdown-menu-VTiqKHN9.js → dropdown-menu-BpyVIc2a.js} +1 -1
  84. package/dist/client/assets/{dynamic-plugin-layout-CMgyIw65.js → dynamic-plugin-layout-BG3KkqG4.js} +1 -1
  85. package/dist/client/assets/{editable-thread-title-CPogfRoD.js → editable-thread-title-BxqvtSds.js} +1 -1
  86. package/dist/client/assets/{empty-state-CevFdaoX.js → empty-state-ozmf3847.js} +1 -1
  87. package/dist/client/assets/{env-vars-editor-CZ9xwqbP.js → env-vars-editor-Nr3mWxuy.js} +1 -1
  88. package/dist/client/assets/{extract-connection-data-bPHhUn8L.js → extract-connection-data-DFqYDb10.js} +1 -1
  89. package/dist/client/assets/{file-browser-BBOKW0fZ.js → file-browser-D_9g9ebY.js} +2 -2
  90. package/dist/client/assets/{form-p8UY3zWX.js → form-BP7dMbdn.js} +1 -1
  91. package/dist/client/assets/{grid-view-CBiwYQ_M.js → grid-view-CPznGSAH.js} +1 -1
  92. package/dist/client/assets/{home-gtPjmaoD.js → home-DGwiBCGX.js} +1 -1
  93. package/dist/client/assets/{index-G8oxxr2G.js → index-0ocXQ777.js} +1 -1
  94. package/dist/client/assets/{index-BymQJSqf.js → index-BHlJRTz3.js} +1 -1
  95. package/dist/client/assets/{index-CmPWq7Ch.js → index-CCY7DImO.js} +1 -1
  96. package/dist/client/assets/{index-BPWcS_Kf.js → index-CDOpTYgU.js} +41 -41
  97. package/dist/client/assets/{index-CWyCvGNo.js → index-CEU_Ae_m.js} +1 -1
  98. package/dist/client/assets/{index-BRPNbM-s.js → index-CG50wTGS.js} +1 -1
  99. package/dist/client/assets/{index-CqCzS9v2.js → index-CGrDr99B.js} +1 -1
  100. package/dist/client/assets/index-DGca9RW1.css +1 -0
  101. package/dist/client/assets/{index-Cz17zD6m.js → index-DWQkOhqZ.js} +1 -1
  102. package/dist/client/assets/{index-0HoOnen3.js → index-plkk4e_J.js} +3 -3
  103. package/dist/client/assets/{infiniteQueryObserver-Be7iTEXe.js → infiniteQueryObserver-DaMN_U7y.js} +1 -1
  104. package/dist/client/assets/{input-BtUicd3Q.js → input-CmqvOeLB.js} +1 -1
  105. package/dist/client/assets/{integration-icon-5VjL1GgL.js → integration-icon-KIbgHijj.js} +1 -1
  106. package/dist/client/assets/{label-D6atofYo.js → label-bnFjyLyV.js} +1 -1
  107. package/dist/client/assets/{layout-Cgu_nW-7.js → layout-eozNid8i.js} +1 -1
  108. package/dist/client/assets/{localstorage-keys-BoChS3hJ.js → localstorage-keys-v0BD3Bnj.js} +1 -1
  109. package/dist/client/assets/{login-BJHT5HcO.js → login-CBgrYal6.js} +1 -1
  110. package/dist/client/assets/{markdown-C4hTkq3E.js → markdown-CPbw-_yp.js} +1 -1
  111. package/dist/client/assets/{mcp-oauth-D5R57Lko.js → mcp-oauth-B013QyX1.js} +1 -1
  112. package/dist/client/assets/{mcp-server-card-BiIhdNix.js → mcp-server-card-ncXA5Jvx.js} +1 -1
  113. package/dist/client/assets/{mcp-server-detail-BhlbPBsp.js → mcp-server-detail-3iu4l0w5.js} +2 -2
  114. package/dist/client/assets/{members-OikP95XQ.js → members-CImSfQo3.js} +1 -1
  115. package/dist/client/assets/{monitoring-DapgIfZL.js → monitoring-ChNXdpYB.js} +1 -1
  116. package/dist/client/assets/monitoring-dashboard-edit-Cu-THApH.js +1 -0
  117. package/dist/client/assets/{monitoring-dashboard-view-DRykeaHO.js → monitoring-dashboard-view-BzUwVgh9.js} +1 -1
  118. package/dist/client/assets/{oauth-callback-DZIR2PjB.js → oauth-callback-DZs-RHtN.js} +1 -1
  119. package/dist/client/assets/page-B6FWTLb-.js +1 -0
  120. package/dist/client/assets/{page-PH6ZVWlA.js → page-D9R69UOA.js} +1 -1
  121. package/dist/client/assets/{plugin-empty-state-kz2uan6n.js → plugin-empty-state-C2xpGFC3.js} +1 -1
  122. package/dist/client/assets/{plugin-empty-state-y1tYhlY3.js → plugin-empty-state-CHtrUf1n.js} +1 -1
  123. package/dist/client/assets/{plugin-header-BJbVVCoY.js → plugin-header-CUHoCr6W.js} +1 -1
  124. package/dist/client/assets/{plugin-header-nmFTSFoR.js → plugin-header-CoAFaSME.js} +1 -1
  125. package/dist/client/assets/{popover-P8B4MdX3.js → popover-BIhQBNxG.js} +1 -1
  126. package/dist/client/assets/project-layout-GwHfcyse.js +1 -0
  127. package/dist/client/assets/{projects-list-3Z4u-J4l.js → projects-list-xLnE8dj1.js} +1 -1
  128. package/dist/client/assets/{ranking-layout-DDk0F0da.js → ranking-layout-g51-toAX.js} +1 -1
  129. package/dist/client/assets/{readme-viewer-BFDmw5ln.js → readme-viewer-ClGynTaO.js} +1 -1
  130. package/dist/client/assets/{registry-layout-tBKkcjtf.js → registry-layout-Dm3suQ96.js} +1 -1
  131. package/dist/client/assets/{registry-utils-BPK3KAEQ.js → registry-utils-CT2cHZWq.js} +1 -1
  132. package/dist/client/assets/{reports-layout-C1Rj5mWL.js → reports-layout-CJCUfohD.js} +1 -1
  133. package/dist/client/assets/{reset-password-CoNNt1yx.js → reset-password-Cv5Uxbmm.js} +1 -1
  134. package/dist/client/assets/{resizable-CpFkObl0.js → resizable-Cwh2gJdN.js} +1 -1
  135. package/dist/client/assets/{save-actions-CNp28sAN.js → save-actions-D1fibul5.js} +1 -1
  136. package/dist/client/assets/{scroll-area-Bhoi0n_B.js → scroll-area-CqN1XcNu.js} +4 -4
  137. package/dist/client/assets/{select-DOO2sOs0.js → select-DzSheW-c.js} +1 -1
  138. package/dist/client/assets/shell-layout-B0efKbYl.js +3 -0
  139. package/dist/client/assets/{skeleton-CR236scd.js → skeleton-Ddk21_zG.js} +1 -1
  140. package/dist/client/assets/{spinner-DzG2AImj.js → spinner-DThNWGT1.js} +1 -1
  141. package/dist/client/assets/{store-invite-CeIOMnWs.js → store-invite-DoNiJ_2C.js} +1 -1
  142. package/dist/client/assets/{switch-UjGh-56-.js → switch-BHoytSWv.js} +1 -1
  143. package/dist/client/assets/{table-CK5AQN01.js → table-C75ROyVe.js} +1 -1
  144. package/dist/client/assets/{tabs-ZEd61iZd.js → tabs-CgeHjw7d.js} +1 -1
  145. package/dist/client/assets/tasks-J3R0xo09.js +1 -0
  146. package/dist/client/assets/{textarea-Ca7XZUqN.js → textarea-D0tgU2KU.js} +1 -1
  147. package/dist/client/assets/{time-range-picker-GPYqbq-o.js → time-range-picker-upAU-oKs.js} +1 -1
  148. package/dist/client/assets/{toggle-group-BgEBi3gu.js → toggle-group-BkgC_GPy.js} +1 -1
  149. package/dist/client/assets/{tools-list-DJeaOzT_.js → tools-list-DcUxVw8u.js} +1 -1
  150. package/dist/client/assets/{tooltip-BWlQ9UL9.js → tooltip-Bnw97WFs.js} +1 -1
  151. package/dist/client/assets/{topbar-portal-CMlW5IwY.js → topbar-portal-C7BEToqh.js} +1 -1
  152. package/dist/client/assets/{types-BPCR06YW.js → types-C3qz9fLX.js} +1 -1
  153. package/dist/client/assets/{use-binding-CcrgjIcJ.js → use-binding-BnDQaQ8a.js} +1 -1
  154. package/dist/client/assets/{use-connection-B6TFiTxb.js → use-connection-CQasYzzj.js} +1 -1
  155. package/dist/client/assets/{use-copy-DfInz4oY.js → use-copy-Co7gHvim.js} +1 -1
  156. package/dist/client/assets/{use-create-virtual-mcp-pELq4UZ_.js → use-create-virtual-mcp-D-bJGh_Q.js} +1 -1
  157. package/dist/client/assets/{use-deco-chat-open-BmqwFIXp.js → use-deco-chat-open-DzCwN_oU.js} +1 -1
  158. package/dist/client/assets/{use-install-from-registry-BCXPqkOi.js → use-install-from-registry-GXYG5L7Y.js} +1 -1
  159. package/dist/client/assets/{use-list-state-Bpa4-xTU.js → use-list-state-BDwJVbli.js} +1 -1
  160. package/dist/client/assets/{use-llm-7gZpMpM0.js → use-llm-BwSqXALL.js} +1 -1
  161. package/dist/client/assets/{use-mcp-prompts-BIRErCHu.js → use-mcp-prompts-CN7UYKcE.js} +1 -1
  162. package/dist/client/assets/{use-mcp-tools-BjSYCbSh.js → use-mcp-tools-CvszUz7q.js} +1 -1
  163. package/dist/client/assets/{use-members-BUeDkAPW.js → use-members-DBSMoNj3.js} +1 -1
  164. package/dist/client/assets/{use-mobile-B9jSIPRg.js → use-mobile-DLdIzb3b.js} +1 -1
  165. package/dist/client/assets/{use-project-B6kYJzwY.js → use-project-DoeOF1FB.js} +1 -1
  166. package/dist/client/assets/{use-settings-modal-Bi52YF5w.js → use-settings-modal-D_BbrW8Q.js} +1 -1
  167. package/dist/client/assets/{use-view-mode-CHcflreW.js → use-view-mode-v-cu8Xdx.js} +1 -1
  168. package/dist/client/assets/{use-virtual-mcp-C4mcpRPm.js → use-virtual-mcp-CcREhkTd.js} +1 -1
  169. package/dist/client/assets/useInfiniteQuery-CS1K3ARI.js +1 -0
  170. package/dist/client/assets/{useMutation-C13VGcqo.js → useMutation-D4nH_fUX.js} +1 -1
  171. package/dist/client/assets/useQuery-D64ihcYY.js +1 -0
  172. package/dist/client/assets/useSuspenseInfiniteQuery-D2GBejOt.js +1 -0
  173. package/dist/client/assets/{workflow-N0cDVEpp.js → workflow-De0pszJC.js} +1 -1
  174. package/dist/client/index.html +2 -2
  175. package/dist/server/cli.js +168 -168
  176. package/dist/server/migrate.js +2 -2
  177. package/dist/server/server.js +2 -2
  178. package/package.json +1 -1
  179. package/dist/client/assets/Tool01-DkfecWlX.js +0 -1
  180. package/dist/client/assets/agent-detail-D5a7TiOz.js +0 -2
  181. package/dist/client/assets/connection-detail-DOePEdlc.js +0 -1
  182. package/dist/client/assets/constants-DK6m0rOQ.js +0 -1
  183. package/dist/client/assets/context-GOV4Tst1.js +0 -23
  184. package/dist/client/assets/deco-constants-BmtTfZbQ.js +0 -1
  185. package/dist/client/assets/index-BcDQ75Aq.css +0 -1
  186. package/dist/client/assets/monitoring-dashboard-edit-Yzekapph.js +0 -1
  187. package/dist/client/assets/page-iyMzbA2I.js +0 -1
  188. package/dist/client/assets/project-layout-BqSVP5TE.js +0 -1
  189. package/dist/client/assets/shell-layout-CSB6jzfL.js +0 -3
  190. package/dist/client/assets/tasks-C15WiR9-.js +0 -1
  191. package/dist/client/assets/useInfiniteQuery-78QQc26G.js +0 -1
  192. package/dist/client/assets/useQuery-CI6Jq2Tz.js +0 -1
  193. package/dist/client/assets/useSuspenseInfiniteQuery-BfZMgfKc.js +0 -1
@@ -1 +1 @@
1
- import{c as v,v as N,j as t}from"./index-0HoOnen3.js";import{i as y}from"./Loading01-Jv8Mbea8.js";import{i as C}from"./SearchMd-CS2uMIPl.js";import{I as w}from"./input-BtUicd3Q.js";function S(){const u=v.c(1);let e;return u[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("img",{src:"/empty-state-cards.png",alt:"",width:336,height:320,"aria-hidden":"true"}),u[0]=e):e=u[0],e}function z(u){const e=v.c(24),{image:f,title:h,description:j,actions:d,className:p,descriptionClassName:g,actionsClassName:x}=u;let c;e[0]!==p?(c=N("flex flex-1 flex-col items-center justify-center gap-8 p-4",p),e[0]=p,e[1]=c):c=e[1];let s;e[2]!==f?(s=f!==null&&t.jsx("div",{className:"flex items-center justify-center",children:f??t.jsx(S,{})}),e[2]=f,e[3]=s):s=e[3];let o;e[4]!==h?(o=t.jsx("h3",{className:"text-lg font-medium text-foreground",children:h}),e[4]=h,e[5]=o):o=e[5];let l;e[6]!==g?(l=N("text-sm text-muted-foreground text-center max-w-[300px]",g),e[6]=g,e[7]=l):l=e[7];let i;e[8]!==j||e[9]!==l?(i=t.jsx("div",{className:l,children:j}),e[8]=j,e[9]=l,e[10]=i):i=e[10];let r;e[11]!==o||e[12]!==i?(r=t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o,i]}),e[11]=o,e[12]=i,e[13]=r):r=e[13];let a;e[14]!==d||e[15]!==x?(a=d&&t.jsx("div",{className:N("flex items-center gap-2",x),children:d}),e[14]=d,e[15]=x,e[16]=a):a=e[16];let n;e[17]!==r||e[18]!==a?(n=t.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r,a]}),e[17]=r,e[18]=a,e[19]=n):n=e[19];let m;return e[20]!==c||e[21]!==s||e[22]!==n?(m=t.jsxs("div",{className:c,children:[s,n]}),e[20]=c,e[21]=s,e[22]=n,e[23]=m):m=e[23],m}function R(u){const e=v.c(21),{value:f,onChange:h,placeholder:j,onKeyDown:d,className:p,isSearching:g,disabled:x}=u,c=j===void 0?"Search...":j;let s;e[0]!==p?(s=N("shrink-0 w-full border-b border-border h-12",p),e[0]=p,e[1]=s):s=e[1];const o=x?"cursor-not-allowed opacity-50":"cursor-text";let l;e[2]!==o?(l=N("flex items-center gap-2.5 h-12 px-4",o),e[2]=o,e[3]=l):l=e[3];let i;e[4]!==g?(i=g?t.jsx(y,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):t.jsx(C,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=g,e[5]=i):i=e[5];let r;e[6]!==h?(r=b=>h(b.target.value),e[6]=h,e[7]=r):r=e[7];let a;e[8]!==x||e[9]!==d||e[10]!==c||e[11]!==r||e[12]!==f?(a=t.jsx(w,{value:f,onChange:r,onKeyDown:d,placeholder:c,disabled:x,className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[8]=x,e[9]=d,e[10]=c,e[11]=r,e[12]=f,e[13]=a):a=e[13];let n;e[14]!==l||e[15]!==i||e[16]!==a?(n=t.jsxs("label",{className:l,children:[i,a]}),e[14]=l,e[15]=i,e[16]=a,e[17]=n):n=e[17];let m;return e[18]!==s||e[19]!==n?(m=t.jsx("div",{className:s,children:n}),e[18]=s,e[19]=n,e[20]=m):m=e[20],m}export{R as C,z as E};
1
+ import{c as v,v as N,j as t}from"./index-plkk4e_J.js";import{i as y}from"./Loading01-CWvnRL6a.js";import{i as C}from"./SearchMd-TuCoj3FU.js";import{I as w}from"./input-CmqvOeLB.js";function S(){const u=v.c(1);let e;return u[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("img",{src:"/empty-state-cards.png",alt:"",width:336,height:320,"aria-hidden":"true"}),u[0]=e):e=u[0],e}function z(u){const e=v.c(24),{image:f,title:h,description:j,actions:d,className:p,descriptionClassName:g,actionsClassName:x}=u;let c;e[0]!==p?(c=N("flex flex-1 flex-col items-center justify-center gap-8 p-4",p),e[0]=p,e[1]=c):c=e[1];let s;e[2]!==f?(s=f!==null&&t.jsx("div",{className:"flex items-center justify-center",children:f??t.jsx(S,{})}),e[2]=f,e[3]=s):s=e[3];let o;e[4]!==h?(o=t.jsx("h3",{className:"text-lg font-medium text-foreground",children:h}),e[4]=h,e[5]=o):o=e[5];let l;e[6]!==g?(l=N("text-sm text-muted-foreground text-center max-w-[300px]",g),e[6]=g,e[7]=l):l=e[7];let i;e[8]!==j||e[9]!==l?(i=t.jsx("div",{className:l,children:j}),e[8]=j,e[9]=l,e[10]=i):i=e[10];let r;e[11]!==o||e[12]!==i?(r=t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o,i]}),e[11]=o,e[12]=i,e[13]=r):r=e[13];let a;e[14]!==d||e[15]!==x?(a=d&&t.jsx("div",{className:N("flex items-center gap-2",x),children:d}),e[14]=d,e[15]=x,e[16]=a):a=e[16];let n;e[17]!==r||e[18]!==a?(n=t.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r,a]}),e[17]=r,e[18]=a,e[19]=n):n=e[19];let m;return e[20]!==c||e[21]!==s||e[22]!==n?(m=t.jsxs("div",{className:c,children:[s,n]}),e[20]=c,e[21]=s,e[22]=n,e[23]=m):m=e[23],m}function R(u){const e=v.c(21),{value:f,onChange:h,placeholder:j,onKeyDown:d,className:p,isSearching:g,disabled:x}=u,c=j===void 0?"Search...":j;let s;e[0]!==p?(s=N("shrink-0 w-full border-b border-border h-12",p),e[0]=p,e[1]=s):s=e[1];const o=x?"cursor-not-allowed opacity-50":"cursor-text";let l;e[2]!==o?(l=N("flex items-center gap-2.5 h-12 px-4",o),e[2]=o,e[3]=l):l=e[3];let i;e[4]!==g?(i=g?t.jsx(y,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):t.jsx(C,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=g,e[5]=i):i=e[5];let r;e[6]!==h?(r=b=>h(b.target.value),e[6]=h,e[7]=r):r=e[7];let a;e[8]!==x||e[9]!==d||e[10]!==c||e[11]!==r||e[12]!==f?(a=t.jsx(w,{value:f,onChange:r,onKeyDown:d,placeholder:c,disabled:x,className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[8]=x,e[9]=d,e[10]=c,e[11]=r,e[12]=f,e[13]=a):a=e[13];let n;e[14]!==l||e[15]!==i||e[16]!==a?(n=t.jsxs("label",{className:l,children:[i,a]}),e[14]=l,e[15]=i,e[16]=a,e[17]=n):n=e[17];let m;return e[18]!==s||e[19]!==n?(m=t.jsx("div",{className:s,children:n}),e[18]=s,e[19]=n,e[20]=m):m=e[20],m}export{R as C,z as E};
@@ -1 +1 @@
1
- import{c as Ae,j as t,B as Ie,b as Ye,d as Ze,u as et,r as tt,O as $e,t as st}from"./index-0HoOnen3.js";import{g as Oe}from"./generate-id-Dyweu44Y.js";import{a as ot,C as Fe}from"./collection-table-wrapper-BkrnGVuo.js";import{C as it,E as nt}from"./collection-search-DeB-znan.js";import{C as rt}from"./card-c-CJHmFC.js";import{I as ke}from"./integration-icon-5VjL1GgL.js";import{D as Ke,a as Ue,b as Le,c as k}from"./dropdown-menu-VTiqKHN9.js";import{a as Be}from"./Copy01-CPaHCgqg.js";import{i as Re}from"./DotsVertical-DcLEsGDj.js";import{i as Ve}from"./Edit01-BEBZ-Ht5.js";import{s as Ge}from"./Eye-VtlrDhJf.js";import{s as Je}from"./Trash01-CKATI1mI.js";import{E as ze}from"./empty-state-CevFdaoX.js";import{n as Ee}from"./Inbox01-DK0JkUYE.js";import{U as lt,u as at}from"./use-list-state-Bpa4-xTU.js";import{B as ct}from"./constants-DK6m0rOQ.js";import{A as dt,g as pt,c as mt,b as ut,d as ft,e as ht,a as xt,f as gt}from"./alert-dialog-CdqWA8wc.js";import{u as jt,e as Ct}from"./use-connection-B6TFiTxb.js";import{u as vt}from"./constants-DyBxaLKI.js";import{s as bt}from"./Plus-Cecv4wEo.js";import{V as yt}from"./layout-Cgu_nW-7.js";function Nt(n,e){const s=n.properties||{};for(const i in s){const l=s[i];if(l&&l.type==="string"&&(l.format==="url"||l.format==="uri")&&e&&typeof e=="object"&&i in e&&e[i])return e[i]}const r=["image","img","avatar","icon","logo","thumbnail","cover"];for(const i of r)if(e&&typeof e=="object"&&i in e&&typeof e[i]=="string")return e[i]}function wt(n){const e=Ae.c(25),{item:s,schema:r,actions:i}=n;let l;e[0]!==s||e[1]!==r?(l=Nt(r,s),e[0]=s,e[1]=r,e[2]=l):l=e[2];const u=l,p=s&&typeof s=="object"&&"description"in s&&typeof s.description=="string"?s.description:void 0;let j;e[3]!==i?(j=i&&Object.keys(i).length>0,e[3]=i,e[4]=j):j=e[4];const o=j;let m;e[5]!==u||e[6]!==s.title?(m=t.jsx(ke,{icon:u,name:s.title,size:"md",className:"shrink-0 shadow-sm"}),e[5]=u,e[6]=s.title,e[7]=m):m=e[7];let f;e[8]!==s.title?(f=t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:s.title}),e[8]=s.title,e[9]=f):f=e[9];const d=p||"No description";let c;e[10]!==d?(c=t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:d}),e[10]=d,e[11]=c):c=e[11];let C;e[12]!==f||e[13]!==c?(C=t.jsxs("div",{className:"flex flex-col gap-0 flex-1",children:[f,c]}),e[12]=f,e[13]=c,e[14]=C):C=e[14];let y;e[15]!==m||e[16]!==C?(y=t.jsxs("div",{className:"flex flex-col gap-4 p-6 flex-1",children:[m,C]}),e[15]=m,e[16]=C,e[17]=y):y=e[17];let a;e[18]!==i||e[19]!==o||e[20]!==s?(a=o&&t.jsx("div",{className:"absolute top-6 right-6 opacity-0 group-hover:opacity-100 transition-opacity",onClick:At,onMouseDown:_t,children:t.jsxs(Ke,{children:[t.jsx(Ue,{asChild:!0,children:t.jsx(Ie,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Dt,children:t.jsx(Re,{size:20})})}),t.jsxs(Le,{align:"end",onClick:St,children:[i.open&&t.jsxs(k,{onClick:h=>{h.stopPropagation(),i.open?.(s)},children:[t.jsx(Ge,{size:16}),"Open"]}),i.edit&&t.jsxs(k,{onClick:h=>{h.stopPropagation(),i.edit?.(s)},children:[t.jsx(Ve,{size:16}),"Edit"]}),i.duplicate&&t.jsxs(k,{onClick:h=>{h.stopPropagation(),i.duplicate?.(s)},children:[t.jsx(Be,{size:16}),"Duplicate"]}),i.delete&&t.jsxs(k,{variant:"destructive",onClick:h=>{h.stopPropagation(),i.delete?.(s)},children:[t.jsx(Je,{size:16}),"Delete"]})]})]})}),e[18]=i,e[19]=o,e[20]=s,e[21]=a):a=e[21];let S;return e[22]!==y||e[23]!==a?(S=t.jsxs(rt,{className:"cursor-pointer transition-colors h-full flex flex-col group relative",children:[y,a]}),e[22]=y,e[23]=a,e[24]=S):S=e[24],S}function St(n){return n.stopPropagation()}function Dt(n){return n.stopPropagation()}function _t(n){return n.stopPropagation()}function At(n){return n.stopPropagation()}const It=["icon","avatar","logo"],Me=["created_at","created_by","id"];function Pt(n){return Object.keys(n).find(e=>It.includes(e.toLowerCase()))}function We(n,e){return Object.keys(n.properties||{}).filter(s=>["id","created_at","updated_at","created_by","updated_by"].includes(s)?!1:e?e.includes(s):!0).map(s=>({id:s,label:s.charAt(0).toUpperCase()+s.slice(1).replace(/_/g," ")}))}function Tt(n){const e=Ae.c(32),{data:s,schema:r,viewMode:i,onViewModeChange:l,search:u,sortKey:p,sortDirection:j,onSort:o,actions:m,onItemClick:f,headerActions:d,emptyState:c,readOnly:C,columns:y,hideToolbar:a,sortableFields:S}=n,h=l===void 0?Mt:l,x=j===void 0?"asc":j,P=o===void 0?Et:o;let v;e[0]!==m?(v=m===void 0?{}:m,e[0]=m,e[1]=v):v=e[1];const D=v,_=f===void 0?zt:f,z=d===void 0?null:d,b=c===void 0?null:c,T=C===void 0?!1:C,N=y===void 0?void 0:y,F=a===void 0?!1:a,w=S===void 0?void 0:S;let E;e[2]!==N||e[3]!==r||e[4]!==w?(E=N?N.filter(Ot).filter(M=>!w||w.includes(M.id)).map($t):We(r,w),e[2]=N,e[3]=r,e[4]=w,e[5]=E):E=e[5];const $=E;let A;e[6]!==z||e[7]!==F||e[8]!==P||e[9]!==h||e[10]!==x||e[11]!==p||e[12]!==$||e[13]!==i?(A=!F&&t.jsx("div",{className:"shrink-0 w-full border-b border-border h-12",children:t.jsxs("div",{className:"flex items-center gap-3 h-12 px-4",children:[t.jsx("div",{className:"flex items-center gap-2 flex-1",children:z}),t.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t.jsx(Fe,{viewMode:i,onViewModeChange:h,sortKey:p,sortDirection:x,onSort:P,sortOptions:$})})]})}),e[6]=z,e[7]=F,e[8]=P,e[9]=h,e[10]=x,e[11]=p,e[12]=$,e[13]=i,e[14]=A):A=e[14];let O;e[15]!==D||e[16]!==N||e[17]!==s||e[18]!==b||e[19]!==_||e[20]!==P||e[21]!==T||e[22]!==r||e[23]!==u||e[24]!==x||e[25]!==p||e[26]!==w||e[27]!==i?(O=i==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:s.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:b||t.jsx(ze,{icon:t.jsx(Ee,{size:36,className:"text-muted-foreground"}),title:"No items found",description:u?"Try adjusting your search":"No items to display"})}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:s.map(M=>t.jsx("div",{onClick:()=>_?.(M),className:"cursor-pointer h-full",children:t.jsx(wt,{item:M,schema:r,readOnly:T,actions:D})},M.id))})}):t.jsx(ot,{columns:Kt(N,r,w,D),data:s,sortKey:p,sortDirection:x,onSort:P,onRowClick:_,emptyState:b||t.jsx(ze,{icon:t.jsx(Ee,{size:36,className:"text-muted-foreground"}),title:"No items found",description:u?"Try adjusting your search":"No items to display"})}),e[15]=D,e[16]=N,e[17]=s,e[18]=b,e[19]=_,e[20]=P,e[21]=T,e[22]=r,e[23]=u,e[24]=x,e[25]=p,e[26]=w,e[27]=i,e[28]=O):O=e[28];let I;return e[29]!==A||e[30]!==O?(I=t.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[A,O]}),e[29]=A,e[30]=O,e[31]=I):I=e[31],I}function $t(n){return{id:n.id,label:typeof n.header=="string"?n.header:n.id}}function Ot(n){return n.sortable!==!1}function zt(){}function Et(){}function Mt(){}function Ft(n){return{id:"actions",header:"",render:e=>t.jsxs(Ke,{children:[t.jsx(Ue,{asChild:!0,children:t.jsx(Ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:s=>s.stopPropagation(),children:t.jsx(Re,{size:20})})}),t.jsxs(Le,{align:"end",onClick:s=>s.stopPropagation(),children:[n.open&&t.jsxs(k,{onClick:s=>{s.stopPropagation(),n.open?.(e)},children:[t.jsx(Ge,{size:16}),"Open"]}),n.edit&&t.jsxs(k,{onClick:s=>{s.stopPropagation(),n.edit?.(e)},children:[t.jsx(Ve,{size:16}),"Edit"]}),n.duplicate&&t.jsxs(k,{onClick:s=>{s.stopPropagation(),n.duplicate?.(e)},children:[t.jsx(Be,{size:16}),"Duplicate"]}),n.delete&&t.jsxs(k,{variant:"destructive",onClick:s=>{s.stopPropagation(),n.delete?.(e)},children:[t.jsx(Je,{size:16}),"Delete"]})]})]}),cellClassName:"w-[60px]",sortable:!1}}function He(n){const e=n.type;return Array.isArray(e)?e.every(s=>He({type:s})):e==="string"||e==="number"||e==="integer"||e==="boolean"||e==="null"}function kt(n,e){const s=n.properties||{},r=Object.keys(s).filter(o=>{const m=s[o];return m&&He(m)}),i=Pt(s),l=[],u=new Set;i&&r.includes(i)&&(l.push(i),u.add(i));const p=["title","description","updated_at","updated_by"];for(const o of p)r.includes(o)&&!u.has(o)&&(l.push(o),u.add(o));const j=r.filter(o=>!u.has(o)&&!Me.includes(o)).sort((o,m)=>o.localeCompare(m));for(const o of j)l.push(o),u.add(o);for(const o of Me)r.includes(o)&&!u.has(o)&&(l.push(o),u.add(o));return l.map(o=>{const m=s[o],f=e?e.includes(o):!["id"].includes(o);return o===i?{id:o,header:"",render:d=>{const c=d[o];return t.jsx(ke,{icon:c,name:d.title,size:"sm",className:"shrink-0 shadow-sm"})},sortable:!1,cellClassName:"w-16 shrink-0",wrap:!0}:o==="description"?{id:o,header:"Description",render:d=>{const c=d[o];return c==null?"—":t.jsx("span",{className:"block truncate max-w-[50ch]",children:String(c)})},sortable:f,cellClassName:"max-w-[50ch]"}:o==="created_by"||o==="updated_by"?{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:d=>{const c=d[o];return c?t.jsx(lt,{id:String(c),size:"xs"}):"—"},sortable:f,cellClassName:"max-w-[250px]"}:m?.format==="date-time"||o.endsWith("_at")?{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:d=>{const c=d[o];return c?t.jsx("span",{className:"block truncate max-w-full",children:new Date(c).toLocaleDateString()}):"—"},sortable:f,cellClassName:"max-w-[200px]"}:{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:d=>{const c=d[o];return c==null?"—":t.jsx("span",{className:"block truncate max-w-full",children:String(c)})},sortable:f,cellClassName:"max-w-[200px]"}})}function Kt(n,e,s,r){const i=n||kt(e,s);return i.some(p=>p.id==="actions")?i:Object.keys(r).length>0?[...i,Ft(r)]:i}function as(n){const e=Ae.c(113),{connectionId:s,org:r,activeCollection:i}=n,l=i.name,u=i.schema??ct,p=i.hasCreateTool,j=i.hasUpdateTool,o=i.hasDeleteTool,m=Ye(),{data:f}=Ze.useSession(),d=f?.user?.id||"unknown",{org:c}=et();let C;e[0]!==s||e[1]!==c.id?(C={connectionId:s,orgId:c.id},e[0]=s,e[1]=c.id,e[2]=C):C=e[2];const y=vt(C),a=jt(s,l,y),S=`${s}-${l}`;let h;e[3]!==r||e[4]!==S?(h={namespace:r,resource:S,defaultSortKey:"updated_at"},e[3]=r,e[4]=S,e[5]=h):h=e[5];const{search:x,searchTerm:P,setSearch:v,viewMode:D,setViewMode:_,sortKey:z,sortDirection:b,handleSort:T}=at(h);let N;e[6]!==P||e[7]!==b||e[8]!==z?(N={searchTerm:P,sortKey:z,sortDirection:b},e[6]=P,e[7]=b,e[8]=z,e[9]=N):N=e[9];const F=Ct(s,l,y,N),w=!p&&!j&&!o;let E;e[10]!==l||e[11]!==s||e[12]!==m||e[13]!==r?(E=g=>{m({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:r,project:$e,connectionId:s,collectionName:l,itemId:g.id}})},e[10]=l,e[11]=s,e[12]=m,e[13]=r,e[14]=E):E=e[14];const $=E;let A;e[15]!==a.create||e[16]!==d?(A=async g=>{const me=new Date().toISOString();await a.create.mutateAsync({...g,id:Oe("conn"),title:`${g.title} (Copy)`,created_at:me,updated_at:me,created_by:d,updated_by:d})},e[15]=a.create,e[16]=d,e[17]=A):A=e[17];const O=A,[I,M]=tt.useState(null);let oe;e[18]===Symbol.for("react.memo_cache_sentinel")?(oe=g=>{M(g)},e[18]=oe):oe=e[18];const qe=oe;let K;e[19]!==$||e[20]!==j?(K=j&&{edit:$},e[19]=$,e[20]=j,e[21]=K):K=e[21];let U;e[22]!==O||e[23]!==p?(U=p&&{duplicate:O},e[22]=O,e[23]=p,e[24]=U):U=e[24];let L;e[25]!==o?(L=o&&{delete:qe},e[25]=o,e[26]=L):L=e[26];let ie;e[27]!==L||e[28]!==K||e[29]!==U?(ie={...K,...U,...L},e[27]=L,e[28]=K,e[29]=U,e[30]=ie):ie=e[30];const ue=ie;let ne;e[31]!==a.delete||e[32]!==I?(ne=async()=>{I&&(await a.delete.mutateAsync(I.id),M(null))},e[31]=a.delete,e[32]=I,e[33]=ne):ne=e[33];const fe=ne;let re;e[34]!==a.create||e[35]!==l||e[36]!==s||e[37]!==p||e[38]!==m||e[39]!==r||e[40]!==d?(re=async()=>{if(!p){st.error("Create operation is not available for this collection");return}const g=new Date().toISOString(),me={id:Oe("conn"),title:"New Item",description:"A brief description of the item",created_at:g,updated_at:g,created_by:d,updated_by:d};try{const _e=await a.create.mutateAsync(me);m({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:r,project:$e,connectionId:s,collectionName:l,itemId:_e.id}})}catch(_e){console.error("Failed to create item:",_e)}},e[34]=a.create,e[35]=l,e[36]=s,e[37]=p,e[38]=m,e[39]=r,e[40]=d,e[41]=re):re=e[41];const he=re;let le;e[42]!==u?(le=We(u),e[42]=u,e[43]=le):le=e[43];const xe=le,Pe=(F?.length??0)>0,Qe=p&&Pe,Xe=p&&!Pe&&!x;let ae;e[44]!==a.create||e[45]!==he||e[46]!==p?(ae=p?t.jsxs(Ie,{onClick:he,size:"sm",disabled:a.create.isPending,className:"h-7",children:[t.jsx(bt,{className:"mr-2 h-4 w-4"}),a.create.isPending?"Creating...":"Create"]}):null,e[44]=a.create,e[45]=he,e[46]=p,e[47]=ae):ae=e[47];const Te=ae,ge=z;let B;e[48]!==T||e[49]!==_||e[50]!==b||e[51]!==xe||e[52]!==ge||e[53]!==D?(B=t.jsx(Fe,{viewMode:D,onViewModeChange:_,sortKey:ge,sortDirection:b,onSort:T,sortOptions:xe}),e[48]=T,e[49]=_,e[50]=b,e[51]=xe,e[52]=ge,e[53]=D,e[54]=B):B=e[54];const je=Qe&&Te;let R;e[55]!==B||e[56]!==je?(R=t.jsxs(yt,{children:[B,je]}),e[55]=B,e[56]=je,e[57]=R):R=e[57];const Ce=`Search ${l}...`;let V;e[58]!==v?(V=g=>{g.key==="Escape"&&(v(""),g.target.blur())},e[58]=v,e[59]=V):V=e[59];let G;e[60]!==x||e[61]!==v||e[62]!==Ce||e[63]!==V?(G=t.jsx(it,{value:x,onChange:v,placeholder:Ce,onKeyDown:V}),e[60]=x,e[61]=v,e[62]=Ce,e[63]=V,e[64]=G):G=e[64];let J;e[65]!==F?(J=F??[],e[65]=F,e[66]=J):J=e[66];const ve=z;let W;e[67]!==$?(W=g=>$(g),e[67]=$,e[68]=W):W=e[68];const be="No items found",ye=x?"Try adjusting your search terms":"This collection doesn't have any items yet.",Ne=Xe?Te:void 0;let H;e[69]!==be||e[70]!==ye||e[71]!==Ne?(H=t.jsx(nt,{image:null,title:be,description:ye,actions:Ne}),e[69]=be,e[70]=ye,e[71]=Ne,e[72]=H):H=e[72];let q;e[73]!==T||e[74]!==w||e[75]!==ue||e[76]!==u||e[77]!==x||e[78]!==v||e[79]!==_||e[80]!==b||e[81]!==J||e[82]!==ve||e[83]!==W||e[84]!==H||e[85]!==D?(q=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(Tt,{hideToolbar:!0,data:J,schema:u,viewMode:D,onViewModeChange:_,search:x,onSearchChange:v,sortKey:ve,sortDirection:b,onSort:T,actions:ue,onItemClick:W,readOnly:w,emptyState:H})}),e[73]=T,e[74]=w,e[75]=ue,e[76]=u,e[77]=x,e[78]=v,e[79]=_,e[80]=b,e[81]=J,e[82]=ve,e[83]=W,e[84]=H,e[85]=D,e[86]=q):q=e[86];let Q;e[87]!==G||e[88]!==q?(Q=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[G,q]}),e[87]=G,e[88]=q,e[89]=Q):Q=e[89];const we=!!I;let ce;e[90]===Symbol.for("react.memo_cache_sentinel")?(ce=g=>{g||M(null)},e[90]=ce):ce=e[90];let de;e[91]===Symbol.for("react.memo_cache_sentinel")?(de=t.jsx(mt,{children:"Delete item?"}),e[91]=de):de=e[91];const Se=I?.title;let X;e[92]!==Se?(X=t.jsxs(ut,{children:[de,t.jsxs(ft,{children:['Are you sure you want to delete "',Se,'"? This action cannot be undone.']})]}),e[92]=Se,e[93]=X):X=e[93];let Y;e[94]!==a.delete.isPending?(Y=t.jsx(dt,{disabled:a.delete.isPending,children:"Cancel"}),e[94]=a.delete.isPending,e[95]=Y):Y=e[95];const De=a.delete.isPending?"Deleting...":"Delete";let Z;e[96]!==a.delete.isPending||e[97]!==fe||e[98]!==De?(Z=t.jsx(pt,{onClick:fe,disabled:a.delete.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:De}),e[96]=a.delete.isPending,e[97]=fe,e[98]=De,e[99]=Z):Z=e[99];let ee;e[100]!==Y||e[101]!==Z?(ee=t.jsxs(ht,{children:[Y,Z]}),e[100]=Y,e[101]=Z,e[102]=ee):ee=e[102];let te;e[103]!==X||e[104]!==ee?(te=t.jsxs(xt,{children:[X,ee]}),e[103]=X,e[104]=ee,e[105]=te):te=e[105];let se;e[106]!==we||e[107]!==te?(se=t.jsx(gt,{open:we,onOpenChange:ce,children:te}),e[106]=we,e[107]=te,e[108]=se):se=e[108];let pe;return e[109]!==R||e[110]!==Q||e[111]!==se?(pe=t.jsxs(t.Fragment,{children:[R,Q,se]}),e[109]=R,e[110]=Q,e[111]=se,e[112]=pe):pe=e[112],pe}export{as as C};
1
+ import{c as Ae,j as t,B as Ie,b as Ye,d as Ze,u as et,r as tt,O as $e,t as st}from"./index-plkk4e_J.js";import{g as Oe}from"./generate-id-Dyweu44Y.js";import{a as ot,C as Fe}from"./collection-table-wrapper-Bz8WElPd.js";import{C as it,E as nt}from"./collection-search-CxUg-xAQ.js";import{C as rt}from"./card-DD-UCxfi.js";import{I as ke}from"./integration-icon-KIbgHijj.js";import{D as Ke,a as Ue,b as Le,c as k}from"./dropdown-menu-BpyVIc2a.js";import{a as Be}from"./Copy01-HMjceblh.js";import{i as Re}from"./DotsVertical-Bda0yV1s.js";import{i as Ve}from"./Edit01-BF7NKi37.js";import{s as Ge}from"./Eye-jbWvzlxk.js";import{s as Je}from"./Trash01-CPjIZLEP.js";import{E as ze}from"./empty-state-ozmf3847.js";import{n as Ee}from"./Inbox01-CglLjipa.js";import{U as lt,u as at}from"./use-list-state-BDwJVbli.js";import{B as ct}from"./constants-CbHMb0-K.js";import{A as dt,g as pt,c as mt,b as ut,d as ft,e as ht,a as xt,f as gt}from"./alert-dialog-COYgvBCq.js";import{u as jt,e as Ct}from"./use-connection-CQasYzzj.js";import{u as vt}from"./constants-CilfzTas.js";import{s as bt}from"./Plus-C-k6EyqD.js";import{V as yt}from"./layout-eozNid8i.js";function Nt(n,e){const s=n.properties||{};for(const i in s){const l=s[i];if(l&&l.type==="string"&&(l.format==="url"||l.format==="uri")&&e&&typeof e=="object"&&i in e&&e[i])return e[i]}const r=["image","img","avatar","icon","logo","thumbnail","cover"];for(const i of r)if(e&&typeof e=="object"&&i in e&&typeof e[i]=="string")return e[i]}function wt(n){const e=Ae.c(25),{item:s,schema:r,actions:i}=n;let l;e[0]!==s||e[1]!==r?(l=Nt(r,s),e[0]=s,e[1]=r,e[2]=l):l=e[2];const u=l,p=s&&typeof s=="object"&&"description"in s&&typeof s.description=="string"?s.description:void 0;let j;e[3]!==i?(j=i&&Object.keys(i).length>0,e[3]=i,e[4]=j):j=e[4];const o=j;let m;e[5]!==u||e[6]!==s.title?(m=t.jsx(ke,{icon:u,name:s.title,size:"md",className:"shrink-0 shadow-sm"}),e[5]=u,e[6]=s.title,e[7]=m):m=e[7];let f;e[8]!==s.title?(f=t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:s.title}),e[8]=s.title,e[9]=f):f=e[9];const d=p||"No description";let c;e[10]!==d?(c=t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:d}),e[10]=d,e[11]=c):c=e[11];let C;e[12]!==f||e[13]!==c?(C=t.jsxs("div",{className:"flex flex-col gap-0 flex-1",children:[f,c]}),e[12]=f,e[13]=c,e[14]=C):C=e[14];let y;e[15]!==m||e[16]!==C?(y=t.jsxs("div",{className:"flex flex-col gap-4 p-6 flex-1",children:[m,C]}),e[15]=m,e[16]=C,e[17]=y):y=e[17];let a;e[18]!==i||e[19]!==o||e[20]!==s?(a=o&&t.jsx("div",{className:"absolute top-6 right-6 opacity-0 group-hover:opacity-100 transition-opacity",onClick:At,onMouseDown:_t,children:t.jsxs(Ke,{children:[t.jsx(Ue,{asChild:!0,children:t.jsx(Ie,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Dt,children:t.jsx(Re,{size:20})})}),t.jsxs(Le,{align:"end",onClick:St,children:[i.open&&t.jsxs(k,{onClick:h=>{h.stopPropagation(),i.open?.(s)},children:[t.jsx(Ge,{size:16}),"Open"]}),i.edit&&t.jsxs(k,{onClick:h=>{h.stopPropagation(),i.edit?.(s)},children:[t.jsx(Ve,{size:16}),"Edit"]}),i.duplicate&&t.jsxs(k,{onClick:h=>{h.stopPropagation(),i.duplicate?.(s)},children:[t.jsx(Be,{size:16}),"Duplicate"]}),i.delete&&t.jsxs(k,{variant:"destructive",onClick:h=>{h.stopPropagation(),i.delete?.(s)},children:[t.jsx(Je,{size:16}),"Delete"]})]})]})}),e[18]=i,e[19]=o,e[20]=s,e[21]=a):a=e[21];let S;return e[22]!==y||e[23]!==a?(S=t.jsxs(rt,{className:"cursor-pointer transition-colors h-full flex flex-col group relative",children:[y,a]}),e[22]=y,e[23]=a,e[24]=S):S=e[24],S}function St(n){return n.stopPropagation()}function Dt(n){return n.stopPropagation()}function _t(n){return n.stopPropagation()}function At(n){return n.stopPropagation()}const It=["icon","avatar","logo"],Me=["created_at","created_by","id"];function Pt(n){return Object.keys(n).find(e=>It.includes(e.toLowerCase()))}function We(n,e){return Object.keys(n.properties||{}).filter(s=>["id","created_at","updated_at","created_by","updated_by"].includes(s)?!1:e?e.includes(s):!0).map(s=>({id:s,label:s.charAt(0).toUpperCase()+s.slice(1).replace(/_/g," ")}))}function Tt(n){const e=Ae.c(32),{data:s,schema:r,viewMode:i,onViewModeChange:l,search:u,sortKey:p,sortDirection:j,onSort:o,actions:m,onItemClick:f,headerActions:d,emptyState:c,readOnly:C,columns:y,hideToolbar:a,sortableFields:S}=n,h=l===void 0?Mt:l,x=j===void 0?"asc":j,P=o===void 0?Et:o;let v;e[0]!==m?(v=m===void 0?{}:m,e[0]=m,e[1]=v):v=e[1];const D=v,_=f===void 0?zt:f,z=d===void 0?null:d,b=c===void 0?null:c,T=C===void 0?!1:C,N=y===void 0?void 0:y,F=a===void 0?!1:a,w=S===void 0?void 0:S;let E;e[2]!==N||e[3]!==r||e[4]!==w?(E=N?N.filter(Ot).filter(M=>!w||w.includes(M.id)).map($t):We(r,w),e[2]=N,e[3]=r,e[4]=w,e[5]=E):E=e[5];const $=E;let A;e[6]!==z||e[7]!==F||e[8]!==P||e[9]!==h||e[10]!==x||e[11]!==p||e[12]!==$||e[13]!==i?(A=!F&&t.jsx("div",{className:"shrink-0 w-full border-b border-border h-12",children:t.jsxs("div",{className:"flex items-center gap-3 h-12 px-4",children:[t.jsx("div",{className:"flex items-center gap-2 flex-1",children:z}),t.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t.jsx(Fe,{viewMode:i,onViewModeChange:h,sortKey:p,sortDirection:x,onSort:P,sortOptions:$})})]})}),e[6]=z,e[7]=F,e[8]=P,e[9]=h,e[10]=x,e[11]=p,e[12]=$,e[13]=i,e[14]=A):A=e[14];let O;e[15]!==D||e[16]!==N||e[17]!==s||e[18]!==b||e[19]!==_||e[20]!==P||e[21]!==T||e[22]!==r||e[23]!==u||e[24]!==x||e[25]!==p||e[26]!==w||e[27]!==i?(O=i==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:s.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:b||t.jsx(ze,{icon:t.jsx(Ee,{size:36,className:"text-muted-foreground"}),title:"No items found",description:u?"Try adjusting your search":"No items to display"})}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:s.map(M=>t.jsx("div",{onClick:()=>_?.(M),className:"cursor-pointer h-full",children:t.jsx(wt,{item:M,schema:r,readOnly:T,actions:D})},M.id))})}):t.jsx(ot,{columns:Kt(N,r,w,D),data:s,sortKey:p,sortDirection:x,onSort:P,onRowClick:_,emptyState:b||t.jsx(ze,{icon:t.jsx(Ee,{size:36,className:"text-muted-foreground"}),title:"No items found",description:u?"Try adjusting your search":"No items to display"})}),e[15]=D,e[16]=N,e[17]=s,e[18]=b,e[19]=_,e[20]=P,e[21]=T,e[22]=r,e[23]=u,e[24]=x,e[25]=p,e[26]=w,e[27]=i,e[28]=O):O=e[28];let I;return e[29]!==A||e[30]!==O?(I=t.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[A,O]}),e[29]=A,e[30]=O,e[31]=I):I=e[31],I}function $t(n){return{id:n.id,label:typeof n.header=="string"?n.header:n.id}}function Ot(n){return n.sortable!==!1}function zt(){}function Et(){}function Mt(){}function Ft(n){return{id:"actions",header:"",render:e=>t.jsxs(Ke,{children:[t.jsx(Ue,{asChild:!0,children:t.jsx(Ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:s=>s.stopPropagation(),children:t.jsx(Re,{size:20})})}),t.jsxs(Le,{align:"end",onClick:s=>s.stopPropagation(),children:[n.open&&t.jsxs(k,{onClick:s=>{s.stopPropagation(),n.open?.(e)},children:[t.jsx(Ge,{size:16}),"Open"]}),n.edit&&t.jsxs(k,{onClick:s=>{s.stopPropagation(),n.edit?.(e)},children:[t.jsx(Ve,{size:16}),"Edit"]}),n.duplicate&&t.jsxs(k,{onClick:s=>{s.stopPropagation(),n.duplicate?.(e)},children:[t.jsx(Be,{size:16}),"Duplicate"]}),n.delete&&t.jsxs(k,{variant:"destructive",onClick:s=>{s.stopPropagation(),n.delete?.(e)},children:[t.jsx(Je,{size:16}),"Delete"]})]})]}),cellClassName:"w-[60px]",sortable:!1}}function He(n){const e=n.type;return Array.isArray(e)?e.every(s=>He({type:s})):e==="string"||e==="number"||e==="integer"||e==="boolean"||e==="null"}function kt(n,e){const s=n.properties||{},r=Object.keys(s).filter(o=>{const m=s[o];return m&&He(m)}),i=Pt(s),l=[],u=new Set;i&&r.includes(i)&&(l.push(i),u.add(i));const p=["title","description","updated_at","updated_by"];for(const o of p)r.includes(o)&&!u.has(o)&&(l.push(o),u.add(o));const j=r.filter(o=>!u.has(o)&&!Me.includes(o)).sort((o,m)=>o.localeCompare(m));for(const o of j)l.push(o),u.add(o);for(const o of Me)r.includes(o)&&!u.has(o)&&(l.push(o),u.add(o));return l.map(o=>{const m=s[o],f=e?e.includes(o):!["id"].includes(o);return o===i?{id:o,header:"",render:d=>{const c=d[o];return t.jsx(ke,{icon:c,name:d.title,size:"sm",className:"shrink-0 shadow-sm"})},sortable:!1,cellClassName:"w-16 shrink-0",wrap:!0}:o==="description"?{id:o,header:"Description",render:d=>{const c=d[o];return c==null?"—":t.jsx("span",{className:"block truncate max-w-[50ch]",children:String(c)})},sortable:f,cellClassName:"max-w-[50ch]"}:o==="created_by"||o==="updated_by"?{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:d=>{const c=d[o];return c?t.jsx(lt,{id:String(c),size:"xs"}):"—"},sortable:f,cellClassName:"max-w-[250px]"}:m?.format==="date-time"||o.endsWith("_at")?{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:d=>{const c=d[o];return c?t.jsx("span",{className:"block truncate max-w-full",children:new Date(c).toLocaleDateString()}):"—"},sortable:f,cellClassName:"max-w-[200px]"}:{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:d=>{const c=d[o];return c==null?"—":t.jsx("span",{className:"block truncate max-w-full",children:String(c)})},sortable:f,cellClassName:"max-w-[200px]"}})}function Kt(n,e,s,r){const i=n||kt(e,s);return i.some(p=>p.id==="actions")?i:Object.keys(r).length>0?[...i,Ft(r)]:i}function as(n){const e=Ae.c(113),{connectionId:s,org:r,activeCollection:i}=n,l=i.name,u=i.schema??ct,p=i.hasCreateTool,j=i.hasUpdateTool,o=i.hasDeleteTool,m=Ye(),{data:f}=Ze.useSession(),d=f?.user?.id||"unknown",{org:c}=et();let C;e[0]!==s||e[1]!==c.id?(C={connectionId:s,orgId:c.id},e[0]=s,e[1]=c.id,e[2]=C):C=e[2];const y=vt(C),a=jt(s,l,y),S=`${s}-${l}`;let h;e[3]!==r||e[4]!==S?(h={namespace:r,resource:S,defaultSortKey:"updated_at"},e[3]=r,e[4]=S,e[5]=h):h=e[5];const{search:x,searchTerm:P,setSearch:v,viewMode:D,setViewMode:_,sortKey:z,sortDirection:b,handleSort:T}=at(h);let N;e[6]!==P||e[7]!==b||e[8]!==z?(N={searchTerm:P,sortKey:z,sortDirection:b},e[6]=P,e[7]=b,e[8]=z,e[9]=N):N=e[9];const F=Ct(s,l,y,N),w=!p&&!j&&!o;let E;e[10]!==l||e[11]!==s||e[12]!==m||e[13]!==r?(E=g=>{m({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:r,project:$e,connectionId:s,collectionName:l,itemId:g.id}})},e[10]=l,e[11]=s,e[12]=m,e[13]=r,e[14]=E):E=e[14];const $=E;let A;e[15]!==a.create||e[16]!==d?(A=async g=>{const me=new Date().toISOString();await a.create.mutateAsync({...g,id:Oe("conn"),title:`${g.title} (Copy)`,created_at:me,updated_at:me,created_by:d,updated_by:d})},e[15]=a.create,e[16]=d,e[17]=A):A=e[17];const O=A,[I,M]=tt.useState(null);let oe;e[18]===Symbol.for("react.memo_cache_sentinel")?(oe=g=>{M(g)},e[18]=oe):oe=e[18];const qe=oe;let K;e[19]!==$||e[20]!==j?(K=j&&{edit:$},e[19]=$,e[20]=j,e[21]=K):K=e[21];let U;e[22]!==O||e[23]!==p?(U=p&&{duplicate:O},e[22]=O,e[23]=p,e[24]=U):U=e[24];let L;e[25]!==o?(L=o&&{delete:qe},e[25]=o,e[26]=L):L=e[26];let ie;e[27]!==L||e[28]!==K||e[29]!==U?(ie={...K,...U,...L},e[27]=L,e[28]=K,e[29]=U,e[30]=ie):ie=e[30];const ue=ie;let ne;e[31]!==a.delete||e[32]!==I?(ne=async()=>{I&&(await a.delete.mutateAsync(I.id),M(null))},e[31]=a.delete,e[32]=I,e[33]=ne):ne=e[33];const fe=ne;let re;e[34]!==a.create||e[35]!==l||e[36]!==s||e[37]!==p||e[38]!==m||e[39]!==r||e[40]!==d?(re=async()=>{if(!p){st.error("Create operation is not available for this collection");return}const g=new Date().toISOString(),me={id:Oe("conn"),title:"New Item",description:"A brief description of the item",created_at:g,updated_at:g,created_by:d,updated_by:d};try{const _e=await a.create.mutateAsync(me);m({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:r,project:$e,connectionId:s,collectionName:l,itemId:_e.id}})}catch(_e){console.error("Failed to create item:",_e)}},e[34]=a.create,e[35]=l,e[36]=s,e[37]=p,e[38]=m,e[39]=r,e[40]=d,e[41]=re):re=e[41];const he=re;let le;e[42]!==u?(le=We(u),e[42]=u,e[43]=le):le=e[43];const xe=le,Pe=(F?.length??0)>0,Qe=p&&Pe,Xe=p&&!Pe&&!x;let ae;e[44]!==a.create||e[45]!==he||e[46]!==p?(ae=p?t.jsxs(Ie,{onClick:he,size:"sm",disabled:a.create.isPending,className:"h-7",children:[t.jsx(bt,{className:"mr-2 h-4 w-4"}),a.create.isPending?"Creating...":"Create"]}):null,e[44]=a.create,e[45]=he,e[46]=p,e[47]=ae):ae=e[47];const Te=ae,ge=z;let B;e[48]!==T||e[49]!==_||e[50]!==b||e[51]!==xe||e[52]!==ge||e[53]!==D?(B=t.jsx(Fe,{viewMode:D,onViewModeChange:_,sortKey:ge,sortDirection:b,onSort:T,sortOptions:xe}),e[48]=T,e[49]=_,e[50]=b,e[51]=xe,e[52]=ge,e[53]=D,e[54]=B):B=e[54];const je=Qe&&Te;let R;e[55]!==B||e[56]!==je?(R=t.jsxs(yt,{children:[B,je]}),e[55]=B,e[56]=je,e[57]=R):R=e[57];const Ce=`Search ${l}...`;let V;e[58]!==v?(V=g=>{g.key==="Escape"&&(v(""),g.target.blur())},e[58]=v,e[59]=V):V=e[59];let G;e[60]!==x||e[61]!==v||e[62]!==Ce||e[63]!==V?(G=t.jsx(it,{value:x,onChange:v,placeholder:Ce,onKeyDown:V}),e[60]=x,e[61]=v,e[62]=Ce,e[63]=V,e[64]=G):G=e[64];let J;e[65]!==F?(J=F??[],e[65]=F,e[66]=J):J=e[66];const ve=z;let W;e[67]!==$?(W=g=>$(g),e[67]=$,e[68]=W):W=e[68];const be="No items found",ye=x?"Try adjusting your search terms":"This collection doesn't have any items yet.",Ne=Xe?Te:void 0;let H;e[69]!==be||e[70]!==ye||e[71]!==Ne?(H=t.jsx(nt,{image:null,title:be,description:ye,actions:Ne}),e[69]=be,e[70]=ye,e[71]=Ne,e[72]=H):H=e[72];let q;e[73]!==T||e[74]!==w||e[75]!==ue||e[76]!==u||e[77]!==x||e[78]!==v||e[79]!==_||e[80]!==b||e[81]!==J||e[82]!==ve||e[83]!==W||e[84]!==H||e[85]!==D?(q=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(Tt,{hideToolbar:!0,data:J,schema:u,viewMode:D,onViewModeChange:_,search:x,onSearchChange:v,sortKey:ve,sortDirection:b,onSort:T,actions:ue,onItemClick:W,readOnly:w,emptyState:H})}),e[73]=T,e[74]=w,e[75]=ue,e[76]=u,e[77]=x,e[78]=v,e[79]=_,e[80]=b,e[81]=J,e[82]=ve,e[83]=W,e[84]=H,e[85]=D,e[86]=q):q=e[86];let Q;e[87]!==G||e[88]!==q?(Q=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[G,q]}),e[87]=G,e[88]=q,e[89]=Q):Q=e[89];const we=!!I;let ce;e[90]===Symbol.for("react.memo_cache_sentinel")?(ce=g=>{g||M(null)},e[90]=ce):ce=e[90];let de;e[91]===Symbol.for("react.memo_cache_sentinel")?(de=t.jsx(mt,{children:"Delete item?"}),e[91]=de):de=e[91];const Se=I?.title;let X;e[92]!==Se?(X=t.jsxs(ut,{children:[de,t.jsxs(ft,{children:['Are you sure you want to delete "',Se,'"? This action cannot be undone.']})]}),e[92]=Se,e[93]=X):X=e[93];let Y;e[94]!==a.delete.isPending?(Y=t.jsx(dt,{disabled:a.delete.isPending,children:"Cancel"}),e[94]=a.delete.isPending,e[95]=Y):Y=e[95];const De=a.delete.isPending?"Deleting...":"Delete";let Z;e[96]!==a.delete.isPending||e[97]!==fe||e[98]!==De?(Z=t.jsx(pt,{onClick:fe,disabled:a.delete.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:De}),e[96]=a.delete.isPending,e[97]=fe,e[98]=De,e[99]=Z):Z=e[99];let ee;e[100]!==Y||e[101]!==Z?(ee=t.jsxs(ht,{children:[Y,Z]}),e[100]=Y,e[101]=Z,e[102]=ee):ee=e[102];let te;e[103]!==X||e[104]!==ee?(te=t.jsxs(xt,{children:[X,ee]}),e[103]=X,e[104]=ee,e[105]=te):te=e[105];let se;e[106]!==we||e[107]!==te?(se=t.jsx(gt,{open:we,onOpenChange:ce,children:te}),e[106]=we,e[107]=te,e[108]=se):se=e[108];let pe;return e[109]!==R||e[110]!==Q||e[111]!==se?(pe=t.jsxs(t.Fragment,{children:[R,Q,se]}),e[109]=R,e[110]=Q,e[111]=se,e[112]=pe):pe=e[112],pe}export{as as C};
@@ -1 +1 @@
1
- import{r as I,c as P,v as y,j as s,B as oe}from"./index-0HoOnen3.js";import{c as ne,a as ie,D as le,b as re}from"./dropdown-menu-VTiqKHN9.js";import{n as Y}from"./ArrowDown-DPy5cnDQ.js";import{i as Z}from"./ArrowUp-Dx6U6WtF.js";import{i as ae}from"./Check-BIaai9j0.js";import{c as ce}from"./Grid01-C8gF-dWK.js";import{i as de}from"./List-mX8yEKmx.js";import{c as ue,T as fe,a as me,b as xe}from"./tooltip-BWlQ9UL9.js";import{T as pe,a as he,b as X,c as ge,d as be,e as ve}from"./table-CK5AQN01.js";const ee=({size:C=24,color:e="currentColor",...o})=>I.createElement("svg",{viewBox:"0 0 24 24",width:C,height:C,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...o},I.createElement("path",{d:"M5 21v-7m0-4V3m7 18v-9m0-4V3m7 18v-5m0-4V3M2 14h6m1-6h6m1 8h6"}));ee.displayName="Sliders01";const je={sm:{button:"size-7",icon:"size-4"},md:{button:"size-9",icon:"size-5"},lg:{button:"size-12",icon:"size-6"}};function we(C){const e=P.c(66),{value:o,onValueChange:a,options:t,size:f,fullWidth:d,className:r}=C,m=f===void 0?"sm":f,c=d===void 0?!1:d,b=I.useRef(null),u=I.useRef(null);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={left:0,width:0,opacity:0},e[0]=l):l=e[0];const[i,h]=I.useState(l);let x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=K=>{if(!K.current)return;const{offsetLeft:te,offsetWidth:se}=K.current;h({left:te,width:se,opacity:1})},e[1]=x):x=e[1];const j=x;let v;e[2]!==t[0].value||e[3]!==o?(v=()=>{const K=o===t[0].value?b:u;j(K)},e[2]=t[0].value,e[3]=o,e[4]=v):v=e[4];let p;e[5]!==t||e[6]!==o?(p=[o,t],e[5]=t,e[6]=o,e[7]=p):p=e[7],I.useEffect(v,p);const n=je[m];let g;e[8]!==r?(g=y("relative flex gap-0 bg-muted rounded-lg",r),e[8]=r,e[9]=g):g=e[9];let w;e[10]!==a||e[11]!==t[0].value?(w=()=>a(t[0].value),e[10]=a,e[11]=t[0].value,e[12]=w):w=e[12];const N=c?"flex-1 h-12 px-4":n.button,O=!c&&t[0].label?"px-3":"";let z;e[13]!==O||e[14]!==N?(z=y("relative z-10 flex items-center justify-center gap-2 rounded-lg transition-colors [transition-timing-function:var(--ease-out-cubic)] duration-200",N,O),e[13]=O,e[14]=N,e[15]=z):z=e[15];const A=o===t[0].value?"text-foreground":"text-muted-foreground";let k;e[16]!==n.icon||e[17]!==A?(k=y("transition-colors ease-out duration-200 flex items-center justify-center [&>svg]:size-[1em]",n.icon,A),e[16]=n.icon,e[17]=A,e[18]=k):k=e[18];let S;e[19]!==t[0].icon||e[20]!==k?(S=s.jsx("span",{className:k,children:t[0].icon}),e[19]=t[0].icon,e[20]=k,e[21]=S):S=e[21];let T;e[22]!==t[0].label||e[23]!==t[0].value||e[24]!==o?(T=t[0].label&&s.jsx("span",{className:y("text-xs transition-colors ease-out duration-200 whitespace-nowrap",o===t[0].value?"text-foreground":"text-muted-foreground"),children:t[0].label}),e[22]=t[0].label,e[23]=t[0].value,e[24]=o,e[25]=T):T=e[25];let D;e[26]!==z||e[27]!==S||e[28]!==T||e[29]!==w?(D=s.jsxs("button",{ref:b,type:"button",onClick:w,className:z,children:[S,T]}),e[26]=z,e[27]=S,e[28]=T,e[29]=w,e[30]=D):D=e[30];let M;e[31]!==a||e[32]!==t[1].value?(M=()=>a(t[1].value),e[31]=a,e[32]=t[1].value,e[33]=M):M=e[33];const q=c?"flex-1 h-12 px-4":n.button,F=!c&&t[1].label?"px-3":"";let R;e[34]!==q||e[35]!==F?(R=y("relative z-10 flex items-center justify-center gap-2 rounded-lg transition-colors [transition-timing-function:var(--ease-out-cubic)] duration-200",q,F),e[34]=q,e[35]=F,e[36]=R):R=e[36];const G=o===t[1].value?"text-foreground":"text-muted-foreground";let $;e[37]!==n.icon||e[38]!==G?($=y("transition-colors ease-out duration-200 flex items-center justify-center [&>svg]:size-[1em]",n.icon,G),e[37]=n.icon,e[38]=G,e[39]=$):$=e[39];let V;e[40]!==t[1].icon||e[41]!==$?(V=s.jsx("span",{className:$,children:t[1].icon}),e[40]=t[1].icon,e[41]=$,e[42]=V):V=e[42];let _;e[43]!==t[1].label||e[44]!==t[1].value||e[45]!==o?(_=t[1].label&&s.jsx("span",{className:y("text-xs transition-colors ease-out duration-200 whitespace-nowrap",o===t[1].value?"text-foreground":"text-muted-foreground"),children:t[1].label}),e[43]=t[1].label,e[44]=t[1].value,e[45]=o,e[46]=_):_=e[46];let L;e[47]!==M||e[48]!==R||e[49]!==V||e[50]!==_?(L=s.jsxs("button",{ref:u,type:"button",onClick:M,className:R,children:[V,_]}),e[47]=M,e[48]=R,e[49]=V,e[50]=_,e[51]=L):L=e[51];const J=c?"h-12":n.button;let E;e[52]!==J?(E=y("absolute z-0 bg-background rounded-lg border-shadow transition-all [transition-timing-function:var(--ease-out-cubic)] duration-200",J),e[52]=J,e[53]=E):E=e[53];const Q=`${i.left}px`,U=`${i.width}px`;let W;e[54]!==i.opacity||e[55]!==Q||e[56]!==U?(W={left:Q,width:U,opacity:i.opacity},e[54]=i.opacity,e[55]=Q,e[56]=U,e[57]=W):W=e[57];let B;e[58]!==E||e[59]!==W?(B=s.jsx("div",{className:E,style:W}),e[58]=E,e[59]=W,e[60]=B):B=e[60];let H;return e[61]!==D||e[62]!==L||e[63]!==B||e[64]!==g?(H=s.jsxs("div",{className:g,children:[D,L,B]}),e[61]=D,e[62]=L,e[63]=B,e[64]=g,e[65]=H):H=e[65],H}function $e(C){const e=P.c(16),{viewMode:o,onViewModeChange:a,sortKey:t,sortDirection:f,onSort:d,sortOptions:r}=C;let m;e[0]!==r?(m=r===void 0?[]:r,e[0]=r,e[1]=m):m=e[1];const c=m;let b;e[2]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(ue,{children:s.jsxs(fe,{children:[s.jsx(me,{asChild:!0,children:s.jsx(ie,{asChild:!0,children:s.jsx(oe,{variant:"outline",size:"icon",className:"size-7 border border-input",children:s.jsx(ee,{size:16})})})}),s.jsx(xe,{children:"Search filters"})]})}),e[2]=b):b=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={value:"table",icon:s.jsx(de,{})},e[3]=u):u=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=[u,{value:"cards",icon:s.jsx(ce,{})}],e[4]=l):l=e[4];let i;e[5]!==a||e[6]!==o?(i=s.jsx("div",{className:"p-2 border-b border-border",children:s.jsx(we,{value:o,onValueChange:a,fullWidth:!0,options:l})}),e[5]=a,e[6]=o,e[7]=i):i=e[7];let h;e[8]!==d||e[9]!==f||e[10]!==t||e[11]!==c?(h=c.length>0&&d&&s.jsxs("div",{className:"p-1 flex flex-col gap-0.5",children:[s.jsx("div",{className:"px-2 py-1.5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Sort by"}),c.map(j=>{const v=t===j.id;return s.jsx(ne,{onClick:()=>d(j.id),className:y("h-8 px-2 py-0 cursor-pointer",v&&"bg-accent"),children:s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[v&&s.jsx(ae,{size:16,className:"text-foreground shrink-0"}),!v&&s.jsx("div",{className:"w-4 shrink-0"}),s.jsx("span",{className:"text-sm text-foreground flex-1",children:j.label}),v&&f&&(f==="asc"?s.jsx(Z,{size:16,className:"text-foreground shrink-0"}):s.jsx(Y,{size:16,className:"text-foreground shrink-0"}))]})},j.id)})]}),e[8]=d,e[9]=f,e[10]=t,e[11]=c,e[12]=h):h=e[12];let x;return e[13]!==i||e[14]!==h?(x=s.jsxs(le,{children:[b,s.jsxs(re,{align:"end",className:"w-[200px] p-0 gap-0",children:[i,h]})]}),e[13]=i,e[14]=h,e[15]=x):x=e[15],x}function Ne(C){const e=P.c(29),{columns:o,data:a,sortKey:t,sortDirection:f,onSort:d,onRowClick:r,rowClassName:m}=C;let c;e[0]!==f?(c=function(n,g){return s.jsx("div",{className:"w-4 flex items-center justify-center",children:g&&f&&(f==="asc"?s.jsx(Z,{size:16,className:"text-muted-foreground transition-colors"}):s.jsx(Y,{size:16,className:"text-muted-foreground transition-colors"}))})},e[0]=f,e[1]=c):c=e[1];const b=c;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=function(n,g){let w="px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider";return n===g-1&&(w="px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider w-8"),w},e[2]=u):u=e[2];const l=u;let i;if(e[3]!==o||e[4]!==d||e[5]!==b||e[6]!==t){let p;e[8]!==o.length||e[9]!==d||e[10]!==b||e[11]!==t?(p=(n,g)=>{const w=t===n.id;return s.jsx(pe,{className:y(l(g,o.length),"group transition-colors select-none",n.sortable&&"hover:bg-accent cursor-pointer",n.rowClassName,n.cellClassName),onClick:n.sortable&&d?()=>d(n.id):void 0,children:s.jsxs("span",{className:"flex items-center gap-1",children:[n.header,n.sortable&&b(n.id,w)]})},n.id)},e[8]=o.length,e[9]=d,e[10]=b,e[11]=t,e[12]=p):p=e[12],i=o.map(p),e[3]=o,e[4]=d,e[5]=b,e[6]=t,e[7]=i}else i=e[7];let h;e[13]!==i?(h=s.jsx(he,{className:"border-b-0",children:s.jsx(X,{className:"h-9 hover:bg-transparent border-b border-border",children:i})}),e[13]=i,e[14]=h):h=e[14];let x;if(e[15]!==o||e[16]!==a||e[17]!==r||e[18]!==m){let p;e[20]!==o||e[21]!==r||e[22]!==m?(p=(n,g)=>{const w=m?.(n);return s.jsx(X,{"data-row-index":g,className:y("group/data-row transition-colors border-b-0 hover:bg-accent/50",r?"cursor-pointer":"",w),onClick:r?()=>r(n):void 0,children:o.map(N=>s.jsx(ge,{className:y("px-5 py-4 h-16 align-middle text-sm text-foreground",N.cellClassName,N.wrap?"whitespace-normal wrap-break-word":""),children:s.jsx("div",{className:y(N.wrap?"w-full":"min-w-0 w-full",!N.wrap&&"truncate overflow-hidden whitespace-nowrap"),children:N.render?N.render(n):N.accessor?N.accessor(n):null})},N.id))},g)},e[20]=o,e[21]=r,e[22]=m,e[23]=p):p=e[23],x=a.map(p),e[15]=o,e[16]=a,e[17]=r,e[18]=m,e[19]=x}else x=e[19];let j;e[24]!==x?(j=s.jsx(be,{children:x}),e[24]=x,e[25]=j):j=e[25];let v;return e[26]!==h||e[27]!==j?(v=s.jsxs(ve,{className:"w-full border-collapse",children:[h,j]}),e[26]=h,e[27]=j,e[28]=v):v=e[28],v}function Ve(C){const e=P.c(12),{columns:o,data:a,isLoading:t,sortKey:f,sortDirection:d,onSort:r,onRowClick:m,emptyState:c}=C;if(t===void 0?!1:t){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-muted-foreground",children:"Loading..."})}),e[0]=l):l=e[0],l}if(a.length===0){let l;e[1]!==c?(l=c||s.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"No items found"}),e[1]=c,e[2]=l):l=e[2];let i;return e[3]!==l?(i=s.jsx("div",{className:"flex items-center justify-center h-full",children:l}),e[3]=l,e[4]=i):i=e[4],i}let u;return e[5]!==o||e[6]!==a||e[7]!==m||e[8]!==r||e[9]!==d||e[10]!==f?(u=s.jsx("div",{className:"flex-1 overflow-auto",children:s.jsx(Ne,{columns:o,data:a,sortKey:f,sortDirection:d,onSort:r,onRowClick:m})}),e[5]=o,e[6]=a,e[7]=m,e[8]=r,e[9]=d,e[10]=f,e[11]=u):u=e[11],u}export{$e as C,we as V,Ve as a};
1
+ import{r as I,c as P,v as y,j as s,B as oe}from"./index-plkk4e_J.js";import{c as ne,a as ie,D as le,b as re}from"./dropdown-menu-BpyVIc2a.js";import{n as Y}from"./ArrowDown-PNhqRNxD.js";import{i as Z}from"./ArrowUp-CH0M2x4i.js";import{i as ae}from"./Check-xLOyX88L.js";import{c as ce}from"./Grid01-Z7sWikL1.js";import{i as de}from"./List-QV8E4GNR.js";import{c as ue,T as fe,a as me,b as xe}from"./tooltip-Bnw97WFs.js";import{T as pe,a as he,b as X,c as ge,d as be,e as ve}from"./table-C75ROyVe.js";const ee=({size:C=24,color:e="currentColor",...o})=>I.createElement("svg",{viewBox:"0 0 24 24",width:C,height:C,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...o},I.createElement("path",{d:"M5 21v-7m0-4V3m7 18v-9m0-4V3m7 18v-5m0-4V3M2 14h6m1-6h6m1 8h6"}));ee.displayName="Sliders01";const je={sm:{button:"size-7",icon:"size-4"},md:{button:"size-9",icon:"size-5"},lg:{button:"size-12",icon:"size-6"}};function we(C){const e=P.c(66),{value:o,onValueChange:a,options:t,size:f,fullWidth:d,className:r}=C,m=f===void 0?"sm":f,c=d===void 0?!1:d,b=I.useRef(null),u=I.useRef(null);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={left:0,width:0,opacity:0},e[0]=l):l=e[0];const[i,h]=I.useState(l);let x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=K=>{if(!K.current)return;const{offsetLeft:te,offsetWidth:se}=K.current;h({left:te,width:se,opacity:1})},e[1]=x):x=e[1];const j=x;let v;e[2]!==t[0].value||e[3]!==o?(v=()=>{const K=o===t[0].value?b:u;j(K)},e[2]=t[0].value,e[3]=o,e[4]=v):v=e[4];let p;e[5]!==t||e[6]!==o?(p=[o,t],e[5]=t,e[6]=o,e[7]=p):p=e[7],I.useEffect(v,p);const n=je[m];let g;e[8]!==r?(g=y("relative flex gap-0 bg-muted rounded-lg",r),e[8]=r,e[9]=g):g=e[9];let w;e[10]!==a||e[11]!==t[0].value?(w=()=>a(t[0].value),e[10]=a,e[11]=t[0].value,e[12]=w):w=e[12];const N=c?"flex-1 h-12 px-4":n.button,O=!c&&t[0].label?"px-3":"";let z;e[13]!==O||e[14]!==N?(z=y("relative z-10 flex items-center justify-center gap-2 rounded-lg transition-colors [transition-timing-function:var(--ease-out-cubic)] duration-200",N,O),e[13]=O,e[14]=N,e[15]=z):z=e[15];const A=o===t[0].value?"text-foreground":"text-muted-foreground";let k;e[16]!==n.icon||e[17]!==A?(k=y("transition-colors ease-out duration-200 flex items-center justify-center [&>svg]:size-[1em]",n.icon,A),e[16]=n.icon,e[17]=A,e[18]=k):k=e[18];let S;e[19]!==t[0].icon||e[20]!==k?(S=s.jsx("span",{className:k,children:t[0].icon}),e[19]=t[0].icon,e[20]=k,e[21]=S):S=e[21];let T;e[22]!==t[0].label||e[23]!==t[0].value||e[24]!==o?(T=t[0].label&&s.jsx("span",{className:y("text-xs transition-colors ease-out duration-200 whitespace-nowrap",o===t[0].value?"text-foreground":"text-muted-foreground"),children:t[0].label}),e[22]=t[0].label,e[23]=t[0].value,e[24]=o,e[25]=T):T=e[25];let D;e[26]!==z||e[27]!==S||e[28]!==T||e[29]!==w?(D=s.jsxs("button",{ref:b,type:"button",onClick:w,className:z,children:[S,T]}),e[26]=z,e[27]=S,e[28]=T,e[29]=w,e[30]=D):D=e[30];let M;e[31]!==a||e[32]!==t[1].value?(M=()=>a(t[1].value),e[31]=a,e[32]=t[1].value,e[33]=M):M=e[33];const q=c?"flex-1 h-12 px-4":n.button,F=!c&&t[1].label?"px-3":"";let R;e[34]!==q||e[35]!==F?(R=y("relative z-10 flex items-center justify-center gap-2 rounded-lg transition-colors [transition-timing-function:var(--ease-out-cubic)] duration-200",q,F),e[34]=q,e[35]=F,e[36]=R):R=e[36];const G=o===t[1].value?"text-foreground":"text-muted-foreground";let $;e[37]!==n.icon||e[38]!==G?($=y("transition-colors ease-out duration-200 flex items-center justify-center [&>svg]:size-[1em]",n.icon,G),e[37]=n.icon,e[38]=G,e[39]=$):$=e[39];let V;e[40]!==t[1].icon||e[41]!==$?(V=s.jsx("span",{className:$,children:t[1].icon}),e[40]=t[1].icon,e[41]=$,e[42]=V):V=e[42];let _;e[43]!==t[1].label||e[44]!==t[1].value||e[45]!==o?(_=t[1].label&&s.jsx("span",{className:y("text-xs transition-colors ease-out duration-200 whitespace-nowrap",o===t[1].value?"text-foreground":"text-muted-foreground"),children:t[1].label}),e[43]=t[1].label,e[44]=t[1].value,e[45]=o,e[46]=_):_=e[46];let L;e[47]!==M||e[48]!==R||e[49]!==V||e[50]!==_?(L=s.jsxs("button",{ref:u,type:"button",onClick:M,className:R,children:[V,_]}),e[47]=M,e[48]=R,e[49]=V,e[50]=_,e[51]=L):L=e[51];const J=c?"h-12":n.button;let E;e[52]!==J?(E=y("absolute z-0 bg-background rounded-lg border-shadow transition-all [transition-timing-function:var(--ease-out-cubic)] duration-200",J),e[52]=J,e[53]=E):E=e[53];const Q=`${i.left}px`,U=`${i.width}px`;let W;e[54]!==i.opacity||e[55]!==Q||e[56]!==U?(W={left:Q,width:U,opacity:i.opacity},e[54]=i.opacity,e[55]=Q,e[56]=U,e[57]=W):W=e[57];let B;e[58]!==E||e[59]!==W?(B=s.jsx("div",{className:E,style:W}),e[58]=E,e[59]=W,e[60]=B):B=e[60];let H;return e[61]!==D||e[62]!==L||e[63]!==B||e[64]!==g?(H=s.jsxs("div",{className:g,children:[D,L,B]}),e[61]=D,e[62]=L,e[63]=B,e[64]=g,e[65]=H):H=e[65],H}function $e(C){const e=P.c(16),{viewMode:o,onViewModeChange:a,sortKey:t,sortDirection:f,onSort:d,sortOptions:r}=C;let m;e[0]!==r?(m=r===void 0?[]:r,e[0]=r,e[1]=m):m=e[1];const c=m;let b;e[2]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(ue,{children:s.jsxs(fe,{children:[s.jsx(me,{asChild:!0,children:s.jsx(ie,{asChild:!0,children:s.jsx(oe,{variant:"outline",size:"icon",className:"size-7 border border-input",children:s.jsx(ee,{size:16})})})}),s.jsx(xe,{children:"Search filters"})]})}),e[2]=b):b=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={value:"table",icon:s.jsx(de,{})},e[3]=u):u=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=[u,{value:"cards",icon:s.jsx(ce,{})}],e[4]=l):l=e[4];let i;e[5]!==a||e[6]!==o?(i=s.jsx("div",{className:"p-2 border-b border-border",children:s.jsx(we,{value:o,onValueChange:a,fullWidth:!0,options:l})}),e[5]=a,e[6]=o,e[7]=i):i=e[7];let h;e[8]!==d||e[9]!==f||e[10]!==t||e[11]!==c?(h=c.length>0&&d&&s.jsxs("div",{className:"p-1 flex flex-col gap-0.5",children:[s.jsx("div",{className:"px-2 py-1.5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Sort by"}),c.map(j=>{const v=t===j.id;return s.jsx(ne,{onClick:()=>d(j.id),className:y("h-8 px-2 py-0 cursor-pointer",v&&"bg-accent"),children:s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[v&&s.jsx(ae,{size:16,className:"text-foreground shrink-0"}),!v&&s.jsx("div",{className:"w-4 shrink-0"}),s.jsx("span",{className:"text-sm text-foreground flex-1",children:j.label}),v&&f&&(f==="asc"?s.jsx(Z,{size:16,className:"text-foreground shrink-0"}):s.jsx(Y,{size:16,className:"text-foreground shrink-0"}))]})},j.id)})]}),e[8]=d,e[9]=f,e[10]=t,e[11]=c,e[12]=h):h=e[12];let x;return e[13]!==i||e[14]!==h?(x=s.jsxs(le,{children:[b,s.jsxs(re,{align:"end",className:"w-[200px] p-0 gap-0",children:[i,h]})]}),e[13]=i,e[14]=h,e[15]=x):x=e[15],x}function Ne(C){const e=P.c(29),{columns:o,data:a,sortKey:t,sortDirection:f,onSort:d,onRowClick:r,rowClassName:m}=C;let c;e[0]!==f?(c=function(n,g){return s.jsx("div",{className:"w-4 flex items-center justify-center",children:g&&f&&(f==="asc"?s.jsx(Z,{size:16,className:"text-muted-foreground transition-colors"}):s.jsx(Y,{size:16,className:"text-muted-foreground transition-colors"}))})},e[0]=f,e[1]=c):c=e[1];const b=c;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=function(n,g){let w="px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider";return n===g-1&&(w="px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider w-8"),w},e[2]=u):u=e[2];const l=u;let i;if(e[3]!==o||e[4]!==d||e[5]!==b||e[6]!==t){let p;e[8]!==o.length||e[9]!==d||e[10]!==b||e[11]!==t?(p=(n,g)=>{const w=t===n.id;return s.jsx(pe,{className:y(l(g,o.length),"group transition-colors select-none",n.sortable&&"hover:bg-accent cursor-pointer",n.rowClassName,n.cellClassName),onClick:n.sortable&&d?()=>d(n.id):void 0,children:s.jsxs("span",{className:"flex items-center gap-1",children:[n.header,n.sortable&&b(n.id,w)]})},n.id)},e[8]=o.length,e[9]=d,e[10]=b,e[11]=t,e[12]=p):p=e[12],i=o.map(p),e[3]=o,e[4]=d,e[5]=b,e[6]=t,e[7]=i}else i=e[7];let h;e[13]!==i?(h=s.jsx(he,{className:"border-b-0",children:s.jsx(X,{className:"h-9 hover:bg-transparent border-b border-border",children:i})}),e[13]=i,e[14]=h):h=e[14];let x;if(e[15]!==o||e[16]!==a||e[17]!==r||e[18]!==m){let p;e[20]!==o||e[21]!==r||e[22]!==m?(p=(n,g)=>{const w=m?.(n);return s.jsx(X,{"data-row-index":g,className:y("group/data-row transition-colors border-b-0 hover:bg-accent/50",r?"cursor-pointer":"",w),onClick:r?()=>r(n):void 0,children:o.map(N=>s.jsx(ge,{className:y("px-5 py-4 h-16 align-middle text-sm text-foreground",N.cellClassName,N.wrap?"whitespace-normal wrap-break-word":""),children:s.jsx("div",{className:y(N.wrap?"w-full":"min-w-0 w-full",!N.wrap&&"truncate overflow-hidden whitespace-nowrap"),children:N.render?N.render(n):N.accessor?N.accessor(n):null})},N.id))},g)},e[20]=o,e[21]=r,e[22]=m,e[23]=p):p=e[23],x=a.map(p),e[15]=o,e[16]=a,e[17]=r,e[18]=m,e[19]=x}else x=e[19];let j;e[24]!==x?(j=s.jsx(be,{children:x}),e[24]=x,e[25]=j):j=e[25];let v;return e[26]!==h||e[27]!==j?(v=s.jsxs(ve,{className:"w-full border-collapse",children:[h,j]}),e[26]=h,e[27]=j,e[28]=v):v=e[28],v}function Ve(C){const e=P.c(12),{columns:o,data:a,isLoading:t,sortKey:f,sortDirection:d,onSort:r,onRowClick:m,emptyState:c}=C;if(t===void 0?!1:t){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-muted-foreground",children:"Loading..."})}),e[0]=l):l=e[0],l}if(a.length===0){let l;e[1]!==c?(l=c||s.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"No items found"}),e[1]=c,e[2]=l):l=e[2];let i;return e[3]!==l?(i=s.jsx("div",{className:"flex items-center justify-center h-full",children:l}),e[3]=l,e[4]=i):i=e[4],i}let u;return e[5]!==o||e[6]!==a||e[7]!==m||e[8]!==r||e[9]!==d||e[10]!==f?(u=s.jsx("div",{className:"flex-1 overflow-auto",children:s.jsx(Ne,{columns:o,data:a,sortKey:f,sortDirection:d,onSort:r,onRowClick:m})}),e[5]=o,e[6]=a,e[7]=m,e[8]=r,e[9]=d,e[10]=f,e[11]=u):u=e[11],u}export{$e as C,we as V,Ve as a};
@@ -1 +1 @@
1
- import{c as f,v as u,j as m}from"./index-0HoOnen3.js";import{B as g}from"./badge-0EzsH3AB.js";function v(x){const e=f.c(12),{tabs:l,activeTab:n,onTabChange:s,className:a}=x;let t;e[0]!==a?(t=u("flex items-center gap-2 overflow-x-auto no-scrollbar",a),e[0]=a,e[1]=t):t=e[1];let r;if(e[2]!==n||e[3]!==s||e[4]!==l){let c;e[6]!==n||e[7]!==s?(c=o=>{const d=n===o.id;return m.jsxs("button",{type:"button",onClick:()=>s(o.id),className:u("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex gap-1.5 items-center",d&&"bg-accent border-border text-foreground",!d&&"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:[o.label,o.count!==void 0&&m.jsx(g,{variant:"secondary",className:u("h-5 min-w-5 px-1 rounded-full text-[10px] font-mono inline-flex items-center justify-center",d?"bg-background text-foreground":"bg-muted-foreground/10 text-muted-foreground"),children:o.count})]},o.id)},e[6]=n,e[7]=s,e[8]=c):c=e[8],r=l.map(c),e[2]=n,e[3]=s,e[4]=l,e[5]=r}else r=e[5];let i;return e[9]!==t||e[10]!==r?(i=m.jsx("div",{className:t,children:r}),e[9]=t,e[10]=r,e[11]=i):i=e[11],i}export{v as C};
1
+ import{c as f,v as u,j as m}from"./index-plkk4e_J.js";import{B as g}from"./badge-qrWA_kLG.js";function v(x){const e=f.c(12),{tabs:l,activeTab:n,onTabChange:s,className:a}=x;let t;e[0]!==a?(t=u("flex items-center gap-2 overflow-x-auto no-scrollbar",a),e[0]=a,e[1]=t):t=e[1];let r;if(e[2]!==n||e[3]!==s||e[4]!==l){let c;e[6]!==n||e[7]!==s?(c=o=>{const d=n===o.id;return m.jsxs("button",{type:"button",onClick:()=>s(o.id),className:u("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex gap-1.5 items-center",d&&"bg-accent border-border text-foreground",!d&&"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:[o.label,o.count!==void 0&&m.jsx(g,{variant:"secondary",className:u("h-5 min-w-5 px-1 rounded-full text-[10px] font-mono inline-flex items-center justify-center",d?"bg-background text-foreground":"bg-muted-foreground/10 text-muted-foreground"),children:o.count})]},o.id)},e[6]=n,e[7]=s,e[8]=c):c=e[8],r=l.map(c),e[2]=n,e[3]=s,e[4]=l,e[5]=r}else r=e[5];let i;return e[9]!==t||e[10]!==r?(i=m.jsx("div",{className:t,children:r}),e[9]=t,e[10]=r,e[11]=i):i=e[11],i}export{v as C};
@@ -1 +1 @@
1
- import{c as r,v as m,j as n}from"./index-0HoOnen3.js";import{_ as d}from"./index-CqCzS9v2.js";import{i}from"./SearchMd-CS2uMIPl.js";function x(l){const e=r.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=n.jsx(d,{"data-slot":"command",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}function g(l){const e=r.c(9);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(i,{className:"size-5 shrink-0 text-foreground"}),e[3]=o):o=e[3];let a;e[4]!==t?(a=m("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t),e[4]=t,e[5]=a):a=e[5];let c;return e[6]!==s||e[7]!==a?(c=n.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-10 items-center gap-2 border-b px-3",children:[o,n.jsx(d.Input,{"data-slot":"command-input",className:a,...s})]}),e[6]=s,e[7]=a,e[8]=c):c=e[8],c}function h(l){const e=r.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=n.jsx(d.List,{"data-slot":"command-list",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}function v(l){const e=r.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=n.jsx(d.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t}),e[2]=t,e[3]=s):s=e[3],s}function N(l){const e=r.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=n.jsx(d.Group,{"data-slot":"command-group",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}function b(l){const e=r.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("bg-border -mx-1 h-px",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=n.jsx(d.Separator,{"data-slot":"command-separator",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}function _(l){const e=r.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=n.jsx(d.Item,{"data-slot":"command-item",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}export{N as C,_ as a,b,v as c,h as d,x as e,g as f};
1
+ import{c as r,v as m,j as n}from"./index-plkk4e_J.js";import{_ as d}from"./index-CGrDr99B.js";import{i}from"./SearchMd-TuCoj3FU.js";function x(l){const e=r.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=n.jsx(d,{"data-slot":"command",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}function g(l){const e=r.c(9);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(i,{className:"size-5 shrink-0 text-foreground"}),e[3]=o):o=e[3];let a;e[4]!==t?(a=m("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t),e[4]=t,e[5]=a):a=e[5];let c;return e[6]!==s||e[7]!==a?(c=n.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-10 items-center gap-2 border-b px-3",children:[o,n.jsx(d.Input,{"data-slot":"command-input",className:a,...s})]}),e[6]=s,e[7]=a,e[8]=c):c=e[8],c}function h(l){const e=r.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=n.jsx(d.List,{"data-slot":"command-list",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}function v(l){const e=r.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=n.jsx(d.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t}),e[2]=t,e[3]=s):s=e[3],s}function N(l){const e=r.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=n.jsx(d.Group,{"data-slot":"command-group",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}function b(l){const e=r.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("bg-border -mx-1 h-px",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=n.jsx(d.Separator,{"data-slot":"command-separator",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}function _(l){const e=r.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=n.jsx(d.Item,{"data-slot":"command-item",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}export{N as C,_ as a,b,v as c,h as d,x as e,g as f};
@@ -1 +1 @@
1
- import{c as T,bV as M,j as e,bW as P,m as q,r as R,t as f,B as y,e as O}from"./index-0HoOnen3.js";import{u as A}from"./useQuery-CI6Jq2Tz.js";import{u as _}from"./useMutation-C13VGcqo.js";import{C as N,a as v}from"./card-c-CJHmFC.js";import{i as L,a as U}from"./mcp-oauth-D5R57Lko.js";import{c as C,C as K,a as k}from"./circle-alert-orNW2INv.js";const Q=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],D=C("external-link",Q);const H=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],w=C("loader-circle",H);const J=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],B=C("refresh-cw",J),V=t=>{const n=T.c(6);let i;n[0]!==t?({...i}=t,n[0]=t,n[1]=i):i=n[1];const{theme:a}=M(),d=a===void 0?"system":a;let r;n[2]===Symbol.for("react.memo_cache_sentinel")?(r={"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},n[2]=r):r=n[2];let m;return n[3]!==i||n[4]!==d?(m=e.jsx(P,{theme:d,className:"toaster group",style:r,...i}),n[3]=i,n[4]=d,n[5]=m):m=n[5],m},b={session:t=>["user-sandbox-session",t]};function W({sessionId:t,onComplete:n,onError:i}){const a=q(),[p,d]=R.useState(null),{data:r,isLoading:m,error:j}=A({queryKey:b.session(t),queryFn:async()=>{const s=await fetch(`/api/user-sandbox/sessions/${t}`);if(!s.ok){const o=await s.json();throw new Error(o.error||"Failed to load session")}return s.json()}}),F=_({mutationFn:async({appName:s,connectionId:o})=>{const l=await fetch(`/api/user-sandbox/sessions/${t}/configure`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:s,connection_id:o})});if(!l.ok){const u=await l.json();throw new Error(u.error||"Configuration failed")}return l.json()},onSuccess:()=>{a.invalidateQueries({queryKey:b.session(t)})}}),x=_({mutationFn:async()=>{const s=await fetch(`/api/user-sandbox/sessions/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!s.ok){const o=await s.json();throw new Error(o.error||"Failed to complete")}return s.json()},onSuccess:s=>{s.redirectUrl?window.location.href=s.redirectUrl:(f.success("Setup complete!"),a.invalidateQueries({queryKey:b.session(t)}),n?.({agentId:s.agentId,redirectUrl:s.redirectUrl}))},onError:s=>{const o=s instanceof Error?s:new Error("Failed to complete");f.error(o.message),i?.(o)}}),S=async s=>{d(s.app_name);try{const o=await fetch(`/api/user-sandbox/sessions/${t}/provision`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:s.app_name})});if(!o.ok){const g=await o.json();throw new Error(g.error||"Failed to provision connection")}const u=(await o.json()).connection_id;if(s.connection_type==="HTTP"||s.connection_type==="SSE"||s.connection_type==="Websocket"){const g=`/mcp/${u}`,z=await L({url:g,token:null});if(!z.isAuthenticated&&z.supportsOAuth){f.info("Opening authentication window...");const c=await U({connectionId:u,clientName:s.title,timeout:3e5});if(c.error)throw new Error(c.error);if(c.tokenInfo){const E=await fetch(`/api/connections/${u}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:c.tokenInfo.accessToken,refreshToken:c.tokenInfo.refreshToken,expiresIn:c.tokenInfo.expiresIn,scope:c.tokenInfo.scope,clientId:c.tokenInfo.clientId,clientSecret:c.tokenInfo.clientSecret,tokenEndpoint:c.tokenInfo.tokenEndpoint})});if(!E.ok){const $=await E.json().catch(()=>({}));throw new Error($.error||"Failed to save authentication tokens. Please try again.")}}}}await F.mutateAsync({appName:s.app_name,connectionId:u}),f.success(`${s.title} connected successfully`)}catch(o){console.error("Connection error:",o);const l=o instanceof Error?o:new Error("Failed to connect");f.error(l.message),i?.(l)}finally{d(null)}},I=r?.apps.every(s=>s.status.configured),h=r?.session.status==="completed";return m?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx(w,{className:"size-8 animate-spin text-muted-foreground"})}):j?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsx(N,{className:"max-w-md w-full",children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[e.jsx("div",{className:"size-12 rounded-full bg-destructive/10 flex items-center justify-center",children:e.jsx(K,{className:"size-6 text-destructive"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Session Error"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:j instanceof Error?j.message:"Failed to load"})]})]})})})}):r?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(V,{}),e.jsxs("div",{className:"max-w-lg mx-auto px-4 py-12",children:[e.jsxs("div",{className:"text-center mb-8",children:[r.template.icon&&e.jsx("div",{className:"size-16 mx-auto mb-4 rounded-xl bg-muted flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:r.template.icon,alt:"",className:"size-10 object-contain"})}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:r.template.title}),r.template.description&&e.jsx("p",{className:"text-muted-foreground mt-2",children:r.template.description})]}),h&&e.jsx(N,{className:"mb-6 border-green-500/20 bg-green-500/5",children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"size-10 rounded-full bg-green-500/10 flex items-center justify-center",children:e.jsx(k,{className:"size-5 text-green-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Setup Complete"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your integrations are ready to use."})]})]})})}),e.jsx("div",{className:"space-y-3",children:r.apps.map(s=>e.jsx(N,{children:e.jsx(v,{className:"py-4",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"size-10 rounded-lg bg-muted flex items-center justify-center shrink-0 overflow-hidden",children:s.icon?e.jsx("img",{src:s.icon,alt:"",className:"size-6 object-contain"}):e.jsx("span",{className:"text-lg",children:"📦"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.status.configured?e.jsxs("span",{className:"text-green-600 dark:text-green-400 flex items-center gap-1",children:[e.jsx(k,{className:"size-3"})," Connected"]}):s.requires_oauth?"Requires authentication":"Ready to connect"})]}),!s.status.configured&&!h&&e.jsx(y,{size:"sm",onClick:()=>S(s),disabled:p!==null||x.isPending,children:p===s.app_name?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"size-4 mr-2 animate-spin"}),"Connecting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(D,{className:"size-4 mr-2"}),"Connect"]})}),s.status.configured&&!h&&e.jsxs(y,{size:"sm",variant:"outline",onClick:()=>S(s),disabled:p!==null||x.isPending,children:[e.jsx(B,{className:"size-4 mr-2"}),"Reconnect"]}),h&&e.jsx("div",{className:"size-8 rounded-full bg-green-500/10 flex items-center justify-center",children:e.jsx(k,{className:"size-4 text-green-500"})})]})})},s.app_name))}),I&&!h&&e.jsx("div",{className:"mt-6",children:e.jsx(y,{className:"w-full",size:"lg",onClick:()=>x.mutate(),disabled:x.isPending,children:x.isPending?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"size-4 mr-2 animate-spin"}),"Completing..."]}):"Complete Setup"})}),e.jsx("div",{className:"mt-8 pt-6 border-t text-center",children:e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Session expires:"," ",new Date(r.session.expires_at).toLocaleString()]})})]})]}):null}function ne(){const t=T.c(3);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/connect/$sessionId"},t[0]=n):n=t[0];const{sessionId:i}=O(n);let a;return t[1]!==i?(a=e.jsx(W,{sessionId:i}),t[1]=i,t[2]=a):a=t[2],a}export{ne as default};
1
+ import{c as T,bV as M,j as e,bW as P,m as q,r as R,t as f,B as y,e as O}from"./index-plkk4e_J.js";import{u as A}from"./useQuery-D64ihcYY.js";import{u as _}from"./useMutation-D4nH_fUX.js";import{C as N,a as v}from"./card-DD-UCxfi.js";import{i as L,a as U}from"./mcp-oauth-B013QyX1.js";import{c as C,C as K,a as k}from"./circle-alert-DdDFLH9P.js";const Q=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],D=C("external-link",Q);const H=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],w=C("loader-circle",H);const J=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],B=C("refresh-cw",J),V=t=>{const n=T.c(6);let i;n[0]!==t?({...i}=t,n[0]=t,n[1]=i):i=n[1];const{theme:a}=M(),d=a===void 0?"system":a;let r;n[2]===Symbol.for("react.memo_cache_sentinel")?(r={"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},n[2]=r):r=n[2];let m;return n[3]!==i||n[4]!==d?(m=e.jsx(P,{theme:d,className:"toaster group",style:r,...i}),n[3]=i,n[4]=d,n[5]=m):m=n[5],m},b={session:t=>["user-sandbox-session",t]};function W({sessionId:t,onComplete:n,onError:i}){const a=q(),[p,d]=R.useState(null),{data:r,isLoading:m,error:j}=A({queryKey:b.session(t),queryFn:async()=>{const s=await fetch(`/api/user-sandbox/sessions/${t}`);if(!s.ok){const o=await s.json();throw new Error(o.error||"Failed to load session")}return s.json()}}),F=_({mutationFn:async({appName:s,connectionId:o})=>{const l=await fetch(`/api/user-sandbox/sessions/${t}/configure`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:s,connection_id:o})});if(!l.ok){const u=await l.json();throw new Error(u.error||"Configuration failed")}return l.json()},onSuccess:()=>{a.invalidateQueries({queryKey:b.session(t)})}}),x=_({mutationFn:async()=>{const s=await fetch(`/api/user-sandbox/sessions/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!s.ok){const o=await s.json();throw new Error(o.error||"Failed to complete")}return s.json()},onSuccess:s=>{s.redirectUrl?window.location.href=s.redirectUrl:(f.success("Setup complete!"),a.invalidateQueries({queryKey:b.session(t)}),n?.({agentId:s.agentId,redirectUrl:s.redirectUrl}))},onError:s=>{const o=s instanceof Error?s:new Error("Failed to complete");f.error(o.message),i?.(o)}}),S=async s=>{d(s.app_name);try{const o=await fetch(`/api/user-sandbox/sessions/${t}/provision`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:s.app_name})});if(!o.ok){const g=await o.json();throw new Error(g.error||"Failed to provision connection")}const u=(await o.json()).connection_id;if(s.connection_type==="HTTP"||s.connection_type==="SSE"||s.connection_type==="Websocket"){const g=`/mcp/${u}`,z=await L({url:g,token:null});if(!z.isAuthenticated&&z.supportsOAuth){f.info("Opening authentication window...");const c=await U({connectionId:u,clientName:s.title,timeout:3e5});if(c.error)throw new Error(c.error);if(c.tokenInfo){const E=await fetch(`/api/connections/${u}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:c.tokenInfo.accessToken,refreshToken:c.tokenInfo.refreshToken,expiresIn:c.tokenInfo.expiresIn,scope:c.tokenInfo.scope,clientId:c.tokenInfo.clientId,clientSecret:c.tokenInfo.clientSecret,tokenEndpoint:c.tokenInfo.tokenEndpoint})});if(!E.ok){const $=await E.json().catch(()=>({}));throw new Error($.error||"Failed to save authentication tokens. Please try again.")}}}}await F.mutateAsync({appName:s.app_name,connectionId:u}),f.success(`${s.title} connected successfully`)}catch(o){console.error("Connection error:",o);const l=o instanceof Error?o:new Error("Failed to connect");f.error(l.message),i?.(l)}finally{d(null)}},I=r?.apps.every(s=>s.status.configured),h=r?.session.status==="completed";return m?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx(w,{className:"size-8 animate-spin text-muted-foreground"})}):j?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsx(N,{className:"max-w-md w-full",children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[e.jsx("div",{className:"size-12 rounded-full bg-destructive/10 flex items-center justify-center",children:e.jsx(K,{className:"size-6 text-destructive"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Session Error"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:j instanceof Error?j.message:"Failed to load"})]})]})})})}):r?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(V,{}),e.jsxs("div",{className:"max-w-lg mx-auto px-4 py-12",children:[e.jsxs("div",{className:"text-center mb-8",children:[r.template.icon&&e.jsx("div",{className:"size-16 mx-auto mb-4 rounded-xl bg-muted flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:r.template.icon,alt:"",className:"size-10 object-contain"})}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:r.template.title}),r.template.description&&e.jsx("p",{className:"text-muted-foreground mt-2",children:r.template.description})]}),h&&e.jsx(N,{className:"mb-6 border-green-500/20 bg-green-500/5",children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"size-10 rounded-full bg-green-500/10 flex items-center justify-center",children:e.jsx(k,{className:"size-5 text-green-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Setup Complete"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your integrations are ready to use."})]})]})})}),e.jsx("div",{className:"space-y-3",children:r.apps.map(s=>e.jsx(N,{children:e.jsx(v,{className:"py-4",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"size-10 rounded-lg bg-muted flex items-center justify-center shrink-0 overflow-hidden",children:s.icon?e.jsx("img",{src:s.icon,alt:"",className:"size-6 object-contain"}):e.jsx("span",{className:"text-lg",children:"📦"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.status.configured?e.jsxs("span",{className:"text-green-600 dark:text-green-400 flex items-center gap-1",children:[e.jsx(k,{className:"size-3"})," Connected"]}):s.requires_oauth?"Requires authentication":"Ready to connect"})]}),!s.status.configured&&!h&&e.jsx(y,{size:"sm",onClick:()=>S(s),disabled:p!==null||x.isPending,children:p===s.app_name?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"size-4 mr-2 animate-spin"}),"Connecting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(D,{className:"size-4 mr-2"}),"Connect"]})}),s.status.configured&&!h&&e.jsxs(y,{size:"sm",variant:"outline",onClick:()=>S(s),disabled:p!==null||x.isPending,children:[e.jsx(B,{className:"size-4 mr-2"}),"Reconnect"]}),h&&e.jsx("div",{className:"size-8 rounded-full bg-green-500/10 flex items-center justify-center",children:e.jsx(k,{className:"size-4 text-green-500"})})]})})},s.app_name))}),I&&!h&&e.jsx("div",{className:"mt-6",children:e.jsx(y,{className:"w-full",size:"lg",onClick:()=>x.mutate(),disabled:x.isPending,children:x.isPending?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"size-4 mr-2 animate-spin"}),"Completing..."]}):"Complete Setup"})}),e.jsx("div",{className:"mt-8 pt-6 border-t text-center",children:e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Session expires:"," ",new Date(r.session.expires_at).toLocaleString()]})})]})]}):null}function ne(){const t=T.c(3);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/connect/$sessionId"},t[0]=n):n=t[0];const{sessionId:i}=O(n);let a;return t[1]!==i?(a=e.jsx(W,{sessionId:i}),t[1]=i,t[2]=a):a=t[2],a}export{ne as default};
@@ -1 +1 @@
1
- import{c as $,v as N,j as t}from"./index-0HoOnen3.js";import{C as q}from"./card-c-CJHmFC.js";import{I as B}from"./integration-icon-5VjL1GgL.js";function K(g){const e=$.c(46),{connection:s,onClick:C,headerActions:b,body:k,footer:y,className:I,size:A,fallbackIcon:w}=g,E=A===void 0?"md":A,i=E==="sm"?"p-4":"p-6",P=E==="sm"?"text-sm":"text-base",R=E==="sm"?"text-xs":"text-sm",S=C&&"hover:bg-muted/50";let l;e[0]!==I||e[1]!==S?(l=N("cursor-pointer transition-colors group overflow-hidden flex flex-col",S,I),e[0]=I,e[1]=S,e[2]=l):l=e[2];let o;e[3]!==i?(o=N("flex flex-col gap-4",i),e[3]=i,e[4]=o):o=e[4];let n;e[5]!==s.icon||e[6]!==s.title||e[7]!==w?(n=t.jsx(B,{icon:s.icon,name:s.title,size:"md",className:"shrink-0 shadow-sm",fallbackIcon:w}),e[5]=s.icon,e[6]=s.title,e[7]=w,e[8]=n):n=e[8];let c;e[9]!==b?(c=b&&t.jsx("div",{className:N("transition-opacity","opacity-0 group-hover:opacity-100"),onClick:F,children:b}),e[9]=b,e[10]=c):c=e[10];let r;e[11]!==c?(r=t.jsx("div",{className:"relative",children:c}),e[11]=c,e[12]=r):r=e[12];let a;e[13]!==n||e[14]!==r?(a=t.jsxs("div",{className:"flex items-start justify-between",children:[n,r]}),e[13]=n,e[14]=r,e[15]=a):a=e[15];let d;e[16]!==P?(d=N("font-medium text-foreground truncate",P),e[16]=P,e[17]=d):d=e[17];let m;e[18]!==s.title||e[19]!==d?(m=t.jsx("h3",{className:d,children:s.title}),e[18]=s.title,e[19]=d,e[20]=m):m=e[20];let f;e[21]!==R?(f=N("text-muted-foreground line-clamp-2",R),e[21]=R,e[22]=f):f=e[22];const _=s.description||"No description";let x;e[23]!==f||e[24]!==_?(x=t.jsx("p",{className:f,children:_}),e[23]=f,e[24]=_,e[25]=x):x=e[25];let p;e[26]!==m||e[27]!==x?(p=t.jsxs("div",{className:"flex flex-col gap-0",children:[m,x]}),e[26]=m,e[27]=x,e[28]=p):p=e[28];let h;e[29]!==k?(h=k&&t.jsx("div",{children:k}),e[29]=k,e[30]=h):h=e[30];let u;e[31]!==p||e[32]!==h||e[33]!==o||e[34]!==a?(u=t.jsxs("div",{className:o,children:[a,p,h]}),e[31]=p,e[32]=h,e[33]=o,e[34]=a,e[35]=u):u=e[35];let j;e[36]!==y||e[37]!==i?(j=y&&t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:N("h-14 flex items-center",i),onClick:D,children:y})}),e[36]=y,e[37]=i,e[38]=j):j=e[38];let v;e[39]!==u||e[40]!==j?(v=t.jsxs("div",{className:"flex flex-col flex-1",children:[u,j]}),e[39]=u,e[40]=j,e[41]=v):v=e[41];let z;return e[42]!==C||e[43]!==v||e[44]!==l?(z=t.jsx(q,{className:l,onClick:C,children:v}),e[42]=C,e[43]=v,e[44]=l,e[45]=z):z=e[45],z}function D(g){return g.stopPropagation()}function F(g){return g.stopPropagation()}export{K as C};
1
+ import{c as $,v as N,j as t}from"./index-plkk4e_J.js";import{C as q}from"./card-DD-UCxfi.js";import{I as B}from"./integration-icon-KIbgHijj.js";function K(g){const e=$.c(46),{connection:s,onClick:C,headerActions:b,body:k,footer:y,className:I,size:A,fallbackIcon:w}=g,E=A===void 0?"md":A,i=E==="sm"?"p-4":"p-6",P=E==="sm"?"text-sm":"text-base",R=E==="sm"?"text-xs":"text-sm",S=C&&"hover:bg-muted/50";let l;e[0]!==I||e[1]!==S?(l=N("cursor-pointer transition-colors group overflow-hidden flex flex-col",S,I),e[0]=I,e[1]=S,e[2]=l):l=e[2];let o;e[3]!==i?(o=N("flex flex-col gap-4",i),e[3]=i,e[4]=o):o=e[4];let n;e[5]!==s.icon||e[6]!==s.title||e[7]!==w?(n=t.jsx(B,{icon:s.icon,name:s.title,size:"md",className:"shrink-0 shadow-sm",fallbackIcon:w}),e[5]=s.icon,e[6]=s.title,e[7]=w,e[8]=n):n=e[8];let c;e[9]!==b?(c=b&&t.jsx("div",{className:N("transition-opacity","opacity-0 group-hover:opacity-100"),onClick:F,children:b}),e[9]=b,e[10]=c):c=e[10];let r;e[11]!==c?(r=t.jsx("div",{className:"relative",children:c}),e[11]=c,e[12]=r):r=e[12];let a;e[13]!==n||e[14]!==r?(a=t.jsxs("div",{className:"flex items-start justify-between",children:[n,r]}),e[13]=n,e[14]=r,e[15]=a):a=e[15];let d;e[16]!==P?(d=N("font-medium text-foreground truncate",P),e[16]=P,e[17]=d):d=e[17];let m;e[18]!==s.title||e[19]!==d?(m=t.jsx("h3",{className:d,children:s.title}),e[18]=s.title,e[19]=d,e[20]=m):m=e[20];let f;e[21]!==R?(f=N("text-muted-foreground line-clamp-2",R),e[21]=R,e[22]=f):f=e[22];const _=s.description||"No description";let x;e[23]!==f||e[24]!==_?(x=t.jsx("p",{className:f,children:_}),e[23]=f,e[24]=_,e[25]=x):x=e[25];let p;e[26]!==m||e[27]!==x?(p=t.jsxs("div",{className:"flex flex-col gap-0",children:[m,x]}),e[26]=m,e[27]=x,e[28]=p):p=e[28];let h;e[29]!==k?(h=k&&t.jsx("div",{children:k}),e[29]=k,e[30]=h):h=e[30];let u;e[31]!==p||e[32]!==h||e[33]!==o||e[34]!==a?(u=t.jsxs("div",{className:o,children:[a,p,h]}),e[31]=p,e[32]=h,e[33]=o,e[34]=a,e[35]=u):u=e[35];let j;e[36]!==y||e[37]!==i?(j=y&&t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:N("h-14 flex items-center",i),onClick:D,children:y})}),e[36]=y,e[37]=i,e[38]=j):j=e[38];let v;e[39]!==u||e[40]!==j?(v=t.jsxs("div",{className:"flex flex-col flex-1",children:[u,j]}),e[39]=u,e[40]=j,e[41]=v):v=e[41];let z;return e[42]!==C||e[43]!==v||e[44]!==l?(z=t.jsx(q,{className:l,onClick:C,children:v}),e[42]=C,e[43]=v,e[44]=l,e[45]=z):z=e[45],z}function D(g){return g.stopPropagation()}function F(g){return g.stopPropagation()}export{K as C};
@@ -0,0 +1 @@
1
+ import{c as F,j as t,b as Ne,B as Ue,O as ge,aE as it,u as Be,b_ as Qe,az as gt,p as jt,r as X,o as at,bF as bt,bN as vt,s as z,aA as Ge,aB as Nt,E as ct,e as yt,a as _t,m as Ct,k as St,l as wt,i as Tt,t as ve,K as Je}from"./index-plkk4e_J.js";import{E as Z,C as ze}from"./collection-search-CxUg-xAQ.js";import{E as kt,r as Pt,e as lt}from"./env-vars-editor-Nr3mWxuy.js";import{g as Ke}from"./types-C3qz9fLX.js";import{S as It}from"./save-actions-D1fibul5.js";import{b as $t,a as At}from"./use-binding-BnDQaQ8a.js";import{u as Vt,S as Mt}from"./index-DWQkOhqZ.js";import{f as Dt,g as dt}from"./use-connection-CQasYzzj.js";import{u as mt}from"./constants-CilfzTas.js";import{d as Ot}from"./use-mcp-tools-CvszUz7q.js";import{b as Et,e as Rt}from"./use-mcp-prompts-CN7UYKcE.js";import{a as Lt}from"./mcp-oauth-B013QyX1.js";import{b as Ye,c as Ut,d as Ft,e as Bt,B as zt,a as Kt}from"./breadcrumb-Zdkq43pK.js";import{C as Xt}from"./collection-tabs-BjWYcsD2.js";import{i as Oe}from"./Loading01-CWvnRL6a.js";import{V as Xe,a as Ht}from"./layout-eozNid8i.js";import{C as Wt}from"./collection-tab-C62wXALQ.js";import{I as Ee}from"./integration-icon-KIbgHijj.js";import{B as Fe}from"./badge-qrWA_kLG.js";import{D as qt,a as Qt,b as Gt,c as Ze}from"./dropdown-menu-BpyVIc2a.js";import{F as W,a as Jt,b as q,d as K,f as Q,c as Y,e as Yt}from"./form-BP7dMbdn.js";import{I as G}from"./input-CmqvOeLB.js";import{S as et,a as tt,b as st,c as nt,d as H}from"./select-DzSheW-c.js";import{i as ut}from"./CheckCircle-D15lJ7XR.js";import{t as Zt}from"./ChevronDown-p63TAVBS.js";import{n as es}from"./Container-ufACj1Zy.js";import{s as De}from"./Globe02-CGDduE0L.js";import{s as ts}from"./RefreshCcw01-DCPzxJqp.js";import{i as ss}from"./Terminal-D1kaOGFC.js";import{s as ns}from"./Trash01-CPjIZLEP.js";import{t as He}from"./Users03-C6jjP916.js";import{s as os}from"./XClose-BvPNH9hN.js";import{U as rs}from"./use-list-state-BDwJVbli.js";import{b as is,a as as}from"./use-virtual-mcp-CcREhkTd.js";import{i as cs}from"./ChevronRight-D_Ht_JRW.js";import{s as ls}from"./Plus-C-k6EyqD.js";import{f as ds}from"./formatDistanceToNow-Cb2QZZJn.js";import{a as pt,C as ft}from"./collection-table-wrapper-Bz8WElPd.js";import{C as We}from"./card-DD-UCxfi.js";import{R as ms}from"./readme-viewer-ClGynTaO.js";import{T as us,a as ps}from"./tools-list-DcUxVw8u.js";import{M as fs}from"./index-CDOpTYgU.js";import"./SearchMd-TuCoj3FU.js";import"./Save01-SegoBYVF.js";import"./binder-13i_lQ0c.js";import"./File06-BM5aCl-O.js";import"./Key01-LKATn8lY.js";import"./constants-CbHMb0-K.js";import"./registry-utils-CT2cHZWq.js";import"./extract-connection-data-DFqYDb10.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-GXYG5L7Y.js";import"./index-CG50wTGS.js";import"./circle-alert-DdDFLH9P.js";import"./index-CCY7DImO.js";import"./index-CGrDr99B.js";import"./context-CkGm0UTl.js";import"./decopilot-events-Brt4gAR6.js";import"./use-llm-BwSqXALL.js";import"./useQuery-D64ihcYY.js";import"./localstorage-keys-v0BD3Bnj.js";import"./useMutation-D4nH_fUX.js";import"./skeleton-Ddk21_zG.js";import"./checkbox-C_Pgnv4n.js";import"./Check-xLOyX88L.js";import"./dialog-iHT0i0tz.js";import"./X-tkzrbQVp.js";import"./AlignLeft-BgC5LMd0.js";import"./ArrowLeft-wS11NpwF.js";import"./Image01-CuKvPASB.js";import"./Settings01-DovilCf0.js";import"./useSuspenseInfiniteQuery-D2GBejOt.js";import"./infiniteQueryObserver-DaMN_U7y.js";import"./index-0ocXQ777.js";import"./use-mobile-DLdIzb3b.js";import"./tooltip-Bnw97WFs.js";import"./index-BHlJRTz3.js";import"./Copy01-HMjceblh.js";import"./DotsVertical-Bda0yV1s.js";import"./Edit01-BF7NKi37.js";import"./Eye-jbWvzlxk.js";import"./empty-state-ozmf3847.js";import"./Inbox01-CglLjipa.js";import"./alert-dialog-COYgvBCq.js";import"./label-bnFjyLyV.js";import"./avatar-B9DZwrpo.js";import"./use-view-mode-v-cu8Xdx.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./ArrowDown-PNhqRNxD.js";import"./ArrowUp-CH0M2x4i.js";import"./Grid01-Z7sWikL1.js";import"./List-QV8E4GNR.js";import"./table-C75ROyVe.js";import"./popover-BIhQBNxG.js";import"./spinner-DThNWGT1.js";import"./usage-B8eRkRZY.js";import"./XCircle-Cs5fpSB3.js";import"./AlertCircle-0hiOc8CZ.js";import"./use-copy-Co7gHvim.js";import"./tabs-CgeHjw7d.js";import"./use-deco-chat-open-DzCwN_oU.js";import"./Code01-CvvU9TcF.js";import"./use-create-virtual-mcp-D-bJGh_Q.js";import"./marked.esm-BaswSlok.js";import"./markdown-CPbw-_yp.js";import"./Clock-DrIhUE6G.js";function xs(s){const e=F.c(14),{virtualMcp:n,org:o}=s;let i;e[0]!==o||e[1]!==n.id?(i={org:o,project:ge,agentId:n.id},e[0]=o,e[1]=n.id,e[2]=i):i=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(He,{size:16}),e[3]=a):a=e[3];let l;e[4]!==n.icon||e[5]!==n.title?(l=t.jsx(Ee,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:a}),e[4]=n.icon,e[5]=n.title,e[6]=l):l=e[6];let g;e[7]!==n.title?(g=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[7]=n.title,e[8]=g):g=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(cs,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[9]=x):x=e[9];let m;return e[10]!==i||e[11]!==l||e[12]!==g?(m=t.jsxs(it,{to:"/$org/$project/agents/$agentId",params:i,className:"flex items-center gap-3 p-2 pr-1 rounded-lg hover:bg-muted/50 transition-colors group",children:[l,g,x]}),e[10]=i,e[11]=l,e[12]=g,e[13]=m):m=e[13],m}function ot(s){const e=F.c(20),{connectionId:n,connectionTitle:o,connectionDescription:i,connectionIcon:a,org:l,hasExistingVirtualMcps:g}=s,x=Ne(),m=as();let f;e[0]!==m.create||e[1]!==i||e[2]!==a||e[3]!==n||e[4]!==o||e[5]!==x||e[6]!==l?(f=async()=>{const d=await m.create.mutateAsync({title:`${o} Agent`,description:i??null,icon:a??null,status:"active",connections:[{connection_id:n,selected_tools:null,selected_resources:null,selected_prompts:null}]});x({to:"/$org/$project/agents/$agentId",params:{org:l,project:ge,agentId:d.id}})},e[0]=m.create,e[1]=i,e[2]=a,e[3]=n,e[4]=o,e[5]=x,e[6]=l,e[7]=f):f=e[7];const c=f;if(g){let d;e[8]!==m.create.isPending?(d=m.create.isPending?t.jsx(Oe,{size:16,className:"animate-spin"}):t.jsx(ls,{size:16}),e[8]=m.create.isPending,e[9]=d):d=e[9];let u;return e[10]!==m.create.isPending||e[11]!==c||e[12]!==d?(u=t.jsx(Ue,{variant:"ghost",className:"size-6 p-0",onClick:c,disabled:m.create.isPending,children:d}),e[10]=m.create.isPending,e[11]=c,e[12]=d,e[13]=u):u=e[13],u}let r;e[14]!==m.create.isPending?(r=m.create.isPending?t.jsx(Oe,{className:"animate-spin text-muted-foreground"}):t.jsx(He,{className:"size-3 text-muted-foreground"}),e[14]=m.create.isPending,e[15]=r):r=e[15];let h;return e[16]!==m.create.isPending||e[17]!==c||e[18]!==r?(h=t.jsxs(Ue,{variant:"outline",size:"sm",onClick:c,disabled:m.create.isPending,children:[r,"Create an agent"]}),e[16]=m.create.isPending,e[17]=c,e[18]=r,e[19]=h):h=e[19],h}function hs(s){const e=F.c(26),{connectionId:n,connectionTitle:o,connectionDescription:i,connectionIcon:a,org:l}=s;let g;e[0]!==n?(g={filters:[{column:"connection_id",value:n}]},e[0]=n,e[1]=g):g=e[1];const x=is(g);if(!(x.length>0)){let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("h4",{className:"text-xs text-muted-foreground font-medium",children:"Use in your IDE"}),e[2]=u):u=e[2];let b;return e[3]!==i||e[4]!==a||e[5]!==n||e[6]!==o||e[7]!==l?(b=t.jsxs("div",{className:"p-5 flex items-center justify-between gap-3",children:[u,t.jsx(ot,{connectionId:n,connectionTitle:o,connectionDescription:i,connectionIcon:a,org:l,hasExistingVirtualMcps:!1})]}),e[3]=i,e[4]=a,e[5]=n,e[6]=o,e[7]=l,e[8]=b):b=e[8],b}let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("h4",{className:"text-xs text-muted-foreground font-medium",children:"Agents"}),e[9]=f):f=e[9];let c;e[10]!==i||e[11]!==a||e[12]!==n||e[13]!==o||e[14]!==l?(c=t.jsx("div",{className:"flex flex-col gap-1",children:t.jsxs("div",{className:"flex items-center justify-between",children:[f,t.jsx(ot,{connectionId:n,connectionTitle:o,connectionDescription:i,connectionIcon:a,org:l,hasExistingVirtualMcps:!0})]})}),e[10]=i,e[11]=a,e[12]=n,e[13]=o,e[14]=l,e[15]=c):c=e[15];let r;if(e[16]!==l||e[17]!==x){let u;e[19]!==l?(u=b=>t.jsx(xs,{virtualMcp:b,org:l},b.id),e[19]=l,e[20]=u):u=e[20],r=x.map(u),e[16]=l,e[17]=x,e[18]=r}else r=e[18];let h;e[21]!==r?(h=t.jsx("div",{className:"flex flex-col gap-2",children:r}),e[21]=r,e[22]=h):h=e[22];let d;return e[23]!==c||e[24]!==h?(d=t.jsxs("div",{className:"p-5 flex flex-col gap-3",children:[c,h]}),e[23]=c,e[24]=h,e[25]=d):d=e[25],d}function gs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:o,onRemoveOAuth:i}){const a=Qe({control:s.control,name:"ui_type"}),l=Qe({control:s.control,name:"connection_url"}),{stdioEnabled:g}=gt(),x=(()=>{if(typeof l!="string"||!l)return!1;try{const r=new URL(l);return r.hostname==="api.githubcopilot.com"&&r.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),m=g||e.connection_type==="STDIO",f=e.connection_type==="VIRTUAL",c=f?jt(e.connection_url):null;return f?t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",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(He,{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."})]}),c&&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:c})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[t.jsx(W,{control:s.control,name:"ui_type",render:({field:r})=>t.jsxs(q,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),a!=="NPX"&&a!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(et,{value:r.value,onValueChange:r.onChange,children:[t.jsx(K,{children:t.jsxs(tt,{className:"h-10 w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(De,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(st,{})]})}),t.jsxs(nt,{children:[t.jsx(H,{value:"HTTP",children:"HTTP"}),t.jsx(H,{value:"SSE",children:"SSE"}),t.jsx(H,{value:"Websocket",children:"Websocket"}),m&&t.jsxs(t.Fragment,{children:[t.jsx(H,{value:"NPX",children:"NPX Package"}),t.jsx(H,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(W,{control:s.control,name:"connection_url",render:({field:h})=>t.jsx(q,{className:"flex-1 min-w-0",children:t.jsx(K,{children:t.jsx(G,{placeholder:"https://example.com/mcp",...h,value:h.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(et,{value:r.value,onValueChange:r.onChange,children:[t.jsx(K,{children:t.jsx(tt,{className:"h-10",children:t.jsx(st,{})})}),t.jsxs(nt,{children:[t.jsx(H,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(De,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(H,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(De,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(H,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(De,{className:"w-4 h-4"}),"Websocket"]})}),m&&t.jsxs(t.Fragment,{children:[t.jsx(H,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(es,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(H,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ss,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(Q,{})]})}),a==="NPX"&&t.jsx(W,{control:s.control,name:"npx_package",render:({field:r})=>t.jsxs(q,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(K,{children:t.jsx(G,{placeholder:"@perplexity-ai/mcp-server",...r,value:r.value||"",className:"h-10 rounded-lg"})}),t.jsx(Q,{})]})}),a==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(W,{control:s.control,name:"stdio_command",render:({field:r})=>t.jsxs(q,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(K,{children:t.jsx(G,{placeholder:"node, bun, python...",...r,value:r.value||"",className:"h-10 rounded-lg"})}),t.jsx(Q,{})]})}),t.jsx(W,{control:s.control,name:"stdio_args",render:({field:r})=>t.jsxs(q,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(K,{children:t.jsx(G,{placeholder:"arg1 arg2 --flag value",...r,value:r.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(Q,{})]})})]}),t.jsx(W,{control:s.control,name:"stdio_cwd",render:({field:r})=>t.jsxs(q,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(K,{children:t.jsx(G,{placeholder:"/path/to/project (optional)",...r,value:r.value||"",className:"h-10 rounded-lg"})}),t.jsx(Q,{})]})})]}),(a==="NPX"||a==="STDIO")&&t.jsx(W,{control:s.control,name:"env_vars",render:({field:r})=>t.jsxs(q,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(K,{children:t.jsx(kt,{value:r.value??[],onChange:r.onChange})}),t.jsx(Q,{})]})}),a!=="NPX"&&a!=="STDIO"&&t.jsx(W,{control:s.control,name:"connection_token",render:({field:r})=>t.jsxs(q,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:x?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(qt,{children:[t.jsx(Qt,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Fe,{variant:"success",className:"gap-1.5",children:[t.jsx(ut,{size:12}),"Authenticated via OAuth",t.jsx(Zt,{size:12})]})})}),t.jsxs(Gt,{align:"start",children:[t.jsxs(Ze,{onClick:o,children:[t.jsx(ts,{size:16}),"Re-authenticate"]}),t.jsxs(Ze,{variant:"destructive",onClick:i,children:[t.jsx(ns,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&r.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:()=>r.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(os,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(K,{children:t.jsx(G,{type:"password",placeholder:x?"Paste your GitHub PAT":"Enter access token...",...r,value:r.value||"",className:"h-10 rounded-lg"})}),x&&t.jsxs(Yt,{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(Q,{})]})})]})}function js(s){const e=F.c(43),{form:n,connection:o,isMCPAuthenticated:i,hasOAuthToken:a,onReauthenticate:l,onRemoveOAuth:g}=s,{org:x}=Be();let m;e[0]!==o.icon||e[1]!==o.title?(m=t.jsx(Ee,{icon:o.icon,name:o.title,size:"lg",className:"shadow-sm"}),e[0]=o.icon,e[1]=o.title,e[2]=m):m=e[2];let f;e[3]!==n.control?(f=t.jsxs("div",{className:"flex flex-col",children:[t.jsx(W,{control:n.control,name:"title",render:vs}),t.jsx(W,{control:n.control,name:"description",render:bs})]}),e[3]=n.control,e[4]=f):f=e[4];let c;e[5]!==m||e[6]!==f?(c=t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[m,f]}),e[5]=m,e[6]=f,e[7]=c):c=e[7];let r;e[8]!==o||e[9]!==n||e[10]!==a||e[11]!==l||e[12]!==g?(r=t.jsx(gs,{form:n,connection:o,hasOAuthToken:a,onReauthenticate:l,onRemoveOAuth:g}),e[8]=o,e[9]=n,e[10]=a,e[11]=l,e[12]=g,e[13]=r):r=e[13];let h;e[14]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Status"}),e[14]=h):h=e[14];let d;e[15]!==i?(d=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[h,i?t.jsxs(Fe,{variant:"success",className:"gap-1.5 bg-success-foreground text-success",children:[t.jsx(ut,{size:12}),"Connected"]}):t.jsx(Fe,{variant:"outline",className:"text-muted-foreground",children:"Not connected"})]}),e[15]=i,e[16]=d):d=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Created by"}),e[17]=u):u=e[17];let b;e[18]!==o.created_by?(b=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[u,t.jsx(rs,{id:o.created_by,size:"2xs"})]}),e[18]=o.created_by,e[19]=b):b=e[19];let v;e[20]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Updated"}),e[20]=v):v=e[20];let _;e[21]!==o.updated_at?(_=o.updated_at?ds(new Date(o.updated_at),{addSuffix:!0}):"Unknown",e[21]=o.updated_at,e[22]=_):_=e[22];let I;e[23]!==_?(I=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[v,t.jsx("span",{className:"text-sm text-foreground",children:_})]}),e[23]=_,e[24]=I):I=e[24];let p;e[25]!==I||e[26]!==d||e[27]!==b?(p=t.jsxs("div",{className:"flex flex-col gap-2 p-5 border-b border-border",children:[d,b,I]}),e[25]=I,e[26]=d,e[27]=b,e[28]=p):p=e[28];let S;e[29]!==o.description||e[30]!==o.icon||e[31]!==o.id||e[32]!==o.title||e[33]!==x.slug?(S=t.jsx(hs,{connectionId:o.id,connectionTitle:o.title,connectionDescription:o.description,connectionIcon:o.icon,org:x.slug}),e[29]=o.description,e[30]=o.icon,e[31]=o.id,e[32]=o.title,e[33]=x.slug,e[34]=S):S=e[34];let w;e[35]!==p||e[36]!==S||e[37]!==c||e[38]!==r?(w=t.jsxs("div",{className:"flex flex-col h-full overflow-auto",children:[c,r,p,S]}),e[35]=p,e[36]=S,e[37]=c,e[38]=r,e[39]=w):w=e[39];let j;return e[40]!==n||e[41]!==w?(j=t.jsx(Jt,{...n,children:w}),e[40]=n,e[41]=w,e[42]=j):j=e[42],j}function bs(s){const{field:e}=s;return t.jsxs(q,{className:"w-full space-y-0",children:[t.jsx(K,{children:t.jsx(G,{...e,value:e.value||"",className:"h-auto py-0.5 text-base text-muted-foreground leading-6 px-2 -mx-2 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Add a description..."})}),t.jsx(Q,{})]})}function vs(s){const{field:e}=s;return t.jsxs(q,{className:"flex-1 space-y-0",children:[t.jsx(K,{children:t.jsx(G,{...e,className:"h-auto py-0.5 text-lg! font-medium leading-7 px-2 -mx-2 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Connection Name"})}),t.jsx(Q,{})]})}function Ns(s){const e=F.c(39),{prompts:n,connectionId:o,org:i,onPromptClick:a,showToolbar:l,emptyMessage:g}=s,x=l===void 0?!0:l,m=g===void 0?"This connection doesn't have any prompts yet.":g,f=Ne(),[c,r]=X.useState(""),[h,d]=X.useState("table"),[u,b]=X.useState("name"),[v,_]=X.useState("asc");let I;e[0]!==v||e[1]!==u?(I=C=>{u===C?(_(ws),v==="desc"&&b(void 0)):(b(C),_("asc"))},e[0]=v,e[1]=u,e[2]=I):I=e[2];const p=I;let S;e[3]!==o||e[4]!==f||e[5]!==a||e[6]!==i?(S=C=>{a?a(C):o&&i&&f({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:i,project:ge,connectionId:o,collectionName:"prompts",itemId:encodeURIComponent(C.name)}})},e[3]=o,e[4]=f,e[5]=a,e[6]=i,e[7]=S):S=e[7];const w=S;let j;if(e[8]!==n||e[9]!==c||e[10]!==v||e[11]!==u){const C=!n||n.length===0?[]:c.trim()?(()=>{const O=c.toLowerCase();return n.filter(B=>B.name.toLowerCase().includes(O)||B.description&&B.description.toLowerCase().includes(O))})():n;j=!u||!v?C:[...C].sort((O,B)=>{const je=O[u]||"",ee=B[u]||"",J=String(je).localeCompare(String(ee));return v==="asc"?J:-J}),e[8]=n,e[9]=c,e[10]=v,e[11]=u,e[12]=j}else j=e[12];const $=j;let k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=[{id:"name",header:"Name",render:Ss,sortable:!0},{id:"description",header:"Description",render:Cs,cellClassName:"flex-1",sortable:!0}],e[13]=k):k=e[13];const R=k;let V;e[14]===Symbol.for("react.memo_cache_sentinel")?(V=R.filter(_s).map(ys),e[14]=V):V=e[14];const M=V;let y;e[15]!==p||e[16]!==x||e[17]!==v||e[18]!==u||e[19]!==h?(y=x&&t.jsx(Xe,{children:t.jsx(ft,{viewMode:h,onViewModeChange:d,sortKey:u,sortDirection:v,onSort:p,sortOptions:M})}),e[15]=p,e[16]=x,e[17]=v,e[18]=u,e[19]=h,e[20]=y):y=e[20];let L;e[21]===Symbol.for("react.memo_cache_sentinel")?(L=C=>{C.key==="Escape"&&(r(""),C.target.blur())},e[21]=L):L=e[21];let A;e[22]!==c?(A=t.jsx(ze,{value:c,onChange:r,placeholder:"Search prompts...",onKeyDown:L}),e[22]=c,e[23]=A):A=e[23];let N;e[24]!==m||e[25]!==w||e[26]!==p||e[27]!==c||e[28]!==v||e[29]!==u||e[30]!==$||e[31]!==h?(N=h==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:$.length===0?t.jsx(Z,{image:null,title:c?"No prompts found":"No prompts available",description:c?"Try adjusting your search terms":m}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:$.map(C=>t.jsx(We,{className:"cursor-pointer transition-colors",onClick:()=>w(C),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Ee,{icon:null,name:C.name,size:"md",className:"shrink-0 shadow-sm"}),t.jsxs("div",{className:"flex flex-col gap-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:C.name}),t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:C.description||"No description"})]})]})},C.name))})}):t.jsx(pt,{columns:R,data:$,isLoading:!1,sortKey:u,sortDirection:v,onSort:p,onRowClick:C=>w(C),emptyState:t.jsx(Z,{image:null,title:c?"No prompts found":"No prompts available",description:c?"Try adjusting your search terms":m})}),e[24]=m,e[25]=w,e[26]=p,e[27]=c,e[28]=v,e[29]=u,e[30]=$,e[31]=h,e[32]=N):N=e[32];let P;e[33]!==A||e[34]!==N?(P=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[A,N]}),e[33]=A,e[34]=N,e[35]=P):P=e[35];let D;return e[36]!==P||e[37]!==y?(D=t.jsxs(t.Fragment,{children:[y,P]}),e[36]=P,e[37]=y,e[38]=D):D=e[38],D}function ys(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function _s(s){return s.sortable}function Cs(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function Ss(s){return t.jsx("span",{className:"text-sm font-medium font-mono text-foreground",children:s.name})}function ws(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function Ts(s){const e=F.c(4),{prompts:n,connectionId:o,org:i}=s;let a;return e[0]!==o||e[1]!==i||e[2]!==n?(a=t.jsx(Ns,{prompts:n,connectionId:o,org:i}),e[0]=o,e[1]=i,e[2]=n,e[3]=a):a=e[3],a}function ks(s){const e=F.c(2),{repository:n}=s;let o;return e[0]!==n?(o=t.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:t.jsx(ms,{repository:n})}),e[0]=n,e[1]=o):o=e[1],o}function Ps(s){const e=F.c(36),{resources:n,onResourceClick:o,showToolbar:i,emptyMessage:a}=s,l=i===void 0?!0:i,g=a===void 0?"This connection doesn't have any resources yet.":a,[x,m]=X.useState(""),[f,c]=X.useState("table"),[r,h]=X.useState("name"),[d,u]=X.useState("asc");let b;e[0]!==d||e[1]!==r?(b=N=>{r===N?(u(Os),d==="desc"&&h(void 0)):(h(N),u("asc"))},e[0]=d,e[1]=r,e[2]=b):b=e[2];const v=b;let _;e[3]!==o?(_=N=>{o&&o(N)},e[3]=o,e[4]=_):_=e[4];const I=_;let p;if(e[5]!==n||e[6]!==x||e[7]!==d||e[8]!==r){const N=!n||n.length===0?[]:x.trim()?(()=>{const P=x.toLowerCase();return n.filter(D=>D.uri.toLowerCase().includes(P)||D.name&&D.name.toLowerCase().includes(P)||D.description&&D.description.toLowerCase().includes(P))})():n;p=!r||!d?N:[...N].sort((P,D)=>{const C=P[r]||"",O=D[r]||"",B=String(C).localeCompare(String(O));return d==="asc"?B:-B}),e[5]=n,e[6]=x,e[7]=d,e[8]=r,e[9]=p}else p=e[9];const S=p;let w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=[{id:"name",header:"Name",render:Ds,sortable:!0},{id:"uri",header:"URI",render:Ms,sortable:!0},{id:"description",header:"Description",render:Vs,cellClassName:"flex-1",sortable:!0},{id:"mimeType",header:"Type",render:As,sortable:!0}],e[10]=w):w=e[10];const j=w;let $;e[11]===Symbol.for("react.memo_cache_sentinel")?($=j.filter($s).map(Is),e[11]=$):$=e[11];const k=$;let R;e[12]!==v||e[13]!==l||e[14]!==d||e[15]!==r||e[16]!==f?(R=l&&t.jsx(Xe,{children:t.jsx(ft,{viewMode:f,onViewModeChange:c,sortKey:r,sortDirection:d,onSort:v,sortOptions:k})}),e[12]=v,e[13]=l,e[14]=d,e[15]=r,e[16]=f,e[17]=R):R=e[17];let V;e[18]===Symbol.for("react.memo_cache_sentinel")?(V=N=>{N.key==="Escape"&&(m(""),N.target.blur())},e[18]=V):V=e[18];let M;e[19]!==x?(M=t.jsx(ze,{value:x,onChange:m,placeholder:"Search resources...",onKeyDown:V}),e[19]=x,e[20]=M):M=e[20];let y;e[21]!==g||e[22]!==I||e[23]!==v||e[24]!==x||e[25]!==d||e[26]!==r||e[27]!==S||e[28]!==f?(y=f==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:S.length===0?t.jsx(Z,{image:null,title:x?"No resources found":"No resources available",description:x?"Try adjusting your search terms":g}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:S.map(N=>t.jsx(We,{className:"cursor-pointer transition-colors",onClick:()=>I(N),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Ee,{icon:null,name:N.name||N.uri,size:"md",className:"shrink-0 shadow-sm"}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:N.name||N.uri}),t.jsx("p",{className:"text-xs font-mono text-muted-foreground truncate",children:N.uri}),N.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:N.description})]})]})},N.uri))})}):t.jsx(pt,{columns:j,data:S,isLoading:!1,sortKey:r,sortDirection:d,onSort:v,onRowClick:N=>I(N),emptyState:t.jsx(Z,{image:null,title:x?"No resources found":"No resources available",description:x?"Try adjusting your search terms":g})}),e[21]=g,e[22]=I,e[23]=v,e[24]=x,e[25]=d,e[26]=r,e[27]=S,e[28]=f,e[29]=y):y=e[29];let L;e[30]!==M||e[31]!==y?(L=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[M,y]}),e[30]=M,e[31]=y,e[32]=L):L=e[32];let A;return e[33]!==L||e[34]!==R?(A=t.jsxs(t.Fragment,{children:[R,L]}),e[33]=L,e[34]=R,e[35]=A):A=e[35],A}function Is(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function $s(s){return s.sortable}function As(s){return t.jsx("span",{className:"text-sm text-muted-foreground",children:s.mimeType||"—"})}function Vs(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function Ms(s){return t.jsx("span",{className:"text-sm font-mono text-muted-foreground",children:s.uri})}function Ds(s){return t.jsx("span",{className:"text-sm font-medium text-foreground",children:s.name||s.uri})}function Os(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function Es(s){const e=F.c(4),{resources:n,connectionId:o,org:i}=s;let a;return e[0]!==o||e[1]!==i||e[2]!==n?(a=t.jsx(Ps,{resources:n,connectionId:o,org:i}),e[0]=o,e[1]=i,e[2]=n,e[3]=a):a=e[3],a}const Rs=at({key:z().min(1,"Key is required"),value:z()}),Ls=at({title:z().min(1,"Name is required"),description:z().nullable().optional(),ui_type:Nt(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:z().optional(),connection_token:z().nullable().optional(),npx_package:z().optional(),stdio_command:z().optional(),stdio_args:z().optional(),stdio_cwd:z().optional(),env_vars:Ge(Rs).optional(),configuration_scopes:Ge(z()).nullable().optional(),configuration_state:bt(z(),vt()).nullable().optional()}).refine(s=>s.ui_type==="NPX"?!!s.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(s=>s.ui_type==="STDIO"?!!s.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(s=>s.ui_type==="HTTP"||s.ui_type==="SSE"||s.ui_type==="Websocket"?!!s.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function Us(s){const e=F.c(5),{tools:n,connectionId:o,org:i,isLoading:a}=s;let l;return e[0]!==o||e[1]!==a||e[2]!==i||e[3]!==n?(l=t.jsx(us,{tools:n,connectionId:o,org:i,isLoading:a}),e[0]=o,e[1]=a,e[2]=i,e[3]=n,e[4]=l):l=e[4],l}function Fs(s){const e=F.c(27),{tools:n,connectionId:o,org:i}=s,a=Ne(),{org:l}=Be();let g;e[0]!==o||e[1]!==l.id?(g={connectionId:o,orgId:l.id},e[0]=o,e[1]=l.id,e[2]=g):g=e[2];const x=mt(g),[m,f]=X.useState("");let c,r,h,d;if(e[3]!==x||e[4]!==o||e[5]!==a||e[6]!==i||e[7]!==m||e[8]!==n){const v=(n??[]).filter(Bs),_=m.toLowerCase().trim(),I=_?v.filter(j=>j.name.toLowerCase().includes(_)||j.description&&j.description.toLowerCase().includes(_)):v;let p;e[13]!==o||e[14]!==a||e[15]!==i?(p=j=>{a({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:i,project:ge,connectionId:o,collectionName:"tools",itemId:encodeURIComponent(j.name)}})},e[13]=o,e[14]=a,e[15]=i,e[16]=p):p=e[16];const S=p;h="flex flex-col h-full overflow-hidden";let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=j=>{j.key==="Escape"&&(f(""),j.target.blur())},e[17]=w):w=e[17],e[18]!==m?(d=t.jsx(ze,{value:m,onChange:f,placeholder:"Search apps...",onKeyDown:w}),e[18]=m,e[19]=d):d=e[19],c="flex-1 overflow-auto p-5",r=I.length===0?t.jsx(Z,{image:null,title:m?"No apps found":"No apps available",description:m?"Try adjusting your search terms":"This connection doesn't have any tools with interactive UIs yet."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:I.map(j=>{const $=Ke(j._meta);return t.jsxs(We,{className:"cursor-pointer transition-colors overflow-hidden",onClick:()=>S(j),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(fs,{resourceURI:$,toolName:j.name,displayMode:"inline",minHeight:200,maxHeight:200,client:x})}),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:j.name}),t.jsx(ps,{annotations:j.annotations,_meta:j._meta})]}),j.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:j.description})]})]},j.name)})}),e[3]=x,e[4]=o,e[5]=a,e[6]=i,e[7]=m,e[8]=n,e[9]=c,e[10]=r,e[11]=h,e[12]=d}else c=e[9],r=e[10],h=e[11],d=e[12];let u;e[20]!==c||e[21]!==r?(u=t.jsx("div",{className:c,children:r}),e[20]=c,e[21]=r,e[22]=u):u=e[22];let b;return e[23]!==h||e[24]!==d||e[25]!==u?(b=t.jsxs("div",{className:h,children:[d,u]}),e[23]=h,e[24]=d,e[25]=u,e[26]=b):b=e[26],b}function Bs(s){return!!Ke(s._meta)}function zs(s){return s.command==="npx"}function Ks(s){return s.args?.find(e=>!e.startsWith("-"))??""}function Xs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function Hs(s,e){const n={command:"npx",args:["-y",s]},o=lt(e);return Object.keys(o).length>0&&(n.envVars=o),n}function Ws(s,e,n,o){const i={command:s};e.trim()&&(i.args=e.trim().split(/\s+/)),n?.trim()&&(i.cwd=n.trim());const a=lt(o);return Object.keys(a).length>0&&(i.envVars=a),i}function rt(s,e){const n={title:s.title,description:s.description??"",configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&Tt(s.connection_headers)){const o=s.connection_headers,i=Pt(o.envVars);if(zs(o)){const l=Ks(o);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:l,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:i}}const a=Xs(o);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:a.command,stdio_args:a.args,stdio_cwd:a.cwd,env_vars:i}}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 qs(s){let e,n=null,o=null,i=null;return s.ui_type==="NPX"?(e="STDIO",n="",i=Hs(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",i=Ws(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",o=s.connection_token||null),{title:s.title,description:s.description||null,connection_type:e,connection_url:n,...o&&{connection_token:o},...i&&{connection_headers:i},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function Qs(s){const e=F.c(116),{connection:n,connectionId:o,org:i,requestedTabId:a,collections:l,onUpdate:g,isUpdating:x,prompts:m,resources:f,tools:c,isLoadingTools:r}=s;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={from:"/$org/$project/mcps/$connectionId"},e[0]=h):h=e[0];const d=Ne(h),u=Ct(),b=dt();let v;e[1]!==o?(v={connectionId:o},e[1]=o,e[2]=v):v=e[2];const _=Vt(v),p=n?.connection_type==="VIRTUAL"||_.isAuthenticated;let S;e[3]!==n?(S={connections:[n],binding:"MCP"},e[3]=n,e[4]=S):S=e[4];const j=At(S).length>0,$=n?.metadata?.repository,k=!!$?.url;let R;e[5]===Symbol.for("react.memo_cache_sentinel")?(R=St(Ls),e[5]=R):R=e[5];let V;e[6]!==n?(V=rt(n),e[6]=n,e[7]=V):V=e[7];let M;e[8]!==V?(M={resolver:R,values:V},e[8]=V,e[9]=M):M=e[9];const y=wt(M),L=y.formState.isDirty;let A;e[10]!==y||e[11]!==g?(A=async()=>{if(!await y.trigger())return;const U=y.getValues(),he=qs(U);await g(he),y.reset(U)},e[10]=y,e[11]=g,e[12]=A):A=e[12];const N=A;let P;e[13]!==n||e[14]!==y?(P=()=>{y.reset(rt(n))},e[13]=n,e[14]=y,e[15]=P):P=e[15];const D=P;let C;e[16]!==n.id||e[17]!==b||e[18]!==u?(C=async()=>{const{token:T,tokenInfo:U,error:he}=await Lt({connectionId:n.id});if(he||!T){ve.error(`Authentication failed: ${he}`);return}if(U)try{const Me=await fetch(`/api/connections/${n.id}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:U.accessToken,refreshToken:U.refreshToken,expiresIn:U.expiresIn,scope:U.scope,clientId:U.clientId,clientSecret:U.clientSecret,tokenEndpoint:U.tokenEndpoint})});if(!Me.ok)console.error("Failed to save OAuth token:",await Me.text()),await b.update.mutateAsync({id:n.id,data:{connection_token:T}});else try{await b.update.mutateAsync({id:n.id,data:{}})}catch(qe){console.warn("Failed to refresh connection tools after OAuth:",qe)}}catch(Me){console.error("Error saving OAuth token:",Me),await b.update.mutateAsync({id:n.id,data:{connection_token:T}})}else await b.update.mutateAsync({id:n.id,data:{connection_token:T}});const ht=new URL(`/mcp/${n.id}`,window.location.origin);await u.invalidateQueries({queryKey:Je.isMCPAuthenticated(ht.href,null)}),ve.success("Authentication successful")},e[16]=n.id,e[17]=b,e[18]=u,e[19]=C):C=e[19];const O=C;let B;e[20]!==n.id||e[21]!==u?(B=async()=>{try{const T=await fetch(`/api/connections/${n.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!T.ok){const he=await T.text();ve.error(`Failed to remove OAuth: ${he}`);return}const U=new URL(`/mcp/${n.id}`,window.location.origin);await u.invalidateQueries({queryKey:Je.isMCPAuthenticated(U.href,null)}),ve.success("OAuth removed. You can now re-authenticate with a different account.")}catch(T){console.error("Error removing OAuth token:",T),ve.error("Failed to remove OAuth")}},e[20]=n.id,e[21]=u,e[22]=B):B=e[22];const je=B,ee=c.length,J=m.length,ye=f.length;let _e;e[23]!==c?(_e=c.filter(Ys),e[23]=c,e[24]=_e):_e=e[24];const Ce=_e.length,Re=ee>0||r;let Se;e[25]===Symbol.for("react.memo_cache_sentinel")?(Se={id:"settings",label:"Settings"},e[25]=Se):Se=e[25];let te;e[26]!==r||e[27]!==p||e[28]!==Re||e[29]!==ee?(te=p&&Re?[{id:"tools",label:"Tools",count:r?void 0:ee}]:[],e[26]=r,e[27]=p,e[28]=Re,e[29]=ee,e[30]=te):te=e[30];let se;e[31]!==p||e[32]!==J?(se=p&&J>0?[{id:"prompts",label:"Prompts",count:J}]:[],e[31]=p,e[32]=J,e[33]=se):se=e[33];let ne;e[34]!==p||e[35]!==ye?(ne=p&&ye>0?[{id:"resources",label:"Resources",count:ye}]:[],e[34]=p,e[35]=ye,e[36]=ne):ne=e[36];let oe;e[37]!==p||e[38]!==Ce?(oe=p&&Ce>0?[{id:"ui",label:"UI",count:Ce}]:[],e[37]=p,e[38]=Ce,e[39]=oe):oe=e[39];let we;if(e[40]!==l||e[41]!==k||e[42]!==p||e[43]!==te||e[44]!==se||e[45]!==ne||e[46]!==oe){let T;e[48]!==k?(T=k?[{id:"readme",label:"README"}]:[],e[48]=k,e[49]=T):T=e[49],we=[Se,...te,...se,...ne,...oe,...p?(l||[]).map(Js):[],...T],e[40]=l,e[41]=k,e[42]=p,e[43]=te,e[44]=se,e[45]=ne,e[46]=oe,e[47]=we}else we=e[47];const be=we,xt=p&&be.some(Gs)?"tools":"settings",E=be.some(T=>T.id===a)?a:xt;let Te;e[50]!==d?(Te=T=>{d({search:U=>({...U,tab:T}),replace:!0})},e[50]=d,e[51]=Te):Te=e[51];const re=Te;let ie;e[52]!==l?(ie=l||[],e[52]=l,e[53]=ie):ie=e[53];let ke;if(e[54]!==E||e[55]!==ie){let T;e[57]!==E?(T=U=>U.name===E,e[57]=E,e[58]=T):T=e[58],ke=ie.find(T),e[54]=E,e[55]=ie,e[56]=ke}else ke=e[56];const Pe=ke;let ae;e[59]!==i?(ae=t.jsx(Ye,{children:t.jsx(Ft,{asChild:!0,children:t.jsx(it,{to:"/$org/$project/mcps",params:{org:i,project:ge},children:"Connections"})})}),e[59]=i,e[60]=ae):ae=e[60];let Ie;e[61]===Symbol.for("react.memo_cache_sentinel")?(Ie=t.jsx(Bt,{}),e[61]=Ie):Ie=e[61];let ce;e[62]!==n.title?(ce=t.jsx(Ye,{children:t.jsx(Ut,{children:n.title})}),e[62]=n.title,e[63]=ce):ce=e[63];let $e;e[64]!==ae||e[65]!==ce?($e=t.jsx(zt,{children:t.jsxs(Kt,{children:[ae,Ie,ce]})}),e[64]=ae,e[65]=ce,e[66]=$e):$e=e[66];const Le=$e;let le;e[67]!==N||e[68]!==D||e[69]!==L||e[70]!==x?(le=t.jsx(Xe,{children:t.jsx(It,{onSave:N,onUndo:D,isDirty:L,isSaving:x})}),e[67]=N,e[68]=D,e[69]=L,e[70]=x,e[71]=le):le=e[71];let de;e[72]!==_.hasOAuthToken||e[73]!==n||e[74]!==y||e[75]!==O||e[76]!==je||e[77]!==p?(de=t.jsx("div",{className:"w-100 shrink-0 border-r border-border bg-background",children:t.jsx(js,{form:y,connection:n,isMCPAuthenticated:p,hasOAuthToken:_.hasOAuthToken,onReauthenticate:O,onRemoveOAuth:je})}),e[72]=_.hasOAuthToken,e[73]=n,e[74]=y,e[75]=O,e[76]=je,e[77]=p,e[78]=de):de=e[78];let me;e[79]!==E||e[80]!==re||e[81]!==be?(me=t.jsx("div",{className:"shrink-0 flex items-center gap-4 px-5 py-3 border-b border-border",children:t.jsx(Xt,{tabs:be,activeTab:E,onTabChange:re,className:"flex-1"})}),e[79]=E,e[80]=re,e[81]=be,e[82]=me):me=e[82];let Ae;e[83]===Symbol.for("react.memo_cache_sentinel")?(Ae=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Oe,{size:32,className:"animate-spin text-muted-foreground"})}),e[83]=Ae):Ae=e[83];let ue;e[84]!==Pe||e[85]!==E||e[86]!==_.isServerError||e[87]!==_.supportsOAuth||e[88]!==n||e[89]!==o||e[90]!==y||e[91]!==O||e[92]!==re||e[93]!==j||e[94]!==k||e[95]!==r||e[96]!==p||e[97]!==i||e[98]!==m||e[99]!==$||e[100]!==f||e[101]!==c?(ue=t.jsx(X.Suspense,{fallback:Ae,children:E==="tools"?t.jsx(Us,{tools:c,connectionId:o,org:i,isLoading:r}):E==="ui"?t.jsx(Fs,{tools:c,connectionId:o,org:i}):E==="prompts"?t.jsx(Ts,{prompts:m,connectionId:o,org:i}):E==="resources"?t.jsx(Es,{resources:f,connectionId:o,org:i}):E==="settings"?t.jsx(Mt,{connection:n,form:y,hasMcpBinding:j,isMCPAuthenticated:p,supportsOAuth:_.supportsOAuth,isServerError:_.isServerError,onAuthenticate:O,onViewReadme:k?()=>re("readme"):void 0}):E==="readme"&&k?t.jsx(ks,{repository:$}):Pe&&p?t.jsx(Wt,{connectionId:o,org:i,activeCollection:Pe},E):t.jsx(Z,{title:"Collection not found",description:"This collection may have been deleted or you may not have access."})}),e[84]=Pe,e[85]=E,e[86]=_.isServerError,e[87]=_.supportsOAuth,e[88]=n,e[89]=o,e[90]=y,e[91]=O,e[92]=re,e[93]=j,e[94]=k,e[95]=r,e[96]=p,e[97]=i,e[98]=m,e[99]=$,e[100]=f,e[101]=c,e[102]=ue):ue=e[102];let pe;e[103]!==E||e[104]!==ue?(pe=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(ct,{children:ue},E)}),e[103]=E,e[104]=ue,e[105]=pe):pe=e[105];let fe;e[106]!==me||e[107]!==pe?(fe=t.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:[me,pe]}),e[106]=me,e[107]=pe,e[108]=fe):fe=e[108];let xe;e[109]!==de||e[110]!==fe?(xe=t.jsxs("div",{className:"flex h-full w-full bg-background overflow-hidden",children:[de,fe]}),e[109]=de,e[110]=fe,e[111]=xe):xe=e[111];let Ve;return e[112]!==Le||e[113]!==le||e[114]!==xe?(Ve=t.jsxs(Ht,{breadcrumb:Le,children:[le,xe]}),e[112]=Le,e[113]=le,e[114]=xe,e[115]=Ve):Ve=e[115],Ve}function Gs(s){return s.id==="tools"}function Js(s){return{id:s.name,label:s.displayName}}function Ys(s){return!!Ke(s._meta)}function Zs(){const s=F.c(43);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/$project/mcps/$connectionId"},s[0]=e):e=s[0];const n=Ne(e);let o;s[1]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/$project/mcps/$connectionId"},s[1]=o):o=s[1];const{connectionId:i,org:a}=yt(o),{org:l}=Be();let g;s[2]===Symbol.for("react.memo_cache_sentinel")?(g={from:"/shell/$org/$project/mcps/$connectionId"},s[2]=g):g=s[2];const m=_t(g).tab??"",f=Dt(i),c=dt(),r=$t(f??void 0);let h;s[3]!==i||s[4]!==l.id?(h={connectionId:i,orgId:l.id},s[3]=i,s[4]=l.id,s[5]=h):h=s[5];const d=mt(h);let u;s[6]!==d?(u={client:d},s[6]=d,s[7]=u):u=s[7];const{data:b}=Et(u);let v;s[8]!==d?(v={client:d},s[8]=d,s[9]=v):v=s[9];const{data:_}=Rt(v),p=!(f?.connection_type==="VIRTUAL")&&f?.tools&&f.tools.length>0,S=!p;let w;s[10]!==d||s[11]!==S?(w={client:d,enabled:S},s[10]=d,s[11]=S,s[12]=w):w=s[12];const{data:j,isLoading:$}=Ot(w);let k;s[13]!==b?.prompts?(k=b?.prompts??[],s[13]=b?.prompts,s[14]=k):k=s[14];let R;s[15]!==k?(R=k.map(sn),s[15]=k,s[16]=R):R=s[16];const V=R;let M;s[17]!==_?.resources?(M=_?.resources??[],s[17]=_?.resources,s[18]=M):M=s[18];let y;s[19]!==M?(y=M.map(tn),s[19]=M,s[20]=y):y=s[20];const L=y;let A;s[21]!==f||s[22]!==p||s[23]!==j?.tools?(A=p?f.tools??[]:(j?.tools??[]).map(en),s[21]=f,s[22]=p,s[23]=j?.tools,s[24]=A):A=s[24];const N=A;let P;s[25]!==c.update||s[26]!==i?(P=async O=>{await c.update.mutateAsync({id:i,data:O})},s[25]=c.update,s[26]=i,s[27]=P):P=s[27];const D=P;if(!f){let O;return s[28]!==n||s[29]!==a?(O=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Z,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(Ue,{variant:"outline",onClick:()=>n({to:"/$org/$project/mcps",params:{org:a,project:ge}}),children:"Back to connections"})})}),s[28]=n,s[29]=a,s[30]=O):O=s[30],O}let C;return s[31]!==c.update.isPending||s[32]!==r||s[33]!==f||s[34]!==i||s[35]!==D||s[36]!==$||s[37]!==a||s[38]!==V||s[39]!==m||s[40]!==L||s[41]!==N?(C=t.jsx(Qs,{org:a,connection:f,connectionId:i,requestedTabId:m,collections:r,onUpdate:D,isUpdating:c.update.isPending,prompts:V,resources:L,tools:N,isLoadingTools:$}),s[31]=c.update.isPending,s[32]=r,s[33]=f,s[34]=i,s[35]=D,s[36]=$,s[37]=a,s[38]=V,s[39]=m,s[40]=L,s[41]=N,s[42]=C):C=s[42],C}function en(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,annotations:s.annotations,_meta:s._meta}}function tn(s){return{uri:s.uri,name:s.name,description:s.description}}function sn(s){return{name:s.name,description:s.description}}function nn(){const s=F.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ct,{children:t.jsx(X.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(Oe,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Zs,{})})}),s[0]=e):e=s[0],e}function ir(){const s=F.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(nn,{}),s[0]=e):e=s[0],e}export{ir as default};
@@ -1 +1 @@
1
- import{c as be,j as e,E as Fe,r as X,u as Be,m as Ue,b as He,a as ze,d as Le,az as Me,l as Re,k as Xe,i as We,B as S,O as g,t as D,o as ke,aA as Ke,s as C,aB as Ge}from"./index-0HoOnen3.js";import{g as qe}from"./generate-id-Dyweu44Y.js";import{C as Qe,a as Je}from"./collection-table-wrapper-BkrnGVuo.js";import{C as Ye,E as z}from"./collection-search-DeB-znan.js";import{C as Ze}from"./connection-card-DmcuYZ2d.js";import{B as L}from"./badge-0EzsH3AB.js";import{i as et}from"./AlertCircle-Y6iSJK0t.js";import{i as tt}from"./CheckCircle-DvhMgeYT.js";import{I as nt}from"./integration-icon-5VjL1GgL.js";import{P as E}from"./index-G8oxxr2G.js";import{u as st,U as re}from"./use-list-state-Bpa4-xTU.js";import{u as ot}from"./use-binding-CcrgjIcJ.js";import{f as rt,e as it}from"./registry-utils-BPK3KAEQ.js";import{f as ie,a as ae,b as ce,c as le,d as de,e as me,A as ue,g as pe}from"./alert-dialog-CdqWA8wc.js";import{B as at,a as ct,b as lt,c as dt}from"./breadcrumb-BcJj21EL.js";import{D as mt,a as ut,b as pt,c as xt,d as ht,e as gt}from"./dialog-L8ZakXii.js";import{D as xe,a as he,b as ge,c as F}from"./dropdown-menu-VTiqKHN9.js";import{a as jt,F as j,b as f,c as y,d as v,f as _}from"./form-p8UY3zWX.js";import{I as T}from"./input-BtUicd3Q.js";import{S as ft,a as yt,b as vt,c as _t,d as $}from"./select-DOO2sOs0.js";import{T as Ct}from"./textarea-Ca7XZUqN.js";import{g as Nt,h as bt}from"./use-connection-B6TFiTxb.js";import{u as je,a as kt}from"./constants-DyBxaLKI.js";import{b as wt}from"./use-mcp-tools-BjSYCbSh.js";import{n as M}from"./Container-DBGOFJUc.js";import{i as fe}from"./DotsVertical-DcLEsGDj.js";import{s as ye}from"./Eye-VtlrDhJf.js";import{s as R}from"./Globe02-nOidPs01.js";import{i as St}from"./Loading01-Jv8Mbea8.js";import{i as Tt}from"./Terminal-d72o721Q.js";import{s as ve}from"./Trash01-CKATI1mI.js";import{f as _e}from"./format-time-CMKyl-GC.js";import{r as Dt,E as Pt,e as we}from"./env-vars-editor-CZ9xwqbP.js";import"./ArrowDown-DPy5cnDQ.js";import"./ArrowUp-Dx6U6WtF.js";import"./Check-BIaai9j0.js";import"./Grid01-C8gF-dWK.js";import"./List-mX8yEKmx.js";import"./tooltip-BWlQ9UL9.js";import"./index-BymQJSqf.js";import"./table-CK5AQN01.js";import"./SearchMd-CS2uMIPl.js";import"./card-c-CJHmFC.js";import"./use-mobile-B9jSIPRg.js";import"./X-RC7YVNJU.js";import"./avatar-tLGNC2ok.js";import"./useQuery-CI6Jq2Tz.js";import"./use-view-mode-CHcflreW.js";import"./binder-w9dF9fSa.js";import"./ChevronRight-D6p6jiry.js";import"./label-D6atofYo.js";import"./ChevronDown-Dyskz-ZD.js";import"./useMutation-C13VGcqo.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./Plus-Cecv4wEo.js";function Ce(s){const o=be.c(3),{status:i}=s;if(i==="active"){let c;return o[0]===Symbol.for("react.memo_cache_sentinel")?(c=e.jsxs(L,{variant:"success",className:"gap-1.5 text-success border-success/40 bg-background",children:[e.jsx(tt,{size:12}),"Active"]}),o[0]=c):c=o[0],c}if(i==="error"){let c;return o[1]===Symbol.for("react.memo_cache_sentinel")?(c=e.jsxs(L,{variant:"outline",className:"gap-1.5 text-destructive border-destructive/40 bg-background",children:[e.jsx(et,{size:12}),"Error"]}),o[1]=c):c=o[1],c}let d;return o[2]===Symbol.for("react.memo_cache_sentinel")?(d=e.jsx(L,{variant:"outline",className:"text-muted-foreground",children:"Inactive"}),o[2]=d):d=o[2],d}const It=ke({key:C(),value:C()}),Et=ke({title:C().min(1,"Name is required"),description:C().nullable().optional(),ui_type:Ge(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:C().optional(),connection_token:C().nullable().optional(),npx_package:C().optional(),stdio_command:C().optional(),stdio_args:C().optional(),stdio_cwd:C().optional(),env_vars:Ke(It).optional()}).refine(s=>s.ui_type==="NPX"?!!s.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(s=>s.ui_type==="STDIO"?!!s.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(s=>s.ui_type==="HTTP"||s.ui_type==="SSE"||s.ui_type==="Websocket"?!!s.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function U(s){const o=s.trim();if(!o)return"";try{const i=new URL(o),d=i.pathname.length>1?i.pathname.replace(/\/+$/,""):i.pathname;return`${i.origin}${d}`}catch{return o.replace(/\/+$/,"")}}function $t(s){const o=s.trim().split(/\s+/).filter(Boolean);if(o.length<2)return null;const i=o[0]?.toLowerCase();if(i!=="npx"&&i!=="bunx")return null;const c=o.slice(1).find(N=>!N.startsWith("-"));return c?{packageName:c}:null}function B(s){const{uiType:o}=s,i=U(s.connectionUrl??"");if((o==="HTTP"||o==="SSE"||o==="Websocket")&&i===U("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 d=(s.npxPackage??"").trim();return o==="NPX"&&d==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function Ne(s){if(s.registryItems.length===0||s.uiType!=="HTTP"&&s.uiType!=="SSE"&&s.uiType!=="Websocket")return null;const o=U(s.connectionUrl??"");if(!o)return null;const i=s.registryItems.find(N=>(N.server?.remotes??[]).some(O=>U(O.url??"")===o));if(!i)return null;const d=i.title||i.name||i.server?.title||i.server?.name||"",c=i.server?.description||i.description||i.summary||null;return d?{id:"registry",title:d,description:c}:null}function Ot(s,o){const i={command:"npx",args:["-y",s]},d=we(o);return Object.keys(d).length>0&&(i.envVars=d),i}function At(s,o,i,d){const c={command:s};o.trim()&&(c.args=o.trim().split(/\s+/)),i?.trim()&&(c.cwd=i.trim());const N=we(d);return Object.keys(N).length>0&&(c.envVars=N),c}function Vt(s){return s.command==="npx"}function Ft(s){return s.args?.find(o=>!o.startsWith("-"))??""}function Bt(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function Ut(s,o){switch(o.type){case"edit":return{mode:"editing",connection:o.connection};case"delete":return{mode:"deleting",connection:o.connection};case"force-delete":return{mode:"force-deleting",connection:o.connection,agentNames:o.agentNames};case"close":return{mode:"idle"}}}function Ht(){const{org:s}=Be(),o=Ue(),i=He(),d=ze({strict:!1}),{data:c}=Le.useSession(),{stdioEnabled:N}=Me(),l=st({namespace:s.slug,resource:"connections"}),O=Nt(),A=bt(l),[u,b]=X.useReducer(Ut,{mode:"idle"}),W=ot(A)[0],K=W?.id??"",G=rt(W?.tools),Se=je({connectionId:K||null,orgId:s.id}),{data:Te}=wt({client:Se,toolName:G,toolArguments:{limit:200},enabled:!!(K&&G),staleTime:3600*1e3,select:t=>t.structuredContent??t}),q=it(Te??[]),Q=d.action==="create",De=()=>{i({to:"/$org/$project/mcps",params:{org:s.slug,project:g},search:{action:"create"}})},J=()=>{i({to:"/$org/$project/mcps",params:{org:s.slug,project:g},search:{}})},r=Re({resolver:Xe(Et),defaultValues:{title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),p=r.watch("ui_type"),Y=r.watch("connection_url"),Pe=r.watch("npx_package"),P=B({uiType:p,connectionUrl:Y??"",npxPackage:Pe??""})??Ne({uiType:p,connectionUrl:Y??"",registryItems:q}),m=u.mode==="editing"?u.connection:null;X.useEffect(()=>{if(m){const t=We(m.connection_headers)?m.connection_headers:null;if(t&&m.connection_type==="STDIO"){const n=Dt(t.envVars);if(Vt(t)){const a=Ft(t);r.reset({title:m.title,description:m.description,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:a,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:n})}else{const a=Bt(t);r.reset({title:m.title,description:m.description,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:a.command,stdio_args:a.args,stdio_cwd:a.cwd,env_vars:n})}}else r.reset({title:m.title,description:m.description,ui_type:m.connection_type,connection_url:m.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})}else r.reset({title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})},[m,r]);const Z=je({connectionId:kt,orgId:s.id}),ee=()=>{o.invalidateQueries({predicate:t=>{const n=t.queryKey;return n[1]===s.id&&n[3]==="collection"&&n[4]==="CONNECTIONS"}})},te=t=>{const n=t.content;return Array.isArray(n)&&n[0]?.type==="text"&&typeof n[0].text=="string"?n[0].text:"Unknown error"},Ie=async()=>{if(u.mode!=="deleting")return;const t=u.connection;b({type:"close"});try{const n=await Z.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:t.id}});if(n.isError){const a=te(n),k=a.replace(/^Error:\s*/,"");try{const x=JSON.parse(k);if(x.code==="CONNECTION_IN_USE"&&x.agentNames){b({type:"force-delete",connection:t,agentNames:x.agentNames.map(w=>`"${w}"`).join(", ")});return}}catch{}D.error(`Failed to delete connection: ${a}`);return}ee(),D.success("Connection deleted successfully")}catch(n){const a=n instanceof Error?n.message:String(n);D.error(`Failed to delete connection: ${a}`)}},Ee=async()=>{if(u.mode!=="force-deleting")return;const t=u.connection.id;b({type:"close"});try{const n=await Z.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:t,force:!0}});if(n.isError){D.error(`Failed to delete connection: ${te(n)}`);return}ee(),D.success("Connection deleted successfully")}catch(n){const a=n instanceof Error?n.message:String(n);D.error(`Failed to delete connection: ${a}`)}},$e=async t=>{let n,a=null,k=null,x=null;if(t.ui_type==="NPX"?(n="STDIO",a="",x=Ot(t.npx_package||"",t.env_vars||[])):t.ui_type==="STDIO"?(n="STDIO",a="",x=At(t.stdio_command||"",t.stdio_args||"",t.stdio_cwd,t.env_vars||[])):(n=t.ui_type,a=t.connection_url||"",k=t.connection_token||null),m){await O.update.mutateAsync({id:m.id,data:{title:t.title,description:t.description||null,connection_type:n,connection_url:a,...k&&{connection_token:k},...x&&{connection_headers:x}}}),b({type:"close"}),r.reset();return}const w=qe("conn");await O.create.mutateAsync({id:w,title:t.title,description:t.description||null,connection_type:n,connection_url:a,connection_token:k,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:c?.user?.id||"system",organization_id:s.id,icon:null,app_name:null,app_id:null,connection_headers:x,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),J(),r.reset(),i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:w}})},ne=t=>{t||(Q?J():b({type:"close"}),r.reset())},V=t=>{const n=t.trim();if(!n)return;const a=!!r.formState.dirtyFields.title,k=!!r.formState.dirtyFields.description,x=!!r.formState.dirtyFields.env_vars,w=h=>{if(h&&(!a&&!r.getValues("title").trim()&&h.title&&r.setValue("title",h.title,{shouldDirty:!1}),!k&&!(r.getValues("description")??"").trim()&&h.description&&r.setValue("description",h.description,{shouldDirty:!1}),!x&&h.envVarKeys?.length)){const se=r.getValues("env_vars")??[],Ve=new Set(se.map(I=>I.key)),oe=h.envVarKeys.filter(I=>!Ve.has(I));oe.length>0&&r.setValue("env_vars",[...se,...oe.map(I=>({key:I,value:""}))],{shouldDirty:!0})}},H=$t(n);if(H&&N){r.setValue("ui_type","NPX",{shouldDirty:!0}),r.setValue("npx_package",H.packageName,{shouldDirty:!0}),r.setValue("connection_url","",{shouldDirty:!0}),r.setValue("connection_token",null,{shouldDirty:!0}),w(B({uiType:"NPX",npxPackage:H.packageName}));return}if(n.startsWith("http://")||n.startsWith("https://")){const h=p==="HTTP"||p==="SSE"||p==="Websocket"?p:"HTTP";r.setValue("ui_type",h,{shouldDirty:!0}),r.setValue("connection_url",n,{shouldDirty:!0}),w(B({uiType:h,connectionUrl:n})??Ne({uiType:h,connectionUrl:n,registryItems:q}));return}p==="NPX"&&w(B({uiType:"NPX",npxPackage:n}))},Oe=[{id:"title",header:"Name",render:t=>e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(nt,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:e.jsx(M,{})}),e.jsx("span",{className:"text-sm font-medium text-foreground truncate block",title:t.title,children:t.title})]}),cellClassName:"w-32 min-w-0 shrink-0",sortable:!0},{id:"description",header:"Description",render:t=>e.jsx("span",{className:"text-sm text-muted-foreground truncate block",title:t.description||"",children:t.description||"—"}),cellClassName:"flex-1 min-w-0 max-w-0",wrap:!1,sortable:!0},{id:"connection_type",header:"Type",accessor:t=>e.jsx("span",{className:"text-xs font-medium",children:t.connection_type}),cellClassName:"w-16 shrink-0",sortable:!0},{id:"status",header:"Status",render:t=>e.jsx(Ce,{status:t.status}),cellClassName:"w-28 shrink-0",sortable:!1},{id:"updated_by",header:"Updated by",render:t=>e.jsx(re,{id:t.updated_by??t.created_by,size:"3xs"}),cellClassName:"w-32 shrink-0",sortable:!0},{id:"updated_at",header:"Updated",render:t=>e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:t.updated_at?_e(new Date(t.updated_at)):"—"}),cellClassName:"max-w-24 w-24 shrink-0",sortable:!0},{id:"actions",header:"",render:t=>e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:n=>n.stopPropagation(),children:e.jsx(fe,{size:20})})}),e.jsxs(ge,{align:"end",onClick:n=>n.stopPropagation(),children:[e.jsxs(F,{onClick:n=>{n.stopPropagation(),i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:t.id}})},children:[e.jsx(ye,{size:16}),"Open"]}),e.jsxs(F,{variant:"destructive",onClick:n=>{n.stopPropagation(),b({type:"delete",connection:t})},children:[e.jsx(ve,{size:16}),"Delete"]})]})]}),cellClassName:"w-12 shrink-0"}],Ae=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"outline",onClick:()=>i({to:"/$org/$project/store",params:{org:s.slug,project:g}}),size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Browse Store"}),e.jsx(S,{onClick:De,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Custom Connection"})]});return e.jsxs(E,{children:[e.jsx(mt,{open:Q||u.mode==="editing",onOpenChange:ne,children:e.jsxs(ut,{className:"sm:max-w-[525px]",children:[e.jsxs(pt,{children:[e.jsx(xt,{children:m?"Edit Connection":"Create Connection"}),e.jsx(ht,{children:m?"Update the connection details below.":"Create a custom connection in your organization. Fill in the details below."})]}),e.jsx(jt,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit($e),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(j,{control:r.control,name:"ui_type",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"Type *"}),e.jsxs(ft,{value:t.value,onValueChange:t.onChange,children:[e.jsx(v,{children:e.jsx(yt,{children:e.jsx(vt,{})})}),e.jsxs(_t,{children:[e.jsx($,{value:"HTTP",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-4 h-4"}),"HTTP"]})}),e.jsx($,{value:"SSE",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-4 h-4"}),"SSE"]})}),e.jsx($,{value:"Websocket",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-4 h-4"}),"Websocket"]})}),N&&e.jsxs(e.Fragment,{children:[e.jsx($,{value:"NPX",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(M,{className:"w-4 h-4"}),"NPX Package"]})}),e.jsx($,{value:"STDIO",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Tt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),e.jsx(_,{})]})}),p==="NPX"&&e.jsx(e.Fragment,{children:e.jsx(j,{control:r.control,name:"npx_package",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"NPM Package *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"@perplexity-ai/mcp-server",...t,value:t.value??"",onPaste:n=>{const a=n.clipboardData.getData("text");a&&(n.preventDefault(),r.setValue("npx_package",a.trim(),{shouldDirty:!0}),V(a))},onBlur:n=>{V(n.target.value),t.onBlur()}})}),e.jsx(_,{})]})})}),p==="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[e.jsx(j,{control:r.control,name:"stdio_command",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"Command *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"node, bun, python...",...t,value:t.value??""})}),e.jsx(_,{})]})}),e.jsx(j,{control:r.control,name:"stdio_args",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"Arguments"}),e.jsx(v,{children:e.jsx(T,{placeholder:"arg1 arg2 --flag value",...t,value:t.value??""})}),e.jsx(_,{})]})})]}),e.jsx(j,{control:r.control,name:"stdio_cwd",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"Working Directory"}),e.jsx(v,{children:e.jsx(T,{placeholder:"/path/to/project (optional)",...t,value:t.value??""})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),e.jsx(_,{})]})})]}),(p==="NPX"||p==="STDIO")&&e.jsx(j,{control:r.control,name:"env_vars",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"Environment Variables"}),e.jsx(v,{children:e.jsx(Pt,{value:t.value??[],onChange:t.onChange})}),e.jsx(_,{})]})}),p!=="NPX"&&p!=="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsx(j,{control:r.control,name:"connection_url",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"URL *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"https://example.com/mcp",...t,value:t.value??"",onPaste:n=>{const a=n.clipboardData.getData("text");a&&(n.preventDefault(),r.setValue("connection_url",a.trim(),{shouldDirty:!0}),V(a))},onBlur:n=>{V(n.target.value),t.onBlur()}})}),e.jsx(_,{})]})}),e.jsx(j,{control:r.control,name:"connection_token",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:P?.token?.label??"Token (optional)"}),e.jsx(v,{children:e.jsx(T,{type:"password",placeholder:P?.token?.placeholder??"Bearer token or API key",...t,value:t.value??""})}),P?.token?.helperText&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[P.token.helperText,P.id==="github"&&e.jsxs(e.Fragment,{children:[" ","·"," ",e.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"})]})]}),e.jsx(_,{})]})})]}),e.jsx(j,{control:r.control,name:"title",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"Name *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"My Connection",...t})}),e.jsx(_,{})]})}),e.jsx(j,{control:r.control,name:"description",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"Description"}),e.jsx(v,{children:e.jsx(Ct,{placeholder:"A brief description of this connection",rows:3,...t,value:t.value??""})}),e.jsx(_,{})]})})]}),e.jsxs(gt,{children:[e.jsx(S,{type:"button",variant:"outline",onClick:()=>ne(!1),children:"Cancel"}),e.jsx(S,{type:"submit",disabled:r.formState.isSubmitting,className:"min-w-40",children:r.formState.isSubmitting?"Saving...":m?"Update Connection":"Create Connection"})]})]})})]})}),e.jsx(ie,{open:u.mode==="deleting",onOpenChange:t=>!t&&b({type:"close"}),children:e.jsxs(ae,{children:[e.jsxs(ce,{children:[e.jsx(le,{children:"Delete Connection?"}),e.jsxs(de,{children:["This action cannot be undone. This will permanently delete"," ",e.jsx("span",{className:"font-medium text-foreground",children:u.mode==="deleting"&&u.connection.title}),"."]})]}),e.jsxs(me,{children:[e.jsx(ue,{children:"Cancel"}),e.jsx(pe,{onClick:Ie,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),e.jsx(ie,{open:u.mode==="force-deleting",onOpenChange:t=>!t&&b({type:"close"}),children:e.jsxs(ae,{children:[e.jsxs(ce,{children:[e.jsx(le,{children:"Connection Used by Agents"}),e.jsx(de,{asChild:!0,children:e.jsxs("div",{children:[e.jsxs("p",{children:["The connection"," ",e.jsx("span",{className:"font-medium text-foreground",children:u.mode==="force-deleting"&&u.connection.title})," ","is currently used by the following agent(s):"," ",e.jsx("span",{className:"font-medium text-foreground",children:u.mode==="force-deleting"&&u.agentNames}),"."]}),e.jsx("p",{className:"mt-2",children:"Deleting this connection will remove it from those agents, which may impact existing workflows that depend on them."})]})})]}),e.jsxs(me,{children:[e.jsx(ue,{children:"Cancel"}),e.jsx(pe,{onClick:Ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Anyway"})]})]})}),e.jsxs(E.Header,{children:[e.jsx(E.Header.Left,{children:e.jsx(at,{children:e.jsx(ct,{children:e.jsx(lt,{children:e.jsx(dt,{children:"Connections"})})})})}),e.jsxs(E.Header.Right,{children:[e.jsx(Qe,{viewMode:l.viewMode,onViewModeChange:l.setViewMode,sortKey:l.sortKey,sortDirection:l.sortDirection,onSort:l.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"updated_by",label:"Updated by"},{id:"updated_at",label:"Updated"}]}),Ae]})]}),e.jsx(Ye,{value:l.search,onChange:l.setSearch,placeholder:"Search for a Connection...",onKeyDown:t=>{t.key==="Escape"&&(l.setSearch(""),t.target.blur())}}),e.jsx(E.Content,{children:l.viewMode==="cards"?e.jsx("div",{className:"flex-1 overflow-auto p-5",children:A.length===0?e.jsx(z,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:(l.search,"No Connections found"),description:l.search?`No Connections match "${l.search}"`:"Create a connection to get started.",actions:!l.search&&e.jsx(S,{variant:"outline",onClick:()=>i({to:"/$org/$project/store",params:{org:s.slug,project:g}}),children:"Browse Store"})}):e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:A.map(t=>e.jsx(Ze,{connection:t,fallbackIcon:e.jsx(M,{}),onClick:()=>i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:t.id}}),headerActions:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:n=>n.stopPropagation(),children:e.jsx(fe,{size:20})})}),e.jsxs(ge,{align:"end",onClick:n=>n.stopPropagation(),children:[e.jsxs(F,{onClick:n=>{n.stopPropagation(),i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:t.id}})},children:[e.jsx(ye,{size:16}),"Open"]}),e.jsxs(F,{variant:"destructive",onClick:n=>{n.stopPropagation(),b({type:"delete",connection:t})},children:[e.jsx(ve,{size:16}),"Delete"]})]})]}),body:e.jsx(Ce,{status:t.status}),footer:e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground w-full min-w-0",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(re,{id:t.updated_by??t.created_by,size:"3xs"})}),e.jsx("span",{className:"shrink-0 ml-2",children:t.updated_at?_e(new Date(t.updated_at)):"—"})]})},t.id))})}):e.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:e.jsx("div",{className:"flex-1 overflow-auto min-w-0",children:e.jsx("div",{className:"min-w-[1000px]",children:e.jsx(Je,{columns:Oe,data:A,isLoading:!1,sortKey:l.sortKey,sortDirection:l.sortDirection,onSort:l.handleSort,onRowClick:t=>i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:t.id}}),emptyState:l.search?e.jsx(z,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:`No Connections match "${l.search}"`}):e.jsx(z,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:"Create a connection to get started.",actions:e.jsx(S,{variant:"outline",onClick:()=>i({to:"/$org/$project/store",params:{org:s.slug,project:g}}),children:"Browse Store"})})})})})})})]})}function Mn(){const s=be.c(1);let o;return s[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(Fe,{children:e.jsx(X.Suspense,{fallback:e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(St,{size:32,className:"animate-spin text-muted-foreground"})}),children:e.jsx(Ht,{})})}),s[0]=o):o=s[0],o}export{Mn as default};
1
+ import{c as be,j as e,E as Fe,r as X,u as Be,m as Ue,b as He,a as ze,d as Le,az as Me,l as Re,k as Xe,i as We,B as S,O as g,t as D,o as ke,aA as Ke,s as C,aB as Ge}from"./index-plkk4e_J.js";import{g as qe}from"./generate-id-Dyweu44Y.js";import{C as Qe,a as Je}from"./collection-table-wrapper-Bz8WElPd.js";import{C as Ye,E as z}from"./collection-search-CxUg-xAQ.js";import{C as Ze}from"./connection-card-CqQpoqHp.js";import{B as L}from"./badge-qrWA_kLG.js";import{i as et}from"./AlertCircle-0hiOc8CZ.js";import{i as tt}from"./CheckCircle-D15lJ7XR.js";import{I as nt}from"./integration-icon-KIbgHijj.js";import{P as E}from"./index-0ocXQ777.js";import{u as st,U as re}from"./use-list-state-BDwJVbli.js";import{u as ot}from"./use-binding-BnDQaQ8a.js";import{f as rt,e as it}from"./registry-utils-CT2cHZWq.js";import{f as ie,a as ae,b as ce,c as le,d as de,e as me,A as ue,g as pe}from"./alert-dialog-COYgvBCq.js";import{B as at,a as ct,b as lt,c as dt}from"./breadcrumb-Zdkq43pK.js";import{D as mt,a as ut,b as pt,c as xt,d as ht,e as gt}from"./dialog-iHT0i0tz.js";import{D as xe,a as he,b as ge,c as F}from"./dropdown-menu-BpyVIc2a.js";import{a as jt,F as j,b as f,c as y,d as v,f as _}from"./form-BP7dMbdn.js";import{I as T}from"./input-CmqvOeLB.js";import{S as ft,a as yt,b as vt,c as _t,d as $}from"./select-DzSheW-c.js";import{T as Ct}from"./textarea-D0tgU2KU.js";import{g as Nt,h as bt}from"./use-connection-CQasYzzj.js";import{u as je,a as kt}from"./constants-CilfzTas.js";import{b as wt}from"./use-mcp-tools-CvszUz7q.js";import{n as M}from"./Container-ufACj1Zy.js";import{i as fe}from"./DotsVertical-Bda0yV1s.js";import{s as ye}from"./Eye-jbWvzlxk.js";import{s as R}from"./Globe02-CGDduE0L.js";import{i as St}from"./Loading01-CWvnRL6a.js";import{i as Tt}from"./Terminal-D1kaOGFC.js";import{s as ve}from"./Trash01-CPjIZLEP.js";import{f as _e}from"./format-time-CMKyl-GC.js";import{r as Dt,E as Pt,e as we}from"./env-vars-editor-Nr3mWxuy.js";import"./ArrowDown-PNhqRNxD.js";import"./ArrowUp-CH0M2x4i.js";import"./Check-xLOyX88L.js";import"./Grid01-Z7sWikL1.js";import"./List-QV8E4GNR.js";import"./tooltip-Bnw97WFs.js";import"./index-BHlJRTz3.js";import"./table-C75ROyVe.js";import"./SearchMd-TuCoj3FU.js";import"./card-DD-UCxfi.js";import"./use-mobile-DLdIzb3b.js";import"./X-tkzrbQVp.js";import"./avatar-B9DZwrpo.js";import"./useQuery-D64ihcYY.js";import"./use-view-mode-v-cu8Xdx.js";import"./binder-13i_lQ0c.js";import"./ChevronRight-D_Ht_JRW.js";import"./label-bnFjyLyV.js";import"./ChevronDown-p63TAVBS.js";import"./useMutation-D4nH_fUX.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./Plus-C-k6EyqD.js";function Ce(s){const o=be.c(3),{status:i}=s;if(i==="active"){let c;return o[0]===Symbol.for("react.memo_cache_sentinel")?(c=e.jsxs(L,{variant:"success",className:"gap-1.5 text-success border-success/40 bg-background",children:[e.jsx(tt,{size:12}),"Active"]}),o[0]=c):c=o[0],c}if(i==="error"){let c;return o[1]===Symbol.for("react.memo_cache_sentinel")?(c=e.jsxs(L,{variant:"outline",className:"gap-1.5 text-destructive border-destructive/40 bg-background",children:[e.jsx(et,{size:12}),"Error"]}),o[1]=c):c=o[1],c}let d;return o[2]===Symbol.for("react.memo_cache_sentinel")?(d=e.jsx(L,{variant:"outline",className:"text-muted-foreground",children:"Inactive"}),o[2]=d):d=o[2],d}const It=ke({key:C(),value:C()}),Et=ke({title:C().min(1,"Name is required"),description:C().nullable().optional(),ui_type:Ge(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:C().optional(),connection_token:C().nullable().optional(),npx_package:C().optional(),stdio_command:C().optional(),stdio_args:C().optional(),stdio_cwd:C().optional(),env_vars:Ke(It).optional()}).refine(s=>s.ui_type==="NPX"?!!s.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(s=>s.ui_type==="STDIO"?!!s.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(s=>s.ui_type==="HTTP"||s.ui_type==="SSE"||s.ui_type==="Websocket"?!!s.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function U(s){const o=s.trim();if(!o)return"";try{const i=new URL(o),d=i.pathname.length>1?i.pathname.replace(/\/+$/,""):i.pathname;return`${i.origin}${d}`}catch{return o.replace(/\/+$/,"")}}function $t(s){const o=s.trim().split(/\s+/).filter(Boolean);if(o.length<2)return null;const i=o[0]?.toLowerCase();if(i!=="npx"&&i!=="bunx")return null;const c=o.slice(1).find(N=>!N.startsWith("-"));return c?{packageName:c}:null}function B(s){const{uiType:o}=s,i=U(s.connectionUrl??"");if((o==="HTTP"||o==="SSE"||o==="Websocket")&&i===U("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 d=(s.npxPackage??"").trim();return o==="NPX"&&d==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function Ne(s){if(s.registryItems.length===0||s.uiType!=="HTTP"&&s.uiType!=="SSE"&&s.uiType!=="Websocket")return null;const o=U(s.connectionUrl??"");if(!o)return null;const i=s.registryItems.find(N=>(N.server?.remotes??[]).some(O=>U(O.url??"")===o));if(!i)return null;const d=i.title||i.name||i.server?.title||i.server?.name||"",c=i.server?.description||i.description||i.summary||null;return d?{id:"registry",title:d,description:c}:null}function Ot(s,o){const i={command:"npx",args:["-y",s]},d=we(o);return Object.keys(d).length>0&&(i.envVars=d),i}function At(s,o,i,d){const c={command:s};o.trim()&&(c.args=o.trim().split(/\s+/)),i?.trim()&&(c.cwd=i.trim());const N=we(d);return Object.keys(N).length>0&&(c.envVars=N),c}function Vt(s){return s.command==="npx"}function Ft(s){return s.args?.find(o=>!o.startsWith("-"))??""}function Bt(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function Ut(s,o){switch(o.type){case"edit":return{mode:"editing",connection:o.connection};case"delete":return{mode:"deleting",connection:o.connection};case"force-delete":return{mode:"force-deleting",connection:o.connection,agentNames:o.agentNames};case"close":return{mode:"idle"}}}function Ht(){const{org:s}=Be(),o=Ue(),i=He(),d=ze({strict:!1}),{data:c}=Le.useSession(),{stdioEnabled:N}=Me(),l=st({namespace:s.slug,resource:"connections"}),O=Nt(),A=bt(l),[u,b]=X.useReducer(Ut,{mode:"idle"}),W=ot(A)[0],K=W?.id??"",G=rt(W?.tools),Se=je({connectionId:K||null,orgId:s.id}),{data:Te}=wt({client:Se,toolName:G,toolArguments:{limit:200},enabled:!!(K&&G),staleTime:3600*1e3,select:t=>t.structuredContent??t}),q=it(Te??[]),Q=d.action==="create",De=()=>{i({to:"/$org/$project/mcps",params:{org:s.slug,project:g},search:{action:"create"}})},J=()=>{i({to:"/$org/$project/mcps",params:{org:s.slug,project:g},search:{}})},r=Re({resolver:Xe(Et),defaultValues:{title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),p=r.watch("ui_type"),Y=r.watch("connection_url"),Pe=r.watch("npx_package"),P=B({uiType:p,connectionUrl:Y??"",npxPackage:Pe??""})??Ne({uiType:p,connectionUrl:Y??"",registryItems:q}),m=u.mode==="editing"?u.connection:null;X.useEffect(()=>{if(m){const t=We(m.connection_headers)?m.connection_headers:null;if(t&&m.connection_type==="STDIO"){const n=Dt(t.envVars);if(Vt(t)){const a=Ft(t);r.reset({title:m.title,description:m.description,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:a,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:n})}else{const a=Bt(t);r.reset({title:m.title,description:m.description,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:a.command,stdio_args:a.args,stdio_cwd:a.cwd,env_vars:n})}}else r.reset({title:m.title,description:m.description,ui_type:m.connection_type,connection_url:m.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})}else r.reset({title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})},[m,r]);const Z=je({connectionId:kt,orgId:s.id}),ee=()=>{o.invalidateQueries({predicate:t=>{const n=t.queryKey;return n[1]===s.id&&n[3]==="collection"&&n[4]==="CONNECTIONS"}})},te=t=>{const n=t.content;return Array.isArray(n)&&n[0]?.type==="text"&&typeof n[0].text=="string"?n[0].text:"Unknown error"},Ie=async()=>{if(u.mode!=="deleting")return;const t=u.connection;b({type:"close"});try{const n=await Z.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:t.id}});if(n.isError){const a=te(n),k=a.replace(/^Error:\s*/,"");try{const x=JSON.parse(k);if(x.code==="CONNECTION_IN_USE"&&x.agentNames){b({type:"force-delete",connection:t,agentNames:x.agentNames.map(w=>`"${w}"`).join(", ")});return}}catch{}D.error(`Failed to delete connection: ${a}`);return}ee(),D.success("Connection deleted successfully")}catch(n){const a=n instanceof Error?n.message:String(n);D.error(`Failed to delete connection: ${a}`)}},Ee=async()=>{if(u.mode!=="force-deleting")return;const t=u.connection.id;b({type:"close"});try{const n=await Z.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:t,force:!0}});if(n.isError){D.error(`Failed to delete connection: ${te(n)}`);return}ee(),D.success("Connection deleted successfully")}catch(n){const a=n instanceof Error?n.message:String(n);D.error(`Failed to delete connection: ${a}`)}},$e=async t=>{let n,a=null,k=null,x=null;if(t.ui_type==="NPX"?(n="STDIO",a="",x=Ot(t.npx_package||"",t.env_vars||[])):t.ui_type==="STDIO"?(n="STDIO",a="",x=At(t.stdio_command||"",t.stdio_args||"",t.stdio_cwd,t.env_vars||[])):(n=t.ui_type,a=t.connection_url||"",k=t.connection_token||null),m){await O.update.mutateAsync({id:m.id,data:{title:t.title,description:t.description||null,connection_type:n,connection_url:a,...k&&{connection_token:k},...x&&{connection_headers:x}}}),b({type:"close"}),r.reset();return}const w=qe("conn");await O.create.mutateAsync({id:w,title:t.title,description:t.description||null,connection_type:n,connection_url:a,connection_token:k,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:c?.user?.id||"system",organization_id:s.id,icon:null,app_name:null,app_id:null,connection_headers:x,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),J(),r.reset(),i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:w}})},ne=t=>{t||(Q?J():b({type:"close"}),r.reset())},V=t=>{const n=t.trim();if(!n)return;const a=!!r.formState.dirtyFields.title,k=!!r.formState.dirtyFields.description,x=!!r.formState.dirtyFields.env_vars,w=h=>{if(h&&(!a&&!r.getValues("title").trim()&&h.title&&r.setValue("title",h.title,{shouldDirty:!1}),!k&&!(r.getValues("description")??"").trim()&&h.description&&r.setValue("description",h.description,{shouldDirty:!1}),!x&&h.envVarKeys?.length)){const se=r.getValues("env_vars")??[],Ve=new Set(se.map(I=>I.key)),oe=h.envVarKeys.filter(I=>!Ve.has(I));oe.length>0&&r.setValue("env_vars",[...se,...oe.map(I=>({key:I,value:""}))],{shouldDirty:!0})}},H=$t(n);if(H&&N){r.setValue("ui_type","NPX",{shouldDirty:!0}),r.setValue("npx_package",H.packageName,{shouldDirty:!0}),r.setValue("connection_url","",{shouldDirty:!0}),r.setValue("connection_token",null,{shouldDirty:!0}),w(B({uiType:"NPX",npxPackage:H.packageName}));return}if(n.startsWith("http://")||n.startsWith("https://")){const h=p==="HTTP"||p==="SSE"||p==="Websocket"?p:"HTTP";r.setValue("ui_type",h,{shouldDirty:!0}),r.setValue("connection_url",n,{shouldDirty:!0}),w(B({uiType:h,connectionUrl:n})??Ne({uiType:h,connectionUrl:n,registryItems:q}));return}p==="NPX"&&w(B({uiType:"NPX",npxPackage:n}))},Oe=[{id:"title",header:"Name",render:t=>e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(nt,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:e.jsx(M,{})}),e.jsx("span",{className:"text-sm font-medium text-foreground truncate block",title:t.title,children:t.title})]}),cellClassName:"w-32 min-w-0 shrink-0",sortable:!0},{id:"description",header:"Description",render:t=>e.jsx("span",{className:"text-sm text-muted-foreground truncate block",title:t.description||"",children:t.description||"—"}),cellClassName:"flex-1 min-w-0 max-w-0",wrap:!1,sortable:!0},{id:"connection_type",header:"Type",accessor:t=>e.jsx("span",{className:"text-xs font-medium",children:t.connection_type}),cellClassName:"w-16 shrink-0",sortable:!0},{id:"status",header:"Status",render:t=>e.jsx(Ce,{status:t.status}),cellClassName:"w-28 shrink-0",sortable:!1},{id:"updated_by",header:"Updated by",render:t=>e.jsx(re,{id:t.updated_by??t.created_by,size:"3xs"}),cellClassName:"w-32 shrink-0",sortable:!0},{id:"updated_at",header:"Updated",render:t=>e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:t.updated_at?_e(new Date(t.updated_at)):"—"}),cellClassName:"max-w-24 w-24 shrink-0",sortable:!0},{id:"actions",header:"",render:t=>e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:n=>n.stopPropagation(),children:e.jsx(fe,{size:20})})}),e.jsxs(ge,{align:"end",onClick:n=>n.stopPropagation(),children:[e.jsxs(F,{onClick:n=>{n.stopPropagation(),i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:t.id}})},children:[e.jsx(ye,{size:16}),"Open"]}),e.jsxs(F,{variant:"destructive",onClick:n=>{n.stopPropagation(),b({type:"delete",connection:t})},children:[e.jsx(ve,{size:16}),"Delete"]})]})]}),cellClassName:"w-12 shrink-0"}],Ae=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"outline",onClick:()=>i({to:"/$org/$project/store",params:{org:s.slug,project:g}}),size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Browse Store"}),e.jsx(S,{onClick:De,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Custom Connection"})]});return e.jsxs(E,{children:[e.jsx(mt,{open:Q||u.mode==="editing",onOpenChange:ne,children:e.jsxs(ut,{className:"sm:max-w-[525px]",children:[e.jsxs(pt,{children:[e.jsx(xt,{children:m?"Edit Connection":"Create Connection"}),e.jsx(ht,{children:m?"Update the connection details below.":"Create a custom connection in your organization. Fill in the details below."})]}),e.jsx(jt,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit($e),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(j,{control:r.control,name:"ui_type",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"Type *"}),e.jsxs(ft,{value:t.value,onValueChange:t.onChange,children:[e.jsx(v,{children:e.jsx(yt,{children:e.jsx(vt,{})})}),e.jsxs(_t,{children:[e.jsx($,{value:"HTTP",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-4 h-4"}),"HTTP"]})}),e.jsx($,{value:"SSE",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-4 h-4"}),"SSE"]})}),e.jsx($,{value:"Websocket",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-4 h-4"}),"Websocket"]})}),N&&e.jsxs(e.Fragment,{children:[e.jsx($,{value:"NPX",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(M,{className:"w-4 h-4"}),"NPX Package"]})}),e.jsx($,{value:"STDIO",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Tt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),e.jsx(_,{})]})}),p==="NPX"&&e.jsx(e.Fragment,{children:e.jsx(j,{control:r.control,name:"npx_package",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"NPM Package *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"@perplexity-ai/mcp-server",...t,value:t.value??"",onPaste:n=>{const a=n.clipboardData.getData("text");a&&(n.preventDefault(),r.setValue("npx_package",a.trim(),{shouldDirty:!0}),V(a))},onBlur:n=>{V(n.target.value),t.onBlur()}})}),e.jsx(_,{})]})})}),p==="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[e.jsx(j,{control:r.control,name:"stdio_command",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"Command *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"node, bun, python...",...t,value:t.value??""})}),e.jsx(_,{})]})}),e.jsx(j,{control:r.control,name:"stdio_args",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"Arguments"}),e.jsx(v,{children:e.jsx(T,{placeholder:"arg1 arg2 --flag value",...t,value:t.value??""})}),e.jsx(_,{})]})})]}),e.jsx(j,{control:r.control,name:"stdio_cwd",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"Working Directory"}),e.jsx(v,{children:e.jsx(T,{placeholder:"/path/to/project (optional)",...t,value:t.value??""})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),e.jsx(_,{})]})})]}),(p==="NPX"||p==="STDIO")&&e.jsx(j,{control:r.control,name:"env_vars",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"Environment Variables"}),e.jsx(v,{children:e.jsx(Pt,{value:t.value??[],onChange:t.onChange})}),e.jsx(_,{})]})}),p!=="NPX"&&p!=="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsx(j,{control:r.control,name:"connection_url",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"URL *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"https://example.com/mcp",...t,value:t.value??"",onPaste:n=>{const a=n.clipboardData.getData("text");a&&(n.preventDefault(),r.setValue("connection_url",a.trim(),{shouldDirty:!0}),V(a))},onBlur:n=>{V(n.target.value),t.onBlur()}})}),e.jsx(_,{})]})}),e.jsx(j,{control:r.control,name:"connection_token",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:P?.token?.label??"Token (optional)"}),e.jsx(v,{children:e.jsx(T,{type:"password",placeholder:P?.token?.placeholder??"Bearer token or API key",...t,value:t.value??""})}),P?.token?.helperText&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[P.token.helperText,P.id==="github"&&e.jsxs(e.Fragment,{children:[" ","·"," ",e.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"})]})]}),e.jsx(_,{})]})})]}),e.jsx(j,{control:r.control,name:"title",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"Name *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"My Connection",...t})}),e.jsx(_,{})]})}),e.jsx(j,{control:r.control,name:"description",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"Description"}),e.jsx(v,{children:e.jsx(Ct,{placeholder:"A brief description of this connection",rows:3,...t,value:t.value??""})}),e.jsx(_,{})]})})]}),e.jsxs(gt,{children:[e.jsx(S,{type:"button",variant:"outline",onClick:()=>ne(!1),children:"Cancel"}),e.jsx(S,{type:"submit",disabled:r.formState.isSubmitting,className:"min-w-40",children:r.formState.isSubmitting?"Saving...":m?"Update Connection":"Create Connection"})]})]})})]})}),e.jsx(ie,{open:u.mode==="deleting",onOpenChange:t=>!t&&b({type:"close"}),children:e.jsxs(ae,{children:[e.jsxs(ce,{children:[e.jsx(le,{children:"Delete Connection?"}),e.jsxs(de,{children:["This action cannot be undone. This will permanently delete"," ",e.jsx("span",{className:"font-medium text-foreground",children:u.mode==="deleting"&&u.connection.title}),"."]})]}),e.jsxs(me,{children:[e.jsx(ue,{children:"Cancel"}),e.jsx(pe,{onClick:Ie,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),e.jsx(ie,{open:u.mode==="force-deleting",onOpenChange:t=>!t&&b({type:"close"}),children:e.jsxs(ae,{children:[e.jsxs(ce,{children:[e.jsx(le,{children:"Connection Used by Agents"}),e.jsx(de,{asChild:!0,children:e.jsxs("div",{children:[e.jsxs("p",{children:["The connection"," ",e.jsx("span",{className:"font-medium text-foreground",children:u.mode==="force-deleting"&&u.connection.title})," ","is currently used by the following agent(s):"," ",e.jsx("span",{className:"font-medium text-foreground",children:u.mode==="force-deleting"&&u.agentNames}),"."]}),e.jsx("p",{className:"mt-2",children:"Deleting this connection will remove it from those agents, which may impact existing workflows that depend on them."})]})})]}),e.jsxs(me,{children:[e.jsx(ue,{children:"Cancel"}),e.jsx(pe,{onClick:Ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Anyway"})]})]})}),e.jsxs(E.Header,{children:[e.jsx(E.Header.Left,{children:e.jsx(at,{children:e.jsx(ct,{children:e.jsx(lt,{children:e.jsx(dt,{children:"Connections"})})})})}),e.jsxs(E.Header.Right,{children:[e.jsx(Qe,{viewMode:l.viewMode,onViewModeChange:l.setViewMode,sortKey:l.sortKey,sortDirection:l.sortDirection,onSort:l.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"updated_by",label:"Updated by"},{id:"updated_at",label:"Updated"}]}),Ae]})]}),e.jsx(Ye,{value:l.search,onChange:l.setSearch,placeholder:"Search for a Connection...",onKeyDown:t=>{t.key==="Escape"&&(l.setSearch(""),t.target.blur())}}),e.jsx(E.Content,{children:l.viewMode==="cards"?e.jsx("div",{className:"flex-1 overflow-auto p-5",children:A.length===0?e.jsx(z,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:(l.search,"No Connections found"),description:l.search?`No Connections match "${l.search}"`:"Create a connection to get started.",actions:!l.search&&e.jsx(S,{variant:"outline",onClick:()=>i({to:"/$org/$project/store",params:{org:s.slug,project:g}}),children:"Browse Store"})}):e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:A.map(t=>e.jsx(Ze,{connection:t,fallbackIcon:e.jsx(M,{}),onClick:()=>i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:t.id}}),headerActions:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:n=>n.stopPropagation(),children:e.jsx(fe,{size:20})})}),e.jsxs(ge,{align:"end",onClick:n=>n.stopPropagation(),children:[e.jsxs(F,{onClick:n=>{n.stopPropagation(),i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:t.id}})},children:[e.jsx(ye,{size:16}),"Open"]}),e.jsxs(F,{variant:"destructive",onClick:n=>{n.stopPropagation(),b({type:"delete",connection:t})},children:[e.jsx(ve,{size:16}),"Delete"]})]})]}),body:e.jsx(Ce,{status:t.status}),footer:e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground w-full min-w-0",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(re,{id:t.updated_by??t.created_by,size:"3xs"})}),e.jsx("span",{className:"shrink-0 ml-2",children:t.updated_at?_e(new Date(t.updated_at)):"—"})]})},t.id))})}):e.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:e.jsx("div",{className:"flex-1 overflow-auto min-w-0",children:e.jsx("div",{className:"min-w-[1000px]",children:e.jsx(Je,{columns:Oe,data:A,isLoading:!1,sortKey:l.sortKey,sortDirection:l.sortDirection,onSort:l.handleSort,onRowClick:t=>i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:t.id}}),emptyState:l.search?e.jsx(z,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:`No Connections match "${l.search}"`}):e.jsx(z,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:"Create a connection to get started.",actions:e.jsx(S,{variant:"outline",onClick:()=>i({to:"/$org/$project/store",params:{org:s.slug,project:g}}),children:"Browse Store"})})})})})})})]})}function Mn(){const s=be.c(1);let o;return s[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(Fe,{children:e.jsx(X.Suspense,{fallback:e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(St,{size:32,className:"animate-spin text-muted-foreground"})}),children:e.jsx(Ht,{})})}),s[0]=o):o=s[0],o}export{Mn as default};
@@ -0,0 +1 @@
1
+ import{a0 as a,a1 as t}from"./index-plkk4e_J.js";const e=a(t,{target:"draft-7"});export{e as B};
@@ -1 +1 @@
1
- import{bQ as h,c as d,n as f,bR as _}from"./index-0HoOnen3.js";const m={authConfig:()=>["authConfig"],threads:t=>["threads",t],virtualMcpThreads:(t,e)=>["threads",t,"virtual-mcp",e],thread:(t,e)=>["thread",t,e],threadMessages:(t,e)=>["thread-messages",t,e],messages:t=>["messages",t],organizations:()=>["organizations"],members:t=>[t,"members"],invitations:t=>[t,"invitations"],organizationRoles:t=>[t,"organization-roles"],connections:t=>[t,"connections"],connectionsByBinding:(t,e)=>[t,"connections",`binding:${e}`],connection:(t,e)=>[t,"connection",e],isMCPAuthenticated:(t,e)=>["is-mcp-authenticated",t,e],mcpTools:(t,e)=>["mcp","tools",t,e],mcpClient:(t,e,n,o)=>["mcp","client",t,e,n,o],mcpToolsList:t=>["mcp","client",t,"tools"],mcpResourcesList:t=>["mcp","client",t,"resources"],mcpPromptsList:t=>["mcp","client",t,"prompts"],mcpReadResource:(t,e)=>["mcp","client",t,"resource",e],mcpGetPrompt:(t,e,n)=>["mcp","client",t,"prompt",e,n],mcpToolCall:(t,e,n)=>["mcp","client",t,"tool-call",e,n],organizationSettings:t=>["organization-settings",t],activeOrganization:t=>["activeOrganization",t],modelsList:t=>["models-list",t],connectionCollections:t=>[t,"collections","discovery"],toolCall:(t,e,n)=>["tool-call",t,e,n],collectionItems:(t,e)=>["collection",t,e],collection:(t,e,n)=>[t,e,"collection",n],collectionItem:(t,e,n,o,i)=>[t,e,n,"collection",o,i],collectionList:(t,e,n,o,i)=>[t,e,n,"collection",o,"list",i],collectionListInfinite:(t,e,n,o,i)=>[t,e,n,"collection",o,"list-infinite",i],githubReadme:(t,e)=>["github-readme",t,e],monitoringStats:()=>["monitoring","stats"],monitoringLogs:t=>["monitoring","logs",t],monitoringLogsInfinite:(t,e)=>["monitoring","logs-infinite",t,e],virtualMcpPrompts:t=>["virtual-mcp",t,"prompts"],connectionPrompts:t=>["connection",t,"prompts"],connectionResources:t=>["connection",t,"resources"],user:t=>["user",t]};class y extends h{constructor(e,n){super(e,n)}send(e,n){const o=b(e);return o?.type==="emit"?(this.onmessage?.(o.message),Promise.resolve()):o?.type==="suppress"?Promise.resolve():super.send(e,n)}}function b(t){const e=t;if(!e||typeof e!="object"||!("method"in e))return null;switch(e.method){case"initialize":{const n=e?.params?.protocolVersion;return n?{type:"emit",message:{result:{protocolVersion:n,capabilities:{tools:{},resources:{},prompts:{},tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}},serverInfo:{name:"mesh-virtual-mcp",version:"1.0.0"}},jsonrpc:e.jsonrpc??"2.0",id:e.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}const C={name:"mesh-sdk",version:"1.0.0"};function T(t,e){const n=e??(typeof window<"u"?window.location.origin:void 0);if(!n)throw new Error("MCP client requires either meshUrl option or a browser environment.");const o=t?`/mcp/${t}`:"/mcp";return new URL(o,n).href}async function g({connectionId:t,orgId:e,token:n,meshUrl:o}){const i=T(t,o),c=new _(C,{capabilities:{tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}}}),r=new y(new URL(i),{requestInit:{headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream","x-org-id":e,...n?{Authorization:`Bearer ${n}`}:{}}}});await c.connect(r);const a=m.mcpClient(e,t??"self",n??"",o??"");return c.toJSON=()=>`mcp-client:${a.join(":")}`,c}function S(t){const e=d.c(13),{connectionId:n,orgId:o,token:i,meshUrl:c}=t;let r;e[0]!==n||e[1]!==c||e[2]!==o||e[3]!==i?(r=m.mcpClient(o,n??"self",i??"",c??""),e[0]=n,e[1]=c,e[2]=o,e[3]=i,e[4]=r):r=e[4];const a=r;let s;e[5]!==n||e[6]!==c||e[7]!==o||e[8]!==i?(s=()=>g({connectionId:n,orgId:o,token:i,meshUrl:c}),e[5]=n,e[6]=c,e[7]=o,e[8]=i,e[9]=s):s=e[9];let l;e[10]!==a||e[11]!==s?(l={queryKey:a,queryFn:s,staleTime:1/0,gcTime:0},e[10]=a,e[11]=s,e[12]=l):l=e[12];const{data:u}=f(l);return u}function I(t){const e=d.c(13),{connectionId:n,orgId:o,token:i,meshUrl:c}=t;let r;e[0]!==n||e[1]!==c||e[2]!==o||e[3]!==i?(r=n!==void 0?m.mcpClient(o,n??"self",i??"",c??""):["mcp","client","skip",o],e[0]=n,e[1]=c,e[2]=o,e[3]=i,e[4]=r):r=e[4];const a=r;let s;e[5]!==n||e[6]!==c||e[7]!==o||e[8]!==i?(s=async()=>n===void 0?null:g({connectionId:n,orgId:o,token:i,meshUrl:c}),e[5]=n,e[6]=c,e[7]=o,e[8]=i,e[9]=s):s=e[9];let l;e[10]!==a||e[11]!==s?(l={queryKey:a,queryFn:s,staleTime:1/0,gcTime:0},e[10]=a,e[11]=s,e[12]=l):l=e[12];const{data:u}=f(l);return u??null}const P={SELF:t=>`${t}_self`,REGISTRY:t=>`${t}_registry`,COMMUNITY_REGISTRY:t=>`${t}_community-registry`,DEV_ASSETS:t=>`${t}_dev-assets`},M="self";function R(t){return{id:P.REGISTRY(t),title:"Deco Store",description:"Official deco MCP registry with curated integrations",connection_type:"HTTP",connection_url:"https://api.decocms.com/mcp/registry",icon:"https://assets.decocache.com/decocms/00ccf6c3-9e13-4517-83b0-75ab84554bb9/596364c63320075ca58483660156b6d9de9b526e.png",app_name:"deco-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}function L(){return{id:"community-registry",title:"MCP Registry",description:"Community MCP registry with thousands of handy MCPs",connection_type:"HTTP",connection_url:"https://sites-registry.decocache.com/mcp",icon:"https://assets.decocache.com/decocms/cd7ca472-0f72-463a-b0de-6e44bdd0f9b4/mcp.png",app_name:"mcp-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}function D(t={}){return{id:t.id,title:"OpenRouter",description:"Access hundreds of LLM models from a single API",icon:"https://assets.decocache.com/decocms/b2e2f64f-6025-45f7-9e8c-3b3ebdd073d8/openrouter_logojpg.jpg",app_name:"openrouter",app_id:"openrouter",connection_type:"HTTP",connection_url:"https://sites-openrouter.decocache.com/mcp",connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{source:"chat",verified:!1,scopeName:"deco",toolsCount:0,publishedAt:null,repository:null}}}function E(){return{title:"MCP Studio",description:"An app that allows you to create and manage MCPs",icon:"https://assets.decocache.com/mcp/09e44283-f47d-4046-955f-816d227c626f/app.png",app_name:"mcp-studio",app_id:"65a1b407-b6af-41e2-a89f-ce9450c05bbc",connection_type:"HTTP",connection_url:"https://sites-vibemcp.decocache.com/mcp",connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!1,type:"mcp-studio"}}}function O(t){return{id:v(t),organization_id:t,title:"Decopilot",description:"Default agent that aggregates all organization connections",icon:"https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png",status:"active",created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:"system",updated_by:void 0,metadata:{instructions:null},connections:[]}}const p="decopilot_";function $(t){return!t||!t.startsWith(p)?null:t.slice(p.length)||null}function v(t){return`${p}${t}`}export{m as K,y as S,P as W,M as a,L as b,g as c,O as d,E as e,D as f,v as g,R as h,$ as i,I as j,S as u};
1
+ import{bB as h,c as d,n as f,bC as _}from"./index-plkk4e_J.js";const m={authConfig:()=>["authConfig"],threads:t=>["threads",t],virtualMcpThreads:(t,e)=>["threads",t,"virtual-mcp",e],thread:(t,e)=>["thread",t,e],threadMessages:(t,e)=>["thread-messages",t,e],messages:t=>["messages",t],organizations:()=>["organizations"],members:t=>[t,"members"],invitations:t=>[t,"invitations"],organizationRoles:t=>[t,"organization-roles"],connections:t=>[t,"connections"],connectionsByBinding:(t,e)=>[t,"connections",`binding:${e}`],connection:(t,e)=>[t,"connection",e],isMCPAuthenticated:(t,e)=>["is-mcp-authenticated",t,e],mcpTools:(t,e)=>["mcp","tools",t,e],mcpClient:(t,e,n,o)=>["mcp","client",t,e,n,o],mcpToolsList:t=>["mcp","client",t,"tools"],mcpResourcesList:t=>["mcp","client",t,"resources"],mcpPromptsList:t=>["mcp","client",t,"prompts"],mcpReadResource:(t,e)=>["mcp","client",t,"resource",e],mcpGetPrompt:(t,e,n)=>["mcp","client",t,"prompt",e,n],mcpToolCall:(t,e,n)=>["mcp","client",t,"tool-call",e,n],organizationSettings:t=>["organization-settings",t],activeOrganization:t=>["activeOrganization",t],modelsList:t=>["models-list",t],connectionCollections:t=>[t,"collections","discovery"],toolCall:(t,e,n)=>["tool-call",t,e,n],collectionItems:(t,e)=>["collection",t,e],collection:(t,e,n)=>[t,e,"collection",n],collectionItem:(t,e,n,o,i)=>[t,e,n,"collection",o,i],collectionList:(t,e,n,o,i)=>[t,e,n,"collection",o,"list",i],collectionListInfinite:(t,e,n,o,i)=>[t,e,n,"collection",o,"list-infinite",i],githubReadme:(t,e)=>["github-readme",t,e],monitoringStats:()=>["monitoring","stats"],monitoringLogs:t=>["monitoring","logs",t],monitoringLogsInfinite:(t,e)=>["monitoring","logs-infinite",t,e],virtualMcpPrompts:t=>["virtual-mcp",t,"prompts"],connectionPrompts:t=>["connection",t,"prompts"],connectionResources:t=>["connection",t,"resources"],user:t=>["user",t]};class y extends h{constructor(e,n){super(e,n)}send(e,n){const o=C(e);return o?.type==="emit"?(this.onmessage?.(o.message),Promise.resolve()):o?.type==="suppress"?Promise.resolve():super.send(e,n)}}function C(t){const e=t;if(!e||typeof e!="object"||!("method"in e))return null;switch(e.method){case"initialize":{const n=e?.params?.protocolVersion;return n?{type:"emit",message:{result:{protocolVersion:n,capabilities:{tools:{},resources:{},prompts:{},tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}},serverInfo:{name:"mesh-virtual-mcp",version:"1.0.0"}},jsonrpc:e.jsonrpc??"2.0",id:e.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}const b={name:"mesh-sdk",version:"1.0.0"};function T(t,e){const n=e??(typeof window<"u"?window.location.origin:void 0);if(!n)throw new Error("MCP client requires either meshUrl option or a browser environment.");const o=t?`/mcp/${t}`:"/mcp";return new URL(o,n).href}async function g({connectionId:t,orgId:e,token:n,meshUrl:o}){const i=T(t,o),c=new _(b,{capabilities:{tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}}}),r=new y(new URL(i),{requestInit:{headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream","x-org-id":e,...n?{Authorization:`Bearer ${n}`}:{}}}});await c.connect(r);const a=m.mcpClient(e,t??"self",n??"",o??"");return c.toJSON=()=>`mcp-client:${a.join(":")}`,c}function S(t){const e=d.c(13),{connectionId:n,orgId:o,token:i,meshUrl:c}=t;let r;e[0]!==n||e[1]!==c||e[2]!==o||e[3]!==i?(r=m.mcpClient(o,n??"self",i??"",c??""),e[0]=n,e[1]=c,e[2]=o,e[3]=i,e[4]=r):r=e[4];const a=r;let s;e[5]!==n||e[6]!==c||e[7]!==o||e[8]!==i?(s=()=>g({connectionId:n,orgId:o,token:i,meshUrl:c}),e[5]=n,e[6]=c,e[7]=o,e[8]=i,e[9]=s):s=e[9];let l;e[10]!==a||e[11]!==s?(l={queryKey:a,queryFn:s,staleTime:1/0,gcTime:0},e[10]=a,e[11]=s,e[12]=l):l=e[12];const{data:u}=f(l);return u}function I(t){const e=d.c(13),{connectionId:n,orgId:o,token:i,meshUrl:c}=t;let r;e[0]!==n||e[1]!==c||e[2]!==o||e[3]!==i?(r=n!==void 0?m.mcpClient(o,n??"self",i??"",c??""):["mcp","client","skip",o],e[0]=n,e[1]=c,e[2]=o,e[3]=i,e[4]=r):r=e[4];const a=r;let s;e[5]!==n||e[6]!==c||e[7]!==o||e[8]!==i?(s=async()=>n===void 0?null:g({connectionId:n,orgId:o,token:i,meshUrl:c}),e[5]=n,e[6]=c,e[7]=o,e[8]=i,e[9]=s):s=e[9];let l;e[10]!==a||e[11]!==s?(l={queryKey:a,queryFn:s,staleTime:1/0,gcTime:0},e[10]=a,e[11]=s,e[12]=l):l=e[12];const{data:u}=f(l);return u??null}const P={SELF:t=>`${t}_self`,REGISTRY:t=>`${t}_registry`,COMMUNITY_REGISTRY:t=>`${t}_community-registry`,DEV_ASSETS:t=>`${t}_dev-assets`},M="self";function R(t){return{id:P.REGISTRY(t),title:"Deco Store",description:"Official deco MCP registry with curated integrations",connection_type:"HTTP",connection_url:"https://api.decocms.com/mcp/registry",icon:"https://assets.decocache.com/decocms/00ccf6c3-9e13-4517-83b0-75ab84554bb9/596364c63320075ca58483660156b6d9de9b526e.png",app_name:"deco-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}function L(){return{id:"community-registry",title:"MCP Registry",description:"Community MCP registry with thousands of handy MCPs",connection_type:"HTTP",connection_url:"https://sites-registry.decocache.com/mcp",icon:"https://assets.decocache.com/decocms/cd7ca472-0f72-463a-b0de-6e44bdd0f9b4/mcp.png",app_name:"mcp-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}function D(t={}){return{id:t.id,title:"OpenRouter",description:"Access hundreds of LLM models from a single API",icon:"https://assets.decocache.com/decocms/b2e2f64f-6025-45f7-9e8c-3b3ebdd073d8/openrouter_logojpg.jpg",app_name:"openrouter",app_id:"openrouter",connection_type:"HTTP",connection_url:"https://sites-openrouter.decocache.com/mcp",connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{source:"chat",verified:!1,scopeName:"deco",toolsCount:0,publishedAt:null,repository:null}}}function E(){return{title:"MCP Studio",description:"An app that allows you to create and manage MCPs",icon:"https://assets.decocache.com/mcp/09e44283-f47d-4046-955f-816d227c626f/app.png",app_name:"mcp-studio",app_id:"65a1b407-b6af-41e2-a89f-ce9450c05bbc",connection_type:"HTTP",connection_url:"https://sites-vibemcp.decocache.com/mcp",connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!1,type:"mcp-studio"}}}function O(t){return{id:v(t),organization_id:t,title:"Decopilot",description:"Default agent that aggregates all organization connections",icon:"https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png",status:"active",created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:"system",updated_by:void 0,metadata:{instructions:null},connections:[]}}const p="decopilot_";function $(t){return!t||!t.startsWith(p)?null:t.slice(p.length)||null}function v(t){return`${p}${t}`}export{m as K,y as S,P as W,M as a,L as b,g as c,O as d,E as e,D as f,v as g,R as h,$ as i,I as j,S as u};