decocms 4.21.0 → 4.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-DrgnpYmf.js → AlertCircle-hfr9WJXe.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-CEF-CsVj.js → ArrowUpRight-DBXurizV.js} +1 -1
- package/dist/client/assets/Check-DhEV1E4F.js +1 -0
- package/dist/client/assets/{CheckCircle-xbzaC4iQ.js → CheckCircle-CbuPUNoj.js} +1 -1
- package/dist/client/assets/{ChevronDown-DDeoixaJ.js → ChevronDown-BJvvkmIr.js} +1 -1
- package/dist/client/assets/{ChevronRight-Cc93D1fP.js → ChevronRight-BP1EbKKr.js} +1 -1
- package/dist/client/assets/ChevronUp-CVqQKtsY.js +1 -0
- package/dist/client/assets/Circle-BnMDtDeu.js +1 -0
- package/dist/client/assets/Copy01-Cm6DymEJ.js +1 -0
- package/dist/client/assets/DotsVertical-BU3qKzJo.js +1 -0
- package/dist/client/assets/Eye-CtocRVwR.js +1 -0
- package/dist/client/assets/{FilterLines-C174NPGB.js → FilterLines-XaejSF3d.js} +1 -1
- package/dist/client/assets/{Globe01-y8c9C4nH.js → Globe01-CxIEuzOP.js} +1 -1
- package/dist/client/assets/{Globe04-v8yJBvO0.js → Globe04-DZ-Pm9xo.js} +1 -1
- package/dist/client/assets/{HardDrive-vkw_bVtH.js → HardDrive-C2sIA93N.js} +1 -1
- package/dist/client/assets/{Key01-8wUzNiiB.js → Key01-D8bQG_zp.js} +1 -1
- package/dist/client/assets/{LayoutLeft-DFSfhhoN.js → LayoutLeft-C8PdEJOQ.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CPcvHi4V.js → LinkExternal01-D58rAWvm.js} +1 -1
- package/dist/client/assets/List-vf0HKUEp.js +1 -0
- package/dist/client/assets/Loading02-DejqZGnO.js +1 -0
- package/dist/client/assets/{Monitor01-DQ9B5dBT.js → Monitor01-CodDwsVO.js} +1 -1
- package/dist/client/assets/{Palette-BP0gnn-x.js → Palette-CgTelSEQ.js} +1 -1
- package/dist/client/assets/{Play-6woe_bCf.js → Play-Dh4_54hC.js} +1 -1
- package/dist/client/assets/{Plus-sSvDtP2D.js → Plus-DX9uB6jT.js} +1 -1
- package/dist/client/assets/{SearchLg-BHGwQ11F.js → SearchLg-D0ZqoPSb.js} +1 -1
- package/dist/client/assets/{SearchMd-DcwBMfFO.js → SearchMd-DWSBWjan.js} +1 -1
- package/dist/client/assets/{Settings02-B0ZT4yzH.js → Settings02-CZ9vMUyw.js} +1 -1
- package/dist/client/assets/{Shield01-16ivhP9D.js → Shield01-DvUXE0jO.js} +1 -1
- package/dist/client/assets/{Star01-BwzFDtQr.js → Star01-7qhyucrX.js} +1 -1
- package/dist/client/assets/{Stars01-D_GgsBTV.js → Stars01-DN1mvd59.js} +1 -1
- package/dist/client/assets/{Stars02-CgeR-sX4.js → Stars02-CFivD_f8.js} +1 -1
- package/dist/client/assets/{Sun-vVeG2mZ0.js → Sun-CHp4Y1Dq.js} +1 -1
- package/dist/client/assets/SwitchHorizontal01-sG-IqCt6.js +1 -0
- package/dist/client/assets/{Tool01-BUi-a5a2.js → Tool01-DGnLcysQ.js} +1 -1
- package/dist/client/assets/{Trash01-YsCUBRvj.js → Trash01-CAEn55T5.js} +1 -1
- package/dist/client/assets/{Upload01-CTPdQzyc.js → Upload01-DKn5tYXN.js} +1 -1
- package/dist/client/assets/{User01-C4JQrjGt.js → User01-IYcmkjnc.js} +1 -1
- package/dist/client/assets/{Users01-TIl6xBro.js → Users01-0WxprMle.js} +1 -1
- package/dist/client/assets/{Users03-Cw_16vbZ.js → Users03-DHP7OUDR.js} +1 -1
- package/dist/client/assets/{X-CAjmVwOR.js → X-BWG-JTku.js} +1 -1
- package/dist/client/assets/{XCircle-D3nhMqns.js → XCircle-C94QFqN0.js} +1 -1
- package/dist/client/assets/{XClose-B93vthJT.js → XClose-CQikaAXa.js} +1 -1
- package/dist/client/assets/{Zap-8CUqVoBU.js → Zap-DeHaXJHA.js} +1 -1
- package/dist/client/assets/{ZapSquare-BDUSHcAn.js → ZapSquare-DBjTUciD.js} +1 -1
- package/dist/client/assets/{ZoomOut-BN-KB_0J.js → ZoomOut-DltoXGbL.js} +1 -1
- package/dist/client/assets/{access-gate-B6S-WMth.js → access-gate-CaRDuo1w.js} +1 -1
- package/dist/client/assets/{add-section-modal-CQq5kJUo.js → add-section-modal-Dkbb81MA.js} +1 -1
- package/dist/client/assets/agent-capabilities-BBWlBKsQ.js +1 -0
- package/dist/client/assets/agent-icon-CuxkxUe-.js +1 -0
- package/dist/client/assets/agents-list-BiXTIWXs.js +1 -0
- package/dist/client/assets/ai-providers-BQfoPc8M.js +1 -0
- package/dist/client/assets/{alert-BBmFOgXs.js → alert-BU-LVOFa.js} +1 -1
- package/dist/client/assets/{alert-dialog-ClCDLHyi.js → alert-dialog-BLM89Cw2.js} +1 -1
- package/dist/client/assets/app-editor-BxQrAgCs.js +1 -0
- package/dist/client/assets/{auth-CxjVr2Fw.js → auth-By4coGKl.js} +1 -1
- package/dist/client/assets/{auth-catchall-DCUDZpnm.js → auth-catchall-CZA5Hfvu.js} +1 -1
- package/dist/client/assets/{auth-entry-CDU8nxvN.js → auth-entry-HXEUnKNQ.js} +1 -1
- package/dist/client/assets/{auth-split-layout-VRGxSLqT.js → auth-split-layout-X0hXvUdh.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-CZ-MLzKy.js → authenticate-and-persist-oauth-1U_DESs3.js} +1 -1
- package/dist/client/assets/{automation-list-row-B57SiMbH.js → automation-list-row-BMTjAch1.js} +1 -1
- package/dist/client/assets/automation-runs-C8J9he9y.js +1 -0
- package/dist/client/assets/automations-CJ9i_c9k.js +1 -0
- package/dist/client/assets/{avatar-BAkTMYHj.js → avatar-BeEkEhV9.js} +1 -1
- package/dist/client/assets/{badge-CxIGH9s7.js → badge-EC_FS1hJ.js} +1 -1
- package/dist/client/assets/{block-document-sOmo01vI.js → block-document-zDNpXx1K.js} +1 -1
- package/dist/client/assets/{brand-context-rYfc__eE.js → brand-context-BkgDlw8b.js} +1 -1
- package/dist/client/assets/{breadcrumb-WlMbFTff.js → breadcrumb-UZDdQrwI.js} +1 -1
- package/dist/client/assets/buckets-8plr1d-P.js +1 -0
- package/dist/client/assets/bulk-category-panel-76hRbL0c.js +1 -0
- package/dist/client/assets/{capability-load-error-Bj6xKhKF.js → capability-load-error-6mU8gg9S.js} +1 -1
- package/dist/client/assets/{card-9jdGQNnr.js → card-Cd_UT82w.js} +1 -1
- package/dist/client/assets/category-editor-CAmRTXwv.js +1 -0
- package/dist/client/assets/{chat-context-OmrHZlWm.js → chat-context-BEYxfvRE.js} +5 -5
- package/dist/client/assets/checkbox-B7ovMLyf.js +1 -0
- package/dist/client/assets/{cli-auth-success-CkMPwuV_.js → cli-auth-success-LMcjXaku.js} +1 -1
- package/dist/client/assets/collection-detail-D-KxR4bK.js +1 -0
- package/dist/client/assets/collection-display-button-DmoD5b6J.js +1 -0
- package/dist/client/assets/{collection-search-BHP0uS8b.js → collection-search-_ltIvUcU.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DeKnxXxy.js → collection-table-wrapper-Cz2kpo8j.js} +1 -1
- package/dist/client/assets/{collection-tabs-CvLerKx4.js → collection-tabs-ByJ2lCEV.js} +1 -1
- package/dist/client/assets/{command-D9kK6qBS.js → command-D8TSS276.js} +1 -1
- package/dist/client/assets/commerce-onboarding-BlroNemj.js +1 -0
- package/dist/client/assets/connect-desktop-dialog-D4NpUtWr.js +1 -0
- package/dist/client/assets/connection-card-COLJGGyb.js +1 -0
- package/dist/client/assets/connection-detail-IEtqvqDx.js +1 -0
- package/dist/client/assets/{connection-form-helpers-oKSRt7Z9.js → connection-form-helpers-Bx2EyqE0.js} +1 -1
- package/dist/client/assets/connections-CtMf6Y72.js +1 -0
- package/dist/client/assets/constants-C8_Swa4x.js +1 -0
- package/dist/client/assets/{decopilot-xPgbGeJc.js → decopilot-CphvkEuu.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-BdE-V58A.js → decopilot-sse-pool-tveLasMO.js} +1 -1
- package/dist/client/assets/{dialog-D_ieAQTy.js → dialog-1PlbGnxl.js} +1 -1
- package/dist/client/assets/{domain-settings-ByTW2skH.js → domain-settings-C5LwCZzv.js} +1 -1
- package/dist/client/assets/{drawer-BP70Rujn.js → drawer-D7F9J8H1.js} +1 -1
- package/dist/client/assets/dropdown-menu-DgucD0Wn.js +1 -0
- package/dist/client/assets/{empty-state-BS7npFnj.js → empty-state-CKmzL0iR.js} +1 -1
- package/dist/client/assets/extract-connection-data-DXmsDXzN.js +1 -0
- package/dist/client/assets/file-explorer-Dw7VTTo2.js +2 -0
- package/dist/client/assets/{file-type-icon-DALXnNwz.js → file-type-icon-CjQ-i8Tj.js} +1 -1
- package/dist/client/assets/{files-hG4e0Y52.js → files-4PjS2DE6.js} +1 -1
- package/dist/client/assets/{form-DaxgojJl.js → form-DY5CJF6A.js} +1 -1
- package/dist/client/assets/format-time-Cy7tTmZp.js +1 -0
- package/dist/client/assets/general-B1x-jxiu.js +1 -0
- package/dist/client/assets/github-repo-picker-C928_gR2.js +1 -0
- package/dist/client/assets/{hooks-ChlRS_Cr.js → hooks-C98PDXkO.js} +4 -4
- package/dist/client/assets/{index-DpMErrhr.js → index-3pMCJF1F.js} +1 -1
- package/dist/client/assets/{index-DgNLMhiy.js → index-BIvxcsMT.js} +25 -25
- package/dist/client/assets/{index-CvxPzQfb.js → index-BeJ1yeue.js} +1 -1
- package/dist/client/assets/{index-DSNOu07Q.js → index-BhywTD9L.js} +12 -12
- package/dist/client/assets/{index-xZ8IGJ2g.js → index-BnU8c8Ro.js} +2 -2
- package/dist/client/assets/{index-6Q-DcRF4.js → index-CCO5X6vK.js} +1 -1
- package/dist/client/assets/{index-CYTkc5bj.js → index-CXhPz6Na.js} +1 -1
- package/dist/client/assets/index-ChDm4HPz.js +1 -0
- package/dist/client/assets/{index-CrIRvXb3.js → index-Co62zZxD.js} +4 -4
- package/dist/client/assets/index-CveMeMql.css +1 -0
- package/dist/client/assets/{index-7osCyUPH.js → index-D2iM60An.js} +1 -1
- package/dist/client/assets/index-D7F2qNe_.js +1 -0
- package/dist/client/assets/index-DBJUANyT.js +1 -0
- package/dist/client/assets/{index-Bo5LvjuQ.js → index-DPO0Ar5L.js} +6 -6
- package/dist/client/assets/{index-yloThw-p.js → index-Du424YAy.js} +1 -1
- package/dist/client/assets/{index-redirect-TiE2LCg3.js → index-redirect-B-jN-fhS.js} +1 -1
- package/dist/client/assets/{input-CjQtu1h5.js → input-C-5bkxwu.js} +1 -1
- package/dist/client/assets/{integration-icon-DvmR_kCi.js → integration-icon-DWcR_mMd.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-BHrSHQE6.js → invite-member-dialog-c6uPezaw.js} +2 -2
- package/dist/client/assets/{label-CyPUYQaT.js → label-CuPUA6lI.js} +1 -1
- package/dist/client/assets/{library-tab-CrasAutb.js → library-tab-B9PQjg9x.js} +3 -3
- package/dist/client/assets/{login-C4Xj3ZGq.js → login-MwH_nULc.js} +1 -1
- package/dist/client/assets/{mcp-oauth-Cjq6PMkC.js → mcp-oauth-BFb5Mr2N.js} +1 -1
- package/dist/client/assets/members-DMKRSesY.js +1 -0
- package/dist/client/assets/{monaco-editor-kdhsccRw.js → monaco-editor-B_E6MYgL.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-DeKE4QGN.js → monitoring-stats-row-CDUo4bJg.js} +1 -1
- package/dist/client/assets/{oauth-callback-CTt195fk.js → oauth-callback-CpqRc4mk.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-CXZF8sn_.js → oauth-callback-ai-provider-BEZ67TTl.js} +1 -1
- package/dist/client/assets/{onboarding-BgKa_2mX.js → onboarding-DY1XdIjP.js} +1 -1
- package/dist/client/assets/{org-install-CFWrpbg8.js → org-install-_qYii8TY.js} +1 -1
- package/dist/client/assets/{org-layout-B7y5gvzJ.js → org-layout-CH6-dACM.js} +1 -1
- package/dist/client/assets/{organization-choice-LKw28vSy.js → organization-choice-q9IVQdh1.js} +1 -1
- package/dist/client/assets/{page-seo-form-DmWg08s4.js → page-seo-form-Dl3vlbYl.js} +1 -1
- package/dist/client/assets/page-seo-sheet-pnb4BjH1.js +1 -0
- package/dist/client/assets/{popover-Dk6C_xyw.js → popover-BnhIWYgB.js} +1 -1
- package/dist/client/assets/post-editor-BzHE5onr.js +1 -0
- package/dist/client/assets/{primitives-D3eMc46F.js → primitives-B_yiwpb8.js} +1 -1
- package/dist/client/assets/profile-q_xefMdi.js +1 -0
- package/dist/client/assets/project-app-view-BoTA9-Gv.js +1 -0
- package/dist/client/assets/record-editor-C6Mdc0zg.js +1 -0
- package/dist/client/assets/registry-BRcT-CVu.js +2 -0
- package/dist/client/assets/{registry-layout-BljHeZAP.js → registry-layout-CY97jFJ5.js} +4 -4
- package/dist/client/assets/{require-capability-ByiCIEvf.js → require-capability-B4CjdwjM.js} +1 -1
- package/dist/client/assets/{required-auth-layout-B1_k8uZH.js → required-auth-layout-B14liizk.js} +1 -1
- package/dist/client/assets/{reset-password-14ERSLOr.js → reset-password-xrDJRi-g.js} +1 -1
- package/dist/client/assets/roles-Bjp9hGjL.js +1 -0
- package/dist/client/assets/{scroll-area-DVEw9jTn.js → scroll-area-CiGoarGm.js} +11 -11
- package/dist/client/assets/{search-input-Cw7dukB_.js → search-input-CmJ7IuJz.js} +1 -1
- package/dist/client/assets/secrets-CuAdzo5u.js +1 -0
- package/dist/client/assets/{sections-editor-Bnz1L7UN.js → sections-editor-CDssHvQJ.js} +2 -2
- package/dist/client/assets/select-XC9B8kYb.js +1 -0
- package/dist/client/assets/{select-model-1JGm9WVZ.js → select-model-Bb4qdZ4V.js} +1 -1
- package/dist/client/assets/seo-editor-CBv7uxMZ.js +1 -0
- package/dist/client/assets/{settings-layout-f8IHCdTn.js → settings-layout-D8XYD_1r.js} +1 -1
- package/dist/client/assets/{settings-section-CTfa0pnb.js → settings-section-CZoUIOGy.js} +1 -1
- package/dist/client/assets/{sheet-B3x8ZiS-.js → sheet-DMsXF2a5.js} +1 -1
- package/dist/client/assets/{shell-controls-C4LCUc-y.js → shell-controls-K02mDLgA.js} +1 -1
- package/dist/client/assets/shell-layout-CX1dOlGj.js +1 -0
- package/dist/client/assets/{sidebar-C8N0hRhw.js → sidebar-BxApc71_.js} +1 -1
- package/dist/client/assets/{skeleton-C5L5O22N.js → skeleton-CS6PjKeZ.js} +1 -1
- package/dist/client/assets/sso-DEuC0ilk.js +1 -0
- package/dist/client/assets/store-CW4k1iID.js +1 -0
- package/dist/client/assets/store-registry-C0XIPk1o.js +2 -0
- package/dist/client/assets/{studio-tools-kXfq3pN5.js → studio-tools-DGpKprde.js} +1 -1
- package/dist/client/assets/{switch-BL5aJnqG.js → switch-BofmoE_g.js} +1 -1
- package/dist/client/assets/{table-77ubNeic.js → table-Cbxpe5u6.js} +1 -1
- package/dist/client/assets/{tabs-Dh_kZG_m.js → tabs-mPJyea1e.js} +1 -1
- package/dist/client/assets/task-row-BrC9ZQiv.js +1 -0
- package/dist/client/assets/task-status-MSiVemqS.js +1 -0
- package/dist/client/assets/{textarea-D5nE7rMP.js → textarea-BJ7uXt99.js} +1 -1
- package/dist/client/assets/{toggle-group-oUYd1Jxm.js → toggle-group-CRVZDsng.js} +1 -1
- package/dist/client/assets/{toolbar-BSesNl59.js → toolbar-BIJJ6VS7.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-Da4GFxZS.js → toolbar-icon-button-sU8FyquD.js} +1 -1
- package/dist/client/assets/{tools-list-JC_5uk0t.js → tools-list-D-u8vbQL.js} +1 -1
- package/dist/client/assets/{tooltip-B3h8W9fM.js → tooltip-BGL3A5jy.js} +1 -1
- package/dist/client/assets/{types-H_rr3OSP.js → types-DUULP3Cg.js} +1 -1
- package/dist/client/assets/{use-ai-providers-lTSdzFgc.js → use-ai-providers-CGMLoVgI.js} +1 -1
- package/dist/client/assets/use-automations-eYq1QdPO.js +1 -0
- package/dist/client/assets/{use-capability-Cgr7yHYD.js → use-capability--pStQfW2.js} +1 -1
- package/dist/client/assets/use-clock-tick-CF30qkon.js +1 -0
- package/dist/client/assets/{use-collections-Bb5vIdWQ.js → use-collections-DaNfbX0Q.js} +1 -1
- package/dist/client/assets/use-connection-rw8Y5wYH.js +1 -0
- package/dist/client/assets/{use-copy-ClKjk1Nz.js → use-copy-CLk0PZni.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BcrC97GS.js → use-create-virtual-mcp-B_ygxy0B.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-CEbGGyRe.js → use-debounced-autosave-Chq2pCXJ.js} +1 -1
- package/dist/client/assets/{use-debounced-value-BCxrmAGw.js → use-debounced-value-DarNUEml.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-CkQ3Rugh.js → use-decopilot-events-C4jxMeza.js} +1 -1
- package/dist/client/assets/{use-delete-connection-COjWhEca.js → use-delete-connection-GWWQ0NwP.js} +1 -1
- package/dist/client/assets/{use-file-configs-CxoqQtr4.js → use-file-configs--8K7Ji7z.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-DqqX0EF_.js → use-infinite-scroll-C2oRLreW.js} +1 -1
- package/dist/client/assets/{use-join-requests-BFV1IEGJ.js → use-join-requests-n3oXhO9U.js} +1 -1
- package/dist/client/assets/use-mcp-client-DbN0o_29.js +10 -0
- package/dist/client/assets/{use-mcp-prompts-F7AgPwEV.js → use-mcp-prompts-k9BBdGe-.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-UjXU5ids.js → use-mcp-tools-BaQM5Bz7.js} +1 -1
- package/dist/client/assets/{use-members-B-1xXj0d.js → use-members-CJvmy-r3.js} +1 -1
- package/dist/client/assets/{use-mobile-CTYLPqKT.js → use-mobile-CdswWdV_.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-ZLpx01PW.js → use-navigate-to-agent-yzOIB4ca.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-NLz6RBvg.js → use-org-auth-client-DQwimkN2.js} +1 -1
- package/dist/client/assets/{use-org-sso-nbZu8iS1.js → use-org-sso-DRbO1SYZ.js} +1 -1
- package/dist/client/assets/{use-organization-roles-BEuKNbP8.js → use-organization-roles-CoVa3Svg.js} +1 -1
- package/dist/client/assets/use-organization-settings-B87409No.js +1 -0
- package/dist/client/assets/use-registry-connections-DPvd05bN.js +1 -0
- package/dist/client/assets/{use-secrets-CIN5lIiD.js → use-secrets-BfSDmFK4.js} +1 -1
- package/dist/client/assets/{use-status-sounds-Bl8mPZM3.js → use-status-sounds-DzIbcTbB.js} +1 -1
- package/dist/client/assets/{use-view-mode-DE98MrNw.js → use-view-mode-viB7TTSY.js} +1 -1
- package/dist/client/assets/use-virtual-mcp-st0OLLtk.js +1 -0
- package/dist/client/assets/useInfiniteQuery-Cd0Nyb0J.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-DO0pAzSF.js +1 -0
- package/dist/client/assets/{useSuspenseQueries-g9RVw8Va.js → useSuspenseQueries-_jBEPc9k.js} +1 -1
- package/dist/client/assets/variant-calendar-BaDsfBeS.js +1 -0
- package/dist/client/assets/{view-mode-toggle-B3xxjWBP.js → view-mode-toggle-BekCb9Y2.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +513 -523
- package/dist/server/migrate.js +83 -83
- package/dist/server/server.js +314 -314
- package/package.json +1 -1
- package/dist/client/assets/ChevronUp-C2DYINXH.js +0 -1
- package/dist/client/assets/DotsVertical-CB1RTV9h.js +0 -1
- package/dist/client/assets/Eye-DHiUyPMS.js +0 -1
- package/dist/client/assets/SwitchHorizontal01-DTag6ZGf.js +0 -1
- package/dist/client/assets/agent-capabilities-BLdjNi42.js +0 -1
- package/dist/client/assets/agent-icon-HIFEO6vs.js +0 -1
- package/dist/client/assets/agents-list-YngYFo7C.js +0 -1
- package/dist/client/assets/ai-providers-BbExXFlh.js +0 -1
- package/dist/client/assets/app-editor-dXgIlUYv.js +0 -1
- package/dist/client/assets/automation-runs-LATF_NNh.js +0 -1
- package/dist/client/assets/automations-BBkP1No_.js +0 -1
- package/dist/client/assets/buckets-oHa98Efr.js +0 -1
- package/dist/client/assets/bulk-category-panel-C9FEvCBV.js +0 -1
- package/dist/client/assets/category-editor-Y8aXIh-A.js +0 -1
- package/dist/client/assets/checkbox-DnPlj3-W.js +0 -1
- package/dist/client/assets/collection-detail-C28Se3ZZ.js +0 -1
- package/dist/client/assets/collection-display-button-DOUzSfH_.js +0 -1
- package/dist/client/assets/commerce-onboarding-Dwo4yg2j.js +0 -1
- package/dist/client/assets/connect-desktop-dialog-3SiI_mFd.js +0 -1
- package/dist/client/assets/connection-card-MLfvU4EZ.js +0 -1
- package/dist/client/assets/connection-detail-AC0jwDBB.js +0 -1
- package/dist/client/assets/connections-DNvp-Wd0.js +0 -1
- package/dist/client/assets/dropdown-menu-Ctb60TB7.js +0 -1
- package/dist/client/assets/extract-connection-data-RxV5HgFK.js +0 -1
- package/dist/client/assets/file-explorer-CqV9i4IM.js +0 -2
- package/dist/client/assets/general-mdgztBV6.js +0 -1
- package/dist/client/assets/github-repo-picker-CZI-ClVg.js +0 -1
- package/dist/client/assets/index-B1I1Oi0g.css +0 -1
- package/dist/client/assets/index-BMeJsDzW.js +0 -1
- package/dist/client/assets/index-DoOMda_E.js +0 -1
- package/dist/client/assets/members-C-oUAFwh.js +0 -1
- package/dist/client/assets/page-seo-sheet-Cg02Z-pf.js +0 -1
- package/dist/client/assets/post-editor-DoYb2wDl.js +0 -1
- package/dist/client/assets/profile-D3nqggYc.js +0 -1
- package/dist/client/assets/project-app-view-B9CUuk6-.js +0 -1
- package/dist/client/assets/record-editor-CjPHKje-.js +0 -1
- package/dist/client/assets/registry-8Yn6aIkw.js +0 -2
- package/dist/client/assets/roles-Dk6u6yco.js +0 -1
- package/dist/client/assets/secrets-CswlU-Ba.js +0 -1
- package/dist/client/assets/select-bneCBMXH.js +0 -1
- package/dist/client/assets/seo-editor-D0gZRnH2.js +0 -1
- package/dist/client/assets/shell-layout-CSNtx2tN.js +0 -1
- package/dist/client/assets/sso-CmKVccvq.js +0 -1
- package/dist/client/assets/store-DnZXwM23.js +0 -1
- package/dist/client/assets/store-registry-DzUKthzk.js +0 -2
- package/dist/client/assets/task-row-LdEr6awi.js +0 -1
- package/dist/client/assets/task-status-DNIO7fCq.js +0 -1
- package/dist/client/assets/use-automations-1J-hXDhd.js +0 -1
- package/dist/client/assets/use-clock-tick-D7gbCPid.js +0 -1
- package/dist/client/assets/use-connection-C0zEwTpO.js +0 -1
- package/dist/client/assets/use-mcp-client-C62ZsAPE.js +0 -10
- package/dist/client/assets/use-organization-settings-Dys1xzl0.js +0 -1
- package/dist/client/assets/use-registry-connections-By0sWOC0.js +0 -1
- package/dist/client/assets/use-virtual-mcp-D_g2q7bN.js +0 -1
- package/dist/client/assets/useInfiniteQuery-YzbBhr0w.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-Cgpvcam3.js +0 -1
- package/dist/client/assets/variant-calendar-CHjE3Ibi.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as d,l as i,j as n}from"./index-
|
|
1
|
+
import{c as d,l as i,j as n}from"./index-BIvxcsMT.js";import{_ as m}from"./index-Du424YAy.js";import{e as k,a as N,b as j,c as b,d as w}from"./dialog-1PlbGnxl.js";import{i as y}from"./SearchMd-DWSBWjan.js";function C(a){const e=d.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=i("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==s||e[6]!==o?(l=n.jsx(m,{"data-slot":"command",className:o,...s}),e[5]=s,e[6]=o,e[7]=l):l=e[7],l}function S(a){const e=d.c(24);let t,s,o,l,r;e[0]!==a?({title:l,description:r,children:t,className:s,...o}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o,e[4]=l,e[5]=r):(t=e[1],s=e[2],o=e[3],l=e[4],r=e[5]);const _=l===void 0?"Command Palette":l,v=r===void 0?"Search for a command to run...":r;let c;e[6]!==_?(c=n.jsx(N,{children:_}),e[6]=_,e[7]=c):c=e[7];let p;e[8]!==v?(p=n.jsx(j,{children:v}),e[8]=v,e[9]=p):p=e[9];let u;e[10]!==c||e[11]!==p?(u=n.jsxs(b,{className:"sr-only",children:[c,p]}),e[10]=c,e[11]=p,e[12]=u):u=e[12];let f;e[13]!==s?(f=i("overflow-hidden p-0",s),e[13]=s,e[14]=f):f=e[14];let x;e[15]!==t?(x=n.jsx(C,{className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:t}),e[15]=t,e[16]=x):x=e[16];let g;e[17]!==f||e[18]!==x?(g=n.jsx(w,{className:f,closeButtonClassName:"hidden",children:x}),e[17]=f,e[18]=x,e[19]=g):g=e[19];let h;return e[20]!==o||e[21]!==u||e[22]!==g?(h=n.jsxs(k,{...o,children:[u,g]}),e[20]=o,e[21]=u,e[22]=g,e[23]=h):h=e[23],h}function z(a){const e=d.c(9);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(y,{className:"size-5 shrink-0 text-foreground"}),e[3]=o):o=e[3];let l;e[4]!==t?(l=i("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t),e[4]=t,e[5]=l):l=e[5];let r;return e[6]!==s||e[7]!==l?(r=n.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-10 items-center gap-2 border-b px-3",children:[o,n.jsx(m.Input,{"data-slot":"command-input",className:l,...s})]}),e[6]=s,e[7]=l,e[8]=r):r=e[8],r}function G(a){const e=d.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=i("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==s||e[6]!==o?(l=n.jsx(m.List,{"data-slot":"command-list",className:o,...s}),e[5]=s,e[6]=o,e[7]=l):l=e[7],l}function L(a){const e=d.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=n.jsx(m.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t}),e[2]=t,e[3]=s):s=e[3],s}function R(a){const e=d.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=i("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==s||e[6]!==o?(l=n.jsx(m.Group,{"data-slot":"command-group",className:o,...s}),e[5]=s,e[6]=o,e[7]=l):l=e[7],l}function B(a){const e=d.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=i("bg-border -mx-1 h-px",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==s||e[6]!==o?(l=n.jsx(m.Separator,{"data-slot":"command-separator",className:o,...s}),e[5]=s,e[6]=o,e[7]=l):l=e[7],l}function H(a){const e=d.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=i("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==s||e[6]!==o?(l=n.jsx(m.Item,{"data-slot":"command-item",className:o,...s}),e[5]=s,e[6]=o,e[7]=l):l=e[7],l}export{L as C,H as a,z as b,G as c,C as d,R as e,S as f,B as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as q,r as V,l as oe,j as t,B as H,m as Ce,d as fe,K as Y,o as _e,s as le,n as Se,p as Ne,i as ze,k as be,t as Ae,q as ge,v as ee,Q as st,E as ot,a as ke,u as it,w as Tt,b as rt,x as Ot,y as at,L as At}from"./index-BIvxcsMT.js";import{A as kt}from"./auth-entry-HXEUnKNQ.js";import{A as Rt}from"./auth-split-layout-X0hXvUdh.js";import{O as Ze}from"./organization-choice-q9IVQdh1.js";import{f as Lt}from"./tab-id-CLpu897Q.js";import{I as ye}from"./input-C-5bkxwu.js";import{u as Re}from"./use-mcp-client-DbN0o_29.js";import{W as De,S as lt,g as Pt,C as Ut}from"./constants-C8_Swa4x.js";import{i as ct}from"./XCircle-C94QFqN0.js";import{I as Fe}from"./integration-icon-DWcR_mMd.js";import{D as he,a as dt,b as ut,c as mt,d as ft,e as pt}from"./dialog-1PlbGnxl.js";import{T as gt,a as ht,b as xt}from"./tooltip-BGL3A5jy.js";import{i as Me}from"./CheckCircle-CbuPUNoj.js";import{i as yt,t as bt}from"./agent-icon-CuxkxUe-.js";import{g as $t,c as zt,e as Dt}from"./extract-connection-data-DXmsDXzN.js";import{F as ce,a as Ee,b as de,c as Te,d as ue,e as me,f as Ft}from"./form-DY5CJF6A.js";import{i as Mt}from"./Check-DhEV1E4F.js";import{a as vt}from"./Copy01-Cm6DymEJ.js";import{i as qt}from"./Settings02-CZ9vMUyw.js";import{s as Kt}from"./Eye-CtocRVwR.js";import{u as Vt}from"./use-debounced-value-DarNUEml.js";import{f as Gt}from"./github-installations-DzN1UQ4x.js";import{u as Ht}from"./useSuspenseQueries-_jBEPc9k.js";import{a as Bt}from"./authenticate-and-persist-oauth-1U_DESs3.js";import{i as jt}from"./ArrowUpRight-DBXurizV.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-BeEkEhV9.js";import"./User01-IYcmkjnc.js";import"./auth-By4coGKl.js";import"./X-BWG-JTku.js";import"./AlertCircle-hfr9WJXe.js";import"./Tool01-DGnLcysQ.js";import"./SwitchHorizontal01-sG-IqCt6.js";import"./ZapSquare-DBjTUciD.js";import"./Users03-DHP7OUDR.js";import"./ChevronDown-BJvvkmIr.js";import"./ChevronRight-BP1EbKKr.js";import"./ChevronUp-CVqQKtsY.js";import"./Circle-BnMDtDeu.js";import"./Stars02-CFivD_f8.js";import"./Loading02-DejqZGnO.js";import"./ZoomOut-DltoXGbL.js";import"./DotsVertical-BU3qKzJo.js";import"./Globe01-CxIEuzOP.js";import"./FilterLines-XaejSF3d.js";import"./Star01-7qhyucrX.js";import"./Globe04-DZ-Pm9xo.js";import"./HardDrive-C2sIA93N.js";import"./Key01-D8bQG_zp.js";import"./LayoutLeft-C8PdEJOQ.js";import"./LinkExternal01-D58rAWvm.js";import"./List-vf0HKUEp.js";import"./Monitor01-CodDwsVO.js";import"./Sun-CHp4Y1Dq.js";import"./Palette-CgTelSEQ.js";import"./Play-Dh4_54hC.js";import"./Plus-DX9uB6jT.js";import"./SearchLg-D0ZqoPSb.js";import"./SearchMd-DWSBWjan.js";import"./Shield01-DvUXE0jO.js";import"./Stars01-DN1mvd59.js";import"./Trash01-CAEn55T5.js";import"./Upload01-DKn5tYXN.js";import"./Users01-0WxprMle.js";import"./XClose-CQikaAXa.js";import"./Zap-DeHaXJHA.js";import"./label-CuPUA6lI.js";import"./mcp-oauth-BFb5Mr2N.js";const Qt=/^[a-zA-Z][a-zA-Z\d+.-]*:/,Wt=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,Yt=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,Jt=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function ae(s){const e=s.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const n=Qt.test(e),o=Wt.test(e),i=Yt.test(e);if(n&&!o&&!i)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const a=o?e:`https://${e}`;let r;try{r=new URL(a)}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||!Jt.test(d))?{ok:!1,error:"Enter a valid website URL."}:(r.protocol="https:",{ok:!0,value:r.origin})}function Zt(s,e){if(!s.trim())return!0;const n=ae(s);if(!n.ok||!e)return!1;const o=ae(e);return o.ok&&o.value===n.value}function Ue(s){const e=q.c(14),{children:n,className:o,wrapperClassName:i}=s,[a,r]=V.useState(!0);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=v=>{if(!v)return;const j=()=>{const f=v.scrollHeight-v.scrollTop-v.clientHeight<8;r(f)};j(),v.addEventListener("scroll",j,{passive:!0});const x=new ResizeObserver(j);x.observe(v);for(const f of Array.from(v.children))x.observe(f);return()=>{v.removeEventListener("scroll",j),x.disconnect()}},e[0]=l):l=e[0];const d=l;let u;e[1]!==i?(u=oe("relative",i),e[1]=i,e[2]=u):u=e[2];let c;e[3]!==n||e[4]!==o?(c=t.jsx("div",{ref:d,className:o,children:n}),e[3]=n,e[4]=o,e[5]=c):c=e[5];const p=a?"opacity-0":"opacity-100";let m;e[6]!==p?(m=oe("pointer-events-none absolute inset-x-0 -bottom-px h-[72px]","bg-gradient-to-t from-sidebar from-[6px] to-transparent","backdrop-blur-[1px] [mask-image:linear-gradient(to_top,black_6px,transparent)]","transition-opacity duration-200",p),e[6]=p,e[7]=m):m=e[7];let h;e[8]!==m?(h=t.jsx("div",{"aria-hidden":!0,className:m}),e[8]=m,e[9]=h):h=e[9];let g;return e[10]!==u||e[11]!==c||e[12]!==h?(g=t.jsxs("div",{className:u,children:[c,h]}),e[10]=u,e[11]=c,e[12]=h,e[13]=g):g=e[13],g}function Xt(s){const e=s.properties;if(!e)return[];const n=[];for(const[o,i]of Object.entries(e)){const l=i?.properties?.__type?.const;typeof l=="string"&&l.length>0&&n.push({fieldKey:o,bindingType:l})}return n}function en(s,e){const n=[];if(s.length&&n.push({field:["id"],operator:"in",value:s}),e.length&&n.push({field:["name"],operator:"in",value:e}),n.length!==0)return n.length===1?n[0]:{operator:"or",conditions:n}}function ne(s){const e=s;if(e.isError)throw new Error(e.content?.find(n=>n.text)?.text??"Tool call failed");return e.structuredContent??s}function tn(s,e,n,o){return{...s??{},[e]:{__type:n,value:o}}}function $e(s){return s==null?!1:typeof s=="string"?s.trim().length>0:typeof s=="number"||typeof s=="boolean"?!0:Array.isArray(s)?s.some($e):typeof s=="object"?Object.entries(s).some(([e,n])=>!e.startsWith("__")&&$e(n)):!1}function nn(s){const e={accountName:"Nome da conta",appKey:"App Key",appToken:"App Token",propertyId:"Propriedade",siteUrl:"Site"};return e[s]?e[s]:s.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,n=>n.toUpperCase())}function sn(s){return $e(s)?typeof s=="string"?s.trim():typeof s=="number"||typeof s=="boolean"?String(s):JSON.stringify(s):null}function on(s){return s?Object.entries(s).flatMap(([e,n])=>{if(e.startsWith("__"))return[];const o=sn(n);return o?[{key:e,label:nn(e),value:o}]:[]}):[]}function rn({autoOpenFieldKey:s,card:e}){return s===e.fieldKey&&e.satisfied&&!!e.linkedConnectionId}function an(s,e,n){const o=s.filter(i=>i.app_name===e||!!n&&i.app_id===n);return o.length===0?null:(o.sort((i,a)=>{const r=l=>l.status==="active"?0:1;return r(i)!==r(a)?r(i)-r(a):(a.updated_at??"").localeCompare(i.updated_at??"")}),o[0].id)}function ln(s){return s.server?.icons?.[0]?.src??$t(s.server?.repository)??null}function cn(s,e){const n=s._meta?.["mcp.mesh"];return n?.friendlyName||n?.friendly_name||s.title||s.server?.title||s.server?.name||e}function dn(s){const e=[],n=new Map(s.connections.map(o=>[o.id,o]));for(const o of s.requirements){const i=s.curated[o.bindingType],a=i?s.itemsById[i.registryAppId]:s.itemsByName[o.bindingType];if(!a)continue;const r=s.configurationState?.[o.fieldKey]?.value,l=r?n.get(r):void 0,d=r&&l?r:null,u=d?s.connectionReadiness?.[d]!==!1:!1,c=!!d&&u,p=c?void 0:s.saBindings?.[o.bindingType],m=c||!!p,h=c?"oauth":p?"sa":null;e.push({fieldKey:o.fieldKey,bindingType:o.bindingType,registryItem:a,title:cn(a,o.bindingType),icon:ln(a),headline:i?.headline??a._meta?.["mcp.mesh"]?.short_description??null,area:i?.area??null,bullets:i?.bullets??[],satisfied:m,candidateConnectionId:m?null:d||an(s.connections,o.bindingType,i?.registryAppId),linkedConnectionId:d,configurationState:l?.configuration_state??null,boundVia:h,boundResource:p?.resource??null})}return e}function un(s,e){if(!s)return null;const n=i=>{if(i.startsWith("sc-domain:"))return i.substring(10);try{let r=new URL(i.startsWith("http")?i:`https://${i}`).hostname||"";return r.startsWith("www.")&&(r=r.substring(4)),r}catch{return i}},o=n(s);for(const i of e)if(n(i.siteUrl)===o)return i.siteUrl;return null}function mn(s){return(s?.response?.accountSummaries??[]).map(o=>({account:o.account,options:(o.propertySummaries??[]).map(i=>({value:i.property,label:`${i.displayName} (${o.displayName})`}))}))}function Xe(s){const e=q.c(38);let n,o,i,a,r;e[0]!==s?({value:r,onChange:o,placeholder:i,className:n,...a}=s,e[0]=s,e[1]=n,e[2]=o,e[3]=i,e[4]=a,e[5]=r):(n=e[1],o=e[2],i=e[3],a=e[4],r=e[5]);const[l,d]=V.useState(!1),[u,c]=V.useState(!1);let p;e[6]!==r?(p=async()=>{if(r)try{await navigator.clipboard.writeText(r),c(!0),setTimeout(()=>c(!1),2e3)}catch(A){console.error("Failed to copy text: ",A)}},e[6]=r,e[7]=p):p=e[7];const m=p;let h;e[8]!==l?(h=()=>{d(!l)},e[8]=l,e[9]=h):h=e[9];const g=h,v=l?"text":"password";let j;e[10]!==n?(j=oe("pr-20",n),e[10]=n,e[11]=j):j=e[11];let x;e[12]!==o||e[13]!==i||e[14]!==a||e[15]!==v||e[16]!==j||e[17]!==r?(x=t.jsx(ye,{type:v,value:r,onChange:o,placeholder:i,className:j,...a}),e[12]=o,e[13]=i,e[14]=a,e[15]=v,e[16]=j,e[17]=r,e[18]=x):x=e[18];const f=l?"Hide password":"Show password";let b;e[19]!==l?(b=l?t.jsx(qt,{size:16}):t.jsx(Kt,{size:16}),e[19]=l,e[20]=b):b=e[20];let y;e[21]!==f||e[22]!==b||e[23]!==g?(y=t.jsx(H,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:g,title:f,children:b}),e[21]=f,e[22]=b,e[23]=g,e[24]=y):y=e[24];const C=!r,w=u?"Copied!":"Copy token";let _;e[25]!==u?(_=u?t.jsx(Mt,{size:16}):t.jsx(vt,{size:16}),e[25]=u,e[26]=_):_=e[26];let S;e[27]!==m||e[28]!==w||e[29]!==_||e[30]!==C?(S=t.jsx(H,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:m,disabled:C,title:w,children:_}),e[27]=m,e[28]=w,e[29]=_,e[30]=C,e[31]=S):S=e[31];let I;e[32]!==S||e[33]!==y?(I=t.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[y,S]}),e[32]=S,e[33]=y,e[34]=I):I=e[34];let O;return e[35]!==I||e[36]!==x?(O=t.jsxs("div",{className:"relative",children:[x,I]}),e[35]=I,e[36]=x,e[37]=O):O=e[37],O}function qe(s){const e=q.c(19),{card:n,selfClient:o,org:i,onDone:a,onError:r}=s,l=Ce();let d;e[0]!==n||e[1]!==o?(d=async j=>{const x={...n.configurationState??{},...j};await o.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:n.linkedConnectionId||n.candidateConnectionId,data:{configuration_state:x}}})},e[0]=n,e[1]=o,e[2]=d):d=e[2];let u;e[3]!==a||e[4]!==i||e[5]!==l?(u=async()=>{await l.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(i.id)}),a()},e[3]=a,e[4]=i,e[5]=l,e[6]=u):u=e[6];let c;e[7]!==r?(c=j=>{r?.(j)},e[7]=r,e[8]=c):c=e[8];let p;e[9]!==d||e[10]!==u||e[11]!==c?(p={mutationFn:d,onSuccess:u,onError:c},e[9]=d,e[10]=u,e[11]=c,e[12]=p):p=e[12];const m=fe(p);let h;e[13]!==m?(h=j=>m.mutate(j),e[13]=m,e[14]=h):h=e[14];const g=h;let v;return e[15]!==m.error||e[16]!==m.isPending||e[17]!==g?(v={save:g,isPending:m.isPending,error:m.error},e[15]=m.error,e[16]=m.isPending,e[17]=g,e[18]=v):v=e[18],v}const fn=_e({accountName:le().min(1,"Informe o nome da conta"),appKey:le().optional(),appToken:le().optional()});function pn(s){const e=q.c(63),{card:n,selfClient:o,org:i,onDone:a,onIsPendingChange:r}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=Se(fn),e[0]=l):l=e[0];const d=n.configurationState?.accountName||"",u=n.configurationState?.appKey||"",c=n.configurationState?.appToken||"";let p;e[1]!==d||e[2]!==u||e[3]!==c?(p={resolver:l,defaultValues:{accountName:d,appKey:u,appToken:c}},e[1]=d,e[2]=u,e[3]=c,e[4]=p):p=e[4];const m=Ne(p);let h;e[5]!==n.configurationState?.accountName||e[6]!==n.configurationState?.appKey||e[7]!==n.configurationState?.appToken||e[8]!==m?(h=()=>{m.reset({accountName:n.configurationState?.accountName||"",appKey:n.configurationState?.appKey||"",appToken:n.configurationState?.appToken||""})},e[5]=n.configurationState?.accountName,e[6]=n.configurationState?.appKey,e[7]=n.configurationState?.appToken,e[8]=m,e[9]=h):h=e[9];let g;e[10]!==n.configurationState||e[11]!==m?(g=[n.configurationState,m],e[10]=n.configurationState,e[11]=m,e[12]=g):g=e[12],V.useEffect(h,g);let v;e[13]!==n||e[14]!==a||e[15]!==i||e[16]!==o?(v={card:n,selfClient:o,org:i,onDone:a},e[13]=n,e[14]=a,e[15]=i,e[16]=o,e[17]=v):v=e[17];const{save:j,isPending:x,error:f}=qe(v);let b,y;e[18]!==x||e[19]!==r?(y=()=>{r?.(x)},b=[x,r],e[18]=x,e[19]=r,e[20]=b,e[21]=y):(b=e[20],y=e[21]),V.useEffect(y,b);let C;if(e[22]!==m||e[23]!==j){let D;e[25]!==j?(D=async k=>{j(k)},e[25]=j,e[26]=D):D=e[26],C=m.handleSubmit(D),e[22]=m,e[23]=j,e[24]=C}else C=e[24];const w=C;let _;e[27]!==x?(_=D=>{const{field:k}=D;return t.jsxs(de,{children:[t.jsx(Te,{children:"Nome da conta"}),t.jsx(ue,{children:t.jsx(ye,{placeholder:"Nome da sua conta VTEX",...k,disabled:x})}),t.jsx(me,{})]})},e[27]=x,e[28]=_):_=e[28];let S;e[29]!==m.control||e[30]!==_?(S=t.jsx(ce,{control:m.control,name:"accountName",render:_}),e[29]=m.control,e[30]=_,e[31]=S):S=e[31];let I;e[32]!==x?(I=D=>{const{field:k}=D;return t.jsxs(de,{children:[t.jsx(Te,{children:"App Key (opcional)"}),t.jsx(ue,{children:t.jsx(Xe,{placeholder:"App Key da VTEX",...k,disabled:x})}),t.jsx(me,{})]})},e[32]=x,e[33]=I):I=e[33];let O;e[34]!==m.control||e[35]!==I?(O=t.jsx(ce,{control:m.control,name:"appKey",render:I}),e[34]=m.control,e[35]=I,e[36]=O):O=e[36];let A;e[37]!==x?(A=D=>{const{field:k}=D;return t.jsxs(de,{children:[t.jsx(Te,{children:"App Token (opcional)"}),t.jsx(ue,{children:t.jsx(Xe,{placeholder:"App Token da VTEX",...k,disabled:x})}),t.jsx(me,{})]})},e[37]=x,e[38]=A):A=e[38];let N;e[39]!==m.control||e[40]!==A?(N=t.jsx(ce,{control:m.control,name:"appToken",render:A}),e[39]=m.control,e[40]=A,e[41]=N):N=e[41];let L;e[42]!==m||e[43]!==S||e[44]!==O||e[45]!==N?(L=t.jsxs(Ee,{...m,children:[S,O,N]}),e[42]=m,e[43]=S,e[44]=O,e[45]=N,e[46]=L):L=e[46];let z;e[47]!==f?(z=f&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:f instanceof Error?f.message:"Não foi possível salvar a configuração"}),e[47]=f,e[48]=z):z=e[48];let P;e[49]!==x||e[50]!==a?(P=t.jsx(H,{type:"button",variant:"outline",onClick:a,disabled:x,children:"Cancelar"}),e[49]=x,e[50]=a,e[51]=P):P=e[51];const F=x?"Salvando...":"Salvar";let M;e[52]!==x||e[53]!==F?(M=t.jsx(H,{type:"submit",disabled:x,children:F}),e[52]=x,e[53]=F,e[54]=M):M=e[54];let E;e[55]!==P||e[56]!==M?(E=t.jsxs(he,{className:"pt-4",children:[P,M]}),e[55]=P,e[56]=M,e[57]=E):E=e[57];let T;return e[58]!==w||e[59]!==L||e[60]!==z||e[61]!==E?(T=t.jsxs("form",{onSubmit:w,className:"space-y-4",children:[L,z,E]}),e[58]=w,e[59]=L,e[60]=z,e[61]=E,e[62]=T):T=e[62],T}function Ke(s){const e=q.c(29),{options:n,value:o,onChange:i,disabled:a,ariaLabel:r,searchPlaceholder:l,hideSearch:d}=s,u=l===void 0?"Buscar...":l,c=d===void 0?!1:d,[p,m]=V.useState("");let h,g,v;if(e[0]!==n||e[1]!==p||e[2]!==o){const _=p.trim().toLowerCase();h=_?n.filter(S=>S.label.toLowerCase().includes(_)):n,g=h.map(gn),v=g.includes(o)?o:g[0]??"",e[0]=n,e[1]=p,e[2]=o,e[3]=h,e[4]=g,e[5]=v}else h=e[3],g=e[4],v=e[5];const j=v;let x;e[6]!==a||e[7]!==g||e[8]!==i?(x=function(S){if(a||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(S.key))return;S.preventDefault();const O=S.currentTarget.dataset.value,A=g.indexOf(O),N=g.length;if(N===0)return;let L;S.key==="ArrowDown"||S.key==="ArrowRight"?L=(A+1)%N:S.key==="ArrowUp"||S.key==="ArrowLeft"?L=(A-1+N)%N:S.key==="Home"?L=0:L=N-1;const z=g[L];i(z),S.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(z)}"]`)?.focus()},e[6]=a,e[7]=g,e[8]=i,e[9]=x):x=e[9];const f=x;let b;e[10]!==r||e[11]!==a||e[12]!==c||e[13]!==p||e[14]!==u?(b=c?null:t.jsxs("div",{className:"relative",children:[t.jsx(yt,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),t.jsx(ye,{type:"text",value:p,onChange:_=>m(_.target.value),disabled:a,placeholder:u,"aria-label":`Buscar ${r}`,className:"h-8 pl-8"})]}),e[10]=r,e[11]=a,e[12]=c,e[13]=p,e[14]=u,e[15]=b):b=e[15];let y;e[16]!==a||e[17]!==h||e[18]!==f||e[19]!==i||e[20]!==j||e[21]!==o?(y=h.length===0?t.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:"Nenhum resultado"}):h.map(_=>{const S=_.value===o;return t.jsxs("button",{type:"button",role:"radio","aria-checked":S,disabled:a,"data-value":_.value,tabIndex:_.value===j?0:-1,onClick:()=>i(_.value),onKeyDown:f,className:oe("flex w-full items-center justify-between gap-2 rounded-sm px-2 py-2 text-left text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",S?"bg-muted font-medium text-foreground":"text-foreground hover:bg-muted/50"),children:[t.jsx("span",{className:"truncate",children:_.label}),S?t.jsx(Me,{size:16,className:"shrink-0 text-primary"}):null]},_.value)}),e[16]=a,e[17]=h,e[18]=f,e[19]=i,e[20]=j,e[21]=o,e[22]=y):y=e[22];let C;e[23]!==r||e[24]!==y?(C=t.jsx("div",{role:"radiogroup","aria-label":r,className:"max-h-[280px] overflow-y-auto",children:y}),e[23]=r,e[24]=y,e[25]=C):C=e[25];let w;return e[26]!==b||e[27]!==C?(w=t.jsxs("div",{className:"space-y-2",children:[b,C]}),e[26]=b,e[27]=C,e[28]=w):w=e[28],w}function gn(s){return s.value}function Le(s){const e=q.c(16),{label:n,iconSize:o,className:i,iconClassName:a,labelClassName:r}=s,l=o===void 0?14:o;let d;e[0]!==i?(d=oe("inline-flex items-center gap-2",i),e[0]=i,e[1]=d):d=e[1];let u;e[2]!==a?(u=oe("shrink-0 animate-spin",a),e[2]=a,e[3]=u):u=e[3];let c;e[4]!==l||e[5]!==u?(c=t.jsx(ze,{size:l,className:u}),e[4]=l,e[5]=u,e[6]=c):c=e[6];let p;e[7]!==r?(p=oe("text-sm",r),e[7]=r,e[8]=p):p=e[8];let m;e[9]!==n||e[10]!==p?(m=t.jsx("span",{className:p,children:n}),e[9]=n,e[10]=p,e[11]=m):m=e[11];let h;return e[12]!==d||e[13]!==c||e[14]!==m?(h=t.jsxs("span",{className:d,children:[c,m]}),e[12]=d,e[13]=c,e[14]=m,e[15]=h):h=e[15],h}const hn=_e({propertyId:le().min(1,"Selecione uma propriedade")});function xn(s){const e=q.c(68),{card:n,connectionId:o,companionClient:i,selfClient:a,org:r,onDone:l,onDisconnect:d,onIsPendingChange:u}=s;let c;e[0]!==o||e[1]!==r.id?(c=Y.commerceDiscoveryCompanionGaProperties(r.id,o),e[0]=o,e[1]=r.id,e[2]=c):c=e[2];let p;e[3]!==i?(p=async()=>{const $=await i.callTool({name:"get-account-summaries",arguments:{}}),K=ne($);return mn(K)},e[3]=i,e[4]=p):p=e[4];let m;e[5]!==c||e[6]!==p?(m={queryKey:c,queryFn:p},e[5]=c,e[6]=p,e[7]=m):m=e[7];const h=be(m);let g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=Se(hn),e[8]=g):g=e[8];const v=n.configurationState?.propertyId||"";let j;e[9]!==v?(j={resolver:g,defaultValues:{propertyId:v}},e[9]=v,e[10]=j):j=e[10];const x=Ne(j);let f;e[11]!==n||e[12]!==l||e[13]!==r||e[14]!==a?(f={card:n,selfClient:a,org:r,onDone:l},e[11]=n,e[12]=l,e[13]=r,e[14]=a,e[15]=f):f=e[15];const{save:b,isPending:y,error:C}=qe(f);let w,_;e[16]!==y||e[17]!==u?(w=()=>{u?.(y)},_=[y,u],e[16]=y,e[17]=u,e[18]=w,e[19]=_):(w=e[18],_=e[19]),V.useEffect(w,_);let S;if(e[20]!==x||e[21]!==b){let $;e[23]!==b?($=async K=>{b(K)},e[23]=b,e[24]=$):$=e[24],S=x.handleSubmit($),e[20]=x,e[21]=b,e[22]=S}else S=e[22];const I=S;if(h.isLoading){let $;return e[25]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:t.jsx(Le,{label:"Carregando propriedades..."})}),e[25]=$):$=e[25],$}if(h.isError){let $;return e[26]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx("div",{className:"space-y-4",children:t.jsx("p",{className:"text-sm text-destructive",children:"Não foi possível carregar as propriedades do Google Analytics."})}),e[26]=$):$=e[26],$}let O;e[27]!==h.data?(O=h.data||[],e[27]=h.data,e[28]=O):O=e[28];const A=O;if(A.flatMap(bn).length===0){let $;e[29]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhuma propriedade do Google Analytics foi encontrada. Conecte uma conta do Google Analytics com propriedades."}),e[29]=$):$=e[29];let K;e[30]!==d?(K=d?t.jsx("button",{type:"button",onClick:d,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive",children:"Desconectar conta"}):t.jsx("span",{}),e[30]=d,e[31]=K):K=e[31];let Q;e[32]!==l?(Q=t.jsx(H,{type:"button",variant:"outline",onClick:l,children:"Fechar"}),e[32]=l,e[33]=Q):Q=e[33];let W;return e[34]!==K||e[35]!==Q?(W=t.jsxs("div",{className:"space-y-4",children:[$,t.jsxs(he,{className:"flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[K,Q]})]}),e[34]=K,e[35]=Q,e[36]=W):W=e[36],W}let L;e[37]!==y||e[38]!==A?(L=$=>{const{field:K}=$;return t.jsxs(de,{children:[t.jsx(ue,{children:t.jsx(Ke,{options:A.flatMap(yn),value:K.value,onChange:K.onChange,disabled:y,ariaLabel:"Propriedade do Google Analytics"})}),t.jsx(me,{})]})},e[37]=y,e[38]=A,e[39]=L):L=e[39];let z;e[40]!==x.control||e[41]!==L?(z=t.jsx(ce,{control:x.control,name:"propertyId",render:L}),e[40]=x.control,e[41]=L,e[42]=z):z=e[42];let P;e[43]!==x||e[44]!==z?(P=t.jsx(Ee,{...x,children:z}),e[43]=x,e[44]=z,e[45]=P):P=e[45];let F;e[46]!==C?(F=C&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:C instanceof Error?C.message:"Não foi possível salvar a configuração"}),e[46]=C,e[47]=F):F=e[47];let M;e[48]!==y||e[49]!==d?(M=d?t.jsx("button",{type:"button",onClick:d,disabled:y,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive disabled:opacity-50",children:"Desconectar conta"}):t.jsx("span",{}),e[48]=y,e[49]=d,e[50]=M):M=e[50];let E;e[51]!==y||e[52]!==l?(E=t.jsx(H,{type:"button",variant:"outline",onClick:l,disabled:y,children:"Cancelar"}),e[51]=y,e[52]=l,e[53]=E):E=e[53];const T=y?"Salvando...":"Salvar";let D;e[54]!==y||e[55]!==T?(D=t.jsx(H,{type:"submit",disabled:y,children:T}),e[54]=y,e[55]=T,e[56]=D):D=e[56];let k;e[57]!==E||e[58]!==D?(k=t.jsxs("div",{className:"flex gap-2",children:[E,D]}),e[57]=E,e[58]=D,e[59]=k):k=e[59];let U;e[60]!==M||e[61]!==k?(U=t.jsxs(he,{className:"flex-col gap-2 pt-4 sm:flex-row sm:items-center sm:justify-between",children:[M,k]}),e[60]=M,e[61]=k,e[62]=U):U=e[62];let G;return e[63]!==I||e[64]!==P||e[65]!==F||e[66]!==U?(G=t.jsxs("form",{onSubmit:I,className:"space-y-4",children:[P,F,U]}),e[63]=I,e[64]=P,e[65]=F,e[66]=U,e[67]=G):G=e[67],G}function yn(s){return s.options}function bn(s){return s.options}const vn=_e({siteUrl:le().min(1,"Selecione um site")});function jn(s){const e=q.c(59),{card:n,connectionId:o,companionClient:i,selfClient:a,org:r,contextSiteUrl:l,onDone:d,onIsPendingChange:u}=s;let c;e[0]!==o||e[1]!==r.id?(c=Y.commerceDiscoveryCompanionGscSites(r.id,o),e[0]=o,e[1]=r.id,e[2]=c):c=e[2];let p;e[3]!==i?(p=async()=>{const k=await i.callTool({name:"list_sites",arguments:{}});return ne(k).sites||[]},e[3]=i,e[4]=p):p=e[4];let m;e[5]!==c||e[6]!==p?(m={queryKey:c,queryFn:p},e[5]=c,e[6]=p,e[7]=m):m=e[7];const h=be(m);let g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=Se(vn),e[8]=g):g=e[8];const v=n.configurationState?.siteUrl||"";let j;e[9]!==v?(j={resolver:g,defaultValues:{siteUrl:v}},e[9]=v,e[10]=j):j=e[10];const x=Ne(j);let f;e[11]!==n||e[12]!==d||e[13]!==r||e[14]!==a?(f={card:n,selfClient:a,org:r,onDone:d},e[11]=n,e[12]=d,e[13]=r,e[14]=a,e[15]=f):f=e[15];const{save:b,isPending:y,error:C}=qe(f);let w,_;e[16]!==y||e[17]!==u?(w=()=>{u?.(y)},_=[y,u],e[16]=y,e[17]=u,e[18]=w,e[19]=_):(w=e[18],_=e[19]),V.useEffect(w,_);let S;if(e[20]!==x||e[21]!==b){let k;e[23]!==b?(k=async U=>{b(U)},e[23]=b,e[24]=k):k=e[24],S=x.handleSubmit(k),e[20]=x,e[21]=b,e[22]=S}else S=e[22];const I=S;if(h.isLoading){let k;return e[25]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:t.jsx(Le,{label:"Carregando sites..."})}),e[25]=k):k=e[25],k}if(h.isError){let k;return e[26]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx("div",{className:"space-y-4",children:t.jsx("p",{className:"text-sm text-destructive",children:"Não foi possível carregar os sites do Google Search Console."})}),e[26]=k):k=e[26],k}let O,A;if(e[27]!==n.configurationState?.siteUrl||e[28]!==l||e[29]!==x||e[30]!==h.data){A=Symbol.for("react.early_return_sentinel");e:{if(O=h.data||[],O.length===0){let U;e[33]===Symbol.for("react.memo_cache_sentinel")?(U=t.jsx("div",{className:"space-y-4",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhum site verificado foi encontrado. Verifique um site no Google Search Console."})}),e[33]=U):U=e[33],A=U;break e}const k=n.configurationState?.siteUrl;if(k&&x.getValues("siteUrl")!==k)x.setValue("siteUrl",k);else if(!k&&!x.getValues("siteUrl")){const U=un(l,O);U&&x.setValue("siteUrl",U)}}e[27]=n.configurationState?.siteUrl,e[28]=l,e[29]=x,e[30]=h.data,e[31]=O,e[32]=A}else O=e[31],A=e[32];if(A!==Symbol.for("react.early_return_sentinel"))return A;let N;e[34]!==y||e[35]!==O?(N=k=>{const{field:U}=k;return t.jsxs(de,{children:[t.jsx(ue,{children:t.jsx(Ke,{options:O.map(Cn),value:U.value,onChange:U.onChange,disabled:y,ariaLabel:"Site verificado"})}),t.jsx(me,{})]})},e[34]=y,e[35]=O,e[36]=N):N=e[36];let L;e[37]!==x.control||e[38]!==N?(L=t.jsx(ce,{control:x.control,name:"siteUrl",render:N}),e[37]=x.control,e[38]=N,e[39]=L):L=e[39];let z;e[40]!==x||e[41]!==L?(z=t.jsx(Ee,{...x,children:L}),e[40]=x,e[41]=L,e[42]=z):z=e[42];let P;e[43]!==C?(P=C&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:C instanceof Error?C.message:"Não foi possível salvar a configuração"}),e[43]=C,e[44]=P):P=e[44];let F;e[45]!==y||e[46]!==d?(F=t.jsx(H,{type:"button",variant:"outline",onClick:d,disabled:y,children:"Cancelar"}),e[45]=y,e[46]=d,e[47]=F):F=e[47];const M=y?"Salvando...":"Salvar";let E;e[48]!==y||e[49]!==M?(E=t.jsx(H,{type:"submit",disabled:y,children:M}),e[48]=y,e[49]=M,e[50]=E):E=e[50];let T;e[51]!==F||e[52]!==E?(T=t.jsxs(he,{className:"pt-4",children:[F,E]}),e[51]=F,e[52]=E,e[53]=T):T=e[53];let D;return e[54]!==I||e[55]!==z||e[56]!==P||e[57]!==T?(D=t.jsxs("form",{onSubmit:I,className:"space-y-4",children:[z,P,T]}),e[54]=I,e[55]=z,e[56]=P,e[57]=T,e[58]=D):D=e[58],D}function Cn(s){return{value:s.siteUrl,label:s.siteUrl}}const _n=_e({githubRepo:le().min(1,"Selecione um repositório")}),Sn=15e3,Nn=/^[\w.-]+\/[\w.-]+$/;async function En(s,e,n,o){const{installations:i}=await Gt(s,n),a=o.trim(),r=await Promise.allSettled(i.map(async c=>{const p=c.type==="User"?"user":"org",m=a?`${p}:${c.login} ${a} in:name`:`${p}:${c.login}`,g=await e.callTool({name:"search_repositories",arguments:{query:m,page:1,perPage:50}},void 0,{signal:AbortSignal.timeout(Sn)}),v=g.content?.[0]?.text;if(g.isError)throw new Error(v??"search_repositories failed");if(!v)throw new Error("empty search_repositories response");return JSON.parse(v).items??[]})),l=new Map;let d=0;for(const c of r){if(c.status==="rejected"){d+=1;continue}for(const p of c.value)p.full_name&&!l.has(p.full_name)&&l.set(p.full_name,p)}return{repos:Array.from(l.values()).sort((c,p)=>(p.updated_at??"").localeCompare(c.updated_at??"")).map(c=>c.full_name),failed:d,total:i.length}}function wn(s){const e=q.c(80),{connectionId:n,companionClient:o,selfClient:i,org:a,onDone:r,onIsPendingChange:l}=s,d=Ce();let u;e[0]!==a.id?(u=De.COMMERCE_DISCOVERY(a.id),e[0]=a.id,e[1]=u):u=e[1];const c=u,[p,m]=V.useState(""),h=Vt(p,300);let g;e[2]!==n||e[3]!==a.id?(g=Y.commerceDiscoveryCompanionGithubSelected(a.id,n),e[2]=n,e[3]=a.id,e[4]=g):g=e[4];let v;e[5]!==c||e[6]!==i?(v=async()=>{const Z=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:c}}),X=ne(Z).item?.configuration_state??null;return typeof X?.github_repo=="string"?X.github_repo:""},e[5]=c,e[6]=i,e[7]=v):v=e[7];let j;e[8]!==g||e[9]!==v?(j={queryKey:g,queryFn:v},e[8]=g,e[9]=v,e[10]=j):j=e[10];const x=be(j);let f;e[11]!==n||e[12]!==h||e[13]!==a.id?(f=Y.commerceDiscoveryCompanionGithubRepos(a.id,n,h.trim()),e[11]=n,e[12]=h,e[13]=a.id,e[14]=f):f=e[14];let b;e[15]!==o||e[16]!==n||e[17]!==h||e[18]!==i?(b=()=>En(Z=>i.callTool(Z),o,n,h),e[15]=o,e[16]=n,e[17]=h,e[18]=i,e[19]=b):b=e[19];let y;e[20]!==f||e[21]!==b?(y={queryKey:f,queryFn:b},e[20]=f,e[21]=b,e[22]=y):y=e[22];const C=be(y);let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w={resolver:Se(_n),defaultValues:{githubRepo:""}},e[23]=w):w=e[23];const _=Ne(w);let S;e[24]!==c||e[25]!==i?(S=async Z=>{const X=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:c}}),It={...ne(X).item?.configuration_state??null??{},github_repo:Z};await i.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:c,data:{configuration_state:It}}})},e[24]=c,e[25]=i,e[26]=S):S=e[26];let I;e[27]!==c||e[28]!==r||e[29]!==a.id||e[30]!==d?(I=async()=>{await d.invalidateQueries({queryKey:Y.commerceDiscoveryConnection(a.id,c)}),await d.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(a.id)}),r()},e[27]=c,e[28]=r,e[29]=a.id,e[30]=d,e[31]=I):I=e[31];let O;e[32]!==I||e[33]!==S?(O={mutationFn:S,onSuccess:I},e[32]=I,e[33]=S,e[34]=O):O=e[34];const A=fe(O),N=A.isPending;let L,z;e[35]!==N||e[36]!==l?(L=()=>{l?.(N)},z=[N,l],e[35]=N,e[36]=l,e[37]=L,e[38]=z):(L=e[37],z=e[38]),V.useEffect(L,z);let P;if(e[39]!==_||e[40]!==A){let Z;e[42]!==A?(Z=async X=>{A.mutate(X.githubRepo)},e[42]=A,e[43]=Z):Z=e[43],P=_.handleSubmit(Z),e[39]=_,e[40]=A,e[41]=P}else P=e[41];const F=P,M=x.data??"";M&&_.getValues("githubRepo")!==M&&_.setValue("githubRepo",M);let E,T,D;if(e[44]!==h||e[45]!==C.data?.failed||e[46]!==C.data?.repos||e[47]!==C.data?.total||e[48]!==M){const Z=C.data?.repos??[];E=C.data?.failed??0,D=C.data?.total??0;const X=h.trim();T=[...Z],X&&Nn.test(X)&&!T.includes(X)&&T.unshift(X),M&&!T.includes(M)&&T.push(M),e[44]=h,e[45]=C.data?.failed,e[46]=C.data?.repos,e[47]=C.data?.total,e[48]=M,e[49]=E,e[50]=T,e[51]=D}else E=e[49],T=e[50],D=e[51];const k=D>0&&E===D,U=C.isError||k?"Não foi possível buscar os repositórios (erro ou tempo esgotado). Tente novamente ou digite o repositório no formato owner/nome.":E>0?"Parte da busca falhou — alguns repositórios podem não ter aparecido. Tente novamente ou digite owner/nome.":null;let G;e[52]===Symbol.for("react.memo_cache_sentinel")?(G=t.jsx(yt,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),e[52]=G):G=e[52];let $;e[53]===Symbol.for("react.memo_cache_sentinel")?($=Z=>m(Z.target.value),e[53]=$):$=e[53];let K;e[54]!==N||e[55]!==p?(K=t.jsxs("div",{className:"relative",children:[G,t.jsx(ye,{type:"text",value:p,onChange:$,disabled:N,placeholder:"Buscar repositório (ex: deco-sites/fila-store)","aria-label":"Buscar repositório",className:"h-8 pl-8"})]}),e[54]=N,e[55]=p,e[56]=K):K=e[56];let Q;e[57]!==_||e[58]!==N||e[59]!==T||e[60]!==C.isLoading||e[61]!==U?(Q=C.isLoading?t.jsx("div",{className:"flex min-h-[160px] items-center justify-center",children:t.jsx(Le,{label:"Carregando repositórios..."})}):t.jsxs(t.Fragment,{children:[U&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:U}),T.length===0?!U&&t.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhum repositório encontrado. Digite o nome do repositório (owner/nome) para buscar."}):t.jsx(Ee,{..._,children:t.jsx(ce,{control:_.control,name:"githubRepo",render:Z=>{const{field:X}=Z;return t.jsxs(de,{children:[t.jsx(ue,{children:t.jsx(Ke,{options:T.map(In),value:X.value,onChange:X.onChange,disabled:N,ariaLabel:"Repositório",hideSearch:!0})}),t.jsx(me,{})]})}})})]}),e[57]=_,e[58]=N,e[59]=T,e[60]=C.isLoading,e[61]=U,e[62]=Q):Q=e[62];let W;e[63]!==A.error?(W=A.error&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:A.error instanceof Error?A.error.message:"Não foi possível salvar a configuração"}),e[63]=A.error,e[64]=W):W=e[64];let J;e[65]!==N||e[66]!==r?(J=t.jsx(H,{type:"button",variant:"outline",onClick:r,disabled:N,children:"Cancelar"}),e[65]=N,e[66]=r,e[67]=J):J=e[67];const te=N?"Salvando...":"Salvar";let R;e[68]!==N||e[69]!==te?(R=t.jsx(H,{type:"submit",disabled:N,children:te}),e[68]=N,e[69]=te,e[70]=R):R=e[70];let B;e[71]!==J||e[72]!==R?(B=t.jsxs(he,{className:"pt-4",children:[J,R]}),e[71]=J,e[72]=R,e[73]=B):B=e[73];let ie;return e[74]!==F||e[75]!==K||e[76]!==Q||e[77]!==W||e[78]!==B?(ie=t.jsxs("form",{onSubmit:F,className:"space-y-4",children:[K,Q,W,B]}),e[74]=F,e[75]=K,e[76]=Q,e[77]=W,e[78]=B,e[79]=ie):ie=e[79],ie}function In(s){return{value:s,label:s}}const Tn={vtex:pn,"google-analytics":xn,"google-search-console":jn,github:wn},xe="deco-reader@decocms.iam.gserviceaccount.com",Ct={"google-analytics":"ga4","google-search-console":"gsc"},_t={ga4:{label:"Google Analytics",resourceLabel:"ID da propriedade",resourcePlaceholder:"ex: 123456789",resourceHint:"No GA4: Admin → Detalhes da propriedade → ID da propriedade (só números).",connectSteps:["Abra o Google Analytics (GA4) da sua loja.","Vá em Admin → Acesso à propriedade (Gerenciamento de acesso).",`Clique em + → Adicionar usuários, cole ${xe} e conceda o papel Leitor.`,"Copie o ID da propriedade (Admin → Detalhes da propriedade) e cole abaixo."]},gsc:{label:"Google Search Console",resourceLabel:"Site / propriedade",resourcePlaceholder:"ex: sc-domain:sualoja.com.br",resourceHint:"Use o mesmo formato que aparece no Search Console: sc-domain:sualoja.com.br ou https://www.sualoja.com.br/.",connectSteps:["Abra o Google Search Console da sua loja.","Vá em Configurações → Usuários e permissões.",`Clique em Adicionar usuário, cole ${xe} e escolha permissão Completa.`,"Copie o endereço do site como aparece no seletor de propriedades e cole abaixo."]}};function On(s,e){const n=_t[s].label;switch(e){case"no-access":return{title:`Ainda não conseguimos acessar este recurso no ${n}.`,steps:s==="ga4"?[`Confirme que ${xe} foi adicionado em Admin → Acesso à propriedade com o papel Leitor.`,"Confira se o ID da propriedade está correto (só números, sem o prefixo 'properties/').","A concessão de acesso pode levar alguns segundos — tente novamente."]:[`Confirme que ${xe} foi adicionado em Configurações → Usuários e permissões.`,"A permissão precisa ser Completa ou Restrita — 'Não verificado' não funciona.","Confira se o endereço do site está exatamente como aparece no Search Console."]};case"no-web-stream":return{title:"Esta propriedade do GA4 não tem um fluxo de dados da Web (site) configurado.",steps:["No GA4, vá em Admin → Fluxos de dados.","Clique em Adicionar fluxo → Web.","Informe a URL do site da sua loja e salve o fluxo.","Volte aqui e tente vincular de novo. (Propriedades só de app precisam de vínculo manual — fale com o suporte.)"]};case"no-match":return{title:"O recurso informado não corresponde ao domínio desta loja.",steps:s==="ga4"?["Verifique se digitou o ID da propriedade certa — provavelmente é de outro site.","No GA4, o site medido aparece em Admin → Fluxos de dados → (seu fluxo Web) → URL do stream."]:["Verifique se selecionou a propriedade do Search Console referente a esta loja.","O endereço precisa cobrir o mesmo domínio do diagnóstico."]};case"resource_already_bound":return{title:"Este recurso já está vinculado a outra loja.",steps:["Se este recurso é realmente desta loja, fale com o suporte para uma revisão manual.","Caso tenha digitado o id errado, confira e tente novamente."]};default:return{title:"Não foi possível verificar o acesso a este recurso.",steps:["Revise os passos de acesso acima e tente novamente.","Se persistir, fale com o suporte."]}}}function An(s){const e=q.c(76),{provider:n,siteUrl:o,selfClient:i,org:a,initialResourceId:r,onDone:l,onIsPendingChange:d,onOAuthInstead:u}=s,c=_t[n],p=Ce(),[m,h]=V.useState(null);let g,v;if(e[0]!==c.resourceLabel){const R=_e({resourceId:le().trim().min(1,`Informe o ${c.resourceLabel.toLowerCase()}`)});v=Ne,g=Se(R),e[0]=c.resourceLabel,e[1]=g,e[2]=v}else g=e[1],v=e[2];const j=r??"";let x;e[3]!==j?(x={resourceId:j},e[3]=j,e[4]=x):x=e[4];let f;e[5]!==g||e[6]!==x?(f={resolver:g,defaultValues:x},e[5]=g,e[6]=x,e[7]=f):f=e[7];const b=v(f);let y;e[8]!==n||e[9]!==i||e[10]!==o?(y=async R=>{if(!o)throw new Error("URL da loja indisponível — recarregue a página.");const B=await i.callTool({name:"COMMERCE_DISCOVERY_BIND",arguments:{siteUrl:o,provider:n,resourceId:R.resourceId}});return ne(B)},e[8]=n,e[9]=i,e[10]=o,e[11]=y):y=e[11];let C,w;e[12]!==d?(C=()=>d?.(!0),w=()=>d?.(!1),e[12]=d,e[13]=C,e[14]=w):(C=e[13],w=e[14]);let _;e[15]!==c.label||e[16]!==l||e[17]!==a||e[18]!==n||e[19]!==p||e[20]!==o?(_=async R=>{if(R.ok){h(null),Ae.success(`${c.label} conectado`),o&&await p.invalidateQueries({queryKey:Y.commerceDiscoveryConnectionStatus(a.id,o)}),l();return}h({...On(n,R.reason??"unknown"),detail:R.detail})},e[15]=c.label,e[16]=l,e[17]=a,e[18]=n,e[19]=p,e[20]=o,e[21]=_):_=e[21];let S;e[22]!==y||e[23]!==C||e[24]!==w||e[25]!==_?(S={mutationFn:y,onMutate:C,onSettled:w,onSuccess:_},e[22]=y,e[23]=C,e[24]=w,e[25]=_,e[26]=S):S=e[26];const I=fe(S);let O;if(e[27]!==b||e[28]!==I){let R;e[30]!==I?(R=B=>I.mutate(B),e[30]=I,e[31]=R):R=e[31],O=b.handleSubmit(R),e[27]=b,e[28]=I,e[29]=O}else O=e[29];const A=O,N=I.isPending,L=Ln;let z;e[32]!==c.connectSteps?(z=c.connectSteps.map(Rn),e[32]=c.connectSteps,e[33]=z):z=e[33];let P;e[34]!==z?(P=t.jsx("ol",{className:"space-y-2 text-sm text-muted-foreground",children:z}),e[34]=z,e[35]=P):P=e[35];let F;e[36]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx("code",{className:"min-w-0 flex-1 truncate text-xs text-foreground",children:xe}),e[36]=F):F=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/40 p-2",children:[F,t.jsx(H,{type:"button",variant:"ghost",size:"icon-sm",onClick:L,"aria-label":"Copiar e-mail do service account",children:t.jsx(vt,{size:16})})]}),e[37]=M):M=e[37];let E;e[38]!==c.resourceHint||e[39]!==c.resourceLabel||e[40]!==c.resourcePlaceholder||e[41]!==N?(E=R=>{const{field:B}=R;return t.jsxs(de,{children:[t.jsx(Te,{children:c.resourceLabel}),t.jsx(ue,{children:t.jsx(ye,{...B,placeholder:c.resourcePlaceholder,disabled:N,autoComplete:"off"})}),t.jsx(Ft,{children:c.resourceHint}),t.jsx(me,{})]})},e[38]=c.resourceHint,e[39]=c.resourceLabel,e[40]=c.resourcePlaceholder,e[41]=N,e[42]=E):E=e[42];let T;e[43]!==b.control||e[44]!==E?(T=t.jsx(ce,{control:b.control,name:"resourceId",render:E}),e[43]=b.control,e[44]=E,e[45]=T):T=e[45];let D;e[46]!==b||e[47]!==T?(D=t.jsx(Ee,{...b,children:T}),e[46]=b,e[47]=T,e[48]=D):D=e[48];let k;e[49]!==m?(k=m&&t.jsxs("div",{role:"alert",className:"space-y-2 rounded-lg border border-destructive/40 bg-destructive/5 p-3",children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:m.title}),t.jsx("ol",{className:"space-y-1 text-sm text-muted-foreground",children:m.steps.map(kn)})]}),e[49]=m,e[50]=k):k=e[50];let U;e[51]!==I.error||e[52]!==I.isError?(U=I.isError&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:I.error instanceof Error?I.error.message:"Não foi possível vincular."}),e[51]=I.error,e[52]=I.isError,e[53]=U):U=e[53];let G;e[54]!==N||e[55]!==u?(G=u?t.jsx("button",{type:"button",onClick:u,disabled:N,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground disabled:opacity-50",children:"autorizar via login do Google"}):t.jsx("span",{}),e[54]=N,e[55]=u,e[56]=G):G=e[56];let $;e[57]!==N||e[58]!==l?($=t.jsx(H,{type:"button",variant:"outline",onClick:l,disabled:N,children:"Cancelar"}),e[57]=N,e[58]=l,e[59]=$):$=e[59];const K=N?"Verificando...":"Vincular";let Q;e[60]!==N||e[61]!==K?(Q=t.jsx(H,{type:"submit",disabled:N,children:K}),e[60]=N,e[61]=K,e[62]=Q):Q=e[62];let W;e[63]!==$||e[64]!==Q?(W=t.jsxs("div",{className:"flex gap-2",children:[$,Q]}),e[63]=$,e[64]=Q,e[65]=W):W=e[65];let J;e[66]!==G||e[67]!==W?(J=t.jsxs(he,{className:"flex-col gap-2 pt-2 sm:flex-row sm:items-center sm:justify-between",children:[G,W]}),e[66]=G,e[67]=W,e[68]=J):J=e[68];let te;return e[69]!==A||e[70]!==P||e[71]!==D||e[72]!==k||e[73]!==U||e[74]!==J?(te=t.jsxs("form",{onSubmit:A,className:"space-y-4",children:[P,M,D,k,U,J]}),e[69]=A,e[70]=P,e[71]=D,e[72]=k,e[73]=U,e[74]=J,e[75]=te):te=e[75],te}function kn(s){return t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{"aria-hidden":!0,children:"•"}),t.jsx("span",{children:s})]},s)}function Rn(s,e){return t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium text-foreground",children:e+1}),t.jsx("span",{children:s})]},s)}function Ln(){navigator.clipboard?.writeText(xe),Ae.success("E-mail copiado")}function Pn(){const s=q.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"size-9 shrink-0 animate-pulse rounded-lg bg-muted/60"}),s[0]=e):e=s[0];let n;return s[1]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-border bg-card p-4 sm:h-full sm:flex-col sm:items-stretch",children:[e,t.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[t.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted/60"}),t.jsx("div",{className:"h-3 w-full animate-pulse rounded bg-muted/60"})]}),t.jsx("div",{className:"h-8 w-20 shrink-0 animate-pulse rounded-lg bg-muted/60 sm:mt-auto sm:w-full"})]}),s[1]=n):n=s[1],n}const et="rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground";function Un(s){const e=q.c(37),{card:n,connecting:o,disabled:i,onConnect:a,org:r,selfClient:l,siteUrl:d,autoOpenConfigFieldKey:u,onAutoOpenConfigHandled:c}=s,p=n.linkedConnectionId,m=Ct[n.bindingType],h=!!m&&n.boundVia!=="oauth";let g;e[0]!==u||e[1]!==n||e[2]!==o||e[3]!==i||e[4]!==p||e[5]!==c||e[6]!==a||e[7]!==r||e[8]!==m||e[9]!==l||e[10]!==d||e[11]!==h?(g=h&&m?t.jsx($n,{card:n,provider:m,org:r,selfClient:l,siteUrl:d,onOAuthInstead:a,disabled:i,connecting:o}):n.satisfied&&p?t.jsxs("div",{className:"flex items-center justify-end gap-1 sm:justify-start",children:[t.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[t.jsx(Me,{size:16,className:"text-success"})," Conectado"]}),t.jsx(V.Suspense,{fallback:t.jsx(zn,{}),children:t.jsx(Dn,{card:n,org:r,selfClient:l,connectionId:p,contextSiteUrl:d,autoOpen:rn({autoOpenFieldKey:u,card:n}),onAutoOpenHandled:c})})]}):t.jsx(H,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:i||o,onClick:a,"aria-label":`Conectar ${n.title}`,children:o?t.jsx(ze,{size:16,className:"animate-spin"}):"Conectar"}),e[0]=u,e[1]=n,e[2]=o,e[3]=i,e[4]=p,e[5]=c,e[6]=a,e[7]=r,e[8]=m,e[9]=l,e[10]=d,e[11]=h,e[12]=g):g=e[12];const v=g;let j;e[13]!==n.icon||e[14]!==n.title?(j=t.jsx(Fe,{icon:n.icon,name:n.title,size:"sm",fit:"contain",className:"shrink-0 p-1.5"}),e[13]=n.icon,e[14]=n.title,e[15]=j):j=e[15];let x;e[16]!==n.area?(x=n.area&&t.jsx("span",{className:oe("hidden sm:inline-block",et),children:n.area}),e[16]=n.area,e[17]=x):x=e[17];let f;e[18]!==j||e[19]!==x?(f=t.jsxs("div",{className:"shrink-0 self-start sm:flex sm:w-full sm:items-center sm:justify-between sm:gap-2",children:[j,x]}),e[18]=j,e[19]=x,e[20]=f):f=e[20];let b;e[21]!==n.area?(b=n.area&&t.jsx("span",{className:oe("mb-1 inline-block sm:hidden",et),children:n.area}),e[21]=n.area,e[22]=b):b=e[22];let y;e[23]!==n.title?(y=t.jsx("p",{className:"text-sm font-medium text-foreground",children:n.title}),e[23]=n.title,e[24]=y):y=e[24];let C;e[25]!==n.headline?(C=n.headline&&t.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm leading-5 text-muted-foreground",children:n.headline}),e[25]=n.headline,e[26]=C):C=e[26];let w;e[27]!==b||e[28]!==y||e[29]!==C?(w=t.jsxs("div",{className:"min-w-0 flex-1",children:[b,y,C]}),e[27]=b,e[28]=y,e[29]=C,e[30]=w):w=e[30];let _;e[31]!==v?(_=t.jsx("div",{className:"shrink-0 sm:mt-auto sm:w-full sm:pt-1",children:v}),e[31]=v,e[32]=_):_=e[32];let S;return e[33]!==f||e[34]!==w||e[35]!==_?(S=t.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-border bg-card p-4 sm:h-full sm:flex-col sm:items-stretch",children:[f,w,_]}),e[33]=f,e[34]=w,e[35]=_,e[36]=S):S=e[36],S}function $n(s){const e=q.c(39),{card:n,provider:o,org:i,selfClient:a,siteUrl:r,onOAuthInstead:l,disabled:d,connecting:u}=s,[c,p]=V.useState(!1),[m,h]=V.useState(!1);let g;e[0]!==m?(g=L=>{!L&&m||p(L)},e[0]=m,e[1]=g):g=e[1];const v=g;let j;e[2]!==n.satisfied||e[3]!==n.title||e[4]!==u||e[5]!==d?(j=n.satisfied?t.jsxs("div",{className:"flex items-center justify-end gap-1 sm:justify-start",children:[t.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[t.jsx(Me,{size:16,className:"text-success"})," Conectado"]}),t.jsxs(gt,{children:[t.jsx(ht,{asChild:!0,children:t.jsx(H,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:()=>p(!0),"aria-label":`Configurar ${n.title}`,children:t.jsx(bt,{size:16})})}),t.jsx(xt,{children:"Editar configuração"})]})]}):t.jsx(H,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:d||u,onClick:()=>p(!0),"aria-label":`Conectar ${n.title}`,children:u?t.jsx(ze,{size:16,className:"animate-spin"}):"Conectar"}),e[2]=n.satisfied,e[3]=n.title,e[4]=u,e[5]=d,e[6]=j):j=e[6];let x;e[7]!==n.icon||e[8]!==n.title?(x=t.jsx(Fe,{icon:n.icon,name:n.title,size:"md",fit:"contain",className:"p-1.5"}),e[7]=n.icon,e[8]=n.title,e[9]=x):x=e[9];let f;e[10]!==n.title?(f=t.jsx(dt,{children:n.title}),e[10]=n.title,e[11]=f):f=e[11];let b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(ut,{children:"Conceda acesso ao nosso leitor e informe o identificador"}),e[12]=b):b=e[12];let y;e[13]!==f?(y=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[f,b]}),e[13]=f,e[14]=y):y=e[14];let C;e[15]!==x||e[16]!==y?(C=t.jsxs(mt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[x,y]}),e[15]=x,e[16]=y,e[17]=C):C=e[17];const w=n.boundResource??void 0;let _;e[18]===Symbol.for("react.memo_cache_sentinel")?(_=()=>p(!1),e[18]=_):_=e[18];let S;e[19]!==n.satisfied||e[20]!==l?(S=n.satisfied?void 0:()=>{p(!1),l()},e[19]=n.satisfied,e[20]=l,e[21]=S):S=e[21];let I;e[22]!==i||e[23]!==o||e[24]!==a||e[25]!==r||e[26]!==S||e[27]!==w?(I=t.jsx(An,{provider:o,siteUrl:r,selfClient:a,org:i,initialResourceId:w,onDone:_,onIsPendingChange:h,onOAuthInstead:S}),e[22]=i,e[23]=o,e[24]=a,e[25]=r,e[26]=S,e[27]=w,e[28]=I):I=e[28];let O;e[29]!==I||e[30]!==C?(O=t.jsxs(ft,{className:"sm:max-w-lg",children:[C,I]}),e[29]=I,e[30]=C,e[31]=O):O=e[31];let A;e[32]!==v||e[33]!==c||e[34]!==O?(A=t.jsx(pt,{open:c,onOpenChange:v,children:O}),e[32]=v,e[33]=c,e[34]=O,e[35]=A):A=e[35];let N;return e[36]!==A||e[37]!==j?(N=t.jsxs(t.Fragment,{children:[j,A]}),e[36]=A,e[37]=j,e[38]=N):N=e[38],N}function zn(){const s=q.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"size-8 shrink-0 animate-pulse rounded-lg bg-muted/60"}),s[0]=e):e=s[0],e}function Dn(s){const e=q.c(60),{card:n,org:o,selfClient:i,connectionId:a,contextSiteUrl:r,autoOpen:l,onAutoOpenHandled:d}=s;let u;e[0]!==a||e[1]!==o.id||e[2]!==o.slug?(u={connectionId:a,orgId:o.id,orgSlug:o.slug},e[0]=a,e[1]=o.id,e[2]=o.slug,e[3]=u):u=e[3];const c=Re(u),[p,m]=V.useState(l),[h,g]=V.useState(!1),v=Ce(),j=Tn[n.bindingType],x=on(n.configurationState);let f;e[4]!==l||e[5]!==d?(f=()=>{m(!1),l&&d()},e[4]=l,e[5]=d,e[6]=f):f=e[6];const b=f;let y;e[7]!==b||e[8]!==h?(y=K=>{if(!(!K&&h)){if(!K){b();return}m(!0)}},e[7]=b,e[8]=h,e[9]=y):y=e[9];const C=y;let w;e[10]!==a||e[11]!==i?(w=async()=>{await i.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:a,force:!0}})},e[10]=a,e[11]=i,e[12]=w):w=e[12];let _;e[13]!==n.title||e[14]!==b||e[15]!==o.id||e[16]!==v?(_=async()=>{await v.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(o.id)}),Ae.success(`${n.title} desconectado`),b()},e[13]=n.title,e[14]=b,e[15]=o.id,e[16]=v,e[17]=_):_=e[17];let S;e[18]!==w||e[19]!==_?(S={mutationFn:w,onSuccess:_,onError:Fn},e[18]=w,e[19]=_,e[20]=S):S=e[20];const I=fe(S);if(!j)return null;let O;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=()=>m(!0),e[21]=O):O=e[21];const A=`Configurar ${n.title}`;let N;e[22]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(bt,{size:16}),e[22]=N):N=e[22];let L;e[23]!==A?(L=t.jsx(ht,{asChild:!0,children:t.jsx(H,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:O,"aria-label":A,children:N})}),e[23]=A,e[24]=L):L=e[24];const z=x.length>0?"Editar configuração":"Configurar";let P;e[25]!==z?(P=t.jsx(xt,{children:z}),e[25]=z,e[26]=P):P=e[26];let F;e[27]!==L||e[28]!==P?(F=t.jsxs(gt,{children:[L,P]}),e[27]=L,e[28]=P,e[29]=F):F=e[29];let M;e[30]!==n.icon||e[31]!==n.title?(M=t.jsx(Fe,{icon:n.icon,name:n.title,size:"md",fit:"contain",className:"p-1.5"}),e[30]=n.icon,e[31]=n.title,e[32]=M):M=e[32];let E;e[33]!==n.title?(E=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[t.jsx(dt,{children:n.title}),t.jsxs(ut,{children:["Configure o ",n.title," para enriquecer os dados"]})]}),e[33]=n.title,e[34]=E):E=e[34];let T;e[35]!==M||e[36]!==E?(T=t.jsxs(mt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[M,E]}),e[35]=M,e[36]=E,e[37]=T):T=e[37];let D;e[38]!==I?(D=()=>I.mutate(),e[38]=I,e[39]=D):D=e[39];let k;e[40]!==j||e[41]!==n||e[42]!==b||e[43]!==c||e[44]!==a||e[45]!==r||e[46]!==o||e[47]!==i||e[48]!==D?(k=t.jsx(j,{card:n,connectionId:a,companionClient:c,selfClient:i,org:o,contextSiteUrl:r,onDone:b,onDisconnect:D,onIsPendingChange:g}),e[40]=j,e[41]=n,e[42]=b,e[43]=c,e[44]=a,e[45]=r,e[46]=o,e[47]=i,e[48]=D,e[49]=k):k=e[49];let U;e[50]!==T||e[51]!==k?(U=t.jsxs(ft,{className:"sm:max-w-lg",children:[T,k]}),e[50]=T,e[51]=k,e[52]=U):U=e[52];let G;e[53]!==p||e[54]!==C||e[55]!==U?(G=t.jsx(pt,{open:p,onOpenChange:C,children:U}),e[53]=p,e[54]=C,e[55]=U,e[56]=G):G=e[56];let $;return e[57]!==F||e[58]!==G?($=t.jsxs(t.Fragment,{children:[F,G]}),e[57]=F,e[58]=G,e[59]=$):$=e[59],$}function Fn(){Ae.error("Não foi possível desconectar. Tente novamente.")}const Ve={vtex:{registryAppId:"deco/vtex",area:"Catálogo",headline:"Rupturas e PDPs que travam suas vendas."},"google-analytics":{registryAppId:"deco/google-analytics",area:"Funil",headline:"Onde a receita vaza no seu funil."},"google-search-console":{registryAppId:"deco/google-search-console",area:"Busca",headline:"O tráfego de busca que você deixa na mesa."},github:{registryAppId:"deco/mcp-github",area:"Engenharia",headline:"A saúde da entrega de código por trás da sua loja."}};function Mn(s){const e=q.c(40),{selfClient:n,org:o,cdConnectionId:i,siteUrl:a}=s;let r;e[0]!==i||e[1]!==o.id||e[2]!==o.slug?(r={connectionId:i,orgId:o.id,orgSlug:o.slug},e[0]=i,e[1]=o.id,e[2]=o.slug,e[3]=r):r=e[3];const l=Re(r);let d;e[4]!==i||e[5]!==o.id?(d=Y.commerceDiscoveryCompanionSchema(o.id,i),e[4]=i,e[5]=o.id,e[6]=d):d=e[6];let u;e[7]!==l?(u=async()=>{const R=await l.callTool({name:"MCP_CONFIGURATION",arguments:{}});return ne(R)},e[7]=l,e[8]=u):u=e[8];let c;e[9]!==d||e[10]!==u?(c={queryKey:d,queryFn:u},e[9]=d,e[10]=u,e[11]=c):c=e[11];const p=ge(c),m=Xt(p.data?.stateSchema??{properties:{}}),h=m.map(Jn),g=m.map(Yn).filter(Wn),v=m.filter(Qn).map(Bn),j=[...g,...v].sort().join(",");let x;e[12]!==i||e[13]!==o.id?(x=Y.commerceDiscoveryConnection(o.id,i),e[12]=i,e[13]=o.id,e[14]=x):x=e[14];let f;e[15]!==i||e[16]!==n?(f=async()=>{const R=await n.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:i}});return ne(R)},e[15]=i,e[16]=n,e[17]=f):f=e[17];let b;e[18]!==x||e[19]!==f?(b={queryKey:x,queryFn:f},e[18]=x,e[19]=f,e[20]=b):b=e[20];const C=ge(b).data?.item?.configuration_state??null;let w;e[21]!==C?(w=R=>C?.[R.fieldKey]?.value,e[21]=C,e[22]=w):w=e[22];const _=m.map(w).filter(Hn),S=[...h.map(Gn),...g.map(Vn),..._.map(Kn)].sort().join(","),O=ge({queryKey:Y.commerceDiscoveryCompanionConnections(o.id,S),queryFn:async()=>{if(m.length===0)return{items:[]};const R=[{field:["app_name"],operator:"in",value:h},{field:["app_id"],operator:"in",value:g}];_.length>0&&R.push({field:["id"],operator:"in",value:_});const B=await n.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:R},limit:1e3}});return ne(B)}}).data?.items??[],A=new Set(_),N=O.filter(R=>A.has(R.id)),L=N.filter(qn);let z;e[23]!==o.id||e[24]!==o.slug?(z=R=>({queryKey:Y.commerceDiscoveryCompanionOAuthStatus(o.id,R.id),queryFn:async()=>{try{const B=await fetch(`/api/${encodeURIComponent(o.slug)}/connections/${encodeURIComponent(R.id)}/oauth-token/status`,{credentials:"include"});return B.ok?{hasToken:(await B.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}},retry:!1}),e[23]=o.id,e[24]=o.slug,e[25]=z):z=e[25];const P=Ht({queries:L.map(z)});let F;e[26]!==P?(F=(R,B)=>[R.id,P[B]?.data?.hasToken===!0],e[26]=P,e[27]=F):F=e[27];const M=new Map(L.map(F)),E={};for(const R of N)E[R.id]=!R.oauth_config||!!R.connection_token||M.get(R.id)===!0;const T=ge({queryKey:Y.commerceDiscoveryCompanionRegistry(o.id,j),queryFn:async()=>{if(m.length===0)return{items:[]};const R=en(g,v),B=await zt(De.REGISTRY(o.id),o.id,o.slug,"COLLECTION_REGISTRY_APP_LIST",{...R?{where:R}:{},limit:1e3});return ne(B)}}),D={},k={};for(const R of T.data?.items??[])D[R.id]=R,R.server?.name&&(k[R.server.name]=R);let U;e[28]!==o.id||e[29]!==a?(U=Y.commerceDiscoveryConnectionStatus(o.id,a??""),e[28]=o.id,e[29]=a,e[30]=U):U=e[30];const G=!!a;let $;e[31]!==n||e[32]!==a?($=async()=>{const R=await n.callTool({name:"COMMERCE_DISCOVERY_CONNECTION_STATUS",arguments:{siteUrl:a}});return ne(R)},e[31]=n,e[32]=a,e[33]=$):$=e[33];let K;e[34]!==U||e[35]!==G||e[36]!==$?(K={queryKey:U,enabled:G,queryFn:$},e[34]=U,e[35]=G,e[36]=$,e[37]=K):K=e[37];const Q=be(K),W={};for(const[R,B]of Object.entries(Ct)){const ie=Q.data?.providers?.[B];ie?.connected&&ie.via==="sa"&&(W[R]={resource:ie.resource??null})}const J=dn({requirements:m,itemsById:D,itemsByName:k,connections:O,connectionReadiness:E,configurationState:C,curated:Ve,saBindings:W});let te;return e[38]!==J?(te={cards:J},e[38]=J,e[39]=te):te=e[39],te}function qn(s){return s.oauth_config&&!s.connection_token}function Kn(s){return`linked:${s}`}function Vn(s){return`app:${s}`}function Gn(s){return`binding:${s}`}function Hn(s){return typeof s=="string"&&s.length>0}function Bn(s){return s.bindingType}function Qn(s){return!Ve[s.bindingType]}function Wn(s){return!!s}function Yn(s){return Ve[s.bindingType]?.registryAppId}function Jn(s){return s.bindingType}function Zn({selfClient:s,org:e,userId:n,cdConnectionId:o,domain:i,siteUrl:a}){const r=Ce(),[l,d]=V.useState(null),[u,c]=V.useState(null),p=async(h,g)=>{const v=await s.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:h,data:g}});return ne(v)};async function m(h){d(h.fieldKey),c(null);const g={app_name:h.title,field_key:h.fieldKey,organization_id:e.id,domain:i,site_url:a};ee("commerce_onboarding_companion_connect_clicked",g);try{let v=h.candidateConnectionId;if(!v){const C=Dt(h.registryItem,e.id,n,{remoteIndex:0}),w=C.connection_type==="STDIO",_=!!C.connection_url,S=w&&C.connection_headers&&typeof C.connection_headers=="object"&&"command"in C.connection_headers;if(!_&&!S)return ee("commerce_onboarding_companion_connect_failed",{...g,error:"no_connection_method"}),c(`${h.title} cannot be connected: no connection method available`),!1;const I=await s.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:C}});v=ne(I).item.id}const j=v,x=await Bt({connectionId:j,orgId:e.id,orgSlug:e.slug,persistFallback:C=>p(j,{connection_token:C}).then(()=>{})});if(!x.ok)return ee("commerce_onboarding_companion_connect_failed",{...g,error:x.error}),c(`Couldn't sign in to ${h.title}: ${x.error}`),!1;const f=await s.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}}),b=ne(f).item?.configuration_state??null,y=tn(b,h.fieldKey,h.bindingType,j);return await p(o,{configuration_state:y}),await r.invalidateQueries({queryKey:Y.commerceDiscoveryConnection(e.id,o)}),await r.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),ee("commerce_onboarding_companion_connected",g),!0}catch(v){return ee("commerce_onboarding_companion_connect_failed",{...g,error:v instanceof Error?v.message:String(v)}),c(v instanceof Error?v.message:String(v)),!1}finally{d(null)}}return{connect:m,connectingFieldKey:l,error:u}}const Ge="flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none md:gap-4";function He(){const s=q.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("h1",{className:"text-2xl font-medium leading-8 text-foreground",children:"Conecte suas ferramentas para ver o diagnóstico completo"}),s[0]=e):e=s[0],e}function Xn(){const s=q.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[0,1,2,3].map(es)}),s[0]=e):e=s[0],e}function es(s){return t.jsx(Pn,{},s)}function Be(){const s=q.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:Ge,children:[t.jsx(He,{}),t.jsx(Xn,{})]}),s[0]=e):e=s[0],e}function ts(s){const e=q.c(5),{onRetry:n}=s;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(He,{}),e[0]=o):o=e[0];let i,a;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("p",{className:"text-sm text-foreground",children:"Não foi possível carregar as integrações complementares."}),a=t.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Algo deu errado ao carregar suas integrações."}),e[1]=i,e[2]=a):(i=e[1],a=e[2]);let r;return e[3]!==n?(r=t.jsxs("div",{className:Ge,children:[o,t.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[i,a,t.jsx(H,{type:"button",variant:"outline",size:"sm",className:"mt-3",onClick:n,children:"Tentar novamente"})]})]}),e[3]=n,e[4]=r):r=e[4],r}function ns(s){const e=q.c(2);let n;return e[0]!==s?(n=t.jsx(st,{children:o=>{const{reset:i}=o;return t.jsx(ot,{fallback:a=>{const{resetError:r}=a;return t.jsx(ts,{onRetry:()=>{i(),r()}})},children:t.jsx(V.Suspense,{fallback:t.jsx(Be,{}),children:t.jsx(ss,{...s})})})}}),e[0]=s,e[1]=n):n=e[1],n}function ss(s){const e=q.c(42),{org:n,cdConnectionId:o,siteUrl:i}=s,{data:a}=ke.useSession(),r=a?.user?.id??"";let l;if(e[0]!==i){const S=i?ae(i):null;if(S?.ok)try{l=new URL(S.value).hostname}catch{l=void 0}e[0]=i,e[1]=l}else l=e[1];let d;e[2]!==n.id||e[3]!==n.slug?(d={connectionId:lt,orgId:n.id,orgSlug:n.slug},e[2]=n.id,e[3]=n.slug,e[4]=d):d=e[4];const u=Re(d);let c;e[5]!==o||e[6]!==n||e[7]!==u||e[8]!==i?(c={selfClient:u,org:n,cdConnectionId:o,siteUrl:i},e[5]=o,e[6]=n,e[7]=u,e[8]=i,e[9]=c):c=e[9];const{cards:p}=Mn(c);let m;e[10]!==o||e[11]!==n||e[12]!==u||e[13]!==l||e[14]!==i||e[15]!==r?(m={selfClient:u,org:n,userId:r,cdConnectionId:o,domain:l,siteUrl:i},e[10]=o,e[11]=n,e[12]=u,e[13]=l,e[14]=i,e[15]=r,e[16]=m):m=e[16];const{connect:h,connectingFieldKey:g,error:v}=Zn(m),[j,x]=V.useState(null);if(p.length===0)return null;const f=g!==null;let b;e[17]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(He,{}),e[17]=b):b=e[17];let y;e[18]!==v?(y=v&&t.jsx("p",{role:"alert",className:"mb-3 text-sm text-destructive",children:v}),e[18]=v,e[19]=y):y=e[19];let C;if(e[20]!==j||e[21]!==f||e[22]!==p||e[23]!==h||e[24]!==g||e[25]!==n||e[26]!==u||e[27]!==i){let S;e[29]!==j||e[30]!==f||e[31]!==h||e[32]!==g||e[33]!==n||e[34]!==u||e[35]!==i?(S=I=>{const O=async()=>{await h(I)&&x(I.fieldKey)};return t.jsx(Un,{card:I,connecting:g===I.fieldKey,disabled:f&&g!==I.fieldKey,org:n,selfClient:u,siteUrl:i,autoOpenConfigFieldKey:j,onAutoOpenConfigHandled:()=>x(A=>A===I.fieldKey?null:A),onConnect:()=>{O()}},I.fieldKey)},e[29]=j,e[30]=f,e[31]=h,e[32]=g,e[33]=n,e[34]=u,e[35]=i,e[36]=S):S=e[36],C=p.map(S),e[20]=j,e[21]=f,e[22]=p,e[23]=h,e[24]=g,e[25]=n,e[26]=u,e[27]=i,e[28]=C}else C=e[28];let w;e[37]!==C?(w=t.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:C}),e[37]=C,e[38]=w):w=e[38];let _;return e[39]!==y||e[40]!==w?(_=t.jsxs("div",{className:Ge,children:[b,t.jsxs(Ue,{wrapperClassName:"flex min-h-0 flex-1 flex-col md:block",className:"-mx-1 min-h-0 flex-1 overflow-y-auto px-1 md:max-h-[min(60vh,calc(100dvh-330px))] md:flex-none",children:[y,w]})]}),e[39]=y,e[40]=w,e[41]=_):_=e[41],_}const Qe="https://decocms.com/agendar",os="Precisa de ajuda? Fale conosco",is="Agende uma chamada de 20 minutos e rodamos o diagnóstico com você, ao vivo.",ve=[{photo:"https://decoims.com/image?src=decocms%2Fb07a1c19-0cd6-49c8-b326-86055ee78605%2Fauthor-1763423987973-baby.jpeg&quality=original&fit=cover&width=200&height=200",alt:"Especialista da deco"},{photo:"https://decoims.com/decocms/07c2daf4-a3c2-485e-a1a8-341585a06e3b/cecilia.png",alt:"Especialista da deco"},{photo:"https://decoims.com/decocms/48013ca2-3277-464b-b0f1-dd5f1f08d986/tavano.png",alt:"Especialista da deco"}],rs="var(--brand-green-dark)";function We({siteUrl:s,email:e}){const n=new URL(Qe);return s&&n.searchParams.set("siteUrl",s),e&&n.searchParams.set("email",e),n.toString()}function as(s){const e=q.c(12),{href:n,size:o,className:i,orgId:a}=s,r=n===void 0?Qe:n,l=o===void 0?"lg":o;let d;e[0]!==i?(d=oe("w-full",i),e[0]=i,e[1]=d):d=e[1];let u;e[2]!==a?(u=()=>ee("commerce_onboarding_meeting_cta_clicked",{placement:"visual_card",organization_id:a}),e[2]=a,e[3]=u):u=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(jt,{size:16}),e[4]=c):c=e[4];let p;e[5]!==r||e[6]!==u?(p=t.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",onClick:u,children:["Agendar uma reunião",c]}),e[5]=r,e[6]=u,e[7]=p):p=e[7];let m;return e[8]!==l||e[9]!==d||e[10]!==p?(m=t.jsx(H,{asChild:!0,variant:"outline",size:l,className:d,children:p}),e[8]=l,e[9]=d,e[10]=p,e[11]=m):m=e[11],m}function ls(s){const e=q.c(10),{size:n}=s,o=n===void 0?72:n;let i;e[0]!==o?(i=Math.round(o*.3),e[0]=o,e[1]=i):i=e[1];const a=i;let r;e[2]!==o?(r={height:o},e[2]=o,e[3]=r):r=e[3];let l;e[4]!==a||e[5]!==o?(l=ve.map((u,c)=>t.jsxs("div",{className:"relative shrink-0",style:{width:o,height:o,marginLeft:c===0?0:-a,zIndex:ve.length-c},children:[t.jsx("div",{className:"h-full w-full overflow-hidden rounded-full border-4 border-card bg-muted",children:t.jsx("img",{src:u.photo,alt:u.alt,className:"h-full w-full object-cover",loading:"lazy"})}),c===0&&t.jsxs("span",{className:"absolute bottom-1.5 right-1.5 flex h-3.5 w-3.5",children:[t.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-success opacity-60 motion-safe:animate-ping","aria-hidden":!0}),t.jsx("span",{className:"relative inline-flex h-3.5 w-3.5 rounded-full border-2 border-card bg-success"})]})]},u.photo)),e[4]=a,e[5]=o,e[6]=l):l=e[6];let d;return e[7]!==r||e[8]!==l?(d=t.jsx("div",{className:"flex items-end",style:r,children:l}),e[7]=r,e[8]=l,e[9]=d):d=e[9],d}function Ye(s){const e=q.c(6),{href:n,orgId:o}=s;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"h-20",style:{backgroundColor:rs}}),e[0]=i):i=e[0];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{className:"-mt-9 mb-4",children:t.jsx(ls,{})}),e[1]=a):a=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx("h2",{className:"text-lg font-medium leading-6 text-foreground",children:os}),t.jsx("p",{className:"text-sm leading-5 text-muted-foreground",children:is})]}),e[2]=r):r=e[2];let l;return e[3]!==n||e[4]!==o?(l=t.jsx("div",{className:"relative flex h-full w-full items-center justify-center p-10",children:t.jsxs("div",{className:"w-full max-w-[440px] overflow-hidden rounded-3xl border border-border bg-card card-shadow",children:[i,t.jsxs("div",{className:"px-8 pb-8",children:[a,r,t.jsx(as,{href:n,size:"lg",className:"mt-6",orgId:o})]})]})}),e[3]=n,e[4]=o,e[5]=l):l=e[5],l}function cs(s){const e=q.c(13),{className:n,href:o,orgId:i}=s,a=o===void 0?Qe:o;let r;e[0]!==i?(r=()=>ee("commerce_onboarding_meeting_cta_clicked",{placement:"mobile_banner",organization_id:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==n?(l=oe("flex items-center gap-4 rounded-2xl border border-border bg-card p-5 card-shadow transition-colors hover:bg-accent",n),e[2]=n,e[3]=l):l=e[3];let d,u;e[4]===Symbol.for("react.memo_cache_sentinel")?(d={height:44,width:44+2*Math.round(30.799999999999997)},u=ve.map(ds),e[4]=d,e[5]=u):(d=e[4],u=e[5]);let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsxs("span",{className:"relative flex shrink-0 items-center",style:d,children:[u,t.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-3 w-3 rounded-full border-2 border-card bg-success","aria-hidden":!0,style:{zIndex:ve.length+1}})]}),e[6]=c):c=e[6];let p,m;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsxs("span",{className:"flex-1 text-base font-medium leading-5 text-foreground",children:["Precisa de ajuda?",t.jsx("br",{}),"Fale conosco"]}),m=t.jsx(jt,{size:18,className:"shrink-0 text-muted-foreground"}),e[7]=p,e[8]=m):(p=e[7],m=e[8]);let h;return e[9]!==a||e[10]!==r||e[11]!==l?(h=t.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",onClick:r,className:l,children:[c,p,m]}),e[9]=a,e[10]=r,e[11]=l,e[12]=h):h=e[12],h}function ds(s,e){return t.jsx("span",{className:"absolute block h-11 w-11 overflow-hidden rounded-full border-2 border-card",style:{left:e*Math.round(30.799999999999997),zIndex:ve.length-e},children:t.jsx("img",{src:s.photo,alt:s.alt,className:"h-full w-full object-cover",loading:"lazy"})},s.photo)}function St(s){const e=q.c(10),{host:n}=s,o=`https://www.google.com/s2/favicons?domain=${n}&sz=128`;let i,a,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-7 w-7 dark:hidden"}),a=t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-7 w-7 hidden dark:block"}),r=t.jsx("div",{className:"h-6 w-px rotate-12 bg-border","aria-hidden":"true"}),e[0]=i,e[1]=a,e[2]=r):(i=e[0],a=e[1],r=e[2]);let l;e[3]!==o?(l=t.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-white",children:t.jsx("img",{src:o,alt:"",className:"h-5 w-5",loading:"lazy"})}),e[3]=o,e[4]=l):l=e[4];let d;e[5]!==n?(d=t.jsx("span",{className:"text-lg font-medium text-foreground",children:n}),e[5]=n,e[6]=d):d=e[6];let u;return e[7]!==l||e[8]!==d?(u=t.jsxs("div",{className:"flex items-center gap-3",children:[i,a,r,l,d]}),e[7]=l,e[8]=d,e[9]=u):u=e[9],u}const us={workspace:"Preparando seu workspace de commerce...",generic:"Preparando..."};function ms(s){return us[s]}function Je(s){const e=q.c(4),{variant:n}=s;let o;e[0]!==n?(o=ms(n),e[0]=n,e[1]=o):o=e[1];let i;return e[2]!==o?(i=t.jsx("div",{className:"flex justify-center py-4",role:"status","aria-live":"polite",children:t.jsx(Le,{label:o,className:"text-muted-foreground"})}),e[2]=o,e[3]=i):i=e[3],i}function Mo(){const s=q.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ps,{}),s[0]=e):e=s[0],e}const Nt=V.createContext(null),Et=()=>V.useContext(Nt);function se(s){const e=q.c(13);let n,o;e[0]!==s?({visual:o,...n}=s,e[0]=s,e[1]=n,e[2]=o):(n=e[1],o=e[2]);let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i={from:"/commerce-onboarding"},e[3]=i):i=e[3];const a=it(i),{data:r}=ke.useSession(),l=r?.user?.email;let d;e[4]!==a.siteUrl||e[5]!==l?(d=We({siteUrl:a.siteUrl,email:l}),e[4]=a.siteUrl,e[5]=l,e[6]=d):d=e[6];const u=d;let c;e[7]!==u||e[8]!==o?(c=o??t.jsx(Ye,{href:u}),e[7]=u,e[8]=o,e[9]=c):c=e[9];let p;return e[10]!==n||e[11]!==c?(p=t.jsx(Rt,{...n,visual:c}),e[10]=n,e[11]=c,e[12]=p):p=e[12],p}const fs={signUpFailed:"Falha ao criar conta",signInFailed:"Falha ao entrar",authenticationFailed:"Falha na autenticação",resetEmailFailed:"Não foi possível enviar o e-mail de redefinição",otpSendFailed:"Não foi possível enviar o código",invalidCode:"Código inválido",invalidEmail:"E-mail inválido",invalidEmailOrPassword:"E-mail ou senha inválidos. Tente novamente.",accountExists:"Já existe uma conta com este e-mail. Tente entrar em vez de criar uma nova conta.",networkError:"Erro de rede. Verifique sua conexão e tente novamente.",tooManyAttempts:"Muitas tentativas. Aguarde um momento e tente novamente.",invalidOrExpiredCode:"Código inválido ou expirado. Tente novamente.",genericError:"Algo deu errado. Tente novamente.",resetPasswordTitle:"Redefinir sua senha",verificationCodeTitle:"Informe o código de verificação",welcomeTitle:"Bem-vindo à deco",resetPasswordSubtitle:"Enviaremos um link de redefinição",codeSentTo:s=>`Código enviado para ${s}`,defaultSubtitle:"Entre ou crie uma nova conta",resetEmailSent:"Verifique seu e-mail para redefinir a senha.",continueWith:s=>`Continuar com ${s}`,divider:"ou",emailLabel:"E-mail",emailPlaceholder:"Endereço de e-mail",sending:"Enviando...",sendCode:"Enviar código",verificationCodeLabel:"Código de verificação",enterCodePlaceholder:"Informe o código",verifying:"Verificando...",verify:"Verificar",useDifferentEmail:"Usar outro e-mail",sendResetLink:"Enviar link de redefinição",nameLabel:"Nome",namePlaceholder:"Seu nome",passwordLabel:"Senha",forgotPassword:"Esqueceu a senha?",creatingAccount:"Criando conta...",signingIn:"Entrando...",continue:"Continuar",backToSignIn:"Voltar para entrar",signInWithPassword:"Entrar com senha",alreadyHaveAccount:"Já tem uma conta? ",dontHaveAccount:"Não tem uma conta? ",signIn:"Entrar",signUp:"Criar conta",signInWithEmailCode:"Entrar com código por e-mail"};function pe(s){if(!s)return null;const e=ae(s);return e.ok?new URL(e.value).hostname:null}function tt(s){switch(s){case"Enter a website URL.":return"Informe a URL de um site.";case"Use an HTTP or HTTPS website URL.":return"Use uma URL de site HTTP ou HTTPS.";case"Enter a valid website URL.":return"Informe uma URL de site válida.";default:return s}}let nt=!1;function ps(){const s=it({from:"/commerce-onboarding"}),{org:e,siteUrl:n}=s,o=pe(n);return!nt&&Tt()&&(nt=!0,ee("commerce_onboarding_viewed",{site_url:n,domain:o??void 0,...o?{$set:{last_scanned_domain:o}}:{}})),t.jsx(Nt.Provider,{value:o,children:t.jsx(gs,{requestedOrgSlug:e,siteUrl:n})})}function gs(s){const e=q.c(8),{requestedOrgSlug:n,siteUrl:o}=s,{data:i,isPending:a}=ke.useSession(),r=Et();if(a){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(se,{children:t.jsx(Je,{variant:"generic"})}),e[0]=d):d=e[0],d}if(!i){const d=typeof window>"u"?"/commerce-onboarding":`${window.location.pathname}${window.location.search}`;let u;e[1]!==r?(u=r?t.jsx(St,{host:r}):void 0,e[1]=r,e[2]=u):u=e[2];let c;return e[3]!==u?(c=t.jsx(se,{children:t.jsx(kt,{callbackUrl:d,allowAutoLogin:!1,title:"Desbloqueie seu diagnóstico completo",subtitle:null,brand:u,copy:fs})}),e[3]=u,e[4]=c):c=e[4],c}let l;return e[5]!==n||e[6]!==o?(l=t.jsx(hs,{requestedOrgSlug:n,siteUrl:o}),e[5]=n,e[6]=o,e[7]=l):l=e[7],l}function hs(s){const e=q.c(40),{requestedOrgSlug:n,siteUrl:o}=s,i=rt(),a=Ot(),[r,l]=V.useState(null),[d,u]=V.useState(null),c=a.data?.map(ys)??[];let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={mutationFn:xs,retry:!1,onSuccess:f=>{u(f)}},e[0]=p):p=e[0];const m=fe(p);if(a.isPending){let f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(se,{children:t.jsx(Je,{variant:"workspace"})}),e[1]=f):f=e[1],f}if(a.error){let f;return e[2]!==a?(f=t.jsx(Oe,{title:"Não foi possível carregar suas organizações",description:"Tente novamente para continuar a configuração de commerce nesta página.",actionLabel:"Tentar novamente",onRetry:()=>a.refetch()}),e[2]=a,e[3]=f):f=e[3],f}const h=n?c.find(f=>f.slug===n):null;if(h){let f;return e[4]!==h||e[5]!==o?(f=t.jsx(Ie,{org:h,initialSiteUrl:o}),e[4]=h,e[5]=o,e[6]=f):f=e[6],f}if(n){let f;return e[7]!==a?(f=t.jsx(Oe,{title:"Organização não encontrada",description:"Não conseguimos encontrar essa organização na sua conta.",actionLabel:"Tentar novamente",onRetry:()=>a.refetch()}),e[7]=a,e[8]=f):f=e[8],f}if(r){let f;return e[9]!==r||e[10]!==o?(f=t.jsx(Ie,{org:r,initialSiteUrl:o}),e[9]=r,e[10]=o,e[11]=f):f=e[11],f}if(c.length===1&&c[0]){let f;return e[12]!==c[0]||e[13]!==o?(f=t.jsx(Ie,{org:c[0],initialSiteUrl:o}),e[12]=c[0],e[13]=o,e[14]=f):f=e[14],f}if(c.length>1){let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(re,{title:"Escolha uma organização",description:"Selecione onde o diagnóstico de commerce deve continuar."}),e[15]=f):f=e[15];let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=C=>l(C),e[16]=b):b=e[16];let y;return e[17]!==c?(y=t.jsx(se,{children:t.jsxs("div",{className:"grid gap-10",children:[f,t.jsx(Ue,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:t.jsx(Ze,{organizations:c,selectLabel:"Continuar",onSelected:b})})]})}),e[17]=c,e[18]=y):y=e[18],y}if(!d){let f;e[19]!==m?(f=()=>{m.reset(),m.mutate()},e[19]=m,e[20]=f):f=e[20];let b;return e[21]!==m||e[22]!==f?(b=t.jsx(bs,{mutation:m,onRetry:f}),e[21]=m,e[22]=f,e[23]=b):b=e[23],b}const g=d;if(g?.success&&(g.status==="created"||g.status==="joined"||g.status==="already_has_organization")&&g.organization){let f;return e[24]!==g.organization||e[25]!==o?(f=t.jsx(Ie,{org:g.organization,initialSiteUrl:o}),e[24]=g.organization,e[25]=o,e[26]=f):f=e[26],f}if(g?.status==="ambiguous"&&g.organizations&&g.organizations.length>0){let f;e[27]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(re,{title:"Escolha uma organização",description:"Seu e-mail pode acessar mais de uma organização. Escolha onde a configuração de commerce deve continuar."}),e[27]=f):f=e[27];const b=g.domain??void 0;let y;e[28]!==i||e[29]!==o?(y=(w,_)=>{at(),l({...w,slug:_}),i({to:"/commerce-onboarding",search:{org:_,siteUrl:o}})},e[28]=i,e[29]=o,e[30]=y):y=e[30];let C;return e[31]!==g.organizations||e[32]!==b||e[33]!==y?(C=t.jsx(se,{children:t.jsxs("div",{className:"grid gap-10",children:[f,t.jsx(Ue,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:t.jsx(Ze,{organizations:g.organizations,domain:b,onJoined:y})})]})}),e[31]=g.organizations,e[32]=b,e[33]=y,e[34]=C):C=e[34],C}const v=g?.error??"Não conseguimos determinar uma organização de commerce para esta conta.";let j;e[35]!==m?(j=()=>{u(null),m.reset()},e[35]=m,e[36]=j):j=e[36];let x;return e[37]!==v||e[38]!==j?(x=t.jsx(Oe,{title:"O onboarding de commerce precisa de suporte",description:v,actionLabel:"Tentar novamente",onRetry:j}),e[37]=v,e[38]=j,e[39]=x):x=e[39],x}async function xs(){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&&at(),e}function ys(s){return{id:s.id,name:s.name,slug:s.slug,logo:s.logo??null}}function bs(s){const e=q.c(7),{mutation:n,onRetry:o}=s,i=V.useRef(!1);let a;e[0]!==n?(a=u=>{!u||i.current||(i.current=!0,n.mutate())},e[0]=n,e[1]=a):a=e[1];const r=a;if(n.error){let u;return e[2]!==o?(u=t.jsx(Oe,{title:"Onboarding de commerce indisponível",description:"Não foi possível preparar uma organização para a configuração de commerce. Tente novamente por esta página ou fale com o suporte.",actionLabel:"Tentar novamente",onRetry:o}),e[2]=o,e[3]=u):u=e[3],u}let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Je,{variant:"generic"}),e[4]=l):l=e[4];let d;return e[5]!==r?(d=t.jsx(se,{children:t.jsx("div",{ref:r,children:l})}),e[5]=r,e[6]=d):d=e[6],d}function re(s){const e=q.c(8),{title:n,description:o}=s,i=Et();let a;e[0]!==i?(a=i?t.jsx(St,{host:i}):t.jsxs("div",{children:[t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),e[0]=i,e[1]=a):a=e[1];let r;e[2]!==o||e[3]!==n?(r=(n||o)&&t.jsxs("div",{className:"space-y-2",children:[n&&t.jsx("h1",{className:"text-2xl font-medium leading-8",children:n}),o&&t.jsx("p",{className:"text-base text-muted-foreground leading-6",children:o})]}),e[2]=o,e[3]=n,e[4]=r):r=e[4];let l;return e[5]!==a||e[6]!==r?(l=t.jsxs("div",{className:"grid gap-10",children:[a,r]}),e[5]=a,e[6]=r,e[7]=l):l=e[7],l}function Oe(s){const e=q.c(9),{title:n,description:o,actionLabel:i,onRetry:a}=s;let r;e[0]!==o||e[1]!==n?(r=t.jsx(re,{title:n,description:o}),e[0]=o,e[1]=n,e[2]=r):r=e[2];let l;e[3]!==i||e[4]!==a?(l=t.jsx(H,{type:"button",size:"xl",className:"w-full",onClick:a,children:i}),e[3]=i,e[4]=a,e[5]=l):l=e[5];let d;return e[6]!==r||e[7]!==l?(d=t.jsx(se,{children:t.jsxs("div",{className:"grid gap-10",children:[r,l]})}),e[6]=r,e[7]=l,e[8]=d):d=e[8],d}function vs(s){return s.content?.find(e=>e.text)?.text??"A configuração do Commerce Discovery falhou."}function we(s){const e=s;if(e.isError)throw new Error(vs(e));return e.structuredContent??s}function Ie(s){const e=q.c(11),{org:n,initialSiteUrl:o}=s,{data:i}=ke.useSession(),a=i?.user?.email;let r;e[0]!==o||e[1]!==a?(r=We({siteUrl:o,email:a}),e[0]=o,e[1]=a,e[2]=r):r=e[2];const l=r;let d;e[3]!==l||e[4]!==n.id?(d=t.jsx(Ye,{href:l,orgId:n.id}),e[3]=l,e[4]=n.id,e[5]=d):d=e[5];const u=d;let c;return e[6]!==o||e[7]!==u||e[8]!==n||e[9]!==i?.user?.email?(c=t.jsx(st,{children:p=>{const{reset:m}=p;return t.jsx(ot,{fallback:h=>{const{error:g,resetError:v}=h;return t.jsx(se,{visual:u,children:t.jsx(js,{orgName:n.name,message:g instanceof Error?g.message:"Não foi possível verificar a configuração do Commerce Discovery.",onRetry:()=>{m(),v()}})})},children:t.jsx(V.Suspense,{fallback:t.jsx(wt,{visual:u}),children:t.jsx(Cs,{org:n,initialSiteUrl:o,sessionEmail:i?.user?.email},`${n.id}:${o??""}`)})})}}),e[6]=o,e[7]=u,e[8]=n,e[9]=i?.user?.email,e[10]=c):c=e[10],c}function wt(s){const e=q.c(3),{visual:n}=s;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[t.jsx(re,{}),t.jsx(Be,{})]}),e[0]=o):o=e[0];let i;return e[1]!==n?(i=t.jsx(se,{align:"fill",visual:n,children:o}),e[1]=n,e[2]=i):i=e[2],i}function js(s){const e=q.c(10),{orgName:n,message:o,onRetry:i}=s,a=`A configuração de commerce continuará em ${n}.`;let r;e[0]!==a?(r=t.jsx(re,{title:"Diagnóstico de commerce",description:a}),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==o?(l=t.jsx(je,{message:o}),e[2]=o,e[3]=l):l=e[3];let d;e[4]!==i?(d=t.jsx(H,{type:"button",size:"xl",className:"w-full",onClick:i,children:"Tentar novamente"}),e[4]=i,e[5]=d):d=e[5];let u;return e[6]!==r||e[7]!==l||e[8]!==d?(u=t.jsxs("div",{className:"grid gap-10",children:[r,l,d]}),e[6]=r,e[7]=l,e[8]=d,e[9]=u):u=e[9],u}function Cs({org:s,initialSiteUrl:e,sessionEmail:n}){const o=rt(),i=Re({connectionId:lt,orgId:s.id,orgSlug:s.slug}),[a,r]=V.useState(e??""),[l,d]=V.useState(null),[u,c]=V.useState(null),p=V.useRef(!1),m=De.COMMERCE_DISCOVERY(s.id),h=Pt(s.id),g=ge({queryKey:Y.commerceDiscoveryConnection(s.id,m),queryFn:async()=>{const E=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:m}});return we(E)},retry:!1}),v=ge({queryKey:Y.commerceDiscoveryVirtualMcp(s.id,h),queryFn:async()=>{const E=await i.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:h}});return we(E)},retry:!1}),j=fe({mutationFn:async E=>{const T=await i.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:E}});return we(T)},retry:!1,onSuccess:(E,T)=>{ee("commerce_onboarding_setup_succeeded",{domain:pe(T)??void 0,organization_id:s.id}),d(E),c(null),g.refetch(),v.refetch()},onError:(E,T)=>{ee("commerce_onboarding_setup_failed",{domain:pe(T)??void 0,organization_id:s.id,error:E instanceof Error?E.message:String(E)}),c(E instanceof Error?E.message:"A configuração do Commerce Discovery falhou.")}}),x=fe({mutationFn:async E=>{const T=await i.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:E}});return we(T)},retry:!1}),[f,b]=V.useState(null),y=!!g.data.item&&!!v.data.item,C=g.data.item,w=typeof C?.metadata?.siteUrl=="string"?C.metadata.siteUrl:void 0,S=Zt(e||a||"",w),I=y&&S,O=e||a||w||"",A=We({siteUrl:O,email:n}),N=t.jsx(Ye,{href:A,orgId:s.id}),L=E=>{const T=ae(E);if(!T.ok){c(tt(T.error));return}c(null),j.mutate(T.value)},z=E=>{!E||p.current||I||!e||(p.current=!0,L(e))},P=E=>{E.preventDefault();const T=ae(a);T.ok&&ee("commerce_onboarding_site_url_submitted",{domain:new URL(T.value).hostname,organization_id:s.id}),L(a)},F=l?.reportApp??{connectionId:m,virtualMcpId:h,toolName:Ut},M=async()=>{b(null),ee("commerce_onboarding_open_report_clicked",{domain:pe(O)??void 0,organization_id:s.id});const E=ae(O);if(E.ok)try{const T=await x.mutateAsync(E.value);if(!T.triggered){ee("commerce_onboarding_run_failed",{domain:pe(O)??void 0,organization_id:s.id,error:T.reason??"not_triggered"}),b("Não foi possível gerar o relatório para este site. Recarregue a página e tente novamente.");return}}catch(T){ee("commerce_onboarding_run_failed",{domain:pe(O)??void 0,organization_id:s.id,error:T instanceof Error?T.message:String(T)}),b("Algo deu errado ao gerar seu relatório. Tente novamente em instantes.");return}localStorage.setItem(At.sidebarOpen(),JSON.stringify(!1)),o({to:"/$org/$taskId",params:{org:s.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:F.virtualMcpId,main:Lt(F.connectionId,F.toolName),chat:0}})};if(I)return t.jsx(_s,{org:s,reportApp:F,onOpenReport:M,isSubmitting:x.isPending,error:f,meetingUrl:A,meetingVisual:N,siteUrl:O});if(j.isPending)return t.jsx(wt,{visual:N});if(e){const E=ae(e);return E.ok?t.jsx(se,{visual:N,children:t.jsxs("div",{ref:z,className:"grid gap-10",children:[t.jsx(re,{title:"Diagnóstico de commerce",description:`O Commerce Discovery está sendo preparado para ${E.value}.`}),u?t.jsxs(t.Fragment,{children:[t.jsx(je,{message:u}),t.jsx(Pe,{siteUrl:a,error:null,isSubmitting:j.isPending,onSiteUrlChange:r,onSubmit:P})]}):t.jsx(Be,{})]})}):t.jsx(se,{visual:N,children:t.jsxs("div",{className:"grid gap-10",children:[t.jsx(re,{title:"Diagnóstico de commerce",description:`A configuração de commerce continuará em ${s.name}.`}),t.jsx(je,{message:tt(E.error)}),t.jsx(Pe,{siteUrl:a,error:u,isSubmitting:j.isPending,onSiteUrlChange:r,onSubmit:P})]})})}return t.jsx(se,{visual:N,children:t.jsxs("div",{className:"grid gap-10",children:[t.jsx(re,{title:"Diagnóstico de commerce",description:`A configuração de commerce continuará em ${s.name}.`}),t.jsx(Pe,{siteUrl:a,error:u,isSubmitting:j.isPending,onSiteUrlChange:r,onSubmit:P})]})})}function Pe(s){const e=q.c(20),{siteUrl:n,error:o,isSubmitting:i,onSiteUrlChange:a,onSubmit:r}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:"URL do site"}),e[0]=l):l=e[0];let d;e[1]!==a?(d=j=>a(j.target.value),e[1]=a,e[2]=d):d=e[2];const u=!!o;let c;e[3]!==i||e[4]!==n||e[5]!==d||e[6]!==u?(c=t.jsx(ye,{id:"commerce-site-url",type:"text",inputMode:"url",value:n,onChange:d,placeholder:"https://example.com","aria-invalid":u,disabled:i}),e[3]=i,e[4]=n,e[5]=d,e[6]=u,e[7]=c):c=e[7];let p;e[8]!==o?(p=o?t.jsx(je,{message:o}):null,e[8]=o,e[9]=p):p=e[9];let m;e[10]!==c||e[11]!==p?(m=t.jsxs("div",{className:"grid gap-2",children:[l,c,p]}),e[10]=c,e[11]=p,e[12]=m):m=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(ct,{size:16}),e[13]=h):h=e[13];let g;e[14]!==i?(g=t.jsxs(H,{type:"submit",size:"xl",className:"w-full",disabled:i,children:["Continuar",h]}),e[14]=i,e[15]=g):g=e[15];let v;return e[16]!==r||e[17]!==m||e[18]!==g?(v=t.jsxs("form",{className:"grid gap-4",onSubmit:r,children:[m,g]}),e[16]=r,e[17]=m,e[18]=g,e[19]=v):v=e[19],v}function _s(s){const e=q.c(27),{org:n,reportApp:o,onOpenReport:i,isSubmitting:a,error:r,meetingUrl:l,meetingVisual:d,siteUrl:u}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(re,{}),e[0]=c):c=e[0];let p;e[1]!==n||e[2]!==o.connectionId||e[3]!==u?(p=t.jsx(ns,{org:n,cdConnectionId:o.connectionId,siteUrl:u}),e[1]=n,e[2]=o.connectionId,e[3]=u,e[4]=p):p=e[4];let m;e[5]!==l||e[6]!==n.id?(m=t.jsx(cs,{className:"md:hidden",href:l,orgId:n.id}),e[5]=l,e[6]=n.id,e[7]=m):m=e[7];let h;e[8]!==r?(h=r?t.jsx(je,{message:r}):null,e[8]=r,e[9]=h):h=e[9];const g=a||!o.virtualMcpId,v=a?"Abrindo relatório...":"Ver relatório completo";let j;e[10]!==a?(j=a?null:t.jsx(ct,{size:18}),e[10]=a,e[11]=j):j=e[11];let x;e[12]!==i||e[13]!==g||e[14]!==v||e[15]!==j?(x=t.jsxs(H,{type:"button",size:"xl",className:"w-full rounded-2xl text-base font-medium",onClick:i,disabled:g,children:[v,j]}),e[12]=i,e[13]=g,e[14]=v,e[15]=j,e[16]=x):x=e[16];let f;e[17]!==m||e[18]!==h||e[19]!==x?(f=t.jsxs("div",{className:"flex shrink-0 flex-col gap-3 md:mt-8",children:[m,h,x]}),e[17]=m,e[18]=h,e[19]=x,e[20]=f):f=e[20];let b;e[21]!==p||e[22]!==f?(b=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[c,p,f]}),e[21]=p,e[22]=f,e[23]=b):b=e[23];let y;return e[24]!==d||e[25]!==b?(y=t.jsx(se,{align:"fill",visual:d,children:b}),e[24]=d,e[25]=b,e[26]=y):y=e[26],y}function je(s){const e=q.c(2),{message:n}=s;let o;return e[0]!==n?(o=t.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:n}),e[0]=n,e[1]=o):o=e[1],o}export{Mo as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as v,D as w,K as z,k as M,j as s,r as T,B as I,l as L}from"./index-BIvxcsMT.js";import{a as S,b as D,c as E,d as R,e as _}from"./dialog-1PlbGnxl.js";import{S as $}from"./chat-context-BEYxfvRE.js";import{i as A}from"./Check-DhEV1E4F.js";import{a as B}from"./Copy01-Cm6DymEJ.js";import{u as F}from"./studio-tools-DGpKprde.js";const y={online:!1,capabilities:[],ready:!1};function K(a){const e=v.c(9),{org:n}=w(),i=F(),o=a?.fast??!1;let t;e[0]!==n.id?(t=z.currentLink(n.id),e[0]=n.id,e[1]=t):t=e[1];let l;e[2]!==i?(l=async()=>{const u=await i.call("LINK_CURRENT_GET",{});return u?{...u,ready:!0}:{...y,ready:!0}},e[2]=i,e[3]=l):l=e[3];const d=o?1e3:1e4,g=o?2e3:15e3;let r;e[4]!==t||e[5]!==l||e[6]!==d||e[7]!==g?(r={queryKey:t,queryFn:l,staleTime:d,refetchInterval:g,refetchOnWindowFocus:!0},e[4]=t,e[5]=l,e[6]=d,e[7]=g,e[8]=r):r=e[8];const{data:c}=M(r);return c??y}function O(a){const e=v.c(3),{size:n}=a,i=n===void 0?16:n;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("path",{d:"M13 12L18.5 5M7.63965 3L12.5 12L13.6865 3M4.48381 6.71679L11.9872 12M3 12L11.9872 12.473M12.2244 13.177L7 20M4.84194 16.8682L11.2824 12.9758M11.5 21L12.665 13.177M21 14L13.1846 12.668M21 10.5788L13 12.3223M16.779 19.646L12.8876 13.3772M19.3566 18.207L13.313 12.9893"}),e[0]=o):o=e[0];let t;return e[1]!==i?(t=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:i,height:i,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o}),e[1]=i,e[2]=t):t=e[2],t}function P(a){const e=v.c(3),{size:n}=a,i=n===void 0?16:n;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("path",{clipRule:"evenodd",d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"}),e[0]=o):o=e[0];let t;return e[1]!==i?(t=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:i,height:i,fill:"currentColor",fillRule:"evenodd","aria-hidden":"true",children:o}),e[1]=i,e[2]=t):t=e[2],t}const N="bunx decocms@latest link",k=[{capability:"claude-code",label:"Claude Code",description:"Runs through the Claude Code CLI",icon:s.jsx(O,{size:18})},{capability:"codex",label:"Codex",description:"Runs through the Codex CLI",icon:s.jsx(P,{size:18})}];function U(a){return k.filter(e=>a.includes(e.capability)).map(e=>e.label)}function J(a){const e=v.c(23),{open:n,onOpenChange:i}=a;let o;e[0]!==n?(o={fast:n},e[0]=n,e[1]=o):o=e[1];const t=K(o),[l,d]=T.useState(!1),g=t.hostname??t.machineId??"Your desktop",r=t.online?`Connected to ${g}`:"Connect your desktop";let c;e[2]!==r?(c=s.jsx(S,{children:r}),e[2]=r,e[3]=c):c=e[3];const u=t.online?"This machine provides the following local agents.":"Run this command in your desktop terminal. The dialog will close once your desktop is online.";let m;e[4]!==u?(m=s.jsx(D,{children:u}),e[4]=u,e[5]=m):m=e[5];let x;e[6]!==c||e[7]!==m?(x=s.jsxs(E,{children:[c,m]}),e[6]=c,e[7]=m,e[8]=x):x=e[8];let f;e[9]!==l||e[10]!==t.online?(f=!t.online&&s.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-sm",children:[s.jsx("span",{className:"flex-1",children:N}),s.jsx(I,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard.writeText(N),d(!0),setTimeout(()=>d(!1),1500)},children:l?s.jsx(A,{size:14}):s.jsx(B,{size:14})})]}),e[9]=l,e[10]=t.online,e[11]=f):f=e[11];let p;e[12]!==t.capabilities||e[13]!==t.online?(p=t.online?s.jsx("div",{className:"flex flex-col gap-3 text-sm",children:s.jsx("div",{className:"flex flex-col gap-2",children:k.map(b=>{const C=t.capabilities.includes(b.capability);return s.jsxs("div",{className:L("flex items-center gap-3 rounded-md border px-3 py-2",C?"border-border bg-background text-foreground":"border-border/60 bg-muted/40 text-muted-foreground"),children:[s.jsx("div",{className:L("flex size-6 items-center justify-center",C?"text-foreground":"text-muted-foreground"),children:b.icon}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-medium",children:b.label}),s.jsx("p",{className:"text-xs text-muted-foreground",children:C?b.description:"Not detected"})]}),s.jsx("span",{className:L("size-2 rounded-full",C?"bg-success":"bg-muted-foreground/30")})]},b.capability)})})}):s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx($,{size:"sm"}),"Waiting for desktop…"]}),e[12]=t.capabilities,e[13]=t.online,e[14]=p):p=e[14];let h;e[15]!==x||e[16]!==f||e[17]!==p?(h=s.jsxs(R,{className:"sm:max-w-md",children:[x,f,p]}),e[15]=x,e[16]=f,e[17]=p,e[18]=h):h=e[18];let j;return e[19]!==i||e[20]!==n||e[21]!==h?(j=s.jsx(_,{open:n,onOpenChange:i,children:h}),e[19]=i,e[20]=n,e[21]=h,e[22]=j):j=e[22],j}export{J as C,O as a,P as b,K as u,U as v};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as _}from"./connection-slug-eyAPH6o3.js";import{c as R,D as $,aV as k,K as D,l as E,j as x}from"./index-BIvxcsMT.js";import{u as K}from"./use-registry-connections-DPvd05bN.js";import{c as Q}from"./use-organization-settings-B87409No.js";import{S as w}from"./constants-C8_Swa4x.js";import{u as F}from"./useInfiniteQuery-Cd0Nyb0J.js";import{c as H}from"./use-mcp-client-DbN0o_29.js";import{i as V,f as q}from"./extract-connection-data-DXmsDXzN.js";import{C as G}from"./card-Cd_UT82w.js";import{I as U}from"./integration-icon-DWcR_mMd.js";function ce(s){const e=new Map;for(const o of s){const l=_(o),r=e.get(l);r?r.push(o):e.set(l,[o])}const t=[],u=new Set;for(const o of s){const l=_(o);if(u.has(l))continue;u.add(l);const r=e.get(l),m=r[0];r.length===1?t.push({type:"single",connection:m}):t.push({type:"group",key:l,icon:m.icon,title:m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.title,connections:r})}return t}function ue(){const s=R.c(6),e=K(),t=Q(),u=$().project.enabledPlugins??[];let o;if(s[0]!==u||s[1]!==t||s[2]!==e){let l;s[4]!==t?(l=r=>t(r.id),s[4]=t,s[5]=l):l=s[5],o=e.filter(l).map(X),u.includes("private-registry")&&t(w)&&o.push({id:w,title:"Private Registry",icon:null}),s[0]=u,s[1]=t,s[2]=e,s[3]=o}else o=s[3];return o}function X(s){return{id:s.id,title:s.title,icon:s.icon}}const Y=24,S=3;function A(s){return s.id.includes("community-registry")}function z(s){const e=s?.trim();if(e)return{operator:"or",conditions:[{field:["title"],operator:"contains",value:e},{field:["description"],operator:"contains",value:e},{field:["name"],operator:"contains",value:e},{field:["server","title"],operator:"contains",value:e}]}}function T(s,e,t,u,o){const l=s.map(c=>c.id).sort().join(","),r=z(o),{data:m,fetchNextPage:d,hasNextPage:f,isFetchingNextPage:p,isLoading:P}=F({queryKey:D.storeDiscovery(e,`${l}:${o??""}`),queryFn:async({pageParam:c})=>{const n=c??{};return await Promise.all(s.map(async i=>{const y=n[i.id];if(y==="EXHAUSTED")return{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:[]};const j=V(i.id,e);let h;for(let v=0;v<S;v++){let C=null;try{C=await H({connectionId:i.id,orgId:e,orgSlug:t});const I={limit:Y};y&&(I.cursor=y),r&&(I.where=r);const b=await C.callTool({name:j,arguments:I}),N=b.structuredContent??b,M=N.nextCursor||N.cursor||void 0,L=q(N?[N]:[]);return{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:L,nextCursor:M}}catch(I){h=I}finally{await C?.close().catch(()=>{})}}return console.warn(`[useMergedStoreDiscovery] Registry "${i.title}" (${i.id}) failed after ${S} attempts:`,h),{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:[]}}))},initialPageParam:{},getNextPageParam:c=>{const n={};let a=!1;for(const i of c)i.registryId&&(i.nextCursor?(n[i.registryId]=i.nextCursor,a=!0):n[i.registryId]="EXHAUSTED");return a?n:void 0},staleTime:3600*1e3,placeholderData:k,retry:!1,enabled:s.length>0}),g=[];if(m?.pages)for(const c of m.pages)for(const n of c)for(const a of n.items)g.push({...a,_sourceName:a._sourceName??n.registryTitle,_sourceIcon:a._sourceIcon??n.registryIcon,_registryId:a._registryId??n.registryId});return{items:g,hasMore:f??!1,isLoadingMore:p,isInitialLoading:P,fetchNextPage:()=>{f&&!p&&d()}}}function fe(s,e){const t=R.c(16),{org:u}=$();let o;t[0]!==s?(o=s.filter(Z),t[0]=s,t[1]=o):o=t[1];const l=o;let r;t[2]!==s?(r=s.filter(W),t[2]=s,t[3]=r):r=t[3];const m=r,d=T(l,u.id,u.slug,!0,e),f=T(m,u.id,u.slug,!0,e);let p;if(t[4]!==f.items||t[5]!==d.items){const y=new Set;p=[];const j=[...d.items,...f.items];for(const h of j){const v=`${h._registryId}:${h.id}`;y.has(v)||(y.add(v),p.push(h))}t[4]=f.items,t[5]=d.items,t[6]=p}else p=t[6];const P=d.isInitialLoading||f.isInitialLoading,g=d.isLoadingMore||f.isLoadingMore,c=d.hasMore||f.hasMore;let n;t[7]!==f||t[8]!==d?(n=()=>{d.hasMore&&d.fetchNextPage(),f.hasMore&&f.fetchNextPage()},t[7]=f,t[8]=d,t[9]=n):n=t[9];const a=n;let i;return t[10]!==c||t[11]!==P||t[12]!==g||t[13]!==p||t[14]!==a?(i={items:p,hasMore:c,isLoadingMore:g,isInitialLoading:P,loadMore:a},t[10]=c,t[11]=P,t[12]=g,t[13]=p,t[14]=a,t[15]=i):i=t[15],i}function W(s){return A(s)}function Z(s){return!A(s)}function de(s){const e=R.c(37),{connection:t,onClick:u,headerActions:o,headerActionsAlwaysVisible:l,body:r,footer:m,className:d,fallbackIcon:f}=s,p=l===void 0?!1:l,P=u&&"hover:bg-muted/50";let g;e[0]!==d||e[1]!==P?(g=E("cursor-pointer transition-colors group overflow-hidden flex flex-col h-full",P,d),e[0]=d,e[1]=P,e[2]=g):g=e[2];let c;e[3]!==t.icon||e[4]!==t.title||e[5]!==f?(c=x.jsx(U,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:f}),e[3]=t.icon,e[4]=t.title,e[5]=f,e[6]=c):c=e[6];let n;e[7]!==o||e[8]!==p?(n=o&&x.jsx("div",{className:E("transition-opacity",!p&&"sm:opacity-0 sm:group-hover:opacity-100"),onClick:J,children:o}),e[7]=o,e[8]=p,e[9]=n):n=e[9];let a;e[10]!==n?(a=x.jsx("div",{className:"relative",children:n}),e[10]=n,e[11]=a):a=e[11];let i;e[12]!==c||e[13]!==a?(i=x.jsxs("div",{className:"flex items-start justify-between",children:[c,a]}),e[12]=c,e[13]=a,e[14]=i):i=e[14];let y;e[15]!==t.title?(y=x.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:t.title}),e[15]=t.title,e[16]=y):y=e[16];const j=t.description||"No description";let h;e[17]!==j?(h=x.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:j}),e[17]=j,e[18]=h):h=e[18];let v;e[19]!==h||e[20]!==y?(v=x.jsxs("div",{className:"flex flex-col gap-1",children:[y,h]}),e[19]=h,e[20]=y,e[21]=v):v=e[21];let C;e[22]!==r?(C=r&&x.jsx("div",{children:r}),e[22]=r,e[23]=C):C=e[23];let I;e[24]!==v||e[25]!==C||e[26]!==i?(I=x.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[i,v,C]}),e[24]=v,e[25]=C,e[26]=i,e[27]=I):I=e[27];let b;e[28]!==m?(b=m&&x.jsx("div",{className:"border-t border-border mt-auto",children:x.jsx("div",{className:"h-14 flex items-center p-4.5",onClick:B,children:m})}),e[28]=m,e[29]=b):b=e[29];let N;e[30]!==I||e[31]!==b?(N=x.jsxs("div",{className:"flex flex-col flex-1",children:[I,b]}),e[30]=I,e[31]=b,e[32]=N):N=e[32];let M;return e[33]!==u||e[34]!==N||e[35]!==g?(M=x.jsx(G,{className:g,onClick:u,children:N}),e[33]=u,e[34]=N,e[35]=g,e[36]=M):M=e[36],M}function B(s){return s.stopPropagation()}function J(s){return s.stopPropagation()}export{de as C,fe as a,ce as g,ue as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as he,ay as Ie,a$ as Ae,s as le,aw as $e,c as P,j as t,i as ge,B as V,r as q,l as je,D as J,q as De,K as ne,b as Y,Z as ce,z as Pe,b0 as Oe,E as Me,e as ze,b1 as Ee,m as Ve,p as Ue,n as Re,t as X,b2 as Fe}from"./index-BIvxcsMT.js";import{a as Le}from"./extract-connection-data-DXmsDXzN.js";import{E as ve}from"./empty-state-CKmzL0iR.js";import{E as Be,c as He,r as Ge,b as We,d as Xe}from"./connection-form-helpers-Bx2EyqE0.js";import{c as qe,S as Ke,V as Qe}from"./index-BnU8c8Ro.js";import{u as be,T as Je}from"./tools-list-D-u8vbQL.js";import{u as Ye}from"./use-members-CJvmy-r3.js";import{A as Ze}from"./avatar-BeEkEhV9.js";import{a as Ne,b as ye,u as et}from"./use-connection-rw8Y5wYH.js";import{u as _e}from"./use-mcp-client-DbN0o_29.js";import{a as tt}from"./use-mcp-tools-BaQM5Bz7.js";import{a as st}from"./use-mcp-prompts-k9BBdGe-.js";import{i as nt,a as ot}from"./mcp-oauth-BFb5Mr2N.js";import{I as oe}from"./integration-icon-DWcR_mMd.js";import{s as it}from"./Plus-DX9uB6jT.js";import{E as at,G as rt,am as lt,ab as ct}from"./agent-icon-CuxkxUe-.js";import{a as Ce,s as dt}from"./Settings02-CZ9vMUyw.js";import{s as ae}from"./Trash01-CAEn55T5.js";import{d as mt,c as ut,b as xt,S as pt,a as ft}from"./sheet-DMsXF2a5.js";import{F as L,b as B,c as H,d as E,e as G,f as ht,a as gt}from"./form-DY5CJF6A.js";import{I as W}from"./input-C-5bkxwu.js";import{u as jt,D as vt}from"./use-delete-connection-GWWQ0NwP.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-CDUo4bJg.js";import{u as kt}from"./studio-tools-DGpKprde.js";import{u as Tt}from"./use-virtual-mcp-st0OLLtk.js";import{i as Se}from"./ChevronRight-BP1EbKKr.js";import{a as we}from"./Users03-DHP7OUDR.js";import{T as ee,a as It,b as te,c as At}from"./tabs-mPJyea1e.js";import{g as ke}from"./connection-slug-eyAPH6o3.js";import{n as $t}from"./ZapSquare-DBjTUciD.js";import{c as Dt}from"./Tool01-DGnLcysQ.js";import{g as re,M as Pt}from"./types-DUULP3Cg.js";import{C as Ot}from"./collection-search-_ltIvUcU.js";import{C as Mt}from"./card-Cd_UT82w.js";import{B as zt}from"./badge-EC_FS1hJ.js";import{a as Et,b as Vt,D as Ut,c as de}from"./dropdown-menu-DgucD0Wn.js";import{d as me,S as ue,a as xe,b as pe,c as F}from"./select-XC9B8kYb.js";import{i as Rt}from"./CheckCircle-CbuPUNoj.js";import{t as Ft}from"./ChevronDown-BJvvkmIr.js";import{n as Lt}from"./XCircle-C94QFqN0.js";import{s as se}from"./Star01-7qhyucrX.js";import{s as Bt}from"./XClose-CQikaAXa.js";import"./constants-C8_Swa4x.js";import"./index-BeJ1yeue.js";import"./sidebar-BxApc71_.js";import"./LayoutLeft-C8PdEJOQ.js";import"./use-mobile-CdswWdV_.js";import"./tooltip-BGL3A5jy.js";import"./ZoomOut-DltoXGbL.js";import"./Key01-D8bQG_zp.js";import"./auth-By4coGKl.js";import"./use-registry-connections-DPvd05bN.js";import"./use-organization-settings-B87409No.js";import"./index-3pMCJF1F.js";import"./index-D2iM60An.js";import"./index-Du424YAy.js";import"./popover-BnhIWYgB.js";import"./Check-DhEV1E4F.js";import"./SearchMd-DWSBWjan.js";import"./use-create-virtual-mcp-B_ygxy0B.js";import"./use-navigate-to-agent-yzOIB4ca.js";import"./Eye-CtocRVwR.js";import"./use-org-auth-client-DQwimkN2.js";import"./User01-IYcmkjnc.js";import"./use-collections-DaNfbX0Q.js";import"./AlertCircle-hfr9WJXe.js";import"./SwitchHorizontal01-sG-IqCt6.js";import"./ArrowUpRight-DBXurizV.js";import"./ChevronUp-CVqQKtsY.js";import"./Circle-BnMDtDeu.js";import"./Stars02-CFivD_f8.js";import"./Loading02-DejqZGnO.js";import"./Copy01-Cm6DymEJ.js";import"./DotsVertical-BU3qKzJo.js";import"./Globe01-CxIEuzOP.js";import"./FilterLines-XaejSF3d.js";import"./Globe04-DZ-Pm9xo.js";import"./HardDrive-C2sIA93N.js";import"./LinkExternal01-D58rAWvm.js";import"./List-vf0HKUEp.js";import"./Monitor01-CodDwsVO.js";import"./Sun-CHp4Y1Dq.js";import"./Palette-CgTelSEQ.js";import"./Play-Dh4_54hC.js";import"./SearchLg-D0ZqoPSb.js";import"./Shield01-DvUXE0jO.js";import"./Stars01-DN1mvd59.js";import"./Upload01-DKn5tYXN.js";import"./Users01-0WxprMle.js";import"./X-BWG-JTku.js";import"./Zap-DeHaXJHA.js";import"./label-CuPUA6lI.js";import"./alert-dialog-BLM89Cw2.js";const Ht=he({scopes:$e(le()).describe("List of scopes available"),stateSchema:Ie(le(),Ae()).describe("JSON Schema (draft-07) defining the state structure")}),Gt=[{name:"MCP_CONFIGURATION",inputSchema:he({}),outputSchema:Ht}];function Wt(s){const e=P.c(46),{instance:n,onConfigure:i,onAuthenticate:a,onDelete:o,onToggleStatus:r}=s;let d;e[0]!==n.id?(d={connectionId:n.id},e[0]=n.id,e[1]=d):d=e[1];const l=be(d),x=!(n.connection_type==="VIRTUAL")&&l.supportsOAuth&&!l.isAuthenticated,p=n.status!=="active",c=x||p?"border-destructive/50 bg-destructive/5":"border-transparent";let h;e[2]!==c?(h=je("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",c),e[2]=c,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]!==a?(N=x&&t.jsx(V,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>a(n),children:"Authorize"}),e[16]=n,e[17]=x,e[18]=a,e[19]=N):N=e[19];let T;e[20]!==n||e[21]!==p||e[22]!==r?(T=p?t.jsxs(V,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>r(n,"active"),children:[t.jsx(at,{size:13}),"Enable"]}):t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>r(n,"inactive"),title:"Disable",children:t.jsx(rt,{size:13})}),e[20]=n,e[21]=p,e[22]=r,e[23]=T):T=e[23];let S;e[24]!==n||e[25]!==i?(S=()=>i(n),e[24]=n,e[25]=i,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(V,{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(V,{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 Xt(s){const e=P.c(15),{instance:n,onConfigure:i}=s;let a;e[0]!==n.icon||e[1]!==n.title?(a=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=a):a=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 r;e[5]!==n||e[6]!==i?(r=()=>i(n),e[5]=n,e[6]=i,e[7]=r):r=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Ce,{size:13}),e[8]=d):d=e[8];let l;e[9]!==r?(l=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:r,title:"Configure",children:d})}),e[9]=r,e[10]=l):l=e[10];let u;return e[11]!==a||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:[a,o,l]}),e[11]=a,e[12]=o,e[13]=l,e[14]=u):u=e[14],u}function qt(s){const e=P.c(27),{instances:n,onConfigure:i,onAuthenticate:a,onDelete:o,onToggleStatus:r,onAdd:d,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 c;e[4]!==l||e[5]!==d||e[6]!==p?(c=t.jsxs(V,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:d,disabled:l,children:[p,"Add instance"]}),e[4]=l,e[5]=d,e[6]=p,e[7]=c):c=e[7];let h;e[8]!==x||e[9]!==c?(h=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[x,c]}),e[8]=x,e[9]=c,e[10]=h):h=e[10];let g;if(e[11]!==n||e[12]!==a||e[13]!==i||e[14]!==o||e[15]!==r){let j;e[17]!==a||e[18]!==i||e[19]!==o||e[20]!==r?(j=N=>t.jsx(q.Suspense,{fallback:t.jsx(Xt,{instance:N,onConfigure:i}),children:t.jsx(Wt,{instance:N,onConfigure:i,onAuthenticate:a,onDelete:o,onToggleStatus:r})},N.id),e[17]=a,e[18]=i,e[19]=o,e[20]=r,e[21]=j):j=e[21],g=n.map(j),e[11]=n,e[12]=a,e[13]=i,e[14]=o,e[15]=r,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}function Kt(s,e=3){const n=new Map;for(const i of s){if(!i.isError)continue;const a=(i.errorMessage??"").trim()||"Unknown error";n.set(a,(n.get(a)??0)+1)}return[...n.entries()].map(([i,a])=>({message:i,count:a})).sort((i,a)=>a.count-i.count).slice(0,e)}const Qt=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function Jt(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 Yt={calls:{label:"Tool calls"},errors:{label:"Errors"}};function Zt(s){const e=P.c(1),{connectionId:n,orgId:i,timeframe:a}=s,o=kt(),r=Jt(a),{data:d}=De({queryKey:ne.connectionActivity(n,a,i),queryFn:async()=>await o.call("MONITORING_LOGS_LIST",{startDate:r.startDate.toISOString(),endDate:r.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}),staleTime:3e5}),l=bt(d?.logs??[],r),u=l.data,x=l.totalCalls>0,p=Kt(d?.logs??[]),c=l.totalCalls>0?Math.round(l.totalErrors/l.totalCalls*100):0;let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[0]=h):h=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()}),h]}),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:Yt,className:"h-16 w-full",children:t.jsxs(yt,{data:u,barCategoryGap:"4%",children:[t.jsx(_t,{content:t.jsx(Ct,{labelFormatter:ss}),cursor:{fill:"var(--muted)"}}),t.jsx(St,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:u.map(ts)})]})}),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"})}),p.length>0&&t.jsxs("div",{className:"px-5 py-4 border-t border-border",children:[t.jsxs("p",{className:"text-xs font-medium text-muted-foreground mb-2",children:["Top errors",c>0?` · ${c}% of calls failed`:""]}),t.jsx("ul",{className:"space-y-1.5",children:p.map(es)})]})]})}function es(s){return t.jsxs("li",{className:"flex items-start gap-2 text-xs",children:[t.jsxs("span",{className:"tabular-nums text-destructive font-medium shrink-0",children:[s.count.toLocaleString(),"×"]}),t.jsx("span",{className:"text-muted-foreground truncate",title:s.message,children:s.message})]},s.message)}function ts(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 ss(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function ns(){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 os(s){const e=P.c(13),{connectionId:n}=s,[i,a]=q.useState("14d"),{org:o}=J();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=r):r=e[0];let d;e[1]!==i?(d=Qt.map(c=>t.jsx("button",{type:"button",onClick:()=>a(c.value),className:je("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",i===c.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:c.label},c.value)),e[1]=i,e[2]=d):d=e[2];let l;e[3]!==d?(l=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[r,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:d})]}),e[3]=d,e[4]=l):l=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(ns,{}),e[5]=u):u=e[5];let x;e[6]!==n||e[7]!==o.id||e[8]!==i?(x=t.jsx(q.Suspense,{fallback:u,children:t.jsx(Zt,{connectionId:n,orgId:o.id,timeframe:i})}),e[6]=n,e[7]=o.id,e[8]=i,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 is(s){const e=P.c(15),{virtualMcp:n,org:i}=s,a=Y();let o;e[0]!==a||e[1]!==i||e[2]!==n.id?(o=()=>{const p=crypto.randomUUID();a({to:"/$org/$taskId",params:{org:i,taskId:p},search:{virtualmcpid:n.id}})},e[0]=a,e[1]=i,e[2]=n.id,e[3]=o):o=e[3];let r;e[4]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(we,{size:16}),e[4]=r):r=e[4];let d;e[5]!==n.icon||e[6]!==n.title?(d=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:r}),e[5]=n.icon,e[6]=n.title,e[7]=d):d=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]!==d||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:[d,l,u]}),e[11]=o,e[12]=d,e[13]=l,e[14]=x):x=e[14],x}function as(s){const e=P.c(7),{virtualMcps:n,org:i}=s;let a;if(e[0]!==i||e[1]!==n){let r;e[3]!==i?(r=d=>t.jsx(is,{virtualMcp:d,org:i},d.id),e[3]=i,e[4]=r):r=e[4],a=n.map(r),e[0]=i,e[1]=n,e[2]=a}else a=e[2];let o;return e[5]!==a?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:a})}),e[5]=a,e[6]=o):o=e[6],o}function rs(s){const e=P.c(7),{connection:n}=s,{org:i}=J();let a;e[0]!==n.id?(a={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=a):a=e[1];const o=Tt(a);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 d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=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]=d):d=e[3];let l;return e[4]!==i.slug||e[5]!==o?(l=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[d,t.jsx("div",{className:"px-5 py-4",children:t.jsx(as,{virtualMcps:o,org:i.slug})})]}),e[4]=i.slug,e[5]=o,e[6]=l):l=e[6],l}function ls(s){const e=P.c(31),{tools:n,connectionId:i,org:a}=s,o=Y(),{org:r}=J();let d;e[0]!==i||e[1]!==r.id||e[2]!==r.slug?(d={connectionId:i,orgId:r.id,orgSlug:r.slug},e[0]=i,e[1]=r.id,e[2]=r.slug,e[3]=d):d=e[3];const l=_e(d),u=Ne(i);let x;e[4]!==u||e[5]!==i?(x=u?ke(u):i,e[4]=u,e[5]=i,e[6]=x):x=e[6];const p=x,[c,h]=q.useState("");let g,v,b,j;if(e[7]!==p||e[8]!==l||e[9]!==o||e[10]!==a||e[11]!==c||e[12]!==n){const S=(n??[]).filter(cs),y=c.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]!==a?(_=f=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:a,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(f.name)}})},e[17]=p,e[18]=o,e[19]=a,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]!==c?(j=t.jsx(Ot,{value:c,onChange:h,placeholder:"Search apps...",onKeyDown:C}),e[22]=c,e[23]=j):j=e[23],g="flex-1 overflow-auto p-5",v=I.length===0?t.jsx(ve,{image:null,title:c?"No apps found":"No apps available",description:c?"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(Mt,{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]=a,e[11]=c,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 cs(s){return!!re(s._meta)}function Te(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=r=>r.charAt(0).toUpperCase()+r.slice(1),i=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),a=e.map(n),o=e[e.length-1];return a.length>=2&&o&&i.has(o)?[a.pop(),...a].join(" "):a.join(" ")}function ie(s){const e=P.c(2),{label:n}=s;let i;return e[0]!==n?(i=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]=i):i=e[1],i}function ds(s){const e=P.c(50),{tools:n,prompts:i,resources:a,connectionId:o,org:r}=s;let d;e[0]!==i?(d=i===void 0?[]:i,e[0]=i,e[1]=d):d=e[1];const l=d;let u;e[2]!==a?(u=a===void 0?[]:a,e[2]=a,e[3]=u):u=e[3];const x=u,p=Y(),c=Ne(o??"");let h;e[4]!==c||e[5]!==o?(h=c?ke(c):o,e[4]=c,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]!==r?(v=function($){!o||!r||p({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:g,collectionName:"tools",itemId:encodeURIComponent($)}})},e[7]=g,e[8]=o,e[9]=p,e[10]=r,e[11]=v):v=e[11];const b=v;let j;e[12]!==o||e[13]!==r||e[14]!==n?(j=o&&r&&n.some(xs),e[12]=o,e[13]=r,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(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(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]!==r||e[34]!==n?(w=N&&t.jsx(te,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(ls,{tools:n,connectionId:o,org:r})}),e[31]=o,e[32]=N,e[33]=r,e[34]=n,e[35]=w):w=e[35];let M;e[36]!==l?(M=l.length>0?l.map(us):t.jsx(ie,{label:"prompts"}),e[36]=l,e[37]=M):M=e[37];let O;e[38]!==M?(O=t.jsx(te,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:M})}),e[38]=M,e[39]=O):O=e[39];let A;e[40]!==x?(A=x.length>0?x.map(ms):t.jsx(ie,{label:"resources"}),e[40]=x,e[41]=A):A=e[41];let z;e[42]!==A?(z=t.jsx(te,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:A})}),e[42]=A,e[43]=z):z=e[43];let U;return e[44]!==k||e[45]!==f||e[46]!==w||e[47]!==O||e[48]!==z?(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,z]})}),e[44]=k,e[45]=f,e[46]=w,e[47]=O,e[48]=z,e[49]=U):U=e[49],U}function ms(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 us(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($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(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 xs(s){return re(s._meta)}function ps(s){const e=P.c(13),{connection:n,displayTitle:i}=s,a=i??n.title;let o;e[0]!==n.icon||e[1]!==a?(o=t.jsx(oe,{icon:n.icon,name:a,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=a,e[2]=o):o=e[2];let r;e[3]!==a?(r=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:a})}),e[3]=a,e[4]=r):r=e[4];let d;e[5]!==n.description?(d=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]=d):d=e[6];let l;e[7]!==r||e[8]!==d?(l=t.jsxs("div",{className:"flex-1 min-w-0",children:[r,d]}),e[7]=r,e[8]=d,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 fs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:i,onRemoveOAuth:a}){const o=ce({control:s.control,name:"ui_type"}),r=ce({control:s.control,name:"connection_url"}),{stdioEnabled:d}=Pe(),l=(()=>{if(typeof r!="string"||!r)return!1;try{const c=new URL(r);return c.hostname==="api.githubcopilot.com"&&c.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),u=d||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:c})=>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:c.value,onValueChange:c.onChange,children:[t.jsx(E,{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(F,{value:"HTTP",children:"HTTP"}),t.jsx(F,{value:"SSE",children:"SSE"}),t.jsx(F,{value:"Websocket",children:"Websocket"}),u&&t.jsxs(t.Fragment,{children:[t.jsx(F,{value:"NPX",children:"NPX Package"}),t.jsx(F,{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(E,{children:t.jsx(W,{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:c.value,onValueChange:c.onChange,children:[t.jsx(E,{children:t.jsx(ue,{className:"h-10",children:t.jsx(xe,{})})}),t.jsxs(pe,{children:[t.jsx(F,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(F,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(F,{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(F,{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(F,{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(G,{})]})}),o==="NPX"&&t.jsx(L,{control:s.control,name:"npx_package",render:({field:c})=>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(E,{children:t.jsx(W,{placeholder:"@perplexity-ai/mcp-server",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(G,{})]})}),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:c})=>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(E,{children:t.jsx(W,{placeholder:"node, bun, python...",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(G,{})]})}),t.jsx(L,{control:s.control,name:"stdio_args",render:({field:c})=>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(E,{children:t.jsx(W,{placeholder:"arg1 arg2 --flag value",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(G,{})]})})]}),t.jsx(L,{control:s.control,name:"stdio_cwd",render:({field:c})=>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(E,{children:t.jsx(W,{placeholder:"/path/to/project (optional)",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(G,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(L,{control:s.control,name:"env_vars",render:({field:c})=>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(E,{children:t.jsx(Be,{value:c.value??[],onChange:c.onChange})}),t.jsx(G,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(L,{control:s.control,name:"connection_token",render:({field:c})=>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(Et,{children:[t.jsx(Vt,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(zt,{variant:"success",className:"gap-1.5",children:[t.jsx(Rt,{size:12}),"Authenticated via OAuth",t.jsx(Ft,{size:12})]})})}),t.jsxs(Ut,{align:"start",children:[t.jsxs(de,{onClick:i,children:[t.jsx(dt,{size:16}),"Re-authenticate"]}),t.jsxs(de,{variant:"destructive",onClick:a,children:[t.jsx(ae,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&c.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:()=>c.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(E,{children:t.jsx(W,{type:"password",placeholder:l?"Paste your GitHub PAT":"Enter access token...",...c,value:c.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(G,{})]})})]})}function hs(s){return s.command==="npx"}function gs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function js(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"&&Fe(s.connection_headers)){const i=s.connection_headers,a=Ge(i.envVars);if(hs(i)){const r=gs(i);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:r,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:a}}const o=js(i);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:a}}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 vs(s){let e,n=null,i=null,a=null;return s.ui_type==="NPX"?(e="STDIO",n="",a=We(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",a=Xe(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",i=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...i&&{connection_token:i},...a&&{connection_headers:a},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function bs({connection:s,connectionId:e,org:n,isUpdating:i,tools:a,prompts:o,resources:r,siblings:d}){const l=Y({from:"/$org/settings/connections/$appSlug"}),u=Ve(),x=ye(),{org:p}=J(),c=jt({onSuccess:()=>{d.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:a},C=qe(k,Gt),f=Ue({resolver:Re(He),values:fe(h??s)}),w=f.formState.isDirty,M=async()=>{if(!await f.trigger())return;const $=f.getValues(),D=vs($),R=h?.id??e;await x.update.mutateAsync({id:R,data:D}),f.reset($)},O=()=>{f.reset(fe(h??s))},A=async m=>{const{token:$,tokenInfo:D,error:R}=await ot({connectionId:m,orgSlug:p.slug,scope:"offline_access"});if(R||!$){X.error(`Authentication failed: ${R}`);return}if(D)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:D.accessToken,refreshToken:D.refreshToken,expiresIn:D.expiresIn,scope:D.scope,clientId:D.clientId,clientSecret:D.clientSecret,tokenEndpoint:D.tokenEndpoint})});if(!K.ok)console.error("Failed to save OAuth token:",await K.text()),await x.update.mutateAsync({id:m,data:{connection_token:$}});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:$}})}else await x.update.mutateAsync({id:m,data:{connection_token:$}});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()}),X.success("Authentication successful")},z=()=>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 D=await m.text();X.error(`Failed to remove OAuth: ${D}`);return}const $=new URL(`/api/${p.slug}/mcp/${s.id}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated($.href,null)}),X.success("OAuth removed. You can now re-authenticate with a different account.")}catch(m){console.error("Error removing OAuth token:",m),X.error("Failed to remove OAuth")}};return t.jsxs(t.Fragment,{children:[t.jsx(vt,{...c}),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(E,{children:t.jsx(W,{...m})}),t.jsx(G,{})]})}),t.jsx(L,{control:f.control,name:"description",render:({field:m})=>t.jsxs(B,{children:[t.jsx(H,{children:"Description"}),t.jsx(E,{children:t.jsx(W,{...m,value:m.value||""})}),t.jsx(G,{})]})})]}),t.jsx(fs,{form:f,connection:h??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:z,onRemoveOAuth:U}),t.jsx(Ke,{connection:h??s,form:f,hasMcpBinding:C,isMCPAuthenticated:_,supportsOAuth:j.supportsOAuth,isServerError:j.isServerError,onAuthenticate:z,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(V,{onClick:M,disabled:!w||i,className:"flex-1",children:i?"Saving…":"Save changes"}),w&&t.jsx(V,{variant:"outline",onClick:O,children:"Undo"}),t.jsxs(V,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const m=h??s;g(null),c.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(ps,{connection:s,displayTitle:(()=>{const m=d[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(os,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(qt,{instances:d,onConfigure:m=>g(m),onAuthenticate:m=>A(m.id),onDelete:m=>c.requestDelete(m),onToggleStatus:async(m,$)=>{try{await x.update.mutateAsync({id:m.id,data:{status:$}}),X.success($==="active"?"Connection enabled":"Connection disabled")}catch{X.error("Failed to update connection")}},isAdding:v,onAdd:async()=>{b(!0);try{const m=d[0]??s,$=m.title.replace(/\s*\(\d+\)\s*$/,""),D=d.length+1,R=`${$} (${D})`,Q=Le("conn");await x.create.mutateAsync({id:Q,title:R,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(rs,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ds,{tools:a,prompts:o,resources:r,connectionId:e,org:n})})]})})]})})]})}function Ns(){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 i;s[1]===Symbol.for("react.memo_cache_sentinel")?(i={from:"/shell/$org/settings/connections/$appSlug"},s[1]=i):i=s[1];const{appSlug:a,org:o}=ze(i),{org:r}=J(),d=ye();let l;s[2]!==a?(l={slug:a},s[2]=a,s[3]=l):l=s[3];const u=et(l),x=u[0]??null,p=x?.id??"",c=p||null;let h;s[4]!==r.id||s[5]!==r.slug||s[6]!==c?(h={connectionId:c,orgId:r.id,orgSlug:r.slug},s[4]=r.id,s[5]=r.slug,s[6]=c,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(ks):(x?.tools??[]).map(ws);e:{if(u.length<=1){j=A;break e}const z=new Set,U=[],m=Cs;for(const $ of u){const D=$.id===p?A:m($.tools);for(const R of D)z.has(R.name)||(z.add(R.name),U.push(R))}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}=Ee(y);let _;s[19]!==S?.prompts?(_=S?.prompts??[],s[19]=S?.prompts,s[20]=_):_=s[20];let k;s[21]!==_?(k=_.map(_s),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(ys),s[25]=f,s[26]=w):w=s[26];const M=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(V,{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]!==d.update.isPending||s[31]!==N||s[32]!==x||s[33]!==p||s[34]!==o||s[35]!==C||s[36]!==M||s[37]!==u?(O=t.jsx(bs,{org:o,connection:x,connectionId:p,isUpdating:d.update.isPending,tools:N,prompts:C,resources:M,siblings:u}),s[30]=d.update.isPending,s[31]=N,s[32]=x,s[33]=p,s[34]=o,s[35]=C,s[36]=M,s[37]=u,s[38]=O):O=s[38],O}function ys(s){return{name:s.name,description:s.description,uri:s.uri}}function _s(s){return{name:s.name,description:s.description}}function Cs(s){return(s??[]).map(Ss)}function Ss(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ws(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ks(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ts(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Me,{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(Ns,{})})}),s[0]=e):e=s[0],e}function ho(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ts,{}),s[0]=e):e=s[0],e}export{ho as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as R,ay as A,a$ as I,s as a,aw as j,ax as z,c as L,j as u,B as C}from"./index-
|
|
1
|
+
import{o as R,ay as A,a$ as I,s as a,aw as j,ax as z,c as L,j as u,B as C}from"./index-BIvxcsMT.js";import{I as H}from"./input-C-5bkxwu.js";import{s as W}from"./Plus-DX9uB6jT.js";import{s as $}from"./Trash01-CAEn55T5.js";const q=R({key:a().min(1,"Key is required"),value:a()}),M=R({title:a().min(1,"Name is required"),description:a().nullable().optional(),icon:a().nullable().optional(),ui_type:z(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:a().optional(),connection_token:a().nullable().optional(),npx_package:a().optional(),stdio_command:a().optional(),stdio_args:a().optional(),stdio_cwd:a().optional(),env_vars:j(q).optional(),configuration_scopes:j(a()).nullable().optional(),configuration_state:A(a(),I()).nullable().optional()}).refine(n=>n.ui_type==="NPX"?!!n.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(n=>n.ui_type==="STDIO"?!!n.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(n=>n.ui_type==="HTTP"||n.ui_type==="SSE"||n.ui_type==="Websocket"?!!n.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function K(n){const e=n.toLowerCase();return!!(["secret","password","passwd","credential","private","token","bearer","jwt","refresh","session","api_key","apikey","auth_key","access_key","secret_key","private_key","service_key","encryption_key","signing_key","license_key","auth","oauth","client_secret","app_secret","webhook","signing","signature","database_url","db_url","mongo_uri","redis_url","postgres_url","mysql_url","connection_string","dsn","service_role","anon_key","supabase_key","openai","anthropic","stripe","twilio","sendgrid","resend","firebase","sentry","datadog","newrelic","new_relic","pplx","replicate","pinecone","cohere","hugging","hf_token","gh_token","npm_token","certificate","cert","ssl","tls","encryption","salt","hash","hmac","personal_access","github_pat","gitlab_pat","bitbucket_pat"].some(s=>e.includes(s))||["sk_","rk_","whsec_","pk_live","sk_live"].some(s=>e.startsWith(s))||["_key","_secret","_token","_password","_auth","_pat"].some(s=>e.endsWith(s)))}function X(n){const e=L.c(34),{value:t,onChange:r,keyPlaceholder:o,valuePlaceholder:s,className:v}=n,m=o===void 0?"VARIABLE_NAME":o,_=s===void 0?"value...":s;let b;e[0]!==r||e[1]!==t?(b=()=>{r([...t,{key:"",value:""}])},e[0]=r,e[1]=t,e[2]=b):b=e[2];const S=b;let x;e[3]!==r||e[4]!==t?(x=l=>{r(t.filter((p,i)=>i!==l))},e[3]=r,e[4]=t,e[5]=x):x=e[5];const g=x;let P;e[6]!==r||e[7]!==t?(P=(l,p)=>{const i=[...t],c=i[l];c&&(i[l]={key:p,value:c.value},r(i))},e[6]=r,e[7]=t,e[8]=P):P=e[8];const y=P;let w;e[9]!==r||e[10]!==t?(w=(l,p)=>{const i=[...t],c=i[l];c&&(i[l]={key:c.key,value:p},r(i))},e[9]=r,e[10]=t,e[11]=w):w=e[11];const k=w;let d;if(e[12]!==y||e[13]!==g||e[14]!==k||e[15]!==m||e[16]!==t||e[17]!==_){let l;e[19]!==y||e[20]!==g||e[21]!==k||e[22]!==m||e[23]!==_?(l=(p,i)=>u.jsxs("div",{className:"flex gap-2 items-center",children:[u.jsx(H,{placeholder:m,value:p.key,onChange:c=>y(i,c.target.value),className:"h-10 rounded-lg flex-1 font-mono text-sm"}),u.jsx(H,{type:K(p.key)?"password":"text",placeholder:_,value:p.value,onChange:c=>k(i,c.target.value),className:"h-10 rounded-lg flex-1"}),u.jsx(C,{type:"button",variant:"ghost",size:"icon",className:"h-10 w-10 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>g(i),children:u.jsx($,{size:16})})]},i),e[19]=y,e[20]=g,e[21]=k,e[22]=m,e[23]=_,e[24]=l):l=e[24],d=t.map(l),e[12]=y,e[13]=g,e[14]=k,e[15]=m,e[16]=t,e[17]=_,e[18]=d}else d=e[18];let T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=u.jsx(W,{size:16,className:"mr-1"}),e[25]=T):T=e[25];let f;e[26]!==S?(f=u.jsxs(C,{type:"button",variant:"outline",size:"sm",className:"w-full h-9 text-muted-foreground",onClick:S,children:[T,"Add Environment Variable"]}),e[26]=S,e[27]=f):f=e[27];let h;e[28]!==d||e[29]!==f?(h=u.jsxs("div",{className:"flex flex-col gap-2",children:[d,f]}),e[28]=d,e[29]=f,e[30]=h):h=e[30];let E;return e[31]!==v||e[32]!==h?(E=u.jsx("div",{className:v,children:h}),e[31]=v,e[32]=h,e[33]=E):E=e[33],E}function V(n){const e={};for(const{key:t,value:r}of n)t.trim()&&(e[t.trim()]=r);return e}function D(n){return n?Object.entries(n).map(([e,t])=>({key:e,value:t})):[]}function N(n){const e=n.trim();if(!e)return"";try{const t=new URL(e),r=t.pathname.length>1?t.pathname.replace(/\/+$/,""):t.pathname;return`${t.origin}${r}`}catch{return e.replace(/\/+$/,"")}}function F(n){const e=n.trim().split(/\s+/).filter(Boolean);if(e.length<2)return null;const t=e[0]?.toLowerCase();if(t!=="npx"&&t!=="bunx")return null;const o=e.slice(1).find(s=>!s.startsWith("-"));return o?{packageName:o}:null}function Y(n){const{uiType:e}=n,t=N(n.connectionUrl??"");if((e==="HTTP"||e==="SSE"||e==="Websocket")&&t===N("https://api.githubcopilot.com/mcp/"))return{id:"github",title:"GitHub",description:"GitHub Copilot MCP",token:{label:"GitHub PAT",placeholder:"github_pat_…",helperText:"Paste a GitHub Personal Access Token (PAT)"}};const r=(n.npxPackage??"").trim();return e==="NPX"&&r==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function J(n){if(n.registryItems.length===0||n.uiType!=="HTTP"&&n.uiType!=="SSE"&&n.uiType!=="Websocket")return null;const e=N(n.connectionUrl??"");if(!e)return null;const t=n.registryItems.find(s=>(s.server?.remotes??[]).some(m=>N(m.url??"")===e));if(!t)return null;const r=t.title||t.name||t.server?.title||t.server?.name||"",o=t.server?.description||t.description||t.summary||null;return r?{id:"registry",title:r,description:o}:null}function Q(n,e){const t={command:"npx",args:["-y",n]},r=V(e);return Object.keys(r).length>0&&(t.envVars=r),t}function Z(n,e,t,r){const o={command:n};e.trim()&&(o.args=e.trim().split(/\s+/)),t?.trim()&&(o.cwd=t.trim());const s=V(r);return Object.keys(s).length>0&&(o.envVars=s),o}export{X as E,J as a,Q as b,M as c,Z as d,Y as i,F as p,D as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as E,c as oe,j as t,E as Ye,i as ce,D as be,b as _e,u as Ze,a as Ne,z as et,C as tt,L as nt,p as st,n as ot,B as U,v as te,m as it,l as de,t as W,K as rt}from"./index-BIvxcsMT.js";import{a as lt,b as De,g as at,e as ct}from"./extract-connection-data-DXmsDXzN.js";import{C as dt}from"./collection-display-button-DmoD5b6J.js";import{S as mt}from"./search-input-CmJ7IuJz.js";import{C as ut}from"./collection-tabs-ByJ2lCEV.js";import{u as pt,a as ke,g as ht,C as Ce}from"./connection-card-COLJGGyb.js";import{E as gt}from"./empty-state-CKmzL0iR.js";import{I as xt}from"./integration-icon-DWcR_mMd.js";import{P as ue}from"./index-BeJ1yeue.js";import{u as ft,D as jt}from"./use-delete-connection-GWWQ0NwP.js";import{u as ye}from"./use-capability--pStQfW2.js";import{u as yt}from"./use-infinite-scroll-C2oRLreW.js";import{u as Ct}from"./use-view-mode-viB7TTSY.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-BLM89Cw2.js";import{C as Fe}from"./checkbox-B7ovMLyf.js";import{e as Me,d as ze,c as Ve,a as Ee,b as Be,D as Ke}from"./dialog-1PlbGnxl.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-D7F9J8H1.js";import{u as At}from"./use-mobile-CdswWdV_.js";import{a as Ue,b as Re,D as He,c as re}from"./dropdown-menu-DgucD0Wn.js";import{F as Q,b as J,c as Y,d as Z,e as ee,a as ve}from"./form-DY5CJF6A.js";import{I as ie}from"./input-C-5bkxwu.js";import{d as wt,S as Tt,a as It,b as Pt,c as ae}from"./select-XC9B8kYb.js";import{T as $t}from"./textarea-BJ7uXt99.js";import{b as We,u as Lt}from"./use-connection-rw8Y5wYH.js";import{u as Ot}from"./use-virtual-mcp-st0OLLtk.js";import{u as Ft}from"./studio-tools-DGpKprde.js";import{ab as Mt,al as zt,G as Vt,E as Et}from"./agent-icon-CuxkxUe-.js";import{n as ge}from"./XCircle-C94QFqN0.js";import{i as Xe}from"./DotsVertical-BU3qKzJo.js";import{s as qe}from"./Eye-CtocRVwR.js";import{s as je}from"./Star01-7qhyucrX.js";import{s as Ge}from"./Plus-DX9uB6jT.js";import{s as Qe}from"./Trash01-CAEn55T5.js";import{s as Je}from"./XClose-CQikaAXa.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-Bx2EyqE0.js";import{a as Wt}from"./authenticate-and-persist-oauth-1U_DESs3.js";import"./use-mcp-client-DbN0o_29.js";import"./constants-C8_Swa4x.js";import"./auth-By4coGKl.js";import"./SwitchHorizontal01-sG-IqCt6.js";import"./Check-DhEV1E4F.js";import"./List-vf0HKUEp.js";import"./tooltip-BGL3A5jy.js";import"./view-mode-toggle-BekCb9Y2.js";import"./badge-EC_FS1hJ.js";import"./SearchMd-DWSBWjan.js";import"./use-registry-connections-DPvd05bN.js";import"./use-organization-settings-B87409No.js";import"./useInfiniteQuery-Cd0Nyb0J.js";import"./card-Cd_UT82w.js";import"./sidebar-BxApc71_.js";import"./LayoutLeft-C8PdEJOQ.js";import"./sheet-DMsXF2a5.js";import"./X-BWG-JTku.js";import"./ChevronRight-BP1EbKKr.js";import"./Circle-BnMDtDeu.js";import"./label-CuPUA6lI.js";import"./ChevronDown-BJvvkmIr.js";import"./ChevronUp-CVqQKtsY.js";import"./use-collections-DaNfbX0Q.js";import"./AlertCircle-hfr9WJXe.js";import"./Tool01-DGnLcysQ.js";import"./Settings02-CZ9vMUyw.js";import"./ArrowUpRight-DBXurizV.js";import"./ZapSquare-DBjTUciD.js";import"./Users03-DHP7OUDR.js";import"./CheckCircle-CbuPUNoj.js";import"./Stars02-CFivD_f8.js";import"./Loading02-DejqZGnO.js";import"./Copy01-Cm6DymEJ.js";import"./ZoomOut-DltoXGbL.js";import"./Globe01-CxIEuzOP.js";import"./FilterLines-XaejSF3d.js";import"./Globe04-DZ-Pm9xo.js";import"./HardDrive-C2sIA93N.js";import"./Key01-D8bQG_zp.js";import"./LinkExternal01-D58rAWvm.js";import"./Monitor01-CodDwsVO.js";import"./Sun-CHp4Y1Dq.js";import"./Palette-CgTelSEQ.js";import"./Play-Dh4_54hC.js";import"./SearchLg-D0ZqoPSb.js";import"./Shield01-DvUXE0jO.js";import"./Stars01-DN1mvd59.js";import"./Upload01-DKn5tYXN.js";import"./User01-IYcmkjnc.js";import"./Users01-0WxprMle.js";import"./Zap-DeHaXJHA.js";import"./mcp-oauth-BFb5Mr2N.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 Us(){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{Us as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r={SELF:t=>`${t}_self`,REGISTRY:t=>`${t}_registry`,COMMUNITY_REGISTRY:t=>`${t}_community-registry`,DEV_ASSETS:t=>`${t}_dev-assets`,SITE_DIAGNOSTICS:t=>`site-diagnostics_${t}`,COMMERCE_DISCOVERY:t=>`${t}_commerce-discovery`},d="get_my_diagnostic",g="self";function n(t){return{is(e){return!e||!e.startsWith(t)?null:e.slice(t.length)||null},get(e){return`${t}${e}`}}}function s(t){return{id:t.id,organization_id:t.organizationId,title:t.title,description:t.description,icon:t.icon,status:"active",created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:"system",updated_by:void 0,metadata:{instructions:t.instructions??null},pinned:!1,connections:[]}}const a=n("decopilot_"),_=a.is,i=a.get,o=n("dev_"),u=o.get,l=o.is;function m(t){return s({id:i(t),organizationId:t,title:"Decopilot",description:"Default agent that aggregates all organization connections",icon:"https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png"})}const c=n("commerce-discovery_"),A=c.get,E={AGENT_MANAGER:t=>`studio-agent-manager_${t}`,AUTOMATION_MANAGER:t=>`studio-automation-manager_${t}`,CONNECTION_MANAGER:t=>`studio-connection-manager_${t}`,STORE_MANAGER:t=>`studio-store-manager_${t}`,BRAND_MANAGER:t=>`studio-brand-manager_${t}`,USAGE_MANAGER:t=>`studio-usage-manager_${t}`};function S(t){return t?t.startsWith("studio-agent-manager_")||t.startsWith("studio-automation-manager_")||t.startsWith("studio-connection-manager_")||t.startsWith("studio-store-manager_")||t.startsWith("studio-brand-manager_")||t.startsWith("studio-usage-manager_"):!1}export{d as C,g as S,r as W,m as a,u as b,E as c,S as d,i as e,A as g,_ as i,l as p};
|