@decocms/mesh 2.127.1 → 2.128.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/dist/client/assets/{AlertCircle-gTiRcsL2.js → AlertCircle-Bi6qVvrN.js} +1 -1
  2. package/dist/client/assets/{AlertOctagon-CCh30giC.js → AlertOctagon-Fcp3y8nF.js} +1 -1
  3. package/dist/client/assets/{AlertTriangle-BtlWEVub.js → AlertTriangle-DFZ90wgN.js} +1 -1
  4. package/dist/client/assets/{ArrowDown-CzYdDuHD.js → ArrowDown-DADN3olT.js} +1 -1
  5. package/dist/client/assets/{ArrowLeft-wb84lLAu.js → ArrowLeft-AtFbPu15.js} +1 -1
  6. package/dist/client/assets/{ArrowUp-CdWHzWi2.js → ArrowUp-Cfyg5juo.js} +1 -1
  7. package/dist/client/assets/{Check-DeEBcLrH.js → Check-Cm2iUQXG.js} +1 -1
  8. package/dist/client/assets/{CheckCircle-DJDu6IBy.js → CheckCircle-DbniBHxr.js} +1 -1
  9. package/dist/client/assets/{CheckDone01-BpcL38Sf.js → CheckDone01-875P-Irn.js} +1 -1
  10. package/dist/client/assets/{CheckVerified02-ChzJ2czs.js → CheckVerified02-D6HcNS_s.js} +1 -1
  11. package/dist/client/assets/{ChevronDown-CpMv-ZCm.js → ChevronDown-BufhPURG.js} +1 -1
  12. package/dist/client/assets/{ChevronRight-CnxoKS9T.js → ChevronRight-Ddi-3F9S.js} +1 -1
  13. package/dist/client/assets/{Clock-2a7XM267.js → Clock-Bvm7X8ou.js} +1 -1
  14. package/dist/client/assets/{Code01-B6d_3DvF.js → Code01-B6JRytqX.js} +1 -1
  15. package/dist/client/assets/{Container-KLxmLuBM.js → Container-B3EmXRhZ.js} +1 -1
  16. package/dist/client/assets/{Copy01-CLunLJKI.js → Copy01-B3XYrA0z.js} +1 -1
  17. package/dist/client/assets/{Dataflow03-0MI9TZIt.js → Dataflow03-Ca2mwTsX.js} +1 -1
  18. package/dist/client/assets/{DotsHorizontal-SZFJ10nV.js → DotsHorizontal-C7JLP9tS.js} +1 -1
  19. package/dist/client/assets/{DotsVertical-D6pC-fy1.js → DotsVertical-CSadjG67.js} +1 -1
  20. package/dist/client/assets/{Download01-GBGLtbUj.js → Download01--BNFvyry.js} +1 -1
  21. package/dist/client/assets/{Edit01-DY0U7OhY.js → Edit01-DKSRjmBx.js} +1 -1
  22. package/dist/client/assets/{Eye-B15TPEDO.js → Eye-DOWXmHLb.js} +1 -1
  23. package/dist/client/assets/{File02-BVAawntr.js → File02-CbipvW6f.js} +1 -1
  24. package/dist/client/assets/{File06-UyeJp3Yn.js → File06-Bcrb96z7.js} +1 -1
  25. package/dist/client/assets/{FilterLines-k9tJPeT3.js → FilterLines-BY0QAs50.js} +1 -1
  26. package/dist/client/assets/{Globe01-DDofBfsO.js → Globe01-DL4AD3PJ.js} +1 -1
  27. package/dist/client/assets/{Globe02-3loTulSB.js → Globe02-YF4Iol6V.js} +1 -1
  28. package/dist/client/assets/{Grid01-Dq0Wc8TI.js → Grid01-DWFyhMlk.js} +1 -1
  29. package/dist/client/assets/{Hash02-Dx1qpCPI.js → Hash02-lVbQabr3.js} +1 -1
  30. package/dist/client/assets/{Home02-DzbZfXTm.js → Home02-CBgwN5B0.js} +1 -1
  31. package/dist/client/assets/{Image01-Cqm-HpUD.js → Image01-BWp0soXg.js} +1 -1
  32. package/dist/client/assets/{Inbox01-Cy78a0Mb.js → Inbox01-DjPYutLV.js} +1 -1
  33. package/dist/client/assets/{InfoCircle-QHkAEzxn.js → InfoCircle-Ba_35fj3.js} +1 -1
  34. package/dist/client/assets/{Key01-Bds3RsgX.js → Key01-DkL0Aa6F.js} +1 -1
  35. package/dist/client/assets/{LinkExternal01-BK1BxQbv.js → LinkExternal01-B0dtroaL.js} +1 -1
  36. package/dist/client/assets/{List-HJgoVtkr.js → List-DvkRrNFX.js} +1 -1
  37. package/dist/client/assets/{Loading01-77NTYviO.js → Loading01-Du7SSOFL.js} +1 -1
  38. package/dist/client/assets/{Lock01-CE-Og3pM.js → Lock01-B_Ca_7Fy.js} +1 -1
  39. package/dist/client/assets/{Play-DfC4hRc3.js → Play-DsN2Vu-9.js} +1 -1
  40. package/dist/client/assets/{Plus-DG0waRPt.js → Plus-GyEYmH7H.js} +1 -1
  41. package/dist/client/assets/{RefreshCcw01-DgNkgC_r.js → RefreshCcw01-CSeua2ip.js} +1 -1
  42. package/dist/client/assets/{RefreshCw01-fyFGfvzx.js → RefreshCw01-BSAySLXB.js} +1 -1
  43. package/dist/client/assets/{Rows03-CaAivaF3.js → Rows03-kYzPV04j.js} +1 -1
  44. package/dist/client/assets/{Save01-BMHaog3F.js → Save01-CoeneoQw.js} +1 -1
  45. package/dist/client/assets/{SearchMd-D25_gEXb.js → SearchMd-CST_zdt_.js} +1 -1
  46. package/dist/client/assets/{Settings01-CLue_Mcp.js → Settings01-DAlQl5Hv.js} +1 -1
  47. package/dist/client/assets/{Shield01-BanwMIAb.js → Shield01-D18Lmcuo.js} +1 -1
  48. package/dist/client/assets/{Terminal-xe5z4JeI.js → Terminal-BoJXcgsb.js} +1 -1
  49. package/dist/client/assets/{Tool01-CXc6Z6rX.js → Tool01-BqSsATCJ.js} +1 -1
  50. package/dist/client/assets/{Trash01-CZXAnYkd.js → Trash01-DTBe8XH-.js} +1 -1
  51. package/dist/client/assets/{Upload01-vyULtK9J.js → Upload01-TqbNCyR0.js} +1 -1
  52. package/dist/client/assets/{Users03-C8GZAEof.js → Users03-C58KX3if.js} +1 -1
  53. package/dist/client/assets/{X-C5YHEo86.js → X-CiUv7JeK.js} +1 -1
  54. package/dist/client/assets/{XCircle-CDdOtTVY.js → XCircle-c-fGPkxr.js} +1 -1
  55. package/dist/client/assets/{XClose-gSM6r0nZ.js → XClose-BOJUsKo6.js} +1 -1
  56. package/dist/client/assets/{agent-connections-preview-053rFYJI.js → agent-connections-preview-0VaJpHmY.js} +1 -1
  57. package/dist/client/assets/{agent-detail-BRL8VrWb.js → agent-detail-DfofQqg_.js} +1 -1
  58. package/dist/client/assets/{agents-XOoh8M4L.js → agents-LlXNozr1.js} +1 -1
  59. package/dist/client/assets/{alert-dialog-O2Rm7jj8.js → alert-dialog-W67uPDui.js} +1 -1
  60. package/dist/client/assets/{auth-catchall-B6Oq1x96.js → auth-catchall-B8ChPBfo.js} +1 -1
  61. package/dist/client/assets/{avatar-De7anvsN.js → avatar-C22lLmXV.js} +1 -1
  62. package/dist/client/assets/{badge-DX_NRCrB.js → badge-wZkXx6tq.js} +1 -1
  63. package/dist/client/assets/{binder-BWaLB8kX.js → binder-CO5VHJsz.js} +1 -1
  64. package/dist/client/assets/{breadcrumb-D8hXSONO.js → breadcrumb-BlLFCMoF.js} +1 -1
  65. package/dist/client/assets/{button-tfLPNtWJ.js → button-BShrPPQB.js} +1 -1
  66. package/dist/client/assets/{card-DOAEt50g.js → card-BO4jLXoP.js} +1 -1
  67. package/dist/client/assets/{chart-RH6Sn5GP.js → chart-DoLzE0dq.js} +1 -1
  68. package/dist/client/assets/{checkbox-BD8R4oHK.js → checkbox-CJOukTQl.js} +1 -1
  69. package/dist/client/assets/{circle-alert-_oaneE91.js → circle-alert-xgiobPeL.js} +1 -1
  70. package/dist/client/assets/{collection-detail-D3RC4AUZ.js → collection-detail-BrigopIz.js} +1 -1
  71. package/dist/client/assets/{collection-search-DP3VOxDY.js → collection-search-epuaoKsC.js} +1 -1
  72. package/dist/client/assets/{collection-tab-CCzVdmvm.js → collection-tab-BDHVvxwA.js} +1 -1
  73. package/dist/client/assets/{collection-table-wrapper-C55HnOv6.js → collection-table-wrapper-BHfH8h7S.js} +1 -1
  74. package/dist/client/assets/{collection-tabs-Cv57OrJk.js → collection-tabs-D_RAhYU-.js} +1 -1
  75. package/dist/client/assets/{command-ZBXly572.js → command-SkTjLnr0.js} +1 -1
  76. package/dist/client/assets/{connect-qtHdHJ1I.js → connect-CLzKNZX3.js} +1 -1
  77. package/dist/client/assets/{connection-card-B8Vrz1b8.js → connection-card-Cs2JqhzD.js} +1 -1
  78. package/dist/client/assets/{connection-detail-Y3K5lv0z.js → connection-detail-DXegMwIj.js} +1 -1
  79. package/dist/client/assets/{connections-B17jR1OX.js → connections-UdkE9Odl.js} +1 -1
  80. package/dist/client/assets/constants-BMvsKHXz.js +1 -0
  81. package/dist/client/assets/{constants-CL8_8_oj.js → constants-t4cYcaOj.js} +1 -1
  82. package/dist/client/assets/{context-D9CqM7rN.js → context-CADU4rSF.js} +1 -1
  83. package/dist/client/assets/{create-organization-dialog-B8wTHjKM.js → create-organization-dialog-C6fo5Hef.js} +1 -1
  84. package/dist/client/assets/{create-project-dialog-B1EyAEHx.js → create-project-dialog-DeWiYUJP.js} +1 -1
  85. package/dist/client/assets/{deco-constants-Co7853uN.js → deco-constants-DwNVBkXd.js} +1 -1
  86. package/dist/client/assets/{dialog-Dy_XRMC3.js → dialog-DZ73hYD2.js} +1 -1
  87. package/dist/client/assets/{dropdown-menu-C1ZnNlCc.js → dropdown-menu-BlYEF8_O.js} +1 -1
  88. package/dist/client/assets/{dynamic-plugin-layout-CPqFU1lA.js → dynamic-plugin-layout-Cj_NN8Sa.js} +1 -1
  89. package/dist/client/assets/{editable-thread-title-BgZLa0-S.js → editable-thread-title-CZzMY2v8.js} +1 -1
  90. package/dist/client/assets/{empty-state-2QYaEyOm.js → empty-state-Fw_Jw9KM.js} +1 -1
  91. package/dist/client/assets/{env-vars-editor-A2uVLiWO.js → env-vars-editor-BfORkosV.js} +1 -1
  92. package/dist/client/assets/{error-boundary--iNQ8gta.js → error-boundary-B8Qhob-A.js} +1 -1
  93. package/dist/client/assets/{extract-connection-data-nDbN7_tg.js → extract-connection-data-DsHfycl1.js} +1 -1
  94. package/dist/client/assets/{file-browser-qHIX-iyB.js → file-browser-DdVjHr4m.js} +2 -2
  95. package/dist/client/assets/{form-Bu9G0YBm.js → form-C6Ox6-3I.js} +1 -1
  96. package/dist/client/assets/{grid-view-3WScGepR.js → grid-view-BHRg_Pme.js} +1 -1
  97. package/dist/client/assets/{home-DOnU6BAd.js → home-Du3a56yX.js} +1 -1
  98. package/dist/client/assets/{index-CVuBarxG.js → index--aNT0bd8.js} +1 -1
  99. package/dist/client/assets/{index-U9Vr21E9.js → index-4ixjLWXM.js} +1 -1
  100. package/dist/client/assets/{index-CFLaQxUg.js → index-BJmUOuV4.js} +1 -1
  101. package/dist/client/assets/{index-D10n-K36.js → index-BfJ-GPYf.js} +1 -1
  102. package/dist/client/assets/{index-iz89DtPg.js → index-CFFAW6El.js} +1 -1
  103. package/dist/client/assets/{index-DA_wRLZy.js → index-CV_imPUN.js} +1 -1
  104. package/dist/client/assets/{index-CWe8J-Hq.js → index-DGcrprcR.js} +3 -3
  105. package/dist/client/assets/{index-DcxptXfK.js → index-ayuCOtc0.js} +1 -1
  106. package/dist/client/assets/{index-Ch6ga_lY.js → index-bJmmgjqx.js} +1 -1
  107. package/dist/client/assets/{infiniteQueryObserver-sdc9LyR0.js → infiniteQueryObserver-BxKDZ2ST.js} +1 -1
  108. package/dist/client/assets/{input-CNUW7CdE.js → input-DvTN1BP6.js} +1 -1
  109. package/dist/client/assets/{integration-icon-B1ucSrYo.js → integration-icon-CgBX_ks3.js} +1 -1
  110. package/dist/client/assets/{label-C9M8nB_D.js → label-qeOE7dIh.js} +1 -1
  111. package/dist/client/assets/{layout-Du0jhu2u.js → layout-odhQDxBs.js} +1 -1
  112. package/dist/client/assets/{localstorage-keys-B08XCBrR.js → localstorage-keys-BQX8_0BZ.js} +1 -1
  113. package/dist/client/assets/{login-BGeMc3UY.js → login-GKelMg3g.js} +1 -1
  114. package/dist/client/assets/{markdown-Beha7Jtr.js → markdown-BhF_-YvH.js} +1 -1
  115. package/dist/client/assets/{mcp-oauth-Bf5n92Z6.js → mcp-oauth-D01_ndal.js} +1 -1
  116. package/dist/client/assets/{mcp-server-card-C5AWkI-Y.js → mcp-server-card-BHBeZkJo.js} +1 -1
  117. package/dist/client/assets/{mcp-server-detail-CASakw41.js → mcp-server-detail-BatwHSxN.js} +2 -2
  118. package/dist/client/assets/{members-Cgz_wHue.js → members-rpOiHXHk.js} +1 -1
  119. package/dist/client/assets/{monitoring-CvEepsfe.js → monitoring-CvC6-eq5.js} +1 -1
  120. package/dist/client/assets/{monitoring-dashboard-edit-C4comU_8.js → monitoring-dashboard-edit-DADoyJ7_.js} +1 -1
  121. package/dist/client/assets/{monitoring-dashboard-view-Bud5sv4I.js → monitoring-dashboard-view-BWj6ZaV3.js} +1 -1
  122. package/dist/client/assets/{oauth-callback-CmYqc2L-.js → oauth-callback-B5gL7lCI.js} +1 -1
  123. package/dist/client/assets/{page-C7OrtuJw.js → page-C58nJ-Li.js} +1 -1
  124. package/dist/client/assets/{page-BXuLYm2j.js → page-DkE_PS55.js} +1 -1
  125. package/dist/client/assets/{plugin-empty-state-9JYg72Wv.js → plugin-empty-state-X7uea6VR.js} +1 -1
  126. package/dist/client/assets/{plugin-empty-state-BAAh8fxn.js → plugin-empty-state-q2whEGVP.js} +1 -1
  127. package/dist/client/assets/{plugin-header-BRkpYFNK.js → plugin-header-C7DE0ct4.js} +1 -1
  128. package/dist/client/assets/{plugin-header-nW9lSeM6.js → plugin-header-Ch-I_bTw.js} +1 -1
  129. package/dist/client/assets/{popover-DB2HonEp.js → popover-Nu95EjX8.js} +1 -1
  130. package/dist/client/assets/{project-layout-L7QwsEuW.js → project-layout-DcWSPHT9.js} +1 -1
  131. package/dist/client/assets/{projects-list-wc8x0cwK.js → projects-list-NJsuEVXb.js} +1 -1
  132. package/dist/client/assets/{ranking-layout-BeNFgd62.js → ranking-layout-B5Zz2w8q.js} +1 -1
  133. package/dist/client/assets/{readme-viewer-CKXEsoh1.js → readme-viewer-Z343YQu7.js} +1 -1
  134. package/dist/client/assets/{registry-layout-yPgoCDfX.js → registry-layout-e-LPyvS8.js} +1 -1
  135. package/dist/client/assets/{registry-utils-Bq5Vnmys.js → registry-utils-COvjQkiO.js} +1 -1
  136. package/dist/client/assets/{reports-layout-BKMF4kWc.js → reports-layout-BCFMfUZH.js} +1 -1
  137. package/dist/client/assets/{reset-password-BMbQ83jF.js → reset-password-BcvesDFp.js} +1 -1
  138. package/dist/client/assets/{resizable-uz-qXPzp.js → resizable-kfZDbkMy.js} +1 -1
  139. package/dist/client/assets/{save-actions-cJA22Jt2.js → save-actions-Df_NW4BN.js} +1 -1
  140. package/dist/client/assets/{scroll-area-ypfKFEm3.js → scroll-area-BJuQHCIp.js} +1 -1
  141. package/dist/client/assets/{select-DC-MYgCv.js → select-DQBmlhEf.js} +1 -1
  142. package/dist/client/assets/{shell-layout-DltVhPnc.js → shell-layout-CH02Na8I.js} +2 -2
  143. package/dist/client/assets/{skeleton-jyQZqxOG.js → skeleton-DQ8ccdHg.js} +1 -1
  144. package/dist/client/assets/{spinner-UfnawxyY.js → spinner-BX-oePRV.js} +1 -1
  145. package/dist/client/assets/{store-invite-DVl_Lais.js → store-invite-hqcnYITt.js} +1 -1
  146. package/dist/client/assets/{switch-KuerVPFw.js → switch-DPh6dtI2.js} +1 -1
  147. package/dist/client/assets/{table-8RrK86eW.js → table-Dr59BlIZ.js} +1 -1
  148. package/dist/client/assets/{tabs-BkMV4XdU.js → tabs-Cai1peX-.js} +1 -1
  149. package/dist/client/assets/{tasks-Djw2Obnw.js → tasks-CamivDB8.js} +1 -1
  150. package/dist/client/assets/{textarea-BKS8B-0-.js → textarea-CMZ8dKCK.js} +1 -1
  151. package/dist/client/assets/{time-range-picker-CAS1lrUx.js → time-range-picker-DI74vKx1.js} +1 -1
  152. package/dist/client/assets/{toggle-group-5L2C16rQ.js → toggle-group-CwM-3IQt.js} +1 -1
  153. package/dist/client/assets/{tools-list-zUY0nGjI.js → tools-list-B9j_bdvI.js} +1 -1
  154. package/dist/client/assets/{tooltip-CnmABkU-.js → tooltip-B4YNhEm3.js} +1 -1
  155. package/dist/client/assets/{topbar-portal-KPVzjsXQ.js → topbar-portal-D-2YmoLb.js} +1 -1
  156. package/dist/client/assets/{types-BRllmd3O.js → types-B4eKYkCD.js} +1 -1
  157. package/dist/client/assets/{use-binding-B-iUklfM.js → use-binding-B4TEVgwJ.js} +1 -1
  158. package/dist/client/assets/{use-connection-uvGXb5bB.js → use-connection-xUIwVn2H.js} +1 -1
  159. package/dist/client/assets/{use-copy-BPEj9iD9.js → use-copy-BUl6Sk74.js} +1 -1
  160. package/dist/client/assets/{use-create-virtual-mcp-CDu5HI2i.js → use-create-virtual-mcp-Cor7Xu1g.js} +1 -1
  161. package/dist/client/assets/{use-deco-chat-open-BPzhNEVE.js → use-deco-chat-open-B8cuCwuQ.js} +1 -1
  162. package/dist/client/assets/{use-install-from-registry-BIorpWqD.js → use-install-from-registry-DlSusZM8.js} +1 -1
  163. package/dist/client/assets/{use-list-state-hbtjFpq8.js → use-list-state-EBDuQbGr.js} +1 -1
  164. package/dist/client/assets/{use-llm-D1Sybk2o.js → use-llm-CuiygiQa.js} +1 -1
  165. package/dist/client/assets/{use-mcp-prompts-D_mlcnc9.js → use-mcp-prompts-DaJitUnA.js} +1 -1
  166. package/dist/client/assets/{use-mcp-tools-BHU8SNYs.js → use-mcp-tools-CQfFVFT8.js} +1 -1
  167. package/dist/client/assets/{use-members-BuLKK-kU.js → use-members-CmtCKeEg.js} +1 -1
  168. package/dist/client/assets/{use-mobile-o_stuDvp.js → use-mobile-D-DrP5e0.js} +1 -1
  169. package/dist/client/assets/{use-project-C7KV4vtq.js → use-project-kKLsM3W2.js} +1 -1
  170. package/dist/client/assets/{use-settings-modal-DKUpDKHN.js → use-settings-modal-Clf9xo0e.js} +1 -1
  171. package/dist/client/assets/{use-view-mode-Bxxsqow8.js → use-view-mode-DptZS1vf.js} +1 -1
  172. package/dist/client/assets/{use-virtual-mcp-BwOE6c59.js → use-virtual-mcp-BpLVEDAn.js} +1 -1
  173. package/dist/client/assets/useInfiniteQuery-DLMQEeqg.js +1 -0
  174. package/dist/client/assets/{useMutation-Cwew6NK8.js → useMutation-DDPkMzlm.js} +1 -1
  175. package/dist/client/assets/useQuery-AhBFUcM2.js +1 -0
  176. package/dist/client/assets/useSuspenseInfiniteQuery-CuoTdKGU.js +1 -0
  177. package/dist/client/assets/{workflow-CnuxFv4B.js → workflow-LLeHyMBS.js} +1 -1
  178. package/dist/client/index.html +1 -1
  179. package/package.json +1 -1
  180. package/dist/client/assets/constants-F73UdIpY.js +0 -1
  181. package/dist/client/assets/useInfiniteQuery-C6n3MmqB.js +0 -1
  182. package/dist/client/assets/useQuery-BHHN8tIv.js +0 -1
  183. package/dist/client/assets/useSuspenseInfiniteQuery-LTF73aNG.js +0 -1
@@ -1 +1 @@
1
- import{c as F,j as t,b as Ne,O as ge,aE as it,u as Be,bX as Qe,au as gt,p as jt,r as K,o as at,bv as bt,bD as vt,s as z,av as Ge,aw as Nt,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-CWe8J-Hq.js";import{E as Z,C as ze}from"./collection-search-DP3VOxDY.js";import{E as ct}from"./error-boundary--iNQ8gta.js";import{E as kt,r as Pt,e as lt}from"./env-vars-editor-A2uVLiWO.js";import{g as Xe}from"./types-BRllmd3O.js";import{S as It}from"./save-actions-cJA22Jt2.js";import{b as $t,a as At}from"./use-binding-B-iUklfM.js";import{u as Vt,S as Mt}from"./index-DcxptXfK.js";import{f as Dt,g as dt}from"./use-connection-uvGXb5bB.js";import{u as mt}from"./constants-CL8_8_oj.js";import{d as Ot}from"./use-mcp-tools-BHU8SNYs.js";import{b as Et,e as Rt}from"./use-mcp-prompts-D_mlcnc9.js";import{a as Lt}from"./mcp-oauth-Bf5n92Z6.js";import{b as Ye,c as Ut,d as Ft,e as Bt,B as zt,a as Xt}from"./breadcrumb-D8hXSONO.js";import{B as Ue}from"./button-tfLPNtWJ.js";import{C as Kt}from"./collection-tabs-Cv57OrJk.js";import{i as Oe}from"./Loading01-77NTYviO.js";import{V as Ke,a as Ht}from"./layout-Du0jhu2u.js";import{C as Wt}from"./collection-tab-CCzVdmvm.js";import{I as Ee}from"./integration-icon-B1ucSrYo.js";import{B as Fe}from"./badge-DX_NRCrB.js";import{D as qt,a as Qt,b as Gt,c as Ze}from"./dropdown-menu-C1ZnNlCc.js";import{F as W,a as Jt,b as q,d as X,f as Q,c as Y,e as Yt}from"./form-Bu9G0YBm.js";import{I as G}from"./input-CNUW7CdE.js";import{S as et,a as tt,b as st,c as nt,d as H}from"./select-DC-MYgCv.js";import{i as ut}from"./CheckCircle-DJDu6IBy.js";import{t as Zt}from"./ChevronDown-CpMv-ZCm.js";import{n as es}from"./Container-KLxmLuBM.js";import{s as De}from"./Globe02-3loTulSB.js";import{s as ts}from"./RefreshCcw01-DgNkgC_r.js";import{i as ss}from"./Terminal-xe5z4JeI.js";import{s as ns}from"./Trash01-CZXAnYkd.js";import{t as He}from"./Users03-C8GZAEof.js";import{s as os}from"./XClose-gSM6r0nZ.js";import{U as rs}from"./use-list-state-hbtjFpq8.js";import{b as is,a as as}from"./use-virtual-mcp-BwOE6c59.js";import{i as cs}from"./ChevronRight-CnxoKS9T.js";import{s as ls}from"./Plus-DG0waRPt.js";import{f as ds}from"./formatDistanceToNow-Cb2QZZJn.js";import{a as pt,C as ft}from"./collection-table-wrapper-C55HnOv6.js";import{C as We}from"./card-DOAEt50g.js";import{R as ms}from"./readme-viewer-CKXEsoh1.js";import{T as us,a as ps}from"./tools-list-zUY0nGjI.js";import{M as fs}from"./index-U9Vr21E9.js";import"./SearchMd-D25_gEXb.js";import"./AlertTriangle-BtlWEVub.js";import"./Save01-BMHaog3F.js";import"./binder-BWaLB8kX.js";import"./File06-UyeJp3Yn.js";import"./Key01-Bds3RsgX.js";import"./constants-F73UdIpY.js";import"./registry-utils-Bq5Vnmys.js";import"./extract-connection-data-nDbN7_tg.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-BIorpWqD.js";import"./index-DA_wRLZy.js";import"./circle-alert-_oaneE91.js";import"./index-Ch6ga_lY.js";import"./index-iz89DtPg.js";import"./context-D9CqM7rN.js";import"./decopilot-events-Brt4gAR6.js";import"./use-llm-D1Sybk2o.js";import"./useQuery-BHHN8tIv.js";import"./localstorage-keys-B08XCBrR.js";import"./useMutation-Cwew6NK8.js";import"./skeleton-jyQZqxOG.js";import"./popover-DB2HonEp.js";import"./Grid01-Dq0Wc8TI.js";import"./Image01-Cqm-HpUD.js";import"./Settings01-CLue_Mcp.js";import"./useSuspenseInfiniteQuery-LTF73aNG.js";import"./infiniteQueryObserver-sdc9LyR0.js";import"./index-CVuBarxG.js";import"./use-mobile-o_stuDvp.js";import"./X-C5YHEo86.js";import"./tooltip-CnmABkU-.js";import"./index-D10n-K36.js";import"./Copy01-CLunLJKI.js";import"./DotsVertical-D6pC-fy1.js";import"./Edit01-DY0U7OhY.js";import"./Eye-B15TPEDO.js";import"./empty-state-2QYaEyOm.js";import"./Inbox01-Cy78a0Mb.js";import"./alert-dialog-O2Rm7jj8.js";import"./Check-DeEBcLrH.js";import"./label-C9M8nB_D.js";import"./avatar-De7anvsN.js";import"./use-view-mode-Bxxsqow8.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./ArrowDown-CzYdDuHD.js";import"./ArrowUp-CdWHzWi2.js";import"./List-HJgoVtkr.js";import"./table-8RrK86eW.js";import"./RefreshCw01-fyFGfvzx.js";import"./spinner-UfnawxyY.js";import"./dialog-Dy_XRMC3.js";import"./usage-B8eRkRZY.js";import"./XCircle-CDdOtTVY.js";import"./AlertCircle-gTiRcsL2.js";import"./tabs-BkMV4XdU.js";import"./ArrowLeft-wb84lLAu.js";import"./use-copy-BPEj9iD9.js";import"./use-deco-chat-open-BPzhNEVE.js";import"./Code01-B6d_3DvF.js";import"./use-create-virtual-mcp-CDu5HI2i.js";import"./deco-constants-Co7853uN.js";import"./marked.esm-BaswSlok.js";import"./markdown-Beha7Jtr.js";import"./Clock-2a7XM267.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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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]=K.useState(""),[h,d]=K.useState("table"),[u,b]=K.useState("name"),[v,_]=K.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(Ke,{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]=K.useState(""),[f,c]=K.useState("table"),[r,h]=K.useState("name"),[d,u]=K.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(Ke,{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]=K.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 $=Xe(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!!Xe(s._meta)}function zs(s){return s.command==="npx"}function Xs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function Ks(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=Xs(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=Ks(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(Xt,{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(Ke,{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(Kt,{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(K.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!!Xe(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(K.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 lr(){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{lr as default};
1
+ import{c as F,j as t,b as Ne,O as ge,aE as it,u as Be,bX as Qe,au as gt,p as jt,r as K,o as at,bv as bt,bD as vt,s as z,av as Ge,aw as Nt,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-DGcrprcR.js";import{E as Z,C as ze}from"./collection-search-epuaoKsC.js";import{E as ct}from"./error-boundary-B8Qhob-A.js";import{E as kt,r as Pt,e as lt}from"./env-vars-editor-BfORkosV.js";import{g as Xe}from"./types-B4eKYkCD.js";import{S as It}from"./save-actions-Df_NW4BN.js";import{b as $t,a as At}from"./use-binding-B4TEVgwJ.js";import{u as Vt,S as Mt}from"./index-ayuCOtc0.js";import{f as Dt,g as dt}from"./use-connection-xUIwVn2H.js";import{u as mt}from"./constants-t4cYcaOj.js";import{d as Ot}from"./use-mcp-tools-CQfFVFT8.js";import{b as Et,e as Rt}from"./use-mcp-prompts-DaJitUnA.js";import{a as Lt}from"./mcp-oauth-D01_ndal.js";import{b as Ye,c as Ut,d as Ft,e as Bt,B as zt,a as Xt}from"./breadcrumb-BlLFCMoF.js";import{B as Ue}from"./button-BShrPPQB.js";import{C as Kt}from"./collection-tabs-D_RAhYU-.js";import{i as Oe}from"./Loading01-Du7SSOFL.js";import{V as Ke,a as Ht}from"./layout-odhQDxBs.js";import{C as Wt}from"./collection-tab-BDHVvxwA.js";import{I as Ee}from"./integration-icon-CgBX_ks3.js";import{B as Fe}from"./badge-wZkXx6tq.js";import{D as qt,a as Qt,b as Gt,c as Ze}from"./dropdown-menu-BlYEF8_O.js";import{F as W,a as Jt,b as q,d as X,f as Q,c as Y,e as Yt}from"./form-C6Ox6-3I.js";import{I as G}from"./input-DvTN1BP6.js";import{S as et,a as tt,b as st,c as nt,d as H}from"./select-DQBmlhEf.js";import{i as ut}from"./CheckCircle-DbniBHxr.js";import{t as Zt}from"./ChevronDown-BufhPURG.js";import{n as es}from"./Container-B3EmXRhZ.js";import{s as De}from"./Globe02-YF4Iol6V.js";import{s as ts}from"./RefreshCcw01-CSeua2ip.js";import{i as ss}from"./Terminal-BoJXcgsb.js";import{s as ns}from"./Trash01-DTBe8XH-.js";import{t as He}from"./Users03-C58KX3if.js";import{s as os}from"./XClose-BOJUsKo6.js";import{U as rs}from"./use-list-state-EBDuQbGr.js";import{b as is,a as as}from"./use-virtual-mcp-BpLVEDAn.js";import{i as cs}from"./ChevronRight-Ddi-3F9S.js";import{s as ls}from"./Plus-GyEYmH7H.js";import{f as ds}from"./formatDistanceToNow-Cb2QZZJn.js";import{a as pt,C as ft}from"./collection-table-wrapper-BHfH8h7S.js";import{C as We}from"./card-BO4jLXoP.js";import{R as ms}from"./readme-viewer-Z343YQu7.js";import{T as us,a as ps}from"./tools-list-B9j_bdvI.js";import{M as fs}from"./index-4ixjLWXM.js";import"./SearchMd-CST_zdt_.js";import"./AlertTriangle-DFZ90wgN.js";import"./Save01-CoeneoQw.js";import"./binder-CO5VHJsz.js";import"./File06-Bcrb96z7.js";import"./Key01-DkL0Aa6F.js";import"./constants-BMvsKHXz.js";import"./registry-utils-COvjQkiO.js";import"./extract-connection-data-DsHfycl1.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-DlSusZM8.js";import"./index-CV_imPUN.js";import"./circle-alert-xgiobPeL.js";import"./index-bJmmgjqx.js";import"./index-CFFAW6El.js";import"./context-CADU4rSF.js";import"./decopilot-events-Brt4gAR6.js";import"./use-llm-CuiygiQa.js";import"./useQuery-AhBFUcM2.js";import"./localstorage-keys-BQX8_0BZ.js";import"./useMutation-DDPkMzlm.js";import"./skeleton-DQ8ccdHg.js";import"./popover-Nu95EjX8.js";import"./Grid01-DWFyhMlk.js";import"./Image01-BWp0soXg.js";import"./Settings01-DAlQl5Hv.js";import"./useSuspenseInfiniteQuery-CuoTdKGU.js";import"./infiniteQueryObserver-BxKDZ2ST.js";import"./index--aNT0bd8.js";import"./use-mobile-D-DrP5e0.js";import"./X-CiUv7JeK.js";import"./tooltip-B4YNhEm3.js";import"./index-BfJ-GPYf.js";import"./Copy01-B3XYrA0z.js";import"./DotsVertical-CSadjG67.js";import"./Edit01-DKSRjmBx.js";import"./Eye-DOWXmHLb.js";import"./empty-state-Fw_Jw9KM.js";import"./Inbox01-DjPYutLV.js";import"./alert-dialog-W67uPDui.js";import"./Check-Cm2iUQXG.js";import"./label-qeOE7dIh.js";import"./avatar-C22lLmXV.js";import"./use-view-mode-DptZS1vf.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./ArrowDown-DADN3olT.js";import"./ArrowUp-Cfyg5juo.js";import"./List-DvkRrNFX.js";import"./table-Dr59BlIZ.js";import"./RefreshCw01-BSAySLXB.js";import"./spinner-BX-oePRV.js";import"./dialog-DZ73hYD2.js";import"./usage-B8eRkRZY.js";import"./XCircle-c-fGPkxr.js";import"./AlertCircle-Bi6qVvrN.js";import"./tabs-Cai1peX-.js";import"./ArrowLeft-AtFbPu15.js";import"./use-copy-BUl6Sk74.js";import"./use-deco-chat-open-B8cuCwuQ.js";import"./Code01-B6JRytqX.js";import"./use-create-virtual-mcp-Cor7Xu1g.js";import"./deco-constants-DwNVBkXd.js";import"./marked.esm-BaswSlok.js";import"./markdown-BhF_-YvH.js";import"./Clock-Bvm7X8ou.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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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]=K.useState(""),[h,d]=K.useState("table"),[u,b]=K.useState("name"),[v,_]=K.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(Ke,{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]=K.useState(""),[f,c]=K.useState("table"),[r,h]=K.useState("name"),[d,u]=K.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(Ke,{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]=K.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 $=Xe(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!!Xe(s._meta)}function zs(s){return s.command==="npx"}function Xs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function Ks(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=Xs(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=Ks(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(Xt,{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(Ke,{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(Kt,{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(K.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!!Xe(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(K.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 lr(){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{lr as default};
@@ -1 +1 @@
1
- import{c as be,j as e,r as X,u as Fe,m as Be,b as Ue,a as He,d as Le,au as Me,l as ze,k as Re,i as Xe,O as g,t as D,o as ke,av as We,s as C,aw as Ke}from"./index-CWe8J-Hq.js";import{g as Ge}from"./generate-id-Dyweu44Y.js";import{C as qe,a as Qe}from"./collection-table-wrapper-C55HnOv6.js";import{C as Je,E as L}from"./collection-search-DP3VOxDY.js";import{C as Ye}from"./connection-card-B8Vrz1b8.js";import{B as M}from"./badge-DX_NRCrB.js";import{i as Ze}from"./AlertCircle-gTiRcsL2.js";import{i as et}from"./CheckCircle-DJDu6IBy.js";import{E as tt}from"./error-boundary--iNQ8gta.js";import{I as nt}from"./integration-icon-B1ucSrYo.js";import{P as E}from"./index-CVuBarxG.js";import{u as st,U as re}from"./use-list-state-hbtjFpq8.js";import{u as ot}from"./use-binding-B-iUklfM.js";import{f as rt,e as it}from"./registry-utils-Bq5Vnmys.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-O2Rm7jj8.js";import{B as at,a as ct,b as lt,c as dt}from"./breadcrumb-D8hXSONO.js";import{B as S}from"./button-tfLPNtWJ.js";import{D as mt,a as ut,b as pt,c as xt,d as ht,e as gt}from"./dialog-Dy_XRMC3.js";import{D as xe,a as he,b as ge,c as F}from"./dropdown-menu-C1ZnNlCc.js";import{a as ft,F as f,b as j,c as y,d as v,f as _}from"./form-Bu9G0YBm.js";import{I as T}from"./input-CNUW7CdE.js";import{S as jt,a as yt,b as vt,c as _t,d as $}from"./select-DC-MYgCv.js";import{T as Ct}from"./textarea-BKS8B-0-.js";import{g as Nt,h as bt}from"./use-connection-uvGXb5bB.js";import{u as fe,a as kt}from"./constants-CL8_8_oj.js";import{b as wt}from"./use-mcp-tools-BHU8SNYs.js";import{n as z}from"./Container-KLxmLuBM.js";import{i as je}from"./DotsVertical-D6pC-fy1.js";import{s as ye}from"./Eye-B15TPEDO.js";import{s as R}from"./Globe02-3loTulSB.js";import{i as St}from"./Loading01-77NTYviO.js";import{i as Tt}from"./Terminal-xe5z4JeI.js";import{s as ve}from"./Trash01-CZXAnYkd.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-A2uVLiWO.js";import"./ArrowDown-CzYdDuHD.js";import"./ArrowUp-CdWHzWi2.js";import"./Check-DeEBcLrH.js";import"./Grid01-Dq0Wc8TI.js";import"./List-HJgoVtkr.js";import"./tooltip-CnmABkU-.js";import"./index-D10n-K36.js";import"./table-8RrK86eW.js";import"./SearchMd-D25_gEXb.js";import"./card-DOAEt50g.js";import"./AlertTriangle-BtlWEVub.js";import"./use-mobile-o_stuDvp.js";import"./X-C5YHEo86.js";import"./avatar-De7anvsN.js";import"./useQuery-BHHN8tIv.js";import"./use-view-mode-Bxxsqow8.js";import"./binder-BWaLB8kX.js";import"./ChevronRight-CnxoKS9T.js";import"./label-C9M8nB_D.js";import"./ChevronDown-CpMv-ZCm.js";import"./useMutation-Cwew6NK8.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./Plus-DG0waRPt.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(M,{variant:"success",className:"gap-1.5 text-success border-success/40 bg-background",children:[e.jsx(et,{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(M,{variant:"outline",className:"gap-1.5 text-destructive border-destructive/40 bg-background",children:[e.jsx(Ze,{size:12}),"Error"]}),o[1]=c):c=o[1],c}let d;return o[2]===Symbol.for("react.memo_cache_sentinel")?(d=e.jsx(M,{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:Ke(["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:We(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}=Fe(),o=Be(),i=Ue(),d=He({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=fe({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=ze({resolver:Re(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=Xe(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=fe({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=Ge("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(z,{})}),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(je,{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(ft,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit($e),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(f,{control:r.control,name:"ui_type",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Type *"}),e.jsxs(jt,{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(z,{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(f,{control:r.control,name:"npx_package",render:({field:t})=>e.jsxs(j,{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(f,{control:r.control,name:"stdio_command",render:({field:t})=>e.jsxs(j,{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(f,{control:r.control,name:"stdio_args",render:({field:t})=>e.jsxs(j,{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(f,{control:r.control,name:"stdio_cwd",render:({field:t})=>e.jsxs(j,{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(f,{control:r.control,name:"env_vars",render:({field:t})=>e.jsxs(j,{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(f,{control:r.control,name:"connection_url",render:({field:t})=>e.jsxs(j,{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(f,{control:r.control,name:"connection_token",render:({field:t})=>e.jsxs(j,{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(f,{control:r.control,name:"title",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Name *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"My Connection",...t})}),e.jsx(_,{})]})}),e.jsx(f,{control:r.control,name:"description",render:({field:t})=>e.jsxs(j,{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(Je,{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(L,{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(Ye,{connection:t,fallbackIcon:e.jsx(z,{}),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(je,{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(Qe,{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(L,{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(L,{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 Wn(){const s=be.c(1);let o;return s[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(tt,{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{Wn as default};
1
+ import{c as be,j as e,r as X,u as Fe,m as Be,b as Ue,a as He,d as Le,au as Me,l as ze,k as Re,i as Xe,O as g,t as D,o as ke,av as We,s as C,aw as Ke}from"./index-DGcrprcR.js";import{g as Ge}from"./generate-id-Dyweu44Y.js";import{C as qe,a as Qe}from"./collection-table-wrapper-BHfH8h7S.js";import{C as Je,E as L}from"./collection-search-epuaoKsC.js";import{C as Ye}from"./connection-card-Cs2JqhzD.js";import{B as M}from"./badge-wZkXx6tq.js";import{i as Ze}from"./AlertCircle-Bi6qVvrN.js";import{i as et}from"./CheckCircle-DbniBHxr.js";import{E as tt}from"./error-boundary-B8Qhob-A.js";import{I as nt}from"./integration-icon-CgBX_ks3.js";import{P as E}from"./index--aNT0bd8.js";import{u as st,U as re}from"./use-list-state-EBDuQbGr.js";import{u as ot}from"./use-binding-B4TEVgwJ.js";import{f as rt,e as it}from"./registry-utils-COvjQkiO.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-W67uPDui.js";import{B as at,a as ct,b as lt,c as dt}from"./breadcrumb-BlLFCMoF.js";import{B as S}from"./button-BShrPPQB.js";import{D as mt,a as ut,b as pt,c as xt,d as ht,e as gt}from"./dialog-DZ73hYD2.js";import{D as xe,a as he,b as ge,c as F}from"./dropdown-menu-BlYEF8_O.js";import{a as ft,F as f,b as j,c as y,d as v,f as _}from"./form-C6Ox6-3I.js";import{I as T}from"./input-DvTN1BP6.js";import{S as jt,a as yt,b as vt,c as _t,d as $}from"./select-DQBmlhEf.js";import{T as Ct}from"./textarea-CMZ8dKCK.js";import{g as Nt,h as bt}from"./use-connection-xUIwVn2H.js";import{u as fe,a as kt}from"./constants-t4cYcaOj.js";import{b as wt}from"./use-mcp-tools-CQfFVFT8.js";import{n as z}from"./Container-B3EmXRhZ.js";import{i as je}from"./DotsVertical-CSadjG67.js";import{s as ye}from"./Eye-DOWXmHLb.js";import{s as R}from"./Globe02-YF4Iol6V.js";import{i as St}from"./Loading01-Du7SSOFL.js";import{i as Tt}from"./Terminal-BoJXcgsb.js";import{s as ve}from"./Trash01-DTBe8XH-.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-BfORkosV.js";import"./ArrowDown-DADN3olT.js";import"./ArrowUp-Cfyg5juo.js";import"./Check-Cm2iUQXG.js";import"./Grid01-DWFyhMlk.js";import"./List-DvkRrNFX.js";import"./tooltip-B4YNhEm3.js";import"./index-BfJ-GPYf.js";import"./table-Dr59BlIZ.js";import"./SearchMd-CST_zdt_.js";import"./card-BO4jLXoP.js";import"./AlertTriangle-DFZ90wgN.js";import"./use-mobile-D-DrP5e0.js";import"./X-CiUv7JeK.js";import"./avatar-C22lLmXV.js";import"./useQuery-AhBFUcM2.js";import"./use-view-mode-DptZS1vf.js";import"./binder-CO5VHJsz.js";import"./ChevronRight-Ddi-3F9S.js";import"./label-qeOE7dIh.js";import"./ChevronDown-BufhPURG.js";import"./useMutation-DDPkMzlm.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./Plus-GyEYmH7H.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(M,{variant:"success",className:"gap-1.5 text-success border-success/40 bg-background",children:[e.jsx(et,{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(M,{variant:"outline",className:"gap-1.5 text-destructive border-destructive/40 bg-background",children:[e.jsx(Ze,{size:12}),"Error"]}),o[1]=c):c=o[1],c}let d;return o[2]===Symbol.for("react.memo_cache_sentinel")?(d=e.jsx(M,{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:Ke(["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:We(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}=Fe(),o=Be(),i=Ue(),d=He({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=fe({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=ze({resolver:Re(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=Xe(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=fe({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=Ge("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(z,{})}),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(je,{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(ft,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit($e),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(f,{control:r.control,name:"ui_type",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Type *"}),e.jsxs(jt,{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(z,{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(f,{control:r.control,name:"npx_package",render:({field:t})=>e.jsxs(j,{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(f,{control:r.control,name:"stdio_command",render:({field:t})=>e.jsxs(j,{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(f,{control:r.control,name:"stdio_args",render:({field:t})=>e.jsxs(j,{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(f,{control:r.control,name:"stdio_cwd",render:({field:t})=>e.jsxs(j,{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(f,{control:r.control,name:"env_vars",render:({field:t})=>e.jsxs(j,{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(f,{control:r.control,name:"connection_url",render:({field:t})=>e.jsxs(j,{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(f,{control:r.control,name:"connection_token",render:({field:t})=>e.jsxs(j,{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(f,{control:r.control,name:"title",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Name *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"My Connection",...t})}),e.jsx(_,{})]})}),e.jsx(f,{control:r.control,name:"description",render:({field:t})=>e.jsxs(j,{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(Je,{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(L,{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(Ye,{connection:t,fallbackIcon:e.jsx(z,{}),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(je,{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(Qe,{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(L,{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(L,{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 Wn(){const s=be.c(1);let o;return s[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(tt,{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{Wn as default};
@@ -0,0 +1 @@
1
+ import{X as t,Y as a}from"./index-DGcrprcR.js";const e=t(a,{target:"draft-7"});export{e as B};
@@ -1 +1 @@
1
- import{bN as h,c as d,n as f,bO as _}from"./index-CWe8J-Hq.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 O(){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 E(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,E as d,O as e,D as f,v as g,R as h,$ as i,I as j,S as u};
1
+ import{bN as h,c as d,n as f,bO as _}from"./index-DGcrprcR.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 O(){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 E(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,E as d,O as e,D as f,v as g,R as h,$ as i,I as j,S as u};
@@ -1,4 +1,4 @@
1
- import{r as I,c5 as es,c6 as ts,X as as,bA as q,s as x,c7 as Be,c8 as Qt,bE as ss,bF as rs,bz as os,bB as B,bv as ke,av as $e,o as j,bC as S,bD as ue,c9 as ns,ca as k,aw as is,bP as ls,c as D,u as be,K as ye,e as Xt,m as We,t as Te,j as d,b as cs,O as us,d as ds}from"./index-CWe8J-Hq.js";import{u as ft,a as ht,d as ps}from"./constants-CL8_8_oj.js";import{b as ms}from"./use-virtual-mcp-BwOE6c59.js";import{A as Nt,D as Ke}from"./decopilot-events-Brt4gAR6.js";import{u as gt,a as fs}from"./use-llm-D1Sybk2o.js";import{u as hs}from"./useQuery-BHHN8tIv.js";import{u as qe,L as vt}from"./localstorage-keys-B08XCBrR.js";import{E as yt}from"./error-boundary--iNQ8gta.js";import{S as U,u as gs}from"./skeleton-jyQZqxOG.js";import{c as Kt,B as ot}from"./button-tfLPNtWJ.js";import{I as vs}from"./input-CNUW7CdE.js";import{P as ys,a as xs,b as bs}from"./popover-DB2HonEp.js";import{S as _s,a as Es,b as Ss,c as Is,d as ws}from"./select-DC-MYgCv.js";import{i as Ts}from"./AlertTriangle-BtlWEVub.js";import{t as nt}from"./ChevronDown-CpMv-ZCm.js";import{i as Ns}from"./File06-UyeJp3Yn.js";import{c as Cs}from"./Grid01-Dq0Wc8TI.js";import{a as As}from"./Image01-Cqm-HpUD.js";import{s as Ms}from"./RefreshCcw01-DgNkgC_r.js";import{i as ea}from"./SearchMd-D25_gEXb.js";import{t as Rs}from"./Settings01-CLue_Mcp.js";import{b as xt,c as js,a as ks,e as Os}from"./use-connection-uvGXb5bB.js";import{u as Ps}from"./useSuspenseInfiniteQuery-LTF73aNG.js";var Oe;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function a(r){throw new Error}t.assertNever=a,t.arrayToEnum=r=>{const o={};for(const i of r)o[i]=i;return o},t.getValidEnumValues=r=>{const o=t.objectKeys(r).filter(n=>typeof r[r[n]]!="number"),i={};for(const n of o)i[n]=r[n];return t.objectValues(i)},t.objectValues=r=>t.objectKeys(r).map(function(o){return r[o]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const o=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&o.push(i);return o},t.find=(r,o)=>{for(const i of r)if(o(i))return i},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,o=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}t.joinValues=s,t.jsonStringifyReplacer=(r,o)=>typeof o=="bigint"?o.toString():o})(Oe||(Oe={}));var Ct;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Ct||(Ct={}));Oe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Oe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class He extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(o){return o.message},s={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(a(i));else{let n=s,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(n[l]=n[l]||{_errors:[]},n[l]._errors.push(a(i))):n[l]=n[l]||{_errors:[]},n=n[l],c++}}};return r(this),s}static assert(e){if(!(e instanceof He))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Oe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a=Object.create(null),s=[];for(const r of this.issues)if(r.path.length>0){const o=r.path[0];a[o]=a[o]||[],a[o].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:a}}get formErrors(){return this.flatten()}}He.create=t=>new He(t);var At;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(At||(At={}));var T;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(T||(T={}));const ta=({size:t=24,color:e="currentColor",...a})=>I.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},I.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));ta.displayName="ChevronSelectorVertical";const aa=({size:t=24,color:e="currentColor",...a})=>I.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},I.createElement("path",{d:"M6 16a4 4 0 0 0 4 4h4a4 4 0 0 0 0-8h-4a4 4 0 0 1 0-8h4a4 4 0 0 1 4 4m-6-6v20"}));aa.displayName="CurrencyDollar";const sa=({size:t=24,color:e="currentColor",...a})=>I.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},I.createElement("path",{d:"m18 8 4 4m0 0-4 4m4-4H9m6-7.796A8.383 8.383 0 0 0 10.667 3C5.88 3 2 7.03 2 12s3.88 9 8.667 9A8.384 8.384 0 0 0 15 19.796"}));sa.displayName="LogOut04";const ra=({size:t=24,color:e="currentColor",...a})=>I.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},I.createElement("path",{d:"m6.5 13 .784 1.569c.266.53.399.796.576 1.026a3 3 0 0 0 .545.545c.23.177.495.31 1.026.575L11 17.5l-1.569.785c-.53.265-.796.398-1.026.575a3 3 0 0 0-.545.545c-.177.23-.31.495-.576 1.026L6.5 22l-.784-1.569c-.266-.53-.399-.796-.576-1.026a3 3 0 0 0-.545-.545c-.23-.177-.495-.31-1.026-.575L2 17.5l1.569-.785c.53-.265.796-.398 1.026-.575a3 3 0 0 0 .545-.545c.177-.23.31-.495.576-1.026L6.5 13ZM15 2l1.179 3.064c.282.734.423 1.1.642 1.409a3 3 0 0 0 .706.706c.309.22.675.36 1.409.642L22 9l-3.064 1.179c-.734.282-1.1.423-1.409.642a3 3 0 0 0-.706.706c-.22.309-.36.675-.642 1.409L15 16l-1.179-3.064c-.282-.734-.423-1.1-.642-1.409a3 3 0 0 0-.706-.706c-.309-.22-.675-.36-1.409-.642L8 9l3.064-1.179c.734-.282 1.1-.423 1.409-.642a3 3 0 0 0 .706-.706c.22-.309.36-.675.642-1.409L15 2Z"}));ra.displayName="Stars01";var oa="vercel.ai.error",Ds=Symbol.for(oa),Mt,Rt,K=class na extends(Rt=Error,Mt=Ds,Rt){constructor({name:e,message:a,cause:s}){super(a),this[Mt]=!0,this.name=e,this.cause=s}static isInstance(e){return na.hasMarker(e,oa)}static hasMarker(e,a){const s=Symbol.for(a);return e!=null&&typeof e=="object"&&s in e&&typeof e[s]=="boolean"&&e[s]===!0}};function ia(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var la="AI_InvalidArgumentError",ca=`vercel.ai.error.${la}`,$s=Symbol.for(ca),jt,kt,Ls=class extends(kt=K,jt=$s,kt){constructor({message:t,cause:e,argument:a}){super({name:la,message:t,cause:e}),this[jt]=!0,this.argument=a}static isInstance(t){return K.hasMarker(t,ca)}},ua="AI_JSONParseError",da=`vercel.ai.error.${ua}`,Zs=Symbol.for(da),Ot,Pt,Dt=class extends(Pt=K,Ot=Zs,Pt){constructor({text:t,cause:e}){super({name:ua,message:`JSON parsing failed: Text: ${t}.
1
+ import{r as I,c5 as es,c6 as ts,X as as,bA as q,s as x,c7 as Be,c8 as Qt,bE as ss,bF as rs,bz as os,bB as B,bv as ke,av as $e,o as j,bC as S,bD as ue,c9 as ns,ca as k,aw as is,bP as ls,c as D,u as be,K as ye,e as Xt,m as We,t as Te,j as d,b as cs,O as us,d as ds}from"./index-DGcrprcR.js";import{u as ft,a as ht,d as ps}from"./constants-t4cYcaOj.js";import{b as ms}from"./use-virtual-mcp-BpLVEDAn.js";import{A as Nt,D as Ke}from"./decopilot-events-Brt4gAR6.js";import{u as gt,a as fs}from"./use-llm-CuiygiQa.js";import{u as hs}from"./useQuery-AhBFUcM2.js";import{u as qe,L as vt}from"./localstorage-keys-BQX8_0BZ.js";import{E as yt}from"./error-boundary-B8Qhob-A.js";import{S as U,u as gs}from"./skeleton-DQ8ccdHg.js";import{c as Kt,B as ot}from"./button-BShrPPQB.js";import{I as vs}from"./input-DvTN1BP6.js";import{P as ys,a as xs,b as bs}from"./popover-Nu95EjX8.js";import{S as _s,a as Es,b as Ss,c as Is,d as ws}from"./select-DQBmlhEf.js";import{i as Ts}from"./AlertTriangle-DFZ90wgN.js";import{t as nt}from"./ChevronDown-BufhPURG.js";import{i as Ns}from"./File06-Bcrb96z7.js";import{c as Cs}from"./Grid01-DWFyhMlk.js";import{a as As}from"./Image01-BWp0soXg.js";import{s as Ms}from"./RefreshCcw01-CSeua2ip.js";import{i as ea}from"./SearchMd-CST_zdt_.js";import{t as Rs}from"./Settings01-DAlQl5Hv.js";import{b as xt,c as js,a as ks,e as Os}from"./use-connection-xUIwVn2H.js";import{u as Ps}from"./useSuspenseInfiniteQuery-CuoTdKGU.js";var Oe;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function a(r){throw new Error}t.assertNever=a,t.arrayToEnum=r=>{const o={};for(const i of r)o[i]=i;return o},t.getValidEnumValues=r=>{const o=t.objectKeys(r).filter(n=>typeof r[r[n]]!="number"),i={};for(const n of o)i[n]=r[n];return t.objectValues(i)},t.objectValues=r=>t.objectKeys(r).map(function(o){return r[o]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const o=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&o.push(i);return o},t.find=(r,o)=>{for(const i of r)if(o(i))return i},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,o=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}t.joinValues=s,t.jsonStringifyReplacer=(r,o)=>typeof o=="bigint"?o.toString():o})(Oe||(Oe={}));var Ct;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Ct||(Ct={}));Oe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Oe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class He extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(o){return o.message},s={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(a(i));else{let n=s,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(n[l]=n[l]||{_errors:[]},n[l]._errors.push(a(i))):n[l]=n[l]||{_errors:[]},n=n[l],c++}}};return r(this),s}static assert(e){if(!(e instanceof He))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Oe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a=Object.create(null),s=[];for(const r of this.issues)if(r.path.length>0){const o=r.path[0];a[o]=a[o]||[],a[o].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:a}}get formErrors(){return this.flatten()}}He.create=t=>new He(t);var At;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(At||(At={}));var T;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(T||(T={}));const ta=({size:t=24,color:e="currentColor",...a})=>I.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},I.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));ta.displayName="ChevronSelectorVertical";const aa=({size:t=24,color:e="currentColor",...a})=>I.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},I.createElement("path",{d:"M6 16a4 4 0 0 0 4 4h4a4 4 0 0 0 0-8h-4a4 4 0 0 1 0-8h4a4 4 0 0 1 4 4m-6-6v20"}));aa.displayName="CurrencyDollar";const sa=({size:t=24,color:e="currentColor",...a})=>I.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},I.createElement("path",{d:"m18 8 4 4m0 0-4 4m4-4H9m6-7.796A8.383 8.383 0 0 0 10.667 3C5.88 3 2 7.03 2 12s3.88 9 8.667 9A8.384 8.384 0 0 0 15 19.796"}));sa.displayName="LogOut04";const ra=({size:t=24,color:e="currentColor",...a})=>I.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},I.createElement("path",{d:"m6.5 13 .784 1.569c.266.53.399.796.576 1.026a3 3 0 0 0 .545.545c.23.177.495.31 1.026.575L11 17.5l-1.569.785c-.53.265-.796.398-1.026.575a3 3 0 0 0-.545.545c-.177.23-.31.495-.576 1.026L6.5 22l-.784-1.569c-.266-.53-.399-.796-.576-1.026a3 3 0 0 0-.545-.545c-.23-.177-.495-.31-1.026-.575L2 17.5l1.569-.785c.53-.265.796-.398 1.026-.575a3 3 0 0 0 .545-.545c.177-.23.31-.495.576-1.026L6.5 13ZM15 2l1.179 3.064c.282.734.423 1.1.642 1.409a3 3 0 0 0 .706.706c.309.22.675.36 1.409.642L22 9l-3.064 1.179c-.734.282-1.1.423-1.409.642a3 3 0 0 0-.706.706c-.22.309-.36.675-.642 1.409L15 16l-1.179-3.064c-.282-.734-.423-1.1-.642-1.409a3 3 0 0 0-.706-.706c-.309-.22-.675-.36-1.409-.642L8 9l3.064-1.179c.734-.282 1.1-.423 1.409-.642a3 3 0 0 0 .706-.706c.22-.309.36-.675.642-1.409L15 2Z"}));ra.displayName="Stars01";var oa="vercel.ai.error",Ds=Symbol.for(oa),Mt,Rt,K=class na extends(Rt=Error,Mt=Ds,Rt){constructor({name:e,message:a,cause:s}){super(a),this[Mt]=!0,this.name=e,this.cause=s}static isInstance(e){return na.hasMarker(e,oa)}static hasMarker(e,a){const s=Symbol.for(a);return e!=null&&typeof e=="object"&&s in e&&typeof e[s]=="boolean"&&e[s]===!0}};function ia(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var la="AI_InvalidArgumentError",ca=`vercel.ai.error.${la}`,$s=Symbol.for(ca),jt,kt,Ls=class extends(kt=K,jt=$s,kt){constructor({message:t,cause:e,argument:a}){super({name:la,message:t,cause:e}),this[jt]=!0,this.argument=a}static isInstance(t){return K.hasMarker(t,ca)}},ua="AI_JSONParseError",da=`vercel.ai.error.${ua}`,Zs=Symbol.for(da),Ot,Pt,Dt=class extends(Pt=K,Ot=Zs,Pt){constructor({text:t,cause:e}){super({name:ua,message:`JSON parsing failed: Text: ${t}.
2
2
  Error message: ${ia(e)}`,cause:e}),this[Ot]=!0,this.text=t}static isInstance(t){return K.hasMarker(t,da)}},pa="AI_TypeValidationError",ma=`vercel.ai.error.${pa}`,Fs=Symbol.for(ma),$t,Lt,Ne=class it extends(Lt=K,$t=Fs,Lt){constructor({value:e,cause:a,context:s}){let r="Type validation failed";if(s?.field&&(r+=` for ${s.field}`),s?.entityName||s?.entityId){r+=" (";const o=[];s.entityName&&o.push(s.entityName),s.entityId&&o.push(`id: "${s.entityId}"`),r+=o.join(", "),r+=")"}super({name:pa,message:`${r}: Value: ${JSON.stringify(e)}.
3
3
  Error message: ${ia(a)}`,cause:a}),this[$t]=!0,this.value=e,this.context=s}static isInstance(e){return K.hasMarker(e,ma)}static wrap({value:e,cause:a,context:s}){var r,o,i;return it.isInstance(a)&&a.value===e&&((r=a.context)==null?void 0:r.field)===s?.field&&((o=a.context)==null?void 0:o.entityName)===s?.entityName&&((i=a.context)==null?void 0:i.entityId)===s?.entityId?a:new it({value:e,cause:a,context:s})}},Le=({prefix:t,size:e=16,alphabet:a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:s="-"}={})=>{const r=()=>{const o=a.length,i=new Array(e);for(let n=0;n<e;n++)i[n]=a[Math.random()*o|0];return i.join("")};if(t==null)return r;if(a.includes(s))throw new Ls({argument:"separator",message:`The separator "${s}" must not be part of the alphabet "${a}".`});return()=>`${t}${s}${r()}`},Us=Le();function Zt(t=globalThis){var e,a,s;return t.window?"runtime/browser":(e=t.navigator)!=null&&e.userAgent?`runtime/${t.navigator.userAgent.toLowerCase()}`:(s=(a=t.process)==null?void 0:a.versions)!=null&&s.node?`runtime/node.js/${t.process.version.substring(0)}`:t.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function ve(t){if(t==null)return{};const e={};if(t instanceof Headers)t.forEach((a,s)=>{e[s.toLowerCase()]=a});else{Array.isArray(t)||(t=Object.entries(t));for(const[a,s]of t)s!=null&&(e[a.toLowerCase()]=s)}return e}function Ft(t,...e){const a=new Headers(ve(t)),s=a.get("user-agent")||"";return a.set("user-agent",[s,...e].filter(Boolean).join(" ")),Object.fromEntries(a.entries())}var zs=/"__proto__"\s*:/,Vs=/"constructor"\s*:/;function Ut(t){const e=JSON.parse(t);return e===null||typeof e!="object"||zs.test(t)===!1&&Vs.test(t)===!1?e:Bs(e)}function Bs(t){let e=[t];for(;e.length;){const a=e;e=[];for(const s of a){if(Object.prototype.hasOwnProperty.call(s,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(s,"constructor")&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const r in s){const o=s[r];o&&typeof o=="object"&&e.push(o)}}}return t}function qs(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return Ut(t)}try{return Ut(t)}finally{Error.stackTraceLimit=e}}function bt(t){if(t.type==="object"||Array.isArray(t.type)&&t.type.includes("object")){t.additionalProperties=!1;const{properties:a}=t;if(a!=null)for(const s of Object.keys(a))a[s]=ge(a[s])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(ge):ge(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(ge)),t.allOf!=null&&(t.allOf=t.allOf.map(ge)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(ge));const{definitions:e}=t;if(e!=null)for(const a of Object.keys(e))e[a]=ge(e[a]);return t}function ge(t){return typeof t=="boolean"?t:bt(t)}var Hs=Symbol("Let zodToJsonSchema decide on which parser to use"),zt={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},Ws=t=>typeof t=="string"?{...zt,name:t}:{...zt,...t};function W(){return{}}function Js(t,e){var a,s,r;const o={type:"array"};return(a=t.type)!=null&&a._def&&((r=(s=t.type)==null?void 0:s._def)==null?void 0:r.typeName)!==T.ZodAny&&(o.items=R(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(o.minItems=t.minLength.value),t.maxLength&&(o.maxItems=t.maxLength.value),t.exactLength&&(o.minItems=t.exactLength.value,o.maxItems=t.exactLength.value),o}function Gs(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const a of t.checks)switch(a.kind){case"min":a.inclusive?e.minimum=a.value:e.exclusiveMinimum=a.value;break;case"max":a.inclusive?e.maximum=a.value:e.exclusiveMaximum=a.value;break;case"multipleOf":e.multipleOf=a.value;break}return e}function Ys(){return{type:"boolean"}}function fa(t,e){return R(t.type._def,e)}var Qs=(t,e)=>R(t.innerType._def,e);function ha(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,o)=>ha(t,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Xs(t)}}var Xs=t=>{const e={type:"integer",format:"unix-time"};for(const a of t.checks)switch(a.kind){case"min":e.minimum=a.value;break;case"max":e.maximum=a.value;break}return e};function Ks(t,e){return{...R(t.innerType._def,e),default:t.defaultValue()}}function er(t,e){return e.effectStrategy==="input"?R(t.schema._def,e):W()}function tr(t){return{type:"string",enum:Array.from(t.values)}}var ar=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function sr(t,e){const a=[R(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),R(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(r=>!!r),s=[];return a.forEach(r=>{if(ar(r))s.push(...r.allOf);else{let o=r;if("additionalProperties"in r&&r.additionalProperties===!1){const{additionalProperties:i,...n}=r;o=n}s.push(o)}}),s.length?{allOf:s}:void 0}function rr(t){const e=typeof t.value;return e!=="bigint"&&e!=="number"&&e!=="boolean"&&e!=="string"?{type:Array.isArray(t.value)?"array":"object"}:{type:e==="bigint"?"integer":e,const:t.value}}var et=void 0,G={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(et===void 0&&(et=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),et),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function ga(t,e){const a={type:"string"};if(t.checks)for(const s of t.checks)switch(s.kind){case"min":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value;break;case"max":a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value;break;case"email":switch(e.emailStrategy){case"format:email":Y(a,"email",s.message,e);break;case"format:idn-email":Y(a,"idn-email",s.message,e);break;case"pattern:zod":V(a,G.email,s.message,e);break}break;case"url":Y(a,"uri",s.message,e);break;case"uuid":Y(a,"uuid",s.message,e);break;case"regex":V(a,s.regex,s.message,e);break;case"cuid":V(a,G.cuid,s.message,e);break;case"cuid2":V(a,G.cuid2,s.message,e);break;case"startsWith":V(a,RegExp(`^${tt(s.value,e)}`),s.message,e);break;case"endsWith":V(a,RegExp(`${tt(s.value,e)}$`),s.message,e);break;case"datetime":Y(a,"date-time",s.message,e);break;case"date":Y(a,"date",s.message,e);break;case"time":Y(a,"time",s.message,e);break;case"duration":Y(a,"duration",s.message,e);break;case"length":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value;break;case"includes":{V(a,RegExp(tt(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Y(a,"ipv4",s.message,e),s.version!=="v4"&&Y(a,"ipv6",s.message,e);break}case"base64url":V(a,G.base64url,s.message,e);break;case"jwt":V(a,G.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&V(a,G.ipv4Cidr,s.message,e),s.version!=="v4"&&V(a,G.ipv6Cidr,s.message,e);break}case"emoji":V(a,G.emoji(),s.message,e);break;case"ulid":{V(a,G.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Y(a,"binary",s.message,e);break}case"contentEncoding:base64":{a.contentEncoding="base64";break}case"pattern:zod":{V(a,G.base64,s.message,e);break}}break}case"nanoid":V(a,G.nanoid,s.message,e)}return a}function tt(t,e){return e.patternStrategy==="escape"?nr(t):t}var or=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function nr(t){let e="";for(let a=0;a<t.length;a++)or.has(t[a])||(e+="\\"),e+=t[a];return e}function Y(t,e,a,s){var r;t.format||(r=t.anyOf)!=null&&r.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...a&&s.errorMessages&&{errorMessage:{format:a}}})):t.format=e}function V(t,e,a,s){var r;t.pattern||(r=t.allOf)!=null&&r.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:Vt(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):t.pattern=Vt(e,s)}function Vt(t,e){var a;if(!e.applyRegexFlags||!t.flags)return t.source;const s={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},r=s.i?t.source.toLowerCase():t.source;let o="",i=!1,n=!1,c=!1;for(let l=0;l<r.length;l++){if(i){o+=r[l],i=!1;continue}if(s.i){if(n){if(r[l].match(/[a-z]/)){c?(o+=r[l],o+=`${r[l-2]}-${r[l]}`.toUpperCase(),c=!1):r[l+1]==="-"&&((a=r[l+2])!=null&&a.match(/[a-z]/))?(o+=r[l],c=!0):o+=`${r[l]}${r[l].toUpperCase()}`;continue}}else if(r[l].match(/[a-z]/)){o+=`[${r[l]}${r[l].toUpperCase()}]`;continue}}if(s.m){if(r[l]==="^"){o+=`(^|(?<=[\r
4
4
  ]))`;continue}else if(r[l]==="$"){o+=`($|(?=[\r
@@ -1 +1 @@
1
- import{o as A,s as D,c as O,k as v,l as E,j as r,d as N}from"./index-CWe8J-Hq.js";import{A as I,a as M,b as L,c as R,d as T,e as $,f as k}from"./alert-dialog-O2Rm7jj8.js";import{B}from"./button-tfLPNtWJ.js";import{F as V,a as q,b as H,c as U,d as G,e as J,f as K}from"./form-Bu9G0YBm.js";import{I as P}from"./input-CNUW7CdE.js";import{S as Q}from"./spinner-UfnawxyY.js";import{u as W}from"./useMutation-Cwew6NK8.js";function _(o){return o.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const X=A({name:D().min(2,"Organization name is required")});function ne(o){const e=O.c(41),{open:a,onOpenChange:s}=o;let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j={resolver:v(X),defaultValues:{name:""}},e[0]=j):j=e[0];const t=E(j);let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w={mutationFn:Z,onSuccess:Y},e[1]=w):w=e[1];const i=W(w),z=i.error instanceof Error?i.error.message:i.error?"Failed to create organization.":null;let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=r.jsxs(L,{children:[r.jsx(R,{children:"Create a new organization"}),r.jsx(T,{children:"Set up a new organization to collaborate with others."})]}),e[2]=F):F=e[2];let n;if(e[3]!==i||e[4]!==t){let x;e[6]!==i?(x=b=>i.mutateAsync(b),e[6]=i,e[7]=x):x=e[7],n=t.handleSubmit(x),e[3]=i,e[4]=t,e[5]=n}else n=e[5];let l;e[8]!==t.formState.isSubmitting?(l=x=>{const{field:b}=x;return r.jsxs(H,{children:[r.jsx(U,{children:"Organization Name"}),r.jsx(G,{children:r.jsx(P,{...b,placeholder:"Acme Inc.",disabled:t.formState.isSubmitting})}),r.jsx(J,{children:"The name of your company or organization"}),b.value&&r.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Organization URL:"," ",r.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",_(b.value)]})]}),r.jsx(K,{})]})},e[8]=t.formState.isSubmitting,e[9]=l):l=e[9];let m;e[10]!==t.control||e[11]!==l?(m=r.jsx(V,{control:t.control,name:"name",render:l}),e[10]=t.control,e[11]=l,e[12]=m):m=e[12];let c;e[13]!==z?(c=z&&r.jsx("div",{className:"text-destructive text-sm mt-2",children:z}),e[13]=z,e[14]=c):c=e[14];let f;e[15]!==i||e[16]!==t?(f=()=>{i.reset(),t.reset()},e[15]=i,e[16]=t,e[17]=f):f=e[17];let g;e[18]!==t.formState.isSubmitting||e[19]!==f?(g=r.jsx(I,{disabled:t.formState.isSubmitting,onClick:f,children:"Cancel"}),e[18]=t.formState.isSubmitting,e[19]=f,e[20]=g):g=e[20];const y=!t.formState.isValid||t.formState.isSubmitting;let u;e[21]!==t.formState.isSubmitting?(u=t.formState.isSubmitting?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Q,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=t.formState.isSubmitting,e[22]=u):u=e[22];let d;e[23]!==y||e[24]!==u?(d=r.jsx(B,{type:"submit",variant:"default",disabled:y,children:u}),e[23]=y,e[24]=u,e[25]=d):d=e[25];let S;e[26]!==d||e[27]!==g?(S=r.jsxs($,{children:[g,d]}),e[26]=d,e[27]=g,e[28]=S):S=e[28];let h;e[29]!==S||e[30]!==n||e[31]!==m||e[32]!==c?(h=r.jsxs("form",{className:"space-y-6",onSubmit:n,autoComplete:"off",children:[m,c,S]}),e[29]=S,e[30]=n,e[31]=m,e[32]=c,e[33]=h):h=e[33];let p;e[34]!==t||e[35]!==h?(p=r.jsxs(M,{children:[F,r.jsx(q,{...t,children:h})]}),e[34]=t,e[35]=h,e[36]=p):p=e[36];let C;return e[37]!==s||e[38]!==a||e[39]!==p?(C=r.jsx(k,{open:a,onOpenChange:s,children:p}),e[37]=s,e[38]=a,e[39]=p,e[40]=C):C=e[40],C}function Y(o){const{orgSlug:e}=o;window.location.href=`/${e}`}async function Z(o){const e=_(o.name);if(!e)throw new Error("Organization slug is invalid");const a=await N.organization.create({name:o.name,slug:e});if(a?.error)throw new Error(a.error.message||"Failed to create organization");const s=a?.data?.slug??e;if(!s)throw new Error("Failed to create organization");return{orgSlug:s}}export{ne as C};
1
+ import{o as A,s as D,c as O,k as v,l as E,j as r,d as N}from"./index-DGcrprcR.js";import{A as I,a as M,b as L,c as R,d as T,e as $,f as k}from"./alert-dialog-W67uPDui.js";import{B}from"./button-BShrPPQB.js";import{F as V,a as q,b as H,c as U,d as G,e as J,f as K}from"./form-C6Ox6-3I.js";import{I as P}from"./input-DvTN1BP6.js";import{S as Q}from"./spinner-BX-oePRV.js";import{u as W}from"./useMutation-DDPkMzlm.js";function _(o){return o.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const X=A({name:D().min(2,"Organization name is required")});function ne(o){const e=O.c(41),{open:a,onOpenChange:s}=o;let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j={resolver:v(X),defaultValues:{name:""}},e[0]=j):j=e[0];const t=E(j);let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w={mutationFn:Z,onSuccess:Y},e[1]=w):w=e[1];const i=W(w),z=i.error instanceof Error?i.error.message:i.error?"Failed to create organization.":null;let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=r.jsxs(L,{children:[r.jsx(R,{children:"Create a new organization"}),r.jsx(T,{children:"Set up a new organization to collaborate with others."})]}),e[2]=F):F=e[2];let n;if(e[3]!==i||e[4]!==t){let x;e[6]!==i?(x=b=>i.mutateAsync(b),e[6]=i,e[7]=x):x=e[7],n=t.handleSubmit(x),e[3]=i,e[4]=t,e[5]=n}else n=e[5];let l;e[8]!==t.formState.isSubmitting?(l=x=>{const{field:b}=x;return r.jsxs(H,{children:[r.jsx(U,{children:"Organization Name"}),r.jsx(G,{children:r.jsx(P,{...b,placeholder:"Acme Inc.",disabled:t.formState.isSubmitting})}),r.jsx(J,{children:"The name of your company or organization"}),b.value&&r.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Organization URL:"," ",r.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",_(b.value)]})]}),r.jsx(K,{})]})},e[8]=t.formState.isSubmitting,e[9]=l):l=e[9];let m;e[10]!==t.control||e[11]!==l?(m=r.jsx(V,{control:t.control,name:"name",render:l}),e[10]=t.control,e[11]=l,e[12]=m):m=e[12];let c;e[13]!==z?(c=z&&r.jsx("div",{className:"text-destructive text-sm mt-2",children:z}),e[13]=z,e[14]=c):c=e[14];let f;e[15]!==i||e[16]!==t?(f=()=>{i.reset(),t.reset()},e[15]=i,e[16]=t,e[17]=f):f=e[17];let g;e[18]!==t.formState.isSubmitting||e[19]!==f?(g=r.jsx(I,{disabled:t.formState.isSubmitting,onClick:f,children:"Cancel"}),e[18]=t.formState.isSubmitting,e[19]=f,e[20]=g):g=e[20];const y=!t.formState.isValid||t.formState.isSubmitting;let u;e[21]!==t.formState.isSubmitting?(u=t.formState.isSubmitting?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Q,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=t.formState.isSubmitting,e[22]=u):u=e[22];let d;e[23]!==y||e[24]!==u?(d=r.jsx(B,{type:"submit",variant:"default",disabled:y,children:u}),e[23]=y,e[24]=u,e[25]=d):d=e[25];let S;e[26]!==d||e[27]!==g?(S=r.jsxs($,{children:[g,d]}),e[26]=d,e[27]=g,e[28]=S):S=e[28];let h;e[29]!==S||e[30]!==n||e[31]!==m||e[32]!==c?(h=r.jsxs("form",{className:"space-y-6",onSubmit:n,autoComplete:"off",children:[m,c,S]}),e[29]=S,e[30]=n,e[31]=m,e[32]=c,e[33]=h):h=e[33];let p;e[34]!==t||e[35]!==h?(p=r.jsxs(M,{children:[F,r.jsx(q,{...t,children:h})]}),e[34]=t,e[35]=h,e[36]=p):p=e[36];let C;return e[37]!==s||e[38]!==a||e[39]!==p?(C=r.jsx(k,{open:a,onOpenChange:s,children:p}),e[37]=s,e[38]=a,e[39]=p,e[40]=C):C=e[40],C}function Y(o){const{orgSlug:e}=o;window.location.href=`/${e}`}async function Z(o){const e=_(o.name);if(!e)throw new Error("Organization slug is invalid");const a=await N.organization.create({name:o.name,slug:e});if(a?.error)throw new Error(a.error.message||"Failed to create organization");const s=a?.data?.slug??e;if(!s)throw new Error("Failed to create organization");return{orgSlug:s}}export{ne as C};
@@ -1 +1 @@
1
- import{c as A,j as e,u as L,b as R,m as k,r as z,l as M,t as B,K as T,O as j,o as V,s as f}from"./index-CWe8J-Hq.js";import{u as $}from"./useMutation-Cwew6NK8.js";import{u as q,a as O}from"./constants-CL8_8_oj.js";import{D as K,a as U,b as G,c as J,d as Q,e as Y}from"./dialog-Dy_XRMC3.js";import{c as H,B as D}from"./button-tfLPNtWJ.js";import{a as W,F as v,b as F,c as N,d as S,f as w}from"./form-Bu9G0YBm.js";import{I}from"./input-CNUW7CdE.js";import{T as X}from"./textarea-BKS8B-0-.js";import{L as Z}from"./label-C9M8nB_D.js";import{i as ee}from"./Check-DeEBcLrH.js";function se(l){return l.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function _(l){return/^[a-z0-9-]+$/.test(l)&&l.length>0&&l.length<=100}const te=["#3B82F6","#8B5CF6","#EC4899","#EF4444","#F97316","#EAB308","#22C55E","#14B8A6","#06B6D4","#6366F1","#64748B","#000000"];function re(l){const s=A.c(16),{value:n,onChange:i}=l;let c;s[0]!==i||s[1]!==n?(c=te.map(o=>e.jsx("button",{type:"button",onClick:()=>i(o),className:H("size-8 rounded-lg transition-all",n===o&&"ring-2 ring-offset-2 ring-primary"),style:{backgroundColor:o},children:n===o&&e.jsx(ee,{className:"size-4 text-white mx-auto"})},o)),s[0]=i,s[1]=n,s[2]=c):c=s[2];let u;s[3]!==c?(u=e.jsx("div",{className:"grid grid-cols-6 gap-2",children:c}),s[3]=c,s[4]=u):u=s[4];const g=n??"#3B82F6";let d;s[5]!==i?(d=o=>i(o.target.value),s[5]=i,s[6]=d):d=s[6];let t;s[7]!==g||s[8]!==d?(t=e.jsx("input",{type:"color",value:g,onChange:d,className:"size-8 rounded cursor-pointer"}),s[7]=g,s[8]=d,s[9]=t):t=s[9];let a;s[10]===Symbol.for("react.memo_cache_sentinel")?(a=e.jsx("span",{className:"text-sm text-muted-foreground",children:"Custom color"}),s[10]=a):a=s[10];let m;s[11]!==t?(m=e.jsxs("div",{className:"flex items-center gap-2",children:[t,a]}),s[11]=t,s[12]=m):m=s[12];let x;return s[13]!==u||s[14]!==m?(x=e.jsxs("div",{className:"space-y-3",children:[u,m]}),s[13]=u,s[14]=m,s[15]=x):x=s[15],x}V({name:f().min(1,"Name is required").max(200),slug:f().min(1,"Slug is required").max(100),description:f().max(1e3).optional(),bannerColor:f().nullable().optional()});function xe({open:l,onOpenChange:s}){const{org:n}=L(),i=R(),c=k(),[u,g]=z.useState(!1),d=q({connectionId:O,orgId:n.id}),t=M({mode:"onChange",defaultValues:{name:"",slug:"",description:"",bannerColor:"#3B82F6"}}),a=$({mutationFn:async r=>{const h=await d.callTool({name:"PROJECT_CREATE",arguments:{organizationId:n.id,slug:r.slug,name:r.name,description:r.description||null,enabledPlugins:[],ui:{banner:null,bannerColor:r.bannerColor??null,icon:null,themeColor:r.bannerColor??null}}});return h.structuredContent??h},onSuccess:r=>{c.invalidateQueries({queryKey:T.projects(n.id)}),B.success("Project created successfully"),s(!1),t.reset({name:"",slug:"",description:"",bannerColor:"#3B82F6"}),g(!1),i({to:"/$org/$project",params:{org:n.slug,project:r.project.slug}})},onError:r=>{B.error("Failed to create project: "+(r instanceof Error?r.message:"Unknown error"))}}),m=async r=>{if(!_(r.slug)){t.setError("slug",{message:"Slug must be lowercase alphanumeric with hyphens only"});return}if(r.slug===j){t.setError("slug",{message:`"${j}" is a reserved slug`});return}await a.mutateAsync(r)},x=r=>{const h=r.target.value;if(t.setValue("name",h),!u){const P=se(h);t.setValue("slug",P)}},o=r=>{g(!0),t.setValue("slug",r.target.value.toLowerCase().replace(/[^a-z0-9-]/g,""))},C=t.watch("bannerColor"),p=t.watch("slug"),b=t.watch("name"),y=p===j,E=p.length>0&&!_(p);return e.jsx(K,{open:l,onOpenChange:s,children:e.jsxs(U,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsxs(G,{children:[e.jsx(J,{children:"Create New Project"}),e.jsxs(Q,{children:["Set up a new project in ",n.name,". You can configure plugins and settings after creation."]})]}),e.jsx(W,{...t,children:e.jsxs("form",{onSubmit:t.handleSubmit(m),className:"space-y-6",children:[e.jsx("div",{className:"h-20 rounded-lg relative",style:{backgroundColor:C??"#3B82F6"},children:e.jsx("div",{className:"absolute -bottom-4 left-4",children:e.jsx("div",{className:"size-12 rounded-lg border-2 border-background flex items-center justify-center text-lg font-semibold text-white",style:{backgroundColor:C??"#3B82F6"},children:b?.charAt(0)?.toUpperCase()||"P"})})}),e.jsxs("div",{className:"space-y-2 pt-4",children:[e.jsx(Z,{children:"Banner Color"}),e.jsx(re,{value:C??null,onChange:r=>t.setValue("bannerColor",r)})]}),e.jsx(v,{control:t.control,name:"name",render:()=>e.jsxs(F,{children:[e.jsx(N,{children:"Project Name *"}),e.jsx(S,{children:e.jsx(I,{value:b,onChange:x,placeholder:"My Awesome Project",autoFocus:!0,disabled:a.isPending})}),e.jsx(w,{})]})}),e.jsx(v,{control:t.control,name:"slug",render:()=>e.jsxs(F,{children:[e.jsx(N,{children:"Slug *"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:["/",n.slug,"/"]}),e.jsx(S,{children:e.jsx(I,{value:p,onChange:o,placeholder:"my-awesome-project",className:"flex-1",disabled:a.isPending})})]}),y&&e.jsxs("p",{className:"text-xs text-destructive",children:['"',j,'" is a reserved slug']}),E&&!y&&e.jsx("p",{className:"text-xs text-destructive",children:"Slug must be lowercase alphanumeric with hyphens only"}),e.jsx(w,{})]})}),e.jsx(v,{control:t.control,name:"description",render:({field:r})=>e.jsxs(F,{children:[e.jsx(N,{children:"Description"}),e.jsx(S,{children:e.jsx(X,{...r,placeholder:"What is this project for?",rows:2,disabled:a.isPending})}),e.jsx(w,{})]})}),e.jsxs(Y,{children:[e.jsx(D,{type:"button",variant:"outline",onClick:()=>s(!1),disabled:a.isPending,children:"Cancel"}),e.jsx(D,{type:"submit",disabled:a.isPending||y||E||!b||!p,children:a.isPending?"Creating...":"Create Project"})]})]})})]})})}export{xe as C};
1
+ import{c as A,j as e,u as L,b as R,m as k,r as z,l as M,t as B,K as T,O as j,o as V,s as f}from"./index-DGcrprcR.js";import{u as $}from"./useMutation-DDPkMzlm.js";import{u as q,a as O}from"./constants-t4cYcaOj.js";import{D as K,a as U,b as G,c as J,d as Q,e as Y}from"./dialog-DZ73hYD2.js";import{c as H,B as D}from"./button-BShrPPQB.js";import{a as W,F as v,b as F,c as N,d as S,f as w}from"./form-C6Ox6-3I.js";import{I}from"./input-DvTN1BP6.js";import{T as X}from"./textarea-CMZ8dKCK.js";import{L as Z}from"./label-qeOE7dIh.js";import{i as ee}from"./Check-Cm2iUQXG.js";function se(l){return l.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function _(l){return/^[a-z0-9-]+$/.test(l)&&l.length>0&&l.length<=100}const te=["#3B82F6","#8B5CF6","#EC4899","#EF4444","#F97316","#EAB308","#22C55E","#14B8A6","#06B6D4","#6366F1","#64748B","#000000"];function re(l){const s=A.c(16),{value:n,onChange:i}=l;let c;s[0]!==i||s[1]!==n?(c=te.map(o=>e.jsx("button",{type:"button",onClick:()=>i(o),className:H("size-8 rounded-lg transition-all",n===o&&"ring-2 ring-offset-2 ring-primary"),style:{backgroundColor:o},children:n===o&&e.jsx(ee,{className:"size-4 text-white mx-auto"})},o)),s[0]=i,s[1]=n,s[2]=c):c=s[2];let u;s[3]!==c?(u=e.jsx("div",{className:"grid grid-cols-6 gap-2",children:c}),s[3]=c,s[4]=u):u=s[4];const g=n??"#3B82F6";let d;s[5]!==i?(d=o=>i(o.target.value),s[5]=i,s[6]=d):d=s[6];let t;s[7]!==g||s[8]!==d?(t=e.jsx("input",{type:"color",value:g,onChange:d,className:"size-8 rounded cursor-pointer"}),s[7]=g,s[8]=d,s[9]=t):t=s[9];let a;s[10]===Symbol.for("react.memo_cache_sentinel")?(a=e.jsx("span",{className:"text-sm text-muted-foreground",children:"Custom color"}),s[10]=a):a=s[10];let m;s[11]!==t?(m=e.jsxs("div",{className:"flex items-center gap-2",children:[t,a]}),s[11]=t,s[12]=m):m=s[12];let x;return s[13]!==u||s[14]!==m?(x=e.jsxs("div",{className:"space-y-3",children:[u,m]}),s[13]=u,s[14]=m,s[15]=x):x=s[15],x}V({name:f().min(1,"Name is required").max(200),slug:f().min(1,"Slug is required").max(100),description:f().max(1e3).optional(),bannerColor:f().nullable().optional()});function xe({open:l,onOpenChange:s}){const{org:n}=L(),i=R(),c=k(),[u,g]=z.useState(!1),d=q({connectionId:O,orgId:n.id}),t=M({mode:"onChange",defaultValues:{name:"",slug:"",description:"",bannerColor:"#3B82F6"}}),a=$({mutationFn:async r=>{const h=await d.callTool({name:"PROJECT_CREATE",arguments:{organizationId:n.id,slug:r.slug,name:r.name,description:r.description||null,enabledPlugins:[],ui:{banner:null,bannerColor:r.bannerColor??null,icon:null,themeColor:r.bannerColor??null}}});return h.structuredContent??h},onSuccess:r=>{c.invalidateQueries({queryKey:T.projects(n.id)}),B.success("Project created successfully"),s(!1),t.reset({name:"",slug:"",description:"",bannerColor:"#3B82F6"}),g(!1),i({to:"/$org/$project",params:{org:n.slug,project:r.project.slug}})},onError:r=>{B.error("Failed to create project: "+(r instanceof Error?r.message:"Unknown error"))}}),m=async r=>{if(!_(r.slug)){t.setError("slug",{message:"Slug must be lowercase alphanumeric with hyphens only"});return}if(r.slug===j){t.setError("slug",{message:`"${j}" is a reserved slug`});return}await a.mutateAsync(r)},x=r=>{const h=r.target.value;if(t.setValue("name",h),!u){const P=se(h);t.setValue("slug",P)}},o=r=>{g(!0),t.setValue("slug",r.target.value.toLowerCase().replace(/[^a-z0-9-]/g,""))},C=t.watch("bannerColor"),p=t.watch("slug"),b=t.watch("name"),y=p===j,E=p.length>0&&!_(p);return e.jsx(K,{open:l,onOpenChange:s,children:e.jsxs(U,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsxs(G,{children:[e.jsx(J,{children:"Create New Project"}),e.jsxs(Q,{children:["Set up a new project in ",n.name,". You can configure plugins and settings after creation."]})]}),e.jsx(W,{...t,children:e.jsxs("form",{onSubmit:t.handleSubmit(m),className:"space-y-6",children:[e.jsx("div",{className:"h-20 rounded-lg relative",style:{backgroundColor:C??"#3B82F6"},children:e.jsx("div",{className:"absolute -bottom-4 left-4",children:e.jsx("div",{className:"size-12 rounded-lg border-2 border-background flex items-center justify-center text-lg font-semibold text-white",style:{backgroundColor:C??"#3B82F6"},children:b?.charAt(0)?.toUpperCase()||"P"})})}),e.jsxs("div",{className:"space-y-2 pt-4",children:[e.jsx(Z,{children:"Banner Color"}),e.jsx(re,{value:C??null,onChange:r=>t.setValue("bannerColor",r)})]}),e.jsx(v,{control:t.control,name:"name",render:()=>e.jsxs(F,{children:[e.jsx(N,{children:"Project Name *"}),e.jsx(S,{children:e.jsx(I,{value:b,onChange:x,placeholder:"My Awesome Project",autoFocus:!0,disabled:a.isPending})}),e.jsx(w,{})]})}),e.jsx(v,{control:t.control,name:"slug",render:()=>e.jsxs(F,{children:[e.jsx(N,{children:"Slug *"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:["/",n.slug,"/"]}),e.jsx(S,{children:e.jsx(I,{value:p,onChange:o,placeholder:"my-awesome-project",className:"flex-1",disabled:a.isPending})})]}),y&&e.jsxs("p",{className:"text-xs text-destructive",children:['"',j,'" is a reserved slug']}),E&&!y&&e.jsx("p",{className:"text-xs text-destructive",children:"Slug must be lowercase alphanumeric with hyphens only"}),e.jsx(w,{})]})}),e.jsx(v,{control:t.control,name:"description",render:({field:r})=>e.jsxs(F,{children:[e.jsx(N,{children:"Description"}),e.jsx(S,{children:e.jsx(X,{...r,placeholder:"What is this project for?",rows:2,disabled:a.isPending})}),e.jsx(w,{})]})}),e.jsxs(Y,{children:[e.jsx(D,{type:"button",variant:"outline",onClick:()=>s(!1),disabled:a.isPending,children:"Cancel"}),e.jsx(D,{type:"submit",disabled:a.isPending||y||E||!b||!p,children:a.isPending?"Creating...":"Create Project"})]})]})})]})})}export{xe as C};
@@ -1 +1 @@
1
- import{r as s}from"./index-CWe8J-Hq.js";const c=({size:e=24,color:t="currentColor",...o})=>s.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...o},s.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));c.displayName="Coins01";const p="https://sites-openrouter.decocache.com/mcp",a="https://sites-deco-ai-gateway.decocache.com/mcp",n=[a];function d(e){if(!e)return!1;try{const t=new URL(e);return n.some(o=>{const r=new URL(o);return t.origin===r.origin&&t.pathname.replace(/\/$/,"")===r.pathname})}catch{return!1}}const h="https://assets.decocache.com/decocms/b2e2f64f-6025-45f7-9e8c-3b3ebdd073d8/openrouter_logojpg.jpg";export{h as O,c as a,p as b,d as i};
1
+ import{r as s}from"./index-DGcrprcR.js";const c=({size:e=24,color:t="currentColor",...o})=>s.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...o},s.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));c.displayName="Coins01";const p="https://sites-openrouter.decocache.com/mcp",a="https://sites-deco-ai-gateway.decocache.com/mcp",n=[a];function d(e){if(!e)return!1;try{const t=new URL(e);return n.some(o=>{const r=new URL(o);return t.origin===r.origin&&t.pathname.replace(/\/$/,"")===r.pathname})}catch{return!1}}const h="https://assets.decocache.com/decocms/b2e2f64f-6025-45f7-9e8c-3b3ebdd073d8/openrouter_logojpg.jpg";export{h as O,c as a,p as b,d as i};