decocms 2.311.9 → 2.311.10
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-DenZ2tH1.js → AlertCircle-CBFejk6X.js} +1 -1
- package/dist/client/assets/{Archive-CUyKZVLi.js → Archive-iAwIFcLN.js} +1 -1
- package/dist/client/assets/{ArrowNarrowLeft-CdHYti4b.js → ArrowNarrowLeft-C0NWe8i5.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-DQA2yLzS.js → ArrowUpRight-wDGVfxe4.js} +1 -1
- package/dist/client/assets/{Check-B1QjP0lW.js → Check-BzVO1AiZ.js} +1 -1
- package/dist/client/assets/{CheckCircle-uoVBaQQY.js → CheckCircle-B7pbvHXn.js} +1 -1
- package/dist/client/assets/{ChevronDown-CW5suF8w.js → ChevronDown-Deq9bkeU.js} +1 -1
- package/dist/client/assets/{ChevronRight-C75N1vRO.js → ChevronRight-De9CjTSZ.js} +1 -1
- package/dist/client/assets/{ChevronUp-D9vKVRMW.js → ChevronUp-B22gTkPS.js} +1 -1
- package/dist/client/assets/{Container-e4KoMY54.js → Container-10kbY0mV.js} +1 -1
- package/dist/client/assets/{DotsVertical-Bl74LMdL.js → DotsVertical-B0gKWs5D.js} +1 -1
- package/dist/client/assets/{LinkExternal01-JpLMSezj.js → LinkExternal01-DkQ5Dk0s.js} +1 -1
- package/dist/client/assets/{Lock01-ChyzS6Qk.js → Lock01-CHNFEFTO.js} +1 -1
- package/dist/client/assets/{Palette-DxkFGkUo.js → Palette-B7UA48pi.js} +1 -1
- package/dist/client/assets/{Play-DNddfPVv.js → Play-BunaO9my.js} +1 -1
- package/dist/client/assets/{Plus-BdkW25go.js → Plus-DlXyaJQM.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-Bv9_h0OY.js → RefreshCcw01-BsycvfGb.js} +1 -1
- package/dist/client/assets/{SearchMd-DENJ3C2Y.js → SearchMd-15kzRVQe.js} +1 -1
- package/dist/client/assets/{Settings02-B4xVAQg7.js → Settings02-DVi1PM0X.js} +1 -1
- package/dist/client/assets/{Shield01-CISf8vls.js → Shield01-B70wMBqd.js} +1 -1
- package/dist/client/assets/{Star01-B90yQrQf.js → Star01-CJoi6RDa.js} +1 -1
- package/dist/client/assets/{Sun-jOb3MXPJ.js → Sun-CGoBYMaF.js} +1 -1
- package/dist/client/assets/{Tool01-CBOCDbIq.js → Tool01-D48iIlf1.js} +1 -1
- package/dist/client/assets/{Trash01-CqvPY4I1.js → Trash01-r5gnirq_.js} +1 -1
- package/dist/client/assets/{User01-DcOBCx9n.js → User01-DJ7t0J9b.js} +1 -1
- package/dist/client/assets/{Users03-l6fjto8R.js → Users03-DYLtKI27.js} +1 -1
- package/dist/client/assets/{X-CuBCe85s.js → X-BkKDRlJI.js} +1 -1
- package/dist/client/assets/{XCircle-CwRlSPkG.js → XCircle-sedM5Yzu.js} +1 -1
- package/dist/client/assets/{XClose-BYpD-FW2.js → XClose-Bx_xQQD_.js} +1 -1
- package/dist/client/assets/{Zap-BBT7v7w5.js → Zap-Cf_cpNNU.js} +1 -1
- package/dist/client/assets/{ZapSquare-q2bTQS4w.js → ZapSquare-DlRSLgAv.js} +1 -1
- package/dist/client/assets/{accordion-ChtmP3A-.js → accordion-DT47aOa3.js} +1 -1
- package/dist/client/assets/{agent-icon-aCG4rJO5.js → agent-icon-DUbGEO2S.js} +1 -1
- package/dist/client/assets/{agents-list-z6-U6t17.js → agents-list-rwKMRHld.js} +1 -1
- package/dist/client/assets/ai-providers-CRf0IUiu.js +1 -0
- package/dist/client/assets/{alert-dialog-DbOFkimV.js → alert-dialog-2Jj762BJ.js} +1 -1
- package/dist/client/assets/{auth-catchall-gGMZKA1c.js → auth-catchall-DTur9gCU.js} +1 -1
- package/dist/client/assets/{automation-list-row-CW7pxb1d.js → automation-list-row-Cuemsvmv.js} +1 -1
- package/dist/client/assets/{automations-BGGEy84S.js → automations-DN3LYNZV.js} +1 -1
- package/dist/client/assets/{avatar-aIgMbJGD.js → avatar-BoueLWcb.js} +1 -1
- package/dist/client/assets/{badge-DVYtPj3Q.js → badge-kdIe7Szq.js} +1 -1
- package/dist/client/assets/{brand-context-CWGrLOUV.js → brand-context-C39FhTOD.js} +1 -1
- package/dist/client/assets/{card-DF88hzU1.js → card-1EoqQ-Q7.js} +1 -1
- package/dist/client/assets/{chat-context-C_Gvp66M.js → chat-context-CqLR71Tu.js} +1 -1
- package/dist/client/assets/{checkbox-KaNd7DxH.js → checkbox-CL4jg0mR.js} +1 -1
- package/dist/client/assets/{collection-detail-CsOa-wP4.js → collection-detail-Be93090Z.js} +1 -1
- package/dist/client/assets/{collection-display-button-DX3qc6dM.js → collection-display-button-BWk8xHdj.js} +1 -1
- package/dist/client/assets/{collection-search-CW10ePNY.js → collection-search-B-8Jnp5p.js} +1 -1
- package/dist/client/assets/{collection-search-B_uLWogM.js → collection-search-BOMyE6Ld.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-jrC7a888.js → collection-table-wrapper-Cb-FxojL.js} +1 -1
- package/dist/client/assets/{collection-tabs-B4ahuefD.js → collection-tabs-Li95C-8Z.js} +1 -1
- package/dist/client/assets/{collections-BGO4ETj2.js → collections-BpcdhWS9.js} +1 -1
- package/dist/client/assets/{command-CI9ISywp.js → command-D-VqtTkt.js} +1 -1
- package/dist/client/assets/{connection-card-Bpyvc28P.js → connection-card-D4MG7ceA.js} +1 -1
- package/dist/client/assets/{connection-detail-CZhT71J5.js → connection-detail-C9HOgjUN.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-BfvL5eFo.js → connection-form-helpers-C96WddUN.js} +1 -1
- package/dist/client/assets/{connections-BAYG38Zt.js → connections-Dudt-pG4.js} +1 -1
- package/dist/client/assets/{constants-D5Po9Lb5.js → constants--Z68frQS.js} +1 -1
- package/dist/client/assets/{constants-P7U02cV2.js → constants-BY3slQ5k.js} +1 -1
- package/dist/client/assets/{dialog-59APH-gQ.js → dialog-2qod6XLb.js} +1 -1
- package/dist/client/assets/{domain-settings-BGvTcpHg.js → domain-settings-BXrvw6Lv.js} +1 -1
- package/dist/client/assets/{drawer-IJtapzyu.js → drawer-DSH3rjuX.js} +1 -1
- package/dist/client/assets/{dropdown-menu-B2SzMipC.js → dropdown-menu-CYyf-ZrC.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-Drvp3rfz.js → dynamic-plugin-layout-RlhEpflE.js} +1 -1
- package/dist/client/assets/{empty-state-DkaEz1nV.js → empty-state-BdiBdNme.js} +1 -1
- package/dist/client/assets/{empty-state-i6xsv-YS.js → empty-state-DebOy9XU.js} +1 -1
- package/dist/client/assets/{extract-connection-data-B7tG5T45.js → extract-connection-data-BTMDGqDD.js} +1 -1
- package/dist/client/assets/{features-amfQ2FpE.js → features-Cxt-JPsD.js} +1 -1
- package/dist/client/assets/{form-DZNe3M-o.js → form-BxsxXSuZ.js} +1 -1
- package/dist/client/assets/{general-uTGUk0Bo.js → general-u1Y39J62.js} +1 -1
- package/dist/client/assets/{index-B_OOgiEa.js → index-0enbmaSe.js} +2 -2
- package/dist/client/assets/{index-CemFt8yz.js → index-BNtQbO2i.js} +1 -1
- package/dist/client/assets/{index-B2WBo1WB.js → index-BVirFM6V.js} +1 -1
- package/dist/client/assets/{index-B9Elrkih.js → index-Bna4Mzv7.js} +1 -1
- package/dist/client/assets/{index-BT3jRQuX.js → index-CJ3mMCam.js} +1 -1
- package/dist/client/assets/{index-_Kba4LMo.js → index-CbJD4O9M.js} +3 -3
- package/dist/client/assets/{index-BlLtpzeQ.js → index-Co04TeZ5.js} +1 -1
- package/dist/client/assets/{index-PTvg3Wun.js → index-CucV4lBd.js} +1 -1
- package/dist/client/assets/{index-9smU3vak.js → index-D1Os768e.js} +1 -1
- package/dist/client/assets/{index-0FuZBqpL.js → index-D9p0G3vk.js} +1 -1
- package/dist/client/assets/{index-CfMT-svD.js → index-DKffdYnU.js} +1 -1
- package/dist/client/assets/{index-CsMR0Ypg.js → index-Dk7VTW9z.js} +1 -1
- package/dist/client/assets/index-DmW2ChV3.js +1 -0
- package/dist/client/assets/{index-s4QTWOmY.js → index-DyLEkJ9h.js} +1 -1
- package/dist/client/assets/{index-DHTAzDdj.js → index-fQuO2Dc3.js} +1 -1
- package/dist/client/assets/{index-Cs0mksI2.js → index-sxBFqhbB.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-Djo7_6Dx.js → infiniteQueryObserver-sxIykUWp.js} +1 -1
- package/dist/client/assets/{input-BQQp-6KZ.js → input-CZy7VBF-.js} +1 -1
- package/dist/client/assets/{integration-icon-Box-itol.js → integration-icon-Cgu3nEbl.js} +1 -1
- package/dist/client/assets/{label-DC5mP9Z5.js → label-BhPoqbH1.js} +1 -1
- package/dist/client/assets/{layout-DtZHLBeB.js → layout-jAXEQlv4.js} +1 -1
- package/dist/client/assets/{lean-canvas-recruit-modal-Drc7dSHp.js → lean-canvas-recruit-modal-Mo-uvZiE.js} +1 -1
- package/dist/client/assets/{login-pkkTGCaQ.js → login-BgB-8JX_.js} +1 -1
- package/dist/client/assets/{members-CCFl4lVb.js → members-D5i4jyvH.js} +1 -1
- package/dist/client/assets/{monaco-editor-Bx4gABcs.js → monaco-editor-D-E1NsT_.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-Bzr2EdBL.js → monitoring-stats-row-CaU12GnW.js} +1 -1
- package/dist/client/assets/{oauth-callback-D2WYRLXX.js → oauth-callback-BrTY445n.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-DiQQcEIA.js → oauth-callback-ai-provider-BA8nRDph.js} +1 -1
- package/dist/client/assets/{onboarding-C-xes3uo.js → onboarding-CAft2_BY.js} +1 -1
- package/dist/client/assets/{org-layout-d5JWtma9.js → org-layout-C0XY3j3w.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-_jGAIDyT.js → org-plugin-layout-CiPGTy9y.js} +1 -1
- package/dist/client/assets/{pair-C1uVZAxc.js → pair-DyP8v5ZE.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-By7qsYCS.js → plugin-empty-state-CPC4iNPZ.js} +1 -1
- package/dist/client/assets/{plugin-header-DmxH-nDy.js → plugin-header-BaIUgM8O.js} +1 -1
- package/dist/client/assets/{plugin-layout-DHq8VP6I.js → plugin-layout-CP7WeU3S.js} +1 -1
- package/dist/client/assets/{popover-BE2Ag2Hj.js → popover-g5bCjakL.js} +1 -1
- package/dist/client/assets/{profile-BiAUdeqZ.js → profile-DE9V4UAe.js} +1 -1
- package/dist/client/assets/{project-app-view-BWIUYPZS.js → project-app-view-CsUA3eWI.js} +1 -1
- package/dist/client/assets/registry-Cth6leQk.js +2 -0
- package/dist/client/assets/{registry-layout-D6WP-9Mz.js → registry-layout-IV9o5tdh.js} +1 -1
- package/dist/client/assets/{required-auth-layout-78lMndsk.js → required-auth-layout-CbwdpaRZ.js} +1 -1
- package/dist/client/assets/{reset-password-LLOtqeM3.js → reset-password-HK92arRg.js} +1 -1
- package/dist/client/assets/{roles-CrIxGBCo.js → roles-BWPZWJaM.js} +1 -1
- package/dist/client/assets/{scroll-area-BDlizEf_.js → scroll-area-DPp3zriG.js} +1 -1
- package/dist/client/assets/{search-input-Ck2WpyGM.js → search-input-DFpePjxv.js} +1 -1
- package/dist/client/assets/{select-Bibny-1X.js → select-DNBVly7-.js} +1 -1
- package/dist/client/assets/{select-model-CUnmfM2z.js → select-model-DeUWMCqm.js} +1 -1
- package/dist/client/assets/settings-layout-D82thllZ.js +1 -0
- package/dist/client/assets/{settings-section-BNYaFgEU.js → settings-section-DLmrAiBm.js} +1 -1
- package/dist/client/assets/{shell-layout-BKENpmuK.js → shell-layout-R4iIIify.js} +1 -1
- package/dist/client/assets/{skeleton-D20a7YZ_.js → skeleton-D3XIs5gC.js} +1 -1
- package/dist/client/assets/{sso-BS0m4Gbq.js → sso-DM0bDf34.js} +1 -1
- package/dist/client/assets/{store-CxbfCzK1.js → store-DBYsfjv2.js} +1 -1
- package/dist/client/assets/store-registry-Be_BNgv2.js +2 -0
- package/dist/client/assets/{switch-B5LXqu_k.js → switch-ChHlr-0p.js} +1 -1
- package/dist/client/assets/{table-YZX5FqNR.js → table-D-EfNZTA.js} +1 -1
- package/dist/client/assets/{tabs-DrXz1mKv.js → tabs-C3Y9bmk3.js} +1 -1
- package/dist/client/assets/{task-status-50r4iWhu.js → task-status-Byb391SI.js} +1 -1
- package/dist/client/assets/{textarea-B34jNm12.js → textarea-TEFGem1K.js} +1 -1
- package/dist/client/assets/{toggle-group-CrVa8CeF.js → toggle-group-DYAaGRJB.js} +1 -1
- package/dist/client/assets/{tools-list-DoRhQ4bQ.js → tools-list-DHP55xBU.js} +1 -1
- package/dist/client/assets/{tooltip-7fE-WE8n.js → tooltip-DZ4hI4gi.js} +1 -1
- package/dist/client/assets/{types-KIGJkxYN.js → types-D599MtjY.js} +1 -1
- package/dist/client/assets/{use-ai-providers-BlHdNIJC.js → use-ai-providers-DSutNjVp.js} +1 -1
- package/dist/client/assets/{use-collections-BvXCKCPf.js → use-collections-BbQAdI3o.js} +1 -1
- package/dist/client/assets/{use-connection-BHzWUZTk.js → use-connection-CrEyI3P_.js} +1 -1
- package/dist/client/assets/{use-copy-BM6tbEKn.js → use-copy-Df3K3sfk.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-B9su0hdd.js → use-create-virtual-mcp-t8SMbFkV.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-BBrYSIAA.js → use-debounced-autosave-IAh8TU4o.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-DUjp4NXe.js → use-decopilot-events-CxAD33F2.js} +1 -1
- package/dist/client/assets/{use-delete-connection-D8QH8qmD.js → use-delete-connection-zP-NAmKT.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-nwbx-KTg.js → use-infinite-scroll-hrqUZmbE.js} +1 -1
- package/dist/client/assets/{use-list-state-DRAznPzR.js → use-list-state-DsStSeaC.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DkrDenYe.js → use-mcp-tools-kqffQmIa.js} +1 -1
- package/dist/client/assets/{use-members-H_2fli-8.js → use-members-BqQiitMx.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-DM6COLbJ.js → use-navigate-to-agent-DkjTuG5H.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-DQZC7OFW.js → use-org-auth-client-DM9zvqH-.js} +1 -1
- package/dist/client/assets/{use-org-sso-LaD6hSpN.js → use-org-sso-DFTMWioi.js} +1 -1
- package/dist/client/assets/{use-organization-roles-Tf-ts5gx.js → use-organization-roles-CzgnOad2.js} +1 -1
- package/dist/client/assets/{use-organization-settings-CXJ-uDFo.js → use-organization-settings-CZnRZbph.js} +1 -1
- package/dist/client/assets/{use-registry-connections-BnSuTCtJ.js → use-registry-connections-CT-N1sCh.js} +1 -1
- package/dist/client/assets/{use-status-sounds-CW-esQf_.js → use-status-sounds-Bewyc919.js} +1 -1
- package/dist/client/assets/{use-tasks-_5SYg2Al.js → use-tasks-9cquzKq3.js} +1 -1
- package/dist/client/assets/{use-view-mode-C2T_AD4N.js → use-view-mode-B2bqG4ko.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-Bqk6k6NQ.js → use-virtual-mcp-Bl5HfgtI.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-P_vpKUlW.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-CdjREh1b.js +1 -0
- package/dist/client/assets/{user-8chVVoiM.js → user-BmqT7ATa.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-Dg2K0IHy.js → view-mode-toggle-DdV_2G2i.js} +1 -1
- package/dist/client/assets/{workflow-DLu1DTyd.js → workflow-Oj5odTn3.js} +1 -1
- package/dist/client/assets/workflow-detail-BT6eq7UZ.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +77 -73
- 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/ansi-styles/package.json +54 -0
- package/dist/server/node_modules/ansi-styles/readme.md +173 -0
- package/dist/server/node_modules/onetime/index.d.ts +64 -0
- package/dist/server/node_modules/onetime/index.js +44 -0
- package/dist/server/node_modules/{mimic-fn → onetime}/package.json +16 -15
- package/dist/server/node_modules/onetime/readme.md +94 -0
- package/dist/server/server.js +76 -72
- package/package.json +1 -1
- package/dist/client/assets/ai-providers-v-Xe3QBL.js +0 -1
- package/dist/client/assets/index-D9JwUOO_.js +0 -1
- package/dist/client/assets/registry-CBHaV5Tp.js +0 -2
- package/dist/client/assets/settings-layout-DHrmC_DN.js +0 -1
- package/dist/client/assets/store-registry-DaiC69PW.js +0 -2
- package/dist/client/assets/useInfiniteQuery-ZZ7aYlwI.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-UOA0UYpI.js +0 -1
- package/dist/client/assets/workflow-detail-c0UiiwlM.js +0 -1
- package/dist/server/node_modules/emoji-regex/LICENSE-MIT.txt +0 -20
- package/dist/server/node_modules/emoji-regex/README.md +0 -107
- package/dist/server/node_modules/emoji-regex/index.d.ts +0 -3
- package/dist/server/node_modules/emoji-regex/index.js +0 -4
- package/dist/server/node_modules/emoji-regex/index.mjs +0 -4
- package/dist/server/node_modules/emoji-regex/package.json +0 -45
- package/dist/server/node_modules/get-east-asian-width/index.d.ts +0 -60
- package/dist/server/node_modules/get-east-asian-width/index.js +0 -30
- package/dist/server/node_modules/get-east-asian-width/lookup-data.js +0 -18
- package/dist/server/node_modules/get-east-asian-width/lookup.js +0 -135
- package/dist/server/node_modules/get-east-asian-width/package.json +0 -71
- package/dist/server/node_modules/get-east-asian-width/readme.md +0 -65
- package/dist/server/node_modules/get-east-asian-width/utilities.js +0 -24
- package/dist/server/node_modules/is-fullwidth-code-point/index.d.ts +0 -17
- package/dist/server/node_modules/is-fullwidth-code-point/index.js +0 -12
- package/dist/server/node_modules/is-fullwidth-code-point/package.json +0 -53
- package/dist/server/node_modules/is-fullwidth-code-point/readme.md +0 -31
- package/dist/server/node_modules/mimic-fn/index.d.ts +0 -54
- package/dist/server/node_modules/mimic-fn/index.js +0 -13
- package/dist/server/node_modules/mimic-fn/license +0 -9
- package/dist/server/node_modules/mimic-fn/readme.md +0 -69
- package/dist/server/node_modules/pg-int8/LICENSE +0 -13
- package/dist/server/node_modules/pg-int8/README.md +0 -16
- package/dist/server/node_modules/pg-int8/index.js +0 -100
- package/dist/server/node_modules/pg-int8/package.json +0 -24
- package/dist/server/node_modules/postgres-array/index.d.ts +0 -4
- package/dist/server/node_modules/postgres-array/index.js +0 -97
- package/dist/server/node_modules/postgres-array/license +0 -21
- package/dist/server/node_modules/postgres-array/package.json +0 -35
- package/dist/server/node_modules/postgres-array/readme.md +0 -43
- package/dist/server/node_modules/postgres-bytea/index.js +0 -33
- package/dist/server/node_modules/postgres-bytea/license +0 -21
- package/dist/server/node_modules/postgres-bytea/package.json +0 -34
- package/dist/server/node_modules/postgres-bytea/readme.md +0 -34
- package/dist/server/node_modules/postgres-date/index.js +0 -116
- package/dist/server/node_modules/postgres-date/license +0 -21
- package/dist/server/node_modules/postgres-date/package.json +0 -33
- package/dist/server/node_modules/postgres-date/readme.md +0 -49
- package/dist/server/node_modules/postgres-interval/index.d.ts +0 -20
- package/dist/server/node_modules/postgres-interval/index.js +0 -125
- package/dist/server/node_modules/postgres-interval/license +0 -21
- package/dist/server/node_modules/postgres-interval/package.json +0 -36
- package/dist/server/node_modules/postgres-interval/readme.md +0 -48
- package/dist/server/node_modules/split2/LICENSE +0 -13
- package/dist/server/node_modules/split2/README.md +0 -85
- package/dist/server/node_modules/split2/bench.js +0 -27
- package/dist/server/node_modules/split2/index.js +0 -141
- package/dist/server/node_modules/split2/package.json +0 -39
- package/dist/server/node_modules/split2/test.js +0 -409
- /package/dist/server/node_modules/{get-east-asian-width → ansi-styles}/license +0 -0
- /package/dist/server/node_modules/{is-fullwidth-code-point → onetime}/license +0 -0
|
@@ -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 ds,r as L,p as $l,q as Fl,e as W,s as xe,K as Os,n as Jo,a as Zo,c as se,j as o,l as Re,B as re,E as It,b as Ei,v as ci,f as Pt,d as sn,w as Hl,x as pe,y as Wl,V as Ul,t as we,z as Qo,C as Vl,D as Ft,F as Kl,G as jn,L as ql,H as Hi,I as ti,J as ht,M as ea,P as Gl,_ as Yl,Q as ta,R as sa,T as Xl,g as Jl}from"./index-B_OOgiEa.js";import{C as Ee,u as Zl,w as Ql,A as ec,T as tc,a as sc,S as ic}from"./index-Cs0mksI2.js";import{I as us}from"./integration-icon-Box-itol.js";import{S as Lt,u as Fe,g as ia,a as ra}from"./constants-D5Po9Lb5.js";import{u as kt,a as rc}from"./use-virtual-mcp-Bqk6k6NQ.js";import{a as nc}from"./Users03-l6fjto8R.js";import{u as na,a as vt,b as Ti,c as fs,t as oc,d as En}from"./chat-context-C_Gvp66M.js";import{i as zs}from"./AlertCircle-DenZ2tH1.js";import{i as ac}from"./CheckCircle-uoVBaQQY.js";import{a as Tn,n as lc}from"./ZapSquare-q2bTQS4w.js";import{i as cc,a as hc,b as dc,c as Di,d as uc}from"./XCircle-CwRlSPkG.js";import{s as ls,i as fc}from"./XClose-BYpD-FW2.js";import{c as mc,r as _c,p as oa,f as Dn,a as pc,F as gc,t as Rn,M as rn,G as aa,L as vc,i as xc,b as bc,d as Sc,e as yc}from"./pair-C1uVZAxc.js";import{C as wc,a as Mn,b as In,c as Cc,d as kc,e as Nc,f as jc}from"./command-CI9ISywp.js";import{P as Ks,a as qs,b as Gs}from"./popover-BE2Ag2Hj.js";import{i as Is,a as xi,b as Ec,c as Tc,p as Ri,g as Mi,d as nn,e as la,h as mr,f as Wi,j as An,A as Bn,k as on,l as Dc,m as Rc,n as Mc,t as Ic,o as Ac,q as hi,r as ca,s as ha,u as da,v as Pn,w as Bc,x as As,y as Pc,z as ua,B as fa}from"./agent-icon-aCG4rJO5.js";import{u as ms,a as Lc}from"./use-mcp-tools-DkrDenYe.js";import{u as Oc,a as zc}from"./use-ai-providers-BlHdNIJC.js";import{g as Kt,d as Ln,u as $c,b as _r,e as Fc,f as Hc,c as Wc,T as Uc}from"./index-D9JwUOO_.js";import{u as Ii,i as Vc}from"./shell-layout-BKENpmuK.js";import{i as Kc,P as ct,u as qc,c as Gc,d as Yc,e as Xc}from"./index-B9Elrkih.js";import{u as ma,T as Ve,a as Ke,b as qe,c as Jc}from"./tooltip-7fE-WE8n.js";import{u as Zc}from"./use-status-sounds-CW-esQf_.js";import{E as $s}from"./empty-state-i6xsv-YS.js";import{A as Qc,a as eh,b as th,c as sh,R as _a,d as ih,e as rh}from"./accordion-ChtmP3A-.js";import{u as Ai,a as an,b as nh}from"./use-connection-BHzWUZTk.js";import{g as oh}from"./constants-P7U02cV2.js";import{u as ah,g as lh}from"./types-KIGJkxYN.js";import{u as pa,G as ch}from"./lean-canvas-recruit-modal-Drc7dSHp.js";import{U as ga}from"./user-8chVVoiM.js";import{T as hh,u as va}from"./tools-list-DoRhQ4bQ.js";import{u as dh}from"./unwrap-tool-result-BYXdCQMg.js";import{s as xa,g as uh}from"./connection-slug-eyAPH6o3.js";import{A as ba,a as Sa,b as ya,c as wa,d as Ca,e as ka,f as Na,g as ja}from"./alert-dialog-DbOFkimV.js";import{D as fh,a as ln,b as cn,c as Ea,d as Ta}from"./dialog-59APH-gQ.js";import{C as mh,a as On}from"./card-DF88hzU1.js";import{I as _s}from"./input-BQQp-6KZ.js";import{L as Bs}from"./label-DC5mP9Z5.js";import{S as ts,a as ss,b as is,c as rs,d as Bt}from"./select-Bibny-1X.js";import{S as pr}from"./switch-B5LXqu_k.js";import{T as zn}from"./textarea-B34jNm12.js";import{i as di}from"./Play-DNddfPVv.js";import{s as cs}from"./Plus-BdkW25go.js";import{a as _h}from"./Settings02-B4xVAQg7.js";import{t as Da,i as ph}from"./Tool01-CBOCDbIq.js";import{s as gr}from"./Trash01-CqvPY4I1.js";import{u as bi}from"./use-debounced-autosave-BBrYSIAA.js";import{S as Ra}from"./scroll-area-BDlizEf_.js";import{i as Ma,a as gh}from"./SearchMd-DENJ3C2Y.js";import{C as vh}from"./collection-tabs-B4ahuefD.js";import{C as xh}from"./checkbox-KaNd7DxH.js";import{u as bh,T as Ui,a as Sh,b as yh,c as Vi}from"./tabs-DrXz1mKv.js";import{D as wh,a as Ch,b as kh}from"./drawer-IJtapzyu.js";import{i as Bi}from"./Check-B1QjP0lW.js";import{n as qt}from"./LinkExternal01-JpLMSezj.js";import{S as Nh}from"./index-B2WBo1WB.js";import{D as ns,a as os,b as as,c as Ct,d as jh,e as Eh,f as Th}from"./dropdown-menu-B2SzMipC.js";import{t as vr}from"./ChevronDown-CW5suF8w.js";import{i as Ia}from"./RefreshCcw01-Bv9_h0OY.js";import{V as Dh}from"./view-mode-toggle-Dg2K0IHy.js";import{M as Rh}from"./select-model-CUnmfM2z.js";import{u as Mh}from"./use-organization-settings-CXJ-uDFo.js";import{u as Ys,a as Ih,b as Ah,c as Bh,A as Ph,d as Lh}from"./automation-list-row-CW7pxb1d.js";import{i as Fs}from"./Zap-BBT7v7w5.js";import{S as Oh}from"./search-input-Ck2WpyGM.js";import"./use-navigate-to-agent-DM6COLbJ.js";import"./use-tasks-_5SYg2Al.js";import"./use-collections-BvXCKCPf.js";import"./collection-search-CW10ePNY.js";import"./form-DZNe3M-o.js";import"./Star01-B90yQrQf.js";import"./Lock01-ChyzS6Qk.js";import"./X-CuBCe85s.js";import"./toggle-group-CrVa8CeF.js";import"./index-CsMR0Ypg.js";import"./question-004-sINsf4GQ.js";import"./ai-providers-logos-DD3qZ33J.js";import"./connection-card-Bpyvc28P.js";import"./use-registry-connections-BnSuTCtJ.js";import"./useInfiniteQuery-ZZ7aYlwI.js";import"./infiniteQueryObserver-Djo7_6Dx.js";import"./extract-connection-data-B7tG5T45.js";import"./Container-e4KoMY54.js";import"./connection-form-helpers-BfvL5eFo.js";import"./use-infinite-scroll-nwbx-KTg.js";import"./useSuspenseInfiniteQuery-UOA0UYpI.js";import"./badge-DVYtPj3Q.js";import"./ChevronRight-C75N1vRO.js";import"./use-decopilot-events-DUjp4NXe.js";import"./create-sse-subscription-CxkOgzKf.js";import"./use-copy-BM6tbEKn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./content-blocks-o63cs2vh.js";import"./Sun-jOb3MXPJ.js";import"./index-s4QTWOmY.js";import"./Archive-CUyKZVLi.js";import"./ArrowNarrowLeft-CdHYti4b.js";import"./ArrowUpRight-DQA2yLzS.js";import"./ChevronUp-D9vKVRMW.js";import"./DotsVertical-Bl74LMdL.js";import"./Palette-DxkFGkUo.js";import"./Shield01-CISf8vls.js";import"./User01-DcOBCx9n.js";import"./skeleton-D20a7YZ_.js";import"./avatar-aIgMbJGD.js";import"./index-0FuZBqpL.js";import"./collection-search-B_uLWogM.js";import"./use-create-virtual-mcp-B9su0hdd.js";import"./task-status-50r4iWhu.js";import"./required-auth-layout-78lMndsk.js";import"./use-org-sso-LaD6hSpN.js";import"./collections-BGO4ETj2.js";import"./settings-section-BNYaFgEU.js";import"./formatDistanceToNow-Cb2QZZJn.js";function zh(t,e){const s=ds(e);return $h({filters:{...t,status:"pending"}},s).length}function $n(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function $h(t={},e){const s=ds(e).getMutationCache(),i=L.useRef(t),r=L.useRef(null);return r.current===null&&(r.current=$n(s,t)),L.useEffect(()=>{i.current=t}),L.useSyncExternalStore(L.useCallback(n=>s.subscribe(()=>{const a=$l(r.current,$n(s,i.current));r.current!==a&&(r.current=a,Fl.schedule(n))}),[s]),()=>r.current,()=>r.current)}function Fh(t,e){const s=W.c(40),{org:i,locator:r}=xe();let n;s[0]!==i.id||s[1]!==i.slug?(n={connectionId:Lt,orgId:i.id,orgSlug:i.slug},s[0]=i.id,s[1]=i.slug,s[2]=n):n=s[2];const a=Fe(n),l=ds();let h;s[3]!==t||s[4]!==i.id?(h=Os.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 f=Jo(d);let _;s[13]!==a||s[14]!==e?(_=async x=>{const w=await a.callTool({name:"COLLECTION_THREADS_CREATE",arguments:{data:{id:x,virtual_mcp_id:e}}});if(w.isError){const C=w.content,D=Array.isArray(C)&&C[0]&&typeof C[0]=="object"?C[0].text??"Create failed":"Create failed";throw new Error(D)}return w.structuredContent.item},s[13]=a,s[14]=e,s[15]=_):_=s[15];let m;s[16]!==r||s[17]!==i.id||s[18]!==f||s[19]!==l?(m=()=>{l.invalidateQueries({predicate:x=>x.queryKey[1]===i.id&&x.queryKey[3]==="collection"&&x.queryKey[4]==="THREADS"}),l.invalidateQueries({queryKey:Os.tasksPrefix(r)}),f.refetch()},s[16]=r,s[17]=i.id,s[18]=f,s[19]=l,s[20]=m):m=s[20];let p;s[21]!==_||s[22]!==m?(p={mutationFn:_,onSuccess:m},s[21]=_,s[22]=m,s[23]=p):p=s[23];const g=Zo(p);let v,b;if(s[24]!==g||s[25]!==t||s[26]!==f.data||s[27]!==f.isSuccess?(v=()=>{t&&(!f.isSuccess||f.data||g.isPending||g.variables!==t&&g.mutate(t))},b=[t,f.isSuccess,f.data,g],s[24]=g,s[25]=t,s[26]=f.data,s[27]=f.isSuccess,s[28]=v,s[29]=b):(v=s[28],b=s[29]),L.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(f.isLoading){let x;return s[31]===Symbol.for("react.memo_cache_sentinel")?(x={status:"loading"},s[31]=x):x=s[31],x}if(f.isError){const x=f.error;let w;return s[32]!==x?(w={status:"error",error:x},s[32]=x,s[33]=w):w=s[33],w}if(f.isSuccess&&f.data){let x;return s[34]!==f.data?(x={status:"ready",task:f.data},s[34]=f.data,s[35]=x):x=s[35],x}if(g.isPending||f.isSuccess&&!f.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 y;return s[39]===Symbol.for("react.memo_cache_sentinel")?(y={status:"loading"},s[39]=y):y=s[39],y}function Ss(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Fn(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 Hh(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function Wh(t){const e=W.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(Uh),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 Uh(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 Vh(t){const e=W.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 f;e[6]!==c||e[7]!==u||e[8]!==d?(f=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]=f):f=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 m;e[11]!==a?(m=a.toFixed(1),e[11]=a,e[12]=m):m=e[12];let p;e[13]!==m?(p=o.jsxs("div",{className:"flex items-center gap-1.5",children:[_,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",m,"%"]})]}),e[13]=m,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 y;e[20]!==h||e[21]!==r?(y=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]=y):y=e[22];let x;e[23]!==b||e[24]!==y||e[25]!==p?(x=o.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[p,b,y]}),e[23]=b,e[24]=y,e[25]=p,e[26]=x):x=e[26];let w;return e[27]!==x||e[28]!==f?(w=o.jsxs("div",{className:"flex flex-col gap-2",children:[f,x]}),e[27]=x,e[28]=f,e[29]=w):w=e[29],w}function Kh(t){const e=W.c(19),{part:s}=t,i=s.input?.agent_id,r=kt(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(us,{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 f;e[3]!==d?(f=se("shrink-0 font-medium",d),e[3]=d,e[4]=f):f=e[4];let _;e[5]!==n||e[6]!==f?(_=o.jsx("span",{className:f,children:n}),e[5]=n,e[6]=f,e[7]=_):_=e[7];let m;e[8]!==s.input?(m=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]=m):m=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(Re,{size:12,className:"animate-spin text-muted-foreground"}):h?o.jsx(cc,{size:12,className:"text-destructive"}):c?o.jsx(zs,{size:12,className:"text-warning"}):o.jsx(ac,{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]!==m||e[17]!==p?(g=o.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[u,_,m,p]}),e[14]=u,e[15]=_,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function qh(t){const e=W.c(58),{onClose:s,back:i,className:r}=t,[n,a]=L.useState(null),{messages:l}=na(),{tasks:h,taskId:c}=vt(),{selectedModel:u,selectedVirtualMcp:d}=Ti();let f,_,m,p,g,v,b,y;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){y=Symbol.for("react.early_return_sentinel");e:{let k;e[17]!==c?(k=X=>X.id===c,e[17]=c,e[18]=k):k=e[18];const C=h.find(k),D=mc(l),T=[...l].reverse().find(rd),B=T?.metadata?.usage,I=T?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,R=B?.contextTokens??B?.totalTokens??0,S=I&&I>0?(R/I*100).toFixed(1):null,j=l;let E;e[19]!==j?(E=j.filter(id).reduce(sd,0),e[19]=j,e[20]=E):E=e[20];const N=E,P=l;let M;e[21]!==P?(M=P.filter(td).reduce(ed,0),e[21]=P,e[22]=M):M=e[22];const H=M,V=Math.max(0,D.totalTokens-N-H),U=l[0],K=l.at(-1),Q=U?.metadata?.created_at??C?.created_at,ee=K?.metadata?.created_at??C?.updated_at,Y=l.filter(Qh),$=l.flatMap(Jh),A=u?.modelId?Hh(u.modelId):"—",O=d?.title??"Decopilot",F=[{label:"Session",value:C?.title??"New chat"},{label:"Messages",value:Y.length},{label:"Agent",value:O},{label:"Model",value:A},{label:"Context Limit",value:I?Ss(I):"—"},{label:"Session Tokens (billed)",value:D.totalTokens>0?Ss(D.totalTokens):"0"},{label:"Usage",value:S!==null?`${S}%`:"—"},{label:"Input Tokens",value:D.inputTokens>0?Ss(D.inputTokens):"0"},{label:"Output Tokens",value:D.outputTokens>0?Ss(D.outputTokens):"0"},{label:"Reasoning Tokens",value:D.reasoningTokens>0?Ss(D.reasoningTokens):"0"},{label:"Cost",value:D.cost>0?`$${D.cost<.001?D.cost.toFixed(6):D.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:Fn(Q)},{label:"Last Activity",value:Fn(ee)}];if(!C&&Y.length===0){let X;e[23]!==r?(X=se("flex flex-col h-full w-full border-l border-border bg-background",r),e[23]=r,e[24]=X):X=e[24];let de;e[25]===Symbol.for("react.memo_cache_sentinel")?(de=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[25]=de):de=e[25];let fe;e[26]!==i?(fe=i?o.jsx(Tn,{size:14,className:"text-muted-foreground"}):o.jsx(ls,{size:14,className:"text-muted-foreground"}),e[26]=i,e[27]=fe):fe=e[27];let he;e[28]!==s||e[29]!==fe?(he=o.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[de,o.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:fe})]}),e[28]=s,e[29]=fe,e[30]=he):he=e[30];let ue;e[31]===Symbol.for("react.memo_cache_sentinel")?(ue=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]=ue):ue=e[31];let _e;e[32]!==X||e[33]!==he?(_e=o.jsxs("div",{className:X,children:[he,ue]}),e[32]=X,e[33]=he,e[34]=_e):_e=e[34],y=_e;break e}e[35]!==r?(v=se("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 te;e[37]===Symbol.for("react.memo_cache_sentinel")?(te=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[37]=te):te=e[37];let ae;e[38]!==i?(ae=i?o.jsx(Tn,{size:14}):o.jsx(ls,{size:14}),e[38]=i,e[39]=ae):ae=e[39],e[40]!==s||e[41]!==ae?(b=o.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[te,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:ae})]}),e[40]=s,e[41]=ae,e[42]=b):b=e[42],f="flex flex-col gap-8 p-6",_=$.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:$.map(Xh)})]}),m=o.jsx(Wh,{items:F});let ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(ne=o.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[43]=ne):ne=e[43],e[44]!==H||e[45]!==V||e[46]!==N?(p=o.jsxs("div",{className:"flex flex-col gap-3",children:[ne,o.jsx(Vh,{userTokens:N,assistantTokens:H,otherTokens:V})]}),e[44]=H,e[45]=V,e[46]=N,e[47]=p):p=e[47],g=Y.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:Y.map(X=>{const de=X.metadata?.created_at,fe=n?.id===X.id;return o.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o.jsxs("button",{type:"button",onClick:()=>a(fe?null:X),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:se("shrink-0 font-medium",X.role==="user"?"text-chart-1":"text-chart-2"),children:X.role}),o.jsx("span",{className:"text-muted-foreground",children:"•"}),o.jsx("span",{className:"truncate text-muted-foreground font-mono",children:X.id})]}),de&&o.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(de).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),fe&&o.jsxs(o.Fragment,{children:[X.role==="assistant"&&(()=>{const he=X.metadata?._request;if(!he)return null;const ue=he.systemSections??[],_e=Math.max(1,...ue.map(Yh)),Xe=ue.reduce(Gh,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"]})]}),ue.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(Xe/4).toLocaleString()," ","tok"]})]}),ue.map((He,Je)=>{const it=He.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${Je}`,je=He.chars/_e*100,bt=Math.round(He.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:it}),o.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",bt.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:`${je}%`}})})]},Je)})]})]})})(),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(X,null,2)})]})]},X.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]=f,e[10]=_,e[11]=m,e[12]=p,e[13]=g,e[14]=v,e[15]=b,e[16]=y}else f=e[9],_=e[10],m=e[11],p=e[12],g=e[13],v=e[14],b=e[15],y=e[16];if(y!==Symbol.for("react.early_return_sentinel"))return y;let x;e[48]!==f||e[49]!==_||e[50]!==m||e[51]!==p||e[52]!==g?(x=o.jsxs("div",{className:f,children:[_,m,p,g]}),e[48]=f,e[49]=_,e[50]=m,e[51]=p,e[52]=g,e[53]=x):x=e[53];let w;return e[54]!==v||e[55]!==b||e[56]!==x?(w=o.jsxs("div",{className:v,children:[b,x]}),e[54]=v,e[55]=b,e[56]=x,e[57]=w):w=e[57],w}function Gh(t,e){return t+e.chars}function Yh(t){return t.chars}function Xh(t,e){return o.jsx(Kh,{part:t},e)}function Jh(t){return(t.parts??[]).filter(Zh)}function Zh(t){return t.type==="tool-subtask"}function Qh(t){return t.role!=="system"}function ed(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function td(t){return t.role==="assistant"}function sd(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function id(t){return t.role==="user"}function rd(t){return t.role==="assistant"&&t.metadata?.usage}const Hn=["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"],Wn=["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 nd(){const t=Hn[Math.floor(Math.random()*Hn.length)],e=Wn[Math.floor(Math.random()*Wn.length)];return`deco/${t}-${e}`}function od(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 ad(t){const e=W.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 f;e[0]!==s||e[1]!==i||e[2]!==d?(f={connectionId:d,orgId:s,orgSlug:i},e[0]=s,e[1]=i,e[2]=d,e[3]=f):f=e[3];const _=Fe(f);let m;e[4]!==l||e[5]!==h?(m={owner:l,repo:h},e[4]=l,e[5]=h,e[6]=m):m=e[6];const p=u&&!!n&&!!l&&!!h;let g;e[7]!==_||e[8]!==m||e[9]!==p?(g={client:_,toolName:"list_branches",toolArguments:m,enabled:p,staleTime:3e4,select:dd},e[7]=_,e[8]=m,e[9]=p,e[10]=g):g=e[10];const{data:v,isLoading:b,isError:y}=ms(g);let x,w;e[11]!==r||e[12]!==a?(w=new Set(Object.keys(a?.[r]??{})),x=[...w].sort().map(hd),e[11]=r,e[12]=a,e[13]=x,e[14]=w):(x=e[13],w=e[14]);const k=x;let C;if(e[15]!==v||e[16]!==w){const I=Array.isArray(v)?v:v?.branches??[];let R;e[18]!==w?(R=S=>!w.has(S.name),e[18]=w,e[19]=R):R=e[19],C=I.filter(cd).filter(R).map(ld),e[15]=v,e[16]=w,e[17]=C}else C=e[17];const D=C,T=Array.isArray(v)?null:v?.default_branch??null;let B;return e[20]!==T||e[21]!==y||e[22]!==b||e[23]!==D||e[24]!==k?(B={yours:k,others:D,defaultBase:T,isLoading:b,isError:y},e[20]=T,e[21]=y,e[22]=b,e[23]=D,e[24]=k,e[25]=B):B=e[25],B}function ld(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function cd(t){return typeof t.name=="string"}function hd(t){return{name:t,source:"yours"}}function dd(t){return od(t)}function ud(t){const e=W.c(42),{orgId:s,orgSlug:i,userId:r,connectionId:n,owner:a,repo:l,vmMap:h,value:c,onChange:u}=t,[d,f]=L.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:m,others:p,isLoading:g,isError:v}=ad(_);let b;e[9]!==u?(b=N=>{u(N),f(!1)},e[9]=u,e[10]=b):b=e[10];const y=b,x=c??"Select branch…";let w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Is,{className:"h-3.5 w-3.5"}),e[11]=w):w=e[11];let k;e[12]!==x?(k=o.jsx(Ks,{asChild:!0,children:o.jsxs(re,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 font-mono text-xs",children:[w,o.jsx("span",{className:"max-w-[200px] truncate",children:x})]})}),e[12]=x,e[13]=k):k=e[13];let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(kc,{placeholder:"Search branches…"}),e[14]=C):C=e[14];let D;e[15]!==y?(D=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:[C,o.jsx(re,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>y(nd()),children:"New"})]}),e[15]=y,e[16]=D):D=e[16];let T;e[17]!==v?(T=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]=T):T=e[18];let B;e[19]!==v||e[20]!==g||e[21]!==p.length||e[22]!==m.length?(B=!v&&!g&&m.length===0&&p.length===0&&o.jsx(wc,{children:"No branches found."}),e[19]=v,e[20]=g,e[21]=p.length,e[22]=m.length,e[23]=B):B=e[23];let I;e[24]!==y||e[25]!==m?(I=m.length>0&&o.jsx(Mn,{heading:"Your branches",children:m.map(N=>o.jsxs(In,{value:N.name,onSelect:()=>y(N.name),children:[o.jsx(Is,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:N.name})]},N.name))}),e[24]=y,e[25]=m,e[26]=I):I=e[26];let R;e[27]!==p||e[28]!==y?(R=p.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Cc,{}),o.jsx(Mn,{heading:"Other branches in repo",children:p.map(N=>o.jsxs(In,{value:N.name,onSelect:()=>y(N.name),children:[o.jsx(Is,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:N.name}),N.author&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",N.author]})]},N.name))})]}),e[27]=p,e[28]=y,e[29]=R):R=e[29];let S;e[30]!==R||e[31]!==T||e[32]!==B||e[33]!==I?(S=o.jsxs(Nc,{children:[T,B,I,R]}),e[30]=R,e[31]=T,e[32]=B,e[33]=I,e[34]=S):S=e[34];let j;e[35]!==S||e[36]!==D?(j=o.jsx(qs,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:o.jsxs(jc,{children:[D,S]})}),e[35]=S,e[36]=D,e[37]=j):j=e[37];let E;return e[38]!==d||e[39]!==j||e[40]!==k?(E=o.jsxs(Gs,{open:d,onOpenChange:f,children:[k,j]}),e[38]=d,e[39]=j,e[40]=k,e[41]=E):E=e[41],E}function fd(){const t=W.c(27),{org:e}=xe(),{selectedVirtualMcp:s}=Ti(),{data:i}=Ei.useSession(),{currentBranch:r,setCurrentTaskBranch:n}=vt();let a;t[0]!==e.id?(a=ia(e.id),t[0]=e.id,t[1]=a):a=t[1];const h=s??a,c=kt(h.id),u=i?.user?.id??"",d=c?.metadata?.githubRepo??null,f=!!d?.connectionId&&!!u;let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(nc,{size:32}),t[2]=_):_=t[2];let m;t[3]!==h.icon||t[4]!==h.title?(m=o.jsx(us,{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]=m):m=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]!==f||t[17]!==u?(b=f&&o.jsx("div",{className:"mt-2",children:o.jsx(ud,{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]=f,t[17]=u,t[18]=b):b=t[18];let y;t[19]!==m||t[20]!==p||t[21]!==v||t[22]!==b?(y=o.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[m,p,v,b]}),t[19]=m,t[20]=p,t[21]=v,t[22]=b,t[23]=y):y=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 w;return t[25]!==y?(w=o.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center gap-6 px-4",children:[y,x]}),t[25]=y,t[26]=w):w=t[26],w}function md(){const t=W.c(26),{org:e}=xe(),s=Oc(),{isChatEmpty:i}=na(),[r,n]=L.useState("chat"),a=Zl();if(s.length===0){let y;return t[0]===Symbol.for("react.memo_cache_sentinel")?(y=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]=y):y=t[0],y}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&&!Ql(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=se("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",u),t[10]=u,t[11]=d):d=t[11];let f;t[12]!==i?(f=i?o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(fd,{})}),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]=f):f=t[13];let _;t[14]!==d||t[15]!==f?(_=o.jsx("div",{className:d,children:f}),t[14]=d,t[15]=f,t[16]=_):_=t[16];const m=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let p;t[17]!==m?(p=se("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",m),t[17]=m,t[18]=p):p=t[18];let g;t[19]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(qh,{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 Aa(){const t=W.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(It,{fallback:e,children:o.jsx(L.Suspense,{fallback:o.jsx(Ee.Skeleton,{}),children:o.jsx(md,{})})}),t[1]=s):s=t[1],s}async function _d(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 Ba=["VM_START"],si=new Map,pd=t=>`${t.virtualMcpId}::${t.branch??""}`,Ki=new Set,Si={mark:(t,e)=>Ki.add(`${t}::${e}`),clear:(t,e)=>Ki.delete(`${t}::${e}`),isStopped:(t,e)=>Ki.has(`${t}::${e}`)};function hn(t){const e=ds();return Zo({mutationKey:Ba,mutationFn:async s=>{s.branch&&Si.clear(s.virtualMcpId,s.branch);const i=pd(s),r=si.get(i);if(r)return r;const n=(async()=>(await _d(t,"VM_START",s)).structuredContent)();si.set(i,n);try{return await n}finally{si.get(i)===n&&si.delete(i)}},onSuccess:()=>{ci(e)}})}function Pa(t,e){const s=W.c(3);let i;return s[0]!==e||s[1]!==t?(i={mutationKey:Ba,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],zh(i)>0}const gd={settings:Tc,automations:Ec,env:xi,preview:hc,git:Is};function Un(t){const e=Ri(t);if(e.type==="icon"){const s=Mi(e.name);return s?{kind:"component",Component:s}:null}return e.type==="url"?{kind:"url",src:e.url}:null}function qi(t){if(t.kind==="system")return{kind:"component",Component:gd[t.tabId]};const e=Un(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=Un(s.icon);return i||{kind:"fallback"}}function vd(t){const{org:e}=xe(),s=Fe({connectionId:Lt,orgId:e.id,orgSlug:e.slug}),{data:i}=Hl({queryKey:Os.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 La(t){const e=W.c(8),s=Pt();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const r=sn(i),n=kt(t.virtualMcpId),a=vd(t.taskId),{currentBranch:l}=vt(),h=n?.metadata?.ui??null,c=h?.layout??null,u=c?.tabs??[],d=h?.pinnedViews??[],f=a?.expanded_tools??[],_=!!(n&&Kt(n));let m;e[1]===Symbol.for("react.memo_cache_sentinel")?(m={includeVirtual:!0},e[1]=m):m=e[1];const p=Ai(m),{activeTab:g,mainOpen:v}=_c({mainParam:r.main,metadata:c?{defaultMainView:c.defaultMainView??null,tabs:u.map(xd)}:null}),b=oa(g),y=[];_&&(y.push({id:"preview",title:"Preview"}),y.push({id:"env",title:"Terminal"}),y.push({id:"git",title:l??"git"})),y.push({id:"settings",title:"Settings"}),y.push({id:"automations",title:"Automations"});const x=new Map;for(const T of f){const B=Dn(T.appId,T.toolName);x.set(B,{id:B,title:T.toolName,appId:T.appId,iconKey:T.toolName})}for(const T of d){const B=Dn(T.connectionId,T.toolName);x.set(B,{id:B,title:T.label||T.toolName,appId:T.connectionId,iconKey:T.toolName,iconUrl:T.icon??null})}let w;e[2]!==p?(w=T=>({id:T.id,title:T.title,kind:"agent",icon:qi({tabId:T.id,kind:"agent",appId:T.view.appId,connections:p})}),e[2]=p,e[3]=w):w=e[3];const k=[...u.map(w),...Array.from(x.values()).map(T=>({id:T.id,title:T.title,kind:"expanded",icon:qi({tabId:T.iconKey,kind:"expanded",appId:T.appId,iconUrl:T.iconUrl,connections:p})})),...y.map(T=>({id:T.id,title:T.title,kind:"system",icon:qi({tabId:T.id,kind:"system",connections:p})}))];let C;return e[4]!==g||e[5]!==v||e[6]!==s?(C=T=>{const B=pc({clickedId:T,activeTab:g,mainOpen:v});s({to:".",search:I=>({...I,main:B}),replace:!0})},e[4]=g,e[5]=v,e[6]=s,e[7]=C):C=e[7],{activeTab:g,mainOpen:v,setActiveTab:C,systemTabs:y,layoutTabs:u,expandedTools:f,automationTabParsed:b,tabs:k}}function xd(t){return{id:t.id}}function Oa(t){const{managerAgentId:e,managerName:s,kind:i,id:r,instructions:n}=t,a=` to improve the instructions of ${i} "${r}". Here are its current instructions.
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-app-view-CsUA3eWI.js","assets/index-0enbmaSe.js","assets/index-CpHJcJk3.css","assets/pair-DyP8v5ZE.js","assets/agent-icon-DUbGEO2S.js","assets/AlertCircle-CBFejk6X.js","assets/Tool01-D48iIlf1.js","assets/Archive-iAwIFcLN.js","assets/XClose-Bx_xQQD_.js","assets/RefreshCcw01-BsycvfGb.js","assets/ArrowNarrowLeft-C0NWe8i5.js","assets/XCircle-sedM5Yzu.js","assets/ArrowUpRight-wDGVfxe4.js","assets/ZapSquare-DlRSLgAv.js","assets/Users03-DYLtKI27.js","assets/CheckCircle-B7pbvHXn.js","assets/Check-BzVO1AiZ.js","assets/ChevronDown-Deq9bkeU.js","assets/ChevronRight-De9CjTSZ.js","assets/ChevronUp-B22gTkPS.js","assets/DotsVertical-B0gKWs5D.js","assets/Container-10kbY0mV.js","assets/Star01-CJoi6RDa.js","assets/Palette-B7UA48pi.js","assets/SearchMd-15kzRVQe.js","assets/index-Bna4Mzv7.js","assets/tooltip-DZ4hI4gi.js","assets/X-BkKDRlJI.js","assets/LinkExternal01-DkQ5Dk0s.js","assets/Lock01-CHNFEFTO.js","assets/Sun-CGoBYMaF.js","assets/Play-BunaO9my.js","assets/Plus-DlXyaJQM.js","assets/Settings02-DVi1PM0X.js","assets/Shield01-B70wMBqd.js","assets/Trash01-r5gnirq_.js","assets/User01-DJ7t0J9b.js","assets/Zap-Cf_cpNNU.js","assets/index-BVirFM6V.js","assets/use-copy-Df3K3sfk.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/dialog-2qod6XLb.js","assets/content-blocks-o63cs2vh.js","assets/types-D599MtjY.js","assets/constants--Z68frQS.js","assets/chat-context-CqLR71Tu.js","assets/use-virtual-mcp-Bl5HfgtI.js","assets/use-collections-BbQAdI3o.js","assets/use-ai-providers-DSutNjVp.js","assets/use-decopilot-events-CxAD33F2.js","assets/create-sse-subscription-CxkOgzKf.js","assets/use-tasks-9cquzKq3.js","assets/use-organization-settings-CZnRZbph.js","assets/shell-layout-R4iIIify.js","assets/required-auth-layout-CbwdpaRZ.js","assets/use-org-sso-DFTMWioi.js","assets/integration-icon-Cgu3nEbl.js","assets/use-mcp-tools-kqffQmIa.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as ds,r as L,p as $l,q as Fl,e as W,s as xe,K as Os,n as Jo,a as Zo,c as se,j as o,l as Re,B as re,E as It,b as Ei,v as ci,f as Pt,d as sn,w as Hl,x as pe,y as Wl,V as Ul,t as we,z as Qo,C as Vl,D as Ft,F as Kl,G as jn,L as ql,H as Hi,I as ti,J as ht,M as ea,P as Gl,_ as Yl,Q as ta,R as sa,T as Xl,g as Jl}from"./index-0enbmaSe.js";import{C as Ee,u as Zl,w as Ql,A as ec,T as tc,a as sc,S as ic}from"./index-sxBFqhbB.js";import{I as us}from"./integration-icon-Cgu3nEbl.js";import{S as Lt,u as Fe,g as ia,a as ra}from"./constants--Z68frQS.js";import{u as kt,a as rc}from"./use-virtual-mcp-Bl5HfgtI.js";import{a as nc}from"./Users03-DYLtKI27.js";import{u as na,a as vt,b as Ti,c as fs,t as oc,d as En}from"./chat-context-CqLR71Tu.js";import{i as zs}from"./AlertCircle-CBFejk6X.js";import{i as ac}from"./CheckCircle-B7pbvHXn.js";import{a as Tn,n as lc}from"./ZapSquare-DlRSLgAv.js";import{i as cc,a as hc,b as dc,c as Di,d as uc}from"./XCircle-sedM5Yzu.js";import{s as ls,i as fc}from"./XClose-Bx_xQQD_.js";import{c as mc,r as _c,p as oa,f as Dn,a as pc,F as gc,t as Rn,M as rn,G as aa,L as vc,i as xc,b as bc,d as Sc,e as yc}from"./pair-DyP8v5ZE.js";import{C as wc,a as Mn,b as In,c as Cc,d as kc,e as Nc,f as jc}from"./command-D-VqtTkt.js";import{P as Ks,a as qs,b as Gs}from"./popover-g5bCjakL.js";import{i as Is,a as xi,b as Ec,c as Tc,p as Ri,g as Mi,d as nn,e as la,h as mr,f as Wi,j as An,A as Bn,k as on,l as Dc,m as Rc,n as Mc,t as Ic,o as Ac,q as hi,r as ca,s as ha,u as da,v as Pn,w as Bc,x as As,y as Pc,z as ua,B as fa}from"./agent-icon-DUbGEO2S.js";import{u as ms,a as Lc}from"./use-mcp-tools-kqffQmIa.js";import{u as Oc,a as zc}from"./use-ai-providers-DSutNjVp.js";import{g as Kt,d as Ln,u as $c,b as _r,e as Fc,f as Hc,c as Wc,T as Uc}from"./index-DmW2ChV3.js";import{u as Ii,i as Vc}from"./shell-layout-R4iIIify.js";import{i as Kc,P as ct,u as qc,c as Gc,d as Yc,e as Xc}from"./index-Bna4Mzv7.js";import{u as ma,T as Ve,a as Ke,b as qe,c as Jc}from"./tooltip-DZ4hI4gi.js";import{u as Zc}from"./use-status-sounds-Bewyc919.js";import{E as $s}from"./empty-state-DebOy9XU.js";import{A as Qc,a as eh,b as th,c as sh,R as _a,d as ih,e as rh}from"./accordion-DT47aOa3.js";import{u as Ai,a as an,b as nh}from"./use-connection-CrEyI3P_.js";import{g as oh}from"./constants-BY3slQ5k.js";import{u as ah,g as lh}from"./types-D599MtjY.js";import{u as pa,G as ch}from"./lean-canvas-recruit-modal-Mo-uvZiE.js";import{U as ga}from"./user-BmqT7ATa.js";import{T as hh,u as va}from"./tools-list-DHP55xBU.js";import{u as dh}from"./unwrap-tool-result-BYXdCQMg.js";import{s as xa,g as uh}from"./connection-slug-eyAPH6o3.js";import{A as ba,a as Sa,b as ya,c as wa,d as Ca,e as ka,f as Na,g as ja}from"./alert-dialog-2Jj762BJ.js";import{D as fh,a as ln,b as cn,c as Ea,d as Ta}from"./dialog-2qod6XLb.js";import{C as mh,a as On}from"./card-1EoqQ-Q7.js";import{I as _s}from"./input-CZy7VBF-.js";import{L as Bs}from"./label-BhPoqbH1.js";import{S as ts,a as ss,b as is,c as rs,d as Bt}from"./select-DNBVly7-.js";import{S as pr}from"./switch-ChHlr-0p.js";import{T as zn}from"./textarea-TEFGem1K.js";import{i as di}from"./Play-BunaO9my.js";import{s as cs}from"./Plus-DlXyaJQM.js";import{a as _h}from"./Settings02-DVi1PM0X.js";import{t as Da,i as ph}from"./Tool01-D48iIlf1.js";import{s as gr}from"./Trash01-r5gnirq_.js";import{u as bi}from"./use-debounced-autosave-IAh8TU4o.js";import{S as Ra}from"./scroll-area-DPp3zriG.js";import{i as Ma,a as gh}from"./SearchMd-15kzRVQe.js";import{C as vh}from"./collection-tabs-Li95C-8Z.js";import{C as xh}from"./checkbox-CL4jg0mR.js";import{u as bh,T as Ui,a as Sh,b as yh,c as Vi}from"./tabs-C3Y9bmk3.js";import{D as wh,a as Ch,b as kh}from"./drawer-DSH3rjuX.js";import{i as Bi}from"./Check-BzVO1AiZ.js";import{n as qt}from"./LinkExternal01-DkQ5Dk0s.js";import{S as Nh}from"./index-BVirFM6V.js";import{D as ns,a as os,b as as,c as Ct,d as jh,e as Eh,f as Th}from"./dropdown-menu-CYyf-ZrC.js";import{t as vr}from"./ChevronDown-Deq9bkeU.js";import{i as Ia}from"./RefreshCcw01-BsycvfGb.js";import{V as Dh}from"./view-mode-toggle-DdV_2G2i.js";import{M as Rh}from"./select-model-DeUWMCqm.js";import{u as Mh}from"./use-organization-settings-CZnRZbph.js";import{u as Ys,a as Ih,b as Ah,c as Bh,A as Ph,d as Lh}from"./automation-list-row-Cuemsvmv.js";import{i as Fs}from"./Zap-Cf_cpNNU.js";import{S as Oh}from"./search-input-DFpePjxv.js";import"./use-navigate-to-agent-DkjTuG5H.js";import"./use-tasks-9cquzKq3.js";import"./use-collections-BbQAdI3o.js";import"./collection-search-B-8Jnp5p.js";import"./form-BxsxXSuZ.js";import"./Star01-CJoi6RDa.js";import"./Lock01-CHNFEFTO.js";import"./X-BkKDRlJI.js";import"./toggle-group-DYAaGRJB.js";import"./index-Dk7VTW9z.js";import"./question-004-sINsf4GQ.js";import"./ai-providers-logos-DD3qZ33J.js";import"./connection-card-D4MG7ceA.js";import"./use-registry-connections-CT-N1sCh.js";import"./useInfiniteQuery-P_vpKUlW.js";import"./infiniteQueryObserver-sxIykUWp.js";import"./extract-connection-data-BTMDGqDD.js";import"./Container-10kbY0mV.js";import"./connection-form-helpers-C96WddUN.js";import"./use-infinite-scroll-hrqUZmbE.js";import"./useSuspenseInfiniteQuery-CdjREh1b.js";import"./badge-kdIe7Szq.js";import"./ChevronRight-De9CjTSZ.js";import"./use-decopilot-events-CxAD33F2.js";import"./create-sse-subscription-CxkOgzKf.js";import"./use-copy-Df3K3sfk.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./content-blocks-o63cs2vh.js";import"./Sun-CGoBYMaF.js";import"./index-DyLEkJ9h.js";import"./Archive-iAwIFcLN.js";import"./ArrowNarrowLeft-C0NWe8i5.js";import"./ArrowUpRight-wDGVfxe4.js";import"./ChevronUp-B22gTkPS.js";import"./DotsVertical-B0gKWs5D.js";import"./Palette-B7UA48pi.js";import"./Shield01-B70wMBqd.js";import"./User01-DJ7t0J9b.js";import"./skeleton-D3XIs5gC.js";import"./avatar-BoueLWcb.js";import"./index-D9p0G3vk.js";import"./collection-search-BOMyE6Ld.js";import"./use-create-virtual-mcp-t8SMbFkV.js";import"./task-status-Byb391SI.js";import"./required-auth-layout-CbwdpaRZ.js";import"./use-org-sso-DFTMWioi.js";import"./collections-BpcdhWS9.js";import"./settings-section-DLmrAiBm.js";import"./formatDistanceToNow-Cb2QZZJn.js";function zh(t,e){const s=ds(e);return $h({filters:{...t,status:"pending"}},s).length}function $n(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function $h(t={},e){const s=ds(e).getMutationCache(),i=L.useRef(t),r=L.useRef(null);return r.current===null&&(r.current=$n(s,t)),L.useEffect(()=>{i.current=t}),L.useSyncExternalStore(L.useCallback(n=>s.subscribe(()=>{const a=$l(r.current,$n(s,i.current));r.current!==a&&(r.current=a,Fl.schedule(n))}),[s]),()=>r.current,()=>r.current)}function Fh(t,e){const s=W.c(40),{org:i,locator:r}=xe();let n;s[0]!==i.id||s[1]!==i.slug?(n={connectionId:Lt,orgId:i.id,orgSlug:i.slug},s[0]=i.id,s[1]=i.slug,s[2]=n):n=s[2];const a=Fe(n),l=ds();let h;s[3]!==t||s[4]!==i.id?(h=Os.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 f=Jo(d);let _;s[13]!==a||s[14]!==e?(_=async x=>{const w=await a.callTool({name:"COLLECTION_THREADS_CREATE",arguments:{data:{id:x,virtual_mcp_id:e}}});if(w.isError){const C=w.content,D=Array.isArray(C)&&C[0]&&typeof C[0]=="object"?C[0].text??"Create failed":"Create failed";throw new Error(D)}return w.structuredContent.item},s[13]=a,s[14]=e,s[15]=_):_=s[15];let m;s[16]!==r||s[17]!==i.id||s[18]!==f||s[19]!==l?(m=()=>{l.invalidateQueries({predicate:x=>x.queryKey[1]===i.id&&x.queryKey[3]==="collection"&&x.queryKey[4]==="THREADS"}),l.invalidateQueries({queryKey:Os.tasksPrefix(r)}),f.refetch()},s[16]=r,s[17]=i.id,s[18]=f,s[19]=l,s[20]=m):m=s[20];let p;s[21]!==_||s[22]!==m?(p={mutationFn:_,onSuccess:m},s[21]=_,s[22]=m,s[23]=p):p=s[23];const g=Zo(p);let v,b;if(s[24]!==g||s[25]!==t||s[26]!==f.data||s[27]!==f.isSuccess?(v=()=>{t&&(!f.isSuccess||f.data||g.isPending||g.variables!==t&&g.mutate(t))},b=[t,f.isSuccess,f.data,g],s[24]=g,s[25]=t,s[26]=f.data,s[27]=f.isSuccess,s[28]=v,s[29]=b):(v=s[28],b=s[29]),L.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(f.isLoading){let x;return s[31]===Symbol.for("react.memo_cache_sentinel")?(x={status:"loading"},s[31]=x):x=s[31],x}if(f.isError){const x=f.error;let w;return s[32]!==x?(w={status:"error",error:x},s[32]=x,s[33]=w):w=s[33],w}if(f.isSuccess&&f.data){let x;return s[34]!==f.data?(x={status:"ready",task:f.data},s[34]=f.data,s[35]=x):x=s[35],x}if(g.isPending||f.isSuccess&&!f.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 y;return s[39]===Symbol.for("react.memo_cache_sentinel")?(y={status:"loading"},s[39]=y):y=s[39],y}function Ss(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Fn(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 Hh(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function Wh(t){const e=W.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(Uh),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 Uh(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 Vh(t){const e=W.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 f;e[6]!==c||e[7]!==u||e[8]!==d?(f=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]=f):f=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 m;e[11]!==a?(m=a.toFixed(1),e[11]=a,e[12]=m):m=e[12];let p;e[13]!==m?(p=o.jsxs("div",{className:"flex items-center gap-1.5",children:[_,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",m,"%"]})]}),e[13]=m,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 y;e[20]!==h||e[21]!==r?(y=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]=y):y=e[22];let x;e[23]!==b||e[24]!==y||e[25]!==p?(x=o.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[p,b,y]}),e[23]=b,e[24]=y,e[25]=p,e[26]=x):x=e[26];let w;return e[27]!==x||e[28]!==f?(w=o.jsxs("div",{className:"flex flex-col gap-2",children:[f,x]}),e[27]=x,e[28]=f,e[29]=w):w=e[29],w}function Kh(t){const e=W.c(19),{part:s}=t,i=s.input?.agent_id,r=kt(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(us,{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 f;e[3]!==d?(f=se("shrink-0 font-medium",d),e[3]=d,e[4]=f):f=e[4];let _;e[5]!==n||e[6]!==f?(_=o.jsx("span",{className:f,children:n}),e[5]=n,e[6]=f,e[7]=_):_=e[7];let m;e[8]!==s.input?(m=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]=m):m=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(Re,{size:12,className:"animate-spin text-muted-foreground"}):h?o.jsx(cc,{size:12,className:"text-destructive"}):c?o.jsx(zs,{size:12,className:"text-warning"}):o.jsx(ac,{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]!==m||e[17]!==p?(g=o.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[u,_,m,p]}),e[14]=u,e[15]=_,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function qh(t){const e=W.c(58),{onClose:s,back:i,className:r}=t,[n,a]=L.useState(null),{messages:l}=na(),{tasks:h,taskId:c}=vt(),{selectedModel:u,selectedVirtualMcp:d}=Ti();let f,_,m,p,g,v,b,y;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){y=Symbol.for("react.early_return_sentinel");e:{let k;e[17]!==c?(k=X=>X.id===c,e[17]=c,e[18]=k):k=e[18];const C=h.find(k),D=mc(l),T=[...l].reverse().find(rd),B=T?.metadata?.usage,I=T?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,R=B?.contextTokens??B?.totalTokens??0,S=I&&I>0?(R/I*100).toFixed(1):null,j=l;let E;e[19]!==j?(E=j.filter(id).reduce(sd,0),e[19]=j,e[20]=E):E=e[20];const N=E,P=l;let M;e[21]!==P?(M=P.filter(td).reduce(ed,0),e[21]=P,e[22]=M):M=e[22];const H=M,V=Math.max(0,D.totalTokens-N-H),U=l[0],K=l.at(-1),Q=U?.metadata?.created_at??C?.created_at,ee=K?.metadata?.created_at??C?.updated_at,Y=l.filter(Qh),$=l.flatMap(Jh),A=u?.modelId?Hh(u.modelId):"—",O=d?.title??"Decopilot",F=[{label:"Session",value:C?.title??"New chat"},{label:"Messages",value:Y.length},{label:"Agent",value:O},{label:"Model",value:A},{label:"Context Limit",value:I?Ss(I):"—"},{label:"Session Tokens (billed)",value:D.totalTokens>0?Ss(D.totalTokens):"0"},{label:"Usage",value:S!==null?`${S}%`:"—"},{label:"Input Tokens",value:D.inputTokens>0?Ss(D.inputTokens):"0"},{label:"Output Tokens",value:D.outputTokens>0?Ss(D.outputTokens):"0"},{label:"Reasoning Tokens",value:D.reasoningTokens>0?Ss(D.reasoningTokens):"0"},{label:"Cost",value:D.cost>0?`$${D.cost<.001?D.cost.toFixed(6):D.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:Fn(Q)},{label:"Last Activity",value:Fn(ee)}];if(!C&&Y.length===0){let X;e[23]!==r?(X=se("flex flex-col h-full w-full border-l border-border bg-background",r),e[23]=r,e[24]=X):X=e[24];let de;e[25]===Symbol.for("react.memo_cache_sentinel")?(de=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[25]=de):de=e[25];let fe;e[26]!==i?(fe=i?o.jsx(Tn,{size:14,className:"text-muted-foreground"}):o.jsx(ls,{size:14,className:"text-muted-foreground"}),e[26]=i,e[27]=fe):fe=e[27];let he;e[28]!==s||e[29]!==fe?(he=o.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[de,o.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:fe})]}),e[28]=s,e[29]=fe,e[30]=he):he=e[30];let ue;e[31]===Symbol.for("react.memo_cache_sentinel")?(ue=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]=ue):ue=e[31];let _e;e[32]!==X||e[33]!==he?(_e=o.jsxs("div",{className:X,children:[he,ue]}),e[32]=X,e[33]=he,e[34]=_e):_e=e[34],y=_e;break e}e[35]!==r?(v=se("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 te;e[37]===Symbol.for("react.memo_cache_sentinel")?(te=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[37]=te):te=e[37];let ae;e[38]!==i?(ae=i?o.jsx(Tn,{size:14}):o.jsx(ls,{size:14}),e[38]=i,e[39]=ae):ae=e[39],e[40]!==s||e[41]!==ae?(b=o.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[te,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:ae})]}),e[40]=s,e[41]=ae,e[42]=b):b=e[42],f="flex flex-col gap-8 p-6",_=$.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:$.map(Xh)})]}),m=o.jsx(Wh,{items:F});let ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(ne=o.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[43]=ne):ne=e[43],e[44]!==H||e[45]!==V||e[46]!==N?(p=o.jsxs("div",{className:"flex flex-col gap-3",children:[ne,o.jsx(Vh,{userTokens:N,assistantTokens:H,otherTokens:V})]}),e[44]=H,e[45]=V,e[46]=N,e[47]=p):p=e[47],g=Y.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:Y.map(X=>{const de=X.metadata?.created_at,fe=n?.id===X.id;return o.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o.jsxs("button",{type:"button",onClick:()=>a(fe?null:X),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:se("shrink-0 font-medium",X.role==="user"?"text-chart-1":"text-chart-2"),children:X.role}),o.jsx("span",{className:"text-muted-foreground",children:"•"}),o.jsx("span",{className:"truncate text-muted-foreground font-mono",children:X.id})]}),de&&o.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(de).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),fe&&o.jsxs(o.Fragment,{children:[X.role==="assistant"&&(()=>{const he=X.metadata?._request;if(!he)return null;const ue=he.systemSections??[],_e=Math.max(1,...ue.map(Yh)),Xe=ue.reduce(Gh,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"]})]}),ue.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(Xe/4).toLocaleString()," ","tok"]})]}),ue.map((He,Je)=>{const it=He.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${Je}`,je=He.chars/_e*100,bt=Math.round(He.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:it}),o.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",bt.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:`${je}%`}})})]},Je)})]})]})})(),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(X,null,2)})]})]},X.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]=f,e[10]=_,e[11]=m,e[12]=p,e[13]=g,e[14]=v,e[15]=b,e[16]=y}else f=e[9],_=e[10],m=e[11],p=e[12],g=e[13],v=e[14],b=e[15],y=e[16];if(y!==Symbol.for("react.early_return_sentinel"))return y;let x;e[48]!==f||e[49]!==_||e[50]!==m||e[51]!==p||e[52]!==g?(x=o.jsxs("div",{className:f,children:[_,m,p,g]}),e[48]=f,e[49]=_,e[50]=m,e[51]=p,e[52]=g,e[53]=x):x=e[53];let w;return e[54]!==v||e[55]!==b||e[56]!==x?(w=o.jsxs("div",{className:v,children:[b,x]}),e[54]=v,e[55]=b,e[56]=x,e[57]=w):w=e[57],w}function Gh(t,e){return t+e.chars}function Yh(t){return t.chars}function Xh(t,e){return o.jsx(Kh,{part:t},e)}function Jh(t){return(t.parts??[]).filter(Zh)}function Zh(t){return t.type==="tool-subtask"}function Qh(t){return t.role!=="system"}function ed(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function td(t){return t.role==="assistant"}function sd(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function id(t){return t.role==="user"}function rd(t){return t.role==="assistant"&&t.metadata?.usage}const Hn=["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"],Wn=["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 nd(){const t=Hn[Math.floor(Math.random()*Hn.length)],e=Wn[Math.floor(Math.random()*Wn.length)];return`deco/${t}-${e}`}function od(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 ad(t){const e=W.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 f;e[0]!==s||e[1]!==i||e[2]!==d?(f={connectionId:d,orgId:s,orgSlug:i},e[0]=s,e[1]=i,e[2]=d,e[3]=f):f=e[3];const _=Fe(f);let m;e[4]!==l||e[5]!==h?(m={owner:l,repo:h},e[4]=l,e[5]=h,e[6]=m):m=e[6];const p=u&&!!n&&!!l&&!!h;let g;e[7]!==_||e[8]!==m||e[9]!==p?(g={client:_,toolName:"list_branches",toolArguments:m,enabled:p,staleTime:3e4,select:dd},e[7]=_,e[8]=m,e[9]=p,e[10]=g):g=e[10];const{data:v,isLoading:b,isError:y}=ms(g);let x,w;e[11]!==r||e[12]!==a?(w=new Set(Object.keys(a?.[r]??{})),x=[...w].sort().map(hd),e[11]=r,e[12]=a,e[13]=x,e[14]=w):(x=e[13],w=e[14]);const k=x;let C;if(e[15]!==v||e[16]!==w){const I=Array.isArray(v)?v:v?.branches??[];let R;e[18]!==w?(R=S=>!w.has(S.name),e[18]=w,e[19]=R):R=e[19],C=I.filter(cd).filter(R).map(ld),e[15]=v,e[16]=w,e[17]=C}else C=e[17];const D=C,T=Array.isArray(v)?null:v?.default_branch??null;let B;return e[20]!==T||e[21]!==y||e[22]!==b||e[23]!==D||e[24]!==k?(B={yours:k,others:D,defaultBase:T,isLoading:b,isError:y},e[20]=T,e[21]=y,e[22]=b,e[23]=D,e[24]=k,e[25]=B):B=e[25],B}function ld(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function cd(t){return typeof t.name=="string"}function hd(t){return{name:t,source:"yours"}}function dd(t){return od(t)}function ud(t){const e=W.c(42),{orgId:s,orgSlug:i,userId:r,connectionId:n,owner:a,repo:l,vmMap:h,value:c,onChange:u}=t,[d,f]=L.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:m,others:p,isLoading:g,isError:v}=ad(_);let b;e[9]!==u?(b=N=>{u(N),f(!1)},e[9]=u,e[10]=b):b=e[10];const y=b,x=c??"Select branch…";let w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Is,{className:"h-3.5 w-3.5"}),e[11]=w):w=e[11];let k;e[12]!==x?(k=o.jsx(Ks,{asChild:!0,children:o.jsxs(re,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 font-mono text-xs",children:[w,o.jsx("span",{className:"max-w-[200px] truncate",children:x})]})}),e[12]=x,e[13]=k):k=e[13];let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(kc,{placeholder:"Search branches…"}),e[14]=C):C=e[14];let D;e[15]!==y?(D=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:[C,o.jsx(re,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>y(nd()),children:"New"})]}),e[15]=y,e[16]=D):D=e[16];let T;e[17]!==v?(T=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]=T):T=e[18];let B;e[19]!==v||e[20]!==g||e[21]!==p.length||e[22]!==m.length?(B=!v&&!g&&m.length===0&&p.length===0&&o.jsx(wc,{children:"No branches found."}),e[19]=v,e[20]=g,e[21]=p.length,e[22]=m.length,e[23]=B):B=e[23];let I;e[24]!==y||e[25]!==m?(I=m.length>0&&o.jsx(Mn,{heading:"Your branches",children:m.map(N=>o.jsxs(In,{value:N.name,onSelect:()=>y(N.name),children:[o.jsx(Is,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:N.name})]},N.name))}),e[24]=y,e[25]=m,e[26]=I):I=e[26];let R;e[27]!==p||e[28]!==y?(R=p.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Cc,{}),o.jsx(Mn,{heading:"Other branches in repo",children:p.map(N=>o.jsxs(In,{value:N.name,onSelect:()=>y(N.name),children:[o.jsx(Is,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:N.name}),N.author&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",N.author]})]},N.name))})]}),e[27]=p,e[28]=y,e[29]=R):R=e[29];let S;e[30]!==R||e[31]!==T||e[32]!==B||e[33]!==I?(S=o.jsxs(Nc,{children:[T,B,I,R]}),e[30]=R,e[31]=T,e[32]=B,e[33]=I,e[34]=S):S=e[34];let j;e[35]!==S||e[36]!==D?(j=o.jsx(qs,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:o.jsxs(jc,{children:[D,S]})}),e[35]=S,e[36]=D,e[37]=j):j=e[37];let E;return e[38]!==d||e[39]!==j||e[40]!==k?(E=o.jsxs(Gs,{open:d,onOpenChange:f,children:[k,j]}),e[38]=d,e[39]=j,e[40]=k,e[41]=E):E=e[41],E}function fd(){const t=W.c(27),{org:e}=xe(),{selectedVirtualMcp:s}=Ti(),{data:i}=Ei.useSession(),{currentBranch:r,setCurrentTaskBranch:n}=vt();let a;t[0]!==e.id?(a=ia(e.id),t[0]=e.id,t[1]=a):a=t[1];const h=s??a,c=kt(h.id),u=i?.user?.id??"",d=c?.metadata?.githubRepo??null,f=!!d?.connectionId&&!!u;let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(nc,{size:32}),t[2]=_):_=t[2];let m;t[3]!==h.icon||t[4]!==h.title?(m=o.jsx(us,{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]=m):m=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]!==f||t[17]!==u?(b=f&&o.jsx("div",{className:"mt-2",children:o.jsx(ud,{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]=f,t[17]=u,t[18]=b):b=t[18];let y;t[19]!==m||t[20]!==p||t[21]!==v||t[22]!==b?(y=o.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[m,p,v,b]}),t[19]=m,t[20]=p,t[21]=v,t[22]=b,t[23]=y):y=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 w;return t[25]!==y?(w=o.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center gap-6 px-4",children:[y,x]}),t[25]=y,t[26]=w):w=t[26],w}function md(){const t=W.c(26),{org:e}=xe(),s=Oc(),{isChatEmpty:i}=na(),[r,n]=L.useState("chat"),a=Zl();if(s.length===0){let y;return t[0]===Symbol.for("react.memo_cache_sentinel")?(y=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]=y):y=t[0],y}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&&!Ql(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=se("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",u),t[10]=u,t[11]=d):d=t[11];let f;t[12]!==i?(f=i?o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(fd,{})}),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]=f):f=t[13];let _;t[14]!==d||t[15]!==f?(_=o.jsx("div",{className:d,children:f}),t[14]=d,t[15]=f,t[16]=_):_=t[16];const m=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let p;t[17]!==m?(p=se("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",m),t[17]=m,t[18]=p):p=t[18];let g;t[19]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(qh,{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 Aa(){const t=W.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(It,{fallback:e,children:o.jsx(L.Suspense,{fallback:o.jsx(Ee.Skeleton,{}),children:o.jsx(md,{})})}),t[1]=s):s=t[1],s}async function _d(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 Ba=["VM_START"],si=new Map,pd=t=>`${t.virtualMcpId}::${t.branch??""}`,Ki=new Set,Si={mark:(t,e)=>Ki.add(`${t}::${e}`),clear:(t,e)=>Ki.delete(`${t}::${e}`),isStopped:(t,e)=>Ki.has(`${t}::${e}`)};function hn(t){const e=ds();return Zo({mutationKey:Ba,mutationFn:async s=>{s.branch&&Si.clear(s.virtualMcpId,s.branch);const i=pd(s),r=si.get(i);if(r)return r;const n=(async()=>(await _d(t,"VM_START",s)).structuredContent)();si.set(i,n);try{return await n}finally{si.get(i)===n&&si.delete(i)}},onSuccess:()=>{ci(e)}})}function Pa(t,e){const s=W.c(3);let i;return s[0]!==e||s[1]!==t?(i={mutationKey:Ba,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],zh(i)>0}const gd={settings:Tc,automations:Ec,env:xi,preview:hc,git:Is};function Un(t){const e=Ri(t);if(e.type==="icon"){const s=Mi(e.name);return s?{kind:"component",Component:s}:null}return e.type==="url"?{kind:"url",src:e.url}:null}function qi(t){if(t.kind==="system")return{kind:"component",Component:gd[t.tabId]};const e=Un(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=Un(s.icon);return i||{kind:"fallback"}}function vd(t){const{org:e}=xe(),s=Fe({connectionId:Lt,orgId:e.id,orgSlug:e.slug}),{data:i}=Hl({queryKey:Os.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 La(t){const e=W.c(8),s=Pt();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const r=sn(i),n=kt(t.virtualMcpId),a=vd(t.taskId),{currentBranch:l}=vt(),h=n?.metadata?.ui??null,c=h?.layout??null,u=c?.tabs??[],d=h?.pinnedViews??[],f=a?.expanded_tools??[],_=!!(n&&Kt(n));let m;e[1]===Symbol.for("react.memo_cache_sentinel")?(m={includeVirtual:!0},e[1]=m):m=e[1];const p=Ai(m),{activeTab:g,mainOpen:v}=_c({mainParam:r.main,metadata:c?{defaultMainView:c.defaultMainView??null,tabs:u.map(xd)}:null}),b=oa(g),y=[];_&&(y.push({id:"preview",title:"Preview"}),y.push({id:"env",title:"Terminal"}),y.push({id:"git",title:l??"git"})),y.push({id:"settings",title:"Settings"}),y.push({id:"automations",title:"Automations"});const x=new Map;for(const T of f){const B=Dn(T.appId,T.toolName);x.set(B,{id:B,title:T.toolName,appId:T.appId,iconKey:T.toolName})}for(const T of d){const B=Dn(T.connectionId,T.toolName);x.set(B,{id:B,title:T.label||T.toolName,appId:T.connectionId,iconKey:T.toolName,iconUrl:T.icon??null})}let w;e[2]!==p?(w=T=>({id:T.id,title:T.title,kind:"agent",icon:qi({tabId:T.id,kind:"agent",appId:T.view.appId,connections:p})}),e[2]=p,e[3]=w):w=e[3];const k=[...u.map(w),...Array.from(x.values()).map(T=>({id:T.id,title:T.title,kind:"expanded",icon:qi({tabId:T.iconKey,kind:"expanded",appId:T.appId,iconUrl:T.iconUrl,connections:p})})),...y.map(T=>({id:T.id,title:T.title,kind:"system",icon:qi({tabId:T.id,kind:"system",connections:p})}))];let C;return e[4]!==g||e[5]!==v||e[6]!==s?(C=T=>{const B=pc({clickedId:T,activeTab:g,mainOpen:v});s({to:".",search:I=>({...I,main:B}),replace:!0})},e[4]=g,e[5]=v,e[6]=s,e[7]=C):C=e[7],{activeTab:g,mainOpen:v,setActiveTab:C,systemTabs:y,layoutTabs:u,expandedTools:f,automationTabParsed:b,tabs:k}}function xd(t){return{id:t.id}}function Oa(t){const{managerAgentId:e,managerName:s,kind:i,id:r,instructions:n}=t,a=` to improve the instructions of ${i} "${r}". Here are its current instructions.
|
|
3
3
|
<current_instructions>${n}</current_instructions>`;return{type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Use "},{type:"mention",attrs:{id:e,name:s,char:"@",metadata:{agentId:e,title:s}}},{type:"text",text:a}]}]}}function bd(t){const e=W.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,f=c===void 0?!0:c,_=u===void 0?!1:u,[m,p]=L.useState(!1),[g,v]=L.useState("icons"),[b,y]=L.useState(""),[x,w]=L.useState("blue");let k;e[0]!==s?(k=Ri(s),e[0]=s,e[1]=k):k=e[1];const C=k,D=C.type==="icon"||C.type==="url"&&C.color?C.color:x;let T;e[2]!==i||e[3]!==D?(T=je=>{i(Wi(je,D))},e[2]=i,e[3]=D,e[4]=T):T=e[4];const B=T;let I;e[5]!==i||e[6]!==r||e[7]!==C.name||e[8]!==C.type||e[9]!==C.url?(I=je=>{w(je),r?.(je),C.type==="icon"?i(Wi(C.name,je)):C.type==="url"&&i(An(C.url,je))},e[5]=i,e[6]=r,e[7]=C.name,e[8]=C.type,e[9]=C.url,e[10]=I):I=e[10];const R=I;let S;e[11]!==i||e[12]!==D?(S=je=>{i(An(je,D)),p(!1)},e[11]=i,e[12]=D,e[13]=S):S=e[13];const j=S;let E;e[14]!==i||e[15]!==D?(E=()=>{const je=nn(),bt=je[Math.floor(Math.random()*je.length)];i(Wi(bt,D))},e[14]=i,e[15]=D,e[16]=E):E=e[16];const N=E;let P,M,H,V,U,K,Q,ee;if(e[17]!==l||e[18]!==_||e[19]!==m||e[20]!==d){const je={xs:"rounded-md",sm:"rounded-lg","sm+":"rounded-xl",md:"rounded-xl",lg:"rounded-2xl",xl:"rounded-2xl"};M=Gs,K=_?!1:m,Q=p,P=Ks,U=!0,ee="button",H=_,V=se("relative group overflow-hidden",_?"cursor-default opacity-50":"cursor-pointer",je[d],l),e[17]=l,e[18]=_,e[19]=m,e[20]=d,e[21]=P,e[22]=M,e[23]=H,e[24]=V,e[25]=U,e[26]=K,e[27]=Q,e[28]=ee}else P=e[21],M=e[22],H=e[23],V=e[24],U=e[25],K=e[26],Q=e[27],ee=e[28];let Y;e[29]!==h||e[30]!==n||e[31]!==d||e[32]!==s?(Y=o.jsx(Bn,{icon:s,name:n,size:d,className:h}),e[29]=h,e[30]=n,e[31]=d,e[32]=s,e[33]=Y):Y=e[33];let $;e[34]!==_||e[35]!==f?($=f&&!_&&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(on,{size:16,className:"text-white"})}),e[34]=_,e[35]=f,e[36]=$):$=e[36];let A;e[37]!==H||e[38]!==V||e[39]!==Y||e[40]!==$||e[41]!==ee?(A=o.jsxs("button",{type:ee,disabled:H,className:V,children:[Y,$]}),e[37]=H,e[38]=V,e[39]=Y,e[40]=$,e[41]=ee,e[42]=A):A=e[42];let O;e[43]!==P||e[44]!==U||e[45]!==A?(O=o.jsx(P,{asChild:U,children:A}),e[43]=P,e[44]=U,e[45]=A,e[46]=O):O=e[46];let F;e[47]!==n||e[48]!==s?(F=o.jsx("div",{className:"flex items-center justify-center py-4",children:o.jsx(Bn,{icon:s,name:n,size:"xl"})}),e[47]=n,e[48]=s,e[49]=F):F=e[49];let te;e[50]===Symbol.for("react.memo_cache_sentinel")?(te=()=>v("icons"),e[50]=te):te=e[50];const ae=g==="icons"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let ne;e[51]!==ae?(ne=se("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",ae),e[51]=ae,e[52]=ne):ne=e[52];let X;e[53]!==ne?(X=o.jsx("button",{type:"button",onClick:te,className:ne,children:"Icons"}),e[53]=ne,e[54]=X):X=e[54];let de;e[55]===Symbol.for("react.memo_cache_sentinel")?(de=()=>v("upload"),e[55]=de):de=e[55];const fe=g==="upload"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let he;e[56]!==fe?(he=se("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",fe),e[56]=fe,e[57]=he):he=e[57];let ue;e[58]!==he?(ue=o.jsx("button",{type:"button",onClick:de,className:he,children:"Upload"}),e[58]=he,e[59]=ue):ue=e[59];let _e;e[60]===Symbol.for("react.memo_cache_sentinel")?(_e=o.jsx("div",{className:"flex-1"}),e[60]=_e):_e=e[60];let Xe;e[61]!==X||e[62]!==ue?(Xe=o.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[X,ue,_e]}),e[61]=X,e[62]=ue,e[63]=Xe):Xe=e[63];let He;e[64]!==R||e[65]!==N||e[66]!==B||e[67]!==j||e[68]!==C.name||e[69]!==C.type||e[70]!==b||e[71]!==D||e[72]!==g?(He=g==="icons"?o.jsx(Cd,{search:b,onSearchChange:y,selectedColor:D,onColorChange:R,onSelectIcon:B,onRandom:N,currentIconName:C.type==="icon"?C.name:null}):o.jsx(kd,{onUpload:j}),e[64]=R,e[65]=N,e[66]=B,e[67]=j,e[68]=C.name,e[69]=C.type,e[70]=b,e[71]=D,e[72]=g,e[73]=He):He=e[73];let Je;e[74]!==F||e[75]!==Xe||e[76]!==He?(Je=o.jsx(qs,{align:"start",className:"w-80 p-0",onOpenAutoFocus:Sd,children:o.jsxs("div",{className:"flex flex-col",children:[F,Xe,He]})}),e[74]=F,e[75]=Xe,e[76]=He,e[77]=Je):Je=e[77];let it;return e[78]!==M||e[79]!==K||e[80]!==Q||e[81]!==O||e[82]!==Je?(it=o.jsxs(M,{open:K,onOpenChange:Q,children:[O,Je]}),e[78]=M,e[79]=K,e[80]=Q,e[81]=O,e[82]=Je,e[83]=it):it=e[83],it}function Sd(t){return t.preventDefault()}function yd(t){const e=W.c(27),{selectedColor:s,onColorChange:i}=t,[r,n]=L.useState(!1);let a,l,h,c,u,d,f;if(e[0]!==r||e[1]!==s){const b=la(s);l=Gs,d=r,f=n,a=Ks,u=!0,h="button",c=se("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]=f}else a=e[2],l=e[3],h=e[4],c=e[5],u=e[6],d=e[7],f=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 m;e[12]!==a||e[13]!==u||e[14]!==_?(m=o.jsx(a,{asChild:u,children:_}),e[12]=a,e[13]=u,e[14]=_,e[15]=m):m=e[15];let p;e[16]!==i||e[17]!==s?(p=Rc.map(b=>o.jsx("button",{type:"button",onClick:()=>{i(b.name),n(!1)},className:se("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(qs,{align:"start",side:"right",sideOffset:8,className:"w-auto p-2",onOpenAutoFocus:wd,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]!==f||e[24]!==m||e[25]!==g?(v=o.jsxs(l,{open:d,onOpenChange:f,children:[m,g]}),e[21]=l,e[22]=d,e[23]=f,e[24]=m,e[25]=g,e[26]=v):v=e[26],v}function wd(t){return t.preventDefault()}function Cd(t){const e=W.c(44),{search:s,onSearchChange:i,selectedColor:r,onColorChange:n,onSelectIcon:a,onRandom:l,currentIconName:h}=t;let c,u,d,f,_,m,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=nn(),w=la(r);u=s.trim()?x.filter(R=>{const S=mr(R),j=s.toLowerCase();return S.includes(j)||R.toLowerCase().includes(j)}):x,m="flex flex-col";let k;e[14]===Symbol.for("react.memo_cache_sentinel")?(k=o.jsx(Ma,{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 C;e[15]!==i?(C=R=>i(R.target.value),e[15]=i,e[16]=C):C=e[16];let D;e[17]!==s||e[18]!==C?(D=o.jsxs("div",{className:"relative flex-1",children:[k,o.jsx(_s,{value:s,onChange:C,placeholder:"Filter...",className:"h-8 text-xs pl-7"})]}),e[17]=s,e[18]=C,e[19]=D):D=e[19];let T;e[20]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(Dc,{size:14,className:"text-muted-foreground"}),e[20]=T):T=e[20];let B;e[21]!==l?(B=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:T}),e[21]=l,e[22]=B):B=e[22];let I;e[23]!==n||e[24]!==r?(I=o.jsx(yd,{selectedColor:r,onColorChange:n}),e[23]=n,e[24]=r,e[25]=I):I=e[25],e[26]!==B||e[27]!==I||e[28]!==D?(p=o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[D,B,I]}),e[26]=B,e[27]=I,e[28]=D,e[29]=p):p=e[29],c=Ra,_="h-56",d="grid grid-cols-9 gap-0.5 px-2 pb-2",f=u.map(R=>{const S=Mi(R);return S?o.jsx("button",{type:"button",onClick:()=>a(R),className:se("h-8 w-8 flex items-center justify-center rounded-md transition-colors cursor-pointer",h===R?se(w.bg,w.text):se(w.text,"hover:bg-accent")),title:R,children:o.jsx(S,{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]=f,e[11]=_,e[12]=m,e[13]=p}else c=e[7],u=e[8],d=e[9],f=e[10],_=e[11],m=e[12],p=e[13];let g;e[30]!==d||e[31]!==f?(g=o.jsx("div",{className:d,children:f}),e[30]=d,e[31]=f,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 y;return e[40]!==m||e[41]!==p||e[42]!==b?(y=o.jsxs("div",{className:m,children:[p,b]}),e[40]=m,e[41]=p,e[42]=b,e[43]=y):y=e[43],y}function kd(t){const e=W.c(27),{onUpload:s}=t,i=L.useRef(null);let r;e[0]!==s?(r=k=>{const C=k.target.files?.[0];if(!C)return;if(C.size>2097152){pe.error("Image must be smaller than 2MB"),k.target.value="";return}const D=new FileReader;D.onerror=()=>{pe.error("Failed to read image file"),i.current&&(i.current.value="")},D.onloadend=()=>{D.readyState===FileReader.DONE&&D.result&&s(D.result),i.current&&(i.current.value="")},D.readAsDataURL(C)},e[0]=s,e[1]=r):r=e[1];const n=r,[a,l]=L.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 f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=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(dc,{size:20}),o.jsx("span",{className:"text-xs",children:"Click to upload an image (max 2MB)"})]}),e[8]=f):f=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 m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=k=>l(k.target.value),e[10]=m):m=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(_s,{value:a,onChange:m,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 y;e[18]!==c||e[19]!==b?(y=o.jsx(re,{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]=y):y=e[20];let x;e[21]!==y||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-1.5",children:[g,y]}),e[21]=y,e[22]=g,e[23]=x):x=e[23];let w;return e[24]!==x||e[25]!==u?(w=o.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[u,f,_,x]}),e[24]=x,e[25]=u,e[26]=w):w=e[26],w}function Nd(t){const e=W.c(5),{value:s}=t;let i;if(e[0]!==s){i=Symbol.for("react.early_return_sentinel");e:{const n=Ri(s);if(n.type==="icon"){const a=Mi(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(Kc,{size:16,className:"text-muted-foreground"}),e[4]=r):r=e[4],r}function jd(t){const e=W.c(66),{value:s,onChange:i,className:r,disabled:n}=t,[a,l]=L.useState(!1),[h,c]=L.useState("");let u;e[0]!==s?(u=Ri(s),e[0]=s,e[1]=u):u=e[1];const d=u,f=d.type==="icon"?d.name:null;let _,m,p,g,v,b,y,x,w,k,C,D,T,B,I;if(e[2]!==r||e[3]!==f||e[4]!==n||e[5]!==i||e[6]!==a||e[7]!==h||e[8]!==s){const M=nn();g=h.trim()?M.filter(Y=>{const $=h.toLowerCase();return mr(Y).includes($)||Y.toLowerCase().includes($)}):M,p=Gs,v=n?!1:a,b=l;const H=n?"cursor-default opacity-50":"cursor-pointer hover:bg-accent";let V;e[24]!==r||e[25]!==H?(V=se("size-7 shrink-0 rounded-md transition-colors flex items-center justify-center",H,r),e[24]=r,e[25]=H,e[26]=V):V=e[26];let U;e[27]!==s?(U=o.jsx(Nd,{value:s}),e[27]=s,e[28]=U):U=e[28],e[29]!==n||e[30]!==V||e[31]!==U?(y=o.jsx(Ks,{asChild:!0,children:o.jsx("button",{type:"button",disabled:n,className:V,children:U})}),e[29]=n,e[30]=V,e[31]=U,e[32]=y):y=e[32],m=qs,T="start",B="w-64 p-0",I=Ed,C="flex flex-col";let K;e[33]===Symbol.for("react.memo_cache_sentinel")?(K=o.jsx(Ma,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[33]=K):K=e[33];let Q;e[34]===Symbol.for("react.memo_cache_sentinel")?(Q=Y=>c(Y.target.value),e[34]=Q):Q=e[34],e[35]!==h?(D=o.jsx("div",{className:"px-2 py-2",children:o.jsxs("div",{className:"relative",children:[K,o.jsx(_s,{value:h,onChange:Q,placeholder:"Filter...",className:"h-7 text-xs pl-7"})]})}),e[35]=h,e[36]=D):D=e[36],_=Ra,k="h-48",x="grid grid-cols-8 gap-0.5 px-2 pb-2";let ee;e[37]!==f||e[38]!==i?(ee=Y=>{const $=Mi(Y);return $?o.jsx("button",{type:"button",onClick:()=>{i(`icon://${Y}`),l(!1)},className:se("h-7 w-7 flex items-center justify-center rounded-md transition-colors cursor-pointer",f===Y?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),title:mr(Y),children:o.jsx($,{size:16})},Y):null},e[37]=f,e[38]=i,e[39]=ee):ee=e[39],w=g.map(ee),e[2]=r,e[3]=f,e[4]=n,e[5]=i,e[6]=a,e[7]=h,e[8]=s,e[9]=_,e[10]=m,e[11]=p,e[12]=g,e[13]=v,e[14]=b,e[15]=y,e[16]=x,e[17]=w,e[18]=k,e[19]=C,e[20]=D,e[21]=T,e[22]=B,e[23]=I}else _=e[9],m=e[10],p=e[11],g=e[12],v=e[13],b=e[14],y=e[15],x=e[16],w=e[17],k=e[18],C=e[19],D=e[20],T=e[21],B=e[22],I=e[23];let R;e[40]!==x||e[41]!==w?(R=o.jsx("div",{className:x,children:w}),e[40]=x,e[41]=w,e[42]=R):R=e[42];let S;e[43]!==g.length?(S=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]=S):S=e[44];let j;e[45]!==_||e[46]!==R||e[47]!==S||e[48]!==k?(j=o.jsxs(_,{className:k,children:[R,S]}),e[45]=_,e[46]=R,e[47]=S,e[48]=k,e[49]=j):j=e[49];let E;e[50]!==j||e[51]!==C||e[52]!==D?(E=o.jsxs("div",{className:C,children:[D,j]}),e[50]=j,e[51]=C,e[52]=D,e[53]=E):E=e[53];let N;e[54]!==m||e[55]!==E||e[56]!==T||e[57]!==B||e[58]!==I?(N=o.jsx(m,{align:T,className:B,onOpenAutoFocus:I,children:E}),e[54]=m,e[55]=E,e[56]=T,e[57]=B,e[58]=I,e[59]=N):N=e[59];let P;return e[60]!==p||e[61]!==v||e[62]!==b||e[63]!==y||e[64]!==N?(P=o.jsxs(p,{open:v,onOpenChange:b,children:[y,N]}),e[60]=p,e[61]=v,e[62]=b,e[63]=y,e[64]=N,e[65]=P):P=e[65],P}function Ed(t){return t.preventDefault()}function ui(){const t=W.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(Re,{className:"animate-spin text-muted-foreground",size:24})}),t[0]=e):e=t[0],e}function Gi(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(Wl,{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 Td(t){const e=W.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=se("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 f;e[10]!==s.description?(f=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description}),e[10]=s.description,e[11]=f):f=e[11];let _;e[12]!==d||e[13]!==f?(_=o.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[d,f]}),e[12]=d,e[13]=f,e[14]=_):_=e[14];let m;e[15]!==n||e[16]!==i||e[17]!==r?(m=o.jsx(xh,{checked:i,onCheckedChange:r,disabled:n,className:"mt-0.5"}),e[15]=n,e[16]=i,e[17]=r,e[18]=m):m=e[18];let p;return e[19]!==h||e[20]!==_||e[21]!==m?(p=o.jsxs("label",{className:h,children:[_,m]}),e[19]=h,e[20]=_,e[21]=m,e[22]=p):p=e[22],p}function dn(t){const e=W.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(Dd);if(s.length===0){let f;e[8]!==n?(f=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]=f):f=e[9],c=f;break e}l="flex-1 overflow-auto px-4 py-3 space-y-1",h=s.map(f=>o.jsx(Td,{item:f,isSelected:i===null||i?.includes(f.id),onToggle:()=>r(f.id,d),disabled:a},f.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 Dd(t){return t.id}function Rd(t){const e=W.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=Fe(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=Lc(c);let d;e[6]!==u.tools?(d=u.tools.map(Md),e[6]=u.tools,e[7]=d):d=e[7];const f=d;let _;return e[8]!==n||e[9]!==f||e[10]!==r||e[11]!==i?(_=o.jsx(dn,{items:f,selections:i,onToggle:r,emptyMessage:"No tools available",disabled:n}),e[8]=n,e[9]=f,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function Md(t){return{id:t.name,name:t.name,description:t.description,tags:o.jsx(hh,{annotations:t.annotations,_meta:t._meta})}}function Id(t){const e=W.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=Fe(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.resources?(d=u.resources.map(Ad),e[6]=u.resources,e[7]=d):d=e[7];const f=d;let _;return e[8]!==n||e[9]!==f||e[10]!==r||e[11]!==i?(_=o.jsx(dn,{items:f,selections:i,onToggle:r,emptyMessage:"No resources available",disabled:n}),e[8]=n,e[9]=f,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function Ad(t){return{id:t.name||t.uri,name:t.name||t.uri,description:t.description}}function Bd(t){const e=W.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=Fe(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=bh(c);let d;e[6]!==u.prompts?(d=u.prompts.map(Pd),e[6]=u.prompts,e[7]=d):d=e[7];const f=d;let _;return e[8]!==n||e[9]!==f||e[10]!==r||e[11]!==i?(_=o.jsx(dn,{items:f,selections:i,onToggle:r,emptyMessage:"No prompts available",disabled:n}),e[8]=n,e[9]=f,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function Pd(t){return{id:t.name,name:t.name,description:t.description}}function Ld(t){const e=W.c(54),{currentConnection:s,activeTab:i,selectedId:r,formData:n,toggleTool:a,toggleResource:l,togglePrompt:h,toggleAllTools:c,toggleAllResources:u,toggleAllPrompts:d,onTabChange:f}=t,_=n[r],m=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(us,{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 y;e[11]!==s.description?(y=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[11]=s.description,e[12]=y):y=e[12];let x;e[13]!==b||e[14]!==y?(x=o.jsxs("div",{className:"flex-1 min-w-0",children:[b,y]}),e[13]=b,e[14]=y,e[15]=x):x=e[15];let w;e[16]!==v||e[17]!==x?(w=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]=w):w=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 C;e[20]!==f?(C=P=>f(P),e[20]=f,e[21]=C):C=e[21];let D;e[22]!==i||e[23]!==C?(D=o.jsx(vh,{tabs:k,activeTab:i,onTabChange:C}),e[22]=i,e[23]=C,e[24]=D):D=e[24];const T=m?"Deselect all":"Select all";let B;e[25]!==g||e[26]!==T?(B=o.jsx("button",{type:"button",onClick:g,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:T}),e[25]=g,e[26]=T,e[27]=B):B=e[27];let I;e[28]!==B||e[29]!==D?(I=o.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border shrink-0",children:[D,B]}),e[28]=B,e[29]=D,e[30]=I):I=e[30];let R;e[31]!==i||e[32]!==n||e[33]!==r||e[34]!==a?(R=i==="tools"&&o.jsx(It,{fallback:Gi("Tools not supported by this server"),children:o.jsx(L.Suspense,{fallback:o.jsx(ui,{}),children:o.jsx(Rd,{connectionId:r,selections:n[r]?n[r].tools:[],onToggle:(P,M)=>a(r,P,M)})})}),e[31]=i,e[32]=n,e[33]=r,e[34]=a,e[35]=R):R=e[35];let S;e[36]!==i||e[37]!==n||e[38]!==r||e[39]!==l?(S=i==="resources"&&o.jsx(It,{fallback:Gi("Resources not supported by this server"),children:o.jsx(L.Suspense,{fallback:o.jsx(ui,{}),children:o.jsx(Id,{connectionId:r,selections:n[r]?n[r].resources:[],onToggle:(P,M)=>l(r,P,M)})})}),e[36]=i,e[37]=n,e[38]=r,e[39]=l,e[40]=S):S=e[40];let j;e[41]!==i||e[42]!==n||e[43]!==r||e[44]!==h?(j=i==="prompts"&&o.jsx(It,{fallback:Gi("Prompts not supported by this server"),children:o.jsx(L.Suspense,{fallback:o.jsx(ui,{}),children:o.jsx(Bd,{connectionId:r,selections:n[r]?n[r].prompts:[],onToggle:(P,M)=>h(r,P,M)})})}),e[41]=i,e[42]=n,e[43]=r,e[44]=h,e[45]=j):j=e[45];let E;e[46]!==R||e[47]!==S||e[48]!==j?(E=o.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[R,S,j]}),e[46]=R,e[47]=S,e[48]=j,e[49]=E):E=e[49];let N;return e[50]!==I||e[51]!==E||e[52]!==w?(N=o.jsxs(o.Fragment,{children:[w,I,E]}),e[50]=I,e[51]=E,e[52]=w,e[53]=N):N=e[53],N}function Od(t){const e=W.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=va(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(Mc,{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(re,{variant:"outline",size:"sm",onClick:()=>i(s),children:"Authorize"}),e[4]=s,e[5]=i,e[6]=d):d=e[6];let f;return e[7]!==d?(f=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]=f):f=e[8],f}let h;return e[9]!==r?(h=o.jsx(o.Fragment,{children:r}),e[9]=r,e[10]=h):h=e[10],h}function zd(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 Vn(t){return Object.entries(t).map(([e,s])=>({connection_id:e,selected_tools:s.tools,selected_resources:s.resources,selected_prompts:s.prompts}))}function $d(t,e){return e.type==="SET_ACTIVE_TAB"?{...t,activeTab:e.payload}:t}function Fd(t){const e=W.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]=L.useReducer($d,h),d=an(r??"");let f;e[1]!==a?(f=a??[],e[1]=a,e[2]=f):f=e[2];let _;e[3]!==f?(_=zd(f),e[3]=f,e[4]=_):_=e[4];const m=_;let p;e[5]!==n||e[6]!==m?(p=(K,Q,ee,Y)=>{const $=m[K]?.[Q];let A;$===null?A=Y.filter(F=>F!==ee):$?.includes(ee)?A=$.filter(F=>F!==ee):(A=[...$??[],ee],A.length===Y.length&&(A=null));const O={...m};O[K]?O[K]={...O[K]}:O[K]={tools:null,resources:null,prompts:null},O[K][Q]=A,n.setValue("connections",Vn(O),{shouldDirty:!0,shouldTouch:!0})},e[5]=n,e[6]=m,e[7]=p):p=e[7];const g=p;let v;e[8]!==n||e[9]!==m?(v=(K,Q)=>{const Y=m[K]?.[Q]===null?[]:null,$={...m};$[K]?$[K]={...$[K]}:$[K]={tools:null,resources:null,prompts:null},$[K][Q]=Y,n.setValue("connections",Vn($),{shouldDirty:!0,shouldTouch:!0})},e[8]=n,e[9]=m,e[10]=v):v=e[10];const b=v;let y;e[11]!==g?(y=(K,Q,ee)=>g(K,"tools",Q,ee),e[11]=g,e[12]=y):y=e[12];const x=y;let w;e[13]!==g?(w=(K,Q,ee)=>g(K,"resources",Q,ee),e[13]=g,e[14]=w):w=e[14];const k=w;let C;e[15]!==g?(C=(K,Q,ee)=>g(K,"prompts",Q,ee),e[15]=g,e[16]=C):C=e[16];const D=C;let T;e[17]!==b?(T=K=>b(K,"tools"),e[17]=b,e[18]=T):T=e[18];const B=T;let I;e[19]!==b?(I=K=>b(K,"resources"),e[19]=b,e[20]=I):I=e[20];const R=I;let S;e[21]!==b?(S=K=>b(K,"prompts"),e[21]=b,e[22]=S):S=e[22];const j=S;if(!r||!d)return null;let E;e[23]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(ui,{}),e[23]=E):E=e[23];let N;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=K=>u({type:"SET_ACTIVE_TAB",payload:K}),e[24]=N):N=e[24];let P;e[25]!==d||e[26]!==c.activeTab||e[27]!==m||e[28]!==r||e[29]!==j||e[30]!==R||e[31]!==B||e[32]!==D||e[33]!==k||e[34]!==x?(P=o.jsx(Ld,{currentConnection:d,activeTab:c.activeTab,selectedId:r,formData:m,toggleTool:x,toggleResource:k,togglePrompt:D,toggleAllTools:B,toggleAllResources:R,toggleAllPrompts:j,onTabChange:N},r),e[25]=d,e[26]=c.activeTab,e[27]=m,e[28]=r,e[29]=j,e[30]=R,e[31]=B,e[32]=D,e[33]=k,e[34]=x,e[35]=P):P=e[35];let M;e[36]!==l||e[37]!==r||e[38]!==P?(M=o.jsx(L.Suspense,{fallback:E,children:o.jsx(Od,{connectionId:r,onAuthenticate:l,children:P})}),e[36]=l,e[37]=r,e[38]=P,e[39]=M):M=e[39];let H;e[40]!==i?(H=o.jsx(fh,{className:"px-6 py-4 border-t border-border shrink-0",children:o.jsx(re,{variant:"outline",onClick:()=>i(!1),children:"Done"})}),e[40]=i,e[41]=H):H=e[41];let V;e[42]!==M||e[43]!==H?(V=o.jsxs(ln,{className:"sm:max-w-2xl h-[75vh] max-h-[75vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[M,H]}),e[42]=M,e[43]=H,e[44]=V):V=e[44];let U;return e[45]!==i||e[46]!==s||e[47]!==V?(U=o.jsx(cn,{open:s,onOpenChange:i,children:V}),e[45]=i,e[46]=s,e[47]=V,e[48]=U):U=e[48],U}const Yi={tools:null,resources:null,prompts:null},Hd=Ul.pick({status:!0,title:!0,description:!0,icon:!0,metadata:!0,connections:!0});function Wd(t){const s=new TextEncoder().encode(t),i=Array.from(s,r=>String.fromCharCode(r)).join("");return btoa(i)}function Ud(t){const e=W.c(11),{url:s,agentId:i}=t,[r,n]=L.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),pe.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(Bi,{size:20,className:"text-green-600"}):o.jsx(Di,{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(re,{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 Vd(t){const e=W.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=xa(i),f=Wd(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),_=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(u)}&config=${encodeURIComponent(f)}`;window.open(_,"_blank"),pe.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(re,{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 Kd(t){const e=W.c(12),{url:s,serverName:i,agentId:r}=t,[n,a]=L.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 _=xa(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),pe.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(Bi,{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 f;return e[8]!==h||e[9]!==c||e[10]!==d?(f=o.jsxs(re,{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]=f):f=e[11],f}function qd({virtualMcp:t}){const{org:e}=xe(),s=Fe({connectionId:Lt,orgId:e.id,orgSlug:e.slug}),[i,r]=L.useState(null),[n,a]=L.useState(!1),[l,h]=L.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`,f=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}),pe.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),pe.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(re,{type:"button",variant:"outline",size:"sm",className:"shrink-0 gap-1.5",onClick:f,disabled:n,children:[n?o.jsx(Re,{size:14,className:"animate-spin"}):o.jsx(gh,{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(re,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:_,children:l?o.jsx(Bi,{size:12,className:"text-green-600"}):o.jsx(Di,{size:12})})]})}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Runtime variables"}),o.jsx(Gd,{apiKey:i,agentId:c})]})}function Gd(t){const e=W.c(21),{apiKey:s,agentId:i}=t,[r,n]=L.useState(!1),a=window.location.origin,l=s?`MESH_API_KEY=${s}`:"MESH_API_KEY=<api-key>",h=`MESH_BASE_URL=${a}`,c=`${l}
|
|
4
4
|
${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,f=!s;let _;e[4]!==f?(_=se({"opacity-50":f}),e[4]=f,e[5]=_):_=e[5];let m;e[6]!==l||e[7]!==_?(m=o.jsx("span",{className:_,children:l}),e[6]=l,e[7]=_,e[8]=m):m=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]!==m?(v=o.jsxs("code",{className:"min-w-0 flex-1 font-mono text-xs text-muted-foreground",children:[m,p,g]}),e[11]=m,e[12]=v):v=e[12];let b;e[13]!==r?(b=r?o.jsx(Bi,{size:12,className:"text-green-600"}):o.jsx(Di,{size:12}),e[13]=r,e[14]=b):b=e[14];let y;e[15]!==d||e[16]!==b?(y=o.jsx(re,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:d,children:b}),e[15]=d,e[16]=b,e[17]=y):y=e[17];let x;return e[18]!==v||e[19]!==y?(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,y]})}),e[18]=v,e[19]=y,e[20]=x):x=e[20],x}function Yd(t){const e=W.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(L.Suspense,{fallback:i,children:o.jsx(qd,{virtualMcp:s})}),e[1]=s,e[2]=r):r=e[2],r}function Xd(t){const e=W.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=ma();let f;e[5]!==r.id||e[6]!==h.href?(f=o.jsx(Ud,{url:h.href,agentId:r.id}),e[5]=r.id,e[6]=h.href,e[7]=f):f=e[7];let _,m;e[8]!==u||e[9]!==r.id||e[10]!==h.href?(_=o.jsx(Vd,{url:h.href,serverName:u,agentId:r.id}),m=o.jsx(Kd,{url:h.href,serverName:u,agentId:r.id}),e[8]=u,e[9]=r.id,e[10]=h.href,e[11]=_,e[12]=m):(_=e[11],m=e[12]);let p;e[13]!==f||e[14]!==_||e[15]!==m?(p=o.jsx("div",{className:"flex flex-col gap-3 pt-2",children:o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[f,_,m]})}),e[13]=f,e[14]=_,e[15]=m,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(Yd,{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 y=b;if(d){let C;e[23]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(wh,{className:"mt-4 mb-4 text-base font-semibold",children:"Connect"}),e[23]=C):C=e[23];let D;e[24]!==y?(D=o.jsx(Ch,{children:o.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-6 [touch-action:pan-y]",children:[C,y]})}),e[24]=y,e[25]=D):D=e[25];let T;return e[26]!==i||e[27]!==s||e[28]!==D?(T=o.jsx(kh,{open:s,onOpenChange:i,children:D}),e[26]=i,e[27]=s,e[28]=D,e[29]=T):T=e[29],T}let x;e[30]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Ea,{children:o.jsx(Ta,{children:"Connect"})}),e[30]=x):x=e[30];let w;e[31]!==y?(w=o.jsxs(ln,{className:"max-h-[80vh] overflow-y-auto sm:max-w-2xl",children:[x,y]}),e[31]=y,e[32]=w):w=e[32];let k;return e[33]!==i||e[34]!==s||e[35]!==w?(k=o.jsx(cn,{open:s,onOpenChange:i,children:w}),e[33]=i,e[34]=s,e[35]=w,e[36]=k):k=e[36],k}function Jd(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,e){switch(e.type){case"accumulate":{const s=t??{start:e.now,fields:new Set,saveCount:0,instructionsLength:null},i=new Set(s.fields);for(const r of e.fields)i.add(r);return{...s,fields:i,saveCount:s.saveCount+1,instructionsLength:e.instructionsLength??s.instructionsLength}}case"reset":return null}}function Qd(t){const e=W.c(22),{connection_id:s,usedConnectionIds:i,onOpenSettings:r,onRemove:n,onAuthenticate:a,onSwitchInstance:l,onNewInstance:h}=t,c=an(s),{org:u}=xe();if(!c)return null;let d;e[0]!==c?(d=uh(c),e[0]=c,e[1]=d):d=e[1];const f=d;let _;e[2]!==s?(_=o.jsx(iu,{connection_id:s}),e[2]=s,e[3]=_):_=e[3];let m;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]!==f||e[17]!==i?(m=o.jsx(su,{connection_id:s,connectionTitle:c.title,connectionDescription:c.description,connectionIcon:c.icon,connectionType:c.connection_type,slug:f,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]=f,e[17]=i,e[18]=m):m=e[18];let p;return e[19]!==_||e[20]!==m?(p=o.jsx(L.Suspense,{fallback:_,children:m}),e[19]=_,e[20]=m,e[21]=p):p=e[21],p}const Kn="__new_instance__";async function eu(t,e){const s=t?.idToken??null;if(s){const r=qn(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 qn(e)}function qn(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 tu(t){const e=W.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=Ai(l);if(h.length<=1)return null;let c;e[2]!==i||e[3]!==a||e[4]!==n?(c=p=>{p===Kn?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(Bt,{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 f;e[14]!==a?(f=a&&o.jsx(Bt,{value:Kn,className:"text-xs text-muted-foreground",children:"+ New instance"}),e[14]=a,e[15]=f):f=e[15];let _;e[16]!==d||e[17]!==f?(_=o.jsxs(rs,{children:[d,f]}),e[16]=d,e[17]=f,e[18]=_):_=e[18];let m;return e[19]!==i||e[20]!==c||e[21]!==_?(m=o.jsxs(ts,{value:i,onValueChange:c,children:[u,_]}),e[19]=i,e[20]=c,e[21]=_,e[22]=m):m=e[22],m}function su(t){const e=W.c(55),{connection_id:s,connectionTitle:i,connectionDescription:r,connectionIcon:n,connectionType:a,slug:l,orgSlug:h,appName:c,usedConnectionIds:u,onOpenSettings:d,onRemove:f,onAuthenticate:_,onSwitchInstance:m,onNewInstance:p}=t;let g;e[0]!==s?(g={connectionId:s},e[0]=s,e[1]=g):g=e[1];const v=va(g),y=!(a==="VIRTUAL")&&v.supportsOAuth&&!v.isAuthenticated,x=y?"border-destructive/50 bg-destructive/5":"border-border";let w;e[2]!==x?(w=se("rounded-xl border overflow-hidden transition-colors",x),e[2]=x,e[3]=w):w=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 C;e[7]!==n||e[8]!==i?(C=o.jsx(us,{icon:n,name:i,size:"sm",className:"shrink-0"}),e[7]=n,e[8]=i,e[9]=C):C=e[9];let D;e[10]!==i?(D=o.jsx("p",{className:"text-sm font-medium truncate",children:i}),e[10]=i,e[11]=D):D=e[11];let T;e[12]!==r||e[13]!==y?(T=y?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]=y,e[14]=T):T=e[14];let B;e[15]!==D||e[16]!==T?(B=o.jsxs("div",{className:"flex-1 min-w-0",children:[D,T]}),e[15]=D,e[16]=T,e[17]=B):B=e[17];let I;e[18]!==s||e[19]!==y||e[20]!==_?(I=y?o.jsx(re,{variant:"outline",size:"sm",className:"h-7 text-xs shrink-0",onClick:Y=>{Y.preventDefault(),Y.stopPropagation(),_(s)},children:"Authorize"}):o.jsxs(Ve,{delayDuration:0,children:[o.jsx(Ke,{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(_h,{size:16})})}),o.jsx(qe,{side:"bottom",children:"Connection settings"})]}),e[18]=s,e[19]=y,e[20]=_,e[21]=I):I=e[21];let R;e[22]!==k||e[23]!==C||e[24]!==B||e[25]!==I?(R=o.jsxs(ql,{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:[C,B,I]}),e[22]=k,e[23]=C,e[24]=B,e[25]=I,e[26]=R):R=e[26];let S;e[27]!==c||e[28]!==s||e[29]!==p||e[30]!==m||e[31]!==u?(S=c&&o.jsx(tu,{appName:c,connectionId:s,usedConnectionIds:u,onSwitchInstance:m,onNewInstance:p}),e[27]=c,e[28]=s,e[29]=p,e[30]=m,e[31]=u,e[32]=S):S=e[32];let j;e[33]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(Ac,{size:13}),e[33]=j):j=e[33];let E;e[34]!==d?(E=o.jsx(Ke,{asChild:!0,children:o.jsx(re,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:d,"aria-label":"Configure resources",children:j})}),e[34]=d,e[35]=E):E=e[35];let N;e[36]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx(qe,{side:"bottom",children:"Configure resources"}),e[36]=N):N=e[36];let P;e[37]!==E?(P=o.jsxs(Ve,{delayDuration:0,children:[E,N]}),e[37]=E,e[38]=P):P=e[38];let M;e[39]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(ls,{size:13}),e[39]=M):M=e[39];let H;e[40]!==f?(H=o.jsx(Ke,{asChild:!0,children:o.jsx(re,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:f,"aria-label":"Remove connection",children:M})}),e[40]=f,e[41]=H):H=e[41];let V;e[42]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(qe,{side:"bottom",children:"Remove"}),e[42]=V):V=e[42];let U;e[43]!==H?(U=o.jsxs(Ve,{delayDuration:0,children:[H,V]}),e[43]=H,e[44]=U):U=e[44];let K;e[45]!==P||e[46]!==U?(K=o.jsxs("div",{className:"flex items-center gap-0.5 ml-auto",children:[P,U]}),e[45]=P,e[46]=U,e[47]=K):K=e[47];let Q;e[48]!==S||e[49]!==K?(Q=o.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-border bg-muted/25",children:[S,K]}),e[48]=S,e[49]=K,e[50]=Q):Q=e[50];let ee;return e[51]!==R||e[52]!==Q||e[53]!==w?(ee=o.jsxs("div",{className:w,children:[R,Q]}),e[51]=R,e[52]=Q,e[53]=w,e[54]=ee):ee=e[54],ee}function iu(t){const e=W.c(17),{connection_id:s}=t,i=an(s);if(!i){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(za,{}),e[0]=d):d=e[0],d}let r;e[1]!==i.icon||e[2]!==i.title?(r=o.jsx(us,{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 za(){const t=W.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 ru({virtualMcpId:t,form:e,flushAndSave:s}){const{org:i}=xe(),r=Fe({connectionId:Lt,orgId:i.id,orgSlug:i.slug}),n=kt(t),a=(n?.connections??[]).map(S=>S.connection_id).sort(),{data:l}=Jo({queryKey:Os.projectConnectionDetails(t,a),enabled:a.length>0,queryFn:async()=>await Promise.all(a.map(async j=>{try{const E=await r.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:j}}),{item:N}=dh(E),P=(N?.tools??[]).filter(M=>!!lh(M._meta)).map(M=>({name:M.name,description:M.description}));return{fetchOk:!0,id:j,title:N?.title??j,icon:N?.icon??null,uiTools:P}}catch{return{fetchOk:!1,id:j,title:j,icon:null,uiTools:[]}}}))}),h=(l??[]).filter(S=>S.uiTools.length>0),c=new Set(gc),u=e.watch("metadata.ui.pinnedViews")??[],d=e.watch("metadata.ui.layout")??null,f=d?.defaultMainView??null,_=d?.chatDefaultOpen??!1,m=!f||f.type==="chat"?"chat":f.type==="instructions"||f.type==="connections"||f.type==="layout"?"settings":c.has(f.type)?f.type:`${f.type}:${f.id??""}:${f.toolName??""}`,p=S=>{const[j,E,N]=S.split(":");return j?j==="chat"?{type:j}:c.has(j)?{type:j}:j==="ext-apps"&&E?{type:"ext-apps",id:E,toolName:N||void 0}:null:null},g=S=>{e.setValue("metadata.ui.pinnedViews",S,{shouldDirty:!0})},v=S=>{e.setValue("metadata.ui.layout",{...d,...S},{shouldDirty:!0})},b=L.useRef(!1);if(l&&l.length>0&&!b.current){b.current=!0;const S=new Set((l??[]).filter(N=>N.fetchOk).map(N=>N.id)),j=new Set(h.flatMap(N=>N.uiTools.map(P=>`${N.id}:${P.name}`))),E=u.filter(N=>!S.has(N.connectionId)||j.has(`${N.connectionId}:${N.toolName}`));E.length!==u.length&&(g(E),f?.type==="ext-apps"&&!E.some(N=>N.connectionId===f.id&&N.toolName===f.toolName)&&v({defaultMainView:{type:"chat"}}))}const y=(S,j)=>{if(u.some(N=>N.connectionId===S&&N.toolName===j)){const N=u.filter(M=>!(M.connectionId===S&&M.toolName===j));g(N);const P=`ext-apps:${S}:${j}`;m===P&&v({defaultMainView:{type:"chat"}})}else g([...u,{connectionId:S,toolName:j,label:Rn(j),icon:null}]);s()},x=(S,j,E)=>{g(u.map(N=>N.connectionId===S&&N.toolName===j?{...N,label:E}:N))},w=()=>{s()},k=(S,j,E)=>{g(u.map(N=>N.connectionId===S&&N.toolName===j?{...N,icon:E}:N)),s()},C=S=>{v({defaultMainView:p(S)}),s()},D=a.length===0,T=l&&h.length===0,B=!!Kt(n),I=[{value:"chat",label:"Chat"},{value:"settings",label:"Settings"},{value:"automations",label:"Automations"}];B&&(I.push({value:"env",label:"Terminal"}),I.push({value:"preview",label:"Preview"}));for(const S of u)I.push({value:`ext-apps:${S.connectionId}:${S.toolName}`,label:S.label||S.toolName});const R=h.length>0||D||T;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(mh,{className:"p-6 gap-5",children:[o.jsxs(On,{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(Bs,{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:m,onValueChange:C,children:[o.jsx(ss,{className:"w-44 h-8 text-sm capitalize shrink-0",children:o.jsx(is,{})}),o.jsx(rs,{children:I.map(S=>o.jsx(Bt,{value:S.value,className:"capitalize",children:S.label},S.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(Bs,{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(Ve,{delayDuration:0,children:[o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"shrink-0",children:o.jsx(pr,{checked:m==="chat"?!0:_,disabled:m==="chat",onCheckedChange:S=>{v({chatDefaultOpen:S}),s()}})})}),m==="chat"&&o.jsx(qe,{side:"top",children:"Chat is always shown when it is the default view"})]})]})]}),R&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"border-t border-border -mx-6"}),o.jsxs(On,{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(Bs,{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."}),T&&!D&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"None of the connected servers expose interactive tools."}),h.length>0&&o.jsx("div",{className:"space-y-4 pt-1",children:h.map((S,j)=>o.jsxs("div",{children:[j>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(us,{icon:S.icon,name:S.title,size:"xs",className:"shrink-0"}),o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:S.title})]}),o.jsx("div",{className:"space-y-1.5",children:S.uiTools.map(E=>{const N=u.some(M=>M.connectionId===S.id&&M.toolName===E.name),P=u.find(M=>M.connectionId===S.id&&M.toolName===E.name);return o.jsxs("div",{className:se("flex items-center justify-between gap-3 px-3 py-2 rounded-lg border transition-colors",N?"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(jd,{value:P?.icon??null,onChange:M=>k(S.id,E.name,M),disabled:!N}),o.jsx(_s,{value:N&&P?P.label:Rn(E.name),onChange:M=>x(S.id,E.name,M.target.value),onBlur:w,className:"h-7 text-sm w-40",disabled:!N,readOnly:!N})]}),o.jsx(pr,{checked:N,onCheckedChange:()=>y(S.id,E.name)})]},E.name)})})]},S.id))})]})]})]})]})}function nu({virtualMcp:t,hideOwnTitle:e}){const{org:s}=xe(),i=rc(),r=nh(),n=ds(),a=Fe({connectionId:Lt,orgId:s.id,orgSlug:s.slug}),l=Qo({resolver:Vl(Hd),defaultValues:t}),h=l.watch("connections"),c=!!Kt(t),[u,d]=L.useReducer(Jd,{shareDialogOpen:!1,addDialogOpen:!1,settingsDialogOpen:!1,settingsConnectionId:null}),[f,_]=L.useState(!1),[m,p]=L.useState(!1),{createNewTask:g,setChatOpen:v}=Ii(),{sendMessage:b}=fs(),y=pa(),x=async()=>{if(m)return;const A=l.getValues("metadata.instructions");if(A?.trim()){p(!0);try{B(),we("agent_instructions_improve_clicked",{agent_id:t.id,instructions_length:A.length}),await y(["studio-agent-manager"]),v(!0),await b({tiptapDoc:Oa({managerAgentId:ra.AGENT_MANAGER(s.id),managerName:"Agent Manager",kind:"agent",id:t.id,instructions:A})})}finally{p(!1)}}},w=()=>{B(),we("agent_test_clicked",{agent_id:t.id}),g()},[k,C]=L.useReducer(Zd,null),D=()=>{k!==null&&(we("agent_updated",{agent_id:t.id,fields:Array.from(k.fields),instructions_length:k.instructionsLength,save_count:k.saveCount,edit_duration_ms:Date.now()-k.start}),C({type:"reset"}))},{schedule:T,flush:B}=bi({delayMs:3e4,save:async()=>D()}),I=async()=>{const A=Object.keys(l.control._formState.dirtyFields);if(A.length===0)return;const O=A.includes("metadata"),F=l.getValues();l.reset(F,{keepValues:!0}),await i.update.mutateAsync({id:t.id,data:F}),C({type:"accumulate",now:Date.now(),fields:A,instructionsLength:O?F.metadata?.instructions?.length??0:null}),T()},{schedule:R,flush:S}=bi({save:I});L.useEffect(()=>{const A=l.watch(()=>R());return()=>A.unsubscribe()},[]);const j=()=>{we("connections_dialog_opened",{source:"agent_settings",mode:"add"}),d({type:"SET_ADD_DIALOG_OPEN",payload:!0})},E=async A=>{const O=l.getValues("connections");if(O.some(ae=>ae.connection_id===A))return;l.setValue("connections",[...O,{connection_id:A,selected_tools:Yi.tools,selected_resources:Yi.resources,selected_prompts:Yi.prompts}],{shouldDirty:!0}),d({type:"SET_ADD_DIALOG_OPEN",payload:!1});const F=new URL(`/api/${s.slug}/mcp/${A}`,window.location.origin),te=await jn({url:F.href,token:null,orgId:s.id});te.supportsOAuth&&!te.isAuthenticated&&await V(A)},N=A=>{const F=l.getValues("connections").filter(te=>te.connection_id!==A);l.setValue("connections",F,{shouldDirty:!0})},P=(A,O)=>{const F=l.getValues("connections");if(F.some(te=>te.connection_id===O)){pe.error("This instance is already added to the agent");return}l.setValue("connections",F.map(te=>te.connection_id===A?{...te,connection_id:O}:te),{shouldDirty:!0})},M=async A=>{if(l.getValues("connections").find(F=>F.connection_id===A))try{const F=await a.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:A}}),{item:te}=F.structuredContent??{};if(!te)return;const ae=te.title.replace(/\s*\(.*?\)\s*$/,""),ne=oh("conn"),X=`${ae} (${Date.now().toString(36).slice(-4)})`;await r.create.mutateAsync({id:ne,title:X,description:te.description??null,connection_type:te.connection_type,connection_url:te.connection_url??null,connection_token:null,icon:te.icon??null,app_name:te.app_name??null,app_id:te.app_id??null,connection_headers:te.connection_headers??null});const de=new URL(`/api/${s.slug}/mcp/${ne}`,window.location.origin),fe=await jn({url:de.href,token:null,orgId:s.id});if(fe.supportsOAuth&&!fe.isAuthenticated){const he=await V(ne);if(!he){await r.delete.mutateAsync(ne);return}await r.update.mutateAsync({id:ne,data:{title:`${ae} (${he})`}})}P(A,ne),pe.success("New instance created")}catch(F){console.error("Failed to create instance:",F),pe.error("Failed to create instance")}},H=A=>{d({type:"OPEN_SETTINGS",payload:A})},V=async A=>{const{token:O,tokenInfo:F,error:te}=await Kl({connectionId:A,orgSlug:s.slug,scope:"offline_access"});if(te||!O)return pe.error(`Authentication failed: ${te}`),null;if(F)try{const ne=await fetch(`/api/${s.slug}/connections/${A}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:F.accessToken,refreshToken:F.refreshToken,expiresIn:F.expiresIn,scope:F.scope,clientId:F.clientId,clientSecret:F.clientSecret,tokenEndpoint:F.tokenEndpoint})});if(!ne.ok)console.error("Failed to save OAuth token:",await ne.text()),await r.update.mutateAsync({id:A,data:{connection_token:O}});else try{await r.update.mutateAsync({id:A,data:{}})}catch(X){console.warn("Failed to refresh connection tools after OAuth:",X)}}catch(ne){console.error("Error saving OAuth token:",ne),await r.update.mutateAsync({id:A,data:{connection_token:O}})}else await r.update.mutateAsync({id:A,data:{connection_token:O}});const ae=new URL(`/api/${s.slug}/mcp/${A}`,window.location.origin);return await n.invalidateQueries({queryKey:Os.isMCPAuthenticated(ae.href,null)}),pe.success("Authentication successful"),eu(F,O)},U=()=>{const A=l.getValues("metadata.instructions")??"",O=`<role>
|
|
5
5
|
Define who this agent is and what it specializes in.
|
|
@@ -179,4 +179,4 @@ WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){t
|
|
|
179
179
|
`,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return{get promptLabel(){return xr.get()},set promptLabel(t){xr.set(t)},get tooMuchOutput(){return br.get()},set tooMuchOutput(t){br.set(t)}}}_verifyIntegers(...t){for(ut of t)if(ut===1/0||isNaN(ut)||ut%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(ut of t)if(ut&&(ut===1/0||isNaN(ut)||ut%1!==0||ut<0))throw new Error("This API only accepts positive integers")}};var Rp=2,Mp=1,Ip=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let e=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(e._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let e=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,s=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(s.getPropertyValue("height")),r=Math.max(0,parseInt(s.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),a={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},l=a.top+a.bottom,h=a.right+a.left,c=i-l,u=r-h-e;return{cols:Math.max(Rp,Math.floor(u/t.css.cell.width)),rows:Math.max(Mp,Math.floor(c/t.css.cell.height))}}};function Ap({source:t,onReady:e,onSelectionChange:s,className:i}){const r=L.useRef(null),n=L.useRef(null),a=L.useRef(s);a.current=s;const l=Gt(),h=L.useRef(t);return h.current=t,ef((c,u)=>{c===h.current&&n.current?.write(u)}),L.useEffect(()=>{const c=r.current;if(!c)return;const u=getComputedStyle(document.documentElement),d=v=>u.getPropertyValue(v).trim()||void 0,f=new Dp({allowTransparency:!1,fontFamily:d("--font-mono")||"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:12.5,lineHeight:1.5,scrollback:5e3,cursorBlink:!1,disableStdin:!0,theme:{background:d("--sidebar")||d("--card")||d("--background")||"#1e1e1e",cursor:"transparent",foreground:d("--foreground")||"#d4d4d4",selectionBackground:d("--accent"),selectionForeground:d("--accent-foreground"),black:d("--muted"),red:d("--destructive"),green:d("--success"),yellow:d("--warning"),blue:d("--chart-1"),magenta:d("--chart-3"),cyan:d("--chart-5"),white:d("--foreground"),brightBlack:d("--muted-foreground"),brightRed:d("--destructive"),brightGreen:d("--success"),brightYellow:d("--warning"),brightBlue:d("--chart-1"),brightMagenta:d("--chart-3"),brightCyan:d("--chart-5"),brightWhite:d("--foreground")}}),_=new Ip;f.loadAddon(_),f.open(c),_.fit();const m=l.getBuffer(t);m&&f.write(m),n.current=f,e?.(f);const p=f.onSelectionChange(()=>{const v=!!f.getSelection();a.current?.(v,()=>f.getSelection())}),g=new ResizeObserver(()=>{_.fit()});return g.observe(c),()=>{p.dispose(),g.disconnect(),n.current=null,f.dispose()}},[]),o.jsx("div",{ref:r,className:se("overflow-hidden bg-sidebar px-4 py-3 [&_.xterm]:h-full [&_.xterm-screen]:min-h-full [&_.xterm-viewport]:overscroll-contain",i)})}function Bp(){const t=W.c(2),s=wn()?.entity;let i;return t[0]!==s?(i=Kt(s),t[0]=s,t[1]=i):i=t[1],i}const Pp={npm:{install:"npm install",run:t=>`npm run ${t}`,runtime:"node"},pnpm:{install:"pnpm install",run:t=>`pnpm run ${t}`,runtime:"node"},yarn:{install:"yarn install",run:t=>`yarn run ${t}`,runtime:"node"},bun:{install:"bun install",run:t=>`bun run ${t}`,runtime:"bun"},deno:{install:"deno install",run:t=>`deno task ${t}`,runtime:"deno"}},Lp=["dev","start"];function Op({daemonOpen:t=!1}){const{org:e}=xe(),s=wn(),i=ds(),{data:r}=Ei.useSession(),{currentBranch:n,setCurrentTaskBranch:a}=vt(),l=r?.user?.id,h=s?.entity?.metadata,c=l&&n?h?.vmMap?.[l]?.[n]:void 0,u=c&&n?{previewUrl:c.previewUrl,vmId:c.vmId,branch:n,runnerKind:c.runnerKind}:null,[d,f]=L.useState(null),[_,m]=L.useState(""),[p,g]=L.useState(""),[v,b]=L.useState(!1),[y,x]=L.useState(new Set),w=L.useRef(!1),k=L.useRef(Date.now()),[C,D]=L.useState("setup"),[T,B]=L.useState([]),I=L.useRef(new Map),{sendMessage:R}=fs(),{setChatOpen:S}=Ii(),[j,E]=L.useState(!1),N=L.useRef(null),P=G=>{D(G),E(!1),N.current=null},M=(G,ie,Z)=>{G===C&&(E(ie),N.current=ie?Z:null)},H=()=>{const G=N.current?.();if(!G)return;S(!0),R({parts:[{type:"text",text:`<server-logs>
|
|
180
180
|
${G}
|
|
181
181
|
</server-logs>`}]}),I.current.get(C)?.clearSelection()},V=Fe({connectionId:Lt,orgId:e.id,orgSlug:e.slug}),U=Gt(),K=Pa(s?.entity?.id,n??void 0),Q=U.suspended?"suspended":U.notFound?"creating":u?"running":K?"creating":"idle",ee=d??Q;if(L.useEffect(()=>{d==="creating"&&Q==="running"&&f(null),d==="stopping"&&Q==="idle"&&f(null)},[Q,d]),y.size>0){let G=!1;const ie=new Set(y);for(const Z of y)U.activeProcesses.includes(Z)||(ie.delete(Z),G=!0);G&&x(ie)}const Y=hn(V),{mutate:$,isPending:A}=Y,O=s?.entity?.id,F=U.notFound?c?.vmId??null:null,te=L.useRef(null);L.useEffect(()=>{if(!F||!O||A||te.current===F)return;te.current=F;const G={virtualMcpId:O};n&&(G.branch=n),$(G,{onError:ie=>{console.error("[env] reprovision VM_START failed",ie)}})},[F,O,n,A,$]);const ae=L.useRef(!1);L.useEffect(()=>{if(U.scripts.length>0&&!ae.current){ae.current=!0;for(const G of Lp)if(U.scripts.includes(G)){B([G]),P(G);break}}},[U.scripts]);const ne=async(G,ie)=>{const Z=await V.callTool({name:G,arguments:ie}),ge=Z.content;if(ge?.[0]?.text?.startsWith("Error:"))throw new Error(ge[0].text);return Z.structuredContent??Z},X=async G=>{if(!(v||!u||!O||!n)){b(!0);try{const ie=new URLSearchParams({virtualMcpId:O,branch:n}).toString(),Z=await fetch(`/api/${encodeURIComponent(e.slug)}/vm-exec/exec/${encodeURIComponent(G)}?${ie}`,{method:"POST"});if(!Z.ok)throw new Error(`Exec failed: ${Z.statusText}`)}finally{b(!1)}}},de=async G=>{if(!(!u||!O||!n)&&!y.has(G)){x(ie=>{const Z=new Set(ie);return Z.add(G),Z});try{const ie=new URLSearchParams({virtualMcpId:O,branch:n}).toString(),Z=await fetch(`/api/${encodeURIComponent(e.slug)}/vm-exec/kill/${encodeURIComponent(G)}?${ie}`,{method:"POST"});if(!Z.ok)throw new Error(`Kill failed: ${Z.statusText}`)}catch{x(ie=>{const Z=new Set(ie);return Z.delete(G),Z}),pe.error(`Failed to stop ${G}`)}}},fe=G=>{T.includes(G)||B(ie=>[...ie,G]),P(G),X(G)},he=async()=>{if(!w.current){w.current=!0,s?.entity?.id&&n&&Si.clear(s.entity.id,n),k.current=Date.now(),f("creating"),m("Connecting..."),g(""),ae.current=!1,B([]),P("setup");try{if(!s?.entity)throw new Error("No virtual MCP context");const G={virtualMcpId:s.entity.id};n&&(G.branch=n);const ie=await ne("VM_START",G);if(!ie.vmId||!ie.branch)throw new Error("Invalid VM response — missing fields");n||a(ie.branch),m(""),ci(i)}catch(G){f("error"),g(G instanceof Error?G.message:"Failed to start VM")}finally{w.current=!1}}},ue=async()=>{const G=u?.branch??n;f("stopping");const ie=s?.entity?.id;if(ie&&G&&Si.mark(ie,G),ie&&G)try{await V.callTool({name:"VM_DELETE",arguments:{virtualMcpId:ie,branch:G}})}catch{}ci(i)},_e=Bp(),Xe=s?.entity?.metadata?.runtime,He="__none__",Je=Object.keys(Pp),it=async(G,ie)=>{if(s?.entity)try{await V.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:s.entity.id,data:{metadata:{runtime:{...Xe,[G]:ie}}}}}),ci(i)}catch{pe.error("Failed to update setting")}};if(ee==="idle"||ee==="stopping"){const G=ee==="stopping";return o.jsx("div",{className:"flex flex-col items-center justify-center w-full h-full p-6",children:o.jsxs("div",{className:"flex flex-col gap-4 w-full max-w-xs",children:[_e&&o.jsxs("a",{href:`https://github.com/${_e.owner}/${_e.name}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-4 rounded-lg border border-border hover:bg-accent/50 transition-colors",children:[o.jsx(ch,{size:24}),o.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0 flex-1",children:[o.jsxs("span",{className:"text-sm font-medium truncate",children:[_e.owner,"/",_e.name]}),o.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["github.com/",_e.owner,"/",_e.name]})]}),o.jsx(qt,{size:14,className:"text-muted-foreground shrink-0"})]}),o.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-2 w-full",children:[o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx(Bs,{htmlFor:"env-runtime",className:"text-xs font-medium",children:"Runtime"}),o.jsxs(ts,{value:Xe?.selected??He,onValueChange:ie=>it("selected",ie===He?null:ie),children:[o.jsx(ss,{id:"env-runtime",className:"w-28",children:o.jsx(is,{placeholder:"None"})}),o.jsxs(rs,{children:[o.jsx(Bt,{value:He,children:"None"}),Je.map(ie=>o.jsx(Bt,{value:ie,children:ie},ie))]})]})]}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx(Bs,{htmlFor:"env-port",className:"text-xs font-medium",children:"Port"}),o.jsx(_s,{id:"env-port",placeholder:"3001",className:"w-20 h-8",defaultValue:Xe?.port??"",onBlur:ie=>it("port",ie.target.value||null)})]}),o.jsxs(re,{onClick:he,disabled:G,children:[G?o.jsx(Re,{size:14,className:"animate-spin"}):o.jsx(di,{size:14}),G?"Stopping...":"Run"]})]})]})})}if(ee==="creating"){const G=U.notFound?"Sandbox was stopped, we're restarting it…":_;return o.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full gap-4",children:[o.jsx(Re,{size:24,className:"animate-spin text-muted-foreground"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:G}),o.jsx(vc,{since:k.current})]})}if(ee==="error")return o.jsx(Va,{errorMsg:p,onRetry:he});if(ee==="suspended")return o.jsx(Ua,{onResume:he});const je=["setup",...T,...t?["daemon"]:[]],bt=U.scripts.filter(G=>!T.includes(G));return o.jsx("div",{className:"flex flex-col w-full h-full",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex h-12 items-center border-b border-border px-2 shrink-0",children:[je.map(G=>o.jsx("button",{type:"button",onClick:()=>P(G),className:se("flex items-center h-full px-3 text-sm whitespace-nowrap border-b-2 mb-[-1px] capitalize transition-all hover:text-foreground",C===G?"text-foreground border-primary":"text-muted-foreground border-transparent"),children:G},G)),bt.length>0&&o.jsxs(ns,{children:[o.jsx(os,{asChild:!0,children:o.jsx("button",{type:"button",className:"flex items-center h-full px-2 text-muted-foreground hover:text-foreground transition-colors",children:o.jsx(cs,{size:14})})}),o.jsx(as,{align:"start",children:bt.map(G=>o.jsx(Ct,{onClick:()=>fe(G),children:G},G))})]}),o.jsx("div",{className:"flex-1 flex justify-center",children:u?.vmId&&o.jsxs("div",{className:"flex items-center",children:[o.jsxs(Ve,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button",className:"shrink-0 rounded-l bg-muted px-1.5 py-0.5 text-[10px] font-mono text-muted-foreground cursor-pointer hover:bg-accent hover:text-foreground transition-colors border-r border-border/50",onClick:()=>navigator.clipboard.writeText(u?.vmId??""),children:u.vmId})}),o.jsx(qe,{side:"bottom",children:"Copy VM ID"})]}),o.jsxs(ns,{children:[o.jsx(os,{asChild:!0,children:o.jsx("button",{type:"button",className:"shrink-0 self-stretch rounded-r bg-muted px-0.5 text-[10px] text-muted-foreground cursor-pointer hover:bg-accent hover:text-foreground transition-colors",children:o.jsx(vr,{size:10})})}),o.jsx(as,{align:"center",children:o.jsxs(Ct,{onClick:ue,children:[o.jsx(Pn,{size:12}),"Stop Server"]})})]})]})}),o.jsxs("div",{className:"flex items-center gap-1",children:[j&&o.jsxs("button",{type:"button",onClick:H,className:"flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[o.jsx(Bc,{size:12}),"Add to chat"]}),C!=="setup"&&C!=="daemon"&&T.includes(C)&&(()=>{const G=U.activeProcesses.includes(C),ie=y.has(C),Z=G&&!ie,ge=v||ie,Ze=()=>X(C),vs=()=>de(C),xs=v?"Running...":ie?"Stopping...":G?"Restart":"Run";return o.jsxs("div",{className:"flex items-center",children:[o.jsxs("button",{type:"button",disabled:ge,onClick:Ze,className:se("flex items-center gap-1 border border-border px-2 py-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted transition-colors disabled:opacity-50",Z?"rounded-l-md border-r-0":"rounded-md"),children:[ge?o.jsx(Re,{size:12,className:"animate-spin"}):o.jsx(di,{size:12}),xs]}),Z&&o.jsxs(ns,{children:[o.jsx(os,{asChild:!0,children:o.jsx("button",{type:"button",disabled:ge,className:"flex items-center self-stretch rounded-r-md border border-border px-1 text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors disabled:opacity-50",children:o.jsx(vr,{size:12})})}),o.jsx(as,{align:"end",children:o.jsxs(Ct,{onClick:vs,children:[o.jsx(Pn,{size:12}),"Stop"]})})]})]})})()]})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:je.map(G=>o.jsx("div",{className:se("h-full",C===G?"block":"hidden"),children:U.hasData(G)||G==="setup"||G==="daemon"?o.jsx(Ap,{source:G,onReady:ie=>{I.current.set(G,ie)},onSelectionChange:(ie,Z)=>M(G,ie,Z),className:"h-full"}):o.jsx($s,{className:"h-full",image:null,title:`Script "${G}" not running`,description:`Click Run to start "${G}".`,actions:o.jsxs(re,{variant:"outline",size:"sm",disabled:v,onClick:()=>X(G),children:[v?o.jsx(Re,{size:14,className:"animate-spin"}):o.jsx(di,{size:14}),"Run"]})})},G))})]})})}function zp(t){const e=W.c(1);let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Op,{}),e[0]=s):s=e[0],s}function Ls(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function $p(t){if(!t)return"Unknown schedule";const e=t.trim();if(e==="* * * * *")return"Every minute";if(e==="0 * * * *")return"Every hour";if(e==="0 0 * * *")return"Every day";if(e==="0 0 * * 1")return"Every week";const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return`Every ${s[1]} minutes`;const i=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(i)return`Every ${i[1]} hours`;const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const l=parseInt(r[1]??"1");return l%7===0?`Every ${l/7} weeks`:`Every ${l} days`}const n=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(n){const l=(n[2]??"0").padStart(2,"0"),h=(n[1]??"0").padStart(2,"0");return`Every day at ${l}:${h} UTC`}const a=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(a){const h=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(a[3]??"0")]??"day",c=(a[2]??"0").padStart(2,"0"),u=(a[1]??"0").padStart(2,"0");return`Every ${h} at ${c}:${u} UTC`}return t}function Fp(t,e){const s=Math.max(1,t);switch(e){case"minutes":return s===1?"* * * * *":`*/${s} * * * *`;case"hours":return s===1?"0 * * * *":`0 */${s} * * *`;case"days":return s===1?"0 0 * * *":`0 0 */${s} * *`;case"weeks":return s===1?"0 0 * * 1":`0 0 */${s*7} * *`}}function Hp(t){const e=t.trim();if(e==="* * * * *")return{count:1,unit:"minutes"};if(e==="0 * * * *")return{count:1,unit:"hours"};if(e==="0 0 * * *")return{count:1,unit:"days"};if(e==="0 0 * * 1")return{count:1,unit:"weeks"};const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return{count:parseInt(s[1]),unit:"minutes"};const i=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(i)return{count:parseInt(i[1]),unit:"hours"};const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const n=parseInt(r[1]);return n%7===0?{count:n/7,unit:"weeks"}:{count:n,unit:"days"}}return null}function Wp(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const Up=[{label:"Minute",cron:"* * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function Vp(t){const e=W.c(33),{automationId:s,open:i,onOpenChange:r,onCustomSelect:n,onEventSelect:a}=t,{triggerAdd:l}=Ys(),[h,c]=L.useState(!1),u=i??h;let d;e[0]!==r?(d=I=>{r?r(I):c(I)},e[0]=r,e[1]=d):d=e[1];const f=d;let _;e[2]!==l||e[3]!==s||e[4]!==f?(_=async I=>{try{await l.mutateAsync({automation_id:s,type:"cron",cron_expression:I}),pe.success("Starter added"),f(!1)}catch(R){const S=R,j=S instanceof Error?S.message:"Failed to add starter";pe.error(j)}},e[2]=l,e[3]=s,e[4]=f,e[5]=_):_=e[5];const m=_;let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(os,{asChild:!0,children:o.jsxs(re,{variant:"outline",size:"sm",children:[o.jsx(cs,{size:14}),"Add Starter"]})}),e[6]=p):p=e[6];let g;e[7]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsxs(jh,{className:"gap-2.5",children:[o.jsx(As,{size:14,className:"text-muted-foreground shrink-0"}),"Every..."]}),e[7]=g):g=e[7];let v;e[8]!==l||e[9]!==m?(v=Up.map(I=>o.jsxs(Ct,{className:"gap-2.5",onSelect:()=>m(I.cron),disabled:l.isPending,children:[o.jsx(As,{size:14,className:"text-muted-foreground shrink-0"}),"Every ",I.label]},I.cron)),e[8]=l,e[9]=m,e[10]=v):v=e[10];let b;e[11]!==v?(b=o.jsxs(Eh,{children:[g,o.jsx(Th,{className:"w-[160px]",children:v})]}),e[11]=v,e[12]=b):b=e[12];let y;e[13]!==f||e[14]!==n?(y=()=>{f(!1),n?.()},e[13]=f,e[14]=n,e[15]=y):y=e[15];let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(As,{size:14,className:"text-muted-foreground shrink-0"}),e[16]=x):x=e[16];let w;e[17]!==y?(w=o.jsxs(Ct,{className:"gap-2.5",onSelect:y,children:[x,"Custom (cron)"]}),e[17]=y,e[18]=w):w=e[18];let k;e[19]!==f||e[20]!==a?(k=()=>{f(!1),a?.()},e[19]=f,e[20]=a,e[21]=k):k=e[21];let C;e[22]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(Fs,{size:14,className:"text-muted-foreground shrink-0"}),e[22]=C):C=e[22];let D;e[23]!==k?(D=o.jsxs(Ct,{className:"gap-2.5",onSelect:k,children:[C,"Event"]}),e[23]=k,e[24]=D):D=e[24];let T;e[25]!==D||e[26]!==b||e[27]!==w?(T=o.jsxs(as,{align:"end",className:"w-[200px]",children:[b,w,D]}),e[25]=D,e[26]=b,e[27]=w,e[28]=T):T=e[28];let B;return e[29]!==f||e[30]!==u||e[31]!==T?(B=o.jsxs(ns,{open:u,onOpenChange:f,children:[p,T]}),e[29]=f,e[30]=u,e[31]=T,e[32]=B):B=e[32],B}function Kp(t){const e=W.c(60),{trigger:s,automationId:i,connectionName:r}=t,{triggerAdd:n,triggerRemove:a}=Ys(),[l,h]=L.useState(!1);let c;e[0]!==s.cron_expression?(c=s.cron_expression?Hp(s.cron_expression):null,e[0]=s.cron_expression,e[1]=c):c=e[1];const u=c,[d,f]=L.useState(u?.count??1),[_,m]=L.useState(!1),[p,g]=L.useState(s.cron_expression??""),v=a.isPending||n.isPending,b=s.type==="cron";let y;e[2]!==i||e[3]!==a||e[4]!==s.id?(y=async()=>{try{await a.mutateAsync({trigger_id:s.id,automation_id:i}),pe.success("Starter removed")}catch{pe.error("Failed to remove starter")}h(!1)},e[2]=i,e[3]=a,e[4]=s.id,e[5]=y):y=e[5];const x=y;let w;e[6]!==n||e[7]!==i||e[8]!==p||e[9]!==a||e[10]!==s.cron_expression||e[11]!==s.id?(w=async()=>{const U=p.trim();if(!U||!Ls(U)||U===s.cron_expression){m(!1),g(s.cron_expression??"");return}try{await n.mutateAsync({automation_id:i,type:"cron",cron_expression:U}),await a.mutateAsync({trigger_id:s.id,automation_id:i}),m(!1)}catch{pe.error("Failed to update starter"),g(s.cron_expression??""),m(!1)}},e[6]=n,e[7]=i,e[8]=p,e[9]=a,e[10]=s.cron_expression,e[11]=s.id,e[12]=w):w=e[12];const k=w;let C;e[13]!==n||e[14]!==i||e[15]!==u||e[16]!==a||e[17]!==s.cron_expression||e[18]!==s.id?(C=async U=>{if(!u)return;const K=Math.max(1,U),Q=Fp(K,u.unit);if(Q!==s.cron_expression)try{await n.mutateAsync({automation_id:i,type:"cron",cron_expression:Q}),await a.mutateAsync({trigger_id:s.id,automation_id:i})}catch{pe.error("Failed to update starter"),f(u.count)}},e[13]=n,e[14]=i,e[15]=u,e[16]=a,e[17]=s.cron_expression,e[18]=s.id,e[19]=C):C=e[19];const D=C;let T;e[20]!==b?(T=b?o.jsx(As,{size:14,className:"text-muted-foreground shrink-0"}):o.jsx(Fs,{size:14,className:"text-muted-foreground shrink-0"}),e[20]=b,e[21]=T):T=e[21];let B;e[22]!==r||e[23]!==d||e[24]!==p||e[25]!==D||e[26]!==k||e[27]!==u||e[28]!==b||e[29]!==_||e[30]!==v||e[31]!==s.cron_expression||e[32]!==s.event_type||e[33]!==s.params?(B=u&&b?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Every"}),o.jsx("input",{type:"number",min:1,value:d,onChange:U=>f(parseInt(U.target.value)||1),onBlur:()=>D(d),onKeyDown:U=>{U.key==="Enter"&&U.target.blur(),U.key==="Escape"&&f(u.count)},disabled:v,className:"w-12 text-center text-sm h-7 border border-border rounded-md bg-background px-1 focus:outline-none focus:ring-1 focus:ring-ring"}),o.jsx("span",{className:"text-sm",children:Wp(u.unit,d)})]}):b&&_?o.jsxs(o.Fragment,{children:[o.jsx("input",{type:"text",value:p,onChange:U=>g(U.target.value),onBlur:k,onKeyDown:U=>{U.key==="Enter"&&U.target.blur(),U.key==="Escape"&&(m(!1),g(s.cron_expression??""))},className:"flex-1 text-sm font-mono bg-transparent outline-none",autoFocus:!0}),p&&!Ls(p)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"})]}):o.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-mono text-xs text-muted-foreground truncate",children:b?$p(s.cron_expression??""):`${s.event_type}${r?` · ${r}`:""}`}),!b&&s.params&&Object.keys(s.params).length>0&&o.jsx("span",{className:"text-xs text-muted-foreground/60 truncate",children:Object.entries(s.params).map(qp).join(", ")})]}),e[22]=r,e[23]=d,e[24]=p,e[25]=D,e[26]=k,e[27]=u,e[28]=b,e[29]=_,e[30]=v,e[31]=s.cron_expression,e[32]=s.event_type,e[33]=s.params,e[34]=B):B=e[34];let I;e[35]!==v?(I=v&&o.jsx(Re,{size:13,className:"animate-spin text-muted-foreground"}),e[35]=v,e[36]=I):I=e[36];let R;e[37]!==u||e[38]!==b||e[39]!==_||e[40]!==s.cron_expression?(R=b&&!u&&!_&&o.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{g(s.cron_expression??""),m(!0)},children:o.jsx(ph,{size:13,className:"text-muted-foreground"})}),e[37]=u,e[38]=b,e[39]=_,e[40]=s.cron_expression,e[41]=R):R=e[41];let S;e[42]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>h(!0),children:o.jsx(ls,{size:13,className:"text-muted-foreground"})}),e[42]=S):S=e[42];let j;e[43]!==I||e[44]!==R?(j=o.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[I,R,S]}),e[43]=I,e[44]=R,e[45]=j):j=e[45];let E;e[46]!==j||e[47]!==T||e[48]!==B?(E=o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[T,B,j]}),e[46]=j,e[47]=T,e[48]=B,e[49]=E):E=e[49];let N;e[50]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsxs(ya,{children:[o.jsx(wa,{children:"Remove Starter"}),o.jsx(Ca,{children:"Are you sure you want to remove this starter?"})]}),e[50]=N):N=e[50];let P;e[51]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(Na,{children:"Cancel"}),e[51]=P):P=e[51];let M;e[52]!==x?(M=o.jsxs(Sa,{children:[N,o.jsxs(ka,{children:[P,o.jsx(ja,{onClick:x,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),e[52]=x,e[53]=M):M=e[53];let H;e[54]!==l||e[55]!==M?(H=o.jsx(ba,{open:l,onOpenChange:h,children:M}),e[54]=l,e[55]=M,e[56]=H):H=e[56];let V;return e[57]!==E||e[58]!==H?(V=o.jsxs(o.Fragment,{children:[E,H]}),e[57]=E,e[58]=H,e[59]=V):V=e[59],V}function qp(t){const[e,s]=t;return`${e}: ${s}`}function Gp(t,e){switch(e.type){case"accumulate":{const s=t??{start:e.now,fields:new Set,saveCount:0},i=new Set(s.fields);for(const r of e.fields)i.add(r);return{...s,fields:i,saveCount:s.saveCount+1}}case"reset":return null}}function Yp(t){const e=W.c(55),{automationId:s,onDone:i}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={binding:"TRIGGER"},e[0]=r):r=e[0];const n=Ai(r),[a,l]=L.useState(),[h,c]=L.useState();let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u={},e[1]=u):u=e[1];const[d,f]=L.useState(u),{triggerAdd:_}=Ys(),{data:m,isLoading:p}=Ih(a);let g,v,b,y,x,w;if(e[2]!==_||e[3]!==s||e[4]!==a||e[5]!==h||e[6]!==p||e[7]!==i||e[8]!==d||e[9]!==n||e[10]!==m){const D=m?.find(M=>M.type===h);let T;e[17]!==_||e[18]!==s||e[19]!==a||e[20]!==h||e[21]!==i||e[22]!==d?(T=async()=>{if(!(!a||!h))try{await _.mutateAsync({automation_id:s,type:"event",event_type:h,connection_id:a,params:d}),we("automation_trigger_added",{automation_id:s,trigger_type:"event",connection_id:a,event_type:h}),pe.success("Event trigger added"),i()}catch{pe.error("Failed to add event trigger")}},e[17]=_,e[18]=s,e[19]=a,e[20]=h,e[21]=i,e[22]=d,e[23]=T):T=e[23],g=T,v="flex flex-col gap-3 px-3 py-3 rounded-lg border border-border bg-background";let B,I;e[24]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(Fs,{size:14,className:"text-muted-foreground shrink-0"}),B=o.jsx("span",{className:"text-sm font-medium",children:"Event trigger"}),e[24]=B,e[25]=I):(B=e[24],I=e[25]);let R;e[26]===Symbol.for("react.memo_cache_sentinel")?(R=o.jsx(ls,{size:13}),e[26]=R):R=e[26],e[27]!==i?(b=o.jsxs("div",{className:"flex items-center gap-2",children:[I,B,o.jsx("button",{type:"button",className:"ml-auto shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground",onClick:i,children:R})]}),e[27]=i,e[28]=b):b=e[28];const S=a??"";let j;e[29]===Symbol.for("react.memo_cache_sentinel")?(j=M=>{l(M),c(void 0),f({})},e[29]=j):j=e[29];let E;e[30]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(ss,{className:"w-full",children:o.jsx(is,{placeholder:"Select connection..."})}),e[30]=E):E=e[30];let N;e[31]!==n?(N=n.length===0?o.jsx("div",{className:"px-2 py-3 text-center text-xs text-muted-foreground",children:"No connections with trigger support"}):n.map(Zp),e[31]=n,e[32]=N):N=e[32];let P;e[33]!==N?(P=o.jsx(rs,{children:N}),e[33]=N,e[34]=P):P=e[34],e[35]!==S||e[36]!==P?(y=o.jsxs(ts,{value:S,onValueChange:j,children:[E,P]}),e[35]=S,e[36]=P,e[37]=y):y=e[37],e[38]!==a||e[39]!==h||e[40]!==p||e[41]!==m?(x=a&&o.jsxs(ts,{value:h??"",onValueChange:M=>{c(M),f({})},children:[o.jsx(ss,{className:"w-full",children:p?o.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx(Re,{size:13,className:"animate-spin"}),"Loading events..."]}):o.jsx(is,{placeholder:"Select event type...",children:h??"Select event type..."})}),o.jsx(rs,{children:m?.map(Jp)})]}),e[38]=a,e[39]=h,e[40]=p,e[41]=m,e[42]=x):x=e[42],w=D?.paramsSchema&&Object.keys(D.paramsSchema).length>0&&o.jsx("div",{className:"flex flex-col gap-2",children:Object.entries(D.paramsSchema).map(M=>{const[H,V]=M;return o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsxs("label",{className:"text-xs text-muted-foreground",children:[H,V.description&&o.jsxs("span",{className:"text-muted-foreground/60",children:[" ","— ",V.description]})]}),V.enum?o.jsxs(ts,{value:d[H]??"",onValueChange:U=>f(K=>({...K,[H]:U})),children:[o.jsx(ss,{className:"w-full",children:o.jsx(is,{placeholder:`Select ${H}...`})}),o.jsx(rs,{children:V.enum.map(Xp)})]}):o.jsx("input",{type:"text",value:d[H]??"",onChange:U=>f(K=>({...K,[H]:U.target.value})),placeholder:V.description??H,className:"text-sm border border-border rounded-md bg-background px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-ring"})]},H)})}),e[2]=_,e[3]=s,e[4]=a,e[5]=h,e[6]=p,e[7]=i,e[8]=d,e[9]=n,e[10]=m,e[11]=g,e[12]=v,e[13]=b,e[14]=y,e[15]=x,e[16]=w}else g=e[11],v=e[12],b=e[13],y=e[14],x=e[15],w=e[16];let k;e[43]!==_||e[44]!==a||e[45]!==h||e[46]!==g?(k=a&&h&&o.jsx(re,{size:"sm",onClick:g,disabled:_.isPending,children:_.isPending?o.jsx(Re,{size:13,className:"animate-spin"}):"Add trigger"}),e[43]=_,e[44]=a,e[45]=h,e[46]=g,e[47]=k):k=e[47];let C;return e[48]!==v||e[49]!==b||e[50]!==y||e[51]!==x||e[52]!==w||e[53]!==k?(C=o.jsxs("div",{className:v,children:[b,y,x,w,k]}),e[48]=v,e[49]=b,e[50]=y,e[51]=x,e[52]=w,e[53]=k,e[54]=C):C=e[54],C}function Xp(t){return o.jsx(Bt,{value:t,children:t},t)}function Jp(t){return o.jsx(Bt,{value:t.type,children:o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{children:t.type}),o.jsx("span",{className:"text-xs text-muted-foreground",children:t.description})]})},t.type)}function Zp(t){return o.jsx(Bt,{value:t.id,children:t.title},t.id)}function Qp({automationId:t,automation:e,onBack:s,onDelete:i}){const r=e.virtual_mcp_id,{org:n}=xe(),{update:a,triggerAdd:l}=Ys(),h=Ai(),c=new Map(h.map(Z=>[Z.id,Z.title])),{createTaskWithMessage:u}=vt(),{setModel:d,setSimpleModeTier:f,credentialId:_,selectedModel:m}=Ti(),p=Mh(),{setChatOpen:g}=Ii(),{sendMessage:v}=fs(),b=pa(),[y,x]=Gl(),w=e.messages?.[0]?.metadata?.tiptapDoc??void 0,[k,C]=L.useState(w),[D,T]=L.useState(!1),[B,I]=L.useState(!1),[R,S]=L.useState(""),[j,E]=L.useState(!1),[N,P]=L.useState(!1),[M,H]=L.useState(!1),[V,U]=L.useState(!1),K=async()=>{if(N)return;const ge=En(k).filter(Ze=>Ze.type==="text").map(Ze=>Ze.text).join(`
|
|
182
|
-
`);if(ge.trim()){P(!0);try{bt(),we("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:ge.length}),await b(["studio-automation-manager"]),g(!0),await v({tiptapDoc:Oa({managerAgentId:ra.AUTOMATION_MANAGER(n.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:ge})})}finally{P(!1)}}},Q=e.models?.credentialId||_||"",ee=e.models?.thinking?.id||m?.modelId||"",Y=e.models?.tier??"",$=Qo({defaultValues:{name:e.name,active:e.active,credential_id:Q,model_id:ee,tier:Y}}),A=$.watch("active"),O=$.watch("credential_id"),F=$.watch("model_id"),{models:te,isLoading:ae}=zc(O||void 0),ne=te.find(Z=>Z.modelId===F)??null,X=$.watch("tier"),de=["fast","smart","thinking"].find(Z=>p.chat[Z]?.modelId===F&&p.chat[Z]?.keyId===O),fe=X||de||"smart",he=Z=>{const ge=p.chat[Z];ge&&($.setValue("credential_id",ge.keyId,{shouldDirty:!0}),$.setValue("model_id",ge.modelId,{shouldDirty:!0}),$.setValue("tier",Z,{shouldDirty:!0}))},[ue,_e]=L.useReducer(Gp,null),Xe=()=>{ue!==null&&(we("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(ue.fields),save_count:ue.saveCount,edit_duration_ms:Date.now()-ue.start}),_e({type:"reset"}))},He=async()=>{const Z=$.control._formState.dirtyFields,ge=Object.keys(Z);if(ge.length===0&&!V)return!0;const Ze=$.getValues(),vs=Ze.credential_id&&Ze.model_id?Ze.credential_id:"",xs=Ze.credential_id&&Ze.model_id?Ze.model_id:"";vs!==Ze.credential_id&&$.setValue("credential_id",vs),xs!==Ze.model_id&&$.setValue("model_id",xs);const bs=$.getValues(),Ol=$.control._defaultValues;$.reset(bs,{keepValues:!0});const Cn=V;U(!1);const kn=p.enabled?bs.tier||de:bs.tier||void 0,zl={id:t,name:bs.name,active:bs.active,models:{credentialId:vs,thinking:{id:xs},...kn?{tier:kn}:{}},messages:oc(k),temperature:0};try{await a.mutateAsync(zl)}catch{return $.reset(Ol,{keepValues:!0}),Cn&&U(!0),!1}const Nn=[...ge];return Cn&&Nn.push("messages"),_e({type:"accumulate",now:Date.now(),fields:Nn}),je(),!0},{schedule:Je,flush:it}=bi({save:He}),{schedule:je,flush:bt}=bi({delayMs:3e4,save:async()=>Xe()});L.useEffect(()=>{const Z=$.watch(()=>Je());return()=>Z.unsubscribe()},[]);const G=Z=>{if(C(Z),!M){H(!0);return}U(!0),Je()},ie=async()=>{we("automation_test_clicked",{automation_id:t,agent_id:r});const Z=await it();if(bt(),!Z)return;if(!k){pe.error("No instructions configured for this automation");return}p.enabled?f(fe):ne&&O&&d({...ne,keyId:O}),g(!0),x({...y,toolApprovalLevel:"auto"});const ge=En(k);u({message:{tiptapDoc:k,parts:ge},virtualMcpId:r||void 0})};return o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(re,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(Ia,{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(Ft,{control:$.control,name:"name",render:({field:Z})=>o.jsx(_s,{...Z,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"}})}),i&&o.jsx(re,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:i,children:o.jsx(gr,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ft,{control:$.control,name:"active",render:({field:Z})=>o.jsx(pr,{checked:Z.value,onCheckedChange:ge=>{Z.onChange(ge),it()},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:A?"Active":"Inactive"}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(ga,{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(Vp,{automationId:t,open:D,onOpenChange:T,onCustomSelect:()=>{I(!0),E(!1),S("")},onEventSelect:()=>{E(!0),I(!1)}})]}),e.triggers.length===0&&!B?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:()=>T(!0),children:"Add a starter"})," ","to get going."]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(Z=>o.jsx(Kp,{trigger:Z,automationId:t,connectionName:Z.connection_id?c.get(Z.connection_id):void 0},Z.id))}),B&&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(As,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:R,onChange:Z=>S(Z.target.value),onBlur:async()=>{const Z=R.trim();if(!(!Z||!Ls(Z)))try{await l.mutateAsync({automation_id:t,type:"cron",cron_expression:Z}),we("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),pe.success("Starter added"),I(!1),S("")}catch{pe.error("Failed to add starter")}},onKeyDown:async Z=>{const ge=R.trim();Z.key==="Enter"&&ge&&Ls(ge)&&Z.target.blur(),Z.key==="Escape"&&(I(!1),S(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),R&&!Ls(R)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),l.isPending&&o.jsx(Re,{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:()=>{I(!1),S("")},children:o.jsx(ls,{size:13})})]}),j&&o.jsx(L.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(Re,{size:13,className:"animate-spin text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:o.jsx(Yp,{automationId:t,onDone:()=>E(!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(re,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:N||!k,onClick:K,children:[o.jsx(Da,{size:13}),"Improve"]})]}),o.jsx(tc,{tiptapDoc:k,setTiptapDoc:G,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(sc,{virtualMcpId:r||null,className:"max-h-[45vh]"}),o.jsxs("div",{className:"flex items-center justify-end gap-1.5 p-2.5",children:[p.enabled?o.jsx(ic,{tier:fe,onSelect:he}):o.jsx(Rh,{model:ne,isLoading:ae,credentialId:O||null,onCredentialChange:Z=>{$.setValue("credential_id",Z??"",{shouldDirty:!0}),$.setValue("model_id","",{shouldDirty:!0}),$.setValue("tier","",{shouldDirty:!0})},onModelChange:Z=>{$.setValue("model_id",Z.modelId,{shouldDirty:!0}),$.setValue("tier","",{shouldDirty:!0})},placeholder:"Model"}),o.jsxs(Ve,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(re,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:ie,disabled:!r,children:[o.jsx(fc,{size:16}),"Test"]})}),o.jsx(qe,{children:"Test Automation"})]})]})]})})]})]})]})}function eg(t){const e=W.c(5),{tabId:s}=t;let i;e[0]!==s?(i=oa(s),e[0]=s,e[1]=i):i=e[1];const r=i;if(!r)return null;let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Re,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=n):n=e[2];let a;return e[3]!==r.id?(a=o.jsx(ct,{children:o.jsx(ct.Content,{children:o.jsx(ct.Body,{children:o.jsx(L.Suspense,{fallback:n,children:o.jsx(tg,{id:r.id})})})})}),e[3]=r.id,e[4]=a):a=e[4],a}function tg(t){const e=W.c(8),{id:s}=t,i=Pt(),{data:r,isLoading:n}=Ah(s);let a;e[0]!==i?(a=()=>i({to:".",search:sg,replace:!0}),e[0]=i,e[1]=a):a=e[1];const l=a;if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Re,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=c):c=e[2],c}if(!r){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=c):c=e[3],c}let h;return e[4]!==r||e[5]!==s||e[6]!==l?(h=o.jsx(Qp,{automationId:s,automation:r,onBack:l}),e[4]=r,e[5]=s,e[6]=l,e[7]=h):h=e[7],h}function sg(t){return{...t,main:"automations"}}function ig(t){const e=W.c(20),{virtualMcpId:s}=t,i=Pt(),{data:r}=Bh(s),n=r===void 0?[]:r,{create:a}=Ys(),{selectedModel:l,credentialId:h}=Ti(),[c,u]=L.useState(""),d=c.toLowerCase(),f=n.filter(R=>R.name.toLowerCase().includes(d));let _;e[0]!==i?(_=R=>i({to:".",search:S=>({...S,main:"automation:"+R}),replace:!0}),e[0]=i,e[1]=_):_=e[1];const m=_,p=async()=>{if(a.isPending)return;we("automation_new_clicked",{virtual_mcp_id:s,existing_count:n.length});const R=l?.modelId&&h?{credentialId:h,modelId:l.modelId}:null,S=await a.mutateAsync(Lh(s,R));m(S.id)},g=ct,v=ct,b=ct;let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(ct.Title,{children:"Automations"}),e[2]=y):y=e[2];const x=n.length>0&&o.jsx(Oh,{value:c,onChange:u,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(cs,{size:14}),e[3]=w):w=e[3];let k;e[4]!==a.isPending||e[5]!==p?(k=o.jsxs(re,{size:"sm",onClick:p,disabled:a.isPending,children:[w,"New automation"]}),e[4]=a.isPending,e[5]=p,e[6]=k):k=e[6];let C;e[7]!==x||e[8]!==k?(C=o.jsxs("div",{className:"flex flex-col gap-6",children:[y,o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[x,k]})]}),e[7]=x,e[8]=k,e[9]=C):C=e[9];const D=n.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx($s,{image:o.jsx(Fs,{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(re,{size:"sm",onClick:p,disabled:a.isPending,children:[o.jsx(cs,{size:14}),"New automation"]})})}):f.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx($s,{image:o.jsx(Fs,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${c}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:f.map(R=>o.jsx(Ph,{automation:R,onClick:()=>m(R.id)},R.id))});let T;e[10]!==D||e[11]!==b.Body||e[12]!==C?(T=o.jsxs(b.Body,{children:[C,D]}),e[10]=D,e[11]=b.Body,e[12]=C,e[13]=T):T=e[13];let B;e[14]!==T||e[15]!==v.Content?(B=o.jsx(v.Content,{children:T}),e[14]=T,e[15]=v.Content,e[16]=B):B=e[16];let I;return e[17]!==g||e[18]!==B?(I=o.jsx(g,{children:B}),e[17]=g,e[18]=B,e[19]=I):I=e[19],I}function rg(t){const e=W.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(Re,{size:20,className:"animate-spin text-muted-foreground"})}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx(L.Suspense,{fallback:i,children:o.jsx(ig,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}const Vo=L.lazy(()=>Yl(()=>import("./project-app-view-BWIUYPZS.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,56,57])).then(t=>({default:t.AppViewContent})));function Pl(t){const e=W.c(43),{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}=La(r);if(xc(n)){let m;return e[3]!==i?(m=o.jsx(Gn,{virtualMcpId:i}),e[3]=i,e[4]=m):m=e[4],m}if(n==="git"){let m;return e[5]!==i?(m=o.jsx(Ou,{virtualMcpId:i}),e[5]=i,e[6]=m):m=e[6],m}if(n==="automations"){let m;return e[7]!==i?(m=o.jsx(rg,{virtualMcpId:i}),e[7]=i,e[8]=m):m=e[8],m}if(n==="env"){let m;return e[9]!==i?(m=o.jsx(zp,{virtualMcpId:i}),e[9]=i,e[10]=m):m=e[10],m}if(n==="preview"){let m;return e[11]!==i?(m=o.jsx(Sf,{virtualMcpId:i}),e[11]=i,e[12]=m):m=e[12],m}if(h){let m;return e[13]!==n?(m=o.jsx(eg,{tabId:n}),e[13]=n,e[14]=m):m=e[14],m}let c;e[15]!==n?(c=bc(n),e[15]=n,e[16]=c):c=e[16];const u=c;if(u){let m;if(e[17]!==l||e[18]!==u.connectionId||e[19]!==u.toolName){let y;e[21]!==u.connectionId||e[22]!==u.toolName?(y=x=>x.appId===u.connectionId&&x.toolName===u.toolName,e[21]=u.connectionId,e[22]=u.toolName,e[23]=y):y=e[23],m=l.find(y),e[17]=l,e[18]=u.connectionId,e[19]=u.toolName,e[20]=m}else m=e[20];const p=m;let g;e[24]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Re,{size:20,className:"animate-spin text-muted-foreground"})}),e[24]=g):g=e[24];const v=p?.args;let b;return e[25]!==n||e[26]!==u.connectionId||e[27]!==u.toolName||e[28]!==v?(b=o.jsx(L.Suspense,{fallback:g,children:o.jsx(Vo,{connectionId:u.connectionId,toolName:u.toolName,args:v},n)}),e[25]=n,e[26]=u.connectionId,e[27]=u.toolName,e[28]=v,e[29]=b):b=e[29],b}let d;if(e[30]!==n||e[31]!==a){let m;e[33]!==n?(m=p=>p.id===n,e[33]=n,e[34]=m):m=e[34],d=a.find(m),e[30]=n,e[31]=a,e[32]=d}else d=e[32];const f=d;if(f){let m;e[35]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Re,{size:20,className:"animate-spin text-muted-foreground"})}),e[35]=m):m=e[35];let p;return e[36]!==n||e[37]!==f.id||e[38]!==f.view.appId||e[39]!==f.view.args?(p=o.jsx(L.Suspense,{fallback:m,children:o.jsx(Vo,{connectionId:f.view.appId,toolName:f.id,args:f.view.args},n)}),e[36]=n,e[37]=f.id,e[38]=f.view.appId,e[39]=f.view.args,e[40]=p):p=e[40],p}let _;return e[41]!==i?(_=o.jsx(Gn,{virtualMcpId:i}),e[41]=i,e[42]=_):_=e[42],_}function ng(t){const e=W.c(7),{children:s,defaultSize:i}=t,[,r]=L.useTransition();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=sa.decoChatPanelWidth(),e[0]=n):n=e[0];const[a,l]=ta(n,45),h=i>0&&i<100?a:i;let c;e[1]!==l?(c=f=>r(()=>{f>0&&f<100&&l(f)}),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(_a,{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 og(t){const e=W.c(30),{virtualMcpId:s,taskId:i,chatOpen:r,mainOpen:n,chatContent:a}=t;let l;e[0]!==r||e[1]!==n?(l=Ln(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=sa.decoChatPanelWidth(),e[3]=c):c=e[3];const[u]=ta(c,45),d=L.useRef(null);let f,_;e[4]!==r||e[5]!==n||e[6]!==u?(f=()=>{const B=d.current;if(!B)return;const I=Ln(r,n),R=I.chat>0&&I.chat<100?u:I.chat,S=I.chat>0&&I.chat<100?100-u:I.main;B.setLayout([R,S])},_=[r,n,u],e[4]=r,e[5]=n,e[6]=u,e[7]=f,e[8]=_):(f=e[7],_=e[8]),L.useEffect(f,_);const m=`${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(Aa,{}),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(ng,{defaultSize:h.chat,children:v}),e[14]=h.chat,e[15]=v,e[16]=b):b=e[16];let y;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(ih,{className:"bg-sidebar"}),e[17]=y):y=e[17];const x=h.main;let w;e[18]===Symbol.for("react.memo_cache_sentinel")?(w={overflow:"visible"},e[18]=w):w=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=se("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 C;e[20]!==i||e[21]!==s?(C=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(It,{children:o.jsx(Pl,{taskId:i,virtualMcpId:s})})})})}),e[20]=i,e[21]=s,e[22]=C):C=e[22];let D;e[23]!==h.main||e[24]!==C?(D=o.jsx(_a,{className:"min-w-0 flex flex-col",order:2,defaultSize:x,style:w,collapsible:!0,collapsedSize:0,minSize:20,children:C}),e[23]=h.main,e[24]=C,e[25]=D):D=e[25];let T;return e[26]!==D||e[27]!==m||e[28]!==b?(T=o.jsxs(rh,{ref:d,direction:"horizontal",className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",style:p,children:[b,y,D]},m),e[26]=D,e[27]=m,e[28]=b,e[29]=T):T=e[29],T}const ur="flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",Ko="bg-sidebar-accent text-sidebar-foreground",fr="text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";function ag(t){const e=W.c(47),{chatOpen:s,toggleChat:i,onNewTask:r}=t,{tasksOpen:n,toggleTasks:a}=$c(),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?Ko:fr;let u;e[3]!==c?(u=se(ur,c),e[3]=c,e[4]=u):u=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Pc,{size:16}),e[5]=d):d=e[5];let f;e[6]!==h||e[7]!==u||e[8]!==n?(f=o.jsx(Ke,{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]=f):f=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(qe,{side:"bottom",children:"Tasks"}),e[10]=_):_=e[10];let m;e[11]!==f?(m=o.jsxs(Ve,{delayDuration:300,children:[f,_]}),e[11]=f,e[12]=m):m=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?Ko:fr;let v;e[16]!==g?(v=se(ur,g),e[16]=g,e[17]=v):v=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(ua,{size:16}),e[18]=b):b=e[18];let y;e[19]!==s||e[20]!==v||e[21]!==p?(y=o.jsx(Ke,{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]=y):y=e[22];let x;e[23]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(qe,{side:"bottom",children:"Chat"}),e[23]=x):x=e[23];let w;e[24]!==y?(w=o.jsxs(Ve,{delayDuration:300,children:[y,x]}),e[24]=y,e[25]=w):w=e[25];const k=l?"grid-cols-[1fr]":"grid-cols-[0fr]";let C;e[26]!==k?(C=se("grid transition-[grid-template-columns] duration-200 ease-[var(--ease-out-quart)]",k),e[26]=k,e[27]=C):C=e[27];const D=!l,T=l?0:-1,B=!l,I=l?"translate-x-0 opacity-100":"-translate-x-2 opacity-0";let R;e[28]!==I?(R=se(ur,fr,"transition-[transform,opacity] duration-200 ease-[var(--ease-out-quart)] will-change-transform",I),e[28]=I,e[29]=R):R=e[29];let S;e[30]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(on,{size:16}),e[30]=S):S=e[30];let j;e[31]!==r||e[32]!==D||e[33]!==T||e[34]!==B||e[35]!==R?(j=o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button",onClick:r,disabled:D,tabIndex:T,"aria-hidden":B,className:R,children:S})}),e[31]=r,e[32]=D,e[33]=T,e[34]=B,e[35]=R,e[36]=j):j=e[36];let E;e[37]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(qe,{side:"bottom",children:"New task"}),e[37]=E):E=e[37];let N;e[38]!==j?(N=o.jsx("div",{className:"overflow-hidden",children:o.jsxs(Ve,{delayDuration:300,children:[j,E]})}),e[38]=j,e[39]=N):N=e[39];let P;e[40]!==C||e[41]!==N?(P=o.jsx("div",{className:C,children:N}),e[40]=C,e[41]=N,e[42]=P):P=e[42];let M;return e[43]!==w||e[44]!==P||e[45]!==m?(M=o.jsxs(o.Fragment,{children:[m,w,P]}),e[43]=w,e[44]=P,e[45]=m,e[46]=M):M=e[46],M}function lg(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 cg(t){const e=W.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=se("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(hg,{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 hg(t){const e=W.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(fa,{className:"size-4"}),e[4]=i):i=e[4],i}function dg(t){const e=W.c(13),{overflow:s,onSelect:i}=t,[r,n]=L.useState(!1);let a;e[0]!==i?(a=f=>{n(!1),i(f)},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(Ks,{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(ca,{className:"size-4"})})}),e[2]=h):h=e[2];let c;if(e[3]!==l||e[4]!==s){let f;e[6]!==l?(f=_=>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(ug,{icon:_.icon})}),o.jsx("span",{className:"truncate",children:_.title})]})},_.id),e[6]=l,e[7]=f):f=e[7],c=s.map(f),e[3]=l,e[4]=s,e[5]=c}else c=e[5];let u;e[8]!==c?(u=o.jsx(qs,{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(Gs,{open:r,onOpenChange:n,children:[h,u]}),e[10]=r,e[11]=u,e[12]=d):d=e[12],d}function ug(t){const e=W.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(fa,{className:"size-4"}),e[4]=i):i=e[4],i}const fg=6;function Ll(t){const e=W.c(20),{virtualMcpId:s,taskId:i}=t,r=Pt();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}=La(n);let u,d,f,_;if(e[3]!==l||e[4]!==h||e[5]!==r||e[6]!==c||e[7]!==a||e[8]!==s){const g=Sc({activeTab:l,mainOpen:h}),v=k=>k.id==="automations"?g:h&&k.id===l,y=a.find(k=>v(k))?.id??null,{visible:x,overflow:w}=lg(a,y,fg);d=w,u=k=>{const C=a.find(T=>T.id===k),D=y===k&&h;if(we("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:k,tab_kind:C?.kind??null,was_active:D}),k==="automations"){const T=yc({activeTab:l,mainOpen:h});r({to:".",search:B=>({...B,main:T}),replace:!0});return}c(k)},f="flex items-center min-w-0 gap-0.5",_=x.map(k=>o.jsx(cg,{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]=f,e[12]=_}else u=e[9],d=e[10],f=e[11],_=e[12];let m;e[13]!==u||e[14]!==d?(m=d.length>0&&o.jsx(dg,{overflow:d,onSelect:u}),e[13]=u,e[14]=d,e[15]=m):m=e[15];let p;return e[16]!==f||e[17]!==_||e[18]!==m?(p=o.jsxs("div",{className:f,children:[_,m]}),e[16]=f,e[17]=_,e[18]=m,e[19]=p):p=e[19],p}function mg(t){const e=W.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=se("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(Xl,{"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 _g(t){const e=W.c(20),{prNumber:s,disabled:i,send:r}=t;let n;e[0]!==s||e[1]!==r?(n=()=>r(ju({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(Nu({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(re,{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(vr,{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(re,{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 f;e[12]!==h?(f=o.jsx(as,{align:"end",children:o.jsx(Ct,{onClick:h,children:"Review"})}),e[12]=h,e[13]=f):f=e[13];let _;e[14]!==d||e[15]!==f?(_=o.jsxs(ns,{children:[d,f]}),e[14]=d,e[15]=f,e[16]=_):_=e[16];let m;return e[17]!==c||e[18]!==_?(m=o.jsxs("div",{className:"inline-flex items-stretch rounded-md",children:[c,_]}),e[17]=c,e[18]=_,e[19]=m):m=e[19],m}const pg=new Set(["failure","timed_out","cancelled","action_required"]);function gg(t){return t.status==="completed"&&pg.has(t.conclusion)}function vg(t){return t.status==="queued"||t.status==="in_progress"}function xg(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"};switch(e.kind){case"initializing":return{label:"Starting sandbox…",disabled:!0,loading:!0,variant:"outline",tooltip:"Waiting for the sandbox daemon to come online"};case"cloning":return{label:"Cloning repo…",disabled:!0,loading:!0,variant:"outline",tooltip:"Cloning the project repository"};case"clone-failed":return{label:"Clone failed",disabled:!0,variant:"outline",tooltip:e.error||"git clone failed — see setup logs"};case"checking-out":return{label:`Switching to ${e.to}…`,disabled:!0,loading:!0,variant:"outline",tooltip:`Checking out ${e.to}`};case"checkout-failed":return{label:"Checkout failed",disabled:!0,variant:"outline",tooltip:e.error||"git checkout failed — see setup logs"}}const a=e;if(a.workingTreeDirty||a.unpushed>0)return{label:"Save changes",action:"commit-and-push",variant:"default",tooltip:"Commit and push local changes"};if(s?.merged)return!!a.headSha&&!!s.headSha&&a.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(a.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 ${a.branch} → ${a.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 c=i.filter(gg).map(f=>f.name);if(c.length>0)return{label:"Fix tests",action:"fix-checks",variant:"default",tooltip:`Failing: ${c.join(", ")}`,meta:{failingChecks:c}};const u=i.filter(vg);if(u.length>0)return{label:"Running tests…",disabled:!0,loading:!0,variant:"outline",tooltip:`Waiting on ${u.length} check${u.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 d=r?.unresolvedConversations??0;return d>0?{label:"Address feedback",action:"resolve-comments",variant:"default",tooltip:`${d} unresolved conversation${d===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 ${a.base}`}}function bg(){return Gt().branchStatus}const Sg=6e4,yg=3e4;function wg(t){const e=W.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=Fe(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:Sg,refetchIntervalInBackground:!1,staleTime:yg,select:Cg},e[8]=i,e[9]=n,e[10]=a,e[11]=l):l=e[11],ms(l)}function Cg(t){const e=Xs(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 kg(t){const e=W.c(42),{virtualMcpId:s}=t,{org:i}=xe(),r=kt(s),{currentBranch:n}=vt(),a=fs(),l=r?.metadata?.githubRepo??null,h=bg(),c=l?.connectionId??"",u=l?.owner??"",d=l?.name??"",f=n??null;let _;e[0]!==i.id||e[1]!==i.slug||e[2]!==c||e[3]!==u||e[4]!==d||e[5]!==f?(_={orgId:i.id,orgSlug:i.slug,connectionId:c,owner:u,repo:d,branch:f},e[0]=i.id,e[1]=i.slug,e[2]=c,e[3]=u,e[4]=d,e[5]=f,e[6]=_):_=e[6];const m=$a(_),p=m.data??null,g=l?.connectionId??"",v=l?.owner??"",b=l?.name??"",y=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]!==y?(x={orgId:i.id,orgSlug:i.slug,connectionId:g,owner:v,repo:b,prNumber:y},e[7]=i.id,e[8]=i.slug,e[9]=g,e[10]=v,e[11]=b,e[12]=y,e[13]=x):x=e[13];const w=Ha(x),k=l?.connectionId??"",C=l?.owner??"",D=l?.name??"",T=p&&p.state==="open"?p.number:null;let B;e[14]!==i.id||e[15]!==i.slug||e[16]!==k||e[17]!==C||e[18]!==D||e[19]!==T?(B={orgId:i.id,orgSlug:i.slug,connectionId:k,owner:C,repo:D,prNumber:T},e[14]=i.id,e[15]=i.slug,e[16]=k,e[17]=C,e[18]=D,e[19]=T,e[20]=B):B=e[20];const I=wg(B);if(!l?.connectionId||!n)return null;let R;e[21]!==h||e[22]!==w.data||e[23]!==p||e[24]!==m.isPending||e[25]!==I.data?(R=xg({branchStatus:h,pr:p,checks:w.data??[],reviews:I.data??null,loading:m.isPending}),e[21]=h,e[22]=w.data,e[23]=p,e[24]=m.isPending,e[25]=I.data,e[26]=R):R=e[26];const S=R;let j;e[27]!==a?(j=K=>a.sendMessage({parts:[{type:"text",text:K}]}),e[27]=a,e[28]=j):j=e[28];const E=j,N=a.isStreaming;let P;e[29]!==n||e[30]!==S||e[31]!==N||e[32]!==p||e[33]!==E?(P=K=>{if(!N)switch(K){case"commit-and-push":{E(vu({branch:n}));return}case"create-pr":{E(xu({branch:n}));return}case"reopen":{p&&E(bu({prNumber:p.number}));return}case"rebase":{E(Su({branch:n}));return}case"fix-checks":{p&&E(wu({prNumber:p.number,failingChecks:S.meta?.failingChecks??[]}));return}case"mark-ready":{p&&E(Cu({prNumber:p.number}));return}case"resolve-comments":{p&&E(ku({prNumber:p.number}));return}case"merge-split":return}},e[29]=n,e[30]=S,e[31]=N,e[32]=p,e[33]=E,e[34]=P):P=e[34];const M=P;let H;e[35]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(mg,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-5"}),e[35]=H):H=e[35];const V=p?.number;let U;return e[36]!==S||e[37]!==N||e[38]!==M||e[39]!==E||e[40]!==V?(U=o.jsxs(o.Fragment,{children:[H,o.jsx(Ng,{button:S,isStreaming:N,onActivate:M,prNumber:V,send:E})]}),e[36]=S,e[37]=N,e[38]=M,e[39]=E,e[40]=V,e[41]=U):U=e[41],U}function Ng(t){const e=W.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(_g,{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(qo,{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(Nh,{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(re,{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(qo,{label:n,children:h}),e[18]=h,e[19]=n,e[20]=c):c=e[20],c}function qo(t){const e=W.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(Ke,{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(qe,{children:s}),e[4]=s,e[5]=n):n=e[5];let a;return e[6]!==r||e[7]!==n?(a=o.jsx(Jc,{children:o.jsxs(Ve,{children:[r,n]})}),e[6]=r,e[7]=n,e[8]=a):a=e[8],a}function jg(t){const e=W.c(2),{virtualMcp:s}=t;if(!!!(s.metadata?.githubRepo??null)?.connectionId)return null;let n;return e[0]!==s.id?(n=o.jsx(_r.Right,{children:o.jsx(kg,{virtualMcpId:s.id})}),e[0]=s.id,e[1]=n):n=e[1],n}const Qt=L.createContext(null);function wn(){return L.use(Qt)}function Go(t){const e=W.c(7),{children:s}=t,{taskId:i}=vt();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(Aa,{}),e[2]=s,e[3]=a):a=e[3];let l;return e[4]!==a||e[5]!==i?(l=o.jsx(It,{fallback:r,children:o.jsx(L.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 Yo(t){const e=W.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],L.useLayoutEffect(r),null}function Eg(t){const e=W.c(23),{onOpenSidebar:s,virtualMcpId:i,taskId:r,mainOpen:n,onToggleMain:a,onNewTask:l}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(lc,{size:20}),e[0]=h):h=e[0];let c;e[1]!==s?(c=o.jsx("button",{type:"button",onClick:s,className:"flex size-8 shrink-0 items-center justify-center rounded-md text-foreground/60 hover:bg-accent hover:text-foreground transition-colors","aria-label":"Open menu",children:h}),e[1]=s,e[2]=c):c=e[2];let u;e[3]!==r||e[4]!==i?(u=o.jsx("div",{className:"flex-1 min-w-0 overflow-x-auto [scrollbar-width:none]",children:o.jsx(Ll,{virtualMcpId:i,taskId:r})}),e[3]=r,e[4]=i,e[5]=u):u=e[5];const d=!n,f=n?"text-foreground/60 hover:bg-accent hover:text-foreground":"bg-accent text-foreground";let _;e[6]!==f?(_=se("flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",f),e[6]=f,e[7]=_):_=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(ua,{size:16}),e[8]=m):m=e[8];let p;e[9]!==a||e[10]!==d||e[11]!==_?(p=o.jsx("button",{type:"button",onClick:a,"aria-pressed":d,className:_,title:"Chat",children:m}),e[9]=a,e[10]=d,e[11]=_,e[12]=p):p=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(on,{size:16}),e[13]=g):g=e[13];let v;e[14]!==l?(v=o.jsx("button",{type:"button",onClick:l,className:"flex size-7 shrink-0 items-center justify-center rounded-md text-foreground/60 hover:bg-accent hover:text-foreground transition-colors",title:"New task",children:g}),e[14]=l,e[15]=v):v=e[15];let b;e[16]!==v||e[17]!==p?(b=o.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[p,v]}),e[16]=v,e[17]=p,e[18]=b):b=e[18];let y;return e[19]!==b||e[20]!==c||e[21]!==u?(y=o.jsxs("div",{className:"shrink-0 flex items-center gap-1 px-2 h-12 bg-background border-b border-border",children:[c,u,b]}),e[19]=b,e[20]=c,e[21]=u,e[22]=y):y=e[22],y}function Xo(t){const e=W.c(16),{virtualMcpId:s,hasActiveGithubRepo:i,vmMap:r,children:n}=t,{org:a}=xe(),{currentBranch:l}=vt(),{data:h}=Ei.useSession(),c=h?.user?.id;let u;e[0]!==a.id||e[1]!==a.slug?(u={connectionId:Lt,orgId:a.id,orgSlug:a.slug},e[0]=a.id,e[1]=a.slug,e[2]=u):u=e[2];const d=Fe(u),{mutate:f}=hn(d);let _;e[3]===Symbol.for("react.memo_cache_sentinel")?(_=new Set,e[3]=_):_=e[3];const m=L.useRef(_);let p,g;e[4]!==l||e[5]!==i||e[6]!==f||e[7]!==c||e[8]!==s||e[9]!==r?(p=()=>{if(i&&c&&l){if(r?.[c]?.[l]){m.current.add(l);return}m.current.has(l)||(m.current.add(l),f({virtualMcpId:s,branch:l},{onError:Tg}))}},g=[i,c,l,r,s,f],e[4]=l,e[5]=i,e[6]=f,e[7]=c,e[8]=s,e[9]=r,e[10]=p,e[11]=g):(p=e[10],g=e[11]),L.useEffect(p,g);const v=l??null;let b;return e[12]!==n||e[13]!==v||e[14]!==s?(b=o.jsx(Qu,{virtualMcpId:s,branch:v,children:n}),e[12]=n,e[13]=v,e[14]=s,e[15]=b):b=e[15],b}function Tg(t){console.error("[auto-start-vm] failed:",t)}function Dg(){const t=W.c(107),e=ma(),s=Pt(),{org:i}=xe(),r=Fc()?.tasksOpen??!1;Zc(i.slug);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const a=Jl(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=sn(h);let u;t[2]!==i.id||t[3]!==c.virtualmcpid?(u=c.virtualmcpid??ia(i.id).id,t[2]=i.id,t[3]=c.virtualmcpid,t[4]=u):u=t[4];const d=u,f=Fh(a.taskId??"",d),_=kt(d),m=_?.metadata?.ui?.layout??null;let p;t[5]!==m?(p=m?{defaultMainView:m.defaultMainView??null,chatDefaultOpen:m.chatDefaultOpen??null}:null,t[5]=m,t[6]=p):p=t[6];const g=p;let v;t[7]!==_?(v=_&&Kt(_),t[7]=_,t[8]=v):v=t[8];const b=!!v;let y;t[9]!==l||t[10]!==d?(y={virtualMcpId:d,orgSlug:l,isAgentRoute:!0},t[9]=l,t[10]=d,t[11]=y):y=t[11];const x=Hc(g,y),{setOpenMobile:w,openMobile:k}=qc(),C=w,D=L.useRef(null);let T,B;t[12]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{const Y=$=>{Vc($)&&$.shiftKey&&$.code==="KeyS"&&!$.repeat&&($.preventDefault(),D.current?.())};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},B=[],t[12]=T,t[13]=B):(T=t[12],B=t[13]),L.useEffect(T,B);const I=d;let R;t[14]!==_||t[15]!==d?(R={virtualMcpId:d,entity:_},t[14]=_,t[15]=d,t[16]=R):R=t[16];const S=R;if(f.status==="creating"||f.status==="loading"){let Y;t[17]===Symbol.for("react.memo_cache_sentinel")?(Y=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(Re,{className:"size-4 animate-spin mr-2"}),"Creating task…"]})}),t[17]=Y):Y=t[17];let $;return t[18]!==S?($=o.jsx(Qt,{value:S,children:Y}),t[18]=S,t[19]=$):$=t[19],$}if(f.status==="error"){let Y;t[20]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx("div",{className:"font-medium",children:"Task unavailable"}),t[20]=Y):Y=t[20];let $;t[21]!==f.error.message?($=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:[Y,o.jsx("div",{className:"text-muted-foreground",children:f.error.message})]})}),t[21]=f.error.message,t[22]=$):$=t[22];let A;return t[23]!==S||t[24]!==$?(A=o.jsx(Qt,{value:S,children:$}),t[23]=S,t[24]=$,t[25]=A):A=t[25],A}if(!_){let Y;t[26]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(zs,{size:48,className:"text-muted-foreground"}),t[26]=Y):Y=t[26];const $=`The agent "${d}" does not exist in this organization.`;let A;t[27]!==s||t[28]!==l?(A=o.jsx(re,{variant:"outline",onClick:()=>s({to:"/$org",params:{org:l}}),children:"Go to organization home"}),t[27]=s,t[28]=l,t[29]=A):A=t[29];let O;t[30]!==$||t[31]!==A?(O=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($s,{image:Y,title:"Agent not found",description:$,actions:A})})}),t[30]=$,t[31]=A,t[32]=O):O=t[32];let F;return t[33]!==S||t[34]!==O?(F=o.jsx(Qt,{value:S,children:O}),t[33]=S,t[34]=O,t[35]=F):F=t[35],F}if(e){let Y;t[36]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(Gc,{className:"sr-only",children:"Navigation"}),t[36]=Y):Y=t[36];let $;t[37]!==C?($=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(Wc,{onClose:()=>C(!1)})}),t[37]=C,t[38]=$):$=t[38];let A;t[39]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:o.jsx(Uc,{})}),t[39]=A):A=t[39];let O;t[40]!==$?(O=o.jsxs(Yc,{side:"left",hideCloseButton:!0,className:"w-[calc(100vw-3rem)] sm:max-w-md! p-0",children:[Y,o.jsxs("div",{className:"flex h-full",children:[$,A]})]}),t[40]=$,t[41]=O):O=t[41];let F;t[42]!==k||t[43]!==C||t[44]!==O?(F=o.jsx(Xc,{open:k,onOpenChange:C,children:O}),t[42]=k,t[43]=C,t[44]=O,t[45]=F):F=t[45];const te=F,ae=_?.metadata?.vmMap;let ne;t[46]!==x.createNewTask?(ne=o.jsx(Yo,{onNewTaskRef:D,createNewTask:x.createNewTask}),t[46]=x.createNewTask,t[47]=ne):ne=t[47];let X;t[48]!==C?(X=()=>C(!0),t[48]=C,t[49]=X):X=t[49];let de;t[50]!==I||t[51]!==x.createNewTask||t[52]!==x.mainOpen||t[53]!==x.taskId||t[54]!==x.toggleMain||t[55]!==X?(de=o.jsx(Eg,{onOpenSidebar:X,virtualMcpId:I,taskId:x.taskId,mainOpen:x.mainOpen,onToggleMain:x.toggleMain,onNewTask:x.createNewTask}),t[50]=I,t[51]=x.createNewTask,t[52]=x.mainOpen,t[53]=x.taskId,t[54]=x.toggleMain,t[55]=X,t[56]=de):de=t[56];let fe;t[57]!==I||t[58]!==x.mainOpen||t[59]!==x.taskId?(fe=o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:x.mainOpen?o.jsx(It,{fallback:o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Something went wrong. Try refreshing."}),children:o.jsx(L.Suspense,{fallback:o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(Re,{size:20,className:"animate-spin text-muted-foreground"})}),children:o.jsx(Pl,{taskId:x.taskId,virtualMcpId:I})})}):o.jsx(Go,{})}),t[57]=I,t[58]=x.mainOpen,t[59]=x.taskId,t[60]=fe):fe=t[60];let he;t[61]!==b||t[62]!==te||t[63]!==ae||t[64]!==ne||t[65]!==de||t[66]!==fe||t[67]!==d?(he=o.jsxs(Xo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:ae,children:[ne,de,fe,te]}),t[61]=b,t[62]=te,t[63]=ae,t[64]=ne,t[65]=de,t[66]=fe,t[67]=d,t[68]=he):he=t[68];let ue;t[69]!==I||t[70]!==he?(ue=o.jsx("div",{className:"flex flex-col flex-1 bg-background min-h-0",children:o.jsx(Ee.Provider,{virtualMcpId:I,children:he},I)}),t[69]=I,t[70]=he,t[71]=ue):ue=t[71];let _e;return t[72]!==S||t[73]!==ue?(_e=o.jsx(Qt,{value:S,children:ue}),t[72]=S,t[73]=ue,t[74]=_e):_e=t[74],_e}const j=r?void 0:x.createNewTask;let E;t[75]!==x.chatOpen||t[76]!==x.toggleChat||t[77]!==j?(E=o.jsx(_r.Toggles,{children:o.jsx(ag,{chatOpen:x.chatOpen,toggleChat:x.toggleChat,onNewTask:j})}),t[75]=x.chatOpen,t[76]=x.toggleChat,t[77]=j,t[78]=E):E=t[78];let N;t[79]!==x.taskId||t[80]!==d?(N=o.jsx(_r.Tabs,{children:o.jsx(Ll,{virtualMcpId:d,taskId:x.taskId})}),t[79]=x.taskId,t[80]=d,t[81]=N):N=t[81];const P=_?.metadata?.vmMap;let M;t[82]!==_?(M=o.jsx(jg,{virtualMcp:_}),t[82]=_,t[83]=M):M=t[83];let H;t[84]!==x.createNewTask?(H=o.jsx(Yo,{onNewTaskRef:D,createNewTask:x.createNewTask}),t[84]=x.createNewTask,t[85]=H):H=t[85];let V;t[86]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(Go,{}),t[86]=V):V=t[86];let U;t[87]!==x.chatOpen||t[88]!==x.mainOpen||t[89]!==x.taskId||t[90]!==d?(U=o.jsx(og,{virtualMcpId:d,taskId:x.taskId,chatOpen:x.chatOpen,mainOpen:x.mainOpen,chatContent:V}),t[87]=x.chatOpen,t[88]=x.mainOpen,t[89]=x.taskId,t[90]=d,t[91]=U):U=t[91];let K;t[92]!==b||t[93]!==P||t[94]!==M||t[95]!==H||t[96]!==U||t[97]!==d?(K=o.jsxs(Xo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:P,children:[M,H,U]}),t[92]=b,t[93]=P,t[94]=M,t[95]=H,t[96]=U,t[97]=d,t[98]=K):K=t[98];let Q;t[99]!==I||t[100]!==N||t[101]!==K?(Q=o.jsxs(Ee.Provider,{virtualMcpId:I,children:[N,K]},I),t[99]=I,t[100]=N,t[101]=K,t[102]=Q):Q=t[102];let ee;return t[103]!==S||t[104]!==E||t[105]!==Q?(ee=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:o.jsxs(Qt,{value:S,children:[E,Q]})}),t[103]=S,t[104]=E,t[105]=Q,t[106]=ee):ee=t[106],ee}function z1(){const t=W.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(L.Suspense,{fallback:o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Re,{size:20,className:"animate-spin text-muted-foreground"})}),children:o.jsx(Dg,{})}),t[0]=e):e=t[0],e}export{z1 as default,wn as useInsetContext};
|
|
182
|
+
`);if(ge.trim()){P(!0);try{bt(),we("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:ge.length}),await b(["studio-automation-manager"]),g(!0),await v({tiptapDoc:Oa({managerAgentId:ra.AUTOMATION_MANAGER(n.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:ge})})}finally{P(!1)}}},Q=e.models?.credentialId||_||"",ee=e.models?.thinking?.id||m?.modelId||"",Y=e.models?.tier??"",$=Qo({defaultValues:{name:e.name,active:e.active,credential_id:Q,model_id:ee,tier:Y}}),A=$.watch("active"),O=$.watch("credential_id"),F=$.watch("model_id"),{models:te,isLoading:ae}=zc(O||void 0),ne=te.find(Z=>Z.modelId===F)??null,X=$.watch("tier"),de=["fast","smart","thinking"].find(Z=>p.chat[Z]?.modelId===F&&p.chat[Z]?.keyId===O),fe=X||de||"smart",he=Z=>{const ge=p.chat[Z];ge&&($.setValue("credential_id",ge.keyId,{shouldDirty:!0}),$.setValue("model_id",ge.modelId,{shouldDirty:!0}),$.setValue("tier",Z,{shouldDirty:!0}))},[ue,_e]=L.useReducer(Gp,null),Xe=()=>{ue!==null&&(we("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(ue.fields),save_count:ue.saveCount,edit_duration_ms:Date.now()-ue.start}),_e({type:"reset"}))},He=async()=>{const Z=$.control._formState.dirtyFields,ge=Object.keys(Z);if(ge.length===0&&!V)return!0;const Ze=$.getValues(),vs=Ze.credential_id&&Ze.model_id?Ze.credential_id:"",xs=Ze.credential_id&&Ze.model_id?Ze.model_id:"";vs!==Ze.credential_id&&$.setValue("credential_id",vs),xs!==Ze.model_id&&$.setValue("model_id",xs);const bs=$.getValues(),Ol=$.control._defaultValues;$.reset(bs,{keepValues:!0});const Cn=V;U(!1);const kn=p.enabled?bs.tier||de:bs.tier||void 0,zl={id:t,name:bs.name,active:bs.active,models:{credentialId:vs,thinking:{id:xs},...kn?{tier:kn}:{}},messages:oc(k),temperature:0};try{await a.mutateAsync(zl)}catch{return $.reset(Ol,{keepValues:!0}),Cn&&U(!0),!1}const Nn=[...ge];return Cn&&Nn.push("messages"),_e({type:"accumulate",now:Date.now(),fields:Nn}),je(),!0},{schedule:Je,flush:it}=bi({save:He}),{schedule:je,flush:bt}=bi({delayMs:3e4,save:async()=>Xe()});L.useEffect(()=>{const Z=$.watch(()=>Je());return()=>Z.unsubscribe()},[]);const G=Z=>{if(C(Z),!M){H(!0);return}U(!0),Je()},ie=async()=>{we("automation_test_clicked",{automation_id:t,agent_id:r});const Z=await it();if(bt(),!Z)return;if(!k){pe.error("No instructions configured for this automation");return}p.enabled?f(fe):ne&&O&&d({...ne,keyId:O}),g(!0),x({...y,toolApprovalLevel:"auto"});const ge=En(k);u({message:{tiptapDoc:k,parts:ge},virtualMcpId:r||void 0})};return o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(re,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(Ia,{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(Ft,{control:$.control,name:"name",render:({field:Z})=>o.jsx(_s,{...Z,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"}})}),i&&o.jsx(re,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:i,children:o.jsx(gr,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ft,{control:$.control,name:"active",render:({field:Z})=>o.jsx(pr,{checked:Z.value,onCheckedChange:ge=>{Z.onChange(ge),it()},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:A?"Active":"Inactive"}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(ga,{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(Vp,{automationId:t,open:D,onOpenChange:T,onCustomSelect:()=>{I(!0),E(!1),S("")},onEventSelect:()=>{E(!0),I(!1)}})]}),e.triggers.length===0&&!B?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:()=>T(!0),children:"Add a starter"})," ","to get going."]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(Z=>o.jsx(Kp,{trigger:Z,automationId:t,connectionName:Z.connection_id?c.get(Z.connection_id):void 0},Z.id))}),B&&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(As,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:R,onChange:Z=>S(Z.target.value),onBlur:async()=>{const Z=R.trim();if(!(!Z||!Ls(Z)))try{await l.mutateAsync({automation_id:t,type:"cron",cron_expression:Z}),we("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),pe.success("Starter added"),I(!1),S("")}catch{pe.error("Failed to add starter")}},onKeyDown:async Z=>{const ge=R.trim();Z.key==="Enter"&&ge&&Ls(ge)&&Z.target.blur(),Z.key==="Escape"&&(I(!1),S(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),R&&!Ls(R)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),l.isPending&&o.jsx(Re,{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:()=>{I(!1),S("")},children:o.jsx(ls,{size:13})})]}),j&&o.jsx(L.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(Re,{size:13,className:"animate-spin text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:o.jsx(Yp,{automationId:t,onDone:()=>E(!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(re,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:N||!k,onClick:K,children:[o.jsx(Da,{size:13}),"Improve"]})]}),o.jsx(tc,{tiptapDoc:k,setTiptapDoc:G,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(sc,{virtualMcpId:r||null,className:"max-h-[45vh]"}),o.jsxs("div",{className:"flex items-center justify-end gap-1.5 p-2.5",children:[p.enabled?o.jsx(ic,{tier:fe,onSelect:he}):o.jsx(Rh,{model:ne,isLoading:ae,credentialId:O||null,onCredentialChange:Z=>{$.setValue("credential_id",Z??"",{shouldDirty:!0}),$.setValue("model_id","",{shouldDirty:!0}),$.setValue("tier","",{shouldDirty:!0})},onModelChange:Z=>{$.setValue("model_id",Z.modelId,{shouldDirty:!0}),$.setValue("tier","",{shouldDirty:!0})},placeholder:"Model"}),o.jsxs(Ve,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(re,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:ie,disabled:!r,children:[o.jsx(fc,{size:16}),"Test"]})}),o.jsx(qe,{children:"Test Automation"})]})]})]})})]})]})]})}function eg(t){const e=W.c(5),{tabId:s}=t;let i;e[0]!==s?(i=oa(s),e[0]=s,e[1]=i):i=e[1];const r=i;if(!r)return null;let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Re,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=n):n=e[2];let a;return e[3]!==r.id?(a=o.jsx(ct,{children:o.jsx(ct.Content,{children:o.jsx(ct.Body,{children:o.jsx(L.Suspense,{fallback:n,children:o.jsx(tg,{id:r.id})})})})}),e[3]=r.id,e[4]=a):a=e[4],a}function tg(t){const e=W.c(8),{id:s}=t,i=Pt(),{data:r,isLoading:n}=Ah(s);let a;e[0]!==i?(a=()=>i({to:".",search:sg,replace:!0}),e[0]=i,e[1]=a):a=e[1];const l=a;if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Re,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=c):c=e[2],c}if(!r){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=c):c=e[3],c}let h;return e[4]!==r||e[5]!==s||e[6]!==l?(h=o.jsx(Qp,{automationId:s,automation:r,onBack:l}),e[4]=r,e[5]=s,e[6]=l,e[7]=h):h=e[7],h}function sg(t){return{...t,main:"automations"}}function ig(t){const e=W.c(20),{virtualMcpId:s}=t,i=Pt(),{data:r}=Bh(s),n=r===void 0?[]:r,{create:a}=Ys(),{selectedModel:l,credentialId:h}=Ti(),[c,u]=L.useState(""),d=c.toLowerCase(),f=n.filter(R=>R.name.toLowerCase().includes(d));let _;e[0]!==i?(_=R=>i({to:".",search:S=>({...S,main:"automation:"+R}),replace:!0}),e[0]=i,e[1]=_):_=e[1];const m=_,p=async()=>{if(a.isPending)return;we("automation_new_clicked",{virtual_mcp_id:s,existing_count:n.length});const R=l?.modelId&&h?{credentialId:h,modelId:l.modelId}:null,S=await a.mutateAsync(Lh(s,R));m(S.id)},g=ct,v=ct,b=ct;let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(ct.Title,{children:"Automations"}),e[2]=y):y=e[2];const x=n.length>0&&o.jsx(Oh,{value:c,onChange:u,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(cs,{size:14}),e[3]=w):w=e[3];let k;e[4]!==a.isPending||e[5]!==p?(k=o.jsxs(re,{size:"sm",onClick:p,disabled:a.isPending,children:[w,"New automation"]}),e[4]=a.isPending,e[5]=p,e[6]=k):k=e[6];let C;e[7]!==x||e[8]!==k?(C=o.jsxs("div",{className:"flex flex-col gap-6",children:[y,o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[x,k]})]}),e[7]=x,e[8]=k,e[9]=C):C=e[9];const D=n.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx($s,{image:o.jsx(Fs,{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(re,{size:"sm",onClick:p,disabled:a.isPending,children:[o.jsx(cs,{size:14}),"New automation"]})})}):f.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx($s,{image:o.jsx(Fs,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${c}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:f.map(R=>o.jsx(Ph,{automation:R,onClick:()=>m(R.id)},R.id))});let T;e[10]!==D||e[11]!==b.Body||e[12]!==C?(T=o.jsxs(b.Body,{children:[C,D]}),e[10]=D,e[11]=b.Body,e[12]=C,e[13]=T):T=e[13];let B;e[14]!==T||e[15]!==v.Content?(B=o.jsx(v.Content,{children:T}),e[14]=T,e[15]=v.Content,e[16]=B):B=e[16];let I;return e[17]!==g||e[18]!==B?(I=o.jsx(g,{children:B}),e[17]=g,e[18]=B,e[19]=I):I=e[19],I}function rg(t){const e=W.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(Re,{size:20,className:"animate-spin text-muted-foreground"})}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx(L.Suspense,{fallback:i,children:o.jsx(ig,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}const Vo=L.lazy(()=>Yl(()=>import("./project-app-view-CsUA3eWI.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,56,57])).then(t=>({default:t.AppViewContent})));function Pl(t){const e=W.c(43),{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}=La(r);if(xc(n)){let m;return e[3]!==i?(m=o.jsx(Gn,{virtualMcpId:i}),e[3]=i,e[4]=m):m=e[4],m}if(n==="git"){let m;return e[5]!==i?(m=o.jsx(Ou,{virtualMcpId:i}),e[5]=i,e[6]=m):m=e[6],m}if(n==="automations"){let m;return e[7]!==i?(m=o.jsx(rg,{virtualMcpId:i}),e[7]=i,e[8]=m):m=e[8],m}if(n==="env"){let m;return e[9]!==i?(m=o.jsx(zp,{virtualMcpId:i}),e[9]=i,e[10]=m):m=e[10],m}if(n==="preview"){let m;return e[11]!==i?(m=o.jsx(Sf,{virtualMcpId:i}),e[11]=i,e[12]=m):m=e[12],m}if(h){let m;return e[13]!==n?(m=o.jsx(eg,{tabId:n}),e[13]=n,e[14]=m):m=e[14],m}let c;e[15]!==n?(c=bc(n),e[15]=n,e[16]=c):c=e[16];const u=c;if(u){let m;if(e[17]!==l||e[18]!==u.connectionId||e[19]!==u.toolName){let y;e[21]!==u.connectionId||e[22]!==u.toolName?(y=x=>x.appId===u.connectionId&&x.toolName===u.toolName,e[21]=u.connectionId,e[22]=u.toolName,e[23]=y):y=e[23],m=l.find(y),e[17]=l,e[18]=u.connectionId,e[19]=u.toolName,e[20]=m}else m=e[20];const p=m;let g;e[24]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Re,{size:20,className:"animate-spin text-muted-foreground"})}),e[24]=g):g=e[24];const v=p?.args;let b;return e[25]!==n||e[26]!==u.connectionId||e[27]!==u.toolName||e[28]!==v?(b=o.jsx(L.Suspense,{fallback:g,children:o.jsx(Vo,{connectionId:u.connectionId,toolName:u.toolName,args:v},n)}),e[25]=n,e[26]=u.connectionId,e[27]=u.toolName,e[28]=v,e[29]=b):b=e[29],b}let d;if(e[30]!==n||e[31]!==a){let m;e[33]!==n?(m=p=>p.id===n,e[33]=n,e[34]=m):m=e[34],d=a.find(m),e[30]=n,e[31]=a,e[32]=d}else d=e[32];const f=d;if(f){let m;e[35]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Re,{size:20,className:"animate-spin text-muted-foreground"})}),e[35]=m):m=e[35];let p;return e[36]!==n||e[37]!==f.id||e[38]!==f.view.appId||e[39]!==f.view.args?(p=o.jsx(L.Suspense,{fallback:m,children:o.jsx(Vo,{connectionId:f.view.appId,toolName:f.id,args:f.view.args},n)}),e[36]=n,e[37]=f.id,e[38]=f.view.appId,e[39]=f.view.args,e[40]=p):p=e[40],p}let _;return e[41]!==i?(_=o.jsx(Gn,{virtualMcpId:i}),e[41]=i,e[42]=_):_=e[42],_}function ng(t){const e=W.c(7),{children:s,defaultSize:i}=t,[,r]=L.useTransition();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=sa.decoChatPanelWidth(),e[0]=n):n=e[0];const[a,l]=ta(n,45),h=i>0&&i<100?a:i;let c;e[1]!==l?(c=f=>r(()=>{f>0&&f<100&&l(f)}),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(_a,{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 og(t){const e=W.c(30),{virtualMcpId:s,taskId:i,chatOpen:r,mainOpen:n,chatContent:a}=t;let l;e[0]!==r||e[1]!==n?(l=Ln(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=sa.decoChatPanelWidth(),e[3]=c):c=e[3];const[u]=ta(c,45),d=L.useRef(null);let f,_;e[4]!==r||e[5]!==n||e[6]!==u?(f=()=>{const B=d.current;if(!B)return;const I=Ln(r,n),R=I.chat>0&&I.chat<100?u:I.chat,S=I.chat>0&&I.chat<100?100-u:I.main;B.setLayout([R,S])},_=[r,n,u],e[4]=r,e[5]=n,e[6]=u,e[7]=f,e[8]=_):(f=e[7],_=e[8]),L.useEffect(f,_);const m=`${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(Aa,{}),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(ng,{defaultSize:h.chat,children:v}),e[14]=h.chat,e[15]=v,e[16]=b):b=e[16];let y;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(ih,{className:"bg-sidebar"}),e[17]=y):y=e[17];const x=h.main;let w;e[18]===Symbol.for("react.memo_cache_sentinel")?(w={overflow:"visible"},e[18]=w):w=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=se("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 C;e[20]!==i||e[21]!==s?(C=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(It,{children:o.jsx(Pl,{taskId:i,virtualMcpId:s})})})})}),e[20]=i,e[21]=s,e[22]=C):C=e[22];let D;e[23]!==h.main||e[24]!==C?(D=o.jsx(_a,{className:"min-w-0 flex flex-col",order:2,defaultSize:x,style:w,collapsible:!0,collapsedSize:0,minSize:20,children:C}),e[23]=h.main,e[24]=C,e[25]=D):D=e[25];let T;return e[26]!==D||e[27]!==m||e[28]!==b?(T=o.jsxs(rh,{ref:d,direction:"horizontal",className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",style:p,children:[b,y,D]},m),e[26]=D,e[27]=m,e[28]=b,e[29]=T):T=e[29],T}const ur="flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",Ko="bg-sidebar-accent text-sidebar-foreground",fr="text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";function ag(t){const e=W.c(47),{chatOpen:s,toggleChat:i,onNewTask:r}=t,{tasksOpen:n,toggleTasks:a}=$c(),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?Ko:fr;let u;e[3]!==c?(u=se(ur,c),e[3]=c,e[4]=u):u=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Pc,{size:16}),e[5]=d):d=e[5];let f;e[6]!==h||e[7]!==u||e[8]!==n?(f=o.jsx(Ke,{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]=f):f=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(qe,{side:"bottom",children:"Tasks"}),e[10]=_):_=e[10];let m;e[11]!==f?(m=o.jsxs(Ve,{delayDuration:300,children:[f,_]}),e[11]=f,e[12]=m):m=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?Ko:fr;let v;e[16]!==g?(v=se(ur,g),e[16]=g,e[17]=v):v=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(ua,{size:16}),e[18]=b):b=e[18];let y;e[19]!==s||e[20]!==v||e[21]!==p?(y=o.jsx(Ke,{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]=y):y=e[22];let x;e[23]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(qe,{side:"bottom",children:"Chat"}),e[23]=x):x=e[23];let w;e[24]!==y?(w=o.jsxs(Ve,{delayDuration:300,children:[y,x]}),e[24]=y,e[25]=w):w=e[25];const k=l?"grid-cols-[1fr]":"grid-cols-[0fr]";let C;e[26]!==k?(C=se("grid transition-[grid-template-columns] duration-200 ease-[var(--ease-out-quart)]",k),e[26]=k,e[27]=C):C=e[27];const D=!l,T=l?0:-1,B=!l,I=l?"translate-x-0 opacity-100":"-translate-x-2 opacity-0";let R;e[28]!==I?(R=se(ur,fr,"transition-[transform,opacity] duration-200 ease-[var(--ease-out-quart)] will-change-transform",I),e[28]=I,e[29]=R):R=e[29];let S;e[30]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(on,{size:16}),e[30]=S):S=e[30];let j;e[31]!==r||e[32]!==D||e[33]!==T||e[34]!==B||e[35]!==R?(j=o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button",onClick:r,disabled:D,tabIndex:T,"aria-hidden":B,className:R,children:S})}),e[31]=r,e[32]=D,e[33]=T,e[34]=B,e[35]=R,e[36]=j):j=e[36];let E;e[37]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(qe,{side:"bottom",children:"New task"}),e[37]=E):E=e[37];let N;e[38]!==j?(N=o.jsx("div",{className:"overflow-hidden",children:o.jsxs(Ve,{delayDuration:300,children:[j,E]})}),e[38]=j,e[39]=N):N=e[39];let P;e[40]!==C||e[41]!==N?(P=o.jsx("div",{className:C,children:N}),e[40]=C,e[41]=N,e[42]=P):P=e[42];let M;return e[43]!==w||e[44]!==P||e[45]!==m?(M=o.jsxs(o.Fragment,{children:[m,w,P]}),e[43]=w,e[44]=P,e[45]=m,e[46]=M):M=e[46],M}function lg(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 cg(t){const e=W.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=se("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(hg,{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 hg(t){const e=W.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(fa,{className:"size-4"}),e[4]=i):i=e[4],i}function dg(t){const e=W.c(13),{overflow:s,onSelect:i}=t,[r,n]=L.useState(!1);let a;e[0]!==i?(a=f=>{n(!1),i(f)},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(Ks,{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(ca,{className:"size-4"})})}),e[2]=h):h=e[2];let c;if(e[3]!==l||e[4]!==s){let f;e[6]!==l?(f=_=>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(ug,{icon:_.icon})}),o.jsx("span",{className:"truncate",children:_.title})]})},_.id),e[6]=l,e[7]=f):f=e[7],c=s.map(f),e[3]=l,e[4]=s,e[5]=c}else c=e[5];let u;e[8]!==c?(u=o.jsx(qs,{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(Gs,{open:r,onOpenChange:n,children:[h,u]}),e[10]=r,e[11]=u,e[12]=d):d=e[12],d}function ug(t){const e=W.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(fa,{className:"size-4"}),e[4]=i):i=e[4],i}const fg=6;function Ll(t){const e=W.c(20),{virtualMcpId:s,taskId:i}=t,r=Pt();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}=La(n);let u,d,f,_;if(e[3]!==l||e[4]!==h||e[5]!==r||e[6]!==c||e[7]!==a||e[8]!==s){const g=Sc({activeTab:l,mainOpen:h}),v=k=>k.id==="automations"?g:h&&k.id===l,y=a.find(k=>v(k))?.id??null,{visible:x,overflow:w}=lg(a,y,fg);d=w,u=k=>{const C=a.find(T=>T.id===k),D=y===k&&h;if(we("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:k,tab_kind:C?.kind??null,was_active:D}),k==="automations"){const T=yc({activeTab:l,mainOpen:h});r({to:".",search:B=>({...B,main:T}),replace:!0});return}c(k)},f="flex items-center min-w-0 gap-0.5",_=x.map(k=>o.jsx(cg,{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]=f,e[12]=_}else u=e[9],d=e[10],f=e[11],_=e[12];let m;e[13]!==u||e[14]!==d?(m=d.length>0&&o.jsx(dg,{overflow:d,onSelect:u}),e[13]=u,e[14]=d,e[15]=m):m=e[15];let p;return e[16]!==f||e[17]!==_||e[18]!==m?(p=o.jsxs("div",{className:f,children:[_,m]}),e[16]=f,e[17]=_,e[18]=m,e[19]=p):p=e[19],p}function mg(t){const e=W.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=se("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(Xl,{"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 _g(t){const e=W.c(20),{prNumber:s,disabled:i,send:r}=t;let n;e[0]!==s||e[1]!==r?(n=()=>r(ju({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(Nu({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(re,{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(vr,{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(re,{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 f;e[12]!==h?(f=o.jsx(as,{align:"end",children:o.jsx(Ct,{onClick:h,children:"Review"})}),e[12]=h,e[13]=f):f=e[13];let _;e[14]!==d||e[15]!==f?(_=o.jsxs(ns,{children:[d,f]}),e[14]=d,e[15]=f,e[16]=_):_=e[16];let m;return e[17]!==c||e[18]!==_?(m=o.jsxs("div",{className:"inline-flex items-stretch rounded-md",children:[c,_]}),e[17]=c,e[18]=_,e[19]=m):m=e[19],m}const pg=new Set(["failure","timed_out","cancelled","action_required"]);function gg(t){return t.status==="completed"&&pg.has(t.conclusion)}function vg(t){return t.status==="queued"||t.status==="in_progress"}function xg(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"};switch(e.kind){case"initializing":return{label:"Starting sandbox…",disabled:!0,loading:!0,variant:"outline",tooltip:"Waiting for the sandbox daemon to come online"};case"cloning":return{label:"Cloning repo…",disabled:!0,loading:!0,variant:"outline",tooltip:"Cloning the project repository"};case"clone-failed":return{label:"Clone failed",disabled:!0,variant:"outline",tooltip:e.error||"git clone failed — see setup logs"};case"checking-out":return{label:`Switching to ${e.to}…`,disabled:!0,loading:!0,variant:"outline",tooltip:`Checking out ${e.to}`};case"checkout-failed":return{label:"Checkout failed",disabled:!0,variant:"outline",tooltip:e.error||"git checkout failed — see setup logs"}}const a=e;if(a.workingTreeDirty||a.unpushed>0)return{label:"Save changes",action:"commit-and-push",variant:"default",tooltip:"Commit and push local changes"};if(s?.merged)return!!a.headSha&&!!s.headSha&&a.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(a.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 ${a.branch} → ${a.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 c=i.filter(gg).map(f=>f.name);if(c.length>0)return{label:"Fix tests",action:"fix-checks",variant:"default",tooltip:`Failing: ${c.join(", ")}`,meta:{failingChecks:c}};const u=i.filter(vg);if(u.length>0)return{label:"Running tests…",disabled:!0,loading:!0,variant:"outline",tooltip:`Waiting on ${u.length} check${u.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 d=r?.unresolvedConversations??0;return d>0?{label:"Address feedback",action:"resolve-comments",variant:"default",tooltip:`${d} unresolved conversation${d===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 ${a.base}`}}function bg(){return Gt().branchStatus}const Sg=6e4,yg=3e4;function wg(t){const e=W.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=Fe(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:Sg,refetchIntervalInBackground:!1,staleTime:yg,select:Cg},e[8]=i,e[9]=n,e[10]=a,e[11]=l):l=e[11],ms(l)}function Cg(t){const e=Xs(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 kg(t){const e=W.c(42),{virtualMcpId:s}=t,{org:i}=xe(),r=kt(s),{currentBranch:n}=vt(),a=fs(),l=r?.metadata?.githubRepo??null,h=bg(),c=l?.connectionId??"",u=l?.owner??"",d=l?.name??"",f=n??null;let _;e[0]!==i.id||e[1]!==i.slug||e[2]!==c||e[3]!==u||e[4]!==d||e[5]!==f?(_={orgId:i.id,orgSlug:i.slug,connectionId:c,owner:u,repo:d,branch:f},e[0]=i.id,e[1]=i.slug,e[2]=c,e[3]=u,e[4]=d,e[5]=f,e[6]=_):_=e[6];const m=$a(_),p=m.data??null,g=l?.connectionId??"",v=l?.owner??"",b=l?.name??"",y=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]!==y?(x={orgId:i.id,orgSlug:i.slug,connectionId:g,owner:v,repo:b,prNumber:y},e[7]=i.id,e[8]=i.slug,e[9]=g,e[10]=v,e[11]=b,e[12]=y,e[13]=x):x=e[13];const w=Ha(x),k=l?.connectionId??"",C=l?.owner??"",D=l?.name??"",T=p&&p.state==="open"?p.number:null;let B;e[14]!==i.id||e[15]!==i.slug||e[16]!==k||e[17]!==C||e[18]!==D||e[19]!==T?(B={orgId:i.id,orgSlug:i.slug,connectionId:k,owner:C,repo:D,prNumber:T},e[14]=i.id,e[15]=i.slug,e[16]=k,e[17]=C,e[18]=D,e[19]=T,e[20]=B):B=e[20];const I=wg(B);if(!l?.connectionId||!n)return null;let R;e[21]!==h||e[22]!==w.data||e[23]!==p||e[24]!==m.isPending||e[25]!==I.data?(R=xg({branchStatus:h,pr:p,checks:w.data??[],reviews:I.data??null,loading:m.isPending}),e[21]=h,e[22]=w.data,e[23]=p,e[24]=m.isPending,e[25]=I.data,e[26]=R):R=e[26];const S=R;let j;e[27]!==a?(j=K=>a.sendMessage({parts:[{type:"text",text:K}]}),e[27]=a,e[28]=j):j=e[28];const E=j,N=a.isStreaming;let P;e[29]!==n||e[30]!==S||e[31]!==N||e[32]!==p||e[33]!==E?(P=K=>{if(!N)switch(K){case"commit-and-push":{E(vu({branch:n}));return}case"create-pr":{E(xu({branch:n}));return}case"reopen":{p&&E(bu({prNumber:p.number}));return}case"rebase":{E(Su({branch:n}));return}case"fix-checks":{p&&E(wu({prNumber:p.number,failingChecks:S.meta?.failingChecks??[]}));return}case"mark-ready":{p&&E(Cu({prNumber:p.number}));return}case"resolve-comments":{p&&E(ku({prNumber:p.number}));return}case"merge-split":return}},e[29]=n,e[30]=S,e[31]=N,e[32]=p,e[33]=E,e[34]=P):P=e[34];const M=P;let H;e[35]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(mg,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-5"}),e[35]=H):H=e[35];const V=p?.number;let U;return e[36]!==S||e[37]!==N||e[38]!==M||e[39]!==E||e[40]!==V?(U=o.jsxs(o.Fragment,{children:[H,o.jsx(Ng,{button:S,isStreaming:N,onActivate:M,prNumber:V,send:E})]}),e[36]=S,e[37]=N,e[38]=M,e[39]=E,e[40]=V,e[41]=U):U=e[41],U}function Ng(t){const e=W.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(_g,{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(qo,{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(Nh,{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(re,{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(qo,{label:n,children:h}),e[18]=h,e[19]=n,e[20]=c):c=e[20],c}function qo(t){const e=W.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(Ke,{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(qe,{children:s}),e[4]=s,e[5]=n):n=e[5];let a;return e[6]!==r||e[7]!==n?(a=o.jsx(Jc,{children:o.jsxs(Ve,{children:[r,n]})}),e[6]=r,e[7]=n,e[8]=a):a=e[8],a}function jg(t){const e=W.c(2),{virtualMcp:s}=t;if(!!!(s.metadata?.githubRepo??null)?.connectionId)return null;let n;return e[0]!==s.id?(n=o.jsx(_r.Right,{children:o.jsx(kg,{virtualMcpId:s.id})}),e[0]=s.id,e[1]=n):n=e[1],n}const Qt=L.createContext(null);function wn(){return L.use(Qt)}function Go(t){const e=W.c(7),{children:s}=t,{taskId:i}=vt();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(Aa,{}),e[2]=s,e[3]=a):a=e[3];let l;return e[4]!==a||e[5]!==i?(l=o.jsx(It,{fallback:r,children:o.jsx(L.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 Yo(t){const e=W.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],L.useLayoutEffect(r),null}function Eg(t){const e=W.c(23),{onOpenSidebar:s,virtualMcpId:i,taskId:r,mainOpen:n,onToggleMain:a,onNewTask:l}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(lc,{size:20}),e[0]=h):h=e[0];let c;e[1]!==s?(c=o.jsx("button",{type:"button",onClick:s,className:"flex size-8 shrink-0 items-center justify-center rounded-md text-foreground/60 hover:bg-accent hover:text-foreground transition-colors","aria-label":"Open menu",children:h}),e[1]=s,e[2]=c):c=e[2];let u;e[3]!==r||e[4]!==i?(u=o.jsx("div",{className:"flex-1 min-w-0 overflow-x-auto [scrollbar-width:none]",children:o.jsx(Ll,{virtualMcpId:i,taskId:r})}),e[3]=r,e[4]=i,e[5]=u):u=e[5];const d=!n,f=n?"text-foreground/60 hover:bg-accent hover:text-foreground":"bg-accent text-foreground";let _;e[6]!==f?(_=se("flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",f),e[6]=f,e[7]=_):_=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(ua,{size:16}),e[8]=m):m=e[8];let p;e[9]!==a||e[10]!==d||e[11]!==_?(p=o.jsx("button",{type:"button",onClick:a,"aria-pressed":d,className:_,title:"Chat",children:m}),e[9]=a,e[10]=d,e[11]=_,e[12]=p):p=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(on,{size:16}),e[13]=g):g=e[13];let v;e[14]!==l?(v=o.jsx("button",{type:"button",onClick:l,className:"flex size-7 shrink-0 items-center justify-center rounded-md text-foreground/60 hover:bg-accent hover:text-foreground transition-colors",title:"New task",children:g}),e[14]=l,e[15]=v):v=e[15];let b;e[16]!==v||e[17]!==p?(b=o.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[p,v]}),e[16]=v,e[17]=p,e[18]=b):b=e[18];let y;return e[19]!==b||e[20]!==c||e[21]!==u?(y=o.jsxs("div",{className:"shrink-0 flex items-center gap-1 px-2 h-12 bg-background border-b border-border",children:[c,u,b]}),e[19]=b,e[20]=c,e[21]=u,e[22]=y):y=e[22],y}function Xo(t){const e=W.c(16),{virtualMcpId:s,hasActiveGithubRepo:i,vmMap:r,children:n}=t,{org:a}=xe(),{currentBranch:l}=vt(),{data:h}=Ei.useSession(),c=h?.user?.id;let u;e[0]!==a.id||e[1]!==a.slug?(u={connectionId:Lt,orgId:a.id,orgSlug:a.slug},e[0]=a.id,e[1]=a.slug,e[2]=u):u=e[2];const d=Fe(u),{mutate:f}=hn(d);let _;e[3]===Symbol.for("react.memo_cache_sentinel")?(_=new Set,e[3]=_):_=e[3];const m=L.useRef(_);let p,g;e[4]!==l||e[5]!==i||e[6]!==f||e[7]!==c||e[8]!==s||e[9]!==r?(p=()=>{if(i&&c&&l){if(r?.[c]?.[l]){m.current.add(l);return}m.current.has(l)||(m.current.add(l),f({virtualMcpId:s,branch:l},{onError:Tg}))}},g=[i,c,l,r,s,f],e[4]=l,e[5]=i,e[6]=f,e[7]=c,e[8]=s,e[9]=r,e[10]=p,e[11]=g):(p=e[10],g=e[11]),L.useEffect(p,g);const v=l??null;let b;return e[12]!==n||e[13]!==v||e[14]!==s?(b=o.jsx(Qu,{virtualMcpId:s,branch:v,children:n}),e[12]=n,e[13]=v,e[14]=s,e[15]=b):b=e[15],b}function Tg(t){console.error("[auto-start-vm] failed:",t)}function Dg(){const t=W.c(107),e=ma(),s=Pt(),{org:i}=xe(),r=Fc()?.tasksOpen??!1;Zc(i.slug);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const a=Jl(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=sn(h);let u;t[2]!==i.id||t[3]!==c.virtualmcpid?(u=c.virtualmcpid??ia(i.id).id,t[2]=i.id,t[3]=c.virtualmcpid,t[4]=u):u=t[4];const d=u,f=Fh(a.taskId??"",d),_=kt(d),m=_?.metadata?.ui?.layout??null;let p;t[5]!==m?(p=m?{defaultMainView:m.defaultMainView??null,chatDefaultOpen:m.chatDefaultOpen??null}:null,t[5]=m,t[6]=p):p=t[6];const g=p;let v;t[7]!==_?(v=_&&Kt(_),t[7]=_,t[8]=v):v=t[8];const b=!!v;let y;t[9]!==l||t[10]!==d?(y={virtualMcpId:d,orgSlug:l,isAgentRoute:!0},t[9]=l,t[10]=d,t[11]=y):y=t[11];const x=Hc(g,y),{setOpenMobile:w,openMobile:k}=qc(),C=w,D=L.useRef(null);let T,B;t[12]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{const Y=$=>{Vc($)&&$.shiftKey&&$.code==="KeyS"&&!$.repeat&&($.preventDefault(),D.current?.())};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},B=[],t[12]=T,t[13]=B):(T=t[12],B=t[13]),L.useEffect(T,B);const I=d;let R;t[14]!==_||t[15]!==d?(R={virtualMcpId:d,entity:_},t[14]=_,t[15]=d,t[16]=R):R=t[16];const S=R;if(f.status==="creating"||f.status==="loading"){let Y;t[17]===Symbol.for("react.memo_cache_sentinel")?(Y=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(Re,{className:"size-4 animate-spin mr-2"}),"Creating task…"]})}),t[17]=Y):Y=t[17];let $;return t[18]!==S?($=o.jsx(Qt,{value:S,children:Y}),t[18]=S,t[19]=$):$=t[19],$}if(f.status==="error"){let Y;t[20]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx("div",{className:"font-medium",children:"Task unavailable"}),t[20]=Y):Y=t[20];let $;t[21]!==f.error.message?($=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:[Y,o.jsx("div",{className:"text-muted-foreground",children:f.error.message})]})}),t[21]=f.error.message,t[22]=$):$=t[22];let A;return t[23]!==S||t[24]!==$?(A=o.jsx(Qt,{value:S,children:$}),t[23]=S,t[24]=$,t[25]=A):A=t[25],A}if(!_){let Y;t[26]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(zs,{size:48,className:"text-muted-foreground"}),t[26]=Y):Y=t[26];const $=`The agent "${d}" does not exist in this organization.`;let A;t[27]!==s||t[28]!==l?(A=o.jsx(re,{variant:"outline",onClick:()=>s({to:"/$org",params:{org:l}}),children:"Go to organization home"}),t[27]=s,t[28]=l,t[29]=A):A=t[29];let O;t[30]!==$||t[31]!==A?(O=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($s,{image:Y,title:"Agent not found",description:$,actions:A})})}),t[30]=$,t[31]=A,t[32]=O):O=t[32];let F;return t[33]!==S||t[34]!==O?(F=o.jsx(Qt,{value:S,children:O}),t[33]=S,t[34]=O,t[35]=F):F=t[35],F}if(e){let Y;t[36]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(Gc,{className:"sr-only",children:"Navigation"}),t[36]=Y):Y=t[36];let $;t[37]!==C?($=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(Wc,{onClose:()=>C(!1)})}),t[37]=C,t[38]=$):$=t[38];let A;t[39]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:o.jsx(Uc,{})}),t[39]=A):A=t[39];let O;t[40]!==$?(O=o.jsxs(Yc,{side:"left",hideCloseButton:!0,className:"w-[calc(100vw-3rem)] sm:max-w-md! p-0",children:[Y,o.jsxs("div",{className:"flex h-full",children:[$,A]})]}),t[40]=$,t[41]=O):O=t[41];let F;t[42]!==k||t[43]!==C||t[44]!==O?(F=o.jsx(Xc,{open:k,onOpenChange:C,children:O}),t[42]=k,t[43]=C,t[44]=O,t[45]=F):F=t[45];const te=F,ae=_?.metadata?.vmMap;let ne;t[46]!==x.createNewTask?(ne=o.jsx(Yo,{onNewTaskRef:D,createNewTask:x.createNewTask}),t[46]=x.createNewTask,t[47]=ne):ne=t[47];let X;t[48]!==C?(X=()=>C(!0),t[48]=C,t[49]=X):X=t[49];let de;t[50]!==I||t[51]!==x.createNewTask||t[52]!==x.mainOpen||t[53]!==x.taskId||t[54]!==x.toggleMain||t[55]!==X?(de=o.jsx(Eg,{onOpenSidebar:X,virtualMcpId:I,taskId:x.taskId,mainOpen:x.mainOpen,onToggleMain:x.toggleMain,onNewTask:x.createNewTask}),t[50]=I,t[51]=x.createNewTask,t[52]=x.mainOpen,t[53]=x.taskId,t[54]=x.toggleMain,t[55]=X,t[56]=de):de=t[56];let fe;t[57]!==I||t[58]!==x.mainOpen||t[59]!==x.taskId?(fe=o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:x.mainOpen?o.jsx(It,{fallback:o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Something went wrong. Try refreshing."}),children:o.jsx(L.Suspense,{fallback:o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(Re,{size:20,className:"animate-spin text-muted-foreground"})}),children:o.jsx(Pl,{taskId:x.taskId,virtualMcpId:I})})}):o.jsx(Go,{})}),t[57]=I,t[58]=x.mainOpen,t[59]=x.taskId,t[60]=fe):fe=t[60];let he;t[61]!==b||t[62]!==te||t[63]!==ae||t[64]!==ne||t[65]!==de||t[66]!==fe||t[67]!==d?(he=o.jsxs(Xo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:ae,children:[ne,de,fe,te]}),t[61]=b,t[62]=te,t[63]=ae,t[64]=ne,t[65]=de,t[66]=fe,t[67]=d,t[68]=he):he=t[68];let ue;t[69]!==I||t[70]!==he?(ue=o.jsx("div",{className:"flex flex-col flex-1 bg-background min-h-0",children:o.jsx(Ee.Provider,{virtualMcpId:I,children:he},I)}),t[69]=I,t[70]=he,t[71]=ue):ue=t[71];let _e;return t[72]!==S||t[73]!==ue?(_e=o.jsx(Qt,{value:S,children:ue}),t[72]=S,t[73]=ue,t[74]=_e):_e=t[74],_e}const j=r?void 0:x.createNewTask;let E;t[75]!==x.chatOpen||t[76]!==x.toggleChat||t[77]!==j?(E=o.jsx(_r.Toggles,{children:o.jsx(ag,{chatOpen:x.chatOpen,toggleChat:x.toggleChat,onNewTask:j})}),t[75]=x.chatOpen,t[76]=x.toggleChat,t[77]=j,t[78]=E):E=t[78];let N;t[79]!==x.taskId||t[80]!==d?(N=o.jsx(_r.Tabs,{children:o.jsx(Ll,{virtualMcpId:d,taskId:x.taskId})}),t[79]=x.taskId,t[80]=d,t[81]=N):N=t[81];const P=_?.metadata?.vmMap;let M;t[82]!==_?(M=o.jsx(jg,{virtualMcp:_}),t[82]=_,t[83]=M):M=t[83];let H;t[84]!==x.createNewTask?(H=o.jsx(Yo,{onNewTaskRef:D,createNewTask:x.createNewTask}),t[84]=x.createNewTask,t[85]=H):H=t[85];let V;t[86]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(Go,{}),t[86]=V):V=t[86];let U;t[87]!==x.chatOpen||t[88]!==x.mainOpen||t[89]!==x.taskId||t[90]!==d?(U=o.jsx(og,{virtualMcpId:d,taskId:x.taskId,chatOpen:x.chatOpen,mainOpen:x.mainOpen,chatContent:V}),t[87]=x.chatOpen,t[88]=x.mainOpen,t[89]=x.taskId,t[90]=d,t[91]=U):U=t[91];let K;t[92]!==b||t[93]!==P||t[94]!==M||t[95]!==H||t[96]!==U||t[97]!==d?(K=o.jsxs(Xo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:P,children:[M,H,U]}),t[92]=b,t[93]=P,t[94]=M,t[95]=H,t[96]=U,t[97]=d,t[98]=K):K=t[98];let Q;t[99]!==I||t[100]!==N||t[101]!==K?(Q=o.jsxs(Ee.Provider,{virtualMcpId:I,children:[N,K]},I),t[99]=I,t[100]=N,t[101]=K,t[102]=Q):Q=t[102];let ee;return t[103]!==S||t[104]!==E||t[105]!==Q?(ee=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:o.jsxs(Qt,{value:S,children:[E,Q]})}),t[103]=S,t[104]=E,t[105]=Q,t[106]=ee):ee=t[106],ee}function z1(){const t=W.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(L.Suspense,{fallback:o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Re,{size:20,className:"animate-spin text-muted-foreground"})}),children:o.jsx(Dg,{})}),t[0]=e):e=t[0],e}export{z1 as default,wn as useInsetContext};
|