@qwen-code/qwen-code 0.25.2-preview.1 → 0.25.2
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/chunks/{MaxSizedBox-CF4NN4Y7.js → MaxSizedBox-CGJP7S5S.js} +1 -1
- package/chunks/{StandaloneSessionPicker-Q23KTB6U.js → StandaloneSessionPicker-H6NONKPP.js} +1 -1
- package/chunks/{acp-subagent-executor-LXOLDTFY.js → acp-subagent-executor-7OCKCTA5.js} +1 -1
- package/chunks/{acpAgent-QRKZVQAG.js → acpAgent-VCKTBLFO.js} +3 -3
- package/chunks/{advisor-VZZJU7BR.js → advisor-UQJ45FLG.js} +1 -1
- package/chunks/{agent-LP66VBC4.js → agent-KMSCVRSG.js} +1 -1
- package/chunks/{agent-headless-W5P4KPX4.js → agent-headless-3FWQ5QNO.js} +1 -1
- package/chunks/{agent-host-client-OW4HBXRL.js → agent-host-client-PXIIFCCS.js} +1 -1
- package/chunks/{agent-host-connections-D7IC6WWL.js → agent-host-connections-QUYGQNJX.js} +1 -1
- package/chunks/{anthropicContentGenerator-6I25Q3Y6.js → anthropicContentGenerator-MDETV5LU.js} +1 -1
- package/chunks/{batch-7E5KJ625.js → batch-RQO2HWFV.js} +1 -1
- package/chunks/{bridge-BITC2AVN.js → bridge-OA3GEU2I.js} +1 -1
- package/chunks/{channel-settings-store-VAVG6ONF.js → channel-settings-store-YN23NP2H.js} +1 -1
- package/chunks/{chunk-4NCTKE4Z.js → chunk-2PQ5ZRTI.js} +1 -1
- package/chunks/{chunk-OJHTHXBC.js → chunk-32UFT5HU.js} +1 -1
- package/chunks/{chunk-2HJZ3OYW.js → chunk-3C34EMBZ.js} +1 -1
- package/chunks/{chunk-UXFLNZNB.js → chunk-3FPPMGVC.js} +1 -1
- package/chunks/{chunk-74YXI5IJ.js → chunk-445NIH5T.js} +1 -1
- package/chunks/{chunk-MXXYBMBZ.js → chunk-45EKBDFD.js} +1 -1
- package/chunks/{chunk-JV5FCFG4.js → chunk-4WFWZWR3.js} +1 -1
- package/chunks/{chunk-AAOAX46J.js → chunk-56NX3ASC.js} +1 -1
- package/chunks/{chunk-IBS4PHD2.js → chunk-5FY6TL3Z.js} +1 -1
- package/chunks/{chunk-UGI3XPRM.js → chunk-5GJPVNHI.js} +1 -1
- package/chunks/{chunk-7BZGY7AH.js → chunk-5XAVUYY6.js} +6 -6
- package/chunks/{chunk-V3WNU4F5.js → chunk-655XEN5H.js} +1 -1
- package/chunks/{chunk-APX7ODYT.js → chunk-6PHAGUA6.js} +1 -1
- package/chunks/{chunk-CD6C4OHZ.js → chunk-7YX6LW5H.js} +1 -1
- package/chunks/{chunk-C2NFZSGI.js → chunk-AAVRYR5T.js} +1 -1
- package/chunks/{chunk-EO35BRIG.js → chunk-ANUAITTH.js} +1 -1
- package/chunks/{chunk-CNQ6AOFN.js → chunk-AZ5GFEKG.js} +1 -1
- package/chunks/{chunk-KAEW65QP.js → chunk-B5XDGUAK.js} +1 -1
- package/chunks/{chunk-X6QHNKUW.js → chunk-BCNBZOGV.js} +1 -1
- package/chunks/{chunk-W5DIWPQB.js → chunk-BDXWLZJD.js} +1 -1
- package/chunks/{chunk-ZASVUARY.js → chunk-BPX4A433.js} +1 -1
- package/chunks/{chunk-CDSI44GJ.js → chunk-BUI6W6CU.js} +1 -1
- package/chunks/{chunk-ZEYCGUHI.js → chunk-BVARURDD.js} +1 -1
- package/chunks/{chunk-PZ5UPKIG.js → chunk-BW5CHWEJ.js} +2 -2
- package/chunks/{chunk-7TUP75C2.js → chunk-C4DSH4A3.js} +1 -1
- package/chunks/{chunk-R4KMBENY.js → chunk-CCBWBPJL.js} +1 -1
- package/chunks/{chunk-TU6DWKVI.js → chunk-CKJ3OUIV.js} +2 -2
- package/chunks/{chunk-SG5P4CK4.js → chunk-CRZ7QRFB.js} +1 -1
- package/chunks/{chunk-UYFL7K4Z.js → chunk-CTEBIP2S.js} +1 -1
- package/chunks/{chunk-WSIDVWGO.js → chunk-DBOWUORN.js} +1 -1
- package/chunks/{chunk-NAHKSVYI.js → chunk-DPBXGGQX.js} +1 -1
- package/chunks/{chunk-BMOJDKDZ.js → chunk-DSSSLNXD.js} +3 -3
- package/chunks/{chunk-FP2RLPWJ.js → chunk-EKGFFEH4.js} +1 -1
- package/chunks/{chunk-L7W3J427.js → chunk-EMEQR2LX.js} +1 -1
- package/chunks/{chunk-YRYMLJAC.js → chunk-ENUYA7BO.js} +1 -1
- package/chunks/{chunk-4CWBH6LP.js → chunk-EORORGZC.js} +1 -1
- package/chunks/{chunk-RBH3BOVF.js → chunk-EUK64V6Z.js} +1 -1
- package/chunks/{chunk-AII4DN7M.js → chunk-FBV4LUUL.js} +1 -1
- package/chunks/{chunk-YVEPPENZ.js → chunk-FFLFTXO7.js} +1 -1
- package/chunks/{chunk-2HSFO66N.js → chunk-FHXH3GSI.js} +1 -1
- package/chunks/{chunk-RH6PMH32.js → chunk-FVBDVZD7.js} +1 -1
- package/chunks/{chunk-Y2HLDUZG.js → chunk-I2D2ZUKF.js} +1 -1
- package/chunks/{chunk-6PUZWUMQ.js → chunk-I3FZ733S.js} +1 -1
- package/chunks/{chunk-GG7RNHZW.js → chunk-IFAUFERF.js} +5 -5
- package/chunks/{chunk-JQ7BCB3L.js → chunk-IYFUH3JB.js} +1 -1
- package/chunks/{chunk-VAMQAYF3.js → chunk-JB5I5QAD.js} +1 -1
- package/chunks/{chunk-Z3UZTCKY.js → chunk-JD3QDS7D.js} +1 -1
- package/chunks/{chunk-TFVPY43T.js → chunk-JG2UNQOW.js} +1 -1
- package/chunks/{chunk-E4MRBL4O.js → chunk-JSXHTTFE.js} +1 -1
- package/chunks/{chunk-QTYA6TES.js → chunk-LJLS3MDJ.js} +1 -1
- package/chunks/{chunk-RZISIEQL.js → chunk-MEIW5WVJ.js} +1 -1
- package/chunks/{chunk-ZD4U3GR4.js → chunk-MGL36H3B.js} +1 -1
- package/chunks/{chunk-HXA3X4PB.js → chunk-MJUFVFH3.js} +1 -1
- package/chunks/{chunk-SYIDPXVT.js → chunk-MSR6LYHS.js} +1 -1
- package/chunks/{chunk-4MJ67O5W.js → chunk-MTXJRB7G.js} +2 -2
- package/chunks/{chunk-F5P3BWS7.js → chunk-MXFBSMIM.js} +1 -1
- package/chunks/{chunk-W6TNBCKX.js → chunk-MYHJ4WUH.js} +1 -1
- package/chunks/{chunk-CWU5NJOB.js → chunk-NHXKNS7F.js} +1 -1
- package/chunks/{chunk-6OIJIF6G.js → chunk-NT74NPQT.js} +1 -1
- package/chunks/{chunk-O47FCWNF.js → chunk-NWXW4UNC.js} +1 -1
- package/chunks/{chunk-JASL4RZR.js → chunk-O77LM4EW.js} +1 -1
- package/chunks/{chunk-ZDNTENP2.js → chunk-OB7T2MDO.js} +1 -1
- package/chunks/{chunk-L7WFW57T.js → chunk-PODFLAH7.js} +1 -1
- package/chunks/{chunk-R3ZMQ7WR.js → chunk-Q2G675WT.js} +1 -1
- package/chunks/{chunk-H3QROVUO.js → chunk-QT27SK62.js} +1 -1
- package/chunks/{chunk-UELAXFT7.js → chunk-QZPNBV4F.js} +1 -1
- package/chunks/{chunk-B3L4LODR.js → chunk-RV54BGL2.js} +1 -1
- package/chunks/{chunk-KLXL3FSI.js → chunk-SFETIBPP.js} +1 -1
- package/chunks/{chunk-F3YGAXZ5.js → chunk-SGKINIQB.js} +1 -1
- package/chunks/{chunk-MBPT3YYO.js → chunk-SHJNP7OV.js} +1 -1
- package/chunks/{chunk-U3YSYIQE.js → chunk-SPFRORFN.js} +1 -1
- package/chunks/{chunk-S3B4TZVJ.js → chunk-SPLINFM7.js} +1 -1
- package/chunks/{chunk-ORIS5AVH.js → chunk-SYO5FPHL.js} +1 -1
- package/chunks/{chunk-AGHGPOH6.js → chunk-TEE4MM5S.js} +1 -1
- package/chunks/{chunk-WHF3HYZI.js → chunk-TPZTO4K3.js} +1 -1
- package/chunks/{chunk-KJO757RN.js → chunk-UY2CSL5W.js} +1 -1
- package/chunks/{chunk-VCTZRPKP.js → chunk-W7QYXFWW.js} +1 -1
- package/chunks/{chunk-T3ECMT6I.js → chunk-WQOZJ6V7.js} +2 -2
- package/chunks/{chunk-INEI2ZW2.js → chunk-WZK7RC36.js} +1 -1
- package/chunks/{chunk-Y5JLH3SN.js → chunk-X22435IN.js} +4 -4
- package/chunks/{chunk-WHNAY3QQ.js → chunk-X2KF6AUQ.js} +1 -1
- package/chunks/{chunk-MUEIZGTI.js → chunk-YHPHQX6M.js} +1 -1
- package/chunks/{chunk-5OOO3YIH.js → chunk-YL7QMYOX.js} +1 -1
- package/chunks/{chunk-43E3XC2W.js → chunk-YQEOEO5V.js} +1 -1
- package/chunks/{chunk-624P32LD.js → chunk-YZ374XTK.js} +1 -1
- package/chunks/{codex-subagent-executor-2MPLWNLD.js → codex-subagent-executor-MC3QB2AN.js} +1 -1
- package/chunks/{config-utils-MJEEBLQW.js → config-utils-FYT7PUIC.js} +1 -1
- package/chunks/{contextCommand-BP566QVE.js → contextCommand-DXMSMSR7.js} +1 -1
- package/chunks/{core-runtime-BOAIFYAZ.js → core-runtime-ZLB6QZ3Z.js} +1 -1
- package/chunks/{create-sub-session-HJVK7AXV.js → create-sub-session-YUI3G5AF.js} +1 -1
- package/chunks/{daemon-git-worktree-guard-KA2Y6FHL.js → daemon-git-worktree-guard-5PYZMC6T.js} +1 -1
- package/chunks/{daemon-status-provider-JGR5JT2T.js → daemon-status-provider-GC567FVE.js} +1 -1
- package/chunks/{daemon-trust-policy-EP4DHXOW.js → daemon-trust-policy-LLD2UMPF.js} +1 -1
- package/chunks/{daemon-trust-policy-monitor-W3VZRKOK.js → daemon-trust-policy-monitor-MRMB2CRJ.js} +1 -1
- package/chunks/{deferred-core-runtime-Q3JH7XDL.js → deferred-core-runtime-4HLTINJ6.js} +1 -1
- package/chunks/{edit-S7DCBMAL.js → edit-CZ6FEXDU.js} +1 -1
- package/chunks/{enterPlanMode-UX7B6KWX.js → enterPlanMode-O3CJ3I2J.js} +1 -1
- package/chunks/{environment-ZBW6HDG3.js → environment-OJWH4FYL.js} +1 -1
- package/chunks/{errors-7ZRLUHEB.js → errors-NWKSQVL3.js} +1 -1
- package/chunks/{execution-tool-R244Q3GW.js → execution-tool-7UCADALN.js} +1 -1
- package/chunks/{execution-worker-JR44JTC4.js → execution-worker-LWHQMPBV.js} +1 -1
- package/chunks/{exitPlanMode-2PTTZXGO.js → exitPlanMode-JDM6ZZWI.js} +1 -1
- package/chunks/{fast-path-NQQ42XUR.js → fast-path-4WHPMNMD.js} +1 -1
- package/chunks/{glob-4JP6RQNK.js → glob-LAU4YJ6J.js} +1 -1
- package/chunks/{goal-tools-MO7NIH7B.js → goal-tools-AF2FQO3H.js} +1 -1
- package/chunks/{handleAutoUpdate-STUVMCIU.js → handleAutoUpdate-WBWK4775.js} +1 -1
- package/chunks/{i18n-UTIILRKE.js → i18n-O4Q2KHOA.js} +1 -1
- package/chunks/{initializer-YI2WT6LZ.js → initializer-2AH3EKBL.js} +1 -1
- package/chunks/{installationInfo-PW2JHHJV.js → installationInfo-77WYXG4W.js} +1 -1
- package/chunks/{list-SAOL2OZI.js → list-RAU3ZJQS.js} +1 -1
- package/chunks/{llm-LMY62H6Z.js → llm-MJMQ34KB.js} +4 -4
- package/chunks/{llm-content-generator-6RPOZ2YR.js → llm-content-generator-MJPR2TWC.js} +1 -1
- package/chunks/{loadedSettingsAdapter-RNXWDDE2.js → loadedSettingsAdapter-WRWWNGHZ.js} +1 -1
- package/chunks/{local-execution-environment-GIWY2LO6.js → local-execution-environment-VVJ7OYBT.js} +1 -1
- package/chunks/{loggingContentGenerator-AOKEDXK6.js → loggingContentGenerator-722BJL7T.js} +1 -1
- package/chunks/{manage-memory-WKPWLYDD.js → manage-memory-GN56UQHG.js} +1 -1
- package/chunks/{managed-npm-update-LFFWFATA.js → managed-npm-update-5VE662JS.js} +1 -1
- package/chunks/{managed-runtime-attestation-worker-IV6ZNIAK.js → managed-runtime-attestation-worker-ASGGZMFM.js} +1 -1
- package/chunks/{managed-runtime-session-worker-3NU4FOXD.js → managed-runtime-session-worker-YUSO7WFB.js} +1 -1
- package/chunks/{mcp-RDDGN4JK.js → mcp-6D236MEH.js} +1 -1
- package/chunks/{model-call-collection-JARTJD6S.js → model-call-collection-UAE2W6VV.js} +1 -1
- package/chunks/{model-configuration-7H6PEOLY.js → model-configuration-VHPSBCQI.js} +1 -1
- package/chunks/{modelConfigUtils-Q63ZZTXY.js → modelConfigUtils-XKDXYQRJ.js} +1 -1
- package/chunks/{monitor-HLO366TQ.js → monitor-JIKXBXDK.js} +1 -1
- package/chunks/{nonInteractiveCli-JO5EG6OK.js → nonInteractiveCli-IXTK5V4Q.js} +1 -1
- package/chunks/{nonInteractiveToolExecutor-T7AKBX25.js → nonInteractiveToolExecutor-3MSROJV5.js} +1 -1
- package/chunks/{notebook-edit-XKULPMG7.js → notebook-edit-VDWBIBMG.js} +1 -1
- package/chunks/{omni-H3GFC6KR.js → omni-MEUE65XC.js} +1 -1
- package/chunks/{openaiContentGenerator-RT4S6OYR.js → openaiContentGenerator-KNZTYVNK.js} +1 -1
- package/chunks/{openaiResponsesContentGenerator-JD4ZBCAL.js → openaiResponsesContentGenerator-G7GRJXES.js} +1 -1
- package/chunks/{pidfile-JXCPPGC6.js → pidfile-HMEKKPWO.js} +1 -1
- package/chunks/{processUtils-FF7LHGHW.js → processUtils-KHWNT3KU.js} +1 -1
- package/chunks/{prompt-terminal-ledger-VLIEJ5BB.js → prompt-terminal-ledger-EY72RU3D.js} +1 -1
- package/chunks/{qwenContentGenerator-6SGQI4ES.js → qwenContentGenerator-A7WREYLV.js} +1 -1
- package/chunks/{reactive-degrade-2UJPX4AU.js → reactive-degrade-O6WBGQ5X.js} +1 -1
- package/chunks/{read-file-27DWTM5N.js → read-file-A4MQWC6T.js} +1 -1
- package/chunks/{resumeHistoryUtils-KRF2LD7T.js → resumeHistoryUtils-KNUVMH5J.js} +1 -1
- package/chunks/{review-IPFFTVGV.js → review-OC76PLQ4.js} +1 -1
- package/chunks/{ripGrep-75QL35XD.js → ripGrep-JR6DHTIW.js} +1 -1
- package/chunks/{run-qwen-serve-WW74NSUL.js → run-qwen-serve-NFPGPJJ2.js} +2 -2
- package/chunks/{runtime-Z2NIOF6Y.js → runtime-BPHFAZOP.js} +1 -1
- package/chunks/{sandboxConfig-WMQAKX7Q.js → sandboxConfig-KXTV3QBG.js} +1 -1
- package/chunks/{scheduled-tasks-LMJJ5ZM7.js → scheduled-tasks-2GNFZH4N.js} +1 -1
- package/chunks/{scheduler-KHWWXW6H.js → scheduler-CKLZCETX.js} +1 -1
- package/chunks/{search-memory-WEO3M674.js → search-memory-ICNU2EJA.js} +1 -1
- package/chunks/{send-message-E2EVXDU4.js → send-message-T32PFXX5.js} +1 -1
- package/chunks/{serve-E7ZGE7PD.js → serve-O7XBFM36.js} +1 -1
- package/chunks/{server-SSHP5IO4.js → server-7H2EGX7C.js} +3 -3
- package/chunks/{session-UWUQU3NV.js → session-SO4TKKO3.js} +1 -1
- package/chunks/{session-attachments-root-I35OUD7P.js → session-attachments-root-QPBJB3Y2.js} +1 -1
- package/chunks/{session-execution-engine-selector-S7HXLYKG.js → session-execution-engine-selector-73JQ7AG6.js} +1 -1
- package/chunks/{session-pr-refresh-34FLQB2Z.js → session-pr-refresh-XPDBRBQV.js} +1 -1
- package/chunks/{sessionService-BBC2563F.js → sessionService-DDLWVLNC.js} +1 -1
- package/chunks/{settings-BXCTAYMU.js → settings-TUEKBNAX.js} +1 -1
- package/chunks/{shell-ORZNRZKX.js → shell-SXSN7UYK.js} +1 -1
- package/chunks/{skill-3MJ6V2VQ.js → skill-XAYT7HGV.js} +1 -1
- package/chunks/{skill-settings-A7TTYJGH.js → skill-settings-X3O75XUN.js} +1 -1
- package/chunks/{spawnChannel-UPHPUPIJ.js → spawnChannel-3523LPUW.js} +1 -1
- package/chunks/{standalone-update-GGHQ54QB.js → standalone-update-T7AUODLV.js} +1 -1
- package/chunks/{start-opentui-ui-O6WMWLGS.js → start-opentui-ui-IKBADQQS.js} +1 -1
- package/chunks/{startInteractiveUI-N3ZPR2FK.js → startInteractiveUI-PV2JETB4.js} +1 -1
- package/chunks/{team-create-EYLFAQVU.js → team-create-ZKTBFE7Z.js} +1 -1
- package/chunks/{team-plan-approval-2WFSX4XE.js → team-plan-approval-SCTAN2HM.js} +1 -1
- package/chunks/{terminal-image-renderer-A5HEJZTW.js → terminal-image-renderer-EDBYTK3B.js} +1 -1
- package/chunks/{theme-manager-TQHNJSKQ.js → theme-manager-ZLXHLO2Y.js} +1 -1
- package/chunks/{tool-call-UBLAA45C.js → tool-call-ULUE3W3P.js} +1 -1
- package/chunks/{tool-result-media-53AD3EHK.js → tool-result-media-VXS7QTX7.js} +1 -1
- package/chunks/{tool-search-D6PSBDDZ.js → tool-search-VWM6VCVU.js} +1 -1
- package/chunks/{total-session-admission-CUMMWSM2.js → total-session-admission-FZDBG232.js} +1 -1
- package/chunks/{trustedFolders-TERXKVJ6.js → trustedFolders-VIPEDZNB.js} +1 -1
- package/chunks/{update-relaunch-PXCI66U2.js → update-relaunch-N6TNUHQE.js} +1 -1
- package/chunks/{updateCheck-2P4ANPL7.js → updateCheck-367IR3FW.js} +1 -1
- package/chunks/{upload-config-G2WZG4DM.js → upload-config-5W4WTLML.js} +1 -1
- package/chunks/{useAutoAcceptIndicator-H7I7JP34.js → useAutoAcceptIndicator-SGT7EBCJ.js} +1 -1
- package/chunks/{validateNonInterActiveAuth-VLRV5LCK.js → validateNonInterActiveAuth-7WEBPZ4S.js} +1 -1
- package/chunks/{version-AOKDKXXZ.js → version-3OKRQ6LC.js} +1 -1
- package/chunks/{web-fetch-OUJS56AV.js → web-fetch-BV7BK5NT.js} +1 -1
- package/chunks/{web-search-3S4ZIGLP.js → web-search-DFQ74G7V.js} +1 -1
- package/chunks/{workflow-6W4WB4L5.js → workflow-EXSCHLQK.js} +1 -1
- package/chunks/{workspace-agents-7GB2RLY5.js → workspace-agents-HPOPFXKJ.js} +1 -1
- package/chunks/{workspace-providers-status-OMD57CUW.js → workspace-providers-status-UQCSR2PB.js} +1 -1
- package/chunks/{workspace-registration-store-WKLFVMQ2.js → workspace-registration-store-Q5U4WD5M.js} +1 -1
- package/chunks/{workspace-registry-6WJOPYIS.js → workspace-registry-I2O2LXTZ.js} +1 -1
- package/chunks/{workspace-runtime-coordinator-XG7G7DG3.js → workspace-runtime-coordinator-MVVDZYYX.js} +1 -1
- package/chunks/{workspace-service-YLX46RJM.js → workspace-service-CFJ2EUB7.js} +1 -1
- package/chunks/{workspace-skills-status-JZZR7QHN.js → workspace-skills-status-LLNIK3NS.js} +1 -1
- package/chunks/{workspace-trust-reconciler-AO3I5KYO.js → workspace-trust-reconciler-VLGJXLCZ.js} +1 -1
- package/chunks/{write-file-MGYLC32T.js → write-file-RG7HHIYP.js} +1 -1
- package/chunks/{zoom-image-TZ527ASZ.js → zoom-image-AKW6CA4K.js} +1 -1
- package/cli.js +2 -2
- package/execution-worker.js +1 -1
- package/export-transcript-document.js +1 -1
- package/package.json +3 -3
- package/web-shell/assets/{PierreFilePreview-Cq9imG0c.js → PierreFilePreview-Cij36lF-.js} +1 -1
- package/web-shell/assets/{SpreadsheetPreview-Blho0kkO.js → SpreadsheetPreview-kDlHrK21.js} +1 -1
- package/web-shell/assets/{WorkspaceFileBrowser-DjeX-ArR.js → WorkspaceFileBrowser-DBXW9l-s.js} +1 -1
- package/web-shell/assets/{abnfDiagram-VCTEODGH-mEfLgGao.js → abnfDiagram-VCTEODGH-DBrfOx4O.js} +1 -1
- package/web-shell/assets/{agents-route-Bg4_tLdL.js → agents-route-6E_3XRjk.js} +1 -1
- package/web-shell/assets/{arc-DEVpMJqB.js → arc-RwrvKU6y.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-CGhqKvd1.js → architectureDiagram-5GKGNRK7-B2_hfNn6.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-DxpWdCdl.js → blockDiagram-NRAW4CY4-C755qTFO.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-CE1W0_yu.js → c4Diagram-UCG6FXSJ-CARC2uHQ.js} +1 -1
- package/web-shell/assets/channel-U9JRrjem.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-ibHTXjoH.js → chunk-2Q5K7J3B-BS1ldEp9.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-BEZ2-gCE.js → chunk-5VM5RSS4-DckOEd3N.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-CKyPZ7Jh.js → chunk-F27PBJKO-fZstOLLL.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-WHNRb7iQ.js → chunk-G27WJ6UU-Bf4QkrJ7.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-Dm4G-fLP.js → chunk-JWPE2WC7-uBW51XO_.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-BvTm39E-.js → chunk-LCL6LL3I-D2MYZdE_.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-C0zAbzIo.js → chunk-POPQ4Y6H-CzTHTST7.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-B36K-VPq.js → chunk-SVP7TREG-fL48tjL5.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-D1opdtZ1.js → chunk-XXDRQBXY-R1jjDz-e.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-r255RW6f.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-r255RW6f.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-S_IO4ZW5.js → cose-bilkent-JH36ORCC-DTK6Alrt.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-CGUKfurr.js → cynefin-OW5HDTMX-C1JYDjN4.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-BqUpO_VD.js → cynefinDiagram-5FMLGOSQ-C3bR18IM.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-CiKqZpUi.js → dagre-3AP2YEHR-D4oUlW7g.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-B3CQED4o.js → diagram-S7CK7UJ4-m-a-vk_2.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-BewunX5H.js → diagram-UQ7AKVKN-CVGSVvpJ.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-C5j1hiVn.js → diagram-VSXAHHWV-DcLovKfd.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-CWDIIA61.js → diagram-VX7I27RA-DAwY09qQ.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-COa1V8UD.js → diagram-Z3DM3KII-D4BWV8Yb.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-CP33EIO8.js → ebnfDiagram-PWID7BFC-AhqQLlAR.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-V2pL2JAp.js → erDiagram-SSCWMZ5O-DcIpsPuK.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-CF-YQlR_.js → flowDiagram-A5DVABFB-Cdu3v56D.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-TXUid-Q2.js → ganttDiagram-EL5Y4UJY-D8o98Muo.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-QNcIYsgn.js → gitGraphDiagram-WWUBYQGX-fIAd56jC.js} +1 -1
- package/web-shell/assets/{index-CKa6aZMZ.js → index-CJmvuO8Q.js} +1 -1
- package/web-shell/assets/{index-N9F4X44H.js → index-DSh5Yfsf.js} +5 -5
- package/web-shell/assets/{infoDiagram-RXCK75RN-Dn1biwuc.js → infoDiagram-RXCK75RN-dPnP0Koe.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-iBYO7WCt.js → ishikawaDiagram-5VMMS53U-f9Oq8YH7.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-D98LzO4k.js → journeyDiagram-EYS64GPL-CqwSlUQ1.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-lQMIgDSM.js → kanban-definition-3QL26DDD-Bh_KTp2S.js} +1 -1
- package/web-shell/assets/{layout-BgOy6tFo.js → layout-0e-hGnuM.js} +1 -1
- package/web-shell/assets/{linear-En8RXsBs.js → linear-BtxWFISv.js} +1 -1
- package/web-shell/assets/{mermaid.core-BneKXyZr.js → mermaid.core-Dik4l-jM.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-NkP_9BC4.js → mindmap-definition-FBJOCRG2-B7gext3e.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-B0ie-nkt.js → pegDiagram-XKGWAZYB-BfyKzGY0.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-Qa86cFZc.js → pieDiagram-E7YTZNPT-vfeVyHgh.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-CkjUzR0e.js → quadrantDiagram-AXDQQJYC-DGAZmngq.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-mN7KpgJG.js → railroadDiagram-O6MQD6OU-Dgxiy8W5.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-Bmn2z6x2.js → requirementDiagram-EFPCY7ZU-D7TFokdR.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-CYWnwpoW.js → sankeyDiagram-P5KCCOFB-BZU_UYd-.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-BFyWlR1P.js → sequenceDiagram-WJ2MYXX4-Bz94qtvq.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-BwCPrn2w.js → sizeCapture-X5ZJPWSS-DVlzIShY.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-oqL3E0Ws.js → stateDiagram-HBIQ2CUA-CE9Il33j.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-BVL1rIGD.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-C3FAVL8g.js → swimlanes-XN3QIQJK-Cr2CyF9L.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-BeWJAUmf.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-BdwxFsPJ.js → timeline-definition-24CTP7MA-DWbRlUDe.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-j_G2AbSj.js → vennDiagram-4TSXK5OY-Bp5BiaRL.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-Dy_fHHBq.js → wardleyDiagram-VM6X3IG4-DoQIUrT8.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-CnLgG50x.js → xychartDiagram-S5SC5T6Z-BTO308Vv.js} +1 -1
- package/web-shell/index.html +1 -1
- package/web-shell/sw.js +1 -1
- package/web-shell/assets/channel-CHCXOu89.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-DXIqcod_.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-DXIqcod_.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-Cmho6gw2.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-D9Sfkn7b.js +0 -8
|
@@ -626,4 +626,4 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
626
626
|
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:re().optional().describe("User's language and region preference in BCP 47 format."),timeZone:re().optional().describe("User's timezone in IANA format."),userAgent:re().optional().describe("Host application identifier."),platform:Yt([ne("web"),ne("desktop"),ne("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:le({touch:Da().optional().describe("Whether the device supports touch input."),hover:Da().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:le({top:Ut().describe("Top safe area inset in pixels."),right:Ut().describe("Right safe area inset in pixels."),bottom:Ut().describe("Bottom safe area inset in pixels."),left:Ut().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough();le({method:ne("ui/notifications/host-context-changed"),params:xU.describe("Partial context update containing only changed fields.")});var T6e=le({method:ne("ui/update-model-context"),params:le({content:It(cg).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:ta(re(),Ea().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),_6e=le({method:ne("ui/initialize"),params:le({appInfo:Ab.describe("App identification (name and version)."),appCapabilities:b6e.describe("Features and capabilities this app provides."),protocolVersion:re().describe("Protocol version this app supports.")})});le({protocolVersion:re().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Ab.describe("Host application identification and version."),hostCapabilities:y6e.describe("Features and capabilities provided by the host."),hostContext:xU.describe("Rich context about the host environment.")}).passthrough();var B6=class{constructor(t=window.parent,a){Xt(this,"eventTarget"),Xt(this,"eventSource"),Xt(this,"messageListener"),Xt(this,"onclose"),Xt(this,"onerror"),Xt(this,"onmessage"),Xt(this,"sessionId"),Xt(this,"setProtocolVersion"),this.eventTarget=t,this.eventSource=a,this.messageListener=n=>{if(a&&n.source!==this.eventSource){console.debug("Ignoring message from unknown source",n);return}let r=OSe.safeParse(n.data);r.success?(console.debug("Parsed message",r.data),this.onmessage?.(r.data)):n.data?.jsonrpc!=="2.0"?console.debug("Ignoring non-JSON-RPC message",r.error.message,n):(console.error("Failed to parse message",r.error.message,n),this.onerror?.(Error("Invalid JSON-RPC message received: "+r.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(t,a){t.method!==l6e&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}},I6e=[kU],F6=class extends $6{constructor(t,a,n,r){super(r),Xt(this,"_client"),Xt(this,"_hostInfo"),Xt(this,"_capabilities"),Xt(this,"_appCapabilities"),Xt(this,"_hostContext",{}),Xt(this,"_appInfo"),Xt(this,"_initializedReceived",!1),Xt(this,"_baseReplaceRequestHandler",this.replaceRequestHandler),Xt(this,"replaceRequestHandler",(o,s)=>{this._baseReplaceRequestHandler(o,(i,l)=>(this._initializedReceived||console.warn(`[ext-apps] AppBridge received '${i.method}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`),s(i,l)))}),Xt(this,"eventSchemas",{sizechange:m6e,sandboxready:p6e,initialized:k6e,requestteardown:w6e,loggingmessage:wU}),Xt(this,"onping"),Xt(this,"_onmessage"),Xt(this,"_onopenlink"),Xt(this,"_ondownloadfile"),Xt(this,"_onrequestdisplaymode"),Xt(this,"_onupdatemodelcontext"),Xt(this,"_oncalltool"),Xt(this,"_onlistresources"),Xt(this,"_onlistresourcetemplates"),Xt(this,"_onreadresource"),Xt(this,"_onlistprompts"),Xt(this,"sendResourceTeardown",this.teardownResource),this._client=t,this._hostInfo=a,this._capabilities=n,this.addEventListener("initialized",()=>{this._initializedReceived=!0}),this._hostContext=r?.hostContext||{},this.setRequestHandler(_6e,o=>this._oninitialize(o)),this.setRequestHandler(Eb,(o,s)=>(this.onping?.(o.params,s),{})),this.replaceRequestHandler(mF,o=>({mode:this._hostContext.displayMode??"inline"}))}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}get onsizechange(){return this.getEventHandler("sizechange")}set onsizechange(t){this.setEventHandler("sizechange",t)}get onsandboxready(){return this.getEventHandler("sandboxready")}set onsandboxready(t){this.setEventHandler("sandboxready",t)}get oninitialized(){return this.getEventHandler("initialized")}set oninitialized(t){this.setEventHandler("initialized",t)}get onmessage(){return this._onmessage}set onmessage(t){this.warnIfRequestHandlerReplaced("onmessage",this._onmessage,t),this._onmessage=t,this.replaceRequestHandler(C6e,async(a,n)=>{if(!this._onmessage)throw Error("No onmessage handler set");return this._onmessage(a.params,n)})}get onopenlink(){return this._onopenlink}set onopenlink(t){this.warnIfRequestHandlerReplaced("onopenlink",this._onopenlink,t),this._onopenlink=t,this.replaceRequestHandler(f6e,async(a,n)=>{if(!this._onopenlink)throw Error("No onopenlink handler set");return this._onopenlink(a.params,n)})}get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(t){this.warnIfRequestHandlerReplaced("ondownloadfile",this._ondownloadfile,t),this._ondownloadfile=t,this.replaceRequestHandler(S6e,async(a,n)=>{if(!this._ondownloadfile)throw Error("No ondownloadfile handler set");return this._ondownloadfile(a.params,n)})}get onrequestteardown(){return this.getEventHandler("requestteardown")}set onrequestteardown(t){this.setEventHandler("requestteardown",t)}get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(t){this.warnIfRequestHandlerReplaced("onrequestdisplaymode",this._onrequestdisplaymode,t),this._onrequestdisplaymode=t,this.replaceRequestHandler(mF,async(a,n)=>{if(!this._onrequestdisplaymode)throw Error("No onrequestdisplaymode handler set");return this._onrequestdisplaymode(a.params,n)})}get onloggingmessage(){return this.getEventHandler("loggingmessage")}set onloggingmessage(t){this.setEventHandler("loggingmessage",t)}get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(t){this.warnIfRequestHandlerReplaced("onupdatemodelcontext",this._onupdatemodelcontext,t),this._onupdatemodelcontext=t,this.replaceRequestHandler(T6e,async(a,n)=>{if(!this._onupdatemodelcontext)throw Error("No onupdatemodelcontext handler set");return this._onupdatemodelcontext(a.params,n)})}get oncalltool(){return this._oncalltool}set oncalltool(t){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,t),this._oncalltool=t,this.replaceRequestHandler(hU,async(a,n)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(a.params,n)})}set oncreatesamplingmessage(t){this.setRequestHandler(yU,async(a,n)=>t(a.params,n))}sendToolListChanged(t={}){return this.notification({method:"notifications/tools/list_changed",params:t})}get onlistresources(){return this._onlistresources}set onlistresources(t){this.warnIfRequestHandlerReplaced("onlistresources",this._onlistresources,t),this._onlistresources=t,this.replaceRequestHandler(aU,async(a,n)=>{if(!this._onlistresources)throw Error("No onlistresources handler set");return this._onlistresources(a.params,n)})}get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(t){this.warnIfRequestHandlerReplaced("onlistresourcetemplates",this._onlistresourcetemplates,t),this._onlistresourcetemplates=t,this.replaceRequestHandler(rU,async(a,n)=>{if(!this._onlistresourcetemplates)throw Error("No onlistresourcetemplates handler set");return this._onlistresourcetemplates(a.params,n)})}get onreadresource(){return this._onreadresource}set onreadresource(t){this.warnIfRequestHandlerReplaced("onreadresource",this._onreadresource,t),this._onreadresource=t,this.replaceRequestHandler(sU,async(a,n)=>{if(!this._onreadresource)throw Error("No onreadresource handler set");return this._onreadresource(a.params,n)})}sendResourceListChanged(t={}){return this.notification({method:"notifications/resources/list_changed",params:t})}get onlistprompts(){return this._onlistprompts}set onlistprompts(t){this.warnIfRequestHandlerReplaced("onlistprompts",this._onlistprompts,t),this._onlistprompts=t,this.replaceRequestHandler(cU,async(a,n)=>{if(!this._onlistprompts)throw Error("No onlistprompts handler set");return this._onlistprompts(a.params,n)})}sendPromptListChanged(t={}){return this.notification({method:"notifications/prompts/list_changed",params:t})}assertCapabilityForMethod(t){}assertRequestHandlerCapability(t){}assertNotificationCapability(t){}assertTaskCapability(t){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(t){throw Error("Task handlers are not supported in MCP Apps")}getCapabilities(){return this._capabilities}async _oninitialize(t){let a=t.params.protocolVersion;return this._appInfo!==void 0&&console.warn("[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values."),this._appCapabilities=t.params.appCapabilities,this._appInfo=t.params.appInfo,{protocolVersion:I6e.includes(a)?a:kU,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(t){let a={},n=!1;for(let r of Object.keys(t)){let o=this._hostContext[r],s=t[r];L6e(o,s)||(a[r]=s,n=!0)}n&&(this._hostContext=t,this.sendHostContextChange(a))}sendHostContextChange(t){return this.notification({method:"ui/notifications/host-context-changed",params:t})}sendToolInput(t){return this.notification({method:"ui/notifications/tool-input",params:t})}sendToolInputPartial(t){return this.notification({method:"ui/notifications/tool-input-partial",params:t})}sendToolResult(t){return this.notification({method:"ui/notifications/tool-result",params:t})}sendToolCancelled(t){return this.notification({method:"ui/notifications/tool-cancelled",params:t})}sendSandboxResourceReady(t){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:t})}teardownResource(t,a){return this.request({method:"ui/resource-teardown",params:t},v6e,a)}callTool(t,a){return this.request({method:"tools/call",params:t},H0,a)}listTools(t,a){return this.request({method:"tools/list",params:t},mU,a)}async connect(t){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._initializedReceived=!1,this._client){let a=this._client.getServerCapabilities();if(!a)throw Error("Client server capabilities not available");a.tools&&(this.oncalltool=async(n,r)=>this._client.request({method:"tools/call",params:n},H0,{signal:r.signal}),a.tools.listChanged&&this._client.setNotificationHandler(gU,n=>this.sendToolListChanged(n.params))),a.resources&&(this.onlistresources=async(n,r)=>this._client.request({method:"resources/list",params:n},nU,{signal:r.signal}),this.onlistresourcetemplates=async(n,r)=>this._client.request({method:"resources/templates/list",params:n},oU,{signal:r.signal}),this.onreadresource=async(n,r)=>this._client.request({method:"resources/read",params:n},iU,{signal:r.signal}),a.resources.listChanged&&this._client.setNotificationHandler(lU,n=>this.sendResourceListChanged(n.params))),a.prompts&&(this.onlistprompts=async(n,r)=>this._client.request({method:"prompts/list",params:n},uU,{signal:r.signal}),a.prompts.listChanged&&this._client.setNotificationHandler(pU,n=>this.sendPromptListChanged(n.params)))}return super.connect(t)}};function L6e(e,t){return JSON.stringify(e)===JSON.stringify(t)}var A6e="_card_1vjff_1",E6e="_header_1vjff_9",R6e="_server_1vjff_20",M6e="_frame_1vjff_25",N6e="_fallback_1vjff_40",Sp={card:A6e,header:E6e,server:R6e,frame:M6e,fallback:N6e};function jC(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function G0(e){if(!(!jC(e)||e.type!=="mcp_app")&&!(typeof e.serverName!="string"||typeof e.resourceUri!="string"||typeof e.html!="string"||typeof e.fallbackText!="string"||!jC(e.toolResult)||!jC(e.toolArguments)))return e}var P6e=8192;function hF(e){let t=e.split("."),a=t.length===4&&t[0]==="127"&&t.slice(1).every(n=>{if(!/^\d+$/.test(n))return!1;let r=Number(n);return r>=0&&r<=255});return e==="localhost"||e==="[::1]"||a}function O6e(e){if(e==="127.0.0.1"||e==="[::1]")return"localhost"}function D6e(e,t,a=!1){try{let n=new URL(t),r=new URL(e,n);if(!["http:","https:"].includes(n.protocol)||!["http:","https:"].includes(r.protocol)||r.username||r.password)return;if(a||=n.protocol==="https:"||!hF(n.hostname)||!hF(r.hostname),!a&&(r.hostname==="[::1]"&&(r.hostname="localhost"),r.origin===n.origin)){let o=O6e(r.hostname);o&&(r.hostname=o)}return r.pathname=`${r.pathname.replace(/\/$/,"")}/mcp-app-sandbox`,r.search="",r.hash="",r.searchParams.set("hostOrigin",n.origin),a&&r.searchParams.set("mode","data"),r.toString()}catch{return}}function $6e(e,t){if(!t)return e;let a=new URL(e);return a.searchParams.set("csp",t),a.search.length<=P6e?a.toString():e}function gF(e){return{theme:e,platform:"web",displayMode:"inline",availableDisplayModes:["inline"],containerDimensions:{maxHeight:640}}}var HC=0,zy=new Set;function B6e(e){return new Promise((t,a)=>{let n=()=>{zy.delete(r),a(e.reason)},r=()=>{e.removeEventListener("abort",n),HC+=1,t(()=>{HC-=1;let o=zy.values().next().value;o&&(zy.delete(o),o())})};e.aborted?a(e.reason):HC<2?r():(zy.add(r),e.addEventListener("abort",n,{once:!0}))})}function F6e({display:e}){let t=(0,y.useContext)(Wz),a=(0,y.useContext)(Gz),n=(0,y.useContext)(g0e),r=(0,y.useContext)(h0e);a&&r?.sessionId;let o=void 0,s=a&&n?.sessionId===a?n.callTool:void 0,i=K0(),l=(0,y.useRef)(null),c=(0,y.useRef)(null),d=(0,y.useRef)(0),f=(0,y.useRef)(e),p=(0,y.useRef)(i);f.current=e,p.current=i;let[m,g]=(0,y.useState)(260),[h,b]=(0,y.useState)(),[v,w]=(0,y.useState)(!1),k=e.csp?JSON.stringify(e.csp):"",_=JSON.stringify(e.toolArguments),T=JSON.stringify(e.toolResult),L=(0,y.useMemo)(()=>{if(!t||typeof window>"u")return;let S=D6e(t,window.location.href,v);if(S)return $6e(S,k)},[t,k,v]);return(0,y.useEffect)(()=>{b(void 0);let S=l.current;if(!S||!L)return;let I=++d.current,R=!1,E=!0,N=!1,O=f.current,$=new F6(null,{name:"qwen-code-web-shell",version:"0.0.1"},{...s?{serverTools:{}}:{},sandbox:{...O.csp?{csp:O.csp}:{}}},{hostContext:gF(p.current)});c.current=$;let B=new AbortController;s&&($.oncalltool=async(J,Z)=>{let Q=AbortSignal.any([Z.signal,B.signal]),A=0,j=J._meta?.progressToken,K=Z.sendNotification,P=Q.aborted||typeof j!="string"&&typeof j!="number"?void 0:setInterval(()=>{K({method:"notifications/progress",params:{progressToken:j,progress:++A}}).catch(()=>{})},3e4),ae=()=>clearInterval(P);Q.addEventListener("abort",ae,{once:!0});let se;try{return se=await B6e(Q),Q.throwIfAborted(),await s({serverName:O.serverName,resourceUri:O.resourceUri,name:J.name,arguments:J.arguments??{}},Q)}finally{se?.(),ae(),Q.removeEventListener("abort",ae)}});let V=()=>{!E||d.current!==I||(E=!1,clearTimeout(G),$.oncalltool=void 0,$.onmessage=void 0,B.abort(),S.removeAttribute("src"),c.current=null,$.close().catch(()=>{}),b("sandbox-load-failed"))},G=setTimeout(()=>{E&&(new URL(L).searchParams.get("mode")!=="data"?w(!0):V())},1e4);return $.onsandboxready=()=>{if(!E||N)return;N=!0,clearTimeout(G),G=setTimeout(()=>{E&&!R&&V()},3e4);let J=f.current;$.sendSandboxResourceReady({html:J.html,...J.csp?{csp:J.csp}:{}}).catch(V)},$.oninitialized=()=>{if(!E)return;R=!0,clearTimeout(G);let J=f.current;$.sendToolInput({arguments:J.toolArguments}).then(()=>{if(E)return $.sendToolResult(J.toolResult)}).catch(V)},$.onsizechange=({height:J})=>{typeof J=="number"&&Number.isFinite(J)&&g(Math.min(640,Math.max(120,Math.ceil(J))))},$.connect(new B6(S.contentWindow??void 0,S.contentWindow)).then(()=>{E&&(S.src=L)}).catch(V),()=>{E=!1,clearTimeout(G),$.oncalltool=void 0,$.onmessage=void 0,B.abort(),c.current=null;let J=()=>{d.current===I&&S.removeAttribute("src"),$.close().catch(()=>{})};if(R){$.teardownResource({},{timeout:500}).catch(()=>{}).finally(J);return}J()}},[L,v,s,o,a,e.serverName,e.resourceUri,e.html,k,_,T]),(0,y.useEffect)(()=>{c.current?.setHostContext(gF(i))},[i]),!e.html||!L?(0,u.jsx)("div",{className:Sp.fallback,children:e.fallbackText}):(0,u.jsxs)("div",{className:Sp.card,"data-testid":"mcp-app",children:[(0,u.jsxs)("div",{className:Sp.header,children:[(0,u.jsx)("span",{children:"MCP App"}),(0,u.jsx)("span",{className:Sp.server,children:e.serverName})]}),h?(0,u.jsx)("div",{className:Sp.fallback,children:e.fallbackText||"MCP App could not initialize."}):null,(0,u.jsx)("iframe",{ref:l,title:`${e.serverName} MCP App`,className:Sp.frame,style:{height:m,display:h?"none":void 0},sandbox:"allow-scripts allow-forms allow-same-origin",referrerPolicy:"origin",onError:()=>b("sandbox-load-failed")})]})}function z6e(e){let t=q6e(e.args,"file_path","filePath","path");if(t!==void 0&&t.length>0)return t;for(let a of e.content??[])if(a.path)return a.path;return e.locations?.[0]?.file}function q6e(e,...t){if(e)for(let a of t){let n=e[a];if(typeof n=="string")return n}}function U6e(e,t){if(!e||!t)return;let a=e.workspaces;if(a){let n=a.filter(o=>o.cwd===t),r=n[0];return n.length!==1||!r?.id||r.trusted!==!0||a.filter(o=>o.id===r.id).length!==1||r.primary!==(r.cwd===e.workspaceCwd)?void 0:j6e(r)}if(e.workspaceCwd===t)return{cwd:t,primary:!0}}function j6e(e){return{cwd:e.cwd,id:e.id,primary:e.primary}}function H6e(e,t){return e?.cwd===t.cwd&&e.id===t.id&&e.primary===t.primary}function SU(e){let t=Sb(),a=k0e(),n=(0,y.useMemo)(()=>U6e(t.capabilities,e),[t.capabilities,e]),r=!!(n?.id&&t.capabilities?.features?.includes("workspace_file_upload")&&t.capabilities?.features?.includes("workspace_qualified_rest_core")),o=(0,y.useRef)(r);o.current=r;let s=(0,y.useRef)(void 0);n?H6e(s.current?.owner,n)||(s.current={owner:n}):s.current=void 0;let i=s.current,l=(0,y.useRef)(void 0);(0,y.useEffect)(()=>{if(!i){l.current=void 0;return}let d={};return l.current=d,()=>{queueMicrotask(()=>{l.current===d&&s.current===i&&(s.current=void 0)})}},[i]);let c=(0,y.useMemo)(()=>{if(!i)return;let d=i,f=()=>{let m=s.current;if(m!==d)throw new Error("Workspace artifact owner is no longer available");return m.owner},p=m=>{let g=f();if(g.id!==m)throw new Error("Scheduled task workspace owner no longer matches");return g};return{...r?{async uploadWorkspaceFile(m,g){let h=f();if(!o.current)throw new Error("Workspace file upload is no longer available");let b=await t.client.workspaceByCwd(h.cwd).uploadWorkspaceFile(m,g);if(f(),!o.current)throw new Error("Workspace file upload is no longer available");return b}}:{},async listDirectory(m){let g=f(),h=await(g.id?t.client.workspaceByCwd(g.cwd).dirList(m):a.listDirectory(m));return f(),h},async readWorkspaceFile(m,g){let h=f(),b=await(h.primary?a.readWorkspaceFile(m,g):t.client.workspaceByCwd(h.cwd).readWorkspaceFile(m,g));return f(),b},async readFileBytes(m,g){let h=f(),b=await(h.primary?a.readFileBytes(m,g):t.client.workspaceByCwd(h.cwd).readWorkspaceFileBytes(m,g));return f(),b},async stat(m){let g=f(),h=await(g.primary?a.stat(m):t.client.workspaceByCwd(g.cwd).fileStat(m));return f(),h},async listScheduledTasks(m){p(m);let g=await a.listScheduledTasks(m);return p(m),g},async updateScheduledTask(m,g,h){p(h);let b=await a.updateScheduledTask(m,g,h);return p(h),b},async deleteScheduledTask(m,g){p(g),await a.deleteScheduledTask(m,g),p(g)}}},[i,a,t.client,r]);if(!(!i||!c))return{workspaceCwd:i.owner.cwd,...i.owner.id?{workspaceId:i.owner.id}:{},actions:c}}function W6e({tool:e,workspaceCwd:t,onOpen:a,iconOnly:n}){let r=Ma(),o=z6e(e);return r!=="interactive"||!a||!t||!o?.trim()?null:(0,u.jsx)(G6e,{filePath:o,workspaceCwd:t,tool:e,onOpen:a,iconOnly:n},JSON.stringify([t,o,e.callId]))}function G6e({filePath:e,workspaceCwd:t,tool:a,onOpen:n,iconOnly:r}){let{t:o}=tt(),{status:s}=Sb(),i=SU(t)?.actions,[l,c]=(0,y.useState)(),d=(0,y.useRef)({sequence:0}).current,f=(0,y.useRef)({actions:i,status:s,onOpen:n});if(f.current={actions:i,status:s,onOpen:n},(0,y.useEffect)(()=>{if(c(void 0),!i||s!=="connected")return;let m=async()=>{let g=++d.sequence;try{let h=await i.stat(e);g===d.sequence&&c(h.type==="file"?i:void 0)}catch{g===d.sequence&&c(void 0)}};return m(),window.addEventListener("focus",m),()=>{d.sequence++,window.removeEventListener("focus",m)}},[i,e,d,s,a.status]),!i||s!=="connected"||l!==i)return null;let p=async()=>{let m=++d.sequence;try{let g=await i.stat(e);if(m!==d.sequence||f.current.actions!==i||f.current.status!=="connected"||f.current.onOpen!==n)return;if(g.type!=="file"){c(void 0);return}n({id:`file:${t}:${e}`,kind:"attachment",title:e.split(/[/\\]/).pop()||e,turnId:a.callId,workspacePath:e,workspaceCwd:t,silentUnavailable:!0})}catch{m===d.sequence&&c(void 0)}};return(0,u.jsxs)(Ha,{type:"button",variant:"ghost",size:r?"icon-xs":"xs",className:"ml-auto text-muted-foreground",title:o("tool.viewCurrentFile"),"aria-label":o(r6(e)?"tool.viewImage":"tool.viewFile"),onClick:()=>void p(),children:[!r&&o(r6(e)?"tool.viewImage":"tool.viewFile"),(0,u.jsx)(Oi,{"aria-hidden":"true"})]})}function V6e({result:e,onOpen:t}){let{t:a}=tt();return(0,u.jsxs)("div",{className:"flex flex-wrap items-center gap-2 px-3 py-2 text-xs","data-managed-tool-result":e.id,children:[(0,u.jsx)(DC,{variant:"outline",children:a(`managed.result.execution.${e.execution_status}`)}),(0,u.jsx)(DC,{variant:"outline",children:a(`managed.result.capture.${e.capture_status??"none"}`)}),(0,u.jsx)(DC,{variant:"outline",children:a(`managed.result.delivery.${e.delivery_status}`)}),t&&(0,u.jsx)(Ha,{size:"sm",variant:"ghost",onClick:()=>t(e.item_id),children:a("managed.result.view")})]})}function CU(e,t,a){if(e.current)return;let n={};e.current=n,t().then(r=>{e.current===n&&!r&&a()},()=>{e.current===n&&a()}).finally(()=>{e.current===n&&(e.current=null)})}function X6e(e){let t=e.toolName.toLowerCase();return _s(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||u9(t)||i9(t)||Lo(e.toolName)||c9(t)}function Xy(e){let t=e.toLowerCase();return t==="edit"||t==="editfile"||t==="write"||t==="write_file"||t==="writefile"}function K6e(e){let t=Z6e(e);if(t)return t;if(e.content){let o=e.content.find(s=>s.type==="diff");if(o&&o.type==="diff")return WB(o.oldText||"",o.newText||"")}if(e.status==="failed"||e.wasCancelled)return"";let a=e.args?.patch;if(typeof a=="string"&&a)return a;let n=e.args?.newText??e.args?.new_string,r=e.args?.oldText??e.args?.old_string;return typeof n=="string"||typeof r=="string"?WB(typeof r=="string"?r:"",typeof n=="string"?n:""):""}function Z6e(e){if(e.rawOutput&&typeof e.rawOutput=="object"){let t=e.rawOutput;if(Q6e(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function Q6e(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}var Y6e=60,J6e=2e5,e9e=1e3,t9e={cjs:"javascript",cts:"typescript",h:"c",hpp:"cpp",js:"javascript",jsx:"jsx",mjs:"javascript",mts:"typescript",py:"python",rb:"ruby",sh:"bash",ts:"typescript",tsx:"tsx",yml:"yaml"};function a9e({tool:e}){let t=(0,y.useMemo)(()=>md(e)||"",[e]),a=o9e(n9e(e)),n=a==="text"||t.length>J6e||r9e(t,e9e);return(0,u.jsx)("div",{className:pe.expandedRead,children:n?(0,u.jsx)("pre",{className:pe.expandedOutput,children:t}):(0,u.jsx)(ci,{content:s9e(a,t)})})}function n9e(e){let t=e.args?.file_path??e.args?.path;return typeof t=="string"?t:""}function r9e(e,t){let a=1;for(let n=0;n<e.length;n++)if(e.charCodeAt(n)===10&&++a>t)return!0;return!1}function o9e(e){let t=e.split(/[?#]/,1)[0]?.split(".").pop()?.toLowerCase();if(!t||t===e.toLowerCase()||t==="mermaid"||t==="mmd")return"text";let a=t9e[t]??t;return/^[\w+.#-]+$/.test(a)?a:"text"}function s9e(e,t){let a=t.match(/~{3,}/g)?.reduce((r,o)=>Math.max(r,o.length),0)??0,n="~".repeat(Math.max(3,a+1));return`${n}${e}
|
|
627
627
|
${t}
|
|
628
628
|
${n}`}function vF({tool:e}){let t=(0,y.useMemo)(()=>K6e(e),[e]),a=(0,y.useMemo)(()=>e.content&&md(e)||"",[e]);return!t&&!a?null:(0,u.jsx)("div",{className:pe.expandedEdit,children:t?(0,u.jsx)(Z2e,{diff:t}):(0,u.jsx)("pre",{className:pe.expandedOutput,children:a})})}function F0({title:e,action:t,detail:a,status:n,children:r}){return(0,u.jsxs)("div",{className:pe.expandedCard,children:[(0,u.jsxs)("div",{className:pe.expandedCardHeader,children:[(0,u.jsxs)("span",{className:pe.expandedCardTitleRow,children:[n&&(0,u.jsx)(Mp,{status:n}),(0,u.jsx)("span",{className:pe.expandedCardTitle,children:e}),t]}),a&&(0,u.jsx)("span",{className:pe.expandedCardDetail,children:a})]}),r&&(0,u.jsx)("div",{className:pe.expandedCardBody,children:r})]})}function i9e({tool:e,todos:t,expanded:a,title:n}){let r=(0,y.useContext)(K6).get(e.callId)?.events??[];return a?(0,u.jsx)(F0,{title:n,status:e.status,children:(0,u.jsx)("div",{className:pe.todoBody,children:(0,u.jsx)(hq,{todos:t})})}):(0,u.jsx)("div",{className:pe.todoBody,children:(0,u.jsx)(mq,{todos:t,events:r})})}function l9e({tool:e,displayName:t,detail:a,result:n}){let{t:r}=tt(),o=sxe(),s=o?lxe(o.tasks,e):void 0;return s?(0,u.jsx)(iq,{task:s}):(0,u.jsx)(F0,{title:t,detail:a,children:(0,u.jsx)("div",{className:pe.workflowFallback,role:"status",children:e.status==="pending"||e.status==="in_progress"?r("workflow.inline.loading"):n||r("workflow.inline.unavailable")})})}function TU(e,t){let a=Bp(e.rawOutput),n=d9(e),r=q0(e),o=m9(e),s=c9e(e),i=bb(e),l=e.subTools?.length||a?.toolCalls?.length||0,c=a?.executionSummary,d=c&&typeof c.totalDurationMs=="number"?cq(c.totalDurationMs):Op(e.startTime,e.endTime??(e.status==="in_progress"&&t?t:void 0)),f=a&&typeof a.tokenCount=="number"&&a.tokenCount>0?a.tokenCount:c&&typeof c.outputTokens=="number"&&c.outputTokens>0?c.outputTokens:0,p=f>0?p9(f):"";return{agentType:o,explicitAgentType:s,description:i,subToolCount:l,elapsed:d,tokens:p,status:r,reason:n}}function c9e(e){let t=Bp(e.rawOutput)?.subagentName;if(typeof t=="string"&&t.trim())return t.trim();let a=e.args?.subagent_type;return typeof a=="string"&&a.trim()?a.trim():""}function wF(e){if(e.status==="completed")return!1;let t=e.toolName.toLowerCase();return!!(Lo(e.toolName)||Xy(t)||_s(t))}function u9e({tool:e}){let t=md(e)||"";return(0,u.jsx)("pre",{className:pe.expandedOutput,children:t})}function d9e({tool:e}){let t=f9e(e)||(typeof e.args?.args=="string"&&e.args.args.trim()?e.args.args.trim():e.title??"");return(0,u.jsx)("pre",{className:pe.expandedOutput,children:t})}function f9e(e){let t=e.content?.[0];return t?.type!=="content"?"":typeof t.content?.text=="string"?t.content.text:""}function mb(e){let t=e.toolName.toLowerCase();return tr(e)?"agent":Lo(e.toolName)?"ask":_s(t)?"shell":q6(t)?"fetch":hd(t)?"todo":t==="read"||t==="read_file"||t==="readfile"?"read":t==="edit"||t==="editfile"?"edit":t==="write"||t==="write_file"||t==="writefile"?"write":"other"}function p9e({description:e,elapsed:t}){return(0,u.jsxs)(u.Fragment,{children:[e&&(0,u.jsx)("span",{className:pe.lineArg,children:e}),t&&(0,u.jsx)("span",{className:pe.lineElapsed,children:t})]})}function P0({info:e}){let{renderToolHeaderExtra:t}=Ao(),a=t?.(e);return a?(0,u.jsx)(u.Fragment,{children:a}):(0,u.jsx)(p9e,{description:e.description,elapsed:e.kind==="agent"||Cn(e.tool.status)?e.elapsed:""})}function m9e(e){return e.length>Y6e||e.includes(`
|
|
629
|
-
`)}function h9e(e){return e.find(t=>Cn(t.status))??e[e.length-1]}function g9e(e,t,a,n=!1){if(Z6(e)){let o=e.filter(i=>Cn(i.status)&&!Is(i));if(o.length===0)return t("subagent.background");if(o.length===1&&Lo(o[0].toolName))return t("toolGroup.summary.provideInformation");let s=o.map(i=>Lo(i.toolName)?t("toolGroup.summary.provideInformation"):_U(i,t,a));return t("toolGroup.running",{name:s.join(" \xB7 "),count:o.length})}return w9e(e,t,n)||t("toolGroup.summary",{count:e.length})}function _U(e,t,a){if(hd(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if(Lo(e.toolName))return Cn(e.status)?t("toolGroup.summary.provideInformation"):t("toolGroup.summary.askedQuestions",{count:LU(e)});let{displayName:n,description:r,hideDisplayName:o}=IU(e,t,a);return[o?"":n,r].filter(Boolean).join(" ")}function IU(e,t,a){let n=Nc(e.toolName,t),r=ln(Nz(e,a),120);return{kind:mb(e),tool:e,displayName:n,description:r,elapsed:"",workspaceCwd:a,hideDisplayName:!!tpe(e)}}function v9e({tool:e,workspaceCwd:t}){let{t:a}=tt(),n=Lo(e.toolName),r=Cn(e.status),o=Is(e),s=r&&!o&&tr(e),i=Cb(s),l=!n&&r?o?a("subagent.background"):a("toolGroup.runningPrefix").trim():"";if(hd(e.toolName)||n)return(0,u.jsxs)(u.Fragment,{children:[l&&(0,u.jsxs)("span",{children:[l," "]}),_U(e,a,t)]});let c=IU(e,a,t),d=s?Bz(e,a):"",f=s?{...c,description:[c.description,d&&`(${d})`].filter(Boolean).join(" "),elapsed:TU(e,i).elapsed}:c;return(0,u.jsxs)(u.Fragment,{children:[l&&(0,u.jsxs)("span",{children:[l," "]}),(0,u.jsxs)("span",{className:pe.chatSummaryInline,children:[!f.hideDisplayName&&(0,u.jsx)("span",{className:pe.lineName,children:f.displayName}),(0,u.jsx)(P0,{info:f})]})]})}function w9e(e,t,a){let n=a?e.filter(tr).length:0;if(n>0){let f=e.length-n;return[t("toolGroup.summary.ranAgents",{count:n}),f?t("toolGroup.summary",{count:f}):""].filter(Boolean).join(" \xB7 ")}let r=0,o=0,s=0,i=0,l=0,c=0,d=0;for(let f of e){let p=f.toolName.toLowerCase();_s(p)?o++:p==="edit"||p==="editfile"||p==="write"||p==="write_file"||p==="writefile"?r++:p==="read"||p==="read_file"||p==="readfile"?s++:p==="grep"||p==="grep_search"||p==="search"||p==="glob"||p==="web_search"||p==="websearch"?i++:hd(p)?l++:Lo(p)?c+=LU(f):d++}return[r?t("toolGroup.summary.editedFiles",{count:r}):"",o?t("toolGroup.summary.ranCommands",{count:o}):"",s?t("toolGroup.summary.readFiles",{count:s}):"",i?t("toolGroup.summary.searched",{count:i}):"",l?t("toolGroup.summary.updatedTodos",{count:l}):"",c?t("toolGroup.summary.askedQuestions",{count:c}):"",d?t("toolGroup.summary.otherTools",{count:d}):""].filter(Boolean).join(" ")}function LU(e){let t=e.args?.questions;return Array.isArray(t)&&t.length>0?t.length:1}function y9e(){return(0,u.jsxs)("svg",{className:pe.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,u.jsx)("path",{d:"M12 20h9"}),(0,u.jsx)("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function AU(){return(0,u.jsxs)("svg",{className:pe.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[(0,u.jsx)("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),(0,u.jsx)("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function b9e(){return(0,u.jsxs)("svg",{className:pe.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[(0,u.jsx)("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.25"}),(0,u.jsx)("path",{d:"M1.8 7h10.4M7 1.5c1.3 1.5 2 3.3 2 5.5s-.7 4-2 5.5M7 1.5C5.7 3 5 4.8 5 7s.7 4 2 5.5",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function k9e(){return(0,u.jsxs)("svg",{className:pe.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[(0,u.jsx)("rect",{x:"2",y:"1.6",width:"10",height:"10.8",rx:"2.2",stroke:"currentColor",strokeWidth:"1.25"}),(0,u.jsx)("path",{d:"M4.5 5.2h5M4.5 7h5M4.5 8.8h5",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function x9e(){return(0,u.jsx)("svg",{className:pe.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:(0,u.jsx)("path",{d:"M3 4.2 4.2 5.4 6.1 3.3M7.5 4.5h3.6M3 9.1l1.2 1.2 1.9-2.1M7.5 9.4h3.6",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function S9e(){return(0,u.jsx)("svg",{className:pe.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:(0,u.jsx)("path",{d:"M3.4 3.2h7.2c.7 0 1.25.55 1.25 1.25v3.4c0 .7-.55 1.25-1.25 1.25H7.5L4.5 11V9.1H3.4c-.7 0-1.25-.55-1.25-1.25v-3.4c0-.7.55-1.25 1.25-1.25Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function z6(){return(0,u.jsx)("svg",{className:pe.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:(0,u.jsx)("path",{d:"M770.08 96.32c1.728.64 3.072 1.984 3.712 3.712l38.848 107.584c.64 1.728 1.984 3.104 3.712 3.712l107.584 38.848a6.144 6.144 0 0 1 0 11.584l-107.584 38.848a6.144 6.144 0 0 0-3.712 3.712l-38.848 107.584a6.144 6.144 0 0 1-11.584 0L723.36 304.32a6.144 6.144 0 0 0-3.712-3.712L612.064 261.76a6.144 6.144 0 0 1 0-11.584l107.584-38.848a6.144 6.144 0 0 0 3.712-3.712l38.848-107.584c1.184-3.2 4.704-4.8 7.872-3.68zM576 160H384q-119.296 0-203.648 84.352Q96 328.704 96 448v192q0 119.296 84.352 203.648Q264.704 928 384 928h256q119.296 0 203.648-84.352Q928 759.296 928 640V512h-64v128q0 92.8-65.6 158.4Q732.8 864 640 864H384q-92.8 0-158.4-65.6Q160 732.8 160 640V448q0-92.8 65.6-158.4Q291.2 224 384 224h192v-64zm96 248.224L568.224 512 672 615.776l45.248-45.28L658.752 512l58.496-58.496L672 408.224zM320 608V448h64v160h-64z",stroke:"currentColor",strokeWidth:"28",strokeLinejoin:"round"})})}function EU({tool:e}){let t=mb(e);return t==="agent"?(0,u.jsx)(z6,{}):t==="ask"?(0,u.jsx)(S9e,{}):t==="edit"||t==="write"?(0,u.jsx)(y9e,{}):t==="fetch"?(0,u.jsx)(b9e,{}):t==="read"?(0,u.jsx)(k9e,{}):t==="todo"?(0,u.jsx)(x9e,{}):(0,u.jsx)(AU,{})}function q6(e){let t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}function C9e(e,t){if(e.approval?.id!==t.approval?.id||e.workspaceCwd!==t.workspaceCwd||e.onTurnOutputOpen!==t.onTurnOutputOpen||e.onToolResultOpen!==t.onToolResultOpen||e.summaryOnly!==t.summaryOnly||e.forceExpanded!==t.forceExpanded||e.detailsVisible!==t.detailsVisible||e.hideHeader!==t.hideHeader||e.hideCollapsedOutput!==t.hideCollapsedOutput)return!1;let a=e.tool,n=t.tool;return a.callId===n.callId&&a.toolName===n.toolName&&a.status===n.status&&a.subagentSessionReady===n.subagentSessionReady&&a.startTime===n.startTime&&a.endTime===n.endTime&&a.subContent===n.subContent&&a.rawOutput===n.rawOutput&&a.toolResult===n.toolResult&&a.wasCancelled===n.wasCancelled&&a.args===n.args&&a.content===n.content&&a.locations===n.locations&&a.title===n.title&&T9e(a.subTools,n.subTools)}function T9e(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let a=0;a<e.length;a++){let n=e[a],r=t[a];if(n.callId!==r.callId||n.toolName!==r.toolName||n.status!==r.status||n.subagentSessionReady!==r.subagentSessionReady||n.endTime!==r.endTime||n.rawOutput!==r.rawOutput||n.toolResult!==r.toolResult||n.wasCancelled!==r.wasCancelled||n.args!==r.args||n.subContent!==r.subContent||n.title!==r.title)return!1}return!0}var yF=/\[([^\]]+)\]\(qwen-session:\/\/([^)]+)\)/g;function WC(e,t){if(!e||!e.includes("qwen-session://"))return e;let a=[],n=0,r;for(yF.lastIndex=0;(r=yF.exec(e))!==null;){r.index>n&&a.push(e.slice(n,r.index));let o=r[2];a.push(t!=="interactive"?(0,u.jsx)("span",{style:{textDecoration:"underline"},children:r[1]},r.index):(0,u.jsx)("a",{href:"#",role:"button",style:{textDecoration:"underline",cursor:"pointer"},onClick:s=>{s.preventDefault(),s.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:o}))},children:r[1]},r.index)),n=r.index+r[0].length}return n<e.length&&a.push(e.slice(n)),a.length===1?a[0]:(0,u.jsx)(u.Fragment,{children:a})}var U6=(0,y.memo)(function({tool:e,approval:t,workspaceCwd:a,onTurnOutputOpen:n,onToolResultOpen:r,summaryOnly:o=!1,forceExpanded:s=!1,detailsVisible:i=!0,hideHeader:l=!1,hideCollapsedOutput:c=!1}){let{t:d}=tt(),f=Ma(),p=kb(),m=pq(),{hostOwnsEditDiffPreview:g}=Ao(),h=m!==void 0,b=G0(e.rawOutput),v=s||!!b,w=t?.toolCallId===e.callId,k=!!(g&&w&&t?.hasDiffPreview&&Xy(t?.toolName??e.toolName)),_=k,[T,L]=(0,y.useState)(!1),[S,I]=(0,y.useState)(()=>v||!o&&wF(e)&&!_),R=(0,y.useRef)(null),E=(0,y.useRef)(!1),N=c9(e.toolName);(0,y.useEffect)(()=>{I(v||!o&&wF(e)&&!_),L(!1),R.current=null,E.current=!1},[v,_,h,o,e.callId,e.toolName]);let O=tr(e),$=!w&&t?.toolCallId&&O&&Ls(e,t.toolCallId),B=!!(k||g&&$&&t?.hasDiffPreview&&Xy(t.toolName??"")),V=Cn(e.status),G=V&&!_s(e.toolName)&&!q6(e.toolName)&&!B,J=Cb(G);if((0,y.useEffect)(()=>{!v&&!O&&e.status==="completed"&&!E.current&&I(!1)},[v,O,e.status]),O){let X=TU(e,J),de=X.explicitAgentType?`${d("agent.label")} (${J0(X.explicitAgentType,d)})`:d("agent.label"),ye=e.status==="completed"||e.status==="failed",qe=Is(e),Qe=[qe&&!ye?d("subagent.background"):e.status==="pending"?d("subagent.pending"):d("subagent.running"),qe&&!ye||B?"":X.elapsed].filter(Boolean).join(" \xB7 "),vt=[X.subToolCount>0?d("subagent.toolsCount",{count:X.subToolCount}):"",X.elapsed,X.tokens,X.reason?ln(X.reason,80):""].filter(Boolean).join(" \xB7 "),zt=s||S||!!$,nt=!!w,Ve=li(e),Ct=(0,u.jsx)(w9,{tool:e,approval:g?t:void 0,hideHeader:!0,defaultExpanded:!0,inline:!0});if(p&&!l){let We=(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(z6,{}),(0,u.jsx)(Mp,{status:ye?X.status:e.status}),(0,u.jsx)("span",{className:pe.lineName,children:de}),(0,u.jsx)(P0,{info:{kind:"agent",tool:e,displayName:de,description:X.description?ln(X.description,60):"",elapsed:ye?vt:Qe,workspaceCwd:a}})]});return(0,u.jsx)("div",{className:pe.line,"data-transcript-tool-call-id":e.callId,children:nt?(0,u.jsx)("div",{className:`${pe.lineMain} ${pe.lineButton}`,"aria-disabled":"true",children:We}):(0,u.jsxs)("button",{type:"button",className:`${pe.lineMain} ${pe.lineExpandable} ${pe.lineButton}`,"aria-disabled":!!Ve||void 0,title:Ve?d(Ve):void 0,onClick:()=>{Ve||p.onOpen(e)},children:[We,(0,u.jsx)("span",{className:pe.lineChevronRight,"aria-hidden":"true"})]})})}return(0,u.jsxs)("div",{className:pe.line,"data-transcript-tool-call-id":e.callId,children:[!l&&(0,u.jsxs)("div",{className:`${pe.lineMain} ${nt?"":pe.lineExpandable}`,"aria-disabled":!!Ve||void 0,title:Ve?d(Ve):void 0,onClick:nt||Ve?void 0:()=>I(!S),children:[(0,u.jsx)(z6,{}),(0,u.jsx)(Mp,{status:ye?X.status:e.status}),(0,u.jsx)("span",{className:pe.lineName,children:de}),(0,u.jsx)(P0,{info:{kind:"agent",tool:e,displayName:de,description:X.description?ln(X.description,60):"",elapsed:ye?vt:Qe,workspaceCwd:a}}),!nt&&(0,u.jsx)("span",{className:S?pe.lineChevronDown:pe.lineChevronRight,"aria-hidden":"true"})]}),zt&&(0,u.jsx)("div",{className:pe.lineDetail,children:l?(0,u.jsx)("div",{className:pe.expandedAgentCard,children:Ct}):Ct})]})}let Z=rb(e,a),Q=ape(e),A=_s(e.toolName)?Nz(e,a):Z,j=Nc(e.toolName,d),K=B||_s(e.toolName)||q6(e.toolName)?"":Op(e.startTime,V?J:e.endTime),P=e.toolName.toLowerCase(),ae=P==="monitor"&&h&&!T&&!l,se=hd(P),Ee=se?Xz(e):void 0,q=!!Ee&&Ee.length>0,oe=Ee?Ee.filter(X=>X.status==="completed").length:0,ie=_s(P),ee=P==="grep"||P==="grep_search"||P==="search"||P==="glob",he=P==="read"||P==="read_file"||P==="readfile",ke=i9(P),Me=i&&(he||Xy(P)||P==="display_image"||P==="zoom_image")?(0,u.jsx)(W6e,{tool:e,workspaceCwd:a,onOpen:n}):void 0,ge=!se&&m9e(A),W=!v&&!_,xe=ae||W,_e=()=>{E.current=!0,I(X=>!X)},Ye=()=>{L(!0),W&&_e()},it=()=>{m&&CU(R,()=>m.onOpen(e),Ye)},Bt=X6e(e),na=S&&ge,ue=he||ke,Ke=na&&!ie&&!ee&&!he,fe=Z,Pe=S&&!Bt&&(!se||!q&&!Q);return(0,u.jsxs)("div",{className:pe.line,"data-transcript-tool-call-id":e.callId,children:[l&&V&&K&&(0,u.jsx)("div",{className:pe.lineMain,children:(0,u.jsx)(P0,{info:{kind:mb(e),tool:e,displayName:j,description:"",elapsed:K,workspaceCwd:a}})}),!l&&(0,u.jsxs)("div",{className:`${pe.lineMain} ${xe?pe.lineExpandable:""}`,title:ae?void 0:W?d(S?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":ae?void 0:W?S:void 0,role:xe?"button":void 0,tabIndex:xe?0:void 0,onClick:xe?()=>{if(ae){it();return}_e()}:void 0,onKeyDown:xe?X=>{if(!(X.key!=="Enter"&&X.key!==" ")){if(X.preventDefault(),ae){it();return}_e()}}:void 0,children:[(0,u.jsx)(EU,{tool:e}),(0,u.jsx)(Mp,{status:e.status}),(0,u.jsx)("span",{className:pe.lineName,children:j}),se&&q&&(0,u.jsxs)("span",{className:pe.todoProgress,children:[oe,"/",Ee.length]}),(0,u.jsx)(P0,{info:{kind:mb(e),tool:e,displayName:j,description:se||Ke?"":A,elapsed:se?"":K,workspaceCwd:a}}),xe&&(0,u.jsx)("span",{className:!ae&&S?pe.lineChevronDown:pe.lineChevronRight,"aria-hidden":"true"})]}),b&&(!o||S)&&(0,u.jsx)(F6e,{display:b}),!b&&(!o||S)&&se&&q&&(0,u.jsx)(i9e,{tool:e,todos:Ee,expanded:S,title:j}),!b&&(!o||S)&&se&&!q&&Q&&(0,u.jsx)("div",{className:pe.lineOutput,children:WC(Q,f)}),!b&&Pe&&(0,u.jsx)(F0,{title:j,detail:fe,status:e.status,action:Me,children:Q&&(0,u.jsx)("div",{className:`${pe.lineOutput} ${pe.expandedLineOutput}`,children:WC(Q,f)})}),!b&&!se&&!c&&Q&&!Pe&&(!S||!Bt)&&(!o||S)&&(0,u.jsx)("div",{className:S?`${pe.lineOutput} ${pe.expandedLineOutput}`:pe.lineOutput,children:WC(Q,f)}),!b&&!se&&S&&Bt&&(!N||i)&&(0,u.jsx)("div",{className:N?`${pe.lineDetail} ${pe.workflowLineDetail}`:ue?`${pe.lineDetail} ${pe.markdownLineDetail}`:pe.lineDetail,children:N?(0,u.jsx)(l9e,{tool:e,displayName:j,detail:fe,result:Q}):ie?(0,u.jsx)(nxe,{tool:e}):he?(0,u.jsx)(F0,{title:j,status:e.status,action:Me,children:(0,u.jsx)(a9e,{tool:e})}):(0,u.jsxs)(F0,{title:j,detail:fe,status:e.status,action:Me,children:[(P==="write_file"||P==="writefile")&&(0,u.jsx)(vF,{tool:e}),(P==="edit"||P==="write"||P==="editfile")&&(0,u.jsx)(vF,{tool:e}),Lo(e.toolName)&&(0,u.jsx)(u9e,{tool:e}),u9(P)&&(0,u.jsx)(d9e,{tool:e}),ke&&(0,u.jsx)(ci,{content:Pz(e)??""})]})}),e.toolResult&&(0,u.jsx)(V6e,{result:e.toolResult,onOpen:r})]})},C9e),_9e=(0,y.memo)(function({isStreaming:e,expanded:t,documentMode:a,translateContent:n,generateContent:r,onToggle:o}){let{language:s,t:i}=tt();return(0,u.jsxs)("div",{className:`${pe.chatSummaryThoughtHeader}${t?` ${pe.chatSummaryThoughtHeaderExpanded}`:""}`,onClick:l=>{!a&&l.currentTarget.contains(l.target)&&o()},children:[(0,u.jsxs)("button",{type:"button",disabled:a,tabIndex:a?-1:void 0,className:pe.chatSummaryThoughtSummary,"data-testid":"compact-thinking-summary","aria-expanded":a?void 0:t,title:a?void 0:i(t?"thinking.collapse":"thinking.expand"),children:[(0,u.jsx)("span",{className:pe.chatSummaryThoughtIcon,"aria-hidden":"true",children:(0,u.jsx)(h9,{})}),(0,u.jsx)("span",{className:`${pe.chatSummaryThoughtLabel}${e?` ${pe.chatSummaryThoughtLabelActive}`:""}`,children:i(e?"thinking.running":"thinking.done")})]}),s==="zh-CN"&&n!==void 0&&r&&(0,u.jsx)(zz,{content:n,generateContent:r,className:pe.chatSummaryThoughtTranslate}),(0,u.jsx)("span",{className:t?pe.chatSummaryThoughtChevronDown:pe.chatSummaryThoughtChevronRight,"aria-hidden":"true"})]})}),GC=(0,y.memo)(function({content:e,isStreaming:t,generateContent:a}){let n=Ma()==="document",r=vb(),[o,s]=(0,y.useState)(!1),i=n?r:o,l=(0,y.useCallback)(()=>{n||s(c=>!c)},[n]);return(0,u.jsxs)("div",{className:pe.chatSummaryThought,children:[(0,u.jsx)(_9e,{isStreaming:t,expanded:i,documentMode:n,translateContent:n||t?void 0:e,generateContent:a,onToggle:l}),i&&(0,u.jsx)("div",{className:pe.chatSummaryThoughtContent,children:(0,u.jsx)(ci,{content:e,source:"thinking",isStreaming:t})})]})}),I9e=(0,y.memo)(function({tools:e,compactSummary:t=!1,thoughts:a,pendingApproval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,isLocateFlashing:i=!1,generateContent:l}){let{t:c}=tt(),d=Ma()==="document",f=vb(),p=kb(),m=pq(),g=m!==void 0,[h,b]=(0,y.useState)(!1),[v,w]=(0,y.useState)(!1),k=d?f:v,_=(0,y.useRef)(null),T=Z6(e),L=e.find(q=>Cn(q.status)&&!Is(q))??(e.length>0?h9e(e):void 0),S=e.length===1?e[0]:void 0,I=!!a?.length,R=S&&tr(S)?S:void 0,E=S&&S.toolName.toLowerCase()==="monitor"?S:void 0,N=(S?G0(S.rawOutput):void 0)?.resourceUri,O=e.some(q=>G0(q.rawOutput)),$=e.some(q=>c9(q.toolName)),B=e.some(q=>Cn(q.status)&&!Is(q)),V=a?.find(q=>q.isStreaming),G=T&&B?!0:V!==void 0,J=!G&&e.some(q=>Cn(q.status)&&Is(q)),Z=!!(!t&&R&&p),Q=!!(!t&&E&&g&&!h),A=Z||Q,j=!t&&R?li(R):void 0,K=T?L??e[0]:e[0],P=n?.toolCallId&&e.some(q=>Ls(q,n.toolCallId)),ae=new Map,se=new Set;for(let q=0;t&&q<e.length;q++){if(!tr(e[q]))continue;let oe=q+1;for(;oe<e.length&&tr(e[oe]);)oe++;if(oe-q>=2){let ie=e.slice(q,oe);ae.set(ie[0].callId,ie);for(let ee of ie.slice(1))se.add(ee.callId)}q=oe-1}(0,y.useEffect)(()=>{b(!1),w(!1),_.current=null},[g,E?.callId]),(0,y.useEffect)(()=>{(N||O)&&w(!0)},[N,O]);let Ee=()=>{!E||!m||CU(_,()=>m.onOpen(E),()=>{b(!0),w(q=>!q)})};return P?(0,u.jsx)("div",{className:`${pe.group}${i?` ${pl.flash}`:""}`,children:e.map(q=>(0,u.jsx)(U6,{tool:q,approval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,forceExpanded:d},q.callId))}):(0,u.jsxs)("div",{className:i?pl.flash:void 0,children:[(0,u.jsxs)("button",{type:"button",disabled:d,"aria-disabled":!!j||void 0,tabIndex:d?-1:void 0,className:pe.chatSummary,onClick:()=>{if(!(d||j)){if(Z&&R&&p){p.onOpen(R);return}if(Q&&E&&m){Ee();return}w(q=>!q)}},"aria-expanded":d||A?void 0:v,title:j?c(j):d||A?void 0:c(k?"tool.collapseHint":"tool.expand"),children:[(0,u.jsx)("span",{className:J?`${pe.chatSummaryIcon} ${pe.chatSummaryIconDetached}`:pe.chatSummaryIcon,"aria-hidden":"true",children:V?(0,u.jsx)(h9,{}):K?(0,u.jsx)(EU,{tool:K}):(0,u.jsx)(AU,{})}),(0,u.jsx)("span",{className:G?`${pe.chatSummaryText} ${pe.chatSummaryTextActive}`:pe.chatSummaryText,children:V?c("thinking.running"):S?(0,u.jsx)(v9e,{tool:S,workspaceCwd:r}):g9e(e,c,r,t)}),(0,u.jsx)("span",{className:k?pe.chatChevronDown:pe.chatChevronRight,"aria-hidden":"true"})]}),(k||O||$)&&(0,u.jsx)("div",{"aria-hidden":!k,ref:q=>{q?.toggleAttribute("inert",!k)},className:k?pe.chatSummaryContentClip:`${pe.chatSummaryContentClip} ${pe.chatSummaryContentCollapsed}`,style:!k&&O&&!$?{display:"none"}:void 0,children:(0,u.jsx)("div",{className:pe.chatSummaryContentInner,children:(0,u.jsxs)("div",{className:`${pe.group} ${pe.chatSummaryGroup}`,children:[e.map(q=>{if(se.has(q.callId))return null;let oe=ae.get(q.callId);return(0,u.jsxs)(y.Fragment,{children:[a?.filter(ie=>ie.beforeToolCallId===q.callId).map((ie,ee)=>(0,u.jsx)(GC,{content:ie.content,isStreaming:ie.isStreaming,generateContent:l},`thought-${q.callId}-${ee}`)),oe?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{className:pe.chatSummaryParallelAgents,"data-testid":"compact-parallel-agents",children:(0,u.jsx)(dq,{agents:oe,pendingApproval:n})}),oe.slice(1).flatMap(ie=>a?.filter(ee=>ee.beforeToolCallId===ie.callId).map((ee,he)=>(0,u.jsx)(GC,{content:ee.content,isStreaming:ee.isStreaming,generateContent:l},`thought-${ie.callId}-${he}`)))]}):(0,u.jsx)(U6,{tool:q,approval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,summaryOnly:!S||I,forceExpanded:d||!!S&&!I,detailsVisible:k,hideHeader:!!S&&!I})]},q.callId)}),a?.filter(q=>q.beforeToolCallId===void 0).map((q,oe)=>(0,u.jsx)(GC,{content:q.content,isStreaming:q.isStreaming,generateContent:l},`thought-trailing-${oe}`))]})})})]})}),G9="summary-",z0=e=>`${G9}${e}`,RU=e=>e.startsWith(G9),hb=e=>RU(e)?e.slice(G9.length):void 0,L9e="_message_1ujhf_1",A9e="_header_1ujhf_6",E9e="_headerStatic_1ujhf_7",R9e="_chevron_1ujhf_24",M9e="_title_1ujhf_30",N9e="_progress_1ujhf_39",Ic={message:L9e,header:A9e,headerStatic:E9e,chevron:R9e,title:M9e,progress:N9e};function P9e({id:e,todos:t}){let a=(0,y.useContext)(K6).get(e)?.events??[];return(0,u.jsx)(mq,{todos:t,events:a})}var O9e=(0,y.memo)(function({id:e,todos:t,isLocateFlashing:a=!1}){let{t:n}=tt(),r=Ma()==="document",o=vb(),[s,i]=(0,y.useState)(!1);if(t.length===0)return null;let l=r?o:s,c=t.length,d=t.filter(f=>f.status==="completed").length;return(0,u.jsxs)("div",{className:`${Ic.message}${a?` ${pl.flash}`:""}`,children:[r?(0,u.jsxs)("div",{className:Ic.headerStatic,children:[(0,u.jsx)("span",{className:Ic.title,children:n("plan.title")}),(0,u.jsxs)("span",{className:Ic.progress,children:[d,"/",c]})]}):(0,u.jsxs)("button",{type:"button",className:Ic.header,onClick:()=>i(f=>!f),"aria-expanded":s,title:n(s?"todo.collapse":"todo.expand"),children:[(0,u.jsx)("span",{className:Ic.chevron,"aria-hidden":"true",children:s?"\u25BE":"\u25B8"}),(0,u.jsx)("span",{className:Ic.title,children:n("plan.title")}),(0,u.jsxs)("span",{className:Ic.progress,children:[d,"/",c]})]}),l?(0,u.jsx)(hq,{todos:t,numbered:!0}):(0,u.jsx)(P9e,{id:e,todos:t})]})}),D9e="_message_1abcu_1",$9e="_content_1abcu_11",B9e="_question_1abcu_17",F9e="_prefix_1abcu_24",z9e="_answer_1abcu_28",q9e="_pending_1abcu_32",U9e="_shortcuts_1abcu_36",ad={message:D9e,content:$9e,question:B9e,prefix:F9e,answer:z9e,pending:q9e,shortcuts:U9e},j9e=(0,y.memo)(function({question:e,answer:t,isPending:a}){let{t:n}=tt();return(0,u.jsxs)("div",{className:ad.message,children:[(0,u.jsxs)("div",{className:ad.content,children:[(0,u.jsxs)("div",{className:ad.question,children:[(0,u.jsx)("span",{className:ad.prefix,children:"/btw "}),(0,u.jsx)("span",{children:e})]}),(0,u.jsx)("div",{className:ad.answer,children:a?(0,u.jsx)("span",{className:ad.pending,children:n("btw.answering")}):(0,u.jsx)(ci,{content:t})})]}),(0,u.jsx)("div",{className:ad.shortcuts,children:n(a?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),H9e="_message_1g0wi_1",W9e="_header_1g0wi_21",G9e="_status_1g0wi_30",V9e="_name_1g0wi_35",X9e="_command_1g0wi_42",K9e="_output_1g0wi_51",Cp={message:H9e,header:W9e,status:G9e,name:V9e,command:X9e,output:K9e},Z9e=(0,y.memo)(function({command:e,output:t}){let{t:a}=tt();return(0,u.jsxs)("div",{className:Cp.message,children:[(0,u.jsxs)("div",{className:Cp.header,children:[(0,u.jsx)("span",{className:Cp.status,children:"\u2713"}),(0,u.jsx)("span",{className:Cp.name,children:a("shell.command")}),e&&(0,u.jsx)("span",{className:Cp.command,children:e})]}),t&&(0,u.jsx)("pre",{className:Cp.output,children:t})]})}),Q9e="_progress_1ik59_1",Y9e="_spinner_1ik59_12",J9e="_bar_1ik59_19",e7e="_stage_1ik59_25",t7e="_icon_1ik59_29",a7e="_done_1ik59_35",n7e="_error_1ik59_43",r7e="_detail_1ik59_51",o7e="_path_1ik59_56",s7e="_pathButton_1ik59_61",On={progress:Q9e,spinner:Y9e,bar:J9e,stage:e7e,icon:t7e,done:a7e,error:n7e,detail:r7e,path:o7e,pathButton:s7e},bF=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827"];function i7e({progress:e}){let{stage:t,progress:a,detail:n,isComplete:r,error:o}=e,[s,i]=(0,y.useState)(0),l=30,c=Math.round(a/100*l),d=l-c,f="\u2588".repeat(Math.max(0,c))+"\u2591".repeat(Math.max(0,d));return(0,y.useEffect)(()=>{if(r||o)return;let p=setInterval(()=>{i(m=>(m+1)%bF.length)},120);return()=>clearInterval(p)},[r,o]),o?(0,u.jsxs)("div",{className:`${On.progress} ${On.error}`,children:[(0,u.jsx)("span",{className:On.icon,children:"\u2715"}),(0,u.jsx)("span",{className:On.stage,children:t}),(0,u.jsx)("div",{className:On.detail,children:o})]}):r?(0,u.jsxs)("div",{className:`${On.progress} ${On.done}`,children:[(0,u.jsx)("span",{className:On.icon,children:"\u2713"}),(0,u.jsx)("span",{className:On.stage,children:t})]}):(0,u.jsxs)("div",{className:On.progress,children:[(0,u.jsx)("span",{className:On.spinner,children:bF[s]}),(0,u.jsx)("span",{className:On.bar,children:f}),(0,u.jsxs)("span",{className:On.stage,children:[t,n?` (${n})`:""]})]})}function l7e({path:e,onInsightReportOpen:t}){let{t:a}=tt();return(0,u.jsxs)("div",{className:`${On.progress} ${On.done}`,children:[(0,u.jsx)("span",{className:On.icon,children:"\u2713"}),(0,u.jsx)("span",{className:On.stage,children:a("insight.ready")}),t?(0,u.jsx)("button",{type:"button",className:`${On.path} ${On.pathButton}`,onClick:()=>t(e),children:e}):(0,u.jsx)("span",{className:On.path,children:e})]})}var c7e=(0,y.createContext)(void 0);function u7e(e,t){return e!=="background_notification"&&e!=="mid_turn_message_injected"&&e!=="goal_runtime"&&e!=="goal_control"&&(e!=="cron"||t.trim().length>0)}function d7e(){return(0,y.useContext)(c7e)}var f7e=(0,y.memo)(function({message:e,pendingApproval:t,onShowContextDetail:a,onLocateBackgroundSource:n,onImagePreview:r,onAttachmentPreview:o,onTurnOutputOpen:s,onToolResultOpen:i,onInsightReportOpen:l,workspaceCwd:c,showRetryHint:d=!1,onRetryClick:f,sendFailed:p=!1,onRetrySend:m,onEditUserMessage:g,onSubmitUserMessageEdit:h,onBranchSession:b,branchRecordId:v,showAssistantActions:w=!1,showAssistantBranch:k=!1,assistantFeedbackTurnId:_,assistantFeedbackPromptId:T,assistantFeedbackRating:L,onAssistantFeedbackRate:S,isLocateFlashing:I=!1,assistantTurnFooterInfo:R,turnSources:E,onSourceOpen:N,generateContent:O}){let{t:$}=tt(),[B,V]=(0,y.useState)(!1),[G,J]=(0,y.useState)(!1),Z=(0,y.useCallback)(()=>{g?.()!==!0&&V(!0)},[g]),Q=(0,y.useCallback)(()=>{V(!1)},[]),A=(0,y.useCallback)(ke=>{h&&(J(!0),Promise.resolve(h(ke)).catch(()=>!1).then(Me=>{J(!1),Me!==!1&&V(!1)}))},[h]),j=(0,y.useMemo)(()=>b&&v?()=>b(v):void 0,[b,v]),K=(0,y.useMemo)(()=>S&&T?ke=>S(T,_??"",ke):void 0,[S,T,_]),P=(0,y.useContext)(X6),ae=e.role==="tool_group"&&e.tools.length===1&&l9(e.tools[0])?e.tools[0]:void 0,se=ae?epe(ae):null,Ee=!!se||e.role==="user"||e.role==="system"&&e.source==="mid_turn_message_injected",q=d7e(),oe=(()=>{switch(e.role){case"user":return(0,u.jsx)(Ez,{content:e.content,images:e.images,files:e.files,inputAnnotations:e.inputAnnotations,isLocateFlashing:I,sendFailed:p,onRetrySend:m,editing:B,submittingEdit:G,onEditSubmit:A,onEditCancel:Q,onImagePreview:r,onAttachmentPreview:o,author:e.author});case"assistant":return(0,u.jsx)(wme,{content:e.content,author:e.author,agentMessage:e.agentMessage,isStreaming:e.isStreaming,timestamp:e.timestamp,onBranchSession:j,showFooterActions:w,showBranchAction:k,showAssistantFeedback:T!==void 0,assistantFeedbackRating:L,onAssistantFeedbackRate:K,isLocateFlashing:I,customFooterInfo:R,turnSources:E,onSourceOpen:N});case"thinking":return(0,u.jsx)(Cme,{content:e.content,author:e.author,isStreaming:e.isStreaming,timestamp:e.timestamp,isLocateFlashing:I,generateContent:O});case"tool_group":return ae&&!se&&!md(ae)?.trim()?null:se&&ae?!se.answers.length&&!se.text.trim()?null:(0,u.jsx)(Qfe,{tool:ae,result:se,isLocateFlashing:I}):(0,u.jsx)(I9e,{tools:e.tools,onTurnOutputOpen:s,onToolResultOpen:i,thoughts:e.thoughts,compactSummary:P&&RU(e.id),pendingApproval:t,workspaceCwd:c,isLocateFlashing:I,generateContent:O});case"plan":return(0,u.jsx)(O9e,{id:e.id,todos:e.todos,isLocateFlashing:I});case"system":return(0,u.jsx)(_be,{content:e.content,variant:e.variant,source:e.source,data:e.data,images:e.images,files:e.files,onShowContextDetail:a,onLocateBackgroundSource:n,onImagePreview:r,onAttachmentPreview:o,showRetryHint:d&&e.retryable===!0,onRetryClick:f});case"user_shell":return(0,u.jsx)(Z9e,{command:e.command,output:e.output});case"btw":return(0,u.jsx)(j9e,{question:e.question,answer:e.answer,isPending:e.isPending});case"insight_progress":return(0,u.jsx)(i7e,{progress:{stage:e.stage,progress:e.progress,detail:e.detail}});case"insight_ready":return(0,u.jsx)(l7e,{path:e.path,onInsightReportOpen:l});case"insight_error":return(0,u.jsx)("div",{style:{color:"var(--error-color, #e06c75)"},children:e.error});default:return null}})();if(oe===null)return null;let ie=(0,u.jsx)(cd,{label:`message:${e.role}`,resetKeys:[e],fallback:(0,u.jsx)(p7e,{align:Ee?"end":"start"}),children:oe}),ee=(0,u.jsx)("div",{"data-user-selectable":"true",style:{display:"contents"},children:ie});if(e.role==="assistant")return w?ee:(0,u.jsx)(n6,{timestamp:e.timestamp,children:ee});if(e.role==="system"&&e.source==="prompt_cancelled")return ee;let he=q&&e.role==="user"&&u7e(e.source,e.content)?e.id:void 0;return(0,u.jsx)(n6,{timestamp:e.timestamp,hideTimestamp:e.role==="system"&&(e.source==="background_task_completed"||e.source==="background_notification_turn_started"),chatMode:Ee,toolGroupSpacing:e.role==="tool_group"&&P,copyText:Ee&&"content"in e?e.content:void 0,copyTitle:$("common.copy"),onEdit:g&&!B?Z:void 0,editTitle:$("userMessage.edit"),onOpenTurnCalls:q&&he?()=>q(he):void 0,turnCallsTitle:$("turnCalls.open"),children:ee})},m7e);function p7e({align:e}){let{t}=tt();return(0,u.jsx)("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:(0,u.jsx)("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function m7e(e,t){return e.pendingApproval?.id!==t.pendingApproval?.id||e.onShowContextDetail!==t.onShowContextDetail||e.onLocateBackgroundSource!==t.onLocateBackgroundSource||e.onImagePreview!==t.onImagePreview||e.onAttachmentPreview!==t.onAttachmentPreview||e.onTurnOutputOpen!==t.onTurnOutputOpen||e.onToolResultOpen!==t.onToolResultOpen||e.workspaceCwd!==t.workspaceCwd||e.showRetryHint!==t.showRetryHint||e.onRetryClick!==t.onRetryClick||e.sendFailed!==t.sendFailed||e.onRetrySend!==t.onRetrySend||e.onEditUserMessage!==t.onEditUserMessage||e.onSubmitUserMessageEdit!==t.onSubmitUserMessageEdit||e.onInsightReportOpen!==t.onInsightReportOpen||e.onBranchSession!==t.onBranchSession||e.branchRecordId!==t.branchRecordId||e.showAssistantActions!==t.showAssistantActions||e.showAssistantBranch!==t.showAssistantBranch||e.assistantFeedbackTurnId!==t.assistantFeedbackTurnId||e.assistantFeedbackPromptId!==t.assistantFeedbackPromptId||e.assistantFeedbackRating!==t.assistantFeedbackRating||e.onAssistantFeedbackRate!==t.onAssistantFeedbackRate||e.isLocateFlashing!==t.isLocateFlashing||e.generateContent!==t.generateContent||e.turnSources!==t.turnSources||e.onSourceOpen!==t.onSourceOpen||!h7e(e.assistantTurnFooterInfo,t.assistantTurnFooterInfo)?!1:v7e(e.message,t.message)}function h7e(e,t){return e===t?!0:!e||!t?!1:e.turnId===t.turnId&&e.message.id===t.message.id&&e.message.content===t.message.content&&e.message.isStreaming===t.message.isStreaming&&e.message.timestamp===t.message.timestamp}function g7e(e,t){return e===t?!0:!e||!t?!1:e.status===t.status&&e.error===t.error&&e.totalTokens===t.totalTokens&&e.squadOutcome===t.squadOutcome&&e.author?.squadName===t.author?.squadName&&e.author?.memberSquadName===t.author?.memberSquadName&&(e.steps??[]).length===(t.steps??[]).length&&(e.steps??[]).every((a,n)=>a.title===t.steps?.[n]?.title&&a.status===t.steps?.[n]?.status)}function v7e(e,t){if(e===t)return!0;if(e.id!==t.id||e.role!==t.role||e.timestamp!==t.timestamp||e.author?.name!==t.author?.name||e.author?.color!==t.author?.color)return!1;switch(e.role){case"user":return t.role==="user"&&e.content===t.content&&e.source===t.source&&xF(e.images,t.images);case"assistant":return t.role==="assistant"&&e.content===t.content&&e.isStreaming===t.isStreaming&&g7e(e.agentMessage,t.agentMessage);case"thinking":return t.role==="thinking"&&e.content===t.content&&e.isStreaming===t.isStreaming;case"system":return t.role==="system"&&e.content===t.content&&e.variant===t.variant&&e.retryable===t.retryable&&e.source===t.source&&e.data===t.data&&xF(e.images,t.images);case"user_shell":return t.role==="user_shell"&&e.command===t.command&&e.output===t.output&&e.cwd===t.cwd;case"btw":return t.role==="btw"&&e.question===t.question&&e.answer===t.answer&&e.isPending===t.isPending;case"insight_progress":return t.role==="insight_progress"&&e.stage===t.stage&&e.progress===t.progress&&e.detail===t.detail;case"insight_ready":return t.role==="insight_ready"&&e.path===t.path;case"insight_error":return t.role==="insight_error"&&e.error===t.error;case"plan":return t.role==="plan"&&w7e(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&y7e(e.thoughts,t.thoughts)&&e.tools.length===t.tools.length&&e.tools.every((a,n)=>MU(a,t.tools[n]));default:return!1}}function w7e(e,t){return e.length===t.length&&e.every((a,n)=>{let r=t[n];return r&&a.id===r.id&&a.content===r.content&&a.status===r.status&&a.priority===r.priority})}function MU(e,t){return t?e.callId===t.callId&&e.toolName===t.toolName&&e.status===t.status&&e.subagentSessionReady===t.subagentSessionReady&&e.title===t.title&&e.kind===t.kind&&e.startTime===t.startTime&&e.endTime===t.endTime&&e.subContent===t.subContent&&ii(e.args)===ii(t.args)&&ii(e.rawOutput)===ii(t.rawOutput)&&ii(e.toolResult)===ii(t.toolResult)&&e.wasCancelled===t.wasCancelled&&ii(e.locations)===ii(t.locations)&&ii(e.content)===ii(t.content)&&b7e(e.subTools,t.subTools):!1}function y7e(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((a,n)=>a.content===t[n]?.content&&a.isStreaming===t[n]?.isStreaming&&a.beforeToolCallId===t[n]?.beforeToolCallId)}function b7e(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((a,n)=>MU(a,t[n]))}var kF=new WeakMap;function xF(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((a,n)=>a.data===t[n].data&&a.mimeType===t[n].mimeType)}function ii(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=kF.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return kF.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}function SF({additions:e,deletions:t,className:a,additionsClassName:n,deletionsClassName:r}){return e===void 0||t===void 0?null:(0,u.jsxs)("span",{className:a,children:[(0,u.jsxs)("span",{className:n,children:["+",e]}),(0,u.jsxs)("span",{className:r,children:["-",t]})]})}function k7e(e){if(!e.some(t=>t.additions===void 0||t.deletions===void 0))return e.reduce((t,a)=>({additions:t.additions+(a.additions??0),deletions:t.deletions+(a.deletions??0)}),{additions:0,deletions:0})}var x7e="_root_numdi_1",S7e="_card_numdi_7",C7e="_summary_numdi_14",T7e="_icon_numdi_22",_7e="_iconSvg_numdi_33",I7e="_title_numdi_39",L7e="_artifactTitle_numdi_46",A7e="_reviewSummary_numdi_52",E7e="_reviewSummaryWithStats_numdi_59",R7e="_reviewMeta_numdi_64",M7e="_linkButton_numdi_71",N7e="_reviewButton_numdi_72",P7e="_showMoreButton_numdi_73",O7e="_actions_numdi_102",D7e="_openButtonWrapper_numdi_108",$7e="_list_numdi_132",B7e="_fileRow_numdi_139",F7e="_path_numdi_159",z7e="_lineStats_numdi_168",q7e="_additions_numdi_177",U7e="_deletions_numdi_181",j7e="_chevronIcon_numdi_195",H7e="_chevronIconOpen_numdi_203",W7e="_artifactInfo_numdi_207",G7e="_artifactMeta_numdi_212",xt={root:x7e,card:S7e,summary:C7e,icon:T7e,iconSvg:_7e,title:I7e,artifactTitle:L7e,reviewSummary:A7e,reviewSummaryWithStats:E7e,reviewMeta:R7e,linkButton:M7e,reviewButton:N7e,showMoreButton:P7e,actions:O7e,openButtonWrapper:D7e,list:$7e,fileRow:B7e,path:F7e,lineStats:z7e,additions:q7e,deletions:U7e,chevronIcon:j7e,chevronIconOpen:H7e,artifactInfo:W7e,artifactMeta:G7e},j6=3;function CF(e,t){return t?e:e.slice(0,j6)}function V7e({turnId:e,changes:t,artifacts:a,sourceSessionId:n,scheduledTasks:r,workspaceCwd:o,onOpenRequest:s,onReviewChanges:i,onOpenArtifact:l,onOpenScheduledTask:c,onError:d}){let{t:f}=tt(),{filterArtifact:p}=Ao(),m=p?a.filter(O=>p(O,{turnId:e,sourceSessionId:n})):a,g=SU(o),h=g?.actions,[b,v]=(0,y.useState)(!1),[w,k]=(0,y.useState)(!1);if(t.length===0&&m.length===0&&r.length===0)return null;let _=CF(t,b),T=t.length-j6,L=CF(m,w),S=m.length-j6,I=k7e(t),R=O=>{if(s){s({id:"review",kind:"review",title:f("turnOutputs.review"),turnId:e,changes:t,...o?{workspaceCwd:o}:{},...g?.workspaceId?{workspaceId:g.workspaceId}:{},...O?{selectedPath:O}:{}});return}i(t,O)},E=O=>{let $=Y7e(O,t,o);if(s){s({id:`artifact:${O.id}`,kind:"artifact",title:tz(O),turnId:e,artifactId:O.id,...O.managedId?{managedId:O.managedId}:{},artifact:O,...o?{workspaceCwd:o}:{},...g?.workspaceId?{workspaceId:g.workspaceId}:{},...$!==void 0?{previewContent:$}:{}});return}l(O.id,$)},N=O=>{if(s){s({id:`scheduled-task:${O.toolCallId}`,kind:"scheduled_task",title:f("scheduledTasks.title"),turnId:e,task:g?.workspaceId?{...O,workspaceId:g.workspaceId}:O,...o?{workspaceCwd:o}:{},...g?.workspaceId?{workspaceId:g.workspaceId}:{}});return}c(O)};return(0,u.jsxs)("div",{className:xt.root,children:[t.length>0&&(0,u.jsxs)("div",{className:xt.card,children:[(0,u.jsxs)("div",{className:xt.summary,children:[(0,u.jsx)("span",{className:xt.icon,"aria-hidden":"true",children:(0,u.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",focusable:"false",className:xt.iconSvg,children:[(0,u.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),(0,u.jsx)("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,u.jsx)("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),(0,u.jsxs)("div",{className:[xt.reviewSummary,I?xt.reviewSummaryWithStats:""].filter(Boolean).join(" "),children:[(0,u.jsx)("div",{className:xt.title,children:f("turnOutputs.filesEdited",{count:t.length})}),(0,u.jsxs)("div",{className:xt.reviewMeta,children:[(0,u.jsx)(SF,{additions:I?.additions,deletions:I?.deletions,className:xt.lineStats,additionsClassName:xt.additions,deletionsClassName:xt.deletions}),(0,u.jsxs)("button",{type:"button",className:xt.linkButton,onClick:()=>R(),children:[f("turnOutputs.viewChanges")," \u2197"]})]})]}),(0,u.jsx)("div",{className:xt.actions,children:(0,u.jsx)("button",{type:"button",className:xt.reviewButton,onClick:()=>R(),children:f("turnOutputs.review")})})]}),(0,u.jsxs)("div",{className:xt.list,children:[_.map(O=>(0,u.jsxs)("button",{type:"button",className:xt.fileRow,onClick:()=>R(O.path),title:O.path,children:[(0,u.jsx)("span",{className:xt.path,children:o8e(O.path,o)}),(0,u.jsx)(SF,{additions:O.additions,deletions:O.deletions,className:xt.lineStats,additionsClassName:xt.additions,deletionsClassName:xt.deletions})]},`${O.toolCallId}:${O.path}`)),T>0&&(0,u.jsxs)("button",{type:"button",className:xt.showMoreButton,onClick:()=>v(O=>!O),children:[(0,u.jsx)("span",{children:b?f("turnOutputs.collapseFiles"):f("turnOutputs.showMoreFiles",{count:T})}),(0,u.jsx)(TF,{open:b})]})]})]}),L.map(O=>{let $=n8e(O);return(0,u.jsx)(X7e,{artifact:O,externalUrl:$,onOpen:$||!NU(O)?void 0:()=>E(O),onError:d,onDownload:a8e(O)&&h?B=>Kie(h,O.workspacePath,O.mimeType,B):void 0},O.id)}),S>0&&(0,u.jsxs)("button",{type:"button",className:xt.showMoreButton,onClick:()=>k(O=>!O),children:[(0,u.jsx)("span",{children:w?f("turnOutputs.collapseArtifacts"):f("turnOutputs.showMoreArtifacts",{count:S})}),(0,u.jsx)(TF,{open:w})]}),r.map(O=>(0,u.jsx)(K7e,{task:O,scheduleLabel:oz(O.cron,f),onOpen:()=>N(O)},O.toolCallId))]})}function X7e({artifact:e,externalUrl:t,onOpen:a,onDownload:n,onError:r}){let{t:o}=tt(),s=wb(),[i,l]=(0,y.useState)(!1),c=(0,y.useRef)(!0);(0,y.useEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]);let d=Hie(e.sizeBytes),f=r8e(e,o),p=tz(e),m=async()=>{if(!(!n||i)){l(!0);try{await n(()=>!c.current)}catch(h){if(!c.current)return;let b=o("common.downloadFailed",{message:Qy(h)});r?r(new Error(b,{cause:h}),b):console.error(b,h)}finally{l(!1)}}},g=(0,u.jsx)(Oi,{size:16,strokeWidth:1.8,"aria-hidden":"true"});return(0,u.jsx)("div",{className:xt.card,children:(0,u.jsxs)("div",{className:xt.summary,children:[(0,u.jsx)("span",{className:xt.icon,"aria-hidden":"true",children:(0,u.jsx)(Jie,{artifact:e,className:xt.iconSvg})}),(0,u.jsxs)("div",{className:xt.artifactInfo,children:[(0,u.jsx)("div",{className:`${xt.title} ${xt.artifactTitle}`,children:p}),(0,u.jsx)("div",{className:xt.artifactMeta,children:[e.metadata?.artifactType==="web_preview_snapshot"?o("webPreview.saved"):jie(e),d].filter(Boolean).join(" \xB7 ")})]}),(0,u.jsxs)("div",{className:xt.actions,children:[n&&(0,u.jsxs)("button",{type:"button",className:xt.reviewButton,onClick:()=>void m(),title:`${o("common.download")} ${p}`,disabled:i,children:[(0,u.jsx)(vh,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),o(i?"common.downloading":"common.download")]}),(0,u.jsx)("span",{className:xt.openButtonWrapper,title:f??p,children:t?(0,u.jsxs)("a",{className:xt.reviewButton,href:t,target:"_blank",rel:"noopener noreferrer",onClick:h=>s(h,t),children:[g,o("common.open")]}):(0,u.jsxs)("button",{type:"button",className:xt.reviewButton,onClick:a,disabled:!a,children:[g,o("common.open")]})})]})]})})}function K7e({task:e,scheduleLabel:t,onOpen:a}){let{t:n}=tt();return(0,u.jsx)("div",{className:xt.card,children:(0,u.jsxs)("div",{className:xt.summary,children:[(0,u.jsx)("span",{className:xt.icon,"aria-hidden":"true",children:(0,u.jsx)(Z7e,{})}),(0,u.jsxs)("div",{className:xt.artifactInfo,children:[(0,u.jsx)("div",{className:xt.title,children:e.title}),(0,u.jsx)("div",{className:xt.artifactMeta,children:[t,e.recurring?n("scheduledTasks.repeats"):n("scheduledTasks.runsOnce")].filter(Boolean).join(" \xB7 ")})]}),(0,u.jsx)("div",{className:xt.actions,children:(0,u.jsx)("button",{type:"button",className:xt.reviewButton,onClick:a,title:e.title,children:n("common.open")})})]})})}function Z7e(){return(0,u.jsxs)("svg",{className:xt.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[(0,u.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),(0,u.jsx)("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function TF({open:e}){return(0,u.jsx)("svg",{className:[xt.chevronIcon,e?xt.chevronIconOpen:""].filter(Boolean).join(" "),viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:(0,u.jsx)("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}var Q7e=(0,y.memo)(V7e);function Y7e(e,t,a){if(!e8e(e)||!e.workspacePath)return;let n=t.find(r=>Zie(r.path,e.workspacePath,a));if(n)return J7e(n)}function J7e(e){for(let t=e.diffs.length-1;t>=0;t--){let a=e.diffs[t];if(a?.fullContent)return a.newText}}function e8e(e){let t=e.workspacePath?.toLowerCase()??"",a=e.mimeType?.toLowerCase()??"";return e.kind==="html"||t8e(t)||a==="text/html"||a==="text/markdown"}function t8e(e){let t=e.toLowerCase();return t.endsWith(".html")||t.endsWith(".htm")||t.endsWith(".md")||t.endsWith(".markdown")||r6(t)!==void 0}function a8e(e){return e.storage==="workspace"&&(e.status==="available"||e.status==="changed")&&!!e.workspacePath}function NU(e){return e.storage!=="workspace"?!0:e.status==="available"||e.status==="changed"}function n8e(e){if(e.kind!=="link"||e.storage==="published")return;let t=e.url?.trim();return a9(t)?t:void 0}function r8e(e,t){if(!NU(e))return e.workspacePath?t("turnOutputs.artifactUnavailable",{path:e.workspacePath}):t("turnOutputs.artifactMissing")}function o8e(e,t){return o6(e,t)}function s8e(e,t){let[a,n]=(0,y.useState)(!1);return(0,y.useLayoutEffect)(()=>{let r=e.current;if(!r||!t){n(!1);return}let o=r.closest("[data-history-viewport]")??r,s=()=>{let d=Number.parseFloat(getComputedStyle(r).getPropertyValue("--chat-regular-content-width"))||1e3;n(o.getBoundingClientRect().width>=d)};s();let i=typeof ResizeObserver>"u"?null:new ResizeObserver(s);i?.observe(o);let l=r.closest("[data-web-shell-root]"),c=new MutationObserver(s);return l&&c.observe(l,{attributes:!0,attributeFilter:["style"]}),()=>{i?.disconnect(),c.disconnect()}},[e,t]),a}var i8e="_collapseRow_d7f01_1",l8e="_collapseRowClickable_d7f01_14",c8e="_collapseLabel_d7f01_19",u8e="_processedLabel_d7f01_36",d8e="_processedMeta_d7f01_43",f8e="_hiddenMetrics_d7f01_47",p8e="_summaryMetrics_d7f01_51",m8e="_collapseIcon_d7f01_59",h8e="_chevronRight_d7f01_72",g8e="_chevronDown_d7f01_73",Ts={collapseRow:i8e,collapseRowClickable:l8e,collapseLabel:c8e,processedLabel:u8e,processedMeta:d8e,hiddenMetrics:f8e,summaryMetrics:p8e,collapseIcon:m8e,chevronRight:h8e,chevronDown:g8e},v8e="_list_nvt92_1",w8e="_listWithWelcomeHeader_nvt92_12",y8e="_historyStatus_nvt92_32",b8e="_historyRetryButton_nvt92_38",k8e="_virtualSizer_nvt92_64",x8e="_virtualRow_nvt92_73",S8e="_loadingSkeleton_nvt92_83",C8e="_srOnly_nvt92_91",T8e="_loadingSkeletonUserRow_nvt92_103",_8e="_loadingSkeletonAssistantRow_nvt92_109",I8e="_loadingSkeletonUserBubble_nvt92_115",L8e="_loadingSkeletonUserBubbleCompact_nvt92_116",A8e="_loadingSkeletonAssistantBlock_nvt92_130",E8e="_loadingSkeletonLineWide_nvt92_138",R8e="_loadingSkeletonLineMedium_nvt92_139",M8e="_loadingSkeletonLineShort_nvt92_140",N8e="_loadingSkeletonLineNarrow_nvt92_141",P8e="_turnStatusRow_nvt92_181",O8e="_turnAnswerRow_nvt92_182",D8e="_turnContentRow_nvt92_193",$8e="_sessionTimelineLayer_nvt92_197",B8e="_sessionTimelinePanel_nvt92_210",F8e="_sessionTimelineViewport_nvt92_226",z8e="_sessionTimelineList_nvt92_275",q8e="_sessionTimelineItem_nvt92_285",U8e="_sessionTimelineButton_nvt92_290",j8e="_sessionTimelineTick_nvt92_310",H8e="_sessionTimelineButtonInRange_nvt92_400",W8e="_sessionTimelineButtonCurrent_nvt92_404",G8e="_sessionTimelineDetails_nvt92_415",V8e="_sessionTimelineDetailsTitle_nvt92_453",X8e="_sessionTimelineDetailsIcon_nvt92_460",K8e="_sessionTimelineDetailsTitleText_nvt92_472",Z8e="_sessionTimelineDetailsDetail_nvt92_482",Rt={list:v8e,listWithWelcomeHeader:w8e,historyStatus:y8e,historyRetryButton:b8e,virtualSizer:k8e,virtualRow:x8e,loadingSkeleton:S8e,srOnly:C8e,loadingSkeletonUserRow:T8e,loadingSkeletonAssistantRow:_8e,loadingSkeletonUserBubble:I8e,loadingSkeletonUserBubbleCompact:L8e,loadingSkeletonAssistantBlock:A8e,loadingSkeletonLineWide:E8e,loadingSkeletonLineMedium:R8e,loadingSkeletonLineShort:M8e,loadingSkeletonLineNarrow:N8e,turnStatusRow:P8e,turnAnswerRow:O8e,turnContentRow:D8e,sessionTimelineLayer:$8e,sessionTimelinePanel:B8e,sessionTimelineViewport:F8e,sessionTimelineList:z8e,sessionTimelineItem:q8e,sessionTimelineButton:U8e,sessionTimelineTick:j8e,sessionTimelineButtonInRange:H8e,sessionTimelineButtonCurrent:W8e,sessionTimelineDetails:G8e,sessionTimelineDetailsTitle:V8e,sessionTimelineDetailsIcon:X8e,sessionTimelineDetailsTitleText:K8e,sessionTimelineDetailsDetail:Z8e},VC=()=>{},Q8e=15e3,XC=180,Y8e=400,_F=5e3;function J8e(e,t){if(!e||e.length!==t.length||t.length===0)return!1;for(let r=0;r<t.length-1;r+=1)if(e[r]!==t[r])return!1;let a=e[e.length-1],n=t[t.length-1];return a.id!==n.id||a.role!==n.role||n.role!=="assistant"&&n.role!=="thinking"||a.role!=="assistant"&&a.role!=="thinking"||a.isStreaming!==!0||n.isStreaming!==!0?!1:a.role==="assistant"&&n.role==="assistant"?typeof a.content!="string"||typeof n.content!="string"?!1:a.branchRecordId===n.branchRecordId&&a.usage===n.usage&&!!a.content.trim()==!!n.content.trim():a.role==="thinking"&&n.role==="thinking"}function IF(e,t){return e.length===t.length&&e.every((a,n)=>Object.is(a,t[n]))}function eTe(e){for(let t=e.length-1;t>=0;t--){let a=e[t];if(a?.role==="user")return a.id}return null}function tTe(e){return e[e.length-1]}function aTe(e){for(let t=e.length-1;t>=0;t--){let a=e[t];if(a&&no(a))return a.id}return null}function nTe(e,t){return e.role!=="tool_group"?!1:!!(t?.toolCallId&&e.tools.some(a=>Ls(a,t.toolCallId)))}function H6(e){return l9(e)||!!G0(e.rawOutput)}function LF(e){let t=[],a=!1;for(let n of e){if(n.role!=="tool_group"||n.tools.length<2||!n.tools.some(H6)){t.push(n);continue}a=!0;let r=[],o=0,s=i=>{i.length!==0&&t.push({...n,id:o++===0?n.id:`${n.id}-${i[0].callId}`,tools:i})};for(let i of n.tools)H6(i)?(s(r),r=[],s([i])):r.push(i);s(r)}return a?t:e}function rTe(e,t){let a=[],n=0,r=o=>o.role==="tool_group"&&!nTe(o,t)&&!o.tools.some(H6);for(;n<e.length;){let o=e[n];if(o.role!=="thinking"&&!r(o)){a.push(o),n++;continue}let s=[],i=n-1,l=n;for(;l<e.length;){let p=e[l];if(p.role==="thinking"||r(p)){s.push(p),i=l,l++;continue}break}let c=s.filter(p=>p.role==="tool_group").flatMap(p=>p.tools);if(c.length===0||s.length<=1||s.length>=2&&s.every(a6)){for(let p of s)a.push(p);n=i+1;continue}let d=[],f=[];for(let p of s)if(p.role==="thinking"){let m={content:p.content,...p.isStreaming===!0?{isStreaming:!0}:{}};d.push(m),f.push(m)}else if(p.role==="tool_group"&&p.tools.length>0){let m=p.tools[0].callId;for(let g of f)g.beforeToolCallId=m;f.length=0}a.push({id:z0(s[0].id),role:"tool_group",tools:c,...d.length>0?{thoughts:d}:{},timestamp:s[0].timestamp}),n=i+1}return a}function oTe(e,t){let a=e[e.length-1];if(a?.role!=="tool_group"||hb(a.id)===void 0||!a.thoughts?.length)return;let n=a.thoughts[a.thoughts.length-1];if(n?.isStreaming!==!0)return;let r=a.thoughts.slice();r[r.length-1]={...n,content:t.content,isStreaming:!0};let o=e.slice();return o[o.length-1]={...a,thoughts:r,...a.id===z0(t.id)?{timestamp:t.timestamp}:{}},o}function sTe(e){if(e.role==="assistant"||e.role==="thinking")return e.isStreaming?{...e,isStreaming:!1}:e;if(e.role!=="tool_group"||!e.thoughts?.length)return e;let t=!1,a=e.thoughts.map(n=>n.isStreaming?(t=!0,{...n,isStreaming:!1}):n);return t?{...e,thoughts:a}:e}function AF(e){if(e.role==="assistant"||e.role==="thinking")return e.content;if(e.role==="tool_group"&&e.thoughts?.length)return JSON.stringify(e.thoughts.map(t=>t.content))}function EF(e,t){let a=e.get(t);if(a!==void 0)return a;let n=sTe(t);return e.set(t,n),n}function PU(e){return Fse(zTe(e))}function qy(e){if(e.type==="parallel_agents")return`group:${e.key}`;if(e.type==="turn_outputs")return`outputs:${e.key}`;if(e.type==="turn_collapse"){let t=e.turnCollapse.liveStartedAt;return t===void 0?`tc:${e.key}`:`tc:${e.key}:${t}`}return`msg:${e.key}`}function iTe(e,t,a,n,r){if((!a||a.size===0)&&(!n||n.size===0)&&(!r||r.size===0))return e;let o=[],s=null,i=(l,c)=>{if(c&&t||!l)return;let d=a?.get(l)??[],f=n?.get(l)??[],p=r?.get(l)??[];if(d.length===0&&f.length===0&&p.length===0)return;let m=o.length;for(let g=o.length-1;g>=0;g-=1){let h=o[g];if(h.type!=="message"||h.message.role!=="system")break;h.message.source==="recap"&&(m=g)}o.splice(m,0,{type:"turn_outputs",key:l,turnId:l,changes:d,artifacts:f,scheduledTasks:p})};for(let l of e)l.type==="message"&&no(l.message)?(i(s,!1),s=l.message.id):!s&&l.type==="message"?s=l.message.id:!s&&l.type==="parallel_agents"&&(s=l.turnId),o.push(l);return i(s,!0),o}function lTe(e,t){let a=s=>s.type==="parallel_agents"&&(t?.has(s.key)===!0||s.agents.some(i=>Cn(i.status)));if(!e.some(s=>a(s)))return e;let n=[],r=[],o=()=>{n.push(...r),r=[]};for(let s of e)s.type==="message"&&no(s.message)?(o(),n.push(s)):a(s)?r.push(s):n.push(s);return o(),n}function OU(e){return e.type==="message"&&e.message.role==="assistant"&&e.message.agentMessage?.kind==="agent_message"}function DU(e,t){return e.type==="message"&&!OU(e)&&(e.message.role==="assistant"||t&&e.message.role==="system"&&e.message.source==="background_notification")&&!!e.message.content&&e.message.content.trim().length>0}function Rb(e,t,a,n=!0){let r=!1;for(let o=a;o>t;o--){let s=e[o];if(s.type==="message"&&s.message.role==="system"&&s.message.source==="background_notification_turn_started")r=!1;else if(CTe(s))r=!0;else if(!r&&DU(s,n))return o}return-1}function cTe(e,{isResponding:t,latestTurnAwaitsAgentSummary:a,gateBackgroundAgentStatus:n}){let r=[];for(let s=0;s<e.length;s++){let i=e[s];i.type==="message"&&no(i.message)&&r.push(s)}let o=new Map;for(let s=0;s<r.length;s++){let i=r[s],l=(s+1<r.length?r[s+1]:e.length)-1;if(s===r.length-1&&(t||n&&a)||n&&zU(e,i,l))continue;let c=e[i],d=Rb(e,i,l,!1);if(d<0)continue;let f=e[d];c?.type==="message"&&f.type==="message"&&f.message.role==="assistant"&&o.set(f.message.id,c.message.id)}return o}function RF(e,t){if(e.type==="parallel_agents")return!0;if(e.type==="turn_outputs"||e.type==="turn_collapse")return!1;switch(e.message.role){case"tool_group":return!e.message.tools.some(l9);case"plan":return!0;case"assistant":return!t&&!OU(e);case"thinking":return!0;case"system":return e.message.source==="background_notification"?!t:e.message.source==="background_notification_turn_started"||e.message.source==="background_task_completed"||e.message.source==="vision_bridge_notice";case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return!1;default:return e.message,!1}}function $U(e){return e.source==="mid_turn_message_injected"}function uTe(e,t){if(e.type==="parallel_agents")return{kind:"agents",timestamp:e.timestamp,label:t?t("timeline.parallelAgents"):"Parallel agents"};if(e.type==="turn_outputs")return{kind:"none"};if(e.type!=="message")return{kind:"none"};let{message:a}=e;switch(a.role){case"thinking":return{kind:"thought",timestamp:a.timestamp,label:t?t("timeline.thinking"):"Thinking"};case"assistant":return e.turnCollapse?{kind:"none",timestamp:a.timestamp}:pd(a.content,1)?{kind:"commentary",timestamp:a.timestamp,label:t?t("timeline.assistantUpdate"):"Assistant update"}:{kind:"none",timestamp:a.timestamp};case"tool_group":{let n=a.tools.length;return{kind:"tool",timestamp:a.timestamp,label:t?t("timeline.toolCalls",{count:n}):`${n} tool call${n===1?"":"s"}`}}case"plan":return{kind:"plan",timestamp:a.timestamp,label:t?t("timeline.planUpdate"):"Plan update"};case"system":return $U(a)?{kind:"status",timestamp:a.timestamp,label:t?t("timeline.statusUpdate"):"Status update"}:{kind:"none",timestamp:a.timestamp};case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return{kind:"none",timestamp:a.timestamp};default:return{kind:"none"}}}function pd(e,t,a={}){let n=(a.stripMarkdown===!0?dTe(e):e??"").replace(/\s+/g," ").trim();if(t<=0||!n)return"";let r=Array.from(n);return r.length>t?`${r.slice(0,t-1).join("")}\u2026`:n}function dTe(e){if(!e)return"";let t=[],a=r=>{let o=`\0${t.length}\0`;return t.push(r),o},n=e.replace(/```[^\n`]*\n?([\s\S]*?)```/g,(r,o)=>a(o)).replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`\n]+)`/g,(r,o)=>a(o)).replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"");n=KC(n,"~~"),n=KC(n,"**"),n=KC(n,"__"),n=n.replace(/\*([^*\s][^*]*?\S)\*/g,"$1").replace(/(^|[^\p{L}\p{N}_])_([^_\s][^_]*?\S)_(?=$|[^\p{L}\p{N}_])/gu,"$1$2");for(let[r,o]of t.entries())n=n.split(`\0${r}\0`).join(o);return n}function KC(e,t){let a="",n=0;for(;n<e.length;){let r=e.indexOf(t,n);if(r===-1)return a+e.slice(n);let o=r+t.length,s=e.indexOf(t,o);if(s===-1)return a+e.slice(n);let i=e.slice(o,s);a+=i.trim().length===0?e.slice(n,s+t.length):e.slice(n,r)+i,n=s+t.length}return a}function fTe(e,t){let a=e.role==="user"?e.content:e.role==="user_shell"?e.command:"";return pd(a,32)||(t?t("timeline.userTurn"):"User turn")}function pTe(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function no(e){return e.role==="user"||e.role==="user_shell"}function mTe(e,t){if(!t.startsWith("msg:"))return;let a=t.slice(4);a=hb(a)??a;for(let n=e.length-1;n>=0;n--)if(e[n]?.id===a){for(let r=n;r>=0;r--){let o=e[r];if(o&&no(o))return o.id}return}}function hTe(e,t){for(let a of e)if(a.type==="turn_collapse"&&a.turnCollapse.turnId===t)return a.turnCollapse.collapsed;return!1}function gTe(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return pd(e.content,120,{stripMarkdown:!0});case"tool_group":{let a=e.tools.length;return t?t("timeline.toolCalls",{count:a}):`${a} tool call${a===1?"":"s"}`}case"plan":return t?t("timeline.planDetail"):"plan update";case"system":return $U(e)?pd(e.content,120,{stripMarkdown:!0}):"";case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return"";default:return""}}function vTe(e,t){if(e.type==="parallel_agents"){let a=e.agents.length;return t?t("timeline.parallelAgentsDetail",{count:a}):`${a} parallel agent${a===1?"":"s"}`}return e.type==="turn_outputs"||e.type!=="message"?"":gTe(e.message,t)}function wTe(e,t){return t?t(`timeline.kind.${e}`):e_e[e]}function yTe(e,t,a,n){if(t!==null)for(let s of e){if(s.type!=="message")continue;let{message:i}=s;if(i.id!==t||i.role!=="assistant")continue;let l=pd(i.content,180,{stripMarkdown:!0});if(l)return l}let r=[];for(let s=0;s<e.length;s+=1){let i=e[s];if(i.type==="message"&&t!==null&&i.message.id===t)continue;let l=vTe(i,n);l&&r.push(l)}return pd(r.join(" \xB7 "),180)||(a.length>0?a.map(s=>wTe(s,n)).join(" \xB7 "):n?n("timeline.noActivity"):"No activity")}function bTe(e,t){let a=[],n=null,r=[],o=()=>{if(!n)return;let s=PU(r),i=Rb(s,-1,s.length-1,!1),l=i>=0?s[i]:null,c=l?.type==="message"&&l.message.role==="assistant"&&!l.message.isStreaming&&pd(l.message.content,1,{stripMarkdown:!0}).length>0?l.message.id:null,d=[];for(let f of s){if(f.type==="message"&&c!==null&&f.message.id===c)continue;let p=uTe(f,t);p.kind!=="none"&&!d.includes(p.kind)&&d.push(p.kind)}a.push({id:n.id,label:fTe(n,t),detail:yTe(s,c,d,t),timestamp:n.timestamp,nodeKinds:d,...pTe(n)?{isScheduledTask:!0}:{}})};for(let s of e){if(no(s)){o(),n=s,r=[];continue}n&&r.push(s)}return o(),a}function kTe(){return(0,u.jsxs)("svg",{className:Rt.sessionTimelineDetailsIcon,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,u.jsx)("circle",{cx:"8",cy:"8",r:"6.25"}),(0,u.jsx)("path",{d:"M8 4.5v4l-2.5 2"})]})}function xTe(e){let t=e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0;return[e.callId,e.toolName,e.kind??"",e.status,e.parentToolCallId??"",e.subContent?"sub-content":"",e.subTools?.length??0,String(e.args?.subagent_type??""),e.args?.run_in_background===!0?"background":"",String(t?.type??""),String(t?.status??"")].join(":")}function STe(e){return e.map(t=>{let a=`${t.id}:${t.role}:${t.timestamp??""}`;switch(t.role){case"assistant":case"thinking":return`${a}:${t.isStreaming?"streaming":t.content}`;case"tool_group":return`${a}:${t.tools.map(xTe).join(",")}`;case"system":return`${a}:${t.variant}:${t.source??""}:${t.content}`;case"user":return`${a}:${t.content}`;case"user_shell":return`${a}:${t.command}`;case"plan":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return a;default:return a}}).join("|")}function CTe(e){return e.type==="parallel_agents"?!0:e.type==="turn_outputs"||e.type==="turn_collapse"?!1:e.message.role==="tool_group"||e.message.role==="plan"}function TTe(e){if(e.type==="turn_outputs")return null;if(e.type==="turn_collapse")return e.turnCollapse.liveStartedAt===void 0||e.turnCollapse.toolCallCount===void 0||e.turnCollapse.toolCallCount<=0?null:`turn:${e.turnCollapse.turnId}:${e.turnCollapse.toolCallCount}`;if(e.type==="parallel_agents"){let a=e.agents.filter(n=>Cn(n.status));return a.length===0?null:`agents:${e.key}:${a.map(n=>n.callId).join(",")}`}if(e.message.role!=="tool_group")return null;let t=e.message.tools.filter(a=>Cn(a.status));return t.length===0?null:`tools:${e.message.id}:${t.map(a=>a.callId).join(",")}`}function _Te(e){for(let t=e.length-1;t>=0;t--){let a=TTe(e[t]);if(a)return a}return null}function ITe(e){if(!(e.type!=="message"||e.message.role!=="system"))return e.message.source==="prompt_cancelled"||e.message.source==="turn_error"?e.message.timestamp:void 0}function LTe(e){return e.type==="message"&&e.message.role==="system"&&e.message.source==="turn_error"}function ATe(e){if(!(e.type!=="message"||e.message.role!=="assistant"))return e.message.content?.trim()?e.message.timestamp:void 0}function ETe(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function ZC(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function MF(e){if(e.parentToolCallId||!tr(e))return;let t=e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0,a=t?.executionSummary&&typeof t.executionSummary=="object"?t.executionSummary:void 0,n=ZC(a?.inputTokens),r=ZC(a?.outputTokens);if(n===void 0&&r===void 0)return;let o=ZC(a?.cachedTokens);return{callId:e.callId,usage:{inputTokens:n??0,outputTokens:r??0,...o!==void 0?{cachedTokens:o}:{}}}}function RTe(e){return e.type==="parallel_agents"?e.agents.flatMap(t=>MF(t)??[]):e.type!=="message"||e.message.role!=="tool_group"?[]:e.message.tools.flatMap(t=>MF(t)??[])}function MTe(e){return e.type==="parallel_agents"?e.agents.length:e.type==="turn_outputs"||e.type==="turn_collapse"?0:e.message.role==="tool_group"?e.message.tools.filter(t=>!Lo(t.toolName)).length:0}function BU(e,t){for(let a=Math.min(t,e.length-1);a>=0;a--){let n=e[a];if(n.type==="message"&&no(n.message))return n.message.id}return null}function FU(e){let t=[],a=null;for(let n of e)n.type==="message"&&no(n.message)&&(a=n.message.id),t.push(a);return t}function NF(e,t,a,n){let r=n===void 0?BU(e,t):n[t]??null;return r?a.get(r)??null:null}function NTe(e,t,a,n,r=FU(e)){let o=Number.POSITIVE_INFINITY,s=-1;for(let l of t){if(l<0||l>=e.length)continue;let c=NF(e,l,a,r);c!==null&&(o=Math.min(o,c),s=Math.max(s,c))}if(s<0)return null;let i=n==null?null:NF(e,n,a,r);return{startIndex:o,endIndex:s,currentIndex:i!==null&&i>=o&&i<=s?i:s}}function ug(e,t,a,n){for(let r=t;r<=a;r++){let o=e[r];if(o.type==="parallel_agents"){if(o.agents.some(n))return!0}else if(o.type==="message"&&o.message.role==="tool_group"&&o.message.tools.some(n))return!0}return!1}function PTe(e,t,a,n){return n?ug(e,t,a,r=>Ls(r,n)):!1}function OTe(e,t,a){return ug(e,t,a,n=>tr(n)&&Cn(n.status))}function DTe(e,t,a){return ug(e,t,a,n=>G0(n.rawOutput)!==void 0)}function $Te(e,t){let a=new Set(t);for(let n of e){if(n.type!=="message"||n.message.role!=="system"||n.message.source!=="background_notification"&&n.message.source!=="background_task_completed"&&n.message.source!=="background_notification_turn_started")continue;let r=n.message.data;if(n.message.source==="background_notification_turn_started"&&r&&typeof r=="object"&&"backgroundTask"in r&&(r=r.backgroundTask??r),!r||typeof r!="object"||Array.isArray(r)||!("kind"in r)||r.kind!=="shell")continue;let o="taskId"in r?r.taskId:void 0;typeof o=="string"&&a.add(o)}return a}function BTe(e,t,a,n){return ug(e,t,a,r=>{let o=Bse(r);return o!==void 0&&!n.has(o)})}function zU(e,t,a){return ug(e,t,a,n=>Is(n)&&Cn(n.status))}function FTe(e,t,a,n){if(!n?.size)return!1;for(let r=t;r<=a;r++){let o=e[r];if(o.type==="parallel_agents"&&n.has(o.key))return!0}return!1}function QC(e){return e.type==="parallel_agents"?e.agents.filter(t=>Is(t)&&t.status!=="failed").map(t=>t.callId):e.type==="message"&&e.message.role==="tool_group"?e.message.tools.filter(t=>Is(t)&&t.status!=="failed").map(t=>t.callId):[]}function qU(e){if(e.role!=="system"||e.source!=="background_notification"&&e.source!=="background_task_completed"&&e.source!=="background_notification_turn_started")return null;let t=e.content?.trimStart().toLowerCase().startsWith("background agent ")===!0,a=e.data;if(e.source==="background_notification_turn_started"&&a&&typeof a=="object"&&"backgroundTask"in a&&(a=a.backgroundTask??a),typeof a!="object"||a===null||Array.isArray(a))return t?{status:"completed",...e.timestamp!==void 0?{endTime:e.timestamp}:{}}:null;let{kind:n,toolUseId:r,status:o}=a;if(n!=="agent"&&!(n===void 0&&t))return null;let s=o===void 0?"completed":HF(o)?o:void 0;return s?{...typeof r=="string"?{callId:r}:{},status:s,...e.timestamp!==void 0?{endTime:e.timestamp}:{}}:null}function W6(e){return e.type==="message"?qU(e.message):null}function zTe(e){let t=new Map;for(let r of e){let o=qU(r);o?.callId&&t.set(o.callId,o)}if(t.size===0)return e;let a=!1,n=e.map(r=>{if(r.role!=="tool_group")return r;let o=!1,s=r.tools.map(i=>{let l=t.get(i.callId);if(!l||!Is(i)||!Cn(i.status))return i;let c=WF(i,l.status,l.endTime);return c===i?i:(o=!0,c)});return o?(a=!0,{...r,tools:s}):r});return a?n:e}function UU(e,t,a,n){let r=-1,o;for(let c=a;c>t;c--){let d=e[c];if(!(d.type!=="message"||d.message.role!=="system")){if(d.message.source==="turn_error"||d.message.source==="prompt_cancelled"){if(r<0)return null;continue}if(d.message.source==="background_notification"){let f=W6(d);if(n&&!f)continue;r<0&&(r=c,o=f?.callId)}}}if(r<0)return null;let s=-1;if(o){for(let c=a;c>=0;c--)if(QC(e[c]).includes(o)){s=c;break}}for(let c=a;c>=t&&!(s>=0);c--)if(QC(e[c]).length>0){s=c;break}let i=new Set,l=!1;if(s>=0){let c=s;for(let f=s;f>=0;f--){let p=e[f];if(p.type==="message"&&no(p.message)){c=f;break}}let d=[];for(let f=c;f<=a;f++){let p=e[f];for(let g of QC(p))i.add(g);let m=W6(p);m&&(l=!0,m.callId?i.delete(m.callId):d.push(new Set(i)))}for(let f of d)for(let p of f)if(i.has(p)){i.delete(p);break}}return{lastNotificationIndex:r,sawAgentCompletion:l,unmatchedAgentCallIds:i}}function G6(e,t,a,n=!1,r=!0,o=!0){let s=UU(e,t,a,n);if(!s)return!1;if(s.sawAgentCompletion&&s.unmatchedAgentCallIds.size>0)return r;for(let i=s.lastNotificationIndex+1;i<=a;i++){let l=e[i];if(l.type==="message"&&l.message.role==="thinking")return!1}return o&&Rb(e,t,a,!1)<s.lastNotificationIndex}function qTe(e,{overrides:t,isResponding:a,activeTurnStartedAt:n,backgroundSummaryGraceActive:r=!0,waitForUnmatchedAgentCompletions:o=!0,waitForOrderedNarration:s=!0,terminalBackgroundShellTaskIds:i,automaticallyExpandedAgentKeys:l,pendingApprovalCallId:c,includeSubagentToolUsageInMetrics:d=!0,paginatedExpanded:f,enabled:p}){if(!p||e.length===0)return e;let m=[];for(let b=0;b<e.length;b++){let v=e[b];v.type==="message"&&no(v.message)&&m.push(b)}if(m.length===0)return e;let g=$Te(e,i),h=[];for(let b=0;b<m[0];b++)h.push(e[b]);for(let b=0;b<m.length;b++){let v=m[b],w=(b+1<m.length?m[b+1]:e.length)-1,k=e[v],_=k.message.id,T=k.message.timestamp,L=b===m.length-1,S=L&&a,I=OTe(e,v,w),R=DTe(e,v,w),E=BTe(e,v,w,g),N=FTe(e,v,w,l),O=L&&r&&G6(e,v,w,!1,o,s),$=PTe(e,v,w,c),B=Rb(e,v,w),V=B;if(B>=0&&DU(e[B],!1)){let ge=!1;for(let W=B-1;W>v;W--){let xe=e[W];if(xe.type!=="message")break;if(xe.message.role==="system"&&xe.message.source==="background_task_completed")ge=!0;else if(ge&&xe.message.role==="assistant")V=W,ge=!1;else break}}let G=0,J,Z,Q,A=0,j=0,K=0,P=0,ae=0,se=!1,Ee=new Set,q=!1;for(let ge=v+1;ge<=w;ge++){let W=e[ge];if(RF(W,ge>=V&&ge<=B)&&G++,LTe(W)&&(q=!0),P+=MTe(W),W.type==="message"&&W.message.role==="thinking"?ae++:W.type==="message"&&W.message.role==="tool_group"&&W.message.thoughts&&(ae+=W.message.thoughts.length),W.type==="message"&&W.message.role==="system"&&W.message.source==="prompt_cancelled"){let it=W.message.data,Bt=it&&typeof it=="object"&&"elapsedMs"in it?it.elapsedMs:void 0;typeof Bt=="number"&&Number.isFinite(Bt)&&Bt>=0&&(Z=Bt)}let xe=ITe(W);xe!==void 0&&(J=J===void 0?xe:Math.max(J,xe));let _e=ATe(W);_e!==void 0&&(Q=Q===void 0?_e:Math.max(Q,_e));let Ye=ETe(W);if(Ye&&(A+=Ye.inputTokens,j+=Ye.outputTokens,K+=Ye.cachedTokens??0,se=!0),d)for(let it of RTe(W))Ee.has(it.callId)||(Ee.add(it.callId),A+=it.usage.inputTokens,j+=it.usage.outputTokens,K+=it.usage.cachedTokens??0,se=!0)}let oe=S||O?n??T??Date.now():void 0,ie=J??Q,ee=Z??(T!==void 0&&ie!==void 0&&ie>=T?ie-T:void 0);if($||G===0&&!(se||ee!==void 0||oe!==void 0)){for(let ge=v;ge<=w;ge++)h.push(e[ge]);continue}let he=S||I||R||E||N||O||(q||B<0)&&L,ke=!(G===0||(t.has(_)?t.get(_):f?.has(_)||he));h.push({type:"message",key:k.key,message:k.message});let Me={turnId:_,collapsed:ke,hiddenCount:G,...ee!==void 0?{elapsedMs:ee}:{},...se?{inputTokens:A,outputTokens:j}:{},...K>0?{cachedTokens:K}:{},...P>0?{toolCallCount:P}:{},...ae>0?{thinkingCount:ae}:{},...oe!==void 0?{liveStartedAt:oe}:{}};if(h.push({type:"turn_collapse",key:`tc-${_}`,turnCollapse:Me}),!ke){for(let ge=v+1;ge<=w;ge++){let W=e[ge];ge===B&&W.type==="message"&&W.message.role==="assistant"?h.push({...W,turnCollapse:Me}):h.push(W)}continue}for(let ge=v+1;ge<=w;ge++){let W=e[ge];if(!(ge===B&&S)){if(ge===B&&W.type==="message"&&W.message.role==="assistant"){h.push({...W,turnCollapse:Me});continue}RF(W,ge>=V&&ge<=B)||h.push(W)}}}return h}function Uy(e,t,a){if(a){for(let n=0;n<e.length;n++){let r=e[n];if(r.type==="message"&&r.message.role==="tool_group"&&r.message.tools.some(o=>Ls(o,a))||r.type==="parallel_agents"&&r.agents.some(o=>Ls(o,a)))return n}return-1}for(let n=0;n<e.length;n++){let r=e[n];if(r.type==="message"&&r.message.id===t)return n}return-1}function PF(e,t){if(!t)return!1;let a=t.callId;return e.type==="message"?a?e.message.role==="tool_group"&&e.message.tools.some(n=>Ls(n,a)):e.message.id===t.messageId:e.type==="parallel_agents"?!!a&&e.agents.some(n=>Ls(n,a)):(e.type,!1)}function OF(e,t){return e?e.type==="message"?e.message.sourceBlockIds?.join(","):t.filter(a=>e.type==="parallel_agents"?a.role==="tool_group"&&e.agents.some(n=>a.tools.some(r=>Ls(r,n.callId))):a.id===(e.type==="turn_outputs"?e.turnId:e.turnCollapse.turnId)).flatMap(a=>a.sourceBlockIds??[]).join(",")||void 0:void 0}var YC=0,UTe=120,jTe=80,HTe=32,WTe=240,jy=30,JC=160,DF=30,jU=200;function GTe(e,t=jU){return e>t}function VTe(e,t){return e<=t}function XTe(e){let t=Math.max(0,Math.ceil(e/1e3));if(t<60)return`${t}s`;let a=Math.floor(t/60),n=t-a*60;return`${a}m ${n}s`}function KTe(e){return e!==void 0&&e>=0?XTe(e):""}function ZTe(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";let a=e.cachedTokens??0,n=a>0&&e.inputTokens>0?` (${Dn(a)} ${t("turn.cached")}, ${Math.round(a/e.inputTokens*100)}%)`:"";return`\u2191${Dn(e.inputTokens)}${n} \u2193${Dn(e.outputTokens)}`}function $F(e,t){let a=[],n=ZTe(e,t);return n&&a.push(n),e.toolCallCount!==void 0&&e.toolCallCount>0&&a.push(t("turn.toolCalls",{count:e.toolCallCount})),e.thinkingCount!==void 0&&e.thinkingCount>0&&a.push(t("turn.thinkingCount",{count:e.thinkingCount})),a.join(" \xB7 ")}function QTe(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}var YTe=(0,y.memo)(function({turnCollapse:e,onToggleCollapse:t}){let{t:a}=tt(),n=e.hiddenCount>0,r=e.liveStartedAt,o=n||r!==void 0||QTe(e),s=Cb(r!==void 0&&o),i=(0,y.useRef)(0),l=(0,y.useRef)(r);l.current!==r&&(l.current=r,i.current=0);let c;r!==void 0&&o?(i.current=Math.max(i.current,Math.max(0,s-r)),c=i.current):o&&e.elapsedMs!==void 0?(i.current=0,c=e.elapsedMs):(i.current=0,c=void 0);let d=KTe(c),f=$F(e,a),p=$F(e,a),m=a(r!==void 0?"turn.processing":"turn.processed"),g=!!d&&o,h=!!f&&o,b=!!p&&o;if(!o)return null;let v=()=>{if(!n)return;let w=e.collapsed;t(e.turnId,w)};return(0,u.jsxs)("div",{className:n?`${Ts.collapseRow} ${Ts.collapseRowClickable}`:Ts.collapseRow,role:n?"button":void 0,tabIndex:n?0:void 0,"aria-expanded":n?!e.collapsed:void 0,"aria-label":n?e.collapsed?a("turn.expand"):a("turn.collapse"):void 0,title:n?e.collapsed?a("turn.expand"):a("turn.collapse"):void 0,onClick:n?v:void 0,onKeyDown:n?w=>{w.key!=="Enter"&&w.key!==" "||(w.preventDefault(),v())}:void 0,children:[(0,u.jsxs)("span",{className:Ts.collapseLabel,children:[(0,u.jsxs)("span",{className:Ts.processedLabel,children:[m,g&&(0,u.jsxs)("span",{className:Ts.processedMeta,children:[" ",d]})]}),b&&(0,u.jsx)("span",{className:Ts.summaryMetrics,children:p}),h&&(0,u.jsx)("span",{className:Ts.hiddenMetrics,children:f})]}),n&&(0,u.jsx)("span",{"data-testid":`toggle-${e.turnId}`,className:Ts.collapseIcon,onClick:w=>{w.stopPropagation(),v()},children:(0,u.jsx)("span",{className:e.collapsed?Ts.chevronRight:Ts.chevronDown,"aria-hidden":"true"})})]})});function JTe(e){if(e.type==="turn_collapse")return Rt.turnStatusRow;if(e.type==="turn_outputs")return Rt.turnContentRow;if(e.type==="message"&&e.turnCollapse)return Rt.turnAnswerRow}var e_e={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},t_e=["--background","--foreground","--muted-foreground","--border","--font-sans"],BF="session-timeline-detail-tooltip",a_e=(0,y.memo)(function({entries:e,currentTurnId:t,currentRange:a,hidden:n,onSelect:r,action:o}){let s=X0(),{t:i}=tt(),l=(0,y.useRef)(null),c=(0,y.useRef)(null),d=(0,y.useRef)(null),f=(0,y.useRef)(!1),p=(0,y.useRef)(!1),m=(0,y.useRef)(null),g=(0,y.useRef)(null),[h,b]=(0,y.useState)(null),v=a!==null?a.currentIndex:e.findIndex(E=>E.id===t),w=(0,y.useCallback)(()=>b(null),[]),k=(0,y.useCallback)(()=>{f.current||p.current||w()},[w]),_=(0,y.useCallback)((E,N)=>{let O=l.current;if(!O)return null;let $=getComputedStyle(O),B=N.getBoundingClientRect();return{entry:E,top:B.top+B.height/2,left:B.right+8,clamped:!1,themeVars:Object.fromEntries(t_e.map(V=>[V,$.getPropertyValue(V)]))}},[]),T=(0,y.useCallback)(E=>{let N=c.current;return N?Array.from(N.querySelectorAll('[data-testid="session-timeline-entry"]')).find(O=>O.getAttribute("data-turn-id")===E.id)?.querySelector("button")??null:null},[]),L=(0,y.useCallback)(E=>{let N=c.current;if(!N)return!1;let O=N.getBoundingClientRect(),$=E.getBoundingClientRect();return $.bottom>=O.top&&$.top<=O.bottom},[]),S=(0,y.useCallback)(()=>{b(E=>{if(!E)return null;let N=T(E.entry);return!N||!L(N)?null:_(E.entry,N)})},[_,T,L]),I=(0,y.useCallback)((E,N)=>{b(_(E,N))},[_]),R=(0,y.useCallback)(()=>{typeof window>"u"||(m.current!==null&&window.cancelAnimationFrame(m.current),g.current!==null&&window.clearTimeout(g.current),p.current=!0,m.current=window.requestAnimationFrame(()=>{m.current=null,p.current=!1,S()}),g.current=window.setTimeout(()=>{g.current=null,p.current=!1},100))},[S]);return(0,y.useLayoutEffect)(()=>{if(n)return;let E=c.current;if(!E||v<0)return;let N=E.querySelector(`[data-timeline-index="${v}"]`);if(!N)return;let O=N.offsetTop+N.offsetHeight/2,$=E.scrollHeight-E.clientHeight,B=Math.max(0,Math.min(O-E.clientHeight/2,$));if(E.scrollTop===B)return;f.current=!0,E.scrollTop=B;let V=window.requestAnimationFrame(()=>{f.current=!1,S()}),G=window.setTimeout(()=>{f.current=!1},100);return()=>{window.cancelAnimationFrame(V),window.clearTimeout(G),f.current=!1}},[v,n,S]),(0,y.useLayoutEffect)(()=>{if(!(!h||typeof window>"u"))return window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)}},[S,h]),(0,y.useLayoutEffect)(()=>()=>{m.current!==null&&window.cancelAnimationFrame(m.current),g.current!==null&&window.clearTimeout(g.current),p.current=!1},[]),(0,y.useLayoutEffect)(()=>{if(!h||h.clamped)return;let E=l.current,N=d.current;if(!E||!N||typeof window>"u")return;let O=N.getBoundingClientRect(),$=12,B=h.top;O.top<$?B+=$-O.top:O.bottom>window.innerHeight-$&&(B-=O.bottom-(window.innerHeight-$)),B!==h.top&&b(V=>V?.entry.id===h.entry.id?{...V,top:B,clamped:!0}:V)},[h]),n||e.length===0?null:(0,u.jsx)("div",{className:Rt.sessionTimelineLayer,"aria-hidden":"false",children:(0,u.jsxs)("nav",{ref:l,className:Rt.sessionTimelinePanel,"aria-label":i("timeline.sessionTimeline"),"data-testid":"session-timeline",onMouseLeave:w,children:[(0,u.jsx)("div",{ref:c,className:Rt.sessionTimelineViewport,"data-testid":"session-timeline-viewport",onScroll:k,children:(0,u.jsx)("ol",{className:Rt.sessionTimelineList,children:e.map((E,N)=>{let O=a!==null&&N>=a.startIndex&&N<=a.endIndex,$=a!==null?N===a.currentIndex:E.id===t,B=E.nodeKinds.join(","),V=[`${i("timeline.turnPrefix",{index:N+1})}: ${E.label}`,$?i("timeline.currentTurn"):null].filter(Boolean).join(". "),G=Q=>I(E,Q.currentTarget),J=Q=>{R(),I(E,Q.currentTarget)},Z=h?.entry.id===E.id;return(0,u.jsx)("li",{className:Rt.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":E.id,"data-timeline-index":N,"data-node-kinds":B,"data-in-current-range":O?"true":void 0,children:(0,u.jsx)("button",{type:"button",className:V6(Rt.sessionTimelineButton,O?Rt.sessionTimelineButtonInRange:void 0,$?Rt.sessionTimelineButtonCurrent:void 0),"aria-current":$?"step":void 0,"aria-describedby":Z?BF:void 0,"aria-label":V,onClick:()=>r(E.id),onFocus:J,onBlur:w,onMouseEnter:G,onMouseLeave:w,children:(0,u.jsx)("span",{className:Rt.sessionTimelineTick})})},E.id)})})}),o,h&&typeof document<"u"&&(0,V0.createPortal)((0,u.jsxs)("div",{ref:d,className:Rt.sessionTimelineDetails,id:BF,"data-testid":"session-timeline-detail","data-title":h.entry.label,"data-detail":h.entry.detail,"data-scheduled-task":h.entry.isScheduledTask?"true":void 0,role:"tooltip",style:{...h.themeVars,top:h.top,left:h.left},children:[(0,u.jsxs)("span",{className:Rt.sessionTimelineDetailsTitle,children:[h.entry.isScheduledTask&&(0,u.jsx)(kTe,{}),(0,u.jsx)("span",{className:Rt.sessionTimelineDetailsTitleText,children:h.entry.label})]}),(0,u.jsx)("span",{className:Rt.sessionTimelineDetailsDetail,children:h.entry.detail})]}),s??document.body)]})})});function V6(...e){return e.filter(Boolean).join(" ")||void 0}var n_e=[];function r_e({label:e}){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{role:"status","aria-live":"polite",className:Rt.srOnly,children:e}),(0,u.jsxs)("div",{className:Rt.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[(0,u.jsx)("div",{className:Rt.loadingSkeletonUserRow,children:(0,u.jsxs)("div",{className:Rt.loadingSkeletonUserBubble,children:[(0,u.jsx)("span",{className:Rt.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Rt.loadingSkeletonLineShort})]})}),(0,u.jsx)("div",{className:Rt.loadingSkeletonAssistantRow,children:(0,u.jsxs)("div",{className:Rt.loadingSkeletonAssistantBlock,children:[(0,u.jsx)("span",{className:Rt.loadingSkeletonLineMedium}),(0,u.jsx)("span",{className:Rt.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Rt.loadingSkeletonLineNarrow})]})}),(0,u.jsx)("div",{className:Rt.loadingSkeletonUserRow,children:(0,u.jsx)("div",{className:Rt.loadingSkeletonUserBubbleCompact,children:(0,u.jsx)("span",{className:Rt.loadingSkeletonLineMedium})})}),(0,u.jsx)("div",{className:Rt.loadingSkeletonAssistantRow,children:(0,u.jsxs)("div",{className:Rt.loadingSkeletonAssistantBlock,children:[(0,u.jsx)("span",{className:Rt.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Rt.loadingSkeletonLineMedium})]})})]})]})}var o_e=(0,y.memo)((0,y.forwardRef)(function({messages:e,frozenViewport:t=!1,sessionKey:a,terminalBackgroundShellTaskIds:n,pendingApproval:r,onShowContextDetail:o,onImagePreview:s,onAttachmentPreview:i,onInsightReportOpen:l,onEditUserMessage:c,onSubmitUserMessageEdit:d,loadingTranscript:f,catchingUp:p,hasOlderHistory:m=!1,loadingOlderHistory:g=!1,historyCapacityReached:h=!1,historyPaginationError:b=!1,onLoadOlderHistory:v,transcriptBlockCount:w=0,transcriptActivity:k,onReloadTranscript:_,isResponding:T=!1,transcriptReloadPaused:L=T,activeTurnStartedAt:S,welcomeHeader:I,centerWelcomeHeader:R=!1,workspaceCwd:E,tailContent:N,tailKey:O="tail",virtualScrollThreshold:$=jU,autoScrollTailIntoView:B=!1,bottomOverlayInset:V=0,hideSessionTimeline:G=!1,timelineAction:J,hideFirstUserMessage:Z=!1,firstTurnMetrics:Q,includeSubagentToolUsageInMetrics:A=!0,showRetryHint:j=!1,onRetryClick:K,failedPromptMessageId:P,onRetryFailedPrompt:ae,onBranchSession:se,onCanScrollToBottomChange:Ee,turnFileChanges:q,turnArtifacts:oe,sourceEntries:ie,sourceSessionId:ee,mcpAppSessionId:he=ee,onSourceOpen:ke,turnScheduledTasks:Me,onReviewChanges:ge,onOpenArtifact:W,onOpenScheduledTask:xe,onTurnOutputOpen:_e,onToolResultOpen:Ye,onError:it,generateContent:Bt},na){let ue=(0,y.useRef)(t);ue.current=t;let{t:Ke}=tt(),fe=Ma(),Pe=(0,y.useContext)(X6),X=(0,y.useMemo)(()=>{let z=new Map,te,ve=0;for(let Ne of e)Ne.role==="user"&&(z.set(Ne.id,ve),te=Ne.id,ve+=1);return{lastId:te,turnIndexById:z}},[e]),de=(0,y.useMemo)(()=>{if(!t)return;let z=[...X.turnIndexById.keys()];return new Set(z.filter((te,ve)=>ve===0||ve===z.length-1))},[X,t]),ye=(0,y.useRef)(void 0),qe=J8e(ye.current,e);(0,y.useLayoutEffect)(()=>{ye.current=e},[e]);let Qe=(0,y.useRef)(void 0),vt=(0,y.useRef)(void 0),zt=(0,y.useRef)(void 0),nt=(0,y.useRef)(void 0),Ve=(0,y.useMemo)(()=>{let z=Qe.current,te=e[e.length-1],ve;if(qe&&z?.sourceMessages===ye.current&&z?.compactMode===Pe&&z.pendingApproval===r&&(te?.role==="assistant"&&z.value[z.value.length-1]?.id===te.id?(ve=z.value.slice(),ve[ve.length-1]=te):te?.role==="thinking"&&(ve=Pe?oTe(z.value,te):LF(e))),!ve){let ot=LF(e);ve=Pe?rTe(ot,r):ot}Qe.current={sourceMessages:e,compactMode:Pe,pendingApproval:r,value:ve};let Ne=nt.current??=new WeakMap,Ce=vt.current,Ht=Ce!==void 0&&Ce.sessionKey===a?Ce.ids:void 0;if(T){if(zt.current=void 0,!Ht?.size)return ve;let ot,Mt=!1,lt=ve.map(_a=>{let Sa=hb(_a.id);if(Sa!==void 0){let Lg=Ht.get(Sa);Lg!==void 0&&(ot??=new Map).set(Sa,Lg)}let Tn=Ht.get(z0(_a.id));Tn!==void 0&&(ot??=new Map).set(z0(_a.id),Tn);let rs=Ht.get(_a.id);return rs===void 0||AF(_a)!==rs?_a:((ot??=new Map).set(_a.id,rs),Mt=!0,EF(Ne,_a))});return(ot?.size??0)!==Ht.size&&(zt.current={sessionKey:a,ids:ot??new Map}),Mt?lt:ve}let Jt,sa=ve.map(ot=>{let Mt=EF(Ne,ot);if(Mt!==ot){let lt=AF(ot);if(lt!==void 0){(Jt??=new Map).set(ot.id,lt);let _a=hb(ot.id),Sa=ot.role==="tool_group"?ot.thoughts?.[0]?.content:void 0;_a!==void 0&&Sa!==void 0&&Jt.set(_a,Sa),ot.role==="thinking"&&Jt.set(z0(ot.id),JSON.stringify([ot.content]))}}return Mt});return Jt?(zt.current={sessionKey:a,ids:new Map([...Ht??[],...Jt])},sa):ve},[Pe,T,e,r,a,qe]);(0,y.useLayoutEffect)(()=>{let z=zt.current;z&&(vt.current=z,zt.current=void 0)},[Ve]);let Ct=(0,y.useRef)(void 0),We=(0,y.useMemo)(()=>{let z=Ct.current,te=Ve[Ve.length-1],ve;if(qe&&T&&z?.sourceMessages===ye.current&&z?.compactMode===Pe&&z.pendingApproval===r&&z.isResponding===T&&z.turnFileChanges===q&&z.turnArtifacts===oe&&z.turnScheduledTasks===Me){let Ne=z.value[z.value.length-1];Ne?.type==="message"&&Ne.message.id===te.id&&(ve=z.value.slice(),ve[ve.length-1]={...Ne,message:te})}return ve??=iTe(PU(Ve),T,q,oe,Me),Ct.current={sourceMessages:e,compactMode:Pe,pendingApproval:r,isResponding:T,turnFileChanges:q,turnArtifacts:oe,turnScheduledTasks:Me,value:ve},ve},[Ve,e,qe,Pe,r,T,q,oe,Me]),dt=(0,y.useMemo)(()=>{for(let z=Ve.length-1;z>=0;z-=1){let te=Ve[z];if(te?.role==="system"&&te.source==="background_notification")return te.id}return null},[Ve]),[la,ar]=(0,y.useState)(dt),nr=!!(f||p),ml=(0,y.useRef)(nr),Dt=(0,y.useRef)(Ve.length>0),qr=!Dt.current&&Ve.length>0,ha=nr||ml.current||qr;(0,y.useLayoutEffect)(()=>{ha&&ar(dt),Ve.length>0&&(Dt.current=!0),ml.current=nr},[ha,dt,nr,Ve.length]);let Na=!ha&&dt!==null&&la!==dt,ra=(0,y.useMemo)(()=>{for(let z=We.length-1;z>=0;z-=1){let te=We[z];if(te.type==="message"&&no(te.message))return z}return 0},[We]),dn=fe==="interactive",$a=(0,y.useMemo)(()=>dn&&zU(We,ra,We.length-1),[We,dn,ra]),Bn=(0,y.useMemo)(()=>UU(We,ra,We.length-1,!0),[We,ra]),ga=(0,y.useMemo)(()=>{let z=Bn?.unmatchedAgentCallIds;return z&&z.size>0?[...z].sort().join("|"):""},[Bn]),vr=Na&&!$a&&(Bn?.sawAgentCompletion??!1)&&(Bn?.unmatchedAgentCallIds.size??0)>0,[wr,va]=(0,y.useState)(!1);(0,y.useEffect)(()=>{va(!1)},[ga,ra,T]),(0,y.useEffect)(()=>{if(!vr||T)return;let z=setTimeout(()=>va(!0),_F);return()=>clearTimeout(z)},[vr,ga,ra,T]);let hl=(0,y.useMemo)(()=>Na&&!$a&&!T&&(Bn?.sawAgentCompletion??!1)&&(Bn?.unmatchedAgentCallIds.size??0)===0&&G6(We,ra,We.length-1,!0,!0,!0),[Na,We,T,Bn,$a,ra]),[io,dg]=(0,y.useState)(!1),zp=(0,y.useMemo)(()=>{let z=Bn;if(!z||z.lastNotificationIndex<0)return"";let te=We[z.lastNotificationIndex];return te?.type==="message"?te.message.id:""},[We,Bn]);(0,y.useEffect)(()=>{dg(!1)},[zp,ra,T]),(0,y.useEffect)(()=>{if(!hl)return;let z=setTimeout(()=>dg(!0),_F);return()=>clearTimeout(z)},[hl,zp,ra,T]);let Mo=(0,y.useMemo)(()=>Na&&G6(We,ra,We.length-1,!0,$a||!wr,!io),[Na,We,$a,ra,io,wr]),Dc=(0,y.useMemo)(()=>{let z=new Set;for(let te=ra;te<We.length;te+=1){let ve=We[te];ve.type==="parallel_agents"&&z.add(ve.key)}return z},[We,ra]),$c=(0,y.useMemo)(()=>{if(!Na)return{key:null};let z=-1,te;for(let ve=We.length-1;ve>=0;ve-=1){let Ne=We[ve];if(Ne.type!=="message"||Ne.message.role!=="system"||Ne.message.source!=="background_notification")continue;let Ce=W6(Ne);if(Ce){z=ve,te=Ce.callId;break}}for(let ve=z-1;ve>=0;ve-=1){let Ne=We[ve];if(Ne.type==="parallel_agents"&&(!te||Ne.agents.some(Ce=>Ce.callId===te)))return{key:Ne.key}}return{key:null}},[Na,We]),Fn=(0,y.useRef)(null),Bc=s8e(Fn,!G),[yd,Mb]=(0,y.useState)(()=>new Set),fg=(0,y.useCallback)((z,te)=>{Mb(ve=>{if(ve.has(z)===te)return ve;let Ne=new Set(ve);return te?Ne.add(z):Ne.delete(z),Ne})},[]),bd=(0,y.useRef)(null),Fc=(0,y.useMemo)(()=>{if(!Bc)return n_e;let z=STe(Ve);return(bd.current?.signature!==z||bd.current?.t!==Ke)&&(bd.current={signature:z,t:Ke,entries:bTe(Ve,Ke)}),bd.current.entries},[Bc,Ve,Ke]),Nb=(0,y.useMemo)(()=>new Map(Fc.map((z,te)=>[z.id,te])),[Fc]),pg=(0,y.useMemo)(()=>aTe(Ve),[Ve]),[qp,mg]=(0,y.useState)(null),Pb=qp!==null?Fc[qp.currentIndex]?.id??pg:pg,Up=(0,y.useRef)(void 0),jp=(0,y.useMemo)(()=>{let z=Up.current,te;return qe&&T&&z?.sourceMessages===ye.current&&z?.isResponding===T&&z.latestTurnAwaitsAgentSummary===Mo&&z.gateBackgroundAgentStatus===dn?te=z.value:te=cTe(We,{isResponding:T,latestTurnAwaitsAgentSummary:Mo,gateBackgroundAgentStatus:dn}),Up.current={sourceMessages:e,isResponding:T,latestTurnAwaitsAgentSummary:Mo,gateBackgroundAgentStatus:dn,value:te},te},[We,e,qe,dn,T,Mo]),{collapseCompletedTurns:hg,sourceReferences:zc,assistantFeedback:Hp}=Ao(),{ratings:gg,rate:vg,ratingForTurn:wg}=wie(ee),yg=(0,y.useMemo)(()=>{let z=new Map;for(let te of e)no(te)&&z.set(te.id,te);return z},[e]),kd=cie({renderMode:fe,sessionId:ee,options:Hp}),Wp=(0,y.useRef)(Hp);Wp.current=Hp;let bg=(0,y.useRef)(e);bg.current=e;let kg=(0,y.useCallback)((z,te,ve)=>{let Ne=wg(z);vg(z,ve);let Ce=Wp.current?.onRate;Ce&&uie(Ce,{rating:ve,previousRating:Ne,sessionId:ee,promptId:z,userMessage:die(bg.current,te)})},[wg,vg,ee]),Gp=(0,y.useRef)(void 0),xd=(0,y.useMemo)(()=>{let z=[ie,E,ee,zc],te=Gp.current;return qe&&T&&te&&te.sourceMessages===ye.current&&IF(te.dependencies,z)?te.value:gse(e,ie??[],E,ee,zc)},[e,ie,E,ee,zc,qe,T]);(0,y.useLayoutEffect)(()=>{Gp.current={sourceMessages:e,dependencies:[ie,E,ee,zc],value:xd}},[e,ie,E,ee,zc,xd]);let Sd=hg??!0,[qc,Cd]=(0,y.useState)(()=>new Map),[gl,Uc]=(0,y.useState)(()=>new Set),vl=(0,y.useRef)(new Map),[xg,yr]=(0,y.useTransition)(),Vp=(0,y.useRef)(!1),jc=(0,y.useRef)(new Map),wl=(0,y.useRef)(void 0),yl=(0,y.useRef)([]),bl=(0,y.useRef)(!0);t&&(bl.current=!1);let oa=(0,y.useRef)(!1),Xp=(0,y.useRef)(0),kl=(0,y.useRef)(0),Ar=(0,y.useRef)(!1),F=(0,y.useRef)(0),ce=(0,y.useRef)(!1),be=(0,y.useRef)(0),ut=(0,y.useRef)(null),St=(0,y.useRef)(!1),xa=(0,y.useRef)(null),es=(0,y.useRef)(null),Hc=(0,y.useRef)(!1),lo=(0,y.useRef)(null),ui=(0,y.useRef)(!1),Td=(0,y.useRef)(f),Kp=(0,y.useRef)(!!f),Ur=(0,y.useRef)(void 0),_d=(0,y.useRef)(void 0),K9=(0,y.useRef)(V),Ob=(0,y.useRef)(null),Z9=(0,y.useRef)(p),Wc=(0,y.useRef)(p),Q9=(0,y.useRef)(!1),Db=(0,y.useRef)(!1),Id=(0,y.useRef)(void 0),Zp=(0,y.useRef)(void 0);Wc.current=p;let Ld=(0,y.useRef)(!1),jr=(0,y.useRef)(void 0),Qp=(0,y.useRef)(void 0),di=(0,y.useRef)(void 0),Yp=(0,y.useRef)(void 0),Jp=(0,y.useRef)(void 0),Ad=(0,y.useRef)(void 0),Sg=(0,y.useRef)(void 0),$b=(0,y.useRef)(w),Bb=(0,y.useRef)(L);$b.current=w,Bb.current=L||t;let Fb=(0,y.useRef)(null),[Ba,As]=(0,y.useState)(null),Y9=(0,y.useRef)(!1);Y9.current=Ba?.virtual===!0;let J9=(0,y.useRef)(Ve.length);(0,y.useLayoutEffect)(()=>{J9.current=Ve.length},[Ve.length]);let zb=(0,y.useRef)(e);(0,y.useLayoutEffect)(()=>{zb.current=e},[e]);let[QU,Cg]=(0,y.useState)(!1),[YU,JU]=(0,y.useState)(a);YU!==a&&(JU(a),vl.current.clear(),F.current+=1,Ar.current=!1,Ld.current=!1,As(null),Cd(z=>z.size?new Map:z),Uc(z=>z.size?new Set:z)),(0,y.useEffect)(()=>{m||(Ld.current=!1,Fb.current=null)},[m]);let em=(0,y.useCallback)(()=>{let z=Fn.current,te=z?z.scrollHeight-z.scrollTop-z.clientHeight:0,ve=!bl.current&&te>1;es.current!==ve&&(es.current=ve,Ee?.(ve))},[Ee]),rr=(0,y.useCallback)(()=>{Zp.current!==void 0&&window.cancelAnimationFrame(Zp.current),Zp.current=window.requestAnimationFrame(em)},[em]),jt=(0,y.useCallback)(z=>{ue.current&&(z=!1),bl.current!==z&&(bl.current=z,rr())},[rr]),Ed=(0,y.useRef)(void 0),qb=(0,y.useRef)(!1),zn=(0,y.useMemo)(()=>{qb.current=!1;let z=[de,qc,T,S,n,Na,$a,wr,io,Sd,Z,Q,A,yd,Pe,r,q,oe,Me,gl],te=Ed.current,ve=We[We.length-1];if(qe&&T&&te&&te.sourceMessages===ye.current&&IF(te.dependencies,z)&&ve?.type==="message"){let lt=qy(ve),_a=-1;for(let Sa=te.value.length-1;Sa>=0;Sa-=1)if(qy(te.value[Sa])===lt){_a=Sa;break}if(_a>=0){let Sa=te.value[_a];if(Sa?.type==="message"){let Tn=te.value.slice();return Tn[_a]={...Sa,message:ve.message},Ed.current={sourceMessages:e,dependencies:z,value:Tn,virtualizerItems:te.virtualizerItems},qb.current=!0,Tn}}}let Ne=qTe(We,{overrides:qc,isResponding:T,activeTurnStartedAt:S,terminalBackgroundShellTaskIds:n,backgroundSummaryGraceActive:Na,waitForUnmatchedAgentCompletions:$a||!wr,waitForOrderedNarration:!io,automaticallyExpandedAgentKeys:yd,pendingApprovalCallId:r?.toolCallId??null,includeSubagentToolUsageInMetrics:A,paginatedExpanded:de?new Set([...gl,...de]):gl,enabled:Sd}),Ce=de?Ne.map(lt=>{if(!("turnCollapse"in lt)||!lt.turnCollapse||!de.has(lt.turnCollapse.turnId))return lt;let{turnId:_a,collapsed:Sa,hiddenCount:Tn}=lt.turnCollapse;return{...lt,turnCollapse:{turnId:_a,collapsed:Sa,hiddenCount:Tn}}}):Ne,Ht=!1,Jt=Q?Ce.map(lt=>Ht||lt.type!=="turn_collapse"?lt:(Ht=!0,{...lt,turnCollapse:{...lt.turnCollapse,...Q.durationMs!==void 0&&Q.durationMs>0?{elapsedMs:Q.durationMs}:{},...Q.inputTokens!==void 0?{inputTokens:Q.inputTokens}:{},...Q.outputTokens!==void 0?{outputTokens:Q.outputTokens}:{},...Q.cachedTokens!==void 0?{cachedTokens:Q.cachedTokens}:{}}})):Ce,sa=lTe(Jt,yd);if(!Z)return Ed.current={sourceMessages:e,dependencies:z,value:sa,virtualizerItems:sa},sa;let ot=Ve.find(lt=>lt.role==="user")?.id,Mt=ot?sa.filter(lt=>lt.type!=="message"||lt.message.id!==ot):sa;return Ed.current={sourceMessages:e,dependencies:z,value:Mt,virtualizerItems:Mt},Mt},[We,qe,qc,T,S,n,Na,$a,wr,io,Sd,de,Z,Q,A,Ve,e,yd,Pe,r,q,oe,Me,gl]),Rd=Ed.current?.sourceMessages===e?Ed.current.virtualizerItems:zn,tm=(0,y.useCallback)(z=>Rd.some(te=>String(qy(te))===z),[Rd]),Ub=(0,y.useRef)(void 0),ej=(0,y.useMemo)(()=>{if(qb.current&&Ub.current?.length===zn.length)return Ub.current.value;let z=FU(zn);return Ub.current={length:zn.length,value:z},z},[zn]),tj=Fc.length>=mge,ts=N!=null,Md=!!f,xl=!!I,or=xl?1:0,Gc=or+zn.length,am=Gc+(ts?1:0),aj=or+We.length+(ts?1:0),fi=GTe(aj,$),Kn=(0,y.useCallback)(()=>Fn.current,[]),e7=(0,y.useCallback)(()=>{let z=Fn.current;if(!z)return;let te=z.scrollHeight-z.scrollTop-z.clientHeight<jy;oa.current=!te,jt(te),rr()},[rr,jt]),nm=(0,y.useCallback)(()=>{Xp.current=Date.now()+1e3},[]),Tg=(0,y.useCallback)(()=>{Jp.current!==void 0&&(window.clearTimeout(Jp.current),Jp.current=void 0)},[]),as=(0,y.useCallback)(()=>{Tg(),Ad.current?.abort(),Ad.current=void 0},[Tg]),Nd=(0,y.useCallback)(()=>{Tg();let z=Sg.current;if(z){if(k?.getSnapshot().lastEventId===z.lastEventId)return;Sg.current=void 0}!_||Ad.current!==void 0||oa.current||Bb.current||$b.current<=TB||(Jp.current=window.setTimeout(()=>{if(Jp.current=void 0,Bb.current||oa.current||$b.current<=TB)return;let te=Fn.current;if(!te||te.scrollHeight-te.scrollTop-te.clientHeight>=jy)return;let ve=new AbortController;Ad.current=ve,_(ve.signal).then(()=>{if(ve.signal.aborted)return;let Ne=k?.getSnapshot();Sg.current={...Ne?.lastEventId!==void 0?{lastEventId:Ne.lastEventId}:{}}}).catch(Ne=>{Ne instanceof Error&&Ne.name==="AbortError"||console.warn("[MessageList] transcript reload failed:",Ne)}).finally(()=>{Ad.current===ve&&(Ad.current=void 0)})},Q8e))},[Tg,_,k]);(0,y.useEffect)(()=>{Sg.current=void 0},[k]),(0,y.useEffect)(()=>{if(!k)return as;let z=k.getSnapshot().lastEventId,te=k.subscribe(()=>{let ve=k.getSnapshot().lastEventId;ve!==z&&(z=ve,Nd())});return()=>{te(),as()}},[k,Nd,as]),(0,y.useEffect)(()=>{if(L){as();return}Nd()},[as,L,Nd,w]);let Pd=(0,y.useCallback)(()=>{Db.current=!0,Id.current!==void 0&&window.cancelAnimationFrame(Id.current),Id.current=window.requestAnimationFrame(()=>{Db.current=!1,Id.current=void 0,e7()})},[e7]);(0,y.useEffect)(()=>()=>{Id.current!==void 0&&window.cancelAnimationFrame(Id.current),Zp.current!==void 0&&window.cancelAnimationFrame(Zp.current),jr.current!==void 0&&window.cancelAnimationFrame(jr.current),Qp.current!==void 0&&window.cancelAnimationFrame(Qp.current),di.current!==void 0&&window.cancelAnimationFrame(di.current),as(),Ur.current!==void 0&&window.cancelAnimationFrame(Ur.current),_d.current!==void 0&&window.cancelAnimationFrame(_d.current)},[as]);let t7=(0,y.useCallback)((z,te)=>{let ve=Fn.current;(!ve||ve.scrollHeight>ve.clientHeight+1)&&(oa.current=!0,jt(!1)),Pd(),wl.current!==void 0&&window.clearTimeout(wl.current),jc.current.clear(),Fn.current?.querySelectorAll("[data-message-row-key]").forEach(Ne=>{let Ce=Ne.dataset.messageRowKey;Ce&&jc.current.set(Ce,Ne.getBoundingClientRect().top)}),Vp.current=!0,yr(()=>{Uc(Ne=>{if(!Ne.has(z))return Ne;let Ce=new Set(Ne);return Ce.delete(z),Ce}),Cd(Ne=>{let Ce=new Map(Ne);return Ce.set(z,te),Ce})})},[Pd,jt]);(0,y.useLayoutEffect)(()=>{if(xg||!Vp.current)return;Vp.current=!1;for(let te of yl.current)te.cancel();yl.current=[];let z=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;z||Fn.current?.querySelectorAll("[data-message-row-key]").forEach(te=>{if(typeof te.animate!="function")return;let ve=te.dataset.messageRowKey,Ne=ve?jc.current.get(ve):void 0;if(Ne===void 0){yl.current.push(te.animate([{opacity:0},{opacity:1}],{duration:XC,easing:"ease-out"}));return}let Ce=Ne-te.getBoundingClientRect().top;Math.abs(Ce)<1||yl.current.push(te.animate([{translate:`0 ${Ce}px`},{translate:"0 0"}],{duration:XC,easing:"ease-out"}))}),jc.current.clear(),wl.current=window.setTimeout(()=>{wl.current=void 0,Pd()},z?0:XC)},[Pd,xg]),(0,y.useEffect)(()=>()=>{wl.current!==void 0&&window.clearTimeout(wl.current);for(let z of yl.current)z.cancel();yl.current=[]},[]);let nj=(0,y.useCallback)(z=>{let te=z.target;te instanceof HTMLElement&&te.closest("[aria-expanded], summary")&&(oa.current=!0,jt(!1),Pd())},[Pd,jt]),Vc=(0,y.useCallback)(z=>{if(xl&&z===YC)return"slot:header";if(ts&&z===Gc)return`slot:tail:${O}`;let te=Rd[z-or];return te?qy(te):`slot:row:${z}`},[xl,ts,Gc,O,Rd,or]),rj=(0,y.useCallback)(z=>xl&&z===YC?UTe:ts&&z===Gc?WTe:Rd[z-or]?.type==="turn_collapse"?HTe:jTe,[xl,ts,or,Gc,Rd]),Zn=(0,y.useCallback)((z="auto")=>{if(ue.current)return;let te=Kn();if(!te||te.scrollHeight<=te.clientHeight)return;St.current=!1,be.current+=1;let ve=be.current;ce.current=!0,z==="smooth"?te.scrollTo({top:te.scrollHeight,behavior:z}):te.scrollTop=te.scrollHeight,rr(),kl.current=Math.max(0,te.scrollHeight-te.clientHeight),em();let Ne=()=>{if(be.current!==ve||(ce.current=!1,!St.current)||(St.current=!1,Wc.current||oa.current))return;let Ce=Kn();!Ce||Ce.scrollHeight<=Ce.clientHeight||(jt(!0),Ce.scrollTop=Ce.scrollHeight,rr(),kl.current=Math.max(0,Ce.scrollHeight-Ce.clientHeight),em())};z==="smooth"?setTimeout(Ne,350):requestAnimationFrame(Ne)},[Kn,em,rr,jt]),a7=(0,y.useCallback)((z="smooth")=>{oa.current=!1,jt(!0),Zn(z)},[Zn,jt]),ns=Pse({count:am,enabled:fi,getScrollElement:Kn,getItemKey:Vc,estimateSize:rj,overscan:20,anchorTo:"end",useFlushSync:!1,useAnimationFrameWithResizeObserver:!0,directDomUpdates:!0});ns.shouldAdjustScrollPositionOnItemSizeChange=(z,te,ve)=>VTe(z.end,Fn.current?.scrollTop??ve.scrollOffset??0);let oj=(0,y.useCallback)(z=>{if(ns.measureElement(z),!z||!Y9.current)return;let te=Number(z.dataset.index);Number.isFinite(te)&&!ns.itemSizeCache.has(Vc(te))&&ns.resizeItem(te,z.offsetHeight)},[Vc,ns]);(0,y.useLayoutEffect)(()=>{if(!Ba)return;let z=Fn.current;if(Ba.rowKey&&!tm(Ba.rowKey)){let te=mTe(zb.current,Ba.rowKey);if(te!==void 0&&hTe(zn,te)&&qc.get(te)!==!1&&!gl.has(te)){Uc(ve=>ve.has(te)?ve:new Set(ve).add(te)),As(ve=>ve&&{...ve,rowKey:`msg:${te}`});return}Ba.generation===F.current&&(F.current+=1),Ar.current=!1,Yp.current=void 0,Cg(!1),As(null);return}if(Ba.settled){if(!z){Ar.current=!1,As(null);return}if(Ba.virtual?Ve.length===Ba.messageCount:z.scrollHeight===Ba.scrollHeight){if(Ar.current=!1,jr.current!==void 0)return;let te=DF,ve=()=>{if(jr.current=void 0,Ba.generation===F.current&&J9.current===Ba.messageCount){if(te-=1,te>0){jr.current=requestAnimationFrame(ve);return}As(Ne=>Ne===Ba?null:Ne)}};jr.current=requestAnimationFrame(ve);return}jr.current!==void 0&&(cancelAnimationFrame(jr.current),jr.current=void 0),jr.current=requestAnimationFrame(()=>{if(jr.current=void 0,Ba.generation!==F.current)return;if(Ba.rowKey&&!tm(Ba.rowKey)){Ar.current=!1,As(null);return}let te=Ba.rowKey?Array.from(z.querySelectorAll("[data-message-row-key]")).find(ve=>ve.dataset.messageRowKey===Ba.rowKey):void 0;te&&Ba.rowTop!==void 0?z.scrollTop+=te.getBoundingClientRect().top-Ba.rowTop:z.scrollTop=Ba.scrollTop+Math.max(0,z.scrollHeight-Ba.scrollHeight),Ar.current=!1,As(null)})}},[tm,Ve.length,Ba,zn,qc,gl]);let n7=ns.getVirtualItems(),Od=ns.getTotalSize(),r7=(0,y.useRef)({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});r7.current={entryIndexById:Nb,headerOffset:or,isVisible:Bc,turnIdByDisplayIndex:ej,visibleItems:zn};let o7=(0,y.useCallback)(()=>{let z=Kn(),te=r7.current;if(!z||!te.isVisible||te.entryIndexById.size===0){mg(lt=>lt===null?lt:null);return}let ve=z.getBoundingClientRect(),Ne=ve.top,Ce=ve.bottom,Ht=Ne+(Ce-Ne)/2,Jt=[],sa=null,ot=Number.POSITIVE_INFINITY;z.querySelectorAll("[data-index]").forEach(lt=>{let _a=lt.dataset.index;if(_a===void 0)return;let Sa=Number(_a);if(!Number.isFinite(Sa))return;let Tn=Sa-te.headerOffset;if(Tn<0||Tn>=te.visibleItems.length)return;let rs=lt.getBoundingClientRect();if(rs.bottom<Ne||rs.top>Ce)return;Jt.push(Tn);let Lg=rs.top+(rs.bottom-rs.top)/2,u7=Math.abs(Lg-Ht);u7<ot&&(ot=u7,sa=Tn)});let Mt=NTe(te.visibleItems,Jt,te.entryIndexById,sa,te.turnIdByDisplayIndex);mg(lt=>lt?.startIndex===Mt?.startIndex&<?.endIndex===Mt?.endIndex&<?.currentIndex===Mt?.currentIndex?lt:Mt)},[Kn]),Sl=(0,y.useCallback)(()=>{xa.current!==null&&cancelAnimationFrame(xa.current),xa.current=requestAnimationFrame(()=>{xa.current=null,o7()})},[o7]);(0,y.useEffect)(()=>()=>{ut.current!==null&&(clearTimeout(ut.current),ut.current=null),xa.current!==null&&(cancelAnimationFrame(xa.current),xa.current=null)},[]),(0,y.useEffect)(()=>{Sl()},[Sl,am,Od,fi,n7.length,Bc]);let[rm,jb]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(!rm)return;let z=setTimeout(()=>jb(null),1600);return()=>clearTimeout(z)},[rm]);let Hb=(0,y.useCallback)((z,te)=>{oa.current=!0,jt(!1),be.current+=1;let ve=be.current;if(ce.current=!0,fi)if(ue.current){let Ne=ns.getOffsetForIndex(z,"center");Ne&&Fn.current&&(Fn.current.scrollTop=Ne[0])}else ns.scrollToIndex(z,{align:"center"});else Fn.current?.querySelector(`[data-index="${z}"]`)?.scrollIntoView({block:"center"});ut.current!==null&&clearTimeout(ut.current),ut.current=setTimeout(()=>{ut.current=null,be.current===ve&&(ce.current=!1,Sl(),rr())},150),jb(null),requestAnimationFrame(()=>jb(te))},[fi,ns,jt,Sl,rr]),s7=(0,y.useRef)({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});s7.current={visibleItems:zn,displayItems:We,headerOffset:or,performScrollToRow:Hb};let Xc=(0,y.useRef)(null),om=(0,y.useCallback)((z,te)=>{let{visibleItems:ve,displayItems:Ne,headerOffset:Ce,performScrollToRow:Ht}=s7.current,Jt=Uy(ve,z,te);if(Jt>=0)return Xc.current=null,Ht(Jt+Ce,{messageId:z,callId:te}),!0;let sa=Uy(Ne,z,te);if(sa<0)return!1;let ot=BU(Ne,sa);return ot?(Xc.current={messageId:z,callId:te},Cd(Mt=>{if(Mt.get(ot)===!0)return Mt;let lt=new Map(Mt);return lt.set(ot,!0),lt}),!0):!1},[]);(0,y.useImperativeHandle)(na,()=>({scrollToMessage:om,scrollToBottom:a7}),[om,a7]),(0,y.useEffect)(()=>{let z=Xc.current;if(!z)return;let te=Uy(zn,z.messageId,z.callId);te<0||(Xc.current=null,Hb(te+or,z))},[zn,or,Hb]);let Es=(0,y.useCallback)(async(z=!1,te=!1)=>{let ve=Fn.current;if(!ve||!v||g||Ar.current||b&&!te||Ld.current&&!z)return;Ld.current=!1,Ar.current=!0;let Ne=++F.current;jr.current!==void 0&&(cancelAnimationFrame(jr.current),jr.current=void 0),Cg(!te);let Ce;if(fi){let Mt=String(Vc(or)),lt=DF;if(Ce=await new Promise(_a=>{let Sa=()=>{if(Qp.current=void 0,Ne!==F.current||Fn.current!==ve||!tm(Mt)||lt--<=0){_a(void 0);return}let Tn=Array.from(ve.querySelectorAll("[data-message-row-key]")).find(rs=>rs.dataset.messageRowKey===Mt);Tn?_a({rowKey:Mt,rowTop:Tn.getBoundingClientRect().top}):Qp.current=requestAnimationFrame(Sa)};Qp.current=requestAnimationFrame(Sa)}),!Ce){Ne===F.current&&(Ar.current=!1,Yp.current=void 0,Cg(!1));return}}let Ht=ve.scrollHeight,Jt=ve.scrollTop,sa=ve.getBoundingClientRect().top,ot=Ce?void 0:Array.from(ve.querySelectorAll("[data-message-row-key]")).find(Mt=>{let lt=Mt.dataset.messageRowKey;return lt!==void 0&<.startsWith("msg:")&&Mt.getBoundingClientRect().bottom>sa});oa.current=!0,As({scrollHeight:Ht,scrollTop:Jt,messageCount:Ve.length,virtual:fi,settled:!1,generation:Ne,...Ce??(ot?{rowKey:ot.dataset.messageRowKey,rowTop:ot.getBoundingClientRect().top}:{})});try{vl.current.set(Ne,{ids:new Set(zb.current.map(lt=>lt.id)),resolved:!1}),await v(te?{force:!0}:void 0);let Mt=vl.current.get(Ne);Mt&&(Mt.resolved=!0),Ne===F.current&&As(lt=>lt?.generation===Ne?{...lt,settled:!0}:lt)}catch{vl.current.delete(Ne),Ne===F.current&&(Ld.current=!0,Ar.current=!1,As(null))}finally{Ne===F.current&&Cg(!1)}},[g,v,b,Vc,tm,or,Ve.length,fi]),sj=(0,y.useCallback)(()=>{Es(!0,!0)},[Es]);(0,y.useLayoutEffect)(()=>{let z=vl.current;if(z.size===0)return;let te=e.find(Jt=>!Jt?.id.startsWith("local-"));if(!te)return;let ve=z.entries().next().value;if(!ve)return;let[Ne,Ce]=ve;if(Ce.ids.has(te.id))return;let Ht=[];for(let Jt=0;Jt<e.length;Jt++){let sa=e[Jt];if(!sa||!no(sa)||Ce.ids.has(sa.id))continue;let ot=!1;for(let Mt=Jt+1;Mt<e.length;Mt++){let lt=e[Mt];if(no(lt))break;if(Ce.ids.has(lt.id)){ot=!0;break}}ot&&Ht.push(sa.id)}if(Ht.length===0){if(!Ce.resolved)return}else Uc(Jt=>{let sa=null;for(let ot of Ht)Jt.has(ot)||(sa??=new Set(Jt),sa.add(ot));return sa??Jt});z.delete(Ne);for(let Jt of z.values())for(let sa of e)sa&&Jt.ids.add(sa.id)},[e]),(0,y.useEffect)(()=>{let z=Yp.current;if(z===void 0||g||Ba||Ar.current||(Yp.current=void 0,!m||z!==F.current))return;let te=Kn();te&&te.scrollTop<=JC&&Es(!0)},[Kn,m,Es,g,Ba]);let Wb=(0,y.useCallback)(()=>{let z=Kn();if(!z)return;let te=z.scrollTop;m&&te<=JC&&Es(!0);let ve=Date.now()<=Xp.current;if(ce.current&&!ve){kl.current=te;return}Sl();let Ne=kl.current;kl.current=te;let Ce=z.scrollHeight-te-z.clientHeight;if(rr(),te<Ne-1){let Ht=Ce<jy;ve?(as(),oa.current=!0,jt(!1)):Ht?(oa.current=!1,jt(!0)):oa.current||(as(),jt(!1));return}Ce<jy?(oa.current=!1,jt(!0),Nd()):as()},[Kn,m,Es,rr,Sl,Nd,as,jt]);(0,y.useEffect)(()=>{let z=Kn();if(z)return z.addEventListener("scroll",Wb,{passive:!0}),()=>z.removeEventListener("scroll",Wb)},[Kn,Wb]);let _g=(0,y.useCallback)(()=>{if(!m||g||p||Md)return;let z=Kn();if(!z||z.scrollHeight>z.clientHeight+1)return;let te=Fb.current;if(te!==null&&te.loader===v&&te.totalVirtualSize===Od){Ld.current=!0;return}Fb.current={loader:v,totalVirtualSize:Od},Es()},[p,Kn,m,Es,g,v,Md,Od]);(0,y.useEffect)(()=>{_g()},[_g,Od]),(0,y.useEffect)(()=>{let z=Kn();if(!z)return;let te=()=>{if(di.current=void 0,!(z.scrollTop>JC)){if(g||Ar.current){Yp.current=F.current;return}Es(!0)}},ve=()=>{di.current!==void 0&&cancelAnimationFrame(di.current),di.current=requestAnimationFrame(te)},Ne=ot=>{nm(),ot.deltaY<0&&ve()},Ce=()=>{nm()},Ht=()=>ve(),Jt=ot=>{let Mt=z.getBoundingClientRect(),lt=20;(ot.clientX>=Mt.right-lt||ot.clientY>=Mt.bottom-lt)&&nm()},sa=ot=>{(ot.key==="ArrowUp"||ot.key==="ArrowDown"||ot.key==="PageUp"||ot.key==="PageDown"||ot.key==="Home"||ot.key==="End"||ot.key===" ")&&(nm(),(ot.key==="ArrowUp"||ot.key==="PageUp"||ot.key==="Home")&&ve())};return z.addEventListener("wheel",Ne,{passive:!0}),z.addEventListener("touchstart",Ce,{passive:!0}),z.addEventListener("touchmove",Ht,{passive:!0}),z.addEventListener("pointerdown",Jt,{passive:!0}),z.addEventListener("keydown",sa,{passive:!0}),()=>{z.removeEventListener("wheel",Ne),z.removeEventListener("touchstart",Ce),z.removeEventListener("touchmove",Ht),z.removeEventListener("pointerdown",Jt),z.removeEventListener("keydown",sa),di.current!==void 0&&(cancelAnimationFrame(di.current),di.current=void 0)}},[Kn,Es,g,nm]),(0,y.useEffect)(()=>{let z=Kn();if(!z||typeof ResizeObserver>"u")return;let te=new ResizeObserver(()=>{rr(),_g(),!(Wc.current||oa.current)&&(jt(!0),Zn())});te.observe(z);for(let Ne of Array.from(z.children))te.observe(Ne);let ve=new MutationObserver(Ne=>{for(let Ce of Ne){for(let Ht of Array.from(Ce.addedNodes))Ht instanceof HTMLElement&&te.observe(Ht);for(let Ht of Array.from(Ce.removedNodes))Ht instanceof HTMLElement&&te.unobserve(Ht)}rr()});return ve.observe(z,{childList:!0}),rr(),()=>{te.disconnect(),ve.disconnect()}},[Kn,_g,rr,Zn,jt]),(0,y.useEffect)(()=>{e.length===0&&(oa.current=!1,St.current=!1,jt(!0),Xc.current=null,vl.current.clear(),vt.current=void 0,zt.current=void 0,Cd(z=>z.size?new Map:z),Uc(z=>z.size?new Set:z))},[e.length,jt]),(0,y.useEffect)(()=>{let z=Fn.current;if(!z)return;let te=new ResizeObserver(()=>{Sl(),!Wc.current&&(oa.current||(jt(!0),requestAnimationFrame(()=>{!Wc.current&&!oa.current&&Zn()})))});return te.observe(z),()=>te.disconnect()},[Zn,Sl,jt]),(0,y.useLayoutEffect)(()=>{let z=eTe(e);if(p||f||Td.current){lo.current=z,Hc.current=!0,ui.current=!1,Td.current=f;return}if(Td.current=f,!Hc.current){lo.current=z,Hc.current=!0,ui.current=!1;return}let te=tTe(e);z&&te?.role==="user"&&z!==lo.current?(oa.current=!1,jt(!0),Xc.current=null,ui.current=!0):ui.current=!1,lo.current=z},[e,p,f,jt]),(0,y.useLayoutEffect)(()=>{Z9.current&&!p&&(oa.current=!1,jt(!0),Zn("auto")),Z9.current=p},[p,Zn,jt]),(0,y.useLayoutEffect)(()=>{if(f){Kp.current=!0;return}if(!Kp.current||p||e.length===0)return;Kp.current=!1,oa.current=!1,jt(!0),Xc.current=null,Ur.current!==void 0&&window.cancelAnimationFrame(Ur.current),_d.current!==void 0&&window.cancelAnimationFrame(_d.current);let z=()=>{Wc.current||oa.current||(jt(!0),Zn("auto"))};Ur.current=window.requestAnimationFrame(()=>{Ur.current=void 0,z(),_d.current=window.requestAnimationFrame(()=>{_d.current=void 0,z()})})},[p,f,e.length,Zn,jt]),(0,y.useLayoutEffect)(()=>{let z=K9.current!==V;K9.current=V,z&&(p||oa.current||(jt(!0),requestAnimationFrame(()=>{!Wc.current&&!oa.current&&Zn("auto")})))},[V,p,Zn,jt]);let Ig=(0,y.useMemo)(()=>_Te(zn),[zn]);(0,y.useLayoutEffect)(()=>{if(!p){if(!Ig){Ob.current=null;return}Ig!==Ob.current&&(Ob.current=Ig,(bl.current||!oa.current)&&requestAnimationFrame(()=>{oa.current||(jt(!0),Zn())}))}},[p,Ig,Zn,jt]),(0,y.useEffect)(()=>{B&&ts&&!Q9.current&&(oa.current=!1,jt(!0),requestAnimationFrame(()=>{oa.current||Zn()})),Q9.current=ts},[B,ts,Zn,jt]);let i7=(0,y.useCallback)(z=>{let te=Ce=>{if(Ce.type==="parallel_agents")return(0,u.jsx)(n6,{timestamp:Ce.timestamp,children:(0,u.jsx)("div",{className:PF(Ce,rm)?pl.flash:void 0,children:(0,u.jsx)(dq,{agents:Ce.agents,autoManageExpansion:fe==="interactive"&&!p,automaticCollapseDelayMs:$c.key===Ce.key&&!Mo?Y8e:void 0,deferAutomaticCollapse:$c.key===Ce.key&&Mo,expandActiveWhenLive:T&&Dc.has(Ce.key),onAutomaticExpansionChange:Tn=>fg(Ce.key,Tn),pendingApproval:r})})});if(Ce.type==="turn_outputs")return(0,u.jsx)(Q7e,{changes:Ce.changes,turnId:Ce.turnId,artifacts:Ce.artifacts,sourceSessionId:ee,scheduledTasks:Ce.scheduledTasks,workspaceCwd:E,onOpenRequest:_e,onReviewChanges:ge??VC,onOpenArtifact:W??VC,onOpenScheduledTask:xe??VC,onError:it});if(Ce.type==="turn_collapse")return(0,u.jsx)(YTe,{turnCollapse:Ce.turnCollapse,onToggleCollapse:t7});let Ht=Ce.message.role==="assistant"?jp.get(Ce.message.id):void 0,Jt;Ce.message.role==="assistant"&&Ht&&!t&&(Jt={turnId:Ht,message:{id:Ce.message.id,content:Ce.message.content,isStreaming:Ce.message.isStreaming,timestamp:Ce.message.timestamp}});let sa=Ht?yg.get(Ht):void 0,ot=Ce.message.promptId??sa?.promptId,Mt=Ce.message.role==="assistant"&&Ce.message.agentMessage?.kind==="agent_message",lt=Ce.message.role==="assistant"&&!Mt?Ce.message.branchRecordId:void 0,_a=Ce.message.role==="user"?Ce.message.content:void 0,Sa=_a!==void 0&&Ce.message.id===X.lastId&&!T&&!m&&!h?{turnIndex:X.turnIndexById.get(Ce.message.id)??0,content:_a}:void 0;return(0,u.jsx)(f7e,{message:Ce.message,onLocateBackgroundSource:Ce.message.role==="system"&&Ce.message.source==="background_notification_turn_started"&&Ce.message.backgroundTurn?.toolUseId&&Uy(We,"",Ce.message.backgroundTurn.toolUseId)>=0?om:void 0,pendingApproval:r,onShowContextDetail:o,onImagePreview:s,onAttachmentPreview:i,onTurnOutputOpen:_e,onToolResultOpen:Ye,onInsightReportOpen:l,onEditUserMessage:c&&Sa?()=>c(Sa.turnIndex,Sa.content):void 0,onSubmitUserMessageEdit:d&&Sa?Tn=>d(Sa.turnIndex,Tn):void 0,workspaceCwd:E,showRetryHint:j,onRetryClick:K,sendFailed:Ce.message.role==="user"&&Ce.message.id===P,onRetrySend:ae,onBranchSession:se,branchRecordId:lt,showAssistantActions:Ce.message.role==="assistant"&&(Mt||jp.has(Ce.message.id)),showAssistantBranch:Ce.message.role==="assistant"&&!Mt&&!T&<!==void 0,assistantFeedbackTurnId:kd&&!Mt?Ht:void 0,assistantFeedbackPromptId:kd&&!Mt?ot:void 0,assistantFeedbackRating:kd&&!Mt&&ot?gg[ot]:void 0,onAssistantFeedbackRate:kg,isLocateFlashing:PF(Ce,rm),assistantTurnFooterInfo:Jt,turnSources:Ht?xd.get(Ht):void 0,onSourceOpen:ke,generateContent:Bt})};if(xl&&z===YC)return I;if(ts&&z===Gc)return N;let ve=z-or,Ne=zn[ve];return Ne?te(Ne):null},[xl,I,ts,N,Gc,r,p,T,Mo,Dc,$c,fe,fg,o,We,om,s,i,l,c,d,X,m,h,Bt,or,zn,rm,jp,kd,yg,gg,kg,t,E,j,K,P,ae,se,t7,ee,W,xe,ge,_e,Ye,xd,ke,it]),l7=(0,y.useCallback)(z=>z?JTe(z):void 0,[]),c7=fi?Od:e;return(0,y.useLayoutEffect)(()=>{if(p)return;let z=ui.current;if(ce.current&&!z){oa.current||(St.current=!0);return}Db.current&&!z||(bl.current||z||!oa.current)&&(oa.current||jt(!0),Zn(z?"smooth":"auto"),ui.current=!1)},[c7,am,p,Zn,jt]),(0,y.useLayoutEffect)(()=>{rr()},[c7,rr,am]),(0,u.jsx)(Gz.Provider,{value:he,children:(0,u.jsxs)("div",{ref:Fn,className:V6(Rt.list,xl&&R?Rt.listWithWelcomeHeader:void 0),"data-web-shell-message-list":!0,onClickCapture:nj,children:[Md&&(0,u.jsx)(r_e,{label:Ke("editor.sessionLoading")}),g&&!Md&&!QU&&(0,u.jsx)("div",{className:Rt.historyStatus,role:"status",children:Ke("history.loadingEarlier")}),h&&!Md&&(0,u.jsx)("div",{className:Rt.historyStatus,role:"status",children:Ke("history.capacityReached")}),b&&!Md&&!h&&(0,u.jsxs)("div",{className:Rt.historyStatus,children:[(0,u.jsx)("span",{role:"status",children:Ke("history.paginationError")}),v&&(0,u.jsx)("button",{type:"button",className:Rt.historyRetryButton,onClick:sj,children:Ke("history.retry")})]}),(0,u.jsx)(a_e,{action:J,entries:Fc,currentTurnId:Pb,currentRange:qp,hidden:!Bc||!tj,onSelect:om}),fi?(0,u.jsx)("div",{ref:ns.containerRef,className:Rt.virtualSizer,children:n7.map(z=>(0,u.jsx)("div",{"data-index":z.index,ref:oj,className:V6(Rt.virtualRow,l7(zn[z.index-or])),"data-message-row-key":String(Vc(z.index)),"data-source-block-ids":OF(zn[z.index-or],e),"data-web-shell-message-row":!0,style:{position:"absolute",top:0,left:0,right:0},children:i7(z.index)},z.key))}):Array.from({length:am},(z,te)=>{let ve=Vc(te),Ne=zn[te-or];return(0,u.jsx)("div",{"data-index":te,className:l7(Ne),"data-message-row-key":String(ve),"data-source-block-ids":OF(Ne,e),"data-web-shell-message-row":!0,children:i7(te)},ve)})]})})})),FF={en:{title:"Something went wrong",body:"An unexpected error occurred and this content could not be displayed.",retry:"Try again",reload:"Reload page"},"zh-CN":{title:"\u51FA\u4E86\u70B9\u95EE\u9898",body:"\u53D1\u751F\u610F\u5916\u9519\u8BEF\uFF0C\u65E0\u6CD5\u663E\u793A\u6B64\u5185\u5BB9\u3002",retry:"\u91CD\u8BD5",reload:"\u91CD\u65B0\u52A0\u8F7D"}},s_e={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},i_e={margin:0,fontSize:"1rem",fontWeight:600},l_e={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},c_e={appearance:"none",cursor:"pointer",padding:"0.4rem 1rem",fontSize:"0.85rem",borderRadius:"6px",border:"1px solid rgba(128, 128, 128, 0.4)",background:"transparent",color:"inherit"};function u_e({error:e,onRetry:t,language:a="en",retryMode:n="reset"}){let r=FF[a]??FF.en;return(0,u.jsxs)("div",{role:"alert",style:s_e,"data-web-shell-error":!0,children:[(0,u.jsx)("p",{style:i_e,children:r.title}),(0,u.jsx)("p",{style:l_e,children:r.body}),!1,(0,u.jsx)("button",{type:"button",style:c_e,onClick:t,children:n==="reload"?r.reload:r.retry})]})}function d_e(e,t,a=!1){return V0e(e,{safeToolProjection:a,includeSourceIdentity:!0,labels:{promptCancelled:t("request.cancelled"),branchSuccess:n=>t("branch.success",{name:n}),modelStreamInterrupted:t("error.modelStreamInterrupted"),loopDetected:t("error.loopDetected")}})}var f_e="_app_1tbv0_1",p_e="_appChat_1tbv0_66",m_e="_content_1tbv0_120",h_e="_themeDark_1tbv0_435",g_e="_themeLight_1tbv0_509",v_e="_contentHasMessages_1tbv0_591",Tp={app:f_e,appChat:p_e,content:m_e,themeDark:h_e,themeLight:g_e,contentHasMessages:v_e},w_e=1e3,y_e=40;function HU(e){if(e!==void 0)return U$(e);if(typeof window>"u")return"en";let t=new URLSearchParams(window.location.search);return U$(t.get("language")??t.get("lang")??navigator.language)}function b_e(e){let t=`${typeof e=="number"&&Number.isFinite(e)&&e>0?e:w_e}px`,a=`calc(${t} + ${y_e}px)`;return{"--chat-regular-content-width":t,"--chat-regular-shell-width":a,"--chat-content-width":t,"--chat-shell-width":a}}function k_e({blocks:e,renderMode:t="readonly",theme:a=E0.Dark,language:n,className:r,style:o,chatMaxWidth:s,workspaceCwd:i="",compactThinking:l=!1,documentExpanded:c=!0,collapseCompletedTurns:d,markdownTableMode:f="basic",virtualScrollThreshold:p,markdown:m,sourceSessionId:g,sources:h,sourceAttachments:b,sourceReferences:v,getAssistantSourcesIcon:w,onSourceOpen:k,composerTagIcons:_,artifact:T,renderToolHeaderExtra:L,parseUserMessageContent:S,renderUserMessageContent:I,renderComposerTag:R,renderComposerTagTooltip:E,renderAssistantTurnFooter:N,mcpAppBaseUrl:O}){let $=t==="document",B=!$&&(d??!0),V=$?"basic":f,G=HU(n),J=(0,y.useMemo)(()=>VF(G),[G]),Z=(0,y.useMemo)(()=>d_e(e,J,$),[e,$,J]),Q=(0,y.useMemo)(()=>mse(h??[],b??[]),[h,b]),A=(0,y.useMemo)(()=>A0e(Z),[Z]),j=(0,y.useMemo)(()=>S0e(Z),[Z]),K=(0,y.useMemo)(()=>({artifact:T,composerTagIcons:_,renderToolHeaderExtra:L,parseUserMessageContent:S,renderUserMessageContent:I,renderComposerTag:R,renderComposerTagTooltip:E,renderAssistantTurnFooter:N,compactThinking:l,collapseCompletedTurns:B,markdownTableMode:V,markdown:m,sourceReferences:v,getAssistantSourcesIcon:w}),[T,B,l,_,m,v,w,V,S,N,R,E,L,I]),P=(0,y.useRef)(null),[ae,se]=(0,y.useState)(null),Ee=(0,y.useRef)(new Set),q=[Tp.app,Tp.appChat,a===E0.Light?Tp.themeLight:Tp.themeDark,a===E0.Dark?"dark":void 0,r].filter(Boolean).join(" "),oe=(0,y.useMemo)(()=>({...o,...b_e(s)}),[s,o]);return(0,y.useLayoutEffect)(()=>{if(typeof document>"u")return;let ie=document.createElement("div");return ie.dataset.webShellPortalRoot="",ie.dataset.webShellShadcn="",document.body.appendChild(ie),se(ie),()=>{ie.remove(),se(null)}},[]),(0,y.useLayoutEffect)(()=>{let ie=P.current;if(!ie||!ae)return;let ee=null,he=()=>{ee=null;let W=getComputedStyle(ie),xe=new Set;ae.dataset.webShellShadcn="",ae.classList.toggle("dark",a===E0.Dark),ae.lang=G;for(let _e=0;_e<W.length;_e+=1){let Ye=W[_e];Ye.startsWith("--")&&(xe.add(Ye),ae.style.setProperty(Ye,W.getPropertyValue(Ye)))}for(let _e of Ee.current)xe.has(_e)||ae.style.removeProperty(_e);Ee.current=xe},ke=()=>{ee===null&&(ee=requestAnimationFrame(he))};he();let Me=new MutationObserver(ke),ge=ie;for(;ge;)Me.observe(ge,{attributes:!0,attributeFilter:["class","style","data-theme","lang"]}),ge=ge.parentElement;return window.addEventListener("resize",ke),()=>{Me.disconnect(),window.removeEventListener("resize",ke),ee!==null&&cancelAnimationFrame(ee)}},[ae,G,q,oe,a]),(0,u.jsx)(ble,{value:a,children:(0,u.jsx)(sie,{language:G,children:(0,u.jsx)(Wz.Provider,{value:O,children:(0,u.jsx)(XF.Provider,{value:ae,children:(0,u.jsx)(iie,{value:t,children:(0,u.jsx)(lie,{value:c,children:(0,u.jsx)(wse,{value:K,children:(0,u.jsx)(vse,{timeline:j,details:A,children:(0,u.jsx)(X6.Provider,{value:!1,children:(0,u.jsx)("div",{ref:P,className:q,style:oe,"data-web-shell-root":!0,"data-web-shell-shadcn":!0,"data-transcript-render-mode":t,"data-document-expanded":$?String(c):void 0,lang:G,children:(0,u.jsx)("div",{className:`${Tp.content} ${Tp.contentHasMessages}`,children:(0,u.jsx)(o_e,{messages:Z,sourceSessionId:g,sourceEntries:$?void 0:Q,onSourceOpen:k,pendingApproval:null,isResponding:!1,workspaceCwd:i,virtualScrollThreshold:$?Number.MAX_SAFE_INTEGER:p,hideSessionTimeline:$})})})})})})})})})})})})}function WU(e){let t=HU(e.language);return(0,u.jsx)(cd,{label:"web-shell-transcript-root",resetKeys:[e.blocks,t],fallback:(a,n)=>(0,u.jsx)(u_e,{error:a,onRetry:n,language:t}),children:(0,u.jsx)(k_e,{...e})})}var gt=je(mn(),1),XU="qwen-export-theme";function vd(e){return e===void 0||typeof e=="string"}function wd(e){return e===void 0||typeof e=="number"&&Number.isFinite(e)&&e>=0}function x_e(){let e=document.getElementById("transcript-document");if(!(e instanceof HTMLScriptElement))throw new Error("Transcript document envelope is missing.");let t=e.textContent??"";if(t.length>33554432)throw new Error("Transcript document exceeds the envelope budget.");if(new TextEncoder().encode(t).byteLength>33554432)throw new Error("Transcript document exceeds the envelope budget.");let a=JSON.parse(t);if(a.schemaVersion!==1||a.rendererVersion!=="0.25.2-preview.1+cf4dd6243bfd28c7"||!Array.isArray(a.blocks)||a.blocks.length>1e3||!a.metadata||typeof a.metadata!="object"||Array.isArray(a.metadata)||!vd(a.metadata.title)||!vd(a.metadata.startedAt)||!vd(a.metadata.projectName)||!vd(a.metadata.repository)||!vd(a.metadata.gitBranch)||!vd(a.metadata.model)||!vd(a.metadata.channel)||!wd(a.metadata.promptCount)||!wd(a.metadata.contextUsagePercent)||!wd(a.metadata.contextWindowSize)||!wd(a.metadata.totalTokens)||!wd(a.metadata.filesWritten)||!wd(a.metadata.linesAdded)||!wd(a.metadata.linesRemoved)||typeof a.metadata.exportedAt!="string"||typeof a.metadata.complete!="boolean"||typeof a.metadata.truncated!="boolean")throw new Error("Transcript document is incompatible with this renderer.");return a}function S_e(){try{let e=localStorage.getItem(XU);if(e==="light"||e==="dark")return e}catch{}return"dark"}function GU(e){if(!e)return;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function C_e(e){if(e!==void 0)return e>=1e6?`${e/1e6}m`:e>=1e3?`${e/1e3}k`:String(e)}function oo({label:e,value:t}){return t===void 0||t===""?null:(0,gt.jsxs)("div",{className:"document-metadata-item",children:[(0,gt.jsx)("dt",{children:e}),(0,gt.jsx)("dd",{children:t})]})}function T_e({metadata:e}){let t=e.contextUsagePercent===void 0?void 0:`${e.contextUsagePercent>100?">100":e.contextUsagePercent}%${e.contextWindowSize===void 0?"":` of ${C_e(e.contextWindowSize)}`}`;return(0,gt.jsxs)("aside",{className:"document-metadata","data-document-metadata":!0,children:[(0,gt.jsxs)("section",{children:[(0,gt.jsx)("h2",{children:"Session Info"}),(0,gt.jsxs)("dl",{children:[(0,gt.jsx)(oo,{label:"Session",value:e.title??"Qwen Code Chat Export"}),(0,gt.jsx)(oo,{label:"Started",value:GU(e.startedAt)}),(0,gt.jsx)(oo,{label:"Exported",value:GU(e.exportedAt)}),(0,gt.jsx)(oo,{label:"Project",value:e.projectName}),(0,gt.jsx)(oo,{label:"Repository",value:e.repository}),(0,gt.jsx)(oo,{label:"Branch",value:e.gitBranch}),(0,gt.jsx)(oo,{label:"Model",value:e.model}),(0,gt.jsx)(oo,{label:"Channel",value:e.channel})]})]}),(0,gt.jsxs)("section",{children:[(0,gt.jsx)("h2",{children:"Statistics"}),(0,gt.jsxs)("dl",{children:[(0,gt.jsx)(oo,{label:"Prompts",value:e.promptCount}),(0,gt.jsx)(oo,{label:"Context Usage",value:t}),(0,gt.jsx)(oo,{label:"Tokens",value:e.totalTokens?.toLocaleString()})]})]}),(0,gt.jsxs)("section",{children:[(0,gt.jsx)("h2",{children:"File Operations"}),(0,gt.jsxs)("dl",{children:[(0,gt.jsx)(oo,{label:"Files modified",value:e.filesWritten}),(0,gt.jsx)(oo,{label:"Lines added",value:e.linesAdded}),(0,gt.jsx)(oo,{label:"Lines removed",value:e.linesRemoved})]})]})]})}function __e({value:e}){let[t,a]=(0,so.useState)(S_e),[n,r]=(0,so.useState)(!0),o=(0,so.useRef)(n),s=(0,so.useRef)(null);return(0,so.useEffect)(()=>{document.documentElement.classList.toggle("dark",t==="dark"),document.documentElement.classList.toggle("light",t==="light");try{localStorage.setItem(XU,t)}catch{}},[t]),(0,so.useEffect)(()=>{o.current=n},[n]),(0,so.useEffect)(()=>{let i=()=>{s.current=o.current,(0,V9.flushSync)(()=>r(!0))},l=()=>{let c=s.current;s.current=null,c!==null&&(0,V9.flushSync)(()=>r(c))};return addEventListener("beforeprint",i),addEventListener("afterprint",l),()=>{removeEventListener("beforeprint",i),removeEventListener("afterprint",l)}},[]),(0,so.useEffect)(()=>{document.title=e.metadata.title||"Qwen Code Chat Export",requestAnimationFrame(()=>{document.body.dataset.renderComplete="true"})},[e.metadata.title]),(0,gt.jsxs)("main",{className:"document-shell",children:[(0,gt.jsxs)("header",{className:"document-header",children:[(0,gt.jsxs)("div",{children:[(0,gt.jsx)("h1",{children:e.metadata.title||"Qwen Code Chat Export"}),(0,gt.jsx)("p",{children:e.metadata.startedAt?`Started ${e.metadata.startedAt}`:`Exported ${e.metadata.exportedAt}`})]}),(!e.metadata.complete||e.metadata.truncated)&&(0,gt.jsx)("span",{className:"document-warning",children:"Partial export"}),(0,gt.jsxs)("div",{className:"document-actions","aria-label":"Document controls",children:[(0,gt.jsx)("button",{type:"button","data-document-expand-all":!0,disabled:n,onClick:()=>r(!0),children:"Expand all"}),(0,gt.jsx)("button",{type:"button","data-document-collapse-all":!0,disabled:!n,onClick:()=>r(!1),children:"Collapse all"}),(0,gt.jsx)("button",{type:"button","data-document-theme-toggle":!0,"aria-label":`Switch to ${t==="dark"?"light":"dark"} theme`,onClick:()=>a(i=>i==="dark"?"light":"dark"),children:t==="dark"?"Light theme":"Dark theme"})]})]}),(0,gt.jsxs)("div",{className:"document-content",children:[(0,gt.jsx)("div",{className:"document-transcript",children:(0,gt.jsx)(WU,{blocks:e.blocks,renderMode:"document",compactThinking:!0,documentExpanded:n,theme:t})}),(0,gt.jsx)(T_e,{metadata:e.metadata})]})]})}function KU(){return(0,so.useEffect)(()=>{document.body.dataset.renderComplete="error"},[]),(0,gt.jsxs)("main",{className:"document-error",role:"alert",children:[(0,gt.jsx)("h1",{children:"Unable to open this chat export"}),(0,gt.jsx)("p",{children:"The file is incomplete or uses an incompatible renderer version."})]})}var X9=class extends so.Component{constructor(){super(...arguments);this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,gt.jsx)(KU,{}):this.props.children}},ZU=document.getElementById("app");if(!ZU)throw new Error("Transcript document root is missing.");if(document.body.dataset.renderComplete!=="error"){let e=(0,VU.createRoot)(ZU);try{e.render((0,gt.jsx)(X9,{children:(0,gt.jsx)(__e,{value:x_e()})}))}catch{e.render((0,gt.jsx)(KU,{}))}}})();
|
|
629
|
+
`)}function h9e(e){return e.find(t=>Cn(t.status))??e[e.length-1]}function g9e(e,t,a,n=!1){if(Z6(e)){let o=e.filter(i=>Cn(i.status)&&!Is(i));if(o.length===0)return t("subagent.background");if(o.length===1&&Lo(o[0].toolName))return t("toolGroup.summary.provideInformation");let s=o.map(i=>Lo(i.toolName)?t("toolGroup.summary.provideInformation"):_U(i,t,a));return t("toolGroup.running",{name:s.join(" \xB7 "),count:o.length})}return w9e(e,t,n)||t("toolGroup.summary",{count:e.length})}function _U(e,t,a){if(hd(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if(Lo(e.toolName))return Cn(e.status)?t("toolGroup.summary.provideInformation"):t("toolGroup.summary.askedQuestions",{count:LU(e)});let{displayName:n,description:r,hideDisplayName:o}=IU(e,t,a);return[o?"":n,r].filter(Boolean).join(" ")}function IU(e,t,a){let n=Nc(e.toolName,t),r=ln(Nz(e,a),120);return{kind:mb(e),tool:e,displayName:n,description:r,elapsed:"",workspaceCwd:a,hideDisplayName:!!tpe(e)}}function v9e({tool:e,workspaceCwd:t}){let{t:a}=tt(),n=Lo(e.toolName),r=Cn(e.status),o=Is(e),s=r&&!o&&tr(e),i=Cb(s),l=!n&&r?o?a("subagent.background"):a("toolGroup.runningPrefix").trim():"";if(hd(e.toolName)||n)return(0,u.jsxs)(u.Fragment,{children:[l&&(0,u.jsxs)("span",{children:[l," "]}),_U(e,a,t)]});let c=IU(e,a,t),d=s?Bz(e,a):"",f=s?{...c,description:[c.description,d&&`(${d})`].filter(Boolean).join(" "),elapsed:TU(e,i).elapsed}:c;return(0,u.jsxs)(u.Fragment,{children:[l&&(0,u.jsxs)("span",{children:[l," "]}),(0,u.jsxs)("span",{className:pe.chatSummaryInline,children:[!f.hideDisplayName&&(0,u.jsx)("span",{className:pe.lineName,children:f.displayName}),(0,u.jsx)(P0,{info:f})]})]})}function w9e(e,t,a){let n=a?e.filter(tr).length:0;if(n>0){let f=e.length-n;return[t("toolGroup.summary.ranAgents",{count:n}),f?t("toolGroup.summary",{count:f}):""].filter(Boolean).join(" \xB7 ")}let r=0,o=0,s=0,i=0,l=0,c=0,d=0;for(let f of e){let p=f.toolName.toLowerCase();_s(p)?o++:p==="edit"||p==="editfile"||p==="write"||p==="write_file"||p==="writefile"?r++:p==="read"||p==="read_file"||p==="readfile"?s++:p==="grep"||p==="grep_search"||p==="search"||p==="glob"||p==="web_search"||p==="websearch"?i++:hd(p)?l++:Lo(p)?c+=LU(f):d++}return[r?t("toolGroup.summary.editedFiles",{count:r}):"",o?t("toolGroup.summary.ranCommands",{count:o}):"",s?t("toolGroup.summary.readFiles",{count:s}):"",i?t("toolGroup.summary.searched",{count:i}):"",l?t("toolGroup.summary.updatedTodos",{count:l}):"",c?t("toolGroup.summary.askedQuestions",{count:c}):"",d?t("toolGroup.summary.otherTools",{count:d}):""].filter(Boolean).join(" ")}function LU(e){let t=e.args?.questions;return Array.isArray(t)&&t.length>0?t.length:1}function y9e(){return(0,u.jsxs)("svg",{className:pe.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,u.jsx)("path",{d:"M12 20h9"}),(0,u.jsx)("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function AU(){return(0,u.jsxs)("svg",{className:pe.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[(0,u.jsx)("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),(0,u.jsx)("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function b9e(){return(0,u.jsxs)("svg",{className:pe.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[(0,u.jsx)("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.25"}),(0,u.jsx)("path",{d:"M1.8 7h10.4M7 1.5c1.3 1.5 2 3.3 2 5.5s-.7 4-2 5.5M7 1.5C5.7 3 5 4.8 5 7s.7 4 2 5.5",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function k9e(){return(0,u.jsxs)("svg",{className:pe.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[(0,u.jsx)("rect",{x:"2",y:"1.6",width:"10",height:"10.8",rx:"2.2",stroke:"currentColor",strokeWidth:"1.25"}),(0,u.jsx)("path",{d:"M4.5 5.2h5M4.5 7h5M4.5 8.8h5",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function x9e(){return(0,u.jsx)("svg",{className:pe.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:(0,u.jsx)("path",{d:"M3 4.2 4.2 5.4 6.1 3.3M7.5 4.5h3.6M3 9.1l1.2 1.2 1.9-2.1M7.5 9.4h3.6",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function S9e(){return(0,u.jsx)("svg",{className:pe.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:(0,u.jsx)("path",{d:"M3.4 3.2h7.2c.7 0 1.25.55 1.25 1.25v3.4c0 .7-.55 1.25-1.25 1.25H7.5L4.5 11V9.1H3.4c-.7 0-1.25-.55-1.25-1.25v-3.4c0-.7.55-1.25 1.25-1.25Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function z6(){return(0,u.jsx)("svg",{className:pe.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:(0,u.jsx)("path",{d:"M770.08 96.32c1.728.64 3.072 1.984 3.712 3.712l38.848 107.584c.64 1.728 1.984 3.104 3.712 3.712l107.584 38.848a6.144 6.144 0 0 1 0 11.584l-107.584 38.848a6.144 6.144 0 0 0-3.712 3.712l-38.848 107.584a6.144 6.144 0 0 1-11.584 0L723.36 304.32a6.144 6.144 0 0 0-3.712-3.712L612.064 261.76a6.144 6.144 0 0 1 0-11.584l107.584-38.848a6.144 6.144 0 0 0 3.712-3.712l38.848-107.584c1.184-3.2 4.704-4.8 7.872-3.68zM576 160H384q-119.296 0-203.648 84.352Q96 328.704 96 448v192q0 119.296 84.352 203.648Q264.704 928 384 928h256q119.296 0 203.648-84.352Q928 759.296 928 640V512h-64v128q0 92.8-65.6 158.4Q732.8 864 640 864H384q-92.8 0-158.4-65.6Q160 732.8 160 640V448q0-92.8 65.6-158.4Q291.2 224 384 224h192v-64zm96 248.224L568.224 512 672 615.776l45.248-45.28L658.752 512l58.496-58.496L672 408.224zM320 608V448h64v160h-64z",stroke:"currentColor",strokeWidth:"28",strokeLinejoin:"round"})})}function EU({tool:e}){let t=mb(e);return t==="agent"?(0,u.jsx)(z6,{}):t==="ask"?(0,u.jsx)(S9e,{}):t==="edit"||t==="write"?(0,u.jsx)(y9e,{}):t==="fetch"?(0,u.jsx)(b9e,{}):t==="read"?(0,u.jsx)(k9e,{}):t==="todo"?(0,u.jsx)(x9e,{}):(0,u.jsx)(AU,{})}function q6(e){let t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}function C9e(e,t){if(e.approval?.id!==t.approval?.id||e.workspaceCwd!==t.workspaceCwd||e.onTurnOutputOpen!==t.onTurnOutputOpen||e.onToolResultOpen!==t.onToolResultOpen||e.summaryOnly!==t.summaryOnly||e.forceExpanded!==t.forceExpanded||e.detailsVisible!==t.detailsVisible||e.hideHeader!==t.hideHeader||e.hideCollapsedOutput!==t.hideCollapsedOutput)return!1;let a=e.tool,n=t.tool;return a.callId===n.callId&&a.toolName===n.toolName&&a.status===n.status&&a.subagentSessionReady===n.subagentSessionReady&&a.startTime===n.startTime&&a.endTime===n.endTime&&a.subContent===n.subContent&&a.rawOutput===n.rawOutput&&a.toolResult===n.toolResult&&a.wasCancelled===n.wasCancelled&&a.args===n.args&&a.content===n.content&&a.locations===n.locations&&a.title===n.title&&T9e(a.subTools,n.subTools)}function T9e(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let a=0;a<e.length;a++){let n=e[a],r=t[a];if(n.callId!==r.callId||n.toolName!==r.toolName||n.status!==r.status||n.subagentSessionReady!==r.subagentSessionReady||n.endTime!==r.endTime||n.rawOutput!==r.rawOutput||n.toolResult!==r.toolResult||n.wasCancelled!==r.wasCancelled||n.args!==r.args||n.subContent!==r.subContent||n.title!==r.title)return!1}return!0}var yF=/\[([^\]]+)\]\(qwen-session:\/\/([^)]+)\)/g;function WC(e,t){if(!e||!e.includes("qwen-session://"))return e;let a=[],n=0,r;for(yF.lastIndex=0;(r=yF.exec(e))!==null;){r.index>n&&a.push(e.slice(n,r.index));let o=r[2];a.push(t!=="interactive"?(0,u.jsx)("span",{style:{textDecoration:"underline"},children:r[1]},r.index):(0,u.jsx)("a",{href:"#",role:"button",style:{textDecoration:"underline",cursor:"pointer"},onClick:s=>{s.preventDefault(),s.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:o}))},children:r[1]},r.index)),n=r.index+r[0].length}return n<e.length&&a.push(e.slice(n)),a.length===1?a[0]:(0,u.jsx)(u.Fragment,{children:a})}var U6=(0,y.memo)(function({tool:e,approval:t,workspaceCwd:a,onTurnOutputOpen:n,onToolResultOpen:r,summaryOnly:o=!1,forceExpanded:s=!1,detailsVisible:i=!0,hideHeader:l=!1,hideCollapsedOutput:c=!1}){let{t:d}=tt(),f=Ma(),p=kb(),m=pq(),{hostOwnsEditDiffPreview:g}=Ao(),h=m!==void 0,b=G0(e.rawOutput),v=s||!!b,w=t?.toolCallId===e.callId,k=!!(g&&w&&t?.hasDiffPreview&&Xy(t?.toolName??e.toolName)),_=k,[T,L]=(0,y.useState)(!1),[S,I]=(0,y.useState)(()=>v||!o&&wF(e)&&!_),R=(0,y.useRef)(null),E=(0,y.useRef)(!1),N=c9(e.toolName);(0,y.useEffect)(()=>{I(v||!o&&wF(e)&&!_),L(!1),R.current=null,E.current=!1},[v,_,h,o,e.callId,e.toolName]);let O=tr(e),$=!w&&t?.toolCallId&&O&&Ls(e,t.toolCallId),B=!!(k||g&&$&&t?.hasDiffPreview&&Xy(t.toolName??"")),V=Cn(e.status),G=V&&!_s(e.toolName)&&!q6(e.toolName)&&!B,J=Cb(G);if((0,y.useEffect)(()=>{!v&&!O&&e.status==="completed"&&!E.current&&I(!1)},[v,O,e.status]),O){let X=TU(e,J),de=X.explicitAgentType?`${d("agent.label")} (${J0(X.explicitAgentType,d)})`:d("agent.label"),ye=e.status==="completed"||e.status==="failed",qe=Is(e),Qe=[qe&&!ye?d("subagent.background"):e.status==="pending"?d("subagent.pending"):d("subagent.running"),qe&&!ye||B?"":X.elapsed].filter(Boolean).join(" \xB7 "),vt=[X.subToolCount>0?d("subagent.toolsCount",{count:X.subToolCount}):"",X.elapsed,X.tokens,X.reason?ln(X.reason,80):""].filter(Boolean).join(" \xB7 "),zt=s||S||!!$,nt=!!w,Ve=li(e),Ct=(0,u.jsx)(w9,{tool:e,approval:g?t:void 0,hideHeader:!0,defaultExpanded:!0,inline:!0});if(p&&!l){let We=(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(z6,{}),(0,u.jsx)(Mp,{status:ye?X.status:e.status}),(0,u.jsx)("span",{className:pe.lineName,children:de}),(0,u.jsx)(P0,{info:{kind:"agent",tool:e,displayName:de,description:X.description?ln(X.description,60):"",elapsed:ye?vt:Qe,workspaceCwd:a}})]});return(0,u.jsx)("div",{className:pe.line,"data-transcript-tool-call-id":e.callId,children:nt?(0,u.jsx)("div",{className:`${pe.lineMain} ${pe.lineButton}`,"aria-disabled":"true",children:We}):(0,u.jsxs)("button",{type:"button",className:`${pe.lineMain} ${pe.lineExpandable} ${pe.lineButton}`,"aria-disabled":!!Ve||void 0,title:Ve?d(Ve):void 0,onClick:()=>{Ve||p.onOpen(e)},children:[We,(0,u.jsx)("span",{className:pe.lineChevronRight,"aria-hidden":"true"})]})})}return(0,u.jsxs)("div",{className:pe.line,"data-transcript-tool-call-id":e.callId,children:[!l&&(0,u.jsxs)("div",{className:`${pe.lineMain} ${nt?"":pe.lineExpandable}`,"aria-disabled":!!Ve||void 0,title:Ve?d(Ve):void 0,onClick:nt||Ve?void 0:()=>I(!S),children:[(0,u.jsx)(z6,{}),(0,u.jsx)(Mp,{status:ye?X.status:e.status}),(0,u.jsx)("span",{className:pe.lineName,children:de}),(0,u.jsx)(P0,{info:{kind:"agent",tool:e,displayName:de,description:X.description?ln(X.description,60):"",elapsed:ye?vt:Qe,workspaceCwd:a}}),!nt&&(0,u.jsx)("span",{className:S?pe.lineChevronDown:pe.lineChevronRight,"aria-hidden":"true"})]}),zt&&(0,u.jsx)("div",{className:pe.lineDetail,children:l?(0,u.jsx)("div",{className:pe.expandedAgentCard,children:Ct}):Ct})]})}let Z=rb(e,a),Q=ape(e),A=_s(e.toolName)?Nz(e,a):Z,j=Nc(e.toolName,d),K=B||_s(e.toolName)||q6(e.toolName)?"":Op(e.startTime,V?J:e.endTime),P=e.toolName.toLowerCase(),ae=P==="monitor"&&h&&!T&&!l,se=hd(P),Ee=se?Xz(e):void 0,q=!!Ee&&Ee.length>0,oe=Ee?Ee.filter(X=>X.status==="completed").length:0,ie=_s(P),ee=P==="grep"||P==="grep_search"||P==="search"||P==="glob",he=P==="read"||P==="read_file"||P==="readfile",ke=i9(P),Me=i&&(he||Xy(P)||P==="display_image"||P==="zoom_image")?(0,u.jsx)(W6e,{tool:e,workspaceCwd:a,onOpen:n}):void 0,ge=!se&&m9e(A),W=!v&&!_,xe=ae||W,_e=()=>{E.current=!0,I(X=>!X)},Ye=()=>{L(!0),W&&_e()},it=()=>{m&&CU(R,()=>m.onOpen(e),Ye)},Bt=X6e(e),na=S&&ge,ue=he||ke,Ke=na&&!ie&&!ee&&!he,fe=Z,Pe=S&&!Bt&&(!se||!q&&!Q);return(0,u.jsxs)("div",{className:pe.line,"data-transcript-tool-call-id":e.callId,children:[l&&V&&K&&(0,u.jsx)("div",{className:pe.lineMain,children:(0,u.jsx)(P0,{info:{kind:mb(e),tool:e,displayName:j,description:"",elapsed:K,workspaceCwd:a}})}),!l&&(0,u.jsxs)("div",{className:`${pe.lineMain} ${xe?pe.lineExpandable:""}`,title:ae?void 0:W?d(S?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":ae?void 0:W?S:void 0,role:xe?"button":void 0,tabIndex:xe?0:void 0,onClick:xe?()=>{if(ae){it();return}_e()}:void 0,onKeyDown:xe?X=>{if(!(X.key!=="Enter"&&X.key!==" ")){if(X.preventDefault(),ae){it();return}_e()}}:void 0,children:[(0,u.jsx)(EU,{tool:e}),(0,u.jsx)(Mp,{status:e.status}),(0,u.jsx)("span",{className:pe.lineName,children:j}),se&&q&&(0,u.jsxs)("span",{className:pe.todoProgress,children:[oe,"/",Ee.length]}),(0,u.jsx)(P0,{info:{kind:mb(e),tool:e,displayName:j,description:se||Ke?"":A,elapsed:se?"":K,workspaceCwd:a}}),xe&&(0,u.jsx)("span",{className:!ae&&S?pe.lineChevronDown:pe.lineChevronRight,"aria-hidden":"true"})]}),b&&(!o||S)&&(0,u.jsx)(F6e,{display:b}),!b&&(!o||S)&&se&&q&&(0,u.jsx)(i9e,{tool:e,todos:Ee,expanded:S,title:j}),!b&&(!o||S)&&se&&!q&&Q&&(0,u.jsx)("div",{className:pe.lineOutput,children:WC(Q,f)}),!b&&Pe&&(0,u.jsx)(F0,{title:j,detail:fe,status:e.status,action:Me,children:Q&&(0,u.jsx)("div",{className:`${pe.lineOutput} ${pe.expandedLineOutput}`,children:WC(Q,f)})}),!b&&!se&&!c&&Q&&!Pe&&(!S||!Bt)&&(!o||S)&&(0,u.jsx)("div",{className:S?`${pe.lineOutput} ${pe.expandedLineOutput}`:pe.lineOutput,children:WC(Q,f)}),!b&&!se&&S&&Bt&&(!N||i)&&(0,u.jsx)("div",{className:N?`${pe.lineDetail} ${pe.workflowLineDetail}`:ue?`${pe.lineDetail} ${pe.markdownLineDetail}`:pe.lineDetail,children:N?(0,u.jsx)(l9e,{tool:e,displayName:j,detail:fe,result:Q}):ie?(0,u.jsx)(nxe,{tool:e}):he?(0,u.jsx)(F0,{title:j,status:e.status,action:Me,children:(0,u.jsx)(a9e,{tool:e})}):(0,u.jsxs)(F0,{title:j,detail:fe,status:e.status,action:Me,children:[(P==="write_file"||P==="writefile")&&(0,u.jsx)(vF,{tool:e}),(P==="edit"||P==="write"||P==="editfile")&&(0,u.jsx)(vF,{tool:e}),Lo(e.toolName)&&(0,u.jsx)(u9e,{tool:e}),u9(P)&&(0,u.jsx)(d9e,{tool:e}),ke&&(0,u.jsx)(ci,{content:Pz(e)??""})]})}),e.toolResult&&(0,u.jsx)(V6e,{result:e.toolResult,onOpen:r})]})},C9e),_9e=(0,y.memo)(function({isStreaming:e,expanded:t,documentMode:a,translateContent:n,generateContent:r,onToggle:o}){let{language:s,t:i}=tt();return(0,u.jsxs)("div",{className:`${pe.chatSummaryThoughtHeader}${t?` ${pe.chatSummaryThoughtHeaderExpanded}`:""}`,onClick:l=>{!a&&l.currentTarget.contains(l.target)&&o()},children:[(0,u.jsxs)("button",{type:"button",disabled:a,tabIndex:a?-1:void 0,className:pe.chatSummaryThoughtSummary,"data-testid":"compact-thinking-summary","aria-expanded":a?void 0:t,title:a?void 0:i(t?"thinking.collapse":"thinking.expand"),children:[(0,u.jsx)("span",{className:pe.chatSummaryThoughtIcon,"aria-hidden":"true",children:(0,u.jsx)(h9,{})}),(0,u.jsx)("span",{className:`${pe.chatSummaryThoughtLabel}${e?` ${pe.chatSummaryThoughtLabelActive}`:""}`,children:i(e?"thinking.running":"thinking.done")})]}),s==="zh-CN"&&n!==void 0&&r&&(0,u.jsx)(zz,{content:n,generateContent:r,className:pe.chatSummaryThoughtTranslate}),(0,u.jsx)("span",{className:t?pe.chatSummaryThoughtChevronDown:pe.chatSummaryThoughtChevronRight,"aria-hidden":"true"})]})}),GC=(0,y.memo)(function({content:e,isStreaming:t,generateContent:a}){let n=Ma()==="document",r=vb(),[o,s]=(0,y.useState)(!1),i=n?r:o,l=(0,y.useCallback)(()=>{n||s(c=>!c)},[n]);return(0,u.jsxs)("div",{className:pe.chatSummaryThought,children:[(0,u.jsx)(_9e,{isStreaming:t,expanded:i,documentMode:n,translateContent:n||t?void 0:e,generateContent:a,onToggle:l}),i&&(0,u.jsx)("div",{className:pe.chatSummaryThoughtContent,children:(0,u.jsx)(ci,{content:e,source:"thinking",isStreaming:t})})]})}),I9e=(0,y.memo)(function({tools:e,compactSummary:t=!1,thoughts:a,pendingApproval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,isLocateFlashing:i=!1,generateContent:l}){let{t:c}=tt(),d=Ma()==="document",f=vb(),p=kb(),m=pq(),g=m!==void 0,[h,b]=(0,y.useState)(!1),[v,w]=(0,y.useState)(!1),k=d?f:v,_=(0,y.useRef)(null),T=Z6(e),L=e.find(q=>Cn(q.status)&&!Is(q))??(e.length>0?h9e(e):void 0),S=e.length===1?e[0]:void 0,I=!!a?.length,R=S&&tr(S)?S:void 0,E=S&&S.toolName.toLowerCase()==="monitor"?S:void 0,N=(S?G0(S.rawOutput):void 0)?.resourceUri,O=e.some(q=>G0(q.rawOutput)),$=e.some(q=>c9(q.toolName)),B=e.some(q=>Cn(q.status)&&!Is(q)),V=a?.find(q=>q.isStreaming),G=T&&B?!0:V!==void 0,J=!G&&e.some(q=>Cn(q.status)&&Is(q)),Z=!!(!t&&R&&p),Q=!!(!t&&E&&g&&!h),A=Z||Q,j=!t&&R?li(R):void 0,K=T?L??e[0]:e[0],P=n?.toolCallId&&e.some(q=>Ls(q,n.toolCallId)),ae=new Map,se=new Set;for(let q=0;t&&q<e.length;q++){if(!tr(e[q]))continue;let oe=q+1;for(;oe<e.length&&tr(e[oe]);)oe++;if(oe-q>=2){let ie=e.slice(q,oe);ae.set(ie[0].callId,ie);for(let ee of ie.slice(1))se.add(ee.callId)}q=oe-1}(0,y.useEffect)(()=>{b(!1),w(!1),_.current=null},[g,E?.callId]),(0,y.useEffect)(()=>{(N||O)&&w(!0)},[N,O]);let Ee=()=>{!E||!m||CU(_,()=>m.onOpen(E),()=>{b(!0),w(q=>!q)})};return P?(0,u.jsx)("div",{className:`${pe.group}${i?` ${pl.flash}`:""}`,children:e.map(q=>(0,u.jsx)(U6,{tool:q,approval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,forceExpanded:d},q.callId))}):(0,u.jsxs)("div",{className:i?pl.flash:void 0,children:[(0,u.jsxs)("button",{type:"button",disabled:d,"aria-disabled":!!j||void 0,tabIndex:d?-1:void 0,className:pe.chatSummary,onClick:()=>{if(!(d||j)){if(Z&&R&&p){p.onOpen(R);return}if(Q&&E&&m){Ee();return}w(q=>!q)}},"aria-expanded":d||A?void 0:v,title:j?c(j):d||A?void 0:c(k?"tool.collapseHint":"tool.expand"),children:[(0,u.jsx)("span",{className:J?`${pe.chatSummaryIcon} ${pe.chatSummaryIconDetached}`:pe.chatSummaryIcon,"aria-hidden":"true",children:V?(0,u.jsx)(h9,{}):K?(0,u.jsx)(EU,{tool:K}):(0,u.jsx)(AU,{})}),(0,u.jsx)("span",{className:G?`${pe.chatSummaryText} ${pe.chatSummaryTextActive}`:pe.chatSummaryText,children:V?c("thinking.running"):S?(0,u.jsx)(v9e,{tool:S,workspaceCwd:r}):g9e(e,c,r,t)}),(0,u.jsx)("span",{className:k?pe.chatChevronDown:pe.chatChevronRight,"aria-hidden":"true"})]}),(k||O||$)&&(0,u.jsx)("div",{"aria-hidden":!k,ref:q=>{q?.toggleAttribute("inert",!k)},className:k?pe.chatSummaryContentClip:`${pe.chatSummaryContentClip} ${pe.chatSummaryContentCollapsed}`,style:!k&&O&&!$?{display:"none"}:void 0,children:(0,u.jsx)("div",{className:pe.chatSummaryContentInner,children:(0,u.jsxs)("div",{className:`${pe.group} ${pe.chatSummaryGroup}`,children:[e.map(q=>{if(se.has(q.callId))return null;let oe=ae.get(q.callId);return(0,u.jsxs)(y.Fragment,{children:[a?.filter(ie=>ie.beforeToolCallId===q.callId).map((ie,ee)=>(0,u.jsx)(GC,{content:ie.content,isStreaming:ie.isStreaming,generateContent:l},`thought-${q.callId}-${ee}`)),oe?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{className:pe.chatSummaryParallelAgents,"data-testid":"compact-parallel-agents",children:(0,u.jsx)(dq,{agents:oe,pendingApproval:n})}),oe.slice(1).flatMap(ie=>a?.filter(ee=>ee.beforeToolCallId===ie.callId).map((ee,he)=>(0,u.jsx)(GC,{content:ee.content,isStreaming:ee.isStreaming,generateContent:l},`thought-${ie.callId}-${he}`)))]}):(0,u.jsx)(U6,{tool:q,approval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,summaryOnly:!S||I,forceExpanded:d||!!S&&!I,detailsVisible:k,hideHeader:!!S&&!I})]},q.callId)}),a?.filter(q=>q.beforeToolCallId===void 0).map((q,oe)=>(0,u.jsx)(GC,{content:q.content,isStreaming:q.isStreaming,generateContent:l},`thought-trailing-${oe}`))]})})})]})}),G9="summary-",z0=e=>`${G9}${e}`,RU=e=>e.startsWith(G9),hb=e=>RU(e)?e.slice(G9.length):void 0,L9e="_message_1ujhf_1",A9e="_header_1ujhf_6",E9e="_headerStatic_1ujhf_7",R9e="_chevron_1ujhf_24",M9e="_title_1ujhf_30",N9e="_progress_1ujhf_39",Ic={message:L9e,header:A9e,headerStatic:E9e,chevron:R9e,title:M9e,progress:N9e};function P9e({id:e,todos:t}){let a=(0,y.useContext)(K6).get(e)?.events??[];return(0,u.jsx)(mq,{todos:t,events:a})}var O9e=(0,y.memo)(function({id:e,todos:t,isLocateFlashing:a=!1}){let{t:n}=tt(),r=Ma()==="document",o=vb(),[s,i]=(0,y.useState)(!1);if(t.length===0)return null;let l=r?o:s,c=t.length,d=t.filter(f=>f.status==="completed").length;return(0,u.jsxs)("div",{className:`${Ic.message}${a?` ${pl.flash}`:""}`,children:[r?(0,u.jsxs)("div",{className:Ic.headerStatic,children:[(0,u.jsx)("span",{className:Ic.title,children:n("plan.title")}),(0,u.jsxs)("span",{className:Ic.progress,children:[d,"/",c]})]}):(0,u.jsxs)("button",{type:"button",className:Ic.header,onClick:()=>i(f=>!f),"aria-expanded":s,title:n(s?"todo.collapse":"todo.expand"),children:[(0,u.jsx)("span",{className:Ic.chevron,"aria-hidden":"true",children:s?"\u25BE":"\u25B8"}),(0,u.jsx)("span",{className:Ic.title,children:n("plan.title")}),(0,u.jsxs)("span",{className:Ic.progress,children:[d,"/",c]})]}),l?(0,u.jsx)(hq,{todos:t,numbered:!0}):(0,u.jsx)(P9e,{id:e,todos:t})]})}),D9e="_message_1abcu_1",$9e="_content_1abcu_11",B9e="_question_1abcu_17",F9e="_prefix_1abcu_24",z9e="_answer_1abcu_28",q9e="_pending_1abcu_32",U9e="_shortcuts_1abcu_36",ad={message:D9e,content:$9e,question:B9e,prefix:F9e,answer:z9e,pending:q9e,shortcuts:U9e},j9e=(0,y.memo)(function({question:e,answer:t,isPending:a}){let{t:n}=tt();return(0,u.jsxs)("div",{className:ad.message,children:[(0,u.jsxs)("div",{className:ad.content,children:[(0,u.jsxs)("div",{className:ad.question,children:[(0,u.jsx)("span",{className:ad.prefix,children:"/btw "}),(0,u.jsx)("span",{children:e})]}),(0,u.jsx)("div",{className:ad.answer,children:a?(0,u.jsx)("span",{className:ad.pending,children:n("btw.answering")}):(0,u.jsx)(ci,{content:t})})]}),(0,u.jsx)("div",{className:ad.shortcuts,children:n(a?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),H9e="_message_1g0wi_1",W9e="_header_1g0wi_21",G9e="_status_1g0wi_30",V9e="_name_1g0wi_35",X9e="_command_1g0wi_42",K9e="_output_1g0wi_51",Cp={message:H9e,header:W9e,status:G9e,name:V9e,command:X9e,output:K9e},Z9e=(0,y.memo)(function({command:e,output:t}){let{t:a}=tt();return(0,u.jsxs)("div",{className:Cp.message,children:[(0,u.jsxs)("div",{className:Cp.header,children:[(0,u.jsx)("span",{className:Cp.status,children:"\u2713"}),(0,u.jsx)("span",{className:Cp.name,children:a("shell.command")}),e&&(0,u.jsx)("span",{className:Cp.command,children:e})]}),t&&(0,u.jsx)("pre",{className:Cp.output,children:t})]})}),Q9e="_progress_1ik59_1",Y9e="_spinner_1ik59_12",J9e="_bar_1ik59_19",e7e="_stage_1ik59_25",t7e="_icon_1ik59_29",a7e="_done_1ik59_35",n7e="_error_1ik59_43",r7e="_detail_1ik59_51",o7e="_path_1ik59_56",s7e="_pathButton_1ik59_61",On={progress:Q9e,spinner:Y9e,bar:J9e,stage:e7e,icon:t7e,done:a7e,error:n7e,detail:r7e,path:o7e,pathButton:s7e},bF=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827"];function i7e({progress:e}){let{stage:t,progress:a,detail:n,isComplete:r,error:o}=e,[s,i]=(0,y.useState)(0),l=30,c=Math.round(a/100*l),d=l-c,f="\u2588".repeat(Math.max(0,c))+"\u2591".repeat(Math.max(0,d));return(0,y.useEffect)(()=>{if(r||o)return;let p=setInterval(()=>{i(m=>(m+1)%bF.length)},120);return()=>clearInterval(p)},[r,o]),o?(0,u.jsxs)("div",{className:`${On.progress} ${On.error}`,children:[(0,u.jsx)("span",{className:On.icon,children:"\u2715"}),(0,u.jsx)("span",{className:On.stage,children:t}),(0,u.jsx)("div",{className:On.detail,children:o})]}):r?(0,u.jsxs)("div",{className:`${On.progress} ${On.done}`,children:[(0,u.jsx)("span",{className:On.icon,children:"\u2713"}),(0,u.jsx)("span",{className:On.stage,children:t})]}):(0,u.jsxs)("div",{className:On.progress,children:[(0,u.jsx)("span",{className:On.spinner,children:bF[s]}),(0,u.jsx)("span",{className:On.bar,children:f}),(0,u.jsxs)("span",{className:On.stage,children:[t,n?` (${n})`:""]})]})}function l7e({path:e,onInsightReportOpen:t}){let{t:a}=tt();return(0,u.jsxs)("div",{className:`${On.progress} ${On.done}`,children:[(0,u.jsx)("span",{className:On.icon,children:"\u2713"}),(0,u.jsx)("span",{className:On.stage,children:a("insight.ready")}),t?(0,u.jsx)("button",{type:"button",className:`${On.path} ${On.pathButton}`,onClick:()=>t(e),children:e}):(0,u.jsx)("span",{className:On.path,children:e})]})}var c7e=(0,y.createContext)(void 0);function u7e(e,t){return e!=="background_notification"&&e!=="mid_turn_message_injected"&&e!=="goal_runtime"&&e!=="goal_control"&&(e!=="cron"||t.trim().length>0)}function d7e(){return(0,y.useContext)(c7e)}var f7e=(0,y.memo)(function({message:e,pendingApproval:t,onShowContextDetail:a,onLocateBackgroundSource:n,onImagePreview:r,onAttachmentPreview:o,onTurnOutputOpen:s,onToolResultOpen:i,onInsightReportOpen:l,workspaceCwd:c,showRetryHint:d=!1,onRetryClick:f,sendFailed:p=!1,onRetrySend:m,onEditUserMessage:g,onSubmitUserMessageEdit:h,onBranchSession:b,branchRecordId:v,showAssistantActions:w=!1,showAssistantBranch:k=!1,assistantFeedbackTurnId:_,assistantFeedbackPromptId:T,assistantFeedbackRating:L,onAssistantFeedbackRate:S,isLocateFlashing:I=!1,assistantTurnFooterInfo:R,turnSources:E,onSourceOpen:N,generateContent:O}){let{t:$}=tt(),[B,V]=(0,y.useState)(!1),[G,J]=(0,y.useState)(!1),Z=(0,y.useCallback)(()=>{g?.()!==!0&&V(!0)},[g]),Q=(0,y.useCallback)(()=>{V(!1)},[]),A=(0,y.useCallback)(ke=>{h&&(J(!0),Promise.resolve(h(ke)).catch(()=>!1).then(Me=>{J(!1),Me!==!1&&V(!1)}))},[h]),j=(0,y.useMemo)(()=>b&&v?()=>b(v):void 0,[b,v]),K=(0,y.useMemo)(()=>S&&T?ke=>S(T,_??"",ke):void 0,[S,T,_]),P=(0,y.useContext)(X6),ae=e.role==="tool_group"&&e.tools.length===1&&l9(e.tools[0])?e.tools[0]:void 0,se=ae?epe(ae):null,Ee=!!se||e.role==="user"||e.role==="system"&&e.source==="mid_turn_message_injected",q=d7e(),oe=(()=>{switch(e.role){case"user":return(0,u.jsx)(Ez,{content:e.content,images:e.images,files:e.files,inputAnnotations:e.inputAnnotations,isLocateFlashing:I,sendFailed:p,onRetrySend:m,editing:B,submittingEdit:G,onEditSubmit:A,onEditCancel:Q,onImagePreview:r,onAttachmentPreview:o,author:e.author});case"assistant":return(0,u.jsx)(wme,{content:e.content,author:e.author,agentMessage:e.agentMessage,isStreaming:e.isStreaming,timestamp:e.timestamp,onBranchSession:j,showFooterActions:w,showBranchAction:k,showAssistantFeedback:T!==void 0,assistantFeedbackRating:L,onAssistantFeedbackRate:K,isLocateFlashing:I,customFooterInfo:R,turnSources:E,onSourceOpen:N});case"thinking":return(0,u.jsx)(Cme,{content:e.content,author:e.author,isStreaming:e.isStreaming,timestamp:e.timestamp,isLocateFlashing:I,generateContent:O});case"tool_group":return ae&&!se&&!md(ae)?.trim()?null:se&&ae?!se.answers.length&&!se.text.trim()?null:(0,u.jsx)(Qfe,{tool:ae,result:se,isLocateFlashing:I}):(0,u.jsx)(I9e,{tools:e.tools,onTurnOutputOpen:s,onToolResultOpen:i,thoughts:e.thoughts,compactSummary:P&&RU(e.id),pendingApproval:t,workspaceCwd:c,isLocateFlashing:I,generateContent:O});case"plan":return(0,u.jsx)(O9e,{id:e.id,todos:e.todos,isLocateFlashing:I});case"system":return(0,u.jsx)(_be,{content:e.content,variant:e.variant,source:e.source,data:e.data,images:e.images,files:e.files,onShowContextDetail:a,onLocateBackgroundSource:n,onImagePreview:r,onAttachmentPreview:o,showRetryHint:d&&e.retryable===!0,onRetryClick:f});case"user_shell":return(0,u.jsx)(Z9e,{command:e.command,output:e.output});case"btw":return(0,u.jsx)(j9e,{question:e.question,answer:e.answer,isPending:e.isPending});case"insight_progress":return(0,u.jsx)(i7e,{progress:{stage:e.stage,progress:e.progress,detail:e.detail}});case"insight_ready":return(0,u.jsx)(l7e,{path:e.path,onInsightReportOpen:l});case"insight_error":return(0,u.jsx)("div",{style:{color:"var(--error-color, #e06c75)"},children:e.error});default:return null}})();if(oe===null)return null;let ie=(0,u.jsx)(cd,{label:`message:${e.role}`,resetKeys:[e],fallback:(0,u.jsx)(p7e,{align:Ee?"end":"start"}),children:oe}),ee=(0,u.jsx)("div",{"data-user-selectable":"true",style:{display:"contents"},children:ie});if(e.role==="assistant")return w?ee:(0,u.jsx)(n6,{timestamp:e.timestamp,children:ee});if(e.role==="system"&&e.source==="prompt_cancelled")return ee;let he=q&&e.role==="user"&&u7e(e.source,e.content)?e.id:void 0;return(0,u.jsx)(n6,{timestamp:e.timestamp,hideTimestamp:e.role==="system"&&(e.source==="background_task_completed"||e.source==="background_notification_turn_started"),chatMode:Ee,toolGroupSpacing:e.role==="tool_group"&&P,copyText:Ee&&"content"in e?e.content:void 0,copyTitle:$("common.copy"),onEdit:g&&!B?Z:void 0,editTitle:$("userMessage.edit"),onOpenTurnCalls:q&&he?()=>q(he):void 0,turnCallsTitle:$("turnCalls.open"),children:ee})},m7e);function p7e({align:e}){let{t}=tt();return(0,u.jsx)("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:(0,u.jsx)("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function m7e(e,t){return e.pendingApproval?.id!==t.pendingApproval?.id||e.onShowContextDetail!==t.onShowContextDetail||e.onLocateBackgroundSource!==t.onLocateBackgroundSource||e.onImagePreview!==t.onImagePreview||e.onAttachmentPreview!==t.onAttachmentPreview||e.onTurnOutputOpen!==t.onTurnOutputOpen||e.onToolResultOpen!==t.onToolResultOpen||e.workspaceCwd!==t.workspaceCwd||e.showRetryHint!==t.showRetryHint||e.onRetryClick!==t.onRetryClick||e.sendFailed!==t.sendFailed||e.onRetrySend!==t.onRetrySend||e.onEditUserMessage!==t.onEditUserMessage||e.onSubmitUserMessageEdit!==t.onSubmitUserMessageEdit||e.onInsightReportOpen!==t.onInsightReportOpen||e.onBranchSession!==t.onBranchSession||e.branchRecordId!==t.branchRecordId||e.showAssistantActions!==t.showAssistantActions||e.showAssistantBranch!==t.showAssistantBranch||e.assistantFeedbackTurnId!==t.assistantFeedbackTurnId||e.assistantFeedbackPromptId!==t.assistantFeedbackPromptId||e.assistantFeedbackRating!==t.assistantFeedbackRating||e.onAssistantFeedbackRate!==t.onAssistantFeedbackRate||e.isLocateFlashing!==t.isLocateFlashing||e.generateContent!==t.generateContent||e.turnSources!==t.turnSources||e.onSourceOpen!==t.onSourceOpen||!h7e(e.assistantTurnFooterInfo,t.assistantTurnFooterInfo)?!1:v7e(e.message,t.message)}function h7e(e,t){return e===t?!0:!e||!t?!1:e.turnId===t.turnId&&e.message.id===t.message.id&&e.message.content===t.message.content&&e.message.isStreaming===t.message.isStreaming&&e.message.timestamp===t.message.timestamp}function g7e(e,t){return e===t?!0:!e||!t?!1:e.status===t.status&&e.error===t.error&&e.totalTokens===t.totalTokens&&e.squadOutcome===t.squadOutcome&&e.author?.squadName===t.author?.squadName&&e.author?.memberSquadName===t.author?.memberSquadName&&(e.steps??[]).length===(t.steps??[]).length&&(e.steps??[]).every((a,n)=>a.title===t.steps?.[n]?.title&&a.status===t.steps?.[n]?.status)}function v7e(e,t){if(e===t)return!0;if(e.id!==t.id||e.role!==t.role||e.timestamp!==t.timestamp||e.author?.name!==t.author?.name||e.author?.color!==t.author?.color)return!1;switch(e.role){case"user":return t.role==="user"&&e.content===t.content&&e.source===t.source&&xF(e.images,t.images);case"assistant":return t.role==="assistant"&&e.content===t.content&&e.isStreaming===t.isStreaming&&g7e(e.agentMessage,t.agentMessage);case"thinking":return t.role==="thinking"&&e.content===t.content&&e.isStreaming===t.isStreaming;case"system":return t.role==="system"&&e.content===t.content&&e.variant===t.variant&&e.retryable===t.retryable&&e.source===t.source&&e.data===t.data&&xF(e.images,t.images);case"user_shell":return t.role==="user_shell"&&e.command===t.command&&e.output===t.output&&e.cwd===t.cwd;case"btw":return t.role==="btw"&&e.question===t.question&&e.answer===t.answer&&e.isPending===t.isPending;case"insight_progress":return t.role==="insight_progress"&&e.stage===t.stage&&e.progress===t.progress&&e.detail===t.detail;case"insight_ready":return t.role==="insight_ready"&&e.path===t.path;case"insight_error":return t.role==="insight_error"&&e.error===t.error;case"plan":return t.role==="plan"&&w7e(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&y7e(e.thoughts,t.thoughts)&&e.tools.length===t.tools.length&&e.tools.every((a,n)=>MU(a,t.tools[n]));default:return!1}}function w7e(e,t){return e.length===t.length&&e.every((a,n)=>{let r=t[n];return r&&a.id===r.id&&a.content===r.content&&a.status===r.status&&a.priority===r.priority})}function MU(e,t){return t?e.callId===t.callId&&e.toolName===t.toolName&&e.status===t.status&&e.subagentSessionReady===t.subagentSessionReady&&e.title===t.title&&e.kind===t.kind&&e.startTime===t.startTime&&e.endTime===t.endTime&&e.subContent===t.subContent&&ii(e.args)===ii(t.args)&&ii(e.rawOutput)===ii(t.rawOutput)&&ii(e.toolResult)===ii(t.toolResult)&&e.wasCancelled===t.wasCancelled&&ii(e.locations)===ii(t.locations)&&ii(e.content)===ii(t.content)&&b7e(e.subTools,t.subTools):!1}function y7e(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((a,n)=>a.content===t[n]?.content&&a.isStreaming===t[n]?.isStreaming&&a.beforeToolCallId===t[n]?.beforeToolCallId)}function b7e(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((a,n)=>MU(a,t[n]))}var kF=new WeakMap;function xF(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((a,n)=>a.data===t[n].data&&a.mimeType===t[n].mimeType)}function ii(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=kF.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return kF.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}function SF({additions:e,deletions:t,className:a,additionsClassName:n,deletionsClassName:r}){return e===void 0||t===void 0?null:(0,u.jsxs)("span",{className:a,children:[(0,u.jsxs)("span",{className:n,children:["+",e]}),(0,u.jsxs)("span",{className:r,children:["-",t]})]})}function k7e(e){if(!e.some(t=>t.additions===void 0||t.deletions===void 0))return e.reduce((t,a)=>({additions:t.additions+(a.additions??0),deletions:t.deletions+(a.deletions??0)}),{additions:0,deletions:0})}var x7e="_root_numdi_1",S7e="_card_numdi_7",C7e="_summary_numdi_14",T7e="_icon_numdi_22",_7e="_iconSvg_numdi_33",I7e="_title_numdi_39",L7e="_artifactTitle_numdi_46",A7e="_reviewSummary_numdi_52",E7e="_reviewSummaryWithStats_numdi_59",R7e="_reviewMeta_numdi_64",M7e="_linkButton_numdi_71",N7e="_reviewButton_numdi_72",P7e="_showMoreButton_numdi_73",O7e="_actions_numdi_102",D7e="_openButtonWrapper_numdi_108",$7e="_list_numdi_132",B7e="_fileRow_numdi_139",F7e="_path_numdi_159",z7e="_lineStats_numdi_168",q7e="_additions_numdi_177",U7e="_deletions_numdi_181",j7e="_chevronIcon_numdi_195",H7e="_chevronIconOpen_numdi_203",W7e="_artifactInfo_numdi_207",G7e="_artifactMeta_numdi_212",xt={root:x7e,card:S7e,summary:C7e,icon:T7e,iconSvg:_7e,title:I7e,artifactTitle:L7e,reviewSummary:A7e,reviewSummaryWithStats:E7e,reviewMeta:R7e,linkButton:M7e,reviewButton:N7e,showMoreButton:P7e,actions:O7e,openButtonWrapper:D7e,list:$7e,fileRow:B7e,path:F7e,lineStats:z7e,additions:q7e,deletions:U7e,chevronIcon:j7e,chevronIconOpen:H7e,artifactInfo:W7e,artifactMeta:G7e},j6=3;function CF(e,t){return t?e:e.slice(0,j6)}function V7e({turnId:e,changes:t,artifacts:a,sourceSessionId:n,scheduledTasks:r,workspaceCwd:o,onOpenRequest:s,onReviewChanges:i,onOpenArtifact:l,onOpenScheduledTask:c,onError:d}){let{t:f}=tt(),{filterArtifact:p}=Ao(),m=p?a.filter(O=>p(O,{turnId:e,sourceSessionId:n})):a,g=SU(o),h=g?.actions,[b,v]=(0,y.useState)(!1),[w,k]=(0,y.useState)(!1);if(t.length===0&&m.length===0&&r.length===0)return null;let _=CF(t,b),T=t.length-j6,L=CF(m,w),S=m.length-j6,I=k7e(t),R=O=>{if(s){s({id:"review",kind:"review",title:f("turnOutputs.review"),turnId:e,changes:t,...o?{workspaceCwd:o}:{},...g?.workspaceId?{workspaceId:g.workspaceId}:{},...O?{selectedPath:O}:{}});return}i(t,O)},E=O=>{let $=Y7e(O,t,o);if(s){s({id:`artifact:${O.id}`,kind:"artifact",title:tz(O),turnId:e,artifactId:O.id,...O.managedId?{managedId:O.managedId}:{},artifact:O,...o?{workspaceCwd:o}:{},...g?.workspaceId?{workspaceId:g.workspaceId}:{},...$!==void 0?{previewContent:$}:{}});return}l(O.id,$)},N=O=>{if(s){s({id:`scheduled-task:${O.toolCallId}`,kind:"scheduled_task",title:f("scheduledTasks.title"),turnId:e,task:g?.workspaceId?{...O,workspaceId:g.workspaceId}:O,...o?{workspaceCwd:o}:{},...g?.workspaceId?{workspaceId:g.workspaceId}:{}});return}c(O)};return(0,u.jsxs)("div",{className:xt.root,children:[t.length>0&&(0,u.jsxs)("div",{className:xt.card,children:[(0,u.jsxs)("div",{className:xt.summary,children:[(0,u.jsx)("span",{className:xt.icon,"aria-hidden":"true",children:(0,u.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",focusable:"false",className:xt.iconSvg,children:[(0,u.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),(0,u.jsx)("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,u.jsx)("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),(0,u.jsxs)("div",{className:[xt.reviewSummary,I?xt.reviewSummaryWithStats:""].filter(Boolean).join(" "),children:[(0,u.jsx)("div",{className:xt.title,children:f("turnOutputs.filesEdited",{count:t.length})}),(0,u.jsxs)("div",{className:xt.reviewMeta,children:[(0,u.jsx)(SF,{additions:I?.additions,deletions:I?.deletions,className:xt.lineStats,additionsClassName:xt.additions,deletionsClassName:xt.deletions}),(0,u.jsxs)("button",{type:"button",className:xt.linkButton,onClick:()=>R(),children:[f("turnOutputs.viewChanges")," \u2197"]})]})]}),(0,u.jsx)("div",{className:xt.actions,children:(0,u.jsx)("button",{type:"button",className:xt.reviewButton,onClick:()=>R(),children:f("turnOutputs.review")})})]}),(0,u.jsxs)("div",{className:xt.list,children:[_.map(O=>(0,u.jsxs)("button",{type:"button",className:xt.fileRow,onClick:()=>R(O.path),title:O.path,children:[(0,u.jsx)("span",{className:xt.path,children:o8e(O.path,o)}),(0,u.jsx)(SF,{additions:O.additions,deletions:O.deletions,className:xt.lineStats,additionsClassName:xt.additions,deletionsClassName:xt.deletions})]},`${O.toolCallId}:${O.path}`)),T>0&&(0,u.jsxs)("button",{type:"button",className:xt.showMoreButton,onClick:()=>v(O=>!O),children:[(0,u.jsx)("span",{children:b?f("turnOutputs.collapseFiles"):f("turnOutputs.showMoreFiles",{count:T})}),(0,u.jsx)(TF,{open:b})]})]})]}),L.map(O=>{let $=n8e(O);return(0,u.jsx)(X7e,{artifact:O,externalUrl:$,onOpen:$||!NU(O)?void 0:()=>E(O),onError:d,onDownload:a8e(O)&&h?B=>Kie(h,O.workspacePath,O.mimeType,B):void 0},O.id)}),S>0&&(0,u.jsxs)("button",{type:"button",className:xt.showMoreButton,onClick:()=>k(O=>!O),children:[(0,u.jsx)("span",{children:w?f("turnOutputs.collapseArtifacts"):f("turnOutputs.showMoreArtifacts",{count:S})}),(0,u.jsx)(TF,{open:w})]}),r.map(O=>(0,u.jsx)(K7e,{task:O,scheduleLabel:oz(O.cron,f),onOpen:()=>N(O)},O.toolCallId))]})}function X7e({artifact:e,externalUrl:t,onOpen:a,onDownload:n,onError:r}){let{t:o}=tt(),s=wb(),[i,l]=(0,y.useState)(!1),c=(0,y.useRef)(!0);(0,y.useEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]);let d=Hie(e.sizeBytes),f=r8e(e,o),p=tz(e),m=async()=>{if(!(!n||i)){l(!0);try{await n(()=>!c.current)}catch(h){if(!c.current)return;let b=o("common.downloadFailed",{message:Qy(h)});r?r(new Error(b,{cause:h}),b):console.error(b,h)}finally{l(!1)}}},g=(0,u.jsx)(Oi,{size:16,strokeWidth:1.8,"aria-hidden":"true"});return(0,u.jsx)("div",{className:xt.card,children:(0,u.jsxs)("div",{className:xt.summary,children:[(0,u.jsx)("span",{className:xt.icon,"aria-hidden":"true",children:(0,u.jsx)(Jie,{artifact:e,className:xt.iconSvg})}),(0,u.jsxs)("div",{className:xt.artifactInfo,children:[(0,u.jsx)("div",{className:`${xt.title} ${xt.artifactTitle}`,children:p}),(0,u.jsx)("div",{className:xt.artifactMeta,children:[e.metadata?.artifactType==="web_preview_snapshot"?o("webPreview.saved"):jie(e),d].filter(Boolean).join(" \xB7 ")})]}),(0,u.jsxs)("div",{className:xt.actions,children:[n&&(0,u.jsxs)("button",{type:"button",className:xt.reviewButton,onClick:()=>void m(),title:`${o("common.download")} ${p}`,disabled:i,children:[(0,u.jsx)(vh,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),o(i?"common.downloading":"common.download")]}),(0,u.jsx)("span",{className:xt.openButtonWrapper,title:f??p,children:t?(0,u.jsxs)("a",{className:xt.reviewButton,href:t,target:"_blank",rel:"noopener noreferrer",onClick:h=>s(h,t),children:[g,o("common.open")]}):(0,u.jsxs)("button",{type:"button",className:xt.reviewButton,onClick:a,disabled:!a,children:[g,o("common.open")]})})]})]})})}function K7e({task:e,scheduleLabel:t,onOpen:a}){let{t:n}=tt();return(0,u.jsx)("div",{className:xt.card,children:(0,u.jsxs)("div",{className:xt.summary,children:[(0,u.jsx)("span",{className:xt.icon,"aria-hidden":"true",children:(0,u.jsx)(Z7e,{})}),(0,u.jsxs)("div",{className:xt.artifactInfo,children:[(0,u.jsx)("div",{className:xt.title,children:e.title}),(0,u.jsx)("div",{className:xt.artifactMeta,children:[t,e.recurring?n("scheduledTasks.repeats"):n("scheduledTasks.runsOnce")].filter(Boolean).join(" \xB7 ")})]}),(0,u.jsx)("div",{className:xt.actions,children:(0,u.jsx)("button",{type:"button",className:xt.reviewButton,onClick:a,title:e.title,children:n("common.open")})})]})})}function Z7e(){return(0,u.jsxs)("svg",{className:xt.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[(0,u.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),(0,u.jsx)("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function TF({open:e}){return(0,u.jsx)("svg",{className:[xt.chevronIcon,e?xt.chevronIconOpen:""].filter(Boolean).join(" "),viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:(0,u.jsx)("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}var Q7e=(0,y.memo)(V7e);function Y7e(e,t,a){if(!e8e(e)||!e.workspacePath)return;let n=t.find(r=>Zie(r.path,e.workspacePath,a));if(n)return J7e(n)}function J7e(e){for(let t=e.diffs.length-1;t>=0;t--){let a=e.diffs[t];if(a?.fullContent)return a.newText}}function e8e(e){let t=e.workspacePath?.toLowerCase()??"",a=e.mimeType?.toLowerCase()??"";return e.kind==="html"||t8e(t)||a==="text/html"||a==="text/markdown"}function t8e(e){let t=e.toLowerCase();return t.endsWith(".html")||t.endsWith(".htm")||t.endsWith(".md")||t.endsWith(".markdown")||r6(t)!==void 0}function a8e(e){return e.storage==="workspace"&&(e.status==="available"||e.status==="changed")&&!!e.workspacePath}function NU(e){return e.storage!=="workspace"?!0:e.status==="available"||e.status==="changed"}function n8e(e){if(e.kind!=="link"||e.storage==="published")return;let t=e.url?.trim();return a9(t)?t:void 0}function r8e(e,t){if(!NU(e))return e.workspacePath?t("turnOutputs.artifactUnavailable",{path:e.workspacePath}):t("turnOutputs.artifactMissing")}function o8e(e,t){return o6(e,t)}function s8e(e,t){let[a,n]=(0,y.useState)(!1);return(0,y.useLayoutEffect)(()=>{let r=e.current;if(!r||!t){n(!1);return}let o=r.closest("[data-history-viewport]")??r,s=()=>{let d=Number.parseFloat(getComputedStyle(r).getPropertyValue("--chat-regular-content-width"))||1e3;n(o.getBoundingClientRect().width>=d)};s();let i=typeof ResizeObserver>"u"?null:new ResizeObserver(s);i?.observe(o);let l=r.closest("[data-web-shell-root]"),c=new MutationObserver(s);return l&&c.observe(l,{attributes:!0,attributeFilter:["style"]}),()=>{i?.disconnect(),c.disconnect()}},[e,t]),a}var i8e="_collapseRow_d7f01_1",l8e="_collapseRowClickable_d7f01_14",c8e="_collapseLabel_d7f01_19",u8e="_processedLabel_d7f01_36",d8e="_processedMeta_d7f01_43",f8e="_hiddenMetrics_d7f01_47",p8e="_summaryMetrics_d7f01_51",m8e="_collapseIcon_d7f01_59",h8e="_chevronRight_d7f01_72",g8e="_chevronDown_d7f01_73",Ts={collapseRow:i8e,collapseRowClickable:l8e,collapseLabel:c8e,processedLabel:u8e,processedMeta:d8e,hiddenMetrics:f8e,summaryMetrics:p8e,collapseIcon:m8e,chevronRight:h8e,chevronDown:g8e},v8e="_list_nvt92_1",w8e="_listWithWelcomeHeader_nvt92_12",y8e="_historyStatus_nvt92_32",b8e="_historyRetryButton_nvt92_38",k8e="_virtualSizer_nvt92_64",x8e="_virtualRow_nvt92_73",S8e="_loadingSkeleton_nvt92_83",C8e="_srOnly_nvt92_91",T8e="_loadingSkeletonUserRow_nvt92_103",_8e="_loadingSkeletonAssistantRow_nvt92_109",I8e="_loadingSkeletonUserBubble_nvt92_115",L8e="_loadingSkeletonUserBubbleCompact_nvt92_116",A8e="_loadingSkeletonAssistantBlock_nvt92_130",E8e="_loadingSkeletonLineWide_nvt92_138",R8e="_loadingSkeletonLineMedium_nvt92_139",M8e="_loadingSkeletonLineShort_nvt92_140",N8e="_loadingSkeletonLineNarrow_nvt92_141",P8e="_turnStatusRow_nvt92_181",O8e="_turnAnswerRow_nvt92_182",D8e="_turnContentRow_nvt92_193",$8e="_sessionTimelineLayer_nvt92_197",B8e="_sessionTimelinePanel_nvt92_210",F8e="_sessionTimelineViewport_nvt92_226",z8e="_sessionTimelineList_nvt92_275",q8e="_sessionTimelineItem_nvt92_285",U8e="_sessionTimelineButton_nvt92_290",j8e="_sessionTimelineTick_nvt92_310",H8e="_sessionTimelineButtonInRange_nvt92_400",W8e="_sessionTimelineButtonCurrent_nvt92_404",G8e="_sessionTimelineDetails_nvt92_415",V8e="_sessionTimelineDetailsTitle_nvt92_453",X8e="_sessionTimelineDetailsIcon_nvt92_460",K8e="_sessionTimelineDetailsTitleText_nvt92_472",Z8e="_sessionTimelineDetailsDetail_nvt92_482",Rt={list:v8e,listWithWelcomeHeader:w8e,historyStatus:y8e,historyRetryButton:b8e,virtualSizer:k8e,virtualRow:x8e,loadingSkeleton:S8e,srOnly:C8e,loadingSkeletonUserRow:T8e,loadingSkeletonAssistantRow:_8e,loadingSkeletonUserBubble:I8e,loadingSkeletonUserBubbleCompact:L8e,loadingSkeletonAssistantBlock:A8e,loadingSkeletonLineWide:E8e,loadingSkeletonLineMedium:R8e,loadingSkeletonLineShort:M8e,loadingSkeletonLineNarrow:N8e,turnStatusRow:P8e,turnAnswerRow:O8e,turnContentRow:D8e,sessionTimelineLayer:$8e,sessionTimelinePanel:B8e,sessionTimelineViewport:F8e,sessionTimelineList:z8e,sessionTimelineItem:q8e,sessionTimelineButton:U8e,sessionTimelineTick:j8e,sessionTimelineButtonInRange:H8e,sessionTimelineButtonCurrent:W8e,sessionTimelineDetails:G8e,sessionTimelineDetailsTitle:V8e,sessionTimelineDetailsIcon:X8e,sessionTimelineDetailsTitleText:K8e,sessionTimelineDetailsDetail:Z8e},VC=()=>{},Q8e=15e3,XC=180,Y8e=400,_F=5e3;function J8e(e,t){if(!e||e.length!==t.length||t.length===0)return!1;for(let r=0;r<t.length-1;r+=1)if(e[r]!==t[r])return!1;let a=e[e.length-1],n=t[t.length-1];return a.id!==n.id||a.role!==n.role||n.role!=="assistant"&&n.role!=="thinking"||a.role!=="assistant"&&a.role!=="thinking"||a.isStreaming!==!0||n.isStreaming!==!0?!1:a.role==="assistant"&&n.role==="assistant"?typeof a.content!="string"||typeof n.content!="string"?!1:a.branchRecordId===n.branchRecordId&&a.usage===n.usage&&!!a.content.trim()==!!n.content.trim():a.role==="thinking"&&n.role==="thinking"}function IF(e,t){return e.length===t.length&&e.every((a,n)=>Object.is(a,t[n]))}function eTe(e){for(let t=e.length-1;t>=0;t--){let a=e[t];if(a?.role==="user")return a.id}return null}function tTe(e){return e[e.length-1]}function aTe(e){for(let t=e.length-1;t>=0;t--){let a=e[t];if(a&&no(a))return a.id}return null}function nTe(e,t){return e.role!=="tool_group"?!1:!!(t?.toolCallId&&e.tools.some(a=>Ls(a,t.toolCallId)))}function H6(e){return l9(e)||!!G0(e.rawOutput)}function LF(e){let t=[],a=!1;for(let n of e){if(n.role!=="tool_group"||n.tools.length<2||!n.tools.some(H6)){t.push(n);continue}a=!0;let r=[],o=0,s=i=>{i.length!==0&&t.push({...n,id:o++===0?n.id:`${n.id}-${i[0].callId}`,tools:i})};for(let i of n.tools)H6(i)?(s(r),r=[],s([i])):r.push(i);s(r)}return a?t:e}function rTe(e,t){let a=[],n=0,r=o=>o.role==="tool_group"&&!nTe(o,t)&&!o.tools.some(H6);for(;n<e.length;){let o=e[n];if(o.role!=="thinking"&&!r(o)){a.push(o),n++;continue}let s=[],i=n-1,l=n;for(;l<e.length;){let p=e[l];if(p.role==="thinking"||r(p)){s.push(p),i=l,l++;continue}break}let c=s.filter(p=>p.role==="tool_group").flatMap(p=>p.tools);if(c.length===0||s.length<=1||s.length>=2&&s.every(a6)){for(let p of s)a.push(p);n=i+1;continue}let d=[],f=[];for(let p of s)if(p.role==="thinking"){let m={content:p.content,...p.isStreaming===!0?{isStreaming:!0}:{}};d.push(m),f.push(m)}else if(p.role==="tool_group"&&p.tools.length>0){let m=p.tools[0].callId;for(let g of f)g.beforeToolCallId=m;f.length=0}a.push({id:z0(s[0].id),role:"tool_group",tools:c,...d.length>0?{thoughts:d}:{},timestamp:s[0].timestamp}),n=i+1}return a}function oTe(e,t){let a=e[e.length-1];if(a?.role!=="tool_group"||hb(a.id)===void 0||!a.thoughts?.length)return;let n=a.thoughts[a.thoughts.length-1];if(n?.isStreaming!==!0)return;let r=a.thoughts.slice();r[r.length-1]={...n,content:t.content,isStreaming:!0};let o=e.slice();return o[o.length-1]={...a,thoughts:r,...a.id===z0(t.id)?{timestamp:t.timestamp}:{}},o}function sTe(e){if(e.role==="assistant"||e.role==="thinking")return e.isStreaming?{...e,isStreaming:!1}:e;if(e.role!=="tool_group"||!e.thoughts?.length)return e;let t=!1,a=e.thoughts.map(n=>n.isStreaming?(t=!0,{...n,isStreaming:!1}):n);return t?{...e,thoughts:a}:e}function AF(e){if(e.role==="assistant"||e.role==="thinking")return e.content;if(e.role==="tool_group"&&e.thoughts?.length)return JSON.stringify(e.thoughts.map(t=>t.content))}function EF(e,t){let a=e.get(t);if(a!==void 0)return a;let n=sTe(t);return e.set(t,n),n}function PU(e){return Fse(zTe(e))}function qy(e){if(e.type==="parallel_agents")return`group:${e.key}`;if(e.type==="turn_outputs")return`outputs:${e.key}`;if(e.type==="turn_collapse"){let t=e.turnCollapse.liveStartedAt;return t===void 0?`tc:${e.key}`:`tc:${e.key}:${t}`}return`msg:${e.key}`}function iTe(e,t,a,n,r){if((!a||a.size===0)&&(!n||n.size===0)&&(!r||r.size===0))return e;let o=[],s=null,i=(l,c)=>{if(c&&t||!l)return;let d=a?.get(l)??[],f=n?.get(l)??[],p=r?.get(l)??[];if(d.length===0&&f.length===0&&p.length===0)return;let m=o.length;for(let g=o.length-1;g>=0;g-=1){let h=o[g];if(h.type!=="message"||h.message.role!=="system")break;h.message.source==="recap"&&(m=g)}o.splice(m,0,{type:"turn_outputs",key:l,turnId:l,changes:d,artifacts:f,scheduledTasks:p})};for(let l of e)l.type==="message"&&no(l.message)?(i(s,!1),s=l.message.id):!s&&l.type==="message"?s=l.message.id:!s&&l.type==="parallel_agents"&&(s=l.turnId),o.push(l);return i(s,!0),o}function lTe(e,t){let a=s=>s.type==="parallel_agents"&&(t?.has(s.key)===!0||s.agents.some(i=>Cn(i.status)));if(!e.some(s=>a(s)))return e;let n=[],r=[],o=()=>{n.push(...r),r=[]};for(let s of e)s.type==="message"&&no(s.message)?(o(),n.push(s)):a(s)?r.push(s):n.push(s);return o(),n}function OU(e){return e.type==="message"&&e.message.role==="assistant"&&e.message.agentMessage?.kind==="agent_message"}function DU(e,t){return e.type==="message"&&!OU(e)&&(e.message.role==="assistant"||t&&e.message.role==="system"&&e.message.source==="background_notification")&&!!e.message.content&&e.message.content.trim().length>0}function Rb(e,t,a,n=!0){let r=!1;for(let o=a;o>t;o--){let s=e[o];if(s.type==="message"&&s.message.role==="system"&&s.message.source==="background_notification_turn_started")r=!1;else if(CTe(s))r=!0;else if(!r&&DU(s,n))return o}return-1}function cTe(e,{isResponding:t,latestTurnAwaitsAgentSummary:a,gateBackgroundAgentStatus:n}){let r=[];for(let s=0;s<e.length;s++){let i=e[s];i.type==="message"&&no(i.message)&&r.push(s)}let o=new Map;for(let s=0;s<r.length;s++){let i=r[s],l=(s+1<r.length?r[s+1]:e.length)-1;if(s===r.length-1&&(t||n&&a)||n&&zU(e,i,l))continue;let c=e[i],d=Rb(e,i,l,!1);if(d<0)continue;let f=e[d];c?.type==="message"&&f.type==="message"&&f.message.role==="assistant"&&o.set(f.message.id,c.message.id)}return o}function RF(e,t){if(e.type==="parallel_agents")return!0;if(e.type==="turn_outputs"||e.type==="turn_collapse")return!1;switch(e.message.role){case"tool_group":return!e.message.tools.some(l9);case"plan":return!0;case"assistant":return!t&&!OU(e);case"thinking":return!0;case"system":return e.message.source==="background_notification"?!t:e.message.source==="background_notification_turn_started"||e.message.source==="background_task_completed"||e.message.source==="vision_bridge_notice";case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return!1;default:return e.message,!1}}function $U(e){return e.source==="mid_turn_message_injected"}function uTe(e,t){if(e.type==="parallel_agents")return{kind:"agents",timestamp:e.timestamp,label:t?t("timeline.parallelAgents"):"Parallel agents"};if(e.type==="turn_outputs")return{kind:"none"};if(e.type!=="message")return{kind:"none"};let{message:a}=e;switch(a.role){case"thinking":return{kind:"thought",timestamp:a.timestamp,label:t?t("timeline.thinking"):"Thinking"};case"assistant":return e.turnCollapse?{kind:"none",timestamp:a.timestamp}:pd(a.content,1)?{kind:"commentary",timestamp:a.timestamp,label:t?t("timeline.assistantUpdate"):"Assistant update"}:{kind:"none",timestamp:a.timestamp};case"tool_group":{let n=a.tools.length;return{kind:"tool",timestamp:a.timestamp,label:t?t("timeline.toolCalls",{count:n}):`${n} tool call${n===1?"":"s"}`}}case"plan":return{kind:"plan",timestamp:a.timestamp,label:t?t("timeline.planUpdate"):"Plan update"};case"system":return $U(a)?{kind:"status",timestamp:a.timestamp,label:t?t("timeline.statusUpdate"):"Status update"}:{kind:"none",timestamp:a.timestamp};case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return{kind:"none",timestamp:a.timestamp};default:return{kind:"none"}}}function pd(e,t,a={}){let n=(a.stripMarkdown===!0?dTe(e):e??"").replace(/\s+/g," ").trim();if(t<=0||!n)return"";let r=Array.from(n);return r.length>t?`${r.slice(0,t-1).join("")}\u2026`:n}function dTe(e){if(!e)return"";let t=[],a=r=>{let o=`\0${t.length}\0`;return t.push(r),o},n=e.replace(/```[^\n`]*\n?([\s\S]*?)```/g,(r,o)=>a(o)).replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`\n]+)`/g,(r,o)=>a(o)).replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"");n=KC(n,"~~"),n=KC(n,"**"),n=KC(n,"__"),n=n.replace(/\*([^*\s][^*]*?\S)\*/g,"$1").replace(/(^|[^\p{L}\p{N}_])_([^_\s][^_]*?\S)_(?=$|[^\p{L}\p{N}_])/gu,"$1$2");for(let[r,o]of t.entries())n=n.split(`\0${r}\0`).join(o);return n}function KC(e,t){let a="",n=0;for(;n<e.length;){let r=e.indexOf(t,n);if(r===-1)return a+e.slice(n);let o=r+t.length,s=e.indexOf(t,o);if(s===-1)return a+e.slice(n);let i=e.slice(o,s);a+=i.trim().length===0?e.slice(n,s+t.length):e.slice(n,r)+i,n=s+t.length}return a}function fTe(e,t){let a=e.role==="user"?e.content:e.role==="user_shell"?e.command:"";return pd(a,32)||(t?t("timeline.userTurn"):"User turn")}function pTe(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function no(e){return e.role==="user"||e.role==="user_shell"}function mTe(e,t){if(!t.startsWith("msg:"))return;let a=t.slice(4);a=hb(a)??a;for(let n=e.length-1;n>=0;n--)if(e[n]?.id===a){for(let r=n;r>=0;r--){let o=e[r];if(o&&no(o))return o.id}return}}function hTe(e,t){for(let a of e)if(a.type==="turn_collapse"&&a.turnCollapse.turnId===t)return a.turnCollapse.collapsed;return!1}function gTe(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return pd(e.content,120,{stripMarkdown:!0});case"tool_group":{let a=e.tools.length;return t?t("timeline.toolCalls",{count:a}):`${a} tool call${a===1?"":"s"}`}case"plan":return t?t("timeline.planDetail"):"plan update";case"system":return $U(e)?pd(e.content,120,{stripMarkdown:!0}):"";case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return"";default:return""}}function vTe(e,t){if(e.type==="parallel_agents"){let a=e.agents.length;return t?t("timeline.parallelAgentsDetail",{count:a}):`${a} parallel agent${a===1?"":"s"}`}return e.type==="turn_outputs"||e.type!=="message"?"":gTe(e.message,t)}function wTe(e,t){return t?t(`timeline.kind.${e}`):e_e[e]}function yTe(e,t,a,n){if(t!==null)for(let s of e){if(s.type!=="message")continue;let{message:i}=s;if(i.id!==t||i.role!=="assistant")continue;let l=pd(i.content,180,{stripMarkdown:!0});if(l)return l}let r=[];for(let s=0;s<e.length;s+=1){let i=e[s];if(i.type==="message"&&t!==null&&i.message.id===t)continue;let l=vTe(i,n);l&&r.push(l)}return pd(r.join(" \xB7 "),180)||(a.length>0?a.map(s=>wTe(s,n)).join(" \xB7 "):n?n("timeline.noActivity"):"No activity")}function bTe(e,t){let a=[],n=null,r=[],o=()=>{if(!n)return;let s=PU(r),i=Rb(s,-1,s.length-1,!1),l=i>=0?s[i]:null,c=l?.type==="message"&&l.message.role==="assistant"&&!l.message.isStreaming&&pd(l.message.content,1,{stripMarkdown:!0}).length>0?l.message.id:null,d=[];for(let f of s){if(f.type==="message"&&c!==null&&f.message.id===c)continue;let p=uTe(f,t);p.kind!=="none"&&!d.includes(p.kind)&&d.push(p.kind)}a.push({id:n.id,label:fTe(n,t),detail:yTe(s,c,d,t),timestamp:n.timestamp,nodeKinds:d,...pTe(n)?{isScheduledTask:!0}:{}})};for(let s of e){if(no(s)){o(),n=s,r=[];continue}n&&r.push(s)}return o(),a}function kTe(){return(0,u.jsxs)("svg",{className:Rt.sessionTimelineDetailsIcon,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,u.jsx)("circle",{cx:"8",cy:"8",r:"6.25"}),(0,u.jsx)("path",{d:"M8 4.5v4l-2.5 2"})]})}function xTe(e){let t=e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0;return[e.callId,e.toolName,e.kind??"",e.status,e.parentToolCallId??"",e.subContent?"sub-content":"",e.subTools?.length??0,String(e.args?.subagent_type??""),e.args?.run_in_background===!0?"background":"",String(t?.type??""),String(t?.status??"")].join(":")}function STe(e){return e.map(t=>{let a=`${t.id}:${t.role}:${t.timestamp??""}`;switch(t.role){case"assistant":case"thinking":return`${a}:${t.isStreaming?"streaming":t.content}`;case"tool_group":return`${a}:${t.tools.map(xTe).join(",")}`;case"system":return`${a}:${t.variant}:${t.source??""}:${t.content}`;case"user":return`${a}:${t.content}`;case"user_shell":return`${a}:${t.command}`;case"plan":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return a;default:return a}}).join("|")}function CTe(e){return e.type==="parallel_agents"?!0:e.type==="turn_outputs"||e.type==="turn_collapse"?!1:e.message.role==="tool_group"||e.message.role==="plan"}function TTe(e){if(e.type==="turn_outputs")return null;if(e.type==="turn_collapse")return e.turnCollapse.liveStartedAt===void 0||e.turnCollapse.toolCallCount===void 0||e.turnCollapse.toolCallCount<=0?null:`turn:${e.turnCollapse.turnId}:${e.turnCollapse.toolCallCount}`;if(e.type==="parallel_agents"){let a=e.agents.filter(n=>Cn(n.status));return a.length===0?null:`agents:${e.key}:${a.map(n=>n.callId).join(",")}`}if(e.message.role!=="tool_group")return null;let t=e.message.tools.filter(a=>Cn(a.status));return t.length===0?null:`tools:${e.message.id}:${t.map(a=>a.callId).join(",")}`}function _Te(e){for(let t=e.length-1;t>=0;t--){let a=TTe(e[t]);if(a)return a}return null}function ITe(e){if(!(e.type!=="message"||e.message.role!=="system"))return e.message.source==="prompt_cancelled"||e.message.source==="turn_error"?e.message.timestamp:void 0}function LTe(e){return e.type==="message"&&e.message.role==="system"&&e.message.source==="turn_error"}function ATe(e){if(!(e.type!=="message"||e.message.role!=="assistant"))return e.message.content?.trim()?e.message.timestamp:void 0}function ETe(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function ZC(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function MF(e){if(e.parentToolCallId||!tr(e))return;let t=e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0,a=t?.executionSummary&&typeof t.executionSummary=="object"?t.executionSummary:void 0,n=ZC(a?.inputTokens),r=ZC(a?.outputTokens);if(n===void 0&&r===void 0)return;let o=ZC(a?.cachedTokens);return{callId:e.callId,usage:{inputTokens:n??0,outputTokens:r??0,...o!==void 0?{cachedTokens:o}:{}}}}function RTe(e){return e.type==="parallel_agents"?e.agents.flatMap(t=>MF(t)??[]):e.type!=="message"||e.message.role!=="tool_group"?[]:e.message.tools.flatMap(t=>MF(t)??[])}function MTe(e){return e.type==="parallel_agents"?e.agents.length:e.type==="turn_outputs"||e.type==="turn_collapse"?0:e.message.role==="tool_group"?e.message.tools.filter(t=>!Lo(t.toolName)).length:0}function BU(e,t){for(let a=Math.min(t,e.length-1);a>=0;a--){let n=e[a];if(n.type==="message"&&no(n.message))return n.message.id}return null}function FU(e){let t=[],a=null;for(let n of e)n.type==="message"&&no(n.message)&&(a=n.message.id),t.push(a);return t}function NF(e,t,a,n){let r=n===void 0?BU(e,t):n[t]??null;return r?a.get(r)??null:null}function NTe(e,t,a,n,r=FU(e)){let o=Number.POSITIVE_INFINITY,s=-1;for(let l of t){if(l<0||l>=e.length)continue;let c=NF(e,l,a,r);c!==null&&(o=Math.min(o,c),s=Math.max(s,c))}if(s<0)return null;let i=n==null?null:NF(e,n,a,r);return{startIndex:o,endIndex:s,currentIndex:i!==null&&i>=o&&i<=s?i:s}}function ug(e,t,a,n){for(let r=t;r<=a;r++){let o=e[r];if(o.type==="parallel_agents"){if(o.agents.some(n))return!0}else if(o.type==="message"&&o.message.role==="tool_group"&&o.message.tools.some(n))return!0}return!1}function PTe(e,t,a,n){return n?ug(e,t,a,r=>Ls(r,n)):!1}function OTe(e,t,a){return ug(e,t,a,n=>tr(n)&&Cn(n.status))}function DTe(e,t,a){return ug(e,t,a,n=>G0(n.rawOutput)!==void 0)}function $Te(e,t){let a=new Set(t);for(let n of e){if(n.type!=="message"||n.message.role!=="system"||n.message.source!=="background_notification"&&n.message.source!=="background_task_completed"&&n.message.source!=="background_notification_turn_started")continue;let r=n.message.data;if(n.message.source==="background_notification_turn_started"&&r&&typeof r=="object"&&"backgroundTask"in r&&(r=r.backgroundTask??r),!r||typeof r!="object"||Array.isArray(r)||!("kind"in r)||r.kind!=="shell")continue;let o="taskId"in r?r.taskId:void 0;typeof o=="string"&&a.add(o)}return a}function BTe(e,t,a,n){return ug(e,t,a,r=>{let o=Bse(r);return o!==void 0&&!n.has(o)})}function zU(e,t,a){return ug(e,t,a,n=>Is(n)&&Cn(n.status))}function FTe(e,t,a,n){if(!n?.size)return!1;for(let r=t;r<=a;r++){let o=e[r];if(o.type==="parallel_agents"&&n.has(o.key))return!0}return!1}function QC(e){return e.type==="parallel_agents"?e.agents.filter(t=>Is(t)&&t.status!=="failed").map(t=>t.callId):e.type==="message"&&e.message.role==="tool_group"?e.message.tools.filter(t=>Is(t)&&t.status!=="failed").map(t=>t.callId):[]}function qU(e){if(e.role!=="system"||e.source!=="background_notification"&&e.source!=="background_task_completed"&&e.source!=="background_notification_turn_started")return null;let t=e.content?.trimStart().toLowerCase().startsWith("background agent ")===!0,a=e.data;if(e.source==="background_notification_turn_started"&&a&&typeof a=="object"&&"backgroundTask"in a&&(a=a.backgroundTask??a),typeof a!="object"||a===null||Array.isArray(a))return t?{status:"completed",...e.timestamp!==void 0?{endTime:e.timestamp}:{}}:null;let{kind:n,toolUseId:r,status:o}=a;if(n!=="agent"&&!(n===void 0&&t))return null;let s=o===void 0?"completed":HF(o)?o:void 0;return s?{...typeof r=="string"?{callId:r}:{},status:s,...e.timestamp!==void 0?{endTime:e.timestamp}:{}}:null}function W6(e){return e.type==="message"?qU(e.message):null}function zTe(e){let t=new Map;for(let r of e){let o=qU(r);o?.callId&&t.set(o.callId,o)}if(t.size===0)return e;let a=!1,n=e.map(r=>{if(r.role!=="tool_group")return r;let o=!1,s=r.tools.map(i=>{let l=t.get(i.callId);if(!l||!Is(i)||!Cn(i.status))return i;let c=WF(i,l.status,l.endTime);return c===i?i:(o=!0,c)});return o?(a=!0,{...r,tools:s}):r});return a?n:e}function UU(e,t,a,n){let r=-1,o;for(let c=a;c>t;c--){let d=e[c];if(!(d.type!=="message"||d.message.role!=="system")){if(d.message.source==="turn_error"||d.message.source==="prompt_cancelled"){if(r<0)return null;continue}if(d.message.source==="background_notification"){let f=W6(d);if(n&&!f)continue;r<0&&(r=c,o=f?.callId)}}}if(r<0)return null;let s=-1;if(o){for(let c=a;c>=0;c--)if(QC(e[c]).includes(o)){s=c;break}}for(let c=a;c>=t&&!(s>=0);c--)if(QC(e[c]).length>0){s=c;break}let i=new Set,l=!1;if(s>=0){let c=s;for(let f=s;f>=0;f--){let p=e[f];if(p.type==="message"&&no(p.message)){c=f;break}}let d=[];for(let f=c;f<=a;f++){let p=e[f];for(let g of QC(p))i.add(g);let m=W6(p);m&&(l=!0,m.callId?i.delete(m.callId):d.push(new Set(i)))}for(let f of d)for(let p of f)if(i.has(p)){i.delete(p);break}}return{lastNotificationIndex:r,sawAgentCompletion:l,unmatchedAgentCallIds:i}}function G6(e,t,a,n=!1,r=!0,o=!0){let s=UU(e,t,a,n);if(!s)return!1;if(s.sawAgentCompletion&&s.unmatchedAgentCallIds.size>0)return r;for(let i=s.lastNotificationIndex+1;i<=a;i++){let l=e[i];if(l.type==="message"&&l.message.role==="thinking")return!1}return o&&Rb(e,t,a,!1)<s.lastNotificationIndex}function qTe(e,{overrides:t,isResponding:a,activeTurnStartedAt:n,backgroundSummaryGraceActive:r=!0,waitForUnmatchedAgentCompletions:o=!0,waitForOrderedNarration:s=!0,terminalBackgroundShellTaskIds:i,automaticallyExpandedAgentKeys:l,pendingApprovalCallId:c,includeSubagentToolUsageInMetrics:d=!0,paginatedExpanded:f,enabled:p}){if(!p||e.length===0)return e;let m=[];for(let b=0;b<e.length;b++){let v=e[b];v.type==="message"&&no(v.message)&&m.push(b)}if(m.length===0)return e;let g=$Te(e,i),h=[];for(let b=0;b<m[0];b++)h.push(e[b]);for(let b=0;b<m.length;b++){let v=m[b],w=(b+1<m.length?m[b+1]:e.length)-1,k=e[v],_=k.message.id,T=k.message.timestamp,L=b===m.length-1,S=L&&a,I=OTe(e,v,w),R=DTe(e,v,w),E=BTe(e,v,w,g),N=FTe(e,v,w,l),O=L&&r&&G6(e,v,w,!1,o,s),$=PTe(e,v,w,c),B=Rb(e,v,w),V=B;if(B>=0&&DU(e[B],!1)){let ge=!1;for(let W=B-1;W>v;W--){let xe=e[W];if(xe.type!=="message")break;if(xe.message.role==="system"&&xe.message.source==="background_task_completed")ge=!0;else if(ge&&xe.message.role==="assistant")V=W,ge=!1;else break}}let G=0,J,Z,Q,A=0,j=0,K=0,P=0,ae=0,se=!1,Ee=new Set,q=!1;for(let ge=v+1;ge<=w;ge++){let W=e[ge];if(RF(W,ge>=V&&ge<=B)&&G++,LTe(W)&&(q=!0),P+=MTe(W),W.type==="message"&&W.message.role==="thinking"?ae++:W.type==="message"&&W.message.role==="tool_group"&&W.message.thoughts&&(ae+=W.message.thoughts.length),W.type==="message"&&W.message.role==="system"&&W.message.source==="prompt_cancelled"){let it=W.message.data,Bt=it&&typeof it=="object"&&"elapsedMs"in it?it.elapsedMs:void 0;typeof Bt=="number"&&Number.isFinite(Bt)&&Bt>=0&&(Z=Bt)}let xe=ITe(W);xe!==void 0&&(J=J===void 0?xe:Math.max(J,xe));let _e=ATe(W);_e!==void 0&&(Q=Q===void 0?_e:Math.max(Q,_e));let Ye=ETe(W);if(Ye&&(A+=Ye.inputTokens,j+=Ye.outputTokens,K+=Ye.cachedTokens??0,se=!0),d)for(let it of RTe(W))Ee.has(it.callId)||(Ee.add(it.callId),A+=it.usage.inputTokens,j+=it.usage.outputTokens,K+=it.usage.cachedTokens??0,se=!0)}let oe=S||O?n??T??Date.now():void 0,ie=J??Q,ee=Z??(T!==void 0&&ie!==void 0&&ie>=T?ie-T:void 0);if($||G===0&&!(se||ee!==void 0||oe!==void 0)){for(let ge=v;ge<=w;ge++)h.push(e[ge]);continue}let he=S||I||R||E||N||O||(q||B<0)&&L,ke=!(G===0||(t.has(_)?t.get(_):f?.has(_)||he));h.push({type:"message",key:k.key,message:k.message});let Me={turnId:_,collapsed:ke,hiddenCount:G,...ee!==void 0?{elapsedMs:ee}:{},...se?{inputTokens:A,outputTokens:j}:{},...K>0?{cachedTokens:K}:{},...P>0?{toolCallCount:P}:{},...ae>0?{thinkingCount:ae}:{},...oe!==void 0?{liveStartedAt:oe}:{}};if(h.push({type:"turn_collapse",key:`tc-${_}`,turnCollapse:Me}),!ke){for(let ge=v+1;ge<=w;ge++){let W=e[ge];ge===B&&W.type==="message"&&W.message.role==="assistant"?h.push({...W,turnCollapse:Me}):h.push(W)}continue}for(let ge=v+1;ge<=w;ge++){let W=e[ge];if(!(ge===B&&S)){if(ge===B&&W.type==="message"&&W.message.role==="assistant"){h.push({...W,turnCollapse:Me});continue}RF(W,ge>=V&&ge<=B)||h.push(W)}}}return h}function Uy(e,t,a){if(a){for(let n=0;n<e.length;n++){let r=e[n];if(r.type==="message"&&r.message.role==="tool_group"&&r.message.tools.some(o=>Ls(o,a))||r.type==="parallel_agents"&&r.agents.some(o=>Ls(o,a)))return n}return-1}for(let n=0;n<e.length;n++){let r=e[n];if(r.type==="message"&&r.message.id===t)return n}return-1}function PF(e,t){if(!t)return!1;let a=t.callId;return e.type==="message"?a?e.message.role==="tool_group"&&e.message.tools.some(n=>Ls(n,a)):e.message.id===t.messageId:e.type==="parallel_agents"?!!a&&e.agents.some(n=>Ls(n,a)):(e.type,!1)}function OF(e,t){return e?e.type==="message"?e.message.sourceBlockIds?.join(","):t.filter(a=>e.type==="parallel_agents"?a.role==="tool_group"&&e.agents.some(n=>a.tools.some(r=>Ls(r,n.callId))):a.id===(e.type==="turn_outputs"?e.turnId:e.turnCollapse.turnId)).flatMap(a=>a.sourceBlockIds??[]).join(",")||void 0:void 0}var YC=0,UTe=120,jTe=80,HTe=32,WTe=240,jy=30,JC=160,DF=30,jU=200;function GTe(e,t=jU){return e>t}function VTe(e,t){return e<=t}function XTe(e){let t=Math.max(0,Math.ceil(e/1e3));if(t<60)return`${t}s`;let a=Math.floor(t/60),n=t-a*60;return`${a}m ${n}s`}function KTe(e){return e!==void 0&&e>=0?XTe(e):""}function ZTe(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";let a=e.cachedTokens??0,n=a>0&&e.inputTokens>0?` (${Dn(a)} ${t("turn.cached")}, ${Math.round(a/e.inputTokens*100)}%)`:"";return`\u2191${Dn(e.inputTokens)}${n} \u2193${Dn(e.outputTokens)}`}function $F(e,t){let a=[],n=ZTe(e,t);return n&&a.push(n),e.toolCallCount!==void 0&&e.toolCallCount>0&&a.push(t("turn.toolCalls",{count:e.toolCallCount})),e.thinkingCount!==void 0&&e.thinkingCount>0&&a.push(t("turn.thinkingCount",{count:e.thinkingCount})),a.join(" \xB7 ")}function QTe(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}var YTe=(0,y.memo)(function({turnCollapse:e,onToggleCollapse:t}){let{t:a}=tt(),n=e.hiddenCount>0,r=e.liveStartedAt,o=n||r!==void 0||QTe(e),s=Cb(r!==void 0&&o),i=(0,y.useRef)(0),l=(0,y.useRef)(r);l.current!==r&&(l.current=r,i.current=0);let c;r!==void 0&&o?(i.current=Math.max(i.current,Math.max(0,s-r)),c=i.current):o&&e.elapsedMs!==void 0?(i.current=0,c=e.elapsedMs):(i.current=0,c=void 0);let d=KTe(c),f=$F(e,a),p=$F(e,a),m=a(r!==void 0?"turn.processing":"turn.processed"),g=!!d&&o,h=!!f&&o,b=!!p&&o;if(!o)return null;let v=()=>{if(!n)return;let w=e.collapsed;t(e.turnId,w)};return(0,u.jsxs)("div",{className:n?`${Ts.collapseRow} ${Ts.collapseRowClickable}`:Ts.collapseRow,role:n?"button":void 0,tabIndex:n?0:void 0,"aria-expanded":n?!e.collapsed:void 0,"aria-label":n?e.collapsed?a("turn.expand"):a("turn.collapse"):void 0,title:n?e.collapsed?a("turn.expand"):a("turn.collapse"):void 0,onClick:n?v:void 0,onKeyDown:n?w=>{w.key!=="Enter"&&w.key!==" "||(w.preventDefault(),v())}:void 0,children:[(0,u.jsxs)("span",{className:Ts.collapseLabel,children:[(0,u.jsxs)("span",{className:Ts.processedLabel,children:[m,g&&(0,u.jsxs)("span",{className:Ts.processedMeta,children:[" ",d]})]}),b&&(0,u.jsx)("span",{className:Ts.summaryMetrics,children:p}),h&&(0,u.jsx)("span",{className:Ts.hiddenMetrics,children:f})]}),n&&(0,u.jsx)("span",{"data-testid":`toggle-${e.turnId}`,className:Ts.collapseIcon,onClick:w=>{w.stopPropagation(),v()},children:(0,u.jsx)("span",{className:e.collapsed?Ts.chevronRight:Ts.chevronDown,"aria-hidden":"true"})})]})});function JTe(e){if(e.type==="turn_collapse")return Rt.turnStatusRow;if(e.type==="turn_outputs")return Rt.turnContentRow;if(e.type==="message"&&e.turnCollapse)return Rt.turnAnswerRow}var e_e={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},t_e=["--background","--foreground","--muted-foreground","--border","--font-sans"],BF="session-timeline-detail-tooltip",a_e=(0,y.memo)(function({entries:e,currentTurnId:t,currentRange:a,hidden:n,onSelect:r,action:o}){let s=X0(),{t:i}=tt(),l=(0,y.useRef)(null),c=(0,y.useRef)(null),d=(0,y.useRef)(null),f=(0,y.useRef)(!1),p=(0,y.useRef)(!1),m=(0,y.useRef)(null),g=(0,y.useRef)(null),[h,b]=(0,y.useState)(null),v=a!==null?a.currentIndex:e.findIndex(E=>E.id===t),w=(0,y.useCallback)(()=>b(null),[]),k=(0,y.useCallback)(()=>{f.current||p.current||w()},[w]),_=(0,y.useCallback)((E,N)=>{let O=l.current;if(!O)return null;let $=getComputedStyle(O),B=N.getBoundingClientRect();return{entry:E,top:B.top+B.height/2,left:B.right+8,clamped:!1,themeVars:Object.fromEntries(t_e.map(V=>[V,$.getPropertyValue(V)]))}},[]),T=(0,y.useCallback)(E=>{let N=c.current;return N?Array.from(N.querySelectorAll('[data-testid="session-timeline-entry"]')).find(O=>O.getAttribute("data-turn-id")===E.id)?.querySelector("button")??null:null},[]),L=(0,y.useCallback)(E=>{let N=c.current;if(!N)return!1;let O=N.getBoundingClientRect(),$=E.getBoundingClientRect();return $.bottom>=O.top&&$.top<=O.bottom},[]),S=(0,y.useCallback)(()=>{b(E=>{if(!E)return null;let N=T(E.entry);return!N||!L(N)?null:_(E.entry,N)})},[_,T,L]),I=(0,y.useCallback)((E,N)=>{b(_(E,N))},[_]),R=(0,y.useCallback)(()=>{typeof window>"u"||(m.current!==null&&window.cancelAnimationFrame(m.current),g.current!==null&&window.clearTimeout(g.current),p.current=!0,m.current=window.requestAnimationFrame(()=>{m.current=null,p.current=!1,S()}),g.current=window.setTimeout(()=>{g.current=null,p.current=!1},100))},[S]);return(0,y.useLayoutEffect)(()=>{if(n)return;let E=c.current;if(!E||v<0)return;let N=E.querySelector(`[data-timeline-index="${v}"]`);if(!N)return;let O=N.offsetTop+N.offsetHeight/2,$=E.scrollHeight-E.clientHeight,B=Math.max(0,Math.min(O-E.clientHeight/2,$));if(E.scrollTop===B)return;f.current=!0,E.scrollTop=B;let V=window.requestAnimationFrame(()=>{f.current=!1,S()}),G=window.setTimeout(()=>{f.current=!1},100);return()=>{window.cancelAnimationFrame(V),window.clearTimeout(G),f.current=!1}},[v,n,S]),(0,y.useLayoutEffect)(()=>{if(!(!h||typeof window>"u"))return window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)}},[S,h]),(0,y.useLayoutEffect)(()=>()=>{m.current!==null&&window.cancelAnimationFrame(m.current),g.current!==null&&window.clearTimeout(g.current),p.current=!1},[]),(0,y.useLayoutEffect)(()=>{if(!h||h.clamped)return;let E=l.current,N=d.current;if(!E||!N||typeof window>"u")return;let O=N.getBoundingClientRect(),$=12,B=h.top;O.top<$?B+=$-O.top:O.bottom>window.innerHeight-$&&(B-=O.bottom-(window.innerHeight-$)),B!==h.top&&b(V=>V?.entry.id===h.entry.id?{...V,top:B,clamped:!0}:V)},[h]),n||e.length===0?null:(0,u.jsx)("div",{className:Rt.sessionTimelineLayer,"aria-hidden":"false",children:(0,u.jsxs)("nav",{ref:l,className:Rt.sessionTimelinePanel,"aria-label":i("timeline.sessionTimeline"),"data-testid":"session-timeline",onMouseLeave:w,children:[(0,u.jsx)("div",{ref:c,className:Rt.sessionTimelineViewport,"data-testid":"session-timeline-viewport",onScroll:k,children:(0,u.jsx)("ol",{className:Rt.sessionTimelineList,children:e.map((E,N)=>{let O=a!==null&&N>=a.startIndex&&N<=a.endIndex,$=a!==null?N===a.currentIndex:E.id===t,B=E.nodeKinds.join(","),V=[`${i("timeline.turnPrefix",{index:N+1})}: ${E.label}`,$?i("timeline.currentTurn"):null].filter(Boolean).join(". "),G=Q=>I(E,Q.currentTarget),J=Q=>{R(),I(E,Q.currentTarget)},Z=h?.entry.id===E.id;return(0,u.jsx)("li",{className:Rt.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":E.id,"data-timeline-index":N,"data-node-kinds":B,"data-in-current-range":O?"true":void 0,children:(0,u.jsx)("button",{type:"button",className:V6(Rt.sessionTimelineButton,O?Rt.sessionTimelineButtonInRange:void 0,$?Rt.sessionTimelineButtonCurrent:void 0),"aria-current":$?"step":void 0,"aria-describedby":Z?BF:void 0,"aria-label":V,onClick:()=>r(E.id),onFocus:J,onBlur:w,onMouseEnter:G,onMouseLeave:w,children:(0,u.jsx)("span",{className:Rt.sessionTimelineTick})})},E.id)})})}),o,h&&typeof document<"u"&&(0,V0.createPortal)((0,u.jsxs)("div",{ref:d,className:Rt.sessionTimelineDetails,id:BF,"data-testid":"session-timeline-detail","data-title":h.entry.label,"data-detail":h.entry.detail,"data-scheduled-task":h.entry.isScheduledTask?"true":void 0,role:"tooltip",style:{...h.themeVars,top:h.top,left:h.left},children:[(0,u.jsxs)("span",{className:Rt.sessionTimelineDetailsTitle,children:[h.entry.isScheduledTask&&(0,u.jsx)(kTe,{}),(0,u.jsx)("span",{className:Rt.sessionTimelineDetailsTitleText,children:h.entry.label})]}),(0,u.jsx)("span",{className:Rt.sessionTimelineDetailsDetail,children:h.entry.detail})]}),s??document.body)]})})});function V6(...e){return e.filter(Boolean).join(" ")||void 0}var n_e=[];function r_e({label:e}){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{role:"status","aria-live":"polite",className:Rt.srOnly,children:e}),(0,u.jsxs)("div",{className:Rt.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[(0,u.jsx)("div",{className:Rt.loadingSkeletonUserRow,children:(0,u.jsxs)("div",{className:Rt.loadingSkeletonUserBubble,children:[(0,u.jsx)("span",{className:Rt.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Rt.loadingSkeletonLineShort})]})}),(0,u.jsx)("div",{className:Rt.loadingSkeletonAssistantRow,children:(0,u.jsxs)("div",{className:Rt.loadingSkeletonAssistantBlock,children:[(0,u.jsx)("span",{className:Rt.loadingSkeletonLineMedium}),(0,u.jsx)("span",{className:Rt.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Rt.loadingSkeletonLineNarrow})]})}),(0,u.jsx)("div",{className:Rt.loadingSkeletonUserRow,children:(0,u.jsx)("div",{className:Rt.loadingSkeletonUserBubbleCompact,children:(0,u.jsx)("span",{className:Rt.loadingSkeletonLineMedium})})}),(0,u.jsx)("div",{className:Rt.loadingSkeletonAssistantRow,children:(0,u.jsxs)("div",{className:Rt.loadingSkeletonAssistantBlock,children:[(0,u.jsx)("span",{className:Rt.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Rt.loadingSkeletonLineMedium})]})})]})]})}var o_e=(0,y.memo)((0,y.forwardRef)(function({messages:e,frozenViewport:t=!1,sessionKey:a,terminalBackgroundShellTaskIds:n,pendingApproval:r,onShowContextDetail:o,onImagePreview:s,onAttachmentPreview:i,onInsightReportOpen:l,onEditUserMessage:c,onSubmitUserMessageEdit:d,loadingTranscript:f,catchingUp:p,hasOlderHistory:m=!1,loadingOlderHistory:g=!1,historyCapacityReached:h=!1,historyPaginationError:b=!1,onLoadOlderHistory:v,transcriptBlockCount:w=0,transcriptActivity:k,onReloadTranscript:_,isResponding:T=!1,transcriptReloadPaused:L=T,activeTurnStartedAt:S,welcomeHeader:I,centerWelcomeHeader:R=!1,workspaceCwd:E,tailContent:N,tailKey:O="tail",virtualScrollThreshold:$=jU,autoScrollTailIntoView:B=!1,bottomOverlayInset:V=0,hideSessionTimeline:G=!1,timelineAction:J,hideFirstUserMessage:Z=!1,firstTurnMetrics:Q,includeSubagentToolUsageInMetrics:A=!0,showRetryHint:j=!1,onRetryClick:K,failedPromptMessageId:P,onRetryFailedPrompt:ae,onBranchSession:se,onCanScrollToBottomChange:Ee,turnFileChanges:q,turnArtifacts:oe,sourceEntries:ie,sourceSessionId:ee,mcpAppSessionId:he=ee,onSourceOpen:ke,turnScheduledTasks:Me,onReviewChanges:ge,onOpenArtifact:W,onOpenScheduledTask:xe,onTurnOutputOpen:_e,onToolResultOpen:Ye,onError:it,generateContent:Bt},na){let ue=(0,y.useRef)(t);ue.current=t;let{t:Ke}=tt(),fe=Ma(),Pe=(0,y.useContext)(X6),X=(0,y.useMemo)(()=>{let z=new Map,te,ve=0;for(let Ne of e)Ne.role==="user"&&(z.set(Ne.id,ve),te=Ne.id,ve+=1);return{lastId:te,turnIndexById:z}},[e]),de=(0,y.useMemo)(()=>{if(!t)return;let z=[...X.turnIndexById.keys()];return new Set(z.filter((te,ve)=>ve===0||ve===z.length-1))},[X,t]),ye=(0,y.useRef)(void 0),qe=J8e(ye.current,e);(0,y.useLayoutEffect)(()=>{ye.current=e},[e]);let Qe=(0,y.useRef)(void 0),vt=(0,y.useRef)(void 0),zt=(0,y.useRef)(void 0),nt=(0,y.useRef)(void 0),Ve=(0,y.useMemo)(()=>{let z=Qe.current,te=e[e.length-1],ve;if(qe&&z?.sourceMessages===ye.current&&z?.compactMode===Pe&&z.pendingApproval===r&&(te?.role==="assistant"&&z.value[z.value.length-1]?.id===te.id?(ve=z.value.slice(),ve[ve.length-1]=te):te?.role==="thinking"&&(ve=Pe?oTe(z.value,te):LF(e))),!ve){let ot=LF(e);ve=Pe?rTe(ot,r):ot}Qe.current={sourceMessages:e,compactMode:Pe,pendingApproval:r,value:ve};let Ne=nt.current??=new WeakMap,Ce=vt.current,Ht=Ce!==void 0&&Ce.sessionKey===a?Ce.ids:void 0;if(T){if(zt.current=void 0,!Ht?.size)return ve;let ot,Mt=!1,lt=ve.map(_a=>{let Sa=hb(_a.id);if(Sa!==void 0){let Lg=Ht.get(Sa);Lg!==void 0&&(ot??=new Map).set(Sa,Lg)}let Tn=Ht.get(z0(_a.id));Tn!==void 0&&(ot??=new Map).set(z0(_a.id),Tn);let rs=Ht.get(_a.id);return rs===void 0||AF(_a)!==rs?_a:((ot??=new Map).set(_a.id,rs),Mt=!0,EF(Ne,_a))});return(ot?.size??0)!==Ht.size&&(zt.current={sessionKey:a,ids:ot??new Map}),Mt?lt:ve}let Jt,sa=ve.map(ot=>{let Mt=EF(Ne,ot);if(Mt!==ot){let lt=AF(ot);if(lt!==void 0){(Jt??=new Map).set(ot.id,lt);let _a=hb(ot.id),Sa=ot.role==="tool_group"?ot.thoughts?.[0]?.content:void 0;_a!==void 0&&Sa!==void 0&&Jt.set(_a,Sa),ot.role==="thinking"&&Jt.set(z0(ot.id),JSON.stringify([ot.content]))}}return Mt});return Jt?(zt.current={sessionKey:a,ids:new Map([...Ht??[],...Jt])},sa):ve},[Pe,T,e,r,a,qe]);(0,y.useLayoutEffect)(()=>{let z=zt.current;z&&(vt.current=z,zt.current=void 0)},[Ve]);let Ct=(0,y.useRef)(void 0),We=(0,y.useMemo)(()=>{let z=Ct.current,te=Ve[Ve.length-1],ve;if(qe&&T&&z?.sourceMessages===ye.current&&z?.compactMode===Pe&&z.pendingApproval===r&&z.isResponding===T&&z.turnFileChanges===q&&z.turnArtifacts===oe&&z.turnScheduledTasks===Me){let Ne=z.value[z.value.length-1];Ne?.type==="message"&&Ne.message.id===te.id&&(ve=z.value.slice(),ve[ve.length-1]={...Ne,message:te})}return ve??=iTe(PU(Ve),T,q,oe,Me),Ct.current={sourceMessages:e,compactMode:Pe,pendingApproval:r,isResponding:T,turnFileChanges:q,turnArtifacts:oe,turnScheduledTasks:Me,value:ve},ve},[Ve,e,qe,Pe,r,T,q,oe,Me]),dt=(0,y.useMemo)(()=>{for(let z=Ve.length-1;z>=0;z-=1){let te=Ve[z];if(te?.role==="system"&&te.source==="background_notification")return te.id}return null},[Ve]),[la,ar]=(0,y.useState)(dt),nr=!!(f||p),ml=(0,y.useRef)(nr),Dt=(0,y.useRef)(Ve.length>0),qr=!Dt.current&&Ve.length>0,ha=nr||ml.current||qr;(0,y.useLayoutEffect)(()=>{ha&&ar(dt),Ve.length>0&&(Dt.current=!0),ml.current=nr},[ha,dt,nr,Ve.length]);let Na=!ha&&dt!==null&&la!==dt,ra=(0,y.useMemo)(()=>{for(let z=We.length-1;z>=0;z-=1){let te=We[z];if(te.type==="message"&&no(te.message))return z}return 0},[We]),dn=fe==="interactive",$a=(0,y.useMemo)(()=>dn&&zU(We,ra,We.length-1),[We,dn,ra]),Bn=(0,y.useMemo)(()=>UU(We,ra,We.length-1,!0),[We,ra]),ga=(0,y.useMemo)(()=>{let z=Bn?.unmatchedAgentCallIds;return z&&z.size>0?[...z].sort().join("|"):""},[Bn]),vr=Na&&!$a&&(Bn?.sawAgentCompletion??!1)&&(Bn?.unmatchedAgentCallIds.size??0)>0,[wr,va]=(0,y.useState)(!1);(0,y.useEffect)(()=>{va(!1)},[ga,ra,T]),(0,y.useEffect)(()=>{if(!vr||T)return;let z=setTimeout(()=>va(!0),_F);return()=>clearTimeout(z)},[vr,ga,ra,T]);let hl=(0,y.useMemo)(()=>Na&&!$a&&!T&&(Bn?.sawAgentCompletion??!1)&&(Bn?.unmatchedAgentCallIds.size??0)===0&&G6(We,ra,We.length-1,!0,!0,!0),[Na,We,T,Bn,$a,ra]),[io,dg]=(0,y.useState)(!1),zp=(0,y.useMemo)(()=>{let z=Bn;if(!z||z.lastNotificationIndex<0)return"";let te=We[z.lastNotificationIndex];return te?.type==="message"?te.message.id:""},[We,Bn]);(0,y.useEffect)(()=>{dg(!1)},[zp,ra,T]),(0,y.useEffect)(()=>{if(!hl)return;let z=setTimeout(()=>dg(!0),_F);return()=>clearTimeout(z)},[hl,zp,ra,T]);let Mo=(0,y.useMemo)(()=>Na&&G6(We,ra,We.length-1,!0,$a||!wr,!io),[Na,We,$a,ra,io,wr]),Dc=(0,y.useMemo)(()=>{let z=new Set;for(let te=ra;te<We.length;te+=1){let ve=We[te];ve.type==="parallel_agents"&&z.add(ve.key)}return z},[We,ra]),$c=(0,y.useMemo)(()=>{if(!Na)return{key:null};let z=-1,te;for(let ve=We.length-1;ve>=0;ve-=1){let Ne=We[ve];if(Ne.type!=="message"||Ne.message.role!=="system"||Ne.message.source!=="background_notification")continue;let Ce=W6(Ne);if(Ce){z=ve,te=Ce.callId;break}}for(let ve=z-1;ve>=0;ve-=1){let Ne=We[ve];if(Ne.type==="parallel_agents"&&(!te||Ne.agents.some(Ce=>Ce.callId===te)))return{key:Ne.key}}return{key:null}},[Na,We]),Fn=(0,y.useRef)(null),Bc=s8e(Fn,!G),[yd,Mb]=(0,y.useState)(()=>new Set),fg=(0,y.useCallback)((z,te)=>{Mb(ve=>{if(ve.has(z)===te)return ve;let Ne=new Set(ve);return te?Ne.add(z):Ne.delete(z),Ne})},[]),bd=(0,y.useRef)(null),Fc=(0,y.useMemo)(()=>{if(!Bc)return n_e;let z=STe(Ve);return(bd.current?.signature!==z||bd.current?.t!==Ke)&&(bd.current={signature:z,t:Ke,entries:bTe(Ve,Ke)}),bd.current.entries},[Bc,Ve,Ke]),Nb=(0,y.useMemo)(()=>new Map(Fc.map((z,te)=>[z.id,te])),[Fc]),pg=(0,y.useMemo)(()=>aTe(Ve),[Ve]),[qp,mg]=(0,y.useState)(null),Pb=qp!==null?Fc[qp.currentIndex]?.id??pg:pg,Up=(0,y.useRef)(void 0),jp=(0,y.useMemo)(()=>{let z=Up.current,te;return qe&&T&&z?.sourceMessages===ye.current&&z?.isResponding===T&&z.latestTurnAwaitsAgentSummary===Mo&&z.gateBackgroundAgentStatus===dn?te=z.value:te=cTe(We,{isResponding:T,latestTurnAwaitsAgentSummary:Mo,gateBackgroundAgentStatus:dn}),Up.current={sourceMessages:e,isResponding:T,latestTurnAwaitsAgentSummary:Mo,gateBackgroundAgentStatus:dn,value:te},te},[We,e,qe,dn,T,Mo]),{collapseCompletedTurns:hg,sourceReferences:zc,assistantFeedback:Hp}=Ao(),{ratings:gg,rate:vg,ratingForTurn:wg}=wie(ee),yg=(0,y.useMemo)(()=>{let z=new Map;for(let te of e)no(te)&&z.set(te.id,te);return z},[e]),kd=cie({renderMode:fe,sessionId:ee,options:Hp}),Wp=(0,y.useRef)(Hp);Wp.current=Hp;let bg=(0,y.useRef)(e);bg.current=e;let kg=(0,y.useCallback)((z,te,ve)=>{let Ne=wg(z);vg(z,ve);let Ce=Wp.current?.onRate;Ce&&uie(Ce,{rating:ve,previousRating:Ne,sessionId:ee,promptId:z,userMessage:die(bg.current,te)})},[wg,vg,ee]),Gp=(0,y.useRef)(void 0),xd=(0,y.useMemo)(()=>{let z=[ie,E,ee,zc],te=Gp.current;return qe&&T&&te&&te.sourceMessages===ye.current&&IF(te.dependencies,z)?te.value:gse(e,ie??[],E,ee,zc)},[e,ie,E,ee,zc,qe,T]);(0,y.useLayoutEffect)(()=>{Gp.current={sourceMessages:e,dependencies:[ie,E,ee,zc],value:xd}},[e,ie,E,ee,zc,xd]);let Sd=hg??!0,[qc,Cd]=(0,y.useState)(()=>new Map),[gl,Uc]=(0,y.useState)(()=>new Set),vl=(0,y.useRef)(new Map),[xg,yr]=(0,y.useTransition)(),Vp=(0,y.useRef)(!1),jc=(0,y.useRef)(new Map),wl=(0,y.useRef)(void 0),yl=(0,y.useRef)([]),bl=(0,y.useRef)(!0);t&&(bl.current=!1);let oa=(0,y.useRef)(!1),Xp=(0,y.useRef)(0),kl=(0,y.useRef)(0),Ar=(0,y.useRef)(!1),F=(0,y.useRef)(0),ce=(0,y.useRef)(!1),be=(0,y.useRef)(0),ut=(0,y.useRef)(null),St=(0,y.useRef)(!1),xa=(0,y.useRef)(null),es=(0,y.useRef)(null),Hc=(0,y.useRef)(!1),lo=(0,y.useRef)(null),ui=(0,y.useRef)(!1),Td=(0,y.useRef)(f),Kp=(0,y.useRef)(!!f),Ur=(0,y.useRef)(void 0),_d=(0,y.useRef)(void 0),K9=(0,y.useRef)(V),Ob=(0,y.useRef)(null),Z9=(0,y.useRef)(p),Wc=(0,y.useRef)(p),Q9=(0,y.useRef)(!1),Db=(0,y.useRef)(!1),Id=(0,y.useRef)(void 0),Zp=(0,y.useRef)(void 0);Wc.current=p;let Ld=(0,y.useRef)(!1),jr=(0,y.useRef)(void 0),Qp=(0,y.useRef)(void 0),di=(0,y.useRef)(void 0),Yp=(0,y.useRef)(void 0),Jp=(0,y.useRef)(void 0),Ad=(0,y.useRef)(void 0),Sg=(0,y.useRef)(void 0),$b=(0,y.useRef)(w),Bb=(0,y.useRef)(L);$b.current=w,Bb.current=L||t;let Fb=(0,y.useRef)(null),[Ba,As]=(0,y.useState)(null),Y9=(0,y.useRef)(!1);Y9.current=Ba?.virtual===!0;let J9=(0,y.useRef)(Ve.length);(0,y.useLayoutEffect)(()=>{J9.current=Ve.length},[Ve.length]);let zb=(0,y.useRef)(e);(0,y.useLayoutEffect)(()=>{zb.current=e},[e]);let[QU,Cg]=(0,y.useState)(!1),[YU,JU]=(0,y.useState)(a);YU!==a&&(JU(a),vl.current.clear(),F.current+=1,Ar.current=!1,Ld.current=!1,As(null),Cd(z=>z.size?new Map:z),Uc(z=>z.size?new Set:z)),(0,y.useEffect)(()=>{m||(Ld.current=!1,Fb.current=null)},[m]);let em=(0,y.useCallback)(()=>{let z=Fn.current,te=z?z.scrollHeight-z.scrollTop-z.clientHeight:0,ve=!bl.current&&te>1;es.current!==ve&&(es.current=ve,Ee?.(ve))},[Ee]),rr=(0,y.useCallback)(()=>{Zp.current!==void 0&&window.cancelAnimationFrame(Zp.current),Zp.current=window.requestAnimationFrame(em)},[em]),jt=(0,y.useCallback)(z=>{ue.current&&(z=!1),bl.current!==z&&(bl.current=z,rr())},[rr]),Ed=(0,y.useRef)(void 0),qb=(0,y.useRef)(!1),zn=(0,y.useMemo)(()=>{qb.current=!1;let z=[de,qc,T,S,n,Na,$a,wr,io,Sd,Z,Q,A,yd,Pe,r,q,oe,Me,gl],te=Ed.current,ve=We[We.length-1];if(qe&&T&&te&&te.sourceMessages===ye.current&&IF(te.dependencies,z)&&ve?.type==="message"){let lt=qy(ve),_a=-1;for(let Sa=te.value.length-1;Sa>=0;Sa-=1)if(qy(te.value[Sa])===lt){_a=Sa;break}if(_a>=0){let Sa=te.value[_a];if(Sa?.type==="message"){let Tn=te.value.slice();return Tn[_a]={...Sa,message:ve.message},Ed.current={sourceMessages:e,dependencies:z,value:Tn,virtualizerItems:te.virtualizerItems},qb.current=!0,Tn}}}let Ne=qTe(We,{overrides:qc,isResponding:T,activeTurnStartedAt:S,terminalBackgroundShellTaskIds:n,backgroundSummaryGraceActive:Na,waitForUnmatchedAgentCompletions:$a||!wr,waitForOrderedNarration:!io,automaticallyExpandedAgentKeys:yd,pendingApprovalCallId:r?.toolCallId??null,includeSubagentToolUsageInMetrics:A,paginatedExpanded:de?new Set([...gl,...de]):gl,enabled:Sd}),Ce=de?Ne.map(lt=>{if(!("turnCollapse"in lt)||!lt.turnCollapse||!de.has(lt.turnCollapse.turnId))return lt;let{turnId:_a,collapsed:Sa,hiddenCount:Tn}=lt.turnCollapse;return{...lt,turnCollapse:{turnId:_a,collapsed:Sa,hiddenCount:Tn}}}):Ne,Ht=!1,Jt=Q?Ce.map(lt=>Ht||lt.type!=="turn_collapse"?lt:(Ht=!0,{...lt,turnCollapse:{...lt.turnCollapse,...Q.durationMs!==void 0&&Q.durationMs>0?{elapsedMs:Q.durationMs}:{},...Q.inputTokens!==void 0?{inputTokens:Q.inputTokens}:{},...Q.outputTokens!==void 0?{outputTokens:Q.outputTokens}:{},...Q.cachedTokens!==void 0?{cachedTokens:Q.cachedTokens}:{}}})):Ce,sa=lTe(Jt,yd);if(!Z)return Ed.current={sourceMessages:e,dependencies:z,value:sa,virtualizerItems:sa},sa;let ot=Ve.find(lt=>lt.role==="user")?.id,Mt=ot?sa.filter(lt=>lt.type!=="message"||lt.message.id!==ot):sa;return Ed.current={sourceMessages:e,dependencies:z,value:Mt,virtualizerItems:Mt},Mt},[We,qe,qc,T,S,n,Na,$a,wr,io,Sd,de,Z,Q,A,Ve,e,yd,Pe,r,q,oe,Me,gl]),Rd=Ed.current?.sourceMessages===e?Ed.current.virtualizerItems:zn,tm=(0,y.useCallback)(z=>Rd.some(te=>String(qy(te))===z),[Rd]),Ub=(0,y.useRef)(void 0),ej=(0,y.useMemo)(()=>{if(qb.current&&Ub.current?.length===zn.length)return Ub.current.value;let z=FU(zn);return Ub.current={length:zn.length,value:z},z},[zn]),tj=Fc.length>=mge,ts=N!=null,Md=!!f,xl=!!I,or=xl?1:0,Gc=or+zn.length,am=Gc+(ts?1:0),aj=or+We.length+(ts?1:0),fi=GTe(aj,$),Kn=(0,y.useCallback)(()=>Fn.current,[]),e7=(0,y.useCallback)(()=>{let z=Fn.current;if(!z)return;let te=z.scrollHeight-z.scrollTop-z.clientHeight<jy;oa.current=!te,jt(te),rr()},[rr,jt]),nm=(0,y.useCallback)(()=>{Xp.current=Date.now()+1e3},[]),Tg=(0,y.useCallback)(()=>{Jp.current!==void 0&&(window.clearTimeout(Jp.current),Jp.current=void 0)},[]),as=(0,y.useCallback)(()=>{Tg(),Ad.current?.abort(),Ad.current=void 0},[Tg]),Nd=(0,y.useCallback)(()=>{Tg();let z=Sg.current;if(z){if(k?.getSnapshot().lastEventId===z.lastEventId)return;Sg.current=void 0}!_||Ad.current!==void 0||oa.current||Bb.current||$b.current<=TB||(Jp.current=window.setTimeout(()=>{if(Jp.current=void 0,Bb.current||oa.current||$b.current<=TB)return;let te=Fn.current;if(!te||te.scrollHeight-te.scrollTop-te.clientHeight>=jy)return;let ve=new AbortController;Ad.current=ve,_(ve.signal).then(()=>{if(ve.signal.aborted)return;let Ne=k?.getSnapshot();Sg.current={...Ne?.lastEventId!==void 0?{lastEventId:Ne.lastEventId}:{}}}).catch(Ne=>{Ne instanceof Error&&Ne.name==="AbortError"||console.warn("[MessageList] transcript reload failed:",Ne)}).finally(()=>{Ad.current===ve&&(Ad.current=void 0)})},Q8e))},[Tg,_,k]);(0,y.useEffect)(()=>{Sg.current=void 0},[k]),(0,y.useEffect)(()=>{if(!k)return as;let z=k.getSnapshot().lastEventId,te=k.subscribe(()=>{let ve=k.getSnapshot().lastEventId;ve!==z&&(z=ve,Nd())});return()=>{te(),as()}},[k,Nd,as]),(0,y.useEffect)(()=>{if(L){as();return}Nd()},[as,L,Nd,w]);let Pd=(0,y.useCallback)(()=>{Db.current=!0,Id.current!==void 0&&window.cancelAnimationFrame(Id.current),Id.current=window.requestAnimationFrame(()=>{Db.current=!1,Id.current=void 0,e7()})},[e7]);(0,y.useEffect)(()=>()=>{Id.current!==void 0&&window.cancelAnimationFrame(Id.current),Zp.current!==void 0&&window.cancelAnimationFrame(Zp.current),jr.current!==void 0&&window.cancelAnimationFrame(jr.current),Qp.current!==void 0&&window.cancelAnimationFrame(Qp.current),di.current!==void 0&&window.cancelAnimationFrame(di.current),as(),Ur.current!==void 0&&window.cancelAnimationFrame(Ur.current),_d.current!==void 0&&window.cancelAnimationFrame(_d.current)},[as]);let t7=(0,y.useCallback)((z,te)=>{let ve=Fn.current;(!ve||ve.scrollHeight>ve.clientHeight+1)&&(oa.current=!0,jt(!1)),Pd(),wl.current!==void 0&&window.clearTimeout(wl.current),jc.current.clear(),Fn.current?.querySelectorAll("[data-message-row-key]").forEach(Ne=>{let Ce=Ne.dataset.messageRowKey;Ce&&jc.current.set(Ce,Ne.getBoundingClientRect().top)}),Vp.current=!0,yr(()=>{Uc(Ne=>{if(!Ne.has(z))return Ne;let Ce=new Set(Ne);return Ce.delete(z),Ce}),Cd(Ne=>{let Ce=new Map(Ne);return Ce.set(z,te),Ce})})},[Pd,jt]);(0,y.useLayoutEffect)(()=>{if(xg||!Vp.current)return;Vp.current=!1;for(let te of yl.current)te.cancel();yl.current=[];let z=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;z||Fn.current?.querySelectorAll("[data-message-row-key]").forEach(te=>{if(typeof te.animate!="function")return;let ve=te.dataset.messageRowKey,Ne=ve?jc.current.get(ve):void 0;if(Ne===void 0){yl.current.push(te.animate([{opacity:0},{opacity:1}],{duration:XC,easing:"ease-out"}));return}let Ce=Ne-te.getBoundingClientRect().top;Math.abs(Ce)<1||yl.current.push(te.animate([{translate:`0 ${Ce}px`},{translate:"0 0"}],{duration:XC,easing:"ease-out"}))}),jc.current.clear(),wl.current=window.setTimeout(()=>{wl.current=void 0,Pd()},z?0:XC)},[Pd,xg]),(0,y.useEffect)(()=>()=>{wl.current!==void 0&&window.clearTimeout(wl.current);for(let z of yl.current)z.cancel();yl.current=[]},[]);let nj=(0,y.useCallback)(z=>{let te=z.target;te instanceof HTMLElement&&te.closest("[aria-expanded], summary")&&(oa.current=!0,jt(!1),Pd())},[Pd,jt]),Vc=(0,y.useCallback)(z=>{if(xl&&z===YC)return"slot:header";if(ts&&z===Gc)return`slot:tail:${O}`;let te=Rd[z-or];return te?qy(te):`slot:row:${z}`},[xl,ts,Gc,O,Rd,or]),rj=(0,y.useCallback)(z=>xl&&z===YC?UTe:ts&&z===Gc?WTe:Rd[z-or]?.type==="turn_collapse"?HTe:jTe,[xl,ts,or,Gc,Rd]),Zn=(0,y.useCallback)((z="auto")=>{if(ue.current)return;let te=Kn();if(!te||te.scrollHeight<=te.clientHeight)return;St.current=!1,be.current+=1;let ve=be.current;ce.current=!0,z==="smooth"?te.scrollTo({top:te.scrollHeight,behavior:z}):te.scrollTop=te.scrollHeight,rr(),kl.current=Math.max(0,te.scrollHeight-te.clientHeight),em();let Ne=()=>{if(be.current!==ve||(ce.current=!1,!St.current)||(St.current=!1,Wc.current||oa.current))return;let Ce=Kn();!Ce||Ce.scrollHeight<=Ce.clientHeight||(jt(!0),Ce.scrollTop=Ce.scrollHeight,rr(),kl.current=Math.max(0,Ce.scrollHeight-Ce.clientHeight),em())};z==="smooth"?setTimeout(Ne,350):requestAnimationFrame(Ne)},[Kn,em,rr,jt]),a7=(0,y.useCallback)((z="smooth")=>{oa.current=!1,jt(!0),Zn(z)},[Zn,jt]),ns=Pse({count:am,enabled:fi,getScrollElement:Kn,getItemKey:Vc,estimateSize:rj,overscan:20,anchorTo:"end",useFlushSync:!1,useAnimationFrameWithResizeObserver:!0,directDomUpdates:!0});ns.shouldAdjustScrollPositionOnItemSizeChange=(z,te,ve)=>VTe(z.end,Fn.current?.scrollTop??ve.scrollOffset??0);let oj=(0,y.useCallback)(z=>{if(ns.measureElement(z),!z||!Y9.current)return;let te=Number(z.dataset.index);Number.isFinite(te)&&!ns.itemSizeCache.has(Vc(te))&&ns.resizeItem(te,z.offsetHeight)},[Vc,ns]);(0,y.useLayoutEffect)(()=>{if(!Ba)return;let z=Fn.current;if(Ba.rowKey&&!tm(Ba.rowKey)){let te=mTe(zb.current,Ba.rowKey);if(te!==void 0&&hTe(zn,te)&&qc.get(te)!==!1&&!gl.has(te)){Uc(ve=>ve.has(te)?ve:new Set(ve).add(te)),As(ve=>ve&&{...ve,rowKey:`msg:${te}`});return}Ba.generation===F.current&&(F.current+=1),Ar.current=!1,Yp.current=void 0,Cg(!1),As(null);return}if(Ba.settled){if(!z){Ar.current=!1,As(null);return}if(Ba.virtual?Ve.length===Ba.messageCount:z.scrollHeight===Ba.scrollHeight){if(Ar.current=!1,jr.current!==void 0)return;let te=DF,ve=()=>{if(jr.current=void 0,Ba.generation===F.current&&J9.current===Ba.messageCount){if(te-=1,te>0){jr.current=requestAnimationFrame(ve);return}As(Ne=>Ne===Ba?null:Ne)}};jr.current=requestAnimationFrame(ve);return}jr.current!==void 0&&(cancelAnimationFrame(jr.current),jr.current=void 0),jr.current=requestAnimationFrame(()=>{if(jr.current=void 0,Ba.generation!==F.current)return;if(Ba.rowKey&&!tm(Ba.rowKey)){Ar.current=!1,As(null);return}let te=Ba.rowKey?Array.from(z.querySelectorAll("[data-message-row-key]")).find(ve=>ve.dataset.messageRowKey===Ba.rowKey):void 0;te&&Ba.rowTop!==void 0?z.scrollTop+=te.getBoundingClientRect().top-Ba.rowTop:z.scrollTop=Ba.scrollTop+Math.max(0,z.scrollHeight-Ba.scrollHeight),Ar.current=!1,As(null)})}},[tm,Ve.length,Ba,zn,qc,gl]);let n7=ns.getVirtualItems(),Od=ns.getTotalSize(),r7=(0,y.useRef)({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});r7.current={entryIndexById:Nb,headerOffset:or,isVisible:Bc,turnIdByDisplayIndex:ej,visibleItems:zn};let o7=(0,y.useCallback)(()=>{let z=Kn(),te=r7.current;if(!z||!te.isVisible||te.entryIndexById.size===0){mg(lt=>lt===null?lt:null);return}let ve=z.getBoundingClientRect(),Ne=ve.top,Ce=ve.bottom,Ht=Ne+(Ce-Ne)/2,Jt=[],sa=null,ot=Number.POSITIVE_INFINITY;z.querySelectorAll("[data-index]").forEach(lt=>{let _a=lt.dataset.index;if(_a===void 0)return;let Sa=Number(_a);if(!Number.isFinite(Sa))return;let Tn=Sa-te.headerOffset;if(Tn<0||Tn>=te.visibleItems.length)return;let rs=lt.getBoundingClientRect();if(rs.bottom<Ne||rs.top>Ce)return;Jt.push(Tn);let Lg=rs.top+(rs.bottom-rs.top)/2,u7=Math.abs(Lg-Ht);u7<ot&&(ot=u7,sa=Tn)});let Mt=NTe(te.visibleItems,Jt,te.entryIndexById,sa,te.turnIdByDisplayIndex);mg(lt=>lt?.startIndex===Mt?.startIndex&<?.endIndex===Mt?.endIndex&<?.currentIndex===Mt?.currentIndex?lt:Mt)},[Kn]),Sl=(0,y.useCallback)(()=>{xa.current!==null&&cancelAnimationFrame(xa.current),xa.current=requestAnimationFrame(()=>{xa.current=null,o7()})},[o7]);(0,y.useEffect)(()=>()=>{ut.current!==null&&(clearTimeout(ut.current),ut.current=null),xa.current!==null&&(cancelAnimationFrame(xa.current),xa.current=null)},[]),(0,y.useEffect)(()=>{Sl()},[Sl,am,Od,fi,n7.length,Bc]);let[rm,jb]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(!rm)return;let z=setTimeout(()=>jb(null),1600);return()=>clearTimeout(z)},[rm]);let Hb=(0,y.useCallback)((z,te)=>{oa.current=!0,jt(!1),be.current+=1;let ve=be.current;if(ce.current=!0,fi)if(ue.current){let Ne=ns.getOffsetForIndex(z,"center");Ne&&Fn.current&&(Fn.current.scrollTop=Ne[0])}else ns.scrollToIndex(z,{align:"center"});else Fn.current?.querySelector(`[data-index="${z}"]`)?.scrollIntoView({block:"center"});ut.current!==null&&clearTimeout(ut.current),ut.current=setTimeout(()=>{ut.current=null,be.current===ve&&(ce.current=!1,Sl(),rr())},150),jb(null),requestAnimationFrame(()=>jb(te))},[fi,ns,jt,Sl,rr]),s7=(0,y.useRef)({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});s7.current={visibleItems:zn,displayItems:We,headerOffset:or,performScrollToRow:Hb};let Xc=(0,y.useRef)(null),om=(0,y.useCallback)((z,te)=>{let{visibleItems:ve,displayItems:Ne,headerOffset:Ce,performScrollToRow:Ht}=s7.current,Jt=Uy(ve,z,te);if(Jt>=0)return Xc.current=null,Ht(Jt+Ce,{messageId:z,callId:te}),!0;let sa=Uy(Ne,z,te);if(sa<0)return!1;let ot=BU(Ne,sa);return ot?(Xc.current={messageId:z,callId:te},Cd(Mt=>{if(Mt.get(ot)===!0)return Mt;let lt=new Map(Mt);return lt.set(ot,!0),lt}),!0):!1},[]);(0,y.useImperativeHandle)(na,()=>({scrollToMessage:om,scrollToBottom:a7}),[om,a7]),(0,y.useEffect)(()=>{let z=Xc.current;if(!z)return;let te=Uy(zn,z.messageId,z.callId);te<0||(Xc.current=null,Hb(te+or,z))},[zn,or,Hb]);let Es=(0,y.useCallback)(async(z=!1,te=!1)=>{let ve=Fn.current;if(!ve||!v||g||Ar.current||b&&!te||Ld.current&&!z)return;Ld.current=!1,Ar.current=!0;let Ne=++F.current;jr.current!==void 0&&(cancelAnimationFrame(jr.current),jr.current=void 0),Cg(!te);let Ce;if(fi){let Mt=String(Vc(or)),lt=DF;if(Ce=await new Promise(_a=>{let Sa=()=>{if(Qp.current=void 0,Ne!==F.current||Fn.current!==ve||!tm(Mt)||lt--<=0){_a(void 0);return}let Tn=Array.from(ve.querySelectorAll("[data-message-row-key]")).find(rs=>rs.dataset.messageRowKey===Mt);Tn?_a({rowKey:Mt,rowTop:Tn.getBoundingClientRect().top}):Qp.current=requestAnimationFrame(Sa)};Qp.current=requestAnimationFrame(Sa)}),!Ce){Ne===F.current&&(Ar.current=!1,Yp.current=void 0,Cg(!1));return}}let Ht=ve.scrollHeight,Jt=ve.scrollTop,sa=ve.getBoundingClientRect().top,ot=Ce?void 0:Array.from(ve.querySelectorAll("[data-message-row-key]")).find(Mt=>{let lt=Mt.dataset.messageRowKey;return lt!==void 0&<.startsWith("msg:")&&Mt.getBoundingClientRect().bottom>sa});oa.current=!0,As({scrollHeight:Ht,scrollTop:Jt,messageCount:Ve.length,virtual:fi,settled:!1,generation:Ne,...Ce??(ot?{rowKey:ot.dataset.messageRowKey,rowTop:ot.getBoundingClientRect().top}:{})});try{vl.current.set(Ne,{ids:new Set(zb.current.map(lt=>lt.id)),resolved:!1}),await v(te?{force:!0}:void 0);let Mt=vl.current.get(Ne);Mt&&(Mt.resolved=!0),Ne===F.current&&As(lt=>lt?.generation===Ne?{...lt,settled:!0}:lt)}catch{vl.current.delete(Ne),Ne===F.current&&(Ld.current=!0,Ar.current=!1,As(null))}finally{Ne===F.current&&Cg(!1)}},[g,v,b,Vc,tm,or,Ve.length,fi]),sj=(0,y.useCallback)(()=>{Es(!0,!0)},[Es]);(0,y.useLayoutEffect)(()=>{let z=vl.current;if(z.size===0)return;let te=e.find(Jt=>!Jt?.id.startsWith("local-"));if(!te)return;let ve=z.entries().next().value;if(!ve)return;let[Ne,Ce]=ve;if(Ce.ids.has(te.id))return;let Ht=[];for(let Jt=0;Jt<e.length;Jt++){let sa=e[Jt];if(!sa||!no(sa)||Ce.ids.has(sa.id))continue;let ot=!1;for(let Mt=Jt+1;Mt<e.length;Mt++){let lt=e[Mt];if(no(lt))break;if(Ce.ids.has(lt.id)){ot=!0;break}}ot&&Ht.push(sa.id)}if(Ht.length===0){if(!Ce.resolved)return}else Uc(Jt=>{let sa=null;for(let ot of Ht)Jt.has(ot)||(sa??=new Set(Jt),sa.add(ot));return sa??Jt});z.delete(Ne);for(let Jt of z.values())for(let sa of e)sa&&Jt.ids.add(sa.id)},[e]),(0,y.useEffect)(()=>{let z=Yp.current;if(z===void 0||g||Ba||Ar.current||(Yp.current=void 0,!m||z!==F.current))return;let te=Kn();te&&te.scrollTop<=JC&&Es(!0)},[Kn,m,Es,g,Ba]);let Wb=(0,y.useCallback)(()=>{let z=Kn();if(!z)return;let te=z.scrollTop;m&&te<=JC&&Es(!0);let ve=Date.now()<=Xp.current;if(ce.current&&!ve){kl.current=te;return}Sl();let Ne=kl.current;kl.current=te;let Ce=z.scrollHeight-te-z.clientHeight;if(rr(),te<Ne-1){let Ht=Ce<jy;ve?(as(),oa.current=!0,jt(!1)):Ht?(oa.current=!1,jt(!0)):oa.current||(as(),jt(!1));return}Ce<jy?(oa.current=!1,jt(!0),Nd()):as()},[Kn,m,Es,rr,Sl,Nd,as,jt]);(0,y.useEffect)(()=>{let z=Kn();if(z)return z.addEventListener("scroll",Wb,{passive:!0}),()=>z.removeEventListener("scroll",Wb)},[Kn,Wb]);let _g=(0,y.useCallback)(()=>{if(!m||g||p||Md)return;let z=Kn();if(!z||z.scrollHeight>z.clientHeight+1)return;let te=Fb.current;if(te!==null&&te.loader===v&&te.totalVirtualSize===Od){Ld.current=!0;return}Fb.current={loader:v,totalVirtualSize:Od},Es()},[p,Kn,m,Es,g,v,Md,Od]);(0,y.useEffect)(()=>{_g()},[_g,Od]),(0,y.useEffect)(()=>{let z=Kn();if(!z)return;let te=()=>{if(di.current=void 0,!(z.scrollTop>JC)){if(g||Ar.current){Yp.current=F.current;return}Es(!0)}},ve=()=>{di.current!==void 0&&cancelAnimationFrame(di.current),di.current=requestAnimationFrame(te)},Ne=ot=>{nm(),ot.deltaY<0&&ve()},Ce=()=>{nm()},Ht=()=>ve(),Jt=ot=>{let Mt=z.getBoundingClientRect(),lt=20;(ot.clientX>=Mt.right-lt||ot.clientY>=Mt.bottom-lt)&&nm()},sa=ot=>{(ot.key==="ArrowUp"||ot.key==="ArrowDown"||ot.key==="PageUp"||ot.key==="PageDown"||ot.key==="Home"||ot.key==="End"||ot.key===" ")&&(nm(),(ot.key==="ArrowUp"||ot.key==="PageUp"||ot.key==="Home")&&ve())};return z.addEventListener("wheel",Ne,{passive:!0}),z.addEventListener("touchstart",Ce,{passive:!0}),z.addEventListener("touchmove",Ht,{passive:!0}),z.addEventListener("pointerdown",Jt,{passive:!0}),z.addEventListener("keydown",sa,{passive:!0}),()=>{z.removeEventListener("wheel",Ne),z.removeEventListener("touchstart",Ce),z.removeEventListener("touchmove",Ht),z.removeEventListener("pointerdown",Jt),z.removeEventListener("keydown",sa),di.current!==void 0&&(cancelAnimationFrame(di.current),di.current=void 0)}},[Kn,Es,g,nm]),(0,y.useEffect)(()=>{let z=Kn();if(!z||typeof ResizeObserver>"u")return;let te=new ResizeObserver(()=>{rr(),_g(),!(Wc.current||oa.current)&&(jt(!0),Zn())});te.observe(z);for(let Ne of Array.from(z.children))te.observe(Ne);let ve=new MutationObserver(Ne=>{for(let Ce of Ne){for(let Ht of Array.from(Ce.addedNodes))Ht instanceof HTMLElement&&te.observe(Ht);for(let Ht of Array.from(Ce.removedNodes))Ht instanceof HTMLElement&&te.unobserve(Ht)}rr()});return ve.observe(z,{childList:!0}),rr(),()=>{te.disconnect(),ve.disconnect()}},[Kn,_g,rr,Zn,jt]),(0,y.useEffect)(()=>{e.length===0&&(oa.current=!1,St.current=!1,jt(!0),Xc.current=null,vl.current.clear(),vt.current=void 0,zt.current=void 0,Cd(z=>z.size?new Map:z),Uc(z=>z.size?new Set:z))},[e.length,jt]),(0,y.useEffect)(()=>{let z=Fn.current;if(!z)return;let te=new ResizeObserver(()=>{Sl(),!Wc.current&&(oa.current||(jt(!0),requestAnimationFrame(()=>{!Wc.current&&!oa.current&&Zn()})))});return te.observe(z),()=>te.disconnect()},[Zn,Sl,jt]),(0,y.useLayoutEffect)(()=>{let z=eTe(e);if(p||f||Td.current){lo.current=z,Hc.current=!0,ui.current=!1,Td.current=f;return}if(Td.current=f,!Hc.current){lo.current=z,Hc.current=!0,ui.current=!1;return}let te=tTe(e);z&&te?.role==="user"&&z!==lo.current?(oa.current=!1,jt(!0),Xc.current=null,ui.current=!0):ui.current=!1,lo.current=z},[e,p,f,jt]),(0,y.useLayoutEffect)(()=>{Z9.current&&!p&&(oa.current=!1,jt(!0),Zn("auto")),Z9.current=p},[p,Zn,jt]),(0,y.useLayoutEffect)(()=>{if(f){Kp.current=!0;return}if(!Kp.current||p||e.length===0)return;Kp.current=!1,oa.current=!1,jt(!0),Xc.current=null,Ur.current!==void 0&&window.cancelAnimationFrame(Ur.current),_d.current!==void 0&&window.cancelAnimationFrame(_d.current);let z=()=>{Wc.current||oa.current||(jt(!0),Zn("auto"))};Ur.current=window.requestAnimationFrame(()=>{Ur.current=void 0,z(),_d.current=window.requestAnimationFrame(()=>{_d.current=void 0,z()})})},[p,f,e.length,Zn,jt]),(0,y.useLayoutEffect)(()=>{let z=K9.current!==V;K9.current=V,z&&(p||oa.current||(jt(!0),requestAnimationFrame(()=>{!Wc.current&&!oa.current&&Zn("auto")})))},[V,p,Zn,jt]);let Ig=(0,y.useMemo)(()=>_Te(zn),[zn]);(0,y.useLayoutEffect)(()=>{if(!p){if(!Ig){Ob.current=null;return}Ig!==Ob.current&&(Ob.current=Ig,(bl.current||!oa.current)&&requestAnimationFrame(()=>{oa.current||(jt(!0),Zn())}))}},[p,Ig,Zn,jt]),(0,y.useEffect)(()=>{B&&ts&&!Q9.current&&(oa.current=!1,jt(!0),requestAnimationFrame(()=>{oa.current||Zn()})),Q9.current=ts},[B,ts,Zn,jt]);let i7=(0,y.useCallback)(z=>{let te=Ce=>{if(Ce.type==="parallel_agents")return(0,u.jsx)(n6,{timestamp:Ce.timestamp,children:(0,u.jsx)("div",{className:PF(Ce,rm)?pl.flash:void 0,children:(0,u.jsx)(dq,{agents:Ce.agents,autoManageExpansion:fe==="interactive"&&!p,automaticCollapseDelayMs:$c.key===Ce.key&&!Mo?Y8e:void 0,deferAutomaticCollapse:$c.key===Ce.key&&Mo,expandActiveWhenLive:T&&Dc.has(Ce.key),onAutomaticExpansionChange:Tn=>fg(Ce.key,Tn),pendingApproval:r})})});if(Ce.type==="turn_outputs")return(0,u.jsx)(Q7e,{changes:Ce.changes,turnId:Ce.turnId,artifacts:Ce.artifacts,sourceSessionId:ee,scheduledTasks:Ce.scheduledTasks,workspaceCwd:E,onOpenRequest:_e,onReviewChanges:ge??VC,onOpenArtifact:W??VC,onOpenScheduledTask:xe??VC,onError:it});if(Ce.type==="turn_collapse")return(0,u.jsx)(YTe,{turnCollapse:Ce.turnCollapse,onToggleCollapse:t7});let Ht=Ce.message.role==="assistant"?jp.get(Ce.message.id):void 0,Jt;Ce.message.role==="assistant"&&Ht&&!t&&(Jt={turnId:Ht,message:{id:Ce.message.id,content:Ce.message.content,isStreaming:Ce.message.isStreaming,timestamp:Ce.message.timestamp}});let sa=Ht?yg.get(Ht):void 0,ot=Ce.message.promptId??sa?.promptId,Mt=Ce.message.role==="assistant"&&Ce.message.agentMessage?.kind==="agent_message",lt=Ce.message.role==="assistant"&&!Mt?Ce.message.branchRecordId:void 0,_a=Ce.message.role==="user"?Ce.message.content:void 0,Sa=_a!==void 0&&Ce.message.id===X.lastId&&!T&&!m&&!h?{turnIndex:X.turnIndexById.get(Ce.message.id)??0,content:_a}:void 0;return(0,u.jsx)(f7e,{message:Ce.message,onLocateBackgroundSource:Ce.message.role==="system"&&Ce.message.source==="background_notification_turn_started"&&Ce.message.backgroundTurn?.toolUseId&&Uy(We,"",Ce.message.backgroundTurn.toolUseId)>=0?om:void 0,pendingApproval:r,onShowContextDetail:o,onImagePreview:s,onAttachmentPreview:i,onTurnOutputOpen:_e,onToolResultOpen:Ye,onInsightReportOpen:l,onEditUserMessage:c&&Sa?()=>c(Sa.turnIndex,Sa.content):void 0,onSubmitUserMessageEdit:d&&Sa?Tn=>d(Sa.turnIndex,Tn):void 0,workspaceCwd:E,showRetryHint:j,onRetryClick:K,sendFailed:Ce.message.role==="user"&&Ce.message.id===P,onRetrySend:ae,onBranchSession:se,branchRecordId:lt,showAssistantActions:Ce.message.role==="assistant"&&(Mt||jp.has(Ce.message.id)),showAssistantBranch:Ce.message.role==="assistant"&&!Mt&&!T&<!==void 0,assistantFeedbackTurnId:kd&&!Mt?Ht:void 0,assistantFeedbackPromptId:kd&&!Mt?ot:void 0,assistantFeedbackRating:kd&&!Mt&&ot?gg[ot]:void 0,onAssistantFeedbackRate:kg,isLocateFlashing:PF(Ce,rm),assistantTurnFooterInfo:Jt,turnSources:Ht?xd.get(Ht):void 0,onSourceOpen:ke,generateContent:Bt})};if(xl&&z===YC)return I;if(ts&&z===Gc)return N;let ve=z-or,Ne=zn[ve];return Ne?te(Ne):null},[xl,I,ts,N,Gc,r,p,T,Mo,Dc,$c,fe,fg,o,We,om,s,i,l,c,d,X,m,h,Bt,or,zn,rm,jp,kd,yg,gg,kg,t,E,j,K,P,ae,se,t7,ee,W,xe,ge,_e,Ye,xd,ke,it]),l7=(0,y.useCallback)(z=>z?JTe(z):void 0,[]),c7=fi?Od:e;return(0,y.useLayoutEffect)(()=>{if(p)return;let z=ui.current;if(ce.current&&!z){oa.current||(St.current=!0);return}Db.current&&!z||(bl.current||z||!oa.current)&&(oa.current||jt(!0),Zn(z?"smooth":"auto"),ui.current=!1)},[c7,am,p,Zn,jt]),(0,y.useLayoutEffect)(()=>{rr()},[c7,rr,am]),(0,u.jsx)(Gz.Provider,{value:he,children:(0,u.jsxs)("div",{ref:Fn,className:V6(Rt.list,xl&&R?Rt.listWithWelcomeHeader:void 0),"data-web-shell-message-list":!0,onClickCapture:nj,children:[Md&&(0,u.jsx)(r_e,{label:Ke("editor.sessionLoading")}),g&&!Md&&!QU&&(0,u.jsx)("div",{className:Rt.historyStatus,role:"status",children:Ke("history.loadingEarlier")}),h&&!Md&&(0,u.jsx)("div",{className:Rt.historyStatus,role:"status",children:Ke("history.capacityReached")}),b&&!Md&&!h&&(0,u.jsxs)("div",{className:Rt.historyStatus,children:[(0,u.jsx)("span",{role:"status",children:Ke("history.paginationError")}),v&&(0,u.jsx)("button",{type:"button",className:Rt.historyRetryButton,onClick:sj,children:Ke("history.retry")})]}),(0,u.jsx)(a_e,{action:J,entries:Fc,currentTurnId:Pb,currentRange:qp,hidden:!Bc||!tj,onSelect:om}),fi?(0,u.jsx)("div",{ref:ns.containerRef,className:Rt.virtualSizer,children:n7.map(z=>(0,u.jsx)("div",{"data-index":z.index,ref:oj,className:V6(Rt.virtualRow,l7(zn[z.index-or])),"data-message-row-key":String(Vc(z.index)),"data-source-block-ids":OF(zn[z.index-or],e),"data-web-shell-message-row":!0,style:{position:"absolute",top:0,left:0,right:0},children:i7(z.index)},z.key))}):Array.from({length:am},(z,te)=>{let ve=Vc(te),Ne=zn[te-or];return(0,u.jsx)("div",{"data-index":te,className:l7(Ne),"data-message-row-key":String(ve),"data-source-block-ids":OF(Ne,e),"data-web-shell-message-row":!0,children:i7(te)},ve)})]})})})),FF={en:{title:"Something went wrong",body:"An unexpected error occurred and this content could not be displayed.",retry:"Try again",reload:"Reload page"},"zh-CN":{title:"\u51FA\u4E86\u70B9\u95EE\u9898",body:"\u53D1\u751F\u610F\u5916\u9519\u8BEF\uFF0C\u65E0\u6CD5\u663E\u793A\u6B64\u5185\u5BB9\u3002",retry:"\u91CD\u8BD5",reload:"\u91CD\u65B0\u52A0\u8F7D"}},s_e={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},i_e={margin:0,fontSize:"1rem",fontWeight:600},l_e={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},c_e={appearance:"none",cursor:"pointer",padding:"0.4rem 1rem",fontSize:"0.85rem",borderRadius:"6px",border:"1px solid rgba(128, 128, 128, 0.4)",background:"transparent",color:"inherit"};function u_e({error:e,onRetry:t,language:a="en",retryMode:n="reset"}){let r=FF[a]??FF.en;return(0,u.jsxs)("div",{role:"alert",style:s_e,"data-web-shell-error":!0,children:[(0,u.jsx)("p",{style:i_e,children:r.title}),(0,u.jsx)("p",{style:l_e,children:r.body}),!1,(0,u.jsx)("button",{type:"button",style:c_e,onClick:t,children:n==="reload"?r.reload:r.retry})]})}function d_e(e,t,a=!1){return V0e(e,{safeToolProjection:a,includeSourceIdentity:!0,labels:{promptCancelled:t("request.cancelled"),branchSuccess:n=>t("branch.success",{name:n}),modelStreamInterrupted:t("error.modelStreamInterrupted"),loopDetected:t("error.loopDetected")}})}var f_e="_app_1tbv0_1",p_e="_appChat_1tbv0_66",m_e="_content_1tbv0_120",h_e="_themeDark_1tbv0_435",g_e="_themeLight_1tbv0_509",v_e="_contentHasMessages_1tbv0_591",Tp={app:f_e,appChat:p_e,content:m_e,themeDark:h_e,themeLight:g_e,contentHasMessages:v_e},w_e=1e3,y_e=40;function HU(e){if(e!==void 0)return U$(e);if(typeof window>"u")return"en";let t=new URLSearchParams(window.location.search);return U$(t.get("language")??t.get("lang")??navigator.language)}function b_e(e){let t=`${typeof e=="number"&&Number.isFinite(e)&&e>0?e:w_e}px`,a=`calc(${t} + ${y_e}px)`;return{"--chat-regular-content-width":t,"--chat-regular-shell-width":a,"--chat-content-width":t,"--chat-shell-width":a}}function k_e({blocks:e,renderMode:t="readonly",theme:a=E0.Dark,language:n,className:r,style:o,chatMaxWidth:s,workspaceCwd:i="",compactThinking:l=!1,documentExpanded:c=!0,collapseCompletedTurns:d,markdownTableMode:f="basic",virtualScrollThreshold:p,markdown:m,sourceSessionId:g,sources:h,sourceAttachments:b,sourceReferences:v,getAssistantSourcesIcon:w,onSourceOpen:k,composerTagIcons:_,artifact:T,renderToolHeaderExtra:L,parseUserMessageContent:S,renderUserMessageContent:I,renderComposerTag:R,renderComposerTagTooltip:E,renderAssistantTurnFooter:N,mcpAppBaseUrl:O}){let $=t==="document",B=!$&&(d??!0),V=$?"basic":f,G=HU(n),J=(0,y.useMemo)(()=>VF(G),[G]),Z=(0,y.useMemo)(()=>d_e(e,J,$),[e,$,J]),Q=(0,y.useMemo)(()=>mse(h??[],b??[]),[h,b]),A=(0,y.useMemo)(()=>A0e(Z),[Z]),j=(0,y.useMemo)(()=>S0e(Z),[Z]),K=(0,y.useMemo)(()=>({artifact:T,composerTagIcons:_,renderToolHeaderExtra:L,parseUserMessageContent:S,renderUserMessageContent:I,renderComposerTag:R,renderComposerTagTooltip:E,renderAssistantTurnFooter:N,compactThinking:l,collapseCompletedTurns:B,markdownTableMode:V,markdown:m,sourceReferences:v,getAssistantSourcesIcon:w}),[T,B,l,_,m,v,w,V,S,N,R,E,L,I]),P=(0,y.useRef)(null),[ae,se]=(0,y.useState)(null),Ee=(0,y.useRef)(new Set),q=[Tp.app,Tp.appChat,a===E0.Light?Tp.themeLight:Tp.themeDark,a===E0.Dark?"dark":void 0,r].filter(Boolean).join(" "),oe=(0,y.useMemo)(()=>({...o,...b_e(s)}),[s,o]);return(0,y.useLayoutEffect)(()=>{if(typeof document>"u")return;let ie=document.createElement("div");return ie.dataset.webShellPortalRoot="",ie.dataset.webShellShadcn="",document.body.appendChild(ie),se(ie),()=>{ie.remove(),se(null)}},[]),(0,y.useLayoutEffect)(()=>{let ie=P.current;if(!ie||!ae)return;let ee=null,he=()=>{ee=null;let W=getComputedStyle(ie),xe=new Set;ae.dataset.webShellShadcn="",ae.classList.toggle("dark",a===E0.Dark),ae.lang=G;for(let _e=0;_e<W.length;_e+=1){let Ye=W[_e];Ye.startsWith("--")&&(xe.add(Ye),ae.style.setProperty(Ye,W.getPropertyValue(Ye)))}for(let _e of Ee.current)xe.has(_e)||ae.style.removeProperty(_e);Ee.current=xe},ke=()=>{ee===null&&(ee=requestAnimationFrame(he))};he();let Me=new MutationObserver(ke),ge=ie;for(;ge;)Me.observe(ge,{attributes:!0,attributeFilter:["class","style","data-theme","lang"]}),ge=ge.parentElement;return window.addEventListener("resize",ke),()=>{Me.disconnect(),window.removeEventListener("resize",ke),ee!==null&&cancelAnimationFrame(ee)}},[ae,G,q,oe,a]),(0,u.jsx)(ble,{value:a,children:(0,u.jsx)(sie,{language:G,children:(0,u.jsx)(Wz.Provider,{value:O,children:(0,u.jsx)(XF.Provider,{value:ae,children:(0,u.jsx)(iie,{value:t,children:(0,u.jsx)(lie,{value:c,children:(0,u.jsx)(wse,{value:K,children:(0,u.jsx)(vse,{timeline:j,details:A,children:(0,u.jsx)(X6.Provider,{value:!1,children:(0,u.jsx)("div",{ref:P,className:q,style:oe,"data-web-shell-root":!0,"data-web-shell-shadcn":!0,"data-transcript-render-mode":t,"data-document-expanded":$?String(c):void 0,lang:G,children:(0,u.jsx)("div",{className:`${Tp.content} ${Tp.contentHasMessages}`,children:(0,u.jsx)(o_e,{messages:Z,sourceSessionId:g,sourceEntries:$?void 0:Q,onSourceOpen:k,pendingApproval:null,isResponding:!1,workspaceCwd:i,virtualScrollThreshold:$?Number.MAX_SAFE_INTEGER:p,hideSessionTimeline:$})})})})})})})})})})})})}function WU(e){let t=HU(e.language);return(0,u.jsx)(cd,{label:"web-shell-transcript-root",resetKeys:[e.blocks,t],fallback:(a,n)=>(0,u.jsx)(u_e,{error:a,onRetry:n,language:t}),children:(0,u.jsx)(k_e,{...e})})}var gt=je(mn(),1),XU="qwen-export-theme";function vd(e){return e===void 0||typeof e=="string"}function wd(e){return e===void 0||typeof e=="number"&&Number.isFinite(e)&&e>=0}function x_e(){let e=document.getElementById("transcript-document");if(!(e instanceof HTMLScriptElement))throw new Error("Transcript document envelope is missing.");let t=e.textContent??"";if(t.length>33554432)throw new Error("Transcript document exceeds the envelope budget.");if(new TextEncoder().encode(t).byteLength>33554432)throw new Error("Transcript document exceeds the envelope budget.");let a=JSON.parse(t);if(a.schemaVersion!==1||a.rendererVersion!=="0.25.2+cf4dd6243bfd28c7"||!Array.isArray(a.blocks)||a.blocks.length>1e3||!a.metadata||typeof a.metadata!="object"||Array.isArray(a.metadata)||!vd(a.metadata.title)||!vd(a.metadata.startedAt)||!vd(a.metadata.projectName)||!vd(a.metadata.repository)||!vd(a.metadata.gitBranch)||!vd(a.metadata.model)||!vd(a.metadata.channel)||!wd(a.metadata.promptCount)||!wd(a.metadata.contextUsagePercent)||!wd(a.metadata.contextWindowSize)||!wd(a.metadata.totalTokens)||!wd(a.metadata.filesWritten)||!wd(a.metadata.linesAdded)||!wd(a.metadata.linesRemoved)||typeof a.metadata.exportedAt!="string"||typeof a.metadata.complete!="boolean"||typeof a.metadata.truncated!="boolean")throw new Error("Transcript document is incompatible with this renderer.");return a}function S_e(){try{let e=localStorage.getItem(XU);if(e==="light"||e==="dark")return e}catch{}return"dark"}function GU(e){if(!e)return;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function C_e(e){if(e!==void 0)return e>=1e6?`${e/1e6}m`:e>=1e3?`${e/1e3}k`:String(e)}function oo({label:e,value:t}){return t===void 0||t===""?null:(0,gt.jsxs)("div",{className:"document-metadata-item",children:[(0,gt.jsx)("dt",{children:e}),(0,gt.jsx)("dd",{children:t})]})}function T_e({metadata:e}){let t=e.contextUsagePercent===void 0?void 0:`${e.contextUsagePercent>100?">100":e.contextUsagePercent}%${e.contextWindowSize===void 0?"":` of ${C_e(e.contextWindowSize)}`}`;return(0,gt.jsxs)("aside",{className:"document-metadata","data-document-metadata":!0,children:[(0,gt.jsxs)("section",{children:[(0,gt.jsx)("h2",{children:"Session Info"}),(0,gt.jsxs)("dl",{children:[(0,gt.jsx)(oo,{label:"Session",value:e.title??"Qwen Code Chat Export"}),(0,gt.jsx)(oo,{label:"Started",value:GU(e.startedAt)}),(0,gt.jsx)(oo,{label:"Exported",value:GU(e.exportedAt)}),(0,gt.jsx)(oo,{label:"Project",value:e.projectName}),(0,gt.jsx)(oo,{label:"Repository",value:e.repository}),(0,gt.jsx)(oo,{label:"Branch",value:e.gitBranch}),(0,gt.jsx)(oo,{label:"Model",value:e.model}),(0,gt.jsx)(oo,{label:"Channel",value:e.channel})]})]}),(0,gt.jsxs)("section",{children:[(0,gt.jsx)("h2",{children:"Statistics"}),(0,gt.jsxs)("dl",{children:[(0,gt.jsx)(oo,{label:"Prompts",value:e.promptCount}),(0,gt.jsx)(oo,{label:"Context Usage",value:t}),(0,gt.jsx)(oo,{label:"Tokens",value:e.totalTokens?.toLocaleString()})]})]}),(0,gt.jsxs)("section",{children:[(0,gt.jsx)("h2",{children:"File Operations"}),(0,gt.jsxs)("dl",{children:[(0,gt.jsx)(oo,{label:"Files modified",value:e.filesWritten}),(0,gt.jsx)(oo,{label:"Lines added",value:e.linesAdded}),(0,gt.jsx)(oo,{label:"Lines removed",value:e.linesRemoved})]})]})]})}function __e({value:e}){let[t,a]=(0,so.useState)(S_e),[n,r]=(0,so.useState)(!0),o=(0,so.useRef)(n),s=(0,so.useRef)(null);return(0,so.useEffect)(()=>{document.documentElement.classList.toggle("dark",t==="dark"),document.documentElement.classList.toggle("light",t==="light");try{localStorage.setItem(XU,t)}catch{}},[t]),(0,so.useEffect)(()=>{o.current=n},[n]),(0,so.useEffect)(()=>{let i=()=>{s.current=o.current,(0,V9.flushSync)(()=>r(!0))},l=()=>{let c=s.current;s.current=null,c!==null&&(0,V9.flushSync)(()=>r(c))};return addEventListener("beforeprint",i),addEventListener("afterprint",l),()=>{removeEventListener("beforeprint",i),removeEventListener("afterprint",l)}},[]),(0,so.useEffect)(()=>{document.title=e.metadata.title||"Qwen Code Chat Export",requestAnimationFrame(()=>{document.body.dataset.renderComplete="true"})},[e.metadata.title]),(0,gt.jsxs)("main",{className:"document-shell",children:[(0,gt.jsxs)("header",{className:"document-header",children:[(0,gt.jsxs)("div",{children:[(0,gt.jsx)("h1",{children:e.metadata.title||"Qwen Code Chat Export"}),(0,gt.jsx)("p",{children:e.metadata.startedAt?`Started ${e.metadata.startedAt}`:`Exported ${e.metadata.exportedAt}`})]}),(!e.metadata.complete||e.metadata.truncated)&&(0,gt.jsx)("span",{className:"document-warning",children:"Partial export"}),(0,gt.jsxs)("div",{className:"document-actions","aria-label":"Document controls",children:[(0,gt.jsx)("button",{type:"button","data-document-expand-all":!0,disabled:n,onClick:()=>r(!0),children:"Expand all"}),(0,gt.jsx)("button",{type:"button","data-document-collapse-all":!0,disabled:!n,onClick:()=>r(!1),children:"Collapse all"}),(0,gt.jsx)("button",{type:"button","data-document-theme-toggle":!0,"aria-label":`Switch to ${t==="dark"?"light":"dark"} theme`,onClick:()=>a(i=>i==="dark"?"light":"dark"),children:t==="dark"?"Light theme":"Dark theme"})]})]}),(0,gt.jsxs)("div",{className:"document-content",children:[(0,gt.jsx)("div",{className:"document-transcript",children:(0,gt.jsx)(WU,{blocks:e.blocks,renderMode:"document",compactThinking:!0,documentExpanded:n,theme:t})}),(0,gt.jsx)(T_e,{metadata:e.metadata})]})]})}function KU(){return(0,so.useEffect)(()=>{document.body.dataset.renderComplete="error"},[]),(0,gt.jsxs)("main",{className:"document-error",role:"alert",children:[(0,gt.jsx)("h1",{children:"Unable to open this chat export"}),(0,gt.jsx)("p",{children:"The file is incomplete or uses an incompatible renderer version."})]})}var X9=class extends so.Component{constructor(){super(...arguments);this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,gt.jsx)(KU,{}):this.props.children}},ZU=document.getElementById("app");if(!ZU)throw new Error("Transcript document root is missing.");if(document.body.dataset.renderComplete!=="error"){let e=(0,VU.createRoot)(ZU);try{e.render((0,gt.jsx)(X9,{children:(0,gt.jsx)(__e,{value:x_e()})}))}catch{e.render((0,gt.jsx)(KU,{}))}}})();
|