decocms 4.29.1 → 4.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-D90xu5-8.js → AlertCircle-Npyn4_wF.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-B1XPsNPZ.js → ArrowUpRight-zXVQKR-G.js} +1 -1
- package/dist/client/assets/{Check-BqH5cjqe.js → Check-BxViL4rK.js} +1 -1
- package/dist/client/assets/{CheckCircle-CebfgxLq.js → CheckCircle-Cz4tJUop.js} +1 -1
- package/dist/client/assets/{ChevronDown-DhzhS3K5.js → ChevronDown-UniVHOcZ.js} +1 -1
- package/dist/client/assets/{ChevronRight-DntNgeBz.js → ChevronRight-K3Ms28jw.js} +1 -1
- package/dist/client/assets/{ChevronUp-DPJfOoQR.js → ChevronUp-C_JF1YJx.js} +1 -1
- package/dist/client/assets/{Circle-umqkxNwx.js → Circle-iQbOlvwS.js} +1 -1
- package/dist/client/assets/{Copy01-YBIj7O7M.js → Copy01-Ctt9FUbb.js} +1 -1
- package/dist/client/assets/{DotsVertical-DoxN78H8.js → DotsVertical-Cnet9a8h.js} +1 -1
- package/dist/client/assets/{Eye-o8ajkfvt.js → Eye-Bf8ySHj2.js} +1 -1
- package/dist/client/assets/{FilterLines-CEBhmChB.js → FilterLines-DRa15Wby.js} +1 -1
- package/dist/client/assets/{Globe01-D3NrpjPq.js → Globe01-BCgVxayg.js} +1 -1
- package/dist/client/assets/{Globe04-6xG6GU2e.js → Globe04-BRhMXMEJ.js} +1 -1
- package/dist/client/assets/{HardDrive-CDBenwE2.js → HardDrive-BaaJKDpq.js} +1 -1
- package/dist/client/assets/{Key01-CwgjH_um.js → Key01-BvoJKmt1.js} +1 -1
- package/dist/client/assets/{LayoutLeft-CKcHwaHf.js → LayoutLeft-Bsqu0rxT.js} +1 -1
- package/dist/client/assets/{LinkExternal01-DBFEHO3t.js → LinkExternal01-bFRmolQv.js} +1 -1
- package/dist/client/assets/{List-s8AZWxpk.js → List-FyDw_upy.js} +1 -1
- package/dist/client/assets/{Loading02-DaLVACu2.js → Loading02-wU_DDeXK.js} +1 -1
- package/dist/client/assets/{Monitor01-lxPxQ2fk.js → Monitor01-rM21B5VM.js} +1 -1
- package/dist/client/assets/{Palette-DHyTdFqR.js → Palette-Bq3VPed6.js} +1 -1
- package/dist/client/assets/{Play-TOCBGzP9.js → Play-Dqv3vBUr.js} +1 -1
- package/dist/client/assets/{Plus-DkGwhdIW.js → Plus-CIMT0C1M.js} +1 -1
- package/dist/client/assets/{SearchLg-C9MBYrXH.js → SearchLg-BqF-kB3a.js} +1 -1
- package/dist/client/assets/{SearchMd-Dhz0UROc.js → SearchMd-OCIrtgl8.js} +1 -1
- package/dist/client/assets/{Settings02-COfrOHpp.js → Settings02-CTtq6YOs.js} +1 -1
- package/dist/client/assets/{Shield01-BrK-9cDf.js → Shield01-CCAMun7k.js} +1 -1
- package/dist/client/assets/{Star01-twQgP5oO.js → Star01-Cw7wbAha.js} +1 -1
- package/dist/client/assets/{Stars01-C27kMlCK.js → Stars01-CXkCYhyc.js} +1 -1
- package/dist/client/assets/{Stars02-sR281nUk.js → Stars02-C6DKWb0j.js} +1 -1
- package/dist/client/assets/{Sun-DTFx5jn8.js → Sun-Cfq43Fjh.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-Bu9ipsE_.js → SwitchHorizontal01-BSEQu0PJ.js} +1 -1
- package/dist/client/assets/{Tool01-DJgxsN47.js → Tool01-woqhmM89.js} +1 -1
- package/dist/client/assets/{Trash01-myAGgKHr.js → Trash01-DSTcxy5m.js} +1 -1
- package/dist/client/assets/{Upload01-m0ny4YmQ.js → Upload01-DI1Xs1Z6.js} +1 -1
- package/dist/client/assets/{User01-DuGAbO5F.js → User01-D-uDYDK0.js} +1 -1
- package/dist/client/assets/{Users01-e9Wb8IJU.js → Users01-DVmsZOTe.js} +1 -1
- package/dist/client/assets/{Users03-JTfAuK6m.js → Users03-DGDUIZF4.js} +1 -1
- package/dist/client/assets/{X-DRR7RtBP.js → X-DWrz2LqH.js} +1 -1
- package/dist/client/assets/{XCircle-Cz7czjsw.js → XCircle-JQbz9WmR.js} +1 -1
- package/dist/client/assets/{XClose-eEYHZsPT.js → XClose-CBrgKiaB.js} +1 -1
- package/dist/client/assets/{Zap-CMZ9cCJz.js → Zap-NoORqLvM.js} +1 -1
- package/dist/client/assets/{ZapSquare-Ch518nCD.js → ZapSquare-RhqrJVTN.js} +1 -1
- package/dist/client/assets/{ZoomOut-Chl8lvun.js → ZoomOut-nih9dlzQ.js} +1 -1
- package/dist/client/assets/{access-gate-Cf-kJrg7.js → access-gate-DW0Ym0X9.js} +1 -1
- package/dist/client/assets/{add-section-modal-COVSQJFG.js → add-section-modal-DgeyNgVY.js} +1 -1
- package/dist/client/assets/agent-capabilities-0FR5de0y.js +1 -0
- package/dist/client/assets/agent-icon-32aZu8f8.js +1 -0
- package/dist/client/assets/agents-list-C1UtH2E7.js +1 -0
- package/dist/client/assets/ai-providers-CNHaz-V2.js +1 -0
- package/dist/client/assets/{alert-C-n1SZ0O.js → alert-D0cE0bpw.js} +1 -1
- package/dist/client/assets/{alert-dialog-wgrcUQ0O.js → alert-dialog-DBrNjdaV.js} +3 -3
- package/dist/client/assets/app-editor-DVKTcnpY.js +1 -0
- package/dist/client/assets/{auth-B8jeHTDK.js → auth-C9k5QFmE.js} +1 -1
- package/dist/client/assets/{auth-catchall-f5qF8zoS.js → auth-catchall-EFYsuYup.js} +1 -1
- package/dist/client/assets/{auth-entry-BwlcwCMz.js → auth-entry-B7dEi3i4.js} +1 -1
- package/dist/client/assets/{auth-split-layout-DiG8voFB.js → auth-split-layout-DAa980Aa.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-ezeRyKPp.js → authenticate-and-persist-oauth-Dji-Zkvk.js} +1 -1
- package/dist/client/assets/{automation-list-row-CeLhtWjA.js → automation-list-row-DjnykZrH.js} +1 -1
- package/dist/client/assets/automation-runs-CyeVpPEA.js +188 -0
- package/dist/client/assets/automations-BRVTy0px.js +1 -0
- package/dist/client/assets/autosend-Lnw286aO.js +1 -0
- package/dist/client/assets/{avatar-BrhzNA4d.js → avatar-CVASN_n8.js} +1 -1
- package/dist/client/assets/{badge-B5li3mFX.js → badge-DN1YW5R1.js} +1 -1
- package/dist/client/assets/{block-document-BKVlkRQG.js → block-document-BMOnFuNo.js} +3 -3
- package/dist/client/assets/brand-context-BYp2uUo_.js +1 -0
- package/dist/client/assets/{breadcrumb-BPYlrjmj.js → breadcrumb-BylJDyxL.js} +1 -1
- package/dist/client/assets/buckets-ztIgzEwa.js +1 -0
- package/dist/client/assets/bulk-category-panel-D7ZYmK1J.js +1 -0
- package/dist/client/assets/{calendar-C0u4vRHU.js → calendar-ChXBpAOM.js} +1 -1
- package/dist/client/assets/capability-load-error-O4BtnIVr.js +1 -0
- package/dist/client/assets/{card-CCFrbS6S.js → card-BYZEQBt8.js} +1 -1
- package/dist/client/assets/category-editor-C-eV-FDB.js +1 -0
- package/dist/client/assets/{chat-context-XoGdeFE9.js → chat-context-CCC-Byca.js} +5 -5
- package/dist/client/assets/{checkbox-D2NBps_s.js → checkbox-C2WVbLnG.js} +1 -1
- package/dist/client/assets/{cli-auth-success-DG3-YXKw.js → cli-auth-success-D7EMTP4Y.js} +1 -1
- package/dist/client/assets/collection-detail-CKc7ZkK-.js +1 -0
- package/dist/client/assets/{collection-display-button-Bvtt9j_H.js → collection-display-button-oZx_AhoK.js} +1 -1
- package/dist/client/assets/{collection-search-BHb176G9.js → collection-search-i90jdNni.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BBBMMDK4.js → collection-table-wrapper-BkqcRITg.js} +1 -1
- package/dist/client/assets/{collection-tabs-CCdUJRcj.js → collection-tabs-Bg1zR32u.js} +1 -1
- package/dist/client/assets/{command-CGbsZOaN.js → command-D8e2ttGg.js} +1 -1
- package/dist/client/assets/commerce-onboarding-CUg63DGD.js +1 -0
- package/dist/client/assets/{connect-desktop-dialog-CRhRTOUc.js → connect-desktop-dialog-CdtfQBg4.js} +1 -1
- package/dist/client/assets/{connection-card-DGNqtPoP.js → connection-card-DGWh0T1M.js} +1 -1
- package/dist/client/assets/connection-detail-DG_Kwvgf.js +1 -0
- package/dist/client/assets/{connection-form-helpers-Bs8LNNlp.js → connection-form-helpers-CvE1GCwU.js} +1 -1
- package/dist/client/assets/connections-CSSk2Lo7.js +1 -0
- package/dist/client/assets/constants-B72Xmt_K.js +1 -0
- package/dist/client/assets/{decopilot-sse-pool-B7Qe588m.js → decopilot-sse-pool-CYJNLSex.js} +1 -1
- package/dist/client/assets/{dialog-C2MVTIBt.js → dialog-wZUkxFBf.js} +1 -1
- package/dist/client/assets/{domain-settings-Dk68eaoE.js → domain-settings-C-ClIsNf.js} +1 -1
- package/dist/client/assets/{drawer-BGO4iAk0.js → drawer-N4BBUwV9.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BPps0Iqr.js → dropdown-menu-COQWVmxy.js} +1 -1
- package/dist/client/assets/{empty-state-BUKBmmAV.js → empty-state-BdREyKTx.js} +1 -1
- package/dist/client/assets/{extract-connection-data-Dq7vx8cX.js → extract-connection-data-CguvuV8x.js} +1 -1
- package/dist/client/assets/file-explorer-DLrJ1FmW.js +2 -0
- package/dist/client/assets/{file-type-icon-DIgcp2MN.js → file-type-icon-BEeYBjMh.js} +1 -1
- package/dist/client/assets/{files-CIXCBIkO.js → files-OSCRmAjy.js} +1 -1
- package/dist/client/assets/{form-TSiFK-dI.js → form-D4Sjj2S5.js} +1 -1
- package/dist/client/assets/general-EnRn7dAf.js +1 -0
- package/dist/client/assets/github-repo-picker-pjUsTLC6.js +1 -0
- package/dist/client/assets/{hooks-BKW8thdS.js → hooks-RNhoO-Id.js} +6 -6
- package/dist/client/assets/{index-BZQALusN.js → index-4ttWqKAk.js} +1 -1
- package/dist/client/assets/{index-9kwnfSCp.js → index-BGWTtZfz.js} +3 -3
- package/dist/client/assets/index-BYSbf1og.css +1 -0
- package/dist/client/assets/{index-DNvozpHG.js → index-BjUL_v0d.js} +1 -1
- package/dist/client/assets/index-C3s6kNZf.js +1 -0
- package/dist/client/assets/{index-CIZOVv5V.js → index-D6_eTKF9.js} +1 -1
- package/dist/client/assets/index-D8BXYXaV.js +1 -0
- package/dist/client/assets/index-DJ-AVzEz.js +519 -0
- package/dist/client/assets/{index-d52A49fX.js → index-DcsErluY.js} +4 -4
- package/dist/client/assets/{index-BibhmEoM.js → index-E0XzXtgq.js} +1 -1
- package/dist/client/assets/{index-B09DUV7c.js → index-HmjC0l60.js} +1 -1
- package/dist/client/assets/{index-Bsex2T4n.js → index-NrynAfgx.js} +3 -3
- package/dist/client/assets/{index-Btxmdruq.js → index-Q0mE9w5a.js} +3 -3
- package/dist/client/assets/{index-CKKQLGcV.js → index-etRGW8hR.js} +1 -1
- package/dist/client/assets/{index-redirect-BsNOVzi9.js → index-redirect-CtWijNin.js} +1 -1
- package/dist/client/assets/{index-BlJ4j0DM.js → index-tYXe55yO.js} +1 -1
- package/dist/client/assets/{input-B_5YyJ8y.js → input-BLUXQaUJ.js} +1 -1
- package/dist/client/assets/{integration-icon-DXGEOTjP.js → integration-icon-BJkk8MWl.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-YIBgjb89.js → invite-member-dialog-CzBp_hgb.js} +2 -2
- package/dist/client/assets/{label-CWqrShVu.js → label-CW0QYigh.js} +1 -1
- package/dist/client/assets/{login-Da99hiOC.js → login-BzT7SutG.js} +1 -1
- package/dist/client/assets/{mcp-oauth-CSUfdVCn.js → mcp-oauth-DkjiGs3f.js} +1 -1
- package/dist/client/assets/members-B-nTZKqd.js +1 -0
- package/dist/client/assets/monaco-editor-CxptfxHs.js +9 -0
- package/dist/client/assets/{monitoring-stats-row-DixOHH_R.js → monitoring-stats-row-BCom1l-r.js} +1 -1
- package/dist/client/assets/{oauth-callback-BaDQ-n27.js → oauth-callback-BrnloLXP.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-I3h8vdSk.js → oauth-callback-ai-provider-Gf3ErLGK.js} +1 -1
- package/dist/client/assets/{onboarding-B1EOLElh.js → onboarding-Bijoo7hh.js} +1 -1
- package/dist/client/assets/org-install-0y09LTw4.js +1 -0
- package/dist/client/assets/{org-layout-NnaVwU9k.js → org-layout-BnSZ4nrA.js} +1 -1
- package/dist/client/assets/{organization-choice-C-TyyEjY.js → organization-choice-B0E5mbjx.js} +1 -1
- package/dist/client/assets/page-seo-form-Bgz7kJhB.js +1 -0
- package/dist/client/assets/page-seo-sheet-Ct29Vhus.js +1 -0
- package/dist/client/assets/{popover-DlszYF1R.js → popover-jVjMjIDj.js} +1 -1
- package/dist/client/assets/post-editor-BfRHhvGn.js +1 -0
- package/dist/client/assets/primitives-DaPu5vgv.js +1 -0
- package/dist/client/assets/profile-DclYxTny.js +1 -0
- package/dist/client/assets/project-app-view-BQBZobZ4.js +1 -0
- package/dist/client/assets/record-editor-BX1EoYMz.js +1 -0
- package/dist/client/assets/registry-BdbdSSDR.js +2 -0
- package/dist/client/assets/{registry-layout-zFAhrTof.js → registry-layout-BUFv94Wc.js} +1 -1
- package/dist/client/assets/{require-capability-C135EIMf.js → require-capability-gZyrOy_G.js} +1 -1
- package/dist/client/assets/{required-auth-layout-CEAeU4UY.js → required-auth-layout-CCig7BsQ.js} +1 -1
- package/dist/client/assets/{reset-password-D_zECCKz.js → reset-password-A6TbChyi.js} +1 -1
- package/dist/client/assets/reusable-new-chat-qqWu133U.js +1 -0
- package/dist/client/assets/roles-BW9vWvMW.js +1 -0
- package/dist/client/assets/{search-input-DccF25qw.js → search-input-5RFJsKB6.js} +1 -1
- package/dist/client/assets/secrets-T5w0qVnI.js +1 -0
- package/dist/client/assets/sections-editor-1RxueHws.js +2 -0
- package/dist/client/assets/{select-DdHVdWXn.js → select-GP-G7CYY.js} +1 -1
- package/dist/client/assets/select-model-Hh0vuEIf.js +4 -0
- package/dist/client/assets/seo-editor-BOaZSdYe.js +1 -0
- package/dist/client/assets/settings-layout-CQB5hLJw.js +1 -0
- package/dist/client/assets/{settings-section-eWkjB3kv.js → settings-section-BN93dKeu.js} +1 -1
- package/dist/client/assets/shell-controls-Tu95tJS5.js +1 -0
- package/dist/client/assets/shell-layout-BktipYXq.js +1 -0
- package/dist/client/assets/sidebar-BjPm3XPY.js +1 -0
- package/dist/client/assets/{skeleton-Bl9k4gft.js → skeleton-CXWh_vT2.js} +1 -1
- package/dist/client/assets/sso-B36X_9Kv.js +1 -0
- package/dist/client/assets/store-Lh1RLabm.js +1 -0
- package/dist/client/assets/store-registry-CZQ9oZKe.js +2 -0
- package/dist/client/assets/{studio-tools-nA7ZTnFV.js → studio-tools-ajGrecV2.js} +1 -1
- package/dist/client/assets/{switch-CuT_exNr.js → switch-C6ORwIf0.js} +1 -1
- package/dist/client/assets/tab-id-yjGvxWDL.js +1 -0
- package/dist/client/assets/{table-CWyE2zgw.js → table-DyVNd3lx.js} +1 -1
- package/dist/client/assets/{tabs-DRqPX6Mz.js → tabs-BbeJw3E0.js} +1 -1
- package/dist/client/assets/{textarea-B3Rf9sP3.js → textarea-CjjAiaC_.js} +1 -1
- package/dist/client/assets/{toggle-group-BuLxG5r3.js → toggle-group-CBKef6if.js} +1 -1
- package/dist/client/assets/toolbar-BS4jP5VP.js +1 -0
- package/dist/client/assets/{toolbar-icon-button-CwCDO4L5.js → toolbar-icon-button-aR9nKvjU.js} +1 -1
- package/dist/client/assets/tools-list-yY8qipR7.js +1 -0
- package/dist/client/assets/tooltip-CX8JDN5z.js +1 -0
- package/dist/client/assets/{types-B2Xs3OM7.js → types-B4pxnIIx.js} +1 -1
- package/dist/client/assets/{use-ai-providers-CW0jtnuO.js → use-ai-providers-BFYpQ3Dm.js} +1 -1
- package/dist/client/assets/{use-automations-CuWiOTtv.js → use-automations-D2Y3aBGO.js} +1 -1
- package/dist/client/assets/{use-capability-C9whYnsG.js → use-capability-rVzvcxKr.js} +1 -1
- package/dist/client/assets/use-clock-tick-BZ0iPGQL.js +1 -0
- package/dist/client/assets/use-collections-Dkob9Q0i.js +1 -0
- package/dist/client/assets/{use-connection-BLVjIktc.js → use-connection-BHlBIpYJ.js} +1 -1
- package/dist/client/assets/{use-copy-_bA4U2MU.js → use-copy-CQkPNAJi.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-DAOEgAsA.js → use-create-virtual-mcp-Cpq2-1Qg.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-D34fr9f_.js → use-debounced-autosave-C0n83t9Y.js} +1 -1
- package/dist/client/assets/{use-debounced-value-DxBLMeqg.js → use-debounced-value-HI4UvLEV.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-Dk3_PQZu.js → use-decopilot-events-qPFbeAuK.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CkaRxWAn.js → use-delete-connection-Pr4HXWhs.js} +1 -1
- package/dist/client/assets/{use-file-configs-Td4k8wTj.js → use-file-configs-Bwgj83CL.js} +1 -1
- package/dist/client/assets/use-infinite-scroll-gRuFiDfW.js +1 -0
- package/dist/client/assets/{use-join-requests-DoInaUWb.js → use-join-requests-qOUGOtoj.js} +1 -1
- package/dist/client/assets/{use-mcp-client-QTh-uqf4.js → use-mcp-client-x-H3hM3X.js} +2 -2
- package/dist/client/assets/{use-mcp-prompts-5W77PpYc.js → use-mcp-prompts-CB2--qfn.js} +1 -1
- package/dist/client/assets/use-mcp-tools-BAOkrTmg.js +1 -0
- package/dist/client/assets/{use-members-Cc48Xacn.js → use-members-BAUKU0t0.js} +1 -1
- package/dist/client/assets/{use-mobile-Cqur1PpI.js → use-mobile-BNK4ZQXQ.js} +1 -1
- package/dist/client/assets/use-navigate-to-agent-B2zjxakj.js +1 -0
- package/dist/client/assets/{use-org-auth-client-C5lRdd5o.js → use-org-auth-client-CT6ie6N1.js} +1 -1
- package/dist/client/assets/{use-org-sso-DGL7haeQ.js → use-org-sso-DIb9lRy0.js} +1 -1
- package/dist/client/assets/{use-organization-roles-UeKRVQhu.js → use-organization-roles-bMxDWnEc.js} +1 -1
- package/dist/client/assets/{use-organization-settings-CnPdR5CP.js → use-organization-settings-QG8fys4M.js} +1 -1
- package/dist/client/assets/{use-registry-connections-HQM1hA3o.js → use-registry-connections-BvC5yqnv.js} +1 -1
- package/dist/client/assets/{use-secrets-D-GN3cJh.js → use-secrets-BUi_Va3F.js} +1 -1
- package/dist/client/assets/use-status-sounds-DV61EqQ3.js +1 -0
- package/dist/client/assets/{use-view-mode-BMlb6QOX.js → use-view-mode-BaQ_SNlr.js} +1 -1
- package/dist/client/assets/use-virtual-mcp-zN_q3qUT.js +1 -0
- package/dist/client/assets/useInfiniteQuery-W1abYeKO.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-DTvKBZgn.js +1 -0
- package/dist/client/assets/variant-calendar-N7_o0k3x.js +1 -0
- package/dist/client/assets/{view-mode-toggle-D0e_xb-Q.js → view-mode-toggle-RdEYDkk_.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +3 -3
- package/dist/server/server.js +3 -3
- package/package.json +1 -1
- package/dist/client/assets/agent-capabilities-Cpju5Yfe.js +0 -1
- package/dist/client/assets/agent-icon-BvZm1osM.js +0 -1
- package/dist/client/assets/agents-list-BzkaDxFg.js +0 -1
- package/dist/client/assets/ai-providers-DadR3aQt.js +0 -1
- package/dist/client/assets/app-editor-CAH73t0u.js +0 -1
- package/dist/client/assets/automation-runs-CmgFzJTt.js +0 -1
- package/dist/client/assets/automations-D21tUX_h.js +0 -1
- package/dist/client/assets/brand-context-DHuctVxS.js +0 -1
- package/dist/client/assets/buckets-CZdkIll2.js +0 -1
- package/dist/client/assets/bulk-category-panel-DBxbY94B.js +0 -1
- package/dist/client/assets/capability-load-error-D7uMbvO0.js +0 -1
- package/dist/client/assets/category-editor-DJYxfrMo.js +0 -1
- package/dist/client/assets/collection-detail-uY6XXgWz.js +0 -1
- package/dist/client/assets/commerce-onboarding-DtUMhwdU.js +0 -1
- package/dist/client/assets/connection-detail-DlI7-vLh.js +0 -1
- package/dist/client/assets/connections-Ci34jtNe.js +0 -1
- package/dist/client/assets/constants-nH3qQ_1f.js +0 -1
- package/dist/client/assets/content-blocks-o63cs2vh.js +0 -1
- package/dist/client/assets/decopilot--vqccpDb.js +0 -4
- package/dist/client/assets/file-explorer-BGhwIot0.js +0 -2
- package/dist/client/assets/general-D5as9e6z.js +0 -1
- package/dist/client/assets/github-repo-picker-B3tomRAJ.js +0 -1
- package/dist/client/assets/index-5uzKO7q6.css +0 -1
- package/dist/client/assets/index-C7DWYqRh.js +0 -1
- package/dist/client/assets/index-CEE6U8OI.js +0 -1
- package/dist/client/assets/index-ELtqDe0g.js +0 -513
- package/dist/client/assets/library-tab-BBr_dx-g.js +0 -7
- package/dist/client/assets/members-BboKmC5r.js +0 -1
- package/dist/client/assets/monaco-editor-xlUuBDU4.js +0 -9
- package/dist/client/assets/org-install-CDUCFQCm.js +0 -1
- package/dist/client/assets/page-seo-form-Cfv9ng9q.js +0 -1
- package/dist/client/assets/page-seo-sheet-CIF4tqJJ.js +0 -1
- package/dist/client/assets/post-editor-BiHws1oe.js +0 -1
- package/dist/client/assets/primitives-0HgpGbC7.js +0 -1
- package/dist/client/assets/profile-ZMZrPNFW.js +0 -1
- package/dist/client/assets/project-app-view-O-o90Cxo.js +0 -1
- package/dist/client/assets/record-editor-BZ3V6i3V.js +0 -1
- package/dist/client/assets/registry-DzfT-ESq.js +0 -2
- package/dist/client/assets/roles-DYzEztRG.js +0 -1
- package/dist/client/assets/scroll-area-Bsik7Uif.js +0 -188
- package/dist/client/assets/secrets-DJrAzRmE.js +0 -1
- package/dist/client/assets/sections-editor-i5xgzCTq.js +0 -2
- package/dist/client/assets/select-model-C49KT9p5.js +0 -1
- package/dist/client/assets/seo-editor-C38OT2eM.js +0 -1
- package/dist/client/assets/settings-layout-DePsodvD.js +0 -1
- package/dist/client/assets/sheet-DSSfro03.js +0 -1
- package/dist/client/assets/shell-controls-DMbQmeKU.js +0 -1
- package/dist/client/assets/shell-layout-DdmjIlR4.js +0 -1
- package/dist/client/assets/sidebar-BJwboMe2.js +0 -1
- package/dist/client/assets/sso-xj4rMylh.js +0 -1
- package/dist/client/assets/store-DlhSxr4k.js +0 -1
- package/dist/client/assets/store-registry-BayPiGW-.js +0 -2
- package/dist/client/assets/tab-id-Bgchl1bv.js +0 -1
- package/dist/client/assets/task-row-DzSs63v5.js +0 -1
- package/dist/client/assets/task-status-CNEAWeje.js +0 -1
- package/dist/client/assets/toolbar-CVjg3TEd.js +0 -1
- package/dist/client/assets/tools-list-Dzc5vr-A.js +0 -1
- package/dist/client/assets/tooltip-Bzas0fb8.js +0 -1
- package/dist/client/assets/use-clock-tick-B6ygxook.js +0 -1
- package/dist/client/assets/use-collections-BP4R8sI-.js +0 -1
- package/dist/client/assets/use-infinite-scroll-1VhU5Q3H.js +0 -1
- package/dist/client/assets/use-mcp-tools-BTYjbm6L.js +0 -1
- package/dist/client/assets/use-navigate-to-agent-CaUSC1CF.js +0 -1
- package/dist/client/assets/use-status-sounds-DEhedUWx.js +0 -1
- package/dist/client/assets/use-virtual-mcp-n0IfHFn6.js +0 -1
- package/dist/client/assets/useInfiniteQuery-DEG0qlSd.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DzP8_asj.js +0 -1
- package/dist/client/assets/useSuspenseQueries-CI8oYgcQ.js +0 -1
- package/dist/client/assets/variant-calendar-CIBbpgAR.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
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 Re,u as it,w as Tt,b as rt,x as Ot,y as at,L as At}from"./index-d52A49fX.js";import{A as Rt}from"./auth-entry-BwlcwCMz.js";import{A as kt}from"./auth-split-layout-DiG8voFB.js";import{O as Ze}from"./organization-choice-C-TyyEjY.js";import{f as Lt}from"./tab-id-Bgchl1bv.js";import{I as ye}from"./input-B_5YyJ8y.js";import{u as ke}from"./use-mcp-client-QTh-uqf4.js";import{W as De,S as lt,g as Pt,C as $t}from"./constants-nH3qQ_1f.js";import{i as ct}from"./XCircle-Cz7czjsw.js";import{I as Fe}from"./integration-icon-DXGEOTjP.js";import{D as he,a as dt,b as ut,c as mt,d as ft,e as pt}from"./dialog-C2MVTIBt.js";import{T as gt,a as ht,b as xt}from"./tooltip-Bzas0fb8.js";import{i as Me}from"./CheckCircle-CebfgxLq.js";import{i as yt,t as bt}from"./agent-icon-BvZm1osM.js";import{g as Ut,c as zt,e as Dt}from"./extract-connection-data-Dq7vx8cX.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-TSiFK-dI.js";import{i as Mt}from"./Check-BqH5cjqe.js";import{a as vt}from"./Copy01-YBIj7O7M.js";import{i as qt}from"./Settings02-COfrOHpp.js";import{s as Kt}from"./Eye-o8ajkfvt.js";import{u as Vt}from"./use-debounced-value-DxBLMeqg.js";import{f as Gt}from"./github-installations-DzN1UQ4x.js";import{u as Ht}from"./useSuspenseQueries-CI8oYgcQ.js";import{a as Bt}from"./authenticate-and-persist-oauth-ezeRyKPp.js";import{i as jt}from"./ArrowUpRight-B1XPsNPZ.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-BrhzNA4d.js";import"./User01-DuGAbO5F.js";import"./auth-B8jeHTDK.js";import"./X-DRR7RtBP.js";import"./AlertCircle-D90xu5-8.js";import"./Tool01-DJgxsN47.js";import"./SwitchHorizontal01-Bu9ipsE_.js";import"./ZapSquare-Ch518nCD.js";import"./Users03-JTfAuK6m.js";import"./Loading02-DaLVACu2.js";import"./ChevronDown-DhzhS3K5.js";import"./ChevronRight-DntNgeBz.js";import"./ChevronUp-DPJfOoQR.js";import"./Circle-umqkxNwx.js";import"./Stars02-sR281nUk.js";import"./ZoomOut-Chl8lvun.js";import"./DotsVertical-DoxN78H8.js";import"./Globe01-D3NrpjPq.js";import"./FilterLines-CEBhmChB.js";import"./Star01-twQgP5oO.js";import"./Globe04-6xG6GU2e.js";import"./HardDrive-CDBenwE2.js";import"./Key01-CwgjH_um.js";import"./LayoutLeft-CKcHwaHf.js";import"./LinkExternal01-DBFEHO3t.js";import"./List-s8AZWxpk.js";import"./Monitor01-lxPxQ2fk.js";import"./Sun-DTFx5jn8.js";import"./Palette-DHyTdFqR.js";import"./Play-TOCBGzP9.js";import"./Plus-DkGwhdIW.js";import"./SearchLg-C9MBYrXH.js";import"./SearchMd-Dhz0UROc.js";import"./Shield01-BrK-9cDf.js";import"./Stars01-C27kMlCK.js";import"./Trash01-myAGgKHr.js";import"./Upload01-m0ny4YmQ.js";import"./Users01-e9Wb8IJU.js";import"./XClose-eEYHZsPT.js";import"./Zap-CMZ9cCJz.js";import"./label-CWqrShVu.js";import"./mcp-oauth-CSUfdVCn.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 r=o?e:`https://${e}`;let a;try{a=new URL(r)}catch{return{ok:!1,error:"Enter a valid website URL."}}if(a.protocol!=="http:"&&a.protocol!=="https:")return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const c=a.hostname.split(".");return c.length<2||c.some(d=>!d||!Jt.test(d))?{ok:!1,error:"Enter a valid website URL."}:(a.protocol="https:",{ok:!0,value:a.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 $e(s){const e=q.c(14),{children:n,className:o,wrapperClassName:i}=s,[r,a]=V.useState(!0);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=v=>{if(!v)return;const C=()=>{const f=v.scrollHeight-v.scrollTop-v.clientHeight<8;a(f)};C(),v.addEventListener("scroll",C,{passive:!0});const x=new ResizeObserver(C);x.observe(v);for(const f of Array.from(v.children))x.observe(f);return()=>{v.removeEventListener("scroll",C),x.disconnect()}},e[0]=c):c=e[0];const d=c;let u;e[1]!==i?(u=oe("relative",i),e[1]=i,e[2]=u):u=e[2];let l;e[3]!==n||e[4]!==o?(l=t.jsx("div",{ref:d,className:o,children:n}),e[3]=n,e[4]=o,e[5]=l):l=e[5];const p=r?"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]!==l||e[12]!==h?(g=t.jsxs("div",{className:u,children:[l,h]}),e[10]=u,e[11]=l,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 c=i?.properties?.__type?.const;typeof c=="string"&&c.length>0&&n.push({fieldKey:o,bindingType:c})}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 Ue(s){return s==null?!1:typeof s=="string"?s.trim().length>0:typeof s=="number"||typeof s=="boolean"?!0:Array.isArray(s)?s.some(Ue):typeof s=="object"?Object.entries(s).some(([e,n])=>!e.startsWith("__")&&Ue(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 Ue(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,r)=>{const a=c=>c.status==="active"?0:1;return a(i)!==a(r)?a(i)-a(r):(r.updated_at??"").localeCompare(i.updated_at??"")}),o[0].id)}function ln(s){return s.server?.icons?.[0]?.src??Ut(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],r=i?s.itemsById[i.registryAppId]:s.itemsByName[o.bindingType];if(!r)continue;const a=s.configurationState?.[o.fieldKey]?.value,c=a?n.get(a):void 0,d=a&&c?a:null,u=d?s.connectionReadiness?.[d]!==!1:!1,l=!!d&&u,p=l?void 0:s.saBindings?.[o.bindingType],m=l||!!p,h=l?"oauth":p?"sa":null;e.push({fieldKey:o.fieldKey,bindingType:o.bindingType,registryItem:r,title:cn(r,o.bindingType),icon:ln(r),headline:i?.headline??r._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:c?.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 a=new URL(i.startsWith("http")?i:`https://${i}`).hostname||"";return a.startsWith("www.")&&(a=a.substring(4)),a}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,r,a;e[0]!==s?({value:a,onChange:o,placeholder:i,className:n,...r}=s,e[0]=s,e[1]=n,e[2]=o,e[3]=i,e[4]=r,e[5]=a):(n=e[1],o=e[2],i=e[3],r=e[4],a=e[5]);const[c,d]=V.useState(!1),[u,l]=V.useState(!1);let p;e[6]!==a?(p=async()=>{if(a)try{await navigator.clipboard.writeText(a),l(!0),setTimeout(()=>l(!1),2e3)}catch(A){console.error("Failed to copy text: ",A)}},e[6]=a,e[7]=p):p=e[7];const m=p;let h;e[8]!==c?(h=()=>{d(!c)},e[8]=c,e[9]=h):h=e[9];const g=h,v=c?"text":"password";let C;e[10]!==n?(C=oe("pr-20",n),e[10]=n,e[11]=C):C=e[11];let x;e[12]!==o||e[13]!==i||e[14]!==r||e[15]!==v||e[16]!==C||e[17]!==a?(x=t.jsx(ye,{type:v,value:a,onChange:o,placeholder:i,className:C,...r}),e[12]=o,e[13]=i,e[14]=r,e[15]=v,e[16]=C,e[17]=a,e[18]=x):x=e[18];const f=c?"Hide password":"Show password";let b;e[19]!==c?(b=c?t.jsx(qt,{size:16}):t.jsx(Kt,{size:16}),e[19]=c,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 j=!a,N=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]!==N||e[29]!==_||e[30]!==j?(S=t.jsx(H,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:m,disabled:j,title:N,children:_}),e[27]=m,e[28]=N,e[29]=_,e[30]=j,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 T;return e[35]!==I||e[36]!==x?(T=t.jsxs("div",{className:"relative",children:[x,I]}),e[35]=I,e[36]=x,e[37]=T):T=e[37],T}function qe(s){const e=q.c(19),{card:n,selfClient:o,org:i,onDone:r,onError:a}=s,c=Ce();let d;e[0]!==n||e[1]!==o?(d=async C=>{const x={...n.configurationState??{},...C};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]!==r||e[4]!==i||e[5]!==c?(u=async()=>{await c.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(i.id)}),r()},e[3]=r,e[4]=i,e[5]=c,e[6]=u):u=e[6];let l;e[7]!==a?(l=C=>{a?.(C)},e[7]=a,e[8]=l):l=e[8];let p;e[9]!==d||e[10]!==u||e[11]!==l?(p={mutationFn:d,onSuccess:u,onError:l},e[9]=d,e[10]=u,e[11]=l,e[12]=p):p=e[12];const m=fe(p);let h;e[13]!==m?(h=C=>m.mutate(C),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:r,onIsPendingChange:a}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=Se(fn),e[0]=c):c=e[0];const d=n.configurationState?.accountName||"",u=n.configurationState?.appKey||"",l=n.configurationState?.appToken||"";let p;e[1]!==d||e[2]!==u||e[3]!==l?(p={resolver:c,defaultValues:{accountName:d,appKey:u,appToken:l}},e[1]=d,e[2]=u,e[3]=l,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]!==r||e[15]!==i||e[16]!==o?(v={card:n,selfClient:o,org:i,onDone:r},e[13]=n,e[14]=r,e[15]=i,e[16]=o,e[17]=v):v=e[17];const{save:C,isPending:x,error:f}=qe(v);let b,y;e[18]!==x||e[19]!==a?(y=()=>{a?.(x)},b=[x,a],e[18]=x,e[19]=a,e[20]=b,e[21]=y):(b=e[20],y=e[21]),V.useEffect(y,b);let j;if(e[22]!==m||e[23]!==C){let D;e[25]!==C?(D=async R=>{C(R)},e[25]=C,e[26]=D):D=e[26],j=m.handleSubmit(D),e[22]=m,e[23]=C,e[24]=j}else j=e[24];const N=j;let _;e[27]!==x?(_=D=>{const{field:R}=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",...R,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:R}=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",...R,disabled:x})}),t.jsx(me,{})]})},e[32]=x,e[33]=I):I=e[33];let T;e[34]!==m.control||e[35]!==I?(T=t.jsx(ce,{control:m.control,name:"appKey",render:I}),e[34]=m.control,e[35]=I,e[36]=T):T=e[36];let A;e[37]!==x?(A=D=>{const{field:R}=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",...R,disabled:x})}),t.jsx(me,{})]})},e[37]=x,e[38]=A):A=e[38];let E;e[39]!==m.control||e[40]!==A?(E=t.jsx(ce,{control:m.control,name:"appToken",render:A}),e[39]=m.control,e[40]=A,e[41]=E):E=e[41];let L;e[42]!==m||e[43]!==S||e[44]!==T||e[45]!==E?(L=t.jsxs(Ee,{...m,children:[S,T,E]}),e[42]=m,e[43]=S,e[44]=T,e[45]=E,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]!==r?(P=t.jsx(H,{type:"button",variant:"outline",onClick:r,disabled:x,children:"Cancelar"}),e[49]=x,e[50]=r,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 w;e[55]!==P||e[56]!==M?(w=t.jsxs(he,{className:"pt-4",children:[P,M]}),e[55]=P,e[56]=M,e[57]=w):w=e[57];let O;return e[58]!==N||e[59]!==L||e[60]!==z||e[61]!==w?(O=t.jsxs("form",{onSubmit:N,className:"space-y-4",children:[L,z,w]}),e[58]=N,e[59]=L,e[60]=z,e[61]=w,e[62]=O):O=e[62],O}function Ke(s){const e=q.c(29),{options:n,value:o,onChange:i,disabled:r,ariaLabel:a,searchPlaceholder:c,hideSearch:d}=s,u=c===void 0?"Buscar...":c,l=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 C=v;let x;e[6]!==r||e[7]!==g||e[8]!==i?(x=function(S){if(r||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(S.key))return;S.preventDefault();const T=S.currentTarget.dataset.value,A=g.indexOf(T),E=g.length;if(E===0)return;let L;S.key==="ArrowDown"||S.key==="ArrowRight"?L=(A+1)%E:S.key==="ArrowUp"||S.key==="ArrowLeft"?L=(A-1+E)%E:S.key==="Home"?L=0:L=E-1;const z=g[L];i(z),S.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(z)}"]`)?.focus()},e[6]=r,e[7]=g,e[8]=i,e[9]=x):x=e[9];const f=x;let b;e[10]!==a||e[11]!==r||e[12]!==l||e[13]!==p||e[14]!==u?(b=l?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:r,placeholder:u,"aria-label":`Buscar ${a}`,className:"h-8 pl-8"})]}),e[10]=a,e[11]=r,e[12]=l,e[13]=p,e[14]=u,e[15]=b):b=e[15];let y;e[16]!==r||e[17]!==h||e[18]!==f||e[19]!==i||e[20]!==C||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:r,"data-value":_.value,tabIndex:_.value===C?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]=r,e[17]=h,e[18]=f,e[19]=i,e[20]=C,e[21]=o,e[22]=y):y=e[22];let j;e[23]!==a||e[24]!==y?(j=t.jsx("div",{role:"radiogroup","aria-label":a,className:"max-h-[280px] overflow-y-auto",children:y}),e[23]=a,e[24]=y,e[25]=j):j=e[25];let N;return e[26]!==b||e[27]!==j?(N=t.jsxs("div",{className:"space-y-2",children:[b,j]}),e[26]=b,e[27]=j,e[28]=N):N=e[28],N}function gn(s){return s.value}function Le(s){const e=q.c(16),{label:n,iconSize:o,className:i,iconClassName:r,labelClassName:a}=s,c=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]!==r?(u=oe("shrink-0 animate-spin",r),e[2]=r,e[3]=u):u=e[3];let l;e[4]!==c||e[5]!==u?(l=t.jsx(ze,{size:c,className:u}),e[4]=c,e[5]=u,e[6]=l):l=e[6];let p;e[7]!==a?(p=oe("text-sm",a),e[7]=a,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]!==l||e[14]!==m?(h=t.jsxs("span",{className:d,children:[l,m]}),e[12]=d,e[13]=l,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:r,org:a,onDone:c,onDisconnect:d,onIsPendingChange:u}=s;let l;e[0]!==o||e[1]!==a.id?(l=Y.commerceDiscoveryCompanionGaProperties(a.id,o),e[0]=o,e[1]=a.id,e[2]=l):l=e[2];let p;e[3]!==i?(p=async()=>{const U=await i.callTool({name:"get-account-summaries",arguments:{}}),K=ne(U);return mn(K)},e[3]=i,e[4]=p):p=e[4];let m;e[5]!==l||e[6]!==p?(m={queryKey:l,queryFn:p},e[5]=l,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 C;e[9]!==v?(C={resolver:g,defaultValues:{propertyId:v}},e[9]=v,e[10]=C):C=e[10];const x=Ne(C);let f;e[11]!==n||e[12]!==c||e[13]!==a||e[14]!==r?(f={card:n,selfClient:r,org:a,onDone:c},e[11]=n,e[12]=c,e[13]=a,e[14]=r,e[15]=f):f=e[15];const{save:b,isPending:y,error:j}=qe(f);let N,_;e[16]!==y||e[17]!==u?(N=()=>{u?.(y)},_=[y,u],e[16]=y,e[17]=u,e[18]=N,e[19]=_):(N=e[18],_=e[19]),V.useEffect(N,_);let S;if(e[20]!==x||e[21]!==b){let U;e[23]!==b?(U=async K=>{b(K)},e[23]=b,e[24]=U):U=e[24],S=x.handleSubmit(U),e[20]=x,e[21]=b,e[22]=S}else S=e[22];const I=S;if(h.isLoading){let U;return e[25]===Symbol.for("react.memo_cache_sentinel")?(U=t.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:t.jsx(Le,{label:"Carregando propriedades..."})}),e[25]=U):U=e[25],U}if(h.isError){let U;return e[26]===Symbol.for("react.memo_cache_sentinel")?(U=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]=U):U=e[26],U}let T;e[27]!==h.data?(T=h.data||[],e[27]=h.data,e[28]=T):T=e[28];const A=T;if(A.flatMap(bn).length===0){let U;e[29]===Symbol.for("react.memo_cache_sentinel")?(U=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]=U):U=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]!==c?(Q=t.jsx(H,{type:"button",variant:"outline",onClick:c,children:"Fechar"}),e[32]=c,e[33]=Q):Q=e[33];let W;return e[34]!==K||e[35]!==Q?(W=t.jsxs("div",{className:"space-y-4",children:[U,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=U=>{const{field:K}=U;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]!==j?(F=j&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:j instanceof Error?j.message:"Não foi possível salvar a configuração"}),e[46]=j,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 w;e[51]!==y||e[52]!==c?(w=t.jsx(H,{type:"button",variant:"outline",onClick:c,disabled:y,children:"Cancelar"}),e[51]=y,e[52]=c,e[53]=w):w=e[53];const O=y?"Salvando...":"Salvar";let D;e[54]!==y||e[55]!==O?(D=t.jsx(H,{type:"submit",disabled:y,children:O}),e[54]=y,e[55]=O,e[56]=D):D=e[56];let R;e[57]!==w||e[58]!==D?(R=t.jsxs("div",{className:"flex gap-2",children:[w,D]}),e[57]=w,e[58]=D,e[59]=R):R=e[59];let $;e[60]!==M||e[61]!==R?($=t.jsxs(he,{className:"flex-col gap-2 pt-4 sm:flex-row sm:items-center sm:justify-between",children:[M,R]}),e[60]=M,e[61]=R,e[62]=$):$=e[62];let G;return e[63]!==I||e[64]!==P||e[65]!==F||e[66]!==$?(G=t.jsxs("form",{onSubmit:I,className:"space-y-4",children:[P,F,$]}),e[63]=I,e[64]=P,e[65]=F,e[66]=$,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:r,org:a,contextSiteUrl:c,onDone:d,onIsPendingChange:u}=s;let l;e[0]!==o||e[1]!==a.id?(l=Y.commerceDiscoveryCompanionGscSites(a.id,o),e[0]=o,e[1]=a.id,e[2]=l):l=e[2];let p;e[3]!==i?(p=async()=>{const R=await i.callTool({name:"list_sites",arguments:{}});return ne(R).sites||[]},e[3]=i,e[4]=p):p=e[4];let m;e[5]!==l||e[6]!==p?(m={queryKey:l,queryFn:p},e[5]=l,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 C;e[9]!==v?(C={resolver:g,defaultValues:{siteUrl:v}},e[9]=v,e[10]=C):C=e[10];const x=Ne(C);let f;e[11]!==n||e[12]!==d||e[13]!==a||e[14]!==r?(f={card:n,selfClient:r,org:a,onDone:d},e[11]=n,e[12]=d,e[13]=a,e[14]=r,e[15]=f):f=e[15];const{save:b,isPending:y,error:j}=qe(f);let N,_;e[16]!==y||e[17]!==u?(N=()=>{u?.(y)},_=[y,u],e[16]=y,e[17]=u,e[18]=N,e[19]=_):(N=e[18],_=e[19]),V.useEffect(N,_);let S;if(e[20]!==x||e[21]!==b){let R;e[23]!==b?(R=async $=>{b($)},e[23]=b,e[24]=R):R=e[24],S=x.handleSubmit(R),e[20]=x,e[21]=b,e[22]=S}else S=e[22];const I=S;if(h.isLoading){let R;return e[25]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:t.jsx(Le,{label:"Carregando sites..."})}),e[25]=R):R=e[25],R}if(h.isError){let R;return e[26]===Symbol.for("react.memo_cache_sentinel")?(R=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]=R):R=e[26],R}let T,A;if(e[27]!==n.configurationState?.siteUrl||e[28]!==c||e[29]!==x||e[30]!==h.data){A=Symbol.for("react.early_return_sentinel");e:{if(T=h.data||[],T.length===0){let $;e[33]===Symbol.for("react.memo_cache_sentinel")?($=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]=$):$=e[33],A=$;break e}const R=n.configurationState?.siteUrl;if(R&&x.getValues("siteUrl")!==R)x.setValue("siteUrl",R);else if(!R&&!x.getValues("siteUrl")){const $=un(c,T);$&&x.setValue("siteUrl",$)}}e[27]=n.configurationState?.siteUrl,e[28]=c,e[29]=x,e[30]=h.data,e[31]=T,e[32]=A}else T=e[31],A=e[32];if(A!==Symbol.for("react.early_return_sentinel"))return A;let E;e[34]!==y||e[35]!==T?(E=R=>{const{field:$}=R;return t.jsxs(de,{children:[t.jsx(ue,{children:t.jsx(Ke,{options:T.map(Cn),value:$.value,onChange:$.onChange,disabled:y,ariaLabel:"Site verificado"})}),t.jsx(me,{})]})},e[34]=y,e[35]=T,e[36]=E):E=e[36];let L;e[37]!==x.control||e[38]!==E?(L=t.jsx(ce,{control:x.control,name:"siteUrl",render:E}),e[37]=x.control,e[38]=E,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]!==j?(P=j&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:j instanceof Error?j.message:"Não foi possível salvar a configuração"}),e[43]=j,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 w;e[48]!==y||e[49]!==M?(w=t.jsx(H,{type:"submit",disabled:y,children:M}),e[48]=y,e[49]=M,e[50]=w):w=e[50];let O;e[51]!==F||e[52]!==w?(O=t.jsxs(he,{className:"pt-4",children:[F,w]}),e[51]=F,e[52]=w,e[53]=O):O=e[53];let D;return e[54]!==I||e[55]!==z||e[56]!==P||e[57]!==O?(D=t.jsxs("form",{onSubmit:I,className:"space-y-4",children:[z,P,O]}),e[54]=I,e[55]=z,e[56]=P,e[57]=O,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),r=o.trim(),a=await Promise.allSettled(i.map(async l=>{const p=l.type==="User"?"user":"org",m=r?`${p}:${l.login} ${r} in:name`:`${p}:${l.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??[]})),c=new Map;let d=0;for(const l of a){if(l.status==="rejected"){d+=1;continue}for(const p of l.value)p.full_name&&!c.has(p.full_name)&&c.set(p.full_name,p)}return{repos:Array.from(c.values()).sort((l,p)=>(p.updated_at??"").localeCompare(l.updated_at??"")).map(l=>l.full_name),failed:d,total:i.length}}function wn(s){const e=q.c(80),{connectionId:n,companionClient:o,selfClient:i,org:r,onDone:a,onIsPendingChange:c}=s,d=Ce();let u;e[0]!==r.id?(u=De.COMMERCE_DISCOVERY(r.id),e[0]=r.id,e[1]=u):u=e[1];const l=u,[p,m]=V.useState(""),h=Vt(p,300);let g;e[2]!==n||e[3]!==r.id?(g=Y.commerceDiscoveryCompanionGithubSelected(r.id,n),e[2]=n,e[3]=r.id,e[4]=g):g=e[4];let v;e[5]!==l||e[6]!==i?(v=async()=>{const Z=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:l}}),X=ne(Z).item?.configuration_state??null;return typeof X?.github_repo=="string"?X.github_repo:""},e[5]=l,e[6]=i,e[7]=v):v=e[7];let C;e[8]!==g||e[9]!==v?(C={queryKey:g,queryFn:v},e[8]=g,e[9]=v,e[10]=C):C=e[10];const x=be(C);let f;e[11]!==n||e[12]!==h||e[13]!==r.id?(f=Y.commerceDiscoveryCompanionGithubRepos(r.id,n,h.trim()),e[11]=n,e[12]=h,e[13]=r.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 j=be(y);let N;e[23]===Symbol.for("react.memo_cache_sentinel")?(N={resolver:Se(_n),defaultValues:{githubRepo:""}},e[23]=N):N=e[23];const _=Ne(N);let S;e[24]!==l||e[25]!==i?(S=async Z=>{const X=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:l}}),It={...ne(X).item?.configuration_state??null??{},github_repo:Z};await i.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:l,data:{configuration_state:It}}})},e[24]=l,e[25]=i,e[26]=S):S=e[26];let I;e[27]!==l||e[28]!==a||e[29]!==r.id||e[30]!==d?(I=async()=>{await d.invalidateQueries({queryKey:Y.commerceDiscoveryConnection(r.id,l)}),await d.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(r.id)}),a()},e[27]=l,e[28]=a,e[29]=r.id,e[30]=d,e[31]=I):I=e[31];let T;e[32]!==I||e[33]!==S?(T={mutationFn:S,onSuccess:I},e[32]=I,e[33]=S,e[34]=T):T=e[34];const A=fe(T),E=A.isPending;let L,z;e[35]!==E||e[36]!==c?(L=()=>{c?.(E)},z=[E,c],e[35]=E,e[36]=c,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 w,O,D;if(e[44]!==h||e[45]!==j.data?.failed||e[46]!==j.data?.repos||e[47]!==j.data?.total||e[48]!==M){const Z=j.data?.repos??[];w=j.data?.failed??0,D=j.data?.total??0;const X=h.trim();O=[...Z],X&&Nn.test(X)&&!O.includes(X)&&O.unshift(X),M&&!O.includes(M)&&O.push(M),e[44]=h,e[45]=j.data?.failed,e[46]=j.data?.repos,e[47]=j.data?.total,e[48]=M,e[49]=w,e[50]=O,e[51]=D}else w=e[49],O=e[50],D=e[51];const R=D>0&&w===D,$=j.isError||R?"Não foi possível buscar os repositórios (erro ou tempo esgotado). Tente novamente ou digite o repositório no formato owner/nome.":w>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 U;e[53]===Symbol.for("react.memo_cache_sentinel")?(U=Z=>m(Z.target.value),e[53]=U):U=e[53];let K;e[54]!==E||e[55]!==p?(K=t.jsxs("div",{className:"relative",children:[G,t.jsx(ye,{type:"text",value:p,onChange:U,disabled:E,placeholder:"Buscar repositório (ex: deco-sites/fila-store)","aria-label":"Buscar repositório",className:"h-8 pl-8"})]}),e[54]=E,e[55]=p,e[56]=K):K=e[56];let Q;e[57]!==_||e[58]!==E||e[59]!==O||e[60]!==j.isLoading||e[61]!==$?(Q=j.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:[$&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:$}),O.length===0?!$&&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:O.map(In),value:X.value,onChange:X.onChange,disabled:E,ariaLabel:"Repositório",hideSearch:!0})}),t.jsx(me,{})]})}})})]}),e[57]=_,e[58]=E,e[59]=O,e[60]=j.isLoading,e[61]=$,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]!==E||e[66]!==a?(J=t.jsx(H,{type:"button",variant:"outline",onClick:a,disabled:E,children:"Cancelar"}),e[65]=E,e[66]=a,e[67]=J):J=e[67];const te=E?"Salvando...":"Salvar";let k;e[68]!==E||e[69]!==te?(k=t.jsx(H,{type:"submit",disabled:E,children:te}),e[68]=E,e[69]=te,e[70]=k):k=e[70];let B;e[71]!==J||e[72]!==k?(B=t.jsxs(he,{className:"pt-4",children:[J,k]}),e[71]=J,e[72]=k,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:r,initialResourceId:a,onDone:c,onIsPendingChange:d,onOAuthInstead:u}=s,l=_t[n],p=Ce(),[m,h]=V.useState(null);let g,v;if(e[0]!==l.resourceLabel){const k=_e({resourceId:le().trim().min(1,`Informe o ${l.resourceLabel.toLowerCase()}`)});v=Ne,g=Se(k),e[0]=l.resourceLabel,e[1]=g,e[2]=v}else g=e[1],v=e[2];const C=a??"";let x;e[3]!==C?(x={resourceId:C},e[3]=C,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 k=>{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:k.resourceId}});return ne(B)},e[8]=n,e[9]=i,e[10]=o,e[11]=y):y=e[11];let j,N;e[12]!==d?(j=()=>d?.(!0),N=()=>d?.(!1),e[12]=d,e[13]=j,e[14]=N):(j=e[13],N=e[14]);let _;e[15]!==l.label||e[16]!==c||e[17]!==r||e[18]!==n||e[19]!==p||e[20]!==o?(_=async k=>{if(k.ok){h(null),Ae.success(`${l.label} conectado`),o&&await p.invalidateQueries({queryKey:Y.commerceDiscoveryConnectionStatus(r.id,o)}),c();return}h({...On(n,k.reason??"unknown"),detail:k.detail})},e[15]=l.label,e[16]=c,e[17]=r,e[18]=n,e[19]=p,e[20]=o,e[21]=_):_=e[21];let S;e[22]!==y||e[23]!==j||e[24]!==N||e[25]!==_?(S={mutationFn:y,onMutate:j,onSettled:N,onSuccess:_},e[22]=y,e[23]=j,e[24]=N,e[25]=_,e[26]=S):S=e[26];const I=fe(S);let T;if(e[27]!==b||e[28]!==I){let k;e[30]!==I?(k=B=>I.mutate(B),e[30]=I,e[31]=k):k=e[31],T=b.handleSubmit(k),e[27]=b,e[28]=I,e[29]=T}else T=e[29];const A=T,E=I.isPending,L=Ln;let z;e[32]!==l.connectSteps?(z=l.connectSteps.map(kn),e[32]=l.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 w;e[38]!==l.resourceHint||e[39]!==l.resourceLabel||e[40]!==l.resourcePlaceholder||e[41]!==E?(w=k=>{const{field:B}=k;return t.jsxs(de,{children:[t.jsx(Te,{children:l.resourceLabel}),t.jsx(ue,{children:t.jsx(ye,{...B,placeholder:l.resourcePlaceholder,disabled:E,autoComplete:"off"})}),t.jsx(Ft,{children:l.resourceHint}),t.jsx(me,{})]})},e[38]=l.resourceHint,e[39]=l.resourceLabel,e[40]=l.resourcePlaceholder,e[41]=E,e[42]=w):w=e[42];let O;e[43]!==b.control||e[44]!==w?(O=t.jsx(ce,{control:b.control,name:"resourceId",render:w}),e[43]=b.control,e[44]=w,e[45]=O):O=e[45];let D;e[46]!==b||e[47]!==O?(D=t.jsx(Ee,{...b,children:O}),e[46]=b,e[47]=O,e[48]=D):D=e[48];let R;e[49]!==m?(R=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(Rn)})]}),e[49]=m,e[50]=R):R=e[50];let $;e[51]!==I.error||e[52]!==I.isError?($=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]=$):$=e[53];let G;e[54]!==E||e[55]!==u?(G=u?t.jsx("button",{type:"button",onClick:u,disabled:E,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]=E,e[55]=u,e[56]=G):G=e[56];let U;e[57]!==E||e[58]!==c?(U=t.jsx(H,{type:"button",variant:"outline",onClick:c,disabled:E,children:"Cancelar"}),e[57]=E,e[58]=c,e[59]=U):U=e[59];const K=E?"Verificando...":"Vincular";let Q;e[60]!==E||e[61]!==K?(Q=t.jsx(H,{type:"submit",disabled:E,children:K}),e[60]=E,e[61]=K,e[62]=Q):Q=e[62];let W;e[63]!==U||e[64]!==Q?(W=t.jsxs("div",{className:"flex gap-2",children:[U,Q]}),e[63]=U,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]!==R||e[73]!==$||e[74]!==J?(te=t.jsxs("form",{onSubmit:A,className:"space-y-4",children:[P,M,D,R,$,J]}),e[69]=A,e[70]=P,e[71]=D,e[72]=R,e[73]=$,e[74]=J,e[75]=te):te=e[75],te}function Rn(s){return t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{"aria-hidden":!0,children:"•"}),t.jsx("span",{children:s})]},s)}function kn(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 $n(s){const e=q.c(37),{card:n,connecting:o,disabled:i,onConnect:r,org:a,selfClient:c,siteUrl:d,autoOpenConfigFieldKey:u,onAutoOpenConfigHandled:l}=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]!==l||e[6]!==r||e[7]!==a||e[8]!==m||e[9]!==c||e[10]!==d||e[11]!==h?(g=h&&m?t.jsx(Un,{card:n,provider:m,org:a,selfClient:c,siteUrl:d,onOAuthInstead:r,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:a,selfClient:c,connectionId:p,contextSiteUrl:d,autoOpen:rn({autoOpenFieldKey:u,card:n}),onAutoOpenHandled:l})})]}):t.jsx(H,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:i||o,onClick:r,"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]=l,e[6]=r,e[7]=a,e[8]=m,e[9]=c,e[10]=d,e[11]=h,e[12]=g):g=e[12];const v=g;let C;e[13]!==n.icon||e[14]!==n.title?(C=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]=C):C=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]!==C||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:[C,x]}),e[18]=C,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 j;e[25]!==n.headline?(j=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]=j):j=e[26];let N;e[27]!==b||e[28]!==y||e[29]!==j?(N=t.jsxs("div",{className:"min-w-0 flex-1",children:[b,y,j]}),e[27]=b,e[28]=y,e[29]=j,e[30]=N):N=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]!==N||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,N,_]}),e[33]=f,e[34]=N,e[35]=_,e[36]=S):S=e[36],S}function Un(s){const e=q.c(39),{card:n,provider:o,org:i,selfClient:r,siteUrl:a,onOAuthInstead:c,disabled:d,connecting:u}=s,[l,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 C;e[2]!==n.satisfied||e[3]!==n.title||e[4]!==u||e[5]!==d?(C=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]=C):C=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 j;e[15]!==x||e[16]!==y?(j=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]=j):j=e[17];const N=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]!==c?(S=n.satisfied?void 0:()=>{p(!1),c()},e[19]=n.satisfied,e[20]=c,e[21]=S):S=e[21];let I;e[22]!==i||e[23]!==o||e[24]!==r||e[25]!==a||e[26]!==S||e[27]!==N?(I=t.jsx(An,{provider:o,siteUrl:a,selfClient:r,org:i,initialResourceId:N,onDone:_,onIsPendingChange:h,onOAuthInstead:S}),e[22]=i,e[23]=o,e[24]=r,e[25]=a,e[26]=S,e[27]=N,e[28]=I):I=e[28];let T;e[29]!==I||e[30]!==j?(T=t.jsxs(ft,{className:"sm:max-w-lg",children:[j,I]}),e[29]=I,e[30]=j,e[31]=T):T=e[31];let A;e[32]!==v||e[33]!==l||e[34]!==T?(A=t.jsx(pt,{open:l,onOpenChange:v,children:T}),e[32]=v,e[33]=l,e[34]=T,e[35]=A):A=e[35];let E;return e[36]!==A||e[37]!==C?(E=t.jsxs(t.Fragment,{children:[C,A]}),e[36]=A,e[37]=C,e[38]=E):E=e[38],E}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:r,contextSiteUrl:a,autoOpen:c,onAutoOpenHandled:d}=s;let u;e[0]!==r||e[1]!==o.id||e[2]!==o.slug?(u={connectionId:r,orgId:o.id,orgSlug:o.slug},e[0]=r,e[1]=o.id,e[2]=o.slug,e[3]=u):u=e[3];const l=ke(u),[p,m]=V.useState(c),[h,g]=V.useState(!1),v=Ce(),C=Tn[n.bindingType],x=on(n.configurationState);let f;e[4]!==c||e[5]!==d?(f=()=>{m(!1),c&&d()},e[4]=c,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 j=y;let N;e[10]!==r||e[11]!==i?(N=async()=>{await i.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:r,force:!0}})},e[10]=r,e[11]=i,e[12]=N):N=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]!==N||e[19]!==_?(S={mutationFn:N,onSuccess:_,onError:Fn},e[18]=N,e[19]=_,e[20]=S):S=e[20];const I=fe(S);if(!C)return null;let T;e[21]===Symbol.for("react.memo_cache_sentinel")?(T=()=>m(!0),e[21]=T):T=e[21];const A=`Configurar ${n.title}`;let E;e[22]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx(bt,{size:16}),e[22]=E):E=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:T,"aria-label":A,children:E})}),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 w;e[33]!==n.title?(w=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]=w):w=e[34];let O;e[35]!==M||e[36]!==w?(O=t.jsxs(mt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[M,w]}),e[35]=M,e[36]=w,e[37]=O):O=e[37];let D;e[38]!==I?(D=()=>I.mutate(),e[38]=I,e[39]=D):D=e[39];let R;e[40]!==C||e[41]!==n||e[42]!==b||e[43]!==l||e[44]!==r||e[45]!==a||e[46]!==o||e[47]!==i||e[48]!==D?(R=t.jsx(C,{card:n,connectionId:r,companionClient:l,selfClient:i,org:o,contextSiteUrl:a,onDone:b,onDisconnect:D,onIsPendingChange:g}),e[40]=C,e[41]=n,e[42]=b,e[43]=l,e[44]=r,e[45]=a,e[46]=o,e[47]=i,e[48]=D,e[49]=R):R=e[49];let $;e[50]!==O||e[51]!==R?($=t.jsxs(ft,{className:"sm:max-w-lg",children:[O,R]}),e[50]=O,e[51]=R,e[52]=$):$=e[52];let G;e[53]!==p||e[54]!==j||e[55]!==$?(G=t.jsx(pt,{open:p,onOpenChange:j,children:$}),e[53]=p,e[54]=j,e[55]=$,e[56]=G):G=e[56];let U;return e[57]!==F||e[58]!==G?(U=t.jsxs(t.Fragment,{children:[F,G]}),e[57]=F,e[58]=G,e[59]=U):U=e[59],U}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:r}=s;let a;e[0]!==i||e[1]!==o.id||e[2]!==o.slug?(a={connectionId:i,orgId:o.id,orgSlug:o.slug},e[0]=i,e[1]=o.id,e[2]=o.slug,e[3]=a):a=e[3];const c=ke(a);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]!==c?(u=async()=>{const k=await c.callTool({name:"MCP_CONFIGURATION",arguments:{}});return ne(k)},e[7]=c,e[8]=u):u=e[8];let l;e[9]!==d||e[10]!==u?(l={queryKey:d,queryFn:u},e[9]=d,e[10]=u,e[11]=l):l=e[11];const p=ge(l),m=Xt(p.data?.stateSchema??{properties:{}}),h=m.map(Jn),g=m.map(Yn).filter(Wn),v=m.filter(Qn).map(Bn),C=[...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 k=await n.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:i}});return ne(k)},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 j=ge(b).data?.item?.configuration_state??null;let N;e[21]!==j?(N=k=>j?.[k.fieldKey]?.value,e[21]=j,e[22]=N):N=e[22];const _=m.map(N).filter(Hn),S=[...h.map(Gn),...g.map(Vn),..._.map(Kn)].sort().join(","),T=ge({queryKey:Y.commerceDiscoveryCompanionConnections(o.id,S),queryFn:async()=>{if(m.length===0)return{items:[]};const k=[{field:["app_name"],operator:"in",value:h},{field:["app_id"],operator:"in",value:g}];_.length>0&&k.push({field:["id"],operator:"in",value:_});const B=await n.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:k},limit:1e3}});return ne(B)}}).data?.items??[],A=new Set(_),E=T.filter(k=>A.has(k.id)),L=E.filter(qn);let z;e[23]!==o.id||e[24]!==o.slug?(z=k=>({queryKey:Y.commerceDiscoveryCompanionOAuthStatus(o.id,k.id),queryFn:async()=>{try{const B=await fetch(`/api/${encodeURIComponent(o.slug)}/connections/${encodeURIComponent(k.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=(k,B)=>[k.id,P[B]?.data?.hasToken===!0],e[26]=P,e[27]=F):F=e[27];const M=new Map(L.map(F)),w={};for(const k of E)w[k.id]=!k.oauth_config||!!k.connection_token||M.get(k.id)===!0;const O=ge({queryKey:Y.commerceDiscoveryCompanionRegistry(o.id,C),queryFn:async()=>{if(m.length===0)return{items:[]};const k=en(g,v),B=await zt(De.REGISTRY(o.id),o.id,o.slug,"COLLECTION_REGISTRY_APP_LIST",{...k?{where:k}:{},limit:1e3});return ne(B)}}),D={},R={};for(const k of O.data?.items??[])D[k.id]=k,k.server?.name&&(R[k.server.name]=k);let $;e[28]!==o.id||e[29]!==r?($=Y.commerceDiscoveryConnectionStatus(o.id,r??""),e[28]=o.id,e[29]=r,e[30]=$):$=e[30];const G=!!r;let U;e[31]!==n||e[32]!==r?(U=async()=>{const k=await n.callTool({name:"COMMERCE_DISCOVERY_CONNECTION_STATUS",arguments:{siteUrl:r}});return ne(k)},e[31]=n,e[32]=r,e[33]=U):U=e[33];let K;e[34]!==$||e[35]!==G||e[36]!==U?(K={queryKey:$,enabled:G,queryFn:U},e[34]=$,e[35]=G,e[36]=U,e[37]=K):K=e[37];const Q=be(K),W={};for(const[k,B]of Object.entries(Ct)){const ie=Q.data?.providers?.[B];ie?.connected&&ie.via==="sa"&&(W[k]={resource:ie.resource??null})}const J=dn({requirements:m,itemsById:D,itemsByName:R,connections:T,connectionReadiness:w,configurationState:j,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:r}){const a=Ce(),[c,d]=V.useState(null),[u,l]=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),l(null);const g={app_name:h.title,field_key:h.fieldKey,organization_id:e.id,domain:i,site_url:r};ee("commerce_onboarding_companion_connect_clicked",g);try{let v=h.candidateConnectionId;if(!v){const j=Dt(h.registryItem,e.id,n,{remoteIndex:0}),N=j.connection_type==="STDIO",_=!!j.connection_url,S=N&&j.connection_headers&&typeof j.connection_headers=="object"&&"command"in j.connection_headers;if(!_&&!S)return ee("commerce_onboarding_companion_connect_failed",{...g,error:"no_connection_method"}),l(`${h.title} cannot be connected: no connection method available`),!1;const I=await s.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:j}});v=ne(I).item.id}const C=v,x=await Bt({connectionId:C,orgId:e.id,orgSlug:e.slug,persistFallback:j=>p(C,{connection_token:j}).then(()=>{})});if(!x.ok)return ee("commerce_onboarding_companion_connect_failed",{...g,error:x.error}),l(`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,C);return await p(o,{configuration_state:y}),await a.invalidateQueries({queryKey:Y.commerceDiscoveryConnection(e.id,o)}),await a.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)}),l(v instanceof Error?v.message:String(v)),!1}finally{d(null)}}return{connect:m,connectingFieldKey:c,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,r;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."}),r=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]=r):(i=e[1],r=e[2]);let a;return e[3]!==n?(a=t.jsxs("div",{className:Ge,children:[o,t.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[i,r,t.jsx(H,{type:"button",variant:"outline",size:"sm",className:"mt-3",onClick:n,children:"Tentar novamente"})]})]}),e[3]=n,e[4]=a):a=e[4],a}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:r=>{const{resetError:a}=r;return t.jsx(ts,{onRetry:()=>{i(),a()}})},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,onReadinessChange:r}=s,{data:a}=Re.useSession(),c=a?.user?.id??"";let d;if(e[0]!==i){const I=i?ae(i):null;if(I?.ok)try{d=new URL(I.value).hostname}catch{d=void 0}e[0]=i,e[1]=d}else d=e[1];let u;e[2]!==n.id||e[3]!==n.slug?(u={connectionId:lt,orgId:n.id,orgSlug:n.slug},e[2]=n.id,e[3]=n.slug,e[4]=u):u=e[4];const l=ke(u);let p;e[5]!==o||e[6]!==n||e[7]!==l||e[8]!==i?(p={selfClient:l,org:n,cdConnectionId:o,siteUrl:i},e[5]=o,e[6]=n,e[7]=l,e[8]=i,e[9]=p):p=e[9];const{cards:m}=Mn(p);let h;e[10]!==o||e[11]!==n||e[12]!==l||e[13]!==d||e[14]!==i||e[15]!==c?(h={selfClient:l,org:n,userId:c,cdConnectionId:o,domain:d,siteUrl:i},e[10]=o,e[11]=n,e[12]=l,e[13]=d,e[14]=i,e[15]=c,e[16]=h):h=e[16];const{connect:g,connectingFieldKey:v,error:C}=Zn(h),[x,f]=V.useState(null);if(r?.(m.length===0||m.some(os)),m.length===0)return null;const b=v!==null;let y;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(He,{}),e[17]=y):y=e[17];let j;e[18]!==C?(j=C&&t.jsx("p",{role:"alert",className:"mb-3 text-sm text-destructive",children:C}),e[18]=C,e[19]=j):j=e[19];let N;if(e[20]!==x||e[21]!==b||e[22]!==m||e[23]!==g||e[24]!==v||e[25]!==n||e[26]!==l||e[27]!==i){let I;e[29]!==x||e[30]!==b||e[31]!==g||e[32]!==v||e[33]!==n||e[34]!==l||e[35]!==i?(I=T=>{const A=async()=>{await g(T)&&f(T.fieldKey)};return t.jsx($n,{card:T,connecting:v===T.fieldKey,disabled:b&&v!==T.fieldKey,org:n,selfClient:l,siteUrl:i,autoOpenConfigFieldKey:x,onAutoOpenConfigHandled:()=>f(E=>E===T.fieldKey?null:E),onConnect:()=>{A()}},T.fieldKey)},e[29]=x,e[30]=b,e[31]=g,e[32]=v,e[33]=n,e[34]=l,e[35]=i,e[36]=I):I=e[36],N=m.map(I),e[20]=x,e[21]=b,e[22]=m,e[23]=g,e[24]=v,e[25]=n,e[26]=l,e[27]=i,e[28]=N}else N=e[28];let _;e[37]!==N?(_=t.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:N}),e[37]=N,e[38]=_):_=e[38];let S;return e[39]!==j||e[40]!==_?(S=t.jsxs("div",{className:Ge,children:[y,t.jsxs($e,{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:[j,_]})]}),e[39]=j,e[40]=_,e[41]=S):S=e[41],S}function os(s){return s.satisfied}const Qe="https://decocms.com/agendar",is="Precisa de ajuda? Fale conosco",rs="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"}],as="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 ls(s){const e=q.c(12),{href:n,size:o,className:i,orgId:r}=s,a=n===void 0?Qe:n,c=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]!==r?(u=()=>ee("commerce_onboarding_meeting_cta_clicked",{placement:"visual_card",organization_id:r}),e[2]=r,e[3]=u):u=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(jt,{size:16}),e[4]=l):l=e[4];let p;e[5]!==a||e[6]!==u?(p=t.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",onClick:u,children:["Agendar uma reunião",l]}),e[5]=a,e[6]=u,e[7]=p):p=e[7];let m;return e[8]!==c||e[9]!==d||e[10]!==p?(m=t.jsx(H,{asChild:!0,variant:"outline",size:c,className:d,children:p}),e[8]=c,e[9]=d,e[10]=p,e[11]=m):m=e[11],m}function cs(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 r=i;let a;e[2]!==o?(a={height:o},e[2]=o,e[3]=a):a=e[3];let c;e[4]!==r||e[5]!==o?(c=ve.map((u,l)=>t.jsxs("div",{className:"relative shrink-0",style:{width:o,height:o,marginLeft:l===0?0:-r,zIndex:ve.length-l},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"})}),l===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]=r,e[5]=o,e[6]=c):c=e[6];let d;return e[7]!==a||e[8]!==c?(d=t.jsx("div",{className:"flex items-end",style:a,children:c}),e[7]=a,e[8]=c,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:as}}),e[0]=i):i=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"-mt-9 mb-4",children:t.jsx(cs,{})}),e[1]=r):r=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx("h2",{className:"text-lg font-medium leading-6 text-foreground",children:is}),t.jsx("p",{className:"text-sm leading-5 text-muted-foreground",children:rs})]}),e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==o?(c=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:[r,a,t.jsx(ls,{href:n,size:"lg",className:"mt-6",orgId:o})]})]})}),e[3]=n,e[4]=o,e[5]=c):c=e[5],c}function ds(s){const e=q.c(13),{className:n,href:o,orgId:i}=s,r=o===void 0?Qe:o;let a;e[0]!==i?(a=()=>ee("commerce_onboarding_meeting_cta_clicked",{placement:"mobile_banner",organization_id:i}),e[0]=i,e[1]=a):a=e[1];let c;e[2]!==n?(c=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]=c):c=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(us),e[4]=d,e[5]=u):(d=e[4],u=e[5]);let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=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]=l):l=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]!==r||e[10]!==a||e[11]!==c?(h=t.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",onClick:a,className:c,children:[l,p,m]}),e[9]=r,e[10]=a,e[11]=c,e[12]=h):h=e[12],h}function us(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,r,a;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"}),r=t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-7 w-7 hidden dark:block"}),a=t.jsx("div",{className:"h-6 w-px rotate-12 bg-border","aria-hidden":"true"}),e[0]=i,e[1]=r,e[2]=a):(i=e[0],r=e[1],a=e[2]);let c;e[3]!==o?(c=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]=c):c=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]!==c||e[8]!==d?(u=t.jsxs("div",{className:"flex items-center gap-3",children:[i,r,a,c,d]}),e[7]=c,e[8]=d,e[9]=u):u=e[9],u}const ms={workspace:"Preparando seu workspace de commerce...",generic:"Preparando..."};function fs(s){return ms[s]}function Je(s){const e=q.c(4),{variant:n}=s;let o;e[0]!==n?(o=fs(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 qo(){const s=q.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(gs,{}),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 r=it(i),{data:a}=Re.useSession(),c=a?.user?.email;let d;e[4]!==r.siteUrl||e[5]!==c?(d=We({siteUrl:r.siteUrl,email:c}),e[4]=r.siteUrl,e[5]=c,e[6]=d):d=e[6];const u=d;let l;e[7]!==u||e[8]!==o?(l=o??t.jsx(Ye,{href:u}),e[7]=u,e[8]=o,e[9]=l):l=e[9];let p;return e[10]!==n||e[11]!==l?(p=t.jsx(kt,{...n,visual:l}),e[10]=n,e[11]=l,e[12]=p):p=e[12],p}const ps={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 gs(){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(hs,{requestedOrgSlug:e,siteUrl:n})})}function hs(s){const e=q.c(8),{requestedOrgSlug:n,siteUrl:o}=s,{data:i,isPending:r}=Re.useSession(),a=Et();if(r){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]!==a?(u=a?t.jsx(St,{host:a}):void 0,e[1]=a,e[2]=u):u=e[2];let l;return e[3]!==u?(l=t.jsx(se,{children:t.jsx(Rt,{callbackUrl:d,allowAutoLogin:!1,title:"Desbloqueie seu diagnóstico completo",subtitle:null,brand:u,copy:ps})}),e[3]=u,e[4]=l):l=e[4],l}let c;return e[5]!==n||e[6]!==o?(c=t.jsx(xs,{requestedOrgSlug:n,siteUrl:o}),e[5]=n,e[6]=o,e[7]=c):c=e[7],c}function xs(s){const e=q.c(43),{requestedOrgSlug:n,siteUrl:o}=s,i=rt(),r=Ot(),[a,c]=V.useState(null),[d,u]=V.useState(null),l=r.data?.map(bs)??[];let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={mutationFn:ys,retry:!1,onSuccess:f=>{u(f)}},e[0]=p):p=e[0];const m=fe(p);if(r.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(r.error){let f;return e[2]!==r?(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:()=>r.refetch()}),e[2]=r,e[3]=f):f=e[3],f}const h=n?l.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]!==r?(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:()=>r.refetch()}),e[7]=r,e[8]=f):f=e[8],f}if(a){let f;return e[9]!==a||e[10]!==o?(f=t.jsx(Ie,{org:a,initialSiteUrl:o}),e[9]=a,e[10]=o,e[11]=f):f=e[11],f}if(l.length===1&&l[0]){let f;return e[12]!==l[0]||e[13]!==o?(f=t.jsx(Ie,{org:l[0],initialSiteUrl:o}),e[12]=l[0],e[13]=o,e[14]=f):f=e[14],f}if(l.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]!==i||e[17]!==o?(b=j=>i({to:"/commerce-onboarding",search:{org:j.slug,siteUrl:o}}),e[16]=i,e[17]=o,e[18]=b):b=e[18];let y;return e[19]!==l||e[20]!==b?(y=t.jsx(se,{children:t.jsxs("div",{className:"grid gap-10",children:[f,t.jsx($e,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:t.jsx(Ze,{organizations:l,selectLabel:"Continuar",onSelected:b})})]})}),e[19]=l,e[20]=b,e[21]=y):y=e[21],y}if(!d){let f;e[22]!==m?(f=()=>{m.reset(),m.mutate()},e[22]=m,e[23]=f):f=e[23];let b;return e[24]!==m||e[25]!==f?(b=t.jsx(vs,{mutation:m,onRetry:f}),e[24]=m,e[25]=f,e[26]=b):b=e[26],b}const g=d;if(g?.success&&(g.status==="created"||g.status==="joined"||g.status==="already_has_organization")&&g.organization){let f;return e[27]!==g.organization||e[28]!==o?(f=t.jsx(Ie,{org:g.organization,initialSiteUrl:o}),e[27]=g.organization,e[28]=o,e[29]=f):f=e[29],f}if(g?.status==="ambiguous"&&g.organizations&&g.organizations.length>0){let f;e[30]===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[30]=f):f=e[30];const b=g.domain??void 0;let y;e[31]!==i||e[32]!==o?(y=(N,_)=>{at(),c({...N,slug:_}),i({to:"/commerce-onboarding",search:{org:_,siteUrl:o}})},e[31]=i,e[32]=o,e[33]=y):y=e[33];let j;return e[34]!==g.organizations||e[35]!==b||e[36]!==y?(j=t.jsx(se,{children:t.jsxs("div",{className:"grid gap-10",children:[f,t.jsx($e,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:t.jsx(Ze,{organizations:g.organizations,domain:b,onJoined:y})})]})}),e[34]=g.organizations,e[35]=b,e[36]=y,e[37]=j):j=e[37],j}const v=g?.error??"Não conseguimos determinar uma organização de commerce para esta conta.";let C;e[38]!==m?(C=()=>{u(null),m.reset()},e[38]=m,e[39]=C):C=e[39];let x;return e[40]!==v||e[41]!==C?(x=t.jsx(Oe,{title:"O onboarding de commerce precisa de suporte",description:v,actionLabel:"Tentar novamente",onRetry:C}),e[40]=v,e[41]=C,e[42]=x):x=e[42],x}async function ys(){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 bs(s){return{id:s.id,name:s.name,slug:s.slug,logo:s.logo??null}}function vs(s){const e=q.c(7),{mutation:n,onRetry:o}=s,i=V.useRef(!1);let r;e[0]!==n?(r=u=>{!u||i.current||(i.current=!0,n.mutate())},e[0]=n,e[1]=r):r=e[1];const a=r;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 c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Je,{variant:"generic"}),e[4]=c):c=e[4];let d;return e[5]!==a?(d=t.jsx(se,{children:t.jsx("div",{ref:a,children:c})}),e[5]=a,e[6]=d):d=e[6],d}function re(s){const e=q.c(8),{title:n,description:o}=s,i=Et();let r;e[0]!==i?(r=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]=r):r=e[1];let a;e[2]!==o||e[3]!==n?(a=(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]=a):a=e[4];let c;return e[5]!==r||e[6]!==a?(c=t.jsxs("div",{className:"grid gap-10",children:[r,a]}),e[5]=r,e[6]=a,e[7]=c):c=e[7],c}function Oe(s){const e=q.c(9),{title:n,description:o,actionLabel:i,onRetry:r}=s;let a;e[0]!==o||e[1]!==n?(a=t.jsx(re,{title:n,description:o}),e[0]=o,e[1]=n,e[2]=a):a=e[2];let c;e[3]!==i||e[4]!==r?(c=t.jsx(H,{type:"button",size:"xl",className:"w-full",onClick:r,children:i}),e[3]=i,e[4]=r,e[5]=c):c=e[5];let d;return e[6]!==a||e[7]!==c?(d=t.jsx(se,{children:t.jsxs("div",{className:"grid gap-10",children:[a,c]})}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function js(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(js(e));return e.structuredContent??s}function Ie(s){const e=q.c(11),{org:n,initialSiteUrl:o}=s,{data:i}=Re.useSession(),r=i?.user?.email;let a;e[0]!==o||e[1]!==r?(a=We({siteUrl:o,email:r}),e[0]=o,e[1]=r,e[2]=a):a=e[2];const c=a;let d;e[3]!==c||e[4]!==n.id?(d=t.jsx(Ye,{href:c,orgId:n.id}),e[3]=c,e[4]=n.id,e[5]=d):d=e[5];const u=d;let l;return e[6]!==o||e[7]!==u||e[8]!==n||e[9]!==i?.user?.email?(l=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(Cs,{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(_s,{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]=l):l=e[10],l}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 Cs(s){const e=q.c(10),{orgName:n,message:o,onRetry:i}=s,r=`A configuração de commerce continuará em ${n}.`;let a;e[0]!==r?(a=t.jsx(re,{title:"Diagnóstico de commerce",description:r}),e[0]=r,e[1]=a):a=e[1];let c;e[2]!==o?(c=t.jsx(je,{message:o}),e[2]=o,e[3]=c):c=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]!==a||e[7]!==c||e[8]!==d?(u=t.jsxs("div",{className:"grid gap-10",children:[a,c,d]}),e[6]=a,e[7]=c,e[8]=d,e[9]=u):u=e[9],u}function _s({org:s,initialSiteUrl:e,sessionEmail:n}){const o=rt(),i=ke({connectionId:lt,orgId:s.id,orgSlug:s.slug}),[r,a]=V.useState(e??""),[c,d]=V.useState(null),[u,l]=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 w=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:m}});return we(w)},retry:!1}),v=ge({queryKey:Y.commerceDiscoveryVirtualMcp(s.id,h),queryFn:async()=>{const w=await i.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:h}});return we(w)},retry:!1}),C=fe({mutationFn:async w=>{const O=await i.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:w}});return we(O)},retry:!1,onSuccess:(w,O)=>{ee("commerce_onboarding_setup_succeeded",{domain:pe(O)??void 0,organization_id:s.id}),d(w),l(null),g.refetch(),v.refetch()},onError:(w,O)=>{ee("commerce_onboarding_setup_failed",{domain:pe(O)??void 0,organization_id:s.id,error:w instanceof Error?w.message:String(w)}),l(w instanceof Error?w.message:"A configuração do Commerce Discovery falhou.")}}),x=fe({mutationFn:async w=>{const O=await i.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:w}});return we(O)},retry:!1}),[f,b]=V.useState(null),y=!!g.data.item&&!!v.data.item,j=g.data.item,N=typeof j?.metadata?.siteUrl=="string"?j.metadata.siteUrl:void 0,S=Zt(e||r||"",N),I=y&&S,T=e||r||N||"",A=We({siteUrl:T,email:n}),E=t.jsx(Ye,{href:A,orgId:s.id}),L=w=>{const O=ae(w);if(!O.ok){l(tt(O.error));return}l(null),C.mutate(O.value)},z=w=>{!w||p.current||I||!e||(p.current=!0,L(e))},P=w=>{w.preventDefault();const O=ae(r);O.ok&&ee("commerce_onboarding_site_url_submitted",{domain:new URL(O.value).hostname,organization_id:s.id}),L(r)},F=c?.reportApp??{connectionId:m,virtualMcpId:h,toolName:$t},M=async()=>{b(null),ee("commerce_onboarding_open_report_clicked",{domain:pe(T)??void 0,organization_id:s.id});const w=ae(T);if(w.ok)try{const O=await x.mutateAsync(w.value);if(!O.triggered){ee("commerce_onboarding_run_failed",{domain:pe(T)??void 0,organization_id:s.id,error:O.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(O){ee("commerce_onboarding_run_failed",{domain:pe(T)??void 0,organization_id:s.id,error:O instanceof Error?O.message:String(O)}),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(Ss,{org:s,reportApp:F,onOpenReport:M,isSubmitting:x.isPending,error:f,meetingUrl:A,meetingVisual:E,siteUrl:T});if(C.isPending)return t.jsx(wt,{visual:E});if(e){const w=ae(e);return w.ok?t.jsx(se,{visual:E,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 ${w.value}.`}),u?t.jsxs(t.Fragment,{children:[t.jsx(je,{message:u}),t.jsx(Pe,{siteUrl:r,error:null,isSubmitting:C.isPending,onSiteUrlChange:a,onSubmit:P})]}):t.jsx(Be,{})]})}):t.jsx(se,{visual:E,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(w.error)}),t.jsx(Pe,{siteUrl:r,error:u,isSubmitting:C.isPending,onSiteUrlChange:a,onSubmit:P})]})})}return t.jsx(se,{visual:E,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:r,error:u,isSubmitting:C.isPending,onSiteUrlChange:a,onSubmit:P})]})})}function Pe(s){const e=q.c(20),{siteUrl:n,error:o,isSubmitting:i,onSiteUrlChange:r,onSubmit:a}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:"URL do site"}),e[0]=c):c=e[0];let d;e[1]!==r?(d=C=>r(C.target.value),e[1]=r,e[2]=d):d=e[2];const u=!!o;let l;e[3]!==i||e[4]!==n||e[5]!==d||e[6]!==u?(l=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]=l):l=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]!==l||e[11]!==p?(m=t.jsxs("div",{className:"grid gap-2",children:[c,l,p]}),e[10]=l,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]!==a||e[17]!==m||e[18]!==g?(v=t.jsxs("form",{className:"grid gap-4",onSubmit:a,children:[m,g]}),e[16]=a,e[17]=m,e[18]=g,e[19]=v):v=e[19],v}function Ss(s){const e=q.c(27),{org:n,reportApp:o,onOpenReport:i,isSubmitting:r,error:a,meetingUrl:c,meetingVisual:d,siteUrl:u}=s,[l,p]=V.useState(!0);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(re,{}),e[0]=m):m=e[0];let h;e[1]!==n||e[2]!==o.connectionId||e[3]!==u?(h=t.jsx(ns,{org:n,cdConnectionId:o.connectionId,siteUrl:u,onReadinessChange:p}),e[1]=n,e[2]=o.connectionId,e[3]=u,e[4]=h):h=e[4];let g;e[5]!==c||e[6]!==n.id?(g=t.jsx(ds,{className:"md:hidden",href:c,orgId:n.id}),e[5]=c,e[6]=n.id,e[7]=g):g=e[7];let v;e[8]!==a?(v=a?t.jsx(je,{message:a}):null,e[8]=a,e[9]=v):v=e[9];const C=r||!o.virtualMcpId||!l,x=r?"Abrindo relatório...":"Ver relatório completo";let f;e[10]!==r?(f=r?null:t.jsx(ct,{size:18}),e[10]=r,e[11]=f):f=e[11];let b;e[12]!==i||e[13]!==C||e[14]!==x||e[15]!==f?(b=t.jsxs(H,{type:"button",size:"xl",className:"w-full rounded-2xl text-base font-medium",onClick:i,disabled:C,children:[x,f]}),e[12]=i,e[13]=C,e[14]=x,e[15]=f,e[16]=b):b=e[16];let y;e[17]!==g||e[18]!==v||e[19]!==b?(y=t.jsxs("div",{className:"flex shrink-0 flex-col gap-3 md:mt-8",children:[g,v,b]}),e[17]=g,e[18]=v,e[19]=b,e[20]=y):y=e[20];let j;e[21]!==h||e[22]!==y?(j=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[m,h,y]}),e[21]=h,e[22]=y,e[23]=j):j=e[23];let N;return e[24]!==d||e[25]!==j?(N=t.jsx(se,{align:"fill",visual:d,children:j}),e[24]=d,e[25]=j,e[26]=N):N=e[26],N}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{qo as default};
|
|
@@ -1 +0,0 @@
|
|
|
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 G,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 Fe,t as q,b2 as Re}from"./index-d52A49fX.js";import{a as Le}from"./extract-connection-data-Dq7vx8cX.js";import{E as ve}from"./empty-state-BUKBmmAV.js";import{E as Be,c as He,r as We,b as Xe,d as qe}from"./connection-form-helpers-Bs8LNNlp.js";import{c as Ge,S as Ke,V as Qe}from"./index-CKKQLGcV.js";import{u as be,T as Je}from"./tools-list-Dzc5vr-A.js";import{u as Ye}from"./use-members-Cc48Xacn.js";import{A as Ze}from"./avatar-BrhzNA4d.js";import{a as Ne,b as ye,u as et}from"./use-connection-BLVjIktc.js";import{u as _e}from"./use-mcp-client-QTh-uqf4.js";import{a as tt}from"./use-mcp-tools-BTYjbm6L.js";import{a as st}from"./use-mcp-prompts-5W77PpYc.js";import{i as nt,a as ot}from"./mcp-oauth-CSUfdVCn.js";import{I as oe}from"./integration-icon-DXGEOTjP.js";import{s as it}from"./Plus-DkGwhdIW.js";import{D as at,F as rt,an as lt,ac as ct}from"./agent-icon-BvZm1osM.js";import{a as Ce,s as dt}from"./Settings02-COfrOHpp.js";import{s as ae}from"./Trash01-myAGgKHr.js";import{d as mt,c as ut,b as xt,S as pt,a as ft}from"./sheet-DSSfro03.js";import{F as L,b as B,c as H,d as E,e as W,f as ht,a as gt}from"./form-TSiFK-dI.js";import{I as X}from"./input-B_5YyJ8y.js";import{u as jt,D as vt}from"./use-delete-connection-CkaRxWAn.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-DixOHH_R.js";import{u as kt}from"./studio-tools-nA7ZTnFV.js";import{u as Tt}from"./use-virtual-mcp-n0IfHFn6.js";import{i as Se}from"./ChevronRight-DntNgeBz.js";import{a as we}from"./Users03-JTfAuK6m.js";import{T as ee,a as It,b as te,c as At}from"./tabs-DRqPX6Mz.js";import{g as ke}from"./connection-slug-eyAPH6o3.js";import{n as $t}from"./ZapSquare-Ch518nCD.js";import{d as Dt}from"./Tool01-DJgxsN47.js";import{g as re,M as Pt}from"./types-B2Xs3OM7.js";import{C as Ot}from"./collection-search-BHb176G9.js";import{C as Mt}from"./card-CCFrbS6S.js";import{B as zt}from"./badge-B5li3mFX.js";import{a as Et,b as Vt,D as Ut,c as de}from"./dropdown-menu-BPps0Iqr.js";import{d as me,S as ue,a as xe,b as pe,c as R}from"./select-DdHVdWXn.js";import{i as Ft}from"./CheckCircle-CebfgxLq.js";import{t as Rt}from"./ChevronDown-DhzhS3K5.js";import{n as Lt}from"./XCircle-Cz7czjsw.js";import{s as se}from"./Star01-twQgP5oO.js";import{s as Bt}from"./XClose-eEYHZsPT.js";import"./constants-nH3qQ_1f.js";import"./index-BZQALusN.js";import"./sidebar-BJwboMe2.js";import"./LayoutLeft-CKcHwaHf.js";import"./use-mobile-Cqur1PpI.js";import"./tooltip-Bzas0fb8.js";import"./ZoomOut-Chl8lvun.js";import"./Key01-CwgjH_um.js";import"./auth-B8jeHTDK.js";import"./use-registry-connections-HQM1hA3o.js";import"./use-organization-settings-CnPdR5CP.js";import"./index-BibhmEoM.js";import"./index-CIZOVv5V.js";import"./index-BlJ4j0DM.js";import"./popover-DlszYF1R.js";import"./Check-BqH5cjqe.js";import"./SearchMd-Dhz0UROc.js";import"./use-create-virtual-mcp-DAOEgAsA.js";import"./use-navigate-to-agent-CaUSC1CF.js";import"./Eye-o8ajkfvt.js";import"./use-org-auth-client-C5lRdd5o.js";import"./User01-DuGAbO5F.js";import"./use-collections-BP4R8sI-.js";import"./AlertCircle-D90xu5-8.js";import"./SwitchHorizontal01-Bu9ipsE_.js";import"./ArrowUpRight-B1XPsNPZ.js";import"./Loading02-DaLVACu2.js";import"./ChevronUp-DPJfOoQR.js";import"./Circle-umqkxNwx.js";import"./Stars02-sR281nUk.js";import"./Copy01-YBIj7O7M.js";import"./DotsVertical-DoxN78H8.js";import"./Globe01-D3NrpjPq.js";import"./FilterLines-CEBhmChB.js";import"./Globe04-6xG6GU2e.js";import"./HardDrive-CDBenwE2.js";import"./LinkExternal01-DBFEHO3t.js";import"./List-s8AZWxpk.js";import"./Monitor01-lxPxQ2fk.js";import"./Sun-DTFx5jn8.js";import"./Palette-DHyTdFqR.js";import"./Play-TOCBGzP9.js";import"./SearchLg-C9MBYrXH.js";import"./Shield01-BrK-9cDf.js";import"./Stars01-C27kMlCK.js";import"./Upload01-m0ny4YmQ.js";import"./Users01-e9Wb8IJU.js";import"./X-DRR7RtBP.js";import"./Zap-CMZ9cCJz.js";import"./label-CWqrShVu.js";import"./alert-dialog-wgrcUQ0O.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")}),Wt=[{name:"MCP_CONFIGURATION",inputSchema:he({}),outputSchema:Ht}];function Xt(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 qt(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 Gt(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(G.Suspense,{fallback:t.jsx(qt,{instance:N,onConfigure:i}),children:t.jsx(Xt,{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]=G.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(G.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]=G.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(R,{value:"HTTP",children:"HTTP"}),t.jsx(R,{value:"SSE",children:"SSE"}),t.jsx(R,{value:"Websocket",children:"Websocket"}),u&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:"NPX Package"}),t.jsx(R,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(L,{control:s.control,name:"connection_url",render:({field:h})=>t.jsx(B,{className:"flex-1 min-w-0",children:t.jsx(E,{children:t.jsx(X,{placeholder:"https://example.com/mcp",...h,value:h.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(me,{value: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(R,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(R,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(R,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"Websocket"]})}),u&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Lt,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(R,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ct,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(W,{})]})}),o==="NPX"&&t.jsx(L,{control:s.control,name:"npx_package",render:({field: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(X,{placeholder:"@perplexity-ai/mcp-server",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),o==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(L,{control:s.control,name:"stdio_command",render:({field: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(X,{placeholder:"node, bun, python...",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),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(X,{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(W,{})]})})]}),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(X,{placeholder:"/path/to/project (optional)",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})})]}),(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(W,{})]})}),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(Ft,{size:12}),"Authenticated via OAuth",t.jsx(Rt,{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(X,{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(W,{})]})})]})}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"&&Re(s.connection_headers)){const i=s.connection_headers,a=We(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=Xe(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",a=qe(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]=G.useState(null),[v,b]=G.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=Ge(k,Wt),f=Ue({resolver:Fe(He),values:fe(h??s)}),w=f.formState.isDirty,M=async()=>{if(!await f.trigger())return;const $=f.getValues(),D=vs($),F=h?.id??e;await x.update.mutateAsync({id:F,data:D}),f.reset($)},O=()=>{f.reset(fe(h??s))},A=async m=>{const{token:$,tokenInfo:D,error:F}=await ot({connectionId:m,orgSlug:p.slug,scope:"offline_access"});if(F||!$){q.error(`Authentication failed: ${F}`);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()}),q.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();q.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)}),q.success("OAuth removed. You can now re-authenticate with a different account.")}catch(m){console.error("Error removing OAuth token:",m),q.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(X,{...m})}),t.jsx(W,{})]})}),t.jsx(L,{control:f.control,name:"description",render:({field:m})=>t.jsxs(B,{children:[t.jsx(H,{children:"Description"}),t.jsx(E,{children:t.jsx(X,{...m,value:m.value||""})}),t.jsx(W,{})]})})]}),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(Gt,{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:$}}),q.success($==="active"?"Connection enabled":"Connection disabled")}catch{q.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,F=`${$} (${D})`,Q=Le("conn");await x.create.mutateAsync({id:Q,title:F,description:m.description??null,connection_type:m.connection_type,connection_url:m.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:m.created_by,organization_id:m.organization_id,icon:m.icon??null,app_name:m.app_name??null,app_id:m.app_id??null,connection_headers:m.connection_headers??null,oauth_config:null,configuration_state:m.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const K=new URL(`/api/${p.slug}/mcp/${Q}`,window.location.origin),Z=await nt({url:K.href,token:null,orgId:p.id});Z.supportsOAuth&&!Z.isAuthenticated&&await A(Q)}finally{b(!1)}}}),t.jsx(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 F of D)z.has(F.name)||(z.add(F.name),U.push(F))}j=U.length>0?U:A}s[10]=x?.tools,s[11]=p,s[12]=u,s[13]=b,s[14]=j}else j=s[14];const N=j;let T;s[15]!==g?(T={client:g},s[15]=g,s[16]=T):T=s[16];const{data:S}=st(T);let y;s[17]!==g?(y={client:g},s[17]=g,s[18]=y):y=s[18];const{data:I}=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(G.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 +0,0 @@
|
|
|
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-d52A49fX.js";import{a as lt,b as De,g as at,e as ct}from"./extract-connection-data-Dq7vx8cX.js";import{C as dt}from"./collection-display-button-Bvtt9j_H.js";import{S as mt}from"./search-input-DccF25qw.js";import{C as ut}from"./collection-tabs-CCdUJRcj.js";import{u as pt,a as ke,g as ht,C as Ce}from"./connection-card-DGNqtPoP.js";import{E as gt}from"./empty-state-BUKBmmAV.js";import{I as xt}from"./integration-icon-DXGEOTjP.js";import{P as ue}from"./index-BZQALusN.js";import{u as ft,D as jt}from"./use-delete-connection-CkaRxWAn.js";import{u as ye}from"./use-capability-C9whYnsG.js";import{u as yt}from"./use-infinite-scroll-1VhU5Q3H.js";import{u as Ct}from"./use-view-mode-BMlb6QOX.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-wgrcUQ0O.js";import{C as Fe}from"./checkbox-D2NBps_s.js";import{e as Me,d as ze,c as Ve,a as Ee,b as Be,D as Ke}from"./dialog-C2MVTIBt.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-BGO4iAk0.js";import{u as At}from"./use-mobile-Cqur1PpI.js";import{a as Ue,b as Re,D as He,c as re}from"./dropdown-menu-BPps0Iqr.js";import{F as Q,b as J,c as Y,d as Z,e as ee,a as ve}from"./form-TSiFK-dI.js";import{I as ie}from"./input-B_5YyJ8y.js";import{d as wt,S as Tt,a as It,b as Pt,c as ae}from"./select-DdHVdWXn.js";import{T as $t}from"./textarea-B3Rf9sP3.js";import{b as We,u as Lt}from"./use-connection-BLVjIktc.js";import{u as Ot}from"./use-virtual-mcp-n0IfHFn6.js";import{u as Ft}from"./studio-tools-nA7ZTnFV.js";import{ac as Mt,am as zt,F as Vt,D as Et}from"./agent-icon-BvZm1osM.js";import{n as ge}from"./XCircle-Cz7czjsw.js";import{i as Xe}from"./DotsVertical-DoxN78H8.js";import{s as qe}from"./Eye-o8ajkfvt.js";import{s as je}from"./Star01-twQgP5oO.js";import{s as Ge}from"./Plus-DkGwhdIW.js";import{s as Qe}from"./Trash01-myAGgKHr.js";import{s as Je}from"./XClose-eEYHZsPT.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-Bs8LNNlp.js";import{a as Wt}from"./authenticate-and-persist-oauth-ezeRyKPp.js";import"./use-mcp-client-QTh-uqf4.js";import"./constants-nH3qQ_1f.js";import"./auth-B8jeHTDK.js";import"./SwitchHorizontal01-Bu9ipsE_.js";import"./Check-BqH5cjqe.js";import"./List-s8AZWxpk.js";import"./tooltip-Bzas0fb8.js";import"./view-mode-toggle-D0e_xb-Q.js";import"./badge-B5li3mFX.js";import"./SearchMd-Dhz0UROc.js";import"./use-registry-connections-HQM1hA3o.js";import"./use-organization-settings-CnPdR5CP.js";import"./useInfiniteQuery-DEG0qlSd.js";import"./card-CCFrbS6S.js";import"./sidebar-BJwboMe2.js";import"./LayoutLeft-CKcHwaHf.js";import"./sheet-DSSfro03.js";import"./X-DRR7RtBP.js";import"./ChevronRight-DntNgeBz.js";import"./Circle-umqkxNwx.js";import"./label-CWqrShVu.js";import"./ChevronDown-DhzhS3K5.js";import"./ChevronUp-DPJfOoQR.js";import"./use-collections-BP4R8sI-.js";import"./AlertCircle-D90xu5-8.js";import"./Tool01-DJgxsN47.js";import"./Settings02-COfrOHpp.js";import"./ArrowUpRight-B1XPsNPZ.js";import"./ZapSquare-Ch518nCD.js";import"./Users03-JTfAuK6m.js";import"./Loading02-DaLVACu2.js";import"./CheckCircle-CebfgxLq.js";import"./Stars02-sR281nUk.js";import"./Copy01-YBIj7O7M.js";import"./ZoomOut-Chl8lvun.js";import"./Globe01-D3NrpjPq.js";import"./FilterLines-CEBhmChB.js";import"./Globe04-6xG6GU2e.js";import"./HardDrive-CDBenwE2.js";import"./Key01-CwgjH_um.js";import"./LinkExternal01-DBFEHO3t.js";import"./Monitor01-lxPxQ2fk.js";import"./Sun-DTFx5jn8.js";import"./Palette-DHyTdFqR.js";import"./Play-TOCBGzP9.js";import"./SearchLg-C9MBYrXH.js";import"./Shield01-BrK-9cDf.js";import"./Stars01-C27kMlCK.js";import"./Upload01-m0ny4YmQ.js";import"./User01-DuGAbO5F.js";import"./Users01-e9Wb8IJU.js";import"./Zap-CMZ9cCJz.js";import"./mcp-oauth-CSUfdVCn.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};
|
|
@@ -1 +0,0 @@
|
|
|
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,S as b,u as c,E as d,i as e,A as g,_ as i,l as p};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function r(p){return Math.ceil(p.length*3/4)}function n(p){const a=[];for(const t of p)switch(t.type){case"text":t.text?.trim()&&a.push({type:"paragraph",content:[{type:"text",text:t.text}]});break;case"image":case"audio":t.data&&t.mimeType&&a.push({type:"paragraph",content:[{type:"file",attrs:{id:crypto.randomUUID(),name:`${t.type}.${t.mimeType.split("/")[1]??"bin"}`,mimeType:t.mimeType,size:r(t.data),data:t.data}}]});break;case"resource":{const e=t.resource;"text"in e&&e.text?a.push({type:"paragraph",content:[{type:"text",text:e.text}]}):"blob"in e&&e.blob&&a.push({type:"paragraph",content:[{type:"file",attrs:{id:crypto.randomUUID(),name:String(e.uri),mimeType:e.mimeType??"application/octet-stream",size:r(e.blob),data:e.blob}}]});break}case"resource_link":a.push({type:"paragraph",content:[{type:"text",text:t.name??t.uri}]});break}return{type:"doc",content:a}}export{n as c};
|