decocms 3.83.0 → 3.83.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-CqXnKI3D.js → AlertCircle-DM0HzopE.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-D_A_c-WP.js → ArrowUpRight-CoxAwUHc.js} +1 -1
- package/dist/client/assets/{CheckCircle-B6_BlhWA.js → CheckCircle-D5UuMIIH.js} +1 -1
- package/dist/client/assets/{ChevronDown-CsJyvcQs.js → ChevronDown-CW3qqv2x.js} +1 -1
- package/dist/client/assets/{ChevronLeft-cwkPjMhb.js → ChevronLeft-LzGuMB2U.js} +1 -1
- package/dist/client/assets/{ChevronRight-DbmfCIOT.js → ChevronRight-B0GGkNIH.js} +1 -1
- package/dist/client/assets/{ChevronUp-DTH787oJ.js → ChevronUp-DZQVuDwV.js} +1 -1
- package/dist/client/assets/{DotsVertical-DXADESRu.js → DotsVertical-CGmC-AuM.js} +1 -1
- package/dist/client/assets/{Eye-Cd9WdjRO.js → Eye-DRB5PFSd.js} +1 -1
- package/dist/client/assets/{FilterLines-DDE5Z7pT.js → FilterLines-uyaFw99Z.js} +1 -1
- package/dist/client/assets/{Globe01-BtWLhdgc.js → Globe01-J_5kAZ2G.js} +1 -1
- package/dist/client/assets/{Globe04-DVbA5z-S.js → Globe04-DzVxOgG6.js} +1 -1
- package/dist/client/assets/{HardDrive-Dv021FxK.js → HardDrive-BD491-6A.js} +1 -1
- package/dist/client/assets/{Key01-AxVsjzoW.js → Key01-DpArIwgm.js} +1 -1
- package/dist/client/assets/{LayoutLeft-DFQX2HQS.js → LayoutLeft-i76gAzb8.js} +1 -1
- package/dist/client/assets/{LinkExternal01-DFJC7MKi.js → LinkExternal01-BGVgwGxd.js} +1 -1
- package/dist/client/assets/{Monitor01-DzIaslp9.js → Monitor01-C4cglHcn.js} +1 -1
- package/dist/client/assets/{Palette-DRyOxvc4.js → Palette-NYPFTebi.js} +1 -1
- package/dist/client/assets/{Play-BGOeSWeu.js → Play-CIhVolnk.js} +1 -1
- package/dist/client/assets/{Plus-zfs5-JeK.js → Plus-DEhikgBr.js} +1 -1
- package/dist/client/assets/{SearchMd-DUUd_hhd.js → SearchMd-1YEF5GNC.js} +1 -1
- package/dist/client/assets/{Settings02-Gfe6bidH.js → Settings02-B_oiQbnJ.js} +1 -1
- package/dist/client/assets/{Shield01-5ohBHD7b.js → Shield01-BrCb9Fbq.js} +1 -1
- package/dist/client/assets/{Star01-BfbfCcYt.js → Star01-K5E2EVFR.js} +1 -1
- package/dist/client/assets/{Stars01-CDSyPsDa.js → Stars01-D-F-KCAY.js} +1 -1
- package/dist/client/assets/{Stars02-CNjkSD-c.js → Stars02-D5rVREl5.js} +1 -1
- package/dist/client/assets/{Sun-CduMeE8P.js → Sun-0LQy_BRh.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-C-8MujcR.js → SwitchHorizontal01-Y2S_GG49.js} +1 -1
- package/dist/client/assets/{Tool01-CyFZLY0Y.js → Tool01-B21_bo9F.js} +1 -1
- package/dist/client/assets/{Trash01-BwZvbUqV.js → Trash01-D4qJL0O5.js} +1 -1
- package/dist/client/assets/{Upload01-BENZkUL6.js → Upload01-B89V4QHh.js} +1 -1
- package/dist/client/assets/{User01-C6id_Jz0.js → User01-676cwM-d.js} +1 -1
- package/dist/client/assets/{Users01-DoemHjk2.js → Users01-Wg2zRTbW.js} +1 -1
- package/dist/client/assets/{Users03-DNFFVYi5.js → Users03-ClYFKrw1.js} +1 -1
- package/dist/client/assets/{X-DbKbpx_s.js → X-B9D2h3Td.js} +1 -1
- package/dist/client/assets/{XCircle-Dcz0bhP7.js → XCircle-CSFP3d9h.js} +1 -1
- package/dist/client/assets/{XClose-c_WWFEvr.js → XClose-DBh1WmP1.js} +1 -1
- package/dist/client/assets/{Zap-iEV7Y0HC.js → Zap-BRPDiIJ_.js} +1 -1
- package/dist/client/assets/{ZapSquare-C6FRNhWU.js → ZapSquare-Dnw5HzjO.js} +1 -1
- package/dist/client/assets/{ZoomOut-B6sxahLJ.js → ZoomOut-Cz0dpIX0.js} +1 -1
- package/dist/client/assets/{access-gate-Bw0npMv7.js → access-gate-BrhqO3VF.js} +1 -1
- package/dist/client/assets/{add-section-modal-KIiwcyif.js → add-section-modal-D2CiFRjh.js} +1 -1
- package/dist/client/assets/{agent-icon-Dwg5FgWW.js → agent-icon-o19yp48z.js} +1 -1
- package/dist/client/assets/{agents-list-BXDz7sZv.js → agents-list-CZG4qszH.js} +1 -1
- package/dist/client/assets/ai-providers-CO0WuHGD.js +1 -0
- package/dist/client/assets/{alert-CrUsXKEE.js → alert-D1A1Zc_j.js} +1 -1
- package/dist/client/assets/{alert-dialog-Cv06ffuC.js → alert-dialog-BOS0dCJh.js} +3 -3
- package/dist/client/assets/{app-editor-DjhMgCk8.js → app-editor-CIfs2FL1.js} +1 -1
- package/dist/client/assets/{auth-DEpXDpCk.js → auth-BdbahkUc.js} +1 -1
- package/dist/client/assets/{auth-catchall-CPgG-EzL.js → auth-catchall-CNPgs4YU.js} +1 -1
- package/dist/client/assets/{auth-entry-DSjmtoLb.js → auth-entry-B1WtHQhf.js} +1 -1
- package/dist/client/assets/{auth-split-layout-BkUGPb-7.js → auth-split-layout-nvPMwr8u.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-BELZfB_M.js → authenticate-and-persist-oauth-BMdVL1CA.js} +1 -1
- package/dist/client/assets/{automation-list-row-BQBXbnVC.js → automation-list-row-CyNcj0ry.js} +1 -1
- package/dist/client/assets/automation-runs-Bk8JCPKW.js +1 -0
- package/dist/client/assets/automations-D5t0_F84.js +1 -0
- package/dist/client/assets/{avatar-DPNVdynG.js → avatar-3AHqY5tt.js} +1 -1
- package/dist/client/assets/{badge-BAgfu3s3.js → badge-DAumNibn.js} +1 -1
- package/dist/client/assets/{block-document-L8I5bPmf.js → block-document-CyMP0Nwa.js} +1 -1
- package/dist/client/assets/brand-context-yzHlJmXd.js +1 -0
- package/dist/client/assets/buckets-D9fspdLY.js +1 -0
- package/dist/client/assets/{capability-load-error-DNDjRRk_.js → capability-load-error-B4Sf_UJj.js} +1 -1
- package/dist/client/assets/{card-Trr9Smsl.js → card-DPMEGAqZ.js} +1 -1
- package/dist/client/assets/category-editor-nDclmHNc.js +1 -0
- package/dist/client/assets/{chat-context-D2JYAjtU.js → chat-context-DANWEvls.js} +7 -7
- package/dist/client/assets/{checkbox-BkY2CRaN.js → checkbox-ByFK_aep.js} +1 -1
- package/dist/client/assets/{cli-auth-success-CDezhRu8.js → cli-auth-success-s1Ge9151.js} +1 -1
- package/dist/client/assets/collection-detail-NWtLzyq5.js +1 -0
- package/dist/client/assets/{collection-display-button-BhW4iJuC.js → collection-display-button-CTz7X8CM.js} +1 -1
- package/dist/client/assets/{collection-search-IIs4O29o.js → collection-search-CQMKW4Jp.js} +1 -1
- package/dist/client/assets/{collection-tabs-DStxKs6K.js → collection-tabs-jlQTSy-i.js} +1 -1
- package/dist/client/assets/{command-DziWV9Wl.js → command-DNx5Uhv2.js} +1 -1
- package/dist/client/assets/commerce-onboarding-BGm-51c6.js +1 -0
- package/dist/client/assets/{connect-desktop-dialog-CEg8fHOJ.js → connect-desktop-dialog-BeQBPgXI.js} +1 -1
- package/dist/client/assets/{connection-card-CX4CTBla.js → connection-card-CHIFmA8R.js} +1 -1
- package/dist/client/assets/connection-detail-BTDN1t-U.js +1 -0
- package/dist/client/assets/{connection-form-helpers-_Xw7Jp1j.js → connection-form-helpers-CWhKbOwZ.js} +1 -1
- package/dist/client/assets/connections-Df79XqMS.js +1 -0
- package/dist/client/assets/{context-menu-WSPOvmVH.js → context-menu-DkDkJvo8.js} +1 -1
- package/dist/client/assets/{decopilot-CPXrk6Nc.js → decopilot-CmY0uQsK.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-Dc69PdCV.js → decopilot-sse-pool-CXkkAKQx.js} +1 -1
- package/dist/client/assets/{dialog-DC6TTwSU.js → dialog-fVpV_18N.js} +1 -1
- package/dist/client/assets/{domain-settings-C1pK704i.js → domain-settings-BIaZaqXi.js} +1 -1
- package/dist/client/assets/{drawer-D-qJMn42.js → drawer-iojIyQ7Z.js} +1 -1
- package/dist/client/assets/{dropdown-menu-B3yjOr3B.js → dropdown-menu-HRW3zYBQ.js} +1 -1
- package/dist/client/assets/{empty-state-WkcHfsbi.js → empty-state-ySGQGV31.js} +1 -1
- package/dist/client/assets/{extract-connection-data-D0kn1CiV.js → extract-connection-data-CrjpOcI0.js} +1 -1
- package/dist/client/assets/{file-explorer-rTq33vqz.js → file-explorer-D1OUZ8cU.js} +1 -1
- package/dist/client/assets/{file-type-icon-BphKjXRo.js → file-type-icon-BSAfTQY6.js} +1 -1
- package/dist/client/assets/{files-B7FZKUGh.js → files-Dvw5nwbp.js} +1 -1
- package/dist/client/assets/{form-g86n2zay.js → form-dD3QczZa.js} +1 -1
- package/dist/client/assets/{general-DQFzRc7X.js → general-C6KcKAXv.js} +1 -1
- package/dist/client/assets/github-repo-picker-YqP06Fto.js +1 -0
- package/dist/client/assets/{hooks-CpWosBE0.js → hooks-C3qiFxIG.js} +5 -5
- package/dist/client/assets/{import-from-deco-dialog-DHQFK9MP.js → import-from-deco-dialog-DDsiz0pE.js} +2 -2
- package/dist/client/assets/{index-BTDSQgHj.js → index-B7xwJlcR.js} +5 -5
- package/dist/client/assets/{index-Bnq_KeQl.js → index-BK10Xdph.js} +1 -1
- package/dist/client/assets/{index-V_z4g85O.js → index-BMCJlhk3.js} +24 -24
- package/dist/client/assets/{index-D0VHzTLF.js → index-BO-4uKUn.js} +1 -1
- package/dist/client/assets/index-BodEVjlg.js +1 -0
- package/dist/client/assets/{index-3BRPugsV.js → index-C102AH4s.js} +1 -1
- package/dist/client/assets/{index-B1povjSt.js → index-CXXnf1Qe.js} +1 -1
- package/dist/client/assets/{index-CKZ2Jo27.js → index-Ci5DmEN0.js} +1 -1
- package/dist/client/assets/{index-DDYqxneq.js → index-CpgQ8CBr.js} +1 -1
- package/dist/client/assets/{index-CmTvfvqV.js → index-Cvy8WHIB.js} +1 -1
- package/dist/client/assets/index-DDRZvmg6.css +1 -0
- package/dist/client/assets/{index-DPpLkDX2.js → index-DqK88OS0.js} +1 -1
- package/dist/client/assets/index-FKJOX04p.js +1 -0
- package/dist/client/assets/{index-UunSb5mF.js → index-jh_AV7fc.js} +1 -1
- package/dist/client/assets/{index-DeuQtcBQ.js → index-q8ngIE68.js} +1 -1
- package/dist/client/assets/{index-redirect-CgRpP2To.js → index-redirect-B05if20n.js} +1 -1
- package/dist/client/assets/{input-DVRfAVU3.js → input-Bk-XA8aE.js} +1 -1
- package/dist/client/assets/{integration-icon-DdvXmN6b.js → integration-icon-D5R24LMd.js} +1 -1
- package/dist/client/assets/{label-D1MGSLX0.js → label-DbgfgBJH.js} +1 -1
- package/dist/client/assets/{login-DlviF7QT.js → login-BnanKvfh.js} +1 -1
- package/dist/client/assets/{mcp-oauth-DlBIPcRz.js → mcp-oauth-Ge7_9DJm.js} +1 -1
- package/dist/client/assets/{members-HLvKGfjN.js → members-OMqqgRie.js} +1 -1
- package/dist/client/assets/{monaco-editor-Adha2rD5.js → monaco-editor-CLbivzeA.js} +2 -2
- package/dist/client/assets/{monitoring-stats-row-DoSzHe4u.js → monitoring-stats-row-D988ksKz.js} +1 -1
- package/dist/client/assets/{oauth-callback-BLm1iokb.js → oauth-callback-CMcTYSQ9.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-8sG6eagR.js → oauth-callback-ai-provider-CPlg-Iun.js} +1 -1
- package/dist/client/assets/{onboarding-iZKUv6aI.js → onboarding-BQtZWhzG.js} +1 -1
- package/dist/client/assets/{org-install-C9Svi1Dd.js → org-install-EHXdq4o2.js} +1 -1
- package/dist/client/assets/{org-layout-B46TOnBU.js → org-layout-qDY2vnUU.js} +1 -1
- package/dist/client/assets/{organization-choice-D5AMR6f-.js → organization-choice-BOiOzldx.js} +1 -1
- package/dist/client/assets/{page-seo-form-DnlsqJ-m.js → page-seo-form-DeK8_ys8.js} +1 -1
- package/dist/client/assets/page-seo-sheet-CnuTSA1a.js +1 -0
- package/dist/client/assets/popover-BTH_4TON.js +1 -0
- package/dist/client/assets/{post-editor-BI1JMrba.js → post-editor-DJSqRdmQ.js} +1 -1
- package/dist/client/assets/{preview-dialog-CNgWM1Nd.js → preview-dialog-C4U9zVzk.js} +3 -3
- package/dist/client/assets/{primitives-1UYw8T7c.js → primitives-CXIIxbFE.js} +1 -1
- package/dist/client/assets/{profile-DlyPm-rk.js → profile-OkUeU-xS.js} +1 -1
- package/dist/client/assets/project-app-view-ClFsE-uv.js +1 -0
- package/dist/client/assets/record-editor-Ba_-uY6W.js +1 -0
- package/dist/client/assets/registry-OeyyY_3h.js +2 -0
- package/dist/client/assets/{registry-layout-k5bH_SdU.js → registry-layout-CmbVIFjk.js} +1 -1
- package/dist/client/assets/{require-capability-Cnsb8ohV.js → require-capability-B3YVeyKQ.js} +1 -1
- package/dist/client/assets/{required-auth-layout-BrqLeeGH.js → required-auth-layout-hwOac595.js} +1 -1
- package/dist/client/assets/{reset-password-Du_C_DrW.js → reset-password-DYADQ6t-.js} +1 -1
- package/dist/client/assets/roles-CwZxDmMd.js +1 -0
- package/dist/client/assets/{save-status-B7sExUGT.js → save-status-cz-ufgN_.js} +1 -1
- package/dist/client/assets/{scroll-area-wkOEFA0d.js → scroll-area-BliS1K3p.js} +1 -1
- package/dist/client/assets/{search-input-R9PP00jU.js → search-input-CUOcSr_7.js} +1 -1
- package/dist/client/assets/secrets-CyW5acaW.js +1 -0
- package/dist/client/assets/{sections-editor-Din5M3E7.js → sections-editor-Dv8SUTjk.js} +1 -1
- package/dist/client/assets/select-8EVXQGwX.js +1 -0
- package/dist/client/assets/{select-model-GwKBIN6-.js → select-model-iQAMpxgJ.js} +1 -1
- package/dist/client/assets/{seo-editor-C4-hewoS.js → seo-editor-BNVUsXCz.js} +1 -1
- package/dist/client/assets/{settings-layout-nQ4HGRFy.js → settings-layout-D-yUHTQc.js} +1 -1
- package/dist/client/assets/{settings-section-C5yP5Si0.js → settings-section-DHTir3TC.js} +1 -1
- package/dist/client/assets/{sheet-B6_wuIQB.js → sheet-ZPG9h0Fj.js} +1 -1
- package/dist/client/assets/{shell-controls-BCEkmDxf.js → shell-controls-Zawsretc.js} +1 -1
- package/dist/client/assets/shell-layout-CWAvk5Go.js +1 -0
- package/dist/client/assets/{shell-route-loading-BpGUKC4D.js → shell-route-loading-mpOo6h4k.js} +1 -1
- package/dist/client/assets/{sidebar-BC3PqZZk.js → sidebar-DU6XXtnA.js} +1 -1
- package/dist/client/assets/{skeleton-D_8-XLai.js → skeleton-CKrKTMUA.js} +1 -1
- package/dist/client/assets/{sortable.esm-g-r61mRK.js → sortable.esm-B3t9DDZ6.js} +1 -1
- package/dist/client/assets/{sso-D-jPiEUA.js → sso-CERYxMuj.js} +1 -1
- package/dist/client/assets/store-mnbDCvL0.js +1 -0
- package/dist/client/assets/store-registry-CJLz8NHB.js +2 -0
- package/dist/client/assets/{studio-tools-CcWLJIL3.js → studio-tools-BdR8-wJW.js} +1 -1
- package/dist/client/assets/switch-DLwkt3ng.js +1 -0
- package/dist/client/assets/{table-DlwTq8lg.js → table-CHbuq2So.js} +1 -1
- package/dist/client/assets/tabs-C3tau4Eq.js +1 -0
- package/dist/client/assets/{task-status-CG5Li56E.js → task-status-Cpo5H16E.js} +1 -1
- package/dist/client/assets/{textarea-DkgswAud.js → textarea-CJuB4hQ7.js} +1 -1
- package/dist/client/assets/toggle-group-Ckfjs-c4.js +1 -0
- package/dist/client/assets/{toolbar-CMnKNoMl.js → toolbar-D1N_WILM.js} +1 -1
- package/dist/client/assets/tooltip-DjHKSu56.js +1 -0
- package/dist/client/assets/{types-IxCSiIKg.js → types-CNWQoCyo.js} +6 -6
- package/dist/client/assets/use-ai-providers-BxzRSeJ0.js +1 -0
- package/dist/client/assets/{use-automations-CktQtzNu.js → use-automations-Br1p5DHc.js} +1 -1
- package/dist/client/assets/{use-capability-mUGdJwF_.js → use-capability-E8ccWznH.js} +1 -1
- package/dist/client/assets/{use-clock-tick-Db61_Lpl.js → use-clock-tick-BW4BJ8Tt.js} +1 -1
- package/dist/client/assets/use-collections-CsNhZa6R.js +1 -0
- package/dist/client/assets/{use-connection-DY54rYyd.js → use-connection-_slG13py.js} +1 -1
- package/dist/client/assets/{use-copy-BaIsIuIB.js → use-copy-60B0ujzD.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-C92AqYem.js → use-create-virtual-mcp-aSsDb_hC.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-CgWI7Lb7.js → use-debounced-autosave-DlQ25v46.js} +1 -1
- package/dist/client/assets/{use-delete-connection-BP5srM_m.js → use-delete-connection-BSgRrEnr.js} +1 -1
- package/dist/client/assets/use-file-configs-TueoM3xk.js +1 -0
- package/dist/client/assets/{use-infinite-scroll-CcoRA6NH.js → use-infinite-scroll-B7KmD1ay.js} +1 -1
- package/dist/client/assets/{use-join-requests-CezHwAN7.js → use-join-requests-Bugx9GLx.js} +1 -1
- package/dist/client/assets/use-mcp-client--_ZSmyGd.js +10 -0
- package/dist/client/assets/use-mcp-prompts-Bi0YM-MV.js +1 -0
- package/dist/client/assets/use-mcp-tools-C6z5gFrv.js +1 -0
- package/dist/client/assets/use-members-D4NNP_ry.js +1 -0
- package/dist/client/assets/{use-navigate-to-agent-BzP0osS7.js → use-navigate-to-agent-C2eJezkw.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-CL0p_f0y.js → use-org-auth-client-Bn9WqUMO.js} +1 -1
- package/dist/client/assets/{use-org-sso-CFcfBOij.js → use-org-sso-CgbvxseW.js} +1 -1
- package/dist/client/assets/{use-organization-roles-Banmg_pK.js → use-organization-roles-Cg0ug59K.js} +1 -1
- package/dist/client/assets/{use-organization-settings-C13VUvc7.js → use-organization-settings-DQ5ROkEQ.js} +1 -1
- package/dist/client/assets/{use-registry-connections-D7CDGVjW.js → use-registry-connections-Ba1xQHz9.js} +1 -1
- package/dist/client/assets/use-secrets-B1jqMRBn.js +1 -0
- package/dist/client/assets/{use-status-sounds-C-rHNkXR.js → use-status-sounds-Bj_NbDO6.js} +1 -1
- package/dist/client/assets/{use-view-mode-Brlii9ZZ.js → use-view-mode-BvWJalT6.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-oC_oTaOn.js → use-virtual-mcp-BZlyJ3on.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-DDGqv00b.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-DI0bMzys.js +1 -0
- package/dist/client/assets/{variant-calendar-DrknBuXM.js → variant-calendar-C0Qs1GnN.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-Dgssa66x.js → view-mode-toggle-DcivAyKH.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +249 -249
- package/dist/server/server.js +51 -51
- package/package.json +1 -1
- package/dist/client/assets/ai-providers-VH8M6hT6.js +0 -1
- package/dist/client/assets/automation-runs-Dm8vrkrz.js +0 -1
- package/dist/client/assets/automations-DA5a6gqY.js +0 -1
- package/dist/client/assets/brand-context-CULMCcpa.js +0 -1
- package/dist/client/assets/buckets-DMU0eaXD.js +0 -1
- package/dist/client/assets/category-editor-BJlYKlYH.js +0 -1
- package/dist/client/assets/collection-detail-wY7wsRFe.js +0 -1
- package/dist/client/assets/commerce-onboarding-CyEeXl3T.js +0 -1
- package/dist/client/assets/connection-detail-BDjbD-IX.js +0 -1
- package/dist/client/assets/connections-DJEG78Dv.js +0 -1
- package/dist/client/assets/github-repo-picker-C6HuqJ8f.js +0 -1
- package/dist/client/assets/index-DBaGwpyP.css +0 -1
- package/dist/client/assets/index-DEAvf9Ss.js +0 -1
- package/dist/client/assets/index-DPmafiSm.js +0 -1
- package/dist/client/assets/page-seo-sheet-BB-bVgSe.js +0 -1
- package/dist/client/assets/popover-ChpnNBG6.js +0 -1
- package/dist/client/assets/project-app-view-CxdK6kb-.js +0 -1
- package/dist/client/assets/record-editor-BPS6LmYc.js +0 -1
- package/dist/client/assets/registry-B54461Ff.js +0 -2
- package/dist/client/assets/roles-DLI7p3m9.js +0 -1
- package/dist/client/assets/secrets-BBIIYJQL.js +0 -1
- package/dist/client/assets/select-iQPDKsQJ.js +0 -1
- package/dist/client/assets/shell-layout-vJZz5HSU.js +0 -1
- package/dist/client/assets/store-CdLz3AFq.js +0 -1
- package/dist/client/assets/store-registry-cn1ZHxyv.js +0 -2
- package/dist/client/assets/switch-DAdK-1sZ.js +0 -1
- package/dist/client/assets/tabs-B6a4ZhCv.js +0 -1
- package/dist/client/assets/toggle-group-BYYV7q2R.js +0 -1
- package/dist/client/assets/tooltip-Bodmhuae.js +0 -1
- package/dist/client/assets/use-ai-providers-Dr3wiSPj.js +0 -1
- package/dist/client/assets/use-collections-gMfZ5Rvk.js +0 -1
- package/dist/client/assets/use-file-configs-CxuIY0bl.js +0 -1
- package/dist/client/assets/use-mcp-client-DsIzdxc1.js +0 -10
- package/dist/client/assets/use-mcp-prompts-CwZBO4qi.js +0 -1
- package/dist/client/assets/use-mcp-tools-BAGnYViX.js +0 -1
- package/dist/client/assets/use-members-Rhm6WZIF.js +0 -1
- package/dist/client/assets/use-secrets-C6okhs5V.js +0 -1
- package/dist/client/assets/useInfiniteQuery-BDW2fh8c.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-Bfsxp_qn.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as E,r as L,l as Ue,j as i,B as X,i as je,K,k as Z,m as Ae,a as Ne,u as $e,b as Ie,n as De,d as Te,o as Ee,L as Me}from"./index-V_z4g85O.js";import{A as Ke}from"./auth-entry-DSjmtoLb.js";import{A as q}from"./auth-split-layout-BkUGPb-7.js";import{O as _e}from"./organization-choice-D5AMR6f-.js";import{f as qe}from"./tab-id-BptcWVWa.js";import{I as He}from"./input-DVRfAVU3.js";import{u as ve,W as Oe,S as Re,g as Fe,C as Be}from"./use-mcp-client-DsIzdxc1.js";import{i as we}from"./XCircle-Dcz0bhP7.js";import{I as We}from"./integration-icon-DdvXmN6b.js";import{i as ke}from"./CheckCircle-B6_BlhWA.js";import{g as Qe,c as Ge,e as Ye}from"./extract-connection-data-D0kn1CiV.js";import{a as Ve}from"./authenticate-and-persist-oauth-BELZfB_M.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-DPNVdynG.js";import"./User01-C6id_Jz0.js";import"./auth-DEpXDpCk.js";import"./agent-icon-Dwg5FgWW.js";import"./AlertCircle-CqXnKI3D.js";import"./Tool01-CyFZLY0Y.js";import"./SwitchHorizontal01-C-8MujcR.js";import"./Settings02-Gfe6bidH.js";import"./ArrowUpRight-D_A_c-WP.js";import"./ZapSquare-C6FRNhWU.js";import"./Users03-DNFFVYi5.js";import"./ChevronUp-DTH787oJ.js";import"./ChevronDown-CsJyvcQs.js";import"./ChevronLeft-cwkPjMhb.js";import"./ChevronRight-DbmfCIOT.js";import"./DotsVertical-DXADESRu.js";import"./Stars02-CNjkSD-c.js";import"./Eye-Cd9WdjRO.js";import"./ZoomOut-B6sxahLJ.js";import"./Globe01-BtWLhdgc.js";import"./FilterLines-DDE5Z7pT.js";import"./Star01-BfbfCcYt.js";import"./Globe04-DVbA5z-S.js";import"./HardDrive-Dv021FxK.js";import"./Key01-AxVsjzoW.js";import"./LayoutLeft-DFQX2HQS.js";import"./LinkExternal01-DFJC7MKi.js";import"./Monitor01-DzIaslp9.js";import"./Sun-CduMeE8P.js";import"./Palette-DRyOxvc4.js";import"./Play-BGOeSWeu.js";import"./Plus-zfs5-JeK.js";import"./SearchMd-DUUd_hhd.js";import"./Shield01-5ohBHD7b.js";import"./Stars01-CDSyPsDa.js";import"./Trash01-BwZvbUqV.js";import"./Upload01-BENZkUL6.js";import"./Users01-DoemHjk2.js";import"./XClose-c_WWFEvr.js";import"./X-DbKbpx_s.js";import"./Zap-iEV7Y0HC.js";import"./mcp-oauth-DlBIPcRz.js";const Ze=/^[a-zA-Z][a-zA-Z\d+.-]*:/,Je=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,Xe=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,et=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function ye(s){const e=s.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const t=Ze.test(e),n=Je.test(e),o=Xe.test(e);if(t&&!n&&!o)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const c=n?e:`https://${e}`;let r;try{r=new URL(c)}catch{return{ok:!1,error:"Enter a valid website URL."}}if(r.protocol!=="http:"&&r.protocol!=="https:")return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const l=r.hostname.split(".");return l.length<2||l.some(d=>!d||!et.test(d))?{ok:!1,error:"Enter a valid website URL."}:(r.protocol="https:",{ok:!0,value:r.origin})}function Ce(s){const e=E.c(11),{children:t,className:n}=s,[o,c]=L.useState(!0);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=h=>{if(!h)return;const f=()=>{const b=h.scrollHeight-h.scrollTop-h.clientHeight<8;c(b)};f(),h.addEventListener("scroll",f,{passive:!0});const C=new ResizeObserver(f);C.observe(h);for(const b of Array.from(h.children))C.observe(b);return()=>{h.removeEventListener("scroll",f),C.disconnect()}},e[0]=r):r=e[0];const l=r;let d;e[1]!==t||e[2]!==n?(d=i.jsx("div",{ref:l,className:n,children:t}),e[1]=t,e[2]=n,e[3]=d):d=e[3];const u=o?"opacity-0":"opacity-100";let g;e[4]!==u?(g=Ue("pointer-events-none absolute inset-x-0 bottom-0 h-[213px]","bg-gradient-to-t from-background to-transparent","backdrop-blur-[2px] [mask-image:linear-gradient(to_top,black,transparent)]","transition-opacity duration-200",u),e[4]=u,e[5]=g):g=e[5];let m;e[6]!==g?(m=i.jsx("div",{"aria-hidden":!0,className:g}),e[6]=g,e[7]=m):m=e[7];let p;return e[8]!==d||e[9]!==m?(p=i.jsxs("div",{className:"relative",children:[d,m]}),e[8]=d,e[9]=m,e[10]=p):p=e[10],p}function be(s){const e=E.c(3),{children:t}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx(ke,{size:14,className:"shrink-0 text-blue-500"}),e[0]=n):n=e[0];let o;return e[1]!==t?(o=i.jsxs("div",{className:"flex items-center gap-2 p-1",children:[n,i.jsx("p",{className:"text-sm text-foreground",children:t})]}),e[1]=t,e[2]=o):o=e[2],o}function tt(s){const e=E.c(33),{card:t,connecting:n,disabled:o,onConnect:c}=s;let r;e[0]!==t.icon||e[1]!==t.title?(r=i.jsx(We,{icon:t.icon,name:t.title,size:"md",fit:"contain",className:"p-2"}),e[0]=t.icon,e[1]=t.title,e[2]=r):r=e[2];let l;e[3]!==t.title?(l=i.jsx("p",{className:"flex-1 text-sm text-foreground",children:t.title}),e[3]=t.title,e[4]=l):l=e[4];let d;e[5]!==t.satisfied||e[6]!==t.title||e[7]!==n||e[8]!==o||e[9]!==c?(d=t.satisfied?i.jsxs("div",{className:"flex h-8 items-center gap-2 px-3 text-sm text-muted-foreground",children:[i.jsx(ke,{size:16})," Connected"]}):i.jsx(X,{type:"button",variant:"outline",size:"sm",disabled:o||n,onClick:c,"aria-label":`Connect ${t.title}`,children:n?i.jsx(je,{size:16,className:"animate-spin"}):"Connect"}),e[5]=t.satisfied,e[6]=t.title,e[7]=n,e[8]=o,e[9]=c,e[10]=d):d=e[10];let u;e[11]!==r||e[12]!==l||e[13]!==d?(u=i.jsxs("div",{className:"flex items-center gap-2",children:[r,l,d]}),e[11]=r,e[12]=l,e[13]=d,e[14]=u):u=e[14];let g;e[15]!==t.checks?(g=t.checks!==null&&i.jsxs(be,{children:["+ ",t.checks," checks"]}),e[15]=t.checks,e[16]=g):g=e[16];let m;e[17]!==t.headline?(m=t.headline&&i.jsx(be,{children:t.headline}),e[17]=t.headline,e[18]=m):m=e[18];let p;e[19]!==t.bullets?(p=t.bullets.map(nt),e[19]=t.bullets,e[20]=p):p=e[20];let h;e[21]!==t.candidateConnectionId||e[22]!==t.satisfied||e[23]!==t.title?(h=!t.satisfied&&t.candidateConnectionId&&i.jsxs("p",{className:"px-1 text-xs text-muted-foreground",children:["Using your existing ",t.title]}),e[21]=t.candidateConnectionId,e[22]=t.satisfied,e[23]=t.title,e[24]=h):h=e[24];let f;e[25]!==g||e[26]!==m||e[27]!==p||e[28]!==h?(f=i.jsxs("div",{className:"flex flex-col gap-1 px-1 py-2",children:[g,m,p,h]}),e[25]=g,e[26]=m,e[27]=p,e[28]=h,e[29]=f):f=e[29];let C;return e[30]!==u||e[31]!==f?(C=i.jsxs("div",{className:"flex flex-col gap-2 rounded-2xl border border-border bg-card p-4",children:[u,f]}),e[30]=u,e[31]=f,e[32]=C):C=e[32],C}function nt(s){return i.jsx(be,{children:s},s)}const Se={vtex:{registryAppId:"deco/vtex",checks:49,headline:"Out-of-stock, thin PDPs & attribute gaps across every SKU"},"google-analytics":{registryAppId:"deco/google-analytics",checks:49,headline:"Where revenue leaks between product view and checkout"},"google-search-console":{registryAppId:"deco/google-search-console",checks:49,headline:"Search visibility & indexing gaps across your catalog"}};function it(s){const e=s.properties;if(!e)return[];const t=[];for(const[n,o]of Object.entries(e)){const l=o?.properties?.__type?.const;typeof l=="string"&&l.length>0&&t.push({fieldKey:n,bindingType:l})}return t}function st(s,e){const t=[];if(s.length&&t.push({field:["id"],operator:"in",value:s}),e.length&&t.push({field:["name"],operator:"in",value:e}),t.length!==0)return t.length===1?t[0]:{operator:"or",conditions:t}}function H(s){const e=s;if(e.isError)throw new Error(e.content?.find(t=>t.text)?.text??"Tool call failed");return e.structuredContent??s}function ot(s,e,t,n){return{...s??{},[e]:{__type:t,value:n}}}function rt(s,e,t){const n=s.filter(o=>o.app_name===e||!!t&&o.app_id===t);return n.length===0?null:(n.sort((o,c)=>{const r=l=>l.status==="active"?0:1;return r(o)!==r(c)?r(o)-r(c):(c.updated_at??"").localeCompare(o.updated_at??"")}),n[0].id)}function lt(s){return s.server?.icons?.[0]?.src??Qe(s.server?.repository)??null}function ct(s,e){const t=s._meta?.["mcp.mesh"];return t?.friendlyName||t?.friendly_name||s.title||s.server?.title||s.server?.name||e}function at(s){const e=[];for(const t of s.requirements){const n=s.curated[t.bindingType],o=n?s.itemsById[n.registryAppId]:s.itemsByName[t.bindingType];if(!o)continue;const r=!!s.configurationState?.[t.fieldKey]?.value;e.push({fieldKey:t.fieldKey,bindingType:t.bindingType,registryItem:o,title:ct(o,t.bindingType),icon:lt(o),headline:n?.headline??o._meta?.["mcp.mesh"]?.short_description??null,checks:n?.checks??null,bullets:n?.bullets??[],satisfied:r,candidateConnectionId:r?null:rt(s.connections,t.bindingType,n?.registryAppId)})}return e}function dt(s){const e=E.c(25),{selfClient:t,org:n,cdConnectionId:o}=s;let c;e[0]!==o||e[1]!==n.id||e[2]!==n.slug?(c={connectionId:o,orgId:n.id,orgSlug:n.slug},e[0]=o,e[1]=n.id,e[2]=n.slug,e[3]=c):c=e[3];const r=ve(c);let l;e[4]!==o||e[5]!==n.id?(l=K.commerceDiscoveryCompanionSchema(n.id,o),e[4]=o,e[5]=n.id,e[6]=l):l=e[6];let d;e[7]!==r?(d=async()=>{const v=await r.callTool({name:"MCP_CONFIGURATION",arguments:{}});return H(v)},e[7]=r,e[8]=d):d=e[8];let u;e[9]!==l||e[10]!==d?(u={queryKey:l,queryFn:d},e[9]=l,e[10]=d,e[11]=u):u=e[11];const g=Z(u),m=it(g.data?.stateSchema??{properties:{}}),p=m.map(gt),h=m.map(pt).filter(ft),f=m.filter(ut).map(mt),C=[...h,...f].sort().join(",");let b;e[12]!==o||e[13]!==n.id?(b=K.commerceDiscoveryConnection(n.id,o),e[12]=o,e[13]=n.id,e[14]=b):b=e[14];let S;e[15]!==o||e[16]!==t?(S=async()=>{const v=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}});return H(v)},e[15]=o,e[16]=t,e[17]=S):S=e[17];let a;e[18]!==b||e[19]!==S?(a={queryKey:b,queryFn:S},e[18]=b,e[19]=S,e[20]=a):a=e[20];const x=Z(a),j=Z({queryKey:K.commerceDiscoveryCompanionConnections(n.id),enabled:m.length>0,queryFn:async()=>{const v=await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:[{field:["app_name"],operator:"in",value:p},{field:["app_id"],operator:"in",value:h}]},limit:1e3}});return H(v)}}),_=Z({queryKey:K.commerceDiscoveryCompanionRegistry(n.id,C),enabled:m.length>0,queryFn:async()=>{const v=st(h,f),F=await Ge(Oe.REGISTRY(n.id),n.id,n.slug,"COLLECTION_REGISTRY_APP_LIST",{...v?{where:v}:{},limit:1e3});return H(F)}}),R={},N={};for(const v of _.data?.items??[])R[v.id]=v,v.server?.name&&(N[v.server.name]=v);const w=at({requirements:m,itemsById:R,itemsByName:N,connections:j.data?.items??[],configurationState:x.data?.item?.configuration_state??null,curated:Se}),T=g.isPending||x.isPending||m.length>0&&(j.isPending||_.isPending),M=g.error??x.error??j.error??_.error??null;let U;return e[21]!==w||e[22]!==M||e[23]!==T?(U={cards:w,isLoading:T,error:M},e[21]=w,e[22]=M,e[23]=T,e[24]=U):U=e[24],U}function mt(s){return s.bindingType}function ut(s){return!Se[s.bindingType]}function ft(s){return!!s}function pt(s){return Se[s.bindingType]?.registryAppId}function gt(s){return s.bindingType}function ht({selfClient:s,org:e,userId:t,cdConnectionId:n}){const o=Ae(),[c,r]=L.useState(null),[l,d]=L.useState(null),u=async(m,p)=>{const h=await s.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:m,data:p}});return H(h)};async function g(m){r(m.fieldKey),d(null);try{let p=m.candidateConnectionId;if(!p){const a=Ye(m.registryItem,e.id,t,{remoteIndex:0}),x=a.connection_type==="STDIO",j=!!a.connection_url,_=x&&a.connection_headers&&typeof a.connection_headers=="object"&&"command"in a.connection_headers;if(!j&&!_){d(`${m.title} cannot be connected: no connection method available`);return}const R=await s.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:a}});p=H(R).item.id}const h=p,f=await Ve({connectionId:h,orgId:e.id,orgSlug:e.slug,persistFallback:a=>u(h,{connection_token:a}).then(()=>{})});if(!f.ok){d(`Couldn't sign in to ${m.title}: ${f.error}`);return}const C=await s.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:n}}),b=H(C).item?.configuration_state??null,S=ot(b,m.fieldKey,m.bindingType,h);await u(n,{configuration_state:S}),await o.invalidateQueries({queryKey:K.commerceDiscoveryConnection(e.id,n)}),await o.invalidateQueries({queryKey:K.commerceDiscoveryCompanionConnections(e.id)})}catch(p){d(p instanceof Error?p.message:String(p))}finally{r(null)}}return{connect:g,connectingFieldKey:c,error:l}}function xt(s){const e=E.c(30),{org:t,cdConnectionId:n,reportDisabled:o,onOpenReport:c}=s,{data:r}=Ne.useSession(),l=r?.user?.id??"";let d;e[0]!==t.id||e[1]!==t.slug?(d={connectionId:Re,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=d):d=e[2];const u=ve(d);let g;e[3]!==n||e[4]!==t||e[5]!==u?(g={selfClient:u,org:t,cdConnectionId:n},e[3]=n,e[4]=t,e[5]=u,e[6]=g):g=e[6];const{cards:m,isLoading:p,error:h}=dt(g);let f;e[7]!==n||e[8]!==t||e[9]!==u||e[10]!==l?(f={selfClient:u,org:t,userId:l,cdConnectionId:n},e[7]=n,e[8]=t,e[9]=u,e[10]=l,e[11]=f):f=e[11];const{connect:C,connectingFieldKey:b,error:S}=ht(f);let a;e[12]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(we,{size:16}),e[12]=a):a=e[12];let x;e[13]!==c||e[14]!==o?(x=i.jsxs(X,{type:"button",size:"xl",className:"w-full",onClick:c,disabled:o,children:["See full report",a]}),e[13]=c,e[14]=o,e[15]=x):x=e[15];const j=x;if(!p&&!h&&m.length===0){let T;return e[16]!==j?(T=i.jsx("div",{className:"grid gap-10",children:j}),e[16]=j,e[17]=T):T=e[17],T}const _=b!==null;let R;e[18]===Symbol.for("react.memo_cache_sentinel")?(R=i.jsxs("div",{className:"grid gap-1.5",children:[i.jsx("p",{className:"text-2xl font-medium text-foreground",children:"Unlock your full diagnostic"}),i.jsx("p",{className:"text-base text-muted-foreground",children:"Connect your tools to unlock 100+ checks across your funnel."})]}),e[18]=R):R=e[18];let N;e[19]!==_||e[20]!==m||e[21]!==C||e[22]!==S||e[23]!==b||e[24]!==h||e[25]!==p?(N=h?i.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[i.jsx("p",{className:"text-sm text-foreground",children:"Couldn't load companion integrations."}),i.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Reload the page to try again."})]}):p?i.jsx("div",{className:"grid gap-4",children:[0,1,2].map(yt)}):i.jsx(Ce,{className:"-mx-1 max-h-[45vh] overflow-y-auto px-1",children:i.jsxs("div",{className:"grid gap-4",children:[S&&i.jsx("p",{role:"alert",className:"text-sm text-destructive",children:S}),m.map(T=>i.jsx(tt,{card:T,connecting:b===T.fieldKey,disabled:_&&b!==T.fieldKey,onConnect:()=>{C(T)}},T.fieldKey))]})}),e[19]=_,e[20]=m,e[21]=C,e[22]=S,e[23]=b,e[24]=h,e[25]=p,e[26]=N):N=e[26];let w;return e[27]!==j||e[28]!==N?(w=i.jsxs("div",{className:"grid gap-6",children:[R,N,j]}),e[27]=j,e[28]=N,e[29]=w):w=e[29],w}function yt(s){return i.jsx("div",{className:"h-24 animate-pulse rounded-2xl border border-border bg-muted/40"},s)}function ze(s){const e=E.c(10),{host:t}=s,n=`https://www.google.com/s2/favicons?domain=${t}&sz=128`;let o,c,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-7 w-7 dark:hidden"}),c=i.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-7 w-7 hidden dark:block"}),r=i.jsx("div",{className:"h-6 w-px rotate-12 bg-border","aria-hidden":"true"}),e[0]=o,e[1]=c,e[2]=r):(o=e[0],c=e[1],r=e[2]);let l;e[3]!==n?(l=i.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-white",children:i.jsx("img",{src:n,alt:"",className:"h-5 w-5",loading:"lazy"})}),e[3]=n,e[4]=l):l=e[4];let d;e[5]!==t?(d=i.jsx("span",{className:"text-lg font-medium text-foreground",children:t}),e[5]=t,e[6]=d):d=e[6];let u;return e[7]!==l||e[8]!==d?(u=i.jsxs("div",{className:"flex items-center gap-3",children:[o,c,r,l,d]}),e[7]=l,e[8]=d,e[9]=u):u=e[9],u}function kn(){const s=E.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx(bt,{}),s[0]=e):e=s[0],e}const Le=L.createContext(null),Pe=()=>L.useContext(Le);function Ct(s){if(!s)return null;const e=ye(s);return e.ok?new URL(e.value).hostname:null}function bt(){const s=E.c(9);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/commerce-onboarding"},s[0]=e):e=s[0];const t=$e(e),{org:n,siteUrl:o}=t;let c;s[1]!==o?(c=Ct(o),s[1]=o,s[2]=c):c=s[2];const r=c;let l;s[3]!==n||s[4]!==o?(l=i.jsx(jt,{requestedOrgSlug:n,siteUrl:o}),s[3]=n,s[4]=o,s[5]=l):l=s[5];let d;return s[6]!==r||s[7]!==l?(d=i.jsx(Le.Provider,{value:r,children:l}),s[6]=r,s[7]=l,s[8]=d):d=s[8],d}function jt(s){const e=E.c(8),{requestedOrgSlug:t,siteUrl:n}=s,{data:o,isPending:c}=Ne.useSession(),r=Pe();if(c){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx(q,{children:i.jsx(J,{label:"Preparing commerce onboarding..."})}),e[0]=d):d=e[0],d}if(!o){const d=typeof window>"u"?"/commerce-onboarding":`${window.location.pathname}${window.location.search}`;let u;e[1]!==r?(u=r?i.jsx(ze,{host:r}):void 0,e[1]=r,e[2]=u):u=e[2];let g;return e[3]!==u?(g=i.jsx(q,{children:i.jsx(Ke,{callbackUrl:d,allowAutoLogin:!1,title:"Unlock your full diagnostic",subtitle:null,brand:u})}),e[3]=u,e[4]=g):g=e[4],g}let l;return e[5]!==t||e[6]!==n?(l=i.jsx(vt,{requestedOrgSlug:t,siteUrl:n}),e[5]=t,e[6]=n,e[7]=l):l=e[7],l}function vt(s){const e=E.c(40),{requestedOrgSlug:t,siteUrl:n}=s,o=Ie(),c=De(),[r,l]=L.useState(null),[d,u]=L.useState(null),g=c.data?.map(_t)??[];let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={mutationFn:St,retry:!1,onSuccess:a=>{u(a)}},e[0]=m):m=e[0];const p=Te(m);if(c.isPending){let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(q,{children:i.jsx(J,{label:"Preparing commerce onboarding..."})}),e[1]=a):a=e[1],a}if(c.error){let a;return e[2]!==c?(a=i.jsx(ae,{title:"We could not load your organizations",description:"Retry to continue commerce setup from this page.",actionLabel:"Retry",onRetry:()=>c.refetch()}),e[2]=c,e[3]=a):a=e[3],a}const h=t?g.find(a=>a.slug===t):null;if(h){let a;return e[4]!==h||e[5]!==n?(a=i.jsx(ce,{org:h,initialSiteUrl:n}),e[4]=h,e[5]=n,e[6]=a):a=e[6],a}if(t){let a;return e[7]!==c?(a=i.jsx(ae,{title:"Organization not found",description:"We could not find that organization for your account.",actionLabel:"Retry",onRetry:()=>c.refetch()}),e[7]=c,e[8]=a):a=e[8],a}if(r){let a;return e[9]!==r||e[10]!==n?(a=i.jsx(ce,{org:r,initialSiteUrl:n}),e[9]=r,e[10]=n,e[11]=a):a=e[11],a}if(g.length===1&&g[0]){let a;return e[12]!==g[0]||e[13]!==n?(a=i.jsx(ce,{org:g[0],initialSiteUrl:n}),e[12]=g[0],e[13]=n,e[14]=a):a=e[14],a}if(g.length>1){let a;e[15]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(D,{title:"Choose an organization",description:"Select where commerce diagnostics should continue."}),e[15]=a):a=e[15];let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=_=>l(_),e[16]=x):x=e[16];let j;return e[17]!==g?(j=i.jsx(q,{children:i.jsxs("div",{className:"grid gap-10",children:[a,i.jsx(Ce,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:i.jsx(_e,{organizations:g,selectLabel:"Continue",onSelected:x})})]})}),e[17]=g,e[18]=j):j=e[18],j}if(!d){let a;e[19]!==p?(a=()=>{p.reset(),p.mutate()},e[19]=p,e[20]=a):a=e[20];let x;return e[21]!==p||e[22]!==a?(x=i.jsx(Nt,{mutation:p,onRetry:a}),e[21]=p,e[22]=a,e[23]=x):x=e[23],x}const f=d;if(f?.success&&(f.status==="created"||f.status==="joined"||f.status==="already_has_organization")&&f.organization){let a;return e[24]!==f.organization||e[25]!==n?(a=i.jsx(ce,{org:f.organization,initialSiteUrl:n}),e[24]=f.organization,e[25]=n,e[26]=a):a=e[26],a}if(f?.status==="ambiguous"&&f.organizations&&f.organizations.length>0){let a;e[27]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(D,{title:"Choose an organization",description:"Your email can access more than one organization. Choose where commerce setup should continue."}),e[27]=a):a=e[27];const x=f.domain??void 0;let j;e[28]!==o||e[29]!==n?(j=(R,N)=>{Ee(),l({...R,slug:N}),o({to:"/commerce-onboarding",search:{org:N,siteUrl:n}})},e[28]=o,e[29]=n,e[30]=j):j=e[30];let _;return e[31]!==f.organizations||e[32]!==x||e[33]!==j?(_=i.jsx(q,{children:i.jsxs("div",{className:"grid gap-10",children:[a,i.jsx(Ce,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:i.jsx(_e,{organizations:f.organizations,domain:x,onJoined:j})})]})}),e[31]=f.organizations,e[32]=x,e[33]=j,e[34]=_):_=e[34],_}const C=f?.error??"We could not determine a commerce organization for this account.";let b;e[35]!==p?(b=()=>{u(null),p.reset()},e[35]=p,e[36]=b):b=e[36];let S;return e[37]!==C||e[38]!==b?(S=i.jsx(ae,{title:"Commerce onboarding needs support",description:C,actionLabel:"Try again",onRetry:b}),e[37]=C,e[38]=b,e[39]=S):S=e[39],S}async function St(){const e=await(await fetch("/api/auth/custom/ensure-organization",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).json();return e.success&&(e.status==="created"||e.status==="joined"||e.status==="already_has_organization")&&e.organization&&Ee(),e}function _t(s){return{id:s.id,name:s.name,slug:s.slug,logo:s.logo??null}}function Nt(s){const e=E.c(7),{mutation:t,onRetry:n}=s,o=L.useRef(!1);let c;e[0]!==t?(c=u=>{!u||o.current||(o.current=!0,t.mutate())},e[0]=t,e[1]=c):c=e[1];const r=c;if(t.error){let u;return e[2]!==n?(u=i.jsx(ae,{title:"Commerce onboarding is unavailable",description:"We could not prepare an organization for commerce setup. Retry from this page or contact support.",actionLabel:"Retry",onRetry:n}),e[2]=n,e[3]=u):u=e[3],u}let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsx(J,{label:"Preparing your commerce workspace..."}),e[4]=l):l=e[4];let d;return e[5]!==r?(d=i.jsx(q,{children:i.jsx("div",{ref:r,children:l})}),e[5]=r,e[6]=d):d=e[6],d}function D(s){const e=E.c(8),{title:t,description:n}=s,o=Pe();let c;e[0]!==o?(c=o?i.jsx(ze,{host:o}):i.jsxs("div",{children:[i.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),i.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),e[0]=o,e[1]=c):c=e[1];let r;e[2]!==n||e[3]!==t?(r=(t||n)&&i.jsxs("div",{className:"space-y-2",children:[t&&i.jsx("h1",{className:"text-2xl font-medium leading-8",children:t}),n&&i.jsx("p",{className:"text-base text-muted-foreground leading-6",children:n})]}),e[2]=n,e[3]=t,e[4]=r):r=e[4];let l;return e[5]!==c||e[6]!==r?(l=i.jsxs("div",{className:"grid gap-10",children:[c,r]}),e[5]=c,e[6]=r,e[7]=l):l=e[7],l}function J(s){const e=E.c(3),{label:t}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx(je,{size:14,className:"animate-spin text-muted-foreground"}),e[0]=n):n=e[0];let o;return e[1]!==t?(o=i.jsxs("div",{className:"flex items-center gap-2 py-4",role:"status","aria-live":"polite",children:[n,i.jsx("span",{className:"text-sm text-muted-foreground",children:t})]}),e[1]=t,e[2]=o):o=e[2],o}function ae(s){const e=E.c(9),{title:t,description:n,actionLabel:o,onRetry:c}=s;let r;e[0]!==n||e[1]!==t?(r=i.jsx(D,{title:t,description:n}),e[0]=n,e[1]=t,e[2]=r):r=e[2];let l;e[3]!==o||e[4]!==c?(l=i.jsx(X,{type:"button",size:"xl",className:"w-full",onClick:c,children:o}),e[3]=o,e[4]=c,e[5]=l):l=e[5];let d;return e[6]!==r||e[7]!==l?(d=i.jsx(q,{children:i.jsxs("div",{className:"grid gap-10",children:[r,l]})}),e[6]=r,e[7]=l,e[8]=d):d=e[8],d}function It(s){return s.content?.find(e=>e.text)?.text??"Commerce Discovery setup failed."}function he(s){const e=s;if(e.isError)throw new Error(It(e));return e.structuredContent??s}function ce(s){const e=E.c(5),{org:t,initialSiteUrl:n}=s;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(J,{label:"Connecting workspace..."}),e[0]=o):o=e[0];const c=`${t.id}:${n??""}`;let r;return e[1]!==n||e[2]!==t||e[3]!==c?(r=i.jsx(q,{children:i.jsx(L.Suspense,{fallback:o,children:i.jsx(Tt,{org:t,initialSiteUrl:n},c)})}),e[1]=n,e[2]=t,e[3]=c,e[4]=r):r=e[4],r}function Tt(s){const e=E.c(100),{org:t,initialSiteUrl:n}=s,o=Ie();let c;e[0]!==t.id||e[1]!==t.slug?(c={connectionId:Re,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=c):c=e[2];const r=ve(c),[l,d]=L.useState(n??""),[u,g]=L.useState(null),[m,p]=L.useState(null),h=L.useRef(!1),f=Oe.COMMERCE_DISCOVERY(t.id),C=Fe(t.id),b=K.commerceDiscoveryConnection(t.id,f);let S;e[3]!==f||e[4]!==r?(S=async()=>{const y=await r.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:f}});return he(y)},e[3]=f,e[4]=r,e[5]=S):S=e[5];let a;e[6]!==b||e[7]!==S?(a={queryKey:b,queryFn:S,retry:!1},e[6]=b,e[7]=S,e[8]=a):a=e[8];const x=Z(a),j=K.commerceDiscoveryVirtualMcp(t.id,C);let _;e[9]!==r||e[10]!==C?(_=async()=>{const y=await r.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:C}});return he(y)},e[9]=r,e[10]=C,e[11]=_):_=e[11];let R;e[12]!==j||e[13]!==_?(R={queryKey:j,queryFn:_,retry:!1},e[12]=j,e[13]=_,e[14]=R):R=e[14];const N=Z(R);let w;e[15]!==r?(w=async y=>{const I=await r.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:y}});return he(I)},e[15]=r,e[16]=w):w=e[16];let T;e[17]!==x||e[18]!==N?(T=y=>{g(y),p(null),x.refetch(),N.refetch()},e[17]=x,e[18]=N,e[19]=T):T=e[19];let M;e[20]===Symbol.for("react.memo_cache_sentinel")?(M=y=>{p(y instanceof Error?y.message:"Commerce Discovery setup failed.")},e[20]=M):M=e[20];let U;e[21]!==w||e[22]!==T?(U={mutationFn:w,retry:!1,onSuccess:T,onError:M},e[21]=w,e[22]=T,e[23]=U):U=e[23];const v=Te(U),F=x.isPending||N.isPending,me=x.error??N.error,ee=!!x.data?.item&&!!N.data?.item;let te;e[24]!==v?(te=y=>{const I=ye(y);if(!I.ok){p(I.error);return}p(null),v.mutate(I.value)},e[24]=v,e[25]=te):te=e[25];const B=te;let ne;e[26]!==n||e[27]!==B||e[28]!==F||e[29]!==ee?(ne=y=>{!y||h.current||F||ee||!n||(h.current=!0,B(n))},e[26]=n,e[27]=B,e[28]=F,e[29]=ee,e[30]=ne):ne=e[30];const ue=ne;let ie;e[31]!==B||e[32]!==l?(ie=y=>{y.preventDefault(),B(l)},e[31]=B,e[32]=l,e[33]=ie):ie=e[33];const A=ie;let se;e[34]!==f||e[35]!==u?.reportApp||e[36]!==C?(se=u?.reportApp??{connectionId:f,virtualMcpId:C,toolName:Be},e[34]=f,e[35]=u?.reportApp,e[36]=C,e[37]=se):se=e[37];const P=se;let oe;e[38]!==o||e[39]!==t.slug||e[40]!==P.connectionId||e[41]!==P.toolName||e[42]!==P.virtualMcpId?(oe=()=>{localStorage.setItem(Me.sidebarOpen(),JSON.stringify(!1)),o({to:"/$org/$taskId",params:{org:t.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:P.virtualMcpId,main:qe(P.connectionId,P.toolName),chat:0}})},e[38]=o,e[39]=t.slug,e[40]=P.connectionId,e[41]=P.toolName,e[42]=P.virtualMcpId,e[43]=oe):oe=e[43];const fe=oe;if(F){const y=`Commerce setup will continue for ${t.name}.`;let I;e[44]!==y?(I=i.jsx(D,{title:"Commerce diagnostics",description:y}),e[44]=y,e[45]=I):I=e[45];let k;e[46]===Symbol.for("react.memo_cache_sentinel")?(k=i.jsx(J,{label:"Checking Commerce Discovery setup..."}),e[46]=k):k=e[46];let O;return e[47]!==I?(O=i.jsxs("div",{className:"grid gap-10",children:[I,k]}),e[47]=I,e[48]=O):O=e[48],O}if(me){const y=me instanceof Error?me.message:"We could not check Commerce Discovery setup.",I=`Commerce setup will continue for ${t.name}.`;let k;e[49]!==I?(k=i.jsx(D,{title:"Commerce diagnostics",description:I}),e[49]=I,e[50]=k):k=e[50];let O;e[51]!==y?(O=i.jsx(de,{message:y}),e[51]=y,e[52]=O):O=e[52];let z;e[53]!==x||e[54]!==N?(z=i.jsx(X,{type:"button",size:"xl",className:"w-full",onClick:()=>{x.refetch(),N.refetch()},children:"Retry"}),e[53]=x,e[54]=N,e[55]=z):z=e[55];let $;return e[56]!==k||e[57]!==O||e[58]!==z?($=i.jsxs("div",{className:"grid gap-10",children:[k,O,z]}),e[56]=k,e[57]=O,e[58]=z,e[59]=$):$=e[59],$}if(ee){let y;return e[60]!==fe||e[61]!==t||e[62]!==P?(y=i.jsx(Et,{org:t,reportApp:P,onOpenReport:fe}),e[60]=fe,e[61]=t,e[62]=P,e[63]=y):y=e[63],y}if(n){let y;e[64]!==n?(y=ye(n),e[64]=n,e[65]=y):y=e[65];const I=y;if(!I.ok){const ge=`Commerce setup will continue for ${t.name}.`;let G;e[66]!==ge?(G=i.jsx(D,{title:"Commerce diagnostics",description:ge}),e[66]=ge,e[67]=G):G=e[67];let Y;e[68]!==I.error?(Y=i.jsx(de,{message:I.error}),e[68]=I.error,e[69]=Y):Y=e[69];let V;e[70]!==A||e[71]!==m||e[72]!==v.isPending||e[73]!==l?(V=i.jsx(xe,{siteUrl:l,error:m,isSubmitting:v.isPending,onSiteUrlChange:d,onSubmit:A}),e[70]=A,e[71]=m,e[72]=v.isPending,e[73]=l,e[74]=V):V=e[74];let le;return e[75]!==G||e[76]!==Y||e[77]!==V?(le=i.jsxs("div",{className:"grid gap-10",children:[G,Y,V]}),e[75]=G,e[76]=Y,e[77]=V,e[78]=le):le=e[78],le}const k=`Commerce Discovery is being prepared for ${I.value}.`;let O;e[79]!==k?(O=i.jsx(D,{title:"Commerce diagnostics",description:k}),e[79]=k,e[80]=O):O=e[80];let z;e[81]!==A||e[82]!==m||e[83]!==v||e[84]!==l?(z=m?i.jsxs(i.Fragment,{children:[i.jsx(de,{message:m}),i.jsx(xe,{siteUrl:l,error:null,isSubmitting:v.isPending,onSiteUrlChange:d,onSubmit:A})]}):i.jsx(J,{label:"Setting up Commerce Discovery..."}),e[81]=A,e[82]=m,e[83]=v,e[84]=l,e[85]=z):z=e[85];let $;return e[86]!==O||e[87]!==z||e[88]!==ue?($=i.jsxs("div",{ref:ue,className:"grid gap-10",children:[O,z]}),e[86]=O,e[87]=z,e[88]=ue,e[89]=$):$=e[89],$}const pe=`Commerce setup will continue for ${t.name}.`;let W;e[90]!==pe?(W=i.jsx(D,{title:"Commerce diagnostics",description:pe}),e[90]=pe,e[91]=W):W=e[91];let Q;e[92]!==A||e[93]!==m||e[94]!==v.isPending||e[95]!==l?(Q=i.jsx(xe,{siteUrl:l,error:m,isSubmitting:v.isPending,onSiteUrlChange:d,onSubmit:A}),e[92]=A,e[93]=m,e[94]=v.isPending,e[95]=l,e[96]=Q):Q=e[96];let re;return e[97]!==W||e[98]!==Q?(re=i.jsxs("div",{className:"grid gap-10",children:[W,Q]}),e[97]=W,e[98]=Q,e[99]=re):re=e[99],re}function xe(s){const e=E.c(22),{siteUrl:t,error:n,isSubmitting:o,onSiteUrlChange:c,onSubmit:r}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:"Website URL"}),e[0]=l):l=e[0];let d;e[1]!==c?(d=b=>c(b.target.value),e[1]=c,e[2]=d):d=e[2];const u=!!n;let g;e[3]!==o||e[4]!==t||e[5]!==d||e[6]!==u?(g=i.jsx(He,{id:"commerce-site-url",type:"text",inputMode:"url",value:t,onChange:d,placeholder:"https://example.com","aria-invalid":u,disabled:o}),e[3]=o,e[4]=t,e[5]=d,e[6]=u,e[7]=g):g=e[7];let m;e[8]!==n?(m=n?i.jsx(de,{message:n}):null,e[8]=n,e[9]=m):m=e[9];let p;e[10]!==g||e[11]!==m?(p=i.jsxs("div",{className:"grid gap-2",children:[l,g,m]}),e[10]=g,e[11]=m,e[12]=p):p=e[12];let h;e[13]!==o?(h=o?i.jsxs(i.Fragment,{children:[i.jsx(je,{size:14,className:"animate-spin"}),"Setting up"]}):i.jsxs(i.Fragment,{children:["Continue",i.jsx(we,{size:16})]}),e[13]=o,e[14]=h):h=e[14];let f;e[15]!==o||e[16]!==h?(f=i.jsx(X,{type:"submit",size:"xl",className:"w-full",disabled:o,children:h}),e[15]=o,e[16]=h,e[17]=f):f=e[17];let C;return e[18]!==r||e[19]!==p||e[20]!==f?(C=i.jsxs("form",{className:"grid gap-4",onSubmit:r,children:[p,f]}),e[18]=r,e[19]=p,e[20]=f,e[21]=C):C=e[21],C}function Et(s){const e=E.c(6),{org:t,reportApp:n,onOpenReport:o}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx(D,{}),e[0]=c):c=e[0];const r=!n.virtualMcpId;let l;return e[1]!==o||e[2]!==t||e[3]!==n.connectionId||e[4]!==r?(l=i.jsxs("div",{className:"grid gap-10",children:[c,i.jsx(xt,{org:t,cdConnectionId:n.connectionId,reportDisabled:r,onOpenReport:o})]}),e[1]=o,e[2]=t,e[3]=n.connectionId,e[4]=r,e[5]=l):l=e[5],l}function de(s){const e=E.c(2),{message:t}=s;let n;return e[0]!==t?(n=i.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:t}),e[0]=t,e[1]=n):n=e[1],n}export{kn as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{y as he,aD as Ie,b5 as Ae,z as le,aB as De,c as P,j as t,i as ge,B as E,r as q,l as je,v as J,a5 as $e,K as ne,b as Y,a9 as ce,p as Pe,b6 as Oe,a2 as ze,e as Me,b7 as Ve,m as Ee,E as Ue,C as Fe,t as G,b8 as Re}from"./index-V_z4g85O.js";import{a as Le}from"./extract-connection-data-D0kn1CiV.js";import{E as ve}from"./empty-state-WkcHfsbi.js";import{E as Be,c as He,r as We,b as Xe,d as Ge}from"./connection-form-helpers-_Xw7Jp1j.js";import{c as qe,S as Ke,V as Qe}from"./index-D0VHzTLF.js";import{u as be,T as Je}from"./index-DeuQtcBQ.js";import{u as Ye}from"./use-members-Rhm6WZIF.js";import{A as Ze}from"./avatar-DPNVdynG.js";import{a as Ne,b as ye,u as et}from"./use-connection-DY54rYyd.js";import{u as _e}from"./use-mcp-client-DsIzdxc1.js";import{a as tt}from"./use-mcp-tools-BAGnYViX.js";import{a as st}from"./use-mcp-prompts-CwZBO4qi.js";import{i as nt,a as ot}from"./mcp-oauth-DlBIPcRz.js";import{I as oe}from"./integration-icon-DdvXmN6b.js";import{s as it}from"./Plus-zfs5-JeK.js";import{z as at,C as rt,af as lt,a4 as ct}from"./agent-icon-Dwg5FgWW.js";import{a as Ce,s as dt}from"./Settings02-Gfe6bidH.js";import{s as ae}from"./Trash01-BwZvbUqV.js";import{d as mt,c as ut,b as xt,S as pt,a as ft}from"./sheet-B6_wuIQB.js";import{F as L,b as B,c as H,d as V,f as W,e as ht,a as gt}from"./form-g86n2zay.js";import{I as X}from"./input-DVRfAVU3.js";import{u as jt,D as vt}from"./use-delete-connection-BP5srM_m.js";import{c as bt,C as Nt,B as yt,a as _t,b as Ct,d as St,e as wt}from"./monitoring-stats-row-DoSzHe4u.js";import{u as kt}from"./studio-tools-CcWLJIL3.js";import{u as Tt}from"./use-virtual-mcp-oC_oTaOn.js";import{i as Se}from"./ChevronRight-DbmfCIOT.js";import{a as we}from"./Users03-DNFFVYi5.js";import{T as ee,a as It,b as te,c as At}from"./tabs-B6a4ZhCv.js";import{g as ke}from"./connection-slug-eyAPH6o3.js";import{n as Dt}from"./ZapSquare-C6FRNhWU.js";import{c as $t}from"./Tool01-CyFZLY0Y.js";import{g as re,M as Pt}from"./types-IxCSiIKg.js";import{C as Ot}from"./collection-search-IIs4O29o.js";import{C as zt}from"./card-Trr9Smsl.js";import{B as Mt}from"./badge-BAgfu3s3.js";import{D as Vt,a as Et,b as Ut,c as de}from"./dropdown-menu-B3yjOr3B.js";import{d as me,b as ue,c as xe,S as pe,a as R}from"./select-iQPDKsQJ.js";import{i as Ft}from"./CheckCircle-B6_BlhWA.js";import{t as Rt}from"./ChevronDown-CsJyvcQs.js";import{n as Lt}from"./XCircle-Dcz0bhP7.js";import{s as se}from"./Star01-BfbfCcYt.js";import{s as Bt}from"./XClose-c_WWFEvr.js";import"./index-DPpLkDX2.js";import"./sidebar-BC3PqZZk.js";import"./LayoutLeft-DFQX2HQS.js";import"./tooltip-Bodmhuae.js";import"./ZoomOut-B6sxahLJ.js";import"./Key01-AxVsjzoW.js";import"./auth-DEpXDpCk.js";import"./use-registry-connections-D7CDGVjW.js";import"./use-organization-settings-C13VUvc7.js";import"./index-Bnq_KeQl.js";import"./index-UunSb5mF.js";import"./popover-ChpnNBG6.js";import"./ChevronUp-DTH787oJ.js";import"./SearchMd-DUUd_hhd.js";import"./use-create-virtual-mcp-C92AqYem.js";import"./use-navigate-to-agent-BzP0osS7.js";import"./Eye-Cd9WdjRO.js";import"./use-org-auth-client-CL0p_f0y.js";import"./User01-C6id_Jz0.js";import"./use-collections-gMfZ5Rvk.js";import"./AlertCircle-CqXnKI3D.js";import"./SwitchHorizontal01-C-8MujcR.js";import"./ArrowUpRight-D_A_c-WP.js";import"./ChevronLeft-cwkPjMhb.js";import"./DotsVertical-DXADESRu.js";import"./Stars02-CNjkSD-c.js";import"./Globe01-BtWLhdgc.js";import"./FilterLines-DDE5Z7pT.js";import"./Globe04-DVbA5z-S.js";import"./HardDrive-Dv021FxK.js";import"./LinkExternal01-DFJC7MKi.js";import"./Monitor01-DzIaslp9.js";import"./Sun-CduMeE8P.js";import"./Palette-DRyOxvc4.js";import"./Play-BGOeSWeu.js";import"./Shield01-5ohBHD7b.js";import"./Stars01-CDSyPsDa.js";import"./Upload01-BENZkUL6.js";import"./Users01-DoemHjk2.js";import"./X-DbKbpx_s.js";import"./Zap-iEV7Y0HC.js";import"./label-D1MGSLX0.js";import"./alert-dialog-Cv06ffuC.js";const Ht=he({scopes:De(le()).describe("List of scopes available"),stateSchema:Ie(le(),Ae()).describe("JSON Schema (draft-07) defining the state structure")}),Wt=[{name:"MCP_CONFIGURATION",inputSchema:he({}),outputSchema:Ht}];function Xt(s){const e=P.c(46),{instance:n,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i}=s;let c;e[0]!==n.id?(c={connectionId:n.id},e[0]=n.id,e[1]=c):c=e[1];const l=be(c),x=!(n.connection_type==="VIRTUAL")&&l.supportsOAuth&&!l.isAuthenticated,p=n.status!=="active",d=x||p?"border-destructive/50 bg-destructive/5":"border-transparent";let h;e[2]!==d?(h=je("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",d),e[2]=d,e[3]=h):h=e[3];let g;e[4]!==n.icon||e[5]!==n.title?(g=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=g):g=e[6];let v;e[7]!==n.title?(v=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=v):v=e[8];let b;e[9]!==n.status||e[10]!==p||e[11]!==x?(b=x?t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}):p?t.jsx("span",{className:"text-xs text-destructive font-medium",children:n.status==="error"?"Disabled (error)":"Disabled"}):null,e[9]=n.status,e[10]=p,e[11]=x,e[12]=b):b=e[12];let j;e[13]!==v||e[14]!==b?(j=t.jsxs("div",{className:"flex-1 min-w-0",children:[v,b]}),e[13]=v,e[14]=b,e[15]=j):j=e[15];let N;e[16]!==n||e[17]!==x||e[18]!==r?(N=x&&t.jsx(E,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>r(n),children:"Authorize"}),e[16]=n,e[17]=x,e[18]=r,e[19]=N):N=e[19];let T;e[20]!==n||e[21]!==p||e[22]!==i?(T=p?t.jsxs(E,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>i(n,"active"),children:[t.jsx(at,{size:13}),"Enable"]}):t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>i(n,"inactive"),title:"Disable",children:t.jsx(rt,{size:13})}),e[20]=n,e[21]=p,e[22]=i,e[23]=T):T=e[23];let S;e[24]!==n||e[25]!==a?(S=()=>a(n),e[24]=n,e[25]=a,e[26]=S):S=e[26];let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(Ce,{size:13}),e[27]=y):y=e[27];let I;e[28]!==S?(I=t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:S,title:"Configure",children:y}),e[28]=S,e[29]=I):I=e[29];let _;e[30]!==n||e[31]!==o?(_=()=>o(n),e[30]=n,e[31]=o,e[32]=_):_=e[32];let k;e[33]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(ae,{size:13}),e[33]=k):k=e[33];let C;e[34]!==_?(C=t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:_,title:"Delete",children:k}),e[34]=_,e[35]=C):C=e[35];let f;e[36]!==I||e[37]!==C||e[38]!==N||e[39]!==T?(f=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[N,T,I,C]}),e[36]=I,e[37]=C,e[38]=N,e[39]=T,e[40]=f):f=e[40];let w;return e[41]!==f||e[42]!==h||e[43]!==g||e[44]!==j?(w=t.jsxs("div",{className:h,children:[g,j,f]}),e[41]=f,e[42]=h,e[43]=g,e[44]=j,e[45]=w):w=e[45],w}function Gt(s){const e=P.c(15),{instance:n,onConfigure:a}=s;let r;e[0]!==n.icon||e[1]!==n.title?(r=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=r):r=e[2];let o;e[3]!==n.title?(o=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",children:n.title})}),e[3]=n.title,e[4]=o):o=e[4];let i;e[5]!==n||e[6]!==a?(i=()=>a(n),e[5]=n,e[6]=a,e[7]=i):i=e[7];let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ce,{size:13}),e[8]=c):c=e[8];let l;e[9]!==i?(l=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:i,title:"Configure",children:c})}),e[9]=i,e[10]=l):l=e[10];let u;return e[11]!==r||e[12]!==o||e[13]!==l?(u=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[r,o,l]}),e[11]=r,e[12]=o,e[13]=l,e[14]=u):u=e[14],u}function qt(s){const e=P.c(27),{instances:n,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i,onAdd:c,isAdding:l}=s;if(n.length===0)return null;const u=n.length===1?"Instance":"Instances";let x;e[0]!==u?(x=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:u}),e[0]=u,e[1]=x):x=e[1];let p;e[2]!==l?(p=l?t.jsx(ge,{size:13,className:"animate-spin"}):t.jsx(it,{size:13}),e[2]=l,e[3]=p):p=e[3];let d;e[4]!==l||e[5]!==c||e[6]!==p?(d=t.jsxs(E,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:c,disabled:l,children:[p,"Add instance"]}),e[4]=l,e[5]=c,e[6]=p,e[7]=d):d=e[7];let h;e[8]!==x||e[9]!==d?(h=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[x,d]}),e[8]=x,e[9]=d,e[10]=h):h=e[10];let g;if(e[11]!==n||e[12]!==r||e[13]!==a||e[14]!==o||e[15]!==i){let j;e[17]!==r||e[18]!==a||e[19]!==o||e[20]!==i?(j=N=>t.jsx(q.Suspense,{fallback:t.jsx(Gt,{instance:N,onConfigure:a}),children:t.jsx(Xt,{instance:N,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i})},N.id),e[17]=r,e[18]=a,e[19]=o,e[20]=i,e[21]=j):j=e[21],g=n.map(j),e[11]=n,e[12]=r,e[13]=a,e[14]=o,e[15]=i,e[16]=g}else g=e[16];let v;e[22]!==g?(v=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:g}),e[22]=g,e[23]=v):v=e[23];let b;return e[24]!==h||e[25]!==v?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[h,v]}),e[24]=h,e[25]=v,e[26]=b):b=e[26],b}const Kt=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function Qt(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 Jt={calls:{label:"Tool calls"},errors:{label:"Errors"}};function Yt(s){const e=P.c(1),{connectionId:n,orgId:a,timeframe:r}=s,o=kt(),i=Qt(r),{data:c}=$e({queryKey:ne.connectionActivity(n,r,a),queryFn:async()=>await o.call("MONITORING_LOGS_LIST",{startDate:i.startDate.toISOString(),endDate:i.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}),staleTime:3e5}),l=bt(c?.logs??[],i),u=l.data,x=l.totalCalls>0;let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[0]=p):p=e[0],t.jsxs("div",{children:[t.jsxs("div",{className:"flex gap-6 px-5 pb-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:l.totalCalls.toLocaleString()}),p]}),l.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:l.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),l.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(l.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),x?t.jsxs("div",{children:[t.jsx(Nt,{config:Jt,className:"h-16 w-full",children:t.jsxs(yt,{data:u,barCategoryGap:"4%",children:[t.jsx(_t,{content:t.jsx(Ct,{labelFormatter:es}),cursor:{fill:"var(--muted)"}}),t.jsx(St,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:u.map(Zt)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[u.length-1]?.label})]})]}):t.jsx("div",{className:"h-20 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-muted-foreground/60",children:"No activity in this period"})})]})}function Zt(s,e){return t.jsx(wt,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function es(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function ts(){const s=P.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 ss(s){const e=P.c(13),{connectionId:n}=s,[a,r]=q.useState("14d"),{org:o}=J();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=i):i=e[0];let c;e[1]!==a?(c=Kt.map(d=>t.jsx("button",{type:"button",onClick:()=>r(d.value),className:je("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",a===d.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:d.label},d.value)),e[1]=a,e[2]=c):c=e[2];let l;e[3]!==c?(l=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[i,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:c})]}),e[3]=c,e[4]=l):l=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(ts,{}),e[5]=u):u=e[5];let x;e[6]!==n||e[7]!==o.id||e[8]!==a?(x=t.jsx(q.Suspense,{fallback:u,children:t.jsx(Yt,{connectionId:n,orgId:o.id,timeframe:a})}),e[6]=n,e[7]=o.id,e[8]=a,e[9]=x):x=e[9];let p;return e[10]!==l||e[11]!==x?(p=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[l,x]}),e[10]=l,e[11]=x,e[12]=p):p=e[12],p}function ns(s){const e=P.c(15),{virtualMcp:n,org:a}=s,r=Y();let o;e[0]!==r||e[1]!==a||e[2]!==n.id?(o=()=>{const p=crypto.randomUUID();r({to:"/$org/$taskId",params:{org:a,taskId:p},search:{virtualmcpid:n.id}})},e[0]=r,e[1]=a,e[2]=n.id,e[3]=o):o=e[3];let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(we,{size:16}),e[4]=i):i=e[4];let c;e[5]!==n.icon||e[6]!==n.title?(c=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:i}),e[5]=n.icon,e[6]=n.title,e[7]=c):c=e[7];let l;e[8]!==n.title?(l=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=l):l=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(Se,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[10]=u):u=e[10];let x;return e[11]!==o||e[12]!==c||e[13]!==l?(x=t.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group text-left w-full",children:[c,l,u]}),e[11]=o,e[12]=c,e[13]=l,e[14]=x):x=e[14],x}function os(s){const e=P.c(7),{virtualMcps:n,org:a}=s;let r;if(e[0]!==a||e[1]!==n){let i;e[3]!==a?(i=c=>t.jsx(ns,{virtualMcp:c,org:a},c.id),e[3]=a,e[4]=i):i=e[4],r=n.map(i),e[0]=a,e[1]=n,e[2]=r}else r=e[2];let o;return e[5]!==r?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:r})}),e[5]=r,e[6]=o):o=e[6],o}function is(s){const e=P.c(7),{connection:n}=s,{org:a}=J();let r;e[0]!==n.id?(r={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=r):r=e[1];const o=Tt(r);if(!(o.length>0)){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(t.Fragment,{}),e[2]=u):u=e[2],u}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 l;return e[4]!==a.slug||e[5]!==o?(l=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(os,{virtualMcps:o,org:a.slug})})]}),e[4]=a.slug,e[5]=o,e[6]=l):l=e[6],l}function as(s){const e=P.c(31),{tools:n,connectionId:a,org:r}=s,o=Y(),{org:i}=J();let c;e[0]!==a||e[1]!==i.id||e[2]!==i.slug?(c={connectionId:a,orgId:i.id,orgSlug:i.slug},e[0]=a,e[1]=i.id,e[2]=i.slug,e[3]=c):c=e[3];const l=_e(c),u=Ne(a);let x;e[4]!==u||e[5]!==a?(x=u?ke(u):a,e[4]=u,e[5]=a,e[6]=x):x=e[6];const p=x,[d,h]=q.useState("");let g,v,b,j;if(e[7]!==p||e[8]!==l||e[9]!==o||e[10]!==r||e[11]!==d||e[12]!==n){const S=(n??[]).filter(rs),y=d.toLowerCase().trim(),I=y?S.filter(f=>f.name.toLowerCase().includes(y)||f.description&&f.description.toLowerCase().includes(y)):S;let _;e[17]!==p||e[18]!==o||e[19]!==r?(_=f=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(f.name)}})},e[17]=p,e[18]=o,e[19]=r,e[20]=_):_=e[20];const k=_;b="flex flex-col h-full overflow-hidden";let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=f=>{f.key==="Escape"&&(h(""),f.target.blur())},e[21]=C):C=e[21],e[22]!==d?(j=t.jsx(Ot,{value:d,onChange:h,placeholder:"Search apps...",onKeyDown:C}),e[22]=d,e[23]=j):j=e[23],g="flex-1 overflow-auto p-5",v=I.length===0?t.jsx(ve,{image:null,title:d?"No apps found":"No apps available",description:d?"Try adjusting your search terms":"This connection doesn't have any tools with interactive UIs yet."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:I.map(f=>{const w=re(f._meta);return t.jsxs(zt,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>k(f),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(Pt,{resourceURI:w,toolInfo:{tool:f},displayMode:"inline",minHeight:200,maxHeight:200,client:l})}),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:f.name}),t.jsx(Je,{annotations:f.annotations,_meta:f._meta})]}),f.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:f.description})]})]},f.name)})}),e[7]=p,e[8]=l,e[9]=o,e[10]=r,e[11]=d,e[12]=n,e[13]=g,e[14]=v,e[15]=b,e[16]=j}else g=e[13],v=e[14],b=e[15],j=e[16];let N;e[24]!==g||e[25]!==v?(N=t.jsx("div",{className:g,children:v}),e[24]=g,e[25]=v,e[26]=N):N=e[26];let T;return e[27]!==b||e[28]!==j||e[29]!==N?(T=t.jsxs("div",{className:b,children:[j,N]}),e[27]=b,e[28]=j,e[29]=N,e[30]=T):T=e[30],T}function rs(s){return!!re(s._meta)}function Te(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=i=>i.charAt(0).toUpperCase()+i.slice(1),a=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),r=e.map(n),o=e[e.length-1];return r.length>=2&&o&&a.has(o)?[r.pop(),...r].join(" "):r.join(" ")}function ie(s){const e=P.c(2),{label:n}=s;let a;return e[0]!==n?(a=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]=a):a=e[1],a}function ls(s){const e=P.c(50),{tools:n,prompts:a,resources:r,connectionId:o,org:i}=s;let c;e[0]!==a?(c=a===void 0?[]:a,e[0]=a,e[1]=c):c=e[1];const l=c;let u;e[2]!==r?(u=r===void 0?[]:r,e[2]=r,e[3]=u):u=e[3];const x=u,p=Y(),d=Ne(o??"");let h;e[4]!==d||e[5]!==o?(h=d?ke(d):o,e[4]=d,e[5]=o,e[6]=h):h=e[6];const g=h;let v;e[7]!==g||e[8]!==o||e[9]!==p||e[10]!==i?(v=function(D){!o||!i||p({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:i,appSlug:g,collectionName:"tools",itemId:encodeURIComponent(D)}})},e[7]=g,e[8]=o,e[9]=p,e[10]=i,e[11]=v):v=e[11];const b=v;let j;e[12]!==o||e[13]!==i||e[14]!==n?(j=o&&i&&n.some(ms),e[12]=o,e[13]=i,e[14]=n,e[15]=j):j=e[15];const N=j;if(n.length+l.length+x.length===0){let m;return e[16]===Symbol.for("react.memo_cache_sentinel")?(m=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]=m):m=e[16],m}let S;e[17]!==n.length?(S=t.jsxs(ee,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=S):S=e[18];let y;e[19]!==N?(y=N&&t.jsx(ee,{value:"apps",variant:"underline",children:"UI"}),e[19]=N,e[20]=y):y=e[20];let I,_;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(ee,{value:"prompts",variant:"underline",children:"Prompts"}),_=t.jsx(ee,{value:"resources",variant:"underline",children:"Resources"}),e[21]=I,e[22]=_):(I=e[21],_=e[22]);let k;e[23]!==S||e[24]!==y?(k=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(It,{variant:"underline",className:"gap-1",children:[S,y,I,_]})}),e[23]=S,e[24]=y,e[25]=k):k=e[25];let C;e[26]!==b||e[27]!==n?(C=n.length>0?n.map(m=>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:()=>b(m.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($t,{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:Te(m.name)}),m.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:m.description})]}),t.jsx(Se,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},m.name)):t.jsx(ie,{label:"tools"}),e[26]=b,e[27]=n,e[28]=C):C=e[28];let f;e[29]!==C?(f=t.jsx(te,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:C})}),e[29]=C,e[30]=f):f=e[30];let w;e[31]!==o||e[32]!==N||e[33]!==i||e[34]!==n?(w=N&&t.jsx(te,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(as,{tools:n,connectionId:o,org:i})}),e[31]=o,e[32]=N,e[33]=i,e[34]=n,e[35]=w):w=e[35];let z;e[36]!==l?(z=l.length>0?l.map(ds):t.jsx(ie,{label:"prompts"}),e[36]=l,e[37]=z):z=e[37];let O;e[38]!==z?(O=t.jsx(te,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:z})}),e[38]=z,e[39]=O):O=e[39];let A;e[40]!==x?(A=x.length>0?x.map(cs):t.jsx(ie,{label:"resources"}),e[40]=x,e[41]=A):A=e[41];let M;e[42]!==A?(M=t.jsx(te,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:A})}),e[42]=A,e[43]=M):M=e[43];let U;return e[44]!==k||e[45]!==f||e[46]!==w||e[47]!==O||e[48]!==M?(U=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(At,{defaultValue:"tools",variant:"underline",children:[k,f,w,O,M]})}),e[44]=k,e[45]=f,e[46]=w,e[47]=O,e[48]=M,e[49]=U):U=e[49],U}function cs(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(lt,{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 ds(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(Dt,{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:Te(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 ms(s){return re(s._meta)}function us(s){const e=P.c(13),{connection:n,displayTitle:a}=s,r=a??n.title;let o;e[0]!==n.icon||e[1]!==r?(o=t.jsx(oe,{icon:n.icon,name:r,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=r,e[2]=o):o=e[2];let i;e[3]!==r?(i=t.jsx("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:t.jsx("h1",{className:"text-lg md:text-xl font-semibold tracking-tight text-foreground leading-none",children:r})}),e[3]=r,e[4]=i):i=e[4];let c;e[5]!==n.description?(c=n.description&&t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed line-clamp-2",children:n.description}),e[5]=n.description,e[6]=c):c=e[6];let l;e[7]!==i||e[8]!==c?(l=t.jsxs("div",{className:"flex-1 min-w-0",children:[i,c]}),e[7]=i,e[8]=c,e[9]=l):l=e[9];let u;return e[10]!==o||e[11]!==l?(u=t.jsxs("div",{className:"flex items-center gap-4 md:gap-6 py-5 md:py-7 px-4 md:px-8 bg-background border-b border-border shrink-0",children:[o,l]}),e[10]=o,e[11]=l,e[12]=u):u=e[12],u}function xs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:a,onRemoveOAuth:r}){const o=ce({control:s.control,name:"ui_type"}),i=ce({control:s.control,name:"connection_url"}),{stdioEnabled:c}=Pe(),l=(()=>{if(typeof i!="string"||!i)return!1;try{const d=new URL(i);return d.hostname==="api.githubcopilot.com"&&d.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),u=c||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",p=x?Oe(e.connection_url):null;return x?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(we,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),p&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),t.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:t.jsx("code",{className:"text-sm text-muted-foreground",children:p})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(L,{control:s.control,name:"ui_type",render:({field:d})=>t.jsxs(B,{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(me,{value:d.value,onValueChange:d.onChange,children:[t.jsx(V,{children:t.jsxs(ue,{className:"h-full! w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(se,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(xe,{})]})}),t.jsxs(pe,{children:[t.jsx(R,{value:"HTTP",children:"HTTP"}),t.jsx(R,{value:"SSE",children:"SSE"}),t.jsx(R,{value:"Websocket",children:"Websocket"}),u&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:"NPX Package"}),t.jsx(R,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(L,{control:s.control,name:"connection_url",render:({field:h})=>t.jsx(B,{className:"flex-1 min-w-0",children:t.jsx(V,{children:t.jsx(X,{placeholder:"https://example.com/mcp",...h,value:h.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(me,{value:d.value,onValueChange:d.onChange,children:[t.jsx(V,{children:t.jsx(ue,{className:"h-10",children:t.jsx(xe,{})})}),t.jsxs(pe,{children:[t.jsx(R,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(R,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(R,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"Websocket"]})}),u&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Lt,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(R,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ct,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(W,{})]})}),o==="NPX"&&t.jsx(L,{control:s.control,name:"npx_package",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(V,{children:t.jsx(X,{placeholder:"@perplexity-ai/mcp-server",...d,value:d.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(L,{control:s.control,name:"stdio_command",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(V,{children:t.jsx(X,{placeholder:"node, bun, python...",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),t.jsx(L,{control:s.control,name:"stdio_args",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(V,{children:t.jsx(X,{placeholder:"arg1 arg2 --flag value",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(W,{})]})})]}),t.jsx(L,{control:s.control,name:"stdio_cwd",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(V,{children:t.jsx(X,{placeholder:"/path/to/project (optional)",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(L,{control:s.control,name:"env_vars",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(V,{children:t.jsx(Be,{value:d.value??[],onChange:d.onChange})}),t.jsx(W,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(L,{control:s.control,name:"connection_token",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:l?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Vt,{children:[t.jsx(Et,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Mt,{variant:"success",className:"gap-1.5",children:[t.jsx(Ft,{size:12}),"Authenticated via OAuth",t.jsx(Rt,{size:12})]})})}),t.jsxs(Ut,{align:"start",children:[t.jsxs(de,{onClick:a,children:[t.jsx(dt,{size:16}),"Re-authenticate"]}),t.jsxs(de,{variant:"destructive",onClick:r,children:[t.jsx(ae,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&d.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:()=>d.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(Bt,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(X,{type:"password",placeholder:l?"Paste your GitHub PAT":"Enter access token...",...d,value:d.value||"",className:"h-10 rounded-lg"})}),l&&t.jsxs(ht,{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 ps(s){return s.command==="npx"}function fs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function hs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function fe(s,e){const n={title:s.title,description:s.description??"",icon:s.icon??null,configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&Re(s.connection_headers)){const a=s.connection_headers,r=We(a.envVars);if(ps(a)){const i=fs(a);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:i,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const o=hs(a);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:o.command,stdio_args:o.args,stdio_cwd:o.cwd,env_vars:r}}return{...n,ui_type:s.connection_type,connection_url:s.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function gs(s){let e,n=null,a=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=Xe(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",r=Ge(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",a=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...a&&{connection_token:a},...r&&{connection_headers:r},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function js({connection:s,connectionId:e,org:n,isUpdating:a,tools:r,prompts:o,resources:i,siblings:c}){const l=Y({from:"/$org/settings/connections/$appSlug"}),u=Ee(),x=ye(),{org:p}=J(),d=jt({onSuccess:()=>{c.length<=1&&l({to:"/$org/settings/connections",params:{org:n}})}}),[h,g]=q.useState(null),[v,b]=q.useState(!1),j=be({connectionId:e}),{data:N}=Ye(),T=N?.data?.members??[],S=h??s,y=T.find(m=>m.userId===S.created_by),_=s?.connection_type==="VIRTUAL"||j.isAuthenticated,k={...s,tools:r},C=qe(k,Wt),f=Ue({resolver:Fe(He),values:fe(h??s)}),w=f.formState.isDirty,z=async()=>{if(!await f.trigger())return;const D=f.getValues(),$=gs(D),F=h?.id??e;await x.update.mutateAsync({id:F,data:$}),f.reset(D)},O=()=>{f.reset(fe(h??s))},A=async m=>{const{token:D,tokenInfo:$,error:F}=await ot({connectionId:m,orgSlug:p.slug,scope:"offline_access"});if(F||!D){G.error(`Authentication failed: ${F}`);return}if($)try{const K=await fetch(`/api/${p.slug}/connections/${m}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:$.accessToken,refreshToken:$.refreshToken,expiresIn:$.expiresIn,scope:$.scope,clientId:$.clientId,clientSecret:$.clientSecret,tokenEndpoint:$.tokenEndpoint})});if(!K.ok)console.error("Failed to save OAuth token:",await K.text()),await x.update.mutateAsync({id:m,data:{connection_token:D}});else try{await x.update.mutateAsync({id:m,data:{}})}catch(Z){console.warn("Failed to refresh connection tools after OAuth:",Z)}}catch(K){console.error("Error saving OAuth token:",K),await x.update.mutateAsync({id:m,data:{connection_token:D}})}else await x.update.mutateAsync({id:m,data:{connection_token:D}});const Q=new URL(`/api/${p.slug}/mcp/${m}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(Q.href,null)}),await u.invalidateQueries({queryKey:ne.mcpClientPrefix()}),G.success("Authentication successful")},M=()=>A(s.id),U=async()=>{try{const m=await fetch(`/api/${p.slug}/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!m.ok){const $=await m.text();G.error(`Failed to remove OAuth: ${$}`);return}const D=new URL(`/api/${p.slug}/mcp/${s.id}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(D.href,null)}),G.success("OAuth removed. You can now re-authenticate with a different account.")}catch(m){console.error("Error removing OAuth token:",m),G.error("Failed to remove OAuth")}};return t.jsxs(t.Fragment,{children:[t.jsx(vt,{...d}),t.jsx(mt,{open:h!==null,onOpenChange:m=>{m||g(null)},children:t.jsxs(ut,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(xt,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(pt,{className:"text-base",children:h?.title??s.title}),t.jsx(ft,{className:"text-xs",children:"Update URL, authentication, and other settings"}),y&&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:y.user?.image??void 0,fallback:y.user?.name??y.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:y.user?.name||y.user?.email})]})]}),t.jsxs(gt,{...f,children:[t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 md:px-6 md:py-5 flex flex-col gap-4 md:gap-6",children:[t.jsxs("div",{className:"flex flex-col gap-3 md:gap-4",children:[t.jsx(L,{control:f.control,name:"title",render:({field:m})=>t.jsxs(B,{children:[t.jsx(H,{children:"Name"}),t.jsx(V,{children:t.jsx(X,{...m})}),t.jsx(W,{})]})}),t.jsx(L,{control:f.control,name:"description",render:({field:m})=>t.jsxs(B,{children:[t.jsx(H,{children:"Description"}),t.jsx(V,{children:t.jsx(X,{...m,value:m.value||""})}),t.jsx(W,{})]})})]}),t.jsx(xs,{form:f,connection:h??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:M,onRemoveOAuth:U}),t.jsx(Ke,{connection:h??s,form:f,hasMcpBinding:C,isMCPAuthenticated:_,supportsOAuth:j.supportsOAuth,isServerError:j.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(E,{onClick:z,disabled:!w||a,className:"flex-1",children:a?"Saving…":"Save changes"}),w&&t.jsx(E,{variant:"outline",onClick:O,children:"Undo"}),t.jsxs(E,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const m=h??s;g(null),d.requestDelete(m)},children:[t.jsx(ae,{size:15}),"Delete"]})]})]},h?.id??s.id)]})}),t.jsx(Qe,{hideHeader:!0,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(us,{connection:s,displayTitle:(()=>{const m=c[0]??s;return m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.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(ss,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(qt,{instances:c,onConfigure:m=>g(m),onAuthenticate:m=>A(m.id),onDelete:m=>d.requestDelete(m),onToggleStatus:async(m,D)=>{try{await x.update.mutateAsync({id:m.id,data:{status:D}}),G.success(D==="active"?"Connection enabled":"Connection disabled")}catch{G.error("Failed to update connection")}},isAdding:v,onAdd:async()=>{b(!0);try{const m=c[0]??s,D=m.title.replace(/\s*\(\d+\)\s*$/,""),$=c.length+1,F=`${D} (${$})`,Q=Le("conn");await x.create.mutateAsync({id:Q,title:F,description:m.description??null,connection_type:m.connection_type,connection_url:m.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:m.created_by,organization_id:m.organization_id,icon:m.icon??null,app_name:m.app_name??null,app_id:m.app_id??null,connection_headers:m.connection_headers??null,oauth_config:null,configuration_state:m.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const K=new URL(`/api/${p.slug}/mcp/${Q}`,window.location.origin),Z=await nt({url:K.href,token:null,orgId:p.id});Z.supportsOAuth&&!Z.isAuthenticated&&await A(Q)}finally{b(!1)}}}),t.jsx(is,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ls,{tools:r,prompts:o,resources:i,connectionId:e,org:n})})]})})]})})]})}function vs(){const s=P.c(39);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/settings/connections/$appSlug"},s[0]=e):e=s[0];const n=Y(e);let a;s[1]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/shell/$org/settings/connections/$appSlug"},s[1]=a):a=s[1];const{appSlug:r,org:o}=Me(a),{org:i}=J(),c=ye();let l;s[2]!==r?(l={slug:r},s[2]=r,s[3]=l):l=s[3];const u=et(l),x=u[0]??null,p=x?.id??"",d=p||null;let h;s[4]!==i.id||s[5]!==i.slug||s[6]!==d?(h={connectionId:d,orgId:i.id,orgSlug:i.slug},s[4]=i.id,s[5]=i.slug,s[6]=d,s[7]=h):h=s[7];const g=_e(h);let v;s[8]!==g?(v={client:g},s[8]=g,s[9]=v):v=s[9];const{data:b}=tt(v);let j;if(s[10]!==x?.tools||s[11]!==p||s[12]!==u||s[13]!==b){const A=b?b.tools.map(Ss):(x?.tools??[]).map(Cs);e:{if(u.length<=1){j=A;break e}const M=new Set,U=[],m=ys;for(const D of u){const $=D.id===p?A:m(D.tools);for(const F of $)M.has(F.name)||(M.add(F.name),U.push(F))}j=U.length>0?U:A}s[10]=x?.tools,s[11]=p,s[12]=u,s[13]=b,s[14]=j}else j=s[14];const N=j;let T;s[15]!==g?(T={client:g},s[15]=g,s[16]=T):T=s[16];const{data:S}=st(T);let y;s[17]!==g?(y={client:g},s[17]=g,s[18]=y):y=s[18];const{data:I}=Ve(y);let _;s[19]!==S?.prompts?(_=S?.prompts??[],s[19]=S?.prompts,s[20]=_):_=s[20];let k;s[21]!==_?(k=_.map(Ns),s[21]=_,s[22]=k):k=s[22];const C=k;let f;s[23]!==I?.resources?(f=I?.resources??[],s[23]=I?.resources,s[24]=f):f=s[24];let w;s[25]!==f?(w=f.map(bs),s[25]=f,s[26]=w):w=s[26];const z=w;if(!x){let A;return s[27]!==n||s[28]!==o?(A=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(ve,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(E,{variant:"outline",onClick:()=>n({to:"/$org/settings/connections",params:{org:o}}),children:"Back to connections"})})}),s[27]=n,s[28]=o,s[29]=A):A=s[29],A}let O;return s[30]!==c.update.isPending||s[31]!==N||s[32]!==x||s[33]!==p||s[34]!==o||s[35]!==C||s[36]!==z||s[37]!==u?(O=t.jsx(js,{org:o,connection:x,connectionId:p,isUpdating:c.update.isPending,tools:N,prompts:C,resources:z,siblings:u}),s[30]=c.update.isPending,s[31]=N,s[32]=x,s[33]=p,s[34]=o,s[35]=C,s[36]=z,s[37]=u,s[38]=O):O=s[38],O}function bs(s){return{name:s.name,description:s.description,uri:s.uri}}function Ns(s){return{name:s.name,description:s.description}}function ys(s){return(s??[]).map(_s)}function _s(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Cs(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ss(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ws(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ze,{children:t.jsx(q.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(ge,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(vs,{})})}),s[0]=e):e=s[0],e}function io(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ws,{}),s[0]=e):e=s[0],e}export{io as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as E,c as oe,j as t,a2 as Ye,i as ce,v as be,b as _e,u as Ze,a as Ne,p as et,s as tt,L as nt,E as st,C as ot,B as U,q as te,m as it,l as de,t as W,K as rt}from"./index-V_z4g85O.js";import{a as lt,b as De,g as at,e as ct}from"./extract-connection-data-D0kn1CiV.js";import{C as dt}from"./collection-display-button-BhW4iJuC.js";import{S as mt}from"./search-input-R9PP00jU.js";import{C as ut}from"./collection-tabs-DStxKs6K.js";import{u as pt,a as ke,g as ht,C as Ce}from"./connection-card-CX4CTBla.js";import{E as gt}from"./empty-state-WkcHfsbi.js";import{I as xt}from"./integration-icon-DdvXmN6b.js";import{P as ue}from"./index-DPpLkDX2.js";import{u as ft,D as jt}from"./use-delete-connection-BP5srM_m.js";import{u as ye}from"./use-capability-mUGdJwF_.js";import{u as yt}from"./use-infinite-scroll-CcoRA6NH.js";import{u as Ct}from"./use-view-mode-Brlii9ZZ.js";import{g as he}from"./connection-slug-eyAPH6o3.js";import{c as Ae,d as we,b as Te,A as Ie,e as Pe,g as $e,a as Le,f as Oe}from"./alert-dialog-Cv06ffuC.js";import{C as Fe}from"./checkbox-BkY2CRaN.js";import{d as Me,c as ze,D as Ve,a as Ee,b as Be,e as Ke}from"./dialog-DC6TTwSU.js";import{D as vt,a as St,c as bt,b as _t,d as Nt,e as Dt,f as kt}from"./drawer-D-qJMn42.js";import{u as At}from"./tooltip-Bodmhuae.js";import{D as Ue,a as Re,b as He,c as re}from"./dropdown-menu-B3yjOr3B.js";import{F as Q,b as J,c as Y,d as Z,f as ee,a as ve}from"./form-g86n2zay.js";import{I as ie}from"./input-DVRfAVU3.js";import{d as wt,b as Tt,c as It,S as Pt,a as ae}from"./select-iQPDKsQJ.js";import{T as $t}from"./textarea-DkgswAud.js";import{b as We,u as Lt}from"./use-connection-DY54rYyd.js";import{u as Ot}from"./use-virtual-mcp-oC_oTaOn.js";import{u as Ft}from"./studio-tools-CcWLJIL3.js";import{a4 as Mt,ae as zt,C as Vt,z as Et}from"./agent-icon-Dwg5FgWW.js";import{n as ge}from"./XCircle-Dcz0bhP7.js";import{a as Xe}from"./DotsVertical-DXADESRu.js";import{s as qe}from"./Eye-Cd9WdjRO.js";import{s as je}from"./Star01-BfbfCcYt.js";import{s as Ge}from"./Plus-zfs5-JeK.js";import{s as Qe}from"./Trash01-BwZvbUqV.js";import{s as Je}from"./XClose-c_WWFEvr.js";import{i as pe,a as Se,E as Bt,c as Kt,p as Ut,b as Rt,d as Ht}from"./connection-form-helpers-_Xw7Jp1j.js";import{a as Wt}from"./authenticate-and-persist-oauth-BELZfB_M.js";import"./use-mcp-client-DsIzdxc1.js";import"./auth-DEpXDpCk.js";import"./SwitchHorizontal01-C-8MujcR.js";import"./ChevronUp-DTH787oJ.js";import"./view-mode-toggle-Dgssa66x.js";import"./badge-BAgfu3s3.js";import"./SearchMd-DUUd_hhd.js";import"./use-registry-connections-D7CDGVjW.js";import"./use-organization-settings-C13VUvc7.js";import"./useInfiniteQuery-BDW2fh8c.js";import"./card-Trr9Smsl.js";import"./sidebar-BC3PqZZk.js";import"./LayoutLeft-DFQX2HQS.js";import"./sheet-B6_wuIQB.js";import"./X-DbKbpx_s.js";import"./ChevronRight-DbmfCIOT.js";import"./label-D1MGSLX0.js";import"./ChevronDown-CsJyvcQs.js";import"./use-collections-gMfZ5Rvk.js";import"./AlertCircle-CqXnKI3D.js";import"./Tool01-CyFZLY0Y.js";import"./Settings02-Gfe6bidH.js";import"./ArrowUpRight-D_A_c-WP.js";import"./ZapSquare-C6FRNhWU.js";import"./Users03-DNFFVYi5.js";import"./CheckCircle-B6_BlhWA.js";import"./ChevronLeft-cwkPjMhb.js";import"./Stars02-CNjkSD-c.js";import"./ZoomOut-B6sxahLJ.js";import"./Globe01-BtWLhdgc.js";import"./FilterLines-DDE5Z7pT.js";import"./Globe04-DVbA5z-S.js";import"./HardDrive-Dv021FxK.js";import"./Key01-AxVsjzoW.js";import"./LinkExternal01-DFJC7MKi.js";import"./Monitor01-DzIaslp9.js";import"./Sun-CduMeE8P.js";import"./Palette-DRyOxvc4.js";import"./Play-BGOeSWeu.js";import"./Shield01-5ohBHD7b.js";import"./Stars01-CDSyPsDa.js";import"./Upload01-BENZkUL6.js";import"./User01-C6id_Jz0.js";import"./Users01-DoemHjk2.js";import"./Zap-iEV7Y0HC.js";import"./mcp-oauth-DlBIPcRz.js";function Xt(f){const e=`deco-filters-${f}`,[n,p]=E.useState(()=>{try{const o=globalThis.localStorage?.getItem(e);if(o)return JSON.parse(o)}catch(o){console.error("Failed to parse stored filters:",o)}return[]});return[n,o=>{p(o);try{globalThis.localStorage?.setItem(e,JSON.stringify(o))}catch(i){console.error("Failed to save filters:",i)}}]}function qt(f){const e=oe.c(7),[n,p]=E.useState(f),[l,o]=E.useState(f?"desc":null);let i;e[0]!==l||e[1]!==n?(i=j=>{n!==j?(p(j),o("asc")):l==="asc"?o("desc"):l==="desc"&&(p(void 0),o(null))},e[0]=l,e[1]=n,e[2]=i):i=e[2];const g=i;let h;return e[3]!==g||e[4]!==l||e[5]!==n?(h={sortKey:n,sortDirection:l,handleSort:g},e[3]=g,e[4]=l,e[5]=n,e[6]=h):h=e[6],h}function Gt(f){const e=oe.c(20),{namespace:n,resource:p,defaultSortKey:l,defaultViewMode:o}=f,i=l===void 0?"title":l,g=o===void 0?"table":o,[h,j]=E.useState(""),y=E.useDeferredValue(h),N=`${n}-${p}`,[b,a]=Xt(N),x=`mesh-${p}-filter-visible-${n}`;let m;e[0]!==x?(m=()=>globalThis.localStorage?.getItem(x)==="true",e[0]=x,e[1]=m):m=e[1];const[v,_]=E.useState(m);let D;e[2]!==x?(D=T=>{_(T),globalThis.localStorage?.setItem(x,String(T))},e[2]=x,e[3]=D):D=e[3];const L=D;let O;e[4]!==v||e[5]!==L?(O=()=>{L(!v)},e[4]=v,e[5]=L,e[6]=O):O=e[6];const s=O,[A,F]=Ct(`mesh-${p}-${n}`,g),{sortKey:M,sortDirection:w,handleSort:P}=qt(i),z=M;let C;return e[7]!==v||e[8]!==b||e[9]!==P||e[10]!==h||e[11]!==y||e[12]!==L||e[13]!==a||e[14]!==F||e[15]!==w||e[16]!==z||e[17]!==s||e[18]!==A?(C={search:h,searchTerm:y,setSearch:j,filters:b,setFilters:a,filterBarVisible:v,setFilterBarVisible:L,toggleFilterBar:s,viewMode:A,setViewMode:F,sortKey:z,sortDirection:w,handleSort:P},e[7]=v,e[8]=b,e[9]=P,e[10]=h,e[11]=y,e[12]=L,e[13]=a,e[14]=F,e[15]=w,e[16]=z,e[17]=s,e[18]=A,e[19]=C):C=e[19],C}function Qt(f){const e=oe.c(51),{group:n,onOpen:p,selectionMode:l,selectedIds:o,onToggleSelect:i}=f;let g;if(e[0]!==n.connections||e[1]!==o){let C;e[3]!==o?(C=T=>o.has(T.id),e[3]=o,e[4]=C):C=e[4],g=n.connections.every(C),e[0]=n.connections,e[1]=o,e[2]=g}else g=e[2];const h=g;let j;if(e[5]!==n.connections||e[6]!==o){let C;e[8]!==o?(C=T=>o.has(T.id),e[8]=o,e[9]=C):C=e[9],j=n.connections.some(C),e[5]=n.connections,e[6]=o,e[7]=j}else j=e[7];const y=j,N=`${n.connections.length} instances`;let b;e[10]!==n.icon||e[11]!==n.title||e[12]!==N?(b={title:n.title,icon:n.icon,description:N},e[10]=n.icon,e[11]=n.title,e[12]=N,e[13]=b):b=e[13];let a;e[14]!==h||e[15]!==n.connections||e[16]!==p||e[17]!==i||e[18]!==o||e[19]!==l?(a=()=>l?(()=>{for(const C of n.connections)h?o.has(C.id)&&i(C.id):o.has(C.id)||i(C.id)})():p(),e[14]=h,e[15]=n.connections,e[16]=p,e[17]=i,e[18]=o,e[19]=l,e[20]=a):a=e[20];const x=l&&h&&"ring-2 ring-primary",m=l&&y&&!h&&"ring-1 ring-primary/50";let v;e[21]!==x||e[22]!==m?(v=de(x,m),e[21]=x,e[22]=m,e[23]=v):v=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(ge,{}),e[24]=_):_=e[24];let D;e[25]!==h||e[26]!==n.connections||e[27]!==i||e[28]!==o||e[29]!==l||e[30]!==y?(D=l?t.jsx(Fe,{checked:h?!0:y?"indeterminate":!1,onCheckedChange:()=>{for(const C of n.connections)h?o.has(C.id)&&i(C.id):o.has(C.id)||i(C.id)}}):t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsxs("span",{className:"text-xs text-muted-foreground font-normal tabular-nums",children:["x",n.connections.length]})]}),e[25]=h,e[26]=n.connections,e[27]=i,e[28]=o,e[29]=l,e[30]=y,e[31]=D):D=e[31];const L=l?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100";let O;e[32]!==L?(O=de("overflow-hidden transition-all duration-150 ease-out",L),e[32]=L,e[33]=O):O=e[33];let s;e[34]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx(Re,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Yt,children:t.jsx(Xe,{size:20})})}),e[34]=s):s=e[34];let A;e[35]!==p?(A=C=>{C.stopPropagation(),p()},e[35]=p,e[36]=A):A=e[36];let F;e[37]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(qe,{size:16}),e[37]=F):F=e[37];let M;e[38]!==A?(M=t.jsxs(Ue,{children:[s,t.jsx(He,{align:"end",onClick:Jt,children:t.jsxs(re,{onClick:A,children:[F,"Open"]})})]}),e[38]=A,e[39]=M):M=e[39];let w;e[40]!==O||e[41]!==M?(w=t.jsx("div",{className:O,children:M}),e[40]=O,e[41]=M,e[42]=w):w=e[42];let P;e[43]!==D||e[44]!==w?(P=t.jsxs("div",{className:"flex items-center gap-1",children:[D,w]}),e[43]=D,e[44]=w,e[45]=P):P=e[45];let z;return e[46]!==P||e[47]!==b||e[48]!==a||e[49]!==v?(z=t.jsx(t.Fragment,{children:t.jsx(Ce,{connection:b,onClick:a,className:v,fallbackIcon:_,headerActionsAlwaysVisible:!0,headerActions:P})}),e[46]=P,e[47]=b,e[48]=a,e[49]=v,e[50]=z):z=e[50],z}function Jt(f){return f.stopPropagation()}function Yt(f){return f.stopPropagation()}function Zt(f){const e=oe.c(23),{count:n,total:p,canManage:l,canManageAgents:o,onSelectAll:i,onDeselectAll:g,onDelete:h,onAddToAgent:j,onToggleStatus:y,onCancel:N}=f;if(n===0)return null;let b;e[0]!==n?(b=t.jsxs("div",{className:"text-xs text-muted-foreground pr-1 tabular-nums",children:[n," selected"]}),e[0]=n,e[1]=b):b=e[1];let a;e[2]!==n||e[3]!==g||e[4]!==i||e[5]!==p?(a=n<p?t.jsxs(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:i,children:["Select all (",p,")"]}):t.jsx(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:g,children:"Clear selection"}),e[2]=n,e[3]=g,e[4]=i,e[5]=p,e[6]=a):a=e[6];let x;e[7]!==o||e[8]!==j?(x=o&&t.jsxs(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:j,children:[t.jsx(Ge,{size:13}),"Add to Agent"]}),e[7]=o,e[8]=j,e[9]=x):x=e[9];let m;e[10]!==l||e[11]!==h||e[12]!==y?(m=l&&t.jsxs(t.Fragment,{children:[t.jsx(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>y("active"),children:"Enable"}),t.jsx(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>y("inactive"),children:"Disable"}),t.jsxs(U,{variant:"destructive",size:"sm",className:"h-7 text-xs px-2",onClick:h,children:[t.jsx(Qe,{size:13}),"Delete"]})]}),e[10]=l,e[11]=h,e[12]=y,e[13]=m):m=e[13];let v;e[14]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(Je,{size:13}),e[14]=v):v=e[14];let _;e[15]!==N?(_=t.jsx(U,{variant:"ghost",size:"sm",className:"h-7 text-xs px-2",onClick:N,children:v}),e[15]=N,e[16]=_):_=e[16];let D;return e[17]!==b||e[18]!==a||e[19]!==x||e[20]!==m||e[21]!==_?(D=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:[b,a,x,m,_]})}),e[17]=b,e[18]=a,e[19]=x,e[20]=m,e[21]=_,e[22]=D):D=e[22],D}function en(f){const e=oe.c(25),{open:n,onOpenChange:p,agents:l,onConfirm:o}=f,[i,g]=E.useState(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsxs(Ve,{children:[t.jsx(Ee,{children:"Add to Agent"}),t.jsx(Be,{children:"Select an agent to add the selected connections to."})]}),e[0]=h):h=e[0];let j;e[1]!==l||e[2]!==i?(j=l.length===0?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No agents found"}):l.map(D=>t.jsxs("button",{type:"button",onClick:()=>g(D.id),className:de("flex items-center gap-3 w-full rounded-md px-3 py-2 text-left transition-colors",i===D.id?"bg-primary/10 ring-1 ring-primary":"hover:bg-muted/50"),children:[t.jsx(xt,{icon:D.icon,name:D.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:D.title}),D.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:D.description})]})]},D.id)),e[1]=l,e[2]=i,e[3]=j):j=e[3];let y;e[4]!==j?(y=t.jsx("div",{className:"max-h-60 overflow-auto py-2 space-y-1",children:j}),e[4]=j,e[5]=y):y=e[5];let N;e[6]!==p?(N=t.jsx(U,{variant:"outline",onClick:()=>p(!1),children:"Cancel"}),e[6]=p,e[7]=N):N=e[7];const b=!i;let a;e[8]!==o||e[9]!==p||e[10]!==i?(a=()=>{i&&(o(i),p(!1),g(null))},e[8]=o,e[9]=p,e[10]=i,e[11]=a):a=e[11];let x;e[12]!==b||e[13]!==a?(x=t.jsx(U,{disabled:b,onClick:a,children:"Add"}),e[12]=b,e[13]=a,e[14]=x):x=e[14];let m;e[15]!==N||e[16]!==x?(m=t.jsxs(Ke,{children:[N,x]}),e[15]=N,e[16]=x,e[17]=m):m=e[17];let v;e[18]!==y||e[19]!==m?(v=t.jsxs(ze,{className:"sm:max-w-[400px]",children:[h,y,m]}),e[18]=y,e[19]=m,e[20]=v):v=e[20];let _;return e[21]!==p||e[22]!==n||e[23]!==v?(_=t.jsx(Me,{open:n,onOpenChange:p,children:v}),e[21]=p,e[22]=n,e[23]=v,e[24]=_):_=e[24],_}function tn(f){const e=oe.c(20),{open:n,onOpenChange:p,count:l,onConfirm:o}=f,i=l!==1?"s":"";let g;e[0]!==l||e[1]!==i?(g=t.jsxs(Ae,{children:["Delete ",l," connection",i,"?"]}),e[0]=l,e[1]=i,e[2]=g):g=e[2];const h=l!==1?"s":"";let j;e[3]!==h?(j=t.jsxs(we,{children:["This will permanently delete the selected connection",h,". This action cannot be undone."]}),e[3]=h,e[4]=j):j=e[4];let y;e[5]!==g||e[6]!==j?(y=t.jsxs(Te,{children:[g,j]}),e[5]=g,e[6]=j,e[7]=y):y=e[7];let N;e[8]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(Ie,{children:"Cancel"}),e[8]=N):N=e[8];const b=l!==1?"s":"";let a;e[9]!==l||e[10]!==o||e[11]!==b?(a=t.jsxs(Pe,{children:[N,t.jsxs($e,{onClick:o,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:["Delete ",l," connection",b]})]}),e[9]=l,e[10]=o,e[11]=b,e[12]=a):a=e[12];let x;e[13]!==y||e[14]!==a?(x=t.jsxs(Le,{children:[y,a]}),e[13]=y,e[14]=a,e[15]=x):x=e[15];let m;return e[16]!==p||e[17]!==n||e[18]!==x?(m=t.jsx(Oe,{open:n,onOpenChange:p,children:x}),e[16]=p,e[17]=n,e[18]=x,e[19]=m):m=e[19],m}function nn(f){return f._registryId?.includes("community-registry")===!0}function sn(f){const e=oe.c(58),{item:n,canManage:p,allConnections:l,connectedAppNames:o,connectingItemId:i,onNavigateConnected:g,onConnect:h}=f,[j,y]=E.useState(!1),[N,b]=E.useState(null);let a,x;e[0]!==o||e[1]!==n?(a=De(n)??"",x=o.has(a),e[0]=o,e[1]=n,e[2]=a,e[3]=x):(a=e[2],x=e[3]);const m=x,v=n._meta?.["mcp.mesh"],_=v?.friendlyName||v?.friendly_name||n.server?.title||n.title||n.server?.name||n.name||n.id||"",D=n.server?.description||n.description||null;let L;e[4]!==n.server?.icons?.[0]?.src||e[5]!==n.server?.repository?(L=n.server?.icons?.[0]?.src||at(n.server?.repository)||null,e[4]=n.server?.icons?.[0]?.src,e[5]=n.server?.repository,e[6]=L):L=e[6];const O=L;let s;if(e[7]!==l||e[8]!==a){let k;e[10]!==a?(k=se=>se.connection_type!=="VIRTUAL"&&se.app_name===a,e[10]=a,e[11]=k):k=e[11],s=l.filter(k),e[7]=l,e[8]=a,e[9]=s}else s=e[9];const A=s;let F;e[12]!==n?(F=nn(n),e[12]=n,e[13]=F):F=e[13];const M=F;let w,P;e[14]!==A||e[15]!==p||e[16]!==M||e[17]!==m||e[18]!==n||e[19]!==h||e[20]!==g?(w=()=>{if(m){const k=A[0];k&&g(k);return}p&&P()},P=()=>{M?(b("connect"),y(!0)):h(n)},e[14]=A,e[15]=p,e[16]=M,e[17]=m,e[18]=n,e[19]=h,e[20]=g,e[21]=w,e[22]=P):(w=e[21],P=e[22]);let z;e[23]!==n||e[24]!==h||e[25]!==N?(z=()=>{te("connections_community_warning_confirmed",{registry_item_id:n.id}),y(!1),N==="connect"&&h(n),b(null)},e[23]=n,e[24]=h,e[25]=N,e[26]=z):z=e[26];const C=z;let T;e[27]!==D||e[28]!==O||e[29]!==_?(T={title:_,description:D,icon:O},e[27]=D,e[28]=O,e[29]=_,e[30]=T):T=e[30];let G;e[31]===Symbol.for("react.memo_cache_sentinel")?(G=t.jsx(ge,{}),e[31]=G):G=e[31];let H;e[32]!==M||e[33]!==n._sourceIcon?(H=M&&n._sourceIcon&&t.jsx("img",{src:n._sourceIcon,alt:"Community",className:"size-4 rounded-sm object-contain"}),e[32]=M,e[33]=n._sourceIcon,e[34]=H):H=e[34];let X;e[35]!==p||e[36]!==i||e[37]!==P||e[38]!==m||e[39]!==n.id?(X=m?t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}):p&&t.jsx(U,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:i!==null,onClick:k=>{k.stopPropagation(),P()},children:i===n.id?t.jsx(ce,{size:14,className:"animate-spin"}):"Connect"}),e[35]=p,e[36]=i,e[37]=P,e[38]=m,e[39]=n.id,e[40]=X):X=e[40];let c;e[41]!==H||e[42]!==X?(c=t.jsxs("div",{className:"flex items-center gap-2",children:[H,X]}),e[41]=H,e[42]=X,e[43]=c):c=e[43];let S;e[44]!==w||e[45]!==c||e[46]!==T?(S=t.jsx(Ce,{connection:T,fallbackIcon:G,onClick:w,headerActionsAlwaysVisible:!0,headerActions:c}),e[44]=w,e[45]=c,e[46]=T,e[47]=S):S=e[47];let V;e[48]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsxs(Te,{children:[t.jsx(Ae,{children:"Community MCP Server"}),t.jsx(we,{children:"This MCP server is from the Community MCP Registry and is not maintained or verified by Deco. Community servers may have varying levels of quality, security, and reliability. Proceed with caution and review the server details before connecting."})]}),e[48]=V):V=e[48];let R;e[49]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx(Ie,{children:"Cancel"}),e[49]=R):R=e[49];let B;e[50]!==C?(B=t.jsxs(Le,{children:[V,t.jsxs(Pe,{children:[R,t.jsx($e,{onClick:C,children:"Continue"})]})]}),e[50]=C,e[51]=B):B=e[51];let u;e[52]!==j||e[53]!==B?(u=t.jsx(Oe,{open:j,onOpenChange:y,children:B}),e[52]=j,e[53]=B,e[54]=u):u=e[54];let $;return e[55]!==S||e[56]!==u?($=t.jsxs(t.Fragment,{children:[S,u]}),e[55]=S,e[56]=u,e[57]=$):$=e[57],$}function on({listState:f,activeTab:e,typeFilter:n,statusFilter:p,registryFilter:l,enabledRegistries:o}){const{org:i}=be(),g=it(),h=_e(),{data:j}=Ne.useSession(),y=We(),N=Lt(f),b=ft(),{granted:a}=ye("connections:manage"),{granted:x}=ye("agents:manage"),[m,v]=E.useState(new Set),_=m.size>0,[D,L]=E.useState(!1),[O,s]=E.useState(!1),[A,F]=E.useState(null),M=Ot(),w=N.filter(r=>!(n!=="ALL"&&r.connection_type!==n||p!=="ALL"&&r.status!==p)),P=ht(w),z=r=>{v(d=>{const K=new Set(d);return K.has(r)?K.delete(r):K.add(r),K})},C=()=>{v(new Set)},T=ke(o,f.searchTerm),G=T.items,H=yt(T.loadMore,T.hasMore,T.isLoadingMore),X=new Set(N.filter(r=>r.app_name).map(r=>r.app_name)),c=l==="ALL"||o.some(r=>r.id===l)?l:"ALL",S=f.search.length>0,V=e==="all"||S?G.filter(r=>{if(c!=="ALL"&&r._registryId!==c)return!1;if(S){const d=De(r);if(d&&X.has(d))return!1}return!0}):[],R=e==="connected"||S?P:[],B=async r=>{if(!(!i||!j?.user?.id)){te("connection_add_clicked",{action:"connect_new",registry_item_id:r.id,source:"connections_page"}),F(r.id);try{const d=ct(r,i.id,j.user.id,{remoteIndex:0}),K=d.connection_type==="STDIO",I=!!d.connection_url,q=K&&d.connection_headers&&typeof d.connection_headers=="object"&&"command"in d.connection_headers;if(!I&&!q){W.error("This MCP Server cannot be connected: no connection method available"),F(null);return}const{id:ne}=await y.create.mutateAsync(d),le=await Wt({connectionId:ne,orgId:i.id,orgSlug:i.slug,persistFallback:fe=>y.update.mutateAsync({id:ne,data:{connection_token:fe}}).then(()=>{})});if(le.ran&&!le.ok){te("connection_oauth_failed",{connection_id:ne,flow:"connections_page_connect",error:le.error??"no_token"}),W.error(`Authentication failed: ${le.error??"no token received"}`);return}if(le.ran){te("connection_oauth_succeeded",{connection_id:ne,flow:"connections_page_connect"});const fe=new URL(`/api/${i.slug}/mcp/${ne}`,window.location.origin);await g.invalidateQueries({queryKey:rt.isMCPAuthenticated(fe.href,null)}),$(),W.success("Authentication successful")}W.success("Connected successfully")}catch(d){W.error(`Failed to connect: ${d instanceof Error?d.message:String(d)}`)}finally{F(null)}}},u=Ft(),$=()=>{g.invalidateQueries({predicate:r=>{const d=r.queryKey;return d[1]===i.id&&d[3]==="collection"&&d[4]==="CONNECTIONS"}})},k=async()=>{L(!1);const r=[...m];te("connections_bulk_delete",{count:r.length});let d=0;for(const K of r)try{await u.call("COLLECTION_CONNECTIONS_DELETE",{id:K,force:!0}),d++}catch{}$(),W.success(`Deleted ${d} connection${d!==1?"s":""}`),C()},se=async(r,d)=>{try{await y.update.mutateAsync({id:r,data:{status:d}}),$(),W.success(d==="active"?"Connection enabled":"Connection disabled")}catch{W.error("Failed to update connection")}},xe=async r=>{const d=[...m];te("connections_bulk_status_toggled",{count:d.length,to_status:r});let K=0;for(const I of d)try{await y.update.mutateAsync({id:I,data:{status:r}}),K++}catch{}$(),W.success(`${r==="active"?"Enabled":"Disabled"} ${K} connection${K!==1?"s":""}`),C()},me=async r=>{const d=M.find(q=>q.id===r);if(!d)return;te("connections_bulk_add_to_agent",{agent_id:r,count:m.size});const K=new Set(d.connections.map(q=>q.connection_id)),I=[...m].filter(q=>!K.has(q)).map(q=>({connection_id:q,selected_tools:null,selected_resources:null,selected_prompts:null}));if(I.length===0){W.info("All selected connections are already in that agent");return}try{await u.call("COLLECTION_VIRTUAL_MCP_UPDATE",{id:r,data:{connections:[...d.connections,...I]}}),g.invalidateQueries({predicate:q=>{const ne=q.queryKey;return ne[1]===i.id&&ne[3]==="collection"&&ne[4]==="VIRTUAL_MCP"}}),W.success(`Added ${I.length} connection${I.length!==1?"s":""} to "${d.title}"`),C()}catch{W.error("Failed to add connections to agent")}};return t.jsxs(t.Fragment,{children:[t.jsx(jt,{...b}),t.jsx(tn,{open:D,onOpenChange:L,count:m.size,onConfirm:k}),t.jsx(en,{open:O,onOpenChange:s,agents:M,onConfirm:me}),T.isInitialLoading&&e==="all"?t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ce,{size:32,className:"animate-spin text-muted-foreground"})}):t.jsx("div",{children:(S?V.length===0&&w.length===0:e==="all"?V.length===0:w.length===0)?t.jsx(gt,{image:t.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:"No Connections found",description:f.search?`No Connections match "${f.search}"`:a?"Create a connection to get started.":"Ask an organization admin to add one."}):t.jsxs("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:[R.map(r=>{if(r.type==="group")return t.jsx(Qt,{group:r,onOpen:()=>{h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:r.key}})},selectionMode:_,selectedIds:m,onToggleSelect:z},r.key);const d=r.connection,K=m.has(d.id);return t.jsx(Ce,{connection:d,fallbackIcon:t.jsx(ge,{}),onClick:()=>_?z(d.id):h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:he(d)}}),className:de(K&&"ring-2 ring-primary bg-primary/5"),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1",children:[_?t.jsx(Fe,{checked:K,onCheckedChange:()=>z(d.id),onClick:I=>I.stopPropagation()}):t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsx("div",{className:de("overflow-hidden transition-all duration-150 ease-out",_?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100"),children:t.jsxs(Ue,{children:[t.jsx(Re,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:I=>I.stopPropagation(),children:t.jsx(Xe,{size:20})})}),t.jsxs(He,{align:"end",onClick:I=>I.stopPropagation(),children:[t.jsxs(re,{onClick:I=>{I.stopPropagation(),h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:he(d)}})},children:[t.jsx(qe,{size:16}),"Open"]}),(a||x)&&t.jsxs(re,{onClick:I=>{I.stopPropagation(),z(d.id)},children:[t.jsx(zt,{size:16}),"Select"]}),a&&(d.status==="active"?t.jsxs(re,{onClick:I=>{I.stopPropagation(),se(d.id,"inactive")},children:[t.jsx(Vt,{size:16}),"Disable"]}):t.jsxs(re,{onClick:I=>{I.stopPropagation(),se(d.id,"active")},children:[t.jsx(Et,{size:16}),"Enable"]})),a&&t.jsxs(re,{variant:"destructive",onClick:I=>{I.stopPropagation(),b.requestDelete(d)},children:[t.jsx(Qe,{size:16}),"Delete"]})]})]})})]})},d.id)}),V.map(r=>t.jsx(sn,{item:r,canManage:a,allConnections:N,connectedAppNames:X,connectingItemId:A,onNavigateConnected:d=>h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:he(d)}}),onConnect:B},`catalog-${r._registryId}:${r.id}`)),(e==="all"||S)&&o.length>0&&t.jsx("div",{ref:H,className:"col-span-full h-4"}),(e==="all"||S)&&T.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(ce,{size:24,className:"animate-spin text-muted-foreground"})})]})}),_&&t.jsx(Zt,{count:m.size,total:w.length,canManage:a,canManageAgents:x,onSelectAll:()=>{v(new Set(w.map(r=>r.id)))},onDeselectAll:()=>v(new Set),onDelete:()=>L(!0),onAddToAgent:()=>s(!0),onToggleStatus:xe,onCancel:C})]})}function rn(){const{org:f}=be(),e=_e(),n=Ze({strict:!1}),{data:p}=Ne.useSession(),{stdioEnabled:l}=et(),o=At(),{granted:i}=ye("connections:manage"),g=Gt({namespace:f.slug,resource:"connections"}),h=We(),[j,y]=tt(nt.connectionsTab(f.slug),c=>n.tab==="all"||n.tab==="connected"?n.tab:c??"all"),[N,b]=E.useState("ALL"),[a,x]=E.useState("ALL"),[m,v]=E.useState("ALL"),_=pt(),L=ke(_,g.searchTerm).items,O=g.search!==g.searchTerm,s=st({resolver:ot(Kt),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),A=s.watch("ui_type"),F=s.watch("connection_url"),M=s.watch("npx_package"),w=pe({uiType:A,connectionUrl:F??"",npxPackage:M??""})??Se({uiType:A,connectionUrl:F??"",registryItems:L}),P=i&&n.action==="create",z=()=>{te("connections_custom_dialog_opened",{source:"connections_page"}),e({to:"/$org/settings/connections",params:{org:f.slug},search:{action:"create"}})},C=()=>{e({to:"/$org/settings/connections",params:{org:f.slug},search:{}})},T=async c=>{let S,V=null,R=null,B=null;c.ui_type==="NPX"?(S="STDIO",V="",B=Rt(c.npx_package||"",c.env_vars||[])):c.ui_type==="STDIO"?(S="STDIO",V="",B=Ht(c.stdio_command||"",c.stdio_args||"",c.stdio_cwd,c.env_vars||[])):(S=c.ui_type,V=c.connection_url||"",R=c.connection_token||null);const u=lt("conn");te("connection_custom_created",{connection_type:S,ui_type:c.ui_type}),await h.create.mutateAsync({id:u,title:c.title,description:c.description||null,connection_type:S,connection_url:V,connection_token:R,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:p?.user?.id||"system",organization_id:f.id,icon:c.icon??null,app_name:null,app_id:null,connection_headers:B,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),C(),s.reset(),e({to:"/$org/settings/connections/$appSlug",params:{org:f.slug,appSlug:he({app_name:null,connection_url:V,title:c.title,id:u})}})},G=c=>{c||(P&&C(),s.reset())},H=c=>{const S=c.trim();if(!S)return;const V=!!s.formState.dirtyFields.title,R=!!s.formState.dirtyFields.description,B=!!s.formState.dirtyFields.env_vars,u=k=>{if(k&&(!V&&!s.getValues("title").trim()&&k.title&&s.setValue("title",k.title,{shouldDirty:!1}),!R&&!(s.getValues("description")??"").trim()&&k.description&&s.setValue("description",k.description,{shouldDirty:!1}),!B&&k.envVarKeys?.length)){const se=s.getValues("env_vars")??[],xe=new Set(se.map(r=>r.key)),me=k.envVarKeys.filter(r=>!xe.has(r));me.length>0&&s.setValue("env_vars",[...se,...me.map(r=>({key:r,value:""}))],{shouldDirty:!0})}},$=Ut(S);if($&&l){s.setValue("ui_type","NPX",{shouldDirty:!0}),s.setValue("npx_package",$.packageName,{shouldDirty:!0}),s.setValue("connection_url","",{shouldDirty:!0}),s.setValue("connection_token",null,{shouldDirty:!0}),u(pe({uiType:"NPX",npxPackage:$.packageName}));return}if(S.startsWith("http://")||S.startsWith("https://")){const k=A==="HTTP"||A==="SSE"||A==="Websocket"?A:"HTTP";s.setValue("ui_type",k,{shouldDirty:!0}),s.setValue("connection_url",S,{shouldDirty:!0}),u(pe({uiType:k,connectionUrl:S})??Se({uiType:k,connectionUrl:S,registryItems:L}));return}A==="NPX"&&u(pe({uiType:"NPX",npxPackage:S}))},X=i?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(U,{variant:"outline",onClick:z,children:[t.jsx(Ge,{size:14,className:"sm:hidden"}),t.jsx("span",{className:"hidden sm:inline",children:"Custom Connection"})]})}):null;return t.jsx(t.Fragment,{children:t.jsxs(ue,{children:[(()=>{const c="Create Connection",S="Create a custom connection in your organization. Fill in the details below.",V=s.formState.isSubmitting?"Saving...":"Create Connection",R=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(Q,{control:s.control,name:"ui_type",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Type *"}),t.jsxs(wt,{value:u.value,onValueChange:u.onChange,children:[t.jsx(Z,{children:t.jsx(Tt,{children:t.jsx(It,{})})}),t.jsxs(Pt,{children:[t.jsx(ae,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(je,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(ae,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(je,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(ae,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(je,{className:"w-4 h-4"}),"Websocket"]})}),l&&t.jsxs(t.Fragment,{children:[t.jsx(ae,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ge,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(ae,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Mt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(ee,{})]})}),A==="NPX"&&t.jsx(Q,{control:s.control,name:"npx_package",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"NPM Package *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"@perplexity-ai/mcp-server",...u,value:u.value??"",onPaste:$=>{const k=$.clipboardData.getData("text");k&&($.preventDefault(),s.setValue("npx_package",k.trim(),{shouldDirty:!0}),H(k))},onBlur:$=>{H($.target.value),u.onBlur()}})}),t.jsx(ee,{})]})}),A==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(Q,{control:s.control,name:"stdio_command",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Command *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"node, bun, python...",...u,value:u.value??""})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:s.control,name:"stdio_args",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Arguments"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"arg1 arg2 --flag value",...u,value:u.value??""})}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:s.control,name:"stdio_cwd",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Working Directory"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"/path/to/project (optional)",...u,value:u.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),t.jsx(ee,{})]})})]}),(A==="NPX"||A==="STDIO")&&t.jsx(Q,{control:s.control,name:"env_vars",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Environment Variables"}),t.jsx(Z,{children:t.jsx(Bt,{value:u.value??[],onChange:u.onChange})}),t.jsx(ee,{})]})}),A!=="NPX"&&A!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{control:s.control,name:"connection_url",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"URL *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"https://example.com/mcp",...u,value:u.value??"",onPaste:$=>{const k=$.clipboardData.getData("text");k&&($.preventDefault(),s.setValue("connection_url",k.trim(),{shouldDirty:!0}),H(k))},onBlur:$=>{H($.target.value),u.onBlur()}})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:s.control,name:"connection_token",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:w?.token?.label??"Token (optional)"}),t.jsx(Z,{children:t.jsx(ie,{type:"password",placeholder:w?.token?.placeholder??"Bearer token or API key",...u,value:u.value??""})}),w?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[w.token.helperText,w.id==="github"&&t.jsxs(t.Fragment,{children:[" ","·"," ",t.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:s.control,name:"title",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Name *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"My Connection",...u})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:s.control,name:"description",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Description"}),t.jsx(Z,{children:t.jsx($t,{placeholder:"A brief description of this connection",rows:3,...u,value:u.value??""})}),t.jsx(ee,{})]})})]}),B=P;return o?t.jsx(vt,{open:B,onOpenChange:G,children:t.jsxs(St,{className:"max-h-[90vh]",children:[t.jsx(bt,{className:"pb-2",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx(_t,{children:c}),t.jsx(Nt,{className:"mt-1",children:S})]}),t.jsx(Dt,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(Je,{size:16})})})]})}),t.jsx(ve,{...s,children:t.jsxs("form",{onSubmit:s.handleSubmit(T),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:R}),t.jsx(kt,{children:t.jsx(U,{type:"submit",disabled:s.formState.isSubmitting,className:"w-full",children:V})})]})})]})}):t.jsx(Me,{open:B,onOpenChange:G,children:t.jsxs(ze,{className:"sm:max-w-[525px]",children:[t.jsxs(Ve,{children:[t.jsx(Ee,{children:c}),t.jsx(Be,{children:S})]}),t.jsx(ve,{...s,children:t.jsxs("form",{onSubmit:s.handleSubmit(T),children:[t.jsx("div",{className:"py-4",children:R}),t.jsxs(Ke,{children:[t.jsx(U,{type:"button",variant:"outline",onClick:()=>G(!1),children:"Cancel"}),t.jsx(U,{type:"submit",disabled:s.formState.isSubmitting,className:"min-w-40",children:V})]})]})})]})})})(),t.jsx(ue.Content,{children:t.jsx(ue.Body,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(ue.Title,{children:"Connections"}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(mt,{value:g.search,onChange:g.setSearch,placeholder:"Search for a connection",className:"w-full md:w-[375px]",onKeyDown:c=>{c.key==="Escape"&&(g.setSearch(""),c.target.blur())}}),t.jsx(dt,{sortKey:g.sortKey,sortDirection:g.sortDirection,onSort:g.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:N,onChange:c=>b(c||"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:a,onChange:c=>x(c||"ALL"),options:[{id:"ALL",label:"All"},{id:"active",label:"Active"},{id:"inactive",label:"Inactive"},{id:"error",label:"Error"}]},..._.length>1?[{label:"Registry",value:m,onChange:c=>v(c||"ALL"),options:[{id:"ALL",label:"All registries"},..._.map(c=>({id:c.id,label:c.id.includes("community-registry")?"Community MCP Registry":c.title}))]}]:[]]})]}),X]}),t.jsx(ut,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:j,onTabChange:c=>{const S=c;S!==j&&te("connections_page_tab_changed",{to_tab:S}),y(S)}}),t.jsx(E.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ce,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx("div",{style:{opacity:O?.5:1,transition:O?"opacity 0.2s 0.2s linear":"opacity 0s 0s linear",pointerEvents:O?"none":"auto"},children:t.jsx(on,{listState:g,activeTab:j,typeFilter:N,statusFilter:a,registryFilter:m,enabledRegistries:_})})})]})})})]})})}function Fs(){const f=oe.c(1);let e;return f[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ye,{children:t.jsx(E.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ce,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(rn,{})})}),f[0]=e):e=f[0],e}export{Fs as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as L,j as t,v as Q,a as te,m as W,r as A,a4 as B,i as F,d as ne,t as z,K as V,k as se,l as K,a5 as oe,ae as re}from"./index-V_z4g85O.js";import{D as ie,a as ae,c as le,d as ce}from"./dialog-DC6TTwSU.js";import{C as J}from"./checkbox-BkY2CRaN.js";import{C as ue}from"./collection-search-IIs4O29o.js";import{b as de,u as me}from"./use-connection-DY54rYyd.js";import{W as fe,u as H,S as X}from"./use-mcp-client-DsIzdxc1.js";import{i as Z}from"./Settings02-Gfe6bidH.js";import{v as pe}from"./agent-icon-Dwg5FgWW.js";import{a as ge}from"./authenticate-and-persist-oauth-BELZfB_M.js";import{u as xe}from"./use-mcp-tools-BAGnYViX.js";import{e as he}from"./extract-connection-data-D0kn1CiV.js";import{m as be}from"./use-navigate-to-agent-BzP0osS7.js";function U(s){const e=L.c(4),{size:n,className:o}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"}),e[0]=c):c=e[0];let a;return e[1]!==o||e[2]!==n?(a=t.jsx("svg",{width:n,height:n,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:o,children:c}),e[1]=o,e[2]=n,e[3]=a):a=e[3],a}function ye(s,e){const n=L.c(12),{org:o}=Q();let c;n[0]!==o.id?(c=fe.REGISTRY(o.id),n[0]=o.id,n[1]=c):c=n[1];const a=c;let r;n[2]!==o.id||n[3]!==o.slug||n[4]!==a?(r={connectionId:a,orgId:o.id,orgSlug:o.slug},n[2]=o.id,n[3]=o.slug,n[4]=a,n[5]=r):r=n[5];const m=H(r);let f;n[6]!==s?(f={name:s},n[6]=s,n[7]=f):f=n[7];const i=e?.enabled??!0;let h;return n[8]!==m||n[9]!==f||n[10]!==i?(h={client:m,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:f,enabled:i,staleTime:3e5,select:we},n[8]=m,n[9]=f,n[10]=i,n[11]=h):h=n[11],xe(h)}function we(s){return s.structuredContent?.item??null}const Ne="deco/mcp-github";function Ie(s){const{org:e}=Q(),{data:n}=te.useSession(),o=de(),c=W(),[a,r]=A.useState("idle"),[m,f]=A.useState(null),[i,h]=A.useState(null),{data:x,isLoading:l}=ye(Ne,{enabled:s.enabled}),w=A.useRef(!1);s.enabled&&x&&!l&&!w.current&&n?.user?.id&&a==="idle"&&(w.current=!0,y());async function y(){if(!(!x||!n?.user?.id||!e))try{r("installing"),f(null);const b=he(x,e.id,n.user.id,{remoteIndex:0});if(!b.connection_url)throw new Error("Registry item is missing a remote URL for mcp-github");const{id:S}=await o.create.mutateAsync(b);r("authenticating");const p=await ge({connectionId:S,orgId:e.id,orgSlug:e.slug,persistFallback:d=>o.update.mutateAsync({id:S,data:{connection_token:d}}).then(()=>{})});if(p.ran&&!p.ok){try{await o.delete.mutateAsync(S)}catch{}throw new Error(p.error&&p.error!=="no token received"?p.error:"No token received from GitHub")}B(c,e.id),h(b),r("ready")}catch(b){f(b instanceof Error?b.message:String(b)),r("error")}}function N(){r("idle"),f(null),h(null),w.current=!1}return s.enabled&&l&&a==="idle"?{status:"installing",error:null,connection:null,retry:N}:{status:a,error:m,connection:i,retry:N}}const M={contents:"write",metadata:"read",pull_requests:"write",issues:"write"};function Se(s){if(!s||typeof s!="object"||Array.isArray(s))return M;const e=s;return Object.values(e).some(n=>typeof n!="string")?M:e}function je(s){if(!(typeof s!="number"||!Number.isFinite(s)||!Number.isInteger(s)||s<=0))return s}function Ce(s){const e=s.metadata?.repoScope;if(!e||typeof e.installationId!="number"||!Number.isFinite(e.installationId)||!Number.isInteger(e.installationId)||e.installationId<=0||typeof e.owner!="string"||typeof e.repo!="string"||e.owner.length===0||e.repo.length===0)return null;const n=je(e.repositoryId);return{sourceConnectionId:typeof e.sourceConnectionId=="string"?e.sourceConnectionId:void 0,installationId:e.installationId,repositoryId:n,owner:e.owner,repo:e.repo,permissions:Se(e.permissions),grantProvider:e.grantProvider==="github-mcp"?"github-mcp":void 0}}function ve(s){return(s??[]).filter(e=>Ce(e)===null)}async function Ee(s,e){const o=(await s({name:"GITHUB_LIST_USER_ORGS",arguments:{connectionId:e}})).content?.[0]?.text;if(!o)throw new Error("No response from GITHUB_LIST_USER_ORGS");try{return JSON.parse(o)}catch{throw new Error("Invalid response from GITHUB_LIST_USER_ORGS")}}function We(s,e){const n=e.toLowerCase();return s.find(o=>o.login.toLowerCase()===n)}const Y="GitHub MCP did not return refreshable repo grant metadata";function $(s){if(typeof s!="string")return null;const e=s.trim();return e.length>0?e:null}function Te(s){try{const e=new URL(s);return(e.protocol==="http:"||e.protocol==="https:")&&!e.username&&!e.password}catch{return!1}}function _e(s){return typeof s=="number"&&Number.isFinite(s)&&Number.isInteger(s)&&s>0?s:void 0}async function ke(s){const{orgSlug:e,sourceConnection:n,installationId:o,owner:c,repo:a,githubCallTool:r,selfCallTool:m}=s,f=await r({name:"MINT_REPO_TOKEN",arguments:{installationId:o,owner:c,repo:a,permissions:M}}),i=f.structuredContent;if(f.isError||!i?.token){const T=f.content?.find(v=>v.type==="text")?.text;throw new Error(T?`Failed to mint a repo-scoped GitHub token: ${T}`:"Failed to mint a repo-scoped GitHub token")}const h=$(i.refreshToken),x=$(i.tokenEndpoint),l=$(i.clientId);if(!h||!x||!l)throw new Error(Y);if(!Te(x))throw new Error(Y);const w=$(i.repository?.owner),y=$(i.repository?.name),N="GitHub MCP returned refresh metadata for a different repository";if(i.repository?.owner!==void 0&&(!w||w.toLowerCase()!==c.toLowerCase()))throw new Error(N);if(i.repository?.name!==void 0&&(!y||y.toLowerCase()!==a.toLowerCase()))throw new Error(N);const b=_e(i.repository?.id),I=i.expiresAt?Date.parse(i.expiresAt):NaN,S=Number.isFinite(I)?Math.max(0,Math.floor((I-Date.now())/1e3)):null,d=(typeof i.expiresIn=="number"&&Number.isFinite(i.expiresIn)&&Number.isInteger(i.expiresIn)&&i.expiresIn>0?i.expiresIn:null)??S,j=await m({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:{title:`GitHub: ${c}/${a}`,description:`Repo-scoped GitHub access for ${c}/${a}`,icon:n.icon,app_name:n.app_name,app_id:n.app_id,connection_type:n.connection_type,connection_url:n.connection_url,metadata:{repoScope:{installationId:o,repositoryId:b,owner:c,repo:a,permissions:M,grantProvider:"github-mcp"}}}}}),g=j.structuredContent??j,C=g.item?.id??g.id;if(!C)throw new Error("Failed to create the repo-scoped GitHub connection");if(!(await fetch(`/api/${e}/connections/${C}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:i.token,refreshToken:h,expiresIn:d,scope:i.scope??null,clientId:l,tokenEndpoint:x})})).ok)throw await m({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:C,force:!0}}).catch(()=>{}),new Error("Failed to persist the repo-scoped token");return{childConnectionId:C}}function Re(s,e){const n=L.c(4),[o,c]=A.useState(s);let a,r;return n[0]!==e||n[1]!==s?(a=()=>{const m=setTimeout(()=>c(s),e);return()=>clearTimeout(m)},r=[s,e],n[0]=e,n[1]=s,n[2]=a,n[3]=r):(a=n[2],r=n[3]),A.useEffect(a,r),o}const D=[{key:"auto-respond-to-issues",triggerType:"github.issues.opened",nameSuffix:"auto-respond to issues",label:"Auto-respond to new issues",defaultEnabled:!0,instructions:({owner:s,name:e})=>`A new GitHub issue has been opened in ${s}/${e}. Read the issue, explore relevant code, create a branch, implement the fix, and open a PR referencing the issue number.`},{key:"review-incoming-prs",triggerType:"github.pull_request.opened",nameSuffix:"review incoming PRs",label:"Review incoming pull requests",defaultEnabled:!0,instructions:({owner:s,name:e})=>`A pull request was opened in ${s}/${e}. Read the diff, summarize what changed, flag risks (security, perf, breaking changes), and leave a review comment.`},{key:"note-merged-prs",triggerType:"github.pull_request.closed",nameSuffix:"note merged/closed PRs",label:"Note merged or closed PRs",defaultEnabled:!1,instructions:({owner:s,name:e})=>`A pull request was closed in ${s}/${e}. If it was merged, update changelog/release notes as appropriate.`}];function Ae(s,e){const n=new Set;if(s.paramsSchema)for(const c of Object.keys(s.paramsSchema))n.add(c);if(Array.isArray(s.params))for(const c of s.params)n.add(c.name);else if(s.params&&typeof s.params=="object")for(const c of Object.keys(s.params))n.add(c);if(n.has("repo"))return{repo:`${e.owner}/${e.name}`};const o={};return n.has("owner")&&(o.owner=e.owner),n.has("name")&&(o.name=e.name),n.has("repository")&&(o.repository=`${e.owner}/${e.name}`),o}async function Oe({githubCallTool:s,selfCallTool:e,virtualMcpId:n,repo:o,connectionId:c,selectedKeys:a}){const r=await s({name:"TRIGGER_LIST",arguments:{}}),m=r.structuredContent??r,f=new Map((m.triggers??[]).map(l=>[l.type,l])),i=D.filter(l=>a.has(l.key)),h=await Promise.allSettled(i.map(async l=>{const w=f.get(l.triggerType);if(!w)throw new Error(`Trigger ${l.triggerType} not exposed`);const y=await e({name:"AUTOMATION_CREATE",arguments:{name:`${o.name}: ${l.nameSuffix}`,virtual_mcp_id:n,messages:l.instructions(o),active:!0}}),N=(y.structuredContent??y).id;if(!N)throw new Error(`AUTOMATION_CREATE returned no id for ${l.key}`);await e({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:N,type:"event",connection_id:c,event_type:l.triggerType,params:Ae(w,o)}})})),x=h.filter(l=>l.status==="rejected").length;return x>0&&console.error("Some GitHub automations failed to set up:",h.filter(l=>l.status==="rejected")),{total:h.length,failed:x}}function Xe(s){const e=L.c(22),{open:n,onOpenChange:o,title:c,hideAutoRespondCheckbox:a,onImportComplete:r}=s,m=c===void 0?"Import from GitHub":c,f=a===void 0?!1:a,[i,h]=A.useState(null);let x;e[0]!==m?(x=t.jsx(ie,{className:"sr-only",children:t.jsx(ae,{children:m})}),e[0]=m,e[1]=x):x=e[1];let l;e[2]!==i||e[3]!==m?(l=t.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3 shrink-0",children:i?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>h(null),className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors shrink-0","aria-label":"Back to accounts",children:t.jsx(Z,{size:16})}),t.jsx("img",{src:i.avatarUrl,alt:i.login,className:"size-5 rounded-full ring-1 ring-border shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:i.login})]}):t.jsxs(t.Fragment,{children:[t.jsx(U,{className:"size-4 text-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:m})]})}),e[2]=i,e[3]=m,e[4]=l):l=e[4];let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(F,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=w):w=e[5];let y;e[6]!==o?(y=()=>o(!1),e[6]=o,e[7]=y):y=e[7];let N;e[8]!==f||e[9]!==r||e[10]!==n||e[11]!==i||e[12]!==y?(N=t.jsx("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:t.jsx(A.Suspense,{fallback:w,children:t.jsx(Ge,{open:n,onComplete:y,selectedInstallation:i,onSelectInstallation:h,hideAutoRespondCheckbox:f,onImportComplete:r})})}),e[8]=f,e[9]=r,e[10]=n,e[11]=i,e[12]=y,e[13]=N):N=e[13];let b;e[14]!==x||e[15]!==l||e[16]!==N?(b=t.jsxs(le,{className:"sm:max-w-[560px] h-[85svh] sm:h-[520px] p-0 gap-0 overflow-hidden flex flex-col",children:[x,l,N]}),e[14]=x,e[15]=l,e[16]=N,e[17]=b):b=e[17];let I;return e[18]!==o||e[19]!==n||e[20]!==b?(I=t.jsx(ce,{open:n,onOpenChange:o,children:b}),e[18]=o,e[19]=n,e[20]=b,e[21]=I):I=e[21],I}function Ge({open:s,onComplete:e,selectedInstallation:n,onSelectInstallation:o,hideAutoRespondCheckbox:c,onImportComplete:a}){const{org:r}=Q(),m=W(),f=be(),[i,h]=A.useState(null),[x,l]=A.useState(!0),[w,y]=A.useState(()=>new Set(D.filter(u=>u.defaultEnabled).map(u=>u.key))),N=D.filter(u=>u.defaultEnabled).map(u=>u.key),b=c?new Set(N):x?w:new Set,I=me({slug:"mcp-github"}),S=ve(I),p=Ie({enabled:s&&S.length===0}),d=S.length===1?S[0]??null:i,j=H({connectionId:d?.id??"",orgId:r.id,orgSlug:r.slug}),g=H({connectionId:X,orgId:r.id,orgSlug:r.slug}),C=async(u,E)=>{try{const G=await j.callTool({name:"get_file_contents",arguments:{owner:u.owner,repo:u.name,path:E}});if(G.isError)return null;const P=G.content?.find(R=>R.type==="resource")?.resource?.text;if(!P)return null;try{const R=JSON.parse(P);return typeof R=="string"?R:JSON.stringify(R)}catch{return P}}catch{return null}},O=(u,E)=>{Promise.all([C(E,"AGENTS.md"),C(E,"CLAUDE.md")]).then(async([k,G])=>{const _=k??G??null;_&&(await g.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:u,data:{metadata:{instructions:_}}}}),B(m,r.id))}).catch(k=>{console.error("GitHub instructions fetch failed:",k)})},T=async({virtualMcpId:u,repo:E,connectionId:k,selectedKeys:G})=>{const{total:_,failed:P}=await Oe({githubCallTool:R=>j.callTool(R),selfCallTool:R=>g.callTool(R),virtualMcpId:u,repo:E,connectionId:k,selectedKeys:G});P>0&&z.warning(`Set up ${_-P}/${_} GitHub automations. Add the rest from the automations view.`)},v=ne({mutationFn:async u=>{if(!d||!n)throw new Error("No GitHub connection or installation");const E=n.installationId,{childConnectionId:k}=await ke({orgSlug:r.slug,sourceConnection:d,installationId:E,owner:u.owner,repo:u.name,githubCallTool:_=>j.callTool(_),selfCallTool:_=>g.callTool(_)});let G=null;try{const _=await g.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:u.name,description:u.description||"Imported from GitHub",pinned:!1,icon:null,metadata:{githubRepo:{owner:u.owner,name:u.name,url:u.url,installationId:E,connectionId:k},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:k}]}}}),P=_.structuredContent??_,R=P.item?.id;if(!P.item||!R)throw new Error("Failed to create the imported agent");return G=R,b.size>0&&await T({virtualMcpId:R,repo:u,connectionId:k,selectedKeys:b}).catch(ee=>{console.error("Failed to set up GitHub automations:",ee),z.warning("Imported repo, but failed to set up GitHub automations. You can add triggers manually from the automations view.")}),{virtualMcpId:R,repo:u,connectionId:k,item:P.item}}catch(_){throw G&&await g.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:G}}).catch(()=>{}),await g.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:k,force:!0}}).catch(()=>{}),_}},onSuccess:({virtualMcpId:u,repo:E,connectionId:k,item:G})=>{if(m.setQueryData(V.collectionItem(g,r.id,"","VIRTUAL_MCP",u),{item:G}),B(m,r.id),O(u,E),a){a({virtualMcpId:u,repo:E,connectionId:k});return}z.success(`Imported ${E.name} from GitHub`),e(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),f(u)},onError:u=>{z.error("Failed to import repo: "+(u instanceof Error?u.message:"Unknown error"))}});return p.status==="installing"||p.status==="authenticating"?t.jsx(q,{status:p.status,error:null,retry:p.retry}):p.status==="error"?t.jsx(q,{status:"error",error:p.error,retry:p.retry}):S.length===0&&p.status==="idle"?t.jsx(q,{status:"installing",error:null,retry:p.retry}):S.length>1&&!d?t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-4 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a connection"})}),S.map(u=>t.jsxs("button",{type:"button",onClick:()=>h(u),className:"flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left",children:[u.icon?t.jsx("img",{src:u.icon,alt:u.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(U,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:u.title})]},u.id))]}):d?n?t.jsx(Le,{connectionId:d.id,orgId:r.id,orgSlug:r.slug,installation:n,onSelectRepo:u=>v.mutate(u),isSaving:v.isPending,autoRespondEnabled:x,onAutoRespondChange:l,selectedAutomationKeys:w,onAutomationKeysChange:y,hideAutoRespondCheckbox:c}):t.jsx(Pe,{connectionId:d.id,orgId:r.id,orgSlug:r.slug,onSelect:o,showBackButton:S.length>1,onBack:()=>h(null)}):null}function Pe(s){const e=L.c(31),{connectionId:n,orgId:o,orgSlug:c,onSelect:a,showBackButton:r,onBack:m}=s;let f;e[0]!==o||e[1]!==c?(f={connectionId:X,orgId:o,orgSlug:c},e[0]=o,e[1]=c,e[2]=f):f=e[2];const i=H(f);let h;e[3]!==n||e[4]!==o?(h=V.githubUserOrgs(o,n),e[3]=n,e[4]=o,e[5]=h):h=e[5];let x;e[6]!==n||e[7]!==i?(x=()=>Ee(g=>i.callTool(g),n),e[6]=n,e[7]=i,e[8]=x):x=e[8];let l;e[9]!==h||e[10]!==x?(l={queryKey:h,queryFn:x},e[9]=h,e[10]=x,e[11]=l):l=e[11];const w=se(l);if(w.isLoading){let g;return e[12]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(F,{size:18,className:"animate-spin text-muted-foreground"})}),e[12]=g):g=e[12],g}if(w.isError){let g;return e[13]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load GitHub accounts"})}),e[13]=g):g=e[13],g}const y=w.data;if(!y)return null;let N;e[14]!==m||e[15]!==r?(N=r&&t.jsx("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 shrink-0",children:t.jsxs("button",{type:"button",onClick:m,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Z,{size:12}),"Change connection"]})}),e[14]=m,e[15]=r,e[16]=N):N=e[16];let b;if(e[17]!==y.installations||e[18]!==a){let g;e[20]!==a?(g=C=>t.jsxs("button",{type:"button",onClick:()=>a(C),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left group",children:[t.jsx("img",{src:C.avatarUrl,alt:C.login,className:"size-7 rounded-full shrink-0 ring-1 ring-border"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium leading-none",children:C.login}),C.type==="User"&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Personal account"})]}),t.jsx("span",{className:"text-xs text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:"Select →"})]},C.installationId),e[20]=a,e[21]=g):g=e[21],b=y.installations.map(g),e[17]=y.installations,e[18]=a,e[19]=b}else b=e[19];let I;e[22]!==b?(I=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]",children:b}),e[22]=b,e[23]=I):I=e[23];const S=y.appSlug?`https://github.com/apps/${y.appSlug}/installations/new`:"https://github.com/settings/installations";let p;e[24]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("span",{className:"underline underline-offset-2",children:"Install the GitHub App"}),e[24]=p):p=e[24];let d;e[25]!==S?(d=t.jsx("div",{className:"px-4 py-3 border-t border-border shrink-0",children:t.jsxs("a",{href:S,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Account not listed?"," ",p]})}),e[25]=S,e[26]=d):d=e[26];let j;return e[27]!==d||e[28]!==N||e[29]!==I?(j=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[N,I,d]}),e[27]=d,e[28]=N,e[29]=I,e[30]=j):j=e[30],j}function Le(s){const e=L.c(27),{connectionId:n,orgId:o,orgSlug:c,installation:a,onSelectRepo:r,isSaving:m,autoRespondEnabled:f,onAutoRespondChange:i,selectedAutomationKeys:h,onAutomationKeysChange:x,hideAutoRespondCheckbox:l}=s,[w,y]=A.useState(""),N=Re(w,300),b=A.useDeferredValue(N),I=w!==b;let S;e[0]!==I||e[1]!==w?(S=t.jsx(ue,{placeholder:"Search repositories...",value:w,onChange:y,isSearching:I}),e[0]=I,e[1]=w,e[2]=S):S=e[2];const p=I?"opacity-40":"opacity-100";let d;e[3]!==p?(d=K("flex-1 overflow-hidden flex flex-col transition-opacity duration-150",p),e[3]=p,e[4]=d):d=e[4];let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(F,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=j):j=e[5];let g;e[6]!==n||e[7]!==b||e[8]!==a||e[9]!==m||e[10]!==r||e[11]!==o||e[12]!==c?(g=t.jsx(A.Suspense,{fallback:j,children:t.jsx($e,{connectionId:n,orgId:o,orgSlug:c,installation:a,query:b,onSelectRepo:r,isSaving:m})}),e[6]=n,e[7]=b,e[8]=a,e[9]=m,e[10]=r,e[11]=o,e[12]=c,e[13]=g):g=e[13];let C;e[14]!==d||e[15]!==g?(C=t.jsx("div",{className:d,children:g}),e[14]=d,e[15]=g,e[16]=C):C=e[16];let O;e[17]!==f||e[18]!==l||e[19]!==i||e[20]!==x||e[21]!==h?(O=!l&&t.jsxs("div",{className:"border-t border-border shrink-0",children:[t.jsxs("label",{className:"flex items-center gap-2 px-4 py-3 cursor-pointer select-none",children:[t.jsx(J,{checked:f,onCheckedChange:v=>i(v===!0)}),t.jsx("span",{className:"text-xs text-foreground",children:"Set up GitHub automations for this repo"})]}),f&&t.jsx("div",{className:"px-4 pb-3 pl-9 flex flex-col gap-1.5",children:D.map(v=>t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[t.jsx(J,{checked:h.has(v.key),onCheckedChange:u=>{const E=new Set(h);u===!0?E.add(v.key):E.delete(v.key),x(E)}}),t.jsx("span",{className:"text-xs text-muted-foreground",children:v.label})]},v.key))})]}),e[17]=f,e[18]=l,e[19]=i,e[20]=x,e[21]=h,e[22]=O):O=e[22];let T;return e[23]!==S||e[24]!==C||e[25]!==O?(T=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[S,C,O]}),e[23]=S,e[24]=C,e[25]=O,e[26]=T):T=e[26],T}function $e(s){const e=L.c(29),{connectionId:n,orgId:o,orgSlug:c,installation:a,query:r,onSelectRepo:m,isSaving:f}=s;let i;e[0]!==n||e[1]!==o||e[2]!==c?(i={connectionId:n,orgId:o,orgSlug:c},e[0]=n,e[1]=o,e[2]=c,e[3]=i):i=e[3];const h=H(i),x=a.type==="User"?"user":"org",l=r?`${x}:${a.login} ${r} in:name`:`${x}:${a.login}`;let w;e[4]!==n||e[5]!==a.login||e[6]!==o||e[7]!==r?(w=V.githubOrgRepos(o,n,a.login,r),e[4]=n,e[5]=a.login,e[6]=o,e[7]=r,e[8]=w):w=e[8];let y;e[9]!==h||e[10]!==l?(y=async p=>{const{signal:d}=p,g=(await h.callTool({name:"search_repositories",arguments:{query:l,page:1,perPage:30}},void 0,{signal:d})).content?.[0]?.text;if(!g)throw new Error("No response from search_repositories");return(JSON.parse(g).items??[]).map(He)},e[9]=h,e[10]=l,e[11]=y):y=e[11];let N;e[12]!==w||e[13]!==y?(N={queryKey:w,queryFn:y},e[12]=w,e[13]=y,e[14]=N):N=e[14];const{data:b}=oe(N);if(b.length===0){let p;e[15]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories found"}),e[15]=p):p=e[15];let d;e[16]!==r?(d=r&&t.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Try a different search term"}),e[16]=r,e[17]=d):d=e[17];let j;return e[18]!==d?(j=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[p,d]}),e[18]=d,e[19]=j):j=e[19],j}let I;if(e[20]!==f||e[21]!==m||e[22]!==b){let p;e[24]!==f||e[25]!==m?(p=d=>t.jsxs("button",{type:"button",onClick:()=>m(d),disabled:f,className:"flex items-start gap-3 px-4 py-3 hover:bg-accent transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx(U,{className:"size-4 text-muted-foreground mt-0.5 shrink-0"}),t.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:t.jsx("span",{className:"text-sm font-medium truncate",children:d.name})}),t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground border border-border rounded px-1.5 py-0.5 shrink-0 leading-none",children:[d.private?t.jsx(re,{size:10}):t.jsx(pe,{size:10}),d.private?"Private":"Public"]})]},d.fullName),e[24]=f,e[25]=m,e[26]=p):p=e[26],I=b.map(p),e[20]=f,e[21]=m,e[22]=b,e[23]=I}else I=e[23];let S;return e[27]!==I?(S=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden flex flex-col [scrollbar-gutter:stable]",children:I}),e[27]=I,e[28]=S):S=e[28],S}function He(s){return{name:s.name,fullName:s.full_name,owner:s.full_name.split("/")[0]??"",url:s.html_url,private:s.private,description:s.description,updatedAt:s.updated_at}}function q(s){const e=L.c(33),{status:n,error:o,retry:c}=s;if(n==="error"){let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("div",{className:"size-10 rounded-full bg-destructive/10 flex items-center justify-center",children:t.jsx(U,{className:"size-5 text-destructive"})}),e[0]=g):g=e[0];let C;e[1]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx("p",{className:"text-sm font-medium",children:"Connection failed"}),e[1]=C):C=e[1];const O=o??"Something went wrong while connecting to GitHub.";let T;e[2]!==O?(T=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[C,t.jsx("p",{className:"text-xs text-muted-foreground max-w-[260px] leading-relaxed",children:O})]}),e[2]=O,e[3]=T):T=e[3];let v;e[4]!==c?(v=t.jsx("button",{type:"button",onClick:c,className:"text-xs font-medium text-foreground border border-border rounded-md px-3 py-1.5 hover:bg-accent transition-colors",children:"Try again"}),e[4]=c,e[5]=v):v=e[5];let u;return e[6]!==T||e[7]!==v?(u=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[g,T,v]}),e[6]=T,e[7]=v,e[8]=u):u=e[8],u}const a=n==="authenticating";let r;e[9]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"size-10 rounded-full bg-muted flex items-center justify-center",children:t.jsx(U,{className:"size-5 text-foreground"})}),e[9]=r):r=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"relative size-10",children:[r,t.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-background flex items-center justify-center",children:t.jsx(F,{size:12,className:"animate-spin text-muted-foreground"})})]}),e[10]=m):m=e[10];const f=a?"Authenticating with GitHub":"Setting up GitHub";let i;e[11]!==f?(i=t.jsx("p",{className:"text-sm font-medium",children:f}),e[11]=f,e[12]=i):i=e[12];const h=a?"Complete the OAuth flow in your browser":"Installing the GitHub connection...";let x;e[13]!==h?(x=t.jsx("p",{className:"text-xs text-muted-foreground",children:h}),e[13]=h,e[14]=x):x=e[14];let l;e[15]!==i||e[16]!==x?(l=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[i,x]}),e[15]=i,e[16]=x,e[17]=l):l=e[17];const w=a?"bg-muted-foreground/30":"bg-foreground animate-pulse";let y;e[18]!==w?(y=K("size-1.5 rounded-full",w),e[18]=w,e[19]=y):y=e[19];let N;e[20]!==y?(N=t.jsx("span",{className:y}),e[20]=y,e[21]=N):N=e[21];const b=a?"bg-foreground animate-pulse":"bg-muted-foreground/30";let I;e[22]!==b?(I=K("size-1.5 rounded-full",b),e[22]=b,e[23]=I):I=e[23];let S;e[24]!==I?(S=t.jsx("span",{className:I}),e[24]=I,e[25]=S):S=e[25];let p;e[26]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}),e[26]=p):p=e[26];let d;e[27]!==N||e[28]!==S?(d=t.jsxs("div",{className:"flex items-center gap-1.5",children:[N,S,p]}),e[27]=N,e[28]=S,e[29]=d):d=e[29];let j;return e[30]!==d||e[31]!==l?(j=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[m,l,d]}),e[30]=d,e[31]=l,e[32]=j):j=e[32],j}export{Xe as G,U as a,We as b,Ee as f,ve as g,ke as p,Ie as u};
|