decocms 3.34.3 → 3.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-B5QG7wg7.js → AlertCircle-DfCrgvbm.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-Ce95HJs8.js → ArrowUpRight-BZPL9Pks.js} +1 -1
- package/dist/client/assets/{Check-CV74Rqqs.js → Check-CQSOJf1l.js} +1 -1
- package/dist/client/assets/{CheckCircle-BiLWpS6e.js → CheckCircle-oP-mqP5v.js} +1 -1
- package/dist/client/assets/{ChevronDown-XKMoQgX6.js → ChevronDown-DaBswAjS.js} +1 -1
- package/dist/client/assets/{ChevronLeft-rORK5a-Y.js → ChevronLeft-BGAK4Zdv.js} +1 -1
- package/dist/client/assets/{ChevronRight-Betyx6_9.js → ChevronRight-Bwn2E0SF.js} +1 -1
- package/dist/client/assets/{ChevronUp-CGfhqWp1.js → ChevronUp-BiGhh8Mf.js} +1 -1
- package/dist/client/assets/{Container-Byi81M5N.js → Container-C7dE1uq6.js} +1 -1
- package/dist/client/assets/{DotsVertical-CuchmOf0.js → DotsVertical-Ddm9sNM7.js} +1 -1
- package/dist/client/assets/{Eye-RSaOlPZv.js → Eye-CJqEY9Bp.js} +1 -1
- package/dist/client/assets/{FilterLines-DuHSJmFt.js → FilterLines-B_l1Wkux.js} +1 -1
- package/dist/client/assets/{Globe01-Ds0ZgQYM.js → Globe01-CZ8FVUUU.js} +1 -1
- package/dist/client/assets/{HardDrive-C0JdZ_DO.js → HardDrive-CsWNNss4.js} +1 -1
- package/dist/client/assets/{Key01-CStdo5WX.js → Key01-CuoD3w0e.js} +1 -1
- package/dist/client/assets/{LayoutLeft-BdQI12mG.js → LayoutLeft-DkBHny3R.js} +1 -1
- package/dist/client/assets/{LinkExternal01-D7swM7zC.js → LinkExternal01-j7-s92dF.js} +1 -1
- package/dist/client/assets/{Monitor01-CaSeRueL.js → Monitor01-BKcboobL.js} +1 -1
- package/dist/client/assets/{Palette-gIYgJ3Wn.js → Palette-DX6Dwn47.js} +1 -1
- package/dist/client/assets/{Play-1bLCgUWF.js → Play-DF7j7sPZ.js} +1 -1
- package/dist/client/assets/{Plus-wat9tYeJ.js → Plus-DW0XqVol.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-D-1V89vv.js → RefreshCcw01-Csm4yVOO.js} +1 -1
- package/dist/client/assets/{SearchMd-BoptgjAM.js → SearchMd-DZ6aIwIg.js} +1 -1
- package/dist/client/assets/{Settings02-8XjUg3gM.js → Settings02-D5me1w67.js} +1 -1
- package/dist/client/assets/{Shield01-CjOnx-7R.js → Shield01-kWYSVjnp.js} +1 -1
- package/dist/client/assets/{Star01-Dsaeuwpa.js → Star01-Co_EFaK6.js} +1 -1
- package/dist/client/assets/{Stars01-DDkk5qux.js → Stars01-M9lSQCUv.js} +1 -1
- package/dist/client/assets/{Stars02-ChPYLNIJ.js → Stars02-C-4orbjJ.js} +1 -1
- package/dist/client/assets/{Sun-BUoG5bs4.js → Sun-D3s8g6wD.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-CkdIfbJ1.js → SwitchHorizontal01-CRsSfTt7.js} +1 -1
- package/dist/client/assets/{Tool01-Be5AVc1v.js → Tool01-CmnBi-ns.js} +1 -1
- package/dist/client/assets/{Trash01-YuwiLEVo.js → Trash01-DdLe4vdc.js} +1 -1
- package/dist/client/assets/{Upload01-aGUy8jUM.js → Upload01-B_SjMibr.js} +1 -1
- package/dist/client/assets/{User01-CUMpCZVS.js → User01-DXJ1fbKo.js} +1 -1
- package/dist/client/assets/{Users01-BGw9h7dE.js → Users01-j12rIRFD.js} +1 -1
- package/dist/client/assets/{Users03-Cf3_qQGc.js → Users03-CIMcoZEN.js} +1 -1
- package/dist/client/assets/{X-D1kqmcok.js → X-BNvE6MEM.js} +1 -1
- package/dist/client/assets/{XCircle-Ds6l9Vuw.js → XCircle-DxeB44sm.js} +1 -1
- package/dist/client/assets/{XClose-CwNjmDWz.js → XClose-SVLNQiVU.js} +1 -1
- package/dist/client/assets/{Zap-j2XVmCfk.js → Zap-Bgg4Oev9.js} +1 -1
- package/dist/client/assets/{ZapSquare-DMmAEMvR.js → ZapSquare-CBHt5u2b.js} +1 -1
- package/dist/client/assets/{ZoomOut-C6xbqN0H.js → ZoomOut-CiW88kaG.js} +1 -1
- package/dist/client/assets/{access-gate-DfmEpXgP.js → access-gate-D-y2d9t8.js} +1 -1
- package/dist/client/assets/{accordion-B4RSATFh.js → accordion-zpPrX7CV.js} +1 -1
- package/dist/client/assets/add-section-modal-DAWzDKwe.js +1 -0
- package/dist/client/assets/{agent-capabilities-UHQXEFqt.js → agent-capabilities-CPytCHGh.js} +2 -2
- package/dist/client/assets/{agent-icon-BAU0Nn5Q.js → agent-icon-CR2BOYIt.js} +1 -1
- package/dist/client/assets/{agent-icons-CMqOumOa.js → agent-icons-DnVG8vkz.js} +2 -2
- package/dist/client/assets/agents-list-DwVMk1n-.js +1 -0
- package/dist/client/assets/ai-providers-mE8ABjTw.js +1 -0
- package/dist/client/assets/{alert-CeTPCPF-.js → alert-B8OrVPLn.js} +1 -1
- package/dist/client/assets/{alert-dialog-nDI1xJhR.js → alert-dialog-BN8wMw1R.js} +1 -1
- package/dist/client/assets/app-editor-Bbf1K7Id.js +1 -0
- package/dist/client/assets/{auth-catchall-BHc3WJmM.js → auth-catchall-DHwYEi7u.js} +1 -1
- package/dist/client/assets/auth-ottC0wHr.js +1 -0
- package/dist/client/assets/{auth-split-layout-By3wB5zH.js → auth-split-layout-CxpQ1x33.js} +1 -1
- package/dist/client/assets/{automation-list-row-C-im7Cyh.js → automation-list-row-BEJwS8Vh.js} +1 -1
- package/dist/client/assets/{automation-runs-BYZ99hni.js → automation-runs-DhzB2pEa.js} +1 -1
- package/dist/client/assets/automations-D61pNajM.js +1 -0
- package/dist/client/assets/{avatar-BZq-o3M_.js → avatar-CdZJe3C8.js} +1 -1
- package/dist/client/assets/{badge-DBQKr8ze.js → badge-C7EEpKuN.js} +1 -1
- package/dist/client/assets/brand-context-CNpbI5Wl.js +1 -0
- package/dist/client/assets/buckets-CdV7wLzR.js +1 -0
- package/dist/client/assets/{calendar-D0ZGZM9k.js → calendar-DFbEMX6r.js} +1 -1
- package/dist/client/assets/{capability-load-error-BqquNR5_.js → capability-load-error-Cl1kq3iF.js} +1 -1
- package/dist/client/assets/{card-_9LUJQRQ.js → card-CDrd0DTi.js} +1 -1
- package/dist/client/assets/{chat-context-BGBybCr0.js → chat-context-DG8MYWh9.js} +6 -6
- package/dist/client/assets/{checkbox-BoVEsaTu.js → checkbox-BGw-FQHn.js} +1 -1
- package/dist/client/assets/{cli-auth-success-BYlIpapz.js → cli-auth-success-DtIVHpOK.js} +1 -1
- package/dist/client/assets/collection-detail-FqeWA-st.js +1 -0
- package/dist/client/assets/{collection-display-button-C331HXzj.js → collection-display-button-C7zc09ko.js} +1 -1
- package/dist/client/assets/{collection-search-D2zd2w_6.js → collection-search-p8x92ubf.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-D_JocMSh.js → collection-table-wrapper-Cnh8Wpna.js} +1 -1
- package/dist/client/assets/{collection-tabs-Et7HpQI-.js → collection-tabs-CkYCGOii.js} +1 -1
- package/dist/client/assets/{collections-BEkDC2fV.js → collections-DyJP_FmO.js} +1 -1
- package/dist/client/assets/{command-DjRT1inC.js → command-BWTUFK3g.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-C7P5AZy7.js → connect-desktop-dialog-BozHMyNF.js} +1 -1
- package/dist/client/assets/{connection-card-C6z8X3mv.js → connection-card-D4ICX_rU.js} +1 -1
- package/dist/client/assets/{connection-detail-DWcaSH3b.js → connection-detail-ucWXxoPl.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-CJ-3PHD0.js → connection-form-helpers-8awFltv-.js} +1 -1
- package/dist/client/assets/{connections-plRLUbCm.js → connections-iQ8Bv6Z6.js} +1 -1
- package/dist/client/assets/decopilot-sse-pool-DR3EOQSz.js +1 -0
- package/dist/client/assets/{dialog-DilC5A4p.js → dialog-DDaCuEXe.js} +1 -1
- package/dist/client/assets/domain-settings-DTybx0PS.js +1 -0
- package/dist/client/assets/{drawer-PqoucHj8.js → drawer-iJuY2KNl.js} +1 -1
- package/dist/client/assets/{dropdown-menu-CCeLALQe.js → dropdown-menu-Bbmpm5z3.js} +1 -1
- package/dist/client/assets/dynamic-plugin-layout-fiDb4X6H.js +1 -0
- package/dist/client/assets/{empty-state-cuRG9xrS.js → empty-state-Cdm1CYyS.js} +1 -1
- package/dist/client/assets/{empty-state-C0m3QPuD.js → empty-state-D-Pxp7j0.js} +1 -1
- package/dist/client/assets/{extract-connection-data-zlBEIx4x.js → extract-connection-data-SrWlxhIa.js} +1 -1
- package/dist/client/assets/features-Cwh1Qv1Z.js +1 -0
- package/dist/client/assets/file-explorer--zdN4Zrz.js +2 -0
- package/dist/client/assets/{file-type-icon-CBlaUM9a.js → file-type-icon-B4-le7-M.js} +1 -1
- package/dist/client/assets/{files-De7CB1eQ.js → files-DFiPv_6i.js} +1 -1
- package/dist/client/assets/{form-DcfAV72q.js → form-3ozPMiDy.js} +1 -1
- package/dist/client/assets/general-BBvPcHvJ.js +1 -0
- package/dist/client/assets/generate-id-B9GOZfm-.js +1 -0
- package/dist/client/assets/{github-repo-picker-CIreZixy.js → github-repo-picker-CLz-6KHT.js} +2 -2
- package/dist/client/assets/{header-tab-button-CNFRl9p4.js → header-tab-button-KOmUg_0n.js} +3 -3
- package/dist/client/assets/{hover-card-Bizl54yc.js → hover-card-BdET2LVl.js} +1 -1
- package/dist/client/assets/{image-field-Btc7vZ_B.js → image-field-jDtV8hKH.js} +1 -1
- package/dist/client/assets/{index-CoxAwU4M.js → index-7nVwqMEY.js} +1 -1
- package/dist/client/assets/{index-CeH9NvWc.js → index-B1J4YXFH.js} +13 -13
- package/dist/client/assets/{index-DOV0yCSN.js → index-B8Zn3P3M.js} +1 -1
- package/dist/client/assets/{index-B6U1MHPz.js → index-BRNlnl29.js} +1 -1
- package/dist/client/assets/{index-Dr3ZvAAC.js → index-Bg-8akWr.js} +2 -2
- package/dist/client/assets/{index-WAvrfxHO.js → index-BnzjjyUc.js} +1 -1
- package/dist/client/assets/index-ByDZ7Ijt.js +1 -0
- package/dist/client/assets/{index-C_YL5c1Q.js → index-C6TcjGKf.js} +1 -1
- package/dist/client/assets/{index-KCjld4_L.js → index-CKiY6q7v.js} +3 -3
- package/dist/client/assets/{index-NuAPKwye.js → index-CMT1KgDi.js} +1 -1
- package/dist/client/assets/{index-DxLTuX83.js → index-CR2BsklH.js} +34 -34
- package/dist/client/assets/{index-DM719JZt.js → index-DB-iXjqO.js} +1 -1
- package/dist/client/assets/{index-EffHR3rD.js → index-jguHAjxa.js} +1 -1
- package/dist/client/assets/{index-VW961Pbw.js → index-lVjgiIsy.js} +1 -1
- package/dist/client/assets/{index-redirect-BoGD6xOD.js → index-redirect-0OmXb9MX.js} +1 -1
- package/dist/client/assets/index-sGHofokC.js +1 -0
- package/dist/client/assets/{input-3FcnQKag.js → input-BXKnvLhL.js} +1 -1
- package/dist/client/assets/{integration-icon-C2c_G7v_.js → integration-icon-Bw8f7ZPI.js} +1 -1
- package/dist/client/assets/{label-Cv-qQXYd.js → label-CjPScbhz.js} +1 -1
- package/dist/client/assets/{layout-2bgJD0NS.js → layout-Di1CCr2Q.js} +1 -1
- package/dist/client/assets/{login-DDLq_BK-.js → login-5GQvHYAE.js} +1 -1
- package/dist/client/assets/mcp-oauth-BRWfHEzR.js +1 -0
- package/dist/client/assets/{members-BlttLAcq.js → members-QwMU-3Ki.js} +2 -2
- package/dist/client/assets/{monaco-editor-BenQSBIk.js → monaco-editor-Cg1EQRnF.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-BcGGFk75.js → monitoring-stats-row-CNaJGhPf.js} +1 -1
- package/dist/client/assets/oauth-callback-D9zCuUON.js +1 -0
- package/dist/client/assets/{oauth-callback-ai-provider-BF79mlu4.js → oauth-callback-ai-provider-hDwaAL5R.js} +1 -1
- package/dist/client/assets/{onboarding-Dd72TDGl.js → onboarding-DlrXj6YO.js} +1 -1
- package/dist/client/assets/{org-install-Bv_VZKPn.js → org-install-Bu5JllIi.js} +1 -1
- package/dist/client/assets/{org-layout-CTAm8_WK.js → org-layout-BbJy_b93.js} +1 -1
- package/dist/client/assets/org-plugin-layout-B9FRU2Is.js +1 -0
- package/dist/client/assets/{page-seo-form-B0n1eGFy.js → page-seo-form-_9ZP3QBG.js} +1 -1
- package/dist/client/assets/page-seo-sheet-E9iDhskP.js +1 -0
- package/dist/client/assets/{pair-DU07s2Yy.js → pair-gQKhMMDb.js} +6 -6
- package/dist/client/assets/{plugin-empty-state-CVzEQ5Cm.js → plugin-empty-state-BZknPdIb.js} +1 -1
- package/dist/client/assets/{plugin-header-B7b_y-0E.js → plugin-header-DkjZWp_i.js} +1 -1
- package/dist/client/assets/{plugin-layout-Bwwo9Dmw.js → plugin-layout-BdqEclCD.js} +1 -1
- package/dist/client/assets/{popover-DpnBmU5u.js → popover-BTmtXv14.js} +1 -1
- package/dist/client/assets/{post-editor-DOuE35_z.js → post-editor-CH5fTOhb.js} +2 -2
- package/dist/client/assets/{primitives-DCRAmGAV.js → primitives-CKu1vpZw.js} +1 -1
- package/dist/client/assets/profile-Dko06RsO.js +1 -0
- package/dist/client/assets/project-app-view-Cd-36Jgd.js +1 -0
- package/dist/client/assets/record-editor-DT2U_m_t.js +1 -0
- package/dist/client/assets/{registry-layout-BMV-48W2.js → registry-layout-C-Rhe1GR.js} +4 -4
- package/dist/client/assets/registry-lt8SPDA4.js +2 -0
- package/dist/client/assets/{require-capability-BolUdzxs.js → require-capability-CvIZOTUa.js} +1 -1
- package/dist/client/assets/{required-auth-layout-Ce12SDHB.js → required-auth-layout-B00155Vc.js} +1 -1
- package/dist/client/assets/{reset-password-BUAFUG-w.js → reset-password-NK-zyZWv.js} +1 -1
- package/dist/client/assets/{resizable-CDtszfkc.js → resizable-DmhfTA5q.js} +1 -1
- package/dist/client/assets/roles-BUjXqBF2.js +1 -0
- package/dist/client/assets/save-referenced-block-CNwoR_kv.js +1 -0
- package/dist/client/assets/{save-status-CrbNr3Yt.js → save-status-DbsdUBrs.js} +1 -1
- package/dist/client/assets/{schema-form-DF5JNe2x.js → schema-form-DzfWzqPW.js} +1 -1
- package/dist/client/assets/{scroll-area-DtVZtiV9.js → scroll-area-CLZP3_5w.js} +1 -1
- package/dist/client/assets/{search-input-B5QgW7DO.js → search-input-MJliZ4jI.js} +1 -1
- package/dist/client/assets/{secrets-vyIYAehl.js → secrets-D4QL_fAR.js} +1 -1
- package/dist/client/assets/{sections-editor-ChsSqsQp.js → sections-editor-FDdDi8FD.js} +2 -2
- package/dist/client/assets/{select-C0Tyz9qJ.js → select-BFSfYXlX.js} +1 -1
- package/dist/client/assets/{select-model-qL2AwJh1.js → select-model-BbRpf076.js} +1 -1
- package/dist/client/assets/seo-editor-DwVV4QI0.js +1 -0
- package/dist/client/assets/settings-layout-B9A_ZqDS.js +1 -0
- package/dist/client/assets/{settings-section-BxOSnd7f.js → settings-section-C-Pwj2mI.js} +1 -1
- package/dist/client/assets/{sheet-BZaR5cN8.js → sheet-tO1j8MLX.js} +1 -1
- package/dist/client/assets/{shell-controls-B_EeVM1l.js → shell-controls-Bym8A09n.js} +1 -1
- package/dist/client/assets/{shell-layout-DSw-nDR6.js → shell-layout-CVwlRsIR.js} +1 -1
- package/dist/client/assets/shell-route-loading-I4t8prq1.js +1 -0
- package/dist/client/assets/{sidebar-DILd2AwV.js → sidebar-B1ZxuBN_.js} +1 -1
- package/dist/client/assets/{skeleton-Dvzf2GQP.js → skeleton-DJEW9jDp.js} +1 -1
- package/dist/client/assets/{sortable.esm-DhgyheK_.js → sortable.esm-LeLAN_LP.js} +2 -2
- package/dist/client/assets/{spinner-CIUpakvk.js → spinner-CDjEeRHa.js} +1 -1
- package/dist/client/assets/{sso-BYueQDf4.js → sso-DCBE9NzY.js} +1 -1
- package/dist/client/assets/store-BZj3mNA3.js +1 -0
- package/dist/client/assets/store-registry-Bh2zZ5xN.js +2 -0
- package/dist/client/assets/{studio-tools-qhNYzbg-.js → studio-tools-BgmLlqq0.js} +1 -1
- package/dist/client/assets/{switch-B2R8Oovd.js → switch-fOoBffiM.js} +1 -1
- package/dist/client/assets/{tab-id-BEXPtrYn.js → tab-id-DF4EtVz0.js} +1 -1
- package/dist/client/assets/{table-BHblf7Co.js → table-B7zPFKH4.js} +1 -1
- package/dist/client/assets/{tabs-BEFEoOMo.js → tabs-DwCivvg2.js} +1 -1
- package/dist/client/assets/{task-status-17hQtONR.js → task-status-Do0N2yEZ.js} +1 -1
- package/dist/client/assets/{textarea-CZOXZ6_T.js → textarea-C0PLb8A1.js} +1 -1
- package/dist/client/assets/{toggle-group-DzrJraBm.js → toggle-group-Bn94xmD3.js} +1 -1
- package/dist/client/assets/{toolbar-A-Rw_MZF.js → toolbar-D1E6jsA-.js} +1 -1
- package/dist/client/assets/tools-list-BXq3S6hl.js +1 -0
- package/dist/client/assets/{tooltip-D1D9JHhD.js → tooltip-CLG87qyy.js} +1 -1
- package/dist/client/assets/{types-DsYUq_UX.js → types-CBP_wAn8.js} +3 -3
- package/dist/client/assets/{use-ai-providers-CIvGzfXg.js → use-ai-providers-B-vDc98I.js} +1 -1
- package/dist/client/assets/{use-automations-CP8543px.js → use-automations-BPoyZBdX.js} +1 -1
- package/dist/client/assets/{use-capability-DDDjfOOE.js → use-capability-B_PDwTk3.js} +1 -1
- package/dist/client/assets/{use-clock-tick-DufrTL6j.js → use-clock-tick-dBvSZsql.js} +1 -1
- package/dist/client/assets/use-collections-C_yZKgDo.js +1 -0
- package/dist/client/assets/{use-connection-DIX015NP.js → use-connection-BGirJeWX.js} +1 -1
- package/dist/client/assets/{use-copy-B_iKACkn.js → use-copy-vy8ApQ-I.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BiFjwqV_.js → use-create-virtual-mcp-BjqcuHoP.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-CsGRGmM0.js → use-debounced-autosave-D3nmvc0o.js} +1 -1
- package/dist/client/assets/use-delete-connection-hy9eBOJA.js +1 -0
- package/dist/client/assets/{use-file-configs-CzVPvQ04.js → use-file-configs-Rh_uaFMZ.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-BmPWzVgW.js → use-infinite-scroll-DzA4PJqc.js} +1 -1
- package/dist/client/assets/{use-list-state-BxWtfKJF.js → use-list-state-BKFx4oGM.js} +1 -1
- package/dist/client/assets/use-mcp-client-WRUNhji3.js +10 -0
- package/dist/client/assets/{use-mcp-prompts-B8H3Sb8-.js → use-mcp-prompts-D8_D9pv7.js} +1 -1
- package/dist/client/assets/use-mcp-tools-C9n7HK44.js +1 -0
- package/dist/client/assets/{use-members-D33brPm2.js → use-members-CRFHIxPI.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-BpOmxFKV.js → use-navigate-to-agent-S7VbkvxA.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-B3bhhuY4.js → use-org-auth-client-CSi9369v.js} +1 -1
- package/dist/client/assets/{use-org-sso-qcLKm5I7.js → use-org-sso-BpQsq_SJ.js} +1 -1
- package/dist/client/assets/{use-organization-roles-DV7FcWv5.js → use-organization-roles-D_SSRrwH.js} +1 -1
- package/dist/client/assets/{use-organization-settings-mMiPWte8.js → use-organization-settings-CGN7GbnQ.js} +1 -1
- package/dist/client/assets/use-registry-connections-UhNQSvBW.js +1 -0
- package/dist/client/assets/{use-secrets-CMyn_SAh.js → use-secrets-pnJMJ9Be.js} +1 -1
- package/dist/client/assets/use-status-sounds-Dz4RsXmq.js +1 -0
- package/dist/client/assets/{use-view-mode-CQiQ9BoV.js → use-view-mode-Gu7r5Cby.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-BHCygv1Q.js → use-virtual-mcp-CYog3nxZ.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-BSkLeLWA.js +1 -0
- package/dist/client/assets/{useRouterState-CPOZ6kYF.js → useRouterState-D4-J_KM9.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-VzK0S1M9.js +1 -0
- package/dist/client/assets/{user-BHiBl7KY.js → user-BiR0-i8i.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-C4AuqTiF.js → view-mode-toggle-YSQkkoIu.js} +1 -1
- package/dist/client/assets/{watch-sse-pool-BEICArze.js → watch-sse-pool-D-9b4N8J.js} +1 -1
- package/dist/client/assets/workflow-D9qNodRH.js +1 -0
- package/dist/client/assets/workflow-detail-CmQwmqlu.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +458 -458
- package/dist/server/migrate.js +95 -95
- package/dist/server/server.js +335 -335
- package/package.json +1 -1
- package/dist/client/assets/add-section-modal-DGPmEqVH.js +0 -1
- package/dist/client/assets/agents-list-f6dvlBDo.js +0 -1
- package/dist/client/assets/ai-providers-CIni-0nv.js +0 -1
- package/dist/client/assets/app-editor-Dd3wbzna.js +0 -1
- package/dist/client/assets/automations-BKZFJOPp.js +0 -1
- package/dist/client/assets/brand-context-CpadUeMB.js +0 -1
- package/dist/client/assets/buckets-BWDxlk4n.js +0 -1
- package/dist/client/assets/collection-detail-C5awVm7D.js +0 -1
- package/dist/client/assets/decopilot-sse-pool-Cu7Nizzp.js +0 -1
- package/dist/client/assets/domain-settings-BUYR_el1.js +0 -1
- package/dist/client/assets/dynamic-plugin-layout-b5WMDmEL.js +0 -1
- package/dist/client/assets/features-1PDTV_2R.js +0 -1
- package/dist/client/assets/file-explorer-CBKgCWMC.js +0 -2
- package/dist/client/assets/general-DCkCuFZl.js +0 -1
- package/dist/client/assets/generate-id-N17blLwS.js +0 -1
- package/dist/client/assets/index-4vxs0ZGV.js +0 -1
- package/dist/client/assets/index-CQQJ5UaG.js +0 -1
- package/dist/client/assets/oauth-callback-CdBo7Kde.js +0 -1
- package/dist/client/assets/org-plugin-layout-KpgdAlfM.js +0 -1
- package/dist/client/assets/page-seo-sheet-Bo7n8Dbw.js +0 -1
- package/dist/client/assets/profile-DvJYJ7rR.js +0 -1
- package/dist/client/assets/project-app-view-DQhfhWs_.js +0 -1
- package/dist/client/assets/record-editor-BYnzNxDd.js +0 -1
- package/dist/client/assets/registry-469wEK7T.js +0 -2
- package/dist/client/assets/roles-ChM1uml4.js +0 -1
- package/dist/client/assets/save-referenced-block-p44kfiVf.js +0 -1
- package/dist/client/assets/seo-editor-BdvXc5GQ.js +0 -1
- package/dist/client/assets/settings-layout-Cd7DSf19.js +0 -1
- package/dist/client/assets/shell-route-loading-DGAtAFWm.js +0 -1
- package/dist/client/assets/store-DRNbauSU.js +0 -1
- package/dist/client/assets/store-registry-Cj3hC5ms.js +0 -2
- package/dist/client/assets/tools-list-CmTd7_Mb.js +0 -1
- package/dist/client/assets/use-collections-CUoYyXrz.js +0 -1
- package/dist/client/assets/use-delete-connection-C2rrW8fa.js +0 -1
- package/dist/client/assets/use-mcp-client-B7YSHa6V.js +0 -10
- package/dist/client/assets/use-mcp-tools-Bb7rwoEF.js +0 -1
- package/dist/client/assets/use-registry-connections-BIDj-EVl.js +0 -1
- package/dist/client/assets/use-status-sounds-FktjeAga.js +0 -1
- package/dist/client/assets/useInfiniteQuery-Du3dTl6W.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BHnbmrEl.js +0 -1
- package/dist/client/assets/workflow-CqlkVMXi.js +0 -1
- package/dist/client/assets/workflow-detail-CqR4Jdyr.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as $,r as H,T as rt,I as Gt,H as Kt,j as n,B as Se,W as Ye,c as V,t as Xt,q as he,G as Jt,a as Qt,K as me,o as Fe,n as He,f as je,E as Yt,C as Zt,bB as We}from"./index-DxLTuX83.js";import{$ as es,G as ts,B as ss,ac as ns,O as ls,N as os,M as as,a8 as it,ad as rs,ae as is,A as ct,af as ie,ag as cs,ah as us,ai as ds,b as fs}from"./agent-icon-BAU0Nn5Q.js";import{t as Ue}from"./Stars01-DDkk5qux.js";import{a as ut,t as ms,b as Ce,d as ps}from"./XCircle-Ds6l9Vuw.js";import{i as qe}from"./Check-CV74Rqqs.js";import{i as Ze}from"./ChevronRight-Betyx6_9.js";import{a as dt,s as xs}from"./Eye-RSaOlPZv.js";import{a as de,u as ft,t as mt,c as et}from"./use-clock-tick-DufrTL6j.js";import{N as pt,R as xt,e as gt,C as gs,f as hs,g as bs,u as ys,i as js,d as vs}from"./scroll-area-DtVZtiV9.js";import{u as ht}from"./use-copy-B_iKACkn.js";import{T as pe,a as xe,b as ge}from"./tooltip-D1D9JHhD.js";import{M as bt,I as yt,F as Ns}from"./file-type-icon-CBlaUM9a.js";import{c as Ss}from"./content-blocks-o63cs2vh.js";import{g as jt,M as ks}from"./types-DsYUq_UX.js";import{g as _e,i as _s,d as Ve,a as ws}from"./chat-context-BGBybCr0.js";import{l as Ts,f as Cs,m as $s,n as Is}from"./tab-id-BEXPtrYn.js";import{u as Ms}from"./studio-tools-qhNYzbg-.js";import{c as As,u as vt,b as Ls}from"./use-mcp-client-B7YSHa6V.js";import{i as Nt}from"./AlertCircle-B5QG7wg7.js";import{s as Ie,t as St}from"./Star01-Dsaeuwpa.js";import{s as Rs}from"./XClose-CwNjmDWz.js";import{n as kt}from"./ZapSquare-DMmAEMvR.js";import{n as _t,i as Es}from"./Globe01-Ds0ZgQYM.js";import{b as zs,i as Ps,a as Ee}from"./Tool01-Be5AVc1v.js";import{a as tt,i as Fs}from"./ZoomOut-C6xbqN0H.js";import{i as Ne}from"./Monitor01-CaSeRueL.js";import{i as Ds}from"./SearchMd-BoptgjAM.js";import{i as Os}from"./Upload01-aGUy8jUM.js";import{u as Bs,c as Hs}from"./shell-layout-DSw-nDR6.js";import{n as wt}from"./LinkExternal01-D7swM7zC.js";import{I as Ae}from"./integration-icon-C2c_G7v_.js";import{u as Ws}from"./use-virtual-mcp-BHCygv1Q.js";import{a as Tt}from"./Users03-Cf3_qQGc.js";import{a as ce}from"./Palette-gIYgJ3Wn.js";import{k as Ct}from"./use-navigate-to-agent-BpOmxFKV.js";import{a as Us}from"./use-connection-DIX015NP.js";import{s as qs}from"./Stars02-ChPYLNIJ.js";import{g as Vs}from"./use-mcp-prompts-B8H3Sb8-.js";import{c as Gs,b as Ks,d as Xs,a as Js,D as Qs}from"./dialog-DilC5A4p.js";import{a as Ys,F as Zs,b as en,c as tn,d as sn,f as nn}from"./form-DcfAV72q.js";import{I as ln}from"./input-3FcnQKag.js";import{S as on}from"./spinner-CIUpakvk.js";import{t as an}from"./ChevronDown-XKMoQgX6.js";const rn={openrouter:s=>{const e=s?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function $t(s){if(!s?.providerMetadata)return 0;for(const e of Object.values(rn)){const t=e(s.providerMetadata);if(t!==null)return t}return 0}function It(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Mt(s,e){if(!e)return s;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,l=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:s.inputTokens+(e.inputTokens??0),outputTokens:s.outputTokens+(e.outputTokens??0),reasoningTokens:s.reasoningTokens+(e.reasoningTokens??0),totalTokens:s.totalTokens+(e.totalTokens??0),cost:s.cost+$t(e),cacheReadTokens:s.cacheReadTokens+t,cacheWriteTokens:s.cacheWriteTokens+l}}function $a(s){return s.reduce((e,t)=>Mt(e,t.metadata?.usage),It())}function cn(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Ge(s){if(s&&typeof s=="object"&&"gatewayClientId"in s&&typeof s.gatewayClientId=="string")return s.gatewayClientId}function Ke(s,e){if(!e)return s;const t=`${cn(e)}_`;return s.startsWith(t)?s.slice(t.length):s}function un(s,e){return Ke(s,e).replace(/[_-]/g," ").toLowerCase()}function dn(s){const e={};for(const t of s.arguments??[])e[t.name]=t.required?Ye().min(1,"Required"):Ye();return rt(e)}function fn(s,e){const t={};for(const l of s.arguments??[])t[l.name]=e?.[l.name]??"";return t}function mn(s){const e=$.c(66),{prompt:t,setPrompt:l,onSubmit:a,defaultValues:r}=s,o=H.useId();let i;if(e[0]!==t){const R=t?dn(t):rt({});i=Gt(R),e[0]=t,e[1]=i}else i=e[1];const c=i;let m;e[2]!==r||e[3]!==t?(m=t?fn(t,r):{},e[2]=r,e[3]=t,e[4]=m):m=e[4];let p;e[5]!==c||e[6]!==m?(p={resolver:c,defaultValues:m,mode:"onChange"},e[5]=c,e[6]=m,e[7]=p):p=e[7];const u=Kt(p);let f;e[8]!==t?.arguments?(f=t?.arguments??[],e[8]=t?.arguments,e[9]=f):f=e[9];const x=f;let g;e[10]!==u||e[11]!==a||e[12]!==l?(g=async R=>{await a(R),l(null),u.reset()},e[10]=u,e[11]=a,e[12]=l,e[13]=g):g=e[13];const b=g;let h;e[14]!==u||e[15]!==l?(h=R=>{R||(u.reset(),l(null))},e[14]=u,e[15]=l,e[16]=h):h=e[16];const S=h;if(!t)return null;let y;e[17]!==t._meta||e[18]!==t.name||e[19]!==t.title?(y=t.title||un(t.name,Ge(t._meta)),e[17]=t._meta,e[18]=t.name,e[19]=t.title,e[20]=y):y=e[20];let v;e[21]!==y?(v=n.jsx(Gs,{children:n.jsx("span",{className:"capitalize",children:y})}),e[21]=y,e[22]=v):v=e[22];let j;e[23]!==t.description?(j=t.description&&n.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[23]=t.description,e[24]=j):j=e[24];let N;e[25]!==j||e[26]!==v?(N=n.jsxs(Ks,{children:[v,j]}),e[25]=j,e[26]=v,e[27]=N):N=e[27];let k;e[28]!==u||e[29]!==b?(k=R=>{R.stopPropagation(),u.handleSubmit(b)(R)},e[28]=u,e[29]=b,e[30]=k):k=e[30];let _;if(e[31]!==x||e[32]!==u.control||e[33]!==u.formState.isSubmitting){let R;e[35]!==u.control||e[36]!==u.formState.isSubmitting?(R=E=>n.jsx(Zs,{control:u.control,name:E.name,render:D=>{const{field:W}=D;return n.jsxs(en,{children:[n.jsxs(tn,{className:"text-xs",children:[E.name,E.required?null:n.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),n.jsx(sn,{children:n.jsx(ln,{...W,value:W.value??"",required:E.required,placeholder:E.description??"",className:"h-9",disabled:u.formState.isSubmitting})}),n.jsx(nn,{})]})}},E.name),e[35]=u.control,e[36]=u.formState.isSubmitting,e[37]=R):R=e[37],_=x.map(R),e[31]=x,e[32]=u.control,e[33]=u.formState.isSubmitting,e[34]=_}else _=e[34];let w;e[38]!==S?(w=()=>S(!1),e[38]=S,e[39]=w):w=e[39];let T;e[40]!==u.formState.isSubmitting||e[41]!==w?(T=n.jsx(Se,{type:"button",variant:"ghost",onClick:w,disabled:u.formState.isSubmitting,children:"Cancel"}),e[40]=u.formState.isSubmitting,e[41]=w,e[42]=T):T=e[42];let I;e[43]!==u.formState.isSubmitting?(I=u.formState.isSubmitting?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(on,{size:"xs"}),"Loading..."]}):"Use prompt",e[43]=u.formState.isSubmitting,e[44]=I):I=e[44];let M;e[45]!==u.formState.isSubmitting||e[46]!==o||e[47]!==I?(M=n.jsx(Se,{type:"submit",form:o,disabled:u.formState.isSubmitting,children:I}),e[45]=u.formState.isSubmitting,e[46]=o,e[47]=I,e[48]=M):M=e[48];let C;e[49]!==T||e[50]!==M?(C=n.jsxs(Xs,{children:[T,M]}),e[49]=T,e[50]=M,e[51]=C):C=e[51];let A;e[52]!==o||e[53]!==k||e[54]!==_||e[55]!==C?(A=n.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:k,children:[_,C]}),e[52]=o,e[53]=k,e[54]=_,e[55]=C,e[56]=A):A=e[56];let L;e[57]!==u||e[58]!==A?(L=n.jsx(Ys,{...u,children:A}),e[57]=u,e[58]=A,e[59]=L):L=e[59];let F;e[60]!==N||e[61]!==L?(F=n.jsxs(Js,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[N,L]}),e[60]=N,e[61]=L,e[62]=F):F=e[62];let z;return e[63]!==S||e[64]!==F?(z=n.jsx(Qs,{open:!0,onOpenChange:S,children:F}),e[63]=S,e[64]=F,e[65]=z):z=e[65],z}function At(s){return s?s.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function re(s,e){return s==="output-error"||s==="output-denied"?"error":s==="approval-requested"?"approval":s==="input-streaming"||s==="input-available"||s==="output-available"&&e===!0?"loading":"idle"}function ve(s){if(s==null||typeof s!="object")return;const e=s;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return s}function pn(s){return s.storage.mention}function Ia(s,e,t){s.chain().focus().insertContentAt(e,[Lt(t),{type:"text",text:" "}]).run()}function Lt(s){return{type:"mention",attrs:s}}function xn(s){const e=$.c(19),{node:t,selected:l,view:a,editor:r,getPos:o}=s,{name:i,char:d,kind:c,id:m,args:p}=t.attrs,u=l&&a.editable,f=d==="@",x=a.editable&&d==="/"&&c!=="resource";let g;e[0]!==p||e[1]!==r||e[2]!==o||e[3]!==m||e[4]!==x||e[5]!==i?(g=_=>{if(!x)return;const T=pn(r)?.onEditChip;if(!T||typeof o!="function")return;const I=o();typeof I=="number"&&(_.preventDefault(),_.stopPropagation(),T({promptId:m,promptName:i,args:p??{},pos:I}))},e[0]=p,e[1]=r,e[2]=o,e[3]=m,e[4]=x,e[5]=i,e[6]=g):g=e[6];const b=g,h=x?"cursor-pointer":"cursor-default",S=f?"bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",y=u&&"outline-2 outline-blue-300 outline-offset-0",v=x&&"hover:brightness-95";let j;e[7]!==h||e[8]!==S||e[9]!==y||e[10]!==v?(j=V("px-1 py-1 rounded","inline-flex items-center gap-1",h,"select-none","text-xs font-light",S,y,v,"capitalize"),e[7]=h,e[8]=S,e[9]=y,e[10]=v,e[11]=j):j=e[11];let N;e[12]!==i?(N=i?At(i):"",e[12]=i,e[13]=N):N=e[13];let k;return e[14]!==d||e[15]!==b||e[16]!==j||e[17]!==N?(k=n.jsxs(gt,{onClick:b,className:j,children:[d,N]}),e[14]=d,e[15]=b,e[16]=j,e[17]=N,e[18]=k):k=e[18],k}const gn=pt.create({name:"mention",group:"inline",inline:!0,atom:!0,addStorage(){return{onEditChip:null}},addAttributes(){return{id:{default:null,parseHTML:s=>s.getAttribute("data-id")||null,renderHTML:s=>s.id?{"data-id":s.id}:{}},name:{default:null,parseHTML:s=>s.getAttribute("data-name")||null,renderHTML:s=>s.name?{"data-name":s.name}:{}},char:{default:"/",parseHTML:s=>s.getAttribute("data-char")||"/",renderHTML:s=>s.char?{"data-char":s.char}:{}},metadata:{default:null,parseHTML:s=>{try{return JSON.parse(s.getAttribute("data-metadata")||"null")}catch{return null}},renderHTML:s=>s.metadata?{"data-metadata":JSON.stringify(s.metadata)}:{}},kind:{default:null,parseHTML:s=>s.getAttribute("data-kind")||null,renderHTML:s=>s.kind?{"data-kind":s.kind}:{}},args:{default:null,parseHTML:s=>{try{return JSON.parse(s.getAttribute("data-args")||"null")}catch{return null}},renderHTML:s=>s.args?{"data-args":JSON.stringify(s.args)}:{}}}},parseHTML(){return[{tag:'span[data-type="mention"]'}]},renderHTML({node:s,HTMLAttributes:e}){const t={"data-type":"mention"};return s.attrs.id&&(t["data-id"]=s.attrs.id),s.attrs.name&&(t["data-name"]=s.attrs.name),s.attrs.char&&(t["data-char"]=s.attrs.char),s.attrs.metadata&&(t["data-metadata"]=JSON.stringify(s.attrs.metadata)),s.attrs.kind&&(t["data-kind"]=s.attrs.kind),s.attrs.args&&(t["data-args"]=JSON.stringify(s.attrs.args)),["span",{...e,...t}]},renderText({node:s}){const e=s.attrs.char??"@",t=s.attrs.name??"";return`${e}${t}`},addNodeView(){return xt(xn)}}),hn=/^mcp__[a-zA-Z0-9_-]+__/;function Rt(s){return s.replace(hn,"")}function Xe(s){const e=$.c(18),{id:t,part:l,copyable:a,extraActions:r,alwaysShowActions:o,animate:i}=s,d=a===void 0?!1:a,c=o===void 0?!1:o,m=i===void 0?!1:i,{handleCopy:p}=ht(),[u,f]=H.useState(!1);let x;e[0]!==p||e[1]!==t||e[2]!==l.text?(x=async()=>{Xt("chat_message_copied",{message_id:t,chars:l.text.length}),await p(l.text),f(!0),setTimeout(()=>f(!1),2e3)},e[0]=p,e[1]=t,e[2]=l.text,e[3]=x):x=e[3];const g=x,b=d&&r,h=b||r;let S;e[4]!==m||e[5]!==t||e[6]!==l.text?(S=n.jsx(bt,{id:t,text:l.text,animate:m}),e[4]=m,e[5]=t,e[6]=l.text,e[7]=S):S=e[7];let y;e[8]!==c||e[9]!==r||e[10]!==g||e[11]!==u||e[12]!==h||e[13]!==b?(y=h&&n.jsxs("div",{className:V("flex w-full items-center gap-2 text-sm text-muted-foreground transition-all duration-200 mt-1 py-1",c?"opacity-100":"opacity-0 pointer-events-none group-hover/part:opacity-100 group-hover/part:pointer-events-auto"),children:[r,b&&r&&n.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),b&&n.jsx("button",{type:"button",onClick:g,className:"text-muted-foreground [@media(hover:hover)]:hover:text-foreground transition-colors active:scale-[0.97]","aria-label":"Copy message",children:u?n.jsx(qe,{className:"size-4"}):n.jsx(dt,{className:"size-4"})})]}),e[8]=c,e[9]=r,e[10]=g,e[11]=u,e[12]=h,e[13]=b,e[14]=y):y=e[14];let v;return e[15]!==S||e[16]!==y?(v=n.jsxs("div",{className:"group/part relative",children:[S,y]}),e[15]=S,e[16]=y,e[17]=v):v=e[17],v}function Ma(s,e,t){s.chain().focus().insertContentAt(e,[bn(t),{type:"text",text:" "}]).run()}function bn(s){return{type:"file",attrs:s}}function yn(s){const e=$.c(17),{node:t,selected:l,view:a}=s,{name:r,mimeType:o,data:i}=t.attrs,d=l&&a.editable;let c;e[0]!==o?(c=o.startsWith("image/"),e[0]=o,e[1]=c):c=e[1];const m=c,p=d&&"outline-2 outline-blue-300 outline-offset-0";let u;e[2]!==p?(u=V("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light","bg-muted text-muted-foreground",p),e[2]=p,e[3]=u):u=e[3];let f;e[4]!==r?(f=n.jsx(pe,{asChild:!0,children:n.jsx("span",{children:r})}),e[4]=r,e[5]=f):f=e[5];let x;e[6]!==i||e[7]!==m||e[8]!==o||e[9]!==r?(x=n.jsx(xe,{side:"top",className:"max-w-sm p-1.5",children:m?n.jsx("img",{src:`data:${o};base64,${i}`,alt:r,className:"max-w-full max-h-64 object-contain rounded"}):n.jsxs("div",{className:"text-xs",children:[n.jsx("div",{className:"font-medium",children:r}),n.jsx("div",{className:"text-muted-foreground mt-1",children:o})]})}),e[6]=i,e[7]=m,e[8]=o,e[9]=r,e[10]=x):x=e[10];let g;e[11]!==f||e[12]!==x?(g=n.jsxs(ge,{children:[f,x]}),e[11]=f,e[12]=x,e[13]=g):g=e[13];let b;return e[14]!==u||e[15]!==g?(b=n.jsx(gt,{className:u,children:g}),e[14]=u,e[15]=g,e[16]=b):b=e[16],b}const jn=pt.create({name:"file",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:s=>s.getAttribute("data-id")||null,renderHTML:s=>s.id?{"data-id":s.id}:{}},name:{default:null,parseHTML:s=>s.getAttribute("data-name")||null,renderHTML:s=>s.name?{"data-name":s.name}:{}},mimeType:{default:null,parseHTML:s=>s.getAttribute("data-mime-type")||null,renderHTML:s=>s.mimeType?{"data-mime-type":s.mimeType}:{}},size:{default:0,parseHTML:s=>{const e=s.getAttribute("data-size");return e?Number.parseInt(e,10):0},renderHTML:s=>s.size?{"data-size":String(s.size)}:{}},data:{default:null,parseHTML:s=>s.getAttribute("data-data")||null,renderHTML:s=>s.data?{"data-data":s.data}:{}}}},parseHTML(){return[{tag:'span[data-type="file"]'}]},renderHTML({node:s,HTMLAttributes:e}){const t={"data-type":"file"};return s.attrs.id&&(t["data-id"]=s.attrs.id),s.attrs.name&&(t["data-name"]=s.attrs.name),s.attrs.mimeType&&(t["data-mime-type"]=s.attrs.mimeType),s.attrs.size&&(t["data-size"]=String(s.attrs.size)),s.attrs.data&&(t["data-data"]=s.attrs.data),["span",{...e,...t}]},renderText({node:s}){return`[${s.attrs.name??""}]`},addNodeView(){return xt(yn)}}),fe=16,De=2.5,Oe=(fe-De)/2,ze=2*Math.PI*Oe;function vn(s){const e=$.c(31),{usage:t}=s;if(!t)return null;const{totalTokens:l,inputTokens:a,outputTokens:r,cost:o}=t;if(!l&&!a&&!r)return null;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(es,{size:12}),e[0]=i):i=e[0];let d;e[1]!==o||e[2]!==l?(d=o>0?`$${o.toFixed(4)}`:l.toLocaleString(),e[1]=o,e[2]=l,e[3]=d):d=e[3];let c;e[4]!==d?(c=n.jsx(pe,{asChild:!0,children:n.jsxs("span",{className:"inline-flex items-center text-muted-foreground [@media(hover:hover)]:hover:text-foreground pl-1 h-6 gap-1 whitespace-nowrap shrink-0 cursor-default",children:[i,n.jsx("span",{className:"text-sm font-mono tabular-nums",children:d})]})}),e[4]=d,e[5]=c):c=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx("p",{className:"text-muted text-[10px] mb-1",children:"tokens"}),e[6]=m):m=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx("span",{className:"text-muted",children:"in"}),e[7]=p):p=e[7];let u;e[8]!==a?(u=a.toLocaleString(),e[8]=a,e[9]=u):u=e[9];let f;e[10]!==u?(f=n.jsx("span",{className:"text-right tabular-nums",children:u}),e[10]=u,e[11]=f):f=e[11];let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx("span",{className:"text-muted",children:"out"}),e[12]=x):x=e[12];const g=r-(t.reasoningTokens??0);let b;e[13]!==g?(b=g.toLocaleString(),e[13]=g,e[14]=b):b=e[14];let h;e[15]!==b?(h=n.jsx("span",{className:"text-right tabular-nums",children:b}),e[15]=b,e[16]=h):h=e[16];let S;e[17]!==a||e[18]!==t.cacheReadTokens||e[19]!==t.cacheWriteTokens?(S=(t.cacheReadTokens>0||t.cacheWriteTokens>0)&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cache hit"}),n.jsx("span",{className:"text-right tabular-nums",children:a>0?`${(t.cacheReadTokens/a*100).toFixed(0)}%`:"0%"})]}),e[17]=a,e[18]=t.cacheReadTokens,e[19]=t.cacheWriteTokens,e[20]=S):S=e[20];let y;e[21]!==o?(y=o>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cost"}),n.jsxs("span",{className:"text-right tabular-nums",children:["$",o.toFixed(4)]})]}),e[21]=o,e[22]=y):y=e[22];let v;e[23]!==h||e[24]!==S||e[25]!==y||e[26]!==f?(v=n.jsxs(xe,{side:"top",className:"font-mono text-[11px]",children:[m,n.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[p,f,x,h,S,y]})]}),e[23]=h,e[24]=S,e[25]=y,e[26]=f,e[27]=v):v=e[27];let j;return e[28]!==v||e[29]!==c?(j=n.jsxs(ge,{children:[c,v]}),e[28]=v,e[29]=c,e[30]=j):j=e[30],j}function Nn(s){const e=$.c(19),{usage:t,duration:l}=s,a=l!=null&&l>0,r=t!=null&&(t.cost??0)>0,o=t!=null&&(t.totalTokens??0)>0;if(!a&&!r&&!o)return null;let i;e[0]!==l||e[1]!==a?(i=a?de(l/1e3):null,e[0]=l,e[1]=a,e[2]=i):i=e[2];const d=i;let c;e[3]!==l||e[4]!==d||e[5]!==t?(c=d&&n.jsxs(ge,{children:[n.jsx(pe,{asChild:!0,children:n.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:d})}),n.jsxs(xe,{side:"top",className:"font-mono text-[11px]",children:[n.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"thinking"}),n.jsx("span",{className:"tabular-nums",children:de(l/1e3)}),(t?.reasoningTokens??0)>0&&n.jsxs("span",{className:"ml-2 opacity-50",children:[t.reasoningTokens.toLocaleString()," tok"]})]})]}),e[3]=l,e[4]=d,e[5]=t,e[6]=c):c=e[6];let m;e[7]!==r||e[8]!==a||e[9]!==o?(m=a&&(r||o)&&n.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),e[7]=r,e[8]=a,e[9]=o,e[10]=m):m=e[10];let p;e[11]!==r||e[12]!==o||e[13]!==t?(p=(r||o)&&n.jsxs(ge,{children:[n.jsx(pe,{asChild:!0,children:n.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:r?`$${t.cost.toFixed(4)}`:`${t.totalTokens.toLocaleString()} tok`})}),n.jsxs(xe,{side:"top",className:"font-mono text-[11px]",children:[n.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"tokens"}),n.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[n.jsx("span",{className:"opacity-60",children:"in"}),n.jsx("span",{className:"text-right tabular-nums",children:(t.inputTokens??0).toLocaleString()}),n.jsx("span",{className:"opacity-60",children:"out"}),n.jsx("span",{className:"text-right tabular-nums",children:((t.outputTokens??0)-(t?.reasoningTokens??0)).toLocaleString()}),(t?.reasoningTokens??0)>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"opacity-60",children:"think"}),n.jsx("span",{className:"text-right tabular-nums",children:t.reasoningTokens.toLocaleString()})]}),((t?.cacheReadTokens??0)>0||(t?.cacheWriteTokens??0)>0)&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"opacity-60",children:"cache hit"}),n.jsx("span",{className:"text-right tabular-nums",children:(t?.inputTokens??0)>0?`${((t?.cacheReadTokens??0)/t.inputTokens*100).toFixed(0)}%`:"0%"})]})]})]})]}),e[11]=r,e[12]=o,e[13]=t,e[14]=p):p=e[14];let u;return e[15]!==c||e[16]!==m||e[17]!==p?(u=n.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[c,m,p]}),e[15]=c,e[16]=m,e[17]=p,e[18]=u):u=e[18],u}function Aa(s){const e=$.c(51),{usage:t,totalTokens:l,contextWindow:a,onOpenContextPanel:r}=s,o=Math.min(l/a*100,100),i=ze-o/100*ze,d=t?.cost??0,c=t?.inputTokens??0,m=t?.outputTokens??0;let p;e[0]!==o?(p=o.toFixed(0),e[0]=o,e[1]=p):p=e[1];let u;e[2]!==d?(u=d>0?`, $${d.toFixed(2)}`:"",e[2]=d,e[3]=u):u=e[3];const f=`Context usage: ${p}%${u}`,x=r?"cursor-pointer":"cursor-default";let g;e[4]!==x?(g=V("flex items-center gap-1.5 text-muted-foreground hover:text-foreground h-6 px-1 shrink-0",x),e[4]=x,e[5]=g):g=e[5];let b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("circle",{cx:fe/2,cy:fe/2,r:Oe,fill:"none",stroke:"currentColor",strokeWidth:De,className:"opacity-15"}),e[6]=b):b=e[6];const h=o>90?"text-destructive":o>70?"text-warning":"text-muted-foreground";let S;e[7]!==h?(S=V(h),e[7]=h,e[8]=S):S=e[8];let y;e[9]!==i||e[10]!==S?(y=n.jsxs("svg",{width:fe,height:fe,className:"-rotate-90",children:[b,n.jsx("circle",{cx:fe/2,cy:fe/2,r:Oe,fill:"none",stroke:"currentColor",strokeWidth:De,strokeDasharray:ze,strokeDashoffset:i,strokeLinecap:"round",className:S})]}),e[9]=i,e[10]=S,e[11]=y):y=e[11];let v;e[12]!==o?(v=o.toFixed(0),e[12]=o,e[13]=v):v=e[13];let j;e[14]!==d?(j=d>0?` · $${d.toFixed(2)}`:"",e[14]=d,e[15]=j):j=e[15];let N;e[16]!==v||e[17]!==j?(N=n.jsxs("span",{className:"inline-block overflow-hidden whitespace-nowrap max-w-0 opacity-0 transition-[max-width,opacity] duration-200 ease-out @[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100 text-[11px] font-mono tabular-nums",children:[v,"%",j]}),e[16]=v,e[17]=j,e[18]=N):N=e[18];let k;e[19]!==r||e[20]!==N||e[21]!==f||e[22]!==g||e[23]!==y?(k=n.jsx(pe,{asChild:!0,children:n.jsxs("button",{type:"button",onClick:r,"aria-label":f,className:g,children:[y,N]})}),e[19]=r,e[20]=N,e[21]=f,e[22]=g,e[23]=y,e[24]=k):k=e[24];let _;e[25]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx("span",{className:"text-muted",children:"context"}),e[25]=_):_=e[25];let w;e[26]!==l?(w=l.toLocaleString(),e[26]=l,e[27]=w):w=e[27];let T;e[28]!==a?(T=a.toLocaleString(),e[28]=a,e[29]=T):T=e[29];let I;e[30]!==o?(I=o.toFixed(1),e[30]=o,e[31]=I):I=e[31];let M;e[32]!==w||e[33]!==T||e[34]!==I?(M=n.jsxs("span",{className:"text-right tabular-nums",children:[w," / ",T," (",I,"%)"]}),e[32]=w,e[33]=T,e[34]=I,e[35]=M):M=e[35];let C;e[36]!==d||e[37]!==c||e[38]!==m?(C=d>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cost"}),n.jsxs("span",{className:"text-right tabular-nums",children:["$",d.toFixed(4)]}),n.jsx("span",{className:"text-muted",children:"in"}),n.jsx("span",{className:"text-right tabular-nums",children:c.toLocaleString()}),n.jsx("span",{className:"text-muted",children:"out"}),n.jsx("span",{className:"text-right tabular-nums",children:m.toLocaleString()})]}),e[36]=d,e[37]=c,e[38]=m,e[39]=C):C=e[39];let A;e[40]!==c||e[41]!==t?.cacheReadTokens||e[42]!==t?.cacheWriteTokens?(A=((t?.cacheReadTokens??0)>0||(t?.cacheWriteTokens??0)>0)&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cache hit"}),n.jsx("span",{className:"text-right tabular-nums",children:c>0?`${((t?.cacheReadTokens??0)/c*100).toFixed(0)}%`:"0%"})]}),e[40]=c,e[41]=t?.cacheReadTokens,e[42]=t?.cacheWriteTokens,e[43]=A):A=e[43];let L;e[44]!==M||e[45]!==C||e[46]!==A?(L=n.jsx(xe,{side:"top",className:"font-mono text-[11px]",children:n.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[_,M,C,A]})}),e[44]=M,e[45]=C,e[46]=A,e[47]=L):L=e[47];let F;return e[48]!==k||e[49]!==L?(F=n.jsxs(ge,{children:[k,L]}),e[48]=k,e[49]=L,e[50]=F):F=e[50],F}function Sn(s){const e=$.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let l;return e[2]!==t?(l=n.jsx(bs,{"data-slot":"collapsible",...t}),e[2]=t,e[3]=l):l=e[3],l}function kn(s){const e=$.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let l;return e[2]!==t?(l=n.jsx(gs,{"data-slot":"collapsible-trigger",...t}),e[2]=t,e[3]=l):l=e[3],l}function _n(s){const e=$.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let l;return e[2]!==t?(l=n.jsx(hs,{"data-slot":"collapsible-content",...t}),e[2]=t,e[3]=l):l=e[3],l}function Et({containerRef:s,enabled:e,contentDeps:t=[],threshold:l,intervalMs:a=500}){const[r,o]=H.useState(null),[i,d]=H.useState(!1),c=l??(s?.95:.1),m=()=>{if(s?.current){s.current.scrollTop=s.current.scrollHeight;return}if(!r)return;let p=r.parentElement;for(;p;){const u=window.getComputedStyle(p);if(u.overflowY==="auto"||u.overflowY==="scroll"||u.overflow==="auto"||u.overflow==="scroll"){p.scrollTop=p.scrollHeight;return}p=p.parentElement}};return H.useEffect(()=>{if(!r)return;const p=new IntersectionObserver(u=>{const f=u[0]?.isIntersecting??!1;d(f)},{root:s?.current??null,threshold:c,rootMargin:"0px"});return p.observe(r),()=>p.disconnect()},[r,c]),H.useEffect(()=>{if(!e||!i)return;const p=setInterval(m,a);return()=>clearInterval(p)},[e,i,a]),H.useEffect(()=>{!e||!i||m()},[e,i,...t]),{sentinelRef:o,isTracking:i}}function B(s){const e=$.c(53),{icon:t,title:l,usage:a,summary:r,state:o,detail:i,detailVariant:d,forceOpen:c,variant:m,trailing:p,iconDestructive:u,alwaysChevron:f,defaultOpen:x,children:g}=s,b=d===void 0?"code":d,h=m===void 0?"default":m,[S,y]=H.useState(x??!1),{handleCopy:v,copied:j}=ht(),N=o==="loading",k=o==="error";let _;e[0]!==i?(_=i&&i.trim(),e[0]=i,e[1]=_):_=e[1];const T=!!_||!!g,I=h==="subtask",M=(c??!1)||S,C=H.useRef(null),A=N&&M;let L;e[2]!==i?(L=[i],e[2]=i,e[3]=L):L=e[3];let F;e[4]!==A||e[5]!==L?(F={containerRef:C,enabled:A,contentDeps:L},e[4]=A,e[5]=L,e[6]=F):F=e[6];const{sentinelRef:z}=Et(F),R=c?void 0:y,E=!T,D=T&&"[@media(hover:hover)]:hover:bg-accent/30",W=!T&&"cursor-default",U=N&&"shimmer";let O;e[7]!==W||e[8]!==U||e[9]!==D?(O=V("group/tool flex items-center gap-2 w-full py-2.5 text-left transition-colors",D,W,U),e[7]=W,e[8]=U,e[9]=D,e[10]=O):O=e[10];const K=!T;let G;e[11]!==f||e[12]!==M||e[13]!==t||e[14]!==u||e[15]!==k||e[16]!==T?(G=n.jsx("div",{className:"relative shrink-0 size-4 flex items-center justify-center",children:f?n.jsx(Ze,{className:V("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",M&&"rotate-90")}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:V("absolute inset-0 flex items-center justify-center [&>svg]:size-4 transition-opacity duration-150",u?"[&>svg]:text-destructive/70":k?"[&>svg]:text-warning/70":"[&>svg]:text-muted-foreground/75",T&&(M?"opacity-0":"[@media(hover:hover)]:group-hover/tool:opacity-0")),children:t}),T&&n.jsx("div",{className:V("absolute inset-0 flex items-center justify-center transition-opacity duration-150",M?"opacity-100":"opacity-0 [@media(hover:hover)]:group-hover/tool:opacity-100"),children:n.jsx(Ze,{className:V("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",M&&"rotate-90")})})]})}),e[11]=f,e[12]=M,e[13]=t,e[14]=u,e[15]=k,e[16]=T,e[17]=G):G=e[17];const Y=k?"text-warning/80":"text-foreground";let Q;e[18]!==Y?(Q=V("shrink-0 text-[14px] font-normal",Y),e[18]=Y,e[19]=Q):Q=e[19];let te;e[20]!==Q||e[21]!==l?(te=n.jsx("span",{className:Q,children:l}),e[20]=Q,e[21]=l,e[22]=te):te=e[22];let P;e[23]!==r?(P=r?n.jsx("span",{className:"min-w-0 flex-1 truncate",children:n.jsx("span",{className:"text-[12px] text-muted-foreground/60 bg-muted/50 rounded-[3px] px-1 py-px leading-none",children:r})}):n.jsx("div",{className:"flex-1"}),e[23]=r,e[24]=P):P=e[24];let q;e[25]!==p?(q=p&&n.jsx("div",{className:"shrink-0 flex items-center gap-1 [&_svg]:size-3.5 [&_svg]:text-muted-foreground/50",children:p}),e[25]=p,e[26]=q):q=e[26];let X;e[27]!==a?(X=n.jsx(vn,{usage:a}),e[27]=a,e[28]=X):X=e[28];let J;e[29]!==O||e[30]!==K||e[31]!==G||e[32]!==te||e[33]!==P||e[34]!==q||e[35]!==X||e[36]!==E?(J=n.jsxs(kn,{disabled:E,className:O,"aria-disabled":K,children:[G,te,P,q,X]}),e[29]=O,e[30]=K,e[31]=G,e[32]=te,e[33]=P,e[34]=q,e[35]=X,e[36]=E,e[37]=J):J=e[37];let se;e[38]!==g||e[39]!==j||e[40]!==i||e[41]!==b||e[42]!==v||e[43]!==T||e[44]!==z?(se=T&&n.jsx(_n,{className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden",children:g||(b==="prose"?n.jsx("div",{className:"mt-1 mb-1",children:n.jsxs("div",{ref:C,className:"max-h-[150px] overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:[n.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap leading-relaxed wrap-break-word",children:i}),n.jsx("div",{ref:z,className:"h-0 shrink-0"})]})}):n.jsx("div",{className:"ml-[20px] pl-3 border-l border-border/30 mt-0.5 pb-1",children:n.jsxs("div",{ref:C,className:"flex flex-col max-h-48 overflow-y-auto",children:[n.jsxs("div",{className:"flex items-start justify-between gap-2",children:[n.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:n.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:i})}),n.jsx("button",{type:"button",onClick:()=>v(i),className:"shrink-0 p-1.5 rounded-md text-muted-foreground/50 [@media(hover:hover)]:hover:text-foreground [@media(hover:hover)]:hover:bg-accent/50 transition-colors active:scale-[0.97]","aria-label":"Copy",children:j?n.jsx(qe,{className:"size-3.5"}):n.jsx(dt,{className:"size-3.5"})})]}),n.jsx("div",{ref:z,className:"h-0 shrink-0"})]})}))}),e[38]=g,e[39]=j,e[40]=i,e[41]=b,e[42]=v,e[43]=T,e[44]=z,e[45]=se):se=e[45];let ue;e[46]!==M||e[47]!==J||e[48]!==se||e[49]!==R?(ue=n.jsxs(Sn,{open:M,onOpenChange:R,className:"min-w-0",children:[J,se]}),e[46]=M,e[47]=J,e[48]=se,e[49]=R,e[50]=ue):ue=e[50];const oe=ue;if(I){let ae;return e[51]!==oe?(ae=n.jsx("div",{className:"pl-4 border-l border-border/40 ml-1.5",children:oe}),e[51]=oe,e[52]=ae):ae=e[52],ae}return oe}function le(s){const e=$.c(4),{latency:t}=s;if(t==null||t<=0)return null;let l;e[0]!==t?(l=de(t),e[0]=t,e[1]=l):l=e[1];let a;return e[2]!==l?(a=n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground",children:l}),e[2]=l,e[3]=a):a=e[3],a}const zt=4;function Pt(s){const e=$.c(5),{count:t,noun:l,onClick:a}=s;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(ut,{className:"size-4 transition-transform group-hover:translate-x-0.5","aria-hidden":"true"}),e[0]=r):r=e[0];let o;return e[1]!==t||e[2]!==l||e[3]!==a?(o=n.jsxs("button",{type:"button",onClick:a,className:"group flex w-full items-center justify-center gap-1.5 rounded-lg border border-border bg-card px-3 py-2.5 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:["See all ",t," ",l,r]}),e[1]=t,e[2]=l,e[3]=a,e[4]=o):o=e[4],o}function wn(s){const e=$.c(24),{org:t}=he(),l=Jt(),a=Ts(),r=Ms();let o;e[0]!==r||e[1]!==s?(o=async g=>{if(!s)throw new Error("useTaskExpandedTools: no task in context");const h=(await r.call("COLLECTION_THREADS_GET",{id:s})).item?.metadata??{},y=(h.expanded_tools??[]).filter(j=>j.toolName!==g.toolName);y.push({...g,expandedAt:new Date().toISOString()});const v={...h,expanded_tools:y};return await r.call("COLLECTION_THREADS_UPDATE",{id:s,data:{metadata:v}}),y},e[0]=r,e[1]=s,e[2]=o):o=e[2];let i,d,c;e[3]!==t||e[4]!==l||e[5]!==s?(i=async g=>{const b=me.ensureTask(t.id,s??"");await l.cancelQueries({queryKey:b});const h=l.getQueryData(b),y=(h?.metadata?.expanded_tools??[]).filter(v=>v.toolName!==g.toolName);return y.push({...g,expandedAt:new Date().toISOString()}),l.setQueryData(b,v=>v&&{...v,metadata:{...v.metadata??{},expanded_tools:y}}),{previous:h}},d=()=>{l.invalidateQueries({queryKey:me.ensureTask(t.id,s??"")})},c=(g,b,h)=>{const S=me.ensureTask(t.id,s??"");h?.previous===void 0?l.removeQueries({queryKey:S,exact:!0}):l.setQueryData(S,h.previous),Fe.error(g instanceof Error?g.message:"Failed to expand tool")},e[3]=t,e[4]=l,e[5]=s,e[6]=i,e[7]=d,e[8]=c):(i=e[6],d=e[7],c=e[8]);let m;e[9]!==o||e[10]!==i||e[11]!==d||e[12]!==c?(m={mutationFn:o,onMutate:i,onSuccess:d,onError:c},e[9]=o,e[10]=i,e[11]=d,e[12]=c,e[13]=m):m=e[13];const p=Qt(m);let u;e[14]!==a||e[15]!==p||e[16]!==t||e[17]!==l||e[18]!==s?(u=g=>{if(!s||!a)return;const b=me.ensureTask(t.id,s),h=l.getQueryData(b),y=(h?.metadata?.expanded_tools??[]).filter(j=>j.toolName!==g.toolName);y.push({...g,expandedAt:new Date().toISOString()});const v={...h?.metadata??{},expanded_tools:y};l.setQueryData(b,j=>j&&{...j,metadata:v}),a.patchThread({id:s,metadata:v}),p.mutate(g)},e[14]=a,e[15]=p,e[16]=t,e[17]=l,e[18]=s,e[19]=u):u=e[19];const f=u;let x;return e[20]!==f||e[21]!==p.isPending||e[22]!==p.mutate?(x={addOrReplace:p.mutate,addOrReplaceEager:f,isPending:p.isPending},e[20]=f,e[21]=p.isPending,e[22]=p.mutate,e[23]=x):x=e[23],x}function Tn(s){if(s<1024)return`${s} B`;if(s<1024*1024){const t=s/1024;return t<10?`${t.toFixed(1)} KB`:`${Math.round(t)} KB`}const e=s/(1024*1024);return e<10?`${e.toFixed(1)} MB`:`${Math.round(e)} MB`}function Cn(s,e,t,l){const{data:a,isLoading:r}=He({queryKey:me.toolDefinitionLookup(e,t,s),queryFn:async()=>{if(!s||!e)return null;const o=await As({connectionId:e,orgId:t,orgSlug:l});try{const{tools:i}=await o.listTools(),d=Rt(s);return i.find(c=>c.name===d)??null}finally{await o.close().catch(()=>{})}},enabled:!!s&&!!e,staleTime:6e4,gcTime:3e5,retry:!1});return{toolDef:a??void 0,isLoading:r}}const $n={read:{icon:tt,label:"Read File"},write:{icon:Ps,label:"Write File"},edit:{icon:as,label:"Edit File"},grep:{icon:Ds,label:"Search Content"},glob:{icon:Fs,label:"Find Files"},bash:{icon:os,label:"Run Command"},read_tool_output:{icon:tt,label:"Read Tool Output"},read_resource:{icon:ls,label:"Read Resource"},read_prompt:{icon:kt,label:"Read Prompt"},enable_tool:{icon:zs,label:"Enable Tool"},open_in_agent:{icon:ns,label:"Open in Agent"},sandbox:{icon:ss,label:"Run Code"},copy_to_sandbox:{icon:_t,label:"Load File"},share_with_user:{icon:Os,label:"Share with User"},take_screenshot:{icon:Ne,label:"Take Screenshot"},scrape_url:{icon:Ie,label:"Scrape URL"},inspect_page:{icon:ts,label:"Inspect Page"}},In="bash-sleep-start:";function Mn(s){const e=In+s;try{const t=sessionStorage.getItem(e);if(t!==null){const a=Number.parseInt(t,10);if(Number.isFinite(a))return a}const l=Date.now();return sessionStorage.setItem(e,String(l)),l}catch{return Date.now()}}function An(s,e){const t=$.c(2);let l;t[0]!==s?(l=()=>Mn(s),t[0]=s,t[1]=l):l=t[1];const a=H.useState(l)[0];return e??a}function Ln(s){const e=Math.ceil(s/1e3);if(e<60)return`${e}s`;const t=Math.floor(e/60),l=e%60;return l?`${t}m ${l}s`:`${t}m`}function Rn(s){const e=$.c(4),{toolCallId:t,durationMs:l,anchorMs:a}=s;ft(1e3);const o=An(t,a)+l-Date.now();let i;e[0]!==o?(i=o>0?`Waiting ${Ln(o)}`:"Wrapping up…",e[0]=o,e[1]=i):i=e[1];let d;return e[2]!==i?(d=n.jsx("span",{className:"tabular-nums",children:i}),e[2]=i,e[3]=d):d=e[3],d}const En={s:1e3,m:6e4,h:36e5,d:864e5};function zn(s){const e=/(?:^|[\s;&|(])sleep((?:\s+[\d.]+[smhd]?)+)/g;let t=0,l=!1;for(const a of s.matchAll(e))for(const r of a[1].trim().split(/\s+/)){const o=/^([\d.]+)([smhd]?)$/.exec(r);if(!o)continue;const i=Number.parseFloat(o[1]);Number.isFinite(i)&&(t+=i*(En[o[2]||"s"]??1e3),l=!0)}return l?t:null}function Le(s,e="An unknown error occurred"){return"errorText"in s&&typeof s.errorText=="string"?s.errorText:e}function ye(s){if(s==null)return"";try{return JSON.stringify(s)}catch{return"[Non-serializable value]"}}function Me(s){const e=ye(s);if(e===""||e==="[Non-serializable value]")return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}const Pn=s=>s.type==="dynamic-tool"||s.type.startsWith("tool-");function Fn(s){if(!s||typeof s!="object")return null;const e=s;if(!Array.isArray(e.parts))return null;const t=[];for(const l of e.parts)if(l.type==="text"&&typeof l.text=="string")t.push(l.text);else if(l.type==="reasoning")t.push(`## Reasoning
|
|
1
|
+
import{e as $,r as H,P as rt,H as Gt,G as Kt,j as n,B as Se,R as Ye,c as q,t as Xt,p as he,F as Jt,a as Qt,K as me,n as Fe,m as He,f as je,E as Yt,z as Zt,by as We}from"./index-CR2BsklH.js";import{$ as es,G as ts,B as ss,ac as ns,O as ls,N as os,M as as,a8 as it,ad as rs,ae as is,A as ct,af as ie,ag as cs,ah as us,ai as ds,b as fs}from"./agent-icon-CR2BOYIt.js";import{t as Ue}from"./Stars01-M9lSQCUv.js";import{a as ut,t as ms,b as Ce,d as ps}from"./XCircle-DxeB44sm.js";import{i as Ve}from"./Check-CQSOJf1l.js";import{i as Ze}from"./ChevronRight-Bwn2E0SF.js";import{a as dt,s as xs}from"./Eye-CJqEY9Bp.js";import{a as de,u as ft,t as mt,c as et}from"./use-clock-tick-dBvSZsql.js";import{N as pt,R as xt,e as gt,C as gs,f as hs,g as bs,u as ys,i as js,d as vs}from"./scroll-area-CLZP3_5w.js";import{u as ht}from"./use-copy-vy8ApQ-I.js";import{T as pe,a as xe,b as ge}from"./tooltip-CLG87qyy.js";import{M as bt,I as yt,F as Ns}from"./file-type-icon-B4-le7-M.js";import{c as Ss}from"./content-blocks-o63cs2vh.js";import{g as jt,M as ks}from"./types-CBP_wAn8.js";import{g as _e,i as _s,d as qe,a as ws}from"./chat-context-DG8MYWh9.js";import{l as Ts,f as Cs,m as $s,n as Is}from"./tab-id-DF4EtVz0.js";import{u as Ms}from"./studio-tools-BgmLlqq0.js";import{c as As,u as vt,b as Ls}from"./use-mcp-client-WRUNhji3.js";import{i as Nt}from"./AlertCircle-DfCrgvbm.js";import{s as Ie,t as St}from"./Star01-Co_EFaK6.js";import{s as Rs}from"./XClose-SVLNQiVU.js";import{n as kt}from"./ZapSquare-CBHt5u2b.js";import{n as _t,i as Es}from"./Globe01-CZ8FVUUU.js";import{b as zs,i as Ps,a as Ee}from"./Tool01-CmnBi-ns.js";import{a as tt,i as Fs}from"./ZoomOut-CiW88kaG.js";import{i as Ne}from"./Monitor01-BKcboobL.js";import{i as Ds}from"./SearchMd-DZ6aIwIg.js";import{i as Os}from"./Upload01-B_SjMibr.js";import{u as Bs,c as Hs}from"./shell-layout-CVwlRsIR.js";import{n as wt}from"./LinkExternal01-j7-s92dF.js";import{I as Ae}from"./integration-icon-Bw8f7ZPI.js";import{u as Ws}from"./use-virtual-mcp-CYog3nxZ.js";import{a as Tt}from"./Users03-CIMcoZEN.js";import{a as ce}from"./Palette-DX6Dwn47.js";import{k as Ct}from"./use-navigate-to-agent-S7VbkvxA.js";import{a as Us}from"./use-connection-BGirJeWX.js";import{s as Vs}from"./Stars02-C-4orbjJ.js";import{g as qs}from"./use-mcp-prompts-D8_D9pv7.js";import{c as Gs,b as Ks,d as Xs,a as Js,D as Qs}from"./dialog-DDaCuEXe.js";import{a as Ys,F as Zs,b as en,c as tn,d as sn,f as nn}from"./form-3ozPMiDy.js";import{I as ln}from"./input-BXKnvLhL.js";import{S as on}from"./spinner-CDjEeRHa.js";import{t as an}from"./ChevronDown-DaBswAjS.js";const rn={openrouter:s=>{const e=s?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function $t(s){if(!s?.providerMetadata)return 0;for(const e of Object.values(rn)){const t=e(s.providerMetadata);if(t!==null)return t}return 0}function It(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Mt(s,e){if(!e)return s;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,l=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:s.inputTokens+(e.inputTokens??0),outputTokens:s.outputTokens+(e.outputTokens??0),reasoningTokens:s.reasoningTokens+(e.reasoningTokens??0),totalTokens:s.totalTokens+(e.totalTokens??0),cost:s.cost+$t(e),cacheReadTokens:s.cacheReadTokens+t,cacheWriteTokens:s.cacheWriteTokens+l}}function $a(s){return s.reduce((e,t)=>Mt(e,t.metadata?.usage),It())}function cn(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Ge(s){if(s&&typeof s=="object"&&"gatewayClientId"in s&&typeof s.gatewayClientId=="string")return s.gatewayClientId}function Ke(s,e){if(!e)return s;const t=`${cn(e)}_`;return s.startsWith(t)?s.slice(t.length):s}function un(s,e){return Ke(s,e).replace(/[_-]/g," ").toLowerCase()}function dn(s){const e={};for(const t of s.arguments??[])e[t.name]=t.required?Ye().min(1,"Required"):Ye();return rt(e)}function fn(s,e){const t={};for(const l of s.arguments??[])t[l.name]=e?.[l.name]??"";return t}function mn(s){const e=$.c(66),{prompt:t,setPrompt:l,onSubmit:a,defaultValues:r}=s,o=H.useId();let i;if(e[0]!==t){const R=t?dn(t):rt({});i=Gt(R),e[0]=t,e[1]=i}else i=e[1];const c=i;let m;e[2]!==r||e[3]!==t?(m=t?fn(t,r):{},e[2]=r,e[3]=t,e[4]=m):m=e[4];let p;e[5]!==c||e[6]!==m?(p={resolver:c,defaultValues:m,mode:"onChange"},e[5]=c,e[6]=m,e[7]=p):p=e[7];const u=Kt(p);let f;e[8]!==t?.arguments?(f=t?.arguments??[],e[8]=t?.arguments,e[9]=f):f=e[9];const x=f;let g;e[10]!==u||e[11]!==a||e[12]!==l?(g=async R=>{await a(R),l(null),u.reset()},e[10]=u,e[11]=a,e[12]=l,e[13]=g):g=e[13];const b=g;let h;e[14]!==u||e[15]!==l?(h=R=>{R||(u.reset(),l(null))},e[14]=u,e[15]=l,e[16]=h):h=e[16];const S=h;if(!t)return null;let y;e[17]!==t._meta||e[18]!==t.name||e[19]!==t.title?(y=t.title||un(t.name,Ge(t._meta)),e[17]=t._meta,e[18]=t.name,e[19]=t.title,e[20]=y):y=e[20];let v;e[21]!==y?(v=n.jsx(Gs,{children:n.jsx("span",{className:"capitalize",children:y})}),e[21]=y,e[22]=v):v=e[22];let j;e[23]!==t.description?(j=t.description&&n.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[23]=t.description,e[24]=j):j=e[24];let N;e[25]!==j||e[26]!==v?(N=n.jsxs(Ks,{children:[v,j]}),e[25]=j,e[26]=v,e[27]=N):N=e[27];let k;e[28]!==u||e[29]!==b?(k=R=>{R.stopPropagation(),u.handleSubmit(b)(R)},e[28]=u,e[29]=b,e[30]=k):k=e[30];let _;if(e[31]!==x||e[32]!==u.control||e[33]!==u.formState.isSubmitting){let R;e[35]!==u.control||e[36]!==u.formState.isSubmitting?(R=E=>n.jsx(Zs,{control:u.control,name:E.name,render:D=>{const{field:W}=D;return n.jsxs(en,{children:[n.jsxs(tn,{className:"text-xs",children:[E.name,E.required?null:n.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),n.jsx(sn,{children:n.jsx(ln,{...W,value:W.value??"",required:E.required,placeholder:E.description??"",className:"h-9",disabled:u.formState.isSubmitting})}),n.jsx(nn,{})]})}},E.name),e[35]=u.control,e[36]=u.formState.isSubmitting,e[37]=R):R=e[37],_=x.map(R),e[31]=x,e[32]=u.control,e[33]=u.formState.isSubmitting,e[34]=_}else _=e[34];let w;e[38]!==S?(w=()=>S(!1),e[38]=S,e[39]=w):w=e[39];let T;e[40]!==u.formState.isSubmitting||e[41]!==w?(T=n.jsx(Se,{type:"button",variant:"ghost",onClick:w,disabled:u.formState.isSubmitting,children:"Cancel"}),e[40]=u.formState.isSubmitting,e[41]=w,e[42]=T):T=e[42];let I;e[43]!==u.formState.isSubmitting?(I=u.formState.isSubmitting?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(on,{size:"xs"}),"Loading..."]}):"Use prompt",e[43]=u.formState.isSubmitting,e[44]=I):I=e[44];let M;e[45]!==u.formState.isSubmitting||e[46]!==o||e[47]!==I?(M=n.jsx(Se,{type:"submit",form:o,disabled:u.formState.isSubmitting,children:I}),e[45]=u.formState.isSubmitting,e[46]=o,e[47]=I,e[48]=M):M=e[48];let C;e[49]!==T||e[50]!==M?(C=n.jsxs(Xs,{children:[T,M]}),e[49]=T,e[50]=M,e[51]=C):C=e[51];let A;e[52]!==o||e[53]!==k||e[54]!==_||e[55]!==C?(A=n.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:k,children:[_,C]}),e[52]=o,e[53]=k,e[54]=_,e[55]=C,e[56]=A):A=e[56];let L;e[57]!==u||e[58]!==A?(L=n.jsx(Ys,{...u,children:A}),e[57]=u,e[58]=A,e[59]=L):L=e[59];let F;e[60]!==N||e[61]!==L?(F=n.jsxs(Js,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[N,L]}),e[60]=N,e[61]=L,e[62]=F):F=e[62];let z;return e[63]!==S||e[64]!==F?(z=n.jsx(Qs,{open:!0,onOpenChange:S,children:F}),e[63]=S,e[64]=F,e[65]=z):z=e[65],z}function At(s){return s?s.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function re(s,e){return s==="output-error"||s==="output-denied"?"error":s==="approval-requested"?"approval":s==="input-streaming"||s==="input-available"||s==="output-available"&&e===!0?"loading":"idle"}function ve(s){if(s==null||typeof s!="object")return;const e=s;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return s}function pn(s){return s.storage.mention}function Ia(s,e,t){s.chain().focus().insertContentAt(e,[Lt(t),{type:"text",text:" "}]).run()}function Lt(s){return{type:"mention",attrs:s}}function xn(s){const e=$.c(19),{node:t,selected:l,view:a,editor:r,getPos:o}=s,{name:i,char:d,kind:c,id:m,args:p}=t.attrs,u=l&&a.editable,f=d==="@",x=a.editable&&d==="/"&&c!=="resource";let g;e[0]!==p||e[1]!==r||e[2]!==o||e[3]!==m||e[4]!==x||e[5]!==i?(g=_=>{if(!x)return;const T=pn(r)?.onEditChip;if(!T||typeof o!="function")return;const I=o();typeof I=="number"&&(_.preventDefault(),_.stopPropagation(),T({promptId:m,promptName:i,args:p??{},pos:I}))},e[0]=p,e[1]=r,e[2]=o,e[3]=m,e[4]=x,e[5]=i,e[6]=g):g=e[6];const b=g,h=x?"cursor-pointer":"cursor-default",S=f?"bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",y=u&&"outline-2 outline-blue-300 outline-offset-0",v=x&&"hover:brightness-95";let j;e[7]!==h||e[8]!==S||e[9]!==y||e[10]!==v?(j=q("px-1 py-1 rounded","inline-flex items-center gap-1",h,"select-none","text-xs font-light",S,y,v,"capitalize"),e[7]=h,e[8]=S,e[9]=y,e[10]=v,e[11]=j):j=e[11];let N;e[12]!==i?(N=i?At(i):"",e[12]=i,e[13]=N):N=e[13];let k;return e[14]!==d||e[15]!==b||e[16]!==j||e[17]!==N?(k=n.jsxs(gt,{onClick:b,className:j,children:[d,N]}),e[14]=d,e[15]=b,e[16]=j,e[17]=N,e[18]=k):k=e[18],k}const gn=pt.create({name:"mention",group:"inline",inline:!0,atom:!0,addStorage(){return{onEditChip:null}},addAttributes(){return{id:{default:null,parseHTML:s=>s.getAttribute("data-id")||null,renderHTML:s=>s.id?{"data-id":s.id}:{}},name:{default:null,parseHTML:s=>s.getAttribute("data-name")||null,renderHTML:s=>s.name?{"data-name":s.name}:{}},char:{default:"/",parseHTML:s=>s.getAttribute("data-char")||"/",renderHTML:s=>s.char?{"data-char":s.char}:{}},metadata:{default:null,parseHTML:s=>{try{return JSON.parse(s.getAttribute("data-metadata")||"null")}catch{return null}},renderHTML:s=>s.metadata?{"data-metadata":JSON.stringify(s.metadata)}:{}},kind:{default:null,parseHTML:s=>s.getAttribute("data-kind")||null,renderHTML:s=>s.kind?{"data-kind":s.kind}:{}},args:{default:null,parseHTML:s=>{try{return JSON.parse(s.getAttribute("data-args")||"null")}catch{return null}},renderHTML:s=>s.args?{"data-args":JSON.stringify(s.args)}:{}}}},parseHTML(){return[{tag:'span[data-type="mention"]'}]},renderHTML({node:s,HTMLAttributes:e}){const t={"data-type":"mention"};return s.attrs.id&&(t["data-id"]=s.attrs.id),s.attrs.name&&(t["data-name"]=s.attrs.name),s.attrs.char&&(t["data-char"]=s.attrs.char),s.attrs.metadata&&(t["data-metadata"]=JSON.stringify(s.attrs.metadata)),s.attrs.kind&&(t["data-kind"]=s.attrs.kind),s.attrs.args&&(t["data-args"]=JSON.stringify(s.attrs.args)),["span",{...e,...t}]},renderText({node:s}){const e=s.attrs.char??"@",t=s.attrs.name??"";return`${e}${t}`},addNodeView(){return xt(xn)}}),hn=/^mcp__[a-zA-Z0-9_-]+__/;function Rt(s){return s.replace(hn,"")}function Xe(s){const e=$.c(18),{id:t,part:l,copyable:a,extraActions:r,alwaysShowActions:o,animate:i}=s,d=a===void 0?!1:a,c=o===void 0?!1:o,m=i===void 0?!1:i,{handleCopy:p}=ht(),[u,f]=H.useState(!1);let x;e[0]!==p||e[1]!==t||e[2]!==l.text?(x=async()=>{Xt("chat_message_copied",{message_id:t,chars:l.text.length}),await p(l.text),f(!0),setTimeout(()=>f(!1),2e3)},e[0]=p,e[1]=t,e[2]=l.text,e[3]=x):x=e[3];const g=x,b=d&&r,h=b||r;let S;e[4]!==m||e[5]!==t||e[6]!==l.text?(S=n.jsx(bt,{id:t,text:l.text,animate:m}),e[4]=m,e[5]=t,e[6]=l.text,e[7]=S):S=e[7];let y;e[8]!==c||e[9]!==r||e[10]!==g||e[11]!==u||e[12]!==h||e[13]!==b?(y=h&&n.jsxs("div",{className:q("flex w-full items-center gap-2 text-sm text-muted-foreground transition-all duration-200 mt-1 py-1",c?"opacity-100":"opacity-0 pointer-events-none group-hover/part:opacity-100 group-hover/part:pointer-events-auto"),children:[r,b&&r&&n.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),b&&n.jsx("button",{type:"button",onClick:g,className:"text-muted-foreground [@media(hover:hover)]:hover:text-foreground transition-colors active:scale-[0.97]","aria-label":"Copy message",children:u?n.jsx(Ve,{className:"size-4"}):n.jsx(dt,{className:"size-4"})})]}),e[8]=c,e[9]=r,e[10]=g,e[11]=u,e[12]=h,e[13]=b,e[14]=y):y=e[14];let v;return e[15]!==S||e[16]!==y?(v=n.jsxs("div",{className:"group/part relative",children:[S,y]}),e[15]=S,e[16]=y,e[17]=v):v=e[17],v}function Ma(s,e,t){s.chain().focus().insertContentAt(e,[bn(t),{type:"text",text:" "}]).run()}function bn(s){return{type:"file",attrs:s}}function yn(s){const e=$.c(17),{node:t,selected:l,view:a}=s,{name:r,mimeType:o,data:i}=t.attrs,d=l&&a.editable;let c;e[0]!==o?(c=o.startsWith("image/"),e[0]=o,e[1]=c):c=e[1];const m=c,p=d&&"outline-2 outline-blue-300 outline-offset-0";let u;e[2]!==p?(u=q("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light","bg-muted text-muted-foreground",p),e[2]=p,e[3]=u):u=e[3];let f;e[4]!==r?(f=n.jsx(pe,{asChild:!0,children:n.jsx("span",{children:r})}),e[4]=r,e[5]=f):f=e[5];let x;e[6]!==i||e[7]!==m||e[8]!==o||e[9]!==r?(x=n.jsx(xe,{side:"top",className:"max-w-sm p-1.5",children:m?n.jsx("img",{src:`data:${o};base64,${i}`,alt:r,className:"max-w-full max-h-64 object-contain rounded"}):n.jsxs("div",{className:"text-xs",children:[n.jsx("div",{className:"font-medium",children:r}),n.jsx("div",{className:"text-muted-foreground mt-1",children:o})]})}),e[6]=i,e[7]=m,e[8]=o,e[9]=r,e[10]=x):x=e[10];let g;e[11]!==f||e[12]!==x?(g=n.jsxs(ge,{children:[f,x]}),e[11]=f,e[12]=x,e[13]=g):g=e[13];let b;return e[14]!==u||e[15]!==g?(b=n.jsx(gt,{className:u,children:g}),e[14]=u,e[15]=g,e[16]=b):b=e[16],b}const jn=pt.create({name:"file",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:s=>s.getAttribute("data-id")||null,renderHTML:s=>s.id?{"data-id":s.id}:{}},name:{default:null,parseHTML:s=>s.getAttribute("data-name")||null,renderHTML:s=>s.name?{"data-name":s.name}:{}},mimeType:{default:null,parseHTML:s=>s.getAttribute("data-mime-type")||null,renderHTML:s=>s.mimeType?{"data-mime-type":s.mimeType}:{}},size:{default:0,parseHTML:s=>{const e=s.getAttribute("data-size");return e?Number.parseInt(e,10):0},renderHTML:s=>s.size?{"data-size":String(s.size)}:{}},data:{default:null,parseHTML:s=>s.getAttribute("data-data")||null,renderHTML:s=>s.data?{"data-data":s.data}:{}}}},parseHTML(){return[{tag:'span[data-type="file"]'}]},renderHTML({node:s,HTMLAttributes:e}){const t={"data-type":"file"};return s.attrs.id&&(t["data-id"]=s.attrs.id),s.attrs.name&&(t["data-name"]=s.attrs.name),s.attrs.mimeType&&(t["data-mime-type"]=s.attrs.mimeType),s.attrs.size&&(t["data-size"]=String(s.attrs.size)),s.attrs.data&&(t["data-data"]=s.attrs.data),["span",{...e,...t}]},renderText({node:s}){return`[${s.attrs.name??""}]`},addNodeView(){return xt(yn)}}),fe=16,De=2.5,Oe=(fe-De)/2,ze=2*Math.PI*Oe;function vn(s){const e=$.c(31),{usage:t}=s;if(!t)return null;const{totalTokens:l,inputTokens:a,outputTokens:r,cost:o}=t;if(!l&&!a&&!r)return null;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(es,{size:12}),e[0]=i):i=e[0];let d;e[1]!==o||e[2]!==l?(d=o>0?`$${o.toFixed(4)}`:l.toLocaleString(),e[1]=o,e[2]=l,e[3]=d):d=e[3];let c;e[4]!==d?(c=n.jsx(pe,{asChild:!0,children:n.jsxs("span",{className:"inline-flex items-center text-muted-foreground [@media(hover:hover)]:hover:text-foreground pl-1 h-6 gap-1 whitespace-nowrap shrink-0 cursor-default",children:[i,n.jsx("span",{className:"text-sm font-mono tabular-nums",children:d})]})}),e[4]=d,e[5]=c):c=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx("p",{className:"text-muted text-[10px] mb-1",children:"tokens"}),e[6]=m):m=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx("span",{className:"text-muted",children:"in"}),e[7]=p):p=e[7];let u;e[8]!==a?(u=a.toLocaleString(),e[8]=a,e[9]=u):u=e[9];let f;e[10]!==u?(f=n.jsx("span",{className:"text-right tabular-nums",children:u}),e[10]=u,e[11]=f):f=e[11];let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx("span",{className:"text-muted",children:"out"}),e[12]=x):x=e[12];const g=r-(t.reasoningTokens??0);let b;e[13]!==g?(b=g.toLocaleString(),e[13]=g,e[14]=b):b=e[14];let h;e[15]!==b?(h=n.jsx("span",{className:"text-right tabular-nums",children:b}),e[15]=b,e[16]=h):h=e[16];let S;e[17]!==a||e[18]!==t.cacheReadTokens||e[19]!==t.cacheWriteTokens?(S=(t.cacheReadTokens>0||t.cacheWriteTokens>0)&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cache hit"}),n.jsx("span",{className:"text-right tabular-nums",children:a>0?`${(t.cacheReadTokens/a*100).toFixed(0)}%`:"0%"})]}),e[17]=a,e[18]=t.cacheReadTokens,e[19]=t.cacheWriteTokens,e[20]=S):S=e[20];let y;e[21]!==o?(y=o>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cost"}),n.jsxs("span",{className:"text-right tabular-nums",children:["$",o.toFixed(4)]})]}),e[21]=o,e[22]=y):y=e[22];let v;e[23]!==h||e[24]!==S||e[25]!==y||e[26]!==f?(v=n.jsxs(xe,{side:"top",className:"font-mono text-[11px]",children:[m,n.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[p,f,x,h,S,y]})]}),e[23]=h,e[24]=S,e[25]=y,e[26]=f,e[27]=v):v=e[27];let j;return e[28]!==v||e[29]!==c?(j=n.jsxs(ge,{children:[c,v]}),e[28]=v,e[29]=c,e[30]=j):j=e[30],j}function Nn(s){const e=$.c(19),{usage:t,duration:l}=s,a=l!=null&&l>0,r=t!=null&&(t.cost??0)>0,o=t!=null&&(t.totalTokens??0)>0;if(!a&&!r&&!o)return null;let i;e[0]!==l||e[1]!==a?(i=a?de(l/1e3):null,e[0]=l,e[1]=a,e[2]=i):i=e[2];const d=i;let c;e[3]!==l||e[4]!==d||e[5]!==t?(c=d&&n.jsxs(ge,{children:[n.jsx(pe,{asChild:!0,children:n.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:d})}),n.jsxs(xe,{side:"top",className:"font-mono text-[11px]",children:[n.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"thinking"}),n.jsx("span",{className:"tabular-nums",children:de(l/1e3)}),(t?.reasoningTokens??0)>0&&n.jsxs("span",{className:"ml-2 opacity-50",children:[t.reasoningTokens.toLocaleString()," tok"]})]})]}),e[3]=l,e[4]=d,e[5]=t,e[6]=c):c=e[6];let m;e[7]!==r||e[8]!==a||e[9]!==o?(m=a&&(r||o)&&n.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),e[7]=r,e[8]=a,e[9]=o,e[10]=m):m=e[10];let p;e[11]!==r||e[12]!==o||e[13]!==t?(p=(r||o)&&n.jsxs(ge,{children:[n.jsx(pe,{asChild:!0,children:n.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:r?`$${t.cost.toFixed(4)}`:`${t.totalTokens.toLocaleString()} tok`})}),n.jsxs(xe,{side:"top",className:"font-mono text-[11px]",children:[n.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"tokens"}),n.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[n.jsx("span",{className:"opacity-60",children:"in"}),n.jsx("span",{className:"text-right tabular-nums",children:(t.inputTokens??0).toLocaleString()}),n.jsx("span",{className:"opacity-60",children:"out"}),n.jsx("span",{className:"text-right tabular-nums",children:((t.outputTokens??0)-(t?.reasoningTokens??0)).toLocaleString()}),(t?.reasoningTokens??0)>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"opacity-60",children:"think"}),n.jsx("span",{className:"text-right tabular-nums",children:t.reasoningTokens.toLocaleString()})]}),((t?.cacheReadTokens??0)>0||(t?.cacheWriteTokens??0)>0)&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"opacity-60",children:"cache hit"}),n.jsx("span",{className:"text-right tabular-nums",children:(t?.inputTokens??0)>0?`${((t?.cacheReadTokens??0)/t.inputTokens*100).toFixed(0)}%`:"0%"})]})]})]})]}),e[11]=r,e[12]=o,e[13]=t,e[14]=p):p=e[14];let u;return e[15]!==c||e[16]!==m||e[17]!==p?(u=n.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[c,m,p]}),e[15]=c,e[16]=m,e[17]=p,e[18]=u):u=e[18],u}function Aa(s){const e=$.c(51),{usage:t,totalTokens:l,contextWindow:a,onOpenContextPanel:r}=s,o=Math.min(l/a*100,100),i=ze-o/100*ze,d=t?.cost??0,c=t?.inputTokens??0,m=t?.outputTokens??0;let p;e[0]!==o?(p=o.toFixed(0),e[0]=o,e[1]=p):p=e[1];let u;e[2]!==d?(u=d>0?`, $${d.toFixed(2)}`:"",e[2]=d,e[3]=u):u=e[3];const f=`Context usage: ${p}%${u}`,x=r?"cursor-pointer":"cursor-default";let g;e[4]!==x?(g=q("flex items-center gap-1.5 text-muted-foreground hover:text-foreground h-6 px-1 shrink-0",x),e[4]=x,e[5]=g):g=e[5];let b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("circle",{cx:fe/2,cy:fe/2,r:Oe,fill:"none",stroke:"currentColor",strokeWidth:De,className:"opacity-15"}),e[6]=b):b=e[6];const h=o>90?"text-destructive":o>70?"text-warning":"text-muted-foreground";let S;e[7]!==h?(S=q(h),e[7]=h,e[8]=S):S=e[8];let y;e[9]!==i||e[10]!==S?(y=n.jsxs("svg",{width:fe,height:fe,className:"-rotate-90",children:[b,n.jsx("circle",{cx:fe/2,cy:fe/2,r:Oe,fill:"none",stroke:"currentColor",strokeWidth:De,strokeDasharray:ze,strokeDashoffset:i,strokeLinecap:"round",className:S})]}),e[9]=i,e[10]=S,e[11]=y):y=e[11];let v;e[12]!==o?(v=o.toFixed(0),e[12]=o,e[13]=v):v=e[13];let j;e[14]!==d?(j=d>0?` · $${d.toFixed(2)}`:"",e[14]=d,e[15]=j):j=e[15];let N;e[16]!==v||e[17]!==j?(N=n.jsxs("span",{className:"inline-block overflow-hidden whitespace-nowrap max-w-0 opacity-0 transition-[max-width,opacity] duration-200 ease-out @[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100 text-[11px] font-mono tabular-nums",children:[v,"%",j]}),e[16]=v,e[17]=j,e[18]=N):N=e[18];let k;e[19]!==r||e[20]!==N||e[21]!==f||e[22]!==g||e[23]!==y?(k=n.jsx(pe,{asChild:!0,children:n.jsxs("button",{type:"button",onClick:r,"aria-label":f,className:g,children:[y,N]})}),e[19]=r,e[20]=N,e[21]=f,e[22]=g,e[23]=y,e[24]=k):k=e[24];let _;e[25]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx("span",{className:"text-muted",children:"context"}),e[25]=_):_=e[25];let w;e[26]!==l?(w=l.toLocaleString(),e[26]=l,e[27]=w):w=e[27];let T;e[28]!==a?(T=a.toLocaleString(),e[28]=a,e[29]=T):T=e[29];let I;e[30]!==o?(I=o.toFixed(1),e[30]=o,e[31]=I):I=e[31];let M;e[32]!==w||e[33]!==T||e[34]!==I?(M=n.jsxs("span",{className:"text-right tabular-nums",children:[w," / ",T," (",I,"%)"]}),e[32]=w,e[33]=T,e[34]=I,e[35]=M):M=e[35];let C;e[36]!==d||e[37]!==c||e[38]!==m?(C=d>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cost"}),n.jsxs("span",{className:"text-right tabular-nums",children:["$",d.toFixed(4)]}),n.jsx("span",{className:"text-muted",children:"in"}),n.jsx("span",{className:"text-right tabular-nums",children:c.toLocaleString()}),n.jsx("span",{className:"text-muted",children:"out"}),n.jsx("span",{className:"text-right tabular-nums",children:m.toLocaleString()})]}),e[36]=d,e[37]=c,e[38]=m,e[39]=C):C=e[39];let A;e[40]!==c||e[41]!==t?.cacheReadTokens||e[42]!==t?.cacheWriteTokens?(A=((t?.cacheReadTokens??0)>0||(t?.cacheWriteTokens??0)>0)&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cache hit"}),n.jsx("span",{className:"text-right tabular-nums",children:c>0?`${((t?.cacheReadTokens??0)/c*100).toFixed(0)}%`:"0%"})]}),e[40]=c,e[41]=t?.cacheReadTokens,e[42]=t?.cacheWriteTokens,e[43]=A):A=e[43];let L;e[44]!==M||e[45]!==C||e[46]!==A?(L=n.jsx(xe,{side:"top",className:"font-mono text-[11px]",children:n.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[_,M,C,A]})}),e[44]=M,e[45]=C,e[46]=A,e[47]=L):L=e[47];let F;return e[48]!==k||e[49]!==L?(F=n.jsxs(ge,{children:[k,L]}),e[48]=k,e[49]=L,e[50]=F):F=e[50],F}function Sn(s){const e=$.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let l;return e[2]!==t?(l=n.jsx(bs,{"data-slot":"collapsible",...t}),e[2]=t,e[3]=l):l=e[3],l}function kn(s){const e=$.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let l;return e[2]!==t?(l=n.jsx(gs,{"data-slot":"collapsible-trigger",...t}),e[2]=t,e[3]=l):l=e[3],l}function _n(s){const e=$.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let l;return e[2]!==t?(l=n.jsx(hs,{"data-slot":"collapsible-content",...t}),e[2]=t,e[3]=l):l=e[3],l}function Et({containerRef:s,enabled:e,contentDeps:t=[],threshold:l,intervalMs:a=500}){const[r,o]=H.useState(null),[i,d]=H.useState(!1),c=l??(s?.95:.1),m=()=>{if(s?.current){s.current.scrollTop=s.current.scrollHeight;return}if(!r)return;let p=r.parentElement;for(;p;){const u=window.getComputedStyle(p);if(u.overflowY==="auto"||u.overflowY==="scroll"||u.overflow==="auto"||u.overflow==="scroll"){p.scrollTop=p.scrollHeight;return}p=p.parentElement}};return H.useEffect(()=>{if(!r)return;const p=new IntersectionObserver(u=>{const f=u[0]?.isIntersecting??!1;d(f)},{root:s?.current??null,threshold:c,rootMargin:"0px"});return p.observe(r),()=>p.disconnect()},[r,c]),H.useEffect(()=>{if(!e||!i)return;const p=setInterval(m,a);return()=>clearInterval(p)},[e,i,a]),H.useEffect(()=>{!e||!i||m()},[e,i,...t]),{sentinelRef:o,isTracking:i}}function B(s){const e=$.c(53),{icon:t,title:l,usage:a,summary:r,state:o,detail:i,detailVariant:d,forceOpen:c,variant:m,trailing:p,iconDestructive:u,alwaysChevron:f,defaultOpen:x,children:g}=s,b=d===void 0?"code":d,h=m===void 0?"default":m,[S,y]=H.useState(x??!1),{handleCopy:v,copied:j}=ht(),N=o==="loading",k=o==="error";let _;e[0]!==i?(_=i&&i.trim(),e[0]=i,e[1]=_):_=e[1];const T=!!_||!!g,I=h==="subtask",M=(c??!1)||S,C=H.useRef(null),A=N&&M;let L;e[2]!==i?(L=[i],e[2]=i,e[3]=L):L=e[3];let F;e[4]!==A||e[5]!==L?(F={containerRef:C,enabled:A,contentDeps:L},e[4]=A,e[5]=L,e[6]=F):F=e[6];const{sentinelRef:z}=Et(F),R=c?void 0:y,E=!T,D=T&&"[@media(hover:hover)]:hover:bg-accent/30",W=!T&&"cursor-default",U=N&&"shimmer";let O;e[7]!==W||e[8]!==U||e[9]!==D?(O=q("group/tool flex items-center gap-2 w-full py-2.5 text-left transition-colors",D,W,U),e[7]=W,e[8]=U,e[9]=D,e[10]=O):O=e[10];const K=!T;let G;e[11]!==f||e[12]!==M||e[13]!==t||e[14]!==u||e[15]!==k||e[16]!==T?(G=n.jsx("div",{className:"relative shrink-0 size-4 flex items-center justify-center",children:f?n.jsx(Ze,{className:q("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",M&&"rotate-90")}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:q("absolute inset-0 flex items-center justify-center [&>svg]:size-4 transition-opacity duration-150",u?"[&>svg]:text-destructive/70":k?"[&>svg]:text-warning/70":"[&>svg]:text-muted-foreground/75",T&&(M?"opacity-0":"[@media(hover:hover)]:group-hover/tool:opacity-0")),children:t}),T&&n.jsx("div",{className:q("absolute inset-0 flex items-center justify-center transition-opacity duration-150",M?"opacity-100":"opacity-0 [@media(hover:hover)]:group-hover/tool:opacity-100"),children:n.jsx(Ze,{className:q("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",M&&"rotate-90")})})]})}),e[11]=f,e[12]=M,e[13]=t,e[14]=u,e[15]=k,e[16]=T,e[17]=G):G=e[17];const Y=k?"text-warning/80":"text-foreground";let Q;e[18]!==Y?(Q=q("shrink-0 text-[14px] font-normal",Y),e[18]=Y,e[19]=Q):Q=e[19];let te;e[20]!==Q||e[21]!==l?(te=n.jsx("span",{className:Q,children:l}),e[20]=Q,e[21]=l,e[22]=te):te=e[22];let P;e[23]!==r?(P=r?n.jsx("span",{className:"min-w-0 flex-1 truncate",children:n.jsx("span",{className:"text-[12px] text-muted-foreground/60 bg-muted/50 rounded-[3px] px-1 py-px leading-none",children:r})}):n.jsx("div",{className:"flex-1"}),e[23]=r,e[24]=P):P=e[24];let V;e[25]!==p?(V=p&&n.jsx("div",{className:"shrink-0 flex items-center gap-1 [&_svg]:size-3.5 [&_svg]:text-muted-foreground/50",children:p}),e[25]=p,e[26]=V):V=e[26];let X;e[27]!==a?(X=n.jsx(vn,{usage:a}),e[27]=a,e[28]=X):X=e[28];let J;e[29]!==O||e[30]!==K||e[31]!==G||e[32]!==te||e[33]!==P||e[34]!==V||e[35]!==X||e[36]!==E?(J=n.jsxs(kn,{disabled:E,className:O,"aria-disabled":K,children:[G,te,P,V,X]}),e[29]=O,e[30]=K,e[31]=G,e[32]=te,e[33]=P,e[34]=V,e[35]=X,e[36]=E,e[37]=J):J=e[37];let se;e[38]!==g||e[39]!==j||e[40]!==i||e[41]!==b||e[42]!==v||e[43]!==T||e[44]!==z?(se=T&&n.jsx(_n,{className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden",children:g||(b==="prose"?n.jsx("div",{className:"mt-1 mb-1",children:n.jsxs("div",{ref:C,className:"max-h-[150px] overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:[n.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap leading-relaxed wrap-break-word",children:i}),n.jsx("div",{ref:z,className:"h-0 shrink-0"})]})}):n.jsx("div",{className:"ml-[20px] pl-3 border-l border-border/30 mt-0.5 pb-1",children:n.jsxs("div",{ref:C,className:"flex flex-col max-h-48 overflow-y-auto",children:[n.jsxs("div",{className:"flex items-start justify-between gap-2",children:[n.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:n.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:i})}),n.jsx("button",{type:"button",onClick:()=>v(i),className:"shrink-0 p-1.5 rounded-md text-muted-foreground/50 [@media(hover:hover)]:hover:text-foreground [@media(hover:hover)]:hover:bg-accent/50 transition-colors active:scale-[0.97]","aria-label":"Copy",children:j?n.jsx(Ve,{className:"size-3.5"}):n.jsx(dt,{className:"size-3.5"})})]}),n.jsx("div",{ref:z,className:"h-0 shrink-0"})]})}))}),e[38]=g,e[39]=j,e[40]=i,e[41]=b,e[42]=v,e[43]=T,e[44]=z,e[45]=se):se=e[45];let ue;e[46]!==M||e[47]!==J||e[48]!==se||e[49]!==R?(ue=n.jsxs(Sn,{open:M,onOpenChange:R,className:"min-w-0",children:[J,se]}),e[46]=M,e[47]=J,e[48]=se,e[49]=R,e[50]=ue):ue=e[50];const oe=ue;if(I){let ae;return e[51]!==oe?(ae=n.jsx("div",{className:"pl-4 border-l border-border/40 ml-1.5",children:oe}),e[51]=oe,e[52]=ae):ae=e[52],ae}return oe}function le(s){const e=$.c(4),{latency:t}=s;if(t==null||t<=0)return null;let l;e[0]!==t?(l=de(t),e[0]=t,e[1]=l):l=e[1];let a;return e[2]!==l?(a=n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground",children:l}),e[2]=l,e[3]=a):a=e[3],a}const zt=4;function Pt(s){const e=$.c(5),{count:t,noun:l,onClick:a}=s;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(ut,{className:"size-4 transition-transform group-hover:translate-x-0.5","aria-hidden":"true"}),e[0]=r):r=e[0];let o;return e[1]!==t||e[2]!==l||e[3]!==a?(o=n.jsxs("button",{type:"button",onClick:a,className:"group flex w-full items-center justify-center gap-1.5 rounded-lg border border-border bg-card px-3 py-2.5 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:["See all ",t," ",l,r]}),e[1]=t,e[2]=l,e[3]=a,e[4]=o):o=e[4],o}function wn(s){const e=$.c(24),{org:t}=he(),l=Jt(),a=Ts(),r=Ms();let o;e[0]!==r||e[1]!==s?(o=async g=>{if(!s)throw new Error("useTaskExpandedTools: no task in context");const h=(await r.call("COLLECTION_THREADS_GET",{id:s})).item?.metadata??{},y=(h.expanded_tools??[]).filter(j=>j.toolName!==g.toolName);y.push({...g,expandedAt:new Date().toISOString()});const v={...h,expanded_tools:y};return await r.call("COLLECTION_THREADS_UPDATE",{id:s,data:{metadata:v}}),y},e[0]=r,e[1]=s,e[2]=o):o=e[2];let i,d,c;e[3]!==t||e[4]!==l||e[5]!==s?(i=async g=>{const b=me.ensureTask(t.id,s??"");await l.cancelQueries({queryKey:b});const h=l.getQueryData(b),y=(h?.metadata?.expanded_tools??[]).filter(v=>v.toolName!==g.toolName);return y.push({...g,expandedAt:new Date().toISOString()}),l.setQueryData(b,v=>v&&{...v,metadata:{...v.metadata??{},expanded_tools:y}}),{previous:h}},d=()=>{l.invalidateQueries({queryKey:me.ensureTask(t.id,s??"")})},c=(g,b,h)=>{const S=me.ensureTask(t.id,s??"");h?.previous===void 0?l.removeQueries({queryKey:S,exact:!0}):l.setQueryData(S,h.previous),Fe.error(g instanceof Error?g.message:"Failed to expand tool")},e[3]=t,e[4]=l,e[5]=s,e[6]=i,e[7]=d,e[8]=c):(i=e[6],d=e[7],c=e[8]);let m;e[9]!==o||e[10]!==i||e[11]!==d||e[12]!==c?(m={mutationFn:o,onMutate:i,onSuccess:d,onError:c},e[9]=o,e[10]=i,e[11]=d,e[12]=c,e[13]=m):m=e[13];const p=Qt(m);let u;e[14]!==a||e[15]!==p||e[16]!==t||e[17]!==l||e[18]!==s?(u=g=>{if(!s||!a)return;const b=me.ensureTask(t.id,s),h=l.getQueryData(b),y=(h?.metadata?.expanded_tools??[]).filter(j=>j.toolName!==g.toolName);y.push({...g,expandedAt:new Date().toISOString()});const v={...h?.metadata??{},expanded_tools:y};l.setQueryData(b,j=>j&&{...j,metadata:v}),a.patchThread({id:s,metadata:v}),p.mutate(g)},e[14]=a,e[15]=p,e[16]=t,e[17]=l,e[18]=s,e[19]=u):u=e[19];const f=u;let x;return e[20]!==f||e[21]!==p.isPending||e[22]!==p.mutate?(x={addOrReplace:p.mutate,addOrReplaceEager:f,isPending:p.isPending},e[20]=f,e[21]=p.isPending,e[22]=p.mutate,e[23]=x):x=e[23],x}function Tn(s){if(s<1024)return`${s} B`;if(s<1024*1024){const t=s/1024;return t<10?`${t.toFixed(1)} KB`:`${Math.round(t)} KB`}const e=s/(1024*1024);return e<10?`${e.toFixed(1)} MB`:`${Math.round(e)} MB`}function Cn(s,e,t,l){const{data:a,isLoading:r}=He({queryKey:me.toolDefinitionLookup(e,t,s),queryFn:async()=>{if(!s||!e)return null;const o=await As({connectionId:e,orgId:t,orgSlug:l});try{const{tools:i}=await o.listTools(),d=Rt(s);return i.find(c=>c.name===d)??null}finally{await o.close().catch(()=>{})}},enabled:!!s&&!!e,staleTime:6e4,gcTime:3e5,retry:!1});return{toolDef:a??void 0,isLoading:r}}const $n={read:{icon:tt,label:"Read File"},write:{icon:Ps,label:"Write File"},edit:{icon:as,label:"Edit File"},grep:{icon:Ds,label:"Search Content"},glob:{icon:Fs,label:"Find Files"},bash:{icon:os,label:"Run Command"},read_tool_output:{icon:tt,label:"Read Tool Output"},read_resource:{icon:ls,label:"Read Resource"},read_prompt:{icon:kt,label:"Read Prompt"},enable_tool:{icon:zs,label:"Enable Tool"},open_in_agent:{icon:ns,label:"Open in Agent"},sandbox:{icon:ss,label:"Run Code"},copy_to_sandbox:{icon:_t,label:"Load File"},share_with_user:{icon:Os,label:"Share with User"},take_screenshot:{icon:Ne,label:"Take Screenshot"},scrape_url:{icon:Ie,label:"Scrape URL"},inspect_page:{icon:ts,label:"Inspect Page"}},In="bash-sleep-start:";function Mn(s){const e=In+s;try{const t=sessionStorage.getItem(e);if(t!==null){const a=Number.parseInt(t,10);if(Number.isFinite(a))return a}const l=Date.now();return sessionStorage.setItem(e,String(l)),l}catch{return Date.now()}}function An(s,e){const t=$.c(2);let l;t[0]!==s?(l=()=>Mn(s),t[0]=s,t[1]=l):l=t[1];const a=H.useState(l)[0];return e??a}function Ln(s){const e=Math.ceil(s/1e3);if(e<60)return`${e}s`;const t=Math.floor(e/60),l=e%60;return l?`${t}m ${l}s`:`${t}m`}function Rn(s){const e=$.c(4),{toolCallId:t,durationMs:l,anchorMs:a}=s;ft(1e3);const o=An(t,a)+l-Date.now();let i;e[0]!==o?(i=o>0?`Waiting ${Ln(o)}`:"Wrapping up…",e[0]=o,e[1]=i):i=e[1];let d;return e[2]!==i?(d=n.jsx("span",{className:"tabular-nums",children:i}),e[2]=i,e[3]=d):d=e[3],d}const En={s:1e3,m:6e4,h:36e5,d:864e5};function zn(s){const e=/(?:^|[\s;&|(])sleep((?:\s+[\d.]+[smhd]?)+)/g;let t=0,l=!1;for(const a of s.matchAll(e))for(const r of a[1].trim().split(/\s+/)){const o=/^([\d.]+)([smhd]?)$/.exec(r);if(!o)continue;const i=Number.parseFloat(o[1]);Number.isFinite(i)&&(t+=i*(En[o[2]||"s"]??1e3),l=!0)}return l?t:null}function Le(s,e="An unknown error occurred"){return"errorText"in s&&typeof s.errorText=="string"?s.errorText:e}function ye(s){if(s==null)return"";try{return JSON.stringify(s)}catch{return"[Non-serializable value]"}}function Me(s){const e=ye(s);if(e===""||e==="[Non-serializable value]")return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}const Pn=s=>s.type==="dynamic-tool"||s.type.startsWith("tool-");function Fn(s){if(!s||typeof s!="object")return null;const e=s;if(!Array.isArray(e.parts))return null;const t=[];for(const l of e.parts)if(l.type==="text"&&typeof l.text=="string")t.push(l.text);else if(l.type==="reasoning")t.push(`## Reasoning
|
|
2
2
|
${l.text}`);else if(l.type==="source-url")t.push(`## Source URL
|
|
3
3
|
${l.url}`);else if(l.type==="source-document")t.push(`## Source Document
|
|
4
4
|
${l.title}`);else if(l.type==="file")t.push(`## File
|
|
@@ -19,28 +19,28 @@ Error: Tool responded with an error`)}else if(l.state==="output-denied"){const r
|
|
|
19
19
|
Input: ${r||"[No input]"}...
|
|
20
20
|
Output: Tool execution was denied`)}}}return t.length>0?t.join(`
|
|
21
21
|
|
|
22
|
-
`):null}function Dn(s){const e=s&&typeof s=="object"&&"created_at"in s?s.created_at:void 0;return typeof e=="string"||e instanceof Date?mt(e):null}function On(s){const e=s&&typeof s=="object"&&"timeout"in s?s.timeout:void 0;return Math.min(typeof e=="number"?e:3e4,12e4)}function $e(s){const e=$.c(7),{icon:t,label:l}=s;let a;e[0]!==t?(a=n.jsx(pe,{asChild:!0,children:n.jsx("span",{className:"flex items-center",children:t})}),e[0]=t,e[1]=a):a=e[1];let r;e[2]!==l?(r=n.jsx(xe,{side:"top",children:l}),e[2]=l,e[3]=r):r=e[3];let o;return e[4]!==a||e[5]!==r?(o=n.jsxs(ge,{children:[a,r]}),e[4]=a,e[5]=r,e[6]=o):o=e[6],o}function Bn(s){const e=$.c(15),{annotations:t,toolMeta:l}=s;let a;e[0]!==l?(a=jt(l),e[0]=l,e[1]=a):a=e[1];const r=!!a;if(!t&&!r)return null;let o;e[2]!==r?(o=r&&n.jsx($e,{icon:n.jsx(it,{}),label:"Interactive"}),e[2]=r,e[3]=o):o=e[3];let i;e[4]!==t?.readOnlyHint?(i=t?.readOnlyHint&&n.jsx($e,{icon:n.jsx(xs,{}),label:"Read-only — no side effects"}),e[4]=t?.readOnlyHint,e[5]=i):i=e[5];let d;e[6]!==t?.destructiveHint?(d=t?.destructiveHint&&n.jsx($e,{icon:n.jsx(Nt,{}),label:"May modify or delete data"}),e[6]=t?.destructiveHint,e[7]=d):d=e[7];let c;e[8]!==t?.openWorldHint?(c=t?.openWorldHint&&n.jsx($e,{icon:n.jsx(Ie,{}),label:"Reaches outside this system"}),e[8]=t?.openWorldHint,e[9]=c):c=e[9];let m;return e[10]!==o||e[11]!==i||e[12]!==d||e[13]!==c?(m=n.jsxs(n.Fragment,{children:[o,i,d,c]}),e[10]=o,e[11]=i,e[12]=d,e[13]=c,e[14]=m):m=e[14],m}function Hn(s){return s<1?`${Math.round(s*1e3)}ms`:s<10?`${s.toFixed(1)}s`:`${Math.round(s)}s`}function Wn(s){const e=$.c(13),{latency:t,outputBytes:l}=s,a=typeof t=="number"&&t>0,r=typeof l=="number"&&l>=0;if(!a&&!r)return null;let o;e[0]!==a||e[1]!==t?(o=a&&n.jsx("span",{children:Hn(t)}),e[0]=a,e[1]=t,e[2]=o):o=e[2];let i;e[3]!==r||e[4]!==a?(i=a&&r&&n.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[3]=r,e[4]=a,e[5]=i):i=e[5];let d;e[6]!==r||e[7]!==l?(d=r&&n.jsx("span",{children:Tn(l)}),e[6]=r,e[7]=l,e[8]=d):d=e[8];let c;return e[9]!==o||e[10]!==i||e[11]!==d?(c=n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-mono tabular-nums text-muted-foreground/60 px-1 leading-none",children:[o,i,d]}),e[9]=o,e[10]=i,e[11]=d,e[12]=c):c=e[12],c}function Un(s,e,t){switch(s){case"input-streaming":case"input-available":return"Preparing...";case"approval-requested":return"Waiting for your approval";case"output-denied":return"Cancelled";case"output-error":return t??"Failed";case"output-available":{if(e==null)return"Done";if(typeof e=="string"){const l=e.trim();return l.length>100?l.slice(0,100)+"…":l}if(typeof e=="object"){for(const l of Object.keys(e)){const a=e[l];if(typeof a=="string"&&a.trim()){const r=a.trim();return r.length>100?r.slice(0,100)+"…":r}}return""}return String(e).slice(0,100)}default:return""}}function st(s){const e=$.c(74),{part:t,annotations:l,latency:a,outputBytes:r,isLastMessage:o,toolMeta:i}=s,d="toolName"in t&&typeof t.toolName=="string"?t.toolName:t.type==="dynamic-tool"?"Dynamic Tool":t.type.replace("tool-","")||"Tool",c=Rt(d),m=_e(),p=_s(),{org:u}=he(),{setChatOpen:f}=Bs(),x=
|
|
22
|
+
`):null}function Dn(s){const e=s&&typeof s=="object"&&"created_at"in s?s.created_at:void 0;return typeof e=="string"||e instanceof Date?mt(e):null}function On(s){const e=s&&typeof s=="object"&&"timeout"in s?s.timeout:void 0;return Math.min(typeof e=="number"?e:3e4,12e4)}function $e(s){const e=$.c(7),{icon:t,label:l}=s;let a;e[0]!==t?(a=n.jsx(pe,{asChild:!0,children:n.jsx("span",{className:"flex items-center",children:t})}),e[0]=t,e[1]=a):a=e[1];let r;e[2]!==l?(r=n.jsx(xe,{side:"top",children:l}),e[2]=l,e[3]=r):r=e[3];let o;return e[4]!==a||e[5]!==r?(o=n.jsxs(ge,{children:[a,r]}),e[4]=a,e[5]=r,e[6]=o):o=e[6],o}function Bn(s){const e=$.c(15),{annotations:t,toolMeta:l}=s;let a;e[0]!==l?(a=jt(l),e[0]=l,e[1]=a):a=e[1];const r=!!a;if(!t&&!r)return null;let o;e[2]!==r?(o=r&&n.jsx($e,{icon:n.jsx(it,{}),label:"Interactive"}),e[2]=r,e[3]=o):o=e[3];let i;e[4]!==t?.readOnlyHint?(i=t?.readOnlyHint&&n.jsx($e,{icon:n.jsx(xs,{}),label:"Read-only — no side effects"}),e[4]=t?.readOnlyHint,e[5]=i):i=e[5];let d;e[6]!==t?.destructiveHint?(d=t?.destructiveHint&&n.jsx($e,{icon:n.jsx(Nt,{}),label:"May modify or delete data"}),e[6]=t?.destructiveHint,e[7]=d):d=e[7];let c;e[8]!==t?.openWorldHint?(c=t?.openWorldHint&&n.jsx($e,{icon:n.jsx(Ie,{}),label:"Reaches outside this system"}),e[8]=t?.openWorldHint,e[9]=c):c=e[9];let m;return e[10]!==o||e[11]!==i||e[12]!==d||e[13]!==c?(m=n.jsxs(n.Fragment,{children:[o,i,d,c]}),e[10]=o,e[11]=i,e[12]=d,e[13]=c,e[14]=m):m=e[14],m}function Hn(s){return s<1?`${Math.round(s*1e3)}ms`:s<10?`${s.toFixed(1)}s`:`${Math.round(s)}s`}function Wn(s){const e=$.c(13),{latency:t,outputBytes:l}=s,a=typeof t=="number"&&t>0,r=typeof l=="number"&&l>=0;if(!a&&!r)return null;let o;e[0]!==a||e[1]!==t?(o=a&&n.jsx("span",{children:Hn(t)}),e[0]=a,e[1]=t,e[2]=o):o=e[2];let i;e[3]!==r||e[4]!==a?(i=a&&r&&n.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[3]=r,e[4]=a,e[5]=i):i=e[5];let d;e[6]!==r||e[7]!==l?(d=r&&n.jsx("span",{children:Tn(l)}),e[6]=r,e[7]=l,e[8]=d):d=e[8];let c;return e[9]!==o||e[10]!==i||e[11]!==d?(c=n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-mono tabular-nums text-muted-foreground/60 px-1 leading-none",children:[o,i,d]}),e[9]=o,e[10]=i,e[11]=d,e[12]=c):c=e[12],c}function Un(s,e,t){switch(s){case"input-streaming":case"input-available":return"Preparing...";case"approval-requested":return"Waiting for your approval";case"output-denied":return"Cancelled";case"output-error":return t??"Failed";case"output-available":{if(e==null)return"Done";if(typeof e=="string"){const l=e.trim();return l.length>100?l.slice(0,100)+"…":l}if(typeof e=="object"){for(const l of Object.keys(e)){const a=e[l];if(typeof a=="string"&&a.trim()){const r=a.trim();return r.length>100?r.slice(0,100)+"…":r}}return""}return String(e).slice(0,100)}default:return""}}function st(s){const e=$.c(74),{part:t,annotations:l,latency:a,outputBytes:r,isLastMessage:o,toolMeta:i}=s,d="toolName"in t&&typeof t.toolName=="string"?t.toolName:t.type==="dynamic-tool"?"Dynamic Tool":t.type.replace("tool-","")||"Tool",c=Rt(d),m=_e(),p=_s(),{org:u}=he(),{setChatOpen:f}=Bs(),x=qe()?.taskId??null,{addOrReplaceEager:g}=wn(x),b=je(),h=i&&typeof i=="object"&&i!==null&&"connectionId"in i&&i.connectionId!=null&&i.connectionId!==""?String(i.connectionId):p?.selectedVirtualMcp?.id??null,{toolDef:S}=Cn(h?d:null,h,u.id,u.slug),y=S?._meta??i,v=Ge(y),j=Ke(c,v),N=$n[j],k=S?.title??N?.label??At(j);let _;e[0]!==y?(_=jt(y),e[0]=y,e[1]=_):_=e[1];const w=_,T=!!w&&t.state==="output-available",I=h?`${h}:${d}`:null,M=!!l?.destructiveHint,C=T&&!!h&&!M&&!!x;let A;e[2]!==g||e[3]!==h||e[4]!==b||e[5]!==t||e[6]!==d?(A=()=>{if(!h)return;const Z="input"in t&&t.input&&typeof t.input=="object"?t.input:{};g({toolName:d,appId:h,args:Z}),b({to:".",search:ne=>({...ne,main:Cs(h,d)}),replace:!0})},e[2]=g,e[3]=h,e[4]=b,e[5]=t,e[6]=d,e[7]=A):A=e[7];const L=A;let F;e[8]!==C||e[9]!==L?(F=Z=>Z==="fullscreen"&&C?(L(),"fullscreen"):"inline",e[8]=C,e[9]=L,e[10]=F):F=e[10];const z=F;let R;e[11]!==m||e[12]!==f?(R=Z=>{const ne=Ss(Z.content);ne.content.length>0&&(f?.(!0),m?.sendMessage(ne))},e[11]=m,e[12]=f,e[13]=R):R=e[13];const E=R,D=t.state==="approval-requested"&&o===!1,W=t.state==="output-denied"||D,U=t.state==="output-available"&&typeof t.output=="object"&&t.output!=null&&"isError"in t.output&&t.output.isError===!0;let O;e[14]!==t.state?(O=re(t.state),e[14]=t.state,e[15]=O):O=e[15];const K=O,G=D||K==="approval"?"idle":U?"error":K;let Y,Q;if(e[16]!==G||e[17]!==U||e[18]!==D||e[19]!==t||e[20]!==j){Y=t.state==="output-error"?Le(t):void 0;const Z=j==="bash"&&G==="loading"&&t.input&&typeof t.input=="object"&&typeof t.input.command=="string"?t.input.command:null;let ne;e[23]!==Z?(ne=Z!==null?zn(Z):null,e[23]=Z,e[24]=ne):ne=e[24];const ee=ne;let Te;e[25]!==t.input||e[26]!==ee?(Te=ee!==null?Math.min(ee,On(t.input)):null,e[25]=t.input,e[26]=ee,e[27]=Te):Te=e[27];const Qe=Te,qt="toolCallId"in t?t.toolCallId:"";Q=Qe!==null?n.jsx(Rn,{toolCallId:qt,durationMs:Qe,anchorMs:Dn(t)}):D?"Cancelled":U?"Failed":Un(t.state,t.output,Y),e[16]=G,e[17]=U,e[18]=D,e[19]=t,e[20]=j,e[21]=Y,e[22]=Q}else Y=e[21],Q=e[22];const te=Q;let P="";t.input!==void 0&&(P=`# Input
|
|
23
23
|
`+Me(t.input)),t.state==="output-error"?(P&&(P=P+`
|
|
24
24
|
|
|
25
25
|
`),P=P+(`# Error
|
|
26
26
|
`+(Y??""))):t.output!==void 0&&!T&&(P&&(P=P+`
|
|
27
27
|
|
|
28
28
|
`),P=P+(`# Output
|
|
29
|
-
`+Me(t.output)));let
|
|
29
|
+
`+Me(t.output)));let V;e:{if(W){let ee;e[28]===Symbol.for("react.memo_cache_sentinel")?(ee=n.jsx(Rs,{}),e[28]=ee):ee=e[28],V=ee;break e}if(T){let ee;e[29]===Symbol.for("react.memo_cache_sentinel")?(ee=n.jsx(it,{className:"size-4 text-muted-foreground"}),e[29]=ee):ee=e[29],V=ee;break e}const Z=N?.icon;if(Z){let ee;e[30]!==Z?(ee=n.jsx(Z,{className:"size-4 text-muted-foreground"}),e[30]=Z,e[31]=ee):ee=e[31],V=ee;break e}let ne;e[32]===Symbol.for("react.memo_cache_sentinel")?(ne=n.jsx(rs,{className:"size-4 text-muted-foreground"}),e[32]=ne):ne=e[32],V=ne}let X;e[33]!==l||e[34]!==i?(X=n.jsx(Bn,{annotations:l,toolMeta:i}),e[33]=l,e[34]=i,e[35]=X):X=e[35];let J;e[36]!==a||e[37]!==r?(J=n.jsx(Wn,{latency:a,outputBytes:r}),e[36]=a,e[37]=r,e[38]=J):J=e[38];let se;e[39]!==X||e[40]!==J?(se=n.jsxs(n.Fragment,{children:[X,J]}),e[39]=X,e[40]=J,e[41]=se):se=e[41];const ue=P||null;let oe;e[42]!==G||e[43]!==k||e[44]!==W||e[45]!==a||e[46]!==te||e[47]!==se||e[48]!==ue||e[49]!==V?(oe=n.jsx(B,{icon:V,iconDestructive:W,trailing:se,title:k,latency:a,summary:te,state:G,detail:ue}),e[42]=G,e[43]=k,e[44]=W,e[45]=a,e[46]=te,e[47]=se,e[48]=ue,e[49]=V,e[50]=oe):oe=e[50];let ae;e[51]!==C||e[52]!==L?(ae=C&&n.jsx("div",{className:"flex justify-end mt-1.5 mb-1",children:n.jsxs("button",{type:"button",onClick:L,className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground rounded-md [@media(hover:hover)]:hover:bg-accent/50 [@media(hover:hover)]:hover:text-foreground transition-colors",children:[n.jsx(is,{className:"size-3.5"}),"Open in panel"]})}),e[51]=C,e[52]=L,e[53]=ae):ae=e[53];let be;e[54]!==C||e[55]!==p||e[56]!==h||e[57]!==k||e[58]!==E||e[59]!==z||e[60]!==T||e[61]!==y||e[62]!==u.id||e[63]!==u.slug||e[64]!==t.input||e[65]!==t.output||e[66]!==I||e[67]!==j||e[68]!==w?(be=T&&w&&h&&u?.id&&n.jsx(n.Fragment,{children:n.jsx(Yt,{fallback:Z=>{const{resetError:ne}=Z;return n.jsxs("div",{className:"mt-2 flex items-center gap-2 px-3 py-2.5 border border-dashed border-destructive/30 bg-destructive/5 rounded-lg",children:[n.jsx(Nt,{size:16,className:"shrink-0 text-destructive"}),n.jsxs("span",{className:"flex-1 text-xs text-destructive font-medium",children:["Failed to load"," ",n.jsx("span",{className:"font-mono",children:k})," app"]}),n.jsxs(Se,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1.5 shrink-0",onClick:ne,children:[n.jsx(Zt,{className:"size-3.5"}),"Retry"]})]})},children:n.jsx(H.Suspense,{fallback:n.jsx("div",{className:"mt-2 flex items-center justify-center h-12 border border-border/75 rounded-lg overflow-hidden p-3",children:n.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[n.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),n.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),children:n.jsx(Gn,{uiResourceUri:w,connectionId:h,orgId:u.id,orgSlug:u.slug,toolName:j,toolInput:t.input,toolResult:t.output,toolMeta:y,onMessage:E,onUpdateModelContext:I&&p?Z=>p.setAppContext(I,Z):void 0,onTeardown:I&&p?()=>p.clearAppContext(I):void 0,onRequestDisplayMode:C?z:void 0})})})}),e[54]=C,e[55]=p,e[56]=h,e[57]=k,e[58]=E,e[59]=z,e[60]=T,e[61]=y,e[62]=u.id,e[63]=u.slug,e[64]=t.input,e[65]=t.output,e[66]=I,e[67]=j,e[68]=w,e[69]=be):be=e[69];let we;return e[70]!==oe||e[71]!==ae||e[72]!==be?(we=n.jsxs("div",{children:[oe,ae,be]}),e[70]=oe,e[71]=ae,e[72]=be,e[73]=we):we=e[73],we}function Ft(s){return typeof s=="object"&&s!=null&&"type"in s&&s.type==="mcpToolCall"}function Vn(s){if(s!=null)return Ft(s)?s.arguments??void 0:s}function qn(s){if(s==null)return;if(Ft(s)&&s.result!=null)return s.result;if(typeof s=="object"&&"content"in s&&Array.isArray(s.content)){const t=s.content;if(t.length>0&&typeof t[0]=="object"&&t[0]!=null&&"type"in t[0])return s}const e=typeof s=="string"?s:JSON.stringify(s);return{structuredContent:typeof s=="object"&&!Array.isArray(s)?s:void 0,content:[{type:"text",text:e}]}}function Gn(s){const e=$.c(27),{uiResourceUri:t,connectionId:l,orgId:a,orgSlug:r,toolName:o,toolInput:i,toolResult:d,toolMeta:c,onMessage:m,onUpdateModelContext:p,onTeardown:u,onRequestDisplayMode:f}=s;let x;e[0]!==l||e[1]!==a||e[2]!==r?(x={connectionId:l,orgId:a,orgSlug:r},e[0]=l,e[1]=a,e[2]=r,e[3]=x):x=e[3];const g=vt(x);let b;e[4]===Symbol.for("react.memo_cache_sentinel")?(b={type:"object"},e[4]=b):b=e[4];let h;e[5]!==c?(h=c!=null&&{_meta:c},e[5]=c,e[6]=h):h=e[6];let S;e[7]!==h||e[8]!==o?(S={name:o,inputSchema:b,...h},e[7]=h,e[8]=o,e[9]=S):S=e[9];const y=S;let v;e[10]!==y?(v={tool:y},e[10]=y,e[11]=v):v=e[11];let j;e[12]!==i?(j=Vn(i),e[12]=i,e[13]=j):j=e[13];let N;e[14]!==d?(N=qn(d),e[14]=d,e[15]=N):N=e[15];let k;return e[16]!==g||e[17]!==m||e[18]!==f||e[19]!==u||e[20]!==p||e[21]!==a||e[22]!==v||e[23]!==j||e[24]!==N||e[25]!==t?(k=n.jsx("div",{className:"mt-2 border border-border/75 rounded-lg overflow-hidden p-3",children:n.jsx(ks,{resourceURI:t,orgId:a,toolInfo:v,toolInput:j,toolResult:N,client:g,onMessage:m,onUpdateModelContext:p,onTeardown:u,onRequestDisplayMode:f})}),e[16]=g,e[17]=m,e[18]=f,e[19]=u,e[20]=p,e[21]=a,e[22]=v,e[23]=j,e[24]=N,e[25]=t,e[26]=k):k=e[26],k}const nt="mesh-storage://";function Re(s){return s.startsWith(nt)?s.slice(nt.length):null}function Dt(s,e){const t=Re(s);return t!==null?`/api/${e}/files/${t}`:s}function Kn(s){if(!s?.usage)return null;const e=s.usage.inputTokens??0,t=s.usage.outputTokens??0,l=e+t;return l?{inputTokens:e,outputTokens:t,reasoningTokens:0,totalTokens:l,cost:0,cacheReadTokens:0,cacheWriteTokens:0}:null}function Xn(s){const e=$.c(13),{uri:t,orgSlug:l}=s;let a;e[0]!==l||e[1]!==t?(a=Dt(t,l),e[0]=l,e[1]=t,e[2]=a):a=e[2];const r=a;let o;e[3]!==t?(o=Re(t)!==null?t.slice(t.lastIndexOf("/")+1):"reference",e[3]=t,e[4]=o):o=e[4];const i=o;let d;e[5]!==i?(d=n.jsx(pe,{asChild:!0,children:n.jsx("span",{className:"inline-flex items-center gap-1 px-1 py-0.5 rounded bg-muted text-muted-foreground text-xs cursor-default select-none",children:i})}),e[5]=i,e[6]=d):d=e[6];let c;e[7]!==i||e[8]!==r?(c=n.jsx(xe,{side:"top",className:"max-w-sm p-1.5",children:n.jsx("img",{src:r,alt:i,className:"max-w-full max-h-64 object-contain rounded"})}),e[7]=i,e[8]=r,e[9]=c):c=e[9];let m;return e[10]!==d||e[11]!==c?(m=n.jsxs(ge,{children:[d,c]}),e[10]=d,e[11]=c,e[12]=m):m=e[12],m}function Jn(s){const e=$.c(71),{part:t,latency:l}=s,a=We();let r;e[0]!==t.state?(r=re(t.state),e[0]=t.state,e[1]=r):r=e[1];const o=r,i=t.input,d=t.output,c=d?.images;let m;e[2]!==d?(m=Kn(d),e[2]=d,e[3]=m):m=e[3];const p=m,u=d?.model;let f,x,g,b,h,S,y,v,j,N,k,_;if(e[4]!==c||e[5]!==i||e[6]!==l||e[7]!==u||e[8]!==a||e[9]!==t||e[10]!==d||e[11]!==o||e[12]!==p){h=Symbol.for("react.early_return_sentinel");e:{const A=Array.isArray(i?.referenceImages)?i.referenceImages.filter(Qn):void 0;let L;e[25]!==l?(L=l!=null&&l>0?n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:de(l)}):null,e[25]=l,e[26]=L):L=e[26];const F=L;if(o==="loading"){let z;e[27]===Symbol.for("react.memo_cache_sentinel")?(z=n.jsx(Ee,{size:14}),e[27]=z):z=e[27];let R;e[28]!==i?(R=i?.prompt?`"${i.prompt.slice(0,80)}…"`:void 0,e[28]=i,e[29]=R):R=e[29];let E;e[30]!==R?(E=n.jsx(B,{icon:z,title:"Generating image",summary:R,state:"loading"}),e[30]=R,e[31]=E):E=e[31],h=E;break e}if(o==="error"||!c||c.length===0){let z;e[32]!==t||e[33]!==o?(z=o==="error"?Le(t):void 0,e[32]=t,e[33]=o,e[34]=z):z=e[34];const R=z;let E="";i!==void 0&&(E=`# Input
|
|
30
30
|
`+Me(i)),R?(E&&(E=E+`
|
|
31
31
|
|
|
32
32
|
`),E=E+(`# Error
|
|
33
33
|
`+R)):d!==void 0&&(E&&(E=E+`
|
|
34
34
|
|
|
35
35
|
`),E=E+(`# Output
|
|
36
|
-
`+Me(d)));let D;e[35]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx(Ee,{size:14}),e[35]=D):D=e[35];const W=o==="error"?"Failed":"No images generated",U=o==="error"?"error":"idle",O=E||null;let K;e[36]!==F||e[37]!==W||e[38]!==U||e[39]!==O||e[40]!==p?(K=n.jsx(B,{icon:D,title:"Image generation",summary:W,state:U,usage:p,trailing:F,detail:O}),e[36]=F,e[37]=W,e[38]=U,e[39]=O,e[40]=p,e[41]=K):K=e[41],h=K;break e}b="flex flex-col gap-2",f=B,e[42]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(Ee,{size:14,className:"text-pink-500"}),e[42]=j):j=e[42],N="Generated image",k=u,_="idle",x=p,g=F,S="flex flex-col gap-1 pb-2 pl-6",e[43]!==i?(y=i?.prompt&&n.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:i.prompt}),e[43]=i,e[44]=y):y=e[44],v=A&&A.length>0&&n.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[n.jsx("span",{className:"text-[11px] text-muted-foreground/50",children:"references:"}),A.map((z,R)=>{const E=z.uri??z.url;return n.jsx(Xn,{uri:E,orgSlug:a.slug},R)})]})}e[4]=c,e[5]=i,e[6]=l,e[7]=u,e[8]=a,e[9]=t,e[10]=d,e[11]=o,e[12]=p,e[13]=f,e[14]=x,e[15]=g,e[16]=b,e[17]=h,e[18]=S,e[19]=y,e[20]=v,e[21]=j,e[22]=N,e[23]=k,e[24]=_}else f=e[13],x=e[14],g=e[15],b=e[16],h=e[17],S=e[18],y=e[19],v=e[20],j=e[21],N=e[22],k=e[23],_=e[24];if(h!==Symbol.for("react.early_return_sentinel"))return h;let w;e[45]!==S||e[46]!==y||e[47]!==v?(w=n.jsxs("div",{className:S,children:[y,v]}),e[45]=S,e[46]=y,e[47]=v,e[48]=w):w=e[48];let T;e[49]!==f||e[50]!==x||e[51]!==g||e[52]!==w||e[53]!==j||e[54]!==N||e[55]!==k||e[56]!==_?(T=n.jsx(f,{icon:j,title:N,summary:k,state:_,usage:x,trailing:g,children:w}),e[49]=f,e[50]=x,e[51]=g,e[52]=w,e[53]=j,e[54]=N,e[55]=k,e[56]=_,e[57]=T):T=e[57];let I;if(e[58]!==c||e[59]!==i?.prompt||e[60]!==a){let A;e[62]!==i?.prompt||e[63]!==a?(A=(L,F)=>{const z=L.uri??L.url;if(!z)return null;const R=Dt(z,a.slug);return n.jsx(yt,{src:R,alt:i?.prompt??"Generated image",children:n.jsx("img",{src:R,alt:i?.prompt??"Generated image",className:"max-w-sm max-h-80 object-contain rounded-lg border border-border hover:border-foreground/20 transition-colors"})},F)},e[62]=i?.prompt,e[63]=a,e[64]=A):A=e[64],I=c.map(A),e[58]=c,e[59]=i?.prompt,e[60]=a,e[61]=I}else I=e[61];let M;e[65]!==I?(M=n.jsx("div",{className:"flex flex-wrap gap-2",children:I}),e[65]=I,e[66]=M):M=e[66];let C;return e[67]!==b||e[68]!==T||e[69]!==M?(C=n.jsxs("div",{className:b,children:[T,M]}),e[67]=b,e[68]=T,e[69]=M,e[70]=C):C=e[70],C}function Qn(s){return s.uri??s.url}function Yn(s,e){const t=Re(s);return t!==null?`/api/${e}/files/${t}`:s}function Zn(s){const e=$.c(26),{part:t,latency:l}=s,a=We(),r=re(t.state),o=t.input,i=t.output,d=i?.image?.uri,c=i?.url??o?.url;let m;e[0]!==l?(m=l!=null&&l>0?n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:de(l)}):null,e[0]=l,e[1]=m):m=e[1];const p=m;if(r==="loading"){let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(Ne,{size:14}),e[2]=j):j=e[2];let N;return e[3]!==c?(N=n.jsx(B,{icon:j,title:"Taking screenshot",summary:c,state:"loading"}),e[3]=c,e[4]=N):N=e[4],N}if(r==="error"||i?.success===!1||!d){let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(Ne,{size:14}),e[5]=j):j=e[5];const N=i?.error??"Failed";let k;return e[6]!==p||e[7]!==N?(k=n.jsx(B,{icon:j,title:"Take screenshot",summary:N,state:"error",trailing:p}),e[6]=p,e[7]=N,e[8]=k):k=e[8],k}let u;e[9]!==a.slug||e[10]!==d?(u=Yn(d,a.slug),e[9]=a.slug,e[10]=d,e[11]=u):u=e[11];const f=u;let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(Ne,{size:14,className:"text-blue-500"}),e[12]=x):x=e[12];let g;e[13]!==p||e[14]!==c?(g=n.jsx(B,{icon:x,title:"Screenshot",summary:c,state:"idle",trailing:p}),e[13]=p,e[14]=c,e[15]=g):g=e[15];const b=c??"Screenshot",h=c??"Screenshot";let S;e[16]!==f||e[17]!==h?(S=n.jsx("img",{src:f,alt:h,className:"max-w-sm max-h-80 object-contain rounded-lg border border-border hover:border-foreground/20 transition-colors"}),e[16]=f,e[17]=h,e[18]=S):S=e[18];let y;e[19]!==f||e[20]!==b||e[21]!==S?(y=n.jsx("div",{className:"flex flex-wrap gap-2",children:n.jsx(yt,{src:f,alt:b,children:S})}),e[19]=f,e[20]=b,e[21]=S,e[22]=y):y=e[22];let v;return e[23]!==g||e[24]!==y?(v=n.jsxs("div",{className:"flex flex-col gap-2",children:[g,y]}),e[23]=g,e[24]=y,e[25]=v):v=e[25],v}function el(s,e){const t=Re(s);return t!==null?`/api/${e}/files/${t}`:s}function tl(s){if(!s?.usage)return null;const e=s.usage.inputTokens??0,t=s.usage.outputTokens??0,l=e+t;if(!l)return null;const a={providerMetadata:s.usage.providerMetadata};return{inputTokens:e,outputTokens:t,reasoningTokens:0,totalTokens:l,cost:$t(a),cacheReadTokens:0,cacheWriteTokens:0}}function sl(s){try{return new URL(s).hostname.replace(/^www\./,"")}catch{return s}}function nl(s){try{return`${new URL(s).origin}/favicon.ico`}catch{return""}}function ll(s){const e=$.c(16),{citation:t,index:l}=s;let a;e[0]!==t.url?(a=sl(t.url),e[0]=t.url,e[1]=a):a=e[1];const r=a;let o;e[2]!==t.url?(o=nl(t.url),e[2]=t.url,e[3]=o):o=e[3];const i=o,d=t.title||r;let c;e[4]!==i?(c=n.jsx("img",{src:i,alt:"",className:"size-3.5 rounded-sm shrink-0",onError:ol}),e[4]=i,e[5]=c):c=e[5];let m;e[6]!==d?(m=n.jsx("span",{className:"truncate max-w-[180px]",children:d}),e[6]=d,e[7]=m):m=e[7];const p=l+1;let u;e[8]!==p?(u=n.jsxs("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums shrink-0",children:["[",p,"]"]}),e[8]=p,e[9]=u):u=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(wt,{size:10,className:"shrink-0 opacity-0 group-hover/src:opacity-100 transition-opacity"}),e[10]=f):f=e[10];let x;return e[11]!==t.url||e[12]!==c||e[13]!==m||e[14]!==u?(x=n.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"group/src inline-flex items-center gap-1.5 rounded-md border border-border/50 bg-muted/30 px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/60 hover:border-border hover:text-foreground",children:[c,m,u,f]}),e[11]=t.url,e[12]=c,e[13]=m,e[14]=u,e[15]=x):x=e[15],x}function ol(s){s.target.style.display="none"}function al(s,e){return s.replace(/\[(\d+)\]/g,(t,l)=>{const a=parseInt(l,10)-1,r=e[a];return r?`[\\[${l}\\]](${r.url})`:t})}const Pe=5;function rl(s){const e=$.c(12),{citations:t}=s,[l,a]=H.useState(!1),r=t.length>Pe;let o;e[0]!==t||e[1]!==l?(o=l?t:t.slice(0,Pe),e[0]=t,e[1]=l,e[2]=o):o=e[2];const i=o;let d;e[3]!==i?(d=i.map(cl),e[3]=i,e[4]=d):d=e[4];let c;e[5]!==t.length||e[6]!==l||e[7]!==r?(c=r&&n.jsx("button",{type:"button",onClick:()=>a(il),className:"inline-flex items-center rounded-md border border-border/50 bg-muted/30 px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/60 hover:border-border hover:text-foreground",children:l?"show less":`+${t.length-Pe} more`}),e[5]=t.length,e[6]=l,e[7]=r,e[8]=c):c=e[8];let m;return e[9]!==d||e[10]!==c?(m=n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[d,c]}),e[9]=d,e[10]=c,e[11]=m):m=e[11],m}function il(s){return!s}function cl(s,e){return n.jsx(ll,{citation:s,index:e},s.url)}function ul(s){const e=$.c(51),{part:t,latency:l,streamingText:a}=s,r=We();let o;e[0]!==t.state?(o=re(t.state),e[0]=t.state,e[1]=o):o=e[1];const i=o,d=t.input,c=t.output;let m,p,u;e[2]!==r||e[3]!==c?(m=c?.uri?el(c.uri,r.slug):void 0,u=He,p=me.webSearchBlob(m??""),e[2]=r,e[3]=c,e[4]=m,e[5]=p,e[6]=u):(m=e[4],p=e[5],u=e[6]);let f;e[7]!==m?(f=async()=>{const U=await fetch(m);if(!U.ok)throw new Error(`Failed to fetch: ${U.status}`);return U.text()},e[7]=m,e[8]=f):f=e[8];const x=!!m;let g;e[9]!==p||e[10]!==f||e[11]!==x?(g={queryKey:p,queryFn:f,enabled:x,staleTime:1/0},e[9]=p,e[10]=f,e[11]=x,e[12]=g):g=e[12];const{data:b}=u(g),h=i==="loading",S=i!=="loading"&&i!=="error",y=c?.citations;let v;e[13]!==c?(v=tl(c),e[13]=c,e[14]=v):v=e[14];const j=v,N=c?.content??b??a;let k;e[15]!==y||e[16]!==N?(k=N&&y?.length?al(N,y):N,e[15]=y,e[16]=N,e[17]=k):k=e[17];const _=k;let w;e[18]!==l?(w=l!=null&&l>0?n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:de(l)}):null,e[18]=l,e[19]=w):w=e[19];const T=w;if(i==="error"){let U;e[20]===Symbol.for("react.memo_cache_sentinel")?(U=n.jsx(Ie,{size:14}),e[20]=U):U=e[20];let O;return e[21]!==T||e[22]!==j?(O=n.jsx(B,{icon:U,title:"Web search",summary:"Failed",state:"error",usage:j,trailing:T}),e[21]=T,e[22]=j,e[23]=O):O=e[23],O}const I=h?"animate-pulse":"text-blue-500";let M;e[24]!==I?(M=V(I),e[24]=I,e[25]=M):M=e[25];let C;e[26]!==M?(C=n.jsx(Ie,{size:14,className:M}),e[26]=M,e[27]=C):C=e[27];const A=h?"Researching...":"Web search";let L;e[28]!==d||e[29]!==S||e[30]!==c?.model?(L=S?c?.model??d?.query?.slice(0,60):d?.query?`"${d.query.slice(0,80)}"`:void 0,e[28]=d,e[29]=S,e[30]=c?.model,e[31]=L):L=e[31];const F=h?"loading":"idle";let z;e[32]!==d?(z=d?.query&&n.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:d.query}),e[32]=d,e[33]=z):z=e[33];let R;e[34]!==_||e[35]!==t.toolCallId?(R=_?n.jsx("div",{className:"max-h-96 overflow-y-auto overflow-x-hidden rounded-lg border border-border/40 bg-muted/20 px-4 py-3 min-w-0",children:n.jsx("div",{className:"prose prose-sm prose-neutral dark:prose-invert max-w-none text-[13px] leading-relaxed break-words",children:n.jsx(bt,{id:t.toolCallId,text:_})})}):n.jsx("div",{className:"rounded-lg border border-border/40 bg-muted/20 px-4 py-3",children:n.jsxs("div",{className:"space-y-2 animate-pulse",children:[n.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-3/4"}),n.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-1/2"})]})}),e[34]=_,e[35]=t.toolCallId,e[36]=R):R=e[36];let E;e[37]!==y?(E=y&&y.length>0&&n.jsx(rl,{citations:y}),e[37]=y,e[38]=E):E=e[38];let D;e[39]!==z||e[40]!==R||e[41]!==E?(D=n.jsxs("div",{className:"pl-6 pb-3 flex flex-col gap-1 min-w-0",children:[z,R,E]}),e[39]=z,e[40]=R,e[41]=E,e[42]=D):D=e[42];let W;return e[43]!==T||e[44]!==C||e[45]!==A||e[46]!==L||e[47]!==F||e[48]!==D||e[49]!==j?(W=n.jsx(B,{icon:C,title:A,summary:L,state:F,usage:j,trailing:T,defaultOpen:!0,children:D}),e[43]=T,e[44]=C,e[45]=A,e[46]=L,e[47]=F,e[48]=D,e[49]=j,e[50]=W):W=e[50],W}function dl(s){const e=$.c(14),{part:t}=s;if(!t.state.startsWith("output-"))return null;let l;e[0]!==t.input?.prompt?(l=t.input?.prompt?.trim()||"Question",e[0]=t.input?.prompt,e[1]=l):l=e[1];const a=l,r=t.state==="output-error"||t.state==="output-denied",o=t.state==="output-denied";let i;e[2]!==o||e[3]!==t?(i=o?"Skipped":t.state==="output-error"?Le(t)??"Error":t.output?.response??"",e[2]=o,e[3]=t,e[4]=i):i=e[4];const d=i;let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(ms,{className:"size-4 text-muted-foreground/50 shrink-0 mt-0.5"}),e[5]=c):c=e[5];let m;e[6]!==a?(m=n.jsxs("div",{className:"flex items-start gap-2",children:[c,n.jsx("span",{className:"text-[14px] text-muted-foreground leading-snug",children:a})]}),e[6]=a,e[7]=m):m=e[7];let p;e[8]!==d||e[9]!==r?(p=d&&n.jsx("div",{className:"ml-6 pl-2 border-l border-border/50",children:n.jsx("span",{className:V("text-[14px] leading-snug",r?"text-muted-foreground/50 italic":"text-foreground/70"),children:d})}),e[8]=d,e[9]=r,e[10]=p):p=e[10];let u;return e[11]!==m||e[12]!==p?(u=n.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[m,p]}),e[11]=m,e[12]=p,e[13]=u):u=e[13],u}function fl(s){if(s&&typeof s=="object"&&!Array.isArray(s)){const e=s;if(typeof e.text=="string"||typeof e.error=="string"||typeof e.finishReason=="string"){if(typeof e.error=="string"&&e.error.length>0)return`Subtask failed: ${e.error}`;const l=typeof e.text=="string"?e.text.trim():"",a=e.finishReason==="length";return l?(a?`[Subtask hit step limit — partial result below; consider narrowing the task.]
|
|
36
|
+
`+Me(d)));let D;e[35]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx(Ee,{size:14}),e[35]=D):D=e[35];const W=o==="error"?"Failed":"No images generated",U=o==="error"?"error":"idle",O=E||null;let K;e[36]!==F||e[37]!==W||e[38]!==U||e[39]!==O||e[40]!==p?(K=n.jsx(B,{icon:D,title:"Image generation",summary:W,state:U,usage:p,trailing:F,detail:O}),e[36]=F,e[37]=W,e[38]=U,e[39]=O,e[40]=p,e[41]=K):K=e[41],h=K;break e}b="flex flex-col gap-2",f=B,e[42]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(Ee,{size:14,className:"text-pink-500"}),e[42]=j):j=e[42],N="Generated image",k=u,_="idle",x=p,g=F,S="flex flex-col gap-1 pb-2 pl-6",e[43]!==i?(y=i?.prompt&&n.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:i.prompt}),e[43]=i,e[44]=y):y=e[44],v=A&&A.length>0&&n.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[n.jsx("span",{className:"text-[11px] text-muted-foreground/50",children:"references:"}),A.map((z,R)=>{const E=z.uri??z.url;return n.jsx(Xn,{uri:E,orgSlug:a.slug},R)})]})}e[4]=c,e[5]=i,e[6]=l,e[7]=u,e[8]=a,e[9]=t,e[10]=d,e[11]=o,e[12]=p,e[13]=f,e[14]=x,e[15]=g,e[16]=b,e[17]=h,e[18]=S,e[19]=y,e[20]=v,e[21]=j,e[22]=N,e[23]=k,e[24]=_}else f=e[13],x=e[14],g=e[15],b=e[16],h=e[17],S=e[18],y=e[19],v=e[20],j=e[21],N=e[22],k=e[23],_=e[24];if(h!==Symbol.for("react.early_return_sentinel"))return h;let w;e[45]!==S||e[46]!==y||e[47]!==v?(w=n.jsxs("div",{className:S,children:[y,v]}),e[45]=S,e[46]=y,e[47]=v,e[48]=w):w=e[48];let T;e[49]!==f||e[50]!==x||e[51]!==g||e[52]!==w||e[53]!==j||e[54]!==N||e[55]!==k||e[56]!==_?(T=n.jsx(f,{icon:j,title:N,summary:k,state:_,usage:x,trailing:g,children:w}),e[49]=f,e[50]=x,e[51]=g,e[52]=w,e[53]=j,e[54]=N,e[55]=k,e[56]=_,e[57]=T):T=e[57];let I;if(e[58]!==c||e[59]!==i?.prompt||e[60]!==a){let A;e[62]!==i?.prompt||e[63]!==a?(A=(L,F)=>{const z=L.uri??L.url;if(!z)return null;const R=Dt(z,a.slug);return n.jsx(yt,{src:R,alt:i?.prompt??"Generated image",children:n.jsx("img",{src:R,alt:i?.prompt??"Generated image",className:"max-w-sm max-h-80 object-contain rounded-lg border border-border hover:border-foreground/20 transition-colors"})},F)},e[62]=i?.prompt,e[63]=a,e[64]=A):A=e[64],I=c.map(A),e[58]=c,e[59]=i?.prompt,e[60]=a,e[61]=I}else I=e[61];let M;e[65]!==I?(M=n.jsx("div",{className:"flex flex-wrap gap-2",children:I}),e[65]=I,e[66]=M):M=e[66];let C;return e[67]!==b||e[68]!==T||e[69]!==M?(C=n.jsxs("div",{className:b,children:[T,M]}),e[67]=b,e[68]=T,e[69]=M,e[70]=C):C=e[70],C}function Qn(s){return s.uri??s.url}function Yn(s,e){const t=Re(s);return t!==null?`/api/${e}/files/${t}`:s}function Zn(s){const e=$.c(26),{part:t,latency:l}=s,a=We(),r=re(t.state),o=t.input,i=t.output,d=i?.image?.uri,c=i?.url??o?.url;let m;e[0]!==l?(m=l!=null&&l>0?n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:de(l)}):null,e[0]=l,e[1]=m):m=e[1];const p=m;if(r==="loading"){let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(Ne,{size:14}),e[2]=j):j=e[2];let N;return e[3]!==c?(N=n.jsx(B,{icon:j,title:"Taking screenshot",summary:c,state:"loading"}),e[3]=c,e[4]=N):N=e[4],N}if(r==="error"||i?.success===!1||!d){let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(Ne,{size:14}),e[5]=j):j=e[5];const N=i?.error??"Failed";let k;return e[6]!==p||e[7]!==N?(k=n.jsx(B,{icon:j,title:"Take screenshot",summary:N,state:"error",trailing:p}),e[6]=p,e[7]=N,e[8]=k):k=e[8],k}let u;e[9]!==a.slug||e[10]!==d?(u=Yn(d,a.slug),e[9]=a.slug,e[10]=d,e[11]=u):u=e[11];const f=u;let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(Ne,{size:14,className:"text-blue-500"}),e[12]=x):x=e[12];let g;e[13]!==p||e[14]!==c?(g=n.jsx(B,{icon:x,title:"Screenshot",summary:c,state:"idle",trailing:p}),e[13]=p,e[14]=c,e[15]=g):g=e[15];const b=c??"Screenshot",h=c??"Screenshot";let S;e[16]!==f||e[17]!==h?(S=n.jsx("img",{src:f,alt:h,className:"max-w-sm max-h-80 object-contain rounded-lg border border-border hover:border-foreground/20 transition-colors"}),e[16]=f,e[17]=h,e[18]=S):S=e[18];let y;e[19]!==f||e[20]!==b||e[21]!==S?(y=n.jsx("div",{className:"flex flex-wrap gap-2",children:n.jsx(yt,{src:f,alt:b,children:S})}),e[19]=f,e[20]=b,e[21]=S,e[22]=y):y=e[22];let v;return e[23]!==g||e[24]!==y?(v=n.jsxs("div",{className:"flex flex-col gap-2",children:[g,y]}),e[23]=g,e[24]=y,e[25]=v):v=e[25],v}function el(s,e){const t=Re(s);return t!==null?`/api/${e}/files/${t}`:s}function tl(s){if(!s?.usage)return null;const e=s.usage.inputTokens??0,t=s.usage.outputTokens??0,l=e+t;if(!l)return null;const a={providerMetadata:s.usage.providerMetadata};return{inputTokens:e,outputTokens:t,reasoningTokens:0,totalTokens:l,cost:$t(a),cacheReadTokens:0,cacheWriteTokens:0}}function sl(s){try{return new URL(s).hostname.replace(/^www\./,"")}catch{return s}}function nl(s){try{return`${new URL(s).origin}/favicon.ico`}catch{return""}}function ll(s){const e=$.c(16),{citation:t,index:l}=s;let a;e[0]!==t.url?(a=sl(t.url),e[0]=t.url,e[1]=a):a=e[1];const r=a;let o;e[2]!==t.url?(o=nl(t.url),e[2]=t.url,e[3]=o):o=e[3];const i=o,d=t.title||r;let c;e[4]!==i?(c=n.jsx("img",{src:i,alt:"",className:"size-3.5 rounded-sm shrink-0",onError:ol}),e[4]=i,e[5]=c):c=e[5];let m;e[6]!==d?(m=n.jsx("span",{className:"truncate max-w-[180px]",children:d}),e[6]=d,e[7]=m):m=e[7];const p=l+1;let u;e[8]!==p?(u=n.jsxs("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums shrink-0",children:["[",p,"]"]}),e[8]=p,e[9]=u):u=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(wt,{size:10,className:"shrink-0 opacity-0 group-hover/src:opacity-100 transition-opacity"}),e[10]=f):f=e[10];let x;return e[11]!==t.url||e[12]!==c||e[13]!==m||e[14]!==u?(x=n.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"group/src inline-flex items-center gap-1.5 rounded-md border border-border/50 bg-muted/30 px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/60 hover:border-border hover:text-foreground",children:[c,m,u,f]}),e[11]=t.url,e[12]=c,e[13]=m,e[14]=u,e[15]=x):x=e[15],x}function ol(s){s.target.style.display="none"}function al(s,e){return s.replace(/\[(\d+)\]/g,(t,l)=>{const a=parseInt(l,10)-1,r=e[a];return r?`[\\[${l}\\]](${r.url})`:t})}const Pe=5;function rl(s){const e=$.c(12),{citations:t}=s,[l,a]=H.useState(!1),r=t.length>Pe;let o;e[0]!==t||e[1]!==l?(o=l?t:t.slice(0,Pe),e[0]=t,e[1]=l,e[2]=o):o=e[2];const i=o;let d;e[3]!==i?(d=i.map(cl),e[3]=i,e[4]=d):d=e[4];let c;e[5]!==t.length||e[6]!==l||e[7]!==r?(c=r&&n.jsx("button",{type:"button",onClick:()=>a(il),className:"inline-flex items-center rounded-md border border-border/50 bg-muted/30 px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/60 hover:border-border hover:text-foreground",children:l?"show less":`+${t.length-Pe} more`}),e[5]=t.length,e[6]=l,e[7]=r,e[8]=c):c=e[8];let m;return e[9]!==d||e[10]!==c?(m=n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[d,c]}),e[9]=d,e[10]=c,e[11]=m):m=e[11],m}function il(s){return!s}function cl(s,e){return n.jsx(ll,{citation:s,index:e},s.url)}function ul(s){const e=$.c(51),{part:t,latency:l,streamingText:a}=s,r=We();let o;e[0]!==t.state?(o=re(t.state),e[0]=t.state,e[1]=o):o=e[1];const i=o,d=t.input,c=t.output;let m,p,u;e[2]!==r||e[3]!==c?(m=c?.uri?el(c.uri,r.slug):void 0,u=He,p=me.webSearchBlob(m??""),e[2]=r,e[3]=c,e[4]=m,e[5]=p,e[6]=u):(m=e[4],p=e[5],u=e[6]);let f;e[7]!==m?(f=async()=>{const U=await fetch(m);if(!U.ok)throw new Error(`Failed to fetch: ${U.status}`);return U.text()},e[7]=m,e[8]=f):f=e[8];const x=!!m;let g;e[9]!==p||e[10]!==f||e[11]!==x?(g={queryKey:p,queryFn:f,enabled:x,staleTime:1/0},e[9]=p,e[10]=f,e[11]=x,e[12]=g):g=e[12];const{data:b}=u(g),h=i==="loading",S=i!=="loading"&&i!=="error",y=c?.citations;let v;e[13]!==c?(v=tl(c),e[13]=c,e[14]=v):v=e[14];const j=v,N=c?.content??b??a;let k;e[15]!==y||e[16]!==N?(k=N&&y?.length?al(N,y):N,e[15]=y,e[16]=N,e[17]=k):k=e[17];const _=k;let w;e[18]!==l?(w=l!=null&&l>0?n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:de(l)}):null,e[18]=l,e[19]=w):w=e[19];const T=w;if(i==="error"){let U;e[20]===Symbol.for("react.memo_cache_sentinel")?(U=n.jsx(Ie,{size:14}),e[20]=U):U=e[20];let O;return e[21]!==T||e[22]!==j?(O=n.jsx(B,{icon:U,title:"Web search",summary:"Failed",state:"error",usage:j,trailing:T}),e[21]=T,e[22]=j,e[23]=O):O=e[23],O}const I=h?"animate-pulse":"text-blue-500";let M;e[24]!==I?(M=q(I),e[24]=I,e[25]=M):M=e[25];let C;e[26]!==M?(C=n.jsx(Ie,{size:14,className:M}),e[26]=M,e[27]=C):C=e[27];const A=h?"Researching...":"Web search";let L;e[28]!==d||e[29]!==S||e[30]!==c?.model?(L=S?c?.model??d?.query?.slice(0,60):d?.query?`"${d.query.slice(0,80)}"`:void 0,e[28]=d,e[29]=S,e[30]=c?.model,e[31]=L):L=e[31];const F=h?"loading":"idle";let z;e[32]!==d?(z=d?.query&&n.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:d.query}),e[32]=d,e[33]=z):z=e[33];let R;e[34]!==_||e[35]!==t.toolCallId?(R=_?n.jsx("div",{className:"max-h-96 overflow-y-auto overflow-x-hidden rounded-lg border border-border/40 bg-muted/20 px-4 py-3 min-w-0",children:n.jsx("div",{className:"prose prose-sm prose-neutral dark:prose-invert max-w-none text-[13px] leading-relaxed break-words",children:n.jsx(bt,{id:t.toolCallId,text:_})})}):n.jsx("div",{className:"rounded-lg border border-border/40 bg-muted/20 px-4 py-3",children:n.jsxs("div",{className:"space-y-2 animate-pulse",children:[n.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-3/4"}),n.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-1/2"})]})}),e[34]=_,e[35]=t.toolCallId,e[36]=R):R=e[36];let E;e[37]!==y?(E=y&&y.length>0&&n.jsx(rl,{citations:y}),e[37]=y,e[38]=E):E=e[38];let D;e[39]!==z||e[40]!==R||e[41]!==E?(D=n.jsxs("div",{className:"pl-6 pb-3 flex flex-col gap-1 min-w-0",children:[z,R,E]}),e[39]=z,e[40]=R,e[41]=E,e[42]=D):D=e[42];let W;return e[43]!==T||e[44]!==C||e[45]!==A||e[46]!==L||e[47]!==F||e[48]!==D||e[49]!==j?(W=n.jsx(B,{icon:C,title:A,summary:L,state:F,usage:j,trailing:T,defaultOpen:!0,children:D}),e[43]=T,e[44]=C,e[45]=A,e[46]=L,e[47]=F,e[48]=D,e[49]=j,e[50]=W):W=e[50],W}function dl(s){const e=$.c(14),{part:t}=s;if(!t.state.startsWith("output-"))return null;let l;e[0]!==t.input?.prompt?(l=t.input?.prompt?.trim()||"Question",e[0]=t.input?.prompt,e[1]=l):l=e[1];const a=l,r=t.state==="output-error"||t.state==="output-denied",o=t.state==="output-denied";let i;e[2]!==o||e[3]!==t?(i=o?"Skipped":t.state==="output-error"?Le(t)??"Error":t.output?.response??"",e[2]=o,e[3]=t,e[4]=i):i=e[4];const d=i;let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(ms,{className:"size-4 text-muted-foreground/50 shrink-0 mt-0.5"}),e[5]=c):c=e[5];let m;e[6]!==a?(m=n.jsxs("div",{className:"flex items-start gap-2",children:[c,n.jsx("span",{className:"text-[14px] text-muted-foreground leading-snug",children:a})]}),e[6]=a,e[7]=m):m=e[7];let p;e[8]!==d||e[9]!==r?(p=d&&n.jsx("div",{className:"ml-6 pl-2 border-l border-border/50",children:n.jsx("span",{className:q("text-[14px] leading-snug",r?"text-muted-foreground/50 italic":"text-foreground/70"),children:d})}),e[8]=d,e[9]=r,e[10]=p):p=e[10];let u;return e[11]!==m||e[12]!==p?(u=n.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[m,p]}),e[11]=m,e[12]=p,e[13]=u):u=e[13],u}function fl(s){if(s&&typeof s=="object"&&!Array.isArray(s)){const e=s;if(typeof e.text=="string"||typeof e.error=="string"||typeof e.finishReason=="string"){if(typeof e.error=="string"&&e.error.length>0)return`Subtask failed: ${e.error}`;const l=typeof e.text=="string"?e.text.trim():"",a=e.finishReason==="length";return l?(a?`[Subtask hit step limit — partial result below; consider narrowing the task.]
|
|
37
37
|
|
|
38
38
|
`:"")+l:a?"[Subtask hit step limit before producing a final report. The subagent did work but ran out of steps. Narrow the task or increase the budget.]":"Subtask completed (no output)."}}return Fn(s)}function Ot({part:s,subtaskMeta:e,latency:t}){const l=s.state==="input-streaming"||s.state==="input-available",a=s.state==="output-available"&&s.preliminary===!0,r=s.state==="output-available"&&!s.preliminary,o=s.state==="output-error",i=re(s.state,"preliminary"in s?s.preliminary:!1),d=i==="approval"?"idle":i,c=l?"Starting subtask...":a?"Subtask running...":r?"Subtask completed":o?"Subtask failed":"Subtask",m=s.input?.prompt??"",p=s.state==="approval-requested"?"Awaiting approval...":m.length>120?m.slice(0,120)+"…":m,x=(o?Le(s):fl(s.output))??(l||a?"":"No output available"),g=`# Task
|
|
39
39
|
${s.input?.prompt??"No prompt provided"}
|
|
40
40
|
|
|
41
41
|
# ${o?"Error":"Result"}
|
|
42
|
-
${x}`;return{fallbackTitle:c,summary:p,usage:e?.usage,latency:t,detail:g,state:d}}function ml(s){const e=$.c(7),t=Ot(s);let l,a;e[0]!==t?({fallbackTitle:l,...a}=t,e[0]=t,e[1]=l,e[2]=a):(l=e[1],a=e[2]);let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(Ae,{icon:void 0,name:"Subtask",size:"2xs",className:"rounded-xs",fallbackIcon:n.jsx(Tt,{})}),e[3]=r):r=e[3];let o;return e[4]!==l||e[5]!==a?(o=n.jsx(B,{icon:r,title:l,...a}),e[4]=l,e[5]=a,e[6]=o):o=e[6],o}function pl(s){const e=$.c(11),t=Ot(s);let l,a;e[0]!==t?({fallbackTitle:l,...a}=t,e[0]=t,e[1]=l,e[2]=a):(l=e[1],a=e[2]);const r=Ws(s.part.input?.agent_id),o=r?.icon,i=r?.title??"Subtask";let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Tt,{}),e[3]=d):d=e[3];let c;e[4]!==o||e[5]!==i?(c=n.jsx(Ae,{icon:o,name:i,size:"2xs",className:"rounded-xs",fallbackIcon:d}),e[4]=o,e[5]=i,e[6]=c):c=e[6];const m=r?.title??l;let p;return e[7]!==a||e[8]!==c||e[9]!==m?(p=n.jsx(B,{icon:c,title:m,...a}),e[7]=a,e[8]=c,e[9]=m,e[10]=p):p=e[10],p}function xl(s){const e=$.c(16),{part:t}=s;if(!t.state.startsWith("output-"))return null;const l=t.input?.plan??"",r=t.output?.approved===!0;let o,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(kt,{className:"size-4 text-purple-500 shrink-0"}),i=n.jsx("span",{className:"text-[14px] font-medium text-foreground/80",children:"Implementation Plan"}),e[0]=o,e[1]=i):(o=e[0],i=e[1]);let d;e[2]!==r?(d=r&&n.jsxs("span",{className:"flex items-center gap-1 text-xs text-green-600 bg-green-500/10 px-1.5 py-0.5 rounded-md",children:[n.jsx(qe,{size:12}),"Approved"]}),e[2]=r,e[3]=d):d=e[3];let c;e[4]!==r||e[5]!==t.state?(c=!r&&t.state==="output-available"&&n.jsx("span",{className:"text-xs text-muted-foreground/70 italic",children:"Rejected"}),e[4]=r,e[5]=t.state,e[6]=c):c=e[6];let m;e[7]!==d||e[8]!==c?(m=n.jsxs("div",{className:"flex items-center gap-2",children:[o,i,d,c]}),e[7]=d,e[8]=c,e[9]=m):m=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:"View plan"}),e[10]=p):p=e[10];let u;e[11]!==l?(u=n.jsxs("details",{className:"ml-6",children:[p,n.jsx("div",{className:"mt-1 pl-2 border-l-2 border-purple-500/30 prose prose-sm max-w-none text-sm",children:n.jsx(Xe,{id:"plan-content",part:{type:"text",text:l}})})]}),e[11]=l,e[12]=u):u=e[12];let f;return e[13]!==m||e[14]!==u?(f=n.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[m,u]}),e[13]=m,e[14]=u,e[15]=f):f=e[15],f}const Je={primary:"Primary",secondary:"Secondary",accent:"Accent",background:"Background",foreground:"Foreground"};function gl(s){return s.startsWith("http")?s:`https://${s}`}function lt(s){const e=$.c(2),{children:t}=s;let l;return e[0]!==t?(l=n.jsx("span",{className:"text-sm font-medium text-foreground",children:t}),e[0]=t,e[1]=l):l=e[1],l}function hl(s){const e=$.c(12),{name:t,value:l}=s;let a;e[0]!==l?(a=n.jsx("span",{className:"size-7 shrink-0 rounded-md border border-border",style:{backgroundColor:l},"aria-hidden":!0}),e[0]=l,e[1]=a):a=e[1];let r;e[2]!==t?(r=n.jsx("span",{className:"text-sm text-foreground",children:t}),e[2]=t,e[3]=r):r=e[3];let o;e[4]!==l?(o=n.jsx("span",{className:"text-xs font-mono tabular-nums text-muted-foreground",children:l}),e[4]=l,e[5]=o):o=e[5];let i;e[6]!==r||e[7]!==o?(i=n.jsxs("div",{className:"flex flex-col leading-tight min-w-0",children:[r,o]}),e[6]=r,e[7]=o,e[8]=i):i=e[8];let d;return e[9]!==a||e[10]!==i?(d=n.jsxs("div",{className:"flex items-center gap-2.5",children:[a,i]}),e[9]=a,e[10]=i,e[11]=d):d=e[11],d}function bl(s){const e=$.c(15),{role:t,family:l}=s;let a;e[0]!==l?(a=n.jsx("span",{className:"text-2xl font-medium leading-none text-foreground shrink-0",style:{fontFamily:l},"aria-hidden":!0,children:"Aa"}),e[0]=l,e[1]=a):a=e[1];let r;e[2]!==t?(r=n.jsx("span",{className:"text-xs text-muted-foreground",children:t}),e[2]=t,e[3]=r):r=e[3];let o;e[4]!==l?(o={fontFamily:l},e[4]=l,e[5]=o):o=e[5];let i;e[6]!==l||e[7]!==o?(i=n.jsx("span",{className:"text-sm text-foreground",style:o,children:l}),e[6]=l,e[7]=o,e[8]=i):i=e[8];let d;e[9]!==r||e[10]!==i?(d=n.jsxs("div",{className:"flex flex-col leading-tight",children:[r,i]}),e[9]=r,e[10]=i,e[11]=d):d=e[11];let c;return e[12]!==a||e[13]!==d?(c=n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted px-4 py-3",children:[a,d]}),e[12]=a,e[13]=d,e[14]=c):c=e[14],c}function yl(s){const e=$.c(3),{logo:t,favicon:l,name:a}=s,r=t??l;if(!r)return null;const o=a?`${a} logo`:"";let i;return e[0]!==r||e[1]!==o?(i=n.jsx("img",{src:r,alt:o,className:"size-16 shrink-0 rounded-lg border border-border bg-background object-contain p-2",onError:jl}),e[0]=r,e[1]=o,e[2]=i):i=e[2],i}function jl(s){s.target.style.display="none"}function Bt(s){const e=$.c(4),{colors:t}=s;let l;e[0]!==t?(l=Object.entries(t).filter(Nl),e[0]=t,e[1]=l):l=e[1];const a=l;if(a.length===0)return null;let r;return e[2]!==a?(r=n.jsx("div",{className:"flex h-1.5",children:a.map(vl)}),e[2]=a,e[3]=r):r=e[3],r}function vl(s){const[e,t]=s;return n.jsx("span",{className:"flex-1",style:{backgroundColor:t},title:`${Je[e]}: ${t}`,"aria-hidden":!0},e)}function Nl(s){const[,e]=s;return typeof e=="string"&&e.trim().length>0}function Ht(s){const e=$.c(36),{logo:t,favicon:l,name:a,domain:r,overview:o,colors:i,fonts:d,showDefaultBadge:c,isDefault:m}=s;let p;e[0]!==i?(p=i?Object.entries(i).filter(wl):[],e[0]=i,e[1]=p):p=e[1];const u=p;let f;e[2]!==d?(f=d?Object.entries(d).filter(_l):[],e[2]=d,e[3]=f):f=e[3];const x=f;let g;e[4]!==i?(g=i&&n.jsx(Bt,{colors:i}),e[4]=i,e[5]=g):g=e[5];let b;e[6]!==l||e[7]!==t||e[8]!==a?(b=n.jsx(yl,{logo:t,favicon:l,name:a}),e[6]=l,e[7]=t,e[8]=a,e[9]=b):b=e[9];let h;e[10]!==m||e[11]!==a||e[12]!==c?(h=a&&n.jsxs("span",{className:"inline-flex items-center gap-2 text-lg font-semibold text-foreground truncate",children:[a,c&&m&&n.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:[n.jsx(St,{className:"size-3 text-amber-500"}),"default"]})]}),e[10]=m,e[11]=a,e[12]=c,e[13]=h):h=e[13];let S;e[14]!==r?(S=r&&n.jsxs("a",{href:gl(r),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[r,n.jsx(wt,{className:"size-3 shrink-0"})]}),e[14]=r,e[15]=S):S=e[15];let y;e[16]!==h||e[17]!==S?(y=n.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[h,S]}),e[16]=h,e[17]=S,e[18]=y):y=e[18];let v;e[19]!==b||e[20]!==y?(v=n.jsxs("div",{className:"flex items-center gap-4",children:[b,y]}),e[19]=b,e[20]=y,e[21]=v):v=e[21];let j;e[22]!==o?(j=o&&n.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:o}),e[22]=o,e[23]=j):j=e[23];let N;e[24]!==u?(N=u.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx(lt,{children:"Colors"}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-3",children:u.map(kl)})]}),e[24]=u,e[25]=N):N=e[25];let k;e[26]!==x?(k=x.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx(lt,{children:"Typography"}),n.jsx("div",{className:"flex flex-wrap gap-2.5",children:x.map(Sl)})]}),e[26]=x,e[27]=k):k=e[27];let _;e[28]!==N||e[29]!==k||e[30]!==v||e[31]!==j?(_=n.jsxs("div",{className:"p-5 flex flex-col gap-6",children:[v,j,N,k]}),e[28]=N,e[29]=k,e[30]=v,e[31]=j,e[32]=_):_=e[32];let w;return e[33]!==_||e[34]!==g?(w=n.jsxs("div",{className:"mt-2 rounded-lg overflow-hidden border border-border",children:[g,_]}),e[33]=_,e[34]=g,e[35]=w):w=e[35],w}function Sl(s){const[e,t]=s;return n.jsx(bl,{role:e,family:t},e)}function kl(s){const[e,t]=s;return n.jsx(hl,{name:Je[e],value:t},e)}function _l(s){const[,e]=s;return typeof e=="string"&&e.trim().length>0}function wl(s){const[,e]=s;return typeof e=="string"&&e.trim().length>0}function Tl(s){const e=$.c(29),{part:t,latency:l}=s,a=re(t.state);let r;e[0]!==t.output?(r=ve(t.output),e[0]=t.output,e[1]=r):r=e[1];const o=r,i=a==="loading",d=a==="error"||o&&o.success===!1;if(i){const k=t.input;let _;e[2]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(ce,{className:"animate-pulse"}),e[2]=_):_=e[2];const w=k?.domain?`from ${k.domain}`:void 0;let T;return e[3]!==w?(T=n.jsx(B,{icon:_,title:"Extracting brand",summary:w,state:"loading",defaultOpen:!0}),e[3]=w,e[4]=T):T=e[4],T}if(d){let k;e[5]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(ce,{}),e[5]=k):k=e[5];const _=o?.error??"Unknown error";let w;e[6]!==l?(w=l!=null&&l>0?n.jsx(le,{latency:l}):void 0,e[6]=l,e[7]=w):w=e[7];let T;return e[8]!==_||e[9]!==w?(T=n.jsx(B,{icon:k,title:"Brand extraction failed",summary:_,state:"error",trailing:w}),e[8]=_,e[9]=w,e[10]=T):T=e[10],T}let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(ce,{className:"text-fuchsia-500"}),e[11]=c):c=e[11];const m=o?.name?`Brand set: ${o.name}`:"Brand context set",p=o?.domain;let u;e[12]!==l?(u=l!=null&&l>0?n.jsx(le,{latency:l}):void 0,e[12]=l,e[13]=u):u=e[13];let f;e[14]!==m||e[15]!==p||e[16]!==u?(f=n.jsx(B,{icon:c,title:m,summary:p,state:"idle",trailing:u}),e[14]=m,e[15]=p,e[16]=u,e[17]=f):f=e[17];const x=o?.logo,g=o?.favicon,b=o?.name,h=o?.domain,S=o?.overview,y=o?.colors,v=o?.fonts;let j;e[18]!==h||e[19]!==S||e[20]!==y||e[21]!==v||e[22]!==x||e[23]!==g||e[24]!==b?(j=n.jsx(Ht,{logo:x,favicon:g,name:b,domain:h,overview:S,colors:y,fonts:v}),e[18]=h,e[19]=S,e[20]=y,e[21]=v,e[22]=x,e[23]=g,e[24]=b,e[25]=j):j=e[25];let N;return e[26]!==j||e[27]!==f?(N=n.jsxs(n.Fragment,{children:[f,j]}),e[26]=j,e[27]=f,e[28]=N):N=e[28],N}function Cl(s){const e=$.c(27),{part:t,latency:l}=s,a=re(t.state);let r;e[0]!==t.output?(r=ve(t.output),e[0]=t.output,e[1]=r):r=e[1];const o=r,i=a==="loading",d=a==="error"||o&&o.success===!1;if(i){let g;return e[2]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(B,{icon:n.jsx(ce,{className:"animate-pulse"}),title:"Loading brand",state:"loading"}),e[2]=g):g=e[2],g}if(d||!o){let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(ce,{}),e[3]=g):g=e[3];let b;e[4]!==l?(b=l!=null&&l>0?n.jsx(le,{latency:l}):void 0,e[4]=l,e[5]=b):b=e[5];let h;return e[6]!==b?(h=n.jsx(B,{icon:g,title:"Couldn't load brand",state:"error",trailing:b}),e[6]=b,e[7]=h):h=e[7],h}let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(ce,{className:"text-fuchsia-500"}),e[8]=c):c=e[8];const m=o.name?`Brand · ${o.name}`:"Brand";let p;e[9]!==l?(p=l!=null&&l>0?n.jsx(le,{latency:l}):void 0,e[9]=l,e[10]=p):p=e[10];let u;e[11]!==o.domain||e[12]!==m||e[13]!==p?(u=n.jsx(B,{icon:c,title:m,summary:o.domain,state:"idle",trailing:p}),e[11]=o.domain,e[12]=m,e[13]=p,e[14]=u):u=e[14];let f;e[15]!==o.colors||e[16]!==o.domain||e[17]!==o.favicon||e[18]!==o.fonts||e[19]!==o.isDefault||e[20]!==o.logo||e[21]!==o.name||e[22]!==o.overview?(f=n.jsx(Ht,{logo:o.logo,favicon:o.favicon,name:o.name,domain:o.domain,overview:o.overview,colors:o.colors,fonts:o.fonts,showDefaultBadge:!0,isDefault:o.isDefault}),e[15]=o.colors,e[16]=o.domain,e[17]=o.favicon,e[18]=o.fonts,e[19]=o.isDefault,e[20]=o.logo,e[21]=o.name,e[22]=o.overview,e[23]=f):f=e[23];let x;return e[24]!==u||e[25]!==f?(x=n.jsxs(n.Fragment,{children:[u,f]}),e[24]=u,e[25]=f,e[26]=x):x=e[26],x}function $l(s){const e=$.c(32),{part:t,latency:l}=s;let a;e[0]!==t.state?(a=re(t.state),e[0]=t.state,e[1]=a):a=e[1];const r=a;let o,i,d,c;if(e[2]!==l||e[3]!==t.output||e[4]!==r){c=Symbol.for("react.early_return_sentinel");e:{const u=ve(t.output),f=Array.isArray(u?.items)?u.items:[],x=r==="loading",g=r==="error";if(x){let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(B,{icon:n.jsx(ce,{className:"animate-pulse"}),title:"Loading brands",state:"loading"}),e[9]=y):y=e[9],c=y;break e}if(g){let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(ce,{}),e[10]=y):y=e[10];let v;e[11]!==l?(v=l!=null&&l>0?n.jsx(le,{latency:l}):void 0,e[11]=l,e[12]=v):v=e[12];let j;e[13]!==v?(j=n.jsx(B,{icon:y,title:"Couldn't load brands",state:"error",trailing:v}),e[13]=v,e[14]=j):j=e[14],c=j;break e}if(f.length===0){let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(ce,{}),e[15]=y):y=e[15];let v;e[16]!==l?(v=l!=null&&l>0?n.jsx(le,{latency:l}):void 0,e[16]=l,e[17]=v):v=e[17];let j;e[18]!==v?(j=n.jsx(B,{icon:y,title:"No brands yet",summary:"The organization hasn't set up any brand context.",state:"idle",trailing:v}),e[18]=v,e[19]=j):j=e[19],c=j;break e}let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(ce,{className:"text-fuchsia-500"}),e[20]=b):b=e[20];const h=f.length===1?"1 brand":`${f.length} brands`;let S;e[21]!==l?(S=l!=null&&l>0?n.jsx(le,{latency:l}):void 0,e[21]=l,e[22]=S):S=e[22],e[23]!==h||e[24]!==S?(d=n.jsx(B,{icon:b,title:h,state:"idle",trailing:S}),e[23]=h,e[24]=S,e[25]=d):d=e[25],o="mt-2 flex flex-col gap-1.5",i=f.map(Il)}e[2]=l,e[3]=t.output,e[4]=r,e[5]=o,e[6]=i,e[7]=d,e[8]=c}else o=e[5],i=e[6],d=e[7],c=e[8];if(c!==Symbol.for("react.early_return_sentinel"))return c;let m;e[26]!==o||e[27]!==i?(m=n.jsx("div",{className:o,children:i}),e[26]=o,e[27]=i,e[28]=m):m=e[28];let p;return e[29]!==d||e[30]!==m?(p=n.jsxs(n.Fragment,{children:[d,m]}),e[29]=d,e[30]=m,e[31]=p):p=e[31],p}function Il(s){const e=s.colors?Object.entries(s.colors).filter(Ll):[];return n.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[s.colors&&n.jsx(Bt,{colors:s.colors}),n.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5",children:[(s.logo||s.favicon)&&n.jsx("img",{src:s.logo??s.favicon??void 0,alt:"",className:"size-8 shrink-0 rounded-md border border-border bg-background object-contain p-0.5",onError:Al}),n.jsxs("div",{className:"flex flex-col leading-tight min-w-0 flex-1",children:[n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-foreground truncate",children:[s.name??"Untitled",s.isDefault&&n.jsx(St,{className:"size-3 text-amber-500 shrink-0"})]}),s.domain&&n.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:s.domain})]}),e.length>0&&n.jsx("div",{className:"flex items-center gap-0.5 shrink-0",children:e.slice(0,5).map(Ml)})]})]},s.id??`${s.name}-${s.domain}`)}function Ml(s){const[e,t]=s;return n.jsx("span",{className:"size-3 rounded-full border border-border",style:{backgroundColor:t},title:`${Je[e]}: ${t}`,"aria-hidden":!0},e)}function Al(s){s.target.style.display="none"}function Ll(s){const[,e]=s;return typeof e=="string"&&e.trim().length>0}function Be(s){const e=$.c(4),{connection_id:t,iconSize:l}=s,a=l===void 0?"xs":l,r=Us(t);if(!r)return null;let o;return e[0]!==r.icon||e[1]!==r.title||e[2]!==a?(o=n.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:n.jsx(Ae,{icon:r.icon,name:r.title,size:a})}),e[0]=r.icon,e[1]=r.title,e[2]=a,e[3]=o):o=e[3],o}Be.Fallback=function({iconSize:e="xs"}){const t=e==="sm"?"size-6":"size-5";return n.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:n.jsx("div",{className:V(t,"rounded bg-muted animate-pulse")})})};function ke(s){const e=$.c(18),{connectionIds:t,maxVisibleIcons:l,iconSize:a,className:r}=s,o=l===void 0?2:l,i=a===void 0?"xs":a;if(t.length===0)return null;let d,c,m;if(e[0]!==r||e[1]!==t||e[2]!==i||e[3]!==o){const f=t.slice(0,o);d=t.length-o,e[7]!==r?(c=V("flex items-center justify-end -space-x-2",r),e[7]=r,e[8]=c):c=e[8];let x;e[9]!==i?(x=g=>n.jsx(H.Suspense,{fallback:n.jsx(Be.Fallback,{iconSize:i}),children:n.jsx(Be,{connection_id:g,iconSize:i})},g),e[9]=i,e[10]=x):x=e[10],m=f.map(x),e[0]=r,e[1]=t,e[2]=i,e[3]=o,e[4]=d,e[5]=c,e[6]=m}else d=e[4],c=e[5],m=e[6];let p;e[11]!==i||e[12]!==d?(p=d>0&&n.jsx("div",{className:V("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",i==="sm"?"size-8":"size-6"),children:n.jsxs("span",{className:V(i==="sm"?"text-sm":"text-xs","font-medium text-muted-foreground"),"aria-label":`and ${d} more`,children:["+",d]})}),e[11]=i,e[12]=d,e[13]=p):p=e[13];let u;return e[14]!==c||e[15]!==m||e[16]!==p?(u=n.jsxs("div",{className:c,children:[m,p]}),e[14]=c,e[15]=m,e[16]=p,e[17]=u):u=e[17],u}ke.Fallback=function({maxVisibleIcons:e=2,totalCount:t,iconSize:l="xs"}){const a=l==="sm"?"size-6":"size-5",r=l==="sm"?"size-8":"size-6",o=t!==void 0&&t>e;return n.jsxs("div",{className:"flex items-center -space-x-2",children:[Array.from({length:e}).map((i,d)=>n.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:n.jsx("div",{className:V(a,"rounded bg-muted animate-pulse")})},d)),o&&n.jsx("div",{className:V("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",r),children:n.jsx("div",{className:V(l==="sm"?"h-3.5 w-5":"h-3 w-4","rounded bg-muted animate-pulse")})})]})};const Rl="This document certifies that the bearer agent has been granted authorized access to the tools and capabilities described herein. The agent is permitted to operate within the scope defined by its instructions and shall act in accordance with the constraints set forth by the issuing organization. This credential remains valid for the duration of the agent's active status. Unauthorized modification of this agent's permissions or scope is prohibited. The issuing authority reserves the right to revoke access at any time. All actions performed by this agent are subject to audit and review by the organization administrator. ",ot=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null;function El(s){const e=$.c(64),{part:t,latency:l}=s,a=Ct(),r=re(t.state),o=H.useRef(null),i=H.useRef(null),d=H.useRef(null),c=H.useRef(null),m=H.useRef(null);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{ot?.matches||(m.current=o.current?.getBoundingClientRect()??null,o.current&&(o.current.style.willChange="transform"))},e[0]=p):p=e[0];const u=p;let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=P=>{if(ot?.matches)return;const q=m.current,X=o.current;if(!q||!X)return;const J=(P.clientX-q.left)/q.width*100,se=(P.clientY-q.top)/q.height*100;X.style.transform=`perspective(800px) rotateY(${(J-50)*.05}deg) rotateX(${(se-50)*-.05}deg)`,i.current&&(i.current.style.opacity="1",i.current.style.transform=`translate(${(J-50)*.15}px, ${(se-50)*.15}px)`),d.current&&(d.current.style.opacity="0.45"),c.current&&(c.current.style.opacity="0.45")},e[1]=f):f=e[1];const x=f;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{const P=o.current;P&&(P.style.transform="none",P.style.willChange="auto"),i.current&&(i.current.style.opacity="0.4",i.current.style.transform="translate(0, 0)"),d.current&&(d.current.style.opacity="0.3"),c.current&&(c.current.style.opacity="0.3"),m.current=null},e[2]=g):g=e[2];const b=g;if(r==="loading"){let P;return e[3]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(B,{icon:n.jsx(ie,{className:"animate-pulse"}),title:"Creating agent",state:"loading",defaultOpen:!0}),e[3]=P):P=e[3],P}if(r==="approval"){let P;return e[4]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(B,{icon:n.jsx(ie,{}),title:"Create agent",state:"idle"}),e[4]=P):P=e[4],P}if(r==="error"){let P;e[5]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(ie,{}),e[5]=P):P=e[5];const q=t.state==="output-denied"?"Agent creation cancelled":"Couldn't create agent";let X;e[6]!==l?(X=n.jsx(le,{latency:l}),e[6]=l,e[7]=X):X=e[7];let J;return e[8]!==q||e[9]!==X?(J=n.jsx(B,{icon:P,title:q,state:"error",trailing:X}),e[8]=q,e[9]=X,e[10]=J):J=e[10],J}let h,S,y;if(e[11]!==l||e[12]!==t.output){y=Symbol.for("react.early_return_sentinel");e:{if(h=ve(t.output)?.item,!h?.id||!h?.title){let P;e[16]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(ie,{}),e[16]=P):P=e[16];let q;e[17]!==l?(q=n.jsx(B,{icon:P,title:"Agent created",state:"idle",trailing:n.jsx(le,{latency:l})}),e[17]=l,e[18]=q):q=e[18],y=q;break e}S=(h.connections??[]).map(zl)}e[11]=l,e[12]=t.output,e[13]=h,e[14]=S,e[15]=y}else h=e[13],S=e[14],y=e[15];if(y!==Symbol.for("react.early_return_sentinel"))return y;const v=S;let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(ie,{className:"text-emerald-500"}),e[19]=j):j=e[19];const N=`Agent created: ${h.title}`;let k;e[20]!==l?(k=n.jsx(le,{latency:l}),e[20]=l,e[21]=k):k=e[21];let _;e[22]!==N||e[23]!==k?(_=n.jsx(B,{icon:j,title:N,state:"idle",trailing:k}),e[22]=N,e[23]=k,e[24]=_):_=e[24];let w;e[25]===Symbol.for("react.memo_cache_sentinel")?(w={transition:"transform 0.3s ease-out"},e[25]=w):w=e[25];let T;e[26]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx("div",{ref:i,className:"pointer-events-none absolute inset-[-20%] z-[1] select-none rounded-lg",style:{background:"linear-gradient(135deg, hsla(280, 60%, 80%, 0.35) 0%, transparent 35%), linear-gradient(315deg, hsla(190, 70%, 80%, 0.35) 0%, transparent 35%), linear-gradient(225deg, hsla(140, 55%, 80%, 0.3) 0%, transparent 30%), linear-gradient(45deg, hsla(320, 55%, 82%, 0.3) 0%, transparent 30%)",opacity:.4,transition:"opacity 0.3s ease, transform 0.3s ease-out"},"aria-hidden":"true"}),e[26]=T):T=e[26];let I;e[27]===Symbol.for("react.memo_cache_sentinel")?(I={textAlign:"justify",wordBreak:"break-all"},e[27]=I):I=e[27];let M,C;e[28]===Symbol.for("react.memo_cache_sentinel")?(M=n.jsx("p",{className:"pointer-events-none absolute inset-0 z-[1] select-none overflow-hidden text-[6px] font-light leading-[1.5] tracking-[0.06px] text-background opacity-50 mix-blend-overlay",style:I,"aria-hidden":"true",children:Rl.repeat(6)}),C=n.jsx("img",{src:"/stamp.svg",alt:"",className:"pointer-events-none absolute -right-10 -top-10 size-[140px] opacity-50 select-none","aria-hidden":"true"}),e[28]=M,e[29]=C):(M=e[28],C=e[29]);let A;e[30]===Symbol.for("react.memo_cache_sentinel")?(A=n.jsx("img",{ref:d,src:"/left-guilloche.png",alt:"",className:"pointer-events-none absolute inset-y-0 left-0 h-full w-auto select-none z-[1] mix-blend-overlay",style:{opacity:.3,transition:"opacity 0.3s ease"},"aria-hidden":"true"}),e[30]=A):A=e[30];let L;e[31]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx("img",{ref:c,src:"/right-guilloche.png",alt:"",className:"pointer-events-none absolute inset-y-0 right-0 h-full w-auto select-none z-[1] mix-blend-overlay",style:{opacity:.3,transition:"opacity 0.3s ease"},"aria-hidden":"true"}),e[31]=L):L=e[31];let F;e[32]!==h.icon||e[33]!==h.title?(F=n.jsx(ct,{icon:h.icon,name:h.title,size:"md"}),e[32]=h.icon,e[33]=h.title,e[34]=F):F=e[34];let z;e[35]!==h.title?(z=n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:h.title})}),e[35]=h.title,e[36]=z):z=e[36];let R;e[37]!==F||e[38]!==z?(R=n.jsxs("div",{className:"flex items-center gap-2.5 p-2",children:[F,z]}),e[37]=F,e[38]=z,e[39]=R):R=e[39];let E;e[40]!==h.description?(E=h.description&&n.jsx("div",{className:"px-2 pt-1 pr-16",children:n.jsx("p",{className:"text-sm leading-snug text-muted-foreground line-clamp-2",children:h.description})}),e[40]=h.description,e[41]=E):E=e[41];let D;e[42]!==R||e[43]!==E?(D=n.jsxs("div",{className:"relative",children:[R,E]}),e[42]=R,e[43]=E,e[44]=D):D=e[44];let W;e[45]!==v?(W=v.length>0&&n.jsx(H.Suspense,{fallback:n.jsx(ke.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:v.length}),children:n.jsx(ke,{connectionIds:v,iconSize:"xs",maxVisibleIcons:3,className:"flex items-center justify-start -space-x-1"})}),e[45]=v,e[46]=W):W=e[46];let U;e[47]!==W?(U=n.jsx("div",{className:"flex-1 min-w-0",children:W}),e[47]=W,e[48]=U):U=e[48];let O;e[49]!==h.id||e[50]!==a?(O=()=>a(h.id),e[49]=h.id,e[50]=a,e[51]=O):O=e[51];const K=`See agent: ${h.title}`;let G;e[52]!==O||e[53]!==K?(G=n.jsx("div",{className:"flex items-center gap-2 shrink-0",children:n.jsx(Se,{size:"sm",className:"h-7",onClick:O,"aria-label":K,children:"See agent"})}),e[52]=O,e[53]=K,e[54]=G):G=e[54];let Y;e[55]!==U||e[56]!==G?(Y=n.jsxs("div",{className:"relative z-[3] flex items-center gap-2.5 px-2 pt-6 pb-1",children:[U,G]}),e[55]=U,e[56]=G,e[57]=Y):Y=e[57];let Q;e[58]!==D||e[59]!==Y?(Q=n.jsx("div",{className:"mt-2 overflow-hidden rounded-xl border-[0.5px] border-border bg-card p-2.5",children:n.jsxs("div",{ref:o,className:"relative overflow-hidden rounded-lg bg-accent/25 p-2",style:w,onMouseEnter:u,onMouseMove:x,onMouseLeave:b,children:[T,M,C,A,L,D,Y]})}),e[58]=D,e[59]=Y,e[60]=Q):Q=e[60];let te;return e[61]!==Q||e[62]!==_?(te=n.jsxs(n.Fragment,{children:[_,Q]}),e[61]=Q,e[62]=_,e[63]=te):te=e[63],te}function zl(s){return s.connection_id}function Pl(s){const e=$.c(24),{agent:t}=s,l=Ct();if(!t.id)return null;let a;e[0]!==t.connections?(a=t.connections??[],e[0]=t.connections,e[1]=a):a=e[1];let r;e[2]!==a?(r=a.map(Fl),e[2]=a,e[3]=r):r=e[3];const o=r;let i;e[4]!==t.id||e[5]!==l?(i=()=>l(t.id),e[4]=t.id,e[5]=l,e[6]=i):i=e[6];let d;e[7]!==t.icon||e[8]!==t.title?(d=n.jsx(ct,{icon:t.icon,name:t.title,size:"sm"}),e[7]=t.icon,e[8]=t.title,e[9]=d):d=e[9];let c;e[10]!==t.title?(c=n.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[10]=t.title,e[11]=c):c=e[11];let m;e[12]!==t.description?(m=t.description&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:t.description}),e[12]=t.description,e[13]=m):m=e[13];let p;e[14]!==c||e[15]!==m?(p=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[c,m]}),e[14]=c,e[15]=m,e[16]=p):p=e[16];let u;e[17]!==o?(u=o.length>0&&n.jsx(H.Suspense,{fallback:n.jsx(ke.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:o.length}),children:n.jsx(ke,{connectionIds:o,iconSize:"xs",maxVisibleIcons:3})}),e[17]=o,e[18]=u):u=e[18];let f;return e[19]!==i||e[20]!==d||e[21]!==p||e[22]!==u?(f=n.jsxs("button",{type:"button",onClick:i,className:"group flex w-full items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[d,p,u]}),e[19]=i,e[20]=d,e[21]=p,e[22]=u,e[23]=f):f=e[23],f}function Fl(s){return s.connection_id}function Dl(s){const e=$.c(41),{part:t,latency:l}=s,a=je(),{org:r}=he();let o;e[0]!==t.state?(o=re(t.state),e[0]=t.state,e[1]=o):o=e[1];const i=o;let d,c,m,p,u,f;if(e[2]!==l||e[3]!==t.output||e[4]!==t.state||e[5]!==i){f=Symbol.for("react.early_return_sentinel");e:{const h=ve(t.output);if(c=Array.isArray(h?.items)?h.items:[],i==="loading"){let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(B,{icon:n.jsx(ie,{className:"animate-pulse"}),title:"Loading agents",state:"loading"}),e[12]=N):N=e[12],f=N;break e}if(i==="approval"){let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(B,{icon:n.jsx(ie,{}),title:"List agents",state:"idle"}),e[13]=N):N=e[13],f=N;break e}if(i==="error"){let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(ie,{}),e[14]=N):N=e[14];const k=t.state==="output-denied"?"Agent list unavailable":"Couldn't load agents";let _;e[15]!==l?(_=n.jsx(le,{latency:l}),e[15]=l,e[16]=_):_=e[16];let w;e[17]!==k||e[18]!==_?(w=n.jsx(B,{icon:N,title:k,state:"error",trailing:_}),e[17]=k,e[18]=_,e[19]=w):w=e[19],f=w;break e}if(c.length===0){let N;e[20]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(ie,{}),e[20]=N):N=e[20];let k;e[21]!==l?(k=n.jsx(B,{icon:N,title:"No agents yet",summary:"This organization hasn't created any agents.",state:"idle",trailing:n.jsx(le,{latency:l})}),e[21]=l,e[22]=k):k=e[22],f=k;break e}const S=c.slice(0,zt);d=c.length-S.length;let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(ie,{className:"text-emerald-500"}),e[23]=y):y=e[23];const v=c.length===1?"1 agent":`${c.length} agents`;let j;e[24]!==l?(j=n.jsx(le,{latency:l}),e[24]=l,e[25]=j):j=e[25],e[26]!==v||e[27]!==j?(u=n.jsx(B,{icon:y,title:v,state:"idle",trailing:j}),e[26]=v,e[27]=j,e[28]=u):u=e[28],m="mt-2 flex flex-col gap-1.5",p=S.map(Ol)}e[2]=l,e[3]=t.output,e[4]=t.state,e[5]=i,e[6]=d,e[7]=c,e[8]=m,e[9]=p,e[10]=u,e[11]=f}else d=e[6],c=e[7],m=e[8],p=e[9],u=e[10],f=e[11];if(f!==Symbol.for("react.early_return_sentinel"))return f;let x;e[29]!==d||e[30]!==c||e[31]!==a||e[32]!==r?(x=d>0&&n.jsx(Pt,{count:c.length,noun:"agents",onClick:()=>a({to:"/$org/settings/agents",params:{org:r.slug}})}),e[29]=d,e[30]=c,e[31]=a,e[32]=r,e[33]=x):x=e[33];let g;e[34]!==m||e[35]!==p||e[36]!==x?(g=n.jsxs("div",{className:m,children:[p,x]}),e[34]=m,e[35]=p,e[36]=x,e[37]=g):g=e[37];let b;return e[38]!==u||e[39]!==g?(b=n.jsxs(n.Fragment,{children:[u,g]}),e[38]=u,e[39]=g,e[40]=b):b=e[40],b}function Ol(s){return n.jsx(Pl,{agent:s},s.id)}const Bl={active:"bg-emerald-500",inactive:"bg-muted-foreground",error:"bg-destructive"};function Hl(s){const e=$.c(27),{connection:t}=s,l=je(),{org:a}=he(),r=t.slug,o=t.description||t.app_name,i=!r||void 0;let d;e[0]!==l||e[1]!==a||e[2]!==r?(d=()=>r&&l({to:"/$org/settings/connections/$appSlug",params:{org:a.slug,appSlug:r}}),e[0]=l,e[1]=a,e[2]=r,e[3]=d):d=e[3];let c;e[4]!==t.icon||e[5]!==t.title?(c=n.jsx(Ae,{icon:t.icon,name:t.title,size:"sm"}),e[4]=t.icon,e[5]=t.title,e[6]=c):c=e[6];let m;e[7]!==t.title?(m=n.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[7]=t.title,e[8]=m):m=e[8];let p;e[9]!==o?(p=o&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:o}),e[9]=o,e[10]=p):p=e[10];let u;e[11]!==m||e[12]!==p?(u=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[m,p]}),e[11]=m,e[12]=p,e[13]=u):u=e[13];const f=Bl[t.status]??"bg-muted-foreground";let x;e[14]!==f?(x=V("size-2 shrink-0 rounded-full",f),e[14]=f,e[15]=x):x=e[15];let g;e[16]!==x?(g=n.jsx("span",{className:x,"aria-hidden":"true"}),e[16]=x,e[17]=g):g=e[17];let b;e[18]!==t.status?(b=n.jsx("span",{className:"sr-only",children:t.status}),e[18]=t.status,e[19]=b):b=e[19];let h;return e[20]!==i||e[21]!==b||e[22]!==d||e[23]!==c||e[24]!==u||e[25]!==g?(h=n.jsxs("button",{type:"button","aria-disabled":i,onClick:d,className:"group flex w-full items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer aria-disabled:cursor-default aria-disabled:hover:bg-card",children:[c,u,g,b]}),e[20]=i,e[21]=b,e[22]=d,e[23]=c,e[24]=u,e[25]=g,e[26]=h):h=e[26],h}function Wl(s){const e=$.c(40),{part:t,latency:l}=s,a=je(),{org:r}=he();let o;e[0]!==t.state?(o=re(t.state),e[0]=t.state,e[1]=o):o=e[1];const i=o;let d,c,m,p,u,f;if(e[2]!==l||e[3]!==t.output||e[4]!==t.state||e[5]!==i){f=Symbol.for("react.early_return_sentinel");e:{const h=ve(t.output);if(c=(Array.isArray(h?.items)?h.items:[]).filter(ql),i==="loading"||i==="approval"){let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(B,{icon:n.jsx(Ce,{className:"animate-pulse"}),title:"Loading connections",state:"loading"}),e[12]=N):N=e[12],f=N;break e}if(i==="error"){let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(Ce,{}),e[13]=N):N=e[13];const k=t.state==="output-denied"?"Connection list unavailable":"Couldn't load connections";let _;e[14]!==l?(_=n.jsx(le,{latency:l}),e[14]=l,e[15]=_):_=e[15];let w;e[16]!==k||e[17]!==_?(w=n.jsx(B,{icon:N,title:k,state:"error",trailing:_}),e[16]=k,e[17]=_,e[18]=w):w=e[18],f=w;break e}if(c.length===0){let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(Ce,{}),e[19]=N):N=e[19];let k;e[20]!==l?(k=n.jsx(B,{icon:N,title:"No connections yet",summary:"This organization hasn't connected any MCPs.",state:"idle",trailing:n.jsx(le,{latency:l})}),e[20]=l,e[21]=k):k=e[21],f=k;break e}const S=c.slice(0,zt);d=c.length-S.length;let y;e[22]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Ce,{className:"text-emerald-500"}),e[22]=y):y=e[22];const v=c.length===1?"1 connection":`${c.length} connections`;let j;e[23]!==l?(j=n.jsx(le,{latency:l}),e[23]=l,e[24]=j):j=e[24],e[25]!==v||e[26]!==j?(u=n.jsx(B,{icon:y,title:v,state:"idle",trailing:j}),e[25]=v,e[26]=j,e[27]=u):u=e[27],m="mt-2 flex flex-col gap-1.5",p=S.map(Ul)}e[2]=l,e[3]=t.output,e[4]=t.state,e[5]=i,e[6]=d,e[7]=c,e[8]=m,e[9]=p,e[10]=u,e[11]=f}else d=e[6],c=e[7],m=e[8],p=e[9],u=e[10],f=e[11];if(f!==Symbol.for("react.early_return_sentinel"))return f;let x;e[28]!==d||e[29]!==c||e[30]!==a||e[31]!==r?(x=d>0&&n.jsx(Pt,{count:c.length,noun:"connections",onClick:()=>a({to:"/$org/settings/connections",params:{org:r.slug}})}),e[28]=d,e[29]=c,e[30]=a,e[31]=r,e[32]=x):x=e[32];let g;e[33]!==m||e[34]!==p||e[35]!==x?(g=n.jsxs("div",{className:m,children:[p,x]}),e[33]=m,e[34]=p,e[35]=x,e[36]=g):g=e[36];let b;return e[37]!==u||e[38]!==g?(b=n.jsxs(n.Fragment,{children:[u,g]}),e[37]=u,e[38]=g,e[39]=b):b=e[39],b}function Ul(s){return n.jsx(Hl,{connection:s},s.id)}function ql(s){return s.connection_type!=="VIRTUAL"}function Vl(){const s=$.c(37),e=Ve(),{sendMessage:t,isStreaming:l,messages:a}=ws(),{org:r}=he(),o=e?.virtualMcpId,{prompts:i}=Hs(r.slug),d=o??null;let c;s[0]!==r.id||s[1]!==r.slug||s[2]!==d?(c={connectionId:d,orgId:r.id,orgSlug:r.slug},s[0]=r.id,s[1]=r.slug,s[2]=d,s[3]=c):c=s[3];const m=vt(c),[p,u]=H.useState(null);if(!o||l||!Ls(o)||!a.some(Gl))return null;let x;if(s[4]!==i||s[5]!==o){let C;s[7]!==o?(C=A=>A.agentId===o&&A.promptName,s[7]=o,s[8]=C):C=s[8],x=i.find(C),s[4]=i,s[5]=o,s[6]=x}else x=s[6];const g=x;if(!g)return null;let b;s[9]!==m||s[10]!==t?(b=async(C,A)=>{if(!m){Fe.error("MCP client not available");return}try{const L=await Vs(m,C.name,A);await t({type:"doc",content:[{type:"paragraph",content:[Lt({id:C.name,name:Ke(C.name,Ge(C._meta)),metadata:L.messages,char:"/",kind:"prompt",args:A}),{type:"text",text:" "}]}]})}catch(L){console.error("[next-action-chip] failed",L),Fe.error("Failed to load prompt. Please try again.")}},s[9]=m,s[10]=t,s[11]=b):b=s[11];const h=b;let S;s[12]!==g._meta||s[13]!==g.arguments||s[14]!==g.description||s[15]!==g.promptName||s[16]!==g.title||s[17]!==h?(S=()=>{const C={name:g.promptName,title:g.title,description:g.description,arguments:g.arguments,_meta:g._meta};if(C.arguments&&C.arguments.length>0){u(C);return}h(C)},s[12]=g._meta,s[13]=g.arguments,s[14]=g.description,s[15]=g.promptName,s[16]=g.title,s[17]=h,s[18]=S):S=s[18];const y=S;let v,j;s[19]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(qs,{size:12,className:"shrink-0 text-purple-500"}),j=n.jsx("span",{className:"font-medium text-foreground/80",children:"Next:"}),s[19]=v,s[20]=j):(v=s[19],j=s[20]);let N;s[21]!==g.title?(N=n.jsx("span",{className:"truncate",children:g.title}),s[21]=g.title,s[22]=N):N=s[22];let k;s[23]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(ut,{size:12,className:"shrink-0 transition-transform duration-150 group-hover:translate-x-0.5"}),s[23]=k):k=s[23];let _;s[24]!==y||s[25]!==N?(_=n.jsxs("button",{type:"button",onClick:y,className:"group mt-3 flex items-center gap-2 self-start rounded-full border border-border bg-background px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:border-border hover:bg-accent/40 hover:text-foreground",children:[v,j,N,k]}),s[24]=y,s[25]=N,s[26]=_):_=s[26];let w;s[27]===Symbol.for("react.memo_cache_sentinel")?(w=C=>u(C),s[27]=w):w=s[27];let T;s[28]!==p||s[29]!==h?(T=async C=>{const A=p;u(null),A&&await h(A,C)},s[28]=p,s[29]=h,s[30]=T):T=s[30];let I;s[31]!==p||s[32]!==T?(I=n.jsx(mn,{prompt:p,setPrompt:w,onSubmit:T}),s[31]=p,s[32]=T,s[33]=I):I=s[33];let M;return s[34]!==I||s[35]!==_?(M=n.jsxs(n.Fragment,{children:[_,I]}),s[34]=I,s[35]=_,s[36]=M):M=s[36],M}function Gl(s){return s.role==="user"||s.parts.some(Kl)}function Kl(s){return s.type==="tool-user_ask"&&s.state==="output-available"}function Xl(s){const e=$.c(5),{parts:t}=s,l=t?.length,a=t?.[t.length-1];let r;e[0]!==a||e[1]!==l?(r={enabled:!0,contentDeps:[l,a]},e[0]=a,e[1]=l,e[2]=r):r=e[2];const{sentinelRef:o}=Et(r);let i;return e[3]!==o?(i=n.jsx("div",{ref:o,className:"h-0"}),e[3]=o,e[4]=i):i=e[4],i}function Jl(s){const e=new Map;for(let t=s.length-1;t>=0;t--){const l=s[t]?.parts;if(l)for(const a of l){const r=a;if(r.type!=="data-deck-updated")continue;const o=r.data;if(!o?.path)continue;const i=`deck:${o.path}`;e.has(i)||e.set(i,{tabId:$s(o.path),label:o.name||o.path,kind:o.kind==="page"?"page":"deck"})}}return Array.from(e.values())}function Ql(){const s=$.c(9),e=je(),t=_e()?.messages??[],l=Jl(t);if(l.length===0)return null;const a=l.some(Zl),r=l.some(Yl),o=a?r?"Slides & pages in this chat":"Slides in this chat":"Pages in this chat",i="flex flex-col gap-1.5 py-2";let d;s[0]!==o?(d=n.jsx("div",{className:"text-[12px] text-muted-foreground/70 uppercase tracking-wide",children:o}),s[0]=o,s[1]=d):d=s[1];const c="flex flex-wrap gap-2";let m;s[2]!==e?(m=x=>n.jsxs("button",{type:"button",onClick:()=>e({to:".",search:g=>({...g,main:x.tabId}),replace:!0}),className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border bg-muted/30 hover:bg-muted/60 text-[13px] transition-colors",children:[x.kind==="deck"?n.jsx(Ne,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(Es,{className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"font-medium text-foreground",children:x.label})]},x.tabId),s[2]=e,s[3]=m):m=s[3];const p=l.map(m);let u;s[4]!==p?(u=n.jsx("div",{className:c,children:p}),s[4]=p,s[5]=u):u=s[5];let f;return s[6]!==d||s[7]!==u?(f=n.jsxs("div",{className:i,children:[d,u]}),s[6]=d,s[7]=u,s[8]=f):f=s[8],f}function Yl(s){return s.kind==="page"}function Zl(s){return s.kind==="deck"}async function eo(s,e){const t=await fetch(`/api/${e}/threads/${encodeURIComponent(s)}/outputs`,{credentials:"include"});if(!t.ok)throw new Error(`Failed to fetch thread outputs: ${t.status}`);return(await t.json()).objects??[]}function La(){const s=$.c(2),e=_e()?.messages??[];let t;return s[0]!==e?(t=e.some(to),s[0]=e,s[1]=t):t=s[1],t}function to(s){return s.parts?.some(so)}function so(s){const e=s;return(e.type==="tool-share_with_user"||e.type==="tool-bash"||e.type==="tool-write")&&e.state==="output-available"}function no(s,e){const t=$.c(9),{org:l}=he();let a;t[0]!==s?(a=me.threadOutputs(s??""),t[0]=s,t[1]=a):a=t[1];let r;t[2]!==l||t[3]!==s?(r=()=>eo(s??"",l.slug),t[2]=l,t[3]=s,t[4]=r):r=t[4];const o=!!s&&(e?.enabled??!0);let i;return t[5]!==a||t[6]!==r||t[7]!==o?(i={queryKey:a,queryFn:r,enabled:o,staleTime:0},t[5]=a,t[6]=r,t[7]=o,t[8]=i):i=t[8],He(i)}function lo(s){const e=$.c(20),{file:t}=s,l=je();let a;e[0]!==t.key||e[1]!==l?(a=()=>l({to:".",search:f=>({...f,main:Is(t.key)}),replace:!0}),e[0]=t.key,e[1]=l,e[2]=a):a=e[2];const r=a;let o;e[3]!==t.filename?(o=n.jsx(Ns,{filename:t.filename,className:"h-5 w-4 shrink-0"}),e[3]=t.filename,e[4]=o):o=e[4];let i;e[5]!==t.filename||e[6]!==r?(i=n.jsx("button",{type:"button",onClick:r,className:"min-w-0 flex-1 truncate text-left text-[13px] font-medium text-foreground hover:underline",title:t.filename,children:t.filename}),e[5]=t.filename,e[6]=r,e[7]=i):i=e[7];const d=`Download ${t.filename}`;let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(_t,{className:"size-3.5"}),e[8]=c):c=e[8];let m;e[9]!==t.downloadUrl||e[10]!==t.filename||e[11]!==d?(m=n.jsx("a",{href:t.downloadUrl,download:t.filename,className:"hidden shrink-0 text-muted-foreground hover:text-foreground group-hover:block",title:"Download","aria-label":d,children:c}),e[9]=t.downloadUrl,e[10]=t.filename,e[11]=d,e[12]=m):m=e[12];let p;e[13]!==r?(p=n.jsx(Se,{variant:"outline",size:"sm",className:"h-7 shrink-0 px-2.5 text-xs",onClick:r,children:"Open"}),e[13]=r,e[14]=p):p=e[14];let u;return e[15]!==o||e[16]!==i||e[17]!==m||e[18]!==p?(u=n.jsxs("div",{className:"group flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[o,i,m,p]}),e[15]=o,e[16]=i,e[17]=m,e[18]=p,e[19]=u):u=e[19],u}function at(s){return s.split("/").pop()??s}const oo=/(^|\/)output\//;function ao(s){const e=new Set;for(const t of s.parts??[]){const l=t;if(l.state==="output-available"){if(l.type==="tool-share_with_user"){const a=l.output?.filename??l.input?.name??(l.input?.source?at(l.input.source):null);a&&e.add(a)}else if(l.type==="tool-write"){const a=l.input?.path;a&&oo.test(a)&&e.add(at(a))}}}return e}function ro(s){const e=$.c(4),{threadId:t,message:l}=s,a=ao(l),r=a.size>0;let o;e[0]!==r?(o={enabled:r},e[0]=r,e[1]=o):o=e[1];const{data:i}=no(t,o);if(a.size===0)return null;const d=(i??[]).filter(u=>a.has(u.filename));if(d.length===0)return null;const c="flex flex-col gap-1.5 py-2",m=d.map(io);let p;return e[2]!==m?(p=n.jsx("div",{className:c,children:m}),e[2]=m,e[3]=p):p=e[3],p}function io(s){return n.jsx(lo,{file:s},s.key)}function co(s){return s.type==="reasoning"}function uo(s){const e=[],t=new Set,l=new Map,a=new Map,r=new Map;if(s){let i=null;for(let d=0;d<s.parts.length;d++){const c=s.parts[d];if(co(c)){i||(i={parts:[],startIndex:d},e.push(i)),i.parts.push(c),t.add(d);continue}if(i=null,c.type==="data-tool-metadata"&&"id"in c&&"data"in c){const m=c.data,p={};m.annotations&&(p.annotations=m.annotations),typeof m.latencyMs=="number"&&Number.isFinite(m.latencyMs)&&(p.latencySeconds=m.latencyMs/1e3),typeof m.outputBytes=="number"&&Number.isFinite(m.outputBytes)&&m.outputBytes>=0&&(p.outputBytes=m.outputBytes),m._meta&&typeof m._meta=="object"&&(p._meta=m._meta),l.set(c.id,p);continue}if(c.type==="data-tool-subtask-metadata"&&"id"in c){a.set(c.id,c.data);continue}if(c.type==="data-web-search"&&"id"in c&&"data"in c){const m=c.id,p=c.data;r.set(m,p.text??"");continue}}}const o=[];if(s){let i=[],d=[];const c=new Set,m=()=>{for(const p of i)c.has(p)||(c.add(p),o.push({kind:"reasoning-group",group:p}));for(const p of d)o.push({kind:"part",index:p.index});i=[],d=[]};for(let p=0;p<s.parts.length;p++){const u=s.parts[p];if(u.type==="step-start"){m();continue}if(t.has(p)){const f=e.find(x=>x.startIndex===p);f&&i.push(f);continue}u.type.startsWith("data-")||d.push({index:p})}m()}return{reasoningGroups:e,renderOrder:o,dataParts:{toolMetadata:l,toolSubtaskMetadata:a,webSearchStreaming:r}}}function Wt(s){const e=$.c(9),{since:t}=s;let l;e[0]!==t?(l=()=>et(t,Date.now()),e[0]=t,e[1]=l):l=e[1];const[a,r]=H.useState(l);let o,i;e[2]!==t?(o=()=>{const p=setInterval(()=>r(et(t,Date.now())),100);return()=>clearInterval(p)},i=[t],e[2]=t,e[3]=o,e[4]=i):(o=e[3],i=e[4]),H.useEffect(o,i);const d=a/1e3;let c;e[5]!==d?(c=de(d),e[5]=d,e[6]=c):c=e[6];let m;return e[7]!==c?(m=n.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground/50",children:c}),e[7]=c,e[8]=m):m=e[8],m}const Ut=[{delay:0},{delay:100},{delay:200},{delay:100},{delay:200},{delay:200},{delay:300},{delay:300},{delay:400}];function fo(){const s=$.c(5),[e]=H.useState(mo);let t;s[0]===Symbol.for("react.memo_cache_sentinel")?(t={gridTemplateColumns:"repeat(3, 3px)",gap:"1.5px",width:"fit-content"},s[0]=t):t=s[0];let l;s[1]!==e?(l=Ut.map((r,o)=>{const{delay:i}=r;return n.jsx("div",{className:"rounded-[1px]",style:{width:3,height:3,"--cell-color":e[o],animation:"grid-ripple 1s ease infinite",animationDelay:`${i}ms`}},o)}),s[1]=e,s[2]=l):l=s[2];let a;return s[3]!==l?(a=n.jsx("div",{className:"grid",style:t,children:l}),s[3]=l,s[4]=a):a=s[4],a}function mo(){const s=`var(--chart-${Math.ceil(Math.random()*5)})`;return Ut.map(()=>Math.random()<.6?"color-mix(in srgb, var(--muted-foreground) 25%, transparent)":s)}const po={planning:{icon:n.jsx(us,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Planning next moves"},thinking:{icon:n.jsx(Ue,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Thinking"}},xo=1200;function go(){const s=$.c(7),[e,t]=H.useState("planning");let l,a;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{const d=setTimeout(()=>{t("thinking")},xo);return()=>{clearTimeout(d)}},a=[],s[0]=l,s[1]=a):(l=s[0],a=s[1]),H.useEffect(l,a);const r=po[e];let o;s[2]!==r.label?(o=n.jsxs("span",{className:"text-[14px] text-muted-foreground shimmer",children:[r.label,"..."]}),s[2]=r.label,s[3]=o):o=s[3];let i;return s[4]!==r.icon||s[5]!==o?(i=n.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:n.jsxs("span",{className:"flex items-center gap-1.5",children:[r.icon,o]})}),s[4]=r.icon,s[5]=o,s[6]=i):i=s[6],i}function ho(s){const e=$.c(3),{startedAt:t}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(fo,{}),e[0]=l):l=e[0];let a;return e[1]!==t?(a=n.jsxs("div",{className:"flex items-center gap-2.5 mt-1 pb-1 text-muted-foreground/40 select-none",children:[l,n.jsx(Wt,{since:t})]}),e[1]=t,e[2]=a):a=e[2],a}const bo=2e4;function yo(s){const e=$.c(11),{startedAt:t}=s;ft(1e3);const l=_e(),r=(t!==null?Date.now()-t:0)>=bo;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(go,{}),e[0]=o):o=e[0];let i;e[1]!==t?(i=t!==null&&n.jsx("span",{className:"opacity-60",children:n.jsx(Wt,{since:t})}),e[1]=t,e[2]=i):i=e[2];let d;e[3]!==i?(d=n.jsxs("div",{className:"flex items-center gap-2",children:[o,i]}),e[3]=i,e[4]=d):d=e[4];let c;e[5]!==r||e[6]!==l?(c=r&&l?.stop&&n.jsxs("div",{className:"flex items-center gap-2 pb-1 text-[13px] text-muted-foreground/60",children:[n.jsx("span",{children:"This is taking longer than usual."}),n.jsx("button",{type:"button",onClick:()=>l.stop(),className:"text-muted-foreground hover:text-foreground underline underline-offset-2",children:"Cancel"})]}),e[5]=r,e[6]=l,e[7]=c):c=e[7];let m;return e[8]!==d||e[9]!==c?(m=n.jsxs("div",{className:"flex flex-col gap-0.5",children:[d,c]}),e[8]=d,e[9]=c,e[10]=m):m=e[10],m}function jo(s){const e=$.c(20),{duration:t,parts:l,isStreaming:a}=s;let r;e[0]!==l?(r=l.every(So),e[0]=l,e[1]=r):r=e[1];const o=r;let i;e[2]!==t?(i=t&&t/1e3>1?`Thought for ${de(t/1e3)}`:"Thought",e[2]=t,e[3]=i):i=e[3];const d=i;let c;if(e[4]!==o||e[5]!==a||e[6]!==l){const y=l.map(No).join(`
|
|
42
|
+
${x}`;return{fallbackTitle:c,summary:p,usage:e?.usage,latency:t,detail:g,state:d}}function ml(s){const e=$.c(7),t=Ot(s);let l,a;e[0]!==t?({fallbackTitle:l,...a}=t,e[0]=t,e[1]=l,e[2]=a):(l=e[1],a=e[2]);let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(Ae,{icon:void 0,name:"Subtask",size:"2xs",className:"rounded-xs",fallbackIcon:n.jsx(Tt,{})}),e[3]=r):r=e[3];let o;return e[4]!==l||e[5]!==a?(o=n.jsx(B,{icon:r,title:l,...a}),e[4]=l,e[5]=a,e[6]=o):o=e[6],o}function pl(s){const e=$.c(11),t=Ot(s);let l,a;e[0]!==t?({fallbackTitle:l,...a}=t,e[0]=t,e[1]=l,e[2]=a):(l=e[1],a=e[2]);const r=Ws(s.part.input?.agent_id),o=r?.icon,i=r?.title??"Subtask";let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Tt,{}),e[3]=d):d=e[3];let c;e[4]!==o||e[5]!==i?(c=n.jsx(Ae,{icon:o,name:i,size:"2xs",className:"rounded-xs",fallbackIcon:d}),e[4]=o,e[5]=i,e[6]=c):c=e[6];const m=r?.title??l;let p;return e[7]!==a||e[8]!==c||e[9]!==m?(p=n.jsx(B,{icon:c,title:m,...a}),e[7]=a,e[8]=c,e[9]=m,e[10]=p):p=e[10],p}function xl(s){const e=$.c(16),{part:t}=s;if(!t.state.startsWith("output-"))return null;const l=t.input?.plan??"",r=t.output?.approved===!0;let o,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(kt,{className:"size-4 text-purple-500 shrink-0"}),i=n.jsx("span",{className:"text-[14px] font-medium text-foreground/80",children:"Implementation Plan"}),e[0]=o,e[1]=i):(o=e[0],i=e[1]);let d;e[2]!==r?(d=r&&n.jsxs("span",{className:"flex items-center gap-1 text-xs text-green-600 bg-green-500/10 px-1.5 py-0.5 rounded-md",children:[n.jsx(Ve,{size:12}),"Approved"]}),e[2]=r,e[3]=d):d=e[3];let c;e[4]!==r||e[5]!==t.state?(c=!r&&t.state==="output-available"&&n.jsx("span",{className:"text-xs text-muted-foreground/70 italic",children:"Rejected"}),e[4]=r,e[5]=t.state,e[6]=c):c=e[6];let m;e[7]!==d||e[8]!==c?(m=n.jsxs("div",{className:"flex items-center gap-2",children:[o,i,d,c]}),e[7]=d,e[8]=c,e[9]=m):m=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:"View plan"}),e[10]=p):p=e[10];let u;e[11]!==l?(u=n.jsxs("details",{className:"ml-6",children:[p,n.jsx("div",{className:"mt-1 pl-2 border-l-2 border-purple-500/30 prose prose-sm max-w-none text-sm",children:n.jsx(Xe,{id:"plan-content",part:{type:"text",text:l}})})]}),e[11]=l,e[12]=u):u=e[12];let f;return e[13]!==m||e[14]!==u?(f=n.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[m,u]}),e[13]=m,e[14]=u,e[15]=f):f=e[15],f}const Je={primary:"Primary",secondary:"Secondary",accent:"Accent",background:"Background",foreground:"Foreground"};function gl(s){return s.startsWith("http")?s:`https://${s}`}function lt(s){const e=$.c(2),{children:t}=s;let l;return e[0]!==t?(l=n.jsx("span",{className:"text-sm font-medium text-foreground",children:t}),e[0]=t,e[1]=l):l=e[1],l}function hl(s){const e=$.c(12),{name:t,value:l}=s;let a;e[0]!==l?(a=n.jsx("span",{className:"size-7 shrink-0 rounded-md border border-border",style:{backgroundColor:l},"aria-hidden":!0}),e[0]=l,e[1]=a):a=e[1];let r;e[2]!==t?(r=n.jsx("span",{className:"text-sm text-foreground",children:t}),e[2]=t,e[3]=r):r=e[3];let o;e[4]!==l?(o=n.jsx("span",{className:"text-xs font-mono tabular-nums text-muted-foreground",children:l}),e[4]=l,e[5]=o):o=e[5];let i;e[6]!==r||e[7]!==o?(i=n.jsxs("div",{className:"flex flex-col leading-tight min-w-0",children:[r,o]}),e[6]=r,e[7]=o,e[8]=i):i=e[8];let d;return e[9]!==a||e[10]!==i?(d=n.jsxs("div",{className:"flex items-center gap-2.5",children:[a,i]}),e[9]=a,e[10]=i,e[11]=d):d=e[11],d}function bl(s){const e=$.c(15),{role:t,family:l}=s;let a;e[0]!==l?(a=n.jsx("span",{className:"text-2xl font-medium leading-none text-foreground shrink-0",style:{fontFamily:l},"aria-hidden":!0,children:"Aa"}),e[0]=l,e[1]=a):a=e[1];let r;e[2]!==t?(r=n.jsx("span",{className:"text-xs text-muted-foreground",children:t}),e[2]=t,e[3]=r):r=e[3];let o;e[4]!==l?(o={fontFamily:l},e[4]=l,e[5]=o):o=e[5];let i;e[6]!==l||e[7]!==o?(i=n.jsx("span",{className:"text-sm text-foreground",style:o,children:l}),e[6]=l,e[7]=o,e[8]=i):i=e[8];let d;e[9]!==r||e[10]!==i?(d=n.jsxs("div",{className:"flex flex-col leading-tight",children:[r,i]}),e[9]=r,e[10]=i,e[11]=d):d=e[11];let c;return e[12]!==a||e[13]!==d?(c=n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted px-4 py-3",children:[a,d]}),e[12]=a,e[13]=d,e[14]=c):c=e[14],c}function yl(s){const e=$.c(3),{logo:t,favicon:l,name:a}=s,r=t??l;if(!r)return null;const o=a?`${a} logo`:"";let i;return e[0]!==r||e[1]!==o?(i=n.jsx("img",{src:r,alt:o,className:"size-16 shrink-0 rounded-lg border border-border bg-background object-contain p-2",onError:jl}),e[0]=r,e[1]=o,e[2]=i):i=e[2],i}function jl(s){s.target.style.display="none"}function Bt(s){const e=$.c(4),{colors:t}=s;let l;e[0]!==t?(l=Object.entries(t).filter(Nl),e[0]=t,e[1]=l):l=e[1];const a=l;if(a.length===0)return null;let r;return e[2]!==a?(r=n.jsx("div",{className:"flex h-1.5",children:a.map(vl)}),e[2]=a,e[3]=r):r=e[3],r}function vl(s){const[e,t]=s;return n.jsx("span",{className:"flex-1",style:{backgroundColor:t},title:`${Je[e]}: ${t}`,"aria-hidden":!0},e)}function Nl(s){const[,e]=s;return typeof e=="string"&&e.trim().length>0}function Ht(s){const e=$.c(36),{logo:t,favicon:l,name:a,domain:r,overview:o,colors:i,fonts:d,showDefaultBadge:c,isDefault:m}=s;let p;e[0]!==i?(p=i?Object.entries(i).filter(wl):[],e[0]=i,e[1]=p):p=e[1];const u=p;let f;e[2]!==d?(f=d?Object.entries(d).filter(_l):[],e[2]=d,e[3]=f):f=e[3];const x=f;let g;e[4]!==i?(g=i&&n.jsx(Bt,{colors:i}),e[4]=i,e[5]=g):g=e[5];let b;e[6]!==l||e[7]!==t||e[8]!==a?(b=n.jsx(yl,{logo:t,favicon:l,name:a}),e[6]=l,e[7]=t,e[8]=a,e[9]=b):b=e[9];let h;e[10]!==m||e[11]!==a||e[12]!==c?(h=a&&n.jsxs("span",{className:"inline-flex items-center gap-2 text-lg font-semibold text-foreground truncate",children:[a,c&&m&&n.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:[n.jsx(St,{className:"size-3 text-amber-500"}),"default"]})]}),e[10]=m,e[11]=a,e[12]=c,e[13]=h):h=e[13];let S;e[14]!==r?(S=r&&n.jsxs("a",{href:gl(r),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[r,n.jsx(wt,{className:"size-3 shrink-0"})]}),e[14]=r,e[15]=S):S=e[15];let y;e[16]!==h||e[17]!==S?(y=n.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[h,S]}),e[16]=h,e[17]=S,e[18]=y):y=e[18];let v;e[19]!==b||e[20]!==y?(v=n.jsxs("div",{className:"flex items-center gap-4",children:[b,y]}),e[19]=b,e[20]=y,e[21]=v):v=e[21];let j;e[22]!==o?(j=o&&n.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:o}),e[22]=o,e[23]=j):j=e[23];let N;e[24]!==u?(N=u.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx(lt,{children:"Colors"}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-3",children:u.map(kl)})]}),e[24]=u,e[25]=N):N=e[25];let k;e[26]!==x?(k=x.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx(lt,{children:"Typography"}),n.jsx("div",{className:"flex flex-wrap gap-2.5",children:x.map(Sl)})]}),e[26]=x,e[27]=k):k=e[27];let _;e[28]!==N||e[29]!==k||e[30]!==v||e[31]!==j?(_=n.jsxs("div",{className:"p-5 flex flex-col gap-6",children:[v,j,N,k]}),e[28]=N,e[29]=k,e[30]=v,e[31]=j,e[32]=_):_=e[32];let w;return e[33]!==_||e[34]!==g?(w=n.jsxs("div",{className:"mt-2 rounded-lg overflow-hidden border border-border",children:[g,_]}),e[33]=_,e[34]=g,e[35]=w):w=e[35],w}function Sl(s){const[e,t]=s;return n.jsx(bl,{role:e,family:t},e)}function kl(s){const[e,t]=s;return n.jsx(hl,{name:Je[e],value:t},e)}function _l(s){const[,e]=s;return typeof e=="string"&&e.trim().length>0}function wl(s){const[,e]=s;return typeof e=="string"&&e.trim().length>0}function Tl(s){const e=$.c(29),{part:t,latency:l}=s,a=re(t.state);let r;e[0]!==t.output?(r=ve(t.output),e[0]=t.output,e[1]=r):r=e[1];const o=r,i=a==="loading",d=a==="error"||o&&o.success===!1;if(i){const k=t.input;let _;e[2]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(ce,{className:"animate-pulse"}),e[2]=_):_=e[2];const w=k?.domain?`from ${k.domain}`:void 0;let T;return e[3]!==w?(T=n.jsx(B,{icon:_,title:"Extracting brand",summary:w,state:"loading",defaultOpen:!0}),e[3]=w,e[4]=T):T=e[4],T}if(d){let k;e[5]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(ce,{}),e[5]=k):k=e[5];const _=o?.error??"Unknown error";let w;e[6]!==l?(w=l!=null&&l>0?n.jsx(le,{latency:l}):void 0,e[6]=l,e[7]=w):w=e[7];let T;return e[8]!==_||e[9]!==w?(T=n.jsx(B,{icon:k,title:"Brand extraction failed",summary:_,state:"error",trailing:w}),e[8]=_,e[9]=w,e[10]=T):T=e[10],T}let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(ce,{className:"text-fuchsia-500"}),e[11]=c):c=e[11];const m=o?.name?`Brand set: ${o.name}`:"Brand context set",p=o?.domain;let u;e[12]!==l?(u=l!=null&&l>0?n.jsx(le,{latency:l}):void 0,e[12]=l,e[13]=u):u=e[13];let f;e[14]!==m||e[15]!==p||e[16]!==u?(f=n.jsx(B,{icon:c,title:m,summary:p,state:"idle",trailing:u}),e[14]=m,e[15]=p,e[16]=u,e[17]=f):f=e[17];const x=o?.logo,g=o?.favicon,b=o?.name,h=o?.domain,S=o?.overview,y=o?.colors,v=o?.fonts;let j;e[18]!==h||e[19]!==S||e[20]!==y||e[21]!==v||e[22]!==x||e[23]!==g||e[24]!==b?(j=n.jsx(Ht,{logo:x,favicon:g,name:b,domain:h,overview:S,colors:y,fonts:v}),e[18]=h,e[19]=S,e[20]=y,e[21]=v,e[22]=x,e[23]=g,e[24]=b,e[25]=j):j=e[25];let N;return e[26]!==j||e[27]!==f?(N=n.jsxs(n.Fragment,{children:[f,j]}),e[26]=j,e[27]=f,e[28]=N):N=e[28],N}function Cl(s){const e=$.c(27),{part:t,latency:l}=s,a=re(t.state);let r;e[0]!==t.output?(r=ve(t.output),e[0]=t.output,e[1]=r):r=e[1];const o=r,i=a==="loading",d=a==="error"||o&&o.success===!1;if(i){let g;return e[2]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(B,{icon:n.jsx(ce,{className:"animate-pulse"}),title:"Loading brand",state:"loading"}),e[2]=g):g=e[2],g}if(d||!o){let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(ce,{}),e[3]=g):g=e[3];let b;e[4]!==l?(b=l!=null&&l>0?n.jsx(le,{latency:l}):void 0,e[4]=l,e[5]=b):b=e[5];let h;return e[6]!==b?(h=n.jsx(B,{icon:g,title:"Couldn't load brand",state:"error",trailing:b}),e[6]=b,e[7]=h):h=e[7],h}let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(ce,{className:"text-fuchsia-500"}),e[8]=c):c=e[8];const m=o.name?`Brand · ${o.name}`:"Brand";let p;e[9]!==l?(p=l!=null&&l>0?n.jsx(le,{latency:l}):void 0,e[9]=l,e[10]=p):p=e[10];let u;e[11]!==o.domain||e[12]!==m||e[13]!==p?(u=n.jsx(B,{icon:c,title:m,summary:o.domain,state:"idle",trailing:p}),e[11]=o.domain,e[12]=m,e[13]=p,e[14]=u):u=e[14];let f;e[15]!==o.colors||e[16]!==o.domain||e[17]!==o.favicon||e[18]!==o.fonts||e[19]!==o.isDefault||e[20]!==o.logo||e[21]!==o.name||e[22]!==o.overview?(f=n.jsx(Ht,{logo:o.logo,favicon:o.favicon,name:o.name,domain:o.domain,overview:o.overview,colors:o.colors,fonts:o.fonts,showDefaultBadge:!0,isDefault:o.isDefault}),e[15]=o.colors,e[16]=o.domain,e[17]=o.favicon,e[18]=o.fonts,e[19]=o.isDefault,e[20]=o.logo,e[21]=o.name,e[22]=o.overview,e[23]=f):f=e[23];let x;return e[24]!==u||e[25]!==f?(x=n.jsxs(n.Fragment,{children:[u,f]}),e[24]=u,e[25]=f,e[26]=x):x=e[26],x}function $l(s){const e=$.c(32),{part:t,latency:l}=s;let a;e[0]!==t.state?(a=re(t.state),e[0]=t.state,e[1]=a):a=e[1];const r=a;let o,i,d,c;if(e[2]!==l||e[3]!==t.output||e[4]!==r){c=Symbol.for("react.early_return_sentinel");e:{const u=ve(t.output),f=Array.isArray(u?.items)?u.items:[],x=r==="loading",g=r==="error";if(x){let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(B,{icon:n.jsx(ce,{className:"animate-pulse"}),title:"Loading brands",state:"loading"}),e[9]=y):y=e[9],c=y;break e}if(g){let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(ce,{}),e[10]=y):y=e[10];let v;e[11]!==l?(v=l!=null&&l>0?n.jsx(le,{latency:l}):void 0,e[11]=l,e[12]=v):v=e[12];let j;e[13]!==v?(j=n.jsx(B,{icon:y,title:"Couldn't load brands",state:"error",trailing:v}),e[13]=v,e[14]=j):j=e[14],c=j;break e}if(f.length===0){let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(ce,{}),e[15]=y):y=e[15];let v;e[16]!==l?(v=l!=null&&l>0?n.jsx(le,{latency:l}):void 0,e[16]=l,e[17]=v):v=e[17];let j;e[18]!==v?(j=n.jsx(B,{icon:y,title:"No brands yet",summary:"The organization hasn't set up any brand context.",state:"idle",trailing:v}),e[18]=v,e[19]=j):j=e[19],c=j;break e}let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(ce,{className:"text-fuchsia-500"}),e[20]=b):b=e[20];const h=f.length===1?"1 brand":`${f.length} brands`;let S;e[21]!==l?(S=l!=null&&l>0?n.jsx(le,{latency:l}):void 0,e[21]=l,e[22]=S):S=e[22],e[23]!==h||e[24]!==S?(d=n.jsx(B,{icon:b,title:h,state:"idle",trailing:S}),e[23]=h,e[24]=S,e[25]=d):d=e[25],o="mt-2 flex flex-col gap-1.5",i=f.map(Il)}e[2]=l,e[3]=t.output,e[4]=r,e[5]=o,e[6]=i,e[7]=d,e[8]=c}else o=e[5],i=e[6],d=e[7],c=e[8];if(c!==Symbol.for("react.early_return_sentinel"))return c;let m;e[26]!==o||e[27]!==i?(m=n.jsx("div",{className:o,children:i}),e[26]=o,e[27]=i,e[28]=m):m=e[28];let p;return e[29]!==d||e[30]!==m?(p=n.jsxs(n.Fragment,{children:[d,m]}),e[29]=d,e[30]=m,e[31]=p):p=e[31],p}function Il(s){const e=s.colors?Object.entries(s.colors).filter(Ll):[];return n.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[s.colors&&n.jsx(Bt,{colors:s.colors}),n.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5",children:[(s.logo||s.favicon)&&n.jsx("img",{src:s.logo??s.favicon??void 0,alt:"",className:"size-8 shrink-0 rounded-md border border-border bg-background object-contain p-0.5",onError:Al}),n.jsxs("div",{className:"flex flex-col leading-tight min-w-0 flex-1",children:[n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-foreground truncate",children:[s.name??"Untitled",s.isDefault&&n.jsx(St,{className:"size-3 text-amber-500 shrink-0"})]}),s.domain&&n.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:s.domain})]}),e.length>0&&n.jsx("div",{className:"flex items-center gap-0.5 shrink-0",children:e.slice(0,5).map(Ml)})]})]},s.id??`${s.name}-${s.domain}`)}function Ml(s){const[e,t]=s;return n.jsx("span",{className:"size-3 rounded-full border border-border",style:{backgroundColor:t},title:`${Je[e]}: ${t}`,"aria-hidden":!0},e)}function Al(s){s.target.style.display="none"}function Ll(s){const[,e]=s;return typeof e=="string"&&e.trim().length>0}function Be(s){const e=$.c(4),{connection_id:t,iconSize:l}=s,a=l===void 0?"xs":l,r=Us(t);if(!r)return null;let o;return e[0]!==r.icon||e[1]!==r.title||e[2]!==a?(o=n.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:n.jsx(Ae,{icon:r.icon,name:r.title,size:a})}),e[0]=r.icon,e[1]=r.title,e[2]=a,e[3]=o):o=e[3],o}Be.Fallback=function({iconSize:e="xs"}){const t=e==="sm"?"size-6":"size-5";return n.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:n.jsx("div",{className:q(t,"rounded bg-muted animate-pulse")})})};function ke(s){const e=$.c(18),{connectionIds:t,maxVisibleIcons:l,iconSize:a,className:r}=s,o=l===void 0?2:l,i=a===void 0?"xs":a;if(t.length===0)return null;let d,c,m;if(e[0]!==r||e[1]!==t||e[2]!==i||e[3]!==o){const f=t.slice(0,o);d=t.length-o,e[7]!==r?(c=q("flex items-center justify-end -space-x-2",r),e[7]=r,e[8]=c):c=e[8];let x;e[9]!==i?(x=g=>n.jsx(H.Suspense,{fallback:n.jsx(Be.Fallback,{iconSize:i}),children:n.jsx(Be,{connection_id:g,iconSize:i})},g),e[9]=i,e[10]=x):x=e[10],m=f.map(x),e[0]=r,e[1]=t,e[2]=i,e[3]=o,e[4]=d,e[5]=c,e[6]=m}else d=e[4],c=e[5],m=e[6];let p;e[11]!==i||e[12]!==d?(p=d>0&&n.jsx("div",{className:q("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",i==="sm"?"size-8":"size-6"),children:n.jsxs("span",{className:q(i==="sm"?"text-sm":"text-xs","font-medium text-muted-foreground"),"aria-label":`and ${d} more`,children:["+",d]})}),e[11]=i,e[12]=d,e[13]=p):p=e[13];let u;return e[14]!==c||e[15]!==m||e[16]!==p?(u=n.jsxs("div",{className:c,children:[m,p]}),e[14]=c,e[15]=m,e[16]=p,e[17]=u):u=e[17],u}ke.Fallback=function({maxVisibleIcons:e=2,totalCount:t,iconSize:l="xs"}){const a=l==="sm"?"size-6":"size-5",r=l==="sm"?"size-8":"size-6",o=t!==void 0&&t>e;return n.jsxs("div",{className:"flex items-center -space-x-2",children:[Array.from({length:e}).map((i,d)=>n.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:n.jsx("div",{className:q(a,"rounded bg-muted animate-pulse")})},d)),o&&n.jsx("div",{className:q("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",r),children:n.jsx("div",{className:q(l==="sm"?"h-3.5 w-5":"h-3 w-4","rounded bg-muted animate-pulse")})})]})};const Rl="This document certifies that the bearer agent has been granted authorized access to the tools and capabilities described herein. The agent is permitted to operate within the scope defined by its instructions and shall act in accordance with the constraints set forth by the issuing organization. This credential remains valid for the duration of the agent's active status. Unauthorized modification of this agent's permissions or scope is prohibited. The issuing authority reserves the right to revoke access at any time. All actions performed by this agent are subject to audit and review by the organization administrator. ",ot=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null;function El(s){const e=$.c(64),{part:t,latency:l}=s,a=Ct(),r=re(t.state),o=H.useRef(null),i=H.useRef(null),d=H.useRef(null),c=H.useRef(null),m=H.useRef(null);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{ot?.matches||(m.current=o.current?.getBoundingClientRect()??null,o.current&&(o.current.style.willChange="transform"))},e[0]=p):p=e[0];const u=p;let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=P=>{if(ot?.matches)return;const V=m.current,X=o.current;if(!V||!X)return;const J=(P.clientX-V.left)/V.width*100,se=(P.clientY-V.top)/V.height*100;X.style.transform=`perspective(800px) rotateY(${(J-50)*.05}deg) rotateX(${(se-50)*-.05}deg)`,i.current&&(i.current.style.opacity="1",i.current.style.transform=`translate(${(J-50)*.15}px, ${(se-50)*.15}px)`),d.current&&(d.current.style.opacity="0.45"),c.current&&(c.current.style.opacity="0.45")},e[1]=f):f=e[1];const x=f;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{const P=o.current;P&&(P.style.transform="none",P.style.willChange="auto"),i.current&&(i.current.style.opacity="0.4",i.current.style.transform="translate(0, 0)"),d.current&&(d.current.style.opacity="0.3"),c.current&&(c.current.style.opacity="0.3"),m.current=null},e[2]=g):g=e[2];const b=g;if(r==="loading"){let P;return e[3]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(B,{icon:n.jsx(ie,{className:"animate-pulse"}),title:"Creating agent",state:"loading",defaultOpen:!0}),e[3]=P):P=e[3],P}if(r==="approval"){let P;return e[4]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(B,{icon:n.jsx(ie,{}),title:"Create agent",state:"idle"}),e[4]=P):P=e[4],P}if(r==="error"){let P;e[5]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(ie,{}),e[5]=P):P=e[5];const V=t.state==="output-denied"?"Agent creation cancelled":"Couldn't create agent";let X;e[6]!==l?(X=n.jsx(le,{latency:l}),e[6]=l,e[7]=X):X=e[7];let J;return e[8]!==V||e[9]!==X?(J=n.jsx(B,{icon:P,title:V,state:"error",trailing:X}),e[8]=V,e[9]=X,e[10]=J):J=e[10],J}let h,S,y;if(e[11]!==l||e[12]!==t.output){y=Symbol.for("react.early_return_sentinel");e:{if(h=ve(t.output)?.item,!h?.id||!h?.title){let P;e[16]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(ie,{}),e[16]=P):P=e[16];let V;e[17]!==l?(V=n.jsx(B,{icon:P,title:"Agent created",state:"idle",trailing:n.jsx(le,{latency:l})}),e[17]=l,e[18]=V):V=e[18],y=V;break e}S=(h.connections??[]).map(zl)}e[11]=l,e[12]=t.output,e[13]=h,e[14]=S,e[15]=y}else h=e[13],S=e[14],y=e[15];if(y!==Symbol.for("react.early_return_sentinel"))return y;const v=S;let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(ie,{className:"text-emerald-500"}),e[19]=j):j=e[19];const N=`Agent created: ${h.title}`;let k;e[20]!==l?(k=n.jsx(le,{latency:l}),e[20]=l,e[21]=k):k=e[21];let _;e[22]!==N||e[23]!==k?(_=n.jsx(B,{icon:j,title:N,state:"idle",trailing:k}),e[22]=N,e[23]=k,e[24]=_):_=e[24];let w;e[25]===Symbol.for("react.memo_cache_sentinel")?(w={transition:"transform 0.3s ease-out"},e[25]=w):w=e[25];let T;e[26]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx("div",{ref:i,className:"pointer-events-none absolute inset-[-20%] z-[1] select-none rounded-lg",style:{background:"linear-gradient(135deg, hsla(280, 60%, 80%, 0.35) 0%, transparent 35%), linear-gradient(315deg, hsla(190, 70%, 80%, 0.35) 0%, transparent 35%), linear-gradient(225deg, hsla(140, 55%, 80%, 0.3) 0%, transparent 30%), linear-gradient(45deg, hsla(320, 55%, 82%, 0.3) 0%, transparent 30%)",opacity:.4,transition:"opacity 0.3s ease, transform 0.3s ease-out"},"aria-hidden":"true"}),e[26]=T):T=e[26];let I;e[27]===Symbol.for("react.memo_cache_sentinel")?(I={textAlign:"justify",wordBreak:"break-all"},e[27]=I):I=e[27];let M,C;e[28]===Symbol.for("react.memo_cache_sentinel")?(M=n.jsx("p",{className:"pointer-events-none absolute inset-0 z-[1] select-none overflow-hidden text-[6px] font-light leading-[1.5] tracking-[0.06px] text-background opacity-50 mix-blend-overlay",style:I,"aria-hidden":"true",children:Rl.repeat(6)}),C=n.jsx("img",{src:"/stamp.svg",alt:"",className:"pointer-events-none absolute -right-10 -top-10 size-[140px] opacity-50 select-none","aria-hidden":"true"}),e[28]=M,e[29]=C):(M=e[28],C=e[29]);let A;e[30]===Symbol.for("react.memo_cache_sentinel")?(A=n.jsx("img",{ref:d,src:"/left-guilloche.png",alt:"",className:"pointer-events-none absolute inset-y-0 left-0 h-full w-auto select-none z-[1] mix-blend-overlay",style:{opacity:.3,transition:"opacity 0.3s ease"},"aria-hidden":"true"}),e[30]=A):A=e[30];let L;e[31]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx("img",{ref:c,src:"/right-guilloche.png",alt:"",className:"pointer-events-none absolute inset-y-0 right-0 h-full w-auto select-none z-[1] mix-blend-overlay",style:{opacity:.3,transition:"opacity 0.3s ease"},"aria-hidden":"true"}),e[31]=L):L=e[31];let F;e[32]!==h.icon||e[33]!==h.title?(F=n.jsx(ct,{icon:h.icon,name:h.title,size:"md"}),e[32]=h.icon,e[33]=h.title,e[34]=F):F=e[34];let z;e[35]!==h.title?(z=n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:h.title})}),e[35]=h.title,e[36]=z):z=e[36];let R;e[37]!==F||e[38]!==z?(R=n.jsxs("div",{className:"flex items-center gap-2.5 p-2",children:[F,z]}),e[37]=F,e[38]=z,e[39]=R):R=e[39];let E;e[40]!==h.description?(E=h.description&&n.jsx("div",{className:"px-2 pt-1 pr-16",children:n.jsx("p",{className:"text-sm leading-snug text-muted-foreground line-clamp-2",children:h.description})}),e[40]=h.description,e[41]=E):E=e[41];let D;e[42]!==R||e[43]!==E?(D=n.jsxs("div",{className:"relative",children:[R,E]}),e[42]=R,e[43]=E,e[44]=D):D=e[44];let W;e[45]!==v?(W=v.length>0&&n.jsx(H.Suspense,{fallback:n.jsx(ke.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:v.length}),children:n.jsx(ke,{connectionIds:v,iconSize:"xs",maxVisibleIcons:3,className:"flex items-center justify-start -space-x-1"})}),e[45]=v,e[46]=W):W=e[46];let U;e[47]!==W?(U=n.jsx("div",{className:"flex-1 min-w-0",children:W}),e[47]=W,e[48]=U):U=e[48];let O;e[49]!==h.id||e[50]!==a?(O=()=>a(h.id),e[49]=h.id,e[50]=a,e[51]=O):O=e[51];const K=`See agent: ${h.title}`;let G;e[52]!==O||e[53]!==K?(G=n.jsx("div",{className:"flex items-center gap-2 shrink-0",children:n.jsx(Se,{size:"sm",className:"h-7",onClick:O,"aria-label":K,children:"See agent"})}),e[52]=O,e[53]=K,e[54]=G):G=e[54];let Y;e[55]!==U||e[56]!==G?(Y=n.jsxs("div",{className:"relative z-[3] flex items-center gap-2.5 px-2 pt-6 pb-1",children:[U,G]}),e[55]=U,e[56]=G,e[57]=Y):Y=e[57];let Q;e[58]!==D||e[59]!==Y?(Q=n.jsx("div",{className:"mt-2 overflow-hidden rounded-xl border-[0.5px] border-border bg-card p-2.5",children:n.jsxs("div",{ref:o,className:"relative overflow-hidden rounded-lg bg-accent/25 p-2",style:w,onMouseEnter:u,onMouseMove:x,onMouseLeave:b,children:[T,M,C,A,L,D,Y]})}),e[58]=D,e[59]=Y,e[60]=Q):Q=e[60];let te;return e[61]!==Q||e[62]!==_?(te=n.jsxs(n.Fragment,{children:[_,Q]}),e[61]=Q,e[62]=_,e[63]=te):te=e[63],te}function zl(s){return s.connection_id}function Pl(s){const e=$.c(24),{agent:t}=s,l=Ct();if(!t.id)return null;let a;e[0]!==t.connections?(a=t.connections??[],e[0]=t.connections,e[1]=a):a=e[1];let r;e[2]!==a?(r=a.map(Fl),e[2]=a,e[3]=r):r=e[3];const o=r;let i;e[4]!==t.id||e[5]!==l?(i=()=>l(t.id),e[4]=t.id,e[5]=l,e[6]=i):i=e[6];let d;e[7]!==t.icon||e[8]!==t.title?(d=n.jsx(ct,{icon:t.icon,name:t.title,size:"sm"}),e[7]=t.icon,e[8]=t.title,e[9]=d):d=e[9];let c;e[10]!==t.title?(c=n.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[10]=t.title,e[11]=c):c=e[11];let m;e[12]!==t.description?(m=t.description&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:t.description}),e[12]=t.description,e[13]=m):m=e[13];let p;e[14]!==c||e[15]!==m?(p=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[c,m]}),e[14]=c,e[15]=m,e[16]=p):p=e[16];let u;e[17]!==o?(u=o.length>0&&n.jsx(H.Suspense,{fallback:n.jsx(ke.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:o.length}),children:n.jsx(ke,{connectionIds:o,iconSize:"xs",maxVisibleIcons:3})}),e[17]=o,e[18]=u):u=e[18];let f;return e[19]!==i||e[20]!==d||e[21]!==p||e[22]!==u?(f=n.jsxs("button",{type:"button",onClick:i,className:"group flex w-full items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[d,p,u]}),e[19]=i,e[20]=d,e[21]=p,e[22]=u,e[23]=f):f=e[23],f}function Fl(s){return s.connection_id}function Dl(s){const e=$.c(41),{part:t,latency:l}=s,a=je(),{org:r}=he();let o;e[0]!==t.state?(o=re(t.state),e[0]=t.state,e[1]=o):o=e[1];const i=o;let d,c,m,p,u,f;if(e[2]!==l||e[3]!==t.output||e[4]!==t.state||e[5]!==i){f=Symbol.for("react.early_return_sentinel");e:{const h=ve(t.output);if(c=Array.isArray(h?.items)?h.items:[],i==="loading"){let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(B,{icon:n.jsx(ie,{className:"animate-pulse"}),title:"Loading agents",state:"loading"}),e[12]=N):N=e[12],f=N;break e}if(i==="approval"){let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(B,{icon:n.jsx(ie,{}),title:"List agents",state:"idle"}),e[13]=N):N=e[13],f=N;break e}if(i==="error"){let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(ie,{}),e[14]=N):N=e[14];const k=t.state==="output-denied"?"Agent list unavailable":"Couldn't load agents";let _;e[15]!==l?(_=n.jsx(le,{latency:l}),e[15]=l,e[16]=_):_=e[16];let w;e[17]!==k||e[18]!==_?(w=n.jsx(B,{icon:N,title:k,state:"error",trailing:_}),e[17]=k,e[18]=_,e[19]=w):w=e[19],f=w;break e}if(c.length===0){let N;e[20]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(ie,{}),e[20]=N):N=e[20];let k;e[21]!==l?(k=n.jsx(B,{icon:N,title:"No agents yet",summary:"This organization hasn't created any agents.",state:"idle",trailing:n.jsx(le,{latency:l})}),e[21]=l,e[22]=k):k=e[22],f=k;break e}const S=c.slice(0,zt);d=c.length-S.length;let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(ie,{className:"text-emerald-500"}),e[23]=y):y=e[23];const v=c.length===1?"1 agent":`${c.length} agents`;let j;e[24]!==l?(j=n.jsx(le,{latency:l}),e[24]=l,e[25]=j):j=e[25],e[26]!==v||e[27]!==j?(u=n.jsx(B,{icon:y,title:v,state:"idle",trailing:j}),e[26]=v,e[27]=j,e[28]=u):u=e[28],m="mt-2 flex flex-col gap-1.5",p=S.map(Ol)}e[2]=l,e[3]=t.output,e[4]=t.state,e[5]=i,e[6]=d,e[7]=c,e[8]=m,e[9]=p,e[10]=u,e[11]=f}else d=e[6],c=e[7],m=e[8],p=e[9],u=e[10],f=e[11];if(f!==Symbol.for("react.early_return_sentinel"))return f;let x;e[29]!==d||e[30]!==c||e[31]!==a||e[32]!==r?(x=d>0&&n.jsx(Pt,{count:c.length,noun:"agents",onClick:()=>a({to:"/$org/settings/agents",params:{org:r.slug}})}),e[29]=d,e[30]=c,e[31]=a,e[32]=r,e[33]=x):x=e[33];let g;e[34]!==m||e[35]!==p||e[36]!==x?(g=n.jsxs("div",{className:m,children:[p,x]}),e[34]=m,e[35]=p,e[36]=x,e[37]=g):g=e[37];let b;return e[38]!==u||e[39]!==g?(b=n.jsxs(n.Fragment,{children:[u,g]}),e[38]=u,e[39]=g,e[40]=b):b=e[40],b}function Ol(s){return n.jsx(Pl,{agent:s},s.id)}const Bl={active:"bg-emerald-500",inactive:"bg-muted-foreground",error:"bg-destructive"};function Hl(s){const e=$.c(27),{connection:t}=s,l=je(),{org:a}=he(),r=t.slug,o=t.description||t.app_name,i=!r||void 0;let d;e[0]!==l||e[1]!==a||e[2]!==r?(d=()=>r&&l({to:"/$org/settings/connections/$appSlug",params:{org:a.slug,appSlug:r}}),e[0]=l,e[1]=a,e[2]=r,e[3]=d):d=e[3];let c;e[4]!==t.icon||e[5]!==t.title?(c=n.jsx(Ae,{icon:t.icon,name:t.title,size:"sm"}),e[4]=t.icon,e[5]=t.title,e[6]=c):c=e[6];let m;e[7]!==t.title?(m=n.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[7]=t.title,e[8]=m):m=e[8];let p;e[9]!==o?(p=o&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:o}),e[9]=o,e[10]=p):p=e[10];let u;e[11]!==m||e[12]!==p?(u=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[m,p]}),e[11]=m,e[12]=p,e[13]=u):u=e[13];const f=Bl[t.status]??"bg-muted-foreground";let x;e[14]!==f?(x=q("size-2 shrink-0 rounded-full",f),e[14]=f,e[15]=x):x=e[15];let g;e[16]!==x?(g=n.jsx("span",{className:x,"aria-hidden":"true"}),e[16]=x,e[17]=g):g=e[17];let b;e[18]!==t.status?(b=n.jsx("span",{className:"sr-only",children:t.status}),e[18]=t.status,e[19]=b):b=e[19];let h;return e[20]!==i||e[21]!==b||e[22]!==d||e[23]!==c||e[24]!==u||e[25]!==g?(h=n.jsxs("button",{type:"button","aria-disabled":i,onClick:d,className:"group flex w-full items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer aria-disabled:cursor-default aria-disabled:hover:bg-card",children:[c,u,g,b]}),e[20]=i,e[21]=b,e[22]=d,e[23]=c,e[24]=u,e[25]=g,e[26]=h):h=e[26],h}function Wl(s){const e=$.c(40),{part:t,latency:l}=s,a=je(),{org:r}=he();let o;e[0]!==t.state?(o=re(t.state),e[0]=t.state,e[1]=o):o=e[1];const i=o;let d,c,m,p,u,f;if(e[2]!==l||e[3]!==t.output||e[4]!==t.state||e[5]!==i){f=Symbol.for("react.early_return_sentinel");e:{const h=ve(t.output);if(c=(Array.isArray(h?.items)?h.items:[]).filter(Vl),i==="loading"||i==="approval"){let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(B,{icon:n.jsx(Ce,{className:"animate-pulse"}),title:"Loading connections",state:"loading"}),e[12]=N):N=e[12],f=N;break e}if(i==="error"){let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(Ce,{}),e[13]=N):N=e[13];const k=t.state==="output-denied"?"Connection list unavailable":"Couldn't load connections";let _;e[14]!==l?(_=n.jsx(le,{latency:l}),e[14]=l,e[15]=_):_=e[15];let w;e[16]!==k||e[17]!==_?(w=n.jsx(B,{icon:N,title:k,state:"error",trailing:_}),e[16]=k,e[17]=_,e[18]=w):w=e[18],f=w;break e}if(c.length===0){let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(Ce,{}),e[19]=N):N=e[19];let k;e[20]!==l?(k=n.jsx(B,{icon:N,title:"No connections yet",summary:"This organization hasn't connected any MCPs.",state:"idle",trailing:n.jsx(le,{latency:l})}),e[20]=l,e[21]=k):k=e[21],f=k;break e}const S=c.slice(0,zt);d=c.length-S.length;let y;e[22]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Ce,{className:"text-emerald-500"}),e[22]=y):y=e[22];const v=c.length===1?"1 connection":`${c.length} connections`;let j;e[23]!==l?(j=n.jsx(le,{latency:l}),e[23]=l,e[24]=j):j=e[24],e[25]!==v||e[26]!==j?(u=n.jsx(B,{icon:y,title:v,state:"idle",trailing:j}),e[25]=v,e[26]=j,e[27]=u):u=e[27],m="mt-2 flex flex-col gap-1.5",p=S.map(Ul)}e[2]=l,e[3]=t.output,e[4]=t.state,e[5]=i,e[6]=d,e[7]=c,e[8]=m,e[9]=p,e[10]=u,e[11]=f}else d=e[6],c=e[7],m=e[8],p=e[9],u=e[10],f=e[11];if(f!==Symbol.for("react.early_return_sentinel"))return f;let x;e[28]!==d||e[29]!==c||e[30]!==a||e[31]!==r?(x=d>0&&n.jsx(Pt,{count:c.length,noun:"connections",onClick:()=>a({to:"/$org/settings/connections",params:{org:r.slug}})}),e[28]=d,e[29]=c,e[30]=a,e[31]=r,e[32]=x):x=e[32];let g;e[33]!==m||e[34]!==p||e[35]!==x?(g=n.jsxs("div",{className:m,children:[p,x]}),e[33]=m,e[34]=p,e[35]=x,e[36]=g):g=e[36];let b;return e[37]!==u||e[38]!==g?(b=n.jsxs(n.Fragment,{children:[u,g]}),e[37]=u,e[38]=g,e[39]=b):b=e[39],b}function Ul(s){return n.jsx(Hl,{connection:s},s.id)}function Vl(s){return s.connection_type!=="VIRTUAL"}function ql(){const s=$.c(37),e=qe(),{sendMessage:t,isStreaming:l,messages:a}=ws(),{org:r}=he(),o=e?.virtualMcpId,{prompts:i}=Hs(r.slug),d=o??null;let c;s[0]!==r.id||s[1]!==r.slug||s[2]!==d?(c={connectionId:d,orgId:r.id,orgSlug:r.slug},s[0]=r.id,s[1]=r.slug,s[2]=d,s[3]=c):c=s[3];const m=vt(c),[p,u]=H.useState(null);if(!o||l||!Ls(o)||!a.some(Gl))return null;let x;if(s[4]!==i||s[5]!==o){let C;s[7]!==o?(C=A=>A.agentId===o&&A.promptName,s[7]=o,s[8]=C):C=s[8],x=i.find(C),s[4]=i,s[5]=o,s[6]=x}else x=s[6];const g=x;if(!g)return null;let b;s[9]!==m||s[10]!==t?(b=async(C,A)=>{if(!m){Fe.error("MCP client not available");return}try{const L=await qs(m,C.name,A);await t({type:"doc",content:[{type:"paragraph",content:[Lt({id:C.name,name:Ke(C.name,Ge(C._meta)),metadata:L.messages,char:"/",kind:"prompt",args:A}),{type:"text",text:" "}]}]})}catch(L){console.error("[next-action-chip] failed",L),Fe.error("Failed to load prompt. Please try again.")}},s[9]=m,s[10]=t,s[11]=b):b=s[11];const h=b;let S;s[12]!==g._meta||s[13]!==g.arguments||s[14]!==g.description||s[15]!==g.promptName||s[16]!==g.title||s[17]!==h?(S=()=>{const C={name:g.promptName,title:g.title,description:g.description,arguments:g.arguments,_meta:g._meta};if(C.arguments&&C.arguments.length>0){u(C);return}h(C)},s[12]=g._meta,s[13]=g.arguments,s[14]=g.description,s[15]=g.promptName,s[16]=g.title,s[17]=h,s[18]=S):S=s[18];const y=S;let v,j;s[19]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(Vs,{size:12,className:"shrink-0 text-purple-500"}),j=n.jsx("span",{className:"font-medium text-foreground/80",children:"Next:"}),s[19]=v,s[20]=j):(v=s[19],j=s[20]);let N;s[21]!==g.title?(N=n.jsx("span",{className:"truncate",children:g.title}),s[21]=g.title,s[22]=N):N=s[22];let k;s[23]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(ut,{size:12,className:"shrink-0 transition-transform duration-150 group-hover:translate-x-0.5"}),s[23]=k):k=s[23];let _;s[24]!==y||s[25]!==N?(_=n.jsxs("button",{type:"button",onClick:y,className:"group mt-3 flex items-center gap-2 self-start rounded-full border border-border bg-background px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:border-border hover:bg-accent/40 hover:text-foreground",children:[v,j,N,k]}),s[24]=y,s[25]=N,s[26]=_):_=s[26];let w;s[27]===Symbol.for("react.memo_cache_sentinel")?(w=C=>u(C),s[27]=w):w=s[27];let T;s[28]!==p||s[29]!==h?(T=async C=>{const A=p;u(null),A&&await h(A,C)},s[28]=p,s[29]=h,s[30]=T):T=s[30];let I;s[31]!==p||s[32]!==T?(I=n.jsx(mn,{prompt:p,setPrompt:w,onSubmit:T}),s[31]=p,s[32]=T,s[33]=I):I=s[33];let M;return s[34]!==I||s[35]!==_?(M=n.jsxs(n.Fragment,{children:[_,I]}),s[34]=I,s[35]=_,s[36]=M):M=s[36],M}function Gl(s){return s.role==="user"||s.parts.some(Kl)}function Kl(s){return s.type==="tool-user_ask"&&s.state==="output-available"}function Xl(s){const e=$.c(5),{parts:t}=s,l=t?.length,a=t?.[t.length-1];let r;e[0]!==a||e[1]!==l?(r={enabled:!0,contentDeps:[l,a]},e[0]=a,e[1]=l,e[2]=r):r=e[2];const{sentinelRef:o}=Et(r);let i;return e[3]!==o?(i=n.jsx("div",{ref:o,className:"h-0"}),e[3]=o,e[4]=i):i=e[4],i}function Jl(s){const e=new Map;for(let t=s.length-1;t>=0;t--){const l=s[t]?.parts;if(l)for(const a of l){const r=a;if(r.type!=="data-deck-updated")continue;const o=r.data;if(!o?.path)continue;const i=`deck:${o.path}`;e.has(i)||e.set(i,{tabId:$s(o.path),label:o.name||o.path,kind:o.kind==="page"?"page":"deck"})}}return Array.from(e.values())}function Ql(){const s=$.c(9),e=je(),t=_e()?.messages??[],l=Jl(t);if(l.length===0)return null;const a=l.some(Zl),r=l.some(Yl),o=a?r?"Slides & pages in this chat":"Slides in this chat":"Pages in this chat",i="flex flex-col gap-1.5 py-2";let d;s[0]!==o?(d=n.jsx("div",{className:"text-[12px] text-muted-foreground/70 uppercase tracking-wide",children:o}),s[0]=o,s[1]=d):d=s[1];const c="flex flex-wrap gap-2";let m;s[2]!==e?(m=x=>n.jsxs("button",{type:"button",onClick:()=>e({to:".",search:g=>({...g,main:x.tabId}),replace:!0}),className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border bg-muted/30 hover:bg-muted/60 text-[13px] transition-colors",children:[x.kind==="deck"?n.jsx(Ne,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(Es,{className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"font-medium text-foreground",children:x.label})]},x.tabId),s[2]=e,s[3]=m):m=s[3];const p=l.map(m);let u;s[4]!==p?(u=n.jsx("div",{className:c,children:p}),s[4]=p,s[5]=u):u=s[5];let f;return s[6]!==d||s[7]!==u?(f=n.jsxs("div",{className:i,children:[d,u]}),s[6]=d,s[7]=u,s[8]=f):f=s[8],f}function Yl(s){return s.kind==="page"}function Zl(s){return s.kind==="deck"}async function eo(s,e){const t=await fetch(`/api/${e}/threads/${encodeURIComponent(s)}/outputs`,{credentials:"include"});if(!t.ok)throw new Error(`Failed to fetch thread outputs: ${t.status}`);return(await t.json()).objects??[]}function La(){const s=$.c(2),e=_e()?.messages??[];let t;return s[0]!==e?(t=e.some(to),s[0]=e,s[1]=t):t=s[1],t}function to(s){return s.parts?.some(so)}function so(s){const e=s;return(e.type==="tool-share_with_user"||e.type==="tool-bash"||e.type==="tool-write")&&e.state==="output-available"}function no(s,e){const t=$.c(9),{org:l}=he();let a;t[0]!==s?(a=me.threadOutputs(s??""),t[0]=s,t[1]=a):a=t[1];let r;t[2]!==l||t[3]!==s?(r=()=>eo(s??"",l.slug),t[2]=l,t[3]=s,t[4]=r):r=t[4];const o=!!s&&(e?.enabled??!0);let i;return t[5]!==a||t[6]!==r||t[7]!==o?(i={queryKey:a,queryFn:r,enabled:o,staleTime:0},t[5]=a,t[6]=r,t[7]=o,t[8]=i):i=t[8],He(i)}function lo(s){const e=$.c(20),{file:t}=s,l=je();let a;e[0]!==t.key||e[1]!==l?(a=()=>l({to:".",search:f=>({...f,main:Is(t.key)}),replace:!0}),e[0]=t.key,e[1]=l,e[2]=a):a=e[2];const r=a;let o;e[3]!==t.filename?(o=n.jsx(Ns,{filename:t.filename,className:"h-5 w-4 shrink-0"}),e[3]=t.filename,e[4]=o):o=e[4];let i;e[5]!==t.filename||e[6]!==r?(i=n.jsx("button",{type:"button",onClick:r,className:"min-w-0 flex-1 truncate text-left text-[13px] font-medium text-foreground hover:underline",title:t.filename,children:t.filename}),e[5]=t.filename,e[6]=r,e[7]=i):i=e[7];const d=`Download ${t.filename}`;let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(_t,{className:"size-3.5"}),e[8]=c):c=e[8];let m;e[9]!==t.downloadUrl||e[10]!==t.filename||e[11]!==d?(m=n.jsx("a",{href:t.downloadUrl,download:t.filename,className:"hidden shrink-0 text-muted-foreground hover:text-foreground group-hover:block",title:"Download","aria-label":d,children:c}),e[9]=t.downloadUrl,e[10]=t.filename,e[11]=d,e[12]=m):m=e[12];let p;e[13]!==r?(p=n.jsx(Se,{variant:"outline",size:"sm",className:"h-7 shrink-0 px-2.5 text-xs",onClick:r,children:"Open"}),e[13]=r,e[14]=p):p=e[14];let u;return e[15]!==o||e[16]!==i||e[17]!==m||e[18]!==p?(u=n.jsxs("div",{className:"group flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[o,i,m,p]}),e[15]=o,e[16]=i,e[17]=m,e[18]=p,e[19]=u):u=e[19],u}function at(s){return s.split("/").pop()??s}const oo=/(^|\/)output\//;function ao(s){const e=new Set;for(const t of s.parts??[]){const l=t;if(l.state==="output-available"){if(l.type==="tool-share_with_user"){const a=l.output?.filename??l.input?.name??(l.input?.source?at(l.input.source):null);a&&e.add(a)}else if(l.type==="tool-write"){const a=l.input?.path;a&&oo.test(a)&&e.add(at(a))}}}return e}function ro(s){const e=$.c(4),{threadId:t,message:l}=s,a=ao(l),r=a.size>0;let o;e[0]!==r?(o={enabled:r},e[0]=r,e[1]=o):o=e[1];const{data:i}=no(t,o);if(a.size===0)return null;const d=(i??[]).filter(u=>a.has(u.filename));if(d.length===0)return null;const c="flex flex-col gap-1.5 py-2",m=d.map(io);let p;return e[2]!==m?(p=n.jsx("div",{className:c,children:m}),e[2]=m,e[3]=p):p=e[3],p}function io(s){return n.jsx(lo,{file:s},s.key)}function co(s){return s.type==="reasoning"}function uo(s){const e=[],t=new Set,l=new Map,a=new Map,r=new Map;if(s){let i=null;for(let d=0;d<s.parts.length;d++){const c=s.parts[d];if(co(c)){i||(i={parts:[],startIndex:d},e.push(i)),i.parts.push(c),t.add(d);continue}if(i=null,c.type==="data-tool-metadata"&&"id"in c&&"data"in c){const m=c.data,p={};m.annotations&&(p.annotations=m.annotations),typeof m.latencyMs=="number"&&Number.isFinite(m.latencyMs)&&(p.latencySeconds=m.latencyMs/1e3),typeof m.outputBytes=="number"&&Number.isFinite(m.outputBytes)&&m.outputBytes>=0&&(p.outputBytes=m.outputBytes),m._meta&&typeof m._meta=="object"&&(p._meta=m._meta),l.set(c.id,p);continue}if(c.type==="data-tool-subtask-metadata"&&"id"in c){a.set(c.id,c.data);continue}if(c.type==="data-web-search"&&"id"in c&&"data"in c){const m=c.id,p=c.data;r.set(m,p.text??"");continue}}}const o=[];if(s){let i=[],d=[];const c=new Set,m=()=>{for(const p of i)c.has(p)||(c.add(p),o.push({kind:"reasoning-group",group:p}));for(const p of d)o.push({kind:"part",index:p.index});i=[],d=[]};for(let p=0;p<s.parts.length;p++){const u=s.parts[p];if(u.type==="step-start"){m();continue}if(t.has(p)){const f=e.find(x=>x.startIndex===p);f&&i.push(f);continue}u.type.startsWith("data-")||d.push({index:p})}m()}return{reasoningGroups:e,renderOrder:o,dataParts:{toolMetadata:l,toolSubtaskMetadata:a,webSearchStreaming:r}}}function Wt(s){const e=$.c(9),{since:t}=s;let l;e[0]!==t?(l=()=>et(t,Date.now()),e[0]=t,e[1]=l):l=e[1];const[a,r]=H.useState(l);let o,i;e[2]!==t?(o=()=>{const p=setInterval(()=>r(et(t,Date.now())),100);return()=>clearInterval(p)},i=[t],e[2]=t,e[3]=o,e[4]=i):(o=e[3],i=e[4]),H.useEffect(o,i);const d=a/1e3;let c;e[5]!==d?(c=de(d),e[5]=d,e[6]=c):c=e[6];let m;return e[7]!==c?(m=n.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground/50",children:c}),e[7]=c,e[8]=m):m=e[8],m}const Ut=[{delay:0},{delay:100},{delay:200},{delay:100},{delay:200},{delay:200},{delay:300},{delay:300},{delay:400}];function fo(){const s=$.c(5),[e]=H.useState(mo);let t;s[0]===Symbol.for("react.memo_cache_sentinel")?(t={gridTemplateColumns:"repeat(3, 3px)",gap:"1.5px",width:"fit-content"},s[0]=t):t=s[0];let l;s[1]!==e?(l=Ut.map((r,o)=>{const{delay:i}=r;return n.jsx("div",{className:"rounded-[1px]",style:{width:3,height:3,"--cell-color":e[o],animation:"grid-ripple 1s ease infinite",animationDelay:`${i}ms`}},o)}),s[1]=e,s[2]=l):l=s[2];let a;return s[3]!==l?(a=n.jsx("div",{className:"grid",style:t,children:l}),s[3]=l,s[4]=a):a=s[4],a}function mo(){const s=`var(--chart-${Math.ceil(Math.random()*5)})`;return Ut.map(()=>Math.random()<.6?"color-mix(in srgb, var(--muted-foreground) 25%, transparent)":s)}const po={planning:{icon:n.jsx(us,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Planning next moves"},thinking:{icon:n.jsx(Ue,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Thinking"}},xo=1200;function go(){const s=$.c(7),[e,t]=H.useState("planning");let l,a;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{const d=setTimeout(()=>{t("thinking")},xo);return()=>{clearTimeout(d)}},a=[],s[0]=l,s[1]=a):(l=s[0],a=s[1]),H.useEffect(l,a);const r=po[e];let o;s[2]!==r.label?(o=n.jsxs("span",{className:"text-[14px] text-muted-foreground shimmer",children:[r.label,"..."]}),s[2]=r.label,s[3]=o):o=s[3];let i;return s[4]!==r.icon||s[5]!==o?(i=n.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:n.jsxs("span",{className:"flex items-center gap-1.5",children:[r.icon,o]})}),s[4]=r.icon,s[5]=o,s[6]=i):i=s[6],i}function ho(s){const e=$.c(3),{startedAt:t}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(fo,{}),e[0]=l):l=e[0];let a;return e[1]!==t?(a=n.jsxs("div",{className:"flex items-center gap-2.5 mt-1 pb-1 text-muted-foreground/40 select-none",children:[l,n.jsx(Wt,{since:t})]}),e[1]=t,e[2]=a):a=e[2],a}const bo=2e4;function yo(s){const e=$.c(11),{startedAt:t}=s;ft(1e3);const l=_e(),r=(t!==null?Date.now()-t:0)>=bo;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(go,{}),e[0]=o):o=e[0];let i;e[1]!==t?(i=t!==null&&n.jsx("span",{className:"opacity-60",children:n.jsx(Wt,{since:t})}),e[1]=t,e[2]=i):i=e[2];let d;e[3]!==i?(d=n.jsxs("div",{className:"flex items-center gap-2",children:[o,i]}),e[3]=i,e[4]=d):d=e[4];let c;e[5]!==r||e[6]!==l?(c=r&&l?.stop&&n.jsxs("div",{className:"flex items-center gap-2 pb-1 text-[13px] text-muted-foreground/60",children:[n.jsx("span",{children:"This is taking longer than usual."}),n.jsx("button",{type:"button",onClick:()=>l.stop(),className:"text-muted-foreground hover:text-foreground underline underline-offset-2",children:"Cancel"})]}),e[5]=r,e[6]=l,e[7]=c):c=e[7];let m;return e[8]!==d||e[9]!==c?(m=n.jsxs("div",{className:"flex flex-col gap-0.5",children:[d,c]}),e[8]=d,e[9]=c,e[10]=m):m=e[10],m}function jo(s){const e=$.c(20),{duration:t,parts:l,isStreaming:a}=s;let r;e[0]!==l?(r=l.every(So),e[0]=l,e[1]=r):r=e[1];const o=r;let i;e[2]!==t?(i=t&&t/1e3>1?`Thought for ${de(t/1e3)}`:"Thought",e[2]=t,e[3]=i):i=e[3];const d=i;let c;if(e[4]!==o||e[5]!==a||e[6]!==l){const y=l.map(No).join(`
|
|
43
43
|
`).trim().split(`
|
|
44
44
|
`).filter(Boolean),v=a?y[y.length-1]??"":y[0]??"";c=!o&&v?v.length>100?v.slice(0,100)+"…":v:void 0,e[4]=o,e[5]=a,e[6]=l,e[7]=c}else c=e[7];const m=c;let p;if(e[8]!==o||e[9]!==l){const S=l.map(vo).join(`
|
|
45
45
|
|
|
46
|
-
`);p=!o&&S.trim()?S:null,e[8]=o,e[9]=l,e[10]=p}else p=e[10];const u=p,f=!a&&t!=null?t/1e3:void 0;let x;e[11]!==a?(x=a?n.jsx(Ue,{className:"size-4"}):n.jsx(cs,{className:"size-4"}),e[11]=a,e[12]=x):x=e[12];const g=a?"Thinking...":d,b=a?"loading":"idle";let h;return e[13]!==u||e[14]!==f||e[15]!==m||e[16]!==x||e[17]!==g||e[18]!==b?(h=n.jsx(B,{icon:x,title:g,summary:m,detail:u,state:b,detailVariant:"prose",latency:f}),e[13]=u,e[14]=f,e[15]=m,e[16]=x,e[17]=g,e[18]=b,e[19]=h):h=e[19],h}function vo(s){return s.text??""}function No(s){return s.text??""}function So(s){return s.text?.includes("REDACTED")}const ko=3;function _o(s,e){let t=-1;for(let l=s.length-1;l>=0;l--){const a=s[l];if(a.kind==="part"&&e[a.index]?.type==="text"){t=l;break}}return t===-1?{collapsed:[],tail:s}:{collapsed:s.slice(0,t),tail:s.slice(t)}}function wo(s,e){let t=0,l=0;for(const a of s)if(a.kind==="reasoning-group")l++;else{const r=e[a.index]?.type;r==="text"?l++:(r==="dynamic-tool"||r?.startsWith("tool-"))&&r!=="tool-todo_write"&&r!=="tool-update_interests"&&t++}return{toolCalls:t,messages:l}}function To(s){const e=$.c(8),{toolCalls:t,messages:l}=s;let a;e[0]!==l||e[1]!==t?(a=t>0&&n.jsxs(n.Fragment,{children:[n.jsx(ps,{className:"size-3.5 shrink-0"}),n.jsxs("span",{children:[t," tool call",t===1?"":"s",l>0?",":""]})]}),e[0]=l,e[1]=t,e[2]=a):a=e[2];let r;e[3]!==l?(r=l>0&&n.jsxs(n.Fragment,{children:[n.jsx(ds,{className:"size-3.5 shrink-0"}),n.jsxs("span",{children:[l," message",l===1?"":"s"]})]}),e[3]=l,e[4]=r):r=e[4];let o;return e[5]!==a||e[6]!==r?(o=n.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[a,r]}),e[5]=a,e[6]=r,e[7]=o):o=e[7],o}function Co(s){const e=$.c(28),{items:t,message:l,reasoningGroups:a,isReasoningActive:r,totalDuration:o,dataParts:i,isLoading:d,isLast:c}=s;let m;e[0]!==t||e[1]!==l.parts?(m=wo(t,l.parts),e[0]=t,e[1]=l.parts,e[2]=m):m=e[2];const{toolCalls:p,messages:u}=m;if(p===0&&u===0)return null;let f;e[3]!==u||e[4]!==p?(f=n.jsx(To,{toolCalls:p,messages:u}),e[3]=u,e[4]=p,e[5]=f):f=e[5];let x;if(e[6]!==i||e[7]!==c||e[8]!==d||e[9]!==r||e[10]!==t||e[11]!==l||e[12]!==a||e[13]!==o){let h;e[15]!==i||e[16]!==c||e[17]!==d||e[18]!==r||e[19]!==l||e[20]!==a||e[21]!==o?(h=(S,y)=>qt({item:S,renderIndex:y,message:l,reasoningGroups:a,isReasoningActive:r,totalDuration:o,dataParts:i,isLoading:d,isLast:c,isLastVisiblePart:!1}),e[15]=i,e[16]=c,e[17]=d,e[18]=r,e[19]=l,e[20]=a,e[21]=o,e[22]=h):h=e[22],x=t.map(h),e[6]=i,e[7]=c,e[8]=d,e[9]=r,e[10]=t,e[11]=l,e[12]=a,e[13]=o,e[14]=x}else x=e[14];let g;e[23]!==x?(g=n.jsx("div",{className:"flex flex-col gap-3 sm:gap-2 pt-1",children:x}),e[23]=x,e[24]=g):g=e[24];let b;return e[25]!==f||e[26]!==g?(b=n.jsx(B,{icon:null,alwaysChevron:!0,title:f,state:"idle",children:g}),e[25]=f,e[26]=g,e[27]=b):b=e[27],b}function qt({item:s,renderIndex:e,message:t,reasoningGroups:l,isReasoningActive:a,totalDuration:r,dataParts:o,isLoading:i,isLast:d,isLastVisiblePart:c,renderOrder:m}){if(s.kind==="reasoning-group"){const{group:x}=s,g=x===l[l.length-1],b=a&&g;if(!x.parts.some(y=>y.text?.trim())&&!b)return null;const S=l.length===1?r:null;return n.jsx(jo,{duration:S,parts:x.parts,isStreaming:b},`${t.id}-reasoning-${x.startIndex}`)}const p=t.parts[s.index],u=c||(m?m.findLastIndex(x=>x.kind==="part")===e:!1),f=u?Mt(It(),t.metadata?.usage):null;return n.jsx($o,{part:p,id:t.id,usageStats:u&&n.jsx(Nn,{usage:f,duration:r}),dataParts:o,isLoading:i,isLastMessage:d},`${t.id}-${s.index}`)}function $o(s){const e=$.c(121),{part:t,id:l,usageStats:a,dataParts:r,isLoading:o,isLastMessage:i}=s;let d;e[0]!==r.toolMetadata?(d=u=>r.toolMetadata.get(u),e[0]=r.toolMetadata,e[1]=d):d=e[1];const c=d;let m;e[2]!==r.toolSubtaskMetadata?(m=u=>r.toolSubtaskMetadata.get(u),e[2]=r.toolSubtaskMetadata,e[3]=m):m=e[3];const p=m;switch(t.type){case"dynamic-tool":{let u;e[4]!==c||e[5]!==t.toolCallId?(u=c(t.toolCallId)?.annotations,e[4]=c,e[5]=t.toolCallId,e[6]=u):u=e[6];let f;e[7]!==c||e[8]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[7]=c,e[8]=t.toolCallId,e[9]=f):f=e[9];let x;e[10]!==c||e[11]!==t.toolCallId?(x=c(t.toolCallId)?.outputBytes,e[10]=c,e[11]=t.toolCallId,e[12]=x):x=e[12];let g;e[13]!==c||e[14]!==t.toolCallId?(g=c(t.toolCallId)?._meta,e[13]=c,e[14]=t.toolCallId,e[15]=g):g=e[15];let b;return e[16]!==i||e[17]!==t||e[18]!==u||e[19]!==f||e[20]!==x||e[21]!==g?(b=n.jsx(st,{part:t,annotations:u,latency:f,outputBytes:x,isLastMessage:i,toolMeta:g}),e[16]=i,e[17]=t,e[18]=u,e[19]=f,e[20]=x,e[21]=g,e[22]=b):b=e[22],b}case"tool-todo_write":return null;case"tool-update_interests":return null;case"tool-user_ask":{let u;e[23]!==c||e[24]!==t.toolCallId?(u=c(t.toolCallId)?.latencySeconds,e[23]=c,e[24]=t.toolCallId,e[25]=u):u=e[25];let f;return e[26]!==t||e[27]!==u?(f=n.jsx(dl,{part:t,latency:u}),e[26]=t,e[27]=u,e[28]=f):f=e[28],f}case"tool-propose_plan":{let u;return e[29]!==t?(u=n.jsx(xl,{part:t}),e[29]=t,e[30]=u):u=e[30],u}case"tool-generate_image":{let u;e[31]!==c||e[32]!==t.toolCallId?(u=c(t.toolCallId)?.latencySeconds,e[31]=c,e[32]=t.toolCallId,e[33]=u):u=e[33];let f;return e[34]!==t||e[35]!==u?(f=n.jsx(Jn,{part:t,latency:u}),e[34]=t,e[35]=u,e[36]=f):f=e[36],f}case"tool-take_screenshot":{let u;e[37]!==c||e[38]!==t.toolCallId?(u=c(t.toolCallId)?.latencySeconds,e[37]=c,e[38]=t.toolCallId,e[39]=u):u=e[39];let f;return e[40]!==t||e[41]!==u?(f=n.jsx(Zn,{part:t,latency:u}),e[40]=t,e[41]=u,e[42]=f):f=e[42],f}case"tool-web_search":{let u;e[43]!==c||e[44]!==t.toolCallId?(u=c(t.toolCallId)?.latencySeconds,e[43]=c,e[44]=t.toolCallId,e[45]=u):u=e[45];let f;e[46]!==r.webSearchStreaming||e[47]!==t.toolCallId?(f=r.webSearchStreaming.get(t.toolCallId),e[46]=r.webSearchStreaming,e[47]=t.toolCallId,e[48]=f):f=e[48];let x;return e[49]!==t||e[50]!==u||e[51]!==f?(x=n.jsx(ul,{part:t,latency:u,streamingText:f}),e[49]=t,e[50]=u,e[51]=f,e[52]=x):x=e[52],x}case"tool-subtask":{let u;e[53]!==p||e[54]!==t.toolCallId?(u=p(t.toolCallId),e[53]=p,e[54]=t.toolCallId,e[55]=u):u=e[55];let f;e[56]!==c||e[57]!==t.toolCallId?(f=c(t.toolCallId)?.annotations,e[56]=c,e[57]=t.toolCallId,e[58]=f):f=e[58];let x;e[59]!==c||e[60]!==t.toolCallId?(x=c(t.toolCallId)?.latencySeconds,e[59]=c,e[60]=t.toolCallId,e[61]=x):x=e[61];let g;e[62]!==t||e[63]!==u||e[64]!==f||e[65]!==x?(g={part:t,subtaskMeta:u,annotations:f,latency:x},e[62]=t,e[63]=u,e[64]=f,e[65]=x,e[66]=g):g=e[66];const b=g;let h;return e[67]!==b?(h=n.jsx(H.Suspense,{fallback:n.jsx(ml,{...b}),children:n.jsx(pl,{...b})}),e[67]=b,e[68]=h):h=e[68],h}case"text":{const u=!!a&&!o,f=o&&i;let x;return e[69]!==l||e[70]!==t||e[71]!==u||e[72]!==f||e[73]!==a?(x=n.jsx(Xe,{id:l,part:t,extraActions:a,copyable:!0,alwaysShowActions:u,animate:f}),e[69]=l,e[70]=t,e[71]=u,e[72]=f,e[73]=a,e[74]=x):x=e[74],x}case"reasoning":return null;case"step-start":case"file":case"source-url":case"source-document":return null;case"data-tool-metadata":case"data-tool-subtask-metadata":case"data-generate-image":case"data-web-search":return null;default:{const u=t;if(u.type==="tool-brand_context_setup"||u.type==="tool-BRAND_CONTEXT_EXTRACT"){let f;e[75]!==u.toolCallId||e[76]!==c?(f=c(u.toolCallId)?.latencySeconds,e[75]=u.toolCallId,e[76]=c,e[77]=f):f=e[77];let x;return e[78]!==u||e[79]!==f?(x=n.jsx(Tl,{part:u,latency:f}),e[78]=u,e[79]=f,e[80]=x):x=e[80],x}if(u.type==="tool-BRAND_CONTEXT_GET"){let f;e[81]!==u.toolCallId||e[82]!==c?(f=c(u.toolCallId)?.latencySeconds,e[81]=u.toolCallId,e[82]=c,e[83]=f):f=e[83];let x;return e[84]!==u||e[85]!==f?(x=n.jsx(Cl,{part:u,latency:f}),e[84]=u,e[85]=f,e[86]=x):x=e[86],x}if(u.type==="tool-BRAND_CONTEXT_LIST"){let f;e[87]!==u.toolCallId||e[88]!==c?(f=c(u.toolCallId)?.latencySeconds,e[87]=u.toolCallId,e[88]=c,e[89]=f):f=e[89];let x;return e[90]!==u||e[91]!==f?(x=n.jsx($l,{part:u,latency:f}),e[90]=u,e[91]=f,e[92]=x):x=e[92],x}if(u.type==="tool-COLLECTION_VIRTUAL_MCP_CREATE"){let f;e[93]!==u.toolCallId||e[94]!==c?(f=c(u.toolCallId)?.latencySeconds,e[93]=u.toolCallId,e[94]=c,e[95]=f):f=e[95];let x;return e[96]!==u||e[97]!==f?(x=n.jsx(El,{part:u,latency:f}),e[96]=u,e[97]=f,e[98]=x):x=e[98],x}if(u.type==="tool-COLLECTION_VIRTUAL_MCP_LIST"){let f;e[99]!==u.toolCallId||e[100]!==c?(f=c(u.toolCallId)?.latencySeconds,e[99]=u.toolCallId,e[100]=c,e[101]=f):f=e[101];let x;return e[102]!==u||e[103]!==f?(x=n.jsx(Dl,{part:u,latency:f}),e[102]=u,e[103]=f,e[104]=x):x=e[104],x}if(u.type==="tool-COLLECTION_CONNECTIONS_LIST"){let f;e[105]!==u.toolCallId||e[106]!==c?(f=c(u.toolCallId)?.latencySeconds,e[105]=u.toolCallId,e[106]=c,e[107]=f):f=e[107];let x;return e[108]!==u||e[109]!==f?(x=n.jsx(Wl,{part:u,latency:f}),e[108]=u,e[109]=f,e[110]=x):x=e[110],x}if(u.type.startsWith("tool-")){const f=u.toolCallId;let x;e[111]!==r.toolMetadata||e[112]!==f?(x=r.toolMetadata.get(f),e[111]=r.toolMetadata,e[112]=f,e[113]=x):x=e[113];const g=x,b=g?.annotations,h=g?.latencySeconds,S=g?.outputBytes,y=g?._meta;let v;return e[114]!==u||e[115]!==i||e[116]!==b||e[117]!==h||e[118]!==S||e[119]!==y?(v=n.jsx(st,{part:u,annotations:b,latency:h,outputBytes:S,isLastMessage:i,toolMeta:y}),e[114]=u,e[115]=i,e[116]=b,e[117]=h,e[118]=S,e[119]=y,e[120]=v):v=e[120],v}if(u.type.startsWith("data-"))return null;throw new Error(`Unknown part type: ${u.type}`)}}}function Io(s){const e=$.c(2),{isRunInProgress:t}=s;if(t){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(Ue,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),n.jsx("span",{className:"text-[14px] text-muted-foreground shimmer",children:"Resuming task..."})]})}),e[0]=a):a=e[0],a}let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("div",{className:"text-[14px] text-muted-foreground/60 py-2",children:"No response was generated"}),e[1]=l):l=e[1],l}function Mo(s){const e=$.c(7),{className:t,children:l}=s;let a;e[0]!==t?(a=V("w-full min-w-0 group relative flex items-start gap-4 px-4 z-20 text-foreground flex-row",t),e[0]=t,e[1]=a):a=e[1];let r;e[2]!==l?(r=n.jsx("div",{className:"flex flex-col min-w-0 w-full items-start",children:n.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-[14px] wrap-break-word overflow-wrap-anywhere bg-transparent",children:l})}),e[2]=l,e[3]=r):r=e[3];let o;return e[4]!==a||e[5]!==r?(o=n.jsx("div",{className:a,children:r}),e[4]=a,e[5]=r,e[6]=o):o=e[6],o}function Ao(s){const e=$.c(42),{message:t,turnStartedAt:l,status:a,className:r,isLast:o}=s,i=o===void 0?!1:o,{isRunInProgress:d}=_e()??{},c=d===void 0?!1:d,m=Ve()?.taskId??null,p=a==="streaming",f=p||a==="submitted";let x;e[0]!==l?(x=mt(l),e[0]=l,e[1]=x):x=e[1];const g=x;let b;e[2]!==f?(b=()=>f?Date.now():null,e[2]=f,e[3]=b):b=e[3];const[h,S]=H.useState(b),[y,v]=H.useState(f);y!==f&&(v(f),S(f?Date.now():null));const j=g??h,N=t!==null&&t.parts.length>0,{reasoningGroups:k,renderOrder:_,dataParts:w}=uo(t),T=t&&t.parts.length>0?t.parts[t.parts.length-1]:null,I=p&&T?.type==="reasoning";let M;if(e[4]!==t){const O=t?.metadata?.reasoning_start_at?new Date(t.metadata.reasoning_start_at):null,K=t?.metadata?.reasoning_end_at?new Date(t.metadata.reasoning_end_at):new Date;M=O!==null?K.getTime()-O.getTime():null,e[4]=t,e[5]=M}else M=e[5];const C=M;let A;e[6]!==i||e[7]!==t?(A=!i||!t||!t.parts.some(Ro),e[6]=i,e[7]=t,e[8]=A):A=e[8];const L=A;let F;e[9]!==N||e[10]!==f||e[11]!==L||e[12]!==t||e[13]!==_?(F=!f&&N&&L&&(()=>{let O=0;for(const K of _)if(K.kind==="part"){const G=t.parts[K.index]?.type;(G==="dynamic-tool"||G?.startsWith("tool-"))&&O++}return O>=ko})(),e[9]=N,e[10]=f,e[11]=L,e[12]=t,e[13]=_,e[14]=F):F=e[14];const z=F;let R,E,D;if(e[15]!==r||e[16]!==w||e[17]!==N||e[18]!==i||e[19]!==f||e[20]!==I||e[21]!==c||e[22]!==L||e[23]!==t||e[24]!==k||e[25]!==_||e[26]!==z||e[27]!==j||e[28]!==m||e[29]!==C){const{collapsed:O,tail:K}=z?_o(_,t.parts):{collapsed:[],tail:_};R=Mo,E=r,D=N?n.jsxs("div",{className:"flex flex-col gap-3 sm:gap-2",children:[O.length>0&&n.jsx(Co,{items:O,message:t,reasoningGroups:k,isReasoningActive:I,totalDuration:C,dataParts:w,isLoading:f,isLast:i}),K.map((G,Y)=>{const Q=O.length+Y,te=K.findLastIndex(Lo)===Y;return qt({item:G,renderIndex:Q,message:t,reasoningGroups:k,isReasoningActive:I,totalDuration:C,dataParts:w,isLoading:f,isLast:i,isLastVisiblePart:te,renderOrder:_})}),m&&n.jsx(ro,{threadId:m,message:t}),i&&f&&j!==null&&n.jsx(ho,{startedAt:j}),i&&!f&&m&&n.jsxs(n.Fragment,{children:[n.jsx(Ql,{}),L&&n.jsx(Vl,{})]})]}):f?n.jsx(yo,{startedAt:j}):n.jsx(Io,{isRunInProgress:i&&c}),e[15]=r,e[16]=w,e[17]=N,e[18]=i,e[19]=f,e[20]=I,e[21]=c,e[22]=L,e[23]=t,e[24]=k,e[25]=_,e[26]=z,e[27]=j,e[28]=m,e[29]=C,e[30]=R,e[31]=E,e[32]=D}else R=e[30],E=e[31],D=e[32];let W;e[33]!==i||e[34]!==p||e[35]!==t?.parts?(W=i&&p&&n.jsx(Xl,{parts:t?.parts}),e[33]=i,e[34]=p,e[35]=t?.parts,e[36]=W):W=e[36];let U;return e[37]!==R||e[38]!==W||e[39]!==E||e[40]!==D?(U=n.jsxs(R,{className:E,children:[D,W]}),e[37]=R,e[38]=W,e[39]=E,e[40]=D,e[41]=U):U=e[41],U}function Lo(s){return s.kind==="part"}function Ro(s){const e=s.type;if(e!=="dynamic-tool"&&!e?.startsWith("tool-"))return!1;const t=s.state;return t==="input-streaming"||t==="input-available"||t==="approval-requested"}function Eo(s){const e=$.c(21),{event:t}=s,[l,a]=H.useState(!1);let r;e[0]!==t.data?(r=JSON.stringify(t.data,null,2),e[0]=t.data,e[1]=r):r=e[1];const o=r;let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=()=>a(zo),e[2]=i):i=e[2];let d,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(fs,{className:"size-4 shrink-0 text-muted-foreground"}),c=n.jsx("span",{className:"font-medium",children:"Triggered by event"}),e[3]=d,e[4]=c):(d=e[3],c=e[4]);let m;e[5]!==t.type?(m=n.jsx("span",{className:"min-w-0 truncate text-muted-foreground",children:t.type}),e[5]=t.type,e[6]=m):m=e[6];const p=l&&"rotate-180";let u;e[7]!==p?(u=V("ml-auto size-4 shrink-0 text-muted-foreground transition-transform",p),e[7]=p,e[8]=u):u=e[8];let f;e[9]!==u?(f=n.jsx(an,{className:u}),e[9]=u,e[10]=f):f=e[10];let x;e[11]!==m||e[12]!==f?(x=n.jsxs("button",{type:"button",onClick:i,className:"flex w-full items-center gap-2 px-3 py-2 text-sm cursor-pointer",children:[d,c,m,f]}),e[11]=m,e[12]=f,e[13]=x):x=e[13];let g;e[14]!==t.source||e[15]!==l||e[16]!==o?(g=l&&n.jsxs("div",{className:"border-t border-border/60 px-3 py-2",children:[n.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:t.source}),n.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-words text-xs text-foreground",children:o})]}),e[14]=t.source,e[15]=l,e[16]=o,e[17]=g):g=e[17];let b;return e[18]!==g||e[19]!==x?(b=n.jsxs("div",{className:"rounded-lg border border-border/60 bg-background overflow-hidden text-left",children:[x,g]}),e[18]=g,e[19]=x,e[20]=b):b=e[20],b}function zo(s){return!s}const Po=[js.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),gn,jn];function Fo(s){const e=$.c(5),{tiptapDoc:t}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={attributes:{class:"prose prose-sm max-w-none focus:outline-none"}},e[0]=l):l=e[0];let a;e[1]!==t?(a={extensions:Po,content:t,editable:!1,editorProps:l},e[1]=t,e[2]=a):a=e[2];const r=ys(a);if(!r)return null;let o;return e[3]!==r?(o=n.jsx(vs,{editor:r,className:"[&_.ProseMirror]:outline-none [&_.ProseMirror]:cursor-text"}),e[3]=r,e[4]=o):o=e[4],o}function Do(s){const e=$.c(33),{message:t,className:l,onScrollToPair:a}=s,{id:r,parts:o,metadata:i}=t,[d,c]=H.useState(!1),[m,p]=H.useState(!1),u=H.useRef(!1);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=C=>{C&&!u.current&&(u.current=!0,p(C.scrollHeight>C.clientHeight))},e[0]=f):f=e[0];const x=f;if(!o||o.length===0)return null;let g;e[1]!==a?(g=()=>{c(!0),a?.()},e[1]=a,e[2]=g):g=e[2];const b=g,h=i?.tiptapDoc;let S;e[3]!==l?(S=V("message-block w-full min-w-0 relative flex items-start gap-4 px-2.5 text-foreground flex-row-reverse",l),e[3]=l,e[4]=S):S=e[4];let y,v;e[5]===Symbol.for("react.memo_cache_sentinel")?(y=()=>c(!0),v=()=>c(!1),e[5]=y,e[6]=v):(y=e[5],v=e[6]);let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx("div",{className:"absolute inset-0 bg-muted/75 rounded-lg pointer-events-none"}),e[7]=j):j=e[7];let N;e[8]!==d||e[9]!==m?(N=V("z-10 px-4 py-2 flex-1 transition-[max-height,opacity] duration-300 ease-out",d?"max-h-[50vh] overflow-auto opacity-100":V("max-h-[84px] overflow-hidden opacity-99",m&&"mask-b-from-1%")),e[8]=d,e[9]=m,e[10]=N):N=e[10];let k;if(e[11]!==r||e[12]!==o){let C;e[14]!==r?(C=(A,L)=>A.type==="data-trigger-event"?n.jsx(Eo,{event:A.data},`${r}-${L}`):null,e[14]=r,e[15]=C):C=e[15],k=o.map(C),e[11]=r,e[12]=o,e[13]=k}else k=e[13];let _;e[16]!==h||e[17]!==r||e[18]!==i||e[19]!==o?(_=h?n.jsx(Fo,{tiptapDoc:i.tiptapDoc}):o.map((C,A)=>C.type==="text"?o[A-1]?.type==="data-trigger-event"?null:n.jsx(Xe,{id:r,part:C},`${r}-${A}`):null),e[16]=h,e[17]=r,e[18]=i,e[19]=o,e[20]=_):_=e[20];let w;e[21]!==k||e[22]!==_?(w=n.jsxs("div",{className:"flex flex-col gap-2",children:[k,_]}),e[21]=k,e[22]=_,e[23]=w):w=e[23];let T;e[24]!==w||e[25]!==N?(T=n.jsx("div",{ref:x,className:N,children:w}),e[24]=w,e[25]=N,e[26]=T):T=e[26];let I;e[27]!==b||e[28]!==T?(I=n.jsxs("div",{tabIndex:0,onClick:b,onFocus:y,onBlur:v,className:"w-full border border-border/60 min-w-0 shadow-xs rounded-lg text-[14px] wrap-break-word overflow-wrap-anywhere bg-background cursor-pointer transition-colors relative flex outline-none",children:[j,T]}),e[27]=b,e[28]=T,e[29]=I):I=e[29];let M;return e[30]!==I||e[31]!==S?(M=n.jsx(n.Fragment,{children:n.jsx("div",{className:S,children:I})}),e[30]=I,e[31]=S,e[32]=M):M=e[32],M}function Ra(s){const e=[],t=s.filter(l=>l.role!=="system");for(let l=0;l<t.length;l++){const a=t[l];if(a)if(a.role==="user"){const r=t[l+1];r&&r.role==="assistant"?(e.push({user:a,assistant:r}),l++):e.push({user:a,assistant:null})}else a.role==="assistant"&&e.push({user:null,assistant:a})}return e}function Ea(s){const e=$.c(18),{pair:t,isLastPair:l,status:a}=s,r=H.useRef(null),o=H.useRef(!1);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{r.current&&r.current.scrollIntoView({behavior:"smooth",block:"start"})},e[0]=i):i=e[0];const d=i;let c;e[1]!==l||e[2]!==a?(c=h=>{if(r.current=h,!l||!h||o.current)return;if(o.current=!0,a==="submitted"||a==="streaming"){h.scrollIntoView({behavior:"smooth",block:"start"});return}const S=h.closest("[data-chat-scroller]");S?S.scrollTop=S.scrollHeight:h.scrollIntoView({behavior:"instant",block:"start"})},e[1]=l,e[2]=a,e[3]=c):c=e[3];const m=c,p=!t.user&&"pt-8 sm:pt-6";let u;e[4]!==p?(u=V("flex flex-col pb-2 sm:pb-2",p),e[4]=p,e[5]=u):u=e[5];let f;e[6]!==t.user?(f=t.user&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"sticky top-0 z-50 w-full h-4 bg-background"}),n.jsx("div",{className:"sticky mb-8 sm:mb-6 top-4 z-50",children:n.jsx(Do,{message:t.user,onScrollToPair:d})})]}),e[6]=t.user,e[7]=f):f=e[7];const x=t.user?.created_at??null;let g;e[8]!==l||e[9]!==t.assistant||e[10]!==a||e[11]!==x?(g=n.jsx(Ao,{message:t.assistant,turnStartedAt:x,status:a,isLast:l}),e[8]=l,e[9]=t.assistant,e[10]=a,e[11]=x,e[12]=g):g=e[12];let b;return e[13]!==m||e[14]!==u||e[15]!==f||e[16]!==g?(b=n.jsxs("div",{ref:m,className:u,children:[f,g]}),e[13]=m,e[14]=u,e[15]=f,e[16]=g,e[17]=b):b=e[17],b}export{Sn as C,jn as F,fo as G,Xe as M,lo as O,mn as P,Aa as S,no as a,kn as b,$a as c,_n as d,Lt as e,un as f,Ge as g,Rt as h,Ma as i,Ia as j,pn as k,gn as l,Ra as m,Ea as n,Tn as o,Ke as s,At as t,La as u};
|
|
46
|
+
`);p=!o&&S.trim()?S:null,e[8]=o,e[9]=l,e[10]=p}else p=e[10];const u=p,f=!a&&t!=null?t/1e3:void 0;let x;e[11]!==a?(x=a?n.jsx(Ue,{className:"size-4"}):n.jsx(cs,{className:"size-4"}),e[11]=a,e[12]=x):x=e[12];const g=a?"Thinking...":d,b=a?"loading":"idle";let h;return e[13]!==u||e[14]!==f||e[15]!==m||e[16]!==x||e[17]!==g||e[18]!==b?(h=n.jsx(B,{icon:x,title:g,summary:m,detail:u,state:b,detailVariant:"prose",latency:f}),e[13]=u,e[14]=f,e[15]=m,e[16]=x,e[17]=g,e[18]=b,e[19]=h):h=e[19],h}function vo(s){return s.text??""}function No(s){return s.text??""}function So(s){return s.text?.includes("REDACTED")}const ko=3;function _o(s,e){let t=-1;for(let l=s.length-1;l>=0;l--){const a=s[l];if(a.kind==="part"&&e[a.index]?.type==="text"){t=l;break}}return t===-1?{collapsed:[],tail:s}:{collapsed:s.slice(0,t),tail:s.slice(t)}}function wo(s,e){let t=0,l=0;for(const a of s)if(a.kind==="reasoning-group")l++;else{const r=e[a.index]?.type;r==="text"?l++:(r==="dynamic-tool"||r?.startsWith("tool-"))&&r!=="tool-todo_write"&&r!=="tool-update_interests"&&t++}return{toolCalls:t,messages:l}}function To(s){const e=$.c(8),{toolCalls:t,messages:l}=s;let a;e[0]!==l||e[1]!==t?(a=t>0&&n.jsxs(n.Fragment,{children:[n.jsx(ps,{className:"size-3.5 shrink-0"}),n.jsxs("span",{children:[t," tool call",t===1?"":"s",l>0?",":""]})]}),e[0]=l,e[1]=t,e[2]=a):a=e[2];let r;e[3]!==l?(r=l>0&&n.jsxs(n.Fragment,{children:[n.jsx(ds,{className:"size-3.5 shrink-0"}),n.jsxs("span",{children:[l," message",l===1?"":"s"]})]}),e[3]=l,e[4]=r):r=e[4];let o;return e[5]!==a||e[6]!==r?(o=n.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[a,r]}),e[5]=a,e[6]=r,e[7]=o):o=e[7],o}function Co(s){const e=$.c(28),{items:t,message:l,reasoningGroups:a,isReasoningActive:r,totalDuration:o,dataParts:i,isLoading:d,isLast:c}=s;let m;e[0]!==t||e[1]!==l.parts?(m=wo(t,l.parts),e[0]=t,e[1]=l.parts,e[2]=m):m=e[2];const{toolCalls:p,messages:u}=m;if(p===0&&u===0)return null;let f;e[3]!==u||e[4]!==p?(f=n.jsx(To,{toolCalls:p,messages:u}),e[3]=u,e[4]=p,e[5]=f):f=e[5];let x;if(e[6]!==i||e[7]!==c||e[8]!==d||e[9]!==r||e[10]!==t||e[11]!==l||e[12]!==a||e[13]!==o){let h;e[15]!==i||e[16]!==c||e[17]!==d||e[18]!==r||e[19]!==l||e[20]!==a||e[21]!==o?(h=(S,y)=>Vt({item:S,renderIndex:y,message:l,reasoningGroups:a,isReasoningActive:r,totalDuration:o,dataParts:i,isLoading:d,isLast:c,isLastVisiblePart:!1}),e[15]=i,e[16]=c,e[17]=d,e[18]=r,e[19]=l,e[20]=a,e[21]=o,e[22]=h):h=e[22],x=t.map(h),e[6]=i,e[7]=c,e[8]=d,e[9]=r,e[10]=t,e[11]=l,e[12]=a,e[13]=o,e[14]=x}else x=e[14];let g;e[23]!==x?(g=n.jsx("div",{className:"flex flex-col gap-3 sm:gap-2 pt-1",children:x}),e[23]=x,e[24]=g):g=e[24];let b;return e[25]!==f||e[26]!==g?(b=n.jsx(B,{icon:null,alwaysChevron:!0,title:f,state:"idle",children:g}),e[25]=f,e[26]=g,e[27]=b):b=e[27],b}function Vt({item:s,renderIndex:e,message:t,reasoningGroups:l,isReasoningActive:a,totalDuration:r,dataParts:o,isLoading:i,isLast:d,isLastVisiblePart:c,renderOrder:m}){if(s.kind==="reasoning-group"){const{group:x}=s,g=x===l[l.length-1],b=a&&g;if(!x.parts.some(y=>y.text?.trim())&&!b)return null;const S=l.length===1?r:null;return n.jsx(jo,{duration:S,parts:x.parts,isStreaming:b},`${t.id}-reasoning-${x.startIndex}`)}const p=t.parts[s.index],u=c||(m?m.findLastIndex(x=>x.kind==="part")===e:!1),f=u?Mt(It(),t.metadata?.usage):null;return n.jsx($o,{part:p,id:t.id,usageStats:u&&n.jsx(Nn,{usage:f,duration:r}),dataParts:o,isLoading:i,isLastMessage:d},`${t.id}-${s.index}`)}function $o(s){const e=$.c(121),{part:t,id:l,usageStats:a,dataParts:r,isLoading:o,isLastMessage:i}=s;let d;e[0]!==r.toolMetadata?(d=u=>r.toolMetadata.get(u),e[0]=r.toolMetadata,e[1]=d):d=e[1];const c=d;let m;e[2]!==r.toolSubtaskMetadata?(m=u=>r.toolSubtaskMetadata.get(u),e[2]=r.toolSubtaskMetadata,e[3]=m):m=e[3];const p=m;switch(t.type){case"dynamic-tool":{let u;e[4]!==c||e[5]!==t.toolCallId?(u=c(t.toolCallId)?.annotations,e[4]=c,e[5]=t.toolCallId,e[6]=u):u=e[6];let f;e[7]!==c||e[8]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[7]=c,e[8]=t.toolCallId,e[9]=f):f=e[9];let x;e[10]!==c||e[11]!==t.toolCallId?(x=c(t.toolCallId)?.outputBytes,e[10]=c,e[11]=t.toolCallId,e[12]=x):x=e[12];let g;e[13]!==c||e[14]!==t.toolCallId?(g=c(t.toolCallId)?._meta,e[13]=c,e[14]=t.toolCallId,e[15]=g):g=e[15];let b;return e[16]!==i||e[17]!==t||e[18]!==u||e[19]!==f||e[20]!==x||e[21]!==g?(b=n.jsx(st,{part:t,annotations:u,latency:f,outputBytes:x,isLastMessage:i,toolMeta:g}),e[16]=i,e[17]=t,e[18]=u,e[19]=f,e[20]=x,e[21]=g,e[22]=b):b=e[22],b}case"tool-todo_write":return null;case"tool-update_interests":return null;case"tool-user_ask":{let u;e[23]!==c||e[24]!==t.toolCallId?(u=c(t.toolCallId)?.latencySeconds,e[23]=c,e[24]=t.toolCallId,e[25]=u):u=e[25];let f;return e[26]!==t||e[27]!==u?(f=n.jsx(dl,{part:t,latency:u}),e[26]=t,e[27]=u,e[28]=f):f=e[28],f}case"tool-propose_plan":{let u;return e[29]!==t?(u=n.jsx(xl,{part:t}),e[29]=t,e[30]=u):u=e[30],u}case"tool-generate_image":{let u;e[31]!==c||e[32]!==t.toolCallId?(u=c(t.toolCallId)?.latencySeconds,e[31]=c,e[32]=t.toolCallId,e[33]=u):u=e[33];let f;return e[34]!==t||e[35]!==u?(f=n.jsx(Jn,{part:t,latency:u}),e[34]=t,e[35]=u,e[36]=f):f=e[36],f}case"tool-take_screenshot":{let u;e[37]!==c||e[38]!==t.toolCallId?(u=c(t.toolCallId)?.latencySeconds,e[37]=c,e[38]=t.toolCallId,e[39]=u):u=e[39];let f;return e[40]!==t||e[41]!==u?(f=n.jsx(Zn,{part:t,latency:u}),e[40]=t,e[41]=u,e[42]=f):f=e[42],f}case"tool-web_search":{let u;e[43]!==c||e[44]!==t.toolCallId?(u=c(t.toolCallId)?.latencySeconds,e[43]=c,e[44]=t.toolCallId,e[45]=u):u=e[45];let f;e[46]!==r.webSearchStreaming||e[47]!==t.toolCallId?(f=r.webSearchStreaming.get(t.toolCallId),e[46]=r.webSearchStreaming,e[47]=t.toolCallId,e[48]=f):f=e[48];let x;return e[49]!==t||e[50]!==u||e[51]!==f?(x=n.jsx(ul,{part:t,latency:u,streamingText:f}),e[49]=t,e[50]=u,e[51]=f,e[52]=x):x=e[52],x}case"tool-subtask":{let u;e[53]!==p||e[54]!==t.toolCallId?(u=p(t.toolCallId),e[53]=p,e[54]=t.toolCallId,e[55]=u):u=e[55];let f;e[56]!==c||e[57]!==t.toolCallId?(f=c(t.toolCallId)?.annotations,e[56]=c,e[57]=t.toolCallId,e[58]=f):f=e[58];let x;e[59]!==c||e[60]!==t.toolCallId?(x=c(t.toolCallId)?.latencySeconds,e[59]=c,e[60]=t.toolCallId,e[61]=x):x=e[61];let g;e[62]!==t||e[63]!==u||e[64]!==f||e[65]!==x?(g={part:t,subtaskMeta:u,annotations:f,latency:x},e[62]=t,e[63]=u,e[64]=f,e[65]=x,e[66]=g):g=e[66];const b=g;let h;return e[67]!==b?(h=n.jsx(H.Suspense,{fallback:n.jsx(ml,{...b}),children:n.jsx(pl,{...b})}),e[67]=b,e[68]=h):h=e[68],h}case"text":{const u=!!a&&!o,f=o&&i;let x;return e[69]!==l||e[70]!==t||e[71]!==u||e[72]!==f||e[73]!==a?(x=n.jsx(Xe,{id:l,part:t,extraActions:a,copyable:!0,alwaysShowActions:u,animate:f}),e[69]=l,e[70]=t,e[71]=u,e[72]=f,e[73]=a,e[74]=x):x=e[74],x}case"reasoning":return null;case"step-start":case"file":case"source-url":case"source-document":return null;case"data-tool-metadata":case"data-tool-subtask-metadata":case"data-generate-image":case"data-web-search":return null;default:{const u=t;if(u.type==="tool-brand_context_setup"||u.type==="tool-BRAND_CONTEXT_EXTRACT"){let f;e[75]!==u.toolCallId||e[76]!==c?(f=c(u.toolCallId)?.latencySeconds,e[75]=u.toolCallId,e[76]=c,e[77]=f):f=e[77];let x;return e[78]!==u||e[79]!==f?(x=n.jsx(Tl,{part:u,latency:f}),e[78]=u,e[79]=f,e[80]=x):x=e[80],x}if(u.type==="tool-BRAND_CONTEXT_GET"){let f;e[81]!==u.toolCallId||e[82]!==c?(f=c(u.toolCallId)?.latencySeconds,e[81]=u.toolCallId,e[82]=c,e[83]=f):f=e[83];let x;return e[84]!==u||e[85]!==f?(x=n.jsx(Cl,{part:u,latency:f}),e[84]=u,e[85]=f,e[86]=x):x=e[86],x}if(u.type==="tool-BRAND_CONTEXT_LIST"){let f;e[87]!==u.toolCallId||e[88]!==c?(f=c(u.toolCallId)?.latencySeconds,e[87]=u.toolCallId,e[88]=c,e[89]=f):f=e[89];let x;return e[90]!==u||e[91]!==f?(x=n.jsx($l,{part:u,latency:f}),e[90]=u,e[91]=f,e[92]=x):x=e[92],x}if(u.type==="tool-COLLECTION_VIRTUAL_MCP_CREATE"){let f;e[93]!==u.toolCallId||e[94]!==c?(f=c(u.toolCallId)?.latencySeconds,e[93]=u.toolCallId,e[94]=c,e[95]=f):f=e[95];let x;return e[96]!==u||e[97]!==f?(x=n.jsx(El,{part:u,latency:f}),e[96]=u,e[97]=f,e[98]=x):x=e[98],x}if(u.type==="tool-COLLECTION_VIRTUAL_MCP_LIST"){let f;e[99]!==u.toolCallId||e[100]!==c?(f=c(u.toolCallId)?.latencySeconds,e[99]=u.toolCallId,e[100]=c,e[101]=f):f=e[101];let x;return e[102]!==u||e[103]!==f?(x=n.jsx(Dl,{part:u,latency:f}),e[102]=u,e[103]=f,e[104]=x):x=e[104],x}if(u.type==="tool-COLLECTION_CONNECTIONS_LIST"){let f;e[105]!==u.toolCallId||e[106]!==c?(f=c(u.toolCallId)?.latencySeconds,e[105]=u.toolCallId,e[106]=c,e[107]=f):f=e[107];let x;return e[108]!==u||e[109]!==f?(x=n.jsx(Wl,{part:u,latency:f}),e[108]=u,e[109]=f,e[110]=x):x=e[110],x}if(u.type.startsWith("tool-")){const f=u.toolCallId;let x;e[111]!==r.toolMetadata||e[112]!==f?(x=r.toolMetadata.get(f),e[111]=r.toolMetadata,e[112]=f,e[113]=x):x=e[113];const g=x,b=g?.annotations,h=g?.latencySeconds,S=g?.outputBytes,y=g?._meta;let v;return e[114]!==u||e[115]!==i||e[116]!==b||e[117]!==h||e[118]!==S||e[119]!==y?(v=n.jsx(st,{part:u,annotations:b,latency:h,outputBytes:S,isLastMessage:i,toolMeta:y}),e[114]=u,e[115]=i,e[116]=b,e[117]=h,e[118]=S,e[119]=y,e[120]=v):v=e[120],v}if(u.type.startsWith("data-"))return null;throw new Error(`Unknown part type: ${u.type}`)}}}function Io(s){const e=$.c(2),{isRunInProgress:t}=s;if(t){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(Ue,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),n.jsx("span",{className:"text-[14px] text-muted-foreground shimmer",children:"Resuming task..."})]})}),e[0]=a):a=e[0],a}let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("div",{className:"text-[14px] text-muted-foreground/60 py-2",children:"No response was generated"}),e[1]=l):l=e[1],l}function Mo(s){const e=$.c(7),{className:t,children:l}=s;let a;e[0]!==t?(a=q("w-full min-w-0 group relative flex items-start gap-4 px-4 z-20 text-foreground flex-row",t),e[0]=t,e[1]=a):a=e[1];let r;e[2]!==l?(r=n.jsx("div",{className:"flex flex-col min-w-0 w-full items-start",children:n.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-[14px] wrap-break-word overflow-wrap-anywhere bg-transparent",children:l})}),e[2]=l,e[3]=r):r=e[3];let o;return e[4]!==a||e[5]!==r?(o=n.jsx("div",{className:a,children:r}),e[4]=a,e[5]=r,e[6]=o):o=e[6],o}function Ao(s){const e=$.c(42),{message:t,turnStartedAt:l,status:a,className:r,isLast:o}=s,i=o===void 0?!1:o,{isRunInProgress:d}=_e()??{},c=d===void 0?!1:d,m=qe()?.taskId??null,p=a==="streaming",f=p||a==="submitted";let x;e[0]!==l?(x=mt(l),e[0]=l,e[1]=x):x=e[1];const g=x;let b;e[2]!==f?(b=()=>f?Date.now():null,e[2]=f,e[3]=b):b=e[3];const[h,S]=H.useState(b),[y,v]=H.useState(f);y!==f&&(v(f),S(f?Date.now():null));const j=g??h,N=t!==null&&t.parts.length>0,{reasoningGroups:k,renderOrder:_,dataParts:w}=uo(t),T=t&&t.parts.length>0?t.parts[t.parts.length-1]:null,I=p&&T?.type==="reasoning";let M;if(e[4]!==t){const O=t?.metadata?.reasoning_start_at?new Date(t.metadata.reasoning_start_at):null,K=t?.metadata?.reasoning_end_at?new Date(t.metadata.reasoning_end_at):new Date;M=O!==null?K.getTime()-O.getTime():null,e[4]=t,e[5]=M}else M=e[5];const C=M;let A;e[6]!==i||e[7]!==t?(A=!i||!t||!t.parts.some(Ro),e[6]=i,e[7]=t,e[8]=A):A=e[8];const L=A;let F;e[9]!==N||e[10]!==f||e[11]!==L||e[12]!==t||e[13]!==_?(F=!f&&N&&L&&(()=>{let O=0;for(const K of _)if(K.kind==="part"){const G=t.parts[K.index]?.type;(G==="dynamic-tool"||G?.startsWith("tool-"))&&O++}return O>=ko})(),e[9]=N,e[10]=f,e[11]=L,e[12]=t,e[13]=_,e[14]=F):F=e[14];const z=F;let R,E,D;if(e[15]!==r||e[16]!==w||e[17]!==N||e[18]!==i||e[19]!==f||e[20]!==I||e[21]!==c||e[22]!==L||e[23]!==t||e[24]!==k||e[25]!==_||e[26]!==z||e[27]!==j||e[28]!==m||e[29]!==C){const{collapsed:O,tail:K}=z?_o(_,t.parts):{collapsed:[],tail:_};R=Mo,E=r,D=N?n.jsxs("div",{className:"flex flex-col gap-3 sm:gap-2",children:[O.length>0&&n.jsx(Co,{items:O,message:t,reasoningGroups:k,isReasoningActive:I,totalDuration:C,dataParts:w,isLoading:f,isLast:i}),K.map((G,Y)=>{const Q=O.length+Y,te=K.findLastIndex(Lo)===Y;return Vt({item:G,renderIndex:Q,message:t,reasoningGroups:k,isReasoningActive:I,totalDuration:C,dataParts:w,isLoading:f,isLast:i,isLastVisiblePart:te,renderOrder:_})}),m&&n.jsx(ro,{threadId:m,message:t}),i&&f&&j!==null&&n.jsx(ho,{startedAt:j}),i&&!f&&m&&n.jsxs(n.Fragment,{children:[n.jsx(Ql,{}),L&&n.jsx(ql,{})]})]}):f?n.jsx(yo,{startedAt:j}):n.jsx(Io,{isRunInProgress:i&&c}),e[15]=r,e[16]=w,e[17]=N,e[18]=i,e[19]=f,e[20]=I,e[21]=c,e[22]=L,e[23]=t,e[24]=k,e[25]=_,e[26]=z,e[27]=j,e[28]=m,e[29]=C,e[30]=R,e[31]=E,e[32]=D}else R=e[30],E=e[31],D=e[32];let W;e[33]!==i||e[34]!==p||e[35]!==t?.parts?(W=i&&p&&n.jsx(Xl,{parts:t?.parts}),e[33]=i,e[34]=p,e[35]=t?.parts,e[36]=W):W=e[36];let U;return e[37]!==R||e[38]!==W||e[39]!==E||e[40]!==D?(U=n.jsxs(R,{className:E,children:[D,W]}),e[37]=R,e[38]=W,e[39]=E,e[40]=D,e[41]=U):U=e[41],U}function Lo(s){return s.kind==="part"}function Ro(s){const e=s.type;if(e!=="dynamic-tool"&&!e?.startsWith("tool-"))return!1;const t=s.state;return t==="input-streaming"||t==="input-available"||t==="approval-requested"}function Eo(s){const e=$.c(21),{event:t}=s,[l,a]=H.useState(!1);let r;e[0]!==t.data?(r=JSON.stringify(t.data,null,2),e[0]=t.data,e[1]=r):r=e[1];const o=r;let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=()=>a(zo),e[2]=i):i=e[2];let d,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(fs,{className:"size-4 shrink-0 text-muted-foreground"}),c=n.jsx("span",{className:"font-medium",children:"Triggered by event"}),e[3]=d,e[4]=c):(d=e[3],c=e[4]);let m;e[5]!==t.type?(m=n.jsx("span",{className:"min-w-0 truncate text-muted-foreground",children:t.type}),e[5]=t.type,e[6]=m):m=e[6];const p=l&&"rotate-180";let u;e[7]!==p?(u=q("ml-auto size-4 shrink-0 text-muted-foreground transition-transform",p),e[7]=p,e[8]=u):u=e[8];let f;e[9]!==u?(f=n.jsx(an,{className:u}),e[9]=u,e[10]=f):f=e[10];let x;e[11]!==m||e[12]!==f?(x=n.jsxs("button",{type:"button",onClick:i,className:"flex w-full items-center gap-2 px-3 py-2 text-sm cursor-pointer",children:[d,c,m,f]}),e[11]=m,e[12]=f,e[13]=x):x=e[13];let g;e[14]!==t.source||e[15]!==l||e[16]!==o?(g=l&&n.jsxs("div",{className:"border-t border-border/60 px-3 py-2",children:[n.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:t.source}),n.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-words text-xs text-foreground",children:o})]}),e[14]=t.source,e[15]=l,e[16]=o,e[17]=g):g=e[17];let b;return e[18]!==g||e[19]!==x?(b=n.jsxs("div",{className:"rounded-lg border border-border/60 bg-background overflow-hidden text-left",children:[x,g]}),e[18]=g,e[19]=x,e[20]=b):b=e[20],b}function zo(s){return!s}const Po=[js.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),gn,jn];function Fo(s){const e=$.c(5),{tiptapDoc:t}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={attributes:{class:"prose prose-sm max-w-none focus:outline-none"}},e[0]=l):l=e[0];let a;e[1]!==t?(a={extensions:Po,content:t,editable:!1,editorProps:l},e[1]=t,e[2]=a):a=e[2];const r=ys(a);if(!r)return null;let o;return e[3]!==r?(o=n.jsx(vs,{editor:r,className:"[&_.ProseMirror]:outline-none [&_.ProseMirror]:cursor-text"}),e[3]=r,e[4]=o):o=e[4],o}function Do(s){const e=$.c(33),{message:t,className:l,onScrollToPair:a}=s,{id:r,parts:o,metadata:i}=t,[d,c]=H.useState(!1),[m,p]=H.useState(!1),u=H.useRef(!1);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=C=>{C&&!u.current&&(u.current=!0,p(C.scrollHeight>C.clientHeight))},e[0]=f):f=e[0];const x=f;if(!o||o.length===0)return null;let g;e[1]!==a?(g=()=>{c(!0),a?.()},e[1]=a,e[2]=g):g=e[2];const b=g,h=i?.tiptapDoc;let S;e[3]!==l?(S=q("message-block w-full min-w-0 relative flex items-start gap-4 px-2.5 text-foreground flex-row-reverse",l),e[3]=l,e[4]=S):S=e[4];let y,v;e[5]===Symbol.for("react.memo_cache_sentinel")?(y=()=>c(!0),v=()=>c(!1),e[5]=y,e[6]=v):(y=e[5],v=e[6]);let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx("div",{className:"absolute inset-0 bg-muted/75 rounded-lg pointer-events-none"}),e[7]=j):j=e[7];let N;e[8]!==d||e[9]!==m?(N=q("z-10 px-4 py-2 flex-1 transition-[max-height,opacity] duration-300 ease-out",d?"max-h-[50vh] overflow-auto opacity-100":q("max-h-[84px] overflow-hidden opacity-99",m&&"mask-b-from-1%")),e[8]=d,e[9]=m,e[10]=N):N=e[10];let k;if(e[11]!==r||e[12]!==o){let C;e[14]!==r?(C=(A,L)=>A.type==="data-trigger-event"?n.jsx(Eo,{event:A.data},`${r}-${L}`):null,e[14]=r,e[15]=C):C=e[15],k=o.map(C),e[11]=r,e[12]=o,e[13]=k}else k=e[13];let _;e[16]!==h||e[17]!==r||e[18]!==i||e[19]!==o?(_=h?n.jsx(Fo,{tiptapDoc:i.tiptapDoc}):o.map((C,A)=>C.type==="text"?o[A-1]?.type==="data-trigger-event"?null:n.jsx(Xe,{id:r,part:C},`${r}-${A}`):null),e[16]=h,e[17]=r,e[18]=i,e[19]=o,e[20]=_):_=e[20];let w;e[21]!==k||e[22]!==_?(w=n.jsxs("div",{className:"flex flex-col gap-2",children:[k,_]}),e[21]=k,e[22]=_,e[23]=w):w=e[23];let T;e[24]!==w||e[25]!==N?(T=n.jsx("div",{ref:x,className:N,children:w}),e[24]=w,e[25]=N,e[26]=T):T=e[26];let I;e[27]!==b||e[28]!==T?(I=n.jsxs("div",{tabIndex:0,onClick:b,onFocus:y,onBlur:v,className:"w-full border border-border/60 min-w-0 shadow-xs rounded-lg text-[14px] wrap-break-word overflow-wrap-anywhere bg-background cursor-pointer transition-colors relative flex outline-none",children:[j,T]}),e[27]=b,e[28]=T,e[29]=I):I=e[29];let M;return e[30]!==I||e[31]!==S?(M=n.jsx(n.Fragment,{children:n.jsx("div",{className:S,children:I})}),e[30]=I,e[31]=S,e[32]=M):M=e[32],M}function Ra(s){const e=[],t=s.filter(l=>l.role!=="system");for(let l=0;l<t.length;l++){const a=t[l];if(a)if(a.role==="user"){const r=t[l+1];r&&r.role==="assistant"?(e.push({user:a,assistant:r}),l++):e.push({user:a,assistant:null})}else a.role==="assistant"&&e.push({user:null,assistant:a})}return e}function Ea(s){const e=$.c(18),{pair:t,isLastPair:l,status:a}=s,r=H.useRef(null),o=H.useRef(!1);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{r.current&&r.current.scrollIntoView({behavior:"smooth",block:"start"})},e[0]=i):i=e[0];const d=i;let c;e[1]!==l||e[2]!==a?(c=h=>{if(r.current=h,!l||!h||o.current)return;if(o.current=!0,a==="submitted"||a==="streaming"){h.scrollIntoView({behavior:"smooth",block:"start"});return}const S=h.closest("[data-chat-scroller]");S?S.scrollTop=S.scrollHeight:h.scrollIntoView({behavior:"instant",block:"start"})},e[1]=l,e[2]=a,e[3]=c):c=e[3];const m=c,p=!t.user&&"pt-8 sm:pt-6";let u;e[4]!==p?(u=q("flex flex-col pb-2 sm:pb-2",p),e[4]=p,e[5]=u):u=e[5];let f;e[6]!==t.user?(f=t.user&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"sticky top-0 z-50 w-full h-4 bg-background"}),n.jsx("div",{className:"sticky mb-8 sm:mb-6 top-4 z-50",children:n.jsx(Do,{message:t.user,onScrollToPair:d})})]}),e[6]=t.user,e[7]=f):f=e[7];const x=t.user?.created_at??null;let g;e[8]!==l||e[9]!==t.assistant||e[10]!==a||e[11]!==x?(g=n.jsx(Ao,{message:t.assistant,turnStartedAt:x,status:a,isLast:l}),e[8]=l,e[9]=t.assistant,e[10]=a,e[11]=x,e[12]=g):g=e[12];let b;return e[13]!==m||e[14]!==u||e[15]!==f||e[16]!==g?(b=n.jsxs("div",{ref:m,className:u,children:[f,g]}),e[13]=m,e[14]=u,e[15]=f,e[16]=g,e[17]=b):b=e[17],b}export{Sn as C,jn as F,fo as G,Xe as M,lo as O,mn as P,Aa as S,no as a,kn as b,$a as c,_n as d,Lt as e,un as f,Ge as g,Rt as h,Ma as i,Ia as j,pn as k,gn as l,Ra as m,Ea as n,Tn as o,Ke as s,At as t,La as u};
|