decocms 2.178.1 → 2.178.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-CI8iQIN4.js → AlertCircle-12chRuly.js} +1 -1
- package/dist/client/assets/{AlignLeft-D1a9nQq5.js → AlignLeft-_LT9deOt.js} +1 -1
- package/dist/client/assets/{ArrowDown-bcBjuFxH.js → ArrowDown-7rbX3zqZ.js} +1 -1
- package/dist/client/assets/{ArrowLeft-BaV7db3X.js → ArrowLeft-erI8s3G2.js} +1 -1
- package/dist/client/assets/{ArrowUp-BtIkmj4Y.js → ArrowUp-DoIG5eQh.js} +1 -1
- package/dist/client/assets/{Building02-R_mkgdQ4.js → Building02-Dr7IyBdv.js} +1 -1
- package/dist/client/assets/{Check-GOz4_bBS.js → Check-DW8AVFkq.js} +1 -1
- package/dist/client/assets/{CheckCircle-DosFvCW2.js → CheckCircle-hBpanOsI.js} +1 -1
- package/dist/client/assets/{CheckSquare-Be1kXxvn.js → CheckSquare-Cr3IzSXp.js} +1 -1
- package/dist/client/assets/{CheckVerified02-CZakFFpv.js → CheckVerified02-r17ymUCs.js} +1 -1
- package/dist/client/assets/{ChevronDown-DElgod-p.js → ChevronDown-BIRGQoZ5.js} +1 -1
- package/dist/client/assets/{ChevronLeft-Bk7mc5_w.js → ChevronLeft-D-e7F7Gj.js} +1 -1
- package/dist/client/assets/{ChevronRight-Ys0vr-YD.js → ChevronRight-DsjLlugM.js} +1 -1
- package/dist/client/assets/{ChevronUp-CKkWbsZ5.js → ChevronUp-Bi3NMXzv.js} +1 -1
- package/dist/client/assets/{Clock-DRICOB0c.js → Clock-D4xJnA3P.js} +1 -1
- package/dist/client/assets/{Code01-CDxb4LVl.js → Code01-YGq5QwlZ.js} +1 -1
- package/dist/client/assets/{Container-C8ScaknS.js → Container-DHyMOW_p.js} +1 -1
- package/dist/client/assets/{Copy01-DhAVspEC.js → Copy01-DkcjIGiS.js} +1 -1
- package/dist/client/assets/{Dataflow03-ONoSH2VT.js → Dataflow03-CD3eo8oO.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-BaiN7u8r.js → DotsHorizontal-CjYGc80C.js} +1 -1
- package/dist/client/assets/{DotsVertical-rvqtR29a.js → DotsVertical-2nyye7GD.js} +1 -1
- package/dist/client/assets/{Download01-CVEqgoRT.js → Download01-BvtNZalG.js} +1 -1
- package/dist/client/assets/{Edit01-BaPedGGl.js → Edit01-CoeKfJ-u.js} +1 -1
- package/dist/client/assets/{Edit05-DSl3Jqkp.js → Edit05-CbbEzOoe.js} +1 -1
- package/dist/client/assets/{Eye-BgAytXDm.js → Eye-hBqNQHpc.js} +1 -1
- package/dist/client/assets/{EyeOff-CucokIoZ.js → EyeOff-CJoTkAtN.js} +1 -1
- package/dist/client/assets/{File02-gbFS8GtC.js → File02-D19u2hUl.js} +1 -1
- package/dist/client/assets/{File06-Dpi3gJhU.js → File06-Bp4ioOvR.js} +1 -1
- package/dist/client/assets/{FilterLines-BeHTcRH-.js → FilterLines-Dvk7BhWf.js} +1 -1
- package/dist/client/assets/{Globe01-Ceb6Pyzg.js → Globe01-B8Ib7knn.js} +1 -1
- package/dist/client/assets/{Globe02-4oAOo4_d.js → Globe02-wRhoc1N5.js} +1 -1
- package/dist/client/assets/{Grid01-NwJJaoW7.js → Grid01-C5e9ReQ4.js} +1 -1
- package/dist/client/assets/{Home02-DQJpzzIE.js → Home02-JZJR9jmQ.js} +1 -1
- package/dist/client/assets/{Image01-BwGUDEUi.js → Image01-DjoSkYp_.js} +1 -1
- package/dist/client/assets/{Inbox01-CDOpLWwZ.js → Inbox01-ClVaT7W5.js} +1 -1
- package/dist/client/assets/{InfoCircle-CfTVXLYm.js → InfoCircle-DzyfpQes.js} +1 -1
- package/dist/client/assets/{Key01-BZkaWvm5.js → Key01-qNySmY39.js} +1 -1
- package/dist/client/assets/{LayersTwo01-D9dHuPjU.js → LayersTwo01-dfSlQT0y.js} +1 -1
- package/dist/client/assets/{LayoutLeft-BHhw95T0.js → LayoutLeft-B2KZfn2n.js} +1 -1
- package/dist/client/assets/{Link01-CU6UcWFS.js → Link01-Cz_ZRKoB.js} +1 -1
- package/dist/client/assets/{LinkExternal01-DOdBEG1U.js → LinkExternal01-CKvCiQnV.js} +1 -1
- package/dist/client/assets/{List-DD3BKPLz.js → List-NLa0AhO4.js} +1 -1
- package/dist/client/assets/{Loading01-B85tVuIU.js → Loading01-Bb8FCosd.js} +1 -1
- package/dist/client/assets/{Lock01-WwvDQaaT.js → Lock01-CnZITIks.js} +1 -1
- package/dist/client/assets/{Play-DTPauCd1.js → Play-Bw5lQw7j.js} +1 -1
- package/dist/client/assets/{Plus-C9dY5EOr.js → Plus-CajZ9VfC.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-DJsZi8Hz.js → RefreshCcw01-B_NTitRE.js} +1 -1
- package/dist/client/assets/{Save01-COu7GfwR.js → Save01-8oEsqMkJ.js} +1 -1
- package/dist/client/assets/{SearchMd-CKp0BoPW.js → SearchMd-eZWeU0sP.js} +1 -1
- package/dist/client/assets/{Settings01-DunsMQ-m.js → Settings01-ClPVpLPy.js} +1 -1
- package/dist/client/assets/{Shield01-CCMtDdxH.js → Shield01-N4ace-oo.js} +1 -1
- package/dist/client/assets/{Terminal-COsHV7Wy.js → Terminal-CGwuP-_5.js} +1 -1
- package/dist/client/assets/{Tool01-Delk_MGO.js → Tool01-D1m8i7Ez.js} +1 -1
- package/dist/client/assets/{Trash01-BtiNjuw3.js → Trash01-B_4PTwjI.js} +1 -1
- package/dist/client/assets/{Upload01-DqqcM3M6.js → Upload01-CLIOr3Tj.js} +1 -1
- package/dist/client/assets/{Users03-CQa5jfkV.js → Users03-Bv-hUQkl.js} +1 -1
- package/dist/client/assets/{X-CaaFSPD_.js → X-LzehymHS.js} +1 -1
- package/dist/client/assets/{XClose-Dey3r3af.js → XClose-CcNXqPQc.js} +1 -1
- package/dist/client/assets/{Zap-DX02pf-a.js → Zap-BFN1DqIC.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-BCTZ6BnP.js → agent-connections-preview-3pYXfstj.js} +1 -1
- package/dist/client/assets/{agent-detail-BBSZrHWb.js → agent-detail-DMK-u3yi.js} +1 -1
- package/dist/client/assets/{agents-DVOxH2hb.js → agents-Wfe5dNfh.js} +1 -1
- package/dist/client/assets/{ai-providers-logos-BWU0RfRJ.js → ai-providers-logos-CCp39UCk.js} +1 -1
- package/dist/client/assets/{alert-dialog-BGZzdkI2.js → alert-dialog-B_ae3oRt.js} +1 -1
- package/dist/client/assets/{auth-catchall-1PjzZ5eD.js → auth-catchall-DAx9m28t.js} +1 -1
- package/dist/client/assets/{automation-detail-dSH73muX.js → automation-detail-DfFkGT_5.js} +1 -1
- package/dist/client/assets/{automations-CEr8CMbK.js → automations-A8NOzTSS.js} +1 -1
- package/dist/client/assets/{avatar-DWAYNsNK.js → avatar-B2yArl-q.js} +1 -1
- package/dist/client/assets/{badge-B_BTuJZe.js → badge-DtRom7JO.js} +1 -1
- package/dist/client/assets/{binder-l1kCmNCE.js → binder-D4cqx_Kx.js} +1 -1
- package/dist/client/assets/{breadcrumb-ijphtzQp.js → breadcrumb-C2RG4nAQ.js} +1 -1
- package/dist/client/assets/{card-CwEWrOs9.js → card-B8qDZGCZ.js} +1 -1
- package/dist/client/assets/{checkbox-B_91sMwd.js → checkbox-B1rexahu.js} +1 -1
- package/dist/client/assets/{collapsible-DILfwVxb.js → collapsible-BtjeaBAE.js} +1 -1
- package/dist/client/assets/{collection-detail-lkCxiUzr.js → collection-detail-BaBGI9i2.js} +1 -1
- package/dist/client/assets/{collection-display-button-kCOiEzLn.js → collection-display-button-CpVZ4wHm.js} +1 -1
- package/dist/client/assets/{collection-search-Bdxpglbf.js → collection-search-BYV7N3mr.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-D-vPJPam.js → collection-table-wrapper-CHFJQd21.js} +1 -1
- package/dist/client/assets/{collection-tabs-IdlFD1jR.js → collection-tabs-CJEa3dRy.js} +1 -1
- package/dist/client/assets/{command-BgTh2_vK.js → command-Drksh_DO.js} +1 -1
- package/dist/client/assets/{connection-card-BWZAp_hO.js → connection-card-Bak2l1_M.js} +1 -1
- package/dist/client/assets/{connection-detail-DPSHmWyz.js → connection-detail-BKy2ZsS6.js} +1 -1
- package/dist/client/assets/{connections-BvYzdmU4.js → connections-Dxf4eIOE.js} +1 -1
- package/dist/client/assets/{constants-BCt7c81T.js → constants-D7qXOYRn.js} +1 -1
- package/dist/client/assets/{context-BTMVzdan.js → context-DxQMlFKC.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-Du7uAMNm.js → create-organization-dialog-CNWB-72r.js} +1 -1
- package/dist/client/assets/{create-project-dialog-Bb7dubB7.js → create-project-dialog-BeIY4Oy9.js} +1 -1
- package/dist/client/assets/{danger-CfnLHwII.js → danger-YWbxrjNq.js} +1 -1
- package/dist/client/assets/{danger-zone-DjN4GhuT.js → danger-zone-DGg0ZzSy.js} +1 -1
- package/dist/client/assets/{dependencies-CwSG23CA.js → dependencies-DtAVTWu-.js} +1 -1
- package/dist/client/assets/{dialog-BDa2Gsq9.js → dialog-ChXYvlDt.js} +1 -1
- package/dist/client/assets/{dropdown-menu-DEQ5DCnG.js → dropdown-menu-BxlQMXgW.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-DP6UGwOE.js → dynamic-plugin-layout-JpZTv0Ay.js} +1 -1
- package/dist/client/assets/{editable-task-title-CaE6DIBf.js → editable-task-title-Cm-uIwFs.js} +1 -1
- package/dist/client/assets/{empty-state-DmgqwjeV.js → empty-state-qLM_bVsv.js} +1 -1
- package/dist/client/assets/{empty-state-C4c2sKjV.js → empty-state-xIvMMy-_.js} +1 -1
- package/dist/client/assets/{env-vars-editor-Ah5xyGmz.js → env-vars-editor-Yss1wn0m.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BxJWN5u-.js → extract-connection-data-48N591A_.js} +1 -1
- package/dist/client/assets/{file-browser-BRFmGA__.js → file-browser-BbqpPFZK.js} +2 -2
- package/dist/client/assets/{form-BWoxqZfk.js → form-CaFPTMVC.js} +1 -1
- package/dist/client/assets/{general-BKqD1lIr.js → general-DI9irVIQ.js} +1 -1
- package/dist/client/assets/{generate-id-BaIFvm62.js → generate-id-BiV6m8fS.js} +1 -1
- package/dist/client/assets/{grid-view-DGZvuOwZ.js → grid-view-DurgUMuo.js} +1 -1
- package/dist/client/assets/{home-B7jB9Gxp.js → home-CspK560n.js} +1 -1
- package/dist/client/assets/{index-BgoahoDu.js → index-ChUIqRBi.js} +1 -1
- package/dist/client/assets/{index--PLXALUm.js → index-CqWJIMlG.js} +1 -1
- package/dist/client/assets/{index-WTO-ZRzC.js → index-CqtWW-Tq.js} +1 -1
- package/dist/client/assets/{index-10S4l3se.js → index-CqyqI90F.js} +1 -1
- package/dist/client/assets/{index-DZ6p-ZXx.js → index-De1iYnQy.js} +1 -1
- package/dist/client/assets/{index-DcxE8oe_.js → index-NjMxPJgF.js} +3 -3
- package/dist/client/assets/{index-DGLQ2uQ5.js → index-TV8hw8s3.js} +1 -1
- package/dist/client/assets/{index-Bc448aeG.js → index-YL7q5tyF.js} +1 -1
- package/dist/client/assets/{index-CTjqFNkw.js → index-YRudAQp7.js} +1 -1
- package/dist/client/assets/{index-B5vgf28x.js → index-yiVP4brl.js} +1 -1
- package/dist/client/assets/{index-CM7_8eMu.js → index-zWpUeKAz.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-CzIVu_kK.js → infiniteQueryObserver-JZ0YxCW-.js} +1 -1
- package/dist/client/assets/{input-DPpAbHbD.js → input-B89sozd8.js} +1 -1
- package/dist/client/assets/{integration-icon-6jcHFHZV.js → integration-icon-BPVDVJvP.js} +1 -1
- package/dist/client/assets/{label-BtaiiWJ8.js → label-DkiEYJcU.js} +1 -1
- package/dist/client/assets/{layout-Cjef80qc.js → layout-Cqn-h1Jz.js} +1 -1
- package/dist/client/assets/{layout-DG9LlvE6.js → layout-DcmGLVHZ.js} +1 -1
- package/dist/client/assets/{login-D1Xb70mS.js → login-qT_ItpIx.js} +1 -1
- package/dist/client/assets/{logo-upload-79T6Ecg3.js → logo-upload-CoGaedUC.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-DgOOTmoQ.js → mcp-app-renderer-By1mQEU9.js} +1 -1
- package/dist/client/assets/{mcp-server-card-CqBs71hZ.js → mcp-server-card-B3Nrrgyk.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-D_BCRi3w.js → mcp-server-detail-DMfy0V9h.js} +2 -2
- package/dist/client/assets/{members-BkdG_-Nh.js → members-Q81LXZu1.js} +1 -1
- package/dist/client/assets/{monaco-editor-D5smiy7k.js → monaco-editor-ZB27PMAe.js} +1 -1
- package/dist/client/assets/{monitoring-kw0ipyvO.js → monitoring-C31A03PZ.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-edit-S2Ut1cvD.js → monitoring-dashboard-edit-Dfi8Jxeb.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-view-gNG_IQ8M.js → monitoring-dashboard-view-CxjxBHLW.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-D3PlzPcP.js → monitoring-stats-row-CAn-8pVZ.js} +1 -1
- package/dist/client/assets/{oauth-callback-9ngEzskH.js → oauth-callback-B8DRnSok.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-CpdQKMVl.js → oauth-callback-ai-provider-CsTCxPAY.js} +1 -1
- package/dist/client/assets/{org-ai-providers-CrQ3OeB5.js → org-ai-providers-DaYyItUL.js} +1 -1
- package/dist/client/assets/{page-C2HdbsvN.js → page-BjLk0DX_.js} +1 -1
- package/dist/client/assets/{page-DmVGFJaY.js → page-C2I5Nlmu.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-DXhpvNlI.js → plugin-empty-state-K02oXRNN.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-CWxRJkeE.js → plugin-empty-state-l30u7dec.js} +1 -1
- package/dist/client/assets/{plugin-header-C3JJ8Nq_.js → plugin-header-B_wkRb4Y.js} +1 -1
- package/dist/client/assets/{plugin-header-TcX-3hN2.js → plugin-header-CE-BhILm.js} +1 -1
- package/dist/client/assets/plugins-6p4XZdw1.js +1 -0
- package/dist/client/assets/{popover-CNIkv0WT.js → popover-Br8QkMK3.js} +1 -1
- package/dist/client/assets/{project-app-view-BVSK5NCb.js → project-app-view-CRe7LVZk.js} +1 -1
- package/dist/client/assets/{project-layout-Bd1vlG83.js → project-layout-Bg1hlIaM.js} +1 -1
- package/dist/client/assets/{project-plugins-az_ZXSwN.js → project-plugins-BHOZZsH7.js} +1 -1
- package/dist/client/assets/{projects-list-D8eiYeUr.js → projects-list-i4ZvUqtI.js} +1 -1
- package/dist/client/assets/{registry-layout-BXceDqEw.js → registry-layout-DQV7LhSo.js} +1 -1
- package/dist/client/assets/{registry-utils-CkCRcmq4.js → registry-utils-cjX9P5J9.js} +1 -1
- package/dist/client/assets/{reset-password-xlfm2d95.js → reset-password-Cgcrl5ZG.js} +1 -1
- package/dist/client/assets/{resizable-B7fIdnoq.js → resizable-Nu1SqaJD.js} +1 -1
- package/dist/client/assets/{save-actions-DIKaTzi7.js → save-actions-CVl6VtT2.js} +1 -1
- package/dist/client/assets/{scroll-area-B-pB6oMr.js → scroll-area-BTJQ86Ry.js} +1 -1
- package/dist/client/assets/{select-DeNgR918.js → select-Dx3T3-4n.js} +1 -1
- package/dist/client/assets/{select-virtual-mcp-CFDIRCp8.js → select-virtual-mcp-BS537pmy.js} +1 -1
- package/dist/client/assets/{sheet-BBLyN2xl.js → sheet-C3HM0Uwr.js} +1 -1
- package/dist/client/assets/{shell-layout-CiKn6BP6.js → shell-layout-Bco0BFOl.js} +2 -2
- package/dist/client/assets/{sidebar-settings-DOwlHFdj.js → sidebar-settings-JhN4X_jg.js} +1 -1
- package/dist/client/assets/{skeleton-CNgs5GJt.js → skeleton-Cjm8s7CT.js} +1 -1
- package/dist/client/assets/{spinner-BZdAS5i2.js → spinner-Dzx7B3Jl.js} +1 -1
- package/dist/client/assets/{store-invite-BXcKXIzr.js → store-invite-BPcFU0aw.js} +1 -1
- package/dist/client/assets/{switch-CmREXk8C.js → switch-CA_oYDia.js} +1 -1
- package/dist/client/assets/{table-C4WVepD4.js → table-C-1rP_rt.js} +1 -1
- package/dist/client/assets/{tabs-BeYHPY-1.js → tabs-BSOe8gLq.js} +1 -1
- package/dist/client/assets/{task-status-DauQRqAW.js → task-status-DYx9R7EL.js} +1 -1
- package/dist/client/assets/tasks-D1X8oLa3.js +1 -0
- package/dist/client/assets/{tasks-panel-DqbQRMGq.js → tasks-panel-BJ3TfA-_.js} +1 -1
- package/dist/client/assets/{textarea-C7YqhWTc.js → textarea-DIJzFUWn.js} +1 -1
- package/dist/client/assets/{time-range-picker-CM-9xODE.js → time-range-picker-CGBh-D6p.js} +1 -1
- package/dist/client/assets/{toggle-group-B7g3fYap.js → toggle-group-DlZGDyPQ.js} +1 -1
- package/dist/client/assets/{tools-list-4D_tBiUe.js → tools-list-D-T64862.js} +1 -1
- package/dist/client/assets/{tooltip-CXZH0tSC.js → tooltip-BJMSu0c2.js} +1 -1
- package/dist/client/assets/{topbar-portal-CjA9qO3_.js → topbar-portal-ChPXVsi1.js} +1 -1
- package/dist/client/assets/{types-CPj3Y6i2.js → types-BHeMLyAV.js} +1 -1
- package/dist/client/assets/{use-automations-B0CZymwk.js → use-automations-Bmw3x7Dk.js} +1 -1
- package/dist/client/assets/{use-collections-CObsJD7p.js → use-collections-C0cYiFfV.js} +1 -1
- package/dist/client/assets/{use-connection-Cv_-e2MS.js → use-connection-CHFdKnsr.js} +1 -1
- package/dist/client/assets/{use-copy-sxHnzQ3E.js → use-copy-xhdji_Bl.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-dSjfTRl8.js → use-create-virtual-mcp-B7odZ_c3.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-CqxPDCSp.js → use-infinite-scroll-CPhZNIw7.js} +1 -1
- package/dist/client/assets/{use-install-from-registry-wW1d1HtB.js → use-install-from-registry-BzwuBLOx.js} +1 -1
- package/dist/client/assets/{use-list-state-CWVUvMhj.js → use-list-state-CbsN6RbJ.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-C4X4lEEg.js → use-mcp-prompts-Bel4H4rh.js} +1 -1
- package/dist/client/assets/{use-mcp-resources-DoUnZI9j.js → use-mcp-resources-qGdymfRz.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-Cnh4vEBm.js → use-mcp-tools-BCZI_Wqc.js} +1 -1
- package/dist/client/assets/{use-members-BHa-Fb-h.js → use-members-B4ncWtMV.js} +1 -1
- package/dist/client/assets/{use-mobile-v2XXLV0O.js → use-mobile-DOUfTohp.js} +1 -1
- package/dist/client/assets/{use-project-B-9YXhNP.js → use-project-b5C3lq5-.js} +1 -1
- package/dist/client/assets/{use-store-discovery-z8nwAYJJ.js → use-store-discovery-B402mTHd.js} +1 -1
- package/dist/client/assets/{use-view-mode-XMRPR1ke.js → use-view-mode-ss3eRodO.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-DfPJ-WDb.js → use-virtual-mcp-BP6aaUzw.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-BXDrDvlH.js +1 -0
- package/dist/client/assets/{useMutation-CV3IN68C.js → useMutation-68NxhXCf.js} +1 -1
- package/dist/client/assets/useQuery-BYBCFxgb.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-X3jXt04i.js +1 -0
- package/dist/client/assets/{user-_Hc5WOWn.js → user-iDZRuimU.js} +1 -1
- package/dist/client/assets/{workflow-DKAllKJO.js → workflow-CrrTPehP.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +2 -2
- package/dist/server/migrate.js +1 -1
- package/dist/server/node_modules/pg-connection-string/LICENSE +21 -0
- package/dist/server/node_modules/pg-connection-string/README.md +105 -0
- package/dist/server/node_modules/pg-connection-string/esm/index.mjs +8 -0
- package/dist/server/node_modules/pg-connection-string/index.d.ts +36 -0
- package/dist/server/node_modules/pg-connection-string/index.js +231 -0
- package/dist/server/node_modules/pg-connection-string/package.json +52 -0
- package/dist/server/node_modules/{pg → pg-pool}/LICENSE +1 -1
- package/dist/server/node_modules/pg-pool/README.md +357 -0
- package/dist/server/node_modules/pg-pool/esm/index.mjs +5 -0
- package/dist/server/node_modules/pg-pool/index.js +517 -0
- package/dist/server/node_modules/pg-pool/package.json +51 -0
- package/dist/server/server.js +2 -2
- package/package.json +1 -1
- package/dist/client/assets/plugins-BfcAD8Xs.js +0 -1
- package/dist/client/assets/tasks-fQ7kFf17.js +0 -1
- package/dist/client/assets/useInfiniteQuery-BIejUr4H.js +0 -1
- package/dist/client/assets/useQuery-CEE9SUlS.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-B7NkSjI9.js +0 -1
- package/dist/server/node_modules/pg/README.md +0 -95
- package/dist/server/node_modules/pg/esm/index.mjs +0 -20
- package/dist/server/node_modules/pg/lib/client.js +0 -743
- package/dist/server/node_modules/pg/lib/connection-parameters.js +0 -171
- package/dist/server/node_modules/pg/lib/connection.js +0 -221
- package/dist/server/node_modules/pg/lib/crypto/cert-signatures.js +0 -122
- package/dist/server/node_modules/pg/lib/crypto/sasl.js +0 -212
- package/dist/server/node_modules/pg/lib/crypto/utils-legacy.js +0 -43
- package/dist/server/node_modules/pg/lib/crypto/utils-webcrypto.js +0 -89
- package/dist/server/node_modules/pg/lib/crypto/utils.js +0 -9
- package/dist/server/node_modules/pg/lib/defaults.js +0 -91
- package/dist/server/node_modules/pg/lib/index.js +0 -73
- package/dist/server/node_modules/pg/lib/native/client.js +0 -323
- package/dist/server/node_modules/pg/lib/native/index.js +0 -2
- package/dist/server/node_modules/pg/lib/native/query.js +0 -165
- package/dist/server/node_modules/pg/lib/query.js +0 -252
- package/dist/server/node_modules/pg/lib/result.js +0 -109
- package/dist/server/node_modules/pg/lib/stream.js +0 -83
- package/dist/server/node_modules/pg/lib/type-overrides.js +0 -35
- package/dist/server/node_modules/pg/lib/utils.js +0 -217
- package/dist/server/node_modules/pg/package.json +0 -76
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as k,j as r,D as C}from"./index-
|
|
1
|
+
import{c as k,j as r,D as C}from"./index-NjMxPJgF.js";import{c as S,a as R,b as T,e as H,d as L,T as D}from"./table-C-1rP_rt.js";import{n as z}from"./ArrowDown-7rbX3zqZ.js";import{i as E}from"./ArrowUp-DoIG5eQh.js";function I(y){const e=k.c(29),{columns:s,data:f,sortKey:u,sortDirection:x,onSort:i,onRowClick:n,rowClassName:c}=y;let p;e[0]!==x?(p=function(t,h){return r.jsx("div",{className:"w-4 flex items-center justify-center",children:h&&x&&(x==="asc"?r.jsx(E,{size:16,className:"text-muted-foreground transition-colors"}):r.jsx(z,{size:16,className:"text-muted-foreground transition-colors"}))})},e[0]=x,e[1]=p):p=e[1];const b=p;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=function(t,h){let N="px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider";return t===h-1&&(N="px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider w-8"),N},e[2]=d):d=e[2];const a=d;let o;if(e[3]!==s||e[4]!==i||e[5]!==b||e[6]!==u){let l;e[8]!==s.length||e[9]!==i||e[10]!==b||e[11]!==u?(l=(t,h)=>{const N=u===t.id;return r.jsx(S,{className:C(a(h,s.length),"group transition-colors select-none",t.sortable&&"hover:bg-accent cursor-pointer",t.rowClassName,t.cellClassName),onClick:t.sortable&&i?()=>i(t.id):void 0,children:r.jsxs("span",{className:"flex items-center gap-1",children:[t.header,t.sortable&&b(t.id,N)]})},t.id)},e[8]=s.length,e[9]=i,e[10]=b,e[11]=u,e[12]=l):l=e[12],o=s.map(l),e[3]=s,e[4]=i,e[5]=b,e[6]=u,e[7]=o}else o=e[7];let g;e[13]!==o?(g=r.jsx(R,{className:"border-b-0",children:r.jsx(T,{className:"h-9 hover:bg-transparent border-b border-border",children:o})}),e[13]=o,e[14]=g):g=e[14];let j;if(e[15]!==s||e[16]!==f||e[17]!==n||e[18]!==c){let l;e[20]!==s||e[21]!==n||e[22]!==c?(l=(t,h)=>{const N=c?.(t);return r.jsx(T,{"data-row-index":h,className:C("group/data-row transition-colors border-b-0 hover:bg-accent/50",n?"cursor-pointer":"",N),onClick:n?()=>n(t):void 0,children:s.map(m=>r.jsx(H,{className:C("px-5 py-4 h-16 align-middle text-sm text-foreground",m.cellClassName,m.wrap?"whitespace-normal wrap-break-word":""),children:r.jsx("div",{className:C(m.wrap?"w-full":"min-w-0 w-full",!m.wrap&&"truncate overflow-hidden whitespace-nowrap"),children:m.render?m.render(t):m.accessor?m.accessor(t):null})},m.id))},h)},e[20]=s,e[21]=n,e[22]=c,e[23]=l):l=e[23],j=f.map(l),e[15]=s,e[16]=f,e[17]=n,e[18]=c,e[19]=j}else j=e[19];let w;e[24]!==j?(w=r.jsx(L,{children:j}),e[24]=j,e[25]=w):w=e[25];let v;return e[26]!==g||e[27]!==w?(v=r.jsxs(D,{className:"w-full border-collapse",children:[g,w]}),e[26]=g,e[27]=w,e[28]=v):v=e[28],v}function W(y){const e=k.c(12),{columns:s,data:f,isLoading:u,sortKey:x,sortDirection:i,onSort:n,onRowClick:c,emptyState:p}=y;if(u===void 0?!1:u){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx("div",{className:"text-muted-foreground",children:"Loading..."})}),e[0]=a):a=e[0],a}if(f.length===0){let a;e[1]!==p?(a=p||r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"No items found"}),e[1]=p,e[2]=a):a=e[2];let o;return e[3]!==a?(o=r.jsx("div",{className:"flex items-center justify-center h-full",children:a}),e[3]=a,e[4]=o):o=e[4],o}let d;return e[5]!==s||e[6]!==f||e[7]!==c||e[8]!==n||e[9]!==i||e[10]!==x?(d=r.jsx("div",{className:"flex-1 overflow-auto",children:r.jsx(I,{columns:s,data:f,sortKey:x,sortDirection:i,onSort:n,onRowClick:c})}),e[5]=s,e[6]=f,e[7]=c,e[8]=n,e[9]=i,e[10]=x,e[11]=d):d=e[11],d}export{W as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as f,D as u,j as m}from"./index-
|
|
1
|
+
import{c as f,D as u,j as m}from"./index-NjMxPJgF.js";import{B as g}from"./badge-DtRom7JO.js";function h(x){const e=f.c(12),{tabs:l,activeTab:n,onTabChange:s,className:a}=x;let t;e[0]!==a?(t=u("flex items-center gap-2 overflow-x-auto no-scrollbar",a),e[0]=a,e[1]=t):t=e[1];let r;if(e[2]!==n||e[3]!==s||e[4]!==l){let c;e[6]!==n||e[7]!==s?(c=o=>{const d=n===o.id;return m.jsxs("button",{type:"button",onClick:()=>s(o.id),className:u("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex gap-1.5 items-center",d&&"bg-accent border-border text-foreground",!d&&"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:[o.label,o.count!==void 0&&m.jsx(g,{variant:"secondary",className:u("h-5 min-w-5 px-1 rounded-full text-[10px] font-mono inline-flex items-center justify-center",d?"bg-background text-foreground":"bg-muted-foreground/10 text-muted-foreground"),children:o.count})]},o.id)},e[6]=n,e[7]=s,e[8]=c):c=e[8],r=l.map(c),e[2]=n,e[3]=s,e[4]=l,e[5]=r}else r=e[5];let i;return e[9]!==t||e[10]!==r?(i=m.jsx("div",{className:t,children:r}),e[9]=t,e[10]=r,e[11]=i):i=e[11],i}export{h as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as r,D as m,j as n}from"./index-
|
|
1
|
+
import{c as r,D as m,j as n}from"./index-NjMxPJgF.js";import{_ as d}from"./index-zWpUeKAz.js";import{i}from"./SearchMd-eZWeU0sP.js";function x(l){const e=r.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=n.jsx(d,{"data-slot":"command",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}function g(l){const e=r.c(9);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(i,{className:"size-5 shrink-0 text-foreground"}),e[3]=o):o=e[3];let a;e[4]!==t?(a=m("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t),e[4]=t,e[5]=a):a=e[5];let c;return e[6]!==s||e[7]!==a?(c=n.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-10 items-center gap-2 border-b px-3",children:[o,n.jsx(d.Input,{"data-slot":"command-input",className:a,...s})]}),e[6]=s,e[7]=a,e[8]=c):c=e[8],c}function h(l){const e=r.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=n.jsx(d.List,{"data-slot":"command-list",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}function N(l){const e=r.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=n.jsx(d.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t}),e[2]=t,e[3]=s):s=e[3],s}function v(l){const e=r.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=n.jsx(d.Group,{"data-slot":"command-group",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}function b(l){const e=r.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("bg-border -mx-1 h-px",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=n.jsx(d.Separator,{"data-slot":"command-separator",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}function _(l){const e=r.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=n.jsx(d.Item,{"data-slot":"command-item",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}export{v as C,h as a,x as b,g as c,N as d,_ as e,b as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as E,D as I,j as t}from"./index-
|
|
1
|
+
import{c as E,D as I,j as t}from"./index-NjMxPJgF.js";import{C as P}from"./card-B8qDZGCZ.js";import{I as R}from"./integration-icon-BPVDVJvP.js";function q(h){const e=E.c(37),{connection:s,onClick:u,headerActions:j,headerActionsAlwaysVisible:A,body:v,footer:N,className:b,fallbackIcon:C}=h,y=A===void 0?!1:A,k=u&&"hover:bg-muted/50";let i;e[0]!==b||e[1]!==k?(i=I("cursor-pointer transition-colors group overflow-hidden flex flex-col h-full",k,b),e[0]=b,e[1]=k,e[2]=i):i=e[2];let l;e[3]!==s.icon||e[4]!==s.title||e[5]!==C?(l=t.jsx(R,{icon:s.icon,name:s.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:C}),e[3]=s.icon,e[4]=s.title,e[5]=C,e[6]=l):l=e[6];let o;e[7]!==j||e[8]!==y?(o=j&&t.jsx("div",{className:I("transition-opacity",!y&&"opacity-0 group-hover:opacity-100"),onClick:_,children:j}),e[7]=j,e[8]=y,e[9]=o):o=e[9];let n;e[10]!==o?(n=t.jsx("div",{className:"relative",children:o}),e[10]=o,e[11]=n):n=e[11];let c;e[12]!==l||e[13]!==n?(c=t.jsxs("div",{className:"flex items-start justify-between",children:[l,n]}),e[12]=l,e[13]=n,e[14]=c):c=e[14];let r;e[15]!==s.title?(r=t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:s.title}),e[15]=s.title,e[16]=r):r=e[16];const w=s.description||"No description";let a;e[17]!==w?(a=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:w}),e[17]=w,e[18]=a):a=e[18];let d;e[19]!==a||e[20]!==r?(d=t.jsxs("div",{className:"flex flex-col gap-1",children:[r,a]}),e[19]=a,e[20]=r,e[21]=d):d=e[21];let f;e[22]!==v?(f=v&&t.jsx("div",{children:v}),e[22]=v,e[23]=f):f=e[23];let m;e[24]!==d||e[25]!==f||e[26]!==c?(m=t.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[c,d,f]}),e[24]=d,e[25]=f,e[26]=c,e[27]=m):m=e[27];let x;e[28]!==N?(x=N&&t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:"h-14 flex items-center p-4.5",onClick:V,children:N})}),e[28]=N,e[29]=x):x=e[29];let p;e[30]!==m||e[31]!==x?(p=t.jsxs("div",{className:"flex flex-col flex-1",children:[m,x]}),e[30]=m,e[31]=x,e[32]=p):p=e[32];let g;return e[33]!==u||e[34]!==p||e[35]!==i?(g=t.jsx(P,{className:i,onClick:u,children:p}),e[33]=u,e[34]=p,e[35]=i,e[36]=g):g=e[36],g}function V(h){return h.stopPropagation()}function _(h){return h.stopPropagation()}export{q as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as B,c as $,j as t,B as X,D as Ne,u as oe,x as Oe,K as le,O as J,Q as ye,e as re,c4 as xe,y as Ve,p as Me,E as Ee,g as ze,w as Re,t as Le,q as Ue,i as Fe,b as Be,v as Z,a as He}from"./index-DcxE8oe_.js";import{g as We}from"./generate-id-BaIFvm62.js";import{E as Ce}from"./empty-state-C4c2sKjV.js";import{E as Xe,c as Ge,r as Qe,e as _e}from"./env-vars-editor-Ah5xyGmz.js";import{d as Ke}from"./registry-utils-CkCRcmq4.js";import{u as Se,n as qe,S as Je}from"./index-WTO-ZRzC.js";import{u as Ye}from"./use-members-BHa-Fb-h.js";import{A as Ze}from"./avatar-DWAYNsNK.js";import{u as we,b as et,a as ke}from"./use-connection-Cv_-e2MS.js";import{u as ce,a as tt}from"./constants-BCt7c81T.js";import{d as st}from"./use-mcp-tools-Cnh4vEBm.js";import{b as nt}from"./use-mcp-resources-DoUnZI9j.js";import{a as ot}from"./use-mcp-prompts-C4X4lEEg.js";import{B as rt,a as it,b as pe,d as at,e as lt,c as ct}from"./breadcrumb-ijphtzQp.js";import{I as ie}from"./integration-icon-6jcHFHZV.js";import{i as Te}from"./Loading01-B85tVuIU.js";import{s as dt}from"./Plus-C9dY5EOr.js";import{t as Ae}from"./Settings01-DunsMQ-m.js";import{s as de}from"./Trash01-BtiNjuw3.js";import{f as mt,a as ut,b as xt,c as pt,d as ht,e as ft,A as gt,h as jt}from"./alert-dialog-BGZzdkI2.js";import{S as vt,a as bt,b as Nt,c as yt,d as Ct}from"./sheet-BBLyN2xl.js";import{F as U,b as F,c as H,d as R,f as W,e as _t,a as St}from"./form-BWoxqZfk.js";import{I as G}from"./input-DPpAbHbD.js";import{g as me}from"./connection-slug-Bw8dtz1U.js";import{a as wt}from"./layout-DG9LlvE6.js";import{c as kt,C as Tt,B as At,a as It,b as Dt,d as $t,e as Pt}from"./monitoring-stats-row-D3PlzPcP.js";import{b as Ot}from"./use-virtual-mcp-DfPJ-WDb.js";import{i as Ie}from"./ChevronRight-Ys0vr-YD.js";import{t as De}from"./Users03-CQa5jfkV.js";import{T as te,a as Vt,b as se,c as Mt}from"./tabs-BeYHPY-1.js";import{a as Et}from"./Tool01-Delk_MGO.js";import{g as ue}from"./types-CPj3Y6i2.js";import{M as zt}from"./mcp-app-renderer-DgOOTmoQ.js";import{C as Rt}from"./collection-search-Bdxpglbf.js";import{T as Lt}from"./tools-list-4D_tBiUe.js";import{C as Ut}from"./card-CwEWrOs9.js";import{B as Ft}from"./badge-B_BTuJZe.js";import{D as Bt,a as Ht,b as Wt,c as he}from"./dropdown-menu-DEQ5DCnG.js";import{S as fe,a as ge,b as je,c as ve,d as L}from"./select-DeNgR918.js";import{i as Xt}from"./CheckCircle-DosFvCW2.js";import{t as Gt}from"./ChevronDown-DElgod-p.js";import{n as Qt}from"./Container-C8ScaknS.js";import{s as ne}from"./Globe02-4oAOo4_d.js";import{s as Kt}from"./RefreshCcw01-DJsZi8Hz.js";import{i as qt}from"./Terminal-COsHV7Wy.js";import{s as Jt}from"./XClose-Dey3r3af.js";import"./binder-l1kCmNCE.js";import"./File06-Dpi3gJhU.js";import"./Key01-BZkaWvm5.js";import"./extract-connection-data-BxJWN5u-.js";import"./use-install-from-registry-wW1d1HtB.js";import"./index-DGLQ2uQ5.js";import"./index-BgoahoDu.js";import"./ChevronUp-CKkWbsZ5.js";import"./index-CM7_8eMu.js";import"./select-virtual-mcp-CFDIRCp8.js";import"./popover-CNIkv0WT.js";import"./tooltip-CXZH0tSC.js";import"./index-10S4l3se.js";import"./Check-GOz4_bBS.js";import"./SearchMd-CKp0BoPW.js";import"./use-create-virtual-mcp-dSjfTRl8.js";import"./use-collections-CObsJD7p.js";import"./useMutation-CV3IN68C.js";import"./useQuery-CEE9SUlS.js";import"./X-CaaFSPD_.js";import"./label-BtaiiWJ8.js";import"./slugify-CEUa2lfQ.js";import"./index-DZ6p-ZXx.js";import"./collection-display-button-kCOiEzLn.js";import"./ArrowDown-bcBjuFxH.js";import"./ArrowUp-BtIkmj4Y.js";import"./Grid01-NwJJaoW7.js";import"./List-DD3BKPLz.js";import"./collection-table-wrapper-D-vPJPam.js";import"./table-C4WVepD4.js";import"./Eye-BgAytXDm.js";import"./LayersTwo01-D9dHuPjU.js";const $e=({size:s=24,color:e="currentColor",...n})=>B.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},B.createElement("path",{d:"m12 21-.1-.15c-.695-1.042-1.042-1.563-1.5-1.94a4 4 0 0 0-1.378-.737C8.453 18 7.827 18 6.575 18H5.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C2 16.48 2 15.92 2 14.8V6.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C3.52 3 4.08 3 5.2 3h.4c2.24 0 3.36 0 4.216.436a4 4 0 0 1 1.748 1.748C12 6.04 12 7.16 12 9.4M12 21V9.4M12 21l.1-.15c.695-1.042 1.042-1.563 1.5-1.94a3.999 3.999 0 0 1 1.378-.737C15.547 18 16.173 18 17.425 18H18.8c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C22 16.48 22 15.92 22 14.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C20.48 3 19.92 3 18.8 3h-.4c-2.24 0-3.36 0-4.216.436a4 4 0 0 0-1.748 1.748C12 6.04 12 7.16 12 9.4"}));$e.displayName="BookOpen01";function Yt(s){const e=$.c(39),{instance:n,onConfigure:r,onAuthenticate:i,onDelete:o}=s;let l;e[0]!==n.id?(l={connectionId:n.id},e[0]=n.id,e[1]=l):l=e[1];const c=Se(l),d=!(n.connection_type==="VIRTUAL")&&c.supportsOAuth&&!c.isAuthenticated,p=d?"border-destructive/50 bg-destructive/5 px-4 py-2.5":"border-transparent";let x;e[2]!==p?(x=Ne("flex items-center gap-3 rounded-lg border transition-colors",p),e[2]=p,e[3]=x):x=e[3];let a;e[4]!==n.icon||e[5]!==n.title?(a=t.jsx(ie,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=a):a=e[6];let f;e[7]!==n.title?(f=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=f):f=e[8];let j;e[9]!==d?(j=d&&t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}),e[9]=d,e[10]=j):j=e[10];let b;e[11]!==f||e[12]!==j?(b=t.jsxs("div",{className:"flex-1 min-w-0",children:[f,j]}),e[11]=f,e[12]=j,e[13]=b):b=e[13];let v;e[14]!==n||e[15]!==d||e[16]!==i?(v=d&&t.jsx(X,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>i(n),children:"Authorize"}),e[14]=n,e[15]=d,e[16]=i,e[17]=v):v=e[17];let g;e[18]!==n||e[19]!==r?(g=()=>r(n),e[18]=n,e[19]=r,e[20]=g):g=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Ae,{size:13}),e[21]=C):C=e[21];let A;e[22]!==g?(A=t.jsx(X,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:g,title:"Configure",children:C}),e[22]=g,e[23]=A):A=e[23];let _;e[24]!==n||e[25]!==o?(_=()=>o(n),e[24]=n,e[25]=o,e[26]=_):_=e[26];let N;e[27]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(de,{size:13}),e[27]=N):N=e[27];let w;e[28]!==_?(w=t.jsx(X,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:_,title:"Delete",children:N}),e[28]=_,e[29]=w):w=e[29];let S;e[30]!==A||e[31]!==w||e[32]!==v?(S=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[v,A,w]}),e[30]=A,e[31]=w,e[32]=v,e[33]=S):S=e[33];let T;return e[34]!==S||e[35]!==x||e[36]!==a||e[37]!==b?(T=t.jsxs("div",{className:x,children:[a,b,S]}),e[34]=S,e[35]=x,e[36]=a,e[37]=b,e[38]=T):T=e[38],T}function Zt(s){const e=$.c(15),{instance:n,onConfigure:r}=s;let i;e[0]!==n.icon||e[1]!==n.title?(i=t.jsx(ie,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=i):i=e[2];let o;e[3]!==n.title?(o=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",children:n.title})}),e[3]=n.title,e[4]=o):o=e[4];let l;e[5]!==n||e[6]!==r?(l=()=>r(n),e[5]=n,e[6]=r,e[7]=l):l=e[7];let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ae,{size:13}),e[8]=c):c=e[8];let m;e[9]!==l?(m=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(X,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,title:"Configure",children:c})}),e[9]=l,e[10]=m):m=e[10];let d;return e[11]!==i||e[12]!==o||e[13]!==m?(d=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent transition-colors",children:[i,o,m]}),e[11]=i,e[12]=o,e[13]=m,e[14]=d):d=e[14],d}function es(s){const e=$.c(25),{instances:n,onConfigure:r,onAuthenticate:i,onDelete:o,onAdd:l,isAdding:c}=s;if(n.length===0)return null;const m=n.length===1?"Instance":"Instances";let d;e[0]!==m?(d=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:m}),e[0]=m,e[1]=d):d=e[1];let p;e[2]!==c?(p=c?t.jsx(Te,{size:13,className:"animate-spin"}):t.jsx(dt,{size:13}),e[2]=c,e[3]=p):p=e[3];let x;e[4]!==c||e[5]!==l||e[6]!==p?(x=t.jsxs(X,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:l,disabled:c,children:[p,"Add instance"]}),e[4]=c,e[5]=l,e[6]=p,e[7]=x):x=e[7];let a;e[8]!==d||e[9]!==x?(a=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[d,x]}),e[8]=d,e[9]=x,e[10]=a):a=e[10];let f;if(e[11]!==n||e[12]!==i||e[13]!==r||e[14]!==o){let v;e[16]!==i||e[17]!==r||e[18]!==o?(v=g=>t.jsx(B.Suspense,{fallback:t.jsx(Zt,{instance:g,onConfigure:r}),children:t.jsx(Yt,{instance:g,onConfigure:r,onAuthenticate:i,onDelete:o})},g.id),e[16]=i,e[17]=r,e[18]=o,e[19]=v):v=e[19],f=n.map(v),e[11]=n,e[12]=i,e[13]=r,e[14]=o,e[15]=f}else f=e[15];let j;e[20]!==f?(j=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:f}),e[20]=f,e[21]=j):j=e[21];let b;return e[22]!==a||e[23]!==j?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[a,j]}),e[22]=a,e[23]=j,e[24]=b):b=e[24],b}const ts=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function ss(s){const e=new Date,n=new Date(e);return s==="7d"?n.setDate(n.getDate()-7):s==="14d"?n.setDate(n.getDate()-14):n.setDate(n.getDate()-30),{startDate:n,endDate:e}}const ns={calls:{label:"Tool calls"},errors:{label:"Errors"}};function os(s){const e=$.c(3),{connectionId:n,orgId:r,timeframe:i}=s;let o;e[0]!==r?(o={connectionId:tt,orgId:r},e[0]=r,e[1]=o):o=e[1];const l=ce(o),c=ss(i),{data:m}=Oe({queryKey:le.connectionActivity(n,i,r),queryFn:async()=>{const f=await l.callTool({name:"MONITORING_LOGS_LIST",arguments:{startDate:c.startDate.toISOString(),endDate:c.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}});return f.structuredContent??f},staleTime:3e5}),d=kt(m?.logs??[],c),p=d.data,x=d.totalCalls>0;let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[2]=a):a=e[2],t.jsxs("div",{children:[t.jsxs("div",{className:"flex gap-6 px-5 pb-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:d.totalCalls.toLocaleString()}),a]}),d.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:d.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),d.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(d.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),x?t.jsxs("div",{children:[t.jsx(Tt,{config:ns,className:"h-16 w-full",children:t.jsxs(At,{data:p,barCategoryGap:"4%",children:[t.jsx(It,{content:t.jsx(Dt,{labelFormatter:is}),cursor:{fill:"var(--muted)"}}),t.jsx($t,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:p.map(rs)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:p[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:p[p.length-1]?.label})]})]}):t.jsx("div",{className:"h-20 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-muted-foreground/60",children:"No activity in this period"})})]})}function rs(s,e){return t.jsx(Pt,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function is(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function as(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{children:[t.jsx("div",{className:"flex gap-6 px-5 pb-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx("div",{className:"h-7 w-16 rounded-md bg-muted animate-pulse"}),t.jsx("div",{className:"h-3 w-14 rounded bg-muted animate-pulse"})]})}),t.jsx("div",{className:"h-20 w-full rounded-md bg-muted animate-pulse"})]}),s[0]=e):e=s[0],e}function ls(s){const e=$.c(13),{connectionId:n}=s,[r,i]=B.useState("14d"),{org:o}=oe();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=l):l=e[0];let c;e[1]!==r?(c=ts.map(a=>t.jsx("button",{type:"button",onClick:()=>i(a.value),className:Ne("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",r===a.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:a.label},a.value)),e[1]=r,e[2]=c):c=e[2];let m;e[3]!==c?(m=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[l,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:c})]}),e[3]=c,e[4]=m):m=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(as,{}),e[5]=d):d=e[5];let p;e[6]!==n||e[7]!==o.id||e[8]!==r?(p=t.jsx(B.Suspense,{fallback:d,children:t.jsx(os,{connectionId:n,orgId:o.id,timeframe:r})}),e[6]=n,e[7]=o.id,e[8]=r,e[9]=p):p=e[9];let x;return e[10]!==m||e[11]!==p?(x=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[m,p]}),e[10]=m,e[11]=p,e[12]=x):x=e[12],x}function cs(s){const e=$.c(14),{virtualMcp:n,org:r}=s;let i;e[0]!==r||e[1]!==n.id?(i={org:r,project:J,agentId:n.id},e[0]=r,e[1]=n.id,e[2]=i):i=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(De,{size:16}),e[3]=o):o=e[3];let l;e[4]!==n.icon||e[5]!==n.title?(l=t.jsx(ie,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:o}),e[4]=n.icon,e[5]=n.title,e[6]=l):l=e[6];let c;e[7]!==n.title?(c=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[7]=n.title,e[8]=c):c=e[8];let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(Ie,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[9]=m):m=e[9];let d;return e[10]!==i||e[11]!==l||e[12]!==c?(d=t.jsxs(ye,{to:"/$org/$project/agents/$agentId/",params:i,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group",children:[l,c,m]}),e[10]=i,e[11]=l,e[12]=c,e[13]=d):d=e[13],d}function ds(s){const e=$.c(7),{virtualMcps:n,org:r}=s;let i;if(e[0]!==r||e[1]!==n){let l;e[3]!==r?(l=c=>t.jsx(cs,{virtualMcp:c,org:r},c.id),e[3]=r,e[4]=l):l=e[4],i=n.map(l),e[0]=r,e[1]=n,e[2]=i}else i=e[2];let o;return e[5]!==i?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:i})}),e[5]=i,e[6]=o):o=e[6],o}function ms(s){const e=$.c(7),{connection:n}=s,{org:r}=oe();let i;e[0]!==n.id?(i={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=i):i=e[1];const o=Ot(i);if(!(o.length>0)){let d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(t.Fragment,{}),e[2]=d):d=e[2],d}let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"px-5 py-4 border-b border-border",children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Used by agents"})}),e[3]=c):c=e[3];let m;return e[4]!==r.slug||e[5]!==o?(m=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[c,t.jsx("div",{className:"px-5 py-4",children:t.jsx(ds,{virtualMcps:o,org:r.slug})})]}),e[4]=r.slug,e[5]=o,e[6]=m):m=e[6],m}function us(s){const e=$.c(30),{tools:n,connectionId:r,org:i}=s,o=re(),{org:l}=oe();let c;e[0]!==r||e[1]!==l.id?(c={connectionId:r,orgId:l.id},e[0]=r,e[1]=l.id,e[2]=c):c=e[2];const m=ce(c),d=we(r);let p;e[3]!==d||e[4]!==r?(p=d?me(d):r,e[3]=d,e[4]=r,e[5]=p):p=e[5];const x=p,[a,f]=B.useState("");let j,b,v,g;if(e[6]!==x||e[7]!==m||e[8]!==o||e[9]!==i||e[10]!==a||e[11]!==n){const _=(n??[]).filter(xs),N=a.toLowerCase().trim(),w=N?_.filter(h=>h.name.toLowerCase().includes(N)||h.description&&h.description.toLowerCase().includes(N)):_;let S;e[16]!==x||e[17]!==o||e[18]!==i?(S=h=>{o({to:"/$org/$project/mcps/$appSlug/$collectionName/$itemId",params:{org:i,project:J,appSlug:x,collectionName:"tools",itemId:encodeURIComponent(h.name)}})},e[16]=x,e[17]=o,e[18]=i,e[19]=S):S=e[19];const T=S;v="flex flex-col h-full overflow-hidden";let I;e[20]===Symbol.for("react.memo_cache_sentinel")?(I=h=>{h.key==="Escape"&&(f(""),h.target.blur())},e[20]=I):I=e[20],e[21]!==a?(g=t.jsx(Rt,{value:a,onChange:f,placeholder:"Search apps...",onKeyDown:I}),e[21]=a,e[22]=g):g=e[22],j="flex-1 overflow-auto p-5",b=w.length===0?t.jsx(Ce,{image:null,title:a?"No apps found":"No apps available",description:a?"Try adjusting your search terms":"This connection doesn't have any tools with interactive UIs yet."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:w.map(h=>{const D=ue(h._meta);return t.jsxs(Ut,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>T(h),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(zt,{resourceURI:D,toolInfo:{tool:h},displayMode:"inline",minHeight:200,maxHeight:200,client:m})}),t.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:h.name}),t.jsx(Lt,{annotations:h.annotations,_meta:h._meta})]}),h.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:h.description})]})]},h.name)})}),e[6]=x,e[7]=m,e[8]=o,e[9]=i,e[10]=a,e[11]=n,e[12]=j,e[13]=b,e[14]=v,e[15]=g}else j=e[12],b=e[13],v=e[14],g=e[15];let C;e[23]!==j||e[24]!==b?(C=t.jsx("div",{className:j,children:b}),e[23]=j,e[24]=b,e[25]=C):C=e[25];let A;return e[26]!==v||e[27]!==g||e[28]!==C?(A=t.jsxs("div",{className:v,children:[g,C]}),e[26]=v,e[27]=g,e[28]=C,e[29]=A):A=e[29],A}function xs(s){return!!ue(s._meta)}function Pe(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=l=>l.charAt(0).toUpperCase()+l.slice(1),r=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),i=e.map(n),o=e[e.length-1];return i.length>=2&&o&&r.has(o)?[i.pop(),...i].join(" "):i.join(" ")}function ae(s){const e=$.c(2),{label:n}=s;let r;return e[0]!==n?(r=t.jsx("div",{className:"px-5 py-8 text-center",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",n," available."]})}),e[0]=n,e[1]=r):r=e[1],r}function ps(s){const e=$.c(50),{tools:n,prompts:r,resources:i,connectionId:o,org:l}=s;let c;e[0]!==r?(c=r===void 0?[]:r,e[0]=r,e[1]=c):c=e[1];const m=c;let d;e[2]!==i?(d=i===void 0?[]:i,e[2]=i,e[3]=d):d=e[3];const p=d,x=re(),a=we(o??"");let f;e[4]!==a||e[5]!==o?(f=a?me(a):o,e[4]=a,e[5]=o,e[6]=f):f=e[6];const j=f;let b;e[7]!==j||e[8]!==o||e[9]!==x||e[10]!==l?(b=function(Q){!o||!l||x({to:"/$org/$project/mcps/$appSlug/$collectionName/$itemId",params:{org:l,project:J,appSlug:j,collectionName:"tools",itemId:encodeURIComponent(Q)}})},e[7]=j,e[8]=o,e[9]=x,e[10]=l,e[11]=b):b=e[11];const v=b;let g;e[12]!==o||e[13]!==l||e[14]!==n?(g=o&&l&&n.some(gs),e[12]=o,e[13]=l,e[14]=n,e[15]=g):g=e[15];const C=g;if(n.length+m.length+p.length===0){let y;return e[16]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:"Capabilities"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"No capabilities discovered yet. The connection may still be connecting."})]}),e[16]=y):y=e[16],y}let _;e[17]!==n.length?(_=t.jsxs(te,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=_):_=e[18];let N;e[19]!==C?(N=C&&t.jsx(te,{value:"apps",variant:"underline",children:"UI"}),e[19]=C,e[20]=N):N=e[20];let w,S;e[21]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(te,{value:"prompts",variant:"underline",children:"Prompts"}),S=t.jsx(te,{value:"resources",variant:"underline",children:"Resources"}),e[21]=w,e[22]=S):(w=e[21],S=e[22]);let T;e[23]!==_||e[24]!==N?(T=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(Vt,{variant:"underline",className:"gap-1",children:[_,N,w,S]})}),e[23]=_,e[24]=N,e[25]=T):T=e[25];let I;e[26]!==v||e[27]!==n?(I=n.length>0?n.map(y=>t.jsxs("button",{type:"button",className:"w-full flex items-start gap-3 px-5 py-3 text-left hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>v(y.name),children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(Et,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Pe(y.name)}),y.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:y.description})]}),t.jsx(Ie,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},y.name)):t.jsx(ae,{label:"tools"}),e[26]=v,e[27]=n,e[28]=I):I=e[28];let h;e[29]!==I?(h=t.jsx(se,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:I})}),e[29]=I,e[30]=h):h=e[30];let D;e[31]!==o||e[32]!==C||e[33]!==l||e[34]!==n?(D=C&&t.jsx(se,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(us,{tools:n,connectionId:o,org:l})}),e[31]=o,e[32]=C,e[33]=l,e[34]=n,e[35]=D):D=e[35];let E;e[36]!==m?(E=m.length>0?m.map(fs):t.jsx(ae,{label:"prompts"}),e[36]=m,e[37]=E):E=e[37];let P;e[38]!==E?(P=t.jsx(se,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:E})}),e[38]=E,e[39]=P):P=e[39];let O;e[40]!==p?(O=p.length>0?p.map(hs):t.jsx(ae,{label:"resources"}),e[40]=p,e[41]=O):O=e[41];let M;e[42]!==O?(M=t.jsx(se,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:O})}),e[42]=O,e[43]=M):M=e[43];let z;return e[44]!==T||e[45]!==h||e[46]!==D||e[47]!==P||e[48]!==M?(z=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(Mt,{defaultValue:"tools",variant:"underline",children:[T,h,D,P,M]})}),e[44]=T,e[45]=h,e[46]=D,e[47]=P,e[48]=M,e[49]=z):z=e[49],z}function hs(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(qe,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:s.name}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description}),s.uri&&t.jsx("div",{className:"text-xs text-muted-foreground/60 font-mono mt-0.5 truncate",children:s.uri})]})]},s.uri??s.name)}function fs(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx($e,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Pe(s.name)}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description})]})]},s.name)}function gs(s){return ue(s._meta)}function js(s){const e=$.c(13),{connection:n,displayTitle:r}=s,i=r??n.title;let o;e[0]!==n.icon||e[1]!==i?(o=t.jsx(ie,{icon:n.icon,name:i,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=i,e[2]=o):o=e[2];let l;e[3]!==i?(l=t.jsx("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:t.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground leading-none",children:i})}),e[3]=i,e[4]=l):l=e[4];let c;e[5]!==n.description?(c=n.description&&t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:n.description}),e[5]=n.description,e[6]=c):c=e[6];let m;e[7]!==l||e[8]!==c?(m=t.jsxs("div",{className:"flex-1 min-w-0",children:[l,c]}),e[7]=l,e[8]=c,e[9]=m):m=e[9];let d;return e[10]!==o||e[11]!==m?(d=t.jsxs("div",{className:"flex items-center gap-6 py-7 px-8 bg-background border-b border-border shrink-0",children:[o,m]}),e[10]=o,e[11]=m,e[12]=d):d=e[12],d}function vs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:r,onRemoveOAuth:i}){const o=xe({control:s.control,name:"ui_type"}),l=xe({control:s.control,name:"connection_url"}),{stdioEnabled:c}=Ve(),m=(()=>{if(typeof l!="string"||!l)return!1;try{const a=new URL(l);return a.hostname==="api.githubcopilot.com"&&a.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),d=c||e.connection_type==="STDIO",p=e.connection_type==="VIRTUAL",x=p?Me(e.connection_url):null;return p?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(De,{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."})]}),x&&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:x})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(U,{control:s.control,name:"ui_type",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),o!=="NPX"&&o!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(fe,{value:a.value,onValueChange:a.onChange,children:[t.jsx(R,{children:t.jsxs(ge,{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(ne,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(je,{})]})}),t.jsxs(ve,{children:[t.jsx(L,{value:"HTTP",children:"HTTP"}),t.jsx(L,{value:"SSE",children:"SSE"}),t.jsx(L,{value:"Websocket",children:"Websocket"}),d&&t.jsxs(t.Fragment,{children:[t.jsx(L,{value:"NPX",children:"NPX Package"}),t.jsx(L,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(U,{control:s.control,name:"connection_url",render:({field:f})=>t.jsx(F,{className:"flex-1 min-w-0",children:t.jsx(R,{children:t.jsx(G,{placeholder:"https://example.com/mcp",...f,value:f.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(fe,{value:a.value,onValueChange:a.onChange,children:[t.jsx(R,{children:t.jsx(ge,{className:"h-10",children:t.jsx(je,{})})}),t.jsxs(ve,{children:[t.jsx(L,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ne,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(L,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ne,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(L,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ne,{className:"w-4 h-4"}),"Websocket"]})}),d&&t.jsxs(t.Fragment,{children:[t.jsx(L,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Qt,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(L,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(qt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(W,{})]})}),o==="NPX"&&t.jsx(U,{control:s.control,name:"npx_package",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(R,{children:t.jsx(G,{placeholder:"@perplexity-ai/mcp-server",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),o==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(U,{control:s.control,name:"stdio_command",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(R,{children:t.jsx(G,{placeholder:"node, bun, python...",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),t.jsx(U,{control:s.control,name:"stdio_args",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(R,{children:t.jsx(G,{placeholder:"arg1 arg2 --flag value",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(W,{})]})})]}),t.jsx(U,{control:s.control,name:"stdio_cwd",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(R,{children:t.jsx(G,{placeholder:"/path/to/project (optional)",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(U,{control:s.control,name:"env_vars",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(R,{children:t.jsx(Xe,{value:a.value??[],onChange:a.onChange})}),t.jsx(W,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(U,{control:s.control,name:"connection_token",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:m?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Bt,{children:[t.jsx(Ht,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Ft,{variant:"success",className:"gap-1.5",children:[t.jsx(Xt,{size:12}),"Authenticated via OAuth",t.jsx(Gt,{size:12})]})})}),t.jsxs(Wt,{align:"start",children:[t.jsxs(he,{onClick:r,children:[t.jsx(Kt,{size:16}),"Re-authenticate"]}),t.jsxs(he,{variant:"destructive",onClick:i,children:[t.jsx(de,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&a.value===null?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>a.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(Jt,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(R,{children:t.jsx(G,{type:"password",placeholder:m?"Paste your GitHub PAT":"Enter access token...",...a,value:a.value||"",className:"h-10 rounded-lg"})}),m&&t.jsxs(_t,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(W,{})]})})]})}function bs(s){return s.command==="npx"}function Ns(s){return s.args?.find(e=>!e.startsWith("-"))??""}function ys(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function Cs(s,e){const n={command:"npx",args:["-y",s]},r=_e(e);return Object.keys(r).length>0&&(n.envVars=r),n}function _s(s,e,n,r){const i={command:s};e.trim()&&(i.args=e.trim().split(/\s+/)),n?.trim()&&(i.cwd=n.trim());const o=_e(r);return Object.keys(o).length>0&&(i.envVars=o),i}function be(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"&&Be(s.connection_headers)){const r=s.connection_headers,i=Qe(r.envVars);if(bs(r)){const l=Ns(r);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:l,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:i}}const o=ys(r);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:o.command,stdio_args:o.args,stdio_cwd:o.cwd,env_vars: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 Ss(s){let e,n=null,r=null,i=null;return s.ui_type==="NPX"?(e="STDIO",n="",i=Cs(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",i=_s(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",r=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...r&&{connection_token:r},...i&&{connection_headers:i},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function ws({connection:s,connectionId:e,org:n,isUpdating:r,tools:i,prompts:o,resources:l,siblings:c}){const m=re({from:"/$org/$project/mcps/$appSlug"}),d=Re(),p=ke(),[x,a]=B.useState(null),[f,j]=B.useState(null),[b,v]=B.useState(!1),g=Se({connectionId:e}),{data:C}=Ye(),A=C?.data?.members??[],_=x??s,N=A.find(u=>u.userId===_.created_by),S=s?.connection_type==="VIRTUAL"||g.isAuthenticated,I=Ke({connections:[s],binding:"MCP"}).length>0,h=Le({resolver:Ue(Ge),values:be(x??s)}),D=h.formState.isDirty,E=async()=>{if(!await h.trigger())return;const k=h.getValues(),V=Ss(k),K=x?.id??e;await p.update.mutateAsync({id:K,data:V}),h.reset(k)},P=()=>{h.reset(be(x??s))},O=async u=>{const{token:k,tokenInfo:V,error:K}=await He({connectionId:u});if(K||!k){Z.error(`Authentication failed: ${K}`);return}if(V)try{const q=await fetch(`/api/connections/${u}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:V.accessToken,refreshToken:V.refreshToken,expiresIn:V.expiresIn,scope:V.scope,clientId:V.clientId,clientSecret:V.clientSecret,tokenEndpoint:V.tokenEndpoint})});if(!q.ok)console.error("Failed to save OAuth token:",await q.text()),await p.update.mutateAsync({id:u,data:{connection_token:k}});else try{await p.update.mutateAsync({id:u,data:{}})}catch(ee){console.warn("Failed to refresh connection tools after OAuth:",ee)}}catch(q){console.error("Error saving OAuth token:",q),await p.update.mutateAsync({id:u,data:{connection_token:k}})}else await p.update.mutateAsync({id:u,data:{connection_token:k}});const Y=new URL(`/mcp/${u}`,window.location.origin);await d.invalidateQueries({queryKey:le.isMCPAuthenticated(Y.href,null)}),Z.success("Authentication successful")},M=()=>O(s.id),z=async()=>{try{const u=await fetch(`/api/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!u.ok){const V=await u.text();Z.error(`Failed to remove OAuth: ${V}`);return}const k=new URL(`/mcp/${s.id}`,window.location.origin);await d.invalidateQueries({queryKey:le.isMCPAuthenticated(k.href,null)}),Z.success("OAuth removed. You can now re-authenticate with a different account.")}catch(u){console.error("Error removing OAuth token:",u),Z.error("Failed to remove OAuth")}},y=async u=>{await p.delete.mutateAsync(u.id),c.length<=1&&m({to:"/$org/$project/mcps",params:{org:n,project:J}}),j(null)},Q=t.jsx(rt,{children:t.jsxs(it,{children:[t.jsx(pe,{children:t.jsx(at,{asChild:!0,children:t.jsx(ye,{to:"/$org/$project/mcps",params:{org:n,project:J},children:"Connections"})})}),t.jsx(lt,{}),t.jsx(pe,{children:t.jsx(ct,{children:(()=>{const u=c[0]??s;return u.app_name?u.title.replace(/\s*\(\d+\)\s*$/,""):u.title})()})})]})});return t.jsxs(t.Fragment,{children:[t.jsx(mt,{open:f!==null,onOpenChange:u=>{u||j(null)},children:t.jsxs(ut,{children:[t.jsxs(xt,{children:[t.jsx(pt,{children:"Disconnect instance?"}),t.jsxs(ht,{children:["This will permanently remove"," ",t.jsx("span",{className:"font-medium text-foreground",children:f?.title}),". This action cannot be undone."]})]}),t.jsxs(ft,{children:[t.jsx(gt,{children:"Cancel"}),t.jsx(jt,{onClick:()=>f&&y(f),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})}),t.jsx(vt,{open:x!==null,onOpenChange:u=>{u||a(null)},children:t.jsxs(bt,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(Nt,{className:"px-6 py-4 border-b border-border shrink-0",children:[t.jsx(yt,{className:"text-base",children:x?.title??s.title}),t.jsx(Ct,{className:"text-xs",children:"Update URL, authentication, and other settings"}),N&&t.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Connected by"}),t.jsx(Ze,{url:N.user?.image??void 0,fallback:N.user?.name??N.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:N.user?.name||N.user?.email})]})]}),t.jsxs(St,{...h,children:[t.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5 flex flex-col gap-6",children:[t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(U,{control:h.control,name:"title",render:({field:u})=>t.jsxs(F,{children:[t.jsx(H,{children:"Name"}),t.jsx(R,{children:t.jsx(G,{...u})}),t.jsx(W,{})]})}),t.jsx(U,{control:h.control,name:"description",render:({field:u})=>t.jsxs(F,{children:[t.jsx(H,{children:"Description"}),t.jsx(R,{children:t.jsx(G,{...u,value:u.value||""})}),t.jsx(W,{})]})})]}),t.jsx(vs,{form:h,connection:x??s,hasOAuthToken:g.hasOAuthToken,onReauthenticate:M,onRemoveOAuth:z}),t.jsx(Je,{connection:x??s,form:h,hasMcpBinding:I,isMCPAuthenticated:S,supportsOAuth:g.supportsOAuth,isServerError:g.isServerError,onAuthenticate:M,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(X,{onClick:E,disabled:!D||r,className:"flex-1",children:r?"Saving…":"Save changes"}),D&&t.jsx(X,{variant:"outline",onClick:P,children:"Undo"}),t.jsxs(X,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const u=x??s;a(null),j(u)},children:[t.jsx(de,{size:15}),"Delete"]})]})]},x?.id??s.id)]})}),t.jsx(wt,{breadcrumb:Q,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(js,{connection:s,displayTitle:(()=>{const u=c[0]??s;return u.app_name?u.title.replace(/\s*\(\d+\)\s*$/,""):u.title})()}),t.jsx("div",{className:"flex-1 overflow-auto @container",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-2 gap-5 p-6",children:[t.jsx(ls,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(es,{instances:c,onConfigure:u=>a(u),onAuthenticate:u=>O(u.id),onDelete:u=>j(u),isAdding:b,onAdd:async()=>{v(!0);try{const u=c[0]??s,k=u.title.replace(/\s*\(\d+\)\s*$/,""),V=c.length+1,K=`${k} (${V})`,Y=We("conn");await p.create.mutateAsync({id:Y,title:K,description:u.description??null,connection_type:u.connection_type,connection_url:u.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:u.created_by,organization_id:u.organization_id,icon:u.icon??null,app_name:u.app_name??null,app_id:u.app_id??null,connection_headers:u.connection_headers??null,oauth_config:null,configuration_state:u.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const q=new URL(`/mcp/${Y}`,window.location.origin),ee=await Fe({url:q.href,token:null});ee.supportsOAuth&&!ee.isAuthenticated&&await O(Y)}finally{v(!1)}}}),t.jsx(ms,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ps,{tools:i,prompts:o,resources:l,connectionId:e,org:n})})]})})]})})]})}function ks(){const s=$.c(31);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/$project/mcps/$appSlug"},s[0]=e):e=s[0];const n=re(e);let r;s[1]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org/$project/mcps/$appSlug"},s[1]=r):r=s[1];const{appSlug:i,org:o}=ze(r),{org:l}=oe(),c=et(),m=ke();let d;s[2]!==i?(d=y=>y.connection_type!=="VIRTUAL"&&me(y)===i,s[2]=i,s[3]=d):d=s[3];const p=c.filter(d),x=p[0]??null,a=x?.id??"",f=ce({connectionId:a||null,orgId:l.id}),b=!(x?.connection_type==="VIRTUAL")&&x?.tools&&x.tools.length>0,v=!b;let g;s[4]!==f||s[5]!==v?(g={client:f,enabled:v},s[4]=f,s[5]=v,s[6]=g):g=s[6];const{data:C}=st(g),A=b?x?.tools??[]:(C?.tools??[]).map(Is);let _;e:{if(p.length<=1){_=A;break e}const y=new Set,Q=[];for(const u of p)for(const k of u.tools??[])y.has(k.name)||(y.add(k.name),Q.push({name:k.name,description:k.description,inputSchema:k.inputSchema??{},outputSchema:k.outputSchema,annotations:k.annotations,_meta:k._meta}));_=Q.length>0?Q:A}const N=_;let w;s[7]!==f?(w={client:f},s[7]=f,s[8]=w):w=s[8];const{data:S}=ot(w);let T;s[9]!==f?(T={client:f},s[9]=f,s[10]=T):T=s[10];const{data:I}=nt(T);let h;s[11]!==S?.prompts?(h=S?.prompts??[],s[11]=S?.prompts,s[12]=h):h=s[12];let D;s[13]!==h?(D=h.map(As),s[13]=h,s[14]=D):D=s[14];const E=D;let P;s[15]!==I?.resources?(P=I?.resources??[],s[15]=I?.resources,s[16]=P):P=s[16];let O;s[17]!==P?(O=P.map(Ts),s[17]=P,s[18]=O):O=s[18];const M=O;if(!x){let y;return s[19]!==n||s[20]!==o?(y=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ce,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(X,{variant:"outline",onClick:()=>n({to:"/$org/$project/mcps",params:{org:o,project:J}}),children:"Back to connections"})})}),s[19]=n,s[20]=o,s[21]=y):y=s[21],y}let z;return s[22]!==m.update.isPending||s[23]!==N||s[24]!==x||s[25]!==a||s[26]!==o||s[27]!==E||s[28]!==M||s[29]!==p?(z=t.jsx(ws,{org:o,connection:x,connectionId:a,isUpdating:m.update.isPending,tools:N,prompts:E,resources:M,siblings:p}),s[22]=m.update.isPending,s[23]=N,s[24]=x,s[25]=a,s[26]=o,s[27]=E,s[28]=M,s[29]=p,s[30]=z):z=s[30],z}function Ts(s){return{name:s.name,description:s.description,uri:s.uri}}function As(s){return{name:s.name,description:s.description}}function Is(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,annotations:s.annotations,_meta:s._meta}}function Ds(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ee,{children:t.jsx(B.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(Te,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(ks,{})})}),s[0]=e):e=s[0],e}function no(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ds,{}),s[0]=e):e=s[0],e}export{no as default};
|
|
1
|
+
import{r as B,c as $,j as t,B as X,D as Ne,u as oe,x as Oe,K as le,O as J,Q as ye,e as re,c4 as xe,y as Ve,p as Me,E as Ee,g as ze,w as Re,t as Le,q as Ue,i as Fe,b as Be,v as Z,a as He}from"./index-NjMxPJgF.js";import{g as We}from"./generate-id-BiV6m8fS.js";import{E as Ce}from"./empty-state-xIvMMy-_.js";import{E as Xe,c as Ge,r as Qe,e as _e}from"./env-vars-editor-Yss1wn0m.js";import{d as Ke}from"./registry-utils-cjX9P5J9.js";import{u as Se,n as qe,S as Je}from"./index-CqtWW-Tq.js";import{u as Ye}from"./use-members-B4ncWtMV.js";import{A as Ze}from"./avatar-B2yArl-q.js";import{u as we,b as et,a as ke}from"./use-connection-CHFdKnsr.js";import{u as ce,a as tt}from"./constants-D7qXOYRn.js";import{d as st}from"./use-mcp-tools-BCZI_Wqc.js";import{b as nt}from"./use-mcp-resources-qGdymfRz.js";import{a as ot}from"./use-mcp-prompts-Bel4H4rh.js";import{B as rt,a as it,b as pe,d as at,e as lt,c as ct}from"./breadcrumb-C2RG4nAQ.js";import{I as ie}from"./integration-icon-BPVDVJvP.js";import{i as Te}from"./Loading01-Bb8FCosd.js";import{s as dt}from"./Plus-CajZ9VfC.js";import{t as Ae}from"./Settings01-ClPVpLPy.js";import{s as de}from"./Trash01-B_4PTwjI.js";import{f as mt,a as ut,b as xt,c as pt,d as ht,e as ft,A as gt,h as jt}from"./alert-dialog-B_ae3oRt.js";import{S as vt,a as bt,b as Nt,c as yt,d as Ct}from"./sheet-C3HM0Uwr.js";import{F as U,b as F,c as H,d as R,f as W,e as _t,a as St}from"./form-CaFPTMVC.js";import{I as G}from"./input-B89sozd8.js";import{g as me}from"./connection-slug-Bw8dtz1U.js";import{a as wt}from"./layout-DcmGLVHZ.js";import{c as kt,C as Tt,B as At,a as It,b as Dt,d as $t,e as Pt}from"./monitoring-stats-row-CAn-8pVZ.js";import{b as Ot}from"./use-virtual-mcp-BP6aaUzw.js";import{i as Ie}from"./ChevronRight-DsjLlugM.js";import{t as De}from"./Users03-Bv-hUQkl.js";import{T as te,a as Vt,b as se,c as Mt}from"./tabs-BSOe8gLq.js";import{a as Et}from"./Tool01-D1m8i7Ez.js";import{g as ue}from"./types-BHeMLyAV.js";import{M as zt}from"./mcp-app-renderer-By1mQEU9.js";import{C as Rt}from"./collection-search-BYV7N3mr.js";import{T as Lt}from"./tools-list-D-T64862.js";import{C as Ut}from"./card-B8qDZGCZ.js";import{B as Ft}from"./badge-DtRom7JO.js";import{D as Bt,a as Ht,b as Wt,c as he}from"./dropdown-menu-BxlQMXgW.js";import{S as fe,a as ge,b as je,c as ve,d as L}from"./select-Dx3T3-4n.js";import{i as Xt}from"./CheckCircle-hBpanOsI.js";import{t as Gt}from"./ChevronDown-BIRGQoZ5.js";import{n as Qt}from"./Container-DHyMOW_p.js";import{s as ne}from"./Globe02-wRhoc1N5.js";import{s as Kt}from"./RefreshCcw01-B_NTitRE.js";import{i as qt}from"./Terminal-CGwuP-_5.js";import{s as Jt}from"./XClose-CcNXqPQc.js";import"./binder-D4cqx_Kx.js";import"./File06-Bp4ioOvR.js";import"./Key01-qNySmY39.js";import"./extract-connection-data-48N591A_.js";import"./use-install-from-registry-BzwuBLOx.js";import"./index-TV8hw8s3.js";import"./index-ChUIqRBi.js";import"./ChevronUp-Bi3NMXzv.js";import"./index-zWpUeKAz.js";import"./select-virtual-mcp-BS537pmy.js";import"./popover-Br8QkMK3.js";import"./tooltip-BJMSu0c2.js";import"./index-CqyqI90F.js";import"./Check-DW8AVFkq.js";import"./SearchMd-eZWeU0sP.js";import"./use-create-virtual-mcp-B7odZ_c3.js";import"./use-collections-C0cYiFfV.js";import"./useMutation-68NxhXCf.js";import"./useQuery-BYBCFxgb.js";import"./X-LzehymHS.js";import"./label-DkiEYJcU.js";import"./slugify-CEUa2lfQ.js";import"./index-De1iYnQy.js";import"./collection-display-button-CpVZ4wHm.js";import"./ArrowDown-7rbX3zqZ.js";import"./ArrowUp-DoIG5eQh.js";import"./Grid01-C5e9ReQ4.js";import"./List-NLa0AhO4.js";import"./collection-table-wrapper-CHFJQd21.js";import"./table-C-1rP_rt.js";import"./Eye-hBqNQHpc.js";import"./LayersTwo01-dfSlQT0y.js";const $e=({size:s=24,color:e="currentColor",...n})=>B.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},B.createElement("path",{d:"m12 21-.1-.15c-.695-1.042-1.042-1.563-1.5-1.94a4 4 0 0 0-1.378-.737C8.453 18 7.827 18 6.575 18H5.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C2 16.48 2 15.92 2 14.8V6.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C3.52 3 4.08 3 5.2 3h.4c2.24 0 3.36 0 4.216.436a4 4 0 0 1 1.748 1.748C12 6.04 12 7.16 12 9.4M12 21V9.4M12 21l.1-.15c.695-1.042 1.042-1.563 1.5-1.94a3.999 3.999 0 0 1 1.378-.737C15.547 18 16.173 18 17.425 18H18.8c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C22 16.48 22 15.92 22 14.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C20.48 3 19.92 3 18.8 3h-.4c-2.24 0-3.36 0-4.216.436a4 4 0 0 0-1.748 1.748C12 6.04 12 7.16 12 9.4"}));$e.displayName="BookOpen01";function Yt(s){const e=$.c(39),{instance:n,onConfigure:r,onAuthenticate:i,onDelete:o}=s;let l;e[0]!==n.id?(l={connectionId:n.id},e[0]=n.id,e[1]=l):l=e[1];const c=Se(l),d=!(n.connection_type==="VIRTUAL")&&c.supportsOAuth&&!c.isAuthenticated,p=d?"border-destructive/50 bg-destructive/5 px-4 py-2.5":"border-transparent";let x;e[2]!==p?(x=Ne("flex items-center gap-3 rounded-lg border transition-colors",p),e[2]=p,e[3]=x):x=e[3];let a;e[4]!==n.icon||e[5]!==n.title?(a=t.jsx(ie,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=a):a=e[6];let f;e[7]!==n.title?(f=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=f):f=e[8];let j;e[9]!==d?(j=d&&t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}),e[9]=d,e[10]=j):j=e[10];let b;e[11]!==f||e[12]!==j?(b=t.jsxs("div",{className:"flex-1 min-w-0",children:[f,j]}),e[11]=f,e[12]=j,e[13]=b):b=e[13];let v;e[14]!==n||e[15]!==d||e[16]!==i?(v=d&&t.jsx(X,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>i(n),children:"Authorize"}),e[14]=n,e[15]=d,e[16]=i,e[17]=v):v=e[17];let g;e[18]!==n||e[19]!==r?(g=()=>r(n),e[18]=n,e[19]=r,e[20]=g):g=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Ae,{size:13}),e[21]=C):C=e[21];let A;e[22]!==g?(A=t.jsx(X,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:g,title:"Configure",children:C}),e[22]=g,e[23]=A):A=e[23];let _;e[24]!==n||e[25]!==o?(_=()=>o(n),e[24]=n,e[25]=o,e[26]=_):_=e[26];let N;e[27]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(de,{size:13}),e[27]=N):N=e[27];let w;e[28]!==_?(w=t.jsx(X,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:_,title:"Delete",children:N}),e[28]=_,e[29]=w):w=e[29];let S;e[30]!==A||e[31]!==w||e[32]!==v?(S=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[v,A,w]}),e[30]=A,e[31]=w,e[32]=v,e[33]=S):S=e[33];let T;return e[34]!==S||e[35]!==x||e[36]!==a||e[37]!==b?(T=t.jsxs("div",{className:x,children:[a,b,S]}),e[34]=S,e[35]=x,e[36]=a,e[37]=b,e[38]=T):T=e[38],T}function Zt(s){const e=$.c(15),{instance:n,onConfigure:r}=s;let i;e[0]!==n.icon||e[1]!==n.title?(i=t.jsx(ie,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=i):i=e[2];let o;e[3]!==n.title?(o=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",children:n.title})}),e[3]=n.title,e[4]=o):o=e[4];let l;e[5]!==n||e[6]!==r?(l=()=>r(n),e[5]=n,e[6]=r,e[7]=l):l=e[7];let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ae,{size:13}),e[8]=c):c=e[8];let m;e[9]!==l?(m=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(X,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,title:"Configure",children:c})}),e[9]=l,e[10]=m):m=e[10];let d;return e[11]!==i||e[12]!==o||e[13]!==m?(d=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent transition-colors",children:[i,o,m]}),e[11]=i,e[12]=o,e[13]=m,e[14]=d):d=e[14],d}function es(s){const e=$.c(25),{instances:n,onConfigure:r,onAuthenticate:i,onDelete:o,onAdd:l,isAdding:c}=s;if(n.length===0)return null;const m=n.length===1?"Instance":"Instances";let d;e[0]!==m?(d=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:m}),e[0]=m,e[1]=d):d=e[1];let p;e[2]!==c?(p=c?t.jsx(Te,{size:13,className:"animate-spin"}):t.jsx(dt,{size:13}),e[2]=c,e[3]=p):p=e[3];let x;e[4]!==c||e[5]!==l||e[6]!==p?(x=t.jsxs(X,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:l,disabled:c,children:[p,"Add instance"]}),e[4]=c,e[5]=l,e[6]=p,e[7]=x):x=e[7];let a;e[8]!==d||e[9]!==x?(a=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[d,x]}),e[8]=d,e[9]=x,e[10]=a):a=e[10];let f;if(e[11]!==n||e[12]!==i||e[13]!==r||e[14]!==o){let v;e[16]!==i||e[17]!==r||e[18]!==o?(v=g=>t.jsx(B.Suspense,{fallback:t.jsx(Zt,{instance:g,onConfigure:r}),children:t.jsx(Yt,{instance:g,onConfigure:r,onAuthenticate:i,onDelete:o})},g.id),e[16]=i,e[17]=r,e[18]=o,e[19]=v):v=e[19],f=n.map(v),e[11]=n,e[12]=i,e[13]=r,e[14]=o,e[15]=f}else f=e[15];let j;e[20]!==f?(j=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:f}),e[20]=f,e[21]=j):j=e[21];let b;return e[22]!==a||e[23]!==j?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[a,j]}),e[22]=a,e[23]=j,e[24]=b):b=e[24],b}const ts=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function ss(s){const e=new Date,n=new Date(e);return s==="7d"?n.setDate(n.getDate()-7):s==="14d"?n.setDate(n.getDate()-14):n.setDate(n.getDate()-30),{startDate:n,endDate:e}}const ns={calls:{label:"Tool calls"},errors:{label:"Errors"}};function os(s){const e=$.c(3),{connectionId:n,orgId:r,timeframe:i}=s;let o;e[0]!==r?(o={connectionId:tt,orgId:r},e[0]=r,e[1]=o):o=e[1];const l=ce(o),c=ss(i),{data:m}=Oe({queryKey:le.connectionActivity(n,i,r),queryFn:async()=>{const f=await l.callTool({name:"MONITORING_LOGS_LIST",arguments:{startDate:c.startDate.toISOString(),endDate:c.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}});return f.structuredContent??f},staleTime:3e5}),d=kt(m?.logs??[],c),p=d.data,x=d.totalCalls>0;let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[2]=a):a=e[2],t.jsxs("div",{children:[t.jsxs("div",{className:"flex gap-6 px-5 pb-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:d.totalCalls.toLocaleString()}),a]}),d.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:d.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),d.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(d.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),x?t.jsxs("div",{children:[t.jsx(Tt,{config:ns,className:"h-16 w-full",children:t.jsxs(At,{data:p,barCategoryGap:"4%",children:[t.jsx(It,{content:t.jsx(Dt,{labelFormatter:is}),cursor:{fill:"var(--muted)"}}),t.jsx($t,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:p.map(rs)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:p[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:p[p.length-1]?.label})]})]}):t.jsx("div",{className:"h-20 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-muted-foreground/60",children:"No activity in this period"})})]})}function rs(s,e){return t.jsx(Pt,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function is(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function as(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{children:[t.jsx("div",{className:"flex gap-6 px-5 pb-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx("div",{className:"h-7 w-16 rounded-md bg-muted animate-pulse"}),t.jsx("div",{className:"h-3 w-14 rounded bg-muted animate-pulse"})]})}),t.jsx("div",{className:"h-20 w-full rounded-md bg-muted animate-pulse"})]}),s[0]=e):e=s[0],e}function ls(s){const e=$.c(13),{connectionId:n}=s,[r,i]=B.useState("14d"),{org:o}=oe();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=l):l=e[0];let c;e[1]!==r?(c=ts.map(a=>t.jsx("button",{type:"button",onClick:()=>i(a.value),className:Ne("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",r===a.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:a.label},a.value)),e[1]=r,e[2]=c):c=e[2];let m;e[3]!==c?(m=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[l,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:c})]}),e[3]=c,e[4]=m):m=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(as,{}),e[5]=d):d=e[5];let p;e[6]!==n||e[7]!==o.id||e[8]!==r?(p=t.jsx(B.Suspense,{fallback:d,children:t.jsx(os,{connectionId:n,orgId:o.id,timeframe:r})}),e[6]=n,e[7]=o.id,e[8]=r,e[9]=p):p=e[9];let x;return e[10]!==m||e[11]!==p?(x=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[m,p]}),e[10]=m,e[11]=p,e[12]=x):x=e[12],x}function cs(s){const e=$.c(14),{virtualMcp:n,org:r}=s;let i;e[0]!==r||e[1]!==n.id?(i={org:r,project:J,agentId:n.id},e[0]=r,e[1]=n.id,e[2]=i):i=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(De,{size:16}),e[3]=o):o=e[3];let l;e[4]!==n.icon||e[5]!==n.title?(l=t.jsx(ie,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:o}),e[4]=n.icon,e[5]=n.title,e[6]=l):l=e[6];let c;e[7]!==n.title?(c=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[7]=n.title,e[8]=c):c=e[8];let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(Ie,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[9]=m):m=e[9];let d;return e[10]!==i||e[11]!==l||e[12]!==c?(d=t.jsxs(ye,{to:"/$org/$project/agents/$agentId/",params:i,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group",children:[l,c,m]}),e[10]=i,e[11]=l,e[12]=c,e[13]=d):d=e[13],d}function ds(s){const e=$.c(7),{virtualMcps:n,org:r}=s;let i;if(e[0]!==r||e[1]!==n){let l;e[3]!==r?(l=c=>t.jsx(cs,{virtualMcp:c,org:r},c.id),e[3]=r,e[4]=l):l=e[4],i=n.map(l),e[0]=r,e[1]=n,e[2]=i}else i=e[2];let o;return e[5]!==i?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:i})}),e[5]=i,e[6]=o):o=e[6],o}function ms(s){const e=$.c(7),{connection:n}=s,{org:r}=oe();let i;e[0]!==n.id?(i={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=i):i=e[1];const o=Ot(i);if(!(o.length>0)){let d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(t.Fragment,{}),e[2]=d):d=e[2],d}let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"px-5 py-4 border-b border-border",children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Used by agents"})}),e[3]=c):c=e[3];let m;return e[4]!==r.slug||e[5]!==o?(m=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[c,t.jsx("div",{className:"px-5 py-4",children:t.jsx(ds,{virtualMcps:o,org:r.slug})})]}),e[4]=r.slug,e[5]=o,e[6]=m):m=e[6],m}function us(s){const e=$.c(30),{tools:n,connectionId:r,org:i}=s,o=re(),{org:l}=oe();let c;e[0]!==r||e[1]!==l.id?(c={connectionId:r,orgId:l.id},e[0]=r,e[1]=l.id,e[2]=c):c=e[2];const m=ce(c),d=we(r);let p;e[3]!==d||e[4]!==r?(p=d?me(d):r,e[3]=d,e[4]=r,e[5]=p):p=e[5];const x=p,[a,f]=B.useState("");let j,b,v,g;if(e[6]!==x||e[7]!==m||e[8]!==o||e[9]!==i||e[10]!==a||e[11]!==n){const _=(n??[]).filter(xs),N=a.toLowerCase().trim(),w=N?_.filter(h=>h.name.toLowerCase().includes(N)||h.description&&h.description.toLowerCase().includes(N)):_;let S;e[16]!==x||e[17]!==o||e[18]!==i?(S=h=>{o({to:"/$org/$project/mcps/$appSlug/$collectionName/$itemId",params:{org:i,project:J,appSlug:x,collectionName:"tools",itemId:encodeURIComponent(h.name)}})},e[16]=x,e[17]=o,e[18]=i,e[19]=S):S=e[19];const T=S;v="flex flex-col h-full overflow-hidden";let I;e[20]===Symbol.for("react.memo_cache_sentinel")?(I=h=>{h.key==="Escape"&&(f(""),h.target.blur())},e[20]=I):I=e[20],e[21]!==a?(g=t.jsx(Rt,{value:a,onChange:f,placeholder:"Search apps...",onKeyDown:I}),e[21]=a,e[22]=g):g=e[22],j="flex-1 overflow-auto p-5",b=w.length===0?t.jsx(Ce,{image:null,title:a?"No apps found":"No apps available",description:a?"Try adjusting your search terms":"This connection doesn't have any tools with interactive UIs yet."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:w.map(h=>{const D=ue(h._meta);return t.jsxs(Ut,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>T(h),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(zt,{resourceURI:D,toolInfo:{tool:h},displayMode:"inline",minHeight:200,maxHeight:200,client:m})}),t.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:h.name}),t.jsx(Lt,{annotations:h.annotations,_meta:h._meta})]}),h.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:h.description})]})]},h.name)})}),e[6]=x,e[7]=m,e[8]=o,e[9]=i,e[10]=a,e[11]=n,e[12]=j,e[13]=b,e[14]=v,e[15]=g}else j=e[12],b=e[13],v=e[14],g=e[15];let C;e[23]!==j||e[24]!==b?(C=t.jsx("div",{className:j,children:b}),e[23]=j,e[24]=b,e[25]=C):C=e[25];let A;return e[26]!==v||e[27]!==g||e[28]!==C?(A=t.jsxs("div",{className:v,children:[g,C]}),e[26]=v,e[27]=g,e[28]=C,e[29]=A):A=e[29],A}function xs(s){return!!ue(s._meta)}function Pe(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=l=>l.charAt(0).toUpperCase()+l.slice(1),r=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),i=e.map(n),o=e[e.length-1];return i.length>=2&&o&&r.has(o)?[i.pop(),...i].join(" "):i.join(" ")}function ae(s){const e=$.c(2),{label:n}=s;let r;return e[0]!==n?(r=t.jsx("div",{className:"px-5 py-8 text-center",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",n," available."]})}),e[0]=n,e[1]=r):r=e[1],r}function ps(s){const e=$.c(50),{tools:n,prompts:r,resources:i,connectionId:o,org:l}=s;let c;e[0]!==r?(c=r===void 0?[]:r,e[0]=r,e[1]=c):c=e[1];const m=c;let d;e[2]!==i?(d=i===void 0?[]:i,e[2]=i,e[3]=d):d=e[3];const p=d,x=re(),a=we(o??"");let f;e[4]!==a||e[5]!==o?(f=a?me(a):o,e[4]=a,e[5]=o,e[6]=f):f=e[6];const j=f;let b;e[7]!==j||e[8]!==o||e[9]!==x||e[10]!==l?(b=function(Q){!o||!l||x({to:"/$org/$project/mcps/$appSlug/$collectionName/$itemId",params:{org:l,project:J,appSlug:j,collectionName:"tools",itemId:encodeURIComponent(Q)}})},e[7]=j,e[8]=o,e[9]=x,e[10]=l,e[11]=b):b=e[11];const v=b;let g;e[12]!==o||e[13]!==l||e[14]!==n?(g=o&&l&&n.some(gs),e[12]=o,e[13]=l,e[14]=n,e[15]=g):g=e[15];const C=g;if(n.length+m.length+p.length===0){let y;return e[16]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:"Capabilities"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"No capabilities discovered yet. The connection may still be connecting."})]}),e[16]=y):y=e[16],y}let _;e[17]!==n.length?(_=t.jsxs(te,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=_):_=e[18];let N;e[19]!==C?(N=C&&t.jsx(te,{value:"apps",variant:"underline",children:"UI"}),e[19]=C,e[20]=N):N=e[20];let w,S;e[21]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(te,{value:"prompts",variant:"underline",children:"Prompts"}),S=t.jsx(te,{value:"resources",variant:"underline",children:"Resources"}),e[21]=w,e[22]=S):(w=e[21],S=e[22]);let T;e[23]!==_||e[24]!==N?(T=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(Vt,{variant:"underline",className:"gap-1",children:[_,N,w,S]})}),e[23]=_,e[24]=N,e[25]=T):T=e[25];let I;e[26]!==v||e[27]!==n?(I=n.length>0?n.map(y=>t.jsxs("button",{type:"button",className:"w-full flex items-start gap-3 px-5 py-3 text-left hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>v(y.name),children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(Et,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Pe(y.name)}),y.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:y.description})]}),t.jsx(Ie,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},y.name)):t.jsx(ae,{label:"tools"}),e[26]=v,e[27]=n,e[28]=I):I=e[28];let h;e[29]!==I?(h=t.jsx(se,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:I})}),e[29]=I,e[30]=h):h=e[30];let D;e[31]!==o||e[32]!==C||e[33]!==l||e[34]!==n?(D=C&&t.jsx(se,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(us,{tools:n,connectionId:o,org:l})}),e[31]=o,e[32]=C,e[33]=l,e[34]=n,e[35]=D):D=e[35];let E;e[36]!==m?(E=m.length>0?m.map(fs):t.jsx(ae,{label:"prompts"}),e[36]=m,e[37]=E):E=e[37];let P;e[38]!==E?(P=t.jsx(se,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:E})}),e[38]=E,e[39]=P):P=e[39];let O;e[40]!==p?(O=p.length>0?p.map(hs):t.jsx(ae,{label:"resources"}),e[40]=p,e[41]=O):O=e[41];let M;e[42]!==O?(M=t.jsx(se,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:O})}),e[42]=O,e[43]=M):M=e[43];let z;return e[44]!==T||e[45]!==h||e[46]!==D||e[47]!==P||e[48]!==M?(z=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(Mt,{defaultValue:"tools",variant:"underline",children:[T,h,D,P,M]})}),e[44]=T,e[45]=h,e[46]=D,e[47]=P,e[48]=M,e[49]=z):z=e[49],z}function hs(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(qe,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:s.name}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description}),s.uri&&t.jsx("div",{className:"text-xs text-muted-foreground/60 font-mono mt-0.5 truncate",children:s.uri})]})]},s.uri??s.name)}function fs(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx($e,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Pe(s.name)}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description})]})]},s.name)}function gs(s){return ue(s._meta)}function js(s){const e=$.c(13),{connection:n,displayTitle:r}=s,i=r??n.title;let o;e[0]!==n.icon||e[1]!==i?(o=t.jsx(ie,{icon:n.icon,name:i,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=i,e[2]=o):o=e[2];let l;e[3]!==i?(l=t.jsx("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:t.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground leading-none",children:i})}),e[3]=i,e[4]=l):l=e[4];let c;e[5]!==n.description?(c=n.description&&t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:n.description}),e[5]=n.description,e[6]=c):c=e[6];let m;e[7]!==l||e[8]!==c?(m=t.jsxs("div",{className:"flex-1 min-w-0",children:[l,c]}),e[7]=l,e[8]=c,e[9]=m):m=e[9];let d;return e[10]!==o||e[11]!==m?(d=t.jsxs("div",{className:"flex items-center gap-6 py-7 px-8 bg-background border-b border-border shrink-0",children:[o,m]}),e[10]=o,e[11]=m,e[12]=d):d=e[12],d}function vs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:r,onRemoveOAuth:i}){const o=xe({control:s.control,name:"ui_type"}),l=xe({control:s.control,name:"connection_url"}),{stdioEnabled:c}=Ve(),m=(()=>{if(typeof l!="string"||!l)return!1;try{const a=new URL(l);return a.hostname==="api.githubcopilot.com"&&a.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),d=c||e.connection_type==="STDIO",p=e.connection_type==="VIRTUAL",x=p?Me(e.connection_url):null;return p?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(De,{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."})]}),x&&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:x})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(U,{control:s.control,name:"ui_type",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),o!=="NPX"&&o!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(fe,{value:a.value,onValueChange:a.onChange,children:[t.jsx(R,{children:t.jsxs(ge,{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(ne,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(je,{})]})}),t.jsxs(ve,{children:[t.jsx(L,{value:"HTTP",children:"HTTP"}),t.jsx(L,{value:"SSE",children:"SSE"}),t.jsx(L,{value:"Websocket",children:"Websocket"}),d&&t.jsxs(t.Fragment,{children:[t.jsx(L,{value:"NPX",children:"NPX Package"}),t.jsx(L,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(U,{control:s.control,name:"connection_url",render:({field:f})=>t.jsx(F,{className:"flex-1 min-w-0",children:t.jsx(R,{children:t.jsx(G,{placeholder:"https://example.com/mcp",...f,value:f.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(fe,{value:a.value,onValueChange:a.onChange,children:[t.jsx(R,{children:t.jsx(ge,{className:"h-10",children:t.jsx(je,{})})}),t.jsxs(ve,{children:[t.jsx(L,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ne,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(L,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ne,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(L,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ne,{className:"w-4 h-4"}),"Websocket"]})}),d&&t.jsxs(t.Fragment,{children:[t.jsx(L,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Qt,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(L,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(qt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(W,{})]})}),o==="NPX"&&t.jsx(U,{control:s.control,name:"npx_package",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(R,{children:t.jsx(G,{placeholder:"@perplexity-ai/mcp-server",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),o==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(U,{control:s.control,name:"stdio_command",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(R,{children:t.jsx(G,{placeholder:"node, bun, python...",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),t.jsx(U,{control:s.control,name:"stdio_args",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(R,{children:t.jsx(G,{placeholder:"arg1 arg2 --flag value",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(W,{})]})})]}),t.jsx(U,{control:s.control,name:"stdio_cwd",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(R,{children:t.jsx(G,{placeholder:"/path/to/project (optional)",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(U,{control:s.control,name:"env_vars",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(R,{children:t.jsx(Xe,{value:a.value??[],onChange:a.onChange})}),t.jsx(W,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(U,{control:s.control,name:"connection_token",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:m?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Bt,{children:[t.jsx(Ht,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Ft,{variant:"success",className:"gap-1.5",children:[t.jsx(Xt,{size:12}),"Authenticated via OAuth",t.jsx(Gt,{size:12})]})})}),t.jsxs(Wt,{align:"start",children:[t.jsxs(he,{onClick:r,children:[t.jsx(Kt,{size:16}),"Re-authenticate"]}),t.jsxs(he,{variant:"destructive",onClick:i,children:[t.jsx(de,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&a.value===null?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>a.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(Jt,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(R,{children:t.jsx(G,{type:"password",placeholder:m?"Paste your GitHub PAT":"Enter access token...",...a,value:a.value||"",className:"h-10 rounded-lg"})}),m&&t.jsxs(_t,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(W,{})]})})]})}function bs(s){return s.command==="npx"}function Ns(s){return s.args?.find(e=>!e.startsWith("-"))??""}function ys(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function Cs(s,e){const n={command:"npx",args:["-y",s]},r=_e(e);return Object.keys(r).length>0&&(n.envVars=r),n}function _s(s,e,n,r){const i={command:s};e.trim()&&(i.args=e.trim().split(/\s+/)),n?.trim()&&(i.cwd=n.trim());const o=_e(r);return Object.keys(o).length>0&&(i.envVars=o),i}function be(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"&&Be(s.connection_headers)){const r=s.connection_headers,i=Qe(r.envVars);if(bs(r)){const l=Ns(r);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:l,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:i}}const o=ys(r);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:o.command,stdio_args:o.args,stdio_cwd:o.cwd,env_vars: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 Ss(s){let e,n=null,r=null,i=null;return s.ui_type==="NPX"?(e="STDIO",n="",i=Cs(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",i=_s(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",r=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...r&&{connection_token:r},...i&&{connection_headers:i},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function ws({connection:s,connectionId:e,org:n,isUpdating:r,tools:i,prompts:o,resources:l,siblings:c}){const m=re({from:"/$org/$project/mcps/$appSlug"}),d=Re(),p=ke(),[x,a]=B.useState(null),[f,j]=B.useState(null),[b,v]=B.useState(!1),g=Se({connectionId:e}),{data:C}=Ye(),A=C?.data?.members??[],_=x??s,N=A.find(u=>u.userId===_.created_by),S=s?.connection_type==="VIRTUAL"||g.isAuthenticated,I=Ke({connections:[s],binding:"MCP"}).length>0,h=Le({resolver:Ue(Ge),values:be(x??s)}),D=h.formState.isDirty,E=async()=>{if(!await h.trigger())return;const k=h.getValues(),V=Ss(k),K=x?.id??e;await p.update.mutateAsync({id:K,data:V}),h.reset(k)},P=()=>{h.reset(be(x??s))},O=async u=>{const{token:k,tokenInfo:V,error:K}=await He({connectionId:u});if(K||!k){Z.error(`Authentication failed: ${K}`);return}if(V)try{const q=await fetch(`/api/connections/${u}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:V.accessToken,refreshToken:V.refreshToken,expiresIn:V.expiresIn,scope:V.scope,clientId:V.clientId,clientSecret:V.clientSecret,tokenEndpoint:V.tokenEndpoint})});if(!q.ok)console.error("Failed to save OAuth token:",await q.text()),await p.update.mutateAsync({id:u,data:{connection_token:k}});else try{await p.update.mutateAsync({id:u,data:{}})}catch(ee){console.warn("Failed to refresh connection tools after OAuth:",ee)}}catch(q){console.error("Error saving OAuth token:",q),await p.update.mutateAsync({id:u,data:{connection_token:k}})}else await p.update.mutateAsync({id:u,data:{connection_token:k}});const Y=new URL(`/mcp/${u}`,window.location.origin);await d.invalidateQueries({queryKey:le.isMCPAuthenticated(Y.href,null)}),Z.success("Authentication successful")},M=()=>O(s.id),z=async()=>{try{const u=await fetch(`/api/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!u.ok){const V=await u.text();Z.error(`Failed to remove OAuth: ${V}`);return}const k=new URL(`/mcp/${s.id}`,window.location.origin);await d.invalidateQueries({queryKey:le.isMCPAuthenticated(k.href,null)}),Z.success("OAuth removed. You can now re-authenticate with a different account.")}catch(u){console.error("Error removing OAuth token:",u),Z.error("Failed to remove OAuth")}},y=async u=>{await p.delete.mutateAsync(u.id),c.length<=1&&m({to:"/$org/$project/mcps",params:{org:n,project:J}}),j(null)},Q=t.jsx(rt,{children:t.jsxs(it,{children:[t.jsx(pe,{children:t.jsx(at,{asChild:!0,children:t.jsx(ye,{to:"/$org/$project/mcps",params:{org:n,project:J},children:"Connections"})})}),t.jsx(lt,{}),t.jsx(pe,{children:t.jsx(ct,{children:(()=>{const u=c[0]??s;return u.app_name?u.title.replace(/\s*\(\d+\)\s*$/,""):u.title})()})})]})});return t.jsxs(t.Fragment,{children:[t.jsx(mt,{open:f!==null,onOpenChange:u=>{u||j(null)},children:t.jsxs(ut,{children:[t.jsxs(xt,{children:[t.jsx(pt,{children:"Disconnect instance?"}),t.jsxs(ht,{children:["This will permanently remove"," ",t.jsx("span",{className:"font-medium text-foreground",children:f?.title}),". This action cannot be undone."]})]}),t.jsxs(ft,{children:[t.jsx(gt,{children:"Cancel"}),t.jsx(jt,{onClick:()=>f&&y(f),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})}),t.jsx(vt,{open:x!==null,onOpenChange:u=>{u||a(null)},children:t.jsxs(bt,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(Nt,{className:"px-6 py-4 border-b border-border shrink-0",children:[t.jsx(yt,{className:"text-base",children:x?.title??s.title}),t.jsx(Ct,{className:"text-xs",children:"Update URL, authentication, and other settings"}),N&&t.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Connected by"}),t.jsx(Ze,{url:N.user?.image??void 0,fallback:N.user?.name??N.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:N.user?.name||N.user?.email})]})]}),t.jsxs(St,{...h,children:[t.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5 flex flex-col gap-6",children:[t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(U,{control:h.control,name:"title",render:({field:u})=>t.jsxs(F,{children:[t.jsx(H,{children:"Name"}),t.jsx(R,{children:t.jsx(G,{...u})}),t.jsx(W,{})]})}),t.jsx(U,{control:h.control,name:"description",render:({field:u})=>t.jsxs(F,{children:[t.jsx(H,{children:"Description"}),t.jsx(R,{children:t.jsx(G,{...u,value:u.value||""})}),t.jsx(W,{})]})})]}),t.jsx(vs,{form:h,connection:x??s,hasOAuthToken:g.hasOAuthToken,onReauthenticate:M,onRemoveOAuth:z}),t.jsx(Je,{connection:x??s,form:h,hasMcpBinding:I,isMCPAuthenticated:S,supportsOAuth:g.supportsOAuth,isServerError:g.isServerError,onAuthenticate:M,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(X,{onClick:E,disabled:!D||r,className:"flex-1",children:r?"Saving…":"Save changes"}),D&&t.jsx(X,{variant:"outline",onClick:P,children:"Undo"}),t.jsxs(X,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const u=x??s;a(null),j(u)},children:[t.jsx(de,{size:15}),"Delete"]})]})]},x?.id??s.id)]})}),t.jsx(wt,{breadcrumb:Q,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(js,{connection:s,displayTitle:(()=>{const u=c[0]??s;return u.app_name?u.title.replace(/\s*\(\d+\)\s*$/,""):u.title})()}),t.jsx("div",{className:"flex-1 overflow-auto @container",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-2 gap-5 p-6",children:[t.jsx(ls,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(es,{instances:c,onConfigure:u=>a(u),onAuthenticate:u=>O(u.id),onDelete:u=>j(u),isAdding:b,onAdd:async()=>{v(!0);try{const u=c[0]??s,k=u.title.replace(/\s*\(\d+\)\s*$/,""),V=c.length+1,K=`${k} (${V})`,Y=We("conn");await p.create.mutateAsync({id:Y,title:K,description:u.description??null,connection_type:u.connection_type,connection_url:u.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:u.created_by,organization_id:u.organization_id,icon:u.icon??null,app_name:u.app_name??null,app_id:u.app_id??null,connection_headers:u.connection_headers??null,oauth_config:null,configuration_state:u.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const q=new URL(`/mcp/${Y}`,window.location.origin),ee=await Fe({url:q.href,token:null});ee.supportsOAuth&&!ee.isAuthenticated&&await O(Y)}finally{v(!1)}}}),t.jsx(ms,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ps,{tools:i,prompts:o,resources:l,connectionId:e,org:n})})]})})]})})]})}function ks(){const s=$.c(31);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/$project/mcps/$appSlug"},s[0]=e):e=s[0];const n=re(e);let r;s[1]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org/$project/mcps/$appSlug"},s[1]=r):r=s[1];const{appSlug:i,org:o}=ze(r),{org:l}=oe(),c=et(),m=ke();let d;s[2]!==i?(d=y=>y.connection_type!=="VIRTUAL"&&me(y)===i,s[2]=i,s[3]=d):d=s[3];const p=c.filter(d),x=p[0]??null,a=x?.id??"",f=ce({connectionId:a||null,orgId:l.id}),b=!(x?.connection_type==="VIRTUAL")&&x?.tools&&x.tools.length>0,v=!b;let g;s[4]!==f||s[5]!==v?(g={client:f,enabled:v},s[4]=f,s[5]=v,s[6]=g):g=s[6];const{data:C}=st(g),A=b?x?.tools??[]:(C?.tools??[]).map(Is);let _;e:{if(p.length<=1){_=A;break e}const y=new Set,Q=[];for(const u of p)for(const k of u.tools??[])y.has(k.name)||(y.add(k.name),Q.push({name:k.name,description:k.description,inputSchema:k.inputSchema??{},outputSchema:k.outputSchema,annotations:k.annotations,_meta:k._meta}));_=Q.length>0?Q:A}const N=_;let w;s[7]!==f?(w={client:f},s[7]=f,s[8]=w):w=s[8];const{data:S}=ot(w);let T;s[9]!==f?(T={client:f},s[9]=f,s[10]=T):T=s[10];const{data:I}=nt(T);let h;s[11]!==S?.prompts?(h=S?.prompts??[],s[11]=S?.prompts,s[12]=h):h=s[12];let D;s[13]!==h?(D=h.map(As),s[13]=h,s[14]=D):D=s[14];const E=D;let P;s[15]!==I?.resources?(P=I?.resources??[],s[15]=I?.resources,s[16]=P):P=s[16];let O;s[17]!==P?(O=P.map(Ts),s[17]=P,s[18]=O):O=s[18];const M=O;if(!x){let y;return s[19]!==n||s[20]!==o?(y=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ce,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(X,{variant:"outline",onClick:()=>n({to:"/$org/$project/mcps",params:{org:o,project:J}}),children:"Back to connections"})})}),s[19]=n,s[20]=o,s[21]=y):y=s[21],y}let z;return s[22]!==m.update.isPending||s[23]!==N||s[24]!==x||s[25]!==a||s[26]!==o||s[27]!==E||s[28]!==M||s[29]!==p?(z=t.jsx(ws,{org:o,connection:x,connectionId:a,isUpdating:m.update.isPending,tools:N,prompts:E,resources:M,siblings:p}),s[22]=m.update.isPending,s[23]=N,s[24]=x,s[25]=a,s[26]=o,s[27]=E,s[28]=M,s[29]=p,s[30]=z):z=s[30],z}function Ts(s){return{name:s.name,description:s.description,uri:s.uri}}function As(s){return{name:s.name,description:s.description}}function Is(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,annotations:s.annotations,_meta:s._meta}}function Ds(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ee,{children:t.jsx(B.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(Te,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(ks,{})})}),s[0]=e):e=s[0],e}function no(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ds,{}),s[0]=e):e=s[0],e}export{no as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as me,j as t,E as wt,r as K,u as At,w as Dt,e as It,d as Pt,f as $t,y as Et,z as Je,t as Ot,q as Lt,b as Vt,B as P,D as se,O as W,v as $,i as zt,a as Ft,K as Mt}from"./index-DcxE8oe_.js";import{g as Ut}from"./generate-id-BaIFvm62.js";import{C as Bt}from"./collection-display-button-kCOiEzLn.js";import{C as Rt}from"./collection-search-Bdxpglbf.js";import{C as Ht}from"./collection-tabs-IdlFD1jR.js";import{C as be}from"./connection-card-BWZAp_hO.js";import{E as Kt}from"./empty-state-C4c2sKjV.js";import{I as Ae}from"./integration-icon-6jcHFHZV.js";import{u as Ze,P as ae}from"./index-DZ6p-ZXx.js";import{u as Xt,f as Wt,g as et}from"./registry-utils-CkCRcmq4.js";import{u as Gt}from"./use-infinite-scroll-CqxPDCSp.js";import{u as qt}from"./use-list-state-CWVUvMhj.js";import{u as Qt}from"./use-store-discovery-z8nwAYJJ.js";import{g as oe}from"./connection-slug-Bw8dtz1U.js";import{s as Yt}from"./slugify-CEUa2lfQ.js";import{f as De,a as Ie,b as Pe,c as $e,d as Ee,e as Oe,A as Le,h as Ve}from"./alert-dialog-BGZzdkI2.js";import{B as Jt,a as Zt,b as en,c as tn}from"./breadcrumb-ijphtzQp.js";import{C as ot}from"./checkbox-B_91sMwd.js";import{D as it,a as rt,b as ct,c as lt,d as at,e as dt}from"./dialog-BDa2Gsq9.js";import{D as ze,a as Fe,b as Me,c as ue}from"./dropdown-menu-DEQ5DCnG.js";import{a as nn,F as M,b as U,c as B,d as R,f as H}from"./form-BWoxqZfk.js";import{I as ne}from"./input-DPpAbHbD.js";import{S as sn,a as on,b as rn,c as cn,d as de}from"./select-DeNgR918.js";import{T as ln}from"./textarea-C7YqhWTc.js";import{a as an,b as tt}from"./use-connection-Cv_-e2MS.js";import{u as dn,a as un}from"./constants-BCt7c81T.js";import{b as pn}from"./use-virtual-mcp-DfPJ-WDb.js";import{i as mn}from"./CheckSquare-Be1kXxvn.js";import{i as hn}from"./CheckVerified02-CZakFFpv.js";import{t as xn}from"./ChevronDown-DElgod-p.js";import{n as pe}from"./Container-C8ScaknS.js";import{i as ut}from"./DotsVertical-rvqtR29a.js";import{s as pt}from"./Eye-BgAytXDm.js";import{s as we}from"./Globe02-4oAOo4_d.js";import{i as Se}from"./Loading01-B85tVuIU.js";import{s as fn}from"./Plus-C9dY5EOr.js";import{i as gn}from"./Terminal-COsHV7Wy.js";import{s as mt}from"./Trash01-BtiNjuw3.js";import{s as jn}from"./XClose-Dey3r3af.js";import{r as yn,E as vn,c as Cn,e as ht}from"./env-vars-editor-Ah5xyGmz.js";import{e as bn}from"./extract-connection-data-BxJWN5u-.js";import"./ArrowDown-bcBjuFxH.js";import"./ArrowUp-BtIkmj4Y.js";import"./Check-GOz4_bBS.js";import"./Grid01-NwJJaoW7.js";import"./List-DD3BKPLz.js";import"./tooltip-CXZH0tSC.js";import"./index-10S4l3se.js";import"./badge-B_BTuJZe.js";import"./SearchMd-CKp0BoPW.js";import"./card-CwEWrOs9.js";import"./useQuery-CEE9SUlS.js";import"./useMutation-CV3IN68C.js";import"./binder-l1kCmNCE.js";import"./use-view-mode-XMRPR1ke.js";import"./use-mobile-v2XXLV0O.js";import"./useInfiniteQuery-BIejUr4H.js";import"./infiniteQueryObserver-CzIVu_kK.js";import"./ChevronRight-Ys0vr-YD.js";import"./X-CaaFSPD_.js";import"./label-BtaiiWJ8.js";import"./ChevronUp-CKkWbsZ5.js";import"./use-collections-CObsJD7p.js";function nt(i){return oe(i)}function Sn(i){const e=new Map;for(const c of i){if(c.connection_type==="VIRTUAL")continue;const l=nt(c),d=e.get(l);d?d.push(c):e.set(l,[c])}const o=[],a=new Set;for(const c of i){if(c.connection_type==="VIRTUAL")continue;const l=nt(c);if(a.has(l))continue;a.add(l);const d=e.get(l),h=d[0];d.length===1?o.push({type:"single",connection:h}):o.push({type:"group",key:l,icon:h.icon,title:h.app_name?h.title.replace(/\s*\(\d+\)\s*$/,""):h.title,connections:d})}return o}function Ne(i){const e=i.trim();if(!e)return"";try{const o=new URL(e),a=o.pathname.length>1?o.pathname.replace(/\/+$/,""):o.pathname;return`${o.origin}${a}`}catch{return e.replace(/\/+$/,"")}}function Nn(i){const e=i.trim().split(/\s+/).filter(Boolean);if(e.length<2)return null;const o=e[0]?.toLowerCase();if(o!=="npx"&&o!=="bunx")return null;const c=e.slice(1).find(l=>!l.startsWith("-"));return c?{packageName:c}:null}function Ce(i){const{uiType:e}=i,o=Ne(i.connectionUrl??"");if((e==="HTTP"||e==="SSE"||e==="Websocket")&&o===Ne("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 a=(i.npxPackage??"").trim();return e==="NPX"&&a==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function st(i){if(i.registryItems.length===0||i.uiType!=="HTTP"&&i.uiType!=="SSE"&&i.uiType!=="Websocket")return null;const e=Ne(i.connectionUrl??"");if(!e)return null;const o=i.registryItems.find(l=>(l.server?.remotes??[]).some(h=>Ne(h.url??"")===e));if(!o)return null;const a=o.title||o.name||o.server?.title||o.server?.name||"",c=o.server?.description||o.description||o.summary||null;return a?{id:"registry",title:a,description:c}:null}function _n(i,e){const o={command:"npx",args:["-y",i]},a=ht(e);return Object.keys(a).length>0&&(o.envVars=a),o}function kn(i,e,o,a){const c={command:i};e.trim()&&(c.args=e.trim().split(/\s+/)),o?.trim()&&(c.cwd=o.trim());const l=ht(a);return Object.keys(l).length>0&&(c.envVars=l),c}function Tn(i){return i.command==="npx"}function wn(i){return i.args?.find(e=>!e.startsWith("-"))??""}function An(i){return{command:i.command,args:i.args?.join(" ")??"",cwd:i.cwd??""}}function Dn(i,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 In(i){const e=me.c(51),{group:o,onOpen:a,selectionMode:c,selectedIds:l,onToggleSelect:d}=i;let h;if(e[0]!==o.connections||e[1]!==l){let N;e[3]!==l?(N=J=>l.has(J.id),e[3]=l,e[4]=N):N=e[4],h=o.connections.every(N),e[0]=o.connections,e[1]=l,e[2]=h}else h=e[2];const C=h;let y;if(e[5]!==o.connections||e[6]!==l){let N;e[8]!==l?(N=J=>l.has(J.id),e[8]=l,e[9]=N):N=e[9],y=o.connections.some(N),e[5]=o.connections,e[6]=l,e[7]=y}else y=e[7];const m=y,f=`${o.connections.length} instances`;let v;e[10]!==o.icon||e[11]!==o.title||e[12]!==f?(v={title:o.title,icon:o.icon,description:f},e[10]=o.icon,e[11]=o.title,e[12]=f,e[13]=v):v=e[13];let x;e[14]!==C||e[15]!==o.connections||e[16]!==a||e[17]!==d||e[18]!==l||e[19]!==c?(x=()=>c?(()=>{for(const N of o.connections)C?l.has(N.id)&&d(N.id):l.has(N.id)||d(N.id)})():a(),e[14]=C,e[15]=o.connections,e[16]=a,e[17]=d,e[18]=l,e[19]=c,e[20]=x):x=e[20];const g=c&&C&&"ring-2 ring-primary",b=c&&m&&!C&&"ring-1 ring-primary/50";let k;e[21]!==g||e[22]!==b?(k=se(g,b),e[21]=g,e[22]=b,e[23]=k):k=e[23];let D;e[24]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx(pe,{}),e[24]=D):D=e[24];let S;e[25]!==C||e[26]!==o.connections||e[27]!==d||e[28]!==l||e[29]!==c||e[30]!==m?(S=c?t.jsx(ot,{checked:C?!0:m?"indeterminate":!1,onCheckedChange:()=>{for(const N of o.connections)C?l.has(N.id)&&d(N.id):l.has(N.id)||d(N.id)}}):t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsxs("span",{className:"text-xs text-muted-foreground font-normal tabular-nums",children:["x",o.connections.length]})]}),e[25]=C,e[26]=o.connections,e[27]=d,e[28]=l,e[29]=c,e[30]=m,e[31]=S):S=e[31];const A=c?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100";let O;e[32]!==A?(O=se("overflow-hidden transition-all duration-150 ease-out",A),e[32]=A,e[33]=O):O=e[33];let G;e[34]===Symbol.for("react.memo_cache_sentinel")?(G=t.jsx(Fe,{asChild:!0,children:t.jsx(P,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:$n,children:t.jsx(ut,{size:20})})}),e[34]=G):G=e[34];let q;e[35]!==a?(q=N=>{N.stopPropagation(),a()},e[35]=a,e[36]=q):q=e[36];let Q;e[37]===Symbol.for("react.memo_cache_sentinel")?(Q=t.jsx(pt,{size:16}),e[37]=Q):Q=e[37];let Y;e[38]!==q?(Y=t.jsxs(ze,{children:[G,t.jsx(Me,{align:"end",onClick:Pn,children:t.jsxs(ue,{onClick:q,children:[Q,"Open"]})})]}),e[38]=q,e[39]=Y):Y=e[39];let X;e[40]!==O||e[41]!==Y?(X=t.jsx("div",{className:O,children:Y}),e[40]=O,e[41]=Y,e[42]=X):X=e[42];let te;e[43]!==S||e[44]!==X?(te=t.jsxs("div",{className:"flex items-center gap-1",children:[S,X]}),e[43]=S,e[44]=X,e[45]=te):te=e[45];let z;return e[46]!==te||e[47]!==v||e[48]!==x||e[49]!==k?(z=t.jsx(t.Fragment,{children:t.jsx(be,{connection:v,onClick:x,className:k,fallbackIcon:D,headerActionsAlwaysVisible:!0,headerActions:te})}),e[46]=te,e[47]=v,e[48]=x,e[49]=k,e[50]=z):z=e[50],z}function Pn(i){return i.stopPropagation()}function $n(i){return i.stopPropagation()}function En(i){const e=me.c(28),{count:o,total:a,onSelectAll:c,onDeselectAll:l,onDelete:d,onAddToAgent:h,onToggleStatus:C,onCancel:y}=i;if(o===0)return null;let m;e[0]!==o?(m=t.jsxs("div",{className:"text-xs text-muted-foreground pr-1 tabular-nums",children:[o," selected"]}),e[0]=o,e[1]=m):m=e[1];let f;e[2]!==o||e[3]!==l||e[4]!==c||e[5]!==a?(f=o<a?t.jsxs(P,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:c,children:["Select all (",a,")"]}):t.jsx(P,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:l,children:"Clear selection"}),e[2]=o,e[3]=l,e[4]=c,e[5]=a,e[6]=f):f=e[6];let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(fn,{size:13}),e[7]=v):v=e[7];let x;e[8]!==h?(x=t.jsxs(P,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:h,children:[v,"Add to Agent"]}),e[8]=h,e[9]=x):x=e[9];let g;e[10]!==C?(g=t.jsx(P,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>C("active"),children:"Enable"}),e[10]=C,e[11]=g):g=e[11];let b;e[12]!==C?(b=t.jsx(P,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>C("inactive"),children:"Disable"}),e[12]=C,e[13]=b):b=e[13];let k;e[14]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(mt,{size:13}),e[14]=k):k=e[14];let D;e[15]!==d?(D=t.jsxs(P,{variant:"destructive",size:"sm",className:"h-7 text-xs px-2",onClick:d,children:[k,"Delete"]}),e[15]=d,e[16]=D):D=e[16];let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(jn,{size:13}),e[17]=S):S=e[17];let A;e[18]!==y?(A=t.jsx(P,{variant:"ghost",size:"sm",className:"h-7 text-xs px-2",onClick:y,children:S}),e[18]=y,e[19]=A):A=e[19];let O;return e[20]!==m||e[21]!==A||e[22]!==f||e[23]!==x||e[24]!==g||e[25]!==b||e[26]!==D?(O=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:[m,f,x,g,b,D,A]})}),e[20]=m,e[21]=A,e[22]=f,e[23]=x,e[24]=g,e[25]=b,e[26]=D,e[27]=O):O=e[27],O}function On(i){const e=me.c(25),{open:o,onOpenChange:a,agents:c,onConfirm:l}=i,[d,h]=K.useState(null);let C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsxs(ct,{children:[t.jsx(lt,{children:"Add to Agent"}),t.jsx(at,{children:"Select an agent to add the selected connections to."})]}),e[0]=C):C=e[0];let y;e[1]!==c||e[2]!==d?(y=c.length===0?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No agents found"}):c.map(S=>t.jsxs("button",{type:"button",onClick:()=>h(S.id),className:se("flex items-center gap-3 w-full rounded-md px-3 py-2 text-left transition-colors",d===S.id?"bg-primary/10 ring-1 ring-primary":"hover:bg-muted/50"),children:[t.jsx(Ae,{icon:S.icon,name:S.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:S.title}),S.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:S.description})]})]},S.id)),e[1]=c,e[2]=d,e[3]=y):y=e[3];let m;e[4]!==y?(m=t.jsx("div",{className:"max-h-60 overflow-auto py-2 space-y-1",children:y}),e[4]=y,e[5]=m):m=e[5];let f;e[6]!==a?(f=t.jsx(P,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e[6]=a,e[7]=f):f=e[7];const v=!d;let x;e[8]!==l||e[9]!==a||e[10]!==d?(x=()=>{d&&(l(d),a(!1),h(null))},e[8]=l,e[9]=a,e[10]=d,e[11]=x):x=e[11];let g;e[12]!==v||e[13]!==x?(g=t.jsx(P,{disabled:v,onClick:x,children:"Add"}),e[12]=v,e[13]=x,e[14]=g):g=e[14];let b;e[15]!==f||e[16]!==g?(b=t.jsxs(dt,{children:[f,g]}),e[15]=f,e[16]=g,e[17]=b):b=e[17];let k;e[18]!==m||e[19]!==b?(k=t.jsxs(rt,{className:"sm:max-w-[400px]",children:[C,m,b]}),e[18]=m,e[19]=b,e[20]=k):k=e[20];let D;return e[21]!==a||e[22]!==o||e[23]!==k?(D=t.jsx(it,{open:o,onOpenChange:a,children:k}),e[21]=a,e[22]=o,e[23]=k,e[24]=D):D=e[24],D}function Ln(i){const e=me.c(20),{open:o,onOpenChange:a,count:c,onConfirm:l}=i,d=c!==1?"s":"";let h;e[0]!==c||e[1]!==d?(h=t.jsxs($e,{children:["Delete ",c," connection",d,"?"]}),e[0]=c,e[1]=d,e[2]=h):h=e[2];const C=c!==1?"s":"";let y;e[3]!==C?(y=t.jsxs(Ee,{children:["This will permanently delete the selected connection",C,". This action cannot be undone."]}),e[3]=C,e[4]=y):y=e[4];let m;e[5]!==h||e[6]!==y?(m=t.jsxs(Pe,{children:[h,y]}),e[5]=h,e[6]=y,e[7]=m):m=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(Le,{children:"Cancel"}),e[8]=f):f=e[8];const v=c!==1?"s":"";let x;e[9]!==c||e[10]!==l||e[11]!==v?(x=t.jsxs(Oe,{children:[f,t.jsxs(Ve,{onClick:l,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:["Delete ",c," connection",v]})]}),e[9]=c,e[10]=l,e[11]=v,e[12]=x):x=e[12];let g;e[13]!==m||e[14]!==x?(g=t.jsxs(Ie,{children:[m,x]}),e[13]=m,e[14]=x,e[15]=g):g=e[15];let b;return e[16]!==a||e[17]!==o||e[18]!==g?(b=t.jsx(De,{open:o,onOpenChange:a,children:g}),e[16]=a,e[17]=o,e[18]=g,e[19]=b):b=e[19],b}function Vn(){const{org:i}=At(),e=Dt(),o=It(),a=Pt({strict:!1}),{data:c}=$t.useSession(),{stdioEnabled:l}=Et(),d=qt({namespace:i.slug,resource:"connections"}),h=an(),C=tt(d),y=tt(),[m,f]=K.useReducer(Dn,{mode:"idle"}),[v,x]=K.useState(new Set),g=v.size>0,[b,k]=K.useState(!1),[D,S]=K.useState(!1),[A,O]=Ze(Je.connectionsTab(i.slug),n=>a.tab==="all"||a.tab==="connected"?a.tab:n??"all"),[G,q]=K.useState("ALL"),[Q,Y]=K.useState("ALL"),X=pn(),z=C.filter(n=>!(n.connection_type==="VIRTUAL"||G!=="ALL"&&n.connection_type!==G||Q!=="ALL"&&n.status!==Q)),N=Sn(z),J=n=>{x(s=>{const r=new Set(s);return r.has(n)?r.delete(n):r.add(n),r})},he=()=>{x(new Set)},Z=Xt(y).sort((n,s)=>{const r=n.app_name==="@deco/management-mcp",u=s.app_name==="@deco/management-mcp";return r&&!u?1:!r&&u?-1:0}),[ie,xt]=Ze(Je.selectedRegistry(i.slug),n=>n??""),Ue=(ie?Z.find(n=>n.id===ie):void 0)??Z[0],_e=Ue?.id??"",ft=Wt(Ue?.tools),re=Qt({registryId:_e,listToolName:ft}),ke=re.items,gt=Gt(re.loadMore,re.hasMore,re.isLoadingMore),Be=new Set(y.filter(n=>n.connection_type!=="VIRTUAL"&&n.app_name).map(n=>n.app_name)),ee=d.search.toLowerCase(),Re=A==="all"||ee?ke.filter(n=>{if(!ee)return!0;const s=n._meta?.["mcp.mesh"],r=[s?.friendly_name,n.server?.name,n.server?.title,n.name,n.title,n.id].filter(Boolean).join(" "),u=[s?.short_description,s?.mesh_description,n.server?.description,n.description].filter(Boolean).join(" ");return r.toLowerCase().includes(ee)||u.toLowerCase().includes(ee)}):[],xe=Re.filter(n=>n.verified||n._meta?.["mcp.mesh"]?.verified||n.meta?.verified),fe=Re.filter(n=>!n.verified&&!n._meta?.["mcp.mesh"]?.verified&&!n.meta?.verified),jt=A==="all"&&!ee?[]:N,He=n=>{const s=Yt(n.name||n.title||n.server?.title||""),r=typeof n.id=="string"&&n.id.includes("/"),u=typeof n.server?.name=="string"&&n.server.name.includes("/"),j=r&&!u?n.id:n.server?.name||n.id||"";o({to:"/$org/$project/store/$appName",params:{org:i.slug,project:W,appName:s},search:{registryId:_e,serverName:j}})},[ge,Te]=K.useState(null),Ke=async n=>{if(!(!i||!c?.user?.id)){Te(n.id);try{const s=bn(n,i.id,c.user.id,{remoteIndex:0}),r=s.connection_type==="STDIO",u=!!s.connection_url,j=r&&s.connection_headers&&typeof s.connection_headers=="object"&&"command"in s.connection_headers;if(!u&&!j){$.error("This MCP Server cannot be connected: no connection method available"),Te(null);return}const I=n.id??n.title,F=y.filter(V=>V.app_name===I||V.title===s.title);if(F.length>0){const V=s.title||"MCP Server";s.title=`${V} (${F.length+1})`}const{id:_}=await h.create.mutateAsync(s),w=new URL(`/mcp/${_}`,window.location.origin),ve=await zt({url:w.href,token:null});if(ve.supportsOAuth&&!ve.isAuthenticated){const{token:V,tokenInfo:E,error:Ye}=await Ft({connectionId:_});if(Ye||!V){$.error(`Authentication failed: ${Ye??"no token received"}`);return}else{if(E)try{(await fetch(`/api/connections/${_}/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})})).ok?await h.update.mutateAsync({id:_,data:{}}):await h.update.mutateAsync({id:_,data:{connection_token:V}})}catch{await h.update.mutateAsync({id:_,data:{connection_token:V}})}else await h.update.mutateAsync({id:_,data:{connection_token:V}});await e.invalidateQueries({queryKey:Mt.isMCPAuthenticated(w.href,null)}),$.success("Authentication successful")}}$.success("Connected successfully")}catch(s){$.error(`Failed to connect: ${s instanceof Error?s.message:String(s)}`)}finally{Te(null)}}},Xe=a.action==="create",yt=()=>{o({to:"/$org/$project/mcps",params:{org:i.slug,project:W},search:{action:"create"}})},We=()=>{o({to:"/$org/$project/mcps",params:{org:i.slug,project:W},search:{}})},p=Ot({resolver:Lt(Cn),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),L=p.watch("ui_type"),Ge=p.watch("connection_url"),vt=p.watch("npx_package"),ce=Ce({uiType:L,connectionUrl:Ge??"",npxPackage:vt??""})??st({uiType:L,connectionUrl:Ge??"",registryItems:ke}),T=m.mode==="editing"?m.connection:null;K.useEffect(()=>{if(T){const n=Vt(T.connection_headers)?T.connection_headers:null;if(n&&T.connection_type==="STDIO"){const s=yn(n.envVars);if(Tn(n)){const r=wn(n);p.reset({title:T.title,description:T.description,icon:T.icon??null,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:r,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:s})}else{const r=An(n);p.reset({title:T.title,description:T.description,icon:T.icon??null,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:r.command,stdio_args:r.args,stdio_cwd:r.cwd,env_vars:s})}}else p.reset({title:T.title,description:T.description,icon:T.icon??null,ui_type:T.connection_type,connection_url:T.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})}else p.reset({title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})},[T,p]);const le=dn({connectionId:un,orgId:i.id}),je=()=>{e.invalidateQueries({predicate:n=>{const s=n.queryKey;return s[1]===i.id&&s[3]==="collection"&&s[4]==="CONNECTIONS"}})},Ct=async()=>{k(!1);const n=[...v];let s=0;for(const r of n)try{(await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:r,force:!0}})).isError||s++}catch{}je(),$.success(`Deleted ${s} connection${s!==1?"s":""}`),he()},bt=async n=>{const s=[...v];let r=0;for(const u of s)try{await h.update.mutateAsync({id:u,data:{status:n}}),r++}catch{}je(),$.success(`${n==="active"?"Enabled":"Disabled"} ${r} connection${r!==1?"s":""}`),he()},St=async n=>{const s=X.find(j=>j.id===n);if(!s||!le)return;const r=new Set(s.connections.map(j=>j.connection_id)),u=[...v].filter(j=>!r.has(j)).map(j=>({connection_id:j,selected_tools:null,selected_resources:null,selected_prompts:null}));if(u.length===0){$.info("All selected connections are already in that agent");return}try{await le.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:n,data:{connections:[...s.connections,...u]}}}),e.invalidateQueries({predicate:j=>{const I=j.queryKey;return I[1]===i.id&&I[3]==="collection"&&I[4]==="VIRTUAL_MCP"}}),$.success(`Added ${u.length} connection${u.length!==1?"s":""} to "${s.title}"`),he()}catch{$.error("Failed to add connections to agent")}},qe=n=>{const s=n.content;return Array.isArray(s)&&s[0]?.type==="text"&&typeof s[0].text=="string"?s[0].text:"Unknown error"},Nt=async()=>{if(m.mode!=="deleting")return;const n=m.connection;f({type:"close"});try{const s=await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:n.id}});if(s.isError){const r=qe(s),u=r.replace(/^Error:\s*/,"");try{const j=JSON.parse(u);if(j.code==="CONNECTION_IN_USE"&&j.agentNames){f({type:"force-delete",connection:n,agentNames:j.agentNames.map(I=>`"${I}"`).join(", ")});return}}catch{}$.error(`Failed to delete connection: ${r}`);return}je(),$.success("Connection deleted successfully")}catch(s){const r=s instanceof Error?s.message:String(s);$.error(`Failed to delete connection: ${r}`)}},_t=async()=>{if(m.mode!=="force-deleting")return;const n=m.connection.id;f({type:"close"});try{const s=await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:n,force:!0}});if(s.isError){$.error(`Failed to delete connection: ${qe(s)}`);return}je(),$.success("Connection deleted successfully")}catch(s){const r=s instanceof Error?s.message:String(s);$.error(`Failed to delete connection: ${r}`)}},kt=async n=>{let s,r=null,u=null,j=null;if(n.ui_type==="NPX"?(s="STDIO",r="",j=_n(n.npx_package||"",n.env_vars||[])):n.ui_type==="STDIO"?(s="STDIO",r="",j=kn(n.stdio_command||"",n.stdio_args||"",n.stdio_cwd,n.env_vars||[])):(s=n.ui_type,r=n.connection_url||"",u=n.connection_token||null),T){await h.update.mutateAsync({id:T.id,data:{title:n.title,description:n.description||null,icon:n.icon??null,connection_type:s,connection_url:r,...u&&{connection_token:u},...j&&{connection_headers:j}}}),f({type:"close"}),p.reset();return}const I=Ut("conn");await h.create.mutateAsync({id:I,title:n.title,description:n.description||null,connection_type:s,connection_url:r,connection_token:u,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:c?.user?.id||"system",organization_id:i.id,icon:n.icon??null,app_name:null,app_id:null,connection_headers:j,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),We(),p.reset(),o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:W,appSlug:oe({app_name:null,connection_url:r,title:n.title,id:I})}})},Qe=n=>{n||(Xe?We():f({type:"close"}),p.reset())},ye=n=>{const s=n.trim();if(!s)return;const r=!!p.formState.dirtyFields.title,u=!!p.formState.dirtyFields.description,j=!!p.formState.dirtyFields.env_vars,I=_=>{if(_&&(!r&&!p.getValues("title").trim()&&_.title&&p.setValue("title",_.title,{shouldDirty:!1}),!u&&!(p.getValues("description")??"").trim()&&_.description&&p.setValue("description",_.description,{shouldDirty:!1}),!j&&_.envVarKeys?.length)){const w=p.getValues("env_vars")??[],ve=new Set(w.map(E=>E.key)),V=_.envVarKeys.filter(E=>!ve.has(E));V.length>0&&p.setValue("env_vars",[...w,...V.map(E=>({key:E,value:""}))],{shouldDirty:!0})}},F=Nn(s);if(F&&l){p.setValue("ui_type","NPX",{shouldDirty:!0}),p.setValue("npx_package",F.packageName,{shouldDirty:!0}),p.setValue("connection_url","",{shouldDirty:!0}),p.setValue("connection_token",null,{shouldDirty:!0}),I(Ce({uiType:"NPX",npxPackage:F.packageName}));return}if(s.startsWith("http://")||s.startsWith("https://")){const _=L==="HTTP"||L==="SSE"||L==="Websocket"?L:"HTTP";p.setValue("ui_type",_,{shouldDirty:!0}),p.setValue("connection_url",s,{shouldDirty:!0}),I(Ce({uiType:_,connectionUrl:s})??st({uiType:_,connectionUrl:s,registryItems:ke}));return}L==="NPX"&&I(Ce({uiType:"NPX",npxPackage:s}))},Tt=t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(P,{variant:"outline",onClick:yt,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Custom Connection"})});return t.jsx(t.Fragment,{children:t.jsxs(ae,{children:[t.jsx(it,{open:Xe||m.mode==="editing",onOpenChange:Qe,children:t.jsxs(rt,{className:"sm:max-w-[525px]",children:[t.jsxs(ct,{children:[t.jsx(lt,{children:T?"Edit Connection":"Create Connection"}),t.jsx(at,{children:T?"Update the connection details below.":"Create a custom connection in your organization. Fill in the details below."})]}),t.jsx(nn,{...p,children:t.jsxs("form",{onSubmit:p.handleSubmit(kt),children:[t.jsxs("div",{className:"grid gap-4 py-4",children:[t.jsx(M,{control:p.control,name:"ui_type",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"Type *"}),t.jsxs(sn,{value:n.value,onValueChange:n.onChange,children:[t.jsx(R,{children:t.jsx(on,{children:t.jsx(rn,{})})}),t.jsxs(cn,{children:[t.jsx(de,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(we,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(de,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(we,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(de,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(we,{className:"w-4 h-4"}),"Websocket"]})}),l&&t.jsxs(t.Fragment,{children:[t.jsx(de,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(pe,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(de,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(gn,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(H,{})]})}),L==="NPX"&&t.jsx(t.Fragment,{children:t.jsx(M,{control:p.control,name:"npx_package",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"NPM Package *"}),t.jsx(R,{children:t.jsx(ne,{placeholder:"@perplexity-ai/mcp-server",...n,value:n.value??"",onPaste:s=>{const r=s.clipboardData.getData("text");r&&(s.preventDefault(),p.setValue("npx_package",r.trim(),{shouldDirty:!0}),ye(r))},onBlur:s=>{ye(s.target.value),n.onBlur()}})}),t.jsx(H,{})]})})}),L==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(M,{control:p.control,name:"stdio_command",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"Command *"}),t.jsx(R,{children:t.jsx(ne,{placeholder:"node, bun, python...",...n,value:n.value??""})}),t.jsx(H,{})]})}),t.jsx(M,{control:p.control,name:"stdio_args",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"Arguments"}),t.jsx(R,{children:t.jsx(ne,{placeholder:"arg1 arg2 --flag value",...n,value:n.value??""})}),t.jsx(H,{})]})})]}),t.jsx(M,{control:p.control,name:"stdio_cwd",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"Working Directory"}),t.jsx(R,{children:t.jsx(ne,{placeholder:"/path/to/project (optional)",...n,value:n.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),t.jsx(H,{})]})})]}),(L==="NPX"||L==="STDIO")&&t.jsx(M,{control:p.control,name:"env_vars",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"Environment Variables"}),t.jsx(R,{children:t.jsx(vn,{value:n.value??[],onChange:n.onChange})}),t.jsx(H,{})]})}),L!=="NPX"&&L!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(M,{control:p.control,name:"connection_url",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"URL *"}),t.jsx(R,{children:t.jsx(ne,{placeholder:"https://example.com/mcp",...n,value:n.value??"",onPaste:s=>{const r=s.clipboardData.getData("text");r&&(s.preventDefault(),p.setValue("connection_url",r.trim(),{shouldDirty:!0}),ye(r))},onBlur:s=>{ye(s.target.value),n.onBlur()}})}),t.jsx(H,{})]})}),t.jsx(M,{control:p.control,name:"connection_token",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:ce?.token?.label??"Token (optional)"}),t.jsx(R,{children:t.jsx(ne,{type:"password",placeholder:ce?.token?.placeholder??"Bearer token or API key",...n,value:n.value??""})}),ce?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[ce.token.helperText,ce.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(H,{})]})})]}),t.jsx(M,{control:p.control,name:"title",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"Name *"}),t.jsx(R,{children:t.jsx(ne,{placeholder:"My Connection",...n})}),t.jsx(H,{})]})}),t.jsx(M,{control:p.control,name:"description",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"Description"}),t.jsx(R,{children:t.jsx(ln,{placeholder:"A brief description of this connection",rows:3,...n,value:n.value??""})}),t.jsx(H,{})]})})]}),t.jsxs(dt,{children:[t.jsx(P,{type:"button",variant:"outline",onClick:()=>Qe(!1),children:"Cancel"}),t.jsx(P,{type:"submit",disabled:p.formState.isSubmitting,className:"min-w-40",children:p.formState.isSubmitting?"Saving...":T?"Update Connection":"Create Connection"})]})]})})]})}),t.jsx(De,{open:m.mode==="deleting",onOpenChange:n=>!n&&f({type:"close"}),children:t.jsxs(Ie,{children:[t.jsxs(Pe,{children:[t.jsx($e,{children:"Delete Connection?"}),t.jsxs(Ee,{children:["This action cannot be undone. This will permanently delete"," ",t.jsx("span",{className:"font-medium text-foreground",children:m.mode==="deleting"&&m.connection.title}),"."]})]}),t.jsxs(Oe,{children:[t.jsx(Le,{children:"Cancel"}),t.jsx(Ve,{onClick:Nt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t.jsx(De,{open:m.mode==="force-deleting",onOpenChange:n=>!n&&f({type:"close"}),children:t.jsxs(Ie,{children:[t.jsxs(Pe,{children:[t.jsx($e,{children:"Connection Used by Agents"}),t.jsx(Ee,{asChild:!0,children:t.jsxs("div",{children:[t.jsxs("p",{children:["The connection"," ",t.jsx("span",{className:"font-medium text-foreground",children:m.mode==="force-deleting"&&m.connection.title})," ","is currently used by the following agent(s):"," ",t.jsx("span",{className:"font-medium text-foreground",children:m.mode==="force-deleting"&&m.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(Oe,{children:[t.jsx(Le,{children:"Cancel"}),t.jsx(Ve,{onClick:_t,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Anyway"})]})]})}),t.jsx(Ln,{open:b,onOpenChange:k,count:v.size,onConfirm:Ct}),t.jsx(On,{open:D,onOpenChange:S,agents:X,onConfirm:St}),t.jsxs(ae.Header,{children:[t.jsx(ae.Header.Left,{children:t.jsx(Jt,{children:t.jsx(Zt,{children:t.jsx(en,{children:t.jsx(tn,{children:"Connections"})})})})}),t.jsxs(ae.Header.Right,{children:[t.jsx(Bt,{sortKey:d.sortKey,sortDirection:d.sortDirection,onSort:d.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:G,onChange:n=>q(n||"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:Q,onChange:n=>Y(n||"ALL"),options:[{id:"ALL",label:"All"},{id:"active",label:"Active"},{id:"inactive",label:"Inactive"},{id:"error",label:"Error"}]}]}),Tt]})]}),t.jsxs("div",{className:"flex flex-col gap-0",children:[t.jsx("div",{children:t.jsx(Rt,{value:d.search,onChange:d.setSearch,placeholder:"Search for a Connection...",onKeyDown:n=>{n.key==="Escape"&&(d.setSearch(""),n.target.blur())}})}),t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[t.jsx(Ht,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:A,onTabChange:n=>O(n)}),Z.length>0&&t.jsx("div",{className:se(A!=="all"&&"invisible pointer-events-none"),children:t.jsxs(ze,{children:[t.jsx(Fe,{asChild:!0,children:t.jsxs(P,{variant:"outline",size:"sm",className:"h-7 px-2 gap-1.5 text-sm font-normal",children:[(()=>{const n=Z.find(s=>s.id===(ie||Z[0]?.id))??Z[0];return t.jsxs(t.Fragment,{children:[t.jsx(Ae,{icon:n?.icon,name:n?.title??"",size:"2xs",className:"shrink-0 rounded-sm"}),t.jsx("span",{children:n?.title})]})})(),t.jsx(xn,{size:14,className:"text-muted-foreground"})]})}),t.jsx(Me,{align:"end",children:Z.map(n=>t.jsxs(ue,{onClick:()=>xt(n.id),className:se(ie===n.id||!ie&&n.id===Z[0]?.id?"bg-accent":""),children:[t.jsx(Ae,{icon:n.icon,name:n.title,size:"2xs",className:"shrink-0 rounded-sm"}),n.title]},n.id))})]})})]})]}),t.jsx(ae.Content,{children:t.jsx("div",{className:"flex-1 overflow-auto p-5",children:(ee?xe.length===0&&fe.length===0&&z.length===0:A==="all"?xe.length===0&&fe.length===0:z.length===0)?t.jsx(Kt,{image:t.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:"No Connections found",description:d.search?`No Connections match "${d.search}"`:"Create a connection to get started."}):t.jsxs("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:[jt.map(n=>{if(n.type==="group")return t.jsx(In,{group:n,onOpen:()=>{o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:W,appSlug:n.key}})},selectionMode:g,selectedIds:v,onToggleSelect:J},n.key);const s=n.connection,r=v.has(s.id);return t.jsx(be,{connection:s,fallbackIcon:t.jsx(pe,{}),onClick:()=>g?J(s.id):o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:W,appSlug:oe(s)}}),className:se(r&&"ring-2 ring-primary bg-primary/5"),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1",children:[g?t.jsx(ot,{checked:r,onCheckedChange:()=>J(s.id),onClick:u=>u.stopPropagation()}):t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsx("div",{className:se("overflow-hidden transition-all duration-150 ease-out",g?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100"),children:t.jsxs(ze,{children:[t.jsx(Fe,{asChild:!0,children:t.jsx(P,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:u=>u.stopPropagation(),children:t.jsx(ut,{size:20})})}),t.jsxs(Me,{align:"end",onClick:u=>u.stopPropagation(),children:[t.jsxs(ue,{onClick:u=>{u.stopPropagation(),o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:W,appSlug:oe(s)}})},children:[t.jsx(pt,{size:16}),"Open"]}),t.jsxs(ue,{onClick:u=>{u.stopPropagation(),J(s.id)},children:[t.jsx(mn,{size:16}),"Select"]}),t.jsxs(ue,{variant:"destructive",onClick:u=>{u.stopPropagation(),f({type:"delete",connection:s})},children:[t.jsx(mt,{size:16}),"Delete"]})]})]})})]})},s.id)}),A==="all"&&xe.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx(hn,{size:13,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"Verified"}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),xe.map(n=>{const s=n.server?.name||n.name||n.id||"",r=Be.has(s),u=n._meta?.["mcp.mesh"],j=u?.friendlyName||u?.friendly_name||n.server?.title||n.title||n.server?.name||n.name||n.id||"",I=n.server?.description||n.description||null,F=n.server?.icons?.[0]?.src||et(n.server?.repository)||null,_=y.filter(w=>w.connection_type!=="VIRTUAL"&&w.app_name===s);return t.jsx(be,{connection:{title:j,description:I,icon:F},fallbackIcon:t.jsx(pe,{}),onClick:()=>{if(r){const w=_[0];w&&o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:W,appSlug:oe(w)}})}else He(n)},headerActionsAlwaysVisible:!0,headerActions:r?t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}):t.jsx(P,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:ge!==null,onClick:w=>{w.stopPropagation(),Ke(n)},children:ge===n.id?t.jsx(Se,{size:14,className:"animate-spin"}):"Connect"})},`catalog-${n.id}`)}),A==="all"&&fe.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"All connections"}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),fe.map(n=>{const s=n.server?.name||n.name||n.id||"",r=Be.has(s),u=n._meta?.["mcp.mesh"],j=u?.friendlyName||u?.friendly_name||n.server?.title||n.title||n.server?.name||n.name||n.id||"",I=n.server?.description||n.description||null,F=n.server?.icons?.[0]?.src||et(n.server?.repository)||null,_=y.filter(w=>w.connection_type!=="VIRTUAL"&&w.app_name===s);return t.jsx(be,{connection:{title:j,description:I,icon:F},fallbackIcon:t.jsx(pe,{}),onClick:()=>{if(r){const w=_[0];w&&o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:W,appSlug:oe(w)}})}else He(n)},headerActionsAlwaysVisible:!0,headerActions:r?t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}):t.jsx(P,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:ge!==null,onClick:w=>{w.stopPropagation(),Ke(n)},children:ge===n.id?t.jsx(Se,{size:14,className:"animate-spin"}):"Connect"})},`catalog-${n.id}`)}),(A==="all"||ee)&&_e&&t.jsx("div",{ref:gt,className:"col-span-full h-4"}),(A==="all"||ee)&&re.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(Se,{size:24,className:"animate-spin text-muted-foreground"})})]})})}),g&&t.jsx(En,{count:v.size,total:z.length,onSelectAll:()=>{x(new Set(z.map(n=>n.id)))},onDeselectAll:()=>x(new Set),onDelete:()=>k(!0),onAddToAgent:()=>S(!0),onToggleStatus:bt,onCancel:he})]})})}function Gs(){const i=me.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(wt,{children:t.jsx(K.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Se,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Vn,{})})}),i[0]=e):e=i[0],e}export{Gs as default};
|
|
1
|
+
import{c as me,j as t,E as wt,r as K,u as At,w as Dt,e as It,d as Pt,f as $t,y as Et,z as Je,t as Ot,q as Lt,b as Vt,B as P,D as se,O as W,v as $,i as zt,a as Ft,K as Mt}from"./index-NjMxPJgF.js";import{g as Ut}from"./generate-id-BiV6m8fS.js";import{C as Bt}from"./collection-display-button-CpVZ4wHm.js";import{C as Rt}from"./collection-search-BYV7N3mr.js";import{C as Ht}from"./collection-tabs-CJEa3dRy.js";import{C as be}from"./connection-card-Bak2l1_M.js";import{E as Kt}from"./empty-state-xIvMMy-_.js";import{I as Ae}from"./integration-icon-BPVDVJvP.js";import{u as Ze,P as ae}from"./index-De1iYnQy.js";import{u as Xt,f as Wt,g as et}from"./registry-utils-cjX9P5J9.js";import{u as Gt}from"./use-infinite-scroll-CPhZNIw7.js";import{u as qt}from"./use-list-state-CbsN6RbJ.js";import{u as Qt}from"./use-store-discovery-B402mTHd.js";import{g as oe}from"./connection-slug-Bw8dtz1U.js";import{s as Yt}from"./slugify-CEUa2lfQ.js";import{f as De,a as Ie,b as Pe,c as $e,d as Ee,e as Oe,A as Le,h as Ve}from"./alert-dialog-B_ae3oRt.js";import{B as Jt,a as Zt,b as en,c as tn}from"./breadcrumb-C2RG4nAQ.js";import{C as ot}from"./checkbox-B1rexahu.js";import{D as it,a as rt,b as ct,c as lt,d as at,e as dt}from"./dialog-ChXYvlDt.js";import{D as ze,a as Fe,b as Me,c as ue}from"./dropdown-menu-BxlQMXgW.js";import{a as nn,F as M,b as U,c as B,d as R,f as H}from"./form-CaFPTMVC.js";import{I as ne}from"./input-B89sozd8.js";import{S as sn,a as on,b as rn,c as cn,d as de}from"./select-Dx3T3-4n.js";import{T as ln}from"./textarea-DIJzFUWn.js";import{a as an,b as tt}from"./use-connection-CHFdKnsr.js";import{u as dn,a as un}from"./constants-D7qXOYRn.js";import{b as pn}from"./use-virtual-mcp-BP6aaUzw.js";import{i as mn}from"./CheckSquare-Cr3IzSXp.js";import{i as hn}from"./CheckVerified02-r17ymUCs.js";import{t as xn}from"./ChevronDown-BIRGQoZ5.js";import{n as pe}from"./Container-DHyMOW_p.js";import{i as ut}from"./DotsVertical-2nyye7GD.js";import{s as pt}from"./Eye-hBqNQHpc.js";import{s as we}from"./Globe02-wRhoc1N5.js";import{i as Se}from"./Loading01-Bb8FCosd.js";import{s as fn}from"./Plus-CajZ9VfC.js";import{i as gn}from"./Terminal-CGwuP-_5.js";import{s as mt}from"./Trash01-B_4PTwjI.js";import{s as jn}from"./XClose-CcNXqPQc.js";import{r as yn,E as vn,c as Cn,e as ht}from"./env-vars-editor-Yss1wn0m.js";import{e as bn}from"./extract-connection-data-48N591A_.js";import"./ArrowDown-7rbX3zqZ.js";import"./ArrowUp-DoIG5eQh.js";import"./Check-DW8AVFkq.js";import"./Grid01-C5e9ReQ4.js";import"./List-NLa0AhO4.js";import"./tooltip-BJMSu0c2.js";import"./index-CqyqI90F.js";import"./badge-DtRom7JO.js";import"./SearchMd-eZWeU0sP.js";import"./card-B8qDZGCZ.js";import"./useQuery-BYBCFxgb.js";import"./useMutation-68NxhXCf.js";import"./binder-D4cqx_Kx.js";import"./use-view-mode-ss3eRodO.js";import"./use-mobile-DOUfTohp.js";import"./useInfiniteQuery-BXDrDvlH.js";import"./infiniteQueryObserver-JZ0YxCW-.js";import"./ChevronRight-DsjLlugM.js";import"./X-LzehymHS.js";import"./label-DkiEYJcU.js";import"./ChevronUp-Bi3NMXzv.js";import"./use-collections-C0cYiFfV.js";function nt(i){return oe(i)}function Sn(i){const e=new Map;for(const c of i){if(c.connection_type==="VIRTUAL")continue;const l=nt(c),d=e.get(l);d?d.push(c):e.set(l,[c])}const o=[],a=new Set;for(const c of i){if(c.connection_type==="VIRTUAL")continue;const l=nt(c);if(a.has(l))continue;a.add(l);const d=e.get(l),h=d[0];d.length===1?o.push({type:"single",connection:h}):o.push({type:"group",key:l,icon:h.icon,title:h.app_name?h.title.replace(/\s*\(\d+\)\s*$/,""):h.title,connections:d})}return o}function Ne(i){const e=i.trim();if(!e)return"";try{const o=new URL(e),a=o.pathname.length>1?o.pathname.replace(/\/+$/,""):o.pathname;return`${o.origin}${a}`}catch{return e.replace(/\/+$/,"")}}function Nn(i){const e=i.trim().split(/\s+/).filter(Boolean);if(e.length<2)return null;const o=e[0]?.toLowerCase();if(o!=="npx"&&o!=="bunx")return null;const c=e.slice(1).find(l=>!l.startsWith("-"));return c?{packageName:c}:null}function Ce(i){const{uiType:e}=i,o=Ne(i.connectionUrl??"");if((e==="HTTP"||e==="SSE"||e==="Websocket")&&o===Ne("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 a=(i.npxPackage??"").trim();return e==="NPX"&&a==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function st(i){if(i.registryItems.length===0||i.uiType!=="HTTP"&&i.uiType!=="SSE"&&i.uiType!=="Websocket")return null;const e=Ne(i.connectionUrl??"");if(!e)return null;const o=i.registryItems.find(l=>(l.server?.remotes??[]).some(h=>Ne(h.url??"")===e));if(!o)return null;const a=o.title||o.name||o.server?.title||o.server?.name||"",c=o.server?.description||o.description||o.summary||null;return a?{id:"registry",title:a,description:c}:null}function _n(i,e){const o={command:"npx",args:["-y",i]},a=ht(e);return Object.keys(a).length>0&&(o.envVars=a),o}function kn(i,e,o,a){const c={command:i};e.trim()&&(c.args=e.trim().split(/\s+/)),o?.trim()&&(c.cwd=o.trim());const l=ht(a);return Object.keys(l).length>0&&(c.envVars=l),c}function Tn(i){return i.command==="npx"}function wn(i){return i.args?.find(e=>!e.startsWith("-"))??""}function An(i){return{command:i.command,args:i.args?.join(" ")??"",cwd:i.cwd??""}}function Dn(i,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 In(i){const e=me.c(51),{group:o,onOpen:a,selectionMode:c,selectedIds:l,onToggleSelect:d}=i;let h;if(e[0]!==o.connections||e[1]!==l){let N;e[3]!==l?(N=J=>l.has(J.id),e[3]=l,e[4]=N):N=e[4],h=o.connections.every(N),e[0]=o.connections,e[1]=l,e[2]=h}else h=e[2];const C=h;let y;if(e[5]!==o.connections||e[6]!==l){let N;e[8]!==l?(N=J=>l.has(J.id),e[8]=l,e[9]=N):N=e[9],y=o.connections.some(N),e[5]=o.connections,e[6]=l,e[7]=y}else y=e[7];const m=y,f=`${o.connections.length} instances`;let v;e[10]!==o.icon||e[11]!==o.title||e[12]!==f?(v={title:o.title,icon:o.icon,description:f},e[10]=o.icon,e[11]=o.title,e[12]=f,e[13]=v):v=e[13];let x;e[14]!==C||e[15]!==o.connections||e[16]!==a||e[17]!==d||e[18]!==l||e[19]!==c?(x=()=>c?(()=>{for(const N of o.connections)C?l.has(N.id)&&d(N.id):l.has(N.id)||d(N.id)})():a(),e[14]=C,e[15]=o.connections,e[16]=a,e[17]=d,e[18]=l,e[19]=c,e[20]=x):x=e[20];const g=c&&C&&"ring-2 ring-primary",b=c&&m&&!C&&"ring-1 ring-primary/50";let k;e[21]!==g||e[22]!==b?(k=se(g,b),e[21]=g,e[22]=b,e[23]=k):k=e[23];let D;e[24]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx(pe,{}),e[24]=D):D=e[24];let S;e[25]!==C||e[26]!==o.connections||e[27]!==d||e[28]!==l||e[29]!==c||e[30]!==m?(S=c?t.jsx(ot,{checked:C?!0:m?"indeterminate":!1,onCheckedChange:()=>{for(const N of o.connections)C?l.has(N.id)&&d(N.id):l.has(N.id)||d(N.id)}}):t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsxs("span",{className:"text-xs text-muted-foreground font-normal tabular-nums",children:["x",o.connections.length]})]}),e[25]=C,e[26]=o.connections,e[27]=d,e[28]=l,e[29]=c,e[30]=m,e[31]=S):S=e[31];const A=c?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100";let O;e[32]!==A?(O=se("overflow-hidden transition-all duration-150 ease-out",A),e[32]=A,e[33]=O):O=e[33];let G;e[34]===Symbol.for("react.memo_cache_sentinel")?(G=t.jsx(Fe,{asChild:!0,children:t.jsx(P,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:$n,children:t.jsx(ut,{size:20})})}),e[34]=G):G=e[34];let q;e[35]!==a?(q=N=>{N.stopPropagation(),a()},e[35]=a,e[36]=q):q=e[36];let Q;e[37]===Symbol.for("react.memo_cache_sentinel")?(Q=t.jsx(pt,{size:16}),e[37]=Q):Q=e[37];let Y;e[38]!==q?(Y=t.jsxs(ze,{children:[G,t.jsx(Me,{align:"end",onClick:Pn,children:t.jsxs(ue,{onClick:q,children:[Q,"Open"]})})]}),e[38]=q,e[39]=Y):Y=e[39];let X;e[40]!==O||e[41]!==Y?(X=t.jsx("div",{className:O,children:Y}),e[40]=O,e[41]=Y,e[42]=X):X=e[42];let te;e[43]!==S||e[44]!==X?(te=t.jsxs("div",{className:"flex items-center gap-1",children:[S,X]}),e[43]=S,e[44]=X,e[45]=te):te=e[45];let z;return e[46]!==te||e[47]!==v||e[48]!==x||e[49]!==k?(z=t.jsx(t.Fragment,{children:t.jsx(be,{connection:v,onClick:x,className:k,fallbackIcon:D,headerActionsAlwaysVisible:!0,headerActions:te})}),e[46]=te,e[47]=v,e[48]=x,e[49]=k,e[50]=z):z=e[50],z}function Pn(i){return i.stopPropagation()}function $n(i){return i.stopPropagation()}function En(i){const e=me.c(28),{count:o,total:a,onSelectAll:c,onDeselectAll:l,onDelete:d,onAddToAgent:h,onToggleStatus:C,onCancel:y}=i;if(o===0)return null;let m;e[0]!==o?(m=t.jsxs("div",{className:"text-xs text-muted-foreground pr-1 tabular-nums",children:[o," selected"]}),e[0]=o,e[1]=m):m=e[1];let f;e[2]!==o||e[3]!==l||e[4]!==c||e[5]!==a?(f=o<a?t.jsxs(P,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:c,children:["Select all (",a,")"]}):t.jsx(P,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:l,children:"Clear selection"}),e[2]=o,e[3]=l,e[4]=c,e[5]=a,e[6]=f):f=e[6];let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(fn,{size:13}),e[7]=v):v=e[7];let x;e[8]!==h?(x=t.jsxs(P,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:h,children:[v,"Add to Agent"]}),e[8]=h,e[9]=x):x=e[9];let g;e[10]!==C?(g=t.jsx(P,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>C("active"),children:"Enable"}),e[10]=C,e[11]=g):g=e[11];let b;e[12]!==C?(b=t.jsx(P,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>C("inactive"),children:"Disable"}),e[12]=C,e[13]=b):b=e[13];let k;e[14]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(mt,{size:13}),e[14]=k):k=e[14];let D;e[15]!==d?(D=t.jsxs(P,{variant:"destructive",size:"sm",className:"h-7 text-xs px-2",onClick:d,children:[k,"Delete"]}),e[15]=d,e[16]=D):D=e[16];let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(jn,{size:13}),e[17]=S):S=e[17];let A;e[18]!==y?(A=t.jsx(P,{variant:"ghost",size:"sm",className:"h-7 text-xs px-2",onClick:y,children:S}),e[18]=y,e[19]=A):A=e[19];let O;return e[20]!==m||e[21]!==A||e[22]!==f||e[23]!==x||e[24]!==g||e[25]!==b||e[26]!==D?(O=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:[m,f,x,g,b,D,A]})}),e[20]=m,e[21]=A,e[22]=f,e[23]=x,e[24]=g,e[25]=b,e[26]=D,e[27]=O):O=e[27],O}function On(i){const e=me.c(25),{open:o,onOpenChange:a,agents:c,onConfirm:l}=i,[d,h]=K.useState(null);let C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsxs(ct,{children:[t.jsx(lt,{children:"Add to Agent"}),t.jsx(at,{children:"Select an agent to add the selected connections to."})]}),e[0]=C):C=e[0];let y;e[1]!==c||e[2]!==d?(y=c.length===0?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No agents found"}):c.map(S=>t.jsxs("button",{type:"button",onClick:()=>h(S.id),className:se("flex items-center gap-3 w-full rounded-md px-3 py-2 text-left transition-colors",d===S.id?"bg-primary/10 ring-1 ring-primary":"hover:bg-muted/50"),children:[t.jsx(Ae,{icon:S.icon,name:S.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:S.title}),S.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:S.description})]})]},S.id)),e[1]=c,e[2]=d,e[3]=y):y=e[3];let m;e[4]!==y?(m=t.jsx("div",{className:"max-h-60 overflow-auto py-2 space-y-1",children:y}),e[4]=y,e[5]=m):m=e[5];let f;e[6]!==a?(f=t.jsx(P,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e[6]=a,e[7]=f):f=e[7];const v=!d;let x;e[8]!==l||e[9]!==a||e[10]!==d?(x=()=>{d&&(l(d),a(!1),h(null))},e[8]=l,e[9]=a,e[10]=d,e[11]=x):x=e[11];let g;e[12]!==v||e[13]!==x?(g=t.jsx(P,{disabled:v,onClick:x,children:"Add"}),e[12]=v,e[13]=x,e[14]=g):g=e[14];let b;e[15]!==f||e[16]!==g?(b=t.jsxs(dt,{children:[f,g]}),e[15]=f,e[16]=g,e[17]=b):b=e[17];let k;e[18]!==m||e[19]!==b?(k=t.jsxs(rt,{className:"sm:max-w-[400px]",children:[C,m,b]}),e[18]=m,e[19]=b,e[20]=k):k=e[20];let D;return e[21]!==a||e[22]!==o||e[23]!==k?(D=t.jsx(it,{open:o,onOpenChange:a,children:k}),e[21]=a,e[22]=o,e[23]=k,e[24]=D):D=e[24],D}function Ln(i){const e=me.c(20),{open:o,onOpenChange:a,count:c,onConfirm:l}=i,d=c!==1?"s":"";let h;e[0]!==c||e[1]!==d?(h=t.jsxs($e,{children:["Delete ",c," connection",d,"?"]}),e[0]=c,e[1]=d,e[2]=h):h=e[2];const C=c!==1?"s":"";let y;e[3]!==C?(y=t.jsxs(Ee,{children:["This will permanently delete the selected connection",C,". This action cannot be undone."]}),e[3]=C,e[4]=y):y=e[4];let m;e[5]!==h||e[6]!==y?(m=t.jsxs(Pe,{children:[h,y]}),e[5]=h,e[6]=y,e[7]=m):m=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(Le,{children:"Cancel"}),e[8]=f):f=e[8];const v=c!==1?"s":"";let x;e[9]!==c||e[10]!==l||e[11]!==v?(x=t.jsxs(Oe,{children:[f,t.jsxs(Ve,{onClick:l,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:["Delete ",c," connection",v]})]}),e[9]=c,e[10]=l,e[11]=v,e[12]=x):x=e[12];let g;e[13]!==m||e[14]!==x?(g=t.jsxs(Ie,{children:[m,x]}),e[13]=m,e[14]=x,e[15]=g):g=e[15];let b;return e[16]!==a||e[17]!==o||e[18]!==g?(b=t.jsx(De,{open:o,onOpenChange:a,children:g}),e[16]=a,e[17]=o,e[18]=g,e[19]=b):b=e[19],b}function Vn(){const{org:i}=At(),e=Dt(),o=It(),a=Pt({strict:!1}),{data:c}=$t.useSession(),{stdioEnabled:l}=Et(),d=qt({namespace:i.slug,resource:"connections"}),h=an(),C=tt(d),y=tt(),[m,f]=K.useReducer(Dn,{mode:"idle"}),[v,x]=K.useState(new Set),g=v.size>0,[b,k]=K.useState(!1),[D,S]=K.useState(!1),[A,O]=Ze(Je.connectionsTab(i.slug),n=>a.tab==="all"||a.tab==="connected"?a.tab:n??"all"),[G,q]=K.useState("ALL"),[Q,Y]=K.useState("ALL"),X=pn(),z=C.filter(n=>!(n.connection_type==="VIRTUAL"||G!=="ALL"&&n.connection_type!==G||Q!=="ALL"&&n.status!==Q)),N=Sn(z),J=n=>{x(s=>{const r=new Set(s);return r.has(n)?r.delete(n):r.add(n),r})},he=()=>{x(new Set)},Z=Xt(y).sort((n,s)=>{const r=n.app_name==="@deco/management-mcp",u=s.app_name==="@deco/management-mcp";return r&&!u?1:!r&&u?-1:0}),[ie,xt]=Ze(Je.selectedRegistry(i.slug),n=>n??""),Ue=(ie?Z.find(n=>n.id===ie):void 0)??Z[0],_e=Ue?.id??"",ft=Wt(Ue?.tools),re=Qt({registryId:_e,listToolName:ft}),ke=re.items,gt=Gt(re.loadMore,re.hasMore,re.isLoadingMore),Be=new Set(y.filter(n=>n.connection_type!=="VIRTUAL"&&n.app_name).map(n=>n.app_name)),ee=d.search.toLowerCase(),Re=A==="all"||ee?ke.filter(n=>{if(!ee)return!0;const s=n._meta?.["mcp.mesh"],r=[s?.friendly_name,n.server?.name,n.server?.title,n.name,n.title,n.id].filter(Boolean).join(" "),u=[s?.short_description,s?.mesh_description,n.server?.description,n.description].filter(Boolean).join(" ");return r.toLowerCase().includes(ee)||u.toLowerCase().includes(ee)}):[],xe=Re.filter(n=>n.verified||n._meta?.["mcp.mesh"]?.verified||n.meta?.verified),fe=Re.filter(n=>!n.verified&&!n._meta?.["mcp.mesh"]?.verified&&!n.meta?.verified),jt=A==="all"&&!ee?[]:N,He=n=>{const s=Yt(n.name||n.title||n.server?.title||""),r=typeof n.id=="string"&&n.id.includes("/"),u=typeof n.server?.name=="string"&&n.server.name.includes("/"),j=r&&!u?n.id:n.server?.name||n.id||"";o({to:"/$org/$project/store/$appName",params:{org:i.slug,project:W,appName:s},search:{registryId:_e,serverName:j}})},[ge,Te]=K.useState(null),Ke=async n=>{if(!(!i||!c?.user?.id)){Te(n.id);try{const s=bn(n,i.id,c.user.id,{remoteIndex:0}),r=s.connection_type==="STDIO",u=!!s.connection_url,j=r&&s.connection_headers&&typeof s.connection_headers=="object"&&"command"in s.connection_headers;if(!u&&!j){$.error("This MCP Server cannot be connected: no connection method available"),Te(null);return}const I=n.id??n.title,F=y.filter(V=>V.app_name===I||V.title===s.title);if(F.length>0){const V=s.title||"MCP Server";s.title=`${V} (${F.length+1})`}const{id:_}=await h.create.mutateAsync(s),w=new URL(`/mcp/${_}`,window.location.origin),ve=await zt({url:w.href,token:null});if(ve.supportsOAuth&&!ve.isAuthenticated){const{token:V,tokenInfo:E,error:Ye}=await Ft({connectionId:_});if(Ye||!V){$.error(`Authentication failed: ${Ye??"no token received"}`);return}else{if(E)try{(await fetch(`/api/connections/${_}/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})})).ok?await h.update.mutateAsync({id:_,data:{}}):await h.update.mutateAsync({id:_,data:{connection_token:V}})}catch{await h.update.mutateAsync({id:_,data:{connection_token:V}})}else await h.update.mutateAsync({id:_,data:{connection_token:V}});await e.invalidateQueries({queryKey:Mt.isMCPAuthenticated(w.href,null)}),$.success("Authentication successful")}}$.success("Connected successfully")}catch(s){$.error(`Failed to connect: ${s instanceof Error?s.message:String(s)}`)}finally{Te(null)}}},Xe=a.action==="create",yt=()=>{o({to:"/$org/$project/mcps",params:{org:i.slug,project:W},search:{action:"create"}})},We=()=>{o({to:"/$org/$project/mcps",params:{org:i.slug,project:W},search:{}})},p=Ot({resolver:Lt(Cn),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),L=p.watch("ui_type"),Ge=p.watch("connection_url"),vt=p.watch("npx_package"),ce=Ce({uiType:L,connectionUrl:Ge??"",npxPackage:vt??""})??st({uiType:L,connectionUrl:Ge??"",registryItems:ke}),T=m.mode==="editing"?m.connection:null;K.useEffect(()=>{if(T){const n=Vt(T.connection_headers)?T.connection_headers:null;if(n&&T.connection_type==="STDIO"){const s=yn(n.envVars);if(Tn(n)){const r=wn(n);p.reset({title:T.title,description:T.description,icon:T.icon??null,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:r,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:s})}else{const r=An(n);p.reset({title:T.title,description:T.description,icon:T.icon??null,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:r.command,stdio_args:r.args,stdio_cwd:r.cwd,env_vars:s})}}else p.reset({title:T.title,description:T.description,icon:T.icon??null,ui_type:T.connection_type,connection_url:T.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})}else p.reset({title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})},[T,p]);const le=dn({connectionId:un,orgId:i.id}),je=()=>{e.invalidateQueries({predicate:n=>{const s=n.queryKey;return s[1]===i.id&&s[3]==="collection"&&s[4]==="CONNECTIONS"}})},Ct=async()=>{k(!1);const n=[...v];let s=0;for(const r of n)try{(await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:r,force:!0}})).isError||s++}catch{}je(),$.success(`Deleted ${s} connection${s!==1?"s":""}`),he()},bt=async n=>{const s=[...v];let r=0;for(const u of s)try{await h.update.mutateAsync({id:u,data:{status:n}}),r++}catch{}je(),$.success(`${n==="active"?"Enabled":"Disabled"} ${r} connection${r!==1?"s":""}`),he()},St=async n=>{const s=X.find(j=>j.id===n);if(!s||!le)return;const r=new Set(s.connections.map(j=>j.connection_id)),u=[...v].filter(j=>!r.has(j)).map(j=>({connection_id:j,selected_tools:null,selected_resources:null,selected_prompts:null}));if(u.length===0){$.info("All selected connections are already in that agent");return}try{await le.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:n,data:{connections:[...s.connections,...u]}}}),e.invalidateQueries({predicate:j=>{const I=j.queryKey;return I[1]===i.id&&I[3]==="collection"&&I[4]==="VIRTUAL_MCP"}}),$.success(`Added ${u.length} connection${u.length!==1?"s":""} to "${s.title}"`),he()}catch{$.error("Failed to add connections to agent")}},qe=n=>{const s=n.content;return Array.isArray(s)&&s[0]?.type==="text"&&typeof s[0].text=="string"?s[0].text:"Unknown error"},Nt=async()=>{if(m.mode!=="deleting")return;const n=m.connection;f({type:"close"});try{const s=await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:n.id}});if(s.isError){const r=qe(s),u=r.replace(/^Error:\s*/,"");try{const j=JSON.parse(u);if(j.code==="CONNECTION_IN_USE"&&j.agentNames){f({type:"force-delete",connection:n,agentNames:j.agentNames.map(I=>`"${I}"`).join(", ")});return}}catch{}$.error(`Failed to delete connection: ${r}`);return}je(),$.success("Connection deleted successfully")}catch(s){const r=s instanceof Error?s.message:String(s);$.error(`Failed to delete connection: ${r}`)}},_t=async()=>{if(m.mode!=="force-deleting")return;const n=m.connection.id;f({type:"close"});try{const s=await le.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:n,force:!0}});if(s.isError){$.error(`Failed to delete connection: ${qe(s)}`);return}je(),$.success("Connection deleted successfully")}catch(s){const r=s instanceof Error?s.message:String(s);$.error(`Failed to delete connection: ${r}`)}},kt=async n=>{let s,r=null,u=null,j=null;if(n.ui_type==="NPX"?(s="STDIO",r="",j=_n(n.npx_package||"",n.env_vars||[])):n.ui_type==="STDIO"?(s="STDIO",r="",j=kn(n.stdio_command||"",n.stdio_args||"",n.stdio_cwd,n.env_vars||[])):(s=n.ui_type,r=n.connection_url||"",u=n.connection_token||null),T){await h.update.mutateAsync({id:T.id,data:{title:n.title,description:n.description||null,icon:n.icon??null,connection_type:s,connection_url:r,...u&&{connection_token:u},...j&&{connection_headers:j}}}),f({type:"close"}),p.reset();return}const I=Ut("conn");await h.create.mutateAsync({id:I,title:n.title,description:n.description||null,connection_type:s,connection_url:r,connection_token:u,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:c?.user?.id||"system",organization_id:i.id,icon:n.icon??null,app_name:null,app_id:null,connection_headers:j,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),We(),p.reset(),o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:W,appSlug:oe({app_name:null,connection_url:r,title:n.title,id:I})}})},Qe=n=>{n||(Xe?We():f({type:"close"}),p.reset())},ye=n=>{const s=n.trim();if(!s)return;const r=!!p.formState.dirtyFields.title,u=!!p.formState.dirtyFields.description,j=!!p.formState.dirtyFields.env_vars,I=_=>{if(_&&(!r&&!p.getValues("title").trim()&&_.title&&p.setValue("title",_.title,{shouldDirty:!1}),!u&&!(p.getValues("description")??"").trim()&&_.description&&p.setValue("description",_.description,{shouldDirty:!1}),!j&&_.envVarKeys?.length)){const w=p.getValues("env_vars")??[],ve=new Set(w.map(E=>E.key)),V=_.envVarKeys.filter(E=>!ve.has(E));V.length>0&&p.setValue("env_vars",[...w,...V.map(E=>({key:E,value:""}))],{shouldDirty:!0})}},F=Nn(s);if(F&&l){p.setValue("ui_type","NPX",{shouldDirty:!0}),p.setValue("npx_package",F.packageName,{shouldDirty:!0}),p.setValue("connection_url","",{shouldDirty:!0}),p.setValue("connection_token",null,{shouldDirty:!0}),I(Ce({uiType:"NPX",npxPackage:F.packageName}));return}if(s.startsWith("http://")||s.startsWith("https://")){const _=L==="HTTP"||L==="SSE"||L==="Websocket"?L:"HTTP";p.setValue("ui_type",_,{shouldDirty:!0}),p.setValue("connection_url",s,{shouldDirty:!0}),I(Ce({uiType:_,connectionUrl:s})??st({uiType:_,connectionUrl:s,registryItems:ke}));return}L==="NPX"&&I(Ce({uiType:"NPX",npxPackage:s}))},Tt=t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(P,{variant:"outline",onClick:yt,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Custom Connection"})});return t.jsx(t.Fragment,{children:t.jsxs(ae,{children:[t.jsx(it,{open:Xe||m.mode==="editing",onOpenChange:Qe,children:t.jsxs(rt,{className:"sm:max-w-[525px]",children:[t.jsxs(ct,{children:[t.jsx(lt,{children:T?"Edit Connection":"Create Connection"}),t.jsx(at,{children:T?"Update the connection details below.":"Create a custom connection in your organization. Fill in the details below."})]}),t.jsx(nn,{...p,children:t.jsxs("form",{onSubmit:p.handleSubmit(kt),children:[t.jsxs("div",{className:"grid gap-4 py-4",children:[t.jsx(M,{control:p.control,name:"ui_type",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"Type *"}),t.jsxs(sn,{value:n.value,onValueChange:n.onChange,children:[t.jsx(R,{children:t.jsx(on,{children:t.jsx(rn,{})})}),t.jsxs(cn,{children:[t.jsx(de,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(we,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(de,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(we,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(de,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(we,{className:"w-4 h-4"}),"Websocket"]})}),l&&t.jsxs(t.Fragment,{children:[t.jsx(de,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(pe,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(de,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(gn,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(H,{})]})}),L==="NPX"&&t.jsx(t.Fragment,{children:t.jsx(M,{control:p.control,name:"npx_package",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"NPM Package *"}),t.jsx(R,{children:t.jsx(ne,{placeholder:"@perplexity-ai/mcp-server",...n,value:n.value??"",onPaste:s=>{const r=s.clipboardData.getData("text");r&&(s.preventDefault(),p.setValue("npx_package",r.trim(),{shouldDirty:!0}),ye(r))},onBlur:s=>{ye(s.target.value),n.onBlur()}})}),t.jsx(H,{})]})})}),L==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(M,{control:p.control,name:"stdio_command",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"Command *"}),t.jsx(R,{children:t.jsx(ne,{placeholder:"node, bun, python...",...n,value:n.value??""})}),t.jsx(H,{})]})}),t.jsx(M,{control:p.control,name:"stdio_args",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"Arguments"}),t.jsx(R,{children:t.jsx(ne,{placeholder:"arg1 arg2 --flag value",...n,value:n.value??""})}),t.jsx(H,{})]})})]}),t.jsx(M,{control:p.control,name:"stdio_cwd",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"Working Directory"}),t.jsx(R,{children:t.jsx(ne,{placeholder:"/path/to/project (optional)",...n,value:n.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),t.jsx(H,{})]})})]}),(L==="NPX"||L==="STDIO")&&t.jsx(M,{control:p.control,name:"env_vars",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"Environment Variables"}),t.jsx(R,{children:t.jsx(vn,{value:n.value??[],onChange:n.onChange})}),t.jsx(H,{})]})}),L!=="NPX"&&L!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(M,{control:p.control,name:"connection_url",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"URL *"}),t.jsx(R,{children:t.jsx(ne,{placeholder:"https://example.com/mcp",...n,value:n.value??"",onPaste:s=>{const r=s.clipboardData.getData("text");r&&(s.preventDefault(),p.setValue("connection_url",r.trim(),{shouldDirty:!0}),ye(r))},onBlur:s=>{ye(s.target.value),n.onBlur()}})}),t.jsx(H,{})]})}),t.jsx(M,{control:p.control,name:"connection_token",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:ce?.token?.label??"Token (optional)"}),t.jsx(R,{children:t.jsx(ne,{type:"password",placeholder:ce?.token?.placeholder??"Bearer token or API key",...n,value:n.value??""})}),ce?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[ce.token.helperText,ce.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(H,{})]})})]}),t.jsx(M,{control:p.control,name:"title",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"Name *"}),t.jsx(R,{children:t.jsx(ne,{placeholder:"My Connection",...n})}),t.jsx(H,{})]})}),t.jsx(M,{control:p.control,name:"description",render:({field:n})=>t.jsxs(U,{children:[t.jsx(B,{children:"Description"}),t.jsx(R,{children:t.jsx(ln,{placeholder:"A brief description of this connection",rows:3,...n,value:n.value??""})}),t.jsx(H,{})]})})]}),t.jsxs(dt,{children:[t.jsx(P,{type:"button",variant:"outline",onClick:()=>Qe(!1),children:"Cancel"}),t.jsx(P,{type:"submit",disabled:p.formState.isSubmitting,className:"min-w-40",children:p.formState.isSubmitting?"Saving...":T?"Update Connection":"Create Connection"})]})]})})]})}),t.jsx(De,{open:m.mode==="deleting",onOpenChange:n=>!n&&f({type:"close"}),children:t.jsxs(Ie,{children:[t.jsxs(Pe,{children:[t.jsx($e,{children:"Delete Connection?"}),t.jsxs(Ee,{children:["This action cannot be undone. This will permanently delete"," ",t.jsx("span",{className:"font-medium text-foreground",children:m.mode==="deleting"&&m.connection.title}),"."]})]}),t.jsxs(Oe,{children:[t.jsx(Le,{children:"Cancel"}),t.jsx(Ve,{onClick:Nt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t.jsx(De,{open:m.mode==="force-deleting",onOpenChange:n=>!n&&f({type:"close"}),children:t.jsxs(Ie,{children:[t.jsxs(Pe,{children:[t.jsx($e,{children:"Connection Used by Agents"}),t.jsx(Ee,{asChild:!0,children:t.jsxs("div",{children:[t.jsxs("p",{children:["The connection"," ",t.jsx("span",{className:"font-medium text-foreground",children:m.mode==="force-deleting"&&m.connection.title})," ","is currently used by the following agent(s):"," ",t.jsx("span",{className:"font-medium text-foreground",children:m.mode==="force-deleting"&&m.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(Oe,{children:[t.jsx(Le,{children:"Cancel"}),t.jsx(Ve,{onClick:_t,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Anyway"})]})]})}),t.jsx(Ln,{open:b,onOpenChange:k,count:v.size,onConfirm:Ct}),t.jsx(On,{open:D,onOpenChange:S,agents:X,onConfirm:St}),t.jsxs(ae.Header,{children:[t.jsx(ae.Header.Left,{children:t.jsx(Jt,{children:t.jsx(Zt,{children:t.jsx(en,{children:t.jsx(tn,{children:"Connections"})})})})}),t.jsxs(ae.Header.Right,{children:[t.jsx(Bt,{sortKey:d.sortKey,sortDirection:d.sortDirection,onSort:d.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:G,onChange:n=>q(n||"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:Q,onChange:n=>Y(n||"ALL"),options:[{id:"ALL",label:"All"},{id:"active",label:"Active"},{id:"inactive",label:"Inactive"},{id:"error",label:"Error"}]}]}),Tt]})]}),t.jsxs("div",{className:"flex flex-col gap-0",children:[t.jsx("div",{children:t.jsx(Rt,{value:d.search,onChange:d.setSearch,placeholder:"Search for a Connection...",onKeyDown:n=>{n.key==="Escape"&&(d.setSearch(""),n.target.blur())}})}),t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[t.jsx(Ht,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:A,onTabChange:n=>O(n)}),Z.length>0&&t.jsx("div",{className:se(A!=="all"&&"invisible pointer-events-none"),children:t.jsxs(ze,{children:[t.jsx(Fe,{asChild:!0,children:t.jsxs(P,{variant:"outline",size:"sm",className:"h-7 px-2 gap-1.5 text-sm font-normal",children:[(()=>{const n=Z.find(s=>s.id===(ie||Z[0]?.id))??Z[0];return t.jsxs(t.Fragment,{children:[t.jsx(Ae,{icon:n?.icon,name:n?.title??"",size:"2xs",className:"shrink-0 rounded-sm"}),t.jsx("span",{children:n?.title})]})})(),t.jsx(xn,{size:14,className:"text-muted-foreground"})]})}),t.jsx(Me,{align:"end",children:Z.map(n=>t.jsxs(ue,{onClick:()=>xt(n.id),className:se(ie===n.id||!ie&&n.id===Z[0]?.id?"bg-accent":""),children:[t.jsx(Ae,{icon:n.icon,name:n.title,size:"2xs",className:"shrink-0 rounded-sm"}),n.title]},n.id))})]})})]})]}),t.jsx(ae.Content,{children:t.jsx("div",{className:"flex-1 overflow-auto p-5",children:(ee?xe.length===0&&fe.length===0&&z.length===0:A==="all"?xe.length===0&&fe.length===0:z.length===0)?t.jsx(Kt,{image:t.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:"No Connections found",description:d.search?`No Connections match "${d.search}"`:"Create a connection to get started."}):t.jsxs("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:[jt.map(n=>{if(n.type==="group")return t.jsx(In,{group:n,onOpen:()=>{o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:W,appSlug:n.key}})},selectionMode:g,selectedIds:v,onToggleSelect:J},n.key);const s=n.connection,r=v.has(s.id);return t.jsx(be,{connection:s,fallbackIcon:t.jsx(pe,{}),onClick:()=>g?J(s.id):o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:W,appSlug:oe(s)}}),className:se(r&&"ring-2 ring-primary bg-primary/5"),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1",children:[g?t.jsx(ot,{checked:r,onCheckedChange:()=>J(s.id),onClick:u=>u.stopPropagation()}):t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsx("div",{className:se("overflow-hidden transition-all duration-150 ease-out",g?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100"),children:t.jsxs(ze,{children:[t.jsx(Fe,{asChild:!0,children:t.jsx(P,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:u=>u.stopPropagation(),children:t.jsx(ut,{size:20})})}),t.jsxs(Me,{align:"end",onClick:u=>u.stopPropagation(),children:[t.jsxs(ue,{onClick:u=>{u.stopPropagation(),o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:W,appSlug:oe(s)}})},children:[t.jsx(pt,{size:16}),"Open"]}),t.jsxs(ue,{onClick:u=>{u.stopPropagation(),J(s.id)},children:[t.jsx(mn,{size:16}),"Select"]}),t.jsxs(ue,{variant:"destructive",onClick:u=>{u.stopPropagation(),f({type:"delete",connection:s})},children:[t.jsx(mt,{size:16}),"Delete"]})]})]})})]})},s.id)}),A==="all"&&xe.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx(hn,{size:13,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"Verified"}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),xe.map(n=>{const s=n.server?.name||n.name||n.id||"",r=Be.has(s),u=n._meta?.["mcp.mesh"],j=u?.friendlyName||u?.friendly_name||n.server?.title||n.title||n.server?.name||n.name||n.id||"",I=n.server?.description||n.description||null,F=n.server?.icons?.[0]?.src||et(n.server?.repository)||null,_=y.filter(w=>w.connection_type!=="VIRTUAL"&&w.app_name===s);return t.jsx(be,{connection:{title:j,description:I,icon:F},fallbackIcon:t.jsx(pe,{}),onClick:()=>{if(r){const w=_[0];w&&o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:W,appSlug:oe(w)}})}else He(n)},headerActionsAlwaysVisible:!0,headerActions:r?t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}):t.jsx(P,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:ge!==null,onClick:w=>{w.stopPropagation(),Ke(n)},children:ge===n.id?t.jsx(Se,{size:14,className:"animate-spin"}):"Connect"})},`catalog-${n.id}`)}),A==="all"&&fe.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"All connections"}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),fe.map(n=>{const s=n.server?.name||n.name||n.id||"",r=Be.has(s),u=n._meta?.["mcp.mesh"],j=u?.friendlyName||u?.friendly_name||n.server?.title||n.title||n.server?.name||n.name||n.id||"",I=n.server?.description||n.description||null,F=n.server?.icons?.[0]?.src||et(n.server?.repository)||null,_=y.filter(w=>w.connection_type!=="VIRTUAL"&&w.app_name===s);return t.jsx(be,{connection:{title:j,description:I,icon:F},fallbackIcon:t.jsx(pe,{}),onClick:()=>{if(r){const w=_[0];w&&o({to:"/$org/$project/mcps/$appSlug",params:{org:i.slug,project:W,appSlug:oe(w)}})}else He(n)},headerActionsAlwaysVisible:!0,headerActions:r?t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}):t.jsx(P,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:ge!==null,onClick:w=>{w.stopPropagation(),Ke(n)},children:ge===n.id?t.jsx(Se,{size:14,className:"animate-spin"}):"Connect"})},`catalog-${n.id}`)}),(A==="all"||ee)&&_e&&t.jsx("div",{ref:gt,className:"col-span-full h-4"}),(A==="all"||ee)&&re.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(Se,{size:24,className:"animate-spin text-muted-foreground"})})]})})}),g&&t.jsx(En,{count:v.size,total:z.length,onSelectAll:()=>{x(new Set(z.map(n=>n.id)))},onDeselectAll:()=>x(new Set),onDelete:()=>k(!0),onAddToAgent:()=>S(!0),onToggleStatus:bt,onCancel:he})]})})}function Gs(){const i=me.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(wt,{children:t.jsx(K.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Se,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Vn,{})})}),i[0]=e):e=i[0],e}export{Gs as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bM as h,c as d,x as g,bN as y}from"./index-
|
|
1
|
+
import{bM as h,c as d,x as g,bN as y}from"./index-NjMxPJgF.js";const m={authConfig:()=>["authConfig"],threads:e=>["threads",e],virtualMcpThreads:(e,t)=>["threads",e,"virtual-mcp",t],thread:(e,t)=>["thread",e,t],threadMessages:(e,t)=>["thread-messages",e,t],messages:e=>["messages",e],organizations:()=>["organizations"],members:e=>[e,"members"],invitations:e=>[e,"invitations"],organizationRoles:e=>[e,"organization-roles"],connections:e=>[e,"connections"],connectionsByBinding:(e,t)=>[e,"connections",`binding:${t}`],connection:(e,t)=>[e,"connection",t],isMCPAuthenticated:(e,t)=>["is-mcp-authenticated",e,t],mcpTools:(e,t)=>["mcp","tools",e,t],mcpClient:(e,t,n,o)=>["mcp","client",e,t,n,o],mcpToolsList:e=>["mcp","client",e,"tools"],mcpResourcesList:e=>["mcp","client",e,"resources"],mcpPromptsList:e=>["mcp","client",e,"prompts"],mcpReadResource:(e,t)=>["mcp","client",e,"resource",t],mcpGetPrompt:(e,t,n)=>["mcp","client",e,"prompt",t,n],mcpToolCall:(e,t,n)=>["mcp","client",e,"tool-call",t,n],organizationSettings:e=>["organization-settings",e],activeOrganization:e=>["activeOrganization",e],modelsList:e=>["models-list",e],connectionCollections:e=>[e,"collections","discovery"],toolCall:(e,t,n)=>["tool-call",e,t,n],collectionItems:(e,t)=>["collection",e,t],collection:(e,t,n)=>[e,t,"collection",n],collectionItem:(e,t,n,o,i)=>[e,t,n,"collection",o,i],collectionList:(e,t,n,o,i)=>[e,t,n,"collection",o,"list",i],collectionListInfinite:(e,t,n,o,i)=>[e,t,n,"collection",o,"list-infinite",i],githubReadme:(e,t)=>["github-readme",e,t],monitoringStats:()=>["monitoring","stats"],monitoringLogs:e=>["monitoring","logs",e],monitoringLogsInfinite:(e,t)=>["monitoring","logs-infinite",e,t],virtualMcpPrompts:e=>["virtual-mcp",e,"prompts"],connectionPrompts:e=>["connection",e,"prompts"],connectionResources:e=>["connection",e,"resources"],user:e=>["user",e]};class _ extends h{constructor(t,n){super(t,n)}send(t,n){const o=C(t);return o?.type==="emit"?(this.onmessage?.(o.message),Promise.resolve()):o?.type==="suppress"?Promise.resolve():super.send(t,n)}}function C(e){const t=e;if(!t||typeof t!="object"||!("method"in t))return null;switch(t.method){case"initialize":{const n=t?.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:t.jsonrpc??"2.0",id:t.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(e,t){const n=t??(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=e?`/mcp/${e}`:"/mcp";return new URL(o,n).href}async function f({connectionId:e,orgId:t,token:n,meshUrl:o}){const i=T(e,o),s=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":t,...n?{Authorization:`Bearer ${n}`}:{}}}});await s.connect(r);const l=m.mcpClient(t,e??"self",n??"",o??"");return s.toJSON=()=>`mcp-client:${l.join(":")}`,s}function S(e){const t=d.c(13),{connectionId:n,orgId:o,token:i,meshUrl:s}=e;let r;t[0]!==n||t[1]!==s||t[2]!==o||t[3]!==i?(r=m.mcpClient(o,n??"self",i??"",s??""),t[0]=n,t[1]=s,t[2]=o,t[3]=i,t[4]=r):r=t[4];const l=r;let c;t[5]!==n||t[6]!==s||t[7]!==o||t[8]!==i?(c=()=>f({connectionId:n,orgId:o,token:i,meshUrl:s}),t[5]=n,t[6]=s,t[7]=o,t[8]=i,t[9]=c):c=t[9];let a;t[10]!==l||t[11]!==c?(a={queryKey:l,queryFn:c,staleTime:1/0,gcTime:0},t[10]=l,t[11]=c,t[12]=a):a=t[12];const{data:u}=g(a);return u}function w(e){const t=d.c(13),{connectionId:n,orgId:o,token:i,meshUrl:s}=e;let r;t[0]!==n||t[1]!==s||t[2]!==o||t[3]!==i?(r=n!==void 0?m.mcpClient(o,n??"self",i??"",s??""):["mcp","client","skip",o],t[0]=n,t[1]=s,t[2]=o,t[3]=i,t[4]=r):r=t[4];const l=r;let c;t[5]!==n||t[6]!==s||t[7]!==o||t[8]!==i?(c=async()=>n===void 0?null:f({connectionId:n,orgId:o,token:i,meshUrl:s}),t[5]=n,t[6]=s,t[7]=o,t[8]=i,t[9]=c):c=t[9];let a;t[10]!==l||t[11]!==c?(a={queryKey:l,queryFn:c,staleTime:1/0,gcTime:0},t[10]=l,t[11]=c,t[12]=a):a=t[12];const{data:u}=g(a);return u??null}const P={SELF:e=>`${e}_self`,REGISTRY:e=>`${e}_registry`,COMMUNITY_REGISTRY:e=>`${e}_community-registry`,DEV_ASSETS:e=>`${e}_dev-assets`},M="self";function R(e){return{id:P.REGISTRY(e),title:"Deco Store",description:"Official deco MCP registry with curated integrations",connection_type:"HTTP",connection_url:"https://studio.decocms.com/org/deco/registry/mcp",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(e){return{id:v(e),organization_id:e,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 E(e){return!e||!e.startsWith(p)?null:e.slice(p.length)||null}function v(e){return`${p}${e}`}export{m as K,_ as S,P as W,M as a,L as b,f as c,D as d,R as e,w as f,v as g,E as i,S as u};
|