decocms 3.112.2 → 3.112.3
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-CzIdrsPe.js → AlertCircle-BhSO5Twf.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-d-McfeTp.js → ArrowUpRight-DdpAwwxM.js} +1 -1
- package/dist/client/assets/{CheckCircle-CGWBWaF4.js → CheckCircle-Xk-HyAZE.js} +1 -1
- package/dist/client/assets/{ChevronDown-BSMOH4GN.js → ChevronDown-DjI9Ah6n.js} +1 -1
- package/dist/client/assets/{ChevronLeft-sTx1d03w.js → ChevronLeft-BFb1BrOh.js} +1 -1
- package/dist/client/assets/{ChevronRight-C5PSQAe8.js → ChevronRight-BAc41q_Y.js} +1 -1
- package/dist/client/assets/{ChevronUp-Cv3UG4VC.js → ChevronUp-UIn_3dHA.js} +1 -1
- package/dist/client/assets/{DotsVertical-QQbESzVQ.js → DotsVertical-Bvp1DFrg.js} +1 -1
- package/dist/client/assets/{Eye-BKfEBTR6.js → Eye-BcHeo8OC.js} +1 -1
- package/dist/client/assets/{FilterLines-jO13dYdi.js → FilterLines-YkqgITmY.js} +1 -1
- package/dist/client/assets/{Globe01-D-5I09_1.js → Globe01-D2j8m26P.js} +1 -1
- package/dist/client/assets/{Globe04-CxdBUmsy.js → Globe04-C2SZSHBy.js} +1 -1
- package/dist/client/assets/{HardDrive-BVAgx0xq.js → HardDrive-BSN492Hp.js} +1 -1
- package/dist/client/assets/{Key01-Duu4Kv4L.js → Key01-CvSwoCFY.js} +1 -1
- package/dist/client/assets/{LayoutLeft-DCkN0cQJ.js → LayoutLeft-B9LtoNr5.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BvKrBHVq.js → LinkExternal01-DuDM-dnL.js} +1 -1
- package/dist/client/assets/{Monitor01-Dgw5JUxQ.js → Monitor01-Qw5xJyG2.js} +1 -1
- package/dist/client/assets/{Palette-BUMNen50.js → Palette-ChkPBary.js} +1 -1
- package/dist/client/assets/{Play-eeHi-AX7.js → Play-IlsQDEUP.js} +1 -1
- package/dist/client/assets/{Plus-NToHlEg2.js → Plus-DVlEi_3L.js} +1 -1
- package/dist/client/assets/{SearchLg-CgBplEiw.js → SearchLg-BIORAwuK.js} +1 -1
- package/dist/client/assets/{SearchMd-6O6GiFiF.js → SearchMd-CTp_yTnU.js} +1 -1
- package/dist/client/assets/{Settings02-DbJL_Tra.js → Settings02-hQL04X7-.js} +1 -1
- package/dist/client/assets/{Shield01-Bmld8xSM.js → Shield01-D4MVNzZ5.js} +1 -1
- package/dist/client/assets/{Star01-DFQYfscL.js → Star01-DOH6S4RS.js} +1 -1
- package/dist/client/assets/{Stars01-BoU6NAMR.js → Stars01-D6kYyOXX.js} +1 -1
- package/dist/client/assets/{Stars02-Cr_Es7Gy.js → Stars02-Dg0VuXKP.js} +1 -1
- package/dist/client/assets/{Sun-C8ejLyiC.js → Sun-Bvs8Be4l.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-CtKf5tEe.js → SwitchHorizontal01-dHIjRjs4.js} +1 -1
- package/dist/client/assets/{Tool01-CQy-Zc7d.js → Tool01-C2Wy9ddS.js} +1 -1
- package/dist/client/assets/{Trash01-CuZl7D3Y.js → Trash01-ioK8wGcX.js} +1 -1
- package/dist/client/assets/{Upload01-Bu2c0ULj.js → Upload01-y8AitCX_.js} +1 -1
- package/dist/client/assets/{User01-B1FwGbIY.js → User01-CxvFJWlw.js} +1 -1
- package/dist/client/assets/{Users01-1DHq38re.js → Users01-DUhNk4D1.js} +1 -1
- package/dist/client/assets/{Users03-D27-2joB.js → Users03-B7IMqo7U.js} +1 -1
- package/dist/client/assets/{X-krPcwbrq.js → X-BJkEaciD.js} +1 -1
- package/dist/client/assets/{XCircle-D7jPFiCg.js → XCircle-DXiqmV8m.js} +1 -1
- package/dist/client/assets/{XClose-DOOshGb0.js → XClose-C-z27vFA.js} +1 -1
- package/dist/client/assets/{Zap-_qvpS23v.js → Zap-KSy73DcB.js} +1 -1
- package/dist/client/assets/{ZapSquare-duAEQmzm.js → ZapSquare-A7DF2PWn.js} +1 -1
- package/dist/client/assets/{ZoomOut-DxQk7sae.js → ZoomOut-Ci9Q3RHZ.js} +1 -1
- package/dist/client/assets/{access-gate-DQ-5adb6.js → access-gate-D-y_Un36.js} +1 -1
- package/dist/client/assets/{add-section-modal-DscBIlVV.js → add-section-modal-C28o5DHb.js} +1 -1
- package/dist/client/assets/{agent-icon-DtAe4QA2.js → agent-icon-1Cwh4hkP.js} +1 -1
- package/dist/client/assets/{agents-list-BufrhIEF.js → agents-list-BDxvVPHR.js} +1 -1
- package/dist/client/assets/{ai-providers-wBZ3SLkA.js → ai-providers-Bw8qaxG3.js} +1 -1
- package/dist/client/assets/{alert-Bqb0BjJT.js → alert-C0wZgcSN.js} +1 -1
- package/dist/client/assets/{alert-dialog-kSFMmJXm.js → alert-dialog-CwkyXqH2.js} +1 -1
- package/dist/client/assets/{app-editor-S0A3fVO6.js → app-editor-CpzykCGY.js} +1 -1
- package/dist/client/assets/{auth-gjnhTvi5.js → auth-DT4EIgFs.js} +1 -1
- package/dist/client/assets/{auth-catchall-CpuZPnRK.js → auth-catchall-xAKLrX26.js} +1 -1
- package/dist/client/assets/{auth-entry-DNxpDwip.js → auth-entry-sWJP_TqI.js} +1 -1
- package/dist/client/assets/{auth-split-layout-B0zk7ss2.js → auth-split-layout-Dy6_0L_d.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-B65Ekq8w.js → authenticate-and-persist-oauth-DtrjZzTS.js} +1 -1
- package/dist/client/assets/{automation-list-row-DBKSr9eM.js → automation-list-row-P--kLagS.js} +1 -1
- package/dist/client/assets/{automation-runs-Cnk8OYai.js → automation-runs-BpvA3NrO.js} +1 -1
- package/dist/client/assets/{automations-CCyN0FKF.js → automations-BGT2yM66.js} +1 -1
- package/dist/client/assets/{avatar-BUuVB0OM.js → avatar-W_lUBW2r.js} +1 -1
- package/dist/client/assets/{badge-CABvv7j-.js → badge-BDbhVtEB.js} +1 -1
- package/dist/client/assets/{block-document-CYVoCNLt.js → block-document-CJmNAwMu.js} +1 -1
- package/dist/client/assets/{brand-context-D8J7F3t6.js → brand-context-DYl2rk_W.js} +1 -1
- package/dist/client/assets/{buckets-GBgG4MM1.js → buckets-C8Wa8Wv3.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-DjLwsAYE.js → bulk-category-panel-DcIwXwO5.js} +1 -1
- package/dist/client/assets/{capability-load-error-CnsyVE7o.js → capability-load-error-XerfE3R8.js} +1 -1
- package/dist/client/assets/{card-yO9ahfyg.js → card-BJrMnoeO.js} +1 -1
- package/dist/client/assets/{category-editor-DZP_5nLU.js → category-editor-Cd95Vg43.js} +1 -1
- package/dist/client/assets/{chat-context-C2fQ7A44.js → chat-context-C5Dv0tTg.js} +1 -1
- package/dist/client/assets/{checkbox-BILJodYH.js → checkbox-367KGph9.js} +1 -1
- package/dist/client/assets/{cli-auth-success-BYzmXc5w.js → cli-auth-success-BpcbH0O5.js} +1 -1
- package/dist/client/assets/{collection-detail-lL9iMr3S.js → collection-detail-OCKyst3E.js} +1 -1
- package/dist/client/assets/{collection-display-button-C9f33xU-.js → collection-display-button-DCiLrK74.js} +1 -1
- package/dist/client/assets/{collection-search-DVOdXXKt.js → collection-search-DzlllM3V.js} +1 -1
- package/dist/client/assets/{collection-tabs-DrndLmnC.js → collection-tabs-BfUAY8z2.js} +1 -1
- package/dist/client/assets/{command-BofTZ1F3.js → command-CFE9B-sb.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-CIxOUzUM.js → commerce-onboarding-BSv7Ort3.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-DngfqiIJ.js → connect-desktop-dialog-B3FevdKG.js} +1 -1
- package/dist/client/assets/{connection-card-BDPLTIDM.js → connection-card-KOVkCaek.js} +1 -1
- package/dist/client/assets/{connection-detail-DdAAeESC.js → connection-detail-DMbJ1DTC.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-x5xuSAeR.js → connection-form-helpers-BEonMIwB.js} +1 -1
- package/dist/client/assets/{connections-wV2CJcDC.js → connections-GE9zibTJ.js} +1 -1
- package/dist/client/assets/{context-menu-BLm9Y433.js → context-menu-DGDyOrdt.js} +1 -1
- package/dist/client/assets/{decopilot-DSvGNCSl.js → decopilot-DbXK2c3g.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-BuXpbrkf.js → decopilot-sse-pool-CfHubug8.js} +1 -1
- package/dist/client/assets/{dialog-CauQU0Ef.js → dialog-CymwL5lO.js} +1 -1
- package/dist/client/assets/{domain-settings-CntnBgst.js → domain-settings-DjD_IFbk.js} +1 -1
- package/dist/client/assets/{drawer-MJc90PUb.js → drawer-Cb9A4OVK.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BO9nmkr0.js → dropdown-menu-DE9I1deT.js} +1 -1
- package/dist/client/assets/{empty-state-DBQumgnx.js → empty-state-B-swTT-U.js} +1 -1
- package/dist/client/assets/{extract-connection-data-DG-sAs8O.js → extract-connection-data-CIPj3tI0.js} +1 -1
- package/dist/client/assets/{file-explorer-DoJnoTKv.js → file-explorer-LWyCCj95.js} +1 -1
- package/dist/client/assets/{file-type-icon-DqM6AfOQ.js → file-type-icon-B2EgQ19E.js} +1 -1
- package/dist/client/assets/{files-pghQFWOW.js → files-6gxhhsbh.js} +1 -1
- package/dist/client/assets/{form-DCj2JfvE.js → form-CoZSZB1f.js} +1 -1
- package/dist/client/assets/{general-BcbkZBjA.js → general-CYnw3h5_.js} +1 -1
- package/dist/client/assets/{github-repo-picker-Cd3Pws2k.js → github-repo-picker-BBmy0ULl.js} +1 -1
- package/dist/client/assets/{hooks-B7-Sd1fa.js → hooks-lMbMn8Le.js} +1 -1
- package/dist/client/assets/{import-from-deco-dialog-DbIXkbY1.js → import-from-deco-dialog-X4L-3jNA.js} +1 -1
- package/dist/client/assets/{index--SasJUOp.js → index-BA1AFQeU.js} +1 -1
- package/dist/client/assets/{index-ChiAKgjP.js → index-BZc7xOAR.js} +1 -1
- package/dist/client/assets/{index-C0JR5_r6.js → index-Bq4DOwVe.js} +1 -1
- package/dist/client/assets/{index-Dq9YczfU.js → index-C7QerrAO.js} +1 -1
- package/dist/client/assets/{index-CP3QgKcT.js → index-CGtb2pr4.js} +1 -1
- package/dist/client/assets/{index-DOhgMQFz.js → index-CJs3lrz9.js} +1 -1
- package/dist/client/assets/{index-Dv9eD-aO.js → index-CLlAg9w2.js} +1 -1
- package/dist/client/assets/{index-DhoK-2ai.js → index-DX3jDFqO.js} +5 -5
- package/dist/client/assets/{index-Ce-NoXEp.js → index-D_UOP9mB.js} +3 -3
- package/dist/client/assets/{index-C6yeaOeV.js → index-Dh95wcQ-.js} +1 -1
- package/dist/client/assets/{index-Cuhw77u5.js → index-Dx6qXiIS.js} +1 -1
- package/dist/client/assets/{index-Dzd1H2zJ.js → index-deKJ9XUA.js} +1 -1
- package/dist/client/assets/{index-Ca2K5P2-.js → index-h2SiQ3aq.js} +1 -1
- package/dist/client/assets/{index-redirect-BnYKyihs.js → index-redirect-BToJCL7P.js} +1 -1
- package/dist/client/assets/{index-MOTjCtsp.js → index-z7ZyGnDz.js} +1 -1
- package/dist/client/assets/{input-BKRZkXBz.js → input-IN5HhQsQ.js} +1 -1
- package/dist/client/assets/{integration-icon-DYuoyOIy.js → integration-icon-Db4EBrGH.js} +1 -1
- package/dist/client/assets/{label-C0YeL6wH.js → label-BZIeDc6a.js} +1 -1
- package/dist/client/assets/{login-D9p80dck.js → login-DdD3jsKi.js} +1 -1
- package/dist/client/assets/{mcp-oauth-S-U-rwND.js → mcp-oauth-gzDzaR6G.js} +1 -1
- package/dist/client/assets/{members-DszpPi1H.js → members-D0uiwhCd.js} +1 -1
- package/dist/client/assets/{monaco-editor-DQY1vfLZ.js → monaco-editor-DqH1LGBG.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-dql-TpC9.js → monitoring-stats-row-C9GbdyOQ.js} +1 -1
- package/dist/client/assets/{oauth-callback-BfNdq5r1.js → oauth-callback-BxfGu7ZM.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-kAgnmyGz.js → oauth-callback-ai-provider-BpJvLn6m.js} +1 -1
- package/dist/client/assets/{onboarding-BGLkKtLC.js → onboarding-CIAHEUbt.js} +1 -1
- package/dist/client/assets/{org-install-D3-LsuMX.js → org-install-O69xRwHO.js} +1 -1
- package/dist/client/assets/{org-layout-DpwOyQmn.js → org-layout-QbuxyKYH.js} +1 -1
- package/dist/client/assets/{organization-choice-9oMWEkQK.js → organization-choice-lY7p5sF9.js} +1 -1
- package/dist/client/assets/{page-seo-form-j0YNQpjq.js → page-seo-form-BqB24Fq8.js} +1 -1
- package/dist/client/assets/page-seo-sheet-BVFZokRs.js +1 -0
- package/dist/client/assets/{popover-C5AnURrR.js → popover-BvQdvb3c.js} +1 -1
- package/dist/client/assets/{post-editor-oYbaNsAb.js → post-editor-C9-2-bmH.js} +1 -1
- package/dist/client/assets/{preview-dialog-pWz0CIeI.js → preview-dialog-D1BhMrVf.js} +1 -1
- package/dist/client/assets/{primitives-5RDDEPG8.js → primitives-F9M8Ipkb.js} +1 -1
- package/dist/client/assets/{profile-pxcuuKGt.js → profile-C2xswEnM.js} +1 -1
- package/dist/client/assets/project-app-view-PiMJBUWz.js +1 -0
- package/dist/client/assets/record-editor-BaLGETo0.js +1 -0
- package/dist/client/assets/registry-c3wnyfdK.js +2 -0
- package/dist/client/assets/{registry-layout-LspFswn9.js → registry-layout-Bnb9-rCG.js} +1 -1
- package/dist/client/assets/{require-capability-BtcCyvp2.js → require-capability-Dk3T3zYa.js} +1 -1
- package/dist/client/assets/{required-auth-layout-D9BQ_bkS.js → required-auth-layout-CUTn0kys.js} +1 -1
- package/dist/client/assets/{reset-password-JJRHjizg.js → reset-password-CBb5abSk.js} +1 -1
- package/dist/client/assets/{roles-BNXIauC5.js → roles-CiZrsv50.js} +1 -1
- package/dist/client/assets/{scroll-area-B1dVuptd.js → scroll-area-Dxw-E5II.js} +1 -1
- package/dist/client/assets/{search-input-CKyPfOaX.js → search-input-DkSLPibf.js} +1 -1
- package/dist/client/assets/{secrets-CuZqGbU_.js → secrets-Ddul9WIZ.js} +1 -1
- package/dist/client/assets/{sections-editor-BK1lVZRX.js → sections-editor-CW5bA2RP.js} +1 -1
- package/dist/client/assets/{select-DbTrJaBo.js → select-D6WRoyEz.js} +1 -1
- package/dist/client/assets/{select-model-CSFAIVDV.js → select-model-BeBUe7ya.js} +1 -1
- package/dist/client/assets/{seo-editor-IyNR_t_8.js → seo-editor-Cz4IeoUQ.js} +1 -1
- package/dist/client/assets/{settings-layout-C7XeWt4F.js → settings-layout-BvQvLYuh.js} +1 -1
- package/dist/client/assets/{settings-section-D4bBHif-.js → settings-section-CgcU6xm_.js} +1 -1
- package/dist/client/assets/{sheet-6SkVbWmm.js → sheet-JAvCyso3.js} +1 -1
- package/dist/client/assets/{shell-controls-CNdRw4ys.js → shell-controls-B2fE8psz.js} +1 -1
- package/dist/client/assets/{shell-layout-BElQaqKc.js → shell-layout-klpGsxrf.js} +1 -1
- package/dist/client/assets/{shell-route-loading-D4skwJ91.js → shell-route-loading-cmXdamAW.js} +1 -1
- package/dist/client/assets/{sidebar-DGRwDJha.js → sidebar-DdgOh6Z9.js} +1 -1
- package/dist/client/assets/{skeleton-DHhMjkBh.js → skeleton-DdzpHjCD.js} +1 -1
- package/dist/client/assets/{sortable.esm-CGtCzcgO.js → sortable.esm-DYJqg3G6.js} +1 -1
- package/dist/client/assets/{sso-ByvSA1mS.js → sso-BatvxI5G.js} +1 -1
- package/dist/client/assets/{store-BCYui8sK.js → store-Deoe0yK9.js} +1 -1
- package/dist/client/assets/store-registry-LMmG1Wms.js +2 -0
- package/dist/client/assets/{studio-tools-DxnrxOKS.js → studio-tools-CAjgBW6i.js} +1 -1
- package/dist/client/assets/{switch-BnwD-Vul.js → switch-C6POgRTK.js} +1 -1
- package/dist/client/assets/{table-JdBIMuie.js → table-BRFlo438.js} +1 -1
- package/dist/client/assets/{tabs-CVrrWuOo.js → tabs-86zaQtr4.js} +1 -1
- package/dist/client/assets/{task-status-DRnjxr-S.js → task-status-DhrCE0Pg.js} +1 -1
- package/dist/client/assets/{textarea-L85Stm8m.js → textarea-BXtqsNU_.js} +1 -1
- package/dist/client/assets/{toggle-group-CKJLwQaG.js → toggle-group-CjaKzFll.js} +1 -1
- package/dist/client/assets/{toolbar-Bd7T7QUb.js → toolbar-DGAhaLmi.js} +1 -1
- package/dist/client/assets/{tools-list-lOdvLoOI.js → tools-list-8hgiGZV6.js} +1 -1
- package/dist/client/assets/{tooltip-CA-iJjQ9.js → tooltip-BR6syT2S.js} +1 -1
- package/dist/client/assets/{types-BdkD4Vt1.js → types-DcxX5vjQ.js} +1 -1
- package/dist/client/assets/{use-ai-providers-B7gFggHS.js → use-ai-providers-BiVw9Yom.js} +1 -1
- package/dist/client/assets/{use-automations-DWMz324L.js → use-automations-Cg8Eoo8I.js} +1 -1
- package/dist/client/assets/{use-capability-j-lfCCNr.js → use-capability-C8IPuVtH.js} +1 -1
- package/dist/client/assets/{use-clock-tick-btodX9Hz.js → use-clock-tick-BnysYYmn.js} +1 -1
- package/dist/client/assets/{use-collections-O10oaKyl.js → use-collections-BrwR970o.js} +1 -1
- package/dist/client/assets/{use-connection-C9Oo2tfi.js → use-connection-B2ptAtQ1.js} +1 -1
- package/dist/client/assets/{use-copy-CqVa9v2d.js → use-copy-CyLGNLn_.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BrVJit7X.js → use-create-virtual-mcp-DurQg2m_.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-kUOeL1Jg.js → use-debounced-autosave-DEyHd5s5.js} +1 -1
- package/dist/client/assets/{use-debounced-value-C0aocxQX.js → use-debounced-value-CG92tvCS.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-CNKr7yO4.js → use-decopilot-events-Bg1nIm5P.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CcscTt90.js → use-delete-connection-COfumQMV.js} +1 -1
- package/dist/client/assets/{use-file-configs-D0F3KULW.js → use-file-configs-C5skVIUC.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-D7j-2mjA.js → use-infinite-scroll-CbmbBOhb.js} +1 -1
- package/dist/client/assets/{use-join-requests-DqD_eeW0.js → use-join-requests-DiNJOaXg.js} +1 -1
- package/dist/client/assets/{use-mcp-client-BZ22ytXH.js → use-mcp-client-DlyZEA3A.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-DyUPPXRK.js → use-mcp-prompts-pcmTb2GI.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-VtgecmTO.js → use-mcp-tools-DGxNZBda.js} +1 -1
- package/dist/client/assets/{use-members-BaYsXyZv.js → use-members-AyHbqHNZ.js} +1 -1
- package/dist/client/assets/{use-mobile-DTm06RLc.js → use-mobile-BZo7lvaH.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-Bn0KdHLf.js → use-navigate-to-agent-in-j_28j.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-WIl6LS5U.js → use-org-auth-client-JM5TXzj8.js} +1 -1
- package/dist/client/assets/{use-org-fs-CUQD3qsK.js → use-org-fs-DMkyivR7.js} +1 -1
- package/dist/client/assets/{use-org-sso-CnqlrZZr.js → use-org-sso-B3J5z-pj.js} +1 -1
- package/dist/client/assets/{use-organization-roles-BFiv0b61.js → use-organization-roles-YS5TrsWV.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BytjQVXP.js → use-organization-settings-CBu4ORjn.js} +1 -1
- package/dist/client/assets/{use-registry-connections-BbGinNTu.js → use-registry-connections-yFLwMSbr.js} +1 -1
- package/dist/client/assets/{use-secrets-CzI490qJ.js → use-secrets-CONYfnRB.js} +1 -1
- package/dist/client/assets/{use-status-sounds-CPkCcPZ0.js → use-status-sounds-CNvb3BK4.js} +1 -1
- package/dist/client/assets/{use-view-mode-Dyg-Wdla.js → use-view-mode-DPuZdDbm.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-LcXDAtF2.js → use-virtual-mcp-BeJfWraj.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-BafAnv-q.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-Cc6HzBdO.js +1 -0
- package/dist/client/assets/{useSuspenseQueries-BB0b4DLG.js → useSuspenseQueries-DcwQR2IM.js} +1 -1
- package/dist/client/assets/{variant-calendar-D0H5SdJZ.js → variant-calendar-Dh2N1MTd.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-ZMapCEcm.js → view-mode-toggle-Y9k5agR3.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +422 -422
- package/dist/server/server.js +289 -289
- package/package.json +1 -1
- package/dist/client/assets/page-seo-sheet-DT8ezixQ.js +0 -1
- package/dist/client/assets/project-app-view-CtOp7U5d.js +0 -1
- package/dist/client/assets/record-editor-Dpmj_Qj3.js +0 -1
- package/dist/client/assets/registry-Dzzrs-kB.js +0 -2
- package/dist/client/assets/store-registry-B0TnpYie.js +0 -2
- package/dist/client/assets/useInfiniteQuery-DdrjKh-2.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CXyQS01C.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{m as qe,r as j,ar as qs,ap as Ks,c as O,D as de,l as U,j as s,E as Qs,t as le,o as ye,aD as Ys,s as Re,aE as Pt,L as Hs,B as re,p as Gs,n as Ws,aF as Js,aG as Zs,J as De,af as Xs,aH as Oe,aI as Jt,b as ot,d as Mt,v as G,aJ as er,a8 as En,a7 as tr,F as nr,aK as sr,a as Rn,aL as rr,aM as Tn,aN as or,aO as ue,aP as bt,aQ as ar,aR as lr,aS as vt,aT as ir,aU as cr,aV as dr,aW as ur,q as Vr,K as Ee,aX as fr,aY as mr,aZ as pr,a_ as hr,a$ as Dn,b0 as ze,k as xr,i as gr,ag as Pn}from"./index-Ce-NoXEp.js";import{a as Mn,n as br}from"./SwitchHorizontal01-CtKf5tEe.js";import{b as he,u as Pe,S as Nt,c as at,a as Fn,e as $n,s as vr,f as yr,g as Ar,h as jr,i as On,A as wr,j as Sr,k as Cr}from"./chat-context-C2fQ7A44.js";import{j as Ln,s as lt,g as me,P as Ze,k as Ft,t as Nr,l as kr,M as _r,m as Ir,n as Xe,o as zn,p as Er,D as Rr,q as Tr,r as Dr,v as Te,w as Pr,d as Mr,x as Fr,y as $t,z as $r,F as Or,i as Lr,E as zr,c as Br,A as Ur,B as qr,H as Kr,I as Qr,J as Zt}from"./scroll-area-B1dVuptd.js";import{c as kt,a as xe,b as ge,T as be}from"./tooltip-CA-iJjQ9.js";import{c as it,a as ct,d as dt,e as ut,b as Ot}from"./dialog-CauQU0Ef.js";import{c as Yr,b as Hr,a as Gr,D as Wr}from"./drawer-MJc90PUb.js";import{C as Jr}from"./collection-search-DVOdXXKt.js";import{u as Zr}from"./use-mobile-DTm06RLc.js";import{a as Vt,u as Me,S as Xr,i as Xt}from"./use-mcp-client-BZ22ytXH.js";import{u as eo,g as ft,l as _t}from"./use-mcp-prompts-DyUPPXRK.js";import{t as mt}from"./ChevronDown-BSMOH4GN.js";import{i as _e}from"./X-krPcwbrq.js";import{t as to,z as no,u as so,w as ro,A as oo}from"./hooks-B7-Sd1fa.js";import{K as ao,i as lo}from"./shell-layout-BElQaqKc.js";import{u as io,a as co}from"./use-virtual-mcp-LcXDAtF2.js";import{n as Bn}from"./ZapSquare-duAEQmzm.js";import{i as Ke}from"./ChevronUp-Cv3UG4VC.js";import{s as Un}from"./Star01-DFQYfscL.js";import{a as qn}from"./Tool01-CQy-Zc7d.js";import{ad as pt,x as uo,a5 as Kn,ae as Vo,A as Qn,g as Ge,j as fo,a7 as mo,af as po,C as ho,ag as Yn,ah as xo,ai as go,c as Hn}from"./agent-icon-DtAe4QA2.js";import{i as bo}from"./Upload01-Bu2c0ULj.js";import{i as Gn}from"./AlertCircle-CzIdrsPe.js";import{a as vo}from"./Eye-BKfEBTR6.js";import{a as It,b as Lt,d as zt,e as Bt,F as Wn}from"./form-DCj2JfvE.js";import{S as yo,d as Ao,a as jo,b as wo,c as So}from"./select-DbTrJaBo.js";import{b as Co}from"./Settings02-DbJL_Tra.js";import{i as Jn,t as Et,b as No}from"./XCircle-D7jPFiCg.js";import{b as ko,c as _o}from"./tabs-CVrrWuOo.js";import{T as Zn,a as et}from"./toggle-group-CKJLwQaG.js";import{I as Xn}from"./input-BKRZkXBz.js";import{u as es,a as Io,g as Eo,A as Ro}from"./sortable.esm-CGtCzcgO.js";import{u as ts}from"./studio-tools-DxnrxOKS.js";import{i as Ut}from"./Monitor01-Dgw5JUxQ.js";import{u as ns,C as To,a as ss,b as rs}from"./connect-desktop-dialog-DngfqiIJ.js";import{s as Do}from"./XClose-DOOshGb0.js";import{m as ht,i as Po,g as os,a as Mo,N as Fo}from"./decopilot-DSvGNCSl.js";import{P as qt,a as Kt,b as Qt}from"./popover-C5AnURrR.js";import{e as en,a as tn,g as $o,b as Oo,C as Lo,c as zo,d as Bo}from"./command-BofTZ1F3.js";import{u as Uo}from"./useInfiniteQuery-DdrjKh-2.js";import{t as qo}from"./Stars01-BoU6NAMR.js";import{g as Ko,h as Qo}from"./use-org-fs-CUQD3qsK.js";import{D as Yo,a as Ho,b as Go,c as fe,d as nn,e as sn,f as rn,j as Wo,i as Jo}from"./dropdown-menu-BO9nmkr0.js";import{s as on}from"./Plus-NToHlEg2.js";import{p as Zo,q as Xo}from"./question-004-sINsf4GQ.js";import{i as ea}from"./ChevronRight-C5PSQAe8.js";function ta(t,e){const n=qe(e);return na({filters:{...t,status:"pending"}},n).length}function an(t,e){return t.findAll(e.filters).map(n=>e.select?e.select(n):n.state)}function na(t={},e){const n=qe(e).getMutationCache(),r=j.useRef(t),o=j.useRef(null);return o.current===null&&(o.current=an(n,t)),j.useEffect(()=>{r.current=t}),j.useSyncExternalStore(j.useCallback(a=>n.subscribe(()=>{const l=qs(o.current,an(n,r.current));o.current!==l&&(o.current=l,Ks.schedule(a))}),[n]),()=>o.current,()=>o.current)}const ln=3,as="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",sa="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function ls(t){const e=O.c(46),{item:n,onSelect:r,isLoading:o,isDisabled:a,variant:l}=t,c=l===void 0?"pill":l,{prompt:d}=n;let u;if(e[0]!==d._meta||e[1]!==d.name||e[2]!==d.title){const y=me(d._meta);u=d.title??Ft(d.name,y),e[0]=d._meta,e[1]=d.name,e[2]=d.title,e[3]=u}else u=e[3];const V=u,i=d.description||null;if(c==="card"){let y;e[4]!==r||e[5]!==d?(y=()=>r(d),e[4]=r,e[5]=d,e[6]=y):y=e[6];const C=a||o,k=o&&"bg-accent/40",_=(a||o)&&"cursor-not-allowed opacity-50";let E;e[7]!==k||e[8]!==_?(E=U(sa,"hover:bg-accent/60 text-foreground",k,_),e[7]=k,e[8]=_,e[9]=E):E=e[9];let D;e[10]!==V?(D=s.jsx("span",{className:"font-medium truncate capitalize",children:V}),e[10]=V,e[11]=D):D=e[11];let T;e[12]!==o?(T=o&&s.jsx(Nt,{size:"xs"}),e[12]=o,e[13]=T):T=e[13];let N;e[14]!==D||e[15]!==T?(N=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[D,T]}),e[14]=D,e[15]=T,e[16]=N):N=e[16];let M;e[17]!==i?(M=i&&s.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:i}),e[17]=i,e[18]=M):M=e[18];let I;return e[19]!==N||e[20]!==M||e[21]!==y||e[22]!==C||e[23]!==E?(I=s.jsxs("button",{type:"button",onClick:y,disabled:C,className:E,children:[N,M]}),e[19]=N,e[20]=M,e[21]=y,e[22]=C,e[23]=E,e[24]=I):I=e[24],I}let m;e[25]!==r||e[26]!==d?(m=()=>r(d),e[25]=r,e[26]=d,e[27]=m):m=e[27];const f=a||o,h=o&&"bg-muted/50",p=(a||o)&&"cursor-not-allowed opacity-50";let x;e[28]!==h||e[29]!==p?(x=U(as,"hover:bg-muted/70 hover:text-foreground",h,p),e[28]=h,e[29]=p,e[30]=x):x=e[30];let b;e[31]!==V?(b=s.jsx("span",{className:"capitalize",children:V}),e[31]=V,e[32]=b):b=e[32];let g;e[33]!==o?(g=o&&s.jsx(Nt,{size:"xs"}),e[33]=o,e[34]=g):g=e[34];let v;e[35]!==m||e[36]!==f||e[37]!==x||e[38]!==b||e[39]!==g?(v=s.jsx(xe,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:m,disabled:f,className:x,children:[b,g]})}),e[35]=m,e[36]=f,e[37]=x,e[38]=b,e[39]=g,e[40]=v):v=e[40];const w=i??V;let S;e[41]!==w?(S=s.jsx(ge,{side:"top",className:"max-w-xs",children:s.jsx("p",{className:"text-xs",children:w})}),e[41]=w,e[42]=S):S=e[42];let A;return e[43]!==v||e[44]!==S?(A=s.jsxs(be,{delayDuration:400,children:[v,S]}),e[43]=v,e[44]=S,e[45]=A):A=e[45],A}function ra(t){const e=O.c(41),{items:n,open:r,onOpenChange:o,onSelect:a,loadingPrompt:l}=t,[c,d]=j.useState(""),u=!!l;let V;e[0]!==n||e[1]!==c?(V=c.trim()?n.filter(C=>{const k=c.toLowerCase();return C.prompt.name.toLowerCase().includes(k)||(C.prompt.title??"").toLowerCase().includes(k)||(C.prompt.description??"").toLowerCase().includes(k)}):n,e[0]=n,e[1]=c,e[2]=V):V=e[2];const i=V,m=Zr();let f;e[3]!==i.length||e[4]!==c?(f=i.length===0&&s.jsxs("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:["No prompts match “",c,"”"]}),e[3]=i.length,e[4]=c,e[5]=f):f=e[5];let h;if(e[6]!==i||e[7]!==u||e[8]!==l?.name||e[9]!==o||e[10]!==a){let C;e[12]!==u||e[13]!==l?.name||e[14]!==o||e[15]!==a?(C=k=>s.jsx(ls,{item:k,variant:"card",onSelect:_=>{o(!1),a(_)},isLoading:l?.name===k.prompt.name,isDisabled:u&&l?.name!==k.prompt.name},k.prompt.name),e[12]=u,e[13]=l?.name,e[14]=o,e[15]=a,e[16]=C):C=e[16],h=i.map(C),e[6]=i,e[7]=u,e[8]=l?.name,e[9]=o,e[10]=a,e[11]=h}else h=e[11];let p;e[17]!==f||e[18]!==h?(p=s.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[f,h]})}),e[17]=f,e[18]=h,e[19]=p):p=e[19];const x=p;let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=C=>{C.key==="Escape"&&d("")},e[20]=b):b=e[20];let g;e[21]!==c?(g=s.jsx(Jr,{value:c,onChange:d,placeholder:"Search prompts...",onKeyDown:b}),e[21]=c,e[22]=g):g=e[22];const v=g;if(m){let C;e[23]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(Yr,{className:"sr-only",children:s.jsx(Hr,{children:"All prompts"})}),e[23]=C):C=e[23];let k;e[24]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[24]=k):k=e[24];let _;e[25]!==x||e[26]!==v?(_=s.jsxs(Gr,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[C,k,v,x]}),e[25]=x,e[26]=v,e[27]=_):_=e[27];let E;return e[28]!==o||e[29]!==r||e[30]!==_?(E=s.jsx(kt,{delayDuration:400,children:s.jsx(Wr,{open:r,onOpenChange:o,children:_})}),e[28]=o,e[29]=r,e[30]=_,e[31]=E):E=e[31],E}let w;e[32]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(it,{className:"sr-only",children:s.jsx(ct,{children:"All prompts"})}),e[32]=w):w=e[32];let S;e[33]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[33]=S):S=e[33];let A;e[34]!==x||e[35]!==v?(A=s.jsxs(dt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[w,S,v,x]}),e[34]=x,e[35]=v,e[36]=A):A=e[36];let y;return e[37]!==o||e[38]!==r||e[39]!==A?(y=s.jsx(kt,{delayDuration:400,children:s.jsx(ut,{open:r,onOpenChange:o,children:A})}),e[37]=o,e[38]=r,e[39]=A,e[40]=y):y=e[40],y}function oa(t){const e=O.c(29),{items:n,onSelect:r,loadingPrompt:o,className:a}=t,[l,c]=j.useState(!1);if(n.length===0)return null;let d,u,V;if(e[0]!==n||e[1]!==o||e[2]!==r){const b=n.slice(0,ln);let g;e[6]!==n?(g=n.slice(ln),e[6]=n,e[7]=g):g=e[7],d=g,u=!!o;let v;e[8]!==u||e[9]!==o?.name||e[10]!==r?(v=w=>s.jsx(ls,{item:w,onSelect:r,isLoading:o?.name===w.prompt.name,isDisabled:u&&o?.name!==w.prompt.name},w.prompt.name),e[8]=u,e[9]=o?.name,e[10]=r,e[11]=v):v=e[11],V=b.map(v),e[0]=n,e[1]=o,e[2]=r,e[3]=d,e[4]=u,e[5]=V}else d=e[3],u=e[4],V=e[5];const i=V;let m;e[12]!==a?(m=U("w-full flex flex-wrap gap-2 justify-center",a),e[12]=a,e[13]=m):m=e[13];let f;e[14]!==d.length||e[15]!==u?(f=d.length>0&&s.jsxs("button",{type:"button",disabled:u,onClick:()=>c(!0),className:U(as,"hover:bg-muted/70 hover:text-foreground",u&&"opacity-50 cursor-not-allowed"),children:["+",d.length," more"]}),e[14]=d.length,e[15]=u,e[16]=f):f=e[16];let h;e[17]!==i||e[18]!==m||e[19]!==f?(h=s.jsxs("div",{className:m,children:[i,f]}),e[17]=i,e[18]=m,e[19]=f,e[20]=h):h=e[20];let p;e[21]!==n||e[22]!==o||e[23]!==l||e[24]!==r?(p=s.jsx(ra,{items:n,open:l,onOpenChange:c,onSelect:r,loadingPrompt:o}),e[21]=n,e[22]=o,e[23]=l,e[24]=r,e[25]=p):p=e[25];let x;return e[26]!==h||e[27]!==p?(x=s.jsxs(kt,{delayDuration:400,children:[h,p]}),e[26]=h,e[27]=p,e[28]=x):x=e[28],x}function aa(){return null}function la(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function ia(t){const e=O.c(30),{connectionId:n}=t,{sendMessage:r}=Pe(),{org:o}=de();let a;e[0]!==n||e[1]!==o.id||e[2]!==o.slug?(a={connectionId:n,orgId:o.id,orgSlug:o.slug},e[0]=n,e[1]=o.id,e[2]=o.slug,e[3]=a):a=e[3];const l=Me(a);let c;e[4]!==l?(c={client:l,staleTime:6e4},e[4]=l,e[5]=c):c=e[5];const{data:d}=eo(c);let u;e[6]!==d?.prompts?(u=d?.prompts??[],e[6]=d?.prompts,e[7]=u):u=e[7];const V=u;let i;e[8]!==V?(i=V.map(ca),e[8]=V,e[9]=i):i=e[9];const m=i;let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f={stage:"idle"},e[10]=f):f=e[10];const[h,p]=j.useReducer(la,f),[x,b]=j.useState(null);let g;e[11]!==l||e[12]!==r?(g=async(T,N)=>{if(!l){le.error("MCP client not available"),p({type:"RESET"});return}try{const M=await ft(l,T.name,N);p({type:"RESET"});const I={type:"doc",content:[{type:"paragraph",content:[Ln({id:T.name,name:lt(T.name,me(T._meta)),metadata:M.messages,char:"/",kind:"prompt",args:N}),{type:"text",text:" "}]}]};await r(I)}catch(M){console.error("[ice-breakers] Failed to fetch prompt:",M),le.error("Failed to load prompt. Please try again."),p({type:"RESET"})}},e[11]=l,e[12]=r,e[13]=g):g=e[13];const v=g;let w;e[14]!==v?(w=async T=>{if(T.arguments&&T.arguments.length>0){p({type:"SELECT_PROMPT",prompt:T}),b(T);return}p({type:"START_LOADING",prompt:T}),await v(T)},e[14]=v,e[15]=w):w=e[15];const S=w;let A;e[16]!==x||e[17]!==v?(A=async T=>{x&&(p({type:"START_LOADING",prompt:x,arguments:T}),b(null),await v(x,T))},e[16]=x,e[17]=v,e[18]=A):A=e[18];const y=A;if(m.length===0)return null;const C=h.stage==="loading"?h.prompt:null;let k;e[19]!==S||e[20]!==m||e[21]!==C?(k=s.jsx(oa,{items:m,onSelect:S,loadingPrompt:C}),e[19]=S,e[20]=m,e[21]=C,e[22]=k):k=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=()=>{b(null),p({type:"RESET"})},e[23]=_):_=e[23];let E;e[24]!==x||e[25]!==y?(E=s.jsx(Ze,{prompt:x,setPrompt:_,onSubmit:y}),e[24]=x,e[25]=y,e[26]=E):E=e[26];let D;return e[27]!==k||e[28]!==E?(D=s.jsxs(s.Fragment,{children:[k,E]}),e[27]=k,e[28]=E,e[29]=D):D=e[29],D}function ca(t){return{prompt:t}}function da(t){const e=O.c(13),{className:n}=t,{selectedVirtualMcp:r}=he(),{org:o}=de();let a;e[0]!==o.id?(a=Vt(o.id),e[0]=o.id,e[1]=a):a=e[1];const l=a.id,c=r?.id??l;let d;e[2]!==n?(d=U("w-full @container",n),e[2]=n,e[3]=d):d=e[3];const u=c??"default";let V;e[4]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx(aa,{}),e[4]=V):V=e[4];let i;e[5]!==c?(i=s.jsx(ia,{connectionId:c}),e[5]=c,e[6]=i):i=e[6];let m;e[7]!==u||e[8]!==i?(m=s.jsx(Qs,{fallback:null,children:s.jsx(j.Suspense,{fallback:V,children:i},u)}),e[7]=u,e[8]=i,e[9]=m):m=e[9];let f;return e[10]!==d||e[11]!==m?(f=s.jsx("div",{className:d,children:m}),e[10]=d,e[11]=m,e[12]=f):f=e[12],f}const yt="cubic-bezier(0.645, 0.045, 0.355, 1)",ua=44,Va={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-amber-500/5 after:pointer-events-none after:-z-10"},fa={default:"border-border",error:"border-destructive/30",warning:"border-amber-500/30"},ma={default:"text-muted-foreground",error:"text-destructive",warning:"text-amber-600 dark:text-amber-500"};function pe(t){const e=O.c(61),{icon:n,label:r,count:o,title:a,footerLeft:l,footerRight:c,children:d,defaultExpanded:u,variant:V,onClose:i}=t,m=V===void 0?"default":V,[f,h]=j.useState(u),[p,x]=j.useState(!1);let b;e[0]!==i?(b=()=>{x(!0),i?.()},e[0]=i,e[1]=b):b=e[1];const g=b;if(p)return null;const v=fa[m],w=Va[m];let S;e[2]!==v||e[3]!==w?(S=U("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",v,w),e[2]=v,e[3]=w,e[4]=S):S=e[4];let A;e[5]===Symbol.for("react.memo_cache_sentinel")?(A=()=>h(pa),e[5]=A):A=e[5];const y=f&&"rounded-b-none",C=!f&&"rounded-b-xl";let k;e[6]!==y||e[7]!==C?(k=U("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",y,C),e[6]=y,e[7]=C,e[8]=k):k=e[8];const _=ma[m];let E;e[9]!==_?(E=U("shrink-0",_),e[9]=_,e[10]=E):E=e[10];let D;e[11]!==n||e[12]!==E?(D=s.jsx("span",{className:E,children:n}),e[11]=n,e[12]=E,e[13]=D):D=e[13];let T;e[14]!==r?(T=s.jsx("span",{className:"flex-1 min-w-0 truncate",children:r}),e[14]=r,e[15]=T):T=e[15];let N;e[16]!==o?(N=o?s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:o}):null,e[16]=o,e[17]=N):N=e[17];const M=f?"rotate(180deg)":"rotate(0deg)";let I;e[18]!==M?(I=s.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:s.jsx(mt,{size:16,style:{transform:M,transition:`transform 180ms ${yt}`}})}),e[18]=M,e[19]=I):I=e[19];let P,R;e[20]!==g?(P=se=>{se.stopPropagation(),g()},R=se=>{(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),se.stopPropagation(),g())},e[20]=g,e[21]=P,e[22]=R):(P=e[21],R=e[22]);let $;e[23]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(_e,{size:16}),e[23]=$):$=e[23];let z;e[24]!==P||e[25]!==R?(z=s.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":"Close",title:"Close",onClick:P,onKeyDown:R,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:$}),e[24]=P,e[25]=R,e[26]=z):z=e[26];let L;e[27]!==f||e[28]!==D||e[29]!==T||e[30]!==N||e[31]!==I||e[32]!==z||e[33]!==k?(L=s.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":f,onClick:A,className:k,children:[D,T,N,I,z]}),e[27]=f,e[28]=D,e[29]=T,e[30]=N,e[31]=I,e[32]=z,e[33]=k,e[34]=L):L=e[34];const q=f?"1fr":"0fr";let K;e[35]!==q?(K={display:"grid",gridTemplateRows:q,transition:`grid-template-rows 180ms ${yt}`},e[35]=q,e[36]=K):K=e[36];let Q;e[37]===Symbol.for("react.memo_cache_sentinel")?(Q={overflow:"hidden",minHeight:0},e[37]=Q):Q=e[37];const F=f?1:0;let B;e[38]!==F?(B={opacity:F,transition:`opacity 120ms ${yt}`},e[38]=F,e[39]=B):B=e[39];let Y;e[40]!==a?(Y=a?s.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:s.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:a})}):s.jsx("div",{className:"border-t border-dashed border-border/60"}),e[40]=a,e[41]=Y):Y=e[41];let H;e[42]!==d||e[43]!==a?(H=d?s.jsx("div",{className:U("overflow-clip pb-4",!a&&"pt-4"),children:d}):null,e[42]=d,e[43]=a,e[44]=H):H=e[44];let Z;e[45]!==l||e[46]!==c?(Z=l||c?s.jsx("div",{className:"border-t border-border px-3 py-3 pb-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:l}),s.jsx("div",{className:"flex items-center gap-2",children:c})]})}):null,e[45]=l,e[46]=c,e[47]=Z):Z=e[47];let X;e[48]!==B||e[49]!==Y||e[50]!==H||e[51]!==Z?(X=s.jsx("div",{style:Q,children:s.jsxs("div",{style:B,children:[Y,H,Z]})}),e[48]=B,e[49]=Y,e[50]=H,e[51]=Z,e[52]=X):X=e[52];let ee;e[53]!==K||e[54]!==X?(ee=s.jsx("div",{"data-testid":"collapsible-highlight-body",style:K,children:X}),e[53]=K,e[54]=X,e[55]=ee):ee=e[55];let te;return e[56]!==L||e[57]!==ee||e[58]!==S||e[59]!==m?(te=s.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":m,className:S,children:[L,ee]}),e[56]=L,e[57]=ee,e[58]=S,e[59]=m,e[60]=te):te=e[60],te}function pa(t){return!t}const ha=ye({content:Re().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Pt(["pending","in_progress","completed"]),activeForm:Re().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),is=ye({todos:Ys(ha)}),xa="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";to({description:xa,inputSchema:no(is),execute:async({todos:t})=>({ok:!0,count:t.length})});const ga="tool-todo_write",ba=new Set(["input-available","output-available"]);function cs(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n.role!=="assistant")continue;const r=n.parts;if(Array.isArray(r))for(let o=r.length-1;o>=0;o--){const a=r[o];if(a.type!==ga||typeof a.state!="string"||!ba.has(a.state))continue;const l=is.safeParse(a.input);if(l.success)return l.data.todos}}return[]}function ds(t){const e=[];for(const n of t)if("state"in n&&n.state==="approval-requested"&&"approval"in n&&n.approval?.id&&"toolCallId"in n&&n.toolCallId){const r="toolName"in n&&typeof n.toolName=="string"?n.toolName:n.type.startsWith("tool-")?n.type.replace("tool-",""):"Tool";e.push({approvalId:n.approval.id,toolCallId:n.toolCallId,toolName:r,friendlyName:Nr(kr(r)),input:n.input})}return e}function us(t){const e=[];for(const n of t)if("type"in n&&n.type==="tool-propose_plan"&&"state"in n&&n.state==="input-available"&&"toolCallId"in n&&"input"in n){const r=n.input;e.push({toolCallId:n.toolCallId,plan:r.plan,state:n.state})}return e}function va(t){return t?t.message.startsWith("[CREDITS]"):!1}const ya={isCreditExhausted:!1,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1};function Aa(t){const{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=t;if(!o&&n&&va(n))return{...ya,isCreditExhausted:!0};const l=e.at(-1),c=l?.role==="assistant"?l.parts:[],d=c,V=!!d.filter(v=>v.type==="tool-user_ask").filter(v=>v.state!=="output-available").length,i=us(c),m=ds(d),f=cs(e),h=!o&&!!n,p=m.length>0||o&&a,x=i.length>0,g=!o&&!!r&&r!=="stop"&&!(r==="tool-calls"&&(V||p||x))&&!h;return{isCreditExhausted:!1,hasTodos:f.length>0,showError:h,showWarning:g,hasApprovals:p,hasPlans:x,isWaitingForUserInput:V}}function Vs(){const t=O.c(6),{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=Pe(),l=n??null,c=r??null;let d;return t[0]!==o||t[1]!==a||t[2]!==e||t[3]!==l||t[4]!==c?(d=Aa({messages:e,error:l,finishReason:c,isStreaming:o,isWaitingForApprovals:a}),t[0]=o,t[1]=a,t[2]=e,t[3]=l,t[4]=c,t[5]=d):d=t[5],d}function ja(){const t=Vs();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function fs(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(n=>n.type==="hardBreak"||n.type==="text"&&(!n.text||n.text.trim()==="")):!1)}const wa="__home__";function Yt(t,e){return Hs.chatDraft(t,e)}function Sa(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const n=e.tiptapDoc;return!n||typeof n!="object"||n.type!=="doc"||!Array.isArray(n.content)?null:n}function Ca(t,e,n,r,o){const a=Yt(e,n);if(fs(r)){t.removeItem(a);return}const l={tiptapDoc:r,updatedAt:Date.now()},c=JSON.stringify(l);try{t.setItem(a,c)}catch(d){if(ka(d)){const u=new TextEncoder().encode(c).byteLength;o?.onQuotaExceeded?.({docSizeBytes:u});return}throw d}}function cn(t,e,n){const r=Yt(e,n),o=t.getItem(r),a=Sa(o);return o!==null&&a===null&&t.removeItem(r),a}function Na(t,e,n){t.removeItem(Yt(e,n))}function ka(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function _a(t){const e=O.c(21),{current:n,total:r,onPrev:o,onNext:a}=t;if(r<=1)return null;const l=n===0,c=n===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let d;e[0]!==c?(d=U("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Co,{size:14}),e[2]=u):u=e[2];let V;e[3]!==o||e[4]!==l||e[5]!==d?(V=s.jsx("button",{type:"button",onClick:o,disabled:l,className:d,"aria-label":"Previous question",children:u}),e[3]=o,e[4]=l,e[5]=d,e[6]=V):V=e[6];const i=n+1;let m;e[7]!==i||e[8]!==r?(m=s.jsxs("span",{className:"tabular-nums text-xs",children:[i," of ",r]}),e[7]=i,e[8]=r,e[9]=m):m=e[9];const f=n===r-1,h=n===r-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let p;e[10]!==h?(p=U("p-0.5 rounded transition-colors",h),e[10]=h,e[11]=p):p=e[11];let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Jn,{size:14}),e[12]=x):x=e[12];let b;e[13]!==a||e[14]!==p||e[15]!==f?(b=s.jsx("button",{type:"button",onClick:a,disabled:f,className:p,"aria-label":"Next question",children:x}),e[13]=a,e[14]=p,e[15]=f,e[16]=b):b=e[16];let g;return e[17]!==b||e[18]!==V||e[19]!==m?(g=s.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[V,m,b]}),e[17]=b,e[18]=V,e[19]=m,e[20]=g):g=e[20],g}function ms(t){const e=O.c(8),{currentIndex:n,total:r,onPrev:o,onNext:a,extraLeft:l}=t;let c;e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==r?(c=s.jsx(_a,{current:n,total:r,onPrev:o,onNext:a}),e[0]=n,e[1]=a,e[2]=o,e[3]=r,e[4]=c):c=e[4];let d;return e[5]!==l||e[6]!==c?(d=s.jsxs("div",{className:"flex items-center gap-2",children:[c,l]}),e[5]=l,e[6]=c,e[7]=d):d=e[7],d}function Ia(t){const e=O.c(17),{isStreaming:n,isAllAnswered:r,isCurrentAnswered:o,onAdvanceOrSubmit:a,submitLabel:l,nextLabel:c}=t,V=r?l===void 0?"Submit":l:c===void 0?"Next":c,i=r?n:!o,m=i?r?"Waiting for the assistant to finish…":"Answer this item to continue":null;let f;e[0]!==i||e[1]!==a?(f=()=>{i||a()},e[0]=i,e[1]=a,e[2]=f):f=e[2];const h=i&&"opacity-50 cursor-not-allowed";let p;e[3]!==h?(p=U("h-7 px-2.5 text-xs",h),e[3]=h,e[4]=p):p=e[4];let x;e[5]!==i||e[6]!==V||e[7]!==f||e[8]!==p?(x=s.jsx(re,{type:"button",size:"sm","aria-disabled":i,onClick:f,className:p,children:V}),e[5]=i,e[6]=V,e[7]=f,e[8]=p,e[9]=x):x=e[9];const b=x;if(!m)return b;let g;e[10]!==b?(g=s.jsx(xe,{asChild:!0,children:b}),e[10]=b,e[11]=g):g=e[11];let v;e[12]!==m?(v=s.jsx(ge,{children:m}),e[12]=m,e[13]=v):v=e[13];let w;return e[14]!==g||e[15]!==v?(w=s.jsxs(be,{children:[g,v]}),e[14]=g,e[15]=v,e[16]=w):w=e[16],w}function ps(t,e,n){return t.findIndex(r=>e(r)===n)}function dn(t,e,n,r){return t.length===0?!1:t.every(o=>r(n[e(o)]))}function un(t,e,n,r,o){if(t.length===0)return null;const a=ps(t,e,o);for(let l=1;l<=t.length;l++){const c=t[(a+l)%t.length];if(!c)continue;const d=e(c);if(d!==o&&!r(n[d]))return d}return null}function Ea(t){return!t.isStreaming&&t.allAnswered}function hs(t){const{parts:e,partKey:n,schema:r,defaultValues:o,isStreaming:a,hasAnswer:l,onSubmit:c}=t,d=e[0]?n(e[0]):"",[u,V]=j.useState(d),[i,m]=j.useState(!1),f=Gs({resolver:Ws(r),defaultValues:o}),h=f.watch(),p=ps(e,n,u),x=p>=0?e[p]:void 0,b=l(h[u]),g=dn(e,n,h,l),v=Ea({isStreaming:a,allAnswered:g}),w=()=>{if(p>0){const E=e[p-1];E&&V(n(E))}},S=()=>{if(p>=0&&p<e.length-1){const E=e[p+1];E&&V(n(E))}},A=()=>{const E=f.getValues(),D=un(e,n,E,l,u);D&&V(D)},y=()=>{f.handleSubmit(E=>{const D=E;for(const T of e)c(T,D[n(T)])})()},C=j.useRef(y);C.current=y;const k=()=>{v&&(m(!1),C.current())},_=()=>{const E=f.getValues();if(dn(e,n,E,l)){if(a){m(!0);return}m(!1),C.current()}else{const D=un(e,n,E,l,u);D&&V(D)}};return j.useEffect(()=>{if(i&&!a){if(!g){m(!1);return}m(!1),C.current()}},[i,a,g]),{form:f,activeKey:u,setActiveKey:V,currentIndex:p,currentPart:x,isCurrentAnswered:b,isAllAnswered:g,canSubmit:v,goPrev:w,goNext:S,advanceToNextUnanswered:A,submit:k,submitOrAdvance:_}}const xs="User denied this tool call, give other alternatives.";function gs(t){const e=O.c(9),{onYolo:n}=t,[r,o]=De();let a;e[0]!==n||e[1]!==r||e[2]!==o?(a=V=>{const i=V,m=r.toolApprovalLevel??"readonly";o({...r,toolApprovalLevel:i}),i==="auto"&&n(m)},e[0]=n,e[1]=r,e[2]=o,e[3]=a):a=e[3];const l=a;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(wo,{size:"xs",className:"text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",onClick:Ta,children:s.jsx(So,{})}),e[4]=c):c=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(yo,{children:Oe.map(Ra)}),e[5]=d):d=e[5];let u;return e[6]!==l||e[7]!==r.toolApprovalLevel?(u=s.jsxs(Ao,{value:r.toolApprovalLevel,onValueChange:l,children:[c,d]}),e[6]=l,e[7]=r.toolApprovalLevel,e[8]=u):u=e[8],u}function Ra(t){return s.jsx(jo,{value:t.value,children:t.label},t.value)}function Ta(t){return t.stopPropagation()}function bs(t){const e=O.c(5),{input:n}=t;if(n==null){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:"No input"}),e[0]=a):a=e[0],a}let r;try{let a;e[1]!==n?(a=JSON.stringify(n,null,2),e[1]=n,e[2]=a):a=e[2],r=a}catch{r=String(n)}let o;return e[3]!==r?(o=s.jsx("div",{className:"px-4",children:s.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:r})}),e[3]=r,e[4]=o):o=e[4],o}function Da(t){const e=O.c(28),{approval:n,onRespond:r}=t,[o]=De(),a=o.toolApprovalLevel??"readonly";let l;e[0]!==n.approvalId||e[1]!==a||e[2]!==r?(l=()=>r(n.approvalId,!1,xs,a),e[0]=n.approvalId,e[1]=a,e[2]=r,e[3]=l):l=e[3];const c=l;let d;e[4]!==n.approvalId||e[5]!==a||e[6]!==r?(d=()=>r(n.approvalId,!0,void 0,a),e[4]=n.approvalId,e[5]=a,e[6]=r,e[7]=d):d=e[7];const u=d;let V;e[8]!==n.approvalId||e[9]!==r?(V=S=>r(n.approvalId,!0,void 0,S),e[8]=n.approvalId,e[9]=r,e[10]=V):V=e[10];const i=V;let m;e[11]!==i?(m=s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(gs,{onYolo:i})}),e[11]=i,e[12]=m):m=e[12];const f=m;let h;e[13]!==c?(h=s.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:c,children:"Deny"}),e[13]=c,e[14]=h):h=e[14];let p;e[15]!==u?(p=s.jsx(re,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:u,children:"Accept"}),e[15]=u,e[16]=p):p=e[16];let x;e[17]!==h||e[18]!==p?(x=s.jsxs(s.Fragment,{children:[h,p]}),e[17]=h,e[18]=p,e[19]=x):x=e[19];const b=x;let g;e[20]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(pt,{size:14}),e[20]=g):g=e[20];let v;e[21]!==n.input?(v=s.jsx(bs,{input:n.input}),e[21]=n.input,e[22]=v):v=e[22];let w;return e[23]!==n.friendlyName||e[24]!==f||e[25]!==b||e[26]!==v?(w=s.jsx(pe,{icon:g,label:"Approval needed",title:n.friendlyName,defaultExpanded:!0,footerLeft:f,footerRight:b,children:v}),e[23]=n.friendlyName,e[24]=f,e[25]=b,e[26]=v,e[27]=w):w=e[27],w}const Pa=Js(Re(),ye({approved:Zs().optional(),levelOverride:Pt(["auto","readonly"]).optional()}));function Ma(t){const e=O.c(42),{approvals:n,isStreaming:r,onRespond:o}=t,[a]=De(),l=a.toolApprovalLevel??"readonly";let c;e[0]!==n?(c=Object.fromEntries(n.map(Oa)),e[0]=n,e[1]=c):c=e[1];const d=c;let u;e[2]!==l||e[3]!==o?(u=(_,E)=>{const D=E;typeof D?.approved=="boolean"&&o(_.approvalId,D.approved,D.approved===!1?xs:void 0,D.levelOverride??l)},e[2]=l,e[3]=o,e[4]=u):u=e[4];let V;e[5]!==n||e[6]!==d||e[7]!==r||e[8]!==u?(V={parts:n,partKey:$a,schema:Pa,defaultValues:d,isStreaming:r,hasAnswer:Fa,onSubmit:u},e[5]=n,e[6]=d,e[7]=r,e[8]=u,e[9]=V):V=e[9];const i=hs(V);let m;e[10]!==n||e[11]!==i?(m=_=>{i.form.reset(Object.fromEntries(n.map(E=>[E.approvalId,{approved:!0,levelOverride:_}]))),i.submitOrAdvance()},e[10]=n,e[11]=i,e[12]=m):m=e[12];const f=m,h=i.currentPart;let p;e[13]!==i?(p=_=>{_.preventDefault(),i.submit()},e[13]=i,e[14]=p):p=e[14];let x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(pt,{size:14}),e[15]=x):x=e[15];const b=`${n.length} approvals pending`,g=h?.friendlyName??"";let v;e[16]!==f?(v=s.jsx(gs,{onYolo:f}),e[16]=f,e[17]=v):v=e[17];let w;e[18]!==n.length||e[19]!==i.currentIndex||e[20]!==i.goNext||e[21]!==i.goPrev||e[22]!==v?(w=s.jsx(ms,{currentIndex:i.currentIndex,total:n.length,onPrev:i.goPrev,onNext:i.goNext,extraLeft:v}),e[18]=n.length,e[19]=i.currentIndex,e[20]=i.goNext,e[21]=i.goPrev,e[22]=v,e[23]=w):w=e[23];let S;e[24]!==h||e[25]!==i.form.control||e[26]!==i.submitOrAdvance?(S=h?s.jsx(La,{approvalId:h.approvalId,control:i.form.control,onChange:i.submitOrAdvance}):null,e[24]=h,e[25]=i.form.control,e[26]=i.submitOrAdvance,e[27]=S):S=e[27];let A;e[28]!==h?(A=h?s.jsx(bs,{input:h.input}):null,e[28]=h,e[29]=A):A=e[29];let y;e[30]!==w||e[31]!==S||e[32]!==A||e[33]!==b||e[34]!==g?(y=s.jsx(pe,{icon:x,label:b,title:g,defaultExpanded:!0,footerLeft:w,footerRight:S,children:A}),e[30]=w,e[31]=S,e[32]=A,e[33]=b,e[34]=g,e[35]=y):y=e[35];let C;e[36]!==y||e[37]!==p?(C=s.jsx("form",{onSubmit:p,children:y}),e[36]=y,e[37]=p,e[38]=C):C=e[38];let k;return e[39]!==i.form||e[40]!==C?(k=s.jsx(It,{...i.form,children:C}),e[39]=i.form,e[40]=C,e[41]=k):k=e[41],k}function Fa(t){return typeof t?.approved=="boolean"}function $a(t){return t.approvalId}function Oa(t){return[t.approvalId,{approved:void 0}]}function La(t){const e=O.c(6),{approvalId:n,control:r,onChange:o}=t,a=`${n}.approved`;let l;e[0]!==o?(l=d=>{const{field:u}=d,V=u.value===!0,i=u.value===!1;return s.jsxs(s.Fragment,{children:[s.jsx(re,{type:"button",variant:i?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!1),o()},"aria-pressed":i,children:"Deny"}),s.jsx(re,{type:"button",variant:V?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!0),o()},"aria-pressed":V,children:"Accept"})]})},e[0]=o,e[1]=l):l=e[1];let c;return e[2]!==r||e[3]!==a||e[4]!==l?(c=s.jsx(Xs,{control:r,name:a,render:l}),e[2]=r,e[3]=a,e[4]=l,e[5]=c):c=e[5],c}function za(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(pt,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing approval request..."})]}),t[0]=e):e=t[0],e}function Ba(t){const e=O.c(8),{approvals:n,isStreaming:r,onRespond:o}=t;if(r&&n.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(za,{}),e[0]=l):l=e[0],l}if(n.length===0)return null;if(n.length===1){const l=n[0];if(!l)return null;let c;return e[1]!==o||e[2]!==l?(c=s.jsx(Da,{approval:l,onRespond:o}),e[1]=o,e[2]=l,e[3]=c):c=e[3],c}let a;return e[4]!==n||e[5]!==r||e[6]!==o?(a=s.jsx(Ma,{approvals:n,isStreaming:r,onRespond:o}),e[4]=n,e[5]=r,e[6]=o,e[7]=a):a=e[7],a}function Ua(t){const e=O.c(16),{plan:n,onApprove:r,onDismiss:o}=t;let a;e[0]!==r||e[1]!==n.plan?(a=()=>{r(n.plan)},e[0]=r,e[1]=n.plan,e[2]=a):a=e[2];const l=a;let c;e[3]!==o?(c=s.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:o,children:"Keep iterating"}),e[3]=o,e[4]=c):c=e[4];let d;e[5]!==l?(d=s.jsx(re,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:l,children:"Let's go"}),e[5]=l,e[6]=d):d=e[6];let u;e[7]!==c||e[8]!==d?(u=s.jsxs(s.Fragment,{children:[c,d]}),e[7]=c,e[8]=d,e[9]=u):u=e[9];const V=u;let i;e[10]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(uo,{size:14}),e[10]=i):i=e[10];let m;e[11]!==n.plan?(m=s.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:s.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:s.jsx(_r,{id:"plan-preview",part:{type:"text",text:n.plan}})})}),e[11]=n.plan,e[12]=m):m=e[12];let f;return e[13]!==V||e[14]!==m?(f=s.jsx(pe,{icon:i,label:"Plan ready",title:"Implementation Plan",defaultExpanded:!0,footerRight:V,children:m}),e[13]=V,e[14]=m,e[15]=f):f=e[15],f}function qa(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed border-purple-500/30 rounded-lg bg-purple-500/5 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(Ke,{className:"size-5 text-purple-500 shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing plan..."})]}),t[0]=e):e=t[0],e}function Ka(t){const e=O.c(7),{plans:n,isStreaming:r,onApprove:o,onDismiss:a}=t;if(r&&n.length===0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(qa,{}),e[0]=u):u=e[0],u}let l;e[1]!==n?(l=n.at(-1),e[1]=n,e[2]=l):l=e[2];const c=l;if(!c)return null;let d;return e[3]!==c||e[4]!==o||e[5]!==a?(d=s.jsx(Ua,{plan:c,onApprove:o,onDismiss:a}),e[3]=c,e[4]=o,e[5]=a,e[6]=d):d=e[6],d}function vs(t){return t?"response"in t?t.response:t.option??t.draft:""}const Vn=ye({response:Re().min(1,"Response is required")}),Qa=ye({option:Re().nullable(),draft:Re()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),Ya=ye({response:Pt(["yes","no"])});function Ha(t){switch(t.type){case"text":return Vn;case"choice":return Qa;case"confirm":return Ya;default:return Vn}}function Ga(t){const e={};for(const n of t)e[n.toolCallId]=Ha(n.input);return ye(e)}function Wa(t){const e=O.c(6),{control:n,name:r,placeholder:o}=t;let a;e[0]!==o?(a=c=>{const{field:d}=c,u=d.value??"";return s.jsxs(Lt,{children:[s.jsx(zt,{children:s.jsx("div",{className:"px-2",children:s.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Kn,{size:16,className:"text-muted-foreground"})}),s.jsx("input",{...d,value:u,type:"text",placeholder:o||"Type your response...",autoFocus:!0,"aria-label":"Text response input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),s.jsx(Bt,{})]})},e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==n||e[3]!==r||e[4]!==a?(l=s.jsx(Wn,{control:n,name:r,render:a}),e[2]=n,e[3]=r,e[4]=a,e[5]=l):l=e[5],l}function ys(t,e){const n=O.c(4);let r,o;n[0]!==t||n[1]!==e?(r=()=>{const a=l=>{const c=l.target.tagName;if(c==="INPUT"||c==="TEXTAREA"||l.metaKey||l.ctrlKey||l.altKey)return;const d=Number.parseInt(l.key,10);d>=1&&d<=t&&(l.preventDefault(),e(d-1))};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},o=[t,e],n[0]=t,n[1]=e,n[2]=r,n[3]=o):(r=n[2],o=n[3]),j.useEffect(r,o)}function Ja(t){const e=O.c(40),{control:n,name:r,options:o}=t,a=`${r}.option`;let l;e[0]!==n||e[1]!==a?(l={control:n,name:a,defaultValue:null},e[0]=n,e[1]=a,e[2]=l):l=e[2];const{field:c}=Jt(l),d=`${r}.draft`;let u;e[3]!==n||e[4]!==d?(u={control:n,name:d,defaultValue:""},e[3]=n,e[4]=d,e[5]=u):u=e[5];const{field:V}=Jt(u),i=c.value,m=V.value??"";let f;if(e[6]!==c||e[7]!==o?(f=D=>{const T=o[D];T!=null&&c.onChange(T)},e[6]=c,e[7]=o,e[8]=f):f=e[8],ys(o.length,f),o.length===0)return null;const h=i===null;let p;if(e[9]!==c||e[10]!==i||e[11]!==o){let D;e[13]!==c||e[14]!==i?(D=(T,N)=>{const M=i===T;return s.jsxs("button",{type:"button",onClick:()=>c.onChange(T),className:U("flex items-center gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",M&&"bg-accent/50",!M&&"hover:bg-accent/30"),"aria-label":`Select ${T}`,children:[s.jsx("span",{className:U("flex items-center justify-center size-6 rounded-md text-sm shrink-0",M?"bg-chart-1 text-white":"bg-muted text-foreground"),children:N+1}),s.jsx("span",{className:"text-sm text-foreground truncate",children:T})]},`${N}-${T}`)},e[13]=c,e[14]=i,e[15]=D):D=e[15],p=o.map(D),e[9]=c,e[10]=i,e[11]=o,e[12]=p}else p=e[12];const x=h&&"bg-accent/50",b=!h&&"hover:bg-accent/30";let g;e[16]!==x||e[17]!==b?(g=U("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",x,b),e[16]=x,e[17]=b,e[18]=g):g=e[18];let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Kn,{size:16,className:"text-muted-foreground"})}),e[19]=v):v=e[19];const w=h?m:"";let S;e[20]!==V||e[21]!==c||e[22]!==i?(S=D=>{V.onChange(D.target.value),i!==null&&c.onChange(null)},e[20]=V,e[21]=c,e[22]=i,e[23]=S):S=e[23];let A;e[24]!==c||e[25]!==i?(A=()=>{i!==null&&c.onChange(null)},e[24]=c,e[25]=i,e[26]=A):A=e[26];let y;e[27]!==w||e[28]!==S||e[29]!==A?(y=s.jsx("input",{type:"text",value:w,onChange:S,onFocus:A,placeholder:"Something else...","aria-label":"Custom choice input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[27]=w,e[28]=S,e[29]=A,e[30]=y):y=e[30];let C;e[31]!==y||e[32]!==g?(C=s.jsxs("label",{className:g,children:[v,y]}),e[31]=y,e[32]=g,e[33]=C):C=e[33];let k;e[34]!==C||e[35]!==p?(k=s.jsx(zt,{children:s.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":"Choice options",children:[p,C]})}),e[34]=C,e[35]=p,e[36]=k):k=e[36];let _;e[37]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(Bt,{}),e[37]=_):_=e[37];let E;return e[38]!==k?(E=s.jsxs(Lt,{children:[k,_]}),e[38]=k,e[39]=E):E=e[39],E}function Za(t){const e=O.c(6),{control:n,name:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const a=o,l=j.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=V=>{l.current?.onChange(a[V]??"")},e[1]=c):c=e[1],ys(a.length,c);let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=V=>{const{field:i}=V;return l.current=i,s.jsxs(Lt,{children:[s.jsx(zt,{children:s.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:a.map(m=>{const f=i.value===m;return s.jsxs("button",{type:"button",onClick:()=>i.onChange(m),className:U("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",f&&"bg-accent/50",!f&&"hover:bg-accent/30"),"aria-label":`Confirm ${m}`,children:[s.jsx("span",{className:U("flex items-center justify-center size-6 rounded-md text-sm shrink-0",f?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),s.jsx("span",{className:"text-sm text-foreground capitalize",children:m})]},m)})})}),s.jsx(Bt,{})]})},e[2]=d):d=e[2];let u;return e[3]!==n||e[4]!==r?(u=s.jsx(Wn,{control:n,name:r,render:d}),e[3]=n,e[4]=r,e[5]=u):u=e[5],u}function fn(t){const e=O.c(13),{input:n,control:r,toolCallId:o}=t;switch(n.type){case"text":{const a=`${o}.response`;let l;return e[0]!==r||e[1]!==n.default||e[2]!==a?(l=s.jsx(Wa,{control:r,name:a,placeholder:n.default}),e[0]=r,e[1]=n.default,e[2]=a,e[3]=l):l=e[3],l}case"choice":{let a;e[4]!==n.options?(a=n.options?.filter(Boolean)??[],e[4]=n.options,e[5]=a):a=e[5];const l=a;let c;return e[6]!==r||e[7]!==l||e[8]!==o?(c=s.jsx(Ja,{control:r,name:o,options:l}),e[6]=r,e[7]=l,e[8]=o,e[9]=c):c=e[9],c}case"confirm":{const a=`${o}.response`;let l;return e[10]!==r||e[11]!==a?(l=s.jsx(Za,{control:r,name:a}),e[10]=r,e[11]=a,e[12]=l):l=e[12],l}default:return null}}function Xa(t){const e=O.c(71),{parts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=Ga(n.map(sl)),e[0]=n,e[1]=a):a=e[1];const l=a;let c;e[2]!==n?(c=Object.fromEntries(n.map(nl)),e[2]=n,e[3]=c):c=e[3];const d=c;let u;e[4]!==o?(u=(P,R)=>{const $=vs(R);$&&o(P,$)},e[4]=o,e[5]=u):u=e[5];let V;e[6]!==d||e[7]!==r||e[8]!==n||e[9]!==l||e[10]!==u?(V={parts:n,partKey:tl,schema:l,defaultValues:d,isStreaming:r,hasAnswer:el,onSubmit:u},e[6]=d,e[7]=r,e[8]=n,e[9]=l,e[10]=u,e[11]=V):V=e[11];const i=hs(V),m=i.currentPart;let f;e[12]!==m||e[13]!==i?(f=()=>{const P=m;if(!P)return;const R=P.toolCallId;P.input?.type==="choice"?(i.form.setValue(`${R}.option`,null),i.form.setValue(`${R}.draft`,"user has skip this question")):i.form.setValue(`${R}.response`,"user has skip this question"),i.advanceToNextUnanswered()},e[12]=m,e[13]=i,e[14]=f):f=e[14];const h=f;let p;e[15]!==i.currentIndex||e[16]!==i.goNext||e[17]!==i.goPrev||e[18]!==n.length?(p=s.jsx(ms,{currentIndex:i.currentIndex,total:n.length,onPrev:i.goPrev,onNext:i.goNext}),e[15]=i.currentIndex,e[16]=i.goNext,e[17]=i.goPrev,e[18]=n.length,e[19]=p):p=e[19];const x=p;let b;e[20]!==h?(b=s.jsx(re,{type:"button",variant:"outline",size:"sm",onClick:h,className:"h-7",children:"Skip"}),e[20]=h,e[21]=b):b=e[21];let g;e[22]!==i.isAllAnswered||e[23]!==i.isCurrentAnswered||e[24]!==i.submitOrAdvance||e[25]!==r?(g=s.jsx(Ia,{isStreaming:r,isAllAnswered:i.isAllAnswered,isCurrentAnswered:i.isCurrentAnswered,onAdvanceOrSubmit:i.submitOrAdvance}),e[22]=i.isAllAnswered,e[23]=i.isCurrentAnswered,e[24]=i.submitOrAdvance,e[25]=r,e[26]=g):g=e[26];let v;e[27]!==b||e[28]!==g?(v=s.jsxs(s.Fragment,{children:[b,g]}),e[27]=b,e[28]=g,e[29]=v):v=e[29];const w=v;if(n.length===1){const P=n[0];if(!P?.input)return null;let R;e[30]!==i?(R=B=>{B.preventDefault(),i.submit()},e[30]=i,e[31]=R):R=e[31];let $;e[32]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(Et,{size:14}),e[32]=$):$=e[32];const z=P.input?.prompt??"Question",L=P.input;let q;e[33]!==i.form.control||e[34]!==P.toolCallId||e[35]!==L?(q=s.jsx(fn,{input:L,control:i.form.control,toolCallId:P.toolCallId}),e[33]=i.form.control,e[34]=P.toolCallId,e[35]=L,e[36]=q):q=e[36];let K;e[37]!==w||e[38]!==z||e[39]!==q?(K=s.jsx(pe,{icon:$,label:"Question pending",title:z,defaultExpanded:!0,footerRight:w,children:q}),e[37]=w,e[38]=z,e[39]=q,e[40]=K):K=e[40];let Q;e[41]!==R||e[42]!==K?(Q=s.jsx("form",{onSubmit:R,autoComplete:"off",children:K}),e[41]=R,e[42]=K,e[43]=Q):Q=e[43];let F;return e[44]!==i.form||e[45]!==Q?(F=s.jsx(It,{...i.form,children:Q}),e[44]=i.form,e[45]=Q,e[46]=F):F=e[46],F}const S=i.form;let A;e[47]!==i?(A=P=>{P.preventDefault(),i.submit()},e[47]=i,e[48]=A):A=e[48];let y;e[49]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(Et,{size:14}),e[49]=y):y=e[49];const C=`${i.currentIndex+1} of ${n.length}`,k=m?.input?.prompt??"Question",_=i.activeKey,E=i.setActiveKey;let D;if(e[50]!==i.form||e[51]!==n){let P;e[53]!==i.form?(P=R=>s.jsx(ko,{value:R.toolCallId,className:"mt-0",children:s.jsx(fn,{input:R.input,control:i.form.control,toolCallId:R.toolCallId})},R.toolCallId),e[53]=i.form,e[54]=P):P=e[54],D=n.map(P),e[50]=i.form,e[51]=n,e[52]=D}else D=e[52];let T;e[55]!==i.activeKey||e[56]!==i.setActiveKey||e[57]!==D?(T=s.jsx(_o,{value:_,onValueChange:E,children:D}),e[55]=i.activeKey,e[56]=i.setActiveKey,e[57]=D,e[58]=T):T=e[58];let N;e[59]!==x||e[60]!==w||e[61]!==C||e[62]!==k||e[63]!==T?(N=s.jsx(pe,{icon:y,label:"Question pending",count:C,title:k,defaultExpanded:!0,footerLeft:x,footerRight:w,children:T}),e[59]=x,e[60]=w,e[61]=C,e[62]=k,e[63]=T,e[64]=N):N=e[64];let M;e[65]!==A||e[66]!==N?(M=s.jsx("form",{onSubmit:A,autoComplete:"off",children:N}),e[65]=A,e[66]=N,e[67]=M):M=e[67];let I;return e[68]!==i.form||e[69]!==M?(I=s.jsx(It,{...S,children:M}),e[68]=i.form,e[69]=M,e[70]=I):I=e[70],I}function el(t){return!!vs(t)}function tl(t){return t.toolCallId}function nl(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function sl(t){return{toolCallId:t.toolCallId,input:t.input}}function rl(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(Et,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing question..."})]}),t[0]=e):e=t[0],e}function As(t){const e=O.c(7),{userAskParts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=n.filter(ol),e[0]=n,e[1]=a):a=e[1];const l=a;if(l.length===0){if(r){let d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(rl,{}),e[2]=d):d=e[2],d}return null}let c;return e[3]!==r||e[4]!==o||e[5]!==l?(c=s.jsx(Xa,{parts:l,isStreaming:r,onSubmit:o}),e[3]=r,e[4]=o,e[5]=l,e[6]=c):c=e[6],c}function ol(t){return t.state==="input-available"}function al(t){const e=t.filter(a=>a.status==="in_progress"),n=t.filter(a=>a.status==="completed").length,r=t.length;if(r>0&&n===r)return{icon:"completed",activity:"All done",progress:`${r}/${r}`};const[o]=e;return o&&e.length===1?{icon:"in_progress",activity:o.activeForm,progress:`${n}/${r} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${n}/${r} done`}:n>0?{icon:"pending",activity:`${r-n} pending`,progress:`${n}/${r} done`}:{icon:"pending",activity:`${r} todos`,progress:"not started"}}function ll(){const t=O.c(21),{messages:e}=Pe();let n,r,o,a,l,c,d,u,V;if(t[0]!==e){V=Symbol.for("react.early_return_sentinel");e:{const f=cs(e);if(f.length===0){V=null;break e}const h=al(f);n=pe,l=s.jsx(ul,{status:h.icon}),c=h.activity,d=h.progress,u=!1,r="todos-list",o="flex flex-col px-2 max-h-[40vh] overflow-y-auto",a=f.map(il)}t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=a,t[5]=l,t[6]=c,t[7]=d,t[8]=u,t[9]=V}else n=t[1],r=t[2],o=t[3],a=t[4],l=t[5],c=t[6],d=t[7],u=t[8],V=t[9];if(V!==Symbol.for("react.early_return_sentinel"))return V;let i;t[10]!==r||t[11]!==o||t[12]!==a?(i=s.jsx("ul",{"data-testid":r,className:o,children:a}),t[10]=r,t[11]=o,t[12]=a,t[13]=i):i=t[13];let m;return t[14]!==n||t[15]!==l||t[16]!==c||t[17]!==d||t[18]!==u||t[19]!==i?(m=s.jsx(n,{icon:l,label:c,count:d,defaultExpanded:u,children:i}),t[14]=n,t[15]=l,t[16]=c,t[17]=d,t[18]=u,t[19]=i,t[20]=m):m=t[20],m}function il(t,e){return s.jsx(cl,{todo:t},e)}function cl(t){const e=O.c(14),{todo:n}=t,r=n.status==="completed",a=n.status==="in_progress"?n.activeForm:n.content;let l;e[0]!==n.status?(l=s.jsx(dl,{status:n.status}),e[0]=n.status,e[1]=l):l=e[1];const c=r&&"text-muted-foreground";let d;e[2]!==c?(d=U("relative text-sm leading-snug pt-px select-none",c),e[2]=c,e[3]=d):d=e[3];const u=r?"100%":"0%",V=r?"width 300ms ease 200ms":"width 150ms ease";let i;e[4]!==u||e[5]!==V?(i=s.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:u,transition:V}}),e[4]=u,e[5]=V,e[6]=i):i=e[6];let m;e[7]!==a||e[8]!==d||e[9]!==i?(m=s.jsxs("span",{className:d,children:[a,i]}),e[7]=a,e[8]=d,e[9]=i,e[10]=m):m=e[10];let f;return e[11]!==l||e[12]!==m?(f=s.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[l,m]}),e[11]=l,e[12]=m,e[13]=f):f=e[13],f}function dl(t){const e=O.c(4),{status:n}=t,r=n==="completed"?"true":void 0,o=n==="in_progress"?"true":void 0;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("svg",{viewBox:"0 0 21 21",children:s.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=a):a=e[0];let l;return e[1]!==r||e[2]!==o?(l=s.jsx("div",{className:"todo-cb mt-0.5","data-checked":r,"data-progress":o,"aria-hidden":"true",children:a}),e[1]=r,e[2]=o,e[3]=l):l=e[3],l}function ul(t){const e=O.c(3),{status:n}=t;if(n==="completed"){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("span",{"aria-label":"completed",className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:s.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:s.jsx("path",{d:"M1 4l2.5 2.5L9 1"})})}),e[0]=o):o=e[0],o}if(n==="in_progress"){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("span",{"aria-label":"in progress",className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[1]=o):o=e[1],o}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("span",{"aria-label":"pending",className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[2]=r):r=e[2],r}const Vl={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]},fl=["Access to 100+ AI models","Unified API, no separate keys needed","Pay only for what you use"];function js(t){const e=O.c(41),{onDismiss:n}=t,{org:r}=de(),o=ot(),{decoKeyId:a}=es(),l=ts(),[c,d]=j.useState(""),[u,V]=j.useState(!1),[i,m]=j.useState("usd"),f=i==="brl"?"R$":"$";let h,p;e[0]!==r.id?(h=()=>{G("credits_exhausted_shown",{organization_id:r.id})},p=[r.id],e[0]=r.id,e[1]=h,e[2]=p):(h=e[1],p=e[2]),j.useEffect(h,p);let x;e[3]!==i||e[4]!==l?(x=async P=>{const{url:R}=await l.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:P,currency:i});return R},e[3]=i,e[4]=l,e[5]=x):x=e[5];let b;e[6]!==n?(b=P=>{P&&window.open(P,"_blank","noopener,noreferrer"),n?.()},e[6]=n,e[7]=b):b=e[7];let g;e[8]!==x||e[9]!==b?(g={mutationFn:x,onSuccess:b,onError:hl},e[8]=x,e[9]=b,e[10]=g):g=e[10];const{mutate:v,isPending:w}=Mt(g),S=parseFloat(c),A=!isNaN(S)&&S>=1;let y;e[11]!==n?(y=P=>!P&&n?.(),e[11]=n,e[12]=y):y=e[12];let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[13]=C):C=e[13];let k;e[14]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:C.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[14]=k):k=e[14];let _;e[15]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[k,s.jsxs(it,{className:"relative gap-4",children:[s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),s.jsxs("div",{children:[s.jsx(ct,{className:"text-xl font-semibold tracking-tight",children:"Top up to keep building"}),s.jsx(Ot,{className:"mt-1.5 text-sm leading-relaxed",children:"Your credits are used up. Add more to continue using AI across all your agents."})]})]})]}),e[15]=_):_=e[15];let E;e[16]!==i||e[17]!==f||e[18]!==c||e[19]!==S||e[20]!==a||e[21]!==A||e[22]!==w||e[23]!==u||e[24]!==v?(E=a&&s.jsxs("div",{className:"px-8 pt-5 pb-6",children:[s.jsx("div",{className:"mb-4",children:s.jsxs(Zn,{type:"single",variant:"outline",size:"sm",value:i,onValueChange:P=>{P&&m(P)},children:[s.jsx(et,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(et,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),s.jsxs("div",{className:"rounded-xl border border-border p-5",children:[s.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:Vl[i].map(P=>{const{dollars:R,label:$}=P;return s.jsxs("button",{type:"button",disabled:w,onClick:()=>{G("credits_topup_clicked",{amount_cents:R*100,currency:i,tier_label:$,source:"exhausted_banner"}),v(R*100)},className:U("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[s.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[f,R]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:$})]},R)})}),u?s.jsxs("div",{className:"flex gap-2 mt-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:f}),s.jsx(Xn,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:P=>d(P.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(re,{className:"h-10",disabled:!A||w,onClick:()=>{G("credits_topup_clicked",{amount_cents:Math.round(S*100),currency:i,tier_label:"custom",source:"exhausted_banner"}),v(Math.round(S*100))},children:w?"Opening...":"Add"})]}):s.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>V(!0),children:"Enter custom amount"})]}),s.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:fl.map(ml)})]}),e[16]=i,e[17]=f,e[18]=c,e[19]=S,e[20]=a,e[21]=A,e[22]=w,e[23]=u,e[24]=v,e[25]=E):E=e[25];let D;e[26]!==n?(D=s.jsx(re,{variant:"ghost",size:"sm",onClick:n,children:"Dismiss"}),e[26]=n,e[27]=D):D=e[27];let T;e[28]!==o||e[29]!==n||e[30]!==r.slug?(T=s.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{o({to:"/$org/settings/ai-providers",params:{org:r.slug}}),n?.()},children:"Manage providers"}),e[28]=o,e[29]=n,e[30]=r.slug,e[31]=T):T=e[31];let N;e[32]!==D||e[33]!==T?(N=s.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[D,T]}),e[32]=D,e[33]=T,e[34]=N):N=e[34];let M;e[35]!==E||e[36]!==N?(M=s.jsxs(dt,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:pl,children:[_,E,N]}),e[35]=E,e[36]=N,e[37]=M):M=e[37];let I;return e[38]!==M||e[39]!==y?(I=s.jsx(ut,{open:!0,onOpenChange:y,children:M}),e[38]=M,e[39]=y,e[40]=I):I=e[40],I}function ml(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:s.jsx(Ke,{size:12,className:"text-[hsl(var(--chart-1))]"})}),s.jsx("span",{className:"text-sm text-foreground/80",children:t})]},t)}function pl(t){return t.preventDefault()}function hl(t){le.error(`Top-up failed: ${t.message}`)}function xl(){const t=O.c(5),e=at(),n=ns(),[r,o]=j.useState(!1);if(!(e?.lockedSandbox==="user-desktop")||!n.ready||n.online)return null;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Ut,{size:14}),t[0]=l):l=t[0];let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(re,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>o(!0),children:"Reconnect desktop"}),t[1]=c):c=t[1];let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(pe,{icon:l,label:"Your desktop is offline",title:"This chat runs on your desktop, which isn't connected right now.",defaultExpanded:!0,variant:"warning",footerRight:c,children:s.jsxs("p",{className:"mx-4 text-xs text-muted-foreground",children:["Run ",s.jsx("code",{className:"font-mono",children:"bunx decocms@latest link"})," in a terminal on that machine to bring it back. Messages you send while it's offline will fail."]})}),t[2]=d):d=t[2];let u;return t[3]!==r?(u=s.jsxs(s.Fragment,{children:[d,s.jsx(To,{open:r,onOpenChange:o})]}),t[3]=r,t[4]=u):u=t[4],u}function gl(t){const e=t.trim(),n=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),r=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),o=/failed to fetch|networkerror|load failed|offline/i.test(e),a=/timeout|timed out|aborted|deadline/i.test(e),l=e.length>240,c=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(c){const d=c[1]?.trim().replace(/\.$/,"");return{summary:d?`Your sandbox didn't finish starting up (${d}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return/link_unavailable|user_desktop_link_/i.test(e)?/user_desktop_link_capability_missing/i.test(e)?{summary:"Your desktop is connected, but the CLI this chat uses wasn't detected there. Install it and sign in on your desktop, then try again.",rawDetails:t}:{summary:"Your desktop is offline. Run `bunx decocms@latest link` in a terminal on it, then try again.",rawDetails:t}:r||n&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:o?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:a?{summary:"That took longer than expected. Try again.",rawDetails:t}:n||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const bl={length:"Response reached the model's output limit. Different models have different limits. Try switching models or asking it to continue.","content-filter":"Response was filtered due to content policy.","tool-calls":"Response paused after tool execution to prevent infinite loops and save costs. Click continue to keep working."};function tt(t){const e=O.c(19),{variant:n,onDismiss:r}=t,o=n==="error",a=o?"Error occurred":"Response incomplete",l=o?Gn:En,c=o?t.error.message:bl[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`;let d;e[0]!==o||e[1]!==c?(d=o?gl(c):{summary:c,rawDetails:null},e[0]=o,e[1]=c,e[2]=d):d=e[2];const{summary:u,rawDetails:V}=d;let i;e[3]!==l?(i=s.jsx(l,{size:14}),e[3]=l,e[4]=i):i=e[4];let m;e[5]!==o||e[6]!==t.onContinue||e[7]!==t.onFixInChat?(m=o?s.jsx(re,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}):s.jsx(re,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"}),e[5]=o,e[6]=t.onContinue,e[7]=t.onFixInChat,e[8]=m):m=e[8];let f;e[9]!==V?(f=V?s.jsxs("details",{className:"group mx-4",children:[s.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[s.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"m4.5 3 3 3-3 3"})}),s.jsx("span",{className:"group-open:hidden",children:"Show technical details"}),s.jsx("span",{className:"hidden group-open:inline",children:"Hide technical details"})]}),s.jsxs("div",{className:"relative mt-2",children:[s.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(V).then(yl).catch(vl)},"aria-label":"Copy error details",title:"Copy",className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:s.jsx(vo,{className:"size-3.5"})}),s.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:V})]})]}):null,e[9]=V,e[10]=f):f=e[10];let h;return e[11]!==a||e[12]!==r||e[13]!==u||e[14]!==i||e[15]!==m||e[16]!==f||e[17]!==n?(h=s.jsx(pe,{icon:i,label:a,title:u,defaultExpanded:!0,variant:n,onClose:r,footerRight:m,children:f}),e[11]=a,e[12]=r,e[13]=u,e[14]=i,e[15]=m,e[16]=f,e[17]=n,e[18]=h):h=e[18],h}function vl(){return le.error("Could not copy")}function yl(){return le.success("Copied to clipboard")}function xt(){const t=O.c(62),{error:e,clearError:n,finishReason:r,clearFinishReason:o,messages:a,isStreaming:l,submit:c,sendMessage:d}=Pe(),[u,V]=De(),{virtualMcpId:i,createTaskWithMessage:m}=Fn(),{chatMode:f,simpleModeTier:h}=he();let p;t[0]!==f||t[1]!==h||t[2]!==i?(p=W=>({tier:h,mode:f,toolApprovalLevel:W,agent:i?{id:i}:void 0}),t[0]=f,t[1]=h,t[2]=i,t[3]=p):p=t[3];const x=p;let b;t[4]!==u.toolApprovalLevel?(b=u.toolApprovalLevel??er(),t[4]=u.toolApprovalLevel,t[5]=b):b=t[5];const g=b,v=a.at(-1),w=v?.role==="assistant"?v.parts:[],S=w.filter(Sl),A=us(w),y=ds(w);let C;t[6]!==e||t[7]!==d?(C=()=>{if(e){const oe={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};d(oe)}},t[6]=e,t[7]=d,t[8]=C):C=t[8];const k=C;let _;t[9]!==d?(_=()=>{d({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[9]=d,t[10]=_):_=t[10];const E=_;let D;t[11]!==x||t[12]!==g||t[13]!==c?(D=(W,oe)=>{c({kind:"toolOutput",toolCallId:W.toolCallId,output:{response:oe}},x(g))},t[11]=x,t[12]=g,t[13]=c,t[14]=D):D=t[14];const T=D;let N;t[15]!==m||t[16]!==u||t[17]!==V||t[18]!==i?(N=W=>{V({...u,toolApprovalLevel:"auto"}),m({virtualMcpId:i,message:{parts:[{type:"text",text:`Implement this plan:
|
|
1
|
+
import{m as qe,r as j,ar as qs,ap as Ks,c as O,D as de,l as U,j as s,E as Qs,t as le,o as ye,aD as Ys,s as Re,aE as Pt,L as Hs,B as re,p as Gs,n as Ws,aF as Js,aG as Zs,J as De,af as Xs,aH as Oe,aI as Jt,b as ot,d as Mt,v as G,aJ as er,a8 as En,a7 as tr,F as nr,aK as sr,a as Rn,aL as rr,aM as Tn,aN as or,aO as ue,aP as bt,aQ as ar,aR as lr,aS as vt,aT as ir,aU as cr,aV as dr,aW as ur,q as Vr,K as Ee,aX as fr,aY as mr,aZ as pr,a_ as hr,a$ as Dn,b0 as ze,k as xr,i as gr,ag as Pn}from"./index-D_UOP9mB.js";import{a as Mn,n as br}from"./SwitchHorizontal01-dHIjRjs4.js";import{b as he,u as Pe,S as Nt,c as at,a as Fn,e as $n,s as vr,f as yr,g as Ar,h as jr,i as On,A as wr,j as Sr,k as Cr}from"./chat-context-C5Dv0tTg.js";import{j as Ln,s as lt,g as me,P as Ze,k as Ft,t as Nr,l as kr,M as _r,m as Ir,n as Xe,o as zn,p as Er,D as Rr,q as Tr,r as Dr,v as Te,w as Pr,d as Mr,x as Fr,y as $t,z as $r,F as Or,i as Lr,E as zr,c as Br,A as Ur,B as qr,H as Kr,I as Qr,J as Zt}from"./scroll-area-Dxw-E5II.js";import{c as kt,a as xe,b as ge,T as be}from"./tooltip-BR6syT2S.js";import{c as it,a as ct,d as dt,e as ut,b as Ot}from"./dialog-CymwL5lO.js";import{c as Yr,b as Hr,a as Gr,D as Wr}from"./drawer-Cb9A4OVK.js";import{C as Jr}from"./collection-search-DzlllM3V.js";import{u as Zr}from"./use-mobile-BZo7lvaH.js";import{a as Vt,u as Me,S as Xr,i as Xt}from"./use-mcp-client-DlyZEA3A.js";import{u as eo,g as ft,l as _t}from"./use-mcp-prompts-pcmTb2GI.js";import{t as mt}from"./ChevronDown-DjI9Ah6n.js";import{i as _e}from"./X-BJkEaciD.js";import{t as to,z as no,u as so,w as ro,A as oo}from"./hooks-lMbMn8Le.js";import{K as ao,i as lo}from"./shell-layout-klpGsxrf.js";import{u as io,a as co}from"./use-virtual-mcp-BeJfWraj.js";import{n as Bn}from"./ZapSquare-A7DF2PWn.js";import{i as Ke}from"./ChevronUp-UIn_3dHA.js";import{s as Un}from"./Star01-DOH6S4RS.js";import{a as qn}from"./Tool01-C2Wy9ddS.js";import{ad as pt,x as uo,a5 as Kn,ae as Vo,A as Qn,g as Ge,j as fo,a7 as mo,af as po,C as ho,ag as Yn,ah as xo,ai as go,c as Hn}from"./agent-icon-1Cwh4hkP.js";import{i as bo}from"./Upload01-y8AitCX_.js";import{i as Gn}from"./AlertCircle-BhSO5Twf.js";import{a as vo}from"./Eye-BcHeo8OC.js";import{a as It,b as Lt,d as zt,e as Bt,F as Wn}from"./form-CoZSZB1f.js";import{S as yo,d as Ao,a as jo,b as wo,c as So}from"./select-D6WRoyEz.js";import{b as Co}from"./Settings02-hQL04X7-.js";import{i as Jn,t as Et,b as No}from"./XCircle-DXiqmV8m.js";import{b as ko,c as _o}from"./tabs-86zaQtr4.js";import{T as Zn,a as et}from"./toggle-group-CjaKzFll.js";import{I as Xn}from"./input-IN5HhQsQ.js";import{u as es,a as Io,g as Eo,A as Ro}from"./sortable.esm-DYJqg3G6.js";import{u as ts}from"./studio-tools-CAjgBW6i.js";import{i as Ut}from"./Monitor01-Qw5xJyG2.js";import{u as ns,C as To,a as ss,b as rs}from"./connect-desktop-dialog-B3FevdKG.js";import{s as Do}from"./XClose-C-z27vFA.js";import{m as ht,i as Po,g as os,a as Mo,N as Fo}from"./decopilot-DbXK2c3g.js";import{P as qt,a as Kt,b as Qt}from"./popover-BvQdvb3c.js";import{e as en,a as tn,g as $o,b as Oo,C as Lo,c as zo,d as Bo}from"./command-CFE9B-sb.js";import{u as Uo}from"./useInfiniteQuery-BafAnv-q.js";import{t as qo}from"./Stars01-D6kYyOXX.js";import{g as Ko,h as Qo}from"./use-org-fs-DMkyivR7.js";import{D as Yo,a as Ho,b as Go,c as fe,d as nn,e as sn,f as rn,j as Wo,i as Jo}from"./dropdown-menu-DE9I1deT.js";import{s as on}from"./Plus-DVlEi_3L.js";import{p as Zo,q as Xo}from"./question-004-sINsf4GQ.js";import{i as ea}from"./ChevronRight-BAc41q_Y.js";function ta(t,e){const n=qe(e);return na({filters:{...t,status:"pending"}},n).length}function an(t,e){return t.findAll(e.filters).map(n=>e.select?e.select(n):n.state)}function na(t={},e){const n=qe(e).getMutationCache(),r=j.useRef(t),o=j.useRef(null);return o.current===null&&(o.current=an(n,t)),j.useEffect(()=>{r.current=t}),j.useSyncExternalStore(j.useCallback(a=>n.subscribe(()=>{const l=qs(o.current,an(n,r.current));o.current!==l&&(o.current=l,Ks.schedule(a))}),[n]),()=>o.current,()=>o.current)}const ln=3,as="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",sa="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function ls(t){const e=O.c(46),{item:n,onSelect:r,isLoading:o,isDisabled:a,variant:l}=t,c=l===void 0?"pill":l,{prompt:d}=n;let u;if(e[0]!==d._meta||e[1]!==d.name||e[2]!==d.title){const y=me(d._meta);u=d.title??Ft(d.name,y),e[0]=d._meta,e[1]=d.name,e[2]=d.title,e[3]=u}else u=e[3];const V=u,i=d.description||null;if(c==="card"){let y;e[4]!==r||e[5]!==d?(y=()=>r(d),e[4]=r,e[5]=d,e[6]=y):y=e[6];const C=a||o,k=o&&"bg-accent/40",_=(a||o)&&"cursor-not-allowed opacity-50";let E;e[7]!==k||e[8]!==_?(E=U(sa,"hover:bg-accent/60 text-foreground",k,_),e[7]=k,e[8]=_,e[9]=E):E=e[9];let D;e[10]!==V?(D=s.jsx("span",{className:"font-medium truncate capitalize",children:V}),e[10]=V,e[11]=D):D=e[11];let T;e[12]!==o?(T=o&&s.jsx(Nt,{size:"xs"}),e[12]=o,e[13]=T):T=e[13];let N;e[14]!==D||e[15]!==T?(N=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[D,T]}),e[14]=D,e[15]=T,e[16]=N):N=e[16];let M;e[17]!==i?(M=i&&s.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:i}),e[17]=i,e[18]=M):M=e[18];let I;return e[19]!==N||e[20]!==M||e[21]!==y||e[22]!==C||e[23]!==E?(I=s.jsxs("button",{type:"button",onClick:y,disabled:C,className:E,children:[N,M]}),e[19]=N,e[20]=M,e[21]=y,e[22]=C,e[23]=E,e[24]=I):I=e[24],I}let m;e[25]!==r||e[26]!==d?(m=()=>r(d),e[25]=r,e[26]=d,e[27]=m):m=e[27];const f=a||o,h=o&&"bg-muted/50",p=(a||o)&&"cursor-not-allowed opacity-50";let x;e[28]!==h||e[29]!==p?(x=U(as,"hover:bg-muted/70 hover:text-foreground",h,p),e[28]=h,e[29]=p,e[30]=x):x=e[30];let b;e[31]!==V?(b=s.jsx("span",{className:"capitalize",children:V}),e[31]=V,e[32]=b):b=e[32];let g;e[33]!==o?(g=o&&s.jsx(Nt,{size:"xs"}),e[33]=o,e[34]=g):g=e[34];let v;e[35]!==m||e[36]!==f||e[37]!==x||e[38]!==b||e[39]!==g?(v=s.jsx(xe,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:m,disabled:f,className:x,children:[b,g]})}),e[35]=m,e[36]=f,e[37]=x,e[38]=b,e[39]=g,e[40]=v):v=e[40];const w=i??V;let S;e[41]!==w?(S=s.jsx(ge,{side:"top",className:"max-w-xs",children:s.jsx("p",{className:"text-xs",children:w})}),e[41]=w,e[42]=S):S=e[42];let A;return e[43]!==v||e[44]!==S?(A=s.jsxs(be,{delayDuration:400,children:[v,S]}),e[43]=v,e[44]=S,e[45]=A):A=e[45],A}function ra(t){const e=O.c(41),{items:n,open:r,onOpenChange:o,onSelect:a,loadingPrompt:l}=t,[c,d]=j.useState(""),u=!!l;let V;e[0]!==n||e[1]!==c?(V=c.trim()?n.filter(C=>{const k=c.toLowerCase();return C.prompt.name.toLowerCase().includes(k)||(C.prompt.title??"").toLowerCase().includes(k)||(C.prompt.description??"").toLowerCase().includes(k)}):n,e[0]=n,e[1]=c,e[2]=V):V=e[2];const i=V,m=Zr();let f;e[3]!==i.length||e[4]!==c?(f=i.length===0&&s.jsxs("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:["No prompts match “",c,"”"]}),e[3]=i.length,e[4]=c,e[5]=f):f=e[5];let h;if(e[6]!==i||e[7]!==u||e[8]!==l?.name||e[9]!==o||e[10]!==a){let C;e[12]!==u||e[13]!==l?.name||e[14]!==o||e[15]!==a?(C=k=>s.jsx(ls,{item:k,variant:"card",onSelect:_=>{o(!1),a(_)},isLoading:l?.name===k.prompt.name,isDisabled:u&&l?.name!==k.prompt.name},k.prompt.name),e[12]=u,e[13]=l?.name,e[14]=o,e[15]=a,e[16]=C):C=e[16],h=i.map(C),e[6]=i,e[7]=u,e[8]=l?.name,e[9]=o,e[10]=a,e[11]=h}else h=e[11];let p;e[17]!==f||e[18]!==h?(p=s.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[f,h]})}),e[17]=f,e[18]=h,e[19]=p):p=e[19];const x=p;let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=C=>{C.key==="Escape"&&d("")},e[20]=b):b=e[20];let g;e[21]!==c?(g=s.jsx(Jr,{value:c,onChange:d,placeholder:"Search prompts...",onKeyDown:b}),e[21]=c,e[22]=g):g=e[22];const v=g;if(m){let C;e[23]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(Yr,{className:"sr-only",children:s.jsx(Hr,{children:"All prompts"})}),e[23]=C):C=e[23];let k;e[24]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[24]=k):k=e[24];let _;e[25]!==x||e[26]!==v?(_=s.jsxs(Gr,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[C,k,v,x]}),e[25]=x,e[26]=v,e[27]=_):_=e[27];let E;return e[28]!==o||e[29]!==r||e[30]!==_?(E=s.jsx(kt,{delayDuration:400,children:s.jsx(Wr,{open:r,onOpenChange:o,children:_})}),e[28]=o,e[29]=r,e[30]=_,e[31]=E):E=e[31],E}let w;e[32]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(it,{className:"sr-only",children:s.jsx(ct,{children:"All prompts"})}),e[32]=w):w=e[32];let S;e[33]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[33]=S):S=e[33];let A;e[34]!==x||e[35]!==v?(A=s.jsxs(dt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[w,S,v,x]}),e[34]=x,e[35]=v,e[36]=A):A=e[36];let y;return e[37]!==o||e[38]!==r||e[39]!==A?(y=s.jsx(kt,{delayDuration:400,children:s.jsx(ut,{open:r,onOpenChange:o,children:A})}),e[37]=o,e[38]=r,e[39]=A,e[40]=y):y=e[40],y}function oa(t){const e=O.c(29),{items:n,onSelect:r,loadingPrompt:o,className:a}=t,[l,c]=j.useState(!1);if(n.length===0)return null;let d,u,V;if(e[0]!==n||e[1]!==o||e[2]!==r){const b=n.slice(0,ln);let g;e[6]!==n?(g=n.slice(ln),e[6]=n,e[7]=g):g=e[7],d=g,u=!!o;let v;e[8]!==u||e[9]!==o?.name||e[10]!==r?(v=w=>s.jsx(ls,{item:w,onSelect:r,isLoading:o?.name===w.prompt.name,isDisabled:u&&o?.name!==w.prompt.name},w.prompt.name),e[8]=u,e[9]=o?.name,e[10]=r,e[11]=v):v=e[11],V=b.map(v),e[0]=n,e[1]=o,e[2]=r,e[3]=d,e[4]=u,e[5]=V}else d=e[3],u=e[4],V=e[5];const i=V;let m;e[12]!==a?(m=U("w-full flex flex-wrap gap-2 justify-center",a),e[12]=a,e[13]=m):m=e[13];let f;e[14]!==d.length||e[15]!==u?(f=d.length>0&&s.jsxs("button",{type:"button",disabled:u,onClick:()=>c(!0),className:U(as,"hover:bg-muted/70 hover:text-foreground",u&&"opacity-50 cursor-not-allowed"),children:["+",d.length," more"]}),e[14]=d.length,e[15]=u,e[16]=f):f=e[16];let h;e[17]!==i||e[18]!==m||e[19]!==f?(h=s.jsxs("div",{className:m,children:[i,f]}),e[17]=i,e[18]=m,e[19]=f,e[20]=h):h=e[20];let p;e[21]!==n||e[22]!==o||e[23]!==l||e[24]!==r?(p=s.jsx(ra,{items:n,open:l,onOpenChange:c,onSelect:r,loadingPrompt:o}),e[21]=n,e[22]=o,e[23]=l,e[24]=r,e[25]=p):p=e[25];let x;return e[26]!==h||e[27]!==p?(x=s.jsxs(kt,{delayDuration:400,children:[h,p]}),e[26]=h,e[27]=p,e[28]=x):x=e[28],x}function aa(){return null}function la(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function ia(t){const e=O.c(30),{connectionId:n}=t,{sendMessage:r}=Pe(),{org:o}=de();let a;e[0]!==n||e[1]!==o.id||e[2]!==o.slug?(a={connectionId:n,orgId:o.id,orgSlug:o.slug},e[0]=n,e[1]=o.id,e[2]=o.slug,e[3]=a):a=e[3];const l=Me(a);let c;e[4]!==l?(c={client:l,staleTime:6e4},e[4]=l,e[5]=c):c=e[5];const{data:d}=eo(c);let u;e[6]!==d?.prompts?(u=d?.prompts??[],e[6]=d?.prompts,e[7]=u):u=e[7];const V=u;let i;e[8]!==V?(i=V.map(ca),e[8]=V,e[9]=i):i=e[9];const m=i;let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f={stage:"idle"},e[10]=f):f=e[10];const[h,p]=j.useReducer(la,f),[x,b]=j.useState(null);let g;e[11]!==l||e[12]!==r?(g=async(T,N)=>{if(!l){le.error("MCP client not available"),p({type:"RESET"});return}try{const M=await ft(l,T.name,N);p({type:"RESET"});const I={type:"doc",content:[{type:"paragraph",content:[Ln({id:T.name,name:lt(T.name,me(T._meta)),metadata:M.messages,char:"/",kind:"prompt",args:N}),{type:"text",text:" "}]}]};await r(I)}catch(M){console.error("[ice-breakers] Failed to fetch prompt:",M),le.error("Failed to load prompt. Please try again."),p({type:"RESET"})}},e[11]=l,e[12]=r,e[13]=g):g=e[13];const v=g;let w;e[14]!==v?(w=async T=>{if(T.arguments&&T.arguments.length>0){p({type:"SELECT_PROMPT",prompt:T}),b(T);return}p({type:"START_LOADING",prompt:T}),await v(T)},e[14]=v,e[15]=w):w=e[15];const S=w;let A;e[16]!==x||e[17]!==v?(A=async T=>{x&&(p({type:"START_LOADING",prompt:x,arguments:T}),b(null),await v(x,T))},e[16]=x,e[17]=v,e[18]=A):A=e[18];const y=A;if(m.length===0)return null;const C=h.stage==="loading"?h.prompt:null;let k;e[19]!==S||e[20]!==m||e[21]!==C?(k=s.jsx(oa,{items:m,onSelect:S,loadingPrompt:C}),e[19]=S,e[20]=m,e[21]=C,e[22]=k):k=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=()=>{b(null),p({type:"RESET"})},e[23]=_):_=e[23];let E;e[24]!==x||e[25]!==y?(E=s.jsx(Ze,{prompt:x,setPrompt:_,onSubmit:y}),e[24]=x,e[25]=y,e[26]=E):E=e[26];let D;return e[27]!==k||e[28]!==E?(D=s.jsxs(s.Fragment,{children:[k,E]}),e[27]=k,e[28]=E,e[29]=D):D=e[29],D}function ca(t){return{prompt:t}}function da(t){const e=O.c(13),{className:n}=t,{selectedVirtualMcp:r}=he(),{org:o}=de();let a;e[0]!==o.id?(a=Vt(o.id),e[0]=o.id,e[1]=a):a=e[1];const l=a.id,c=r?.id??l;let d;e[2]!==n?(d=U("w-full @container",n),e[2]=n,e[3]=d):d=e[3];const u=c??"default";let V;e[4]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx(aa,{}),e[4]=V):V=e[4];let i;e[5]!==c?(i=s.jsx(ia,{connectionId:c}),e[5]=c,e[6]=i):i=e[6];let m;e[7]!==u||e[8]!==i?(m=s.jsx(Qs,{fallback:null,children:s.jsx(j.Suspense,{fallback:V,children:i},u)}),e[7]=u,e[8]=i,e[9]=m):m=e[9];let f;return e[10]!==d||e[11]!==m?(f=s.jsx("div",{className:d,children:m}),e[10]=d,e[11]=m,e[12]=f):f=e[12],f}const yt="cubic-bezier(0.645, 0.045, 0.355, 1)",ua=44,Va={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-amber-500/5 after:pointer-events-none after:-z-10"},fa={default:"border-border",error:"border-destructive/30",warning:"border-amber-500/30"},ma={default:"text-muted-foreground",error:"text-destructive",warning:"text-amber-600 dark:text-amber-500"};function pe(t){const e=O.c(61),{icon:n,label:r,count:o,title:a,footerLeft:l,footerRight:c,children:d,defaultExpanded:u,variant:V,onClose:i}=t,m=V===void 0?"default":V,[f,h]=j.useState(u),[p,x]=j.useState(!1);let b;e[0]!==i?(b=()=>{x(!0),i?.()},e[0]=i,e[1]=b):b=e[1];const g=b;if(p)return null;const v=fa[m],w=Va[m];let S;e[2]!==v||e[3]!==w?(S=U("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",v,w),e[2]=v,e[3]=w,e[4]=S):S=e[4];let A;e[5]===Symbol.for("react.memo_cache_sentinel")?(A=()=>h(pa),e[5]=A):A=e[5];const y=f&&"rounded-b-none",C=!f&&"rounded-b-xl";let k;e[6]!==y||e[7]!==C?(k=U("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",y,C),e[6]=y,e[7]=C,e[8]=k):k=e[8];const _=ma[m];let E;e[9]!==_?(E=U("shrink-0",_),e[9]=_,e[10]=E):E=e[10];let D;e[11]!==n||e[12]!==E?(D=s.jsx("span",{className:E,children:n}),e[11]=n,e[12]=E,e[13]=D):D=e[13];let T;e[14]!==r?(T=s.jsx("span",{className:"flex-1 min-w-0 truncate",children:r}),e[14]=r,e[15]=T):T=e[15];let N;e[16]!==o?(N=o?s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:o}):null,e[16]=o,e[17]=N):N=e[17];const M=f?"rotate(180deg)":"rotate(0deg)";let I;e[18]!==M?(I=s.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:s.jsx(mt,{size:16,style:{transform:M,transition:`transform 180ms ${yt}`}})}),e[18]=M,e[19]=I):I=e[19];let P,R;e[20]!==g?(P=se=>{se.stopPropagation(),g()},R=se=>{(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),se.stopPropagation(),g())},e[20]=g,e[21]=P,e[22]=R):(P=e[21],R=e[22]);let $;e[23]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(_e,{size:16}),e[23]=$):$=e[23];let z;e[24]!==P||e[25]!==R?(z=s.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":"Close",title:"Close",onClick:P,onKeyDown:R,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:$}),e[24]=P,e[25]=R,e[26]=z):z=e[26];let L;e[27]!==f||e[28]!==D||e[29]!==T||e[30]!==N||e[31]!==I||e[32]!==z||e[33]!==k?(L=s.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":f,onClick:A,className:k,children:[D,T,N,I,z]}),e[27]=f,e[28]=D,e[29]=T,e[30]=N,e[31]=I,e[32]=z,e[33]=k,e[34]=L):L=e[34];const q=f?"1fr":"0fr";let K;e[35]!==q?(K={display:"grid",gridTemplateRows:q,transition:`grid-template-rows 180ms ${yt}`},e[35]=q,e[36]=K):K=e[36];let Q;e[37]===Symbol.for("react.memo_cache_sentinel")?(Q={overflow:"hidden",minHeight:0},e[37]=Q):Q=e[37];const F=f?1:0;let B;e[38]!==F?(B={opacity:F,transition:`opacity 120ms ${yt}`},e[38]=F,e[39]=B):B=e[39];let Y;e[40]!==a?(Y=a?s.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:s.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:a})}):s.jsx("div",{className:"border-t border-dashed border-border/60"}),e[40]=a,e[41]=Y):Y=e[41];let H;e[42]!==d||e[43]!==a?(H=d?s.jsx("div",{className:U("overflow-clip pb-4",!a&&"pt-4"),children:d}):null,e[42]=d,e[43]=a,e[44]=H):H=e[44];let Z;e[45]!==l||e[46]!==c?(Z=l||c?s.jsx("div",{className:"border-t border-border px-3 py-3 pb-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:l}),s.jsx("div",{className:"flex items-center gap-2",children:c})]})}):null,e[45]=l,e[46]=c,e[47]=Z):Z=e[47];let X;e[48]!==B||e[49]!==Y||e[50]!==H||e[51]!==Z?(X=s.jsx("div",{style:Q,children:s.jsxs("div",{style:B,children:[Y,H,Z]})}),e[48]=B,e[49]=Y,e[50]=H,e[51]=Z,e[52]=X):X=e[52];let ee;e[53]!==K||e[54]!==X?(ee=s.jsx("div",{"data-testid":"collapsible-highlight-body",style:K,children:X}),e[53]=K,e[54]=X,e[55]=ee):ee=e[55];let te;return e[56]!==L||e[57]!==ee||e[58]!==S||e[59]!==m?(te=s.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":m,className:S,children:[L,ee]}),e[56]=L,e[57]=ee,e[58]=S,e[59]=m,e[60]=te):te=e[60],te}function pa(t){return!t}const ha=ye({content:Re().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Pt(["pending","in_progress","completed"]),activeForm:Re().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),is=ye({todos:Ys(ha)}),xa="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";to({description:xa,inputSchema:no(is),execute:async({todos:t})=>({ok:!0,count:t.length})});const ga="tool-todo_write",ba=new Set(["input-available","output-available"]);function cs(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n.role!=="assistant")continue;const r=n.parts;if(Array.isArray(r))for(let o=r.length-1;o>=0;o--){const a=r[o];if(a.type!==ga||typeof a.state!="string"||!ba.has(a.state))continue;const l=is.safeParse(a.input);if(l.success)return l.data.todos}}return[]}function ds(t){const e=[];for(const n of t)if("state"in n&&n.state==="approval-requested"&&"approval"in n&&n.approval?.id&&"toolCallId"in n&&n.toolCallId){const r="toolName"in n&&typeof n.toolName=="string"?n.toolName:n.type.startsWith("tool-")?n.type.replace("tool-",""):"Tool";e.push({approvalId:n.approval.id,toolCallId:n.toolCallId,toolName:r,friendlyName:Nr(kr(r)),input:n.input})}return e}function us(t){const e=[];for(const n of t)if("type"in n&&n.type==="tool-propose_plan"&&"state"in n&&n.state==="input-available"&&"toolCallId"in n&&"input"in n){const r=n.input;e.push({toolCallId:n.toolCallId,plan:r.plan,state:n.state})}return e}function va(t){return t?t.message.startsWith("[CREDITS]"):!1}const ya={isCreditExhausted:!1,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1};function Aa(t){const{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=t;if(!o&&n&&va(n))return{...ya,isCreditExhausted:!0};const l=e.at(-1),c=l?.role==="assistant"?l.parts:[],d=c,V=!!d.filter(v=>v.type==="tool-user_ask").filter(v=>v.state!=="output-available").length,i=us(c),m=ds(d),f=cs(e),h=!o&&!!n,p=m.length>0||o&&a,x=i.length>0,g=!o&&!!r&&r!=="stop"&&!(r==="tool-calls"&&(V||p||x))&&!h;return{isCreditExhausted:!1,hasTodos:f.length>0,showError:h,showWarning:g,hasApprovals:p,hasPlans:x,isWaitingForUserInput:V}}function Vs(){const t=O.c(6),{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=Pe(),l=n??null,c=r??null;let d;return t[0]!==o||t[1]!==a||t[2]!==e||t[3]!==l||t[4]!==c?(d=Aa({messages:e,error:l,finishReason:c,isStreaming:o,isWaitingForApprovals:a}),t[0]=o,t[1]=a,t[2]=e,t[3]=l,t[4]=c,t[5]=d):d=t[5],d}function ja(){const t=Vs();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function fs(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(n=>n.type==="hardBreak"||n.type==="text"&&(!n.text||n.text.trim()==="")):!1)}const wa="__home__";function Yt(t,e){return Hs.chatDraft(t,e)}function Sa(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const n=e.tiptapDoc;return!n||typeof n!="object"||n.type!=="doc"||!Array.isArray(n.content)?null:n}function Ca(t,e,n,r,o){const a=Yt(e,n);if(fs(r)){t.removeItem(a);return}const l={tiptapDoc:r,updatedAt:Date.now()},c=JSON.stringify(l);try{t.setItem(a,c)}catch(d){if(ka(d)){const u=new TextEncoder().encode(c).byteLength;o?.onQuotaExceeded?.({docSizeBytes:u});return}throw d}}function cn(t,e,n){const r=Yt(e,n),o=t.getItem(r),a=Sa(o);return o!==null&&a===null&&t.removeItem(r),a}function Na(t,e,n){t.removeItem(Yt(e,n))}function ka(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function _a(t){const e=O.c(21),{current:n,total:r,onPrev:o,onNext:a}=t;if(r<=1)return null;const l=n===0,c=n===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let d;e[0]!==c?(d=U("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Co,{size:14}),e[2]=u):u=e[2];let V;e[3]!==o||e[4]!==l||e[5]!==d?(V=s.jsx("button",{type:"button",onClick:o,disabled:l,className:d,"aria-label":"Previous question",children:u}),e[3]=o,e[4]=l,e[5]=d,e[6]=V):V=e[6];const i=n+1;let m;e[7]!==i||e[8]!==r?(m=s.jsxs("span",{className:"tabular-nums text-xs",children:[i," of ",r]}),e[7]=i,e[8]=r,e[9]=m):m=e[9];const f=n===r-1,h=n===r-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let p;e[10]!==h?(p=U("p-0.5 rounded transition-colors",h),e[10]=h,e[11]=p):p=e[11];let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Jn,{size:14}),e[12]=x):x=e[12];let b;e[13]!==a||e[14]!==p||e[15]!==f?(b=s.jsx("button",{type:"button",onClick:a,disabled:f,className:p,"aria-label":"Next question",children:x}),e[13]=a,e[14]=p,e[15]=f,e[16]=b):b=e[16];let g;return e[17]!==b||e[18]!==V||e[19]!==m?(g=s.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[V,m,b]}),e[17]=b,e[18]=V,e[19]=m,e[20]=g):g=e[20],g}function ms(t){const e=O.c(8),{currentIndex:n,total:r,onPrev:o,onNext:a,extraLeft:l}=t;let c;e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==r?(c=s.jsx(_a,{current:n,total:r,onPrev:o,onNext:a}),e[0]=n,e[1]=a,e[2]=o,e[3]=r,e[4]=c):c=e[4];let d;return e[5]!==l||e[6]!==c?(d=s.jsxs("div",{className:"flex items-center gap-2",children:[c,l]}),e[5]=l,e[6]=c,e[7]=d):d=e[7],d}function Ia(t){const e=O.c(17),{isStreaming:n,isAllAnswered:r,isCurrentAnswered:o,onAdvanceOrSubmit:a,submitLabel:l,nextLabel:c}=t,V=r?l===void 0?"Submit":l:c===void 0?"Next":c,i=r?n:!o,m=i?r?"Waiting for the assistant to finish…":"Answer this item to continue":null;let f;e[0]!==i||e[1]!==a?(f=()=>{i||a()},e[0]=i,e[1]=a,e[2]=f):f=e[2];const h=i&&"opacity-50 cursor-not-allowed";let p;e[3]!==h?(p=U("h-7 px-2.5 text-xs",h),e[3]=h,e[4]=p):p=e[4];let x;e[5]!==i||e[6]!==V||e[7]!==f||e[8]!==p?(x=s.jsx(re,{type:"button",size:"sm","aria-disabled":i,onClick:f,className:p,children:V}),e[5]=i,e[6]=V,e[7]=f,e[8]=p,e[9]=x):x=e[9];const b=x;if(!m)return b;let g;e[10]!==b?(g=s.jsx(xe,{asChild:!0,children:b}),e[10]=b,e[11]=g):g=e[11];let v;e[12]!==m?(v=s.jsx(ge,{children:m}),e[12]=m,e[13]=v):v=e[13];let w;return e[14]!==g||e[15]!==v?(w=s.jsxs(be,{children:[g,v]}),e[14]=g,e[15]=v,e[16]=w):w=e[16],w}function ps(t,e,n){return t.findIndex(r=>e(r)===n)}function dn(t,e,n,r){return t.length===0?!1:t.every(o=>r(n[e(o)]))}function un(t,e,n,r,o){if(t.length===0)return null;const a=ps(t,e,o);for(let l=1;l<=t.length;l++){const c=t[(a+l)%t.length];if(!c)continue;const d=e(c);if(d!==o&&!r(n[d]))return d}return null}function Ea(t){return!t.isStreaming&&t.allAnswered}function hs(t){const{parts:e,partKey:n,schema:r,defaultValues:o,isStreaming:a,hasAnswer:l,onSubmit:c}=t,d=e[0]?n(e[0]):"",[u,V]=j.useState(d),[i,m]=j.useState(!1),f=Gs({resolver:Ws(r),defaultValues:o}),h=f.watch(),p=ps(e,n,u),x=p>=0?e[p]:void 0,b=l(h[u]),g=dn(e,n,h,l),v=Ea({isStreaming:a,allAnswered:g}),w=()=>{if(p>0){const E=e[p-1];E&&V(n(E))}},S=()=>{if(p>=0&&p<e.length-1){const E=e[p+1];E&&V(n(E))}},A=()=>{const E=f.getValues(),D=un(e,n,E,l,u);D&&V(D)},y=()=>{f.handleSubmit(E=>{const D=E;for(const T of e)c(T,D[n(T)])})()},C=j.useRef(y);C.current=y;const k=()=>{v&&(m(!1),C.current())},_=()=>{const E=f.getValues();if(dn(e,n,E,l)){if(a){m(!0);return}m(!1),C.current()}else{const D=un(e,n,E,l,u);D&&V(D)}};return j.useEffect(()=>{if(i&&!a){if(!g){m(!1);return}m(!1),C.current()}},[i,a,g]),{form:f,activeKey:u,setActiveKey:V,currentIndex:p,currentPart:x,isCurrentAnswered:b,isAllAnswered:g,canSubmit:v,goPrev:w,goNext:S,advanceToNextUnanswered:A,submit:k,submitOrAdvance:_}}const xs="User denied this tool call, give other alternatives.";function gs(t){const e=O.c(9),{onYolo:n}=t,[r,o]=De();let a;e[0]!==n||e[1]!==r||e[2]!==o?(a=V=>{const i=V,m=r.toolApprovalLevel??"readonly";o({...r,toolApprovalLevel:i}),i==="auto"&&n(m)},e[0]=n,e[1]=r,e[2]=o,e[3]=a):a=e[3];const l=a;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(wo,{size:"xs",className:"text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",onClick:Ta,children:s.jsx(So,{})}),e[4]=c):c=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(yo,{children:Oe.map(Ra)}),e[5]=d):d=e[5];let u;return e[6]!==l||e[7]!==r.toolApprovalLevel?(u=s.jsxs(Ao,{value:r.toolApprovalLevel,onValueChange:l,children:[c,d]}),e[6]=l,e[7]=r.toolApprovalLevel,e[8]=u):u=e[8],u}function Ra(t){return s.jsx(jo,{value:t.value,children:t.label},t.value)}function Ta(t){return t.stopPropagation()}function bs(t){const e=O.c(5),{input:n}=t;if(n==null){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:"No input"}),e[0]=a):a=e[0],a}let r;try{let a;e[1]!==n?(a=JSON.stringify(n,null,2),e[1]=n,e[2]=a):a=e[2],r=a}catch{r=String(n)}let o;return e[3]!==r?(o=s.jsx("div",{className:"px-4",children:s.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:r})}),e[3]=r,e[4]=o):o=e[4],o}function Da(t){const e=O.c(28),{approval:n,onRespond:r}=t,[o]=De(),a=o.toolApprovalLevel??"readonly";let l;e[0]!==n.approvalId||e[1]!==a||e[2]!==r?(l=()=>r(n.approvalId,!1,xs,a),e[0]=n.approvalId,e[1]=a,e[2]=r,e[3]=l):l=e[3];const c=l;let d;e[4]!==n.approvalId||e[5]!==a||e[6]!==r?(d=()=>r(n.approvalId,!0,void 0,a),e[4]=n.approvalId,e[5]=a,e[6]=r,e[7]=d):d=e[7];const u=d;let V;e[8]!==n.approvalId||e[9]!==r?(V=S=>r(n.approvalId,!0,void 0,S),e[8]=n.approvalId,e[9]=r,e[10]=V):V=e[10];const i=V;let m;e[11]!==i?(m=s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(gs,{onYolo:i})}),e[11]=i,e[12]=m):m=e[12];const f=m;let h;e[13]!==c?(h=s.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:c,children:"Deny"}),e[13]=c,e[14]=h):h=e[14];let p;e[15]!==u?(p=s.jsx(re,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:u,children:"Accept"}),e[15]=u,e[16]=p):p=e[16];let x;e[17]!==h||e[18]!==p?(x=s.jsxs(s.Fragment,{children:[h,p]}),e[17]=h,e[18]=p,e[19]=x):x=e[19];const b=x;let g;e[20]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(pt,{size:14}),e[20]=g):g=e[20];let v;e[21]!==n.input?(v=s.jsx(bs,{input:n.input}),e[21]=n.input,e[22]=v):v=e[22];let w;return e[23]!==n.friendlyName||e[24]!==f||e[25]!==b||e[26]!==v?(w=s.jsx(pe,{icon:g,label:"Approval needed",title:n.friendlyName,defaultExpanded:!0,footerLeft:f,footerRight:b,children:v}),e[23]=n.friendlyName,e[24]=f,e[25]=b,e[26]=v,e[27]=w):w=e[27],w}const Pa=Js(Re(),ye({approved:Zs().optional(),levelOverride:Pt(["auto","readonly"]).optional()}));function Ma(t){const e=O.c(42),{approvals:n,isStreaming:r,onRespond:o}=t,[a]=De(),l=a.toolApprovalLevel??"readonly";let c;e[0]!==n?(c=Object.fromEntries(n.map(Oa)),e[0]=n,e[1]=c):c=e[1];const d=c;let u;e[2]!==l||e[3]!==o?(u=(_,E)=>{const D=E;typeof D?.approved=="boolean"&&o(_.approvalId,D.approved,D.approved===!1?xs:void 0,D.levelOverride??l)},e[2]=l,e[3]=o,e[4]=u):u=e[4];let V;e[5]!==n||e[6]!==d||e[7]!==r||e[8]!==u?(V={parts:n,partKey:$a,schema:Pa,defaultValues:d,isStreaming:r,hasAnswer:Fa,onSubmit:u},e[5]=n,e[6]=d,e[7]=r,e[8]=u,e[9]=V):V=e[9];const i=hs(V);let m;e[10]!==n||e[11]!==i?(m=_=>{i.form.reset(Object.fromEntries(n.map(E=>[E.approvalId,{approved:!0,levelOverride:_}]))),i.submitOrAdvance()},e[10]=n,e[11]=i,e[12]=m):m=e[12];const f=m,h=i.currentPart;let p;e[13]!==i?(p=_=>{_.preventDefault(),i.submit()},e[13]=i,e[14]=p):p=e[14];let x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(pt,{size:14}),e[15]=x):x=e[15];const b=`${n.length} approvals pending`,g=h?.friendlyName??"";let v;e[16]!==f?(v=s.jsx(gs,{onYolo:f}),e[16]=f,e[17]=v):v=e[17];let w;e[18]!==n.length||e[19]!==i.currentIndex||e[20]!==i.goNext||e[21]!==i.goPrev||e[22]!==v?(w=s.jsx(ms,{currentIndex:i.currentIndex,total:n.length,onPrev:i.goPrev,onNext:i.goNext,extraLeft:v}),e[18]=n.length,e[19]=i.currentIndex,e[20]=i.goNext,e[21]=i.goPrev,e[22]=v,e[23]=w):w=e[23];let S;e[24]!==h||e[25]!==i.form.control||e[26]!==i.submitOrAdvance?(S=h?s.jsx(La,{approvalId:h.approvalId,control:i.form.control,onChange:i.submitOrAdvance}):null,e[24]=h,e[25]=i.form.control,e[26]=i.submitOrAdvance,e[27]=S):S=e[27];let A;e[28]!==h?(A=h?s.jsx(bs,{input:h.input}):null,e[28]=h,e[29]=A):A=e[29];let y;e[30]!==w||e[31]!==S||e[32]!==A||e[33]!==b||e[34]!==g?(y=s.jsx(pe,{icon:x,label:b,title:g,defaultExpanded:!0,footerLeft:w,footerRight:S,children:A}),e[30]=w,e[31]=S,e[32]=A,e[33]=b,e[34]=g,e[35]=y):y=e[35];let C;e[36]!==y||e[37]!==p?(C=s.jsx("form",{onSubmit:p,children:y}),e[36]=y,e[37]=p,e[38]=C):C=e[38];let k;return e[39]!==i.form||e[40]!==C?(k=s.jsx(It,{...i.form,children:C}),e[39]=i.form,e[40]=C,e[41]=k):k=e[41],k}function Fa(t){return typeof t?.approved=="boolean"}function $a(t){return t.approvalId}function Oa(t){return[t.approvalId,{approved:void 0}]}function La(t){const e=O.c(6),{approvalId:n,control:r,onChange:o}=t,a=`${n}.approved`;let l;e[0]!==o?(l=d=>{const{field:u}=d,V=u.value===!0,i=u.value===!1;return s.jsxs(s.Fragment,{children:[s.jsx(re,{type:"button",variant:i?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!1),o()},"aria-pressed":i,children:"Deny"}),s.jsx(re,{type:"button",variant:V?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!0),o()},"aria-pressed":V,children:"Accept"})]})},e[0]=o,e[1]=l):l=e[1];let c;return e[2]!==r||e[3]!==a||e[4]!==l?(c=s.jsx(Xs,{control:r,name:a,render:l}),e[2]=r,e[3]=a,e[4]=l,e[5]=c):c=e[5],c}function za(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(pt,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing approval request..."})]}),t[0]=e):e=t[0],e}function Ba(t){const e=O.c(8),{approvals:n,isStreaming:r,onRespond:o}=t;if(r&&n.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(za,{}),e[0]=l):l=e[0],l}if(n.length===0)return null;if(n.length===1){const l=n[0];if(!l)return null;let c;return e[1]!==o||e[2]!==l?(c=s.jsx(Da,{approval:l,onRespond:o}),e[1]=o,e[2]=l,e[3]=c):c=e[3],c}let a;return e[4]!==n||e[5]!==r||e[6]!==o?(a=s.jsx(Ma,{approvals:n,isStreaming:r,onRespond:o}),e[4]=n,e[5]=r,e[6]=o,e[7]=a):a=e[7],a}function Ua(t){const e=O.c(16),{plan:n,onApprove:r,onDismiss:o}=t;let a;e[0]!==r||e[1]!==n.plan?(a=()=>{r(n.plan)},e[0]=r,e[1]=n.plan,e[2]=a):a=e[2];const l=a;let c;e[3]!==o?(c=s.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:o,children:"Keep iterating"}),e[3]=o,e[4]=c):c=e[4];let d;e[5]!==l?(d=s.jsx(re,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:l,children:"Let's go"}),e[5]=l,e[6]=d):d=e[6];let u;e[7]!==c||e[8]!==d?(u=s.jsxs(s.Fragment,{children:[c,d]}),e[7]=c,e[8]=d,e[9]=u):u=e[9];const V=u;let i;e[10]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(uo,{size:14}),e[10]=i):i=e[10];let m;e[11]!==n.plan?(m=s.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:s.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:s.jsx(_r,{id:"plan-preview",part:{type:"text",text:n.plan}})})}),e[11]=n.plan,e[12]=m):m=e[12];let f;return e[13]!==V||e[14]!==m?(f=s.jsx(pe,{icon:i,label:"Plan ready",title:"Implementation Plan",defaultExpanded:!0,footerRight:V,children:m}),e[13]=V,e[14]=m,e[15]=f):f=e[15],f}function qa(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed border-purple-500/30 rounded-lg bg-purple-500/5 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(Ke,{className:"size-5 text-purple-500 shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing plan..."})]}),t[0]=e):e=t[0],e}function Ka(t){const e=O.c(7),{plans:n,isStreaming:r,onApprove:o,onDismiss:a}=t;if(r&&n.length===0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(qa,{}),e[0]=u):u=e[0],u}let l;e[1]!==n?(l=n.at(-1),e[1]=n,e[2]=l):l=e[2];const c=l;if(!c)return null;let d;return e[3]!==c||e[4]!==o||e[5]!==a?(d=s.jsx(Ua,{plan:c,onApprove:o,onDismiss:a}),e[3]=c,e[4]=o,e[5]=a,e[6]=d):d=e[6],d}function vs(t){return t?"response"in t?t.response:t.option??t.draft:""}const Vn=ye({response:Re().min(1,"Response is required")}),Qa=ye({option:Re().nullable(),draft:Re()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),Ya=ye({response:Pt(["yes","no"])});function Ha(t){switch(t.type){case"text":return Vn;case"choice":return Qa;case"confirm":return Ya;default:return Vn}}function Ga(t){const e={};for(const n of t)e[n.toolCallId]=Ha(n.input);return ye(e)}function Wa(t){const e=O.c(6),{control:n,name:r,placeholder:o}=t;let a;e[0]!==o?(a=c=>{const{field:d}=c,u=d.value??"";return s.jsxs(Lt,{children:[s.jsx(zt,{children:s.jsx("div",{className:"px-2",children:s.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Kn,{size:16,className:"text-muted-foreground"})}),s.jsx("input",{...d,value:u,type:"text",placeholder:o||"Type your response...",autoFocus:!0,"aria-label":"Text response input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),s.jsx(Bt,{})]})},e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==n||e[3]!==r||e[4]!==a?(l=s.jsx(Wn,{control:n,name:r,render:a}),e[2]=n,e[3]=r,e[4]=a,e[5]=l):l=e[5],l}function ys(t,e){const n=O.c(4);let r,o;n[0]!==t||n[1]!==e?(r=()=>{const a=l=>{const c=l.target.tagName;if(c==="INPUT"||c==="TEXTAREA"||l.metaKey||l.ctrlKey||l.altKey)return;const d=Number.parseInt(l.key,10);d>=1&&d<=t&&(l.preventDefault(),e(d-1))};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},o=[t,e],n[0]=t,n[1]=e,n[2]=r,n[3]=o):(r=n[2],o=n[3]),j.useEffect(r,o)}function Ja(t){const e=O.c(40),{control:n,name:r,options:o}=t,a=`${r}.option`;let l;e[0]!==n||e[1]!==a?(l={control:n,name:a,defaultValue:null},e[0]=n,e[1]=a,e[2]=l):l=e[2];const{field:c}=Jt(l),d=`${r}.draft`;let u;e[3]!==n||e[4]!==d?(u={control:n,name:d,defaultValue:""},e[3]=n,e[4]=d,e[5]=u):u=e[5];const{field:V}=Jt(u),i=c.value,m=V.value??"";let f;if(e[6]!==c||e[7]!==o?(f=D=>{const T=o[D];T!=null&&c.onChange(T)},e[6]=c,e[7]=o,e[8]=f):f=e[8],ys(o.length,f),o.length===0)return null;const h=i===null;let p;if(e[9]!==c||e[10]!==i||e[11]!==o){let D;e[13]!==c||e[14]!==i?(D=(T,N)=>{const M=i===T;return s.jsxs("button",{type:"button",onClick:()=>c.onChange(T),className:U("flex items-center gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",M&&"bg-accent/50",!M&&"hover:bg-accent/30"),"aria-label":`Select ${T}`,children:[s.jsx("span",{className:U("flex items-center justify-center size-6 rounded-md text-sm shrink-0",M?"bg-chart-1 text-white":"bg-muted text-foreground"),children:N+1}),s.jsx("span",{className:"text-sm text-foreground truncate",children:T})]},`${N}-${T}`)},e[13]=c,e[14]=i,e[15]=D):D=e[15],p=o.map(D),e[9]=c,e[10]=i,e[11]=o,e[12]=p}else p=e[12];const x=h&&"bg-accent/50",b=!h&&"hover:bg-accent/30";let g;e[16]!==x||e[17]!==b?(g=U("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",x,b),e[16]=x,e[17]=b,e[18]=g):g=e[18];let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Kn,{size:16,className:"text-muted-foreground"})}),e[19]=v):v=e[19];const w=h?m:"";let S;e[20]!==V||e[21]!==c||e[22]!==i?(S=D=>{V.onChange(D.target.value),i!==null&&c.onChange(null)},e[20]=V,e[21]=c,e[22]=i,e[23]=S):S=e[23];let A;e[24]!==c||e[25]!==i?(A=()=>{i!==null&&c.onChange(null)},e[24]=c,e[25]=i,e[26]=A):A=e[26];let y;e[27]!==w||e[28]!==S||e[29]!==A?(y=s.jsx("input",{type:"text",value:w,onChange:S,onFocus:A,placeholder:"Something else...","aria-label":"Custom choice input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[27]=w,e[28]=S,e[29]=A,e[30]=y):y=e[30];let C;e[31]!==y||e[32]!==g?(C=s.jsxs("label",{className:g,children:[v,y]}),e[31]=y,e[32]=g,e[33]=C):C=e[33];let k;e[34]!==C||e[35]!==p?(k=s.jsx(zt,{children:s.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":"Choice options",children:[p,C]})}),e[34]=C,e[35]=p,e[36]=k):k=e[36];let _;e[37]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(Bt,{}),e[37]=_):_=e[37];let E;return e[38]!==k?(E=s.jsxs(Lt,{children:[k,_]}),e[38]=k,e[39]=E):E=e[39],E}function Za(t){const e=O.c(6),{control:n,name:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const a=o,l=j.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=V=>{l.current?.onChange(a[V]??"")},e[1]=c):c=e[1],ys(a.length,c);let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=V=>{const{field:i}=V;return l.current=i,s.jsxs(Lt,{children:[s.jsx(zt,{children:s.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:a.map(m=>{const f=i.value===m;return s.jsxs("button",{type:"button",onClick:()=>i.onChange(m),className:U("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",f&&"bg-accent/50",!f&&"hover:bg-accent/30"),"aria-label":`Confirm ${m}`,children:[s.jsx("span",{className:U("flex items-center justify-center size-6 rounded-md text-sm shrink-0",f?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),s.jsx("span",{className:"text-sm text-foreground capitalize",children:m})]},m)})})}),s.jsx(Bt,{})]})},e[2]=d):d=e[2];let u;return e[3]!==n||e[4]!==r?(u=s.jsx(Wn,{control:n,name:r,render:d}),e[3]=n,e[4]=r,e[5]=u):u=e[5],u}function fn(t){const e=O.c(13),{input:n,control:r,toolCallId:o}=t;switch(n.type){case"text":{const a=`${o}.response`;let l;return e[0]!==r||e[1]!==n.default||e[2]!==a?(l=s.jsx(Wa,{control:r,name:a,placeholder:n.default}),e[0]=r,e[1]=n.default,e[2]=a,e[3]=l):l=e[3],l}case"choice":{let a;e[4]!==n.options?(a=n.options?.filter(Boolean)??[],e[4]=n.options,e[5]=a):a=e[5];const l=a;let c;return e[6]!==r||e[7]!==l||e[8]!==o?(c=s.jsx(Ja,{control:r,name:o,options:l}),e[6]=r,e[7]=l,e[8]=o,e[9]=c):c=e[9],c}case"confirm":{const a=`${o}.response`;let l;return e[10]!==r||e[11]!==a?(l=s.jsx(Za,{control:r,name:a}),e[10]=r,e[11]=a,e[12]=l):l=e[12],l}default:return null}}function Xa(t){const e=O.c(71),{parts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=Ga(n.map(sl)),e[0]=n,e[1]=a):a=e[1];const l=a;let c;e[2]!==n?(c=Object.fromEntries(n.map(nl)),e[2]=n,e[3]=c):c=e[3];const d=c;let u;e[4]!==o?(u=(P,R)=>{const $=vs(R);$&&o(P,$)},e[4]=o,e[5]=u):u=e[5];let V;e[6]!==d||e[7]!==r||e[8]!==n||e[9]!==l||e[10]!==u?(V={parts:n,partKey:tl,schema:l,defaultValues:d,isStreaming:r,hasAnswer:el,onSubmit:u},e[6]=d,e[7]=r,e[8]=n,e[9]=l,e[10]=u,e[11]=V):V=e[11];const i=hs(V),m=i.currentPart;let f;e[12]!==m||e[13]!==i?(f=()=>{const P=m;if(!P)return;const R=P.toolCallId;P.input?.type==="choice"?(i.form.setValue(`${R}.option`,null),i.form.setValue(`${R}.draft`,"user has skip this question")):i.form.setValue(`${R}.response`,"user has skip this question"),i.advanceToNextUnanswered()},e[12]=m,e[13]=i,e[14]=f):f=e[14];const h=f;let p;e[15]!==i.currentIndex||e[16]!==i.goNext||e[17]!==i.goPrev||e[18]!==n.length?(p=s.jsx(ms,{currentIndex:i.currentIndex,total:n.length,onPrev:i.goPrev,onNext:i.goNext}),e[15]=i.currentIndex,e[16]=i.goNext,e[17]=i.goPrev,e[18]=n.length,e[19]=p):p=e[19];const x=p;let b;e[20]!==h?(b=s.jsx(re,{type:"button",variant:"outline",size:"sm",onClick:h,className:"h-7",children:"Skip"}),e[20]=h,e[21]=b):b=e[21];let g;e[22]!==i.isAllAnswered||e[23]!==i.isCurrentAnswered||e[24]!==i.submitOrAdvance||e[25]!==r?(g=s.jsx(Ia,{isStreaming:r,isAllAnswered:i.isAllAnswered,isCurrentAnswered:i.isCurrentAnswered,onAdvanceOrSubmit:i.submitOrAdvance}),e[22]=i.isAllAnswered,e[23]=i.isCurrentAnswered,e[24]=i.submitOrAdvance,e[25]=r,e[26]=g):g=e[26];let v;e[27]!==b||e[28]!==g?(v=s.jsxs(s.Fragment,{children:[b,g]}),e[27]=b,e[28]=g,e[29]=v):v=e[29];const w=v;if(n.length===1){const P=n[0];if(!P?.input)return null;let R;e[30]!==i?(R=B=>{B.preventDefault(),i.submit()},e[30]=i,e[31]=R):R=e[31];let $;e[32]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(Et,{size:14}),e[32]=$):$=e[32];const z=P.input?.prompt??"Question",L=P.input;let q;e[33]!==i.form.control||e[34]!==P.toolCallId||e[35]!==L?(q=s.jsx(fn,{input:L,control:i.form.control,toolCallId:P.toolCallId}),e[33]=i.form.control,e[34]=P.toolCallId,e[35]=L,e[36]=q):q=e[36];let K;e[37]!==w||e[38]!==z||e[39]!==q?(K=s.jsx(pe,{icon:$,label:"Question pending",title:z,defaultExpanded:!0,footerRight:w,children:q}),e[37]=w,e[38]=z,e[39]=q,e[40]=K):K=e[40];let Q;e[41]!==R||e[42]!==K?(Q=s.jsx("form",{onSubmit:R,autoComplete:"off",children:K}),e[41]=R,e[42]=K,e[43]=Q):Q=e[43];let F;return e[44]!==i.form||e[45]!==Q?(F=s.jsx(It,{...i.form,children:Q}),e[44]=i.form,e[45]=Q,e[46]=F):F=e[46],F}const S=i.form;let A;e[47]!==i?(A=P=>{P.preventDefault(),i.submit()},e[47]=i,e[48]=A):A=e[48];let y;e[49]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(Et,{size:14}),e[49]=y):y=e[49];const C=`${i.currentIndex+1} of ${n.length}`,k=m?.input?.prompt??"Question",_=i.activeKey,E=i.setActiveKey;let D;if(e[50]!==i.form||e[51]!==n){let P;e[53]!==i.form?(P=R=>s.jsx(ko,{value:R.toolCallId,className:"mt-0",children:s.jsx(fn,{input:R.input,control:i.form.control,toolCallId:R.toolCallId})},R.toolCallId),e[53]=i.form,e[54]=P):P=e[54],D=n.map(P),e[50]=i.form,e[51]=n,e[52]=D}else D=e[52];let T;e[55]!==i.activeKey||e[56]!==i.setActiveKey||e[57]!==D?(T=s.jsx(_o,{value:_,onValueChange:E,children:D}),e[55]=i.activeKey,e[56]=i.setActiveKey,e[57]=D,e[58]=T):T=e[58];let N;e[59]!==x||e[60]!==w||e[61]!==C||e[62]!==k||e[63]!==T?(N=s.jsx(pe,{icon:y,label:"Question pending",count:C,title:k,defaultExpanded:!0,footerLeft:x,footerRight:w,children:T}),e[59]=x,e[60]=w,e[61]=C,e[62]=k,e[63]=T,e[64]=N):N=e[64];let M;e[65]!==A||e[66]!==N?(M=s.jsx("form",{onSubmit:A,autoComplete:"off",children:N}),e[65]=A,e[66]=N,e[67]=M):M=e[67];let I;return e[68]!==i.form||e[69]!==M?(I=s.jsx(It,{...S,children:M}),e[68]=i.form,e[69]=M,e[70]=I):I=e[70],I}function el(t){return!!vs(t)}function tl(t){return t.toolCallId}function nl(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function sl(t){return{toolCallId:t.toolCallId,input:t.input}}function rl(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(Et,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing question..."})]}),t[0]=e):e=t[0],e}function As(t){const e=O.c(7),{userAskParts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=n.filter(ol),e[0]=n,e[1]=a):a=e[1];const l=a;if(l.length===0){if(r){let d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(rl,{}),e[2]=d):d=e[2],d}return null}let c;return e[3]!==r||e[4]!==o||e[5]!==l?(c=s.jsx(Xa,{parts:l,isStreaming:r,onSubmit:o}),e[3]=r,e[4]=o,e[5]=l,e[6]=c):c=e[6],c}function ol(t){return t.state==="input-available"}function al(t){const e=t.filter(a=>a.status==="in_progress"),n=t.filter(a=>a.status==="completed").length,r=t.length;if(r>0&&n===r)return{icon:"completed",activity:"All done",progress:`${r}/${r}`};const[o]=e;return o&&e.length===1?{icon:"in_progress",activity:o.activeForm,progress:`${n}/${r} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${n}/${r} done`}:n>0?{icon:"pending",activity:`${r-n} pending`,progress:`${n}/${r} done`}:{icon:"pending",activity:`${r} todos`,progress:"not started"}}function ll(){const t=O.c(21),{messages:e}=Pe();let n,r,o,a,l,c,d,u,V;if(t[0]!==e){V=Symbol.for("react.early_return_sentinel");e:{const f=cs(e);if(f.length===0){V=null;break e}const h=al(f);n=pe,l=s.jsx(ul,{status:h.icon}),c=h.activity,d=h.progress,u=!1,r="todos-list",o="flex flex-col px-2 max-h-[40vh] overflow-y-auto",a=f.map(il)}t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=a,t[5]=l,t[6]=c,t[7]=d,t[8]=u,t[9]=V}else n=t[1],r=t[2],o=t[3],a=t[4],l=t[5],c=t[6],d=t[7],u=t[8],V=t[9];if(V!==Symbol.for("react.early_return_sentinel"))return V;let i;t[10]!==r||t[11]!==o||t[12]!==a?(i=s.jsx("ul",{"data-testid":r,className:o,children:a}),t[10]=r,t[11]=o,t[12]=a,t[13]=i):i=t[13];let m;return t[14]!==n||t[15]!==l||t[16]!==c||t[17]!==d||t[18]!==u||t[19]!==i?(m=s.jsx(n,{icon:l,label:c,count:d,defaultExpanded:u,children:i}),t[14]=n,t[15]=l,t[16]=c,t[17]=d,t[18]=u,t[19]=i,t[20]=m):m=t[20],m}function il(t,e){return s.jsx(cl,{todo:t},e)}function cl(t){const e=O.c(14),{todo:n}=t,r=n.status==="completed",a=n.status==="in_progress"?n.activeForm:n.content;let l;e[0]!==n.status?(l=s.jsx(dl,{status:n.status}),e[0]=n.status,e[1]=l):l=e[1];const c=r&&"text-muted-foreground";let d;e[2]!==c?(d=U("relative text-sm leading-snug pt-px select-none",c),e[2]=c,e[3]=d):d=e[3];const u=r?"100%":"0%",V=r?"width 300ms ease 200ms":"width 150ms ease";let i;e[4]!==u||e[5]!==V?(i=s.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:u,transition:V}}),e[4]=u,e[5]=V,e[6]=i):i=e[6];let m;e[7]!==a||e[8]!==d||e[9]!==i?(m=s.jsxs("span",{className:d,children:[a,i]}),e[7]=a,e[8]=d,e[9]=i,e[10]=m):m=e[10];let f;return e[11]!==l||e[12]!==m?(f=s.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[l,m]}),e[11]=l,e[12]=m,e[13]=f):f=e[13],f}function dl(t){const e=O.c(4),{status:n}=t,r=n==="completed"?"true":void 0,o=n==="in_progress"?"true":void 0;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("svg",{viewBox:"0 0 21 21",children:s.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=a):a=e[0];let l;return e[1]!==r||e[2]!==o?(l=s.jsx("div",{className:"todo-cb mt-0.5","data-checked":r,"data-progress":o,"aria-hidden":"true",children:a}),e[1]=r,e[2]=o,e[3]=l):l=e[3],l}function ul(t){const e=O.c(3),{status:n}=t;if(n==="completed"){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("span",{"aria-label":"completed",className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:s.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:s.jsx("path",{d:"M1 4l2.5 2.5L9 1"})})}),e[0]=o):o=e[0],o}if(n==="in_progress"){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("span",{"aria-label":"in progress",className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[1]=o):o=e[1],o}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("span",{"aria-label":"pending",className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[2]=r):r=e[2],r}const Vl={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]},fl=["Access to 100+ AI models","Unified API, no separate keys needed","Pay only for what you use"];function js(t){const e=O.c(41),{onDismiss:n}=t,{org:r}=de(),o=ot(),{decoKeyId:a}=es(),l=ts(),[c,d]=j.useState(""),[u,V]=j.useState(!1),[i,m]=j.useState("usd"),f=i==="brl"?"R$":"$";let h,p;e[0]!==r.id?(h=()=>{G("credits_exhausted_shown",{organization_id:r.id})},p=[r.id],e[0]=r.id,e[1]=h,e[2]=p):(h=e[1],p=e[2]),j.useEffect(h,p);let x;e[3]!==i||e[4]!==l?(x=async P=>{const{url:R}=await l.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:P,currency:i});return R},e[3]=i,e[4]=l,e[5]=x):x=e[5];let b;e[6]!==n?(b=P=>{P&&window.open(P,"_blank","noopener,noreferrer"),n?.()},e[6]=n,e[7]=b):b=e[7];let g;e[8]!==x||e[9]!==b?(g={mutationFn:x,onSuccess:b,onError:hl},e[8]=x,e[9]=b,e[10]=g):g=e[10];const{mutate:v,isPending:w}=Mt(g),S=parseFloat(c),A=!isNaN(S)&&S>=1;let y;e[11]!==n?(y=P=>!P&&n?.(),e[11]=n,e[12]=y):y=e[12];let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[13]=C):C=e[13];let k;e[14]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:C.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[14]=k):k=e[14];let _;e[15]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[k,s.jsxs(it,{className:"relative gap-4",children:[s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),s.jsxs("div",{children:[s.jsx(ct,{className:"text-xl font-semibold tracking-tight",children:"Top up to keep building"}),s.jsx(Ot,{className:"mt-1.5 text-sm leading-relaxed",children:"Your credits are used up. Add more to continue using AI across all your agents."})]})]})]}),e[15]=_):_=e[15];let E;e[16]!==i||e[17]!==f||e[18]!==c||e[19]!==S||e[20]!==a||e[21]!==A||e[22]!==w||e[23]!==u||e[24]!==v?(E=a&&s.jsxs("div",{className:"px-8 pt-5 pb-6",children:[s.jsx("div",{className:"mb-4",children:s.jsxs(Zn,{type:"single",variant:"outline",size:"sm",value:i,onValueChange:P=>{P&&m(P)},children:[s.jsx(et,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(et,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),s.jsxs("div",{className:"rounded-xl border border-border p-5",children:[s.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:Vl[i].map(P=>{const{dollars:R,label:$}=P;return s.jsxs("button",{type:"button",disabled:w,onClick:()=>{G("credits_topup_clicked",{amount_cents:R*100,currency:i,tier_label:$,source:"exhausted_banner"}),v(R*100)},className:U("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[s.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[f,R]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:$})]},R)})}),u?s.jsxs("div",{className:"flex gap-2 mt-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:f}),s.jsx(Xn,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:P=>d(P.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(re,{className:"h-10",disabled:!A||w,onClick:()=>{G("credits_topup_clicked",{amount_cents:Math.round(S*100),currency:i,tier_label:"custom",source:"exhausted_banner"}),v(Math.round(S*100))},children:w?"Opening...":"Add"})]}):s.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>V(!0),children:"Enter custom amount"})]}),s.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:fl.map(ml)})]}),e[16]=i,e[17]=f,e[18]=c,e[19]=S,e[20]=a,e[21]=A,e[22]=w,e[23]=u,e[24]=v,e[25]=E):E=e[25];let D;e[26]!==n?(D=s.jsx(re,{variant:"ghost",size:"sm",onClick:n,children:"Dismiss"}),e[26]=n,e[27]=D):D=e[27];let T;e[28]!==o||e[29]!==n||e[30]!==r.slug?(T=s.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{o({to:"/$org/settings/ai-providers",params:{org:r.slug}}),n?.()},children:"Manage providers"}),e[28]=o,e[29]=n,e[30]=r.slug,e[31]=T):T=e[31];let N;e[32]!==D||e[33]!==T?(N=s.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[D,T]}),e[32]=D,e[33]=T,e[34]=N):N=e[34];let M;e[35]!==E||e[36]!==N?(M=s.jsxs(dt,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:pl,children:[_,E,N]}),e[35]=E,e[36]=N,e[37]=M):M=e[37];let I;return e[38]!==M||e[39]!==y?(I=s.jsx(ut,{open:!0,onOpenChange:y,children:M}),e[38]=M,e[39]=y,e[40]=I):I=e[40],I}function ml(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:s.jsx(Ke,{size:12,className:"text-[hsl(var(--chart-1))]"})}),s.jsx("span",{className:"text-sm text-foreground/80",children:t})]},t)}function pl(t){return t.preventDefault()}function hl(t){le.error(`Top-up failed: ${t.message}`)}function xl(){const t=O.c(5),e=at(),n=ns(),[r,o]=j.useState(!1);if(!(e?.lockedSandbox==="user-desktop")||!n.ready||n.online)return null;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Ut,{size:14}),t[0]=l):l=t[0];let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(re,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>o(!0),children:"Reconnect desktop"}),t[1]=c):c=t[1];let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(pe,{icon:l,label:"Your desktop is offline",title:"This chat runs on your desktop, which isn't connected right now.",defaultExpanded:!0,variant:"warning",footerRight:c,children:s.jsxs("p",{className:"mx-4 text-xs text-muted-foreground",children:["Run ",s.jsx("code",{className:"font-mono",children:"bunx decocms@latest link"})," in a terminal on that machine to bring it back. Messages you send while it's offline will fail."]})}),t[2]=d):d=t[2];let u;return t[3]!==r?(u=s.jsxs(s.Fragment,{children:[d,s.jsx(To,{open:r,onOpenChange:o})]}),t[3]=r,t[4]=u):u=t[4],u}function gl(t){const e=t.trim(),n=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),r=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),o=/failed to fetch|networkerror|load failed|offline/i.test(e),a=/timeout|timed out|aborted|deadline/i.test(e),l=e.length>240,c=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(c){const d=c[1]?.trim().replace(/\.$/,"");return{summary:d?`Your sandbox didn't finish starting up (${d}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return/link_unavailable|user_desktop_link_/i.test(e)?/user_desktop_link_capability_missing/i.test(e)?{summary:"Your desktop is connected, but the CLI this chat uses wasn't detected there. Install it and sign in on your desktop, then try again.",rawDetails:t}:{summary:"Your desktop is offline. Run `bunx decocms@latest link` in a terminal on it, then try again.",rawDetails:t}:r||n&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:o?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:a?{summary:"That took longer than expected. Try again.",rawDetails:t}:n||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const bl={length:"Response reached the model's output limit. Different models have different limits. Try switching models or asking it to continue.","content-filter":"Response was filtered due to content policy.","tool-calls":"Response paused after tool execution to prevent infinite loops and save costs. Click continue to keep working."};function tt(t){const e=O.c(19),{variant:n,onDismiss:r}=t,o=n==="error",a=o?"Error occurred":"Response incomplete",l=o?Gn:En,c=o?t.error.message:bl[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`;let d;e[0]!==o||e[1]!==c?(d=o?gl(c):{summary:c,rawDetails:null},e[0]=o,e[1]=c,e[2]=d):d=e[2];const{summary:u,rawDetails:V}=d;let i;e[3]!==l?(i=s.jsx(l,{size:14}),e[3]=l,e[4]=i):i=e[4];let m;e[5]!==o||e[6]!==t.onContinue||e[7]!==t.onFixInChat?(m=o?s.jsx(re,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}):s.jsx(re,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"}),e[5]=o,e[6]=t.onContinue,e[7]=t.onFixInChat,e[8]=m):m=e[8];let f;e[9]!==V?(f=V?s.jsxs("details",{className:"group mx-4",children:[s.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[s.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"m4.5 3 3 3-3 3"})}),s.jsx("span",{className:"group-open:hidden",children:"Show technical details"}),s.jsx("span",{className:"hidden group-open:inline",children:"Hide technical details"})]}),s.jsxs("div",{className:"relative mt-2",children:[s.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(V).then(yl).catch(vl)},"aria-label":"Copy error details",title:"Copy",className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:s.jsx(vo,{className:"size-3.5"})}),s.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:V})]})]}):null,e[9]=V,e[10]=f):f=e[10];let h;return e[11]!==a||e[12]!==r||e[13]!==u||e[14]!==i||e[15]!==m||e[16]!==f||e[17]!==n?(h=s.jsx(pe,{icon:i,label:a,title:u,defaultExpanded:!0,variant:n,onClose:r,footerRight:m,children:f}),e[11]=a,e[12]=r,e[13]=u,e[14]=i,e[15]=m,e[16]=f,e[17]=n,e[18]=h):h=e[18],h}function vl(){return le.error("Could not copy")}function yl(){return le.success("Copied to clipboard")}function xt(){const t=O.c(62),{error:e,clearError:n,finishReason:r,clearFinishReason:o,messages:a,isStreaming:l,submit:c,sendMessage:d}=Pe(),[u,V]=De(),{virtualMcpId:i,createTaskWithMessage:m}=Fn(),{chatMode:f,simpleModeTier:h}=he();let p;t[0]!==f||t[1]!==h||t[2]!==i?(p=W=>({tier:h,mode:f,toolApprovalLevel:W,agent:i?{id:i}:void 0}),t[0]=f,t[1]=h,t[2]=i,t[3]=p):p=t[3];const x=p;let b;t[4]!==u.toolApprovalLevel?(b=u.toolApprovalLevel??er(),t[4]=u.toolApprovalLevel,t[5]=b):b=t[5];const g=b,v=a.at(-1),w=v?.role==="assistant"?v.parts:[],S=w.filter(Sl),A=us(w),y=ds(w);let C;t[6]!==e||t[7]!==d?(C=()=>{if(e){const oe={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};d(oe)}},t[6]=e,t[7]=d,t[8]=C):C=t[8];const k=C;let _;t[9]!==d?(_=()=>{d({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[9]=d,t[10]=_):_=t[10];const E=_;let D;t[11]!==x||t[12]!==g||t[13]!==c?(D=(W,oe)=>{c({kind:"toolOutput",toolCallId:W.toolCallId,output:{response:oe}},x(g))},t[11]=x,t[12]=g,t[13]=c,t[14]=D):D=t[14];const T=D;let N;t[15]!==m||t[16]!==u||t[17]!==V||t[18]!==i?(N=W=>{V({...u,toolApprovalLevel:"auto"}),m({virtualMcpId:i,message:{parts:[{type:"text",text:`Implement this plan:
|
|
2
2
|
|
|
3
3
|
${W}`}]}})},t[15]=m,t[16]=u,t[17]=V,t[18]=i,t[19]=N):N=t[19];const M=N,I=wl;let P;t[20]!==x||t[21]!==c?(P=(W,oe,ne,ce)=>{c({kind:"approval",approvalId:W,approved:oe,...ne?{reason:ne}:{}},x(ce))},t[20]=x,t[21]=c,t[22]=P):P=t[22];const R=P,$=Vs();if($.isCreditExhausted){let W;return t[23]!==n?(W=s.jsx(js,{onDismiss:n}),t[23]=n,t[24]=W):W=t[24],W}const{showError:z,showWarning:L,hasApprovals:q}=$,K=S.map(jl).join("|"),Q=A[0]?.toolCallId??"",F=y.map(Al).join("|");let B,Y;t[25]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx(ll,{}),Y=s.jsx(xl,{}),t[25]=B,t[26]=Y):(B=t[25],Y=t[26]);let H;t[27]!==n||t[28]!==e||t[29]!==k||t[30]!==z?(H=z&&s.jsx(tt,{variant:"error",error:e,onDismiss:n,onFixInChat:k}),t[27]=n,t[28]=e,t[29]=k,t[30]=z,t[31]=H):H=t[31];let Z;t[32]!==o||t[33]!==r||t[34]!==E||t[35]!==L?(Z=L&&s.jsx(tt,{variant:"warning",finishReason:r,onDismiss:o,onContinue:E}),t[32]=o,t[33]=r,t[34]=E,t[35]=L,t[36]=Z):Z=t[36];let X;t[37]!==F||t[38]!==R||t[39]!==q||t[40]!==l||t[41]!==y?(X=q&&s.jsx(Ba,{approvals:y,isStreaming:l,onRespond:R},F),t[37]=F,t[38]=R,t[39]=q,t[40]=l,t[41]=y,t[42]=X):X=t[42];let ee;t[43]!==$.hasPlans||t[44]!==M||t[45]!==I||t[46]!==l||t[47]!==A||t[48]!==Q?(ee=$.hasPlans&&s.jsx(Ka,{plans:A,isStreaming:l,onApprove:M,onDismiss:I},Q),t[43]=$.hasPlans,t[44]=M,t[45]=I,t[46]=l,t[47]=A,t[48]=Q,t[49]=ee):ee=t[49];let te;t[50]!==$.isWaitingForUserInput||t[51]!==T||t[52]!==l||t[53]!==K||t[54]!==S?(te=$.isWaitingForUserInput&&s.jsx(As,{userAskParts:S,isStreaming:l,onSubmit:T},K),t[50]=$.isWaitingForUserInput,t[51]=T,t[52]=l,t[53]=K,t[54]=S,t[55]=te):te=t[55];let se;return t[56]!==Z||t[57]!==X||t[58]!==ee||t[59]!==te||t[60]!==H?(se=s.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[B,Y,H,Z,X,ee,te]}),t[56]=Z,t[57]=X,t[58]=ee,t[59]=te,t[60]=H,t[61]=se):se=t[61],se}function Al(t){return t.approvalId}function jl(t){return t.toolCallId}function wl(){document.querySelector("[data-chat-input]")?.focus()}function Sl(t){return t.type==="tool-user_ask"}xt.Error=function(e){return s.jsx(tt,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};xt.Warning=function(e){return s.jsx(tt,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};xt.UserAskQuestion=As;function Cl(t){const e=O.c(12),{taskId:n}=t,r=$n(n),o=vr(r),a=yr(),{stop:l,removeLocalMessage:c}=Pe();if(o.length===0)return null;let d;e[0]!==l?(d=()=>{l()},e[0]=l,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Mn,{size:14}),e[2]=u):u=e[2];let V;e[3]!==d?(V=s.jsx(xe,{asChild:!0,children:s.jsx(re,{type:"button",variant:"ghost",size:"icon-sm",onClick:d,children:u})}),e[3]=d,e[4]=V):V=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(ge,{side:"top",children:s.jsx("p",{className:"text-xs",children:"Send now"})}),e[5]=i):i=e[5];let m;e[6]!==V?(m=s.jsxs(be,{delayDuration:400,children:[V,i]}),e[6]=V,e[7]=m):m=e[7];let f;return e[8]!==a||e[9]!==c||e[10]!==n?(f=(h,p)=>s.jsxs("div",{className:"group/queuerow flex items-center gap-2 px-3 py-1.5",children:[s.jsx("span",{className:"flex size-[18px] shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground dark:bg-background",children:p+1}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:h.text}),s.jsx("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover/queuerow:opacity-100",children:s.jsx(re,{type:"button",variant:"ghost",size:"icon-sm",title:"Remove from queue",onClick:()=>{a.cancel(n,h.messageId).then(x=>{x&&(Ar(n,h.messageId),c(h.messageId))})},children:s.jsx(Do,{className:"size-3.5"})})})]},h.messageId),e[8]=a,e[9]=c,e[10]=n,e[11]=f):f=e[11],s.jsxs("div",{className:"mb-1 overflow-hidden rounded-2xl border border-border bg-card dark:bg-muted",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border py-1.5 pr-2 pl-3 text-xs text-muted-foreground",children:[s.jsxs("span",{children:[o.length," queued message",o.length>1?"s":""]}),m]}),o.map(f)]})}async function Nl(t,e,n){const r=await t.callTool({name:e,arguments:n});if(r.isError){const o=r.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(o)}return r}const ws=["SANDBOX_START"],Ye=new Map,kl=t=>`${t.virtualMcpId}::${t.branch??""}`,At=new Set,_l={mark:(t,e)=>At.add(`${t}::${e}`),clear:(t,e)=>At.delete(`${t}::${e}`),isStopped:(t,e)=>At.has(`${t}::${e}`)};function Il(t){const e=qe();return Mt({mutationKey:ws,mutationFn:async n=>{n.branch&&_l.clear(n.virtualMcpId,n.branch);const r=kl(n),o=Ye.get(r);if(o)return o;const a=(async()=>(await Nl(t,"SANDBOX_START",n)).structuredContent)();Ye.set(r,a);try{return await a}finally{Ye.get(r)===a&&Ye.delete(r)}},onSuccess:()=>{tr(e)}})}function wu(t,e){const n=O.c(3);let r;return n[0]!==e||n[1]!==t?(r={mutationKey:ws,predicate:a=>{if(!t)return!1;const l=a.state.variables;return!l||l.virtualMcpId!==t?!1:(l.branch??"")===(e??"")}},n[0]=e,n[1]=t,n[2]=r):r=n[2],ta(r)>0}function El(){const t=O.c(11),e=ns(),n=nr();let r;t[0]!==e.capabilities||t[1]!==e.online?(r=e.online&&e.capabilities.includes("claude-code"),t[0]=e.capabilities,t[1]=e.online,t[2]=r):r=t[2];let o;t[3]!==e.capabilities||t[4]!==e.online?(o=e.online&&e.capabilities.includes("codex"),t[3]=e.capabilities,t[4]=e.online,t[5]=o):o=t[5];let a;return t[6]!==e.online||t[7]!==n.runtime.agentSandbox||t[8]!==r||t[9]!==o?(a={agentSandbox:n.runtime.agentSandbox,userDesktop:e.online,claudeCode:r,codex:o},t[6]=e.online,t[7]=n.runtime.agentSandbox,t[8]=r,t[9]=o,t[10]=a):a=t[10],a}const Rl={fast:{modelId:"claude-code:haiku",label:"Haiku 4.5"},smart:{modelId:"claude-code:sonnet",label:"Sonnet 5"},thinking:{modelId:"claude-code:opus-1m",label:"Opus 4.8 1M"}},Tl={fast:{modelId:"codex:gpt-5.4-mini",label:"GPT-5.4 Mini"},smart:{modelId:"codex:gpt-5.4",label:"GPT-5.4"},thinking:{modelId:"codex:gpt-5.5",label:"GPT-5.5"}};function Dl(t){return t==="claude-code"?Rl:t==="codex"?Tl:null}function mn(t,e){return Dl(t)?.[e]??null}const Pl={"cloud-decopilot":"decopilot","local-decopilot":"decopilot-desktop","local-claude-code":"claude-code-desktop","local-codex":"codex-desktop"},Ml={decopilot:"cloud-decopilot","decopilot-desktop":"local-decopilot","claude-code-desktop":"local-claude-code","codex-desktop":"local-codex"};function Fl(t){return Pl[t]}function Ss(t){return t===null?"cloud-decopilot":Ml[t]}function Cs(){const t=O.c(2),{pendingAgentOption:e}=he();let n;return t[0]!==e?(n=Ss(e),t[0]=e,t[1]=n):n=t[1],n}function $l(){const t=O.c(2),{setPendingAgentOption:e}=he();let n;return t[0]!==e?(n=r=>e(Fl(r)),t[0]=e,t[1]=n):n=t[1],n}function Ol(){return he().simpleModeTier}function Ll(){return he().setSimpleModeTier}const zl={fast:"Quicker responses",smart:"Balanced quality",thinking:"Deeper reasoning"};function Bl(t,e){return t==="local-claude-code"?mn("claude-code",e)?.label??null:t==="local-codex"?mn("codex",e)?.label??null:zl[e]}const Ul={decopilot:"Decopilot","claude-code":"Claude Code",codex:"Codex"},ql=Vt("").icon;function nt(t){const e=O.c(4),{compact:n}=t,o=(n===void 0?!1:n)?"size-3.5 rounded-sm":"size-4 rounded-sm";let a;e[0]!==o?(a=U(o),e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==a?(l=s.jsx(Qn,{icon:ql,name:"Decopilot",size:"2xs",className:a}),e[2]=a,e[3]=l):l=e[3],l}const Kl={mode:"cloud-decopilot",label:"Decopilot",description:"Runs in an agent sandbox",group:"cloud",icon:s.jsx(nt,{}),isAvailable:t=>t.agentSandbox},Ql={mode:"local-decopilot",label:"Decopilot",description:"Runs on your desktop",group:"local",icon:s.jsx(nt,{}),isAvailable:t=>t.userDesktop},Yl={mode:"local-claude-code",label:"Claude Code",description:"Runs via Claude Code CLI",group:"local",icon:s.jsx(ss,{size:16}),isAvailable:t=>t.userDesktop&&t.claudeCode},Hl={mode:"local-codex",label:"Codex",description:"Runs via Codex CLI",group:"local",icon:s.jsx(rs,{size:16}),isAvailable:t=>t.userDesktop&&t.codex},pn=[Kl,Ql,Yl,Hl];function Gl(t,e){return t==="claude-code"?"local-claude-code":t==="codex"?"local-codex":e==="user-desktop"?"local-decopilot":"cloud-decopilot"}function Wl({selectedMode:t,lockedHarness:e,lockedSandbox:n,isThreadLocked:r}){if(r&&e!=null){const o=jr(e,n);return o?Ss(o):Gl(e,n)}return t}function Ns(t){return t==="local-decopilot"?{icon:s.jsx(nt,{compact:!0}),text:"Decopilot"}:t==="local-claude-code"?{icon:s.jsx(ss,{size:14}),text:"Claude Code"}:t==="local-codex"?{icon:s.jsx(rs,{size:14}),text:"Codex"}:{icon:s.jsx(nt,{compact:!0}),text:"Decopilot"}}function Jl(t){const{text:e}=Ns(t);return{icon:t==="cloud-decopilot"?s.jsx(Vo,{size:14}):s.jsx(Ut,{size:14}),text:e}}function jt(t){return t==="cloud-decopilot"?"cloud":"desktop"}const Zl="text-muted-foreground hover:text-foreground text-xs transition-[gap] duration-200",Xl="text-success hover:text-success";function ei(t){const e=O.c(91),{mode:n,availability:r,locked:o,lockedHarness:a,onSelect:l}=t,[c,d]=j.useState(!1);let u;e[0]!==o||e[1]!==n?(u=o?Ns(n):Jl(n),e[0]=o,e[1]=n,e[2]=u):u=e[2];const{icon:V,text:i}=u;let m;e[3]!==n?(m=jt(n),e[3]=n,e[4]=m):m=e[4];const f=`${i} on ${m}`,h=n!=="cloud-decopilot",p=a!=null,x=a?Ul[a]:null;let b,g,v,w,S,A,y,C,k,_,E,D,T;if(e[5]!==r||e[6]!==x||e[7]!==V||e[8]!==h||e[9]!==f||e[10]!==o||e[11]!==n||e[12]!==l||e[13]!==c||e[14]!==p||e[15]!==i){let P;e[29]!==r?(P=ne=>ne.group==="cloud"&&ne.isAvailable(r),e[29]=r,e[30]=P):P=e[30];const R=pn.filter(P),$=pn.filter(ti);let z;e[31]!==l?(z=ne=>{l(ne),d(!1)},e[31]=l,e[32]=z):z=e[32];const L=z;g=qt,w=c,S=o?void 0:d;let q;e[33]!==x||e[34]!==f||e[35]!==n||e[36]!==p?(q=p&&x?`This chat is using ${x} on ${jt(n)}. Start a new chat to use a different runtime.`:f,e[33]=x,e[34]=f,e[35]=n,e[36]=p,e[37]=q):q=e[37];const K=o?"mode-picker-locked":"mode-picker",Q=h&&Xl,F=o?"gap-0":"gap-0 @[320px]/chat-bottom:gap-1.5";let B;e[38]!==Q||e[39]!==F?(B=U(Zl,Q,"shrink min-w-0",F),e[38]=Q,e[39]=F,e[40]=B):B=e[40];const Y=!o&&"@[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100";let H;e[41]!==Y?(H=U("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0",Y),e[41]=Y,e[42]=H):H=e[42];let Z;e[43]!==H||e[44]!==i?(Z=s.jsx("span",{className:H,children:i}),e[43]=H,e[44]=i,e[45]=Z):Z=e[45];let X;e[46]!==o?(X=!o&&s.jsx(mt,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[46]=o,e[47]=X):X=e[47];let ee;e[48]!==V||e[49]!==o||e[50]!==q||e[51]!==K||e[52]!==B||e[53]!==Z||e[54]!==X?(ee=s.jsx(xe,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(Kt,{asChild:!0,children:s.jsxs(re,{type:"button",variant:"ghost",size:"default","aria-label":q,disabled:o,"data-testid":K,className:B,children:[V,Z,X]})})})}),e[48]=V,e[49]=o,e[50]=q,e[51]=K,e[52]=B,e[53]=Z,e[54]=X,e[55]=ee):ee=e[55];let te;e[56]!==x||e[57]!==f||e[58]!==n||e[59]!==p?(te=p&&x?`This chat is using ${x} on ${jt(n)}. Start a new chat to use a different runtime.`:f,e[56]=x,e[57]=f,e[58]=n,e[59]=p,e[60]=te):te=e[60];let se;e[61]!==te?(se=s.jsx(ge,{children:te}),e[61]=te,e[62]=se):se=e[62],e[63]!==ee||e[64]!==se?(A=s.jsxs(be,{children:[ee,se]}),e[63]=ee,e[64]=se,e[65]=A):A=e[65],b=Qt,T="start",v="p-1 w-64",y="menu",C="flex flex-col",k=R.length>0&&s.jsx(hn,{title:"Cloud"});let W;e[66]!==L||e[67]!==n?(W=ne=>s.jsx(xn,{row:ne,active:n===ne.mode,onSelect:L},ne.mode),e[66]=L,e[67]=n,e[68]=W):W=e[68],_=R.map(W),E=$.length>0&&s.jsx(hn,{title:"Local",variant:"success",icon:s.jsx(Ut,{size:12,"data-testid":"local-section-desktop-icon"}),testId:"local-section-header"});let oe;e[69]!==r||e[70]!==L||e[71]!==n?(oe=ne=>{const ce=ne.isAvailable(r);return s.jsx(xn,{row:ne,active:n===ne.mode,onSelect:L,unavailableHint:ce?void 0:r.userDesktop?"Not detected on your desktop":"Desktop not detected"},ne.mode)},e[69]=r,e[70]=L,e[71]=n,e[72]=oe):oe=e[72],D=$.map(oe),e[5]=r,e[6]=x,e[7]=V,e[8]=h,e[9]=f,e[10]=o,e[11]=n,e[12]=l,e[13]=c,e[14]=p,e[15]=i,e[16]=b,e[17]=g,e[18]=v,e[19]=w,e[20]=S,e[21]=A,e[22]=y,e[23]=C,e[24]=k,e[25]=_,e[26]=E,e[27]=D,e[28]=T}else b=e[16],g=e[17],v=e[18],w=e[19],S=e[20],A=e[21],y=e[22],C=e[23],k=e[24],_=e[25],E=e[26],D=e[27],T=e[28];let N;e[73]!==y||e[74]!==C||e[75]!==k||e[76]!==_||e[77]!==E||e[78]!==D?(N=s.jsxs("div",{role:y,className:C,children:[k,_,E,D]}),e[73]=y,e[74]=C,e[75]=k,e[76]=_,e[77]=E,e[78]=D,e[79]=N):N=e[79];let M;e[80]!==b||e[81]!==v||e[82]!==N||e[83]!==T?(M=s.jsx(b,{align:T,className:v,children:N}),e[80]=b,e[81]=v,e[82]=N,e[83]=T,e[84]=M):M=e[84];let I;return e[85]!==g||e[86]!==w||e[87]!==S||e[88]!==A||e[89]!==M?(I=s.jsxs(g,{open:w,onOpenChange:S,children:[A,M]}),e[85]=g,e[86]=w,e[87]=S,e[88]=A,e[89]=M,e[90]=I):I=e[90],I}function ti(t){return t.group==="local"}function hn(t){const e=O.c(9),{title:n,variant:r,icon:o,testId:a}=t,c=(r===void 0?"muted":r)==="success"?"bg-success/10 text-success":"text-muted-foreground";let d;e[0]!==c?(d=U("inline-flex w-fit items-center gap-2 mx-1 mt-2 mb-1 px-1.5 py-0.5 rounded text-[10px] font-medium uppercase tracking-wide",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]!==n?(u=s.jsx("span",{children:n}),e[2]=n,e[3]=u):u=e[3];let V;return e[4]!==o||e[5]!==d||e[6]!==u||e[7]!==a?(V=s.jsxs("div",{"data-testid":a,className:d,children:[o,u]}),e[4]=o,e[5]=d,e[6]=u,e[7]=a,e[8]=V):V=e[8],V}function xn(t){const e=O.c(20),{row:n,active:r,onSelect:o,unavailableHint:a}=t;let l;e[0]!==o||e[1]!==n.mode?(l=()=>o(n.mode),e[0]=o,e[1]=n.mode,e[2]=l):l=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=U("flex items-start gap-2 px-2 py-1.5 rounded-md text-left","hover:bg-muted"),e[3]=c):c=e[3];let d;e[4]!==n.icon?(d=s.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:n.icon}),e[4]=n.icon,e[5]=d):d=e[5];let u;e[6]!==n.label?(u=s.jsx("div",{className:"text-sm",children:n.label}),e[6]=n.label,e[7]=u):u=e[7];const V=a??n.description;let i;e[8]!==V?(i=s.jsx("div",{className:"text-xs text-muted-foreground",children:V}),e[8]=V,e[9]=i):i=e[9];let m;e[10]!==u||e[11]!==i?(m=s.jsxs("div",{className:"flex-1",children:[u,i]}),e[10]=u,e[11]=i,e[12]=m):m=e[12];let f;e[13]!==r?(f=r&&s.jsx(Ke,{size:14,className:"text-foreground mt-0.5"}),e[13]=r,e[14]=f):f=e[14];let h;return e[15]!==l||e[16]!==d||e[17]!==m||e[18]!==f?(h=s.jsxs("button",{type:"button",role:"menuitem",onClick:l,className:c,children:[d,m,f]}),e[15]=l,e[16]=d,e[17]=m,e[18]=f,e[19]=h):h=e[19],h}function ni(t){const e=O.c(19),{locked:n,currentBranch:r,virtualMcpId:o}=t,a=Cs(),l=$l(),{org:c}=de();let d;e[0]!==c.id||e[1]!==c.slug?(d={connectionId:Xr,orgId:c.id,orgSlug:c.slug},e[0]=c.id,e[1]=c.slug,e[2]=d):d=e[2];const u=Me(d),V=Il(u),i=at(),m=i?.lockedHarness??null,f=i?.lockedSandbox??null,h=i?.isThreadLocked??!1,p=El();let x;e[3]!==h||e[4]!==m||e[5]!==f||e[6]!==a?(x=Wl({selectedMode:a,lockedHarness:m,lockedSandbox:f,isThreadLocked:h}),e[3]=h,e[4]=m,e[5]=f,e[6]=a,e[7]=x):x=e[7];const b=x;let g;e[8]!==r||e[9]!==l||e[10]!==V||e[11]!==o?(g=S=>{l(S),G("agent_mode_selected",{mode:S}),r&&V.mutate({virtualMcpId:o,branch:r,sandboxProviderKind:S==="cloud-decopilot"?"agent-sandbox":"user-desktop"})},e[8]=r,e[9]=l,e[10]=V,e[11]=o,e[12]=g):g=e[12];const v=g;let w;return e[13]!==p||e[14]!==v||e[15]!==n||e[16]!==m||e[17]!==b?(w=s.jsx(s.Fragment,{children:s.jsx(ei,{mode:b,availability:p,locked:n,lockedHarness:m,onSelect:v})}),e[13]=p,e[14]=v,e[15]=n,e[16]=m,e[17]=b,e[18]=w):w=e[18],w}function si(t){return(t??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"user"}function ri(t){const e=si(t),n=Date.now().toString(36).split("").reverse().join("");return`${e}-${n}`}const We=100;function oi(t,e,n){const r=e.trim().toLowerCase();return r?(t??[]).some(o=>o.branches.some(a=>typeof a.name=="string"&&!n.has(a.name)&&a.name.toLowerCase().includes(r))):!0}function ai(t,e){const n=e.trim().toLowerCase();return n?[...t].some(r=>r.toLowerCase().includes(n)):!0}function li(t){const e=t;if(e.structuredContent)return e.structuredContent;const n=e.content?.find(r=>r.type==="text")?.text;if(n)try{return JSON.parse(n)}catch{return[]}return[]}function ii(t){const e=O.c(48),{orgId:n,orgSlug:r,userId:o,connectionId:a,sandboxMap:l,owner:c,repo:d,enabled:u}=t,V=u===void 0?!0:u,i=a??null;let m;e[0]!==n||e[1]!==r||e[2]!==i?(m={connectionId:i,orgId:n,orgSlug:r},e[0]=n,e[1]=r,e[2]=i,e[3]=m):m=e[3];const f=Me(m);let h;e[4]!==a||e[5]!==n||e[6]!==r||e[7]!==c||e[8]!==d?(h=sr.githubBranches(n,r,a,c,d),e[4]=a,e[5]=n,e[6]=r,e[7]=c,e[8]=d,e[9]=h):h=e[9];const p=V&&!!a&&!!c&&!!d;let x;e[10]!==f||e[11]!==c||e[12]!==d?(x=async L=>{const{pageParam:q,signal:K}=L,Q=Number(q),F=await f.callTool({name:"list_branches",arguments:{owner:c,repo:d,page:Q,perPage:We}},void 0,{signal:K}),B=li(F);return{branches:Array.isArray(B)?B:B.branches??[],default_branch:Array.isArray(B)?null:B.default_branch??null,page:Q}},e[10]=f,e[11]=c,e[12]=d,e[13]=x):x=e[13];let b;e[14]!==h||e[15]!==p||e[16]!==x?(b={queryKey:h,enabled:p,staleTime:3e4,retry:!1,initialPageParam:1,queryFn:x,getNextPageParam:mi},e[14]=h,e[15]=p,e[16]=x,e[17]=b):b=e[17];const{data:g,isLoading:v,isError:w,hasNextPage:S,isFetchingNextPage:A,fetchNextPage:y}=Uo(b);let C,k;e[18]!==l||e[19]!==o?(k=new Set(Object.keys(l?.[o]??{})),C=[...k].sort().map(fi),e[18]=l,e[19]=o,e[20]=C,e[21]=k):(C=e[20],k=e[21]);const _=C;let E;if(e[22]!==g?.pages){const L=new Map;for(const K of g?.pages??[])for(const Q of K.branches)typeof Q.name=="string"&&L.set(Q.name,Q);E=[...L.values()].filter(Vi),e[22]=g?.pages,e[23]=E}else E=e[23];let D;e[24]!==E||e[25]!==k?(D=E.filter(L=>!k.has(L.name)).map(ui),e[24]=E,e[25]=k,e[26]=D):D=e[26];const T=D;let N;e[27]!==g?.pages?(N=g?.pages.find(di)?.default_branch??null,e[27]=g?.pages,e[28]=N):N=e[28];const M=N;let I;e[29]!==g?.pages||e[30]!==y||e[31]!==A||e[32]!==k?(I=async(L,q)=>{const K=q===void 0?ci:q;if(!K()||ai(k,L)||A)return;let Q=g?.pages??[];for(;K()&&!oi(Q,L,k)&&(Q.at(-1)?.branches.length??We)>=We;){const F=await y();if(!K())break;const B=F.data?.pages??Q;if(B.length===Q.length)break;Q=B}},e[29]=g?.pages,e[30]=y,e[31]=A,e[32]=k,e[33]=I):I=e[33];const P=I,R=S??!1;let $;e[34]!==y||e[35]!==S||e[36]!==A?($=()=>{S&&!A&&y()},e[34]=y,e[35]=S,e[36]=A,e[37]=$):$=e[37];let z;return e[38]!==M||e[39]!==P||e[40]!==w||e[41]!==A||e[42]!==v||e[43]!==T||e[44]!==R||e[45]!==$||e[46]!==_?(z={yours:_,others:T,defaultBase:M,isLoading:v,isError:w,hasMore:R,isFetchingMore:A,fetchMore:$,fetchUntilMatch:P},e[38]=M,e[39]=P,e[40]=w,e[41]=A,e[42]=v,e[43]=T,e[44]=R,e[45]=$,e[46]=_,e[47]=z):z=e[47],z}function ci(){return!0}function di(t){return t.default_branch}function ui(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function Vi(t){return typeof t.name=="string"}function fi(t){return{name:t,source:"yours"}}function mi(t){if(!(t.branches.length<We))return t.page+1}function pi(t){const e=O.c(85),{orgId:n,orgSlug:r,userId:o,userLabel:a,connectionId:l,owner:c,repo:d,sandboxMap:u,value:V,onChange:i,disabled:m,placement:f}=t,h=m===void 0?!1:m,x=(f===void 0?"chat":f)==="header",[b,g]=j.useState(!1),[v,w]=j.useState(""),[S,A]=j.useState(!1),y=j.useRef(0);let C;e[0]!==l||e[1]!==b||e[2]!==n||e[3]!==r||e[4]!==c||e[5]!==d||e[6]!==u||e[7]!==o?(C={orgId:n,orgSlug:r,userId:o,connectionId:l,sandboxMap:u,owner:c,repo:d,enabled:b},e[0]=l,e[1]=b,e[2]=n,e[3]=r,e[4]=c,e[5]=d,e[6]=u,e[7]=o,e[8]=C):C=e[8];const{yours:k,others:_,isLoading:E,isError:D,hasMore:T,isFetchingMore:N,fetchMore:M,fetchUntilMatch:I}=ii(C);let P;e[9]!==i?(P=ae=>{i(ae),g(!1)},e[9]=i,e[10]=P):P=e[10];const R=P,$=V??"Select branch…";let z;e[11]!==I?(z=ae=>{w(ae),y.current=y.current+1;const ke=y.current,gt=ae.trim();if(!gt){A(!1);return}A(!0),I(gt,()=>ke===y.current).finally(()=>{ke===y.current&&A(!1)})},e[11]=I,e[12]=z):z=e[12];const L=z;let q;e[13]!==M?(q=ae=>{const ke=ae.currentTarget;ke.scrollHeight-ke.scrollTop-ke.clientHeight<48&&M()},e[13]=M,e[14]=q):q=e[14];const K=q,Q=h?void 0:g,F=x?"outline":"ghost",B=x?"sm":"default";let Y;e[15]!==h||e[16]!==x?(Y=U("font-mono shrink min-w-0 max-w-[200px]",x?"gap-1.5 text-xs":U("text-xs text-muted-foreground hover:text-foreground transition-[gap] duration-200",h?"gap-0":"gap-0 @[320px]/chat-bottom:gap-1.5")),e[15]=h,e[16]=x,e[17]=Y):Y=e[17];let H;e[18]===Symbol.for("react.memo_cache_sentinel")?(H=s.jsx(Ge,{className:"h-3.5 w-3.5 shrink-0"}),e[18]=H):H=e[18];const Z=x?"":"transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[200px] @[320px]/chat-bottom:opacity-100";let X;e[19]!==Z?(X=U("min-w-0 truncate",Z),e[19]=Z,e[20]=X):X=e[20];let ee;e[21]!==$||e[22]!==X?(ee=s.jsx("span",{className:X,children:$}),e[21]=$,e[22]=X,e[23]=ee):ee=e[23];let te;e[24]!==h||e[25]!==x?(te=!h&&s.jsx(mt,{size:12,className:U("opacity-60 shrink-0",x?"":"hidden @[320px]/chat-bottom:inline-block")}),e[24]=h,e[25]=x,e[26]=te):te=e[26];let se;e[27]!==h||e[28]!==$||e[29]!==Y||e[30]!==ee||e[31]!==te||e[32]!==F||e[33]!==B?(se=s.jsx(xe,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(Kt,{asChild:!0,children:s.jsxs(re,{variant:F,size:B,"aria-label":$,disabled:h,className:Y,children:[H,ee,te]})})})}),e[27]=h,e[28]=$,e[29]=Y,e[30]=ee,e[31]=te,e[32]=F,e[33]=B,e[34]=se):se=e[34];let W;e[35]!==$?(W=s.jsx(ge,{children:$}),e[35]=$,e[36]=W):W=e[36];let oe;e[37]!==se||e[38]!==W?(oe=s.jsxs(be,{children:[se,W]}),e[37]=se,e[38]=W,e[39]=oe):oe=e[39];let ne;e[40]!==L||e[41]!==v?(ne=s.jsx(Oo,{placeholder:"Search loaded branches…",value:v,onValueChange:L}),e[40]=L,e[41]=v,e[42]=ne):ne=e[42];let ce;e[43]!==R||e[44]!==a?(ce=s.jsx(re,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>R(ri(a)),children:"New"}),e[43]=R,e[44]=a,e[45]=ce):ce=e[45];let Ve;e[46]!==ne||e[47]!==ce?(Ve=s.jsxs("div",{className:"*:data-[slot=command-input-wrapper]:flex-1 *:data-[slot=command-input-wrapper]:border-b-0 flex items-center border-b pr-2",children:[ne,ce]}),e[46]=ne,e[47]=ce,e[48]=Ve):Ve=e[48];let J;e[49]!==D?(J=D&&s.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[49]=D,e[50]=J):J=e[50];let ie;e[51]!==T||e[52]!==D||e[53]!==E?(ie=!D&&!E&&s.jsx(Lo,{children:T?"Looking through more branches...":"No branches found."}),e[51]=T,e[52]=D,e[53]=E,e[54]=ie):ie=e[54];let Ae;e[55]!==R||e[56]!==k?(Ae=k.length>0&&s.jsx(en,{heading:"Your branches",children:k.map(ae=>s.jsxs(tn,{value:ae.name,onSelect:()=>R(ae.name),children:[s.jsx(Ge,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"flex-1 truncate",children:ae.name})]},ae.name))}),e[55]=R,e[56]=k,e[57]=Ae):Ae=e[57];let je;e[58]!==_||e[59]!==R?(je=_.length>0&&s.jsxs(s.Fragment,{children:[s.jsx($o,{}),s.jsx(en,{heading:"Other branches in repo",children:_.map(ae=>s.jsxs(tn,{value:ae.name,onSelect:()=>R(ae.name),children:[s.jsx(Ge,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"flex-1 truncate",children:ae.name}),ae.author&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",ae.author]})]},ae.name))})]}),e[58]=_,e[59]=R,e[60]=je):je=e[60];let we;e[61]!==M||e[62]!==T||e[63]!==N||e[64]!==S?(we=T&&s.jsx("div",{className:"border-t p-2",children:s.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:N,onClick:M,children:N||S?"Loading more…":"Load more branches"})}),e[61]=M,e[62]=T,e[63]=N,e[64]=S,e[65]=we):we=e[65];let Se;e[66]!==T||e[67]!==_.length?(Se=!T&&_.length>0&&s.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:"All loaded"}),e[66]=T,e[67]=_.length,e[68]=Se):Se=e[68];let Ce;e[69]!==K||e[70]!==J||e[71]!==ie||e[72]!==Ae||e[73]!==je||e[74]!==we||e[75]!==Se?(Ce=s.jsxs(zo,{onScroll:K,children:[J,ie,Ae,je,we,Se]}),e[69]=K,e[70]=J,e[71]=ie,e[72]=Ae,e[73]=je,e[74]=we,e[75]=Se,e[76]=Ce):Ce=e[76];let Ne;e[77]!==Ve||e[78]!==Ce?(Ne=s.jsx(Qt,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:s.jsxs(Bo,{children:[Ve,Ce]})}),e[77]=Ve,e[78]=Ce,e[79]=Ne):Ne=e[79];let Qe;return e[80]!==b||e[81]!==oe||e[82]!==Ne||e[83]!==Q?(Qe=s.jsxs(qt,{open:b,onOpenChange:Q,children:[oe,Ne]}),e[80]=b,e[81]=oe,e[82]=Ne,e[83]=Q,e[84]=Qe):Qe=e[84],Qe}function hi(t){const e=O.c(25);let n,r,o,a;e[0]!==t?({locked:n,placement:r,value:a,...o}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=a):(n=e[1],r=e[2],o=e[3],a=e[4]);const l=r==="header";if(n){const d=a??"(no branch)",u=l?"h-8 gap-1.5 border border-input bg-background px-2.5":"h-9 gap-0 px-2";let V;e[5]!==u?(V=U("inline-flex items-center rounded-md font-mono text-xs","text-muted-foreground cursor-default min-w-0 max-w-[200px]",u),e[5]=u,e[6]=V):V=e[6];let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Ge,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),e[7]=i):i=e[7];const m=l?"":"max-w-0 opacity-0";let f;e[8]!==m?(f=U("min-w-0 truncate",m),e[8]=m,e[9]=f):f=e[9];let h;e[10]!==d||e[11]!==f?(h=s.jsx("span",{className:f,children:d}),e[10]=d,e[11]=f,e[12]=h):h=e[12];let p;e[13]!==V||e[14]!==h?(p=s.jsx(xe,{asChild:!0,children:s.jsxs("span",{"data-testid":"branch-picker-locked","aria-disabled":"true",className:V,children:[i,h]})}),e[13]=V,e[14]=h,e[15]=p):p=e[15];let x;e[16]!==d?(x=s.jsxs(ge,{children:["This chat is using branch ",d,". Start a new chat to use a different branch."]}),e[16]=d,e[17]=x):x=e[17];let b;return e[18]!==p||e[19]!==x?(b=s.jsxs(be,{children:[p,x]}),e[18]=p,e[19]=x,e[20]=b):b=e[20],b}let c;return e[21]!==r||e[22]!==o||e[23]!==a?(c=s.jsx(pi,{...o,value:a,placement:r}),e[21]=r,e[22]=o,e[23]=a,e[24]=c):c=e[24],c}function xi(t){const e=O.c(3),{branchPill:n,modePicker:r}=t;if(!n&&!r)return null;let o;return e[0]!==n||e[1]!==r?(o=s.jsxs(s.Fragment,{children:[r,n]}),e[0]=n,e[1]=r,e[2]=o):o=e[2],o}function gi(t){const e=O.c(26),{virtualMcp:n,currentBranch:r}=t,o=On(),a=at();let l;e[0]!==o?.messages||e[1]!==a?.isThreadLocked?(l=(o?.messages??[]).length>0||(a?.isThreadLocked??!1),e[0]=o?.messages,e[1]=a?.isThreadLocked,e[2]=l):l=e[2];const c=l,d=a?.setCurrentTaskBranch;let u;e[3]!==n?(u=Io(n),e[3]=n,e[4]=u):u=e[4];const V=u,i=V?.connectionId,{data:m}=Rn.useSession(),f=m?.user?.id??"";let h;e[5]!==m?.user?.email||e[6]!==m?.user?.name?(h=m?.user?.name??m?.user?.email?.split("@")[0],e[5]=m?.user?.email,e[6]=m?.user?.name,e[7]=h):h=e[7];const p=h,{org:x}=de();let b;e[8]!==i||e[9]!==r||e[10]!==V||e[11]!==c||e[12]!==x||e[13]!==d||e[14]!==f||e[15]!==p||e[16]!==n?.id||e[17]!==n?.metadata?.sandboxMap?(b=V&&i?s.jsx(hi,{orgId:x.id,orgSlug:x.slug,userId:f,userLabel:p,virtualMcpId:n?.id??"",connectionId:i,owner:V.owner,repo:V.name,sandboxMap:n?.metadata?.sandboxMap,value:r,onChange:y=>{d&&d(y)},locked:c,placement:"chat"}):null,e[8]=i,e[9]=r,e[10]=V,e[11]=c,e[12]=x,e[13]=d,e[14]=f,e[15]=p,e[16]=n?.id,e[17]=n?.metadata?.sandboxMap,e[18]=b):b=e[18];const g=b,v=n?.id??"";let w;e[19]!==r||e[20]!==c||e[21]!==v?(w=s.jsx(ni,{locked:c,currentBranch:r,virtualMcpId:v}),e[19]=r,e[20]=c,e[21]=v,e[22]=w):w=e[22];const S=w;let A;return e[23]!==g||e[24]!==S?(A=s.jsx(xi,{branchPill:g,modePicker:S}),e[23]=g,e[24]=S,e[25]=A):A=e[25],A}const bi=["fast","smart","thinking"],Fe={fast:"Fast",smart:"Smart",thinking:"Thinking"};function vi(t){const e=O.c(30),{tier:n,subtitleFor:r,iconFor:o,onSelect:a}=t,[l,c]=j.useState(!1);let d;e[0]!==a?(d=C=>{a(C),c(!1)},e[0]=a,e[1]=d):d=e[1];const u=d,V=Fe[n];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=U("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[2]=i):i=e[2];let m;e[3]!==o||e[4]!==n?(m=o?.(n),e[3]=o,e[4]=n,e[5]=m):m=e[5];let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=U("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),e[6]=f):f=e[6];const h=Fe[n];let p;e[7]!==h?(p=s.jsx("span",{className:f,children:h}),e[7]=h,e[8]=p):p=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(mt,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[9]=x):x=e[9];let b;e[10]!==V||e[11]!==m||e[12]!==p?(b=s.jsx(xe,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(Kt,{asChild:!0,children:s.jsxs(re,{type:"button",variant:"ghost",size:"default","aria-label":V,className:i,children:[m,p,x]})})})}),e[10]=V,e[11]=m,e[12]=p,e[13]=b):b=e[13];const g=Fe[n];let v;e[14]!==g?(v=s.jsx(ge,{children:g}),e[14]=g,e[15]=v):v=e[15];let w;e[16]!==v||e[17]!==b?(w=s.jsxs(be,{children:[b,v]}),e[16]=v,e[17]=b,e[18]=w):w=e[18];let S;e[19]!==u||e[20]!==o||e[21]!==r||e[22]!==n?(S=bi.map(C=>{const k=r(C),_=o?.(C),E=C===n;return s.jsxs("button",{type:"button",role:"menuitem","aria-label":Fe[C],onClick:()=>u(C),className:U("flex items-start gap-2 px-2 py-1.5 rounded-md text-left","hover:bg-muted"),children:[_&&s.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:_}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"text-sm",children:Fe[C]}),k&&s.jsx("div",{className:"text-xs text-muted-foreground",children:k})]}),E&&s.jsx(Ke,{size:14,className:"text-foreground mt-0.5"})]},C)}),e[19]=u,e[20]=o,e[21]=r,e[22]=n,e[23]=S):S=e[23];let A;e[24]!==S?(A=s.jsx(Qt,{align:"end",className:"p-1 w-56",children:s.jsx("div",{role:"menu",className:"flex flex-col",children:S})}),e[24]=S,e[25]=A):A=e[25];let y;return e[26]!==l||e[27]!==w||e[28]!==A?(y=s.jsxs(qt,{open:l,onOpenChange:c,children:[w,A]}),e[26]=l,e[27]=w,e[28]=A,e[29]=y):y=e[29],y}function yi(t){return t==="fast"?s.jsx(fo,{size:16}):t==="thinking"?s.jsx(mo,{size:16}):s.jsx(qo,{size:16})}function Ai(){const t=O.c(6),e=Ol(),n=Ll(),r=Cs();let o;t[0]!==r?(o=c=>Bl(r,c),t[0]=r,t[1]=o):o=t[1];const a=o;let l;return t[2]!==n||t[3]!==a||t[4]!==e?(l=s.jsx(vi,{tier:e,subtitleFor:a,iconFor:yi,onSelect:n}),t[2]=n,t[3]=a,t[4]=e,t[5]=l):l=t[5],l}async function Ht(t,e,n,r,o){if(!ht(e)){le.error("Selected model does not support file uploads");return}const a=n.type||"application/octet-stream";if(!Po(a,e)){const c=os(e),d=e?.title??"This model";o?o({fileName:n.name,modelName:d,accepted:c}):le.error(`"${n.name}" can't be attached`,{description:`${d} accepts ${c}.`});return}const l=10*1024*1024;if(n.size>l){le.error(`File "${n.name}" exceeds 10MB limit`);return}try{const c=new FileReader,d=new Promise((i,m)=>{c.onload=()=>{const f=c.result;if(typeof f!="string"){m(new Error("Failed to read file as data URL"));return}const h=f.includes(",")?f.split(",")[1]??f:f;i(h)},c.onerror=m});c.readAsDataURL(n);const u=await d,V={id:crypto.randomUUID(),name:n.name,mimeType:n.type||"application/octet-stream",size:n.size,data:u};Ir(t,{from:r,to:r},V)}catch(c){console.error("Failed to process file:",c),le.error(`Failed to load file "${n.name}"`)}}function ji(t){const e=O.c(8),{editor:n,selectedModel:r,onUnsupportedFile:o}=t,a=j.useRef(Si);let l,c;e[0]!==n||e[1]!==o||e[2]!==r?(l=()=>{a.current=async(V,i)=>{await Ht(n,r,V,i,o)}},c=[n,r,o],e[0]=n,e[1]=o,e[2]=r,e[3]=l,e[4]=c):(l=e[3],c=e[4]),j.useEffect(l,c);let d,u;return e[5]!==n?(d=()=>{if(n?.isDestroyed)return;const V=new Xe("fileDropHandler");n.state.plugins.find(f=>f.spec.key===V)&&n.unregisterPlugin(V);const m=new zn({key:V,props:{handleDrop:(f,h,p,x)=>{if(x)return!1;const b=h.dataTransfer?.files;if(!b||b.length===0)return!1;h.preventDefault();const g=f.posAtCoords({left:h.clientX,top:h.clientY});if(!g)return!1;const v=Array.from(b),w=g.pos;for(const S of v)a.current?.(S,w);return!0},handlePaste:(f,h)=>{const p=h.clipboardData?.items;if(!p)return!1;const x=Array.from(p).filter(wi);if(x.length===0)return!1;h.preventDefault();const{from:b}=f.state.selection;for(const g of x){const v=g.getAsFile();v&&a.current?.(v,b)}return!0}}});return n.registerPlugin(m),()=>{n?.isDestroyed||n.unregisterPlugin(V)}},u=[n],e[5]=n,e[6]=d,e[7]=u):(d=e[6],u=e[7]),j.useEffect(d,u),null}function wi(t){return t.kind==="file"}function Si(){return Promise.resolve()}function Ci(t){const e=O.c(26),{info:n,onClose:r}=t,o=n!==null;let a;e[0]!==r?(a=S=>!S&&r(),e[0]=r,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(251,191,36,0.35) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(244,114,182,0.25) 0%, transparent 100%)"],e[2]=l):l=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:l.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[3]=c):c=e[3];let d,u;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-amber-500/15 text-amber-600 dark:text-amber-400",children:s.jsx(En,{size:18})}),u=s.jsx(ct,{className:"text-xl font-semibold tracking-tight",children:"File type not supported"}),e[4]=d,e[5]=u):(d=e[4],u=e[5]);const V=n?.fileName;let i;e[6]!==V?(i=s.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,s.jsxs(it,{className:"relative gap-4",children:[d,s.jsxs("div",{children:[u,s.jsxs(Ot,{className:"mt-1.5 text-sm leading-relaxed",children:[s.jsxs("span",{className:"font-medium text-foreground",children:["“",V,"”"]})," ","can't be attached to this chat."]})]})]})]}),e[6]=V,e[7]=i):i=e[7];const m=n?.modelName;let f;e[8]!==m?(f=s.jsxs("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:[m," accepts"]}),e[8]=m,e[9]=f):f=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(po,{size:14,className:"text-muted-foreground"}),e[10]=h):h=e[10];const p=n?.accepted;let x;e[11]!==p?(x=s.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[h,s.jsx("span",{className:"capitalize",children:p})]}),e[11]=p,e[12]=x):x=e[12];let b;e[13]!==f||e[14]!==x?(b=s.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:s.jsxs("div",{className:"rounded-xl border border-border p-4",children:[f,x]})}),e[13]=f,e[14]=x,e[15]=b):b=e[15];let g;e[16]!==r?(g=s.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:s.jsx(re,{onClick:r,children:"Got it"})}),e[16]=r,e[17]=g):g=e[17];let v;e[18]!==b||e[19]!==g||e[20]!==i?(v=s.jsxs(dt,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Ni,children:[i,b,g]}),e[18]=b,e[19]=g,e[20]=i,e[21]=v):v=e[21];let w;return e[22]!==o||e[23]!==v||e[24]!==a?(w=s.jsx(ut,{open:o,onOpenChange:a,children:v}),e[22]=o,e[23]=v,e[24]=a,e[25]=w):w=e[25],w}function Ni(t){return t.preventDefault()}function ki(){const t=O.c(3),[e,n]=j.useState(null);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>n(null),t[0]=r):r=t[0];let o;return t[1]!==e?(o={unsupportedFile:e,onUnsupportedFile:n,clearUnsupportedFile:r},t[1]=e,t[2]=o):o=t[2],o}var _i=Er;var Ii=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Rt=Ii.join(","),ks=typeof Element>"u",Be=ks?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,st=!ks&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},rt=function(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),a=o===""||o==="true",l=a||n&&e&&(typeof e.closest=="function"?e.closest("[inert]"):rt(e.parentNode));return l},Ei=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},Ri=function(e,n,r){if(rt(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(Rt));return n&&Be.call(e,Rt)&&o.unshift(e),o=o.filter(r),o},Tt=function(e,n,r){for(var o=[],a=Array.from(e);a.length;){var l=a.shift();if(!rt(l,!1))if(l.tagName==="SLOT"){var c=l.assignedElements(),d=c.length?c:l.children,u=Tt(d,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:l,candidates:u})}else{var V=Be.call(l,Rt);V&&r.filter(l)&&(n||!e.includes(l))&&o.push(l);var i=l.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(l),m=!rt(i,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(i&&m){var f=Tt(i===!0?l.children:i.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:l,candidates:f})}else a.unshift.apply(a,l.children)}}return o},_s=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Is=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Ei(e))&&!_s(e)?0:e.tabIndex},Ti=function(e,n){var r=Is(e);return r<0&&n&&!_s(e)?0:r},Di=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},Es=function(e){return e.tagName==="INPUT"},Pi=function(e){return Es(e)&&e.type==="hidden"},Mi=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},Fi=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},$i=function(e){if(!e.name)return!0;var n=e.form||st(e),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(e.name));else try{o=r(e.name)}catch(l){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",l.message),!1}var a=Fi(o,e.form);return!a||a===e},Oi=function(e){return Es(e)&&e.type==="radio"},Li=function(e){return Oi(e)&&!$i(e)},zi=function(e){var n,r=e&&st(e),o=(n=r)===null||n===void 0?void 0:n.host,a=!1;if(r&&r!==e){var l,c,d;for(a=!!((l=o)!==null&&l!==void 0&&(c=l.ownerDocument)!==null&&c!==void 0&&c.contains(o)||e!=null&&(d=e.ownerDocument)!==null&&d!==void 0&&d.contains(e));!a&&o;){var u,V,i;r=st(o),o=(u=r)===null||u===void 0?void 0:u.host,a=!!((V=o)!==null&&V!==void 0&&(i=V.ownerDocument)!==null&&i!==void 0&&i.contains(o))}}return a},gn=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},Bi=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var a=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!a}if(getComputedStyle(e).visibility==="hidden")return!0;var l=Be.call(e,"details>summary:first-of-type"),c=l?e.parentElement:e;if(Be.call(c,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var d=e;e;){var u=e.parentElement,V=st(e);if(u&&!u.shadowRoot&&o(u)===!0)return gn(e);e.assignedSlot?e=e.assignedSlot:!u&&V!==e.ownerDocument?e=V.host:e=u}e=d}if(zi(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return gn(e);return!1},Ui=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Be.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},qi=function(e,n){return!(n.disabled||Pi(n)||Bi(n,e)||Mi(n)||Ui(n))},bn=function(e,n){return!(Li(n)||Is(n)<0||!qi(e,n))},Ki=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Rs=function(e){var n=[],r=[];return e.forEach(function(o,a){var l=!!o.scopeParent,c=l?o.scopeParent:o,d=Ti(c,l),u=l?Rs(o.candidates):c;d===0?l?n.push.apply(n,u):n.push(c):r.push({documentOrder:a,tabIndex:d,item:o,isScope:l,content:u})}),r.sort(Di).reduce(function(o,a){return a.isScope?o.push.apply(o,a.content):o.push(a.content),o},[]).concat(n)},Ts=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Tt([e],n.includeContainer,{filter:bn.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Ki}):r=Ri(e,n.includeContainer,bn.bind(null,n)),Rs(r)};function Qi(){return/apple/i.test(navigator.vendor)}const vn="data-floating-ui-focusable";function Yi(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function Dt(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&rr(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function $e(t){return"composedPath"in t?t.composedPath()[0]:t.target}function wt(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function Hi(t){return t.matches("html,body")}function Ue(t){return t?.ownerDocument||document}function Gi(t){return t?t.hasAttribute(vn)?t:t.querySelector("["+vn+"]")||t:null}function Je(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var a;return o.parentId===e&&(!n||((a=o.context)==null?void 0:a.open))}).flatMap(o=>[o,...Je(t,o.id,n)])}function Wi(t){return"nativeEvent"in t}var Ji=typeof document<"u",Zi=function(){},ve=Ji?j.useLayoutEffect:Zi;const Xi={...Tn},ec=Xi.useInsertionEffect,tc=ec||(t=>t());function Ie(t){const e=j.useRef(()=>{});return tc(()=>{e.current=t}),j.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}const Ds=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Ps(t,e){const n=Ts(t,Ds()),r=n.length;if(r===0)return;const o=Yi(Ue(t)),a=n.indexOf(o),l=a===-1?e===1?0:r-1:a+e;return n[l]}function nc(t){return Ps(Ue(t).body,1)||t}function sc(t){return Ps(Ue(t).body,-1)||t}function St(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!Dt(n,r)}function rc(t){Ts(t,Ds()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function yn(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const oc="data-floating-ui-focusable",An="active",jn="selected",ac={...Tn};let wn=!1,lc=0;const Sn=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+lc++;function ic(){const[t,e]=j.useState(()=>wn?Sn():void 0);return ve(()=>{t==null&&e(Sn())},[]),j.useEffect(()=>{wn=!0},[]),t}const cc=ac.useId,Gt=cc||ic;function dc(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const uc=j.createContext(null),Vc=j.createContext(null),Ms=()=>{var t;return((t=j.useContext(uc))==null?void 0:t.id)||null},Fs=()=>j.useContext(Vc);function Wt(t){return"data-floating-ui-"+t}const fc={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},Cn=j.forwardRef(function(e,n){const[r,o]=j.useState();ve(()=>{Qi()&&o("button")},[]);const a={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Wt("focus-guard")]:"",style:fc};return s.jsx("span",{...e,...a})}),mc={clipPath:"inset(50%)",position:"fixed",top:0,left:0},$s=j.createContext(null),Nn=Wt("portal");function pc(t){t===void 0&&(t={});const{id:e,root:n}=t,r=Gt(),o=xc(),[a,l]=j.useState(null),c=j.useRef(null);return ve(()=>()=>{a?.remove(),queueMicrotask(()=>{c.current=null})},[a]),ve(()=>{if(!r||c.current)return;const d=e?document.getElementById(e):null;if(!d)return;const u=document.createElement("div");u.id=r,u.setAttribute(Nn,""),d.appendChild(u),c.current=u,l(u)},[e,r]),ve(()=>{if(n===null||!r||c.current)return;let d=n||o?.portalNode;d&&!ur(d)&&(d=d.current),d=d||document.body;let u=null;e&&(u=document.createElement("div"),u.id=e,d.appendChild(u));const V=document.createElement("div");V.id=r,V.setAttribute(Nn,""),d=u||d,d.appendChild(V),c.current=V,l(V)},[e,n,r,o]),a}function hc(t){const{children:e,id:n,root:r,preserveTabOrder:o=!0}=t,a=pc({id:n,root:r}),[l,c]=j.useState(null),d=j.useRef(null),u=j.useRef(null),V=j.useRef(null),i=j.useRef(null),m=l?.modal,f=l?.open,h=!!l&&!l.modal&&l.open&&o&&!!(r||a);return j.useEffect(()=>{if(!a||!o||m)return;function p(x){a&&St(x)&&(x.type==="focusin"?yn:rc)(a)}return a.addEventListener("focusin",p,!0),a.addEventListener("focusout",p,!0),()=>{a.removeEventListener("focusin",p,!0),a.removeEventListener("focusout",p,!0)}},[a,o,m]),j.useEffect(()=>{a&&(f||yn(a))},[f,a]),s.jsxs($s.Provider,{value:j.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:d,afterOutsideRef:u,beforeInsideRef:V,afterInsideRef:i,portalNode:a,setFocusManagerState:c}),[o,a]),children:[h&&a&&s.jsx(Cn,{"data-type":"outside",ref:d,onFocus:p=>{if(St(p,a)){var x;(x=V.current)==null||x.focus()}else{const b=l?l.domReference:null,g=sc(b);g?.focus()}}}),h&&a&&s.jsx("span",{"aria-owns":a.id,style:mc}),a&&ar.createPortal(e,a),h&&a&&s.jsx(Cn,{"data-type":"outside",ref:u,onFocus:p=>{if(St(p,a)){var x;(x=i.current)==null||x.focus()}else{const b=l?l.domReference:null,g=nc(b);g?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,p.nativeEvent,"focus-out")}}})]})}const xc=()=>j.useContext($s),gc={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},bc={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},kn=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function vc(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:a}=t,{enabled:l=!0,escapeKey:c=!0,outsidePress:d=!0,outsidePressEvent:u="pointerdown",referencePress:V=!1,referencePressEvent:i="pointerdown",ancestorScroll:m=!1,bubbles:f,capture:h}=e,p=Fs(),x=Ie(typeof d=="function"?d:()=>!1),b=typeof d=="function"?x:d,g=j.useRef(!1),{escapeKey:v,outsidePress:w}=kn(f),{escapeKey:S,outsidePress:A}=kn(h),y=j.useRef(!1),C=Ie(N=>{var M;if(!n||!l||!c||N.key!=="Escape"||y.current)return;const I=(M=a.current.floatingContext)==null?void 0:M.nodeId,P=p?Je(p.nodesRef.current,I):[];if(!v&&(N.stopPropagation(),P.length>0)){let R=!0;if(P.forEach($=>{var z;if((z=$.context)!=null&&z.open&&!$.context.dataRef.current.__escapeKeyBubbles){R=!1;return}}),!R)return}r(!1,Wi(N)?N.nativeEvent:N,"escape-key")}),k=Ie(N=>{var M;const I=()=>{var P;C(N),(P=$e(N))==null||P.removeEventListener("keydown",I)};(M=$e(N))==null||M.addEventListener("keydown",I)}),_=Ie(N=>{var M;const I=a.current.insideReactTree;a.current.insideReactTree=!1;const P=g.current;if(g.current=!1,u==="click"&&P||I||typeof b=="function"&&!b(N))return;const R=$e(N),$="["+Wt("inert")+"]",z=Ue(o.floating).querySelectorAll($);let L=ue(R)?R:null;for(;L&&!vt(L);){const F=ir(L);if(vt(F)||!ue(F))break;L=F}if(z.length&&ue(R)&&!Hi(R)&&!Dt(R,o.floating)&&Array.from(z).every(F=>!Dt(L,F)))return;if(cr(R)&&T){const F=vt(R),B=dr(R),Y=/auto|scroll/,H=F||Y.test(B.overflowX),Z=F||Y.test(B.overflowY),X=H&&R.clientWidth>0&&R.scrollWidth>R.clientWidth,ee=Z&&R.clientHeight>0&&R.scrollHeight>R.clientHeight,te=B.direction==="rtl",se=ee&&(te?N.offsetX<=R.offsetWidth-R.clientWidth:N.offsetX>R.clientWidth),W=X&&N.offsetY>R.clientHeight;if(se||W)return}const q=(M=a.current.floatingContext)==null?void 0:M.nodeId,K=p&&Je(p.nodesRef.current,q).some(F=>{var B;return wt(N,(B=F.context)==null?void 0:B.elements.floating)});if(wt(N,o.floating)||wt(N,o.domReference)||K)return;const Q=p?Je(p.nodesRef.current,q):[];if(Q.length>0){let F=!0;if(Q.forEach(B=>{var Y;if((Y=B.context)!=null&&Y.open&&!B.context.dataRef.current.__outsidePressBubbles){F=!1;return}}),!F)return}r(!1,N,"outside-press")}),E=Ie(N=>{var M;const I=()=>{var P;_(N),(P=$e(N))==null||P.removeEventListener(u,I)};(M=$e(N))==null||M.addEventListener(u,I)});j.useEffect(()=>{if(!n||!l)return;a.current.__escapeKeyBubbles=v,a.current.__outsidePressBubbles=w;let N=-1;function M(z){r(!1,z,"ancestor-scroll")}function I(){window.clearTimeout(N),y.current=!0}function P(){N=window.setTimeout(()=>{y.current=!1},lr()?5:0)}const R=Ue(o.floating);c&&(R.addEventListener("keydown",S?k:C,S),R.addEventListener("compositionstart",I),R.addEventListener("compositionend",P)),b&&R.addEventListener(u,A?E:_,A);let $=[];return m&&(ue(o.domReference)&&($=bt(o.domReference)),ue(o.floating)&&($=$.concat(bt(o.floating))),!ue(o.reference)&&o.reference&&o.reference.contextElement&&($=$.concat(bt(o.reference.contextElement)))),$=$.filter(z=>{var L;return z!==((L=R.defaultView)==null?void 0:L.visualViewport)}),$.forEach(z=>{z.addEventListener("scroll",M,{passive:!0})}),()=>{c&&(R.removeEventListener("keydown",S?k:C,S),R.removeEventListener("compositionstart",I),R.removeEventListener("compositionend",P)),b&&R.removeEventListener(u,A?E:_,A),$.forEach(z=>{z.removeEventListener("scroll",M)}),window.clearTimeout(N)}},[a,o,c,b,u,n,r,m,l,v,w,C,S,k,_,A,E]),j.useEffect(()=>{a.current.insideReactTree=!1},[a,b,u]);const D=j.useMemo(()=>({onKeyDown:C,...V&&{[gc[i]]:N=>{r(!1,N.nativeEvent,"reference-press")},...i!=="click"&&{onClick(N){r(!1,N.nativeEvent,"reference-press")}}}}),[C,r,V,i]),T=j.useMemo(()=>{function N(M){M.button===0&&(g.current=!0)}return{onKeyDown:C,onMouseDown:N,onMouseUp:N,[bc[u]]:()=>{a.current.insideReactTree=!0}}},[C,u,a]);return j.useMemo(()=>l?{reference:D,floating:T}:{},[l,D,T])}function yc(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=Gt(),a=j.useRef({}),[l]=j.useState(()=>dc()),c=Ms()!=null,[d,u]=j.useState(r.reference),V=Ie((f,h,p)=>{a.current.openEvent=f?h:void 0,l.emit("openchange",{open:f,event:h,reason:p,nested:c}),n?.(f,h,p)}),i=j.useMemo(()=>({setPositionReference:u}),[]),m=j.useMemo(()=>({reference:d||r.reference||null,floating:r.floating||null,domReference:r.reference}),[d,r.reference,r.floating]);return j.useMemo(()=>({dataRef:a,open:e,onOpenChange:V,elements:m,events:l,floatingId:o,refs:i}),[e,V,m,l,o,i])}function Ac(t){t===void 0&&(t={});const{nodeId:e}=t,n=yc({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[a,l]=j.useState(null),[c,d]=j.useState(null),V=o?.domReference||a,i=j.useRef(null),m=Fs();ve(()=>{V&&(i.current=V)},[V]);const f=or({...t,elements:{...o,...c&&{reference:c}}}),h=j.useCallback(v=>{const w=ue(v)?{getBoundingClientRect:()=>v.getBoundingClientRect(),getClientRects:()=>v.getClientRects(),contextElement:v}:v;d(w),f.refs.setReference(w)},[f.refs]),p=j.useCallback(v=>{(ue(v)||v===null)&&(i.current=v,l(v)),(ue(f.refs.reference.current)||f.refs.reference.current===null||v!==null&&!ue(v))&&f.refs.setReference(v)},[f.refs]),x=j.useMemo(()=>({...f.refs,setReference:p,setPositionReference:h,domReference:i}),[f.refs,p,h]),b=j.useMemo(()=>({...f.elements,domReference:V}),[f.elements,V]),g=j.useMemo(()=>({...f,...r,refs:x,elements:b,nodeId:e}),[f,x,b,e,r]);return ve(()=>{r.dataRef.current.floatingContext=g;const v=m?.nodesRef.current.find(w=>w.id===e);v&&(v.context=g)}),j.useMemo(()=>({...f,context:g,refs:x,elements:b}),[f,x,b,g])}function Ct(t,e,n){const r=new Map,o=n==="item";let a=t;if(o&&t){const{[An]:l,[jn]:c,...d}=t;a=d}return{...n==="floating"&&{tabIndex:-1,[oc]:""},...a,...e.map(l=>{const c=l?l[n]:null;return typeof c=="function"?t?c(t):null:c}).concat(t).reduce((l,c)=>(c&&Object.entries(c).forEach(d=>{let[u,V]=d;if(!(o&&[An,jn].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof V=="function"){var i;(i=r.get(u))==null||i.push(V),l[u]=function(){for(var m,f=arguments.length,h=new Array(f),p=0;p<f;p++)h[p]=arguments[p];return(m=r.get(u))==null?void 0:m.map(x=>x(...h)).find(x=>x!==void 0)}}}else l[u]=V}),l),{})}}function jc(t){t===void 0&&(t=[]);const e=t.map(c=>c?.reference),n=t.map(c=>c?.floating),r=t.map(c=>c?.item),o=j.useCallback(c=>Ct(c,t,"reference"),e),a=j.useCallback(c=>Ct(c,t,"floating"),n),l=j.useCallback(c=>Ct(c,t,"item"),r);return j.useMemo(()=>({getReferenceProps:o,getFloatingProps:a,getItemProps:l}),[o,a,l])}const wc=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Sc(t,e){var n,r;e===void 0&&(e={});const{open:o,elements:a,floatingId:l}=t,{enabled:c=!0,role:d="dialog"}=e,u=Gt(),V=((n=a.domReference)==null?void 0:n.id)||u,i=j.useMemo(()=>{var g;return((g=Gi(a.floating))==null?void 0:g.id)||l},[a.floating,l]),m=(r=wc.get(d))!=null?r:d,h=Ms()!=null,p=j.useMemo(()=>m==="tooltip"||d==="label"?{["aria-"+(d==="label"?"labelledby":"describedby")]:o?i:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":m==="alertdialog"?"dialog":m,"aria-controls":o?i:void 0,...m==="listbox"&&{role:"combobox"},...m==="menu"&&{id:V},...m==="menu"&&h&&{role:"menuitem"},...d==="select"&&{"aria-autocomplete":"none"},...d==="combobox"&&{"aria-autocomplete":"list"}},[m,i,h,o,V,d]),x=j.useMemo(()=>{const g={id:i,...m&&{role:m}};return m==="tooltip"||d==="label"?g:{...g,...m==="menu"&&{"aria-labelledby":V}}},[m,i,V,d]),b=j.useCallback(g=>{let{active:v,selected:w}=g;const S={role:"option",...v&&{id:i+"-fui-option"}};switch(d){case"select":case"combobox":return{...S,"aria-selected":w}}return{}},[i,d]);return j.useMemo(()=>c?{reference:p,floating:x,item:b}:{},[c,p,x,b])}function Cc(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:a,startOfLine:l,$position:c}=t,d=r&&!o,u=Dr(n),V=new RegExp(`\\s${u}$`),i=l?"^":"",m=o?"":u,f=d?new RegExp(`${i}${u}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${i}(?:^)?${u}[^\\s${m}]*`,"gm"),h=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!h)return null;const p=c.pos-h.length,x=Array.from(h.matchAll(f)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const b=x.input.slice(Math.max(0,x.index-1),x.index),g=new RegExp(`^[${a?.join("")}\0]?$`).test(b);if(a!==null&&!g)return null;const v=p+x.index;let w=v+x[0].length;return d&&V.test(h.slice(w-1,w+1))&&(x[0]+=" ",w+=1),v<c.pos&&w>=c.pos?{range:{from:v,to:w},query:x[0].slice(n.length),text:x[0]}:null}var Nc=new Xe("suggestion");function kc({pluginKey:t=Nc,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:a=[" "],startOfLine:l=!1,decorationTag:c="span",decorationClass:d="suggestion",decorationContent:u="",decorationEmptyClass:V="is-empty",command:i=()=>null,items:m=()=>[],render:f=()=>({}),allow:h=()=>!0,findSuggestionMatch:p=Cc,shouldShow:x}){let b;const g=f?.(),v=()=>{const y=e.state.selection.$anchor.pos,C=e.view.coordsAtPos(y),{top:k,right:_,bottom:E,left:D}=C;try{return new DOMRect(D,k,_-D,E-k)}catch{return null}},w=(y,C)=>C?()=>{const k=t.getState(e.state),_=k?.decorationId,E=y.dom.querySelector(`[data-decoration-id="${_}"]`);return E?.getBoundingClientRect()||null}:v;function S(y,C){var k;try{const E=t.getState(y.state),D=E?.decorationId?y.dom.querySelector(`[data-decoration-id="${E.decorationId}"]`):null,T={editor:e,range:E?.range||{from:0,to:0},query:E?.query||null,text:E?.text||null,items:[],command:N=>i({editor:e,range:E?.range||{from:0,to:0},props:N}),decorationNode:D,clientRect:w(y,D)};(k=g?.onExit)==null||k.call(g,T)}catch{}const _=y.state.tr.setMeta(C,{exit:!0});y.dispatch(_)}const A=new zn({key:t,view(){return{update:async(y,C)=>{var k,_,E,D,T,N,M;const I=(k=this.key)==null?void 0:k.getState(C),P=(_=this.key)==null?void 0:_.getState(y.state),R=I.active&&P.active&&I.range.from!==P.range.from,$=!I.active&&P.active,z=I.active&&!P.active,L=!$&&!z&&I.query!==P.query,q=$||R&&L,K=L||R,Q=z||R&&L;if(!q&&!K&&!Q)return;const F=Q&&!q?I:P,B=y.dom.querySelector(`[data-decoration-id="${F.decorationId}"]`);b={editor:e,range:F.range,query:F.query,text:F.text,items:[],command:Y=>i({editor:e,range:F.range,props:Y}),decorationNode:B,clientRect:w(y,B)},q&&((E=g?.onBeforeStart)==null||E.call(g,b)),K&&((D=g?.onBeforeUpdate)==null||D.call(g,b)),(K||q)&&(b.items=await m({editor:e,query:F.query})),Q&&((T=g?.onExit)==null||T.call(g,b)),K&&((N=g?.onUpdate)==null||N.call(g,b)),q&&((M=g?.onStart)==null||M.call(g,b))},destroy:()=>{var y;b&&((y=g?.onExit)==null||y.call(g,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(y,C,k,_){const{isEditable:E}=e,{composing:D}=e.view,{selection:T}=y,{empty:N,from:M}=T,I={...C},P=y.getMeta(t);if(P&&P.exit)return I.active=!1,I.decorationId=null,I.range={from:0,to:0},I.query=null,I.text=null,I;if(I.composing=D,E&&(N||e.view.composing)){(M<C.range.from||M>C.range.to)&&!D&&!C.composing&&(I.active=!1);const R=p({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:a,startOfLine:l,$position:T.$from}),$=`id_${Math.floor(Math.random()*4294967295)}`;R&&h({editor:e,state:_,range:R.range,isActive:C.active})&&(!x||x({editor:e,range:R.range,query:R.query,text:R.text,transaction:y}))?(I.active=!0,I.decorationId=C.decorationId?C.decorationId:$,I.range=R.range,I.query=R.query,I.text=R.text):I.active=!1}else I.active=!1;return I.active||(I.decorationId=null,I.range={from:0,to:0},I.query=null,I.text=null),I}},props:{handleKeyDown(y,C){var k,_,E,D;const{active:T,range:N}=A.getState(y.state);if(!T)return!1;if(C.key==="Escape"||C.key==="Esc"){const I=A.getState(y.state),P=(k=b?.decorationNode)!=null?k:null,R=P??(I?.decorationId?y.dom.querySelector(`[data-decoration-id="${I.decorationId}"]`):null);if(((_=g?.onKeyDown)==null?void 0:_.call(g,{view:y,event:C,range:I.range}))||!1)return!0;const z={editor:e,range:I.range,query:I.query,text:I.text,items:[],command:L=>i({editor:e,range:I.range,props:L}),decorationNode:R,clientRect:R?()=>R.getBoundingClientRect()||null:null};return(E=g?.onExit)==null||E.call(g,z),S(y,t),!0}return((D=g?.onKeyDown)==null?void 0:D.call(g,{view:y,event:C,range:N}))||!1},decorations(y){const{active:C,range:k,decorationId:_,query:E}=A.getState(y);if(!C)return null;const D=!E?.length,T=[d];return D&&T.push(V),Rr.create(y.doc,[Tr.inline(k.from,k.to,{nodeName:c,class:T.join(" "),"data-decoration-id":_,"data-decoration-content":u})])}}});return A}function _c(t){const e=O.c(24),{editor:n,query:r,items:o,onSelect:a,onClose:l}=t,[c,d]=j.useState(0),u=j.useRef(o),V=j.useRef(c),i=j.useRef(a),m=j.useRef(l),f=j.useDeferredValue(r);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{d(0)},e[0]=h):h=e[0];let p;e[1]!==f?(p=[f],e[1]=f,e[2]=p):p=e[2],j.useEffect(h,p);let x,b;e[3]!==o.length||e[4]!==c?(x=()=>{c>=o.length&&o.length>0&&d(0)},b=[o.length,c],e[3]=o.length,e[4]=c,e[5]=x,e[6]=b):(x=e[5],b=e[6]),j.useEffect(x,b);let g,v;e[7]!==o?(g=()=>{u.current=o},v=[o],e[7]=o,e[8]=g,e[9]=v):(g=e[8],v=e[9]),j.useEffect(g,v);let w,S;e[10]!==c?(w=()=>{V.current=c},S=[c],e[10]=c,e[11]=w,e[12]=S):(w=e[11],S=e[12]),j.useEffect(w,S);let A,y;e[13]!==a?(y=()=>{i.current=a},A=[a],e[13]=a,e[14]=A,e[15]=y):(A=e[14],y=e[15]),j.useEffect(y,A);let C,k;e[16]!==l?(C=()=>{m.current=l},k=[l],e[16]=l,e[17]=C,e[18]=k):(C=e[17],k=e[18]),j.useEffect(C,k);let _,E;e[19]!==n?(_=()=>{if(n?.isDestroyed)return;let N;try{N=n.view.dom}catch{return}if(!N)return;const M=P=>{const R=u.current;if(!R.length)return!1;const $=()=>d(L=>(L+1)%R.length),z=()=>d(L=>(L-1+R.length)%R.length);switch(P.key){case"ArrowUp":return P.preventDefault(),z(),!0;case"ArrowDown":return P.preventDefault(),$(),!0;case"Tab":return P.preventDefault(),P.shiftKey?z():$(),!0;case"Home":return P.preventDefault(),d(0),!0;case"End":return P.preventDefault(),d(R.length-1),!0;case"Enter":{if(P.isComposing)return!1;P.preventDefault();const L=V.current;return L!==-1&&R[L]&&i.current?.(R[L],L),!0}case"Escape":return P.preventDefault(),m.current?.(),!0;default:return!1}},I=P=>{M(P)};return N.addEventListener("keydown",I,!0),()=>{N?.removeEventListener("keydown",I,!0)}},E=[n],e[19]=n,e[20]=_,e[21]=E):(_=e[20],E=e[21]),j.useEffect(_,E);const D=o.length?c:void 0;let T;return e[22]!==D?(T={selectedIndex:D,setSelectedIndex:d},e[22]=D,e[23]=T):T=e[23],T}function Ic(t,e){switch(e.type){case"SET_SELECTED_ITEM":return{...t,selectedItem:e.payload};case"ON_START":return{...t,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...t,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return t}}const Os=j.createContext(void 0);function Ls(){const t=j.useContext(Os);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function Ec({editor:t,char:e,pluginKey:n,allow:r,onOpenChange:o}){const[a,l]=j.useReducer(Ic,{open:!1,element:null,query:"",range:null,selectedItem:null}),c=j.useRef(o);return c.current=o,j.useEffect(()=>{if(t?.isDestroyed)return;const d=n instanceof Xe?n:new Xe(n);t.state.plugins.find(i=>i.spec.key===d)&&t.unregisterPlugin(d);const V=kc({pluginKey:d,editor:t,char:e,allow(i){const m=t.state.doc.resolve(i.range.from);for(let f=m.depth;f>0;f--)if(m.node(f).type.name==="image")return!1;return!(r&&!r(i))},command(){},render:()=>({onStart:i=>{l({type:"ON_START",payload:{element:i.decorationNode??null,query:i.query,range:i.range}}),c.current?.(!0)},onUpdate:i=>{l({type:"ON_UPDATE",payload:{element:i.decorationNode??null,query:i.query,range:i.range}})},onKeyDown:i=>i.event.key==="Escape"?(l({type:"ON_EXIT"}),!0):!1,onExit:()=>{l({type:"ON_EXIT"}),c.current?.(!1)}}),items:()=>[]});return t.registerPlugin(V),()=>{t?.isDestroyed||t.unregisterPlugin(d)}},[t,n,e,l,r]),{state:a,dispatch:l}}function Rc({editor:t,queryKey:e,queryFn:n,onSelect:r}){const{state:o,dispatch:a}=Ls(),l=j.useDeferredValue(o.query),{data:c}=Vr({queryKey:Ee.suggestionItems(e,o.open,l),queryFn:()=>o.open?n({query:l}):[]}),d=()=>{a({type:"ON_EXIT"})},u=async(i,m)=>{if(!(o.selectedItem!==null||!o.range)){a({type:"SET_SELECTED_ITEM",payload:i});try{const{view:f}=t,p=f.state.selection.$to.nodeAfter?.text?.startsWith(" "),x=o.range?{...o.range}:{from:0,to:0};p&&o.range&&(x.to+=1),await r({range:x,item:i})===!1?a({type:"SET_SELECTED_ITEM",payload:null}):d()}catch{d()}}},{selectedIndex:V}=_c({editor:t,query:l,items:c,onSelect:u,onClose:d});return{selectedItem:o.selectedItem,items:c,selectedIndex:V,close:d,onSelect:u}}function Tc({children:t}){const{state:e,dispatch:n}=Ls(),{open:r,element:o}=e,a=()=>{n({type:"ON_EXIT"})},{refs:l,floatingStyles:c,context:d}=Ac({placement:"bottom-start",open:r,onOpenChange:m=>{m||a()},elements:{reference:o},middleware:[fr(10),mr(),pr()],whileElementsMounted:hr}),u=vc(d,{outsidePress:m=>!(m.target instanceof Element&&m.target.closest(".ProseMirror"))}),V=Sc(d,{role:"listbox"}),{getFloatingProps:i}=jc([u,V]);return r?s.jsx(hc,{children:s.jsx("div",{ref:l.setFloating,style:c,...i(),className:"z-50 w-auto min-w-[360px] max-w-[520px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-md outline-hidden overflow-hidden",children:t})}):null}const Dc=t=>{const e=O.c(29),{item:n,isSelected:r,onSelect:o,isLoading:a,ref:l}=t;let c;if(e[0]!==n){const A=me(n._meta);c=n.title||Ft(n.name,A),e[0]=n,e[1]=c}else c=e[1];const d=c,u=n.description||null,V=n.icon,i=r&&"bg-accent text-accent-foreground",m=a&&"pointer-events-none opacity-50";let f;e[2]!==i||e[3]!==m?(f=U("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",i,m),e[2]=i,e[3]=m,e[4]=f):f=e[4];let h;e[5]!==V||e[6]!==d?(h=V!==void 0&&s.jsx(Qn,{icon:V,name:d,size:"xs",className:"mr-2"}),e[5]=V,e[6]=d,e[7]=h):h=e[7];let p;e[8]!==d?(p=s.jsx("span",{className:"font-medium flex items-center truncate capitalize",children:d}),e[8]=d,e[9]=p):p=e[9];let x;e[10]!==a?(x=a&&s.jsx(Nt,{size:"xs"}),e[10]=a,e[11]=x):x=e[11];let b;e[12]!==p||e[13]!==x?(b=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p,x]}),e[12]=p,e[13]=x,e[14]=b):b=e[14];let g;e[15]!==u?(g=u&&s.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:u}),e[15]=u,e[16]=g):g=e[16];let v;e[17]!==b||e[18]!==g?(v=s.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[b,g]}),e[17]=b,e[18]=g,e[19]=v):v=e[19];let w;e[20]!==n.drillable?(w=n.drillable&&s.jsx("kbd",{className:"shrink-0 ml-2 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground bg-muted border border-border rounded",children:"↵"}),e[20]=n.drillable,e[21]=w):w=e[21];let S;return e[22]!==o||e[23]!==l||e[24]!==v||e[25]!==w||e[26]!==f||e[27]!==h?(S=s.jsxs("div",{ref:l,onClick:o,className:f,children:[h,v,w]}),e[22]=o,e[23]=l,e[24]=v,e[25]=w,e[26]=f,e[27]=h,e[28]=S):S=e[28],S},Pc=t=>{const e=O.c(18),{editor:n,queryKey:r,queryFn:o,onSelect:a}=t;let l;e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==r?(l={editor:n,queryKey:r,queryFn:o,onSelect:a},e[0]=n,e[1]=a,e[2]=o,e[3]=r,e[4]=l):l=e[4];const{items:c,selectedIndex:d,onSelect:u,selectedItem:V}=Rc(l);if(!c.length){let h;return e[5]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md border shadow-md p-3 text-sm",children:"No items found"}),e[5]=h):h=e[5],h}let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[6]=i):i=e[6];let m;if(e[7]!==u||e[8]!==c||e[9]!==d||e[10]!==V?.name){let h;e[12]!==u||e[13]!==d||e[14]!==V?.name?(h=(p,x)=>s.jsx(Dc,{item:p,isSelected:x===d,ref:x===d?$c:void 0,onSelect:()=>u(p,x),isLoading:V?.name===p.name},`${p.kind??"item"}:${p.name}`),e[12]=u,e[13]=d,e[14]=V?.name,e[15]=h):h=e[15],m=c.map(h),e[7]=u,e[8]=c,e[9]=d,e[10]=V?.name,e[11]=m}else m=e[11];let f;return e[16]!==m?(f=s.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:i,children:s.jsx("div",{className:"p-1",children:m})}),e[16]=m,e[17]=f):f=e[17],f};function Mc(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"p-1",children:[...Array(3)].map(Fc)}),t[0]=e):e=t[0],e}function Fc(t,e){return s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[s.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),s.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function zs(t){const e=O.c(18),{editor:n,char:r,pluginKey:o,queryKey:a,queryFn:l,onSelect:c,allow:d,onOpenChange:u}=t;let V;e[0]!==d||e[1]!==r||e[2]!==n||e[3]!==u||e[4]!==o?(V={editor:n,char:r,pluginKey:o,allow:d,onOpenChange:u},e[0]=d,e[1]=r,e[2]=n,e[3]=u,e[4]=o,e[5]=V):V=e[5];const{state:i,dispatch:m}=Ec(V);let f;e[6]!==m||e[7]!==i?(f={state:i,dispatch:m},e[6]=m,e[7]=i,e[8]=f):f=e[8];let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Mc,{}),e[9]=h):h=e[9];let p;e[10]!==n||e[11]!==c||e[12]!==l||e[13]!==a?(p=s.jsx(Tc,{children:s.jsx(j.Suspense,{fallback:h,children:s.jsx(Pc,{editor:n,queryKey:a,queryFn:l,onSelect:c})})}),e[10]=n,e[11]=c,e[12]=l,e[13]=a,e[14]=p):p=e[14];let x;return e[15]!==f||e[16]!==p?(x=s.jsx(Os.Provider,{value:f,children:p}),e[15]=f,e[16]=p,e[17]=x):x=e[17],x}function $c(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const Oc=[{name:"agents",title:"Agents",description:"Mention an agent to hand off work",kind:"category",drillable:!0},{name:"resources",title:"Resources",description:"Attach a resource as context",kind:"category",drillable:!0}],Lc=({editor:t,virtualMcpId:e})=>{const n=qe(),{org:r}=de(),o=io(),a=Eo(o),l=Me({connectionId:e,orgId:r.id,orgSlug:r.slug}),c=Ee.virtualMcpResources(e,r.id),[d,u]=j.useState("categories"),V=j.useRef(d);V.current=d;const i=j.useRef(null),m=j.useRef(!1),f=["at-mention",r.id,e??"default",d],h=async({item:b,range:g})=>{if(G("chat_picker_item_selected",{picker:"@",item_kind:b.kind,item_name:b.name}),b.kind!=="category"&&(m.current=!0),b.kind==="category")return u(b.name==="agents"?"agents":"resources"),!1;if(b.kind==="agent"&&b.agentId){Te(t,g,{id:b.agentId,name:b.name,metadata:{agentId:b.agentId,title:b.name},char:"@"}),u("categories");return}if(b.kind==="resource"&&b.uri&&l){try{const v=await Dn(l,b.uri);Te(t,g,{id:b.uri,name:b.uri,metadata:v.contents,char:"@"})}catch(v){console.error("[at-mention] Failed to fetch resource:",v),le.error("Failed to load resource. Please try again.")}u("categories");return}},p=async b=>{const{query:g}=b,v=V.current;if(v==="categories"){if(!g.trim())return Oc;const A=g.toLowerCase(),y=o.filter(k=>k.status==="active"&&(!k.id||!Xt(k.id))&&!a.has(k.id)&&k.id!==e&&(k.title.toLowerCase().includes(A)||k.description?.toLowerCase().includes(A))).map(k=>({name:k.title,title:k.title,description:k.description??void 0,icon:k.icon??null,kind:"agent",agentId:k.id})),C=await(async()=>{if(!l)return[];let k=n.getQueryData(c);return k||(k=await n.fetchQuery({queryKey:c,queryFn:()=>ze(l),staleTime:6e4})),(k?.resources??[]).filter(_=>_.uri.toLowerCase().includes(A)||_.name?.toLowerCase().includes(A)||_.description?.toLowerCase().includes(A)).map(_=>({name:_.name??_.uri,title:_.name,description:_.description,kind:"resource",uri:_.uri}))})();return[...y,...C]}if(v==="agents"){let A=o.filter(y=>y.status==="active"&&(!y.id||!Xt(y.id))&&!a.has(y.id)&&y.id!==e);if(g.trim()){const y=g.toLowerCase();A=A.filter(C=>C.title.toLowerCase().includes(y)||C.description?.toLowerCase().includes(y))}return A.map(y=>({name:y.title,title:y.title,description:y.description??void 0,icon:y.icon??null,kind:"agent",agentId:y.id}))}if(!l)return[];let w=n.getQueryData(c);w?n.fetchQuery({queryKey:c,queryFn:()=>ze(l),staleTime:6e4}).catch(()=>{}):w=await n.fetchQuery({queryKey:c,queryFn:()=>ze(l),staleTime:6e4});let S=w?.resources??[];if(g.trim()){const A=g.toLowerCase();S=S.filter(y=>y.uri.toLowerCase().includes(A)||y.name?.toLowerCase().includes(A)||y.description?.toLowerCase().includes(A))}return S.map(A=>({name:A.name??A.uri,title:A.name,description:A.description,kind:"resource",uri:A.uri}))},x=b=>{if(b)i.current=Date.now(),m.current=!1,G("chat_picker_opened",{picker:"@"});else{const g=i.current;G("chat_picker_closed",{picker:"@",outcome:m.current?"selected":"dismissed",duration_ms:g?Date.now()-g:null}),i.current=null,u("categories")}};return s.jsx(zs,{editor:t,char:"@",pluginKey:"atDropdownMenu",queryKey:f,queryFn:p,onSelect:h,onOpenChange:x})};async function _n(t,e,n,r,o,a){try{const l=await ft(n,r,a);Te(t,e,{id:r,name:lt(r,o),metadata:l.messages,char:"/",kind:"prompt",args:a})}catch(l){console.error("[slash] Failed to fetch prompt:",l),le.error("Failed to load prompt. Please try again.")}}async function zc(t,e,n,r){try{const o=await Dn(n,r);Te(t,e,{id:r,name:r,metadata:o.contents,char:"/",kind:"resource"})}catch(o){console.error("[slash] Failed to fetch resource:",o),le.error("Failed to load resource. Please try again.")}}async function Bc(t,e,n,r){try{const{files:o,omittedPaths:a}=await Ko(n,r.volume,r.path),l={sandboxPath:r.sandboxPath,files:o,omittedPaths:a};Te(t,e,{id:r.id,name:r.name,metadata:l,char:"/",kind:"skill"})}catch(o){console.error("[slash] Failed to fetch skill:",o),le.error("Failed to load skill. Please try again.")}}const Uc=({editor:t,virtualMcpId:e})=>{const n=qe(),{org:r}=de(),o=Me({connectionId:e,orgId:r.id,orgSlug:r.slug}),a=Ee.virtualMcpPrompts(e,r.id),l=Ee.virtualMcpResources(e,r.id),c=Ee.slashSkills(r.id),d=["slash-mention",r.id,e??"default"],[u,V]=j.useState(null),[i,m]=j.useState(null),f=Pr(t);f&&(f.onEditChip=async S=>{if(o)try{const y=(await In(n,a,o)).find(C=>C.name===S.promptId);if(!y?.arguments||y.arguments.length===0)return;m({...S,prompt:y})}catch(A){console.error("[slash] Failed to load prompt for editing:",A),le.error("Failed to load prompt. Please try again.")}});const h=j.useRef(null),p=j.useRef(!1),x=async({item:S,range:A})=>{if(G("chat_picker_item_selected",{picker:"/",item_kind:S.kind,item_name:S.name}),p.current=!0,!!o)if(S.kind==="prompt"){if(S.arguments&&S.arguments.length>0){V({range:A,item:S});return}const y=me(S._meta);await _n(t,A,o,S.name,y)}else S.kind==="skill"?S.skill&&await Bc(t,A,r.slug,S.skill):S.uri&&await zc(t,A,o,S.uri)},b=async S=>{if(!u||!o)return;const{range:A,item:y}=u,C=me(y._meta);await _n(t,A,o,y.name,C,S),V(null)},g=async S=>{if(!(!i||!o)){try{const A=await ft(o,i.promptId,S),y=me(i.prompt._meta);t.chain().focus().setNodeSelection(i.pos).deleteSelection().insertContentAt(i.pos,Ln({id:i.promptId,name:lt(i.promptId,y),metadata:A.messages,char:"/",kind:"prompt",args:S})).run(),G("chat_picker_item_selected",{picker:"/edit",item_kind:"prompt",item_name:i.promptId})}catch(A){console.error("[slash] Failed to update prompt:",A),le.error("Failed to update prompt. Please try again.")}m(null)}},v=async S=>{const{query:A}=S;if(!o)return[];const[y,C,k]=await Promise.all([In(n,a,o),Kc(n,l,o),qc(n,c,r.slug)]),_=A.trim().toLowerCase(),E=(y??[]).filter(N=>!_||N.name.toLowerCase().includes(_)||N.title?.toLowerCase().includes(_)||N.description?.toLowerCase().includes(_)).map(N=>({name:N.name,title:N.title,description:N.description,kind:"prompt",arguments:N.arguments,_meta:N._meta})),D=(C??[]).filter(N=>!_||N.uri.toLowerCase().includes(_)||N.name?.toLowerCase().includes(_)||N.description?.toLowerCase().includes(_)).map(N=>({name:N.name??N.uri,title:N.name,description:N.description,kind:"resource",uri:N.uri})),T=(k??[]).filter(N=>!_||N.name.toLowerCase().includes(_)||N.id.toLowerCase().includes(_)||N.description?.toLowerCase().includes(_)).map(N=>({name:N.name,title:N.name,description:N.description??void 0,kind:"skill",skill:N}));return[...E,...D,...T]},w=u?.item.kind==="prompt"?{name:u.item.name,title:u.item.title,arguments:u.item.arguments,description:u.item.description,_meta:u.item._meta}:null;return s.jsxs(s.Fragment,{children:[s.jsx(zs,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:d,queryFn:v,onSelect:x,onOpenChange:S=>{if(S)h.current=Date.now(),p.current=!1,G("chat_picker_opened",{picker:"/"});else{const A=h.current;G("chat_picker_closed",{picker:"/",outcome:p.current?"selected":"dismissed",duration_ms:A?Date.now()-A:null}),h.current=null}}}),s.jsx(Ze,{prompt:w,setPrompt:()=>V(null),onSubmit:b}),s.jsx(Ze,{prompt:i?.prompt??null,setPrompt:()=>m(null),onSubmit:g,defaultValues:i?.args},i?`edit-${i.promptId}-${i.pos}`:"edit-idle")]})};async function In(t,e,n){let r=t.getQueryData(e);return r?t.fetchQuery({queryKey:e,queryFn:()=>_t(n),staleTime:6e4}).catch(()=>{}):r=await t.fetchQuery({queryKey:e,queryFn:()=>_t(n),staleTime:6e4}),r?.prompts??[]}async function qc(t,e,n){const r=t.getQueryData(e),o=()=>t.fetchQuery({queryKey:e,queryFn:()=>Qo(n),staleTime:6e4});return r?(o().catch(()=>{}),r):o().catch(()=>[])}async function Kc(t,e,n){let r=t.getQueryData(e);return r?t.fetchQuery({queryKey:e,queryFn:()=>ze(n),staleTime:6e4}).catch(()=>{}):r=await t.fetchQuery({queryKey:e,queryFn:()=>ze(n),staleTime:6e4}),r?.resources??[]}function Qc(t){return[Lr.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),_i.configure({placeholder:()=>t.current??"Ask anything, / for prompts, @ for agents & resources...",showOnlyWhenEditable:!1}),$r,Or]}function Yc({tiptapDoc:t,setTiptapDoc:e,disabled:n=!1,enterToSubmit:r=!1,placeholder:o,onSubmit:a,children:l}){const c=j.useRef(a),d=j.useRef(e),u=j.useRef(r),V=j.useRef(o),i=Mr({extensions:Qc(V),content:t||"",editorProps:{attributes:{"data-chat-input":"true",class:"prose prose-sm max-w-none focus:outline-none w-full h-full text-[15px] p-[18px]"},handleKeyDown:(m,f)=>f.key==="Enter"&&!f.shiftKey&&u.current?(f.preventDefault(),c.current?.(),!0):!1},onUpdate:({editor:m})=>{d.current(m?.getJSON())}});return j.useEffect(()=>{i?.setEditable(!n)},[i,n]),j.useEffect(()=>{c.current=a},[a]),j.useEffect(()=>{d.current=e},[e]),j.useEffect(()=>{u.current=r},[r]),j.useEffect(()=>{V.current=o},[o]),j.useEffect(()=>{if(!i||i.isDestroyed)return;const m=JSON.stringify(i.getJSON()),f=JSON.stringify(t||{type:"doc",content:[]});m!==f&&i.commands.setContent(t||{type:"doc",content:[]})},[i,t]),s.jsx(Fr.Provider,{value:{editor:i},children:l})}function Hc(t){const e=O.c(26),{disabled:n,virtualMcpId:r,showFileUploader:o,selectedModel:a,onUnsupportedFile:l,ref:c,className:d}=t,u=n===void 0?!1:n,V=o===void 0?!1:o,{editor:i}=$t();let m,f;if(e[0]!==i?(m=()=>({focus:()=>{i?.commands.focus()},clear:()=>{i?.commands.clearContent(!0)},appendText:C=>{if(!i)return;const k=i.state.doc.textContent.trim()==="";i.commands.focus("end"),k||i.commands.insertContent(" "),i.commands.insertContent(C)},syncVoiceText:(C,k)=>{if(i&&(i.commands.setContent(C||{type:"doc",content:[]}),k)){i.commands.focus("end");const _=i.state.doc.textContent.trim().length>0;i.commands.insertContent(_?" "+k:k)}},restoreContent:C=>{i&&i.commands.setContent(C||{type:"doc",content:[]})}}),f=[i],e[0]=i,e[1]=m,e[2]=f):(m=e[1],f=e[2]),j.useImperativeHandle(c??null,m,f),!i)return null;const h=u&&"cursor-not-allowed opacity-70",p=u&&"[&_.ProseMirror]:cursor-not-allowed";let x;e[3]!==d||e[4]!==h||e[5]!==p?(x=U("overflow-y-auto relative flex-1 max-h-[164px] min-h-[20px] w-full flex flex-col",d,"[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[20px] [&_.ProseMirror]:flex-1","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:opacity-50","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0",h,p),e[3]=d,e[4]=h,e[5]=p,e[6]=x):x=e[6];let b;e[7]!==i||e[8]!==x?(b=s.jsx(zr,{editor:i,className:x}),e[7]=i,e[8]=x,e[9]=b):b=e[9];const g=r??null;let v;e[10]!==i||e[11]!==g?(v=s.jsx(j.Suspense,{fallback:null,children:s.jsx(Uc,{editor:i,virtualMcpId:g})}),e[10]=i,e[11]=g,e[12]=v):v=e[12];const w=r??null;let S;e[13]!==i||e[14]!==w?(S=s.jsx(j.Suspense,{fallback:null,children:s.jsx(Lc,{editor:i,virtualMcpId:w})}),e[13]=i,e[14]=w,e[15]=S):S=e[15];let A;e[16]!==i||e[17]!==l||e[18]!==a||e[19]!==V?(A=V&&a?s.jsx(ji,{editor:i,selectedModel:a,onUnsupportedFile:l}):null,e[16]=i,e[17]=l,e[18]=a,e[19]=V,e[20]=A):A=e[20];let y;return e[21]!==v||e[22]!==S||e[23]!==A||e[24]!==b?(y=s.jsxs(s.Fragment,{children:[b,v,S,A]}),e[21]=v,e[22]=S,e[23]=A,e[24]=b,e[25]=y):y=e[25],y}function Bs(t){const e=O.c(3),[n]=De();let r;return e[0]!==n.enableSounds||e[1]!==t?(r=()=>{n.enableSounds&&Zo(t.dataUri).catch(a=>{console.warn(`[sound] ${t.name} playback failed:`,a)})},e[0]=n.enableSounds,e[1]=t,e[2]=r):r=e[2],r}const Gc={name:"switch-005",dataUri:"data:audio/mpeg;base64,SUQzBAAAAAAAIlRTU0VAAAAOAAADTGF2ZjYyLjMuMTAwAAAAAAAAAAAAAAD/+1DAAAAAAAAAAAAAAAAAAAAAAABJbmZvAAAADwAAABkAABU4ABMTEx0dHR0nJycnMTExMTs7OztERERETk5OTlhYWFhiYmJibGxsbHZ2dnZ/f39/iYmJiZOTk5OdnZ2dp6enp7GxsbG7u7u7xMTExM7Ozs7Y2NjY4uLi4uzs7Oz29vb2/////wAAAABMYXZjNjIuMTEAAAAAAAAAAAAAAAAkBVYAAAAAAAAVOPCP8KUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//tQxAAACEwDXvQRAAG8Ii93HtACUCAABAKCJwfaCEHwfeoEAQdEAYygIHBOCAIAgCAJh9QIOg+D5/ygPh/wfB8DuKAgCHyn9QPh/5SCDv+CEHAQdxOD4B27c39tbckkqYbBAYAN9bNJLB+aXAf5wQAKdzxfbmrVIRQ4xNx3HwnoDmLhfMhgJiiw/HREXNCHqjvHEPEG8QjBYlxQNepJAT0kC8ip6JzSWj1TasoG+iyycbf2Uil1ovf1f/oUtR1qP+s1WSBFKoAAU02BDjMhuP/7UsQEgws8bRpd8YABJYPeBf9wCGXTGxBYcw5AJFMFMAmQQAhGAxgLBgHIAMYAAALhgAchipbe/91aU1VV4zcZj1Vf1XgYCIMBNrsBAIGs9/Ue4i/xFPeqCqwViI9/UeLf///rOngdA3OPHFjmOBv+EQnGahgaZxVplmkAH5JadDTQlNCEuGNiWYbCCONWdUJg6HXNazFdu1T+VgaEpOP70exv7f2/4b/yH//2/4cqCX/zWRUrIw+IPNMNlDnjAXQas/I4AzmYifA0tMSCgQDF//tSxBCDSzzi3k/sQwEyCtjJ/rBZAk+Uqj1YhA5YMCAAMwgOUchTkK7OR7LbMl0W1H6SvzG0Q2ZzfKUhnmTobv9DNhS1v7P8h//8Gv8gTRt1jReZ7YEjmMQg9hhwwMycHooasFmZyjcZGBKJD+IwbMCQQLoi+IQXCcIoydKoilI2MWFS5uJdDEu2taRrYI2ZSqKY50pJLv2NfjUAAuQAMfqVQ/T3PDQgMJMeEZ45hJzY6MNoFMxqTj1zNGQKJjAxEsSCBgQJBSIL0mcKYQJfVAn/+1LEGwLKlEKrD3MiYcuMkVa/wABB8Vh6M1q1epbvXwWBURhkyEhWZ/////////////9gjZ/Wt4w+4MNMCpE4TBYQl4w1IHvMDdA2zBngBMwc8COMDhCpDAfgOAAgrBgNYU+YC0FBGAkAMpgWoSCYAGESGBGAKBgXgJOdiOJmMCmNwCYNDJhYRPykRCJhTBnEUzlsjv4UNLj/z97n3Mv/7z1nZqyitYAZIqErIwMwJAqEw0GAAMFptJMaqFwB8CQIWlhuhuDAwNjfuwrQFAYXCf/7UsQVAA+9PTP42gYRdiIu9zBwAPbFUCi0DAhgNcS+7cDwVgM05A9bUDeuQMyE/u3CygVISgZhpIau/9PhdQG2C9DpxZZJmn/dn/Psmt0EFm////l84ThUTopE4VD/9JkubOGasTvN30C20G21qgUCkVCoUCgPMywrPCGly27V5q5t24vl/8jSlSAPCxzNseNCw3oh3NGBu4BZJ5hv7DRSfR/+eWG7nA8IKh2Olv5iz3q5m3//Joxo3JqNyYkSuGt/k6D4DeoBOHmHdl0dkZYA//tSxAUAC4B1Z/2DADEcA17Z/uhI4Yoik/TrZo+ww7UtmpW4LDWu2IacoJKJJeTSM+ZmAYBEiU+ZnnAwCn1VVVV6JUJQVnioKhrgqdKgqGpUFeCp0sDR3ztQNREDRUFioKuxKCpYGQBlRIBk+aLwb8KblGQVDdphPYTUdBOGbVpAaTF6ZdjEV0iRUZRCYkA4oUQDx5zqDugtXvza/7fuNNvfZ+j9v+T/2f//J/4cAAOTpE5K4zksR9MfIB+TDcQTI4gNs1XKAzEFUrGkxABYEBb/+1LEEYNKrEjgT/TCwYYVmUX+mHoKgWhKU5Eiw9SFIRmppw+3fYo4siPhUFeexM8KgIO6wVuPDDy01qeRaVbw357//y3+o8M0pBNlNLCGBzGKwyYw2IIFOE1WNTjRM6x8MlA1AxDhUHTAkEiyKpnbWrLcaOBotBUKbk1pypcWDAIK00AhKLGkUco6q9VWvM53mcaq3tVa8zjTM/tX//EDP//////////XAAmrwAAPoKwcw0ShDCZD/BQlhzinxQdorsOuXTEIC01ZkJyu4k/qPP/7UsQUAEjkrrkvZaPBIRXUoe5QObfMhYKX9RVgTPqCSCaSCaSC0XVdV1f/////6IAlguuAJSiDRNloNBsZg+0+Ts8MMCn81WUTRAlIi+GHECD0y8AWDIqswYsxGOSKVV7MqOni8tkVOip0fZX/////9HrMCbAz2EHGS4GKAAiRAAAYAcDdKd4G6Z/nwYgJ0ZAIgZyC8aPAs/iPBhwMpWDQNARltNS5Y61v//9i8Yl4SkFkIGTkAc0UBrIYLPA4MYBEy+YLMRuY4nhTC3hZA68H//tSxCoAyQC6mY6CkWDJBIsBz/QUrgNmahSzcrYw0/HhfnMAZBojDsgTFkDR5MDkG/DZEbk2FCmowqdqv2TYABiJwqqYjaQRGZ1URZ1DhSsdiHX/GBu0QpzIBNSaLqZ0ARkwFARxMrpt/Eh47mbQAhhU6sisFUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LESoHHJCRaj/dmYAIAQAAQAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsSLg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsShg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",duration:.609,format:"mp3",license:"CC0",author:"Kenney"},Wc=ao.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),Jc=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function Zc(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex items-center -space-x-1.5",children:Jc.map(Xc)}),t[0]=e):e=t[0],e}function Xc(t){return s.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-1 ring-border object-cover bg-white"},t.name)}function ed({disabled:t,onOpenConnections:e,virtualMcpId:n,selectedModel:r,isStreaming:o,onUnsupportedFile:a}){const[l,c]=j.useState(!1),d=Bs(Gc),{org:u}=de(),{editor:V}=$t(),i=j.useRef(null),m=ht(r),f=()=>{!m||o||(c(!1),i.current?.click())},h=async F=>{const B=F.target.files;if(!B||B.length===0||!V)return;const Y=Array.from(B),{from:H}=V.state.selection;try{for(const Z of Y)await Ht(V,r??null,Z,H,a)}finally{i.current&&(i.current.value="")}},p=Me({connectionId:n,orgId:u.id,orgSlug:u.slug}),x=Ee.virtualMcpPrompts(n,u.id),{data:b,isLoading:g}=xr({queryKey:x,queryFn:()=>_t(p),staleTime:6e4,enabled:l&&!!p}),v=b?.prompts??[],[w,S]=j.useState(null),{chatMode:A,setChatMode:y}=he(),[C,k]=De(),E=(Oe.find(F=>F.value===C.toolApprovalLevel)??Oe[0]).short,D=F=>{const B=Oe.find(Y=>Y.value===F);if(B){if(B.value===C.toolApprovalLevel){c(!1);return}d(),G("chat_approval_level_changed",{from_level:C.toolApprovalLevel,to_level:B.value,source:"tools_popover"}),k({...C,toolApprovalLevel:B.value}),c(!1)}},T=A==="plan",N=()=>{d();const F=T?"default":"plan";G("chat_mode_changed",{from_mode:A,to_mode:F,source:"tools_popover"}),y(F),c(!1)},M=()=>{e(),c(!1)},I=async(F,B)=>{if(!V||!p)return;const Y=me(F._meta),H={from:V.state.selection.from,to:V.state.selection.to};try{const Z=await ft(p,F.name,B);Te(V,H,{id:F.name,name:lt(F.name,Y),metadata:Z.messages,char:"/",kind:"prompt",args:B})}catch{le.error("Failed to load prompt. Please try again.")}},P=async F=>{c(!1);const B=!!(F.arguments&&F.arguments.length>0);if(G("chat_prompt_inserted",{prompt_name:F.name,with_arguments:B}),B){S(F);return}await I(F)},R=async F=>{w&&(await I(w,F),S(null))},$=()=>{d();const F=A==="gen-image"?"default":"gen-image";G("chat_mode_changed",{from_mode:A,to_mode:F,source:"tools_popover"}),y(F),c(!1)},z=()=>{d();const F=A==="web-search"?"default":"web-search";G("chat_mode_changed",{from_mode:A,to_mode:F,source:"tools_popover"}),y(F),c(!1)},L=()=>{d();const F=A==="deep-research"?"default":"deep-research";G("chat_mode_changed",{from_mode:A,to_mode:F,source:"tools_popover"}),y(F),c(!1)},q=A==="gen-image",K=A==="web-search",Q=A==="deep-research";return s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:i,type:"file",multiple:!0,accept:Mo(r??null),className:"hidden",onChange:h,disabled:o}),s.jsxs(Yo,{open:l,onOpenChange:F=>{F&&!l&&G("chat_tools_popover_opened",{chat_mode:A}),c(F)},children:[s.jsx(Ho,{asChild:!0,children:s.jsxs(re,{type:"button",variant:"ghost",size:"default",disabled:t,title:"Tools","aria-label":"Tools",className:U("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),children:[s.jsx(ho,{size:14}),s.jsx("span",{className:U("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),children:"Tools"})]})}),s.jsxs(Go,{align:"start",className:"w-52 p-1.5 space-y-1",children:[m?s.jsxs(fe,{onClick:f,disabled:o,children:[s.jsx(on,{size:16}),s.jsx("span",{className:"flex-1",children:"Add file"})]}):s.jsxs(be,{children:[s.jsx(xe,{asChild:!0,children:s.jsxs(fe,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:F=>F.preventDefault(),children:[s.jsx(on,{size:16}),s.jsx("span",{className:"flex-1",children:"Add file"})]})}),s.jsx(ge,{side:"right",children:"The selected model does not support reading files or images."})]}),s.jsxs(fe,{onClick:N,className:U(T&&"text-violet-600 dark:text-violet-400"),children:[s.jsx(Bn,{size:16,className:U(T&&"text-violet-500")}),s.jsx("span",{className:"flex-1",children:"Plan mode"}),s.jsx("span",{className:U("text-xs text-muted-foreground",T&&"text-violet-500 font-medium"),children:Wc})]}),s.jsxs(fe,{onClick:$,className:U(q&&"text-pink-600 dark:text-pink-400"),children:[s.jsx(qn,{size:16,className:U(q&&"text-pink-500")}),s.jsx("span",{className:"flex-1",children:"Create image"}),q&&s.jsx("span",{className:"text-xs text-pink-500 font-medium",children:"On"})]}),s.jsxs(fe,{onClick:z,className:U(K&&"text-blue-600 dark:text-blue-400"),children:[s.jsx(Un,{size:16,className:U(K&&"text-blue-500")}),s.jsx("span",{className:"flex-1",children:"Web search"}),K&&s.jsx("span",{className:"text-xs text-blue-500 font-medium",children:"On"})]}),s.jsxs(fe,{onClick:L,className:U(Q&&"text-blue-600 dark:text-blue-400"),children:[s.jsx(Yn,{size:16,className:U(Q&&"text-blue-500")}),s.jsx("span",{className:"flex-1",children:"Deep research"}),Q&&s.jsx("span",{className:"text-xs text-blue-500 font-medium",children:"On"})]}),s.jsxs(nn,{children:[s.jsxs(sn,{className:"gap-2",children:[s.jsx("span",{className:"flex size-4 items-center justify-center text-base font-medium text-muted-foreground",children:"/"}),s.jsx("span",{className:"flex-1",children:"Prompts"})]}),s.jsx(rn,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:g?s.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[s.jsx(gr,{size:14,className:"animate-spin"}),"Loading prompts…"]}):v.length===0?s.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:"No prompts available"}):v.map(F=>s.jsxs(fe,{onClick:()=>P(F),className:"flex flex-col items-start gap-0.5",children:[s.jsx("span",{className:"font-medium text-sm capitalize",children:F.title||Ft(F.name,me(F._meta))}),F.description&&s.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:F.description})]},F.name))})]}),s.jsxs(nn,{children:[s.jsxs(sn,{className:"gap-2",children:[s.jsx(pt,{size:16}),s.jsx("span",{className:"flex-1",children:"Approval"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:E})]}),s.jsx(rn,{className:"w-48 p-1.5",children:s.jsx(Wo,{value:C.toolApprovalLevel,onValueChange:D,children:Oe.map(F=>s.jsx(Jo,{value:F.value,children:F.label},F.value))})})]}),s.jsxs(fe,{onClick:M,children:[s.jsx(No,{size:16}),s.jsx("span",{className:"flex-1",children:"Connections"}),s.jsx(j.Suspense,{children:s.jsx(Zc,{})})]})]})]}),s.jsx(Ze,{prompt:w,setPrompt:S,onSubmit:R})]})}const td=[{src:"/connections/github.png",name:"GitHub"},{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/linear.png",name:"Linear"},{src:"/connections/shopify.png",name:"Shopify"},{src:"/connections/firecrawl.png",name:"Firecrawl"},{src:"/connections/perplexity.png",name:"Perplexity"}];function nd(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex items-center -space-x-1",children:td.map(sd)}),t[0]=e):e=t[0],e}function sd(t){return s.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-2 ring-muted object-cover bg-white"},t.name)}function rd(t){const e=O.c(6),{onClick:n}=t;let r,o,a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=U("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),o=s.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:"Connect tools and get more done"}),a=s.jsx(nd,{}),l=s.jsx(ea,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[0]=r,e[1]=o,e[2]=a,e[3]=l):(r=e[0],o=e[1],a=e[2],l=e[3]);let c;return e[4]!==n?(c=s.jsxs("button",{type:"button",onClick:n,className:r,children:[o,a,l]}),e[4]=n,e[5]=c):c=e[5],c}const Le=48;function od(){const t=O.c(9),[e,n]=j.useState("idle"),[r,o]=j.useState(""),[a,l]=j.useState(""),[c,d]=j.useState(id),u=j.useRef(null),V=j.useRef(null),i=j.useRef(null),m=j.useRef(null),f=j.useRef(0),h=j.useRef(!1),p=j.useRef(""),x=j.useRef(""),b=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let g;t[0]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{f.current&&(cancelAnimationFrame(f.current),f.current=0),V.current?.close().catch(ld),m.current?.getTracks().forEach(ad),i.current=null,V.current=null,m.current=null},t[0]=g):g=t[0];const v=g;let w;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const E=D=>{m.current=D;const T=new AudioContext;V.current=T;const N=T.createMediaStreamSource(D),M=T.createAnalyser();M.fftSize=128,M.smoothingTimeConstant=.8,N.connect(M),i.current=M;const I=new Uint8Array(M.frequencyBinCount),P=()=>{if(!i.current)return;i.current.getByteFrequencyData(I);const R=[];for(let $=0;$<Le;$++){const z=Math.floor($/Le*I.length);R.push(Math.max(.04,(I[z]??0)/255))}d(R),f.current=requestAnimationFrame(P)};P()};w=async()=>{const D=window.SpeechRecognition||window.webkitSpeechRecognition;if(!D){n("unsupported");return}let T;try{T=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{n("permission-denied");return}o(""),l(""),x.current="",p.current="",h.current=!0,n("recording"),E(T);const N=new D;u.current=N,N.interimResults=!0,N.continuous=!0,N.lang=navigator.language||"en-US",N.onresult=M=>{let I="",P="";for(let R=M.resultIndex;R<M.results.length;R++){const $=M.results[R],z=$?.[0]?.transcript??"";$?.isFinal?P=P+z:I=I+z}P&&(p.current=p.current+P,o(p.current)),x.current=I,l(I)},N.onend=()=>{if(h.current)try{N.start()}catch{}};try{N.start()}catch{n("idle")}},t[1]=w}else w=t[1];const S=w;let A;t[2]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{h.current=!1,u.current?.stop(),v(),n("idle"),d(Array(Le).fill(.05)),l("");const E=(p.current+(x.current?" "+x.current:"")).trim();return o(""),p.current="",x.current="",E},t[2]=A):A=t[2];const y=A;let C;t[3]===Symbol.for("react.memo_cache_sentinel")?(C=()=>{h.current=!1,u.current?.abort(),v(),n("idle"),o(""),l(""),d(Array(Le).fill(.05)),p.current="",x.current=""},t[3]=C):C=t[3];const k=C;let _;return t[4]!==a||t[5]!==e||t[6]!==r||t[7]!==c?(_={status:e,transcript:r,interimTranscript:a,waveformData:c,isSupported:b,startRecording:S,stopRecording:y,cancelRecording:k},t[4]=a,t[5]=e,t[6]=r,t[7]=c,t[8]=_):_=t[8],_}function ad(t){return t.stop()}function ld(){}function id(){return Array(Le).fill(.05)}function cd(t){const e=O.c(4),{data:n}=t;let r;e[0]!==n?(r=n.map(dd),e[0]=n,e[1]=r):r=e[1];let o;return e[2]!==r?(o=s.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:r}),e[2]=r,e[3]=o):o=e[3],o}function dd(t,e){return s.jsx("div",{className:"w-[2px] shrink-0 rounded-full bg-chart-2 transition-[height] duration-75 ease-out",style:{height:`${Math.max(4,Math.round(t*40))}px`}},e)}function ud({messageCount:t,showConnectionsBanner:e}){return t>0||e}function Vd(t){return t.hasDraft?"send":t.isStreaming||t.isRunInProgress?"stop":"disabled"}function fd(t){const e=O.c(3),{message:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Pn,{size:14,className:"shrink-0"}),e[0]=r):r=e[0];let o;return e[1]!==n?(o=s.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-2.5 rounded-xl border border-border bg-muted/40 text-muted-foreground",children:[r,s.jsx("span",{className:"text-sm",children:n})]}),e[1]=n,e[2]=o):o=e[2],o}function md(t,e){const n=O.c(5),{editor:r}=$t(),[o,a]=j.useState(!1),l=j.useRef(0);let c,d;return n[0]!==r||n[1]!==e||n[2]!==t?(c=()=>{const u=f=>{f.dataTransfer?.types.includes("Files")&&(f.preventDefault(),l.current=l.current+1,a(!0))},V=f=>{f.preventDefault(),l.current=Math.max(0,l.current-1),l.current===0&&a(!1)},i=pd,m=f=>{if(f.preventDefault(),l.current=0,a(!1),!r||!t||!ht(t))return;const h=f.dataTransfer?.files;if(!h||h.length===0)return;const{from:p}=r.state.selection;for(const x of Array.from(h))Ht(r,t,x,p,e)};return window.addEventListener("dragenter",u),window.addEventListener("dragleave",V),window.addEventListener("dragover",i),window.addEventListener("drop",m),()=>{window.removeEventListener("dragenter",u),window.removeEventListener("dragleave",V),window.removeEventListener("dragover",i),window.removeEventListener("drop",m)}},d=[r,t,e],n[0]=r,n[1]=e,n[2]=t,n[3]=c,n[4]=d):(c=n[3],d=n[4]),j.useEffect(c,d),o}function pd(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function hd(t){const e=O.c(11),{selectedModel:n,onUnsupportedFile:r}=t,o=md(n,r);let a;e[0]!==n?(a=ht(n),e[0]=n,e[1]=a):a=e[1];const l=a,c=o?"opacity-100":"opacity-0 pointer-events-none",d=l?"border-primary/40 text-primary/70":"border-destructive/30 text-destructive/70";let u;e[2]!==c||e[3]!==d?(u=U("absolute inset-0 z-20 rounded-xl flex flex-col items-center justify-center gap-2 bg-muted border-2 border-dashed transition-opacity",c,d),e[2]=c,e[3]=d,e[4]=u):u=e[4];let V;e[5]!==n||e[6]!==l?(V=l?s.jsxs(s.Fragment,{children:[s.jsx(bo,{size:24}),s.jsxs("span",{className:"text-sm font-medium",children:["Drop ",os(n)," here"]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Pn,{size:24}),s.jsx("span",{className:"text-sm font-medium",children:"This model can't read attachments — switch to one with vision or file support"})]}),e[5]=n,e[6]=l,e[7]=V):V=e[7];let i;return e[8]!==u||e[9]!==V?(i=s.jsx("div",{className:u,children:V}),e[8]=u,e[9]=V,e[10]=i):i=e[10],i}function xd(){const t=O.c(6),e=ot(),{org:n,locator:r}=de(),{create:o}=so();let a;return t[0]!==o||t[1]!==r||t[2]!==e||t[3]!==n.id||t[4]!==n.slug?(a=async l=>{const{tiptapDoc:c,virtualMcp:d}=l,u=crypto.randomUUID(),V=d?.id??Vt(n.id).id;ro(sessionStorage,r,u,{tiptapDoc:c});try{await o({id:u,virtual_mcp_id:V})}catch{}const i={virtualmcpid:V,autosend:oo};e({to:"/$org/$taskId",params:{org:n.slug,taskId:u},search:i})},t[0]=o,t[1]=r,t[2]=e,t[3]=n.id,t[4]=n.slug,t[5]=a):a=t[5],a}function gd({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const n=On(),r=at(),o=n?.messages??[],a=n?.isStreaming??!1,l=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),d=r?.taskId??"",u=d||wa,V=xd(),{selectedModel:i,selectedVirtualMcp:m,isModelsLoading:f,tiptapDocRef:h,imageModel:p,webSearchModel:x,deepResearchModel:b,chatMode:g,setChatMode:v}=he(),{data:w}=Rn.useSession(),S=w?.user?.id,{org:A,locator:y}=de(),C=Vt(A.id).id,k=co(m?.id??C),_=Bs(Xo),[E,D]=j.useState(!1),{unsupportedFile:T,onUnsupportedFile:N,clearUnsupportedFile:M}=ki(),I=od(),P=j.useRef(void 0),R=async()=>{P.current=q,await I.startRecording();const J=I.status==="recording"?"started":I.status==="unsupported"?"unsupported":I.status==="permission-denied"?"permission_denied":"unknown";G("chat_voice_started",{thread_id:d,outcome:J})},$=()=>{G("chat_voice_confirmed",{thread_id:d});const J=I.stopRecording();H.current?.syncVoiceText(P.current,J),H.current?.focus()},z=()=>{G("chat_voice_cancelled",{thread_id:d}),I.cancelRecording(),H.current?.restoreContent(P.current)};j.useEffect(()=>{if(I.status!=="recording")return;const J=(I.transcript+(I.interimTranscript?" "+I.interimTranscript:"")).trim();H.current?.syncVoiceText(P.current,J)},[I.transcript,I.interimTranscript,I.status]);const L=r?.activeTask??null,[q,K]=j.useState(()=>cn(sessionStorage,y,u)??void 0),Q=J=>{K(J),h.current=J,Ca(sessionStorage,y,u,J,{onQuotaExceeded:({docSizeBytes:ie})=>{G("chat_draft_quota_exceeded",{thread_id:d||null,doc_size_bytes:ie}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},F=j.useRef(d);if(F.current!==d){F.current=d;const J=cn(sessionStorage,y,u)??void 0;K(J),h.current=J}const Y=[...o].reverse().find(J=>J.role==="assistant")?.metadata?.modelLimits?.contextWindow??i?.limits?.contextWindow,H=j.useRef(null),Z=g==="plan";j.useEffect(()=>{const J=ie=>{lo(ie)&&ie.code==="KeyL"&&(ie.preventDefault(),ie.shiftKey&&v(g==="plan"?"default":"plan"),H.current?.focus())};return document.addEventListener("keydown",J),()=>document.removeEventListener("keydown",J)},[g,v]);const X=Br(o),te=[...o].reverse().find(J=>J.role==="assistant"&&J.metadata?.usage)?.metadata?.usage?.contextTokens??0,se=!f&&!fs(q),W=Vd({hasDraft:se,isStreaming:a,isRunInProgress:l}),oe=W==="send",ne=W==="stop",ce=ud({messageCount:o.length,showConnectionsBanner:e}),Ve=J=>{if(J?.preventDefault(),W==="send"&&q){if(G("chat_message_sent",{thread_id:d||null,mode:g,model_id:i?.modelId??null,model_provider:i?.providerId??null,virtual_mcp_id:m?.id??null,submission:J?"button_or_enter":"programmatic"}),n){if(n.isSendInFlight()){le.info("Still sending your previous message — try again in a moment");return}n.sendMessage(q)}else V({tiptapDoc:q,virtualMcp:m});Na(sessionStorage,y,u),Q(void 0)}else W==="stop"&&(G("chat_message_stopped",{thread_id:d}),c())};return S&&L?.created_by&&L.created_by!==S?s.jsx(fd,{message:"Read only - you're viewing someone else's thread"}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-col w-full justify-end",children:s.jsxs("div",{className:"relative rounded-2xl w-full flex flex-col",children:[e&&s.jsx("div",{className:"absolute inset-0 rounded-2xl pointer-events-none bg-muted/50"}),n&&r&&s.jsx(xt,{}),n&&r&&d?s.jsx(Cl,{taskId:d}):null,s.jsx(Yc,{tiptapDoc:q,setTiptapDoc:Q,disabled:!1,enterToSubmit:!0,onSubmit:Ve,children:s.jsxs("form",{onSubmit:Ve,className:U("w-full relative rounded-2xl min-h-[110px] md:min-h-[130px] flex flex-col bg-card dark:bg-muted card-shadow overflow-hidden"),children:[s.jsx(hd,{selectedModel:i,onUnsupportedFile:N}),s.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:s.jsx(Hc,{ref:H,disabled:I.status==="recording",virtualMcpId:m?.id??C,showFileUploader:!0,selectedModel:i,onUnsupportedFile:N})}),s.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:I.status==="recording"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex-1"}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsx(cd,{data:I.waveformData.slice(0,28)}),s.jsx("button",{type:"button",onClick:z,className:"flex items-center justify-center size-8 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Cancel recording",children:s.jsx(_e,{size:16})}),s.jsx("button",{type:"button",onClick:$,className:"flex items-center justify-center size-8 rounded-lg bg-foreground text-background hover:opacity-80 transition-opacity","aria-label":"Use transcription",children:s.jsx(Ke,{size:16})})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(ed,{disabled:!1,onOpenConnections:()=>{G("connections_dialog_opened",{source:"tools_popover",mode:"add"}),D(!0)},virtualMcpId:m?.id??C,selectedModel:i,isStreaming:a,onUnsupportedFile:N}),Z&&s.jsxs("button",{type:"button",onClick:()=>{_(),G("chat_mode_changed",{from_mode:"plan",to_mode:"default",source:"pill_dismiss"}),v("default")},title:"Plan mode","aria-label":"Plan mode",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-violet-600 dark:text-violet-400 hover:bg-violet-500/10 group min-w-0 shrink animate-in fade-in duration-200",children:[s.jsx(Bn,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100",children:"Plan mode"}),s.jsx(_e,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),g==="gen-image"&&p&&s.jsxs("button",{type:"button",onClick:()=>{_(),G("chat_mode_changed",{from_mode:"gen-image",to_mode:"default",source:"pill_dismiss"}),v("default")},title:"Create image","aria-label":"Create image",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-pink-600 dark:text-pink-400 hover:bg-pink-500/10 group min-w-0 shrink animate-in fade-in duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:[s.jsx(qn,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[120px] @[320px]/chat-bottom:opacity-100",children:"Create image"}),s.jsx(_e,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),g==="web-search"&&x&&s.jsxs("button",{type:"button",onClick:()=>{_(),G("chat_mode_changed",{from_mode:"web-search",to_mode:"default",source:"pill_dismiss"}),v("default")},title:"Web search","aria-label":"Web search",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 group min-w-0 shrink animate-in fade-in duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:[s.jsx(Un,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[120px] @[320px]/chat-bottom:opacity-100",children:"Web search"}),s.jsx(_e,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),g==="deep-research"&&b&&s.jsxs("button",{type:"button",onClick:()=>{_(),G("chat_mode_changed",{from_mode:"deep-research",to_mode:"default",source:"pill_dismiss"}),v("default")},title:"Deep research","aria-label":"Deep research",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 group min-w-0 shrink animate-in fade-in duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:[s.jsx(Yn,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[120px] @[320px]/chat-bottom:opacity-100",children:"Deep research"}),s.jsx(_e,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),Y&&te>0&&s.jsx(Ur,{usage:X,totalTokens:te,contextWindow:Y,onOpenContextPanel:t})]}),s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[ce&&s.jsx(gi,{virtualMcp:k,currentBranch:r?.currentBranch??null}),s.jsx(Ai,{}),I.isSupported&&s.jsx(re,{type:"button",onClick:R,disabled:!1,variant:"ghost",size:"icon",className:U("size-8 rounded-lg transition-colors",I.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:I.status==="permission-denied"?"Microphone access denied — click to try again":"Voice input",children:s.jsx(xo,{size:18})}),s.jsx(re,{type:ne?"button":"submit",onClick:J=>{ne&&(J.preventDefault(),J.stopPropagation(),c())},variant:oe||ne?"default":"ghost",size:"icon",disabled:!oe&&!ne,className:U("size-8 rounded-lg transition-all",!oe&&!ne&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:W==="stop"?a?"Stop generating":"Cancel run":"Send message (Enter)",children:ne?s.jsx(go,{size:20}):s.jsx(Mn,{size:20})})]})]})})]})},d),e&&s.jsx(rd,{onClick:()=>{G("connections_banner_clicked",{source:"home_chat_input"}),G("connections_dialog_opened",{source:"home_banner",mode:"add"}),D(!0)}})]})}),s.jsx(Ro,{mode:"browse",open:E,onOpenChange:D,defaultTab:"all"}),s.jsx(Ci,{info:T,onClose:M})]})}const bd={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]};function Us(t){return`deco-credits-empty-dismissed:${t}`}function Su(t){try{return localStorage.getItem(Us(t))==="1"}catch{return!1}}function vd(){const t=O.c(47),{org:e}=de(),n=ot(),{decoKeyId:r}=es(),o=ts(),[a,l]=j.useState(!0),[c,d]=j.useState(""),[u,V]=j.useState(!1),[i,m]=j.useState("usd"),f=i==="brl"?"R$":"$";let h;t[0]!==e.id?(h=()=>{G("credits_empty_state_dismissed",{organization_id:e.id}),l(!1);try{localStorage.setItem(Us(e.id),"1")}catch{}},t[0]=e.id,t[1]=h):h=t[1];const p=h;let x,b;t[2]!==a||t[3]!==e.id?(x=()=>{a&&G("credits_empty_state_shown",{organization_id:e.id})},b=[a,e.id],t[2]=a,t[3]=e.id,t[4]=x,t[5]=b):(x=t[4],b=t[5]),j.useEffect(x,b);let g;t[6]!==i||t[7]!==o?(g=async L=>{const{url:q}=await o.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:L,currency:i});return q},t[6]=i,t[7]=o,t[8]=g):g=t[8];let v;t[9]!==p?(v=L=>{L&&window.open(L,"_blank","noopener,noreferrer"),p()},t[9]=p,t[10]=v):v=t[10];let w;t[11]!==g||t[12]!==v?(w={mutationFn:g,onSuccess:v,onError:Ad},t[11]=g,t[12]=v,t[13]=w):w=t[13];const{mutate:S,isPending:A}=Mt(w),y=parseFloat(c),C=!isNaN(y)&&y>=1;if(!a)return null;let k;t[14]!==p?(k=L=>!L&&p(),t[14]=p,t[15]=k):k=t[15];let _;t[16]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-amber-500/8 to-transparent pointer-events-none rounded-t-lg"}),t[16]=_):_=t[16];let E;t[17]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-amber-100 dark:bg-amber-900/40 border border-amber-200/60 dark:border-amber-800/40 mx-auto",children:s.jsx(Hn,{size:20,className:"text-amber-600 dark:text-amber-400"})}),t[17]=E):E=t[17];let D;t[18]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[_,s.jsxs(it,{className:"relative gap-3",children:[E,s.jsxs("div",{className:"text-center",children:[s.jsx(ct,{className:"text-lg font-semibold",children:"This workspace has no credits"}),s.jsx(Ot,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:"Your free credits were used in another workspace. Add credits to use AI here."})]})]})]}),t[18]=D):D=t[18];let T;t[19]!==i||t[20]!==f||t[21]!==c||t[22]!==y||t[23]!==r||t[24]!==C||t[25]!==A||t[26]!==u||t[27]!==S?(T=r&&s.jsxs("div",{className:"px-6 pb-5",children:[s.jsx("div",{className:"mb-4",children:s.jsxs(Zn,{type:"single",variant:"outline",size:"sm",value:i,onValueChange:L=>{L&&m(L)},children:[s.jsx(et,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(et,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),s.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:bd[i].map(L=>{const{dollars:q,label:K}=L;return s.jsxs("button",{type:"button",disabled:A,onClick:()=>{G("credits_topup_clicked",{amount_cents:q*100,currency:i,tier_label:K,source:"empty_state"}),S(q*100)},className:U("relative flex flex-col items-center gap-1 py-6 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[s.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[f,q]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:K})]},q)})}),u?s.jsxs("div",{className:"flex gap-2 mt-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:f}),s.jsx(Xn,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:L=>d(L.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(re,{className:"h-10",disabled:!C||A,onClick:()=>{G("credits_topup_clicked",{amount_cents:Math.round(y*100),currency:i,tier_label:"custom",source:"empty_state"}),S(Math.round(y*100))},children:A?"Opening...":"Add"})]}):s.jsx("button",{type:"button",className:"w-full mt-2.5 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>V(!0),children:"Enter custom amount"})]}),t[19]=i,t[20]=f,t[21]=c,t[22]=y,t[23]=r,t[24]=C,t[25]=A,t[26]=u,t[27]=S,t[28]=T):T=t[28];let N;t[29]!==p||t[30]!==n||t[31]!==e.slug?(N=()=>{n({to:"/$org/settings/ai-providers",params:{org:e.slug}}),p()},t[29]=p,t[30]=n,t[31]=e.slug,t[32]=N):N=t[32];let M;t[33]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx(Jn,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[33]=M):M=t[33];let I;t[34]!==N?(I=s.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:N,children:["Use your own provider",M]}),t[34]=N,t[35]=I):I=t[35];let P;t[36]!==p?(P=s.jsx(re,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:p,children:"Skip for now"}),t[36]=p,t[37]=P):P=t[37];let R;t[38]!==I||t[39]!==P?(R=s.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[I,P]}),t[38]=I,t[39]=P,t[40]=R):R=t[40];let $;t[41]!==T||t[42]!==R?($=s.jsxs(dt,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:yd,children:[D,T,R]}),t[41]=T,t[42]=R,t[43]=$):$=t[43];let z;return t[44]!==$||t[45]!==k?(z=s.jsx(ut,{open:!0,onOpenChange:k,children:$}),t[44]=$,t[45]=k,t[46]=z):z=t[46],z}function yd(t){return t.preventDefault()}function Ad(t){le.error(`Top-up failed: ${t.message}`)}function jd(t){const e=O.c(6),{balanceDollars:n}=t;let r;e[0]!==n?(r=n.toFixed(2),e[0]=n,e[1]=r):r=e[1];const o=r;let a,l;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=U("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-emerald-50 dark:bg-emerald-950/30","border border-emerald-200/60 dark:border-emerald-800/40","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),l=s.jsx(Hn,{size:13,className:"text-emerald-600 dark:text-emerald-400"}),e[2]=a,e[3]=l):(a=e[2],l=e[3]);let c;return e[4]!==o?(c=s.jsxs("div",{className:a,children:[l,s.jsxs("span",{className:"text-xs font-medium text-emerald-700 dark:text-emerald-300 tabular-nums",children:["$",o," in credits to get started"]})]}),e[4]=o,e[5]=c):c=e[5],c}function wd(){const t=O.c(8),{org:e}=de(),n=ot();let r;t[0]!==n||t[1]!==e.slug?(r=()=>n({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=n,t[1]=e.slug,t[2]=r):r=t[2];let o,a,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=U("inline-flex items-center gap-1.5 px-3 py-1 rounded-full cursor-pointer","bg-amber-50 dark:bg-amber-950/30","border border-amber-200/60 dark:border-amber-800/40","hover:bg-amber-100/60 dark:hover:bg-amber-900/30","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),a=s.jsx(Gn,{size:13,className:"text-amber-600 dark:text-amber-400"}),l=s.jsx("span",{className:"text-xs font-medium text-amber-700 dark:text-amber-300",children:"No credits remaining · Add more"}),t[3]=o,t[4]=a,t[5]=l):(o=t[3],a=t[4],l=t[5]);let c;return t[6]!==r?(c=s.jsxs("button",{type:"button",onClick:r,className:o,children:[a,l]}),t[6]=r,t[7]=c):c=t[7],c}function Sd(t){const e=O.c(11),{className:n}=t;let r;e[0]!==n?(r=U("flex h-full w-full flex-col bg-background",n),e[0]=n,e[1]=r):r=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=o):o=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs("div",{className:"flex items-center gap-3",children:[o,s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),s.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),e[3]=a):a=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:s.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[a,s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),s.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),e[4]=l):l=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:s.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[s.jsx(He,{align:"right",width:"w-3/4"}),s.jsx(He,{align:"left",width:"w-full",lines:3}),s.jsx(He,{align:"right",width:"w-2/3"}),s.jsx(He,{align:"left",width:"w-5/6",lines:2})]})}),e[5]=c):c=e[5];let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:s.jsx("div",{className:"relative flex-1",children:s.jsxs("div",{className:"space-y-2 p-2",children:[s.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),s.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),e[6]=d):d=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("div",{className:"flex items-center gap-1",children:s.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),e[7]=u):u=e[7];let V;e[8]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx("div",{className:"px-4 py-4",children:s.jsx("div",{className:"mx-auto w-full max-w-2xl",children:s.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl bg-background card-shadow",children:[d,s.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[u,s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),s.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})}),e[8]=V):V=e[8];let i;return e[9]!==r?(i=s.jsxs("div",{className:r,children:[l,c,V]}),e[9]=r,e[10]=i):i=e[10],i}function He(t){const e=O.c(22),{align:n,width:r,lines:o}=t,a=r===void 0?"w-full":r,l=o===void 0?1:o,c=n==="right"?"flex-row-reverse":"flex-row";let d;e[0]!==c?(d=U("flex w-full gap-4 px-4 py-2",c),e[0]=c,e[1]=d):d=e[1];const u=n==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let V;e[2]!==u?(V=U("flex min-w-0 flex-col gap-2",u),e[2]=u,e[3]=V):V=e[3];let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=i):i=e[4];const m=n==="right"?"bg-muted":"bg-transparent border border-border/40";let f;e[5]!==m||e[6]!==a?(f=U("min-w-0 rounded-2xl p-4",m,a),e[5]=m,e[6]=a,e[7]=f):f=e[7];let h;e[8]!==l?(h=Array.from({length:l}),e[8]=l,e[9]=h):h=e[9];let p;e[10]!==l||e[11]!==h?(p=s.jsx("div",{className:"space-y-2",children:h.map((v,w)=>s.jsx("div",{className:U("h-3 rounded bg-muted-foreground/20 animate-pulse",w===l-1?"w-3/4":"w-full"),style:{animationDelay:`${w*.1}s`}},w))}),e[10]=l,e[11]=h,e[12]=p):p=e[12];let x;e[13]!==p||e[14]!==f?(x=s.jsx("div",{className:f,children:p}),e[13]=p,e[14]=f,e[15]=x):x=e[15];let b;e[16]!==x||e[17]!==V?(b=s.jsxs("div",{className:V,children:[i,x]}),e[16]=x,e[17]=V,e[18]=b):b=e[18];let g;return e[19]!==b||e[20]!==d?(g=s.jsx("div",{className:d,children:b}),e[19]=b,e[20]=d,e[21]=g):g=e[21],g}function Cd(t){const e=O.c(7),{scrollRef:n,sentinelRef:r,hasMoreOlder:o,isFetchingOlder:a,fetchOlderMessages:l}=t;let c,d;e[0]!==l||e[1]!==o||e[2]!==a||e[3]!==n||e[4]!==r?(c=()=>{const u=r.current,V=n.current;if(!u||!V||!o)return;const i=new IntersectionObserver(async m=>{if(!m[0]?.isIntersecting||a||!o)return;const h=V.scrollHeight,p=V.scrollTop;await l(),requestAnimationFrame(()=>{const x=V.scrollHeight;V.scrollTop=p+(x-h)})},{root:V,rootMargin:"200px 0px 0px 0px"});return i.observe(u),()=>i.disconnect()},d=[n,r,o,a,l],e[0]=l,e[1]=o,e[2]=a,e[3]=n,e[4]=r,e[5]=c,e[6]=d):(c=e[5],d=e[6]),j.useEffect(c,d)}function Nd(t){const e=O.c(5),{className:n,children:r}=t;let o;e[0]!==n?(o=U("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",n),e[0]=n,e[1]=o):o=e[1];let a;return e[2]!==r||e[3]!==o?(a=s.jsx("div",{className:o,children:r}),e[2]=r,e[3]=o,e[4]=a):a=e[4],a}function kd(t){const e=O.c(5),{children:n,className:r}=t;let o;e[0]!==r?(o=U("flex-1 min-h-0 overflow-y-auto isolate",r),e[0]=r,e[1]=o):o=e[1];let a;return e[2]!==n||e[3]!==o?(a=s.jsx("div",{className:o,children:n}),e[2]=n,e[3]=o,e[4]=a):a=e[4],a}function _d(t){const e=O.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:n}),e[0]=n,e[1]=r):r=e[1],r}function Id(){const{messages:t,status:e,hasMoreOlder:n,isFetchingOlder:r,fetchOlderMessages:o}=Pe(),{taskId:a}=Fn(),l=$n(a??""),c=Cr(l),d=c.size===0?t:t.filter(b=>!c.has(b.id)),u=qr(d),V=u.at(-1),m=ja()*ua+16,f=j.useRef(null),h=j.useRef(null);Cd({scrollRef:f,sentinelRef:h,hasMoreOlder:n,isFetchingOlder:r,fetchOlderMessages:o});const p=Kr({initial:!1}),x=b=>{f.current=b,p.scrollRef(b)};return s.jsx(Qr,{messages:t,children:s.jsxs("div",{className:"relative h-full w-full min-w-0",children:[s.jsx("div",{ref:x,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full [container-type:size]",style:{paddingBottom:m},children:s.jsxs("div",{ref:p.contentRef,className:"overflow-x-clip",children:[s.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[s.jsx("div",{ref:h,"aria-hidden":!0,className:"h-px"}),r&&s.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:"Loading older messages…"}),u.slice(0,-1).map((b,g)=>s.jsx(Zt,{pair:b,isLastPair:!1,status:g===u.length-1?e:void 0},`pair-${b.user?.id??b.assistant?.id}`))]}),V&&s.jsx("div",{className:"min-h-[100cqh] min-w-0 max-w-2xl mx-auto w-full",children:s.jsx(Zt,{pair:V,isLastPair:!0,status:e},`pair-${V.user?.id??V.assistant?.id}`)})]})}),!p.isAtBottom&&s.jsx(re,{type:"button",variant:"outline",size:"icon-sm","aria-label":"Jump to latest",className:"absolute left-1/2 z-50 -translate-x-1/2 rounded-full shadow-md animate-in fade-in duration-200 dark:bg-background dark:hover:bg-accent",style:{bottom:m+8},onClick:()=>{p.scrollToBottom()},children:s.jsx(br,{size:14})})]})})}function Ed(t){const e=O.c(5),{children:n,className:r}=t;let o;e[0]!==r?(o=U("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",r),e[0]=r,e[1]=o):o=e[1];let a;return e[2]!==n||e[3]!==o?(a=s.jsx("div",{className:o,children:n}),e[2]=n,e[3]=o,e[4]=a):a=e[4],a}const Cu=Object.assign(Nd,{Main:kd,Messages:Id,EmptyState:_d,Footer:Ed,Input:gd,Provider:Sr,ActiveTaskProvider:wr,Skeleton:Sd,IceBreakers:da,NoAiProviderEmptyState:Fo,CreditsEmptyState:vd,CreditsEyebrow:jd,NoCreditsEyebrow:wd,CreditsExhaustedBanner:js});export{Cu as C,Yc as T,gi as a,Hc as b,wu as c,ri as g,_i as i,_l as s,Il as u,Su as w};
|