decocms 4.61.2 → 4.62.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-BsA2wZmN.js → AlertCircle-pDwFaZ69.js} +1 -1
- package/dist/client/assets/{AreaChart-BHEk1VG5.js → AreaChart-CUV8xbg8.js} +1 -1
- package/dist/client/assets/{ArrowUp-CDnEKV2Y.js → ArrowUp-DtY9ye1M.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-DdPCnlNm.js → ArrowUpRight-BF8RC7lQ.js} +1 -1
- package/dist/client/assets/{Check-CcLLJc-z.js → Check-c3mV_Uni.js} +1 -1
- package/dist/client/assets/{CheckCircle-lXciCGfG.js → CheckCircle-CE_q_EWl.js} +1 -1
- package/dist/client/assets/{ChevronDown-BmFaSDo8.js → ChevronDown-Be1kUurm.js} +1 -1
- package/dist/client/assets/{ChevronRight-C3Tgk-3m.js → ChevronRight-86cbncTU.js} +1 -1
- package/dist/client/assets/{ChevronUp-Dew3RmKl.js → ChevronUp-7vDXTQHH.js} +1 -1
- package/dist/client/assets/{Circle-C_fdyhr8.js → Circle-Jj2lB_OB.js} +1 -1
- package/dist/client/assets/{Copy01-b3lIb5yu.js → Copy01-bnpfrlf8.js} +1 -1
- package/dist/client/assets/{DotsVertical-CK1a4mKj.js → DotsVertical-Cw_RGd0K.js} +1 -1
- package/dist/client/assets/{Eye-DM8bmzm7.js → Eye-DSKes5cc.js} +1 -1
- package/dist/client/assets/{FilterLines-DCNZa1GS.js → FilterLines-AFo6zz8G.js} +1 -1
- package/dist/client/assets/{Globe01-B6kdhpV9.js → Globe01-CINqduC_.js} +1 -1
- package/dist/client/assets/{Globe04-CGLGspo5.js → Globe04-Df4bCIam.js} +1 -1
- package/dist/client/assets/{HardDrive-CR6Rs-a1.js → HardDrive-C9RJVCTC.js} +1 -1
- package/dist/client/assets/{Key01-1r4YrQER.js → Key01-BufYrbpv.js} +1 -1
- package/dist/client/assets/{LayoutLeft-DvNM8qhm.js → LayoutLeft-Dg-hdc1o.js} +1 -1
- package/dist/client/assets/{LinkExternal01-Ck4lryDE.js → LinkExternal01-jNsZTUJe.js} +1 -1
- package/dist/client/assets/{List-DfPIAPM_.js → List-jTag997N.js} +1 -1
- package/dist/client/assets/{Loading02-Dx-xiZND.js → Loading02-DXivv_GE.js} +1 -1
- package/dist/client/assets/{Monitor01-D_DrBwt_.js → Monitor01-Cgb6dKKW.js} +1 -1
- package/dist/client/assets/{Package-CV2Q9Uup.js → Package-Bm7E2eK0.js} +1 -1
- package/dist/client/assets/{Palette-BY5BmUDa.js → Palette-D0cmCBJm.js} +1 -1
- package/dist/client/assets/{Play-Ci1OqtIO.js → Play-DL5iVtNY.js} +1 -1
- package/dist/client/assets/{Plus-Cgq7ON9K.js → Plus-SxhLmH-g.js} +1 -1
- package/dist/client/assets/{SearchLg-2as_l8YT.js → SearchLg-DalS_9no.js} +1 -1
- package/dist/client/assets/{SearchMd-ZfoTl6vw.js → SearchMd-DXMQuWHS.js} +1 -1
- package/dist/client/assets/{Settings02-CS2jOfO5.js → Settings02-Ci6H3sb0.js} +1 -1
- package/dist/client/assets/{Shield01-C6TdRfmI.js → Shield01-CFnvQppZ.js} +1 -1
- package/dist/client/assets/{Star01-2DHf7kTZ.js → Star01-ZuQ9gpI3.js} +1 -1
- package/dist/client/assets/{Stars01-BEHbN5c3.js → Stars01-MX3VUC0h.js} +1 -1
- package/dist/client/assets/{Stars02-HLp9q8iP.js → Stars02-ClT22kUl.js} +1 -1
- package/dist/client/assets/{Sun-ByaEjJ0N.js → Sun-C2eqMrg3.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-ilLzkPr_.js → SwitchHorizontal01-CTbgmfyn.js} +1 -1
- package/dist/client/assets/{Tool01-DVCGutKV.js → Tool01-CcmA_w81.js} +1 -1
- package/dist/client/assets/{Tool02-CSTMjTef.js → Tool02-DsdesO-0.js} +1 -1
- package/dist/client/assets/{Trash01--uX5q_ti.js → Trash01-RuXWiql6.js} +1 -1
- package/dist/client/assets/{TrendUp01-acR-ekUr.js → TrendUp01-RmaL7vVA.js} +1 -1
- package/dist/client/assets/{Upload01-BaheeKQP.js → Upload01-t4JMvfO4.js} +1 -1
- package/dist/client/assets/{User01-5hu8D3_O.js → User01-nY_0gSR5.js} +1 -1
- package/dist/client/assets/{Users01-Dh5E4dqf.js → Users01-COP9ABdE.js} +1 -1
- package/dist/client/assets/{Users03-tGwfKVJc.js → Users03-CwOsvMmx.js} +1 -1
- package/dist/client/assets/{X-OFSHASit.js → X-82Zaa9wO.js} +1 -1
- package/dist/client/assets/{XCircle-D3cI1Aep.js → XCircle-DFVEpL7j.js} +1 -1
- package/dist/client/assets/{XClose-D5Ra7e-f.js → XClose-DGRyO79b.js} +1 -1
- package/dist/client/assets/{Zap-CgjpaG4V.js → Zap-DGilRzov.js} +1 -1
- package/dist/client/assets/{ZapSquare-Dzb50Gix.js → ZapSquare-x5bylaAn.js} +1 -1
- package/dist/client/assets/{ZoomOut-DYAXxr_v.js → ZoomOut-d0pU1jsr.js} +1 -1
- package/dist/client/assets/{access-gate-B4XS-sin.js → access-gate-B9Uqf_RZ.js} +1 -1
- package/dist/client/assets/{add-section-modal-2QsV6sh6.js → add-section-modal-F3LoJMj-.js} +1 -1
- package/dist/client/assets/agent-icon-Bx7GZZkT.js +1 -0
- package/dist/client/assets/agents-list-DA2O4yFI.js +1 -0
- package/dist/client/assets/ai-providers-_h8FzskN.js +1 -0
- package/dist/client/assets/{alert-DBWDLZgp.js → alert-D7vvtYHx.js} +1 -1
- package/dist/client/assets/{alert-dialog-Bd5XLC3F.js → alert-dialog-BbUTua7Y.js} +3 -3
- package/dist/client/assets/{app-editor-CC9wPnl_.js → app-editor-Ba6EJE8k.js} +1 -1
- package/dist/client/assets/{auth-D_bm0-t3.js → auth-Cduc78Mk.js} +1 -1
- package/dist/client/assets/{auth-catchall-CDVAqOkY.js → auth-catchall-BiGQzMvA.js} +1 -1
- package/dist/client/assets/auth-entry-B1IjK16Y.js +1 -0
- package/dist/client/assets/{auth-split-layout-DB8qmgLK.js → auth-split-layout-B5WaIo2U.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-ClCvWDci.js → authenticate-and-persist-oauth-Bsjhlz6M.js} +1 -1
- package/dist/client/assets/{automation-list-row-ByoN-o6y.js → automation-list-row-tfqwgW_l.js} +1 -1
- package/dist/client/assets/{automation-runs-Y9TSuy3F.js → automation-runs-HchqpNoW.js} +1 -1
- package/dist/client/assets/automations-3g-k57eu.js +1 -0
- package/dist/client/assets/{autosend-qB5BaOSA.js → autosend-CFSFemh9.js} +1 -1
- package/dist/client/assets/{avatar-DOYkgu8W.js → avatar-ChSwYwdc.js} +1 -1
- package/dist/client/assets/{badge-BMMjntMn.js → badge-BDCVlL_X.js} +1 -1
- package/dist/client/assets/{block-document-CCtmnkDi.js → block-document-CwHUDj3Z.js} +1 -1
- package/dist/client/assets/brand-context-KxYFeM0J.js +1 -0
- package/dist/client/assets/{buckets-B22IEfKD.js → buckets-BB9qHXCG.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-C3pu2Jik.js → bulk-category-panel-mDoc713s.js} +1 -1
- package/dist/client/assets/{calendar-Io_vhk-a.js → calendar-DkErgVju.js} +1 -1
- package/dist/client/assets/capability-load-error-C5KrMr5A.js +1 -0
- package/dist/client/assets/{card-Bc92PJFP.js → card-CZ_4AnzZ.js} +1 -1
- package/dist/client/assets/{category-editor-C1FxzSFF.js → category-editor-CoE1JSlR.js} +1 -1
- package/dist/client/assets/{chat-context-Awe2cIoY.js → chat-context-DHiffp4D.js} +6 -6
- package/dist/client/assets/{checkbox-B-y-IHdE.js → checkbox-B0y92ybh.js} +1 -1
- package/dist/client/assets/{cli-auth-success-BlIIxKPd.js → cli-auth-success-BJQaPA_u.js} +1 -1
- package/dist/client/assets/collection-detail-B85L8fXv.js +1 -0
- package/dist/client/assets/{collection-display-button-BVhQtAEp.js → collection-display-button-CTkls5Hq.js} +1 -1
- package/dist/client/assets/{collection-search-DSP3ov6A.js → collection-search-B1ZoXYDP.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-CeR2zvlX.js → collection-table-wrapper-CzOELqST.js} +1 -1
- package/dist/client/assets/{collection-tabs-PTC62n_G.js → collection-tabs-DSyyuCu8.js} +1 -1
- package/dist/client/assets/{command-DzGwZa9g.js → command-NscuxjlL.js} +1 -1
- package/dist/client/assets/commerce-onboarding-DS2bNsVf.js +1 -0
- package/dist/client/assets/{connect-desktop-dialog-DiutLBhU.js → connect-desktop-dialog-C_zkxzg2.js} +1 -1
- package/dist/client/assets/connection-card-DgJ4fCkV.js +1 -0
- package/dist/client/assets/connection-detail-BHWNvMoI.js +1 -0
- package/dist/client/assets/{connection-form-helpers-POWe2kJ-.js → connection-form-helpers-CoPiWrjw.js} +1 -1
- package/dist/client/assets/connections-ByyzNSeZ.js +1 -0
- package/dist/client/assets/{decopilot-sse-pool-CJtSg3wj.js → decopilot-sse-pool-jzNdhqzZ.js} +1 -1
- package/dist/client/assets/dialog-BxiPyolh.js +1 -0
- package/dist/client/assets/domain-settings-DixzI7vw.js +1 -0
- package/dist/client/assets/{drawer-Ck_Oak77.js → drawer-HMFyJ4Dn.js} +1 -1
- package/dist/client/assets/{dropdown-menu-C9SSwIby.js → dropdown-menu-B8LX4IYo.js} +1 -1
- package/dist/client/assets/{empty-state-DD15-E7x.js → empty-state-BJyyJcI7.js} +1 -1
- package/dist/client/assets/{extract-connection-data-Di6SAuY0.js → extract-connection-data-CgMMiKb9.js} +1 -1
- package/dist/client/assets/{file-explorer-CMqCjVts.js → file-explorer-B2mELjEV.js} +2 -2
- package/dist/client/assets/{file-type-icon-CuakGACj.js → file-type-icon-aF4rioSK.js} +1 -1
- package/dist/client/assets/{files-DrQIRu5a.js → files-DlatlTEv.js} +1 -1
- package/dist/client/assets/{form-YJrSMpNL.js → form-NWTw1_w9.js} +1 -1
- package/dist/client/assets/general-B6MHlXUW.js +1 -0
- package/dist/client/assets/github-repo-picker-BgT_NiIP.js +1 -0
- package/dist/client/assets/{hooks-GnFkomrq.js → hooks-7RE64ble.js} +1 -1
- package/dist/client/assets/index-6OJYzM5S.js +1 -0
- package/dist/client/assets/{index-DS3hrf0F.js → index-BQNtvMv8.js} +1 -1
- package/dist/client/assets/index-Bn17GDJi.js +1 -0
- package/dist/client/assets/{index-0yvnZiwb.js → index-C6SqXYAf.js} +1 -1
- package/dist/client/assets/{index-Cim2j5YD.js → index-CGtkbkWC.js} +1 -1
- package/dist/client/assets/{index-CCnsgP9d.js → index-CNXl1ql2.js} +5 -5
- package/dist/client/assets/{index-Dv19SgJH.js → index-CPLWHNIg.js} +5 -5
- package/dist/client/assets/{index-CsZhMKFM.js → index-CtlgC1KW.js} +26 -26
- package/dist/client/assets/{index-Cyr1IOqy.js → index-Cv4TIpz2.js} +1 -1
- package/dist/client/assets/index-D6W0Zja4.css +1 -0
- package/dist/client/assets/index-DX7CG04Y.js +1 -0
- package/dist/client/assets/index-Dz-SEkbI.js +1 -0
- package/dist/client/assets/{index-DPzJsdBC.js → index-FOhB290E.js} +1 -1
- package/dist/client/assets/{index-MwzluG1w.js → index-Fk54aBQb.js} +1 -1
- package/dist/client/assets/{index-redirect-Hp_EA6DJ.js → index-redirect-D_1i3wgr.js} +1 -1
- package/dist/client/assets/{index-BraRl60q.js → index-w9OsdEvg.js} +1 -1
- package/dist/client/assets/{input-D5ccsU_1.js → input-D0-jk8XC.js} +1 -1
- package/dist/client/assets/{integration-icon-6pGkEdul.js → integration-icon-BxCXFWwF.js} +1 -1
- package/dist/client/assets/invite-member-dialog-CczkEEVJ.js +3 -0
- package/dist/client/assets/{label-BULuaMoF.js → label-CI8zXgUl.js} +1 -1
- package/dist/client/assets/{layout-BloKJFhD.js → layout-DsSv6cI0.js} +1 -1
- package/dist/client/assets/{login-Dzlh5qYT.js → login-vc557tVg.js} +1 -1
- package/dist/client/assets/{mcp-oauth-z9GFPjDo.js → mcp-oauth-Crm2yFws.js} +1 -1
- package/dist/client/assets/members-BriZzAKO.js +1 -0
- package/dist/client/assets/{monaco-editor-CiP0ChuC.js → monaco-editor-BSERZA56.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-CLHK9ypI.js → monitoring-stats-row-Bzy4MOqt.js} +3 -3
- package/dist/client/assets/{oauth-callback-CdWGFVi8.js → oauth-callback-BweaHAfJ.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-qp9LO32T.js → oauth-callback-ai-provider-DGFuYZT6.js} +1 -1
- package/dist/client/assets/{onboarding-iL9ZeHnE.js → onboarding-CGfqD1Pb.js} +1 -1
- package/dist/client/assets/{org-install-ZxTYabEU.js → org-install-C4kxLg_g.js} +1 -1
- package/dist/client/assets/{org-layout-DWaUEBqs.js → org-layout-DzZAcdj6.js} +1 -1
- package/dist/client/assets/{organization-choice-5GYvmez0.js → organization-choice-D69Iyg_P.js} +1 -1
- package/dist/client/assets/{orgs-CRRA1WCm.js → orgs-CvM6zK17.js} +1 -1
- package/dist/client/assets/{page-seo-form-C4SLs6YG.js → page-seo-form-C8i2PCcW.js} +1 -1
- package/dist/client/assets/page-seo-sheet-Bj1PQ_T3.js +1 -0
- package/dist/client/assets/{popover-C5PoRwEk.js → popover-4SjKIFSf.js} +1 -1
- package/dist/client/assets/{post-editor-DQzYF8Ef.js → post-editor-DwhUQfz3.js} +1 -1
- package/dist/client/assets/{primitives-BEmjSMO9.js → primitives-IUnUzi8K.js} +1 -1
- package/dist/client/assets/profile-op77lWAk.js +1 -0
- package/dist/client/assets/project-app-view-Bw5vRwKV.js +1 -0
- package/dist/client/assets/record-editor-CO3ZgdGS.js +1 -0
- package/dist/client/assets/registry-DasK6zXw.js +2 -0
- package/dist/client/assets/{registry-layout-BDNmgEhN.js → registry-layout-DPozdEQJ.js} +4 -4
- package/dist/client/assets/{reports-C6ascunL.js → reports-AOzd79LO.js} +1 -1
- package/dist/client/assets/{require-capability-BjscC7QS.js → require-capability-BIrGCy6a.js} +1 -1
- package/dist/client/assets/{required-auth-layout-R2McgzF5.js → required-auth-layout-CQN5hr5X.js} +1 -1
- package/dist/client/assets/{reset-password-Fw4tx_9w.js → reset-password-DyAxea_4.js} +1 -1
- package/dist/client/assets/roles-Bmag3QoK.js +1 -0
- package/dist/client/assets/{search-input-BREJK7qA.js → search-input-DAhQOW8w.js} +1 -1
- package/dist/client/assets/secrets-Bca-yEgx.js +1 -0
- package/dist/client/assets/{sections-editor-CKmy6jCA.js → sections-editor-A9ozMN_I.js} +1 -1
- package/dist/client/assets/{select-CVMXwLRV.js → select-DymbSi1i.js} +1 -1
- package/dist/client/assets/{select-model-Cg3FzUNI.js → select-model-CBmm5efp.js} +1 -1
- package/dist/client/assets/self-tool-result-DQZF7wnw.js +1 -0
- package/dist/client/assets/{seo-editor-DVVtxnZN.js → seo-editor-D8BRx5cO.js} +1 -1
- package/dist/client/assets/settings-layout-BbrrKyAB.js +1 -0
- package/dist/client/assets/{settings-section-BYCtjEaG.js → settings-section-BorHlHtt.js} +1 -1
- package/dist/client/assets/{shell-controls-Daj0PZIQ.js → shell-controls-D4pwQUJp.js} +1 -1
- package/dist/client/assets/shell-layout-DSlq9QDA.js +1 -0
- package/dist/client/assets/sidebar-BGBaPTiJ.js +1 -0
- package/dist/client/assets/{skeleton-BZzqWIif.js → skeleton-Cs7umMol.js} +1 -1
- package/dist/client/assets/sso-CSY_I7_s.js +1 -0
- package/dist/client/assets/store-CbwbkmsP.js +1 -0
- package/dist/client/assets/store-registry-3IML_T0w.js +2 -0
- package/dist/client/assets/studio-tools-Dm4swbDJ.js +1 -0
- package/dist/client/assets/{switch-B36ltQ63.js → switch-DenJ-Rqp.js} +1 -1
- package/dist/client/assets/{table-CLRsCUXA.js → table-6yLqG5BG.js} +1 -1
- package/dist/client/assets/{tabs-BoNNus4B.js → tabs-B41R3KT7.js} +1 -1
- package/dist/client/assets/{textarea-DPLwPKZJ.js → textarea-DDx4ded2.js} +1 -1
- package/dist/client/assets/{toggle-group-DkGsY2u-.js → toggle-group-DxbzbSVL.js} +1 -1
- package/dist/client/assets/{toolbar-CedVmC1P.js → toolbar-Dw7sJZzm.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-5fStNBy9.js → toolbar-icon-button-DRu94yPg.js} +1 -1
- package/dist/client/assets/tools-list-gF6CK4rd.js +1 -0
- package/dist/client/assets/{tooltip-Cs5hng3q.js → tooltip-2S76Z1GN.js} +1 -1
- package/dist/client/assets/use-ai-providers-BRJFSGox.js +1 -0
- package/dist/client/assets/use-automations-CtMMZwGK.js +1 -0
- package/dist/client/assets/use-capability-Cr4AoWjX.js +1 -0
- package/dist/client/assets/{use-clock-tick-CB7NlnVZ.js → use-clock-tick-YishFSE2.js} +1 -1
- package/dist/client/assets/{use-collections-Cl7KVWNQ.js → use-collections-Bq6tf4lW.js} +1 -1
- package/dist/client/assets/use-connection-C0xfUPl-.js +1 -0
- package/dist/client/assets/{use-copy-B-pxrD6E.js → use-copy-D7Lvwi_8.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-DPkT8FPW.js → use-create-virtual-mcp-CT3JpXjp.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-teletZQd.js → use-debounced-autosave-DnYuRWI8.js} +1 -1
- package/dist/client/assets/{use-debounced-value-ChKSUuxz.js → use-debounced-value-LiVhfciY.js} +1 -1
- package/dist/client/assets/use-deco-credits-DTpKn8hS.js +1 -0
- package/dist/client/assets/{use-decopilot-events-CWf9qNc0.js → use-decopilot-events-42PTdhf1.js} +1 -1
- package/dist/client/assets/use-delete-connection-CKLjJrR4.js +1 -0
- package/dist/client/assets/{use-deployment-admin-C3JCAXzA.js → use-deployment-admin-Cfv-0c-V.js} +1 -1
- package/dist/client/assets/use-file-configs-DRXMLwD-.js +1 -0
- package/dist/client/assets/use-infinite-scroll-BkP7H-cz.js +1 -0
- package/dist/client/assets/use-join-requests-l1azjTjY.js +1 -0
- package/dist/client/assets/{use-mcp-client-Bv8WGceO.js → use-mcp-client-8-W_7yBa.js} +4 -4
- package/dist/client/assets/{use-mcp-tools-_p3Gu3UX.js → use-mcp-tools-CUOQhfsg.js} +1 -1
- package/dist/client/assets/use-members-CynVAzPM.js +1 -0
- package/dist/client/assets/{use-mobile-DhhfLpzh.js → use-mobile-CcO0QCgb.js} +1 -1
- package/dist/client/assets/use-navigate-to-agent-DNjmGLp3.js +1 -0
- package/dist/client/assets/use-org-auth-client-mw0sCxV3.js +1 -0
- package/dist/client/assets/{use-org-sso-DDm0m5Eb.js → use-org-sso-BjHGhVgE.js} +1 -1
- package/dist/client/assets/use-organization-roles-Cjha62oV.js +1 -0
- package/dist/client/assets/use-organization-settings-B3aKfsZI.js +1 -0
- package/dist/client/assets/use-registry-connections-CVi0ypH7.js +1 -0
- package/dist/client/assets/use-secrets-C5knhQtS.js +1 -0
- package/dist/client/assets/use-status-sounds-C434uotZ.js +1 -0
- package/dist/client/assets/{use-view-mode-H6oFviHU.js → use-view-mode-BeALUlwT.js} +1 -1
- package/dist/client/assets/use-virtual-mcp-BjiOjpKa.js +1 -0
- package/dist/client/assets/useInfiniteQuery-C5v-SAtB.js +1 -0
- package/dist/client/assets/{useRouterState-DjtN_ggp.js → useRouterState-BRB-iA8I.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BeixZw8P.js +1 -0
- package/dist/client/assets/{users-CwhV7o0r.js → users-D2x-LE8o.js} +1 -1
- package/dist/client/assets/{variant-calendar-5liHDWH_.js → variant-calendar-BcqsqX_c.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-DovE7i8d.js → view-mode-toggle-JDik54gp.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +1 -1
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/agent-icon-dPkJbbXq.js +0 -1
- package/dist/client/assets/agents-list-CBbQQUEx.js +0 -1
- package/dist/client/assets/ai-providers-CeevjV97.js +0 -1
- package/dist/client/assets/auth-entry-Bo3LWJI9.js +0 -1
- package/dist/client/assets/automations-DDTM3E3g.js +0 -1
- package/dist/client/assets/brand-context-Bkaj5nz3.js +0 -1
- package/dist/client/assets/capability-load-error-COzn8-Xb.js +0 -1
- package/dist/client/assets/collection-detail-CcnshY5k.js +0 -1
- package/dist/client/assets/commerce-onboarding-v6NmdNz5.js +0 -1
- package/dist/client/assets/connection-card-CXwWR_5h.js +0 -1
- package/dist/client/assets/connection-detail-B_tl4TZx.js +0 -1
- package/dist/client/assets/connections-C1NH7yoX.js +0 -1
- package/dist/client/assets/dialog-DZtdYFi_.js +0 -1
- package/dist/client/assets/domain-settings-C7CfCyw6.js +0 -1
- package/dist/client/assets/general-XFvP4tXw.js +0 -1
- package/dist/client/assets/github-repo-picker-VDMXf52q.js +0 -1
- package/dist/client/assets/index-CEI6wi5Z.js +0 -1
- package/dist/client/assets/index-DFCCfX3B.js +0 -1
- package/dist/client/assets/index-DKyQrM3l.js +0 -1
- package/dist/client/assets/index-DPKpPAQv.js +0 -1
- package/dist/client/assets/index-DhnTILyr.css +0 -1
- package/dist/client/assets/invite-member-dialog-DV_-RNy8.js +0 -3
- package/dist/client/assets/members-BfULkB51.js +0 -1
- package/dist/client/assets/page-seo-sheet-CqzS0lEJ.js +0 -1
- package/dist/client/assets/profile-Dh73-0Iy.js +0 -1
- package/dist/client/assets/project-app-view-KN05BOuo.js +0 -1
- package/dist/client/assets/record-editor-BGeMoeUP.js +0 -1
- package/dist/client/assets/registry-DGAgXfxF.js +0 -2
- package/dist/client/assets/roles-D6vLw9pS.js +0 -1
- package/dist/client/assets/secrets-B2rqgV3S.js +0 -1
- package/dist/client/assets/settings-layout-CS4A10kE.js +0 -1
- package/dist/client/assets/shell-layout-Bi4LjwsI.js +0 -1
- package/dist/client/assets/sidebar-DRSu2iBz.js +0 -1
- package/dist/client/assets/sso-C6uqUsih.js +0 -1
- package/dist/client/assets/store-BZ7eoytz.js +0 -1
- package/dist/client/assets/store-registry-DA7t2U9g.js +0 -2
- package/dist/client/assets/studio-tools-CTswP4mA.js +0 -1
- package/dist/client/assets/tools-list-DyAKlhYk.js +0 -1
- package/dist/client/assets/use-ai-providers-D77UFwvU.js +0 -1
- package/dist/client/assets/use-automations-WNGih4F_.js +0 -1
- package/dist/client/assets/use-capability-DmeYLlad.js +0 -1
- package/dist/client/assets/use-connection-CcLotHiI.js +0 -1
- package/dist/client/assets/use-deco-credits-1Xd5keqC.js +0 -1
- package/dist/client/assets/use-delete-connection-BJuEHINL.js +0 -1
- package/dist/client/assets/use-file-configs-G_3bUBDS.js +0 -1
- package/dist/client/assets/use-infinite-scroll-BTdf9pFZ.js +0 -1
- package/dist/client/assets/use-join-requests-NgN8gue3.js +0 -1
- package/dist/client/assets/use-members-eaM3vNiv.js +0 -1
- package/dist/client/assets/use-navigate-to-agent-BsdctirU.js +0 -1
- package/dist/client/assets/use-org-auth-client-DYoTiK8H.js +0 -1
- package/dist/client/assets/use-organization-roles-CcwnCugJ.js +0 -1
- package/dist/client/assets/use-organization-settings-C4hP3pVq.js +0 -1
- package/dist/client/assets/use-registry-connections-xg-zrNmx.js +0 -1
- package/dist/client/assets/use-secrets-CdGKHqA-.js +0 -1
- package/dist/client/assets/use-status-sounds-Uz1qdvt2.js +0 -1
- package/dist/client/assets/use-virtual-mcp-CMvxAHEJ.js +0 -1
- package/dist/client/assets/useInfiniteQuery-BosqZeNZ.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-Dh0QZdLF.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as kt,p as Ue,s as Lt,q as Pt,Q as ct,n as ye,v as zt,w as Ut,r as K,x as $t,y as Dt,z as Mt,C as qt,D as st,E as Ft,F as Kt,G as Vt,c as F,l as ie,j as t,B,d as pe,K as Y,H as _e,I as ce,J as Se,M as Ne,i as Re,m as ge,t as Ae,P as ve,R as X,T as dt,U as ut,a as ke,u as mt,V as Ht,b as ft,W as Qt,X as pt,Y as Gt}from"./index-CsZhMKFM.js";import{A as Bt}from"./auth-entry-Bo3LWJI9.js";import{A as Wt}from"./auth-split-layout-DB8qmgLK.js";import{O as nt}from"./organization-choice-5GYvmez0.js";import{f as Yt}from"./tab-id-bb-jjgGv.js";import{I as be}from"./input-D5ccsU_1.js";import{u as Le}from"./use-mcp-client-Bv8WGceO.js";import{W as Me,S as gt,g as Jt,C as Xt}from"./constants-CaIX_f5U.js";import{i as ht}from"./XCircle-D3cI1Aep.js";import{I as qe}from"./integration-icon-6pGkEdul.js";import{c as he,a as xt,f as yt,D as bt,d as vt,e as Ct}from"./dialog-DZtdYFi_.js";import{T as Fe,a as Ke,b as Ve}from"./tooltip-Cs5hng3q.js";import{i as He}from"./CheckCircle-lXciCGfG.js";import{i as jt,t as Zt,a as _t}from"./agent-icon-dPkJbbXq.js";import{g as es,c as ts,e as ss}from"./extract-connection-data-Di6SAuY0.js";import{g as ns,f as os}from"./github-installations-D2vHSx02.js";import{F as de,a as Ee,b as ue,c as Oe,d as me,e as fe,f as is}from"./form-YJrSMpNL.js";import{i as rs}from"./Check-CcLLJc-z.js";import{a as St}from"./Copy01-b3lIb5yu.js";import{i as as}from"./Settings02-CS2jOfO5.js";import{s as ls}from"./Eye-DM8bmzm7.js";import{u as cs}from"./use-debounced-value-ChKSUuxz.js";import{a as ds}from"./authenticate-and-persist-oauth-ClCvWDci.js";import{i as Nt}from"./ArrowUpRight-DdPCnlNm.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-DOYkgu8W.js";import"./User01-5hu8D3_O.js";import"./auth-D_bm0-t3.js";import"./Tool02-CSTMjTef.js";import"./X-OFSHASit.js";import"./AlertCircle-BsA2wZmN.js";import"./Tool01-DVCGutKV.js";import"./ArrowUp-CDnEKV2Y.js";import"./TrendUp01-acR-ekUr.js";import"./ZapSquare-Dzb50Gix.js";import"./Users03-tGwfKVJc.js";import"./Loading02-Dx-xiZND.js";import"./ChevronDown-BmFaSDo8.js";import"./ChevronRight-C3Tgk-3m.js";import"./ChevronUp-Dew3RmKl.js";import"./Circle-C_fdyhr8.js";import"./Stars02-HLp9q8iP.js";import"./ZoomOut-DYAXxr_v.js";import"./DotsVertical-CK1a4mKj.js";import"./Globe01-B6kdhpV9.js";import"./FilterLines-DCNZa1GS.js";import"./Star01-2DHf7kTZ.js";import"./Globe04-CGLGspo5.js";import"./SwitchHorizontal01-ilLzkPr_.js";import"./HardDrive-CR6Rs-a1.js";import"./Key01-1r4YrQER.js";import"./LayoutLeft-DvNM8qhm.js";import"./LinkExternal01-Ck4lryDE.js";import"./List-DfPIAPM_.js";import"./Monitor01-D_DrBwt_.js";import"./Sun-ByaEjJ0N.js";import"./Package-CV2Q9Uup.js";import"./Palette-BY5BmUDa.js";import"./Play-Ci1OqtIO.js";import"./Plus-Cgq7ON9K.js";import"./SearchLg-2as_l8YT.js";import"./SearchMd-ZfoTl6vw.js";import"./Shield01-C6TdRfmI.js";import"./Stars01-BEHbN5c3.js";import"./Trash01--uX5q_ti.js";import"./Upload01-BaheeKQP.js";import"./Users01-Dh5E4dqf.js";import"./XClose-D5Ra7e-f.js";import"./Zap-CgjpaG4V.js";import"./label-BULuaMoF.js";import"./mcp-oauth-z9GFPjDo.js";function ot(n,e){const s=new Set(e);return n.filter(o=>!s.has(o))}function us(n,e,s){const o=n.slice(0);return o[e]=s,o}var ms=class extends kt{#o;#e;#i;#n;#t;#s;#r;#a;#l;#c=[];constructor(n,e,s){super(),this.#o=n,this.#n=s,this.#i=[],this.#t=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(n=>{n.subscribe(e=>{this.#f(n,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(n=>{n.destroy()})}setQueries(n,e){this.#i=n,this.#n=e,Ue.batch(()=>{const s=this.#t,o=this.#m(this.#i);o.forEach(l=>l.observer.setOptions(l.defaultedQueryOptions));const i=o.map(l=>l.observer),r=i.map(l=>l.getCurrentResult()),a=s.length!==i.length,c=i.some((l,p)=>l!==s[p]),d=a||c,m=d?!0:r.some((l,p)=>{const f=this.#e[p];return!f||!Lt(l,f)});!d&&!m||(d&&(this.#c=o,this.#t=i),this.#e=r,this.hasListeners()&&(d&&(ot(s,i).forEach(l=>{l.destroy()}),ot(i,s).forEach(l=>{l.subscribe(p=>{this.#f(l,p)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(n=>n.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(n,e){const s=this.#m(n),o=s.map(r=>r.observer.getOptimisticResult(r.defaultedQueryOptions)),i=s.map(r=>r.defaultedQueryOptions.queryHash);return[o,r=>this.#u(r??o,e,i),()=>this.#d(o,s)]}#d(n,e){return e.map((s,o)=>{const i=n[o];return s.defaultedQueryOptions.notifyOnChangeProps?i:s.observer.trackResult(i,r=>{e.forEach(a=>{a.observer.trackProp(r)})})})}#u(n,e,s){if(e){const o=this.#l,i=s!==void 0&&o!==void 0&&(o.length!==s.length||s.some((r,a)=>r!==o[a]));return(!this.#s||this.#e!==this.#a||i||e!==this.#r)&&(this.#r=e,this.#a=this.#e,s!==void 0&&(this.#l=s),this.#s=Pt(this.#s,e(n))),this.#s}return n}#g(){return this.#n?.combine!==void 0&&this.#t.some((n,e)=>n.options.suspense&&this.#e[e]?.data===void 0)}#m(n){const e=new Map;this.#t.forEach(o=>{const i=o.options.queryHash;if(!i)return;const r=e.get(i);r?r.push(o):e.set(i,[o])});const s=[];return n.forEach(o=>{const i=this.#o.defaultQueryOptions(o),a=e.get(i.queryHash)?.shift()??new ct(this.#o,i);s.push({defaultedQueryOptions:i,observer:a})}),s}#f(n,e){const s=this.#t.indexOf(n);s!==-1&&(this.#e=us(this.#e,s,e),this.#p())}#p(){if(this.hasListeners()){const n=this.#d(this.#e,this.#c),e=this.#g(),s=this.#s,o=e?s:this.#u(n,this.#n?.combine);(e||s!==o)&&Ue.batch(()=>{this.listeners.forEach(i=>{i(this.#e)})})}}};function fs({queries:n,...e},s){const o=ye(s),i=zt(),r=Ut(),a=K.useMemo(()=>n.map(C=>{const h=o.defaultQueryOptions(C);return h._optimisticResults=i?"isRestoring":"optimistic",h}),[n,o,i]);a.forEach(C=>{$t(C);const h=o.getQueryCache().get(C.queryHash);Dt(C,r,h)}),Mt(r);const[c]=K.useState(()=>new ms(o,a,e)),[d,m,l]=c.getOptimisticResult(a,e.combine),p=!i&&e.subscribed!==!1;K.useSyncExternalStore(K.useCallback(C=>p?c.subscribe(Ue.batchCalls(C)):qt,[c,p]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),K.useEffect(()=>{c.setQueries(a,e)},[a,e,c]);const x=d.some((C,h)=>st(a[h],C))?d.flatMap((C,h)=>{const g=a[h];if(g&&st(g,C)){const u=new ct(o,g);return Ft(g,u,r)}return[]}):[];if(x.length>0)throw Promise.all(x);const y=d.find((C,h)=>{const g=a[h];return g&&Kt({result:C,errorResetBoundary:r,throwOnError:g.throwOnError,query:o.getQueryCache().get(g.queryHash),suspense:g.suspense})});if(y?.error)throw y.error;return m(l())}function ps(n,e){return fs({...n,queries:n.queries.map(s=>({...s,suspense:!0,throwOnError:Vt,enabled:!0,placeholderData:void 0}))},e)}const gs=/^[a-zA-Z][a-zA-Z\d+.-]*:/,hs=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,xs=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,ys=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function ae(n){const e=n.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const s=gs.test(e),o=hs.test(e),i=xs.test(e);if(s&&!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||!ys.test(d))?{ok:!1,error:"Enter a valid website URL."}:(a.protocol="https:",{ok:!0,value:a.origin})}function bs(n,e){if(!n.trim())return!0;const s=ae(n);if(!s.ok||!e)return!1;const o=ae(e);return o.ok&&o.value===s.value}function $e(n){const e=F.c(14),{children:s,className:o,wrapperClassName:i}=n,[r,a]=K.useState(!0);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=C=>{if(!C)return;const h=()=>{const u=C.scrollHeight-C.scrollTop-C.clientHeight<8;a(u)};h(),C.addEventListener("scroll",h,{passive:!0});const g=new ResizeObserver(h);g.observe(C);for(const u of Array.from(C.children))g.observe(u);return()=>{C.removeEventListener("scroll",h),g.disconnect()}},e[0]=c):c=e[0];const d=c;let m;e[1]!==i?(m=ie("relative",i),e[1]=i,e[2]=m):m=e[2];let l;e[3]!==s||e[4]!==o?(l=t.jsx("div",{ref:d,className:o,children:s}),e[3]=s,e[4]=o,e[5]=l):l=e[5];const p=r?"opacity-0":"opacity-100";let f;e[6]!==p?(f=ie("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]=f):f=e[7];let x;e[8]!==f?(x=t.jsx("div",{"aria-hidden":!0,className:f}),e[8]=f,e[9]=x):x=e[9];let y;return e[10]!==m||e[11]!==l||e[12]!==x?(y=t.jsxs("div",{className:m,children:[l,x]}),e[10]=m,e[11]=l,e[12]=x,e[13]=y):y=e[13],y}function vs(n){const e=n.properties;if(!e)return[];const s=[];for(const[o,i]of Object.entries(e)){const c=i?.properties?.__type?.const;typeof c=="string"&&c.length>0&&s.push({fieldKey:o,bindingType:c})}return s}const Cs=[{fieldKey:"vtex",bindingType:"vtex"},{fieldKey:"ga4",bindingType:"google-analytics"},{fieldKey:"gsc",bindingType:"google-search-console"},{fieldKey:"github",bindingType:"github"}];function js(n,e){const s=[];if(n.length&&s.push({field:["id"],operator:"in",value:n}),e.length&&s.push({field:["name"],operator:"in",value:e}),s.length!==0)return s.length===1?s[0]:{operator:"or",conditions:s}}function se(n){const e=n;if(e.isError)throw new Error(e.content?.find(s=>s.text)?.text??"Tool call failed");return e.structuredContent??n}function _s(n,e,s,o){return{...n??{},[e]:{__type:s,value:o}}}function De(n){return n==null?!1:typeof n=="string"?n.trim().length>0:typeof n=="number"||typeof n=="boolean"?!0:Array.isArray(n)?n.some(De):typeof n=="object"?Object.entries(n).some(([e,s])=>!e.startsWith("__")&&De(s)):!1}function Ss(n){const e={accountName:"Nome da conta",appKey:"App Key",appToken:"App Token",propertyId:"Propriedade",siteUrl:"Site"};return e[n]?e[n]:n.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,s=>s.toUpperCase())}function Ns(n){return De(n)?typeof n=="string"?n.trim():typeof n=="number"||typeof n=="boolean"?String(n):JSON.stringify(n):null}function Es(n){return n?Object.entries(n).flatMap(([e,s])=>{if(e.startsWith("__"))return[];const o=Ns(s);return o?[{key:e,label:Ss(e),value:o}]:[]}):[]}function ws({autoOpenFieldKey:n,card:e}){return n===e.fieldKey&&e.satisfied&&!!e.linkedConnectionId}function Ts(n,e,s){const o=n.filter(i=>(i.app_name===e||!!s&&i.app_id===s)&&ns(i)===null);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 Os(n){return n.server?.icons?.[0]?.src??es(n.server?.repository)??null}function Is(n,e){const s=n._meta?.["mcp.mesh"];return s?.friendlyName||s?.friendly_name||n.title||n.server?.title||n.server?.name||e}function Rs(n){const e=[],s=new Map(n.connections.map(o=>[o.id,o]));for(const o of n.requirements){const i=n.curated[o.bindingType],r=i?n.itemsById[i.registryAppId]:n.itemsByName[o.bindingType];if(!r)continue;const a=n.configurationState?.[o.fieldKey]?.value,c=a?s.get(a):void 0,d=a&&c?a:null,m=d?n.connectionReadiness?.[d]!==!1:!1,l=!!d&&m,p=l?void 0:n.saBindings?.[o.bindingType],f=l||!!p,x=l?"oauth":p?"sa":null;e.push({fieldKey:o.fieldKey,bindingType:o.bindingType,registryItem:r,title:Is(r,o.bindingType),icon:Os(r),headline:i?.headline??r._meta?.["mcp.mesh"]?.short_description??null,area:i?.area??null,bullets:i?.bullets??[],satisfied:f,candidateConnectionId:f?null:d||Ts(n.connections,o.bindingType,i?.registryAppId),linkedConnectionId:d,configurationState:c?.configuration_state??null,boundVia:x,boundResource:p?.resource??null})}return e}function As(n,e){if(!n)return null;const s=i=>{const r=i.startsWith("sc-domain:")?i.substring(10):(()=>{try{return new URL(i.startsWith("http")?i:`https://${i}`).hostname}catch{return null}})();return r===null?i:r.startsWith("www.")?r.substring(4):r},o=s(n);for(const i of e)if(s(i.siteUrl)===o)return i.siteUrl;return null}function ks(n){return(n?.response?.accountSummaries??[]).map(o=>({account:o.account,options:(o.propertySummaries??[]).map(i=>({value:i.property,label:`${i.displayName} (${o.displayName})`}))}))}function it(n){const e=F.c(38);let s,o,i,r,a;e[0]!==n?({value:a,onChange:o,placeholder:i,className:s,...r}=n,e[0]=n,e[1]=s,e[2]=o,e[3]=i,e[4]=r,e[5]=a):(s=e[1],o=e[2],i=e[3],r=e[4],a=e[5]);const[c,d]=K.useState(!1),[m,l]=K.useState(!1);let p;e[6]!==a?(p=async()=>{if(a)try{await navigator.clipboard.writeText(a),l(!0),setTimeout(()=>l(!1),2e3)}catch(R){console.error("Failed to copy text: ",R)}},e[6]=a,e[7]=p):p=e[7];const f=p;let x;e[8]!==c?(x=()=>{d(!c)},e[8]=c,e[9]=x):x=e[9];const y=x,C=c?"text":"password";let h;e[10]!==s?(h=ie("pr-20",s),e[10]=s,e[11]=h):h=e[11];let g;e[12]!==o||e[13]!==i||e[14]!==r||e[15]!==C||e[16]!==h||e[17]!==a?(g=t.jsx(be,{type:C,value:a,onChange:o,placeholder:i,className:h,...r}),e[12]=o,e[13]=i,e[14]=r,e[15]=C,e[16]=h,e[17]=a,e[18]=g):g=e[18];const u=c?"Hide password":"Show password";let v;e[19]!==c?(v=c?t.jsx(as,{size:16}):t.jsx(ls,{size:16}),e[19]=c,e[20]=v):v=e[20];let b;e[21]!==u||e[22]!==v||e[23]!==y?(b=t.jsx(B,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:y,title:u,children:v}),e[21]=u,e[22]=v,e[23]=y,e[24]=b):b=e[24];const _=!a,w=m?"Copied!":"Copy token";let S;e[25]!==m?(S=m?t.jsx(rs,{size:16}):t.jsx(St,{size:16}),e[25]=m,e[26]=S):S=e[26];let j;e[27]!==f||e[28]!==w||e[29]!==S||e[30]!==_?(j=t.jsx(B,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:f,disabled:_,title:w,children:S}),e[27]=f,e[28]=w,e[29]=S,e[30]=_,e[31]=j):j=e[31];let E;e[32]!==j||e[33]!==b?(E=t.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[b,j]}),e[32]=j,e[33]=b,e[34]=E):E=e[34];let O;return e[35]!==E||e[36]!==g?(O=t.jsxs("div",{className:"relative",children:[g,E]}),e[35]=E,e[36]=g,e[37]=O):O=e[37],O}function Qe(n){const e=F.c(19),{card:s,selfClient:o,org:i,onDone:r,onError:a}=n,c=ye();let d;e[0]!==s||e[1]!==o?(d=async h=>{const g={...s.configurationState??{},...h};await o.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:s.linkedConnectionId||s.candidateConnectionId,data:{configuration_state:g}}})},e[0]=s,e[1]=o,e[2]=d):d=e[2];let m;e[3]!==r||e[4]!==i||e[5]!==c?(m=async()=>{await c.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(i.id)}),r()},e[3]=r,e[4]=i,e[5]=c,e[6]=m):m=e[6];let l;e[7]!==a?(l=h=>{a?.(h)},e[7]=a,e[8]=l):l=e[8];let p;e[9]!==d||e[10]!==m||e[11]!==l?(p={mutationFn:d,onSuccess:m,onError:l},e[9]=d,e[10]=m,e[11]=l,e[12]=p):p=e[12];const f=pe(p);let x;e[13]!==f?(x=h=>f.mutate(h),e[13]=f,e[14]=x):x=e[14];const y=x;let C;return e[15]!==f.error||e[16]!==f.isPending||e[17]!==y?(C={save:y,isPending:f.isPending,error:f.error},e[15]=f.error,e[16]=f.isPending,e[17]=y,e[18]=C):C=e[18],C}const Ls=_e({accountName:ce().min(1,"Informe o nome da conta"),appKey:ce().optional(),appToken:ce().optional()});function Ps(n){const e=F.c(63),{card:s,selfClient:o,org:i,onDone:r,onIsPendingChange:a}=n;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=Se(Ls),e[0]=c):c=e[0];const d=s.configurationState?.accountName||"",m=s.configurationState?.appKey||"",l=s.configurationState?.appToken||"";let p;e[1]!==d||e[2]!==m||e[3]!==l?(p={resolver:c,defaultValues:{accountName:d,appKey:m,appToken:l}},e[1]=d,e[2]=m,e[3]=l,e[4]=p):p=e[4];const f=Ne(p);let x;e[5]!==s.configurationState?.accountName||e[6]!==s.configurationState?.appKey||e[7]!==s.configurationState?.appToken||e[8]!==f?(x=()=>{f.reset({accountName:s.configurationState?.accountName||"",appKey:s.configurationState?.appKey||"",appToken:s.configurationState?.appToken||""})},e[5]=s.configurationState?.accountName,e[6]=s.configurationState?.appKey,e[7]=s.configurationState?.appToken,e[8]=f,e[9]=x):x=e[9];let y;e[10]!==s.configurationState||e[11]!==f?(y=[s.configurationState,f],e[10]=s.configurationState,e[11]=f,e[12]=y):y=e[12],K.useEffect(x,y);let C;e[13]!==s||e[14]!==r||e[15]!==i||e[16]!==o?(C={card:s,selfClient:o,org:i,onDone:r},e[13]=s,e[14]=r,e[15]=i,e[16]=o,e[17]=C):C=e[17];const{save:h,isPending:g,error:u}=Qe(C);let v,b;e[18]!==g||e[19]!==a?(b=()=>{a?.(g)},v=[g,a],e[18]=g,e[19]=a,e[20]=v,e[21]=b):(v=e[20],b=e[21]),K.useEffect(b,v);let _;if(e[22]!==f||e[23]!==h){let $;e[25]!==h?($=async A=>{h(A)},e[25]=h,e[26]=$):$=e[26],_=f.handleSubmit($),e[22]=f,e[23]=h,e[24]=_}else _=e[24];const w=_;let S;e[27]!==g?(S=$=>{const{field:A}=$;return t.jsxs(ue,{children:[t.jsx(Oe,{children:"Nome da conta"}),t.jsx(me,{children:t.jsx(be,{placeholder:"Nome da sua conta VTEX",...A,disabled:g})}),t.jsx(fe,{})]})},e[27]=g,e[28]=S):S=e[28];let j;e[29]!==f.control||e[30]!==S?(j=t.jsx(de,{control:f.control,name:"accountName",render:S}),e[29]=f.control,e[30]=S,e[31]=j):j=e[31];let E;e[32]!==g?(E=$=>{const{field:A}=$;return t.jsxs(ue,{children:[t.jsx(Oe,{children:"App Key (opcional)"}),t.jsx(me,{children:t.jsx(it,{placeholder:"App Key da VTEX",...A,disabled:g})}),t.jsx(fe,{})]})},e[32]=g,e[33]=E):E=e[33];let O;e[34]!==f.control||e[35]!==E?(O=t.jsx(de,{control:f.control,name:"appKey",render:E}),e[34]=f.control,e[35]=E,e[36]=O):O=e[36];let R;e[37]!==g?(R=$=>{const{field:A}=$;return t.jsxs(ue,{children:[t.jsx(Oe,{children:"App Token (opcional)"}),t.jsx(me,{children:t.jsx(it,{placeholder:"App Token da VTEX",...A,disabled:g})}),t.jsx(fe,{})]})},e[37]=g,e[38]=R):R=e[38];let N;e[39]!==f.control||e[40]!==R?(N=t.jsx(de,{control:f.control,name:"appToken",render:R}),e[39]=f.control,e[40]=R,e[41]=N):N=e[41];let k;e[42]!==f||e[43]!==j||e[44]!==O||e[45]!==N?(k=t.jsxs(Ee,{...f,children:[j,O,N]}),e[42]=f,e[43]=j,e[44]=O,e[45]=N,e[46]=k):k=e[46];let P;e[47]!==u?(P=u&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:u instanceof Error?u.message:"Não foi possível salvar a configuração"}),e[47]=u,e[48]=P):P=e[48];let L;e[49]!==g||e[50]!==r?(L=t.jsx(B,{type:"button",variant:"outline",onClick:r,disabled:g,children:"Cancelar"}),e[49]=g,e[50]=r,e[51]=L):L=e[51];const M=g?"Salvando...":"Salvar";let U;e[52]!==g||e[53]!==M?(U=t.jsx(B,{type:"submit",disabled:g,children:M}),e[52]=g,e[53]=M,e[54]=U):U=e[54];let T;e[55]!==L||e[56]!==U?(T=t.jsxs(he,{className:"pt-4",children:[L,U]}),e[55]=L,e[56]=U,e[57]=T):T=e[57];let I;return e[58]!==w||e[59]!==k||e[60]!==P||e[61]!==T?(I=t.jsxs("form",{onSubmit:w,className:"space-y-4",children:[k,P,T]}),e[58]=w,e[59]=k,e[60]=P,e[61]=T,e[62]=I):I=e[62],I}function Ge(n){const e=F.c(29),{options:s,value:o,onChange:i,disabled:r,ariaLabel:a,searchPlaceholder:c,hideSearch:d}=n,m=c===void 0?"Buscar...":c,l=d===void 0?!1:d,[p,f]=K.useState("");let x,y,C;if(e[0]!==s||e[1]!==p||e[2]!==o){const S=p.trim().toLowerCase();x=S?s.filter(j=>j.label.toLowerCase().includes(S)):s,y=x.map(zs),C=y.includes(o)?o:y[0]??"",e[0]=s,e[1]=p,e[2]=o,e[3]=x,e[4]=y,e[5]=C}else x=e[3],y=e[4],C=e[5];const h=C;let g;e[6]!==r||e[7]!==y||e[8]!==i?(g=function(j){if(r||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(j.key))return;j.preventDefault();const O=j.currentTarget.dataset.value,R=y.indexOf(O),N=y.length;if(N===0)return;let k;j.key==="ArrowDown"||j.key==="ArrowRight"?k=(R+1)%N:j.key==="ArrowUp"||j.key==="ArrowLeft"?k=(R-1+N)%N:j.key==="Home"?k=0:k=N-1;const P=y[k];i(P),j.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(P)}"]`)?.focus()},e[6]=r,e[7]=y,e[8]=i,e[9]=g):g=e[9];const u=g;let v;e[10]!==a||e[11]!==r||e[12]!==l||e[13]!==p||e[14]!==m?(v=l?null:t.jsxs("div",{className:"relative",children:[t.jsx(jt,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),t.jsx(be,{type:"text",value:p,onChange:S=>f(S.target.value),disabled:r,placeholder:m,"aria-label":`Buscar ${a}`,className:"h-8 pl-8"})]}),e[10]=a,e[11]=r,e[12]=l,e[13]=p,e[14]=m,e[15]=v):v=e[15];let b;e[16]!==r||e[17]!==x||e[18]!==u||e[19]!==i||e[20]!==h||e[21]!==o?(b=x.length===0?t.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:"Nenhum resultado"}):x.map(S=>{const j=S.value===o;return t.jsxs("button",{type:"button",role:"radio","aria-checked":j,disabled:r,"data-value":S.value,tabIndex:S.value===h?0:-1,onClick:()=>i(S.value),onKeyDown:u,className:ie("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",j?"bg-muted font-medium text-foreground":"text-foreground hover:bg-muted/50"),children:[t.jsx("span",{className:"truncate",children:S.label}),j?t.jsx(He,{size:16,className:"shrink-0 text-primary"}):null]},S.value)}),e[16]=r,e[17]=x,e[18]=u,e[19]=i,e[20]=h,e[21]=o,e[22]=b):b=e[22];let _;e[23]!==a||e[24]!==b?(_=t.jsx("div",{role:"radiogroup","aria-label":a,className:"max-h-[280px] overflow-y-auto",children:b}),e[23]=a,e[24]=b,e[25]=_):_=e[25];let w;return e[26]!==v||e[27]!==_?(w=t.jsxs("div",{className:"space-y-2",children:[v,_]}),e[26]=v,e[27]=_,e[28]=w):w=e[28],w}function zs(n){return n.value}function Pe(n){const e=F.c(16),{label:s,iconSize:o,className:i,iconClassName:r,labelClassName:a}=n,c=o===void 0?14:o;let d;e[0]!==i?(d=ie("inline-flex items-center gap-2",i),e[0]=i,e[1]=d):d=e[1];let m;e[2]!==r?(m=ie("shrink-0 animate-spin",r),e[2]=r,e[3]=m):m=e[3];let l;e[4]!==c||e[5]!==m?(l=t.jsx(Re,{size:c,className:m}),e[4]=c,e[5]=m,e[6]=l):l=e[6];let p;e[7]!==a?(p=ie("text-sm",a),e[7]=a,e[8]=p):p=e[8];let f;e[9]!==s||e[10]!==p?(f=t.jsx("span",{className:p,children:s}),e[9]=s,e[10]=p,e[11]=f):f=e[11];let x;return e[12]!==d||e[13]!==l||e[14]!==f?(x=t.jsxs("span",{className:d,children:[l,f]}),e[12]=d,e[13]=l,e[14]=f,e[15]=x):x=e[15],x}const Us=_e({propertyId:ce().min(1,"Selecione uma propriedade")});function $s(n){const e=F.c(68),{card:s,connectionId:o,companionClient:i,selfClient:r,org:a,onDone:c,onDisconnect:d,onIsPendingChange:m}=n;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 D=await i.callTool({name:"get-account-summaries",arguments:{}}),V=se(D);return ks(V)},e[3]=i,e[4]=p):p=e[4];let f;e[5]!==l||e[6]!==p?(f={queryKey:l,queryFn:p},e[5]=l,e[6]=p,e[7]=f):f=e[7];const x=ge(f);let y;e[8]===Symbol.for("react.memo_cache_sentinel")?(y=Se(Us),e[8]=y):y=e[8];const C=s.configurationState?.propertyId||"";let h;e[9]!==C?(h={resolver:y,defaultValues:{propertyId:C}},e[9]=C,e[10]=h):h=e[10];const g=Ne(h);let u;e[11]!==s||e[12]!==c||e[13]!==a||e[14]!==r?(u={card:s,selfClient:r,org:a,onDone:c},e[11]=s,e[12]=c,e[13]=a,e[14]=r,e[15]=u):u=e[15];const{save:v,isPending:b,error:_}=Qe(u);let w,S;e[16]!==b||e[17]!==m?(w=()=>{m?.(b)},S=[b,m],e[16]=b,e[17]=m,e[18]=w,e[19]=S):(w=e[18],S=e[19]),K.useEffect(w,S);let j;if(e[20]!==g||e[21]!==v){let D;e[23]!==v?(D=async V=>{v(V)},e[23]=v,e[24]=D):D=e[24],j=g.handleSubmit(D),e[20]=g,e[21]=v,e[22]=j}else j=e[22];const E=j;if(x.isLoading){let D;return e[25]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:t.jsx(Pe,{label:"Carregando propriedades..."})}),e[25]=D):D=e[25],D}if(x.isError){let D;return e[26]===Symbol.for("react.memo_cache_sentinel")?(D=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]=D):D=e[26],D}let O;e[27]!==x.data?(O=x.data||[],e[27]=x.data,e[28]=O):O=e[28];const R=O;if(R.flatMap(Ms).length===0){let D;e[29]===Symbol.for("react.memo_cache_sentinel")?(D=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]=D):D=e[29];let V;e[30]!==d?(V=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]=V):V=e[31];let G;e[32]!==c?(G=t.jsx(B,{type:"button",variant:"outline",onClick:c,children:"Fechar"}),e[32]=c,e[33]=G):G=e[33];let J;return e[34]!==V||e[35]!==G?(J=t.jsxs("div",{className:"space-y-4",children:[D,t.jsxs(he,{className:"flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[V,G]})]}),e[34]=V,e[35]=G,e[36]=J):J=e[36],J}let k;e[37]!==b||e[38]!==R?(k=D=>{const{field:V}=D;return t.jsxs(ue,{children:[t.jsx(me,{children:t.jsx(Ge,{options:R.flatMap(Ds),value:V.value,onChange:V.onChange,disabled:b,ariaLabel:"Propriedade do Google Analytics"})}),t.jsx(fe,{})]})},e[37]=b,e[38]=R,e[39]=k):k=e[39];let P;e[40]!==g.control||e[41]!==k?(P=t.jsx(de,{control:g.control,name:"propertyId",render:k}),e[40]=g.control,e[41]=k,e[42]=P):P=e[42];let L;e[43]!==g||e[44]!==P?(L=t.jsx(Ee,{...g,children:P}),e[43]=g,e[44]=P,e[45]=L):L=e[45];let M;e[46]!==_?(M=_&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:_ instanceof Error?_.message:"Não foi possível salvar a configuração"}),e[46]=_,e[47]=M):M=e[47];let U;e[48]!==b||e[49]!==d?(U=d?t.jsx("button",{type:"button",onClick:d,disabled:b,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive disabled:opacity-50",children:"Desconectar conta"}):t.jsx("span",{}),e[48]=b,e[49]=d,e[50]=U):U=e[50];let T;e[51]!==b||e[52]!==c?(T=t.jsx(B,{type:"button",variant:"outline",onClick:c,disabled:b,children:"Cancelar"}),e[51]=b,e[52]=c,e[53]=T):T=e[53];const I=b?"Salvando...":"Salvar";let $;e[54]!==b||e[55]!==I?($=t.jsx(B,{type:"submit",disabled:b,children:I}),e[54]=b,e[55]=I,e[56]=$):$=e[56];let A;e[57]!==T||e[58]!==$?(A=t.jsxs("div",{className:"flex gap-2",children:[T,$]}),e[57]=T,e[58]=$,e[59]=A):A=e[59];let q;e[60]!==U||e[61]!==A?(q=t.jsxs(he,{className:"flex-col gap-2 pt-4 sm:flex-row sm:items-center sm:justify-between",children:[U,A]}),e[60]=U,e[61]=A,e[62]=q):q=e[62];let H;return e[63]!==E||e[64]!==L||e[65]!==M||e[66]!==q?(H=t.jsxs("form",{onSubmit:E,className:"space-y-4",children:[L,M,q]}),e[63]=E,e[64]=L,e[65]=M,e[66]=q,e[67]=H):H=e[67],H}function Ds(n){return n.options}function Ms(n){return n.options}const qs=_e({siteUrl:ce().min(1,"Selecione um site")});function Fs(n){const e=F.c(59),{card:s,connectionId:o,companionClient:i,selfClient:r,org:a,contextSiteUrl:c,onDone:d,onIsPendingChange:m}=n;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 A=await i.callTool({name:"list_sites",arguments:{}});return se(A).sites||[]},e[3]=i,e[4]=p):p=e[4];let f;e[5]!==l||e[6]!==p?(f={queryKey:l,queryFn:p},e[5]=l,e[6]=p,e[7]=f):f=e[7];const x=ge(f);let y;e[8]===Symbol.for("react.memo_cache_sentinel")?(y=Se(qs),e[8]=y):y=e[8];const C=s.configurationState?.siteUrl||"";let h;e[9]!==C?(h={resolver:y,defaultValues:{siteUrl:C}},e[9]=C,e[10]=h):h=e[10];const g=Ne(h);let u;e[11]!==s||e[12]!==d||e[13]!==a||e[14]!==r?(u={card:s,selfClient:r,org:a,onDone:d},e[11]=s,e[12]=d,e[13]=a,e[14]=r,e[15]=u):u=e[15];const{save:v,isPending:b,error:_}=Qe(u);let w,S;e[16]!==b||e[17]!==m?(w=()=>{m?.(b)},S=[b,m],e[16]=b,e[17]=m,e[18]=w,e[19]=S):(w=e[18],S=e[19]),K.useEffect(w,S);let j;if(e[20]!==g||e[21]!==v){let A;e[23]!==v?(A=async q=>{v(q)},e[23]=v,e[24]=A):A=e[24],j=g.handleSubmit(A),e[20]=g,e[21]=v,e[22]=j}else j=e[22];const E=j;if(x.isLoading){let A;return e[25]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:t.jsx(Pe,{label:"Carregando sites..."})}),e[25]=A):A=e[25],A}if(x.isError){let A;return e[26]===Symbol.for("react.memo_cache_sentinel")?(A=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]=A):A=e[26],A}let O,R;if(e[27]!==s.configurationState?.siteUrl||e[28]!==c||e[29]!==g||e[30]!==x.data){R=Symbol.for("react.early_return_sentinel");e:{if(O=x.data||[],O.length===0){let q;e[33]===Symbol.for("react.memo_cache_sentinel")?(q=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]=q):q=e[33],R=q;break e}const A=s.configurationState?.siteUrl;if(A&&g.getValues("siteUrl")!==A)g.setValue("siteUrl",A);else if(!A&&!g.getValues("siteUrl")){const q=As(c,O);q&&g.setValue("siteUrl",q)}}e[27]=s.configurationState?.siteUrl,e[28]=c,e[29]=g,e[30]=x.data,e[31]=O,e[32]=R}else O=e[31],R=e[32];if(R!==Symbol.for("react.early_return_sentinel"))return R;let N;e[34]!==b||e[35]!==O?(N=A=>{const{field:q}=A;return t.jsxs(ue,{children:[t.jsx(me,{children:t.jsx(Ge,{options:O.map(Ks),value:q.value,onChange:q.onChange,disabled:b,ariaLabel:"Site verificado"})}),t.jsx(fe,{})]})},e[34]=b,e[35]=O,e[36]=N):N=e[36];let k;e[37]!==g.control||e[38]!==N?(k=t.jsx(de,{control:g.control,name:"siteUrl",render:N}),e[37]=g.control,e[38]=N,e[39]=k):k=e[39];let P;e[40]!==g||e[41]!==k?(P=t.jsx(Ee,{...g,children:k}),e[40]=g,e[41]=k,e[42]=P):P=e[42];let L;e[43]!==_?(L=_&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:_ instanceof Error?_.message:"Não foi possível salvar a configuração"}),e[43]=_,e[44]=L):L=e[44];let M;e[45]!==b||e[46]!==d?(M=t.jsx(B,{type:"button",variant:"outline",onClick:d,disabled:b,children:"Cancelar"}),e[45]=b,e[46]=d,e[47]=M):M=e[47];const U=b?"Salvando...":"Salvar";let T;e[48]!==b||e[49]!==U?(T=t.jsx(B,{type:"submit",disabled:b,children:U}),e[48]=b,e[49]=U,e[50]=T):T=e[50];let I;e[51]!==M||e[52]!==T?(I=t.jsxs(he,{className:"pt-4",children:[M,T]}),e[51]=M,e[52]=T,e[53]=I):I=e[53];let $;return e[54]!==E||e[55]!==P||e[56]!==L||e[57]!==I?($=t.jsxs("form",{onSubmit:E,className:"space-y-4",children:[P,L,I]}),e[54]=E,e[55]=P,e[56]=L,e[57]=I,e[58]=$):$=e[58],$}function Ks(n){return{value:n.siteUrl,label:n.siteUrl}}const Vs=_e({githubRepo:ce().min(1,"Selecione um repositório")}),Hs=15e3,Qs=/^[\w.-]+\/[\w.-]+$/;async function Gs(n,e,s,o){const{installations:i}=await os(n,s),r=o.trim(),a=await Promise.allSettled(i.map(async l=>{const p=l.type==="User"?"user":"org",f=r?`${p}:${l.login} ${r} in:name`:`${p}:${l.login}`,y=await e.callTool({name:"search_repositories",arguments:{query:f,page:1,perPage:50}},void 0,{signal:AbortSignal.timeout(Hs)}),C=y.content?.[0]?.text;if(y.isError)throw new Error(C??"search_repositories failed");if(!C)throw new Error("empty search_repositories response");return JSON.parse(C).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 Bs(n){const e=F.c(80),{connectionId:s,companionClient:o,selfClient:i,org:r,onDone:a,onIsPendingChange:c}=n,d=ye();let m;e[0]!==r.id?(m=Me.COMMERCE_DISCOVERY(r.id),e[0]=r.id,e[1]=m):m=e[1];const l=m,[p,f]=K.useState(""),x=cs(p,300);let y;e[2]!==s||e[3]!==r.id?(y=Y.commerceDiscoveryCompanionGithubSelected(r.id,s),e[2]=s,e[3]=r.id,e[4]=y):y=e[4];let C;e[5]!==l||e[6]!==i?(C=async()=>{const W=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:l}}),te=se(W).item?.configuration_state??null;return typeof te?.github_repo=="string"?te.github_repo:""},e[5]=l,e[6]=i,e[7]=C):C=e[7];let h;e[8]!==y||e[9]!==C?(h={queryKey:y,queryFn:C},e[8]=y,e[9]=C,e[10]=h):h=e[10];const g=ge(h);let u;e[11]!==s||e[12]!==x||e[13]!==r.id?(u=Y.commerceDiscoveryCompanionGithubRepos(r.id,s,x.trim()),e[11]=s,e[12]=x,e[13]=r.id,e[14]=u):u=e[14];let v;e[15]!==o||e[16]!==s||e[17]!==x||e[18]!==i?(v=()=>Gs(W=>i.callTool(W),o,s,x),e[15]=o,e[16]=s,e[17]=x,e[18]=i,e[19]=v):v=e[19];let b;e[20]!==u||e[21]!==v?(b={queryKey:u,queryFn:v},e[20]=u,e[21]=v,e[22]=b):b=e[22];const _=ge(b);let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w={resolver:Se(Vs),defaultValues:{githubRepo:""}},e[23]=w):w=e[23];const S=Ne(w);let j;e[24]!==l||e[25]!==i?(j=async W=>{const te=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:l}}),At={...se(te).item?.configuration_state??null??{},github_repo:W};await i.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:l,data:{configuration_state:At}}})},e[24]=l,e[25]=i,e[26]=j):j=e[26];let E;e[27]!==l||e[28]!==a||e[29]!==r.id||e[30]!==d?(E=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]=E):E=e[31];let O;e[32]!==E||e[33]!==j?(O={mutationFn:j,onSuccess:E},e[32]=E,e[33]=j,e[34]=O):O=e[34];const R=pe(O),N=R.isPending;let k,P;e[35]!==N||e[36]!==c?(k=()=>{c?.(N)},P=[N,c],e[35]=N,e[36]=c,e[37]=k,e[38]=P):(k=e[37],P=e[38]),K.useEffect(k,P);let L;if(e[39]!==S||e[40]!==R){let W;e[42]!==R?(W=async te=>{R.mutate(te.githubRepo)},e[42]=R,e[43]=W):W=e[43],L=S.handleSubmit(W),e[39]=S,e[40]=R,e[41]=L}else L=e[41];const M=L,U=g.data??"";U&&S.getValues("githubRepo")!==U&&S.setValue("githubRepo",U);let T,I,$;if(e[44]!==x||e[45]!==_.data?.failed||e[46]!==_.data?.repos||e[47]!==_.data?.total||e[48]!==U){const W=_.data?.repos??[];T=_.data?.failed??0,$=_.data?.total??0;const te=x.trim();I=[...W],te&&Qs.test(te)&&!I.includes(te)&&I.unshift(te),U&&!I.includes(U)&&I.push(U),e[44]=x,e[45]=_.data?.failed,e[46]=_.data?.repos,e[47]=_.data?.total,e[48]=U,e[49]=T,e[50]=I,e[51]=$}else T=e[49],I=e[50],$=e[51];const A=$>0&&T===$,q=_.isError||A?"Não foi possível buscar os repositórios (erro ou tempo esgotado). Tente novamente ou digite o repositório no formato owner/nome.":T>0?"Parte da busca falhou — alguns repositórios podem não ter aparecido. Tente novamente ou digite owner/nome.":null;let H;e[52]===Symbol.for("react.memo_cache_sentinel")?(H=t.jsx(jt,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),e[52]=H):H=e[52];let D;e[53]===Symbol.for("react.memo_cache_sentinel")?(D=W=>f(W.target.value),e[53]=D):D=e[53];let V;e[54]!==N||e[55]!==p?(V=t.jsxs("div",{className:"relative",children:[H,t.jsx(be,{type:"text",value:p,onChange:D,disabled:N,placeholder:"Buscar repositório","aria-label":"Buscar repositório",className:"h-8 pl-8"})]}),e[54]=N,e[55]=p,e[56]=V):V=e[56];let G;e[57]!==S||e[58]!==N||e[59]!==I||e[60]!==_.isLoading||e[61]!==q?(G=_.isLoading?t.jsx("div",{className:"flex min-h-[160px] items-center justify-center",children:t.jsx(Pe,{label:"Carregando repositórios..."})}):t.jsxs(t.Fragment,{children:[q&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:q}),I.length===0?!q&&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,{...S,children:t.jsx(de,{control:S.control,name:"githubRepo",render:W=>{const{field:te}=W;return t.jsxs(ue,{children:[t.jsx(me,{children:t.jsx(Ge,{options:I.map(Ws),value:te.value,onChange:te.onChange,disabled:N,ariaLabel:"Repositório",hideSearch:!0})}),t.jsx(fe,{})]})}})})]}),e[57]=S,e[58]=N,e[59]=I,e[60]=_.isLoading,e[61]=q,e[62]=G):G=e[62];let J;e[63]!==R.error?(J=R.error&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:R.error instanceof Error?R.error.message:"Não foi possível salvar a configuração"}),e[63]=R.error,e[64]=J):J=e[64];let Z;e[65]!==N||e[66]!==a?(Z=t.jsx(B,{type:"button",variant:"outline",onClick:a,disabled:N,children:"Cancelar"}),e[65]=N,e[66]=a,e[67]=Z):Z=e[67];const oe=N?"Salvando...":"Salvar";let Q;e[68]!==N||e[69]!==oe?(Q=t.jsx(B,{type:"submit",disabled:N,children:oe}),e[68]=N,e[69]=oe,e[70]=Q):Q=e[70];let z;e[71]!==Z||e[72]!==Q?(z=t.jsxs(he,{className:"pt-4",children:[Z,Q]}),e[71]=Z,e[72]=Q,e[73]=z):z=e[73];let ee;return e[74]!==M||e[75]!==V||e[76]!==G||e[77]!==J||e[78]!==z?(ee=t.jsxs("form",{onSubmit:M,className:"space-y-4",children:[V,G,J,z]}),e[74]=M,e[75]=V,e[76]=G,e[77]=J,e[78]=z,e[79]=ee):ee=e[79],ee}function Ws(n){return{value:n,label:n}}const Ys={vtex:Ps,"google-analytics":$s,"google-search-console":Fs,github:Bs},xe="deco-reader@decocms.iam.gserviceaccount.com",Et={"google-analytics":"ga4","google-search-console":"gsc"},wt={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 Js(n,e){const s=wt[n].label;switch(e){case"no-access":return{title:`Ainda não conseguimos acessar este recurso no ${s}.`,steps:n==="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:n==="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 Xs(n){const e=F.c(76),{provider:s,siteUrl:o,selfClient:i,org:r,initialResourceId:a,onDone:c,onIsPendingChange:d,onOAuthInstead:m}=n,l=wt[s],p=ye(),[f,x]=K.useState(null);let y,C;if(e[0]!==l.resourceLabel){const Q=_e({resourceId:ce().trim().min(1,`Informe o ${l.resourceLabel.toLowerCase()}`)});C=Ne,y=Se(Q),e[0]=l.resourceLabel,e[1]=y,e[2]=C}else y=e[1],C=e[2];const h=a??"";let g;e[3]!==h?(g={resourceId:h},e[3]=h,e[4]=g):g=e[4];let u;e[5]!==y||e[6]!==g?(u={resolver:y,defaultValues:g},e[5]=y,e[6]=g,e[7]=u):u=e[7];const v=C(u);let b;e[8]!==s||e[9]!==i||e[10]!==o?(b=async Q=>{if(!o)throw new Error("URL da loja indisponível — recarregue a página.");const z=await i.callTool({name:"COMMERCE_DISCOVERY_BIND",arguments:{siteUrl:o,provider:s,resourceId:Q.resourceId}});return se(z)},e[8]=s,e[9]=i,e[10]=o,e[11]=b):b=e[11];let _,w;e[12]!==d?(_=()=>d?.(!0),w=()=>d?.(!1),e[12]=d,e[13]=_,e[14]=w):(_=e[13],w=e[14]);let S;e[15]!==l.label||e[16]!==c||e[17]!==r||e[18]!==s||e[19]!==p||e[20]!==o?(S=async Q=>{if(Q.ok){x(null),Ae.success(`${l.label} conectado`),o&&await p.invalidateQueries({queryKey:Y.commerceDiscoveryConnectionStatus(r.id,o)}),c();return}x({...Js(s,Q.reason??"unknown"),detail:Q.detail})},e[15]=l.label,e[16]=c,e[17]=r,e[18]=s,e[19]=p,e[20]=o,e[21]=S):S=e[21];let j;e[22]!==b||e[23]!==_||e[24]!==w||e[25]!==S?(j={mutationFn:b,onMutate:_,onSettled:w,onSuccess:S},e[22]=b,e[23]=_,e[24]=w,e[25]=S,e[26]=j):j=e[26];const E=pe(j);let O;if(e[27]!==v||e[28]!==E){let Q;e[30]!==E?(Q=z=>E.mutate(z),e[30]=E,e[31]=Q):Q=e[31],O=v.handleSubmit(Q),e[27]=v,e[28]=E,e[29]=O}else O=e[29];const R=O,N=E.isPending,k=tn;let P;e[32]!==l.connectSteps?(P=l.connectSteps.map(en),e[32]=l.connectSteps,e[33]=P):P=e[33];let L;e[34]!==P?(L=t.jsx("ol",{className:"space-y-2 text-sm text-muted-foreground",children:P}),e[34]=P,e[35]=L):L=e[35];let M;e[36]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsx("code",{className:"min-w-0 flex-1 truncate text-xs text-foreground",children:xe}),e[36]=M):M=e[36];let U;e[37]===Symbol.for("react.memo_cache_sentinel")?(U=t.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/40 p-2",children:[M,t.jsx(B,{type:"button",variant:"ghost",size:"icon-sm",onClick:k,"aria-label":"Copiar e-mail do service account",children:t.jsx(St,{size:16})})]}),e[37]=U):U=e[37];let T;e[38]!==l.resourceHint||e[39]!==l.resourceLabel||e[40]!==l.resourcePlaceholder||e[41]!==N?(T=Q=>{const{field:z}=Q;return t.jsxs(ue,{children:[t.jsx(Oe,{children:l.resourceLabel}),t.jsx(me,{children:t.jsx(be,{...z,placeholder:l.resourcePlaceholder,disabled:N,autoComplete:"off"})}),t.jsx(is,{children:l.resourceHint}),t.jsx(fe,{})]})},e[38]=l.resourceHint,e[39]=l.resourceLabel,e[40]=l.resourcePlaceholder,e[41]=N,e[42]=T):T=e[42];let I;e[43]!==v.control||e[44]!==T?(I=t.jsx(de,{control:v.control,name:"resourceId",render:T}),e[43]=v.control,e[44]=T,e[45]=I):I=e[45];let $;e[46]!==v||e[47]!==I?($=t.jsx(Ee,{...v,children:I}),e[46]=v,e[47]=I,e[48]=$):$=e[48];let A;e[49]!==f?(A=f&&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:f.title}),t.jsx("ol",{className:"space-y-1 text-sm text-muted-foreground",children:f.steps.map(Zs)})]}),e[49]=f,e[50]=A):A=e[50];let q;e[51]!==E.error||e[52]!==E.isError?(q=E.isError&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:E.error instanceof Error?E.error.message:"Não foi possível vincular."}),e[51]=E.error,e[52]=E.isError,e[53]=q):q=e[53];let H;e[54]!==N||e[55]!==m?(H=m?t.jsx("button",{type:"button",onClick:m,disabled:N,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground disabled:opacity-50",children:"autorizar via login do Google"}):t.jsx("span",{}),e[54]=N,e[55]=m,e[56]=H):H=e[56];let D;e[57]!==N||e[58]!==c?(D=t.jsx(B,{type:"button",variant:"outline",onClick:c,disabled:N,children:"Cancelar"}),e[57]=N,e[58]=c,e[59]=D):D=e[59];const V=N?"Verificando...":"Vincular";let G;e[60]!==N||e[61]!==V?(G=t.jsx(B,{type:"submit",disabled:N,children:V}),e[60]=N,e[61]=V,e[62]=G):G=e[62];let J;e[63]!==D||e[64]!==G?(J=t.jsxs("div",{className:"flex gap-2",children:[D,G]}),e[63]=D,e[64]=G,e[65]=J):J=e[65];let Z;e[66]!==H||e[67]!==J?(Z=t.jsxs(he,{className:"flex-col gap-2 pt-2 sm:flex-row sm:items-center sm:justify-between",children:[H,J]}),e[66]=H,e[67]=J,e[68]=Z):Z=e[68];let oe;return e[69]!==R||e[70]!==L||e[71]!==$||e[72]!==A||e[73]!==q||e[74]!==Z?(oe=t.jsxs("form",{onSubmit:R,className:"space-y-4",children:[L,U,$,A,q,Z]}),e[69]=R,e[70]=L,e[71]=$,e[72]=A,e[73]=q,e[74]=Z,e[75]=oe):oe=e[75],oe}function Zs(n){return t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{"aria-hidden":!0,children:"•"}),t.jsx("span",{children:n})]},n)}function en(n,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:n})]},n)}function tn(){navigator.clipboard?.writeText(xe),Ae.success("E-mail copiado")}function sn(){const n=F.c(2);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"size-9 shrink-0 animate-pulse rounded-lg bg-muted/60"}),n[0]=e):e=n[0];let s;return n[1]===Symbol.for("react.memo_cache_sentinel")?(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:[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"})]}),n[1]=s):s=n[1],s}const rt="rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground";function nn(n){const e=F.c(39),{card:s,connecting:o,disconnecting:i,disabled:r,onConnect:a,onDisconnect:c,org:d,selfClient:m,siteUrl:l,autoOpenConfigFieldKey:p,onAutoOpenConfigHandled:f}=n,x=s.linkedConnectionId,y=Et[s.bindingType],C=!!y&&s.boundVia!=="oauth";let h;e[0]!==p||e[1]!==s||e[2]!==o||e[3]!==r||e[4]!==i||e[5]!==x||e[6]!==f||e[7]!==a||e[8]!==c||e[9]!==d||e[10]!==y||e[11]!==m||e[12]!==l||e[13]!==C?(h=C&&y?t.jsx(on,{card:s,provider:y,org:d,selfClient:m,siteUrl:l,onOAuthInstead:a,disabled:r,connecting:o}):s.satisfied&&x?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(He,{size:16,className:"text-success"})," Conectado"]}),t.jsx(K.Suspense,{fallback:t.jsx(rn,{}),children:t.jsx(an,{card:s,org:d,selfClient:m,connectionId:x,contextSiteUrl:l,autoOpen:ws({autoOpenFieldKey:p,card:s}),onAutoOpenHandled:f})}),t.jsxs(Fe,{children:[t.jsx(Ke,{asChild:!0,children:t.jsx(B,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:r||i,onClick:c,"aria-label":`Desconectar ${s.title}`,children:i?t.jsx(Re,{size:16,className:"animate-spin"}):t.jsx(Zt,{size:16})})}),t.jsx(Ve,{children:"Desconectar"})]})]}):t.jsx(B,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:r||o,onClick:a,"aria-label":`Conectar ${s.title}`,children:o?t.jsx(Re,{size:16,className:"animate-spin"}):"Conectar"}),e[0]=p,e[1]=s,e[2]=o,e[3]=r,e[4]=i,e[5]=x,e[6]=f,e[7]=a,e[8]=c,e[9]=d,e[10]=y,e[11]=m,e[12]=l,e[13]=C,e[14]=h):h=e[14];const g=h;let u;e[15]!==s.icon||e[16]!==s.title?(u=t.jsx(qe,{icon:s.icon,name:s.title,size:"sm",fit:"contain",className:"shrink-0 p-1.5"}),e[15]=s.icon,e[16]=s.title,e[17]=u):u=e[17];let v;e[18]!==s.area?(v=s.area&&t.jsx("span",{className:ie("hidden sm:inline-block",rt),children:s.area}),e[18]=s.area,e[19]=v):v=e[19];let b;e[20]!==u||e[21]!==v?(b=t.jsxs("div",{className:"shrink-0 self-start sm:flex sm:w-full sm:items-center sm:justify-between sm:gap-2",children:[u,v]}),e[20]=u,e[21]=v,e[22]=b):b=e[22];let _;e[23]!==s.area?(_=s.area&&t.jsx("span",{className:ie("mb-1 inline-block sm:hidden",rt),children:s.area}),e[23]=s.area,e[24]=_):_=e[24];let w;e[25]!==s.title?(w=t.jsx("p",{className:"text-sm font-medium text-foreground",children:s.title}),e[25]=s.title,e[26]=w):w=e[26];let S;e[27]!==s.headline?(S=s.headline&&t.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm leading-5 text-muted-foreground",children:s.headline}),e[27]=s.headline,e[28]=S):S=e[28];let j;e[29]!==_||e[30]!==w||e[31]!==S?(j=t.jsxs("div",{className:"min-w-0 flex-1",children:[_,w,S]}),e[29]=_,e[30]=w,e[31]=S,e[32]=j):j=e[32];let E;e[33]!==g?(E=t.jsx("div",{className:"shrink-0 sm:mt-auto sm:w-full sm:pt-1",children:g}),e[33]=g,e[34]=E):E=e[34];let O;return e[35]!==b||e[36]!==j||e[37]!==E?(O=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:[b,j,E]}),e[35]=b,e[36]=j,e[37]=E,e[38]=O):O=e[38],O}function on(n){const e=F.c(39),{card:s,provider:o,org:i,selfClient:r,siteUrl:a,onOAuthInstead:c,disabled:d,connecting:m}=n,[l,p]=K.useState(!1),[f,x]=K.useState(!1);let y;e[0]!==f?(y=k=>{!k&&f||p(k)},e[0]=f,e[1]=y):y=e[1];const C=y;let h;e[2]!==s.satisfied||e[3]!==s.title||e[4]!==m||e[5]!==d?(h=s.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(He,{size:16,className:"text-success"})," Conectado"]}),t.jsxs(Fe,{children:[t.jsx(Ke,{asChild:!0,children:t.jsx(B,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:()=>p(!0),"aria-label":`Configurar ${s.title}`,children:t.jsx(_t,{size:16})})}),t.jsx(Ve,{children:"Editar configuração"})]})]}):t.jsx(B,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:d||m,onClick:()=>p(!0),"aria-label":`Conectar ${s.title}`,children:m?t.jsx(Re,{size:16,className:"animate-spin"}):"Conectar"}),e[2]=s.satisfied,e[3]=s.title,e[4]=m,e[5]=d,e[6]=h):h=e[6];let g;e[7]!==s.icon||e[8]!==s.title?(g=t.jsx(qe,{icon:s.icon,name:s.title,size:"md",fit:"contain",className:"p-1.5"}),e[7]=s.icon,e[8]=s.title,e[9]=g):g=e[9];let u;e[10]!==s.title?(u=t.jsx(xt,{children:s.title}),e[10]=s.title,e[11]=u):u=e[11];let v;e[12]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(yt,{children:"Conceda acesso ao nosso leitor e informe o identificador"}),e[12]=v):v=e[12];let b;e[13]!==u?(b=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[u,v]}),e[13]=u,e[14]=b):b=e[14];let _;e[15]!==g||e[16]!==b?(_=t.jsxs(bt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[g,b]}),e[15]=g,e[16]=b,e[17]=_):_=e[17];const w=s.boundResource??void 0;let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=()=>p(!1),e[18]=S):S=e[18];let j;e[19]!==s.satisfied||e[20]!==c?(j=s.satisfied?void 0:()=>{p(!1),c()},e[19]=s.satisfied,e[20]=c,e[21]=j):j=e[21];let E;e[22]!==i||e[23]!==o||e[24]!==r||e[25]!==a||e[26]!==j||e[27]!==w?(E=t.jsx(Xs,{provider:o,siteUrl:a,selfClient:r,org:i,initialResourceId:w,onDone:S,onIsPendingChange:x,onOAuthInstead:j}),e[22]=i,e[23]=o,e[24]=r,e[25]=a,e[26]=j,e[27]=w,e[28]=E):E=e[28];let O;e[29]!==E||e[30]!==_?(O=t.jsxs(vt,{className:"sm:max-w-lg",children:[_,E]}),e[29]=E,e[30]=_,e[31]=O):O=e[31];let R;e[32]!==C||e[33]!==l||e[34]!==O?(R=t.jsx(Ct,{open:l,onOpenChange:C,children:O}),e[32]=C,e[33]=l,e[34]=O,e[35]=R):R=e[35];let N;return e[36]!==R||e[37]!==h?(N=t.jsxs(t.Fragment,{children:[h,R]}),e[36]=R,e[37]=h,e[38]=N):N=e[38],N}function rn(){const n=F.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"size-8 shrink-0 animate-pulse rounded-lg bg-muted/60"}),n[0]=e):e=n[0],e}function an(n){const e=F.c(60),{card:s,org:o,selfClient:i,connectionId:r,contextSiteUrl:a,autoOpen:c,onAutoOpenHandled:d}=n;let m;e[0]!==r||e[1]!==o.id||e[2]!==o.slug?(m={connectionId:r,orgId:o.id,orgSlug:o.slug},e[0]=r,e[1]=o.id,e[2]=o.slug,e[3]=m):m=e[3];const l=Le(m),[p,f]=K.useState(c),[x,y]=K.useState(!1),C=ye(),h=Ys[s.bindingType],g=Es(s.configurationState);let u;e[4]!==c||e[5]!==d?(u=()=>{f(!1),c&&d()},e[4]=c,e[5]=d,e[6]=u):u=e[6];const v=u;let b;e[7]!==v||e[8]!==x?(b=V=>{if(!(!V&&x)){if(!V){v();return}f(!0)}},e[7]=v,e[8]=x,e[9]=b):b=e[9];const _=b;let w;e[10]!==r||e[11]!==i?(w=async()=>{await i.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:r,force:!0}})},e[10]=r,e[11]=i,e[12]=w):w=e[12];let S;e[13]!==s.title||e[14]!==v||e[15]!==o.id||e[16]!==C?(S=async()=>{await C.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(o.id)}),Ae.success(`${s.title} desconectado`),v()},e[13]=s.title,e[14]=v,e[15]=o.id,e[16]=C,e[17]=S):S=e[17];let j;e[18]!==w||e[19]!==S?(j={mutationFn:w,onSuccess:S,onError:ln},e[18]=w,e[19]=S,e[20]=j):j=e[20];const E=pe(j);if(!h)return null;let O;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=()=>f(!0),e[21]=O):O=e[21];const R=`Configurar ${s.title}`;let N;e[22]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(_t,{size:16}),e[22]=N):N=e[22];let k;e[23]!==R?(k=t.jsx(Ke,{asChild:!0,children:t.jsx(B,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:O,"aria-label":R,children:N})}),e[23]=R,e[24]=k):k=e[24];const P=g.length>0?"Editar configuração":"Configurar";let L;e[25]!==P?(L=t.jsx(Ve,{children:P}),e[25]=P,e[26]=L):L=e[26];let M;e[27]!==k||e[28]!==L?(M=t.jsxs(Fe,{children:[k,L]}),e[27]=k,e[28]=L,e[29]=M):M=e[29];let U;e[30]!==s.icon||e[31]!==s.title?(U=t.jsx(qe,{icon:s.icon,name:s.title,size:"md",fit:"contain",className:"p-1.5"}),e[30]=s.icon,e[31]=s.title,e[32]=U):U=e[32];let T;e[33]!==s.title?(T=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[t.jsx(xt,{children:s.title}),t.jsxs(yt,{children:["Configure o ",s.title," para enriquecer os dados"]})]}),e[33]=s.title,e[34]=T):T=e[34];let I;e[35]!==U||e[36]!==T?(I=t.jsxs(bt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[U,T]}),e[35]=U,e[36]=T,e[37]=I):I=e[37];let $;e[38]!==E?($=()=>E.mutate(),e[38]=E,e[39]=$):$=e[39];let A;e[40]!==h||e[41]!==s||e[42]!==v||e[43]!==l||e[44]!==r||e[45]!==a||e[46]!==o||e[47]!==i||e[48]!==$?(A=t.jsx(h,{card:s,connectionId:r,companionClient:l,selfClient:i,org:o,contextSiteUrl:a,onDone:v,onDisconnect:$,onIsPendingChange:y}),e[40]=h,e[41]=s,e[42]=v,e[43]=l,e[44]=r,e[45]=a,e[46]=o,e[47]=i,e[48]=$,e[49]=A):A=e[49];let q;e[50]!==I||e[51]!==A?(q=t.jsxs(vt,{className:"sm:max-w-lg",children:[I,A]}),e[50]=I,e[51]=A,e[52]=q):q=e[52];let H;e[53]!==p||e[54]!==_||e[55]!==q?(H=t.jsx(Ct,{open:p,onOpenChange:_,children:q}),e[53]=p,e[54]=_,e[55]=q,e[56]=H):H=e[56];let D;return e[57]!==M||e[58]!==H?(D=t.jsxs(t.Fragment,{children:[M,H]}),e[57]=M,e[58]=H,e[59]=D):D=e[59],D}function ln(){Ae.error("Não foi possível desconectar. Tente novamente.")}const Be={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 cn(n){const e=F.c(40),{selfClient:s,org:o,cdConnectionId:i,siteUrl:r}=n;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=Le(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 m;e[7]!==c?(m=async()=>{const z=await c.callTool({name:"MCP_CONFIGURATION",arguments:{}});return se(z)},e[7]=c,e[8]=m):m=e[8];let l;e[9]!==d||e[10]!==m?(l={queryKey:d,queryFn:m,retry:!1},e[9]=d,e[10]=m,e[11]=l):l=e[11];const p=ge(l),f=p.data?.stateSchema?vs(p.data.stateSchema):null,x=f&&f.length>0?f:Cs,y=x.map(bn),C=x.map(yn).filter(xn),h=x.filter(hn).map(gn),g=[...C,...h].sort().join(",");let u;e[12]!==i||e[13]!==o.id?(u=Y.commerceDiscoveryConnection(o.id,i),e[12]=i,e[13]=o.id,e[14]=u):u=e[14];let v;e[15]!==i||e[16]!==s?(v=async()=>{const z=await s.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:i}});return se(z)},e[15]=i,e[16]=s,e[17]=v):v=e[17];let b;e[18]!==u||e[19]!==v?(b={queryKey:u,queryFn:v},e[18]=u,e[19]=v,e[20]=b):b=e[20];const w=ve(b).data?.item?.configuration_state??null;let S;e[21]!==w?(S=z=>w?.[z.fieldKey]?.value,e[21]=w,e[22]=S):S=e[22];const j=x.map(S).filter(pn),E=[...y.map(fn),...C.map(mn),...j.map(un)].sort().join(","),R=ve({queryKey:Y.commerceDiscoveryCompanionConnections(o.id,E),queryFn:async()=>{if(x.length===0)return{items:[]};const z=[{field:["app_name"],operator:"in",value:y},{field:["app_id"],operator:"in",value:C}];j.length>0&&z.push({field:["id"],operator:"in",value:j});const ee=await s.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:z},limit:1e3}});return se(ee)}}).data?.items??[],N=new Set(j),k=R.filter(z=>N.has(z.id)),P=k.filter(dn);let L;e[23]!==o.id||e[24]!==o.slug?(L=z=>({queryKey:Y.commerceDiscoveryCompanionOAuthStatus(o.id,z.id),queryFn:async()=>{try{const ee=await fetch(`/api/${encodeURIComponent(o.slug)}/connections/${encodeURIComponent(z.id)}/oauth-token/status`,{credentials:"include"});return ee.ok?{hasToken:(await ee.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}},retry:!1}),e[23]=o.id,e[24]=o.slug,e[25]=L):L=e[25];const M=ps({queries:P.map(L)});let U;e[26]!==M?(U=(z,ee)=>[z.id,M[ee]?.data?.hasToken===!0],e[26]=M,e[27]=U):U=e[27];const T=new Map(P.map(U)),I={};for(const z of k)I[z.id]=!z.oauth_config||!!z.connection_token||T.get(z.id)===!0;const $=ve({queryKey:Y.commerceDiscoveryCompanionRegistry(o.id,g),queryFn:async()=>{if(x.length===0)return{items:[]};const z=js(C,h),ee=await ts(Me.REGISTRY(o.id),o.id,o.slug,"COLLECTION_REGISTRY_APP_LIST",{...z?{where:z}:{},limit:1e3});return se(ee)}}),A={},q={};for(const z of $.data?.items??[])A[z.id]=z,z.server?.name&&(q[z.server.name]=z);let H;e[28]!==o.id||e[29]!==r?(H=Y.commerceDiscoveryConnectionStatus(o.id,r??""),e[28]=o.id,e[29]=r,e[30]=H):H=e[30];const D=!!r;let V;e[31]!==s||e[32]!==r?(V=async()=>{const z=await s.callTool({name:"COMMERCE_DISCOVERY_CONNECTION_STATUS",arguments:{siteUrl:r}});return se(z)},e[31]=s,e[32]=r,e[33]=V):V=e[33];let G;e[34]!==H||e[35]!==D||e[36]!==V?(G={queryKey:H,enabled:D,queryFn:V},e[34]=H,e[35]=D,e[36]=V,e[37]=G):G=e[37];const J=ge(G),Z={};for(const[z,ee]of Object.entries(Et)){const W=J.data?.providers?.[ee];W?.connected&&W.via==="sa"&&(Z[z]={resource:W.resource??null})}const oe=Rs({requirements:x,itemsById:A,itemsByName:q,connections:R,connectionReadiness:I,configurationState:w,curated:Be,saBindings:Z});let Q;return e[38]!==oe?(Q={cards:oe},e[38]=oe,e[39]=Q):Q=e[39],Q}function dn(n){return n.oauth_config&&!n.connection_token}function un(n){return`linked:${n}`}function mn(n){return`app:${n}`}function fn(n){return`binding:${n}`}function pn(n){return typeof n=="string"&&n.length>0}function gn(n){return n.bindingType}function hn(n){return!Be[n.bindingType]}function xn(n){return!!n}function yn(n){return Be[n.bindingType]?.registryAppId}function bn(n){return n.bindingType}function vn({selfClient:n,org:e,userId:s,cdConnectionId:o,domain:i,siteUrl:r}){const a=ye(),[c,d]=K.useState(null),[m,l]=K.useState(null),[p,f]=K.useState(null),x=async(h,g)=>{const u=await n.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:h,data:g}});return se(u)};async function y(h){d(h.fieldKey),f(null);const g={app_name:h.title,field_key:h.fieldKey,organization_id:e.id,domain:i,site_url:r};X("commerce_onboarding_companion_connect_clicked",g);try{let u=h.candidateConnectionId;if(!u){const j=ss(h.registryItem,e.id,s,{remoteIndex:0}),E=j.connection_type==="STDIO",O=!!j.connection_url,R=E&&j.connection_headers&&typeof j.connection_headers=="object"&&"command"in j.connection_headers;if(!O&&!R)return X("commerce_onboarding_companion_connect_failed",{...g,error:"no_connection_method"}),f(`${h.title} cannot be connected: no connection method available`),!1;const N=await n.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:j}});u=se(N).item.id}const v=u,b=await ds({connectionId:v,orgId:e.id,orgSlug:e.slug,persistFallback:j=>x(v,{connection_token:j}).then(()=>{})});if(!b.ok)return X("commerce_onboarding_companion_connect_failed",{...g,error:b.error}),f(`Couldn't sign in to ${h.title}: ${b.error}`),!1;const _=await n.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}}),w=se(_).item?.configuration_state??null,S=_s(w,h.fieldKey,h.bindingType,v);return h.bindingType==="github"&&delete S.github_repo,await x(o,{configuration_state:S}),await a.invalidateQueries({queryKey:Y.commerceDiscoveryConnection(e.id,o)}),await a.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),X("commerce_onboarding_companion_connected",g),!0}catch(u){return X("commerce_onboarding_companion_connect_failed",{...g,error:u instanceof Error?u.message:String(u)}),f(u instanceof Error?u.message:String(u)),!1}finally{d(null)}}async function C(h){l(h.fieldKey),f(null);const g={app_name:h.title,field_key:h.fieldKey,organization_id:e.id,domain:i,site_url:r};X("commerce_onboarding_companion_disconnect_clicked",g);try{const u=await n.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}}),b={...se(u).item?.configuration_state??null??{}};return delete b[h.fieldKey],h.bindingType==="github"&&delete b.github_repo,await x(o,{configuration_state:b}),await a.invalidateQueries({queryKey:Y.commerceDiscoveryConnection(e.id,o)}),await a.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),X("commerce_onboarding_companion_disconnected",g),!0}catch(u){return X("commerce_onboarding_companion_disconnect_failed",{...g,error:u instanceof Error?u.message:String(u)}),f(u instanceof Error?u.message:String(u)),!1}finally{l(null)}}return{connect:y,connectingFieldKey:c,disconnect:C,disconnectingFieldKey:m,error:p}}const We="flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none md:gap-4";function Ye(){const n=F.c(1);let e;return n[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"}),n[0]=e):e=n[0],e}function Cn(){const n=F.c(1);let e;return n[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(jn)}),n[0]=e):e=n[0],e}function jn(n){return t.jsx(sn,{},n)}function Je(){const n=F.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:We,children:[t.jsx(Ye,{}),t.jsx(Cn,{})]}),n[0]=e):e=n[0],e}function _n(n){const e=F.c(5),{onRetry:s}=n;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(Ye,{}),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]!==s?(a=t.jsxs("div",{className:We,children:[o,t.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[i,r,t.jsx(B,{type:"button",variant:"outline",size:"sm",className:"mt-3",onClick:s,children:"Tentar novamente"})]})]}),e[3]=s,e[4]=a):a=e[4],a}function Sn(n){const e=F.c(2);let s;return e[0]!==n?(s=t.jsx(dt,{children:o=>{const{reset:i}=o;return t.jsx(ut,{fallback:r=>{const{resetError:a}=r;return t.jsx(_n,{onRetry:()=>{i(),a()}})},children:t.jsx(K.Suspense,{fallback:t.jsx(Je,{}),children:t.jsx(Nn,{...n})})})}}),e[0]=n,e[1]=s):s=e[1],s}function Nn(n){const e=F.c(46),{org:s,cdConnectionId:o,siteUrl:i,onReadinessChange:r}=n,{data:a}=ke.useSession(),c=a?.user?.id??"";let d;if(e[0]!==i){const R=i?ae(i):null;if(R?.ok)try{d=new URL(R.value).hostname}catch{d=void 0}e[0]=i,e[1]=d}else d=e[1];let m;e[2]!==s.id||e[3]!==s.slug?(m={connectionId:gt,orgId:s.id,orgSlug:s.slug},e[2]=s.id,e[3]=s.slug,e[4]=m):m=e[4];const l=Le(m);let p;e[5]!==o||e[6]!==s||e[7]!==l||e[8]!==i?(p={selfClient:l,org:s,cdConnectionId:o,siteUrl:i},e[5]=o,e[6]=s,e[7]=l,e[8]=i,e[9]=p):p=e[9];const{cards:f}=cn(p);let x;e[10]!==o||e[11]!==s||e[12]!==l||e[13]!==d||e[14]!==i||e[15]!==c?(x={selfClient:l,org:s,userId:c,cdConnectionId:o,domain:d,siteUrl:i},e[10]=o,e[11]=s,e[12]=l,e[13]=d,e[14]=i,e[15]=c,e[16]=x):x=e[16];const{connect:y,connectingFieldKey:C,disconnect:h,disconnectingFieldKey:g,error:u}=vn(x),[v,b]=K.useState(null);if(r?.(f.length===0||f.some(En)),f.length===0)return null;const _=C!==null||g!==null;let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(Ye,{}),e[17]=w):w=e[17];let S;e[18]!==u?(S=u&&t.jsx("p",{role:"alert",className:"mb-3 text-sm text-destructive",children:u}),e[18]=u,e[19]=S):S=e[19];let j;if(e[20]!==v||e[21]!==_||e[22]!==f||e[23]!==y||e[24]!==C||e[25]!==h||e[26]!==g||e[27]!==s||e[28]!==l||e[29]!==i){let R;e[31]!==v||e[32]!==_||e[33]!==y||e[34]!==C||e[35]!==h||e[36]!==g||e[37]!==s||e[38]!==l||e[39]!==i?(R=N=>{const k=async()=>{await y(N)&&b(N.fieldKey)};return t.jsx(nn,{card:N,connecting:C===N.fieldKey,disconnecting:g===N.fieldKey,disabled:_&&C!==N.fieldKey&&g!==N.fieldKey,org:s,selfClient:l,siteUrl:i,autoOpenConfigFieldKey:v,onAutoOpenConfigHandled:()=>b(P=>P===N.fieldKey?null:P),onConnect:()=>{k()},onDisconnect:()=>{h(N)}},N.fieldKey)},e[31]=v,e[32]=_,e[33]=y,e[34]=C,e[35]=h,e[36]=g,e[37]=s,e[38]=l,e[39]=i,e[40]=R):R=e[40],j=f.map(R),e[20]=v,e[21]=_,e[22]=f,e[23]=y,e[24]=C,e[25]=h,e[26]=g,e[27]=s,e[28]=l,e[29]=i,e[30]=j}else j=e[30];let E;e[41]!==j?(E=t.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:j}),e[41]=j,e[42]=E):E=e[42];let O;return e[43]!==S||e[44]!==E?(O=t.jsxs("div",{className:We,children:[w,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:[S,E]})]}),e[43]=S,e[44]=E,e[45]=O):O=e[45],O}function En(n){return n.satisfied}const Xe="https://decocms.com/agendar",wn="Precisa de ajuda? Fale conosco",Tn="Agende uma chamada de 20 minutos e rodamos o diagnóstico com você, ao vivo.",Ce=[{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"}],On="var(--brand-green-dark)";function Ze({siteUrl:n,email:e}){const s=new URL(Xe);return n&&s.searchParams.set("siteUrl",n),e&&s.searchParams.set("email",e),s.toString()}function In(n){const e=F.c(12),{href:s,size:o,className:i,orgId:r}=n,a=s===void 0?Xe:s,c=o===void 0?"lg":o;let d;e[0]!==i?(d=ie("w-full",i),e[0]=i,e[1]=d):d=e[1];let m;e[2]!==r?(m=()=>X("commerce_onboarding_meeting_cta_clicked",{placement:"visual_card",organization_id:r}),e[2]=r,e[3]=m):m=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Nt,{size:16}),e[4]=l):l=e[4];let p;e[5]!==a||e[6]!==m?(p=t.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",onClick:m,children:["Agendar uma reunião",l]}),e[5]=a,e[6]=m,e[7]=p):p=e[7];let f;return e[8]!==c||e[9]!==d||e[10]!==p?(f=t.jsx(B,{asChild:!0,variant:"outline",size:c,className:d,children:p}),e[8]=c,e[9]=d,e[10]=p,e[11]=f):f=e[11],f}function Rn(n){const e=F.c(10),{size:s}=n,o=s===void 0?72:s;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=Ce.map((m,l)=>t.jsxs("div",{className:"relative shrink-0",style:{width:o,height:o,marginLeft:l===0?0:-r,zIndex:Ce.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:m.photo,alt:m.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"})]})]},m.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 et(n){const e=F.c(6),{href:s,orgId:o}=n;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"h-20",style:{backgroundColor:On}}),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(Rn,{})}),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:wn}),t.jsx("p",{className:"text-sm leading-5 text-muted-foreground",children:Tn})]}),e[2]=a):a=e[2];let c;return e[3]!==s||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(In,{href:s,size:"lg",className:"mt-6",orgId:o})]})]})}),e[3]=s,e[4]=o,e[5]=c):c=e[5],c}function An(n){const e=F.c(13),{className:s,href:o,orgId:i}=n,r=o===void 0?Xe:o;let a;e[0]!==i?(a=()=>X("commerce_onboarding_meeting_cta_clicked",{placement:"mobile_banner",organization_id:i}),e[0]=i,e[1]=a):a=e[1];let c;e[2]!==s?(c=ie("flex items-center gap-4 rounded-2xl border border-border bg-card p-5 card-shadow transition-colors hover:bg-accent",s),e[2]=s,e[3]=c):c=e[3];let d,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(d={height:44,width:44+2*Math.round(30.799999999999997)},m=Ce.map(kn),e[4]=d,e[5]=m):(d=e[4],m=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:[m,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:Ce.length+1}})]}),e[6]=l):l=e[6];let p,f;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"]}),f=t.jsx(Nt,{size:18,className:"shrink-0 text-muted-foreground"}),e[7]=p,e[8]=f):(p=e[7],f=e[8]);let x;return e[9]!==r||e[10]!==a||e[11]!==c?(x=t.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",onClick:a,className:c,children:[l,p,f]}),e[9]=r,e[10]=a,e[11]=c,e[12]=x):x=e[12],x}function kn(n,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:Ce.length-e},children:t.jsx("img",{src:n.photo,alt:n.alt,className:"h-full w-full object-cover",loading:"lazy"})},n.photo)}function Tt(n){const e=F.c(10),{host:s}=n,o=`https://www.google.com/s2/favicons?domain=${s}&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]!==s?(d=t.jsx("span",{className:"text-lg font-medium text-foreground",children:s}),e[5]=s,e[6]=d):d=e[6];let m;return e[7]!==c||e[8]!==d?(m=t.jsxs("div",{className:"flex items-center gap-3",children:[i,r,a,c,d]}),e[7]=c,e[8]=d,e[9]=m):m=e[9],m}const Ln={workspace:"Preparando seu workspace de commerce...",generic:"Preparando..."};function Pn(n){return Ln[n]}function tt(n){const e=F.c(4),{variant:s}=n;let o;e[0]!==s?(o=Pn(s),e[0]=s,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(Pe,{label:o,className:"text-muted-foreground"})}),e[2]=o,e[3]=i):i=e[3],i}function fi(){const n=F.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Un,{}),n[0]=e):e=n[0],e}const Ot=K.createContext(null),It=()=>K.useContext(Ot);function ne(n){const e=F.c(13);let s,o;e[0]!==n?({visual:o,...s}=n,e[0]=n,e[1]=s,e[2]=o):(s=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=mt(i),{data:a}=ke.useSession(),c=a?.user?.email;let d;e[4]!==r.siteUrl||e[5]!==c?(d=Ze({siteUrl:r.siteUrl,email:c}),e[4]=r.siteUrl,e[5]=c,e[6]=d):d=e[6];const m=d;let l;e[7]!==m||e[8]!==o?(l=o??t.jsx(et,{href:m}),e[7]=m,e[8]=o,e[9]=l):l=e[9];let p;return e[10]!==s||e[11]!==l?(p=t.jsx(Wt,{...s,visual:l}),e[10]=s,e[11]=l,e[12]=p):p=e[12],p}const zn={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:n=>`Código enviado para ${n}`,defaultSubtitle:"Entre ou crie uma nova conta",resetEmailSent:"Verifique seu e-mail para redefinir a senha.",continueWith:n=>`Continuar com ${n}`,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 le(n){if(!n)return null;const e=ae(n);return e.ok?new URL(e.value).hostname:null}function at(n){switch(n){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 n}}let lt=!1;function Un(){const n=mt({from:"/commerce-onboarding"}),{org:e,siteUrl:s}=n,o=le(s);return!lt&&Ht()&&(lt=!0,X("commerce_onboarding_viewed",{site_url:s,domain:o??void 0,...o?{$set:{last_scanned_domain:o}}:{}})),t.jsx(Ot.Provider,{value:o,children:t.jsx($n,{requestedOrgSlug:e,siteUrl:s})})}function $n(n){const e=F.c(8),{requestedOrgSlug:s,siteUrl:o}=n,{data:i,isPending:r}=ke.useSession(),a=It();if(r){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(ne,{children:t.jsx(tt,{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 m;e[1]!==a?(m=a?t.jsx(Tt,{host:a}):void 0,e[1]=a,e[2]=m):m=e[2];let l;return e[3]!==m?(l=t.jsx(ne,{children:t.jsx(Bt,{callbackUrl:d,allowAutoLogin:!1,title:"Desbloqueie seu diagnóstico completo",subtitle:null,brand:m,copy:zn})}),e[3]=m,e[4]=l):l=e[4],l}let c;return e[5]!==s||e[6]!==o?(c=t.jsx(Dn,{requestedOrgSlug:s,siteUrl:o}),e[5]=s,e[6]=o,e[7]=c):c=e[7],c}function Dn(n){const e=F.c(43),{requestedOrgSlug:s,siteUrl:o}=n,i=ft(),r=Qt(),[a,c]=K.useState(null),[d,m]=K.useState(null),l=r.data?.map(qn)??[];let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={mutationFn:Mn,retry:!1,onSuccess:u=>{m(u)}},e[0]=p):p=e[0];const f=pe(p);if(r.isPending){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(ne,{children:t.jsx(tt,{variant:"workspace"})}),e[1]=u):u=e[1],u}if(r.error){let u;return e[2]!==r?(u=t.jsx(Ie,{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]=u):u=e[3],u}const x=s?l.find(u=>u.slug===s):null;if(x){let u;return e[4]!==x||e[5]!==o?(u=t.jsx(Te,{org:x,initialSiteUrl:o}),e[4]=x,e[5]=o,e[6]=u):u=e[6],u}if(s){let u;return e[7]!==r?(u=t.jsx(Ie,{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]=u):u=e[8],u}if(a){let u;return e[9]!==a||e[10]!==o?(u=t.jsx(Te,{org:a,initialSiteUrl:o}),e[9]=a,e[10]=o,e[11]=u):u=e[11],u}if(l.length===1&&l[0]){let u;return e[12]!==l[0]||e[13]!==o?(u=t.jsx(Te,{org:l[0],initialSiteUrl:o}),e[12]=l[0],e[13]=o,e[14]=u):u=e[14],u}if(l.length>1){let u;e[15]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(re,{title:"Escolha uma organização",description:"Selecione onde o diagnóstico de commerce deve continuar."}),e[15]=u):u=e[15];let v;e[16]!==i||e[17]!==o?(v=_=>i({to:"/commerce-onboarding",search:{org:_.slug,siteUrl:o}}),e[16]=i,e[17]=o,e[18]=v):v=e[18];let b;return e[19]!==l||e[20]!==v?(b=t.jsx(ne,{children:t.jsxs("div",{className:"grid gap-10",children:[u,t.jsx($e,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:t.jsx(nt,{organizations:l,selectLabel:"Continuar",onSelected:v})})]})}),e[19]=l,e[20]=v,e[21]=b):b=e[21],b}if(!d){let u;e[22]!==f?(u=()=>{f.reset(),f.mutate()},e[22]=f,e[23]=u):u=e[23];let v;return e[24]!==f||e[25]!==u?(v=t.jsx(Fn,{mutation:f,onRetry:u}),e[24]=f,e[25]=u,e[26]=v):v=e[26],v}const y=d;if(y?.success&&(y.status==="created"||y.status==="joined"||y.status==="already_has_organization")&&y.organization){let u;return e[27]!==y.organization||e[28]!==o?(u=t.jsx(Te,{org:y.organization,initialSiteUrl:o}),e[27]=y.organization,e[28]=o,e[29]=u):u=e[29],u}if(y?.status==="ambiguous"&&y.organizations&&y.organizations.length>0){let u;e[30]===Symbol.for("react.memo_cache_sentinel")?(u=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]=u):u=e[30];const v=y.domain??void 0;let b;e[31]!==i||e[32]!==o?(b=(w,S)=>{pt(),c({...w,slug:S}),i({to:"/commerce-onboarding",search:{org:S,siteUrl:o}})},e[31]=i,e[32]=o,e[33]=b):b=e[33];let _;return e[34]!==y.organizations||e[35]!==v||e[36]!==b?(_=t.jsx(ne,{children:t.jsxs("div",{className:"grid gap-10",children:[u,t.jsx($e,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:t.jsx(nt,{organizations:y.organizations,domain:v,onJoined:b})})]})}),e[34]=y.organizations,e[35]=v,e[36]=b,e[37]=_):_=e[37],_}const C=y?.error??"Não conseguimos determinar uma organização de commerce para esta conta.";let h;e[38]!==f?(h=()=>{m(null),f.reset()},e[38]=f,e[39]=h):h=e[39];let g;return e[40]!==C||e[41]!==h?(g=t.jsx(Ie,{title:"O onboarding de commerce precisa de suporte",description:C,actionLabel:"Tentar novamente",onRetry:h}),e[40]=C,e[41]=h,e[42]=g):g=e[42],g}async function Mn(){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&&pt(),e}function qn(n){return{id:n.id,name:n.name,slug:n.slug,logo:n.logo??null}}function Fn(n){const e=F.c(7),{mutation:s,onRetry:o}=n,i=K.useRef(!1);let r;e[0]!==s?(r=m=>{!m||i.current||(i.current=!0,s.mutate())},e[0]=s,e[1]=r):r=e[1];const a=r;if(s.error){let m;return e[2]!==o?(m=t.jsx(Ie,{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]=m):m=e[3],m}let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(tt,{variant:"generic"}),e[4]=c):c=e[4];let d;return e[5]!==a?(d=t.jsx(ne,{children:t.jsx("div",{ref:a,children:c})}),e[5]=a,e[6]=d):d=e[6],d}function re(n){const e=F.c(8),{title:s,description:o}=n,i=It();let r;e[0]!==i?(r=i?t.jsx(Tt,{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]!==s?(a=(s||o)&&t.jsxs("div",{className:"space-y-2",children:[s&&t.jsx("h1",{className:"text-2xl font-medium leading-8",children:s}),o&&t.jsx("p",{className:"text-base text-muted-foreground leading-6",children:o})]}),e[2]=o,e[3]=s,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 Ie(n){const e=F.c(9),{title:s,description:o,actionLabel:i,onRetry:r}=n;let a;e[0]!==o||e[1]!==s?(a=t.jsx(re,{title:s,description:o}),e[0]=o,e[1]=s,e[2]=a):a=e[2];let c;e[3]!==i||e[4]!==r?(c=t.jsx(B,{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(ne,{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 Kn(n){return n.content?.find(e=>e.text)?.text??"A configuração do Commerce Discovery falhou."}function we(n){const e=n;if(e.isError)throw new Error(Kn(e));return e.structuredContent??n}function Te(n){const e=F.c(11),{org:s,initialSiteUrl:o}=n,{data:i}=ke.useSession(),r=i?.user?.email;let a;e[0]!==o||e[1]!==r?(a=Ze({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]!==s.id?(d=t.jsx(et,{href:c,orgId:s.id}),e[3]=c,e[4]=s.id,e[5]=d):d=e[5];const m=d;let l;return e[6]!==o||e[7]!==m||e[8]!==s||e[9]!==i?.user?.email?(l=t.jsx(dt,{children:p=>{const{reset:f}=p;return t.jsx(ut,{fallback:x=>{const{error:y,resetError:C}=x;return t.jsx(ne,{visual:m,children:t.jsx(Vn,{orgName:s.name,message:y instanceof Error?y.message:"Não foi possível verificar a configuração do Commerce Discovery.",onRetry:()=>{f(),C()}})})},children:t.jsx(K.Suspense,{fallback:t.jsx(Rt,{visual:m}),children:t.jsx(Hn,{org:s,initialSiteUrl:o,sessionEmail:i?.user?.email},`${s.id}:${o??""}`)})})}}),e[6]=o,e[7]=m,e[8]=s,e[9]=i?.user?.email,e[10]=l):l=e[10],l}function Rt(n){const e=F.c(3),{visual:s}=n;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(Je,{})]}),e[0]=o):o=e[0];let i;return e[1]!==s?(i=t.jsx(ne,{align:"fill",visual:s,children:o}),e[1]=s,e[2]=i):i=e[2],i}function Vn(n){const e=F.c(10),{orgName:s,message:o,onRetry:i}=n,r=`A configuração de commerce continuará em ${s}.`;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(B,{type:"button",size:"xl",className:"w-full",onClick:i,children:"Tentar novamente"}),e[4]=i,e[5]=d):d=e[5];let m;return e[6]!==a||e[7]!==c||e[8]!==d?(m=t.jsxs("div",{className:"grid gap-10",children:[a,c,d]}),e[6]=a,e[7]=c,e[8]=d,e[9]=m):m=e[9],m}function Hn({org:n,initialSiteUrl:e,sessionEmail:s}){const o=ft(),i=Le({connectionId:gt,orgId:n.id,orgSlug:n.slug}),[r,a]=K.useState(e??""),[c,d]=K.useState(null),[m,l]=K.useState(null),p=K.useRef(!1),f=Me.COMMERCE_DISCOVERY(n.id),x=Jt(n.id),y=ve({queryKey:Y.commerceDiscoveryConnection(n.id,f),queryFn:async()=>{const T=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:f}});return we(T)},retry:!1}),C=ve({queryKey:Y.commerceDiscoveryVirtualMcp(n.id,x),queryFn:async()=>{const T=await i.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:x}});return we(T)},retry:!1}),h=pe({mutationFn:async T=>{const I=await i.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:T}});return we(I)},retry:!1,onSuccess:(T,I)=>{X("commerce_onboarding_setup_succeeded",{domain:le(I)??void 0,organization_id:n.id}),d(T),l(null),y.refetch(),C.refetch()},onError:(T,I)=>{X("commerce_onboarding_setup_failed",{domain:le(I)??void 0,organization_id:n.id,error:T instanceof Error?T.message:String(T)}),l(T instanceof Error?T.message:"A configuração do Commerce Discovery falhou.")}}),g=pe({mutationFn:async T=>{const I=await i.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:T}});return we(I)},retry:!1}),[u,v]=K.useState(null),b=!!y.data.item&&!!C.data.item,_=y.data.item,w=typeof _?.metadata?.siteUrl=="string"?_.metadata.siteUrl:void 0,j=bs(e||r||"",w),E=b&&j,O=e||r||w||"",R=Ze({siteUrl:O,email:s}),N=t.jsx(et,{href:R,orgId:n.id}),k=T=>{const I=ae(T);if(!I.ok){l(at(I.error));return}l(null),h.mutate(I.value)},P=T=>{!T||p.current||E||!e||(p.current=!0,k(e))},L=T=>{T.preventDefault();const I=ae(r);I.ok&&X("commerce_onboarding_site_url_submitted",{domain:new URL(I.value).hostname,organization_id:n.id}),k(r)},M=c?.reportApp??{connectionId:f,virtualMcpId:x,toolName:Xt},U=async()=>{v(null),X("commerce_onboarding_open_report_clicked",{domain:le(O)??void 0,organization_id:n.id});const T=ae(O);if(T.ok)try{await h.mutateAsync(T.value);let I=await g.mutateAsync(T.value);if(I.triggered||(X("commerce_onboarding_run_reclaim",{domain:le(O)??void 0,organization_id:n.id,reason:I.reason??"not_upgraded"}),await h.mutateAsync(T.value),I=await g.mutateAsync(T.value)),!I.triggered){X("commerce_onboarding_run_failed",{domain:le(O)??void 0,organization_id:n.id,error:I.reason??"not_triggered"}),v("Não foi possível gerar o relatório para este site. Recarregue a página e tente novamente.");return}}catch(I){X("commerce_onboarding_run_failed",{domain:le(O)??void 0,organization_id:n.id,error:I instanceof Error?I.message:String(I)}),v("Algo deu errado ao gerar seu relatório. Tente novamente em instantes.");return}localStorage.setItem(Gt.sidebarOpen(),JSON.stringify(!1)),o({to:"/$org/$taskId",params:{org:n.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:M.virtualMcpId,main:Yt(M.connectionId,M.toolName)}})};if(E)return t.jsx(Qn,{org:n,reportApp:M,onOpenReport:U,isSubmitting:g.isPending,error:u,meetingUrl:R,meetingVisual:N,siteUrl:O});if(h.isPending)return t.jsx(Rt,{visual:N});if(e){const T=ae(e);return T.ok?t.jsx(ne,{visual:N,children:t.jsxs("div",{ref:P,className:"grid gap-10",children:[t.jsx(re,{title:"Diagnóstico de commerce",description:`O Commerce Discovery está sendo preparado para ${T.value}.`}),m?t.jsxs(t.Fragment,{children:[t.jsx(je,{message:m}),t.jsx(ze,{siteUrl:r,error:null,isSubmitting:h.isPending,onSiteUrlChange:a,onSubmit:L})]}):t.jsx(Je,{})]})}):t.jsx(ne,{visual:N,children:t.jsxs("div",{className:"grid gap-10",children:[t.jsx(re,{title:"Diagnóstico de commerce",description:`A configuração de commerce continuará em ${n.name}.`}),t.jsx(je,{message:at(T.error)}),t.jsx(ze,{siteUrl:r,error:m,isSubmitting:h.isPending,onSiteUrlChange:a,onSubmit:L})]})})}return t.jsx(ne,{visual:N,children:t.jsxs("div",{className:"grid gap-10",children:[t.jsx(re,{title:"Diagnóstico de commerce",description:`A configuração de commerce continuará em ${n.name}.`}),t.jsx(ze,{siteUrl:r,error:m,isSubmitting:h.isPending,onSiteUrlChange:a,onSubmit:L})]})})}function ze(n){const e=F.c(20),{siteUrl:s,error:o,isSubmitting:i,onSiteUrlChange:r,onSubmit:a}=n;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=h=>r(h.target.value),e[1]=r,e[2]=d):d=e[2];const m=!!o;let l;e[3]!==i||e[4]!==s||e[5]!==d||e[6]!==m?(l=t.jsx(be,{id:"commerce-site-url",type:"text",inputMode:"url",value:s,onChange:d,placeholder:"https://example.com","aria-invalid":m,disabled:i}),e[3]=i,e[4]=s,e[5]=d,e[6]=m,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 f;e[10]!==l||e[11]!==p?(f=t.jsxs("div",{className:"grid gap-2",children:[c,l,p]}),e[10]=l,e[11]=p,e[12]=f):f=e[12];let x;e[13]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(ht,{size:16}),e[13]=x):x=e[13];let y;e[14]!==i?(y=t.jsxs(B,{type:"submit",size:"xl",className:"w-full",disabled:i,children:["Continuar",x]}),e[14]=i,e[15]=y):y=e[15];let C;return e[16]!==a||e[17]!==f||e[18]!==y?(C=t.jsxs("form",{className:"grid gap-4",onSubmit:a,children:[f,y]}),e[16]=a,e[17]=f,e[18]=y,e[19]=C):C=e[19],C}function Qn(n){const e=F.c(27),{org:s,reportApp:o,onOpenReport:i,isSubmitting:r,error:a,meetingUrl:c,meetingVisual:d,siteUrl:m}=n,[l,p]=K.useState(!0);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(re,{}),e[0]=f):f=e[0];let x;e[1]!==s||e[2]!==o.connectionId||e[3]!==m?(x=t.jsx(Sn,{org:s,cdConnectionId:o.connectionId,siteUrl:m,onReadinessChange:p}),e[1]=s,e[2]=o.connectionId,e[3]=m,e[4]=x):x=e[4];let y;e[5]!==c||e[6]!==s.id?(y=t.jsx(An,{className:"md:hidden",href:c,orgId:s.id}),e[5]=c,e[6]=s.id,e[7]=y):y=e[7];let C;e[8]!==a?(C=a?t.jsx(je,{message:a}):null,e[8]=a,e[9]=C):C=e[9];const h=r||!o.virtualMcpId||!l,g=r?"Abrindo relatório...":"Ver relatório completo";let u;e[10]!==r?(u=r?null:t.jsx(ht,{size:18}),e[10]=r,e[11]=u):u=e[11];let v;e[12]!==i||e[13]!==h||e[14]!==g||e[15]!==u?(v=t.jsxs(B,{type:"button",size:"xl",className:"w-full rounded-2xl text-base font-medium",onClick:i,disabled:h,children:[g,u]}),e[12]=i,e[13]=h,e[14]=g,e[15]=u,e[16]=v):v=e[16];let b;e[17]!==y||e[18]!==C||e[19]!==v?(b=t.jsxs("div",{className:"flex shrink-0 flex-col gap-3 md:mt-8",children:[y,C,v]}),e[17]=y,e[18]=C,e[19]=v,e[20]=b):b=e[20];let _;e[21]!==x||e[22]!==b?(_=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[f,x,b]}),e[21]=x,e[22]=b,e[23]=_):_=e[23];let w;return e[24]!==d||e[25]!==_?(w=t.jsx(ne,{align:"fill",visual:d,children:_}),e[24]=d,e[25]=_,e[26]=w):w=e[26],w}function je(n){const e=F.c(2),{message:s}=n;let o;return e[0]!==s?(o=t.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:s}),e[0]=s,e[1]=o):o=e[1],o}export{fi as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as _}from"./connection-slug-eyAPH6o3.js";import{c as R,a4 as $,aX as k,K as D,l as E,j as x}from"./index-CsZhMKFM.js";import{u as K}from"./use-registry-connections-xg-zrNmx.js";import{d as Q}from"./use-organization-settings-C4hP3pVq.js";import{S as w}from"./constants-CaIX_f5U.js";import{u as F}from"./useInfiniteQuery-BosqZeNZ.js";import{c as H}from"./use-mcp-client-Bv8WGceO.js";import{i as X,f as q}from"./extract-connection-data-Di6SAuY0.js";import{C as G}from"./card-Bc92PJFP.js";import{I as U}from"./integration-icon-6pGkEdul.js";function ce(s){const e=new Map;for(const o of s){const a=_(o),r=e.get(a);r?r.push(o):e.set(a,[o])}const t=[],l=new Set;for(const o of s){const a=_(o);if(l.has(a))continue;l.add(a);const r=e.get(a),m=r[0];r.length===1?t.push({type:"single",connection:m}):t.push({type:"group",key:a,icon:m.icon,title:m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.title,connections:r})}return t}function ue(){const s=R.c(6),e=K(),t=Q(),l=$().project.enabledPlugins??[];let o;if(s[0]!==l||s[1]!==t||s[2]!==e){let a;s[4]!==t?(a=r=>t(r.id),s[4]=t,s[5]=a):a=s[5],o=e.filter(a).map(V),l.includes("private-registry")&&t(w)&&o.push({id:w,title:"Private Registry",icon:null}),s[0]=l,s[1]=t,s[2]=e,s[3]=o}else o=s[3];return o}function V(s){return{id:s.id,title:s.title,icon:s.icon}}const Y=24,S=3;function A(s){return s.id.includes("community-registry")}function z(s){const e=s?.trim().split(/\s+/).filter(Boolean)??[];if(e.length===0)return;const t=[["title"],["description"],["name"],["server","title"]];return{operator:"or",conditions:e.flatMap(l=>t.map(o=>({field:o,operator:"contains",value:l})))}}function T(s,e,t,l,o){const a=s.map(u=>u.id).sort().join(","),r=z(o),{data:m,fetchNextPage:d,hasNextPage:f,isFetchingNextPage:p,isLoading:P}=F({queryKey:D.storeDiscovery(e,`${a}:${o??""}`),queryFn:async({pageParam:u})=>{const n=u??{};return await Promise.all(s.map(async i=>{const y=n[i.id];if(y==="EXHAUSTED")return{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:[]};const j=X(i.id,e);let h;for(let I=0;I<S;I++){let C=null;try{C=await H({connectionId:i.id,orgId:e,orgSlug:t});const v={limit:Y};y&&(v.cursor=y),r&&(v.where=r);const b=await C.callTool({name:j,arguments:v}),N=b.structuredContent??b,M=N.nextCursor||N.cursor||void 0,L=q(N?[N]:[]);return{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:L,nextCursor:M}}catch(v){h=v}finally{await C?.close().catch(()=>{})}}return console.warn(`[useMergedStoreDiscovery] Registry "${i.title}" (${i.id}) failed after ${S} attempts:`,h),{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:[]}}))},initialPageParam:{},getNextPageParam:u=>{const n={};let c=!1;for(const i of u)i.registryId&&(i.nextCursor?(n[i.registryId]=i.nextCursor,c=!0):n[i.registryId]="EXHAUSTED");return c?n:void 0},staleTime:3600*1e3,placeholderData:k,retry:!1,enabled:s.length>0}),g=[];if(m?.pages)for(const u of m.pages)for(const n of u)for(const c of n.items)g.push({...c,_sourceName:c._sourceName??n.registryTitle,_sourceIcon:c._sourceIcon??n.registryIcon,_registryId:c._registryId??n.registryId});return{items:g,hasMore:f??!1,isLoadingMore:p,isInitialLoading:P,fetchNextPage:()=>{f&&!p&&d()}}}function fe(s,e){const t=R.c(16),{org:l}=$();let o;t[0]!==s?(o=s.filter(W),t[0]=s,t[1]=o):o=t[1];const a=o;let r;t[2]!==s?(r=s.filter(B),t[2]=s,t[3]=r):r=t[3];const m=r,d=T(a,l.id,l.slug,!0,e),f=T(m,l.id,l.slug,!0,e);let p;if(t[4]!==f.items||t[5]!==d.items){const y=new Set;p=[];const j=[...d.items,...f.items];for(const h of j){const I=`${h._registryId}:${h.id}`;y.has(I)||(y.add(I),p.push(h))}t[4]=f.items,t[5]=d.items,t[6]=p}else p=t[6];const P=d.isInitialLoading||f.isInitialLoading,g=d.isLoadingMore||f.isLoadingMore,u=d.hasMore||f.hasMore;let n;t[7]!==f||t[8]!==d?(n=()=>{d.hasMore&&d.fetchNextPage(),f.hasMore&&f.fetchNextPage()},t[7]=f,t[8]=d,t[9]=n):n=t[9];const c=n;let i;return t[10]!==u||t[11]!==P||t[12]!==g||t[13]!==p||t[14]!==c?(i={items:p,hasMore:u,isLoadingMore:g,isInitialLoading:P,loadMore:c},t[10]=u,t[11]=P,t[12]=g,t[13]=p,t[14]=c,t[15]=i):i=t[15],i}function B(s){return A(s)}function W(s){return!A(s)}function de(s){const e=R.c(37),{connection:t,onClick:l,headerActions:o,headerActionsAlwaysVisible:a,body:r,footer:m,className:d,fallbackIcon:f}=s,p=a===void 0?!1:a,P=l&&"hover:bg-muted/50";let g;e[0]!==d||e[1]!==P?(g=E("cursor-pointer transition-colors group overflow-hidden flex flex-col h-full",P,d),e[0]=d,e[1]=P,e[2]=g):g=e[2];let u;e[3]!==t.icon||e[4]!==t.title||e[5]!==f?(u=x.jsx(U,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:f}),e[3]=t.icon,e[4]=t.title,e[5]=f,e[6]=u):u=e[6];let n;e[7]!==o||e[8]!==p?(n=o&&x.jsx("div",{className:E("transition-opacity",!p&&"sm:opacity-0 sm:group-hover:opacity-100"),onClick:J,children:o}),e[7]=o,e[8]=p,e[9]=n):n=e[9];let c;e[10]!==n?(c=x.jsx("div",{className:"relative",children:n}),e[10]=n,e[11]=c):c=e[11];let i;e[12]!==u||e[13]!==c?(i=x.jsxs("div",{className:"flex items-start justify-between",children:[u,c]}),e[12]=u,e[13]=c,e[14]=i):i=e[14];let y;e[15]!==t.title?(y=x.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:t.title}),e[15]=t.title,e[16]=y):y=e[16];const j=t.description||"No description";let h;e[17]!==j?(h=x.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:j}),e[17]=j,e[18]=h):h=e[18];let I;e[19]!==h||e[20]!==y?(I=x.jsxs("div",{className:"flex flex-col gap-1",children:[y,h]}),e[19]=h,e[20]=y,e[21]=I):I=e[21];let C;e[22]!==r?(C=r&&x.jsx("div",{children:r}),e[22]=r,e[23]=C):C=e[23];let v;e[24]!==I||e[25]!==C||e[26]!==i?(v=x.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[i,I,C]}),e[24]=I,e[25]=C,e[26]=i,e[27]=v):v=e[27];let b;e[28]!==m?(b=m&&x.jsx("div",{className:"border-t border-border mt-auto",children:x.jsx("div",{className:"h-14 flex items-center p-4.5",onClick:Z,children:m})}),e[28]=m,e[29]=b):b=e[29];let N;e[30]!==v||e[31]!==b?(N=x.jsxs("div",{className:"flex flex-col flex-1",children:[v,b]}),e[30]=v,e[31]=b,e[32]=N):N=e[32];let M;return e[33]!==l||e[34]!==N||e[35]!==g?(M=x.jsx(G,{className:g,onClick:l,children:N}),e[33]=l,e[34]=N,e[35]=g,e[36]=M):M=e[36],M}function Z(s){return s.stopPropagation()}function J(s){return s.stopPropagation()}export{de as C,fe as a,ce as g,ue as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{H as he,ad as Ie,b2 as Ae,I as le,ab as $e,c as P,j as t,i as ge,B as V,r as G,l as je,a4 as J,P as De,K as ne,b as Y,aH as ce,a1 as Pe,b3 as Oe,U as Me,e as ze,b4 as Ee,n as Ve,M as Ue,J as Re,t as X,b5 as Fe}from"./index-CsZhMKFM.js";import{a as Le}from"./extract-connection-data-Di6SAuY0.js";import{E as ve}from"./empty-state-DD15-E7x.js";import{E as He,c as Be,r as qe,b as We,d as Xe}from"./connection-form-helpers-POWe2kJ-.js";import{c as Ge,S as Ke,V as Qe}from"./index-MwzluG1w.js";import{u as be,T as Je}from"./tools-list-DyAKlhYk.js";import{u as Ye}from"./use-members-eaM3vNiv.js";import{A as Ze}from"./avatar-DOYkgu8W.js";import{a as Ne,b as ye,u as et}from"./use-connection-CcLotHiI.js";import{u as _e}from"./use-mcp-client-Bv8WGceO.js";import{a as tt}from"./use-mcp-tools-_p3Gu3UX.js";import{c as st,C as nt,a as ot,d as it}from"./AreaChart-BHEk1VG5.js";import{i as rt,a as at}from"./mcp-oauth-z9GFPjDo.js";import{I as oe}from"./integration-icon-6pGkEdul.js";import{s as lt}from"./Plus-Cgq7ON9K.js";import{N as ct,O as dt,aq as mt,am as ut}from"./agent-icon-dPkJbbXq.js";import{a as Ce,s as xt}from"./Settings02-CS2jOfO5.js";import{s as re}from"./Trash01--uX5q_ti.js";import{q as pt,p as ft,o as ht,m as gt,n as jt}from"./sidebar-DRSu2iBz.js";import{F as L,b as H,c as B,d as E,e as q,f as vt,a as bt}from"./form-YJrSMpNL.js";import{I as W}from"./input-D5ccsU_1.js";import{u as Nt,D as yt}from"./use-delete-connection-BJuEHINL.js";import{c as _t,B as Ct,a as St,C as wt}from"./monitoring-stats-row-CLHK9ypI.js";import{u as kt}from"./studio-tools-CTswP4mA.js";import{u as Tt}from"./use-virtual-mcp-CMvxAHEJ.js";import{i as Se}from"./ChevronRight-C3Tgk-3m.js";import{a as we}from"./Users03-tGwfKVJc.js";import{b as ee,c as It,T as te,a as At}from"./tabs-BoNNus4B.js";import{g as ke}from"./connection-slug-eyAPH6o3.js";import{n as $t}from"./ZapSquare-Dzb50Gix.js";import{d as Dt}from"./Tool01-DVCGutKV.js";import{g as ae,M as Pt}from"./index-DPzJsdBC.js";import{C as Ot}from"./collection-search-DSP3ov6A.js";import{C as Mt}from"./card-Bc92PJFP.js";import{B as zt}from"./badge-BMMjntMn.js";import{D as Et,a as Vt,c as Ut,d as de}from"./dropdown-menu-C9SSwIby.js";import{S as me,a as ue,b as xe,c as pe,d as F}from"./select-CVMXwLRV.js";import{i as Rt}from"./CheckCircle-lXciCGfG.js";import{t as Ft}from"./ChevronDown-BmFaSDo8.js";import{n as Lt}from"./Tool02-CSTMjTef.js";import{s as se}from"./Star01-2DHf7kTZ.js";import{s as Ht}from"./XClose-D5Ra7e-f.js";import"./constants-CaIX_f5U.js";import"./index-DS3hrf0F.js";import"./ZoomOut-DYAXxr_v.js";import"./Key01-1r4YrQER.js";import"./auth-D_bm0-t3.js";import"./use-registry-connections-xg-zrNmx.js";import"./use-organization-settings-C4hP3pVq.js";import"./index-Cyr1IOqy.js";import"./index-DKyQrM3l.js";import"./popover-C5PoRwEk.js";import"./tooltip-Cs5hng3q.js";import"./Check-CcLLJc-z.js";import"./SearchMd-ZfoTl6vw.js";import"./use-mobile-DhhfLpzh.js";import"./use-create-virtual-mcp-DPkT8FPW.js";import"./use-navigate-to-agent-BsdctirU.js";import"./hooks-GnFkomrq.js";import"./decopilot-sse-pool-CJtSg3wj.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./Eye-DM8bmzm7.js";import"./use-org-auth-client-DYoTiK8H.js";import"./User01-5hu8D3_O.js";import"./use-collections-Cl7KVWNQ.js";import"./AlertCircle-BsA2wZmN.js";import"./ArrowUp-CDnEKV2Y.js";import"./XCircle-D3cI1Aep.js";import"./ArrowUpRight-DdPCnlNm.js";import"./TrendUp01-acR-ekUr.js";import"./Loading02-Dx-xiZND.js";import"./ChevronUp-Dew3RmKl.js";import"./Circle-C_fdyhr8.js";import"./Stars02-HLp9q8iP.js";import"./Copy01-b3lIb5yu.js";import"./DotsVertical-CK1a4mKj.js";import"./Globe01-B6kdhpV9.js";import"./FilterLines-DCNZa1GS.js";import"./Globe04-CGLGspo5.js";import"./SwitchHorizontal01-ilLzkPr_.js";import"./HardDrive-CR6Rs-a1.js";import"./LayoutLeft-DvNM8qhm.js";import"./LinkExternal01-Ck4lryDE.js";import"./List-DfPIAPM_.js";import"./Monitor01-D_DrBwt_.js";import"./Sun-ByaEjJ0N.js";import"./Package-CV2Q9Uup.js";import"./Palette-BY5BmUDa.js";import"./Play-Ci1OqtIO.js";import"./SearchLg-2as_l8YT.js";import"./Shield01-C6TdRfmI.js";import"./Stars01-BEHbN5c3.js";import"./Upload01-BaheeKQP.js";import"./Users01-Dh5E4dqf.js";import"./X-OFSHASit.js";import"./Zap-CgjpaG4V.js";import"./label-BULuaMoF.js";import"./alert-dialog-Bd5XLC3F.js";const Bt=he({scopes:$e(le()).describe("List of scopes available"),stateSchema:Ie(le(),Ae()).describe("JSON Schema (draft-07) defining the state structure")}),qt=[{name:"MCP_CONFIGURATION",inputSchema:he({}),outputSchema:Bt}];function Wt(s){const e=P.c(46),{instance:n,onConfigure:i,onAuthenticate:r,onDelete:o,onToggleStatus:a}=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]!==r?(N=x&&t.jsx(V,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>r(n),children:"Authorize"}),e[16]=n,e[17]=x,e[18]=r,e[19]=N):N=e[19];let T;e[20]!==n||e[21]!==p||e[22]!==a?(T=p?t.jsxs(V,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>a(n,"active"),children:[t.jsx(ct,{size:13}),"Enable"]}):t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>a(n,"inactive"),title:"Disable",children:t.jsx(dt,{size:13})}),e[20]=n,e[21]=p,e[22]=a,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(re,{size:13}),e[33]=k):k=e[33];let C;e[34]!==_?(C=t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:_,title:"Delete",children:k}),e[34]=_,e[35]=C):C=e[35];let f;e[36]!==I||e[37]!==C||e[38]!==N||e[39]!==T?(f=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[N,T,I,C]}),e[36]=I,e[37]=C,e[38]=N,e[39]=T,e[40]=f):f=e[40];let w;return e[41]!==f||e[42]!==h||e[43]!==g||e[44]!==j?(w=t.jsxs("div",{className:h,children:[g,j,f]}),e[41]=f,e[42]=h,e[43]=g,e[44]=j,e[45]=w):w=e[45],w}function Xt(s){const e=P.c(15),{instance:n,onConfigure:i}=s;let r;e[0]!==n.icon||e[1]!==n.title?(r=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=r):r=e[2];let o;e[3]!==n.title?(o=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",children:n.title})}),e[3]=n.title,e[4]=o):o=e[4];let a;e[5]!==n||e[6]!==i?(a=()=>i(n),e[5]=n,e[6]=i,e[7]=a):a=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]!==a?(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:a,title:"Configure",children:d})}),e[9]=a,e[10]=l):l=e[10];let u;return e[11]!==r||e[12]!==o||e[13]!==l?(u=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[r,o,l]}),e[11]=r,e[12]=o,e[13]=l,e[14]=u):u=e[14],u}function Gt(s){const e=P.c(27),{instances:n,onConfigure:i,onAuthenticate:r,onDelete:o,onToggleStatus:a,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(lt,{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]!==r||e[13]!==i||e[14]!==o||e[15]!==a){let j;e[17]!==r||e[18]!==i||e[19]!==o||e[20]!==a?(j=N=>t.jsx(G.Suspense,{fallback:t.jsx(Xt,{instance:N,onConfigure:i}),children:t.jsx(Wt,{instance:N,onConfigure:i,onAuthenticate:r,onDelete:o,onToggleStatus:a})},N.id),e[17]=r,e[18]=i,e[19]=o,e[20]=a,e[21]=j):j=e[21],g=n.map(j),e[11]=n,e[12]=r,e[13]=i,e[14]=o,e[15]=a,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 r=(i.errorMessage??"").trim()||"Unknown error";n.set(r,(n.get(r)??0)+1)}return[...n.entries()].map(([i,r])=>({message:i,count:r})).sort((i,r)=>r.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:r}=s,o=kt(),a=Jt(r),{data:d}=De({queryKey:ne.connectionActivity(n,r,i),queryFn:async()=>await o.call("MONITORING_LOGS_LIST",{startDate:a.startDate.toISOString(),endDate:a.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}),staleTime:3e5}),l=_t(d?.logs??[],a),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(st,{config:Yt,className:"h-16 w-full",children:t.jsxs(Ct,{data:u,barCategoryGap:"4%",children:[t.jsx(nt,{content:t.jsx(ot,{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,r]=G.useState("14d"),{org:o}=J();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=a):a=e[0];let d;e[1]!==i?(d=Qt.map(c=>t.jsx("button",{type:"button",onClick:()=>r(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:[a,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,r=Y();let o;e[0]!==r||e[1]!==i||e[2]!==n.id?(o=()=>{const p=crypto.randomUUID();r({to:"/$org/$taskId",params:{org:i,taskId:p},search:{virtualmcpid:n.id}})},e[0]=r,e[1]=i,e[2]=n.id,e[3]=o):o=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(we,{size:16}),e[4]=a):a=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:a}),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 rs(s){const e=P.c(7),{virtualMcps:n,org:i}=s;let r;if(e[0]!==i||e[1]!==n){let a;e[3]!==i?(a=d=>t.jsx(is,{virtualMcp:d,org:i},d.id),e[3]=i,e[4]=a):a=e[4],r=n.map(a),e[0]=i,e[1]=n,e[2]=r}else r=e[2];let o;return e[5]!==r?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:r})}),e[5]=r,e[6]=o):o=e[6],o}function as(s){const e=P.c(7),{connection:n}=s,{org:i}=J();let r;e[0]!==n.id?(r={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=r):r=e[1];const o=Tt(r);if(!(o.length>0)){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(t.Fragment,{}),e[2]=u):u=e[2],u}let 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(rs,{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:r}=s,o=Y(),{org:a}=J();let d;e[0]!==i||e[1]!==a.id||e[2]!==a.slug?(d={connectionId:i,orgId:a.id,orgSlug:a.slug},e[0]=i,e[1]=a.id,e[2]=a.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]!==r||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]!==r?(_=f=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(f.name)}})},e[17]=p,e[18]=o,e[19]=r,e[20]=_):_=e[20];const k=_;b="flex flex-col h-full overflow-hidden";let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=f=>{f.key==="Escape"&&(h(""),f.target.blur())},e[21]=C):C=e[21],e[22]!==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=ae(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]=r,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!!ae(s._meta)}function Te(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=a=>a.charAt(0).toUpperCase()+a.slice(1),i=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),r=e.map(n),o=e[e.length-1];return r.length>=2&&o&&i.has(o)?[r.pop(),...r].join(" "):r.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:r,connectionId:o,org:a}=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]!==r?(u=r===void 0?[]:r,e[2]=r,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]!==a?(v=function($){!o||!a||p({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:a,appSlug:g,collectionName:"tools",itemId:encodeURIComponent($)}})},e[7]=g,e[8]=o,e[9]=p,e[10]=a,e[11]=v):v=e[11];const b=v;let j;e[12]!==o||e[13]!==a||e[14]!==n?(j=o&&a&&n.some(xs),e[12]=o,e[13]=a,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]!==a||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:a})}),e[31]=o,e[32]=N,e[33]=a,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(mt,{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 ae(s._meta)}function ps(s){const e=P.c(13),{connection:n,displayTitle:i}=s,r=i??n.title;let o;e[0]!==n.icon||e[1]!==r?(o=t.jsx(oe,{icon:n.icon,name:r,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=r,e[2]=o):o=e[2];let a;e[3]!==r?(a=t.jsx("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:t.jsx("h1",{className:"text-lg md:text-xl font-semibold tracking-tight text-foreground leading-none",children:r})}),e[3]=r,e[4]=a):a=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]!==a||e[8]!==d?(l=t.jsxs("div",{className:"flex-1 min-w-0",children:[a,d]}),e[7]=a,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:r}){const o=ce({control:s.control,name:"ui_type"}),a=ce({control:s.control,name:"connection_url"}),{stdioEnabled:d}=Pe(),l=(()=>{if(typeof a!="string"||!a)return!1;try{const c=new URL(a);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(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),o!=="NPX"&&o!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(me,{value:c.value,onValueChange:c.onChange,children:[t.jsx(E,{children:t.jsxs(ue,{className:"h-full! w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(se,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(xe,{})]})}),t.jsxs(pe,{children:[t.jsx(F,{value:"HTTP",children:"HTTP"}),t.jsx(F,{value:"SSE",children:"SSE"}),t.jsx(F,{value:"Websocket",children:"Websocket"}),u&&t.jsxs(t.Fragment,{children:[t.jsx(F,{value:"NPX",children:"NPX Package"}),t.jsx(F,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(L,{control:s.control,name:"connection_url",render:({field:h})=>t.jsx(H,{className:"flex-1 min-w-0",children:t.jsx(E,{children:t.jsx(W,{placeholder:"https://example.com/mcp",...h,value:h.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(me,{value:c.value,onValueChange:c.onChange,children:[t.jsx(E,{children:t.jsx(ue,{className:"h-10",children:t.jsx(xe,{})})}),t.jsxs(pe,{children:[t.jsx(F,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(F,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(F,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"Websocket"]})}),u&&t.jsxs(t.Fragment,{children:[t.jsx(F,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Lt,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(F,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ut,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(q,{})]})}),o==="NPX"&&t.jsx(L,{control:s.control,name:"npx_package",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(E,{children:t.jsx(W,{placeholder:"@perplexity-ai/mcp-server",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(q,{})]})}),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(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(E,{children:t.jsx(W,{placeholder:"node, bun, python...",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(q,{})]})}),t.jsx(L,{control:s.control,name:"stdio_args",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(E,{children:t.jsx(W,{placeholder:"arg1 arg2 --flag value",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(q,{})]})})]}),t.jsx(L,{control:s.control,name:"stdio_cwd",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(E,{children:t.jsx(W,{placeholder:"/path/to/project (optional)",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(q,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(L,{control:s.control,name:"env_vars",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(E,{children:t.jsx(He,{value:c.value??[],onChange:c.onChange})}),t.jsx(q,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(L,{control:s.control,name:"connection_token",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:l?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Et,{children:[t.jsx(Vt,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(zt,{variant:"success",className:"gap-1.5",children:[t.jsx(Rt,{size:12}),"Authenticated via OAuth",t.jsx(Ft,{size:12})]})})}),t.jsxs(Ut,{align:"start",children:[t.jsxs(de,{onClick:i,children:[t.jsx(xt,{size:16}),"Re-authenticate"]}),t.jsxs(de,{variant:"destructive",onClick:r,children:[t.jsx(re,{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(Ht,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(E,{children:t.jsx(W,{type:"password",placeholder:l?"Paste your GitHub PAT":"Enter access token...",...c,value:c.value||"",className:"h-10 rounded-lg"})}),l&&t.jsxs(vt,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(q,{})]})})]})}function hs(s){return s.command==="npx"}function gs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function js(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function fe(s,e){const n={title:s.title,description:s.description??"",icon:s.icon??null,configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&Fe(s.connection_headers)){const i=s.connection_headers,r=qe(i.envVars);if(hs(i)){const a=gs(i);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:a,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}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:r}}return{...n,ui_type:s.connection_type,connection_url:s.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function vs(s){let e,n=null,i=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=We(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",r=Xe(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",i=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...i&&{connection_token:i},...r&&{connection_headers:r},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function bs({connection:s,connectionId:e,org:n,isUpdating:i,tools:r,prompts:o,resources:a,siblings:d}){const l=Y({from:"/$org/settings/connections/$appSlug"}),u=Ve(),x=ye(),{org:p}=J(),c=Nt({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:r},C=Ge(k,qt),f=Ue({resolver:Re(Be),values:fe(h??s)}),w=f.formState.isDirty,M=async()=>{if(!await f.trigger())return;const $=f.getValues(),D=vs($),R=h?.id??e;await x.update.mutateAsync({id:R,data:D}),f.reset($)},O=()=>{f.reset(fe(h??s))},A=async m=>{const{token:$,tokenInfo:D,error:R}=await at({connectionId:m,orgSlug:p.slug,scope:"offline_access"});if(R||!$){X.error(`Authentication failed: ${R}`);return}if(D)try{const K=await fetch(`/api/${p.slug}/connections/${m}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:D.accessToken,refreshToken:D.refreshToken,expiresIn:D.expiresIn,scope:D.scope,clientId:D.clientId,clientSecret:D.clientSecret,tokenEndpoint:D.tokenEndpoint})});if(!K.ok)console.error("Failed to save OAuth token:",await K.text()),await x.update.mutateAsync({id:m,data:{connection_token:$}});else try{await x.update.mutateAsync({id:m,data:{}})}catch(Z){console.warn("Failed to refresh connection tools after OAuth:",Z)}}catch(K){console.error("Error saving OAuth token:",K),await x.update.mutateAsync({id:m,data:{connection_token:$}})}else await x.update.mutateAsync({id:m,data:{connection_token:$}});const Q=new URL(`/api/${p.slug}/mcp/${m}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(Q.href,null)}),await u.invalidateQueries({queryKey:ne.mcpClientPrefix()}),X.success("Authentication successful")},z=()=>A(s.id),U=async()=>{try{const m=await fetch(`/api/${p.slug}/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!m.ok){const D=await m.text();X.error(`Failed to remove OAuth: ${D}`);return}const $=new URL(`/api/${p.slug}/mcp/${s.id}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated($.href,null)}),X.success("OAuth removed. You can now re-authenticate with a different account.")}catch(m){console.error("Error removing OAuth token:",m),X.error("Failed to remove OAuth")}};return t.jsxs(t.Fragment,{children:[t.jsx(yt,{...c}),t.jsx(pt,{open:h!==null,onOpenChange:m=>{m||g(null)},children:t.jsxs(ft,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(ht,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(gt,{className:"text-base",children:h?.title??s.title}),t.jsx(jt,{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(bt,{...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(H,{children:[t.jsx(B,{children:"Name"}),t.jsx(E,{children:t.jsx(W,{...m})}),t.jsx(q,{})]})}),t.jsx(L,{control:f.control,name:"description",render:({field:m})=>t.jsxs(H,{children:[t.jsx(B,{children:"Description"}),t.jsx(E,{children:t.jsx(W,{...m,value:m.value||""})}),t.jsx(q,{})]})})]}),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(re,{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:$}}),X.success($==="active"?"Connection enabled":"Connection disabled")}catch{X.error("Failed to update connection")}},isAdding:v,onAdd:async()=>{b(!0);try{const m=d[0]??s,$=m.title.replace(/\s*\(\d+\)\s*$/,""),D=d.length+1,R=`${$} (${D})`,Q=Le("conn");await x.create.mutateAsync({id:Q,title:R,description:m.description??null,connection_type:m.connection_type,connection_url:m.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:m.created_by,organization_id:m.organization_id,icon:m.icon??null,app_name:m.app_name??null,app_id:m.app_id??null,connection_headers:m.connection_headers??null,oauth_config:null,configuration_state:m.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const K=new URL(`/api/${p.slug}/mcp/${Q}`,window.location.origin),Z=await rt({url:K.href,token:null,orgId:p.id});Z.supportsOAuth&&!Z.isAuthenticated&&await A(Q)}finally{b(!1)}}}),t.jsx(as,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ds,{tools:r,prompts:o,resources:a,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:r,org:o}=ze(i),{org:a}=J(),d=ye();let l;s[2]!==r?(l={slug:r},s[2]=r,s[3]=l):l=s[3];const u=et(l),x=u[0]??null,p=x?.id??"",c=p||null;let h;s[4]!==a.id||s[5]!==a.slug||s[6]!==c?(h={connectionId:c,orgId:a.id,orgSlug:a.slug},s[4]=a.id,s[5]=a.slug,s[6]=c,s[7]=h):h=s[7];const g=_e(h);let v;s[8]!==g?(v={client:g},s[8]=g,s[9]=v):v=s[9];const{data:b}=tt(v);let j;if(s[10]!==x?.tools||s[11]!==p||s[12]!==u||s[13]!==b){const A=b?b.tools.map(ks):(x?.tools??[]).map(ws);e:{if(u.length<=1){j=A;break e}const z=new Set,U=[],m=Cs;for(const $ of u){const D=$.id===p?A:m($.tools);for(const R of D)z.has(R.name)||(z.add(R.name),U.push(R))}j=U.length>0?U:A}s[10]=x?.tools,s[11]=p,s[12]=u,s[13]=b,s[14]=j}else j=s[14];const N=j;let T;s[15]!==g?(T={client:g},s[15]=g,s[16]=T):T=s[16];const{data:S}=it(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 _o(){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{_o as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as E,c as oe,j as t,U as Ye,i as ce,a4 as be,b as _e,u as Ze,a as Ne,a1 as et,a2 as tt,Y as nt,M as st,J as ot,B as U,R as te,n as it,l as de,t as W,K as rt}from"./index-CsZhMKFM.js";import{a as lt,b as De,g as at,e as ct}from"./extract-connection-data-Di6SAuY0.js";import{C as dt}from"./collection-display-button-BVhQtAEp.js";import{S as mt}from"./search-input-BREJK7qA.js";import{C as ut}from"./collection-tabs-PTC62n_G.js";import{u as pt,a as ke,g as ht,C as Ce}from"./connection-card-CXwWR_5h.js";import{E as gt}from"./empty-state-DD15-E7x.js";import{I as xt}from"./integration-icon-6pGkEdul.js";import{P as ue}from"./index-DS3hrf0F.js";import{u as ft,D as jt}from"./use-delete-connection-BJuEHINL.js";import{u as ye}from"./use-capability-DmeYLlad.js";import{u as yt}from"./use-infinite-scroll-BTdf9pFZ.js";import{u as Ct}from"./use-view-mode-H6oFviHU.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-Bd5XLC3F.js";import{C as Fe}from"./checkbox-B-y-IHdE.js";import{e as Me,d as ze,D as Ve,a as Ee,f as Be,c as Ke}from"./dialog-DZtdYFi_.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-Ck_Oak77.js";import{u as At}from"./use-mobile-DhhfLpzh.js";import{D as Ue,a as Re,c as He,d as re}from"./dropdown-menu-C9SSwIby.js";import{F as Q,b as J,c as Y,d as Z,e as ee,a as ve}from"./form-YJrSMpNL.js";import{I as ie}from"./input-D5ccsU_1.js";import{S as wt,a as Tt,b as It,c as Pt,d as ae}from"./select-CVMXwLRV.js";import{T as $t}from"./textarea-DPLwPKZJ.js";import{b as We,u as Lt}from"./use-connection-CcLotHiI.js";import{u as Ot}from"./use-virtual-mcp-CMvxAHEJ.js";import{u as Ft}from"./studio-tools-CTswP4mA.js";import{am as Mt,ap as zt,O as Vt,N as Et}from"./agent-icon-dPkJbbXq.js";import{n as ge}from"./Tool02-CSTMjTef.js";import{i as Xe}from"./DotsVertical-CK1a4mKj.js";import{s as qe}from"./Eye-DM8bmzm7.js";import{s as je}from"./Star01-2DHf7kTZ.js";import{s as Ge}from"./Plus-Cgq7ON9K.js";import{s as Qe}from"./Trash01--uX5q_ti.js";import{s as Je}from"./XClose-D5Ra7e-f.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-POWe2kJ-.js";import{a as Wt}from"./authenticate-and-persist-oauth-ClCvWDci.js";import"./use-mcp-client-Bv8WGceO.js";import"./constants-CaIX_f5U.js";import"./auth-D_bm0-t3.js";import"./ArrowUp-CDnEKV2Y.js";import"./Check-CcLLJc-z.js";import"./SwitchHorizontal01-ilLzkPr_.js";import"./List-DfPIAPM_.js";import"./tooltip-Cs5hng3q.js";import"./view-mode-toggle-DovE7i8d.js";import"./badge-BMMjntMn.js";import"./SearchMd-ZfoTl6vw.js";import"./use-registry-connections-xg-zrNmx.js";import"./use-organization-settings-C4hP3pVq.js";import"./useInfiniteQuery-BosqZeNZ.js";import"./card-Bc92PJFP.js";import"./sidebar-DRSu2iBz.js";import"./LayoutLeft-DvNM8qhm.js";import"./X-OFSHASit.js";import"./ChevronRight-C3Tgk-3m.js";import"./Circle-C_fdyhr8.js";import"./label-BULuaMoF.js";import"./ChevronDown-BmFaSDo8.js";import"./ChevronUp-Dew3RmKl.js";import"./use-collections-Cl7KVWNQ.js";import"./AlertCircle-BsA2wZmN.js";import"./Tool01-DVCGutKV.js";import"./Settings02-CS2jOfO5.js";import"./XCircle-D3cI1Aep.js";import"./ArrowUpRight-DdPCnlNm.js";import"./TrendUp01-acR-ekUr.js";import"./ZapSquare-Dzb50Gix.js";import"./Users03-tGwfKVJc.js";import"./Loading02-Dx-xiZND.js";import"./CheckCircle-lXciCGfG.js";import"./Stars02-HLp9q8iP.js";import"./Copy01-b3lIb5yu.js";import"./ZoomOut-DYAXxr_v.js";import"./Globe01-B6kdhpV9.js";import"./FilterLines-DCNZa1GS.js";import"./Globe04-CGLGspo5.js";import"./HardDrive-CR6Rs-a1.js";import"./Key01-1r4YrQER.js";import"./LinkExternal01-Ck4lryDE.js";import"./Monitor01-D_DrBwt_.js";import"./Sun-ByaEjJ0N.js";import"./Package-CV2Q9Uup.js";import"./Palette-BY5BmUDa.js";import"./Play-Ci1OqtIO.js";import"./SearchLg-2as_l8YT.js";import"./Shield01-C6TdRfmI.js";import"./Stars01-BEHbN5c3.js";import"./Upload01-BaheeKQP.js";import"./User01-5hu8D3_O.js";import"./Users01-Dh5E4dqf.js";import"./Zap-CgjpaG4V.js";import"./mcp-oauth-z9GFPjDo.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 Ws(){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{Ws as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as n,j as i,cM as u,l as c,bP as m,cL as x,cN as j,cO as N,cQ as b,cZ as D,cP as g}from"./index-CsZhMKFM.js";import{i as h}from"./X-OFSHASit.js";function z(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(u,{"data-slot":"dialog",...t}),e[2]=t,e[3]=s):s=e[3],s}function k(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(D,{"data-slot":"dialog-trigger",...t}),e[2]=t,e[3]=s):s=e[3],s}function v(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(N,{"data-slot":"dialog-portal",...t}),e[2]=t,e[3]=s):s=e[3],s}function w(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(g,{"data-slot":"dialog-close",...t}),e[2]=t,e[3]=s):s=e[3],s}function y(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/45 backdrop-blur-[0.15px]",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(b,{"data-slot":"dialog-overlay",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function $(l){const e=n.c(6),{className:t}=l;let s;e[0]!==t?(s=c("cursor-pointer ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground","absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2","focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[0]=t,e[1]=s):s=e[1];let a,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(h,{}),o=i.jsx("span",{className:"sr-only",children:"Close"}),e[2]=a,e[3]=o):(a=e[2],o=e[3]);let r;return e[4]!==s?(r=i.jsxs(g,{className:s,children:[a,o]}),e[4]=s,e[5]=r):r=e[5],r}function P(l){const e=n.c(15);let t,s,a,o;e[0]!==l?({className:s,children:t,closeButtonClassName:a,...o}=l,e[0]=l,e[1]=t,e[2]=s,e[3]=a,e[4]=o):(t=e[1],s=e[2],a=e[3],o=e[4]);let r;e[5]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(y,{}),e[5]=r):r=e[5];let d;e[6]!==s?(d=c("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border p-6 shadow-md duration-200 sm:max-w-lg",s),e[6]=s,e[7]=d):d=e[7];let f;e[8]!==a?(f=i.jsx($,{className:a}),e[8]=a,e[9]=f):f=e[9];let p;return e[10]!==t||e[11]!==o||e[12]!==d||e[13]!==f?(p=i.jsxs(v,{"data-slot":"dialog-portal",children:[r,i.jsxs(m,{"data-slot":"dialog-content",className:d,...o,children:[t,f]})]}),e[10]=t,e[11]=o,e[12]=d,e[13]=f,e[14]=p):p=e[14],p}function T(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("flex flex-col gap-2 text-center sm:text-left",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx("div",{"data-slot":"dialog-header",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function O(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx("div",{"data-slot":"dialog-footer",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function R(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("text-lg leading-none font-semibold",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(x,{"data-slot":"dialog-title",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function B(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("text-muted-foreground text-sm",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(j,{"data-slot":"dialog-description",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}export{T as D,R as a,k as b,O as c,P as d,z as e,B as f,w as g,v as h,y as i};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as X,a4 as H,n as U,r as W,K as J,m as ee,d as Z,R as te,t as p,j as i,B as $}from"./index-CsZhMKFM.js";import{u as ie}from"./studio-tools-CTswP4mA.js";import{b as se,S as ne,a as oe}from"./settings-section-BYCtjEaG.js";import{B as Q}from"./badge-BMMjntMn.js";import{I as ae}from"./input-D5ccsU_1.js";import{S as re,a as le,b as ce,c as de,d as me}from"./select-CVMXwLRV.js";const ue={off:"Off",auto:"Auto-join",request:"Require approval"};function fe(e,t){switch(e){case"auto":return`Anyone with a verified @${t} email joins automatically.`;case"request":return`People with a verified @${t} email can request to join; an admin approves.`;default:return"Not discoverable — no one can find or join through this domain."}}function be(){const e=X.c(69),{org:t}=H(),u=U(),s=ie(),[l,x]=W.useState("");let r;e[0]!==t.id?(r=J.organizationDomains(t.id),e[0]=t.id,e[1]=r):r=e[1];let c;e[2]!==s?(c=()=>s.call("ORGANIZATION_DOMAIN_LIST",{}),e[2]=s,e[3]=c):c=e[3];let d;e[4]!==r||e[5]!==c?(d={queryKey:r,queryFn:c},e[4]=r,e[5]=c,e[6]=d):d=e[6];const{data:f,isPending:j}=ee(d);let m;e[7]!==t.id||e[8]!==u?(m=()=>u.invalidateQueries({queryKey:J.organizationDomains(t.id)}),e[7]=t.id,e[8]=u,e[9]=m):m=e[9];const n=m;let N;e[10]!==s?(N=o=>s.call("ORGANIZATION_DOMAIN_ADD",{domain:o}),e[10]=s,e[11]=N):N=e[11];let v;e[12]!==n||e[13]!==t.id?(v=()=>{te("organization_domain_added",{organization_id:t.id}),x(""),n(),p.success("Domain added")},e[12]=n,e[13]=t.id,e[14]=v):v=e[14];let P;e[15]!==N||e[16]!==v?(P={mutationFn:N,onSuccess:v,onError:je},e[15]=N,e[16]=v,e[17]=P):P=e[17];const h=Z(P);let S;e[18]!==s?(S=o=>{const{id:a,joinMode:g}=o;return s.call("ORGANIZATION_DOMAIN_UPDATE",{id:a,joinMode:g})},e[18]=s,e[19]=S):S=e[19];let y;e[20]!==n?(y=()=>{n(),p.success("Join mode updated")},e[20]=n,e[21]=y):y=e[21];let V;e[22]!==S||e[23]!==y?(V={mutationFn:S,onSuccess:y,onError:ge},e[22]=S,e[23]=y,e[24]=V):V=e[24];const F=Z(V);let _;e[25]!==s?(_=o=>s.call("ORGANIZATION_DOMAIN_VERIFY",{id:o}),e[25]=s,e[26]=_):_=e[26];let A;e[27]!==n?(A=o=>{n(),o.verified?p.success("Domain verified"):p.error("TXT record not found yet — DNS can take a few minutes.")},e[27]=n,e[28]=A):A=e[28];let k;e[29]!==_||e[30]!==A?(k={mutationFn:_,onSuccess:A,onError:he},e[29]=_,e[30]=A,e[31]=k):k=e[31];const D=Z(k);let I;e[32]!==s?(I=o=>s.call("ORGANIZATION_DOMAIN_REMOVE",{id:o}),e[32]=s,e[33]=I):I=e[33];let b;e[34]!==n?(b=()=>{n(),p.success("Domain removed")},e[34]=n,e[35]=b):b=e[35];let q;e[36]!==I||e[37]!==b?(q={mutationFn:I,onSuccess:b,onError:xe},e[36]=I,e[37]=b,e[38]=q):q=e[38];const E=Z(q);if(j)return null;let z;e[39]!==f?.domains?(z=f?.domains??[],e[39]=f?.domains,e[40]=z):z=e[40];const K=z;let O;if(e[41]!==K||e[42]!==E||e[43]!==F||e[44]!==D){let o;e[46]!==E||e[47]!==F||e[48]!==D?(o=a=>{const g=a.verificationStatus==="verified";return i.jsx(se,{title:i.jsxs("span",{className:"flex items-center gap-2",children:[a.domain,g?i.jsx(Q,{variant:"secondary",children:"Verified"}):i.jsx(Q,{variant:"outline",children:"Pending"})]}),description:g?fe(a.joinMode,a.domain):"Add the DNS record below, then verify.",action:i.jsxs("div",{className:"flex items-center gap-2",children:[g&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:"Join mode"}),i.jsxs(re,{value:a.joinMode,onValueChange:Y=>F.mutate({id:a.id,joinMode:Y}),children:[i.jsx(le,{className:"w-44",size:"sm",children:i.jsx(ce,{})}),i.jsx(de,{children:["off","auto","request"].map(pe)})]})]}),!g&&i.jsx($,{size:"sm",variant:"outline",onClick:()=>D.mutate(a.id),disabled:D.isPending,children:"Verify"}),i.jsx($,{size:"sm",variant:"ghost",onClick:()=>E.mutate(a.id),disabled:E.isPending,children:"Remove"})]}),children:!g&&a.recordName&&a.recordValue&&i.jsx(Ne,{recordName:a.recordName,recordValue:a.recordValue})},a.id)},e[46]=E,e[47]=F,e[48]=D,e[49]=o):o=e[49],O=K.map(o),e[41]=K,e[42]=E,e[43]=F,e[44]=D,e[45]=O}else O=e[45];let B;e[50]===Symbol.for("react.memo_cache_sentinel")?(B=o=>x(o.target.value),e[50]=B):B=e[50];let M;e[51]!==l?(M=i.jsx(ae,{value:l,onChange:B,placeholder:"acme.com",className:"max-w-xs"}),e[51]=l,e[52]=M):M=e[52];let T;e[53]!==h||e[54]!==l?(T=()=>h.mutate(l.trim()),e[53]=h,e[54]=l,e[55]=T):T=e[55];let C;e[56]!==h.isPending||e[57]!==l?(C=!l.trim()||h.isPending,e[56]=h.isPending,e[57]=l,e[58]=C):C=e[58];const L=h.isPending?"Adding…":"Add domain";let R;e[59]!==T||e[60]!==C||e[61]!==L?(R=i.jsx($,{size:"sm",onClick:T,disabled:C,children:L}),e[59]=T,e[60]=C,e[61]=L,e[62]=R):R=e[62];let w;e[63]!==M||e[64]!==R?(w=i.jsxs("div",{className:"flex items-center gap-2 p-4",children:[M,R]}),e[63]=M,e[64]=R,e[65]=w):w=e[65];let G;return e[66]!==O||e[67]!==w?(G=i.jsx(ne,{title:"Email domains",description:"Let people with a matching email domain discover and join this organization.",children:i.jsxs(oe,{children:[O,w]})}),e[66]=O,e[67]=w,e[68]=G):G=e[68],G}function pe(e){return i.jsx(me,{value:e,children:ue[e]},e)}function xe(e){return p.error(e instanceof Error?e.message:"Failed to remove")}function he(e){return p.error(e instanceof Error?e.message:"Failed to verify")}function ge(e){return p.error(e instanceof Error?e.message:"Failed to update")}function je(e){return p.error(e instanceof Error?e.message:"Failed to add domain")}function Ne(e){const t=X.c(16),{recordName:u,recordValue:s}=e,l=ve;let x;t[0]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx("p",{className:"text-muted-foreground",children:"Add this TXT record at your DNS provider, then click Verify:"}),t[0]=x):x=t[0];let r;t[1]!==u?(r=()=>l(u),t[1]=u,t[2]=r):r=t[2];let c;t[3]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx("span",{className:"text-muted-foreground",children:"TXT "}),t[3]=c):c=t[3];let d;t[4]!==u||t[5]!==r?(d=i.jsxs("button",{type:"button",className:"text-left font-mono break-all hover:underline",onClick:r,children:[c,u]}),t[4]=u,t[5]=r,t[6]=d):d=t[6];let f;t[7]!==s?(f=()=>l(s),t[7]=s,t[8]=f):f=t[8];let j;t[9]===Symbol.for("react.memo_cache_sentinel")?(j=i.jsx("span",{className:"text-muted-foreground",children:"value "}),t[9]=j):j=t[9];let m;t[10]!==s||t[11]!==f?(m=i.jsxs("button",{type:"button",className:"text-left font-mono break-all hover:underline",onClick:f,children:[j,s]}),t[10]=s,t[11]=f,t[12]=m):m=t[12];let n;return t[13]!==d||t[14]!==m?(n=i.jsxs("div",{className:"mt-3 rounded-lg border border-border bg-muted/40 p-3 text-xs space-y-2",children:[x,i.jsxs("div",{className:"grid gap-1",children:[d,m]})]}),t[13]=d,t[14]=m,t[15]=n):n=t[15],n}function ve(e){navigator.clipboard?.writeText(e),p.success("Copied")}export{be as D};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as K,a4 as V,n as M,M as Q,J as Y,d as U,R as F,t as w,K as L,j as a,af as $,H as Z,I as T,c as O,r as B,B as H,Y as q,X as J}from"./index-CsZhMKFM.js";import{P as k}from"./index-DS3hrf0F.js";import{u as X}from"./use-org-auth-client-DYoTiK8H.js";import{u as W}from"./use-debounced-autosave-teletZQd.js";import{A as ee}from"./avatar-DOYkgu8W.js";import{I as G}from"./input-D5ccsU_1.js";import{S as P,a as I,b as _,c as te}from"./settings-section-BYCtjEaG.js";import{D as ae}from"./domain-settings-C7CfCyw6.js";import{S as ne}from"./switch-B36ltQ63.js";import{c as se,f as oe}from"./use-organization-settings-C4hP3pVq.js";import{u as ie}from"./studio-tools-CTswP4mA.js";import{c as re,b as le,d as ce,A as de,e as ue,g as me,a as ge,f as fe}from"./alert-dialog-Bd5XLC3F.js";import{R as pe}from"./require-capability-BjscC7QS.js";import"./sidebar-DRSu2iBz.js";import"./LayoutLeft-DvNM8qhm.js";import"./use-mobile-DhhfLpzh.js";import"./X-OFSHASit.js";import"./tooltip-Cs5hng3q.js";import"./User01-5hu8D3_O.js";import"./card-Bc92PJFP.js";import"./ArrowUpRight-DdPCnlNm.js";import"./badge-BMMjntMn.js";import"./select-CVMXwLRV.js";import"./Check-CcLLJc-z.js";import"./ChevronDown-BmFaSDo8.js";import"./ChevronUp-Dew3RmKl.js";import"./constants-CaIX_f5U.js";import"./use-capability-DmeYLlad.js";import"./access-gate-B4XS-sin.js";import"./capability-load-error-COzn8-Xb.js";const he=new Set([".well-known","_admin","api","auth","cli","commerce-onboarding","dbos-queue-depth","health","hosted-run-pending","login","mcp","metrics","oauth","oauth-proxy","onboarding","org","report","reset-password"]);function xe(e){return typeof e=="string"&&he.has(e.trim().toLowerCase())}const je=Z({name:T().min(1,"Name is required").max(255,"Name is too long"),slug:T().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens").refine(e=>!xe(e),"This organization URL is reserved by Studio"),logo:T().optional()});function be(e){const t=O.c(13),{value:f,onChange:d,name:s,disabled:l}=e,u=B.useRef(null);let c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>u.current?.click(),t[0]=c):c=t[0];const r=c;let m;t[1]!==d?(m=j=>{const b=j.target.files?.[0];if(!b)return;if(b.size>2097152){w.error("Image must be smaller than 2MB");return}const g=new FileReader;g.onerror=ye,g.onloadend=()=>{g.result&&d(g.result),u.current&&(u.current.value="")},g.readAsDataURL(b)},t[1]=d,t[2]=m):m=t[2];const n=m;let o;t[3]!==l||t[4]!==n?(o=a.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:n,className:"hidden",disabled:l}),t[3]=l,t[4]=n,t[5]=o):o=t[5];const i=f||void 0,x=s??"?";let p;t[6]!==i||t[7]!==x?(p=a.jsx(ee,{url:i,fallback:x,shape:"square",size:"base"}),t[6]=i,t[7]=x,t[8]=p):p=t[8];let h;return t[9]!==l||t[10]!==o||t[11]!==p?(h=a.jsxs("button",{type:"button",onClick:r,disabled:l,className:"rounded-lg overflow-hidden hover:ring-2 hover:ring-border transition-all disabled:opacity-50","aria-label":"Upload organization logo",children:[o,p]}),t[9]=l,t[10]=o,t[11]=p,t[12]=h):h=t[12],h}function ye(){return w.error("Failed to read image")}function ve(){const e=K(),{org:t}=V(),f=X(),d=M(),s=Q({resolver:Y(je),values:{name:t.name??"",slug:t.slug??"",logo:t.logo??""}}),l=U({mutationFn:async n=>{const o={name:n.name,slug:n.slug};n.logo&&(o.logo=n.logo);const i=await f.organization.update({data:o});if(i?.error)throw new Error(i.error.message||"Failed to update organization");return i},onSuccess:(n,o)=>{F("organization_settings_updated",{organization_id:t.id,fields:Object.keys(o)}),d.invalidateQueries({queryKey:L.organizations()}),d.invalidateQueries({queryKey:L.activeOrganization(t.slug)}),w.success("Organization updated successfully"),n?.data?.slug&&n.data.slug!==t.slug&&e({to:"/$org/settings/general",params:{org:n.data.slug}})},onError:(n,o)=>{F("organization_settings_update_failed",{organization_id:t.id,fields:Object.keys(o),error:n instanceof Error?n.message:String(n)}),w.error(n instanceof Error?n.message:"Failed to update organization")}}),{schedule:u,flush:c}=W({save:async()=>{const n=s.control._formState.dirtyFields;if(Object.keys(n).length===0||!await s.trigger())return;const i=s.getValues(),x=s.control._defaultValues;s.reset(i,{keepValues:!0});try{await l.mutateAsync(i)}catch{s.reset(x,{keepValues:!0})}}}),r=s.formState.errors,m=typeof window<"u"?`${window.location.host}/`:"";return a.jsx(P,{children:a.jsxs(I,{children:[a.jsx(_,{title:"Logo",description:"Recommended size is 256x256px",action:a.jsx(be,{value:s.watch("logo"),onChange:n=>{s.setValue("logo",n??"",{shouldDirty:!0}),c()},name:s.watch("name")})}),a.jsx(_,{title:"Name",action:a.jsx($,{control:s.control,name:"name",render:({field:n})=>a.jsx(G,{id:"org-name",...n,onChange:o=>{n.onChange(o),u()},onBlur:()=>{n.onBlur(),c()},placeholder:"Organization name",className:"w-[280px]"})})}),a.jsx(_,{title:"URL",action:a.jsxs("div",{className:"flex items-center w-[280px] rounded-md border border-input bg-input/30 focus-within:ring-2 focus-within:ring-ring/50 overflow-hidden",children:[m&&a.jsx("span",{className:"pl-3 text-sm text-muted-foreground select-none",children:m}),a.jsx($,{control:s.control,name:"slug",render:({field:n})=>a.jsx("input",{id:"org-slug",value:n.value??"",name:n.name,ref:n.ref,placeholder:"my-organization",className:"flex-1 min-w-0 bg-transparent px-2 py-1.5 text-sm text-foreground placeholder:text-muted-foreground/60 outline-none",onChange:o=>{const i=o.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");s.setValue("slug",i,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0}),u()},onBlur:()=>{n.onBlur(),c()}})})]})}),(r.name||r.slug||r.logo)&&a.jsxs("div",{className:"px-5 pb-3 flex flex-col gap-1",children:[r.name&&a.jsx("p",{className:"text-xs text-destructive",children:r.name.message}),r.slug&&a.jsx("p",{className:"text-xs text-destructive",children:r.slug.message}),r.logo&&a.jsx("p",{className:"text-xs text-destructive",children:r.logo.message})]})]})})}function Se(){const e=O.c(6),t=se(),{mutate:f,isPending:d}=oe();let s;e[0]!==f?(s=u=>f(u),e[0]=f,e[1]=s):s=e[1];let l;return e[2]!==t||e[3]!==d||e[4]!==s?(l=a.jsx(P,{title:"Task board",description:"A board for tracking org tasks by status, priority, and assignee.",children:a.jsx(I,{children:a.jsx(_,{title:"Enable task board",description:"Adds a Board entry to the sidebar for this organization.",action:a.jsx(ne,{checked:t,disabled:d,onCheckedChange:s})})})}),e[2]=t,e[3]=d,e[4]=s,e[5]=l):l=e[5],l}function ze(){const e=O.c(42),{org:t}=V(),[f,d]=B.useState(!1),[s,l]=B.useState(""),u=ie();let c;e[0]!==t.id||e[1]!==u?(c=async()=>{await u.call("ORGANIZATION_DELETE",{id:t.id})},e[0]=t.id,e[1]=u,e[2]=c):c=e[2];let r;e[3]!==t.id||e[4]!==t.slug?(r=()=>{F("organization_deleted",{organization_id:t.id}),localStorage.getItem(q.lastOrgSlug())===t.slug&&localStorage.removeItem(q.lastOrgSlug()),J(),w.success("Organization deleted"),window.location.href="/"},e[3]=t.id,e[4]=t.slug,e[5]=r):r=e[5];let m;e[6]!==c||e[7]!==r?(m={mutationFn:c,onSuccess:r,onError:Ce},e[6]=c,e[7]=r,e[8]=m):m=e[8];const n=U(m);let o;e[9]===Symbol.for("react.memo_cache_sentinel")?(o=()=>d(!0),e[9]=o):o=e[9];let i;e[10]!==n.isPending?(i=a.jsx(P,{title:"Danger Zone",description:"Irreversible actions that affect your entire organization.",children:a.jsx(I,{className:"border-destructive/40",children:a.jsx(_,{title:"Delete organization",description:"Permanently delete this organization and all of its data. This action cannot be undone.",action:a.jsx(H,{variant:"destructive",size:"sm",onClick:o,disabled:n.isPending,children:"Delete"})})})}),e[10]=n.isPending,e[11]=i):i=e[11];let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=N=>{d(N),N||l("")},e[12]=x):x=e[12];let p;e[13]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsx(re,{children:"Delete Organization?"}),e[13]=p):p=e[13];let h;e[14]!==t.name?(h=a.jsxs("p",{children:["This will permanently delete all data associated with"," ",a.jsx("span",{className:"font-medium text-foreground",children:t.name}),". This action cannot be undone."]}),e[14]=t.name,e[15]=h):h=e[15];let j;e[16]!==t.name?(j=a.jsxs("p",{className:"mt-3 mb-1.5",children:["Type"," ",a.jsx("span",{className:"font-medium text-foreground",children:t.name})," ","to confirm:"]}),e[16]=t.name,e[17]=j):j=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=N=>l(N.target.value),e[18]=b):b=e[18];let g;e[19]!==s||e[20]!==t.name?(g=a.jsx(G,{value:s,onChange:b,placeholder:t.name,autoFocus:!0}),e[19]=s,e[20]=t.name,e[21]=g):g=e[21];let y;e[22]!==g||e[23]!==h||e[24]!==j?(y=a.jsxs(le,{children:[p,a.jsx(ce,{asChild:!0,children:a.jsxs("div",{children:[h,j,g]})})]}),e[22]=g,e[23]=h,e[24]=j,e[25]=y):y=e[25];let D;e[26]===Symbol.for("react.memo_cache_sentinel")?(D=a.jsx(de,{children:"Cancel"}),e[26]=D):D=e[26];let v;e[27]!==n?(v=()=>n.mutate(),e[27]=n,e[28]=v):v=e[28];const E=s!==t.name||n.isPending,R=n.isPending?"Deleting…":"Delete organization";let S;e[29]!==v||e[30]!==E||e[31]!==R?(S=a.jsxs(ue,{children:[D,a.jsx(me,{onClick:v,disabled:E,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:opacity-50",children:R})]}),e[29]=v,e[30]=E,e[31]=R,e[32]=S):S=e[32];let z;e[33]!==y||e[34]!==S?(z=a.jsxs(ge,{children:[y,S]}),e[33]=y,e[34]=S,e[35]=z):z=e[35];let C;e[36]!==f||e[37]!==z?(C=a.jsx(fe,{open:f,onOpenChange:x,children:z}),e[36]=f,e[37]=z,e[38]=C):C=e[38];let A;return e[39]!==C||e[40]!==i?(A=a.jsxs(a.Fragment,{children:[i,C]}),e[39]=C,e[40]=i,e[41]=A):A=e[41],A}function Ce(e){w.error(e instanceof Error?e.message:"Failed to delete organization")}function we(){const e=O.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=a.jsx(k,{children:a.jsx(k.Content,{children:a.jsx(k.Body,{children:a.jsxs(te,{children:[a.jsx(k.Title,{children:"Organization"}),a.jsx(ve,{}),a.jsx(ae,{}),a.jsx(Se,{}),a.jsx(ze,{})]})})})}),e[0]=t):t=e[0],t}function at(){const e=O.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=a.jsx(pe,{capability:"org:manage",area:"general settings",children:a.jsx(we,{})}),e[0]=t):t=e[0],t}export{at as default};
|