decocms 2.302.5 → 2.302.6
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-C3v8uxQV.js → AlertCircle-DYsBkqgk.js} +1 -1
- package/dist/client/assets/{ArrowNarrowLeft-DqjvSsdH.js → ArrowNarrowLeft-f4NsG2u2.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-B0mRU26a.js → ArrowUpRight-0SvsPZ4w.js} +1 -1
- package/dist/client/assets/{CheckCircle-R_thqCxv.js → CheckCircle-CXidvOnE.js} +1 -1
- package/dist/client/assets/{ChevronDown-BIaDZcDn.js → ChevronDown-T3J_FVZJ.js} +1 -1
- package/dist/client/assets/{ChevronRight-Dd4hxp1D.js → ChevronRight-CAh53MYi.js} +1 -1
- package/dist/client/assets/{ChevronUp-CkYQx1Bj.js → ChevronUp-BB9elRBQ.js} +1 -1
- package/dist/client/assets/{Container-C9PcQlkh.js → Container-CzTl4K2T.js} +1 -1
- package/dist/client/assets/{DotsVertical-XchXO7Ol.js → DotsVertical-BzVzv-oX.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CeSFqmDM.js → LinkExternal01-w4yRWGwt.js} +1 -1
- package/dist/client/assets/{Lock01-Ct2davzl.js → Lock01-y59fY-pi.js} +1 -1
- package/dist/client/assets/{Palette-C-Uvqmxu.js → Palette-DHavAHjq.js} +1 -1
- package/dist/client/assets/{Play-BhfmXnEc.js → Play-iXdmlyAm.js} +1 -1
- package/dist/client/assets/{Plus-Cp0KPDXV.js → Plus-CxFWwhW1.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-DpQ0bWEr.js → RefreshCcw01-D9tZoyTd.js} +1 -1
- package/dist/client/assets/{SearchMd-CRDaIIAo.js → SearchMd-DESZBiw-.js} +1 -1
- package/dist/client/assets/{Settings02-o1SCp48r.js → Settings02-Hf6ZIRqV.js} +1 -1
- package/dist/client/assets/{Shield01-CIRxPwUL.js → Shield01-BoHQvnPl.js} +1 -1
- package/dist/client/assets/{Star01-CFSBtznF.js → Star01-DXGNUfAS.js} +1 -1
- package/dist/client/assets/{Sun-DRVshJ4h.js → Sun-27B3YKPV.js} +1 -1
- package/dist/client/assets/{Tool01-70GpeWbj.js → Tool01-_70cqt2t.js} +1 -1
- package/dist/client/assets/{Trash01-x0uVmxtV.js → Trash01-BFWH9msw.js} +1 -1
- package/dist/client/assets/{User01-CDjsPNWR.js → User01-Cn3EgXS1.js} +1 -1
- package/dist/client/assets/{Users03-D7_xGfRK.js → Users03-DQJCKjsg.js} +1 -1
- package/dist/client/assets/{X-Y9O2r61Y.js → X-D7XtWfgE.js} +1 -1
- package/dist/client/assets/{XCircle-Boh1wV2D.js → XCircle-C4cR7ffS.js} +1 -1
- package/dist/client/assets/{XClose-DrATv0fK.js → XClose-BIyC5w2n.js} +1 -1
- package/dist/client/assets/{Zap-DXZlejxD.js → Zap-5CNC0Ept.js} +1 -1
- package/dist/client/assets/{ZapSquare-TQyLEhYQ.js → ZapSquare-C5LgmBxA.js} +1 -1
- package/dist/client/assets/{accordion-kXMFpzvY.js → accordion-Cd97pZzi.js} +1 -1
- package/dist/client/assets/{agent-icon-BkXaC4dn.js → agent-icon-B9_saWOv.js} +1 -1
- package/dist/client/assets/{agents-list-BZs3KGTP.js → agents-list-BgyjjVf_.js} +1 -1
- package/dist/client/assets/ai-providers-DK0_8BYC.js +1 -0
- package/dist/client/assets/{alert-dialog-DE4JF7gT.js → alert-dialog-OujxhZeA.js} +1 -1
- package/dist/client/assets/{auth-catchall-BKOk33zi.js → auth-catchall-DjKppIi6.js} +1 -1
- package/dist/client/assets/{automation-list-row-C3Ff1asd.js → automation-list-row-DGv6wybK.js} +1 -1
- package/dist/client/assets/{automations-CSFxuEov.js → automations-BwhFPhC-.js} +1 -1
- package/dist/client/assets/{avatar-Cbdobq83.js → avatar-C_UGze8T.js} +1 -1
- package/dist/client/assets/{badge-DnIGvusX.js → badge-DpwrE1zH.js} +1 -1
- package/dist/client/assets/{brand-context-CK47iya3.js → brand-context-D4_qXiHY.js} +1 -1
- package/dist/client/assets/{card-BlDciy6y.js → card-B2FlHiSa.js} +1 -1
- package/dist/client/assets/{chat-context-BR7AKiVj.js → chat-context-BehWdIE_.js} +1 -1
- package/dist/client/assets/{checkbox-CbKyITB3.js → checkbox-ByEBQCLB.js} +1 -1
- package/dist/client/assets/{collection-detail-BE243KKe.js → collection-detail-BO6A-6D3.js} +1 -1
- package/dist/client/assets/{collection-display-button-Bs_toiw3.js → collection-display-button-Duh_PqWr.js} +1 -1
- package/dist/client/assets/{collection-search-Bok8ho3j.js → collection-search-B9TJgiJz.js} +1 -1
- package/dist/client/assets/{collection-search-CiijcwRe.js → collection-search-Buik536F.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-C0i-hx-e.js → collection-table-wrapper-E2fNxYM9.js} +1 -1
- package/dist/client/assets/{collection-tabs-DWkZe3wt.js → collection-tabs-BPN7Casr.js} +1 -1
- package/dist/client/assets/{collections-C5FoML4p.js → collections-nZFIaO7A.js} +1 -1
- package/dist/client/assets/{command-C2FQlATW.js → command-8r7A67dg.js} +1 -1
- package/dist/client/assets/{connection-card-DR63waj2.js → connection-card-B84kBAnY.js} +1 -1
- package/dist/client/assets/{connection-detail-C14Memac.js → connection-detail-T4cI2Rar.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-DUpdgqN2.js → connection-form-helpers-DXAccRFx.js} +1 -1
- package/dist/client/assets/{connections-v2-xkf44.js → connections-DdrV40z5.js} +1 -1
- package/dist/client/assets/{constants-b-g-bhUD.js → constants-DFyn79Ih.js} +1 -1
- package/dist/client/assets/{constants-Co3yHY4g.js → constants-DYjDD2hw.js} +1 -1
- package/dist/client/assets/{dialog-BShWtPYB.js → dialog-CmncC-6K.js} +1 -1
- package/dist/client/assets/{domain-settings-BaWkNlMc.js → domain-settings-CtzaIQej.js} +1 -1
- package/dist/client/assets/{drawer-BJU9NNnI.js → drawer-DGcXLXQn.js} +1 -1
- package/dist/client/assets/{dropdown-menu-DyF3EUCW.js → dropdown-menu-CDsPRIxB.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-Be4w7kRD.js → dynamic-plugin-layout-hLPoR_s6.js} +1 -1
- package/dist/client/assets/{empty-state-o2OLy2PY.js → empty-state-BoNuHRpQ.js} +1 -1
- package/dist/client/assets/{empty-state-C8lkMmnr.js → empty-state-Dy2IUdp3.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BCJ9z3jK.js → extract-connection-data-VJ13de98.js} +1 -1
- package/dist/client/assets/{features-DmpNxI8D.js → features-C9HfymjH.js} +1 -1
- package/dist/client/assets/{form-CU1xnDC1.js → form-D2IsM6ud.js} +1 -1
- package/dist/client/assets/{general-DtZ69dQj.js → general-DF9nKrr6.js} +1 -1
- package/dist/client/assets/{index-Dmp30UfO.js → index-BDWHZF4c.js} +2 -2
- package/dist/client/assets/{index-DdqDY9sX.js → index-BVSR2SFo.js} +1 -1
- package/dist/client/assets/{index-93vCrQRs.js → index-BXLSydrA.js} +1 -1
- package/dist/client/assets/{index-BD0s5h1x.js → index-BlJhA7rZ.js} +1 -1
- package/dist/client/assets/{index-BAqW6-1-.js → index-C9vZi4B1.js} +1 -1
- package/dist/client/assets/{index-Bbhlg2OG.js → index-CETKIyXW.js} +1 -1
- package/dist/client/assets/{index-D9VqK4wg.js → index-CT7XdYTs.js} +1 -1
- package/dist/client/assets/{index-BJDXTR0N.js → index-CWU3080-.js} +1 -1
- package/dist/client/assets/{index-BvvlryQB.js → index-CkKhKJfC.js} +1 -1
- package/dist/client/assets/index-D4C2QwcG.js +1 -0
- package/dist/client/assets/{index-YXlEtKoF.js → index-DEwSM5UO.js} +3 -3
- package/dist/client/assets/{index-CShtHeIs.js → index-DJ4-TGQU.js} +1 -1
- package/dist/client/assets/{index-DJzKiogP.js → index-DN6IuHkz.js} +1 -1
- package/dist/client/assets/{index-DYdxc4zk.js → index-DPbaB7jD.js} +1 -1
- package/dist/client/assets/{index-BkZrdPDM.js → index-FR3V6lrD.js} +1 -1
- package/dist/client/assets/{index-Dq0WJfNG.js → index-KELtbXYG.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-Bgu8I4E_.js → infiniteQueryObserver-DMzx8Ajh.js} +1 -1
- package/dist/client/assets/{input-DE5dVvtt.js → input-Bdzlyvmj.js} +1 -1
- package/dist/client/assets/{integration-icon-BSWYobpu.js → integration-icon-Cy5BK0qE.js} +1 -1
- package/dist/client/assets/{label-MyRBse_4.js → label-Bw2PIYCj.js} +1 -1
- package/dist/client/assets/{layout-Chu0ZeeD.js → layout-CYPmG5mO.js} +1 -1
- package/dist/client/assets/{lean-canvas-recruit-modal-CnPQVk8j.js → lean-canvas-recruit-modal-BT4juGyz.js} +1 -1
- package/dist/client/assets/{login-DgG8VVG-.js → login-B28e1Wyf.js} +1 -1
- package/dist/client/assets/{members-JZ8_eiTP.js → members-MaYKbIl8.js} +1 -1
- package/dist/client/assets/{monaco-editor-jevI2jI9.js → monaco-editor-B0DWqYLF.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-8Ez2tQeb.js → monitoring-stats-row-DH201TcG.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-okDQrh8X.js → oauth-callback-ai-provider-DNZYP_aS.js} +1 -1
- package/dist/client/assets/{oauth-callback-BO14tjoC.js → oauth-callback-sJETWziT.js} +1 -1
- package/dist/client/assets/{onboarding-B9YWKytA.js → onboarding-CarvRKmy.js} +1 -1
- package/dist/client/assets/{org-layout-CaA0XUBd.js → org-layout-DHW0VeFP.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-DgNjRY8f.js → org-plugin-layout-CXpJSkkf.js} +1 -1
- package/dist/client/assets/{pair-BuupCCmO.js → pair-OadcxUG9.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-Bgr-X4yK.js → plugin-empty-state-DesCuNpH.js} +1 -1
- package/dist/client/assets/{plugin-header-B7jqrzr6.js → plugin-header--6VZlO2H.js} +1 -1
- package/dist/client/assets/{plugin-layout-CgWUHRf6.js → plugin-layout-C9GSESK4.js} +1 -1
- package/dist/client/assets/{popover-zG7HhkCX.js → popover-BY5xAQmF.js} +1 -1
- package/dist/client/assets/{profile-gUcdx9gL.js → profile-BoZLpLkD.js} +1 -1
- package/dist/client/assets/{project-app-view-CTLBsma1.js → project-app-view-DzdWARcC.js} +1 -1
- package/dist/client/assets/registry-CR-1KhXP.js +2 -0
- package/dist/client/assets/{registry-layout-J29xLmfl.js → registry-layout-CdwMJvbZ.js} +1 -1
- package/dist/client/assets/{required-auth-layout-C8_RljYS.js → required-auth-layout-BDnZ49oa.js} +1 -1
- package/dist/client/assets/{reset-password-UcXKDRuV.js → reset-password-DUYGrA7L.js} +1 -1
- package/dist/client/assets/{roles-Dp_NwNIB.js → roles-Y85thY7n.js} +1 -1
- package/dist/client/assets/{scroll-area-CidaZG9N.js → scroll-area-qCxE2hon.js} +1 -1
- package/dist/client/assets/{search-input-DZHvtDyy.js → search-input-B5lcLg8G.js} +1 -1
- package/dist/client/assets/{select-DClDmbpQ.js → select-CPOZtPOm.js} +1 -1
- package/dist/client/assets/{select-model-BeD5k8y2.js → select-model-BtIjEXHL.js} +1 -1
- package/dist/client/assets/{settings-layout-DU93HHod.js → settings-layout-DLuUhrGj.js} +1 -1
- package/dist/client/assets/{settings-section-BTtNKAuG.js → settings-section-CjgR1v3b.js} +1 -1
- package/dist/client/assets/{shell-layout-BKNqqCpH.js → shell-layout-DSlnYQwS.js} +1 -1
- package/dist/client/assets/{skeleton-7XdQnZLr.js → skeleton-CIdd6LnB.js} +1 -1
- package/dist/client/assets/{sso-C2TaBJ_X.js → sso-7YErCYvk.js} +1 -1
- package/dist/client/assets/{store-CJBzqIhb.js → store-3uf30l0N.js} +1 -1
- package/dist/client/assets/store-registry-ClZqe9d2.js +2 -0
- package/dist/client/assets/{switch-BorShhPS.js → switch-BKqARx2z.js} +1 -1
- package/dist/client/assets/{table-CHej9oM7.js → table-DSnKB3WU.js} +1 -1
- package/dist/client/assets/{tabs-Dz2iGebN.js → tabs-BqvlcXR7.js} +1 -1
- package/dist/client/assets/{task-status-B0ESb4uD.js → task-status-CEH-hhyq.js} +1 -1
- package/dist/client/assets/{textarea-DyhzZ3a0.js → textarea-BDXFkTIX.js} +1 -1
- package/dist/client/assets/{toggle-group-BgXNE5eK.js → toggle-group-BNTZzdFS.js} +1 -1
- package/dist/client/assets/{tools-list-D_f871AE.js → tools-list-Dw6JwtIs.js} +1 -1
- package/dist/client/assets/{tooltip-CPTWAn4e.js → tooltip-_WWA2f_Q.js} +1 -1
- package/dist/client/assets/{types-DznggzE7.js → types-3fOwpBiV.js} +1 -1
- package/dist/client/assets/{use-ai-providers-CF-WEnpG.js → use-ai-providers-CeAjYVgE.js} +1 -1
- package/dist/client/assets/{use-collections-CgnneowC.js → use-collections-CsI9zuvk.js} +1 -1
- package/dist/client/assets/{use-connection-CXfm8X-F.js → use-connection-c2fdn_Q4.js} +1 -1
- package/dist/client/assets/{use-copy-CBLDGR3I.js → use-copy-CkKvvrYW.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-LChuERqV.js → use-create-virtual-mcp-DG6IAqew.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-BJdfGMiz.js → use-decopilot-events-BJCOOgAS.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CjzA3_5D.js → use-delete-connection-BjJoFZAR.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-DiAb3Px5.js → use-infinite-scroll-C1mLbaq7.js} +1 -1
- package/dist/client/assets/{use-list-state-DjI0vjHj.js → use-list-state-BIGugSjM.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DFoWakZ9.js → use-mcp-tools-CLk_EUg4.js} +1 -1
- package/dist/client/assets/{use-members-BRHKFgBf.js → use-members-C52huH1h.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-XCi2yYhB.js → use-navigate-to-agent-DY3jsv9_.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-3kBAJUD3.js → use-org-auth-client-Brlzufmt.js} +1 -1
- package/dist/client/assets/{use-org-sso-CcympP7K.js → use-org-sso-D0sdE_Rr.js} +1 -1
- package/dist/client/assets/{use-organization-roles-BVvoY3A5.js → use-organization-roles-CxDdUjnY.js} +1 -1
- package/dist/client/assets/{use-organization-settings-fzhI1sm5.js → use-organization-settings-qeGEmxxb.js} +1 -1
- package/dist/client/assets/{use-registry-connections-A44r5oEv.js → use-registry-connections-B3dA54zD.js} +1 -1
- package/dist/client/assets/{use-status-sounds-O9ew_8Ll.js → use-status-sounds-DyfabNoq.js} +1 -1
- package/dist/client/assets/{use-tasks-u-3hCZTJ.js → use-tasks-CalaAWsj.js} +1 -1
- package/dist/client/assets/{use-view-mode-DlaGUb5K.js → use-view-mode-J-pl-NFS.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-DCBMUq-0.js → use-virtual-mcp-Ci2IQchC.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-_4aHbhXJ.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-DEL5b49j.js +1 -0
- package/dist/client/assets/{user-CcjBPChW.js → user-BduM2bsi.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-DQvv5M2y.js → view-mode-toggle-CAxEHNjr.js} +1 -1
- package/dist/client/assets/{workflow-BCEkisit.js → workflow-B-q1l-SU.js} +1 -1
- package/dist/client/assets/workflow-detail-Jmd9Dc5X.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +3 -3
- package/dist/server/node_modules/ansi-styles/index.d.ts +236 -0
- package/dist/server/node_modules/ansi-styles/index.js +223 -0
- package/dist/server/node_modules/{slice-ansi → ansi-styles}/license +0 -1
- package/dist/server/node_modules/ansi-styles/package.json +54 -0
- package/dist/server/node_modules/ansi-styles/readme.md +173 -0
- package/dist/server/node_modules/cli-cursor/index.d.ts +47 -0
- package/dist/server/node_modules/cli-cursor/index.js +39 -0
- package/dist/server/node_modules/{ink → cli-cursor}/license +0 -1
- package/dist/server/node_modules/cli-cursor/package.json +49 -0
- package/dist/server/node_modules/cli-cursor/readme.md +51 -0
- package/dist/server/node_modules/environment/index.d.ts +74 -0
- package/dist/server/node_modules/environment/index.js +47 -0
- package/dist/server/node_modules/environment/license +9 -0
- package/dist/server/node_modules/environment/package.json +74 -0
- package/dist/server/node_modules/environment/readme.md +94 -0
- package/dist/server/node_modules/escape-string-regexp/index.d.ts +18 -0
- package/dist/server/node_modules/escape-string-regexp/index.js +11 -0
- package/dist/server/node_modules/escape-string-regexp/license +9 -0
- package/dist/server/node_modules/escape-string-regexp/package.json +43 -0
- package/dist/server/node_modules/escape-string-regexp/readme.md +29 -0
- package/dist/server/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
- package/dist/server/node_modules/is-fullwidth-code-point/index.js +12 -0
- package/dist/server/node_modules/is-fullwidth-code-point/license +9 -0
- package/dist/server/node_modules/is-fullwidth-code-point/package.json +53 -0
- package/dist/server/node_modules/is-fullwidth-code-point/readme.md +31 -0
- package/dist/server/node_modules/is-unicode-supported/index.d.ts +12 -0
- package/dist/server/node_modules/is-unicode-supported/index.js +21 -0
- package/dist/server/node_modules/is-unicode-supported/license +9 -0
- package/dist/server/node_modules/is-unicode-supported/package.json +47 -0
- package/dist/server/node_modules/is-unicode-supported/readme.md +35 -0
- package/dist/server/node_modules/postgres-array/index.d.ts +4 -0
- package/dist/server/node_modules/postgres-array/index.js +97 -0
- package/dist/server/node_modules/postgres-array/license +21 -0
- package/dist/server/node_modules/postgres-array/package.json +35 -0
- package/dist/server/node_modules/postgres-array/readme.md +43 -0
- package/dist/server/node_modules/restore-cursor/index.d.ts +11 -0
- package/dist/server/node_modules/restore-cursor/index.js +11 -0
- package/dist/server/node_modules/restore-cursor/license +9 -0
- package/dist/server/node_modules/restore-cursor/package.json +55 -0
- package/dist/server/node_modules/restore-cursor/readme.md +31 -0
- package/dist/server/node_modules/string-width/index.d.ts +39 -0
- package/dist/server/node_modules/string-width/index.js +82 -0
- package/dist/server/node_modules/string-width/license +9 -0
- package/dist/server/node_modules/string-width/package.json +64 -0
- package/dist/server/node_modules/string-width/readme.md +66 -0
- package/dist/server/server.js +2 -2
- package/package.json +1 -1
- package/dist/client/assets/ai-providers-BQ-gkNg2.js +0 -1
- package/dist/client/assets/index-GRM2kqyY.js +0 -1
- package/dist/client/assets/registry-B-92BzsA.js +0 -2
- package/dist/client/assets/store-registry-CumcxK5h.js +0 -2
- package/dist/client/assets/useInfiniteQuery-BIyHVMaV.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CxgNWHmG.js +0 -1
- package/dist/client/assets/workflow-detail-BBy3s-Vk.js +0 -1
- package/dist/server/node_modules/ink/build/ansi-tokenizer.d.ts +0 -38
- package/dist/server/node_modules/ink/build/ansi-tokenizer.js +0 -316
- package/dist/server/node_modules/ink/build/ansi-tokenizer.js.map +0 -1
- package/dist/server/node_modules/ink/build/apply-styles.js +0 -175
- package/dist/server/node_modules/ink/build/build-layout.js +0 -77
- package/dist/server/node_modules/ink/build/calculate-wrapped-text.js +0 -53
- package/dist/server/node_modules/ink/build/colorize.d.ts +0 -3
- package/dist/server/node_modules/ink/build/colorize.js +0 -48
- package/dist/server/node_modules/ink/build/colorize.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/AccessibilityContext.d.ts +0 -3
- package/dist/server/node_modules/ink/build/components/AccessibilityContext.js +0 -5
- package/dist/server/node_modules/ink/build/components/AccessibilityContext.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/App.d.ts +0 -18
- package/dist/server/node_modules/ink/build/components/App.js +0 -351
- package/dist/server/node_modules/ink/build/components/App.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/AppContext.d.ts +0 -15
- package/dist/server/node_modules/ink/build/components/AppContext.js +0 -11
- package/dist/server/node_modules/ink/build/components/AppContext.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/BackgroundContext.d.ts +0 -4
- package/dist/server/node_modules/ink/build/components/BackgroundContext.js +0 -3
- package/dist/server/node_modules/ink/build/components/BackgroundContext.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/Box.d.ts +0 -117
- package/dist/server/node_modules/ink/build/components/Box.js +0 -34
- package/dist/server/node_modules/ink/build/components/Box.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/Color.js +0 -62
- package/dist/server/node_modules/ink/build/components/Cursor.d.ts +0 -83
- package/dist/server/node_modules/ink/build/components/Cursor.js +0 -53
- package/dist/server/node_modules/ink/build/components/Cursor.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/CursorContext.d.ts +0 -11
- package/dist/server/node_modules/ink/build/components/CursorContext.js +0 -8
- package/dist/server/node_modules/ink/build/components/CursorContext.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/ErrorBoundary.d.ts +0 -18
- package/dist/server/node_modules/ink/build/components/ErrorBoundary.js +0 -23
- package/dist/server/node_modules/ink/build/components/ErrorBoundary.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/ErrorOverview.d.ts +0 -6
- package/dist/server/node_modules/ink/build/components/ErrorOverview.js +0 -84
- package/dist/server/node_modules/ink/build/components/ErrorOverview.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/FocusContext.d.ts +0 -16
- package/dist/server/node_modules/ink/build/components/FocusContext.js +0 -17
- package/dist/server/node_modules/ink/build/components/FocusContext.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/Newline.d.ts +0 -13
- package/dist/server/node_modules/ink/build/components/Newline.js +0 -8
- package/dist/server/node_modules/ink/build/components/Newline.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/Spacer.d.ts +0 -7
- package/dist/server/node_modules/ink/build/components/Spacer.js +0 -11
- package/dist/server/node_modules/ink/build/components/Spacer.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/Static.d.ts +0 -24
- package/dist/server/node_modules/ink/build/components/Static.js +0 -28
- package/dist/server/node_modules/ink/build/components/Static.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/StderrContext.d.ts +0 -15
- package/dist/server/node_modules/ink/build/components/StderrContext.js +0 -13
- package/dist/server/node_modules/ink/build/components/StderrContext.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/StdinContext.d.ts +0 -22
- package/dist/server/node_modules/ink/build/components/StdinContext.js +0 -19
- package/dist/server/node_modules/ink/build/components/StdinContext.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/StdoutContext.d.ts +0 -15
- package/dist/server/node_modules/ink/build/components/StdoutContext.js +0 -13
- package/dist/server/node_modules/ink/build/components/StdoutContext.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/Text.d.ts +0 -55
- package/dist/server/node_modules/ink/build/components/Text.js +0 -50
- package/dist/server/node_modules/ink/build/components/Text.js.map +0 -1
- package/dist/server/node_modules/ink/build/components/Transform.d.ts +0 -16
- package/dist/server/node_modules/ink/build/components/Transform.js +0 -15
- package/dist/server/node_modules/ink/build/components/Transform.js.map +0 -1
- package/dist/server/node_modules/ink/build/cursor-helpers.d.ts +0 -38
- package/dist/server/node_modules/ink/build/cursor-helpers.js +0 -56
- package/dist/server/node_modules/ink/build/cursor-helpers.js.map +0 -1
- package/dist/server/node_modules/ink/build/devtools-window-polyfill.d.ts +0 -1
- package/dist/server/node_modules/ink/build/devtools-window-polyfill.js +0 -65
- package/dist/server/node_modules/ink/build/devtools-window-polyfill.js.map +0 -1
- package/dist/server/node_modules/ink/build/devtools.d.ts +0 -1
- package/dist/server/node_modules/ink/build/devtools.js +0 -11
- package/dist/server/node_modules/ink/build/devtools.js.map +0 -1
- package/dist/server/node_modules/ink/build/dom.d.ts +0 -56
- package/dist/server/node_modules/ink/build/dom.js +0 -124
- package/dist/server/node_modules/ink/build/dom.js.map +0 -1
- package/dist/server/node_modules/ink/build/experimental/apply-style.js +0 -140
- package/dist/server/node_modules/ink/build/experimental/dom.js +0 -123
- package/dist/server/node_modules/ink/build/experimental/output.js +0 -91
- package/dist/server/node_modules/ink/build/experimental/reconciler.js +0 -141
- package/dist/server/node_modules/ink/build/experimental/renderer.js +0 -81
- package/dist/server/node_modules/ink/build/get-max-width.d.ts +0 -3
- package/dist/server/node_modules/ink/build/get-max-width.js +0 -10
- package/dist/server/node_modules/ink/build/get-max-width.js.map +0 -1
- package/dist/server/node_modules/ink/build/hooks/use-app.d.ts +0 -5
- package/dist/server/node_modules/ink/build/hooks/use-app.js +0 -8
- package/dist/server/node_modules/ink/build/hooks/use-app.js.map +0 -1
- package/dist/server/node_modules/ink/build/hooks/use-cursor.d.ts +0 -12
- package/dist/server/node_modules/ink/build/hooks/use-cursor.js +0 -29
- package/dist/server/node_modules/ink/build/hooks/use-cursor.js.map +0 -1
- package/dist/server/node_modules/ink/build/hooks/use-focus-manager.d.ts +0 -28
- package/dist/server/node_modules/ink/build/hooks/use-focus-manager.js +0 -17
- package/dist/server/node_modules/ink/build/hooks/use-focus-manager.js.map +0 -1
- package/dist/server/node_modules/ink/build/hooks/use-focus.d.ts +0 -29
- package/dist/server/node_modules/ink/build/hooks/use-focus.js +0 -42
- package/dist/server/node_modules/ink/build/hooks/use-focus.js.map +0 -1
- package/dist/server/node_modules/ink/build/hooks/use-input.d.ts +0 -131
- package/dist/server/node_modules/ink/build/hooks/use-input.js +0 -124
- package/dist/server/node_modules/ink/build/hooks/use-input.js.map +0 -1
- package/dist/server/node_modules/ink/build/hooks/use-is-screen-reader-enabled.d.ts +0 -5
- package/dist/server/node_modules/ink/build/hooks/use-is-screen-reader-enabled.js +0 -11
- package/dist/server/node_modules/ink/build/hooks/use-is-screen-reader-enabled.js.map +0 -1
- package/dist/server/node_modules/ink/build/hooks/use-stderr.d.ts +0 -5
- package/dist/server/node_modules/ink/build/hooks/use-stderr.js +0 -8
- package/dist/server/node_modules/ink/build/hooks/use-stderr.js.map +0 -1
- package/dist/server/node_modules/ink/build/hooks/use-stdin.d.ts +0 -5
- package/dist/server/node_modules/ink/build/hooks/use-stdin.js +0 -8
- package/dist/server/node_modules/ink/build/hooks/use-stdin.js.map +0 -1
- package/dist/server/node_modules/ink/build/hooks/use-stdout.d.ts +0 -5
- package/dist/server/node_modules/ink/build/hooks/use-stdout.js +0 -8
- package/dist/server/node_modules/ink/build/hooks/use-stdout.js.map +0 -1
- package/dist/server/node_modules/ink/build/hooks/useInput.js +0 -38
- package/dist/server/node_modules/ink/build/index.d.ts +0 -34
- package/dist/server/node_modules/ink/build/index.js +0 -20
- package/dist/server/node_modules/ink/build/index.js.map +0 -1
- package/dist/server/node_modules/ink/build/ink.d.ts +0 -90
- package/dist/server/node_modules/ink/build/ink.js +0 -637
- package/dist/server/node_modules/ink/build/ink.js.map +0 -1
- package/dist/server/node_modules/ink/build/input-parser.d.ts +0 -7
- package/dist/server/node_modules/ink/build/input-parser.js +0 -154
- package/dist/server/node_modules/ink/build/input-parser.js.map +0 -1
- package/dist/server/node_modules/ink/build/instance.js +0 -205
- package/dist/server/node_modules/ink/build/instances.d.ts +0 -3
- package/dist/server/node_modules/ink/build/instances.js +0 -8
- package/dist/server/node_modules/ink/build/instances.js.map +0 -1
- package/dist/server/node_modules/ink/build/kitty-keyboard.d.ts +0 -23
- package/dist/server/node_modules/ink/build/kitty-keyboard.js +0 -32
- package/dist/server/node_modules/ink/build/kitty-keyboard.js.map +0 -1
- package/dist/server/node_modules/ink/build/layout.d.ts +0 -7
- package/dist/server/node_modules/ink/build/layout.js +0 -33
- package/dist/server/node_modules/ink/build/layout.js.map +0 -1
- package/dist/server/node_modules/ink/build/log-update.d.ts +0 -19
- package/dist/server/node_modules/ink/build/log-update.js +0 -242
- package/dist/server/node_modules/ink/build/log-update.js.map +0 -1
- package/dist/server/node_modules/ink/build/measure-element.d.ts +0 -16
- package/dist/server/node_modules/ink/build/measure-element.js +0 -9
- package/dist/server/node_modules/ink/build/measure-element.js.map +0 -1
- package/dist/server/node_modules/ink/build/measure-text.d.ts +0 -6
- package/dist/server/node_modules/ink/build/measure-text.js +0 -21
- package/dist/server/node_modules/ink/build/measure-text.js.map +0 -1
- package/dist/server/node_modules/ink/build/options.d.ts +0 -52
- package/dist/server/node_modules/ink/build/options.js +0 -2
- package/dist/server/node_modules/ink/build/options.js.map +0 -1
- package/dist/server/node_modules/ink/build/output.d.ts +0 -35
- package/dist/server/node_modules/ink/build/output.js +0 -183
- package/dist/server/node_modules/ink/build/output.js.map +0 -1
- package/dist/server/node_modules/ink/build/parse-keypress.d.ts +0 -22
- package/dist/server/node_modules/ink/build/parse-keypress.js +0 -493
- package/dist/server/node_modules/ink/build/parse-keypress.js.map +0 -1
- package/dist/server/node_modules/ink/build/reconciler.d.ts +0 -4
- package/dist/server/node_modules/ink/build/reconciler.js +0 -274
- package/dist/server/node_modules/ink/build/reconciler.js.map +0 -1
- package/dist/server/node_modules/ink/build/render-background.d.ts +0 -4
- package/dist/server/node_modules/ink/build/render-background.js +0 -25
- package/dist/server/node_modules/ink/build/render-background.js.map +0 -1
- package/dist/server/node_modules/ink/build/render-border.d.ts +0 -4
- package/dist/server/node_modules/ink/build/render-border.js +0 -73
- package/dist/server/node_modules/ink/build/render-border.js.map +0 -1
- package/dist/server/node_modules/ink/build/render-node-to-output.d.ts +0 -14
- package/dist/server/node_modules/ink/build/render-node-to-output.js +0 -147
- package/dist/server/node_modules/ink/build/render-node-to-output.js.map +0 -1
- package/dist/server/node_modules/ink/build/render-to-string.d.ts +0 -38
- package/dist/server/node_modules/ink/build/render-to-string.js +0 -115
- package/dist/server/node_modules/ink/build/render-to-string.js.map +0 -1
- package/dist/server/node_modules/ink/build/render.d.ts +0 -121
- package/dist/server/node_modules/ink/build/render.js +0 -55
- package/dist/server/node_modules/ink/build/render.js.map +0 -1
- package/dist/server/node_modules/ink/build/renderer.d.ts +0 -8
- package/dist/server/node_modules/ink/build/renderer.js +0 -55
- package/dist/server/node_modules/ink/build/renderer.js.map +0 -1
- package/dist/server/node_modules/ink/build/sanitize-ansi.d.ts +0 -2
- package/dist/server/node_modules/ink/build/sanitize-ansi.js +0 -27
- package/dist/server/node_modules/ink/build/sanitize-ansi.js.map +0 -1
- package/dist/server/node_modules/ink/build/screen-reader-update.d.ts +0 -13
- package/dist/server/node_modules/ink/build/screen-reader-update.js +0 -38
- package/dist/server/node_modules/ink/build/screen-reader-update.js.map +0 -1
- package/dist/server/node_modules/ink/build/squash-text-nodes.d.ts +0 -3
- package/dist/server/node_modules/ink/build/squash-text-nodes.js +0 -36
- package/dist/server/node_modules/ink/build/squash-text-nodes.js.map +0 -1
- package/dist/server/node_modules/ink/build/styles.d.ts +0 -240
- package/dist/server/node_modules/ink/build/styles.js +0 -232
- package/dist/server/node_modules/ink/build/styles.js.map +0 -1
- package/dist/server/node_modules/ink/build/utils.d.ts +0 -2
- package/dist/server/node_modules/ink/build/utils.js +0 -4
- package/dist/server/node_modules/ink/build/utils.js.map +0 -1
- package/dist/server/node_modules/ink/build/wrap-text.d.ts +0 -3
- package/dist/server/node_modules/ink/build/wrap-text.js +0 -31
- package/dist/server/node_modules/ink/build/wrap-text.js.map +0 -1
- package/dist/server/node_modules/ink/build/write-synchronized.d.ts +0 -4
- package/dist/server/node_modules/ink/build/write-synchronized.js +0 -7
- package/dist/server/node_modules/ink/build/write-synchronized.js.map +0 -1
- package/dist/server/node_modules/ink/package.json +0 -201
- package/dist/server/node_modules/ink/readme.md +0 -2636
- package/dist/server/node_modules/slice-ansi/index.d.ts +0 -19
- package/dist/server/node_modules/slice-ansi/index.js +0 -260
- package/dist/server/node_modules/slice-ansi/package.json +0 -59
- package/dist/server/node_modules/slice-ansi/readme.md +0 -54
- package/dist/server/node_modules/slice-ansi/tokenize-ansi.js +0 -752
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-app-view-
|
|
2
|
-
import{o as Wt,r as A,p as Tl,q as Rl,e as q,s as xe,K as As,n as Vo,a as Ko,c as te,j as o,l as Ie,B as se,E as es,b as Ci,v as ai,f as At,d as Qr,w as Dl,x as _e,y as Ml,V as Il,t as we,z as qo,C as Al,D as Jt,F as Bl,G as Sn,L as Pl,H as Oi,I as Zs,J as ct,M as Go,P as Ll,_ as Ol,Q as Yo,R as Xo,T as zl,g as $l}from"./index-Dmp30UfO.js";import{C as Ee,u as Fl,w as Hl,A as Wl,T as Ul,a as Vl}from"./index-Dq0WJfNG.js";import{I as ds}from"./integration-icon-BSWYobpu.js";import{S as Bt,u as He,g as Jo,a as Zo}from"./constants-b-g-bhUD.js";import{u as yt,a as Kl}from"./use-virtual-mcp-DCBMUq-0.js";import{a as ql}from"./Users03-D7_xGfRK.js";import{u as Qo,a as lt,b as ki,c as Ni,t as Gl,d as yn}from"./chat-context-BR7AKiVj.js";import{i as Bs}from"./AlertCircle-C3v8uxQV.js";import{i as Yl}from"./CheckCircle-R_thqCxv.js";import{n as wn,a as Xl}from"./ZapSquare-TQyLEhYQ.js";import{i as Jl,a as Zl,b as Ql,c as ji,d as ec}from"./XCircle-Boh1wV2D.js";import{s as ls,i as tc}from"./XClose-DrATv0fK.js";import{c as sc,r as ic,p as ea,f as Cn,a as rc,F as nc,t as kn,M as en,G as ta,L as oc,i as ac,b as lc,d as cc,e as hc}from"./pair-BuupCCmO.js";import{C as dc,a as Nn,b as jn,c as uc,d as fc,e as mc,f as _c}from"./command-C2FQlATW.js";import{P as Hs,a as Ws,b as Us}from"./popover-zG7HhkCX.js";import{i as Ts,a as pi,b as pc,c as gc,p as Ei,g as Ti,d as tn,e as sa,h as dr,f as zi,j as En,A as Tn,k as ia,l as vc,m as xc,n as bc,t as Sc,o as yc,q as ra,r as na,s as oa,u as aa,v as Rn,w as wc,x as Rs,y as Cc,z as kc,B as Nc,C as la}from"./agent-icon-BkXaC4dn.js";import{u as us,a as jc}from"./use-mcp-tools-DFoWakZ9.js";import{u as Ec,a as Tc}from"./use-ai-providers-CF-WEnpG.js";import{g as Ut,c as Dn,u as Rc,b as ur,d as Dc,e as Mc,f as Ic,T as Ac}from"./index-BkZrdPDM.js";import{u as sn,i as Bc}from"./shell-layout-BKNqqCpH.js";import{i as Pc,P as at,u as Lc,c as Oc,d as zc,e as $c}from"./index-DdqDY9sX.js";import{u as ca,T as Ke,a as qe,b as Ge,c as Fc}from"./tooltip-CPTWAn4e.js";import{u as Hc}from"./use-status-sounds-O9ew_8Ll.js";import{E as Ps}from"./empty-state-o2OLy2PY.js";import{A as Wc,a as Uc,b as Vc,c as Kc,R as ha,d as qc,e as Gc}from"./accordion-kXMFpzvY.js";import{u as Ri,a as rn,b as Yc}from"./use-connection-CXfm8X-F.js";import{g as Xc}from"./constants-Co3yHY4g.js";import{u as Jc,g as Zc}from"./types-DznggzE7.js";import{U as da}from"./user-CcjBPChW.js";import{T as Qc,u as ua}from"./tools-list-D_f871AE.js";import{u as $i}from"./unwrap-tool-result-BYXdCQMg.js";import{s as fa,g as eh}from"./connection-slug-eyAPH6o3.js";import{A as ma,a as _a,b as pa,c as ga,d as va,e as xa,f as ba,g as Sa}from"./alert-dialog-DE4JF7gT.js";import{D as th,a as nn,b as on,c as ya,d as wa}from"./dialog-BShWtPYB.js";import{C as sh,a as Mn}from"./card-BlDciy6y.js";import{I as fs}from"./input-DE5dVvtt.js";import{L as Ds}from"./label-MyRBse_4.js";import{S as ts,a as ss,b as is,c as rs,d as It}from"./select-DClDmbpQ.js";import{S as fr}from"./switch-BorShhPS.js";import{T as In}from"./textarea-DyhzZ3a0.js";import{i as li}from"./Play-BhfmXnEc.js";import{s as cs}from"./Plus-Cp0KPDXV.js";import{a as ih}from"./Settings02-o1SCp48r.js";import{t as Ca}from"./Tool01-70GpeWbj.js";import{s as mr}from"./Trash01-x0uVmxtV.js";import{S as ka}from"./scroll-area-CidaZG9N.js";import{i as Na,a as rh}from"./SearchMd-CRDaIIAo.js";import{C as nh}from"./collection-tabs-DWkZe3wt.js";import{C as oh}from"./checkbox-CbKyITB3.js";import{u as ah,T as Fi,a as lh,b as ch,c as Hi}from"./tabs-Dz2iGebN.js";import{D as hh,a as dh,b as uh}from"./drawer-BJU9NNnI.js";import{i as Di,t as _r}from"./ChevronDown-BIaDZcDn.js";import{n as Vt}from"./LinkExternal01-CeSFqmDM.js";import{S as fh}from"./index-DYdxc4zk.js";import{D as ns,a as os,b as as,c as St,d as mh,e as _h,f as ph}from"./dropdown-menu-DyF3EUCW.js";import{i as ja}from"./RefreshCcw01-DpQ0bWEr.js";import{V as gh}from"./view-mode-toggle-DQvv5M2y.js";import{G as vh}from"./lean-canvas-recruit-modal-CnPQVk8j.js";import{M as xh}from"./select-model-BeD5k8y2.js";import{u as Vs,a as bh,b as Sh,c as yh,A as wh,d as Ch}from"./automation-list-row-C3Ff1asd.js";import{i as Ls}from"./Zap-DXZlejxD.js";import{S as kh}from"./search-input-DZHvtDyy.js";import"./use-navigate-to-agent-XCi2yYhB.js";import"./use-tasks-u-3hCZTJ.js";import"./use-collections-CgnneowC.js";import"./collection-search-CiijcwRe.js";import"./form-CU1xnDC1.js";import"./Star01-CFSBtznF.js";import"./Lock01-Ct2davzl.js";import"./X-Y9O2r61Y.js";import"./toggle-group-BgXNE5eK.js";import"./index-Bbhlg2OG.js";import"./question-004-sINsf4GQ.js";import"./ai-providers-logos-DD3qZ33J.js";import"./connection-card-DR63waj2.js";import"./use-registry-connections-A44r5oEv.js";import"./use-organization-settings-fzhI1sm5.js";import"./useInfiniteQuery-BIyHVMaV.js";import"./infiniteQueryObserver-Bgu8I4E_.js";import"./extract-connection-data-BCJ9z3jK.js";import"./Container-C9PcQlkh.js";import"./connection-form-helpers-DUpdgqN2.js";import"./use-infinite-scroll-DiAb3Px5.js";import"./useSuspenseInfiniteQuery-CxgNWHmG.js";import"./badge-DnIGvusX.js";import"./ChevronRight-Dd4hxp1D.js";import"./use-decopilot-events-BJdfGMiz.js";import"./create-sse-subscription-CxkOgzKf.js";import"./use-copy-CBLDGR3I.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./content-blocks-o63cs2vh.js";import"./Sun-DRVshJ4h.js";import"./index-CShtHeIs.js";import"./ArrowNarrowLeft-DqjvSsdH.js";import"./ArrowUpRight-B0mRU26a.js";import"./ChevronUp-CkYQx1Bj.js";import"./DotsVertical-XchXO7Ol.js";import"./Palette-C-Uvqmxu.js";import"./Shield01-CIRxPwUL.js";import"./User01-CDjsPNWR.js";import"./skeleton-7XdQnZLr.js";import"./avatar-Cbdobq83.js";import"./index-BJDXTR0N.js";import"./collection-search-Bok8ho3j.js";import"./use-create-virtual-mcp-LChuERqV.js";import"./task-status-B0ESb4uD.js";import"./required-auth-layout-C8_RljYS.js";import"./use-org-sso-CcympP7K.js";import"./collections-C5FoML4p.js";import"./settings-section-BTtNKAuG.js";import"./formatDistanceToNow-Cb2QZZJn.js";function Nh(t,e){const s=Wt(e);return jh({filters:{...t,status:"pending"}},s).length}function An(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function jh(t={},e){const s=Wt(e).getMutationCache(),i=A.useRef(t),r=A.useRef(null);return r.current===null&&(r.current=An(s,t)),A.useEffect(()=>{i.current=t}),A.useSyncExternalStore(A.useCallback(n=>s.subscribe(()=>{const a=Tl(r.current,An(s,i.current));r.current!==a&&(r.current=a,Rl.schedule(n))}),[s]),()=>r.current,()=>r.current)}function Eh(t,e){const s=q.c(40),{org:i,locator:r}=xe();let n;s[0]!==i.id||s[1]!==i.slug?(n={connectionId:Bt,orgId:i.id,orgSlug:i.slug},s[0]=i.id,s[1]=i.slug,s[2]=n):n=s[2];const a=He(n),l=Wt();let h;s[3]!==t||s[4]!==i.id?(h=As.ensureTask(i.id,t),s[3]=t,s[4]=i.id,s[5]=h):h=s[5];let c;s[6]!==a||s[7]!==t?(c=async()=>(await a.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}})).structuredContent?.item??null,s[6]=a,s[7]=t,s[8]=c):c=s[8];const u=t.length>0;let d;s[9]!==h||s[10]!==c||s[11]!==u?(d={queryKey:h,queryFn:c,enabled:u,retry:!1,refetchOnWindowFocus:!1},s[9]=h,s[10]=c,s[11]=u,s[12]=d):d=s[12];const m=Vo(d);let _;s[13]!==a||s[14]!==e?(_=async x=>{const y=await a.callTool({name:"COLLECTION_THREADS_CREATE",arguments:{data:{id:x,virtual_mcp_id:e}}});if(y.isError){const w=y.content,N=Array.isArray(w)&&w[0]&&typeof w[0]=="object"?w[0].text??"Create failed":"Create failed";throw new Error(N)}return y.structuredContent.item},s[13]=a,s[14]=e,s[15]=_):_=s[15];let f;s[16]!==r||s[17]!==i.id||s[18]!==m||s[19]!==l?(f=()=>{l.invalidateQueries({predicate:x=>x.queryKey[1]===i.id&&x.queryKey[3]==="collection"&&x.queryKey[4]==="THREADS"}),l.invalidateQueries({queryKey:As.tasksPrefix(r)}),m.refetch()},s[16]=r,s[17]=i.id,s[18]=m,s[19]=l,s[20]=f):f=s[20];let p;s[21]!==_||s[22]!==f?(p={mutationFn:_,onSuccess:f},s[21]=_,s[22]=f,s[23]=p):p=s[23];const g=Ko(p);let v,b;if(s[24]!==g||s[25]!==t||s[26]!==m.data||s[27]!==m.isSuccess?(v=()=>{t&&(!m.isSuccess||m.data||g.isPending||g.variables!==t&&g.mutate(t))},b=[t,m.isSuccess,m.data,g],s[24]=g,s[25]=t,s[26]=m.data,s[27]=m.isSuccess,s[28]=v,s[29]=b):(v=s[28],b=s[29]),A.useEffect(v,b),!t){let x;return s[30]===Symbol.for("react.memo_cache_sentinel")?(x={status:"ready",task:null},s[30]=x):x=s[30],x}if(m.isLoading){let x;return s[31]===Symbol.for("react.memo_cache_sentinel")?(x={status:"loading"},s[31]=x):x=s[31],x}if(m.isError){const x=m.error;let y;return s[32]!==x?(y={status:"error",error:x},s[32]=x,s[33]=y):y=s[33],y}if(m.isSuccess&&m.data){let x;return s[34]!==m.data?(x={status:"ready",task:m.data},s[34]=m.data,s[35]=x):x=s[35],x}if(g.isPending||m.isSuccess&&!m.data){let x;return s[36]===Symbol.for("react.memo_cache_sentinel")?(x={status:"creating"},s[36]=x):x=s[36],x}if(g.isError){let x;return s[37]!==g.error?(x={status:"error",error:g.error},s[37]=g.error,s[38]=x):x=s[38],x}let S;return s[39]===Symbol.for("react.memo_cache_sentinel")?(S={status:"loading"},s[39]=S):S=s[39],S}function gs(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Bn(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function Th(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function Rh(t){const e=q.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(Dh),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==i?(r=o.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:i}),e[2]=i,e[3]=r):r=e[3],r}function Dh(t){return o.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[o.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),o.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function Mh(t){const e=q.c(30),{userTokens:s,assistantTokens:i,otherTokens:r}=t,n=s+i+r,a=n>0?s/n*100:0,l=n>0?i/n*100:0,h=n>0?r/n*100:0;let c;e[0]!==a?(c=a>0&&o.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=c):c=e[1];let u;e[2]!==l?(u=l>0&&o.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=u):u=e[3];let d;e[4]!==h?(d=h>0&&o.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${h}%`}}),e[4]=h,e[5]=d):d=e[5];let m;e[6]!==c||e[7]!==u||e[8]!==d?(m=o.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[c,u,d]}),e[6]=c,e[7]=u,e[8]=d,e[9]=m):m=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=_):_=e[10];let f;e[11]!==a?(f=a.toFixed(1),e[11]=a,e[12]=f):f=e[12];let p;e[13]!==f?(p=o.jsxs("div",{className:"flex items-center gap-1.5",children:[_,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",f,"%"]})]}),e[13]=f,e[14]=p):p=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[15]=g):g=e[15];let v;e[16]!==l?(v=l.toFixed(1),e[16]=l,e[17]=v):v=e[17];let b;e[18]!==v?(b=o.jsxs("div",{className:"flex items-center gap-1.5",children:[g,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Assistant ",v,"%"]})]}),e[18]=v,e[19]=b):b=e[19];let S;e[20]!==h||e[21]!==r?(S=r>0&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Other ",h.toFixed(1),"%"]})]}),e[20]=h,e[21]=r,e[22]=S):S=e[22];let x;e[23]!==b||e[24]!==S||e[25]!==p?(x=o.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[p,b,S]}),e[23]=b,e[24]=S,e[25]=p,e[26]=x):x=e[26];let y;return e[27]!==x||e[28]!==m?(y=o.jsxs("div",{className:"flex flex-col gap-2",children:[m,x]}),e[27]=x,e[28]=m,e[29]=y):y=e[29],y}function Ih(t){const e=q.c(19),{part:s}=t,i=s.input?.agent_id,r=yt(i),n=r?.title??"Subtask",a=r?.icon??null,l=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,h=s.state==="output-error",c=s.state==="approval-requested";let u;e[0]!==a||e[1]!==n?(u=o.jsx(ds,{icon:a,name:n,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=n,e[2]=u):u=e[2];const d=h?"text-destructive":"text-foreground";let m;e[3]!==d?(m=te("shrink-0 font-medium",d),e[3]=d,e[4]=m):m=e[4];let _;e[5]!==n||e[6]!==m?(_=o.jsx("span",{className:m,children:n}),e[5]=n,e[6]=m,e[7]=_):_=e[7];let f;e[8]!==s.input?(f=s.input?.prompt&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-muted-foreground/50",children:"·"}),o.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=f):f=e[9];let p;e[10]!==c||e[11]!==h||e[12]!==l?(p=o.jsx("span",{className:"ml-auto shrink-0",children:l?o.jsx(Ie,{size:12,className:"animate-spin text-muted-foreground"}):h?o.jsx(Jl,{size:12,className:"text-destructive"}):c?o.jsx(Bs,{size:12,className:"text-warning"}):o.jsx(Yl,{size:12,className:"text-emerald-500"})}),e[10]=c,e[11]=h,e[12]=l,e[13]=p):p=e[13];let g;return e[14]!==u||e[15]!==_||e[16]!==f||e[17]!==p?(g=o.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[u,_,f,p]}),e[14]=u,e[15]=_,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function Ah(t){const e=q.c(58),{onClose:s,back:i,className:r}=t,[n,a]=A.useState(null),{messages:l}=Qo(),{tasks:h,taskId:c}=lt(),{selectedModel:u,selectedVirtualMcp:d}=ki();let m,_,f,p,g,v,b,S;if(e[0]!==i||e[1]!==r||e[2]!==l||e[3]!==s||e[4]!==n?.id||e[5]!==u||e[6]!==d?.title||e[7]!==c||e[8]!==h){S=Symbol.for("react.early_return_sentinel");e:{let k;e[17]!==c?(k=Z=>Z.id===c,e[17]=c,e[18]=k):k=e[18];const w=h.find(k),N=sc(l),j=[...l].reverse().find(Vh),T=j?.metadata?.usage,M=j?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,R=T?.contextTokens??T?.totalTokens??0,C=M&&M>0?(R/M*100).toFixed(1):null,D=l;let E;e[19]!==D?(E=D.filter(Uh).reduce(Wh,0),e[19]=D,e[20]=E):E=e[20];const I=E,L=l;let B;e[21]!==L?(B=L.filter(Hh).reduce(Fh,0),e[21]=L,e[22]=B):B=e[22];const P=B,O=Math.max(0,N.totalTokens-I-P),F=l[0],z=l.at(-1),V=F?.metadata?.created_at??w?.created_at,W=z?.metadata?.created_at??w?.updated_at,U=l.filter($h),G=l.flatMap(Oh),$=u?.modelId?Th(u.modelId):"—",J=d?.title??"Decopilot",K=[{label:"Session",value:w?.title??"New chat"},{label:"Messages",value:U.length},{label:"Agent",value:J},{label:"Model",value:$},{label:"Context Limit",value:M?gs(M):"—"},{label:"Session Tokens (billed)",value:N.totalTokens>0?gs(N.totalTokens):"0"},{label:"Usage",value:C!==null?`${C}%`:"—"},{label:"Input Tokens",value:N.inputTokens>0?gs(N.inputTokens):"0"},{label:"Output Tokens",value:N.outputTokens>0?gs(N.outputTokens):"0"},{label:"Reasoning Tokens",value:N.reasoningTokens>0?gs(N.reasoningTokens):"0"},{label:"Cost",value:N.cost>0?`$${N.cost<.001?N.cost.toFixed(6):N.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:Bn(V)},{label:"Last Activity",value:Bn(W)}];if(!w&&U.length===0){let Z;e[23]!==r?(Z=te("flex flex-col h-full w-full border-l border-border bg-background",r),e[23]=r,e[24]=Z):Z=e[24];let ue;e[25]===Symbol.for("react.memo_cache_sentinel")?(ue=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[25]=ue):ue=e[25];let de;e[26]!==i?(de=i?o.jsx(wn,{size:14,className:"text-muted-foreground"}):o.jsx(ls,{size:14,className:"text-muted-foreground"}),e[26]=i,e[27]=de):de=e[27];let he;e[28]!==s||e[29]!==de?(he=o.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[ue,o.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:de})]}),e[28]=s,e[29]=de,e[30]=he):he=e[30];let pe;e[31]===Symbol.for("react.memo_cache_sentinel")?(pe=o.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a conversation to see context"})}),e[31]=pe):pe=e[31];let We;e[32]!==Z||e[33]!==he?(We=o.jsxs("div",{className:Z,children:[he,pe]}),e[32]=Z,e[33]=he,e[34]=We):We=e[34],S=We;break e}e[35]!==r?(v=te("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",r),e[35]=r,e[36]=v):v=e[36];let ee;e[37]===Symbol.for("react.memo_cache_sentinel")?(ee=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[37]=ee):ee=e[37];let oe;e[38]!==i?(oe=i?o.jsx(wn,{size:14}):o.jsx(ls,{size:14}),e[38]=i,e[39]=oe):oe=e[39],e[40]!==s||e[41]!==oe?(b=o.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[ee,o.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:oe})]}),e[40]=s,e[41]=oe,e[42]=b):b=e[42],m="flex flex-col gap-8 p-6",_=G.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Subtasks"}),o.jsx("div",{className:"flex flex-col gap-1",children:G.map(Lh)})]}),f=o.jsx(Rh,{items:K});let ie;e[43]===Symbol.for("react.memo_cache_sentinel")?(ie=o.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[43]=ie):ie=e[43],e[44]!==P||e[45]!==O||e[46]!==I?(p=o.jsxs("div",{className:"flex flex-col gap-3",children:[ie,o.jsx(Mh,{userTokens:I,assistantTokens:P,otherTokens:O})]}),e[44]=P,e[45]=O,e[46]=I,e[47]=p):p=e[47],g=U.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Raw messages"}),o.jsx("div",{className:"flex flex-col gap-1",children:U.map(Z=>{const ue=Z.metadata?.created_at,de=n?.id===Z.id;return o.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o.jsxs("button",{type:"button",onClick:()=>a(de?null:Z),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("span",{className:te("shrink-0 font-medium",Z.role==="user"?"text-chart-1":"text-chart-2"),children:Z.role}),o.jsx("span",{className:"text-muted-foreground",children:"•"}),o.jsx("span",{className:"truncate text-muted-foreground font-mono",children:Z.id})]}),ue&&o.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(ue).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),de&&o.jsxs(o.Fragment,{children:[Z.role==="assistant"&&(()=>{const he=Z.metadata?._request;if(!he)return null;const pe=he.systemSections??[],We=Math.max(1,...pe.map(Ph)),Be=pe.reduce(Bh,0);return o.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"font-medium text-foreground",children:"Request"}),o.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[he.activeTools??0," / ",he.tools??0," ","tools active"]})]}),pe.length>0&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"text-muted-foreground",children:["System prompt"," ",o.jsxs("span",{className:"tabular-nums",children:["~",Math.round(Be/4).toLocaleString()," ","tok"]})]}),pe.map((re,ge)=>{const Je=re.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${ge}`,fe=re.chars/We*100,kt=Math.round(re.chars/4);return o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"font-mono text-foreground truncate",children:Je}),o.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",kt.toLocaleString()," tok"]})]}),o.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${fe}%`}})})]},ge)})]})]})})(),o.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(Z,null,2)})]})]},Z.id)})})]})}e[0]=i,e[1]=r,e[2]=l,e[3]=s,e[4]=n?.id,e[5]=u,e[6]=d?.title,e[7]=c,e[8]=h,e[9]=m,e[10]=_,e[11]=f,e[12]=p,e[13]=g,e[14]=v,e[15]=b,e[16]=S}else m=e[9],_=e[10],f=e[11],p=e[12],g=e[13],v=e[14],b=e[15],S=e[16];if(S!==Symbol.for("react.early_return_sentinel"))return S;let x;e[48]!==m||e[49]!==_||e[50]!==f||e[51]!==p||e[52]!==g?(x=o.jsxs("div",{className:m,children:[_,f,p,g]}),e[48]=m,e[49]=_,e[50]=f,e[51]=p,e[52]=g,e[53]=x):x=e[53];let y;return e[54]!==v||e[55]!==b||e[56]!==x?(y=o.jsxs("div",{className:v,children:[b,x]}),e[54]=v,e[55]=b,e[56]=x,e[57]=y):y=e[57],y}function Bh(t,e){return t+e.chars}function Ph(t){return t.chars}function Lh(t,e){return o.jsx(Ih,{part:t},e)}function Oh(t){return(t.parts??[]).filter(zh)}function zh(t){return t.type==="tool-subtask"}function $h(t){return t.role!=="system"}function Fh(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function Hh(t){return t.role==="assistant"}function Wh(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function Uh(t){return t.role==="user"}function Vh(t){return t.role==="assistant"&&t.metadata?.usage}const Pn=["amber","bold","bright","calm","crimson","coral","daring","deep","dusty","eager","faint","fierce","frozen","gentle","golden","grand","green","hollow","iron","ivory","keen","lasting","lunar","mellow","misty","noble","olive","pale","prime","quiet","rapid","rustic","serene","sharp","silver","sleek","solar","stark","still","swift","tawny","tender","thin","true","vast","velvet","warm","wild","young","zen"],Ln=["anchor","birch","brook","cedar","cliff","cove","crane","dune","echo","ember","falcon","fern","flint","forge","frost","glade","grove","harbor","hawk","iris","jade","lark","maple","marsh","mesa","opal","orbit","peak","pine","plume","quartz","rapids","reef","ridge","river","sage","shore","slate","spruce","stone","summit","thorn","tide","trail","vale","wren","aspen","delta","crest","spark"];function Kh(){const t=Pn[Math.floor(Math.random()*Pn.length)],e=Ln[Math.floor(Math.random()*Ln.length)];return`deco/${t}-${e}`}function qh(t){const e=t;if(e.structuredContent)return e.structuredContent;const s=e.content?.find(i=>i.type==="text")?.text;if(s)try{return JSON.parse(s)}catch{return[]}return[]}function Gh(t){const e=q.c(26),{orgId:s,orgSlug:i,userId:r,connectionId:n,vmMap:a,owner:l,repo:h,enabled:c}=t,u=c===void 0?!0:c,d=n??null;let m;e[0]!==s||e[1]!==i||e[2]!==d?(m={connectionId:d,orgId:s,orgSlug:i},e[0]=s,e[1]=i,e[2]=d,e[3]=m):m=e[3];const _=He(m);let f;e[4]!==l||e[5]!==h?(f={owner:l,repo:h},e[4]=l,e[5]=h,e[6]=f):f=e[6];const p=u&&!!n&&!!l&&!!h;let g;e[7]!==_||e[8]!==f||e[9]!==p?(g={client:_,toolName:"list_branches",toolArguments:f,enabled:p,staleTime:3e4,select:Zh},e[7]=_,e[8]=f,e[9]=p,e[10]=g):g=e[10];const{data:v,isLoading:b,isError:S}=us(g);let x,y;e[11]!==r||e[12]!==a?(y=new Set(Object.keys(a?.[r]??{})),x=[...y].sort().map(Jh),e[11]=r,e[12]=a,e[13]=x,e[14]=y):(x=e[13],y=e[14]);const k=x;let w;if(e[15]!==v||e[16]!==y){const M=Array.isArray(v)?v:v?.branches??[];let R;e[18]!==y?(R=C=>!y.has(C.name),e[18]=y,e[19]=R):R=e[19],w=M.filter(Xh).filter(R).map(Yh),e[15]=v,e[16]=y,e[17]=w}else w=e[17];const N=w,j=Array.isArray(v)?null:v?.default_branch??null;let T;return e[20]!==j||e[21]!==S||e[22]!==b||e[23]!==N||e[24]!==k?(T={yours:k,others:N,defaultBase:j,isLoading:b,isError:S},e[20]=j,e[21]=S,e[22]=b,e[23]=N,e[24]=k,e[25]=T):T=e[25],T}function Yh(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function Xh(t){return typeof t.name=="string"}function Jh(t){return{name:t,source:"yours"}}function Zh(t){return qh(t)}function Qh(t){const e=q.c(42),{orgId:s,orgSlug:i,userId:r,connectionId:n,owner:a,repo:l,vmMap:h,value:c,onChange:u}=t,[d,m]=A.useState(!1);let _;e[0]!==n||e[1]!==d||e[2]!==s||e[3]!==i||e[4]!==a||e[5]!==l||e[6]!==r||e[7]!==h?(_={orgId:s,orgSlug:i,userId:r,connectionId:n,vmMap:h,owner:a,repo:l,enabled:d},e[0]=n,e[1]=d,e[2]=s,e[3]=i,e[4]=a,e[5]=l,e[6]=r,e[7]=h,e[8]=_):_=e[8];const{yours:f,others:p,isLoading:g,isError:v}=Gh(_);let b;e[9]!==u?(b=I=>{u(I),m(!1)},e[9]=u,e[10]=b):b=e[10];const S=b,x=c??"Select branch…";let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Ts,{className:"h-3.5 w-3.5"}),e[11]=y):y=e[11];let k;e[12]!==x?(k=o.jsx(Hs,{asChild:!0,children:o.jsxs(se,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 font-mono text-xs",children:[y,o.jsx("span",{className:"max-w-[200px] truncate",children:x})]})}),e[12]=x,e[13]=k):k=e[13];let w;e[14]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(fc,{placeholder:"Search branches…"}),e[14]=w):w=e[14];let N;e[15]!==S?(N=o.jsxs("div",{className:"flex items-center border-b pr-2 [&>[data-slot=command-input-wrapper]]:flex-1 [&>[data-slot=command-input-wrapper]]:border-b-0",children:[w,o.jsx(se,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>S(Kh()),children:"New"})]}),e[15]=S,e[16]=N):N=e[16];let j;e[17]!==v?(j=v&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"Couldn't load branches from GitHub. You can still pick from your branches."}),e[17]=v,e[18]=j):j=e[18];let T;e[19]!==v||e[20]!==g||e[21]!==p.length||e[22]!==f.length?(T=!v&&!g&&f.length===0&&p.length===0&&o.jsx(dc,{children:"No branches found."}),e[19]=v,e[20]=g,e[21]=p.length,e[22]=f.length,e[23]=T):T=e[23];let M;e[24]!==S||e[25]!==f?(M=f.length>0&&o.jsx(Nn,{heading:"Your branches",children:f.map(I=>o.jsxs(jn,{value:I.name,onSelect:()=>S(I.name),children:[o.jsx(Ts,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:I.name})]},I.name))}),e[24]=S,e[25]=f,e[26]=M):M=e[26];let R;e[27]!==p||e[28]!==S?(R=p.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(uc,{}),o.jsx(Nn,{heading:"Other branches in repo",children:p.map(I=>o.jsxs(jn,{value:I.name,onSelect:()=>S(I.name),children:[o.jsx(Ts,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:I.name}),I.author&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",I.author]})]},I.name))})]}),e[27]=p,e[28]=S,e[29]=R):R=e[29];let C;e[30]!==R||e[31]!==j||e[32]!==T||e[33]!==M?(C=o.jsxs(mc,{children:[j,T,M,R]}),e[30]=R,e[31]=j,e[32]=T,e[33]=M,e[34]=C):C=e[34];let D;e[35]!==C||e[36]!==N?(D=o.jsx(Ws,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:o.jsxs(_c,{children:[N,C]})}),e[35]=C,e[36]=N,e[37]=D):D=e[37];let E;return e[38]!==d||e[39]!==D||e[40]!==k?(E=o.jsxs(Us,{open:d,onOpenChange:m,children:[k,D]}),e[38]=d,e[39]=D,e[40]=k,e[41]=E):E=e[41],E}function ed(){const t=q.c(27),{org:e}=xe(),{selectedVirtualMcp:s}=ki(),{data:i}=Ci.useSession(),{currentBranch:r,setCurrentTaskBranch:n}=lt();let a;t[0]!==e.id?(a=Jo(e.id),t[0]=e.id,t[1]=a):a=t[1];const h=s??a,c=yt(h.id),u=i?.user?.id??"",d=c?.metadata?.githubRepo??null,m=!!d?.connectionId&&!!u;let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(ql,{size:32}),t[2]=_):_=t[2];let f;t[3]!==h.icon||t[4]!==h.title?(f=o.jsx(ds,{icon:h.icon,name:h.title,size:"lg",fallbackIcon:_,className:"size-10 min-w-10 md:size-[60px]! md:min-w-[60px] rounded-xl md:rounded-[18px]!"}),t[3]=h.icon,t[4]=h.title,t[5]=f):f=t[5];let p;t[6]!==h.title?(p=o.jsx("h3",{className:"text-base md:text-xl font-medium text-foreground",children:h.title}),t[6]=h.title,t[7]=p):p=t[7];const g=h.description??"Ask anything about configuring model providers or using MCP Mesh.";let v;t[8]!==g?(v=o.jsx("div",{className:"text-muted-foreground text-center text-base max-w-md line-clamp-2",children:g}),t[8]=g,t[9]=v):v=t[9];let b;t[10]!==r||t[11]!==c?.metadata?.vmMap||t[12]!==d||t[13]!==e.id||t[14]!==e.slug||t[15]!==n||t[16]!==m||t[17]!==u?(b=m&&o.jsx("div",{className:"mt-2",children:o.jsx(Qh,{orgId:e.id,orgSlug:e.slug,userId:u,connectionId:d.connectionId,owner:d.owner,repo:d.name,vmMap:c?.metadata?.vmMap,value:r??void 0,onChange:n})}),t[10]=r,t[11]=c?.metadata?.vmMap,t[12]=d,t[13]=e.id,t[14]=e.slug,t[15]=n,t[16]=m,t[17]=u,t[18]=b):b=t[18];let S;t[19]!==f||t[20]!==p||t[21]!==v||t[22]!==b?(S=o.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[f,p,v,b]}),t[19]=f,t[20]=p,t[21]=v,t[22]=b,t[23]=S):S=t[23];let x;t[24]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("div",{className:"w-full max-w-3xl mx-auto",children:o.jsx(Ee.IceBreakers,{})}),t[24]=x):x=t[24];let y;return t[25]!==S?(y=o.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center gap-6 px-4",children:[S,x]}),t[25]=S,t[26]=y):y=t[26],y}function td(){const t=q.c(26),{org:e}=xe(),s=Ec(),{isChatEmpty:i}=Qo(),[r,n]=A.useState("chat"),a=Fl();if(s.length===0){let S;return t[0]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Ee,{className:"animate-in fade-in-0 duration-200",children:o.jsx(Ee.Main,{className:"flex flex-col items-center",children:o.jsx(Ee.EmptyState,{children:o.jsx(Ee.NoAiProviderEmptyState,{})})})}),t[0]=S):S=t[0],S}let l;t[1]!==a.hasDecoKey||t[2]!==a.hasOnlyDecoProvider||t[3]!==a.isLoading||t[4]!==a.isZeroBalance||t[5]!==i||t[6]!==e?(l=a.hasDecoKey&&a.isZeroBalance&&a.hasOnlyDecoProvider&&!a.isLoading&&i&&!Hl(e.id),t[1]=a.hasDecoKey,t[2]=a.hasOnlyDecoProvider,t[3]=a.isLoading,t[4]=a.isZeroBalance,t[5]=i,t[6]=e,t[7]=l):l=t[7];const h=l;let c;t[8]!==h?(c=h&&o.jsx(Ee.CreditsEmptyState,{}),t[8]=h,t[9]=c):c=t[9];const u=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let d;t[10]!==u?(d=te("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",u),t[10]=u,t[11]=d):d=t[11];let m;t[12]!==i?(m=i?o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(ed,{})}),o.jsx(Ee.Footer,{children:o.jsx(Ee.Input,{onOpenContextPanel:()=>n("context")})})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(Ee.Messages,{})}),o.jsx(Ee.Footer,{children:o.jsx(Ee.Input,{onOpenContextPanel:()=>n("context")})})]}),t[12]=i,t[13]=m):m=t[13];let _;t[14]!==d||t[15]!==m?(_=o.jsx("div",{className:d,children:m}),t[14]=d,t[15]=m,t[16]=_):_=t[16];const f=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let p;t[17]!==f?(p=te("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",f),t[17]=f,t[18]=p):p=t[18];let g;t[19]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(Ah,{back:!0,onClose:()=>n("chat")}),t[19]=g):g=t[19];let v;t[20]!==p?(v=o.jsx("div",{className:p,children:g}),t[20]=p,t[21]=v):v=t[21];let b;return t[22]!==c||t[23]!==_||t[24]!==v?(b=o.jsxs(Ee,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[c,_,v]}),t[22]=c,t[23]=_,t[24]=v,t[25]=b):b=t[25],b}function Ea(){const t=q.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(Ee.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(es,{fallback:e,children:o.jsx(A.Suspense,{fallback:o.jsx(Ee.Skeleton,{}),children:o.jsx(td,{})})}),t[1]=s):s=t[1],s}async function sd(t,e,s){const i=await t.callTool({name:e,arguments:s});if(i.isError){const r=i.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(r)}return i}const Ta=["VM_START"],Qs=new Map,id=t=>`${t.virtualMcpId}::${t.branch??""}`,Wi=new Set,gi={mark:(t,e)=>Wi.add(`${t}::${e}`),clear:(t,e)=>Wi.delete(`${t}::${e}`),isStopped:(t,e)=>Wi.has(`${t}::${e}`)};function an(t){const e=Wt();return Ko({mutationKey:Ta,mutationFn:async s=>{s.branch&&gi.clear(s.virtualMcpId,s.branch);const i=id(s),r=Qs.get(i);if(r)return r;const n=(async()=>(await sd(t,"VM_START",s)).structuredContent)();Qs.set(i,n);try{return await n}finally{Qs.get(i)===n&&Qs.delete(i)}},onSuccess:()=>{ai(e)}})}function Ra(t,e){const s=q.c(3);let i;return s[0]!==e||s[1]!==t?(i={mutationKey:Ta,predicate:n=>{if(!t)return!1;const a=n.state.variables;return!a||a.virtualMcpId!==t?!1:(a.branch??"")===(e??"")}},s[0]=e,s[1]=t,s[2]=i):i=s[2],Nh(i)>0}const rd={settings:gc,automations:pc,env:pi,preview:Zl,git:Ts};function On(t){const e=Ei(t);if(e.type==="icon"){const s=Ti(e.name);return s?{kind:"component",Component:s}:null}return e.type==="url"?{kind:"url",src:e.url}:null}function Ui(t){if(t.kind==="system")return{kind:"component",Component:rd[t.tabId]};const e=On(t.iconUrl);if(e)return e;if(!t.appId)return{kind:"fallback"};const s=t.connections.find(r=>r.id===t.appId);if(!s)return{kind:"fallback"};const i=On(s.icon);return i||{kind:"fallback"}}function nd(t){const{org:e}=xe(),s=He({connectionId:Bt,orgId:e.id,orgSlug:e.slug}),{data:i}=Dl({queryKey:As.threadMetadata(t),queryFn:async()=>{if(!s||!t)return null;try{const r=await s.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}});return(r.structuredContent??r).item?.metadata??null}catch{return null}},staleTime:3e4});return i}function Da(t){const e=q.c(8),s=At();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const r=Qr(i),n=yt(t.virtualMcpId),a=nd(t.taskId),{currentBranch:l}=lt(),h=n?.metadata?.ui??null,c=h?.layout??null,u=c?.tabs??[],d=h?.pinnedViews??[],m=a?.expanded_tools??[],_=!!(n&&Ut(n));let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f={includeVirtual:!0},e[1]=f):f=e[1];const p=Ri(f),{activeTab:g,mainOpen:v}=ic({mainParam:r.main,metadata:c?{defaultMainView:c.defaultMainView??null,tabs:u.map(od)}:null}),b=ea(g),S=[];_&&(S.push({id:"preview",title:"Preview"}),S.push({id:"env",title:"Terminal"}),S.push({id:"git",title:l??"git"})),S.push({id:"settings",title:"Settings"}),S.push({id:"automations",title:"Automations"});const x=new Map;for(const j of m){const T=Cn(j.appId,j.toolName);x.set(T,{id:T,title:j.toolName,appId:j.appId,iconKey:j.toolName})}for(const j of d){const T=Cn(j.connectionId,j.toolName);x.set(T,{id:T,title:j.label||j.toolName,appId:j.connectionId,iconKey:j.toolName,iconUrl:j.icon??null})}let y;e[2]!==p?(y=j=>({id:j.id,title:j.title,kind:"agent",icon:Ui({tabId:j.id,kind:"agent",appId:j.view.appId,connections:p})}),e[2]=p,e[3]=y):y=e[3];const k=[...u.map(y),...Array.from(x.values()).map(j=>({id:j.id,title:j.title,kind:"expanded",icon:Ui({tabId:j.iconKey,kind:"expanded",appId:j.appId,iconUrl:j.iconUrl,connections:p})})),...S.map(j=>({id:j.id,title:j.title,kind:"system",icon:Ui({tabId:j.id,kind:"system",connections:p})}))];let w;return e[4]!==g||e[5]!==v||e[6]!==s?(w=j=>{const T=rc({clickedId:j,activeTab:g,mainOpen:v});s({to:".",search:M=>({...M,main:T}),replace:!0})},e[4]=g,e[5]=v,e[6]=s,e[7]=w):w=e[7],{activeTab:g,mainOpen:v,setActiveTab:w,systemTabs:S,layoutTabs:u,expandedTools:m,automationTabParsed:b,tabs:k}}function od(t){return{id:t.id}}function ad(t){const e=q.c(84),{value:s,onChange:i,onColorChange:r,name:n,size:a,className:l,avatarClassName:h,showHoverOverlay:c,disabled:u}=t,d=a===void 0?"lg":a,m=c===void 0?!0:c,_=u===void 0?!1:u,[f,p]=A.useState(!1),[g,v]=A.useState("icons"),[b,S]=A.useState(""),[x,y]=A.useState("blue");let k;e[0]!==s?(k=Ei(s),e[0]=s,e[1]=k):k=e[1];const w=k,N=w.type==="icon"||w.type==="url"&&w.color?w.color:x;let j;e[2]!==i||e[3]!==N?(j=fe=>{i(zi(fe,N))},e[2]=i,e[3]=N,e[4]=j):j=e[4];const T=j;let M;e[5]!==i||e[6]!==r||e[7]!==w.name||e[8]!==w.type||e[9]!==w.url?(M=fe=>{y(fe),r?.(fe),w.type==="icon"?i(zi(w.name,fe)):w.type==="url"&&i(En(w.url,fe))},e[5]=i,e[6]=r,e[7]=w.name,e[8]=w.type,e[9]=w.url,e[10]=M):M=e[10];const R=M;let C;e[11]!==i||e[12]!==N?(C=fe=>{i(En(fe,N)),p(!1)},e[11]=i,e[12]=N,e[13]=C):C=e[13];const D=C;let E;e[14]!==i||e[15]!==N?(E=()=>{const fe=tn(),kt=fe[Math.floor(Math.random()*fe.length)];i(zi(kt,N))},e[14]=i,e[15]=N,e[16]=E):E=e[16];const I=E;let L,B,P,O,F,z,V,W;if(e[17]!==l||e[18]!==_||e[19]!==f||e[20]!==d){const fe={xs:"rounded-md",sm:"rounded-lg","sm+":"rounded-xl",md:"rounded-xl",lg:"rounded-2xl",xl:"rounded-2xl"};B=Us,z=_?!1:f,V=p,L=Hs,F=!0,W="button",P=_,O=te("relative group overflow-hidden",_?"cursor-default opacity-50":"cursor-pointer",fe[d],l),e[17]=l,e[18]=_,e[19]=f,e[20]=d,e[21]=L,e[22]=B,e[23]=P,e[24]=O,e[25]=F,e[26]=z,e[27]=V,e[28]=W}else L=e[21],B=e[22],P=e[23],O=e[24],F=e[25],z=e[26],V=e[27],W=e[28];let U;e[29]!==h||e[30]!==n||e[31]!==d||e[32]!==s?(U=o.jsx(Tn,{icon:s,name:n,size:d,className:h}),e[29]=h,e[30]=n,e[31]=d,e[32]=s,e[33]=U):U=e[33];let G;e[34]!==_||e[35]!==m?(G=m&&!_&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity",children:o.jsx(ia,{size:16,className:"text-white"})}),e[34]=_,e[35]=m,e[36]=G):G=e[36];let $;e[37]!==P||e[38]!==O||e[39]!==U||e[40]!==G||e[41]!==W?($=o.jsxs("button",{type:W,disabled:P,className:O,children:[U,G]}),e[37]=P,e[38]=O,e[39]=U,e[40]=G,e[41]=W,e[42]=$):$=e[42];let J;e[43]!==L||e[44]!==F||e[45]!==$?(J=o.jsx(L,{asChild:F,children:$}),e[43]=L,e[44]=F,e[45]=$,e[46]=J):J=e[46];let K;e[47]!==n||e[48]!==s?(K=o.jsx("div",{className:"flex items-center justify-center py-4",children:o.jsx(Tn,{icon:s,name:n,size:"xl"})}),e[47]=n,e[48]=s,e[49]=K):K=e[49];let ee;e[50]===Symbol.for("react.memo_cache_sentinel")?(ee=()=>v("icons"),e[50]=ee):ee=e[50];const oe=g==="icons"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let ie;e[51]!==oe?(ie=te("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",oe),e[51]=oe,e[52]=ie):ie=e[52];let Z;e[53]!==ie?(Z=o.jsx("button",{type:"button",onClick:ee,className:ie,children:"Icons"}),e[53]=ie,e[54]=Z):Z=e[54];let ue;e[55]===Symbol.for("react.memo_cache_sentinel")?(ue=()=>v("upload"),e[55]=ue):ue=e[55];const de=g==="upload"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let he;e[56]!==de?(he=te("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",de),e[56]=de,e[57]=he):he=e[57];let pe;e[58]!==he?(pe=o.jsx("button",{type:"button",onClick:ue,className:he,children:"Upload"}),e[58]=he,e[59]=pe):pe=e[59];let We;e[60]===Symbol.for("react.memo_cache_sentinel")?(We=o.jsx("div",{className:"flex-1"}),e[60]=We):We=e[60];let Be;e[61]!==Z||e[62]!==pe?(Be=o.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[Z,pe,We]}),e[61]=Z,e[62]=pe,e[63]=Be):Be=e[63];let re;e[64]!==R||e[65]!==I||e[66]!==T||e[67]!==D||e[68]!==w.name||e[69]!==w.type||e[70]!==b||e[71]!==N||e[72]!==g?(re=g==="icons"?o.jsx(dd,{search:b,onSearchChange:S,selectedColor:N,onColorChange:R,onSelectIcon:T,onRandom:I,currentIconName:w.type==="icon"?w.name:null}):o.jsx(ud,{onUpload:D}),e[64]=R,e[65]=I,e[66]=T,e[67]=D,e[68]=w.name,e[69]=w.type,e[70]=b,e[71]=N,e[72]=g,e[73]=re):re=e[73];let ge;e[74]!==K||e[75]!==Be||e[76]!==re?(ge=o.jsx(Ws,{align:"start",className:"w-80 p-0",onOpenAutoFocus:ld,children:o.jsxs("div",{className:"flex flex-col",children:[K,Be,re]})}),e[74]=K,e[75]=Be,e[76]=re,e[77]=ge):ge=e[77];let Je;return e[78]!==B||e[79]!==z||e[80]!==V||e[81]!==J||e[82]!==ge?(Je=o.jsxs(B,{open:z,onOpenChange:V,children:[J,ge]}),e[78]=B,e[79]=z,e[80]=V,e[81]=J,e[82]=ge,e[83]=Je):Je=e[83],Je}function ld(t){return t.preventDefault()}function cd(t){const e=q.c(27),{selectedColor:s,onColorChange:i}=t,[r,n]=A.useState(!1);let a,l,h,c,u,d,m;if(e[0]!==r||e[1]!==s){const b=sa(s);l=Us,d=r,m=n,a=Hs,u=!0,h="button",c=te("h-6 w-6 rounded-full shrink-0 ring-2 ring-offset-2 ring-offset-background transition-all cursor-pointer hover:scale-110",b.dot,"ring-foreground/20"),e[0]=r,e[1]=s,e[2]=a,e[3]=l,e[4]=h,e[5]=c,e[6]=u,e[7]=d,e[8]=m}else a=e[2],l=e[3],h=e[4],c=e[5],u=e[6],d=e[7],m=e[8];let _;e[9]!==h||e[10]!==c?(_=o.jsx("button",{type:h,className:c,title:"Change color"}),e[9]=h,e[10]=c,e[11]=_):_=e[11];let f;e[12]!==a||e[13]!==u||e[14]!==_?(f=o.jsx(a,{asChild:u,children:_}),e[12]=a,e[13]=u,e[14]=_,e[15]=f):f=e[15];let p;e[16]!==i||e[17]!==s?(p=xc.map(b=>o.jsx("button",{type:"button",onClick:()=>{i(b.name),n(!1)},className:te("h-5 w-5 rounded-full transition-all shrink-0 cursor-pointer",b.dot,s===b.name?"ring-2 ring-offset-1 ring-offset-background ring-foreground/30 scale-110":"hover:scale-110"),title:b.name},b.name)),e[16]=i,e[17]=s,e[18]=p):p=e[18];let g;e[19]!==p?(g=o.jsx(Ws,{align:"start",side:"right",sideOffset:8,className:"w-auto p-2",onOpenAutoFocus:hd,children:o.jsx("div",{className:"grid grid-cols-4 gap-1",children:p})}),e[19]=p,e[20]=g):g=e[20];let v;return e[21]!==l||e[22]!==d||e[23]!==m||e[24]!==f||e[25]!==g?(v=o.jsxs(l,{open:d,onOpenChange:m,children:[f,g]}),e[21]=l,e[22]=d,e[23]=m,e[24]=f,e[25]=g,e[26]=v):v=e[26],v}function hd(t){return t.preventDefault()}function dd(t){const e=q.c(44),{search:s,onSearchChange:i,selectedColor:r,onColorChange:n,onSelectIcon:a,onRandom:l,currentIconName:h}=t;let c,u,d,m,_,f,p;if(e[0]!==h||e[1]!==n||e[2]!==l||e[3]!==i||e[4]!==a||e[5]!==s||e[6]!==r){const x=tn(),y=sa(r);u=s.trim()?x.filter(R=>{const C=dr(R),D=s.toLowerCase();return C.includes(D)||R.toLowerCase().includes(D)}):x,f="flex flex-col";let k;e[14]===Symbol.for("react.memo_cache_sentinel")?(k=o.jsx(Na,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[14]=k):k=e[14];let w;e[15]!==i?(w=R=>i(R.target.value),e[15]=i,e[16]=w):w=e[16];let N;e[17]!==s||e[18]!==w?(N=o.jsxs("div",{className:"relative flex-1",children:[k,o.jsx(fs,{value:s,onChange:w,placeholder:"Filter...",className:"h-8 text-xs pl-7"})]}),e[17]=s,e[18]=w,e[19]=N):N=e[19];let j;e[20]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(vc,{size:14,className:"text-muted-foreground"}),e[20]=j):j=e[20];let T;e[21]!==l?(T=o.jsx("button",{type:"button",onClick:l,className:"h-8 w-8 flex items-center justify-center rounded-md border border-border hover:bg-accent transition-colors shrink-0",title:"Random icon",children:j}),e[21]=l,e[22]=T):T=e[22];let M;e[23]!==n||e[24]!==r?(M=o.jsx(cd,{selectedColor:r,onColorChange:n}),e[23]=n,e[24]=r,e[25]=M):M=e[25],e[26]!==T||e[27]!==M||e[28]!==N?(p=o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[N,T,M]}),e[26]=T,e[27]=M,e[28]=N,e[29]=p):p=e[29],c=ka,_="h-56",d="grid grid-cols-9 gap-0.5 px-2 pb-2",m=u.map(R=>{const C=Ti(R);return C?o.jsx("button",{type:"button",onClick:()=>a(R),className:te("h-8 w-8 flex items-center justify-center rounded-md transition-colors cursor-pointer",h===R?te(y.bg,y.text):te(y.text,"hover:bg-accent")),title:R,children:o.jsx(C,{size:18})},R):null}),e[0]=h,e[1]=n,e[2]=l,e[3]=i,e[4]=a,e[5]=s,e[6]=r,e[7]=c,e[8]=u,e[9]=d,e[10]=m,e[11]=_,e[12]=f,e[13]=p}else c=e[7],u=e[8],d=e[9],m=e[10],_=e[11],f=e[12],p=e[13];let g;e[30]!==d||e[31]!==m?(g=o.jsx("div",{className:d,children:m}),e[30]=d,e[31]=m,e[32]=g):g=e[32];let v;e[33]!==u.length?(v=u.length===0&&o.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No icons found"}),e[33]=u.length,e[34]=v):v=e[34];let b;e[35]!==c||e[36]!==_||e[37]!==g||e[38]!==v?(b=o.jsxs(c,{className:_,children:[g,v]}),e[35]=c,e[36]=_,e[37]=g,e[38]=v,e[39]=b):b=e[39];let S;return e[40]!==f||e[41]!==p||e[42]!==b?(S=o.jsxs("div",{className:f,children:[p,b]}),e[40]=f,e[41]=p,e[42]=b,e[43]=S):S=e[43],S}function ud(t){const e=q.c(27),{onUpload:s}=t,i=A.useRef(null);let r;e[0]!==s?(r=k=>{const w=k.target.files?.[0];if(!w)return;if(w.size>2097152){_e.error("Image must be smaller than 2MB"),k.target.value="";return}const N=new FileReader;N.onerror=()=>{_e.error("Failed to read image file"),i.current&&(i.current.value="")},N.onloadend=()=>{N.readyState===FileReader.DONE&&N.result&&s(N.result),i.current&&(i.current.value="")},N.readAsDataURL(w)},e[0]=s,e[1]=r):r=e[1];const n=r,[a,l]=A.useState("");let h;e[2]!==s||e[3]!==a?(h=()=>{const k=a.trim();k&&(s(k),l(""))},e[2]=s,e[3]=a,e[4]=h):h=e[4];const c=h;let u;e[5]!==n?(u=o.jsx("input",{type:"file",ref:i,className:"hidden",accept:"image/*",onChange:n}),e[5]=n,e[6]=u):u=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=()=>i.current?.click(),e[7]=d):d=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsxs("button",{type:"button",onClick:d,className:"h-24 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-2 text-muted-foreground hover:text-foreground",children:[o.jsx(Ql,{size:20}),o.jsx("span",{className:"text-xs",children:"Click to upload an image (max 2MB)"})]}),e[8]=m):m=e[8];let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),o.jsx("div",{className:"flex-1 h-px bg-border"})]}),e[9]=_):_=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=k=>l(k.target.value),e[10]=f):f=e[10];let p;e[11]!==c?(p=k=>{k.key==="Enter"&&(k.preventDefault(),c())},e[11]=c,e[12]=p):p=e[12];let g;e[13]!==a||e[14]!==p?(g=o.jsx(fs,{value:a,onChange:f,placeholder:"Paste image URL...",className:"h-8 text-xs flex-1",onKeyDown:p}),e[13]=a,e[14]=p,e[15]=g):g=e[15];let v;e[16]!==a?(v=a.trim(),e[16]=a,e[17]=v):v=e[17];const b=!v;let S;e[18]!==c||e[19]!==b?(S=o.jsx(se,{variant:"outline",size:"sm",className:"h-8 px-3 text-xs shrink-0",onClick:c,disabled:b,children:"Apply"}),e[18]=c,e[19]=b,e[20]=S):S=e[20];let x;e[21]!==S||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-1.5",children:[g,S]}),e[21]=S,e[22]=g,e[23]=x):x=e[23];let y;return e[24]!==x||e[25]!==u?(y=o.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[u,m,_,x]}),e[24]=x,e[25]=u,e[26]=y):y=e[26],y}function fd(t){const e=q.c(5),{value:s}=t;let i;if(e[0]!==s){i=Symbol.for("react.early_return_sentinel");e:{const n=Ei(s);if(n.type==="icon"){const a=Ti(n.name);if(a){let l;e[2]!==a?(l=o.jsx(a,{size:16,className:"text-muted-foreground"}),e[2]=a,e[3]=l):l=e[3],i=l;break e}}}e[0]=s,e[1]=i}else i=e[1];if(i!==Symbol.for("react.early_return_sentinel"))return i;let r;return e[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Pc,{size:16,className:"text-muted-foreground"}),e[4]=r):r=e[4],r}function md(t){const e=q.c(66),{value:s,onChange:i,className:r,disabled:n}=t,[a,l]=A.useState(!1),[h,c]=A.useState("");let u;e[0]!==s?(u=Ei(s),e[0]=s,e[1]=u):u=e[1];const d=u,m=d.type==="icon"?d.name:null;let _,f,p,g,v,b,S,x,y,k,w,N,j,T,M;if(e[2]!==r||e[3]!==m||e[4]!==n||e[5]!==i||e[6]!==a||e[7]!==h||e[8]!==s){const B=tn();g=h.trim()?B.filter(U=>{const G=h.toLowerCase();return dr(U).includes(G)||U.toLowerCase().includes(G)}):B,p=Us,v=n?!1:a,b=l;const P=n?"cursor-default opacity-50":"cursor-pointer hover:bg-accent";let O;e[24]!==r||e[25]!==P?(O=te("size-7 shrink-0 rounded-md transition-colors flex items-center justify-center",P,r),e[24]=r,e[25]=P,e[26]=O):O=e[26];let F;e[27]!==s?(F=o.jsx(fd,{value:s}),e[27]=s,e[28]=F):F=e[28],e[29]!==n||e[30]!==O||e[31]!==F?(S=o.jsx(Hs,{asChild:!0,children:o.jsx("button",{type:"button",disabled:n,className:O,children:F})}),e[29]=n,e[30]=O,e[31]=F,e[32]=S):S=e[32],f=Ws,j="start",T="w-64 p-0",M=_d,w="flex flex-col";let z;e[33]===Symbol.for("react.memo_cache_sentinel")?(z=o.jsx(Na,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[33]=z):z=e[33];let V;e[34]===Symbol.for("react.memo_cache_sentinel")?(V=U=>c(U.target.value),e[34]=V):V=e[34],e[35]!==h?(N=o.jsx("div",{className:"px-2 py-2",children:o.jsxs("div",{className:"relative",children:[z,o.jsx(fs,{value:h,onChange:V,placeholder:"Filter...",className:"h-7 text-xs pl-7"})]})}),e[35]=h,e[36]=N):N=e[36],_=ka,k="h-48",x="grid grid-cols-8 gap-0.5 px-2 pb-2";let W;e[37]!==m||e[38]!==i?(W=U=>{const G=Ti(U);return G?o.jsx("button",{type:"button",onClick:()=>{i(`icon://${U}`),l(!1)},className:te("h-7 w-7 flex items-center justify-center rounded-md transition-colors cursor-pointer",m===U?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),title:dr(U),children:o.jsx(G,{size:16})},U):null},e[37]=m,e[38]=i,e[39]=W):W=e[39],y=g.map(W),e[2]=r,e[3]=m,e[4]=n,e[5]=i,e[6]=a,e[7]=h,e[8]=s,e[9]=_,e[10]=f,e[11]=p,e[12]=g,e[13]=v,e[14]=b,e[15]=S,e[16]=x,e[17]=y,e[18]=k,e[19]=w,e[20]=N,e[21]=j,e[22]=T,e[23]=M}else _=e[9],f=e[10],p=e[11],g=e[12],v=e[13],b=e[14],S=e[15],x=e[16],y=e[17],k=e[18],w=e[19],N=e[20],j=e[21],T=e[22],M=e[23];let R;e[40]!==x||e[41]!==y?(R=o.jsx("div",{className:x,children:y}),e[40]=x,e[41]=y,e[42]=R):R=e[42];let C;e[43]!==g.length?(C=g.length===0&&o.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:"No icons found"}),e[43]=g.length,e[44]=C):C=e[44];let D;e[45]!==_||e[46]!==R||e[47]!==C||e[48]!==k?(D=o.jsxs(_,{className:k,children:[R,C]}),e[45]=_,e[46]=R,e[47]=C,e[48]=k,e[49]=D):D=e[49];let E;e[50]!==D||e[51]!==w||e[52]!==N?(E=o.jsxs("div",{className:w,children:[N,D]}),e[50]=D,e[51]=w,e[52]=N,e[53]=E):E=e[53];let I;e[54]!==f||e[55]!==E||e[56]!==j||e[57]!==T||e[58]!==M?(I=o.jsx(f,{align:j,className:T,onOpenAutoFocus:M,children:E}),e[54]=f,e[55]=E,e[56]=j,e[57]=T,e[58]=M,e[59]=I):I=e[59];let L;return e[60]!==p||e[61]!==v||e[62]!==b||e[63]!==S||e[64]!==I?(L=o.jsxs(p,{open:v,onOpenChange:b,children:[S,I]}),e[60]=p,e[61]=v,e[62]=b,e[63]=S,e[64]=I,e[65]=L):L=e[65],L}function _d(t){return t.preventDefault()}function ci(){const t=q.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex items-center justify-center h-32",children:o.jsx(Ie,{className:"animate-spin text-muted-foreground",size:24})}),t[0]=e):e=t[0],e}function Vi(t){return({error:e})=>e?.message?.includes("Method not found")||e?.code===-32601?o.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:o.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:t})}):o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[o.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:o.jsx(Ml,{className:"h-6 w-6 text-destructive"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h3",{className:"text-lg font-medium",children:"Something went wrong"}),o.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:e?.message?e.message.length>200?`${e.message.slice(0,200)}...`:e.message:"An unexpected error occurred"})]})]})}function pd(t){const e=q.c(23),{item:s,isSelected:i,onToggle:r,disabled:n}=t,a=n?"cursor-not-allowed opacity-50":"cursor-pointer",l=i?"bg-accent/25":"hover:bg-muted/50";let h;e[0]!==a||e[1]!==l?(h=te("flex items-start gap-3 p-4 rounded-lg transition-colors",a,l),e[0]=a,e[1]=l,e[2]=h):h=e[2];let c;e[3]!==s.name?(c=o.jsx("p",{className:"text-sm font-medium leading-none truncate",children:s.name}),e[3]=s.name,e[4]=c):c=e[4];let u;e[5]!==s.tags?(u=s.tags&&o.jsx("span",{className:"shrink-0",children:s.tags}),e[5]=s.tags,e[6]=u):u=e[6];let d;e[7]!==c||e[8]!==u?(d=o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c,u]}),e[7]=c,e[8]=u,e[9]=d):d=e[9];let m;e[10]!==s.description?(m=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description}),e[10]=s.description,e[11]=m):m=e[11];let _;e[12]!==d||e[13]!==m?(_=o.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[d,m]}),e[12]=d,e[13]=m,e[14]=_):_=e[14];let f;e[15]!==n||e[16]!==i||e[17]!==r?(f=o.jsx(oh,{checked:i,onCheckedChange:r,disabled:n,className:"mt-0.5"}),e[15]=n,e[16]=i,e[17]=r,e[18]=f):f=e[18];let p;return e[19]!==h||e[20]!==_||e[21]!==f?(p=o.jsxs("label",{className:h,children:[_,f]}),e[19]=h,e[20]=_,e[21]=f,e[22]=p):p=e[22],p}function ln(t){const e=q.c(13),{items:s,selections:i,onToggle:r,emptyMessage:n,disabled:a}=t;let l,h,c;if(e[0]!==a||e[1]!==n||e[2]!==s||e[3]!==r||e[4]!==i){c=Symbol.for("react.early_return_sentinel");e:{const d=s.map(gd);if(s.length===0){let m;e[8]!==n?(m=o.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:o.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:n})}),e[8]=n,e[9]=m):m=e[9],c=m;break e}l="flex-1 overflow-auto px-4 py-3 space-y-1",h=s.map(m=>o.jsx(pd,{item:m,isSelected:i===null||i?.includes(m.id),onToggle:()=>r(m.id,d),disabled:a},m.id))}e[0]=a,e[1]=n,e[2]=s,e[3]=r,e[4]=i,e[5]=l,e[6]=h,e[7]=c}else l=e[5],h=e[6],c=e[7];if(c!==Symbol.for("react.early_return_sentinel"))return c;let u;return e[10]!==l||e[11]!==h?(u=o.jsx("div",{className:l,children:h}),e[10]=l,e[11]=h,e[12]=u):u=e[12],u}function gd(t){return t.id}function vd(t){const e=q.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=xe();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=He(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=jc(c);let d;e[6]!==u.tools?(d=u.tools.map(xd),e[6]=u.tools,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(ln,{items:m,selections:i,onToggle:r,emptyMessage:"No tools available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function xd(t){return{id:t.name,name:t.name,description:t.description,tags:o.jsx(Qc,{annotations:t.annotations,_meta:t._meta})}}function bd(t){const e=q.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=xe();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=He(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=Jc(c);let d;e[6]!==u.resources?(d=u.resources.map(Sd),e[6]=u.resources,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(ln,{items:m,selections:i,onToggle:r,emptyMessage:"No resources available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function Sd(t){return{id:t.name||t.uri,name:t.name||t.uri,description:t.description}}function yd(t){const e=q.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=xe();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=He(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=ah(c);let d;e[6]!==u.prompts?(d=u.prompts.map(wd),e[6]=u.prompts,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(ln,{items:m,selections:i,onToggle:r,emptyMessage:"No prompts available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function wd(t){return{id:t.name,name:t.name,description:t.description}}function Cd(t){const e=q.c(54),{currentConnection:s,activeTab:i,selectedId:r,formData:n,toggleTool:a,toggleResource:l,togglePrompt:h,toggleAllTools:c,toggleAllResources:u,toggleAllPrompts:d,onTabChange:m}=t,_=n[r],f=i==="tools"?_?.tools===null:i==="resources"?_?.resources===null:_?.prompts===null;let p;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==u||e[4]!==c?(p=()=>{i==="tools"?c(r):i==="resources"?u(r):d(r)},e[0]=i,e[1]=r,e[2]=d,e[3]=u,e[4]=c,e[5]=p):p=e[5];const g=p;let v;e[6]!==s.icon||e[7]!==s.title?(v=o.jsx(ds,{icon:s.icon,name:s.title,size:"sm",className:"shrink-0"}),e[6]=s.icon,e[7]=s.title,e[8]=v):v=e[8];let b;e[9]!==s.title?(b=o.jsx("h2",{className:"text-base font-semibold truncate",children:s.title}),e[9]=s.title,e[10]=b):b=e[10];let S;e[11]!==s.description?(S=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[11]=s.description,e[12]=S):S=e[12];let x;e[13]!==b||e[14]!==S?(x=o.jsxs("div",{className:"flex-1 min-w-0",children:[b,S]}),e[13]=b,e[14]=S,e[15]=x):x=e[15];let y;e[16]!==v||e[17]!==x?(y=o.jsx("div",{className:"px-6 pt-5 pb-4 shrink-0",children:o.jsxs("div",{className:"flex items-center gap-3",children:[v,x]})}),e[16]=v,e[17]=x,e[18]=y):y=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=[{id:"tools",label:"Tools"},{id:"resources",label:"Resources"},{id:"prompts",label:"Prompts"}],e[19]=k):k=e[19];let w;e[20]!==m?(w=L=>m(L),e[20]=m,e[21]=w):w=e[21];let N;e[22]!==i||e[23]!==w?(N=o.jsx(nh,{tabs:k,activeTab:i,onTabChange:w}),e[22]=i,e[23]=w,e[24]=N):N=e[24];const j=f?"Deselect all":"Select all";let T;e[25]!==g||e[26]!==j?(T=o.jsx("button",{type:"button",onClick:g,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:j}),e[25]=g,e[26]=j,e[27]=T):T=e[27];let M;e[28]!==T||e[29]!==N?(M=o.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border shrink-0",children:[N,T]}),e[28]=T,e[29]=N,e[30]=M):M=e[30];let R;e[31]!==i||e[32]!==n||e[33]!==r||e[34]!==a?(R=i==="tools"&&o.jsx(es,{fallback:Vi("Tools not supported by this server"),children:o.jsx(A.Suspense,{fallback:o.jsx(ci,{}),children:o.jsx(vd,{connectionId:r,selections:n[r]?n[r].tools:[],onToggle:(L,B)=>a(r,L,B)})})}),e[31]=i,e[32]=n,e[33]=r,e[34]=a,e[35]=R):R=e[35];let C;e[36]!==i||e[37]!==n||e[38]!==r||e[39]!==l?(C=i==="resources"&&o.jsx(es,{fallback:Vi("Resources not supported by this server"),children:o.jsx(A.Suspense,{fallback:o.jsx(ci,{}),children:o.jsx(bd,{connectionId:r,selections:n[r]?n[r].resources:[],onToggle:(L,B)=>l(r,L,B)})})}),e[36]=i,e[37]=n,e[38]=r,e[39]=l,e[40]=C):C=e[40];let D;e[41]!==i||e[42]!==n||e[43]!==r||e[44]!==h?(D=i==="prompts"&&o.jsx(es,{fallback:Vi("Prompts not supported by this server"),children:o.jsx(A.Suspense,{fallback:o.jsx(ci,{}),children:o.jsx(yd,{connectionId:r,selections:n[r]?n[r].prompts:[],onToggle:(L,B)=>h(r,L,B)})})}),e[41]=i,e[42]=n,e[43]=r,e[44]=h,e[45]=D):D=e[45];let E;e[46]!==R||e[47]!==C||e[48]!==D?(E=o.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[R,C,D]}),e[46]=R,e[47]=C,e[48]=D,e[49]=E):E=e[49];let I;return e[50]!==M||e[51]!==E||e[52]!==y?(I=o.jsxs(o.Fragment,{children:[y,M,E]}),e[50]=M,e[51]=E,e[52]=y,e[53]=I):I=e[53],I}function kd(t){const e=q.c(11),{connectionId:s,onAuthenticate:i,children:r}=t;let n;e[0]!==s?(n={connectionId:s},e[0]=s,e[1]=n):n=e[1];const a=ua(n);if(a.supportsOAuth&&!a.isAuthenticated){let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex items-center justify-center size-12 rounded-full bg-muted",children:o.jsx(bc,{size:22,className:"text-muted-foreground"})}),e[2]=c):c=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"Authorization required"}),o.jsx("p",{className:"text-xs text-muted-foreground max-w-xs",children:"This connection needs to be authorized before you can configure its tools and resources."})]}),e[3]=u):u=e[3];let d;e[4]!==s||e[5]!==i?(d=i&&o.jsx(se,{variant:"outline",size:"sm",onClick:()=>i(s),children:"Authorize"}),e[4]=s,e[5]=i,e[6]=d):d=e[6];let m;return e[7]!==d?(m=o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8 text-center",children:[c,u,d]}),e[7]=d,e[8]=m):m=e[8],m}let h;return e[9]!==r?(h=o.jsx(o.Fragment,{children:r}),e[9]=r,e[10]=h):h=e[10],h}function Nd(t){const e={};for(const s of t)e[s.connection_id]={tools:s.selected_tools,resources:s.selected_resources??null,prompts:s.selected_prompts??null};return e}function zn(t){return Object.entries(t).map(([e,s])=>({connection_id:e,selected_tools:s.tools,selected_resources:s.resources,selected_prompts:s.prompts}))}function jd(t,e){return e.type==="SET_ACTIVE_TAB"?{...t,activeTab:e.payload}:t}function Ed(t){const e=q.c(49),{open:s,onOpenChange:i,selectedId:r,form:n,connections:a,onAuthenticate:l}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={activeTab:"tools"},e[0]=h):h=e[0];const[c,u]=A.useReducer(jd,h),d=rn(r??"");let m;e[1]!==a?(m=a??[],e[1]=a,e[2]=m):m=e[2];let _;e[3]!==m?(_=Nd(m),e[3]=m,e[4]=_):_=e[4];const f=_;let p;e[5]!==n||e[6]!==f?(p=(z,V,W,U)=>{const G=f[z]?.[V];let $;G===null?$=U.filter(K=>K!==W):G?.includes(W)?$=G.filter(K=>K!==W):($=[...G??[],W],$.length===U.length&&($=null));const J={...f};J[z]?J[z]={...J[z]}:J[z]={tools:null,resources:null,prompts:null},J[z][V]=$,n.setValue("connections",zn(J),{shouldDirty:!0,shouldTouch:!0})},e[5]=n,e[6]=f,e[7]=p):p=e[7];const g=p;let v;e[8]!==n||e[9]!==f?(v=(z,V)=>{const U=f[z]?.[V]===null?[]:null,G={...f};G[z]?G[z]={...G[z]}:G[z]={tools:null,resources:null,prompts:null},G[z][V]=U,n.setValue("connections",zn(G),{shouldDirty:!0,shouldTouch:!0})},e[8]=n,e[9]=f,e[10]=v):v=e[10];const b=v;let S;e[11]!==g?(S=(z,V,W)=>g(z,"tools",V,W),e[11]=g,e[12]=S):S=e[12];const x=S;let y;e[13]!==g?(y=(z,V,W)=>g(z,"resources",V,W),e[13]=g,e[14]=y):y=e[14];const k=y;let w;e[15]!==g?(w=(z,V,W)=>g(z,"prompts",V,W),e[15]=g,e[16]=w):w=e[16];const N=w;let j;e[17]!==b?(j=z=>b(z,"tools"),e[17]=b,e[18]=j):j=e[18];const T=j;let M;e[19]!==b?(M=z=>b(z,"resources"),e[19]=b,e[20]=M):M=e[20];const R=M;let C;e[21]!==b?(C=z=>b(z,"prompts"),e[21]=b,e[22]=C):C=e[22];const D=C;if(!r||!d)return null;let E;e[23]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(ci,{}),e[23]=E):E=e[23];let I;e[24]===Symbol.for("react.memo_cache_sentinel")?(I=z=>u({type:"SET_ACTIVE_TAB",payload:z}),e[24]=I):I=e[24];let L;e[25]!==d||e[26]!==c.activeTab||e[27]!==f||e[28]!==r||e[29]!==D||e[30]!==R||e[31]!==T||e[32]!==N||e[33]!==k||e[34]!==x?(L=o.jsx(Cd,{currentConnection:d,activeTab:c.activeTab,selectedId:r,formData:f,toggleTool:x,toggleResource:k,togglePrompt:N,toggleAllTools:T,toggleAllResources:R,toggleAllPrompts:D,onTabChange:I},r),e[25]=d,e[26]=c.activeTab,e[27]=f,e[28]=r,e[29]=D,e[30]=R,e[31]=T,e[32]=N,e[33]=k,e[34]=x,e[35]=L):L=e[35];let B;e[36]!==l||e[37]!==r||e[38]!==L?(B=o.jsx(A.Suspense,{fallback:E,children:o.jsx(kd,{connectionId:r,onAuthenticate:l,children:L})}),e[36]=l,e[37]=r,e[38]=L,e[39]=B):B=e[39];let P;e[40]!==i?(P=o.jsx(th,{className:"px-6 py-4 border-t border-border shrink-0",children:o.jsx(se,{variant:"outline",onClick:()=>i(!1),children:"Done"})}),e[40]=i,e[41]=P):P=e[41];let O;e[42]!==B||e[43]!==P?(O=o.jsxs(nn,{className:"sm:max-w-2xl h-[75vh] max-h-[75vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[B,P]}),e[42]=B,e[43]=P,e[44]=O):O=e[44];let F;return e[45]!==i||e[46]!==s||e[47]!==O?(F=o.jsx(on,{open:s,onOpenChange:i,children:O}),e[45]=i,e[46]=s,e[47]=O,e[48]=F):F=e[48],F}const Ki={tools:null,resources:null,prompts:null},Td=Il.pick({status:!0,title:!0,description:!0,icon:!0,metadata:!0,connections:!0});function Rd(t){const s=new TextEncoder().encode(t),i=Array.from(s,r=>String.fromCharCode(r)).join("");return btoa(i)}function Dd(t){const e=q.c(11),{url:s,agentId:i}=t,[r,n]=A.useState(!1);let a;e[0]!==i||e[1]!==s?(a=async()=>{we("agent_connect_action",{agent_id:i,action:"copy_url"}),await navigator.clipboard.writeText(s),n(!0),_e.success("Agent URL copied to clipboard"),setTimeout(()=>n(!1),2e3)},e[0]=i,e[1]=s,e[2]=a):a=e[2];const l=a;let h;e[3]!==r?(h=r?o.jsx(Di,{size:20,className:"text-green-600"}):o.jsx(ji,{size:20}),e[3]=r,e[4]=h):h=e[4];const c=r?"Copied!":"Copy URL";let u;e[5]!==c?(u=o.jsx("span",{className:"text-xs font-medium",children:c}),e[5]=c,e[6]=u):u=e[6];let d;return e[7]!==l||e[8]!==h||e[9]!==u?(d=o.jsxs(se,{type:"button",variant:"outline",onClick:l,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[h,u]}),e[7]=l,e[8]=h,e[9]=u,e[10]=d):d=e[10],d}function Md(t){const e=q.c(8),{url:s,serverName:i,agentId:r}=t;let n;e[0]!==r||e[1]!==i||e[2]!==s?(n=()=>{we("agent_connect_action",{agent_id:r,action:"install_cursor"});const u=fa(i),m=Rd(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),_=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(u)}&config=${encodeURIComponent(m)}`;window.open(_,"_blank"),_e.success("Opening Cursor...")},e[0]=r,e[1]=i,e[2]=s,e[3]=n):n=e[3];const a=n;let l,h;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),h=o.jsx("span",{className:"text-xs font-medium",children:"Install on Cursor"}),e[4]=l,e[5]=h):(l=e[4],h=e[5]);let c;return e[6]!==a?(c=o.jsxs(se,{type:"button",variant:"outline",onClick:a,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[l,h]}),e[6]=a,e[7]=c):c=e[7],c}function Id(t){const e=q.c(12),{url:s,serverName:i,agentId:r}=t,[n,a]=A.useState(!1);let l;e[0]!==r||e[1]!==i||e[2]!==s?(l=async()=>{we("agent_connect_action",{agent_id:r,action:"install_claude_code"});const _=fa(i),p=JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Claude Code"}},null,2),g=`claude mcp add-json "${_}" '${p.replace(/'/g,"'\\''")}' --scope user`;await navigator.clipboard.writeText(g),a(!0),_e.success("Claude Code command copied to clipboard"),setTimeout(()=>a(!1),2e3)},e[0]=r,e[1]=i,e[2]=s,e[3]=l):l=e[3];const h=l;let c;e[4]!==n?(c=n?o.jsx(Di,{size:20,className:"text-green-600"}):o.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[4]=n,e[5]=c):c=e[5];const u=n?"Copied!":"Install on Claude Code";let d;e[6]!==u?(d=o.jsx("span",{className:"text-xs font-medium",children:u}),e[6]=u,e[7]=d):d=e[7];let m;return e[8]!==h||e[9]!==c||e[10]!==d?(m=o.jsxs(se,{type:"button",variant:"outline",onClick:h,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,d]}),e[8]=h,e[9]=c,e[10]=d,e[11]=m):m=e[11],m}function Ad({virtualMcp:t}){const{org:e}=xe(),s=He({connectionId:Bt,orgId:e.id,orgSlug:e.slug}),[i,r]=A.useState(null),[n,a]=A.useState(!1),[l,h]=A.useState(!1),c=t.id,u=t.title||`agent-${c.slice(0,8)}`,d=i?`bunx @decocms/typegen@latest --mcp ${c} --key ${i} --output client.ts`:`bunx @decocms/typegen@latest --mcp ${c} --key <api-key> --output client.ts`,m=async()=>{a(!0);try{const p=(await s.callTool({name:"API_KEY_CREATE",arguments:{name:`typegen-${u}`,permissions:{[c]:["*"]}}})).structuredContent?.key;if(!p)throw new Error("No key in response");r(p),we("agent_typegen_key_generated",{agent_id:c})}catch{we("agent_typegen_key_failed",{agent_id:c}),_e.error("Failed to generate API key")}finally{a(!1)}},_=async()=>{we("agent_connect_action",{agent_id:c,action:"typegen_copy_command",has_api_key:!!i}),await navigator.clipboard.writeText(d),h(!0),_e.success("Command copied to clipboard"),setTimeout(()=>h(!1),2e3)};return o.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Generate typed client"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Introspects this agent and writes a typed"," ",o.jsx("code",{className:"font-mono",children:"client.ts"})," you can import directly."]})]}),!i&&o.jsxs(se,{type:"button",variant:"outline",size:"sm",className:"shrink-0 gap-1.5",onClick:m,disabled:n,children:[n?o.jsx(Ie,{size:14,className:"animate-spin"}):o.jsx(rh,{size:14}),o.jsx("span",{children:n?"Generating…":"Generate API key"})]})]}),i&&o.jsx("p",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700",children:"Store this key securely — it won't be shown again."}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Generate client"}),o.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("code",{className:"min-w-0 flex-1 break-all font-mono text-xs text-muted-foreground",children:d}),o.jsx(se,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:_,children:l?o.jsx(Di,{size:12,className:"text-green-600"}):o.jsx(ji,{size:12})})]})}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Runtime variables"}),o.jsx(Bd,{apiKey:i,agentId:c})]})}function Bd(t){const e=q.c(21),{apiKey:s,agentId:i}=t,[r,n]=A.useState(!1),a=window.location.origin,l=s?`MESH_API_KEY=${s}`:"MESH_API_KEY=<api-key>",h=`MESH_BASE_URL=${a}`,c=`${l}
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-app-view-DzdWARcC.js","assets/index-BDWHZF4c.js","assets/index-DXHNyf1g.css","assets/pair-OadcxUG9.js","assets/agent-icon-B9_saWOv.js","assets/AlertCircle-DYsBkqgk.js","assets/Tool01-_70cqt2t.js","assets/XClose-BIyC5w2n.js","assets/RefreshCcw01-D9tZoyTd.js","assets/ArrowNarrowLeft-f4NsG2u2.js","assets/XCircle-C4cR7ffS.js","assets/ArrowUpRight-0SvsPZ4w.js","assets/ZapSquare-C5LgmBxA.js","assets/Users03-DQJCKjsg.js","assets/CheckCircle-CXidvOnE.js","assets/ChevronDown-T3J_FVZJ.js","assets/ChevronRight-CAh53MYi.js","assets/ChevronUp-BB9elRBQ.js","assets/DotsVertical-BzVzv-oX.js","assets/Container-CzTl4K2T.js","assets/Star01-DXGNUfAS.js","assets/Palette-DHavAHjq.js","assets/SearchMd-DESZBiw-.js","assets/index-BVSR2SFo.js","assets/tooltip-_WWA2f_Q.js","assets/X-D7XtWfgE.js","assets/LinkExternal01-w4yRWGwt.js","assets/Lock01-y59fY-pi.js","assets/Sun-27B3YKPV.js","assets/Play-iXdmlyAm.js","assets/Plus-CxFWwhW1.js","assets/Settings02-Hf6ZIRqV.js","assets/Shield01-BoHQvnPl.js","assets/Trash01-BFWH9msw.js","assets/User01-Cn3EgXS1.js","assets/Zap-5CNC0Ept.js","assets/index-DPbaB7jD.js","assets/use-copy-CkKvvrYW.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/dialog-CmncC-6K.js","assets/content-blocks-o63cs2vh.js","assets/types-3fOwpBiV.js","assets/constants-DFyn79Ih.js","assets/chat-context-BehWdIE_.js","assets/use-virtual-mcp-Ci2IQchC.js","assets/use-collections-CsI9zuvk.js","assets/use-ai-providers-CeAjYVgE.js","assets/use-decopilot-events-BJCOOgAS.js","assets/create-sse-subscription-CxkOgzKf.js","assets/use-tasks-CalaAWsj.js","assets/use-organization-settings-qeGEmxxb.js","assets/shell-layout-DSlnYQwS.js","assets/required-auth-layout-BDnZ49oa.js","assets/use-org-sso-D0sdE_Rr.js","assets/integration-icon-Cy5BK0qE.js","assets/use-mcp-tools-CLk_EUg4.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as Wt,r as A,p as Tl,q as Rl,e as q,s as xe,K as As,n as Vo,a as Ko,c as te,j as o,l as Ie,B as se,E as es,b as Ci,v as ai,f as At,d as Qr,w as Dl,x as _e,y as Ml,V as Il,t as we,z as qo,C as Al,D as Jt,F as Bl,G as Sn,L as Pl,H as Oi,I as Zs,J as ct,M as Go,P as Ll,_ as Ol,Q as Yo,R as Xo,T as zl,g as $l}from"./index-BDWHZF4c.js";import{C as Ee,u as Fl,w as Hl,A as Wl,T as Ul,a as Vl}from"./index-KELtbXYG.js";import{I as ds}from"./integration-icon-Cy5BK0qE.js";import{S as Bt,u as He,g as Jo,a as Zo}from"./constants-DFyn79Ih.js";import{u as yt,a as Kl}from"./use-virtual-mcp-Ci2IQchC.js";import{a as ql}from"./Users03-DQJCKjsg.js";import{u as Qo,a as lt,b as ki,c as Ni,t as Gl,d as yn}from"./chat-context-BehWdIE_.js";import{i as Bs}from"./AlertCircle-DYsBkqgk.js";import{i as Yl}from"./CheckCircle-CXidvOnE.js";import{n as wn,a as Xl}from"./ZapSquare-C5LgmBxA.js";import{i as Jl,a as Zl,b as Ql,c as ji,d as ec}from"./XCircle-C4cR7ffS.js";import{s as ls,i as tc}from"./XClose-BIyC5w2n.js";import{c as sc,r as ic,p as ea,f as Cn,a as rc,F as nc,t as kn,M as en,G as ta,L as oc,i as ac,b as lc,d as cc,e as hc}from"./pair-OadcxUG9.js";import{C as dc,a as Nn,b as jn,c as uc,d as fc,e as mc,f as _c}from"./command-8r7A67dg.js";import{P as Hs,a as Ws,b as Us}from"./popover-BY5xAQmF.js";import{i as Ts,a as pi,b as pc,c as gc,p as Ei,g as Ti,d as tn,e as sa,h as dr,f as zi,j as En,A as Tn,k as ia,l as vc,m as xc,n as bc,t as Sc,o as yc,q as ra,r as na,s as oa,u as aa,v as Rn,w as wc,x as Rs,y as Cc,z as kc,B as Nc,C as la}from"./agent-icon-B9_saWOv.js";import{u as us,a as jc}from"./use-mcp-tools-CLk_EUg4.js";import{u as Ec,a as Tc}from"./use-ai-providers-CeAjYVgE.js";import{g as Ut,c as Dn,u as Rc,b as ur,d as Dc,e as Mc,f as Ic,T as Ac}from"./index-FR3V6lrD.js";import{u as sn,i as Bc}from"./shell-layout-DSlnYQwS.js";import{i as Pc,P as at,u as Lc,c as Oc,d as zc,e as $c}from"./index-BVSR2SFo.js";import{u as ca,T as Ke,a as qe,b as Ge,c as Fc}from"./tooltip-_WWA2f_Q.js";import{u as Hc}from"./use-status-sounds-DyfabNoq.js";import{E as Ps}from"./empty-state-BoNuHRpQ.js";import{A as Wc,a as Uc,b as Vc,c as Kc,R as ha,d as qc,e as Gc}from"./accordion-Cd97pZzi.js";import{u as Ri,a as rn,b as Yc}from"./use-connection-c2fdn_Q4.js";import{g as Xc}from"./constants-DYjDD2hw.js";import{u as Jc,g as Zc}from"./types-3fOwpBiV.js";import{U as da}from"./user-BduM2bsi.js";import{T as Qc,u as ua}from"./tools-list-Dw6JwtIs.js";import{u as $i}from"./unwrap-tool-result-BYXdCQMg.js";import{s as fa,g as eh}from"./connection-slug-eyAPH6o3.js";import{A as ma,a as _a,b as pa,c as ga,d as va,e as xa,f as ba,g as Sa}from"./alert-dialog-OujxhZeA.js";import{D as th,a as nn,b as on,c as ya,d as wa}from"./dialog-CmncC-6K.js";import{C as sh,a as Mn}from"./card-B2FlHiSa.js";import{I as fs}from"./input-Bdzlyvmj.js";import{L as Ds}from"./label-Bw2PIYCj.js";import{S as ts,a as ss,b as is,c as rs,d as It}from"./select-CPOZtPOm.js";import{S as fr}from"./switch-BKqARx2z.js";import{T as In}from"./textarea-BDXFkTIX.js";import{i as li}from"./Play-iXdmlyAm.js";import{s as cs}from"./Plus-CxFWwhW1.js";import{a as ih}from"./Settings02-Hf6ZIRqV.js";import{t as Ca}from"./Tool01-_70cqt2t.js";import{s as mr}from"./Trash01-BFWH9msw.js";import{S as ka}from"./scroll-area-qCxE2hon.js";import{i as Na,a as rh}from"./SearchMd-DESZBiw-.js";import{C as nh}from"./collection-tabs-BPN7Casr.js";import{C as oh}from"./checkbox-ByEBQCLB.js";import{u as ah,T as Fi,a as lh,b as ch,c as Hi}from"./tabs-BqvlcXR7.js";import{D as hh,a as dh,b as uh}from"./drawer-DGcXLXQn.js";import{i as Di,t as _r}from"./ChevronDown-T3J_FVZJ.js";import{n as Vt}from"./LinkExternal01-w4yRWGwt.js";import{S as fh}from"./index-DPbaB7jD.js";import{D as ns,a as os,b as as,c as St,d as mh,e as _h,f as ph}from"./dropdown-menu-CDsPRIxB.js";import{i as ja}from"./RefreshCcw01-D9tZoyTd.js";import{V as gh}from"./view-mode-toggle-CAxEHNjr.js";import{G as vh}from"./lean-canvas-recruit-modal-BT4juGyz.js";import{M as xh}from"./select-model-BtIjEXHL.js";import{u as Vs,a as bh,b as Sh,c as yh,A as wh,d as Ch}from"./automation-list-row-DGv6wybK.js";import{i as Ls}from"./Zap-5CNC0Ept.js";import{S as kh}from"./search-input-B5lcLg8G.js";import"./use-navigate-to-agent-DY3jsv9_.js";import"./use-tasks-CalaAWsj.js";import"./use-collections-CsI9zuvk.js";import"./collection-search-Buik536F.js";import"./form-D2IsM6ud.js";import"./Star01-DXGNUfAS.js";import"./Lock01-y59fY-pi.js";import"./X-D7XtWfgE.js";import"./toggle-group-BNTZzdFS.js";import"./index-CETKIyXW.js";import"./question-004-sINsf4GQ.js";import"./ai-providers-logos-DD3qZ33J.js";import"./connection-card-B84kBAnY.js";import"./use-registry-connections-B3dA54zD.js";import"./use-organization-settings-qeGEmxxb.js";import"./useInfiniteQuery-_4aHbhXJ.js";import"./infiniteQueryObserver-DMzx8Ajh.js";import"./extract-connection-data-VJ13de98.js";import"./Container-CzTl4K2T.js";import"./connection-form-helpers-DXAccRFx.js";import"./use-infinite-scroll-C1mLbaq7.js";import"./useSuspenseInfiniteQuery-DEL5b49j.js";import"./badge-DpwrE1zH.js";import"./ChevronRight-CAh53MYi.js";import"./use-decopilot-events-BJCOOgAS.js";import"./create-sse-subscription-CxkOgzKf.js";import"./use-copy-CkKvvrYW.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./content-blocks-o63cs2vh.js";import"./Sun-27B3YKPV.js";import"./index-DJ4-TGQU.js";import"./ArrowNarrowLeft-f4NsG2u2.js";import"./ArrowUpRight-0SvsPZ4w.js";import"./ChevronUp-BB9elRBQ.js";import"./DotsVertical-BzVzv-oX.js";import"./Palette-DHavAHjq.js";import"./Shield01-BoHQvnPl.js";import"./User01-Cn3EgXS1.js";import"./skeleton-CIdd6LnB.js";import"./avatar-C_UGze8T.js";import"./index-CWU3080-.js";import"./collection-search-B9TJgiJz.js";import"./use-create-virtual-mcp-DG6IAqew.js";import"./task-status-CEH-hhyq.js";import"./required-auth-layout-BDnZ49oa.js";import"./use-org-sso-D0sdE_Rr.js";import"./collections-nZFIaO7A.js";import"./settings-section-CjgR1v3b.js";import"./formatDistanceToNow-Cb2QZZJn.js";function Nh(t,e){const s=Wt(e);return jh({filters:{...t,status:"pending"}},s).length}function An(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function jh(t={},e){const s=Wt(e).getMutationCache(),i=A.useRef(t),r=A.useRef(null);return r.current===null&&(r.current=An(s,t)),A.useEffect(()=>{i.current=t}),A.useSyncExternalStore(A.useCallback(n=>s.subscribe(()=>{const a=Tl(r.current,An(s,i.current));r.current!==a&&(r.current=a,Rl.schedule(n))}),[s]),()=>r.current,()=>r.current)}function Eh(t,e){const s=q.c(40),{org:i,locator:r}=xe();let n;s[0]!==i.id||s[1]!==i.slug?(n={connectionId:Bt,orgId:i.id,orgSlug:i.slug},s[0]=i.id,s[1]=i.slug,s[2]=n):n=s[2];const a=He(n),l=Wt();let h;s[3]!==t||s[4]!==i.id?(h=As.ensureTask(i.id,t),s[3]=t,s[4]=i.id,s[5]=h):h=s[5];let c;s[6]!==a||s[7]!==t?(c=async()=>(await a.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}})).structuredContent?.item??null,s[6]=a,s[7]=t,s[8]=c):c=s[8];const u=t.length>0;let d;s[9]!==h||s[10]!==c||s[11]!==u?(d={queryKey:h,queryFn:c,enabled:u,retry:!1,refetchOnWindowFocus:!1},s[9]=h,s[10]=c,s[11]=u,s[12]=d):d=s[12];const m=Vo(d);let _;s[13]!==a||s[14]!==e?(_=async x=>{const y=await a.callTool({name:"COLLECTION_THREADS_CREATE",arguments:{data:{id:x,virtual_mcp_id:e}}});if(y.isError){const w=y.content,N=Array.isArray(w)&&w[0]&&typeof w[0]=="object"?w[0].text??"Create failed":"Create failed";throw new Error(N)}return y.structuredContent.item},s[13]=a,s[14]=e,s[15]=_):_=s[15];let f;s[16]!==r||s[17]!==i.id||s[18]!==m||s[19]!==l?(f=()=>{l.invalidateQueries({predicate:x=>x.queryKey[1]===i.id&&x.queryKey[3]==="collection"&&x.queryKey[4]==="THREADS"}),l.invalidateQueries({queryKey:As.tasksPrefix(r)}),m.refetch()},s[16]=r,s[17]=i.id,s[18]=m,s[19]=l,s[20]=f):f=s[20];let p;s[21]!==_||s[22]!==f?(p={mutationFn:_,onSuccess:f},s[21]=_,s[22]=f,s[23]=p):p=s[23];const g=Ko(p);let v,b;if(s[24]!==g||s[25]!==t||s[26]!==m.data||s[27]!==m.isSuccess?(v=()=>{t&&(!m.isSuccess||m.data||g.isPending||g.variables!==t&&g.mutate(t))},b=[t,m.isSuccess,m.data,g],s[24]=g,s[25]=t,s[26]=m.data,s[27]=m.isSuccess,s[28]=v,s[29]=b):(v=s[28],b=s[29]),A.useEffect(v,b),!t){let x;return s[30]===Symbol.for("react.memo_cache_sentinel")?(x={status:"ready",task:null},s[30]=x):x=s[30],x}if(m.isLoading){let x;return s[31]===Symbol.for("react.memo_cache_sentinel")?(x={status:"loading"},s[31]=x):x=s[31],x}if(m.isError){const x=m.error;let y;return s[32]!==x?(y={status:"error",error:x},s[32]=x,s[33]=y):y=s[33],y}if(m.isSuccess&&m.data){let x;return s[34]!==m.data?(x={status:"ready",task:m.data},s[34]=m.data,s[35]=x):x=s[35],x}if(g.isPending||m.isSuccess&&!m.data){let x;return s[36]===Symbol.for("react.memo_cache_sentinel")?(x={status:"creating"},s[36]=x):x=s[36],x}if(g.isError){let x;return s[37]!==g.error?(x={status:"error",error:g.error},s[37]=g.error,s[38]=x):x=s[38],x}let S;return s[39]===Symbol.for("react.memo_cache_sentinel")?(S={status:"loading"},s[39]=S):S=s[39],S}function gs(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Bn(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function Th(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function Rh(t){const e=q.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(Dh),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==i?(r=o.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:i}),e[2]=i,e[3]=r):r=e[3],r}function Dh(t){return o.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[o.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),o.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function Mh(t){const e=q.c(30),{userTokens:s,assistantTokens:i,otherTokens:r}=t,n=s+i+r,a=n>0?s/n*100:0,l=n>0?i/n*100:0,h=n>0?r/n*100:0;let c;e[0]!==a?(c=a>0&&o.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=c):c=e[1];let u;e[2]!==l?(u=l>0&&o.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=u):u=e[3];let d;e[4]!==h?(d=h>0&&o.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${h}%`}}),e[4]=h,e[5]=d):d=e[5];let m;e[6]!==c||e[7]!==u||e[8]!==d?(m=o.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[c,u,d]}),e[6]=c,e[7]=u,e[8]=d,e[9]=m):m=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=_):_=e[10];let f;e[11]!==a?(f=a.toFixed(1),e[11]=a,e[12]=f):f=e[12];let p;e[13]!==f?(p=o.jsxs("div",{className:"flex items-center gap-1.5",children:[_,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",f,"%"]})]}),e[13]=f,e[14]=p):p=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[15]=g):g=e[15];let v;e[16]!==l?(v=l.toFixed(1),e[16]=l,e[17]=v):v=e[17];let b;e[18]!==v?(b=o.jsxs("div",{className:"flex items-center gap-1.5",children:[g,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Assistant ",v,"%"]})]}),e[18]=v,e[19]=b):b=e[19];let S;e[20]!==h||e[21]!==r?(S=r>0&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Other ",h.toFixed(1),"%"]})]}),e[20]=h,e[21]=r,e[22]=S):S=e[22];let x;e[23]!==b||e[24]!==S||e[25]!==p?(x=o.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[p,b,S]}),e[23]=b,e[24]=S,e[25]=p,e[26]=x):x=e[26];let y;return e[27]!==x||e[28]!==m?(y=o.jsxs("div",{className:"flex flex-col gap-2",children:[m,x]}),e[27]=x,e[28]=m,e[29]=y):y=e[29],y}function Ih(t){const e=q.c(19),{part:s}=t,i=s.input?.agent_id,r=yt(i),n=r?.title??"Subtask",a=r?.icon??null,l=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,h=s.state==="output-error",c=s.state==="approval-requested";let u;e[0]!==a||e[1]!==n?(u=o.jsx(ds,{icon:a,name:n,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=n,e[2]=u):u=e[2];const d=h?"text-destructive":"text-foreground";let m;e[3]!==d?(m=te("shrink-0 font-medium",d),e[3]=d,e[4]=m):m=e[4];let _;e[5]!==n||e[6]!==m?(_=o.jsx("span",{className:m,children:n}),e[5]=n,e[6]=m,e[7]=_):_=e[7];let f;e[8]!==s.input?(f=s.input?.prompt&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-muted-foreground/50",children:"·"}),o.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=f):f=e[9];let p;e[10]!==c||e[11]!==h||e[12]!==l?(p=o.jsx("span",{className:"ml-auto shrink-0",children:l?o.jsx(Ie,{size:12,className:"animate-spin text-muted-foreground"}):h?o.jsx(Jl,{size:12,className:"text-destructive"}):c?o.jsx(Bs,{size:12,className:"text-warning"}):o.jsx(Yl,{size:12,className:"text-emerald-500"})}),e[10]=c,e[11]=h,e[12]=l,e[13]=p):p=e[13];let g;return e[14]!==u||e[15]!==_||e[16]!==f||e[17]!==p?(g=o.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[u,_,f,p]}),e[14]=u,e[15]=_,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function Ah(t){const e=q.c(58),{onClose:s,back:i,className:r}=t,[n,a]=A.useState(null),{messages:l}=Qo(),{tasks:h,taskId:c}=lt(),{selectedModel:u,selectedVirtualMcp:d}=ki();let m,_,f,p,g,v,b,S;if(e[0]!==i||e[1]!==r||e[2]!==l||e[3]!==s||e[4]!==n?.id||e[5]!==u||e[6]!==d?.title||e[7]!==c||e[8]!==h){S=Symbol.for("react.early_return_sentinel");e:{let k;e[17]!==c?(k=Z=>Z.id===c,e[17]=c,e[18]=k):k=e[18];const w=h.find(k),N=sc(l),j=[...l].reverse().find(Vh),T=j?.metadata?.usage,M=j?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,R=T?.contextTokens??T?.totalTokens??0,C=M&&M>0?(R/M*100).toFixed(1):null,D=l;let E;e[19]!==D?(E=D.filter(Uh).reduce(Wh,0),e[19]=D,e[20]=E):E=e[20];const I=E,L=l;let B;e[21]!==L?(B=L.filter(Hh).reduce(Fh,0),e[21]=L,e[22]=B):B=e[22];const P=B,O=Math.max(0,N.totalTokens-I-P),F=l[0],z=l.at(-1),V=F?.metadata?.created_at??w?.created_at,W=z?.metadata?.created_at??w?.updated_at,U=l.filter($h),G=l.flatMap(Oh),$=u?.modelId?Th(u.modelId):"—",J=d?.title??"Decopilot",K=[{label:"Session",value:w?.title??"New chat"},{label:"Messages",value:U.length},{label:"Agent",value:J},{label:"Model",value:$},{label:"Context Limit",value:M?gs(M):"—"},{label:"Session Tokens (billed)",value:N.totalTokens>0?gs(N.totalTokens):"0"},{label:"Usage",value:C!==null?`${C}%`:"—"},{label:"Input Tokens",value:N.inputTokens>0?gs(N.inputTokens):"0"},{label:"Output Tokens",value:N.outputTokens>0?gs(N.outputTokens):"0"},{label:"Reasoning Tokens",value:N.reasoningTokens>0?gs(N.reasoningTokens):"0"},{label:"Cost",value:N.cost>0?`$${N.cost<.001?N.cost.toFixed(6):N.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:Bn(V)},{label:"Last Activity",value:Bn(W)}];if(!w&&U.length===0){let Z;e[23]!==r?(Z=te("flex flex-col h-full w-full border-l border-border bg-background",r),e[23]=r,e[24]=Z):Z=e[24];let ue;e[25]===Symbol.for("react.memo_cache_sentinel")?(ue=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[25]=ue):ue=e[25];let de;e[26]!==i?(de=i?o.jsx(wn,{size:14,className:"text-muted-foreground"}):o.jsx(ls,{size:14,className:"text-muted-foreground"}),e[26]=i,e[27]=de):de=e[27];let he;e[28]!==s||e[29]!==de?(he=o.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[ue,o.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:de})]}),e[28]=s,e[29]=de,e[30]=he):he=e[30];let pe;e[31]===Symbol.for("react.memo_cache_sentinel")?(pe=o.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a conversation to see context"})}),e[31]=pe):pe=e[31];let We;e[32]!==Z||e[33]!==he?(We=o.jsxs("div",{className:Z,children:[he,pe]}),e[32]=Z,e[33]=he,e[34]=We):We=e[34],S=We;break e}e[35]!==r?(v=te("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",r),e[35]=r,e[36]=v):v=e[36];let ee;e[37]===Symbol.for("react.memo_cache_sentinel")?(ee=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[37]=ee):ee=e[37];let oe;e[38]!==i?(oe=i?o.jsx(wn,{size:14}):o.jsx(ls,{size:14}),e[38]=i,e[39]=oe):oe=e[39],e[40]!==s||e[41]!==oe?(b=o.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[ee,o.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:oe})]}),e[40]=s,e[41]=oe,e[42]=b):b=e[42],m="flex flex-col gap-8 p-6",_=G.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Subtasks"}),o.jsx("div",{className:"flex flex-col gap-1",children:G.map(Lh)})]}),f=o.jsx(Rh,{items:K});let ie;e[43]===Symbol.for("react.memo_cache_sentinel")?(ie=o.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[43]=ie):ie=e[43],e[44]!==P||e[45]!==O||e[46]!==I?(p=o.jsxs("div",{className:"flex flex-col gap-3",children:[ie,o.jsx(Mh,{userTokens:I,assistantTokens:P,otherTokens:O})]}),e[44]=P,e[45]=O,e[46]=I,e[47]=p):p=e[47],g=U.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Raw messages"}),o.jsx("div",{className:"flex flex-col gap-1",children:U.map(Z=>{const ue=Z.metadata?.created_at,de=n?.id===Z.id;return o.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o.jsxs("button",{type:"button",onClick:()=>a(de?null:Z),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("span",{className:te("shrink-0 font-medium",Z.role==="user"?"text-chart-1":"text-chart-2"),children:Z.role}),o.jsx("span",{className:"text-muted-foreground",children:"•"}),o.jsx("span",{className:"truncate text-muted-foreground font-mono",children:Z.id})]}),ue&&o.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(ue).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),de&&o.jsxs(o.Fragment,{children:[Z.role==="assistant"&&(()=>{const he=Z.metadata?._request;if(!he)return null;const pe=he.systemSections??[],We=Math.max(1,...pe.map(Ph)),Be=pe.reduce(Bh,0);return o.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"font-medium text-foreground",children:"Request"}),o.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[he.activeTools??0," / ",he.tools??0," ","tools active"]})]}),pe.length>0&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"text-muted-foreground",children:["System prompt"," ",o.jsxs("span",{className:"tabular-nums",children:["~",Math.round(Be/4).toLocaleString()," ","tok"]})]}),pe.map((re,ge)=>{const Je=re.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${ge}`,fe=re.chars/We*100,kt=Math.round(re.chars/4);return o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"font-mono text-foreground truncate",children:Je}),o.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",kt.toLocaleString()," tok"]})]}),o.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${fe}%`}})})]},ge)})]})]})})(),o.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(Z,null,2)})]})]},Z.id)})})]})}e[0]=i,e[1]=r,e[2]=l,e[3]=s,e[4]=n?.id,e[5]=u,e[6]=d?.title,e[7]=c,e[8]=h,e[9]=m,e[10]=_,e[11]=f,e[12]=p,e[13]=g,e[14]=v,e[15]=b,e[16]=S}else m=e[9],_=e[10],f=e[11],p=e[12],g=e[13],v=e[14],b=e[15],S=e[16];if(S!==Symbol.for("react.early_return_sentinel"))return S;let x;e[48]!==m||e[49]!==_||e[50]!==f||e[51]!==p||e[52]!==g?(x=o.jsxs("div",{className:m,children:[_,f,p,g]}),e[48]=m,e[49]=_,e[50]=f,e[51]=p,e[52]=g,e[53]=x):x=e[53];let y;return e[54]!==v||e[55]!==b||e[56]!==x?(y=o.jsxs("div",{className:v,children:[b,x]}),e[54]=v,e[55]=b,e[56]=x,e[57]=y):y=e[57],y}function Bh(t,e){return t+e.chars}function Ph(t){return t.chars}function Lh(t,e){return o.jsx(Ih,{part:t},e)}function Oh(t){return(t.parts??[]).filter(zh)}function zh(t){return t.type==="tool-subtask"}function $h(t){return t.role!=="system"}function Fh(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function Hh(t){return t.role==="assistant"}function Wh(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function Uh(t){return t.role==="user"}function Vh(t){return t.role==="assistant"&&t.metadata?.usage}const Pn=["amber","bold","bright","calm","crimson","coral","daring","deep","dusty","eager","faint","fierce","frozen","gentle","golden","grand","green","hollow","iron","ivory","keen","lasting","lunar","mellow","misty","noble","olive","pale","prime","quiet","rapid","rustic","serene","sharp","silver","sleek","solar","stark","still","swift","tawny","tender","thin","true","vast","velvet","warm","wild","young","zen"],Ln=["anchor","birch","brook","cedar","cliff","cove","crane","dune","echo","ember","falcon","fern","flint","forge","frost","glade","grove","harbor","hawk","iris","jade","lark","maple","marsh","mesa","opal","orbit","peak","pine","plume","quartz","rapids","reef","ridge","river","sage","shore","slate","spruce","stone","summit","thorn","tide","trail","vale","wren","aspen","delta","crest","spark"];function Kh(){const t=Pn[Math.floor(Math.random()*Pn.length)],e=Ln[Math.floor(Math.random()*Ln.length)];return`deco/${t}-${e}`}function qh(t){const e=t;if(e.structuredContent)return e.structuredContent;const s=e.content?.find(i=>i.type==="text")?.text;if(s)try{return JSON.parse(s)}catch{return[]}return[]}function Gh(t){const e=q.c(26),{orgId:s,orgSlug:i,userId:r,connectionId:n,vmMap:a,owner:l,repo:h,enabled:c}=t,u=c===void 0?!0:c,d=n??null;let m;e[0]!==s||e[1]!==i||e[2]!==d?(m={connectionId:d,orgId:s,orgSlug:i},e[0]=s,e[1]=i,e[2]=d,e[3]=m):m=e[3];const _=He(m);let f;e[4]!==l||e[5]!==h?(f={owner:l,repo:h},e[4]=l,e[5]=h,e[6]=f):f=e[6];const p=u&&!!n&&!!l&&!!h;let g;e[7]!==_||e[8]!==f||e[9]!==p?(g={client:_,toolName:"list_branches",toolArguments:f,enabled:p,staleTime:3e4,select:Zh},e[7]=_,e[8]=f,e[9]=p,e[10]=g):g=e[10];const{data:v,isLoading:b,isError:S}=us(g);let x,y;e[11]!==r||e[12]!==a?(y=new Set(Object.keys(a?.[r]??{})),x=[...y].sort().map(Jh),e[11]=r,e[12]=a,e[13]=x,e[14]=y):(x=e[13],y=e[14]);const k=x;let w;if(e[15]!==v||e[16]!==y){const M=Array.isArray(v)?v:v?.branches??[];let R;e[18]!==y?(R=C=>!y.has(C.name),e[18]=y,e[19]=R):R=e[19],w=M.filter(Xh).filter(R).map(Yh),e[15]=v,e[16]=y,e[17]=w}else w=e[17];const N=w,j=Array.isArray(v)?null:v?.default_branch??null;let T;return e[20]!==j||e[21]!==S||e[22]!==b||e[23]!==N||e[24]!==k?(T={yours:k,others:N,defaultBase:j,isLoading:b,isError:S},e[20]=j,e[21]=S,e[22]=b,e[23]=N,e[24]=k,e[25]=T):T=e[25],T}function Yh(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function Xh(t){return typeof t.name=="string"}function Jh(t){return{name:t,source:"yours"}}function Zh(t){return qh(t)}function Qh(t){const e=q.c(42),{orgId:s,orgSlug:i,userId:r,connectionId:n,owner:a,repo:l,vmMap:h,value:c,onChange:u}=t,[d,m]=A.useState(!1);let _;e[0]!==n||e[1]!==d||e[2]!==s||e[3]!==i||e[4]!==a||e[5]!==l||e[6]!==r||e[7]!==h?(_={orgId:s,orgSlug:i,userId:r,connectionId:n,vmMap:h,owner:a,repo:l,enabled:d},e[0]=n,e[1]=d,e[2]=s,e[3]=i,e[4]=a,e[5]=l,e[6]=r,e[7]=h,e[8]=_):_=e[8];const{yours:f,others:p,isLoading:g,isError:v}=Gh(_);let b;e[9]!==u?(b=I=>{u(I),m(!1)},e[9]=u,e[10]=b):b=e[10];const S=b,x=c??"Select branch…";let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Ts,{className:"h-3.5 w-3.5"}),e[11]=y):y=e[11];let k;e[12]!==x?(k=o.jsx(Hs,{asChild:!0,children:o.jsxs(se,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 font-mono text-xs",children:[y,o.jsx("span",{className:"max-w-[200px] truncate",children:x})]})}),e[12]=x,e[13]=k):k=e[13];let w;e[14]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(fc,{placeholder:"Search branches…"}),e[14]=w):w=e[14];let N;e[15]!==S?(N=o.jsxs("div",{className:"flex items-center border-b pr-2 [&>[data-slot=command-input-wrapper]]:flex-1 [&>[data-slot=command-input-wrapper]]:border-b-0",children:[w,o.jsx(se,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>S(Kh()),children:"New"})]}),e[15]=S,e[16]=N):N=e[16];let j;e[17]!==v?(j=v&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"Couldn't load branches from GitHub. You can still pick from your branches."}),e[17]=v,e[18]=j):j=e[18];let T;e[19]!==v||e[20]!==g||e[21]!==p.length||e[22]!==f.length?(T=!v&&!g&&f.length===0&&p.length===0&&o.jsx(dc,{children:"No branches found."}),e[19]=v,e[20]=g,e[21]=p.length,e[22]=f.length,e[23]=T):T=e[23];let M;e[24]!==S||e[25]!==f?(M=f.length>0&&o.jsx(Nn,{heading:"Your branches",children:f.map(I=>o.jsxs(jn,{value:I.name,onSelect:()=>S(I.name),children:[o.jsx(Ts,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:I.name})]},I.name))}),e[24]=S,e[25]=f,e[26]=M):M=e[26];let R;e[27]!==p||e[28]!==S?(R=p.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(uc,{}),o.jsx(Nn,{heading:"Other branches in repo",children:p.map(I=>o.jsxs(jn,{value:I.name,onSelect:()=>S(I.name),children:[o.jsx(Ts,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:I.name}),I.author&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",I.author]})]},I.name))})]}),e[27]=p,e[28]=S,e[29]=R):R=e[29];let C;e[30]!==R||e[31]!==j||e[32]!==T||e[33]!==M?(C=o.jsxs(mc,{children:[j,T,M,R]}),e[30]=R,e[31]=j,e[32]=T,e[33]=M,e[34]=C):C=e[34];let D;e[35]!==C||e[36]!==N?(D=o.jsx(Ws,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:o.jsxs(_c,{children:[N,C]})}),e[35]=C,e[36]=N,e[37]=D):D=e[37];let E;return e[38]!==d||e[39]!==D||e[40]!==k?(E=o.jsxs(Us,{open:d,onOpenChange:m,children:[k,D]}),e[38]=d,e[39]=D,e[40]=k,e[41]=E):E=e[41],E}function ed(){const t=q.c(27),{org:e}=xe(),{selectedVirtualMcp:s}=ki(),{data:i}=Ci.useSession(),{currentBranch:r,setCurrentTaskBranch:n}=lt();let a;t[0]!==e.id?(a=Jo(e.id),t[0]=e.id,t[1]=a):a=t[1];const h=s??a,c=yt(h.id),u=i?.user?.id??"",d=c?.metadata?.githubRepo??null,m=!!d?.connectionId&&!!u;let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(ql,{size:32}),t[2]=_):_=t[2];let f;t[3]!==h.icon||t[4]!==h.title?(f=o.jsx(ds,{icon:h.icon,name:h.title,size:"lg",fallbackIcon:_,className:"size-10 min-w-10 md:size-[60px]! md:min-w-[60px] rounded-xl md:rounded-[18px]!"}),t[3]=h.icon,t[4]=h.title,t[5]=f):f=t[5];let p;t[6]!==h.title?(p=o.jsx("h3",{className:"text-base md:text-xl font-medium text-foreground",children:h.title}),t[6]=h.title,t[7]=p):p=t[7];const g=h.description??"Ask anything about configuring model providers or using MCP Mesh.";let v;t[8]!==g?(v=o.jsx("div",{className:"text-muted-foreground text-center text-base max-w-md line-clamp-2",children:g}),t[8]=g,t[9]=v):v=t[9];let b;t[10]!==r||t[11]!==c?.metadata?.vmMap||t[12]!==d||t[13]!==e.id||t[14]!==e.slug||t[15]!==n||t[16]!==m||t[17]!==u?(b=m&&o.jsx("div",{className:"mt-2",children:o.jsx(Qh,{orgId:e.id,orgSlug:e.slug,userId:u,connectionId:d.connectionId,owner:d.owner,repo:d.name,vmMap:c?.metadata?.vmMap,value:r??void 0,onChange:n})}),t[10]=r,t[11]=c?.metadata?.vmMap,t[12]=d,t[13]=e.id,t[14]=e.slug,t[15]=n,t[16]=m,t[17]=u,t[18]=b):b=t[18];let S;t[19]!==f||t[20]!==p||t[21]!==v||t[22]!==b?(S=o.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[f,p,v,b]}),t[19]=f,t[20]=p,t[21]=v,t[22]=b,t[23]=S):S=t[23];let x;t[24]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("div",{className:"w-full max-w-3xl mx-auto",children:o.jsx(Ee.IceBreakers,{})}),t[24]=x):x=t[24];let y;return t[25]!==S?(y=o.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center gap-6 px-4",children:[S,x]}),t[25]=S,t[26]=y):y=t[26],y}function td(){const t=q.c(26),{org:e}=xe(),s=Ec(),{isChatEmpty:i}=Qo(),[r,n]=A.useState("chat"),a=Fl();if(s.length===0){let S;return t[0]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Ee,{className:"animate-in fade-in-0 duration-200",children:o.jsx(Ee.Main,{className:"flex flex-col items-center",children:o.jsx(Ee.EmptyState,{children:o.jsx(Ee.NoAiProviderEmptyState,{})})})}),t[0]=S):S=t[0],S}let l;t[1]!==a.hasDecoKey||t[2]!==a.hasOnlyDecoProvider||t[3]!==a.isLoading||t[4]!==a.isZeroBalance||t[5]!==i||t[6]!==e?(l=a.hasDecoKey&&a.isZeroBalance&&a.hasOnlyDecoProvider&&!a.isLoading&&i&&!Hl(e.id),t[1]=a.hasDecoKey,t[2]=a.hasOnlyDecoProvider,t[3]=a.isLoading,t[4]=a.isZeroBalance,t[5]=i,t[6]=e,t[7]=l):l=t[7];const h=l;let c;t[8]!==h?(c=h&&o.jsx(Ee.CreditsEmptyState,{}),t[8]=h,t[9]=c):c=t[9];const u=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let d;t[10]!==u?(d=te("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",u),t[10]=u,t[11]=d):d=t[11];let m;t[12]!==i?(m=i?o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(ed,{})}),o.jsx(Ee.Footer,{children:o.jsx(Ee.Input,{onOpenContextPanel:()=>n("context")})})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(Ee.Messages,{})}),o.jsx(Ee.Footer,{children:o.jsx(Ee.Input,{onOpenContextPanel:()=>n("context")})})]}),t[12]=i,t[13]=m):m=t[13];let _;t[14]!==d||t[15]!==m?(_=o.jsx("div",{className:d,children:m}),t[14]=d,t[15]=m,t[16]=_):_=t[16];const f=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let p;t[17]!==f?(p=te("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",f),t[17]=f,t[18]=p):p=t[18];let g;t[19]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(Ah,{back:!0,onClose:()=>n("chat")}),t[19]=g):g=t[19];let v;t[20]!==p?(v=o.jsx("div",{className:p,children:g}),t[20]=p,t[21]=v):v=t[21];let b;return t[22]!==c||t[23]!==_||t[24]!==v?(b=o.jsxs(Ee,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[c,_,v]}),t[22]=c,t[23]=_,t[24]=v,t[25]=b):b=t[25],b}function Ea(){const t=q.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(Ee.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(es,{fallback:e,children:o.jsx(A.Suspense,{fallback:o.jsx(Ee.Skeleton,{}),children:o.jsx(td,{})})}),t[1]=s):s=t[1],s}async function sd(t,e,s){const i=await t.callTool({name:e,arguments:s});if(i.isError){const r=i.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(r)}return i}const Ta=["VM_START"],Qs=new Map,id=t=>`${t.virtualMcpId}::${t.branch??""}`,Wi=new Set,gi={mark:(t,e)=>Wi.add(`${t}::${e}`),clear:(t,e)=>Wi.delete(`${t}::${e}`),isStopped:(t,e)=>Wi.has(`${t}::${e}`)};function an(t){const e=Wt();return Ko({mutationKey:Ta,mutationFn:async s=>{s.branch&&gi.clear(s.virtualMcpId,s.branch);const i=id(s),r=Qs.get(i);if(r)return r;const n=(async()=>(await sd(t,"VM_START",s)).structuredContent)();Qs.set(i,n);try{return await n}finally{Qs.get(i)===n&&Qs.delete(i)}},onSuccess:()=>{ai(e)}})}function Ra(t,e){const s=q.c(3);let i;return s[0]!==e||s[1]!==t?(i={mutationKey:Ta,predicate:n=>{if(!t)return!1;const a=n.state.variables;return!a||a.virtualMcpId!==t?!1:(a.branch??"")===(e??"")}},s[0]=e,s[1]=t,s[2]=i):i=s[2],Nh(i)>0}const rd={settings:gc,automations:pc,env:pi,preview:Zl,git:Ts};function On(t){const e=Ei(t);if(e.type==="icon"){const s=Ti(e.name);return s?{kind:"component",Component:s}:null}return e.type==="url"?{kind:"url",src:e.url}:null}function Ui(t){if(t.kind==="system")return{kind:"component",Component:rd[t.tabId]};const e=On(t.iconUrl);if(e)return e;if(!t.appId)return{kind:"fallback"};const s=t.connections.find(r=>r.id===t.appId);if(!s)return{kind:"fallback"};const i=On(s.icon);return i||{kind:"fallback"}}function nd(t){const{org:e}=xe(),s=He({connectionId:Bt,orgId:e.id,orgSlug:e.slug}),{data:i}=Dl({queryKey:As.threadMetadata(t),queryFn:async()=>{if(!s||!t)return null;try{const r=await s.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}});return(r.structuredContent??r).item?.metadata??null}catch{return null}},staleTime:3e4});return i}function Da(t){const e=q.c(8),s=At();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const r=Qr(i),n=yt(t.virtualMcpId),a=nd(t.taskId),{currentBranch:l}=lt(),h=n?.metadata?.ui??null,c=h?.layout??null,u=c?.tabs??[],d=h?.pinnedViews??[],m=a?.expanded_tools??[],_=!!(n&&Ut(n));let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f={includeVirtual:!0},e[1]=f):f=e[1];const p=Ri(f),{activeTab:g,mainOpen:v}=ic({mainParam:r.main,metadata:c?{defaultMainView:c.defaultMainView??null,tabs:u.map(od)}:null}),b=ea(g),S=[];_&&(S.push({id:"preview",title:"Preview"}),S.push({id:"env",title:"Terminal"}),S.push({id:"git",title:l??"git"})),S.push({id:"settings",title:"Settings"}),S.push({id:"automations",title:"Automations"});const x=new Map;for(const j of m){const T=Cn(j.appId,j.toolName);x.set(T,{id:T,title:j.toolName,appId:j.appId,iconKey:j.toolName})}for(const j of d){const T=Cn(j.connectionId,j.toolName);x.set(T,{id:T,title:j.label||j.toolName,appId:j.connectionId,iconKey:j.toolName,iconUrl:j.icon??null})}let y;e[2]!==p?(y=j=>({id:j.id,title:j.title,kind:"agent",icon:Ui({tabId:j.id,kind:"agent",appId:j.view.appId,connections:p})}),e[2]=p,e[3]=y):y=e[3];const k=[...u.map(y),...Array.from(x.values()).map(j=>({id:j.id,title:j.title,kind:"expanded",icon:Ui({tabId:j.iconKey,kind:"expanded",appId:j.appId,iconUrl:j.iconUrl,connections:p})})),...S.map(j=>({id:j.id,title:j.title,kind:"system",icon:Ui({tabId:j.id,kind:"system",connections:p})}))];let w;return e[4]!==g||e[5]!==v||e[6]!==s?(w=j=>{const T=rc({clickedId:j,activeTab:g,mainOpen:v});s({to:".",search:M=>({...M,main:T}),replace:!0})},e[4]=g,e[5]=v,e[6]=s,e[7]=w):w=e[7],{activeTab:g,mainOpen:v,setActiveTab:w,systemTabs:S,layoutTabs:u,expandedTools:m,automationTabParsed:b,tabs:k}}function od(t){return{id:t.id}}function ad(t){const e=q.c(84),{value:s,onChange:i,onColorChange:r,name:n,size:a,className:l,avatarClassName:h,showHoverOverlay:c,disabled:u}=t,d=a===void 0?"lg":a,m=c===void 0?!0:c,_=u===void 0?!1:u,[f,p]=A.useState(!1),[g,v]=A.useState("icons"),[b,S]=A.useState(""),[x,y]=A.useState("blue");let k;e[0]!==s?(k=Ei(s),e[0]=s,e[1]=k):k=e[1];const w=k,N=w.type==="icon"||w.type==="url"&&w.color?w.color:x;let j;e[2]!==i||e[3]!==N?(j=fe=>{i(zi(fe,N))},e[2]=i,e[3]=N,e[4]=j):j=e[4];const T=j;let M;e[5]!==i||e[6]!==r||e[7]!==w.name||e[8]!==w.type||e[9]!==w.url?(M=fe=>{y(fe),r?.(fe),w.type==="icon"?i(zi(w.name,fe)):w.type==="url"&&i(En(w.url,fe))},e[5]=i,e[6]=r,e[7]=w.name,e[8]=w.type,e[9]=w.url,e[10]=M):M=e[10];const R=M;let C;e[11]!==i||e[12]!==N?(C=fe=>{i(En(fe,N)),p(!1)},e[11]=i,e[12]=N,e[13]=C):C=e[13];const D=C;let E;e[14]!==i||e[15]!==N?(E=()=>{const fe=tn(),kt=fe[Math.floor(Math.random()*fe.length)];i(zi(kt,N))},e[14]=i,e[15]=N,e[16]=E):E=e[16];const I=E;let L,B,P,O,F,z,V,W;if(e[17]!==l||e[18]!==_||e[19]!==f||e[20]!==d){const fe={xs:"rounded-md",sm:"rounded-lg","sm+":"rounded-xl",md:"rounded-xl",lg:"rounded-2xl",xl:"rounded-2xl"};B=Us,z=_?!1:f,V=p,L=Hs,F=!0,W="button",P=_,O=te("relative group overflow-hidden",_?"cursor-default opacity-50":"cursor-pointer",fe[d],l),e[17]=l,e[18]=_,e[19]=f,e[20]=d,e[21]=L,e[22]=B,e[23]=P,e[24]=O,e[25]=F,e[26]=z,e[27]=V,e[28]=W}else L=e[21],B=e[22],P=e[23],O=e[24],F=e[25],z=e[26],V=e[27],W=e[28];let U;e[29]!==h||e[30]!==n||e[31]!==d||e[32]!==s?(U=o.jsx(Tn,{icon:s,name:n,size:d,className:h}),e[29]=h,e[30]=n,e[31]=d,e[32]=s,e[33]=U):U=e[33];let G;e[34]!==_||e[35]!==m?(G=m&&!_&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity",children:o.jsx(ia,{size:16,className:"text-white"})}),e[34]=_,e[35]=m,e[36]=G):G=e[36];let $;e[37]!==P||e[38]!==O||e[39]!==U||e[40]!==G||e[41]!==W?($=o.jsxs("button",{type:W,disabled:P,className:O,children:[U,G]}),e[37]=P,e[38]=O,e[39]=U,e[40]=G,e[41]=W,e[42]=$):$=e[42];let J;e[43]!==L||e[44]!==F||e[45]!==$?(J=o.jsx(L,{asChild:F,children:$}),e[43]=L,e[44]=F,e[45]=$,e[46]=J):J=e[46];let K;e[47]!==n||e[48]!==s?(K=o.jsx("div",{className:"flex items-center justify-center py-4",children:o.jsx(Tn,{icon:s,name:n,size:"xl"})}),e[47]=n,e[48]=s,e[49]=K):K=e[49];let ee;e[50]===Symbol.for("react.memo_cache_sentinel")?(ee=()=>v("icons"),e[50]=ee):ee=e[50];const oe=g==="icons"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let ie;e[51]!==oe?(ie=te("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",oe),e[51]=oe,e[52]=ie):ie=e[52];let Z;e[53]!==ie?(Z=o.jsx("button",{type:"button",onClick:ee,className:ie,children:"Icons"}),e[53]=ie,e[54]=Z):Z=e[54];let ue;e[55]===Symbol.for("react.memo_cache_sentinel")?(ue=()=>v("upload"),e[55]=ue):ue=e[55];const de=g==="upload"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let he;e[56]!==de?(he=te("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",de),e[56]=de,e[57]=he):he=e[57];let pe;e[58]!==he?(pe=o.jsx("button",{type:"button",onClick:ue,className:he,children:"Upload"}),e[58]=he,e[59]=pe):pe=e[59];let We;e[60]===Symbol.for("react.memo_cache_sentinel")?(We=o.jsx("div",{className:"flex-1"}),e[60]=We):We=e[60];let Be;e[61]!==Z||e[62]!==pe?(Be=o.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[Z,pe,We]}),e[61]=Z,e[62]=pe,e[63]=Be):Be=e[63];let re;e[64]!==R||e[65]!==I||e[66]!==T||e[67]!==D||e[68]!==w.name||e[69]!==w.type||e[70]!==b||e[71]!==N||e[72]!==g?(re=g==="icons"?o.jsx(dd,{search:b,onSearchChange:S,selectedColor:N,onColorChange:R,onSelectIcon:T,onRandom:I,currentIconName:w.type==="icon"?w.name:null}):o.jsx(ud,{onUpload:D}),e[64]=R,e[65]=I,e[66]=T,e[67]=D,e[68]=w.name,e[69]=w.type,e[70]=b,e[71]=N,e[72]=g,e[73]=re):re=e[73];let ge;e[74]!==K||e[75]!==Be||e[76]!==re?(ge=o.jsx(Ws,{align:"start",className:"w-80 p-0",onOpenAutoFocus:ld,children:o.jsxs("div",{className:"flex flex-col",children:[K,Be,re]})}),e[74]=K,e[75]=Be,e[76]=re,e[77]=ge):ge=e[77];let Je;return e[78]!==B||e[79]!==z||e[80]!==V||e[81]!==J||e[82]!==ge?(Je=o.jsxs(B,{open:z,onOpenChange:V,children:[J,ge]}),e[78]=B,e[79]=z,e[80]=V,e[81]=J,e[82]=ge,e[83]=Je):Je=e[83],Je}function ld(t){return t.preventDefault()}function cd(t){const e=q.c(27),{selectedColor:s,onColorChange:i}=t,[r,n]=A.useState(!1);let a,l,h,c,u,d,m;if(e[0]!==r||e[1]!==s){const b=sa(s);l=Us,d=r,m=n,a=Hs,u=!0,h="button",c=te("h-6 w-6 rounded-full shrink-0 ring-2 ring-offset-2 ring-offset-background transition-all cursor-pointer hover:scale-110",b.dot,"ring-foreground/20"),e[0]=r,e[1]=s,e[2]=a,e[3]=l,e[4]=h,e[5]=c,e[6]=u,e[7]=d,e[8]=m}else a=e[2],l=e[3],h=e[4],c=e[5],u=e[6],d=e[7],m=e[8];let _;e[9]!==h||e[10]!==c?(_=o.jsx("button",{type:h,className:c,title:"Change color"}),e[9]=h,e[10]=c,e[11]=_):_=e[11];let f;e[12]!==a||e[13]!==u||e[14]!==_?(f=o.jsx(a,{asChild:u,children:_}),e[12]=a,e[13]=u,e[14]=_,e[15]=f):f=e[15];let p;e[16]!==i||e[17]!==s?(p=xc.map(b=>o.jsx("button",{type:"button",onClick:()=>{i(b.name),n(!1)},className:te("h-5 w-5 rounded-full transition-all shrink-0 cursor-pointer",b.dot,s===b.name?"ring-2 ring-offset-1 ring-offset-background ring-foreground/30 scale-110":"hover:scale-110"),title:b.name},b.name)),e[16]=i,e[17]=s,e[18]=p):p=e[18];let g;e[19]!==p?(g=o.jsx(Ws,{align:"start",side:"right",sideOffset:8,className:"w-auto p-2",onOpenAutoFocus:hd,children:o.jsx("div",{className:"grid grid-cols-4 gap-1",children:p})}),e[19]=p,e[20]=g):g=e[20];let v;return e[21]!==l||e[22]!==d||e[23]!==m||e[24]!==f||e[25]!==g?(v=o.jsxs(l,{open:d,onOpenChange:m,children:[f,g]}),e[21]=l,e[22]=d,e[23]=m,e[24]=f,e[25]=g,e[26]=v):v=e[26],v}function hd(t){return t.preventDefault()}function dd(t){const e=q.c(44),{search:s,onSearchChange:i,selectedColor:r,onColorChange:n,onSelectIcon:a,onRandom:l,currentIconName:h}=t;let c,u,d,m,_,f,p;if(e[0]!==h||e[1]!==n||e[2]!==l||e[3]!==i||e[4]!==a||e[5]!==s||e[6]!==r){const x=tn(),y=sa(r);u=s.trim()?x.filter(R=>{const C=dr(R),D=s.toLowerCase();return C.includes(D)||R.toLowerCase().includes(D)}):x,f="flex flex-col";let k;e[14]===Symbol.for("react.memo_cache_sentinel")?(k=o.jsx(Na,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[14]=k):k=e[14];let w;e[15]!==i?(w=R=>i(R.target.value),e[15]=i,e[16]=w):w=e[16];let N;e[17]!==s||e[18]!==w?(N=o.jsxs("div",{className:"relative flex-1",children:[k,o.jsx(fs,{value:s,onChange:w,placeholder:"Filter...",className:"h-8 text-xs pl-7"})]}),e[17]=s,e[18]=w,e[19]=N):N=e[19];let j;e[20]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(vc,{size:14,className:"text-muted-foreground"}),e[20]=j):j=e[20];let T;e[21]!==l?(T=o.jsx("button",{type:"button",onClick:l,className:"h-8 w-8 flex items-center justify-center rounded-md border border-border hover:bg-accent transition-colors shrink-0",title:"Random icon",children:j}),e[21]=l,e[22]=T):T=e[22];let M;e[23]!==n||e[24]!==r?(M=o.jsx(cd,{selectedColor:r,onColorChange:n}),e[23]=n,e[24]=r,e[25]=M):M=e[25],e[26]!==T||e[27]!==M||e[28]!==N?(p=o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[N,T,M]}),e[26]=T,e[27]=M,e[28]=N,e[29]=p):p=e[29],c=ka,_="h-56",d="grid grid-cols-9 gap-0.5 px-2 pb-2",m=u.map(R=>{const C=Ti(R);return C?o.jsx("button",{type:"button",onClick:()=>a(R),className:te("h-8 w-8 flex items-center justify-center rounded-md transition-colors cursor-pointer",h===R?te(y.bg,y.text):te(y.text,"hover:bg-accent")),title:R,children:o.jsx(C,{size:18})},R):null}),e[0]=h,e[1]=n,e[2]=l,e[3]=i,e[4]=a,e[5]=s,e[6]=r,e[7]=c,e[8]=u,e[9]=d,e[10]=m,e[11]=_,e[12]=f,e[13]=p}else c=e[7],u=e[8],d=e[9],m=e[10],_=e[11],f=e[12],p=e[13];let g;e[30]!==d||e[31]!==m?(g=o.jsx("div",{className:d,children:m}),e[30]=d,e[31]=m,e[32]=g):g=e[32];let v;e[33]!==u.length?(v=u.length===0&&o.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No icons found"}),e[33]=u.length,e[34]=v):v=e[34];let b;e[35]!==c||e[36]!==_||e[37]!==g||e[38]!==v?(b=o.jsxs(c,{className:_,children:[g,v]}),e[35]=c,e[36]=_,e[37]=g,e[38]=v,e[39]=b):b=e[39];let S;return e[40]!==f||e[41]!==p||e[42]!==b?(S=o.jsxs("div",{className:f,children:[p,b]}),e[40]=f,e[41]=p,e[42]=b,e[43]=S):S=e[43],S}function ud(t){const e=q.c(27),{onUpload:s}=t,i=A.useRef(null);let r;e[0]!==s?(r=k=>{const w=k.target.files?.[0];if(!w)return;if(w.size>2097152){_e.error("Image must be smaller than 2MB"),k.target.value="";return}const N=new FileReader;N.onerror=()=>{_e.error("Failed to read image file"),i.current&&(i.current.value="")},N.onloadend=()=>{N.readyState===FileReader.DONE&&N.result&&s(N.result),i.current&&(i.current.value="")},N.readAsDataURL(w)},e[0]=s,e[1]=r):r=e[1];const n=r,[a,l]=A.useState("");let h;e[2]!==s||e[3]!==a?(h=()=>{const k=a.trim();k&&(s(k),l(""))},e[2]=s,e[3]=a,e[4]=h):h=e[4];const c=h;let u;e[5]!==n?(u=o.jsx("input",{type:"file",ref:i,className:"hidden",accept:"image/*",onChange:n}),e[5]=n,e[6]=u):u=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=()=>i.current?.click(),e[7]=d):d=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsxs("button",{type:"button",onClick:d,className:"h-24 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-2 text-muted-foreground hover:text-foreground",children:[o.jsx(Ql,{size:20}),o.jsx("span",{className:"text-xs",children:"Click to upload an image (max 2MB)"})]}),e[8]=m):m=e[8];let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),o.jsx("div",{className:"flex-1 h-px bg-border"})]}),e[9]=_):_=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=k=>l(k.target.value),e[10]=f):f=e[10];let p;e[11]!==c?(p=k=>{k.key==="Enter"&&(k.preventDefault(),c())},e[11]=c,e[12]=p):p=e[12];let g;e[13]!==a||e[14]!==p?(g=o.jsx(fs,{value:a,onChange:f,placeholder:"Paste image URL...",className:"h-8 text-xs flex-1",onKeyDown:p}),e[13]=a,e[14]=p,e[15]=g):g=e[15];let v;e[16]!==a?(v=a.trim(),e[16]=a,e[17]=v):v=e[17];const b=!v;let S;e[18]!==c||e[19]!==b?(S=o.jsx(se,{variant:"outline",size:"sm",className:"h-8 px-3 text-xs shrink-0",onClick:c,disabled:b,children:"Apply"}),e[18]=c,e[19]=b,e[20]=S):S=e[20];let x;e[21]!==S||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-1.5",children:[g,S]}),e[21]=S,e[22]=g,e[23]=x):x=e[23];let y;return e[24]!==x||e[25]!==u?(y=o.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[u,m,_,x]}),e[24]=x,e[25]=u,e[26]=y):y=e[26],y}function fd(t){const e=q.c(5),{value:s}=t;let i;if(e[0]!==s){i=Symbol.for("react.early_return_sentinel");e:{const n=Ei(s);if(n.type==="icon"){const a=Ti(n.name);if(a){let l;e[2]!==a?(l=o.jsx(a,{size:16,className:"text-muted-foreground"}),e[2]=a,e[3]=l):l=e[3],i=l;break e}}}e[0]=s,e[1]=i}else i=e[1];if(i!==Symbol.for("react.early_return_sentinel"))return i;let r;return e[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Pc,{size:16,className:"text-muted-foreground"}),e[4]=r):r=e[4],r}function md(t){const e=q.c(66),{value:s,onChange:i,className:r,disabled:n}=t,[a,l]=A.useState(!1),[h,c]=A.useState("");let u;e[0]!==s?(u=Ei(s),e[0]=s,e[1]=u):u=e[1];const d=u,m=d.type==="icon"?d.name:null;let _,f,p,g,v,b,S,x,y,k,w,N,j,T,M;if(e[2]!==r||e[3]!==m||e[4]!==n||e[5]!==i||e[6]!==a||e[7]!==h||e[8]!==s){const B=tn();g=h.trim()?B.filter(U=>{const G=h.toLowerCase();return dr(U).includes(G)||U.toLowerCase().includes(G)}):B,p=Us,v=n?!1:a,b=l;const P=n?"cursor-default opacity-50":"cursor-pointer hover:bg-accent";let O;e[24]!==r||e[25]!==P?(O=te("size-7 shrink-0 rounded-md transition-colors flex items-center justify-center",P,r),e[24]=r,e[25]=P,e[26]=O):O=e[26];let F;e[27]!==s?(F=o.jsx(fd,{value:s}),e[27]=s,e[28]=F):F=e[28],e[29]!==n||e[30]!==O||e[31]!==F?(S=o.jsx(Hs,{asChild:!0,children:o.jsx("button",{type:"button",disabled:n,className:O,children:F})}),e[29]=n,e[30]=O,e[31]=F,e[32]=S):S=e[32],f=Ws,j="start",T="w-64 p-0",M=_d,w="flex flex-col";let z;e[33]===Symbol.for("react.memo_cache_sentinel")?(z=o.jsx(Na,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[33]=z):z=e[33];let V;e[34]===Symbol.for("react.memo_cache_sentinel")?(V=U=>c(U.target.value),e[34]=V):V=e[34],e[35]!==h?(N=o.jsx("div",{className:"px-2 py-2",children:o.jsxs("div",{className:"relative",children:[z,o.jsx(fs,{value:h,onChange:V,placeholder:"Filter...",className:"h-7 text-xs pl-7"})]})}),e[35]=h,e[36]=N):N=e[36],_=ka,k="h-48",x="grid grid-cols-8 gap-0.5 px-2 pb-2";let W;e[37]!==m||e[38]!==i?(W=U=>{const G=Ti(U);return G?o.jsx("button",{type:"button",onClick:()=>{i(`icon://${U}`),l(!1)},className:te("h-7 w-7 flex items-center justify-center rounded-md transition-colors cursor-pointer",m===U?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),title:dr(U),children:o.jsx(G,{size:16})},U):null},e[37]=m,e[38]=i,e[39]=W):W=e[39],y=g.map(W),e[2]=r,e[3]=m,e[4]=n,e[5]=i,e[6]=a,e[7]=h,e[8]=s,e[9]=_,e[10]=f,e[11]=p,e[12]=g,e[13]=v,e[14]=b,e[15]=S,e[16]=x,e[17]=y,e[18]=k,e[19]=w,e[20]=N,e[21]=j,e[22]=T,e[23]=M}else _=e[9],f=e[10],p=e[11],g=e[12],v=e[13],b=e[14],S=e[15],x=e[16],y=e[17],k=e[18],w=e[19],N=e[20],j=e[21],T=e[22],M=e[23];let R;e[40]!==x||e[41]!==y?(R=o.jsx("div",{className:x,children:y}),e[40]=x,e[41]=y,e[42]=R):R=e[42];let C;e[43]!==g.length?(C=g.length===0&&o.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:"No icons found"}),e[43]=g.length,e[44]=C):C=e[44];let D;e[45]!==_||e[46]!==R||e[47]!==C||e[48]!==k?(D=o.jsxs(_,{className:k,children:[R,C]}),e[45]=_,e[46]=R,e[47]=C,e[48]=k,e[49]=D):D=e[49];let E;e[50]!==D||e[51]!==w||e[52]!==N?(E=o.jsxs("div",{className:w,children:[N,D]}),e[50]=D,e[51]=w,e[52]=N,e[53]=E):E=e[53];let I;e[54]!==f||e[55]!==E||e[56]!==j||e[57]!==T||e[58]!==M?(I=o.jsx(f,{align:j,className:T,onOpenAutoFocus:M,children:E}),e[54]=f,e[55]=E,e[56]=j,e[57]=T,e[58]=M,e[59]=I):I=e[59];let L;return e[60]!==p||e[61]!==v||e[62]!==b||e[63]!==S||e[64]!==I?(L=o.jsxs(p,{open:v,onOpenChange:b,children:[S,I]}),e[60]=p,e[61]=v,e[62]=b,e[63]=S,e[64]=I,e[65]=L):L=e[65],L}function _d(t){return t.preventDefault()}function ci(){const t=q.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex items-center justify-center h-32",children:o.jsx(Ie,{className:"animate-spin text-muted-foreground",size:24})}),t[0]=e):e=t[0],e}function Vi(t){return({error:e})=>e?.message?.includes("Method not found")||e?.code===-32601?o.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:o.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:t})}):o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[o.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:o.jsx(Ml,{className:"h-6 w-6 text-destructive"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h3",{className:"text-lg font-medium",children:"Something went wrong"}),o.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:e?.message?e.message.length>200?`${e.message.slice(0,200)}...`:e.message:"An unexpected error occurred"})]})]})}function pd(t){const e=q.c(23),{item:s,isSelected:i,onToggle:r,disabled:n}=t,a=n?"cursor-not-allowed opacity-50":"cursor-pointer",l=i?"bg-accent/25":"hover:bg-muted/50";let h;e[0]!==a||e[1]!==l?(h=te("flex items-start gap-3 p-4 rounded-lg transition-colors",a,l),e[0]=a,e[1]=l,e[2]=h):h=e[2];let c;e[3]!==s.name?(c=o.jsx("p",{className:"text-sm font-medium leading-none truncate",children:s.name}),e[3]=s.name,e[4]=c):c=e[4];let u;e[5]!==s.tags?(u=s.tags&&o.jsx("span",{className:"shrink-0",children:s.tags}),e[5]=s.tags,e[6]=u):u=e[6];let d;e[7]!==c||e[8]!==u?(d=o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c,u]}),e[7]=c,e[8]=u,e[9]=d):d=e[9];let m;e[10]!==s.description?(m=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description}),e[10]=s.description,e[11]=m):m=e[11];let _;e[12]!==d||e[13]!==m?(_=o.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[d,m]}),e[12]=d,e[13]=m,e[14]=_):_=e[14];let f;e[15]!==n||e[16]!==i||e[17]!==r?(f=o.jsx(oh,{checked:i,onCheckedChange:r,disabled:n,className:"mt-0.5"}),e[15]=n,e[16]=i,e[17]=r,e[18]=f):f=e[18];let p;return e[19]!==h||e[20]!==_||e[21]!==f?(p=o.jsxs("label",{className:h,children:[_,f]}),e[19]=h,e[20]=_,e[21]=f,e[22]=p):p=e[22],p}function ln(t){const e=q.c(13),{items:s,selections:i,onToggle:r,emptyMessage:n,disabled:a}=t;let l,h,c;if(e[0]!==a||e[1]!==n||e[2]!==s||e[3]!==r||e[4]!==i){c=Symbol.for("react.early_return_sentinel");e:{const d=s.map(gd);if(s.length===0){let m;e[8]!==n?(m=o.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:o.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:n})}),e[8]=n,e[9]=m):m=e[9],c=m;break e}l="flex-1 overflow-auto px-4 py-3 space-y-1",h=s.map(m=>o.jsx(pd,{item:m,isSelected:i===null||i?.includes(m.id),onToggle:()=>r(m.id,d),disabled:a},m.id))}e[0]=a,e[1]=n,e[2]=s,e[3]=r,e[4]=i,e[5]=l,e[6]=h,e[7]=c}else l=e[5],h=e[6],c=e[7];if(c!==Symbol.for("react.early_return_sentinel"))return c;let u;return e[10]!==l||e[11]!==h?(u=o.jsx("div",{className:l,children:h}),e[10]=l,e[11]=h,e[12]=u):u=e[12],u}function gd(t){return t.id}function vd(t){const e=q.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=xe();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=He(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=jc(c);let d;e[6]!==u.tools?(d=u.tools.map(xd),e[6]=u.tools,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(ln,{items:m,selections:i,onToggle:r,emptyMessage:"No tools available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function xd(t){return{id:t.name,name:t.name,description:t.description,tags:o.jsx(Qc,{annotations:t.annotations,_meta:t._meta})}}function bd(t){const e=q.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=xe();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=He(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=Jc(c);let d;e[6]!==u.resources?(d=u.resources.map(Sd),e[6]=u.resources,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(ln,{items:m,selections:i,onToggle:r,emptyMessage:"No resources available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function Sd(t){return{id:t.name||t.uri,name:t.name||t.uri,description:t.description}}function yd(t){const e=q.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=xe();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=He(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=ah(c);let d;e[6]!==u.prompts?(d=u.prompts.map(wd),e[6]=u.prompts,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(ln,{items:m,selections:i,onToggle:r,emptyMessage:"No prompts available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function wd(t){return{id:t.name,name:t.name,description:t.description}}function Cd(t){const e=q.c(54),{currentConnection:s,activeTab:i,selectedId:r,formData:n,toggleTool:a,toggleResource:l,togglePrompt:h,toggleAllTools:c,toggleAllResources:u,toggleAllPrompts:d,onTabChange:m}=t,_=n[r],f=i==="tools"?_?.tools===null:i==="resources"?_?.resources===null:_?.prompts===null;let p;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==u||e[4]!==c?(p=()=>{i==="tools"?c(r):i==="resources"?u(r):d(r)},e[0]=i,e[1]=r,e[2]=d,e[3]=u,e[4]=c,e[5]=p):p=e[5];const g=p;let v;e[6]!==s.icon||e[7]!==s.title?(v=o.jsx(ds,{icon:s.icon,name:s.title,size:"sm",className:"shrink-0"}),e[6]=s.icon,e[7]=s.title,e[8]=v):v=e[8];let b;e[9]!==s.title?(b=o.jsx("h2",{className:"text-base font-semibold truncate",children:s.title}),e[9]=s.title,e[10]=b):b=e[10];let S;e[11]!==s.description?(S=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[11]=s.description,e[12]=S):S=e[12];let x;e[13]!==b||e[14]!==S?(x=o.jsxs("div",{className:"flex-1 min-w-0",children:[b,S]}),e[13]=b,e[14]=S,e[15]=x):x=e[15];let y;e[16]!==v||e[17]!==x?(y=o.jsx("div",{className:"px-6 pt-5 pb-4 shrink-0",children:o.jsxs("div",{className:"flex items-center gap-3",children:[v,x]})}),e[16]=v,e[17]=x,e[18]=y):y=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=[{id:"tools",label:"Tools"},{id:"resources",label:"Resources"},{id:"prompts",label:"Prompts"}],e[19]=k):k=e[19];let w;e[20]!==m?(w=L=>m(L),e[20]=m,e[21]=w):w=e[21];let N;e[22]!==i||e[23]!==w?(N=o.jsx(nh,{tabs:k,activeTab:i,onTabChange:w}),e[22]=i,e[23]=w,e[24]=N):N=e[24];const j=f?"Deselect all":"Select all";let T;e[25]!==g||e[26]!==j?(T=o.jsx("button",{type:"button",onClick:g,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:j}),e[25]=g,e[26]=j,e[27]=T):T=e[27];let M;e[28]!==T||e[29]!==N?(M=o.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border shrink-0",children:[N,T]}),e[28]=T,e[29]=N,e[30]=M):M=e[30];let R;e[31]!==i||e[32]!==n||e[33]!==r||e[34]!==a?(R=i==="tools"&&o.jsx(es,{fallback:Vi("Tools not supported by this server"),children:o.jsx(A.Suspense,{fallback:o.jsx(ci,{}),children:o.jsx(vd,{connectionId:r,selections:n[r]?n[r].tools:[],onToggle:(L,B)=>a(r,L,B)})})}),e[31]=i,e[32]=n,e[33]=r,e[34]=a,e[35]=R):R=e[35];let C;e[36]!==i||e[37]!==n||e[38]!==r||e[39]!==l?(C=i==="resources"&&o.jsx(es,{fallback:Vi("Resources not supported by this server"),children:o.jsx(A.Suspense,{fallback:o.jsx(ci,{}),children:o.jsx(bd,{connectionId:r,selections:n[r]?n[r].resources:[],onToggle:(L,B)=>l(r,L,B)})})}),e[36]=i,e[37]=n,e[38]=r,e[39]=l,e[40]=C):C=e[40];let D;e[41]!==i||e[42]!==n||e[43]!==r||e[44]!==h?(D=i==="prompts"&&o.jsx(es,{fallback:Vi("Prompts not supported by this server"),children:o.jsx(A.Suspense,{fallback:o.jsx(ci,{}),children:o.jsx(yd,{connectionId:r,selections:n[r]?n[r].prompts:[],onToggle:(L,B)=>h(r,L,B)})})}),e[41]=i,e[42]=n,e[43]=r,e[44]=h,e[45]=D):D=e[45];let E;e[46]!==R||e[47]!==C||e[48]!==D?(E=o.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[R,C,D]}),e[46]=R,e[47]=C,e[48]=D,e[49]=E):E=e[49];let I;return e[50]!==M||e[51]!==E||e[52]!==y?(I=o.jsxs(o.Fragment,{children:[y,M,E]}),e[50]=M,e[51]=E,e[52]=y,e[53]=I):I=e[53],I}function kd(t){const e=q.c(11),{connectionId:s,onAuthenticate:i,children:r}=t;let n;e[0]!==s?(n={connectionId:s},e[0]=s,e[1]=n):n=e[1];const a=ua(n);if(a.supportsOAuth&&!a.isAuthenticated){let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex items-center justify-center size-12 rounded-full bg-muted",children:o.jsx(bc,{size:22,className:"text-muted-foreground"})}),e[2]=c):c=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"Authorization required"}),o.jsx("p",{className:"text-xs text-muted-foreground max-w-xs",children:"This connection needs to be authorized before you can configure its tools and resources."})]}),e[3]=u):u=e[3];let d;e[4]!==s||e[5]!==i?(d=i&&o.jsx(se,{variant:"outline",size:"sm",onClick:()=>i(s),children:"Authorize"}),e[4]=s,e[5]=i,e[6]=d):d=e[6];let m;return e[7]!==d?(m=o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8 text-center",children:[c,u,d]}),e[7]=d,e[8]=m):m=e[8],m}let h;return e[9]!==r?(h=o.jsx(o.Fragment,{children:r}),e[9]=r,e[10]=h):h=e[10],h}function Nd(t){const e={};for(const s of t)e[s.connection_id]={tools:s.selected_tools,resources:s.selected_resources??null,prompts:s.selected_prompts??null};return e}function zn(t){return Object.entries(t).map(([e,s])=>({connection_id:e,selected_tools:s.tools,selected_resources:s.resources,selected_prompts:s.prompts}))}function jd(t,e){return e.type==="SET_ACTIVE_TAB"?{...t,activeTab:e.payload}:t}function Ed(t){const e=q.c(49),{open:s,onOpenChange:i,selectedId:r,form:n,connections:a,onAuthenticate:l}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={activeTab:"tools"},e[0]=h):h=e[0];const[c,u]=A.useReducer(jd,h),d=rn(r??"");let m;e[1]!==a?(m=a??[],e[1]=a,e[2]=m):m=e[2];let _;e[3]!==m?(_=Nd(m),e[3]=m,e[4]=_):_=e[4];const f=_;let p;e[5]!==n||e[6]!==f?(p=(z,V,W,U)=>{const G=f[z]?.[V];let $;G===null?$=U.filter(K=>K!==W):G?.includes(W)?$=G.filter(K=>K!==W):($=[...G??[],W],$.length===U.length&&($=null));const J={...f};J[z]?J[z]={...J[z]}:J[z]={tools:null,resources:null,prompts:null},J[z][V]=$,n.setValue("connections",zn(J),{shouldDirty:!0,shouldTouch:!0})},e[5]=n,e[6]=f,e[7]=p):p=e[7];const g=p;let v;e[8]!==n||e[9]!==f?(v=(z,V)=>{const U=f[z]?.[V]===null?[]:null,G={...f};G[z]?G[z]={...G[z]}:G[z]={tools:null,resources:null,prompts:null},G[z][V]=U,n.setValue("connections",zn(G),{shouldDirty:!0,shouldTouch:!0})},e[8]=n,e[9]=f,e[10]=v):v=e[10];const b=v;let S;e[11]!==g?(S=(z,V,W)=>g(z,"tools",V,W),e[11]=g,e[12]=S):S=e[12];const x=S;let y;e[13]!==g?(y=(z,V,W)=>g(z,"resources",V,W),e[13]=g,e[14]=y):y=e[14];const k=y;let w;e[15]!==g?(w=(z,V,W)=>g(z,"prompts",V,W),e[15]=g,e[16]=w):w=e[16];const N=w;let j;e[17]!==b?(j=z=>b(z,"tools"),e[17]=b,e[18]=j):j=e[18];const T=j;let M;e[19]!==b?(M=z=>b(z,"resources"),e[19]=b,e[20]=M):M=e[20];const R=M;let C;e[21]!==b?(C=z=>b(z,"prompts"),e[21]=b,e[22]=C):C=e[22];const D=C;if(!r||!d)return null;let E;e[23]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(ci,{}),e[23]=E):E=e[23];let I;e[24]===Symbol.for("react.memo_cache_sentinel")?(I=z=>u({type:"SET_ACTIVE_TAB",payload:z}),e[24]=I):I=e[24];let L;e[25]!==d||e[26]!==c.activeTab||e[27]!==f||e[28]!==r||e[29]!==D||e[30]!==R||e[31]!==T||e[32]!==N||e[33]!==k||e[34]!==x?(L=o.jsx(Cd,{currentConnection:d,activeTab:c.activeTab,selectedId:r,formData:f,toggleTool:x,toggleResource:k,togglePrompt:N,toggleAllTools:T,toggleAllResources:R,toggleAllPrompts:D,onTabChange:I},r),e[25]=d,e[26]=c.activeTab,e[27]=f,e[28]=r,e[29]=D,e[30]=R,e[31]=T,e[32]=N,e[33]=k,e[34]=x,e[35]=L):L=e[35];let B;e[36]!==l||e[37]!==r||e[38]!==L?(B=o.jsx(A.Suspense,{fallback:E,children:o.jsx(kd,{connectionId:r,onAuthenticate:l,children:L})}),e[36]=l,e[37]=r,e[38]=L,e[39]=B):B=e[39];let P;e[40]!==i?(P=o.jsx(th,{className:"px-6 py-4 border-t border-border shrink-0",children:o.jsx(se,{variant:"outline",onClick:()=>i(!1),children:"Done"})}),e[40]=i,e[41]=P):P=e[41];let O;e[42]!==B||e[43]!==P?(O=o.jsxs(nn,{className:"sm:max-w-2xl h-[75vh] max-h-[75vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[B,P]}),e[42]=B,e[43]=P,e[44]=O):O=e[44];let F;return e[45]!==i||e[46]!==s||e[47]!==O?(F=o.jsx(on,{open:s,onOpenChange:i,children:O}),e[45]=i,e[46]=s,e[47]=O,e[48]=F):F=e[48],F}const Ki={tools:null,resources:null,prompts:null},Td=Il.pick({status:!0,title:!0,description:!0,icon:!0,metadata:!0,connections:!0});function Rd(t){const s=new TextEncoder().encode(t),i=Array.from(s,r=>String.fromCharCode(r)).join("");return btoa(i)}function Dd(t){const e=q.c(11),{url:s,agentId:i}=t,[r,n]=A.useState(!1);let a;e[0]!==i||e[1]!==s?(a=async()=>{we("agent_connect_action",{agent_id:i,action:"copy_url"}),await navigator.clipboard.writeText(s),n(!0),_e.success("Agent URL copied to clipboard"),setTimeout(()=>n(!1),2e3)},e[0]=i,e[1]=s,e[2]=a):a=e[2];const l=a;let h;e[3]!==r?(h=r?o.jsx(Di,{size:20,className:"text-green-600"}):o.jsx(ji,{size:20}),e[3]=r,e[4]=h):h=e[4];const c=r?"Copied!":"Copy URL";let u;e[5]!==c?(u=o.jsx("span",{className:"text-xs font-medium",children:c}),e[5]=c,e[6]=u):u=e[6];let d;return e[7]!==l||e[8]!==h||e[9]!==u?(d=o.jsxs(se,{type:"button",variant:"outline",onClick:l,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[h,u]}),e[7]=l,e[8]=h,e[9]=u,e[10]=d):d=e[10],d}function Md(t){const e=q.c(8),{url:s,serverName:i,agentId:r}=t;let n;e[0]!==r||e[1]!==i||e[2]!==s?(n=()=>{we("agent_connect_action",{agent_id:r,action:"install_cursor"});const u=fa(i),m=Rd(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),_=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(u)}&config=${encodeURIComponent(m)}`;window.open(_,"_blank"),_e.success("Opening Cursor...")},e[0]=r,e[1]=i,e[2]=s,e[3]=n):n=e[3];const a=n;let l,h;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),h=o.jsx("span",{className:"text-xs font-medium",children:"Install on Cursor"}),e[4]=l,e[5]=h):(l=e[4],h=e[5]);let c;return e[6]!==a?(c=o.jsxs(se,{type:"button",variant:"outline",onClick:a,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[l,h]}),e[6]=a,e[7]=c):c=e[7],c}function Id(t){const e=q.c(12),{url:s,serverName:i,agentId:r}=t,[n,a]=A.useState(!1);let l;e[0]!==r||e[1]!==i||e[2]!==s?(l=async()=>{we("agent_connect_action",{agent_id:r,action:"install_claude_code"});const _=fa(i),p=JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Claude Code"}},null,2),g=`claude mcp add-json "${_}" '${p.replace(/'/g,"'\\''")}' --scope user`;await navigator.clipboard.writeText(g),a(!0),_e.success("Claude Code command copied to clipboard"),setTimeout(()=>a(!1),2e3)},e[0]=r,e[1]=i,e[2]=s,e[3]=l):l=e[3];const h=l;let c;e[4]!==n?(c=n?o.jsx(Di,{size:20,className:"text-green-600"}):o.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[4]=n,e[5]=c):c=e[5];const u=n?"Copied!":"Install on Claude Code";let d;e[6]!==u?(d=o.jsx("span",{className:"text-xs font-medium",children:u}),e[6]=u,e[7]=d):d=e[7];let m;return e[8]!==h||e[9]!==c||e[10]!==d?(m=o.jsxs(se,{type:"button",variant:"outline",onClick:h,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,d]}),e[8]=h,e[9]=c,e[10]=d,e[11]=m):m=e[11],m}function Ad({virtualMcp:t}){const{org:e}=xe(),s=He({connectionId:Bt,orgId:e.id,orgSlug:e.slug}),[i,r]=A.useState(null),[n,a]=A.useState(!1),[l,h]=A.useState(!1),c=t.id,u=t.title||`agent-${c.slice(0,8)}`,d=i?`bunx @decocms/typegen@latest --mcp ${c} --key ${i} --output client.ts`:`bunx @decocms/typegen@latest --mcp ${c} --key <api-key> --output client.ts`,m=async()=>{a(!0);try{const p=(await s.callTool({name:"API_KEY_CREATE",arguments:{name:`typegen-${u}`,permissions:{[c]:["*"]}}})).structuredContent?.key;if(!p)throw new Error("No key in response");r(p),we("agent_typegen_key_generated",{agent_id:c})}catch{we("agent_typegen_key_failed",{agent_id:c}),_e.error("Failed to generate API key")}finally{a(!1)}},_=async()=>{we("agent_connect_action",{agent_id:c,action:"typegen_copy_command",has_api_key:!!i}),await navigator.clipboard.writeText(d),h(!0),_e.success("Command copied to clipboard"),setTimeout(()=>h(!1),2e3)};return o.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Generate typed client"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Introspects this agent and writes a typed"," ",o.jsx("code",{className:"font-mono",children:"client.ts"})," you can import directly."]})]}),!i&&o.jsxs(se,{type:"button",variant:"outline",size:"sm",className:"shrink-0 gap-1.5",onClick:m,disabled:n,children:[n?o.jsx(Ie,{size:14,className:"animate-spin"}):o.jsx(rh,{size:14}),o.jsx("span",{children:n?"Generating…":"Generate API key"})]})]}),i&&o.jsx("p",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700",children:"Store this key securely — it won't be shown again."}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Generate client"}),o.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("code",{className:"min-w-0 flex-1 break-all font-mono text-xs text-muted-foreground",children:d}),o.jsx(se,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:_,children:l?o.jsx(Di,{size:12,className:"text-green-600"}):o.jsx(ji,{size:12})})]})}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Runtime variables"}),o.jsx(Bd,{apiKey:i,agentId:c})]})}function Bd(t){const e=q.c(21),{apiKey:s,agentId:i}=t,[r,n]=A.useState(!1),a=window.location.origin,l=s?`MESH_API_KEY=${s}`:"MESH_API_KEY=<api-key>",h=`MESH_BASE_URL=${a}`,c=`${l}
|
|
3
3
|
${h}`;let u;e[0]!==i||e[1]!==s||e[2]!==c?(u=async()=>{we("agent_connect_action",{agent_id:i,action:"typegen_copy_env",has_api_key:!!s}),await navigator.clipboard.writeText(c),n(!0),setTimeout(()=>n(!1),2e3)},e[0]=i,e[1]=s,e[2]=c,e[3]=u):u=e[3];const d=u,m=!s;let _;e[4]!==m?(_=te({"opacity-50":m}),e[4]=m,e[5]=_):_=e[5];let f;e[6]!==l||e[7]!==_?(f=o.jsx("span",{className:_,children:l}),e[6]=l,e[7]=_,e[8]=f):f=e[8];let p,g;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("br",{}),g=o.jsx("span",{children:h}),e[9]=p,e[10]=g):(p=e[9],g=e[10]);let v;e[11]!==f?(v=o.jsxs("code",{className:"min-w-0 flex-1 font-mono text-xs text-muted-foreground",children:[f,p,g]}),e[11]=f,e[12]=v):v=e[12];let b;e[13]!==r?(b=r?o.jsx(Di,{size:12,className:"text-green-600"}):o.jsx(ji,{size:12}),e[13]=r,e[14]=b):b=e[14];let S;e[15]!==d||e[16]!==b?(S=o.jsx(se,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:d,children:b}),e[15]=d,e[16]=b,e[17]=S):S=e[17];let x;return e[18]!==v||e[19]!==S?(x=o.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:o.jsxs("div",{className:"flex items-start gap-2",children:[v,S]})}),e[18]=v,e[19]=S,e[20]=x):x=e[20],x}function Pd(t){const e=q.c(3),{virtualMcp:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"h-20 animate-pulse rounded-md bg-muted"}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx(A.Suspense,{fallback:i,children:o.jsx(Ad,{virtualMcp:s})}),e[1]=s,e[2]=r):r=e[2],r}function Ld(t){const e=q.c(37),{open:s,onOpenChange:i,virtualMcp:r}=t,{org:n}=xe(),a=`/api/${n.slug}/mcp/virtual-mcp/${r.id}`;let l;e[0]!==a?(l=new URL(a,window.location.origin),e[0]=a,e[1]=l):l=e[1];const h=l;let c;e[2]!==r.id||e[3]!==r.title?(c=r.title||`agent-${r.id?.slice(0,8)??"default"}`,e[2]=r.id,e[3]=r.title,e[4]=c):c=e[4];const u=c,d=ca();let m;e[5]!==r.id||e[6]!==h.href?(m=o.jsx(Dd,{url:h.href,agentId:r.id}),e[5]=r.id,e[6]=h.href,e[7]=m):m=e[7];let _,f;e[8]!==u||e[9]!==r.id||e[10]!==h.href?(_=o.jsx(Md,{url:h.href,serverName:u,agentId:r.id}),f=o.jsx(Id,{url:h.href,serverName:u,agentId:r.id}),e[8]=u,e[9]=r.id,e[10]=h.href,e[11]=_,e[12]=f):(_=e[11],f=e[12]);let p;e[13]!==m||e[14]!==_||e[15]!==f?(p=o.jsx("div",{className:"flex flex-col gap-3 pt-2",children:o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[m,_,f]})}),e[13]=m,e[14]=_,e[15]=f,e[16]=p):p=e[16];let g;e[17]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("div",{className:"border-t border-border"}),e[17]=g):g=e[17];let v;e[18]!==r?(v=o.jsx(Pd,{virtualMcp:r}),e[18]=r,e[19]=v):v=e[19];let b;e[20]!==p||e[21]!==v?(b=o.jsxs("div",{className:"flex flex-col gap-6",children:[p,g,v]}),e[20]=p,e[21]=v,e[22]=b):b=e[22];const S=b;if(d){let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(hh,{className:"mt-4 mb-4 text-base font-semibold",children:"Connect"}),e[23]=w):w=e[23];let N;e[24]!==S?(N=o.jsx(dh,{children:o.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-6 [touch-action:pan-y]",children:[w,S]})}),e[24]=S,e[25]=N):N=e[25];let j;return e[26]!==i||e[27]!==s||e[28]!==N?(j=o.jsx(uh,{open:s,onOpenChange:i,children:N}),e[26]=i,e[27]=s,e[28]=N,e[29]=j):j=e[29],j}let x;e[30]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(ya,{children:o.jsx(wa,{children:"Connect"})}),e[30]=x):x=e[30];let y;e[31]!==S?(y=o.jsxs(nn,{className:"max-h-[80vh] overflow-y-auto sm:max-w-2xl",children:[x,S]}),e[31]=S,e[32]=y):y=e[32];let k;return e[33]!==i||e[34]!==s||e[35]!==y?(k=o.jsx(on,{open:s,onOpenChange:i,children:y}),e[33]=i,e[34]=s,e[35]=y,e[36]=k):k=e[36],k}function Od(t,e){switch(e.type){case"SET_SHARE_DIALOG_OPEN":return{...t,shareDialogOpen:e.payload};case"SET_ADD_DIALOG_OPEN":return{...t,addDialogOpen:e.payload};case"OPEN_SETTINGS":return{...t,settingsDialogOpen:!0,settingsConnectionId:e.payload};case"CLOSE_SETTINGS":return{...t,settingsDialogOpen:!1,settingsConnectionId:null};default:return t}}function zd(t){const e=q.c(22),{connection_id:s,usedConnectionIds:i,onOpenSettings:r,onRemove:n,onAuthenticate:a,onSwitchInstance:l,onNewInstance:h}=t,c=rn(s),{org:u}=xe();if(!c)return null;let d;e[0]!==c?(d=eh(c),e[0]=c,e[1]=d):d=e[1];const m=d;let _;e[2]!==s?(_=o.jsx(Wd,{connection_id:s}),e[2]=s,e[3]=_):_=e[3];let f;e[4]!==c.app_name||e[5]!==c.connection_type||e[6]!==c.description||e[7]!==c.icon||e[8]!==c.title||e[9]!==s||e[10]!==a||e[11]!==h||e[12]!==r||e[13]!==n||e[14]!==l||e[15]!==u.slug||e[16]!==m||e[17]!==i?(f=o.jsx(Hd,{connection_id:s,connectionTitle:c.title,connectionDescription:c.description,connectionIcon:c.icon,connectionType:c.connection_type,slug:m,orgSlug:u.slug,appName:c.app_name,usedConnectionIds:i,onOpenSettings:r,onRemove:n,onAuthenticate:a,onSwitchInstance:l,onNewInstance:h}),e[4]=c.app_name,e[5]=c.connection_type,e[6]=c.description,e[7]=c.icon,e[8]=c.title,e[9]=s,e[10]=a,e[11]=h,e[12]=r,e[13]=n,e[14]=l,e[15]=u.slug,e[16]=m,e[17]=i,e[18]=f):f=e[18];let p;return e[19]!==_||e[20]!==f?(p=o.jsx(A.Suspense,{fallback:_,children:f}),e[19]=_,e[20]=f,e[21]=p):p=e[21],p}const $n="__new_instance__";async function $d(t,e){const s=t?.idToken??null;if(s){const r=Fn(s);if(r)return r}const i=t?.userinfoEndpoint??null;if(i)try{const r=await fetch(i,{headers:{Authorization:`Bearer ${e}`}});if(r.ok){const n=await r.json(),a=typeof n.email=="string"?n.email:typeof n.upn=="string"?n.upn:typeof n.preferred_username=="string"?n.preferred_username:null;if(a)return a}}catch{}return Fn(e)}function Fn(t){try{const e=t.split(".");if(e.length===3&&e[1]){const s=JSON.parse(atob(e[1].replace(/-/g,"+").replace(/_/g,"/")));if(typeof s.email=="string")return s.email;if(typeof s.upn=="string")return s.upn;if(typeof s.preferred_username=="string")return s.preferred_username}}catch{}return null}function Fd(t){const e=q.c(23),{appName:s,connectionId:i,usedConnectionIds:r,onSwitchInstance:n,onNewInstance:a}=t;let l;e[0]!==s?(l={filters:[{column:"app_name",value:s}]},e[0]=s,e[1]=l):l=e[1];const h=Ri(l);if(h.length<=1)return null;let c;e[2]!==i||e[3]!==a||e[4]!==n?(c=p=>{p===$n?a?.():n(i,p)},e[2]=i,e[3]=a,e[4]=n,e[5]=c):c=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(ss,{size:"sm",className:"w-auto text-xs gap-1 px-2 shadow-none",children:o.jsx(is,{})}),e[6]=u):u=e[6];let d;if(e[7]!==i||e[8]!==h||e[9]!==r){let p;e[11]!==i||e[12]!==r?(p=g=>o.jsx(It,{value:g.id,className:"text-xs",disabled:g.id!==i&&r.has(g.id),children:g.title},g.id),e[11]=i,e[12]=r,e[13]=p):p=e[13],d=h.map(p),e[7]=i,e[8]=h,e[9]=r,e[10]=d}else d=e[10];let m;e[14]!==a?(m=a&&o.jsx(It,{value:$n,className:"text-xs text-muted-foreground",children:"+ New instance"}),e[14]=a,e[15]=m):m=e[15];let _;e[16]!==d||e[17]!==m?(_=o.jsxs(rs,{children:[d,m]}),e[16]=d,e[17]=m,e[18]=_):_=e[18];let f;return e[19]!==i||e[20]!==c||e[21]!==_?(f=o.jsxs(ts,{value:i,onValueChange:c,children:[u,_]}),e[19]=i,e[20]=c,e[21]=_,e[22]=f):f=e[22],f}function Hd(t){const e=q.c(55),{connection_id:s,connectionTitle:i,connectionDescription:r,connectionIcon:n,connectionType:a,slug:l,orgSlug:h,appName:c,usedConnectionIds:u,onOpenSettings:d,onRemove:m,onAuthenticate:_,onSwitchInstance:f,onNewInstance:p}=t;let g;e[0]!==s?(g={connectionId:s},e[0]=s,e[1]=g):g=e[1];const v=ua(g),S=!(a==="VIRTUAL")&&v.supportsOAuth&&!v.isAuthenticated,x=S?"border-destructive/50 bg-destructive/5":"border-border";let y;e[2]!==x?(y=te("rounded-xl border overflow-hidden transition-colors",x),e[2]=x,e[3]=y):y=e[3];let k;e[4]!==h||e[5]!==l?(k={org:h,appSlug:l},e[4]=h,e[5]=l,e[6]=k):k=e[6];let w;e[7]!==n||e[8]!==i?(w=o.jsx(ds,{icon:n,name:i,size:"sm",className:"shrink-0"}),e[7]=n,e[8]=i,e[9]=w):w=e[9];let N;e[10]!==i?(N=o.jsx("p",{className:"text-sm font-medium truncate",children:i}),e[10]=i,e[11]=N):N=e[11];let j;e[12]!==r||e[13]!==S?(j=S?o.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}):r&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:r}),e[12]=r,e[13]=S,e[14]=j):j=e[14];let T;e[15]!==N||e[16]!==j?(T=o.jsxs("div",{className:"flex-1 min-w-0",children:[N,j]}),e[15]=N,e[16]=j,e[17]=T):T=e[17];let M;e[18]!==s||e[19]!==S||e[20]!==_?(M=S?o.jsx(se,{variant:"outline",size:"sm",className:"h-7 text-xs shrink-0",onClick:U=>{U.preventDefault(),U.stopPropagation(),_(s)},children:"Authorize"}):o.jsxs(Ke,{delayDuration:0,children:[o.jsx(qe,{asChild:!0,children:o.jsx("span",{className:"inline-flex items-center justify-center rounded-md h-7 w-7 hover:bg-accent text-muted-foreground shrink-0 transition-colors",children:o.jsx(ih,{size:16})})}),o.jsx(Ge,{side:"bottom",children:"Connection settings"})]}),e[18]=s,e[19]=S,e[20]=_,e[21]=M):M=e[21];let R;e[22]!==k||e[23]!==w||e[24]!==T||e[25]!==M?(R=o.jsxs(Pl,{to:"/$org/settings/connections/$appSlug",params:k,className:"flex items-center gap-3 px-4 py-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[w,T,M]}),e[22]=k,e[23]=w,e[24]=T,e[25]=M,e[26]=R):R=e[26];let C;e[27]!==c||e[28]!==s||e[29]!==p||e[30]!==f||e[31]!==u?(C=c&&o.jsx(Fd,{appName:c,connectionId:s,usedConnectionIds:u,onSwitchInstance:f,onNewInstance:p}),e[27]=c,e[28]=s,e[29]=p,e[30]=f,e[31]=u,e[32]=C):C=e[32];let D;e[33]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx(yc,{size:13}),e[33]=D):D=e[33];let E;e[34]!==d?(E=o.jsx(qe,{asChild:!0,children:o.jsx(se,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:d,"aria-label":"Configure resources",children:D})}),e[34]=d,e[35]=E):E=e[35];let I;e[36]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(Ge,{side:"bottom",children:"Configure resources"}),e[36]=I):I=e[36];let L;e[37]!==E?(L=o.jsxs(Ke,{delayDuration:0,children:[E,I]}),e[37]=E,e[38]=L):L=e[38];let B;e[39]===Symbol.for("react.memo_cache_sentinel")?(B=o.jsx(ls,{size:13}),e[39]=B):B=e[39];let P;e[40]!==m?(P=o.jsx(qe,{asChild:!0,children:o.jsx(se,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:m,"aria-label":"Remove connection",children:B})}),e[40]=m,e[41]=P):P=e[41];let O;e[42]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx(Ge,{side:"bottom",children:"Remove"}),e[42]=O):O=e[42];let F;e[43]!==P?(F=o.jsxs(Ke,{delayDuration:0,children:[P,O]}),e[43]=P,e[44]=F):F=e[44];let z;e[45]!==L||e[46]!==F?(z=o.jsxs("div",{className:"flex items-center gap-0.5 ml-auto",children:[L,F]}),e[45]=L,e[46]=F,e[47]=z):z=e[47];let V;e[48]!==C||e[49]!==z?(V=o.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-border bg-muted/25",children:[C,z]}),e[48]=C,e[49]=z,e[50]=V):V=e[50];let W;return e[51]!==R||e[52]!==V||e[53]!==y?(W=o.jsxs("div",{className:y,children:[R,V]}),e[51]=R,e[52]=V,e[53]=y,e[54]=W):W=e[54],W}function Wd(t){const e=q.c(17),{connection_id:s}=t,i=rn(s);if(!i){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Ma,{}),e[0]=d):d=e[0],d}let r;e[1]!==i.icon||e[2]!==i.title?(r=o.jsx(ds,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0"}),e[1]=i.icon,e[2]=i.title,e[3]=r):r=e[3];let n;e[4]!==i.title?(n=o.jsx("p",{className:"text-sm font-medium truncate",children:i.title}),e[4]=i.title,e[5]=n):n=e[5];let a;e[6]!==i.description?(a=i.description&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:i.description}),e[6]=i.description,e[7]=a):a=e[7];let l;e[8]!==n||e[9]!==a?(l=o.jsxs("div",{className:"flex-1 min-w-0",children:[n,a]}),e[8]=n,e[9]=a,e[10]=l):l=e[10];let h;e[11]!==r||e[12]!==l?(h=o.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[r,l]}),e[11]=r,e[12]=l,e[13]=h):h=e[13];let c;e[14]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex items-center px-4 py-2 border-t border-border bg-muted/25",children:o.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"})}),e[14]=c):c=e[14];let u;return e[15]!==h?(u=o.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[h,c]}),e[15]=h,e[16]=u):u=e[16],u}function Ma(){const t=q.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"size-8 rounded-md bg-muted animate-pulse shrink-0"}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[e,o.jsxs("div",{className:"flex-1 space-y-1.5",children:[o.jsx("div",{className:"h-4 w-32 rounded bg-muted animate-pulse"}),o.jsx("div",{className:"h-3 w-48 rounded bg-muted animate-pulse"})]})]}),t[1]=s):s=t[1];let i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[s,o.jsx("div",{className:"flex items-center px-4 py-2 border-t border-border bg-muted/25",children:o.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"})})]}),t[2]=i):i=t[2],i}function Ud({virtualMcpId:t}){const{org:e}=xe(),s=He({connectionId:Bt,orgId:e.id,orgSlug:e.slug}),i=Wt(),r=yt(t),n=(r?.connections??[]).map(P=>P.connection_id).sort(),{data:a}=Vo({queryKey:As.projectConnectionDetails(t,n),enabled:n.length>0,queryFn:async()=>await Promise.all(n.map(async O=>{try{const F=await s.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:O}}),{item:z}=$i(F),V=(z?.tools??[]).filter(W=>!!Zc(W._meta)).map(W=>({name:W.name,description:W.description}));return{fetchOk:!0,id:O,title:z?.title??O,icon:z?.icon??null,uiTools:V}}catch{return{fetchOk:!1,id:O,title:O,icon:null,uiTools:[]}}}))}),l=(a??[]).filter(P=>P.uiTools.length>0),h=new Set(nc),c=r?.metadata?.ui,u=c?.pinnedViews??[],d=c?.layout?.defaultMainView??null,m=c?.layout?.chatDefaultOpen??!1,_=!d||d.type==="chat"?"chat":d.type==="instructions"||d.type==="connections"||d.type==="layout"?"settings":h.has(d.type)?d.type:`${d.type}:${d.id??""}:${d.toolName??""}`,[f,p]=A.useState(u),[g,v]=A.useState(_),[b,S]=A.useState(m),[x,y]=A.useState(!1),k=P=>{const[O,F,z]=P.split(":");return O?O==="chat"?{type:O}:h.has(O)?{type:O}:O==="ext-apps"&&F?{type:"ext-apps",id:F,toolName:z||void 0}:null:null},w=A.useRef(!1);if(a&&a.length>0&&!w.current){w.current=!0;const P=new Set((a??[]).filter(z=>z.fetchOk).map(z=>z.id)),O=new Set(l.flatMap(z=>z.uiTools.map(V=>`${z.id}:${V.name}`))),F=u.filter(z=>!P.has(z.connectionId)||O.has(`${z.connectionId}:${z.toolName}`));if(F.length!==u.length){p(F);let z=g;d?.type==="ext-apps"&&!F.some(V=>V.connectionId===d.id&&V.toolName===d.toolName)&&(z="chat",v(z)),s.callTool({name:"VIRTUAL_MCP_PINNED_VIEWS_UPDATE",arguments:{virtualMcpId:t,pinnedViews:F,layout:{defaultMainView:k(z),chatDefaultOpen:b}}}).then(V=>{$i(V),i.invalidateQueries({predicate:W=>Array.isArray(W.queryKey)&&W.queryKey.includes("collection")&&W.queryKey.includes("VIRTUAL_MCP")})}).catch(()=>{p(u),v(_)})}}const N=(P,O,F)=>{y(!0),(async()=>{try{const V=await s.callTool({name:"VIRTUAL_MCP_PINNED_VIEWS_UPDATE",arguments:{virtualMcpId:t,pinnedViews:P,layout:{defaultMainView:k(O),chatDefaultOpen:F??b}}});$i(V),i.invalidateQueries({predicate:W=>Array.isArray(W.queryKey)&&W.queryKey.includes("collection")&&W.queryKey.includes("VIRTUAL_MCP")}),_e.success("Layout updated")}catch(V){_e.error("Failed to update layout: "+(V instanceof Error?V.message:"Unknown error"))}finally{y(!1)}})()},j=(P,O)=>{const F=f.some(W=>W.connectionId===P&&W.toolName===O);let z,V=g;if(F){z=f.filter(U=>!(U.connectionId===P&&U.toolName===O));const W=`ext-apps:${P}:${O}`;g===W&&(V="chat",v(V))}else z=[...f,{connectionId:P,toolName:O,label:kn(O),icon:null}];p(z),N(z,V)},T=(P,O,F)=>{p(z=>z.map(V=>V.connectionId===P&&V.toolName===O?{...V,label:F}:V))},M=()=>{N(f,g)},R=(P,O,F)=>{p(V=>V.map(W=>W.connectionId===P&&W.toolName===O?{...W,icon:F}:W));const z=f.map(V=>V.connectionId===P&&V.toolName===O?{...V,icon:F}:V);N(z,g)},C=P=>{v(P),N(f,P)},D=n.length===0,E=a&&l.length===0,I=!!Ut(r),L=[{value:"chat",label:"Chat"},{value:"settings",label:"Settings"},{value:"automations",label:"Automations"}];I&&(L.push({value:"env",label:"Terminal"}),L.push({value:"preview",label:"Preview"}));for(const P of f)L.push({value:`ext-apps:${P.connectionId}:${P.toolName}`,label:P.label||P.toolName});const B=l.length>0||D||E;return o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("div",{className:"flex items-center justify-between gap-3",children:o.jsx("h2",{className:"text-sm font-medium text-foreground",children:"Layout"})}),o.jsxs(sh,{className:"p-6 gap-5",children:[o.jsxs(Mn,{className:"p-0 space-y-5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"space-y-0.5 min-w-0",children:[o.jsx(Ds,{className:"font-normal text-foreground",children:"Main view"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"What users see when they first open this agent."})]}),o.jsxs(ts,{value:g,onValueChange:C,children:[o.jsx(ss,{className:"w-44 h-8 text-sm capitalize shrink-0",children:o.jsx(is,{})}),o.jsx(rs,{children:L.map(P=>o.jsx(It,{value:P.value,className:"capitalize",children:P.label},P.value))})]})]}),o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"space-y-0.5 min-w-0",children:[o.jsx(Ds,{className:"font-normal text-foreground",children:"Show chat"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Display the chat panel alongside the main view."})]}),o.jsxs(Ke,{delayDuration:0,children:[o.jsx(qe,{asChild:!0,children:o.jsx("span",{className:"shrink-0",children:o.jsx(fr,{checked:g==="chat"?!0:b,disabled:g==="chat"||x,onCheckedChange:P=>{S(P),N(f,g,P)}})})}),g==="chat"&&o.jsx(Ge,{side:"top",children:"Chat is always shown when it is the default view"})]})]})]}),B&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"border-t border-border -mx-6"}),o.jsxs(Mn,{className:"p-0 space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between gap-4",children:o.jsxs("div",{className:"space-y-0.5 min-w-0",children:[o.jsx(Ds,{className:"font-normal text-foreground",children:"Pinned views"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Surface interactive tools as top-level tabs in the agent."})]})}),D&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"Add a connection above to configure pinned views."}),E&&!D&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"None of the connected servers expose interactive tools."}),l.length>0&&o.jsx("div",{className:"space-y-4 pt-1",children:l.map((P,O)=>o.jsxs("div",{children:[O>0&&o.jsx("div",{className:"border-t border-border -mx-6 mb-4"}),o.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[o.jsx(ds,{icon:P.icon,name:P.title,size:"xs",className:"shrink-0"}),o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:P.title})]}),o.jsx("div",{className:"space-y-1.5",children:P.uiTools.map(F=>{const z=f.some(W=>W.connectionId===P.id&&W.toolName===F.name),V=f.find(W=>W.connectionId===P.id&&W.toolName===F.name);return o.jsxs("div",{className:te("flex items-center justify-between gap-3 px-3 py-2 rounded-lg border transition-colors",z?"bg-accent/40 border-border":"bg-transparent border-border"),children:[o.jsxs("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[o.jsx(md,{value:V?.icon??null,onChange:W=>R(P.id,F.name,W),disabled:!z||x}),o.jsx(fs,{value:z&&V?V.label:kn(F.name),onChange:W=>T(P.id,F.name,W.target.value),onBlur:M,className:"h-7 text-sm w-40",disabled:!z||x,readOnly:!z})]}),o.jsx(fr,{checked:z,onCheckedChange:()=>j(P.id,F.name),disabled:x})]},F.name)})})]},P.id))})]})]})]})]})}function Vd({virtualMcp:t,hideOwnTitle:e}){const{org:s}=xe(),i=Kl(),r=Yc(),n=Wt(),a=He({connectionId:Bt,orgId:s.id,orgSlug:s.slug}),l=qo({resolver:Al(Td),defaultValues:t}),h=l.watch("connections"),c=!!Ut(t),[u,d]=A.useReducer(Od,{shareDialogOpen:!1,addDialogOpen:!1,settingsDialogOpen:!1,settingsConnectionId:null}),[m,_]=A.useState(!1),{createTaskWithMessage:f}=lt(),{setChatMode:p}=ki(),{createNewTask:g}=sn(),v=()=>{const $=l.getValues("metadata.instructions");$?.trim()&&(T(),we("agent_instructions_improve_clicked",{agent_id:t.id,instructions_length:$.length}),p("plan"),f({virtualMcpId:Zo(s.id),message:{parts:[{type:"text",text:`/writing-prompts ${t.id}
|
|
4
4
|
|
|
5
5
|
<instructions>
|
|
@@ -186,4 +186,4 @@ ${X}
|
|
|
186
186
|
|
|
187
187
|
<message>
|
|
188
188
|
${ge}
|
|
189
|
-
</message>`}]}}))},B=e.models?.credentialId||_||"",P=e.models?.thinking?.id||f?.modelId||"",O=qo({defaultValues:{name:e.name,active:e.active,credential_id:B,model_id:P}}),F=O.watch("active"),z=O.watch("credential_id"),V=O.watch("model_id"),{models:W,isLoading:U}=Tc(z||void 0),G=W.find(re=>re.modelId===V)??null,$=A.useRef(null),J=A.useRef(new Set),K=A.useRef(0),ee=A.useRef(null),oe=3e4,ie=()=>{ee.current&&(clearTimeout(ee.current),ee.current=null),$.current!==null&&(we("automation_updated",{automation_id:t,agent_id:n,fields:Array.from(J.current),save_count:K.current,edit_duration_ms:Date.now()-$.current}),$.current=null,J.current=new Set,K.current=0)},Z=async()=>{if(!(Object.keys(O.formState.dirtyFields).length>0)&&!E.current)return!0;const ge=Object.keys(O.formState.dirtyFields),Je=E.current;E.current=!1;const fe=O.getValues(),kt=I.current;try{const ps=fe.credential_id&&fe.model_id?fe.credential_id:"",X=fe.credential_id&&fe.model_id?fe.model_id:"",ae={id:t,name:fe.name,active:fe.active,agent:{id:n},models:{credentialId:ps,thinking:{id:X}},messages:Gl(kt),temperature:0};await l.mutateAsync(ae),$.current===null&&($.current=Date.now());for(const Ce of ge)J.current.add(Ce);return Je&&J.current.add("messages"),K.current+=1,ee.current&&clearTimeout(ee.current),ee.current=setTimeout(ie,oe),O.reset({...fe,credential_id:ps,model_id:X},{keepDirtyValues:!0}),!0}catch{return E.current=!0,!1}},ue=A.useRef(Z);ue.current=Z;const de=()=>{D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{D.current=null,ue.current()},1e3)},he=async()=>(D.current&&(clearTimeout(D.current),D.current=null),ue.current()),pe=re=>{if(I.current=re,x(re),!C.current){C.current=!0;return}E.current=!0,de()},We=A.useRef(!1);We.current||(We.current=!0,O.watch(()=>{de()})),A.useEffect(()=>()=>{D.current&&(clearTimeout(D.current),D.current=null,ue.current())},[]);const Be=async()=>{we("automation_test_clicked",{automation_id:t,agent_id:n});const re=await he();if(ie(),!re)return;if(!S){_e.error("No instructions configured for this automation");return}G&&z&&m({...G,keyId:z}),v({...g,toolApprovalLevel:"auto"});const ge=yn(S);d({message:{tiptapDoc:S,parts:ge},virtualMcpId:n||void 0})};return o.jsxs(o.Fragment,{children:[i&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(se,{variant:"ghost",size:"sm",onClick:i,children:[o.jsx(ja,{size:14}),"Back to list"]})}),o.jsxs("div",{className:"flex flex-col gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx(fs,{...O.register("name"),placeholder:"Automation name",className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}}),r&&o.jsx(se,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:r,children:o.jsx(mr,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Jt,{control:O.control,name:"active",render:({field:re})=>o.jsx(fr,{checked:re.value,onCheckedChange:ge=>{re.onChange(ge),setTimeout(()=>he(),0)},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:F?"Active":"Inactive"}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(da,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Starter"}),o.jsx(Tp,{automationId:t,open:y,onOpenChange:k,onCustomSelect:()=>{N(!0),R(!1),T("")},onEventSelect:()=>{R(!0),N(!1)}})]}),e.triggers.length===0&&!w?o.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:["When should this automation run?"," ",o.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>k(!0),children:"Add a starter"})," ","to get going."]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(re=>o.jsx(Rp,{trigger:re,automationId:t,connectionName:re.connection_id?u.get(re.connection_id):void 0},re.id))}),w&&o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[o.jsx(Rs,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:j,onChange:re=>T(re.target.value),onBlur:async()=>{const re=j.trim();if(!(!re||!Is(re)))try{await h.mutateAsync({automation_id:t,type:"cron",cron_expression:re}),we("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),_e.success("Starter added"),N(!1),T("")}catch{_e.error("Failed to add starter")}},onKeyDown:async re=>{const ge=j.trim();re.key==="Enter"&&ge&&Is(ge)&&re.target.blur(),re.key==="Escape"&&(N(!1),T(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),j&&!Is(j)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),h.isPending&&o.jsx(Ie,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),o.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{N(!1),T("")},children:o.jsx(ls,{size:13})})]}),M&&o.jsx(A.Suspense,{fallback:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[o.jsx(Ie,{size:13,className:"animate-spin text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:o.jsx(Mp,{automationId:t,onDone:()=>R(!1)})})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Instructions"}),o.jsxs(se,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:!S,onClick:L,children:[o.jsx(Ca,{size:13}),"Improve"]})]}),o.jsx(Ul,{tiptapDoc:S,setTiptapDoc:pe,placeholder:"What should this automation do?",children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(Vl,{virtualMcpId:n||null,className:"max-h-[45vh]"}),o.jsxs("div",{className:"flex items-center justify-end gap-1.5 p-2.5",children:[o.jsx(xh,{model:G,isLoading:U,credentialId:z||null,onCredentialChange:re=>{O.setValue("credential_id",re??"",{shouldDirty:!0}),O.setValue("model_id","",{shouldDirty:!0})},onModelChange:re=>O.setValue("model_id",re.modelId,{shouldDirty:!0}),placeholder:"Model"}),o.jsxs(Ke,{children:[o.jsx(qe,{asChild:!0,children:o.jsxs(se,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:Be,disabled:!n,children:[o.jsx(tc,{size:16}),"Test"]})}),o.jsx(Ge,{children:"Test Automation"})]})]})]})})]})]})]})}function Lp(t){const e=q.c(6),{tabId:s,virtualMcpId:i}=t;let r;e[0]!==s?(r=ea(s),e[0]=s,e[1]=r):r=e[1];const n=r;if(!n)return null;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let l;return e[3]!==n.id||e[4]!==i?(l=o.jsx(at,{children:o.jsx(at.Content,{children:o.jsx(at.Body,{children:o.jsx(A.Suspense,{fallback:a,children:o.jsx(Op,{id:n.id,virtualMcpId:i})})})})}),e[3]=n.id,e[4]=i,e[5]=l):l=e[5],l}function Op(t){const e=q.c(9),{id:s,virtualMcpId:i}=t,r=At(),{data:n,isLoading:a}=Sh(s);let l;e[0]!==r?(l=()=>r({to:".",search:zp,replace:!0}),e[0]=r,e[1]=l):l=e[1];const h=l;if(a){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=u):u=e[2],u}if(!n){let u;return e[3]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=u):u=e[3],u}let c;return e[4]!==n||e[5]!==s||e[6]!==h||e[7]!==i?(c=o.jsx(Pp,{automationId:s,automation:n,virtualMcpId:i,onBack:h}),e[4]=n,e[5]=s,e[6]=h,e[7]=i,e[8]=c):c=e[8],c}function zp(t){return{...t,main:"automations"}}function $p(t){const e=q.c(20),{virtualMcpId:s}=t,i=At(),{data:r}=yh(s),n=r===void 0?[]:r,{create:a}=Vs(),[l,h]=A.useState(""),c=l.toLowerCase(),u=n.filter(T=>T.name.toLowerCase().includes(c));let d;e[0]!==i?(d=T=>i({to:".",search:M=>({...M,main:"automation:"+T}),replace:!0}),e[0]=i,e[1]=d):d=e[1];const m=d,_=async()=>{if(a.isPending)return;we("automation_new_clicked",{virtual_mcp_id:s,existing_count:n.length});const T=await a.mutateAsync(Ch(s));m(T.id)},f=at,p=at,g=at;let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(at.Title,{children:"Automations"}),e[2]=v):v=e[2];const b=n.length>0&&o.jsx(kh,{value:l,onChange:h,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(cs,{size:14}),e[3]=S):S=e[3];let x;e[4]!==a.isPending||e[5]!==_?(x=o.jsxs(se,{size:"sm",onClick:_,disabled:a.isPending,children:[S,"New automation"]}),e[4]=a.isPending,e[5]=_,e[6]=x):x=e[6];let y;e[7]!==b||e[8]!==x?(y=o.jsxs("div",{className:"flex flex-col gap-6",children:[v,o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[b,x]})]}),e[7]=b,e[8]=x,e[9]=y):y=e[9];const k=n.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ps,{image:o.jsx(Ls,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Create your first automation to run this agent on a schedule or in response to events.",actions:o.jsxs(se,{size:"sm",onClick:_,disabled:a.isPending,children:[o.jsx(cs,{size:14}),"New automation"]})})}):u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ps,{image:o.jsx(Ls,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${l}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:u.map(T=>o.jsx(wh,{automation:T,onClick:()=>m(T.id)},T.id))});let w;e[10]!==k||e[11]!==g.Body||e[12]!==y?(w=o.jsxs(g.Body,{children:[y,k]}),e[10]=k,e[11]=g.Body,e[12]=y,e[13]=w):w=e[13];let N;e[14]!==w||e[15]!==p.Content?(N=o.jsx(p.Content,{children:w}),e[14]=w,e[15]=p.Content,e[16]=N):N=e[16];let j;return e[17]!==f||e[18]!==N?(j=o.jsx(f,{children:N}),e[17]=f,e[18]=N,e[19]=j):j=e[19],j}function Fp(t){const e=q.c(3),{virtualMcpId:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx(A.Suspense,{fallback:i,children:o.jsx($p,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}const zo=A.lazy(()=>Ol(()=>import("./project-app-view-CTLBsma1.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55])).then(t=>({default:t.AppViewContent})));function Hp(t){const e=q.c(44),{taskId:s,virtualMcpId:i}=t;let r;e[0]!==s||e[1]!==i?(r={virtualMcpId:i,taskId:s},e[0]=s,e[1]=i,e[2]=r):r=e[2];const{activeTab:n,layoutTabs:a,expandedTools:l,automationTabParsed:h}=Da(r);if(ac(n)){let f;return e[3]!==i?(f=o.jsx(Hn,{virtualMcpId:i}),e[3]=i,e[4]=f):f=e[4],f}if(n==="git"){let f;return e[5]!==i?(f=o.jsx(Cu,{virtualMcpId:i}),e[5]=i,e[6]=f):f=e[6],f}if(n==="automations"){let f;return e[7]!==i?(f=o.jsx(Fp,{virtualMcpId:i}),e[7]=i,e[8]=f):f=e[8],f}if(n==="env"){let f;return e[9]!==i?(f=o.jsx(wp,{virtualMcpId:i}),e[9]=i,e[10]=f):f=e[10],f}if(n==="preview"){let f;return e[11]!==i?(f=o.jsx(of,{virtualMcpId:i}),e[11]=i,e[12]=f):f=e[12],f}if(h){let f;return e[13]!==n||e[14]!==i?(f=o.jsx(Lp,{tabId:n,virtualMcpId:i}),e[13]=n,e[14]=i,e[15]=f):f=e[15],f}let c;e[16]!==n?(c=lc(n),e[16]=n,e[17]=c):c=e[17];const u=c;if(u){let f;if(e[18]!==l||e[19]!==u.connectionId||e[20]!==u.toolName){let S;e[22]!==u.connectionId||e[23]!==u.toolName?(S=x=>x.appId===u.connectionId&&x.toolName===u.toolName,e[22]=u.connectionId,e[23]=u.toolName,e[24]=S):S=e[24],f=l.find(S),e[18]=l,e[19]=u.connectionId,e[20]=u.toolName,e[21]=f}else f=e[21];const p=f;let g;e[25]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[25]=g):g=e[25];const v=p?.args;let b;return e[26]!==n||e[27]!==u.connectionId||e[28]!==u.toolName||e[29]!==v?(b=o.jsx(A.Suspense,{fallback:g,children:o.jsx(zo,{connectionId:u.connectionId,toolName:u.toolName,args:v},n)}),e[26]=n,e[27]=u.connectionId,e[28]=u.toolName,e[29]=v,e[30]=b):b=e[30],b}let d;if(e[31]!==n||e[32]!==a){let f;e[34]!==n?(f=p=>p.id===n,e[34]=n,e[35]=f):f=e[35],d=a.find(f),e[31]=n,e[32]=a,e[33]=d}else d=e[33];const m=d;if(m){let f;e[36]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[36]=f):f=e[36];let p;return e[37]!==n||e[38]!==m.id||e[39]!==m.view.appId||e[40]!==m.view.args?(p=o.jsx(A.Suspense,{fallback:f,children:o.jsx(zo,{connectionId:m.view.appId,toolName:m.id,args:m.view.args},n)}),e[37]=n,e[38]=m.id,e[39]=m.view.appId,e[40]=m.view.args,e[41]=p):p=e[41],p}let _;return e[42]!==i?(_=o.jsx(Hn,{virtualMcpId:i}),e[42]=i,e[43]=_):_=e[43],_}function Wp(t){const e=q.c(7),{children:s,defaultSize:i}=t,[,r]=A.useTransition();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Xo.decoChatPanelWidth(),e[0]=n):n=e[0];const[a,l]=Yo(n,45),h=i>0&&i<100?a:i;let c;e[1]!==l?(c=m=>r(()=>{m>0&&m<100&&l(m)}),e[1]=l,e[2]=c):c=e[2];const u=c;let d;return e[3]!==s||e[4]!==h||e[5]!==u?(d=o.jsx(ha,{defaultSize:h,minSize:20,collapsible:!0,collapsedSize:0,className:"min-w-0 overflow-hidden bg-sidebar",onResize:u,order:1,children:s}),e[3]=s,e[4]=h,e[5]=u,e[6]=d):d=e[6],d}function Up(t){const e=q.c(30),{virtualMcpId:s,taskId:i,chatOpen:r,mainOpen:n,chatContent:a}=t;let l;e[0]!==r||e[1]!==n?(l=Dn(r,n),e[0]=r,e[1]=n,e[2]=l):l=e[2];const h=l;let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=Xo.decoChatPanelWidth(),e[3]=c):c=e[3];const[u]=Yo(c,45),d=A.useRef(null);let m,_;e[4]!==r||e[5]!==n||e[6]!==u?(m=()=>{const T=d.current;if(!T)return;const M=Dn(r,n),R=M.chat>0&&M.chat<100?u:M.chat,C=M.chat>0&&M.chat<100?100-u:M.main;T.setLayout([R,C])},_=[r,n,u],e[4]=r,e[5]=n,e[6]=u,e[7]=m,e[8]=_):(m=e[7],_=e[8]),A.useEffect(m,_);const f=`${s}-${i}`;let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p={overflow:"visible"},e[9]=p):p=e[9];let g;e[10]!==a?(g=a??o.jsx(Ea,{}),e[10]=a,e[11]=g):g=e[11];let v;e[12]!==g?(v=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:"h-full bg-background rounded-[0.75rem] overflow-hidden card-shadow",children:g})}),e[12]=g,e[13]=v):v=e[13];let b;e[14]!==h.chat||e[15]!==v?(b=o.jsx(Wp,{defaultSize:h.chat,children:v}),e[14]=h.chat,e[15]=v,e[16]=b):b=e[16];let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(qc,{className:"bg-sidebar"}),e[17]=S):S=e[17];const x=h.main;let y;e[18]===Symbol.for("react.memo_cache_sentinel")?(y={overflow:"visible"},e[18]=y):y=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=te("flex flex-col h-full min-h-0 bg-background overflow-hidden","card-shadow","transition-[border-radius] duration-200 ease-[var(--ease-out-quart)]","rounded-[0.75rem]"),e[19]=k):k=e[19];let w;e[20]!==i||e[21]!==s?(w=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:k,children:o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx(Hp,{taskId:i,virtualMcpId:s})})})}),e[20]=i,e[21]=s,e[22]=w):w=e[22];let N;e[23]!==h.main||e[24]!==w?(N=o.jsx(ha,{className:"min-w-0 flex flex-col",order:2,defaultSize:x,style:y,collapsible:!0,collapsedSize:0,minSize:20,children:w}),e[23]=h.main,e[24]=w,e[25]=N):N=e[25];let j;return e[26]!==N||e[27]!==f||e[28]!==b?(j=o.jsxs(Gc,{ref:d,direction:"horizontal",className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",style:p,children:[b,S,N]},f),e[26]=N,e[27]=f,e[28]=b,e[29]=j):j=e[29],j}const cr="flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",$o="bg-sidebar-accent text-sidebar-foreground",hr="text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";function Vp(t){const e=q.c(47),{chatOpen:s,toggleChat:i,onNewTask:r}=t,{tasksOpen:n,toggleTasks:a}=Rc(),l=!!r;let h;e[0]!==n||e[1]!==a?(h=()=>{we("agent_toolbar_toggled",{button:"tasks",next_state:n?"closed":"open"}),a()},e[0]=n,e[1]=a,e[2]=h):h=e[2];const c=n?$o:hr;let u;e[3]!==c?(u=te(cr,c),e[3]=c,e[4]=u):u=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(kc,{size:16}),e[5]=d):d=e[5];let m;e[6]!==h||e[7]!==u||e[8]!==n?(m=o.jsx(qe,{asChild:!0,children:o.jsx("button",{type:"button",onClick:h,"aria-pressed":n,className:u,children:d})}),e[6]=h,e[7]=u,e[8]=n,e[9]=m):m=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Ge,{side:"bottom",children:"Tasks"}),e[10]=_):_=e[10];let f;e[11]!==m?(f=o.jsxs(Ke,{delayDuration:300,children:[m,_]}),e[11]=m,e[12]=f):f=e[12];let p;e[13]!==s||e[14]!==i?(p=()=>{we("agent_toolbar_toggled",{button:"chat",next_state:s?"closed":"open"}),i()},e[13]=s,e[14]=i,e[15]=p):p=e[15];const g=s?$o:hr;let v;e[16]!==g?(v=te(cr,g),e[16]=g,e[17]=v):v=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Nc,{size:16}),e[18]=b):b=e[18];let S;e[19]!==s||e[20]!==v||e[21]!==p?(S=o.jsx(qe,{asChild:!0,children:o.jsx("button",{type:"button",onClick:p,"aria-pressed":s,className:v,children:b})}),e[19]=s,e[20]=v,e[21]=p,e[22]=S):S=e[22];let x;e[23]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Ge,{side:"bottom",children:"Chat"}),e[23]=x):x=e[23];let y;e[24]!==S?(y=o.jsxs(Ke,{delayDuration:300,children:[S,x]}),e[24]=S,e[25]=y):y=e[25];const k=l?"grid-cols-[1fr]":"grid-cols-[0fr]";let w;e[26]!==k?(w=te("grid transition-[grid-template-columns] duration-200 ease-[var(--ease-out-quart)]",k),e[26]=k,e[27]=w):w=e[27];const N=!l,j=l?0:-1,T=!l,M=l?"translate-x-0 opacity-100":"-translate-x-2 opacity-0";let R;e[28]!==M?(R=te(cr,hr,"transition-[transform,opacity] duration-200 ease-[var(--ease-out-quart)] will-change-transform",M),e[28]=M,e[29]=R):R=e[29];let C;e[30]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(ia,{size:16}),e[30]=C):C=e[30];let D;e[31]!==r||e[32]!==N||e[33]!==j||e[34]!==T||e[35]!==R?(D=o.jsx(qe,{asChild:!0,children:o.jsx("button",{type:"button",onClick:r,disabled:N,tabIndex:j,"aria-hidden":T,className:R,children:C})}),e[31]=r,e[32]=N,e[33]=j,e[34]=T,e[35]=R,e[36]=D):D=e[36];let E;e[37]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(Ge,{side:"bottom",children:"New task"}),e[37]=E):E=e[37];let I;e[38]!==D?(I=o.jsx("div",{className:"overflow-hidden",children:o.jsxs(Ke,{delayDuration:300,children:[D,E]})}),e[38]=D,e[39]=I):I=e[39];let L;e[40]!==w||e[41]!==I?(L=o.jsx("div",{className:w,children:I}),e[40]=w,e[41]=I,e[42]=L):L=e[42];let B;return e[43]!==y||e[44]!==L||e[45]!==f?(B=o.jsxs(o.Fragment,{children:[f,y,L]}),e[43]=y,e[44]=L,e[45]=f,e[46]=B):B=e[46],B}function Kp(t,e,s){if(t.length<=s)return{visible:t,overflow:[]};const i=t.slice(0,s),r=t.slice(s);if(e==null)return{visible:i,overflow:r};if(i.some(d=>d.id===e))return{visible:i,overflow:r};const a=r.findIndex(d=>d.id===e);if(a===-1)return{visible:i,overflow:r};const l=i[i.length-1],h=r[a],c=[...i.slice(0,-1),h],u=[l,...r.slice(0,a),...r.slice(a+1)];return{visible:c,overflow:u}}function qp(t){const e=q.c(13),{title:s,icon:i,active:r,onClick:n}=t,a=r?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";let l;e[0]!==a?(l=te("shrink-0 flex items-center gap-1.5 h-8 rounded-md px-2","[transition:background-color_180ms_ease,color_180ms_ease]",a),e[0]=a,e[1]=l):l=e[1];let h;e[2]!==i?(h=o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(Gp,{icon:i})}),e[2]=i,e[3]=h):h=e[3];let c;e[4]!==s?(c=o.jsx("span",{className:"whitespace-nowrap text-sm font-medium leading-none",children:s}),e[4]=s,e[5]=c):c=e[5];let u;return e[6]!==r||e[7]!==n||e[8]!==l||e[9]!==h||e[10]!==c||e[11]!==s?(u=o.jsxs("button",{type:"button",onClick:n,"aria-pressed":r,"aria-label":s,className:l,children:[h,c]}),e[6]=r,e[7]=n,e[8]=l,e[9]=h,e[10]=c,e[11]=s,e[12]=u):u=e[12],u}function Gp(t){const e=q.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:r}=s;let n;return e[0]!==r?(n=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=n):n=e[1],n}if(s.kind==="url"){let r;return e[2]!==s.src?(r=o.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=r):r=e[3],r}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(la,{className:"size-4"}),e[4]=i):i=e[4],i}function Yp(t){const e=q.c(13),{overflow:s,onSelect:i}=t,[r,n]=A.useState(!1);let a;e[0]!==i?(a=m=>{n(!1),i(m)},e[0]=i,e[1]=a):a=e[1];const l=a;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Hs,{asChild:!0,children:o.jsx("button",{type:"button",title:"More tabs","aria-label":"More tabs",className:"shrink-0 flex size-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:o.jsx(na,{className:"size-4"})})}),e[2]=h):h=e[2];let c;if(e[3]!==l||e[4]!==s){let m;e[6]!==l?(m=_=>o.jsx("li",{children:o.jsxs("button",{type:"button",onClick:()=>l(_.id),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md hover:bg-accent text-sm text-foreground",children:[o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(Xp,{icon:_.icon})}),o.jsx("span",{className:"truncate",children:_.title})]})},_.id),e[6]=l,e[7]=m):m=e[7],c=s.map(m),e[3]=l,e[4]=s,e[5]=c}else c=e[5];let u;e[8]!==c?(u=o.jsx(Ws,{align:"end",className:"w-56 p-1",children:o.jsx("ul",{className:"flex flex-col",children:c})}),e[8]=c,e[9]=u):u=e[9];let d;return e[10]!==r||e[11]!==u?(d=o.jsxs(Us,{open:r,onOpenChange:n,children:[h,u]}),e[10]=r,e[11]=u,e[12]=d):d=e[12],d}function Xp(t){const e=q.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:r}=s;let n;return e[0]!==r?(n=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=n):n=e[1],n}if(s.kind==="url"){let r;return e[2]!==s.src?(r=o.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=r):r=e[3],r}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(la,{className:"size-4"}),e[4]=i):i=e[4],i}const Jp=6;function Zp(t){const e=q.c(20),{virtualMcpId:s,taskId:i}=t,r=At();let n;e[0]!==i||e[1]!==s?(n={virtualMcpId:s,taskId:i},e[0]=i,e[1]=s,e[2]=n):n=e[2];const{tabs:a,activeTab:l,mainOpen:h,setActiveTab:c}=Da(n);let u,d,m,_;if(e[3]!==l||e[4]!==h||e[5]!==r||e[6]!==c||e[7]!==a||e[8]!==s){const g=cc({activeTab:l,mainOpen:h}),v=k=>k.id==="automations"?g:h&&k.id===l,S=a.find(k=>v(k))?.id??null,{visible:x,overflow:y}=Kp(a,S,Jp);d=y,u=k=>{const w=a.find(j=>j.id===k),N=S===k&&h;if(we("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:k,tab_kind:w?.kind??null,was_active:N}),k==="automations"){const j=hc({activeTab:l,mainOpen:h});r({to:".",search:T=>({...T,main:j}),replace:!0});return}c(k)},m="flex items-center min-w-0 ml-auto gap-0.5",_=x.map(k=>o.jsx(qp,{title:k.title,icon:k.icon,active:v(k),onClick:()=>u(k.id)},k.id)),e[3]=l,e[4]=h,e[5]=r,e[6]=c,e[7]=a,e[8]=s,e[9]=u,e[10]=d,e[11]=m,e[12]=_}else u=e[9],d=e[10],m=e[11],_=e[12];let f;e[13]!==u||e[14]!==d?(f=d.length>0&&o.jsx(Yp,{overflow:d,onSelect:u}),e[13]=u,e[14]=d,e[15]=f):f=e[15];let p;return e[16]!==m||e[17]!==_||e[18]!==f?(p=o.jsxs("div",{className:m,children:[_,f]}),e[16]=m,e[17]=_,e[18]=f,e[19]=p):p=e[19],p}function Qp(t){const e=q.c(12);let s,i,r,n;e[0]!==t?({className:s,orientation:r,decorative:n,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r,e[4]=n):(s=e[1],i=e[2],r=e[3],n=e[4]);const a=r===void 0?"horizontal":r,l=n===void 0?!0:n;let h;e[5]!==s?(h=te("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",s),e[5]=s,e[6]=h):h=e[6];let c;return e[7]!==l||e[8]!==a||e[9]!==i||e[10]!==h?(c=o.jsx(zl,{"data-slot":"separator-root",decorative:l,orientation:a,className:h,...i}),e[7]=l,e[8]=a,e[9]=i,e[10]=h,e[11]=c):c=e[11],c}function eg(t){const e=q.c(20),{prNumber:s,disabled:i,send:r}=t;let n;e[0]!==s||e[1]!==r?(n=()=>r(fu({prNumber:s})),e[0]=s,e[1]=r,e[2]=n):n=e[2];const a=n;let l;e[3]!==s||e[4]!==r?(l=()=>r(uu({prNumber:s})),e[3]=s,e[4]=r,e[5]=l):l=e[5];const h=l;let c;e[6]!==i||e[7]!==a?(c=o.jsx(se,{size:"sm",variant:"success",className:"rounded-r-none border-r border-success-foreground/20",disabled:i,onClick:a,children:"Publish"}),e[6]=i,e[7]=a,e[8]=c):c=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(_r,{className:"h-3.5 w-3.5"}),e[9]=u):u=e[9];let d;e[10]!==i?(d=o.jsx(os,{asChild:!0,children:o.jsx(se,{size:"sm",variant:"success",className:"rounded-l-none px-2",disabled:i,"aria-label":"More actions",children:u})}),e[10]=i,e[11]=d):d=e[11];let m;e[12]!==h?(m=o.jsx(as,{align:"end",children:o.jsx(St,{onClick:h,children:"Review"})}),e[12]=h,e[13]=m):m=e[13];let _;e[14]!==d||e[15]!==m?(_=o.jsxs(ns,{children:[d,m]}),e[14]=d,e[15]=m,e[16]=_):_=e[16];let f;return e[17]!==c||e[18]!==_?(f=o.jsxs("div",{className:"inline-flex items-stretch rounded-md",children:[c,_]}),e[17]=c,e[18]=_,e[19]=f):f=e[19],f}const tg=new Set(["failure","timed_out","cancelled","action_required"]);function sg(t){return t.status==="completed"&&tg.has(t.conclusion)}function ig(t){return t.status==="queued"||t.status==="in_progress"}function rg(t){const{branchStatus:e,pr:s,checks:i,reviews:r,loading:n}=t;if(!e||n)return{label:"Loading…",disabled:!0,loading:!0,variant:"outline",tooltip:"Loading branch and pull request status"};if(e.workingTreeDirty||e.unpushed>0)return{label:"Save changes",action:"commit-and-push",variant:"default",tooltip:"Commit and push local changes"};if(s?.merged)return!!e.headSha&&!!s.headSha&&e.headSha!==s.headSha?{label:"Continue",action:"create-pr",variant:"special",tooltip:"Open a new PR with the latest commits"}:{label:"Published",disabled:!0,variant:"outline",tooltip:`PR #${s.number} merged into ${s.base}`};if(e.aheadOfBase>0){if(s&&s.state==="closed"&&!s.merged)return{label:"Reopen",action:"reopen",variant:"default",tooltip:`Reopen PR #${s.number}`};if(!s)return{label:"Submit for review",action:"create-pr",variant:"default",tooltip:`Open a PR for ${e.branch} → ${e.base}`};if((r?.mergeableState??"unknown")==="dirty")return{label:`Sync with ${s.base}`,action:"rebase",variant:"default",tooltip:`Resolve conflicts with ${s.base} before merging`};const h=i.filter(sg).map(d=>d.name);if(h.length>0)return{label:"Fix tests",action:"fix-checks",variant:"default",tooltip:`Failing: ${h.join(", ")}`,meta:{failingChecks:h}};const c=i.filter(ig);if(c.length>0)return{label:"Running tests…",disabled:!0,loading:!0,variant:"outline",tooltip:`Waiting on ${c.length} check${c.length===1?"":"s"} to finish`};if(r?.draft)return{label:"Mark ready",action:"mark-ready",variant:"default",tooltip:"Mark draft PR ready for review"};const u=r?.unresolvedConversations??0;return u>0?{label:"Address feedback",action:"resolve-comments",variant:"default",tooltip:`${u} unresolved conversation${u===1?"":"s"}`}:r?.missingRequiredApprovals?{label:"Awaiting review",disabled:!0,variant:"outline",tooltip:"Waiting for required approvals"}:{label:"Publish",action:"merge-split",variant:"success",tooltip:`Squash-merge PR #${s.number} into ${s.base}`}}return{label:"Up to date",disabled:!0,variant:"outline",tooltip:`Branch is in sync with ${e.base}`}}function ng(){return Kt().branchStatus}const og=6e4,ag=3e4;function lg(t){const e=q.c(12);let s;e[0]!==t.connectionId||e[1]!==t.orgId||e[2]!==t.orgSlug?(s={connectionId:t.connectionId,orgId:t.orgId,orgSlug:t.orgSlug},e[0]=t.connectionId,e[1]=t.orgId,e[2]=t.orgSlug,e[3]=s):s=e[3];const i=He(s),r=t.prNumber??0;let n;e[4]!==t.owner||e[5]!==t.repo||e[6]!==r?(n={method:"get",owner:t.owner,repo:t.repo,pullNumber:r},e[4]=t.owner,e[5]=t.repo,e[6]=r,e[7]=n):n=e[7];const a=!!t.prNumber;let l;return e[8]!==i||e[9]!==n||e[10]!==a?(l={client:i,toolName:"pull_request_read",toolArguments:n,enabled:a,refetchInterval:og,refetchIntervalInBackground:!1,staleTime:ag,select:cg},e[8]=i,e[9]=n,e[10]=a,e[11]=l):l=e[11],us(l)}function cg(t){const e=Ks(t);if(!e)return null;const s=e.mergeable_state??"unknown",i=!!(e.draft??!1),r=Number(e.review_comments??0),n=s==="blocked"&&r>0?r:0;return{draft:i,mergeableState:s,unresolvedConversations:n,missingRequiredApprovals:s==="blocked"&&n===0}}function hg(t){const e=q.c(42),{virtualMcpId:s}=t,{org:i}=xe(),r=yt(s),{currentBranch:n}=lt(),a=Ni(),l=r?.metadata?.githubRepo??null,h=ng(),c=l?.connectionId??"",u=l?.owner??"",d=l?.name??"",m=n??null;let _;e[0]!==i.id||e[1]!==i.slug||e[2]!==c||e[3]!==u||e[4]!==d||e[5]!==m?(_={orgId:i.id,orgSlug:i.slug,connectionId:c,owner:u,repo:d,branch:m},e[0]=i.id,e[1]=i.slug,e[2]=c,e[3]=u,e[4]=d,e[5]=m,e[6]=_):_=e[6];const f=Ia(_),p=f.data??null,g=l?.connectionId??"",v=l?.owner??"",b=l?.name??"",S=p&&p.state==="open"?p.number:null;let x;e[7]!==i.id||e[8]!==i.slug||e[9]!==g||e[10]!==v||e[11]!==b||e[12]!==S?(x={orgId:i.id,orgSlug:i.slug,connectionId:g,owner:v,repo:b,prNumber:S},e[7]=i.id,e[8]=i.slug,e[9]=g,e[10]=v,e[11]=b,e[12]=S,e[13]=x):x=e[13];const y=Ba(x),k=l?.connectionId??"",w=l?.owner??"",N=l?.name??"",j=p&&p.state==="open"?p.number:null;let T;e[14]!==i.id||e[15]!==i.slug||e[16]!==k||e[17]!==w||e[18]!==N||e[19]!==j?(T={orgId:i.id,orgSlug:i.slug,connectionId:k,owner:w,repo:N,prNumber:j},e[14]=i.id,e[15]=i.slug,e[16]=k,e[17]=w,e[18]=N,e[19]=j,e[20]=T):T=e[20];const M=lg(T);if(!l?.connectionId||!n)return null;let R;e[21]!==h||e[22]!==y.data||e[23]!==p||e[24]!==f.isPending||e[25]!==M.data?(R=rg({branchStatus:h,pr:p,checks:y.data??[],reviews:M.data??null,loading:f.isPending}),e[21]=h,e[22]=y.data,e[23]=p,e[24]=f.isPending,e[25]=M.data,e[26]=R):R=e[26];const C=R;let D;e[27]!==a?(D=z=>a.sendMessage({parts:[{type:"text",text:z}]}),e[27]=a,e[28]=D):D=e[28];const E=D,I=a.isStreaming;let L;e[29]!==n||e[30]!==C||e[31]!==I||e[32]!==p||e[33]!==E?(L=z=>{if(!I)switch(z){case"commit-and-push":{E(ru({branch:n}));return}case"create-pr":{E(nu({branch:n}));return}case"reopen":{p&&E(ou({prNumber:p.number}));return}case"rebase":{E(au({branch:n}));return}case"fix-checks":{p&&E(cu({prNumber:p.number,failingChecks:C.meta?.failingChecks??[]}));return}case"mark-ready":{p&&E(hu({prNumber:p.number}));return}case"resolve-comments":{p&&E(du({prNumber:p.number}));return}case"merge-split":return}},e[29]=n,e[30]=C,e[31]=I,e[32]=p,e[33]=E,e[34]=L):L=e[34];const B=L;let P;e[35]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(Qp,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-5"}),e[35]=P):P=e[35];const O=p?.number;let F;return e[36]!==C||e[37]!==I||e[38]!==B||e[39]!==E||e[40]!==O?(F=o.jsxs(o.Fragment,{children:[P,o.jsx(dg,{button:C,isStreaming:I,onActivate:B,prNumber:O,send:E})]}),e[36]=C,e[37]=I,e[38]=B,e[39]=E,e[40]=O,e[41]=F):F=e[41],F}function dg(t){const e=q.c(21),{button:s,isStreaming:i}=t,r=!!s.disabled||i,n=i?"Chat is running":s.tooltip??null;if(s.action==="merge-split"&&t.prNumber!=null){let u;e[0]!==r||e[1]!==t.prNumber||e[2]!==t.send?(u=o.jsx(eg,{prNumber:t.prNumber,disabled:r,send:t.send}),e[0]=r,e[1]=t.prNumber,e[2]=t.send,e[3]=u):u=e[3];let d;return e[4]!==u||e[5]!==n?(d=o.jsx(Fo,{label:n,children:u}),e[4]=u,e[5]=n,e[6]=d):d=e[6],d}let a;e[7]!==s.action||e[8]!==t?(a=()=>t.onActivate(s.action),e[7]=s.action,e[8]=t,e[9]=a):a=e[9];let l;e[10]!==s.loading?(l=s.loading?o.jsx(fh,{size:"xs",variant:"default"}):null,e[10]=s.loading,e[11]=l):l=e[11];let h;e[12]!==s.label||e[13]!==s.variant||e[14]!==r||e[15]!==a||e[16]!==l?(h=o.jsxs(se,{size:"sm",variant:s.variant,disabled:r,onClick:a,children:[l,s.label]}),e[12]=s.label,e[13]=s.variant,e[14]=r,e[15]=a,e[16]=l,e[17]=h):h=e[17];let c;return e[18]!==h||e[19]!==n?(c=o.jsx(Fo,{label:n,children:h}),e[18]=h,e[19]=n,e[20]=c):c=e[20],c}function Fo(t){const e=q.c(9),{label:s,children:i}=t;if(!s){let l;return e[0]!==i?(l=o.jsx(o.Fragment,{children:i}),e[0]=i,e[1]=l):l=e[1],l}let r;e[2]!==i?(r=o.jsx(qe,{asChild:!0,children:o.jsx("span",{children:i})}),e[2]=i,e[3]=r):r=e[3];let n;e[4]!==s?(n=o.jsx(Ge,{children:s}),e[4]=s,e[5]=n):n=e[5];let a;return e[6]!==r||e[7]!==n?(a=o.jsx(Fc,{children:o.jsxs(Ke,{children:[r,n]})}),e[6]=r,e[7]=n,e[8]=a):a=e[8],a}function ug(t){const e=q.c(2),{virtualMcp:s}=t;if(!!!(s.metadata?.githubRepo??null)?.connectionId)return null;let n;return e[0]!==s.id?(n=o.jsx(ur.Right,{children:o.jsx(hg,{virtualMcpId:s.id})}),e[0]=s.id,e[1]=n):n=e[1],n}const Zt=A.createContext(null);function bn(){return A.use(Zt)}function Ho(t){const e=q.c(7),{children:s}=t,{taskId:i}=lt();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Something went wrong loading the chat. Try refreshing."}),e[0]=r):r=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Ee.Skeleton,{}),e[1]=n):n=e[1];let a;e[2]!==s?(a=s??o.jsx(Ea,{}),e[2]=s,e[3]=a):a=e[3];let l;return e[4]!==a||e[5]!==i?(l=o.jsx(es,{fallback:r,children:o.jsx(A.Suspense,{fallback:n,children:o.jsx(Ee.ActiveTaskProvider,{taskId:i,children:a})})}),e[4]=a,e[5]=i,e[6]=l):l=e[6],l}function Wo(t){const e=q.c(3),{onNewTaskRef:s,createNewTask:i}=t;let r;return e[0]!==i||e[1]!==s?(r=()=>(s.current=i,()=>{s.current=null}),e[0]=i,e[1]=s,e[2]=r):r=e[2],A.useLayoutEffect(r),null}function fg(t){const e=q.c(3),{onOpenSidebar:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Xl,{size:20}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx("div",{className:"shrink-0 flex items-center justify-between px-3 h-12 bg-background border-b border-border",children:o.jsx("button",{type:"button",onClick:s,className:"flex size-8 items-center justify-center rounded-md text-foreground/60 hover:bg-accent hover:text-foreground transition-colors","aria-label":"Open menu",children:i})}),e[1]=s,e[2]=r):r=e[2],r}function Uo(t){const e=q.c(16),{virtualMcpId:s,hasActiveGithubRepo:i,vmMap:r,children:n}=t,{org:a}=xe(),{currentBranch:l}=lt(),{data:h}=Ci.useSession(),c=h?.user?.id;let u;e[0]!==a.id||e[1]!==a.slug?(u={connectionId:Bt,orgId:a.id,orgSlug:a.slug},e[0]=a.id,e[1]=a.slug,e[2]=u):u=e[2];const d=He(u),{mutate:m}=an(d);let _;e[3]===Symbol.for("react.memo_cache_sentinel")?(_=new Set,e[3]=_):_=e[3];const f=A.useRef(_);let p,g;e[4]!==l||e[5]!==i||e[6]!==m||e[7]!==c||e[8]!==s||e[9]!==r?(p=()=>{if(i&&c&&l){if(r?.[c]?.[l]){f.current.add(l);return}f.current.has(l)||(f.current.add(l),m({virtualMcpId:s,branch:l},{onError:mg}))}},g=[i,c,l,r,s,m],e[4]=l,e[5]=i,e[6]=m,e[7]=c,e[8]=s,e[9]=r,e[10]=p,e[11]=g):(p=e[10],g=e[11]),A.useEffect(p,g);const v=l??null;let b;return e[12]!==n||e[13]!==v||e[14]!==s?(b=o.jsx(zu,{virtualMcpId:s,branch:v,children:n}),e[12]=n,e[13]=v,e[14]=s,e[15]=b):b=e[15],b}function mg(t){console.error("[auto-start-vm] failed:",t)}function _g(){const t=q.c(96),e=ca(),s=At(),{org:i}=xe(),r=Dc()?.tasksOpen??!1;Hc(i.slug);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const a=$l(n),l=a.org??"";let h;t[1]===Symbol.for("react.memo_cache_sentinel")?(h={strict:!1},t[1]=h):h=t[1];const c=Qr(h);let u;t[2]!==i.id||t[3]!==c.virtualmcpid?(u=c.virtualmcpid??Jo(i.id).id,t[2]=i.id,t[3]=c.virtualmcpid,t[4]=u):u=t[4];const d=u,m=Eh(a.taskId??"",d),_=yt(d),f=_?.metadata?.ui?.layout??null;let p;t[5]!==f?(p=f?{defaultMainView:f.defaultMainView??null,chatDefaultOpen:f.chatDefaultOpen??null}:null,t[5]=f,t[6]=p):p=t[6];const g=p;let v;t[7]!==_?(v=_&&Ut(_),t[7]=_,t[8]=v):v=t[8];const b=!!v;let S;t[9]!==l||t[10]!==d?(S={virtualMcpId:d,orgSlug:l,isAgentRoute:!0},t[9]=l,t[10]=d,t[11]=S):S=t[11];const x=Mc(g,S),{setOpenMobile:y,openMobile:k}=Lc(),w=y,N=A.useRef(null);let j,T;t[12]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{const U=G=>{Bc(G)&&G.shiftKey&&G.code==="KeyS"&&!G.repeat&&(G.preventDefault(),N.current?.())};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},T=[],t[12]=j,t[13]=T):(j=t[12],T=t[13]),A.useEffect(j,T);const M=d;let R;t[14]!==_||t[15]!==d?(R={virtualMcpId:d,entity:_},t[14]=_,t[15]=d,t[16]=R):R=t[16];const C=R;if(m.status==="creating"||m.status==="loading"){let U;t[17]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[o.jsx(Ie,{className:"size-4 animate-spin mr-2"}),"Creating task…"]})}),t[17]=U):U=t[17];let G;return t[18]!==C?(G=o.jsx(Zt,{value:C,children:U}),t[18]=C,t[19]=G):G=t[19],G}if(m.status==="error"){let U;t[20]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx("div",{className:"font-medium",children:"Task unavailable"}),t[20]=U):U=t[20];let G;t[21]!==m.error.message?(G=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{className:"flex flex-col h-full items-center justify-center gap-2 bg-background card-shadow rounded-[0.75rem] p-8 text-sm",children:[U,o.jsx("div",{className:"text-muted-foreground",children:m.error.message})]})}),t[21]=m.error.message,t[22]=G):G=t[22];let $;return t[23]!==C||t[24]!==G?($=o.jsx(Zt,{value:C,children:G}),t[23]=C,t[24]=G,t[25]=$):$=t[25],$}if(!_){let U;t[26]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx(Bs,{size:48,className:"text-muted-foreground"}),t[26]=U):U=t[26];const G=`The agent "${d}" does not exist in this organization.`;let $;t[27]!==s||t[28]!==l?($=o.jsx(se,{variant:"outline",onClick:()=>s({to:"/$org",params:{org:l}}),children:"Go to organization home"}),t[27]=s,t[28]=l,t[29]=$):$=t[29];let J;t[30]!==G||t[31]!==$?(J=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:o.jsx(Ps,{image:U,title:"Agent not found",description:G,actions:$})})}),t[30]=G,t[31]=$,t[32]=J):J=t[32];let K;return t[33]!==C||t[34]!==J?(K=o.jsx(Zt,{value:C,children:J}),t[33]=C,t[34]=J,t[35]=K):K=t[35],K}if(e){let U;t[36]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx(Oc,{className:"sr-only",children:"Navigation"}),t[36]=U):U=t[36];let G;t[37]!==w?(G=o.jsx("div",{className:"w-14 shrink-0 bg-sidebar flex flex-col items-center border-r border-border overflow-y-auto group/sidebar","data-state":"collapsed",children:o.jsx(Ic,{onClose:()=>w(!1)})}),t[37]=w,t[38]=G):G=t[38];let $;t[39]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:o.jsx(Ac,{})}),t[39]=$):$=t[39];let J;t[40]!==G?(J=o.jsxs(zc,{side:"left",hideCloseButton:!0,className:"w-[calc(100vw-3rem)] sm:max-w-md! p-0",children:[U,o.jsxs("div",{className:"flex h-full",children:[G,$]})]}),t[40]=G,t[41]=J):J=t[41];let K;t[42]!==k||t[43]!==w||t[44]!==J?(K=o.jsx($c,{open:k,onOpenChange:w,children:J}),t[42]=k,t[43]=w,t[44]=J,t[45]=K):K=t[45];const ee=K,oe=_?.metadata?.vmMap;let ie;t[46]!==x.createNewTask?(ie=o.jsx(Wo,{onNewTaskRef:N,createNewTask:x.createNewTask}),t[46]=x.createNewTask,t[47]=ie):ie=t[47];let Z;t[48]!==w?(Z=o.jsx(fg,{onOpenSidebar:()=>w(!0)}),t[48]=w,t[49]=Z):Z=t[49];let ue;t[50]===Symbol.for("react.memo_cache_sentinel")?(ue=o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx(Ho,{})}),t[50]=ue):ue=t[50];let de;t[51]!==b||t[52]!==ee||t[53]!==oe||t[54]!==ie||t[55]!==Z||t[56]!==d?(de=o.jsxs(Uo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:oe,children:[ie,Z,ue,ee]}),t[51]=b,t[52]=ee,t[53]=oe,t[54]=ie,t[55]=Z,t[56]=d,t[57]=de):de=t[57];let he;t[58]!==M||t[59]!==de?(he=o.jsx("div",{className:"flex flex-col flex-1 bg-background min-h-0",children:o.jsx(Ee.Provider,{virtualMcpId:M,children:de},M)}),t[58]=M,t[59]=de,t[60]=he):he=t[60];let pe;return t[61]!==C||t[62]!==he?(pe=o.jsx(Zt,{value:C,children:he}),t[61]=C,t[62]=he,t[63]=pe):pe=t[63],pe}const D=r?void 0:x.createNewTask;let E;t[64]!==x.chatOpen||t[65]!==x.toggleChat||t[66]!==D?(E=o.jsx(ur.Toggles,{children:o.jsx(Vp,{chatOpen:x.chatOpen,toggleChat:x.toggleChat,onNewTask:D})}),t[64]=x.chatOpen,t[65]=x.toggleChat,t[66]=D,t[67]=E):E=t[67];let I;t[68]!==x.taskId||t[69]!==d?(I=o.jsx(ur.Tabs,{children:o.jsx(Zp,{virtualMcpId:d,taskId:x.taskId})}),t[68]=x.taskId,t[69]=d,t[70]=I):I=t[70];const L=_?.metadata?.vmMap;let B;t[71]!==_?(B=o.jsx(ug,{virtualMcp:_}),t[71]=_,t[72]=B):B=t[72];let P;t[73]!==x.createNewTask?(P=o.jsx(Wo,{onNewTaskRef:N,createNewTask:x.createNewTask}),t[73]=x.createNewTask,t[74]=P):P=t[74];let O;t[75]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx(Ho,{}),t[75]=O):O=t[75];let F;t[76]!==x.chatOpen||t[77]!==x.mainOpen||t[78]!==x.taskId||t[79]!==d?(F=o.jsx(Up,{virtualMcpId:d,taskId:x.taskId,chatOpen:x.chatOpen,mainOpen:x.mainOpen,chatContent:O}),t[76]=x.chatOpen,t[77]=x.mainOpen,t[78]=x.taskId,t[79]=d,t[80]=F):F=t[80];let z;t[81]!==b||t[82]!==L||t[83]!==B||t[84]!==P||t[85]!==F||t[86]!==d?(z=o.jsxs(Uo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:L,children:[B,P,F]}),t[81]=b,t[82]=L,t[83]=B,t[84]=P,t[85]=F,t[86]=d,t[87]=z):z=t[87];let V;t[88]!==M||t[89]!==I||t[90]!==z?(V=o.jsxs(Ee.Provider,{virtualMcpId:M,children:[I,z]},M),t[88]=M,t[89]=I,t[90]=z,t[91]=V):V=t[91];let W;return t[92]!==C||t[93]!==E||t[94]!==V?(W=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:o.jsxs(Zt,{value:C,children:[E,V]})}),t[92]=C,t[93]=E,t[94]=V,t[95]=W):W=t[95],W}function S1(){const t=q.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(A.Suspense,{fallback:o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),children:o.jsx(_g,{})}),t[0]=e):e=t[0],e}export{S1 as default,bn as useInsetContext};
|
|
189
|
+
</message>`}]}}))},B=e.models?.credentialId||_||"",P=e.models?.thinking?.id||f?.modelId||"",O=qo({defaultValues:{name:e.name,active:e.active,credential_id:B,model_id:P}}),F=O.watch("active"),z=O.watch("credential_id"),V=O.watch("model_id"),{models:W,isLoading:U}=Tc(z||void 0),G=W.find(re=>re.modelId===V)??null,$=A.useRef(null),J=A.useRef(new Set),K=A.useRef(0),ee=A.useRef(null),oe=3e4,ie=()=>{ee.current&&(clearTimeout(ee.current),ee.current=null),$.current!==null&&(we("automation_updated",{automation_id:t,agent_id:n,fields:Array.from(J.current),save_count:K.current,edit_duration_ms:Date.now()-$.current}),$.current=null,J.current=new Set,K.current=0)},Z=async()=>{if(!(Object.keys(O.formState.dirtyFields).length>0)&&!E.current)return!0;const ge=Object.keys(O.formState.dirtyFields),Je=E.current;E.current=!1;const fe=O.getValues(),kt=I.current;try{const ps=fe.credential_id&&fe.model_id?fe.credential_id:"",X=fe.credential_id&&fe.model_id?fe.model_id:"",ae={id:t,name:fe.name,active:fe.active,agent:{id:n},models:{credentialId:ps,thinking:{id:X}},messages:Gl(kt),temperature:0};await l.mutateAsync(ae),$.current===null&&($.current=Date.now());for(const Ce of ge)J.current.add(Ce);return Je&&J.current.add("messages"),K.current+=1,ee.current&&clearTimeout(ee.current),ee.current=setTimeout(ie,oe),O.reset({...fe,credential_id:ps,model_id:X},{keepDirtyValues:!0}),!0}catch{return E.current=!0,!1}},ue=A.useRef(Z);ue.current=Z;const de=()=>{D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{D.current=null,ue.current()},1e3)},he=async()=>(D.current&&(clearTimeout(D.current),D.current=null),ue.current()),pe=re=>{if(I.current=re,x(re),!C.current){C.current=!0;return}E.current=!0,de()},We=A.useRef(!1);We.current||(We.current=!0,O.watch(()=>{de()})),A.useEffect(()=>()=>{D.current&&(clearTimeout(D.current),D.current=null,ue.current())},[]);const Be=async()=>{we("automation_test_clicked",{automation_id:t,agent_id:n});const re=await he();if(ie(),!re)return;if(!S){_e.error("No instructions configured for this automation");return}G&&z&&m({...G,keyId:z}),v({...g,toolApprovalLevel:"auto"});const ge=yn(S);d({message:{tiptapDoc:S,parts:ge},virtualMcpId:n||void 0})};return o.jsxs(o.Fragment,{children:[i&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(se,{variant:"ghost",size:"sm",onClick:i,children:[o.jsx(ja,{size:14}),"Back to list"]})}),o.jsxs("div",{className:"flex flex-col gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx(fs,{...O.register("name"),placeholder:"Automation name",className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}}),r&&o.jsx(se,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:r,children:o.jsx(mr,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Jt,{control:O.control,name:"active",render:({field:re})=>o.jsx(fr,{checked:re.value,onCheckedChange:ge=>{re.onChange(ge),setTimeout(()=>he(),0)},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:F?"Active":"Inactive"}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(da,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Starter"}),o.jsx(Tp,{automationId:t,open:y,onOpenChange:k,onCustomSelect:()=>{N(!0),R(!1),T("")},onEventSelect:()=>{R(!0),N(!1)}})]}),e.triggers.length===0&&!w?o.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:["When should this automation run?"," ",o.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>k(!0),children:"Add a starter"})," ","to get going."]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(re=>o.jsx(Rp,{trigger:re,automationId:t,connectionName:re.connection_id?u.get(re.connection_id):void 0},re.id))}),w&&o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[o.jsx(Rs,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:j,onChange:re=>T(re.target.value),onBlur:async()=>{const re=j.trim();if(!(!re||!Is(re)))try{await h.mutateAsync({automation_id:t,type:"cron",cron_expression:re}),we("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),_e.success("Starter added"),N(!1),T("")}catch{_e.error("Failed to add starter")}},onKeyDown:async re=>{const ge=j.trim();re.key==="Enter"&&ge&&Is(ge)&&re.target.blur(),re.key==="Escape"&&(N(!1),T(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),j&&!Is(j)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),h.isPending&&o.jsx(Ie,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),o.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{N(!1),T("")},children:o.jsx(ls,{size:13})})]}),M&&o.jsx(A.Suspense,{fallback:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[o.jsx(Ie,{size:13,className:"animate-spin text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:o.jsx(Mp,{automationId:t,onDone:()=>R(!1)})})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Instructions"}),o.jsxs(se,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:!S,onClick:L,children:[o.jsx(Ca,{size:13}),"Improve"]})]}),o.jsx(Ul,{tiptapDoc:S,setTiptapDoc:pe,placeholder:"What should this automation do?",children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(Vl,{virtualMcpId:n||null,className:"max-h-[45vh]"}),o.jsxs("div",{className:"flex items-center justify-end gap-1.5 p-2.5",children:[o.jsx(xh,{model:G,isLoading:U,credentialId:z||null,onCredentialChange:re=>{O.setValue("credential_id",re??"",{shouldDirty:!0}),O.setValue("model_id","",{shouldDirty:!0})},onModelChange:re=>O.setValue("model_id",re.modelId,{shouldDirty:!0}),placeholder:"Model"}),o.jsxs(Ke,{children:[o.jsx(qe,{asChild:!0,children:o.jsxs(se,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:Be,disabled:!n,children:[o.jsx(tc,{size:16}),"Test"]})}),o.jsx(Ge,{children:"Test Automation"})]})]})]})})]})]})]})}function Lp(t){const e=q.c(6),{tabId:s,virtualMcpId:i}=t;let r;e[0]!==s?(r=ea(s),e[0]=s,e[1]=r):r=e[1];const n=r;if(!n)return null;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let l;return e[3]!==n.id||e[4]!==i?(l=o.jsx(at,{children:o.jsx(at.Content,{children:o.jsx(at.Body,{children:o.jsx(A.Suspense,{fallback:a,children:o.jsx(Op,{id:n.id,virtualMcpId:i})})})})}),e[3]=n.id,e[4]=i,e[5]=l):l=e[5],l}function Op(t){const e=q.c(9),{id:s,virtualMcpId:i}=t,r=At(),{data:n,isLoading:a}=Sh(s);let l;e[0]!==r?(l=()=>r({to:".",search:zp,replace:!0}),e[0]=r,e[1]=l):l=e[1];const h=l;if(a){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=u):u=e[2],u}if(!n){let u;return e[3]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=u):u=e[3],u}let c;return e[4]!==n||e[5]!==s||e[6]!==h||e[7]!==i?(c=o.jsx(Pp,{automationId:s,automation:n,virtualMcpId:i,onBack:h}),e[4]=n,e[5]=s,e[6]=h,e[7]=i,e[8]=c):c=e[8],c}function zp(t){return{...t,main:"automations"}}function $p(t){const e=q.c(20),{virtualMcpId:s}=t,i=At(),{data:r}=yh(s),n=r===void 0?[]:r,{create:a}=Vs(),[l,h]=A.useState(""),c=l.toLowerCase(),u=n.filter(T=>T.name.toLowerCase().includes(c));let d;e[0]!==i?(d=T=>i({to:".",search:M=>({...M,main:"automation:"+T}),replace:!0}),e[0]=i,e[1]=d):d=e[1];const m=d,_=async()=>{if(a.isPending)return;we("automation_new_clicked",{virtual_mcp_id:s,existing_count:n.length});const T=await a.mutateAsync(Ch(s));m(T.id)},f=at,p=at,g=at;let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(at.Title,{children:"Automations"}),e[2]=v):v=e[2];const b=n.length>0&&o.jsx(kh,{value:l,onChange:h,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(cs,{size:14}),e[3]=S):S=e[3];let x;e[4]!==a.isPending||e[5]!==_?(x=o.jsxs(se,{size:"sm",onClick:_,disabled:a.isPending,children:[S,"New automation"]}),e[4]=a.isPending,e[5]=_,e[6]=x):x=e[6];let y;e[7]!==b||e[8]!==x?(y=o.jsxs("div",{className:"flex flex-col gap-6",children:[v,o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[b,x]})]}),e[7]=b,e[8]=x,e[9]=y):y=e[9];const k=n.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ps,{image:o.jsx(Ls,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Create your first automation to run this agent on a schedule or in response to events.",actions:o.jsxs(se,{size:"sm",onClick:_,disabled:a.isPending,children:[o.jsx(cs,{size:14}),"New automation"]})})}):u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ps,{image:o.jsx(Ls,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${l}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:u.map(T=>o.jsx(wh,{automation:T,onClick:()=>m(T.id)},T.id))});let w;e[10]!==k||e[11]!==g.Body||e[12]!==y?(w=o.jsxs(g.Body,{children:[y,k]}),e[10]=k,e[11]=g.Body,e[12]=y,e[13]=w):w=e[13];let N;e[14]!==w||e[15]!==p.Content?(N=o.jsx(p.Content,{children:w}),e[14]=w,e[15]=p.Content,e[16]=N):N=e[16];let j;return e[17]!==f||e[18]!==N?(j=o.jsx(f,{children:N}),e[17]=f,e[18]=N,e[19]=j):j=e[19],j}function Fp(t){const e=q.c(3),{virtualMcpId:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx(A.Suspense,{fallback:i,children:o.jsx($p,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}const zo=A.lazy(()=>Ol(()=>import("./project-app-view-DzdWARcC.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55])).then(t=>({default:t.AppViewContent})));function Hp(t){const e=q.c(44),{taskId:s,virtualMcpId:i}=t;let r;e[0]!==s||e[1]!==i?(r={virtualMcpId:i,taskId:s},e[0]=s,e[1]=i,e[2]=r):r=e[2];const{activeTab:n,layoutTabs:a,expandedTools:l,automationTabParsed:h}=Da(r);if(ac(n)){let f;return e[3]!==i?(f=o.jsx(Hn,{virtualMcpId:i}),e[3]=i,e[4]=f):f=e[4],f}if(n==="git"){let f;return e[5]!==i?(f=o.jsx(Cu,{virtualMcpId:i}),e[5]=i,e[6]=f):f=e[6],f}if(n==="automations"){let f;return e[7]!==i?(f=o.jsx(Fp,{virtualMcpId:i}),e[7]=i,e[8]=f):f=e[8],f}if(n==="env"){let f;return e[9]!==i?(f=o.jsx(wp,{virtualMcpId:i}),e[9]=i,e[10]=f):f=e[10],f}if(n==="preview"){let f;return e[11]!==i?(f=o.jsx(of,{virtualMcpId:i}),e[11]=i,e[12]=f):f=e[12],f}if(h){let f;return e[13]!==n||e[14]!==i?(f=o.jsx(Lp,{tabId:n,virtualMcpId:i}),e[13]=n,e[14]=i,e[15]=f):f=e[15],f}let c;e[16]!==n?(c=lc(n),e[16]=n,e[17]=c):c=e[17];const u=c;if(u){let f;if(e[18]!==l||e[19]!==u.connectionId||e[20]!==u.toolName){let S;e[22]!==u.connectionId||e[23]!==u.toolName?(S=x=>x.appId===u.connectionId&&x.toolName===u.toolName,e[22]=u.connectionId,e[23]=u.toolName,e[24]=S):S=e[24],f=l.find(S),e[18]=l,e[19]=u.connectionId,e[20]=u.toolName,e[21]=f}else f=e[21];const p=f;let g;e[25]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[25]=g):g=e[25];const v=p?.args;let b;return e[26]!==n||e[27]!==u.connectionId||e[28]!==u.toolName||e[29]!==v?(b=o.jsx(A.Suspense,{fallback:g,children:o.jsx(zo,{connectionId:u.connectionId,toolName:u.toolName,args:v},n)}),e[26]=n,e[27]=u.connectionId,e[28]=u.toolName,e[29]=v,e[30]=b):b=e[30],b}let d;if(e[31]!==n||e[32]!==a){let f;e[34]!==n?(f=p=>p.id===n,e[34]=n,e[35]=f):f=e[35],d=a.find(f),e[31]=n,e[32]=a,e[33]=d}else d=e[33];const m=d;if(m){let f;e[36]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[36]=f):f=e[36];let p;return e[37]!==n||e[38]!==m.id||e[39]!==m.view.appId||e[40]!==m.view.args?(p=o.jsx(A.Suspense,{fallback:f,children:o.jsx(zo,{connectionId:m.view.appId,toolName:m.id,args:m.view.args},n)}),e[37]=n,e[38]=m.id,e[39]=m.view.appId,e[40]=m.view.args,e[41]=p):p=e[41],p}let _;return e[42]!==i?(_=o.jsx(Hn,{virtualMcpId:i}),e[42]=i,e[43]=_):_=e[43],_}function Wp(t){const e=q.c(7),{children:s,defaultSize:i}=t,[,r]=A.useTransition();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Xo.decoChatPanelWidth(),e[0]=n):n=e[0];const[a,l]=Yo(n,45),h=i>0&&i<100?a:i;let c;e[1]!==l?(c=m=>r(()=>{m>0&&m<100&&l(m)}),e[1]=l,e[2]=c):c=e[2];const u=c;let d;return e[3]!==s||e[4]!==h||e[5]!==u?(d=o.jsx(ha,{defaultSize:h,minSize:20,collapsible:!0,collapsedSize:0,className:"min-w-0 overflow-hidden bg-sidebar",onResize:u,order:1,children:s}),e[3]=s,e[4]=h,e[5]=u,e[6]=d):d=e[6],d}function Up(t){const e=q.c(30),{virtualMcpId:s,taskId:i,chatOpen:r,mainOpen:n,chatContent:a}=t;let l;e[0]!==r||e[1]!==n?(l=Dn(r,n),e[0]=r,e[1]=n,e[2]=l):l=e[2];const h=l;let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=Xo.decoChatPanelWidth(),e[3]=c):c=e[3];const[u]=Yo(c,45),d=A.useRef(null);let m,_;e[4]!==r||e[5]!==n||e[6]!==u?(m=()=>{const T=d.current;if(!T)return;const M=Dn(r,n),R=M.chat>0&&M.chat<100?u:M.chat,C=M.chat>0&&M.chat<100?100-u:M.main;T.setLayout([R,C])},_=[r,n,u],e[4]=r,e[5]=n,e[6]=u,e[7]=m,e[8]=_):(m=e[7],_=e[8]),A.useEffect(m,_);const f=`${s}-${i}`;let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p={overflow:"visible"},e[9]=p):p=e[9];let g;e[10]!==a?(g=a??o.jsx(Ea,{}),e[10]=a,e[11]=g):g=e[11];let v;e[12]!==g?(v=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:"h-full bg-background rounded-[0.75rem] overflow-hidden card-shadow",children:g})}),e[12]=g,e[13]=v):v=e[13];let b;e[14]!==h.chat||e[15]!==v?(b=o.jsx(Wp,{defaultSize:h.chat,children:v}),e[14]=h.chat,e[15]=v,e[16]=b):b=e[16];let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(qc,{className:"bg-sidebar"}),e[17]=S):S=e[17];const x=h.main;let y;e[18]===Symbol.for("react.memo_cache_sentinel")?(y={overflow:"visible"},e[18]=y):y=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=te("flex flex-col h-full min-h-0 bg-background overflow-hidden","card-shadow","transition-[border-radius] duration-200 ease-[var(--ease-out-quart)]","rounded-[0.75rem]"),e[19]=k):k=e[19];let w;e[20]!==i||e[21]!==s?(w=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:k,children:o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx(Hp,{taskId:i,virtualMcpId:s})})})}),e[20]=i,e[21]=s,e[22]=w):w=e[22];let N;e[23]!==h.main||e[24]!==w?(N=o.jsx(ha,{className:"min-w-0 flex flex-col",order:2,defaultSize:x,style:y,collapsible:!0,collapsedSize:0,minSize:20,children:w}),e[23]=h.main,e[24]=w,e[25]=N):N=e[25];let j;return e[26]!==N||e[27]!==f||e[28]!==b?(j=o.jsxs(Gc,{ref:d,direction:"horizontal",className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",style:p,children:[b,S,N]},f),e[26]=N,e[27]=f,e[28]=b,e[29]=j):j=e[29],j}const cr="flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",$o="bg-sidebar-accent text-sidebar-foreground",hr="text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";function Vp(t){const e=q.c(47),{chatOpen:s,toggleChat:i,onNewTask:r}=t,{tasksOpen:n,toggleTasks:a}=Rc(),l=!!r;let h;e[0]!==n||e[1]!==a?(h=()=>{we("agent_toolbar_toggled",{button:"tasks",next_state:n?"closed":"open"}),a()},e[0]=n,e[1]=a,e[2]=h):h=e[2];const c=n?$o:hr;let u;e[3]!==c?(u=te(cr,c),e[3]=c,e[4]=u):u=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(kc,{size:16}),e[5]=d):d=e[5];let m;e[6]!==h||e[7]!==u||e[8]!==n?(m=o.jsx(qe,{asChild:!0,children:o.jsx("button",{type:"button",onClick:h,"aria-pressed":n,className:u,children:d})}),e[6]=h,e[7]=u,e[8]=n,e[9]=m):m=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Ge,{side:"bottom",children:"Tasks"}),e[10]=_):_=e[10];let f;e[11]!==m?(f=o.jsxs(Ke,{delayDuration:300,children:[m,_]}),e[11]=m,e[12]=f):f=e[12];let p;e[13]!==s||e[14]!==i?(p=()=>{we("agent_toolbar_toggled",{button:"chat",next_state:s?"closed":"open"}),i()},e[13]=s,e[14]=i,e[15]=p):p=e[15];const g=s?$o:hr;let v;e[16]!==g?(v=te(cr,g),e[16]=g,e[17]=v):v=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Nc,{size:16}),e[18]=b):b=e[18];let S;e[19]!==s||e[20]!==v||e[21]!==p?(S=o.jsx(qe,{asChild:!0,children:o.jsx("button",{type:"button",onClick:p,"aria-pressed":s,className:v,children:b})}),e[19]=s,e[20]=v,e[21]=p,e[22]=S):S=e[22];let x;e[23]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Ge,{side:"bottom",children:"Chat"}),e[23]=x):x=e[23];let y;e[24]!==S?(y=o.jsxs(Ke,{delayDuration:300,children:[S,x]}),e[24]=S,e[25]=y):y=e[25];const k=l?"grid-cols-[1fr]":"grid-cols-[0fr]";let w;e[26]!==k?(w=te("grid transition-[grid-template-columns] duration-200 ease-[var(--ease-out-quart)]",k),e[26]=k,e[27]=w):w=e[27];const N=!l,j=l?0:-1,T=!l,M=l?"translate-x-0 opacity-100":"-translate-x-2 opacity-0";let R;e[28]!==M?(R=te(cr,hr,"transition-[transform,opacity] duration-200 ease-[var(--ease-out-quart)] will-change-transform",M),e[28]=M,e[29]=R):R=e[29];let C;e[30]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(ia,{size:16}),e[30]=C):C=e[30];let D;e[31]!==r||e[32]!==N||e[33]!==j||e[34]!==T||e[35]!==R?(D=o.jsx(qe,{asChild:!0,children:o.jsx("button",{type:"button",onClick:r,disabled:N,tabIndex:j,"aria-hidden":T,className:R,children:C})}),e[31]=r,e[32]=N,e[33]=j,e[34]=T,e[35]=R,e[36]=D):D=e[36];let E;e[37]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(Ge,{side:"bottom",children:"New task"}),e[37]=E):E=e[37];let I;e[38]!==D?(I=o.jsx("div",{className:"overflow-hidden",children:o.jsxs(Ke,{delayDuration:300,children:[D,E]})}),e[38]=D,e[39]=I):I=e[39];let L;e[40]!==w||e[41]!==I?(L=o.jsx("div",{className:w,children:I}),e[40]=w,e[41]=I,e[42]=L):L=e[42];let B;return e[43]!==y||e[44]!==L||e[45]!==f?(B=o.jsxs(o.Fragment,{children:[f,y,L]}),e[43]=y,e[44]=L,e[45]=f,e[46]=B):B=e[46],B}function Kp(t,e,s){if(t.length<=s)return{visible:t,overflow:[]};const i=t.slice(0,s),r=t.slice(s);if(e==null)return{visible:i,overflow:r};if(i.some(d=>d.id===e))return{visible:i,overflow:r};const a=r.findIndex(d=>d.id===e);if(a===-1)return{visible:i,overflow:r};const l=i[i.length-1],h=r[a],c=[...i.slice(0,-1),h],u=[l,...r.slice(0,a),...r.slice(a+1)];return{visible:c,overflow:u}}function qp(t){const e=q.c(13),{title:s,icon:i,active:r,onClick:n}=t,a=r?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";let l;e[0]!==a?(l=te("shrink-0 flex items-center gap-1.5 h-8 rounded-md px-2","[transition:background-color_180ms_ease,color_180ms_ease]",a),e[0]=a,e[1]=l):l=e[1];let h;e[2]!==i?(h=o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(Gp,{icon:i})}),e[2]=i,e[3]=h):h=e[3];let c;e[4]!==s?(c=o.jsx("span",{className:"whitespace-nowrap text-sm font-medium leading-none",children:s}),e[4]=s,e[5]=c):c=e[5];let u;return e[6]!==r||e[7]!==n||e[8]!==l||e[9]!==h||e[10]!==c||e[11]!==s?(u=o.jsxs("button",{type:"button",onClick:n,"aria-pressed":r,"aria-label":s,className:l,children:[h,c]}),e[6]=r,e[7]=n,e[8]=l,e[9]=h,e[10]=c,e[11]=s,e[12]=u):u=e[12],u}function Gp(t){const e=q.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:r}=s;let n;return e[0]!==r?(n=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=n):n=e[1],n}if(s.kind==="url"){let r;return e[2]!==s.src?(r=o.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=r):r=e[3],r}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(la,{className:"size-4"}),e[4]=i):i=e[4],i}function Yp(t){const e=q.c(13),{overflow:s,onSelect:i}=t,[r,n]=A.useState(!1);let a;e[0]!==i?(a=m=>{n(!1),i(m)},e[0]=i,e[1]=a):a=e[1];const l=a;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Hs,{asChild:!0,children:o.jsx("button",{type:"button",title:"More tabs","aria-label":"More tabs",className:"shrink-0 flex size-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:o.jsx(na,{className:"size-4"})})}),e[2]=h):h=e[2];let c;if(e[3]!==l||e[4]!==s){let m;e[6]!==l?(m=_=>o.jsx("li",{children:o.jsxs("button",{type:"button",onClick:()=>l(_.id),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md hover:bg-accent text-sm text-foreground",children:[o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(Xp,{icon:_.icon})}),o.jsx("span",{className:"truncate",children:_.title})]})},_.id),e[6]=l,e[7]=m):m=e[7],c=s.map(m),e[3]=l,e[4]=s,e[5]=c}else c=e[5];let u;e[8]!==c?(u=o.jsx(Ws,{align:"end",className:"w-56 p-1",children:o.jsx("ul",{className:"flex flex-col",children:c})}),e[8]=c,e[9]=u):u=e[9];let d;return e[10]!==r||e[11]!==u?(d=o.jsxs(Us,{open:r,onOpenChange:n,children:[h,u]}),e[10]=r,e[11]=u,e[12]=d):d=e[12],d}function Xp(t){const e=q.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:r}=s;let n;return e[0]!==r?(n=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=n):n=e[1],n}if(s.kind==="url"){let r;return e[2]!==s.src?(r=o.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=r):r=e[3],r}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(la,{className:"size-4"}),e[4]=i):i=e[4],i}const Jp=6;function Zp(t){const e=q.c(20),{virtualMcpId:s,taskId:i}=t,r=At();let n;e[0]!==i||e[1]!==s?(n={virtualMcpId:s,taskId:i},e[0]=i,e[1]=s,e[2]=n):n=e[2];const{tabs:a,activeTab:l,mainOpen:h,setActiveTab:c}=Da(n);let u,d,m,_;if(e[3]!==l||e[4]!==h||e[5]!==r||e[6]!==c||e[7]!==a||e[8]!==s){const g=cc({activeTab:l,mainOpen:h}),v=k=>k.id==="automations"?g:h&&k.id===l,S=a.find(k=>v(k))?.id??null,{visible:x,overflow:y}=Kp(a,S,Jp);d=y,u=k=>{const w=a.find(j=>j.id===k),N=S===k&&h;if(we("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:k,tab_kind:w?.kind??null,was_active:N}),k==="automations"){const j=hc({activeTab:l,mainOpen:h});r({to:".",search:T=>({...T,main:j}),replace:!0});return}c(k)},m="flex items-center min-w-0 ml-auto gap-0.5",_=x.map(k=>o.jsx(qp,{title:k.title,icon:k.icon,active:v(k),onClick:()=>u(k.id)},k.id)),e[3]=l,e[4]=h,e[5]=r,e[6]=c,e[7]=a,e[8]=s,e[9]=u,e[10]=d,e[11]=m,e[12]=_}else u=e[9],d=e[10],m=e[11],_=e[12];let f;e[13]!==u||e[14]!==d?(f=d.length>0&&o.jsx(Yp,{overflow:d,onSelect:u}),e[13]=u,e[14]=d,e[15]=f):f=e[15];let p;return e[16]!==m||e[17]!==_||e[18]!==f?(p=o.jsxs("div",{className:m,children:[_,f]}),e[16]=m,e[17]=_,e[18]=f,e[19]=p):p=e[19],p}function Qp(t){const e=q.c(12);let s,i,r,n;e[0]!==t?({className:s,orientation:r,decorative:n,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r,e[4]=n):(s=e[1],i=e[2],r=e[3],n=e[4]);const a=r===void 0?"horizontal":r,l=n===void 0?!0:n;let h;e[5]!==s?(h=te("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",s),e[5]=s,e[6]=h):h=e[6];let c;return e[7]!==l||e[8]!==a||e[9]!==i||e[10]!==h?(c=o.jsx(zl,{"data-slot":"separator-root",decorative:l,orientation:a,className:h,...i}),e[7]=l,e[8]=a,e[9]=i,e[10]=h,e[11]=c):c=e[11],c}function eg(t){const e=q.c(20),{prNumber:s,disabled:i,send:r}=t;let n;e[0]!==s||e[1]!==r?(n=()=>r(fu({prNumber:s})),e[0]=s,e[1]=r,e[2]=n):n=e[2];const a=n;let l;e[3]!==s||e[4]!==r?(l=()=>r(uu({prNumber:s})),e[3]=s,e[4]=r,e[5]=l):l=e[5];const h=l;let c;e[6]!==i||e[7]!==a?(c=o.jsx(se,{size:"sm",variant:"success",className:"rounded-r-none border-r border-success-foreground/20",disabled:i,onClick:a,children:"Publish"}),e[6]=i,e[7]=a,e[8]=c):c=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(_r,{className:"h-3.5 w-3.5"}),e[9]=u):u=e[9];let d;e[10]!==i?(d=o.jsx(os,{asChild:!0,children:o.jsx(se,{size:"sm",variant:"success",className:"rounded-l-none px-2",disabled:i,"aria-label":"More actions",children:u})}),e[10]=i,e[11]=d):d=e[11];let m;e[12]!==h?(m=o.jsx(as,{align:"end",children:o.jsx(St,{onClick:h,children:"Review"})}),e[12]=h,e[13]=m):m=e[13];let _;e[14]!==d||e[15]!==m?(_=o.jsxs(ns,{children:[d,m]}),e[14]=d,e[15]=m,e[16]=_):_=e[16];let f;return e[17]!==c||e[18]!==_?(f=o.jsxs("div",{className:"inline-flex items-stretch rounded-md",children:[c,_]}),e[17]=c,e[18]=_,e[19]=f):f=e[19],f}const tg=new Set(["failure","timed_out","cancelled","action_required"]);function sg(t){return t.status==="completed"&&tg.has(t.conclusion)}function ig(t){return t.status==="queued"||t.status==="in_progress"}function rg(t){const{branchStatus:e,pr:s,checks:i,reviews:r,loading:n}=t;if(!e||n)return{label:"Loading…",disabled:!0,loading:!0,variant:"outline",tooltip:"Loading branch and pull request status"};if(e.workingTreeDirty||e.unpushed>0)return{label:"Save changes",action:"commit-and-push",variant:"default",tooltip:"Commit and push local changes"};if(s?.merged)return!!e.headSha&&!!s.headSha&&e.headSha!==s.headSha?{label:"Continue",action:"create-pr",variant:"special",tooltip:"Open a new PR with the latest commits"}:{label:"Published",disabled:!0,variant:"outline",tooltip:`PR #${s.number} merged into ${s.base}`};if(e.aheadOfBase>0){if(s&&s.state==="closed"&&!s.merged)return{label:"Reopen",action:"reopen",variant:"default",tooltip:`Reopen PR #${s.number}`};if(!s)return{label:"Submit for review",action:"create-pr",variant:"default",tooltip:`Open a PR for ${e.branch} → ${e.base}`};if((r?.mergeableState??"unknown")==="dirty")return{label:`Sync with ${s.base}`,action:"rebase",variant:"default",tooltip:`Resolve conflicts with ${s.base} before merging`};const h=i.filter(sg).map(d=>d.name);if(h.length>0)return{label:"Fix tests",action:"fix-checks",variant:"default",tooltip:`Failing: ${h.join(", ")}`,meta:{failingChecks:h}};const c=i.filter(ig);if(c.length>0)return{label:"Running tests…",disabled:!0,loading:!0,variant:"outline",tooltip:`Waiting on ${c.length} check${c.length===1?"":"s"} to finish`};if(r?.draft)return{label:"Mark ready",action:"mark-ready",variant:"default",tooltip:"Mark draft PR ready for review"};const u=r?.unresolvedConversations??0;return u>0?{label:"Address feedback",action:"resolve-comments",variant:"default",tooltip:`${u} unresolved conversation${u===1?"":"s"}`}:r?.missingRequiredApprovals?{label:"Awaiting review",disabled:!0,variant:"outline",tooltip:"Waiting for required approvals"}:{label:"Publish",action:"merge-split",variant:"success",tooltip:`Squash-merge PR #${s.number} into ${s.base}`}}return{label:"Up to date",disabled:!0,variant:"outline",tooltip:`Branch is in sync with ${e.base}`}}function ng(){return Kt().branchStatus}const og=6e4,ag=3e4;function lg(t){const e=q.c(12);let s;e[0]!==t.connectionId||e[1]!==t.orgId||e[2]!==t.orgSlug?(s={connectionId:t.connectionId,orgId:t.orgId,orgSlug:t.orgSlug},e[0]=t.connectionId,e[1]=t.orgId,e[2]=t.orgSlug,e[3]=s):s=e[3];const i=He(s),r=t.prNumber??0;let n;e[4]!==t.owner||e[5]!==t.repo||e[6]!==r?(n={method:"get",owner:t.owner,repo:t.repo,pullNumber:r},e[4]=t.owner,e[5]=t.repo,e[6]=r,e[7]=n):n=e[7];const a=!!t.prNumber;let l;return e[8]!==i||e[9]!==n||e[10]!==a?(l={client:i,toolName:"pull_request_read",toolArguments:n,enabled:a,refetchInterval:og,refetchIntervalInBackground:!1,staleTime:ag,select:cg},e[8]=i,e[9]=n,e[10]=a,e[11]=l):l=e[11],us(l)}function cg(t){const e=Ks(t);if(!e)return null;const s=e.mergeable_state??"unknown",i=!!(e.draft??!1),r=Number(e.review_comments??0),n=s==="blocked"&&r>0?r:0;return{draft:i,mergeableState:s,unresolvedConversations:n,missingRequiredApprovals:s==="blocked"&&n===0}}function hg(t){const e=q.c(42),{virtualMcpId:s}=t,{org:i}=xe(),r=yt(s),{currentBranch:n}=lt(),a=Ni(),l=r?.metadata?.githubRepo??null,h=ng(),c=l?.connectionId??"",u=l?.owner??"",d=l?.name??"",m=n??null;let _;e[0]!==i.id||e[1]!==i.slug||e[2]!==c||e[3]!==u||e[4]!==d||e[5]!==m?(_={orgId:i.id,orgSlug:i.slug,connectionId:c,owner:u,repo:d,branch:m},e[0]=i.id,e[1]=i.slug,e[2]=c,e[3]=u,e[4]=d,e[5]=m,e[6]=_):_=e[6];const f=Ia(_),p=f.data??null,g=l?.connectionId??"",v=l?.owner??"",b=l?.name??"",S=p&&p.state==="open"?p.number:null;let x;e[7]!==i.id||e[8]!==i.slug||e[9]!==g||e[10]!==v||e[11]!==b||e[12]!==S?(x={orgId:i.id,orgSlug:i.slug,connectionId:g,owner:v,repo:b,prNumber:S},e[7]=i.id,e[8]=i.slug,e[9]=g,e[10]=v,e[11]=b,e[12]=S,e[13]=x):x=e[13];const y=Ba(x),k=l?.connectionId??"",w=l?.owner??"",N=l?.name??"",j=p&&p.state==="open"?p.number:null;let T;e[14]!==i.id||e[15]!==i.slug||e[16]!==k||e[17]!==w||e[18]!==N||e[19]!==j?(T={orgId:i.id,orgSlug:i.slug,connectionId:k,owner:w,repo:N,prNumber:j},e[14]=i.id,e[15]=i.slug,e[16]=k,e[17]=w,e[18]=N,e[19]=j,e[20]=T):T=e[20];const M=lg(T);if(!l?.connectionId||!n)return null;let R;e[21]!==h||e[22]!==y.data||e[23]!==p||e[24]!==f.isPending||e[25]!==M.data?(R=rg({branchStatus:h,pr:p,checks:y.data??[],reviews:M.data??null,loading:f.isPending}),e[21]=h,e[22]=y.data,e[23]=p,e[24]=f.isPending,e[25]=M.data,e[26]=R):R=e[26];const C=R;let D;e[27]!==a?(D=z=>a.sendMessage({parts:[{type:"text",text:z}]}),e[27]=a,e[28]=D):D=e[28];const E=D,I=a.isStreaming;let L;e[29]!==n||e[30]!==C||e[31]!==I||e[32]!==p||e[33]!==E?(L=z=>{if(!I)switch(z){case"commit-and-push":{E(ru({branch:n}));return}case"create-pr":{E(nu({branch:n}));return}case"reopen":{p&&E(ou({prNumber:p.number}));return}case"rebase":{E(au({branch:n}));return}case"fix-checks":{p&&E(cu({prNumber:p.number,failingChecks:C.meta?.failingChecks??[]}));return}case"mark-ready":{p&&E(hu({prNumber:p.number}));return}case"resolve-comments":{p&&E(du({prNumber:p.number}));return}case"merge-split":return}},e[29]=n,e[30]=C,e[31]=I,e[32]=p,e[33]=E,e[34]=L):L=e[34];const B=L;let P;e[35]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(Qp,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-5"}),e[35]=P):P=e[35];const O=p?.number;let F;return e[36]!==C||e[37]!==I||e[38]!==B||e[39]!==E||e[40]!==O?(F=o.jsxs(o.Fragment,{children:[P,o.jsx(dg,{button:C,isStreaming:I,onActivate:B,prNumber:O,send:E})]}),e[36]=C,e[37]=I,e[38]=B,e[39]=E,e[40]=O,e[41]=F):F=e[41],F}function dg(t){const e=q.c(21),{button:s,isStreaming:i}=t,r=!!s.disabled||i,n=i?"Chat is running":s.tooltip??null;if(s.action==="merge-split"&&t.prNumber!=null){let u;e[0]!==r||e[1]!==t.prNumber||e[2]!==t.send?(u=o.jsx(eg,{prNumber:t.prNumber,disabled:r,send:t.send}),e[0]=r,e[1]=t.prNumber,e[2]=t.send,e[3]=u):u=e[3];let d;return e[4]!==u||e[5]!==n?(d=o.jsx(Fo,{label:n,children:u}),e[4]=u,e[5]=n,e[6]=d):d=e[6],d}let a;e[7]!==s.action||e[8]!==t?(a=()=>t.onActivate(s.action),e[7]=s.action,e[8]=t,e[9]=a):a=e[9];let l;e[10]!==s.loading?(l=s.loading?o.jsx(fh,{size:"xs",variant:"default"}):null,e[10]=s.loading,e[11]=l):l=e[11];let h;e[12]!==s.label||e[13]!==s.variant||e[14]!==r||e[15]!==a||e[16]!==l?(h=o.jsxs(se,{size:"sm",variant:s.variant,disabled:r,onClick:a,children:[l,s.label]}),e[12]=s.label,e[13]=s.variant,e[14]=r,e[15]=a,e[16]=l,e[17]=h):h=e[17];let c;return e[18]!==h||e[19]!==n?(c=o.jsx(Fo,{label:n,children:h}),e[18]=h,e[19]=n,e[20]=c):c=e[20],c}function Fo(t){const e=q.c(9),{label:s,children:i}=t;if(!s){let l;return e[0]!==i?(l=o.jsx(o.Fragment,{children:i}),e[0]=i,e[1]=l):l=e[1],l}let r;e[2]!==i?(r=o.jsx(qe,{asChild:!0,children:o.jsx("span",{children:i})}),e[2]=i,e[3]=r):r=e[3];let n;e[4]!==s?(n=o.jsx(Ge,{children:s}),e[4]=s,e[5]=n):n=e[5];let a;return e[6]!==r||e[7]!==n?(a=o.jsx(Fc,{children:o.jsxs(Ke,{children:[r,n]})}),e[6]=r,e[7]=n,e[8]=a):a=e[8],a}function ug(t){const e=q.c(2),{virtualMcp:s}=t;if(!!!(s.metadata?.githubRepo??null)?.connectionId)return null;let n;return e[0]!==s.id?(n=o.jsx(ur.Right,{children:o.jsx(hg,{virtualMcpId:s.id})}),e[0]=s.id,e[1]=n):n=e[1],n}const Zt=A.createContext(null);function bn(){return A.use(Zt)}function Ho(t){const e=q.c(7),{children:s}=t,{taskId:i}=lt();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Something went wrong loading the chat. Try refreshing."}),e[0]=r):r=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Ee.Skeleton,{}),e[1]=n):n=e[1];let a;e[2]!==s?(a=s??o.jsx(Ea,{}),e[2]=s,e[3]=a):a=e[3];let l;return e[4]!==a||e[5]!==i?(l=o.jsx(es,{fallback:r,children:o.jsx(A.Suspense,{fallback:n,children:o.jsx(Ee.ActiveTaskProvider,{taskId:i,children:a})})}),e[4]=a,e[5]=i,e[6]=l):l=e[6],l}function Wo(t){const e=q.c(3),{onNewTaskRef:s,createNewTask:i}=t;let r;return e[0]!==i||e[1]!==s?(r=()=>(s.current=i,()=>{s.current=null}),e[0]=i,e[1]=s,e[2]=r):r=e[2],A.useLayoutEffect(r),null}function fg(t){const e=q.c(3),{onOpenSidebar:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Xl,{size:20}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx("div",{className:"shrink-0 flex items-center justify-between px-3 h-12 bg-background border-b border-border",children:o.jsx("button",{type:"button",onClick:s,className:"flex size-8 items-center justify-center rounded-md text-foreground/60 hover:bg-accent hover:text-foreground transition-colors","aria-label":"Open menu",children:i})}),e[1]=s,e[2]=r):r=e[2],r}function Uo(t){const e=q.c(16),{virtualMcpId:s,hasActiveGithubRepo:i,vmMap:r,children:n}=t,{org:a}=xe(),{currentBranch:l}=lt(),{data:h}=Ci.useSession(),c=h?.user?.id;let u;e[0]!==a.id||e[1]!==a.slug?(u={connectionId:Bt,orgId:a.id,orgSlug:a.slug},e[0]=a.id,e[1]=a.slug,e[2]=u):u=e[2];const d=He(u),{mutate:m}=an(d);let _;e[3]===Symbol.for("react.memo_cache_sentinel")?(_=new Set,e[3]=_):_=e[3];const f=A.useRef(_);let p,g;e[4]!==l||e[5]!==i||e[6]!==m||e[7]!==c||e[8]!==s||e[9]!==r?(p=()=>{if(i&&c&&l){if(r?.[c]?.[l]){f.current.add(l);return}f.current.has(l)||(f.current.add(l),m({virtualMcpId:s,branch:l},{onError:mg}))}},g=[i,c,l,r,s,m],e[4]=l,e[5]=i,e[6]=m,e[7]=c,e[8]=s,e[9]=r,e[10]=p,e[11]=g):(p=e[10],g=e[11]),A.useEffect(p,g);const v=l??null;let b;return e[12]!==n||e[13]!==v||e[14]!==s?(b=o.jsx(zu,{virtualMcpId:s,branch:v,children:n}),e[12]=n,e[13]=v,e[14]=s,e[15]=b):b=e[15],b}function mg(t){console.error("[auto-start-vm] failed:",t)}function _g(){const t=q.c(96),e=ca(),s=At(),{org:i}=xe(),r=Dc()?.tasksOpen??!1;Hc(i.slug);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const a=$l(n),l=a.org??"";let h;t[1]===Symbol.for("react.memo_cache_sentinel")?(h={strict:!1},t[1]=h):h=t[1];const c=Qr(h);let u;t[2]!==i.id||t[3]!==c.virtualmcpid?(u=c.virtualmcpid??Jo(i.id).id,t[2]=i.id,t[3]=c.virtualmcpid,t[4]=u):u=t[4];const d=u,m=Eh(a.taskId??"",d),_=yt(d),f=_?.metadata?.ui?.layout??null;let p;t[5]!==f?(p=f?{defaultMainView:f.defaultMainView??null,chatDefaultOpen:f.chatDefaultOpen??null}:null,t[5]=f,t[6]=p):p=t[6];const g=p;let v;t[7]!==_?(v=_&&Ut(_),t[7]=_,t[8]=v):v=t[8];const b=!!v;let S;t[9]!==l||t[10]!==d?(S={virtualMcpId:d,orgSlug:l,isAgentRoute:!0},t[9]=l,t[10]=d,t[11]=S):S=t[11];const x=Mc(g,S),{setOpenMobile:y,openMobile:k}=Lc(),w=y,N=A.useRef(null);let j,T;t[12]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{const U=G=>{Bc(G)&&G.shiftKey&&G.code==="KeyS"&&!G.repeat&&(G.preventDefault(),N.current?.())};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},T=[],t[12]=j,t[13]=T):(j=t[12],T=t[13]),A.useEffect(j,T);const M=d;let R;t[14]!==_||t[15]!==d?(R={virtualMcpId:d,entity:_},t[14]=_,t[15]=d,t[16]=R):R=t[16];const C=R;if(m.status==="creating"||m.status==="loading"){let U;t[17]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[o.jsx(Ie,{className:"size-4 animate-spin mr-2"}),"Creating task…"]})}),t[17]=U):U=t[17];let G;return t[18]!==C?(G=o.jsx(Zt,{value:C,children:U}),t[18]=C,t[19]=G):G=t[19],G}if(m.status==="error"){let U;t[20]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx("div",{className:"font-medium",children:"Task unavailable"}),t[20]=U):U=t[20];let G;t[21]!==m.error.message?(G=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{className:"flex flex-col h-full items-center justify-center gap-2 bg-background card-shadow rounded-[0.75rem] p-8 text-sm",children:[U,o.jsx("div",{className:"text-muted-foreground",children:m.error.message})]})}),t[21]=m.error.message,t[22]=G):G=t[22];let $;return t[23]!==C||t[24]!==G?($=o.jsx(Zt,{value:C,children:G}),t[23]=C,t[24]=G,t[25]=$):$=t[25],$}if(!_){let U;t[26]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx(Bs,{size:48,className:"text-muted-foreground"}),t[26]=U):U=t[26];const G=`The agent "${d}" does not exist in this organization.`;let $;t[27]!==s||t[28]!==l?($=o.jsx(se,{variant:"outline",onClick:()=>s({to:"/$org",params:{org:l}}),children:"Go to organization home"}),t[27]=s,t[28]=l,t[29]=$):$=t[29];let J;t[30]!==G||t[31]!==$?(J=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:o.jsx(Ps,{image:U,title:"Agent not found",description:G,actions:$})})}),t[30]=G,t[31]=$,t[32]=J):J=t[32];let K;return t[33]!==C||t[34]!==J?(K=o.jsx(Zt,{value:C,children:J}),t[33]=C,t[34]=J,t[35]=K):K=t[35],K}if(e){let U;t[36]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx(Oc,{className:"sr-only",children:"Navigation"}),t[36]=U):U=t[36];let G;t[37]!==w?(G=o.jsx("div",{className:"w-14 shrink-0 bg-sidebar flex flex-col items-center border-r border-border overflow-y-auto group/sidebar","data-state":"collapsed",children:o.jsx(Ic,{onClose:()=>w(!1)})}),t[37]=w,t[38]=G):G=t[38];let $;t[39]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:o.jsx(Ac,{})}),t[39]=$):$=t[39];let J;t[40]!==G?(J=o.jsxs(zc,{side:"left",hideCloseButton:!0,className:"w-[calc(100vw-3rem)] sm:max-w-md! p-0",children:[U,o.jsxs("div",{className:"flex h-full",children:[G,$]})]}),t[40]=G,t[41]=J):J=t[41];let K;t[42]!==k||t[43]!==w||t[44]!==J?(K=o.jsx($c,{open:k,onOpenChange:w,children:J}),t[42]=k,t[43]=w,t[44]=J,t[45]=K):K=t[45];const ee=K,oe=_?.metadata?.vmMap;let ie;t[46]!==x.createNewTask?(ie=o.jsx(Wo,{onNewTaskRef:N,createNewTask:x.createNewTask}),t[46]=x.createNewTask,t[47]=ie):ie=t[47];let Z;t[48]!==w?(Z=o.jsx(fg,{onOpenSidebar:()=>w(!0)}),t[48]=w,t[49]=Z):Z=t[49];let ue;t[50]===Symbol.for("react.memo_cache_sentinel")?(ue=o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx(Ho,{})}),t[50]=ue):ue=t[50];let de;t[51]!==b||t[52]!==ee||t[53]!==oe||t[54]!==ie||t[55]!==Z||t[56]!==d?(de=o.jsxs(Uo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:oe,children:[ie,Z,ue,ee]}),t[51]=b,t[52]=ee,t[53]=oe,t[54]=ie,t[55]=Z,t[56]=d,t[57]=de):de=t[57];let he;t[58]!==M||t[59]!==de?(he=o.jsx("div",{className:"flex flex-col flex-1 bg-background min-h-0",children:o.jsx(Ee.Provider,{virtualMcpId:M,children:de},M)}),t[58]=M,t[59]=de,t[60]=he):he=t[60];let pe;return t[61]!==C||t[62]!==he?(pe=o.jsx(Zt,{value:C,children:he}),t[61]=C,t[62]=he,t[63]=pe):pe=t[63],pe}const D=r?void 0:x.createNewTask;let E;t[64]!==x.chatOpen||t[65]!==x.toggleChat||t[66]!==D?(E=o.jsx(ur.Toggles,{children:o.jsx(Vp,{chatOpen:x.chatOpen,toggleChat:x.toggleChat,onNewTask:D})}),t[64]=x.chatOpen,t[65]=x.toggleChat,t[66]=D,t[67]=E):E=t[67];let I;t[68]!==x.taskId||t[69]!==d?(I=o.jsx(ur.Tabs,{children:o.jsx(Zp,{virtualMcpId:d,taskId:x.taskId})}),t[68]=x.taskId,t[69]=d,t[70]=I):I=t[70];const L=_?.metadata?.vmMap;let B;t[71]!==_?(B=o.jsx(ug,{virtualMcp:_}),t[71]=_,t[72]=B):B=t[72];let P;t[73]!==x.createNewTask?(P=o.jsx(Wo,{onNewTaskRef:N,createNewTask:x.createNewTask}),t[73]=x.createNewTask,t[74]=P):P=t[74];let O;t[75]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx(Ho,{}),t[75]=O):O=t[75];let F;t[76]!==x.chatOpen||t[77]!==x.mainOpen||t[78]!==x.taskId||t[79]!==d?(F=o.jsx(Up,{virtualMcpId:d,taskId:x.taskId,chatOpen:x.chatOpen,mainOpen:x.mainOpen,chatContent:O}),t[76]=x.chatOpen,t[77]=x.mainOpen,t[78]=x.taskId,t[79]=d,t[80]=F):F=t[80];let z;t[81]!==b||t[82]!==L||t[83]!==B||t[84]!==P||t[85]!==F||t[86]!==d?(z=o.jsxs(Uo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:L,children:[B,P,F]}),t[81]=b,t[82]=L,t[83]=B,t[84]=P,t[85]=F,t[86]=d,t[87]=z):z=t[87];let V;t[88]!==M||t[89]!==I||t[90]!==z?(V=o.jsxs(Ee.Provider,{virtualMcpId:M,children:[I,z]},M),t[88]=M,t[89]=I,t[90]=z,t[91]=V):V=t[91];let W;return t[92]!==C||t[93]!==E||t[94]!==V?(W=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:o.jsxs(Zt,{value:C,children:[E,V]})}),t[92]=C,t[93]=E,t[94]=V,t[95]=W):W=t[95],W}function S1(){const t=q.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(A.Suspense,{fallback:o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),children:o.jsx(_g,{})}),t[0]=e):e=t[0],e}export{S1 as default,bn as useInsetContext};
|