decocms 4.1.0 → 4.3.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-BaBhmaDx.js → AlertCircle-DC-zDzV-.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-DNjO3rKJ.js → ArrowUpRight-OJZisFPQ.js} +1 -1
- package/dist/client/assets/{CheckCircle-CjTnfISE.js → CheckCircle-Cgnheu-R.js} +1 -1
- package/dist/client/assets/{ChevronDown-B2-IVVeA.js → ChevronDown-DyHvxYlc.js} +1 -1
- package/dist/client/assets/{ChevronLeft-DIgPkg8j.js → ChevronLeft-dyRjFCmp.js} +1 -1
- package/dist/client/assets/{ChevronRight-Bfy1FDwZ.js → ChevronRight-Cpfh3gza.js} +1 -1
- package/dist/client/assets/{ChevronUp-BOjHpJve.js → ChevronUp-DBpw6M-L.js} +1 -1
- package/dist/client/assets/{DotsVertical-Dqo19PDu.js → DotsVertical-5jSu3d1f.js} +1 -1
- package/dist/client/assets/{Eye-D65NNYL_.js → Eye-bojNLUjA.js} +1 -1
- package/dist/client/assets/{FilterLines-DatNss5g.js → FilterLines-CFl65nng.js} +1 -1
- package/dist/client/assets/{Globe01-Dr5de9U6.js → Globe01-CyfpzbeQ.js} +1 -1
- package/dist/client/assets/{Globe04-B6q-BGyJ.js → Globe04-DFpdKSRI.js} +1 -1
- package/dist/client/assets/{HardDrive-DgOUq6_i.js → HardDrive-B1mtnaeA.js} +1 -1
- package/dist/client/assets/{Key01-B19q_ad0.js → Key01-CwrJlZo0.js} +1 -1
- package/dist/client/assets/{LayoutLeft-C98dANsK.js → LayoutLeft-fsm0LcB8.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BsIWK8-O.js → LinkExternal01-BHwVyDja.js} +1 -1
- package/dist/client/assets/{Monitor01-DCzcFpUw.js → Monitor01-ChA6ov2I.js} +1 -1
- package/dist/client/assets/{Palette-YXNlPWMb.js → Palette-DusYqL0W.js} +1 -1
- package/dist/client/assets/{Play-DeTc-Zz9.js → Play-CnXG8qqP.js} +1 -1
- package/dist/client/assets/{Plus-DKGLRRwi.js → Plus-eGxBB1d8.js} +1 -1
- package/dist/client/assets/{SearchLg-MADdv080.js → SearchLg-CDpA_lbT.js} +1 -1
- package/dist/client/assets/{SearchMd-Cihv3ptw.js → SearchMd-ujiTPCmg.js} +1 -1
- package/dist/client/assets/{Settings02-DKMqfZtL.js → Settings02-BcAnTzm5.js} +1 -1
- package/dist/client/assets/{Shield01-C5iqi6W7.js → Shield01-ZxmFmrvL.js} +1 -1
- package/dist/client/assets/{Star01-2VCD2LhQ.js → Star01-DHEkWySe.js} +1 -1
- package/dist/client/assets/{Stars01-BmrQl2P4.js → Stars01-BdCaKqhF.js} +1 -1
- package/dist/client/assets/{Stars02-BI3Do82b.js → Stars02-qnq-_X9g.js} +1 -1
- package/dist/client/assets/{Sun-ElP5FqvE.js → Sun-lTiqxOzH.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-BSH4xITx.js → SwitchHorizontal01-DAZXInW8.js} +1 -1
- package/dist/client/assets/{Tool01-pUgv0TL7.js → Tool01-CvnpFI53.js} +1 -1
- package/dist/client/assets/{Trash01-CFBK1BIu.js → Trash01-ByxlxTiZ.js} +1 -1
- package/dist/client/assets/{Upload01-Dtg-yEBy.js → Upload01-Z77n1bV8.js} +1 -1
- package/dist/client/assets/{User01-BtP5IntS.js → User01-COQtf360.js} +1 -1
- package/dist/client/assets/{Users01-BEOpwt_F.js → Users01-wtRJYQKX.js} +1 -1
- package/dist/client/assets/{Users03-ymmDn6VM.js → Users03-DknrDMtT.js} +1 -1
- package/dist/client/assets/{X-Br9r-9dE.js → X-DrMVHLcw.js} +1 -1
- package/dist/client/assets/{XCircle-bxIVw0YP.js → XCircle-Ct0eqqsw.js} +1 -1
- package/dist/client/assets/{XClose-B2hyMh3-.js → XClose-BaZ908gw.js} +1 -1
- package/dist/client/assets/{Zap-xkxfehI_.js → Zap-wRIFSWIq.js} +1 -1
- package/dist/client/assets/{ZapSquare-l2K3uFV1.js → ZapSquare-PMiGcZpW.js} +1 -1
- package/dist/client/assets/{ZoomOut-enqpUlCT.js → ZoomOut-6ix2H92j.js} +1 -1
- package/dist/client/assets/{access-gate-DBrVtVof.js → access-gate-D6dGDGRI.js} +1 -1
- package/dist/client/assets/{add-section-modal-Eg_15M6F.js → add-section-modal-DOhGqRCL.js} +1 -1
- package/dist/client/assets/{agent-icon-hsuTqZxe.js → agent-icon-oDx9Z_Be.js} +1 -1
- package/dist/client/assets/agents-list-BgSM_QG_.js +1 -0
- package/dist/client/assets/{ai-providers-BgAwdUBv.js → ai-providers-Crp7kidL.js} +1 -1
- package/dist/client/assets/{alert-C_hUTTMZ.js → alert-CKj_5smu.js} +1 -1
- package/dist/client/assets/{alert-dialog-CI55N51-.js → alert-dialog-CYizItFp.js} +2 -2
- package/dist/client/assets/app-editor-Xoia35dq.js +1 -0
- package/dist/client/assets/{auth-DvUMABem.js → auth-Bej0Tx2Y.js} +1 -1
- package/dist/client/assets/{auth-catchall-9kpX6dgz.js → auth-catchall-CmNVpp-8.js} +1 -1
- package/dist/client/assets/{auth-entry-DWecZ1OK.js → auth-entry-PwLVm-jX.js} +1 -1
- package/dist/client/assets/{auth-split-layout-cQeN5qeS.js → auth-split-layout-5YwPgbAb.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-Ymc5O_Vd.js → authenticate-and-persist-oauth-DoPUB_Bh.js} +1 -1
- package/dist/client/assets/{automation-list-row-QpWYDjXL.js → automation-list-row-CsTyBm4M.js} +1 -1
- package/dist/client/assets/{automation-runs-DfOYdlGn.js → automation-runs-B-dNDEWH.js} +1 -1
- package/dist/client/assets/{automations-BMviwJJQ.js → automations-D395202A.js} +1 -1
- package/dist/client/assets/{avatar-D4JfZsUc.js → avatar-CJP1BOq4.js} +1 -1
- package/dist/client/assets/{badge-DfhROXCy.js → badge-DhpSM7g_.js} +1 -1
- package/dist/client/assets/{block-document-1NXGItBf.js → block-document-B2vhG8Ii.js} +1 -1
- package/dist/client/assets/{brand-context-UTiEbcYn.js → brand-context-BRpHgxfT.js} +1 -1
- package/dist/client/assets/{buckets-BBjHWSi-.js → buckets-DDR0G33f.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-CAuhq72s.js → bulk-category-panel-CM1bMunr.js} +1 -1
- package/dist/client/assets/{capability-load-error-DsWR4_Z3.js → capability-load-error-CCgNL5xi.js} +1 -1
- package/dist/client/assets/{card-CPcIzYlK.js → card-BFb5m83e.js} +1 -1
- package/dist/client/assets/category-editor-2T4Y_ABL.js +1 -0
- package/dist/client/assets/{chat-context-Czo9E0-_.js → chat-context-n9syhvq-.js} +4 -4
- package/dist/client/assets/{checkbox-DWPssgB9.js → checkbox-DmOzmKLP.js} +1 -1
- package/dist/client/assets/{cli-auth-success-CDCYU6bC.js → cli-auth-success-BVPtMYcv.js} +1 -1
- package/dist/client/assets/{collection-detail-D9EcTINE.js → collection-detail-BQKV3UU7.js} +1 -1
- package/dist/client/assets/{collection-display-button-CBbtUTuq.js → collection-display-button-Bf9dlJRy.js} +1 -1
- package/dist/client/assets/{collection-search-B6vccvYM.js → collection-search-8iNXnGlM.js} +1 -1
- package/dist/client/assets/{collection-tabs-DbaekYCc.js → collection-tabs-KA2be3wH.js} +1 -1
- package/dist/client/assets/{command-D0wdDp_f.js → command-C34397s2.js} +1 -1
- package/dist/client/assets/commerce-onboarding-D2H83R0U.js +1 -0
- package/dist/client/assets/{connect-desktop-dialog-zT24ZiUH.js → connect-desktop-dialog-Brra3cMC.js} +1 -1
- package/dist/client/assets/{connection-card-2qrXQffT.js → connection-card-C6NYo4Gp.js} +1 -1
- package/dist/client/assets/{connection-detail-C1PyHf1h.js → connection-detail-gJ5ITUXe.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-C_cmSxxe.js → connection-form-helpers-CwZx7WkC.js} +1 -1
- package/dist/client/assets/{connections-CnV7OL1A.js → connections-CicrEJbU.js} +1 -1
- package/dist/client/assets/{context-menu-B5J5LrrP.js → context-menu-BW_OZBmV.js} +1 -1
- package/dist/client/assets/{decopilot-pjhPwnCi.js → decopilot-BItqS11w.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-CTef3f0J.js → decopilot-sse-pool-CvYk1hkc.js} +1 -1
- package/dist/client/assets/{dialog-BzNIgTeH.js → dialog-BAqFyO8a.js} +1 -1
- package/dist/client/assets/{domain-settings-Dnv8mw6p.js → domain-settings-r_E3rHsG.js} +1 -1
- package/dist/client/assets/{drawer-BrhaY2IO.js → drawer-CFkqEC3w.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BFym91nE.js → dropdown-menu-C62KNjwK.js} +1 -1
- package/dist/client/assets/{empty-state-BCJ4vHXV.js → empty-state-Sh_DuDcy.js} +1 -1
- package/dist/client/assets/{extract-connection-data-DssjagpB.js → extract-connection-data-D6bQrejT.js} +1 -1
- package/dist/client/assets/file-explorer-C8pgfKCz.js +2 -0
- package/dist/client/assets/{file-type-icon-DhTbfG3U.js → file-type-icon-DPWxBpNL.js} +1 -1
- package/dist/client/assets/{files-LJRGP-Ec.js → files-B9ekmQa_.js} +1 -1
- package/dist/client/assets/{form-Bhlzmyq6.js → form-DGE2mWLL.js} +1 -1
- package/dist/client/assets/{general-DeFs4Yjj.js → general-BMDKtyZB.js} +1 -1
- package/dist/client/assets/github-installations-DzN1UQ4x.js +1 -0
- package/dist/client/assets/github-repo-picker-B5tZucJa.js +1 -0
- package/dist/client/assets/{hooks-Cd2kFdlt.js → hooks-CUSV6Enf.js} +1 -1
- package/dist/client/assets/{import-from-deco-dialog-DKfqgTkF.js → import-from-deco-dialog-M3CP3Gmn.js} +2 -2
- package/dist/client/assets/index-B2yJy2sB.js +1 -0
- package/dist/client/assets/{index-FHmyWVzU.js → index-B6hcksS9.js} +1 -1
- package/dist/client/assets/{index-Dpmr0M94.js → index-Bb-tYGNK.js} +1 -1
- package/dist/client/assets/index-BqKQnks_.css +1 -0
- package/dist/client/assets/{index-5m2iNk2S.js → index-CFiyU0D9.js} +4 -4
- package/dist/client/assets/index-CRxAjd1d.js +513 -0
- package/dist/client/assets/{index-Cv4h6I9w.js → index-CkTyYAY1.js} +1 -1
- package/dist/client/assets/{index-BHrf6n_h.js → index-DGzNvPy2.js} +1 -1
- package/dist/client/assets/{index-DxiTsSES.js → index-DIBoN36v.js} +1 -1
- package/dist/client/assets/{index-C0lGxF3K.js → index-DQnTjiix.js} +1 -1
- package/dist/client/assets/{index-DV6NJ2GS.js → index-D_S_Rq8A.js} +1 -1
- package/dist/client/assets/{index-DFS8FrMi.js → index-Dj7TxcSd.js} +1 -1
- package/dist/client/assets/{index-ZIojZmHZ.js → index-hmJjUPum.js} +1 -1
- package/dist/client/assets/{index-zLB_-ncb.js → index-jBUpmiBg.js} +1 -1
- package/dist/client/assets/{index-LggnGz75.js → index-mEtg0zTM.js} +1 -1
- package/dist/client/assets/{index-redirect-I6GDJptT.js → index-redirect-C9Kkmz45.js} +1 -1
- package/dist/client/assets/{input-BIG9H9YK.js → input-BwRH-Gsz.js} +1 -1
- package/dist/client/assets/{integration-icon-CdzRdmGY.js → integration-icon-LQhkkaLl.js} +1 -1
- package/dist/client/assets/{label-DeQNhkMu.js → label-CdBSUJpf.js} +1 -1
- package/dist/client/assets/{login-DL0jcR3l.js → login-d0UWtw9N.js} +1 -1
- package/dist/client/assets/{mcp-oauth-Ja50aKYo.js → mcp-oauth-IblqU9XT.js} +1 -1
- package/dist/client/assets/{members-DyqFK1yT.js → members-Bpdrl2e9.js} +1 -1
- package/dist/client/assets/{monaco-editor-DPSyRXRf.js → monaco-editor-5JIc-lnc.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-D3czlwOh.js → monitoring-stats-row-DPsQ-OAn.js} +1 -1
- package/dist/client/assets/{oauth-callback-gUmHlBxE.js → oauth-callback-B1AvYYRn.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-BlU7gUjM.js → oauth-callback-ai-provider-BtGHmjpp.js} +1 -1
- package/dist/client/assets/{onboarding-CACP2hP7.js → onboarding-DfUmI7F5.js} +1 -1
- package/dist/client/assets/{org-install-DXkOxZ3B.js → org-install-CpJAFt1s.js} +1 -1
- package/dist/client/assets/{org-layout-D8gPmxC9.js → org-layout-BsuFzdH_.js} +1 -1
- package/dist/client/assets/{organization-choice-LXEhXA80.js → organization-choice-DrxWffZp.js} +1 -1
- package/dist/client/assets/{page-seo-form-CIUFvIkf.js → page-seo-form-BLqpZnj6.js} +1 -1
- package/dist/client/assets/page-seo-sheet-C7jjKuEW.js +1 -0
- package/dist/client/assets/{popover-DlhiC2kV.js → popover-BXFiEQtN.js} +1 -1
- package/dist/client/assets/post-editor-Tve7DmSa.js +1 -0
- package/dist/client/assets/{preview-dialog-BZw1tqei.js → preview-dialog-CQgf0QcR.js} +2 -2
- package/dist/client/assets/{primitives-Dag6F90J.js → primitives-BF1opf4F.js} +1 -1
- package/dist/client/assets/{profile-CuYK3aWt.js → profile-C8meo3ry.js} +1 -1
- package/dist/client/assets/project-app-view-BR2-hR46.js +1 -0
- package/dist/client/assets/record-editor-DbXO7U7E.js +1 -0
- package/dist/client/assets/registry-jjhvqeDq.js +2 -0
- package/dist/client/assets/{registry-layout-CEyFqA7n.js → registry-layout-C4UMhzml.js} +1 -1
- package/dist/client/assets/{require-capability-gPUPtdzd.js → require-capability--mIKExbX.js} +1 -1
- package/dist/client/assets/{required-auth-layout-LKAXiCE0.js → required-auth-layout-DDJmFi3U.js} +1 -1
- package/dist/client/assets/{reset-password-bJcBT7Gb.js → reset-password-CuNa1ife.js} +1 -1
- package/dist/client/assets/{roles-CC7E6HcB.js → roles-BMhGnq_F.js} +1 -1
- package/dist/client/assets/{scroll-area-B5uQvwMq.js → scroll-area-BM-54tW1.js} +1 -1
- package/dist/client/assets/{search-input-RKiOmhtP.js → search-input-M7ubuBMG.js} +1 -1
- package/dist/client/assets/{secrets-h-gzLT55.js → secrets-BN1JMG5V.js} +1 -1
- package/dist/client/assets/{sections-editor-CDv9q4Zj.js → sections-editor-Buouhx1S.js} +1 -1
- package/dist/client/assets/{select-DYjkTzV9.js → select-C6v8Xcth.js} +1 -1
- package/dist/client/assets/{select-model-_9UnhtkK.js → select-model-Cz9R_UN3.js} +1 -1
- package/dist/client/assets/seo-editor-D9o3utSQ.js +1 -0
- package/dist/client/assets/{settings-layout-DUIAXfRs.js → settings-layout-CSaUQUXv.js} +1 -1
- package/dist/client/assets/{settings-section-KcFzmKpc.js → settings-section-MeT61nuY.js} +1 -1
- package/dist/client/assets/{sheet-Cpa4SoVx.js → sheet-DyU03ddw.js} +1 -1
- package/dist/client/assets/{shell-controls-T4wdCxHU.js → shell-controls-DtGb6E4l.js} +1 -1
- package/dist/client/assets/{shell-layout-B3MRPoxv.js → shell-layout-Nyz7GHu7.js} +1 -1
- package/dist/client/assets/{shell-route-loading-BJ6w7Z0k.js → shell-route-loading-BRcTX0VT.js} +1 -1
- package/dist/client/assets/{sidebar-DGINLOAj.js → sidebar-BNrafefE.js} +1 -1
- package/dist/client/assets/{skeleton-Bi38tj9R.js → skeleton-B0I93PJP.js} +1 -1
- package/dist/client/assets/{sortable.esm-B5z7Lhjf.js → sortable.esm-MymOIPKk.js} +1 -1
- package/dist/client/assets/{sso-D7lIHw1Z.js → sso-CfyYgWAs.js} +1 -1
- package/dist/client/assets/{store-nglQkJ7k.js → store-T7GJ1SPI.js} +1 -1
- package/dist/client/assets/store-registry-B-YJeGRV.js +2 -0
- package/dist/client/assets/{studio-tools-Dnm8v52D.js → studio-tools-CNO5iCKk.js} +1 -1
- package/dist/client/assets/{switch-DcmGhxAY.js → switch-CCMIMmOF.js} +1 -1
- package/dist/client/assets/{table-C7LrFfqV.js → table-DeNuxLMl.js} +1 -1
- package/dist/client/assets/{tabs-SaW2v3dR.js → tabs-Ca0vDJqc.js} +1 -1
- package/dist/client/assets/{task-status-7c6dWc3x.js → task-status-B3nPzwP7.js} +1 -1
- package/dist/client/assets/{textarea-B1_4ZyQv.js → textarea-BYT525JZ.js} +1 -1
- package/dist/client/assets/{toggle-group-B0qybzrV.js → toggle-group-9TrYMc69.js} +1 -1
- package/dist/client/assets/toolbar-p8VcpV1N.js +1 -0
- package/dist/client/assets/{tools-list-CuC4_RxV.js → tools-list-uWC3Ij6C.js} +1 -1
- package/dist/client/assets/{tooltip-Bd-OGufW.js → tooltip-DrpiSbRG.js} +1 -1
- package/dist/client/assets/{types-Dtutip9J.js → types-C7syjwde.js} +4 -4
- package/dist/client/assets/{use-ai-providers-DpIOd_Jc.js → use-ai-providers-C7KmiuqP.js} +1 -1
- package/dist/client/assets/{use-automations-BAe10nJ1.js → use-automations-RMjkwkxX.js} +1 -1
- package/dist/client/assets/{use-capability-yMzJDZmy.js → use-capability-C6Dwri-U.js} +1 -1
- package/dist/client/assets/{use-clock-tick-Dtz6-Wwf.js → use-clock-tick-BcxdOJLx.js} +1 -1
- package/dist/client/assets/{use-collections-BN0kOjAz.js → use-collections-B4atckEK.js} +1 -1
- package/dist/client/assets/{use-connection-CsNBMvbD.js → use-connection-Dz29RF9P.js} +1 -1
- package/dist/client/assets/{use-copy-CIdhUtly.js → use-copy-Xy0buIqd.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-CeHvNKpk.js → use-create-virtual-mcp-DVmI--_C.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-CNacBvKR.js → use-debounced-autosave-B4mbwJnu.js} +1 -1
- package/dist/client/assets/{use-debounced-value-Ync7OfxW.js → use-debounced-value-C6U3mliE.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-D-Nuhx2W.js → use-decopilot-events-CpQNzv3e.js} +1 -1
- package/dist/client/assets/{use-delete-connection-Cm8qzL4n.js → use-delete-connection-CqeuxO_6.js} +1 -1
- package/dist/client/assets/{use-file-configs-DeLpoG7D.js → use-file-configs-CFCmr--W.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-B2jcH0QP.js → use-infinite-scroll-BX1nHHVY.js} +1 -1
- package/dist/client/assets/{use-join-requests-V90JIt54.js → use-join-requests-j9WpmFq7.js} +1 -1
- package/dist/client/assets/{use-mcp-client-Efjq5Lk3.js → use-mcp-client-xOK-OF8p.js} +2 -2
- package/dist/client/assets/{use-mcp-prompts-C87bOW8f.js → use-mcp-prompts-Crr3H7P7.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CBnDJhOK.js → use-mcp-tools-C8tMWwG9.js} +1 -1
- package/dist/client/assets/{use-members-BOTL3bYo.js → use-members-BMNjJExY.js} +1 -1
- package/dist/client/assets/{use-mobile-C1vI_l2D.js → use-mobile-NlF-3RoP.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-C9NO4q-K.js → use-navigate-to-agent-DZubxUSm.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-Bmkc23g2.js → use-org-auth-client-C_UJ3Vg_.js} +1 -1
- package/dist/client/assets/{use-org-fs-DuGfZwmB.js → use-org-fs-DyK8omii.js} +1 -1
- package/dist/client/assets/{use-org-sso-CHbxlHmQ.js → use-org-sso-DkqH8Zpz.js} +1 -1
- package/dist/client/assets/{use-organization-roles-DrQVYH4f.js → use-organization-roles-Cu69Rnex.js} +1 -1
- package/dist/client/assets/{use-organization-settings-CoqqaaEj.js → use-organization-settings-DksiQdGc.js} +1 -1
- package/dist/client/assets/{use-registry-connections-DXIh0Wgd.js → use-registry-connections-BOZLpkM5.js} +1 -1
- package/dist/client/assets/{use-secrets-CoPLlm-T.js → use-secrets-CLmhH-Rb.js} +1 -1
- package/dist/client/assets/{use-status-sounds-CpbEvaIm.js → use-status-sounds-DxV7deix.js} +1 -1
- package/dist/client/assets/{use-view-mode-_JIb64jV.js → use-view-mode-C2dllj6L.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-DqOCv1FF.js → use-virtual-mcp-2U_MnYnK.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-RUqqRph1.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-fRYRtDkY.js +1 -0
- package/dist/client/assets/{useSuspenseQueries-D4DvYwmE.js → useSuspenseQueries-Cysvk68n.js} +1 -1
- package/dist/client/assets/{variant-calendar-CrqgSBqB.js → variant-calendar-mZn_D1Zo.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-umY1Lj1D.js → view-mode-toggle-4CQodGfa.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/agents-list-DCSCS9IM.js +0 -1
- package/dist/client/assets/app-editor-BHN9W_iy.js +0 -1
- package/dist/client/assets/category-editor-BqAqvGq6.js +0 -1
- package/dist/client/assets/commerce-onboarding-C1-oxR9p.js +0 -1
- package/dist/client/assets/file-explorer-CMfdZKWB.js +0 -2
- package/dist/client/assets/github-repo-picker-D9c9ubs9.js +0 -1
- package/dist/client/assets/index-1MQY-aKx.css +0 -1
- package/dist/client/assets/index-CVYDtNlT.js +0 -1
- package/dist/client/assets/index-DtZ0pbqe.js +0 -513
- package/dist/client/assets/page-seo-sheet-CQlsm1QB.js +0 -1
- package/dist/client/assets/post-editor-C-y1bT8v.js +0 -1
- package/dist/client/assets/project-app-view-txZCpEgu.js +0 -1
- package/dist/client/assets/record-editor-D7Vs93aw.js +0 -1
- package/dist/client/assets/registry-CA1uTLMs.js +0 -2
- package/dist/client/assets/seo-editor-CWPW2cx-.js +0 -1
- package/dist/client/assets/store-registry-Ckxj_Zes.js +0 -2
- package/dist/client/assets/toolbar-JtA92Ok5.js +0 -1
- package/dist/client/assets/useInfiniteQuery-TAL9ie6e.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CnQJo0Tl.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as q,r as H,l as oe,j as t,B as W,m as Ae,d as pe,K as Z,o as ke,s as ce,n as Re,p as Pe,i as st,k as Ge,t as He,q as Se,v as te,Q as Ct,E as _t,a as Be,u as St,w as Ht,b as Nt,x as Bt,y as Et,L as Qt}from"./index-CFiyU0D9.js";import{A as Wt}from"./auth-entry-PwLVm-jX.js";import{A as Yt}from"./auth-split-layout-5YwPgbAb.js";import{O as xt}from"./organization-choice-DrxWffZp.js";import{f as Jt}from"./tab-id-BptcWVWa.js";import{I as Ue}from"./input-BwRH-Gsz.js";import{W as ot,u as Qe,S as wt,g as Zt,C as Xt}from"./use-mcp-client-xOK-OF8p.js";import{i as It}from"./XCircle-Ct0eqqsw.js";import{I as it}from"./integration-icon-LQhkkaLl.js";import{D as Ne,a as Tt,b as Ot,c as At,d as kt,e as Rt}from"./dialog-BAqFyO8a.js";import{T as Pt,a as Ut,b as Lt}from"./tooltip-DrpiSbRG.js";import{i as rt}from"./CheckCircle-Cgnheu-R.js";import{i as en,t as $t}from"./agent-icon-oDx9Z_Be.js";import{g as tn,c as nn,e as sn}from"./extract-connection-data-D6bQrejT.js";import{F as de,a as Le,b as me,c as Ke,d as ue,e as fe,f as on}from"./form-DGE2mWLL.js";import{i as rn}from"./ChevronUp-DBpw6M-L.js";import{s as an,a as zt}from"./Eye-bojNLUjA.js";import{i as ln}from"./Settings02-BcAnTzm5.js";import{f as cn}from"./github-installations-DzN1UQ4x.js";import{u as dn}from"./useSuspenseQueries-Cysvk68n.js";import{a as mn}from"./authenticate-and-persist-oauth-DoPUB_Bh.js";import{i as Dt}from"./ArrowUpRight-OJZisFPQ.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-CJP1BOq4.js";import"./User01-COQtf360.js";import"./auth-Bej0Tx2Y.js";import"./X-DrMVHLcw.js";import"./AlertCircle-DC-zDzV-.js";import"./Tool01-CvnpFI53.js";import"./SwitchHorizontal01-DAZXInW8.js";import"./ZapSquare-PMiGcZpW.js";import"./Users03-DknrDMtT.js";import"./ChevronDown-DyHvxYlc.js";import"./ChevronLeft-dyRjFCmp.js";import"./ChevronRight-Cpfh3gza.js";import"./DotsVertical-5jSu3d1f.js";import"./Stars02-qnq-_X9g.js";import"./ZoomOut-6ix2H92j.js";import"./Globe01-CyfpzbeQ.js";import"./FilterLines-CFl65nng.js";import"./Star01-DHEkWySe.js";import"./Globe04-DFpdKSRI.js";import"./HardDrive-B1mtnaeA.js";import"./Key01-CwrJlZo0.js";import"./LayoutLeft-fsm0LcB8.js";import"./LinkExternal01-BHwVyDja.js";import"./Monitor01-ChA6ov2I.js";import"./Sun-lTiqxOzH.js";import"./Palette-DusYqL0W.js";import"./Play-CnXG8qqP.js";import"./Plus-eGxBB1d8.js";import"./SearchLg-CDpA_lbT.js";import"./SearchMd-ujiTPCmg.js";import"./Shield01-ZxmFmrvL.js";import"./Stars01-BdCaKqhF.js";import"./Trash01-ByxlxTiZ.js";import"./Upload01-Z77n1bV8.js";import"./Users01-wtRJYQKX.js";import"./XClose-BaZ908gw.js";import"./Zap-wRIFSWIq.js";import"./label-CdBSUJpf.js";import"./mcp-oauth-IblqU9XT.js";const un=/^[a-zA-Z][a-zA-Z\d+.-]*:/,fn=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,pn=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,gn=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function we(o){const e=o.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const n=un.test(e),s=fn.test(e),i=pn.test(e);if(n&&!s&&!i)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const a=s?e:`https://${e}`;let r;try{r=new URL(a)}catch{return{ok:!1,error:"Enter a valid website URL."}}if(r.protocol!=="http:"&&r.protocol!=="https:")return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const l=r.hostname.split(".");return l.length<2||l.some(c=>!c||!gn.test(c))?{ok:!1,error:"Enter a valid website URL."}:(r.protocol="https:",{ok:!0,value:r.origin})}function tt(o){const e=q.c(14),{children:n,className:s,wrapperClassName:i}=o,[a,r]=H.useState(!0);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=j=>{if(!j)return;const v=()=>{const f=j.scrollHeight-j.scrollTop-j.clientHeight<8;r(f)};v(),j.addEventListener("scroll",v,{passive:!0});const g=new ResizeObserver(v);g.observe(j);for(const f of Array.from(j.children))g.observe(f);return()=>{j.removeEventListener("scroll",v),g.disconnect()}},e[0]=l):l=e[0];const c=l;let u;e[1]!==i?(u=oe("relative",i),e[1]=i,e[2]=u):u=e[2];let m;e[3]!==n||e[4]!==s?(m=t.jsx("div",{ref:c,className:s,children:n}),e[3]=n,e[4]=s,e[5]=m):m=e[5];const p=a?"opacity-0":"opacity-100";let d;e[6]!==p?(d=oe("pointer-events-none absolute inset-x-0 -bottom-px h-[72px]","bg-gradient-to-t from-sidebar from-[6px] to-transparent","backdrop-blur-[1px] [mask-image:linear-gradient(to_top,black_6px,transparent)]","transition-opacity duration-200",p),e[6]=p,e[7]=d):d=e[7];let x;e[8]!==d?(x=t.jsx("div",{"aria-hidden":!0,className:d}),e[8]=d,e[9]=x):x=e[9];let b;return e[10]!==u||e[11]!==m||e[12]!==x?(b=t.jsxs("div",{className:u,children:[m,x]}),e[10]=u,e[11]=m,e[12]=x,e[13]=b):b=e[13],b}function hn(o){const e=o.properties;if(!e)return[];const n=[];for(const[s,i]of Object.entries(e)){const l=i?.properties?.__type?.const;typeof l=="string"&&l.length>0&&n.push({fieldKey:s,bindingType:l})}return n}function xn(o,e){const n=[];if(o.length&&n.push({field:["id"],operator:"in",value:o}),e.length&&n.push({field:["name"],operator:"in",value:e}),n.length!==0)return n.length===1?n[0]:{operator:"or",conditions:n}}function ne(o){const e=o;if(e.isError)throw new Error(e.content?.find(n=>n.text)?.text??"Tool call failed");return e.structuredContent??o}function yn(o,e,n,s){return{...o??{},[e]:{__type:n,value:s}}}function nt(o){return o==null?!1:typeof o=="string"?o.trim().length>0:typeof o=="number"||typeof o=="boolean"?!0:Array.isArray(o)?o.some(nt):typeof o=="object"?Object.entries(o).some(([e,n])=>!e.startsWith("__")&&nt(n)):!1}function bn(o){const e={accountName:"Nome da conta",appKey:"App Key",appToken:"App Token",propertyId:"Propriedade",siteUrl:"Site"};return e[o]?e[o]:o.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,n=>n.toUpperCase())}function vn(o){return nt(o)?typeof o=="string"?o.trim():typeof o=="number"||typeof o=="boolean"?String(o):JSON.stringify(o):null}function jn(o){return o?Object.entries(o).flatMap(([e,n])=>{if(e.startsWith("__"))return[];const s=vn(n);return s?[{key:e,label:bn(e),value:s}]:[]}):[]}function Cn({autoOpenFieldKey:o,card:e}){return o===e.fieldKey&&e.satisfied&&!!e.linkedConnectionId}function _n(o,e,n){const s=o.filter(i=>i.app_name===e||!!n&&i.app_id===n);return s.length===0?null:(s.sort((i,a)=>{const r=l=>l.status==="active"?0:1;return r(i)!==r(a)?r(i)-r(a):(a.updated_at??"").localeCompare(i.updated_at??"")}),s[0].id)}function Sn(o){return o.server?.icons?.[0]?.src??tn(o.server?.repository)??null}function Nn(o,e){const n=o._meta?.["mcp.mesh"];return n?.friendlyName||n?.friendly_name||o.title||o.server?.title||o.server?.name||e}function En(o){const e=[],n=new Map(o.connections.map(s=>[s.id,s]));for(const s of o.requirements){const i=o.curated[s.bindingType],a=i?o.itemsById[i.registryAppId]:o.itemsByName[s.bindingType];if(!a)continue;const r=o.configurationState?.[s.fieldKey]?.value,l=r?n.get(r):void 0,c=r&&l?r:null,u=c?o.connectionReadiness?.[c]!==!1:!1,m=!!c&&u,p=m?void 0:o.saBindings?.[s.bindingType],d=m||!!p,x=m?"oauth":p?"sa":null;e.push({fieldKey:s.fieldKey,bindingType:s.bindingType,registryItem:a,title:Nn(a,s.bindingType),icon:Sn(a),headline:i?.headline??a._meta?.["mcp.mesh"]?.short_description??null,area:i?.area??null,bullets:i?.bullets??[],satisfied:d,candidateConnectionId:d?null:c||_n(o.connections,s.bindingType,i?.registryAppId),linkedConnectionId:c,configurationState:l?.configuration_state??null,boundVia:x,boundResource:p?.resource??null})}return e}function wn(o,e){if(!o)return null;const n=i=>{if(i.startsWith("sc-domain:"))return i.substring(10);try{let r=new URL(i.startsWith("http")?i:`https://${i}`).hostname||"";return r.startsWith("www.")&&(r=r.substring(4)),r}catch{return i}},s=n(o);for(const i of e)if(n(i.siteUrl)===s)return i.siteUrl;return null}function In(o){return(o?.response?.accountSummaries??[]).map(s=>({account:s.account,options:(s.propertySummaries??[]).map(i=>({value:i.property,label:`${i.displayName} (${s.displayName})`}))}))}function yt(o){const e=q.c(38);let n,s,i,a,r;e[0]!==o?({value:r,onChange:s,placeholder:i,className:n,...a}=o,e[0]=o,e[1]=n,e[2]=s,e[3]=i,e[4]=a,e[5]=r):(n=e[1],s=e[2],i=e[3],a=e[4],r=e[5]);const[l,c]=H.useState(!1),[u,m]=H.useState(!1);let p;e[6]!==r?(p=async()=>{if(r)try{await navigator.clipboard.writeText(r),m(!0),setTimeout(()=>m(!1),2e3)}catch(U){console.error("Failed to copy text: ",U)}},e[6]=r,e[7]=p):p=e[7];const d=p;let x;e[8]!==l?(x=()=>{c(!l)},e[8]=l,e[9]=x):x=e[9];const b=x,j=l?"text":"password";let v;e[10]!==n?(v=oe("pr-20",n),e[10]=n,e[11]=v):v=e[11];let g;e[12]!==s||e[13]!==i||e[14]!==a||e[15]!==j||e[16]!==v||e[17]!==r?(g=t.jsx(Ue,{type:j,value:r,onChange:s,placeholder:i,className:v,...a}),e[12]=s,e[13]=i,e[14]=a,e[15]=j,e[16]=v,e[17]=r,e[18]=g):g=e[18];const f=l?"Hide password":"Show password";let y;e[19]!==l?(y=l?t.jsx(ln,{size:16}):t.jsx(an,{size:16}),e[19]=l,e[20]=y):y=e[20];let h;e[21]!==f||e[22]!==y||e[23]!==b?(h=t.jsx(W,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:b,title:f,children:y}),e[21]=f,e[22]=y,e[23]=b,e[24]=h):h=e[24];const C=!r,E=u?"Copied!":"Copy token";let _;e[25]!==u?(_=u?t.jsx(rn,{size:16}):t.jsx(zt,{size:16}),e[25]=u,e[26]=_):_=e[26];let S;e[27]!==d||e[28]!==E||e[29]!==_||e[30]!==C?(S=t.jsx(W,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:d,disabled:C,title:E,children:_}),e[27]=d,e[28]=E,e[29]=_,e[30]=C,e[31]=S):S=e[31];let N;e[32]!==S||e[33]!==h?(N=t.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[h,S]}),e[32]=S,e[33]=h,e[34]=N):N=e[34];let O;return e[35]!==N||e[36]!==g?(O=t.jsxs("div",{className:"relative",children:[g,N]}),e[35]=N,e[36]=g,e[37]=O):O=e[37],O}function at(o){const e=q.c(19),{card:n,selfClient:s,org:i,onDone:a,onError:r}=o,l=Ae();let c;e[0]!==n||e[1]!==s?(c=async v=>{const g={...n.configurationState??{},...v};await s.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:n.linkedConnectionId||n.candidateConnectionId,data:{configuration_state:g}}})},e[0]=n,e[1]=s,e[2]=c):c=e[2];let u;e[3]!==a||e[4]!==i||e[5]!==l?(u=async()=>{await l.invalidateQueries({queryKey:Z.commerceDiscoveryCompanionConnectionsPrefix(i.id)}),a()},e[3]=a,e[4]=i,e[5]=l,e[6]=u):u=e[6];let m;e[7]!==r?(m=v=>{r?.(v)},e[7]=r,e[8]=m):m=e[8];let p;e[9]!==c||e[10]!==u||e[11]!==m?(p={mutationFn:c,onSuccess:u,onError:m},e[9]=c,e[10]=u,e[11]=m,e[12]=p):p=e[12];const d=pe(p);let x;e[13]!==d?(x=v=>d.mutate(v),e[13]=d,e[14]=x):x=e[14];const b=x;let j;return e[15]!==d.error||e[16]!==d.isPending||e[17]!==b?(j={save:b,isPending:d.isPending,error:d.error},e[15]=d.error,e[16]=d.isPending,e[17]=b,e[18]=j):j=e[18],j}const Tn=ke({accountName:ce().min(1,"Informe o nome da conta"),appKey:ce().optional(),appToken:ce().optional()});function On(o){const e=q.c(63),{card:n,selfClient:s,org:i,onDone:a,onIsPendingChange:r}=o;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=Re(Tn),e[0]=l):l=e[0];const c=n.configurationState?.accountName||"",u=n.configurationState?.appKey||"",m=n.configurationState?.appToken||"";let p;e[1]!==c||e[2]!==u||e[3]!==m?(p={resolver:l,defaultValues:{accountName:c,appKey:u,appToken:m}},e[1]=c,e[2]=u,e[3]=m,e[4]=p):p=e[4];const d=Pe(p);let x;e[5]!==n.configurationState?.accountName||e[6]!==n.configurationState?.appKey||e[7]!==n.configurationState?.appToken||e[8]!==d?(x=()=>{d.reset({accountName:n.configurationState?.accountName||"",appKey:n.configurationState?.appKey||"",appToken:n.configurationState?.appToken||""})},e[5]=n.configurationState?.accountName,e[6]=n.configurationState?.appKey,e[7]=n.configurationState?.appToken,e[8]=d,e[9]=x):x=e[9];let b;e[10]!==n.configurationState||e[11]!==d?(b=[n.configurationState,d],e[10]=n.configurationState,e[11]=d,e[12]=b):b=e[12],H.useEffect(x,b);let j;e[13]!==n||e[14]!==a||e[15]!==i||e[16]!==s?(j={card:n,selfClient:s,org:i,onDone:a},e[13]=n,e[14]=a,e[15]=i,e[16]=s,e[17]=j):j=e[17];const{save:v,isPending:g,error:f}=at(j);let y,h;e[18]!==g||e[19]!==r?(h=()=>{r?.(g)},y=[g,r],e[18]=g,e[19]=r,e[20]=y,e[21]=h):(y=e[20],h=e[21]),H.useEffect(h,y);let C;if(e[22]!==d||e[23]!==v){let $;e[25]!==v?($=async w=>{v(w)},e[25]=v,e[26]=$):$=e[26],C=d.handleSubmit($),e[22]=d,e[23]=v,e[24]=C}else C=e[24];const E=C;let _;e[27]!==g?(_=$=>{const{field:w}=$;return t.jsxs(me,{children:[t.jsx(Ke,{children:"Nome da conta"}),t.jsx(ue,{children:t.jsx(Ue,{placeholder:"Nome da sua conta VTEX",...w,disabled:g})}),t.jsx(fe,{})]})},e[27]=g,e[28]=_):_=e[28];let S;e[29]!==d.control||e[30]!==_?(S=t.jsx(de,{control:d.control,name:"accountName",render:_}),e[29]=d.control,e[30]=_,e[31]=S):S=e[31];let N;e[32]!==g?(N=$=>{const{field:w}=$;return t.jsxs(me,{children:[t.jsx(Ke,{children:"App Key (opcional)"}),t.jsx(ue,{children:t.jsx(yt,{placeholder:"App Key da VTEX",...w,disabled:g})}),t.jsx(fe,{})]})},e[32]=g,e[33]=N):N=e[33];let O;e[34]!==d.control||e[35]!==N?(O=t.jsx(de,{control:d.control,name:"appKey",render:N}),e[34]=d.control,e[35]=N,e[36]=O):O=e[36];let U;e[37]!==g?(U=$=>{const{field:w}=$;return t.jsxs(me,{children:[t.jsx(Ke,{children:"App Token (opcional)"}),t.jsx(ue,{children:t.jsx(yt,{placeholder:"App Token da VTEX",...w,disabled:g})}),t.jsx(fe,{})]})},e[37]=g,e[38]=U):U=e[38];let k;e[39]!==d.control||e[40]!==U?(k=t.jsx(de,{control:d.control,name:"appToken",render:U}),e[39]=d.control,e[40]=U,e[41]=k):k=e[41];let T;e[42]!==d||e[43]!==S||e[44]!==O||e[45]!==k?(T=t.jsxs(Le,{...d,children:[S,O,k]}),e[42]=d,e[43]=S,e[44]=O,e[45]=k,e[46]=T):T=e[46];let R;e[47]!==f?(R=f&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:f instanceof Error?f.message:"Não foi possível salvar a configuração"}),e[47]=f,e[48]=R):R=e[48];let A;e[49]!==g||e[50]!==a?(A=t.jsx(W,{type:"button",variant:"outline",onClick:a,disabled:g,children:"Cancelar"}),e[49]=g,e[50]=a,e[51]=A):A=e[51];const D=g?"Salvando...":"Salvar";let M;e[52]!==g||e[53]!==D?(M=t.jsx(W,{type:"submit",disabled:g,children:D}),e[52]=g,e[53]=D,e[54]=M):M=e[54];let F;e[55]!==A||e[56]!==M?(F=t.jsxs(Ne,{className:"pt-4",children:[A,M]}),e[55]=A,e[56]=M,e[57]=F):F=e[57];let K;return e[58]!==E||e[59]!==T||e[60]!==R||e[61]!==F?(K=t.jsxs("form",{onSubmit:E,className:"space-y-4",children:[T,R,F]}),e[58]=E,e[59]=T,e[60]=R,e[61]=F,e[62]=K):K=e[62],K}function lt(o){const e=q.c(30),{options:n,value:s,onChange:i,disabled:a,ariaLabel:r,searchPlaceholder:l}=o,c=l===void 0?"Buscar...":l,[u,m]=H.useState("");let p,d,x;if(e[0]!==n||e[1]!==u||e[2]!==s){const S=u.trim().toLowerCase();p=S?n.filter(N=>N.label.toLowerCase().includes(S)):n,d=p.map(An),x=d.includes(s)?s:d[0]??"",e[0]=n,e[1]=u,e[2]=s,e[3]=p,e[4]=d,e[5]=x}else p=e[3],d=e[4],x=e[5];const b=x;let j;e[6]!==a||e[7]!==d||e[8]!==i?(j=function(N){if(a||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(N.key))return;N.preventDefault();const U=N.currentTarget.dataset.value,k=d.indexOf(U),T=d.length;if(T===0)return;let R;N.key==="ArrowDown"||N.key==="ArrowRight"?R=(k+1)%T:N.key==="ArrowUp"||N.key==="ArrowLeft"?R=(k-1+T)%T:N.key==="Home"?R=0:R=T-1;const A=d[R];i(A),N.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(A)}"]`)?.focus()},e[6]=a,e[7]=d,e[8]=i,e[9]=j):j=e[9];const v=j;let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(en,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),e[10]=g):g=e[10];let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=S=>m(S.target.value),e[11]=f):f=e[11];const y=`Buscar ${r}`;let h;e[12]!==a||e[13]!==u||e[14]!==c||e[15]!==y?(h=t.jsxs("div",{className:"relative",children:[g,t.jsx(Ue,{type:"text",value:u,onChange:f,disabled:a,placeholder:c,"aria-label":y,className:"h-8 pl-8"})]}),e[12]=a,e[13]=u,e[14]=c,e[15]=y,e[16]=h):h=e[16];let C;e[17]!==a||e[18]!==p||e[19]!==v||e[20]!==i||e[21]!==b||e[22]!==s?(C=p.length===0?t.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:"Nenhum resultado"}):p.map(S=>{const N=S.value===s;return t.jsxs("button",{type:"button",role:"radio","aria-checked":N,disabled:a,"data-value":S.value,tabIndex:S.value===b?0:-1,onClick:()=>i(S.value),onKeyDown:v,className:oe("flex w-full items-center justify-between gap-2 rounded-sm px-2 py-2 text-left text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",N?"bg-muted font-medium text-foreground":"text-foreground hover:bg-muted/50"),children:[t.jsx("span",{className:"truncate",children:S.label}),N?t.jsx(rt,{size:16,className:"shrink-0 text-primary"}):null]},S.value)}),e[17]=a,e[18]=p,e[19]=v,e[20]=i,e[21]=b,e[22]=s,e[23]=C):C=e[23];let E;e[24]!==r||e[25]!==C?(E=t.jsx("div",{role:"radiogroup","aria-label":r,className:"max-h-[280px] overflow-y-auto",children:C}),e[24]=r,e[25]=C,e[26]=E):E=e[26];let _;return e[27]!==h||e[28]!==E?(_=t.jsxs("div",{className:"space-y-2",children:[h,E]}),e[27]=h,e[28]=E,e[29]=_):_=e[29],_}function An(o){return o.value}function We(o){const e=q.c(16),{label:n,iconSize:s,className:i,iconClassName:a,labelClassName:r}=o,l=s===void 0?14:s;let c;e[0]!==i?(c=oe("inline-flex items-center gap-2",i),e[0]=i,e[1]=c):c=e[1];let u;e[2]!==a?(u=oe("shrink-0 animate-spin",a),e[2]=a,e[3]=u):u=e[3];let m;e[4]!==l||e[5]!==u?(m=t.jsx(st,{size:l,className:u}),e[4]=l,e[5]=u,e[6]=m):m=e[6];let p;e[7]!==r?(p=oe("text-sm",r),e[7]=r,e[8]=p):p=e[8];let d;e[9]!==n||e[10]!==p?(d=t.jsx("span",{className:p,children:n}),e[9]=n,e[10]=p,e[11]=d):d=e[11];let x;return e[12]!==c||e[13]!==m||e[14]!==d?(x=t.jsxs("span",{className:c,children:[m,d]}),e[12]=c,e[13]=m,e[14]=d,e[15]=x):x=e[15],x}const kn=ke({propertyId:ce().min(1,"Selecione uma propriedade")});function Rn(o){const e=q.c(68),{card:n,connectionId:s,companionClient:i,selfClient:a,org:r,onDone:l,onDisconnect:c,onIsPendingChange:u}=o;let m;e[0]!==s||e[1]!==r.id?(m=Z.commerceDiscoveryCompanionGaProperties(r.id,s),e[0]=s,e[1]=r.id,e[2]=m):m=e[2];let p;e[3]!==i?(p=async()=>{const L=await i.callTool({name:"get-account-summaries",arguments:{}}),z=ne(L);return In(z)},e[3]=i,e[4]=p):p=e[4];let d;e[5]!==m||e[6]!==p?(d={queryKey:m,queryFn:p},e[5]=m,e[6]=p,e[7]=d):d=e[7];const x=Ge(d);let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=Re(kn),e[8]=b):b=e[8];const j=n.configurationState?.propertyId||"";let v;e[9]!==j?(v={resolver:b,defaultValues:{propertyId:j}},e[9]=j,e[10]=v):v=e[10];const g=Pe(v);let f;e[11]!==n||e[12]!==l||e[13]!==r||e[14]!==a?(f={card:n,selfClient:a,org:r,onDone:l},e[11]=n,e[12]=l,e[13]=r,e[14]=a,e[15]=f):f=e[15];const{save:y,isPending:h,error:C}=at(f);let E,_;e[16]!==h||e[17]!==u?(E=()=>{u?.(h)},_=[h,u],e[16]=h,e[17]=u,e[18]=E,e[19]=_):(E=e[18],_=e[19]),H.useEffect(E,_);let S;if(e[20]!==g||e[21]!==y){let L;e[23]!==y?(L=async z=>{y(z)},e[23]=y,e[24]=L):L=e[24],S=g.handleSubmit(L),e[20]=g,e[21]=y,e[22]=S}else S=e[22];const N=S;if(x.isLoading){let L;return e[25]===Symbol.for("react.memo_cache_sentinel")?(L=t.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:t.jsx(We,{label:"Carregando propriedades..."})}),e[25]=L):L=e[25],L}if(x.isError){let L;return e[26]===Symbol.for("react.memo_cache_sentinel")?(L=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]=L):L=e[26],L}let O;e[27]!==x.data?(O=x.data||[],e[27]=x.data,e[28]=O):O=e[28];const U=O;if(U.flatMap(Un).length===0){let L;e[29]===Symbol.for("react.memo_cache_sentinel")?(L=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]=L):L=e[29];let z;e[30]!==c?(z=c?t.jsx("button",{type:"button",onClick:c,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive",children:"Desconectar conta"}):t.jsx("span",{}),e[30]=c,e[31]=z):z=e[31];let Q;e[32]!==l?(Q=t.jsx(W,{type:"button",variant:"outline",onClick:l,children:"Fechar"}),e[32]=l,e[33]=Q):Q=e[33];let J;return e[34]!==z||e[35]!==Q?(J=t.jsxs("div",{className:"space-y-4",children:[L,t.jsxs(Ne,{className:"flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[z,Q]})]}),e[34]=z,e[35]=Q,e[36]=J):J=e[36],J}let T;e[37]!==h||e[38]!==U?(T=L=>{const{field:z}=L;return t.jsxs(me,{children:[t.jsx(ue,{children:t.jsx(lt,{options:U.flatMap(Pn),value:z.value,onChange:z.onChange,disabled:h,ariaLabel:"Propriedade do Google Analytics"})}),t.jsx(fe,{})]})},e[37]=h,e[38]=U,e[39]=T):T=e[39];let R;e[40]!==g.control||e[41]!==T?(R=t.jsx(de,{control:g.control,name:"propertyId",render:T}),e[40]=g.control,e[41]=T,e[42]=R):R=e[42];let A;e[43]!==g||e[44]!==R?(A=t.jsx(Le,{...g,children:R}),e[43]=g,e[44]=R,e[45]=A):A=e[45];let D;e[46]!==C?(D=C&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:C instanceof Error?C.message:"Não foi possível salvar a configuração"}),e[46]=C,e[47]=D):D=e[47];let M;e[48]!==h||e[49]!==c?(M=c?t.jsx("button",{type:"button",onClick:c,disabled:h,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive disabled:opacity-50",children:"Desconectar conta"}):t.jsx("span",{}),e[48]=h,e[49]=c,e[50]=M):M=e[50];let F;e[51]!==h||e[52]!==l?(F=t.jsx(W,{type:"button",variant:"outline",onClick:l,disabled:h,children:"Cancelar"}),e[51]=h,e[52]=l,e[53]=F):F=e[53];const K=h?"Salvando...":"Salvar";let $;e[54]!==h||e[55]!==K?($=t.jsx(W,{type:"submit",disabled:h,children:K}),e[54]=h,e[55]=K,e[56]=$):$=e[56];let w;e[57]!==F||e[58]!==$?(w=t.jsxs("div",{className:"flex gap-2",children:[F,$]}),e[57]=F,e[58]=$,e[59]=w):w=e[59];let I;e[60]!==M||e[61]!==w?(I=t.jsxs(Ne,{className:"flex-col gap-2 pt-4 sm:flex-row sm:items-center sm:justify-between",children:[M,w]}),e[60]=M,e[61]=w,e[62]=I):I=e[62];let G;return e[63]!==N||e[64]!==A||e[65]!==D||e[66]!==I?(G=t.jsxs("form",{onSubmit:N,className:"space-y-4",children:[A,D,I]}),e[63]=N,e[64]=A,e[65]=D,e[66]=I,e[67]=G):G=e[67],G}function Pn(o){return o.options}function Un(o){return o.options}const Ln=ke({siteUrl:ce().min(1,"Selecione um site")});function $n(o){const e=q.c(59),{card:n,connectionId:s,companionClient:i,selfClient:a,org:r,contextSiteUrl:l,onDone:c,onIsPendingChange:u}=o;let m;e[0]!==s||e[1]!==r.id?(m=Z.commerceDiscoveryCompanionGscSites(r.id,s),e[0]=s,e[1]=r.id,e[2]=m):m=e[2];let p;e[3]!==i?(p=async()=>{const w=await i.callTool({name:"list_sites",arguments:{}});return ne(w).sites||[]},e[3]=i,e[4]=p):p=e[4];let d;e[5]!==m||e[6]!==p?(d={queryKey:m,queryFn:p},e[5]=m,e[6]=p,e[7]=d):d=e[7];const x=Ge(d);let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=Re(Ln),e[8]=b):b=e[8];const j=n.configurationState?.siteUrl||"";let v;e[9]!==j?(v={resolver:b,defaultValues:{siteUrl:j}},e[9]=j,e[10]=v):v=e[10];const g=Pe(v);let f;e[11]!==n||e[12]!==c||e[13]!==r||e[14]!==a?(f={card:n,selfClient:a,org:r,onDone:c},e[11]=n,e[12]=c,e[13]=r,e[14]=a,e[15]=f):f=e[15];const{save:y,isPending:h,error:C}=at(f);let E,_;e[16]!==h||e[17]!==u?(E=()=>{u?.(h)},_=[h,u],e[16]=h,e[17]=u,e[18]=E,e[19]=_):(E=e[18],_=e[19]),H.useEffect(E,_);let S;if(e[20]!==g||e[21]!==y){let w;e[23]!==y?(w=async I=>{y(I)},e[23]=y,e[24]=w):w=e[24],S=g.handleSubmit(w),e[20]=g,e[21]=y,e[22]=S}else S=e[22];const N=S;if(x.isLoading){let w;return e[25]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:t.jsx(We,{label:"Carregando sites..."})}),e[25]=w):w=e[25],w}if(x.isError){let w;return e[26]===Symbol.for("react.memo_cache_sentinel")?(w=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]=w):w=e[26],w}let O,U;if(e[27]!==n.configurationState?.siteUrl||e[28]!==l||e[29]!==g||e[30]!==x.data){U=Symbol.for("react.early_return_sentinel");e:{if(O=x.data||[],O.length===0){let I;e[33]===Symbol.for("react.memo_cache_sentinel")?(I=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]=I):I=e[33],U=I;break e}const w=n.configurationState?.siteUrl;if(w&&g.getValues("siteUrl")!==w)g.setValue("siteUrl",w);else if(!w&&!g.getValues("siteUrl")){const I=wn(l,O);I&&g.setValue("siteUrl",I)}}e[27]=n.configurationState?.siteUrl,e[28]=l,e[29]=g,e[30]=x.data,e[31]=O,e[32]=U}else O=e[31],U=e[32];if(U!==Symbol.for("react.early_return_sentinel"))return U;let k;e[34]!==h||e[35]!==O?(k=w=>{const{field:I}=w;return t.jsxs(me,{children:[t.jsx(ue,{children:t.jsx(lt,{options:O.map(zn),value:I.value,onChange:I.onChange,disabled:h,ariaLabel:"Site verificado"})}),t.jsx(fe,{})]})},e[34]=h,e[35]=O,e[36]=k):k=e[36];let T;e[37]!==g.control||e[38]!==k?(T=t.jsx(de,{control:g.control,name:"siteUrl",render:k}),e[37]=g.control,e[38]=k,e[39]=T):T=e[39];let R;e[40]!==g||e[41]!==T?(R=t.jsx(Le,{...g,children:T}),e[40]=g,e[41]=T,e[42]=R):R=e[42];let A;e[43]!==C?(A=C&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:C instanceof Error?C.message:"Não foi possível salvar a configuração"}),e[43]=C,e[44]=A):A=e[44];let D;e[45]!==h||e[46]!==c?(D=t.jsx(W,{type:"button",variant:"outline",onClick:c,disabled:h,children:"Cancelar"}),e[45]=h,e[46]=c,e[47]=D):D=e[47];const M=h?"Salvando...":"Salvar";let F;e[48]!==h||e[49]!==M?(F=t.jsx(W,{type:"submit",disabled:h,children:M}),e[48]=h,e[49]=M,e[50]=F):F=e[50];let K;e[51]!==D||e[52]!==F?(K=t.jsxs(Ne,{className:"pt-4",children:[D,F]}),e[51]=D,e[52]=F,e[53]=K):K=e[53];let $;return e[54]!==N||e[55]!==R||e[56]!==A||e[57]!==K?($=t.jsxs("form",{onSubmit:N,className:"space-y-4",children:[R,A,K]}),e[54]=N,e[55]=R,e[56]=A,e[57]=K,e[58]=$):$=e[58],$}function zn(o){return{value:o.siteUrl,label:o.siteUrl}}const Dn=ke({githubRepo:ce().min(1,"Selecione um repositório")});async function Fn(o,e,n){const{installations:s}=await cn(o,n),i=await Promise.all(s.map(async r=>{const l=r.type==="User"?"user":"org",u=(await e({name:"search_repositories",arguments:{query:`${l}:${r.login}`,page:1,perPage:50}})).content?.[0]?.text;if(!u)return[];try{return JSON.parse(u).items??[]}catch{return[]}})),a=new Map;for(const r of i.flat())r.full_name&&!a.has(r.full_name)&&a.set(r.full_name,r);return Array.from(a.values()).sort((r,l)=>(l.updated_at??"").localeCompare(r.updated_at??"")).map(r=>r.full_name)}function Mn(o){const e=q.c(64),{connectionId:n,companionClient:s,selfClient:i,org:a,onDone:r,onIsPendingChange:l}=o,c=Ae();let u;e[0]!==a.id?(u=ot.COMMERCE_DISCOVERY(a.id),e[0]=a.id,e[1]=u):u=e[1];const m=u;let p;e[2]!==n||e[3]!==a.id?(p=Z.commerceDiscoveryCompanionGithubRepos(a.id,n),e[2]=n,e[3]=a.id,e[4]=p):p=e[4];let d;e[5]!==m||e[6]!==s||e[7]!==n||e[8]!==i?(d=async()=>{const[I,G]=await Promise.all([Fn(Q=>i.callTool(Q),Q=>s.callTool(Q),n),i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:m}})]),L=ne(G).item?.configuration_state??null,z=typeof L?.github_repo=="string"?L.github_repo:"";return{repos:I,selectedRepo:z}},e[5]=m,e[6]=s,e[7]=n,e[8]=i,e[9]=d):d=e[9];let x;e[10]!==p||e[11]!==d?(x={queryKey:p,queryFn:d},e[10]=p,e[11]=d,e[12]=x):x=e[12];const b=Ge(x);let j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j={resolver:Re(Dn),defaultValues:{githubRepo:""}},e[13]=j):j=e[13];const v=Pe(j);let g;e[14]!==m||e[15]!==i?(g=async I=>{const G=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:m}}),z={...ne(G).item?.configuration_state??null??{},github_repo:I};await i.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:m,data:{configuration_state:z}}})},e[14]=m,e[15]=i,e[16]=g):g=e[16];let f;e[17]!==m||e[18]!==r||e[19]!==a.id||e[20]!==c?(f=async()=>{await c.invalidateQueries({queryKey:Z.commerceDiscoveryConnection(a.id,m)}),await c.invalidateQueries({queryKey:Z.commerceDiscoveryCompanionConnectionsPrefix(a.id)}),r()},e[17]=m,e[18]=r,e[19]=a.id,e[20]=c,e[21]=f):f=e[21];let y;e[22]!==g||e[23]!==f?(y={mutationFn:g,onSuccess:f},e[22]=g,e[23]=f,e[24]=y):y=e[24];const h=pe(y),C=h.isPending;let E,_;e[25]!==C||e[26]!==l?(_=()=>{l?.(C)},E=[C,l],e[25]=C,e[26]=l,e[27]=E,e[28]=_):(E=e[27],_=e[28]),H.useEffect(_,E);let S;if(e[29]!==v||e[30]!==h){let I;e[32]!==h?(I=async G=>{h.mutate(G.githubRepo)},e[32]=h,e[33]=I):I=e[33],S=v.handleSubmit(I),e[29]=v,e[30]=h,e[31]=S}else S=e[31];const N=S;if(b.isLoading){let I;return e[34]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:t.jsx(We,{label:"Carregando repositórios..."})}),e[34]=I):I=e[34],I}if(b.isError){let I;return e[35]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("div",{className:"space-y-4",children:t.jsx("p",{className:"text-sm text-destructive",children:"Não foi possível carregar os repositórios do GitHub."})}),e[35]=I):I=e[35],I}let O;e[36]!==b.data?.repos?(O=b.data?.repos??[],e[36]=b.data?.repos,e[37]=O):O=e[37];const U=O,k=b.data?.selectedRepo??"";if(U.length===0){let I;return e[38]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("div",{className:"space-y-4",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhum repositório acessível foi encontrado nesta conexão do GitHub."})}),e[38]=I):I=e[38],I}k&&v.getValues("githubRepo")!==k&&v.setValue("githubRepo",k);let T;e[39]!==C||e[40]!==U?(T=I=>{const{field:G}=I;return t.jsxs(me,{children:[t.jsx(ue,{children:t.jsx(lt,{options:U.map(qn),value:G.value,onChange:G.onChange,disabled:C,ariaLabel:"Repositório",searchPlaceholder:"Buscar repositório..."})}),t.jsx(fe,{})]})},e[39]=C,e[40]=U,e[41]=T):T=e[41];let R;e[42]!==v.control||e[43]!==T?(R=t.jsx(de,{control:v.control,name:"githubRepo",render:T}),e[42]=v.control,e[43]=T,e[44]=R):R=e[44];let A;e[45]!==v||e[46]!==R?(A=t.jsx(Le,{...v,children:R}),e[45]=v,e[46]=R,e[47]=A):A=e[47];let D;e[48]!==h.error?(D=h.error&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:h.error instanceof Error?h.error.message:"Não foi possível salvar a configuração"}),e[48]=h.error,e[49]=D):D=e[49];let M;e[50]!==C||e[51]!==r?(M=t.jsx(W,{type:"button",variant:"outline",onClick:r,disabled:C,children:"Cancelar"}),e[50]=C,e[51]=r,e[52]=M):M=e[52];const F=C?"Salvando...":"Salvar";let K;e[53]!==C||e[54]!==F?(K=t.jsx(W,{type:"submit",disabled:C,children:F}),e[53]=C,e[54]=F,e[55]=K):K=e[55];let $;e[56]!==M||e[57]!==K?($=t.jsxs(Ne,{className:"pt-4",children:[M,K]}),e[56]=M,e[57]=K,e[58]=$):$=e[58];let w;return e[59]!==N||e[60]!==A||e[61]!==D||e[62]!==$?(w=t.jsxs("form",{onSubmit:N,className:"space-y-4",children:[A,D,$]}),e[59]=N,e[60]=A,e[61]=D,e[62]=$,e[63]=w):w=e[63],w}function qn(o){return{value:o,label:o}}const Kn={vtex:On,"google-analytics":Rn,"google-search-console":$n,github:Mn},Ee="deco-reader@decocms.iam.gserviceaccount.com",Ft={"google-analytics":"ga4","google-search-console":"gsc"},Mt={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 ${Ee} 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 ${Ee} e escolha permissão Completa.`,"Copie o endereço do site como aparece no seletor de propriedades e cole abaixo."]}};function Vn(o,e){const n=Mt[o].label;switch(e){case"no-access":return{title:`Ainda não conseguimos acessar este recurso no ${n}.`,steps:o==="ga4"?[`Confirme que ${Ee} 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 ${Ee} 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:o==="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 Gn(o){const e=q.c(76),{provider:n,siteUrl:s,selfClient:i,org:a,initialResourceId:r,onDone:l,onIsPendingChange:c,onOAuthInstead:u}=o,m=Mt[n],p=Ae(),[d,x]=H.useState(null);let b,j;if(e[0]!==m.resourceLabel){const P=ke({resourceId:ce().trim().min(1,`Informe o ${m.resourceLabel.toLowerCase()}`)});j=Pe,b=Re(P),e[0]=m.resourceLabel,e[1]=b,e[2]=j}else b=e[1],j=e[2];const v=r??"";let g;e[3]!==v?(g={resourceId:v},e[3]=v,e[4]=g):g=e[4];let f;e[5]!==b||e[6]!==g?(f={resolver:b,defaultValues:g},e[5]=b,e[6]=g,e[7]=f):f=e[7];const y=j(f);let h;e[8]!==n||e[9]!==i||e[10]!==s?(h=async P=>{if(!s)throw new Error("URL da loja indisponível — recarregue a página.");const B=await i.callTool({name:"COMMERCE_DISCOVERY_BIND",arguments:{siteUrl:s,provider:n,resourceId:P.resourceId}});return ne(B)},e[8]=n,e[9]=i,e[10]=s,e[11]=h):h=e[11];let C,E;e[12]!==c?(C=()=>c?.(!0),E=()=>c?.(!1),e[12]=c,e[13]=C,e[14]=E):(C=e[13],E=e[14]);let _;e[15]!==m.label||e[16]!==l||e[17]!==a||e[18]!==n||e[19]!==p||e[20]!==s?(_=async P=>{if(P.ok){x(null),He.success(`${m.label} conectado`),s&&await p.invalidateQueries({queryKey:Z.commerceDiscoveryConnectionStatus(a.id,s)}),l();return}x({...Vn(n,P.reason??"unknown"),detail:P.detail})},e[15]=m.label,e[16]=l,e[17]=a,e[18]=n,e[19]=p,e[20]=s,e[21]=_):_=e[21];let S;e[22]!==h||e[23]!==C||e[24]!==E||e[25]!==_?(S={mutationFn:h,onMutate:C,onSettled:E,onSuccess:_},e[22]=h,e[23]=C,e[24]=E,e[25]=_,e[26]=S):S=e[26];const N=pe(S);let O;if(e[27]!==y||e[28]!==N){let P;e[30]!==N?(P=B=>N.mutate(B),e[30]=N,e[31]=P):P=e[31],O=y.handleSubmit(P),e[27]=y,e[28]=N,e[29]=O}else O=e[29];const U=O,k=N.isPending,T=Qn;let R;e[32]!==m.connectSteps?(R=m.connectSteps.map(Bn),e[32]=m.connectSteps,e[33]=R):R=e[33];let A;e[34]!==R?(A=t.jsx("ol",{className:"space-y-2 text-sm text-muted-foreground",children:R}),e[34]=R,e[35]=A):A=e[35];let D;e[36]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx("code",{className:"min-w-0 flex-1 truncate text-xs text-foreground",children:Ee}),e[36]=D):D=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/40 p-2",children:[D,t.jsx(W,{type:"button",variant:"ghost",size:"icon-sm",onClick:T,"aria-label":"Copiar e-mail do service account",children:t.jsx(zt,{size:16})})]}),e[37]=M):M=e[37];let F;e[38]!==m.resourceHint||e[39]!==m.resourceLabel||e[40]!==m.resourcePlaceholder||e[41]!==k?(F=P=>{const{field:B}=P;return t.jsxs(me,{children:[t.jsx(Ke,{children:m.resourceLabel}),t.jsx(ue,{children:t.jsx(Ue,{...B,placeholder:m.resourcePlaceholder,disabled:k,autoComplete:"off"})}),t.jsx(on,{children:m.resourceHint}),t.jsx(fe,{})]})},e[38]=m.resourceHint,e[39]=m.resourceLabel,e[40]=m.resourcePlaceholder,e[41]=k,e[42]=F):F=e[42];let K;e[43]!==y.control||e[44]!==F?(K=t.jsx(de,{control:y.control,name:"resourceId",render:F}),e[43]=y.control,e[44]=F,e[45]=K):K=e[45];let $;e[46]!==y||e[47]!==K?($=t.jsx(Le,{...y,children:K}),e[46]=y,e[47]=K,e[48]=$):$=e[48];let w;e[49]!==d?(w=d&&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:d.title}),t.jsx("ol",{className:"space-y-1 text-sm text-muted-foreground",children:d.steps.map(Hn)})]}),e[49]=d,e[50]=w):w=e[50];let I;e[51]!==N.error||e[52]!==N.isError?(I=N.isError&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:N.error instanceof Error?N.error.message:"Não foi possível vincular."}),e[51]=N.error,e[52]=N.isError,e[53]=I):I=e[53];let G;e[54]!==k||e[55]!==u?(G=u?t.jsx("button",{type:"button",onClick:u,disabled:k,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]=k,e[55]=u,e[56]=G):G=e[56];let L;e[57]!==k||e[58]!==l?(L=t.jsx(W,{type:"button",variant:"outline",onClick:l,disabled:k,children:"Cancelar"}),e[57]=k,e[58]=l,e[59]=L):L=e[59];const z=k?"Verificando...":"Vincular";let Q;e[60]!==k||e[61]!==z?(Q=t.jsx(W,{type:"submit",disabled:k,children:z}),e[60]=k,e[61]=z,e[62]=Q):Q=e[62];let J;e[63]!==L||e[64]!==Q?(J=t.jsxs("div",{className:"flex gap-2",children:[L,Q]}),e[63]=L,e[64]=Q,e[65]=J):J=e[65];let X;e[66]!==G||e[67]!==J?(X=t.jsxs(Ne,{className:"flex-col gap-2 pt-2 sm:flex-row sm:items-center sm:justify-between",children:[G,J]}),e[66]=G,e[67]=J,e[68]=X):X=e[68];let ee;return e[69]!==U||e[70]!==A||e[71]!==$||e[72]!==w||e[73]!==I||e[74]!==X?(ee=t.jsxs("form",{onSubmit:U,className:"space-y-4",children:[A,M,$,w,I,X]}),e[69]=U,e[70]=A,e[71]=$,e[72]=w,e[73]=I,e[74]=X,e[75]=ee):ee=e[75],ee}function Hn(o){return t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{"aria-hidden":!0,children:"•"}),t.jsx("span",{children:o})]},o)}function Bn(o,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:o})]},o)}function Qn(){navigator.clipboard?.writeText(Ee),He.success("E-mail copiado")}function Wn(){const o=q.c(2);let e;o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"size-9 shrink-0 animate-pulse rounded-lg bg-muted/60"}),o[0]=e):e=o[0];let n;return o[1]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-border bg-card p-4 sm:h-full sm:flex-col sm:items-stretch",children:[e,t.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[t.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted/60"}),t.jsx("div",{className:"h-3 w-full animate-pulse rounded bg-muted/60"})]}),t.jsx("div",{className:"h-8 w-20 shrink-0 animate-pulse rounded-lg bg-muted/60 sm:mt-auto sm:w-full"})]}),o[1]=n):n=o[1],n}const bt="rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground";function Yn(o){const e=q.c(37),{card:n,connecting:s,disabled:i,onConnect:a,org:r,selfClient:l,siteUrl:c,autoOpenConfigFieldKey:u,onAutoOpenConfigHandled:m}=o,p=n.linkedConnectionId,d=Ft[n.bindingType],x=!!d&&n.boundVia!=="oauth";let b;e[0]!==u||e[1]!==n||e[2]!==s||e[3]!==i||e[4]!==p||e[5]!==m||e[6]!==a||e[7]!==r||e[8]!==d||e[9]!==l||e[10]!==c||e[11]!==x?(b=x&&d?t.jsx(Jn,{card:n,provider:d,org:r,selfClient:l,siteUrl:c,onOAuthInstead:a,disabled:i,connecting:s}):n.satisfied&&p?t.jsxs("div",{className:"flex items-center justify-end gap-1 sm:justify-start",children:[t.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[t.jsx(rt,{size:16,className:"text-success"})," Conectado"]}),t.jsx(H.Suspense,{fallback:t.jsx(Zn,{}),children:t.jsx(Xn,{card:n,org:r,selfClient:l,connectionId:p,contextSiteUrl:c,autoOpen:Cn({autoOpenFieldKey:u,card:n}),onAutoOpenHandled:m})})]}):t.jsx(W,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:i||s,onClick:a,"aria-label":`Conectar ${n.title}`,children:s?t.jsx(st,{size:16,className:"animate-spin"}):"Conectar"}),e[0]=u,e[1]=n,e[2]=s,e[3]=i,e[4]=p,e[5]=m,e[6]=a,e[7]=r,e[8]=d,e[9]=l,e[10]=c,e[11]=x,e[12]=b):b=e[12];const j=b;let v;e[13]!==n.icon||e[14]!==n.title?(v=t.jsx(it,{icon:n.icon,name:n.title,size:"sm",fit:"contain",className:"shrink-0 p-1.5"}),e[13]=n.icon,e[14]=n.title,e[15]=v):v=e[15];let g;e[16]!==n.area?(g=n.area&&t.jsx("span",{className:oe("hidden sm:inline-block",bt),children:n.area}),e[16]=n.area,e[17]=g):g=e[17];let f;e[18]!==v||e[19]!==g?(f=t.jsxs("div",{className:"shrink-0 self-start sm:flex sm:w-full sm:items-center sm:justify-between sm:gap-2",children:[v,g]}),e[18]=v,e[19]=g,e[20]=f):f=e[20];let y;e[21]!==n.area?(y=n.area&&t.jsx("span",{className:oe("mb-1 inline-block sm:hidden",bt),children:n.area}),e[21]=n.area,e[22]=y):y=e[22];let h;e[23]!==n.title?(h=t.jsx("p",{className:"text-sm font-medium text-foreground",children:n.title}),e[23]=n.title,e[24]=h):h=e[24];let C;e[25]!==n.headline?(C=n.headline&&t.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm leading-5 text-muted-foreground",children:n.headline}),e[25]=n.headline,e[26]=C):C=e[26];let E;e[27]!==y||e[28]!==h||e[29]!==C?(E=t.jsxs("div",{className:"min-w-0 flex-1",children:[y,h,C]}),e[27]=y,e[28]=h,e[29]=C,e[30]=E):E=e[30];let _;e[31]!==j?(_=t.jsx("div",{className:"shrink-0 sm:mt-auto sm:w-full sm:pt-1",children:j}),e[31]=j,e[32]=_):_=e[32];let S;return e[33]!==f||e[34]!==E||e[35]!==_?(S=t.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-border bg-card p-4 sm:h-full sm:flex-col sm:items-stretch",children:[f,E,_]}),e[33]=f,e[34]=E,e[35]=_,e[36]=S):S=e[36],S}function Jn(o){const e=q.c(39),{card:n,provider:s,org:i,selfClient:a,siteUrl:r,onOAuthInstead:l,disabled:c,connecting:u}=o,[m,p]=H.useState(!1),[d,x]=H.useState(!1);let b;e[0]!==d?(b=T=>{!T&&d||p(T)},e[0]=d,e[1]=b):b=e[1];const j=b;let v;e[2]!==n.satisfied||e[3]!==n.title||e[4]!==u||e[5]!==c?(v=n.satisfied?t.jsxs("div",{className:"flex items-center justify-end gap-1 sm:justify-start",children:[t.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[t.jsx(rt,{size:16,className:"text-success"})," Conectado"]}),t.jsxs(Pt,{children:[t.jsx(Ut,{asChild:!0,children:t.jsx(W,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:()=>p(!0),"aria-label":`Configurar ${n.title}`,children:t.jsx($t,{size:16})})}),t.jsx(Lt,{children:"Editar configuração"})]})]}):t.jsx(W,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:c||u,onClick:()=>p(!0),"aria-label":`Conectar ${n.title}`,children:u?t.jsx(st,{size:16,className:"animate-spin"}):"Conectar"}),e[2]=n.satisfied,e[3]=n.title,e[4]=u,e[5]=c,e[6]=v):v=e[6];let g;e[7]!==n.icon||e[8]!==n.title?(g=t.jsx(it,{icon:n.icon,name:n.title,size:"md",fit:"contain",className:"p-1.5"}),e[7]=n.icon,e[8]=n.title,e[9]=g):g=e[9];let f;e[10]!==n.title?(f=t.jsx(Tt,{children:n.title}),e[10]=n.title,e[11]=f):f=e[11];let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(Ot,{children:"Conceda acesso ao nosso leitor e informe o identificador"}),e[12]=y):y=e[12];let h;e[13]!==f?(h=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[f,y]}),e[13]=f,e[14]=h):h=e[14];let C;e[15]!==g||e[16]!==h?(C=t.jsxs(At,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[g,h]}),e[15]=g,e[16]=h,e[17]=C):C=e[17];const E=n.boundResource??void 0;let _;e[18]===Symbol.for("react.memo_cache_sentinel")?(_=()=>p(!1),e[18]=_):_=e[18];let S;e[19]!==n.satisfied||e[20]!==l?(S=n.satisfied?void 0:()=>{p(!1),l()},e[19]=n.satisfied,e[20]=l,e[21]=S):S=e[21];let N;e[22]!==i||e[23]!==s||e[24]!==a||e[25]!==r||e[26]!==S||e[27]!==E?(N=t.jsx(Gn,{provider:s,siteUrl:r,selfClient:a,org:i,initialResourceId:E,onDone:_,onIsPendingChange:x,onOAuthInstead:S}),e[22]=i,e[23]=s,e[24]=a,e[25]=r,e[26]=S,e[27]=E,e[28]=N):N=e[28];let O;e[29]!==N||e[30]!==C?(O=t.jsxs(kt,{className:"sm:max-w-lg",children:[C,N]}),e[29]=N,e[30]=C,e[31]=O):O=e[31];let U;e[32]!==j||e[33]!==m||e[34]!==O?(U=t.jsx(Rt,{open:m,onOpenChange:j,children:O}),e[32]=j,e[33]=m,e[34]=O,e[35]=U):U=e[35];let k;return e[36]!==U||e[37]!==v?(k=t.jsxs(t.Fragment,{children:[v,U]}),e[36]=U,e[37]=v,e[38]=k):k=e[38],k}function Zn(){const o=q.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"size-8 shrink-0 animate-pulse rounded-lg bg-muted/60"}),o[0]=e):e=o[0],e}function Xn(o){const e=q.c(60),{card:n,org:s,selfClient:i,connectionId:a,contextSiteUrl:r,autoOpen:l,onAutoOpenHandled:c}=o;let u;e[0]!==a||e[1]!==s.id||e[2]!==s.slug?(u={connectionId:a,orgId:s.id,orgSlug:s.slug},e[0]=a,e[1]=s.id,e[2]=s.slug,e[3]=u):u=e[3];const m=Qe(u),[p,d]=H.useState(l),[x,b]=H.useState(!1),j=Ae(),v=Kn[n.bindingType],g=jn(n.configurationState);let f;e[4]!==l||e[5]!==c?(f=()=>{d(!1),l&&c()},e[4]=l,e[5]=c,e[6]=f):f=e[6];const y=f;let h;e[7]!==y||e[8]!==x?(h=z=>{if(!(!z&&x)){if(!z){y();return}d(!0)}},e[7]=y,e[8]=x,e[9]=h):h=e[9];const C=h;let E;e[10]!==a||e[11]!==i?(E=async()=>{await i.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:a,force:!0}})},e[10]=a,e[11]=i,e[12]=E):E=e[12];let _;e[13]!==n.title||e[14]!==y||e[15]!==s.id||e[16]!==j?(_=async()=>{await j.invalidateQueries({queryKey:Z.commerceDiscoveryCompanionConnectionsPrefix(s.id)}),He.success(`${n.title} desconectado`),y()},e[13]=n.title,e[14]=y,e[15]=s.id,e[16]=j,e[17]=_):_=e[17];let S;e[18]!==E||e[19]!==_?(S={mutationFn:E,onSuccess:_,onError:es},e[18]=E,e[19]=_,e[20]=S):S=e[20];const N=pe(S);if(!v)return null;let O;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=()=>d(!0),e[21]=O):O=e[21];const U=`Configurar ${n.title}`;let k;e[22]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx($t,{size:16}),e[22]=k):k=e[22];let T;e[23]!==U?(T=t.jsx(Ut,{asChild:!0,children:t.jsx(W,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:O,"aria-label":U,children:k})}),e[23]=U,e[24]=T):T=e[24];const R=g.length>0?"Editar configuração":"Configurar";let A;e[25]!==R?(A=t.jsx(Lt,{children:R}),e[25]=R,e[26]=A):A=e[26];let D;e[27]!==T||e[28]!==A?(D=t.jsxs(Pt,{children:[T,A]}),e[27]=T,e[28]=A,e[29]=D):D=e[29];let M;e[30]!==n.icon||e[31]!==n.title?(M=t.jsx(it,{icon:n.icon,name:n.title,size:"md",fit:"contain",className:"p-1.5"}),e[30]=n.icon,e[31]=n.title,e[32]=M):M=e[32];let F;e[33]!==n.title?(F=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[t.jsx(Tt,{children:n.title}),t.jsxs(Ot,{children:["Configure o ",n.title," para enriquecer os dados"]})]}),e[33]=n.title,e[34]=F):F=e[34];let K;e[35]!==M||e[36]!==F?(K=t.jsxs(At,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[M,F]}),e[35]=M,e[36]=F,e[37]=K):K=e[37];let $;e[38]!==N?($=()=>N.mutate(),e[38]=N,e[39]=$):$=e[39];let w;e[40]!==v||e[41]!==n||e[42]!==y||e[43]!==m||e[44]!==a||e[45]!==r||e[46]!==s||e[47]!==i||e[48]!==$?(w=t.jsx(v,{card:n,connectionId:a,companionClient:m,selfClient:i,org:s,contextSiteUrl:r,onDone:y,onDisconnect:$,onIsPendingChange:b}),e[40]=v,e[41]=n,e[42]=y,e[43]=m,e[44]=a,e[45]=r,e[46]=s,e[47]=i,e[48]=$,e[49]=w):w=e[49];let I;e[50]!==K||e[51]!==w?(I=t.jsxs(kt,{className:"sm:max-w-lg",children:[K,w]}),e[50]=K,e[51]=w,e[52]=I):I=e[52];let G;e[53]!==p||e[54]!==C||e[55]!==I?(G=t.jsx(Rt,{open:p,onOpenChange:C,children:I}),e[53]=p,e[54]=C,e[55]=I,e[56]=G):G=e[56];let L;return e[57]!==D||e[58]!==G?(L=t.jsxs(t.Fragment,{children:[D,G]}),e[57]=D,e[58]=G,e[59]=L):L=e[59],L}function es(){He.error("Não foi possível desconectar. Tente novamente.")}const ct={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 ts(o){const e=q.c(40),{selfClient:n,org:s,cdConnectionId:i,siteUrl:a}=o;let r;e[0]!==i||e[1]!==s.id||e[2]!==s.slug?(r={connectionId:i,orgId:s.id,orgSlug:s.slug},e[0]=i,e[1]=s.id,e[2]=s.slug,e[3]=r):r=e[3];const l=Qe(r);let c;e[4]!==i||e[5]!==s.id?(c=Z.commerceDiscoveryCompanionSchema(s.id,i),e[4]=i,e[5]=s.id,e[6]=c):c=e[6];let u;e[7]!==l?(u=async()=>{const P=await l.callTool({name:"MCP_CONFIGURATION",arguments:{}});return ne(P)},e[7]=l,e[8]=u):u=e[8];let m;e[9]!==c||e[10]!==u?(m={queryKey:c,queryFn:u},e[9]=c,e[10]=u,e[11]=m):m=e[11];const p=Se(m),d=hn(p.data?.stateSchema??{properties:{}}),x=d.map(ms),b=d.map(ds).filter(cs),j=d.filter(ls).map(as),v=[...b,...j].sort().join(",");let g;e[12]!==i||e[13]!==s.id?(g=Z.commerceDiscoveryConnection(s.id,i),e[12]=i,e[13]=s.id,e[14]=g):g=e[14];let f;e[15]!==i||e[16]!==n?(f=async()=>{const P=await n.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:i}});return ne(P)},e[15]=i,e[16]=n,e[17]=f):f=e[17];let y;e[18]!==g||e[19]!==f?(y={queryKey:g,queryFn:f},e[18]=g,e[19]=f,e[20]=y):y=e[20];const C=Se(y).data?.item?.configuration_state??null;let E;e[21]!==C?(E=P=>C?.[P.fieldKey]?.value,e[21]=C,e[22]=E):E=e[22];const _=d.map(E).filter(rs),S=[...x.map(is),...b.map(os),..._.map(ss)].sort().join(","),O=Se({queryKey:Z.commerceDiscoveryCompanionConnections(s.id,S),queryFn:async()=>{if(d.length===0)return{items:[]};const P=[{field:["app_name"],operator:"in",value:x},{field:["app_id"],operator:"in",value:b}];_.length>0&&P.push({field:["id"],operator:"in",value:_});const B=await n.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:P},limit:1e3}});return ne(B)}}).data?.items??[],U=new Set(_),k=O.filter(P=>U.has(P.id)),T=k.filter(ns);let R;e[23]!==s.id||e[24]!==s.slug?(R=P=>({queryKey:Z.commerceDiscoveryCompanionOAuthStatus(s.id,P.id),queryFn:async()=>{try{const B=await fetch(`/api/${encodeURIComponent(s.slug)}/connections/${encodeURIComponent(P.id)}/oauth-token/status`,{credentials:"include"});return B.ok?{hasToken:(await B.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}},retry:!1}),e[23]=s.id,e[24]=s.slug,e[25]=R):R=e[25];const A=dn({queries:T.map(R)});let D;e[26]!==A?(D=(P,B)=>[P.id,A[B]?.data?.hasToken===!0],e[26]=A,e[27]=D):D=e[27];const M=new Map(T.map(D)),F={};for(const P of k)F[P.id]=!P.oauth_config||!!P.connection_token||M.get(P.id)===!0;const K=Se({queryKey:Z.commerceDiscoveryCompanionRegistry(s.id,v),queryFn:async()=>{if(d.length===0)return{items:[]};const P=xn(b,j),B=await nn(ot.REGISTRY(s.id),s.id,s.slug,"COLLECTION_REGISTRY_APP_LIST",{...P?{where:P}:{},limit:1e3});return ne(B)}}),$={},w={};for(const P of K.data?.items??[])$[P.id]=P,P.server?.name&&(w[P.server.name]=P);let I;e[28]!==s.id||e[29]!==a?(I=Z.commerceDiscoveryConnectionStatus(s.id,a??""),e[28]=s.id,e[29]=a,e[30]=I):I=e[30];const G=!!a;let L;e[31]!==n||e[32]!==a?(L=async()=>{const P=await n.callTool({name:"COMMERCE_DISCOVERY_CONNECTION_STATUS",arguments:{siteUrl:a}});return ne(P)},e[31]=n,e[32]=a,e[33]=L):L=e[33];let z;e[34]!==I||e[35]!==G||e[36]!==L?(z={queryKey:I,enabled:G,queryFn:L},e[34]=I,e[35]=G,e[36]=L,e[37]=z):z=e[37];const Q=Ge(z),J={};for(const[P,B]of Object.entries(Ft)){const ie=Q.data?.providers?.[B];ie?.connected&&ie.via==="sa"&&(J[P]={resource:ie.resource??null})}const X=En({requirements:d,itemsById:$,itemsByName:w,connections:O,connectionReadiness:F,configurationState:C,curated:ct,saBindings:J});let ee;return e[38]!==X?(ee={cards:X},e[38]=X,e[39]=ee):ee=e[39],ee}function ns(o){return o.oauth_config&&!o.connection_token}function ss(o){return`linked:${o}`}function os(o){return`app:${o}`}function is(o){return`binding:${o}`}function rs(o){return typeof o=="string"&&o.length>0}function as(o){return o.bindingType}function ls(o){return!ct[o.bindingType]}function cs(o){return!!o}function ds(o){return ct[o.bindingType]?.registryAppId}function ms(o){return o.bindingType}function us({selfClient:o,org:e,userId:n,cdConnectionId:s}){const i=Ae(),[a,r]=H.useState(null),[l,c]=H.useState(null),u=async(p,d)=>{const x=await o.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:p,data:d}});return ne(x)};async function m(p){r(p.fieldKey),c(null);const d={app_name:p.title,field_key:p.fieldKey,organization_id:e.id};te("commerce_onboarding_companion_connect_clicked",d);try{let x=p.candidateConnectionId;if(!x){const y=sn(p.registryItem,e.id,n,{remoteIndex:0}),h=y.connection_type==="STDIO",C=!!y.connection_url,E=h&&y.connection_headers&&typeof y.connection_headers=="object"&&"command"in y.connection_headers;if(!C&&!E)return te("commerce_onboarding_companion_connect_failed",{...d,error:"no_connection_method"}),c(`${p.title} cannot be connected: no connection method available`),!1;const _=await o.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:y}});x=ne(_).item.id}const b=x,j=await mn({connectionId:b,orgId:e.id,orgSlug:e.slug,persistFallback:y=>u(b,{connection_token:y}).then(()=>{})});if(!j.ok)return te("commerce_onboarding_companion_connect_failed",{...d,error:j.error}),c(`Couldn't sign in to ${p.title}: ${j.error}`),!1;const v=await o.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:s}}),g=ne(v).item?.configuration_state??null,f=yn(g,p.fieldKey,p.bindingType,b);return await u(s,{configuration_state:f}),await i.invalidateQueries({queryKey:Z.commerceDiscoveryConnection(e.id,s)}),await i.invalidateQueries({queryKey:Z.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),te("commerce_onboarding_companion_connected",d),!0}catch(x){return te("commerce_onboarding_companion_connect_failed",{...d,error:x instanceof Error?x.message:String(x)}),c(x instanceof Error?x.message:String(x)),!1}finally{r(null)}}return{connect:m,connectingFieldKey:a,error:l}}const dt="flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none md:gap-4";function mt(){const o=q.c(1);let e;return o[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"}),o[0]=e):e=o[0],e}function fs(){const o=q.c(1);let e;return o[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(ps)}),o[0]=e):e=o[0],e}function ps(o){return t.jsx(Wn,{},o)}function ut(){const o=q.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:dt,children:[t.jsx(mt,{}),t.jsx(fs,{})]}),o[0]=e):e=o[0],e}function gs(o){const e=q.c(5),{onRetry:n}=o;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx(mt,{}),e[0]=s):s=e[0];let i,a;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("p",{className:"text-sm text-foreground",children:"Não foi possível carregar as integrações complementares."}),a=t.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Algo deu errado ao carregar suas integrações."}),e[1]=i,e[2]=a):(i=e[1],a=e[2]);let r;return e[3]!==n?(r=t.jsxs("div",{className:dt,children:[s,t.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[i,a,t.jsx(W,{type:"button",variant:"outline",size:"sm",className:"mt-3",onClick:n,children:"Tentar novamente"})]})]}),e[3]=n,e[4]=r):r=e[4],r}function hs(o){const e=q.c(2);let n;return e[0]!==o?(n=t.jsx(Ct,{children:s=>{const{reset:i}=s;return t.jsx(_t,{fallback:a=>{const{resetError:r}=a;return t.jsx(gs,{onRetry:()=>{i(),r()}})},children:t.jsx(H.Suspense,{fallback:t.jsx(ut,{}),children:t.jsx(xs,{...o})})})}}),e[0]=o,e[1]=n):n=e[1],n}function xs(o){const e=q.c(38),{org:n,cdConnectionId:s,siteUrl:i}=o,{data:a}=Be.useSession(),r=a?.user?.id??"";let l;e[0]!==n.id||e[1]!==n.slug?(l={connectionId:wt,orgId:n.id,orgSlug:n.slug},e[0]=n.id,e[1]=n.slug,e[2]=l):l=e[2];const c=Qe(l);let u;e[3]!==s||e[4]!==n||e[5]!==c||e[6]!==i?(u={selfClient:c,org:n,cdConnectionId:s,siteUrl:i},e[3]=s,e[4]=n,e[5]=c,e[6]=i,e[7]=u):u=e[7];const{cards:m}=ts(u);let p;e[8]!==s||e[9]!==n||e[10]!==c||e[11]!==r?(p={selfClient:c,org:n,userId:r,cdConnectionId:s},e[8]=s,e[9]=n,e[10]=c,e[11]=r,e[12]=p):p=e[12];const{connect:d,connectingFieldKey:x,error:b}=us(p),[j,v]=H.useState(null);if(m.length===0)return null;const g=x!==null;let f;e[13]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(mt,{}),e[13]=f):f=e[13];let y;e[14]!==b?(y=b&&t.jsx("p",{role:"alert",className:"mb-3 text-sm text-destructive",children:b}),e[14]=b,e[15]=y):y=e[15];let h;if(e[16]!==j||e[17]!==g||e[18]!==m||e[19]!==d||e[20]!==x||e[21]!==n||e[22]!==c||e[23]!==i){let _;e[25]!==j||e[26]!==g||e[27]!==d||e[28]!==x||e[29]!==n||e[30]!==c||e[31]!==i?(_=S=>{const N=async()=>{await d(S)&&v(S.fieldKey)};return t.jsx(Yn,{card:S,connecting:x===S.fieldKey,disabled:g&&x!==S.fieldKey,org:n,selfClient:c,siteUrl:i,autoOpenConfigFieldKey:j,onAutoOpenConfigHandled:()=>v(O=>O===S.fieldKey?null:O),onConnect:()=>{N()}},S.fieldKey)},e[25]=j,e[26]=g,e[27]=d,e[28]=x,e[29]=n,e[30]=c,e[31]=i,e[32]=_):_=e[32],h=m.map(_),e[16]=j,e[17]=g,e[18]=m,e[19]=d,e[20]=x,e[21]=n,e[22]=c,e[23]=i,e[24]=h}else h=e[24];let C;e[33]!==h?(C=t.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:h}),e[33]=h,e[34]=C):C=e[34];let E;return e[35]!==y||e[36]!==C?(E=t.jsxs("div",{className:dt,children:[f,t.jsxs(tt,{wrapperClassName:"flex min-h-0 flex-1 flex-col md:block",className:"-mx-1 min-h-0 flex-1 overflow-y-auto px-1 md:max-h-[min(60vh,calc(100dvh-330px))] md:flex-none",children:[y,C]})]}),e[35]=y,e[36]=C,e[37]=E):E=e[37],E}const ft="https://decocms.com/agendar",ys="Precisa de ajuda? Fale conosco",bs="Agende uma chamada de 20 minutos e rodamos o diagnóstico com você, ao vivo.",Te=[{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"}],vs="var(--brand-green-dark)";function pt({siteUrl:o,email:e}){const n=new URL(ft);return o&&n.searchParams.set("siteUrl",o),e&&n.searchParams.set("email",e),n.toString()}function js(o){const e=q.c(12),{href:n,size:s,className:i,orgId:a}=o,r=n===void 0?ft:n,l=s===void 0?"lg":s;let c;e[0]!==i?(c=oe("w-full",i),e[0]=i,e[1]=c):c=e[1];let u;e[2]!==a?(u=()=>te("commerce_onboarding_meeting_cta_clicked",{placement:"visual_card",organization_id:a}),e[2]=a,e[3]=u):u=e[3];let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(Dt,{size:16}),e[4]=m):m=e[4];let p;e[5]!==r||e[6]!==u?(p=t.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",onClick:u,children:["Agendar uma reunião",m]}),e[5]=r,e[6]=u,e[7]=p):p=e[7];let d;return e[8]!==l||e[9]!==c||e[10]!==p?(d=t.jsx(W,{asChild:!0,variant:"outline",size:l,className:c,children:p}),e[8]=l,e[9]=c,e[10]=p,e[11]=d):d=e[11],d}function Cs(o){const e=q.c(10),{size:n}=o,s=n===void 0?72:n;let i;e[0]!==s?(i=Math.round(s*.3),e[0]=s,e[1]=i):i=e[1];const a=i;let r;e[2]!==s?(r={height:s},e[2]=s,e[3]=r):r=e[3];let l;e[4]!==a||e[5]!==s?(l=Te.map((u,m)=>t.jsxs("div",{className:"relative shrink-0",style:{width:s,height:s,marginLeft:m===0?0:-a,zIndex:Te.length-m},children:[t.jsx("div",{className:"h-full w-full overflow-hidden rounded-full border-4 border-card bg-muted",children:t.jsx("img",{src:u.photo,alt:u.alt,className:"h-full w-full object-cover",loading:"lazy"})}),m===0&&t.jsxs("span",{className:"absolute bottom-1.5 right-1.5 flex h-3.5 w-3.5",children:[t.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-success opacity-60 motion-safe:animate-ping","aria-hidden":!0}),t.jsx("span",{className:"relative inline-flex h-3.5 w-3.5 rounded-full border-2 border-card bg-success"})]})]},u.photo)),e[4]=a,e[5]=s,e[6]=l):l=e[6];let c;return e[7]!==r||e[8]!==l?(c=t.jsx("div",{className:"flex items-end",style:r,children:l}),e[7]=r,e[8]=l,e[9]=c):c=e[9],c}function gt(o){const e=q.c(6),{href:n,orgId:s}=o;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"h-20",style:{backgroundColor:vs}}),e[0]=i):i=e[0];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{className:"-mt-9 mb-4",children:t.jsx(Cs,{})}),e[1]=a):a=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx("h2",{className:"text-lg font-medium leading-6 text-foreground",children:ys}),t.jsx("p",{className:"text-sm leading-5 text-muted-foreground",children:bs})]}),e[2]=r):r=e[2];let l;return e[3]!==n||e[4]!==s?(l=t.jsx("div",{className:"relative flex h-full w-full items-center justify-center p-10",children:t.jsxs("div",{className:"w-full max-w-[440px] overflow-hidden rounded-3xl border border-border bg-card card-shadow",children:[i,t.jsxs("div",{className:"px-8 pb-8",children:[a,r,t.jsx(js,{href:n,size:"lg",className:"mt-6",orgId:s})]})]})}),e[3]=n,e[4]=s,e[5]=l):l=e[5],l}function _s(o){const e=q.c(13),{className:n,href:s,orgId:i}=o,a=s===void 0?ft:s;let r;e[0]!==i?(r=()=>te("commerce_onboarding_meeting_cta_clicked",{placement:"mobile_banner",organization_id:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==n?(l=oe("flex items-center gap-4 rounded-2xl border border-border bg-card p-5 card-shadow transition-colors hover:bg-accent",n),e[2]=n,e[3]=l):l=e[3];let c,u;e[4]===Symbol.for("react.memo_cache_sentinel")?(c={height:44,width:44+2*Math.round(30.799999999999997)},u=Te.map(Ss),e[4]=c,e[5]=u):(c=e[4],u=e[5]);let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("span",{className:"relative flex shrink-0 items-center",style:c,children:[u,t.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-3 w-3 rounded-full border-2 border-card bg-success","aria-hidden":!0,style:{zIndex:Te.length+1}})]}),e[6]=m):m=e[6];let p,d;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"]}),d=t.jsx(Dt,{size:18,className:"shrink-0 text-muted-foreground"}),e[7]=p,e[8]=d):(p=e[7],d=e[8]);let x;return e[9]!==a||e[10]!==r||e[11]!==l?(x=t.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",onClick:r,className:l,children:[m,p,d]}),e[9]=a,e[10]=r,e[11]=l,e[12]=x):x=e[12],x}function Ss(o,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:Te.length-e},children:t.jsx("img",{src:o.photo,alt:o.alt,className:"h-full w-full object-cover",loading:"lazy"})},o.photo)}function qt(o){const e=q.c(10),{host:n}=o,s=`https://www.google.com/s2/favicons?domain=${n}&sz=128`;let i,a,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-7 w-7 dark:hidden"}),a=t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-7 w-7 hidden dark:block"}),r=t.jsx("div",{className:"h-6 w-px rotate-12 bg-border","aria-hidden":"true"}),e[0]=i,e[1]=a,e[2]=r):(i=e[0],a=e[1],r=e[2]);let l;e[3]!==s?(l=t.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-white",children:t.jsx("img",{src:s,alt:"",className:"h-5 w-5",loading:"lazy"})}),e[3]=s,e[4]=l):l=e[4];let c;e[5]!==n?(c=t.jsx("span",{className:"text-lg font-medium text-foreground",children:n}),e[5]=n,e[6]=c):c=e[6];let u;return e[7]!==l||e[8]!==c?(u=t.jsxs("div",{className:"flex items-center gap-3",children:[i,a,r,l,c]}),e[7]=l,e[8]=c,e[9]=u):u=e[9],u}const Ns={workspace:"Preparando seu workspace de commerce...",generic:"Preparando..."};function Es(o){return Ns[o]}function ht(o){const e=q.c(4),{variant:n}=o;let s;e[0]!==n?(s=Es(n),e[0]=n,e[1]=s):s=e[1];let i;return e[2]!==s?(i=t.jsx("div",{className:"flex justify-center py-4",role:"status","aria-live":"polite",children:t.jsx(We,{label:s,className:"text-muted-foreground"})}),e[2]=s,e[3]=i):i=e[3],i}function Qo(){const o=q.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Is,{}),o[0]=e):e=o[0],e}const Kt=H.createContext(null),Vt=()=>H.useContext(Kt);function se(o){const e=q.c(13);let n,s;e[0]!==o?({visual:s,...n}=o,e[0]=o,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i={from:"/commerce-onboarding"},e[3]=i):i=e[3];const a=St(i),{data:r}=Be.useSession(),l=r?.user?.email;let c;e[4]!==a.siteUrl||e[5]!==l?(c=pt({siteUrl:a.siteUrl,email:l}),e[4]=a.siteUrl,e[5]=l,e[6]=c):c=e[6];const u=c;let m;e[7]!==u||e[8]!==s?(m=s??t.jsx(gt,{href:u}),e[7]=u,e[8]=s,e[9]=m):m=e[9];let p;return e[10]!==n||e[11]!==m?(p=t.jsx(Yt,{...n,visual:m}),e[10]=n,e[11]=m,e[12]=p):p=e[12],p}const ws={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:o=>`Código enviado para ${o}`,defaultSubtitle:"Entre ou crie uma nova conta",resetEmailSent:"Verifique seu e-mail para redefinir a senha.",continueWith:o=>`Continuar com ${o}`,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 Ie(o){if(!o)return null;const e=we(o);return e.ok?new URL(e.value).hostname:null}function vt(o){switch(o){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 o}}let jt=!1;function Is(){const o=St({from:"/commerce-onboarding"}),{org:e,siteUrl:n}=o,s=Ie(n);return!jt&&Ht()&&(jt=!0,te("commerce_onboarding_viewed",{site_url:n,domain:s??void 0,...s?{$set:{last_scanned_domain:s}}:{}})),t.jsx(Kt.Provider,{value:s,children:t.jsx(Ts,{requestedOrgSlug:e,siteUrl:n})})}function Ts(o){const e=q.c(8),{requestedOrgSlug:n,siteUrl:s}=o,{data:i,isPending:a}=Be.useSession(),r=Vt();if(a){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(se,{children:t.jsx(ht,{variant:"generic"})}),e[0]=c):c=e[0],c}if(!i){const c=typeof window>"u"?"/commerce-onboarding":`${window.location.pathname}${window.location.search}`;let u;e[1]!==r?(u=r?t.jsx(qt,{host:r}):void 0,e[1]=r,e[2]=u):u=e[2];let m;return e[3]!==u?(m=t.jsx(se,{children:t.jsx(Wt,{callbackUrl:c,allowAutoLogin:!1,title:"Desbloqueie seu diagnóstico completo",subtitle:null,brand:u,copy:ws})}),e[3]=u,e[4]=m):m=e[4],m}let l;return e[5]!==n||e[6]!==s?(l=t.jsx(Os,{requestedOrgSlug:n,siteUrl:s}),e[5]=n,e[6]=s,e[7]=l):l=e[7],l}function Os(o){const e=q.c(40),{requestedOrgSlug:n,siteUrl:s}=o,i=Nt(),a=Bt(),[r,l]=H.useState(null),[c,u]=H.useState(null),m=a.data?.map(ks)??[];let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={mutationFn:As,retry:!1,onSuccess:f=>{u(f)}},e[0]=p):p=e[0];const d=pe(p);if(a.isPending){let f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(se,{children:t.jsx(ht,{variant:"workspace"})}),e[1]=f):f=e[1],f}if(a.error){let f;return e[2]!==a?(f=t.jsx(Ve,{title:"Não foi possível carregar suas organizações",description:"Tente novamente para continuar a configuração de commerce nesta página.",actionLabel:"Tentar novamente",onRetry:()=>a.refetch()}),e[2]=a,e[3]=f):f=e[3],f}const x=n?m.find(f=>f.slug===n):null;if(x){let f;return e[4]!==x||e[5]!==s?(f=t.jsx(qe,{org:x,initialSiteUrl:s}),e[4]=x,e[5]=s,e[6]=f):f=e[6],f}if(n){let f;return e[7]!==a?(f=t.jsx(Ve,{title:"Organização não encontrada",description:"Não conseguimos encontrar essa organização na sua conta.",actionLabel:"Tentar novamente",onRetry:()=>a.refetch()}),e[7]=a,e[8]=f):f=e[8],f}if(r){let f;return e[9]!==r||e[10]!==s?(f=t.jsx(qe,{org:r,initialSiteUrl:s}),e[9]=r,e[10]=s,e[11]=f):f=e[11],f}if(m.length===1&&m[0]){let f;return e[12]!==m[0]||e[13]!==s?(f=t.jsx(qe,{org:m[0],initialSiteUrl:s}),e[12]=m[0],e[13]=s,e[14]=f):f=e[14],f}if(m.length>1){let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(re,{title:"Escolha uma organização",description:"Selecione onde o diagnóstico de commerce deve continuar."}),e[15]=f):f=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=C=>l(C),e[16]=y):y=e[16];let h;return e[17]!==m?(h=t.jsx(se,{children:t.jsxs("div",{className:"grid gap-10",children:[f,t.jsx(tt,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:t.jsx(xt,{organizations:m,selectLabel:"Continuar",onSelected:y})})]})}),e[17]=m,e[18]=h):h=e[18],h}if(!c){let f;e[19]!==d?(f=()=>{d.reset(),d.mutate()},e[19]=d,e[20]=f):f=e[20];let y;return e[21]!==d||e[22]!==f?(y=t.jsx(Rs,{mutation:d,onRetry:f}),e[21]=d,e[22]=f,e[23]=y):y=e[23],y}const b=c;if(b?.success&&(b.status==="created"||b.status==="joined"||b.status==="already_has_organization")&&b.organization){let f;return e[24]!==b.organization||e[25]!==s?(f=t.jsx(qe,{org:b.organization,initialSiteUrl:s}),e[24]=b.organization,e[25]=s,e[26]=f):f=e[26],f}if(b?.status==="ambiguous"&&b.organizations&&b.organizations.length>0){let f;e[27]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(re,{title:"Escolha uma organização",description:"Seu e-mail pode acessar mais de uma organização. Escolha onde a configuração de commerce deve continuar."}),e[27]=f):f=e[27];const y=b.domain??void 0;let h;e[28]!==i||e[29]!==s?(h=(E,_)=>{Et(),l({...E,slug:_}),i({to:"/commerce-onboarding",search:{org:_,siteUrl:s}})},e[28]=i,e[29]=s,e[30]=h):h=e[30];let C;return e[31]!==b.organizations||e[32]!==y||e[33]!==h?(C=t.jsx(se,{children:t.jsxs("div",{className:"grid gap-10",children:[f,t.jsx(tt,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:t.jsx(xt,{organizations:b.organizations,domain:y,onJoined:h})})]})}),e[31]=b.organizations,e[32]=y,e[33]=h,e[34]=C):C=e[34],C}const j=b?.error??"Não conseguimos determinar uma organização de commerce para esta conta.";let v;e[35]!==d?(v=()=>{u(null),d.reset()},e[35]=d,e[36]=v):v=e[36];let g;return e[37]!==j||e[38]!==v?(g=t.jsx(Ve,{title:"O onboarding de commerce precisa de suporte",description:j,actionLabel:"Tentar novamente",onRetry:v}),e[37]=j,e[38]=v,e[39]=g):g=e[39],g}async function As(){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&&Et(),e}function ks(o){return{id:o.id,name:o.name,slug:o.slug,logo:o.logo??null}}function Rs(o){const e=q.c(7),{mutation:n,onRetry:s}=o,i=H.useRef(!1);let a;e[0]!==n?(a=u=>{!u||i.current||(i.current=!0,n.mutate())},e[0]=n,e[1]=a):a=e[1];const r=a;if(n.error){let u;return e[2]!==s?(u=t.jsx(Ve,{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:s}),e[2]=s,e[3]=u):u=e[3],u}let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(ht,{variant:"generic"}),e[4]=l):l=e[4];let c;return e[5]!==r?(c=t.jsx(se,{children:t.jsx("div",{ref:r,children:l})}),e[5]=r,e[6]=c):c=e[6],c}function re(o){const e=q.c(8),{title:n,description:s}=o,i=Vt();let a;e[0]!==i?(a=i?t.jsx(qt,{host:i}):t.jsxs("div",{children:[t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),e[0]=i,e[1]=a):a=e[1];let r;e[2]!==s||e[3]!==n?(r=(n||s)&&t.jsxs("div",{className:"space-y-2",children:[n&&t.jsx("h1",{className:"text-2xl font-medium leading-8",children:n}),s&&t.jsx("p",{className:"text-base text-muted-foreground leading-6",children:s})]}),e[2]=s,e[3]=n,e[4]=r):r=e[4];let l;return e[5]!==a||e[6]!==r?(l=t.jsxs("div",{className:"grid gap-10",children:[a,r]}),e[5]=a,e[6]=r,e[7]=l):l=e[7],l}function Ve(o){const e=q.c(9),{title:n,description:s,actionLabel:i,onRetry:a}=o;let r;e[0]!==s||e[1]!==n?(r=t.jsx(re,{title:n,description:s}),e[0]=s,e[1]=n,e[2]=r):r=e[2];let l;e[3]!==i||e[4]!==a?(l=t.jsx(W,{type:"button",size:"xl",className:"w-full",onClick:a,children:i}),e[3]=i,e[4]=a,e[5]=l):l=e[5];let c;return e[6]!==r||e[7]!==l?(c=t.jsx(se,{children:t.jsxs("div",{className:"grid gap-10",children:[r,l]})}),e[6]=r,e[7]=l,e[8]=c):c=e[8],c}function Ps(o){return o.content?.find(e=>e.text)?.text??"A configuração do Commerce Discovery falhou."}function Me(o){const e=o;if(e.isError)throw new Error(Ps(e));return e.structuredContent??o}function qe(o){const e=q.c(11),{org:n,initialSiteUrl:s}=o,{data:i}=Be.useSession(),a=i?.user?.email;let r;e[0]!==s||e[1]!==a?(r=pt({siteUrl:s,email:a}),e[0]=s,e[1]=a,e[2]=r):r=e[2];const l=r;let c;e[3]!==l||e[4]!==n.id?(c=t.jsx(gt,{href:l,orgId:n.id}),e[3]=l,e[4]=n.id,e[5]=c):c=e[5];const u=c;let m;return e[6]!==s||e[7]!==u||e[8]!==n||e[9]!==i?.user?.email?(m=t.jsx(Ct,{children:p=>{const{reset:d}=p;return t.jsx(_t,{fallback:x=>{const{error:b,resetError:j}=x;return t.jsx(se,{visual:u,children:t.jsx(Us,{orgName:n.name,message:b instanceof Error?b.message:"Não foi possível verificar a configuração do Commerce Discovery.",onRetry:()=>{d(),j()}})})},children:t.jsx(H.Suspense,{fallback:t.jsx(Gt,{visual:u}),children:t.jsx(Ls,{org:n,initialSiteUrl:s,sessionEmail:i?.user?.email},`${n.id}:${s??""}`)})})}}),e[6]=s,e[7]=u,e[8]=n,e[9]=i?.user?.email,e[10]=m):m=e[10],m}function Gt(o){const e=q.c(3),{visual:n}=o;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=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(ut,{})]}),e[0]=s):s=e[0];let i;return e[1]!==n?(i=t.jsx(se,{align:"fill",visual:n,children:s}),e[1]=n,e[2]=i):i=e[2],i}function Us(o){const e=q.c(10),{orgName:n,message:s,onRetry:i}=o,a=`A configuração de commerce continuará em ${n}.`;let r;e[0]!==a?(r=t.jsx(re,{title:"Diagnóstico de commerce",description:a}),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==s?(l=t.jsx(Oe,{message:s}),e[2]=s,e[3]=l):l=e[3];let c;e[4]!==i?(c=t.jsx(W,{type:"button",size:"xl",className:"w-full",onClick:i,children:"Tentar novamente"}),e[4]=i,e[5]=c):c=e[5];let u;return e[6]!==r||e[7]!==l||e[8]!==c?(u=t.jsxs("div",{className:"grid gap-10",children:[r,l,c]}),e[6]=r,e[7]=l,e[8]=c,e[9]=u):u=e[9],u}function Ls(o){const e=q.c(117),{org:n,initialSiteUrl:s,sessionEmail:i}=o,a=Nt();let r;e[0]!==n.id||e[1]!==n.slug?(r={connectionId:wt,orgId:n.id,orgSlug:n.slug},e[0]=n.id,e[1]=n.slug,e[2]=r):r=e[2];const l=Qe(r),[c,u]=H.useState(s??""),[m,p]=H.useState(null),[d,x]=H.useState(null),b=H.useRef(!1),j=ot.COMMERCE_DISCOVERY(n.id),v=Zt(n.id),g=Z.commerceDiscoveryConnection(n.id,j);let f;e[3]!==j||e[4]!==l?(f=async()=>{const V=await l.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:j}});return Me(V)},e[3]=j,e[4]=l,e[5]=f):f=e[5];let y;e[6]!==g||e[7]!==f?(y={queryKey:g,queryFn:f,retry:!1},e[6]=g,e[7]=f,e[8]=y):y=e[8];const h=Se(y),C=Z.commerceDiscoveryVirtualMcp(n.id,v);let E;e[9]!==l||e[10]!==v?(E=async()=>{const V=await l.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:v}});return Me(V)},e[9]=l,e[10]=v,e[11]=E):E=e[11];let _;e[12]!==C||e[13]!==E?(_={queryKey:C,queryFn:E,retry:!1},e[12]=C,e[13]=E,e[14]=_):_=e[14];const S=Se(_);let N;e[15]!==l?(N=async V=>{const Y=await l.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:V}});return Me(Y)},e[15]=l,e[16]=N):N=e[16];let O;e[17]!==h||e[18]!==n.id||e[19]!==S?(O=(V,Y)=>{te("commerce_onboarding_setup_succeeded",{domain:Ie(Y)??void 0,organization_id:n.id}),p(V),x(null),h.refetch(),S.refetch()},e[17]=h,e[18]=n.id,e[19]=S,e[20]=O):O=e[20];let U;e[21]!==n.id?(U=(V,Y)=>{te("commerce_onboarding_setup_failed",{domain:Ie(Y)??void 0,organization_id:n.id,error:V instanceof Error?V.message:String(V)}),x(V instanceof Error?V.message:"A configuração do Commerce Discovery falhou.")},e[21]=n.id,e[22]=U):U=e[22];let k;e[23]!==U||e[24]!==N||e[25]!==O?(k={mutationFn:N,retry:!1,onSuccess:O,onError:U},e[23]=U,e[24]=N,e[25]=O,e[26]=k):k=e[26];const T=pe(k);let R;e[27]!==l?(R={mutationFn:async V=>{const Y=await l.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:V}});return Me(Y)},retry:!1},e[27]=l,e[28]=R):R=e[28];const A=pe(R),[D,M]=H.useState(null),F=!!h.data.item&&!!S.data.item,K=h.data.item,$=typeof K?.metadata?.siteUrl=="string"?K.metadata.siteUrl:void 0,w=s||c||$||"";let I;e[29]!==w||e[30]!==i?(I=pt({siteUrl:w,email:i}),e[29]=w,e[30]=i,e[31]=I):I=e[31];const G=I;let L;e[32]!==G||e[33]!==n.id?(L=t.jsx(gt,{href:G,orgId:n.id}),e[32]=G,e[33]=n.id,e[34]=L):L=e[34];const z=L;let Q;e[35]!==T?(Q=V=>{const Y=we(V);if(!Y.ok){x(vt(Y.error));return}x(null),T.mutate(Y.value)},e[35]=T,e[36]=Q):Q=e[36];const J=Q;let X;e[37]!==s||e[38]!==J||e[39]!==F?(X=V=>{!V||b.current||F||!s||(b.current=!0,J(s))},e[37]=s,e[38]=J,e[39]=F,e[40]=X):X=e[40];const ee=X;let P;e[41]!==n.id||e[42]!==J||e[43]!==c?(P=V=>{V.preventDefault();const Y=we(c);Y.ok&&te("commerce_onboarding_site_url_submitted",{domain:new URL(Y.value).hostname,organization_id:n.id}),J(c)},e[41]=n.id,e[42]=J,e[43]=c,e[44]=P):P=e[44];const B=P;let ie;e[45]!==j||e[46]!==m?.reportApp||e[47]!==v?(ie=m?.reportApp??{connectionId:j,virtualMcpId:v,toolName:Xt},e[45]=j,e[46]=m?.reportApp,e[47]=v,e[48]=ie):ie=e[48];const ae=ie;let $e;e[49]!==w||e[50]!==a||e[51]!==n.id||e[52]!==n.slug||e[53]!==ae||e[54]!==A?($e=async()=>{M(null),te("commerce_onboarding_open_report_clicked",{domain:Ie(w)??void 0,organization_id:n.id});const V=we(w);if(V.ok)try{await A.mutateAsync(V.value)}catch(Y){const le=Y;te("commerce_onboarding_run_failed",{domain:Ie(w)??void 0,organization_id:n.id,error:le instanceof Error?le.message:String(le)}),M("Algo deu errado ao gerar seu relatório. Tente novamente em instantes.");return}localStorage.setItem(Qt.sidebarOpen(),JSON.stringify(!1)),a({to:"/$org/$taskId",params:{org:n.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:ae.virtualMcpId,main:Jt(ae.connectionId,ae.toolName),chat:0}})},e[49]=w,e[50]=a,e[51]=n.id,e[52]=n.slug,e[53]=ae,e[54]=A,e[55]=$e):$e=e[55];const Ye=$e;if(F){let V;return e[56]!==G||e[57]!==z||e[58]!==w||e[59]!==Ye||e[60]!==n||e[61]!==ae||e[62]!==D||e[63]!==A.isPending?(V=t.jsx($s,{org:n,reportApp:ae,onOpenReport:Ye,isSubmitting:A.isPending,error:D,meetingUrl:G,meetingVisual:z,siteUrl:w}),e[56]=G,e[57]=z,e[58]=w,e[59]=Ye,e[60]=n,e[61]=ae,e[62]=D,e[63]=A.isPending,e[64]=V):V=e[64],V}if(T.isPending){let V;return e[65]!==z?(V=t.jsx(Gt,{visual:z}),e[65]=z,e[66]=V):V=e[66],V}if(s){let V,Y;if(e[67]!==z||e[68]!==B||e[69]!==s||e[70]!==d||e[71]!==n.name||e[72]!==T.isPending||e[73]!==c){Y=Symbol.for("react.early_return_sentinel");e:if(V=we(s),!V.ok){const Ze=`A configuração de commerce continuará em ${n.name}.`;let je;e[76]!==Ze?(je=t.jsx(re,{title:"Diagnóstico de commerce",description:Ze}),e[76]=Ze,e[77]=je):je=e[77];const Xe=t.jsx(Oe,{message:vt(V.error)});let Ce;e[78]!==B||e[79]!==d||e[80]!==T.isPending||e[81]!==c?(Ce=t.jsx(et,{siteUrl:c,error:d,isSubmitting:T.isPending,onSiteUrlChange:u,onSubmit:B}),e[78]=B,e[79]=d,e[80]=T.isPending,e[81]=c,e[82]=Ce):Ce=e[82];let _e;e[83]!==je||e[84]!==Xe||e[85]!==Ce?(_e=t.jsxs("div",{className:"grid gap-10",children:[je,Xe,Ce]}),e[83]=je,e[84]=Xe,e[85]=Ce,e[86]=_e):_e=e[86];let Fe;e[87]!==z||e[88]!==_e?(Fe=t.jsx(se,{visual:z,children:_e}),e[87]=z,e[88]=_e,e[89]=Fe):Fe=e[89],Y=Fe;break e}e[67]=z,e[68]=B,e[69]=s,e[70]=d,e[71]=n.name,e[72]=T.isPending,e[73]=c,e[74]=V,e[75]=Y}else V=e[74],Y=e[75];if(Y!==Symbol.for("react.early_return_sentinel"))return Y;const le=`O Commerce Discovery está sendo preparado para ${V.value}.`;let ye;e[90]!==le?(ye=t.jsx(re,{title:"Diagnóstico de commerce",description:le}),e[90]=le,e[91]=ye):ye=e[91];let be;e[92]!==B||e[93]!==d||e[94]!==T.isPending||e[95]!==c?(be=d?t.jsxs(t.Fragment,{children:[t.jsx(Oe,{message:d}),t.jsx(et,{siteUrl:c,error:null,isSubmitting:T.isPending,onSiteUrlChange:u,onSubmit:B})]}):t.jsx(ut,{}),e[92]=B,e[93]=d,e[94]=T.isPending,e[95]=c,e[96]=be):be=e[96];let ve;e[97]!==ye||e[98]!==be||e[99]!==ee?(ve=t.jsxs("div",{ref:ee,className:"grid gap-10",children:[ye,be]}),e[97]=ye,e[98]=be,e[99]=ee,e[100]=ve):ve=e[100];let De;return e[101]!==z||e[102]!==ve?(De=t.jsx(se,{visual:z,children:ve}),e[101]=z,e[102]=ve,e[103]=De):De=e[103],De}const Je=`A configuração de commerce continuará em ${n.name}.`;let ge;e[104]!==Je?(ge=t.jsx(re,{title:"Diagnóstico de commerce",description:Je}),e[104]=Je,e[105]=ge):ge=e[105];let he;e[106]!==B||e[107]!==d||e[108]!==T.isPending||e[109]!==c?(he=t.jsx(et,{siteUrl:c,error:d,isSubmitting:T.isPending,onSiteUrlChange:u,onSubmit:B}),e[106]=B,e[107]=d,e[108]=T.isPending,e[109]=c,e[110]=he):he=e[110];let xe;e[111]!==ge||e[112]!==he?(xe=t.jsxs("div",{className:"grid gap-10",children:[ge,he]}),e[111]=ge,e[112]=he,e[113]=xe):xe=e[113];let ze;return e[114]!==z||e[115]!==xe?(ze=t.jsx(se,{visual:z,children:xe}),e[114]=z,e[115]=xe,e[116]=ze):ze=e[116],ze}function et(o){const e=q.c(20),{siteUrl:n,error:s,isSubmitting:i,onSiteUrlChange:a,onSubmit:r}=o;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:"URL do site"}),e[0]=l):l=e[0];let c;e[1]!==a?(c=v=>a(v.target.value),e[1]=a,e[2]=c):c=e[2];const u=!!s;let m;e[3]!==i||e[4]!==n||e[5]!==c||e[6]!==u?(m=t.jsx(Ue,{id:"commerce-site-url",type:"text",inputMode:"url",value:n,onChange:c,placeholder:"https://example.com","aria-invalid":u,disabled:i}),e[3]=i,e[4]=n,e[5]=c,e[6]=u,e[7]=m):m=e[7];let p;e[8]!==s?(p=s?t.jsx(Oe,{message:s}):null,e[8]=s,e[9]=p):p=e[9];let d;e[10]!==m||e[11]!==p?(d=t.jsxs("div",{className:"grid gap-2",children:[l,m,p]}),e[10]=m,e[11]=p,e[12]=d):d=e[12];let x;e[13]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(It,{size:16}),e[13]=x):x=e[13];let b;e[14]!==i?(b=t.jsxs(W,{type:"submit",size:"xl",className:"w-full",disabled:i,children:["Continuar",x]}),e[14]=i,e[15]=b):b=e[15];let j;return e[16]!==r||e[17]!==d||e[18]!==b?(j=t.jsxs("form",{className:"grid gap-4",onSubmit:r,children:[d,b]}),e[16]=r,e[17]=d,e[18]=b,e[19]=j):j=e[19],j}function $s(o){const e=q.c(27),{org:n,reportApp:s,onOpenReport:i,isSubmitting:a,error:r,meetingUrl:l,meetingVisual:c,siteUrl:u}=o;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(re,{}),e[0]=m):m=e[0];let p;e[1]!==n||e[2]!==s.connectionId||e[3]!==u?(p=t.jsx(hs,{org:n,cdConnectionId:s.connectionId,siteUrl:u}),e[1]=n,e[2]=s.connectionId,e[3]=u,e[4]=p):p=e[4];let d;e[5]!==l||e[6]!==n.id?(d=t.jsx(_s,{className:"md:hidden",href:l,orgId:n.id}),e[5]=l,e[6]=n.id,e[7]=d):d=e[7];let x;e[8]!==r?(x=r?t.jsx(Oe,{message:r}):null,e[8]=r,e[9]=x):x=e[9];const b=a||!s.virtualMcpId,j=a?"Abrindo relatório...":"Ver relatório completo";let v;e[10]!==a?(v=a?null:t.jsx(It,{size:18}),e[10]=a,e[11]=v):v=e[11];let g;e[12]!==i||e[13]!==b||e[14]!==j||e[15]!==v?(g=t.jsxs(W,{type:"button",size:"xl",className:"w-full rounded-2xl text-base font-medium",onClick:i,disabled:b,children:[j,v]}),e[12]=i,e[13]=b,e[14]=j,e[15]=v,e[16]=g):g=e[16];let f;e[17]!==d||e[18]!==x||e[19]!==g?(f=t.jsxs("div",{className:"flex shrink-0 flex-col gap-3 md:mt-8",children:[d,x,g]}),e[17]=d,e[18]=x,e[19]=g,e[20]=f):f=e[20];let y;e[21]!==p||e[22]!==f?(y=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[m,p,f]}),e[21]=p,e[22]=f,e[23]=y):y=e[23];let h;return e[24]!==c||e[25]!==y?(h=t.jsx(se,{align:"fill",visual:c,children:y}),e[24]=c,e[25]=y,e[26]=h):h=e[26],h}function Oe(o){const e=q.c(2),{message:n}=o;let s;return e[0]!==n?(s=t.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:n}),e[0]=n,e[1]=s):s=e[1],s}export{Qo as default};
|
package/dist/client/assets/{connect-desktop-dialog-zT24ZiUH.js → connect-desktop-dialog-Brra3cMC.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as v,D as w,K as z,k as M,j as s,r as T,B as I,l as L}from"./index-
|
|
1
|
+
import{c as v,D as w,K as z,k as M,j as s,r as T,B as I,l as L}from"./index-CFiyU0D9.js";import{a as S,b as D,c as E,d as R,e as _}from"./dialog-BAqFyO8a.js";import{S as $}from"./chat-context-n9syhvq-.js";import{i as A}from"./ChevronUp-DBpw6M-L.js";import{a as B}from"./Eye-bojNLUjA.js";import{u as F}from"./studio-tools-CNO5iCKk.js";const y={online:!1,capabilities:[],ready:!1};function K(a){const e=v.c(9),{org:n}=w(),i=F(),o=a?.fast??!1;let t;e[0]!==n.id?(t=z.currentLink(n.id),e[0]=n.id,e[1]=t):t=e[1];let l;e[2]!==i?(l=async()=>{const u=await i.call("LINK_CURRENT_GET",{});return u?{...u,ready:!0}:{...y,ready:!0}},e[2]=i,e[3]=l):l=e[3];const d=o?1e3:1e4,g=o?2e3:15e3;let r;e[4]!==t||e[5]!==l||e[6]!==d||e[7]!==g?(r={queryKey:t,queryFn:l,staleTime:d,refetchInterval:g,refetchOnWindowFocus:!0},e[4]=t,e[5]=l,e[6]=d,e[7]=g,e[8]=r):r=e[8];const{data:c}=M(r);return c??y}function O(a){const e=v.c(3),{size:n}=a,i=n===void 0?16:n;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("path",{d:"M13 12L18.5 5M7.63965 3L12.5 12L13.6865 3M4.48381 6.71679L11.9872 12M3 12L11.9872 12.473M12.2244 13.177L7 20M4.84194 16.8682L11.2824 12.9758M11.5 21L12.665 13.177M21 14L13.1846 12.668M21 10.5788L13 12.3223M16.779 19.646L12.8876 13.3772M19.3566 18.207L13.313 12.9893"}),e[0]=o):o=e[0];let t;return e[1]!==i?(t=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:i,height:i,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o}),e[1]=i,e[2]=t):t=e[2],t}function P(a){const e=v.c(3),{size:n}=a,i=n===void 0?16:n;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("path",{clipRule:"evenodd",d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"}),e[0]=o):o=e[0];let t;return e[1]!==i?(t=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:i,height:i,fill:"currentColor",fillRule:"evenodd","aria-hidden":"true",children:o}),e[1]=i,e[2]=t):t=e[2],t}const N="bunx decocms@latest link",k=[{capability:"claude-code",label:"Claude Code",description:"Runs through the Claude Code CLI",icon:s.jsx(O,{size:18})},{capability:"codex",label:"Codex",description:"Runs through the Codex CLI",icon:s.jsx(P,{size:18})}];function U(a){return k.filter(e=>a.includes(e.capability)).map(e=>e.label)}function J(a){const e=v.c(23),{open:n,onOpenChange:i}=a;let o;e[0]!==n?(o={fast:n},e[0]=n,e[1]=o):o=e[1];const t=K(o),[l,d]=T.useState(!1),g=t.hostname??t.machineId??"Your desktop",r=t.online?`Connected to ${g}`:"Connect your desktop";let c;e[2]!==r?(c=s.jsx(S,{children:r}),e[2]=r,e[3]=c):c=e[3];const u=t.online?"This machine provides the following local agents.":"Run this command in your desktop terminal. The dialog will close once your desktop is online.";let m;e[4]!==u?(m=s.jsx(D,{children:u}),e[4]=u,e[5]=m):m=e[5];let x;e[6]!==c||e[7]!==m?(x=s.jsxs(E,{children:[c,m]}),e[6]=c,e[7]=m,e[8]=x):x=e[8];let f;e[9]!==l||e[10]!==t.online?(f=!t.online&&s.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-sm",children:[s.jsx("span",{className:"flex-1",children:N}),s.jsx(I,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard.writeText(N),d(!0),setTimeout(()=>d(!1),1500)},children:l?s.jsx(A,{size:14}):s.jsx(B,{size:14})})]}),e[9]=l,e[10]=t.online,e[11]=f):f=e[11];let p;e[12]!==t.capabilities||e[13]!==t.online?(p=t.online?s.jsx("div",{className:"flex flex-col gap-3 text-sm",children:s.jsx("div",{className:"flex flex-col gap-2",children:k.map(b=>{const C=t.capabilities.includes(b.capability);return s.jsxs("div",{className:L("flex items-center gap-3 rounded-md border px-3 py-2",C?"border-border bg-background text-foreground":"border-border/60 bg-muted/40 text-muted-foreground"),children:[s.jsx("div",{className:L("flex size-6 items-center justify-center",C?"text-foreground":"text-muted-foreground"),children:b.icon}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-medium",children:b.label}),s.jsx("p",{className:"text-xs text-muted-foreground",children:C?b.description:"Not detected"})]}),s.jsx("span",{className:L("size-2 rounded-full",C?"bg-success":"bg-muted-foreground/30")})]},b.capability)})})}):s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx($,{size:"sm"}),"Waiting for desktop…"]}),e[12]=t.capabilities,e[13]=t.online,e[14]=p):p=e[14];let h;e[15]!==x||e[16]!==f||e[17]!==p?(h=s.jsxs(R,{className:"sm:max-w-md",children:[x,f,p]}),e[15]=x,e[16]=f,e[17]=p,e[18]=h):h=e[18];let j;return e[19]!==i||e[20]!==n||e[21]!==h?(j=s.jsx(_,{open:n,onOpenChange:i,children:h}),e[19]=i,e[20]=n,e[21]=h,e[22]=j):j=e[22],j}export{J as C,O as a,P as b,K as u,U as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as _}from"./connection-slug-eyAPH6o3.js";import{c as R,D as $,b1 as k,K as D,l as E,j as x}from"./index-
|
|
1
|
+
import{g as _}from"./connection-slug-eyAPH6o3.js";import{c as R,D as $,b1 as k,K as D,l as E,j as x}from"./index-CFiyU0D9.js";import{u as K}from"./use-registry-connections-BOZLpkM5.js";import{b as Q}from"./use-organization-settings-DksiQdGc.js";import{S as w,e as F}from"./use-mcp-client-xOK-OF8p.js";import{u as H}from"./useInfiniteQuery-RUqqRph1.js";import{i as q,f as G}from"./extract-connection-data-D6bQrejT.js";import{C as U}from"./card-BFb5m83e.js";import{I as V}from"./integration-icon-LQhkkaLl.js";function ae(s){const e=new Map;for(const o of s){const l=_(o),r=e.get(l);r?r.push(o):e.set(l,[o])}const t=[],u=new Set;for(const o of s){const l=_(o);if(u.has(l))continue;u.add(l);const r=e.get(l),m=r[0];r.length===1?t.push({type:"single",connection:m}):t.push({type:"group",key:l,icon:m.icon,title:m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.title,connections:r})}return t}function ce(){const s=R.c(6),e=K(),t=Q(),u=$().project.enabledPlugins??[];let o;if(s[0]!==u||s[1]!==t||s[2]!==e){let l;s[4]!==t?(l=r=>t(r.id),s[4]=t,s[5]=l):l=s[5],o=e.filter(l).map(X),u.includes("private-registry")&&t(w)&&o.push({id:w,title:"Private Registry",icon:null}),s[0]=u,s[1]=t,s[2]=e,s[3]=o}else o=s[3];return o}function X(s){return{id:s.id,title:s.title,icon:s.icon}}const Y=24,S=3;function A(s){return s.id.includes("community-registry")}function z(s){const e=s?.trim();if(e)return{operator:"or",conditions:[{field:["title"],operator:"contains",value:e},{field:["description"],operator:"contains",value:e},{field:["name"],operator:"contains",value:e},{field:["server","title"],operator:"contains",value:e}]}}function T(s,e,t,u,o){const l=s.map(c=>c.id).sort().join(","),r=z(o),{data:m,fetchNextPage:d,hasNextPage:f,isFetchingNextPage:p,isLoading:b}=H({queryKey:D.storeDiscovery(e,`${l}:${o??""}`),queryFn:async({pageParam:c})=>{const n=c??{};return await Promise.all(s.map(async i=>{const y=n[i.id];if(y==="EXHAUSTED")return{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:[]};const j=q(i.id,e);let h;for(let v=0;v<S;v++){let C=null;try{C=await F({connectionId:i.id,orgId:e,orgSlug:t});const I={limit:Y};y&&(I.cursor=y),r&&(I.where=r);const P=await C.callTool({name:j,arguments:I}),N=P.structuredContent??P,M=N.nextCursor||N.cursor||void 0,L=G(N?[N]:[]);return{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:L,nextCursor:M}}catch(I){h=I}finally{await C?.close().catch(()=>{})}}return console.warn(`[useMergedStoreDiscovery] Registry "${i.title}" (${i.id}) failed after ${S} attempts:`,h),{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:[]}}))},initialPageParam:{},getNextPageParam:c=>{const n={};let a=!1;for(const i of c)i.registryId&&(i.nextCursor?(n[i.registryId]=i.nextCursor,a=!0):n[i.registryId]="EXHAUSTED");return a?n:void 0},staleTime:3600*1e3,placeholderData:k,retry:!1,enabled:s.length>0}),g=[];if(m?.pages)for(const c of m.pages)for(const n of c)for(const a of n.items)g.push({...a,_sourceName:a._sourceName??n.registryTitle,_sourceIcon:a._sourceIcon??n.registryIcon,_registryId:a._registryId??n.registryId});return{items:g,hasMore:f??!1,isLoadingMore:p,isInitialLoading:b,fetchNextPage:()=>{f&&!p&&d()}}}function ue(s,e){const t=R.c(16),{org:u}=$();let o;t[0]!==s?(o=s.filter(Z),t[0]=s,t[1]=o):o=t[1];const l=o;let r;t[2]!==s?(r=s.filter(W),t[2]=s,t[3]=r):r=t[3];const m=r,d=T(l,u.id,u.slug,!0,e),f=T(m,u.id,u.slug,!0,e);let p;if(t[4]!==f.items||t[5]!==d.items){const y=new Set;p=[];const j=[...d.items,...f.items];for(const h of j){const v=`${h._registryId}:${h.id}`;y.has(v)||(y.add(v),p.push(h))}t[4]=f.items,t[5]=d.items,t[6]=p}else p=t[6];const b=d.isInitialLoading||f.isInitialLoading,g=d.isLoadingMore||f.isLoadingMore,c=d.hasMore||f.hasMore;let n;t[7]!==f||t[8]!==d?(n=()=>{d.hasMore&&d.fetchNextPage(),f.hasMore&&f.fetchNextPage()},t[7]=f,t[8]=d,t[9]=n):n=t[9];const a=n;let i;return t[10]!==c||t[11]!==b||t[12]!==g||t[13]!==p||t[14]!==a?(i={items:p,hasMore:c,isLoadingMore:g,isInitialLoading:b,loadMore:a},t[10]=c,t[11]=b,t[12]=g,t[13]=p,t[14]=a,t[15]=i):i=t[15],i}function W(s){return A(s)}function Z(s){return!A(s)}function fe(s){const e=R.c(37),{connection:t,onClick:u,headerActions:o,headerActionsAlwaysVisible:l,body:r,footer:m,className:d,fallbackIcon:f}=s,p=l===void 0?!1:l,b=u&&"hover:bg-muted/50";let g;e[0]!==d||e[1]!==b?(g=E("cursor-pointer transition-colors group overflow-hidden flex flex-col h-full",b,d),e[0]=d,e[1]=b,e[2]=g):g=e[2];let c;e[3]!==t.icon||e[4]!==t.title||e[5]!==f?(c=x.jsx(V,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:f}),e[3]=t.icon,e[4]=t.title,e[5]=f,e[6]=c):c=e[6];let n;e[7]!==o||e[8]!==p?(n=o&&x.jsx("div",{className:E("transition-opacity",!p&&"sm:opacity-0 sm:group-hover:opacity-100"),onClick:J,children:o}),e[7]=o,e[8]=p,e[9]=n):n=e[9];let a;e[10]!==n?(a=x.jsx("div",{className:"relative",children:n}),e[10]=n,e[11]=a):a=e[11];let i;e[12]!==c||e[13]!==a?(i=x.jsxs("div",{className:"flex items-start justify-between",children:[c,a]}),e[12]=c,e[13]=a,e[14]=i):i=e[14];let y;e[15]!==t.title?(y=x.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:t.title}),e[15]=t.title,e[16]=y):y=e[16];const j=t.description||"No description";let h;e[17]!==j?(h=x.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:j}),e[17]=j,e[18]=h):h=e[18];let v;e[19]!==h||e[20]!==y?(v=x.jsxs("div",{className:"flex flex-col gap-1",children:[y,h]}),e[19]=h,e[20]=y,e[21]=v):v=e[21];let C;e[22]!==r?(C=r&&x.jsx("div",{children:r}),e[22]=r,e[23]=C):C=e[23];let I;e[24]!==v||e[25]!==C||e[26]!==i?(I=x.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[i,v,C]}),e[24]=v,e[25]=C,e[26]=i,e[27]=I):I=e[27];let P;e[28]!==m?(P=m&&x.jsx("div",{className:"border-t border-border mt-auto",children:x.jsx("div",{className:"h-14 flex items-center p-4.5",onClick:B,children:m})}),e[28]=m,e[29]=P):P=e[29];let N;e[30]!==I||e[31]!==P?(N=x.jsxs("div",{className:"flex flex-col flex-1",children:[I,P]}),e[30]=I,e[31]=P,e[32]=N):N=e[32];let M;return e[33]!==u||e[34]!==N||e[35]!==g?(M=x.jsx(U,{className:g,onClick:u,children:N}),e[33]=u,e[34]=N,e[35]=g,e[36]=M):M=e[36],M}function B(s){return s.stopPropagation()}function J(s){return s.stopPropagation()}export{fe as C,ue as a,ae as g,ce as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as fe,aF as Ie,b7 as Ae,s as le,aD as De,c as P,j as t,i as ge,B as E,r as G,l as je,D as J,q as $e,K as ne,b as Y,ab as ce,z as Pe,b8 as Oe,E as ze,e as Me,b9 as Ve,m as Ee,p as Ue,n as Fe,t as q,ba as Re}from"./index-5m2iNk2S.js";import{a as Le}from"./extract-connection-data-DssjagpB.js";import{E as ve}from"./empty-state-BCJ4vHXV.js";import{E as Be,c as He,r as We,b as Xe,d as qe}from"./connection-form-helpers-C_cmSxxe.js";import{c as Ge,S as Ke,V as Qe}from"./index-Cv4h6I9w.js";import{u as be,T as Je}from"./tools-list-CuC4_RxV.js";import{u as Ye}from"./use-members-BOTL3bYo.js";import{A as Ze}from"./avatar-D4JfZsUc.js";import{a as Ne,b as ye,u as et}from"./use-connection-CsNBMvbD.js";import{u as _e}from"./use-mcp-client-Efjq5Lk3.js";import{a as tt}from"./use-mcp-tools-CBnDJhOK.js";import{a as st}from"./use-mcp-prompts-C87bOW8f.js";import{i as nt,a as ot}from"./mcp-oauth-Ja50aKYo.js";import{I as oe}from"./integration-icon-CdzRdmGY.js";import{s as it}from"./Plus-DKGLRRwi.js";import{B as at,D as rt,ak as lt,a9 as ct}from"./agent-icon-hsuTqZxe.js";import{a as Se,s as dt}from"./Settings02-DKMqfZtL.js";import{s as ae}from"./Trash01-CFBK1BIu.js";import{d as mt,c as ut,b as xt,S as pt,a as ht}from"./sheet-Cpa4SoVx.js";import{F as L,b as B,c as H,d as V,e as W,f as ft,a as gt}from"./form-Bhlzmyq6.js";import{I as X}from"./input-BIG9H9YK.js";import{u as jt,D as vt}from"./use-delete-connection-Cm8qzL4n.js";import{c as bt,C as Nt,B as yt,a as _t,b as St,d as Ct,e as wt}from"./monitoring-stats-row-D3czlwOh.js";import{u as kt}from"./studio-tools-Dnm8v52D.js";import{u as Tt}from"./use-virtual-mcp-DqOCv1FF.js";import{i as Ce}from"./ChevronRight-Bfy1FDwZ.js";import{a as we}from"./Users03-ymmDn6VM.js";import{T as ee,a as It,b as te,c as At}from"./tabs-SaW2v3dR.js";import{g as ke}from"./connection-slug-eyAPH6o3.js";import{n as Dt}from"./ZapSquare-l2K3uFV1.js";import{c as $t}from"./Tool01-pUgv0TL7.js";import{g as re,M as Pt}from"./types-Dtutip9J.js";import{C as Ot}from"./collection-search-B6vccvYM.js";import{C as zt}from"./card-CPcIzYlK.js";import{B as Mt}from"./badge-DfhROXCy.js";import{D as Vt,a as Et,b as Ut,c as de}from"./dropdown-menu-BFym91nE.js";import{d as me,b as ue,c as xe,S as pe,a as R}from"./select-DYjkTzV9.js";import{i as Ft}from"./CheckCircle-CjTnfISE.js";import{t as Rt}from"./ChevronDown-B2-IVVeA.js";import{n as Lt}from"./XCircle-bxIVw0YP.js";import{s as se}from"./Star01-2VCD2LhQ.js";import{s as Bt}from"./XClose-B2hyMh3-.js";import"./index-Dpmr0M94.js";import"./sidebar-DGINLOAj.js";import"./LayoutLeft-C98dANsK.js";import"./use-mobile-C1vI_l2D.js";import"./tooltip-Bd-OGufW.js";import"./ZoomOut-enqpUlCT.js";import"./Key01-B19q_ad0.js";import"./auth-DvUMABem.js";import"./use-registry-connections-DXIh0Wgd.js";import"./use-organization-settings-CoqqaaEj.js";import"./index-ZIojZmHZ.js";import"./index-BHrf6n_h.js";import"./index-zLB_-ncb.js";import"./popover-DlhiC2kV.js";import"./ChevronUp-BOjHpJve.js";import"./SearchMd-Cihv3ptw.js";import"./use-create-virtual-mcp-CeHvNKpk.js";import"./use-navigate-to-agent-C9NO4q-K.js";import"./Eye-D65NNYL_.js";import"./use-org-auth-client-Bmkc23g2.js";import"./User01-BtP5IntS.js";import"./use-collections-BN0kOjAz.js";import"./AlertCircle-BaBhmaDx.js";import"./SwitchHorizontal01-BSH4xITx.js";import"./ArrowUpRight-DNjO3rKJ.js";import"./ChevronLeft-DIgPkg8j.js";import"./DotsVertical-Dqo19PDu.js";import"./Stars02-BI3Do82b.js";import"./Globe01-Dr5de9U6.js";import"./FilterLines-DatNss5g.js";import"./Globe04-B6q-BGyJ.js";import"./HardDrive-DgOUq6_i.js";import"./LinkExternal01-BsIWK8-O.js";import"./Monitor01-DCzcFpUw.js";import"./Sun-ElP5FqvE.js";import"./Palette-YXNlPWMb.js";import"./Play-DeTc-Zz9.js";import"./SearchLg-MADdv080.js";import"./Shield01-C5iqi6W7.js";import"./Stars01-BmrQl2P4.js";import"./Upload01-Dtg-yEBy.js";import"./Users01-BEOpwt_F.js";import"./X-Br9r-9dE.js";import"./Zap-xkxfehI_.js";import"./label-DeQNhkMu.js";import"./alert-dialog-CI55N51-.js";const Ht=fe({scopes:De(le()).describe("List of scopes available"),stateSchema:Ie(le(),Ae()).describe("JSON Schema (draft-07) defining the state structure")}),Wt=[{name:"MCP_CONFIGURATION",inputSchema:fe({}),outputSchema:Ht}];function Xt(s){const e=P.c(46),{instance:n,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i}=s;let c;e[0]!==n.id?(c={connectionId:n.id},e[0]=n.id,e[1]=c):c=e[1];const l=be(c),x=!(n.connection_type==="VIRTUAL")&&l.supportsOAuth&&!l.isAuthenticated,p=n.status!=="active",d=x||p?"border-destructive/50 bg-destructive/5":"border-transparent";let f;e[2]!==d?(f=je("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",d),e[2]=d,e[3]=f):f=e[3];let g;e[4]!==n.icon||e[5]!==n.title?(g=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=g):g=e[6];let v;e[7]!==n.title?(v=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=v):v=e[8];let b;e[9]!==n.status||e[10]!==p||e[11]!==x?(b=x?t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}):p?t.jsx("span",{className:"text-xs text-destructive font-medium",children:n.status==="error"?"Disabled (error)":"Disabled"}):null,e[9]=n.status,e[10]=p,e[11]=x,e[12]=b):b=e[12];let j;e[13]!==v||e[14]!==b?(j=t.jsxs("div",{className:"flex-1 min-w-0",children:[v,b]}),e[13]=v,e[14]=b,e[15]=j):j=e[15];let N;e[16]!==n||e[17]!==x||e[18]!==r?(N=x&&t.jsx(E,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>r(n),children:"Authorize"}),e[16]=n,e[17]=x,e[18]=r,e[19]=N):N=e[19];let T;e[20]!==n||e[21]!==p||e[22]!==i?(T=p?t.jsxs(E,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>i(n,"active"),children:[t.jsx(at,{size:13}),"Enable"]}):t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>i(n,"inactive"),title:"Disable",children:t.jsx(rt,{size:13})}),e[20]=n,e[21]=p,e[22]=i,e[23]=T):T=e[23];let C;e[24]!==n||e[25]!==a?(C=()=>a(n),e[24]=n,e[25]=a,e[26]=C):C=e[26];let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(Se,{size:13}),e[27]=y):y=e[27];let I;e[28]!==C?(I=t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:C,title:"Configure",children:y}),e[28]=C,e[29]=I):I=e[29];let _;e[30]!==n||e[31]!==o?(_=()=>o(n),e[30]=n,e[31]=o,e[32]=_):_=e[32];let k;e[33]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(ae,{size:13}),e[33]=k):k=e[33];let S;e[34]!==_?(S=t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:_,title:"Delete",children:k}),e[34]=_,e[35]=S):S=e[35];let h;e[36]!==I||e[37]!==S||e[38]!==N||e[39]!==T?(h=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[N,T,I,S]}),e[36]=I,e[37]=S,e[38]=N,e[39]=T,e[40]=h):h=e[40];let w;return e[41]!==h||e[42]!==f||e[43]!==g||e[44]!==j?(w=t.jsxs("div",{className:f,children:[g,j,h]}),e[41]=h,e[42]=f,e[43]=g,e[44]=j,e[45]=w):w=e[45],w}function qt(s){const e=P.c(15),{instance:n,onConfigure:a}=s;let r;e[0]!==n.icon||e[1]!==n.title?(r=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=r):r=e[2];let o;e[3]!==n.title?(o=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",children:n.title})}),e[3]=n.title,e[4]=o):o=e[4];let i;e[5]!==n||e[6]!==a?(i=()=>a(n),e[5]=n,e[6]=a,e[7]=i):i=e[7];let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Se,{size:13}),e[8]=c):c=e[8];let l;e[9]!==i?(l=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:i,title:"Configure",children:c})}),e[9]=i,e[10]=l):l=e[10];let u;return e[11]!==r||e[12]!==o||e[13]!==l?(u=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[r,o,l]}),e[11]=r,e[12]=o,e[13]=l,e[14]=u):u=e[14],u}function Gt(s){const e=P.c(27),{instances:n,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i,onAdd:c,isAdding:l}=s;if(n.length===0)return null;const u=n.length===1?"Instance":"Instances";let x;e[0]!==u?(x=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:u}),e[0]=u,e[1]=x):x=e[1];let p;e[2]!==l?(p=l?t.jsx(ge,{size:13,className:"animate-spin"}):t.jsx(it,{size:13}),e[2]=l,e[3]=p):p=e[3];let d;e[4]!==l||e[5]!==c||e[6]!==p?(d=t.jsxs(E,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:c,disabled:l,children:[p,"Add instance"]}),e[4]=l,e[5]=c,e[6]=p,e[7]=d):d=e[7];let f;e[8]!==x||e[9]!==d?(f=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[x,d]}),e[8]=x,e[9]=d,e[10]=f):f=e[10];let g;if(e[11]!==n||e[12]!==r||e[13]!==a||e[14]!==o||e[15]!==i){let j;e[17]!==r||e[18]!==a||e[19]!==o||e[20]!==i?(j=N=>t.jsx(G.Suspense,{fallback:t.jsx(qt,{instance:N,onConfigure:a}),children:t.jsx(Xt,{instance:N,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i})},N.id),e[17]=r,e[18]=a,e[19]=o,e[20]=i,e[21]=j):j=e[21],g=n.map(j),e[11]=n,e[12]=r,e[13]=a,e[14]=o,e[15]=i,e[16]=g}else g=e[16];let v;e[22]!==g?(v=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:g}),e[22]=g,e[23]=v):v=e[23];let b;return e[24]!==f||e[25]!==v?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[f,v]}),e[24]=f,e[25]=v,e[26]=b):b=e[26],b}const Kt=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function Qt(s){const e=new Date,n=new Date(e);return s==="7d"?n.setDate(n.getDate()-7):s==="14d"?n.setDate(n.getDate()-14):n.setDate(n.getDate()-30),{startDate:n,endDate:e}}const Jt={calls:{label:"Tool calls"},errors:{label:"Errors"}};function Yt(s){const e=P.c(1),{connectionId:n,orgId:a,timeframe:r}=s,o=kt(),i=Qt(r),{data:c}=$e({queryKey:ne.connectionActivity(n,r,a),queryFn:async()=>await o.call("MONITORING_LOGS_LIST",{startDate:i.startDate.toISOString(),endDate:i.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}),staleTime:3e5}),l=bt(c?.logs??[],i),u=l.data,x=l.totalCalls>0;let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[0]=p):p=e[0],t.jsxs("div",{children:[t.jsxs("div",{className:"flex gap-6 px-5 pb-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:l.totalCalls.toLocaleString()}),p]}),l.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:l.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),l.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(l.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),x?t.jsxs("div",{children:[t.jsx(Nt,{config:Jt,className:"h-16 w-full",children:t.jsxs(yt,{data:u,barCategoryGap:"4%",children:[t.jsx(_t,{content:t.jsx(St,{labelFormatter:es}),cursor:{fill:"var(--muted)"}}),t.jsx(Ct,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:u.map(Zt)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[u.length-1]?.label})]})]}):t.jsx("div",{className:"h-20 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-muted-foreground/60",children:"No activity in this period"})})]})}function Zt(s,e){return t.jsx(wt,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function es(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function ts(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{children:[t.jsx("div",{className:"flex gap-6 px-5 pb-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx("div",{className:"h-7 w-16 rounded-md bg-muted animate-pulse"}),t.jsx("div",{className:"h-3 w-14 rounded bg-muted animate-pulse"})]})}),t.jsx("div",{className:"h-20 w-full rounded-md bg-muted animate-pulse"})]}),s[0]=e):e=s[0],e}function ss(s){const e=P.c(13),{connectionId:n}=s,[a,r]=G.useState("14d"),{org:o}=J();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=i):i=e[0];let c;e[1]!==a?(c=Kt.map(d=>t.jsx("button",{type:"button",onClick:()=>r(d.value),className:je("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",a===d.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:d.label},d.value)),e[1]=a,e[2]=c):c=e[2];let l;e[3]!==c?(l=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[i,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:c})]}),e[3]=c,e[4]=l):l=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(ts,{}),e[5]=u):u=e[5];let x;e[6]!==n||e[7]!==o.id||e[8]!==a?(x=t.jsx(G.Suspense,{fallback:u,children:t.jsx(Yt,{connectionId:n,orgId:o.id,timeframe:a})}),e[6]=n,e[7]=o.id,e[8]=a,e[9]=x):x=e[9];let p;return e[10]!==l||e[11]!==x?(p=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[l,x]}),e[10]=l,e[11]=x,e[12]=p):p=e[12],p}function ns(s){const e=P.c(15),{virtualMcp:n,org:a}=s,r=Y();let o;e[0]!==r||e[1]!==a||e[2]!==n.id?(o=()=>{const p=crypto.randomUUID();r({to:"/$org/$taskId",params:{org:a,taskId:p},search:{virtualmcpid:n.id}})},e[0]=r,e[1]=a,e[2]=n.id,e[3]=o):o=e[3];let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(we,{size:16}),e[4]=i):i=e[4];let c;e[5]!==n.icon||e[6]!==n.title?(c=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:i}),e[5]=n.icon,e[6]=n.title,e[7]=c):c=e[7];let l;e[8]!==n.title?(l=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=l):l=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(Ce,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[10]=u):u=e[10];let x;return e[11]!==o||e[12]!==c||e[13]!==l?(x=t.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group text-left w-full",children:[c,l,u]}),e[11]=o,e[12]=c,e[13]=l,e[14]=x):x=e[14],x}function os(s){const e=P.c(7),{virtualMcps:n,org:a}=s;let r;if(e[0]!==a||e[1]!==n){let i;e[3]!==a?(i=c=>t.jsx(ns,{virtualMcp:c,org:a},c.id),e[3]=a,e[4]=i):i=e[4],r=n.map(i),e[0]=a,e[1]=n,e[2]=r}else r=e[2];let o;return e[5]!==r?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:r})}),e[5]=r,e[6]=o):o=e[6],o}function is(s){const e=P.c(7),{connection:n}=s,{org:a}=J();let r;e[0]!==n.id?(r={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=r):r=e[1];const o=Tt(r);if(!(o.length>0)){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(t.Fragment,{}),e[2]=u):u=e[2],u}let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"px-5 py-4 border-b border-border",children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Used by agents"})}),e[3]=c):c=e[3];let l;return e[4]!==a.slug||e[5]!==o?(l=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[c,t.jsx("div",{className:"px-5 py-4",children:t.jsx(os,{virtualMcps:o,org:a.slug})})]}),e[4]=a.slug,e[5]=o,e[6]=l):l=e[6],l}function as(s){const e=P.c(31),{tools:n,connectionId:a,org:r}=s,o=Y(),{org:i}=J();let c;e[0]!==a||e[1]!==i.id||e[2]!==i.slug?(c={connectionId:a,orgId:i.id,orgSlug:i.slug},e[0]=a,e[1]=i.id,e[2]=i.slug,e[3]=c):c=e[3];const l=_e(c),u=Ne(a);let x;e[4]!==u||e[5]!==a?(x=u?ke(u):a,e[4]=u,e[5]=a,e[6]=x):x=e[6];const p=x,[d,f]=G.useState("");let g,v,b,j;if(e[7]!==p||e[8]!==l||e[9]!==o||e[10]!==r||e[11]!==d||e[12]!==n){const C=(n??[]).filter(rs),y=d.toLowerCase().trim(),I=y?C.filter(h=>h.name.toLowerCase().includes(y)||h.description&&h.description.toLowerCase().includes(y)):C;let _;e[17]!==p||e[18]!==o||e[19]!==r?(_=h=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(h.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 S;e[21]===Symbol.for("react.memo_cache_sentinel")?(S=h=>{h.key==="Escape"&&(f(""),h.target.blur())},e[21]=S):S=e[21],e[22]!==d?(j=t.jsx(Ot,{value:d,onChange:f,placeholder:"Search apps...",onKeyDown:S}),e[22]=d,e[23]=j):j=e[23],g="flex-1 overflow-auto p-5",v=I.length===0?t.jsx(ve,{image:null,title:d?"No apps found":"No apps available",description:d?"Try adjusting your search terms":"This connection doesn't have any tools with interactive UIs yet."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:I.map(h=>{const w=re(h._meta);return t.jsxs(zt,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>k(h),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(Pt,{resourceURI:w,toolInfo:{tool:h},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:h.name}),t.jsx(Je,{annotations:h.annotations,_meta:h._meta})]}),h.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:h.description})]})]},h.name)})}),e[7]=p,e[8]=l,e[9]=o,e[10]=r,e[11]=d,e[12]=n,e[13]=g,e[14]=v,e[15]=b,e[16]=j}else g=e[13],v=e[14],b=e[15],j=e[16];let N;e[24]!==g||e[25]!==v?(N=t.jsx("div",{className:g,children:v}),e[24]=g,e[25]=v,e[26]=N):N=e[26];let T;return e[27]!==b||e[28]!==j||e[29]!==N?(T=t.jsxs("div",{className:b,children:[j,N]}),e[27]=b,e[28]=j,e[29]=N,e[30]=T):T=e[30],T}function rs(s){return!!re(s._meta)}function Te(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=i=>i.charAt(0).toUpperCase()+i.slice(1),a=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),r=e.map(n),o=e[e.length-1];return r.length>=2&&o&&a.has(o)?[r.pop(),...r].join(" "):r.join(" ")}function ie(s){const e=P.c(2),{label:n}=s;let a;return e[0]!==n?(a=t.jsx("div",{className:"px-5 py-8 text-center",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",n," available."]})}),e[0]=n,e[1]=a):a=e[1],a}function ls(s){const e=P.c(50),{tools:n,prompts:a,resources:r,connectionId:o,org:i}=s;let c;e[0]!==a?(c=a===void 0?[]:a,e[0]=a,e[1]=c):c=e[1];const l=c;let u;e[2]!==r?(u=r===void 0?[]:r,e[2]=r,e[3]=u):u=e[3];const x=u,p=Y(),d=Ne(o??"");let f;e[4]!==d||e[5]!==o?(f=d?ke(d):o,e[4]=d,e[5]=o,e[6]=f):f=e[6];const g=f;let v;e[7]!==g||e[8]!==o||e[9]!==p||e[10]!==i?(v=function(D){!o||!i||p({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:i,appSlug:g,collectionName:"tools",itemId:encodeURIComponent(D)}})},e[7]=g,e[8]=o,e[9]=p,e[10]=i,e[11]=v):v=e[11];const b=v;let j;e[12]!==o||e[13]!==i||e[14]!==n?(j=o&&i&&n.some(ms),e[12]=o,e[13]=i,e[14]=n,e[15]=j):j=e[15];const N=j;if(n.length+l.length+x.length===0){let m;return e[16]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:"Capabilities"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"No capabilities discovered yet. The connection may still be connecting."})]}),e[16]=m):m=e[16],m}let C;e[17]!==n.length?(C=t.jsxs(ee,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=C):C=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]!==C||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:[C,y,I,_]})}),e[23]=C,e[24]=y,e[25]=k):k=e[25];let S;e[26]!==b||e[27]!==n?(S=n.length>0?n.map(m=>t.jsxs("button",{type:"button",className:"w-full flex items-start gap-3 px-5 py-3 text-left hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>b(m.name),children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx($t,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Te(m.name)}),m.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:m.description})]}),t.jsx(Ce,{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]=S):S=e[28];let h;e[29]!==S?(h=t.jsx(te,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:S})}),e[29]=S,e[30]=h):h=e[30];let w;e[31]!==o||e[32]!==N||e[33]!==i||e[34]!==n?(w=N&&t.jsx(te,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(as,{tools:n,connectionId:o,org:i})}),e[31]=o,e[32]=N,e[33]=i,e[34]=n,e[35]=w):w=e[35];let z;e[36]!==l?(z=l.length>0?l.map(ds):t.jsx(ie,{label:"prompts"}),e[36]=l,e[37]=z):z=e[37];let O;e[38]!==z?(O=t.jsx(te,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:z})}),e[38]=z,e[39]=O):O=e[39];let A;e[40]!==x?(A=x.length>0?x.map(cs):t.jsx(ie,{label:"resources"}),e[40]=x,e[41]=A):A=e[41];let M;e[42]!==A?(M=t.jsx(te,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:A})}),e[42]=A,e[43]=M):M=e[43];let U;return e[44]!==k||e[45]!==h||e[46]!==w||e[47]!==O||e[48]!==M?(U=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(At,{defaultValue:"tools",variant:"underline",children:[k,h,w,O,M]})}),e[44]=k,e[45]=h,e[46]=w,e[47]=O,e[48]=M,e[49]=U):U=e[49],U}function cs(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(lt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:s.name}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description}),s.uri&&t.jsx("div",{className:"text-xs text-muted-foreground/60 font-mono mt-0.5 truncate",children:s.uri})]})]},s.uri??s.name)}function ds(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(Dt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Te(s.name)}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description})]})]},s.name)}function ms(s){return re(s._meta)}function us(s){const e=P.c(13),{connection:n,displayTitle:a}=s,r=a??n.title;let o;e[0]!==n.icon||e[1]!==r?(o=t.jsx(oe,{icon:n.icon,name:r,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=r,e[2]=o):o=e[2];let i;e[3]!==r?(i=t.jsx("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:t.jsx("h1",{className:"text-lg md:text-xl font-semibold tracking-tight text-foreground leading-none",children:r})}),e[3]=r,e[4]=i):i=e[4];let c;e[5]!==n.description?(c=n.description&&t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed line-clamp-2",children:n.description}),e[5]=n.description,e[6]=c):c=e[6];let l;e[7]!==i||e[8]!==c?(l=t.jsxs("div",{className:"flex-1 min-w-0",children:[i,c]}),e[7]=i,e[8]=c,e[9]=l):l=e[9];let u;return e[10]!==o||e[11]!==l?(u=t.jsxs("div",{className:"flex items-center gap-4 md:gap-6 py-5 md:py-7 px-4 md:px-8 bg-background border-b border-border shrink-0",children:[o,l]}),e[10]=o,e[11]=l,e[12]=u):u=e[12],u}function xs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:a,onRemoveOAuth:r}){const o=ce({control:s.control,name:"ui_type"}),i=ce({control:s.control,name:"connection_url"}),{stdioEnabled:c}=Pe(),l=(()=>{if(typeof i!="string"||!i)return!1;try{const d=new URL(i);return d.hostname==="api.githubcopilot.com"&&d.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),u=c||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",p=x?Oe(e.connection_url):null;return x?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(we,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),p&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),t.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:t.jsx("code",{className:"text-sm text-muted-foreground",children:p})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(L,{control:s.control,name:"ui_type",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),o!=="NPX"&&o!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(me,{value:d.value,onValueChange:d.onChange,children:[t.jsx(V,{children:t.jsxs(ue,{className:"h-full! w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(se,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(xe,{})]})}),t.jsxs(pe,{children:[t.jsx(R,{value:"HTTP",children:"HTTP"}),t.jsx(R,{value:"SSE",children:"SSE"}),t.jsx(R,{value:"Websocket",children:"Websocket"}),u&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:"NPX Package"}),t.jsx(R,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(L,{control:s.control,name:"connection_url",render:({field:f})=>t.jsx(B,{className:"flex-1 min-w-0",children:t.jsx(V,{children:t.jsx(X,{placeholder:"https://example.com/mcp",...f,value:f.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(me,{value:d.value,onValueChange:d.onChange,children:[t.jsx(V,{children:t.jsx(ue,{className:"h-10",children:t.jsx(xe,{})})}),t.jsxs(pe,{children:[t.jsx(R,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(R,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(R,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"Websocket"]})}),u&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Lt,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(R,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ct,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(W,{})]})}),o==="NPX"&&t.jsx(L,{control:s.control,name:"npx_package",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(V,{children:t.jsx(X,{placeholder:"@perplexity-ai/mcp-server",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),o==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(L,{control:s.control,name:"stdio_command",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(V,{children:t.jsx(X,{placeholder:"node, bun, python...",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),t.jsx(L,{control:s.control,name:"stdio_args",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(V,{children:t.jsx(X,{placeholder:"arg1 arg2 --flag value",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(W,{})]})})]}),t.jsx(L,{control:s.control,name:"stdio_cwd",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(V,{children:t.jsx(X,{placeholder:"/path/to/project (optional)",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(L,{control:s.control,name:"env_vars",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(V,{children:t.jsx(Be,{value:d.value??[],onChange:d.onChange})}),t.jsx(W,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(L,{control:s.control,name:"connection_token",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:l?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Vt,{children:[t.jsx(Et,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Mt,{variant:"success",className:"gap-1.5",children:[t.jsx(Ft,{size:12}),"Authenticated via OAuth",t.jsx(Rt,{size:12})]})})}),t.jsxs(Ut,{align:"start",children:[t.jsxs(de,{onClick:a,children:[t.jsx(dt,{size:16}),"Re-authenticate"]}),t.jsxs(de,{variant:"destructive",onClick:r,children:[t.jsx(ae,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&d.value===null?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>d.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(Bt,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(X,{type:"password",placeholder:l?"Paste your GitHub PAT":"Enter access token...",...d,value:d.value||"",className:"h-10 rounded-lg"})}),l&&t.jsxs(ft,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(W,{})]})})]})}function ps(s){return s.command==="npx"}function hs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function fs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function he(s,e){const n={title:s.title,description:s.description??"",icon:s.icon??null,configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&Re(s.connection_headers)){const a=s.connection_headers,r=We(a.envVars);if(ps(a)){const i=hs(a);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:i,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const o=fs(a);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:o.command,stdio_args:o.args,stdio_cwd:o.cwd,env_vars:r}}return{...n,ui_type:s.connection_type,connection_url:s.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function gs(s){let e,n=null,a=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=Xe(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",r=qe(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",a=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...a&&{connection_token:a},...r&&{connection_headers:r},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function js({connection:s,connectionId:e,org:n,isUpdating:a,tools:r,prompts:o,resources:i,siblings:c}){const l=Y({from:"/$org/settings/connections/$appSlug"}),u=Ee(),x=ye(),{org:p}=J(),d=jt({onSuccess:()=>{c.length<=1&&l({to:"/$org/settings/connections",params:{org:n}})}}),[f,g]=G.useState(null),[v,b]=G.useState(!1),j=be({connectionId:e}),{data:N}=Ye(),T=N?.data?.members??[],C=f??s,y=T.find(m=>m.userId===C.created_by),_=s?.connection_type==="VIRTUAL"||j.isAuthenticated,k={...s,tools:r},S=Ge(k,Wt),h=Ue({resolver:Fe(He),values:he(f??s)}),w=h.formState.isDirty,z=async()=>{if(!await h.trigger())return;const D=h.getValues(),$=gs(D),F=f?.id??e;await x.update.mutateAsync({id:F,data:$}),h.reset(D)},O=()=>{h.reset(he(f??s))},A=async m=>{const{token:D,tokenInfo:$,error:F}=await ot({connectionId:m,orgSlug:p.slug,scope:"offline_access"});if(F||!D){q.error(`Authentication failed: ${F}`);return}if($)try{const K=await fetch(`/api/${p.slug}/connections/${m}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:$.accessToken,refreshToken:$.refreshToken,expiresIn:$.expiresIn,scope:$.scope,clientId:$.clientId,clientSecret:$.clientSecret,tokenEndpoint:$.tokenEndpoint})});if(!K.ok)console.error("Failed to save OAuth token:",await K.text()),await x.update.mutateAsync({id:m,data:{connection_token:D}});else try{await x.update.mutateAsync({id:m,data:{}})}catch(Z){console.warn("Failed to refresh connection tools after OAuth:",Z)}}catch(K){console.error("Error saving OAuth token:",K),await x.update.mutateAsync({id:m,data:{connection_token:D}})}else await x.update.mutateAsync({id:m,data:{connection_token:D}});const Q=new URL(`/api/${p.slug}/mcp/${m}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(Q.href,null)}),await u.invalidateQueries({queryKey:ne.mcpClientPrefix()}),q.success("Authentication successful")},M=()=>A(s.id),U=async()=>{try{const m=await fetch(`/api/${p.slug}/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!m.ok){const $=await m.text();q.error(`Failed to remove OAuth: ${$}`);return}const D=new URL(`/api/${p.slug}/mcp/${s.id}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(D.href,null)}),q.success("OAuth removed. You can now re-authenticate with a different account.")}catch(m){console.error("Error removing OAuth token:",m),q.error("Failed to remove OAuth")}};return t.jsxs(t.Fragment,{children:[t.jsx(vt,{...d}),t.jsx(mt,{open:f!==null,onOpenChange:m=>{m||g(null)},children:t.jsxs(ut,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(xt,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(pt,{className:"text-base",children:f?.title??s.title}),t.jsx(ht,{className:"text-xs",children:"Update URL, authentication, and other settings"}),y&&t.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Connected by"}),t.jsx(Ze,{url:y.user?.image??void 0,fallback:y.user?.name??y.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:y.user?.name||y.user?.email})]})]}),t.jsxs(gt,{...h,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:h.control,name:"title",render:({field:m})=>t.jsxs(B,{children:[t.jsx(H,{children:"Name"}),t.jsx(V,{children:t.jsx(X,{...m})}),t.jsx(W,{})]})}),t.jsx(L,{control:h.control,name:"description",render:({field:m})=>t.jsxs(B,{children:[t.jsx(H,{children:"Description"}),t.jsx(V,{children:t.jsx(X,{...m,value:m.value||""})}),t.jsx(W,{})]})})]}),t.jsx(xs,{form:h,connection:f??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:M,onRemoveOAuth:U}),t.jsx(Ke,{connection:f??s,form:h,hasMcpBinding:S,isMCPAuthenticated:_,supportsOAuth:j.supportsOAuth,isServerError:j.isServerError,onAuthenticate:M,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(E,{onClick:z,disabled:!w||a,className:"flex-1",children:a?"Saving…":"Save changes"}),w&&t.jsx(E,{variant:"outline",onClick:O,children:"Undo"}),t.jsxs(E,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const m=f??s;g(null),d.requestDelete(m)},children:[t.jsx(ae,{size:15}),"Delete"]})]})]},f?.id??s.id)]})}),t.jsx(Qe,{hideHeader:!0,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(us,{connection:s,displayTitle:(()=>{const m=c[0]??s;return m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.title})()}),t.jsx("div",{className:"flex-1 overflow-auto @container",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-2 gap-5 p-6",children:[t.jsx(ss,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(Gt,{instances:c,onConfigure:m=>g(m),onAuthenticate:m=>A(m.id),onDelete:m=>d.requestDelete(m),onToggleStatus:async(m,D)=>{try{await x.update.mutateAsync({id:m.id,data:{status:D}}),q.success(D==="active"?"Connection enabled":"Connection disabled")}catch{q.error("Failed to update connection")}},isAdding:v,onAdd:async()=>{b(!0);try{const m=c[0]??s,D=m.title.replace(/\s*\(\d+\)\s*$/,""),$=c.length+1,F=`${D} (${$})`,Q=Le("conn");await x.create.mutateAsync({id:Q,title:F,description:m.description??null,connection_type:m.connection_type,connection_url:m.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:m.created_by,organization_id:m.organization_id,icon:m.icon??null,app_name:m.app_name??null,app_id:m.app_id??null,connection_headers:m.connection_headers??null,oauth_config:null,configuration_state:m.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const K=new URL(`/api/${p.slug}/mcp/${Q}`,window.location.origin),Z=await nt({url:K.href,token:null,orgId:p.id});Z.supportsOAuth&&!Z.isAuthenticated&&await A(Q)}finally{b(!1)}}}),t.jsx(is,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ls,{tools:r,prompts:o,resources:i,connectionId:e,org:n})})]})})]})})]})}function vs(){const s=P.c(39);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/settings/connections/$appSlug"},s[0]=e):e=s[0];const n=Y(e);let a;s[1]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/shell/$org/settings/connections/$appSlug"},s[1]=a):a=s[1];const{appSlug:r,org:o}=Me(a),{org:i}=J(),c=ye();let l;s[2]!==r?(l={slug:r},s[2]=r,s[3]=l):l=s[3];const u=et(l),x=u[0]??null,p=x?.id??"",d=p||null;let f;s[4]!==i.id||s[5]!==i.slug||s[6]!==d?(f={connectionId:d,orgId:i.id,orgSlug:i.slug},s[4]=i.id,s[5]=i.slug,s[6]=d,s[7]=f):f=s[7];const g=_e(f);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(Cs):(x?.tools??[]).map(Ss);e:{if(u.length<=1){j=A;break e}const M=new Set,U=[],m=ys;for(const D of u){const $=D.id===p?A:m(D.tools);for(const F of $)M.has(F.name)||(M.add(F.name),U.push(F))}j=U.length>0?U:A}s[10]=x?.tools,s[11]=p,s[12]=u,s[13]=b,s[14]=j}else j=s[14];const N=j;let T;s[15]!==g?(T={client:g},s[15]=g,s[16]=T):T=s[16];const{data:C}=st(T);let y;s[17]!==g?(y={client:g},s[17]=g,s[18]=y):y=s[18];const{data:I}=Ve(y);let _;s[19]!==C?.prompts?(_=C?.prompts??[],s[19]=C?.prompts,s[20]=_):_=s[20];let k;s[21]!==_?(k=_.map(Ns),s[21]=_,s[22]=k):k=s[22];const S=k;let h;s[23]!==I?.resources?(h=I?.resources??[],s[23]=I?.resources,s[24]=h):h=s[24];let w;s[25]!==h?(w=h.map(bs),s[25]=h,s[26]=w):w=s[26];const z=w;if(!x){let A;return s[27]!==n||s[28]!==o?(A=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(ve,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(E,{variant:"outline",onClick:()=>n({to:"/$org/settings/connections",params:{org:o}}),children:"Back to connections"})})}),s[27]=n,s[28]=o,s[29]=A):A=s[29],A}let O;return s[30]!==c.update.isPending||s[31]!==N||s[32]!==x||s[33]!==p||s[34]!==o||s[35]!==S||s[36]!==z||s[37]!==u?(O=t.jsx(js,{org:o,connection:x,connectionId:p,isUpdating:c.update.isPending,tools:N,prompts:S,resources:z,siblings:u}),s[30]=c.update.isPending,s[31]=N,s[32]=x,s[33]=p,s[34]=o,s[35]=S,s[36]=z,s[37]=u,s[38]=O):O=s[38],O}function bs(s){return{name:s.name,description:s.description,uri:s.uri}}function Ns(s){return{name:s.name,description:s.description}}function ys(s){return(s??[]).map(_s)}function _s(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ss(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Cs(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ws(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ze,{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(vs,{})})}),s[0]=e):e=s[0],e}function lo(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ws,{}),s[0]=e):e=s[0],e}export{lo as default};
|
|
1
|
+
import{o as fe,aG as Ie,b8 as Ae,s as le,aE as De,c as P,j as t,i as ge,B as V,r as q,l as je,D as J,q as $e,K as ne,b as Y,ab as ce,z as Pe,b9 as Oe,E as ze,e as Me,ba as Ee,m as Ve,p as Ue,n as Fe,t as X,bb as Re}from"./index-CFiyU0D9.js";import{a as Le}from"./extract-connection-data-D6bQrejT.js";import{E as ve}from"./empty-state-Sh_DuDcy.js";import{E as Be,c as He,r as Ge,b as We,d as Xe}from"./connection-form-helpers-CwZx7WkC.js";import{c as qe,S as Ke,V as Qe}from"./index-CkTyYAY1.js";import{u as be,T as Je}from"./tools-list-uWC3Ij6C.js";import{u as Ye}from"./use-members-BMNjJExY.js";import{A as Ze}from"./avatar-CJP1BOq4.js";import{a as Ne,b as ye,u as et}from"./use-connection-Dz29RF9P.js";import{u as _e}from"./use-mcp-client-xOK-OF8p.js";import{a as tt}from"./use-mcp-tools-C8tMWwG9.js";import{a as st}from"./use-mcp-prompts-Crr3H7P7.js";import{i as nt,a as ot}from"./mcp-oauth-IblqU9XT.js";import{I as oe}from"./integration-icon-LQhkkaLl.js";import{s as it}from"./Plus-eGxBB1d8.js";import{B as at,D as rt,ak as lt,a9 as ct}from"./agent-icon-oDx9Z_Be.js";import{a as Se,s as dt}from"./Settings02-BcAnTzm5.js";import{s as ae}from"./Trash01-ByxlxTiZ.js";import{d as mt,c as ut,b as xt,S as pt,a as ht}from"./sheet-DyU03ddw.js";import{F as L,b as B,c as H,d as E,e as G,f as ft,a as gt}from"./form-DGE2mWLL.js";import{I as W}from"./input-BwRH-Gsz.js";import{u as jt,D as vt}from"./use-delete-connection-CqeuxO_6.js";import{c as bt,C as Nt,B as yt,a as _t,b as St,d as Ct,e as wt}from"./monitoring-stats-row-DPsQ-OAn.js";import{u as kt}from"./studio-tools-CNO5iCKk.js";import{u as Tt}from"./use-virtual-mcp-2U_MnYnK.js";import{i as Ce}from"./ChevronRight-Cpfh3gza.js";import{a as we}from"./Users03-DknrDMtT.js";import{T as ee,a as It,b as te,c as At}from"./tabs-Ca0vDJqc.js";import{g as ke}from"./connection-slug-eyAPH6o3.js";import{n as Dt}from"./ZapSquare-PMiGcZpW.js";import{c as $t}from"./Tool01-CvnpFI53.js";import{g as re,M as Pt}from"./types-C7syjwde.js";import{C as Ot}from"./collection-search-8iNXnGlM.js";import{C as zt}from"./card-BFb5m83e.js";import{B as Mt}from"./badge-DhpSM7g_.js";import{D as Et,a as Vt,b as Ut,c as de}from"./dropdown-menu-C62KNjwK.js";import{d as me,b as ue,c as xe,S as pe,a as R}from"./select-C6v8Xcth.js";import{i as Ft}from"./CheckCircle-Cgnheu-R.js";import{t as Rt}from"./ChevronDown-DyHvxYlc.js";import{n as Lt}from"./XCircle-Ct0eqqsw.js";import{s as se}from"./Star01-DHEkWySe.js";import{s as Bt}from"./XClose-BaZ908gw.js";import"./index-Bb-tYGNK.js";import"./sidebar-BNrafefE.js";import"./LayoutLeft-fsm0LcB8.js";import"./use-mobile-NlF-3RoP.js";import"./tooltip-DrpiSbRG.js";import"./ZoomOut-6ix2H92j.js";import"./Key01-CwrJlZo0.js";import"./auth-Bej0Tx2Y.js";import"./use-registry-connections-BOZLpkM5.js";import"./use-organization-settings-DksiQdGc.js";import"./index-hmJjUPum.js";import"./index-DGzNvPy2.js";import"./index-jBUpmiBg.js";import"./popover-BXFiEQtN.js";import"./ChevronUp-DBpw6M-L.js";import"./SearchMd-ujiTPCmg.js";import"./use-create-virtual-mcp-DVmI--_C.js";import"./use-navigate-to-agent-DZubxUSm.js";import"./Eye-bojNLUjA.js";import"./use-org-auth-client-C_UJ3Vg_.js";import"./User01-COQtf360.js";import"./use-collections-B4atckEK.js";import"./AlertCircle-DC-zDzV-.js";import"./SwitchHorizontal01-DAZXInW8.js";import"./ArrowUpRight-OJZisFPQ.js";import"./ChevronLeft-dyRjFCmp.js";import"./DotsVertical-5jSu3d1f.js";import"./Stars02-qnq-_X9g.js";import"./Globe01-CyfpzbeQ.js";import"./FilterLines-CFl65nng.js";import"./Globe04-DFpdKSRI.js";import"./HardDrive-B1mtnaeA.js";import"./LinkExternal01-BHwVyDja.js";import"./Monitor01-ChA6ov2I.js";import"./Sun-lTiqxOzH.js";import"./Palette-DusYqL0W.js";import"./Play-CnXG8qqP.js";import"./SearchLg-CDpA_lbT.js";import"./Shield01-ZxmFmrvL.js";import"./Stars01-BdCaKqhF.js";import"./Upload01-Z77n1bV8.js";import"./Users01-wtRJYQKX.js";import"./X-DrMVHLcw.js";import"./Zap-wRIFSWIq.js";import"./label-CdBSUJpf.js";import"./alert-dialog-CYizItFp.js";const Ht=fe({scopes:De(le()).describe("List of scopes available"),stateSchema:Ie(le(),Ae()).describe("JSON Schema (draft-07) defining the state structure")}),Gt=[{name:"MCP_CONFIGURATION",inputSchema:fe({}),outputSchema:Ht}];function Wt(s){const e=P.c(46),{instance:n,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i}=s;let c;e[0]!==n.id?(c={connectionId:n.id},e[0]=n.id,e[1]=c):c=e[1];const l=be(c),x=!(n.connection_type==="VIRTUAL")&&l.supportsOAuth&&!l.isAuthenticated,p=n.status!=="active",d=x||p?"border-destructive/50 bg-destructive/5":"border-transparent";let f;e[2]!==d?(f=je("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",d),e[2]=d,e[3]=f):f=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]!==i?(T=p?t.jsxs(V,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>i(n,"active"),children:[t.jsx(at,{size:13}),"Enable"]}):t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>i(n,"inactive"),title:"Disable",children:t.jsx(rt,{size:13})}),e[20]=n,e[21]=p,e[22]=i,e[23]=T):T=e[23];let C;e[24]!==n||e[25]!==a?(C=()=>a(n),e[24]=n,e[25]=a,e[26]=C):C=e[26];let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(Se,{size:13}),e[27]=y):y=e[27];let I;e[28]!==C?(I=t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:C,title:"Configure",children:y}),e[28]=C,e[29]=I):I=e[29];let _;e[30]!==n||e[31]!==o?(_=()=>o(n),e[30]=n,e[31]=o,e[32]=_):_=e[32];let k;e[33]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(ae,{size:13}),e[33]=k):k=e[33];let S;e[34]!==_?(S=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]=S):S=e[35];let h;e[36]!==I||e[37]!==S||e[38]!==N||e[39]!==T?(h=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[N,T,I,S]}),e[36]=I,e[37]=S,e[38]=N,e[39]=T,e[40]=h):h=e[40];let w;return e[41]!==h||e[42]!==f||e[43]!==g||e[44]!==j?(w=t.jsxs("div",{className:f,children:[g,j,h]}),e[41]=h,e[42]=f,e[43]=g,e[44]=j,e[45]=w):w=e[45],w}function Xt(s){const e=P.c(15),{instance:n,onConfigure:a}=s;let r;e[0]!==n.icon||e[1]!==n.title?(r=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=r):r=e[2];let o;e[3]!==n.title?(o=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",children:n.title})}),e[3]=n.title,e[4]=o):o=e[4];let i;e[5]!==n||e[6]!==a?(i=()=>a(n),e[5]=n,e[6]=a,e[7]=i):i=e[7];let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Se,{size:13}),e[8]=c):c=e[8];let l;e[9]!==i?(l=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:i,title:"Configure",children:c})}),e[9]=i,e[10]=l):l=e[10];let u;return e[11]!==r||e[12]!==o||e[13]!==l?(u=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[r,o,l]}),e[11]=r,e[12]=o,e[13]=l,e[14]=u):u=e[14],u}function qt(s){const e=P.c(27),{instances:n,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i,onAdd:c,isAdding:l}=s;if(n.length===0)return null;const u=n.length===1?"Instance":"Instances";let x;e[0]!==u?(x=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:u}),e[0]=u,e[1]=x):x=e[1];let p;e[2]!==l?(p=l?t.jsx(ge,{size:13,className:"animate-spin"}):t.jsx(it,{size:13}),e[2]=l,e[3]=p):p=e[3];let d;e[4]!==l||e[5]!==c||e[6]!==p?(d=t.jsxs(V,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:c,disabled:l,children:[p,"Add instance"]}),e[4]=l,e[5]=c,e[6]=p,e[7]=d):d=e[7];let f;e[8]!==x||e[9]!==d?(f=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[x,d]}),e[8]=x,e[9]=d,e[10]=f):f=e[10];let g;if(e[11]!==n||e[12]!==r||e[13]!==a||e[14]!==o||e[15]!==i){let j;e[17]!==r||e[18]!==a||e[19]!==o||e[20]!==i?(j=N=>t.jsx(q.Suspense,{fallback:t.jsx(Xt,{instance:N,onConfigure:a}),children:t.jsx(Wt,{instance:N,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i})},N.id),e[17]=r,e[18]=a,e[19]=o,e[20]=i,e[21]=j):j=e[21],g=n.map(j),e[11]=n,e[12]=r,e[13]=a,e[14]=o,e[15]=i,e[16]=g}else g=e[16];let v;e[22]!==g?(v=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:g}),e[22]=g,e[23]=v):v=e[23];let b;return e[24]!==f||e[25]!==v?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[f,v]}),e[24]=f,e[25]=v,e[26]=b):b=e[26],b}const Kt=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function Qt(s){const e=new Date,n=new Date(e);return s==="7d"?n.setDate(n.getDate()-7):s==="14d"?n.setDate(n.getDate()-14):n.setDate(n.getDate()-30),{startDate:n,endDate:e}}const Jt={calls:{label:"Tool calls"},errors:{label:"Errors"}};function Yt(s){const e=P.c(1),{connectionId:n,orgId:a,timeframe:r}=s,o=kt(),i=Qt(r),{data:c}=$e({queryKey:ne.connectionActivity(n,r,a),queryFn:async()=>await o.call("MONITORING_LOGS_LIST",{startDate:i.startDate.toISOString(),endDate:i.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}),staleTime:3e5}),l=bt(c?.logs??[],i),u=l.data,x=l.totalCalls>0;let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[0]=p):p=e[0],t.jsxs("div",{children:[t.jsxs("div",{className:"flex gap-6 px-5 pb-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:l.totalCalls.toLocaleString()}),p]}),l.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:l.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),l.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(l.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),x?t.jsxs("div",{children:[t.jsx(Nt,{config:Jt,className:"h-16 w-full",children:t.jsxs(yt,{data:u,barCategoryGap:"4%",children:[t.jsx(_t,{content:t.jsx(St,{labelFormatter:es}),cursor:{fill:"var(--muted)"}}),t.jsx(Ct,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:u.map(Zt)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[u.length-1]?.label})]})]}):t.jsx("div",{className:"h-20 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-muted-foreground/60",children:"No activity in this period"})})]})}function Zt(s,e){return t.jsx(wt,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function es(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function ts(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{children:[t.jsx("div",{className:"flex gap-6 px-5 pb-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx("div",{className:"h-7 w-16 rounded-md bg-muted animate-pulse"}),t.jsx("div",{className:"h-3 w-14 rounded bg-muted animate-pulse"})]})}),t.jsx("div",{className:"h-20 w-full rounded-md bg-muted animate-pulse"})]}),s[0]=e):e=s[0],e}function ss(s){const e=P.c(13),{connectionId:n}=s,[a,r]=q.useState("14d"),{org:o}=J();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=i):i=e[0];let c;e[1]!==a?(c=Kt.map(d=>t.jsx("button",{type:"button",onClick:()=>r(d.value),className:je("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",a===d.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:d.label},d.value)),e[1]=a,e[2]=c):c=e[2];let l;e[3]!==c?(l=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[i,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:c})]}),e[3]=c,e[4]=l):l=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(ts,{}),e[5]=u):u=e[5];let x;e[6]!==n||e[7]!==o.id||e[8]!==a?(x=t.jsx(q.Suspense,{fallback:u,children:t.jsx(Yt,{connectionId:n,orgId:o.id,timeframe:a})}),e[6]=n,e[7]=o.id,e[8]=a,e[9]=x):x=e[9];let p;return e[10]!==l||e[11]!==x?(p=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[l,x]}),e[10]=l,e[11]=x,e[12]=p):p=e[12],p}function ns(s){const e=P.c(15),{virtualMcp:n,org:a}=s,r=Y();let o;e[0]!==r||e[1]!==a||e[2]!==n.id?(o=()=>{const p=crypto.randomUUID();r({to:"/$org/$taskId",params:{org:a,taskId:p},search:{virtualmcpid:n.id}})},e[0]=r,e[1]=a,e[2]=n.id,e[3]=o):o=e[3];let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(we,{size:16}),e[4]=i):i=e[4];let c;e[5]!==n.icon||e[6]!==n.title?(c=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:i}),e[5]=n.icon,e[6]=n.title,e[7]=c):c=e[7];let l;e[8]!==n.title?(l=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=l):l=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(Ce,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[10]=u):u=e[10];let x;return e[11]!==o||e[12]!==c||e[13]!==l?(x=t.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group text-left w-full",children:[c,l,u]}),e[11]=o,e[12]=c,e[13]=l,e[14]=x):x=e[14],x}function os(s){const e=P.c(7),{virtualMcps:n,org:a}=s;let r;if(e[0]!==a||e[1]!==n){let i;e[3]!==a?(i=c=>t.jsx(ns,{virtualMcp:c,org:a},c.id),e[3]=a,e[4]=i):i=e[4],r=n.map(i),e[0]=a,e[1]=n,e[2]=r}else r=e[2];let o;return e[5]!==r?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:r})}),e[5]=r,e[6]=o):o=e[6],o}function is(s){const e=P.c(7),{connection:n}=s,{org:a}=J();let r;e[0]!==n.id?(r={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=r):r=e[1];const o=Tt(r);if(!(o.length>0)){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(t.Fragment,{}),e[2]=u):u=e[2],u}let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"px-5 py-4 border-b border-border",children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Used by agents"})}),e[3]=c):c=e[3];let l;return e[4]!==a.slug||e[5]!==o?(l=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[c,t.jsx("div",{className:"px-5 py-4",children:t.jsx(os,{virtualMcps:o,org:a.slug})})]}),e[4]=a.slug,e[5]=o,e[6]=l):l=e[6],l}function as(s){const e=P.c(31),{tools:n,connectionId:a,org:r}=s,o=Y(),{org:i}=J();let c;e[0]!==a||e[1]!==i.id||e[2]!==i.slug?(c={connectionId:a,orgId:i.id,orgSlug:i.slug},e[0]=a,e[1]=i.id,e[2]=i.slug,e[3]=c):c=e[3];const l=_e(c),u=Ne(a);let x;e[4]!==u||e[5]!==a?(x=u?ke(u):a,e[4]=u,e[5]=a,e[6]=x):x=e[6];const p=x,[d,f]=q.useState("");let g,v,b,j;if(e[7]!==p||e[8]!==l||e[9]!==o||e[10]!==r||e[11]!==d||e[12]!==n){const C=(n??[]).filter(rs),y=d.toLowerCase().trim(),I=y?C.filter(h=>h.name.toLowerCase().includes(y)||h.description&&h.description.toLowerCase().includes(y)):C;let _;e[17]!==p||e[18]!==o||e[19]!==r?(_=h=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(h.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 S;e[21]===Symbol.for("react.memo_cache_sentinel")?(S=h=>{h.key==="Escape"&&(f(""),h.target.blur())},e[21]=S):S=e[21],e[22]!==d?(j=t.jsx(Ot,{value:d,onChange:f,placeholder:"Search apps...",onKeyDown:S}),e[22]=d,e[23]=j):j=e[23],g="flex-1 overflow-auto p-5",v=I.length===0?t.jsx(ve,{image:null,title:d?"No apps found":"No apps available",description:d?"Try adjusting your search terms":"This connection doesn't have any tools with interactive UIs yet."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:I.map(h=>{const w=re(h._meta);return t.jsxs(zt,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>k(h),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(Pt,{resourceURI:w,toolInfo:{tool:h},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:h.name}),t.jsx(Je,{annotations:h.annotations,_meta:h._meta})]}),h.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:h.description})]})]},h.name)})}),e[7]=p,e[8]=l,e[9]=o,e[10]=r,e[11]=d,e[12]=n,e[13]=g,e[14]=v,e[15]=b,e[16]=j}else g=e[13],v=e[14],b=e[15],j=e[16];let N;e[24]!==g||e[25]!==v?(N=t.jsx("div",{className:g,children:v}),e[24]=g,e[25]=v,e[26]=N):N=e[26];let T;return e[27]!==b||e[28]!==j||e[29]!==N?(T=t.jsxs("div",{className:b,children:[j,N]}),e[27]=b,e[28]=j,e[29]=N,e[30]=T):T=e[30],T}function rs(s){return!!re(s._meta)}function Te(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=i=>i.charAt(0).toUpperCase()+i.slice(1),a=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),r=e.map(n),o=e[e.length-1];return r.length>=2&&o&&a.has(o)?[r.pop(),...r].join(" "):r.join(" ")}function ie(s){const e=P.c(2),{label:n}=s;let a;return e[0]!==n?(a=t.jsx("div",{className:"px-5 py-8 text-center",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",n," available."]})}),e[0]=n,e[1]=a):a=e[1],a}function ls(s){const e=P.c(50),{tools:n,prompts:a,resources:r,connectionId:o,org:i}=s;let c;e[0]!==a?(c=a===void 0?[]:a,e[0]=a,e[1]=c):c=e[1];const l=c;let u;e[2]!==r?(u=r===void 0?[]:r,e[2]=r,e[3]=u):u=e[3];const x=u,p=Y(),d=Ne(o??"");let f;e[4]!==d||e[5]!==o?(f=d?ke(d):o,e[4]=d,e[5]=o,e[6]=f):f=e[6];const g=f;let v;e[7]!==g||e[8]!==o||e[9]!==p||e[10]!==i?(v=function(D){!o||!i||p({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:i,appSlug:g,collectionName:"tools",itemId:encodeURIComponent(D)}})},e[7]=g,e[8]=o,e[9]=p,e[10]=i,e[11]=v):v=e[11];const b=v;let j;e[12]!==o||e[13]!==i||e[14]!==n?(j=o&&i&&n.some(ms),e[12]=o,e[13]=i,e[14]=n,e[15]=j):j=e[15];const N=j;if(n.length+l.length+x.length===0){let m;return e[16]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:"Capabilities"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"No capabilities discovered yet. The connection may still be connecting."})]}),e[16]=m):m=e[16],m}let C;e[17]!==n.length?(C=t.jsxs(ee,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=C):C=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]!==C||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:[C,y,I,_]})}),e[23]=C,e[24]=y,e[25]=k):k=e[25];let S;e[26]!==b||e[27]!==n?(S=n.length>0?n.map(m=>t.jsxs("button",{type:"button",className:"w-full flex items-start gap-3 px-5 py-3 text-left hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>b(m.name),children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx($t,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Te(m.name)}),m.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:m.description})]}),t.jsx(Ce,{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]=S):S=e[28];let h;e[29]!==S?(h=t.jsx(te,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:S})}),e[29]=S,e[30]=h):h=e[30];let w;e[31]!==o||e[32]!==N||e[33]!==i||e[34]!==n?(w=N&&t.jsx(te,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(as,{tools:n,connectionId:o,org:i})}),e[31]=o,e[32]=N,e[33]=i,e[34]=n,e[35]=w):w=e[35];let z;e[36]!==l?(z=l.length>0?l.map(ds):t.jsx(ie,{label:"prompts"}),e[36]=l,e[37]=z):z=e[37];let O;e[38]!==z?(O=t.jsx(te,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:z})}),e[38]=z,e[39]=O):O=e[39];let A;e[40]!==x?(A=x.length>0?x.map(cs):t.jsx(ie,{label:"resources"}),e[40]=x,e[41]=A):A=e[41];let M;e[42]!==A?(M=t.jsx(te,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:A})}),e[42]=A,e[43]=M):M=e[43];let U;return e[44]!==k||e[45]!==h||e[46]!==w||e[47]!==O||e[48]!==M?(U=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(At,{defaultValue:"tools",variant:"underline",children:[k,h,w,O,M]})}),e[44]=k,e[45]=h,e[46]=w,e[47]=O,e[48]=M,e[49]=U):U=e[49],U}function cs(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(lt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:s.name}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description}),s.uri&&t.jsx("div",{className:"text-xs text-muted-foreground/60 font-mono mt-0.5 truncate",children:s.uri})]})]},s.uri??s.name)}function ds(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(Dt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Te(s.name)}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description})]})]},s.name)}function ms(s){return re(s._meta)}function us(s){const e=P.c(13),{connection:n,displayTitle:a}=s,r=a??n.title;let o;e[0]!==n.icon||e[1]!==r?(o=t.jsx(oe,{icon:n.icon,name:r,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=r,e[2]=o):o=e[2];let i;e[3]!==r?(i=t.jsx("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:t.jsx("h1",{className:"text-lg md:text-xl font-semibold tracking-tight text-foreground leading-none",children:r})}),e[3]=r,e[4]=i):i=e[4];let c;e[5]!==n.description?(c=n.description&&t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed line-clamp-2",children:n.description}),e[5]=n.description,e[6]=c):c=e[6];let l;e[7]!==i||e[8]!==c?(l=t.jsxs("div",{className:"flex-1 min-w-0",children:[i,c]}),e[7]=i,e[8]=c,e[9]=l):l=e[9];let u;return e[10]!==o||e[11]!==l?(u=t.jsxs("div",{className:"flex items-center gap-4 md:gap-6 py-5 md:py-7 px-4 md:px-8 bg-background border-b border-border shrink-0",children:[o,l]}),e[10]=o,e[11]=l,e[12]=u):u=e[12],u}function xs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:a,onRemoveOAuth:r}){const o=ce({control:s.control,name:"ui_type"}),i=ce({control:s.control,name:"connection_url"}),{stdioEnabled:c}=Pe(),l=(()=>{if(typeof i!="string"||!i)return!1;try{const d=new URL(i);return d.hostname==="api.githubcopilot.com"&&d.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),u=c||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",p=x?Oe(e.connection_url):null;return x?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(we,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),p&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),t.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:t.jsx("code",{className:"text-sm text-muted-foreground",children:p})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(L,{control:s.control,name:"ui_type",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),o!=="NPX"&&o!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(me,{value:d.value,onValueChange:d.onChange,children:[t.jsx(E,{children:t.jsxs(ue,{className:"h-full! w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(se,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(xe,{})]})}),t.jsxs(pe,{children:[t.jsx(R,{value:"HTTP",children:"HTTP"}),t.jsx(R,{value:"SSE",children:"SSE"}),t.jsx(R,{value:"Websocket",children:"Websocket"}),u&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:"NPX Package"}),t.jsx(R,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(L,{control:s.control,name:"connection_url",render:({field:f})=>t.jsx(B,{className:"flex-1 min-w-0",children:t.jsx(E,{children:t.jsx(W,{placeholder:"https://example.com/mcp",...f,value:f.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(me,{value:d.value,onValueChange:d.onChange,children:[t.jsx(E,{children:t.jsx(ue,{className:"h-10",children:t.jsx(xe,{})})}),t.jsxs(pe,{children:[t.jsx(R,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(R,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(R,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"Websocket"]})}),u&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Lt,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(R,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ct,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(G,{})]})}),o==="NPX"&&t.jsx(L,{control:s.control,name:"npx_package",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(E,{children:t.jsx(W,{placeholder:"@perplexity-ai/mcp-server",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(G,{})]})}),o==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(L,{control:s.control,name:"stdio_command",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(E,{children:t.jsx(W,{placeholder:"node, bun, python...",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(G,{})]})}),t.jsx(L,{control:s.control,name:"stdio_args",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(E,{children:t.jsx(W,{placeholder:"arg1 arg2 --flag value",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(G,{})]})})]}),t.jsx(L,{control:s.control,name:"stdio_cwd",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(E,{children:t.jsx(W,{placeholder:"/path/to/project (optional)",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(G,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(L,{control:s.control,name:"env_vars",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(E,{children:t.jsx(Be,{value:d.value??[],onChange:d.onChange})}),t.jsx(G,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(L,{control:s.control,name:"connection_token",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:l?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(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(Mt,{variant:"success",className:"gap-1.5",children:[t.jsx(Ft,{size:12}),"Authenticated via OAuth",t.jsx(Rt,{size:12})]})})}),t.jsxs(Ut,{align:"start",children:[t.jsxs(de,{onClick:a,children:[t.jsx(dt,{size:16}),"Re-authenticate"]}),t.jsxs(de,{variant:"destructive",onClick:r,children:[t.jsx(ae,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&d.value===null?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>d.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(Bt,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(E,{children:t.jsx(W,{type:"password",placeholder:l?"Paste your GitHub PAT":"Enter access token...",...d,value:d.value||"",className:"h-10 rounded-lg"})}),l&&t.jsxs(ft,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(G,{})]})})]})}function ps(s){return s.command==="npx"}function hs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function fs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function he(s,e){const n={title:s.title,description:s.description??"",icon:s.icon??null,configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&Re(s.connection_headers)){const a=s.connection_headers,r=Ge(a.envVars);if(ps(a)){const i=hs(a);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:i,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const o=fs(a);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:o.command,stdio_args:o.args,stdio_cwd:o.cwd,env_vars:r}}return{...n,ui_type:s.connection_type,connection_url:s.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function gs(s){let e,n=null,a=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=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||"",a=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...a&&{connection_token:a},...r&&{connection_headers:r},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function js({connection:s,connectionId:e,org:n,isUpdating:a,tools:r,prompts:o,resources:i,siblings:c}){const l=Y({from:"/$org/settings/connections/$appSlug"}),u=Ve(),x=ye(),{org:p}=J(),d=jt({onSuccess:()=>{c.length<=1&&l({to:"/$org/settings/connections",params:{org:n}})}}),[f,g]=q.useState(null),[v,b]=q.useState(!1),j=be({connectionId:e}),{data:N}=Ye(),T=N?.data?.members??[],C=f??s,y=T.find(m=>m.userId===C.created_by),_=s?.connection_type==="VIRTUAL"||j.isAuthenticated,k={...s,tools:r},S=qe(k,Gt),h=Ue({resolver:Fe(He),values:he(f??s)}),w=h.formState.isDirty,z=async()=>{if(!await h.trigger())return;const D=h.getValues(),$=gs(D),F=f?.id??e;await x.update.mutateAsync({id:F,data:$}),h.reset(D)},O=()=>{h.reset(he(f??s))},A=async m=>{const{token:D,tokenInfo:$,error:F}=await ot({connectionId:m,orgSlug:p.slug,scope:"offline_access"});if(F||!D){X.error(`Authentication failed: ${F}`);return}if($)try{const K=await fetch(`/api/${p.slug}/connections/${m}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:$.accessToken,refreshToken:$.refreshToken,expiresIn:$.expiresIn,scope:$.scope,clientId:$.clientId,clientSecret:$.clientSecret,tokenEndpoint:$.tokenEndpoint})});if(!K.ok)console.error("Failed to save OAuth token:",await K.text()),await x.update.mutateAsync({id:m,data:{connection_token:D}});else try{await x.update.mutateAsync({id:m,data:{}})}catch(Z){console.warn("Failed to refresh connection tools after OAuth:",Z)}}catch(K){console.error("Error saving OAuth token:",K),await x.update.mutateAsync({id:m,data:{connection_token:D}})}else await x.update.mutateAsync({id:m,data:{connection_token:D}});const Q=new URL(`/api/${p.slug}/mcp/${m}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(Q.href,null)}),await u.invalidateQueries({queryKey:ne.mcpClientPrefix()}),X.success("Authentication successful")},M=()=>A(s.id),U=async()=>{try{const m=await fetch(`/api/${p.slug}/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!m.ok){const $=await m.text();X.error(`Failed to remove OAuth: ${$}`);return}const D=new URL(`/api/${p.slug}/mcp/${s.id}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(D.href,null)}),X.success("OAuth removed. You can now re-authenticate with a different account.")}catch(m){console.error("Error removing OAuth token:",m),X.error("Failed to remove OAuth")}};return t.jsxs(t.Fragment,{children:[t.jsx(vt,{...d}),t.jsx(mt,{open:f!==null,onOpenChange:m=>{m||g(null)},children:t.jsxs(ut,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(xt,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(pt,{className:"text-base",children:f?.title??s.title}),t.jsx(ht,{className:"text-xs",children:"Update URL, authentication, and other settings"}),y&&t.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Connected by"}),t.jsx(Ze,{url:y.user?.image??void 0,fallback:y.user?.name??y.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:y.user?.name||y.user?.email})]})]}),t.jsxs(gt,{...h,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:h.control,name:"title",render:({field:m})=>t.jsxs(B,{children:[t.jsx(H,{children:"Name"}),t.jsx(E,{children:t.jsx(W,{...m})}),t.jsx(G,{})]})}),t.jsx(L,{control:h.control,name:"description",render:({field:m})=>t.jsxs(B,{children:[t.jsx(H,{children:"Description"}),t.jsx(E,{children:t.jsx(W,{...m,value:m.value||""})}),t.jsx(G,{})]})})]}),t.jsx(xs,{form:h,connection:f??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:M,onRemoveOAuth:U}),t.jsx(Ke,{connection:f??s,form:h,hasMcpBinding:S,isMCPAuthenticated:_,supportsOAuth:j.supportsOAuth,isServerError:j.isServerError,onAuthenticate:M,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(V,{onClick:z,disabled:!w||a,className:"flex-1",children:a?"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=f??s;g(null),d.requestDelete(m)},children:[t.jsx(ae,{size:15}),"Delete"]})]})]},f?.id??s.id)]})}),t.jsx(Qe,{hideHeader:!0,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(us,{connection:s,displayTitle:(()=>{const m=c[0]??s;return m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.title})()}),t.jsx("div",{className:"flex-1 overflow-auto @container",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-2 gap-5 p-6",children:[t.jsx(ss,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(qt,{instances:c,onConfigure:m=>g(m),onAuthenticate:m=>A(m.id),onDelete:m=>d.requestDelete(m),onToggleStatus:async(m,D)=>{try{await x.update.mutateAsync({id:m.id,data:{status:D}}),X.success(D==="active"?"Connection enabled":"Connection disabled")}catch{X.error("Failed to update connection")}},isAdding:v,onAdd:async()=>{b(!0);try{const m=c[0]??s,D=m.title.replace(/\s*\(\d+\)\s*$/,""),$=c.length+1,F=`${D} (${$})`,Q=Le("conn");await x.create.mutateAsync({id:Q,title:F,description:m.description??null,connection_type:m.connection_type,connection_url:m.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:m.created_by,organization_id:m.organization_id,icon:m.icon??null,app_name:m.app_name??null,app_id:m.app_id??null,connection_headers:m.connection_headers??null,oauth_config:null,configuration_state:m.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const K=new URL(`/api/${p.slug}/mcp/${Q}`,window.location.origin),Z=await nt({url:K.href,token:null,orgId:p.id});Z.supportsOAuth&&!Z.isAuthenticated&&await A(Q)}finally{b(!1)}}}),t.jsx(is,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ls,{tools:r,prompts:o,resources:i,connectionId:e,org:n})})]})})]})})]})}function vs(){const s=P.c(39);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/settings/connections/$appSlug"},s[0]=e):e=s[0];const n=Y(e);let a;s[1]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/shell/$org/settings/connections/$appSlug"},s[1]=a):a=s[1];const{appSlug:r,org:o}=Me(a),{org:i}=J(),c=ye();let l;s[2]!==r?(l={slug:r},s[2]=r,s[3]=l):l=s[3];const u=et(l),x=u[0]??null,p=x?.id??"",d=p||null;let f;s[4]!==i.id||s[5]!==i.slug||s[6]!==d?(f={connectionId:d,orgId:i.id,orgSlug:i.slug},s[4]=i.id,s[5]=i.slug,s[6]=d,s[7]=f):f=s[7];const g=_e(f);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(Cs):(x?.tools??[]).map(Ss);e:{if(u.length<=1){j=A;break e}const M=new Set,U=[],m=ys;for(const D of u){const $=D.id===p?A:m(D.tools);for(const F of $)M.has(F.name)||(M.add(F.name),U.push(F))}j=U.length>0?U:A}s[10]=x?.tools,s[11]=p,s[12]=u,s[13]=b,s[14]=j}else j=s[14];const N=j;let T;s[15]!==g?(T={client:g},s[15]=g,s[16]=T):T=s[16];const{data:C}=st(T);let y;s[17]!==g?(y={client:g},s[17]=g,s[18]=y):y=s[18];const{data:I}=Ee(y);let _;s[19]!==C?.prompts?(_=C?.prompts??[],s[19]=C?.prompts,s[20]=_):_=s[20];let k;s[21]!==_?(k=_.map(Ns),s[21]=_,s[22]=k):k=s[22];const S=k;let h;s[23]!==I?.resources?(h=I?.resources??[],s[23]=I?.resources,s[24]=h):h=s[24];let w;s[25]!==h?(w=h.map(bs),s[25]=h,s[26]=w):w=s[26];const z=w;if(!x){let A;return s[27]!==n||s[28]!==o?(A=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(ve,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(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]!==c.update.isPending||s[31]!==N||s[32]!==x||s[33]!==p||s[34]!==o||s[35]!==S||s[36]!==z||s[37]!==u?(O=t.jsx(js,{org:o,connection:x,connectionId:p,isUpdating:c.update.isPending,tools:N,prompts:S,resources:z,siblings:u}),s[30]=c.update.isPending,s[31]=N,s[32]=x,s[33]=p,s[34]=o,s[35]=S,s[36]=z,s[37]=u,s[38]=O):O=s[38],O}function bs(s){return{name:s.name,description:s.description,uri:s.uri}}function Ns(s){return{name:s.name,description:s.description}}function ys(s){return(s??[]).map(_s)}function _s(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ss(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Cs(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ws(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ze,{children:t.jsx(q.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(ge,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(vs,{})})}),s[0]=e):e=s[0],e}function lo(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ws,{}),s[0]=e):e=s[0],e}export{lo as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as R,
|
|
1
|
+
import{o as R,aG as A,b8 as I,s as a,aE as j,aF as z,c as L,j as u,B as C}from"./index-CFiyU0D9.js";import{I as H}from"./input-BwRH-Gsz.js";import{s as W}from"./Plus-eGxBB1d8.js";import{s as q}from"./Trash01-ByxlxTiZ.js";const K=R({key:a().min(1,"Key is required"),value:a()}),M=R({title:a().min(1,"Name is required"),description:a().nullable().optional(),icon:a().nullable().optional(),ui_type:z(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:a().optional(),connection_token:a().nullable().optional(),npx_package:a().optional(),stdio_command:a().optional(),stdio_args:a().optional(),stdio_cwd:a().optional(),env_vars:j(K).optional(),configuration_scopes:j(a()).nullable().optional(),configuration_state:A(a(),I()).nullable().optional()}).refine(n=>n.ui_type==="NPX"?!!n.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(n=>n.ui_type==="STDIO"?!!n.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(n=>n.ui_type==="HTTP"||n.ui_type==="SSE"||n.ui_type==="Websocket"?!!n.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function $(n){const e=n.toLowerCase();return!!(["secret","password","passwd","credential","private","token","bearer","jwt","refresh","session","api_key","apikey","auth_key","access_key","secret_key","private_key","service_key","encryption_key","signing_key","license_key","auth","oauth","client_secret","app_secret","webhook","signing","signature","database_url","db_url","mongo_uri","redis_url","postgres_url","mysql_url","connection_string","dsn","service_role","anon_key","supabase_key","openai","anthropic","stripe","twilio","sendgrid","resend","firebase","sentry","datadog","newrelic","new_relic","pplx","replicate","pinecone","cohere","hugging","hf_token","gh_token","npm_token","certificate","cert","ssl","tls","encryption","salt","hash","hmac","personal_access","github_pat","gitlab_pat","bitbucket_pat"].some(s=>e.includes(s))||["sk_","rk_","whsec_","pk_live","sk_live"].some(s=>e.startsWith(s))||["_key","_secret","_token","_password","_auth","_pat"].some(s=>e.endsWith(s)))}function X(n){const e=L.c(34),{value:t,onChange:r,keyPlaceholder:o,valuePlaceholder:s,className:v}=n,m=o===void 0?"VARIABLE_NAME":o,_=s===void 0?"value...":s;let b;e[0]!==r||e[1]!==t?(b=()=>{r([...t,{key:"",value:""}])},e[0]=r,e[1]=t,e[2]=b):b=e[2];const S=b;let x;e[3]!==r||e[4]!==t?(x=l=>{r(t.filter((p,i)=>i!==l))},e[3]=r,e[4]=t,e[5]=x):x=e[5];const g=x;let P;e[6]!==r||e[7]!==t?(P=(l,p)=>{const i=[...t],c=i[l];c&&(i[l]={key:p,value:c.value},r(i))},e[6]=r,e[7]=t,e[8]=P):P=e[8];const y=P;let w;e[9]!==r||e[10]!==t?(w=(l,p)=>{const i=[...t],c=i[l];c&&(i[l]={key:c.key,value:p},r(i))},e[9]=r,e[10]=t,e[11]=w):w=e[11];const k=w;let d;if(e[12]!==y||e[13]!==g||e[14]!==k||e[15]!==m||e[16]!==t||e[17]!==_){let l;e[19]!==y||e[20]!==g||e[21]!==k||e[22]!==m||e[23]!==_?(l=(p,i)=>u.jsxs("div",{className:"flex gap-2 items-center",children:[u.jsx(H,{placeholder:m,value:p.key,onChange:c=>y(i,c.target.value),className:"h-10 rounded-lg flex-1 font-mono text-sm"}),u.jsx(H,{type:$(p.key)?"password":"text",placeholder:_,value:p.value,onChange:c=>k(i,c.target.value),className:"h-10 rounded-lg flex-1"}),u.jsx(C,{type:"button",variant:"ghost",size:"icon",className:"h-10 w-10 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>g(i),children:u.jsx(q,{size:16})})]},i),e[19]=y,e[20]=g,e[21]=k,e[22]=m,e[23]=_,e[24]=l):l=e[24],d=t.map(l),e[12]=y,e[13]=g,e[14]=k,e[15]=m,e[16]=t,e[17]=_,e[18]=d}else d=e[18];let T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=u.jsx(W,{size:16,className:"mr-1"}),e[25]=T):T=e[25];let f;e[26]!==S?(f=u.jsxs(C,{type:"button",variant:"outline",size:"sm",className:"w-full h-9 text-muted-foreground",onClick:S,children:[T,"Add Environment Variable"]}),e[26]=S,e[27]=f):f=e[27];let h;e[28]!==d||e[29]!==f?(h=u.jsxs("div",{className:"flex flex-col gap-2",children:[d,f]}),e[28]=d,e[29]=f,e[30]=h):h=e[30];let E;return e[31]!==v||e[32]!==h?(E=u.jsx("div",{className:v,children:h}),e[31]=v,e[32]=h,e[33]=E):E=e[33],E}function V(n){const e={};for(const{key:t,value:r}of n)t.trim()&&(e[t.trim()]=r);return e}function F(n){return n?Object.entries(n).map(([e,t])=>({key:e,value:t})):[]}function N(n){const e=n.trim();if(!e)return"";try{const t=new URL(e),r=t.pathname.length>1?t.pathname.replace(/\/+$/,""):t.pathname;return`${t.origin}${r}`}catch{return e.replace(/\/+$/,"")}}function D(n){const e=n.trim().split(/\s+/).filter(Boolean);if(e.length<2)return null;const t=e[0]?.toLowerCase();if(t!=="npx"&&t!=="bunx")return null;const o=e.slice(1).find(s=>!s.startsWith("-"));return o?{packageName:o}:null}function Y(n){const{uiType:e}=n,t=N(n.connectionUrl??"");if((e==="HTTP"||e==="SSE"||e==="Websocket")&&t===N("https://api.githubcopilot.com/mcp/"))return{id:"github",title:"GitHub",description:"GitHub Copilot MCP",token:{label:"GitHub PAT",placeholder:"github_pat_…",helperText:"Paste a GitHub Personal Access Token (PAT)"}};const r=(n.npxPackage??"").trim();return e==="NPX"&&r==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function J(n){if(n.registryItems.length===0||n.uiType!=="HTTP"&&n.uiType!=="SSE"&&n.uiType!=="Websocket")return null;const e=N(n.connectionUrl??"");if(!e)return null;const t=n.registryItems.find(s=>(s.server?.remotes??[]).some(m=>N(m.url??"")===e));if(!t)return null;const r=t.title||t.name||t.server?.title||t.server?.name||"",o=t.server?.description||t.description||t.summary||null;return r?{id:"registry",title:r,description:o}:null}function Q(n,e){const t={command:"npx",args:["-y",n]},r=V(e);return Object.keys(r).length>0&&(t.envVars=r),t}function Z(n,e,t,r){const o={command:n};e.trim()&&(o.args=e.trim().split(/\s+/)),t?.trim()&&(o.cwd=t.trim());const s=V(r);return Object.keys(s).length>0&&(o.envVars=s),o}export{X as E,J as a,Q as b,M as c,Z as d,Y as i,D as p,F as r};
|