@decocms/mesh 2.139.1 → 2.139.2
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.
- package/dist/client/assets/{AlertCircle-DNgqx8KI.js → AlertCircle-BDyT9vNZ.js} +1 -1
- package/dist/client/assets/{AlignLeft-D2gIcSDq.js → AlignLeft-BixvP29Y.js} +1 -1
- package/dist/client/assets/{ArrowDown-CaOFq6pQ.js → ArrowDown-BYesfwXe.js} +1 -1
- package/dist/client/assets/{ArrowLeft-UNV7B-AG.js → ArrowLeft-BAkHebXa.js} +1 -1
- package/dist/client/assets/{ArrowUp-CQq_iQrI.js → ArrowUp-BCyv-ojK.js} +1 -1
- package/dist/client/assets/{Check-BvMJM-Sw.js → Check-Camn3oQw.js} +1 -1
- package/dist/client/assets/{CheckCircle-NPrGj804.js → CheckCircle-B7XGhEcJ.js} +1 -1
- package/dist/client/assets/{CheckDone01-BwVW6pd_.js → CheckDone01-CldSAlfc.js} +1 -1
- package/dist/client/assets/{CheckVerified02-C1MjbRtN.js → CheckVerified02-K0TWAV06.js} +1 -1
- package/dist/client/assets/{ChevronDown-C60hOPCP.js → ChevronDown-DkqBWU_h.js} +1 -1
- package/dist/client/assets/{ChevronLeft-B2HrVwNr.js → ChevronLeft-BPmkNFNc.js} +1 -1
- package/dist/client/assets/{ChevronRight-Sru8EpEz.js → ChevronRight-BI34N28O.js} +1 -1
- package/dist/client/assets/{Clock-Dfwp-ruh.js → Clock-BqFZuRNT.js} +1 -1
- package/dist/client/assets/{Code01-Db51N7Ml.js → Code01-DcYAohyI.js} +1 -1
- package/dist/client/assets/{Container-B8DmhgZQ.js → Container-B8pG1v5Y.js} +1 -1
- package/dist/client/assets/{Copy01-Dd1E3TCJ.js → Copy01-GXSpNbxP.js} +1 -1
- package/dist/client/assets/{Dataflow03-D-RFc5La.js → Dataflow03-Cz5aNZkd.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-BrHuq-yv.js → DotsHorizontal-DseOTG6x.js} +1 -1
- package/dist/client/assets/{DotsVertical-feXQsLpQ.js → DotsVertical-DgG2OQVv.js} +1 -1
- package/dist/client/assets/{Download01-xM4JnupA.js → Download01-DV6jzPqo.js} +1 -1
- package/dist/client/assets/{Edit01-CE3Lg5ZM.js → Edit01-nsEjgwmh.js} +1 -1
- package/dist/client/assets/{Edit05-COnRWzeL.js → Edit05-BLS2FJfm.js} +1 -1
- package/dist/client/assets/{Eye-CCXNKQ3i.js → Eye-DQF_Qzuy.js} +1 -1
- package/dist/client/assets/{File02-DODOChlP.js → File02-QDXoffKV.js} +1 -1
- package/dist/client/assets/{File06-BW0G-Nsj.js → File06-DNhGyMHz.js} +1 -1
- package/dist/client/assets/{FilterLines-Dv3Dliqf.js → FilterLines-lwBT4U5d.js} +1 -1
- package/dist/client/assets/{Globe01-GGyD5Tgu.js → Globe01-lQfF_p8O.js} +1 -1
- package/dist/client/assets/{Globe02-BHELIlHY.js → Globe02-sIfslzHX.js} +1 -1
- package/dist/client/assets/{Grid01-DBuyZdtC.js → Grid01-CTYtPHN4.js} +1 -1
- package/dist/client/assets/{Hash02-DHLHwLlD.js → Hash02-DU1c1Jak.js} +1 -1
- package/dist/client/assets/{Home02-D4Pi_zad.js → Home02-D8QOVzlb.js} +1 -1
- package/dist/client/assets/{Image01-hprGlSB4.js → Image01-BNs8seI1.js} +1 -1
- package/dist/client/assets/{Inbox01-BXzWXZim.js → Inbox01-DTh-ZtU7.js} +1 -1
- package/dist/client/assets/{InfoCircle-cTltWTGD.js → InfoCircle-s0dGNMks.js} +1 -1
- package/dist/client/assets/{Key01-UF8G2Wth.js → Key01-CHf-4NZR.js} +1 -1
- package/dist/client/assets/{LayersTwo01-DbxVUzP3.js → LayersTwo01-zg7ssS5q.js} +1 -1
- package/dist/client/assets/{LayoutLeft-2Jes2cxW.js → LayoutLeft-vITOgZDF.js} +1 -1
- package/dist/client/assets/{Link01-x3rUsD6r.js → Link01-B46W_qyR.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BR9go5n9.js → LinkExternal01-CWUdHxEb.js} +1 -1
- package/dist/client/assets/{List-B76tHO2m.js → List-DXD0Q-rz.js} +1 -1
- package/dist/client/assets/{Loading01-CjjE3eBW.js → Loading01-HszUOya-.js} +1 -1
- package/dist/client/assets/{Lock01-D8t-sVBo.js → Lock01-sWjWjRt6.js} +1 -1
- package/dist/client/assets/{Play-xWkkmxRw.js → Play-DYN0MmVY.js} +1 -1
- package/dist/client/assets/{Plus-4XunsH-w.js → Plus-BaoKmylk.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-DIjgBTR_.js → RefreshCcw01-yUiODtTq.js} +1 -1
- package/dist/client/assets/{Save01-C9WQeXbC.js → Save01-Co3EpgQC.js} +1 -1
- package/dist/client/assets/{SearchMd-C_1lW0Ah.js → SearchMd-3WCi1VDc.js} +1 -1
- package/dist/client/assets/{Settings01-LKv7FQos.js → Settings01-84eR-C3B.js} +1 -1
- package/dist/client/assets/{Shield01-Fx2IJRlW.js → Shield01-WvymnQYW.js} +1 -1
- package/dist/client/assets/{Terminal-75WYHlkp.js → Terminal-CM1LxJaq.js} +1 -1
- package/dist/client/assets/{Trash01-DGY6Zmte.js → Trash01-CAKaaYMp.js} +1 -1
- package/dist/client/assets/{Upload01-BSxD4Kkd.js → Upload01-BDarTYGT.js} +1 -1
- package/dist/client/assets/{Users03-CoKOCw50.js → Users03-D0y7vtGV.js} +1 -1
- package/dist/client/assets/{X-DID3bf3T.js → X-BS-0d43p.js} +1 -1
- package/dist/client/assets/{XCircle-AltdUevh.js → XCircle-BJZFrCgV.js} +1 -1
- package/dist/client/assets/{XClose-DUBNCpe4.js → XClose-6pBqg-B-.js} +1 -1
- package/dist/client/assets/{Zap-Bm4Waap8.js → Zap-MB79YnxU.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-D6XzM0pc.js → agent-connections-preview-D0T58SYV.js} +1 -1
- package/dist/client/assets/{agent-detail-C8hS0OIF.js → agent-detail-BRsW7IYa.js} +1 -1
- package/dist/client/assets/{agents-CcxsZzQD.js → agents-juAVT19y.js} +1 -1
- package/dist/client/assets/{alert-dialog-vVs9i4lx.js → alert-dialog-CtNI8LvE.js} +1 -1
- package/dist/client/assets/{auth-catchall-l-9FY9Je.js → auth-catchall-BNohJky1.js} +1 -1
- package/dist/client/assets/{avatar-DR86yZfU.js → avatar-7hY_H5zt.js} +1 -1
- package/dist/client/assets/{badge-BAP-lcs5.js → badge-DfhuIA_7.js} +1 -1
- package/dist/client/assets/{binder-CFsqRWyE.js → binder-C6fAESck.js} +1 -1
- package/dist/client/assets/{breadcrumb-CdWsOBPt.js → breadcrumb-DZJzQEPd.js} +1 -1
- package/dist/client/assets/{card-Clok3lmK.js → card-DXg2GX79.js} +1 -1
- package/dist/client/assets/{chart-ByrnkTVm.js → chart-BWnEsG4R.js} +1 -1
- package/dist/client/assets/{checkbox-B-1-mid3.js → checkbox-CA1NpLng.js} +1 -1
- package/dist/client/assets/{circle-alert-BzOmgrUI.js → circle-alert-DpFL31gA.js} +1 -1
- package/dist/client/assets/{collapsible-Bp_YQ1BM.js → collapsible-CZMy3y5l.js} +1 -1
- package/dist/client/assets/{collection-detail-CgwyltZh.js → collection-detail-C59CwIQH.js} +1 -1
- package/dist/client/assets/{collection-display-button-D2FdRhJR.js → collection-display-button-CVVCR82C.js} +1 -1
- package/dist/client/assets/{collection-search-D8yWk6Rw.js → collection-search-BVMX34xh.js} +1 -1
- package/dist/client/assets/{collection-tab-BMX9TKO-.js → collection-tab-Dq2y4UTN.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BlXI3ymR.js → collection-table-wrapper-C0TGGJ6J.js} +1 -1
- package/dist/client/assets/{collection-tabs-BFNAuCxi.js → collection-tabs-fHRefLVF.js} +1 -1
- package/dist/client/assets/{command-C5pCOo0G.js → command-DQZMRksB.js} +1 -1
- package/dist/client/assets/{connect-DFA20XuL.js → connect-BPIjHna-.js} +1 -1
- package/dist/client/assets/{connection-card-CYFGLsK7.js → connection-card-CVWbDwe1.js} +1 -1
- package/dist/client/assets/{connection-detail-D0YEXhW5.js → connection-detail-BE8aQ9Vr.js} +1 -1
- package/dist/client/assets/{connection-status-IBWccbtA.js → connection-status-CIfK1aaf.js} +1 -1
- package/dist/client/assets/{connections-BKsdRCbo.js → connections-DE-LDmih.js} +1 -1
- package/dist/client/assets/{constants-xmw1fMHh.js → constants-9aDFHfpv.js} +1 -1
- package/dist/client/assets/constants-C6iMC3JV.js +1 -0
- package/dist/client/assets/{create-organization-dialog-Du1m5FdB.js → create-organization-dialog-rPVbE78O.js} +1 -1
- package/dist/client/assets/{create-project-dialog-BdlPmpWG.js → create-project-dialog-eGd8v6in.js} +1 -1
- package/dist/client/assets/{danger-BPcWEb5d.js → danger-CN2jIiYh.js} +1 -1
- package/dist/client/assets/{danger-zone-ZX9WaVX8.js → danger-zone-DFB5uHUA.js} +1 -1
- package/dist/client/assets/{decopilot-events-0xLoQDoX.js → decopilot-events-BNDSGGPU.js} +1 -1
- package/dist/client/assets/{dependencies-CJbOW7ZD.js → dependencies-B2LWAesw.js} +1 -1
- package/dist/client/assets/{dialog-BzNDvgYI.js → dialog-C82flYm2.js} +1 -1
- package/dist/client/assets/{dropdown-menu-cjxseDpi.js → dropdown-menu-CxuRGQYq.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-BhHLUqT2.js → dynamic-plugin-layout-CQiNNzkD.js} +1 -1
- package/dist/client/assets/{editable-task-title-mvwrxGHt.js → editable-task-title-0i5466nX.js} +1 -1
- package/dist/client/assets/{empty-state-Dp4fl6q2.js → empty-state-BRx85n5e.js} +1 -1
- package/dist/client/assets/{env-vars-editor-B-9hU7y3.js → env-vars-editor-7rdGUbIW.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CFMnH3hb.js → extract-connection-data-C3TnWHFq.js} +1 -1
- package/dist/client/assets/{file-browser-BG7PT9ps.js → file-browser-B6_JSvky.js} +2 -2
- package/dist/client/assets/{form-Cy3Jwk-Q.js → form-yfGhYWGK.js} +1 -1
- package/dist/client/assets/{general-BesX-9zM.js → general-BO87mKaj.js} +1 -1
- package/dist/client/assets/{grid-view-QhAw4KhZ.js → grid-view-CafNEeZS.js} +1 -1
- package/dist/client/assets/{home-Chw56C-3.js → home-DODydEdy.js} +1 -1
- package/dist/client/assets/{icon-picker-eWyiSc_O.js → icon-picker-BxryrKdj.js} +1 -1
- package/dist/client/assets/{index-DXduHOMl.js → index-B9MYwIUx.js} +1 -1
- package/dist/client/assets/{index-DSGyTAGR.js → index-BE5cW0kh.js} +1 -1
- package/dist/client/assets/{index-CQVVuedh.js → index-BxIsqm8s.js} +1 -1
- package/dist/client/assets/{index-DG2fU15Y.js → index-CPVHF3xw.js} +1 -1
- package/dist/client/assets/{index-7YuV3h-h.js → index-Cay1thV-.js} +1 -1
- package/dist/client/assets/{index-Cc5E7IzF.js → index-Dk8Q7M5D.js} +1 -1
- package/dist/client/assets/{index-DAmbTOxS.js → index-PEK2-Gur.js} +3 -3
- package/dist/client/assets/{index-BhLfS6lY.js → index-cyFdlvvQ.js} +1 -1
- package/dist/client/assets/{index-CR1W-IZC.js → index-xpVnmlVH.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-B0HPJqVy.js → infiniteQueryObserver-C6bi1NMJ.js} +1 -1
- package/dist/client/assets/{input-PH_B9jsb.js → input-sgdy4h-T.js} +1 -1
- package/dist/client/assets/{integration-icon-C_X_mJPp.js → integration-icon-CF_VTof8.js} +1 -1
- package/dist/client/assets/{label-CZMyG7OM.js → label-BrZsvi2a.js} +1 -1
- package/dist/client/assets/{layout-CYw6gPHE.js → layout-BIum7cxT.js} +1 -1
- package/dist/client/assets/{layout-DPBAgreo.js → layout-CV1aMVHy.js} +1 -1
- package/dist/client/assets/{localstorage-keys-Dd8wt3F6.js → localstorage-keys-F1lq-lvV.js} +1 -1
- package/dist/client/assets/{login-Cd96JFnW.js → login-DW4fba0v.js} +1 -1
- package/dist/client/assets/{markdown-B3R8LeLR.js → markdown-CbEbvbZf.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer--eX10QZ5.js → mcp-app-renderer-C_3fiOtj.js} +1 -1
- package/dist/client/assets/{mcp-oauth-tjctMKcl.js → mcp-oauth-6xg1H94l.js} +1 -1
- package/dist/client/assets/{mcp-server-card-Hiaqs31Z.js → mcp-server-card-CWDv948O.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-CrOazAbX.js → mcp-server-detail-tO42oFY4.js} +2 -2
- package/dist/client/assets/{members-rOvfUV9J.js → members-DKDzvaot.js} +1 -1
- package/dist/client/assets/{monaco-editor-06NrbgAe.js → monaco-editor-B-R8mcTi.js} +1 -1
- package/dist/client/assets/{monitoring-Ck35fPMW.js → monitoring-X0-0osFY.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-edit-B4CU5j8B.js → monitoring-dashboard-edit-rOc8ctLL.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-view-CMo02Tk9.js → monitoring-dashboard-view-BOcU-Ptb.js} +1 -1
- package/dist/client/assets/{oauth-callback-DuCBrveR.js → oauth-callback-Dt0Z_xAu.js} +1 -1
- package/dist/client/assets/{page-4tHZE6H1.js → page-Bg_wbn7m.js} +1 -1
- package/dist/client/assets/{page-4RXzdwZJ.js → page-C2NqyE1l.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-qTG5gFt8.js → plugin-empty-state-BA7ocyXk.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-Dt5Qyq-F.js → plugin-empty-state-yRJgz3Tr.js} +1 -1
- package/dist/client/assets/{plugin-header-D5a4iiLO.js → plugin-header-BDXHoMCR.js} +1 -1
- package/dist/client/assets/{plugin-header-CIBbHWo4.js → plugin-header-BjlvBkY0.js} +1 -1
- package/dist/client/assets/plugins-C2IeqTZD.js +1 -0
- package/dist/client/assets/{popover-Cmi_uUkW.js → popover-W_pvoCtS.js} +1 -1
- package/dist/client/assets/{project-app-view-D3oGcy6S.js → project-app-view-0TT6VGtD.js} +1 -1
- package/dist/client/assets/{project-layout-B7T63Vv2.js → project-layout-EE8sGSdV.js} +1 -1
- package/dist/client/assets/{project-plugins-ir6R3u5l.js → project-plugins-CUoGWXtV.js} +1 -1
- package/dist/client/assets/{projects-list-WoTiT37T.js → projects-list-bUHr7Hxj.js} +1 -1
- package/dist/client/assets/{readme-viewer-BTRsWoeR.js → readme-viewer-udR9CDuh.js} +1 -1
- package/dist/client/assets/{registry-layout-Bk-VsD-p.js → registry-layout-DDBt9uFS.js} +1 -1
- package/dist/client/assets/{registry-utils-gPUhOrxo.js → registry-utils-BUxN-Xyw.js} +1 -1
- package/dist/client/assets/{reports-layout-D1s-SUhG.js → reports-layout-CCWEuXOO.js} +1 -1
- package/dist/client/assets/{reset-password-CthaoLhI.js → reset-password-Cm4-0xVl.js} +1 -1
- package/dist/client/assets/{resizable-CBUuFqSY.js → resizable-B67Be6M0.js} +1 -1
- package/dist/client/assets/{save-actions-DBUOHjHb.js → save-actions-FUGEGF6q.js} +1 -1
- package/dist/client/assets/{scroll-area-G9ZJaSqZ.js → scroll-area-CK7vwAfQ.js} +1 -1
- package/dist/client/assets/{select-IzFKXHyx.js → select-C05ByfCe.js} +1 -1
- package/dist/client/assets/{shell-layout-CTG00ZNv.js → shell-layout-DTEZojRn.js} +2 -2
- package/dist/client/assets/{sidebar-settings-CRFfw2Gv.js → sidebar-settings-Dcd14gbU.js} +1 -1
- package/dist/client/assets/{skeleton-RkOo2TsK.js → skeleton-UoFZ21oo.js} +1 -1
- package/dist/client/assets/{spinner-vnsl-KUj.js → spinner-BGQowtes.js} +1 -1
- package/dist/client/assets/{store-invite-RNWOq1gd.js → store-invite-Cq-AwKEe.js} +1 -1
- package/dist/client/assets/{switch-CYcmpZG6.js → switch-Q4KewAfm.js} +1 -1
- package/dist/client/assets/{table-C0vfolQ8.js → table-X8r3lDFL.js} +1 -1
- package/dist/client/assets/{tabs-DK-xG_j5.js → tabs-B8_PkbMO.js} +1 -1
- package/dist/client/assets/tasks-BvxRdrj9.js +1 -0
- package/dist/client/assets/{tasks-panel-xhzWg28a.js → tasks-panel-CC3yneqS.js} +1 -1
- package/dist/client/assets/{textarea-DclpUcWC.js → textarea-pi2cWSId.js} +1 -1
- package/dist/client/assets/{time-range-picker-Drj53A5o.js → time-range-picker-BrfuDGgP.js} +1 -1
- package/dist/client/assets/{toggle-group-BXptxmNU.js → toggle-group-BhefXfHG.js} +1 -1
- package/dist/client/assets/{tools-list-CIEV_GAM.js → tools-list-MmMBTqrs.js} +1 -1
- package/dist/client/assets/{tooltip-BH1aeIjU.js → tooltip-CWYwrzX7.js} +1 -1
- package/dist/client/assets/{topbar-portal-TkzwK0-o.js → topbar-portal-RlfRVDuU.js} +1 -1
- package/dist/client/assets/{types-tRNNwmgc.js → types-DfAuQBsH.js} +1 -1
- package/dist/client/assets/{use-binding-DJJU0pVY.js → use-binding-bR1unh0d.js} +1 -1
- package/dist/client/assets/{use-collections-6zQXOG_F.js → use-collections-CdWUwl8U.js} +1 -1
- package/dist/client/assets/{use-connection-DE-37ZRw.js → use-connection-Cknhz6to.js} +1 -1
- package/dist/client/assets/{use-copy-BGu1WqOT.js → use-copy-2ZhzXjqK.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-DerbEulf.js → use-create-virtual-mcp-DtdhklAc.js} +1 -1
- package/dist/client/assets/{use-install-from-registry-DW1S1MH8.js → use-install-from-registry-BzL8TqTO.js} +1 -1
- package/dist/client/assets/{use-list-state-E1MzR5q_.js → use-list-state-BFxcsMHC.js} +1 -1
- package/dist/client/assets/{use-llm-G4Pt8Suw.js → use-llm-D6vMdIHx.js} +1 -1
- package/dist/client/assets/{use-mcp-resources-D8ui0z-w.js → use-mcp-resources-V7_1ln1p.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-NDarjnlp.js → use-mcp-tools-BMktygYP.js} +1 -1
- package/dist/client/assets/{use-members-DEF0_vk3.js → use-members-CZzrsjqR.js} +1 -1
- package/dist/client/assets/{use-mobile-K667MH2e.js → use-mobile-DqFS2tGv.js} +1 -1
- package/dist/client/assets/{use-project-DoCjwOIJ.js → use-project-mIp9moJF.js} +1 -1
- package/dist/client/assets/{use-settings-modal-DEQaKSnd.js → use-settings-modal-CK97wy3L.js} +1 -1
- package/dist/client/assets/{use-view-mode-CbCZ336B.js → use-view-mode-CkSeKCK_.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-BzckzJP9.js → use-virtual-mcp-DncJVsC2.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-l2zBIMez.js +1 -0
- package/dist/client/assets/{useMutation-CD3w4aw8.js → useMutation-Bwc-v8Ow.js} +1 -1
- package/dist/client/assets/useQuery-C84LCuAf.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-B9Fj3djj.js +1 -0
- package/dist/client/assets/{user-v5BJSUZP.js → user-CLAm4Myt.js} +1 -1
- package/dist/client/assets/{workflow-Dg8-Ij6z.js → workflow-BuPqeBHK.js} +1 -1
- package/dist/client/index.html +1 -1
- package/package.json +1 -1
- package/dist/client/assets/constants-BgtO0102.js +0 -1
- package/dist/client/assets/plugins-B-KHF8ha.js +0 -1
- package/dist/client/assets/tasks-BVQ_bYUE.js +0 -1
- package/dist/client/assets/useInfiniteQuery-DVIMnEtv.js +0 -1
- package/dist/client/assets/useQuery-B4nMPmUe.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-9BwyFrU-.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as $,v as N,j as t}from"./index-
|
|
1
|
+
import{c as $,v as N,j as t}from"./index-PEK2-Gur.js";import{C as q}from"./card-DXg2GX79.js";import{I as B}from"./integration-icon-CF_VTof8.js";function K(g){const e=$.c(46),{connection:s,onClick:C,headerActions:b,body:k,footer:y,className:I,size:A,fallbackIcon:w}=g,E=A===void 0?"md":A,i=E==="sm"?"p-4":"p-6",P=E==="sm"?"text-sm":"text-base",R=E==="sm"?"text-xs":"text-sm",S=C&&"hover:bg-muted/50";let l;e[0]!==I||e[1]!==S?(l=N("cursor-pointer transition-colors group overflow-hidden flex flex-col",S,I),e[0]=I,e[1]=S,e[2]=l):l=e[2];let o;e[3]!==i?(o=N("flex flex-col gap-4",i),e[3]=i,e[4]=o):o=e[4];let n;e[5]!==s.icon||e[6]!==s.title||e[7]!==w?(n=t.jsx(B,{icon:s.icon,name:s.title,size:"md",className:"shrink-0 shadow-sm",fallbackIcon:w}),e[5]=s.icon,e[6]=s.title,e[7]=w,e[8]=n):n=e[8];let c;e[9]!==b?(c=b&&t.jsx("div",{className:N("transition-opacity","opacity-0 group-hover:opacity-100"),onClick:F,children:b}),e[9]=b,e[10]=c):c=e[10];let r;e[11]!==c?(r=t.jsx("div",{className:"relative",children:c}),e[11]=c,e[12]=r):r=e[12];let a;e[13]!==n||e[14]!==r?(a=t.jsxs("div",{className:"flex items-start justify-between",children:[n,r]}),e[13]=n,e[14]=r,e[15]=a):a=e[15];let d;e[16]!==P?(d=N("font-medium text-foreground truncate",P),e[16]=P,e[17]=d):d=e[17];let m;e[18]!==s.title||e[19]!==d?(m=t.jsx("h3",{className:d,children:s.title}),e[18]=s.title,e[19]=d,e[20]=m):m=e[20];let f;e[21]!==R?(f=N("text-muted-foreground line-clamp-2",R),e[21]=R,e[22]=f):f=e[22];const _=s.description||"No description";let x;e[23]!==f||e[24]!==_?(x=t.jsx("p",{className:f,children:_}),e[23]=f,e[24]=_,e[25]=x):x=e[25];let p;e[26]!==m||e[27]!==x?(p=t.jsxs("div",{className:"flex flex-col gap-0",children:[m,x]}),e[26]=m,e[27]=x,e[28]=p):p=e[28];let h;e[29]!==k?(h=k&&t.jsx("div",{children:k}),e[29]=k,e[30]=h):h=e[30];let u;e[31]!==p||e[32]!==h||e[33]!==o||e[34]!==a?(u=t.jsxs("div",{className:o,children:[a,p,h]}),e[31]=p,e[32]=h,e[33]=o,e[34]=a,e[35]=u):u=e[35];let j;e[36]!==y||e[37]!==i?(j=y&&t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:N("h-14 flex items-center",i),onClick:D,children:y})}),e[36]=y,e[37]=i,e[38]=j):j=e[38];let v;e[39]!==u||e[40]!==j?(v=t.jsxs("div",{className:"flex flex-col flex-1",children:[u,j]}),e[39]=u,e[40]=j,e[41]=v):v=e[41];let z;return e[42]!==C||e[43]!==v||e[44]!==l?(z=t.jsx(q,{className:l,onClick:C,children:v}),e[42]=C,e[43]=v,e[44]=l,e[45]=z):z=e[45],z}function D(g){return g.stopPropagation()}function F(g){return g.stopPropagation()}export{K as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as U,j as t,b as Ne,B as Ue,O as ge,aF as it,u as ze,x as gt,c0 as Qe,q as jt,p as bt,r as X,o as at,bI as vt,bQ as Nt,s as B,w as Ge,_ as yt,E as ct,e as _t,a as Ct,n as St,k as wt,l as Tt,i as kt,t as ve,K as Je}from"./index-DAmbTOxS.js";import{E as Z,C as Be}from"./collection-search-D8yWk6Rw.js";import{E as Pt,r as It,e as lt}from"./env-vars-editor-B-9hU7y3.js";import{g as Ke}from"./types-tRNNwmgc.js";import{S as $t}from"./save-actions-DBUOHjHb.js";import{b as At,a as Vt}from"./use-binding-DJJU0pVY.js";import{u as Mt,S as Dt}from"./index-BhLfS6lY.js";import{u as Ot,a as dt}from"./use-connection-DE-37ZRw.js";import{u as mt}from"./constants-xmw1fMHh.js";import{d as Rt}from"./use-mcp-tools-NDarjnlp.js";import{b as Et}from"./use-mcp-resources-D8ui0z-w.js";import{a as Lt}from"./decopilot-events-0xLoQDoX.js";import{a as Ut}from"./mcp-oauth-tjctMKcl.js";import{b as Ye,c as Ft,d as zt,e as Bt,B as Kt,a as Xt}from"./breadcrumb-CdWsOBPt.js";import{C as qt}from"./collection-tabs-BFNAuCxi.js";import{i as Oe}from"./Loading01-CjjE3eBW.js";import{V as Xe,a as Ht}from"./layout-CYw6gPHE.js";import{C as Wt}from"./collection-tab-BMX9TKO-.js";import{I as Qt}from"./icon-picker-eWyiSc_O.js";import{I as Re}from"./integration-icon-C_X_mJPp.js";import{B as Fe}from"./badge-BAP-lcs5.js";import{D as Gt,a as Jt,b as Yt,c as Ze}from"./dropdown-menu-cjxseDpi.js";import{F as H,a as Zt,b as W,d as K,f as Q,c as Y,e as es}from"./form-Cy3Jwk-Q.js";import{I as G}from"./input-PH_B9jsb.js";import{S as et,a as tt,b as st,c as nt,d as q}from"./select-IzFKXHyx.js";import{i as ut}from"./CheckCircle-NPrGj804.js";import{t as ts}from"./ChevronDown-C60hOPCP.js";import{n as ss}from"./Container-B8DmhgZQ.js";import{s as De}from"./Globe02-BHELIlHY.js";import{s as ns}from"./RefreshCcw01-DIjgBTR_.js";import{i as os}from"./Terminal-75WYHlkp.js";import{s as rs}from"./Trash01-DGY6Zmte.js";import{t as qe}from"./Users03-CoKOCw50.js";import{s as is}from"./XClose-DUBNCpe4.js";import{U as as}from"./user-v5BJSUZP.js";import{b as cs,a as ls}from"./use-virtual-mcp-BzckzJP9.js";import{i as ds}from"./ChevronRight-Sru8EpEz.js";import{s as ms}from"./Plus-4XunsH-w.js";import{f as us}from"./formatDistanceToNow-Cb2QZZJn.js";import{C as pt}from"./collection-display-button-D2FdRhJR.js";import{C as ft}from"./collection-table-wrapper-BlXI3ymR.js";import{C as He}from"./card-Clok3lmK.js";import{R as ps}from"./readme-viewer-BTRsWoeR.js";import{T as fs,a as xs}from"./tools-list-CIEV_GAM.js";import{M as hs}from"./mcp-app-renderer--eX10QZ5.js";import"./SearchMd-C_1lW0Ah.js";import"./Save01-C9WQeXbC.js";import"./binder-CFsqRWyE.js";import"./File06-BW0G-Nsj.js";import"./Key01-UF8G2Wth.js";import"./constants-BgtO0102.js";import"./registry-utils-gPUhOrxo.js";import"./extract-connection-data-CFMnH3hb.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-DW1S1MH8.js";import"./index-DSGyTAGR.js";import"./circle-alert-BzOmgrUI.js";import"./index-7YuV3h-h.js";import"./index-DXduHOMl.js";import"./index-CQVVuedh.js";import"./collapsible-Bp_YQ1BM.js";import"./use-llm-G4Pt8Suw.js";import"./use-collections-6zQXOG_F.js";import"./useMutation-CD3w4aw8.js";import"./useQuery-B4nMPmUe.js";import"./localstorage-keys-Dd8wt3F6.js";import"./tabs-DK-xG_j5.js";import"./checkbox-B-1-mid3.js";import"./Check-BvMJM-Sw.js";import"./dialog-BzNDvgYI.js";import"./X-DID3bf3T.js";import"./skeleton-RkOo2TsK.js";import"./AlignLeft-D2gIcSDq.js";import"./ArrowLeft-UNV7B-AG.js";import"./Image01-hprGlSB4.js";import"./Settings01-LKv7FQos.js";import"./useSuspenseInfiniteQuery-9BwyFrU-.js";import"./infiniteQueryObserver-B0HPJqVy.js";import"./popover-Cmi_uUkW.js";import"./spinner-vnsl-KUj.js";import"./tooltip-BH1aeIjU.js";import"./index-CR1W-IZC.js";import"./usage-B8eRkRZY.js";import"./ArrowUp-CQq_iQrI.js";import"./Edit01-CE3Lg5ZM.js";import"./XCircle-AltdUevh.js";import"./AlertCircle-DNgqx8KI.js";import"./use-copy-BGu1WqOT.js";import"./Code01-Db51N7Ml.js";import"./use-create-virtual-mcp-DerbEulf.js";import"./Copy01-Dd1E3TCJ.js";import"./marked.esm-BaswSlok.js";import"./markdown-B3R8LeLR.js";import"./Eye-CCXNKQ3i.js";import"./LayersTwo01-DbxVUzP3.js";import"./index-DG2fU15Y.js";import"./Clock-Dfwp-ruh.js";import"./DotsVertical-feXQsLpQ.js";import"./empty-state-Dp4fl6q2.js";import"./Inbox01-BXzWXZim.js";import"./use-list-state-E1MzR5q_.js";import"./use-view-mode-CbCZ336B.js";import"./use-mobile-K667MH2e.js";import"./alert-dialog-vVs9i4lx.js";import"./scroll-area-G9ZJaSqZ.js";import"./Edit05-COnRWzeL.js";import"./Link01-x3rUsD6r.js";import"./label-CZMyG7OM.js";import"./avatar-DR86yZfU.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./ArrowDown-CaOFq6pQ.js";import"./Grid01-DBuyZdtC.js";import"./List-B76tHO2m.js";import"./table-C0vfolQ8.js";function gs(s){const e=U.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(qe,{size:16}),e[3]=a):a=e[3];let l;e[4]!==n.icon||e[5]!==n.title?(l=t.jsx(Re,{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 j;e[7]!==n.title?(j=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[7]=n.title,e[8]=j):j=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(ds,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[9]=f):f=e[9];let m;return e[10]!==i||e[11]!==l||e[12]!==j?(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,j,f]}),e[10]=i,e[11]=l,e[12]=j,e[13]=m):m=e[13],m}function ot(s){const e=U.c(20),{connectionId:n,connectionTitle:o,connectionDescription:i,connectionIcon:a,org:l,hasExistingVirtualMcps:j}=s,f=Ne(),m=ls();let x;e[0]!==m.create||e[1]!==i||e[2]!==a||e[3]!==n||e[4]!==o||e[5]!==f||e[6]!==l?(x=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}]});f({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]=f,e[6]=l,e[7]=x):x=e[7];const c=x;if(j){let d;e[8]!==m.create.isPending?(d=m.create.isPending?t.jsx(Oe,{size:16,className:"animate-spin"}):t.jsx(ms,{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(qe,{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 js(s){const e=U.c(26),{connectionId:n,connectionTitle:o,connectionDescription:i,connectionIcon:a,org:l}=s;let j;e[0]!==n?(j={filters:[{column:"connection_id",value:n}]},e[0]=n,e[1]=j):j=e[1];const f=cs(j);if(!(f.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 x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("h4",{className:"text-xs text-muted-foreground font-medium",children:"Agents"}),e[9]=x):x=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:[x,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]!==f){let u;e[19]!==l?(u=b=>t.jsx(gs,{virtualMcp:b,org:l},b.id),e[19]=l,e[20]=u):u=e[20],r=f.map(u),e[16]=l,e[17]=f,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 bs({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:j}=jt(),f=(()=>{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=j||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",c=x?bt(e.connection_url):null;return x?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(qe,{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(H,{control:s.control,name:"ui_type",render:({field:r})=>t.jsxs(W,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),a!=="NPX"&&a!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(et,{value:r.value,onValueChange:r.onChange,children:[t.jsx(K,{children:t.jsxs(tt,{className:"h-10 w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(De,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(st,{})]})}),t.jsxs(nt,{children:[t.jsx(q,{value:"HTTP",children:"HTTP"}),t.jsx(q,{value:"SSE",children:"SSE"}),t.jsx(q,{value:"Websocket",children:"Websocket"}),m&&t.jsxs(t.Fragment,{children:[t.jsx(q,{value:"NPX",children:"NPX Package"}),t.jsx(q,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(H,{control:s.control,name:"connection_url",render:({field:h})=>t.jsx(W,{className:"flex-1 min-w-0",children:t.jsx(K,{children:t.jsx(G,{placeholder:"https://example.com/mcp",...h,value:h.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(et,{value:r.value,onValueChange:r.onChange,children:[t.jsx(K,{children:t.jsx(tt,{className:"h-10",children:t.jsx(st,{})})}),t.jsxs(nt,{children:[t.jsx(q,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(De,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(q,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(De,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(q,{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(q,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ss,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(q,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(os,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(Q,{})]})}),a==="NPX"&&t.jsx(H,{control:s.control,name:"npx_package",render:({field:r})=>t.jsxs(W,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(K,{children:t.jsx(G,{placeholder:"@perplexity-ai/mcp-server",...r,value:r.value||"",className:"h-10 rounded-lg"})}),t.jsx(Q,{})]})}),a==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(H,{control:s.control,name:"stdio_command",render:({field:r})=>t.jsxs(W,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(K,{children:t.jsx(G,{placeholder:"node, bun, python...",...r,value:r.value||"",className:"h-10 rounded-lg"})}),t.jsx(Q,{})]})}),t.jsx(H,{control:s.control,name:"stdio_args",render:({field:r})=>t.jsxs(W,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(K,{children:t.jsx(G,{placeholder:"arg1 arg2 --flag value",...r,value:r.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(Q,{})]})})]}),t.jsx(H,{control:s.control,name:"stdio_cwd",render:({field:r})=>t.jsxs(W,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(K,{children:t.jsx(G,{placeholder:"/path/to/project (optional)",...r,value:r.value||"",className:"h-10 rounded-lg"})}),t.jsx(Q,{})]})})]}),(a==="NPX"||a==="STDIO")&&t.jsx(H,{control:s.control,name:"env_vars",render:({field:r})=>t.jsxs(W,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(K,{children:t.jsx(Pt,{value:r.value??[],onChange:r.onChange})}),t.jsx(Q,{})]})}),a!=="NPX"&&a!=="STDIO"&&t.jsx(H,{control:s.control,name:"connection_token",render:({field:r})=>t.jsxs(W,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:f?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Gt,{children:[t.jsx(Jt,{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(ts,{size:12})]})})}),t.jsxs(Yt,{align:"start",children:[t.jsxs(Ze,{onClick:o,children:[t.jsx(ns,{size:16}),"Re-authenticate"]}),t.jsxs(Ze,{variant:"destructive",onClick:i,children:[t.jsx(rs,{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(is,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(K,{children:t.jsx(G,{type:"password",placeholder:f?"Paste your GitHub PAT":"Enter access token...",...r,value:r.value||"",className:"h-10 rounded-lg"})}),f&&t.jsxs(es,{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 vs(s){const e=U.c(45),{form:n,connection:o,isMCPAuthenticated:i,hasOAuthToken:a,onReauthenticate:l,onRemoveOAuth:j}=s,{org:f}=ze();let m;e[0]!==o.app_name||e[1]!==o.icon||e[2]!==o.title||e[3]!==n.control?(m=o.app_name&&o.icon?t.jsx(Re,{icon:o.icon,name:o.title,size:"lg",className:"shadow-sm"}):t.jsx(gt,{control:n.control,name:"icon",render:k=>{const{field:I}=k;return t.jsx(Qt,{value:I.value,onChange:I.onChange,name:o.title,size:"lg",className:"shadow-sm"})}}),e[0]=o.app_name,e[1]=o.icon,e[2]=o.title,e[3]=n.control,e[4]=m):m=e[4];let x;e[5]!==n.control?(x=t.jsxs("div",{className:"flex flex-col",children:[t.jsx(H,{control:n.control,name:"title",render:ys}),t.jsx(H,{control:n.control,name:"description",render:Ns})]}),e[5]=n.control,e[6]=x):x=e[6];let c;e[7]!==m||e[8]!==x?(c=t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[m,x]}),e[7]=m,e[8]=x,e[9]=c):c=e[9];let r;e[10]!==o||e[11]!==n||e[12]!==a||e[13]!==l||e[14]!==j?(r=t.jsx(bs,{form:n,connection:o,hasOAuthToken:a,onReauthenticate:l,onRemoveOAuth:j}),e[10]=o,e[11]=n,e[12]=a,e[13]=l,e[14]=j,e[15]=r):r=e[15];let h;e[16]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Status"}),e[16]=h):h=e[16];let d;e[17]!==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[17]=i,e[18]=d):d=e[18];let u;e[19]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Created by"}),e[19]=u):u=e[19];let b;e[20]!==o.created_by?(b=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[u,t.jsx(as,{id:o.created_by,size:"2xs"})]}),e[20]=o.created_by,e[21]=b):b=e[21];let v;e[22]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Updated"}),e[22]=v):v=e[22];let _;e[23]!==o.updated_at?(_=o.updated_at?us(new Date(o.updated_at),{addSuffix:!0}):"Unknown",e[23]=o.updated_at,e[24]=_):_=e[24];let S;e[25]!==_?(S=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[v,t.jsx("span",{className:"text-sm text-foreground",children:_})]}),e[25]=_,e[26]=S):S=e[26];let p;e[27]!==S||e[28]!==d||e[29]!==b?(p=t.jsxs("div",{className:"flex flex-col gap-2 p-5 border-b border-border",children:[d,b,S]}),e[27]=S,e[28]=d,e[29]=b,e[30]=p):p=e[30];let C;e[31]!==o.description||e[32]!==o.icon||e[33]!==o.id||e[34]!==o.title||e[35]!==f.slug?(C=t.jsx(js,{connectionId:o.id,connectionTitle:o.title,connectionDescription:o.description,connectionIcon:o.icon,org:f.slug}),e[31]=o.description,e[32]=o.icon,e[33]=o.id,e[34]=o.title,e[35]=f.slug,e[36]=C):C=e[36];let w;e[37]!==p||e[38]!==C||e[39]!==c||e[40]!==r?(w=t.jsxs("div",{className:"flex flex-col h-full overflow-auto",children:[c,r,p,C]}),e[37]=p,e[38]=C,e[39]=c,e[40]=r,e[41]=w):w=e[41];let g;return e[42]!==n||e[43]!==w?(g=t.jsx(Zt,{...n,children:w}),e[42]=n,e[43]=w,e[44]=g):g=e[44],g}function Ns(s){const{field:e}=s;return t.jsxs(W,{className:"w-full space-y-0",children:[t.jsx(K,{children:t.jsx(G,{...e,value:e.value||"",className:"h-auto py-0.5 text-base text-muted-foreground leading-6 px-2 -mx-2 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Add a description..."})}),t.jsx(Q,{})]})}function ys(s){const{field:e}=s;return t.jsxs(W,{className:"flex-1 space-y-0",children:[t.jsx(K,{children:t.jsx(G,{...e,className:"h-auto py-0.5 text-lg! font-medium leading-7 px-2 -mx-2 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Connection Name"})}),t.jsx(Q,{})]})}function _s(s){const e=U.c(39),{prompts:n,connectionId:o,org:i,onPromptClick:a,showToolbar:l,emptyMessage:j}=s,f=l===void 0?!0:l,m=j===void 0?"This connection doesn't have any prompts yet.":j,x=Ne(),[c,r]=X.useState(""),[h,d]=X.useState("table"),[u,b]=X.useState("name"),[v,_]=X.useState("asc");let S;e[0]!==v||e[1]!==u?(S=T=>{u===T?(_(ks),v==="desc"&&b(void 0)):(b(T),_("asc"))},e[0]=v,e[1]=u,e[2]=S):S=e[2];const p=S;let C;e[3]!==o||e[4]!==x||e[5]!==a||e[6]!==i?(C=T=>{a?a(T):o&&i&&x({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:i,project:ge,connectionId:o,collectionName:"prompts",itemId:encodeURIComponent(T.name)}})},e[3]=o,e[4]=x,e[5]=a,e[6]=i,e[7]=C):C=e[7];const w=C;let g;if(e[8]!==n||e[9]!==c||e[10]!==v||e[11]!==u){const T=!n||n.length===0?[]:c.trim()?(()=>{const F=c.toLowerCase();return n.filter(z=>z.name.toLowerCase().includes(F)||z.description&&z.description.toLowerCase().includes(F))})():n;g=!u||!v?T:[...T].sort((F,z)=>{const je=F[u]||"",ee=z[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]=g}else g=e[12];const k=g;let I;e[13]===Symbol.for("react.memo_cache_sentinel")?(I=[{id:"name",header:"Name",render:Ts,sortable:!0},{id:"description",header:"Description",render:ws,cellClassName:"flex-1",sortable:!0}],e[13]=I):I=e[13];const V=I;let M;e[14]===Symbol.for("react.memo_cache_sentinel")?(M=V.filter(Ss).map(Cs),e[14]=M):M=e[14];const L=M;let y;e[15]!==p||e[16]!==f||e[17]!==v||e[18]!==u||e[19]!==h?(y=f&&t.jsx(Xe,{children:t.jsx(pt,{viewMode:h,onViewModeChange:d,sortKey:u,sortDirection:v,onSort:p,sortOptions:L})}),e[15]=p,e[16]=f,e[17]=v,e[18]=u,e[19]=h,e[20]=y):y=e[20];let R;e[21]===Symbol.for("react.memo_cache_sentinel")?(R=T=>{T.key==="Escape"&&(r(""),T.target.blur())},e[21]=R):R=e[21];let D;e[22]!==c?(D=t.jsx(Be,{value:c,onChange:r,placeholder:"Search prompts...",onKeyDown:R}),e[22]=c,e[23]=D):D=e[23];let N;e[24]!==m||e[25]!==w||e[26]!==p||e[27]!==c||e[28]!==v||e[29]!==u||e[30]!==k||e[31]!==h?(N=h==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:k.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:k.map(T=>t.jsx(He,{className:"cursor-pointer transition-colors",onClick:()=>w(T),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Re,{icon:null,name:T.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:T.name}),t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:T.description||"No description"})]})]})},T.name))})}):t.jsx(ft,{columns:V,data:k,isLoading:!1,sortKey:u,sortDirection:v,onSort:p,onRowClick:T=>w(T),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]=k,e[31]=h,e[32]=N):N=e[32];let A;e[33]!==D||e[34]!==N?(A=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[D,N]}),e[33]=D,e[34]=N,e[35]=A):A=e[35];let $;return e[36]!==A||e[37]!==y?($=t.jsxs(t.Fragment,{children:[y,A]}),e[36]=A,e[37]=y,e[38]=$):$=e[38],$}function Cs(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function Ss(s){return s.sortable}function ws(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function Ts(s){return t.jsx("span",{className:"text-sm font-medium font-mono text-foreground",children:s.name})}function ks(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function Ps(s){const e=U.c(4),{prompts:n,connectionId:o,org:i}=s;let a;return e[0]!==o||e[1]!==i||e[2]!==n?(a=t.jsx(_s,{prompts:n,connectionId:o,org:i}),e[0]=o,e[1]=i,e[2]=n,e[3]=a):a=e[3],a}function Is(s){const e=U.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(ps,{repository:n})}),e[0]=n,e[1]=o):o=e[1],o}function $s(s){const e=U.c(36),{resources:n,onResourceClick:o,showToolbar:i,emptyMessage:a}=s,l=i===void 0?!0:i,j=a===void 0?"This connection doesn't have any resources yet.":a,[f,m]=X.useState(""),[x,c]=X.useState("table"),[r,h]=X.useState("name"),[d,u]=X.useState("asc");let b;e[0]!==d||e[1]!==r?(b=N=>{r===N?(u(Es),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 S=_;let p;if(e[5]!==n||e[6]!==f||e[7]!==d||e[8]!==r){const N=!n||n.length===0?[]:f.trim()?(()=>{const A=f.toLowerCase();return n.filter($=>$.uri.toLowerCase().includes(A)||$.name&&$.name.toLowerCase().includes(A)||$.description&&$.description.toLowerCase().includes(A))})():n;p=!r||!d?N:[...N].sort((A,$)=>{const T=A[r]||"",F=$[r]||"",z=String(T).localeCompare(String(F));return d==="asc"?z:-z}),e[5]=n,e[6]=f,e[7]=d,e[8]=r,e[9]=p}else p=e[9];const C=p;let w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=[{id:"name",header:"Name",render:Rs,sortable:!0},{id:"uri",header:"URI",render:Os,sortable:!0},{id:"description",header:"Description",render:Ds,cellClassName:"flex-1",sortable:!0},{id:"mimeType",header:"Type",render:Ms,sortable:!0}],e[10]=w):w=e[10];const g=w;let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=g.filter(Vs).map(As),e[11]=k):k=e[11];const I=k;let V;e[12]!==v||e[13]!==l||e[14]!==d||e[15]!==r||e[16]!==x?(V=l&&t.jsx(Xe,{children:t.jsx(pt,{viewMode:x,onViewModeChange:c,sortKey:r,sortDirection:d,onSort:v,sortOptions:I})}),e[12]=v,e[13]=l,e[14]=d,e[15]=r,e[16]=x,e[17]=V):V=e[17];let M;e[18]===Symbol.for("react.memo_cache_sentinel")?(M=N=>{N.key==="Escape"&&(m(""),N.target.blur())},e[18]=M):M=e[18];let L;e[19]!==f?(L=t.jsx(Be,{value:f,onChange:m,placeholder:"Search resources...",onKeyDown:M}),e[19]=f,e[20]=L):L=e[20];let y;e[21]!==j||e[22]!==S||e[23]!==v||e[24]!==f||e[25]!==d||e[26]!==r||e[27]!==C||e[28]!==x?(y=x==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:C.length===0?t.jsx(Z,{image:null,title:f?"No resources found":"No resources available",description:f?"Try adjusting your search terms":j}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:C.map(N=>t.jsx(He,{className:"cursor-pointer transition-colors",onClick:()=>S(N),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Re,{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(ft,{columns:g,data:C,isLoading:!1,sortKey:r,sortDirection:d,onSort:v,onRowClick:N=>S(N),emptyState:t.jsx(Z,{image:null,title:f?"No resources found":"No resources available",description:f?"Try adjusting your search terms":j})}),e[21]=j,e[22]=S,e[23]=v,e[24]=f,e[25]=d,e[26]=r,e[27]=C,e[28]=x,e[29]=y):y=e[29];let R;e[30]!==L||e[31]!==y?(R=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[L,y]}),e[30]=L,e[31]=y,e[32]=R):R=e[32];let D;return e[33]!==R||e[34]!==V?(D=t.jsxs(t.Fragment,{children:[V,R]}),e[33]=R,e[34]=V,e[35]=D):D=e[35],D}function As(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function Vs(s){return s.sortable}function Ms(s){return t.jsx("span",{className:"text-sm text-muted-foreground",children:s.mimeType||"—"})}function Ds(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function Os(s){return t.jsx("span",{className:"text-sm font-mono text-muted-foreground",children:s.uri})}function Rs(s){return t.jsx("span",{className:"text-sm font-medium text-foreground",children:s.name||s.uri})}function Es(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function Ls(s){const e=U.c(4),{resources:n,connectionId:o,org:i}=s;let a;return e[0]!==o||e[1]!==i||e[2]!==n?(a=t.jsx($s,{resources:n,connectionId:o,org:i}),e[0]=o,e[1]=i,e[2]=n,e[3]=a):a=e[3],a}const Us=at({key:B().min(1,"Key is required"),value:B()}),Fs=at({title:B().min(1,"Name is required"),description:B().nullable().optional(),icon:B().nullable().optional(),ui_type:yt(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:B().optional(),connection_token:B().nullable().optional(),npx_package:B().optional(),stdio_command:B().optional(),stdio_args:B().optional(),stdio_cwd:B().optional(),env_vars:Ge(Us).optional(),configuration_scopes:Ge(B()).nullable().optional(),configuration_state:vt(B(),Nt()).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 zs(s){const e=U.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(fs,{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 Bs(s){const e=U.c(27),{tools:n,connectionId:o,org:i}=s,a=Ne(),{org:l}=ze();let j;e[0]!==o||e[1]!==l.id?(j={connectionId:o,orgId:l.id},e[0]=o,e[1]=l.id,e[2]=j):j=e[2];const f=mt(j),[m,x]=X.useState("");let c,r,h,d;if(e[3]!==f||e[4]!==o||e[5]!==a||e[6]!==i||e[7]!==m||e[8]!==n){const v=(n??[]).filter(Ks),_=m.toLowerCase().trim(),S=_?v.filter(g=>g.name.toLowerCase().includes(_)||g.description&&g.description.toLowerCase().includes(_)):v;let p;e[13]!==o||e[14]!==a||e[15]!==i?(p=g=>{a({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:i,project:ge,connectionId:o,collectionName:"tools",itemId:encodeURIComponent(g.name)}})},e[13]=o,e[14]=a,e[15]=i,e[16]=p):p=e[16];const C=p;h="flex flex-col h-full overflow-hidden";let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=g=>{g.key==="Escape"&&(x(""),g.target.blur())},e[17]=w):w=e[17],e[18]!==m?(d=t.jsx(Be,{value:m,onChange:x,placeholder:"Search apps...",onKeyDown:w}),e[18]=m,e[19]=d):d=e[19],c="flex-1 overflow-auto p-5",r=S.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:S.map(g=>{const k=Ke(g._meta);return t.jsxs(He,{className:"cursor-pointer transition-colors overflow-hidden",onClick:()=>C(g),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(hs,{resourceURI:k,toolInfo:{tool:g},displayMode:"inline",minHeight:200,maxHeight:200,client:f})}),t.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:g.name}),t.jsx(xs,{annotations:g.annotations,_meta:g._meta})]}),g.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:g.description})]})]},g.name)})}),e[3]=f,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 Ks(s){return!!Ke(s._meta)}function Xs(s){return s.command==="npx"}function qs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function Hs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function Ws(s,e){const n={command:"npx",args:["-y",s]},o=lt(e);return Object.keys(o).length>0&&(n.envVars=o),n}function Qs(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??"",icon:s.icon??null,configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&kt(s.connection_headers)){const o=s.connection_headers,i=It(o.envVars);if(Xs(o)){const l=qs(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=Hs(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 Gs(s){let e,n=null,o=null,i=null;return s.ui_type==="NPX"?(e="STDIO",n="",i=Ws(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",i=Qs(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,icon:s.icon??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 Js(s){const e=U.c(116),{connection:n,connectionId:o,org:i,requestedTabId:a,collections:l,onUpdate:j,isUpdating:f,prompts:m,resources:x,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=St(),b=dt();let v;e[1]!==o?(v={connectionId:o},e[1]=o,e[2]=v):v=e[2];const _=Mt(v),p=n?.connection_type==="VIRTUAL"||_.isAuthenticated;let C;e[3]!==n?(C={connections:[n],binding:"MCP"},e[3]=n,e[4]=C):C=e[4];const g=Vt(C).length>0,k=n?.metadata?.repository,I=!!k?.url;let V;e[5]===Symbol.for("react.memo_cache_sentinel")?(V=wt(Fs),e[5]=V):V=e[5];let M;e[6]!==n?(M=rt(n),e[6]=n,e[7]=M):M=e[7];let L;e[8]!==M?(L={resolver:V,values:M},e[8]=M,e[9]=L):L=e[9];const y=Tt(L),R=y.formState.isDirty;let D;e[10]!==y||e[11]!==j?(D=async()=>{if(!await y.trigger())return;const E=y.getValues(),he=Gs(E);await j(he),y.reset(E)},e[10]=y,e[11]=j,e[12]=D):D=e[12];const N=D;let A;e[13]!==n||e[14]!==y?(A=()=>{y.reset(rt(n))},e[13]=n,e[14]=y,e[15]=A):A=e[15];const $=A;let T;e[16]!==n.id||e[17]!==b||e[18]!==u?(T=async()=>{const{token:P,tokenInfo:E,error:he}=await Ut({connectionId:n.id});if(he||!P){ve.error(`Authentication failed: ${he}`);return}if(E)try{const Me=await fetch(`/api/connections/${n.id}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:E.accessToken,refreshToken:E.refreshToken,expiresIn:E.expiresIn,scope:E.scope,clientId:E.clientId,clientSecret:E.clientSecret,tokenEndpoint:E.tokenEndpoint})});if(!Me.ok)console.error("Failed to save OAuth token:",await Me.text()),await b.update.mutateAsync({id:n.id,data:{connection_token:P}});else try{await b.update.mutateAsync({id:n.id,data:{}})}catch(We){console.warn("Failed to refresh connection tools after OAuth:",We)}}catch(Me){console.error("Error saving OAuth token:",Me),await b.update.mutateAsync({id:n.id,data:{connection_token:P}})}else await b.update.mutateAsync({id:n.id,data:{connection_token:P}});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]=T):T=e[19];const F=T;let z;e[20]!==n.id||e[21]!==u?(z=async()=>{try{const P=await fetch(`/api/connections/${n.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!P.ok){const he=await P.text();ve.error(`Failed to remove OAuth: ${he}`);return}const E=new URL(`/mcp/${n.id}`,window.location.origin);await u.invalidateQueries({queryKey:Je.isMCPAuthenticated(E.href,null)}),ve.success("OAuth removed. You can now re-authenticate with a different account.")}catch(P){console.error("Error removing OAuth token:",P),ve.error("Failed to remove OAuth")}},e[20]=n.id,e[21]=u,e[22]=z):z=e[22];const je=z,ee=c.length,J=m.length,ye=x.length;let _e;e[23]!==c?(_e=c.filter(en),e[23]=c,e[24]=_e):_e=e[24];const Ce=_e.length,Ee=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]!==Ee||e[29]!==ee?(te=p&&Ee?[{id:"tools",label:"Tools",count:r?void 0:ee}]:[],e[26]=r,e[27]=p,e[28]=Ee,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]!==I||e[42]!==p||e[43]!==te||e[44]!==se||e[45]!==ne||e[46]!==oe){let P;e[48]!==I?(P=I?[{id:"readme",label:"README"}]:[],e[48]=I,e[49]=P):P=e[49],we=[Se,...te,...se,...ne,...oe,...p?(l||[]).map(Zs):[],...P],e[40]=l,e[41]=I,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(Ys)?"tools":"settings",O=be.some(P=>P.id===a)?a:xt;let Te;e[50]!==d?(Te=P=>{d({search:E=>({...E,tab:P}),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]!==O||e[55]!==ie){let P;e[57]!==O?(P=E=>E.name===O,e[57]=O,e[58]=P):P=e[58],ke=ie.find(P),e[54]=O,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(zt,{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(Ft,{children:n.title})}),e[62]=n.title,e[63]=ce):ce=e[63];let $e;e[64]!==ae||e[65]!==ce?($e=t.jsx(Kt,{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]!==$||e[69]!==R||e[70]!==f?(le=t.jsx(Xe,{children:t.jsx($t,{onSave:N,onUndo:$,isDirty:R,isSaving:f})}),e[67]=N,e[68]=$,e[69]=R,e[70]=f,e[71]=le):le=e[71];let de;e[72]!==_.hasOAuthToken||e[73]!==n||e[74]!==y||e[75]!==F||e[76]!==je||e[77]!==p?(de=t.jsx("div",{className:"w-100 shrink-0 border-r border-border bg-background",children:t.jsx(vs,{form:y,connection:n,isMCPAuthenticated:p,hasOAuthToken:_.hasOAuthToken,onReauthenticate:F,onRemoveOAuth:je})}),e[72]=_.hasOAuthToken,e[73]=n,e[74]=y,e[75]=F,e[76]=je,e[77]=p,e[78]=de):de=e[78];let me;e[79]!==O||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(qt,{tabs:be,activeTab:O,onTabChange:re,className:"flex-1"})}),e[79]=O,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]!==O||e[86]!==_.isServerError||e[87]!==_.supportsOAuth||e[88]!==n||e[89]!==o||e[90]!==y||e[91]!==F||e[92]!==re||e[93]!==g||e[94]!==I||e[95]!==r||e[96]!==p||e[97]!==i||e[98]!==m||e[99]!==k||e[100]!==x||e[101]!==c?(ue=t.jsx(X.Suspense,{fallback:Ae,children:O==="tools"?t.jsx(zs,{tools:c,connectionId:o,org:i,isLoading:r}):O==="ui"?t.jsx(Bs,{tools:c,connectionId:o,org:i}):O==="prompts"?t.jsx(Ps,{prompts:m,connectionId:o,org:i}):O==="resources"?t.jsx(Ls,{resources:x,connectionId:o,org:i}):O==="settings"?t.jsx(Dt,{connection:n,form:y,hasMcpBinding:g,isMCPAuthenticated:p,supportsOAuth:_.supportsOAuth,isServerError:_.isServerError,onAuthenticate:F,onViewReadme:I?()=>re("readme"):void 0}):O==="readme"&&I?t.jsx(Is,{repository:k}):Pe&&p?t.jsx(Wt,{connectionId:o,org:i,activeCollection:Pe},O):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]=O,e[86]=_.isServerError,e[87]=_.supportsOAuth,e[88]=n,e[89]=o,e[90]=y,e[91]=F,e[92]=re,e[93]=g,e[94]=I,e[95]=r,e[96]=p,e[97]=i,e[98]=m,e[99]=k,e[100]=x,e[101]=c,e[102]=ue):ue=e[102];let pe;e[103]!==O||e[104]!==ue?(pe=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(ct,{children:ue},O)}),e[103]=O,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 Ys(s){return s.id==="tools"}function Zs(s){return{id:s.name,label:s.displayName}}function en(s){return!!Ke(s._meta)}function tn(){const s=U.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}=_t(o),{org:l}=ze();let j;s[2]===Symbol.for("react.memo_cache_sentinel")?(j={from:"/shell/$org/$project/mcps/$connectionId"},s[2]=j):j=s[2];const m=Ct(j).tab??"",x=Ot(i),c=dt(),r=At(x??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}=Lt(u);let v;s[8]!==d?(v={client:d},s[8]=d,s[9]=v):v=s[9];const{data:_}=Et(v),S=x?.connection_type==="VIRTUAL";let p;s[10]!==d||s[11]!==S?(p={client:d,enabled:S},s[10]=d,s[11]=S,s[12]=p):p=s[12];const{data:C,isLoading:w}=Rt(p);let g;s[13]!==b?.prompts?(g=b?.prompts??[],s[13]=b?.prompts,s[14]=g):g=s[14];let k;s[15]!==g?(k=g.map(on),s[15]=g,s[16]=k):k=s[16];const I=k;let V;s[17]!==_?.resources?(V=_?.resources??[],s[17]=_?.resources,s[18]=V):V=s[18];let M;s[19]!==V?(M=V.map(nn),s[19]=V,s[20]=M):M=s[20];const L=M;let y;s[21]!==x?.tools||s[22]!==S||s[23]!==C?.tools?(y=S?(C?.tools??[]).map(sn):x?.tools??[],s[21]=x?.tools,s[22]=S,s[23]=C?.tools,s[24]=y):y=s[24];const R=y;let D;s[25]!==c.update||s[26]!==i?(D=async $=>{await c.update.mutateAsync({id:i,data:$})},s[25]=c.update,s[26]=i,s[27]=D):D=s[27];const N=D;if(!x){let $;return s[28]!==n||s[29]!==a?($=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]=$):$=s[30],$}let A;return s[31]!==c.update.isPending||s[32]!==r||s[33]!==x||s[34]!==i||s[35]!==N||s[36]!==w||s[37]!==a||s[38]!==I||s[39]!==m||s[40]!==L||s[41]!==R?(A=t.jsx(Js,{org:a,connection:x,connectionId:i,requestedTabId:m,collections:r,onUpdate:N,isUpdating:c.update.isPending,prompts:I,resources:L,tools:R,isLoadingTools:w}),s[31]=c.update.isPending,s[32]=r,s[33]=x,s[34]=i,s[35]=N,s[36]=w,s[37]=a,s[38]=I,s[39]=m,s[40]=L,s[41]=R,s[42]=A):A=s[42],A}function sn(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,annotations:s.annotations,_meta:s._meta}}function nn(s){return{uri:s.uri,name:s.name,description:s.description}}function on(s){return{name:s.name,description:s.description}}function rn(){const s=U.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ct,{children:t.jsx(X.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(Oe,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(tn,{})})}),s[0]=e):e=s[0],e}function hr(){const s=U.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(rn,{}),s[0]=e):e=s[0],e}export{hr as default};
|
|
1
|
+
import{c as U,j as t,b as Ne,B as Ue,O as ge,aF as it,u as ze,x as gt,c0 as Qe,q as jt,p as bt,r as X,o as at,bI as vt,bQ as Nt,s as B,w as Ge,_ as yt,E as ct,e as _t,a as Ct,n as St,k as wt,l as Tt,i as kt,t as ve,K as Je}from"./index-PEK2-Gur.js";import{E as Z,C as Be}from"./collection-search-BVMX34xh.js";import{E as Pt,r as It,e as lt}from"./env-vars-editor-7rdGUbIW.js";import{g as Ke}from"./types-DfAuQBsH.js";import{S as $t}from"./save-actions-FUGEGF6q.js";import{b as At,a as Vt}from"./use-binding-bR1unh0d.js";import{u as Mt,S as Dt}from"./index-cyFdlvvQ.js";import{u as Ot,a as dt}from"./use-connection-Cknhz6to.js";import{u as mt}from"./constants-9aDFHfpv.js";import{d as Rt}from"./use-mcp-tools-BMktygYP.js";import{b as Et}from"./use-mcp-resources-V7_1ln1p.js";import{a as Lt}from"./decopilot-events-BNDSGGPU.js";import{a as Ut}from"./mcp-oauth-6xg1H94l.js";import{b as Ye,c as Ft,d as zt,e as Bt,B as Kt,a as Xt}from"./breadcrumb-DZJzQEPd.js";import{C as qt}from"./collection-tabs-fHRefLVF.js";import{i as Oe}from"./Loading01-HszUOya-.js";import{V as Xe,a as Ht}from"./layout-BIum7cxT.js";import{C as Wt}from"./collection-tab-Dq2y4UTN.js";import{I as Qt}from"./icon-picker-BxryrKdj.js";import{I as Re}from"./integration-icon-CF_VTof8.js";import{B as Fe}from"./badge-DfhuIA_7.js";import{D as Gt,a as Jt,b as Yt,c as Ze}from"./dropdown-menu-CxuRGQYq.js";import{F as H,a as Zt,b as W,d as K,f as Q,c as Y,e as es}from"./form-yfGhYWGK.js";import{I as G}from"./input-sgdy4h-T.js";import{S as et,a as tt,b as st,c as nt,d as q}from"./select-C05ByfCe.js";import{i as ut}from"./CheckCircle-B7XGhEcJ.js";import{t as ts}from"./ChevronDown-DkqBWU_h.js";import{n as ss}from"./Container-B8pG1v5Y.js";import{s as De}from"./Globe02-sIfslzHX.js";import{s as ns}from"./RefreshCcw01-yUiODtTq.js";import{i as os}from"./Terminal-CM1LxJaq.js";import{s as rs}from"./Trash01-CAKaaYMp.js";import{t as qe}from"./Users03-D0y7vtGV.js";import{s as is}from"./XClose-6pBqg-B-.js";import{U as as}from"./user-CLAm4Myt.js";import{b as cs,a as ls}from"./use-virtual-mcp-DncJVsC2.js";import{i as ds}from"./ChevronRight-BI34N28O.js";import{s as ms}from"./Plus-BaoKmylk.js";import{f as us}from"./formatDistanceToNow-Cb2QZZJn.js";import{C as pt}from"./collection-display-button-CVVCR82C.js";import{C as ft}from"./collection-table-wrapper-C0TGGJ6J.js";import{C as He}from"./card-DXg2GX79.js";import{R as ps}from"./readme-viewer-udR9CDuh.js";import{T as fs,a as xs}from"./tools-list-MmMBTqrs.js";import{M as hs}from"./mcp-app-renderer-C_3fiOtj.js";import"./SearchMd-3WCi1VDc.js";import"./Save01-Co3EpgQC.js";import"./binder-C6fAESck.js";import"./File06-DNhGyMHz.js";import"./Key01-CHf-4NZR.js";import"./constants-C6iMC3JV.js";import"./registry-utils-BUxN-Xyw.js";import"./extract-connection-data-C3TnWHFq.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-BzL8TqTO.js";import"./index-BE5cW0kh.js";import"./circle-alert-DpFL31gA.js";import"./index-Cay1thV-.js";import"./index-B9MYwIUx.js";import"./index-BxIsqm8s.js";import"./collapsible-CZMy3y5l.js";import"./use-llm-D6vMdIHx.js";import"./use-collections-CdWUwl8U.js";import"./useMutation-Bwc-v8Ow.js";import"./useQuery-C84LCuAf.js";import"./localstorage-keys-F1lq-lvV.js";import"./tabs-B8_PkbMO.js";import"./checkbox-CA1NpLng.js";import"./Check-Camn3oQw.js";import"./dialog-C82flYm2.js";import"./X-BS-0d43p.js";import"./skeleton-UoFZ21oo.js";import"./AlignLeft-BixvP29Y.js";import"./ArrowLeft-BAkHebXa.js";import"./Image01-BNs8seI1.js";import"./Settings01-84eR-C3B.js";import"./useSuspenseInfiniteQuery-B9Fj3djj.js";import"./infiniteQueryObserver-C6bi1NMJ.js";import"./popover-W_pvoCtS.js";import"./spinner-BGQowtes.js";import"./tooltip-CWYwrzX7.js";import"./index-xpVnmlVH.js";import"./usage-B8eRkRZY.js";import"./ArrowUp-BCyv-ojK.js";import"./Edit01-nsEjgwmh.js";import"./XCircle-BJZFrCgV.js";import"./AlertCircle-BDyT9vNZ.js";import"./use-copy-2ZhzXjqK.js";import"./Code01-DcYAohyI.js";import"./use-create-virtual-mcp-DtdhklAc.js";import"./Copy01-GXSpNbxP.js";import"./marked.esm-BaswSlok.js";import"./markdown-CbEbvbZf.js";import"./Eye-DQF_Qzuy.js";import"./LayersTwo01-zg7ssS5q.js";import"./index-CPVHF3xw.js";import"./Clock-BqFZuRNT.js";import"./DotsVertical-DgG2OQVv.js";import"./empty-state-BRx85n5e.js";import"./Inbox01-DTh-ZtU7.js";import"./use-list-state-BFxcsMHC.js";import"./use-view-mode-CkSeKCK_.js";import"./use-mobile-DqFS2tGv.js";import"./alert-dialog-CtNI8LvE.js";import"./scroll-area-CK7vwAfQ.js";import"./Edit05-BLS2FJfm.js";import"./Link01-B46W_qyR.js";import"./label-BrZsvi2a.js";import"./avatar-7hY_H5zt.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./ArrowDown-BYesfwXe.js";import"./Grid01-CTYtPHN4.js";import"./List-DXD0Q-rz.js";import"./table-X8r3lDFL.js";function gs(s){const e=U.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(qe,{size:16}),e[3]=a):a=e[3];let l;e[4]!==n.icon||e[5]!==n.title?(l=t.jsx(Re,{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 j;e[7]!==n.title?(j=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[7]=n.title,e[8]=j):j=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(ds,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[9]=f):f=e[9];let m;return e[10]!==i||e[11]!==l||e[12]!==j?(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,j,f]}),e[10]=i,e[11]=l,e[12]=j,e[13]=m):m=e[13],m}function ot(s){const e=U.c(20),{connectionId:n,connectionTitle:o,connectionDescription:i,connectionIcon:a,org:l,hasExistingVirtualMcps:j}=s,f=Ne(),m=ls();let x;e[0]!==m.create||e[1]!==i||e[2]!==a||e[3]!==n||e[4]!==o||e[5]!==f||e[6]!==l?(x=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}]});f({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]=f,e[6]=l,e[7]=x):x=e[7];const c=x;if(j){let d;e[8]!==m.create.isPending?(d=m.create.isPending?t.jsx(Oe,{size:16,className:"animate-spin"}):t.jsx(ms,{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(qe,{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 js(s){const e=U.c(26),{connectionId:n,connectionTitle:o,connectionDescription:i,connectionIcon:a,org:l}=s;let j;e[0]!==n?(j={filters:[{column:"connection_id",value:n}]},e[0]=n,e[1]=j):j=e[1];const f=cs(j);if(!(f.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 x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("h4",{className:"text-xs text-muted-foreground font-medium",children:"Agents"}),e[9]=x):x=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:[x,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]!==f){let u;e[19]!==l?(u=b=>t.jsx(gs,{virtualMcp:b,org:l},b.id),e[19]=l,e[20]=u):u=e[20],r=f.map(u),e[16]=l,e[17]=f,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 bs({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:j}=jt(),f=(()=>{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=j||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",c=x?bt(e.connection_url):null;return x?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(qe,{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(H,{control:s.control,name:"ui_type",render:({field:r})=>t.jsxs(W,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),a!=="NPX"&&a!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(et,{value:r.value,onValueChange:r.onChange,children:[t.jsx(K,{children:t.jsxs(tt,{className:"h-10 w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(De,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(st,{})]})}),t.jsxs(nt,{children:[t.jsx(q,{value:"HTTP",children:"HTTP"}),t.jsx(q,{value:"SSE",children:"SSE"}),t.jsx(q,{value:"Websocket",children:"Websocket"}),m&&t.jsxs(t.Fragment,{children:[t.jsx(q,{value:"NPX",children:"NPX Package"}),t.jsx(q,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(H,{control:s.control,name:"connection_url",render:({field:h})=>t.jsx(W,{className:"flex-1 min-w-0",children:t.jsx(K,{children:t.jsx(G,{placeholder:"https://example.com/mcp",...h,value:h.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(et,{value:r.value,onValueChange:r.onChange,children:[t.jsx(K,{children:t.jsx(tt,{className:"h-10",children:t.jsx(st,{})})}),t.jsxs(nt,{children:[t.jsx(q,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(De,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(q,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(De,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(q,{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(q,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ss,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(q,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(os,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(Q,{})]})}),a==="NPX"&&t.jsx(H,{control:s.control,name:"npx_package",render:({field:r})=>t.jsxs(W,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(K,{children:t.jsx(G,{placeholder:"@perplexity-ai/mcp-server",...r,value:r.value||"",className:"h-10 rounded-lg"})}),t.jsx(Q,{})]})}),a==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(H,{control:s.control,name:"stdio_command",render:({field:r})=>t.jsxs(W,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(K,{children:t.jsx(G,{placeholder:"node, bun, python...",...r,value:r.value||"",className:"h-10 rounded-lg"})}),t.jsx(Q,{})]})}),t.jsx(H,{control:s.control,name:"stdio_args",render:({field:r})=>t.jsxs(W,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(K,{children:t.jsx(G,{placeholder:"arg1 arg2 --flag value",...r,value:r.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(Q,{})]})})]}),t.jsx(H,{control:s.control,name:"stdio_cwd",render:({field:r})=>t.jsxs(W,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(K,{children:t.jsx(G,{placeholder:"/path/to/project (optional)",...r,value:r.value||"",className:"h-10 rounded-lg"})}),t.jsx(Q,{})]})})]}),(a==="NPX"||a==="STDIO")&&t.jsx(H,{control:s.control,name:"env_vars",render:({field:r})=>t.jsxs(W,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(K,{children:t.jsx(Pt,{value:r.value??[],onChange:r.onChange})}),t.jsx(Q,{})]})}),a!=="NPX"&&a!=="STDIO"&&t.jsx(H,{control:s.control,name:"connection_token",render:({field:r})=>t.jsxs(W,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:f?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Gt,{children:[t.jsx(Jt,{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(ts,{size:12})]})})}),t.jsxs(Yt,{align:"start",children:[t.jsxs(Ze,{onClick:o,children:[t.jsx(ns,{size:16}),"Re-authenticate"]}),t.jsxs(Ze,{variant:"destructive",onClick:i,children:[t.jsx(rs,{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(is,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(K,{children:t.jsx(G,{type:"password",placeholder:f?"Paste your GitHub PAT":"Enter access token...",...r,value:r.value||"",className:"h-10 rounded-lg"})}),f&&t.jsxs(es,{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 vs(s){const e=U.c(45),{form:n,connection:o,isMCPAuthenticated:i,hasOAuthToken:a,onReauthenticate:l,onRemoveOAuth:j}=s,{org:f}=ze();let m;e[0]!==o.app_name||e[1]!==o.icon||e[2]!==o.title||e[3]!==n.control?(m=o.app_name&&o.icon?t.jsx(Re,{icon:o.icon,name:o.title,size:"lg",className:"shadow-sm"}):t.jsx(gt,{control:n.control,name:"icon",render:k=>{const{field:I}=k;return t.jsx(Qt,{value:I.value,onChange:I.onChange,name:o.title,size:"lg",className:"shadow-sm"})}}),e[0]=o.app_name,e[1]=o.icon,e[2]=o.title,e[3]=n.control,e[4]=m):m=e[4];let x;e[5]!==n.control?(x=t.jsxs("div",{className:"flex flex-col",children:[t.jsx(H,{control:n.control,name:"title",render:ys}),t.jsx(H,{control:n.control,name:"description",render:Ns})]}),e[5]=n.control,e[6]=x):x=e[6];let c;e[7]!==m||e[8]!==x?(c=t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[m,x]}),e[7]=m,e[8]=x,e[9]=c):c=e[9];let r;e[10]!==o||e[11]!==n||e[12]!==a||e[13]!==l||e[14]!==j?(r=t.jsx(bs,{form:n,connection:o,hasOAuthToken:a,onReauthenticate:l,onRemoveOAuth:j}),e[10]=o,e[11]=n,e[12]=a,e[13]=l,e[14]=j,e[15]=r):r=e[15];let h;e[16]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Status"}),e[16]=h):h=e[16];let d;e[17]!==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[17]=i,e[18]=d):d=e[18];let u;e[19]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Created by"}),e[19]=u):u=e[19];let b;e[20]!==o.created_by?(b=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[u,t.jsx(as,{id:o.created_by,size:"2xs"})]}),e[20]=o.created_by,e[21]=b):b=e[21];let v;e[22]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Updated"}),e[22]=v):v=e[22];let _;e[23]!==o.updated_at?(_=o.updated_at?us(new Date(o.updated_at),{addSuffix:!0}):"Unknown",e[23]=o.updated_at,e[24]=_):_=e[24];let S;e[25]!==_?(S=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[v,t.jsx("span",{className:"text-sm text-foreground",children:_})]}),e[25]=_,e[26]=S):S=e[26];let p;e[27]!==S||e[28]!==d||e[29]!==b?(p=t.jsxs("div",{className:"flex flex-col gap-2 p-5 border-b border-border",children:[d,b,S]}),e[27]=S,e[28]=d,e[29]=b,e[30]=p):p=e[30];let C;e[31]!==o.description||e[32]!==o.icon||e[33]!==o.id||e[34]!==o.title||e[35]!==f.slug?(C=t.jsx(js,{connectionId:o.id,connectionTitle:o.title,connectionDescription:o.description,connectionIcon:o.icon,org:f.slug}),e[31]=o.description,e[32]=o.icon,e[33]=o.id,e[34]=o.title,e[35]=f.slug,e[36]=C):C=e[36];let w;e[37]!==p||e[38]!==C||e[39]!==c||e[40]!==r?(w=t.jsxs("div",{className:"flex flex-col h-full overflow-auto",children:[c,r,p,C]}),e[37]=p,e[38]=C,e[39]=c,e[40]=r,e[41]=w):w=e[41];let g;return e[42]!==n||e[43]!==w?(g=t.jsx(Zt,{...n,children:w}),e[42]=n,e[43]=w,e[44]=g):g=e[44],g}function Ns(s){const{field:e}=s;return t.jsxs(W,{className:"w-full space-y-0",children:[t.jsx(K,{children:t.jsx(G,{...e,value:e.value||"",className:"h-auto py-0.5 text-base text-muted-foreground leading-6 px-2 -mx-2 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Add a description..."})}),t.jsx(Q,{})]})}function ys(s){const{field:e}=s;return t.jsxs(W,{className:"flex-1 space-y-0",children:[t.jsx(K,{children:t.jsx(G,{...e,className:"h-auto py-0.5 text-lg! font-medium leading-7 px-2 -mx-2 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Connection Name"})}),t.jsx(Q,{})]})}function _s(s){const e=U.c(39),{prompts:n,connectionId:o,org:i,onPromptClick:a,showToolbar:l,emptyMessage:j}=s,f=l===void 0?!0:l,m=j===void 0?"This connection doesn't have any prompts yet.":j,x=Ne(),[c,r]=X.useState(""),[h,d]=X.useState("table"),[u,b]=X.useState("name"),[v,_]=X.useState("asc");let S;e[0]!==v||e[1]!==u?(S=T=>{u===T?(_(ks),v==="desc"&&b(void 0)):(b(T),_("asc"))},e[0]=v,e[1]=u,e[2]=S):S=e[2];const p=S;let C;e[3]!==o||e[4]!==x||e[5]!==a||e[6]!==i?(C=T=>{a?a(T):o&&i&&x({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:i,project:ge,connectionId:o,collectionName:"prompts",itemId:encodeURIComponent(T.name)}})},e[3]=o,e[4]=x,e[5]=a,e[6]=i,e[7]=C):C=e[7];const w=C;let g;if(e[8]!==n||e[9]!==c||e[10]!==v||e[11]!==u){const T=!n||n.length===0?[]:c.trim()?(()=>{const F=c.toLowerCase();return n.filter(z=>z.name.toLowerCase().includes(F)||z.description&&z.description.toLowerCase().includes(F))})():n;g=!u||!v?T:[...T].sort((F,z)=>{const je=F[u]||"",ee=z[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]=g}else g=e[12];const k=g;let I;e[13]===Symbol.for("react.memo_cache_sentinel")?(I=[{id:"name",header:"Name",render:Ts,sortable:!0},{id:"description",header:"Description",render:ws,cellClassName:"flex-1",sortable:!0}],e[13]=I):I=e[13];const V=I;let M;e[14]===Symbol.for("react.memo_cache_sentinel")?(M=V.filter(Ss).map(Cs),e[14]=M):M=e[14];const L=M;let y;e[15]!==p||e[16]!==f||e[17]!==v||e[18]!==u||e[19]!==h?(y=f&&t.jsx(Xe,{children:t.jsx(pt,{viewMode:h,onViewModeChange:d,sortKey:u,sortDirection:v,onSort:p,sortOptions:L})}),e[15]=p,e[16]=f,e[17]=v,e[18]=u,e[19]=h,e[20]=y):y=e[20];let R;e[21]===Symbol.for("react.memo_cache_sentinel")?(R=T=>{T.key==="Escape"&&(r(""),T.target.blur())},e[21]=R):R=e[21];let D;e[22]!==c?(D=t.jsx(Be,{value:c,onChange:r,placeholder:"Search prompts...",onKeyDown:R}),e[22]=c,e[23]=D):D=e[23];let N;e[24]!==m||e[25]!==w||e[26]!==p||e[27]!==c||e[28]!==v||e[29]!==u||e[30]!==k||e[31]!==h?(N=h==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:k.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:k.map(T=>t.jsx(He,{className:"cursor-pointer transition-colors",onClick:()=>w(T),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Re,{icon:null,name:T.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:T.name}),t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:T.description||"No description"})]})]})},T.name))})}):t.jsx(ft,{columns:V,data:k,isLoading:!1,sortKey:u,sortDirection:v,onSort:p,onRowClick:T=>w(T),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]=k,e[31]=h,e[32]=N):N=e[32];let A;e[33]!==D||e[34]!==N?(A=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[D,N]}),e[33]=D,e[34]=N,e[35]=A):A=e[35];let $;return e[36]!==A||e[37]!==y?($=t.jsxs(t.Fragment,{children:[y,A]}),e[36]=A,e[37]=y,e[38]=$):$=e[38],$}function Cs(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function Ss(s){return s.sortable}function ws(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function Ts(s){return t.jsx("span",{className:"text-sm font-medium font-mono text-foreground",children:s.name})}function ks(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function Ps(s){const e=U.c(4),{prompts:n,connectionId:o,org:i}=s;let a;return e[0]!==o||e[1]!==i||e[2]!==n?(a=t.jsx(_s,{prompts:n,connectionId:o,org:i}),e[0]=o,e[1]=i,e[2]=n,e[3]=a):a=e[3],a}function Is(s){const e=U.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(ps,{repository:n})}),e[0]=n,e[1]=o):o=e[1],o}function $s(s){const e=U.c(36),{resources:n,onResourceClick:o,showToolbar:i,emptyMessage:a}=s,l=i===void 0?!0:i,j=a===void 0?"This connection doesn't have any resources yet.":a,[f,m]=X.useState(""),[x,c]=X.useState("table"),[r,h]=X.useState("name"),[d,u]=X.useState("asc");let b;e[0]!==d||e[1]!==r?(b=N=>{r===N?(u(Es),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 S=_;let p;if(e[5]!==n||e[6]!==f||e[7]!==d||e[8]!==r){const N=!n||n.length===0?[]:f.trim()?(()=>{const A=f.toLowerCase();return n.filter($=>$.uri.toLowerCase().includes(A)||$.name&&$.name.toLowerCase().includes(A)||$.description&&$.description.toLowerCase().includes(A))})():n;p=!r||!d?N:[...N].sort((A,$)=>{const T=A[r]||"",F=$[r]||"",z=String(T).localeCompare(String(F));return d==="asc"?z:-z}),e[5]=n,e[6]=f,e[7]=d,e[8]=r,e[9]=p}else p=e[9];const C=p;let w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=[{id:"name",header:"Name",render:Rs,sortable:!0},{id:"uri",header:"URI",render:Os,sortable:!0},{id:"description",header:"Description",render:Ds,cellClassName:"flex-1",sortable:!0},{id:"mimeType",header:"Type",render:Ms,sortable:!0}],e[10]=w):w=e[10];const g=w;let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=g.filter(Vs).map(As),e[11]=k):k=e[11];const I=k;let V;e[12]!==v||e[13]!==l||e[14]!==d||e[15]!==r||e[16]!==x?(V=l&&t.jsx(Xe,{children:t.jsx(pt,{viewMode:x,onViewModeChange:c,sortKey:r,sortDirection:d,onSort:v,sortOptions:I})}),e[12]=v,e[13]=l,e[14]=d,e[15]=r,e[16]=x,e[17]=V):V=e[17];let M;e[18]===Symbol.for("react.memo_cache_sentinel")?(M=N=>{N.key==="Escape"&&(m(""),N.target.blur())},e[18]=M):M=e[18];let L;e[19]!==f?(L=t.jsx(Be,{value:f,onChange:m,placeholder:"Search resources...",onKeyDown:M}),e[19]=f,e[20]=L):L=e[20];let y;e[21]!==j||e[22]!==S||e[23]!==v||e[24]!==f||e[25]!==d||e[26]!==r||e[27]!==C||e[28]!==x?(y=x==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:C.length===0?t.jsx(Z,{image:null,title:f?"No resources found":"No resources available",description:f?"Try adjusting your search terms":j}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:C.map(N=>t.jsx(He,{className:"cursor-pointer transition-colors",onClick:()=>S(N),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Re,{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(ft,{columns:g,data:C,isLoading:!1,sortKey:r,sortDirection:d,onSort:v,onRowClick:N=>S(N),emptyState:t.jsx(Z,{image:null,title:f?"No resources found":"No resources available",description:f?"Try adjusting your search terms":j})}),e[21]=j,e[22]=S,e[23]=v,e[24]=f,e[25]=d,e[26]=r,e[27]=C,e[28]=x,e[29]=y):y=e[29];let R;e[30]!==L||e[31]!==y?(R=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[L,y]}),e[30]=L,e[31]=y,e[32]=R):R=e[32];let D;return e[33]!==R||e[34]!==V?(D=t.jsxs(t.Fragment,{children:[V,R]}),e[33]=R,e[34]=V,e[35]=D):D=e[35],D}function As(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function Vs(s){return s.sortable}function Ms(s){return t.jsx("span",{className:"text-sm text-muted-foreground",children:s.mimeType||"—"})}function Ds(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function Os(s){return t.jsx("span",{className:"text-sm font-mono text-muted-foreground",children:s.uri})}function Rs(s){return t.jsx("span",{className:"text-sm font-medium text-foreground",children:s.name||s.uri})}function Es(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function Ls(s){const e=U.c(4),{resources:n,connectionId:o,org:i}=s;let a;return e[0]!==o||e[1]!==i||e[2]!==n?(a=t.jsx($s,{resources:n,connectionId:o,org:i}),e[0]=o,e[1]=i,e[2]=n,e[3]=a):a=e[3],a}const Us=at({key:B().min(1,"Key is required"),value:B()}),Fs=at({title:B().min(1,"Name is required"),description:B().nullable().optional(),icon:B().nullable().optional(),ui_type:yt(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:B().optional(),connection_token:B().nullable().optional(),npx_package:B().optional(),stdio_command:B().optional(),stdio_args:B().optional(),stdio_cwd:B().optional(),env_vars:Ge(Us).optional(),configuration_scopes:Ge(B()).nullable().optional(),configuration_state:vt(B(),Nt()).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 zs(s){const e=U.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(fs,{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 Bs(s){const e=U.c(27),{tools:n,connectionId:o,org:i}=s,a=Ne(),{org:l}=ze();let j;e[0]!==o||e[1]!==l.id?(j={connectionId:o,orgId:l.id},e[0]=o,e[1]=l.id,e[2]=j):j=e[2];const f=mt(j),[m,x]=X.useState("");let c,r,h,d;if(e[3]!==f||e[4]!==o||e[5]!==a||e[6]!==i||e[7]!==m||e[8]!==n){const v=(n??[]).filter(Ks),_=m.toLowerCase().trim(),S=_?v.filter(g=>g.name.toLowerCase().includes(_)||g.description&&g.description.toLowerCase().includes(_)):v;let p;e[13]!==o||e[14]!==a||e[15]!==i?(p=g=>{a({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:i,project:ge,connectionId:o,collectionName:"tools",itemId:encodeURIComponent(g.name)}})},e[13]=o,e[14]=a,e[15]=i,e[16]=p):p=e[16];const C=p;h="flex flex-col h-full overflow-hidden";let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=g=>{g.key==="Escape"&&(x(""),g.target.blur())},e[17]=w):w=e[17],e[18]!==m?(d=t.jsx(Be,{value:m,onChange:x,placeholder:"Search apps...",onKeyDown:w}),e[18]=m,e[19]=d):d=e[19],c="flex-1 overflow-auto p-5",r=S.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:S.map(g=>{const k=Ke(g._meta);return t.jsxs(He,{className:"cursor-pointer transition-colors overflow-hidden",onClick:()=>C(g),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(hs,{resourceURI:k,toolInfo:{tool:g},displayMode:"inline",minHeight:200,maxHeight:200,client:f})}),t.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:g.name}),t.jsx(xs,{annotations:g.annotations,_meta:g._meta})]}),g.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:g.description})]})]},g.name)})}),e[3]=f,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 Ks(s){return!!Ke(s._meta)}function Xs(s){return s.command==="npx"}function qs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function Hs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function Ws(s,e){const n={command:"npx",args:["-y",s]},o=lt(e);return Object.keys(o).length>0&&(n.envVars=o),n}function Qs(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??"",icon:s.icon??null,configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&kt(s.connection_headers)){const o=s.connection_headers,i=It(o.envVars);if(Xs(o)){const l=qs(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=Hs(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 Gs(s){let e,n=null,o=null,i=null;return s.ui_type==="NPX"?(e="STDIO",n="",i=Ws(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",i=Qs(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,icon:s.icon??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 Js(s){const e=U.c(116),{connection:n,connectionId:o,org:i,requestedTabId:a,collections:l,onUpdate:j,isUpdating:f,prompts:m,resources:x,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=St(),b=dt();let v;e[1]!==o?(v={connectionId:o},e[1]=o,e[2]=v):v=e[2];const _=Mt(v),p=n?.connection_type==="VIRTUAL"||_.isAuthenticated;let C;e[3]!==n?(C={connections:[n],binding:"MCP"},e[3]=n,e[4]=C):C=e[4];const g=Vt(C).length>0,k=n?.metadata?.repository,I=!!k?.url;let V;e[5]===Symbol.for("react.memo_cache_sentinel")?(V=wt(Fs),e[5]=V):V=e[5];let M;e[6]!==n?(M=rt(n),e[6]=n,e[7]=M):M=e[7];let L;e[8]!==M?(L={resolver:V,values:M},e[8]=M,e[9]=L):L=e[9];const y=Tt(L),R=y.formState.isDirty;let D;e[10]!==y||e[11]!==j?(D=async()=>{if(!await y.trigger())return;const E=y.getValues(),he=Gs(E);await j(he),y.reset(E)},e[10]=y,e[11]=j,e[12]=D):D=e[12];const N=D;let A;e[13]!==n||e[14]!==y?(A=()=>{y.reset(rt(n))},e[13]=n,e[14]=y,e[15]=A):A=e[15];const $=A;let T;e[16]!==n.id||e[17]!==b||e[18]!==u?(T=async()=>{const{token:P,tokenInfo:E,error:he}=await Ut({connectionId:n.id});if(he||!P){ve.error(`Authentication failed: ${he}`);return}if(E)try{const Me=await fetch(`/api/connections/${n.id}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:E.accessToken,refreshToken:E.refreshToken,expiresIn:E.expiresIn,scope:E.scope,clientId:E.clientId,clientSecret:E.clientSecret,tokenEndpoint:E.tokenEndpoint})});if(!Me.ok)console.error("Failed to save OAuth token:",await Me.text()),await b.update.mutateAsync({id:n.id,data:{connection_token:P}});else try{await b.update.mutateAsync({id:n.id,data:{}})}catch(We){console.warn("Failed to refresh connection tools after OAuth:",We)}}catch(Me){console.error("Error saving OAuth token:",Me),await b.update.mutateAsync({id:n.id,data:{connection_token:P}})}else await b.update.mutateAsync({id:n.id,data:{connection_token:P}});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]=T):T=e[19];const F=T;let z;e[20]!==n.id||e[21]!==u?(z=async()=>{try{const P=await fetch(`/api/connections/${n.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!P.ok){const he=await P.text();ve.error(`Failed to remove OAuth: ${he}`);return}const E=new URL(`/mcp/${n.id}`,window.location.origin);await u.invalidateQueries({queryKey:Je.isMCPAuthenticated(E.href,null)}),ve.success("OAuth removed. You can now re-authenticate with a different account.")}catch(P){console.error("Error removing OAuth token:",P),ve.error("Failed to remove OAuth")}},e[20]=n.id,e[21]=u,e[22]=z):z=e[22];const je=z,ee=c.length,J=m.length,ye=x.length;let _e;e[23]!==c?(_e=c.filter(en),e[23]=c,e[24]=_e):_e=e[24];const Ce=_e.length,Ee=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]!==Ee||e[29]!==ee?(te=p&&Ee?[{id:"tools",label:"Tools",count:r?void 0:ee}]:[],e[26]=r,e[27]=p,e[28]=Ee,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]!==I||e[42]!==p||e[43]!==te||e[44]!==se||e[45]!==ne||e[46]!==oe){let P;e[48]!==I?(P=I?[{id:"readme",label:"README"}]:[],e[48]=I,e[49]=P):P=e[49],we=[Se,...te,...se,...ne,...oe,...p?(l||[]).map(Zs):[],...P],e[40]=l,e[41]=I,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(Ys)?"tools":"settings",O=be.some(P=>P.id===a)?a:xt;let Te;e[50]!==d?(Te=P=>{d({search:E=>({...E,tab:P}),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]!==O||e[55]!==ie){let P;e[57]!==O?(P=E=>E.name===O,e[57]=O,e[58]=P):P=e[58],ke=ie.find(P),e[54]=O,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(zt,{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(Ft,{children:n.title})}),e[62]=n.title,e[63]=ce):ce=e[63];let $e;e[64]!==ae||e[65]!==ce?($e=t.jsx(Kt,{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]!==$||e[69]!==R||e[70]!==f?(le=t.jsx(Xe,{children:t.jsx($t,{onSave:N,onUndo:$,isDirty:R,isSaving:f})}),e[67]=N,e[68]=$,e[69]=R,e[70]=f,e[71]=le):le=e[71];let de;e[72]!==_.hasOAuthToken||e[73]!==n||e[74]!==y||e[75]!==F||e[76]!==je||e[77]!==p?(de=t.jsx("div",{className:"w-100 shrink-0 border-r border-border bg-background",children:t.jsx(vs,{form:y,connection:n,isMCPAuthenticated:p,hasOAuthToken:_.hasOAuthToken,onReauthenticate:F,onRemoveOAuth:je})}),e[72]=_.hasOAuthToken,e[73]=n,e[74]=y,e[75]=F,e[76]=je,e[77]=p,e[78]=de):de=e[78];let me;e[79]!==O||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(qt,{tabs:be,activeTab:O,onTabChange:re,className:"flex-1"})}),e[79]=O,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]!==O||e[86]!==_.isServerError||e[87]!==_.supportsOAuth||e[88]!==n||e[89]!==o||e[90]!==y||e[91]!==F||e[92]!==re||e[93]!==g||e[94]!==I||e[95]!==r||e[96]!==p||e[97]!==i||e[98]!==m||e[99]!==k||e[100]!==x||e[101]!==c?(ue=t.jsx(X.Suspense,{fallback:Ae,children:O==="tools"?t.jsx(zs,{tools:c,connectionId:o,org:i,isLoading:r}):O==="ui"?t.jsx(Bs,{tools:c,connectionId:o,org:i}):O==="prompts"?t.jsx(Ps,{prompts:m,connectionId:o,org:i}):O==="resources"?t.jsx(Ls,{resources:x,connectionId:o,org:i}):O==="settings"?t.jsx(Dt,{connection:n,form:y,hasMcpBinding:g,isMCPAuthenticated:p,supportsOAuth:_.supportsOAuth,isServerError:_.isServerError,onAuthenticate:F,onViewReadme:I?()=>re("readme"):void 0}):O==="readme"&&I?t.jsx(Is,{repository:k}):Pe&&p?t.jsx(Wt,{connectionId:o,org:i,activeCollection:Pe},O):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]=O,e[86]=_.isServerError,e[87]=_.supportsOAuth,e[88]=n,e[89]=o,e[90]=y,e[91]=F,e[92]=re,e[93]=g,e[94]=I,e[95]=r,e[96]=p,e[97]=i,e[98]=m,e[99]=k,e[100]=x,e[101]=c,e[102]=ue):ue=e[102];let pe;e[103]!==O||e[104]!==ue?(pe=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(ct,{children:ue},O)}),e[103]=O,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 Ys(s){return s.id==="tools"}function Zs(s){return{id:s.name,label:s.displayName}}function en(s){return!!Ke(s._meta)}function tn(){const s=U.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}=_t(o),{org:l}=ze();let j;s[2]===Symbol.for("react.memo_cache_sentinel")?(j={from:"/shell/$org/$project/mcps/$connectionId"},s[2]=j):j=s[2];const m=Ct(j).tab??"",x=Ot(i),c=dt(),r=At(x??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}=Lt(u);let v;s[8]!==d?(v={client:d},s[8]=d,s[9]=v):v=s[9];const{data:_}=Et(v),S=x?.connection_type==="VIRTUAL";let p;s[10]!==d||s[11]!==S?(p={client:d,enabled:S},s[10]=d,s[11]=S,s[12]=p):p=s[12];const{data:C,isLoading:w}=Rt(p);let g;s[13]!==b?.prompts?(g=b?.prompts??[],s[13]=b?.prompts,s[14]=g):g=s[14];let k;s[15]!==g?(k=g.map(on),s[15]=g,s[16]=k):k=s[16];const I=k;let V;s[17]!==_?.resources?(V=_?.resources??[],s[17]=_?.resources,s[18]=V):V=s[18];let M;s[19]!==V?(M=V.map(nn),s[19]=V,s[20]=M):M=s[20];const L=M;let y;s[21]!==x?.tools||s[22]!==S||s[23]!==C?.tools?(y=S?(C?.tools??[]).map(sn):x?.tools??[],s[21]=x?.tools,s[22]=S,s[23]=C?.tools,s[24]=y):y=s[24];const R=y;let D;s[25]!==c.update||s[26]!==i?(D=async $=>{await c.update.mutateAsync({id:i,data:$})},s[25]=c.update,s[26]=i,s[27]=D):D=s[27];const N=D;if(!x){let $;return s[28]!==n||s[29]!==a?($=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]=$):$=s[30],$}let A;return s[31]!==c.update.isPending||s[32]!==r||s[33]!==x||s[34]!==i||s[35]!==N||s[36]!==w||s[37]!==a||s[38]!==I||s[39]!==m||s[40]!==L||s[41]!==R?(A=t.jsx(Js,{org:a,connection:x,connectionId:i,requestedTabId:m,collections:r,onUpdate:N,isUpdating:c.update.isPending,prompts:I,resources:L,tools:R,isLoadingTools:w}),s[31]=c.update.isPending,s[32]=r,s[33]=x,s[34]=i,s[35]=N,s[36]=w,s[37]=a,s[38]=I,s[39]=m,s[40]=L,s[41]=R,s[42]=A):A=s[42],A}function sn(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,annotations:s.annotations,_meta:s._meta}}function nn(s){return{uri:s.uri,name:s.name,description:s.description}}function on(s){return{name:s.name,description:s.description}}function rn(){const s=U.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ct,{children:t.jsx(X.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(Oe,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(tn,{})})}),s[0]=e):e=s[0],e}function hr(){const s=U.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(rn,{}),s[0]=e):e=s[0],e}export{hr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,c as n,j as r}from"./index-
|
|
1
|
+
import{r as c,c as n,j as r}from"./index-PEK2-Gur.js";import{B as a}from"./badge-DfhuIA_7.js";import{i as l}from"./AlertCircle-BDyT9vNZ.js";import{i as m}from"./CheckCircle-B7XGhEcJ.js";const u=({size:s=24,color:e="currentColor",...o})=>c.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...o},c.createElement("path",{d:"m7.5 12 3 3 6-6M7.8 21h8.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C21 18.72 21 17.88 21 16.2V7.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C18.72 3 17.88 3 16.2 3H7.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C3 5.28 3 6.12 3 7.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 21 6.12 21 7.8 21Z"}));u.displayName="CheckSquare";function x(s){const e=n.c(3),{status:o}=s;if(o==="active"){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=r.jsxs(a,{variant:"success",className:"gap-1.5 text-success border-success/40 bg-background",children:[r.jsx(m,{size:12}),"Active"]}),e[0]=t):t=e[0],t}if(o==="error"){let t;return e[1]===Symbol.for("react.memo_cache_sentinel")?(t=r.jsxs(a,{variant:"outline",className:"gap-1.5 text-destructive border-destructive/40 bg-background",children:[r.jsx(l,{size:12}),"Error"]}),e[1]=t):t=e[1],t}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(a,{variant:"outline",className:"text-muted-foreground",children:"Inactive"}),e[2]=i):i=e[2],i}export{x as C,u as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as ge,j as t,E as yt,r as H,u as vt,n as Ct,b as Nt,a as bt,d as _t,q as kt,l as wt,k as St,i as Tt,B as O,O as Q,v as oe,t as J,o as ct,w as Dt,s as Y,_ as It}from"./index-DAmbTOxS.js";import{g as Pt}from"./generate-id-Dyweu44Y.js";import{C as At}from"./collection-display-button-D2FdRhJR.js";import{C as $t,E as $e}from"./collection-search-D8yWk6Rw.js";import{T as Et,a as Ot,b as we,c as pe,d as zt,e as Lt}from"./table-C0vfolQ8.js";import{C as lt}from"./connection-card-CYFGLsK7.js";import{C as Te,i as Vt}from"./connection-status-IBWccbtA.js";import{I as Ne}from"./integration-icon-C_X_mJPp.js";import{P as ve}from"./index-DG2fU15Y.js";import{U as be}from"./user-v5BJSUZP.js";import{u as Ft}from"./use-binding-DJJU0pVY.js";import{u as Bt}from"./use-list-state-E1MzR5q_.js";import{f as Ut,e as Mt}from"./registry-utils-gPUhOrxo.js";import{f as Oe,a as ze,b as Le,c as Ve,d as Fe,e as Be,A as Ue,h as Me}from"./alert-dialog-vVs9i4lx.js";import{B as Re}from"./badge-BAP-lcs5.js";import{B as Rt,a as Ht,b as Xt,c as Kt}from"./breadcrumb-CdWsOBPt.js";import{C as De}from"./checkbox-B-1-mid3.js";import{D as qe,a as Qe,b as Je,c as Ye,d as Ze,e as at}from"./dialog-BzNDvgYI.js";import{D as He,a as Xe,b as Ke,c as fe}from"./dropdown-menu-cjxseDpi.js";import{a as Wt,F as Z,b as ee,c as te,d as ne,f as se}from"./form-Cy3Jwk-Q.js";import{I as xe}from"./input-PH_B9jsb.js";import{S as Gt,a as qt,b as Qt,c as Jt,d as Ce}from"./select-IzFKXHyx.js";import{T as Yt}from"./textarea-DclpUcWC.js";import{a as Zt,b as en}from"./use-connection-DE-37ZRw.js";import{u as ot,a as tn}from"./constants-xmw1fMHh.js";import{b as nn}from"./use-mcp-tools-NDarjnlp.js";import{b as sn}from"./use-virtual-mcp-BzckzJP9.js";import{n as on}from"./ArrowDown-CaOFq6pQ.js";import{i as rn}from"./ArrowUp-CQq_iQrI.js";import{t as cn}from"./ChevronDown-C60hOPCP.js";import{n as he}from"./Container-B8DmhgZQ.js";import{i as We}from"./DotsVertical-feXQsLpQ.js";import{s as Ge}from"./Eye-CCXNKQ3i.js";import{s as Ee}from"./Globe02-BHELIlHY.js";import{i as ln}from"./Loading01-CjjE3eBW.js";import{s as an}from"./Plus-4XunsH-w.js";import{i as dn}from"./Terminal-75WYHlkp.js";import{s as Ie}from"./Trash01-DGY6Zmte.js";import{s as dt}from"./XClose-DUBNCpe4.js";import{f as _e}from"./format-time-CMKyl-GC.js";import{r as mn,E as un,e as mt}from"./env-vars-editor-B-9hU7y3.js";import"./Check-BvMJM-Sw.js";import"./Grid01-DBuyZdtC.js";import"./List-B76tHO2m.js";import"./tooltip-BH1aeIjU.js";import"./index-CR1W-IZC.js";import"./SearchMd-C_1lW0Ah.js";import"./card-Clok3lmK.js";import"./AlertCircle-DNgqx8KI.js";import"./CheckCircle-NPrGj804.js";import"./localstorage-keys-Dd8wt3F6.js";import"./useQuery-B4nMPmUe.js";import"./useMutation-CD3w4aw8.js";import"./avatar-DR86yZfU.js";import"./binder-CFsqRWyE.js";import"./use-view-mode-CbCZ336B.js";import"./use-mobile-K667MH2e.js";import"./ChevronRight-Sru8EpEz.js";import"./X-DID3bf3T.js";import"./label-CZMyG7OM.js";import"./use-collections-6zQXOG_F.js";import"./differenceInSeconds-NQ4PDo0z.js";function it(o){return o.title.trim().replace(/\s+\(\d+\)$/,"")}function pn(o){const e=new Map;for(const l of o){if(l.connection_type==="VIRTUAL")continue;const u=it(l),r=e.get(u);r?r.push(l):e.set(u,[l])}const n=[],c=new Set;for(const l of o){if(l.connection_type==="VIRTUAL")continue;const u=it(l);if(c.has(u))continue;c.add(u);const r=e.get(u),h=r[0];r.length===1?n.push({type:"single",connection:h}):n.push({type:"group",key:u,icon:h.icon,title:h.app_name?h.title.replace(/\s*\(\d+\)\s*$/,""):h.title,connections:r})}return n}function ut(o){const e=new Set,n=[];for(const c of o)c.created_by&&!e.has(c.created_by)&&(e.add(c.created_by),n.push(c.created_by));return n}function xn(o){let e=0,n=0,c=0;for(const l of o)l.connection_type!=="VIRTUAL"&&(l.status==="active"?e++:l.status==="error"?c++:n++);return{active:e,inactive:n,error:c,total:e+n+c}}const hn=ct({key:Y(),value:Y()}),fn=ct({title:Y().min(1,"Name is required"),description:Y().nullable().optional(),icon:Y().nullable().optional(),ui_type:It(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:Y().optional(),connection_token:Y().nullable().optional(),npx_package:Y().optional(),stdio_command:Y().optional(),stdio_args:Y().optional(),stdio_cwd:Y().optional(),env_vars:Dt(hn).optional()}).refine(o=>o.ui_type==="NPX"?!!o.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(o=>o.ui_type==="STDIO"?!!o.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(o=>o.ui_type==="HTTP"||o.ui_type==="SSE"||o.ui_type==="Websocket"?!!o.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function Pe(o){const e=o.trim();if(!e)return"";try{const n=new URL(e),c=n.pathname.length>1?n.pathname.replace(/\/+$/,""):n.pathname;return`${n.origin}${c}`}catch{return e.replace(/\/+$/,"")}}function gn(o){const e=o.trim().split(/\s+/).filter(Boolean);if(e.length<2)return null;const n=e[0]?.toLowerCase();if(n!=="npx"&&n!=="bunx")return null;const l=e.slice(1).find(u=>!u.startsWith("-"));return l?{packageName:l}:null}function Se(o){const{uiType:e}=o,n=Pe(o.connectionUrl??"");if((e==="HTTP"||e==="SSE"||e==="Websocket")&&n===Pe("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 c=(o.npxPackage??"").trim();return e==="NPX"&&c==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function rt(o){if(o.registryItems.length===0||o.uiType!=="HTTP"&&o.uiType!=="SSE"&&o.uiType!=="Websocket")return null;const e=Pe(o.connectionUrl??"");if(!e)return null;const n=o.registryItems.find(u=>(u.server?.remotes??[]).some(h=>Pe(h.url??"")===e));if(!n)return null;const c=n.title||n.name||n.server?.title||n.server?.name||"",l=n.server?.description||n.description||n.summary||null;return c?{id:"registry",title:c,description:l}:null}function jn(o,e){const n={command:"npx",args:["-y",o]},c=mt(e);return Object.keys(c).length>0&&(n.envVars=c),n}function yn(o,e,n,c){const l={command:o};e.trim()&&(l.args=e.trim().split(/\s+/)),n?.trim()&&(l.cwd=n.trim());const u=mt(c);return Object.keys(u).length>0&&(l.envVars=u),l}function vn(o){return o.command==="npx"}function Cn(o){return o.args?.find(e=>!e.startsWith("-"))??""}function Nn(o){return{command:o.command,args:o.args?.join(" ")??"",cwd:o.cwd??""}}function bn(o,e){switch(e.type){case"edit":return{mode:"editing",connection:e.connection};case"delete":return{mode:"deleting",connection:e.connection};case"force-delete":return{mode:"force-deleting",connection:e.connection,agentNames:e.agentNames};case"close":return{mode:"idle"}}}function _n(o){const e=ge.c(107),{group:n,onNavigate:c,onDelete:l,selectionMode:u,selectedIds:r,onToggleSelect:h}=o,[C,d]=H.useState(!1);let f;if(e[0]!==n.connections||e[1]!==r){let $;e[3]!==r?($=E=>r.has(E.id),e[3]=r,e[4]=$):$=e[4],f=n.connections.every($),e[0]=n.connections,e[1]=r,e[2]=f}else f=e[2];const p=f;let T;if(e[5]!==n.connections||e[6]!==r){let $;e[8]!==r?($=E=>r.has(E.id),e[8]=r,e[9]=$):$=e[9],T=n.connections.some($),e[5]=n.connections,e[6]=r,e[7]=T}else T=e[7];const x=T;let j,y,w,_,N,I,A,z,U,b,k;if(e[10]!==p||e[11]!==n.connections||e[12]!==n.icon||e[13]!==n.title||e[14]!==h||e[15]!==r||e[16]!==u||e[17]!==x){const $=ut(n.connections),E=n.connections.reduce(Tn,n.connections[0]),de=E.updated_at??E.created_at;j=lt;const D=`${n.connections.length} instances`;e[29]!==n.icon||e[30]!==n.title||e[31]!==D?(U={title:n.title,icon:n.icon,description:D},e[29]=n.icon,e[30]=n.title,e[31]=D,e[32]=U):U=e[32],e[33]!==p||e[34]!==n.connections||e[35]!==h||e[36]!==r||e[37]!==u?(b=()=>u?(()=>{for(const R of n.connections)p?r.has(R.id)&&h(R.id):r.has(R.id)||h(R.id)})():d(!0),e[33]=p,e[34]=n.connections,e[35]=h,e[36]=r,e[37]=u,e[38]=b):b=e[38];const le=u&&p&&"ring-2 ring-primary",me=u&&x&&!p&&"ring-1 ring-primary/50";e[39]!==le||e[40]!==me?(k=oe(le,me),e[39]=le,e[40]=me,e[41]=k):k=e[41],e[42]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(he,{}),e[42]=y):y=e[42],e[43]!==p||e[44]!==n.connections||e[45]!==h||e[46]!==r||e[47]!==u||e[48]!==x?(w=u?t.jsx(De,{checked:p?!0:x?"indeterminate":!1,onCheckedChange:()=>{for(const R of n.connections)p?r.has(R.id)&&h(R.id):r.has(R.id)||h(R.id)}}):t.jsxs(Re,{variant:"secondary",className:"text-xs tabular-nums",children:["x",n.connections.length]}),e[43]=p,e[44]=n.connections,e[45]=h,e[46]=r,e[47]=u,e[48]=x,e[49]=w):w=e[49];let ue;e[50]!==n.connections?(ue=n.connections.slice(0,6).map(Sn),e[50]=n.connections,e[51]=ue):ue=e[51],e[52]!==ue?(_=t.jsx("div",{className:"flex items-center gap-1",children:ue}),e[52]=ue,e[53]=_):_=e[53],A="flex items-center justify-between text-xs text-muted-foreground w-full min-w-0";const je=$.map(R=>t.jsx(be,{id:R,size:"3xs",avatarOnly:$.length>1},R));e[54]!==je?(z=t.jsx("div",{className:"flex items-center -space-x-1.5",children:je}),e[54]=je,e[55]=z):z=e[55],N="shrink-0 ml-2",I=de?_e(new Date(de)):"—",e[10]=p,e[11]=n.connections,e[12]=n.icon,e[13]=n.title,e[14]=h,e[15]=r,e[16]=u,e[17]=x,e[18]=j,e[19]=y,e[20]=w,e[21]=_,e[22]=N,e[23]=I,e[24]=A,e[25]=z,e[26]=U,e[27]=b,e[28]=k}else j=e[18],y=e[19],w=e[20],_=e[21],N=e[22],I=e[23],A=e[24],z=e[25],U=e[26],b=e[27],k=e[28];let v;e[56]!==N||e[57]!==I?(v=t.jsx("span",{className:N,children:I}),e[56]=N,e[57]=I,e[58]=v):v=e[58];let M;e[59]!==v||e[60]!==A||e[61]!==z?(M=t.jsxs("div",{className:A,children:[z,v]}),e[59]=v,e[60]=A,e[61]=z,e[62]=M):M=e[62];let V;e[63]!==j||e[64]!==y||e[65]!==w||e[66]!==_||e[67]!==M||e[68]!==U||e[69]!==b||e[70]!==k?(V=t.jsx(j,{connection:U,onClick:b,className:k,fallbackIcon:y,headerActions:w,body:_,footer:M}),e[63]=j,e[64]=y,e[65]=w,e[66]=_,e[67]=M,e[68]=U,e[69]=b,e[70]=k,e[71]=V):V=e[71];let X;e[72]===Symbol.for("react.memo_cache_sentinel")?(X=t.jsx(he,{}),e[72]=X):X=e[72];let K;e[73]!==n.icon||e[74]!==n.title?(K=t.jsx(Ne,{icon:n.icon,name:n.title,size:"md",className:"shrink-0 shadow-sm",fallbackIcon:X}),e[73]=n.icon,e[74]=n.title,e[75]=K):K=e[75];let W;e[76]!==n.connections.length?(W=t.jsxs(Re,{variant:"secondary",className:"ml-2 text-xs tabular-nums",children:["x",n.connections.length]}),e[76]=n.connections.length,e[77]=W):W=e[77];let g;e[78]!==n.title||e[79]!==W?(g=t.jsxs(Ye,{children:[n.title,W]}),e[78]=n.title,e[79]=W,e[80]=g):g=e[80];let S;e[81]!==n.connections.length?(S=t.jsxs(Ze,{children:[n.connections.length," installed instances"]}),e[81]=n.connections.length,e[82]=S):S=e[82];let L;e[83]!==g||e[84]!==S?(L=t.jsxs("div",{children:[g,S]}),e[83]=g,e[84]=S,e[85]=L):L=e[85];let ie;e[86]!==K||e[87]!==L?(ie=t.jsx(Je,{className:"px-6 pt-6 pb-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[K,L]})}),e[86]=K,e[87]=L,e[88]=ie):ie=e[88];let re;if(e[89]!==n.connections||e[90]!==l||e[91]!==c){let $;e[93]!==l||e[94]!==c?($=E=>t.jsxs("div",{className:"flex items-center gap-3 px-6 py-3 hover:bg-muted/30 cursor-pointer transition-colors",onClick:()=>{d(!1),c(E.id)},children:[t.jsx(Ne,{icon:E.icon,name:E.title,size:"sm",className:"shrink-0",fallbackIcon:t.jsx(he,{})}),t.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:E.title}),t.jsx(Te,{status:E.status})]}),t.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground shrink-0",children:[t.jsx(be,{id:E.created_by,size:"3xs"}),t.jsx("span",{children:E.created_at?_e(new Date(E.created_at)):"—"})]}),t.jsxs(He,{children:[t.jsx(Xe,{asChild:!0,children:t.jsx(O,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:wn,children:t.jsx(We,{size:16})})}),t.jsxs(Ke,{align:"end",onClick:kn,children:[t.jsxs(fe,{onClick:()=>{d(!1),c(E.id)},children:[t.jsx(Ge,{size:16}),"Open"]}),t.jsxs(fe,{variant:"destructive",onClick:()=>l(E),children:[t.jsx(Ie,{size:16}),"Delete"]})]})]})]},E.id),e[93]=l,e[94]=c,e[95]=$):$=e[95],re=n.connections.map($),e[89]=n.connections,e[90]=l,e[91]=c,e[92]=re}else re=e[92];let ae;e[96]!==re?(ae=t.jsx("div",{className:"divide-y max-h-80 overflow-auto",children:re}),e[96]=re,e[97]=ae):ae=e[97];let ce;e[98]!==ie||e[99]!==ae?(ce=t.jsxs(Qe,{className:"sm:max-w-lg p-0 gap-0",children:[ie,ae]}),e[98]=ie,e[99]=ae,e[100]=ce):ce=e[100];let m;e[101]!==C||e[102]!==ce?(m=t.jsx(qe,{open:C,onOpenChange:d,children:ce}),e[101]=C,e[102]=ce,e[103]=m):m=e[103];let F;return e[104]!==V||e[105]!==m?(F=t.jsxs(t.Fragment,{children:[V,m]}),e[104]=V,e[105]=m,e[106]=F):F=e[106],F}function kn(o){return o.stopPropagation()}function wn(o){return o.stopPropagation()}function Sn(o){return t.jsx(Te,{status:o.status},o.id)}function Tn(o,e){const n=e.updated_at??e.created_at,c=o.updated_at??o.created_at;return n?c?new Date(n)>new Date(c)?e:o:e:o}function Dn(o){const e=ge.c(28),{count:n,total:c,onSelectAll:l,onDeselectAll:u,onDelete:r,onAddToAgent:h,onToggleStatus:C,onCancel:d}=o;if(n===0)return null;let f;e[0]!==n?(f=t.jsxs("div",{className:"text-xs text-muted-foreground pr-1 tabular-nums",children:[n," selected"]}),e[0]=n,e[1]=f):f=e[1];let p;e[2]!==n||e[3]!==u||e[4]!==l||e[5]!==c?(p=n<c?t.jsxs(O,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:l,children:["Select all (",c,")"]}):t.jsx(O,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:u,children:"Clear selection"}),e[2]=n,e[3]=u,e[4]=l,e[5]=c,e[6]=p):p=e[6];let T;e[7]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx(an,{size:13}),e[7]=T):T=e[7];let x;e[8]!==h?(x=t.jsxs(O,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:h,children:[T,"Add to Agent"]}),e[8]=h,e[9]=x):x=e[9];let j;e[10]!==C?(j=t.jsx(O,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>C("active"),children:"Enable"}),e[10]=C,e[11]=j):j=e[11];let y;e[12]!==C?(y=t.jsx(O,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>C("inactive"),children:"Disable"}),e[12]=C,e[13]=y):y=e[13];let w;e[14]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(Ie,{size:13}),e[14]=w):w=e[14];let _;e[15]!==r?(_=t.jsxs(O,{variant:"destructive",size:"sm",className:"h-7 text-xs px-2",onClick:r,children:[w,"Delete"]}),e[15]=r,e[16]=_):_=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(dt,{size:13}),e[17]=N):N=e[17];let I;e[18]!==d?(I=t.jsx(O,{variant:"ghost",size:"sm",className:"h-7 text-xs px-2",onClick:d,children:N}),e[18]=d,e[19]=I):I=e[19];let A;return e[20]!==f||e[21]!==I||e[22]!==p||e[23]!==x||e[24]!==j||e[25]!==y||e[26]!==_?(A=t.jsx("div",{className:"fixed bottom-4 left-1/2 z-50 -translate-x-1/2",children:t.jsxs("div",{className:"rounded-xl border border-border bg-background/95 shadow-lg backdrop-blur px-3 py-2 flex items-center gap-2",children:[f,p,x,j,y,_,I]})}),e[20]=f,e[21]=I,e[22]=p,e[23]=x,e[24]=j,e[25]=y,e[26]=_,e[27]=A):A=e[27],A}function In(o){const e=ge.c(25),{open:n,onOpenChange:c,agents:l,onConfirm:u}=o,[r,h]=H.useState(null);let C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsxs(Je,{children:[t.jsx(Ye,{children:"Add to Agent"}),t.jsx(Ze,{children:"Select an agent to add the selected connections to."})]}),e[0]=C):C=e[0];let d;e[1]!==l||e[2]!==r?(d=l.length===0?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No agents found"}):l.map(N=>t.jsxs("button",{type:"button",onClick:()=>h(N.id),className:oe("flex items-center gap-3 w-full rounded-md px-3 py-2 text-left transition-colors",r===N.id?"bg-primary/10 ring-1 ring-primary":"hover:bg-muted/50"),children:[t.jsx(Ne,{icon:N.icon,name:N.title,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:N.title}),N.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:N.description})]})]},N.id)),e[1]=l,e[2]=r,e[3]=d):d=e[3];let f;e[4]!==d?(f=t.jsx("div",{className:"max-h-60 overflow-auto py-2 space-y-1",children:d}),e[4]=d,e[5]=f):f=e[5];let p;e[6]!==c?(p=t.jsx(O,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e[6]=c,e[7]=p):p=e[7];const T=!r;let x;e[8]!==u||e[9]!==c||e[10]!==r?(x=()=>{r&&(u(r),c(!1),h(null))},e[8]=u,e[9]=c,e[10]=r,e[11]=x):x=e[11];let j;e[12]!==T||e[13]!==x?(j=t.jsx(O,{disabled:T,onClick:x,children:"Add"}),e[12]=T,e[13]=x,e[14]=j):j=e[14];let y;e[15]!==p||e[16]!==j?(y=t.jsxs(at,{children:[p,j]}),e[15]=p,e[16]=j,e[17]=y):y=e[17];let w;e[18]!==f||e[19]!==y?(w=t.jsxs(Qe,{className:"sm:max-w-[400px]",children:[C,f,y]}),e[18]=f,e[19]=y,e[20]=w):w=e[20];let _;return e[21]!==c||e[22]!==n||e[23]!==w?(_=t.jsx(qe,{open:n,onOpenChange:c,children:w}),e[21]=c,e[22]=n,e[23]=w,e[24]=_):_=e[24],_}function Pn(o){const e=ge.c(20),{open:n,onOpenChange:c,count:l,onConfirm:u}=o,r=l!==1?"s":"";let h;e[0]!==l||e[1]!==r?(h=t.jsxs(Ve,{children:["Delete ",l," connection",r,"?"]}),e[0]=l,e[1]=r,e[2]=h):h=e[2];const C=l!==1?"s":"";let d;e[3]!==C?(d=t.jsxs(Fe,{children:["This will permanently delete the selected connection",C,". This action cannot be undone."]}),e[3]=C,e[4]=d):d=e[4];let f;e[5]!==h||e[6]!==d?(f=t.jsxs(Le,{children:[h,d]}),e[5]=h,e[6]=d,e[7]=f):f=e[7];let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Ue,{children:"Cancel"}),e[8]=p):p=e[8];const T=l!==1?"s":"";let x;e[9]!==l||e[10]!==u||e[11]!==T?(x=t.jsxs(Be,{children:[p,t.jsxs(Me,{onClick:u,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:["Delete ",l," connection",T]})]}),e[9]=l,e[10]=u,e[11]=T,e[12]=x):x=e[12];let j;e[13]!==f||e[14]!==x?(j=t.jsxs(ze,{children:[f,x]}),e[13]=f,e[14]=x,e[15]=j):j=e[15];let y;return e[16]!==c||e[17]!==n||e[18]!==j?(y=t.jsx(Oe,{open:n,onOpenChange:c,children:j}),e[16]=c,e[17]=n,e[18]=j,e[19]=y):y=e[19],y}function An(o){const e=ge.c(37),{columns:n,grouped:c,sortKey:l,sortDirection:u,onSort:r,onRowClick:h,selectionMode:C,selectedIds:d,onToggleSelect:f,emptyState:p}=o;let T;e[0]===Symbol.for("react.memo_cache_sentinel")?(T=new Set,e[0]=T):T=e[0];const[x,j]=H.useState(T);let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=b=>{j(k=>{const v=new Set(k);return v.has(b)?v.delete(b):v.add(b),v})},e[1]=y):y=e[1];const w=y;if(c.length===0&&p){let b;return e[2]!==p?(b=t.jsx("div",{className:"flex items-center justify-center h-full",children:p}),e[2]=p,e[3]=b):b=e[3],b}const _=n.length;let N;if(e[4]!==_||e[5]!==n||e[6]!==r||e[7]!==u||e[8]!==l){let b;e[10]!==_||e[11]!==r||e[12]!==u||e[13]!==l?(b=(k,v)=>{const M=l===k.id,V=v===_-1;return t.jsx(Et,{className:oe("px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider",V&&"w-8","group transition-colors select-none",k.sortable&&"hover:bg-accent cursor-pointer",k.cellClassName),onClick:k.sortable&&r?()=>r(k.id):void 0,children:t.jsxs("span",{className:"flex items-center gap-1",children:[k.header,k.sortable&&t.jsx("span",{className:"w-4 flex items-center justify-center",children:M&&u&&(u==="asc"?t.jsx(rn,{size:16,className:"text-muted-foreground"}):t.jsx(on,{size:16,className:"text-muted-foreground"}))})]})},k.id)},e[10]=_,e[11]=r,e[12]=u,e[13]=l,e[14]=b):b=e[14],N=n.map(b),e[4]=_,e[5]=n,e[6]=r,e[7]=u,e[8]=l,e[9]=N}else N=e[9];let I;e[15]!==N?(I=t.jsx(Ot,{className:"border-b-0",children:t.jsx(we,{className:"h-9 hover:bg-transparent border-b border-border",children:N})}),e[15]=N,e[16]=I):I=e[16];let A;if(e[17]!==n||e[18]!==x||e[19]!==c||e[20]!==h||e[21]!==f||e[22]!==d||e[23]!==C){let b;e[25]!==n||e[26]!==x||e[27]!==h||e[28]!==f||e[29]!==d||e[30]!==C?(b=k=>{if(k.type==="single"){const g=k.connection;return t.jsx(we,{className:oe("group/data-row transition-colors border-b-0 hover:bg-accent/50 cursor-pointer",C&&d.has(g.id)&&"bg-primary/5"),onClick:()=>h(g),children:n.map(S=>t.jsx(pe,{className:oe("px-5 py-4 h-16 align-middle text-sm text-foreground",S.cellClassName),children:t.jsx("div",{className:"min-w-0 w-full truncate overflow-hidden whitespace-nowrap",children:S.render?S.render(g):null})},S.id))},g.id)}const v=k,M=x.has(v.key),V=v.connections.every(g=>d.has(g.id)),X=v.connections.some(g=>d.has(g.id)),K=ut(v.connections),W=v.connections.reduce(En,v.connections[0]);return t.jsxs(H.Fragment,{children:[t.jsx(we,{className:"border-b-0 hover:bg-accent/50 cursor-pointer transition-colors",onClick:()=>w(v.key),children:n.map(g=>{const S=oe("px-5 py-3 h-14 align-middle text-sm",g.cellClassName);if(g.id==="select")return t.jsx(pe,{className:S,children:t.jsx(De,{checked:V?!0:X?"indeterminate":!1,onCheckedChange:()=>{for(const L of v.connections)V?d.has(L.id)&&f(L.id):d.has(L.id)||f(L.id)},onClick:$n})},g.id);if(g.id==="title")return t.jsx(pe,{className:S,children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx(Ne,{icon:v.icon,name:v.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:t.jsx(he,{})}),t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:v.title}),t.jsxs(Re,{variant:"secondary",className:"text-xs tabular-nums",children:["x",v.connections.length]})]})},g.id);if(g.id==="updated_by")return t.jsx(pe,{className:S,children:t.jsx("div",{className:"flex items-center -space-x-1.5",children:K.map(L=>t.jsx(be,{id:L,size:"3xs",avatarOnly:K.length>1},L))})},g.id);if(g.id==="updated_at"){const L=W.updated_at??W.created_at;return t.jsx(pe,{className:S,children:t.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:L?_e(new Date(L)):"—"})},g.id)}return g.id==="actions"?t.jsx(pe,{className:S,children:t.jsx(cn,{size:16,className:oe("text-muted-foreground transition-transform",M&&"rotate-180")})},g.id):t.jsx(pe,{className:S},g.id)})}),M&&v.connections.map(g=>t.jsx(we,{className:oe("group/data-row transition-colors border-b-0 hover:bg-accent/50 cursor-pointer bg-muted/20",C&&d.has(g.id)&&"bg-primary/5"),onClick:()=>h(g),children:n.map(S=>t.jsx(pe,{className:oe("px-5 py-3 h-14 align-middle text-sm text-foreground",S.cellClassName,S.id==="title"&&"pl-12"),children:t.jsx("div",{className:"min-w-0 w-full truncate overflow-hidden whitespace-nowrap",children:S.render?S.render(g):null})},S.id))},g.id))]},v.key)},e[25]=n,e[26]=x,e[27]=h,e[28]=f,e[29]=d,e[30]=C,e[31]=b):b=e[31],A=c.map(b),e[17]=n,e[18]=x,e[19]=c,e[20]=h,e[21]=f,e[22]=d,e[23]=C,e[24]=A}else A=e[24];let z;e[32]!==A?(z=t.jsx(zt,{children:A}),e[32]=A,e[33]=z):z=e[33];let U;return e[34]!==I||e[35]!==z?(U=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs(Lt,{className:"w-full border-collapse",children:[I,z]})}),e[34]=I,e[35]=z,e[36]=U):U=e[36],U}function $n(o){return o.stopPropagation()}function En(o,e){const n=e.updated_at??e.created_at,c=o.updated_at??o.created_at;return n?c?new Date(n)>new Date(c)?e:o:e:o}function On(){const{org:o}=vt(),e=Ct(),n=Nt(),c=bt({strict:!1}),{data:l}=_t.useSession(),{stdioEnabled:u}=kt(),r=Bt({namespace:o.slug,resource:"connections"}),h=Zt(),C=en(r),[d,f]=H.useReducer(bn,{mode:"idle"}),[p,T]=H.useState(!1),[x,j]=H.useState(new Set),[y,w]=H.useState(!1),[_,N]=H.useState(!1),[I,A]=H.useState("ALL"),[z,U]=H.useState("ALL"),b=sn(),k=C.filter(s=>!(s.connection_type==="VIRTUAL"||I!=="ALL"&&s.connection_type!==I||z!=="ALL"&&s.status!==z)),v=xn(C),M=pn(k),V=s=>{j(i=>{const a=new Set(i);return a.has(s)?a.delete(s):a.add(s),a})},X=()=>{T(!1),j(new Set)},K=Ft(C)[0],W=K?.id??"",g=Ut(K?.tools),S=ot({connectionId:W||null,orgId:o.id}),{data:L}=nn({client:S,toolName:g,toolArguments:{limit:200},enabled:!!(W&&g),staleTime:3600*1e3,select:s=>s.structuredContent??s}),ie=Mt(L??[]),re=c.action==="create",ae=()=>{n({to:"/$org/$project/mcps",params:{org:o.slug,project:Q},search:{action:"create"}})},ce=()=>{n({to:"/$org/$project/mcps",params:{org:o.slug,project:Q},search:{}})},m=wt({resolver:St(fn),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),F=m.watch("ui_type"),$=m.watch("connection_url"),E=m.watch("npx_package"),de=Se({uiType:F,connectionUrl:$??"",npxPackage:E??""})??rt({uiType:F,connectionUrl:$??"",registryItems:ie}),D=d.mode==="editing"?d.connection:null;H.useEffect(()=>{if(D){const s=Tt(D.connection_headers)?D.connection_headers:null;if(s&&D.connection_type==="STDIO"){const i=mn(s.envVars);if(vn(s)){const a=Cn(s);m.reset({title:D.title,description:D.description,icon:D.icon??null,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:a,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:i})}else{const a=Nn(s);m.reset({title:D.title,description:D.description,icon:D.icon??null,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})}}else m.reset({title:D.title,description:D.description,icon:D.icon??null,ui_type:D.connection_type,connection_url:D.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})}else m.reset({title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})},[D,m]);const le=ot({connectionId:tn,orgId:o.id}),me=()=>{e.invalidateQueries({predicate:s=>{const i=s.queryKey;return i[1]===o.id&&i[3]==="collection"&&i[4]==="CONNECTIONS"}})},ue=async()=>{w(!1);const s=[...x];let i=0;for(const a of s)try{(await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:a,force:!0}})).isError||i++}catch{}me(),J.success(`Deleted ${i} connection${i!==1?"s":""}`),X()},je=async s=>{const i=[...x];let a=0;for(const B of i)try{await h.update.mutateAsync({id:B,data:{status:s}}),a++}catch{}me(),J.success(`${s==="active"?"Enabled":"Disabled"} ${a} connection${a!==1?"s":""}`),X()},R=async s=>{const i=b.find(P=>P.id===s);if(!i||!le)return;const a=new Set(i.connections.map(P=>P.connection_id)),B=[...x].filter(P=>!a.has(P)).map(P=>({connection_id:P,selected_tools:null,selected_resources:null,selected_prompts:null}));if(B.length===0){J.info("All selected connections are already in that agent");return}try{await le.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:s,data:{connections:[...i.connections,...B]}}}),e.invalidateQueries({predicate:P=>{const G=P.queryKey;return G[1]===o.id&&G[3]==="collection"&&G[4]==="VIRTUAL_MCP"}}),J.success(`Added ${B.length} connection${B.length!==1?"s":""} to "${i.title}"`),X()}catch{J.error("Failed to add connections to agent")}},et=s=>{const i=s.content;return Array.isArray(i)&&i[0]?.type==="text"&&typeof i[0].text=="string"?i[0].text:"Unknown error"},pt=async()=>{if(d.mode!=="deleting")return;const s=d.connection;f({type:"close"});try{const i=await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:s.id}});if(i.isError){const a=et(i),B=a.replace(/^Error:\s*/,"");try{const P=JSON.parse(B);if(P.code==="CONNECTION_IN_USE"&&P.agentNames){f({type:"force-delete",connection:s,agentNames:P.agentNames.map(G=>`"${G}"`).join(", ")});return}}catch{}J.error(`Failed to delete connection: ${a}`);return}me(),J.success("Connection deleted successfully")}catch(i){const a=i instanceof Error?i.message:String(i);J.error(`Failed to delete connection: ${a}`)}},xt=async()=>{if(d.mode!=="force-deleting")return;const s=d.connection.id;f({type:"close"});try{const i=await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:s,force:!0}});if(i.isError){J.error(`Failed to delete connection: ${et(i)}`);return}me(),J.success("Connection deleted successfully")}catch(i){const a=i instanceof Error?i.message:String(i);J.error(`Failed to delete connection: ${a}`)}},ht=async s=>{let i,a=null,B=null,P=null;if(s.ui_type==="NPX"?(i="STDIO",a="",P=jn(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(i="STDIO",a="",P=yn(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(i=s.ui_type,a=s.connection_url||"",B=s.connection_token||null),D){await h.update.mutateAsync({id:D.id,data:{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:i,connection_url:a,...B&&{connection_token:B},...P&&{connection_headers:P}}}),f({type:"close"}),m.reset();return}const G=Pt("conn");await h.create.mutateAsync({id:G,title:s.title,description:s.description||null,connection_type:i,connection_url:a,connection_token:B,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:l?.user?.id||"system",organization_id:o.id,icon:s.icon??null,app_name:null,app_id:null,connection_headers:P,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),ce(),m.reset(),n({to:"/$org/$project/mcps/$connectionId",params:{org:o.slug,project:Q,connectionId:G}})},tt=s=>{s||(re?ce():f({type:"close"}),m.reset())},ke=s=>{const i=s.trim();if(!i)return;const a=!!m.formState.dirtyFields.title,B=!!m.formState.dirtyFields.description,P=!!m.formState.dirtyFields.env_vars,G=q=>{if(q&&(!a&&!m.getValues("title").trim()&&q.title&&m.setValue("title",q.title,{shouldDirty:!1}),!B&&!(m.getValues("description")??"").trim()&&q.description&&m.setValue("description",q.description,{shouldDirty:!1}),!P&&q.envVarKeys?.length)){const nt=m.getValues("env_vars")??[],jt=new Set(nt.map(ye=>ye.key)),st=q.envVarKeys.filter(ye=>!jt.has(ye));st.length>0&&m.setValue("env_vars",[...nt,...st.map(ye=>({key:ye,value:""}))],{shouldDirty:!0})}},Ae=gn(i);if(Ae&&u){m.setValue("ui_type","NPX",{shouldDirty:!0}),m.setValue("npx_package",Ae.packageName,{shouldDirty:!0}),m.setValue("connection_url","",{shouldDirty:!0}),m.setValue("connection_token",null,{shouldDirty:!0}),G(Se({uiType:"NPX",npxPackage:Ae.packageName}));return}if(i.startsWith("http://")||i.startsWith("https://")){const q=F==="HTTP"||F==="SSE"||F==="Websocket"?F:"HTTP";m.setValue("ui_type",q,{shouldDirty:!0}),m.setValue("connection_url",i,{shouldDirty:!0}),G(Se({uiType:q,connectionUrl:i})??rt({uiType:q,connectionUrl:i,registryItems:ie}));return}F==="NPX"&&G(Se({uiType:"NPX",npxPackage:i}))},ft=[...p?[{id:"select",header:"",render:s=>t.jsx(De,{checked:x.has(s.id),onCheckedChange:()=>V(s.id),onClick:i=>i.stopPropagation()}),cellClassName:"w-10 shrink-0"}]:[],{id:"title",header:"Name",render:s=>t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx(Ne,{icon:s.icon,name:s.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:t.jsx(he,{})}),t.jsx("span",{className:"text-sm font-medium text-foreground truncate block",title:s.title,children:s.title})]}),cellClassName:"w-32 min-w-0 shrink-0",sortable:!0},{id:"description",header:"Description",render:s=>t.jsx("span",{className:"text-sm text-muted-foreground truncate block",title:s.description||"",children:s.description||"—"}),cellClassName:"flex-1 min-w-0 max-w-0",wrap:!1,sortable:!0},{id:"connection_type",header:"Type",accessor:s=>t.jsx("span",{className:"text-xs font-medium",children:s.connection_type}),cellClassName:"w-16 shrink-0",sortable:!0},{id:"status",header:"Status",render:s=>t.jsx(Te,{status:s.status}),cellClassName:"w-28 shrink-0",sortable:!1},{id:"updated_by",header:"Updated by",render:s=>t.jsx(be,{id:s.updated_by??s.created_by,size:"3xs"}),cellClassName:"w-32 shrink-0",sortable:!0},{id:"updated_at",header:"Updated",render:s=>t.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:s.updated_at?_e(new Date(s.updated_at)):"—"}),cellClassName:"max-w-24 w-24 shrink-0",sortable:!0},{id:"actions",header:"",render:s=>t.jsxs(He,{children:[t.jsx(Xe,{asChild:!0,children:t.jsx(O,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:i=>i.stopPropagation(),children:t.jsx(We,{size:20})})}),t.jsxs(Ke,{align:"end",onClick:i=>i.stopPropagation(),children:[t.jsxs(fe,{onClick:i=>{i.stopPropagation(),n({to:"/$org/$project/mcps/$connectionId",params:{org:o.slug,project:Q,connectionId:s.id}})},children:[t.jsx(Ge,{size:16}),"Open"]}),t.jsxs(fe,{variant:"destructive",onClick:i=>{i.stopPropagation(),f({type:"delete",connection:s})},children:[t.jsx(Ie,{size:16}),"Delete"]})]})]}),cellClassName:"w-12 shrink-0"}],gt=t.jsx("div",{className:"flex items-center gap-2",children:p?t.jsxs(O,{variant:"ghost",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",onClick:X,children:[t.jsx(dt,{size:14}),"Cancel"]}):t.jsxs(t.Fragment,{children:[t.jsxs(O,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",onClick:()=>T(!0),children:[t.jsx(Vt,{size:14}),"Select"]}),t.jsx(O,{variant:"outline",onClick:()=>n({to:"/$org/$project/store",params:{org:o.slug,project:Q}}),size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Browse Store"}),t.jsx(O,{onClick:ae,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Custom Connection"})]})});return t.jsxs(ve,{children:[t.jsx(qe,{open:re||d.mode==="editing",onOpenChange:tt,children:t.jsxs(Qe,{className:"sm:max-w-[525px]",children:[t.jsxs(Je,{children:[t.jsx(Ye,{children:D?"Edit Connection":"Create Connection"}),t.jsx(Ze,{children:D?"Update the connection details below.":"Create a custom connection in your organization. Fill in the details below."})]}),t.jsx(Wt,{...m,children:t.jsxs("form",{onSubmit:m.handleSubmit(ht),children:[t.jsxs("div",{className:"grid gap-4 py-4",children:[t.jsx(Z,{control:m.control,name:"ui_type",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"Type *"}),t.jsxs(Gt,{value:s.value,onValueChange:s.onChange,children:[t.jsx(ne,{children:t.jsx(qt,{children:t.jsx(Qt,{})})}),t.jsxs(Jt,{children:[t.jsx(Ce,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ee,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(Ce,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ee,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(Ce,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ee,{className:"w-4 h-4"}),"Websocket"]})}),u&&t.jsxs(t.Fragment,{children:[t.jsx(Ce,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(he,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(Ce,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(dn,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(se,{})]})}),F==="NPX"&&t.jsx(t.Fragment,{children:t.jsx(Z,{control:m.control,name:"npx_package",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"NPM Package *"}),t.jsx(ne,{children:t.jsx(xe,{placeholder:"@perplexity-ai/mcp-server",...s,value:s.value??"",onPaste:i=>{const a=i.clipboardData.getData("text");a&&(i.preventDefault(),m.setValue("npx_package",a.trim(),{shouldDirty:!0}),ke(a))},onBlur:i=>{ke(i.target.value),s.onBlur()}})}),t.jsx(se,{})]})})}),F==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(Z,{control:m.control,name:"stdio_command",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"Command *"}),t.jsx(ne,{children:t.jsx(xe,{placeholder:"node, bun, python...",...s,value:s.value??""})}),t.jsx(se,{})]})}),t.jsx(Z,{control:m.control,name:"stdio_args",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"Arguments"}),t.jsx(ne,{children:t.jsx(xe,{placeholder:"arg1 arg2 --flag value",...s,value:s.value??""})}),t.jsx(se,{})]})})]}),t.jsx(Z,{control:m.control,name:"stdio_cwd",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"Working Directory"}),t.jsx(ne,{children:t.jsx(xe,{placeholder:"/path/to/project (optional)",...s,value:s.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),t.jsx(se,{})]})})]}),(F==="NPX"||F==="STDIO")&&t.jsx(Z,{control:m.control,name:"env_vars",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"Environment Variables"}),t.jsx(ne,{children:t.jsx(un,{value:s.value??[],onChange:s.onChange})}),t.jsx(se,{})]})}),F!=="NPX"&&F!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(Z,{control:m.control,name:"connection_url",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"URL *"}),t.jsx(ne,{children:t.jsx(xe,{placeholder:"https://example.com/mcp",...s,value:s.value??"",onPaste:i=>{const a=i.clipboardData.getData("text");a&&(i.preventDefault(),m.setValue("connection_url",a.trim(),{shouldDirty:!0}),ke(a))},onBlur:i=>{ke(i.target.value),s.onBlur()}})}),t.jsx(se,{})]})}),t.jsx(Z,{control:m.control,name:"connection_token",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:de?.token?.label??"Token (optional)"}),t.jsx(ne,{children:t.jsx(xe,{type:"password",placeholder:de?.token?.placeholder??"Bearer token or API key",...s,value:s.value??""})}),de?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[de.token.helperText,de.id==="github"&&t.jsxs(t.Fragment,{children:[" ","·"," ",t.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),t.jsx(se,{})]})})]}),t.jsx(Z,{control:m.control,name:"title",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"Name *"}),t.jsx(ne,{children:t.jsx(xe,{placeholder:"My Connection",...s})}),t.jsx(se,{})]})}),t.jsx(Z,{control:m.control,name:"description",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"Description"}),t.jsx(ne,{children:t.jsx(Yt,{placeholder:"A brief description of this connection",rows:3,...s,value:s.value??""})}),t.jsx(se,{})]})})]}),t.jsxs(at,{children:[t.jsx(O,{type:"button",variant:"outline",onClick:()=>tt(!1),children:"Cancel"}),t.jsx(O,{type:"submit",disabled:m.formState.isSubmitting,className:"min-w-40",children:m.formState.isSubmitting?"Saving...":D?"Update Connection":"Create Connection"})]})]})})]})}),t.jsx(Oe,{open:d.mode==="deleting",onOpenChange:s=>!s&&f({type:"close"}),children:t.jsxs(ze,{children:[t.jsxs(Le,{children:[t.jsx(Ve,{children:"Delete Connection?"}),t.jsxs(Fe,{children:["This action cannot be undone. This will permanently delete"," ",t.jsx("span",{className:"font-medium text-foreground",children:d.mode==="deleting"&&d.connection.title}),"."]})]}),t.jsxs(Be,{children:[t.jsx(Ue,{children:"Cancel"}),t.jsx(Me,{onClick:pt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t.jsx(Oe,{open:d.mode==="force-deleting",onOpenChange:s=>!s&&f({type:"close"}),children:t.jsxs(ze,{children:[t.jsxs(Le,{children:[t.jsx(Ve,{children:"Connection Used by Agents"}),t.jsx(Fe,{asChild:!0,children:t.jsxs("div",{children:[t.jsxs("p",{children:["The connection"," ",t.jsx("span",{className:"font-medium text-foreground",children:d.mode==="force-deleting"&&d.connection.title})," ","is currently used by the following agent(s):"," ",t.jsx("span",{className:"font-medium text-foreground",children:d.mode==="force-deleting"&&d.agentNames}),"."]}),t.jsx("p",{className:"mt-2",children:"Deleting this connection will remove it from those agents, which may impact existing workflows that depend on them."})]})})]}),t.jsxs(Be,{children:[t.jsx(Ue,{children:"Cancel"}),t.jsx(Me,{onClick:xt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Anyway"})]})]})}),t.jsx(Pn,{open:y,onOpenChange:w,count:x.size,onConfirm:ue}),t.jsx(In,{open:_,onOpenChange:N,agents:b,onConfirm:R}),t.jsxs(ve.Header,{children:[t.jsx(ve.Header.Left,{children:t.jsx(Rt,{children:t.jsx(Ht,{children:t.jsx(Xt,{children:t.jsxs(Kt,{className:"flex items-center gap-2",children:["Connections",t.jsxs("span",{className:"text-xs font-normal text-muted-foreground tabular-nums",children:[v.total," total",v.active>0&&` · ${v.active} active`,v.error>0&&` · ${v.error} errors`]})]})})})})}),t.jsxs(ve.Header.Right,{children:[t.jsx(At,{viewMode:r.viewMode,onViewModeChange:r.setViewMode,sortKey:r.sortKey,sortDirection:r.sortDirection,onSort:r.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"updated_by",label:"Updated by"},{id:"updated_at",label:"Updated"}],filters:[{label:"Type",value:I,onChange:s=>A(s||"ALL"),options:[{id:"ALL",label:"All"},{id:"HTTP",label:"HTTP"},{id:"SSE",label:"SSE"},{id:"Websocket",label:"WebSocket"},{id:"STDIO",label:"STDIO"}]},{label:"Status",value:z,onChange:s=>U(s||"ALL"),options:[{id:"ALL",label:"All"},{id:"active",label:"Active"},{id:"inactive",label:"Inactive"},{id:"error",label:"Error"}]}]}),gt]})]}),t.jsx("div",{className:"flex items-center gap-3 px-5 pb-0",children:t.jsx("div",{className:"flex-1",children:t.jsx($t,{value:r.search,onChange:r.setSearch,placeholder:"Search for a Connection...",onKeyDown:s=>{s.key==="Escape"&&(r.setSearch(""),s.target.blur())}})})}),t.jsx(ve.Content,{children:r.viewMode==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:k.length===0?t.jsx($e,{image:t.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:"No Connections found",description:r.search?`No Connections match "${r.search}"`:"Create a connection to get started.",actions:!r.search&&t.jsx(O,{variant:"outline",onClick:()=>n({to:"/$org/$project/store",params:{org:o.slug,project:Q}}),children:"Browse Store"})}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:M.map(s=>{if(s.type==="group")return t.jsx(_n,{group:s,onNavigate:a=>n({to:"/$org/$project/mcps/$connectionId",params:{org:o.slug,project:Q,connectionId:a}}),onDelete:a=>f({type:"delete",connection:a}),selectionMode:p,selectedIds:x,onToggleSelect:V},s.key);const i=s.connection;return t.jsxs("div",{className:"relative",children:[p&&t.jsx("div",{className:"absolute top-3 left-3 z-10",children:t.jsx(De,{checked:x.has(i.id),onCheckedChange:()=>V(i.id)})}),t.jsx(lt,{connection:i,fallbackIcon:t.jsx(he,{}),onClick:()=>p?V(i.id):n({to:"/$org/$project/mcps/$connectionId",params:{org:o.slug,project:Q,connectionId:i.id}}),className:oe(p&&x.has(i.id)&&"ring-2 ring-primary"),headerActions:p?void 0:t.jsxs(He,{children:[t.jsx(Xe,{asChild:!0,children:t.jsx(O,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:a=>a.stopPropagation(),children:t.jsx(We,{size:20})})}),t.jsxs(Ke,{align:"end",onClick:a=>a.stopPropagation(),children:[t.jsxs(fe,{onClick:a=>{a.stopPropagation(),n({to:"/$org/$project/mcps/$connectionId",params:{org:o.slug,project:Q,connectionId:i.id}})},children:[t.jsx(Ge,{size:16}),"Open"]}),t.jsxs(fe,{variant:"destructive",onClick:a=>{a.stopPropagation(),f({type:"delete",connection:i})},children:[t.jsx(Ie,{size:16}),"Delete"]})]})]}),body:t.jsx(Te,{status:i.status}),footer:t.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground w-full min-w-0",children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx(be,{id:i.updated_by??i.created_by,size:"3xs"})}),t.jsx("span",{className:"shrink-0 ml-2",children:i.updated_at?_e(new Date(i.updated_at)):"—"})]})})]},i.id)})})}):t.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:t.jsx("div",{className:"flex-1 overflow-auto min-w-0",children:t.jsx("div",{className:"min-w-[1000px]",children:t.jsx(An,{columns:ft,grouped:M,sortKey:r.sortKey,sortDirection:r.sortDirection,onSort:r.handleSort,onRowClick:s=>p?V(s.id):n({to:"/$org/$project/mcps/$connectionId",params:{org:o.slug,project:Q,connectionId:s.id}}),selectionMode:p,selectedIds:x,onToggleSelect:V,emptyState:r.search?t.jsx($e,{image:t.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:`No Connections match "${r.search}"`}):t.jsx($e,{image:t.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:t.jsx(O,{variant:"outline",onClick:()=>n({to:"/$org/$project/store",params:{org:o.slug,project:Q}}),children:"Browse Store"})})})})})})}),p&&t.jsx(Dn,{count:x.size,total:k.length,onSelectAll:()=>{j(new Set(k.map(s=>s.id)))},onDeselectAll:()=>j(new Set),onDelete:()=>w(!0),onAddToAgent:()=>N(!0),onToggleStatus:je,onCancel:X})]})}function Hs(){const o=ge.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(yt,{children:t.jsx(H.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ln,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(On,{})})}),o[0]=e):e=o[0],e}export{Hs as default};
|
|
1
|
+
import{c as ge,j as t,E as yt,r as H,u as vt,n as Ct,b as Nt,a as bt,d as _t,q as kt,l as wt,k as St,i as Tt,B as O,O as Q,v as oe,t as J,o as ct,w as Dt,s as Y,_ as It}from"./index-PEK2-Gur.js";import{g as Pt}from"./generate-id-Dyweu44Y.js";import{C as At}from"./collection-display-button-CVVCR82C.js";import{C as $t,E as $e}from"./collection-search-BVMX34xh.js";import{T as Et,a as Ot,b as we,c as pe,d as zt,e as Lt}from"./table-X8r3lDFL.js";import{C as lt}from"./connection-card-CVWbDwe1.js";import{C as Te,i as Vt}from"./connection-status-CIfK1aaf.js";import{I as Ne}from"./integration-icon-CF_VTof8.js";import{P as ve}from"./index-CPVHF3xw.js";import{U as be}from"./user-CLAm4Myt.js";import{u as Ft}from"./use-binding-bR1unh0d.js";import{u as Bt}from"./use-list-state-BFxcsMHC.js";import{f as Ut,e as Mt}from"./registry-utils-BUxN-Xyw.js";import{f as Oe,a as ze,b as Le,c as Ve,d as Fe,e as Be,A as Ue,h as Me}from"./alert-dialog-CtNI8LvE.js";import{B as Re}from"./badge-DfhuIA_7.js";import{B as Rt,a as Ht,b as Xt,c as Kt}from"./breadcrumb-DZJzQEPd.js";import{C as De}from"./checkbox-CA1NpLng.js";import{D as qe,a as Qe,b as Je,c as Ye,d as Ze,e as at}from"./dialog-C82flYm2.js";import{D as He,a as Xe,b as Ke,c as fe}from"./dropdown-menu-CxuRGQYq.js";import{a as Wt,F as Z,b as ee,c as te,d as ne,f as se}from"./form-yfGhYWGK.js";import{I as xe}from"./input-sgdy4h-T.js";import{S as Gt,a as qt,b as Qt,c as Jt,d as Ce}from"./select-C05ByfCe.js";import{T as Yt}from"./textarea-pi2cWSId.js";import{a as Zt,b as en}from"./use-connection-Cknhz6to.js";import{u as ot,a as tn}from"./constants-9aDFHfpv.js";import{b as nn}from"./use-mcp-tools-BMktygYP.js";import{b as sn}from"./use-virtual-mcp-DncJVsC2.js";import{n as on}from"./ArrowDown-BYesfwXe.js";import{i as rn}from"./ArrowUp-BCyv-ojK.js";import{t as cn}from"./ChevronDown-DkqBWU_h.js";import{n as he}from"./Container-B8pG1v5Y.js";import{i as We}from"./DotsVertical-DgG2OQVv.js";import{s as Ge}from"./Eye-DQF_Qzuy.js";import{s as Ee}from"./Globe02-sIfslzHX.js";import{i as ln}from"./Loading01-HszUOya-.js";import{s as an}from"./Plus-BaoKmylk.js";import{i as dn}from"./Terminal-CM1LxJaq.js";import{s as Ie}from"./Trash01-CAKaaYMp.js";import{s as dt}from"./XClose-6pBqg-B-.js";import{f as _e}from"./format-time-CMKyl-GC.js";import{r as mn,E as un,e as mt}from"./env-vars-editor-7rdGUbIW.js";import"./Check-Camn3oQw.js";import"./Grid01-CTYtPHN4.js";import"./List-DXD0Q-rz.js";import"./tooltip-CWYwrzX7.js";import"./index-xpVnmlVH.js";import"./SearchMd-3WCi1VDc.js";import"./card-DXg2GX79.js";import"./AlertCircle-BDyT9vNZ.js";import"./CheckCircle-B7XGhEcJ.js";import"./localstorage-keys-F1lq-lvV.js";import"./useQuery-C84LCuAf.js";import"./useMutation-Bwc-v8Ow.js";import"./avatar-7hY_H5zt.js";import"./binder-C6fAESck.js";import"./use-view-mode-CkSeKCK_.js";import"./use-mobile-DqFS2tGv.js";import"./ChevronRight-BI34N28O.js";import"./X-BS-0d43p.js";import"./label-BrZsvi2a.js";import"./use-collections-CdWUwl8U.js";import"./differenceInSeconds-NQ4PDo0z.js";function it(o){return o.title.trim().replace(/\s+\(\d+\)$/,"")}function pn(o){const e=new Map;for(const l of o){if(l.connection_type==="VIRTUAL")continue;const u=it(l),r=e.get(u);r?r.push(l):e.set(u,[l])}const n=[],c=new Set;for(const l of o){if(l.connection_type==="VIRTUAL")continue;const u=it(l);if(c.has(u))continue;c.add(u);const r=e.get(u),h=r[0];r.length===1?n.push({type:"single",connection:h}):n.push({type:"group",key:u,icon:h.icon,title:h.app_name?h.title.replace(/\s*\(\d+\)\s*$/,""):h.title,connections:r})}return n}function ut(o){const e=new Set,n=[];for(const c of o)c.created_by&&!e.has(c.created_by)&&(e.add(c.created_by),n.push(c.created_by));return n}function xn(o){let e=0,n=0,c=0;for(const l of o)l.connection_type!=="VIRTUAL"&&(l.status==="active"?e++:l.status==="error"?c++:n++);return{active:e,inactive:n,error:c,total:e+n+c}}const hn=ct({key:Y(),value:Y()}),fn=ct({title:Y().min(1,"Name is required"),description:Y().nullable().optional(),icon:Y().nullable().optional(),ui_type:It(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:Y().optional(),connection_token:Y().nullable().optional(),npx_package:Y().optional(),stdio_command:Y().optional(),stdio_args:Y().optional(),stdio_cwd:Y().optional(),env_vars:Dt(hn).optional()}).refine(o=>o.ui_type==="NPX"?!!o.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(o=>o.ui_type==="STDIO"?!!o.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(o=>o.ui_type==="HTTP"||o.ui_type==="SSE"||o.ui_type==="Websocket"?!!o.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function Pe(o){const e=o.trim();if(!e)return"";try{const n=new URL(e),c=n.pathname.length>1?n.pathname.replace(/\/+$/,""):n.pathname;return`${n.origin}${c}`}catch{return e.replace(/\/+$/,"")}}function gn(o){const e=o.trim().split(/\s+/).filter(Boolean);if(e.length<2)return null;const n=e[0]?.toLowerCase();if(n!=="npx"&&n!=="bunx")return null;const l=e.slice(1).find(u=>!u.startsWith("-"));return l?{packageName:l}:null}function Se(o){const{uiType:e}=o,n=Pe(o.connectionUrl??"");if((e==="HTTP"||e==="SSE"||e==="Websocket")&&n===Pe("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 c=(o.npxPackage??"").trim();return e==="NPX"&&c==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function rt(o){if(o.registryItems.length===0||o.uiType!=="HTTP"&&o.uiType!=="SSE"&&o.uiType!=="Websocket")return null;const e=Pe(o.connectionUrl??"");if(!e)return null;const n=o.registryItems.find(u=>(u.server?.remotes??[]).some(h=>Pe(h.url??"")===e));if(!n)return null;const c=n.title||n.name||n.server?.title||n.server?.name||"",l=n.server?.description||n.description||n.summary||null;return c?{id:"registry",title:c,description:l}:null}function jn(o,e){const n={command:"npx",args:["-y",o]},c=mt(e);return Object.keys(c).length>0&&(n.envVars=c),n}function yn(o,e,n,c){const l={command:o};e.trim()&&(l.args=e.trim().split(/\s+/)),n?.trim()&&(l.cwd=n.trim());const u=mt(c);return Object.keys(u).length>0&&(l.envVars=u),l}function vn(o){return o.command==="npx"}function Cn(o){return o.args?.find(e=>!e.startsWith("-"))??""}function Nn(o){return{command:o.command,args:o.args?.join(" ")??"",cwd:o.cwd??""}}function bn(o,e){switch(e.type){case"edit":return{mode:"editing",connection:e.connection};case"delete":return{mode:"deleting",connection:e.connection};case"force-delete":return{mode:"force-deleting",connection:e.connection,agentNames:e.agentNames};case"close":return{mode:"idle"}}}function _n(o){const e=ge.c(107),{group:n,onNavigate:c,onDelete:l,selectionMode:u,selectedIds:r,onToggleSelect:h}=o,[C,d]=H.useState(!1);let f;if(e[0]!==n.connections||e[1]!==r){let $;e[3]!==r?($=E=>r.has(E.id),e[3]=r,e[4]=$):$=e[4],f=n.connections.every($),e[0]=n.connections,e[1]=r,e[2]=f}else f=e[2];const p=f;let T;if(e[5]!==n.connections||e[6]!==r){let $;e[8]!==r?($=E=>r.has(E.id),e[8]=r,e[9]=$):$=e[9],T=n.connections.some($),e[5]=n.connections,e[6]=r,e[7]=T}else T=e[7];const x=T;let j,y,w,_,N,I,A,z,U,b,k;if(e[10]!==p||e[11]!==n.connections||e[12]!==n.icon||e[13]!==n.title||e[14]!==h||e[15]!==r||e[16]!==u||e[17]!==x){const $=ut(n.connections),E=n.connections.reduce(Tn,n.connections[0]),de=E.updated_at??E.created_at;j=lt;const D=`${n.connections.length} instances`;e[29]!==n.icon||e[30]!==n.title||e[31]!==D?(U={title:n.title,icon:n.icon,description:D},e[29]=n.icon,e[30]=n.title,e[31]=D,e[32]=U):U=e[32],e[33]!==p||e[34]!==n.connections||e[35]!==h||e[36]!==r||e[37]!==u?(b=()=>u?(()=>{for(const R of n.connections)p?r.has(R.id)&&h(R.id):r.has(R.id)||h(R.id)})():d(!0),e[33]=p,e[34]=n.connections,e[35]=h,e[36]=r,e[37]=u,e[38]=b):b=e[38];const le=u&&p&&"ring-2 ring-primary",me=u&&x&&!p&&"ring-1 ring-primary/50";e[39]!==le||e[40]!==me?(k=oe(le,me),e[39]=le,e[40]=me,e[41]=k):k=e[41],e[42]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(he,{}),e[42]=y):y=e[42],e[43]!==p||e[44]!==n.connections||e[45]!==h||e[46]!==r||e[47]!==u||e[48]!==x?(w=u?t.jsx(De,{checked:p?!0:x?"indeterminate":!1,onCheckedChange:()=>{for(const R of n.connections)p?r.has(R.id)&&h(R.id):r.has(R.id)||h(R.id)}}):t.jsxs(Re,{variant:"secondary",className:"text-xs tabular-nums",children:["x",n.connections.length]}),e[43]=p,e[44]=n.connections,e[45]=h,e[46]=r,e[47]=u,e[48]=x,e[49]=w):w=e[49];let ue;e[50]!==n.connections?(ue=n.connections.slice(0,6).map(Sn),e[50]=n.connections,e[51]=ue):ue=e[51],e[52]!==ue?(_=t.jsx("div",{className:"flex items-center gap-1",children:ue}),e[52]=ue,e[53]=_):_=e[53],A="flex items-center justify-between text-xs text-muted-foreground w-full min-w-0";const je=$.map(R=>t.jsx(be,{id:R,size:"3xs",avatarOnly:$.length>1},R));e[54]!==je?(z=t.jsx("div",{className:"flex items-center -space-x-1.5",children:je}),e[54]=je,e[55]=z):z=e[55],N="shrink-0 ml-2",I=de?_e(new Date(de)):"—",e[10]=p,e[11]=n.connections,e[12]=n.icon,e[13]=n.title,e[14]=h,e[15]=r,e[16]=u,e[17]=x,e[18]=j,e[19]=y,e[20]=w,e[21]=_,e[22]=N,e[23]=I,e[24]=A,e[25]=z,e[26]=U,e[27]=b,e[28]=k}else j=e[18],y=e[19],w=e[20],_=e[21],N=e[22],I=e[23],A=e[24],z=e[25],U=e[26],b=e[27],k=e[28];let v;e[56]!==N||e[57]!==I?(v=t.jsx("span",{className:N,children:I}),e[56]=N,e[57]=I,e[58]=v):v=e[58];let M;e[59]!==v||e[60]!==A||e[61]!==z?(M=t.jsxs("div",{className:A,children:[z,v]}),e[59]=v,e[60]=A,e[61]=z,e[62]=M):M=e[62];let V;e[63]!==j||e[64]!==y||e[65]!==w||e[66]!==_||e[67]!==M||e[68]!==U||e[69]!==b||e[70]!==k?(V=t.jsx(j,{connection:U,onClick:b,className:k,fallbackIcon:y,headerActions:w,body:_,footer:M}),e[63]=j,e[64]=y,e[65]=w,e[66]=_,e[67]=M,e[68]=U,e[69]=b,e[70]=k,e[71]=V):V=e[71];let X;e[72]===Symbol.for("react.memo_cache_sentinel")?(X=t.jsx(he,{}),e[72]=X):X=e[72];let K;e[73]!==n.icon||e[74]!==n.title?(K=t.jsx(Ne,{icon:n.icon,name:n.title,size:"md",className:"shrink-0 shadow-sm",fallbackIcon:X}),e[73]=n.icon,e[74]=n.title,e[75]=K):K=e[75];let W;e[76]!==n.connections.length?(W=t.jsxs(Re,{variant:"secondary",className:"ml-2 text-xs tabular-nums",children:["x",n.connections.length]}),e[76]=n.connections.length,e[77]=W):W=e[77];let g;e[78]!==n.title||e[79]!==W?(g=t.jsxs(Ye,{children:[n.title,W]}),e[78]=n.title,e[79]=W,e[80]=g):g=e[80];let S;e[81]!==n.connections.length?(S=t.jsxs(Ze,{children:[n.connections.length," installed instances"]}),e[81]=n.connections.length,e[82]=S):S=e[82];let L;e[83]!==g||e[84]!==S?(L=t.jsxs("div",{children:[g,S]}),e[83]=g,e[84]=S,e[85]=L):L=e[85];let ie;e[86]!==K||e[87]!==L?(ie=t.jsx(Je,{className:"px-6 pt-6 pb-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[K,L]})}),e[86]=K,e[87]=L,e[88]=ie):ie=e[88];let re;if(e[89]!==n.connections||e[90]!==l||e[91]!==c){let $;e[93]!==l||e[94]!==c?($=E=>t.jsxs("div",{className:"flex items-center gap-3 px-6 py-3 hover:bg-muted/30 cursor-pointer transition-colors",onClick:()=>{d(!1),c(E.id)},children:[t.jsx(Ne,{icon:E.icon,name:E.title,size:"sm",className:"shrink-0",fallbackIcon:t.jsx(he,{})}),t.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:E.title}),t.jsx(Te,{status:E.status})]}),t.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground shrink-0",children:[t.jsx(be,{id:E.created_by,size:"3xs"}),t.jsx("span",{children:E.created_at?_e(new Date(E.created_at)):"—"})]}),t.jsxs(He,{children:[t.jsx(Xe,{asChild:!0,children:t.jsx(O,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:wn,children:t.jsx(We,{size:16})})}),t.jsxs(Ke,{align:"end",onClick:kn,children:[t.jsxs(fe,{onClick:()=>{d(!1),c(E.id)},children:[t.jsx(Ge,{size:16}),"Open"]}),t.jsxs(fe,{variant:"destructive",onClick:()=>l(E),children:[t.jsx(Ie,{size:16}),"Delete"]})]})]})]},E.id),e[93]=l,e[94]=c,e[95]=$):$=e[95],re=n.connections.map($),e[89]=n.connections,e[90]=l,e[91]=c,e[92]=re}else re=e[92];let ae;e[96]!==re?(ae=t.jsx("div",{className:"divide-y max-h-80 overflow-auto",children:re}),e[96]=re,e[97]=ae):ae=e[97];let ce;e[98]!==ie||e[99]!==ae?(ce=t.jsxs(Qe,{className:"sm:max-w-lg p-0 gap-0",children:[ie,ae]}),e[98]=ie,e[99]=ae,e[100]=ce):ce=e[100];let m;e[101]!==C||e[102]!==ce?(m=t.jsx(qe,{open:C,onOpenChange:d,children:ce}),e[101]=C,e[102]=ce,e[103]=m):m=e[103];let F;return e[104]!==V||e[105]!==m?(F=t.jsxs(t.Fragment,{children:[V,m]}),e[104]=V,e[105]=m,e[106]=F):F=e[106],F}function kn(o){return o.stopPropagation()}function wn(o){return o.stopPropagation()}function Sn(o){return t.jsx(Te,{status:o.status},o.id)}function Tn(o,e){const n=e.updated_at??e.created_at,c=o.updated_at??o.created_at;return n?c?new Date(n)>new Date(c)?e:o:e:o}function Dn(o){const e=ge.c(28),{count:n,total:c,onSelectAll:l,onDeselectAll:u,onDelete:r,onAddToAgent:h,onToggleStatus:C,onCancel:d}=o;if(n===0)return null;let f;e[0]!==n?(f=t.jsxs("div",{className:"text-xs text-muted-foreground pr-1 tabular-nums",children:[n," selected"]}),e[0]=n,e[1]=f):f=e[1];let p;e[2]!==n||e[3]!==u||e[4]!==l||e[5]!==c?(p=n<c?t.jsxs(O,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:l,children:["Select all (",c,")"]}):t.jsx(O,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:u,children:"Clear selection"}),e[2]=n,e[3]=u,e[4]=l,e[5]=c,e[6]=p):p=e[6];let T;e[7]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx(an,{size:13}),e[7]=T):T=e[7];let x;e[8]!==h?(x=t.jsxs(O,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:h,children:[T,"Add to Agent"]}),e[8]=h,e[9]=x):x=e[9];let j;e[10]!==C?(j=t.jsx(O,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>C("active"),children:"Enable"}),e[10]=C,e[11]=j):j=e[11];let y;e[12]!==C?(y=t.jsx(O,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>C("inactive"),children:"Disable"}),e[12]=C,e[13]=y):y=e[13];let w;e[14]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(Ie,{size:13}),e[14]=w):w=e[14];let _;e[15]!==r?(_=t.jsxs(O,{variant:"destructive",size:"sm",className:"h-7 text-xs px-2",onClick:r,children:[w,"Delete"]}),e[15]=r,e[16]=_):_=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(dt,{size:13}),e[17]=N):N=e[17];let I;e[18]!==d?(I=t.jsx(O,{variant:"ghost",size:"sm",className:"h-7 text-xs px-2",onClick:d,children:N}),e[18]=d,e[19]=I):I=e[19];let A;return e[20]!==f||e[21]!==I||e[22]!==p||e[23]!==x||e[24]!==j||e[25]!==y||e[26]!==_?(A=t.jsx("div",{className:"fixed bottom-4 left-1/2 z-50 -translate-x-1/2",children:t.jsxs("div",{className:"rounded-xl border border-border bg-background/95 shadow-lg backdrop-blur px-3 py-2 flex items-center gap-2",children:[f,p,x,j,y,_,I]})}),e[20]=f,e[21]=I,e[22]=p,e[23]=x,e[24]=j,e[25]=y,e[26]=_,e[27]=A):A=e[27],A}function In(o){const e=ge.c(25),{open:n,onOpenChange:c,agents:l,onConfirm:u}=o,[r,h]=H.useState(null);let C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsxs(Je,{children:[t.jsx(Ye,{children:"Add to Agent"}),t.jsx(Ze,{children:"Select an agent to add the selected connections to."})]}),e[0]=C):C=e[0];let d;e[1]!==l||e[2]!==r?(d=l.length===0?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No agents found"}):l.map(N=>t.jsxs("button",{type:"button",onClick:()=>h(N.id),className:oe("flex items-center gap-3 w-full rounded-md px-3 py-2 text-left transition-colors",r===N.id?"bg-primary/10 ring-1 ring-primary":"hover:bg-muted/50"),children:[t.jsx(Ne,{icon:N.icon,name:N.title,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:N.title}),N.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:N.description})]})]},N.id)),e[1]=l,e[2]=r,e[3]=d):d=e[3];let f;e[4]!==d?(f=t.jsx("div",{className:"max-h-60 overflow-auto py-2 space-y-1",children:d}),e[4]=d,e[5]=f):f=e[5];let p;e[6]!==c?(p=t.jsx(O,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e[6]=c,e[7]=p):p=e[7];const T=!r;let x;e[8]!==u||e[9]!==c||e[10]!==r?(x=()=>{r&&(u(r),c(!1),h(null))},e[8]=u,e[9]=c,e[10]=r,e[11]=x):x=e[11];let j;e[12]!==T||e[13]!==x?(j=t.jsx(O,{disabled:T,onClick:x,children:"Add"}),e[12]=T,e[13]=x,e[14]=j):j=e[14];let y;e[15]!==p||e[16]!==j?(y=t.jsxs(at,{children:[p,j]}),e[15]=p,e[16]=j,e[17]=y):y=e[17];let w;e[18]!==f||e[19]!==y?(w=t.jsxs(Qe,{className:"sm:max-w-[400px]",children:[C,f,y]}),e[18]=f,e[19]=y,e[20]=w):w=e[20];let _;return e[21]!==c||e[22]!==n||e[23]!==w?(_=t.jsx(qe,{open:n,onOpenChange:c,children:w}),e[21]=c,e[22]=n,e[23]=w,e[24]=_):_=e[24],_}function Pn(o){const e=ge.c(20),{open:n,onOpenChange:c,count:l,onConfirm:u}=o,r=l!==1?"s":"";let h;e[0]!==l||e[1]!==r?(h=t.jsxs(Ve,{children:["Delete ",l," connection",r,"?"]}),e[0]=l,e[1]=r,e[2]=h):h=e[2];const C=l!==1?"s":"";let d;e[3]!==C?(d=t.jsxs(Fe,{children:["This will permanently delete the selected connection",C,". This action cannot be undone."]}),e[3]=C,e[4]=d):d=e[4];let f;e[5]!==h||e[6]!==d?(f=t.jsxs(Le,{children:[h,d]}),e[5]=h,e[6]=d,e[7]=f):f=e[7];let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Ue,{children:"Cancel"}),e[8]=p):p=e[8];const T=l!==1?"s":"";let x;e[9]!==l||e[10]!==u||e[11]!==T?(x=t.jsxs(Be,{children:[p,t.jsxs(Me,{onClick:u,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:["Delete ",l," connection",T]})]}),e[9]=l,e[10]=u,e[11]=T,e[12]=x):x=e[12];let j;e[13]!==f||e[14]!==x?(j=t.jsxs(ze,{children:[f,x]}),e[13]=f,e[14]=x,e[15]=j):j=e[15];let y;return e[16]!==c||e[17]!==n||e[18]!==j?(y=t.jsx(Oe,{open:n,onOpenChange:c,children:j}),e[16]=c,e[17]=n,e[18]=j,e[19]=y):y=e[19],y}function An(o){const e=ge.c(37),{columns:n,grouped:c,sortKey:l,sortDirection:u,onSort:r,onRowClick:h,selectionMode:C,selectedIds:d,onToggleSelect:f,emptyState:p}=o;let T;e[0]===Symbol.for("react.memo_cache_sentinel")?(T=new Set,e[0]=T):T=e[0];const[x,j]=H.useState(T);let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=b=>{j(k=>{const v=new Set(k);return v.has(b)?v.delete(b):v.add(b),v})},e[1]=y):y=e[1];const w=y;if(c.length===0&&p){let b;return e[2]!==p?(b=t.jsx("div",{className:"flex items-center justify-center h-full",children:p}),e[2]=p,e[3]=b):b=e[3],b}const _=n.length;let N;if(e[4]!==_||e[5]!==n||e[6]!==r||e[7]!==u||e[8]!==l){let b;e[10]!==_||e[11]!==r||e[12]!==u||e[13]!==l?(b=(k,v)=>{const M=l===k.id,V=v===_-1;return t.jsx(Et,{className:oe("px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider",V&&"w-8","group transition-colors select-none",k.sortable&&"hover:bg-accent cursor-pointer",k.cellClassName),onClick:k.sortable&&r?()=>r(k.id):void 0,children:t.jsxs("span",{className:"flex items-center gap-1",children:[k.header,k.sortable&&t.jsx("span",{className:"w-4 flex items-center justify-center",children:M&&u&&(u==="asc"?t.jsx(rn,{size:16,className:"text-muted-foreground"}):t.jsx(on,{size:16,className:"text-muted-foreground"}))})]})},k.id)},e[10]=_,e[11]=r,e[12]=u,e[13]=l,e[14]=b):b=e[14],N=n.map(b),e[4]=_,e[5]=n,e[6]=r,e[7]=u,e[8]=l,e[9]=N}else N=e[9];let I;e[15]!==N?(I=t.jsx(Ot,{className:"border-b-0",children:t.jsx(we,{className:"h-9 hover:bg-transparent border-b border-border",children:N})}),e[15]=N,e[16]=I):I=e[16];let A;if(e[17]!==n||e[18]!==x||e[19]!==c||e[20]!==h||e[21]!==f||e[22]!==d||e[23]!==C){let b;e[25]!==n||e[26]!==x||e[27]!==h||e[28]!==f||e[29]!==d||e[30]!==C?(b=k=>{if(k.type==="single"){const g=k.connection;return t.jsx(we,{className:oe("group/data-row transition-colors border-b-0 hover:bg-accent/50 cursor-pointer",C&&d.has(g.id)&&"bg-primary/5"),onClick:()=>h(g),children:n.map(S=>t.jsx(pe,{className:oe("px-5 py-4 h-16 align-middle text-sm text-foreground",S.cellClassName),children:t.jsx("div",{className:"min-w-0 w-full truncate overflow-hidden whitespace-nowrap",children:S.render?S.render(g):null})},S.id))},g.id)}const v=k,M=x.has(v.key),V=v.connections.every(g=>d.has(g.id)),X=v.connections.some(g=>d.has(g.id)),K=ut(v.connections),W=v.connections.reduce(En,v.connections[0]);return t.jsxs(H.Fragment,{children:[t.jsx(we,{className:"border-b-0 hover:bg-accent/50 cursor-pointer transition-colors",onClick:()=>w(v.key),children:n.map(g=>{const S=oe("px-5 py-3 h-14 align-middle text-sm",g.cellClassName);if(g.id==="select")return t.jsx(pe,{className:S,children:t.jsx(De,{checked:V?!0:X?"indeterminate":!1,onCheckedChange:()=>{for(const L of v.connections)V?d.has(L.id)&&f(L.id):d.has(L.id)||f(L.id)},onClick:$n})},g.id);if(g.id==="title")return t.jsx(pe,{className:S,children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx(Ne,{icon:v.icon,name:v.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:t.jsx(he,{})}),t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:v.title}),t.jsxs(Re,{variant:"secondary",className:"text-xs tabular-nums",children:["x",v.connections.length]})]})},g.id);if(g.id==="updated_by")return t.jsx(pe,{className:S,children:t.jsx("div",{className:"flex items-center -space-x-1.5",children:K.map(L=>t.jsx(be,{id:L,size:"3xs",avatarOnly:K.length>1},L))})},g.id);if(g.id==="updated_at"){const L=W.updated_at??W.created_at;return t.jsx(pe,{className:S,children:t.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:L?_e(new Date(L)):"—"})},g.id)}return g.id==="actions"?t.jsx(pe,{className:S,children:t.jsx(cn,{size:16,className:oe("text-muted-foreground transition-transform",M&&"rotate-180")})},g.id):t.jsx(pe,{className:S},g.id)})}),M&&v.connections.map(g=>t.jsx(we,{className:oe("group/data-row transition-colors border-b-0 hover:bg-accent/50 cursor-pointer bg-muted/20",C&&d.has(g.id)&&"bg-primary/5"),onClick:()=>h(g),children:n.map(S=>t.jsx(pe,{className:oe("px-5 py-3 h-14 align-middle text-sm text-foreground",S.cellClassName,S.id==="title"&&"pl-12"),children:t.jsx("div",{className:"min-w-0 w-full truncate overflow-hidden whitespace-nowrap",children:S.render?S.render(g):null})},S.id))},g.id))]},v.key)},e[25]=n,e[26]=x,e[27]=h,e[28]=f,e[29]=d,e[30]=C,e[31]=b):b=e[31],A=c.map(b),e[17]=n,e[18]=x,e[19]=c,e[20]=h,e[21]=f,e[22]=d,e[23]=C,e[24]=A}else A=e[24];let z;e[32]!==A?(z=t.jsx(zt,{children:A}),e[32]=A,e[33]=z):z=e[33];let U;return e[34]!==I||e[35]!==z?(U=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs(Lt,{className:"w-full border-collapse",children:[I,z]})}),e[34]=I,e[35]=z,e[36]=U):U=e[36],U}function $n(o){return o.stopPropagation()}function En(o,e){const n=e.updated_at??e.created_at,c=o.updated_at??o.created_at;return n?c?new Date(n)>new Date(c)?e:o:e:o}function On(){const{org:o}=vt(),e=Ct(),n=Nt(),c=bt({strict:!1}),{data:l}=_t.useSession(),{stdioEnabled:u}=kt(),r=Bt({namespace:o.slug,resource:"connections"}),h=Zt(),C=en(r),[d,f]=H.useReducer(bn,{mode:"idle"}),[p,T]=H.useState(!1),[x,j]=H.useState(new Set),[y,w]=H.useState(!1),[_,N]=H.useState(!1),[I,A]=H.useState("ALL"),[z,U]=H.useState("ALL"),b=sn(),k=C.filter(s=>!(s.connection_type==="VIRTUAL"||I!=="ALL"&&s.connection_type!==I||z!=="ALL"&&s.status!==z)),v=xn(C),M=pn(k),V=s=>{j(i=>{const a=new Set(i);return a.has(s)?a.delete(s):a.add(s),a})},X=()=>{T(!1),j(new Set)},K=Ft(C)[0],W=K?.id??"",g=Ut(K?.tools),S=ot({connectionId:W||null,orgId:o.id}),{data:L}=nn({client:S,toolName:g,toolArguments:{limit:200},enabled:!!(W&&g),staleTime:3600*1e3,select:s=>s.structuredContent??s}),ie=Mt(L??[]),re=c.action==="create",ae=()=>{n({to:"/$org/$project/mcps",params:{org:o.slug,project:Q},search:{action:"create"}})},ce=()=>{n({to:"/$org/$project/mcps",params:{org:o.slug,project:Q},search:{}})},m=wt({resolver:St(fn),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),F=m.watch("ui_type"),$=m.watch("connection_url"),E=m.watch("npx_package"),de=Se({uiType:F,connectionUrl:$??"",npxPackage:E??""})??rt({uiType:F,connectionUrl:$??"",registryItems:ie}),D=d.mode==="editing"?d.connection:null;H.useEffect(()=>{if(D){const s=Tt(D.connection_headers)?D.connection_headers:null;if(s&&D.connection_type==="STDIO"){const i=mn(s.envVars);if(vn(s)){const a=Cn(s);m.reset({title:D.title,description:D.description,icon:D.icon??null,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:a,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:i})}else{const a=Nn(s);m.reset({title:D.title,description:D.description,icon:D.icon??null,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})}}else m.reset({title:D.title,description:D.description,icon:D.icon??null,ui_type:D.connection_type,connection_url:D.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})}else m.reset({title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})},[D,m]);const le=ot({connectionId:tn,orgId:o.id}),me=()=>{e.invalidateQueries({predicate:s=>{const i=s.queryKey;return i[1]===o.id&&i[3]==="collection"&&i[4]==="CONNECTIONS"}})},ue=async()=>{w(!1);const s=[...x];let i=0;for(const a of s)try{(await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:a,force:!0}})).isError||i++}catch{}me(),J.success(`Deleted ${i} connection${i!==1?"s":""}`),X()},je=async s=>{const i=[...x];let a=0;for(const B of i)try{await h.update.mutateAsync({id:B,data:{status:s}}),a++}catch{}me(),J.success(`${s==="active"?"Enabled":"Disabled"} ${a} connection${a!==1?"s":""}`),X()},R=async s=>{const i=b.find(P=>P.id===s);if(!i||!le)return;const a=new Set(i.connections.map(P=>P.connection_id)),B=[...x].filter(P=>!a.has(P)).map(P=>({connection_id:P,selected_tools:null,selected_resources:null,selected_prompts:null}));if(B.length===0){J.info("All selected connections are already in that agent");return}try{await le.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:s,data:{connections:[...i.connections,...B]}}}),e.invalidateQueries({predicate:P=>{const G=P.queryKey;return G[1]===o.id&&G[3]==="collection"&&G[4]==="VIRTUAL_MCP"}}),J.success(`Added ${B.length} connection${B.length!==1?"s":""} to "${i.title}"`),X()}catch{J.error("Failed to add connections to agent")}},et=s=>{const i=s.content;return Array.isArray(i)&&i[0]?.type==="text"&&typeof i[0].text=="string"?i[0].text:"Unknown error"},pt=async()=>{if(d.mode!=="deleting")return;const s=d.connection;f({type:"close"});try{const i=await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:s.id}});if(i.isError){const a=et(i),B=a.replace(/^Error:\s*/,"");try{const P=JSON.parse(B);if(P.code==="CONNECTION_IN_USE"&&P.agentNames){f({type:"force-delete",connection:s,agentNames:P.agentNames.map(G=>`"${G}"`).join(", ")});return}}catch{}J.error(`Failed to delete connection: ${a}`);return}me(),J.success("Connection deleted successfully")}catch(i){const a=i instanceof Error?i.message:String(i);J.error(`Failed to delete connection: ${a}`)}},xt=async()=>{if(d.mode!=="force-deleting")return;const s=d.connection.id;f({type:"close"});try{const i=await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:s,force:!0}});if(i.isError){J.error(`Failed to delete connection: ${et(i)}`);return}me(),J.success("Connection deleted successfully")}catch(i){const a=i instanceof Error?i.message:String(i);J.error(`Failed to delete connection: ${a}`)}},ht=async s=>{let i,a=null,B=null,P=null;if(s.ui_type==="NPX"?(i="STDIO",a="",P=jn(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(i="STDIO",a="",P=yn(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(i=s.ui_type,a=s.connection_url||"",B=s.connection_token||null),D){await h.update.mutateAsync({id:D.id,data:{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:i,connection_url:a,...B&&{connection_token:B},...P&&{connection_headers:P}}}),f({type:"close"}),m.reset();return}const G=Pt("conn");await h.create.mutateAsync({id:G,title:s.title,description:s.description||null,connection_type:i,connection_url:a,connection_token:B,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:l?.user?.id||"system",organization_id:o.id,icon:s.icon??null,app_name:null,app_id:null,connection_headers:P,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),ce(),m.reset(),n({to:"/$org/$project/mcps/$connectionId",params:{org:o.slug,project:Q,connectionId:G}})},tt=s=>{s||(re?ce():f({type:"close"}),m.reset())},ke=s=>{const i=s.trim();if(!i)return;const a=!!m.formState.dirtyFields.title,B=!!m.formState.dirtyFields.description,P=!!m.formState.dirtyFields.env_vars,G=q=>{if(q&&(!a&&!m.getValues("title").trim()&&q.title&&m.setValue("title",q.title,{shouldDirty:!1}),!B&&!(m.getValues("description")??"").trim()&&q.description&&m.setValue("description",q.description,{shouldDirty:!1}),!P&&q.envVarKeys?.length)){const nt=m.getValues("env_vars")??[],jt=new Set(nt.map(ye=>ye.key)),st=q.envVarKeys.filter(ye=>!jt.has(ye));st.length>0&&m.setValue("env_vars",[...nt,...st.map(ye=>({key:ye,value:""}))],{shouldDirty:!0})}},Ae=gn(i);if(Ae&&u){m.setValue("ui_type","NPX",{shouldDirty:!0}),m.setValue("npx_package",Ae.packageName,{shouldDirty:!0}),m.setValue("connection_url","",{shouldDirty:!0}),m.setValue("connection_token",null,{shouldDirty:!0}),G(Se({uiType:"NPX",npxPackage:Ae.packageName}));return}if(i.startsWith("http://")||i.startsWith("https://")){const q=F==="HTTP"||F==="SSE"||F==="Websocket"?F:"HTTP";m.setValue("ui_type",q,{shouldDirty:!0}),m.setValue("connection_url",i,{shouldDirty:!0}),G(Se({uiType:q,connectionUrl:i})??rt({uiType:q,connectionUrl:i,registryItems:ie}));return}F==="NPX"&&G(Se({uiType:"NPX",npxPackage:i}))},ft=[...p?[{id:"select",header:"",render:s=>t.jsx(De,{checked:x.has(s.id),onCheckedChange:()=>V(s.id),onClick:i=>i.stopPropagation()}),cellClassName:"w-10 shrink-0"}]:[],{id:"title",header:"Name",render:s=>t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx(Ne,{icon:s.icon,name:s.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:t.jsx(he,{})}),t.jsx("span",{className:"text-sm font-medium text-foreground truncate block",title:s.title,children:s.title})]}),cellClassName:"w-32 min-w-0 shrink-0",sortable:!0},{id:"description",header:"Description",render:s=>t.jsx("span",{className:"text-sm text-muted-foreground truncate block",title:s.description||"",children:s.description||"—"}),cellClassName:"flex-1 min-w-0 max-w-0",wrap:!1,sortable:!0},{id:"connection_type",header:"Type",accessor:s=>t.jsx("span",{className:"text-xs font-medium",children:s.connection_type}),cellClassName:"w-16 shrink-0",sortable:!0},{id:"status",header:"Status",render:s=>t.jsx(Te,{status:s.status}),cellClassName:"w-28 shrink-0",sortable:!1},{id:"updated_by",header:"Updated by",render:s=>t.jsx(be,{id:s.updated_by??s.created_by,size:"3xs"}),cellClassName:"w-32 shrink-0",sortable:!0},{id:"updated_at",header:"Updated",render:s=>t.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:s.updated_at?_e(new Date(s.updated_at)):"—"}),cellClassName:"max-w-24 w-24 shrink-0",sortable:!0},{id:"actions",header:"",render:s=>t.jsxs(He,{children:[t.jsx(Xe,{asChild:!0,children:t.jsx(O,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:i=>i.stopPropagation(),children:t.jsx(We,{size:20})})}),t.jsxs(Ke,{align:"end",onClick:i=>i.stopPropagation(),children:[t.jsxs(fe,{onClick:i=>{i.stopPropagation(),n({to:"/$org/$project/mcps/$connectionId",params:{org:o.slug,project:Q,connectionId:s.id}})},children:[t.jsx(Ge,{size:16}),"Open"]}),t.jsxs(fe,{variant:"destructive",onClick:i=>{i.stopPropagation(),f({type:"delete",connection:s})},children:[t.jsx(Ie,{size:16}),"Delete"]})]})]}),cellClassName:"w-12 shrink-0"}],gt=t.jsx("div",{className:"flex items-center gap-2",children:p?t.jsxs(O,{variant:"ghost",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",onClick:X,children:[t.jsx(dt,{size:14}),"Cancel"]}):t.jsxs(t.Fragment,{children:[t.jsxs(O,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",onClick:()=>T(!0),children:[t.jsx(Vt,{size:14}),"Select"]}),t.jsx(O,{variant:"outline",onClick:()=>n({to:"/$org/$project/store",params:{org:o.slug,project:Q}}),size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Browse Store"}),t.jsx(O,{onClick:ae,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Custom Connection"})]})});return t.jsxs(ve,{children:[t.jsx(qe,{open:re||d.mode==="editing",onOpenChange:tt,children:t.jsxs(Qe,{className:"sm:max-w-[525px]",children:[t.jsxs(Je,{children:[t.jsx(Ye,{children:D?"Edit Connection":"Create Connection"}),t.jsx(Ze,{children:D?"Update the connection details below.":"Create a custom connection in your organization. Fill in the details below."})]}),t.jsx(Wt,{...m,children:t.jsxs("form",{onSubmit:m.handleSubmit(ht),children:[t.jsxs("div",{className:"grid gap-4 py-4",children:[t.jsx(Z,{control:m.control,name:"ui_type",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"Type *"}),t.jsxs(Gt,{value:s.value,onValueChange:s.onChange,children:[t.jsx(ne,{children:t.jsx(qt,{children:t.jsx(Qt,{})})}),t.jsxs(Jt,{children:[t.jsx(Ce,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ee,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(Ce,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ee,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(Ce,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ee,{className:"w-4 h-4"}),"Websocket"]})}),u&&t.jsxs(t.Fragment,{children:[t.jsx(Ce,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(he,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(Ce,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(dn,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(se,{})]})}),F==="NPX"&&t.jsx(t.Fragment,{children:t.jsx(Z,{control:m.control,name:"npx_package",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"NPM Package *"}),t.jsx(ne,{children:t.jsx(xe,{placeholder:"@perplexity-ai/mcp-server",...s,value:s.value??"",onPaste:i=>{const a=i.clipboardData.getData("text");a&&(i.preventDefault(),m.setValue("npx_package",a.trim(),{shouldDirty:!0}),ke(a))},onBlur:i=>{ke(i.target.value),s.onBlur()}})}),t.jsx(se,{})]})})}),F==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(Z,{control:m.control,name:"stdio_command",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"Command *"}),t.jsx(ne,{children:t.jsx(xe,{placeholder:"node, bun, python...",...s,value:s.value??""})}),t.jsx(se,{})]})}),t.jsx(Z,{control:m.control,name:"stdio_args",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"Arguments"}),t.jsx(ne,{children:t.jsx(xe,{placeholder:"arg1 arg2 --flag value",...s,value:s.value??""})}),t.jsx(se,{})]})})]}),t.jsx(Z,{control:m.control,name:"stdio_cwd",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"Working Directory"}),t.jsx(ne,{children:t.jsx(xe,{placeholder:"/path/to/project (optional)",...s,value:s.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),t.jsx(se,{})]})})]}),(F==="NPX"||F==="STDIO")&&t.jsx(Z,{control:m.control,name:"env_vars",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"Environment Variables"}),t.jsx(ne,{children:t.jsx(un,{value:s.value??[],onChange:s.onChange})}),t.jsx(se,{})]})}),F!=="NPX"&&F!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(Z,{control:m.control,name:"connection_url",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"URL *"}),t.jsx(ne,{children:t.jsx(xe,{placeholder:"https://example.com/mcp",...s,value:s.value??"",onPaste:i=>{const a=i.clipboardData.getData("text");a&&(i.preventDefault(),m.setValue("connection_url",a.trim(),{shouldDirty:!0}),ke(a))},onBlur:i=>{ke(i.target.value),s.onBlur()}})}),t.jsx(se,{})]})}),t.jsx(Z,{control:m.control,name:"connection_token",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:de?.token?.label??"Token (optional)"}),t.jsx(ne,{children:t.jsx(xe,{type:"password",placeholder:de?.token?.placeholder??"Bearer token or API key",...s,value:s.value??""})}),de?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[de.token.helperText,de.id==="github"&&t.jsxs(t.Fragment,{children:[" ","·"," ",t.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),t.jsx(se,{})]})})]}),t.jsx(Z,{control:m.control,name:"title",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"Name *"}),t.jsx(ne,{children:t.jsx(xe,{placeholder:"My Connection",...s})}),t.jsx(se,{})]})}),t.jsx(Z,{control:m.control,name:"description",render:({field:s})=>t.jsxs(ee,{children:[t.jsx(te,{children:"Description"}),t.jsx(ne,{children:t.jsx(Yt,{placeholder:"A brief description of this connection",rows:3,...s,value:s.value??""})}),t.jsx(se,{})]})})]}),t.jsxs(at,{children:[t.jsx(O,{type:"button",variant:"outline",onClick:()=>tt(!1),children:"Cancel"}),t.jsx(O,{type:"submit",disabled:m.formState.isSubmitting,className:"min-w-40",children:m.formState.isSubmitting?"Saving...":D?"Update Connection":"Create Connection"})]})]})})]})}),t.jsx(Oe,{open:d.mode==="deleting",onOpenChange:s=>!s&&f({type:"close"}),children:t.jsxs(ze,{children:[t.jsxs(Le,{children:[t.jsx(Ve,{children:"Delete Connection?"}),t.jsxs(Fe,{children:["This action cannot be undone. This will permanently delete"," ",t.jsx("span",{className:"font-medium text-foreground",children:d.mode==="deleting"&&d.connection.title}),"."]})]}),t.jsxs(Be,{children:[t.jsx(Ue,{children:"Cancel"}),t.jsx(Me,{onClick:pt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t.jsx(Oe,{open:d.mode==="force-deleting",onOpenChange:s=>!s&&f({type:"close"}),children:t.jsxs(ze,{children:[t.jsxs(Le,{children:[t.jsx(Ve,{children:"Connection Used by Agents"}),t.jsx(Fe,{asChild:!0,children:t.jsxs("div",{children:[t.jsxs("p",{children:["The connection"," ",t.jsx("span",{className:"font-medium text-foreground",children:d.mode==="force-deleting"&&d.connection.title})," ","is currently used by the following agent(s):"," ",t.jsx("span",{className:"font-medium text-foreground",children:d.mode==="force-deleting"&&d.agentNames}),"."]}),t.jsx("p",{className:"mt-2",children:"Deleting this connection will remove it from those agents, which may impact existing workflows that depend on them."})]})})]}),t.jsxs(Be,{children:[t.jsx(Ue,{children:"Cancel"}),t.jsx(Me,{onClick:xt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Anyway"})]})]})}),t.jsx(Pn,{open:y,onOpenChange:w,count:x.size,onConfirm:ue}),t.jsx(In,{open:_,onOpenChange:N,agents:b,onConfirm:R}),t.jsxs(ve.Header,{children:[t.jsx(ve.Header.Left,{children:t.jsx(Rt,{children:t.jsx(Ht,{children:t.jsx(Xt,{children:t.jsxs(Kt,{className:"flex items-center gap-2",children:["Connections",t.jsxs("span",{className:"text-xs font-normal text-muted-foreground tabular-nums",children:[v.total," total",v.active>0&&` · ${v.active} active`,v.error>0&&` · ${v.error} errors`]})]})})})})}),t.jsxs(ve.Header.Right,{children:[t.jsx(At,{viewMode:r.viewMode,onViewModeChange:r.setViewMode,sortKey:r.sortKey,sortDirection:r.sortDirection,onSort:r.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"updated_by",label:"Updated by"},{id:"updated_at",label:"Updated"}],filters:[{label:"Type",value:I,onChange:s=>A(s||"ALL"),options:[{id:"ALL",label:"All"},{id:"HTTP",label:"HTTP"},{id:"SSE",label:"SSE"},{id:"Websocket",label:"WebSocket"},{id:"STDIO",label:"STDIO"}]},{label:"Status",value:z,onChange:s=>U(s||"ALL"),options:[{id:"ALL",label:"All"},{id:"active",label:"Active"},{id:"inactive",label:"Inactive"},{id:"error",label:"Error"}]}]}),gt]})]}),t.jsx("div",{className:"flex items-center gap-3 px-5 pb-0",children:t.jsx("div",{className:"flex-1",children:t.jsx($t,{value:r.search,onChange:r.setSearch,placeholder:"Search for a Connection...",onKeyDown:s=>{s.key==="Escape"&&(r.setSearch(""),s.target.blur())}})})}),t.jsx(ve.Content,{children:r.viewMode==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:k.length===0?t.jsx($e,{image:t.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:"No Connections found",description:r.search?`No Connections match "${r.search}"`:"Create a connection to get started.",actions:!r.search&&t.jsx(O,{variant:"outline",onClick:()=>n({to:"/$org/$project/store",params:{org:o.slug,project:Q}}),children:"Browse Store"})}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:M.map(s=>{if(s.type==="group")return t.jsx(_n,{group:s,onNavigate:a=>n({to:"/$org/$project/mcps/$connectionId",params:{org:o.slug,project:Q,connectionId:a}}),onDelete:a=>f({type:"delete",connection:a}),selectionMode:p,selectedIds:x,onToggleSelect:V},s.key);const i=s.connection;return t.jsxs("div",{className:"relative",children:[p&&t.jsx("div",{className:"absolute top-3 left-3 z-10",children:t.jsx(De,{checked:x.has(i.id),onCheckedChange:()=>V(i.id)})}),t.jsx(lt,{connection:i,fallbackIcon:t.jsx(he,{}),onClick:()=>p?V(i.id):n({to:"/$org/$project/mcps/$connectionId",params:{org:o.slug,project:Q,connectionId:i.id}}),className:oe(p&&x.has(i.id)&&"ring-2 ring-primary"),headerActions:p?void 0:t.jsxs(He,{children:[t.jsx(Xe,{asChild:!0,children:t.jsx(O,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:a=>a.stopPropagation(),children:t.jsx(We,{size:20})})}),t.jsxs(Ke,{align:"end",onClick:a=>a.stopPropagation(),children:[t.jsxs(fe,{onClick:a=>{a.stopPropagation(),n({to:"/$org/$project/mcps/$connectionId",params:{org:o.slug,project:Q,connectionId:i.id}})},children:[t.jsx(Ge,{size:16}),"Open"]}),t.jsxs(fe,{variant:"destructive",onClick:a=>{a.stopPropagation(),f({type:"delete",connection:i})},children:[t.jsx(Ie,{size:16}),"Delete"]})]})]}),body:t.jsx(Te,{status:i.status}),footer:t.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground w-full min-w-0",children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx(be,{id:i.updated_by??i.created_by,size:"3xs"})}),t.jsx("span",{className:"shrink-0 ml-2",children:i.updated_at?_e(new Date(i.updated_at)):"—"})]})})]},i.id)})})}):t.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:t.jsx("div",{className:"flex-1 overflow-auto min-w-0",children:t.jsx("div",{className:"min-w-[1000px]",children:t.jsx(An,{columns:ft,grouped:M,sortKey:r.sortKey,sortDirection:r.sortDirection,onSort:r.handleSort,onRowClick:s=>p?V(s.id):n({to:"/$org/$project/mcps/$connectionId",params:{org:o.slug,project:Q,connectionId:s.id}}),selectionMode:p,selectedIds:x,onToggleSelect:V,emptyState:r.search?t.jsx($e,{image:t.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:`No Connections match "${r.search}"`}):t.jsx($e,{image:t.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:t.jsx(O,{variant:"outline",onClick:()=>n({to:"/$org/$project/store",params:{org:o.slug,project:Q}}),children:"Browse Store"})})})})})})}),p&&t.jsx(Dn,{count:x.size,total:k.length,onSelectAll:()=>{j(new Set(k.map(s=>s.id)))},onDeselectAll:()=>j(new Set),onDelete:()=>w(!0),onAddToAgent:()=>N(!0),onToggleStatus:je,onCancel:X})]})}function Hs(){const o=ge.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(yt,{children:t.jsx(H.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ln,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(On,{})})}),o[0]=e):e=o[0],e}export{Hs as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bC as h,c as d,m as g,bD as y}from"./index-
|
|
1
|
+
import{bC as h,c as d,m as g,bD as y}from"./index-PEK2-Gur.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 _ extends h{constructor(e,n){super(e,n)}send(e,n){const o=C(e);return o?.type==="emit"?(this.onmessage?.(o.message),Promise.resolve()):o?.type==="suppress"?Promise.resolve():super.send(e,n)}}function C(t){const e=t;if(!e||typeof e!="object"||!("method"in e))return null;switch(e.method){case"initialize":{const n=e?.params?.protocolVersion;return n?{type:"emit",message:{result:{protocolVersion:n,capabilities:{tools:{},resources:{},prompts:{},tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}},serverInfo:{name:"mesh-virtual-mcp",version:"1.0.0"}},jsonrpc:e.jsonrpc??"2.0",id:e.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}const b={name:"mesh-sdk",version:"1.0.0"};function T(t,e){const n=e??(typeof window<"u"?window.location.origin:void 0);if(!n)throw new Error("MCP client requires either meshUrl option or a browser environment.");const o=t?`/mcp/${t}`:"/mcp";return new URL(o,n).href}async function f({connectionId:t,orgId:e,token:n,meshUrl:o}){const i=T(t,o),c=new y(b,{capabilities:{tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}}}),r=new _(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 l=m.mcpClient(e,t??"self",n??"",o??"");return c.toJSON=()=>`mcp-client:${l.join(":")}`,c}function w(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 l=r;let s;e[5]!==n||e[6]!==c||e[7]!==o||e[8]!==i?(s=()=>f({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 a;e[10]!==l||e[11]!==s?(a={queryKey:l,queryFn:s,staleTime:1/0,gcTime:0},e[10]=l,e[11]=s,e[12]=a):a=e[12];const{data:u}=g(a);return u}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=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 l=r;let s;e[5]!==n||e[6]!==c||e[7]!==o||e[8]!==i?(s=async()=>n===void 0?null:f({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 a;e[10]!==l||e[11]!==s?(a={queryKey:l,queryFn:s,staleTime:1/0,gcTime:0},e[10]=l,e[11]=s,e[12]=a):a=e[12];const{data:u}=g(a);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`},R="self";function M(t){return{id:P.REGISTRY(t),title:"Deco Store",description:"Official deco MCP registry with curated integrations",connection_type:"HTTP",connection_url:"https://api.decocms.com/mcp/registry",icon:"https://assets.decocache.com/decocms/00ccf6c3-9e13-4517-83b0-75ab84554bb9/596364c63320075ca58483660156b6d9de9b526e.png",app_name:"deco-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}function L(){return{id:"community-registry",title:"MCP Registry",description:"Community MCP registry with thousands of handy MCPs",connection_type:"HTTP",connection_url:"https://sites-registry.decocache.com/mcp",icon:"https://assets.decocache.com/decocms/cd7ca472-0f72-463a-b0de-6e44bdd0f9b4/mcp.png",app_name:"mcp-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}function D(t={}){return{id:t.id,title:"OpenRouter",description:"Access hundreds of LLM models from a single API",icon:"https://assets.decocache.com/decocms/b2e2f64f-6025-45f7-9e8c-3b3ebdd073d8/openrouter_logojpg.jpg",app_name:"openrouter",app_id:"openrouter",connection_type:"HTTP",connection_url:"https://sites-openrouter.decocache.com/mcp",connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{source:"chat",verified:!1,scopeName:"deco",toolsCount:0,publishedAt:null,repository:null}}}function E(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 O(t){return!t||!t.startsWith(p)?null:t.slice(p.length)||null}function v(t){return`${p}${t}`}export{m as K,_ as S,P as W,R as a,L as b,f as c,E as d,D as e,M as f,v as g,S as h,O as i,w as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a3 as a,a4 as t}from"./index-PEK2-Gur.js";const e=a(t,{target:"draft-7"});export{e as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as A,s as D,c as O,k as v,l as E,j as r,B as N,d as I}from"./index-
|
|
1
|
+
import{o as A,s as D,c as O,k as v,l as E,j as r,B as N,d as I}from"./index-PEK2-Gur.js";import{A as M,a as L,b as R,c as T,d as $,e as k,f as B}from"./alert-dialog-CtNI8LvE.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-yfGhYWGK.js";import{I as P}from"./input-sgdy4h-T.js";import{S as Q}from"./spinner-BGQowtes.js";import{u as W}from"./useMutation-Bwc-v8Ow.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 se(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(R,{children:[r.jsx(T,{children:"Create a new organization"}),r.jsx($,{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 p;e[6]!==i?(p=b=>i.mutateAsync(b),e[6]=i,e[7]=p):p=e[7],n=t.handleSubmit(p),e[3]=i,e[4]=t,e[5]=n}else n=e[5];let l;e[8]!==t.formState.isSubmitting?(l=p=>{const{field:b}=p;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(M,{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(N,{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(k,{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 x;e[34]!==t||e[35]!==h?(x=r.jsxs(L,{children:[F,r.jsx(q,{...t,children:h})]}),e[34]=t,e[35]=h,e[36]=x):x=e[36];let C;return e[37]!==s||e[38]!==a||e[39]!==x?(C=r.jsx(B,{open:a,onOpenChange:s,children:x}),e[37]=s,e[38]=a,e[39]=x,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 I.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{se as C};
|