@ziroo/code 1.0.1 → 1.0.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/README.md +59 -175
- package/chunks/{MaxSizedBox-Q2JOCPAR.js → MaxSizedBox-AE6XDJVP.js} +19 -19
- package/chunks/{StandaloneSessionPicker-U3KQ4SRL.js → StandaloneSessionPicker-P4YAL7JP.js} +32 -32
- package/chunks/{acp-subagent-executor-5AY2F4R4.js → acp-subagent-executor-OXSWEENE.js} +22 -22
- package/chunks/{acpAgent-GB5W6MQG.js → acpAgent-7GLEBL6L.js} +59 -59
- package/chunks/{agent-TPX4E25J.js → agent-LM6L5HKI.js} +8 -8
- package/chunks/{agent-headless-C4ARK2AY.js → agent-headless-SXLG3VFE.js} +8 -8
- package/chunks/{anthropicContentGenerator-7BZ32PUH.js → anthropicContentGenerator-EQYVBR54.js} +3 -3
- package/chunks/{boos-release-JACDEY5J.js → boos-release-QUFXXUYD.js} +20 -20
- package/chunks/{bridge-Y2JOQBRU.js → bridge-AQ7UPXAU.js} +22 -22
- package/chunks/{channel-settings-store-VIG5ZWSL.js → channel-settings-store-N2EC6WO7.js} +24 -24
- package/chunks/{chunk-FEHNDQ3H.js → chunk-2GG7PSPS.js} +11 -11
- package/chunks/{chunk-7GJDRSHC.js → chunk-2PRGIRRX.js} +1 -1
- package/chunks/{chunk-QSLYNAIW.js → chunk-34GGSVLG.js} +2 -2
- package/chunks/{chunk-2DUDBNQ3.js → chunk-36N46BV6.js} +2 -2
- package/chunks/{chunk-6LRD3NFT.js → chunk-3OS2WJAJ.js} +8 -8
- package/chunks/{chunk-HO2RNYFB.js → chunk-4N4YBX4A.js} +1 -1
- package/chunks/{chunk-X4RCK3QL.js → chunk-4ODWIFWU.js} +3 -3
- package/chunks/{chunk-IB26TZTM.js → chunk-4OHHXBBK.js} +4 -4
- package/chunks/{chunk-3D7CPWNN.js → chunk-4TCAGPOZ.js} +3 -3
- package/chunks/{chunk-ES7I5JQP.js → chunk-533IZYSM.js} +4 -4
- package/chunks/{chunk-YRLOQQT5.js → chunk-55MLM4TC.js} +1 -1
- package/chunks/{chunk-QQ3RA43B.js → chunk-5ISUWKAK.js} +4 -4
- package/chunks/{chunk-6O7MSMS5.js → chunk-5YQBH2BN.js} +6 -6
- package/chunks/{chunk-XOAXVIQK.js → chunk-5YSS7T3I.js} +48 -48
- package/chunks/{chunk-5XSSWEEZ.js → chunk-6JI7QTXH.js} +5 -5
- package/chunks/{chunk-5VRPMPHD.js → chunk-766M343P.js} +3 -3
- package/chunks/{chunk-ITS5YND4.js → chunk-773URJVC.js} +1 -1
- package/chunks/{chunk-QI7DF3RJ.js → chunk-77TSYP5H.js} +2 -2
- package/chunks/{chunk-MRWPLS7R.js → chunk-7LAZVXPX.js} +1 -1
- package/chunks/{chunk-RS5KUZH7.js → chunk-AAZUDZ46.js} +1 -1
- package/chunks/{chunk-JWBGDOGT.js → chunk-APLLBEY7.js} +1 -1
- package/chunks/{chunk-YFG6IUPF.js → chunk-AQ6645JB.js} +1 -1
- package/chunks/{chunk-KUI7I6QG.js → chunk-ASJUZ7TM.js} +3 -3
- package/chunks/{chunk-ELJAWV7C.js → chunk-BBNOVVVO.js} +2 -2
- package/chunks/{chunk-FWY6ZYOV.js → chunk-CHXTKBVX.js} +5 -5
- package/chunks/{chunk-J5YIW77R.js → chunk-D7XS6D3O.js} +1 -1
- package/chunks/{chunk-MTSWQFYX.js → chunk-EF3CAROL.js} +5 -5
- package/chunks/{chunk-GAIWRTKM.js → chunk-EFNNICVF.js} +3 -3
- package/chunks/{chunk-B2IE7KRJ.js → chunk-EFY4Q6WS.js} +2 -2
- package/chunks/{chunk-JIN6UMM4.js → chunk-FCQBCZHR.js} +1 -1
- package/chunks/{chunk-IFJGGAHR.js → chunk-FOJZAE5N.js} +1 -1
- package/chunks/{chunk-TWIIOXSD.js → chunk-FVVPUV3Z.js} +28 -28
- package/chunks/{chunk-ULKOQQYG.js → chunk-FZ5CX3PV.js} +2 -2
- package/chunks/{chunk-X6VBKXOO.js → chunk-G6GUBKKA.js} +1 -1
- package/chunks/{chunk-WHE5M3SY.js → chunk-GADUNIHK.js} +1 -1
- package/chunks/{chunk-CRWUPJDQ.js → chunk-GQ4HZYC5.js} +1 -1
- package/chunks/{chunk-GVIIPBTL.js → chunk-H5BBPD5X.js} +1 -1
- package/chunks/{chunk-RUIFG3KP.js → chunk-HAL2JWR6.js} +9 -9
- package/chunks/{chunk-LRIKJZ6F.js → chunk-HDVJK6ZF.js} +3 -3
- package/chunks/{chunk-CEGXFKFY.js → chunk-HVMEOGSS.js} +7 -7
- package/chunks/{chunk-WGNKGUWY.js → chunk-I6PD5PPF.js} +2 -2
- package/chunks/{chunk-UTSD75IR.js → chunk-ICT5QTBR.js} +1 -1
- package/chunks/{chunk-KSRQQPLS.js → chunk-IPCGWUQ2.js} +1 -1
- package/chunks/{chunk-XBW6ZPSB.js → chunk-J7GIEMDA.js} +1 -1
- package/chunks/{chunk-B653MHTM.js → chunk-JAKL2XWS.js} +4 -4
- package/chunks/{chunk-I4SK75LC.js → chunk-JAZ2LJCR.js} +1 -1
- package/chunks/{chunk-JM7Y3EMC.js → chunk-JHTX2FXJ.js} +1 -1
- package/chunks/{chunk-QJECQCEX.js → chunk-JJXMFDR6.js} +1 -1
- package/chunks/{chunk-DVGBNV4M.js → chunk-JSXNJ672.js} +9 -9
- package/chunks/{chunk-VUNSANIA.js → chunk-KA5WOAU3.js} +3 -3
- package/chunks/{chunk-SIGAKHJZ.js → chunk-KJOH7AQ6.js} +1 -1
- package/chunks/{chunk-TMKANEWK.js → chunk-KWG2TCKC.js} +1 -1
- package/chunks/{chunk-YO7PCHUV.js → chunk-KXMTNT7A.js} +2 -2
- package/chunks/{chunk-7P3HCIMO.js → chunk-L5ODR7PK.js} +1 -1
- package/chunks/{chunk-H6NBJZMY.js → chunk-M3KE2YHM.js} +1 -1
- package/chunks/{chunk-7IZSFN5Y.js → chunk-M4X5Q5PN.js} +2 -2
- package/chunks/{chunk-UE6P5SMU.js → chunk-MAFSQJAG.js} +1 -1
- package/chunks/{chunk-4R5W6Y5M.js → chunk-NEY3L2Z3.js} +34 -34
- package/chunks/{chunk-OTNRVLMS.js → chunk-NMYCELQ5.js} +4 -4
- package/chunks/{chunk-UO22JLMI.js → chunk-NQMSV4TR.js} +2 -2
- package/chunks/{chunk-7FUEOND4.js → chunk-O7L66CBJ.js} +3 -3
- package/chunks/{chunk-ZLR25Q7U.js → chunk-OXP3KTYJ.js} +15 -15
- package/chunks/{chunk-Y46AMTI4.js → chunk-PDSYERRI.js} +3 -3
- package/chunks/{chunk-TCDJGWG6.js → chunk-PPSIJ3TJ.js} +1 -1
- package/chunks/{chunk-PSYHTJZ7.js → chunk-QTE6ZVBT.js} +14 -14
- package/chunks/{chunk-FAF5P2F4.js → chunk-RB3ZWUBO.js} +1 -1
- package/chunks/{chunk-XS7T37RM.js → chunk-REZX7PDN.js} +5 -5
- package/chunks/{chunk-D4ARUGJI.js → chunk-RJNTBHPV.js} +1 -1
- package/chunks/{chunk-2HGEPNRT.js → chunk-RP6RKYHM.js} +3 -3
- package/chunks/{chunk-NYUO6LAC.js → chunk-TDSZLLAU.js} +1 -1
- package/chunks/{chunk-CCAZCEGZ.js → chunk-TUBH5GZ5.js} +4 -4
- package/chunks/{chunk-LKTV3LED.js → chunk-U5AO3GES.js} +1 -1
- package/chunks/{chunk-VV5H2CBH.js → chunk-UBNQZI33.js} +3 -3
- package/chunks/{chunk-2KW2NLXZ.js → chunk-UC3D3ERG.js} +2 -2
- package/chunks/{chunk-OZWVZDLL.js → chunk-VNOH23VD.js} +3 -3
- package/chunks/{chunk-ANPUTLIM.js → chunk-W2PNTNUF.js} +3 -3
- package/chunks/{chunk-XQRIVVY4.js → chunk-WFMB7UJE.js} +1 -1
- package/chunks/{chunk-GC6C223E.js → chunk-WJ5FRMHA.js} +1 -1
- package/chunks/{chunk-KMTKYZ4L.js → chunk-WLMZRQLB.js} +2 -2
- package/chunks/{chunk-JY56VMDP.js → chunk-XEVW4MH5.js} +2 -2
- package/chunks/{chunk-HKB3RRTW.js → chunk-XEWQCJYQ.js} +4 -4
- package/chunks/{chunk-ZW2LQ3O5.js → chunk-XXKCXJGV.js} +3 -3
- package/chunks/{chunk-CGS7NNKS.js → chunk-XZUA36L6.js} +4 -4
- package/chunks/{chunk-W56A5INY.js → chunk-Y3PSIJFM.js} +2 -2
- package/chunks/{chunk-577FK7HT.js → chunk-YAE47XAF.js} +13 -13
- package/chunks/{chunk-DRGCSW76.js → chunk-YQJBYTAO.js} +4 -4
- package/chunks/{chunk-J7MWEI4R.js → chunk-YWO6STQY.js} +3 -3
- package/chunks/{chunk-7S2Q55NS.js → chunk-ZB7HWY5O.js} +3 -3
- package/chunks/{chunk-T7BMF2JK.js → chunk-ZHNB7IC7.js} +1 -1
- package/chunks/{codex-subagent-executor-6OBS4V63.js → codex-subagent-executor-F7DCLOHZ.js} +22 -22
- package/chunks/{config-utils-5DSANA3X.js → config-utils-63EK3PLX.js} +19 -19
- package/chunks/{contextCommand-5QZJAGOK.js → contextCommand-LPAJPT6C.js} +20 -20
- package/chunks/{core-runtime-2H3XD5KG.js → core-runtime-NJ2F2WO3.js} +19 -19
- package/chunks/{create-sub-session-SO3ZTQKE.js → create-sub-session-UHB3B3AX.js} +20 -20
- package/chunks/{daemon-git-worktree-guard-GTKEB7OB.js → daemon-git-worktree-guard-BHD3BRGI.js} +19 -19
- package/chunks/{daemon-status-provider-FUEHZ3TJ.js → daemon-status-provider-MTO4LPW7.js} +27 -27
- package/chunks/{daemon-trust-policy-7AQNJEAU.js → daemon-trust-policy-CQZMBB26.js} +24 -24
- package/chunks/{daemon-trust-policy-monitor-BINZYOZM.js → daemon-trust-policy-monitor-GQP5EL5S.js} +24 -24
- package/chunks/{deferred-core-runtime-UWVMWUSZ.js → deferred-core-runtime-VVVTV3BL.js} +19 -19
- package/chunks/{edit-OMJOFFUL.js → edit-NKYGXV44.js} +10 -10
- package/chunks/{enterPlanMode-HF7QYLFD.js → enterPlanMode-VKOJKPBP.js} +8 -8
- package/chunks/{environment-PZZBLDDQ.js → environment-F2SFPUAX.js} +21 -21
- package/chunks/{errors-WRCB4RT3.js → errors-GBN2CLPB.js} +21 -21
- package/chunks/{execution-tool-7UW3FHLT.js → execution-tool-DCH6YQSY.js} +10 -10
- package/chunks/{execution-worker-ZKCKWUAW.js → execution-worker-ETIBXT6U.js} +13 -13
- package/chunks/{exitPlanMode-IS7BPROL.js → exitPlanMode-3SKF5ULE.js} +8 -8
- package/chunks/{fast-path-RX5DKDNR.js → fast-path-XAOYHJRJ.js} +2 -2
- package/chunks/{glob-SV27XA7L.js → glob-CQNTPO4I.js} +8 -8
- package/chunks/{goal-tools-CTHXJCKV.js → goal-tools-YINHW3LU.js} +8 -8
- package/chunks/{handleAutoUpdate-7OHWBVHV.js → handleAutoUpdate-CSVD25VH.js} +22 -22
- package/chunks/{i18n-IASTHFDU.js → i18n-RQMF4KIW.js} +19 -19
- package/chunks/{initializer-QZY2XJFE.js → initializer-K42IRXUJ.js} +24 -24
- package/chunks/{installationInfo-CZREULWG.js → installationInfo-P4S3ABXV.js} +19 -19
- package/chunks/{list-F6BKOYSL.js → list-ICNF4DJL.js} +27 -27
- package/chunks/{llm-55SFBSF6.js → llm-EM6EMXPS.js} +52 -52
- package/chunks/{llm-content-generator-C2IULOA6.js → llm-content-generator-LTPAGW7F.js} +3 -3
- package/chunks/{loadedSettingsAdapter-TRF4NN3K.js → loadedSettingsAdapter-XG7Q54GF.js} +24 -24
- package/chunks/{local-execution-environment-PPNGCRRH.js → local-execution-environment-L2R3GPPM.js} +13 -13
- package/chunks/{loggingContentGenerator-OVVFECFP.js → loggingContentGenerator-NXHN7DFF.js} +9 -9
- package/chunks/{managed-npm-update-ODB7PJTB.js → managed-npm-update-NGWD2TE2.js} +19 -19
- package/chunks/{mcp-6UWLYURH.js → mcp-2RM6NY44.js} +24 -24
- package/chunks/{model-call-collection-7RK4O6ZJ.js → model-call-collection-SULIZ2WM.js} +1 -1
- package/chunks/{model-configuration-4KHUABDY.js → model-configuration-DZVJWYDS.js} +24 -24
- package/chunks/{modelConfigUtils-G6OTPT3A.js → modelConfigUtils-6ZATXNBZ.js} +20 -20
- package/chunks/{monitor-QHNB6VRT.js → monitor-AXOG2VVI.js} +8 -8
- package/chunks/{nonInteractiveCli-PPPWBPCD.js → nonInteractiveCli-HYAKFUQE.js} +50 -50
- package/chunks/{nonInteractiveToolExecutor-NWTL7LE4.js → nonInteractiveToolExecutor-C6AZROCN.js} +9 -9
- package/chunks/{notebook-edit-MK2H45YA.js → notebook-edit-D2OMHDEJ.js} +9 -9
- package/chunks/{omni-3MPDLUYX.js → omni-TMZWPVOE.js} +7 -7
- package/chunks/{openaiContentGenerator-RARLY2JJ.js → openaiContentGenerator-F7RNYUSJ.js} +6 -6
- package/chunks/{openaiResponsesContentGenerator-5SASJ3UU.js → openaiResponsesContentGenerator-2WUWCSGR.js} +2 -2
- package/chunks/{pidfile-DHB3GKKM.js → pidfile-XMFKOAX7.js} +19 -19
- package/chunks/{processUtils-ABI7NHUU.js → processUtils-HX75UIIJ.js} +2 -2
- package/chunks/{prompt-terminal-ledger-CRHRHFOU.js → prompt-terminal-ledger-2ANKCQZU.js} +20 -20
- package/chunks/{reactive-degrade-XTWHEG7J.js → reactive-degrade-FB6UAXDW.js} +6 -6
- package/chunks/{read-file-SIWETONB.js → read-file-FDUBNL7U.js} +2 -2
- package/chunks/{ripGrep-5KMUDM3D.js → ripGrep-BJAYYS5X.js} +3 -3
- package/chunks/{run-qwen-serve-SSULB6H3.js → run-qwen-serve-HOJRSKTE.js} +38 -38
- package/chunks/{runtime-EDW62LCI.js → runtime-YJDIT22D.js} +25 -25
- package/chunks/{sandboxConfig-7TKIIVGQ.js → sandboxConfig-HPGK3TLT.js} +19 -19
- package/chunks/{scheduled-tasks-32GCPTKA.js → scheduled-tasks-K4NE6BFL.js} +25 -25
- package/chunks/{scheduler-GYWHSM6Q.js → scheduler-3STY73NU.js} +21 -21
- package/chunks/{serve-EU4BE3NX.js → serve-XOES6FYW.js} +24 -24
- package/chunks/{server-MI4EAJRH.js → server-4FKIR4FW.js} +55 -55
- package/chunks/{session-QJWXM4W3.js → session-57LDIGYD.js} +51 -51
- package/chunks/{session-attachments-root-GS6O6HO5.js → session-attachments-root-ELYAW7TX.js} +19 -19
- package/chunks/{session-pr-refresh-XQI74HRU.js → session-pr-refresh-6BK7LGEL.js} +24 -24
- package/chunks/{settings-O2PKCL6X.js → settings-Q33XSG2I.js} +23 -23
- package/chunks/{shell-ZF2G3HGA.js → shell-7GC7KV7R.js} +8 -8
- package/chunks/{skill-ZYES4JTZ.js → skill-M7AU7ZJO.js} +3 -3
- package/chunks/{skill-settings-AJFHEAB3.js → skill-settings-4IRADBOU.js} +24 -24
- package/chunks/{spawnChannel-R75E6GJY.js → spawnChannel-KWVQ7PN5.js} +21 -21
- package/chunks/{standalone-update-BD72SHPE.js → standalone-update-25M67YEF.js} +20 -20
- package/chunks/{start-opentui-ui-4RUWSZNV.js → start-opentui-ui-EMNVXPYV.js} +56 -56
- package/chunks/{startInteractiveUI-X6ECEZ3N.js → startInteractiveUI-IPQS65AL.js} +60 -60
- package/chunks/{team-create-TUGY6NAK.js → team-create-43JCHJ7E.js} +8 -8
- package/chunks/{team-plan-approval-VF7237WV.js → team-plan-approval-WEW4YEZ6.js} +8 -8
- package/chunks/{terminal-image-renderer-RRCJEWJQ.js → terminal-image-renderer-JI4XZAT6.js} +19 -19
- package/chunks/{theme-manager-NH7O3MIJ.js → theme-manager-UAUH4JZR.js} +19 -19
- package/chunks/{tool-result-media-2PXOQJFH.js → tool-result-media-TZLWS6IM.js} +7 -7
- package/chunks/{tool-search-YE3JQFMK.js → tool-search-47JJFG2G.js} +2 -2
- package/chunks/{total-session-admission-R5TQO5RV.js → total-session-admission-LEUSCAYM.js} +22 -22
- package/chunks/{trustedFolders-4ZSIZHRS.js → trustedFolders-ZDNOUBMY.js} +20 -20
- package/chunks/{update-relaunch-755J32EG.js → update-relaunch-BFIE2TF5.js} +5 -5
- package/chunks/{updateCheck-M77QAS5K.js → updateCheck-WNATFZX5.js} +21 -21
- package/chunks/{upload-config-O57ONA6V.js → upload-config-BDM6VQ2L.js} +4 -4
- package/chunks/{useAutoAcceptIndicator-4Q3JYJUS.js → useAutoAcceptIndicator-7MF27JNW.js} +26 -26
- package/chunks/{validateNonInterActiveAuth-P4J26SAH.js → validateNonInterActiveAuth-CHHURPRY.js} +48 -48
- package/chunks/{version-YS7Z6QEI.js → version-LCAFUCLI.js} +1 -1
- package/chunks/{web-fetch-S543YCL3.js → web-fetch-6EWK33NV.js} +2 -2
- package/chunks/{web-search-AZLDIKXI.js → web-search-D4I6KKCL.js} +4 -4
- package/chunks/{workflow-DPW44KFG.js → workflow-I6PCR6Z4.js} +9 -9
- package/chunks/{workspace-providers-status-KBG4YFN7.js → workspace-providers-status-5NCDWHVK.js} +29 -29
- package/chunks/{workspace-registration-store-3W7MIIMK.js → workspace-registration-store-7OI3V6HT.js} +1 -1
- package/chunks/{workspace-registry-MLFTAWL7.js → workspace-registry-P4RIMY3S.js} +22 -22
- package/chunks/{workspace-runtime-coordinator-ZCYYRG4X.js → workspace-runtime-coordinator-7S636HPY.js} +23 -23
- package/chunks/{workspace-service-GJWEBIRA.js → workspace-service-UAWMARJQ.js} +25 -25
- package/chunks/{workspace-skills-status-GUYXOFWS.js → workspace-skills-status-QNN7QLLG.js} +27 -27
- package/chunks/{workspace-trust-reconciler-3V55KCZA.js → workspace-trust-reconciler-KTRAI3JS.js} +27 -27
- package/chunks/{write-file-S6CWPGLV.js → write-file-3W663MHZ.js} +10 -10
- package/chunks/{zoom-image-B2FLC6RA.js → zoom-image-3AOSKJWX.js} +2 -2
- package/cli.js +12 -12
- package/execution-worker.js +1 -1
- package/export-transcript-document.js +1 -1
- package/package.json +1 -1
- package/web-shell/assets/{abnfDiagram-VCTEODGH-CQyYkbXZ.js → abnfDiagram-VCTEODGH-B2x60Rk3.js} +1 -1
- package/web-shell/assets/{arc-DyYVKvrR.js → arc-Dg10GEs8.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-BCaijm5x.js → architectureDiagram-5GKGNRK7-BQY8S4LV.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-0qHfzjme.js → blockDiagram-NRAW4CY4-kAWHNGCL.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-C_gS0Qwg.js → c4Diagram-UCG6FXSJ-DgZ3QvQv.js} +1 -1
- package/web-shell/assets/channel-CiI5JOh7.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-LWJWNW3v.js → chunk-2Q5K7J3B-CD1ayqhd.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-4UgI-TmG.js → chunk-5VM5RSS4-BcegqjU1.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-De2tA6j1.js → chunk-F27PBJKO-dU88I5xu.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-3LP_lZ_S.js → chunk-G27WJ6UU-BYrrudaW.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-C54lYdnu.js → chunk-JWPE2WC7-BWFmBFi8.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-D1Q4lEm9.js → chunk-LCL6LL3I-IQawQXu2.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-6BoeBX0v.js → chunk-POPQ4Y6H-CtetmNAQ.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-dT4vC6pN.js → chunk-SVP7TREG-r7fzTemk.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-CFQEes_F.js → chunk-XXDRQBXY-3KxjYrnl.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-B_DSU2pm.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-B_DSU2pm.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-ClvmvQTH.js → cose-bilkent-JH36ORCC-d_-9zC98.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-DwfwwS7z.js → cynefin-OW5HDTMX-haMIoxCZ.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-BhsPHxR2.js → cynefinDiagram-5FMLGOSQ-DglDDPuI.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-DVxjxvpx.js → dagre-3AP2YEHR-BSgP96YL.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-BAOLm3Ts.js → diagram-S7CK7UJ4-Czni9K67.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-vrcedCb8.js → diagram-UQ7AKVKN-D7BJA-_K.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-D6uJsbFc.js → diagram-VSXAHHWV-BCOwiK7u.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-Byf7duhF.js → diagram-VX7I27RA-B55ho8Un.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-CcR7xx1S.js → diagram-Z3DM3KII-C4ROAETQ.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-GYYAXVI6.js → ebnfDiagram-PWID7BFC-D6rqTgWX.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-ke4WpvXl.js → erDiagram-SSCWMZ5O-Lie6ayrt.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-D8PujwQP.js → flowDiagram-A5DVABFB-DhCi5fe7.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-CGuauosi.js → ganttDiagram-EL5Y4UJY-Ddt7fwy-.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-Cc80WgEl.js → gitGraphDiagram-WWUBYQGX-D5K8VrUo.js} +1 -1
- package/web-shell/assets/{index-CQxep91K.js → index-BgwXHnoB.js} +1 -1
- package/web-shell/assets/{index-D5GdGSA7.js → index-C-kwHBey.js} +3 -3
- package/web-shell/assets/{infoDiagram-RXCK75RN-BStELVvd.js → infoDiagram-RXCK75RN-BEd5ZNPm.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-C-NTa1ph.js → ishikawaDiagram-5VMMS53U-QgJL18nx.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-9SEdumop.js → journeyDiagram-EYS64GPL-CteQlmE5.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-DENZOTcv.js → kanban-definition-3QL26DDD-CgraRinm.js} +1 -1
- package/web-shell/assets/{layout-DSB-mDG5.js → layout-V3Sqj-6n.js} +1 -1
- package/web-shell/assets/{linear-BZWN94TW.js → linear-OZGS3P9o.js} +1 -1
- package/web-shell/assets/{mermaid.core-BhKZI204.js → mermaid.core-Cj1nqB6l.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-Cp0MzK8b.js → mindmap-definition-FBJOCRG2-O_Gz_Qyj.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-XFvOfPoX.js → pegDiagram-XKGWAZYB-ClAXBrOi.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-b0ozwQFT.js → pieDiagram-E7YTZNPT-6PyEIccZ.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-vbMIToVY.js → quadrantDiagram-AXDQQJYC-DbH8pO9i.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-DOtea3y-.js → railroadDiagram-O6MQD6OU-DIMPehjD.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-CXBJUucx.js → requirementDiagram-EFPCY7ZU-CHyYCEoY.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-BUfVMTe0.js → sankeyDiagram-P5KCCOFB-B8Q8oq5P.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-jxPhAE9t.js → sequenceDiagram-WJ2MYXX4-2w5GcO-g.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-Dj02ZTte.js → sizeCapture-X5ZJPWSS--sHR6Yun.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-BCDWSaZ3.js → stateDiagram-HBIQ2CUA-BRLM4uVn.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-tN4VyP8e.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-D2DG3vEa.js → swimlanes-XN3QIQJK-CQq6kzIf.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-HtRX6oN2.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-Kedc8zSU.js → timeline-definition-24CTP7MA-BTu32ToH.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-CdjfgUvk.js → vennDiagram-4TSXK5OY-CpEKggCs.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-BOGxr8BK.js → wardleyDiagram-VM6X3IG4-BYzmZVjK.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-Bp6FKqff.js → xychartDiagram-S5SC5T6Z-CkC73DvL.js} +1 -1
- package/web-shell/index.html +1 -1
- package/web-shell/sw.js +1 -1
- package/web-shell/assets/channel-Bh-Zyno9.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-Kjz1oqzK.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-Kjz1oqzK.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-siJeWAsF.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-lLmV5BSm.js +0 -8
|
@@ -622,4 +622,4 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
622
622
|
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:oe().optional().describe("User's language and region preference in BCP 47 format."),timeZone:oe().optional().describe("User's timezone in IANA format."),userAgent:oe().optional().describe("Host application identifier."),platform:Yt([re("web"),re("desktop"),re("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:ue({touch:Rn().optional().describe("Whether the device supports touch input."),hover:Rn().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:ue({top:zt().describe("Top safe area inset in pixels."),right:zt().describe("Right safe area inset in pixels."),bottom:zt().describe("Bottom safe area inset in pixels."),left:zt().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough();ue({method:re("ui/notifications/host-context-changed"),params:$q.describe("Partial context update containing only changed fields.")});var RSe=ue({method:re("ui/update-model-context"),params:ue({content:Lt(j0).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:Jt(oe(),Tn().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),MSe=ue({method:re("ui/initialize"),params:ue({appInfo:lb.describe("App identification (name and version)."),appCapabilities:ISe.describe("Features and capabilities this app provides."),protocolVersion:oe().describe("Protocol version this app supports.")})});ue({protocolVersion:oe().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:lb.describe("Host application identification and version."),hostCapabilities:TSe.describe("Features and capabilities provided by the host."),hostContext:$q.describe("Rich context about the host environment.")}).passthrough();var f6=class{constructor(t=window.parent,n){Wt(this,"eventTarget"),Wt(this,"eventSource"),Wt(this,"messageListener"),Wt(this,"onclose"),Wt(this,"onerror"),Wt(this,"onmessage"),Wt(this,"sessionId"),Wt(this,"setProtocolVersion"),this.eventTarget=t,this.eventSource=n,this.messageListener=a=>{if(n&&a.source!==this.eventSource){console.debug("Ignoring message from unknown source",a);return}let r=q3e.safeParse(a.data);r.success?(console.debug("Parsed message",r.data),this.onmessage?.(r.data)):a.data?.jsonrpc!=="2.0"?console.debug("Ignoring non-JSON-RPC message",r.error.message,a):(console.error("Failed to parse message",r.error.message,a),this.onerror?.(Error("Invalid JSON-RPC message received: "+r.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(t,n){t.method!==mSe&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}},PSe=[Dq],p6=class extends d6{constructor(t,n,a,r){super(r),Wt(this,"_client"),Wt(this,"_hostInfo"),Wt(this,"_capabilities"),Wt(this,"_appCapabilities"),Wt(this,"_hostContext",{}),Wt(this,"_appInfo"),Wt(this,"_initializedReceived",!1),Wt(this,"_baseReplaceRequestHandler",this.replaceRequestHandler),Wt(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)))}),Wt(this,"eventSchemas",{sizechange:bSe,sandboxready:wSe,initialized:_Se,requestteardown:CSe,loggingmessage:Pq}),Wt(this,"onping"),Wt(this,"_onmessage"),Wt(this,"_onopenlink"),Wt(this,"_ondownloadfile"),Wt(this,"_onrequestdisplaymode"),Wt(this,"_onupdatemodelcontext"),Wt(this,"_oncalltool"),Wt(this,"_onlistresources"),Wt(this,"_onlistresourcetemplates"),Wt(this,"_onreadresource"),Wt(this,"_onlistprompts"),Wt(this,"sendResourceTeardown",this.teardownResource),this._client=t,this._hostInfo=n,this._capabilities=a,this.addEventListener("initialized",()=>{this._initializedReceived=!0}),this._hostContext=r?.hostContext||{},this.setRequestHandler(MSe,o=>this._oninitialize(o)),this.setRequestHandler(cb,(o,s)=>(this.onping?.(o.params,s),{})),this.replaceRequestHandler(FB,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(ESe,async(n,a)=>{if(!this._onmessage)throw Error("No onmessage handler set");return this._onmessage(n.params,a)})}get onopenlink(){return this._onopenlink}set onopenlink(t){this.warnIfRequestHandlerReplaced("onopenlink",this._onopenlink,t),this._onopenlink=t,this.replaceRequestHandler(ySe,async(n,a)=>{if(!this._onopenlink)throw Error("No onopenlink handler set");return this._onopenlink(n.params,a)})}get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(t){this.warnIfRequestHandlerReplaced("ondownloadfile",this._ondownloadfile,t),this._ondownloadfile=t,this.replaceRequestHandler(ASe,async(n,a)=>{if(!this._ondownloadfile)throw Error("No ondownloadfile handler set");return this._ondownloadfile(n.params,a)})}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(FB,async(n,a)=>{if(!this._onrequestdisplaymode)throw Error("No onrequestdisplaymode handler set");return this._onrequestdisplaymode(n.params,a)})}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(RSe,async(n,a)=>{if(!this._onupdatemodelcontext)throw Error("No onupdatemodelcontext handler set");return this._onupdatemodelcontext(n.params,a)})}get oncalltool(){return this._oncalltool}set oncalltool(t){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,t),this._oncalltool=t,this.replaceRequestHandler(Eq,async(n,a)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(n.params,a)})}set oncreatesamplingmessage(t){this.setRequestHandler(Nq,async(n,a)=>t(n.params,a))}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(vq,async(n,a)=>{if(!this._onlistresources)throw Error("No onlistresources handler set");return this._onlistresources(n.params,a)})}get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(t){this.warnIfRequestHandlerReplaced("onlistresourcetemplates",this._onlistresourcetemplates,t),this._onlistresourcetemplates=t,this.replaceRequestHandler(wq,async(n,a)=>{if(!this._onlistresourcetemplates)throw Error("No onlistresourcetemplates handler set");return this._onlistresourcetemplates(n.params,a)})}get onreadresource(){return this._onreadresource}set onreadresource(t){this.warnIfRequestHandlerReplaced("onreadresource",this._onreadresource,t),this._onreadresource=t,this.replaceRequestHandler(kq,async(n,a)=>{if(!this._onreadresource)throw Error("No onreadresource handler set");return this._onreadresource(n.params,a)})}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(Cq,async(n,a)=>{if(!this._onlistprompts)throw Error("No onlistprompts handler set");return this._onlistprompts(n.params,a)})}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 n=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:PSe.includes(n)?n:Dq,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(t){let n={},a=!1;for(let r of Object.keys(t)){let o=this._hostContext[r],s=t[r];NSe(o,s)||(n[r]=s,a=!0)}a&&(this._hostContext=t,this.sendHostContextChange(n))}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,n){return this.request({method:"ui/resource-teardown",params:t},SSe,n)}callTool(t,n){return this.request({method:"tools/call",params:t},T0,n)}listTools(t,n){return this.request({method:"tools/list",params:t},Aq,n)}async connect(t){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._initializedReceived=!1,this._client){let n=this._client.getServerCapabilities();if(!n)throw Error("Client server capabilities not available");n.tools&&(this.oncalltool=async(a,r)=>this._client.request({method:"tools/call",params:a},T0,{signal:r.signal}),n.tools.listChanged&&this._client.setNotificationHandler(Rq,a=>this.sendToolListChanged(a.params))),n.resources&&(this.onlistresources=async(a,r)=>this._client.request({method:"resources/list",params:a},yq,{signal:r.signal}),this.onlistresourcetemplates=async(a,r)=>this._client.request({method:"resources/templates/list",params:a},bq,{signal:r.signal}),this.onreadresource=async(a,r)=>this._client.request({method:"resources/read",params:a},xq,{signal:r.signal}),n.resources.listChanged&&this._client.setNotificationHandler(Sq,a=>this.sendResourceListChanged(a.params))),n.prompts&&(this.onlistprompts=async(a,r)=>this._client.request({method:"prompts/list",params:a},Tq,{signal:r.signal}),n.prompts.listChanged&&this._client.setNotificationHandler(Lq,a=>this.sendPromptListChanged(a.params)))}return super.connect(t)}};function NSe(e,t){return JSON.stringify(e)===JSON.stringify(t)}var Bq=(0,w.createContext)(void 0),OSe="_card_1vjff_1",DSe="_header_1vjff_9",$Se="_server_1vjff_20",BSe="_frame_1vjff_25",FSe="_fallback_1vjff_40",mp={card:OSe,header:DSe,server:$Se,frame:BSe,fallback:FSe};function yC(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function _0(e){if(!(!yC(e)||e.type!=="mcp_app")&&!(typeof e.serverName!="string"||typeof e.resourceUri!="string"||typeof e.html!="string"||typeof e.fallbackText!="string"||!yC(e.toolResult)||!yC(e.toolArguments)))return e}var zSe=8192;function zB(e){let t=e.split("."),n=t.length===4&&t[0]==="127"&&t.slice(1).every(a=>{if(!/^\d+$/.test(a))return!1;let r=Number(a);return r>=0&&r<=255});return e==="localhost"||e==="[::1]"||n}function qSe(e){if(e==="127.0.0.1"||e==="[::1]")return"localhost"}function USe(e,t){try{let n=new URL(t),a=new URL(e,n);if(!zB(n.hostname)||!zB(a.hostname))return;if(a.hostname==="[::1]"&&(a.hostname="localhost"),a.origin===n.origin){let r=qSe(a.hostname);r&&(a.hostname=r)}return a.pathname="/mcp-app-sandbox",a.search="",a.hash="",a.searchParams.set("hostOrigin",n.origin),a.toString()}catch{return}}function HSe(e,t){if(!t)return e;let n=new URL(e);return n.searchParams.set("csp",t),n.search.length<=zSe?n.toString():e}function qB(e){return{theme:e,platform:"web",displayMode:"inline",availableDisplayModes:["inline"],containerDimensions:{maxHeight:640}}}function jSe({display:e}){let t=(0,w.useContext)(Bq),n=E0(),a=(0,w.useRef)(null),r=(0,w.useRef)(null),o=(0,w.useRef)(0),s=(0,w.useRef)(e),i=(0,w.useRef)(n);s.current=e,i.current=n;let[l,c]=(0,w.useState)(260),[d,f]=(0,w.useState)(),p=e.csp?JSON.stringify(e.csp):"",m=JSON.stringify(e.toolArguments),h=JSON.stringify(e.toolResult),g=(0,w.useMemo)(()=>{if(!t||typeof window>"u")return;let b=USe(t,window.location.href);if(b)return HSe(b,p)},[t,p]);return(0,w.useEffect)(()=>{f(void 0);let b=a.current;if(!b||!g)return;let v=++o.current,y=!1,k=s.current,I=new p6(null,{name:"boos-code-web-shell",version:"0.0.1"},{sandbox:{...k.csp?{csp:k.csp}:{}}},{hostContext:qB(i.current)});return r.current=I,I.onsandboxready=()=>{let T=s.current;I.sendSandboxResourceReady({html:T.html,...T.csp?{csp:T.csp}:{}}).catch(L=>f(String(L)))},I.oninitialized=()=>{y=!0;let T=s.current;I.sendToolInput({arguments:T.toolArguments}).then(()=>I.sendToolResult(T.toolResult)).catch(L=>f(String(L)))},I.onsizechange=({height:T})=>{typeof T=="number"&&Number.isFinite(T)&&c(Math.min(640,Math.max(120,Math.ceil(T))))},I.connect(new f6(b.contentWindow??void 0,b.contentWindow)).then(()=>{b.src=g}).catch(T=>f(String(T))),()=>{r.current=null;let T=()=>{o.current===v&&b.removeAttribute("src"),I.close().catch(()=>{})};if(y){I.teardownResource({},{timeout:500}).catch(()=>{}).finally(T);return}T()}},[g,e.serverName,e.resourceUri,e.html,p,m,h]),(0,w.useEffect)(()=>{r.current?.setHostContext(qB(n))},[n]),!e.html||!g?(0,u.jsx)("div",{className:mp.fallback,children:e.fallbackText}):(0,u.jsxs)("div",{className:mp.card,"data-testid":"mcp-app",children:[(0,u.jsxs)("div",{className:mp.header,children:[(0,u.jsx)("span",{children:"MCP App"}),(0,u.jsx)("span",{className:mp.server,children:e.serverName})]}),d?(0,u.jsx)("div",{className:mp.fallback,children:e.fallbackText}):null,(0,u.jsx)("iframe",{ref:a,title:`${e.serverName} MCP App`,className:mp.frame,style:{height:l,display:d?"none":void 0},sandbox:"allow-scripts allow-forms",referrerPolicy:"origin",onError:()=>f("sandbox-load-failed")})]})}function WSe(e){let t=GSe(e.args,"file_path","filePath","path");if(t!==void 0&&t.length>0)return t;for(let n of e.content??[])if(n.path)return n.path;return e.locations?.[0]?.file}function GSe(e,...t){if(e)for(let n of t){let a=e[n];if(typeof a=="string")return a}}function VSe(e,t){if(!e||!t)return;let n=e.workspaces;if(n){let a=n.filter(o=>o.cwd===t),r=a[0];return a.length!==1||!r?.id||r.trusted!==!0||n.filter(o=>o.id===r.id).length!==1||r.primary!==(r.cwd===e.workspaceCwd)?void 0:XSe(r)}if(e.workspaceCwd===t)return{cwd:t,primary:!0}}function XSe(e){return{cwd:e.cwd,id:e.id,primary:e.primary}}function ZSe(e,t){return e?.cwd===t.cwd&&e.id===t.id&&e.primary===t.primary}function Fq(e){let t=nb(),n=Pme(),a=(0,w.useMemo)(()=>VSe(t.capabilities,e),[t.capabilities,e]),r=(0,w.useRef)(void 0);a?ZSe(r.current?.owner,a)||(r.current={owner:a}):r.current=void 0;let o=r.current,s=(0,w.useRef)(void 0);(0,w.useEffect)(()=>{if(!o){s.current=void 0;return}let l={};return s.current=l,()=>{queueMicrotask(()=>{s.current===l&&r.current===o&&(r.current=void 0)})}},[o]);let i=(0,w.useMemo)(()=>{if(!o)return;let l=o,c=()=>{let f=r.current;if(f!==l)throw new Error("Workspace artifact owner is no longer available");return f.owner},d=f=>{let p=c();if(p.id!==f)throw new Error("Scheduled task workspace owner no longer matches");return p};return{async readWorkspaceFile(f,p){let m=c(),h=await(m.primary?n.readWorkspaceFile(f,p):t.client.workspaceByCwd(m.cwd).readWorkspaceFile(f,p));return c(),h},async readFileBytes(f,p){let m=c(),h=await(m.primary?n.readFileBytes(f,p):t.client.workspaceByCwd(m.cwd).readWorkspaceFileBytes(f,p));return c(),h},async stat(f){let p=c(),m=await(p.primary?n.stat(f):t.client.workspaceByCwd(p.cwd).fileStat(f));return c(),m},async listScheduledTasks(f){d(f);let p=await n.listScheduledTasks(f);return d(f),p},async updateScheduledTask(f,p,m){d(m);let h=await n.updateScheduledTask(f,p,m);return d(m),h},async deleteScheduledTask(f,p){d(p),await n.deleteScheduledTask(f,p),d(p)}}},[o,n,t.client]);if(!(!o||!i))return{workspaceCwd:o.owner.cwd,...o.owner.id?{workspaceId:o.owner.id}:{},actions:i}}function KSe({tool:e,workspaceCwd:t,onOpen:n}){let a=_n(),r=WSe(e);return a!=="interactive"||!n||!t||!r?.trim()?null:(0,u.jsx)(YSe,{filePath:r,workspaceCwd:t,tool:e,onOpen:n},JSON.stringify([t,r,e.callId]))}function YSe({filePath:e,workspaceCwd:t,tool:n,onOpen:a}){let{t:r}=nt(),{status:o}=nb(),s=Fq(t)?.actions,[i,l]=(0,w.useState)(),c=(0,w.useRef)({sequence:0}).current,d=(0,w.useRef)({actions:s,status:o,onOpen:a});if(d.current={actions:s,status:o,onOpen:a},(0,w.useEffect)(()=>{if(l(void 0),!s||o!=="connected")return;let p=async()=>{let m=++c.sequence;try{let h=await s.stat(e);m===c.sequence&&l(h.type==="file"?s:void 0)}catch{m===c.sequence&&l(void 0)}};return p(),window.addEventListener("focus",p),()=>{c.sequence++,window.removeEventListener("focus",p)}},[s,e,c,o,n.status]),!s||o!=="connected"||i!==s)return null;let f=async()=>{let p=++c.sequence;try{let m=await s.stat(e);if(p!==c.sequence||d.current.actions!==s||d.current.status!=="connected"||d.current.onOpen!==a)return;if(m.type!=="file"){l(void 0);return}a({id:`file:${t}:${e}`,kind:"attachment",title:e.split(/[/\\]/).pop()||e,turnId:n.callId,workspacePath:e,workspaceCwd:t,silentUnavailable:!0})}catch{p===c.sequence&&l(void 0)}};return(0,u.jsxs)(Xn,{type:"button",variant:"ghost",size:"xs",className:"ml-auto text-muted-foreground",title:r("tool.viewCurrentFile"),onClick:()=>void f(),children:[r(SF(e)?"tool.viewImage":"tool.viewFile"),(0,u.jsx)(_i,{"aria-hidden":"true"})]})}function zq(e,t,n){if(e.current)return;let a={};e.current=a,t().then(r=>{e.current===a&&!r&&n()},()=>{e.current===a&&n()}).finally(()=>{e.current===a&&(e.current=null)})}function QSe(e){let t=e.toolName.toLowerCase();return ks(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||$6(t)||Wo(e.toolName)||D6(t)}function Lw(e){let t=e.toLowerCase();return t==="edit"||t==="editfile"||t==="write"||t==="write_file"||t==="writefile"}function JSe(e){let t=eCe(e);if(t)return t;if(e.content){let o=e.content.find(s=>s.type==="diff");if(o&&o.type==="diff")return gB(o.oldText||"",o.newText||"")}if(e.status==="failed"||e.wasCancelled)return"";let n=e.args?.patch;if(typeof n=="string"&&n)return n;let a=e.args?.newText,r=e.args?.oldText;return typeof a=="string"||typeof r=="string"?gB(typeof r=="string"?r:"",typeof a=="string"?a:""):""}function eCe(e){if(e.rawOutput&&typeof e.rawOutput=="object"){let t=e.rawOutput;if(tCe(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function tCe(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}var nCe=60,aCe=2e5,rCe=1e3,oCe={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 sCe({tool:e}){let t=(0,w.useMemo)(()=>Lp(e)||"",[e]),n=cCe(iCe(e)),a=n==="text"||t.length>aCe||lCe(t,rCe);return(0,u.jsx)("div",{className:he.expandedRead,children:a?(0,u.jsx)("pre",{className:he.expandedOutput,children:t}):(0,u.jsx)(rl,{content:uCe(n,t)})})}function iCe(e){let t=e.args?.file_path??e.args?.path;return typeof t=="string"?t:""}function lCe(e,t){let n=1;for(let a=0;a<e.length;a++)if(e.charCodeAt(a)===10&&++n>t)return!0;return!1}function cCe(e){let t=e.split(/[?#]/,1)[0]?.split(".").pop()?.toLowerCase();if(!t||t===e.toLowerCase()||t==="mermaid"||t==="mmd")return"text";let n=oCe[t]??t;return/^[\w+.#-]+$/.test(n)?n:"text"}function uCe(e,t){let n=t.match(/~{3,}/g)?.reduce((r,o)=>Math.max(r,o.length),0)??0,a="~".repeat(Math.max(3,n+1));return`${a}${e}
|
|
623
623
|
${t}
|
|
624
624
|
${a}`}function UB({tool:e}){let t=(0,w.useMemo)(()=>JSe(e),[e]),n=(0,w.useMemo)(()=>e.content&&Lp(e)||"",[e]);return!t&&!n?null:(0,u.jsx)("div",{className:he.expandedEdit,children:t?(0,u.jsx)(nke,{diff:t}):(0,u.jsx)("pre",{className:he.expandedOutput,children:n})})}function x0({title:e,action:t,detail:n,status:a,children:r}){return(0,u.jsxs)("div",{className:he.expandedCard,children:[(0,u.jsxs)("div",{className:he.expandedCardHeader,children:[(0,u.jsxs)("span",{className:he.expandedCardTitleRow,children:[a&&(0,u.jsx)(xp,{status:a}),(0,u.jsx)("span",{className:he.expandedCardTitle,children:e}),t]}),n&&(0,u.jsx)("span",{className:he.expandedCardDetail,children:n})]}),r&&(0,u.jsx)("div",{className:he.expandedCardBody,children:r})]})}function dCe({tool:e,todos:t,expanded:n,title:a}){let r=(0,w.useContext)(S6).get(e.callId)?.events??[];return n?(0,u.jsx)(x0,{title:a,status:e.status,children:(0,u.jsx)("div",{className:he.todoBody,children:(0,u.jsx)(Ez,{todos:t})})}):(0,u.jsx)("div",{className:he.todoBody,children:(0,u.jsx)(Az,{todos:t,events:r})})}function fCe({tool:e,displayName:t,detail:n,result:a}){let{t:r}=nt(),o=fke(),s=o?mke(o.tasks,e):void 0;return s?(0,u.jsx)(xz,{task:s}):(0,u.jsx)(x0,{title:t,detail:n,children:(0,u.jsx)("div",{className:he.workflowFallback,role:"status",children:e.status==="pending"||e.status==="in_progress"?r("workflow.inline.loading"):a||r("workflow.inline.unavailable")})})}function qq(e,t){let n=Ap(e.rawOutput),a=B6(e),r=S0(e),o=q6(e),s=pCe(e),i=Jw(e),l=e.subTools?.length||n?.toolCalls?.length||0,c=n?.executionSummary,d=c&&typeof c.totalDurationMs=="number"?Cz(c.totalDurationMs):Tp(e.startTime,e.endTime??(e.status==="in_progress"&&t?t:void 0)),f=n&&typeof n.tokenCount=="number"&&n.tokenCount>0?n.tokenCount:c&&typeof c.outputTokens=="number"&&c.outputTokens>0?c.outputTokens:0,p=f>0?z6(f):"";return{agentType:o,explicitAgentType:s,description:i,subToolCount:l,elapsed:d,tokens:p,status:r,reason:a}}function pCe(e){let t=Ap(e.rawOutput)?.subagentName;if(typeof t=="string"&&t.trim())return t.trim();let n=e.args?.subagent_type;return typeof n=="string"&&n.trim()?n.trim():""}function HB(e){if(e.status==="completed")return!1;let t=e.toolName.toLowerCase();return!!(Wo(e.toolName)||Lw(t)||ks(t))}function mCe({tool:e}){let t=Lp(e)||"";return(0,u.jsx)("pre",{className:he.expandedOutput,children:t})}function hCe({tool:e}){let t=gCe(e)||(typeof e.args?.args=="string"&&e.args.args.trim()?e.args.args.trim():e.title??"");return(0,u.jsx)("pre",{className:he.expandedOutput,children:t})}function gCe(e){let t=e.content?.[0];return t?.type!=="content"?"":typeof t.content?.text=="string"?t.content.text:""}function Xw(e){let t=e.toolName.toLowerCase();return kr(e)?"agent":Wo(e.toolName)?"ask":ks(t)?"shell":h6(t)?"fetch":od(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 vCe({description:e,elapsed:t}){return(0,u.jsxs)(u.Fragment,{children:[e&&(0,u.jsx)("span",{className:he.lineArg,children:e}),t&&(0,u.jsx)("span",{className:he.lineElapsed,children:t})]})}function y0({info:e}){let{renderToolHeaderExtra:t}=Go(),n=t?.(e);return n?(0,u.jsx)(u.Fragment,{children:n}):(0,u.jsx)(vCe,{description:e.description,elapsed:e.kind==="agent"||wa(e.tool.status)?e.elapsed:""})}function yCe(e){return e.length>nCe||e.includes(`
|
|
625
|
-
`)}function wCe(e){return e.find(t=>wa(t.status))??e[e.length-1]}function bCe(e,t,n,a=!1){if(T6(e)){let o=e.filter(i=>wa(i.status)&&!xs(i));if(o.length===0)return t("subagent.background");if(o.length===1&&Wo(o[0].toolName))return t("toolGroup.summary.provideInformation");let s=o.map(i=>Wo(i.toolName)?t("toolGroup.summary.provideInformation"):Uq(i,t,n));return t("toolGroup.running",{name:s.join(" \xB7 "),count:o.length})}return xCe(e,t,a)||t("toolGroup.summary",{count:e.length})}function Uq(e,t,n){if(od(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if(Wo(e.toolName))return wa(e.status)?t("toolGroup.summary.provideInformation"):t("toolGroup.summary.askedQuestions",{count:jq(e)});let{displayName:a,description:r,hideDisplayName:o}=Hq(e,t,n);return[o?"":a,r].filter(Boolean).join(" ")}function Hq(e,t,n){let a=Cc(e.toolName,t),r=ya(JF(e,n),120);return{kind:Xw(e),tool:e,displayName:a,description:r,elapsed:"",workspaceCwd:n,hideDisplayName:!!Hde(e)}}function kCe({tool:e,workspaceCwd:t}){let{t:n}=nt(),a=Wo(e.toolName),r=wa(e.status),o=xs(e),s=r&&!o&&kr(e),i=ab(s),l=!a&&r?o?n("subagent.background"):n("toolGroup.runningPrefix").trim():"";if(od(e.toolName)||a)return(0,u.jsxs)(u.Fragment,{children:[l&&(0,u.jsxs)("span",{children:[l," "]}),Uq(e,n,t)]});let c=Hq(e,n,t),d=s?az(e,n):"",f=s?{...c,description:[c.description,d&&`(${d})`].filter(Boolean).join(" "),elapsed:qq(e,i).elapsed}:c;return(0,u.jsxs)(u.Fragment,{children:[l&&(0,u.jsxs)("span",{children:[l," "]}),(0,u.jsxs)("span",{className:he.chatSummaryInline,children:[!f.hideDisplayName&&(0,u.jsx)("span",{className:he.lineName,children:f.displayName}),(0,u.jsx)(y0,{info:f})]})]})}function xCe(e,t,n){let a=n?e.filter(kr).length:0;if(a>0){let f=e.length-a;return[t("toolGroup.summary.ranAgents",{count:a}),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();ks(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++:od(p)?l++:Wo(p)?c+=jq(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 jq(e){let t=e.args?.questions;return Array.isArray(t)&&t.length>0?t.length:1}function SCe(){return(0,u.jsxs)("svg",{className:he.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 Wq(){return(0,u.jsxs)("svg",{className:he.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 CCe(){return(0,u.jsxs)("svg",{className:he.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 TCe(){return(0,u.jsxs)("svg",{className:he.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 ICe(){return(0,u.jsx)("svg",{className:he.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 _Ce(){return(0,u.jsx)("svg",{className:he.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 m6(){return(0,u.jsx)("svg",{className:he.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 Gq({tool:e}){let t=Xw(e);return t==="agent"?(0,u.jsx)(m6,{}):t==="ask"?(0,u.jsx)(_Ce,{}):t==="edit"||t==="write"?(0,u.jsx)(SCe,{}):t==="fetch"?(0,u.jsx)(CCe,{}):t==="read"?(0,u.jsx)(TCe,{}):t==="todo"?(0,u.jsx)(ICe,{}):(0,u.jsx)(Wq,{})}function h6(e){let t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}function LCe(e,t){if(e.approval?.id!==t.approval?.id||e.workspaceCwd!==t.workspaceCwd||e.onTurnOutputOpen!==t.onTurnOutputOpen||e.summaryOnly!==t.summaryOnly||e.forceExpanded!==t.forceExpanded||e.detailsVisible!==t.detailsVisible||e.hideHeader!==t.hideHeader||e.hideCollapsedOutput!==t.hideCollapsedOutput)return!1;let n=e.tool,a=t.tool;return n.callId===a.callId&&n.toolName===a.toolName&&n.status===a.status&&n.subagentSessionReady===a.subagentSessionReady&&n.startTime===a.startTime&&n.endTime===a.endTime&&n.subContent===a.subContent&&n.rawOutput===a.rawOutput&&n.args===a.args&&n.content===a.content&&n.locations===a.locations&&n.title===a.title&&ACe(n.subTools,a.subTools)}function ACe(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let a=e[n],r=t[n];if(a.callId!==r.callId||a.toolName!==r.toolName||a.status!==r.status||a.subagentSessionReady!==r.subagentSessionReady||a.endTime!==r.endTime||a.rawOutput!==r.rawOutput||a.args!==r.args||a.subContent!==r.subContent||a.title!==r.title)return!1}return!0}var jB=/\[([^\]]+)\]\(qwen-session:\/\/([^)]+)\)/g;function wC(e,t){if(!e||!e.includes("qwen-session://"))return e;let n=[],a=0,r;for(jB.lastIndex=0;(r=jB.exec(e))!==null;){r.index>a&&n.push(e.slice(a,r.index));let o=r[2];n.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)),a=r.index+r[0].length}return a<e.length&&n.push(e.slice(a)),n.length===1?n[0]:(0,u.jsx)(u.Fragment,{children:n})}var g6=(0,w.memo)(function({tool:e,approval:t,workspaceCwd:n,onTurnOutputOpen:a,summaryOnly:r=!1,forceExpanded:o=!1,detailsVisible:s=!0,hideHeader:i=!1,hideCollapsedOutput:l=!1}){let{t:c}=nt(),d=_n(),f=eb(),p=Lz(),{hostOwnsEditDiffPreview:m}=Go(),h=p!==void 0,g=_0(e.rawOutput),b=o||!!g,v=t?.toolCallId===e.callId,y=!!(m&&v&&t?.hasDiffPreview&&Lw(t?.toolName??e.toolName)),k=y,[I,T]=(0,w.useState)(!1),[L,S]=(0,w.useState)(()=>b||!r&&HB(e)&&!k),_=(0,w.useRef)(null),A=(0,w.useRef)(!1),E=D6(e.toolName);(0,w.useEffect)(()=>{S(b||!r&&HB(e)&&!k),T(!1),_.current=null,A.current=!1},[b,k,h,r,e.callId,e.toolName]);let P=kr(e),D=!v&&t?.toolCallId&&P&&Ss(e,t.toolCallId),B=!!(y||m&&D&&t?.hasDiffPreview&&Lw(t.toolName??"")),z=wa(e.status),Z=z&&!ks(e.toolName)&&!h6(e.toolName)&&!B,G=ab(Z);if((0,w.useEffect)(()=>{!b&&!P&&e.status==="completed"&&!A.current&&S(!1)},[b,P,e.status]),P){let ye=qq(e,G),We=ye.explicitAgentType?`${c("agent.label")} (${N0(ye.explicitAgentType,c)})`:c("agent.label"),Q=e.status==="completed"||e.status==="failed",me=xs(e),ve=[me&&!Q?c("subagent.background"):e.status==="pending"?c("subagent.pending"):c("subagent.running"),me&&!Q||B?"":ye.elapsed].filter(Boolean).join(" \xB7 "),Ge=[ye.subToolCount>0?c("subagent.toolsCount",{count:ye.subToolCount}):"",ye.elapsed,ye.tokens,ye.reason?ya(ye.reason,80):""].filter(Boolean).join(" \xB7 "),_e=o||L||!!D,He=!!v,ht=ti(e),Vt=(0,u.jsx)(W6,{tool:e,approval:m?t:void 0,hideHeader:!0,defaultExpanded:!0,inline:!0});if(f&&!i){let fn=(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(m6,{}),(0,u.jsx)(xp,{status:Q?ye.status:e.status}),(0,u.jsx)("span",{className:he.lineName,children:We}),(0,u.jsx)(y0,{info:{kind:"agent",tool:e,displayName:We,description:ye.description?ya(ye.description,60):"",elapsed:Q?Ge:ve,workspaceCwd:n}})]});return(0,u.jsx)("div",{className:he.line,"data-transcript-tool-call-id":e.callId,children:He?(0,u.jsx)("div",{className:`${he.lineMain} ${he.lineButton}`,"aria-disabled":"true",children:fn}):(0,u.jsxs)("button",{type:"button",className:`${he.lineMain} ${he.lineExpandable} ${he.lineButton}`,"aria-disabled":!!ht||void 0,title:ht?c(ht):void 0,onClick:()=>{ht||f.onOpen(e)},children:[fn,(0,u.jsx)("span",{className:he.lineChevronRight,"aria-hidden":"true"})]})})}return(0,u.jsxs)("div",{className:he.line,"data-transcript-tool-call-id":e.callId,children:[!i&&(0,u.jsxs)("div",{className:`${he.lineMain} ${He?"":he.lineExpandable}`,"aria-disabled":!!ht||void 0,title:ht?c(ht):void 0,onClick:He||ht?void 0:()=>S(!L),children:[(0,u.jsx)(m6,{}),(0,u.jsx)(xp,{status:Q?ye.status:e.status}),(0,u.jsx)("span",{className:he.lineName,children:We}),(0,u.jsx)(y0,{info:{kind:"agent",tool:e,displayName:We,description:ye.description?ya(ye.description,60):"",elapsed:Q?Ge:ve,workspaceCwd:n}}),!He&&(0,u.jsx)("span",{className:L?he.lineChevronDown:he.lineChevronRight,"aria-hidden":"true"})]}),_e&&(0,u.jsx)("div",{className:he.lineDetail,children:i?(0,u.jsx)("div",{className:he.expandedAgentCard,children:Vt}):Vt})]})}let te=Bw(e,n),j=jde(e),J=ks(e.toolName)?JF(e,n):te,R=Cc(e.toolName,c),W=B||ks(e.toolName)||h6(e.toolName)?"":Tp(e.startTime,z?G:e.endTime),V=e.toolName.toLowerCase(),N=V==="monitor"&&h&&!I&&!i,ne=od(V),fe=ne?uz(e):void 0,le=!!fe&&fe.length>0,X=fe?fe.filter(ye=>ye.status==="completed").length:0,se=ks(V),ce=V==="grep"||V==="grep_search"||V==="search"||V==="glob",ae=V==="read"||V==="read_file"||V==="readfile",pe=s&&(ae||Lw(V)||V==="display_image"||V==="zoom_image")?(0,u.jsx)(KSe,{tool:e,workspaceCwd:n,onOpen:a}):void 0,Ee=!ne&&yCe(J),Me=!b&&!k,U=N||Me,ie=()=>{A.current=!0,S(ye=>!ye)},Ze=()=>{T(!0),Me&&ie()},$e=()=>{p&&zq(_,()=>p.onOpen(e),Ze)},at=QSe(e),rt=L&&Ee,yt=ae,en=rt&&!se&&!ce&&!ae,K=te,Ce=L&&!at&&(!ne||!le&&!j);return(0,u.jsxs)("div",{className:he.line,"data-transcript-tool-call-id":e.callId,children:[i&&z&&W&&(0,u.jsx)("div",{className:he.lineMain,children:(0,u.jsx)(y0,{info:{kind:Xw(e),tool:e,displayName:R,description:"",elapsed:W,workspaceCwd:n}})}),!i&&(0,u.jsxs)("div",{className:`${he.lineMain} ${U?he.lineExpandable:""}`,title:N?void 0:Me?c(L?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":N?void 0:Me?L:void 0,role:U?"button":void 0,tabIndex:U?0:void 0,onClick:U?()=>{if(N){$e();return}ie()}:void 0,onKeyDown:U?ye=>{if(!(ye.key!=="Enter"&&ye.key!==" ")){if(ye.preventDefault(),N){$e();return}ie()}}:void 0,children:[(0,u.jsx)(Gq,{tool:e}),(0,u.jsx)(xp,{status:e.status}),(0,u.jsx)("span",{className:he.lineName,children:R}),ne&&le&&(0,u.jsxs)("span",{className:he.todoProgress,children:[X,"/",fe.length]}),(0,u.jsx)(y0,{info:{kind:Xw(e),tool:e,displayName:R,description:ne||en?"":J,elapsed:ne?"":W,workspaceCwd:n}}),U&&(0,u.jsx)("span",{className:!N&&L?he.lineChevronDown:he.lineChevronRight,"aria-hidden":"true"})]}),g&&(!r||L)&&(0,u.jsx)(jSe,{display:g}),!g&&(!r||L)&&ne&&le&&(0,u.jsx)(dCe,{tool:e,todos:fe,expanded:L,title:R}),!g&&(!r||L)&&ne&&!le&&j&&(0,u.jsx)("div",{className:he.lineOutput,children:wC(j,d)}),!g&&Ce&&(0,u.jsx)(x0,{title:R,detail:K,status:e.status,action:pe,children:j&&(0,u.jsx)("div",{className:`${he.lineOutput} ${he.expandedLineOutput}`,children:wC(j,d)})}),!g&&!ne&&!l&&j&&!Ce&&(!L||!at)&&(!r||L)&&(0,u.jsx)("div",{className:L?`${he.lineOutput} ${he.expandedLineOutput}`:he.lineOutput,children:wC(j,d)}),!g&&!ne&&L&&at&&(!E||s)&&(0,u.jsx)("div",{className:E?`${he.lineDetail} ${he.workflowLineDetail}`:yt?`${he.lineDetail} ${he.markdownLineDetail}`:he.lineDetail,children:E?(0,u.jsx)(fCe,{tool:e,displayName:R,detail:K,result:j}):se?(0,u.jsx)(cke,{tool:e}):ae?(0,u.jsx)(x0,{title:R,status:e.status,action:pe,children:(0,u.jsx)(sCe,{tool:e})}):(0,u.jsxs)(x0,{title:R,detail:K,status:e.status,action:pe,children:[(V==="write_file"||V==="writefile")&&(0,u.jsx)(UB,{tool:e}),(V==="edit"||V==="write"||V==="editfile")&&(0,u.jsx)(UB,{tool:e}),Wo(e.toolName)&&(0,u.jsx)(mCe,{tool:e}),$6(V)&&(0,u.jsx)(hCe,{tool:e})]})})]})},LCe),ECe=(0,w.memo)(function({isStreaming:e,expanded:t,documentMode:n,translateContent:a,generateContent:r,onToggle:o}){let{language:s,t:i}=nt();return(0,u.jsxs)("div",{className:`${he.chatSummaryThoughtHeader}${t?` ${he.chatSummaryThoughtHeaderExpanded}`:""}`,onClick:l=>{!n&&l.currentTarget.contains(l.target)&&o()},children:[(0,u.jsxs)("button",{type:"button",disabled:n,tabIndex:n?-1:void 0,className:he.chatSummaryThoughtSummary,"data-testid":"compact-thinking-summary","aria-expanded":n?void 0:t,title:n?void 0:i(t?"thinking.collapse":"thinking.expand"),children:[(0,u.jsx)("span",{className:he.chatSummaryThoughtIcon,"aria-hidden":"true",children:(0,u.jsx)(U6,{})}),(0,u.jsx)("span",{className:`${he.chatSummaryThoughtLabel}${e?` ${he.chatSummaryThoughtLabelActive}`:""}`,children:i(e?"thinking.running":"thinking.done")})]}),s==="zh-CN"&&a!==void 0&&r&&(0,u.jsx)(rz,{content:a,generateContent:r,className:he.chatSummaryThoughtTranslate}),(0,u.jsx)("span",{className:t?he.chatSummaryThoughtChevronDown:he.chatSummaryThoughtChevronRight,"aria-hidden":"true"})]})}),bC=(0,w.memo)(function({content:e,isStreaming:t,generateContent:n}){let a=_n()==="document",r=Zw(),[o,s]=(0,w.useState)(!1),i=a?r:o,l=(0,w.useCallback)(()=>{a||s(c=>!c)},[a]);return(0,u.jsxs)("div",{className:he.chatSummaryThought,children:[(0,u.jsx)(ECe,{isStreaming:t,expanded:i,documentMode:a,translateContent:a||t?void 0:e,generateContent:n,onToggle:l}),i&&(0,u.jsx)("div",{className:he.chatSummaryThoughtContent,children:(0,u.jsx)(rl,{content:e,source:"thinking",isStreaming:t})})]})}),RCe=(0,w.memo)(function({tools:e,compactSummary:t=!1,thoughts:n,pendingApproval:a,workspaceCwd:r,onTurnOutputOpen:o,isLocateFlashing:s=!1,generateContent:i}){let{t:l}=nt(),c=_n()==="document",d=Zw(),f=eb(),p=Lz(),m=p!==void 0,[h,g]=(0,w.useState)(!1),[b,v]=(0,w.useState)(!1),y=c?d:b,k=(0,w.useRef)(null),I=T6(e),T=e.find(le=>wa(le.status)&&!xs(le))??(e.length>0?wCe(e):void 0),L=e.length===1?e[0]:void 0,S=!!n?.length,_=L&&kr(L)?L:void 0,A=L&&L.toolName.toLowerCase()==="monitor"?L:void 0,E=(L?_0(L.rawOutput):void 0)?.resourceUri,P=e.some(le=>_0(le.rawOutput)),D=e.some(le=>D6(le.toolName)),B=e.some(le=>wa(le.status)&&!xs(le)),z=n?.find(le=>le.isStreaming),Z=I&&B?!0:z!==void 0,G=!Z&&e.some(le=>wa(le.status)&&xs(le)),te=!!(!t&&_&&f),j=!!(!t&&A&&m&&!h),J=te||j,R=!t&&_?ti(_):void 0,W=I?T??e[0]:e[0],V=a?.toolCallId&&e.some(le=>Ss(le,a.toolCallId)),N=new Map,ne=new Set;for(let le=0;t&&le<e.length;le++){if(!kr(e[le]))continue;let X=le+1;for(;X<e.length&&kr(e[X]);)X++;if(X-le>=2){let se=e.slice(le,X);N.set(se[0].callId,se);for(let ce of se.slice(1))ne.add(ce.callId)}le=X-1}(0,w.useEffect)(()=>{g(!1),v(!1),k.current=null},[m,A?.callId]),(0,w.useEffect)(()=>{(E||P)&&v(!0)},[E,P]);let fe=()=>{!A||!p||zq(k,()=>p.onOpen(A),()=>{g(!0),v(le=>!le)})};return V?(0,u.jsx)("div",{className:`${he.group}${s?` ${ol.flash}`:""}`,children:e.map(le=>(0,u.jsx)(g6,{tool:le,approval:a,workspaceCwd:r,onTurnOutputOpen:o,forceExpanded:c},le.callId))}):(0,u.jsxs)("div",{className:s?ol.flash:void 0,children:[(0,u.jsxs)("button",{type:"button",disabled:c,"aria-disabled":!!R||void 0,tabIndex:c?-1:void 0,className:he.chatSummary,onClick:()=>{if(!(c||R)){if(te&&_&&f){f.onOpen(_);return}if(j&&A&&p){fe();return}v(le=>!le)}},"aria-expanded":c||J?void 0:b,title:R?l(R):c||J?void 0:l(y?"tool.collapseHint":"tool.expand"),children:[(0,u.jsx)("span",{className:G?`${he.chatSummaryIcon} ${he.chatSummaryIconDetached}`:he.chatSummaryIcon,"aria-hidden":"true",children:z?(0,u.jsx)(U6,{}):W?(0,u.jsx)(Gq,{tool:W}):(0,u.jsx)(Wq,{})}),(0,u.jsx)("span",{className:Z?`${he.chatSummaryText} ${he.chatSummaryTextActive}`:he.chatSummaryText,children:z?l("thinking.running"):L?(0,u.jsx)(kCe,{tool:L,workspaceCwd:r}):bCe(e,l,r,t)}),(0,u.jsx)("span",{className:y?he.chatChevronDown:he.chatChevronRight,"aria-hidden":"true"})]}),(y||P||D)&&(0,u.jsx)("div",{"aria-hidden":!y,ref:le=>{le?.toggleAttribute("inert",!y)},className:y?he.chatSummaryContentClip:`${he.chatSummaryContentClip} ${he.chatSummaryContentCollapsed}`,style:!y&&P&&!D?{display:"none"}:void 0,children:(0,u.jsx)("div",{className:he.chatSummaryContentInner,children:(0,u.jsxs)("div",{className:`${he.group} ${he.chatSummaryGroup}`,children:[e.map(le=>{if(ne.has(le.callId))return null;let X=N.get(le.callId);return(0,u.jsxs)(w.Fragment,{children:[n?.filter(se=>se.beforeToolCallId===le.callId).map((se,ce)=>(0,u.jsx)(bC,{content:se.content,isStreaming:se.isStreaming,generateContent:i},`thought-${le.callId}-${ce}`)),X?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{className:he.chatSummaryParallelAgents,"data-testid":"compact-parallel-agents",children:(0,u.jsx)(Iz,{agents:X,pendingApproval:a})}),X.slice(1).flatMap(se=>n?.filter(ce=>ce.beforeToolCallId===se.callId).map((ce,ae)=>(0,u.jsx)(bC,{content:ce.content,isStreaming:ce.isStreaming,generateContent:i},`thought-${se.callId}-${ae}`)))]}):(0,u.jsx)(g6,{tool:le,approval:a,workspaceCwd:r,onTurnOutputOpen:o,summaryOnly:!L||S,forceExpanded:c||!!L&&!S,detailsVisible:y,hideHeader:!!L&&!S})]},le.callId)}),n?.filter(le=>le.beforeToolCallId===void 0).map((le,X)=>(0,u.jsx)(bC,{content:le.content,isStreaming:le.isStreaming,generateContent:i},`thought-trailing-${X}`))]})})})]})}),w9="summary-",Vq=e=>`${w9}${e}`,Xq=e=>e.startsWith(w9),Zq=e=>Xq(e)?e.slice(w9.length):void 0,MCe="_message_1ujhf_1",PCe="_header_1ujhf_6",NCe="_headerStatic_1ujhf_7",OCe="_chevron_1ujhf_24",DCe="_title_1ujhf_30",$Ce="_progress_1ujhf_39",vc={message:MCe,header:PCe,headerStatic:NCe,chevron:OCe,title:DCe,progress:$Ce};function BCe({id:e,todos:t}){let n=(0,w.useContext)(S6).get(e)?.events??[];return(0,u.jsx)(Az,{todos:t,events:n})}var FCe=(0,w.memo)(function({id:e,todos:t,isLocateFlashing:n=!1}){let{t:a}=nt(),r=_n()==="document",o=Zw(),[s,i]=(0,w.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:`${vc.message}${n?` ${ol.flash}`:""}`,children:[r?(0,u.jsxs)("div",{className:vc.headerStatic,children:[(0,u.jsx)("span",{className:vc.title,children:a("plan.title")}),(0,u.jsxs)("span",{className:vc.progress,children:[d,"/",c]})]}):(0,u.jsxs)("button",{type:"button",className:vc.header,onClick:()=>i(f=>!f),"aria-expanded":s,title:a(s?"todo.collapse":"todo.expand"),children:[(0,u.jsx)("span",{className:vc.chevron,"aria-hidden":"true",children:s?"\u25BE":"\u25B8"}),(0,u.jsx)("span",{className:vc.title,children:a("plan.title")}),(0,u.jsxs)("span",{className:vc.progress,children:[d,"/",c]})]}),l?(0,u.jsx)(Ez,{todos:t,numbered:!0}):(0,u.jsx)(BCe,{id:e,todos:t})]})}),zCe="_message_1abcu_1",qCe="_content_1abcu_11",UCe="_question_1abcu_17",HCe="_prefix_1abcu_24",jCe="_answer_1abcu_28",WCe="_pending_1abcu_32",GCe="_shortcuts_1abcu_36",Vu={message:zCe,content:qCe,question:UCe,prefix:HCe,answer:jCe,pending:WCe,shortcuts:GCe},VCe=(0,w.memo)(function({question:e,answer:t,isPending:n}){let{t:a}=nt();return(0,u.jsxs)("div",{className:Vu.message,children:[(0,u.jsxs)("div",{className:Vu.content,children:[(0,u.jsxs)("div",{className:Vu.question,children:[(0,u.jsx)("span",{className:Vu.prefix,children:"/btw "}),(0,u.jsx)("span",{children:e})]}),(0,u.jsx)("div",{className:Vu.answer,children:n?(0,u.jsx)("span",{className:Vu.pending,children:a("btw.answering")}):(0,u.jsx)(rl,{content:t})})]}),(0,u.jsx)("div",{className:Vu.shortcuts,children:a(n?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),XCe="_message_1g0wi_1",ZCe="_header_1g0wi_21",KCe="_status_1g0wi_30",YCe="_name_1g0wi_35",QCe="_command_1g0wi_42",JCe="_output_1g0wi_51",hp={message:XCe,header:ZCe,status:KCe,name:YCe,command:QCe,output:JCe},e6e=(0,w.memo)(function({command:e,output:t}){let{t:n}=nt();return(0,u.jsxs)("div",{className:hp.message,children:[(0,u.jsxs)("div",{className:hp.header,children:[(0,u.jsx)("span",{className:hp.status,children:"\u2713"}),(0,u.jsx)("span",{className:hp.name,children:n("shell.command")}),e&&(0,u.jsx)("span",{className:hp.command,children:e})]}),t&&(0,u.jsx)("pre",{className:hp.output,children:t})]})}),t6e="_progress_1ik59_1",n6e="_spinner_1ik59_12",a6e="_bar_1ik59_19",r6e="_stage_1ik59_25",o6e="_icon_1ik59_29",s6e="_done_1ik59_35",i6e="_error_1ik59_43",l6e="_detail_1ik59_51",c6e="_path_1ik59_56",u6e="_pathButton_1ik59_61",Aa={progress:t6e,spinner:n6e,bar:a6e,stage:r6e,icon:o6e,done:s6e,error:i6e,detail:l6e,path:c6e,pathButton:u6e},WB=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827"];function d6e({progress:e}){let{stage:t,progress:n,detail:a,isComplete:r,error:o}=e,[s,i]=(0,w.useState)(0),l=30,c=Math.round(n/100*l),d=l-c,f="\u2588".repeat(Math.max(0,c))+"\u2591".repeat(Math.max(0,d));return(0,w.useEffect)(()=>{if(r||o)return;let p=setInterval(()=>{i(m=>(m+1)%WB.length)},120);return()=>clearInterval(p)},[r,o]),o?(0,u.jsxs)("div",{className:`${Aa.progress} ${Aa.error}`,children:[(0,u.jsx)("span",{className:Aa.icon,children:"\u2715"}),(0,u.jsx)("span",{className:Aa.stage,children:t}),(0,u.jsx)("div",{className:Aa.detail,children:o})]}):r?(0,u.jsxs)("div",{className:`${Aa.progress} ${Aa.done}`,children:[(0,u.jsx)("span",{className:Aa.icon,children:"\u2713"}),(0,u.jsx)("span",{className:Aa.stage,children:t})]}):(0,u.jsxs)("div",{className:Aa.progress,children:[(0,u.jsx)("span",{className:Aa.spinner,children:WB[s]}),(0,u.jsx)("span",{className:Aa.bar,children:f}),(0,u.jsxs)("span",{className:Aa.stage,children:[t,a?` (${a})`:""]})]})}function f6e({path:e,onInsightReportOpen:t}){let{t:n}=nt();return(0,u.jsxs)("div",{className:`${Aa.progress} ${Aa.done}`,children:[(0,u.jsx)("span",{className:Aa.icon,children:"\u2713"}),(0,u.jsx)("span",{className:Aa.stage,children:n("insight.ready")}),t?(0,u.jsx)("button",{type:"button",className:`${Aa.path} ${Aa.pathButton}`,onClick:()=>t(e),children:e}):(0,u.jsx)("span",{className:Aa.path,children:e})]})}var p6e=(0,w.memo)(function({message:e,pendingApproval:t,onShowContextDetail:n,onLocateBackgroundSource:a,onImagePreview:r,onAttachmentPreview:o,onTurnOutputOpen:s,onInsightReportOpen:i,workspaceCwd:l,showRetryHint:c=!1,onRetryClick:d,sendFailed:f=!1,onRetrySend:p,onEditUserMessage:m,onSubmitUserMessageEdit:h,onBranchSession:g,branchRecordId:b,showAssistantActions:v=!1,showAssistantBranch:y=!1,assistantFeedbackTurnId:k,assistantFeedbackPromptId:I,assistantFeedbackRating:T,onAssistantFeedbackRate:L,isLocateFlashing:S=!1,assistantTurnFooterInfo:_,turnSources:A,onSourceOpen:E,generateContent:P}){let{t:D}=nt(),[B,z]=(0,w.useState)(!1),[Z,G]=(0,w.useState)(!1),te=(0,w.useCallback)(()=>{m?.()!==!0&&z(!0)},[m]),j=(0,w.useCallback)(()=>{z(!1)},[]),J=(0,w.useCallback)(ce=>{h&&(G(!0),Promise.resolve(h(ce)).catch(()=>!1).then(ae=>{G(!1),ae!==!1&&z(!1)}))},[h]),R=(0,w.useMemo)(()=>g&&b?()=>g(b):void 0,[g,b]),W=(0,w.useMemo)(()=>L&&I?ce=>L(I,k??"",ce):void 0,[L,I,k]),V=(0,w.useContext)(x6),N=e.role==="tool_group"&&e.tools.length===1&&O6(e.tools[0])?e.tools[0]:void 0,ne=N?Ude(N):null,fe=!!ne||e.role==="user"||e.role==="system"&&e.source==="mid_turn_message_injected",le=(()=>{switch(e.role){case"user":return(0,u.jsx)(KF,{content:e.content,images:e.images,files:e.files,inputAnnotations:e.inputAnnotations,isLocateFlashing:S,sendFailed:f,onRetrySend:p,editing:B,submittingEdit:Z,onEditSubmit:J,onEditCancel:j,onImagePreview:r,onAttachmentPreview:o});case"assistant":return(0,u.jsx)(Nfe,{content:e.content,isStreaming:e.isStreaming,timestamp:e.timestamp,onBranchSession:R,showFooterActions:v,showBranchAction:y,showAssistantFeedback:I!==void 0,assistantFeedbackRating:T,onAssistantFeedbackRate:W,isLocateFlashing:S,customFooterInfo:_,turnSources:A,onSourceOpen:E});case"thinking":return(0,u.jsx)(zfe,{content:e.content,isStreaming:e.isStreaming,timestamp:e.timestamp,isLocateFlashing:S,generateContent:P});case"tool_group":return N&&!ne&&!Lp(N)?.trim()?null:ne&&N?!ne.answers.length&&!ne.text.trim()?null:(0,u.jsx)(Fde,{tool:N,result:ne,isLocateFlashing:S}):(0,u.jsx)(RCe,{tools:e.tools,onTurnOutputOpen:s,thoughts:e.thoughts,compactSummary:V&&Xq(e.id),pendingApproval:t,workspaceCwd:l,isLocateFlashing:S,generateContent:P});case"plan":return(0,u.jsx)(FCe,{id:e.id,todos:e.todos,isLocateFlashing:S});case"system":return(0,u.jsx)(Mye,{content:e.content,variant:e.variant,source:e.source,data:e.data,images:e.images,files:e.files,onShowContextDetail:n,onLocateBackgroundSource:a,onImagePreview:r,onAttachmentPreview:o,showRetryHint:c&&e.retryable===!0,onRetryClick:d});case"user_shell":return(0,u.jsx)(e6e,{command:e.command,output:e.output});case"btw":return(0,u.jsx)(VCe,{question:e.question,answer:e.answer,isPending:e.isPending});case"insight_progress":return(0,u.jsx)(d6e,{progress:{stage:e.stage,progress:e.progress,detail:e.detail}});case"insight_ready":return(0,u.jsx)(f6e,{path:e.path,onInsightReportOpen:i});case"insight_error":return(0,u.jsx)("div",{style:{color:"var(--error-color, #e06c75)"},children:e.error});default:return null}})();if(le===null)return null;let X=(0,u.jsx)(ed,{label:`message:${e.role}`,resetKeys:[e],fallback:(0,u.jsx)(m6e,{align:fe?"end":"start"}),children:le}),se=(0,u.jsx)("div",{"data-user-selectable":"true",style:{display:"contents"},children:X});return e.role==="assistant"?v?se:(0,u.jsx)(RC,{timestamp:e.timestamp,children:se}):e.role==="system"&&e.source==="prompt_cancelled"?se:(0,u.jsx)(RC,{timestamp:e.timestamp,hideTimestamp:e.role==="system"&&(e.source==="background_task_completed"||e.source==="background_notification_turn_started"),chatMode:fe,toolGroupSpacing:e.role==="tool_group"&&V,copyText:fe&&"content"in e?e.content:void 0,copyTitle:D("common.copy"),onEdit:m&&!B?te:void 0,editTitle:D("userMessage.edit"),children:se})},h6e);function m6e({align:e}){let{t}=nt();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 h6e(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.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||!g6e(e.assistantTurnFooterInfo,t.assistantTurnFooterInfo)?!1:v6e(e.message,t.message)}function g6e(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 v6e(e,t){if(e===t)return!0;if(e.id!==t.id||e.role!==t.role||e.timestamp!==t.timestamp)return!1;switch(e.role){case"user":return t.role==="user"&&e.content===t.content&&VB(e.images,t.images);case"assistant":return t.role==="assistant"&&e.content===t.content&&e.isStreaming===t.isStreaming;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&&VB(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"&&y6e(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&w6e(e.thoughts,t.thoughts)&&e.tools.length===t.tools.length&&e.tools.every((n,a)=>Kq(n,t.tools[a]));default:return!1}}function y6e(e,t){return e.length===t.length&&e.every((n,a)=>{let r=t[a];return r&&n.id===r.id&&n.content===r.content&&n.status===r.status&&n.priority===r.priority})}function Kq(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&&yc(e.args)===yc(t.args)&&yc(e.rawOutput)===yc(t.rawOutput)&&yc(e.locations)===yc(t.locations)&&yc(e.content)===yc(t.content)&&b6e(e.subTools,t.subTools):!1}function w6e(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,a)=>n.content===t[a]?.content&&n.isStreaming===t[a]?.isStreaming&&n.beforeToolCallId===t[a]?.beforeToolCallId)}function b6e(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((n,a)=>Kq(n,t[a]))}var GB=new WeakMap;function VB(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,a)=>n.data===t[a].data&&n.mimeType===t[a].mimeType)}function yc(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=GB.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return GB.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}function XB({additions:e,deletions:t,className:n,additionsClassName:a,deletionsClassName:r}){return e===void 0||t===void 0?null:(0,u.jsxs)("span",{className:n,children:[(0,u.jsxs)("span",{className:a,children:["+",e]}),(0,u.jsxs)("span",{className:r,children:["-",t]})]})}function k6e(e){if(!e.some(t=>t.additions===void 0||t.deletions===void 0))return e.reduce((t,n)=>({additions:t.additions+(n.additions??0),deletions:t.deletions+(n.deletions??0)}),{additions:0,deletions:0})}var x6e="_root_n9pre_1",S6e="_card_n9pre_7",C6e="_summary_n9pre_14",T6e="_icon_n9pre_22",I6e="_iconSvg_n9pre_33",_6e="_title_n9pre_39",L6e="_reviewSummary_n9pre_46",A6e="_reviewSummaryWithStats_n9pre_53",E6e="_reviewMeta_n9pre_58",R6e="_linkButton_n9pre_65",M6e="_reviewButton_n9pre_66",P6e="_showMoreButton_n9pre_67",N6e="_actions_n9pre_96",O6e="_openButtonWrapper_n9pre_102",D6e="_list_n9pre_126",$6e="_fileRow_n9pre_133",B6e="_path_n9pre_153",F6e="_lineStats_n9pre_162",z6e="_additions_n9pre_171",q6e="_deletions_n9pre_175",U6e="_chevronIcon_n9pre_189",H6e="_chevronIconOpen_n9pre_197",j6e="_artifactInfo_n9pre_201",W6e="_artifactMeta_n9pre_206",Ct={root:x6e,card:S6e,summary:C6e,icon:T6e,iconSvg:I6e,title:_6e,reviewSummary:L6e,reviewSummaryWithStats:A6e,reviewMeta:E6e,linkButton:R6e,reviewButton:M6e,showMoreButton:P6e,actions:N6e,openButtonWrapper:O6e,list:D6e,fileRow:$6e,path:B6e,lineStats:F6e,additions:z6e,deletions:q6e,chevronIcon:U6e,chevronIconOpen:H6e,artifactInfo:j6e,artifactMeta:W6e},v6=3;function ZB(e,t){return t?e:e.slice(0,v6)}function G6e({turnId:e,changes:t,artifacts:n,scheduledTasks:a,workspaceCwd:r,onOpenRequest:o,onReviewChanges:s,onOpenArtifact:i,onOpenScheduledTask:l,onError:c}){let{t:d}=nt(),f=Fq(r),p=f?.actions,[m,h]=(0,w.useState)(!1),[g,b]=(0,w.useState)(!1);if(t.length===0&&n.length===0&&a.length===0)return null;let v=ZB(t,m),y=t.length-v6,k=ZB(n,g),I=n.length-v6,T=k6e(t),L=A=>{if(o){o({id:"review",kind:"review",title:d("turnOutputs.review"),turnId:e,changes:t,...r?{workspaceCwd:r}:{},...f?.workspaceId?{workspaceId:f.workspaceId}:{},...A?{selectedPath:A}:{}});return}s(t,A)},S=A=>{let E=Y6e(A,t,r);if(o){o({id:`artifact:${A.id}`,kind:"artifact",title:A.title??"Artifact",turnId:e,artifactId:A.id,...A.managedId?{managedId:A.managedId}:{},artifact:A,...r?{workspaceCwd:r}:{},...f?.workspaceId?{workspaceId:f.workspaceId}:{},...E!==void 0?{previewContent:E}:{}});return}i(A.id,E)},_=A=>{if(o){o({id:`scheduled-task:${A.toolCallId}`,kind:"scheduled_task",title:d("scheduledTasks.title"),turnId:e,task:f?.workspaceId?{...A,workspaceId:f.workspaceId}:A,...r?{workspaceCwd:r}:{},...f?.workspaceId?{workspaceId:f.workspaceId}:{}});return}l(A)};return(0,u.jsxs)("div",{className:Ct.root,children:[t.length>0&&(0,u.jsxs)("div",{className:Ct.card,children:[(0,u.jsxs)("div",{className:Ct.summary,children:[(0,u.jsx)("span",{className:Ct.icon,"aria-hidden":"true",children:(0,u.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",focusable:"false",className:Ct.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:[Ct.reviewSummary,T?Ct.reviewSummaryWithStats:""].filter(Boolean).join(" "),children:[(0,u.jsx)("div",{className:Ct.title,children:d("turnOutputs.filesEdited",{count:t.length})}),(0,u.jsxs)("div",{className:Ct.reviewMeta,children:[(0,u.jsx)(XB,{additions:T?.additions,deletions:T?.deletions,className:Ct.lineStats,additionsClassName:Ct.additions,deletionsClassName:Ct.deletions}),(0,u.jsxs)("button",{type:"button",className:Ct.linkButton,onClick:()=>L(),children:[d("turnOutputs.viewChanges")," \u2197"]})]})]}),(0,u.jsx)("div",{className:Ct.actions,children:(0,u.jsx)("button",{type:"button",className:Ct.reviewButton,onClick:()=>L(),children:d("turnOutputs.review")})})]}),(0,u.jsxs)("div",{className:Ct.list,children:[v.map(A=>(0,u.jsxs)("button",{type:"button",className:Ct.fileRow,onClick:()=>L(A.path),title:A.path,children:[(0,u.jsx)("span",{className:Ct.path,children:r9e(A.path,r)}),(0,u.jsx)(XB,{additions:A.additions,deletions:A.deletions,className:Ct.lineStats,additionsClassName:Ct.additions,deletionsClassName:Ct.deletions})]},`${A.toolCallId}:${A.path}`)),y>0&&(0,u.jsxs)("button",{type:"button",className:Ct.showMoreButton,onClick:()=>h(A=>!A),children:[(0,u.jsx)("span",{children:m?d("turnOutputs.collapseFiles"):d("turnOutputs.showMoreFiles",{count:y})}),(0,u.jsx)(KB,{open:m})]})]})]}),k.map(A=>{let E=n9e(A);return(0,u.jsx)(V6e,{artifact:A,externalUrl:E,onOpen:E||!Yq(A)?void 0:()=>S(A),onError:c,onDownload:t9e(A)&&p?P=>Wse(p,A.workspacePath,A.mimeType,P):void 0},A.id)}),I>0&&(0,u.jsxs)("button",{type:"button",className:Ct.showMoreButton,onClick:()=>b(A=>!A),children:[(0,u.jsx)("span",{children:g?d("turnOutputs.collapseArtifacts"):d("turnOutputs.showMoreArtifacts",{count:I})}),(0,u.jsx)(KB,{open:g})]}),a.map(A=>(0,u.jsx)(X6e,{task:A,scheduleLabel:IF(A.cron,d),onOpen:()=>_(A)},A.toolCallId))]})}function V6e({artifact:e,externalUrl:t,onOpen:n,onDownload:a,onError:r}){let{t:o}=nt(),s=Kw(),[i,l]=(0,w.useState)(!1),c=(0,w.useRef)(!0);(0,w.useEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]);let d=zse(e.sizeBytes),f=a9e(e,o),p=e.workspacePath&&Ew(e.workspacePath).split("/").at(-1)||e.title,m=async()=>{if(!(!a||i)){l(!0);try{await a(()=>!c.current)}catch(g){if(!c.current)return;let b=o("common.downloadFailed",{message:Mw(g)});r?r(new Error(b,{cause:g}),b):console.error(b,g)}finally{l(!1)}}},h=(0,u.jsx)(_i,{size:16,strokeWidth:1.8,"aria-hidden":"true"});return(0,u.jsx)("div",{className:Ct.card,children:(0,u.jsxs)("div",{className:Ct.summary,children:[(0,u.jsx)("span",{className:Ct.icon,"aria-hidden":"true",children:(0,u.jsx)(Zse,{artifact:e,className:Ct.iconSvg})}),(0,u.jsxs)("div",{className:Ct.artifactInfo,children:[(0,u.jsx)("div",{className:Ct.title,children:e.title}),(0,u.jsx)("div",{className:Ct.artifactMeta,children:[e.metadata?.artifactType==="web_preview_snapshot"?o("webPreview.saved"):Fse(e),d].filter(Boolean).join(" \xB7 ")})]}),(0,u.jsxs)("div",{className:Ct.actions,children:[a&&(0,u.jsxs)("button",{type:"button",className:Ct.reviewButton,onClick:()=>void m(),title:`${o("common.download")} ${p}`,disabled:i,children:[(0,u.jsx)(oh,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),o(i?"common.downloading":"common.download")]}),(0,u.jsx)("span",{className:Ct.openButtonWrapper,title:f??e.title,children:t?(0,u.jsxs)("a",{className:Ct.reviewButton,href:t,target:"_blank",rel:"noopener noreferrer",onClick:g=>s(g,t),children:[h,o("common.open")]}):(0,u.jsxs)("button",{type:"button",className:Ct.reviewButton,onClick:n,disabled:!n,children:[h,o("common.open")]})})]})]})})}function X6e({task:e,scheduleLabel:t,onOpen:n}){let{t:a}=nt();return(0,u.jsx)("div",{className:Ct.card,children:(0,u.jsxs)("div",{className:Ct.summary,children:[(0,u.jsx)("span",{className:Ct.icon,"aria-hidden":"true",children:(0,u.jsx)(Z6e,{})}),(0,u.jsxs)("div",{className:Ct.artifactInfo,children:[(0,u.jsx)("div",{className:Ct.title,children:e.title}),(0,u.jsx)("div",{className:Ct.artifactMeta,children:[t,e.recurring?a("scheduledTasks.repeats"):a("scheduledTasks.runsOnce")].filter(Boolean).join(" \xB7 ")})]}),(0,u.jsx)("div",{className:Ct.actions,children:(0,u.jsx)("button",{type:"button",className:Ct.reviewButton,onClick:n,title:e.title,children:a("common.open")})})]})})}function Z6e(){return(0,u.jsxs)("svg",{className:Ct.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 KB({open:e}){return(0,u.jsx)("svg",{className:[Ct.chevronIcon,e?Ct.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 K6e=(0,w.memo)(G6e);function Y6e(e,t,n){if(!J6e(e)||!e.workspacePath)return;let a=t.find(r=>Gse(r.path,e.workspacePath,n));if(a)return Q6e(a)}function Q6e(e){for(let t=e.diffs.length-1;t>=0;t--){let n=e.diffs[t];if(n?.fullContent)return n.newText}}function J6e(e){let t=e.workspacePath?.toLowerCase()??"",n=e.mimeType?.toLowerCase()??"";return e.kind==="html"||e9e(t)||n==="text/html"||n==="text/markdown"}function e9e(e){let t=e.toLowerCase();return t.endsWith(".html")||t.endsWith(".htm")||t.endsWith(".md")||t.endsWith(".markdown")||SF(t)!==void 0}function t9e(e){return e.storage==="workspace"&&e.status==="available"&&!!e.workspacePath}function Yq(e){return e.storage!=="workspace"?!0:e.status==="available"||e.status==="changed"}function n9e(e){if(e.kind!=="link"||e.storage==="published")return;let t=e.url?.trim();return R6(t)?t:void 0}function a9e(e,t){if(!Yq(e))return e.workspacePath?t("turnOutputs.artifactUnavailable",{path:e.workspacePath}):t("turnOutputs.artifactMissing")}function r9e(e,t){return MC(e,t)}function o9e(e,t){let[n,a]=(0,w.useState)(!1);return(0,w.useLayoutEffect)(()=>{let r=e.current;if(!r||!t){a(!1);return}let o=r.closest("[data-history-viewport]")??r,s=()=>{let d=Number.parseFloat(getComputedStyle(r).getPropertyValue("--chat-regular-content-width"))||1e3;a(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]),n}var s9e="_collapseRow_d7f01_1",i9e="_collapseRowClickable_d7f01_14",l9e="_collapseLabel_d7f01_19",c9e="_processedLabel_d7f01_36",u9e="_processedMeta_d7f01_43",d9e="_hiddenMetrics_d7f01_47",f9e="_summaryMetrics_d7f01_51",p9e="_collapseIcon_d7f01_59",m9e="_chevronRight_d7f01_72",h9e="_chevronDown_d7f01_73",bs={collapseRow:s9e,collapseRowClickable:i9e,collapseLabel:l9e,processedLabel:c9e,processedMeta:u9e,hiddenMetrics:d9e,summaryMetrics:f9e,collapseIcon:p9e,chevronRight:m9e,chevronDown:h9e},g9e="_list_nvt92_1",v9e="_listWithWelcomeHeader_nvt92_12",y9e="_historyStatus_nvt92_32",w9e="_historyRetryButton_nvt92_38",b9e="_virtualSizer_nvt92_64",k9e="_virtualRow_nvt92_73",x9e="_loadingSkeleton_nvt92_83",S9e="_srOnly_nvt92_91",C9e="_loadingSkeletonUserRow_nvt92_103",T9e="_loadingSkeletonAssistantRow_nvt92_109",I9e="_loadingSkeletonUserBubble_nvt92_115",_9e="_loadingSkeletonUserBubbleCompact_nvt92_116",L9e="_loadingSkeletonAssistantBlock_nvt92_130",A9e="_loadingSkeletonLineWide_nvt92_138",E9e="_loadingSkeletonLineMedium_nvt92_139",R9e="_loadingSkeletonLineShort_nvt92_140",M9e="_loadingSkeletonLineNarrow_nvt92_141",P9e="_turnStatusRow_nvt92_181",N9e="_turnAnswerRow_nvt92_182",O9e="_turnContentRow_nvt92_193",D9e="_sessionTimelineLayer_nvt92_197",$9e="_sessionTimelinePanel_nvt92_210",B9e="_sessionTimelineViewport_nvt92_226",F9e="_sessionTimelineList_nvt92_275",z9e="_sessionTimelineItem_nvt92_285",q9e="_sessionTimelineButton_nvt92_290",U9e="_sessionTimelineTick_nvt92_310",H9e="_sessionTimelineButtonInRange_nvt92_400",j9e="_sessionTimelineButtonCurrent_nvt92_404",W9e="_sessionTimelineDetails_nvt92_415",G9e="_sessionTimelineDetailsTitle_nvt92_453",V9e="_sessionTimelineDetailsIcon_nvt92_460",X9e="_sessionTimelineDetailsTitleText_nvt92_472",Z9e="_sessionTimelineDetailsDetail_nvt92_482",Mt={list:g9e,listWithWelcomeHeader:v9e,historyStatus:y9e,historyRetryButton:w9e,virtualSizer:b9e,virtualRow:k9e,loadingSkeleton:x9e,srOnly:S9e,loadingSkeletonUserRow:C9e,loadingSkeletonAssistantRow:T9e,loadingSkeletonUserBubble:I9e,loadingSkeletonUserBubbleCompact:_9e,loadingSkeletonAssistantBlock:L9e,loadingSkeletonLineWide:A9e,loadingSkeletonLineMedium:E9e,loadingSkeletonLineShort:R9e,loadingSkeletonLineNarrow:M9e,turnStatusRow:P9e,turnAnswerRow:N9e,turnContentRow:O9e,sessionTimelineLayer:D9e,sessionTimelinePanel:$9e,sessionTimelineViewport:B9e,sessionTimelineList:F9e,sessionTimelineItem:z9e,sessionTimelineButton:q9e,sessionTimelineTick:U9e,sessionTimelineButtonInRange:H9e,sessionTimelineButtonCurrent:j9e,sessionTimelineDetails:W9e,sessionTimelineDetailsTitle:G9e,sessionTimelineDetailsIcon:V9e,sessionTimelineDetailsTitleText:X9e,sessionTimelineDetailsDetail:Z9e},kC=()=>{},K9e=15e3,xC=180,Y9e=400,YB=5e3;function Q9e(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 n=e[e.length-1],a=t[t.length-1];return n.id!==a.id||n.role!==a.role||a.role!=="assistant"&&a.role!=="thinking"||n.role!=="assistant"&&n.role!=="thinking"||n.isStreaming!==!0||a.isStreaming!==!0?!1:n.role==="assistant"&&a.role==="assistant"?typeof n.content!="string"||typeof a.content!="string"?!1:n.branchRecordId===a.branchRecordId&&n.usage===a.usage&&!!n.content.trim()==!!a.content.trim():n.role==="thinking"&&a.role==="thinking"}function QB(e,t){return e.length===t.length&&e.every((n,a)=>Object.is(n,t[a]))}function J9e(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.role==="user")return n.id}return null}function e7e(e){return e[e.length-1]}function t7e(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&Qr(n))return n.id}return null}function n7e(e,t){return e.role!=="tool_group"?!1:!!(t?.toolCallId&&e.tools.some(n=>Ss(n,t.toolCallId)))}function y6(e){return O6(e)||!!_0(e.rawOutput)}function JB(e){let t=[],n=!1;for(let a of e){if(a.role!=="tool_group"||a.tools.length<2||!a.tools.some(y6)){t.push(a);continue}n=!0;let r=[],o=0,s=i=>{i.length!==0&&t.push({...a,id:o++===0?a.id:`${a.id}-${i[0].callId}`,tools:i})};for(let i of a.tools)y6(i)?(s(r),r=[],s([i])):r.push(i);s(r)}return n?t:e}function a7e(e,t){let n=[],a=0,r=o=>o.role==="tool_group"&&!n7e(o,t)&&!o.tools.some(y6);for(;a<e.length;){let o=e[a];if(o.role!=="thinking"&&!r(o)){n.push(o),a++;continue}let s=[],i=a-1,l=a;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(EC)){for(let p of s)n.push(p);a=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 h of f)h.beforeToolCallId=m;f.length=0}n.push({id:Vq(s[0].id),role:"tool_group",tools:c,...d.length>0?{thoughts:d}:{},timestamp:s[0].timestamp}),a=i+1}return n}function r7e(e,t){let n=e[e.length-1];if(n?.role!=="tool_group"||Zq(n.id)===void 0||!n.thoughts?.length)return;let a=n.thoughts[n.thoughts.length-1];if(a?.isStreaming!==!0)return;let r=n.thoughts.slice();r[r.length-1]={...a,content:t.content,isStreaming:!0};let o=e.slice();return o[o.length-1]={...n,thoughts:r,...n.id===Vq(t.id)?{timestamp:t.timestamp}:{}},o}function Qq(e){return Yoe(B7e(e))}function kw(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 o7e(e,t,n,a,r){if((!n||n.size===0)&&(!a||a.size===0)&&(!r||r.size===0))return e;let o=[],s=null,i=(l,c)=>{if(c&&t||!l)return;let d=n?.get(l)??[],f=a?.get(l)??[],p=r?.get(l)??[];if(d.length===0&&f.length===0&&p.length===0)return;let m=o.length;for(let h=o.length-1;h>=0;h-=1){let g=o[h];if(g.type!=="message"||g.message.role!=="system")break;g.message.source==="recap"&&(m=h)}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"&&Qr(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 s7e(e,t){let n=s=>s.type==="parallel_agents"&&(t?.has(s.key)===!0||s.agents.some(i=>wa(i.status)));if(!e.some(s=>n(s)))return e;let a=[],r=[],o=()=>{a.push(...r),r=[]};for(let s of e)s.type==="message"&&Qr(s.message)?(o(),a.push(s)):n(s)?r.push(s):a.push(s);return o(),a}function Jq(e,t){return e.type==="message"&&(e.message.role==="assistant"||t&&e.message.role==="system"&&e.message.source==="background_notification")&&!!e.message.content&&e.message.content.trim().length>0}function ub(e,t,n,a=!0){let r=!1;for(let o=n;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(x7e(s))r=!0;else if(!r&&Jq(s,a))return o}return-1}function i7e(e,{isResponding:t,latestTurnAwaitsAgentSummary:n,gateBackgroundAgentStatus:a}){let r=[];for(let s=0;s<e.length;s++){let i=e[s];i.type==="message"&&Qr(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||a&&n)||a&&aU(e,i,l))continue;let c=e[i],d=ub(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 eF(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(O6);case"plan":return!0;case"assistant":return!t;case"thinking":return!0;case"system":return e.message.source==="background_notification"?!t: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 eU(e){return e.source==="mid_turn_message_injected"}function l7e(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:n}=e;switch(n.role){case"thinking":return{kind:"thought",timestamp:n.timestamp,label:t?t("timeline.thinking"):"Thinking"};case"assistant":return e.turnCollapse?{kind:"none",timestamp:n.timestamp}:rd(n.content,1)?{kind:"commentary",timestamp:n.timestamp,label:t?t("timeline.assistantUpdate"):"Assistant update"}:{kind:"none",timestamp:n.timestamp};case"tool_group":{let a=n.tools.length;return{kind:"tool",timestamp:n.timestamp,label:t?t("timeline.toolCalls",{count:a}):`${a} tool call${a===1?"":"s"}`}}case"plan":return{kind:"plan",timestamp:n.timestamp,label:t?t("timeline.planUpdate"):"Plan update"};case"system":return eU(n)?{kind:"status",timestamp:n.timestamp,label:t?t("timeline.statusUpdate"):"Status update"}:{kind:"none",timestamp:n.timestamp};case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return{kind:"none",timestamp:n.timestamp};default:return{kind:"none"}}}function rd(e,t,n={}){let a=(n.stripMarkdown===!0?c7e(e):e??"").replace(/\s+/g," ").trim();if(t<=0||!a)return"";let r=Array.from(a);return r.length>t?`${r.slice(0,t-1).join("")}\u2026`:a}function c7e(e){if(!e)return"";let t=[],n=r=>{let o=`\0${t.length}\0`;return t.push(r),o},a=e.replace(/```[^\n`]*\n?([\s\S]*?)```/g,(r,o)=>n(o)).replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`\n]+)`/g,(r,o)=>n(o)).replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"");a=SC(a,"~~"),a=SC(a,"**"),a=SC(a,"__"),a=a.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())a=a.split(`\0${r}\0`).join(o);return a}function SC(e,t){let n="",a=0;for(;a<e.length;){let r=e.indexOf(t,a);if(r===-1)return n+e.slice(a);let o=r+t.length,s=e.indexOf(t,o);if(s===-1)return n+e.slice(a);let i=e.slice(o,s);n+=i.trim().length===0?e.slice(a,s+t.length):e.slice(a,r)+i,a=s+t.length}return n}function u7e(e,t){let n=e.role==="user"?e.content:e.role==="user_shell"?e.command:"";return rd(n,32)||(t?t("timeline.userTurn"):"User turn")}function d7e(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function Qr(e){return e.role==="user"||e.role==="user_shell"}function f7e(e,t){if(!t.startsWith("msg:"))return;let n=t.slice(4);n=Zq(n)??n;for(let a=e.length-1;a>=0;a--)if(e[a]?.id===n){for(let r=a;r>=0;r--){let o=e[r];if(o&&Qr(o))return o.id}return}}function p7e(e,t){for(let n of e)if(n.type==="turn_collapse"&&n.turnCollapse.turnId===t)return n.turnCollapse.collapsed;return!1}function m7e(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return rd(e.content,120,{stripMarkdown:!0});case"tool_group":{let n=e.tools.length;return t?t("timeline.toolCalls",{count:n}):`${n} tool call${n===1?"":"s"}`}case"plan":return t?t("timeline.planDetail"):"plan update";case"system":return eU(e)?rd(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 h7e(e,t){if(e.type==="parallel_agents"){let n=e.agents.length;return t?t("timeline.parallelAgentsDetail",{count:n}):`${n} parallel agent${n===1?"":"s"}`}return e.type==="turn_outputs"||e.type!=="message"?"":m7e(e.message,t)}function g7e(e,t){return t?t(`timeline.kind.${e}`):Q7e[e]}function v7e(e,t,n,a){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=rd(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=h7e(i,a);l&&r.push(l)}return rd(r.join(" \xB7 "),180)||(n.length>0?n.map(s=>g7e(s,a)).join(" \xB7 "):a?a("timeline.noActivity"):"No activity")}function y7e(e,t){let n=[],a=null,r=[],o=()=>{if(!a)return;let s=Qq(r),i=ub(s,-1,s.length-1,!1),l=i>=0?s[i]:null,c=l?.type==="message"&&l.message.role==="assistant"&&!l.message.isStreaming&&rd(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=l7e(f,t);p.kind!=="none"&&!d.includes(p.kind)&&d.push(p.kind)}n.push({id:a.id,label:u7e(a,t),detail:v7e(s,c,d,t),timestamp:a.timestamp,nodeKinds:d,...d7e(a)?{isScheduledTask:!0}:{}})};for(let s of e){if(Qr(s)){o(),a=s,r=[];continue}a&&r.push(s)}return o(),n}function w7e(){return(0,u.jsxs)("svg",{className:Mt.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 b7e(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 k7e(e){return e.map(t=>{let n=`${t.id}:${t.role}:${t.timestamp??""}`;switch(t.role){case"assistant":case"thinking":return`${n}:${t.isStreaming?"streaming":t.content}`;case"tool_group":return`${n}:${t.tools.map(b7e).join(",")}`;case"system":return`${n}:${t.variant}:${t.source??""}:${t.content}`;case"user":return`${n}:${t.content}`;case"user_shell":return`${n}:${t.command}`;case"plan":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return n;default:return n}}).join("|")}function x7e(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 S7e(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 n=e.agents.filter(a=>wa(a.status));return n.length===0?null:`agents:${e.key}:${n.map(a=>a.callId).join(",")}`}if(e.message.role!=="tool_group")return null;let t=e.message.tools.filter(n=>wa(n.status));return t.length===0?null:`tools:${e.message.id}:${t.map(n=>n.callId).join(",")}`}function C7e(e){for(let t=e.length-1;t>=0;t--){let n=S7e(e[t]);if(n)return n}return null}function T7e(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 I7e(e){return e.type==="message"&&e.message.role==="system"&&e.message.source==="turn_error"}function _7e(e){if(!(e.type!=="message"||e.message.role!=="assistant"))return e.message.content?.trim()?e.message.timestamp:void 0}function L7e(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function CC(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function tF(e){if(e.parentToolCallId||!kr(e))return;let t=e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0,n=t?.executionSummary&&typeof t.executionSummary=="object"?t.executionSummary:void 0,a=CC(n?.inputTokens),r=CC(n?.outputTokens);if(a===void 0&&r===void 0)return;let o=CC(n?.cachedTokens);return{callId:e.callId,usage:{inputTokens:a??0,outputTokens:r??0,...o!==void 0?{cachedTokens:o}:{}}}}function A7e(e){return e.type==="parallel_agents"?e.agents.flatMap(t=>tF(t)??[]):e.type!=="message"||e.message.role!=="tool_group"?[]:e.message.tools.flatMap(t=>tF(t)??[])}function E7e(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=>!Wo(t.toolName)).length:0}function tU(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--){let a=e[n];if(a.type==="message"&&Qr(a.message))return a.message.id}return null}function nU(e){let t=[],n=null;for(let a of e)a.type==="message"&&Qr(a.message)&&(n=a.message.id),t.push(n);return t}function nF(e,t,n,a){let r=a===void 0?tU(e,t):a[t]??null;return r?n.get(r)??null:null}function R7e(e,t,n,a,r=nU(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,n,r);c!==null&&(o=Math.min(o,c),s=Math.max(s,c))}if(s<0)return null;let i=a==null?null:nF(e,a,n,r);return{startIndex:o,endIndex:s,currentIndex:i!==null&&i>=o&&i<=s?i:s}}function W0(e,t,n,a){for(let r=t;r<=n;r++){let o=e[r];if(o.type==="parallel_agents"){if(o.agents.some(a))return!0}else if(o.type==="message"&&o.message.role==="tool_group"&&o.message.tools.some(a))return!0}return!1}function M7e(e,t,n,a){return a?W0(e,t,n,r=>Ss(r,a)):!1}function P7e(e,t,n){return W0(e,t,n,a=>kr(a)&&wa(a.status))}function N7e(e,t,n){return W0(e,t,n,a=>_0(a.rawOutput)!==void 0)}function O7e(e,t){let n=new Set(t);for(let a of e){if(a.type!=="message"||a.message.role!=="system"||a.message.source!=="background_notification"&&a.message.source!=="background_task_completed"&&a.message.source!=="background_notification_turn_started")continue;let r=a.message.data;if(a.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"&&n.add(o)}return n}function D7e(e,t,n,a){return W0(e,t,n,r=>{let o=Koe(r);return o!==void 0&&!a.has(o)})}function aU(e,t,n){return W0(e,t,n,a=>xs(a)&&wa(a.status))}function $7e(e,t,n,a){if(!a?.size)return!1;for(let r=t;r<=n;r++){let o=e[r];if(o.type==="parallel_agents"&&a.has(o.key))return!0}return!1}function TC(e){return e.type==="parallel_agents"?e.agents.filter(t=>xs(t)&&t.status!=="failed").map(t=>t.callId):e.type==="message"&&e.message.role==="tool_group"?e.message.tools.filter(t=>xs(t)&&t.status!=="failed").map(t=>t.callId):[]}function rU(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,n=e.data;if(e.source==="background_notification_turn_started"&&n&&typeof n=="object"&&"backgroundTask"in n&&(n=n.backgroundTask??n),typeof n!="object"||n===null||Array.isArray(n))return t?{status:"completed",...e.timestamp!==void 0?{endTime:e.timestamp}:{}}:null;let{kind:a,toolUseId:r,status:o}=n;if(a!=="agent"&&!(a===void 0&&t))return null;let s=o===void 0?"completed":fF(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"?rU(e.message):null}function B7e(e){let t=new Map;for(let r of e){let o=rU(r);o?.callId&&t.set(o.callId,o)}if(t.size===0)return e;let n=!1,a=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||!xs(i)||!wa(i.status))return i;let c=pF(i,l.status,l.endTime);return c===i?i:(o=!0,c)});return o?(n=!0,{...r,tools:s}):r});return n?a:e}function oU(e,t,n,a){let r=-1,o;for(let c=n;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(a&&!f)continue;r<0&&(r=c,o=f?.callId)}}}if(r<0)return null;let s=-1;if(o){for(let c=n;c>=0;c--)if(TC(e[c]).includes(o)){s=c;break}}for(let c=n;c>=t&&!(s>=0);c--)if(TC(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"&&Qr(p.message)){c=f;break}}let d=[];for(let f=c;f<=n;f++){let p=e[f];for(let h of TC(p))i.add(h);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 b6(e,t,n,a=!1,r=!0,o=!0){let s=oU(e,t,n,a);if(!s)return!1;if(s.sawAgentCompletion&&s.unmatchedAgentCallIds.size>0)return r;for(let i=s.lastNotificationIndex+1;i<=n;i++){let l=e[i];if(l.type==="message"&&l.message.role==="thinking")return!1}return o&&ub(e,t,n,!1)<s.lastNotificationIndex}function F7e(e,{overrides:t,isResponding:n,activeTurnStartedAt:a,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"&&Qr(v.message)&&m.push(b)}if(m.length===0)return e;let h=O7e(e,i),g=[];for(let b=0;b<m[0];b++)g.push(e[b]);for(let b=0;b<m.length;b++){let v=m[b],y=(b+1<m.length?m[b+1]:e.length)-1,k=e[v],I=k.message.id,T=k.message.timestamp,L=b===m.length-1,S=L&&n,_=P7e(e,v,y),A=N7e(e,v,y),E=D7e(e,v,y,h),P=$7e(e,v,y,l),D=L&&r&&b6(e,v,y,!1,o,s),B=M7e(e,v,y,c),z=ub(e,v,y),Z=z;if(z>=0&&Jq(e[z],!1)){let U=!1;for(let ie=z-1;ie>v;ie--){let Ze=e[ie];if(Ze.type!=="message")break;if(Ze.message.role==="system"&&Ze.message.source==="background_task_completed")U=!0;else if(U&&Ze.message.role==="assistant")Z=ie,U=!1;else break}}let G=0,te,j,J,R=0,W=0,V=0,N=0,ne=0,fe=!1,le=new Set,X=!1;for(let U=v+1;U<=y;U++){let ie=e[U];if(eF(ie,U>=Z&&U<=z)&&G++,I7e(ie)&&(X=!0),N+=E7e(ie),ie.type==="message"&&ie.message.role==="thinking"?ne++:ie.type==="message"&&ie.message.role==="tool_group"&&ie.message.thoughts&&(ne+=ie.message.thoughts.length),ie.type==="message"&&ie.message.role==="system"&&ie.message.source==="prompt_cancelled"){let rt=ie.message.data,yt=rt&&typeof rt=="object"&&"elapsedMs"in rt?rt.elapsedMs:void 0;typeof yt=="number"&&Number.isFinite(yt)&&yt>=0&&(j=yt)}let Ze=T7e(ie);Ze!==void 0&&(te=te===void 0?Ze:Math.max(te,Ze));let $e=_7e(ie);$e!==void 0&&(J=J===void 0?$e:Math.max(J,$e));let at=L7e(ie);if(at&&(R+=at.inputTokens,W+=at.outputTokens,V+=at.cachedTokens??0,fe=!0),d)for(let rt of A7e(ie))le.has(rt.callId)||(le.add(rt.callId),R+=rt.usage.inputTokens,W+=rt.usage.outputTokens,V+=rt.usage.cachedTokens??0,fe=!0)}let se=S||D?a??T??Date.now():void 0,ce=te??J,ae=j??(T!==void 0&&ce!==void 0&&ce>=T?ce-T:void 0);if(B||G===0&&!(fe||ae!==void 0||se!==void 0)){for(let U=v;U<=y;U++)g.push(e[U]);continue}let pe=S||_||A||E||P||D||(X||z<0)&&L,Ee=!(G===0||(t.has(I)?t.get(I):f?.has(I)||pe));g.push({type:"message",key:k.key,message:k.message});let Me={turnId:I,collapsed:Ee,hiddenCount:G,...ae!==void 0?{elapsedMs:ae}:{},...fe?{inputTokens:R,outputTokens:W}:{},...V>0?{cachedTokens:V}:{},...N>0?{toolCallCount:N}:{},...ne>0?{thinkingCount:ne}:{},...se!==void 0?{liveStartedAt:se}:{}};if(g.push({type:"turn_collapse",key:`tc-${I}`,turnCollapse:Me}),!Ee){for(let U=v+1;U<=y;U++){let ie=e[U];U===z&&ie.type==="message"&&ie.message.role==="assistant"?g.push({...ie,turnCollapse:Me}):g.push(ie)}continue}for(let U=v+1;U<=y;U++){let ie=e[U];if(!(U===z&&S)){if(U===z&&ie.type==="message"&&ie.message.role==="assistant"){g.push({...ie,turnCollapse:Me});continue}eF(ie,U>=Z&&U<=z)||g.push(ie)}}}return g}function xw(e,t,n){if(n){for(let a=0;a<e.length;a++){let r=e[a];if(r.type==="message"&&r.message.role==="tool_group"&&r.message.tools.some(o=>Ss(o,n))||r.type==="parallel_agents"&&r.agents.some(o=>Ss(o,n)))return a}return-1}for(let a=0;a<e.length;a++){let r=e[a];if(r.type==="message"&&r.message.id===t)return a}return-1}function aF(e,t){if(!t)return!1;let n=t.callId;return e.type==="message"?n?e.message.role==="tool_group"&&e.message.tools.some(a=>Ss(a,n)):e.message.id===t.messageId:e.type==="parallel_agents"?!!n&&e.agents.some(a=>Ss(a,n)):(e.type,!1)}function rF(e,t){return e?e.type==="message"?e.message.sourceBlockIds?.join(","):t.filter(n=>e.type==="parallel_agents"?n.role==="tool_group"&&e.agents.some(a=>n.tools.some(r=>Ss(r,a.callId))):n.id===(e.type==="turn_outputs"?e.turnId:e.turnCollapse.turnId)).flatMap(n=>n.sourceBlockIds??[]).join(",")||void 0:void 0}var IC=0,z7e=120,q7e=80,U7e=32,H7e=240,Sw=30,_C=160,oF=30,sU=200;function j7e(e,t=sU){return e>t}function W7e(e,t){return e<=t}function G7e(e){let t=Math.max(0,Math.ceil(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60),a=t-n*60;return`${n}m ${a}s`}function V7e(e){return e!==void 0&&e>=0?G7e(e):""}function X7e(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";let n=e.cachedTokens??0,a=n>0&&e.inputTokens>0?` (${Ea(n)} ${t("turn.cached")}, ${Math.round(n/e.inputTokens*100)}%)`:"";return`\u2191${Ea(e.inputTokens)}${a} \u2193${Ea(e.outputTokens)}`}function sF(e,t){let n=[],a=X7e(e,t);return a&&n.push(a),e.toolCallCount!==void 0&&e.toolCallCount>0&&n.push(t("turn.toolCalls",{count:e.toolCallCount})),e.thinkingCount!==void 0&&e.thinkingCount>0&&n.push(t("turn.thinkingCount",{count:e.thinkingCount})),n.join(" \xB7 ")}function Z7e(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}var K7e=(0,w.memo)(function({turnCollapse:e,onToggleCollapse:t}){let{t:n}=nt(),a=e.hiddenCount>0,r=e.liveStartedAt,o=a||r!==void 0||Z7e(e),s=ab(r!==void 0&&o),i=(0,w.useRef)(0),l=(0,w.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=V7e(c),f=sF(e,n),p=sF(e,n),m=n(r!==void 0?"turn.processing":"turn.processed"),h=!!d&&o,g=!!f&&o,b=!!p&&o;if(!o)return null;let v=()=>{if(!a)return;let y=e.collapsed;t(e.turnId,y)};return(0,u.jsxs)("div",{className:a?`${bs.collapseRow} ${bs.collapseRowClickable}`:bs.collapseRow,role:a?"button":void 0,tabIndex:a?0:void 0,"aria-expanded":a?!e.collapsed:void 0,"aria-label":a?e.collapsed?n("turn.expand"):n("turn.collapse"):void 0,title:a?e.collapsed?n("turn.expand"):n("turn.collapse"):void 0,onClick:a?v:void 0,onKeyDown:a?y=>{y.key!=="Enter"&&y.key!==" "||(y.preventDefault(),v())}:void 0,children:[(0,u.jsxs)("span",{className:bs.collapseLabel,children:[(0,u.jsxs)("span",{className:bs.processedLabel,children:[m,h&&(0,u.jsxs)("span",{className:bs.processedMeta,children:[" ",d]})]}),b&&(0,u.jsx)("span",{className:bs.summaryMetrics,children:p}),g&&(0,u.jsx)("span",{className:bs.hiddenMetrics,children:f})]}),a&&(0,u.jsx)("span",{"data-testid":`toggle-${e.turnId}`,className:bs.collapseIcon,onClick:y=>{y.stopPropagation(),v()},children:(0,u.jsx)("span",{className:e.collapsed?bs.chevronRight:bs.chevronDown,"aria-hidden":"true"})})]})});function Y7e(e){if(e.type==="turn_collapse")return Mt.turnStatusRow;if(e.type==="turn_outputs")return Mt.turnContentRow;if(e.type==="message"&&e.turnCollapse)return Mt.turnAnswerRow}var Q7e={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},J7e=["--background","--foreground","--muted-foreground","--border","--font-sans"],iF="session-timeline-detail-tooltip",e8e=(0,w.memo)(function({entries:e,currentTurnId:t,currentRange:n,hidden:a,onSelect:r}){let o=A0(),{t:s}=nt(),i=(0,w.useRef)(null),l=(0,w.useRef)(null),c=(0,w.useRef)(null),d=(0,w.useRef)(!1),f=(0,w.useRef)(!1),p=(0,w.useRef)(null),m=(0,w.useRef)(null),[h,g]=(0,w.useState)(null),b=n!==null?n.currentIndex:e.findIndex(A=>A.id===t),v=(0,w.useCallback)(()=>g(null),[]),y=(0,w.useCallback)(()=>{d.current||f.current||v()},[v]),k=(0,w.useCallback)((A,E)=>{let P=i.current;if(!P)return null;let D=getComputedStyle(P),B=E.getBoundingClientRect();return{entry:A,top:B.top+B.height/2,left:B.right+8,clamped:!1,themeVars:Object.fromEntries(J7e.map(z=>[z,D.getPropertyValue(z)]))}},[]),I=(0,w.useCallback)(A=>{let E=l.current;return E?Array.from(E.querySelectorAll('[data-testid="session-timeline-entry"]')).find(P=>P.getAttribute("data-turn-id")===A.id)?.querySelector("button")??null:null},[]),T=(0,w.useCallback)(A=>{let E=l.current;if(!E)return!1;let P=E.getBoundingClientRect(),D=A.getBoundingClientRect();return D.bottom>=P.top&&D.top<=P.bottom},[]),L=(0,w.useCallback)(()=>{g(A=>{if(!A)return null;let E=I(A.entry);return!E||!T(E)?null:k(A.entry,E)})},[k,I,T]),S=(0,w.useCallback)((A,E)=>{g(k(A,E))},[k]),_=(0,w.useCallback)(()=>{typeof window>"u"||(p.current!==null&&window.cancelAnimationFrame(p.current),m.current!==null&&window.clearTimeout(m.current),f.current=!0,p.current=window.requestAnimationFrame(()=>{p.current=null,f.current=!1,L()}),m.current=window.setTimeout(()=>{m.current=null,f.current=!1},100))},[L]);return(0,w.useLayoutEffect)(()=>{if(a)return;let A=l.current;if(!A||b<0)return;let E=A.querySelector(`[data-timeline-index="${b}"]`);if(!E)return;let P=E.offsetTop+E.offsetHeight/2,D=A.scrollHeight-A.clientHeight,B=Math.max(0,Math.min(P-A.clientHeight/2,D));if(A.scrollTop===B)return;d.current=!0,A.scrollTop=B;let z=window.requestAnimationFrame(()=>{d.current=!1,L()}),Z=window.setTimeout(()=>{d.current=!1},100);return()=>{window.cancelAnimationFrame(z),window.clearTimeout(Z),d.current=!1}},[b,a,L]),(0,w.useLayoutEffect)(()=>{if(!(!h||typeof window>"u"))return window.addEventListener("resize",L),()=>{window.removeEventListener("resize",L)}},[L,h]),(0,w.useLayoutEffect)(()=>()=>{p.current!==null&&window.cancelAnimationFrame(p.current),m.current!==null&&window.clearTimeout(m.current),f.current=!1},[]),(0,w.useLayoutEffect)(()=>{if(!h||h.clamped)return;let A=i.current,E=c.current;if(!A||!E||typeof window>"u")return;let P=E.getBoundingClientRect(),D=12,B=h.top;P.top<D?B+=D-P.top:P.bottom>window.innerHeight-D&&(B-=P.bottom-(window.innerHeight-D)),B!==h.top&&g(z=>z?.entry.id===h.entry.id?{...z,top:B,clamped:!0}:z)},[h]),a||e.length===0?null:(0,u.jsx)("div",{className:Mt.sessionTimelineLayer,"aria-hidden":"false",children:(0,u.jsxs)("nav",{ref:i,className:Mt.sessionTimelinePanel,"aria-label":s("timeline.sessionTimeline"),"data-testid":"session-timeline",onMouseLeave:v,children:[(0,u.jsx)("div",{ref:l,className:Mt.sessionTimelineViewport,"data-testid":"session-timeline-viewport",onScroll:y,children:(0,u.jsx)("ol",{className:Mt.sessionTimelineList,children:e.map((A,E)=>{let P=n!==null&&E>=n.startIndex&&E<=n.endIndex,D=n!==null?E===n.currentIndex:A.id===t,B=A.nodeKinds.join(","),z=[`${s("timeline.turnPrefix",{index:E+1})}: ${A.label}`,D?s("timeline.currentTurn"):null].filter(Boolean).join(". "),Z=j=>S(A,j.currentTarget),G=j=>{_(),S(A,j.currentTarget)},te=h?.entry.id===A.id;return(0,u.jsx)("li",{className:Mt.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":A.id,"data-timeline-index":E,"data-node-kinds":B,"data-in-current-range":P?"true":void 0,children:(0,u.jsx)("button",{type:"button",className:k6(Mt.sessionTimelineButton,P?Mt.sessionTimelineButtonInRange:void 0,D?Mt.sessionTimelineButtonCurrent:void 0),"aria-current":D?"step":void 0,"aria-describedby":te?iF:void 0,"aria-label":z,onClick:()=>r(A.id),onFocus:G,onBlur:v,onMouseEnter:Z,onMouseLeave:v,children:(0,u.jsx)("span",{className:Mt.sessionTimelineTick})})},A.id)})})}),h&&typeof document<"u"&&(0,L0.createPortal)((0,u.jsxs)("div",{ref:c,className:Mt.sessionTimelineDetails,id:iF,"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:Mt.sessionTimelineDetailsTitle,children:[h.entry.isScheduledTask&&(0,u.jsx)(w7e,{}),(0,u.jsx)("span",{className:Mt.sessionTimelineDetailsTitleText,children:h.entry.label})]}),(0,u.jsx)("span",{className:Mt.sessionTimelineDetailsDetail,children:h.entry.detail})]}),o??document.body)]})})});function k6(...e){return e.filter(Boolean).join(" ")||void 0}var t8e=[];function n8e({label:e}){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{role:"status","aria-live":"polite",className:Mt.srOnly,children:e}),(0,u.jsxs)("div",{className:Mt.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[(0,u.jsx)("div",{className:Mt.loadingSkeletonUserRow,children:(0,u.jsxs)("div",{className:Mt.loadingSkeletonUserBubble,children:[(0,u.jsx)("span",{className:Mt.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Mt.loadingSkeletonLineShort})]})}),(0,u.jsx)("div",{className:Mt.loadingSkeletonAssistantRow,children:(0,u.jsxs)("div",{className:Mt.loadingSkeletonAssistantBlock,children:[(0,u.jsx)("span",{className:Mt.loadingSkeletonLineMedium}),(0,u.jsx)("span",{className:Mt.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Mt.loadingSkeletonLineNarrow})]})}),(0,u.jsx)("div",{className:Mt.loadingSkeletonUserRow,children:(0,u.jsx)("div",{className:Mt.loadingSkeletonUserBubbleCompact,children:(0,u.jsx)("span",{className:Mt.loadingSkeletonLineMedium})})}),(0,u.jsx)("div",{className:Mt.loadingSkeletonAssistantRow,children:(0,u.jsxs)("div",{className:Mt.loadingSkeletonAssistantBlock,children:[(0,u.jsx)("span",{className:Mt.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Mt.loadingSkeletonLineMedium})]})})]})]})}var a8e=(0,w.memo)((0,w.forwardRef)(function({messages:e,frozenViewport:t=!1,sessionKey:n,terminalBackgroundShellTaskIds:a,pendingApproval:r,onShowContextDetail:o,onImagePreview:s,onAttachmentPreview:i,onInsightReportOpen:l,onEditUserMessage:c,onSubmitUserMessageEdit:d,loadingTranscript:f,catchingUp:p,hasOlderHistory:m=!1,loadingOlderHistory:h=!1,historyCapacityReached:g=!1,historyPaginationError:b=!1,onLoadOlderHistory:v,transcriptBlockCount:y=0,transcriptActivity:k,onReloadTranscript:I,isResponding:T=!1,transcriptReloadPaused:L=T,activeTurnStartedAt:S,welcomeHeader:_,centerWelcomeHeader:A=!1,workspaceCwd:E,tailContent:P,tailKey:D="tail",virtualScrollThreshold:B=sU,autoScrollTailIntoView:z=!1,bottomOverlayInset:Z=0,hideSessionTimeline:G=!1,hideFirstUserMessage:te=!1,firstTurnMetrics:j,includeSubagentToolUsageInMetrics:J=!0,showRetryHint:R=!1,onRetryClick:W,failedPromptMessageId:V,onRetryFailedPrompt:N,onBranchSession:ne,onCanScrollToBottomChange:fe,turnFileChanges:le,turnArtifacts:X,sourceEntries:se,sourceSessionId:ce,onSourceOpen:ae,turnScheduledTasks:pe,onReviewChanges:Ee,onOpenArtifact:Me,onOpenScheduledTask:U,onTurnOutputOpen:ie,onError:Ze,generateContent:$e},at){let rt=(0,w.useRef)(t);rt.current=t;let{t:yt}=nt(),en=_n(),K=(0,w.useContext)(x6),Ce=(0,w.useMemo)(()=>{let F=new Map,ee,be=0;for(let Re of e)Re.role==="user"&&(F.set(Re.id,be),ee=Re.id,be+=1);return{lastId:ee,turnIndexById:F}},[e]),ye=(0,w.useMemo)(()=>{if(!t)return;let F=[...Ce.turnIndexById.keys()];return new Set(F.filter((ee,be)=>be===0||be===F.length-1))},[Ce,t]),We=(0,w.useRef)(void 0),Q=Q9e(We.current,e);(0,w.useLayoutEffect)(()=>{We.current=e},[e]);let me=(0,w.useRef)(void 0),ve=(0,w.useMemo)(()=>{let F=me.current,ee=e[e.length-1],be;if(Q&&F?.sourceMessages===We.current&&F?.compactMode===K&&F.pendingApproval===r&&(ee?.role==="assistant"&&F.value[F.value.length-1]?.id===ee.id?(be=F.value.slice(),be[be.length-1]=ee):ee?.role==="thinking"&&(be=K?r7e(F.value,ee):JB(e))),!be){let Re=JB(e);be=K?a7e(Re,r):Re}return me.current={sourceMessages:e,compactMode:K,pendingApproval:r,value:be},be},[K,e,r,Q]),Ge=(0,w.useRef)(void 0),_e=(0,w.useMemo)(()=>{let F=Ge.current,ee=ve[ve.length-1],be;if(Q&&T&&F?.sourceMessages===We.current&&F?.compactMode===K&&F.pendingApproval===r&&F.isResponding===T&&F.turnFileChanges===le&&F.turnArtifacts===X&&F.turnScheduledTasks===pe){let Re=F.value[F.value.length-1];Re?.type==="message"&&Re.message.id===ee.id&&(be=F.value.slice(),be[be.length-1]={...Re,message:ee})}return be??=o7e(Qq(ve),T,le,X,pe),Ge.current={sourceMessages:e,compactMode:K,pendingApproval:r,isResponding:T,turnFileChanges:le,turnArtifacts:X,turnScheduledTasks:pe,value:be},be},[ve,e,Q,K,r,T,le,X,pe]),He=(0,w.useMemo)(()=>{for(let F=ve.length-1;F>=0;F-=1){let ee=ve[F];if(ee?.role==="system"&&ee.source==="background_notification")return ee.id}return null},[ve]),[ht,Vt]=(0,w.useState)(He),fn=!!(f||p),st=(0,w.useRef)(fn),Dt=(0,w.useRef)(ve.length>0),Mn=!Dt.current&&ve.length>0,Ln=fn||st.current||Mn;(0,w.useLayoutEffect)(()=>{Ln&&Vt(He),ve.length>0&&(Dt.current=!0),st.current=fn},[Ln,He,fn,ve.length]);let qn=!Ln&&He!==null&&ht!==He,lt=(0,w.useMemo)(()=>{for(let F=_e.length-1;F>=0;F-=1){let ee=_e[F];if(ee.type==="message"&&Qr(ee.message))return F}return 0},[_e]),ct=en==="interactive",wt=(0,w.useMemo)(()=>ct&&aU(_e,lt,_e.length-1),[_e,ct,lt]),mt=(0,w.useMemo)(()=>oU(_e,lt,_e.length-1,!0),[_e,lt]),Ya=(0,w.useMemo)(()=>{let F=mt?.unmatchedAgentCallIds;return F&&F.size>0?[...F].sort().join("|"):""},[mt]),Qa=qn&&!wt&&(mt?.sawAgentCompletion??!1)&&(mt?.unmatchedAgentCallIds.size??0)>0,[nn,Co]=(0,w.useState)(!1);(0,w.useEffect)(()=>{Co(!1)},[Ya,lt,T]),(0,w.useEffect)(()=>{if(!Qa||T)return;let F=setTimeout(()=>Co(!0),YB);return()=>clearTimeout(F)},[Qa,Ya,lt,T]);let Or=(0,w.useMemo)(()=>qn&&!wt&&!T&&(mt?.sawAgentCompletion??!1)&&(mt?.unmatchedAgentCallIds.size??0)===0&&b6(_e,lt,_e.length-1,!0,!0,!0),[qn,_e,T,mt,wt,lt]),[Ra,Dr]=(0,w.useState)(!1),no=(0,w.useMemo)(()=>{let F=mt;if(!F||F.lastNotificationIndex<0)return"";let ee=_e[F.lastNotificationIndex];return ee?.type==="message"?ee.message.id:""},[_e,mt]);(0,w.useEffect)(()=>{Dr(!1)},[no,lt,T]),(0,w.useEffect)(()=>{if(!Or)return;let F=setTimeout(()=>Dr(!0),YB);return()=>clearTimeout(F)},[Or,no,lt,T]);let xr=(0,w.useMemo)(()=>qn&&b6(_e,lt,_e.length-1,!0,wt||!nn,!Ra),[qn,_e,wt,lt,Ra,nn]),ni=(0,w.useMemo)(()=>{let F=new Set;for(let ee=lt;ee<_e.length;ee+=1){let be=_e[ee];be.type==="parallel_agents"&&F.add(be.key)}return F},[_e,lt]),Rp=(0,w.useMemo)(()=>{if(!qn)return{key:null};let F=-1,ee;for(let be=_e.length-1;be>=0;be-=1){let Re=_e[be];if(Re.type!=="message"||Re.message.role!=="system"||Re.message.source!=="background_notification")continue;let Te=w6(Re);if(Te){F=be,ee=Te.callId;break}}for(let be=F-1;be>=0;be-=1){let Re=_e[be];if(Re.type==="parallel_agents"&&(!ee||Re.agents.some(Te=>Te.callId===ee)))return{key:Re.key}}return{key:null}},[qn,_e]),Ma=(0,w.useRef)(null),_c=o9e(Ma,!G),[cd,db]=(0,w.useState)(()=>new Set),G0=(0,w.useCallback)((F,ee)=>{db(be=>{if(be.has(F)===ee)return be;let Re=new Set(be);return ee?Re.add(F):Re.delete(F),Re})},[]),ud=(0,w.useRef)(null),Lc=(0,w.useMemo)(()=>{if(!_c)return t8e;let F=k7e(ve);return(ud.current?.signature!==F||ud.current?.t!==yt)&&(ud.current={signature:F,t:yt,entries:y7e(ve,yt)}),ud.current.entries},[_c,ve,yt]),fb=(0,w.useMemo)(()=>new Map(Lc.map((F,ee)=>[F.id,ee])),[Lc]),V0=(0,w.useMemo)(()=>t7e(ve),[ve]),[Mp,X0]=(0,w.useState)(null),Z0=Mp!==null?Lc[Mp.currentIndex]?.id??V0:V0,K0=(0,w.useRef)(void 0),dd=(0,w.useMemo)(()=>{let F=K0.current,ee;return Q&&T&&F?.sourceMessages===We.current&&F?.isResponding===T&&F.latestTurnAwaitsAgentSummary===xr&&F.gateBackgroundAgentStatus===ct?ee=F.value:ee=i7e(_e,{isResponding:T,latestTurnAwaitsAgentSummary:xr,gateBackgroundAgentStatus:ct}),K0.current={sourceMessages:e,isResponding:T,latestTurnAwaitsAgentSummary:xr,gateBackgroundAgentStatus:ct,value:ee},ee},[_e,e,Q,ct,T,xr]),{collapseCompletedTurns:pb,sourceReferences:Ac,assistantFeedback:Pp}=Go(),{ratings:Y0,rate:Q0,ratingForTurn:J0}=mse(ce),eg=(0,w.useMemo)(()=>{let F=new Map;for(let ee of e)Qr(ee)&&F.set(ee.id,ee);return F},[e]),Ec=ose({renderMode:en,sessionId:ce,options:Pp}),tg=(0,w.useRef)(Pp);tg.current=Pp;let ng=(0,w.useRef)(e);ng.current=e;let Np=(0,w.useCallback)((F,ee,be)=>{let Re=J0(F);Q0(F,be);let Te=tg.current?.onRate;Te&&sse(Te,{rating:be,previousRating:Re,sessionId:ce,promptId:F,userMessage:ise(ng.current,ee)})},[J0,Q0,ce]),ag=(0,w.useRef)(void 0),Rc=(0,w.useMemo)(()=>{let F=[se,E,ce,Ac],ee=ag.current;return Q&&T&&ee&&ee.sourceMessages===We.current&&QB(ee.dependencies,F)?ee.value:Loe(e,se??[],E,ce,Ac)},[e,se,E,ce,Ac,Q,T]);(0,w.useLayoutEffect)(()=>{ag.current={sourceMessages:e,dependencies:[se,E,ce,Ac],value:Rc}},[e,se,E,ce,Ac,Rc]);let Op=pb??!0,[Mc,fd]=(0,w.useState)(()=>new Map),[sl,Pc]=(0,w.useState)(()=>new Set),il=(0,w.useRef)(new Map),[Ja,mb]=(0,w.useTransition)(),pd=(0,w.useRef)(!1),md=(0,w.useRef)(new Map),ll=(0,w.useRef)(void 0),cl=(0,w.useRef)([]),ul=(0,w.useRef)(!0);t&&(ul.current=!1);let $=(0,w.useRef)(!1),de=(0,w.useRef)(0),ke=(0,w.useRef)(0),et=(0,w.useRef)(!1),xt=(0,w.useRef)(0),hn=(0,w.useRef)(!1),Sr=(0,w.useRef)(0),Zo=(0,w.useRef)(null),$r=(0,w.useRef)(!1),Cs=(0,w.useRef)(null),Dp=(0,w.useRef)(null),$p=(0,w.useRef)(!1),To=(0,w.useRef)(null),hd=(0,w.useRef)(!1),hb=(0,w.useRef)(f),gb=(0,w.useRef)(!!f),gd=(0,w.useRef)(void 0),vd=(0,w.useRef)(void 0),x9=(0,w.useRef)(Z),vb=(0,w.useRef)(null),S9=(0,w.useRef)(p),Nc=(0,w.useRef)(p),C9=(0,w.useRef)(!1),yb=(0,w.useRef)(!1),yd=(0,w.useRef)(void 0),Bp=(0,w.useRef)(void 0);Nc.current=p;let wd=(0,w.useRef)(!1),Br=(0,w.useRef)(void 0),Fp=(0,w.useRef)(void 0),ai=(0,w.useRef)(void 0),zp=(0,w.useRef)(void 0),qp=(0,w.useRef)(void 0),bd=(0,w.useRef)(void 0),rg=(0,w.useRef)(void 0),wb=(0,w.useRef)(y),bb=(0,w.useRef)(L);wb.current=y,bb.current=L||t;let kb=(0,w.useRef)(null),[Pn,Ts]=(0,w.useState)(null),T9=(0,w.useRef)(!1);T9.current=Pn?.virtual===!0;let I9=(0,w.useRef)(ve.length);(0,w.useLayoutEffect)(()=>{I9.current=ve.length},[ve.length]);let xb=(0,w.useRef)(e);(0,w.useLayoutEffect)(()=>{xb.current=e},[e]);let[mU,og]=(0,w.useState)(!1),[hU,gU]=(0,w.useState)(n);hU!==n&&(gU(n),il.current.clear(),xt.current+=1,et.current=!1,wd.current=!1,Ts(null),fd(F=>F.size?new Map:F),Pc(F=>F.size?new Set:F)),(0,w.useEffect)(()=>{m||(wd.current=!1,kb.current=null)},[m]);let Up=(0,w.useCallback)(()=>{let F=Ma.current,ee=F?F.scrollHeight-F.scrollTop-F.clientHeight:0,be=!ul.current&&ee>1;Dp.current!==be&&(Dp.current=be,fe?.(be))},[fe]),er=(0,w.useCallback)(()=>{Bp.current!==void 0&&window.cancelAnimationFrame(Bp.current),Bp.current=window.requestAnimationFrame(Up)},[Up]),qt=(0,w.useCallback)(F=>{rt.current&&(F=!1),ul.current!==F&&(ul.current=F,er())},[er]),kd=(0,w.useRef)(void 0),Sb=(0,w.useRef)(!1),Pa=(0,w.useMemo)(()=>{Sb.current=!1;let F=[ye,Mc,T,S,a,qn,wt,nn,Ra,Op,te,j,J,cd,K,r,le,X,pe,sl],ee=kd.current,be=_e[_e.length-1];if(Q&&T&&ee&&ee.sourceMessages===We.current&&QB(ee.dependencies,F)&&be?.type==="message"){let dt=kw(be),Wa=-1;for(let Na=ee.value.length-1;Na>=0;Na-=1)if(kw(ee.value[Na])===dt){Wa=Na;break}if(Wa>=0){let Na=ee.value[Wa];if(Na?.type==="message"){let ao=ee.value.slice();return ao[Wa]={...Na,message:be.message},kd.current={sourceMessages:e,dependencies:F,value:ao,virtualizerItems:ee.virtualizerItems},Sb.current=!0,ao}}}let Re=F7e(_e,{overrides:Mc,isResponding:T,activeTurnStartedAt:S,terminalBackgroundShellTaskIds:a,backgroundSummaryGraceActive:qn,waitForUnmatchedAgentCompletions:wt||!nn,waitForOrderedNarration:!Ra,automaticallyExpandedAgentKeys:cd,pendingApprovalCallId:r?.toolCallId??null,includeSubagentToolUsageInMetrics:J,paginatedExpanded:ye?new Set([...sl,...ye]):sl,enabled:Op}),Te=ye?Re.map(dt=>{if(!("turnCollapse"in dt)||!dt.turnCollapse||!ye.has(dt.turnCollapse.turnId))return dt;let{turnId:Wa,collapsed:Na,hiddenCount:ao}=dt.turnCollapse;return{...dt,turnCollapse:{turnId:Wa,collapsed:Na,hiddenCount:ao}}}):Re,on=!1,bn=j?Te.map(dt=>on||dt.type!=="turn_collapse"?dt:(on=!0,{...dt,turnCollapse:{...dt.turnCollapse,...j.durationMs!==void 0&&j.durationMs>0?{elapsedMs:j.durationMs}:{},...j.inputTokens!==void 0?{inputTokens:j.inputTokens}:{},...j.outputTokens!==void 0?{outputTokens:j.outputTokens}:{},...j.cachedTokens!==void 0?{cachedTokens:j.cachedTokens}:{}}})):Te,pn=s7e(bn,cd);if(!te)return kd.current={sourceMessages:e,dependencies:F,value:pn,virtualizerItems:pn},pn;let Bt=ve.find(dt=>dt.role==="user")?.id,an=Bt?pn.filter(dt=>dt.type!=="message"||dt.message.id!==Bt):pn;return kd.current={sourceMessages:e,dependencies:F,value:an,virtualizerItems:an},an},[_e,Q,Mc,T,S,a,qn,wt,nn,Ra,Op,ye,te,j,J,ve,e,cd,K,r,le,X,pe,sl]),xd=kd.current?.sourceMessages===e?kd.current.virtualizerItems:Pa,Hp=(0,w.useCallback)(F=>xd.some(ee=>String(kw(ee))===F),[xd]),Cb=(0,w.useRef)(void 0),vU=(0,w.useMemo)(()=>{if(Sb.current&&Cb.current?.length===Pa.length)return Cb.current.value;let F=nU(Pa);return Cb.current={length:Pa.length,value:F},F},[Pa]),yU=Lc.length>=The,Ko=P!=null,Sd=!!f,dl=!!_,tr=dl?1:0,Oc=tr+Pa.length,jp=Oc+(Ko?1:0),wU=tr+_e.length+(Ko?1:0),ri=j7e(wU,B),Ha=(0,w.useCallback)(()=>Ma.current,[]),_9=(0,w.useCallback)(()=>{let F=Ma.current;if(!F)return;let ee=F.scrollHeight-F.scrollTop-F.clientHeight<Sw;$.current=!ee,qt(ee),er()},[er,qt]),Wp=(0,w.useCallback)(()=>{de.current=Date.now()+1e3},[]),sg=(0,w.useCallback)(()=>{qp.current!==void 0&&(window.clearTimeout(qp.current),qp.current=void 0)},[]),Yo=(0,w.useCallback)(()=>{sg(),bd.current?.abort(),bd.current=void 0},[sg]),Cd=(0,w.useCallback)(()=>{sg();let F=rg.current;if(F){if(k?.getSnapshot().lastEventId===F.lastEventId)return;rg.current=void 0}!I||bd.current!==void 0||$.current||bb.current||wb.current<=K$||(qp.current=window.setTimeout(()=>{if(qp.current=void 0,bb.current||$.current||wb.current<=K$)return;let ee=Ma.current;if(!ee||ee.scrollHeight-ee.scrollTop-ee.clientHeight>=Sw)return;let be=new AbortController;bd.current=be,I(be.signal).then(()=>{if(be.signal.aborted)return;let Re=k?.getSnapshot();rg.current={...Re?.lastEventId!==void 0?{lastEventId:Re.lastEventId}:{}}}).catch(Re=>{Re instanceof Error&&Re.name==="AbortError"||console.warn("[MessageList] transcript reload failed:",Re)}).finally(()=>{bd.current===be&&(bd.current=void 0)})},K9e))},[sg,I,k]);(0,w.useEffect)(()=>{rg.current=void 0},[k]),(0,w.useEffect)(()=>{if(!k)return Yo;let F=k.getSnapshot().lastEventId,ee=k.subscribe(()=>{let be=k.getSnapshot().lastEventId;be!==F&&(F=be,Cd())});return()=>{ee(),Yo()}},[k,Cd,Yo]),(0,w.useEffect)(()=>{if(L){Yo();return}Cd()},[Yo,L,Cd,y]);let Td=(0,w.useCallback)(()=>{yb.current=!0,yd.current!==void 0&&window.cancelAnimationFrame(yd.current),yd.current=window.requestAnimationFrame(()=>{yb.current=!1,yd.current=void 0,_9()})},[_9]);(0,w.useEffect)(()=>()=>{yd.current!==void 0&&window.cancelAnimationFrame(yd.current),Bp.current!==void 0&&window.cancelAnimationFrame(Bp.current),Br.current!==void 0&&window.cancelAnimationFrame(Br.current),Fp.current!==void 0&&window.cancelAnimationFrame(Fp.current),ai.current!==void 0&&window.cancelAnimationFrame(ai.current),Yo(),gd.current!==void 0&&window.cancelAnimationFrame(gd.current),vd.current!==void 0&&window.cancelAnimationFrame(vd.current)},[Yo]);let L9=(0,w.useCallback)((F,ee)=>{let be=Ma.current;(!be||be.scrollHeight>be.clientHeight+1)&&($.current=!0,qt(!1)),Td(),ll.current!==void 0&&window.clearTimeout(ll.current),md.current.clear(),Ma.current?.querySelectorAll("[data-message-row-key]").forEach(Re=>{let Te=Re.dataset.messageRowKey;Te&&md.current.set(Te,Re.getBoundingClientRect().top)}),pd.current=!0,mb(()=>{Pc(Re=>{if(!Re.has(F))return Re;let Te=new Set(Re);return Te.delete(F),Te}),fd(Re=>{let Te=new Map(Re);return Te.set(F,ee),Te})})},[Td,qt]);(0,w.useLayoutEffect)(()=>{if(Ja||!pd.current)return;pd.current=!1;for(let ee of cl.current)ee.cancel();cl.current=[];let F=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;F||Ma.current?.querySelectorAll("[data-message-row-key]").forEach(ee=>{if(typeof ee.animate!="function")return;let be=ee.dataset.messageRowKey,Re=be?md.current.get(be):void 0;if(Re===void 0){cl.current.push(ee.animate([{opacity:0},{opacity:1}],{duration:xC,easing:"ease-out"}));return}let Te=Re-ee.getBoundingClientRect().top;Math.abs(Te)<1||cl.current.push(ee.animate([{translate:`0 ${Te}px`},{translate:"0 0"}],{duration:xC,easing:"ease-out"}))}),md.current.clear(),ll.current=window.setTimeout(()=>{ll.current=void 0,Td()},F?0:xC)},[Td,Ja]),(0,w.useEffect)(()=>()=>{ll.current!==void 0&&window.clearTimeout(ll.current);for(let F of cl.current)F.cancel();cl.current=[]},[]);let bU=(0,w.useCallback)(F=>{let ee=F.target;ee instanceof HTMLElement&&ee.closest("[aria-expanded], summary")&&($.current=!0,qt(!1),Td())},[Td,qt]),Dc=(0,w.useCallback)(F=>{if(dl&&F===IC)return"slot:header";if(Ko&&F===Oc)return`slot:tail:${D}`;let ee=xd[F-tr];return ee?kw(ee):`slot:row:${F}`},[dl,Ko,Oc,D,xd,tr]),kU=(0,w.useCallback)(F=>dl&&F===IC?z7e:Ko&&F===Oc?H7e:xd[F-tr]?.type==="turn_collapse"?U7e:q7e,[dl,Ko,tr,Oc,xd]),ja=(0,w.useCallback)((F="auto")=>{if(rt.current)return;let ee=Ha();if(!ee||ee.scrollHeight<=ee.clientHeight)return;$r.current=!1,Sr.current+=1;let be=Sr.current;hn.current=!0,F==="smooth"?ee.scrollTo({top:ee.scrollHeight,behavior:F}):ee.scrollTop=ee.scrollHeight,er(),ke.current=Math.max(0,ee.scrollHeight-ee.clientHeight),Up();let Re=()=>{if(Sr.current!==be||(hn.current=!1,!$r.current)||($r.current=!1,Nc.current||$.current))return;let Te=Ha();!Te||Te.scrollHeight<=Te.clientHeight||(qt(!0),Te.scrollTop=Te.scrollHeight,er(),ke.current=Math.max(0,Te.scrollHeight-Te.clientHeight),Up())};F==="smooth"?setTimeout(Re,350):requestAnimationFrame(Re)},[Ha,Up,er,qt]),A9=(0,w.useCallback)((F="smooth")=>{$.current=!1,qt(!0),ja(F)},[ja,qt]),Qo=Goe({count:jp,enabled:ri,getScrollElement:Ha,getItemKey:Dc,estimateSize:kU,overscan:20,anchorTo:"end",useFlushSync:!1,useAnimationFrameWithResizeObserver:!0,directDomUpdates:!0});Qo.shouldAdjustScrollPositionOnItemSizeChange=(F,ee,be)=>W7e(F.end,Ma.current?.scrollTop??be.scrollOffset??0);let xU=(0,w.useCallback)(F=>{if(Qo.measureElement(F),!F||!T9.current)return;let ee=Number(F.dataset.index);Number.isFinite(ee)&&!Qo.itemSizeCache.has(Dc(ee))&&Qo.resizeItem(ee,F.offsetHeight)},[Dc,Qo]);(0,w.useLayoutEffect)(()=>{if(!Pn)return;let F=Ma.current;if(Pn.rowKey&&!Hp(Pn.rowKey)){let ee=f7e(xb.current,Pn.rowKey);if(ee!==void 0&&p7e(Pa,ee)&&Mc.get(ee)!==!1&&!sl.has(ee)){Pc(be=>be.has(ee)?be:new Set(be).add(ee)),Ts(be=>be&&{...be,rowKey:`msg:${ee}`});return}Pn.generation===xt.current&&(xt.current+=1),et.current=!1,zp.current=void 0,og(!1),Ts(null);return}if(Pn.settled){if(!F){et.current=!1,Ts(null);return}if(Pn.virtual?ve.length===Pn.messageCount:F.scrollHeight===Pn.scrollHeight){if(et.current=!1,Br.current!==void 0)return;let ee=oF,be=()=>{if(Br.current=void 0,Pn.generation===xt.current&&I9.current===Pn.messageCount){if(ee-=1,ee>0){Br.current=requestAnimationFrame(be);return}Ts(Re=>Re===Pn?null:Re)}};Br.current=requestAnimationFrame(be);return}Br.current!==void 0&&(cancelAnimationFrame(Br.current),Br.current=void 0),Br.current=requestAnimationFrame(()=>{if(Br.current=void 0,Pn.generation!==xt.current)return;if(Pn.rowKey&&!Hp(Pn.rowKey)){et.current=!1,Ts(null);return}let ee=Pn.rowKey?Array.from(F.querySelectorAll("[data-message-row-key]")).find(be=>be.dataset.messageRowKey===Pn.rowKey):void 0;ee&&Pn.rowTop!==void 0?F.scrollTop+=ee.getBoundingClientRect().top-Pn.rowTop:F.scrollTop=Pn.scrollTop+Math.max(0,F.scrollHeight-Pn.scrollHeight),et.current=!1,Ts(null)})}},[Hp,ve.length,Pn,Pa,Mc,sl]);let E9=Qo.getVirtualItems(),Id=Qo.getTotalSize(),R9=(0,w.useRef)({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});R9.current={entryIndexById:fb,headerOffset:tr,isVisible:_c,turnIdByDisplayIndex:vU,visibleItems:Pa};let M9=(0,w.useCallback)(()=>{let F=Ha(),ee=R9.current;if(!F||!ee.isVisible||ee.entryIndexById.size===0){X0(dt=>dt===null?dt:null);return}let be=F.getBoundingClientRect(),Re=be.top,Te=be.bottom,on=Re+(Te-Re)/2,bn=[],pn=null,Bt=Number.POSITIVE_INFINITY;F.querySelectorAll("[data-index]").forEach(dt=>{let Wa=dt.dataset.index;if(Wa===void 0)return;let Na=Number(Wa);if(!Number.isFinite(Na))return;let ao=Na-ee.headerOffset;if(ao<0||ao>=ee.visibleItems.length)return;let Bc=dt.getBoundingClientRect();if(Bc.bottom<Re||Bc.top>Te)return;bn.push(ao);let CU=Bc.top+(Bc.bottom-Bc.top)/2,$9=Math.abs(CU-on);$9<Bt&&(Bt=$9,pn=ao)});let an=R7e(ee.visibleItems,bn,ee.entryIndexById,pn,ee.turnIdByDisplayIndex);X0(dt=>dt?.startIndex===an?.startIndex&&dt?.endIndex===an?.endIndex&&dt?.currentIndex===an?.currentIndex?dt:an)},[Ha]),fl=(0,w.useCallback)(()=>{Cs.current!==null&&cancelAnimationFrame(Cs.current),Cs.current=requestAnimationFrame(()=>{Cs.current=null,M9()})},[M9]);(0,w.useEffect)(()=>()=>{Zo.current!==null&&(clearTimeout(Zo.current),Zo.current=null),Cs.current!==null&&(cancelAnimationFrame(Cs.current),Cs.current=null)},[]),(0,w.useEffect)(()=>{fl()},[fl,jp,Id,ri,E9.length,_c]);let[Gp,Tb]=(0,w.useState)(null);(0,w.useEffect)(()=>{if(!Gp)return;let F=setTimeout(()=>Tb(null),1600);return()=>clearTimeout(F)},[Gp]);let Ib=(0,w.useCallback)((F,ee)=>{$.current=!0,qt(!1),Sr.current+=1;let be=Sr.current;if(hn.current=!0,ri)if(rt.current){let Re=Qo.getOffsetForIndex(F,"center");Re&&Ma.current&&(Ma.current.scrollTop=Re[0])}else Qo.scrollToIndex(F,{align:"center"});else Ma.current?.querySelector(`[data-index="${F}"]`)?.scrollIntoView({block:"center"});Zo.current!==null&&clearTimeout(Zo.current),Zo.current=setTimeout(()=>{Zo.current=null,Sr.current===be&&(hn.current=!1,fl(),er())},150),Tb(null),requestAnimationFrame(()=>Tb(ee))},[ri,Qo,qt,fl,er]),P9=(0,w.useRef)({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});P9.current={visibleItems:Pa,displayItems:_e,headerOffset:tr,performScrollToRow:Ib};let $c=(0,w.useRef)(null),Vp=(0,w.useCallback)((F,ee)=>{let{visibleItems:be,displayItems:Re,headerOffset:Te,performScrollToRow:on}=P9.current,bn=xw(be,F,ee);if(bn>=0)return $c.current=null,on(bn+Te,{messageId:F,callId:ee}),!0;let pn=xw(Re,F,ee);if(pn<0)return!1;let Bt=tU(Re,pn);return Bt?($c.current={messageId:F,callId:ee},fd(an=>{if(an.get(Bt)===!0)return an;let dt=new Map(an);return dt.set(Bt,!0),dt}),!0):!1},[]);(0,w.useImperativeHandle)(at,()=>({scrollToMessage:Vp,scrollToBottom:A9}),[Vp,A9]),(0,w.useEffect)(()=>{let F=$c.current;if(!F)return;let ee=xw(Pa,F.messageId,F.callId);ee<0||($c.current=null,Ib(ee+tr,F))},[Pa,tr,Ib]);let Is=(0,w.useCallback)(async(F=!1,ee=!1)=>{let be=Ma.current;if(!be||!v||h||et.current||b&&!ee||wd.current&&!F)return;wd.current=!1,et.current=!0;let Re=++xt.current;Br.current!==void 0&&(cancelAnimationFrame(Br.current),Br.current=void 0),og(!ee);let Te;if(ri){let an=String(Dc(tr)),dt=oF;if(Te=await new Promise(Wa=>{let Na=()=>{if(Fp.current=void 0,Re!==xt.current||Ma.current!==be||!Hp(an)||dt--<=0){Wa(void 0);return}let ao=Array.from(be.querySelectorAll("[data-message-row-key]")).find(Bc=>Bc.dataset.messageRowKey===an);ao?Wa({rowKey:an,rowTop:ao.getBoundingClientRect().top}):Fp.current=requestAnimationFrame(Na)};Fp.current=requestAnimationFrame(Na)}),!Te){Re===xt.current&&(et.current=!1,zp.current=void 0,og(!1));return}}let on=be.scrollHeight,bn=be.scrollTop,pn=be.getBoundingClientRect().top,Bt=Te?void 0:Array.from(be.querySelectorAll("[data-message-row-key]")).find(an=>{let dt=an.dataset.messageRowKey;return dt!==void 0&&dt.startsWith("msg:")&&an.getBoundingClientRect().bottom>pn});$.current=!0,Ts({scrollHeight:on,scrollTop:bn,messageCount:ve.length,virtual:ri,settled:!1,generation:Re,...Te??(Bt?{rowKey:Bt.dataset.messageRowKey,rowTop:Bt.getBoundingClientRect().top}:{})});try{il.current.set(Re,{ids:new Set(xb.current.map(dt=>dt.id)),resolved:!1}),await v(ee?{force:!0}:void 0);let an=il.current.get(Re);an&&(an.resolved=!0),Re===xt.current&&Ts(dt=>dt?.generation===Re?{...dt,settled:!0}:dt)}catch{il.current.delete(Re),Re===xt.current&&(wd.current=!0,et.current=!1,Ts(null))}finally{Re===xt.current&&og(!1)}},[h,v,b,Dc,Hp,tr,ve.length,ri]),SU=(0,w.useCallback)(()=>{Is(!0,!0)},[Is]);(0,w.useLayoutEffect)(()=>{let F=il.current;if(F.size===0)return;let ee=e.find(bn=>!bn?.id.startsWith("local-"));if(!ee)return;let be=F.entries().next().value;if(!be)return;let[Re,Te]=be;if(Te.ids.has(ee.id))return;let on=[];for(let bn=0;bn<e.length;bn++){let pn=e[bn];if(!pn||!Qr(pn)||Te.ids.has(pn.id))continue;let Bt=!1;for(let an=bn+1;an<e.length;an++){let dt=e[an];if(Qr(dt))break;if(Te.ids.has(dt.id)){Bt=!0;break}}Bt&&on.push(pn.id)}if(on.length===0){if(!Te.resolved)return}else Pc(bn=>{let pn=null;for(let Bt of on)bn.has(Bt)||(pn??=new Set(bn),pn.add(Bt));return pn??bn});F.delete(Re);for(let bn of F.values())for(let pn of e)pn&&bn.ids.add(pn.id)},[e]),(0,w.useEffect)(()=>{let F=zp.current;if(F===void 0||h||Pn||et.current||(zp.current=void 0,!m||F!==xt.current))return;let ee=Ha();ee&&ee.scrollTop<=_C&&Is(!0)},[Ha,m,Is,h,Pn]);let _b=(0,w.useCallback)(()=>{let F=Ha();if(!F)return;let ee=F.scrollTop;m&&ee<=_C&&Is(!0);let be=Date.now()<=de.current;if(hn.current&&!be){ke.current=ee;return}fl();let Re=ke.current;ke.current=ee;let Te=F.scrollHeight-ee-F.clientHeight;if(er(),ee<Re-1){let on=Te<Sw;be?(Yo(),$.current=!0,qt(!1)):on?($.current=!1,qt(!0)):$.current||(Yo(),qt(!1));return}Te<Sw?($.current=!1,qt(!0),Cd()):Yo()},[Ha,m,Is,er,fl,Cd,Yo,qt]);(0,w.useEffect)(()=>{let F=Ha();if(F)return F.addEventListener("scroll",_b,{passive:!0}),()=>F.removeEventListener("scroll",_b)},[Ha,_b]);let ig=(0,w.useCallback)(()=>{if(!m||h||p||Sd)return;let F=Ha();if(!F||F.scrollHeight>F.clientHeight+1)return;let ee=kb.current;if(ee!==null&&ee.loader===v&&ee.totalVirtualSize===Id){wd.current=!0;return}kb.current={loader:v,totalVirtualSize:Id},Is()},[p,Ha,m,Is,h,v,Sd,Id]);(0,w.useEffect)(()=>{ig()},[ig,Id]),(0,w.useEffect)(()=>{let F=Ha();if(!F)return;let ee=()=>{if(ai.current=void 0,!(F.scrollTop>_C)){if(h||et.current){zp.current=xt.current;return}Is(!0)}},be=()=>{ai.current!==void 0&&cancelAnimationFrame(ai.current),ai.current=requestAnimationFrame(ee)},Re=Bt=>{Wp(),Bt.deltaY<0&&be()},Te=()=>{Wp()},on=()=>be(),bn=Bt=>{let an=F.getBoundingClientRect(),dt=20;(Bt.clientX>=an.right-dt||Bt.clientY>=an.bottom-dt)&&Wp()},pn=Bt=>{(Bt.key==="ArrowUp"||Bt.key==="ArrowDown"||Bt.key==="PageUp"||Bt.key==="PageDown"||Bt.key==="Home"||Bt.key==="End"||Bt.key===" ")&&(Wp(),(Bt.key==="ArrowUp"||Bt.key==="PageUp"||Bt.key==="Home")&&be())};return F.addEventListener("wheel",Re,{passive:!0}),F.addEventListener("touchstart",Te,{passive:!0}),F.addEventListener("touchmove",on,{passive:!0}),F.addEventListener("pointerdown",bn,{passive:!0}),F.addEventListener("keydown",pn,{passive:!0}),()=>{F.removeEventListener("wheel",Re),F.removeEventListener("touchstart",Te),F.removeEventListener("touchmove",on),F.removeEventListener("pointerdown",bn),F.removeEventListener("keydown",pn),ai.current!==void 0&&(cancelAnimationFrame(ai.current),ai.current=void 0)}},[Ha,Is,h,Wp]),(0,w.useEffect)(()=>{let F=Ha();if(!F||typeof ResizeObserver>"u")return;let ee=new ResizeObserver(()=>{er(),ig(),!(Nc.current||$.current)&&(qt(!0),ja())});ee.observe(F);for(let Re of Array.from(F.children))ee.observe(Re);let be=new MutationObserver(Re=>{for(let Te of Re){for(let on of Array.from(Te.addedNodes))on instanceof HTMLElement&&ee.observe(on);for(let on of Array.from(Te.removedNodes))on instanceof HTMLElement&&ee.unobserve(on)}er()});return be.observe(F,{childList:!0}),er(),()=>{ee.disconnect(),be.disconnect()}},[Ha,ig,er,ja,qt]),(0,w.useEffect)(()=>{e.length===0&&($.current=!1,$r.current=!1,qt(!0),$c.current=null,il.current.clear(),fd(F=>F.size?new Map:F),Pc(F=>F.size?new Set:F))},[e.length,qt]),(0,w.useEffect)(()=>{let F=Ma.current;if(!F)return;let ee=new ResizeObserver(()=>{fl(),!Nc.current&&($.current||(qt(!0),requestAnimationFrame(()=>{!Nc.current&&!$.current&&ja()})))});return ee.observe(F),()=>ee.disconnect()},[ja,fl,qt]),(0,w.useLayoutEffect)(()=>{let F=J9e(e);if(p||f||hb.current){To.current=F,$p.current=!0,hd.current=!1,hb.current=f;return}if(hb.current=f,!$p.current){To.current=F,$p.current=!0,hd.current=!1;return}let ee=e7e(e);F&&ee?.role==="user"&&F!==To.current?($.current=!1,qt(!0),$c.current=null,hd.current=!0):hd.current=!1,To.current=F},[e,p,f,qt]),(0,w.useLayoutEffect)(()=>{S9.current&&!p&&($.current=!1,qt(!0),ja("auto")),S9.current=p},[p,ja,qt]),(0,w.useLayoutEffect)(()=>{if(f){gb.current=!0;return}if(!gb.current||p||e.length===0)return;gb.current=!1,$.current=!1,qt(!0),$c.current=null,gd.current!==void 0&&window.cancelAnimationFrame(gd.current),vd.current!==void 0&&window.cancelAnimationFrame(vd.current);let F=()=>{Nc.current||$.current||(qt(!0),ja("auto"))};gd.current=window.requestAnimationFrame(()=>{gd.current=void 0,F(),vd.current=window.requestAnimationFrame(()=>{vd.current=void 0,F()})})},[p,f,e.length,ja,qt]),(0,w.useLayoutEffect)(()=>{let F=x9.current!==Z;x9.current=Z,F&&(p||$.current||(qt(!0),requestAnimationFrame(()=>{!Nc.current&&!$.current&&ja("auto")})))},[Z,p,ja,qt]);let lg=(0,w.useMemo)(()=>C7e(Pa),[Pa]);(0,w.useLayoutEffect)(()=>{if(!p){if(!lg){vb.current=null;return}lg!==vb.current&&(vb.current=lg,(ul.current||!$.current)&&requestAnimationFrame(()=>{$.current||(qt(!0),ja())}))}},[p,lg,ja,qt]),(0,w.useEffect)(()=>{z&&Ko&&!C9.current&&($.current=!1,qt(!0),requestAnimationFrame(()=>{$.current||ja()})),C9.current=Ko},[z,Ko,ja,qt]);let N9=(0,w.useCallback)(F=>{let ee=Te=>{if(Te.type==="parallel_agents")return(0,u.jsx)(RC,{timestamp:Te.timestamp,children:(0,u.jsx)("div",{className:aF(Te,Gp)?ol.flash:void 0,children:(0,u.jsx)(Iz,{agents:Te.agents,autoManageExpansion:en==="interactive"&&!p,automaticCollapseDelayMs:Rp.key===Te.key&&!xr?Y9e:void 0,deferAutomaticCollapse:Rp.key===Te.key&&xr,expandActiveWhenLive:T&&ni.has(Te.key),onAutomaticExpansionChange:Na=>G0(Te.key,Na),pendingApproval:r})})});if(Te.type==="turn_outputs")return(0,u.jsx)(K6e,{changes:Te.changes,turnId:Te.turnId,artifacts:Te.artifacts,scheduledTasks:Te.scheduledTasks,workspaceCwd:E,onOpenRequest:ie,onReviewChanges:Ee??kC,onOpenArtifact:Me??kC,onOpenScheduledTask:U??kC,onError:Ze});if(Te.type==="turn_collapse")return(0,u.jsx)(K7e,{turnCollapse:Te.turnCollapse,onToggleCollapse:L9});let on=Te.message.role==="assistant"?dd.get(Te.message.id):void 0,bn;Te.message.role==="assistant"&&on&&!t&&(bn={turnId:on,message:{id:Te.message.id,content:Te.message.content,isStreaming:Te.message.isStreaming,timestamp:Te.message.timestamp}});let pn=on?eg.get(on):void 0,Bt=Te.message.promptId??pn?.promptId,an=Te.message.role==="assistant"?Te.message.branchRecordId:void 0,dt=Te.message.role==="user"?Te.message.content:void 0,Wa=dt!==void 0&&Te.message.id===Ce.lastId&&!T&&!m&&!g?{turnIndex:Ce.turnIndexById.get(Te.message.id)??0,content:dt}:void 0;return(0,u.jsx)(p6e,{message:Te.message,onLocateBackgroundSource:Te.message.role==="system"&&Te.message.source==="background_notification_turn_started"&&Te.message.backgroundTurn?.toolUseId&&xw(_e,"",Te.message.backgroundTurn.toolUseId)>=0?Vp:void 0,pendingApproval:r,onShowContextDetail:o,onImagePreview:s,onAttachmentPreview:i,onTurnOutputOpen:ie,onInsightReportOpen:l,onEditUserMessage:c&&Wa?()=>c(Wa.turnIndex,Wa.content):void 0,onSubmitUserMessageEdit:d&&Wa?Na=>d(Wa.turnIndex,Na):void 0,workspaceCwd:E,showRetryHint:R,onRetryClick:W,sendFailed:Te.message.role==="user"&&Te.message.id===V,onRetrySend:N,onBranchSession:ne,branchRecordId:an,showAssistantActions:Te.message.role==="assistant"&&dd.has(Te.message.id),showAssistantBranch:Te.message.role==="assistant"&&!T&&an!==void 0,assistantFeedbackTurnId:Ec?on:void 0,assistantFeedbackPromptId:Ec?Bt:void 0,assistantFeedbackRating:Ec&&Bt?Y0[Bt]:void 0,onAssistantFeedbackRate:Np,isLocateFlashing:aF(Te,Gp),assistantTurnFooterInfo:bn,turnSources:on?Rc.get(on):void 0,onSourceOpen:ae,generateContent:$e})};if(dl&&F===IC)return _;if(Ko&&F===Oc)return P;let be=F-tr,Re=Pa[be];return Re?ee(Re):null},[dl,_,Ko,P,Oc,r,p,T,xr,ni,Rp,en,G0,o,_e,Vp,s,i,l,c,d,Ce,m,g,$e,tr,Pa,Gp,dd,Ec,eg,Y0,Np,t,E,R,W,V,N,ne,L9,Me,U,Ee,ie,Rc,ae,Ze]),O9=(0,w.useCallback)(F=>F?Y7e(F):void 0,[]),D9=ri?Id:e;return(0,w.useLayoutEffect)(()=>{if(p)return;let F=hd.current;if(hn.current&&!F){$.current||($r.current=!0);return}yb.current&&!F||(ul.current||F||!$.current)&&($.current||qt(!0),ja(F?"smooth":"auto"),hd.current=!1)},[D9,jp,p,ja,qt]),(0,w.useLayoutEffect)(()=>{er()},[D9,er,jp]),(0,u.jsxs)("div",{ref:Ma,className:k6(Mt.list,dl&&A?Mt.listWithWelcomeHeader:void 0),"data-web-shell-message-list":!0,onClickCapture:bU,children:[Sd&&(0,u.jsx)(n8e,{label:yt("editor.sessionLoading")}),h&&!Sd&&!mU&&(0,u.jsx)("div",{className:Mt.historyStatus,role:"status",children:yt("history.loadingEarlier")}),g&&!Sd&&(0,u.jsx)("div",{className:Mt.historyStatus,role:"status",children:yt("history.capacityReached")}),b&&!Sd&&!g&&(0,u.jsxs)("div",{className:Mt.historyStatus,children:[(0,u.jsx)("span",{role:"status",children:yt("history.paginationError")}),v&&(0,u.jsx)("button",{type:"button",className:Mt.historyRetryButton,onClick:SU,children:yt("history.retry")})]}),(0,u.jsx)(e8e,{entries:Lc,currentTurnId:Z0,currentRange:Mp,hidden:!_c||!yU,onSelect:Vp}),ri?(0,u.jsx)("div",{ref:Qo.containerRef,className:Mt.virtualSizer,children:E9.map(F=>(0,u.jsx)("div",{"data-index":F.index,ref:xU,className:k6(Mt.virtualRow,O9(Pa[F.index-tr])),"data-message-row-key":String(Dc(F.index)),"data-source-block-ids":rF(Pa[F.index-tr],e),"data-web-shell-message-row":!0,style:{position:"absolute",top:0,left:0,right:0},children:N9(F.index)},F.key))}):Array.from({length:jp},(F,ee)=>{let be=Dc(ee),Re=Pa[ee-tr];return(0,u.jsx)("div",{"data-index":ee,className:O9(Re),"data-message-row-key":String(be),"data-source-block-ids":rF(Re,e),"data-web-shell-message-row":!0,children:N9(ee)},be)})]})})),lF={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"}},r8e={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},o8e={margin:0,fontSize:"1rem",fontWeight:600},s8e={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},i8e={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 l8e({error:e,onRetry:t,language:n="en",retryMode:a="reset"}){let r=lF[n]??lF.en;return(0,u.jsxs)("div",{role:"alert",style:r8e,"data-web-shell-error":!0,children:[(0,u.jsx)("p",{style:o8e,children:r.title}),(0,u.jsx)("p",{style:s8e,children:r.body}),!1,(0,u.jsx)("button",{type:"button",style:i8e,onClick:t,children:a==="reload"?r.reload:r.retry})]})}function c8e(e,t,n=!1){return rhe(e,{safeToolProjection:n,includeSourceIdentity:!0,labels:{promptCancelled:t("request.cancelled"),branchSuccess:a=>t("branch.success",{name:a}),modelStreamInterrupted:t("error.modelStreamInterrupted"),loopDetected:t("error.loopDetected")}})}var u8e="_app_lcwch_1",d8e="_appChat_lcwch_66",f8e="_content_lcwch_119",p8e="_themeDark_lcwch_437",m8e="_themeLight_lcwch_511",h8e="_contentHasMessages_lcwch_593",gp={app:u8e,appChat:d8e,content:f8e,themeDark:p8e,themeLight:m8e,contentHasMessages:h8e},g8e=1e3,v8e=40;function iU(e){if(e!==void 0)return p$(e);if(typeof window>"u")return"en";let t=new URLSearchParams(window.location.search);return p$(t.get("language")??t.get("lang")??navigator.language)}function y8e(e){let t=`${typeof e=="number"&&Number.isFinite(e)&&e>0?e:g8e}px`,n=`calc(${t} + ${v8e}px)`;return{"--chat-regular-content-width":t,"--chat-regular-shell-width":n,"--chat-content-width":t,"--chat-shell-width":n}}function w8e({blocks:e,renderMode:t="readonly",theme:n=m0.Dark,language:a,className:r,style:o,chatMaxWidth:s,workspaceCwd:i="",compactThinking:l=!1,documentExpanded:c=!0,collapseCompletedTurns:d,markdownTableMode:f="basic",virtualScrollThreshold:p,markdown:m,sourceSessionId:h,sources:g,sourceAttachments:b,sourceReferences:v,getAssistantSourcesIcon:y,onSourceOpen:k,composerTagIcons:I,artifact:T,renderToolHeaderExtra:L,parseUserMessageContent:S,renderUserMessageContent:_,renderComposerTag:A,renderComposerTagTooltip:E,renderAssistantTurnFooter:P,mcpAppBaseUrl:D}){let B=t==="document",z=!B&&(d??!0),Z=B?"basic":f,G=iU(a),te=(0,w.useMemo)(()=>hF(G),[G]),j=(0,w.useMemo)(()=>c8e(e,te,B),[e,B,te]),J=(0,w.useMemo)(()=>Ioe(g??[],b??[]),[g,b]),R=(0,w.useMemo)(()=>qme(j),[j]),W=(0,w.useMemo)(()=>Ome(j),[j]),V=(0,w.useMemo)(()=>({artifact:T,composerTagIcons:I,renderToolHeaderExtra:L,parseUserMessageContent:S,renderUserMessageContent:_,renderComposerTag:A,renderComposerTagTooltip:E,renderAssistantTurnFooter:P,compactThinking:l,collapseCompletedTurns:z,markdownTableMode:Z,markdown:m,sourceReferences:v,getAssistantSourcesIcon:y}),[T,z,l,I,m,v,y,Z,S,P,A,E,L,_]),N=(0,w.useRef)(null),[ne,fe]=(0,w.useState)(null),le=(0,w.useRef)(new Set),X=[gp.app,gp.appChat,n===m0.Light?gp.themeLight:gp.themeDark,n===m0.Dark?"dark":void 0,r].filter(Boolean).join(" "),se=(0,w.useMemo)(()=>({...o,...y8e(s)}),[s,o]);return(0,w.useLayoutEffect)(()=>{if(typeof document>"u")return;let ce=document.createElement("div");return ce.dataset.webShellPortalRoot="",ce.dataset.webShellShadcn="",document.body.appendChild(ce),fe(ce),()=>{ce.remove(),fe(null)}},[]),(0,w.useLayoutEffect)(()=>{let ce=N.current;if(!ce||!ne)return;let ae=null,pe=()=>{ae=null;let ie=getComputedStyle(ce),Ze=new Set;ne.dataset.webShellShadcn="",ne.classList.toggle("dark",n===m0.Dark),ne.lang=G;for(let $e=0;$e<ie.length;$e+=1){let at=ie[$e];at.startsWith("--")&&(Ze.add(at),ne.style.setProperty(at,ie.getPropertyValue(at)))}for(let $e of le.current)Ze.has($e)||ne.style.removeProperty($e);le.current=Ze},Ee=()=>{ae===null&&(ae=requestAnimationFrame(pe))};pe();let Me=new MutationObserver(Ee),U=ce;for(;U;)Me.observe(U,{attributes:!0,attributeFilter:["class","style","data-theme","lang"]}),U=U.parentElement;return window.addEventListener("resize",Ee),()=>{Me.disconnect(),window.removeEventListener("resize",Ee),ae!==null&&cancelAnimationFrame(ae)}},[ne,G,X,se,n]),(0,u.jsx)(gie,{value:n,children:(0,u.jsx)(nse,{language:G,children:(0,u.jsx)(Bq.Provider,{value:D,children:(0,u.jsx)(gF.Provider,{value:ne,children:(0,u.jsx)(ase,{value:t,children:(0,u.jsx)(rse,{value:c,children:(0,u.jsx)(Eoe,{value:V,children:(0,u.jsx)(Aoe,{timeline:W,details:R,children:(0,u.jsx)(x6.Provider,{value:!1,children:(0,u.jsx)("div",{ref:N,className:X,style:se,"data-web-shell-root":!0,"data-web-shell-shadcn":!0,"data-transcript-render-mode":t,"data-document-expanded":B?String(c):void 0,lang:G,children:(0,u.jsx)("div",{className:`${gp.content} ${gp.contentHasMessages}`,children:(0,u.jsx)(a8e,{messages:j,sourceSessionId:h,sourceEntries:B?void 0:J,onSourceOpen:k,pendingApproval:null,isResponding:!1,workspaceCwd:i,virtualScrollThreshold:B?Number.MAX_SAFE_INTEGER:p,hideSessionTimeline:B})})})})})})})})})})})})}function lU(e){let t=iU(e.language);return(0,u.jsx)(ed,{label:"web-shell-transcript-root",resetKeys:[e.blocks,t],fallback:(n,a)=>(0,u.jsx)(l8e,{error:n,onRetry:a,language:t}),children:(0,u.jsx)(w8e,{...e})})}var vt=Ue(la(),1),dU="qwen-export-theme";function id(e){return e===void 0||typeof e=="string"}function ld(e){return e===void 0||typeof e=="number"&&Number.isFinite(e)&&e>=0}function b8e(){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 n=JSON.parse(t);if(n.schemaVersion!==1||n.rendererVersion!=="1.0.1+014ed3c257160dd2"||!Array.isArray(n.blocks)||n.blocks.length>1e3||!n.metadata||typeof n.metadata!="object"||Array.isArray(n.metadata)||!id(n.metadata.title)||!id(n.metadata.startedAt)||!id(n.metadata.projectName)||!id(n.metadata.repository)||!id(n.metadata.gitBranch)||!id(n.metadata.model)||!id(n.metadata.channel)||!ld(n.metadata.promptCount)||!ld(n.metadata.contextUsagePercent)||!ld(n.metadata.contextWindowSize)||!ld(n.metadata.totalTokens)||!ld(n.metadata.filesWritten)||!ld(n.metadata.linesAdded)||!ld(n.metadata.linesRemoved)||typeof n.metadata.exportedAt!="string"||typeof n.metadata.complete!="boolean"||typeof n.metadata.truncated!="boolean")throw new Error("Transcript document is incompatible with this renderer.");return n}function k8e(){try{let e=localStorage.getItem(dU);if(e==="light"||e==="dark")return e}catch{}return"dark"}function cU(e){if(!e)return;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function x8e(e){if(e!==void 0)return e>=1e6?`${e/1e6}m`:e>=1e3?`${e/1e3}k`:String(e)}function eo({label:e,value:t}){return t===void 0||t===""?null:(0,vt.jsxs)("div",{className:"document-metadata-item",children:[(0,vt.jsx)("dt",{children:e}),(0,vt.jsx)("dd",{children:t})]})}function S8e({metadata:e}){let t=e.contextUsagePercent===void 0?void 0:`${e.contextUsagePercent>100?">100":e.contextUsagePercent}%${e.contextWindowSize===void 0?"":` of ${x8e(e.contextWindowSize)}`}`;return(0,vt.jsxs)("aside",{className:"document-metadata","data-document-metadata":!0,children:[(0,vt.jsxs)("section",{children:[(0,vt.jsx)("h2",{children:"Session Info"}),(0,vt.jsxs)("dl",{children:[(0,vt.jsx)(eo,{label:"Session",value:e.title??"Ziroo Chat Export"}),(0,vt.jsx)(eo,{label:"Started",value:cU(e.startedAt)}),(0,vt.jsx)(eo,{label:"Exported",value:cU(e.exportedAt)}),(0,vt.jsx)(eo,{label:"Project",value:e.projectName}),(0,vt.jsx)(eo,{label:"Repository",value:e.repository}),(0,vt.jsx)(eo,{label:"Branch",value:e.gitBranch}),(0,vt.jsx)(eo,{label:"Model",value:e.model}),(0,vt.jsx)(eo,{label:"Channel",value:e.channel})]})]}),(0,vt.jsxs)("section",{children:[(0,vt.jsx)("h2",{children:"Statistics"}),(0,vt.jsxs)("dl",{children:[(0,vt.jsx)(eo,{label:"Prompts",value:e.promptCount}),(0,vt.jsx)(eo,{label:"Context Usage",value:t}),(0,vt.jsx)(eo,{label:"Tokens",value:e.totalTokens?.toLocaleString()})]})]}),(0,vt.jsxs)("section",{children:[(0,vt.jsx)("h2",{children:"File Operations"}),(0,vt.jsxs)("dl",{children:[(0,vt.jsx)(eo,{label:"Files modified",value:e.filesWritten}),(0,vt.jsx)(eo,{label:"Lines added",value:e.linesAdded}),(0,vt.jsx)(eo,{label:"Lines removed",value:e.linesRemoved})]})]})]})}function C8e({value:e}){let[t,n]=(0,to.useState)(k8e),[a,r]=(0,to.useState)(!0),o=(0,to.useRef)(a),s=(0,to.useRef)(null);return(0,to.useEffect)(()=>{document.documentElement.classList.toggle("dark",t==="dark"),document.documentElement.classList.toggle("light",t==="light");try{localStorage.setItem(dU,t)}catch{}},[t]),(0,to.useEffect)(()=>{o.current=a},[a]),(0,to.useEffect)(()=>{let i=()=>{s.current=o.current,(0,b9.flushSync)(()=>r(!0))},l=()=>{let c=s.current;s.current=null,c!==null&&(0,b9.flushSync)(()=>r(c))};return addEventListener("beforeprint",i),addEventListener("afterprint",l),()=>{removeEventListener("beforeprint",i),removeEventListener("afterprint",l)}},[]),(0,to.useEffect)(()=>{document.title=e.metadata.title||"Ziroo Chat Export",requestAnimationFrame(()=>{document.body.dataset.renderComplete="true"})},[e.metadata.title]),(0,vt.jsxs)("main",{className:"document-shell",children:[(0,vt.jsxs)("header",{className:"document-header",children:[(0,vt.jsxs)("div",{children:[(0,vt.jsx)("h1",{children:e.metadata.title||"Ziroo Chat Export"}),(0,vt.jsx)("p",{children:e.metadata.startedAt?`Started ${e.metadata.startedAt}`:`Exported ${e.metadata.exportedAt}`})]}),(!e.metadata.complete||e.metadata.truncated)&&(0,vt.jsx)("span",{className:"document-warning",children:"Partial export"}),(0,vt.jsxs)("div",{className:"document-actions","aria-label":"Document controls",children:[(0,vt.jsx)("button",{type:"button","data-document-expand-all":!0,disabled:a,onClick:()=>r(!0),children:"Expand all"}),(0,vt.jsx)("button",{type:"button","data-document-collapse-all":!0,disabled:!a,onClick:()=>r(!1),children:"Collapse all"}),(0,vt.jsx)("button",{type:"button","data-document-theme-toggle":!0,"aria-label":`Switch to ${t==="dark"?"light":"dark"} theme`,onClick:()=>n(i=>i==="dark"?"light":"dark"),children:t==="dark"?"Light theme":"Dark theme"})]})]}),(0,vt.jsxs)("div",{className:"document-content",children:[(0,vt.jsx)("div",{className:"document-transcript",children:(0,vt.jsx)(lU,{blocks:e.blocks,renderMode:"document",compactThinking:!0,documentExpanded:a,theme:t})}),(0,vt.jsx)(S8e,{metadata:e.metadata})]})]})}function fU(){return(0,to.useEffect)(()=>{document.body.dataset.renderComplete="error"},[]),(0,vt.jsxs)("main",{className:"document-error",role:"alert",children:[(0,vt.jsx)("h1",{children:"Unable to open this chat export"}),(0,vt.jsx)("p",{children:"The file is incomplete or uses an incompatible renderer version."})]})}var k9=class extends to.Component{constructor(){super(...arguments);this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,vt.jsx)(fU,{}):this.props.children}},pU=document.getElementById("app");if(!pU)throw new Error("Transcript document root is missing.");if(document.body.dataset.renderComplete!=="error"){let e=(0,uU.createRoot)(pU);try{e.render((0,vt.jsx)(k9,{children:(0,vt.jsx)(C8e,{value:b8e()})}))}catch{e.render((0,vt.jsx)(fU,{}))}}})();
|
|
625
|
+
`)}function wCe(e){return e.find(t=>wa(t.status))??e[e.length-1]}function bCe(e,t,n,a=!1){if(T6(e)){let o=e.filter(i=>wa(i.status)&&!xs(i));if(o.length===0)return t("subagent.background");if(o.length===1&&Wo(o[0].toolName))return t("toolGroup.summary.provideInformation");let s=o.map(i=>Wo(i.toolName)?t("toolGroup.summary.provideInformation"):Uq(i,t,n));return t("toolGroup.running",{name:s.join(" \xB7 "),count:o.length})}return xCe(e,t,a)||t("toolGroup.summary",{count:e.length})}function Uq(e,t,n){if(od(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if(Wo(e.toolName))return wa(e.status)?t("toolGroup.summary.provideInformation"):t("toolGroup.summary.askedQuestions",{count:jq(e)});let{displayName:a,description:r,hideDisplayName:o}=Hq(e,t,n);return[o?"":a,r].filter(Boolean).join(" ")}function Hq(e,t,n){let a=Cc(e.toolName,t),r=ya(JF(e,n),120);return{kind:Xw(e),tool:e,displayName:a,description:r,elapsed:"",workspaceCwd:n,hideDisplayName:!!Hde(e)}}function kCe({tool:e,workspaceCwd:t}){let{t:n}=nt(),a=Wo(e.toolName),r=wa(e.status),o=xs(e),s=r&&!o&&kr(e),i=ab(s),l=!a&&r?o?n("subagent.background"):n("toolGroup.runningPrefix").trim():"";if(od(e.toolName)||a)return(0,u.jsxs)(u.Fragment,{children:[l&&(0,u.jsxs)("span",{children:[l," "]}),Uq(e,n,t)]});let c=Hq(e,n,t),d=s?az(e,n):"",f=s?{...c,description:[c.description,d&&`(${d})`].filter(Boolean).join(" "),elapsed:qq(e,i).elapsed}:c;return(0,u.jsxs)(u.Fragment,{children:[l&&(0,u.jsxs)("span",{children:[l," "]}),(0,u.jsxs)("span",{className:he.chatSummaryInline,children:[!f.hideDisplayName&&(0,u.jsx)("span",{className:he.lineName,children:f.displayName}),(0,u.jsx)(y0,{info:f})]})]})}function xCe(e,t,n){let a=n?e.filter(kr).length:0;if(a>0){let f=e.length-a;return[t("toolGroup.summary.ranAgents",{count:a}),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();ks(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++:od(p)?l++:Wo(p)?c+=jq(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 jq(e){let t=e.args?.questions;return Array.isArray(t)&&t.length>0?t.length:1}function SCe(){return(0,u.jsxs)("svg",{className:he.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 Wq(){return(0,u.jsxs)("svg",{className:he.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 CCe(){return(0,u.jsxs)("svg",{className:he.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 TCe(){return(0,u.jsxs)("svg",{className:he.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 ICe(){return(0,u.jsx)("svg",{className:he.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 _Ce(){return(0,u.jsx)("svg",{className:he.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 m6(){return(0,u.jsx)("svg",{className:he.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 Gq({tool:e}){let t=Xw(e);return t==="agent"?(0,u.jsx)(m6,{}):t==="ask"?(0,u.jsx)(_Ce,{}):t==="edit"||t==="write"?(0,u.jsx)(SCe,{}):t==="fetch"?(0,u.jsx)(CCe,{}):t==="read"?(0,u.jsx)(TCe,{}):t==="todo"?(0,u.jsx)(ICe,{}):(0,u.jsx)(Wq,{})}function h6(e){let t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}function LCe(e,t){if(e.approval?.id!==t.approval?.id||e.workspaceCwd!==t.workspaceCwd||e.onTurnOutputOpen!==t.onTurnOutputOpen||e.summaryOnly!==t.summaryOnly||e.forceExpanded!==t.forceExpanded||e.detailsVisible!==t.detailsVisible||e.hideHeader!==t.hideHeader||e.hideCollapsedOutput!==t.hideCollapsedOutput)return!1;let n=e.tool,a=t.tool;return n.callId===a.callId&&n.toolName===a.toolName&&n.status===a.status&&n.subagentSessionReady===a.subagentSessionReady&&n.startTime===a.startTime&&n.endTime===a.endTime&&n.subContent===a.subContent&&n.rawOutput===a.rawOutput&&n.args===a.args&&n.content===a.content&&n.locations===a.locations&&n.title===a.title&&ACe(n.subTools,a.subTools)}function ACe(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let a=e[n],r=t[n];if(a.callId!==r.callId||a.toolName!==r.toolName||a.status!==r.status||a.subagentSessionReady!==r.subagentSessionReady||a.endTime!==r.endTime||a.rawOutput!==r.rawOutput||a.args!==r.args||a.subContent!==r.subContent||a.title!==r.title)return!1}return!0}var jB=/\[([^\]]+)\]\(qwen-session:\/\/([^)]+)\)/g;function wC(e,t){if(!e||!e.includes("qwen-session://"))return e;let n=[],a=0,r;for(jB.lastIndex=0;(r=jB.exec(e))!==null;){r.index>a&&n.push(e.slice(a,r.index));let o=r[2];n.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)),a=r.index+r[0].length}return a<e.length&&n.push(e.slice(a)),n.length===1?n[0]:(0,u.jsx)(u.Fragment,{children:n})}var g6=(0,w.memo)(function({tool:e,approval:t,workspaceCwd:n,onTurnOutputOpen:a,summaryOnly:r=!1,forceExpanded:o=!1,detailsVisible:s=!0,hideHeader:i=!1,hideCollapsedOutput:l=!1}){let{t:c}=nt(),d=_n(),f=eb(),p=Lz(),{hostOwnsEditDiffPreview:m}=Go(),h=p!==void 0,g=_0(e.rawOutput),b=o||!!g,v=t?.toolCallId===e.callId,y=!!(m&&v&&t?.hasDiffPreview&&Lw(t?.toolName??e.toolName)),k=y,[I,T]=(0,w.useState)(!1),[L,S]=(0,w.useState)(()=>b||!r&&HB(e)&&!k),_=(0,w.useRef)(null),A=(0,w.useRef)(!1),E=D6(e.toolName);(0,w.useEffect)(()=>{S(b||!r&&HB(e)&&!k),T(!1),_.current=null,A.current=!1},[b,k,h,r,e.callId,e.toolName]);let P=kr(e),D=!v&&t?.toolCallId&&P&&Ss(e,t.toolCallId),B=!!(y||m&&D&&t?.hasDiffPreview&&Lw(t.toolName??"")),z=wa(e.status),Z=z&&!ks(e.toolName)&&!h6(e.toolName)&&!B,G=ab(Z);if((0,w.useEffect)(()=>{!b&&!P&&e.status==="completed"&&!A.current&&S(!1)},[b,P,e.status]),P){let ye=qq(e,G),We=ye.explicitAgentType?`${c("agent.label")} (${N0(ye.explicitAgentType,c)})`:c("agent.label"),Q=e.status==="completed"||e.status==="failed",me=xs(e),ve=[me&&!Q?c("subagent.background"):e.status==="pending"?c("subagent.pending"):c("subagent.running"),me&&!Q||B?"":ye.elapsed].filter(Boolean).join(" \xB7 "),Ge=[ye.subToolCount>0?c("subagent.toolsCount",{count:ye.subToolCount}):"",ye.elapsed,ye.tokens,ye.reason?ya(ye.reason,80):""].filter(Boolean).join(" \xB7 "),_e=o||L||!!D,He=!!v,ht=ti(e),Vt=(0,u.jsx)(W6,{tool:e,approval:m?t:void 0,hideHeader:!0,defaultExpanded:!0,inline:!0});if(f&&!i){let fn=(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(m6,{}),(0,u.jsx)(xp,{status:Q?ye.status:e.status}),(0,u.jsx)("span",{className:he.lineName,children:We}),(0,u.jsx)(y0,{info:{kind:"agent",tool:e,displayName:We,description:ye.description?ya(ye.description,60):"",elapsed:Q?Ge:ve,workspaceCwd:n}})]});return(0,u.jsx)("div",{className:he.line,"data-transcript-tool-call-id":e.callId,children:He?(0,u.jsx)("div",{className:`${he.lineMain} ${he.lineButton}`,"aria-disabled":"true",children:fn}):(0,u.jsxs)("button",{type:"button",className:`${he.lineMain} ${he.lineExpandable} ${he.lineButton}`,"aria-disabled":!!ht||void 0,title:ht?c(ht):void 0,onClick:()=>{ht||f.onOpen(e)},children:[fn,(0,u.jsx)("span",{className:he.lineChevronRight,"aria-hidden":"true"})]})})}return(0,u.jsxs)("div",{className:he.line,"data-transcript-tool-call-id":e.callId,children:[!i&&(0,u.jsxs)("div",{className:`${he.lineMain} ${He?"":he.lineExpandable}`,"aria-disabled":!!ht||void 0,title:ht?c(ht):void 0,onClick:He||ht?void 0:()=>S(!L),children:[(0,u.jsx)(m6,{}),(0,u.jsx)(xp,{status:Q?ye.status:e.status}),(0,u.jsx)("span",{className:he.lineName,children:We}),(0,u.jsx)(y0,{info:{kind:"agent",tool:e,displayName:We,description:ye.description?ya(ye.description,60):"",elapsed:Q?Ge:ve,workspaceCwd:n}}),!He&&(0,u.jsx)("span",{className:L?he.lineChevronDown:he.lineChevronRight,"aria-hidden":"true"})]}),_e&&(0,u.jsx)("div",{className:he.lineDetail,children:i?(0,u.jsx)("div",{className:he.expandedAgentCard,children:Vt}):Vt})]})}let te=Bw(e,n),j=jde(e),J=ks(e.toolName)?JF(e,n):te,R=Cc(e.toolName,c),W=B||ks(e.toolName)||h6(e.toolName)?"":Tp(e.startTime,z?G:e.endTime),V=e.toolName.toLowerCase(),N=V==="monitor"&&h&&!I&&!i,ne=od(V),fe=ne?uz(e):void 0,le=!!fe&&fe.length>0,X=fe?fe.filter(ye=>ye.status==="completed").length:0,se=ks(V),ce=V==="grep"||V==="grep_search"||V==="search"||V==="glob",ae=V==="read"||V==="read_file"||V==="readfile",pe=s&&(ae||Lw(V)||V==="display_image"||V==="zoom_image")?(0,u.jsx)(KSe,{tool:e,workspaceCwd:n,onOpen:a}):void 0,Ee=!ne&&yCe(J),Me=!b&&!k,U=N||Me,ie=()=>{A.current=!0,S(ye=>!ye)},Ze=()=>{T(!0),Me&&ie()},$e=()=>{p&&zq(_,()=>p.onOpen(e),Ze)},at=QSe(e),rt=L&&Ee,yt=ae,en=rt&&!se&&!ce&&!ae,K=te,Ce=L&&!at&&(!ne||!le&&!j);return(0,u.jsxs)("div",{className:he.line,"data-transcript-tool-call-id":e.callId,children:[i&&z&&W&&(0,u.jsx)("div",{className:he.lineMain,children:(0,u.jsx)(y0,{info:{kind:Xw(e),tool:e,displayName:R,description:"",elapsed:W,workspaceCwd:n}})}),!i&&(0,u.jsxs)("div",{className:`${he.lineMain} ${U?he.lineExpandable:""}`,title:N?void 0:Me?c(L?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":N?void 0:Me?L:void 0,role:U?"button":void 0,tabIndex:U?0:void 0,onClick:U?()=>{if(N){$e();return}ie()}:void 0,onKeyDown:U?ye=>{if(!(ye.key!=="Enter"&&ye.key!==" ")){if(ye.preventDefault(),N){$e();return}ie()}}:void 0,children:[(0,u.jsx)(Gq,{tool:e}),(0,u.jsx)(xp,{status:e.status}),(0,u.jsx)("span",{className:he.lineName,children:R}),ne&&le&&(0,u.jsxs)("span",{className:he.todoProgress,children:[X,"/",fe.length]}),(0,u.jsx)(y0,{info:{kind:Xw(e),tool:e,displayName:R,description:ne||en?"":J,elapsed:ne?"":W,workspaceCwd:n}}),U&&(0,u.jsx)("span",{className:!N&&L?he.lineChevronDown:he.lineChevronRight,"aria-hidden":"true"})]}),g&&(!r||L)&&(0,u.jsx)(jSe,{display:g}),!g&&(!r||L)&&ne&&le&&(0,u.jsx)(dCe,{tool:e,todos:fe,expanded:L,title:R}),!g&&(!r||L)&&ne&&!le&&j&&(0,u.jsx)("div",{className:he.lineOutput,children:wC(j,d)}),!g&&Ce&&(0,u.jsx)(x0,{title:R,detail:K,status:e.status,action:pe,children:j&&(0,u.jsx)("div",{className:`${he.lineOutput} ${he.expandedLineOutput}`,children:wC(j,d)})}),!g&&!ne&&!l&&j&&!Ce&&(!L||!at)&&(!r||L)&&(0,u.jsx)("div",{className:L?`${he.lineOutput} ${he.expandedLineOutput}`:he.lineOutput,children:wC(j,d)}),!g&&!ne&&L&&at&&(!E||s)&&(0,u.jsx)("div",{className:E?`${he.lineDetail} ${he.workflowLineDetail}`:yt?`${he.lineDetail} ${he.markdownLineDetail}`:he.lineDetail,children:E?(0,u.jsx)(fCe,{tool:e,displayName:R,detail:K,result:j}):se?(0,u.jsx)(cke,{tool:e}):ae?(0,u.jsx)(x0,{title:R,status:e.status,action:pe,children:(0,u.jsx)(sCe,{tool:e})}):(0,u.jsxs)(x0,{title:R,detail:K,status:e.status,action:pe,children:[(V==="write_file"||V==="writefile")&&(0,u.jsx)(UB,{tool:e}),(V==="edit"||V==="write"||V==="editfile")&&(0,u.jsx)(UB,{tool:e}),Wo(e.toolName)&&(0,u.jsx)(mCe,{tool:e}),$6(V)&&(0,u.jsx)(hCe,{tool:e})]})})]})},LCe),ECe=(0,w.memo)(function({isStreaming:e,expanded:t,documentMode:n,translateContent:a,generateContent:r,onToggle:o}){let{language:s,t:i}=nt();return(0,u.jsxs)("div",{className:`${he.chatSummaryThoughtHeader}${t?` ${he.chatSummaryThoughtHeaderExpanded}`:""}`,onClick:l=>{!n&&l.currentTarget.contains(l.target)&&o()},children:[(0,u.jsxs)("button",{type:"button",disabled:n,tabIndex:n?-1:void 0,className:he.chatSummaryThoughtSummary,"data-testid":"compact-thinking-summary","aria-expanded":n?void 0:t,title:n?void 0:i(t?"thinking.collapse":"thinking.expand"),children:[(0,u.jsx)("span",{className:he.chatSummaryThoughtIcon,"aria-hidden":"true",children:(0,u.jsx)(U6,{})}),(0,u.jsx)("span",{className:`${he.chatSummaryThoughtLabel}${e?` ${he.chatSummaryThoughtLabelActive}`:""}`,children:i(e?"thinking.running":"thinking.done")})]}),s==="zh-CN"&&a!==void 0&&r&&(0,u.jsx)(rz,{content:a,generateContent:r,className:he.chatSummaryThoughtTranslate}),(0,u.jsx)("span",{className:t?he.chatSummaryThoughtChevronDown:he.chatSummaryThoughtChevronRight,"aria-hidden":"true"})]})}),bC=(0,w.memo)(function({content:e,isStreaming:t,generateContent:n}){let a=_n()==="document",r=Zw(),[o,s]=(0,w.useState)(!1),i=a?r:o,l=(0,w.useCallback)(()=>{a||s(c=>!c)},[a]);return(0,u.jsxs)("div",{className:he.chatSummaryThought,children:[(0,u.jsx)(ECe,{isStreaming:t,expanded:i,documentMode:a,translateContent:a||t?void 0:e,generateContent:n,onToggle:l}),i&&(0,u.jsx)("div",{className:he.chatSummaryThoughtContent,children:(0,u.jsx)(rl,{content:e,source:"thinking",isStreaming:t})})]})}),RCe=(0,w.memo)(function({tools:e,compactSummary:t=!1,thoughts:n,pendingApproval:a,workspaceCwd:r,onTurnOutputOpen:o,isLocateFlashing:s=!1,generateContent:i}){let{t:l}=nt(),c=_n()==="document",d=Zw(),f=eb(),p=Lz(),m=p!==void 0,[h,g]=(0,w.useState)(!1),[b,v]=(0,w.useState)(!1),y=c?d:b,k=(0,w.useRef)(null),I=T6(e),T=e.find(le=>wa(le.status)&&!xs(le))??(e.length>0?wCe(e):void 0),L=e.length===1?e[0]:void 0,S=!!n?.length,_=L&&kr(L)?L:void 0,A=L&&L.toolName.toLowerCase()==="monitor"?L:void 0,E=(L?_0(L.rawOutput):void 0)?.resourceUri,P=e.some(le=>_0(le.rawOutput)),D=e.some(le=>D6(le.toolName)),B=e.some(le=>wa(le.status)&&!xs(le)),z=n?.find(le=>le.isStreaming),Z=I&&B?!0:z!==void 0,G=!Z&&e.some(le=>wa(le.status)&&xs(le)),te=!!(!t&&_&&f),j=!!(!t&&A&&m&&!h),J=te||j,R=!t&&_?ti(_):void 0,W=I?T??e[0]:e[0],V=a?.toolCallId&&e.some(le=>Ss(le,a.toolCallId)),N=new Map,ne=new Set;for(let le=0;t&&le<e.length;le++){if(!kr(e[le]))continue;let X=le+1;for(;X<e.length&&kr(e[X]);)X++;if(X-le>=2){let se=e.slice(le,X);N.set(se[0].callId,se);for(let ce of se.slice(1))ne.add(ce.callId)}le=X-1}(0,w.useEffect)(()=>{g(!1),v(!1),k.current=null},[m,A?.callId]),(0,w.useEffect)(()=>{(E||P)&&v(!0)},[E,P]);let fe=()=>{!A||!p||zq(k,()=>p.onOpen(A),()=>{g(!0),v(le=>!le)})};return V?(0,u.jsx)("div",{className:`${he.group}${s?` ${ol.flash}`:""}`,children:e.map(le=>(0,u.jsx)(g6,{tool:le,approval:a,workspaceCwd:r,onTurnOutputOpen:o,forceExpanded:c},le.callId))}):(0,u.jsxs)("div",{className:s?ol.flash:void 0,children:[(0,u.jsxs)("button",{type:"button",disabled:c,"aria-disabled":!!R||void 0,tabIndex:c?-1:void 0,className:he.chatSummary,onClick:()=>{if(!(c||R)){if(te&&_&&f){f.onOpen(_);return}if(j&&A&&p){fe();return}v(le=>!le)}},"aria-expanded":c||J?void 0:b,title:R?l(R):c||J?void 0:l(y?"tool.collapseHint":"tool.expand"),children:[(0,u.jsx)("span",{className:G?`${he.chatSummaryIcon} ${he.chatSummaryIconDetached}`:he.chatSummaryIcon,"aria-hidden":"true",children:z?(0,u.jsx)(U6,{}):W?(0,u.jsx)(Gq,{tool:W}):(0,u.jsx)(Wq,{})}),(0,u.jsx)("span",{className:Z?`${he.chatSummaryText} ${he.chatSummaryTextActive}`:he.chatSummaryText,children:z?l("thinking.running"):L?(0,u.jsx)(kCe,{tool:L,workspaceCwd:r}):bCe(e,l,r,t)}),(0,u.jsx)("span",{className:y?he.chatChevronDown:he.chatChevronRight,"aria-hidden":"true"})]}),(y||P||D)&&(0,u.jsx)("div",{"aria-hidden":!y,ref:le=>{le?.toggleAttribute("inert",!y)},className:y?he.chatSummaryContentClip:`${he.chatSummaryContentClip} ${he.chatSummaryContentCollapsed}`,style:!y&&P&&!D?{display:"none"}:void 0,children:(0,u.jsx)("div",{className:he.chatSummaryContentInner,children:(0,u.jsxs)("div",{className:`${he.group} ${he.chatSummaryGroup}`,children:[e.map(le=>{if(ne.has(le.callId))return null;let X=N.get(le.callId);return(0,u.jsxs)(w.Fragment,{children:[n?.filter(se=>se.beforeToolCallId===le.callId).map((se,ce)=>(0,u.jsx)(bC,{content:se.content,isStreaming:se.isStreaming,generateContent:i},`thought-${le.callId}-${ce}`)),X?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{className:he.chatSummaryParallelAgents,"data-testid":"compact-parallel-agents",children:(0,u.jsx)(Iz,{agents:X,pendingApproval:a})}),X.slice(1).flatMap(se=>n?.filter(ce=>ce.beforeToolCallId===se.callId).map((ce,ae)=>(0,u.jsx)(bC,{content:ce.content,isStreaming:ce.isStreaming,generateContent:i},`thought-${se.callId}-${ae}`)))]}):(0,u.jsx)(g6,{tool:le,approval:a,workspaceCwd:r,onTurnOutputOpen:o,summaryOnly:!L||S,forceExpanded:c||!!L&&!S,detailsVisible:y,hideHeader:!!L&&!S})]},le.callId)}),n?.filter(le=>le.beforeToolCallId===void 0).map((le,X)=>(0,u.jsx)(bC,{content:le.content,isStreaming:le.isStreaming,generateContent:i},`thought-trailing-${X}`))]})})})]})}),w9="summary-",Vq=e=>`${w9}${e}`,Xq=e=>e.startsWith(w9),Zq=e=>Xq(e)?e.slice(w9.length):void 0,MCe="_message_1ujhf_1",PCe="_header_1ujhf_6",NCe="_headerStatic_1ujhf_7",OCe="_chevron_1ujhf_24",DCe="_title_1ujhf_30",$Ce="_progress_1ujhf_39",vc={message:MCe,header:PCe,headerStatic:NCe,chevron:OCe,title:DCe,progress:$Ce};function BCe({id:e,todos:t}){let n=(0,w.useContext)(S6).get(e)?.events??[];return(0,u.jsx)(Az,{todos:t,events:n})}var FCe=(0,w.memo)(function({id:e,todos:t,isLocateFlashing:n=!1}){let{t:a}=nt(),r=_n()==="document",o=Zw(),[s,i]=(0,w.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:`${vc.message}${n?` ${ol.flash}`:""}`,children:[r?(0,u.jsxs)("div",{className:vc.headerStatic,children:[(0,u.jsx)("span",{className:vc.title,children:a("plan.title")}),(0,u.jsxs)("span",{className:vc.progress,children:[d,"/",c]})]}):(0,u.jsxs)("button",{type:"button",className:vc.header,onClick:()=>i(f=>!f),"aria-expanded":s,title:a(s?"todo.collapse":"todo.expand"),children:[(0,u.jsx)("span",{className:vc.chevron,"aria-hidden":"true",children:s?"\u25BE":"\u25B8"}),(0,u.jsx)("span",{className:vc.title,children:a("plan.title")}),(0,u.jsxs)("span",{className:vc.progress,children:[d,"/",c]})]}),l?(0,u.jsx)(Ez,{todos:t,numbered:!0}):(0,u.jsx)(BCe,{id:e,todos:t})]})}),zCe="_message_1abcu_1",qCe="_content_1abcu_11",UCe="_question_1abcu_17",HCe="_prefix_1abcu_24",jCe="_answer_1abcu_28",WCe="_pending_1abcu_32",GCe="_shortcuts_1abcu_36",Vu={message:zCe,content:qCe,question:UCe,prefix:HCe,answer:jCe,pending:WCe,shortcuts:GCe},VCe=(0,w.memo)(function({question:e,answer:t,isPending:n}){let{t:a}=nt();return(0,u.jsxs)("div",{className:Vu.message,children:[(0,u.jsxs)("div",{className:Vu.content,children:[(0,u.jsxs)("div",{className:Vu.question,children:[(0,u.jsx)("span",{className:Vu.prefix,children:"/btw "}),(0,u.jsx)("span",{children:e})]}),(0,u.jsx)("div",{className:Vu.answer,children:n?(0,u.jsx)("span",{className:Vu.pending,children:a("btw.answering")}):(0,u.jsx)(rl,{content:t})})]}),(0,u.jsx)("div",{className:Vu.shortcuts,children:a(n?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),XCe="_message_1g0wi_1",ZCe="_header_1g0wi_21",KCe="_status_1g0wi_30",YCe="_name_1g0wi_35",QCe="_command_1g0wi_42",JCe="_output_1g0wi_51",hp={message:XCe,header:ZCe,status:KCe,name:YCe,command:QCe,output:JCe},e6e=(0,w.memo)(function({command:e,output:t}){let{t:n}=nt();return(0,u.jsxs)("div",{className:hp.message,children:[(0,u.jsxs)("div",{className:hp.header,children:[(0,u.jsx)("span",{className:hp.status,children:"\u2713"}),(0,u.jsx)("span",{className:hp.name,children:n("shell.command")}),e&&(0,u.jsx)("span",{className:hp.command,children:e})]}),t&&(0,u.jsx)("pre",{className:hp.output,children:t})]})}),t6e="_progress_1ik59_1",n6e="_spinner_1ik59_12",a6e="_bar_1ik59_19",r6e="_stage_1ik59_25",o6e="_icon_1ik59_29",s6e="_done_1ik59_35",i6e="_error_1ik59_43",l6e="_detail_1ik59_51",c6e="_path_1ik59_56",u6e="_pathButton_1ik59_61",Aa={progress:t6e,spinner:n6e,bar:a6e,stage:r6e,icon:o6e,done:s6e,error:i6e,detail:l6e,path:c6e,pathButton:u6e},WB=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827"];function d6e({progress:e}){let{stage:t,progress:n,detail:a,isComplete:r,error:o}=e,[s,i]=(0,w.useState)(0),l=30,c=Math.round(n/100*l),d=l-c,f="\u2588".repeat(Math.max(0,c))+"\u2591".repeat(Math.max(0,d));return(0,w.useEffect)(()=>{if(r||o)return;let p=setInterval(()=>{i(m=>(m+1)%WB.length)},120);return()=>clearInterval(p)},[r,o]),o?(0,u.jsxs)("div",{className:`${Aa.progress} ${Aa.error}`,children:[(0,u.jsx)("span",{className:Aa.icon,children:"\u2715"}),(0,u.jsx)("span",{className:Aa.stage,children:t}),(0,u.jsx)("div",{className:Aa.detail,children:o})]}):r?(0,u.jsxs)("div",{className:`${Aa.progress} ${Aa.done}`,children:[(0,u.jsx)("span",{className:Aa.icon,children:"\u2713"}),(0,u.jsx)("span",{className:Aa.stage,children:t})]}):(0,u.jsxs)("div",{className:Aa.progress,children:[(0,u.jsx)("span",{className:Aa.spinner,children:WB[s]}),(0,u.jsx)("span",{className:Aa.bar,children:f}),(0,u.jsxs)("span",{className:Aa.stage,children:[t,a?` (${a})`:""]})]})}function f6e({path:e,onInsightReportOpen:t}){let{t:n}=nt();return(0,u.jsxs)("div",{className:`${Aa.progress} ${Aa.done}`,children:[(0,u.jsx)("span",{className:Aa.icon,children:"\u2713"}),(0,u.jsx)("span",{className:Aa.stage,children:n("insight.ready")}),t?(0,u.jsx)("button",{type:"button",className:`${Aa.path} ${Aa.pathButton}`,onClick:()=>t(e),children:e}):(0,u.jsx)("span",{className:Aa.path,children:e})]})}var p6e=(0,w.memo)(function({message:e,pendingApproval:t,onShowContextDetail:n,onLocateBackgroundSource:a,onImagePreview:r,onAttachmentPreview:o,onTurnOutputOpen:s,onInsightReportOpen:i,workspaceCwd:l,showRetryHint:c=!1,onRetryClick:d,sendFailed:f=!1,onRetrySend:p,onEditUserMessage:m,onSubmitUserMessageEdit:h,onBranchSession:g,branchRecordId:b,showAssistantActions:v=!1,showAssistantBranch:y=!1,assistantFeedbackTurnId:k,assistantFeedbackPromptId:I,assistantFeedbackRating:T,onAssistantFeedbackRate:L,isLocateFlashing:S=!1,assistantTurnFooterInfo:_,turnSources:A,onSourceOpen:E,generateContent:P}){let{t:D}=nt(),[B,z]=(0,w.useState)(!1),[Z,G]=(0,w.useState)(!1),te=(0,w.useCallback)(()=>{m?.()!==!0&&z(!0)},[m]),j=(0,w.useCallback)(()=>{z(!1)},[]),J=(0,w.useCallback)(ce=>{h&&(G(!0),Promise.resolve(h(ce)).catch(()=>!1).then(ae=>{G(!1),ae!==!1&&z(!1)}))},[h]),R=(0,w.useMemo)(()=>g&&b?()=>g(b):void 0,[g,b]),W=(0,w.useMemo)(()=>L&&I?ce=>L(I,k??"",ce):void 0,[L,I,k]),V=(0,w.useContext)(x6),N=e.role==="tool_group"&&e.tools.length===1&&O6(e.tools[0])?e.tools[0]:void 0,ne=N?Ude(N):null,fe=!!ne||e.role==="user"||e.role==="system"&&e.source==="mid_turn_message_injected",le=(()=>{switch(e.role){case"user":return(0,u.jsx)(KF,{content:e.content,images:e.images,files:e.files,inputAnnotations:e.inputAnnotations,isLocateFlashing:S,sendFailed:f,onRetrySend:p,editing:B,submittingEdit:Z,onEditSubmit:J,onEditCancel:j,onImagePreview:r,onAttachmentPreview:o});case"assistant":return(0,u.jsx)(Nfe,{content:e.content,isStreaming:e.isStreaming,timestamp:e.timestamp,onBranchSession:R,showFooterActions:v,showBranchAction:y,showAssistantFeedback:I!==void 0,assistantFeedbackRating:T,onAssistantFeedbackRate:W,isLocateFlashing:S,customFooterInfo:_,turnSources:A,onSourceOpen:E});case"thinking":return(0,u.jsx)(zfe,{content:e.content,isStreaming:e.isStreaming,timestamp:e.timestamp,isLocateFlashing:S,generateContent:P});case"tool_group":return N&&!ne&&!Lp(N)?.trim()?null:ne&&N?!ne.answers.length&&!ne.text.trim()?null:(0,u.jsx)(Fde,{tool:N,result:ne,isLocateFlashing:S}):(0,u.jsx)(RCe,{tools:e.tools,onTurnOutputOpen:s,thoughts:e.thoughts,compactSummary:V&&Xq(e.id),pendingApproval:t,workspaceCwd:l,isLocateFlashing:S,generateContent:P});case"plan":return(0,u.jsx)(FCe,{id:e.id,todos:e.todos,isLocateFlashing:S});case"system":return(0,u.jsx)(Mye,{content:e.content,variant:e.variant,source:e.source,data:e.data,images:e.images,files:e.files,onShowContextDetail:n,onLocateBackgroundSource:a,onImagePreview:r,onAttachmentPreview:o,showRetryHint:c&&e.retryable===!0,onRetryClick:d});case"user_shell":return(0,u.jsx)(e6e,{command:e.command,output:e.output});case"btw":return(0,u.jsx)(VCe,{question:e.question,answer:e.answer,isPending:e.isPending});case"insight_progress":return(0,u.jsx)(d6e,{progress:{stage:e.stage,progress:e.progress,detail:e.detail}});case"insight_ready":return(0,u.jsx)(f6e,{path:e.path,onInsightReportOpen:i});case"insight_error":return(0,u.jsx)("div",{style:{color:"var(--error-color, #e06c75)"},children:e.error});default:return null}})();if(le===null)return null;let X=(0,u.jsx)(ed,{label:`message:${e.role}`,resetKeys:[e],fallback:(0,u.jsx)(m6e,{align:fe?"end":"start"}),children:le}),se=(0,u.jsx)("div",{"data-user-selectable":"true",style:{display:"contents"},children:X});return e.role==="assistant"?v?se:(0,u.jsx)(RC,{timestamp:e.timestamp,children:se}):e.role==="system"&&e.source==="prompt_cancelled"?se:(0,u.jsx)(RC,{timestamp:e.timestamp,hideTimestamp:e.role==="system"&&(e.source==="background_task_completed"||e.source==="background_notification_turn_started"),chatMode:fe,toolGroupSpacing:e.role==="tool_group"&&V,copyText:fe&&"content"in e?e.content:void 0,copyTitle:D("common.copy"),onEdit:m&&!B?te:void 0,editTitle:D("userMessage.edit"),children:se})},h6e);function m6e({align:e}){let{t}=nt();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 h6e(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.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||!g6e(e.assistantTurnFooterInfo,t.assistantTurnFooterInfo)?!1:v6e(e.message,t.message)}function g6e(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 v6e(e,t){if(e===t)return!0;if(e.id!==t.id||e.role!==t.role||e.timestamp!==t.timestamp)return!1;switch(e.role){case"user":return t.role==="user"&&e.content===t.content&&VB(e.images,t.images);case"assistant":return t.role==="assistant"&&e.content===t.content&&e.isStreaming===t.isStreaming;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&&VB(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"&&y6e(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&w6e(e.thoughts,t.thoughts)&&e.tools.length===t.tools.length&&e.tools.every((n,a)=>Kq(n,t.tools[a]));default:return!1}}function y6e(e,t){return e.length===t.length&&e.every((n,a)=>{let r=t[a];return r&&n.id===r.id&&n.content===r.content&&n.status===r.status&&n.priority===r.priority})}function Kq(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&&yc(e.args)===yc(t.args)&&yc(e.rawOutput)===yc(t.rawOutput)&&yc(e.locations)===yc(t.locations)&&yc(e.content)===yc(t.content)&&b6e(e.subTools,t.subTools):!1}function w6e(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,a)=>n.content===t[a]?.content&&n.isStreaming===t[a]?.isStreaming&&n.beforeToolCallId===t[a]?.beforeToolCallId)}function b6e(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((n,a)=>Kq(n,t[a]))}var GB=new WeakMap;function VB(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,a)=>n.data===t[a].data&&n.mimeType===t[a].mimeType)}function yc(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=GB.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return GB.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}function XB({additions:e,deletions:t,className:n,additionsClassName:a,deletionsClassName:r}){return e===void 0||t===void 0?null:(0,u.jsxs)("span",{className:n,children:[(0,u.jsxs)("span",{className:a,children:["+",e]}),(0,u.jsxs)("span",{className:r,children:["-",t]})]})}function k6e(e){if(!e.some(t=>t.additions===void 0||t.deletions===void 0))return e.reduce((t,n)=>({additions:t.additions+(n.additions??0),deletions:t.deletions+(n.deletions??0)}),{additions:0,deletions:0})}var x6e="_root_n9pre_1",S6e="_card_n9pre_7",C6e="_summary_n9pre_14",T6e="_icon_n9pre_22",I6e="_iconSvg_n9pre_33",_6e="_title_n9pre_39",L6e="_reviewSummary_n9pre_46",A6e="_reviewSummaryWithStats_n9pre_53",E6e="_reviewMeta_n9pre_58",R6e="_linkButton_n9pre_65",M6e="_reviewButton_n9pre_66",P6e="_showMoreButton_n9pre_67",N6e="_actions_n9pre_96",O6e="_openButtonWrapper_n9pre_102",D6e="_list_n9pre_126",$6e="_fileRow_n9pre_133",B6e="_path_n9pre_153",F6e="_lineStats_n9pre_162",z6e="_additions_n9pre_171",q6e="_deletions_n9pre_175",U6e="_chevronIcon_n9pre_189",H6e="_chevronIconOpen_n9pre_197",j6e="_artifactInfo_n9pre_201",W6e="_artifactMeta_n9pre_206",Ct={root:x6e,card:S6e,summary:C6e,icon:T6e,iconSvg:I6e,title:_6e,reviewSummary:L6e,reviewSummaryWithStats:A6e,reviewMeta:E6e,linkButton:R6e,reviewButton:M6e,showMoreButton:P6e,actions:N6e,openButtonWrapper:O6e,list:D6e,fileRow:$6e,path:B6e,lineStats:F6e,additions:z6e,deletions:q6e,chevronIcon:U6e,chevronIconOpen:H6e,artifactInfo:j6e,artifactMeta:W6e},v6=3;function ZB(e,t){return t?e:e.slice(0,v6)}function G6e({turnId:e,changes:t,artifacts:n,scheduledTasks:a,workspaceCwd:r,onOpenRequest:o,onReviewChanges:s,onOpenArtifact:i,onOpenScheduledTask:l,onError:c}){let{t:d}=nt(),f=Fq(r),p=f?.actions,[m,h]=(0,w.useState)(!1),[g,b]=(0,w.useState)(!1);if(t.length===0&&n.length===0&&a.length===0)return null;let v=ZB(t,m),y=t.length-v6,k=ZB(n,g),I=n.length-v6,T=k6e(t),L=A=>{if(o){o({id:"review",kind:"review",title:d("turnOutputs.review"),turnId:e,changes:t,...r?{workspaceCwd:r}:{},...f?.workspaceId?{workspaceId:f.workspaceId}:{},...A?{selectedPath:A}:{}});return}s(t,A)},S=A=>{let E=Y6e(A,t,r);if(o){o({id:`artifact:${A.id}`,kind:"artifact",title:A.title??"Artifact",turnId:e,artifactId:A.id,...A.managedId?{managedId:A.managedId}:{},artifact:A,...r?{workspaceCwd:r}:{},...f?.workspaceId?{workspaceId:f.workspaceId}:{},...E!==void 0?{previewContent:E}:{}});return}i(A.id,E)},_=A=>{if(o){o({id:`scheduled-task:${A.toolCallId}`,kind:"scheduled_task",title:d("scheduledTasks.title"),turnId:e,task:f?.workspaceId?{...A,workspaceId:f.workspaceId}:A,...r?{workspaceCwd:r}:{},...f?.workspaceId?{workspaceId:f.workspaceId}:{}});return}l(A)};return(0,u.jsxs)("div",{className:Ct.root,children:[t.length>0&&(0,u.jsxs)("div",{className:Ct.card,children:[(0,u.jsxs)("div",{className:Ct.summary,children:[(0,u.jsx)("span",{className:Ct.icon,"aria-hidden":"true",children:(0,u.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",focusable:"false",className:Ct.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:[Ct.reviewSummary,T?Ct.reviewSummaryWithStats:""].filter(Boolean).join(" "),children:[(0,u.jsx)("div",{className:Ct.title,children:d("turnOutputs.filesEdited",{count:t.length})}),(0,u.jsxs)("div",{className:Ct.reviewMeta,children:[(0,u.jsx)(XB,{additions:T?.additions,deletions:T?.deletions,className:Ct.lineStats,additionsClassName:Ct.additions,deletionsClassName:Ct.deletions}),(0,u.jsxs)("button",{type:"button",className:Ct.linkButton,onClick:()=>L(),children:[d("turnOutputs.viewChanges")," \u2197"]})]})]}),(0,u.jsx)("div",{className:Ct.actions,children:(0,u.jsx)("button",{type:"button",className:Ct.reviewButton,onClick:()=>L(),children:d("turnOutputs.review")})})]}),(0,u.jsxs)("div",{className:Ct.list,children:[v.map(A=>(0,u.jsxs)("button",{type:"button",className:Ct.fileRow,onClick:()=>L(A.path),title:A.path,children:[(0,u.jsx)("span",{className:Ct.path,children:r9e(A.path,r)}),(0,u.jsx)(XB,{additions:A.additions,deletions:A.deletions,className:Ct.lineStats,additionsClassName:Ct.additions,deletionsClassName:Ct.deletions})]},`${A.toolCallId}:${A.path}`)),y>0&&(0,u.jsxs)("button",{type:"button",className:Ct.showMoreButton,onClick:()=>h(A=>!A),children:[(0,u.jsx)("span",{children:m?d("turnOutputs.collapseFiles"):d("turnOutputs.showMoreFiles",{count:y})}),(0,u.jsx)(KB,{open:m})]})]})]}),k.map(A=>{let E=n9e(A);return(0,u.jsx)(V6e,{artifact:A,externalUrl:E,onOpen:E||!Yq(A)?void 0:()=>S(A),onError:c,onDownload:t9e(A)&&p?P=>Wse(p,A.workspacePath,A.mimeType,P):void 0},A.id)}),I>0&&(0,u.jsxs)("button",{type:"button",className:Ct.showMoreButton,onClick:()=>b(A=>!A),children:[(0,u.jsx)("span",{children:g?d("turnOutputs.collapseArtifacts"):d("turnOutputs.showMoreArtifacts",{count:I})}),(0,u.jsx)(KB,{open:g})]}),a.map(A=>(0,u.jsx)(X6e,{task:A,scheduleLabel:IF(A.cron,d),onOpen:()=>_(A)},A.toolCallId))]})}function V6e({artifact:e,externalUrl:t,onOpen:n,onDownload:a,onError:r}){let{t:o}=nt(),s=Kw(),[i,l]=(0,w.useState)(!1),c=(0,w.useRef)(!0);(0,w.useEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]);let d=zse(e.sizeBytes),f=a9e(e,o),p=e.workspacePath&&Ew(e.workspacePath).split("/").at(-1)||e.title,m=async()=>{if(!(!a||i)){l(!0);try{await a(()=>!c.current)}catch(g){if(!c.current)return;let b=o("common.downloadFailed",{message:Mw(g)});r?r(new Error(b,{cause:g}),b):console.error(b,g)}finally{l(!1)}}},h=(0,u.jsx)(_i,{size:16,strokeWidth:1.8,"aria-hidden":"true"});return(0,u.jsx)("div",{className:Ct.card,children:(0,u.jsxs)("div",{className:Ct.summary,children:[(0,u.jsx)("span",{className:Ct.icon,"aria-hidden":"true",children:(0,u.jsx)(Zse,{artifact:e,className:Ct.iconSvg})}),(0,u.jsxs)("div",{className:Ct.artifactInfo,children:[(0,u.jsx)("div",{className:Ct.title,children:e.title}),(0,u.jsx)("div",{className:Ct.artifactMeta,children:[e.metadata?.artifactType==="web_preview_snapshot"?o("webPreview.saved"):Fse(e),d].filter(Boolean).join(" \xB7 ")})]}),(0,u.jsxs)("div",{className:Ct.actions,children:[a&&(0,u.jsxs)("button",{type:"button",className:Ct.reviewButton,onClick:()=>void m(),title:`${o("common.download")} ${p}`,disabled:i,children:[(0,u.jsx)(oh,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),o(i?"common.downloading":"common.download")]}),(0,u.jsx)("span",{className:Ct.openButtonWrapper,title:f??e.title,children:t?(0,u.jsxs)("a",{className:Ct.reviewButton,href:t,target:"_blank",rel:"noopener noreferrer",onClick:g=>s(g,t),children:[h,o("common.open")]}):(0,u.jsxs)("button",{type:"button",className:Ct.reviewButton,onClick:n,disabled:!n,children:[h,o("common.open")]})})]})]})})}function X6e({task:e,scheduleLabel:t,onOpen:n}){let{t:a}=nt();return(0,u.jsx)("div",{className:Ct.card,children:(0,u.jsxs)("div",{className:Ct.summary,children:[(0,u.jsx)("span",{className:Ct.icon,"aria-hidden":"true",children:(0,u.jsx)(Z6e,{})}),(0,u.jsxs)("div",{className:Ct.artifactInfo,children:[(0,u.jsx)("div",{className:Ct.title,children:e.title}),(0,u.jsx)("div",{className:Ct.artifactMeta,children:[t,e.recurring?a("scheduledTasks.repeats"):a("scheduledTasks.runsOnce")].filter(Boolean).join(" \xB7 ")})]}),(0,u.jsx)("div",{className:Ct.actions,children:(0,u.jsx)("button",{type:"button",className:Ct.reviewButton,onClick:n,title:e.title,children:a("common.open")})})]})})}function Z6e(){return(0,u.jsxs)("svg",{className:Ct.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 KB({open:e}){return(0,u.jsx)("svg",{className:[Ct.chevronIcon,e?Ct.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 K6e=(0,w.memo)(G6e);function Y6e(e,t,n){if(!J6e(e)||!e.workspacePath)return;let a=t.find(r=>Gse(r.path,e.workspacePath,n));if(a)return Q6e(a)}function Q6e(e){for(let t=e.diffs.length-1;t>=0;t--){let n=e.diffs[t];if(n?.fullContent)return n.newText}}function J6e(e){let t=e.workspacePath?.toLowerCase()??"",n=e.mimeType?.toLowerCase()??"";return e.kind==="html"||e9e(t)||n==="text/html"||n==="text/markdown"}function e9e(e){let t=e.toLowerCase();return t.endsWith(".html")||t.endsWith(".htm")||t.endsWith(".md")||t.endsWith(".markdown")||SF(t)!==void 0}function t9e(e){return e.storage==="workspace"&&e.status==="available"&&!!e.workspacePath}function Yq(e){return e.storage!=="workspace"?!0:e.status==="available"||e.status==="changed"}function n9e(e){if(e.kind!=="link"||e.storage==="published")return;let t=e.url?.trim();return R6(t)?t:void 0}function a9e(e,t){if(!Yq(e))return e.workspacePath?t("turnOutputs.artifactUnavailable",{path:e.workspacePath}):t("turnOutputs.artifactMissing")}function r9e(e,t){return MC(e,t)}function o9e(e,t){let[n,a]=(0,w.useState)(!1);return(0,w.useLayoutEffect)(()=>{let r=e.current;if(!r||!t){a(!1);return}let o=r.closest("[data-history-viewport]")??r,s=()=>{let d=Number.parseFloat(getComputedStyle(r).getPropertyValue("--chat-regular-content-width"))||1e3;a(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]),n}var s9e="_collapseRow_d7f01_1",i9e="_collapseRowClickable_d7f01_14",l9e="_collapseLabel_d7f01_19",c9e="_processedLabel_d7f01_36",u9e="_processedMeta_d7f01_43",d9e="_hiddenMetrics_d7f01_47",f9e="_summaryMetrics_d7f01_51",p9e="_collapseIcon_d7f01_59",m9e="_chevronRight_d7f01_72",h9e="_chevronDown_d7f01_73",bs={collapseRow:s9e,collapseRowClickable:i9e,collapseLabel:l9e,processedLabel:c9e,processedMeta:u9e,hiddenMetrics:d9e,summaryMetrics:f9e,collapseIcon:p9e,chevronRight:m9e,chevronDown:h9e},g9e="_list_nvt92_1",v9e="_listWithWelcomeHeader_nvt92_12",y9e="_historyStatus_nvt92_32",w9e="_historyRetryButton_nvt92_38",b9e="_virtualSizer_nvt92_64",k9e="_virtualRow_nvt92_73",x9e="_loadingSkeleton_nvt92_83",S9e="_srOnly_nvt92_91",C9e="_loadingSkeletonUserRow_nvt92_103",T9e="_loadingSkeletonAssistantRow_nvt92_109",I9e="_loadingSkeletonUserBubble_nvt92_115",_9e="_loadingSkeletonUserBubbleCompact_nvt92_116",L9e="_loadingSkeletonAssistantBlock_nvt92_130",A9e="_loadingSkeletonLineWide_nvt92_138",E9e="_loadingSkeletonLineMedium_nvt92_139",R9e="_loadingSkeletonLineShort_nvt92_140",M9e="_loadingSkeletonLineNarrow_nvt92_141",P9e="_turnStatusRow_nvt92_181",N9e="_turnAnswerRow_nvt92_182",O9e="_turnContentRow_nvt92_193",D9e="_sessionTimelineLayer_nvt92_197",$9e="_sessionTimelinePanel_nvt92_210",B9e="_sessionTimelineViewport_nvt92_226",F9e="_sessionTimelineList_nvt92_275",z9e="_sessionTimelineItem_nvt92_285",q9e="_sessionTimelineButton_nvt92_290",U9e="_sessionTimelineTick_nvt92_310",H9e="_sessionTimelineButtonInRange_nvt92_400",j9e="_sessionTimelineButtonCurrent_nvt92_404",W9e="_sessionTimelineDetails_nvt92_415",G9e="_sessionTimelineDetailsTitle_nvt92_453",V9e="_sessionTimelineDetailsIcon_nvt92_460",X9e="_sessionTimelineDetailsTitleText_nvt92_472",Z9e="_sessionTimelineDetailsDetail_nvt92_482",Mt={list:g9e,listWithWelcomeHeader:v9e,historyStatus:y9e,historyRetryButton:w9e,virtualSizer:b9e,virtualRow:k9e,loadingSkeleton:x9e,srOnly:S9e,loadingSkeletonUserRow:C9e,loadingSkeletonAssistantRow:T9e,loadingSkeletonUserBubble:I9e,loadingSkeletonUserBubbleCompact:_9e,loadingSkeletonAssistantBlock:L9e,loadingSkeletonLineWide:A9e,loadingSkeletonLineMedium:E9e,loadingSkeletonLineShort:R9e,loadingSkeletonLineNarrow:M9e,turnStatusRow:P9e,turnAnswerRow:N9e,turnContentRow:O9e,sessionTimelineLayer:D9e,sessionTimelinePanel:$9e,sessionTimelineViewport:B9e,sessionTimelineList:F9e,sessionTimelineItem:z9e,sessionTimelineButton:q9e,sessionTimelineTick:U9e,sessionTimelineButtonInRange:H9e,sessionTimelineButtonCurrent:j9e,sessionTimelineDetails:W9e,sessionTimelineDetailsTitle:G9e,sessionTimelineDetailsIcon:V9e,sessionTimelineDetailsTitleText:X9e,sessionTimelineDetailsDetail:Z9e},kC=()=>{},K9e=15e3,xC=180,Y9e=400,YB=5e3;function Q9e(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 n=e[e.length-1],a=t[t.length-1];return n.id!==a.id||n.role!==a.role||a.role!=="assistant"&&a.role!=="thinking"||n.role!=="assistant"&&n.role!=="thinking"||n.isStreaming!==!0||a.isStreaming!==!0?!1:n.role==="assistant"&&a.role==="assistant"?typeof n.content!="string"||typeof a.content!="string"?!1:n.branchRecordId===a.branchRecordId&&n.usage===a.usage&&!!n.content.trim()==!!a.content.trim():n.role==="thinking"&&a.role==="thinking"}function QB(e,t){return e.length===t.length&&e.every((n,a)=>Object.is(n,t[a]))}function J9e(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.role==="user")return n.id}return null}function e7e(e){return e[e.length-1]}function t7e(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&Qr(n))return n.id}return null}function n7e(e,t){return e.role!=="tool_group"?!1:!!(t?.toolCallId&&e.tools.some(n=>Ss(n,t.toolCallId)))}function y6(e){return O6(e)||!!_0(e.rawOutput)}function JB(e){let t=[],n=!1;for(let a of e){if(a.role!=="tool_group"||a.tools.length<2||!a.tools.some(y6)){t.push(a);continue}n=!0;let r=[],o=0,s=i=>{i.length!==0&&t.push({...a,id:o++===0?a.id:`${a.id}-${i[0].callId}`,tools:i})};for(let i of a.tools)y6(i)?(s(r),r=[],s([i])):r.push(i);s(r)}return n?t:e}function a7e(e,t){let n=[],a=0,r=o=>o.role==="tool_group"&&!n7e(o,t)&&!o.tools.some(y6);for(;a<e.length;){let o=e[a];if(o.role!=="thinking"&&!r(o)){n.push(o),a++;continue}let s=[],i=a-1,l=a;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(EC)){for(let p of s)n.push(p);a=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 h of f)h.beforeToolCallId=m;f.length=0}n.push({id:Vq(s[0].id),role:"tool_group",tools:c,...d.length>0?{thoughts:d}:{},timestamp:s[0].timestamp}),a=i+1}return n}function r7e(e,t){let n=e[e.length-1];if(n?.role!=="tool_group"||Zq(n.id)===void 0||!n.thoughts?.length)return;let a=n.thoughts[n.thoughts.length-1];if(a?.isStreaming!==!0)return;let r=n.thoughts.slice();r[r.length-1]={...a,content:t.content,isStreaming:!0};let o=e.slice();return o[o.length-1]={...n,thoughts:r,...n.id===Vq(t.id)?{timestamp:t.timestamp}:{}},o}function Qq(e){return Yoe(B7e(e))}function kw(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 o7e(e,t,n,a,r){if((!n||n.size===0)&&(!a||a.size===0)&&(!r||r.size===0))return e;let o=[],s=null,i=(l,c)=>{if(c&&t||!l)return;let d=n?.get(l)??[],f=a?.get(l)??[],p=r?.get(l)??[];if(d.length===0&&f.length===0&&p.length===0)return;let m=o.length;for(let h=o.length-1;h>=0;h-=1){let g=o[h];if(g.type!=="message"||g.message.role!=="system")break;g.message.source==="recap"&&(m=h)}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"&&Qr(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 s7e(e,t){let n=s=>s.type==="parallel_agents"&&(t?.has(s.key)===!0||s.agents.some(i=>wa(i.status)));if(!e.some(s=>n(s)))return e;let a=[],r=[],o=()=>{a.push(...r),r=[]};for(let s of e)s.type==="message"&&Qr(s.message)?(o(),a.push(s)):n(s)?r.push(s):a.push(s);return o(),a}function Jq(e,t){return e.type==="message"&&(e.message.role==="assistant"||t&&e.message.role==="system"&&e.message.source==="background_notification")&&!!e.message.content&&e.message.content.trim().length>0}function ub(e,t,n,a=!0){let r=!1;for(let o=n;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(x7e(s))r=!0;else if(!r&&Jq(s,a))return o}return-1}function i7e(e,{isResponding:t,latestTurnAwaitsAgentSummary:n,gateBackgroundAgentStatus:a}){let r=[];for(let s=0;s<e.length;s++){let i=e[s];i.type==="message"&&Qr(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||a&&n)||a&&aU(e,i,l))continue;let c=e[i],d=ub(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 eF(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(O6);case"plan":return!0;case"assistant":return!t;case"thinking":return!0;case"system":return e.message.source==="background_notification"?!t: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 eU(e){return e.source==="mid_turn_message_injected"}function l7e(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:n}=e;switch(n.role){case"thinking":return{kind:"thought",timestamp:n.timestamp,label:t?t("timeline.thinking"):"Thinking"};case"assistant":return e.turnCollapse?{kind:"none",timestamp:n.timestamp}:rd(n.content,1)?{kind:"commentary",timestamp:n.timestamp,label:t?t("timeline.assistantUpdate"):"Assistant update"}:{kind:"none",timestamp:n.timestamp};case"tool_group":{let a=n.tools.length;return{kind:"tool",timestamp:n.timestamp,label:t?t("timeline.toolCalls",{count:a}):`${a} tool call${a===1?"":"s"}`}}case"plan":return{kind:"plan",timestamp:n.timestamp,label:t?t("timeline.planUpdate"):"Plan update"};case"system":return eU(n)?{kind:"status",timestamp:n.timestamp,label:t?t("timeline.statusUpdate"):"Status update"}:{kind:"none",timestamp:n.timestamp};case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return{kind:"none",timestamp:n.timestamp};default:return{kind:"none"}}}function rd(e,t,n={}){let a=(n.stripMarkdown===!0?c7e(e):e??"").replace(/\s+/g," ").trim();if(t<=0||!a)return"";let r=Array.from(a);return r.length>t?`${r.slice(0,t-1).join("")}\u2026`:a}function c7e(e){if(!e)return"";let t=[],n=r=>{let o=`\0${t.length}\0`;return t.push(r),o},a=e.replace(/```[^\n`]*\n?([\s\S]*?)```/g,(r,o)=>n(o)).replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`\n]+)`/g,(r,o)=>n(o)).replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"");a=SC(a,"~~"),a=SC(a,"**"),a=SC(a,"__"),a=a.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())a=a.split(`\0${r}\0`).join(o);return a}function SC(e,t){let n="",a=0;for(;a<e.length;){let r=e.indexOf(t,a);if(r===-1)return n+e.slice(a);let o=r+t.length,s=e.indexOf(t,o);if(s===-1)return n+e.slice(a);let i=e.slice(o,s);n+=i.trim().length===0?e.slice(a,s+t.length):e.slice(a,r)+i,a=s+t.length}return n}function u7e(e,t){let n=e.role==="user"?e.content:e.role==="user_shell"?e.command:"";return rd(n,32)||(t?t("timeline.userTurn"):"User turn")}function d7e(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function Qr(e){return e.role==="user"||e.role==="user_shell"}function f7e(e,t){if(!t.startsWith("msg:"))return;let n=t.slice(4);n=Zq(n)??n;for(let a=e.length-1;a>=0;a--)if(e[a]?.id===n){for(let r=a;r>=0;r--){let o=e[r];if(o&&Qr(o))return o.id}return}}function p7e(e,t){for(let n of e)if(n.type==="turn_collapse"&&n.turnCollapse.turnId===t)return n.turnCollapse.collapsed;return!1}function m7e(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return rd(e.content,120,{stripMarkdown:!0});case"tool_group":{let n=e.tools.length;return t?t("timeline.toolCalls",{count:n}):`${n} tool call${n===1?"":"s"}`}case"plan":return t?t("timeline.planDetail"):"plan update";case"system":return eU(e)?rd(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 h7e(e,t){if(e.type==="parallel_agents"){let n=e.agents.length;return t?t("timeline.parallelAgentsDetail",{count:n}):`${n} parallel agent${n===1?"":"s"}`}return e.type==="turn_outputs"||e.type!=="message"?"":m7e(e.message,t)}function g7e(e,t){return t?t(`timeline.kind.${e}`):Q7e[e]}function v7e(e,t,n,a){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=rd(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=h7e(i,a);l&&r.push(l)}return rd(r.join(" \xB7 "),180)||(n.length>0?n.map(s=>g7e(s,a)).join(" \xB7 "):a?a("timeline.noActivity"):"No activity")}function y7e(e,t){let n=[],a=null,r=[],o=()=>{if(!a)return;let s=Qq(r),i=ub(s,-1,s.length-1,!1),l=i>=0?s[i]:null,c=l?.type==="message"&&l.message.role==="assistant"&&!l.message.isStreaming&&rd(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=l7e(f,t);p.kind!=="none"&&!d.includes(p.kind)&&d.push(p.kind)}n.push({id:a.id,label:u7e(a,t),detail:v7e(s,c,d,t),timestamp:a.timestamp,nodeKinds:d,...d7e(a)?{isScheduledTask:!0}:{}})};for(let s of e){if(Qr(s)){o(),a=s,r=[];continue}a&&r.push(s)}return o(),n}function w7e(){return(0,u.jsxs)("svg",{className:Mt.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 b7e(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 k7e(e){return e.map(t=>{let n=`${t.id}:${t.role}:${t.timestamp??""}`;switch(t.role){case"assistant":case"thinking":return`${n}:${t.isStreaming?"streaming":t.content}`;case"tool_group":return`${n}:${t.tools.map(b7e).join(",")}`;case"system":return`${n}:${t.variant}:${t.source??""}:${t.content}`;case"user":return`${n}:${t.content}`;case"user_shell":return`${n}:${t.command}`;case"plan":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return n;default:return n}}).join("|")}function x7e(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 S7e(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 n=e.agents.filter(a=>wa(a.status));return n.length===0?null:`agents:${e.key}:${n.map(a=>a.callId).join(",")}`}if(e.message.role!=="tool_group")return null;let t=e.message.tools.filter(n=>wa(n.status));return t.length===0?null:`tools:${e.message.id}:${t.map(n=>n.callId).join(",")}`}function C7e(e){for(let t=e.length-1;t>=0;t--){let n=S7e(e[t]);if(n)return n}return null}function T7e(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 I7e(e){return e.type==="message"&&e.message.role==="system"&&e.message.source==="turn_error"}function _7e(e){if(!(e.type!=="message"||e.message.role!=="assistant"))return e.message.content?.trim()?e.message.timestamp:void 0}function L7e(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function CC(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function tF(e){if(e.parentToolCallId||!kr(e))return;let t=e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0,n=t?.executionSummary&&typeof t.executionSummary=="object"?t.executionSummary:void 0,a=CC(n?.inputTokens),r=CC(n?.outputTokens);if(a===void 0&&r===void 0)return;let o=CC(n?.cachedTokens);return{callId:e.callId,usage:{inputTokens:a??0,outputTokens:r??0,...o!==void 0?{cachedTokens:o}:{}}}}function A7e(e){return e.type==="parallel_agents"?e.agents.flatMap(t=>tF(t)??[]):e.type!=="message"||e.message.role!=="tool_group"?[]:e.message.tools.flatMap(t=>tF(t)??[])}function E7e(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=>!Wo(t.toolName)).length:0}function tU(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--){let a=e[n];if(a.type==="message"&&Qr(a.message))return a.message.id}return null}function nU(e){let t=[],n=null;for(let a of e)a.type==="message"&&Qr(a.message)&&(n=a.message.id),t.push(n);return t}function nF(e,t,n,a){let r=a===void 0?tU(e,t):a[t]??null;return r?n.get(r)??null:null}function R7e(e,t,n,a,r=nU(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,n,r);c!==null&&(o=Math.min(o,c),s=Math.max(s,c))}if(s<0)return null;let i=a==null?null:nF(e,a,n,r);return{startIndex:o,endIndex:s,currentIndex:i!==null&&i>=o&&i<=s?i:s}}function W0(e,t,n,a){for(let r=t;r<=n;r++){let o=e[r];if(o.type==="parallel_agents"){if(o.agents.some(a))return!0}else if(o.type==="message"&&o.message.role==="tool_group"&&o.message.tools.some(a))return!0}return!1}function M7e(e,t,n,a){return a?W0(e,t,n,r=>Ss(r,a)):!1}function P7e(e,t,n){return W0(e,t,n,a=>kr(a)&&wa(a.status))}function N7e(e,t,n){return W0(e,t,n,a=>_0(a.rawOutput)!==void 0)}function O7e(e,t){let n=new Set(t);for(let a of e){if(a.type!=="message"||a.message.role!=="system"||a.message.source!=="background_notification"&&a.message.source!=="background_task_completed"&&a.message.source!=="background_notification_turn_started")continue;let r=a.message.data;if(a.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"&&n.add(o)}return n}function D7e(e,t,n,a){return W0(e,t,n,r=>{let o=Koe(r);return o!==void 0&&!a.has(o)})}function aU(e,t,n){return W0(e,t,n,a=>xs(a)&&wa(a.status))}function $7e(e,t,n,a){if(!a?.size)return!1;for(let r=t;r<=n;r++){let o=e[r];if(o.type==="parallel_agents"&&a.has(o.key))return!0}return!1}function TC(e){return e.type==="parallel_agents"?e.agents.filter(t=>xs(t)&&t.status!=="failed").map(t=>t.callId):e.type==="message"&&e.message.role==="tool_group"?e.message.tools.filter(t=>xs(t)&&t.status!=="failed").map(t=>t.callId):[]}function rU(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,n=e.data;if(e.source==="background_notification_turn_started"&&n&&typeof n=="object"&&"backgroundTask"in n&&(n=n.backgroundTask??n),typeof n!="object"||n===null||Array.isArray(n))return t?{status:"completed",...e.timestamp!==void 0?{endTime:e.timestamp}:{}}:null;let{kind:a,toolUseId:r,status:o}=n;if(a!=="agent"&&!(a===void 0&&t))return null;let s=o===void 0?"completed":fF(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"?rU(e.message):null}function B7e(e){let t=new Map;for(let r of e){let o=rU(r);o?.callId&&t.set(o.callId,o)}if(t.size===0)return e;let n=!1,a=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||!xs(i)||!wa(i.status))return i;let c=pF(i,l.status,l.endTime);return c===i?i:(o=!0,c)});return o?(n=!0,{...r,tools:s}):r});return n?a:e}function oU(e,t,n,a){let r=-1,o;for(let c=n;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(a&&!f)continue;r<0&&(r=c,o=f?.callId)}}}if(r<0)return null;let s=-1;if(o){for(let c=n;c>=0;c--)if(TC(e[c]).includes(o)){s=c;break}}for(let c=n;c>=t&&!(s>=0);c--)if(TC(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"&&Qr(p.message)){c=f;break}}let d=[];for(let f=c;f<=n;f++){let p=e[f];for(let h of TC(p))i.add(h);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 b6(e,t,n,a=!1,r=!0,o=!0){let s=oU(e,t,n,a);if(!s)return!1;if(s.sawAgentCompletion&&s.unmatchedAgentCallIds.size>0)return r;for(let i=s.lastNotificationIndex+1;i<=n;i++){let l=e[i];if(l.type==="message"&&l.message.role==="thinking")return!1}return o&&ub(e,t,n,!1)<s.lastNotificationIndex}function F7e(e,{overrides:t,isResponding:n,activeTurnStartedAt:a,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"&&Qr(v.message)&&m.push(b)}if(m.length===0)return e;let h=O7e(e,i),g=[];for(let b=0;b<m[0];b++)g.push(e[b]);for(let b=0;b<m.length;b++){let v=m[b],y=(b+1<m.length?m[b+1]:e.length)-1,k=e[v],I=k.message.id,T=k.message.timestamp,L=b===m.length-1,S=L&&n,_=P7e(e,v,y),A=N7e(e,v,y),E=D7e(e,v,y,h),P=$7e(e,v,y,l),D=L&&r&&b6(e,v,y,!1,o,s),B=M7e(e,v,y,c),z=ub(e,v,y),Z=z;if(z>=0&&Jq(e[z],!1)){let U=!1;for(let ie=z-1;ie>v;ie--){let Ze=e[ie];if(Ze.type!=="message")break;if(Ze.message.role==="system"&&Ze.message.source==="background_task_completed")U=!0;else if(U&&Ze.message.role==="assistant")Z=ie,U=!1;else break}}let G=0,te,j,J,R=0,W=0,V=0,N=0,ne=0,fe=!1,le=new Set,X=!1;for(let U=v+1;U<=y;U++){let ie=e[U];if(eF(ie,U>=Z&&U<=z)&&G++,I7e(ie)&&(X=!0),N+=E7e(ie),ie.type==="message"&&ie.message.role==="thinking"?ne++:ie.type==="message"&&ie.message.role==="tool_group"&&ie.message.thoughts&&(ne+=ie.message.thoughts.length),ie.type==="message"&&ie.message.role==="system"&&ie.message.source==="prompt_cancelled"){let rt=ie.message.data,yt=rt&&typeof rt=="object"&&"elapsedMs"in rt?rt.elapsedMs:void 0;typeof yt=="number"&&Number.isFinite(yt)&&yt>=0&&(j=yt)}let Ze=T7e(ie);Ze!==void 0&&(te=te===void 0?Ze:Math.max(te,Ze));let $e=_7e(ie);$e!==void 0&&(J=J===void 0?$e:Math.max(J,$e));let at=L7e(ie);if(at&&(R+=at.inputTokens,W+=at.outputTokens,V+=at.cachedTokens??0,fe=!0),d)for(let rt of A7e(ie))le.has(rt.callId)||(le.add(rt.callId),R+=rt.usage.inputTokens,W+=rt.usage.outputTokens,V+=rt.usage.cachedTokens??0,fe=!0)}let se=S||D?a??T??Date.now():void 0,ce=te??J,ae=j??(T!==void 0&&ce!==void 0&&ce>=T?ce-T:void 0);if(B||G===0&&!(fe||ae!==void 0||se!==void 0)){for(let U=v;U<=y;U++)g.push(e[U]);continue}let pe=S||_||A||E||P||D||(X||z<0)&&L,Ee=!(G===0||(t.has(I)?t.get(I):f?.has(I)||pe));g.push({type:"message",key:k.key,message:k.message});let Me={turnId:I,collapsed:Ee,hiddenCount:G,...ae!==void 0?{elapsedMs:ae}:{},...fe?{inputTokens:R,outputTokens:W}:{},...V>0?{cachedTokens:V}:{},...N>0?{toolCallCount:N}:{},...ne>0?{thinkingCount:ne}:{},...se!==void 0?{liveStartedAt:se}:{}};if(g.push({type:"turn_collapse",key:`tc-${I}`,turnCollapse:Me}),!Ee){for(let U=v+1;U<=y;U++){let ie=e[U];U===z&&ie.type==="message"&&ie.message.role==="assistant"?g.push({...ie,turnCollapse:Me}):g.push(ie)}continue}for(let U=v+1;U<=y;U++){let ie=e[U];if(!(U===z&&S)){if(U===z&&ie.type==="message"&&ie.message.role==="assistant"){g.push({...ie,turnCollapse:Me});continue}eF(ie,U>=Z&&U<=z)||g.push(ie)}}}return g}function xw(e,t,n){if(n){for(let a=0;a<e.length;a++){let r=e[a];if(r.type==="message"&&r.message.role==="tool_group"&&r.message.tools.some(o=>Ss(o,n))||r.type==="parallel_agents"&&r.agents.some(o=>Ss(o,n)))return a}return-1}for(let a=0;a<e.length;a++){let r=e[a];if(r.type==="message"&&r.message.id===t)return a}return-1}function aF(e,t){if(!t)return!1;let n=t.callId;return e.type==="message"?n?e.message.role==="tool_group"&&e.message.tools.some(a=>Ss(a,n)):e.message.id===t.messageId:e.type==="parallel_agents"?!!n&&e.agents.some(a=>Ss(a,n)):(e.type,!1)}function rF(e,t){return e?e.type==="message"?e.message.sourceBlockIds?.join(","):t.filter(n=>e.type==="parallel_agents"?n.role==="tool_group"&&e.agents.some(a=>n.tools.some(r=>Ss(r,a.callId))):n.id===(e.type==="turn_outputs"?e.turnId:e.turnCollapse.turnId)).flatMap(n=>n.sourceBlockIds??[]).join(",")||void 0:void 0}var IC=0,z7e=120,q7e=80,U7e=32,H7e=240,Sw=30,_C=160,oF=30,sU=200;function j7e(e,t=sU){return e>t}function W7e(e,t){return e<=t}function G7e(e){let t=Math.max(0,Math.ceil(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60),a=t-n*60;return`${n}m ${a}s`}function V7e(e){return e!==void 0&&e>=0?G7e(e):""}function X7e(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";let n=e.cachedTokens??0,a=n>0&&e.inputTokens>0?` (${Ea(n)} ${t("turn.cached")}, ${Math.round(n/e.inputTokens*100)}%)`:"";return`\u2191${Ea(e.inputTokens)}${a} \u2193${Ea(e.outputTokens)}`}function sF(e,t){let n=[],a=X7e(e,t);return a&&n.push(a),e.toolCallCount!==void 0&&e.toolCallCount>0&&n.push(t("turn.toolCalls",{count:e.toolCallCount})),e.thinkingCount!==void 0&&e.thinkingCount>0&&n.push(t("turn.thinkingCount",{count:e.thinkingCount})),n.join(" \xB7 ")}function Z7e(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}var K7e=(0,w.memo)(function({turnCollapse:e,onToggleCollapse:t}){let{t:n}=nt(),a=e.hiddenCount>0,r=e.liveStartedAt,o=a||r!==void 0||Z7e(e),s=ab(r!==void 0&&o),i=(0,w.useRef)(0),l=(0,w.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=V7e(c),f=sF(e,n),p=sF(e,n),m=n(r!==void 0?"turn.processing":"turn.processed"),h=!!d&&o,g=!!f&&o,b=!!p&&o;if(!o)return null;let v=()=>{if(!a)return;let y=e.collapsed;t(e.turnId,y)};return(0,u.jsxs)("div",{className:a?`${bs.collapseRow} ${bs.collapseRowClickable}`:bs.collapseRow,role:a?"button":void 0,tabIndex:a?0:void 0,"aria-expanded":a?!e.collapsed:void 0,"aria-label":a?e.collapsed?n("turn.expand"):n("turn.collapse"):void 0,title:a?e.collapsed?n("turn.expand"):n("turn.collapse"):void 0,onClick:a?v:void 0,onKeyDown:a?y=>{y.key!=="Enter"&&y.key!==" "||(y.preventDefault(),v())}:void 0,children:[(0,u.jsxs)("span",{className:bs.collapseLabel,children:[(0,u.jsxs)("span",{className:bs.processedLabel,children:[m,h&&(0,u.jsxs)("span",{className:bs.processedMeta,children:[" ",d]})]}),b&&(0,u.jsx)("span",{className:bs.summaryMetrics,children:p}),g&&(0,u.jsx)("span",{className:bs.hiddenMetrics,children:f})]}),a&&(0,u.jsx)("span",{"data-testid":`toggle-${e.turnId}`,className:bs.collapseIcon,onClick:y=>{y.stopPropagation(),v()},children:(0,u.jsx)("span",{className:e.collapsed?bs.chevronRight:bs.chevronDown,"aria-hidden":"true"})})]})});function Y7e(e){if(e.type==="turn_collapse")return Mt.turnStatusRow;if(e.type==="turn_outputs")return Mt.turnContentRow;if(e.type==="message"&&e.turnCollapse)return Mt.turnAnswerRow}var Q7e={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},J7e=["--background","--foreground","--muted-foreground","--border","--font-sans"],iF="session-timeline-detail-tooltip",e8e=(0,w.memo)(function({entries:e,currentTurnId:t,currentRange:n,hidden:a,onSelect:r}){let o=A0(),{t:s}=nt(),i=(0,w.useRef)(null),l=(0,w.useRef)(null),c=(0,w.useRef)(null),d=(0,w.useRef)(!1),f=(0,w.useRef)(!1),p=(0,w.useRef)(null),m=(0,w.useRef)(null),[h,g]=(0,w.useState)(null),b=n!==null?n.currentIndex:e.findIndex(A=>A.id===t),v=(0,w.useCallback)(()=>g(null),[]),y=(0,w.useCallback)(()=>{d.current||f.current||v()},[v]),k=(0,w.useCallback)((A,E)=>{let P=i.current;if(!P)return null;let D=getComputedStyle(P),B=E.getBoundingClientRect();return{entry:A,top:B.top+B.height/2,left:B.right+8,clamped:!1,themeVars:Object.fromEntries(J7e.map(z=>[z,D.getPropertyValue(z)]))}},[]),I=(0,w.useCallback)(A=>{let E=l.current;return E?Array.from(E.querySelectorAll('[data-testid="session-timeline-entry"]')).find(P=>P.getAttribute("data-turn-id")===A.id)?.querySelector("button")??null:null},[]),T=(0,w.useCallback)(A=>{let E=l.current;if(!E)return!1;let P=E.getBoundingClientRect(),D=A.getBoundingClientRect();return D.bottom>=P.top&&D.top<=P.bottom},[]),L=(0,w.useCallback)(()=>{g(A=>{if(!A)return null;let E=I(A.entry);return!E||!T(E)?null:k(A.entry,E)})},[k,I,T]),S=(0,w.useCallback)((A,E)=>{g(k(A,E))},[k]),_=(0,w.useCallback)(()=>{typeof window>"u"||(p.current!==null&&window.cancelAnimationFrame(p.current),m.current!==null&&window.clearTimeout(m.current),f.current=!0,p.current=window.requestAnimationFrame(()=>{p.current=null,f.current=!1,L()}),m.current=window.setTimeout(()=>{m.current=null,f.current=!1},100))},[L]);return(0,w.useLayoutEffect)(()=>{if(a)return;let A=l.current;if(!A||b<0)return;let E=A.querySelector(`[data-timeline-index="${b}"]`);if(!E)return;let P=E.offsetTop+E.offsetHeight/2,D=A.scrollHeight-A.clientHeight,B=Math.max(0,Math.min(P-A.clientHeight/2,D));if(A.scrollTop===B)return;d.current=!0,A.scrollTop=B;let z=window.requestAnimationFrame(()=>{d.current=!1,L()}),Z=window.setTimeout(()=>{d.current=!1},100);return()=>{window.cancelAnimationFrame(z),window.clearTimeout(Z),d.current=!1}},[b,a,L]),(0,w.useLayoutEffect)(()=>{if(!(!h||typeof window>"u"))return window.addEventListener("resize",L),()=>{window.removeEventListener("resize",L)}},[L,h]),(0,w.useLayoutEffect)(()=>()=>{p.current!==null&&window.cancelAnimationFrame(p.current),m.current!==null&&window.clearTimeout(m.current),f.current=!1},[]),(0,w.useLayoutEffect)(()=>{if(!h||h.clamped)return;let A=i.current,E=c.current;if(!A||!E||typeof window>"u")return;let P=E.getBoundingClientRect(),D=12,B=h.top;P.top<D?B+=D-P.top:P.bottom>window.innerHeight-D&&(B-=P.bottom-(window.innerHeight-D)),B!==h.top&&g(z=>z?.entry.id===h.entry.id?{...z,top:B,clamped:!0}:z)},[h]),a||e.length===0?null:(0,u.jsx)("div",{className:Mt.sessionTimelineLayer,"aria-hidden":"false",children:(0,u.jsxs)("nav",{ref:i,className:Mt.sessionTimelinePanel,"aria-label":s("timeline.sessionTimeline"),"data-testid":"session-timeline",onMouseLeave:v,children:[(0,u.jsx)("div",{ref:l,className:Mt.sessionTimelineViewport,"data-testid":"session-timeline-viewport",onScroll:y,children:(0,u.jsx)("ol",{className:Mt.sessionTimelineList,children:e.map((A,E)=>{let P=n!==null&&E>=n.startIndex&&E<=n.endIndex,D=n!==null?E===n.currentIndex:A.id===t,B=A.nodeKinds.join(","),z=[`${s("timeline.turnPrefix",{index:E+1})}: ${A.label}`,D?s("timeline.currentTurn"):null].filter(Boolean).join(". "),Z=j=>S(A,j.currentTarget),G=j=>{_(),S(A,j.currentTarget)},te=h?.entry.id===A.id;return(0,u.jsx)("li",{className:Mt.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":A.id,"data-timeline-index":E,"data-node-kinds":B,"data-in-current-range":P?"true":void 0,children:(0,u.jsx)("button",{type:"button",className:k6(Mt.sessionTimelineButton,P?Mt.sessionTimelineButtonInRange:void 0,D?Mt.sessionTimelineButtonCurrent:void 0),"aria-current":D?"step":void 0,"aria-describedby":te?iF:void 0,"aria-label":z,onClick:()=>r(A.id),onFocus:G,onBlur:v,onMouseEnter:Z,onMouseLeave:v,children:(0,u.jsx)("span",{className:Mt.sessionTimelineTick})})},A.id)})})}),h&&typeof document<"u"&&(0,L0.createPortal)((0,u.jsxs)("div",{ref:c,className:Mt.sessionTimelineDetails,id:iF,"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:Mt.sessionTimelineDetailsTitle,children:[h.entry.isScheduledTask&&(0,u.jsx)(w7e,{}),(0,u.jsx)("span",{className:Mt.sessionTimelineDetailsTitleText,children:h.entry.label})]}),(0,u.jsx)("span",{className:Mt.sessionTimelineDetailsDetail,children:h.entry.detail})]}),o??document.body)]})})});function k6(...e){return e.filter(Boolean).join(" ")||void 0}var t8e=[];function n8e({label:e}){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{role:"status","aria-live":"polite",className:Mt.srOnly,children:e}),(0,u.jsxs)("div",{className:Mt.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[(0,u.jsx)("div",{className:Mt.loadingSkeletonUserRow,children:(0,u.jsxs)("div",{className:Mt.loadingSkeletonUserBubble,children:[(0,u.jsx)("span",{className:Mt.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Mt.loadingSkeletonLineShort})]})}),(0,u.jsx)("div",{className:Mt.loadingSkeletonAssistantRow,children:(0,u.jsxs)("div",{className:Mt.loadingSkeletonAssistantBlock,children:[(0,u.jsx)("span",{className:Mt.loadingSkeletonLineMedium}),(0,u.jsx)("span",{className:Mt.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Mt.loadingSkeletonLineNarrow})]})}),(0,u.jsx)("div",{className:Mt.loadingSkeletonUserRow,children:(0,u.jsx)("div",{className:Mt.loadingSkeletonUserBubbleCompact,children:(0,u.jsx)("span",{className:Mt.loadingSkeletonLineMedium})})}),(0,u.jsx)("div",{className:Mt.loadingSkeletonAssistantRow,children:(0,u.jsxs)("div",{className:Mt.loadingSkeletonAssistantBlock,children:[(0,u.jsx)("span",{className:Mt.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Mt.loadingSkeletonLineMedium})]})})]})]})}var a8e=(0,w.memo)((0,w.forwardRef)(function({messages:e,frozenViewport:t=!1,sessionKey:n,terminalBackgroundShellTaskIds:a,pendingApproval:r,onShowContextDetail:o,onImagePreview:s,onAttachmentPreview:i,onInsightReportOpen:l,onEditUserMessage:c,onSubmitUserMessageEdit:d,loadingTranscript:f,catchingUp:p,hasOlderHistory:m=!1,loadingOlderHistory:h=!1,historyCapacityReached:g=!1,historyPaginationError:b=!1,onLoadOlderHistory:v,transcriptBlockCount:y=0,transcriptActivity:k,onReloadTranscript:I,isResponding:T=!1,transcriptReloadPaused:L=T,activeTurnStartedAt:S,welcomeHeader:_,centerWelcomeHeader:A=!1,workspaceCwd:E,tailContent:P,tailKey:D="tail",virtualScrollThreshold:B=sU,autoScrollTailIntoView:z=!1,bottomOverlayInset:Z=0,hideSessionTimeline:G=!1,hideFirstUserMessage:te=!1,firstTurnMetrics:j,includeSubagentToolUsageInMetrics:J=!0,showRetryHint:R=!1,onRetryClick:W,failedPromptMessageId:V,onRetryFailedPrompt:N,onBranchSession:ne,onCanScrollToBottomChange:fe,turnFileChanges:le,turnArtifacts:X,sourceEntries:se,sourceSessionId:ce,onSourceOpen:ae,turnScheduledTasks:pe,onReviewChanges:Ee,onOpenArtifact:Me,onOpenScheduledTask:U,onTurnOutputOpen:ie,onError:Ze,generateContent:$e},at){let rt=(0,w.useRef)(t);rt.current=t;let{t:yt}=nt(),en=_n(),K=(0,w.useContext)(x6),Ce=(0,w.useMemo)(()=>{let F=new Map,ee,be=0;for(let Re of e)Re.role==="user"&&(F.set(Re.id,be),ee=Re.id,be+=1);return{lastId:ee,turnIndexById:F}},[e]),ye=(0,w.useMemo)(()=>{if(!t)return;let F=[...Ce.turnIndexById.keys()];return new Set(F.filter((ee,be)=>be===0||be===F.length-1))},[Ce,t]),We=(0,w.useRef)(void 0),Q=Q9e(We.current,e);(0,w.useLayoutEffect)(()=>{We.current=e},[e]);let me=(0,w.useRef)(void 0),ve=(0,w.useMemo)(()=>{let F=me.current,ee=e[e.length-1],be;if(Q&&F?.sourceMessages===We.current&&F?.compactMode===K&&F.pendingApproval===r&&(ee?.role==="assistant"&&F.value[F.value.length-1]?.id===ee.id?(be=F.value.slice(),be[be.length-1]=ee):ee?.role==="thinking"&&(be=K?r7e(F.value,ee):JB(e))),!be){let Re=JB(e);be=K?a7e(Re,r):Re}return me.current={sourceMessages:e,compactMode:K,pendingApproval:r,value:be},be},[K,e,r,Q]),Ge=(0,w.useRef)(void 0),_e=(0,w.useMemo)(()=>{let F=Ge.current,ee=ve[ve.length-1],be;if(Q&&T&&F?.sourceMessages===We.current&&F?.compactMode===K&&F.pendingApproval===r&&F.isResponding===T&&F.turnFileChanges===le&&F.turnArtifacts===X&&F.turnScheduledTasks===pe){let Re=F.value[F.value.length-1];Re?.type==="message"&&Re.message.id===ee.id&&(be=F.value.slice(),be[be.length-1]={...Re,message:ee})}return be??=o7e(Qq(ve),T,le,X,pe),Ge.current={sourceMessages:e,compactMode:K,pendingApproval:r,isResponding:T,turnFileChanges:le,turnArtifacts:X,turnScheduledTasks:pe,value:be},be},[ve,e,Q,K,r,T,le,X,pe]),He=(0,w.useMemo)(()=>{for(let F=ve.length-1;F>=0;F-=1){let ee=ve[F];if(ee?.role==="system"&&ee.source==="background_notification")return ee.id}return null},[ve]),[ht,Vt]=(0,w.useState)(He),fn=!!(f||p),st=(0,w.useRef)(fn),Dt=(0,w.useRef)(ve.length>0),Mn=!Dt.current&&ve.length>0,Ln=fn||st.current||Mn;(0,w.useLayoutEffect)(()=>{Ln&&Vt(He),ve.length>0&&(Dt.current=!0),st.current=fn},[Ln,He,fn,ve.length]);let qn=!Ln&&He!==null&&ht!==He,lt=(0,w.useMemo)(()=>{for(let F=_e.length-1;F>=0;F-=1){let ee=_e[F];if(ee.type==="message"&&Qr(ee.message))return F}return 0},[_e]),ct=en==="interactive",wt=(0,w.useMemo)(()=>ct&&aU(_e,lt,_e.length-1),[_e,ct,lt]),mt=(0,w.useMemo)(()=>oU(_e,lt,_e.length-1,!0),[_e,lt]),Ya=(0,w.useMemo)(()=>{let F=mt?.unmatchedAgentCallIds;return F&&F.size>0?[...F].sort().join("|"):""},[mt]),Qa=qn&&!wt&&(mt?.sawAgentCompletion??!1)&&(mt?.unmatchedAgentCallIds.size??0)>0,[nn,Co]=(0,w.useState)(!1);(0,w.useEffect)(()=>{Co(!1)},[Ya,lt,T]),(0,w.useEffect)(()=>{if(!Qa||T)return;let F=setTimeout(()=>Co(!0),YB);return()=>clearTimeout(F)},[Qa,Ya,lt,T]);let Or=(0,w.useMemo)(()=>qn&&!wt&&!T&&(mt?.sawAgentCompletion??!1)&&(mt?.unmatchedAgentCallIds.size??0)===0&&b6(_e,lt,_e.length-1,!0,!0,!0),[qn,_e,T,mt,wt,lt]),[Ra,Dr]=(0,w.useState)(!1),no=(0,w.useMemo)(()=>{let F=mt;if(!F||F.lastNotificationIndex<0)return"";let ee=_e[F.lastNotificationIndex];return ee?.type==="message"?ee.message.id:""},[_e,mt]);(0,w.useEffect)(()=>{Dr(!1)},[no,lt,T]),(0,w.useEffect)(()=>{if(!Or)return;let F=setTimeout(()=>Dr(!0),YB);return()=>clearTimeout(F)},[Or,no,lt,T]);let xr=(0,w.useMemo)(()=>qn&&b6(_e,lt,_e.length-1,!0,wt||!nn,!Ra),[qn,_e,wt,lt,Ra,nn]),ni=(0,w.useMemo)(()=>{let F=new Set;for(let ee=lt;ee<_e.length;ee+=1){let be=_e[ee];be.type==="parallel_agents"&&F.add(be.key)}return F},[_e,lt]),Rp=(0,w.useMemo)(()=>{if(!qn)return{key:null};let F=-1,ee;for(let be=_e.length-1;be>=0;be-=1){let Re=_e[be];if(Re.type!=="message"||Re.message.role!=="system"||Re.message.source!=="background_notification")continue;let Te=w6(Re);if(Te){F=be,ee=Te.callId;break}}for(let be=F-1;be>=0;be-=1){let Re=_e[be];if(Re.type==="parallel_agents"&&(!ee||Re.agents.some(Te=>Te.callId===ee)))return{key:Re.key}}return{key:null}},[qn,_e]),Ma=(0,w.useRef)(null),_c=o9e(Ma,!G),[cd,db]=(0,w.useState)(()=>new Set),G0=(0,w.useCallback)((F,ee)=>{db(be=>{if(be.has(F)===ee)return be;let Re=new Set(be);return ee?Re.add(F):Re.delete(F),Re})},[]),ud=(0,w.useRef)(null),Lc=(0,w.useMemo)(()=>{if(!_c)return t8e;let F=k7e(ve);return(ud.current?.signature!==F||ud.current?.t!==yt)&&(ud.current={signature:F,t:yt,entries:y7e(ve,yt)}),ud.current.entries},[_c,ve,yt]),fb=(0,w.useMemo)(()=>new Map(Lc.map((F,ee)=>[F.id,ee])),[Lc]),V0=(0,w.useMemo)(()=>t7e(ve),[ve]),[Mp,X0]=(0,w.useState)(null),Z0=Mp!==null?Lc[Mp.currentIndex]?.id??V0:V0,K0=(0,w.useRef)(void 0),dd=(0,w.useMemo)(()=>{let F=K0.current,ee;return Q&&T&&F?.sourceMessages===We.current&&F?.isResponding===T&&F.latestTurnAwaitsAgentSummary===xr&&F.gateBackgroundAgentStatus===ct?ee=F.value:ee=i7e(_e,{isResponding:T,latestTurnAwaitsAgentSummary:xr,gateBackgroundAgentStatus:ct}),K0.current={sourceMessages:e,isResponding:T,latestTurnAwaitsAgentSummary:xr,gateBackgroundAgentStatus:ct,value:ee},ee},[_e,e,Q,ct,T,xr]),{collapseCompletedTurns:pb,sourceReferences:Ac,assistantFeedback:Pp}=Go(),{ratings:Y0,rate:Q0,ratingForTurn:J0}=mse(ce),eg=(0,w.useMemo)(()=>{let F=new Map;for(let ee of e)Qr(ee)&&F.set(ee.id,ee);return F},[e]),Ec=ose({renderMode:en,sessionId:ce,options:Pp}),tg=(0,w.useRef)(Pp);tg.current=Pp;let ng=(0,w.useRef)(e);ng.current=e;let Np=(0,w.useCallback)((F,ee,be)=>{let Re=J0(F);Q0(F,be);let Te=tg.current?.onRate;Te&&sse(Te,{rating:be,previousRating:Re,sessionId:ce,promptId:F,userMessage:ise(ng.current,ee)})},[J0,Q0,ce]),ag=(0,w.useRef)(void 0),Rc=(0,w.useMemo)(()=>{let F=[se,E,ce,Ac],ee=ag.current;return Q&&T&&ee&&ee.sourceMessages===We.current&&QB(ee.dependencies,F)?ee.value:Loe(e,se??[],E,ce,Ac)},[e,se,E,ce,Ac,Q,T]);(0,w.useLayoutEffect)(()=>{ag.current={sourceMessages:e,dependencies:[se,E,ce,Ac],value:Rc}},[e,se,E,ce,Ac,Rc]);let Op=pb??!0,[Mc,fd]=(0,w.useState)(()=>new Map),[sl,Pc]=(0,w.useState)(()=>new Set),il=(0,w.useRef)(new Map),[Ja,mb]=(0,w.useTransition)(),pd=(0,w.useRef)(!1),md=(0,w.useRef)(new Map),ll=(0,w.useRef)(void 0),cl=(0,w.useRef)([]),ul=(0,w.useRef)(!0);t&&(ul.current=!1);let $=(0,w.useRef)(!1),de=(0,w.useRef)(0),ke=(0,w.useRef)(0),et=(0,w.useRef)(!1),xt=(0,w.useRef)(0),hn=(0,w.useRef)(!1),Sr=(0,w.useRef)(0),Zo=(0,w.useRef)(null),$r=(0,w.useRef)(!1),Cs=(0,w.useRef)(null),Dp=(0,w.useRef)(null),$p=(0,w.useRef)(!1),To=(0,w.useRef)(null),hd=(0,w.useRef)(!1),hb=(0,w.useRef)(f),gb=(0,w.useRef)(!!f),gd=(0,w.useRef)(void 0),vd=(0,w.useRef)(void 0),x9=(0,w.useRef)(Z),vb=(0,w.useRef)(null),S9=(0,w.useRef)(p),Nc=(0,w.useRef)(p),C9=(0,w.useRef)(!1),yb=(0,w.useRef)(!1),yd=(0,w.useRef)(void 0),Bp=(0,w.useRef)(void 0);Nc.current=p;let wd=(0,w.useRef)(!1),Br=(0,w.useRef)(void 0),Fp=(0,w.useRef)(void 0),ai=(0,w.useRef)(void 0),zp=(0,w.useRef)(void 0),qp=(0,w.useRef)(void 0),bd=(0,w.useRef)(void 0),rg=(0,w.useRef)(void 0),wb=(0,w.useRef)(y),bb=(0,w.useRef)(L);wb.current=y,bb.current=L||t;let kb=(0,w.useRef)(null),[Pn,Ts]=(0,w.useState)(null),T9=(0,w.useRef)(!1);T9.current=Pn?.virtual===!0;let I9=(0,w.useRef)(ve.length);(0,w.useLayoutEffect)(()=>{I9.current=ve.length},[ve.length]);let xb=(0,w.useRef)(e);(0,w.useLayoutEffect)(()=>{xb.current=e},[e]);let[mU,og]=(0,w.useState)(!1),[hU,gU]=(0,w.useState)(n);hU!==n&&(gU(n),il.current.clear(),xt.current+=1,et.current=!1,wd.current=!1,Ts(null),fd(F=>F.size?new Map:F),Pc(F=>F.size?new Set:F)),(0,w.useEffect)(()=>{m||(wd.current=!1,kb.current=null)},[m]);let Up=(0,w.useCallback)(()=>{let F=Ma.current,ee=F?F.scrollHeight-F.scrollTop-F.clientHeight:0,be=!ul.current&&ee>1;Dp.current!==be&&(Dp.current=be,fe?.(be))},[fe]),er=(0,w.useCallback)(()=>{Bp.current!==void 0&&window.cancelAnimationFrame(Bp.current),Bp.current=window.requestAnimationFrame(Up)},[Up]),qt=(0,w.useCallback)(F=>{rt.current&&(F=!1),ul.current!==F&&(ul.current=F,er())},[er]),kd=(0,w.useRef)(void 0),Sb=(0,w.useRef)(!1),Pa=(0,w.useMemo)(()=>{Sb.current=!1;let F=[ye,Mc,T,S,a,qn,wt,nn,Ra,Op,te,j,J,cd,K,r,le,X,pe,sl],ee=kd.current,be=_e[_e.length-1];if(Q&&T&&ee&&ee.sourceMessages===We.current&&QB(ee.dependencies,F)&&be?.type==="message"){let dt=kw(be),Wa=-1;for(let Na=ee.value.length-1;Na>=0;Na-=1)if(kw(ee.value[Na])===dt){Wa=Na;break}if(Wa>=0){let Na=ee.value[Wa];if(Na?.type==="message"){let ao=ee.value.slice();return ao[Wa]={...Na,message:be.message},kd.current={sourceMessages:e,dependencies:F,value:ao,virtualizerItems:ee.virtualizerItems},Sb.current=!0,ao}}}let Re=F7e(_e,{overrides:Mc,isResponding:T,activeTurnStartedAt:S,terminalBackgroundShellTaskIds:a,backgroundSummaryGraceActive:qn,waitForUnmatchedAgentCompletions:wt||!nn,waitForOrderedNarration:!Ra,automaticallyExpandedAgentKeys:cd,pendingApprovalCallId:r?.toolCallId??null,includeSubagentToolUsageInMetrics:J,paginatedExpanded:ye?new Set([...sl,...ye]):sl,enabled:Op}),Te=ye?Re.map(dt=>{if(!("turnCollapse"in dt)||!dt.turnCollapse||!ye.has(dt.turnCollapse.turnId))return dt;let{turnId:Wa,collapsed:Na,hiddenCount:ao}=dt.turnCollapse;return{...dt,turnCollapse:{turnId:Wa,collapsed:Na,hiddenCount:ao}}}):Re,on=!1,bn=j?Te.map(dt=>on||dt.type!=="turn_collapse"?dt:(on=!0,{...dt,turnCollapse:{...dt.turnCollapse,...j.durationMs!==void 0&&j.durationMs>0?{elapsedMs:j.durationMs}:{},...j.inputTokens!==void 0?{inputTokens:j.inputTokens}:{},...j.outputTokens!==void 0?{outputTokens:j.outputTokens}:{},...j.cachedTokens!==void 0?{cachedTokens:j.cachedTokens}:{}}})):Te,pn=s7e(bn,cd);if(!te)return kd.current={sourceMessages:e,dependencies:F,value:pn,virtualizerItems:pn},pn;let Bt=ve.find(dt=>dt.role==="user")?.id,an=Bt?pn.filter(dt=>dt.type!=="message"||dt.message.id!==Bt):pn;return kd.current={sourceMessages:e,dependencies:F,value:an,virtualizerItems:an},an},[_e,Q,Mc,T,S,a,qn,wt,nn,Ra,Op,ye,te,j,J,ve,e,cd,K,r,le,X,pe,sl]),xd=kd.current?.sourceMessages===e?kd.current.virtualizerItems:Pa,Hp=(0,w.useCallback)(F=>xd.some(ee=>String(kw(ee))===F),[xd]),Cb=(0,w.useRef)(void 0),vU=(0,w.useMemo)(()=>{if(Sb.current&&Cb.current?.length===Pa.length)return Cb.current.value;let F=nU(Pa);return Cb.current={length:Pa.length,value:F},F},[Pa]),yU=Lc.length>=The,Ko=P!=null,Sd=!!f,dl=!!_,tr=dl?1:0,Oc=tr+Pa.length,jp=Oc+(Ko?1:0),wU=tr+_e.length+(Ko?1:0),ri=j7e(wU,B),Ha=(0,w.useCallback)(()=>Ma.current,[]),_9=(0,w.useCallback)(()=>{let F=Ma.current;if(!F)return;let ee=F.scrollHeight-F.scrollTop-F.clientHeight<Sw;$.current=!ee,qt(ee),er()},[er,qt]),Wp=(0,w.useCallback)(()=>{de.current=Date.now()+1e3},[]),sg=(0,w.useCallback)(()=>{qp.current!==void 0&&(window.clearTimeout(qp.current),qp.current=void 0)},[]),Yo=(0,w.useCallback)(()=>{sg(),bd.current?.abort(),bd.current=void 0},[sg]),Cd=(0,w.useCallback)(()=>{sg();let F=rg.current;if(F){if(k?.getSnapshot().lastEventId===F.lastEventId)return;rg.current=void 0}!I||bd.current!==void 0||$.current||bb.current||wb.current<=K$||(qp.current=window.setTimeout(()=>{if(qp.current=void 0,bb.current||$.current||wb.current<=K$)return;let ee=Ma.current;if(!ee||ee.scrollHeight-ee.scrollTop-ee.clientHeight>=Sw)return;let be=new AbortController;bd.current=be,I(be.signal).then(()=>{if(be.signal.aborted)return;let Re=k?.getSnapshot();rg.current={...Re?.lastEventId!==void 0?{lastEventId:Re.lastEventId}:{}}}).catch(Re=>{Re instanceof Error&&Re.name==="AbortError"||console.warn("[MessageList] transcript reload failed:",Re)}).finally(()=>{bd.current===be&&(bd.current=void 0)})},K9e))},[sg,I,k]);(0,w.useEffect)(()=>{rg.current=void 0},[k]),(0,w.useEffect)(()=>{if(!k)return Yo;let F=k.getSnapshot().lastEventId,ee=k.subscribe(()=>{let be=k.getSnapshot().lastEventId;be!==F&&(F=be,Cd())});return()=>{ee(),Yo()}},[k,Cd,Yo]),(0,w.useEffect)(()=>{if(L){Yo();return}Cd()},[Yo,L,Cd,y]);let Td=(0,w.useCallback)(()=>{yb.current=!0,yd.current!==void 0&&window.cancelAnimationFrame(yd.current),yd.current=window.requestAnimationFrame(()=>{yb.current=!1,yd.current=void 0,_9()})},[_9]);(0,w.useEffect)(()=>()=>{yd.current!==void 0&&window.cancelAnimationFrame(yd.current),Bp.current!==void 0&&window.cancelAnimationFrame(Bp.current),Br.current!==void 0&&window.cancelAnimationFrame(Br.current),Fp.current!==void 0&&window.cancelAnimationFrame(Fp.current),ai.current!==void 0&&window.cancelAnimationFrame(ai.current),Yo(),gd.current!==void 0&&window.cancelAnimationFrame(gd.current),vd.current!==void 0&&window.cancelAnimationFrame(vd.current)},[Yo]);let L9=(0,w.useCallback)((F,ee)=>{let be=Ma.current;(!be||be.scrollHeight>be.clientHeight+1)&&($.current=!0,qt(!1)),Td(),ll.current!==void 0&&window.clearTimeout(ll.current),md.current.clear(),Ma.current?.querySelectorAll("[data-message-row-key]").forEach(Re=>{let Te=Re.dataset.messageRowKey;Te&&md.current.set(Te,Re.getBoundingClientRect().top)}),pd.current=!0,mb(()=>{Pc(Re=>{if(!Re.has(F))return Re;let Te=new Set(Re);return Te.delete(F),Te}),fd(Re=>{let Te=new Map(Re);return Te.set(F,ee),Te})})},[Td,qt]);(0,w.useLayoutEffect)(()=>{if(Ja||!pd.current)return;pd.current=!1;for(let ee of cl.current)ee.cancel();cl.current=[];let F=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;F||Ma.current?.querySelectorAll("[data-message-row-key]").forEach(ee=>{if(typeof ee.animate!="function")return;let be=ee.dataset.messageRowKey,Re=be?md.current.get(be):void 0;if(Re===void 0){cl.current.push(ee.animate([{opacity:0},{opacity:1}],{duration:xC,easing:"ease-out"}));return}let Te=Re-ee.getBoundingClientRect().top;Math.abs(Te)<1||cl.current.push(ee.animate([{translate:`0 ${Te}px`},{translate:"0 0"}],{duration:xC,easing:"ease-out"}))}),md.current.clear(),ll.current=window.setTimeout(()=>{ll.current=void 0,Td()},F?0:xC)},[Td,Ja]),(0,w.useEffect)(()=>()=>{ll.current!==void 0&&window.clearTimeout(ll.current);for(let F of cl.current)F.cancel();cl.current=[]},[]);let bU=(0,w.useCallback)(F=>{let ee=F.target;ee instanceof HTMLElement&&ee.closest("[aria-expanded], summary")&&($.current=!0,qt(!1),Td())},[Td,qt]),Dc=(0,w.useCallback)(F=>{if(dl&&F===IC)return"slot:header";if(Ko&&F===Oc)return`slot:tail:${D}`;let ee=xd[F-tr];return ee?kw(ee):`slot:row:${F}`},[dl,Ko,Oc,D,xd,tr]),kU=(0,w.useCallback)(F=>dl&&F===IC?z7e:Ko&&F===Oc?H7e:xd[F-tr]?.type==="turn_collapse"?U7e:q7e,[dl,Ko,tr,Oc,xd]),ja=(0,w.useCallback)((F="auto")=>{if(rt.current)return;let ee=Ha();if(!ee||ee.scrollHeight<=ee.clientHeight)return;$r.current=!1,Sr.current+=1;let be=Sr.current;hn.current=!0,F==="smooth"?ee.scrollTo({top:ee.scrollHeight,behavior:F}):ee.scrollTop=ee.scrollHeight,er(),ke.current=Math.max(0,ee.scrollHeight-ee.clientHeight),Up();let Re=()=>{if(Sr.current!==be||(hn.current=!1,!$r.current)||($r.current=!1,Nc.current||$.current))return;let Te=Ha();!Te||Te.scrollHeight<=Te.clientHeight||(qt(!0),Te.scrollTop=Te.scrollHeight,er(),ke.current=Math.max(0,Te.scrollHeight-Te.clientHeight),Up())};F==="smooth"?setTimeout(Re,350):requestAnimationFrame(Re)},[Ha,Up,er,qt]),A9=(0,w.useCallback)((F="smooth")=>{$.current=!1,qt(!0),ja(F)},[ja,qt]),Qo=Goe({count:jp,enabled:ri,getScrollElement:Ha,getItemKey:Dc,estimateSize:kU,overscan:20,anchorTo:"end",useFlushSync:!1,useAnimationFrameWithResizeObserver:!0,directDomUpdates:!0});Qo.shouldAdjustScrollPositionOnItemSizeChange=(F,ee,be)=>W7e(F.end,Ma.current?.scrollTop??be.scrollOffset??0);let xU=(0,w.useCallback)(F=>{if(Qo.measureElement(F),!F||!T9.current)return;let ee=Number(F.dataset.index);Number.isFinite(ee)&&!Qo.itemSizeCache.has(Dc(ee))&&Qo.resizeItem(ee,F.offsetHeight)},[Dc,Qo]);(0,w.useLayoutEffect)(()=>{if(!Pn)return;let F=Ma.current;if(Pn.rowKey&&!Hp(Pn.rowKey)){let ee=f7e(xb.current,Pn.rowKey);if(ee!==void 0&&p7e(Pa,ee)&&Mc.get(ee)!==!1&&!sl.has(ee)){Pc(be=>be.has(ee)?be:new Set(be).add(ee)),Ts(be=>be&&{...be,rowKey:`msg:${ee}`});return}Pn.generation===xt.current&&(xt.current+=1),et.current=!1,zp.current=void 0,og(!1),Ts(null);return}if(Pn.settled){if(!F){et.current=!1,Ts(null);return}if(Pn.virtual?ve.length===Pn.messageCount:F.scrollHeight===Pn.scrollHeight){if(et.current=!1,Br.current!==void 0)return;let ee=oF,be=()=>{if(Br.current=void 0,Pn.generation===xt.current&&I9.current===Pn.messageCount){if(ee-=1,ee>0){Br.current=requestAnimationFrame(be);return}Ts(Re=>Re===Pn?null:Re)}};Br.current=requestAnimationFrame(be);return}Br.current!==void 0&&(cancelAnimationFrame(Br.current),Br.current=void 0),Br.current=requestAnimationFrame(()=>{if(Br.current=void 0,Pn.generation!==xt.current)return;if(Pn.rowKey&&!Hp(Pn.rowKey)){et.current=!1,Ts(null);return}let ee=Pn.rowKey?Array.from(F.querySelectorAll("[data-message-row-key]")).find(be=>be.dataset.messageRowKey===Pn.rowKey):void 0;ee&&Pn.rowTop!==void 0?F.scrollTop+=ee.getBoundingClientRect().top-Pn.rowTop:F.scrollTop=Pn.scrollTop+Math.max(0,F.scrollHeight-Pn.scrollHeight),et.current=!1,Ts(null)})}},[Hp,ve.length,Pn,Pa,Mc,sl]);let E9=Qo.getVirtualItems(),Id=Qo.getTotalSize(),R9=(0,w.useRef)({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});R9.current={entryIndexById:fb,headerOffset:tr,isVisible:_c,turnIdByDisplayIndex:vU,visibleItems:Pa};let M9=(0,w.useCallback)(()=>{let F=Ha(),ee=R9.current;if(!F||!ee.isVisible||ee.entryIndexById.size===0){X0(dt=>dt===null?dt:null);return}let be=F.getBoundingClientRect(),Re=be.top,Te=be.bottom,on=Re+(Te-Re)/2,bn=[],pn=null,Bt=Number.POSITIVE_INFINITY;F.querySelectorAll("[data-index]").forEach(dt=>{let Wa=dt.dataset.index;if(Wa===void 0)return;let Na=Number(Wa);if(!Number.isFinite(Na))return;let ao=Na-ee.headerOffset;if(ao<0||ao>=ee.visibleItems.length)return;let Bc=dt.getBoundingClientRect();if(Bc.bottom<Re||Bc.top>Te)return;bn.push(ao);let CU=Bc.top+(Bc.bottom-Bc.top)/2,$9=Math.abs(CU-on);$9<Bt&&(Bt=$9,pn=ao)});let an=R7e(ee.visibleItems,bn,ee.entryIndexById,pn,ee.turnIdByDisplayIndex);X0(dt=>dt?.startIndex===an?.startIndex&&dt?.endIndex===an?.endIndex&&dt?.currentIndex===an?.currentIndex?dt:an)},[Ha]),fl=(0,w.useCallback)(()=>{Cs.current!==null&&cancelAnimationFrame(Cs.current),Cs.current=requestAnimationFrame(()=>{Cs.current=null,M9()})},[M9]);(0,w.useEffect)(()=>()=>{Zo.current!==null&&(clearTimeout(Zo.current),Zo.current=null),Cs.current!==null&&(cancelAnimationFrame(Cs.current),Cs.current=null)},[]),(0,w.useEffect)(()=>{fl()},[fl,jp,Id,ri,E9.length,_c]);let[Gp,Tb]=(0,w.useState)(null);(0,w.useEffect)(()=>{if(!Gp)return;let F=setTimeout(()=>Tb(null),1600);return()=>clearTimeout(F)},[Gp]);let Ib=(0,w.useCallback)((F,ee)=>{$.current=!0,qt(!1),Sr.current+=1;let be=Sr.current;if(hn.current=!0,ri)if(rt.current){let Re=Qo.getOffsetForIndex(F,"center");Re&&Ma.current&&(Ma.current.scrollTop=Re[0])}else Qo.scrollToIndex(F,{align:"center"});else Ma.current?.querySelector(`[data-index="${F}"]`)?.scrollIntoView({block:"center"});Zo.current!==null&&clearTimeout(Zo.current),Zo.current=setTimeout(()=>{Zo.current=null,Sr.current===be&&(hn.current=!1,fl(),er())},150),Tb(null),requestAnimationFrame(()=>Tb(ee))},[ri,Qo,qt,fl,er]),P9=(0,w.useRef)({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});P9.current={visibleItems:Pa,displayItems:_e,headerOffset:tr,performScrollToRow:Ib};let $c=(0,w.useRef)(null),Vp=(0,w.useCallback)((F,ee)=>{let{visibleItems:be,displayItems:Re,headerOffset:Te,performScrollToRow:on}=P9.current,bn=xw(be,F,ee);if(bn>=0)return $c.current=null,on(bn+Te,{messageId:F,callId:ee}),!0;let pn=xw(Re,F,ee);if(pn<0)return!1;let Bt=tU(Re,pn);return Bt?($c.current={messageId:F,callId:ee},fd(an=>{if(an.get(Bt)===!0)return an;let dt=new Map(an);return dt.set(Bt,!0),dt}),!0):!1},[]);(0,w.useImperativeHandle)(at,()=>({scrollToMessage:Vp,scrollToBottom:A9}),[Vp,A9]),(0,w.useEffect)(()=>{let F=$c.current;if(!F)return;let ee=xw(Pa,F.messageId,F.callId);ee<0||($c.current=null,Ib(ee+tr,F))},[Pa,tr,Ib]);let Is=(0,w.useCallback)(async(F=!1,ee=!1)=>{let be=Ma.current;if(!be||!v||h||et.current||b&&!ee||wd.current&&!F)return;wd.current=!1,et.current=!0;let Re=++xt.current;Br.current!==void 0&&(cancelAnimationFrame(Br.current),Br.current=void 0),og(!ee);let Te;if(ri){let an=String(Dc(tr)),dt=oF;if(Te=await new Promise(Wa=>{let Na=()=>{if(Fp.current=void 0,Re!==xt.current||Ma.current!==be||!Hp(an)||dt--<=0){Wa(void 0);return}let ao=Array.from(be.querySelectorAll("[data-message-row-key]")).find(Bc=>Bc.dataset.messageRowKey===an);ao?Wa({rowKey:an,rowTop:ao.getBoundingClientRect().top}):Fp.current=requestAnimationFrame(Na)};Fp.current=requestAnimationFrame(Na)}),!Te){Re===xt.current&&(et.current=!1,zp.current=void 0,og(!1));return}}let on=be.scrollHeight,bn=be.scrollTop,pn=be.getBoundingClientRect().top,Bt=Te?void 0:Array.from(be.querySelectorAll("[data-message-row-key]")).find(an=>{let dt=an.dataset.messageRowKey;return dt!==void 0&&dt.startsWith("msg:")&&an.getBoundingClientRect().bottom>pn});$.current=!0,Ts({scrollHeight:on,scrollTop:bn,messageCount:ve.length,virtual:ri,settled:!1,generation:Re,...Te??(Bt?{rowKey:Bt.dataset.messageRowKey,rowTop:Bt.getBoundingClientRect().top}:{})});try{il.current.set(Re,{ids:new Set(xb.current.map(dt=>dt.id)),resolved:!1}),await v(ee?{force:!0}:void 0);let an=il.current.get(Re);an&&(an.resolved=!0),Re===xt.current&&Ts(dt=>dt?.generation===Re?{...dt,settled:!0}:dt)}catch{il.current.delete(Re),Re===xt.current&&(wd.current=!0,et.current=!1,Ts(null))}finally{Re===xt.current&&og(!1)}},[h,v,b,Dc,Hp,tr,ve.length,ri]),SU=(0,w.useCallback)(()=>{Is(!0,!0)},[Is]);(0,w.useLayoutEffect)(()=>{let F=il.current;if(F.size===0)return;let ee=e.find(bn=>!bn?.id.startsWith("local-"));if(!ee)return;let be=F.entries().next().value;if(!be)return;let[Re,Te]=be;if(Te.ids.has(ee.id))return;let on=[];for(let bn=0;bn<e.length;bn++){let pn=e[bn];if(!pn||!Qr(pn)||Te.ids.has(pn.id))continue;let Bt=!1;for(let an=bn+1;an<e.length;an++){let dt=e[an];if(Qr(dt))break;if(Te.ids.has(dt.id)){Bt=!0;break}}Bt&&on.push(pn.id)}if(on.length===0){if(!Te.resolved)return}else Pc(bn=>{let pn=null;for(let Bt of on)bn.has(Bt)||(pn??=new Set(bn),pn.add(Bt));return pn??bn});F.delete(Re);for(let bn of F.values())for(let pn of e)pn&&bn.ids.add(pn.id)},[e]),(0,w.useEffect)(()=>{let F=zp.current;if(F===void 0||h||Pn||et.current||(zp.current=void 0,!m||F!==xt.current))return;let ee=Ha();ee&&ee.scrollTop<=_C&&Is(!0)},[Ha,m,Is,h,Pn]);let _b=(0,w.useCallback)(()=>{let F=Ha();if(!F)return;let ee=F.scrollTop;m&&ee<=_C&&Is(!0);let be=Date.now()<=de.current;if(hn.current&&!be){ke.current=ee;return}fl();let Re=ke.current;ke.current=ee;let Te=F.scrollHeight-ee-F.clientHeight;if(er(),ee<Re-1){let on=Te<Sw;be?(Yo(),$.current=!0,qt(!1)):on?($.current=!1,qt(!0)):$.current||(Yo(),qt(!1));return}Te<Sw?($.current=!1,qt(!0),Cd()):Yo()},[Ha,m,Is,er,fl,Cd,Yo,qt]);(0,w.useEffect)(()=>{let F=Ha();if(F)return F.addEventListener("scroll",_b,{passive:!0}),()=>F.removeEventListener("scroll",_b)},[Ha,_b]);let ig=(0,w.useCallback)(()=>{if(!m||h||p||Sd)return;let F=Ha();if(!F||F.scrollHeight>F.clientHeight+1)return;let ee=kb.current;if(ee!==null&&ee.loader===v&&ee.totalVirtualSize===Id){wd.current=!0;return}kb.current={loader:v,totalVirtualSize:Id},Is()},[p,Ha,m,Is,h,v,Sd,Id]);(0,w.useEffect)(()=>{ig()},[ig,Id]),(0,w.useEffect)(()=>{let F=Ha();if(!F)return;let ee=()=>{if(ai.current=void 0,!(F.scrollTop>_C)){if(h||et.current){zp.current=xt.current;return}Is(!0)}},be=()=>{ai.current!==void 0&&cancelAnimationFrame(ai.current),ai.current=requestAnimationFrame(ee)},Re=Bt=>{Wp(),Bt.deltaY<0&&be()},Te=()=>{Wp()},on=()=>be(),bn=Bt=>{let an=F.getBoundingClientRect(),dt=20;(Bt.clientX>=an.right-dt||Bt.clientY>=an.bottom-dt)&&Wp()},pn=Bt=>{(Bt.key==="ArrowUp"||Bt.key==="ArrowDown"||Bt.key==="PageUp"||Bt.key==="PageDown"||Bt.key==="Home"||Bt.key==="End"||Bt.key===" ")&&(Wp(),(Bt.key==="ArrowUp"||Bt.key==="PageUp"||Bt.key==="Home")&&be())};return F.addEventListener("wheel",Re,{passive:!0}),F.addEventListener("touchstart",Te,{passive:!0}),F.addEventListener("touchmove",on,{passive:!0}),F.addEventListener("pointerdown",bn,{passive:!0}),F.addEventListener("keydown",pn,{passive:!0}),()=>{F.removeEventListener("wheel",Re),F.removeEventListener("touchstart",Te),F.removeEventListener("touchmove",on),F.removeEventListener("pointerdown",bn),F.removeEventListener("keydown",pn),ai.current!==void 0&&(cancelAnimationFrame(ai.current),ai.current=void 0)}},[Ha,Is,h,Wp]),(0,w.useEffect)(()=>{let F=Ha();if(!F||typeof ResizeObserver>"u")return;let ee=new ResizeObserver(()=>{er(),ig(),!(Nc.current||$.current)&&(qt(!0),ja())});ee.observe(F);for(let Re of Array.from(F.children))ee.observe(Re);let be=new MutationObserver(Re=>{for(let Te of Re){for(let on of Array.from(Te.addedNodes))on instanceof HTMLElement&&ee.observe(on);for(let on of Array.from(Te.removedNodes))on instanceof HTMLElement&&ee.unobserve(on)}er()});return be.observe(F,{childList:!0}),er(),()=>{ee.disconnect(),be.disconnect()}},[Ha,ig,er,ja,qt]),(0,w.useEffect)(()=>{e.length===0&&($.current=!1,$r.current=!1,qt(!0),$c.current=null,il.current.clear(),fd(F=>F.size?new Map:F),Pc(F=>F.size?new Set:F))},[e.length,qt]),(0,w.useEffect)(()=>{let F=Ma.current;if(!F)return;let ee=new ResizeObserver(()=>{fl(),!Nc.current&&($.current||(qt(!0),requestAnimationFrame(()=>{!Nc.current&&!$.current&&ja()})))});return ee.observe(F),()=>ee.disconnect()},[ja,fl,qt]),(0,w.useLayoutEffect)(()=>{let F=J9e(e);if(p||f||hb.current){To.current=F,$p.current=!0,hd.current=!1,hb.current=f;return}if(hb.current=f,!$p.current){To.current=F,$p.current=!0,hd.current=!1;return}let ee=e7e(e);F&&ee?.role==="user"&&F!==To.current?($.current=!1,qt(!0),$c.current=null,hd.current=!0):hd.current=!1,To.current=F},[e,p,f,qt]),(0,w.useLayoutEffect)(()=>{S9.current&&!p&&($.current=!1,qt(!0),ja("auto")),S9.current=p},[p,ja,qt]),(0,w.useLayoutEffect)(()=>{if(f){gb.current=!0;return}if(!gb.current||p||e.length===0)return;gb.current=!1,$.current=!1,qt(!0),$c.current=null,gd.current!==void 0&&window.cancelAnimationFrame(gd.current),vd.current!==void 0&&window.cancelAnimationFrame(vd.current);let F=()=>{Nc.current||$.current||(qt(!0),ja("auto"))};gd.current=window.requestAnimationFrame(()=>{gd.current=void 0,F(),vd.current=window.requestAnimationFrame(()=>{vd.current=void 0,F()})})},[p,f,e.length,ja,qt]),(0,w.useLayoutEffect)(()=>{let F=x9.current!==Z;x9.current=Z,F&&(p||$.current||(qt(!0),requestAnimationFrame(()=>{!Nc.current&&!$.current&&ja("auto")})))},[Z,p,ja,qt]);let lg=(0,w.useMemo)(()=>C7e(Pa),[Pa]);(0,w.useLayoutEffect)(()=>{if(!p){if(!lg){vb.current=null;return}lg!==vb.current&&(vb.current=lg,(ul.current||!$.current)&&requestAnimationFrame(()=>{$.current||(qt(!0),ja())}))}},[p,lg,ja,qt]),(0,w.useEffect)(()=>{z&&Ko&&!C9.current&&($.current=!1,qt(!0),requestAnimationFrame(()=>{$.current||ja()})),C9.current=Ko},[z,Ko,ja,qt]);let N9=(0,w.useCallback)(F=>{let ee=Te=>{if(Te.type==="parallel_agents")return(0,u.jsx)(RC,{timestamp:Te.timestamp,children:(0,u.jsx)("div",{className:aF(Te,Gp)?ol.flash:void 0,children:(0,u.jsx)(Iz,{agents:Te.agents,autoManageExpansion:en==="interactive"&&!p,automaticCollapseDelayMs:Rp.key===Te.key&&!xr?Y9e:void 0,deferAutomaticCollapse:Rp.key===Te.key&&xr,expandActiveWhenLive:T&&ni.has(Te.key),onAutomaticExpansionChange:Na=>G0(Te.key,Na),pendingApproval:r})})});if(Te.type==="turn_outputs")return(0,u.jsx)(K6e,{changes:Te.changes,turnId:Te.turnId,artifacts:Te.artifacts,scheduledTasks:Te.scheduledTasks,workspaceCwd:E,onOpenRequest:ie,onReviewChanges:Ee??kC,onOpenArtifact:Me??kC,onOpenScheduledTask:U??kC,onError:Ze});if(Te.type==="turn_collapse")return(0,u.jsx)(K7e,{turnCollapse:Te.turnCollapse,onToggleCollapse:L9});let on=Te.message.role==="assistant"?dd.get(Te.message.id):void 0,bn;Te.message.role==="assistant"&&on&&!t&&(bn={turnId:on,message:{id:Te.message.id,content:Te.message.content,isStreaming:Te.message.isStreaming,timestamp:Te.message.timestamp}});let pn=on?eg.get(on):void 0,Bt=Te.message.promptId??pn?.promptId,an=Te.message.role==="assistant"?Te.message.branchRecordId:void 0,dt=Te.message.role==="user"?Te.message.content:void 0,Wa=dt!==void 0&&Te.message.id===Ce.lastId&&!T&&!m&&!g?{turnIndex:Ce.turnIndexById.get(Te.message.id)??0,content:dt}:void 0;return(0,u.jsx)(p6e,{message:Te.message,onLocateBackgroundSource:Te.message.role==="system"&&Te.message.source==="background_notification_turn_started"&&Te.message.backgroundTurn?.toolUseId&&xw(_e,"",Te.message.backgroundTurn.toolUseId)>=0?Vp:void 0,pendingApproval:r,onShowContextDetail:o,onImagePreview:s,onAttachmentPreview:i,onTurnOutputOpen:ie,onInsightReportOpen:l,onEditUserMessage:c&&Wa?()=>c(Wa.turnIndex,Wa.content):void 0,onSubmitUserMessageEdit:d&&Wa?Na=>d(Wa.turnIndex,Na):void 0,workspaceCwd:E,showRetryHint:R,onRetryClick:W,sendFailed:Te.message.role==="user"&&Te.message.id===V,onRetrySend:N,onBranchSession:ne,branchRecordId:an,showAssistantActions:Te.message.role==="assistant"&&dd.has(Te.message.id),showAssistantBranch:Te.message.role==="assistant"&&!T&&an!==void 0,assistantFeedbackTurnId:Ec?on:void 0,assistantFeedbackPromptId:Ec?Bt:void 0,assistantFeedbackRating:Ec&&Bt?Y0[Bt]:void 0,onAssistantFeedbackRate:Np,isLocateFlashing:aF(Te,Gp),assistantTurnFooterInfo:bn,turnSources:on?Rc.get(on):void 0,onSourceOpen:ae,generateContent:$e})};if(dl&&F===IC)return _;if(Ko&&F===Oc)return P;let be=F-tr,Re=Pa[be];return Re?ee(Re):null},[dl,_,Ko,P,Oc,r,p,T,xr,ni,Rp,en,G0,o,_e,Vp,s,i,l,c,d,Ce,m,g,$e,tr,Pa,Gp,dd,Ec,eg,Y0,Np,t,E,R,W,V,N,ne,L9,Me,U,Ee,ie,Rc,ae,Ze]),O9=(0,w.useCallback)(F=>F?Y7e(F):void 0,[]),D9=ri?Id:e;return(0,w.useLayoutEffect)(()=>{if(p)return;let F=hd.current;if(hn.current&&!F){$.current||($r.current=!0);return}yb.current&&!F||(ul.current||F||!$.current)&&($.current||qt(!0),ja(F?"smooth":"auto"),hd.current=!1)},[D9,jp,p,ja,qt]),(0,w.useLayoutEffect)(()=>{er()},[D9,er,jp]),(0,u.jsxs)("div",{ref:Ma,className:k6(Mt.list,dl&&A?Mt.listWithWelcomeHeader:void 0),"data-web-shell-message-list":!0,onClickCapture:bU,children:[Sd&&(0,u.jsx)(n8e,{label:yt("editor.sessionLoading")}),h&&!Sd&&!mU&&(0,u.jsx)("div",{className:Mt.historyStatus,role:"status",children:yt("history.loadingEarlier")}),g&&!Sd&&(0,u.jsx)("div",{className:Mt.historyStatus,role:"status",children:yt("history.capacityReached")}),b&&!Sd&&!g&&(0,u.jsxs)("div",{className:Mt.historyStatus,children:[(0,u.jsx)("span",{role:"status",children:yt("history.paginationError")}),v&&(0,u.jsx)("button",{type:"button",className:Mt.historyRetryButton,onClick:SU,children:yt("history.retry")})]}),(0,u.jsx)(e8e,{entries:Lc,currentTurnId:Z0,currentRange:Mp,hidden:!_c||!yU,onSelect:Vp}),ri?(0,u.jsx)("div",{ref:Qo.containerRef,className:Mt.virtualSizer,children:E9.map(F=>(0,u.jsx)("div",{"data-index":F.index,ref:xU,className:k6(Mt.virtualRow,O9(Pa[F.index-tr])),"data-message-row-key":String(Dc(F.index)),"data-source-block-ids":rF(Pa[F.index-tr],e),"data-web-shell-message-row":!0,style:{position:"absolute",top:0,left:0,right:0},children:N9(F.index)},F.key))}):Array.from({length:jp},(F,ee)=>{let be=Dc(ee),Re=Pa[ee-tr];return(0,u.jsx)("div",{"data-index":ee,className:O9(Re),"data-message-row-key":String(be),"data-source-block-ids":rF(Re,e),"data-web-shell-message-row":!0,children:N9(ee)},be)})]})})),lF={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"}},r8e={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},o8e={margin:0,fontSize:"1rem",fontWeight:600},s8e={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},i8e={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 l8e({error:e,onRetry:t,language:n="en",retryMode:a="reset"}){let r=lF[n]??lF.en;return(0,u.jsxs)("div",{role:"alert",style:r8e,"data-web-shell-error":!0,children:[(0,u.jsx)("p",{style:o8e,children:r.title}),(0,u.jsx)("p",{style:s8e,children:r.body}),!1,(0,u.jsx)("button",{type:"button",style:i8e,onClick:t,children:a==="reload"?r.reload:r.retry})]})}function c8e(e,t,n=!1){return rhe(e,{safeToolProjection:n,includeSourceIdentity:!0,labels:{promptCancelled:t("request.cancelled"),branchSuccess:a=>t("branch.success",{name:a}),modelStreamInterrupted:t("error.modelStreamInterrupted"),loopDetected:t("error.loopDetected")}})}var u8e="_app_lcwch_1",d8e="_appChat_lcwch_66",f8e="_content_lcwch_119",p8e="_themeDark_lcwch_437",m8e="_themeLight_lcwch_511",h8e="_contentHasMessages_lcwch_593",gp={app:u8e,appChat:d8e,content:f8e,themeDark:p8e,themeLight:m8e,contentHasMessages:h8e},g8e=1e3,v8e=40;function iU(e){if(e!==void 0)return p$(e);if(typeof window>"u")return"en";let t=new URLSearchParams(window.location.search);return p$(t.get("language")??t.get("lang")??navigator.language)}function y8e(e){let t=`${typeof e=="number"&&Number.isFinite(e)&&e>0?e:g8e}px`,n=`calc(${t} + ${v8e}px)`;return{"--chat-regular-content-width":t,"--chat-regular-shell-width":n,"--chat-content-width":t,"--chat-shell-width":n}}function w8e({blocks:e,renderMode:t="readonly",theme:n=m0.Dark,language:a,className:r,style:o,chatMaxWidth:s,workspaceCwd:i="",compactThinking:l=!1,documentExpanded:c=!0,collapseCompletedTurns:d,markdownTableMode:f="basic",virtualScrollThreshold:p,markdown:m,sourceSessionId:h,sources:g,sourceAttachments:b,sourceReferences:v,getAssistantSourcesIcon:y,onSourceOpen:k,composerTagIcons:I,artifact:T,renderToolHeaderExtra:L,parseUserMessageContent:S,renderUserMessageContent:_,renderComposerTag:A,renderComposerTagTooltip:E,renderAssistantTurnFooter:P,mcpAppBaseUrl:D}){let B=t==="document",z=!B&&(d??!0),Z=B?"basic":f,G=iU(a),te=(0,w.useMemo)(()=>hF(G),[G]),j=(0,w.useMemo)(()=>c8e(e,te,B),[e,B,te]),J=(0,w.useMemo)(()=>Ioe(g??[],b??[]),[g,b]),R=(0,w.useMemo)(()=>qme(j),[j]),W=(0,w.useMemo)(()=>Ome(j),[j]),V=(0,w.useMemo)(()=>({artifact:T,composerTagIcons:I,renderToolHeaderExtra:L,parseUserMessageContent:S,renderUserMessageContent:_,renderComposerTag:A,renderComposerTagTooltip:E,renderAssistantTurnFooter:P,compactThinking:l,collapseCompletedTurns:z,markdownTableMode:Z,markdown:m,sourceReferences:v,getAssistantSourcesIcon:y}),[T,z,l,I,m,v,y,Z,S,P,A,E,L,_]),N=(0,w.useRef)(null),[ne,fe]=(0,w.useState)(null),le=(0,w.useRef)(new Set),X=[gp.app,gp.appChat,n===m0.Light?gp.themeLight:gp.themeDark,n===m0.Dark?"dark":void 0,r].filter(Boolean).join(" "),se=(0,w.useMemo)(()=>({...o,...y8e(s)}),[s,o]);return(0,w.useLayoutEffect)(()=>{if(typeof document>"u")return;let ce=document.createElement("div");return ce.dataset.webShellPortalRoot="",ce.dataset.webShellShadcn="",document.body.appendChild(ce),fe(ce),()=>{ce.remove(),fe(null)}},[]),(0,w.useLayoutEffect)(()=>{let ce=N.current;if(!ce||!ne)return;let ae=null,pe=()=>{ae=null;let ie=getComputedStyle(ce),Ze=new Set;ne.dataset.webShellShadcn="",ne.classList.toggle("dark",n===m0.Dark),ne.lang=G;for(let $e=0;$e<ie.length;$e+=1){let at=ie[$e];at.startsWith("--")&&(Ze.add(at),ne.style.setProperty(at,ie.getPropertyValue(at)))}for(let $e of le.current)Ze.has($e)||ne.style.removeProperty($e);le.current=Ze},Ee=()=>{ae===null&&(ae=requestAnimationFrame(pe))};pe();let Me=new MutationObserver(Ee),U=ce;for(;U;)Me.observe(U,{attributes:!0,attributeFilter:["class","style","data-theme","lang"]}),U=U.parentElement;return window.addEventListener("resize",Ee),()=>{Me.disconnect(),window.removeEventListener("resize",Ee),ae!==null&&cancelAnimationFrame(ae)}},[ne,G,X,se,n]),(0,u.jsx)(gie,{value:n,children:(0,u.jsx)(nse,{language:G,children:(0,u.jsx)(Bq.Provider,{value:D,children:(0,u.jsx)(gF.Provider,{value:ne,children:(0,u.jsx)(ase,{value:t,children:(0,u.jsx)(rse,{value:c,children:(0,u.jsx)(Eoe,{value:V,children:(0,u.jsx)(Aoe,{timeline:W,details:R,children:(0,u.jsx)(x6.Provider,{value:!1,children:(0,u.jsx)("div",{ref:N,className:X,style:se,"data-web-shell-root":!0,"data-web-shell-shadcn":!0,"data-transcript-render-mode":t,"data-document-expanded":B?String(c):void 0,lang:G,children:(0,u.jsx)("div",{className:`${gp.content} ${gp.contentHasMessages}`,children:(0,u.jsx)(a8e,{messages:j,sourceSessionId:h,sourceEntries:B?void 0:J,onSourceOpen:k,pendingApproval:null,isResponding:!1,workspaceCwd:i,virtualScrollThreshold:B?Number.MAX_SAFE_INTEGER:p,hideSessionTimeline:B})})})})})})})})})})})})}function lU(e){let t=iU(e.language);return(0,u.jsx)(ed,{label:"web-shell-transcript-root",resetKeys:[e.blocks,t],fallback:(n,a)=>(0,u.jsx)(l8e,{error:n,onRetry:a,language:t}),children:(0,u.jsx)(w8e,{...e})})}var vt=Ue(la(),1),dU="qwen-export-theme";function id(e){return e===void 0||typeof e=="string"}function ld(e){return e===void 0||typeof e=="number"&&Number.isFinite(e)&&e>=0}function b8e(){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 n=JSON.parse(t);if(n.schemaVersion!==1||n.rendererVersion!=="1.0.2+014ed3c257160dd2"||!Array.isArray(n.blocks)||n.blocks.length>1e3||!n.metadata||typeof n.metadata!="object"||Array.isArray(n.metadata)||!id(n.metadata.title)||!id(n.metadata.startedAt)||!id(n.metadata.projectName)||!id(n.metadata.repository)||!id(n.metadata.gitBranch)||!id(n.metadata.model)||!id(n.metadata.channel)||!ld(n.metadata.promptCount)||!ld(n.metadata.contextUsagePercent)||!ld(n.metadata.contextWindowSize)||!ld(n.metadata.totalTokens)||!ld(n.metadata.filesWritten)||!ld(n.metadata.linesAdded)||!ld(n.metadata.linesRemoved)||typeof n.metadata.exportedAt!="string"||typeof n.metadata.complete!="boolean"||typeof n.metadata.truncated!="boolean")throw new Error("Transcript document is incompatible with this renderer.");return n}function k8e(){try{let e=localStorage.getItem(dU);if(e==="light"||e==="dark")return e}catch{}return"dark"}function cU(e){if(!e)return;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function x8e(e){if(e!==void 0)return e>=1e6?`${e/1e6}m`:e>=1e3?`${e/1e3}k`:String(e)}function eo({label:e,value:t}){return t===void 0||t===""?null:(0,vt.jsxs)("div",{className:"document-metadata-item",children:[(0,vt.jsx)("dt",{children:e}),(0,vt.jsx)("dd",{children:t})]})}function S8e({metadata:e}){let t=e.contextUsagePercent===void 0?void 0:`${e.contextUsagePercent>100?">100":e.contextUsagePercent}%${e.contextWindowSize===void 0?"":` of ${x8e(e.contextWindowSize)}`}`;return(0,vt.jsxs)("aside",{className:"document-metadata","data-document-metadata":!0,children:[(0,vt.jsxs)("section",{children:[(0,vt.jsx)("h2",{children:"Session Info"}),(0,vt.jsxs)("dl",{children:[(0,vt.jsx)(eo,{label:"Session",value:e.title??"Ziroo Chat Export"}),(0,vt.jsx)(eo,{label:"Started",value:cU(e.startedAt)}),(0,vt.jsx)(eo,{label:"Exported",value:cU(e.exportedAt)}),(0,vt.jsx)(eo,{label:"Project",value:e.projectName}),(0,vt.jsx)(eo,{label:"Repository",value:e.repository}),(0,vt.jsx)(eo,{label:"Branch",value:e.gitBranch}),(0,vt.jsx)(eo,{label:"Model",value:e.model}),(0,vt.jsx)(eo,{label:"Channel",value:e.channel})]})]}),(0,vt.jsxs)("section",{children:[(0,vt.jsx)("h2",{children:"Statistics"}),(0,vt.jsxs)("dl",{children:[(0,vt.jsx)(eo,{label:"Prompts",value:e.promptCount}),(0,vt.jsx)(eo,{label:"Context Usage",value:t}),(0,vt.jsx)(eo,{label:"Tokens",value:e.totalTokens?.toLocaleString()})]})]}),(0,vt.jsxs)("section",{children:[(0,vt.jsx)("h2",{children:"File Operations"}),(0,vt.jsxs)("dl",{children:[(0,vt.jsx)(eo,{label:"Files modified",value:e.filesWritten}),(0,vt.jsx)(eo,{label:"Lines added",value:e.linesAdded}),(0,vt.jsx)(eo,{label:"Lines removed",value:e.linesRemoved})]})]})]})}function C8e({value:e}){let[t,n]=(0,to.useState)(k8e),[a,r]=(0,to.useState)(!0),o=(0,to.useRef)(a),s=(0,to.useRef)(null);return(0,to.useEffect)(()=>{document.documentElement.classList.toggle("dark",t==="dark"),document.documentElement.classList.toggle("light",t==="light");try{localStorage.setItem(dU,t)}catch{}},[t]),(0,to.useEffect)(()=>{o.current=a},[a]),(0,to.useEffect)(()=>{let i=()=>{s.current=o.current,(0,b9.flushSync)(()=>r(!0))},l=()=>{let c=s.current;s.current=null,c!==null&&(0,b9.flushSync)(()=>r(c))};return addEventListener("beforeprint",i),addEventListener("afterprint",l),()=>{removeEventListener("beforeprint",i),removeEventListener("afterprint",l)}},[]),(0,to.useEffect)(()=>{document.title=e.metadata.title||"Ziroo Chat Export",requestAnimationFrame(()=>{document.body.dataset.renderComplete="true"})},[e.metadata.title]),(0,vt.jsxs)("main",{className:"document-shell",children:[(0,vt.jsxs)("header",{className:"document-header",children:[(0,vt.jsxs)("div",{children:[(0,vt.jsx)("h1",{children:e.metadata.title||"Ziroo Chat Export"}),(0,vt.jsx)("p",{children:e.metadata.startedAt?`Started ${e.metadata.startedAt}`:`Exported ${e.metadata.exportedAt}`})]}),(!e.metadata.complete||e.metadata.truncated)&&(0,vt.jsx)("span",{className:"document-warning",children:"Partial export"}),(0,vt.jsxs)("div",{className:"document-actions","aria-label":"Document controls",children:[(0,vt.jsx)("button",{type:"button","data-document-expand-all":!0,disabled:a,onClick:()=>r(!0),children:"Expand all"}),(0,vt.jsx)("button",{type:"button","data-document-collapse-all":!0,disabled:!a,onClick:()=>r(!1),children:"Collapse all"}),(0,vt.jsx)("button",{type:"button","data-document-theme-toggle":!0,"aria-label":`Switch to ${t==="dark"?"light":"dark"} theme`,onClick:()=>n(i=>i==="dark"?"light":"dark"),children:t==="dark"?"Light theme":"Dark theme"})]})]}),(0,vt.jsxs)("div",{className:"document-content",children:[(0,vt.jsx)("div",{className:"document-transcript",children:(0,vt.jsx)(lU,{blocks:e.blocks,renderMode:"document",compactThinking:!0,documentExpanded:a,theme:t})}),(0,vt.jsx)(S8e,{metadata:e.metadata})]})]})}function fU(){return(0,to.useEffect)(()=>{document.body.dataset.renderComplete="error"},[]),(0,vt.jsxs)("main",{className:"document-error",role:"alert",children:[(0,vt.jsx)("h1",{children:"Unable to open this chat export"}),(0,vt.jsx)("p",{children:"The file is incomplete or uses an incompatible renderer version."})]})}var k9=class extends to.Component{constructor(){super(...arguments);this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,vt.jsx)(fU,{}):this.props.children}},pU=document.getElementById("app");if(!pU)throw new Error("Transcript document root is missing.");if(document.body.dataset.renderComplete!=="error"){let e=(0,uU.createRoot)(pU);try{e.render((0,vt.jsx)(k9,{children:(0,vt.jsx)(C8e,{value:b8e()})}))}catch{e.render((0,vt.jsx)(fU,{}))}}})();
|