gerege-cli 0.26.5 → 0.26.6

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.
Files changed (237) hide show
  1. package/README.md +8 -8
  2. package/chunks/{MaxSizedBox-VMVLMS4X.js → MaxSizedBox-QCIXIS4P.js} +1 -1
  3. package/chunks/{StandaloneSessionPicker-UNORCVYY.js → StandaloneSessionPicker-BAFAIRT7.js} +1 -1
  4. package/chunks/{acp-subagent-executor-623ZUTJT.js → acp-subagent-executor-TPVXURLW.js} +1 -1
  5. package/chunks/{acpAgent-MTTDTK2C.js → acpAgent-67UN66PB.js} +3 -3
  6. package/chunks/{advisor-ANUGICJ5.js → advisor-SAXMI4QZ.js} +1 -1
  7. package/chunks/{agent-GNCQDICJ.js → agent-KV7BXY6C.js} +1 -1
  8. package/chunks/{agent-headless-OPUXAXQM.js → agent-headless-FQX3JGG6.js} +1 -1
  9. package/chunks/{agent-host-client-K6GRPTFD.js → agent-host-client-L5EHC4AC.js} +1 -1
  10. package/chunks/{agent-host-connections-MF3YBZU2.js → agent-host-connections-EDBMCVQF.js} +1 -1
  11. package/chunks/{anthropicContentGenerator-OK4PFE5Y.js → anthropicContentGenerator-V7TX2NXP.js} +1 -1
  12. package/chunks/{autofix-pr-MABTGEHZ.js → autofix-pr-WP34NYHL.js} +1 -1
  13. package/chunks/{batch-V2NJT3M5.js → batch-XFVQ4BLM.js} +1 -1
  14. package/chunks/{bridge-BJQ627CX.js → bridge-AE7AFEXB.js} +1 -1
  15. package/chunks/{channel-settings-store-4JMCI4UR.js → channel-settings-store-X63P5OVT.js} +1 -1
  16. package/chunks/{chunk-ZN57TOVA.js → chunk-2DU2WMTL.js} +1 -1
  17. package/chunks/{chunk-Z5XENA4A.js → chunk-2JGTWRZJ.js} +8 -7
  18. package/chunks/{chunk-MTW3A3KT.js → chunk-2LWJGXTW.js} +1 -1
  19. package/chunks/{chunk-OCBJCZC2.js → chunk-2N3NBTYJ.js} +1 -1
  20. package/chunks/{chunk-WI4UMN3Q.js → chunk-2TAJ5STJ.js} +1 -1
  21. package/chunks/{chunk-EIILQ6KT.js → chunk-32XHDDIA.js} +1 -1
  22. package/chunks/{chunk-FNXO5KWB.js → chunk-34HC2AXI.js} +2 -2
  23. package/chunks/{chunk-2X3UF2CF.js → chunk-3W32X2DH.js} +1 -1
  24. package/chunks/{chunk-CKZRJP4F.js → chunk-4ME3BUJK.js} +1 -1
  25. package/chunks/{chunk-NVSKOSFG.js → chunk-4NDJKNN6.js} +1 -1
  26. package/chunks/{chunk-BRPJ5EHA.js → chunk-5EXL4TKQ.js} +1 -1
  27. package/chunks/{chunk-3XBJYUWP.js → chunk-65ME4BOH.js} +1 -1
  28. package/chunks/{chunk-TQTIEK2W.js → chunk-7453BHJO.js} +1 -1
  29. package/chunks/{chunk-HSYBIGMS.js → chunk-76FSYQTG.js} +1 -1
  30. package/chunks/{chunk-FNB3DPQZ.js → chunk-7RNOS7R4.js} +1 -1
  31. package/chunks/{chunk-H57IX45A.js → chunk-AEKEZRIU.js} +1 -1
  32. package/chunks/{chunk-CXGGC4NO.js → chunk-AEZYXPFS.js} +1 -1
  33. package/chunks/{chunk-NGOIJH7K.js → chunk-AFO5ER23.js} +1 -1
  34. package/chunks/{chunk-UY2ET2AL.js → chunk-AYVCT5FF.js} +1 -1
  35. package/chunks/{chunk-QOYRDEXR.js → chunk-B37YY4XU.js} +1 -1
  36. package/chunks/{chunk-IDUGQMTP.js → chunk-BAUMVH4Q.js} +1 -1
  37. package/chunks/{chunk-CAPG7UVH.js → chunk-BCI62WSL.js} +1 -1
  38. package/chunks/{chunk-USJFJZ23.js → chunk-BGELKSQ4.js} +1 -1
  39. package/chunks/{chunk-6X73W4TL.js → chunk-BHIDG6VZ.js} +1 -1
  40. package/chunks/{chunk-26ISBUM7.js → chunk-BPFFRPWE.js} +6 -6
  41. package/chunks/{chunk-YGHM5CDT.js → chunk-BQZF3UKI.js} +1 -1
  42. package/chunks/{chunk-3NQESE5K.js → chunk-CBE6ZIHU.js} +1 -1
  43. package/chunks/{chunk-DEMXCA3K.js → chunk-CF6SZJNP.js} +1 -1
  44. package/chunks/{chunk-2VCDJ6UF.js → chunk-CGDFZEER.js} +1 -1
  45. package/chunks/{chunk-3WQPUP5U.js → chunk-CUP2TNJK.js} +1 -1
  46. package/chunks/{chunk-2IGE2K5V.js → chunk-DA6LOBSB.js} +1 -1
  47. package/chunks/{chunk-HFV6CQWE.js → chunk-EFIRES46.js} +1 -1
  48. package/chunks/{chunk-E5YRAQXM.js → chunk-EKRUF347.js} +1 -1
  49. package/chunks/{chunk-KN27BFXM.js → chunk-ELDZ4MNL.js} +1 -1
  50. package/chunks/{chunk-ADTFKUH2.js → chunk-ET5M5WFN.js} +1 -1
  51. package/chunks/{chunk-IBYFSHBB.js → chunk-EXIFPXMB.js} +1 -1
  52. package/chunks/{chunk-IA4K4PGK.js → chunk-EYPLBTMI.js} +1 -1
  53. package/chunks/{chunk-DTTC4ZKY.js → chunk-FEP6W4NJ.js} +1 -1
  54. package/chunks/{chunk-FHBGTZ4K.js → chunk-FKL3V5BO.js} +1 -1
  55. package/chunks/{chunk-Q5E5SOY2.js → chunk-FKZ46GKL.js} +1 -1
  56. package/chunks/{chunk-OPYGNTZP.js → chunk-FYBJGRX7.js} +1 -1
  57. package/chunks/{chunk-FPZPCZFS.js → chunk-G6DALGGS.js} +1 -1
  58. package/chunks/{chunk-3Y6LSWEW.js → chunk-GBSRWT7J.js} +1 -1
  59. package/chunks/{chunk-SMYBY353.js → chunk-GHIFIXNX.js} +1 -1
  60. package/chunks/{chunk-DE53B2R7.js → chunk-GRAECADD.js} +1 -1
  61. package/chunks/{chunk-UJYOILZR.js → chunk-GSPGIGO5.js} +3 -3
  62. package/chunks/{chunk-5UZT4SXG.js → chunk-H3IR3GIE.js} +1 -1
  63. package/chunks/{chunk-ADZI3OFT.js → chunk-HOG66S6K.js} +1 -1
  64. package/chunks/{chunk-WB34KMOT.js → chunk-HTAUIJB4.js} +1 -1
  65. package/chunks/{chunk-MPAR4JBP.js → chunk-I6PUY2T3.js} +1 -1
  66. package/chunks/{chunk-5ZQWQ3RK.js → chunk-IZ5MWA6E.js} +1 -1
  67. package/chunks/{chunk-7IERHQ63.js → chunk-JEDL4IKF.js} +1 -1
  68. package/chunks/{chunk-RVJJFDF3.js → chunk-JH3V5SPA.js} +1 -1
  69. package/chunks/{chunk-SELRSZFK.js → chunk-JRTOPEM3.js} +1 -1
  70. package/chunks/{chunk-SQQORHMS.js → chunk-JWNKPINR.js} +1 -1
  71. package/chunks/{chunk-55RVKT4O.js → chunk-KJGRCIVY.js} +1 -1
  72. package/chunks/{chunk-GSOBASYW.js → chunk-KZNYALFU.js} +1 -1
  73. package/chunks/{chunk-FDUXQAGW.js → chunk-LBLLWAKK.js} +1 -1
  74. package/chunks/{chunk-ZSVSRF4C.js → chunk-LT3J74BZ.js} +1 -1
  75. package/chunks/{chunk-AMTFJVDD.js → chunk-LTE4N6L3.js} +1 -1
  76. package/chunks/{chunk-F26LTWDZ.js → chunk-M6KB5RVD.js} +1 -1
  77. package/chunks/{chunk-2PY7R7GG.js → chunk-MGATL4OA.js} +1 -1
  78. package/chunks/{chunk-KGJ47CI5.js → chunk-MPVQDYPH.js} +1 -1
  79. package/chunks/{chunk-BBOJUFMW.js → chunk-MTDBCIDA.js} +1 -1
  80. package/chunks/{chunk-ZYTG6R7S.js → chunk-MYV7GY3H.js} +1 -1
  81. package/chunks/{chunk-4GC5HJZO.js → chunk-N7PWZBXV.js} +1 -1
  82. package/chunks/{chunk-2NOMOJWE.js → chunk-NA4ZF2FE.js} +2 -2
  83. package/chunks/{chunk-7MTBINFX.js → chunk-NEKPQLFY.js} +2 -2
  84. package/chunks/{chunk-ABJGFEES.js → chunk-NO7VTKRL.js} +1 -1
  85. package/chunks/{chunk-OHXQYU6S.js → chunk-NONBHCXP.js} +1 -1
  86. package/chunks/{chunk-ZOBX6C7E.js → chunk-NVOI6UDQ.js} +1 -1
  87. package/chunks/{chunk-YLAI26PX.js → chunk-OJ4K62S2.js} +1 -1
  88. package/chunks/{chunk-CCOUFBOY.js → chunk-OK7LBM5G.js} +1 -1
  89. package/chunks/{chunk-POA4NX4N.js → chunk-OOJ2AQT3.js} +1 -1
  90. package/chunks/{chunk-5WLKN3GD.js → chunk-OU7CEG7Q.js} +1 -1
  91. package/chunks/{chunk-4TYTJQWR.js → chunk-P3JEEDQZ.js} +1 -1
  92. package/chunks/{chunk-AQWHCRKY.js → chunk-P62S5JGM.js} +1 -1
  93. package/chunks/{chunk-B6D3KTUK.js → chunk-QDCUR3JB.js} +1 -1
  94. package/chunks/{chunk-XFLLE2J3.js → chunk-RSLTOIG5.js} +2 -2
  95. package/chunks/{chunk-ISGF3BVD.js → chunk-RXN7DUMP.js} +2 -2
  96. package/chunks/{chunk-PN62SUYK.js → chunk-SKGJ26HQ.js} +1 -1
  97. package/chunks/{chunk-62NLMVVT.js → chunk-SP6CQ3MO.js} +1 -1
  98. package/chunks/{chunk-4EQWJTJR.js → chunk-T2YTHAJW.js} +1 -1
  99. package/chunks/{chunk-NO26JN24.js → chunk-T53VMDXH.js} +1 -1
  100. package/chunks/{chunk-X4BFEDWU.js → chunk-T5DKF33F.js} +1 -1
  101. package/chunks/{chunk-KKBOCRPF.js → chunk-TB4AUC2L.js} +1 -1
  102. package/chunks/{chunk-Q6QS5JTK.js → chunk-U3Q72OGV.js} +1 -1
  103. package/chunks/{chunk-FLJLUMQF.js → chunk-UKLXKJKL.js} +1 -1
  104. package/chunks/{chunk-IH2PFVWO.js → chunk-VD2GSW64.js} +1 -1
  105. package/chunks/{chunk-VDRE7U3P.js → chunk-VRKYBH5G.js} +5 -5
  106. package/chunks/{chunk-MOPJNP5I.js → chunk-W2RQIZ6B.js} +1 -1
  107. package/chunks/{chunk-2LLPGSUK.js → chunk-W5Z4BWWA.js} +1 -1
  108. package/chunks/{chunk-CNFA5UUM.js → chunk-W66WWTOP.js} +1 -1
  109. package/chunks/{chunk-C56YJIEI.js → chunk-WGFX3EL3.js} +1 -1
  110. package/chunks/{chunk-6NI33TVK.js → chunk-X2TY7VTY.js} +1 -1
  111. package/chunks/{chunk-FIM7MM25.js → chunk-XISR37DQ.js} +1 -1
  112. package/chunks/{chunk-KDYUZBZC.js → chunk-YH2XRWRF.js} +1 -1
  113. package/chunks/{chunk-UBXLQ6TP.js → chunk-ZENMAISJ.js} +1 -1
  114. package/chunks/{codex-subagent-executor-EK3A2WBH.js → codex-subagent-executor-OLMGVPVS.js} +1 -1
  115. package/chunks/{config-utils-DLOK7OLM.js → config-utils-OWY5G5Y2.js} +1 -1
  116. package/chunks/{contextCommand-AVCUCHQC.js → contextCommand-IXFUZH65.js} +1 -1
  117. package/chunks/{core-runtime-QSS4ZTG6.js → core-runtime-O4LC4NY3.js} +1 -1
  118. package/chunks/{create-sub-session-PNF7QDKC.js → create-sub-session-6F7C3TMT.js} +1 -1
  119. package/chunks/{cron-create-C6JOFIU4.js → cron-create-2422NBSJ.js} +1 -1
  120. package/chunks/{daemon-git-worktree-guard-5XZAZ7D2.js → daemon-git-worktree-guard-EWPQA6NO.js} +1 -1
  121. package/chunks/{daemon-status-provider-MRNELSNJ.js → daemon-status-provider-FAHOXNFW.js} +1 -1
  122. package/chunks/{daemon-trust-policy-26CMW3WY.js → daemon-trust-policy-L3DM6AI5.js} +1 -1
  123. package/chunks/{daemon-trust-policy-monitor-3DWO6NQY.js → daemon-trust-policy-monitor-HNPY5KJ4.js} +1 -1
  124. package/chunks/{deferred-core-runtime-DEC3N46T.js → deferred-core-runtime-JF42NQJK.js} +1 -1
  125. package/chunks/{edit-3HMQPCHN.js → edit-E5LEI2LL.js} +1 -1
  126. package/chunks/{enterPlanMode-QHJF4JXZ.js → enterPlanMode-3COTUV5V.js} +1 -1
  127. package/chunks/{environment-NGIBJWOT.js → environment-XBBIB3VA.js} +1 -1
  128. package/chunks/{errors-MSTGCVGJ.js → errors-LNMQ7TUK.js} +1 -1
  129. package/chunks/{execution-tool-VR4TGOI4.js → execution-tool-QDDKJD2K.js} +1 -1
  130. package/chunks/{execution-worker-EJH7HIE2.js → execution-worker-TXGZRZXE.js} +1 -1
  131. package/chunks/{exitPlanMode-P25OHQJ6.js → exitPlanMode-Z7QEMWPE.js} +1 -1
  132. package/chunks/{fast-path-II433ZDP.js → fast-path-M6K2RACY.js} +1 -1
  133. package/chunks/{glob-4Q6DCT3F.js → glob-N2QT4U7U.js} +1 -1
  134. package/chunks/{goal-tools-FFMAJW6V.js → goal-tools-CUSQD3DG.js} +1 -1
  135. package/chunks/{handleAutoUpdate-QNM26NZK.js → handleAutoUpdate-QF2YQHF6.js} +1 -1
  136. package/chunks/{i18n-L5URVOBB.js → i18n-AGOA6MUI.js} +1 -1
  137. package/chunks/{initializer-NQ2NECYP.js → initializer-FRKYDUSX.js} +1 -1
  138. package/chunks/{installationInfo-BCTXASUM.js → installationInfo-OKA4WXAS.js} +1 -1
  139. package/chunks/{interactive-mod-session-PPTBI37E.js → interactive-mod-session-MWYN5IFK.js} +1 -1
  140. package/chunks/{list-7TE5TUZJ.js → list-DE7VUIR2.js} +1 -1
  141. package/chunks/{llm-BWWKUBBZ.js → llm-N3JGJHYC.js} +4 -4
  142. package/chunks/{llm-content-generator-QOTGPBYC.js → llm-content-generator-VMUBA7OJ.js} +1 -1
  143. package/chunks/{loadedSettingsAdapter-THAGI5M2.js → loadedSettingsAdapter-5C36OZ7N.js} +1 -1
  144. package/chunks/{local-7BTAGV4J.js → local-BE624O3A.js} +1 -1
  145. package/chunks/{local-execution-environment-S3OR4KSC.js → local-execution-environment-OPGM7Y6L.js} +1 -1
  146. package/chunks/{loggingContentGenerator-AXJ5E5RS.js → loggingContentGenerator-2MHAI6JR.js} +1 -1
  147. package/chunks/{loop-wakeup-AJTLMLRX.js → loop-wakeup-BDLATBXH.js} +1 -1
  148. package/chunks/{manage-memory-JHTUVMDJ.js → manage-memory-BBCEIIWB.js} +1 -1
  149. package/chunks/{managed-execution-engine-U6GNJ4U4.js → managed-execution-engine-SRFALTCX.js} +1 -1
  150. package/chunks/{managed-local-serve-P4ZXVRBU.js → managed-local-serve-ICNAS3E6.js} +1 -1
  151. package/chunks/{managed-npm-update-UDUILNR5.js → managed-npm-update-CTL6LH5Z.js} +1 -1
  152. package/chunks/{managed-runtime-attestation-worker-P34ZBNRG.js → managed-runtime-attestation-worker-ZRDWKXCI.js} +1 -1
  153. package/chunks/{managed-runtime-bootstrap-CLMYNPH5.js → managed-runtime-bootstrap-6NTGZXQL.js} +1 -1
  154. package/chunks/{managed-runtime-session-worker-7H7AZJBV.js → managed-runtime-session-worker-RKQBBFR6.js} +1 -1
  155. package/chunks/{managed-runtime-ssh-worker-5KEMC7FD.js → managed-runtime-ssh-worker-FCGV6FSW.js} +1 -1
  156. package/chunks/{managed-session-authority-CFUZ45HT.js → managed-session-authority-C7IW6TJX.js} +1 -1
  157. package/chunks/{mcp-YMG4RVMC.js → mcp-VC4CJPE5.js} +1 -1
  158. package/chunks/{memory-7STURUXK.js → memory-S6OJA3ZD.js} +1 -1
  159. package/chunks/mn-JMS6SWTO.js +8 -0
  160. package/chunks/{model-call-collection-WBWTO3EG.js → model-call-collection-MJZWRQSU.js} +1 -1
  161. package/chunks/{model-configuration-6KCZZSZD.js → model-configuration-SKU6L3QI.js} +1 -1
  162. package/chunks/{modelConfigUtils-Z2EKFSPN.js → modelConfigUtils-TJCB6NXT.js} +1 -1
  163. package/chunks/{monitor-U5E33JO6.js → monitor-M3PNLCYP.js} +1 -1
  164. package/chunks/{nonInteractiveCli-BVCL5I5R.js → nonInteractiveCli-MR7JLAWU.js} +1 -1
  165. package/chunks/{nonInteractiveToolExecutor-B4EUOMYF.js → nonInteractiveToolExecutor-YKA6JMTY.js} +1 -1
  166. package/chunks/{notebook-edit-MXKD5J2C.js → notebook-edit-ENTFB5D7.js} +1 -1
  167. package/chunks/{omni-I5YECZBW.js → omni-6YBX4R6K.js} +1 -1
  168. package/chunks/{openaiContentGenerator-Q5SINFJJ.js → openaiContentGenerator-XRXX33FY.js} +1 -1
  169. package/chunks/{openaiResponsesContentGenerator-R3XCZLZY.js → openaiResponsesContentGenerator-L6ONEHMR.js} +1 -1
  170. package/chunks/{pidfile-UOGUNUTK.js → pidfile-XR4JF2Z6.js} +1 -1
  171. package/chunks/{processUtils-QGQGZHBA.js → processUtils-GQYNJRBJ.js} +1 -1
  172. package/chunks/{prompt-terminal-ledger-L57JMVSR.js → prompt-terminal-ledger-7BM7YDLG.js} +1 -1
  173. package/chunks/{qwenContentGenerator-UKZ237LC.js → qwenContentGenerator-QSA32XEL.js} +1 -1
  174. package/chunks/{reactive-degrade-3OM3HWVA.js → reactive-degrade-TFNBAAPZ.js} +1 -1
  175. package/chunks/{read-file-63ZLWMOW.js → read-file-VD7OFO2E.js} +1 -1
  176. package/chunks/{resumeHistoryUtils-R5YQS4YQ.js → resumeHistoryUtils-2B4KPI7G.js} +1 -1
  177. package/chunks/{review-AT6OWVDO.js → review-C365WGCW.js} +1 -1
  178. package/chunks/{ripGrep-7KBZGTPV.js → ripGrep-D7WPMBXR.js} +1 -1
  179. package/chunks/{run-qwen-serve-CLBG7W6F.js → run-qwen-serve-NZWQHWQA.js} +1 -1
  180. package/chunks/{runtime-R3QIGB7U.js → runtime-J6SPBSCS.js} +1 -1
  181. package/chunks/{sandboxConfig-PM3ZRQYV.js → sandboxConfig-QS2XBPZG.js} +1 -1
  182. package/chunks/{scheduled-tasks-PUMNN5XV.js → scheduled-tasks-YNNIOOPM.js} +1 -1
  183. package/chunks/{scheduler-KTPM226B.js → scheduler-KCMSPHON.js} +1 -1
  184. package/chunks/{search-memory-7I5MGDNV.js → search-memory-EUBJ7IAV.js} +1 -1
  185. package/chunks/{send-message-J526AEBI.js → send-message-CWWZUPSK.js} +1 -1
  186. package/chunks/{serve-KLTMPK4W.js → serve-4CB4BWJ5.js} +1 -1
  187. package/chunks/{server-VLRNY6KG.js → server-JNANUIGC.js} +3 -3
  188. package/chunks/{session-2EB57NXY.js → session-3LQLXPUA.js} +1 -1
  189. package/chunks/{session-attachments-root-I7TESMWL.js → session-attachments-root-BWIVWFHJ.js} +1 -1
  190. package/chunks/{session-execution-engine-selector-5FAMSPSO.js → session-execution-engine-selector-5OLRX57L.js} +1 -1
  191. package/chunks/{session-pr-refresh-JCPVQPNJ.js → session-pr-refresh-RLF3EXS3.js} +1 -1
  192. package/chunks/{sessionService-YRW2IFPR.js → sessionService-U7ACD2HP.js} +1 -1
  193. package/chunks/{settings-KO2Q47JP.js → settings-FTGWYTUH.js} +1 -1
  194. package/chunks/{shell-OLZVNTQZ.js → shell-E4RENYQC.js} +1 -1
  195. package/chunks/{skill-XW2AQS7M.js → skill-OLNPHRWB.js} +1 -1
  196. package/chunks/{skill-settings-TKAVQ4XP.js → skill-settings-R2BV2GEK.js} +1 -1
  197. package/chunks/{spawnChannel-MBGCTK2J.js → spawnChannel-LOPAR5T2.js} +1 -1
  198. package/chunks/{standalone-update-A3YLLIAN.js → standalone-update-IGDX2RGN.js} +1 -1
  199. package/chunks/{start-opentui-ui-G5ROAR4V.js → start-opentui-ui-33QLBNRC.js} +1 -1
  200. package/chunks/{startInteractiveUI-PZQR4U53.js → startInteractiveUI-RQKHD7MM.js} +1 -1
  201. package/chunks/{team-create-S5ZY2UMF.js → team-create-HAVKHNU5.js} +1 -1
  202. package/chunks/{team-plan-approval-KX6RXEST.js → team-plan-approval-7MCQX67C.js} +1 -1
  203. package/chunks/{terminal-image-renderer-SCJREXE6.js → terminal-image-renderer-XT5JVEO6.js} +1 -1
  204. package/chunks/{theme-manager-DZSM4EBR.js → theme-manager-DR5EYGLT.js} +1 -1
  205. package/chunks/{tool-call-UK56SWCT.js → tool-call-LZHZ5RVH.js} +1 -1
  206. package/chunks/{tool-result-media-JLLSLGFL.js → tool-result-media-XCXCF4YC.js} +1 -1
  207. package/chunks/{tool-search-OWPFLVV5.js → tool-search-K6S3ON7M.js} +1 -1
  208. package/chunks/{total-session-admission-NQU4ACKH.js → total-session-admission-LGSS2VWS.js} +1 -1
  209. package/chunks/{trustedFolders-N7GXFYSF.js → trustedFolders-IIR2UZRL.js} +1 -1
  210. package/chunks/{update-relaunch-5SPXXHM2.js → update-relaunch-WVIFX5CN.js} +1 -1
  211. package/chunks/{updateCheck-VXUIX2XG.js → updateCheck-CMEWLLZJ.js} +1 -1
  212. package/chunks/{upload-config-OWLL4SRQ.js → upload-config-TCCFCNCD.js} +1 -1
  213. package/chunks/{useAutoAcceptIndicator-OUYRR56F.js → useAutoAcceptIndicator-5RTTH3OW.js} +1 -1
  214. package/chunks/{validateNonInterActiveAuth-PSVJO5HK.js → validateNonInterActiveAuth-AO336KDX.js} +1 -1
  215. package/chunks/{version-C26S7UAW.js → version-JYWKKMNP.js} +1 -1
  216. package/chunks/{web-fetch-AYOYV7R4.js → web-fetch-HWTAWXFM.js} +1 -1
  217. package/chunks/{web-search-DAREKD3Z.js → web-search-HAI5LW3G.js} +1 -1
  218. package/chunks/{workflow-WBGPKVO6.js → workflow-BZ2YFGF6.js} +1 -1
  219. package/chunks/{workflow-ancestor-trust-GEEB53TB.js → workflow-ancestor-trust-26TFXFPO.js} +1 -1
  220. package/chunks/{workspace-agents-IMAQME4W.js → workspace-agents-DLI4JQJZ.js} +1 -1
  221. package/chunks/{workspace-providers-status-VALHVEU2.js → workspace-providers-status-64C7DJZU.js} +1 -1
  222. package/chunks/{workspace-recovery-worker-AIAVRDGU.js → workspace-recovery-worker-IFRT3KKP.js} +1 -1
  223. package/chunks/{workspace-registration-store-FXEGZG3L.js → workspace-registration-store-MYKJM2SK.js} +1 -1
  224. package/chunks/{workspace-registry-GYFFHWCD.js → workspace-registry-GZJRONAY.js} +1 -1
  225. package/chunks/{workspace-runtime-coordinator-VZ462TLU.js → workspace-runtime-coordinator-44KW6HSN.js} +1 -1
  226. package/chunks/{workspace-service-5DIZM4IZ.js → workspace-service-YHTSZYYD.js} +1 -1
  227. package/chunks/{workspace-skills-status-DOOBVL5N.js → workspace-skills-status-NEB62X24.js} +1 -1
  228. package/chunks/{workspace-trust-reconciler-LOICVUVW.js → workspace-trust-reconciler-HZLOOZWM.js} +1 -1
  229. package/chunks/{write-file-EJNMAHQD.js → write-file-HD5LHXGL.js} +1 -1
  230. package/chunks/{zoom-image-S3OARMYP.js → zoom-image-W4BMRC5T.js} +1 -1
  231. package/cli.js +2 -2
  232. package/execution-worker.js +1 -1
  233. package/export-transcript-document.js +1 -1
  234. package/gerege.mjs +53 -15
  235. package/locales/mn.js +2702 -3774
  236. package/package.json +3 -3
  237. package/chunks/mn-YH2OTBWJ.js +0 -8
@@ -627,4 +627,4 @@ Boolean requesting whether a visible border and background is provided by the ho
627
627
  container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:ie().optional().describe("User's language and region preference in BCP 47 format."),timeZone:ie().optional().describe("User's timezone in IANA format."),userAgent:ie().optional().describe("Host application identifier."),platform:ea([se("web"),se("desktop"),se("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:ue({touch:Ba().optional().describe("Whether the device supports touch input."),hover:Ba().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:ue({top:Ht().describe("Top safe area inset in pixels."),right:Ht().describe("Right safe area inset in pixels."),bottom:Ht().describe("Bottom safe area inset in pixels."),left:Ht().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough();ue({method:se("ui/notifications/host-context-changed"),params:Zj.describe("Partial context update containing only changed fields.")});var $Te=ue({method:se("ui/update-model-context"),params:ue({content:Rt(Dg).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:na(ie(),Pa().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),BTe=ue({method:se("ui/initialize"),params:ue({appInfo:fk.describe("App identification (name and version)."),appCapabilities:MTe.describe("Features and capabilities this app provides."),protocolVersion:ie().describe("Protocol version this app supports.")})});ue({protocolVersion:ie().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:fk.describe("Host application identification and version."),hostCapabilities:ETe.describe("Features and capabilities provided by the host."),hostContext:Zj.describe("Rich context about the host environment.")}).passthrough();var M9=class{constructor(t=window.parent,a){Zt(this,"eventTarget"),Zt(this,"eventSource"),Zt(this,"messageListener"),Zt(this,"onclose"),Zt(this,"onerror"),Zt(this,"onmessage"),Zt(this,"sessionId"),Zt(this,"setProtocolVersion"),this.eventTarget=t,this.eventSource=a,this.messageListener=n=>{if(a&&n.source!==this.eventSource){console.debug("Ignoring message from unknown source",n);return}let r=V9e.safeParse(n.data);r.success?(console.debug("Parsed message",r.data),this.onmessage?.(r.data)):n.data?.jsonrpc!=="2.0"?console.debug("Ignoring non-JSON-RPC message",r.error.message,n):(console.error("Failed to parse message",r.error.message,n),this.onerror?.(Error("Invalid JSON-RPC message received: "+r.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(t,a){t.method!==bTe&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}},FTe=[Xj],P9=class extends E9{constructor(t,a,n,r){super(r),Zt(this,"_client"),Zt(this,"_hostInfo"),Zt(this,"_capabilities"),Zt(this,"_appCapabilities"),Zt(this,"_hostContext",{}),Zt(this,"_appInfo"),Zt(this,"_initializedReceived",!1),Zt(this,"_baseReplaceRequestHandler",this.replaceRequestHandler),Zt(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)))}),Zt(this,"eventSchemas",{sizechange:ITe,sandboxready:TTe,initialized:PTe,requestteardown:RTe,loggingmessage:Gj}),Zt(this,"onping"),Zt(this,"_onmessage"),Zt(this,"_onopenlink"),Zt(this,"_ondownloadfile"),Zt(this,"_onrequestdisplaymode"),Zt(this,"_onupdatemodelcontext"),Zt(this,"_oncalltool"),Zt(this,"_onlistresources"),Zt(this,"_onlistresourcetemplates"),Zt(this,"_onreadresource"),Zt(this,"_onlistprompts"),Zt(this,"sendResourceTeardown",this.teardownResource),this._client=t,this._hostInfo=a,this._capabilities=n,this.addEventListener("initialized",()=>{this._initializedReceived=!0}),this._hostContext=r?.hostContext||{},this.setRequestHandler(BTe,o=>this._oninitialize(o)),this.setRequestHandler(pk,(o,s)=>(this.onping?.(o.params,s),{})),this.replaceRequestHandler(Nq,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(DTe,async(a,n)=>{if(!this._onmessage)throw Error("No onmessage handler set");return this._onmessage(a.params,n)})}get onopenlink(){return this._onopenlink}set onopenlink(t){this.warnIfRequestHandlerReplaced("onopenlink",this._onopenlink,t),this._onopenlink=t,this.replaceRequestHandler(CTe,async(a,n)=>{if(!this._onopenlink)throw Error("No onopenlink handler set");return this._onopenlink(a.params,n)})}get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(t){this.warnIfRequestHandlerReplaced("ondownloadfile",this._ondownloadfile,t),this._ondownloadfile=t,this.replaceRequestHandler(OTe,async(a,n)=>{if(!this._ondownloadfile)throw Error("No ondownloadfile handler set");return this._ondownloadfile(a.params,n)})}get onrequestteardown(){return this.getEventHandler("requestteardown")}set onrequestteardown(t){this.setEventHandler("requestteardown",t)}get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(t){this.warnIfRequestHandlerReplaced("onrequestdisplaymode",this._onrequestdisplaymode,t),this._onrequestdisplaymode=t,this.replaceRequestHandler(Nq,async(a,n)=>{if(!this._onrequestdisplaymode)throw Error("No onrequestdisplaymode handler set");return this._onrequestdisplaymode(a.params,n)})}get onloggingmessage(){return this.getEventHandler("loggingmessage")}set onloggingmessage(t){this.setEventHandler("loggingmessage",t)}get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(t){this.warnIfRequestHandlerReplaced("onupdatemodelcontext",this._onupdatemodelcontext,t),this._onupdatemodelcontext=t,this.replaceRequestHandler($Te,async(a,n)=>{if(!this._onupdatemodelcontext)throw Error("No onupdatemodelcontext handler set");return this._onupdatemodelcontext(a.params,n)})}get oncalltool(){return this._oncalltool}set oncalltool(t){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,t),this._oncalltool=t,this.replaceRequestHandler(jj,async(a,n)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(a.params,n)})}set oncreatesamplingmessage(t){this.setRequestHandler(Vj,async(a,n)=>t(a.params,n))}sendToolListChanged(t={}){return this.notification({method:"notifications/tools/list_changed",params:t})}get onlistresources(){return this._onlistresources}set onlistresources(t){this.warnIfRequestHandlerReplaced("onlistresources",this._onlistresources,t),this._onlistresources=t,this.replaceRequestHandler(Rj,async(a,n)=>{if(!this._onlistresources)throw Error("No onlistresources handler set");return this._onlistresources(a.params,n)})}get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(t){this.warnIfRequestHandlerReplaced("onlistresourcetemplates",this._onlistresourcetemplates,t),this._onlistresourcetemplates=t,this.replaceRequestHandler(Mj,async(a,n)=>{if(!this._onlistresourcetemplates)throw Error("No onlistresourcetemplates handler set");return this._onlistresourcetemplates(a.params,n)})}get onreadresource(){return this._onreadresource}set onreadresource(t){this.warnIfRequestHandlerReplaced("onreadresource",this._onreadresource,t),this._onreadresource=t,this.replaceRequestHandler(Nj,async(a,n)=>{if(!this._onreadresource)throw Error("No onreadresource handler set");return this._onreadresource(a.params,n)})}sendResourceListChanged(t={}){return this.notification({method:"notifications/resources/list_changed",params:t})}get onlistprompts(){return this._onlistprompts}set onlistprompts(t){this.warnIfRequestHandlerReplaced("onlistprompts",this._onlistprompts,t),this._onlistprompts=t,this.replaceRequestHandler($j,async(a,n)=>{if(!this._onlistprompts)throw Error("No onlistprompts handler set");return this._onlistprompts(a.params,n)})}sendPromptListChanged(t={}){return this.notification({method:"notifications/prompts/list_changed",params:t})}assertCapabilityForMethod(t){}assertRequestHandlerCapability(t){}assertNotificationCapability(t){}assertTaskCapability(t){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(t){throw Error("Task handlers are not supported in MCP Apps")}getCapabilities(){return this._capabilities}async _oninitialize(t){let a=t.params.protocolVersion;return this._appInfo!==void 0&&console.warn("[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values."),this._appCapabilities=t.params.appCapabilities,this._appInfo=t.params.appInfo,{protocolVersion:FTe.includes(a)?a:Xj,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(t){let a={},n=!1;for(let r of Object.keys(t)){let o=this._hostContext[r],s=t[r];qTe(o,s)||(a[r]=s,n=!0)}n&&(this._hostContext=t,this.sendHostContextChange(a))}sendHostContextChange(t){return this.notification({method:"ui/notifications/host-context-changed",params:t})}sendToolInput(t){return this.notification({method:"ui/notifications/tool-input",params:t})}sendToolInputPartial(t){return this.notification({method:"ui/notifications/tool-input-partial",params:t})}sendToolResult(t){return this.notification({method:"ui/notifications/tool-result",params:t})}sendToolCancelled(t){return this.notification({method:"ui/notifications/tool-cancelled",params:t})}sendSandboxResourceReady(t){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:t})}teardownResource(t,a){return this.request({method:"ui/resource-teardown",params:t},ATe,a)}callTool(t,a){return this.request({method:"tools/call",params:t},yg,a)}listTools(t,a){return this.request({method:"tools/list",params:t},Uj,a)}async connect(t){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._initializedReceived=!1,this._client){let a=this._client.getServerCapabilities();if(!a)throw Error("Client server capabilities not available");a.tools&&(this.oncalltool=async(n,r)=>this._client.request({method:"tools/call",params:n},yg,{signal:r.signal}),a.tools.listChanged&&this._client.setNotificationHandler(Hj,n=>this.sendToolListChanged(n.params))),a.resources&&(this.onlistresources=async(n,r)=>this._client.request({method:"resources/list",params:n},Ej,{signal:r.signal}),this.onlistresourcetemplates=async(n,r)=>this._client.request({method:"resources/templates/list",params:n},Pj,{signal:r.signal}),this.onreadresource=async(n,r)=>this._client.request({method:"resources/read",params:n},Oj,{signal:r.signal}),a.resources.listChanged&&this._client.setNotificationHandler(Dj,n=>this.sendResourceListChanged(n.params))),a.prompts&&(this.onlistprompts=async(n,r)=>this._client.request({method:"prompts/list",params:n},Bj,{signal:r.signal}),a.prompts.listChanged&&this._client.setNotificationHandler(zj,n=>this.sendPromptListChanged(n.params)))}return super.connect(t)}};function qTe(e,t){return JSON.stringify(e)===JSON.stringify(t)}var zTe="_card_1j118_1",UTe="_header_1j118_10",jTe="_server_1j118_21",HTe="_frame_1j118_26",WTe="_fallback_1j118_41",GTe="_fallbackTitle_1j118_48",VTe="_fallbackSummary_1j118_53",KTe="_fallbackNote_1j118_57",XTe="_builtInBar_1j118_62",ZTe="_loading_1j118_72",Do={card:zTe,header:UTe,server:jTe,frame:HTe,fallback:WTe,fallbackTitle:GTe,fallbackSummary:VTe,fallbackNote:KTe,builtInBar:XTe,loading:ZTe},YTe=(0,y.createContext)(void 0);function QTe(){return(0,y.useContext)(YTe)}function F6(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function bg(e){if(!(!F6(e)||e.type!=="mcp_app")&&!(typeof e.serverName!="string"||typeof e.resourceUri!="string"||typeof e.html!="string"||typeof e.fallbackText!="string"||!F6(e.toolResult)||!F6(e.toolArguments)))return e}var JTe=8192;function Oq(e){let t=e.split("."),a=t.length===4&&t[0]==="127"&&t.slice(1).every(n=>{if(!/^\d+$/.test(n))return!1;let r=Number(n);return r>=0&&r<=255});return e==="localhost"||e==="[::1]"||a}function e8e(e){if(e==="127.0.0.1"||e==="[::1]")return"localhost"}function t8e(e,t,a=!1){try{let n=new URL(t),r=new URL(e,n);if(!["http:","https:"].includes(n.protocol)||!["http:","https:"].includes(r.protocol)||r.username||r.password)return;if(a||=n.protocol==="https:"||!Oq(n.hostname)||!Oq(r.hostname),!a&&(r.hostname==="[::1]"&&(r.hostname="localhost"),r.origin===n.origin)){let o=e8e(r.hostname);o&&(r.hostname=o)}return r.pathname=`${r.pathname.replace(/\/$/,"")}/mcp-app-sandbox`,r.search="",r.hash="",r.searchParams.set("hostOrigin",n.origin),a&&r.searchParams.set("mode","data"),r.toString()}catch{return}}function a8e(e,t){if(!t)return e;let a=new URL(e);return a.searchParams.set("csp",t),a.search.length<=JTe?a.toString():e}var n8e=960,r8e=4e3;function Dq(e,t){if(!e||typeof getComputedStyle!="function")return;let a=getComputedStyle(e),n={"--color-background-primary":"--background","--color-background-secondary":"--muted","--color-background-inverse":"--primary","--color-text-primary":"--foreground","--color-text-secondary":t==="light"?"--secondary-foreground":"--muted-foreground","--color-text-inverse":"--primary-foreground","--color-text-danger":"--destructive","--color-border-primary":"--border","--color-border-secondary":"--input","--color-ring-primary":"--ring","--font-sans":"--font-sans","--border-radius-md":"--radius"},r={};for(let[o,s]of Object.entries(n)){let i=a.getPropertyValue(s).trim();i&&(r[o]=i)}return Object.keys(r).length?r:void 0}function $q(e,t,a,n){return{theme:t,locale:a,...n?{styles:{variables:n}}:{},platform:"web",displayMode:"inline",availableDisplayModes:["inline"],containerDimensions:{maxHeight:e}}}var q6=0,wb=new Set;function o8e(e){return new Promise((t,a)=>{let n=()=>{wb.delete(r),a(e.reason)},r=()=>{e.removeEventListener("abort",n),q6+=1,t(()=>{q6-=1;let o=wb.values().next().value;o&&(wb.delete(o),o())})};e.aborted?a(e.reason):q6<2?r():(wb.add(r),e.addEventListener("abort",n,{once:!0}))})}function s8e(e){let t=e.toolResult.structuredContent;if(!t||typeof t!="object")return;let{title:a,summary:n}=t;return typeof a=="string"&&typeof n=="string"?{title:a,summary:n}:void 0}function i8e({display:e}){let t=s8e(e);return t?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:Do.fallbackTitle,children:t.title}),(0,c.jsx)("div",{className:Do.fallbackSummary,children:t.summary})]}):(0,c.jsx)("div",{children:e.fallbackText})}function Yj({display:e}){let{t}=Ze();return(0,c.jsxs)("div",{className:Do.fallback,children:[(0,c.jsx)(i8e,{display:e}),(0,c.jsx)("div",{className:Do.fallbackNote,children:t("mcpApp.generatedUi.unavailable")})]})}function l8e({display:e,toolId:t,visible:a=!0}){let n=bU(e);return QTe(),(0,y.useContext)(bve)?.source,(0,y.useContext)(ok),(0,y.useContext)(kve),n?(0,c.jsx)(c8e,{display:e}):(0,c.jsx)(Yj,{display:e})}function c8e({display:e,retained:t}){let{t:a,language:n}=Ze(),r=Sve(e),o=r?r8e:n8e,s=(0,y.useContext)(wU),i=(0,y.useContext)(ok),l=(0,y.useContext)(yve),u=(0,y.useContext)(vve),d=(0,y.useContext)(gve),f=(0,y.useRef)(d);f.current=d,i&&u?.sessionId;let p=void 0,m=i&&l?.sessionId===i?l.callTool:void 0,h=xg(),g=(0,y.useRef)(n);g.current=n;let b=(0,y.useRef)(null),w=(0,y.useRef)(null),v=(0,y.useRef)(null),x=(0,y.useRef)(0),T=(0,y.useRef)(e),I=(0,y.useRef)(h);T.current=e,I.current=h;let[L,S]=(0,y.useState)(260),[C,E]=(0,y.useState)(!1),[R,P]=(0,y.useState)(),[N,q]=(0,y.useState)(!1),H=e.csp?JSON.stringify(e.csp):"",z=JSON.stringify(e.toolArguments),G=JSON.stringify(e.toolResult),re=(0,y.useMemo)(()=>{if(!s||typeof window>"u")return;let X=t8e(s,window.location.href,N);if(X)return a8e(X,H)},[s,H,N]);return(0,y.useEffect)(()=>{P(void 0),E(!1);let X=b.current;if(!X||!re)return;let V=++x.current,A=!1,$=!0,K=!1,O=T.current,ee=new P9(null,{name:"qwen-code-web-shell",version:"0.0.1"},{...m?{serverTools:{}}:{},sandbox:{...O.csp?{csp:O.csp}:{}}},{hostContext:$q(o,I.current,g.current,Dq(w.current,I.current))});v.current=ee;let de=new AbortController;m&&(ee.oncalltool=async(te,le)=>{let J=AbortSignal.any([le.signal,de.signal,...t?[t.getSignal()]:[]]),_e=0,xe=te._meta?.progressToken,je=le.sendNotification,be=J.aborted||typeof xe!="string"&&typeof xe!="number"?void 0:setInterval(()=>{je({method:"notifications/progress",params:{progressToken:xe,progress:++_e}}).catch(()=>{})},3e4),W=()=>clearInterval(be);J.addEventListener("abort",W,{once:!0});let ke;try{return ke=await o8e(J),J.throwIfAborted(),await m({serverName:O.serverName,resourceUri:O.resourceUri,name:te.name,arguments:te.arguments??{}},J)}finally{ke?.(),W(),J.removeEventListener("abort",W)}});let ye=()=>{!$||x.current!==V||($=!1,clearTimeout(oe),ee.oncalltool=void 0,ee.onmessage=void 0,de.abort(),X.removeAttribute("src"),v.current=null,ee.close().catch(()=>{}),P("sandbox-load-failed"))},oe=setTimeout(()=>{$&&(new URL(re).searchParams.get("mode")!=="data"?q(!0):ye())},1e4);return ee.onsandboxready=()=>{if(!$||K)return;K=!0,clearTimeout(oe),oe=setTimeout(()=>{$&&!A&&ye()},3e4);let te=T.current;ee.sendSandboxResourceReady({html:te.html,...te.csp?{csp:te.csp}:{}}).catch(ye)},ee.oninitialized=()=>{if(!$)return;A=!0,E(!0),clearTimeout(oe);let te=T.current;ee.sendToolInput({arguments:te.toolArguments}).then(()=>{if($)return ee.sendToolResult(te.toolResult)}).catch(ye)},ee.onsizechange=({height:te,width:le})=>{typeof te=="number"&&Number.isFinite(te)&&le!==0&&(!t||t.isVisible()&&te>0)&&S(Math.min(o,Math.max(120,Math.ceil(te))))},ee.connect(new M9(X.contentWindow??void 0,X.contentWindow)).then(()=>{$&&(X.src=re)}).catch(ye),()=>{$=!1,clearTimeout(oe),ee.oncalltool=void 0,ee.onmessage=void 0,de.abort(),v.current=null;let te=()=>{x.current===V&&X.removeAttribute("src"),ee.close().catch(()=>{})};if(A){ee.teardownResource({},{timeout:500}).catch(()=>{}).finally(te);return}te()}},[re,N,m,p,i,e.serverName,e.resourceUri,e.html,r,H,z,G,t,o]),(0,y.useEffect)(()=>{v.current?.setHostContext($q(o,h,n,Dq(w.current,h)))},[h,n,o]),!e.html||!re?(0,c.jsx)("div",{className:Do.fallback,children:e.fallbackText}):(0,c.jsxs)("div",{ref:w,className:Do.card,"data-testid":"mcp-app",children:[r?t&&(0,c.jsxs)("div",{className:Do.builtInBar,children:[(0,c.jsx)("span",{children:t.reopened?a("mcpApp.generatedUi.reopenNotice"):""}),(0,c.jsx)(pa,{variant:"ghost",size:"sm",title:a("mcpApp.generatedUi.reopenNotice"),onClick:t.reset,children:a("mcpApp.generatedUi.reset")})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("div",{className:Do.header,children:[(0,c.jsx)("span",{children:"MCP App"}),(0,c.jsx)("span",{className:Do.server,children:e.serverName}),t&&(0,c.jsx)(pa,{variant:"ghost",size:"sm",title:a("mcpApp.generatedUi.reopenNotice"),onClick:t.reset,children:a("mcpApp.generatedUi.reset")})]}),t?.reopened&&(0,c.jsx)("div",{className:Do.fallback,children:a("mcpApp.generatedUi.reopenNotice")})]}),R?(0,c.jsx)("div",{className:Do.fallback,children:e.fallbackText||"MCP App could not initialize."}):null,!R&&!C?(0,c.jsx)("div",{className:Do.loading,role:"status",children:a(r?"mcpApp.generatedUi.loading":"mcpApp.loading")}):null,(0,c.jsx)("iframe",{ref:b,title:r?a("mcpApp.generatedUi.title"):`${e.serverName} MCP App`,className:Do.frame,style:{height:L,display:R?"none":void 0,...C?{}:{position:"absolute",visibility:"hidden"}},sandbox:"allow-scripts allow-forms allow-same-origin",referrerPolicy:"origin",onError:()=>P("sandbox-load-failed")})]})}function u8e(e){let t=d8e(e.args,"file_path","filePath","path");if(t!==void 0&&t.length>0)return t;for(let a of e.content??[])if(a.path)return a.path;return e.locations?.[0]?.file}function d8e(e,...t){if(e)for(let a of t){let n=e[a];if(typeof n=="string")return n}}function f8e(e,t){if(!e||!t)return;let a=e.workspaces;if(a){let n=a.filter(o=>o.cwd===t),r=n[0];return n.length!==1||!r?.id||r.trusted!==!0||a.filter(o=>o.id===r.id).length!==1||r.primary!==(r.cwd===e.workspaceCwd)?void 0:p8e(r)}if(e.workspaceCwd===t)return{cwd:t,primary:!0}}function p8e(e){return{cwd:e.cwd,id:e.id,primary:e.primary}}function m8e(e,t){return e?.cwd===t.cwd&&e.id===t.id&&e.primary===t.primary}function Qj(e){let t=sk(),a=Ave(),n=(0,y.useMemo)(()=>f8e(t.capabilities,e),[t.capabilities,e]),r=!1,o=r,s=(0,y.useRef)(o);s.current=o;let i=r,l=r,u=r,d=(0,y.useRef)(u);d.current=u;let f=(0,y.useRef)({file:i,directory:l});f.current={file:i,directory:l};let p=!1,m=(0,y.useRef)(p);m.current=p;let h=(0,y.useRef)(void 0);n?m8e(h.current?.owner,n)||(h.current={owner:n}):h.current=void 0;let g=h.current,b=(0,y.useRef)(void 0);(0,y.useEffect)(()=>{if(!g){b.current=void 0;return}let v={};return b.current=v,()=>{queueMicrotask(()=>{b.current===v&&h.current===g&&(h.current=void 0)})}},[g]);let w=(0,y.useMemo)(()=>{if(!g)return;let v=g,x=()=>{let I=h.current;if(I!==v)throw new Error("Workspace artifact owner is no longer available");return I.owner},T=I=>{let L=x();if(L.id!==I)throw new Error("Scheduled task workspace owner no longer matches");return L};return{async listDirectory(I){let L=x(),S=await(L.id?t.client.workspaceByCwd(L.cwd).dirList(I):a.listDirectory(I));return x(),S},async readWorkspaceFile(I,L){let S=x(),C=await(S.primary?a.readWorkspaceFile(I,L):t.client.workspaceByCwd(S.cwd).readWorkspaceFile(I,L));return x(),C},async readFileBytes(I,L){let S=x(),C=await(S.primary?a.readFileBytes(I,L):t.client.workspaceByCwd(S.cwd).readWorkspaceFileBytes(I,L));return x(),C},async stat(I){let L=x(),S=await(L.primary?a.stat(I):t.client.workspaceByCwd(L.cwd).fileStat(I));return x(),S},async listScheduledTasks(I){T(I);let L=await a.listScheduledTasks(I);return T(I),L},async updateScheduledTask(I,L,S){T(S);let C=await a.updateScheduledTask(I,L,S);return T(S),C},async deleteScheduledTask(I,L){T(L),await a.deleteScheduledTask(I,L),T(L)}}},[g,a,t.client,o,i,l,u,p]);if(!(!g||!w))return{workspaceCwd:g.owner.cwd,...g.owner.id?{workspaceId:g.owner.id}:{},actions:w}}function Bq({tool:e,workspaceCwd:t,onOpen:a,iconOnly:n}){let r=Oa(),o=u8e(e);return r!=="interactive"||!a||!t||!o?.trim()?null:(0,c.jsx)(h8e,{filePath:o,workspaceCwd:t,tool:e,onOpen:a,iconOnly:n},JSON.stringify([t,o,e.callId]))}function h8e({filePath:e,workspaceCwd:t,tool:a,onOpen:n,iconOnly:r}){let{t:o}=Ze(),{status:s}=sk(),i=Qj(t)?.actions,[l,u]=(0,y.useState)(),d=(0,y.useRef)({sequence:0}).current,f=(0,y.useRef)({actions:i,status:s,onOpen:n});if(f.current={actions:i,status:s,onOpen:n},(0,y.useEffect)(()=>{if(u(void 0),!i||s!=="connected")return;let m=async()=>{let h=++d.sequence;try{let g=await i.stat(e);h===d.sequence&&u(g.type==="file"?i:void 0)}catch{h===d.sequence&&u(void 0)}};return m(),window.addEventListener("focus",m),()=>{d.sequence++,window.removeEventListener("focus",m)}},[i,e,d,s,a.status]),!i||s!=="connected"||l!==i)return null;let p=async()=>{let m=++d.sequence;try{let h=await i.stat(e);if(m!==d.sequence||f.current.actions!==i||f.current.status!=="connected"||f.current.onOpen!==n)return;if(h.type!=="file"){u(void 0);return}n({id:`file:${t}:${e}`,kind:"attachment",title:e.split(/[/\\]/).pop()||e,turnId:a.callId,workspacePath:e,workspaceCwd:t,silentUnavailable:!0})}catch{m===d.sequence&&u(void 0)}};return(0,c.jsxs)(pa,{type:"button",variant:"ghost",size:r?"icon-xs":"xs",className:"ml-auto text-muted-foreground",title:o("tool.viewCurrentFile"),"aria-label":o(a9(e)?"tool.viewImage":"tool.viewFile"),onClick:()=>void p(),children:[!r&&o(a9(e)?"tool.viewImage":"tool.viewFile"),(0,c.jsx)(nl,{"aria-hidden":"true"})]})}function g8e({result:e,onOpen:t}){let{t:a}=Ze();return(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-2 px-3 py-2 text-xs","data-managed-tool-result":e.id,children:[(0,c.jsx)(M6,{variant:"outline",children:a(`managed.result.execution.${e.execution_status}`)}),(0,c.jsx)(M6,{variant:"outline",children:a(`managed.result.capture.${e.capture_status??"none"}`)}),(0,c.jsx)(M6,{variant:"outline",children:a(`managed.result.delivery.${e.delivery_status}`)}),t&&(0,c.jsx)(pa,{size:"sm",variant:"ghost",onClick:()=>t(e.item_id),children:a("managed.result.view")})]})}function Jj(e,t,a){if(e.current)return;let n={};e.current=n,t().then(r=>{e.current===n&&!r&&a()},()=>{e.current===n&&a()}).finally(()=>{e.current===n&&(e.current=null)})}function v8e(e){let t=e.toolName.toLowerCase();return Ns(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||n7(t)||e7(t)||$o(e.toolName)||a7(t)}function _b(e){let t=e.toLowerCase();return t==="edit"||t==="editfile"||t==="write"||t==="write_file"||t==="writefile"}function y8e(e){let t=w8e(e);if(t)return t;if(e.content){let o=e.content.find(s=>s.type==="diff");if(o&&o.type==="diff")return dq(o.oldText||"",o.newText||"")}if(e.status==="failed"||e.wasCancelled)return"";let a=e.args?.patch;if(typeof a=="string"&&a)return a;let n=e.args?.newText??e.args?.new_string,r=e.args?.oldText??e.args?.old_string;return typeof n=="string"||typeof r=="string"?dq(typeof r=="string"?r:"",typeof n=="string"?n:""):""}function w8e(e){if(e.rawOutput&&typeof e.rawOutput=="object"){let t=e.rawOutput;if(b8e(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function b8e(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}var k8e=60,x8e=2e5,S8e=1e3,C8e={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 T8e({tool:e}){let{t}=Ze(),a=(0,y.useMemo)(()=>au(e)||"",[e]);if(!a)return(0,c.jsx)("div",{className:me.expandedRead,children:(0,c.jsx)("pre",{className:me.expandedOutput,children:t(an(e.status)?"shell.result.waiting":oU(e)?"shell.result.empty":"shell.result.unavailable")})});let n=L8e(I8e(e)),r=n==="text"||a.length>x8e||_8e(a,S8e);return(0,c.jsx)("div",{className:me.expandedRead,children:r?(0,c.jsx)("pre",{className:me.expandedOutput,children:a}):(0,c.jsx)(wi,{content:A8e(n,a)})})}function I8e(e){let t=e.args?.file_path??e.args?.path;return typeof t=="string"?t:""}function _8e(e,t){let a=1;for(let n=0;n<e.length;n++)if(e.charCodeAt(n)===10&&++a>t)return!0;return!1}function L8e(e){let t=e.split(/[?#]/,1)[0]?.split(".").pop()?.toLowerCase();if(!t||t===e.toLowerCase()||t==="mermaid"||t==="mmd")return"text";let a=C8e[t]??t;return/^[\w+.#-]+$/.test(a)?a:"text"}function A8e(e,t){let a=t.match(/~{3,}/g)?.reduce((r,o)=>Math.max(r,o.length),0)??0,n="~".repeat(Math.max(3,a+1));return`${n}${e}
628
628
  ${t}
629
629
  ${n}`}function Fq({tool:e}){let t=(0,y.useMemo)(()=>y8e(e),[e]),a=(0,y.useMemo)(()=>e.content&&au(e)||"",[e]);return!t&&!a?null:(0,c.jsx)("div",{className:me.expandedEdit,children:t?(0,c.jsx)(o5e,{diff:t}):(0,c.jsx)("pre",{className:me.expandedOutput,children:a})})}function cg({title:e,action:t,detail:a,status:n,children:r}){return(0,c.jsxs)("div",{className:me.expandedCard,children:[(0,c.jsxs)("div",{className:me.expandedCardHeader,children:[(0,c.jsxs)("span",{className:me.expandedCardTitleRow,children:[n&&(0,c.jsx)(Hp,{status:n}),(0,c.jsx)("span",{className:me.expandedCardTitle,children:e}),t]}),a&&(0,c.jsx)("span",{className:me.expandedCardDetail,children:a})]}),r&&(0,c.jsx)("div",{className:me.expandedCardBody,children:r})]})}function R8e({tool:e,todos:t,expanded:a,title:n}){let r=(0,y.useContext)(j9).get(e.callId)?.events??[];return a?(0,c.jsx)(cg,{title:n,status:e.status,children:(0,c.jsx)("div",{className:me.todoBody,children:(0,c.jsx)(jU,{todos:t})})}):(0,c.jsx)("div",{className:me.todoBody,children:(0,c.jsx)(UU,{todos:t,events:r})})}function E8e({tool:e,displayName:t,detail:a,result:n}){let{t:r}=Ze(),o=y5e(),s=o?b5e(o.tasks,e):void 0;return s?(0,c.jsx)(OU,{task:s}):(0,c.jsx)(cg,{title:t,detail:a,children:(0,c.jsx)("div",{className:me.workflowFallback,role:"status",children:e.status==="pending"||e.status==="in_progress"?r("workflow.inline.loading"):n||r("workflow.inline.unavailable")})})}function eH(e,t){let a=Yp(e.rawOutput),n=r7(e),r=hg(e),o=i7(e),s=M8e(e),i=ak(e),l=e.subTools?.length||a?.toolCalls?.length||0,u=a?.executionSummary,d=u&&typeof u.totalDurationMs=="number"?$U(u.totalDurationMs):Vp(e.startTime,e.endTime??(e.status==="in_progress"&&t?t:void 0)),f=a&&typeof a.tokenCount=="number"&&a.tokenCount>0?a.tokenCount:u&&typeof u.outputTokens=="number"&&u.outputTokens>0?u.outputTokens:0,p=f>0?s7(f):"";return{agentType:o,explicitAgentType:s,description:i,subToolCount:l,elapsed:d,tokens:p,status:r,reason:n}}function M8e(e){let t=Yp(e.rawOutput)?.subagentName;if(typeof t=="string"&&t.trim())return t.trim();let a=e.args?.subagent_type;return typeof a=="string"&&a.trim()?a.trim():""}function qq(e){if(e.status==="completed")return!1;let t=e.toolName.toLowerCase();return!!($o(e.toolName)||_b(t)||Ns(t))}function P8e({tool:e}){let t=au(e)||"";return(0,c.jsx)("pre",{className:me.expandedOutput,children:t})}function N8e({tool:e}){let t=O8e(e)||(typeof e.args?.args=="string"&&e.args.args.trim()?e.args.args.trim():e.title??"");return(0,c.jsx)("pre",{className:me.expandedOutput,children:t})}function O8e(e){let t=e.content?.[0];return t?.type!=="content"?"":typeof t.content?.text=="string"?t.content.text:""}function Zb(e){let t=e.toolName.toLowerCase();return lr(e)?"agent":$o(e.toolName)?"ask":Ns(t)?"shell":O9(t)?"fetch":zd(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 D8e({description:e,elapsed:t}){return(0,c.jsxs)(c.Fragment,{children:[e&&(0,c.jsx)("span",{className:me.lineArg,children:e}),t&&(0,c.jsx)("span",{className:me.lineElapsed,children:t})]})}function ng({info:e}){let{renderToolHeaderExtra:t}=Bo(),a=t?.(e);return a?(0,c.jsx)(c.Fragment,{children:a}):(0,c.jsx)(D8e,{description:e.description,elapsed:e.kind==="agent"||an(e.tool.status)?e.elapsed:""})}function $8e(e){return e.length>k8e||e.includes(`
630
- `)}function B8e(e){return e.find(t=>an(t.status))??e[e.length-1]}function F8e(e,t,a,n=!1){if(H9(e)){let o=e.filter(i=>an(i.status)&&!Os(i));if(o.length===0)return t("subagent.background");if(o.length===1&&$o(o[0].toolName))return t("toolGroup.summary.provideInformation");let s=o.map(i=>$o(i.toolName)?t("toolGroup.summary.provideInformation"):tH(i,t,a));return t("toolGroup.running",{name:s.join(" · "),count:o.length})}return z8e(e,t,n)||t("toolGroup.summary",{count:e.length})}function tH(e,t,a){if(zd(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if($o(e.toolName))return an(e.status)?t("toolGroup.summary.provideInformation"):t("toolGroup.summary.askedQuestions",{count:nH(e)});let{displayName:n,description:r,hideDisplayName:o}=aH(e,t,a);return[o?"":n,r].filter(Boolean).join(" ")}function aH(e,t,a){let n=Jc(e.toolName,t),r=tn(rU(e,a),120);return{kind:Zb(e),tool:e,displayName:n,description:r,elapsed:"",workspaceCwd:a,hideDisplayName:!!Qhe(e)}}function q8e({tool:e,workspaceCwd:t}){let{t:a}=Ze(),n=$o(e.toolName),r=an(e.status),o=Os(e),s=r&&!o&&lr(e),i=ik(s),l=!n&&r?o?a("subagent.background"):a("toolGroup.runningPrefix").trim():"";if(zd(e.toolName)||n)return(0,c.jsxs)(c.Fragment,{children:[l&&(0,c.jsxs)("span",{children:[l," "]}),tH(e,a,t)]});let u=aH(e,a,t),d=s?uU(e,a):"",f=s?{...u,description:[u.description,d&&`(${d})`].filter(Boolean).join(" "),elapsed:eH(e,i).elapsed}:u;return(0,c.jsxs)(c.Fragment,{children:[l&&(0,c.jsxs)("span",{children:[l," "]}),(0,c.jsxs)("span",{className:me.chatSummaryInline,children:[!f.hideDisplayName&&(0,c.jsx)("span",{className:me.lineName,children:f.displayName}),(0,c.jsx)(ng,{info:f})]})]})}function z8e(e,t,a){let n=a?e.filter(lr).length:0;if(n>0){let f=e.length-n;return[t("toolGroup.summary.ranAgents",{count:n}),f?t("toolGroup.summary",{count:f}):""].filter(Boolean).join(" · ")}let r=0,o=0,s=0,i=0,l=0,u=0,d=0;for(let f of e){let p=f.toolName.toLowerCase();Ns(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++:zd(p)?l++:$o(p)?u+=nH(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}):"",u?t("toolGroup.summary.askedQuestions",{count:u}):"",d?t("toolGroup.summary.otherTools",{count:d}):""].filter(Boolean).join(" ")}function nH(e){let t=e.args?.questions;return Array.isArray(t)&&t.length>0?t.length:1}function U8e(){return(0,c.jsxs)("svg",{className:me.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,c.jsx)("path",{d:"M12 20h9"}),(0,c.jsx)("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function rH(){return(0,c.jsxs)("svg",{className:me.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[(0,c.jsx)("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),(0,c.jsx)("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),(0,c.jsx)("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function j8e(){return(0,c.jsxs)("svg",{className:me.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[(0,c.jsx)("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.25"}),(0,c.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 H8e(){return(0,c.jsxs)("svg",{className:me.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[(0,c.jsx)("rect",{x:"2",y:"1.6",width:"10",height:"10.8",rx:"2.2",stroke:"currentColor",strokeWidth:"1.25"}),(0,c.jsx)("path",{d:"M4.5 5.2h5M4.5 7h5M4.5 8.8h5",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function W8e(){return(0,c.jsx)("svg",{className:me.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:(0,c.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 G8e(){return(0,c.jsx)("svg",{className:me.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:(0,c.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 N9(){return(0,c.jsx)("svg",{className:me.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:(0,c.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 oH({tool:e}){let t=Zb(e);return t==="agent"?(0,c.jsx)(N9,{}):t==="ask"?(0,c.jsx)(G8e,{}):t==="edit"||t==="write"?(0,c.jsx)(U8e,{}):t==="fetch"?(0,c.jsx)(j8e,{}):t==="read"?(0,c.jsx)(H8e,{}):t==="todo"?(0,c.jsx)(W8e,{}):(0,c.jsx)(rH,{})}function O9(e){let t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}function V8e(e,t){if(e.approval?.id!==t.approval?.id||e.workspaceCwd!==t.workspaceCwd||e.onTurnOutputOpen!==t.onTurnOutputOpen||e.onToolResultOpen!==t.onToolResultOpen||e.summaryOnly!==t.summaryOnly||e.forceExpanded!==t.forceExpanded||e.detailsVisible!==t.detailsVisible||e.hideHeader!==t.hideHeader||e.hideCollapsedOutput!==t.hideCollapsedOutput)return!1;let a=e.tool,n=t.tool;return a.callId===n.callId&&a.generatedUiToolCallId===n.generatedUiToolCallId&&a.toolName===n.toolName&&a.status===n.status&&a.subagentSessionReady===n.subagentSessionReady&&a.startTime===n.startTime&&a.endTime===n.endTime&&a.subContent===n.subContent&&a.rawOutput===n.rawOutput&&a.toolResult===n.toolResult&&a.toolDetailsRevision===n.toolDetailsRevision&&a.wasCancelled===n.wasCancelled&&a.args===n.args&&a.content===n.content&&a.locations===n.locations&&a.title===n.title&&K8e(a.subTools,n.subTools)}function K8e(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let a=0;a<e.length;a++){let n=e[a],r=t[a];if(n.callId!==r.callId||n.generatedUiToolCallId!==r.generatedUiToolCallId||n.toolName!==r.toolName||n.status!==r.status||n.subagentSessionReady!==r.subagentSessionReady||n.endTime!==r.endTime||n.rawOutput!==r.rawOutput||n.toolResult!==r.toolResult||n.toolDetailsRevision!==r.toolDetailsRevision||n.wasCancelled!==r.wasCancelled||n.args!==r.args||n.subContent!==r.subContent||n.title!==r.title)return!1}return!0}var zq=/\[([^\]]+)\]\(qwen-session:\/\/([^)]+)\)/g;function z6(e,t){if(!e||!e.includes("qwen-session://"))return e;let a=[],n=0,r;for(zq.lastIndex=0;(r=zq.exec(e))!==null;){r.index>n&&a.push(e.slice(n,r.index));let o=r[2];a.push(t!=="interactive"?(0,c.jsx)("span",{style:{textDecoration:"underline"},children:r[1]},r.index):(0,c.jsx)("a",{href:"#",role:"button",style:{textDecoration:"underline",cursor:"pointer"},onClick:s=>{s.preventDefault(),s.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:o}))},children:r[1]},r.index)),n=r.index+r[0].length}return n<e.length&&a.push(e.slice(n)),a.length===1?a[0]:(0,c.jsx)(c.Fragment,{children:a})}var D9=(0,y.memo)(function({tool:e,approval:t,workspaceCwd:a,onTurnOutputOpen:n,onToolResultOpen:r,summaryOnly:o=!1,forceExpanded:s=!1,detailsVisible:i=!0,hideHeader:l=!1,hideCollapsedOutput:u=!1}){let{t:d}=Ze(),f=Oa(),p=nk(),m=zU(),{hostOwnsEditDiffPreview:h}=Bo(),g=m!==void 0,b=bg(e.rawOutput),w=bU(b),v=s||!!b,x=t?.toolCallId===e.callId,T=!!(h&&x&&t?.hasDiffPreview&&_b(t?.toolName??e.toolName)),I=T,[L,S]=(0,y.useState)(!1),[C,E]=(0,y.useState)(()=>v||!o&&qq(e)&&!I),R=(0,y.useRef)(null),P=(0,y.useRef)(!1),N=a7(e.toolName);(0,y.useEffect)(()=>{E(v||!o&&qq(e)&&!I),S(!1),R.current=null,P.current=!1},[v,I,g,o,e.callId,e.toolName]);let q=lr(e),H=!x&&t?.toolCallId&&q&&Ds(e,t.toolCallId),z=!!(T||h&&H&&t?.hasDiffPreview&&_b(t.toolName??"")),G=an(e.status),re=G&&!Ns(e.toolName)&&!O9(e.toolName)&&!z,X=ik(re);if((0,y.useEffect)(()=>{!v&&!q&&e.status==="completed"&&!P.current&&E(!1)},[v,q,e.status]),q){let ae=eH(e,X),ge=ae.explicitAgentType?`${d("agent.label")} (${Ig(ae.explicitAgentType,d)})`:d("agent.label"),$e=e.status==="completed"||e.status==="failed",He=Os(e),Je=[He&&!$e?d("subagent.background"):e.status==="pending"?d("subagent.pending"):d("subagent.running"),He&&!$e||z?"":ae.elapsed].filter(Boolean).join(" · "),Gt=[ae.subToolCount>0?d("subagent.toolsCount",{count:ae.subToolCount}):"",ae.elapsed,ae.tokens,ae.reason?tn(ae.reason,80):""].filter(Boolean).join(" · "),at=s||C||!!H,wt=!!x,$t=yi(e),tt=(0,c.jsx)(f7,{tool:e,approval:h?t:void 0,hideHeader:!0,defaultExpanded:!0,inline:!0});if(p&&!l){let gt=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(N9,{}),(0,c.jsx)(Hp,{status:$e?ae.status:e.status}),(0,c.jsx)("span",{className:me.lineName,children:ge}),(0,c.jsx)(ng,{info:{kind:"agent",tool:e,displayName:ge,description:ae.description?tn(ae.description,60):"",elapsed:$e?Gt:Je,workspaceCwd:a}})]});return(0,c.jsx)("div",{className:me.line,"data-transcript-tool-call-id":e.callId,children:wt?(0,c.jsx)("div",{className:`${me.lineMain} ${me.lineButton}`,"aria-disabled":"true",children:gt}):(0,c.jsxs)("button",{type:"button",className:`${me.lineMain} ${me.lineExpandable} ${me.lineButton}`,"aria-disabled":!!$t||void 0,title:$t?d($t):void 0,onClick:()=>{$t||p.onOpen(e)},children:[gt,(0,c.jsx)("span",{className:me.lineChevronRight,"aria-hidden":"true"})]})})}return(0,c.jsxs)("div",{className:me.line,"data-transcript-tool-call-id":e.callId,children:[!l&&(0,c.jsxs)("div",{className:`${me.lineMain} ${wt?"":me.lineExpandable}`,"aria-disabled":!!$t||void 0,title:$t?d($t):void 0,onClick:wt||$t?void 0:()=>E(!C),children:[(0,c.jsx)(N9,{}),(0,c.jsx)(Hp,{status:$e?ae.status:e.status}),(0,c.jsx)("span",{className:me.lineName,children:ge}),(0,c.jsx)(ng,{info:{kind:"agent",tool:e,displayName:ge,description:ae.description?tn(ae.description,60):"",elapsed:$e?Gt:Je,workspaceCwd:a}}),!wt&&(0,c.jsx)("span",{className:C?me.lineChevronDown:me.lineChevronRight,"aria-hidden":"true"})]}),at&&(0,c.jsx)("div",{className:me.lineDetail,children:l?(0,c.jsx)("div",{className:me.expandedAgentCard,children:tt}):tt})]})}let V=qb(e,a),A=f==="document"&&C?au(e)??AF(e):AF(e),$=Ns(e.toolName)?rU(e,a):V,K=Jc(e.toolName,d),O=z||Ns(e.toolName)||O9(e.toolName)?"":Vp(e.startTime,G?X:e.endTime),ee=e.toolName.toLowerCase(),de=ee==="monitor"&&g&&!L&&!l,ye=zd(ee),oe=ye?xU(e):void 0,te=!!oe&&oe.length>0,le=oe?oe.filter(ae=>ae.status==="completed").length:0,J=Ns(ee),_e=ee==="grep"||ee==="grep_search"||ee==="search"||ee==="glob",xe=ee==="read"||ee==="read_file"||ee==="readfile",je=e7(ee),be=i&&(xe||_b(ee)||ee==="display_image"||ee==="zoom_image")?(0,c.jsx)(Bq,{tool:e,workspaceCwd:a,onOpen:n}):void 0,W=!ye&&$8e($),ke=!v&&!I,Ce=de||ke,ze=()=>{P.current=!0,E(ae=>!ae)},lt=()=>{S(!0),ke&&ze()},zt=()=>{m&&Jj(R,()=>m.onOpen(e),lt)},ta=v8e(e),ha=C&&W,pt=xe||je,Ie=ha&&!J&&!_e&&!xe,ne=V,Z=C&&!ta&&(!ye||!te&&!A);return(0,c.jsxs)("div",{className:me.line,"data-transcript-tool-call-id":e.callId,children:[l&&G&&O&&(0,c.jsx)("div",{className:me.lineMain,children:(0,c.jsx)(ng,{info:{kind:Zb(e),tool:e,displayName:K,description:"",elapsed:O,workspaceCwd:a}})}),!l&&(0,c.jsxs)("div",{className:`${me.lineMain} ${Ce?me.lineExpandable:""}`,title:de?void 0:ke?d(C?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":de?void 0:ke?C:void 0,role:Ce?"button":void 0,tabIndex:Ce?0:void 0,onClick:Ce?()=>{if(de){zt();return}ze()}:void 0,onKeyDown:Ce?ae=>{if(!(ae.key!=="Enter"&&ae.key!==" ")){if(ae.preventDefault(),de){zt();return}ze()}}:void 0,children:[(0,c.jsx)(oH,{tool:e}),(0,c.jsx)(Hp,{status:e.status}),(0,c.jsx)("span",{className:me.lineName,children:K}),ye&&te&&(0,c.jsxs)("span",{className:me.todoProgress,children:[le,"/",oe.length]}),(0,c.jsx)(ng,{info:{kind:Zb(e),tool:e,displayName:K,description:ye||Ie?"":$,elapsed:ye?"":O,workspaceCwd:a}}),Ce&&(0,c.jsx)("span",{className:!de&&C?me.lineChevronDown:me.lineChevronRight,"aria-hidden":"true"})]}),b&&(!o||C)&&(w?(0,c.jsx)(l8e,{display:b,toolId:e.generatedUiToolCallId,visible:i}):(0,c.jsx)(Yj,{display:b})),!b&&(!o||C)&&ye&&te&&(0,c.jsx)(R8e,{tool:e,todos:oe,expanded:C,title:K}),!b&&(!o||C)&&ye&&!te&&A&&(0,c.jsx)("div",{className:me.lineOutput,children:z6(A,f)}),!b&&Z&&(0,c.jsx)(cg,{title:K,detail:ne,status:e.status,action:be,children:A&&(0,c.jsx)("div",{className:`${me.lineOutput} ${me.expandedLineOutput}`,children:z6(A,f)})}),!b&&!ye&&!u&&A&&!Z&&(!C||!ta)&&(!o||C)&&(0,c.jsx)("div",{className:C?`${me.lineOutput} ${me.expandedLineOutput}`:me.lineOutput,children:z6(A,f)}),!b&&!ye&&C&&ta&&(!N||i)&&(0,c.jsx)("div",{className:N?`${me.lineDetail} ${me.workflowLineDetail}`:pt?`${me.lineDetail} ${me.markdownLineDetail}`:me.lineDetail,children:(0,c.jsx)(h5e,{tool:e,enabled:i&&(J||xe),children:ae=>N?(0,c.jsx)(E8e,{tool:ae,displayName:K,detail:ne,result:A}):J?(0,c.jsx)(f5e,{tool:ae}):xe?(0,c.jsx)(cg,{title:K,status:ae.status,action:i?(0,c.jsx)(Bq,{tool:ae,workspaceCwd:a,onOpen:n}):void 0,children:(0,c.jsx)(T8e,{tool:ae})}):(0,c.jsxs)(cg,{title:K,detail:ne,status:ae.status,action:be,children:[(ee==="write_file"||ee==="writefile")&&(0,c.jsx)(Fq,{tool:ae}),(ee==="edit"||ee==="write"||ee==="editfile")&&(0,c.jsx)(Fq,{tool:ae}),$o(ae.toolName)&&(0,c.jsx)(P8e,{tool:ae}),n7(ee)&&(0,c.jsx)(N8e,{tool:ae}),je&&(0,c.jsx)(wi,{content:sU(ae)??""})]})})}),e.toolResult&&(C||e.toolResult.execution_status!=="success"||e.toolResult.capture_status==="partial"||e.toolResult.capture_status==="unavailable"||e.toolResult.delivery_status!=="committed")&&(0,c.jsx)(g8e,{result:e.toolResult,onOpen:r})]})},V8e),X8e=(0,y.memo)(function({isStreaming:e,expanded:t,documentMode:a,translateContent:n,generateContent:r,onToggle:o}){let{language:s,t:i}=Ze();return(0,c.jsxs)("div",{className:`${me.chatSummaryThoughtHeader}${t?` ${me.chatSummaryThoughtHeaderExpanded}`:""}`,onClick:l=>{!a&&l.currentTarget.contains(l.target)&&o()},children:[(0,c.jsxs)("button",{type:"button",disabled:a,tabIndex:a?-1:void 0,className:me.chatSummaryThoughtSummary,"data-testid":"compact-thinking-summary","aria-expanded":a?void 0:t,title:a?void 0:i(t?"thinking.collapse":"thinking.expand"),children:[(0,c.jsx)("span",{className:me.chatSummaryThoughtIcon,"aria-hidden":"true",children:(0,c.jsx)(l7,{})}),(0,c.jsx)("span",{className:`${me.chatSummaryThoughtLabel}${e?` ${me.chatSummaryThoughtLabelActive}`:""}`,children:i(e?"thinking.running":"thinking.done")})]}),s==="zh-CN"&&n!==void 0&&r&&(0,c.jsx)(fU,{content:n,generateContent:r,className:me.chatSummaryThoughtTranslate}),(0,c.jsx)("span",{className:t?me.chatSummaryThoughtChevronDown:me.chatSummaryThoughtChevronRight,"aria-hidden":"true"})]})}),U6=(0,y.memo)(function({content:e,isStreaming:t,generateContent:a}){let n=Oa()==="document",r=Qb(),[o,s]=(0,y.useState)(!1),i=n?r:o,l=(0,y.useCallback)(()=>{n||s(u=>!u)},[n]);return(0,c.jsxs)("div",{className:me.chatSummaryThought,children:[(0,c.jsx)(X8e,{isStreaming:t,expanded:i,documentMode:n,translateContent:n||t?void 0:e,generateContent:a,onToggle:l}),i&&(0,c.jsx)("div",{className:me.chatSummaryThoughtContent,children:(0,c.jsx)(wi,{content:e,source:"thinking",isStreaming:t})})]})}),Z8e=(0,y.memo)(function({tools:e,compactSummary:t=!1,thoughts:a,pendingApproval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,isLocateFlashing:i=!1,generateContent:l}){let{t:u}=Ze(),d=Oa()==="document",f=Qb(),p=nk(),m=zU(),h=m!==void 0,[g,b]=(0,y.useState)(!1),[w,v]=(0,y.useState)(!1),x=d?f:w,T=(0,y.useRef)(null),I=H9(e),L=e.find(oe=>an(oe.status)&&!Os(oe))??(e.length>0?B8e(e):void 0),S=e.length===1?e[0]:void 0,C=!!a?.length,E=S&&lr(S)?S:void 0,R=S&&S.toolName.toLowerCase()==="monitor"?S:void 0,P=(S?bg(S.rawOutput):void 0)?.resourceUri,N=e.some(oe=>bg(oe.rawOutput)),q=e.some(oe=>a7(oe.toolName)),H=e.some(oe=>an(oe.status)&&!Os(oe)),z=a?.find(oe=>oe.isStreaming),G=I&&H?!0:z!==void 0,re=!G&&e.some(oe=>an(oe.status)&&Os(oe)),X=!!(!t&&E&&p),V=!!(!t&&R&&h&&!g),A=X||V,$=!t&&E?yi(E):void 0,K=I?L??e[0]:e[0],O=n?.toolCallId&&e.some(oe=>Ds(oe,n.toolCallId)),ee=new Map,de=new Set;for(let oe=0;t&&oe<e.length;oe++){if(!lr(e[oe]))continue;let te=oe+1;for(;te<e.length&&lr(e[te]);)te++;if(te-oe>=2){let le=e.slice(oe,te);ee.set(le[0].callId,le);for(let J of le.slice(1))de.add(J.callId)}oe=te-1}(0,y.useEffect)(()=>{b(!1),v(!1),T.current=null},[h,R?.callId]),(0,y.useEffect)(()=>{(P||N)&&v(!0)},[P,N]);let ye=()=>{!R||!m||Jj(T,()=>m.onOpen(R),()=>{b(!0),v(oe=>!oe)})};return O?(0,c.jsx)("div",{className:`${me.group}${i?` ${Ol.flash}`:""}`,children:e.map(oe=>(0,c.jsx)(D9,{tool:oe,approval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,forceExpanded:d},oe.callId))}):(0,c.jsxs)("div",{className:i?Ol.flash:void 0,children:[(0,c.jsxs)("button",{type:"button",disabled:d,"aria-disabled":!!$||void 0,tabIndex:d?-1:void 0,className:me.chatSummary,onClick:()=>{if(!(d||$)){if(X&&E&&p){p.onOpen(E);return}if(V&&R&&m){ye();return}v(oe=>!oe)}},"aria-expanded":d||A?void 0:w,title:$?u($):d||A?void 0:u(x?"tool.collapseHint":"tool.expand"),children:[(0,c.jsx)("span",{className:re?`${me.chatSummaryIcon} ${me.chatSummaryIconDetached}`:me.chatSummaryIcon,"aria-hidden":"true",children:z?(0,c.jsx)(l7,{}):K?(0,c.jsx)(oH,{tool:K}):(0,c.jsx)(rH,{})}),(0,c.jsx)("span",{className:G?`${me.chatSummaryText} ${me.chatSummaryTextActive}`:me.chatSummaryText,children:z?u("thinking.running"):S?(0,c.jsx)(q8e,{tool:S,workspaceCwd:r}):F8e(e,u,r,t)}),(0,c.jsx)("span",{className:x?me.chatChevronDown:me.chatChevronRight,"aria-hidden":"true"})]}),(x||N||q)&&(0,c.jsx)("div",{"aria-hidden":!x,ref:oe=>{oe?.toggleAttribute("inert",!x)},className:x?me.chatSummaryContentClip:`${me.chatSummaryContentClip} ${me.chatSummaryContentCollapsed}`,style:!x&&N&&!q?{display:"none"}:void 0,children:(0,c.jsx)("div",{className:me.chatSummaryContentInner,children:(0,c.jsxs)("div",{className:`${me.group} ${me.chatSummaryGroup}`,children:[e.map(oe=>{if(de.has(oe.callId))return null;let te=ee.get(oe.callId);return(0,c.jsxs)(y.Fragment,{children:[a?.filter(le=>le.beforeToolCallId===oe.callId).map((le,J)=>(0,c.jsx)(U6,{content:le.content,isStreaming:le.isStreaming,generateContent:l},`thought-${oe.callId}-${J}`)),te?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:me.chatSummaryParallelAgents,"data-testid":"compact-parallel-agents",children:(0,c.jsx)(FU,{agents:te,pendingApproval:n})}),te.slice(1).flatMap(le=>a?.filter(J=>J.beforeToolCallId===le.callId).map((J,_e)=>(0,c.jsx)(U6,{content:J.content,isStreaming:J.isStreaming,generateContent:l},`thought-${le.callId}-${_e}`)))]}):(0,c.jsx)(D9,{tool:oe,approval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,summaryOnly:!S||C,forceExpanded:d||!!S&&!C,detailsVisible:x,hideHeader:!!S&&!C})]},oe.callId)}),a?.filter(oe=>oe.beforeToolCallId===void 0).map((oe,te)=>(0,c.jsx)(U6,{content:oe.content,isStreaming:oe.isStreaming,generateContent:l},`thought-trailing-${te}`))]})})})]})}),q7="summary-",ug=e=>`${q7}${e}`,sH=e=>e.startsWith(q7),dg=e=>sH(e)?e.slice(q7.length):void 0,Y8e="_message_1ujhf_1",Q8e="_header_1ujhf_6",J8e="_headerStatic_1ujhf_7",eIe="_chevron_1ujhf_24",tIe="_title_1ujhf_30",aIe="_progress_1ujhf_39",Gc={message:Y8e,header:Q8e,headerStatic:J8e,chevron:eIe,title:tIe,progress:aIe};function nIe({id:e,todos:t}){let a=(0,y.useContext)(j9).get(e)?.events??[];return(0,c.jsx)(UU,{todos:t,events:a})}var rIe=(0,y.memo)(function({id:e,todos:t,isLocateFlashing:a=!1}){let{t:n}=Ze(),r=Oa()==="document",o=Qb(),[s,i]=(0,y.useState)(!1);if(t.length===0)return null;let l=r?o:s,u=t.length,d=t.filter(f=>f.status==="completed").length;return(0,c.jsxs)("div",{className:`${Gc.message}${a?` ${Ol.flash}`:""}`,children:[r?(0,c.jsxs)("div",{className:Gc.headerStatic,children:[(0,c.jsx)("span",{className:Gc.title,children:n("plan.title")}),(0,c.jsxs)("span",{className:Gc.progress,children:[d,"/",u]})]}):(0,c.jsxs)("button",{type:"button",className:Gc.header,onClick:()=>i(f=>!f),"aria-expanded":s,title:n(s?"todo.collapse":"todo.expand"),children:[(0,c.jsx)("span",{className:Gc.chevron,"aria-hidden":"true",children:s?"▾":"▸"}),(0,c.jsx)("span",{className:Gc.title,children:n("plan.title")}),(0,c.jsxs)("span",{className:Gc.progress,children:[d,"/",u]})]}),l?(0,c.jsx)(jU,{todos:t,numbered:!0}):(0,c.jsx)(nIe,{id:e,todos:t})]})}),oIe="_message_1abcu_1",sIe="_content_1abcu_11",iIe="_question_1abcu_17",lIe="_prefix_1abcu_24",cIe="_answer_1abcu_28",uIe="_pending_1abcu_32",dIe="_shortcuts_1abcu_36",Cd={message:oIe,content:sIe,question:iIe,prefix:lIe,answer:cIe,pending:uIe,shortcuts:dIe},fIe=(0,y.memo)(function({question:e,answer:t,isPending:a}){let{t:n}=Ze(),r=(0,y.useRef)(null),o=(0,y.useRef)(null),s=(0,y.useRef)(!0),i=(0,y.useCallback)(()=>{let l=r.current;l&&s.current&&(l.scrollTop=l.scrollHeight)},[]);return(0,y.useLayoutEffect)(i,[t,a,i]),(0,y.useEffect)(()=>{if(typeof ResizeObserver>"u")return;let l=new ResizeObserver(i);return r.current&&l.observe(r.current),o.current&&l.observe(o.current),()=>l.disconnect()},[i]),(0,c.jsxs)("div",{className:Cd.message,children:[(0,c.jsxs)("div",{ref:r,className:Cd.content,"data-web-shell-btw-content":!0,onScroll:l=>{let u=l.currentTarget;s.current=u.scrollHeight-u.clientHeight-u.scrollTop<=2},children:[(0,c.jsxs)("div",{className:Cd.question,children:[(0,c.jsx)("span",{className:Cd.prefix,children:"/btw "}),(0,c.jsx)("span",{children:e})]}),(0,c.jsx)("div",{ref:o,className:Cd.answer,children:a&&!t?(0,c.jsx)("span",{className:Cd.pending,children:n("btw.answering")}):(0,c.jsx)(wi,{content:t})})]}),(0,c.jsx)("div",{className:Cd.shortcuts,children:n(a?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),pIe="_message_1g0wi_1",mIe="_header_1g0wi_21",hIe="_status_1g0wi_30",gIe="_name_1g0wi_35",vIe="_command_1g0wi_42",yIe="_output_1g0wi_51",Fp={message:pIe,header:mIe,status:hIe,name:gIe,command:vIe,output:yIe},wIe=(0,y.memo)(function({command:e,output:t}){let{t:a}=Ze();return(0,c.jsxs)("div",{className:Fp.message,children:[(0,c.jsxs)("div",{className:Fp.header,children:[(0,c.jsx)("span",{className:Fp.status,children:"✓"}),(0,c.jsx)("span",{className:Fp.name,children:a("shell.command")}),e&&(0,c.jsx)("span",{className:Fp.command,children:e})]}),t&&(0,c.jsx)("pre",{className:Fp.output,children:t})]})}),bIe="_progress_1ik59_1",kIe="_spinner_1ik59_12",xIe="_bar_1ik59_19",SIe="_stage_1ik59_25",CIe="_icon_1ik59_29",TIe="_done_1ik59_35",IIe="_error_1ik59_43",_Ie="_detail_1ik59_51",LIe="_path_1ik59_56",AIe="_pathButton_1ik59_61",$n={progress:bIe,spinner:kIe,bar:xIe,stage:SIe,icon:CIe,done:TIe,error:IIe,detail:_Ie,path:LIe,pathButton:AIe},Uq=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function RIe({progress:e}){let{stage:t,progress:a,detail:n,isComplete:r,error:o}=e,[s,i]=(0,y.useState)(0),l=30,u=Math.round(a/100*l),d=l-u,f="█".repeat(Math.max(0,u))+"░".repeat(Math.max(0,d));return(0,y.useEffect)(()=>{if(r||o)return;let p=setInterval(()=>{i(m=>(m+1)%Uq.length)},120);return()=>clearInterval(p)},[r,o]),o?(0,c.jsxs)("div",{className:`${$n.progress} ${$n.error}`,children:[(0,c.jsx)("span",{className:$n.icon,children:"✕"}),(0,c.jsx)("span",{className:$n.stage,children:t}),(0,c.jsx)("div",{className:$n.detail,children:o})]}):r?(0,c.jsxs)("div",{className:`${$n.progress} ${$n.done}`,children:[(0,c.jsx)("span",{className:$n.icon,children:"✓"}),(0,c.jsx)("span",{className:$n.stage,children:t})]}):(0,c.jsxs)("div",{className:$n.progress,children:[(0,c.jsx)("span",{className:$n.spinner,children:Uq[s]}),(0,c.jsx)("span",{className:$n.bar,children:f}),(0,c.jsxs)("span",{className:$n.stage,children:[t,n?` (${n})`:""]})]})}function EIe({path:e,onInsightReportOpen:t}){let{t:a}=Ze();return(0,c.jsxs)("div",{className:`${$n.progress} ${$n.done}`,children:[(0,c.jsx)("span",{className:$n.icon,children:"✓"}),(0,c.jsx)("span",{className:$n.stage,children:a("insight.ready")}),t?(0,c.jsx)("button",{type:"button",className:`${$n.path} ${$n.pathButton}`,onClick:()=>t(e),children:e}):(0,c.jsx)("span",{className:$n.path,children:e})]})}var MIe=(0,y.createContext)(void 0);function PIe(e,t){return e!=="background_notification"&&e!=="mid_turn_message_injected"&&e!=="goal_runtime"&&e!=="goal_control"&&(e!=="cron"||t.trim().length>0)}function NIe(){return(0,y.useContext)(MIe)}var OIe=(0,y.memo)(function({message:e,pendingApproval:t,onShowContextDetail:a,onOpenMemoryFile:n,onLocateBackgroundSource:r,onImagePreview:o,onAttachmentPreview:s,onTurnOutputOpen:i,onToolResultOpen:l,onInsightReportOpen:u,workspaceCwd:d,showRetryHint:f=!1,onRetryClick:p,sendFailed:m=!1,onRetrySend:h,onEditUserMessage:g,onDeleteMessage:b,deleteMessageDisabled:w,onSubmitUserMessageEdit:v,onBranchSession:x,branchRecordId:T,showAssistantActions:I=!1,assistantFooterAlwaysVisible:L=!1,showAssistantBranch:S=!1,assistantFeedbackTurnId:C,assistantFeedbackPromptId:E,assistantFeedbackRating:R,onAssistantFeedbackRate:P,isLocateFlashing:N=!1,assistantTurnFooterInfo:q,turnSources:H,onSourceOpen:z,generateContent:G}){let{t:re}=Ze(),[X,V]=(0,y.useState)(!1),[A,$]=(0,y.useState)(!1),K=(0,y.useCallback)(()=>{g?.()!==!0&&V(!0)},[g]),O=(0,y.useCallback)(()=>{V(!1)},[]),ee=(0,y.useCallback)(ke=>{v&&($(!0),Promise.resolve(v(ke)).catch(()=>!1).then(Ce=>{$(!1),Ce!==!1&&V(!1)}))},[v]),de=(0,y.useMemo)(()=>x&&T?()=>x(T):void 0,[x,T]),ye=(0,y.useMemo)(()=>P&&E?ke=>P(E,C??"",ke):void 0,[P,E,C]),oe=(0,y.useContext)(U9),te=e.role==="tool_group"&&e.tools.length===1&&t7(e.tools[0])?e.tools[0]:void 0,le=te?Zhe(te):null,J=!!le||e.role==="user"||e.role==="system"&&e.source==="mid_turn_message_injected",_e=NIe(),xe=(()=>{switch(e.role){case"user":return(0,c.jsx)(tU,{content:e.content,images:e.images,files:e.files,inputAnnotations:e.inputAnnotations,isLocateFlashing:N,sendFailed:m,onRetrySend:h,editing:X,submittingEdit:A,onEditSubmit:ee,onEditCancel:O,onImagePreview:o,onAttachmentPreview:s,author:e.author});case"assistant":return(0,c.jsx)(vge,{content:e.content,author:e.author,agentMessage:e.agentMessage,isStreaming:e.isStreaming,timestamp:e.timestamp,onBranchSession:de,showFooterActions:I,footerAlwaysVisible:L,showBranchAction:S,showAssistantFeedback:E!==void 0,assistantFeedbackRating:R,onAssistantFeedbackRate:ye,isLocateFlashing:N,customFooterInfo:q,turnSources:H,onSourceOpen:z});case"thinking":return(0,c.jsx)(xge,{content:e.content,author:e.author,isStreaming:e.isStreaming,timestamp:e.timestamp,isLocateFlashing:N,generateContent:G});case"tool_group":return te&&!le&&!au(te)?.trim()?null:le&&te?!le.answers.length&&!le.text.trim()?null:(0,c.jsx)(Vhe,{tool:te,result:le,isLocateFlashing:N}):(0,c.jsx)(Z8e,{tools:e.tools,onTurnOutputOpen:i,onToolResultOpen:l,thoughts:e.thoughts,compactSummary:oe&&sH(e.id),pendingApproval:t,workspaceCwd:d,isLocateFlashing:N,generateContent:G});case"plan":return(0,c.jsx)(rIe,{id:e.id,todos:e.todos,isLocateFlashing:N});case"system":return(0,c.jsx)(Nxe,{content:e.content,variant:e.variant,source:e.source,data:e.data,images:e.images,files:e.files,onShowContextDetail:a,onOpenMemoryFile:n,onLocateBackgroundSource:r,onImagePreview:o,onAttachmentPreview:s,showRetryHint:f&&e.retryable===!0,onRetryClick:p});case"user_shell":return(0,c.jsx)(wIe,{command:e.command,output:e.output});case"btw":return(0,c.jsx)(fIe,{question:e.question,answer:e.answer,isPending:e.isPending});case"insight_progress":return(0,c.jsx)(RIe,{progress:{stage:e.stage,progress:e.progress,detail:e.detail}});case"insight_ready":return(0,c.jsx)(EIe,{path:e.path,onInsightReportOpen:u});case"insight_error":return(0,c.jsx)("div",{style:{color:"var(--error-color, #e06c75)"},children:e.error});default:return null}})();if(xe===null)return null;let je=(0,c.jsx)($d,{label:`message:${e.role}`,resetKeys:[e],fallback:(0,c.jsx)(DIe,{align:J?"end":"start"}),children:xe}),be=(0,c.jsx)("div",{"data-user-selectable":"true",style:{display:"contents"},children:je});if(e.role==="assistant")return I?be:(0,c.jsx)(t9,{timestamp:e.timestamp,children:be});if(e.role==="system"&&e.source==="prompt_cancelled")return be;let W=_e&&e.role==="user"&&PIe(e.source,e.content)?e.id:void 0;return(0,c.jsx)(t9,{timestamp:e.timestamp,hideTimestamp:e.role==="system"&&(e.source==="background_task_completed"||e.source==="background_notification_turn_started"),chatMode:J,toolGroupSpacing:e.role==="tool_group"&&oe,copyText:J&&"content"in e?e.content:void 0,copyTitle:re("common.copy"),onEdit:g&&!X?K:void 0,editTitle:re("userMessage.edit"),onDelete:b,deleteDisabled:w,deleteTitle:re("messageDelete.entry"),onOpenTurnCalls:_e&&W?()=>_e(W):void 0,turnCallsTitle:re("turnCalls.open"),children:be})},$Ie);function DIe({align:e}){let{t}=Ze();return(0,c.jsx)("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:(0,c.jsx)("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function $Ie(e,t){return e.pendingApproval?.id!==t.pendingApproval?.id||e.onShowContextDetail!==t.onShowContextDetail||e.onOpenMemoryFile!==t.onOpenMemoryFile||e.onLocateBackgroundSource!==t.onLocateBackgroundSource||e.onImagePreview!==t.onImagePreview||e.onAttachmentPreview!==t.onAttachmentPreview||e.onTurnOutputOpen!==t.onTurnOutputOpen||e.onToolResultOpen!==t.onToolResultOpen||e.workspaceCwd!==t.workspaceCwd||e.showRetryHint!==t.showRetryHint||e.onRetryClick!==t.onRetryClick||e.sendFailed!==t.sendFailed||e.onRetrySend!==t.onRetrySend||e.onEditUserMessage!==t.onEditUserMessage||e.onDeleteMessage!==t.onDeleteMessage||e.deleteMessageDisabled!==t.deleteMessageDisabled||e.onSubmitUserMessageEdit!==t.onSubmitUserMessageEdit||e.onInsightReportOpen!==t.onInsightReportOpen||e.onBranchSession!==t.onBranchSession||e.branchRecordId!==t.branchRecordId||e.showAssistantActions!==t.showAssistantActions||e.assistantFooterAlwaysVisible!==t.assistantFooterAlwaysVisible||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||!BIe(e.assistantTurnFooterInfo,t.assistantTurnFooterInfo)?!1:qIe(e.message,t.message)}function BIe(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 FIe(e,t){return e===t?!0:!e||!t?!1:e.status===t.status&&e.error===t.error&&e.totalTokens===t.totalTokens&&e.squadOutcome===t.squadOutcome&&e.author?.squadName===t.author?.squadName&&e.author?.memberSquadName===t.author?.memberSquadName&&(e.steps??[]).length===(t.steps??[]).length&&(e.steps??[]).every((a,n)=>a.title===t.steps?.[n]?.title&&a.status===t.steps?.[n]?.status)}function qIe(e,t){if(e===t)return!0;if(e.id!==t.id||e.role!==t.role||e.timestamp!==t.timestamp||e.author?.name!==t.author?.name||e.author?.color!==t.author?.color)return!1;switch(e.role){case"user":return t.role==="user"&&e.content===t.content&&e.source===t.source&&Hq(e.images,t.images);case"assistant":return t.role==="assistant"&&e.content===t.content&&e.isStreaming===t.isStreaming&&FIe(e.agentMessage,t.agentMessage);case"thinking":return t.role==="thinking"&&e.content===t.content&&e.isStreaming===t.isStreaming;case"system":return t.role==="system"&&e.content===t.content&&e.variant===t.variant&&e.retryable===t.retryable&&e.source===t.source&&e.data===t.data&&Hq(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"&&zIe(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&UIe(e.thoughts,t.thoughts)&&e.tools.length===t.tools.length&&e.tools.every((a,n)=>iH(a,t.tools[n]));default:return!1}}function zIe(e,t){return e.length===t.length&&e.every((a,n)=>{let r=t[n];return r&&a.id===r.id&&a.content===r.content&&a.status===r.status&&a.priority===r.priority})}function iH(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&&vi(e.args)===vi(t.args)&&vi(e.rawOutput)===vi(t.rawOutput)&&vi(e.toolResult)===vi(t.toolResult)&&e.wasCancelled===t.wasCancelled&&vi(e.locations)===vi(t.locations)&&vi(e.content)===vi(t.content)&&jIe(e.subTools,t.subTools):!1}function UIe(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((a,n)=>a.content===t[n]?.content&&a.isStreaming===t[n]?.isStreaming&&a.beforeToolCallId===t[n]?.beforeToolCallId)}function jIe(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((a,n)=>iH(a,t[n]))}var jq=new WeakMap;function Hq(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((a,n)=>a.data===t[n].data&&a.mimeType===t[n].mimeType)}function vi(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=jq.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return jq.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}function Wq({additions:e,deletions:t,className:a,additionsClassName:n,deletionsClassName:r}){return e===void 0||t===void 0?null:(0,c.jsxs)("span",{className:a,children:[(0,c.jsxs)("span",{className:n,children:["+",e]}),(0,c.jsxs)("span",{className:r,children:["-",t]})]})}function HIe(e){if(!e.some(t=>t.additions===void 0||t.deletions===void 0))return e.reduce((t,a)=>({additions:t.additions+(a.additions??0),deletions:t.deletions+(a.deletions??0)}),{additions:0,deletions:0})}var WIe="_root_5t6kl_1",GIe="_card_5t6kl_7",VIe="_summary_5t6kl_15",KIe="_icon_5t6kl_23",XIe="_iconSvg_5t6kl_34",ZIe="_title_5t6kl_40",YIe="_artifactTitle_5t6kl_47",QIe="_reviewSummary_5t6kl_53",JIe="_reviewSummaryWithStats_5t6kl_60",e_e="_reviewMeta_5t6kl_65",t_e="_linkButton_5t6kl_72",a_e="_reviewButton_5t6kl_73",n_e="_showMoreButton_5t6kl_74",r_e="_actions_5t6kl_103",o_e="_openButtonWrapper_5t6kl_109",s_e="_list_5t6kl_133",i_e="_fileRow_5t6kl_140",l_e="_path_5t6kl_160",c_e="_lineStats_5t6kl_169",u_e="_additions_5t6kl_178",d_e="_deletions_5t6kl_182",f_e="_chevronIcon_5t6kl_196",p_e="_chevronIconOpen_5t6kl_204",m_e="_artifactInfo_5t6kl_208",h_e="_artifactMeta_5t6kl_213",g_e="_artifactSummary_5t6kl_222",St={root:WIe,card:GIe,summary:VIe,icon:KIe,iconSvg:XIe,title:ZIe,artifactTitle:YIe,reviewSummary:QIe,reviewSummaryWithStats:JIe,reviewMeta:e_e,linkButton:t_e,reviewButton:a_e,showMoreButton:n_e,actions:r_e,openButtonWrapper:o_e,list:s_e,fileRow:i_e,path:l_e,lineStats:c_e,additions:u_e,deletions:d_e,chevronIcon:f_e,chevronIconOpen:p_e,artifactInfo:m_e,artifactMeta:h_e,artifactSummary:g_e},$9=3;function Gq(e,t){return t?e:e.slice(0,$9)}function v_e({turnId:e,changes:t,artifacts:a,sourceSessionId:n,scheduledTasks:r,workspaceCwd:o,onOpenRequest:s,onReviewChanges:i,onOpenArtifact:l,onOpenScheduledTask:u,onError:d}){let{t:f}=Ze(),{filterArtifact:p}=Bo(),m=p?a.filter(N=>p(N,{turnId:e,sourceSessionId:n})):a,h=Qj(o),g=h?.actions,[b,w]=(0,y.useState)(!1),[v,x]=(0,y.useState)(!1);if(t.length===0&&m.length===0&&r.length===0)return null;let T=Gq(t,b),I=t.length-$9,L=Gq(m,v),S=m.length-$9,C=HIe(t),E=N=>{if(s){s({id:"review",kind:"review",title:f("turnOutputs.review"),turnId:e,changes:t,...o?{workspaceCwd:o}:{},...h?.workspaceId?{workspaceId:h.workspaceId}:{},...N?{selectedPath:N}:{}});return}i(t,N)},R=N=>{let q=x_e(N,t,o);if(s){s({id:`artifact:${N.id}`,kind:"artifact",title:Tz(N),turnId:e,artifactId:N.id,...N.managedId?{managedId:N.managedId}:{},artifact:N,...o?{workspaceCwd:o}:{},...h?.workspaceId?{workspaceId:h.workspaceId}:{},...q!==void 0?{previewContent:q}:{}});return}l(N.id,q)},P=N=>{if(s){s({id:`scheduled-task:${N.toolCallId}`,kind:"scheduled_task",title:f("scheduledTasks.title"),turnId:e,task:h?.workspaceId?{...N,workspaceId:h.workspaceId}:N,...o?{workspaceCwd:o}:{},...h?.workspaceId?{workspaceId:h.workspaceId}:{}});return}u(N)};return(0,c.jsxs)("div",{className:St.root,children:[t.length>0&&(0,c.jsxs)("div",{className:St.card,children:[(0,c.jsxs)("div",{className:St.summary,children:[(0,c.jsx)("span",{className:St.icon,"aria-hidden":"true",children:(0,c.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",focusable:"false",className:St.iconSvg,children:[(0,c.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),(0,c.jsx)("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,c.jsx)("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),(0,c.jsxs)("div",{className:[St.reviewSummary,C?St.reviewSummaryWithStats:""].filter(Boolean).join(" "),children:[(0,c.jsx)("div",{className:St.title,children:f("turnOutputs.filesEdited",{count:t.length})}),(0,c.jsxs)("div",{className:St.reviewMeta,children:[(0,c.jsx)(Wq,{additions:C?.additions,deletions:C?.deletions,className:St.lineStats,additionsClassName:St.additions,deletionsClassName:St.deletions}),(0,c.jsxs)("button",{type:"button",className:St.linkButton,onClick:()=>E(),children:[f("turnOutputs.viewChanges")," ↗"]})]})]}),(0,c.jsx)("div",{className:St.actions,children:(0,c.jsx)("button",{type:"button",className:St.reviewButton,onClick:()=>E(),children:f("turnOutputs.review")})})]}),(0,c.jsxs)("div",{className:St.list,children:[T.map(N=>(0,c.jsxs)("button",{type:"button",className:St.fileRow,onClick:()=>E(N.path),title:N.path,children:[(0,c.jsx)("span",{className:St.path,children:A_e(N.path,o)}),(0,c.jsx)(Wq,{additions:N.additions,deletions:N.deletions,className:St.lineStats,additionsClassName:St.additions,deletionsClassName:St.deletions})]},`${N.toolCallId}:${N.path}`)),I>0&&(0,c.jsxs)("button",{type:"button",className:St.showMoreButton,onClick:()=>w(N=>!N),children:[(0,c.jsx)("span",{children:b?f("turnOutputs.collapseFiles"):f("turnOutputs.showMoreFiles",{count:I})}),(0,c.jsx)(Vq,{open:b})]})]})]}),L.map(N=>{let q=__e(N);return(0,c.jsx)(y_e,{artifact:N,externalUrl:q,onOpen:q||!lH(N)?void 0:()=>R(N),onError:d,onDownload:I_e(N)&&g?H=>Gue(g,N.workspacePath,N.mimeType,H):void 0},N.id)}),S>0&&(0,c.jsxs)("button",{type:"button",className:St.showMoreButton,onClick:()=>x(N=>!N),children:[(0,c.jsx)("span",{children:v?f("turnOutputs.collapseArtifacts"):f("turnOutputs.showMoreArtifacts",{count:S})}),(0,c.jsx)(Vq,{open:v})]}),r.map(N=>(0,c.jsx)(w_e,{task:N,scheduleLabel:Az(N.cron,f),onOpen:()=>P(N)},N.toolCallId))]})}function y_e({artifact:e,externalUrl:t,onOpen:a,onDownload:n,onError:r}){let{t:o}=Ze(),s=Jb(),[i,l]=(0,y.useState)(!1),u=(0,y.useRef)(!0);(0,y.useEffect)(()=>(u.current=!0,()=>{u.current=!1}),[]);let d=zue(e.sizeBytes),f=L_e(e,o),p=Tz(e),m=async()=>{if(!(!n||i)){l(!0);try{await n(()=>!u.current)}catch(g){if(!u.current)return;let b=o("common.downloadFailed",{message:Eb(g)});r?r(new Error(b,{cause:g}),b):console.error(b,g)}finally{l(!1)}}},h=(0,c.jsx)(nl,{size:16,strokeWidth:1.8,"aria-hidden":"true"});return(0,c.jsx)("div",{className:St.card,children:(0,c.jsxs)("div",{className:`${St.summary} ${St.artifactSummary}`,children:[(0,c.jsx)("span",{className:St.icon,"aria-hidden":"true",children:(0,c.jsx)(Zue,{artifact:e,className:St.iconSvg})}),(0,c.jsxs)("div",{className:St.artifactInfo,children:[(0,c.jsx)("div",{className:`${St.title} ${St.artifactTitle}`,children:p}),(0,c.jsx)("div",{className:St.artifactMeta,children:[e.metadata?.artifactType==="web_preview_snapshot"?o("webPreview.saved"):que(e),d,e.status==="changed"&&o("turnOutputs.artifactChanged")].filter(Boolean).join(" · ")})]}),(0,c.jsxs)("div",{className:St.actions,children:[n&&(0,c.jsxs)("button",{type:"button",className:St.reviewButton,onClick:()=>void m(),title:`${o("common.download")} ${p}`,disabled:i,children:[(0,c.jsx)(Eh,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),o(i?"common.downloading":"common.download")]}),(0,c.jsx)("span",{className:St.openButtonWrapper,title:f??p,children:t?(0,c.jsxs)("a",{className:St.reviewButton,href:t,target:"_blank",rel:"noopener noreferrer",onClick:g=>s(g,t),children:[h,o("common.open")]}):(0,c.jsxs)("button",{type:"button",className:St.reviewButton,onClick:a,disabled:!a,children:[h,o("common.open")]})})]})]})})}function w_e({task:e,scheduleLabel:t,onOpen:a}){let{t:n}=Ze();return(0,c.jsx)("div",{className:St.card,children:(0,c.jsxs)("div",{className:St.summary,children:[(0,c.jsx)("span",{className:St.icon,"aria-hidden":"true",children:(0,c.jsx)(b_e,{})}),(0,c.jsxs)("div",{className:St.artifactInfo,children:[(0,c.jsx)("div",{className:St.title,children:e.title}),(0,c.jsx)("div",{className:St.artifactMeta,children:[t,e.recurring?n("scheduledTasks.repeats"):n("scheduledTasks.runsOnce")].filter(Boolean).join(" · ")})]}),(0,c.jsx)("div",{className:St.actions,children:(0,c.jsx)("button",{type:"button",className:St.reviewButton,onClick:a,title:e.title,children:n("common.open")})})]})})}function b_e(){return(0,c.jsxs)("svg",{className:St.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[(0,c.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),(0,c.jsx)("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Vq({open:e}){return(0,c.jsx)("svg",{className:[St.chevronIcon,e?St.chevronIconOpen:""].filter(Boolean).join(" "),viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:(0,c.jsx)("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}var k_e=(0,y.memo)(v_e);function x_e(e,t,a){if(!C_e(e)||!e.workspacePath)return;let n=t.find(r=>Vue(r.path,e.workspacePath,a));if(n)return S_e(n)}function S_e(e){for(let t=e.diffs.length-1;t>=0;t--){let a=e.diffs[t];if(a?.fullContent)return a.newText}}function C_e(e){let t=e.workspacePath?.toLowerCase()??"",a=e.mimeType?.toLowerCase()??"";return e.kind==="html"||T_e(t)||a==="text/html"||a==="text/markdown"}function T_e(e){let t=e.toLowerCase();return t.endsWith(".html")||t.endsWith(".htm")||t.endsWith(".md")||t.endsWith(".markdown")||a9(t)!==void 0}function I_e(e){return e.storage==="workspace"&&(e.status==="available"||e.status==="changed")&&!!e.workspacePath}function lH(e){return e.storage!=="workspace"?!0:e.status==="available"||e.status==="changed"}function __e(e){if(e.kind!=="link"||e.storage==="published")return;let t=e.url?.trim();return Z9(t)?t:void 0}function L_e(e,t){if(!lH(e))return e.workspacePath?t("turnOutputs.artifactUnavailable",{path:e.workspacePath}):t("turnOutputs.artifactMissing")}function A_e(e,t){return n9(e,t)}function R_e(e,t){let[a,n]=(0,y.useState)(!1);return(0,y.useLayoutEffect)(()=>{let r=e.current;if(!r||!t){n(!1);return}let o=r.closest("[data-history-viewport]")??r,s=()=>{let d=getComputedStyle(r),f=Number.parseFloat(d.getPropertyValue("--chat-regular-content-width"))||1e3;n(d.getPropertyValue("--chat-content-width").trim()!=="100%"&&o.getBoundingClientRect().width>=f+128)};s();let i=typeof ResizeObserver>"u"?null:new ResizeObserver(s);i?.observe(o);let l=r.closest("[data-web-shell-root]"),u=new MutationObserver(s);return l&&u.observe(l,{attributes:!0,attributeFilter:["style"]}),()=>{i?.disconnect(),u.disconnect()}},[e,t]),a}var E_e="_collapseRow_d7f01_1",M_e="_collapseRowClickable_d7f01_14",P_e="_collapseLabel_d7f01_19",N_e="_processedLabel_d7f01_36",O_e="_processedMeta_d7f01_43",D_e="_hiddenMetrics_d7f01_47",$_e="_summaryMetrics_d7f01_51",B_e="_collapseIcon_d7f01_59",F_e="_chevronRight_d7f01_72",q_e="_chevronDown_d7f01_73",Ps={collapseRow:E_e,collapseRowClickable:M_e,collapseLabel:P_e,processedLabel:N_e,processedMeta:O_e,hiddenMetrics:D_e,summaryMetrics:$_e,collapseIcon:B_e,chevronRight:F_e,chevronDown:q_e},z_e="_list_mrow6_1",U_e="_listWithWelcomeHeader_mrow6_12",j_e="_historyStatus_mrow6_32",H_e="_historyRetryButton_mrow6_38",W_e="_virtualSizer_mrow6_64",G_e="_virtualRow_mrow6_73",V_e="_loadingSkeleton_mrow6_83",K_e="_srOnly_mrow6_91",X_e="_loadingSkeletonUserRow_mrow6_103",Z_e="_loadingSkeletonAssistantRow_mrow6_109",Y_e="_loadingSkeletonUserBubble_mrow6_115",Q_e="_loadingSkeletonUserBubbleCompact_mrow6_116",J_e="_loadingSkeletonAssistantBlock_mrow6_130",eLe="_loadingSkeletonLineWide_mrow6_138",tLe="_loadingSkeletonLineMedium_mrow6_139",aLe="_loadingSkeletonLineShort_mrow6_140",nLe="_loadingSkeletonLineNarrow_mrow6_141",rLe="_turnStatusRow_mrow6_181",oLe="_turnAnswerRow_mrow6_182",sLe="_turnContentRow_mrow6_193",iLe="_sessionTimelineLayer_mrow6_197",lLe="_sessionTimelinePanel_mrow6_210",cLe="_sessionTimelineViewport_mrow6_226",uLe="_sessionTimelineList_mrow6_275",dLe="_sessionTimelineItem_mrow6_285",fLe="_sessionTimelineButton_mrow6_290",pLe="_sessionTimelineTick_mrow6_310",mLe="_sessionTimelineButtonInRange_mrow6_400",hLe="_sessionTimelineButtonCurrent_mrow6_404",gLe="_sessionTimelineDetails_mrow6_415",vLe="_sessionTimelineDetailsTitle_mrow6_453",yLe="_sessionTimelineDetailsIcon_mrow6_460",wLe="_sessionTimelineDetailsTitleText_mrow6_472",bLe="_sessionTimelineDetailsDetail_mrow6_482",kLe="_deletionMode_mrow6_501",xLe="_deletionCheckbox_mrow6_507",At={list:z_e,listWithWelcomeHeader:U_e,historyStatus:j_e,historyRetryButton:H_e,virtualSizer:W_e,virtualRow:G_e,loadingSkeleton:V_e,srOnly:K_e,loadingSkeletonUserRow:X_e,loadingSkeletonAssistantRow:Z_e,loadingSkeletonUserBubble:Y_e,loadingSkeletonUserBubbleCompact:Q_e,loadingSkeletonAssistantBlock:J_e,loadingSkeletonLineWide:eLe,loadingSkeletonLineMedium:tLe,loadingSkeletonLineShort:aLe,loadingSkeletonLineNarrow:nLe,turnStatusRow:rLe,turnAnswerRow:oLe,turnContentRow:sLe,sessionTimelineLayer:iLe,sessionTimelinePanel:lLe,sessionTimelineViewport:cLe,sessionTimelineList:uLe,sessionTimelineItem:dLe,sessionTimelineButton:fLe,sessionTimelineTick:pLe,sessionTimelineButtonInRange:mLe,sessionTimelineButtonCurrent:hLe,sessionTimelineDetails:gLe,sessionTimelineDetailsTitle:vLe,sessionTimelineDetailsIcon:yLe,sessionTimelineDetailsTitleText:wLe,sessionTimelineDetailsDetail:bLe,deletionMode:kLe,deletionCheckbox:xLe},j6=()=>{},SLe=15e3,H6=180,CLe=400,Kq=5e3;function TLe(e,t){if(!e||e.length!==t.length||t.length===0)return!1;for(let r=0;r<t.length-1;r+=1)if(e[r]!==t[r])return!1;let a=e[e.length-1],n=t[t.length-1];return a.id!==n.id||a.role!==n.role||n.role!=="assistant"&&n.role!=="thinking"||a.role!=="assistant"&&a.role!=="thinking"||a.isStreaming!==!0||n.isStreaming!==!0?!1:a.role==="assistant"&&n.role==="assistant"?typeof a.content!="string"||typeof n.content!="string"?!1:a.branchRecordId===n.branchRecordId&&a.usage===n.usage&&!!a.content.trim()==!!n.content.trim():a.role==="thinking"&&n.role==="thinking"}function Xq(e,t){return e.length===t.length&&e.every((a,n)=>Object.is(a,t[n]))}function ILe(e){for(let t=e.length-1;t>=0;t--){let a=e[t];if(a?.role==="user")return a.id}return null}function _Le(e){return e[e.length-1]}function LLe(e){for(let t=e.length-1;t>=0;t--){let a=e[t];if(a&&Qr(a))return a.id}return null}function ALe(e,t){return e.role!=="tool_group"?!1:!!(t?.toolCallId&&e.tools.some(a=>Ds(a,t.toolCallId)))}function B9(e){return t7(e)||!!bg(e.rawOutput)}function Zq(e){let t=[],a=!1;for(let n of e){if(n.role!=="tool_group"||n.tools.length<2||!n.tools.some(B9)){t.push(n);continue}a=!0;let r=[],o=0,s=i=>{i.length!==0&&t.push({...n,id:o++===0?n.id:`${n.id}-${i[0].callId}`,tools:i})};for(let i of n.tools)B9(i)?(s(r),r=[],s([i])):r.push(i);s(r)}return a?t:e}function RLe(e,t){let a=[],n=0,r=o=>o.role==="tool_group"&&!ALe(o,t)&&!o.tools.some(B9);for(;n<e.length;){let o=e[n];if(o.role!=="thinking"&&!r(o)){a.push(o),n++;continue}let s=[],i=n-1,l=n;for(;l<e.length;){let p=e[l];if(p.role==="thinking"||r(p)){s.push(p),i=l,l++;continue}break}let u=s.filter(p=>p.role==="tool_group").flatMap(p=>p.tools);if(u.length===0||s.length<=1||s.length>=2&&s.every(Q6)){for(let p of s)a.push(p);n=i+1;continue}let d=[],f=[];for(let p of s)if(p.role==="thinking"){let m={content:p.content,...p.isStreaming===!0?{isStreaming:!0}:{}};d.push(m),f.push(m)}else if(p.role==="tool_group"&&p.tools.length>0){let m=p.tools[0].callId;for(let h of f)h.beforeToolCallId=m;f.length=0}a.push({id:ug(s[0].id),role:"tool_group",tools:u,...d.length>0?{thoughts:d}:{},timestamp:s[0].timestamp}),n=i+1}return a}function ELe(e,t){let a=e[e.length-1];if(a?.role!=="tool_group"||dg(a.id)===void 0||!a.thoughts?.length)return;let n=a.thoughts[a.thoughts.length-1];if(n?.isStreaming!==!0)return;let r=a.thoughts.slice();r[r.length-1]={...n,content:t.content,isStreaming:!0};let o=e.slice();return o[o.length-1]={...a,thoughts:r,...a.id===ug(t.id)?{timestamp:t.timestamp}:{}},o}function MLe(e){if(e.role==="assistant"||e.role==="thinking")return e.isStreaming?{...e,isStreaming:!1}:e;if(e.role!=="tool_group"||!e.thoughts?.length)return e;let t=!1,a=e.thoughts.map(n=>n.isStreaming?(t=!0,{...n,isStreaming:!1}):n);return t?{...e,thoughts:a}:e}function Yq(e){if(e.role==="assistant"||e.role==="thinking")return e.content;if(e.role==="tool_group"&&e.thoughts?.length)return JSON.stringify(e.thoughts.map(t=>t.content))}function Qq(e,t){let a=e.get(t);if(a!==void 0)return a;let n=MLe(t);return e.set(t,n),n}function cH(e){return vce(fAe(e))}function bb(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 PLe(e,t,a,n,r){if((!a||a.size===0)&&(!n||n.size===0)&&(!r||r.size===0))return e;let o=[],s=null,i=(l,u)=>{if(u&&t||!l)return;let d=a?.get(l)??[],f=n?.get(l)??[],p=r?.get(l)??[];if(d.length===0&&f.length===0&&p.length===0)return;let m=o.length;for(let 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 NLe(e,t){let a=s=>s.type==="parallel_agents"&&(t?.has(s.key)===!0||s.agents.some(i=>an(i.status)));if(!e.some(s=>a(s)))return e;let n=[],r=[],o=()=>{n.push(...r),r=[]};for(let s of e)s.type==="message"&&Qr(s.message)?(o(),n.push(s)):a(s)?r.push(s):n.push(s);return o(),n}function uH(e){return e.type==="message"&&e.message.role==="assistant"&&e.message.agentMessage?.kind==="agent_message"}function dH(e,t){return e.type==="message"&&!uH(e)&&(e.message.role==="assistant"||t&&e.message.role==="system"&&e.message.source==="background_notification")&&!!e.message.content&&e.message.content.trim().length>0}function mk(e,t,a,n=!0){let r=!1;for(let o=a;o>t;o--){let s=e[o];if(s.type==="message"&&s.message.role==="system"&&s.message.source==="background_notification_turn_started")r=!1;else if(ZLe(s))r=!0;else if(!r&&dH(s,n))return o}return-1}function OLe(e,{isResponding:t,latestTurnAwaitsAgentSummary:a,gateBackgroundAgentStatus:n}){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||n&&a)||n&&hH(e,i,l))continue;let u=e[i],d=mk(e,i,l,!1);if(d<0)continue;let f=e[d];u?.type==="message"&&f.type==="message"&&f.message.role==="assistant"&&o.set(f.message.id,u.message.id)}return o}function Jq(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(t7);case"plan":return!0;case"assistant":return!t&&!uH(e);case"thinking":return!0;case"system":return e.message.source==="background_notification"?!t:e.message.source==="background_notification_turn_started"||e.message.source==="background_task_completed"||e.message.source==="vision_bridge_notice";case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return!1;default:return e.message,!1}}function fH(e){return e.source==="mid_turn_message_injected"}function DLe(e,t){if(e.type==="parallel_agents")return{kind:"agents",timestamp:e.timestamp,label:t?t("timeline.parallelAgents"):"Parallel agents"};if(e.type==="turn_outputs")return{kind:"none"};if(e.type!=="message")return{kind:"none"};let{message:a}=e;switch(a.role){case"thinking":return{kind:"thought",timestamp:a.timestamp,label:t?t("timeline.thinking"):"Thinking"};case"assistant":return e.turnCollapse?{kind:"none",timestamp:a.timestamp}:qd(a.content,1)?{kind:"commentary",timestamp:a.timestamp,label:t?t("timeline.assistantUpdate"):"Assistant update"}:{kind:"none",timestamp:a.timestamp};case"tool_group":{let n=a.tools.length;return{kind:"tool",timestamp:a.timestamp,label:t?t("timeline.toolCalls",{count:n}):`${n} tool call${n===1?"":"s"}`}}case"plan":return{kind:"plan",timestamp:a.timestamp,label:t?t("timeline.planUpdate"):"Plan update"};case"system":return fH(a)?{kind:"status",timestamp:a.timestamp,label:t?t("timeline.statusUpdate"):"Status update"}:{kind:"none",timestamp:a.timestamp};case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return{kind:"none",timestamp:a.timestamp};default:return{kind:"none"}}}function qd(e,t,a={}){let n=(a.stripMarkdown===!0?$Le(e):e??"").replace(/\s+/g," ").trim();if(t<=0||!n)return"";let r=Array.from(n);return r.length>t?`${r.slice(0,t-1).join("")}…`:n}function $Le(e){if(!e)return"";let t=[],a=r=>{let o=`\0${t.length}\0`;return t.push(r),o},n=e.replace(/```[^\n`]*\n?([\s\S]*?)```/g,(r,o)=>a(o)).replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`\n]+)`/g,(r,o)=>a(o)).replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"");n=W6(n,"~~"),n=W6(n,"**"),n=W6(n,"__"),n=n.replace(/\*([^*\s][^*]*?\S)\*/g,"$1").replace(/(^|[^\p{L}\p{N}_])_([^_\s][^_]*?\S)_(?=$|[^\p{L}\p{N}_])/gu,"$1$2");for(let[r,o]of t.entries())n=n.split(`\0${r}\0`).join(o);return n}function W6(e,t){let a="",n=0;for(;n<e.length;){let r=e.indexOf(t,n);if(r===-1)return a+e.slice(n);let o=r+t.length,s=e.indexOf(t,o);if(s===-1)return a+e.slice(n);let i=e.slice(o,s);a+=i.trim().length===0?e.slice(n,s+t.length):e.slice(n,r)+i,n=s+t.length}return a}function BLe(e,t){let a=e.role==="user"?e.content:e.role==="user_shell"?e.command:"";return qd(a,32)||(t?t("timeline.userTurn"):"User turn")}function FLe(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function Qr(e){return e.role==="user"||e.role==="user_shell"}function qLe(e,t){if(!t.startsWith("msg:"))return;let a=t.slice(4);a=dg(a)??a;for(let n=e.length-1;n>=0;n--)if(e[n]?.id===a){for(let r=n;r>=0;r--){let o=e[r];if(o&&Qr(o))return o.id}return}}function zLe(e,t){for(let a of e)if(a.type==="turn_collapse"&&a.turnCollapse.turnId===t)return a.turnCollapse.collapsed;return!1}function ULe(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return qd(e.content,120,{stripMarkdown:!0});case"tool_group":{let a=e.tools.length;return t?t("timeline.toolCalls",{count:a}):`${a} tool call${a===1?"":"s"}`}case"plan":return t?t("timeline.planDetail"):"plan update";case"system":return fH(e)?qd(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 jLe(e,t){if(e.type==="parallel_agents"){let a=e.agents.length;return t?t("timeline.parallelAgentsDetail",{count:a}):`${a} parallel agent${a===1?"":"s"}`}return e.type==="turn_outputs"||e.type!=="message"?"":ULe(e.message,t)}function HLe(e,t){return t?t(`timeline.kind.${e}`):TAe[e]}function WLe(e,t,a,n){if(t!==null)for(let s of e){if(s.type!=="message")continue;let{message:i}=s;if(i.id!==t||i.role!=="assistant")continue;let l=qd(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=jLe(i,n);l&&r.push(l)}return qd(r.join(" · "),180)||(a.length>0?a.map(s=>HLe(s,n)).join(" · "):n?n("timeline.noActivity"):"No activity")}function GLe(e,t){let a=[],n=null,r=[],o=()=>{if(!n)return;let s=cH(r),i=mk(s,-1,s.length-1,!1),l=i>=0?s[i]:null,u=l?.type==="message"&&l.message.role==="assistant"&&!l.message.isStreaming&&qd(l.message.content,1,{stripMarkdown:!0}).length>0?l.message.id:null,d=[];for(let f of s){if(f.type==="message"&&u!==null&&f.message.id===u)continue;let p=DLe(f,t);p.kind!=="none"&&!d.includes(p.kind)&&d.push(p.kind)}a.push({id:n.id,label:BLe(n,t),detail:WLe(s,u,d,t),timestamp:n.timestamp,nodeKinds:d,...FLe(n)?{isScheduledTask:!0}:{}})};for(let s of e){if(Qr(s)){o(),n=s,r=[];continue}n&&r.push(s)}return o(),a}function VLe(){return(0,c.jsxs)("svg",{className:At.sessionTimelineDetailsIcon,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,c.jsx)("circle",{cx:"8",cy:"8",r:"6.25"}),(0,c.jsx)("path",{d:"M8 4.5v4l-2.5 2"})]})}function KLe(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 XLe(e){return e.map(t=>{let a=`${t.id}:${t.role}:${t.timestamp??""}`;switch(t.role){case"assistant":case"thinking":return`${a}:${t.isStreaming?"streaming":t.content}`;case"tool_group":return`${a}:${t.tools.map(KLe).join(",")}`;case"system":return`${a}:${t.variant}:${t.source??""}:${t.content}`;case"user":return`${a}:${t.content}`;case"user_shell":return`${a}:${t.command}`;case"plan":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return a;default:return a}}).join("|")}function ZLe(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 YLe(e){if(e.type==="turn_outputs")return null;if(e.type==="turn_collapse")return e.turnCollapse.liveStartedAt===void 0||e.turnCollapse.toolCallCount===void 0||e.turnCollapse.toolCallCount<=0?null:`turn:${e.turnCollapse.turnId}:${e.turnCollapse.toolCallCount}`;if(e.type==="parallel_agents"){let a=e.agents.filter(n=>an(n.status));return a.length===0?null:`agents:${e.key}:${a.map(n=>n.callId).join(",")}`}if(e.message.role!=="tool_group")return null;let t=e.message.tools.filter(a=>an(a.status));return t.length===0?null:`tools:${e.message.id}:${t.map(a=>a.callId).join(",")}`}function QLe(e){for(let t=e.length-1;t>=0;t--){let a=YLe(e[t]);if(a)return a}return null}function JLe(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 eAe(e){return e.type==="message"&&e.message.role==="system"&&e.message.source==="turn_error"}function tAe(e){if(!(e.type!=="message"||e.message.role!=="assistant"))return e.message.content?.trim()?e.message.timestamp:void 0}function aAe(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function G6(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function ez(e){if(e.parentToolCallId||!lr(e))return;let t=e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0,a=t?.executionSummary&&typeof t.executionSummary=="object"?t.executionSummary:void 0,n=G6(a?.inputTokens),r=G6(a?.outputTokens);if(n===void 0&&r===void 0)return;let o=G6(a?.cachedTokens);return{callId:e.callId,usage:{inputTokens:n??0,outputTokens:r??0,...o!==void 0?{cachedTokens:o}:{}}}}function nAe(e){return e.type==="parallel_agents"?e.agents.flatMap(t=>ez(t)??[]):e.type!=="message"||e.message.role!=="tool_group"?[]:e.message.tools.flatMap(t=>ez(t)??[])}function rAe(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=>!$o(t.toolName)).length:0}function pH(e,t){for(let a=Math.min(t,e.length-1);a>=0;a--){let n=e[a];if(n.type==="message"&&Qr(n.message))return n.message.id}return null}function mH(e){let t=[],a=null;for(let n of e)n.type==="message"&&Qr(n.message)&&(a=n.message.id),t.push(a);return t}function tz(e,t,a,n){let r=n===void 0?pH(e,t):n[t]??null;return r?a.get(r)??null:null}function oAe(e,t,a,n,r=mH(e)){let o=Number.POSITIVE_INFINITY,s=-1;for(let l of t){if(l<0||l>=e.length)continue;let u=tz(e,l,a,r);u!==null&&(o=Math.min(o,u),s=Math.max(s,u))}if(s<0)return null;let i=n==null?null:tz(e,n,a,r);return{startIndex:o,endIndex:s,currentIndex:i!==null&&i>=o&&i<=s?i:s}}function $g(e,t,a,n){for(let r=t;r<=a;r++){let o=e[r];if(o.type==="parallel_agents"){if(o.agents.some(n))return!0}else if(o.type==="message"&&o.message.role==="tool_group"&&o.message.tools.some(n))return!0}return!1}function sAe(e,t,a,n){return n?$g(e,t,a,r=>Ds(r,n)):!1}function iAe(e,t,a){return $g(e,t,a,n=>lr(n)&&an(n.status))}function lAe(e,t,a){return $g(e,t,a,n=>bg(n.rawOutput)!==void 0)}function cAe(e,t){let a=new Set(t);for(let n of e){if(n.type!=="message"||n.message.role!=="system"||n.message.source!=="background_notification"&&n.message.source!=="background_task_completed"&&n.message.source!=="background_notification_turn_started")continue;let r=n.message.data;if(n.message.source==="background_notification_turn_started"&&r&&typeof r=="object"&&"backgroundTask"in r&&(r=r.backgroundTask??r),!r||typeof r!="object"||Array.isArray(r)||!("kind"in r)||r.kind!=="shell")continue;let o="taskId"in r?r.taskId:void 0;typeof o=="string"&&a.add(o)}return a}function uAe(e,t,a,n){return $g(e,t,a,r=>{let o=gce(r);return o!==void 0&&!n.has(o)})}function hH(e,t,a){return $g(e,t,a,n=>Os(n)&&an(n.status))}function dAe(e,t,a,n){if(!n?.size)return!1;for(let r=t;r<=a;r++){let o=e[r];if(o.type==="parallel_agents"&&n.has(o.key))return!0}return!1}function V6(e){return e.type==="parallel_agents"?e.agents.filter(t=>Os(t)&&t.status!=="failed").map(t=>t.callId):e.type==="message"&&e.message.role==="tool_group"?e.message.tools.filter(t=>Os(t)&&t.status!=="failed").map(t=>t.callId):[]}function gH(e){if(e.role!=="system"||e.source!=="background_notification"&&e.source!=="background_task_completed"&&e.source!=="background_notification_turn_started")return null;let t=e.content?.trimStart().toLowerCase().startsWith("background agent ")===!0,a=e.data;if(e.source==="background_notification_turn_started"&&a&&typeof a=="object"&&"backgroundTask"in a&&(a=a.backgroundTask??a),typeof a!="object"||a===null||Array.isArray(a))return t?{status:"completed",...e.timestamp!==void 0?{endTime:e.timestamp}:{}}:null;let{kind:n,toolUseId:r,status:o}=a;if(n!=="agent"&&!(n===void 0&&t))return null;let s=o===void 0?"completed":pz(o)?o:void 0;return s?{...typeof r=="string"?{callId:r}:{},status:s,...e.timestamp!==void 0?{endTime:e.timestamp}:{}}:null}function F9(e){return e.type==="message"?gH(e.message):null}function fAe(e){let t=new Map;for(let r of e){let o=gH(r);o?.callId&&t.set(o.callId,o)}if(t.size===0)return e;let a=!1,n=e.map(r=>{if(r.role!=="tool_group")return r;let o=!1,s=r.tools.map(i=>{let l=t.get(i.callId);if(!l||!Os(i)||!an(i.status))return i;let u=mz(i,l.status,l.endTime);return u===i?i:(o=!0,u)});return o?(a=!0,{...r,tools:s}):r});return a?n:e}function vH(e,t,a,n){let r=-1,o;for(let u=a;u>t;u--){let d=e[u];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=F9(d);if(n&&!f)continue;r<0&&(r=u,o=f?.callId)}}}if(r<0)return null;let s=-1;if(o){for(let u=a;u>=0;u--)if(V6(e[u]).includes(o)){s=u;break}}for(let u=a;u>=t&&!(s>=0);u--)if(V6(e[u]).length>0){s=u;break}let i=new Set,l=!1;if(s>=0){let u=s;for(let f=s;f>=0;f--){let p=e[f];if(p.type==="message"&&Qr(p.message)){u=f;break}}let d=[];for(let f=u;f<=a;f++){let p=e[f];for(let h of V6(p))i.add(h);let m=F9(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 q9(e,t,a,n=!1,r=!0,o=!0){let s=vH(e,t,a,n);if(!s)return!1;if(s.sawAgentCompletion&&s.unmatchedAgentCallIds.size>0)return r;for(let i=s.lastNotificationIndex+1;i<=a;i++){let l=e[i];if(l.type==="message"&&l.message.role==="thinking")return!1}return o&&mk(e,t,a,!1)<s.lastNotificationIndex}function pAe(e,{overrides:t,isResponding:a,activeTurnStartedAt:n,backgroundSummaryGraceActive:r=!0,waitForUnmatchedAgentCompletions:o=!0,waitForOrderedNarration:s=!0,terminalBackgroundShellTaskIds:i,automaticallyExpandedAgentKeys:l,pendingApprovalCallId:u,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 w=e[b];w.type==="message"&&Qr(w.message)&&m.push(b)}if(m.length===0)return e;let h=cAe(e,i),g=[];for(let b=0;b<m[0];b++)g.push(e[b]);for(let b=0;b<m.length;b++){let w=m[b],v=(b+1<m.length?m[b+1]:e.length)-1,x=e[w],T=x.message.id,I=x.message.timestamp,L=b===m.length-1,S=L&&a,C=iAe(e,w,v),E=lAe(e,w,v),R=uAe(e,w,v,h),P=dAe(e,w,v,l),N=L&&r&&q9(e,w,v,!1,o,s),q=sAe(e,w,v,u),H=mk(e,w,v),z=H;if(H>=0&&dH(e[H],!1)){let be=!1;for(let W=H-1;W>w;W--){let ke=e[W];if(ke.type!=="message")break;if(ke.message.role==="system"&&ke.message.source==="background_task_completed")be=!0;else if(be&&ke.message.role==="assistant")z=W,be=!1;else break}}let G=0,re,X,V,A=0,$=0,K=0,O=0,ee=0,de=!1,ye=new Set,oe=!1;for(let be=w+1;be<=v;be++){let W=e[be];if(Jq(W,be>=z&&be<=H)&&G++,eAe(W)&&(oe=!0),O+=rAe(W),W.type==="message"&&W.message.role==="thinking"?ee++:W.type==="message"&&W.message.role==="tool_group"&&W.message.thoughts&&(ee+=W.message.thoughts.length),W.type==="message"&&W.message.role==="system"&&W.message.source==="prompt_cancelled"){let lt=W.message.data,zt=lt&&typeof lt=="object"&&"elapsedMs"in lt?lt.elapsedMs:void 0;typeof zt=="number"&&Number.isFinite(zt)&&zt>=0&&(X=zt)}let ke=JLe(W);ke!==void 0&&(re=re===void 0?ke:Math.max(re,ke));let Ce=tAe(W);Ce!==void 0&&(V=V===void 0?Ce:Math.max(V,Ce));let ze=aAe(W);if(ze&&(A+=ze.inputTokens,$+=ze.outputTokens,K+=ze.cachedTokens??0,de=!0),d)for(let lt of nAe(W))ye.has(lt.callId)||(ye.add(lt.callId),A+=lt.usage.inputTokens,$+=lt.usage.outputTokens,K+=lt.usage.cachedTokens??0,de=!0)}let te=S||N?n??I??Date.now():void 0,le=re??V,J=X??(I!==void 0&&le!==void 0&&le>=I?le-I:void 0);if(q||G===0&&!(de||J!==void 0||te!==void 0)){for(let be=w;be<=v;be++)g.push(e[be]);continue}let _e=S||C||E||R||P||N||(oe||H<0)&&L,xe=!(G===0||(t.has(T)?t.get(T):f?.has(T)||_e));g.push({type:"message",key:x.key,message:x.message});let je={turnId:T,collapsed:xe,hiddenCount:G,...J!==void 0?{elapsedMs:J}:{},...de?{inputTokens:A,outputTokens:$}:{},...K>0?{cachedTokens:K}:{},...O>0?{toolCallCount:O}:{},...ee>0?{thinkingCount:ee}:{},...te!==void 0?{liveStartedAt:te}:{}};if(g.push({type:"turn_collapse",key:`tc-${T}`,turnCollapse:je}),!xe){for(let be=w+1;be<=v;be++){let W=e[be];be===H&&W.type==="message"&&W.message.role==="assistant"?g.push({...W,turnCollapse:je}):g.push(W)}continue}for(let be=w+1;be<=v;be++){let W=e[be];if(!(be===H&&S)){if(be===H&&W.type==="message"&&W.message.role==="assistant"){g.push({...W,turnCollapse:je});continue}Jq(W,be>=z&&be<=H)||g.push(W)}}}return g}function kb(e,t,a){if(a){for(let n=0;n<e.length;n++){let r=e[n];if(r.type==="message"&&r.message.role==="tool_group"&&r.message.tools.some(o=>Ds(o,a))||r.type==="parallel_agents"&&r.agents.some(o=>Ds(o,a)))return n}return-1}for(let n=0;n<e.length;n++){let r=e[n];if(r.type==="message"&&r.message.id===t)return n}return-1}function az(e,t){if(!t)return!1;let a=t.callId;return e.type==="message"?a?e.message.role==="tool_group"&&e.message.tools.some(n=>Ds(n,a)):e.message.id===t.messageId:e.type==="parallel_agents"?!!a&&e.agents.some(n=>Ds(n,a)):(e.type,!1)}function nz(e,t){return e?e.type==="message"?e.message.sourceBlockIds?.join(","):t.filter(a=>e.type==="parallel_agents"?a.role==="tool_group"&&e.agents.some(n=>a.tools.some(r=>Ds(r,n.callId))):a.id===(e.type==="turn_outputs"?e.turnId:e.turnCollapse.turnId)).flatMap(a=>a.sourceBlockIds??[]).join(",")||void 0:void 0}var K6=0,mAe=120,hAe=80,gAe=32,vAe=240,xb=30,X6=160,rz=30,yH=200;function yAe(e,t=yH){return e>t}function wAe(e,t){return e<=t}function bAe(e){return e!==void 0&&e>=0?vz(e):""}function kAe(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";let a=e.cachedTokens??0,n=a>0&&e.inputTokens>0?` (${Fn(a)} ${t("turn.cached")}, ${Math.round(a/e.inputTokens*100)}%)`:"";return`↑${Fn(e.inputTokens)}${n} ↓${Fn(e.outputTokens)}`}function oz(e,t){let a=[],n=kAe(e,t);return n&&a.push(n),e.toolCallCount!==void 0&&e.toolCallCount>0&&a.push(t("turn.toolCalls",{count:e.toolCallCount})),e.thinkingCount!==void 0&&e.thinkingCount>0&&a.push(t("turn.thinkingCount",{count:e.thinkingCount})),a.join(" · ")}function xAe(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}function wH(e){return e.hiddenCount>0||e.liveStartedAt!==void 0||xAe(e)}var SAe=(0,y.memo)(function({turnCollapse:e,onToggleCollapse:t}){let{t:a}=Ze(),n=e.hiddenCount>0,r=e.liveStartedAt,o=wH(e),s=ik(r!==void 0&&o),i=(0,y.useRef)(0),l=(0,y.useRef)(r);l.current!==r&&(l.current=r,i.current=0);let u;r!==void 0&&o?(i.current=Math.max(i.current,Math.max(0,s-r)),u=i.current):o&&e.elapsedMs!==void 0?(i.current=0,u=e.elapsedMs):(i.current=0,u=void 0);let d=bAe(u),f=oz(e,a),p=oz(e,a),m=a(r!==void 0?"turn.processing":"turn.processed"),h=!!d&&o,g=!!f&&o,b=!!p&&o;if(!o)return null;let w=()=>{if(!n)return;let v=e.collapsed;t(e.turnId,v)};return(0,c.jsxs)("div",{className:n?`${Ps.collapseRow} ${Ps.collapseRowClickable}`:Ps.collapseRow,role:n?"button":void 0,tabIndex:n?0:void 0,"aria-expanded":n?!e.collapsed:void 0,"aria-label":n?e.collapsed?a("turn.expand"):a("turn.collapse"):void 0,title:n?e.collapsed?a("turn.expand"):a("turn.collapse"):void 0,onClick:n?w:void 0,onKeyDown:n?v=>{v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),w())}:void 0,children:[(0,c.jsxs)("span",{className:Ps.collapseLabel,children:[(0,c.jsxs)("span",{className:Ps.processedLabel,children:[m,h&&(0,c.jsxs)("span",{className:Ps.processedMeta,children:[" ",d]})]}),b&&(0,c.jsx)("span",{className:Ps.summaryMetrics,children:p}),g&&(0,c.jsx)("span",{className:Ps.hiddenMetrics,children:f})]}),n&&(0,c.jsx)("span",{"data-testid":`toggle-${e.turnId}`,className:Ps.collapseIcon,onClick:v=>{v.stopPropagation(),w()},children:(0,c.jsx)("span",{className:e.collapsed?Ps.chevronRight:Ps.chevronDown,"aria-hidden":"true"})})]})});function CAe(e){if(e.type==="turn_collapse")return At.turnStatusRow;if(e.type==="turn_outputs")return At.turnContentRow;if(e.type==="message"&&e.turnCollapse)return At.turnAnswerRow}var TAe={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},IAe=["--background","--foreground","--muted-foreground","--border","--font-sans"],sz="session-timeline-detail-tooltip",_Ae=(0,y.memo)(function({entries:e,currentTurnId:t,currentRange:a,hidden:n,onSelect:r,action:o}){let s=Xp(),{t:i}=Ze(),l=(0,y.useRef)(null),u=(0,y.useRef)(null),d=(0,y.useRef)(null),f=(0,y.useRef)(!1),p=(0,y.useRef)(!1),m=(0,y.useRef)(null),h=(0,y.useRef)(null),[g,b]=(0,y.useState)(null),w=a!==null?a.currentIndex:e.findIndex(R=>R.id===t),v=(0,y.useCallback)(()=>b(null),[]),x=(0,y.useCallback)(()=>{f.current||p.current||v()},[v]),T=(0,y.useCallback)((R,P)=>{let N=l.current;if(!N)return null;let q=getComputedStyle(N),H=P.getBoundingClientRect();return{entry:R,top:H.top+H.height/2,left:H.right+8,clamped:!1,themeVars:Object.fromEntries(IAe.map(z=>[z,q.getPropertyValue(z)]))}},[]),I=(0,y.useCallback)(R=>{let P=u.current;return P?Array.from(P.querySelectorAll('[data-testid="session-timeline-entry"]')).find(N=>N.getAttribute("data-turn-id")===R.id)?.querySelector("button")??null:null},[]),L=(0,y.useCallback)(R=>{let P=u.current;if(!P)return!1;let N=P.getBoundingClientRect(),q=R.getBoundingClientRect();return q.bottom>=N.top&&q.top<=N.bottom},[]),S=(0,y.useCallback)(()=>{b(R=>{if(!R)return null;let P=I(R.entry);return!P||!L(P)?null:T(R.entry,P)})},[T,I,L]),C=(0,y.useCallback)((R,P)=>{b(T(R,P))},[T]),E=(0,y.useCallback)(()=>{typeof window>"u"||(m.current!==null&&window.cancelAnimationFrame(m.current),h.current!==null&&window.clearTimeout(h.current),p.current=!0,m.current=window.requestAnimationFrame(()=>{m.current=null,p.current=!1,S()}),h.current=window.setTimeout(()=>{h.current=null,p.current=!1},100))},[S]);return(0,y.useLayoutEffect)(()=>{if(n)return;let R=u.current;if(!R||w<0)return;let P=R.querySelector(`[data-timeline-index="${w}"]`);if(!P)return;let N=P.offsetTop+P.offsetHeight/2,q=R.scrollHeight-R.clientHeight,H=Math.max(0,Math.min(N-R.clientHeight/2,q));if(R.scrollTop===H)return;f.current=!0,R.scrollTop=H;let z=window.requestAnimationFrame(()=>{f.current=!1,S()}),G=window.setTimeout(()=>{f.current=!1},100);return()=>{window.cancelAnimationFrame(z),window.clearTimeout(G),f.current=!1}},[w,n,S]),(0,y.useLayoutEffect)(()=>{if(!(!g||typeof window>"u"))return window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)}},[S,g]),(0,y.useLayoutEffect)(()=>()=>{m.current!==null&&window.cancelAnimationFrame(m.current),h.current!==null&&window.clearTimeout(h.current),p.current=!1},[]),(0,y.useLayoutEffect)(()=>{if(!g||g.clamped)return;let R=l.current,P=d.current;if(!R||!P||typeof window>"u")return;let N=P.getBoundingClientRect(),q=12,H=g.top;N.top<q?H+=q-N.top:N.bottom>window.innerHeight-q&&(H-=N.bottom-(window.innerHeight-q)),H!==g.top&&b(z=>z?.entry.id===g.entry.id?{...z,top:H,clamped:!0}:z)},[g]),n||e.length===0?null:(0,c.jsx)("div",{className:At.sessionTimelineLayer,"aria-hidden":"false",children:(0,c.jsxs)("nav",{ref:l,className:At.sessionTimelinePanel,"aria-label":i("timeline.sessionTimeline"),"data-testid":"session-timeline",onMouseLeave:v,children:[(0,c.jsx)("div",{ref:u,className:At.sessionTimelineViewport,"data-testid":"session-timeline-viewport",onScroll:x,children:(0,c.jsx)("ol",{className:At.sessionTimelineList,children:e.map((R,P)=>{let N=a!==null&&P>=a.startIndex&&P<=a.endIndex,q=a!==null?P===a.currentIndex:R.id===t,H=R.nodeKinds.join(","),z=[`${i("timeline.turnPrefix",{index:P+1})}: ${R.label}`,q?i("timeline.currentTurn"):null].filter(Boolean).join(". "),G=V=>C(R,V.currentTarget),re=V=>{E(),C(R,V.currentTarget)},X=g?.entry.id===R.id;return(0,c.jsx)("li",{className:At.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":R.id,"data-timeline-index":P,"data-node-kinds":H,"data-in-current-range":N?"true":void 0,children:(0,c.jsx)("button",{type:"button",className:z9(At.sessionTimelineButton,N?At.sessionTimelineButtonInRange:void 0,q?At.sessionTimelineButtonCurrent:void 0),"aria-current":q?"step":void 0,"aria-describedby":X?sz:void 0,"aria-label":z,onClick:()=>r(R.id),onFocus:re,onBlur:v,onMouseEnter:G,onMouseLeave:v,children:(0,c.jsx)("span",{className:At.sessionTimelineTick})})},R.id)})})}),o,g&&typeof document<"u"&&(0,kg.createPortal)((0,c.jsxs)("div",{ref:d,className:At.sessionTimelineDetails,id:sz,"data-testid":"session-timeline-detail","data-title":g.entry.label,"data-detail":g.entry.detail,"data-scheduled-task":g.entry.isScheduledTask?"true":void 0,role:"tooltip",style:{...g.themeVars,top:g.top,left:g.left},children:[(0,c.jsxs)("span",{className:At.sessionTimelineDetailsTitle,children:[g.entry.isScheduledTask&&(0,c.jsx)(VLe,{}),(0,c.jsx)("span",{className:At.sessionTimelineDetailsTitleText,children:g.entry.label})]}),(0,c.jsx)("span",{className:At.sessionTimelineDetailsDetail,children:g.entry.detail})]}),s??document.body)]})})});function z9(...e){return e.filter(Boolean).join(" ")||void 0}var LAe=[];function AAe({label:e}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{role:"status","aria-live":"polite",className:At.srOnly,children:e}),(0,c.jsxs)("div",{className:At.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[(0,c.jsx)("div",{className:At.loadingSkeletonUserRow,children:(0,c.jsxs)("div",{className:At.loadingSkeletonUserBubble,children:[(0,c.jsx)("span",{className:At.loadingSkeletonLineWide}),(0,c.jsx)("span",{className:At.loadingSkeletonLineShort})]})}),(0,c.jsx)("div",{className:At.loadingSkeletonAssistantRow,children:(0,c.jsxs)("div",{className:At.loadingSkeletonAssistantBlock,children:[(0,c.jsx)("span",{className:At.loadingSkeletonLineMedium}),(0,c.jsx)("span",{className:At.loadingSkeletonLineWide}),(0,c.jsx)("span",{className:At.loadingSkeletonLineNarrow})]})}),(0,c.jsx)("div",{className:At.loadingSkeletonUserRow,children:(0,c.jsx)("div",{className:At.loadingSkeletonUserBubbleCompact,children:(0,c.jsx)("span",{className:At.loadingSkeletonLineMedium})})}),(0,c.jsx)("div",{className:At.loadingSkeletonAssistantRow,children:(0,c.jsxs)("div",{className:At.loadingSkeletonAssistantBlock,children:[(0,c.jsx)("span",{className:At.loadingSkeletonLineWide}),(0,c.jsx)("span",{className:At.loadingSkeletonLineMedium})]})})]})]})}var RAe=(0,y.memo)((0,y.forwardRef)(function({messages:e,deletion:t,frozenViewport:a=!1,sessionKey:n,terminalBackgroundShellTaskIds:r,pendingApproval:o,onShowContextDetail:s,onOpenMemoryFile:i,onImagePreview:l,onAttachmentPreview:u,onInsightReportOpen:d,onEditUserMessage:f,onSubmitUserMessageEdit:p,loadingTranscript:m,catchingUp:h,hasOlderHistory:g=!1,loadingOlderHistory:b=!1,historyCapacityReached:w=!1,historyPaginationError:v=!1,onLoadOlderHistory:x,transcriptBlockCount:T=0,transcriptActivity:I,onReloadTranscript:L,isResponding:S=!1,transcriptReloadPaused:C=S,activeTurnStartedAt:E,welcomeHeader:R,centerWelcomeHeader:P=!1,workspaceCwd:N,tailContent:q,tailKey:H="tail",virtualScrollThreshold:z=yH,autoScrollTailIntoView:G=!1,bottomOverlayInset:re=0,hideSessionTimeline:X=!1,timelineAction:V,hideFirstUserMessage:A=!1,firstTurnMetrics:$,includeSubagentToolUsageInMetrics:K=!0,showRetryHint:O=!1,onRetryClick:ee,failedPromptMessageId:de,onRetryFailedPrompt:ye,onBranchSession:oe,onCanScrollToBottomChange:te,turnFileChanges:le,turnArtifacts:J,sourceEntries:_e,sourceSessionId:xe,mcpAppSessionId:je=xe,onSourceOpen:be,turnScheduledTasks:W,onReviewChanges:ke,onOpenArtifact:Ce,onOpenScheduledTask:ze,onTurnOutputOpen:lt,onToolResultOpen:zt,onError:ta,generateContent:ha},pt){let Ie=(0,y.useRef)(a);Ie.current=a;let{t:ne}=Ze(),Z=Oa(),ae=(0,y.useContext)(U9),ge=(0,y.useMemo)(()=>{let F=new Map,Q,ve=0;for(let Ae of e)Ae.role==="user"&&(F.set(Ae.id,ve),Q=Ae.id,ve+=1);return{lastId:Q,turnIndexById:F}},[e]),$e=(0,y.useMemo)(()=>{if(!a)return;let F=[...ge.turnIndexById.keys()];return new Set(F.filter((Q,ve)=>ve===0||ve===F.length-1))},[ge,a]),He=(0,y.useRef)(void 0),Je=TLe(He.current,e);(0,y.useLayoutEffect)(()=>{He.current=e},[e]);let Gt=(0,y.useRef)(void 0),at=(0,y.useRef)(void 0),wt=(0,y.useRef)(void 0),$t=(0,y.useRef)(void 0),tt=(0,y.useMemo)(()=>{let F=Gt.current,Q=e[e.length-1],ve;if(Je&&F?.sourceMessages===He.current&&F?.compactMode===ae&&F.pendingApproval===o&&(Q?.role==="assistant"&&F.value[F.value.length-1]?.id===Q.id?(ve=F.value.slice(),ve[ve.length-1]=Q):Q?.role==="thinking"&&(ve=ae?ELe(F.value,Q):Zq(e))),!ve){let ot=Zq(e);ve=ae?RLe(ot,o):ot}Gt.current={sourceMessages:e,compactMode:ae,pendingApproval:o,value:ve};let Ae=$t.current??=new WeakMap,pe=at.current,vt=pe!==void 0&&pe.sessionKey===n?pe.ids:void 0;if(S){if(wt.current=void 0,!vt?.size)return ve;let ot,Pt=!1,ut=ve.map(Ra=>{let Ta=dg(Ra.id);if(Ta!==void 0){let a1=vt.get(Ta);a1!==void 0&&(ot??=new Map).set(Ta,a1)}let _n=vt.get(ug(Ra.id));_n!==void 0&&(ot??=new Map).set(ug(Ra.id),_n);let ms=vt.get(Ra.id);return ms===void 0||Yq(Ra)!==ms?Ra:((ot??=new Map).set(Ra.id,ms),Pt=!0,Qq(Ae,Ra))});return(ot?.size??0)!==vt.size&&(wt.current={sessionKey:n,ids:ot??new Map}),Pt?ut:ve}let Ft,sa=ve.map(ot=>{let Pt=Qq(Ae,ot);if(Pt!==ot){let ut=Yq(ot);if(ut!==void 0){(Ft??=new Map).set(ot.id,ut);let Ra=dg(ot.id),Ta=ot.role==="tool_group"?ot.thoughts?.[0]?.content:void 0;Ra!==void 0&&Ta!==void 0&&Ft.set(Ra,Ta),ot.role==="thinking"&&Ft.set(ug(ot.id),JSON.stringify([ot.content]))}}return Pt});return Ft?(wt.current={sessionKey:n,ids:new Map([...vt??[],...Ft])},sa):ve},[ae,S,e,o,n,Je]);(0,y.useLayoutEffect)(()=>{let F=wt.current;F&&(at.current=F,wt.current=void 0)},[tt]);let gt=(0,y.useRef)(void 0),Ge=(0,y.useMemo)(()=>{let F=gt.current,Q=tt[tt.length-1],ve;if(Je&&S&&F?.sourceMessages===He.current&&F?.compactMode===ae&&F.pendingApproval===o&&F.isResponding===S&&F.turnFileChanges===le&&F.turnArtifacts===J&&F.turnScheduledTasks===W){let Ae=F.value[F.value.length-1];Ae?.type==="message"&&Ae.message.id===Q.id&&(ve=F.value.slice(),ve[ve.length-1]={...Ae,message:Q})}return ve??=PLe(cH(tt),S,le,J,W),gt.current={sourceMessages:e,compactMode:ae,pendingApproval:o,isResponding:S,turnFileChanges:le,turnArtifacts:J,turnScheduledTasks:W,value:ve},ve},[tt,e,Je,ae,o,S,le,J,W]),Ka=(0,y.useMemo)(()=>{for(let F=tt.length-1;F>=0;F-=1){let Q=tt[F];if(Q?.role==="system"&&Q.source==="background_notification")return Q.id}return null},[tt]),[ur,bi]=(0,y.useState)(Ka),Tt=!!(m||h),Fr=(0,y.useRef)(Tt),ga=(0,y.useRef)(tt.length>0),In=!ga.current&&tt.length>0,Ir=Tt||Fr.current||In;(0,y.useLayoutEffect)(()=>{Ir&&bi(Ka),tt.length>0&&(ga.current=!0),Fr.current=Tt},[Ir,Ka,Tt,tt.length]);let va=!Ir&&Ka!==null&&ur!==Ka,Fa=(0,y.useMemo)(()=>{for(let F=Ge.length-1;F>=0;F-=1){let Q=Ge[F];if(Q.type==="message"&&Qr(Q.message))return F}return 0},[Ge]),Yn=Z==="interactive",dr=(0,y.useMemo)(()=>Yn&&hH(Ge,Fa,Ge.length-1),[Ge,Yn,Fa]),ya=(0,y.useMemo)(()=>vH(Ge,Fa,Ge.length-1,!0),[Ge,Fa]),_r=(0,y.useMemo)(()=>{let F=ya?.unmatchedAgentCallIds;return F&&F.size>0?[...F].sort().join("|"):""},[ya]),us=va&&!dr&&(ya?.sawAgentCompletion??!1)&&(ya?.unmatchedAgentCallIds.size??0)>0,[zo,$s]=(0,y.useState)(!1);(0,y.useEffect)(()=>{$s(!1)},[_r,Fa,S]),(0,y.useEffect)(()=>{if(!us||S)return;let F=setTimeout(()=>$s(!0),Kq);return()=>clearTimeout(F)},[us,_r,Fa,S]);let ki=(0,y.useMemo)(()=>va&&!dr&&!S&&(ya?.sawAgentCompletion??!1)&&(ya?.unmatchedAgentCallIds.size??0)===0&&q9(Ge,Fa,Ge.length-1,!0,!0,!0),[va,Ge,S,ya,dr,Fa]),[Dl,ho]=(0,y.useState)(!1),Jp=(0,y.useMemo)(()=>{let F=ya;if(!F||F.lastNotificationIndex<0)return"";let Q=Ge[F.lastNotificationIndex];return Q?.type==="message"?Q.message.id:""},[Ge,ya]);(0,y.useEffect)(()=>{ho(!1)},[Jp,Fa,S]),(0,y.useEffect)(()=>{if(!ki)return;let F=setTimeout(()=>ho(!0),Kq);return()=>clearTimeout(F)},[ki,Jp,Fa,S]);let Ca=(0,y.useMemo)(()=>va&&q9(Ge,Fa,Ge.length-1,!0,dr||!zo,!Dl),[va,Ge,dr,Fa,Dl,zo]),Bg=(0,y.useMemo)(()=>{let F=new Set;for(let Q=Fa;Q<Ge.length;Q+=1){let ve=Ge[Q];ve.type==="parallel_agents"&&F.add(ve.key)}return F},[Ge,Fa]),em=(0,y.useMemo)(()=>{if(!va)return{key:null};let F=-1,Q;for(let ve=Ge.length-1;ve>=0;ve-=1){let Ae=Ge[ve];if(Ae.type!=="message"||Ae.message.role!=="system"||Ae.message.source!=="background_notification")continue;let pe=F9(Ae);if(pe){F=ve,Q=pe.callId;break}}for(let ve=F-1;ve>=0;ve-=1){let Ae=Ge[ve];if(Ae.type==="parallel_agents"&&(!Q||Ae.agents.some(pe=>pe.callId===Q)))return{key:Ae.key}}return{key:null}},[va,Ge]),Ut=(0,y.useRef)(null),$l=R_e(Ut,!X),[xi,hk]=(0,y.useState)(()=>new Set),tm=(0,y.useCallback)((F,Q)=>{hk(ve=>{if(ve.has(F)===Q)return ve;let Ae=new Set(ve);return Q?Ae.add(F):Ae.delete(F),Ae})},[]),Si=(0,y.useRef)(null),Bs=(0,y.useMemo)(()=>{if(!$l)return LAe;let F=XLe(tt);return(Si.current?.signature!==F||Si.current?.t!==ne)&&(Si.current={signature:F,t:ne,entries:GLe(tt,ne)}),Si.current.entries},[$l,tt,ne]),am=(0,y.useMemo)(()=>new Map(Bs.map((F,Q)=>[F.id,Q])),[Bs]),Fg=(0,y.useMemo)(()=>LLe(tt),[tt]),[nm,qg]=(0,y.useState)(null),gk=nm!==null?Bs[nm.currentIndex]?.id??Fg:Fg,zg=(0,y.useRef)(void 0),nu=(0,y.useMemo)(()=>{let F=zg.current,Q;return Je&&S&&F?.sourceMessages===He.current&&F?.isResponding===S&&F.latestTurnAwaitsAgentSummary===Ca&&F.gateBackgroundAgentStatus===Yn?Q=F.value:Q=OLe(Ge,{isResponding:S,latestTurnAwaitsAgentSummary:Ca,gateBackgroundAgentStatus:Yn}),zg.current={sourceMessages:e,isResponding:S,latestTurnAwaitsAgentSummary:Ca,gateBackgroundAgentStatus:Yn,value:Q},Q},[Ge,e,Je,Yn,S,Ca]),Ug=(0,y.useMemo)(()=>{let F;for(let Q of nu.values())F=Q;return F},[nu]),{collapseCompletedTurns:vk,sourceReferences:ru,assistantFeedback:rm}=Bo(),{ratings:jg,rate:Hg,ratingForTurn:om}=pue(xe),Wg=(0,y.useMemo)(()=>{let F=new Map;for(let Q of e)Qr(Q)&&F.set(Q.id,Q);return F},[e]),ou=rue({renderMode:Z,sessionId:xe,options:rm}),Gg=(0,y.useRef)(rm);Gg.current=rm;let Vg=(0,y.useRef)(e);Vg.current=e;let Kg=(0,y.useCallback)((F,Q,ve)=>{let Ae=om(F);Hg(F,ve);let pe=Gg.current?.onRate;pe&&oue(pe,{rating:ve,previousRating:Ae,sessionId:xe,promptId:F,userMessage:sue(Vg.current,Q)})},[om,Hg,xe]),Xg=(0,y.useRef)(void 0),Wd=(0,y.useMemo)(()=>{let F=[_e,N,xe,ru],Q=Xg.current;return Je&&S&&Q&&Q.sourceMessages===He.current&&Xq(Q.dependencies,F)?Q.value:Kle(e,_e??[],N,xe,ru)},[e,_e,N,xe,ru,Je,S]);(0,y.useLayoutEffect)(()=>{Xg.current={sourceMessages:e,dependencies:[_e,N,xe,ru],value:Wd}},[e,_e,N,xe,ru,Wd]);let sm=vk??!0,[su,iu]=(0,y.useState)(()=>new Map),[Bl,lu]=(0,y.useState)(()=>new Set),Ci=(0,y.useRef)(new Map),[Zg,yk]=(0,y.useTransition)(),im=(0,y.useRef)(!1),Gd=(0,y.useRef)(new Map),Fl=(0,y.useRef)(void 0),Ti=(0,y.useRef)([]),ql=(0,y.useRef)(!0);a&&(ql.current=!1);let oa=(0,y.useRef)(!1),lm=(0,y.useRef)(0),cu=(0,y.useRef)(0),Aa=(0,y.useRef)(!1),qr=(0,y.useRef)(0),Ii=(0,y.useRef)(!1),zl=(0,y.useRef)(0),_i=(0,y.useRef)(null),uu=(0,y.useRef)(!1),Li=(0,y.useRef)(null),cm=(0,y.useRef)(null),Vd=(0,y.useRef)(!1),du=(0,y.useRef)(null),B=(0,y.useRef)(!1),ce=(0,y.useRef)(m),fe=(0,y.useRef)(!!m),Ue=(0,y.useRef)(void 0),ct=(0,y.useRef)(void 0),wa=(0,y.useRef)(re),fr=(0,y.useRef)(null),go=(0,y.useRef)(h),qn=(0,y.useRef)(h),Ai=(0,y.useRef)(!1),Ri=(0,y.useRef)(!1),Fs=(0,y.useRef)(void 0),zr=(0,y.useRef)(void 0);qn.current=h;let Ei=(0,y.useRef)(!1),zn=(0,y.useRef)(void 0),um=(0,y.useRef)(void 0),Mi=(0,y.useRef)(void 0),dm=(0,y.useRef)(void 0),fm=(0,y.useRef)(void 0),Kd=(0,y.useRef)(void 0),Yg=(0,y.useRef)(void 0),wk=(0,y.useRef)(T),bk=(0,y.useRef)(C);wk.current=T,bk.current=C||a;let kk=(0,y.useRef)(null),[qa,qs]=(0,y.useState)(null),j7=(0,y.useRef)(!1);j7.current=qa?.virtual===!0;let H7=(0,y.useRef)(tt.length);(0,y.useLayoutEffect)(()=>{H7.current=tt.length},[tt.length]);let xk=(0,y.useRef)(e);(0,y.useLayoutEffect)(()=>{xk.current=e},[e]);let[_H,Qg]=(0,y.useState)(!1),[LH,AH]=(0,y.useState)(n);LH!==n&&(AH(n),Ci.current.clear(),qr.current+=1,Aa.current=!1,Ei.current=!1,qs(null),iu(F=>F.size?new Map:F),lu(F=>F.size?new Set:F)),(0,y.useEffect)(()=>{g||(Ei.current=!1,kk.current=null)},[g]);let pm=(0,y.useCallback)(()=>{let F=Ut.current,Q=F?F.scrollHeight-F.scrollTop-F.clientHeight:0,ve=!ql.current&&Q>1;cm.current!==ve&&(cm.current=ve,te?.(ve))},[te]),pr=(0,y.useCallback)(()=>{zr.current!==void 0&&window.cancelAnimationFrame(zr.current),zr.current=window.requestAnimationFrame(pm)},[pm]),Wt=(0,y.useCallback)(F=>{Ie.current&&(F=!1),ql.current!==F&&(ql.current=F,pr())},[pr]),Xd=(0,y.useRef)(void 0),Sk=(0,y.useRef)(!1),rn=(0,y.useMemo)(()=>{Sk.current=!1;let F=[$e,su,S,E,r,va,dr,zo,Dl,sm,A,$,K,xi,ae,o,le,J,W,Bl],Q=Xd.current,ve=Ge[Ge.length-1];if(Je&&S&&Q&&Q.sourceMessages===He.current&&Xq(Q.dependencies,F)&&ve?.type==="message"){let ut=bb(ve),Ra=-1;for(let Ta=Q.value.length-1;Ta>=0;Ta-=1)if(bb(Q.value[Ta])===ut){Ra=Ta;break}if(Ra>=0){let Ta=Q.value[Ra];if(Ta?.type==="message"){let _n=Q.value.slice();return _n[Ra]={...Ta,message:ve.message},Xd.current={sourceMessages:e,dependencies:F,value:_n,virtualizerItems:Q.virtualizerItems},Sk.current=!0,_n}}}let Ae=pAe(Ge,{overrides:su,isResponding:S,activeTurnStartedAt:E,terminalBackgroundShellTaskIds:r,backgroundSummaryGraceActive:va,waitForUnmatchedAgentCompletions:dr||!zo,waitForOrderedNarration:!Dl,automaticallyExpandedAgentKeys:xi,pendingApprovalCallId:o?.toolCallId??null,includeSubagentToolUsageInMetrics:K,paginatedExpanded:$e?new Set([...Bl,...$e]):Bl,enabled:sm}),pe=$e?Ae.map(ut=>{if(!("turnCollapse"in ut)||!ut.turnCollapse||!$e.has(ut.turnCollapse.turnId))return ut;let{turnId:Ra,collapsed:Ta,hiddenCount:_n}=ut.turnCollapse;return{...ut,turnCollapse:{turnId:Ra,collapsed:Ta,hiddenCount:_n}}}):Ae,vt=!1,Ft=$?pe.map(ut=>vt||ut.type!=="turn_collapse"?ut:(vt=!0,{...ut,turnCollapse:{...ut.turnCollapse,...$.durationMs!==void 0&&$.durationMs>0?{elapsedMs:$.durationMs}:{},...$.inputTokens!==void 0?{inputTokens:$.inputTokens}:{},...$.outputTokens!==void 0?{outputTokens:$.outputTokens}:{},...$.cachedTokens!==void 0?{cachedTokens:$.cachedTokens}:{}}})):pe,sa=NLe(Ft,xi);if(!A)return Xd.current={sourceMessages:e,dependencies:F,value:sa,virtualizerItems:sa},sa;let ot=tt.find(ut=>ut.role==="user")?.id,Pt=ot?sa.filter(ut=>ut.type!=="message"||ut.message.id!==ot):sa;return Xd.current={sourceMessages:e,dependencies:F,value:Pt,virtualizerItems:Pt},Pt},[Ge,Je,su,S,E,r,va,dr,zo,Dl,sm,$e,A,$,K,tt,e,xi,ae,o,le,J,W,Bl]),Zd=Xd.current?.sourceMessages===e?Xd.current.virtualizerItems:rn,mm=(0,y.useCallback)(F=>Zd.some(Q=>String(bb(Q))===F),[Zd]),Ck=(0,y.useRef)(void 0),RH=(0,y.useMemo)(()=>{if(Sk.current&&Ck.current?.length===rn.length)return Ck.current.value;let F=mH(rn);return Ck.current={length:rn.length,value:F},F},[rn]),EH=Bs.length>=xye,ds=q!=null,Yd=!!m,Ul=!!R,Qn=Ul?1:0,fu=Qn+rn.length,hm=fu+(ds?1:0),MH=Qn+Ge.length+(ds?1:0),Pi=yAe(MH,z),Jn=(0,y.useCallback)(()=>Ut.current,[]),W7=(0,y.useCallback)(()=>{let F=Ut.current;if(!F)return;let Q=F.scrollHeight-F.scrollTop-F.clientHeight<xb;oa.current=!Q,Wt(Q),pr()},[pr,Wt]),gm=(0,y.useCallback)(()=>{lm.current=Date.now()+1e3},[]),Jg=(0,y.useCallback)(()=>{fm.current!==void 0&&(window.clearTimeout(fm.current),fm.current=void 0)},[]),fs=(0,y.useCallback)(()=>{Jg(),Kd.current?.abort(),Kd.current=void 0},[Jg]),Qd=(0,y.useCallback)(()=>{Jg();let F=Yg.current;if(F){if(I?.getSnapshot().lastEventId===F.lastEventId)return;Yg.current=void 0}!L||Kd.current!==void 0||oa.current||bk.current||wk.current<=WF||(fm.current=window.setTimeout(()=>{if(fm.current=void 0,bk.current||oa.current||wk.current<=WF)return;let Q=Ut.current;if(!Q||Q.scrollHeight-Q.scrollTop-Q.clientHeight>=xb)return;let ve=new AbortController;Kd.current=ve,L(ve.signal).then(()=>{if(ve.signal.aborted)return;let Ae=I?.getSnapshot();Yg.current={...Ae?.lastEventId!==void 0?{lastEventId:Ae.lastEventId}:{}}}).catch(Ae=>{Ae instanceof Error&&Ae.name==="AbortError"||console.warn("[MessageList] transcript reload failed:",Ae)}).finally(()=>{Kd.current===ve&&(Kd.current=void 0)})},SLe))},[Jg,L,I]);(0,y.useEffect)(()=>{Yg.current=void 0},[I]),(0,y.useEffect)(()=>{if(!I)return fs;let F=I.getSnapshot().lastEventId,Q=I.subscribe(()=>{let ve=I.getSnapshot().lastEventId;ve!==F&&(F=ve,Qd())});return()=>{Q(),fs()}},[I,Qd,fs]),(0,y.useEffect)(()=>{if(C){fs();return}Qd()},[fs,C,Qd,T]);let Jd=(0,y.useCallback)(()=>{Ri.current=!0,Fs.current!==void 0&&window.cancelAnimationFrame(Fs.current),Fs.current=window.requestAnimationFrame(()=>{Ri.current=!1,Fs.current=void 0,W7()})},[W7]);(0,y.useEffect)(()=>()=>{Fs.current!==void 0&&window.cancelAnimationFrame(Fs.current),zr.current!==void 0&&window.cancelAnimationFrame(zr.current),zn.current!==void 0&&window.cancelAnimationFrame(zn.current),um.current!==void 0&&window.cancelAnimationFrame(um.current),Mi.current!==void 0&&window.cancelAnimationFrame(Mi.current),fs(),Ue.current!==void 0&&window.cancelAnimationFrame(Ue.current),ct.current!==void 0&&window.cancelAnimationFrame(ct.current)},[fs]);let G7=(0,y.useCallback)((F,Q)=>{let ve=Ut.current;(!ve||ve.scrollHeight>ve.clientHeight+1)&&(oa.current=!0,Wt(!1)),Jd(),Fl.current!==void 0&&window.clearTimeout(Fl.current),Gd.current.clear(),Ut.current?.querySelectorAll("[data-message-row-key]").forEach(Ae=>{let pe=Ae.dataset.messageRowKey;pe&&Gd.current.set(pe,Ae.getBoundingClientRect().top)}),im.current=!0,yk(()=>{lu(Ae=>{if(!Ae.has(F))return Ae;let pe=new Set(Ae);return pe.delete(F),pe}),iu(Ae=>{let pe=new Map(Ae);return pe.set(F,Q),pe})})},[Jd,Wt]);(0,y.useLayoutEffect)(()=>{if(Zg||!im.current)return;im.current=!1;for(let Q of Ti.current)Q.cancel();Ti.current=[];let F=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;F||Ut.current?.querySelectorAll("[data-message-row-key]").forEach(Q=>{if(typeof Q.animate!="function")return;let ve=Q.dataset.messageRowKey,Ae=ve?Gd.current.get(ve):void 0;if(Ae===void 0){Ti.current.push(Q.animate([{opacity:0},{opacity:1}],{duration:H6,easing:"ease-out"}));return}let pe=Ae-Q.getBoundingClientRect().top;Math.abs(pe)<1||Ti.current.push(Q.animate([{translate:`0 ${pe}px`},{translate:"0 0"}],{duration:H6,easing:"ease-out"}))}),Gd.current.clear(),Fl.current=window.setTimeout(()=>{Fl.current=void 0,Jd()},F?0:H6)},[Jd,Zg]),(0,y.useEffect)(()=>()=>{Fl.current!==void 0&&window.clearTimeout(Fl.current);for(let F of Ti.current)F.cancel();Ti.current=[]},[]);let PH=(0,y.useCallback)(F=>{let Q=F.target;Q instanceof HTMLElement&&Q.closest("[aria-expanded], summary")&&(oa.current=!0,Wt(!1),Jd())},[Jd,Wt]),pu=(0,y.useCallback)(F=>{if(Ul&&F===K6)return"slot:header";if(ds&&F===fu)return`slot:tail:${H}`;let Q=Zd[F-Qn];return Q?bb(Q):`slot:row:${F}`},[Ul,ds,fu,H,Zd,Qn]),NH=(0,y.useCallback)(F=>Ul&&F===K6?mAe:ds&&F===fu?vAe:Zd[F-Qn]?.type==="turn_collapse"?gAe:hAe,[Ul,ds,Qn,fu,Zd]),er=(0,y.useCallback)((F="auto")=>{if(Ie.current)return;let Q=Jn();if(!Q||Q.scrollHeight<=Q.clientHeight)return;uu.current=!1,zl.current+=1;let ve=zl.current;Ii.current=!0,F==="smooth"?Q.scrollTo({top:Q.scrollHeight,behavior:F}):Q.scrollTop=Q.scrollHeight,pr(),cu.current=Math.max(0,Q.scrollHeight-Q.clientHeight),pm();let Ae=()=>{if(zl.current!==ve||(Ii.current=!1,!uu.current)||(uu.current=!1,qn.current||oa.current))return;let pe=Jn();!pe||pe.scrollHeight<=pe.clientHeight||(Wt(!0),pe.scrollTop=pe.scrollHeight,pr(),cu.current=Math.max(0,pe.scrollHeight-pe.clientHeight),pm())};F==="smooth"?setTimeout(Ae,350):requestAnimationFrame(Ae)},[Jn,pm,pr,Wt]),V7=(0,y.useCallback)((F="smooth")=>{oa.current=!1,Wt(!0),er(F)},[er,Wt]),ps=fce({count:hm,enabled:Pi,getScrollElement:Jn,getItemKey:pu,estimateSize:NH,overscan:20,anchorTo:"end",useFlushSync:!1,useAnimationFrameWithResizeObserver:!0,directDomUpdates:!0});ps.shouldAdjustScrollPositionOnItemSizeChange=(F,Q,ve)=>wAe(F.end,Ut.current?.scrollTop??ve.scrollOffset??0);let OH=(0,y.useCallback)(F=>{if(ps.measureElement(F),!F||!j7.current)return;let Q=Number(F.dataset.index);Number.isFinite(Q)&&!ps.itemSizeCache.has(pu(Q))&&ps.resizeItem(Q,F.offsetHeight)},[pu,ps]);(0,y.useLayoutEffect)(()=>{if(!qa)return;let F=Ut.current;if(qa.rowKey&&!mm(qa.rowKey)){let Q=qLe(xk.current,qa.rowKey);if(Q!==void 0&&zLe(rn,Q)&&su.get(Q)!==!1&&!Bl.has(Q)){lu(ve=>ve.has(Q)?ve:new Set(ve).add(Q)),qs(ve=>ve&&{...ve,rowKey:`msg:${Q}`});return}qa.generation===qr.current&&(qr.current+=1),Aa.current=!1,dm.current=void 0,Qg(!1),qs(null);return}if(qa.settled){if(!F){Aa.current=!1,qs(null);return}if(qa.virtual?tt.length===qa.messageCount:F.scrollHeight===qa.scrollHeight){if(Aa.current=!1,zn.current!==void 0)return;let Q=rz,ve=()=>{if(zn.current=void 0,qa.generation===qr.current&&H7.current===qa.messageCount){if(Q-=1,Q>0){zn.current=requestAnimationFrame(ve);return}qs(Ae=>Ae===qa?null:Ae)}};zn.current=requestAnimationFrame(ve);return}zn.current!==void 0&&(cancelAnimationFrame(zn.current),zn.current=void 0),zn.current=requestAnimationFrame(()=>{if(zn.current=void 0,qa.generation!==qr.current)return;if(qa.rowKey&&!mm(qa.rowKey)){Aa.current=!1,qs(null);return}let Q=qa.rowKey?Array.from(F.querySelectorAll("[data-message-row-key]")).find(ve=>ve.dataset.messageRowKey===qa.rowKey):void 0;Q&&qa.rowTop!==void 0?F.scrollTop+=Q.getBoundingClientRect().top-qa.rowTop:F.scrollTop=qa.scrollTop+Math.max(0,F.scrollHeight-qa.scrollHeight),Aa.current=!1,qs(null)})}},[mm,tt.length,qa,rn,su,Bl]);let K7=ps.getVirtualItems(),ef=ps.getTotalSize(),X7=(0,y.useRef)({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});X7.current={entryIndexById:am,headerOffset:Qn,isVisible:$l,turnIdByDisplayIndex:RH,visibleItems:rn};let Z7=(0,y.useCallback)(()=>{let F=Jn(),Q=X7.current;if(!F||!Q.isVisible||Q.entryIndexById.size===0){qg(ut=>ut===null?ut:null);return}let ve=F.getBoundingClientRect(),Ae=ve.top,pe=ve.bottom,vt=Ae+(pe-Ae)/2,Ft=[],sa=null,ot=Number.POSITIVE_INFINITY;F.querySelectorAll("[data-index]").forEach(ut=>{let Ra=ut.dataset.index;if(Ra===void 0)return;let Ta=Number(Ra);if(!Number.isFinite(Ta))return;let _n=Ta-Q.headerOffset;if(_n<0||_n>=Q.visibleItems.length)return;let ms=ut.getBoundingClientRect();if(ms.bottom<Ae||ms.top>pe)return;Ft.push(_n);let a1=ms.top+(ms.bottom-ms.top)/2,nT=Math.abs(a1-vt);nT<ot&&(ot=nT,sa=_n)});let Pt=oAe(Q.visibleItems,Ft,Q.entryIndexById,sa,Q.turnIdByDisplayIndex);qg(ut=>ut?.startIndex===Pt?.startIndex&&ut?.endIndex===Pt?.endIndex&&ut?.currentIndex===Pt?.currentIndex?ut:Pt)},[Jn]),jl=(0,y.useCallback)(()=>{Li.current!==null&&cancelAnimationFrame(Li.current),Li.current=requestAnimationFrame(()=>{Li.current=null,Z7()})},[Z7]);(0,y.useEffect)(()=>()=>{_i.current!==null&&(clearTimeout(_i.current),_i.current=null),Li.current!==null&&(cancelAnimationFrame(Li.current),Li.current=null)},[]),(0,y.useEffect)(()=>{jl()},[jl,hm,ef,Pi,K7.length,$l]);let[vm,Tk]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(!vm)return;let F=setTimeout(()=>Tk(null),1600);return()=>clearTimeout(F)},[vm]);let Ik=(0,y.useCallback)((F,Q)=>{oa.current=!0,Wt(!1),zl.current+=1;let ve=zl.current;if(Ii.current=!0,Pi)if(Ie.current){let Ae=ps.getOffsetForIndex(F,"center");Ae&&Ut.current&&(Ut.current.scrollTop=Ae[0])}else ps.scrollToIndex(F,{align:"center"});else Ut.current?.querySelector(`[data-index="${F}"]`)?.scrollIntoView({block:"center"});_i.current!==null&&clearTimeout(_i.current),_i.current=setTimeout(()=>{_i.current=null,zl.current===ve&&(Ii.current=!1,jl(),pr())},150),Tk(null),requestAnimationFrame(()=>Tk(Q))},[Pi,ps,Wt,jl,pr]),Y7=(0,y.useRef)({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});Y7.current={visibleItems:rn,displayItems:Ge,headerOffset:Qn,performScrollToRow:Ik};let mu=(0,y.useRef)(null),ym=(0,y.useCallback)((F,Q)=>{let{visibleItems:ve,displayItems:Ae,headerOffset:pe,performScrollToRow:vt}=Y7.current,Ft=kb(ve,F,Q);if(Ft>=0)return mu.current=null,vt(Ft+pe,{messageId:F,callId:Q}),!0;let sa=kb(Ae,F,Q);if(sa<0)return!1;let ot=pH(Ae,sa);return ot?(mu.current={messageId:F,callId:Q},iu(Pt=>{if(Pt.get(ot)===!0)return Pt;let ut=new Map(Pt);return ut.set(ot,!0),ut}),!0):!1},[]);(0,y.useImperativeHandle)(pt,()=>({scrollToMessage:ym,scrollToBottom:V7}),[ym,V7]),(0,y.useEffect)(()=>{let F=mu.current;if(!F)return;let Q=kb(rn,F.messageId,F.callId);Q<0||(mu.current=null,Ik(Q+Qn,F))},[rn,Qn,Ik]);let zs=(0,y.useCallback)(async(F=!1,Q=!1)=>{let ve=Ut.current;if(!ve||!x||b||Aa.current||v&&!Q||Ei.current&&!F)return;Ei.current=!1,Aa.current=!0;let Ae=++qr.current;zn.current!==void 0&&(cancelAnimationFrame(zn.current),zn.current=void 0),Qg(!Q);let pe;if(Pi){let Pt=String(pu(Qn)),ut=rz;if(pe=await new Promise(Ra=>{let Ta=()=>{if(um.current=void 0,Ae!==qr.current||Ut.current!==ve||!mm(Pt)||ut--<=0){Ra(void 0);return}let _n=Array.from(ve.querySelectorAll("[data-message-row-key]")).find(ms=>ms.dataset.messageRowKey===Pt);_n?Ra({rowKey:Pt,rowTop:_n.getBoundingClientRect().top}):um.current=requestAnimationFrame(Ta)};um.current=requestAnimationFrame(Ta)}),!pe){Ae===qr.current&&(Aa.current=!1,dm.current=void 0,Qg(!1));return}}let vt=ve.scrollHeight,Ft=ve.scrollTop,sa=ve.getBoundingClientRect().top,ot=pe?void 0:Array.from(ve.querySelectorAll("[data-message-row-key]")).find(Pt=>{let ut=Pt.dataset.messageRowKey;return ut!==void 0&&ut.startsWith("msg:")&&Pt.getBoundingClientRect().bottom>sa});oa.current=!0,qs({scrollHeight:vt,scrollTop:Ft,messageCount:tt.length,virtual:Pi,settled:!1,generation:Ae,...pe??(ot?{rowKey:ot.dataset.messageRowKey,rowTop:ot.getBoundingClientRect().top}:{})});try{Ci.current.set(Ae,{ids:new Set(xk.current.map(ut=>ut.id)),resolved:!1}),await x(Q?{force:!0}:void 0);let Pt=Ci.current.get(Ae);Pt&&(Pt.resolved=!0),Ae===qr.current&&qs(ut=>ut?.generation===Ae?{...ut,settled:!0}:ut)}catch{Ci.current.delete(Ae),Ae===qr.current&&(Ei.current=!0,Aa.current=!1,qs(null))}finally{Ae===qr.current&&Qg(!1)}},[b,x,v,pu,mm,Qn,tt.length,Pi]),DH=(0,y.useCallback)(()=>{zs(!0,!0)},[zs]);(0,y.useLayoutEffect)(()=>{let F=Ci.current;if(F.size===0)return;let Q=e.find(Ft=>!Ft?.id.startsWith("local-"));if(!Q)return;let ve=F.entries().next().value;if(!ve)return;let[Ae,pe]=ve;if(pe.ids.has(Q.id))return;let vt=[];for(let Ft=0;Ft<e.length;Ft++){let sa=e[Ft];if(!sa||!Qr(sa)||pe.ids.has(sa.id))continue;let ot=!1;for(let Pt=Ft+1;Pt<e.length;Pt++){let ut=e[Pt];if(Qr(ut))break;if(pe.ids.has(ut.id)){ot=!0;break}}ot&&vt.push(sa.id)}if(vt.length===0){if(!pe.resolved)return}else lu(Ft=>{let sa=null;for(let ot of vt)Ft.has(ot)||(sa??=new Set(Ft),sa.add(ot));return sa??Ft});F.delete(Ae);for(let Ft of F.values())for(let sa of e)sa&&Ft.ids.add(sa.id)},[e]),(0,y.useEffect)(()=>{let F=dm.current;if(F===void 0||b||qa||Aa.current||(dm.current=void 0,!g||F!==qr.current))return;let Q=Jn();Q&&Q.scrollTop<=X6&&zs(!0)},[Jn,g,zs,b,qa]);let _k=(0,y.useCallback)(()=>{let F=Jn();if(!F)return;let Q=F.scrollTop;g&&Q<=X6&&zs(!0);let ve=Date.now()<=lm.current;if(Ii.current&&!ve){cu.current=Q;return}jl();let Ae=cu.current;cu.current=Q;let pe=F.scrollHeight-Q-F.clientHeight;if(pr(),Q<Ae-1){let vt=pe<xb;ve?(fs(),oa.current=!0,Wt(!1)):vt?(oa.current=!1,Wt(!0)):oa.current||(fs(),Wt(!1));return}pe<xb?(oa.current=!1,Wt(!0),Qd()):fs()},[Jn,g,zs,pr,jl,Qd,fs,Wt]);(0,y.useEffect)(()=>{let F=Jn();if(F)return F.addEventListener("scroll",_k,{passive:!0}),()=>F.removeEventListener("scroll",_k)},[Jn,_k]);let e1=(0,y.useCallback)(()=>{if(!g||b||h||Yd)return;let F=Jn();if(!F||F.scrollHeight>F.clientHeight+1)return;let Q=kk.current;if(Q!==null&&Q.loader===x&&Q.totalVirtualSize===ef){Ei.current=!0;return}kk.current={loader:x,totalVirtualSize:ef},zs()},[h,Jn,g,zs,b,x,Yd,ef]);(0,y.useEffect)(()=>{e1()},[e1,ef]),(0,y.useEffect)(()=>{let F=Jn();if(!F)return;let Q=()=>{if(Mi.current=void 0,!(F.scrollTop>X6)){if(b||Aa.current){dm.current=qr.current;return}zs(!0)}},ve=()=>{Mi.current!==void 0&&cancelAnimationFrame(Mi.current),Mi.current=requestAnimationFrame(Q)},Ae=ot=>{gm(),ot.deltaY<0&&ve()},pe=()=>{gm()},vt=()=>ve(),Ft=ot=>{let Pt=F.getBoundingClientRect(),ut=20;(ot.clientX>=Pt.right-ut||ot.clientY>=Pt.bottom-ut)&&gm()},sa=ot=>{(ot.key==="ArrowUp"||ot.key==="ArrowDown"||ot.key==="PageUp"||ot.key==="PageDown"||ot.key==="Home"||ot.key==="End"||ot.key===" ")&&(gm(),(ot.key==="ArrowUp"||ot.key==="PageUp"||ot.key==="Home")&&ve())};return F.addEventListener("wheel",Ae,{passive:!0}),F.addEventListener("touchstart",pe,{passive:!0}),F.addEventListener("touchmove",vt,{passive:!0}),F.addEventListener("pointerdown",Ft,{passive:!0}),F.addEventListener("keydown",sa,{passive:!0}),()=>{F.removeEventListener("wheel",Ae),F.removeEventListener("touchstart",pe),F.removeEventListener("touchmove",vt),F.removeEventListener("pointerdown",Ft),F.removeEventListener("keydown",sa),Mi.current!==void 0&&(cancelAnimationFrame(Mi.current),Mi.current=void 0)}},[Jn,zs,b,gm]),(0,y.useEffect)(()=>{let F=Jn();if(!F||typeof ResizeObserver>"u")return;let Q=new ResizeObserver(()=>{pr(),e1(),!(qn.current||oa.current)&&(Wt(!0),er())});Q.observe(F);for(let Ae of Array.from(F.children))Q.observe(Ae);let ve=new MutationObserver(Ae=>{for(let pe of Ae){for(let vt of Array.from(pe.addedNodes))vt instanceof HTMLElement&&Q.observe(vt);for(let vt of Array.from(pe.removedNodes))vt instanceof HTMLElement&&Q.unobserve(vt)}pr()});return ve.observe(F,{childList:!0}),pr(),()=>{Q.disconnect(),ve.disconnect()}},[Jn,e1,pr,er,Wt]),(0,y.useEffect)(()=>{e.length===0&&(oa.current=!1,uu.current=!1,Wt(!0),mu.current=null,Ci.current.clear(),at.current=void 0,wt.current=void 0,iu(F=>F.size?new Map:F),lu(F=>F.size?new Set:F))},[e.length,Wt]),(0,y.useEffect)(()=>{let F=Ut.current;if(!F)return;let Q=new ResizeObserver(()=>{jl(),!qn.current&&(oa.current||(Wt(!0),requestAnimationFrame(()=>{!qn.current&&!oa.current&&er()})))});return Q.observe(F),()=>Q.disconnect()},[er,jl,Wt]),(0,y.useLayoutEffect)(()=>{let F=ILe(e);if(h||m||ce.current){du.current=F,Vd.current=!0,B.current=!1,ce.current=m;return}if(ce.current=m,!Vd.current){du.current=F,Vd.current=!0,B.current=!1;return}let Q=_Le(e);F&&Q?.role==="user"&&F!==du.current?(oa.current=!1,Wt(!0),mu.current=null,B.current=!0):B.current=!1,du.current=F},[e,h,m,Wt]),(0,y.useLayoutEffect)(()=>{go.current&&!h&&!oa.current&&(Wt(!0),er("auto")),go.current=h},[h,er,Wt]),(0,y.useLayoutEffect)(()=>{if(m){fe.current=!0;return}if(!fe.current||h||e.length===0)return;fe.current=!1,oa.current=!1,Wt(!0),mu.current=null,Ue.current!==void 0&&window.cancelAnimationFrame(Ue.current),ct.current!==void 0&&window.cancelAnimationFrame(ct.current);let F=()=>{qn.current||oa.current||(Wt(!0),er("auto"))};Ue.current=window.requestAnimationFrame(()=>{Ue.current=void 0,F(),ct.current=window.requestAnimationFrame(()=>{ct.current=void 0,F()})})},[h,m,e.length,er,Wt]),(0,y.useLayoutEffect)(()=>{let F=wa.current!==re;wa.current=re,F&&(h||oa.current||(Wt(!0),requestAnimationFrame(()=>{!qn.current&&!oa.current&&er("auto")})))},[re,h,er,Wt]);let t1=(0,y.useMemo)(()=>QLe(rn),[rn]);(0,y.useLayoutEffect)(()=>{if(!h){if(!t1){fr.current=null;return}t1!==fr.current&&(fr.current=t1,(ql.current||!oa.current)&&requestAnimationFrame(()=>{oa.current||(Wt(!0),er())}))}},[h,t1,er,Wt]),(0,y.useEffect)(()=>{G&&ds&&!Ai.current&&(oa.current=!1,Wt(!0),requestAnimationFrame(()=>{oa.current||er()})),Ai.current=ds},[G,ds,er,Wt]);let Q7=(0,y.useCallback)(F=>{let Q=pe=>{if(pe.type==="parallel_agents")return(0,c.jsx)(t9,{timestamp:pe.timestamp,children:(0,c.jsx)("div",{className:az(pe,vm)?Ol.flash:void 0,children:(0,c.jsx)(FU,{agents:pe.agents,autoManageExpansion:Z==="interactive"&&!h,automaticCollapseDelayMs:em.key===pe.key&&!Ca?CLe:void 0,deferAutomaticCollapse:em.key===pe.key&&Ca,expandActiveWhenLive:S&&Bg.has(pe.key),onAutomaticExpansionChange:_n=>tm(pe.key,_n),pendingApproval:o})})});if(pe.type==="turn_outputs")return(0,c.jsx)(k_e,{changes:pe.changes,turnId:pe.turnId,artifacts:pe.artifacts,sourceSessionId:xe,scheduledTasks:pe.scheduledTasks,workspaceCwd:N,onOpenRequest:lt,onReviewChanges:ke??j6,onOpenArtifact:Ce??j6,onOpenScheduledTask:ze??j6,onError:ta});if(pe.type==="turn_collapse")return(0,c.jsx)(SAe,{turnCollapse:pe.turnCollapse,onToggleCollapse:G7});let vt=pe.message.role==="assistant"?nu.get(pe.message.id):void 0,Ft;pe.message.role==="assistant"&&vt&&!a&&(Ft={turnId:vt,message:{id:pe.message.id,content:pe.message.content,isStreaming:pe.message.isStreaming,timestamp:pe.message.timestamp}});let sa=vt?Wg.get(vt):void 0,ot=pe.message.promptId??sa?.promptId,Pt=pe.message.role==="assistant"&&pe.message.agentMessage?.kind==="agent_message",ut=pe.message.role==="assistant"&&!Pt?pe.message.branchRecordId:void 0,Ra=pe.message.role==="user"?pe.message.content:void 0,Ta=Ra!==void 0&&pe.message.id===ge.lastId&&!S&&!g&&!w?{turnIndex:ge.turnIndexById.get(pe.message.id)??0,content:Ra}:void 0;return(0,c.jsx)(OIe,{message:pe.message,onLocateBackgroundSource:pe.message.role==="system"&&pe.message.source==="background_notification_turn_started"&&pe.message.backgroundTurn?.toolUseId&&kb(Ge,"",pe.message.backgroundTurn.toolUseId)>=0?ym:void 0,onDeleteMessage:t&&(t.active||!t.disabled)&&t.canDelete(pe.message)&&(pe.message.role==="user"||pe.message.localCommandId)&&(pe.message.promptId||pe.message.sourceRecordIds?.length||pe.message.localCommandId)?()=>t.start(pe.message):void 0,deleteMessageDisabled:t?.active,pendingApproval:o,onShowContextDetail:s,onOpenMemoryFile:i,onImagePreview:l,onAttachmentPreview:u,onTurnOutputOpen:lt,onToolResultOpen:zt,onInsightReportOpen:d,onEditUserMessage:f&&Ta?()=>f(Ta.turnIndex,Ta.content):void 0,onSubmitUserMessageEdit:p&&Ta?_n=>p(Ta.turnIndex,_n):void 0,workspaceCwd:N,showRetryHint:O,onRetryClick:ee,sendFailed:pe.message.role==="user"&&pe.message.id===de,onRetrySend:ye,onBranchSession:oe,branchRecordId:ut,showAssistantActions:pe.message.role==="assistant"&&(Pt||nu.has(pe.message.id)),assistantFooterAlwaysVisible:!S&&vt!==void 0&&vt===Ug,showAssistantBranch:pe.message.role==="assistant"&&!Pt&&!S&&ut!==void 0,assistantFeedbackTurnId:ou&&!Pt?vt:void 0,assistantFeedbackPromptId:ou&&!Pt?ot:void 0,assistantFeedbackRating:ou&&!Pt&&ot?jg[ot]:void 0,onAssistantFeedbackRate:Kg,isLocateFlashing:az(pe,vm),assistantTurnFooterInfo:Ft,turnSources:vt?Wd.get(vt):void 0,onSourceOpen:be,generateContent:ha})};if(Ul&&F===K6)return R;if(ds&&F===fu)return q;let ve=F-Qn,Ae=rn[ve];return Ae?Q(Ae):null},[Ul,R,ds,q,fu,o,h,S,Ca,Bg,em,Z,tm,s,i,Ge,ym,l,u,d,f,t,p,ge,g,w,ha,Qn,rn,vm,nu,Ug,ou,Wg,jg,Kg,a,N,O,ee,de,ye,oe,G7,xe,Ce,ze,ke,lt,zt,Wd,be,ta]),J7=(0,y.useCallback)(F=>F?CAe(F):void 0,[]),eT=Pi?ef:e;(0,y.useLayoutEffect)(()=>{if(h)return;let F=B.current;if(Ii.current&&!F){oa.current||(uu.current=!0);return}Ri.current&&!F||(ql.current||F||!oa.current)&&(oa.current||Wt(!0),er(F?"smooth":"auto"),B.current=!1)},[eT,hm,h,er,Wt]),(0,y.useLayoutEffect)(()=>{pr()},[eT,pr,hm]);let tT=(0,y.useMemo)(()=>{let F=new Map;if(!t?.active)return F;let Q=pe=>{let vt=pe.type==="message"?pe.message.id:pe.type==="turn_collapse"?pe.turnCollapse.turnId:pe.turnId;return t.groupByMessage.get(vt)??t.groupByMessage.get(dg(vt)??vt)},ve=new Set;for(let pe of rn)if(pe.type==="turn_collapse"&&wH(pe.turnCollapse)){let vt=Q(pe),Ft=vt??pe.turnCollapse.turnId;ve.has(Ft)||(F.set(pe,vt),ve.add(Ft))}let Ae="unowned";for(let pe of rn){if(pe.type==="turn_collapse"||pe.type==="turn_outputs")continue;let vt=Q(pe);if(pe.type==="message"&&Qr(pe.message))Ae=pe.message.id,F.set(pe,vt);else{let Ft=vt??Ae;ve.has(Ft)||(F.set(pe,vt),ve.add(Ft))}}return F},[t,rn]),aT=F=>{if(!t?.active||!F||!tT.has(F))return null;let Q=tT.get(F);return(0,c.jsx)(Ed,{className:At.deletionCheckbox,"aria-label":ne("messageDelete.selectGroup"),title:Q?void 0:ne("messageDelete.unavailable"),checked:Q?t.selected.has(Q):!1,disabled:!Q||t.disabled||!t.allowed.has(Q),onCheckedChange:()=>{Q&&t.toggle(Q)}})};return(0,c.jsx)(ok.Provider,{value:je,children:(0,c.jsxs)("div",{ref:Ut,className:z9(At.list,t?.active?At.deletionMode:void 0,Ul&&P?At.listWithWelcomeHeader:void 0),"data-web-shell-message-list":!0,onClickCapture:PH,children:[Yd&&(0,c.jsx)(AAe,{label:ne("editor.sessionLoading")}),b&&!Yd&&!_H&&(0,c.jsx)("div",{className:At.historyStatus,role:"status",children:ne("history.loadingEarlier")}),w&&!Yd&&(0,c.jsx)("div",{className:At.historyStatus,role:"status",children:ne("history.capacityReached")}),v&&!Yd&&!w&&(0,c.jsxs)("div",{className:At.historyStatus,children:[(0,c.jsx)("span",{role:"status",children:ne("history.paginationError")}),x&&(0,c.jsx)("button",{type:"button",className:At.historyRetryButton,onClick:DH,children:ne("history.retry")})]}),(0,c.jsx)(_Ae,{action:V,entries:Bs,currentTurnId:gk,currentRange:nm,hidden:!$l||!EH,onSelect:ym}),Pi?(0,c.jsx)("div",{ref:ps.containerRef,className:At.virtualSizer,children:K7.map(F=>(0,c.jsxs)("div",{"data-index":F.index,ref:OH,className:z9(At.virtualRow,J7(rn[F.index-Qn])),"data-message-row-key":String(pu(F.index)),"data-source-block-ids":nz(rn[F.index-Qn],e),"data-web-shell-message-row":!0,style:{position:"absolute",top:0,left:0,right:0},children:[aT(rn[F.index-Qn]),Q7(F.index)]},F.key))}):Array.from({length:hm},(F,Q)=>{let ve=pu(Q),Ae=rn[Q-Qn];return(0,c.jsxs)("div",{"data-index":Q,className:J7(Ae),"data-message-row-key":String(ve),"data-source-block-ids":nz(Ae,e),"data-web-shell-message-row":!0,children:[aT(Ae),Q7(Q)]},ve)})]})})})),iz={title:"Something went wrong",body:"An unexpected error occurred and this content could not be displayed.",retry:"Try again",reload:"Reload page"},lz={en:iz,"zh-CN":{title:"出了点问题",body:"发生意外错误,无法显示此内容。",retry:"重试",reload:"重新加载"},ru:iz},EAe={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},MAe={margin:0,fontSize:"1rem",fontWeight:600},PAe={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},NAe={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 OAe({error:e,onRetry:t,language:a="en",retryMode:n="reset"}){let r=lz[a]??lz.en;return(0,c.jsxs)("div",{role:"alert",style:EAe,"data-web-shell-error":!0,children:[(0,c.jsx)("p",{style:MAe,children:r.title}),(0,c.jsx)("p",{style:PAe,children:r.body}),!1,(0,c.jsx)("button",{type:"button",style:NAe,onClick:t,children:n==="reload"?r.reload:r.retry})]})}function DAe(e,t,a=!1){return eye(e,{safeToolProjection:a,includeSourceIdentity:!0,labels:{promptCancelled:t("request.cancelled"),branchSuccess:n=>t("branch.success",{name:n}),modelStreamInterrupted:t("error.modelStreamInterrupted"),loopDetected:t("error.loopDetected"),loopDetectedFor:n=>$Ae(n,t)}})}function $Ae(e,t){let a=e.toolCallLimit;switch(e.loopType){case"turn_tool_call_cap":if(a===void 0)return;switch(e.loopReason){case"explicit_cap":return t("error.loopDetected.explicitCap",{limit:a});case"backstop":return t("error.loopDetected.backstop",{limit:a});case"stuck_repetition":return t("error.loopDetected.stuckRepetition",{limit:a});default:return}case"global_tool_call_duplicate":switch(e.loopReason){case"repeated_call":return t("error.loopDetected.repeatedCall");case"provider_duplicate_id":return t("error.loopDetected.providerDuplicateId");default:return}case"invalid_tool_params_stagnation":return t("error.loopDetected.invalidToolParams");case"repeated_tool_execution_failure":return t("error.loopDetected.repeatedToolFailure");default:return}}var BAe="_app_bt90j_1",FAe="_appChat_bt90j_66",qAe="_content_bt90j_120",zAe="_themeDark_bt90j_435",UAe="_themeLight_bt90j_509",jAe="_contentHasMessages_bt90j_591",qp={app:BAe,appChat:FAe,content:qAe,themeDark:zAe,themeLight:UAe,contentHasMessages:jAe},HAe=1e3,WAe=40;function bH(e){if(e!==void 0)return tF(e);if(typeof window>"u")return"en";let t=new URLSearchParams(window.location.search);return tF(t.get("language")??t.get("lang")??navigator.language)}function GAe(e){let t=`${typeof e=="number"&&Number.isFinite(e)&&e>0?e:HAe}px`,a=`calc(${t} + ${WAe}px)`;return{"--chat-regular-content-width":t,"--chat-regular-shell-width":a,"--chat-content-width":t,"--chat-shell-width":a}}function VAe({blocks:e,renderMode:t="readonly",theme:a=Q0.Dark,language:n,className:r,style:o,chatMaxWidth:s,workspaceCwd:i="",compactThinking:l=!1,documentExpanded:u=!0,collapseCompletedTurns:d,markdownTableMode:f="basic",virtualScrollThreshold:p,markdown:m,sourceSessionId:h,sources:g,sourceAttachments:b,sourceReferences:w,getAssistantSourcesIcon:v,onSourceOpen:x,composerTagIcons:T,artifact:I,renderToolHeaderExtra:L,parseUserMessageContent:S,renderUserMessageContent:C,renderComposerTag:E,renderComposerTagTooltip:R,renderAssistantTurnFooter:P,mcpAppBaseUrl:N}){let q=t==="document",H=!q&&(d??!0),z=q?"basic":f,G=bH(n),re=(0,y.useMemo)(()=>gz(G),[G]),X=(0,y.useMemo)(()=>DAe(e,re,q),[e,q,re]),V=(0,y.useMemo)(()=>Gle(g??[],b??[]),[g,b]),A=(0,y.useMemo)(()=>$ve(X),[X]),$=(0,y.useMemo)(()=>Eve(X),[X]),K=(0,y.useMemo)(()=>({artifact:I,composerTagIcons:T,renderToolHeaderExtra:L,parseUserMessageContent:S,renderUserMessageContent:C,renderComposerTag:E,renderComposerTagTooltip:R,renderAssistantTurnFooter:P,compactThinking:l,collapseCompletedTurns:H,markdownTableMode:z,markdown:m,sourceReferences:w,getAssistantSourcesIcon:v}),[I,H,l,T,m,w,v,z,S,P,E,R,L,C]),O=(0,y.useRef)(null),[ee,de]=(0,y.useState)(null),ye=(0,y.useRef)(new Set),oe=[qp.app,qp.appChat,a===Q0.Light?qp.themeLight:qp.themeDark,a===Q0.Dark?"dark":void 0,r].filter(Boolean).join(" "),te=(0,y.useMemo)(()=>({...o,...GAe(s)}),[s,o]);return(0,y.useLayoutEffect)(()=>{if(typeof document>"u")return;let le=document.createElement("div");return le.dataset.webShellPortalRoot="",le.dataset.webShellShadcn="",document.body.appendChild(le),de(le),()=>{le.remove(),de(null)}},[]),(0,y.useLayoutEffect)(()=>{let le=O.current;if(!le||!ee)return;let J=null,_e=()=>{J=null;let W=getComputedStyle(le),ke=new Set;ee.dataset.webShellShadcn="",ee.classList.toggle("dark",a===Q0.Dark),ee.lang=G;for(let Ce=0;Ce<W.length;Ce+=1){let ze=W[Ce];ze.startsWith("--")&&(ke.add(ze),ee.style.setProperty(ze,W.getPropertyValue(ze)))}for(let Ce of ye.current)ke.has(Ce)||ee.style.removeProperty(Ce);ye.current=ke},xe=()=>{J===null&&(J=requestAnimationFrame(_e))};_e();let je=new MutationObserver(xe),be=le;for(;be;)je.observe(be,{attributes:!0,attributeFilter:["class","style","data-theme","lang"]}),be=be.parentElement;return window.addEventListener("resize",xe),()=>{je.disconnect(),window.removeEventListener("resize",xe),J!==null&&cancelAnimationFrame(J)}},[ee,G,oe,te,a]),(0,c.jsx)(vde,{value:a,children:(0,c.jsx)(tue,{language:G,children:(0,c.jsx)(wU.Provider,{value:N,children:(0,c.jsx)(yz.Provider,{value:ee,children:(0,c.jsx)(aue,{value:t,children:(0,c.jsx)(nue,{value:u,children:(0,c.jsx)(Zle,{value:K,children:(0,c.jsx)(Xle,{timeline:$,details:A,children:(0,c.jsx)(U9.Provider,{value:!1,children:(0,c.jsx)("div",{ref:O,className:oe,style:te,"data-web-shell-root":!0,"data-web-shell-shadcn":!0,"data-transcript-render-mode":t,"data-document-expanded":q?String(u):void 0,lang:G,children:(0,c.jsx)("div",{className:`${qp.content} ${qp.contentHasMessages}`,children:(0,c.jsx)(RAe,{messages:X,sourceSessionId:h,sourceEntries:q?void 0:V,onSourceOpen:x,pendingApproval:null,isResponding:!1,workspaceCwd:i,virtualScrollThreshold:q?Number.MAX_SAFE_INTEGER:p,hideSessionTimeline:q})})})})})})})})})})})})}function kH(e){let t=bH(e.language);return(0,c.jsx)($d,{label:"web-shell-transcript-root",resetKeys:[e.blocks,t],fallback:(a,n)=>(0,c.jsx)(OAe,{error:a,onRetry:n,language:t}),children:(0,c.jsx)(VAe,{...e})})}var yt=Fe(Ya(),1),CH="qwen-export-theme";function jd(e){return e===void 0||typeof e=="string"}function Hd(e){return e===void 0||typeof e=="number"&&Number.isFinite(e)&&e>=0}function KAe(){let e=document.getElementById("transcript-document");if(!(e instanceof HTMLScriptElement))throw new Error("Transcript document envelope is missing.");let t=e.textContent??"";if(t.length>33554432)throw new Error("Transcript document exceeds the envelope budget.");if(new TextEncoder().encode(t).byteLength>33554432)throw new Error("Transcript document exceeds the envelope budget.");let a=JSON.parse(t);if(a.schemaVersion!==1||a.rendererVersion!=="0.26.5+b809ea07d6b8f389"||!Array.isArray(a.blocks)||a.blocks.length>1e3||!a.metadata||typeof a.metadata!="object"||Array.isArray(a.metadata)||!jd(a.metadata.title)||!jd(a.metadata.startedAt)||!jd(a.metadata.projectName)||!jd(a.metadata.repository)||!jd(a.metadata.gitBranch)||!jd(a.metadata.model)||!jd(a.metadata.channel)||!Hd(a.metadata.promptCount)||!Hd(a.metadata.contextUsagePercent)||!Hd(a.metadata.contextWindowSize)||!Hd(a.metadata.totalTokens)||!Hd(a.metadata.filesWritten)||!Hd(a.metadata.linesAdded)||!Hd(a.metadata.linesRemoved)||typeof a.metadata.exportedAt!="string"||typeof a.metadata.complete!="boolean"||typeof a.metadata.truncated!="boolean")throw new Error("Transcript document is incompatible with this renderer.");return a}function XAe(){try{let e=localStorage.getItem(CH);if(e==="light"||e==="dark")return e}catch{}return"dark"}function xH(e){if(!e)return;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function ZAe(e){if(e!==void 0)return e>=1e6?`${e/1e6}m`:e>=1e3?`${e/1e3}k`:String(e)}function po({label:e,value:t}){return t===void 0||t===""?null:(0,yt.jsxs)("div",{className:"document-metadata-item",children:[(0,yt.jsx)("dt",{children:e}),(0,yt.jsx)("dd",{children:t})]})}function YAe({metadata:e}){let t=e.contextUsagePercent===void 0?void 0:`${e.contextUsagePercent>100?">100":e.contextUsagePercent}%${e.contextWindowSize===void 0?"":` of ${ZAe(e.contextWindowSize)}`}`;return(0,yt.jsxs)("aside",{className:"document-metadata","data-document-metadata":!0,children:[(0,yt.jsxs)("section",{children:[(0,yt.jsx)("h2",{children:"Session Info"}),(0,yt.jsxs)("dl",{children:[(0,yt.jsx)(po,{label:"Session",value:e.title??"Qwen Code Chat Export"}),(0,yt.jsx)(po,{label:"Started",value:xH(e.startedAt)}),(0,yt.jsx)(po,{label:"Exported",value:xH(e.exportedAt)}),(0,yt.jsx)(po,{label:"Project",value:e.projectName}),(0,yt.jsx)(po,{label:"Repository",value:e.repository}),(0,yt.jsx)(po,{label:"Branch",value:e.gitBranch}),(0,yt.jsx)(po,{label:"Model",value:e.model}),(0,yt.jsx)(po,{label:"Channel",value:e.channel})]})]}),(0,yt.jsxs)("section",{children:[(0,yt.jsx)("h2",{children:"Statistics"}),(0,yt.jsxs)("dl",{children:[(0,yt.jsx)(po,{label:"Prompts",value:e.promptCount}),(0,yt.jsx)(po,{label:"Context Usage",value:t}),(0,yt.jsx)(po,{label:"Tokens",value:e.totalTokens?.toLocaleString()})]})]}),(0,yt.jsxs)("section",{children:[(0,yt.jsx)("h2",{children:"File Operations"}),(0,yt.jsxs)("dl",{children:[(0,yt.jsx)(po,{label:"Files modified",value:e.filesWritten}),(0,yt.jsx)(po,{label:"Lines added",value:e.linesAdded}),(0,yt.jsx)(po,{label:"Lines removed",value:e.linesRemoved})]})]})]})}function QAe({value:e}){let[t,a]=(0,mo.useState)(XAe),[n,r]=(0,mo.useState)(!0),o=(0,mo.useRef)(n),s=(0,mo.useRef)(null);return(0,mo.useEffect)(()=>{document.documentElement.classList.toggle("dark",t==="dark"),document.documentElement.classList.toggle("light",t==="light");try{localStorage.setItem(CH,t)}catch{}},[t]),(0,mo.useEffect)(()=>{o.current=n},[n]),(0,mo.useEffect)(()=>{let i=()=>{s.current=o.current,(0,z7.flushSync)(()=>r(!0))},l=()=>{let u=s.current;s.current=null,u!==null&&(0,z7.flushSync)(()=>r(u))};return addEventListener("beforeprint",i),addEventListener("afterprint",l),()=>{removeEventListener("beforeprint",i),removeEventListener("afterprint",l)}},[]),(0,mo.useEffect)(()=>{document.title=e.metadata.title||"Qwen Code Chat Export",requestAnimationFrame(()=>{document.body.dataset.renderComplete="true"})},[e.metadata.title]),(0,yt.jsxs)("main",{className:"document-shell",children:[(0,yt.jsxs)("header",{className:"document-header",children:[(0,yt.jsxs)("div",{children:[(0,yt.jsx)("h1",{children:e.metadata.title||"Qwen Code Chat Export"}),(0,yt.jsx)("p",{children:e.metadata.startedAt?`Started ${e.metadata.startedAt}`:`Exported ${e.metadata.exportedAt}`})]}),(!e.metadata.complete||e.metadata.truncated)&&(0,yt.jsx)("span",{className:"document-warning",children:"Partial export"}),(0,yt.jsxs)("div",{className:"document-actions","aria-label":"Document controls",children:[(0,yt.jsx)("button",{type:"button","data-document-expand-all":!0,disabled:n,onClick:()=>r(!0),children:"Expand all"}),(0,yt.jsx)("button",{type:"button","data-document-collapse-all":!0,disabled:!n,onClick:()=>r(!1),children:"Collapse all"}),(0,yt.jsx)("button",{type:"button","data-document-theme-toggle":!0,"aria-label":`Switch to ${t==="dark"?"light":"dark"} theme`,onClick:()=>a(i=>i==="dark"?"light":"dark"),children:t==="dark"?"Light theme":"Dark theme"})]})]}),(0,yt.jsxs)("div",{className:"document-content",children:[(0,yt.jsx)("div",{className:"document-transcript",children:(0,yt.jsx)(kH,{blocks:e.blocks,renderMode:"document",compactThinking:!0,documentExpanded:n,theme:t})}),(0,yt.jsx)(YAe,{metadata:e.metadata})]})]})}function TH(){return(0,mo.useEffect)(()=>{document.body.dataset.renderComplete="error"},[]),(0,yt.jsxs)("main",{className:"document-error",role:"alert",children:[(0,yt.jsx)("h1",{children:"Unable to open this chat export"}),(0,yt.jsx)("p",{children:"The file is incomplete or uses an incompatible renderer version."})]})}var U7=class extends mo.Component{constructor(){super(...arguments);this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,yt.jsx)(TH,{}):this.props.children}},IH=document.getElementById("app");if(!IH)throw new Error("Transcript document root is missing.");if(document.body.dataset.renderComplete!=="error"){let e=(0,SH.createRoot)(IH);try{e.render((0,yt.jsx)(U7,{children:(0,yt.jsx)(QAe,{value:KAe()})}))}catch{e.render((0,yt.jsx)(TH,{}))}}})();
630
+ `)}function B8e(e){return e.find(t=>an(t.status))??e[e.length-1]}function F8e(e,t,a,n=!1){if(H9(e)){let o=e.filter(i=>an(i.status)&&!Os(i));if(o.length===0)return t("subagent.background");if(o.length===1&&$o(o[0].toolName))return t("toolGroup.summary.provideInformation");let s=o.map(i=>$o(i.toolName)?t("toolGroup.summary.provideInformation"):tH(i,t,a));return t("toolGroup.running",{name:s.join(" · "),count:o.length})}return z8e(e,t,n)||t("toolGroup.summary",{count:e.length})}function tH(e,t,a){if(zd(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if($o(e.toolName))return an(e.status)?t("toolGroup.summary.provideInformation"):t("toolGroup.summary.askedQuestions",{count:nH(e)});let{displayName:n,description:r,hideDisplayName:o}=aH(e,t,a);return[o?"":n,r].filter(Boolean).join(" ")}function aH(e,t,a){let n=Jc(e.toolName,t),r=tn(rU(e,a),120);return{kind:Zb(e),tool:e,displayName:n,description:r,elapsed:"",workspaceCwd:a,hideDisplayName:!!Qhe(e)}}function q8e({tool:e,workspaceCwd:t}){let{t:a}=Ze(),n=$o(e.toolName),r=an(e.status),o=Os(e),s=r&&!o&&lr(e),i=ik(s),l=!n&&r?o?a("subagent.background"):a("toolGroup.runningPrefix").trim():"";if(zd(e.toolName)||n)return(0,c.jsxs)(c.Fragment,{children:[l&&(0,c.jsxs)("span",{children:[l," "]}),tH(e,a,t)]});let u=aH(e,a,t),d=s?uU(e,a):"",f=s?{...u,description:[u.description,d&&`(${d})`].filter(Boolean).join(" "),elapsed:eH(e,i).elapsed}:u;return(0,c.jsxs)(c.Fragment,{children:[l&&(0,c.jsxs)("span",{children:[l," "]}),(0,c.jsxs)("span",{className:me.chatSummaryInline,children:[!f.hideDisplayName&&(0,c.jsx)("span",{className:me.lineName,children:f.displayName}),(0,c.jsx)(ng,{info:f})]})]})}function z8e(e,t,a){let n=a?e.filter(lr).length:0;if(n>0){let f=e.length-n;return[t("toolGroup.summary.ranAgents",{count:n}),f?t("toolGroup.summary",{count:f}):""].filter(Boolean).join(" · ")}let r=0,o=0,s=0,i=0,l=0,u=0,d=0;for(let f of e){let p=f.toolName.toLowerCase();Ns(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++:zd(p)?l++:$o(p)?u+=nH(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}):"",u?t("toolGroup.summary.askedQuestions",{count:u}):"",d?t("toolGroup.summary.otherTools",{count:d}):""].filter(Boolean).join(" ")}function nH(e){let t=e.args?.questions;return Array.isArray(t)&&t.length>0?t.length:1}function U8e(){return(0,c.jsxs)("svg",{className:me.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,c.jsx)("path",{d:"M12 20h9"}),(0,c.jsx)("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function rH(){return(0,c.jsxs)("svg",{className:me.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[(0,c.jsx)("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),(0,c.jsx)("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),(0,c.jsx)("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function j8e(){return(0,c.jsxs)("svg",{className:me.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[(0,c.jsx)("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.25"}),(0,c.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 H8e(){return(0,c.jsxs)("svg",{className:me.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[(0,c.jsx)("rect",{x:"2",y:"1.6",width:"10",height:"10.8",rx:"2.2",stroke:"currentColor",strokeWidth:"1.25"}),(0,c.jsx)("path",{d:"M4.5 5.2h5M4.5 7h5M4.5 8.8h5",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function W8e(){return(0,c.jsx)("svg",{className:me.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:(0,c.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 G8e(){return(0,c.jsx)("svg",{className:me.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:(0,c.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 N9(){return(0,c.jsx)("svg",{className:me.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:(0,c.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 oH({tool:e}){let t=Zb(e);return t==="agent"?(0,c.jsx)(N9,{}):t==="ask"?(0,c.jsx)(G8e,{}):t==="edit"||t==="write"?(0,c.jsx)(U8e,{}):t==="fetch"?(0,c.jsx)(j8e,{}):t==="read"?(0,c.jsx)(H8e,{}):t==="todo"?(0,c.jsx)(W8e,{}):(0,c.jsx)(rH,{})}function O9(e){let t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}function V8e(e,t){if(e.approval?.id!==t.approval?.id||e.workspaceCwd!==t.workspaceCwd||e.onTurnOutputOpen!==t.onTurnOutputOpen||e.onToolResultOpen!==t.onToolResultOpen||e.summaryOnly!==t.summaryOnly||e.forceExpanded!==t.forceExpanded||e.detailsVisible!==t.detailsVisible||e.hideHeader!==t.hideHeader||e.hideCollapsedOutput!==t.hideCollapsedOutput)return!1;let a=e.tool,n=t.tool;return a.callId===n.callId&&a.generatedUiToolCallId===n.generatedUiToolCallId&&a.toolName===n.toolName&&a.status===n.status&&a.subagentSessionReady===n.subagentSessionReady&&a.startTime===n.startTime&&a.endTime===n.endTime&&a.subContent===n.subContent&&a.rawOutput===n.rawOutput&&a.toolResult===n.toolResult&&a.toolDetailsRevision===n.toolDetailsRevision&&a.wasCancelled===n.wasCancelled&&a.args===n.args&&a.content===n.content&&a.locations===n.locations&&a.title===n.title&&K8e(a.subTools,n.subTools)}function K8e(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let a=0;a<e.length;a++){let n=e[a],r=t[a];if(n.callId!==r.callId||n.generatedUiToolCallId!==r.generatedUiToolCallId||n.toolName!==r.toolName||n.status!==r.status||n.subagentSessionReady!==r.subagentSessionReady||n.endTime!==r.endTime||n.rawOutput!==r.rawOutput||n.toolResult!==r.toolResult||n.toolDetailsRevision!==r.toolDetailsRevision||n.wasCancelled!==r.wasCancelled||n.args!==r.args||n.subContent!==r.subContent||n.title!==r.title)return!1}return!0}var zq=/\[([^\]]+)\]\(qwen-session:\/\/([^)]+)\)/g;function z6(e,t){if(!e||!e.includes("qwen-session://"))return e;let a=[],n=0,r;for(zq.lastIndex=0;(r=zq.exec(e))!==null;){r.index>n&&a.push(e.slice(n,r.index));let o=r[2];a.push(t!=="interactive"?(0,c.jsx)("span",{style:{textDecoration:"underline"},children:r[1]},r.index):(0,c.jsx)("a",{href:"#",role:"button",style:{textDecoration:"underline",cursor:"pointer"},onClick:s=>{s.preventDefault(),s.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:o}))},children:r[1]},r.index)),n=r.index+r[0].length}return n<e.length&&a.push(e.slice(n)),a.length===1?a[0]:(0,c.jsx)(c.Fragment,{children:a})}var D9=(0,y.memo)(function({tool:e,approval:t,workspaceCwd:a,onTurnOutputOpen:n,onToolResultOpen:r,summaryOnly:o=!1,forceExpanded:s=!1,detailsVisible:i=!0,hideHeader:l=!1,hideCollapsedOutput:u=!1}){let{t:d}=Ze(),f=Oa(),p=nk(),m=zU(),{hostOwnsEditDiffPreview:h}=Bo(),g=m!==void 0,b=bg(e.rawOutput),w=bU(b),v=s||!!b,x=t?.toolCallId===e.callId,T=!!(h&&x&&t?.hasDiffPreview&&_b(t?.toolName??e.toolName)),I=T,[L,S]=(0,y.useState)(!1),[C,E]=(0,y.useState)(()=>v||!o&&qq(e)&&!I),R=(0,y.useRef)(null),P=(0,y.useRef)(!1),N=a7(e.toolName);(0,y.useEffect)(()=>{E(v||!o&&qq(e)&&!I),S(!1),R.current=null,P.current=!1},[v,I,g,o,e.callId,e.toolName]);let q=lr(e),H=!x&&t?.toolCallId&&q&&Ds(e,t.toolCallId),z=!!(T||h&&H&&t?.hasDiffPreview&&_b(t.toolName??"")),G=an(e.status),re=G&&!Ns(e.toolName)&&!O9(e.toolName)&&!z,X=ik(re);if((0,y.useEffect)(()=>{!v&&!q&&e.status==="completed"&&!P.current&&E(!1)},[v,q,e.status]),q){let ae=eH(e,X),ge=ae.explicitAgentType?`${d("agent.label")} (${Ig(ae.explicitAgentType,d)})`:d("agent.label"),$e=e.status==="completed"||e.status==="failed",He=Os(e),Je=[He&&!$e?d("subagent.background"):e.status==="pending"?d("subagent.pending"):d("subagent.running"),He&&!$e||z?"":ae.elapsed].filter(Boolean).join(" · "),Gt=[ae.subToolCount>0?d("subagent.toolsCount",{count:ae.subToolCount}):"",ae.elapsed,ae.tokens,ae.reason?tn(ae.reason,80):""].filter(Boolean).join(" · "),at=s||C||!!H,wt=!!x,$t=yi(e),tt=(0,c.jsx)(f7,{tool:e,approval:h?t:void 0,hideHeader:!0,defaultExpanded:!0,inline:!0});if(p&&!l){let gt=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(N9,{}),(0,c.jsx)(Hp,{status:$e?ae.status:e.status}),(0,c.jsx)("span",{className:me.lineName,children:ge}),(0,c.jsx)(ng,{info:{kind:"agent",tool:e,displayName:ge,description:ae.description?tn(ae.description,60):"",elapsed:$e?Gt:Je,workspaceCwd:a}})]});return(0,c.jsx)("div",{className:me.line,"data-transcript-tool-call-id":e.callId,children:wt?(0,c.jsx)("div",{className:`${me.lineMain} ${me.lineButton}`,"aria-disabled":"true",children:gt}):(0,c.jsxs)("button",{type:"button",className:`${me.lineMain} ${me.lineExpandable} ${me.lineButton}`,"aria-disabled":!!$t||void 0,title:$t?d($t):void 0,onClick:()=>{$t||p.onOpen(e)},children:[gt,(0,c.jsx)("span",{className:me.lineChevronRight,"aria-hidden":"true"})]})})}return(0,c.jsxs)("div",{className:me.line,"data-transcript-tool-call-id":e.callId,children:[!l&&(0,c.jsxs)("div",{className:`${me.lineMain} ${wt?"":me.lineExpandable}`,"aria-disabled":!!$t||void 0,title:$t?d($t):void 0,onClick:wt||$t?void 0:()=>E(!C),children:[(0,c.jsx)(N9,{}),(0,c.jsx)(Hp,{status:$e?ae.status:e.status}),(0,c.jsx)("span",{className:me.lineName,children:ge}),(0,c.jsx)(ng,{info:{kind:"agent",tool:e,displayName:ge,description:ae.description?tn(ae.description,60):"",elapsed:$e?Gt:Je,workspaceCwd:a}}),!wt&&(0,c.jsx)("span",{className:C?me.lineChevronDown:me.lineChevronRight,"aria-hidden":"true"})]}),at&&(0,c.jsx)("div",{className:me.lineDetail,children:l?(0,c.jsx)("div",{className:me.expandedAgentCard,children:tt}):tt})]})}let V=qb(e,a),A=f==="document"&&C?au(e)??AF(e):AF(e),$=Ns(e.toolName)?rU(e,a):V,K=Jc(e.toolName,d),O=z||Ns(e.toolName)||O9(e.toolName)?"":Vp(e.startTime,G?X:e.endTime),ee=e.toolName.toLowerCase(),de=ee==="monitor"&&g&&!L&&!l,ye=zd(ee),oe=ye?xU(e):void 0,te=!!oe&&oe.length>0,le=oe?oe.filter(ae=>ae.status==="completed").length:0,J=Ns(ee),_e=ee==="grep"||ee==="grep_search"||ee==="search"||ee==="glob",xe=ee==="read"||ee==="read_file"||ee==="readfile",je=e7(ee),be=i&&(xe||_b(ee)||ee==="display_image"||ee==="zoom_image")?(0,c.jsx)(Bq,{tool:e,workspaceCwd:a,onOpen:n}):void 0,W=!ye&&$8e($),ke=!v&&!I,Ce=de||ke,ze=()=>{P.current=!0,E(ae=>!ae)},lt=()=>{S(!0),ke&&ze()},zt=()=>{m&&Jj(R,()=>m.onOpen(e),lt)},ta=v8e(e),ha=C&&W,pt=xe||je,Ie=ha&&!J&&!_e&&!xe,ne=V,Z=C&&!ta&&(!ye||!te&&!A);return(0,c.jsxs)("div",{className:me.line,"data-transcript-tool-call-id":e.callId,children:[l&&G&&O&&(0,c.jsx)("div",{className:me.lineMain,children:(0,c.jsx)(ng,{info:{kind:Zb(e),tool:e,displayName:K,description:"",elapsed:O,workspaceCwd:a}})}),!l&&(0,c.jsxs)("div",{className:`${me.lineMain} ${Ce?me.lineExpandable:""}`,title:de?void 0:ke?d(C?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":de?void 0:ke?C:void 0,role:Ce?"button":void 0,tabIndex:Ce?0:void 0,onClick:Ce?()=>{if(de){zt();return}ze()}:void 0,onKeyDown:Ce?ae=>{if(!(ae.key!=="Enter"&&ae.key!==" ")){if(ae.preventDefault(),de){zt();return}ze()}}:void 0,children:[(0,c.jsx)(oH,{tool:e}),(0,c.jsx)(Hp,{status:e.status}),(0,c.jsx)("span",{className:me.lineName,children:K}),ye&&te&&(0,c.jsxs)("span",{className:me.todoProgress,children:[le,"/",oe.length]}),(0,c.jsx)(ng,{info:{kind:Zb(e),tool:e,displayName:K,description:ye||Ie?"":$,elapsed:ye?"":O,workspaceCwd:a}}),Ce&&(0,c.jsx)("span",{className:!de&&C?me.lineChevronDown:me.lineChevronRight,"aria-hidden":"true"})]}),b&&(!o||C)&&(w?(0,c.jsx)(l8e,{display:b,toolId:e.generatedUiToolCallId,visible:i}):(0,c.jsx)(Yj,{display:b})),!b&&(!o||C)&&ye&&te&&(0,c.jsx)(R8e,{tool:e,todos:oe,expanded:C,title:K}),!b&&(!o||C)&&ye&&!te&&A&&(0,c.jsx)("div",{className:me.lineOutput,children:z6(A,f)}),!b&&Z&&(0,c.jsx)(cg,{title:K,detail:ne,status:e.status,action:be,children:A&&(0,c.jsx)("div",{className:`${me.lineOutput} ${me.expandedLineOutput}`,children:z6(A,f)})}),!b&&!ye&&!u&&A&&!Z&&(!C||!ta)&&(!o||C)&&(0,c.jsx)("div",{className:C?`${me.lineOutput} ${me.expandedLineOutput}`:me.lineOutput,children:z6(A,f)}),!b&&!ye&&C&&ta&&(!N||i)&&(0,c.jsx)("div",{className:N?`${me.lineDetail} ${me.workflowLineDetail}`:pt?`${me.lineDetail} ${me.markdownLineDetail}`:me.lineDetail,children:(0,c.jsx)(h5e,{tool:e,enabled:i&&(J||xe),children:ae=>N?(0,c.jsx)(E8e,{tool:ae,displayName:K,detail:ne,result:A}):J?(0,c.jsx)(f5e,{tool:ae}):xe?(0,c.jsx)(cg,{title:K,status:ae.status,action:i?(0,c.jsx)(Bq,{tool:ae,workspaceCwd:a,onOpen:n}):void 0,children:(0,c.jsx)(T8e,{tool:ae})}):(0,c.jsxs)(cg,{title:K,detail:ne,status:ae.status,action:be,children:[(ee==="write_file"||ee==="writefile")&&(0,c.jsx)(Fq,{tool:ae}),(ee==="edit"||ee==="write"||ee==="editfile")&&(0,c.jsx)(Fq,{tool:ae}),$o(ae.toolName)&&(0,c.jsx)(P8e,{tool:ae}),n7(ee)&&(0,c.jsx)(N8e,{tool:ae}),je&&(0,c.jsx)(wi,{content:sU(ae)??""})]})})}),e.toolResult&&(C||e.toolResult.execution_status!=="success"||e.toolResult.capture_status==="partial"||e.toolResult.capture_status==="unavailable"||e.toolResult.delivery_status!=="committed")&&(0,c.jsx)(g8e,{result:e.toolResult,onOpen:r})]})},V8e),X8e=(0,y.memo)(function({isStreaming:e,expanded:t,documentMode:a,translateContent:n,generateContent:r,onToggle:o}){let{language:s,t:i}=Ze();return(0,c.jsxs)("div",{className:`${me.chatSummaryThoughtHeader}${t?` ${me.chatSummaryThoughtHeaderExpanded}`:""}`,onClick:l=>{!a&&l.currentTarget.contains(l.target)&&o()},children:[(0,c.jsxs)("button",{type:"button",disabled:a,tabIndex:a?-1:void 0,className:me.chatSummaryThoughtSummary,"data-testid":"compact-thinking-summary","aria-expanded":a?void 0:t,title:a?void 0:i(t?"thinking.collapse":"thinking.expand"),children:[(0,c.jsx)("span",{className:me.chatSummaryThoughtIcon,"aria-hidden":"true",children:(0,c.jsx)(l7,{})}),(0,c.jsx)("span",{className:`${me.chatSummaryThoughtLabel}${e?` ${me.chatSummaryThoughtLabelActive}`:""}`,children:i(e?"thinking.running":"thinking.done")})]}),s==="zh-CN"&&n!==void 0&&r&&(0,c.jsx)(fU,{content:n,generateContent:r,className:me.chatSummaryThoughtTranslate}),(0,c.jsx)("span",{className:t?me.chatSummaryThoughtChevronDown:me.chatSummaryThoughtChevronRight,"aria-hidden":"true"})]})}),U6=(0,y.memo)(function({content:e,isStreaming:t,generateContent:a}){let n=Oa()==="document",r=Qb(),[o,s]=(0,y.useState)(!1),i=n?r:o,l=(0,y.useCallback)(()=>{n||s(u=>!u)},[n]);return(0,c.jsxs)("div",{className:me.chatSummaryThought,children:[(0,c.jsx)(X8e,{isStreaming:t,expanded:i,documentMode:n,translateContent:n||t?void 0:e,generateContent:a,onToggle:l}),i&&(0,c.jsx)("div",{className:me.chatSummaryThoughtContent,children:(0,c.jsx)(wi,{content:e,source:"thinking",isStreaming:t})})]})}),Z8e=(0,y.memo)(function({tools:e,compactSummary:t=!1,thoughts:a,pendingApproval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,isLocateFlashing:i=!1,generateContent:l}){let{t:u}=Ze(),d=Oa()==="document",f=Qb(),p=nk(),m=zU(),h=m!==void 0,[g,b]=(0,y.useState)(!1),[w,v]=(0,y.useState)(!1),x=d?f:w,T=(0,y.useRef)(null),I=H9(e),L=e.find(oe=>an(oe.status)&&!Os(oe))??(e.length>0?B8e(e):void 0),S=e.length===1?e[0]:void 0,C=!!a?.length,E=S&&lr(S)?S:void 0,R=S&&S.toolName.toLowerCase()==="monitor"?S:void 0,P=(S?bg(S.rawOutput):void 0)?.resourceUri,N=e.some(oe=>bg(oe.rawOutput)),q=e.some(oe=>a7(oe.toolName)),H=e.some(oe=>an(oe.status)&&!Os(oe)),z=a?.find(oe=>oe.isStreaming),G=I&&H?!0:z!==void 0,re=!G&&e.some(oe=>an(oe.status)&&Os(oe)),X=!!(!t&&E&&p),V=!!(!t&&R&&h&&!g),A=X||V,$=!t&&E?yi(E):void 0,K=I?L??e[0]:e[0],O=n?.toolCallId&&e.some(oe=>Ds(oe,n.toolCallId)),ee=new Map,de=new Set;for(let oe=0;t&&oe<e.length;oe++){if(!lr(e[oe]))continue;let te=oe+1;for(;te<e.length&&lr(e[te]);)te++;if(te-oe>=2){let le=e.slice(oe,te);ee.set(le[0].callId,le);for(let J of le.slice(1))de.add(J.callId)}oe=te-1}(0,y.useEffect)(()=>{b(!1),v(!1),T.current=null},[h,R?.callId]),(0,y.useEffect)(()=>{(P||N)&&v(!0)},[P,N]);let ye=()=>{!R||!m||Jj(T,()=>m.onOpen(R),()=>{b(!0),v(oe=>!oe)})};return O?(0,c.jsx)("div",{className:`${me.group}${i?` ${Ol.flash}`:""}`,children:e.map(oe=>(0,c.jsx)(D9,{tool:oe,approval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,forceExpanded:d},oe.callId))}):(0,c.jsxs)("div",{className:i?Ol.flash:void 0,children:[(0,c.jsxs)("button",{type:"button",disabled:d,"aria-disabled":!!$||void 0,tabIndex:d?-1:void 0,className:me.chatSummary,onClick:()=>{if(!(d||$)){if(X&&E&&p){p.onOpen(E);return}if(V&&R&&m){ye();return}v(oe=>!oe)}},"aria-expanded":d||A?void 0:w,title:$?u($):d||A?void 0:u(x?"tool.collapseHint":"tool.expand"),children:[(0,c.jsx)("span",{className:re?`${me.chatSummaryIcon} ${me.chatSummaryIconDetached}`:me.chatSummaryIcon,"aria-hidden":"true",children:z?(0,c.jsx)(l7,{}):K?(0,c.jsx)(oH,{tool:K}):(0,c.jsx)(rH,{})}),(0,c.jsx)("span",{className:G?`${me.chatSummaryText} ${me.chatSummaryTextActive}`:me.chatSummaryText,children:z?u("thinking.running"):S?(0,c.jsx)(q8e,{tool:S,workspaceCwd:r}):F8e(e,u,r,t)}),(0,c.jsx)("span",{className:x?me.chatChevronDown:me.chatChevronRight,"aria-hidden":"true"})]}),(x||N||q)&&(0,c.jsx)("div",{"aria-hidden":!x,ref:oe=>{oe?.toggleAttribute("inert",!x)},className:x?me.chatSummaryContentClip:`${me.chatSummaryContentClip} ${me.chatSummaryContentCollapsed}`,style:!x&&N&&!q?{display:"none"}:void 0,children:(0,c.jsx)("div",{className:me.chatSummaryContentInner,children:(0,c.jsxs)("div",{className:`${me.group} ${me.chatSummaryGroup}`,children:[e.map(oe=>{if(de.has(oe.callId))return null;let te=ee.get(oe.callId);return(0,c.jsxs)(y.Fragment,{children:[a?.filter(le=>le.beforeToolCallId===oe.callId).map((le,J)=>(0,c.jsx)(U6,{content:le.content,isStreaming:le.isStreaming,generateContent:l},`thought-${oe.callId}-${J}`)),te?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:me.chatSummaryParallelAgents,"data-testid":"compact-parallel-agents",children:(0,c.jsx)(FU,{agents:te,pendingApproval:n})}),te.slice(1).flatMap(le=>a?.filter(J=>J.beforeToolCallId===le.callId).map((J,_e)=>(0,c.jsx)(U6,{content:J.content,isStreaming:J.isStreaming,generateContent:l},`thought-${le.callId}-${_e}`)))]}):(0,c.jsx)(D9,{tool:oe,approval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,summaryOnly:!S||C,forceExpanded:d||!!S&&!C,detailsVisible:x,hideHeader:!!S&&!C})]},oe.callId)}),a?.filter(oe=>oe.beforeToolCallId===void 0).map((oe,te)=>(0,c.jsx)(U6,{content:oe.content,isStreaming:oe.isStreaming,generateContent:l},`thought-trailing-${te}`))]})})})]})}),q7="summary-",ug=e=>`${q7}${e}`,sH=e=>e.startsWith(q7),dg=e=>sH(e)?e.slice(q7.length):void 0,Y8e="_message_1ujhf_1",Q8e="_header_1ujhf_6",J8e="_headerStatic_1ujhf_7",eIe="_chevron_1ujhf_24",tIe="_title_1ujhf_30",aIe="_progress_1ujhf_39",Gc={message:Y8e,header:Q8e,headerStatic:J8e,chevron:eIe,title:tIe,progress:aIe};function nIe({id:e,todos:t}){let a=(0,y.useContext)(j9).get(e)?.events??[];return(0,c.jsx)(UU,{todos:t,events:a})}var rIe=(0,y.memo)(function({id:e,todos:t,isLocateFlashing:a=!1}){let{t:n}=Ze(),r=Oa()==="document",o=Qb(),[s,i]=(0,y.useState)(!1);if(t.length===0)return null;let l=r?o:s,u=t.length,d=t.filter(f=>f.status==="completed").length;return(0,c.jsxs)("div",{className:`${Gc.message}${a?` ${Ol.flash}`:""}`,children:[r?(0,c.jsxs)("div",{className:Gc.headerStatic,children:[(0,c.jsx)("span",{className:Gc.title,children:n("plan.title")}),(0,c.jsxs)("span",{className:Gc.progress,children:[d,"/",u]})]}):(0,c.jsxs)("button",{type:"button",className:Gc.header,onClick:()=>i(f=>!f),"aria-expanded":s,title:n(s?"todo.collapse":"todo.expand"),children:[(0,c.jsx)("span",{className:Gc.chevron,"aria-hidden":"true",children:s?"▾":"▸"}),(0,c.jsx)("span",{className:Gc.title,children:n("plan.title")}),(0,c.jsxs)("span",{className:Gc.progress,children:[d,"/",u]})]}),l?(0,c.jsx)(jU,{todos:t,numbered:!0}):(0,c.jsx)(nIe,{id:e,todos:t})]})}),oIe="_message_1abcu_1",sIe="_content_1abcu_11",iIe="_question_1abcu_17",lIe="_prefix_1abcu_24",cIe="_answer_1abcu_28",uIe="_pending_1abcu_32",dIe="_shortcuts_1abcu_36",Cd={message:oIe,content:sIe,question:iIe,prefix:lIe,answer:cIe,pending:uIe,shortcuts:dIe},fIe=(0,y.memo)(function({question:e,answer:t,isPending:a}){let{t:n}=Ze(),r=(0,y.useRef)(null),o=(0,y.useRef)(null),s=(0,y.useRef)(!0),i=(0,y.useCallback)(()=>{let l=r.current;l&&s.current&&(l.scrollTop=l.scrollHeight)},[]);return(0,y.useLayoutEffect)(i,[t,a,i]),(0,y.useEffect)(()=>{if(typeof ResizeObserver>"u")return;let l=new ResizeObserver(i);return r.current&&l.observe(r.current),o.current&&l.observe(o.current),()=>l.disconnect()},[i]),(0,c.jsxs)("div",{className:Cd.message,children:[(0,c.jsxs)("div",{ref:r,className:Cd.content,"data-web-shell-btw-content":!0,onScroll:l=>{let u=l.currentTarget;s.current=u.scrollHeight-u.clientHeight-u.scrollTop<=2},children:[(0,c.jsxs)("div",{className:Cd.question,children:[(0,c.jsx)("span",{className:Cd.prefix,children:"/btw "}),(0,c.jsx)("span",{children:e})]}),(0,c.jsx)("div",{ref:o,className:Cd.answer,children:a&&!t?(0,c.jsx)("span",{className:Cd.pending,children:n("btw.answering")}):(0,c.jsx)(wi,{content:t})})]}),(0,c.jsx)("div",{className:Cd.shortcuts,children:n(a?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),pIe="_message_1g0wi_1",mIe="_header_1g0wi_21",hIe="_status_1g0wi_30",gIe="_name_1g0wi_35",vIe="_command_1g0wi_42",yIe="_output_1g0wi_51",Fp={message:pIe,header:mIe,status:hIe,name:gIe,command:vIe,output:yIe},wIe=(0,y.memo)(function({command:e,output:t}){let{t:a}=Ze();return(0,c.jsxs)("div",{className:Fp.message,children:[(0,c.jsxs)("div",{className:Fp.header,children:[(0,c.jsx)("span",{className:Fp.status,children:"✓"}),(0,c.jsx)("span",{className:Fp.name,children:a("shell.command")}),e&&(0,c.jsx)("span",{className:Fp.command,children:e})]}),t&&(0,c.jsx)("pre",{className:Fp.output,children:t})]})}),bIe="_progress_1ik59_1",kIe="_spinner_1ik59_12",xIe="_bar_1ik59_19",SIe="_stage_1ik59_25",CIe="_icon_1ik59_29",TIe="_done_1ik59_35",IIe="_error_1ik59_43",_Ie="_detail_1ik59_51",LIe="_path_1ik59_56",AIe="_pathButton_1ik59_61",$n={progress:bIe,spinner:kIe,bar:xIe,stage:SIe,icon:CIe,done:TIe,error:IIe,detail:_Ie,path:LIe,pathButton:AIe},Uq=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function RIe({progress:e}){let{stage:t,progress:a,detail:n,isComplete:r,error:o}=e,[s,i]=(0,y.useState)(0),l=30,u=Math.round(a/100*l),d=l-u,f="█".repeat(Math.max(0,u))+"░".repeat(Math.max(0,d));return(0,y.useEffect)(()=>{if(r||o)return;let p=setInterval(()=>{i(m=>(m+1)%Uq.length)},120);return()=>clearInterval(p)},[r,o]),o?(0,c.jsxs)("div",{className:`${$n.progress} ${$n.error}`,children:[(0,c.jsx)("span",{className:$n.icon,children:"✕"}),(0,c.jsx)("span",{className:$n.stage,children:t}),(0,c.jsx)("div",{className:$n.detail,children:o})]}):r?(0,c.jsxs)("div",{className:`${$n.progress} ${$n.done}`,children:[(0,c.jsx)("span",{className:$n.icon,children:"✓"}),(0,c.jsx)("span",{className:$n.stage,children:t})]}):(0,c.jsxs)("div",{className:$n.progress,children:[(0,c.jsx)("span",{className:$n.spinner,children:Uq[s]}),(0,c.jsx)("span",{className:$n.bar,children:f}),(0,c.jsxs)("span",{className:$n.stage,children:[t,n?` (${n})`:""]})]})}function EIe({path:e,onInsightReportOpen:t}){let{t:a}=Ze();return(0,c.jsxs)("div",{className:`${$n.progress} ${$n.done}`,children:[(0,c.jsx)("span",{className:$n.icon,children:"✓"}),(0,c.jsx)("span",{className:$n.stage,children:a("insight.ready")}),t?(0,c.jsx)("button",{type:"button",className:`${$n.path} ${$n.pathButton}`,onClick:()=>t(e),children:e}):(0,c.jsx)("span",{className:$n.path,children:e})]})}var MIe=(0,y.createContext)(void 0);function PIe(e,t){return e!=="background_notification"&&e!=="mid_turn_message_injected"&&e!=="goal_runtime"&&e!=="goal_control"&&(e!=="cron"||t.trim().length>0)}function NIe(){return(0,y.useContext)(MIe)}var OIe=(0,y.memo)(function({message:e,pendingApproval:t,onShowContextDetail:a,onOpenMemoryFile:n,onLocateBackgroundSource:r,onImagePreview:o,onAttachmentPreview:s,onTurnOutputOpen:i,onToolResultOpen:l,onInsightReportOpen:u,workspaceCwd:d,showRetryHint:f=!1,onRetryClick:p,sendFailed:m=!1,onRetrySend:h,onEditUserMessage:g,onDeleteMessage:b,deleteMessageDisabled:w,onSubmitUserMessageEdit:v,onBranchSession:x,branchRecordId:T,showAssistantActions:I=!1,assistantFooterAlwaysVisible:L=!1,showAssistantBranch:S=!1,assistantFeedbackTurnId:C,assistantFeedbackPromptId:E,assistantFeedbackRating:R,onAssistantFeedbackRate:P,isLocateFlashing:N=!1,assistantTurnFooterInfo:q,turnSources:H,onSourceOpen:z,generateContent:G}){let{t:re}=Ze(),[X,V]=(0,y.useState)(!1),[A,$]=(0,y.useState)(!1),K=(0,y.useCallback)(()=>{g?.()!==!0&&V(!0)},[g]),O=(0,y.useCallback)(()=>{V(!1)},[]),ee=(0,y.useCallback)(ke=>{v&&($(!0),Promise.resolve(v(ke)).catch(()=>!1).then(Ce=>{$(!1),Ce!==!1&&V(!1)}))},[v]),de=(0,y.useMemo)(()=>x&&T?()=>x(T):void 0,[x,T]),ye=(0,y.useMemo)(()=>P&&E?ke=>P(E,C??"",ke):void 0,[P,E,C]),oe=(0,y.useContext)(U9),te=e.role==="tool_group"&&e.tools.length===1&&t7(e.tools[0])?e.tools[0]:void 0,le=te?Zhe(te):null,J=!!le||e.role==="user"||e.role==="system"&&e.source==="mid_turn_message_injected",_e=NIe(),xe=(()=>{switch(e.role){case"user":return(0,c.jsx)(tU,{content:e.content,images:e.images,files:e.files,inputAnnotations:e.inputAnnotations,isLocateFlashing:N,sendFailed:m,onRetrySend:h,editing:X,submittingEdit:A,onEditSubmit:ee,onEditCancel:O,onImagePreview:o,onAttachmentPreview:s,author:e.author});case"assistant":return(0,c.jsx)(vge,{content:e.content,author:e.author,agentMessage:e.agentMessage,isStreaming:e.isStreaming,timestamp:e.timestamp,onBranchSession:de,showFooterActions:I,footerAlwaysVisible:L,showBranchAction:S,showAssistantFeedback:E!==void 0,assistantFeedbackRating:R,onAssistantFeedbackRate:ye,isLocateFlashing:N,customFooterInfo:q,turnSources:H,onSourceOpen:z});case"thinking":return(0,c.jsx)(xge,{content:e.content,author:e.author,isStreaming:e.isStreaming,timestamp:e.timestamp,isLocateFlashing:N,generateContent:G});case"tool_group":return te&&!le&&!au(te)?.trim()?null:le&&te?!le.answers.length&&!le.text.trim()?null:(0,c.jsx)(Vhe,{tool:te,result:le,isLocateFlashing:N}):(0,c.jsx)(Z8e,{tools:e.tools,onTurnOutputOpen:i,onToolResultOpen:l,thoughts:e.thoughts,compactSummary:oe&&sH(e.id),pendingApproval:t,workspaceCwd:d,isLocateFlashing:N,generateContent:G});case"plan":return(0,c.jsx)(rIe,{id:e.id,todos:e.todos,isLocateFlashing:N});case"system":return(0,c.jsx)(Nxe,{content:e.content,variant:e.variant,source:e.source,data:e.data,images:e.images,files:e.files,onShowContextDetail:a,onOpenMemoryFile:n,onLocateBackgroundSource:r,onImagePreview:o,onAttachmentPreview:s,showRetryHint:f&&e.retryable===!0,onRetryClick:p});case"user_shell":return(0,c.jsx)(wIe,{command:e.command,output:e.output});case"btw":return(0,c.jsx)(fIe,{question:e.question,answer:e.answer,isPending:e.isPending});case"insight_progress":return(0,c.jsx)(RIe,{progress:{stage:e.stage,progress:e.progress,detail:e.detail}});case"insight_ready":return(0,c.jsx)(EIe,{path:e.path,onInsightReportOpen:u});case"insight_error":return(0,c.jsx)("div",{style:{color:"var(--error-color, #e06c75)"},children:e.error});default:return null}})();if(xe===null)return null;let je=(0,c.jsx)($d,{label:`message:${e.role}`,resetKeys:[e],fallback:(0,c.jsx)(DIe,{align:J?"end":"start"}),children:xe}),be=(0,c.jsx)("div",{"data-user-selectable":"true",style:{display:"contents"},children:je});if(e.role==="assistant")return I?be:(0,c.jsx)(t9,{timestamp:e.timestamp,children:be});if(e.role==="system"&&e.source==="prompt_cancelled")return be;let W=_e&&e.role==="user"&&PIe(e.source,e.content)?e.id:void 0;return(0,c.jsx)(t9,{timestamp:e.timestamp,hideTimestamp:e.role==="system"&&(e.source==="background_task_completed"||e.source==="background_notification_turn_started"),chatMode:J,toolGroupSpacing:e.role==="tool_group"&&oe,copyText:J&&"content"in e?e.content:void 0,copyTitle:re("common.copy"),onEdit:g&&!X?K:void 0,editTitle:re("userMessage.edit"),onDelete:b,deleteDisabled:w,deleteTitle:re("messageDelete.entry"),onOpenTurnCalls:_e&&W?()=>_e(W):void 0,turnCallsTitle:re("turnCalls.open"),children:be})},$Ie);function DIe({align:e}){let{t}=Ze();return(0,c.jsx)("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:(0,c.jsx)("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function $Ie(e,t){return e.pendingApproval?.id!==t.pendingApproval?.id||e.onShowContextDetail!==t.onShowContextDetail||e.onOpenMemoryFile!==t.onOpenMemoryFile||e.onLocateBackgroundSource!==t.onLocateBackgroundSource||e.onImagePreview!==t.onImagePreview||e.onAttachmentPreview!==t.onAttachmentPreview||e.onTurnOutputOpen!==t.onTurnOutputOpen||e.onToolResultOpen!==t.onToolResultOpen||e.workspaceCwd!==t.workspaceCwd||e.showRetryHint!==t.showRetryHint||e.onRetryClick!==t.onRetryClick||e.sendFailed!==t.sendFailed||e.onRetrySend!==t.onRetrySend||e.onEditUserMessage!==t.onEditUserMessage||e.onDeleteMessage!==t.onDeleteMessage||e.deleteMessageDisabled!==t.deleteMessageDisabled||e.onSubmitUserMessageEdit!==t.onSubmitUserMessageEdit||e.onInsightReportOpen!==t.onInsightReportOpen||e.onBranchSession!==t.onBranchSession||e.branchRecordId!==t.branchRecordId||e.showAssistantActions!==t.showAssistantActions||e.assistantFooterAlwaysVisible!==t.assistantFooterAlwaysVisible||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||!BIe(e.assistantTurnFooterInfo,t.assistantTurnFooterInfo)?!1:qIe(e.message,t.message)}function BIe(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 FIe(e,t){return e===t?!0:!e||!t?!1:e.status===t.status&&e.error===t.error&&e.totalTokens===t.totalTokens&&e.squadOutcome===t.squadOutcome&&e.author?.squadName===t.author?.squadName&&e.author?.memberSquadName===t.author?.memberSquadName&&(e.steps??[]).length===(t.steps??[]).length&&(e.steps??[]).every((a,n)=>a.title===t.steps?.[n]?.title&&a.status===t.steps?.[n]?.status)}function qIe(e,t){if(e===t)return!0;if(e.id!==t.id||e.role!==t.role||e.timestamp!==t.timestamp||e.author?.name!==t.author?.name||e.author?.color!==t.author?.color)return!1;switch(e.role){case"user":return t.role==="user"&&e.content===t.content&&e.source===t.source&&Hq(e.images,t.images);case"assistant":return t.role==="assistant"&&e.content===t.content&&e.isStreaming===t.isStreaming&&FIe(e.agentMessage,t.agentMessage);case"thinking":return t.role==="thinking"&&e.content===t.content&&e.isStreaming===t.isStreaming;case"system":return t.role==="system"&&e.content===t.content&&e.variant===t.variant&&e.retryable===t.retryable&&e.source===t.source&&e.data===t.data&&Hq(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"&&zIe(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&UIe(e.thoughts,t.thoughts)&&e.tools.length===t.tools.length&&e.tools.every((a,n)=>iH(a,t.tools[n]));default:return!1}}function zIe(e,t){return e.length===t.length&&e.every((a,n)=>{let r=t[n];return r&&a.id===r.id&&a.content===r.content&&a.status===r.status&&a.priority===r.priority})}function iH(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&&vi(e.args)===vi(t.args)&&vi(e.rawOutput)===vi(t.rawOutput)&&vi(e.toolResult)===vi(t.toolResult)&&e.wasCancelled===t.wasCancelled&&vi(e.locations)===vi(t.locations)&&vi(e.content)===vi(t.content)&&jIe(e.subTools,t.subTools):!1}function UIe(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((a,n)=>a.content===t[n]?.content&&a.isStreaming===t[n]?.isStreaming&&a.beforeToolCallId===t[n]?.beforeToolCallId)}function jIe(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((a,n)=>iH(a,t[n]))}var jq=new WeakMap;function Hq(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((a,n)=>a.data===t[n].data&&a.mimeType===t[n].mimeType)}function vi(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=jq.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return jq.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}function Wq({additions:e,deletions:t,className:a,additionsClassName:n,deletionsClassName:r}){return e===void 0||t===void 0?null:(0,c.jsxs)("span",{className:a,children:[(0,c.jsxs)("span",{className:n,children:["+",e]}),(0,c.jsxs)("span",{className:r,children:["-",t]})]})}function HIe(e){if(!e.some(t=>t.additions===void 0||t.deletions===void 0))return e.reduce((t,a)=>({additions:t.additions+(a.additions??0),deletions:t.deletions+(a.deletions??0)}),{additions:0,deletions:0})}var WIe="_root_5t6kl_1",GIe="_card_5t6kl_7",VIe="_summary_5t6kl_15",KIe="_icon_5t6kl_23",XIe="_iconSvg_5t6kl_34",ZIe="_title_5t6kl_40",YIe="_artifactTitle_5t6kl_47",QIe="_reviewSummary_5t6kl_53",JIe="_reviewSummaryWithStats_5t6kl_60",e_e="_reviewMeta_5t6kl_65",t_e="_linkButton_5t6kl_72",a_e="_reviewButton_5t6kl_73",n_e="_showMoreButton_5t6kl_74",r_e="_actions_5t6kl_103",o_e="_openButtonWrapper_5t6kl_109",s_e="_list_5t6kl_133",i_e="_fileRow_5t6kl_140",l_e="_path_5t6kl_160",c_e="_lineStats_5t6kl_169",u_e="_additions_5t6kl_178",d_e="_deletions_5t6kl_182",f_e="_chevronIcon_5t6kl_196",p_e="_chevronIconOpen_5t6kl_204",m_e="_artifactInfo_5t6kl_208",h_e="_artifactMeta_5t6kl_213",g_e="_artifactSummary_5t6kl_222",St={root:WIe,card:GIe,summary:VIe,icon:KIe,iconSvg:XIe,title:ZIe,artifactTitle:YIe,reviewSummary:QIe,reviewSummaryWithStats:JIe,reviewMeta:e_e,linkButton:t_e,reviewButton:a_e,showMoreButton:n_e,actions:r_e,openButtonWrapper:o_e,list:s_e,fileRow:i_e,path:l_e,lineStats:c_e,additions:u_e,deletions:d_e,chevronIcon:f_e,chevronIconOpen:p_e,artifactInfo:m_e,artifactMeta:h_e,artifactSummary:g_e},$9=3;function Gq(e,t){return t?e:e.slice(0,$9)}function v_e({turnId:e,changes:t,artifacts:a,sourceSessionId:n,scheduledTasks:r,workspaceCwd:o,onOpenRequest:s,onReviewChanges:i,onOpenArtifact:l,onOpenScheduledTask:u,onError:d}){let{t:f}=Ze(),{filterArtifact:p}=Bo(),m=p?a.filter(N=>p(N,{turnId:e,sourceSessionId:n})):a,h=Qj(o),g=h?.actions,[b,w]=(0,y.useState)(!1),[v,x]=(0,y.useState)(!1);if(t.length===0&&m.length===0&&r.length===0)return null;let T=Gq(t,b),I=t.length-$9,L=Gq(m,v),S=m.length-$9,C=HIe(t),E=N=>{if(s){s({id:"review",kind:"review",title:f("turnOutputs.review"),turnId:e,changes:t,...o?{workspaceCwd:o}:{},...h?.workspaceId?{workspaceId:h.workspaceId}:{},...N?{selectedPath:N}:{}});return}i(t,N)},R=N=>{let q=x_e(N,t,o);if(s){s({id:`artifact:${N.id}`,kind:"artifact",title:Tz(N),turnId:e,artifactId:N.id,...N.managedId?{managedId:N.managedId}:{},artifact:N,...o?{workspaceCwd:o}:{},...h?.workspaceId?{workspaceId:h.workspaceId}:{},...q!==void 0?{previewContent:q}:{}});return}l(N.id,q)},P=N=>{if(s){s({id:`scheduled-task:${N.toolCallId}`,kind:"scheduled_task",title:f("scheduledTasks.title"),turnId:e,task:h?.workspaceId?{...N,workspaceId:h.workspaceId}:N,...o?{workspaceCwd:o}:{},...h?.workspaceId?{workspaceId:h.workspaceId}:{}});return}u(N)};return(0,c.jsxs)("div",{className:St.root,children:[t.length>0&&(0,c.jsxs)("div",{className:St.card,children:[(0,c.jsxs)("div",{className:St.summary,children:[(0,c.jsx)("span",{className:St.icon,"aria-hidden":"true",children:(0,c.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",focusable:"false",className:St.iconSvg,children:[(0,c.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),(0,c.jsx)("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,c.jsx)("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),(0,c.jsxs)("div",{className:[St.reviewSummary,C?St.reviewSummaryWithStats:""].filter(Boolean).join(" "),children:[(0,c.jsx)("div",{className:St.title,children:f("turnOutputs.filesEdited",{count:t.length})}),(0,c.jsxs)("div",{className:St.reviewMeta,children:[(0,c.jsx)(Wq,{additions:C?.additions,deletions:C?.deletions,className:St.lineStats,additionsClassName:St.additions,deletionsClassName:St.deletions}),(0,c.jsxs)("button",{type:"button",className:St.linkButton,onClick:()=>E(),children:[f("turnOutputs.viewChanges")," ↗"]})]})]}),(0,c.jsx)("div",{className:St.actions,children:(0,c.jsx)("button",{type:"button",className:St.reviewButton,onClick:()=>E(),children:f("turnOutputs.review")})})]}),(0,c.jsxs)("div",{className:St.list,children:[T.map(N=>(0,c.jsxs)("button",{type:"button",className:St.fileRow,onClick:()=>E(N.path),title:N.path,children:[(0,c.jsx)("span",{className:St.path,children:A_e(N.path,o)}),(0,c.jsx)(Wq,{additions:N.additions,deletions:N.deletions,className:St.lineStats,additionsClassName:St.additions,deletionsClassName:St.deletions})]},`${N.toolCallId}:${N.path}`)),I>0&&(0,c.jsxs)("button",{type:"button",className:St.showMoreButton,onClick:()=>w(N=>!N),children:[(0,c.jsx)("span",{children:b?f("turnOutputs.collapseFiles"):f("turnOutputs.showMoreFiles",{count:I})}),(0,c.jsx)(Vq,{open:b})]})]})]}),L.map(N=>{let q=__e(N);return(0,c.jsx)(y_e,{artifact:N,externalUrl:q,onOpen:q||!lH(N)?void 0:()=>R(N),onError:d,onDownload:I_e(N)&&g?H=>Gue(g,N.workspacePath,N.mimeType,H):void 0},N.id)}),S>0&&(0,c.jsxs)("button",{type:"button",className:St.showMoreButton,onClick:()=>x(N=>!N),children:[(0,c.jsx)("span",{children:v?f("turnOutputs.collapseArtifacts"):f("turnOutputs.showMoreArtifacts",{count:S})}),(0,c.jsx)(Vq,{open:v})]}),r.map(N=>(0,c.jsx)(w_e,{task:N,scheduleLabel:Az(N.cron,f),onOpen:()=>P(N)},N.toolCallId))]})}function y_e({artifact:e,externalUrl:t,onOpen:a,onDownload:n,onError:r}){let{t:o}=Ze(),s=Jb(),[i,l]=(0,y.useState)(!1),u=(0,y.useRef)(!0);(0,y.useEffect)(()=>(u.current=!0,()=>{u.current=!1}),[]);let d=zue(e.sizeBytes),f=L_e(e,o),p=Tz(e),m=async()=>{if(!(!n||i)){l(!0);try{await n(()=>!u.current)}catch(g){if(!u.current)return;let b=o("common.downloadFailed",{message:Eb(g)});r?r(new Error(b,{cause:g}),b):console.error(b,g)}finally{l(!1)}}},h=(0,c.jsx)(nl,{size:16,strokeWidth:1.8,"aria-hidden":"true"});return(0,c.jsx)("div",{className:St.card,children:(0,c.jsxs)("div",{className:`${St.summary} ${St.artifactSummary}`,children:[(0,c.jsx)("span",{className:St.icon,"aria-hidden":"true",children:(0,c.jsx)(Zue,{artifact:e,className:St.iconSvg})}),(0,c.jsxs)("div",{className:St.artifactInfo,children:[(0,c.jsx)("div",{className:`${St.title} ${St.artifactTitle}`,children:p}),(0,c.jsx)("div",{className:St.artifactMeta,children:[e.metadata?.artifactType==="web_preview_snapshot"?o("webPreview.saved"):que(e),d,e.status==="changed"&&o("turnOutputs.artifactChanged")].filter(Boolean).join(" · ")})]}),(0,c.jsxs)("div",{className:St.actions,children:[n&&(0,c.jsxs)("button",{type:"button",className:St.reviewButton,onClick:()=>void m(),title:`${o("common.download")} ${p}`,disabled:i,children:[(0,c.jsx)(Eh,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),o(i?"common.downloading":"common.download")]}),(0,c.jsx)("span",{className:St.openButtonWrapper,title:f??p,children:t?(0,c.jsxs)("a",{className:St.reviewButton,href:t,target:"_blank",rel:"noopener noreferrer",onClick:g=>s(g,t),children:[h,o("common.open")]}):(0,c.jsxs)("button",{type:"button",className:St.reviewButton,onClick:a,disabled:!a,children:[h,o("common.open")]})})]})]})})}function w_e({task:e,scheduleLabel:t,onOpen:a}){let{t:n}=Ze();return(0,c.jsx)("div",{className:St.card,children:(0,c.jsxs)("div",{className:St.summary,children:[(0,c.jsx)("span",{className:St.icon,"aria-hidden":"true",children:(0,c.jsx)(b_e,{})}),(0,c.jsxs)("div",{className:St.artifactInfo,children:[(0,c.jsx)("div",{className:St.title,children:e.title}),(0,c.jsx)("div",{className:St.artifactMeta,children:[t,e.recurring?n("scheduledTasks.repeats"):n("scheduledTasks.runsOnce")].filter(Boolean).join(" · ")})]}),(0,c.jsx)("div",{className:St.actions,children:(0,c.jsx)("button",{type:"button",className:St.reviewButton,onClick:a,title:e.title,children:n("common.open")})})]})})}function b_e(){return(0,c.jsxs)("svg",{className:St.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[(0,c.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),(0,c.jsx)("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Vq({open:e}){return(0,c.jsx)("svg",{className:[St.chevronIcon,e?St.chevronIconOpen:""].filter(Boolean).join(" "),viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:(0,c.jsx)("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}var k_e=(0,y.memo)(v_e);function x_e(e,t,a){if(!C_e(e)||!e.workspacePath)return;let n=t.find(r=>Vue(r.path,e.workspacePath,a));if(n)return S_e(n)}function S_e(e){for(let t=e.diffs.length-1;t>=0;t--){let a=e.diffs[t];if(a?.fullContent)return a.newText}}function C_e(e){let t=e.workspacePath?.toLowerCase()??"",a=e.mimeType?.toLowerCase()??"";return e.kind==="html"||T_e(t)||a==="text/html"||a==="text/markdown"}function T_e(e){let t=e.toLowerCase();return t.endsWith(".html")||t.endsWith(".htm")||t.endsWith(".md")||t.endsWith(".markdown")||a9(t)!==void 0}function I_e(e){return e.storage==="workspace"&&(e.status==="available"||e.status==="changed")&&!!e.workspacePath}function lH(e){return e.storage!=="workspace"?!0:e.status==="available"||e.status==="changed"}function __e(e){if(e.kind!=="link"||e.storage==="published")return;let t=e.url?.trim();return Z9(t)?t:void 0}function L_e(e,t){if(!lH(e))return e.workspacePath?t("turnOutputs.artifactUnavailable",{path:e.workspacePath}):t("turnOutputs.artifactMissing")}function A_e(e,t){return n9(e,t)}function R_e(e,t){let[a,n]=(0,y.useState)(!1);return(0,y.useLayoutEffect)(()=>{let r=e.current;if(!r||!t){n(!1);return}let o=r.closest("[data-history-viewport]")??r,s=()=>{let d=getComputedStyle(r),f=Number.parseFloat(d.getPropertyValue("--chat-regular-content-width"))||1e3;n(d.getPropertyValue("--chat-content-width").trim()!=="100%"&&o.getBoundingClientRect().width>=f+128)};s();let i=typeof ResizeObserver>"u"?null:new ResizeObserver(s);i?.observe(o);let l=r.closest("[data-web-shell-root]"),u=new MutationObserver(s);return l&&u.observe(l,{attributes:!0,attributeFilter:["style"]}),()=>{i?.disconnect(),u.disconnect()}},[e,t]),a}var E_e="_collapseRow_d7f01_1",M_e="_collapseRowClickable_d7f01_14",P_e="_collapseLabel_d7f01_19",N_e="_processedLabel_d7f01_36",O_e="_processedMeta_d7f01_43",D_e="_hiddenMetrics_d7f01_47",$_e="_summaryMetrics_d7f01_51",B_e="_collapseIcon_d7f01_59",F_e="_chevronRight_d7f01_72",q_e="_chevronDown_d7f01_73",Ps={collapseRow:E_e,collapseRowClickable:M_e,collapseLabel:P_e,processedLabel:N_e,processedMeta:O_e,hiddenMetrics:D_e,summaryMetrics:$_e,collapseIcon:B_e,chevronRight:F_e,chevronDown:q_e},z_e="_list_mrow6_1",U_e="_listWithWelcomeHeader_mrow6_12",j_e="_historyStatus_mrow6_32",H_e="_historyRetryButton_mrow6_38",W_e="_virtualSizer_mrow6_64",G_e="_virtualRow_mrow6_73",V_e="_loadingSkeleton_mrow6_83",K_e="_srOnly_mrow6_91",X_e="_loadingSkeletonUserRow_mrow6_103",Z_e="_loadingSkeletonAssistantRow_mrow6_109",Y_e="_loadingSkeletonUserBubble_mrow6_115",Q_e="_loadingSkeletonUserBubbleCompact_mrow6_116",J_e="_loadingSkeletonAssistantBlock_mrow6_130",eLe="_loadingSkeletonLineWide_mrow6_138",tLe="_loadingSkeletonLineMedium_mrow6_139",aLe="_loadingSkeletonLineShort_mrow6_140",nLe="_loadingSkeletonLineNarrow_mrow6_141",rLe="_turnStatusRow_mrow6_181",oLe="_turnAnswerRow_mrow6_182",sLe="_turnContentRow_mrow6_193",iLe="_sessionTimelineLayer_mrow6_197",lLe="_sessionTimelinePanel_mrow6_210",cLe="_sessionTimelineViewport_mrow6_226",uLe="_sessionTimelineList_mrow6_275",dLe="_sessionTimelineItem_mrow6_285",fLe="_sessionTimelineButton_mrow6_290",pLe="_sessionTimelineTick_mrow6_310",mLe="_sessionTimelineButtonInRange_mrow6_400",hLe="_sessionTimelineButtonCurrent_mrow6_404",gLe="_sessionTimelineDetails_mrow6_415",vLe="_sessionTimelineDetailsTitle_mrow6_453",yLe="_sessionTimelineDetailsIcon_mrow6_460",wLe="_sessionTimelineDetailsTitleText_mrow6_472",bLe="_sessionTimelineDetailsDetail_mrow6_482",kLe="_deletionMode_mrow6_501",xLe="_deletionCheckbox_mrow6_507",At={list:z_e,listWithWelcomeHeader:U_e,historyStatus:j_e,historyRetryButton:H_e,virtualSizer:W_e,virtualRow:G_e,loadingSkeleton:V_e,srOnly:K_e,loadingSkeletonUserRow:X_e,loadingSkeletonAssistantRow:Z_e,loadingSkeletonUserBubble:Y_e,loadingSkeletonUserBubbleCompact:Q_e,loadingSkeletonAssistantBlock:J_e,loadingSkeletonLineWide:eLe,loadingSkeletonLineMedium:tLe,loadingSkeletonLineShort:aLe,loadingSkeletonLineNarrow:nLe,turnStatusRow:rLe,turnAnswerRow:oLe,turnContentRow:sLe,sessionTimelineLayer:iLe,sessionTimelinePanel:lLe,sessionTimelineViewport:cLe,sessionTimelineList:uLe,sessionTimelineItem:dLe,sessionTimelineButton:fLe,sessionTimelineTick:pLe,sessionTimelineButtonInRange:mLe,sessionTimelineButtonCurrent:hLe,sessionTimelineDetails:gLe,sessionTimelineDetailsTitle:vLe,sessionTimelineDetailsIcon:yLe,sessionTimelineDetailsTitleText:wLe,sessionTimelineDetailsDetail:bLe,deletionMode:kLe,deletionCheckbox:xLe},j6=()=>{},SLe=15e3,H6=180,CLe=400,Kq=5e3;function TLe(e,t){if(!e||e.length!==t.length||t.length===0)return!1;for(let r=0;r<t.length-1;r+=1)if(e[r]!==t[r])return!1;let a=e[e.length-1],n=t[t.length-1];return a.id!==n.id||a.role!==n.role||n.role!=="assistant"&&n.role!=="thinking"||a.role!=="assistant"&&a.role!=="thinking"||a.isStreaming!==!0||n.isStreaming!==!0?!1:a.role==="assistant"&&n.role==="assistant"?typeof a.content!="string"||typeof n.content!="string"?!1:a.branchRecordId===n.branchRecordId&&a.usage===n.usage&&!!a.content.trim()==!!n.content.trim():a.role==="thinking"&&n.role==="thinking"}function Xq(e,t){return e.length===t.length&&e.every((a,n)=>Object.is(a,t[n]))}function ILe(e){for(let t=e.length-1;t>=0;t--){let a=e[t];if(a?.role==="user")return a.id}return null}function _Le(e){return e[e.length-1]}function LLe(e){for(let t=e.length-1;t>=0;t--){let a=e[t];if(a&&Qr(a))return a.id}return null}function ALe(e,t){return e.role!=="tool_group"?!1:!!(t?.toolCallId&&e.tools.some(a=>Ds(a,t.toolCallId)))}function B9(e){return t7(e)||!!bg(e.rawOutput)}function Zq(e){let t=[],a=!1;for(let n of e){if(n.role!=="tool_group"||n.tools.length<2||!n.tools.some(B9)){t.push(n);continue}a=!0;let r=[],o=0,s=i=>{i.length!==0&&t.push({...n,id:o++===0?n.id:`${n.id}-${i[0].callId}`,tools:i})};for(let i of n.tools)B9(i)?(s(r),r=[],s([i])):r.push(i);s(r)}return a?t:e}function RLe(e,t){let a=[],n=0,r=o=>o.role==="tool_group"&&!ALe(o,t)&&!o.tools.some(B9);for(;n<e.length;){let o=e[n];if(o.role!=="thinking"&&!r(o)){a.push(o),n++;continue}let s=[],i=n-1,l=n;for(;l<e.length;){let p=e[l];if(p.role==="thinking"||r(p)){s.push(p),i=l,l++;continue}break}let u=s.filter(p=>p.role==="tool_group").flatMap(p=>p.tools);if(u.length===0||s.length<=1||s.length>=2&&s.every(Q6)){for(let p of s)a.push(p);n=i+1;continue}let d=[],f=[];for(let p of s)if(p.role==="thinking"){let m={content:p.content,...p.isStreaming===!0?{isStreaming:!0}:{}};d.push(m),f.push(m)}else if(p.role==="tool_group"&&p.tools.length>0){let m=p.tools[0].callId;for(let h of f)h.beforeToolCallId=m;f.length=0}a.push({id:ug(s[0].id),role:"tool_group",tools:u,...d.length>0?{thoughts:d}:{},timestamp:s[0].timestamp}),n=i+1}return a}function ELe(e,t){let a=e[e.length-1];if(a?.role!=="tool_group"||dg(a.id)===void 0||!a.thoughts?.length)return;let n=a.thoughts[a.thoughts.length-1];if(n?.isStreaming!==!0)return;let r=a.thoughts.slice();r[r.length-1]={...n,content:t.content,isStreaming:!0};let o=e.slice();return o[o.length-1]={...a,thoughts:r,...a.id===ug(t.id)?{timestamp:t.timestamp}:{}},o}function MLe(e){if(e.role==="assistant"||e.role==="thinking")return e.isStreaming?{...e,isStreaming:!1}:e;if(e.role!=="tool_group"||!e.thoughts?.length)return e;let t=!1,a=e.thoughts.map(n=>n.isStreaming?(t=!0,{...n,isStreaming:!1}):n);return t?{...e,thoughts:a}:e}function Yq(e){if(e.role==="assistant"||e.role==="thinking")return e.content;if(e.role==="tool_group"&&e.thoughts?.length)return JSON.stringify(e.thoughts.map(t=>t.content))}function Qq(e,t){let a=e.get(t);if(a!==void 0)return a;let n=MLe(t);return e.set(t,n),n}function cH(e){return vce(fAe(e))}function bb(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 PLe(e,t,a,n,r){if((!a||a.size===0)&&(!n||n.size===0)&&(!r||r.size===0))return e;let o=[],s=null,i=(l,u)=>{if(u&&t||!l)return;let d=a?.get(l)??[],f=n?.get(l)??[],p=r?.get(l)??[];if(d.length===0&&f.length===0&&p.length===0)return;let m=o.length;for(let 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 NLe(e,t){let a=s=>s.type==="parallel_agents"&&(t?.has(s.key)===!0||s.agents.some(i=>an(i.status)));if(!e.some(s=>a(s)))return e;let n=[],r=[],o=()=>{n.push(...r),r=[]};for(let s of e)s.type==="message"&&Qr(s.message)?(o(),n.push(s)):a(s)?r.push(s):n.push(s);return o(),n}function uH(e){return e.type==="message"&&e.message.role==="assistant"&&e.message.agentMessage?.kind==="agent_message"}function dH(e,t){return e.type==="message"&&!uH(e)&&(e.message.role==="assistant"||t&&e.message.role==="system"&&e.message.source==="background_notification")&&!!e.message.content&&e.message.content.trim().length>0}function mk(e,t,a,n=!0){let r=!1;for(let o=a;o>t;o--){let s=e[o];if(s.type==="message"&&s.message.role==="system"&&s.message.source==="background_notification_turn_started")r=!1;else if(ZLe(s))r=!0;else if(!r&&dH(s,n))return o}return-1}function OLe(e,{isResponding:t,latestTurnAwaitsAgentSummary:a,gateBackgroundAgentStatus:n}){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||n&&a)||n&&hH(e,i,l))continue;let u=e[i],d=mk(e,i,l,!1);if(d<0)continue;let f=e[d];u?.type==="message"&&f.type==="message"&&f.message.role==="assistant"&&o.set(f.message.id,u.message.id)}return o}function Jq(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(t7);case"plan":return!0;case"assistant":return!t&&!uH(e);case"thinking":return!0;case"system":return e.message.source==="background_notification"?!t:e.message.source==="background_notification_turn_started"||e.message.source==="background_task_completed"||e.message.source==="vision_bridge_notice";case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return!1;default:return e.message,!1}}function fH(e){return e.source==="mid_turn_message_injected"}function DLe(e,t){if(e.type==="parallel_agents")return{kind:"agents",timestamp:e.timestamp,label:t?t("timeline.parallelAgents"):"Parallel agents"};if(e.type==="turn_outputs")return{kind:"none"};if(e.type!=="message")return{kind:"none"};let{message:a}=e;switch(a.role){case"thinking":return{kind:"thought",timestamp:a.timestamp,label:t?t("timeline.thinking"):"Thinking"};case"assistant":return e.turnCollapse?{kind:"none",timestamp:a.timestamp}:qd(a.content,1)?{kind:"commentary",timestamp:a.timestamp,label:t?t("timeline.assistantUpdate"):"Assistant update"}:{kind:"none",timestamp:a.timestamp};case"tool_group":{let n=a.tools.length;return{kind:"tool",timestamp:a.timestamp,label:t?t("timeline.toolCalls",{count:n}):`${n} tool call${n===1?"":"s"}`}}case"plan":return{kind:"plan",timestamp:a.timestamp,label:t?t("timeline.planUpdate"):"Plan update"};case"system":return fH(a)?{kind:"status",timestamp:a.timestamp,label:t?t("timeline.statusUpdate"):"Status update"}:{kind:"none",timestamp:a.timestamp};case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return{kind:"none",timestamp:a.timestamp};default:return{kind:"none"}}}function qd(e,t,a={}){let n=(a.stripMarkdown===!0?$Le(e):e??"").replace(/\s+/g," ").trim();if(t<=0||!n)return"";let r=Array.from(n);return r.length>t?`${r.slice(0,t-1).join("")}…`:n}function $Le(e){if(!e)return"";let t=[],a=r=>{let o=`\0${t.length}\0`;return t.push(r),o},n=e.replace(/```[^\n`]*\n?([\s\S]*?)```/g,(r,o)=>a(o)).replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`\n]+)`/g,(r,o)=>a(o)).replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"");n=W6(n,"~~"),n=W6(n,"**"),n=W6(n,"__"),n=n.replace(/\*([^*\s][^*]*?\S)\*/g,"$1").replace(/(^|[^\p{L}\p{N}_])_([^_\s][^_]*?\S)_(?=$|[^\p{L}\p{N}_])/gu,"$1$2");for(let[r,o]of t.entries())n=n.split(`\0${r}\0`).join(o);return n}function W6(e,t){let a="",n=0;for(;n<e.length;){let r=e.indexOf(t,n);if(r===-1)return a+e.slice(n);let o=r+t.length,s=e.indexOf(t,o);if(s===-1)return a+e.slice(n);let i=e.slice(o,s);a+=i.trim().length===0?e.slice(n,s+t.length):e.slice(n,r)+i,n=s+t.length}return a}function BLe(e,t){let a=e.role==="user"?e.content:e.role==="user_shell"?e.command:"";return qd(a,32)||(t?t("timeline.userTurn"):"User turn")}function FLe(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function Qr(e){return e.role==="user"||e.role==="user_shell"}function qLe(e,t){if(!t.startsWith("msg:"))return;let a=t.slice(4);a=dg(a)??a;for(let n=e.length-1;n>=0;n--)if(e[n]?.id===a){for(let r=n;r>=0;r--){let o=e[r];if(o&&Qr(o))return o.id}return}}function zLe(e,t){for(let a of e)if(a.type==="turn_collapse"&&a.turnCollapse.turnId===t)return a.turnCollapse.collapsed;return!1}function ULe(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return qd(e.content,120,{stripMarkdown:!0});case"tool_group":{let a=e.tools.length;return t?t("timeline.toolCalls",{count:a}):`${a} tool call${a===1?"":"s"}`}case"plan":return t?t("timeline.planDetail"):"plan update";case"system":return fH(e)?qd(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 jLe(e,t){if(e.type==="parallel_agents"){let a=e.agents.length;return t?t("timeline.parallelAgentsDetail",{count:a}):`${a} parallel agent${a===1?"":"s"}`}return e.type==="turn_outputs"||e.type!=="message"?"":ULe(e.message,t)}function HLe(e,t){return t?t(`timeline.kind.${e}`):TAe[e]}function WLe(e,t,a,n){if(t!==null)for(let s of e){if(s.type!=="message")continue;let{message:i}=s;if(i.id!==t||i.role!=="assistant")continue;let l=qd(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=jLe(i,n);l&&r.push(l)}return qd(r.join(" · "),180)||(a.length>0?a.map(s=>HLe(s,n)).join(" · "):n?n("timeline.noActivity"):"No activity")}function GLe(e,t){let a=[],n=null,r=[],o=()=>{if(!n)return;let s=cH(r),i=mk(s,-1,s.length-1,!1),l=i>=0?s[i]:null,u=l?.type==="message"&&l.message.role==="assistant"&&!l.message.isStreaming&&qd(l.message.content,1,{stripMarkdown:!0}).length>0?l.message.id:null,d=[];for(let f of s){if(f.type==="message"&&u!==null&&f.message.id===u)continue;let p=DLe(f,t);p.kind!=="none"&&!d.includes(p.kind)&&d.push(p.kind)}a.push({id:n.id,label:BLe(n,t),detail:WLe(s,u,d,t),timestamp:n.timestamp,nodeKinds:d,...FLe(n)?{isScheduledTask:!0}:{}})};for(let s of e){if(Qr(s)){o(),n=s,r=[];continue}n&&r.push(s)}return o(),a}function VLe(){return(0,c.jsxs)("svg",{className:At.sessionTimelineDetailsIcon,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,c.jsx)("circle",{cx:"8",cy:"8",r:"6.25"}),(0,c.jsx)("path",{d:"M8 4.5v4l-2.5 2"})]})}function KLe(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 XLe(e){return e.map(t=>{let a=`${t.id}:${t.role}:${t.timestamp??""}`;switch(t.role){case"assistant":case"thinking":return`${a}:${t.isStreaming?"streaming":t.content}`;case"tool_group":return`${a}:${t.tools.map(KLe).join(",")}`;case"system":return`${a}:${t.variant}:${t.source??""}:${t.content}`;case"user":return`${a}:${t.content}`;case"user_shell":return`${a}:${t.command}`;case"plan":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return a;default:return a}}).join("|")}function ZLe(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 YLe(e){if(e.type==="turn_outputs")return null;if(e.type==="turn_collapse")return e.turnCollapse.liveStartedAt===void 0||e.turnCollapse.toolCallCount===void 0||e.turnCollapse.toolCallCount<=0?null:`turn:${e.turnCollapse.turnId}:${e.turnCollapse.toolCallCount}`;if(e.type==="parallel_agents"){let a=e.agents.filter(n=>an(n.status));return a.length===0?null:`agents:${e.key}:${a.map(n=>n.callId).join(",")}`}if(e.message.role!=="tool_group")return null;let t=e.message.tools.filter(a=>an(a.status));return t.length===0?null:`tools:${e.message.id}:${t.map(a=>a.callId).join(",")}`}function QLe(e){for(let t=e.length-1;t>=0;t--){let a=YLe(e[t]);if(a)return a}return null}function JLe(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 eAe(e){return e.type==="message"&&e.message.role==="system"&&e.message.source==="turn_error"}function tAe(e){if(!(e.type!=="message"||e.message.role!=="assistant"))return e.message.content?.trim()?e.message.timestamp:void 0}function aAe(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function G6(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function ez(e){if(e.parentToolCallId||!lr(e))return;let t=e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0,a=t?.executionSummary&&typeof t.executionSummary=="object"?t.executionSummary:void 0,n=G6(a?.inputTokens),r=G6(a?.outputTokens);if(n===void 0&&r===void 0)return;let o=G6(a?.cachedTokens);return{callId:e.callId,usage:{inputTokens:n??0,outputTokens:r??0,...o!==void 0?{cachedTokens:o}:{}}}}function nAe(e){return e.type==="parallel_agents"?e.agents.flatMap(t=>ez(t)??[]):e.type!=="message"||e.message.role!=="tool_group"?[]:e.message.tools.flatMap(t=>ez(t)??[])}function rAe(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=>!$o(t.toolName)).length:0}function pH(e,t){for(let a=Math.min(t,e.length-1);a>=0;a--){let n=e[a];if(n.type==="message"&&Qr(n.message))return n.message.id}return null}function mH(e){let t=[],a=null;for(let n of e)n.type==="message"&&Qr(n.message)&&(a=n.message.id),t.push(a);return t}function tz(e,t,a,n){let r=n===void 0?pH(e,t):n[t]??null;return r?a.get(r)??null:null}function oAe(e,t,a,n,r=mH(e)){let o=Number.POSITIVE_INFINITY,s=-1;for(let l of t){if(l<0||l>=e.length)continue;let u=tz(e,l,a,r);u!==null&&(o=Math.min(o,u),s=Math.max(s,u))}if(s<0)return null;let i=n==null?null:tz(e,n,a,r);return{startIndex:o,endIndex:s,currentIndex:i!==null&&i>=o&&i<=s?i:s}}function $g(e,t,a,n){for(let r=t;r<=a;r++){let o=e[r];if(o.type==="parallel_agents"){if(o.agents.some(n))return!0}else if(o.type==="message"&&o.message.role==="tool_group"&&o.message.tools.some(n))return!0}return!1}function sAe(e,t,a,n){return n?$g(e,t,a,r=>Ds(r,n)):!1}function iAe(e,t,a){return $g(e,t,a,n=>lr(n)&&an(n.status))}function lAe(e,t,a){return $g(e,t,a,n=>bg(n.rawOutput)!==void 0)}function cAe(e,t){let a=new Set(t);for(let n of e){if(n.type!=="message"||n.message.role!=="system"||n.message.source!=="background_notification"&&n.message.source!=="background_task_completed"&&n.message.source!=="background_notification_turn_started")continue;let r=n.message.data;if(n.message.source==="background_notification_turn_started"&&r&&typeof r=="object"&&"backgroundTask"in r&&(r=r.backgroundTask??r),!r||typeof r!="object"||Array.isArray(r)||!("kind"in r)||r.kind!=="shell")continue;let o="taskId"in r?r.taskId:void 0;typeof o=="string"&&a.add(o)}return a}function uAe(e,t,a,n){return $g(e,t,a,r=>{let o=gce(r);return o!==void 0&&!n.has(o)})}function hH(e,t,a){return $g(e,t,a,n=>Os(n)&&an(n.status))}function dAe(e,t,a,n){if(!n?.size)return!1;for(let r=t;r<=a;r++){let o=e[r];if(o.type==="parallel_agents"&&n.has(o.key))return!0}return!1}function V6(e){return e.type==="parallel_agents"?e.agents.filter(t=>Os(t)&&t.status!=="failed").map(t=>t.callId):e.type==="message"&&e.message.role==="tool_group"?e.message.tools.filter(t=>Os(t)&&t.status!=="failed").map(t=>t.callId):[]}function gH(e){if(e.role!=="system"||e.source!=="background_notification"&&e.source!=="background_task_completed"&&e.source!=="background_notification_turn_started")return null;let t=e.content?.trimStart().toLowerCase().startsWith("background agent ")===!0,a=e.data;if(e.source==="background_notification_turn_started"&&a&&typeof a=="object"&&"backgroundTask"in a&&(a=a.backgroundTask??a),typeof a!="object"||a===null||Array.isArray(a))return t?{status:"completed",...e.timestamp!==void 0?{endTime:e.timestamp}:{}}:null;let{kind:n,toolUseId:r,status:o}=a;if(n!=="agent"&&!(n===void 0&&t))return null;let s=o===void 0?"completed":pz(o)?o:void 0;return s?{...typeof r=="string"?{callId:r}:{},status:s,...e.timestamp!==void 0?{endTime:e.timestamp}:{}}:null}function F9(e){return e.type==="message"?gH(e.message):null}function fAe(e){let t=new Map;for(let r of e){let o=gH(r);o?.callId&&t.set(o.callId,o)}if(t.size===0)return e;let a=!1,n=e.map(r=>{if(r.role!=="tool_group")return r;let o=!1,s=r.tools.map(i=>{let l=t.get(i.callId);if(!l||!Os(i)||!an(i.status))return i;let u=mz(i,l.status,l.endTime);return u===i?i:(o=!0,u)});return o?(a=!0,{...r,tools:s}):r});return a?n:e}function vH(e,t,a,n){let r=-1,o;for(let u=a;u>t;u--){let d=e[u];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=F9(d);if(n&&!f)continue;r<0&&(r=u,o=f?.callId)}}}if(r<0)return null;let s=-1;if(o){for(let u=a;u>=0;u--)if(V6(e[u]).includes(o)){s=u;break}}for(let u=a;u>=t&&!(s>=0);u--)if(V6(e[u]).length>0){s=u;break}let i=new Set,l=!1;if(s>=0){let u=s;for(let f=s;f>=0;f--){let p=e[f];if(p.type==="message"&&Qr(p.message)){u=f;break}}let d=[];for(let f=u;f<=a;f++){let p=e[f];for(let h of V6(p))i.add(h);let m=F9(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 q9(e,t,a,n=!1,r=!0,o=!0){let s=vH(e,t,a,n);if(!s)return!1;if(s.sawAgentCompletion&&s.unmatchedAgentCallIds.size>0)return r;for(let i=s.lastNotificationIndex+1;i<=a;i++){let l=e[i];if(l.type==="message"&&l.message.role==="thinking")return!1}return o&&mk(e,t,a,!1)<s.lastNotificationIndex}function pAe(e,{overrides:t,isResponding:a,activeTurnStartedAt:n,backgroundSummaryGraceActive:r=!0,waitForUnmatchedAgentCompletions:o=!0,waitForOrderedNarration:s=!0,terminalBackgroundShellTaskIds:i,automaticallyExpandedAgentKeys:l,pendingApprovalCallId:u,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 w=e[b];w.type==="message"&&Qr(w.message)&&m.push(b)}if(m.length===0)return e;let h=cAe(e,i),g=[];for(let b=0;b<m[0];b++)g.push(e[b]);for(let b=0;b<m.length;b++){let w=m[b],v=(b+1<m.length?m[b+1]:e.length)-1,x=e[w],T=x.message.id,I=x.message.timestamp,L=b===m.length-1,S=L&&a,C=iAe(e,w,v),E=lAe(e,w,v),R=uAe(e,w,v,h),P=dAe(e,w,v,l),N=L&&r&&q9(e,w,v,!1,o,s),q=sAe(e,w,v,u),H=mk(e,w,v),z=H;if(H>=0&&dH(e[H],!1)){let be=!1;for(let W=H-1;W>w;W--){let ke=e[W];if(ke.type!=="message")break;if(ke.message.role==="system"&&ke.message.source==="background_task_completed")be=!0;else if(be&&ke.message.role==="assistant")z=W,be=!1;else break}}let G=0,re,X,V,A=0,$=0,K=0,O=0,ee=0,de=!1,ye=new Set,oe=!1;for(let be=w+1;be<=v;be++){let W=e[be];if(Jq(W,be>=z&&be<=H)&&G++,eAe(W)&&(oe=!0),O+=rAe(W),W.type==="message"&&W.message.role==="thinking"?ee++:W.type==="message"&&W.message.role==="tool_group"&&W.message.thoughts&&(ee+=W.message.thoughts.length),W.type==="message"&&W.message.role==="system"&&W.message.source==="prompt_cancelled"){let lt=W.message.data,zt=lt&&typeof lt=="object"&&"elapsedMs"in lt?lt.elapsedMs:void 0;typeof zt=="number"&&Number.isFinite(zt)&&zt>=0&&(X=zt)}let ke=JLe(W);ke!==void 0&&(re=re===void 0?ke:Math.max(re,ke));let Ce=tAe(W);Ce!==void 0&&(V=V===void 0?Ce:Math.max(V,Ce));let ze=aAe(W);if(ze&&(A+=ze.inputTokens,$+=ze.outputTokens,K+=ze.cachedTokens??0,de=!0),d)for(let lt of nAe(W))ye.has(lt.callId)||(ye.add(lt.callId),A+=lt.usage.inputTokens,$+=lt.usage.outputTokens,K+=lt.usage.cachedTokens??0,de=!0)}let te=S||N?n??I??Date.now():void 0,le=re??V,J=X??(I!==void 0&&le!==void 0&&le>=I?le-I:void 0);if(q||G===0&&!(de||J!==void 0||te!==void 0)){for(let be=w;be<=v;be++)g.push(e[be]);continue}let _e=S||C||E||R||P||N||(oe||H<0)&&L,xe=!(G===0||(t.has(T)?t.get(T):f?.has(T)||_e));g.push({type:"message",key:x.key,message:x.message});let je={turnId:T,collapsed:xe,hiddenCount:G,...J!==void 0?{elapsedMs:J}:{},...de?{inputTokens:A,outputTokens:$}:{},...K>0?{cachedTokens:K}:{},...O>0?{toolCallCount:O}:{},...ee>0?{thinkingCount:ee}:{},...te!==void 0?{liveStartedAt:te}:{}};if(g.push({type:"turn_collapse",key:`tc-${T}`,turnCollapse:je}),!xe){for(let be=w+1;be<=v;be++){let W=e[be];be===H&&W.type==="message"&&W.message.role==="assistant"?g.push({...W,turnCollapse:je}):g.push(W)}continue}for(let be=w+1;be<=v;be++){let W=e[be];if(!(be===H&&S)){if(be===H&&W.type==="message"&&W.message.role==="assistant"){g.push({...W,turnCollapse:je});continue}Jq(W,be>=z&&be<=H)||g.push(W)}}}return g}function kb(e,t,a){if(a){for(let n=0;n<e.length;n++){let r=e[n];if(r.type==="message"&&r.message.role==="tool_group"&&r.message.tools.some(o=>Ds(o,a))||r.type==="parallel_agents"&&r.agents.some(o=>Ds(o,a)))return n}return-1}for(let n=0;n<e.length;n++){let r=e[n];if(r.type==="message"&&r.message.id===t)return n}return-1}function az(e,t){if(!t)return!1;let a=t.callId;return e.type==="message"?a?e.message.role==="tool_group"&&e.message.tools.some(n=>Ds(n,a)):e.message.id===t.messageId:e.type==="parallel_agents"?!!a&&e.agents.some(n=>Ds(n,a)):(e.type,!1)}function nz(e,t){return e?e.type==="message"?e.message.sourceBlockIds?.join(","):t.filter(a=>e.type==="parallel_agents"?a.role==="tool_group"&&e.agents.some(n=>a.tools.some(r=>Ds(r,n.callId))):a.id===(e.type==="turn_outputs"?e.turnId:e.turnCollapse.turnId)).flatMap(a=>a.sourceBlockIds??[]).join(",")||void 0:void 0}var K6=0,mAe=120,hAe=80,gAe=32,vAe=240,xb=30,X6=160,rz=30,yH=200;function yAe(e,t=yH){return e>t}function wAe(e,t){return e<=t}function bAe(e){return e!==void 0&&e>=0?vz(e):""}function kAe(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";let a=e.cachedTokens??0,n=a>0&&e.inputTokens>0?` (${Fn(a)} ${t("turn.cached")}, ${Math.round(a/e.inputTokens*100)}%)`:"";return`↑${Fn(e.inputTokens)}${n} ↓${Fn(e.outputTokens)}`}function oz(e,t){let a=[],n=kAe(e,t);return n&&a.push(n),e.toolCallCount!==void 0&&e.toolCallCount>0&&a.push(t("turn.toolCalls",{count:e.toolCallCount})),e.thinkingCount!==void 0&&e.thinkingCount>0&&a.push(t("turn.thinkingCount",{count:e.thinkingCount})),a.join(" · ")}function xAe(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}function wH(e){return e.hiddenCount>0||e.liveStartedAt!==void 0||xAe(e)}var SAe=(0,y.memo)(function({turnCollapse:e,onToggleCollapse:t}){let{t:a}=Ze(),n=e.hiddenCount>0,r=e.liveStartedAt,o=wH(e),s=ik(r!==void 0&&o),i=(0,y.useRef)(0),l=(0,y.useRef)(r);l.current!==r&&(l.current=r,i.current=0);let u;r!==void 0&&o?(i.current=Math.max(i.current,Math.max(0,s-r)),u=i.current):o&&e.elapsedMs!==void 0?(i.current=0,u=e.elapsedMs):(i.current=0,u=void 0);let d=bAe(u),f=oz(e,a),p=oz(e,a),m=a(r!==void 0?"turn.processing":"turn.processed"),h=!!d&&o,g=!!f&&o,b=!!p&&o;if(!o)return null;let w=()=>{if(!n)return;let v=e.collapsed;t(e.turnId,v)};return(0,c.jsxs)("div",{className:n?`${Ps.collapseRow} ${Ps.collapseRowClickable}`:Ps.collapseRow,role:n?"button":void 0,tabIndex:n?0:void 0,"aria-expanded":n?!e.collapsed:void 0,"aria-label":n?e.collapsed?a("turn.expand"):a("turn.collapse"):void 0,title:n?e.collapsed?a("turn.expand"):a("turn.collapse"):void 0,onClick:n?w:void 0,onKeyDown:n?v=>{v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),w())}:void 0,children:[(0,c.jsxs)("span",{className:Ps.collapseLabel,children:[(0,c.jsxs)("span",{className:Ps.processedLabel,children:[m,h&&(0,c.jsxs)("span",{className:Ps.processedMeta,children:[" ",d]})]}),b&&(0,c.jsx)("span",{className:Ps.summaryMetrics,children:p}),g&&(0,c.jsx)("span",{className:Ps.hiddenMetrics,children:f})]}),n&&(0,c.jsx)("span",{"data-testid":`toggle-${e.turnId}`,className:Ps.collapseIcon,onClick:v=>{v.stopPropagation(),w()},children:(0,c.jsx)("span",{className:e.collapsed?Ps.chevronRight:Ps.chevronDown,"aria-hidden":"true"})})]})});function CAe(e){if(e.type==="turn_collapse")return At.turnStatusRow;if(e.type==="turn_outputs")return At.turnContentRow;if(e.type==="message"&&e.turnCollapse)return At.turnAnswerRow}var TAe={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},IAe=["--background","--foreground","--muted-foreground","--border","--font-sans"],sz="session-timeline-detail-tooltip",_Ae=(0,y.memo)(function({entries:e,currentTurnId:t,currentRange:a,hidden:n,onSelect:r,action:o}){let s=Xp(),{t:i}=Ze(),l=(0,y.useRef)(null),u=(0,y.useRef)(null),d=(0,y.useRef)(null),f=(0,y.useRef)(!1),p=(0,y.useRef)(!1),m=(0,y.useRef)(null),h=(0,y.useRef)(null),[g,b]=(0,y.useState)(null),w=a!==null?a.currentIndex:e.findIndex(R=>R.id===t),v=(0,y.useCallback)(()=>b(null),[]),x=(0,y.useCallback)(()=>{f.current||p.current||v()},[v]),T=(0,y.useCallback)((R,P)=>{let N=l.current;if(!N)return null;let q=getComputedStyle(N),H=P.getBoundingClientRect();return{entry:R,top:H.top+H.height/2,left:H.right+8,clamped:!1,themeVars:Object.fromEntries(IAe.map(z=>[z,q.getPropertyValue(z)]))}},[]),I=(0,y.useCallback)(R=>{let P=u.current;return P?Array.from(P.querySelectorAll('[data-testid="session-timeline-entry"]')).find(N=>N.getAttribute("data-turn-id")===R.id)?.querySelector("button")??null:null},[]),L=(0,y.useCallback)(R=>{let P=u.current;if(!P)return!1;let N=P.getBoundingClientRect(),q=R.getBoundingClientRect();return q.bottom>=N.top&&q.top<=N.bottom},[]),S=(0,y.useCallback)(()=>{b(R=>{if(!R)return null;let P=I(R.entry);return!P||!L(P)?null:T(R.entry,P)})},[T,I,L]),C=(0,y.useCallback)((R,P)=>{b(T(R,P))},[T]),E=(0,y.useCallback)(()=>{typeof window>"u"||(m.current!==null&&window.cancelAnimationFrame(m.current),h.current!==null&&window.clearTimeout(h.current),p.current=!0,m.current=window.requestAnimationFrame(()=>{m.current=null,p.current=!1,S()}),h.current=window.setTimeout(()=>{h.current=null,p.current=!1},100))},[S]);return(0,y.useLayoutEffect)(()=>{if(n)return;let R=u.current;if(!R||w<0)return;let P=R.querySelector(`[data-timeline-index="${w}"]`);if(!P)return;let N=P.offsetTop+P.offsetHeight/2,q=R.scrollHeight-R.clientHeight,H=Math.max(0,Math.min(N-R.clientHeight/2,q));if(R.scrollTop===H)return;f.current=!0,R.scrollTop=H;let z=window.requestAnimationFrame(()=>{f.current=!1,S()}),G=window.setTimeout(()=>{f.current=!1},100);return()=>{window.cancelAnimationFrame(z),window.clearTimeout(G),f.current=!1}},[w,n,S]),(0,y.useLayoutEffect)(()=>{if(!(!g||typeof window>"u"))return window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)}},[S,g]),(0,y.useLayoutEffect)(()=>()=>{m.current!==null&&window.cancelAnimationFrame(m.current),h.current!==null&&window.clearTimeout(h.current),p.current=!1},[]),(0,y.useLayoutEffect)(()=>{if(!g||g.clamped)return;let R=l.current,P=d.current;if(!R||!P||typeof window>"u")return;let N=P.getBoundingClientRect(),q=12,H=g.top;N.top<q?H+=q-N.top:N.bottom>window.innerHeight-q&&(H-=N.bottom-(window.innerHeight-q)),H!==g.top&&b(z=>z?.entry.id===g.entry.id?{...z,top:H,clamped:!0}:z)},[g]),n||e.length===0?null:(0,c.jsx)("div",{className:At.sessionTimelineLayer,"aria-hidden":"false",children:(0,c.jsxs)("nav",{ref:l,className:At.sessionTimelinePanel,"aria-label":i("timeline.sessionTimeline"),"data-testid":"session-timeline",onMouseLeave:v,children:[(0,c.jsx)("div",{ref:u,className:At.sessionTimelineViewport,"data-testid":"session-timeline-viewport",onScroll:x,children:(0,c.jsx)("ol",{className:At.sessionTimelineList,children:e.map((R,P)=>{let N=a!==null&&P>=a.startIndex&&P<=a.endIndex,q=a!==null?P===a.currentIndex:R.id===t,H=R.nodeKinds.join(","),z=[`${i("timeline.turnPrefix",{index:P+1})}: ${R.label}`,q?i("timeline.currentTurn"):null].filter(Boolean).join(". "),G=V=>C(R,V.currentTarget),re=V=>{E(),C(R,V.currentTarget)},X=g?.entry.id===R.id;return(0,c.jsx)("li",{className:At.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":R.id,"data-timeline-index":P,"data-node-kinds":H,"data-in-current-range":N?"true":void 0,children:(0,c.jsx)("button",{type:"button",className:z9(At.sessionTimelineButton,N?At.sessionTimelineButtonInRange:void 0,q?At.sessionTimelineButtonCurrent:void 0),"aria-current":q?"step":void 0,"aria-describedby":X?sz:void 0,"aria-label":z,onClick:()=>r(R.id),onFocus:re,onBlur:v,onMouseEnter:G,onMouseLeave:v,children:(0,c.jsx)("span",{className:At.sessionTimelineTick})})},R.id)})})}),o,g&&typeof document<"u"&&(0,kg.createPortal)((0,c.jsxs)("div",{ref:d,className:At.sessionTimelineDetails,id:sz,"data-testid":"session-timeline-detail","data-title":g.entry.label,"data-detail":g.entry.detail,"data-scheduled-task":g.entry.isScheduledTask?"true":void 0,role:"tooltip",style:{...g.themeVars,top:g.top,left:g.left},children:[(0,c.jsxs)("span",{className:At.sessionTimelineDetailsTitle,children:[g.entry.isScheduledTask&&(0,c.jsx)(VLe,{}),(0,c.jsx)("span",{className:At.sessionTimelineDetailsTitleText,children:g.entry.label})]}),(0,c.jsx)("span",{className:At.sessionTimelineDetailsDetail,children:g.entry.detail})]}),s??document.body)]})})});function z9(...e){return e.filter(Boolean).join(" ")||void 0}var LAe=[];function AAe({label:e}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{role:"status","aria-live":"polite",className:At.srOnly,children:e}),(0,c.jsxs)("div",{className:At.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[(0,c.jsx)("div",{className:At.loadingSkeletonUserRow,children:(0,c.jsxs)("div",{className:At.loadingSkeletonUserBubble,children:[(0,c.jsx)("span",{className:At.loadingSkeletonLineWide}),(0,c.jsx)("span",{className:At.loadingSkeletonLineShort})]})}),(0,c.jsx)("div",{className:At.loadingSkeletonAssistantRow,children:(0,c.jsxs)("div",{className:At.loadingSkeletonAssistantBlock,children:[(0,c.jsx)("span",{className:At.loadingSkeletonLineMedium}),(0,c.jsx)("span",{className:At.loadingSkeletonLineWide}),(0,c.jsx)("span",{className:At.loadingSkeletonLineNarrow})]})}),(0,c.jsx)("div",{className:At.loadingSkeletonUserRow,children:(0,c.jsx)("div",{className:At.loadingSkeletonUserBubbleCompact,children:(0,c.jsx)("span",{className:At.loadingSkeletonLineMedium})})}),(0,c.jsx)("div",{className:At.loadingSkeletonAssistantRow,children:(0,c.jsxs)("div",{className:At.loadingSkeletonAssistantBlock,children:[(0,c.jsx)("span",{className:At.loadingSkeletonLineWide}),(0,c.jsx)("span",{className:At.loadingSkeletonLineMedium})]})})]})]})}var RAe=(0,y.memo)((0,y.forwardRef)(function({messages:e,deletion:t,frozenViewport:a=!1,sessionKey:n,terminalBackgroundShellTaskIds:r,pendingApproval:o,onShowContextDetail:s,onOpenMemoryFile:i,onImagePreview:l,onAttachmentPreview:u,onInsightReportOpen:d,onEditUserMessage:f,onSubmitUserMessageEdit:p,loadingTranscript:m,catchingUp:h,hasOlderHistory:g=!1,loadingOlderHistory:b=!1,historyCapacityReached:w=!1,historyPaginationError:v=!1,onLoadOlderHistory:x,transcriptBlockCount:T=0,transcriptActivity:I,onReloadTranscript:L,isResponding:S=!1,transcriptReloadPaused:C=S,activeTurnStartedAt:E,welcomeHeader:R,centerWelcomeHeader:P=!1,workspaceCwd:N,tailContent:q,tailKey:H="tail",virtualScrollThreshold:z=yH,autoScrollTailIntoView:G=!1,bottomOverlayInset:re=0,hideSessionTimeline:X=!1,timelineAction:V,hideFirstUserMessage:A=!1,firstTurnMetrics:$,includeSubagentToolUsageInMetrics:K=!0,showRetryHint:O=!1,onRetryClick:ee,failedPromptMessageId:de,onRetryFailedPrompt:ye,onBranchSession:oe,onCanScrollToBottomChange:te,turnFileChanges:le,turnArtifacts:J,sourceEntries:_e,sourceSessionId:xe,mcpAppSessionId:je=xe,onSourceOpen:be,turnScheduledTasks:W,onReviewChanges:ke,onOpenArtifact:Ce,onOpenScheduledTask:ze,onTurnOutputOpen:lt,onToolResultOpen:zt,onError:ta,generateContent:ha},pt){let Ie=(0,y.useRef)(a);Ie.current=a;let{t:ne}=Ze(),Z=Oa(),ae=(0,y.useContext)(U9),ge=(0,y.useMemo)(()=>{let F=new Map,Q,ve=0;for(let Ae of e)Ae.role==="user"&&(F.set(Ae.id,ve),Q=Ae.id,ve+=1);return{lastId:Q,turnIndexById:F}},[e]),$e=(0,y.useMemo)(()=>{if(!a)return;let F=[...ge.turnIndexById.keys()];return new Set(F.filter((Q,ve)=>ve===0||ve===F.length-1))},[ge,a]),He=(0,y.useRef)(void 0),Je=TLe(He.current,e);(0,y.useLayoutEffect)(()=>{He.current=e},[e]);let Gt=(0,y.useRef)(void 0),at=(0,y.useRef)(void 0),wt=(0,y.useRef)(void 0),$t=(0,y.useRef)(void 0),tt=(0,y.useMemo)(()=>{let F=Gt.current,Q=e[e.length-1],ve;if(Je&&F?.sourceMessages===He.current&&F?.compactMode===ae&&F.pendingApproval===o&&(Q?.role==="assistant"&&F.value[F.value.length-1]?.id===Q.id?(ve=F.value.slice(),ve[ve.length-1]=Q):Q?.role==="thinking"&&(ve=ae?ELe(F.value,Q):Zq(e))),!ve){let ot=Zq(e);ve=ae?RLe(ot,o):ot}Gt.current={sourceMessages:e,compactMode:ae,pendingApproval:o,value:ve};let Ae=$t.current??=new WeakMap,pe=at.current,vt=pe!==void 0&&pe.sessionKey===n?pe.ids:void 0;if(S){if(wt.current=void 0,!vt?.size)return ve;let ot,Pt=!1,ut=ve.map(Ra=>{let Ta=dg(Ra.id);if(Ta!==void 0){let a1=vt.get(Ta);a1!==void 0&&(ot??=new Map).set(Ta,a1)}let _n=vt.get(ug(Ra.id));_n!==void 0&&(ot??=new Map).set(ug(Ra.id),_n);let ms=vt.get(Ra.id);return ms===void 0||Yq(Ra)!==ms?Ra:((ot??=new Map).set(Ra.id,ms),Pt=!0,Qq(Ae,Ra))});return(ot?.size??0)!==vt.size&&(wt.current={sessionKey:n,ids:ot??new Map}),Pt?ut:ve}let Ft,sa=ve.map(ot=>{let Pt=Qq(Ae,ot);if(Pt!==ot){let ut=Yq(ot);if(ut!==void 0){(Ft??=new Map).set(ot.id,ut);let Ra=dg(ot.id),Ta=ot.role==="tool_group"?ot.thoughts?.[0]?.content:void 0;Ra!==void 0&&Ta!==void 0&&Ft.set(Ra,Ta),ot.role==="thinking"&&Ft.set(ug(ot.id),JSON.stringify([ot.content]))}}return Pt});return Ft?(wt.current={sessionKey:n,ids:new Map([...vt??[],...Ft])},sa):ve},[ae,S,e,o,n,Je]);(0,y.useLayoutEffect)(()=>{let F=wt.current;F&&(at.current=F,wt.current=void 0)},[tt]);let gt=(0,y.useRef)(void 0),Ge=(0,y.useMemo)(()=>{let F=gt.current,Q=tt[tt.length-1],ve;if(Je&&S&&F?.sourceMessages===He.current&&F?.compactMode===ae&&F.pendingApproval===o&&F.isResponding===S&&F.turnFileChanges===le&&F.turnArtifacts===J&&F.turnScheduledTasks===W){let Ae=F.value[F.value.length-1];Ae?.type==="message"&&Ae.message.id===Q.id&&(ve=F.value.slice(),ve[ve.length-1]={...Ae,message:Q})}return ve??=PLe(cH(tt),S,le,J,W),gt.current={sourceMessages:e,compactMode:ae,pendingApproval:o,isResponding:S,turnFileChanges:le,turnArtifacts:J,turnScheduledTasks:W,value:ve},ve},[tt,e,Je,ae,o,S,le,J,W]),Ka=(0,y.useMemo)(()=>{for(let F=tt.length-1;F>=0;F-=1){let Q=tt[F];if(Q?.role==="system"&&Q.source==="background_notification")return Q.id}return null},[tt]),[ur,bi]=(0,y.useState)(Ka),Tt=!!(m||h),Fr=(0,y.useRef)(Tt),ga=(0,y.useRef)(tt.length>0),In=!ga.current&&tt.length>0,Ir=Tt||Fr.current||In;(0,y.useLayoutEffect)(()=>{Ir&&bi(Ka),tt.length>0&&(ga.current=!0),Fr.current=Tt},[Ir,Ka,Tt,tt.length]);let va=!Ir&&Ka!==null&&ur!==Ka,Fa=(0,y.useMemo)(()=>{for(let F=Ge.length-1;F>=0;F-=1){let Q=Ge[F];if(Q.type==="message"&&Qr(Q.message))return F}return 0},[Ge]),Yn=Z==="interactive",dr=(0,y.useMemo)(()=>Yn&&hH(Ge,Fa,Ge.length-1),[Ge,Yn,Fa]),ya=(0,y.useMemo)(()=>vH(Ge,Fa,Ge.length-1,!0),[Ge,Fa]),_r=(0,y.useMemo)(()=>{let F=ya?.unmatchedAgentCallIds;return F&&F.size>0?[...F].sort().join("|"):""},[ya]),us=va&&!dr&&(ya?.sawAgentCompletion??!1)&&(ya?.unmatchedAgentCallIds.size??0)>0,[zo,$s]=(0,y.useState)(!1);(0,y.useEffect)(()=>{$s(!1)},[_r,Fa,S]),(0,y.useEffect)(()=>{if(!us||S)return;let F=setTimeout(()=>$s(!0),Kq);return()=>clearTimeout(F)},[us,_r,Fa,S]);let ki=(0,y.useMemo)(()=>va&&!dr&&!S&&(ya?.sawAgentCompletion??!1)&&(ya?.unmatchedAgentCallIds.size??0)===0&&q9(Ge,Fa,Ge.length-1,!0,!0,!0),[va,Ge,S,ya,dr,Fa]),[Dl,ho]=(0,y.useState)(!1),Jp=(0,y.useMemo)(()=>{let F=ya;if(!F||F.lastNotificationIndex<0)return"";let Q=Ge[F.lastNotificationIndex];return Q?.type==="message"?Q.message.id:""},[Ge,ya]);(0,y.useEffect)(()=>{ho(!1)},[Jp,Fa,S]),(0,y.useEffect)(()=>{if(!ki)return;let F=setTimeout(()=>ho(!0),Kq);return()=>clearTimeout(F)},[ki,Jp,Fa,S]);let Ca=(0,y.useMemo)(()=>va&&q9(Ge,Fa,Ge.length-1,!0,dr||!zo,!Dl),[va,Ge,dr,Fa,Dl,zo]),Bg=(0,y.useMemo)(()=>{let F=new Set;for(let Q=Fa;Q<Ge.length;Q+=1){let ve=Ge[Q];ve.type==="parallel_agents"&&F.add(ve.key)}return F},[Ge,Fa]),em=(0,y.useMemo)(()=>{if(!va)return{key:null};let F=-1,Q;for(let ve=Ge.length-1;ve>=0;ve-=1){let Ae=Ge[ve];if(Ae.type!=="message"||Ae.message.role!=="system"||Ae.message.source!=="background_notification")continue;let pe=F9(Ae);if(pe){F=ve,Q=pe.callId;break}}for(let ve=F-1;ve>=0;ve-=1){let Ae=Ge[ve];if(Ae.type==="parallel_agents"&&(!Q||Ae.agents.some(pe=>pe.callId===Q)))return{key:Ae.key}}return{key:null}},[va,Ge]),Ut=(0,y.useRef)(null),$l=R_e(Ut,!X),[xi,hk]=(0,y.useState)(()=>new Set),tm=(0,y.useCallback)((F,Q)=>{hk(ve=>{if(ve.has(F)===Q)return ve;let Ae=new Set(ve);return Q?Ae.add(F):Ae.delete(F),Ae})},[]),Si=(0,y.useRef)(null),Bs=(0,y.useMemo)(()=>{if(!$l)return LAe;let F=XLe(tt);return(Si.current?.signature!==F||Si.current?.t!==ne)&&(Si.current={signature:F,t:ne,entries:GLe(tt,ne)}),Si.current.entries},[$l,tt,ne]),am=(0,y.useMemo)(()=>new Map(Bs.map((F,Q)=>[F.id,Q])),[Bs]),Fg=(0,y.useMemo)(()=>LLe(tt),[tt]),[nm,qg]=(0,y.useState)(null),gk=nm!==null?Bs[nm.currentIndex]?.id??Fg:Fg,zg=(0,y.useRef)(void 0),nu=(0,y.useMemo)(()=>{let F=zg.current,Q;return Je&&S&&F?.sourceMessages===He.current&&F?.isResponding===S&&F.latestTurnAwaitsAgentSummary===Ca&&F.gateBackgroundAgentStatus===Yn?Q=F.value:Q=OLe(Ge,{isResponding:S,latestTurnAwaitsAgentSummary:Ca,gateBackgroundAgentStatus:Yn}),zg.current={sourceMessages:e,isResponding:S,latestTurnAwaitsAgentSummary:Ca,gateBackgroundAgentStatus:Yn,value:Q},Q},[Ge,e,Je,Yn,S,Ca]),Ug=(0,y.useMemo)(()=>{let F;for(let Q of nu.values())F=Q;return F},[nu]),{collapseCompletedTurns:vk,sourceReferences:ru,assistantFeedback:rm}=Bo(),{ratings:jg,rate:Hg,ratingForTurn:om}=pue(xe),Wg=(0,y.useMemo)(()=>{let F=new Map;for(let Q of e)Qr(Q)&&F.set(Q.id,Q);return F},[e]),ou=rue({renderMode:Z,sessionId:xe,options:rm}),Gg=(0,y.useRef)(rm);Gg.current=rm;let Vg=(0,y.useRef)(e);Vg.current=e;let Kg=(0,y.useCallback)((F,Q,ve)=>{let Ae=om(F);Hg(F,ve);let pe=Gg.current?.onRate;pe&&oue(pe,{rating:ve,previousRating:Ae,sessionId:xe,promptId:F,userMessage:sue(Vg.current,Q)})},[om,Hg,xe]),Xg=(0,y.useRef)(void 0),Wd=(0,y.useMemo)(()=>{let F=[_e,N,xe,ru],Q=Xg.current;return Je&&S&&Q&&Q.sourceMessages===He.current&&Xq(Q.dependencies,F)?Q.value:Kle(e,_e??[],N,xe,ru)},[e,_e,N,xe,ru,Je,S]);(0,y.useLayoutEffect)(()=>{Xg.current={sourceMessages:e,dependencies:[_e,N,xe,ru],value:Wd}},[e,_e,N,xe,ru,Wd]);let sm=vk??!0,[su,iu]=(0,y.useState)(()=>new Map),[Bl,lu]=(0,y.useState)(()=>new Set),Ci=(0,y.useRef)(new Map),[Zg,yk]=(0,y.useTransition)(),im=(0,y.useRef)(!1),Gd=(0,y.useRef)(new Map),Fl=(0,y.useRef)(void 0),Ti=(0,y.useRef)([]),ql=(0,y.useRef)(!0);a&&(ql.current=!1);let oa=(0,y.useRef)(!1),lm=(0,y.useRef)(0),cu=(0,y.useRef)(0),Aa=(0,y.useRef)(!1),qr=(0,y.useRef)(0),Ii=(0,y.useRef)(!1),zl=(0,y.useRef)(0),_i=(0,y.useRef)(null),uu=(0,y.useRef)(!1),Li=(0,y.useRef)(null),cm=(0,y.useRef)(null),Vd=(0,y.useRef)(!1),du=(0,y.useRef)(null),B=(0,y.useRef)(!1),ce=(0,y.useRef)(m),fe=(0,y.useRef)(!!m),Ue=(0,y.useRef)(void 0),ct=(0,y.useRef)(void 0),wa=(0,y.useRef)(re),fr=(0,y.useRef)(null),go=(0,y.useRef)(h),qn=(0,y.useRef)(h),Ai=(0,y.useRef)(!1),Ri=(0,y.useRef)(!1),Fs=(0,y.useRef)(void 0),zr=(0,y.useRef)(void 0);qn.current=h;let Ei=(0,y.useRef)(!1),zn=(0,y.useRef)(void 0),um=(0,y.useRef)(void 0),Mi=(0,y.useRef)(void 0),dm=(0,y.useRef)(void 0),fm=(0,y.useRef)(void 0),Kd=(0,y.useRef)(void 0),Yg=(0,y.useRef)(void 0),wk=(0,y.useRef)(T),bk=(0,y.useRef)(C);wk.current=T,bk.current=C||a;let kk=(0,y.useRef)(null),[qa,qs]=(0,y.useState)(null),j7=(0,y.useRef)(!1);j7.current=qa?.virtual===!0;let H7=(0,y.useRef)(tt.length);(0,y.useLayoutEffect)(()=>{H7.current=tt.length},[tt.length]);let xk=(0,y.useRef)(e);(0,y.useLayoutEffect)(()=>{xk.current=e},[e]);let[_H,Qg]=(0,y.useState)(!1),[LH,AH]=(0,y.useState)(n);LH!==n&&(AH(n),Ci.current.clear(),qr.current+=1,Aa.current=!1,Ei.current=!1,qs(null),iu(F=>F.size?new Map:F),lu(F=>F.size?new Set:F)),(0,y.useEffect)(()=>{g||(Ei.current=!1,kk.current=null)},[g]);let pm=(0,y.useCallback)(()=>{let F=Ut.current,Q=F?F.scrollHeight-F.scrollTop-F.clientHeight:0,ve=!ql.current&&Q>1;cm.current!==ve&&(cm.current=ve,te?.(ve))},[te]),pr=(0,y.useCallback)(()=>{zr.current!==void 0&&window.cancelAnimationFrame(zr.current),zr.current=window.requestAnimationFrame(pm)},[pm]),Wt=(0,y.useCallback)(F=>{Ie.current&&(F=!1),ql.current!==F&&(ql.current=F,pr())},[pr]),Xd=(0,y.useRef)(void 0),Sk=(0,y.useRef)(!1),rn=(0,y.useMemo)(()=>{Sk.current=!1;let F=[$e,su,S,E,r,va,dr,zo,Dl,sm,A,$,K,xi,ae,o,le,J,W,Bl],Q=Xd.current,ve=Ge[Ge.length-1];if(Je&&S&&Q&&Q.sourceMessages===He.current&&Xq(Q.dependencies,F)&&ve?.type==="message"){let ut=bb(ve),Ra=-1;for(let Ta=Q.value.length-1;Ta>=0;Ta-=1)if(bb(Q.value[Ta])===ut){Ra=Ta;break}if(Ra>=0){let Ta=Q.value[Ra];if(Ta?.type==="message"){let _n=Q.value.slice();return _n[Ra]={...Ta,message:ve.message},Xd.current={sourceMessages:e,dependencies:F,value:_n,virtualizerItems:Q.virtualizerItems},Sk.current=!0,_n}}}let Ae=pAe(Ge,{overrides:su,isResponding:S,activeTurnStartedAt:E,terminalBackgroundShellTaskIds:r,backgroundSummaryGraceActive:va,waitForUnmatchedAgentCompletions:dr||!zo,waitForOrderedNarration:!Dl,automaticallyExpandedAgentKeys:xi,pendingApprovalCallId:o?.toolCallId??null,includeSubagentToolUsageInMetrics:K,paginatedExpanded:$e?new Set([...Bl,...$e]):Bl,enabled:sm}),pe=$e?Ae.map(ut=>{if(!("turnCollapse"in ut)||!ut.turnCollapse||!$e.has(ut.turnCollapse.turnId))return ut;let{turnId:Ra,collapsed:Ta,hiddenCount:_n}=ut.turnCollapse;return{...ut,turnCollapse:{turnId:Ra,collapsed:Ta,hiddenCount:_n}}}):Ae,vt=!1,Ft=$?pe.map(ut=>vt||ut.type!=="turn_collapse"?ut:(vt=!0,{...ut,turnCollapse:{...ut.turnCollapse,...$.durationMs!==void 0&&$.durationMs>0?{elapsedMs:$.durationMs}:{},...$.inputTokens!==void 0?{inputTokens:$.inputTokens}:{},...$.outputTokens!==void 0?{outputTokens:$.outputTokens}:{},...$.cachedTokens!==void 0?{cachedTokens:$.cachedTokens}:{}}})):pe,sa=NLe(Ft,xi);if(!A)return Xd.current={sourceMessages:e,dependencies:F,value:sa,virtualizerItems:sa},sa;let ot=tt.find(ut=>ut.role==="user")?.id,Pt=ot?sa.filter(ut=>ut.type!=="message"||ut.message.id!==ot):sa;return Xd.current={sourceMessages:e,dependencies:F,value:Pt,virtualizerItems:Pt},Pt},[Ge,Je,su,S,E,r,va,dr,zo,Dl,sm,$e,A,$,K,tt,e,xi,ae,o,le,J,W,Bl]),Zd=Xd.current?.sourceMessages===e?Xd.current.virtualizerItems:rn,mm=(0,y.useCallback)(F=>Zd.some(Q=>String(bb(Q))===F),[Zd]),Ck=(0,y.useRef)(void 0),RH=(0,y.useMemo)(()=>{if(Sk.current&&Ck.current?.length===rn.length)return Ck.current.value;let F=mH(rn);return Ck.current={length:rn.length,value:F},F},[rn]),EH=Bs.length>=xye,ds=q!=null,Yd=!!m,Ul=!!R,Qn=Ul?1:0,fu=Qn+rn.length,hm=fu+(ds?1:0),MH=Qn+Ge.length+(ds?1:0),Pi=yAe(MH,z),Jn=(0,y.useCallback)(()=>Ut.current,[]),W7=(0,y.useCallback)(()=>{let F=Ut.current;if(!F)return;let Q=F.scrollHeight-F.scrollTop-F.clientHeight<xb;oa.current=!Q,Wt(Q),pr()},[pr,Wt]),gm=(0,y.useCallback)(()=>{lm.current=Date.now()+1e3},[]),Jg=(0,y.useCallback)(()=>{fm.current!==void 0&&(window.clearTimeout(fm.current),fm.current=void 0)},[]),fs=(0,y.useCallback)(()=>{Jg(),Kd.current?.abort(),Kd.current=void 0},[Jg]),Qd=(0,y.useCallback)(()=>{Jg();let F=Yg.current;if(F){if(I?.getSnapshot().lastEventId===F.lastEventId)return;Yg.current=void 0}!L||Kd.current!==void 0||oa.current||bk.current||wk.current<=WF||(fm.current=window.setTimeout(()=>{if(fm.current=void 0,bk.current||oa.current||wk.current<=WF)return;let Q=Ut.current;if(!Q||Q.scrollHeight-Q.scrollTop-Q.clientHeight>=xb)return;let ve=new AbortController;Kd.current=ve,L(ve.signal).then(()=>{if(ve.signal.aborted)return;let Ae=I?.getSnapshot();Yg.current={...Ae?.lastEventId!==void 0?{lastEventId:Ae.lastEventId}:{}}}).catch(Ae=>{Ae instanceof Error&&Ae.name==="AbortError"||console.warn("[MessageList] transcript reload failed:",Ae)}).finally(()=>{Kd.current===ve&&(Kd.current=void 0)})},SLe))},[Jg,L,I]);(0,y.useEffect)(()=>{Yg.current=void 0},[I]),(0,y.useEffect)(()=>{if(!I)return fs;let F=I.getSnapshot().lastEventId,Q=I.subscribe(()=>{let ve=I.getSnapshot().lastEventId;ve!==F&&(F=ve,Qd())});return()=>{Q(),fs()}},[I,Qd,fs]),(0,y.useEffect)(()=>{if(C){fs();return}Qd()},[fs,C,Qd,T]);let Jd=(0,y.useCallback)(()=>{Ri.current=!0,Fs.current!==void 0&&window.cancelAnimationFrame(Fs.current),Fs.current=window.requestAnimationFrame(()=>{Ri.current=!1,Fs.current=void 0,W7()})},[W7]);(0,y.useEffect)(()=>()=>{Fs.current!==void 0&&window.cancelAnimationFrame(Fs.current),zr.current!==void 0&&window.cancelAnimationFrame(zr.current),zn.current!==void 0&&window.cancelAnimationFrame(zn.current),um.current!==void 0&&window.cancelAnimationFrame(um.current),Mi.current!==void 0&&window.cancelAnimationFrame(Mi.current),fs(),Ue.current!==void 0&&window.cancelAnimationFrame(Ue.current),ct.current!==void 0&&window.cancelAnimationFrame(ct.current)},[fs]);let G7=(0,y.useCallback)((F,Q)=>{let ve=Ut.current;(!ve||ve.scrollHeight>ve.clientHeight+1)&&(oa.current=!0,Wt(!1)),Jd(),Fl.current!==void 0&&window.clearTimeout(Fl.current),Gd.current.clear(),Ut.current?.querySelectorAll("[data-message-row-key]").forEach(Ae=>{let pe=Ae.dataset.messageRowKey;pe&&Gd.current.set(pe,Ae.getBoundingClientRect().top)}),im.current=!0,yk(()=>{lu(Ae=>{if(!Ae.has(F))return Ae;let pe=new Set(Ae);return pe.delete(F),pe}),iu(Ae=>{let pe=new Map(Ae);return pe.set(F,Q),pe})})},[Jd,Wt]);(0,y.useLayoutEffect)(()=>{if(Zg||!im.current)return;im.current=!1;for(let Q of Ti.current)Q.cancel();Ti.current=[];let F=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;F||Ut.current?.querySelectorAll("[data-message-row-key]").forEach(Q=>{if(typeof Q.animate!="function")return;let ve=Q.dataset.messageRowKey,Ae=ve?Gd.current.get(ve):void 0;if(Ae===void 0){Ti.current.push(Q.animate([{opacity:0},{opacity:1}],{duration:H6,easing:"ease-out"}));return}let pe=Ae-Q.getBoundingClientRect().top;Math.abs(pe)<1||Ti.current.push(Q.animate([{translate:`0 ${pe}px`},{translate:"0 0"}],{duration:H6,easing:"ease-out"}))}),Gd.current.clear(),Fl.current=window.setTimeout(()=>{Fl.current=void 0,Jd()},F?0:H6)},[Jd,Zg]),(0,y.useEffect)(()=>()=>{Fl.current!==void 0&&window.clearTimeout(Fl.current);for(let F of Ti.current)F.cancel();Ti.current=[]},[]);let PH=(0,y.useCallback)(F=>{let Q=F.target;Q instanceof HTMLElement&&Q.closest("[aria-expanded], summary")&&(oa.current=!0,Wt(!1),Jd())},[Jd,Wt]),pu=(0,y.useCallback)(F=>{if(Ul&&F===K6)return"slot:header";if(ds&&F===fu)return`slot:tail:${H}`;let Q=Zd[F-Qn];return Q?bb(Q):`slot:row:${F}`},[Ul,ds,fu,H,Zd,Qn]),NH=(0,y.useCallback)(F=>Ul&&F===K6?mAe:ds&&F===fu?vAe:Zd[F-Qn]?.type==="turn_collapse"?gAe:hAe,[Ul,ds,Qn,fu,Zd]),er=(0,y.useCallback)((F="auto")=>{if(Ie.current)return;let Q=Jn();if(!Q||Q.scrollHeight<=Q.clientHeight)return;uu.current=!1,zl.current+=1;let ve=zl.current;Ii.current=!0,F==="smooth"?Q.scrollTo({top:Q.scrollHeight,behavior:F}):Q.scrollTop=Q.scrollHeight,pr(),cu.current=Math.max(0,Q.scrollHeight-Q.clientHeight),pm();let Ae=()=>{if(zl.current!==ve||(Ii.current=!1,!uu.current)||(uu.current=!1,qn.current||oa.current))return;let pe=Jn();!pe||pe.scrollHeight<=pe.clientHeight||(Wt(!0),pe.scrollTop=pe.scrollHeight,pr(),cu.current=Math.max(0,pe.scrollHeight-pe.clientHeight),pm())};F==="smooth"?setTimeout(Ae,350):requestAnimationFrame(Ae)},[Jn,pm,pr,Wt]),V7=(0,y.useCallback)((F="smooth")=>{oa.current=!1,Wt(!0),er(F)},[er,Wt]),ps=fce({count:hm,enabled:Pi,getScrollElement:Jn,getItemKey:pu,estimateSize:NH,overscan:20,anchorTo:"end",useFlushSync:!1,useAnimationFrameWithResizeObserver:!0,directDomUpdates:!0});ps.shouldAdjustScrollPositionOnItemSizeChange=(F,Q,ve)=>wAe(F.end,Ut.current?.scrollTop??ve.scrollOffset??0);let OH=(0,y.useCallback)(F=>{if(ps.measureElement(F),!F||!j7.current)return;let Q=Number(F.dataset.index);Number.isFinite(Q)&&!ps.itemSizeCache.has(pu(Q))&&ps.resizeItem(Q,F.offsetHeight)},[pu,ps]);(0,y.useLayoutEffect)(()=>{if(!qa)return;let F=Ut.current;if(qa.rowKey&&!mm(qa.rowKey)){let Q=qLe(xk.current,qa.rowKey);if(Q!==void 0&&zLe(rn,Q)&&su.get(Q)!==!1&&!Bl.has(Q)){lu(ve=>ve.has(Q)?ve:new Set(ve).add(Q)),qs(ve=>ve&&{...ve,rowKey:`msg:${Q}`});return}qa.generation===qr.current&&(qr.current+=1),Aa.current=!1,dm.current=void 0,Qg(!1),qs(null);return}if(qa.settled){if(!F){Aa.current=!1,qs(null);return}if(qa.virtual?tt.length===qa.messageCount:F.scrollHeight===qa.scrollHeight){if(Aa.current=!1,zn.current!==void 0)return;let Q=rz,ve=()=>{if(zn.current=void 0,qa.generation===qr.current&&H7.current===qa.messageCount){if(Q-=1,Q>0){zn.current=requestAnimationFrame(ve);return}qs(Ae=>Ae===qa?null:Ae)}};zn.current=requestAnimationFrame(ve);return}zn.current!==void 0&&(cancelAnimationFrame(zn.current),zn.current=void 0),zn.current=requestAnimationFrame(()=>{if(zn.current=void 0,qa.generation!==qr.current)return;if(qa.rowKey&&!mm(qa.rowKey)){Aa.current=!1,qs(null);return}let Q=qa.rowKey?Array.from(F.querySelectorAll("[data-message-row-key]")).find(ve=>ve.dataset.messageRowKey===qa.rowKey):void 0;Q&&qa.rowTop!==void 0?F.scrollTop+=Q.getBoundingClientRect().top-qa.rowTop:F.scrollTop=qa.scrollTop+Math.max(0,F.scrollHeight-qa.scrollHeight),Aa.current=!1,qs(null)})}},[mm,tt.length,qa,rn,su,Bl]);let K7=ps.getVirtualItems(),ef=ps.getTotalSize(),X7=(0,y.useRef)({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});X7.current={entryIndexById:am,headerOffset:Qn,isVisible:$l,turnIdByDisplayIndex:RH,visibleItems:rn};let Z7=(0,y.useCallback)(()=>{let F=Jn(),Q=X7.current;if(!F||!Q.isVisible||Q.entryIndexById.size===0){qg(ut=>ut===null?ut:null);return}let ve=F.getBoundingClientRect(),Ae=ve.top,pe=ve.bottom,vt=Ae+(pe-Ae)/2,Ft=[],sa=null,ot=Number.POSITIVE_INFINITY;F.querySelectorAll("[data-index]").forEach(ut=>{let Ra=ut.dataset.index;if(Ra===void 0)return;let Ta=Number(Ra);if(!Number.isFinite(Ta))return;let _n=Ta-Q.headerOffset;if(_n<0||_n>=Q.visibleItems.length)return;let ms=ut.getBoundingClientRect();if(ms.bottom<Ae||ms.top>pe)return;Ft.push(_n);let a1=ms.top+(ms.bottom-ms.top)/2,nT=Math.abs(a1-vt);nT<ot&&(ot=nT,sa=_n)});let Pt=oAe(Q.visibleItems,Ft,Q.entryIndexById,sa,Q.turnIdByDisplayIndex);qg(ut=>ut?.startIndex===Pt?.startIndex&&ut?.endIndex===Pt?.endIndex&&ut?.currentIndex===Pt?.currentIndex?ut:Pt)},[Jn]),jl=(0,y.useCallback)(()=>{Li.current!==null&&cancelAnimationFrame(Li.current),Li.current=requestAnimationFrame(()=>{Li.current=null,Z7()})},[Z7]);(0,y.useEffect)(()=>()=>{_i.current!==null&&(clearTimeout(_i.current),_i.current=null),Li.current!==null&&(cancelAnimationFrame(Li.current),Li.current=null)},[]),(0,y.useEffect)(()=>{jl()},[jl,hm,ef,Pi,K7.length,$l]);let[vm,Tk]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(!vm)return;let F=setTimeout(()=>Tk(null),1600);return()=>clearTimeout(F)},[vm]);let Ik=(0,y.useCallback)((F,Q)=>{oa.current=!0,Wt(!1),zl.current+=1;let ve=zl.current;if(Ii.current=!0,Pi)if(Ie.current){let Ae=ps.getOffsetForIndex(F,"center");Ae&&Ut.current&&(Ut.current.scrollTop=Ae[0])}else ps.scrollToIndex(F,{align:"center"});else Ut.current?.querySelector(`[data-index="${F}"]`)?.scrollIntoView({block:"center"});_i.current!==null&&clearTimeout(_i.current),_i.current=setTimeout(()=>{_i.current=null,zl.current===ve&&(Ii.current=!1,jl(),pr())},150),Tk(null),requestAnimationFrame(()=>Tk(Q))},[Pi,ps,Wt,jl,pr]),Y7=(0,y.useRef)({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});Y7.current={visibleItems:rn,displayItems:Ge,headerOffset:Qn,performScrollToRow:Ik};let mu=(0,y.useRef)(null),ym=(0,y.useCallback)((F,Q)=>{let{visibleItems:ve,displayItems:Ae,headerOffset:pe,performScrollToRow:vt}=Y7.current,Ft=kb(ve,F,Q);if(Ft>=0)return mu.current=null,vt(Ft+pe,{messageId:F,callId:Q}),!0;let sa=kb(Ae,F,Q);if(sa<0)return!1;let ot=pH(Ae,sa);return ot?(mu.current={messageId:F,callId:Q},iu(Pt=>{if(Pt.get(ot)===!0)return Pt;let ut=new Map(Pt);return ut.set(ot,!0),ut}),!0):!1},[]);(0,y.useImperativeHandle)(pt,()=>({scrollToMessage:ym,scrollToBottom:V7}),[ym,V7]),(0,y.useEffect)(()=>{let F=mu.current;if(!F)return;let Q=kb(rn,F.messageId,F.callId);Q<0||(mu.current=null,Ik(Q+Qn,F))},[rn,Qn,Ik]);let zs=(0,y.useCallback)(async(F=!1,Q=!1)=>{let ve=Ut.current;if(!ve||!x||b||Aa.current||v&&!Q||Ei.current&&!F)return;Ei.current=!1,Aa.current=!0;let Ae=++qr.current;zn.current!==void 0&&(cancelAnimationFrame(zn.current),zn.current=void 0),Qg(!Q);let pe;if(Pi){let Pt=String(pu(Qn)),ut=rz;if(pe=await new Promise(Ra=>{let Ta=()=>{if(um.current=void 0,Ae!==qr.current||Ut.current!==ve||!mm(Pt)||ut--<=0){Ra(void 0);return}let _n=Array.from(ve.querySelectorAll("[data-message-row-key]")).find(ms=>ms.dataset.messageRowKey===Pt);_n?Ra({rowKey:Pt,rowTop:_n.getBoundingClientRect().top}):um.current=requestAnimationFrame(Ta)};um.current=requestAnimationFrame(Ta)}),!pe){Ae===qr.current&&(Aa.current=!1,dm.current=void 0,Qg(!1));return}}let vt=ve.scrollHeight,Ft=ve.scrollTop,sa=ve.getBoundingClientRect().top,ot=pe?void 0:Array.from(ve.querySelectorAll("[data-message-row-key]")).find(Pt=>{let ut=Pt.dataset.messageRowKey;return ut!==void 0&&ut.startsWith("msg:")&&Pt.getBoundingClientRect().bottom>sa});oa.current=!0,qs({scrollHeight:vt,scrollTop:Ft,messageCount:tt.length,virtual:Pi,settled:!1,generation:Ae,...pe??(ot?{rowKey:ot.dataset.messageRowKey,rowTop:ot.getBoundingClientRect().top}:{})});try{Ci.current.set(Ae,{ids:new Set(xk.current.map(ut=>ut.id)),resolved:!1}),await x(Q?{force:!0}:void 0);let Pt=Ci.current.get(Ae);Pt&&(Pt.resolved=!0),Ae===qr.current&&qs(ut=>ut?.generation===Ae?{...ut,settled:!0}:ut)}catch{Ci.current.delete(Ae),Ae===qr.current&&(Ei.current=!0,Aa.current=!1,qs(null))}finally{Ae===qr.current&&Qg(!1)}},[b,x,v,pu,mm,Qn,tt.length,Pi]),DH=(0,y.useCallback)(()=>{zs(!0,!0)},[zs]);(0,y.useLayoutEffect)(()=>{let F=Ci.current;if(F.size===0)return;let Q=e.find(Ft=>!Ft?.id.startsWith("local-"));if(!Q)return;let ve=F.entries().next().value;if(!ve)return;let[Ae,pe]=ve;if(pe.ids.has(Q.id))return;let vt=[];for(let Ft=0;Ft<e.length;Ft++){let sa=e[Ft];if(!sa||!Qr(sa)||pe.ids.has(sa.id))continue;let ot=!1;for(let Pt=Ft+1;Pt<e.length;Pt++){let ut=e[Pt];if(Qr(ut))break;if(pe.ids.has(ut.id)){ot=!0;break}}ot&&vt.push(sa.id)}if(vt.length===0){if(!pe.resolved)return}else lu(Ft=>{let sa=null;for(let ot of vt)Ft.has(ot)||(sa??=new Set(Ft),sa.add(ot));return sa??Ft});F.delete(Ae);for(let Ft of F.values())for(let sa of e)sa&&Ft.ids.add(sa.id)},[e]),(0,y.useEffect)(()=>{let F=dm.current;if(F===void 0||b||qa||Aa.current||(dm.current=void 0,!g||F!==qr.current))return;let Q=Jn();Q&&Q.scrollTop<=X6&&zs(!0)},[Jn,g,zs,b,qa]);let _k=(0,y.useCallback)(()=>{let F=Jn();if(!F)return;let Q=F.scrollTop;g&&Q<=X6&&zs(!0);let ve=Date.now()<=lm.current;if(Ii.current&&!ve){cu.current=Q;return}jl();let Ae=cu.current;cu.current=Q;let pe=F.scrollHeight-Q-F.clientHeight;if(pr(),Q<Ae-1){let vt=pe<xb;ve?(fs(),oa.current=!0,Wt(!1)):vt?(oa.current=!1,Wt(!0)):oa.current||(fs(),Wt(!1));return}pe<xb?(oa.current=!1,Wt(!0),Qd()):fs()},[Jn,g,zs,pr,jl,Qd,fs,Wt]);(0,y.useEffect)(()=>{let F=Jn();if(F)return F.addEventListener("scroll",_k,{passive:!0}),()=>F.removeEventListener("scroll",_k)},[Jn,_k]);let e1=(0,y.useCallback)(()=>{if(!g||b||h||Yd)return;let F=Jn();if(!F||F.scrollHeight>F.clientHeight+1)return;let Q=kk.current;if(Q!==null&&Q.loader===x&&Q.totalVirtualSize===ef){Ei.current=!0;return}kk.current={loader:x,totalVirtualSize:ef},zs()},[h,Jn,g,zs,b,x,Yd,ef]);(0,y.useEffect)(()=>{e1()},[e1,ef]),(0,y.useEffect)(()=>{let F=Jn();if(!F)return;let Q=()=>{if(Mi.current=void 0,!(F.scrollTop>X6)){if(b||Aa.current){dm.current=qr.current;return}zs(!0)}},ve=()=>{Mi.current!==void 0&&cancelAnimationFrame(Mi.current),Mi.current=requestAnimationFrame(Q)},Ae=ot=>{gm(),ot.deltaY<0&&ve()},pe=()=>{gm()},vt=()=>ve(),Ft=ot=>{let Pt=F.getBoundingClientRect(),ut=20;(ot.clientX>=Pt.right-ut||ot.clientY>=Pt.bottom-ut)&&gm()},sa=ot=>{(ot.key==="ArrowUp"||ot.key==="ArrowDown"||ot.key==="PageUp"||ot.key==="PageDown"||ot.key==="Home"||ot.key==="End"||ot.key===" ")&&(gm(),(ot.key==="ArrowUp"||ot.key==="PageUp"||ot.key==="Home")&&ve())};return F.addEventListener("wheel",Ae,{passive:!0}),F.addEventListener("touchstart",pe,{passive:!0}),F.addEventListener("touchmove",vt,{passive:!0}),F.addEventListener("pointerdown",Ft,{passive:!0}),F.addEventListener("keydown",sa,{passive:!0}),()=>{F.removeEventListener("wheel",Ae),F.removeEventListener("touchstart",pe),F.removeEventListener("touchmove",vt),F.removeEventListener("pointerdown",Ft),F.removeEventListener("keydown",sa),Mi.current!==void 0&&(cancelAnimationFrame(Mi.current),Mi.current=void 0)}},[Jn,zs,b,gm]),(0,y.useEffect)(()=>{let F=Jn();if(!F||typeof ResizeObserver>"u")return;let Q=new ResizeObserver(()=>{pr(),e1(),!(qn.current||oa.current)&&(Wt(!0),er())});Q.observe(F);for(let Ae of Array.from(F.children))Q.observe(Ae);let ve=new MutationObserver(Ae=>{for(let pe of Ae){for(let vt of Array.from(pe.addedNodes))vt instanceof HTMLElement&&Q.observe(vt);for(let vt of Array.from(pe.removedNodes))vt instanceof HTMLElement&&Q.unobserve(vt)}pr()});return ve.observe(F,{childList:!0}),pr(),()=>{Q.disconnect(),ve.disconnect()}},[Jn,e1,pr,er,Wt]),(0,y.useEffect)(()=>{e.length===0&&(oa.current=!1,uu.current=!1,Wt(!0),mu.current=null,Ci.current.clear(),at.current=void 0,wt.current=void 0,iu(F=>F.size?new Map:F),lu(F=>F.size?new Set:F))},[e.length,Wt]),(0,y.useEffect)(()=>{let F=Ut.current;if(!F)return;let Q=new ResizeObserver(()=>{jl(),!qn.current&&(oa.current||(Wt(!0),requestAnimationFrame(()=>{!qn.current&&!oa.current&&er()})))});return Q.observe(F),()=>Q.disconnect()},[er,jl,Wt]),(0,y.useLayoutEffect)(()=>{let F=ILe(e);if(h||m||ce.current){du.current=F,Vd.current=!0,B.current=!1,ce.current=m;return}if(ce.current=m,!Vd.current){du.current=F,Vd.current=!0,B.current=!1;return}let Q=_Le(e);F&&Q?.role==="user"&&F!==du.current?(oa.current=!1,Wt(!0),mu.current=null,B.current=!0):B.current=!1,du.current=F},[e,h,m,Wt]),(0,y.useLayoutEffect)(()=>{go.current&&!h&&!oa.current&&(Wt(!0),er("auto")),go.current=h},[h,er,Wt]),(0,y.useLayoutEffect)(()=>{if(m){fe.current=!0;return}if(!fe.current||h||e.length===0)return;fe.current=!1,oa.current=!1,Wt(!0),mu.current=null,Ue.current!==void 0&&window.cancelAnimationFrame(Ue.current),ct.current!==void 0&&window.cancelAnimationFrame(ct.current);let F=()=>{qn.current||oa.current||(Wt(!0),er("auto"))};Ue.current=window.requestAnimationFrame(()=>{Ue.current=void 0,F(),ct.current=window.requestAnimationFrame(()=>{ct.current=void 0,F()})})},[h,m,e.length,er,Wt]),(0,y.useLayoutEffect)(()=>{let F=wa.current!==re;wa.current=re,F&&(h||oa.current||(Wt(!0),requestAnimationFrame(()=>{!qn.current&&!oa.current&&er("auto")})))},[re,h,er,Wt]);let t1=(0,y.useMemo)(()=>QLe(rn),[rn]);(0,y.useLayoutEffect)(()=>{if(!h){if(!t1){fr.current=null;return}t1!==fr.current&&(fr.current=t1,(ql.current||!oa.current)&&requestAnimationFrame(()=>{oa.current||(Wt(!0),er())}))}},[h,t1,er,Wt]),(0,y.useEffect)(()=>{G&&ds&&!Ai.current&&(oa.current=!1,Wt(!0),requestAnimationFrame(()=>{oa.current||er()})),Ai.current=ds},[G,ds,er,Wt]);let Q7=(0,y.useCallback)(F=>{let Q=pe=>{if(pe.type==="parallel_agents")return(0,c.jsx)(t9,{timestamp:pe.timestamp,children:(0,c.jsx)("div",{className:az(pe,vm)?Ol.flash:void 0,children:(0,c.jsx)(FU,{agents:pe.agents,autoManageExpansion:Z==="interactive"&&!h,automaticCollapseDelayMs:em.key===pe.key&&!Ca?CLe:void 0,deferAutomaticCollapse:em.key===pe.key&&Ca,expandActiveWhenLive:S&&Bg.has(pe.key),onAutomaticExpansionChange:_n=>tm(pe.key,_n),pendingApproval:o})})});if(pe.type==="turn_outputs")return(0,c.jsx)(k_e,{changes:pe.changes,turnId:pe.turnId,artifacts:pe.artifacts,sourceSessionId:xe,scheduledTasks:pe.scheduledTasks,workspaceCwd:N,onOpenRequest:lt,onReviewChanges:ke??j6,onOpenArtifact:Ce??j6,onOpenScheduledTask:ze??j6,onError:ta});if(pe.type==="turn_collapse")return(0,c.jsx)(SAe,{turnCollapse:pe.turnCollapse,onToggleCollapse:G7});let vt=pe.message.role==="assistant"?nu.get(pe.message.id):void 0,Ft;pe.message.role==="assistant"&&vt&&!a&&(Ft={turnId:vt,message:{id:pe.message.id,content:pe.message.content,isStreaming:pe.message.isStreaming,timestamp:pe.message.timestamp}});let sa=vt?Wg.get(vt):void 0,ot=pe.message.promptId??sa?.promptId,Pt=pe.message.role==="assistant"&&pe.message.agentMessage?.kind==="agent_message",ut=pe.message.role==="assistant"&&!Pt?pe.message.branchRecordId:void 0,Ra=pe.message.role==="user"?pe.message.content:void 0,Ta=Ra!==void 0&&pe.message.id===ge.lastId&&!S&&!g&&!w?{turnIndex:ge.turnIndexById.get(pe.message.id)??0,content:Ra}:void 0;return(0,c.jsx)(OIe,{message:pe.message,onLocateBackgroundSource:pe.message.role==="system"&&pe.message.source==="background_notification_turn_started"&&pe.message.backgroundTurn?.toolUseId&&kb(Ge,"",pe.message.backgroundTurn.toolUseId)>=0?ym:void 0,onDeleteMessage:t&&(t.active||!t.disabled)&&t.canDelete(pe.message)&&(pe.message.role==="user"||pe.message.localCommandId)&&(pe.message.promptId||pe.message.sourceRecordIds?.length||pe.message.localCommandId)?()=>t.start(pe.message):void 0,deleteMessageDisabled:t?.active,pendingApproval:o,onShowContextDetail:s,onOpenMemoryFile:i,onImagePreview:l,onAttachmentPreview:u,onTurnOutputOpen:lt,onToolResultOpen:zt,onInsightReportOpen:d,onEditUserMessage:f&&Ta?()=>f(Ta.turnIndex,Ta.content):void 0,onSubmitUserMessageEdit:p&&Ta?_n=>p(Ta.turnIndex,_n):void 0,workspaceCwd:N,showRetryHint:O,onRetryClick:ee,sendFailed:pe.message.role==="user"&&pe.message.id===de,onRetrySend:ye,onBranchSession:oe,branchRecordId:ut,showAssistantActions:pe.message.role==="assistant"&&(Pt||nu.has(pe.message.id)),assistantFooterAlwaysVisible:!S&&vt!==void 0&&vt===Ug,showAssistantBranch:pe.message.role==="assistant"&&!Pt&&!S&&ut!==void 0,assistantFeedbackTurnId:ou&&!Pt?vt:void 0,assistantFeedbackPromptId:ou&&!Pt?ot:void 0,assistantFeedbackRating:ou&&!Pt&&ot?jg[ot]:void 0,onAssistantFeedbackRate:Kg,isLocateFlashing:az(pe,vm),assistantTurnFooterInfo:Ft,turnSources:vt?Wd.get(vt):void 0,onSourceOpen:be,generateContent:ha})};if(Ul&&F===K6)return R;if(ds&&F===fu)return q;let ve=F-Qn,Ae=rn[ve];return Ae?Q(Ae):null},[Ul,R,ds,q,fu,o,h,S,Ca,Bg,em,Z,tm,s,i,Ge,ym,l,u,d,f,t,p,ge,g,w,ha,Qn,rn,vm,nu,Ug,ou,Wg,jg,Kg,a,N,O,ee,de,ye,oe,G7,xe,Ce,ze,ke,lt,zt,Wd,be,ta]),J7=(0,y.useCallback)(F=>F?CAe(F):void 0,[]),eT=Pi?ef:e;(0,y.useLayoutEffect)(()=>{if(h)return;let F=B.current;if(Ii.current&&!F){oa.current||(uu.current=!0);return}Ri.current&&!F||(ql.current||F||!oa.current)&&(oa.current||Wt(!0),er(F?"smooth":"auto"),B.current=!1)},[eT,hm,h,er,Wt]),(0,y.useLayoutEffect)(()=>{pr()},[eT,pr,hm]);let tT=(0,y.useMemo)(()=>{let F=new Map;if(!t?.active)return F;let Q=pe=>{let vt=pe.type==="message"?pe.message.id:pe.type==="turn_collapse"?pe.turnCollapse.turnId:pe.turnId;return t.groupByMessage.get(vt)??t.groupByMessage.get(dg(vt)??vt)},ve=new Set;for(let pe of rn)if(pe.type==="turn_collapse"&&wH(pe.turnCollapse)){let vt=Q(pe),Ft=vt??pe.turnCollapse.turnId;ve.has(Ft)||(F.set(pe,vt),ve.add(Ft))}let Ae="unowned";for(let pe of rn){if(pe.type==="turn_collapse"||pe.type==="turn_outputs")continue;let vt=Q(pe);if(pe.type==="message"&&Qr(pe.message))Ae=pe.message.id,F.set(pe,vt);else{let Ft=vt??Ae;ve.has(Ft)||(F.set(pe,vt),ve.add(Ft))}}return F},[t,rn]),aT=F=>{if(!t?.active||!F||!tT.has(F))return null;let Q=tT.get(F);return(0,c.jsx)(Ed,{className:At.deletionCheckbox,"aria-label":ne("messageDelete.selectGroup"),title:Q?void 0:ne("messageDelete.unavailable"),checked:Q?t.selected.has(Q):!1,disabled:!Q||t.disabled||!t.allowed.has(Q),onCheckedChange:()=>{Q&&t.toggle(Q)}})};return(0,c.jsx)(ok.Provider,{value:je,children:(0,c.jsxs)("div",{ref:Ut,className:z9(At.list,t?.active?At.deletionMode:void 0,Ul&&P?At.listWithWelcomeHeader:void 0),"data-web-shell-message-list":!0,onClickCapture:PH,children:[Yd&&(0,c.jsx)(AAe,{label:ne("editor.sessionLoading")}),b&&!Yd&&!_H&&(0,c.jsx)("div",{className:At.historyStatus,role:"status",children:ne("history.loadingEarlier")}),w&&!Yd&&(0,c.jsx)("div",{className:At.historyStatus,role:"status",children:ne("history.capacityReached")}),v&&!Yd&&!w&&(0,c.jsxs)("div",{className:At.historyStatus,children:[(0,c.jsx)("span",{role:"status",children:ne("history.paginationError")}),x&&(0,c.jsx)("button",{type:"button",className:At.historyRetryButton,onClick:DH,children:ne("history.retry")})]}),(0,c.jsx)(_Ae,{action:V,entries:Bs,currentTurnId:gk,currentRange:nm,hidden:!$l||!EH,onSelect:ym}),Pi?(0,c.jsx)("div",{ref:ps.containerRef,className:At.virtualSizer,children:K7.map(F=>(0,c.jsxs)("div",{"data-index":F.index,ref:OH,className:z9(At.virtualRow,J7(rn[F.index-Qn])),"data-message-row-key":String(pu(F.index)),"data-source-block-ids":nz(rn[F.index-Qn],e),"data-web-shell-message-row":!0,style:{position:"absolute",top:0,left:0,right:0},children:[aT(rn[F.index-Qn]),Q7(F.index)]},F.key))}):Array.from({length:hm},(F,Q)=>{let ve=pu(Q),Ae=rn[Q-Qn];return(0,c.jsxs)("div",{"data-index":Q,className:J7(Ae),"data-message-row-key":String(ve),"data-source-block-ids":nz(Ae,e),"data-web-shell-message-row":!0,children:[aT(Ae),Q7(Q)]},ve)})]})})})),iz={title:"Something went wrong",body:"An unexpected error occurred and this content could not be displayed.",retry:"Try again",reload:"Reload page"},lz={en:iz,"zh-CN":{title:"出了点问题",body:"发生意外错误,无法显示此内容。",retry:"重试",reload:"重新加载"},ru:iz},EAe={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},MAe={margin:0,fontSize:"1rem",fontWeight:600},PAe={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},NAe={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 OAe({error:e,onRetry:t,language:a="en",retryMode:n="reset"}){let r=lz[a]??lz.en;return(0,c.jsxs)("div",{role:"alert",style:EAe,"data-web-shell-error":!0,children:[(0,c.jsx)("p",{style:MAe,children:r.title}),(0,c.jsx)("p",{style:PAe,children:r.body}),!1,(0,c.jsx)("button",{type:"button",style:NAe,onClick:t,children:n==="reload"?r.reload:r.retry})]})}function DAe(e,t,a=!1){return eye(e,{safeToolProjection:a,includeSourceIdentity:!0,labels:{promptCancelled:t("request.cancelled"),branchSuccess:n=>t("branch.success",{name:n}),modelStreamInterrupted:t("error.modelStreamInterrupted"),loopDetected:t("error.loopDetected"),loopDetectedFor:n=>$Ae(n,t)}})}function $Ae(e,t){let a=e.toolCallLimit;switch(e.loopType){case"turn_tool_call_cap":if(a===void 0)return;switch(e.loopReason){case"explicit_cap":return t("error.loopDetected.explicitCap",{limit:a});case"backstop":return t("error.loopDetected.backstop",{limit:a});case"stuck_repetition":return t("error.loopDetected.stuckRepetition",{limit:a});default:return}case"global_tool_call_duplicate":switch(e.loopReason){case"repeated_call":return t("error.loopDetected.repeatedCall");case"provider_duplicate_id":return t("error.loopDetected.providerDuplicateId");default:return}case"invalid_tool_params_stagnation":return t("error.loopDetected.invalidToolParams");case"repeated_tool_execution_failure":return t("error.loopDetected.repeatedToolFailure");default:return}}var BAe="_app_bt90j_1",FAe="_appChat_bt90j_66",qAe="_content_bt90j_120",zAe="_themeDark_bt90j_435",UAe="_themeLight_bt90j_509",jAe="_contentHasMessages_bt90j_591",qp={app:BAe,appChat:FAe,content:qAe,themeDark:zAe,themeLight:UAe,contentHasMessages:jAe},HAe=1e3,WAe=40;function bH(e){if(e!==void 0)return tF(e);if(typeof window>"u")return"en";let t=new URLSearchParams(window.location.search);return tF(t.get("language")??t.get("lang")??navigator.language)}function GAe(e){let t=`${typeof e=="number"&&Number.isFinite(e)&&e>0?e:HAe}px`,a=`calc(${t} + ${WAe}px)`;return{"--chat-regular-content-width":t,"--chat-regular-shell-width":a,"--chat-content-width":t,"--chat-shell-width":a}}function VAe({blocks:e,renderMode:t="readonly",theme:a=Q0.Dark,language:n,className:r,style:o,chatMaxWidth:s,workspaceCwd:i="",compactThinking:l=!1,documentExpanded:u=!0,collapseCompletedTurns:d,markdownTableMode:f="basic",virtualScrollThreshold:p,markdown:m,sourceSessionId:h,sources:g,sourceAttachments:b,sourceReferences:w,getAssistantSourcesIcon:v,onSourceOpen:x,composerTagIcons:T,artifact:I,renderToolHeaderExtra:L,parseUserMessageContent:S,renderUserMessageContent:C,renderComposerTag:E,renderComposerTagTooltip:R,renderAssistantTurnFooter:P,mcpAppBaseUrl:N}){let q=t==="document",H=!q&&(d??!0),z=q?"basic":f,G=bH(n),re=(0,y.useMemo)(()=>gz(G),[G]),X=(0,y.useMemo)(()=>DAe(e,re,q),[e,q,re]),V=(0,y.useMemo)(()=>Gle(g??[],b??[]),[g,b]),A=(0,y.useMemo)(()=>$ve(X),[X]),$=(0,y.useMemo)(()=>Eve(X),[X]),K=(0,y.useMemo)(()=>({artifact:I,composerTagIcons:T,renderToolHeaderExtra:L,parseUserMessageContent:S,renderUserMessageContent:C,renderComposerTag:E,renderComposerTagTooltip:R,renderAssistantTurnFooter:P,compactThinking:l,collapseCompletedTurns:H,markdownTableMode:z,markdown:m,sourceReferences:w,getAssistantSourcesIcon:v}),[I,H,l,T,m,w,v,z,S,P,E,R,L,C]),O=(0,y.useRef)(null),[ee,de]=(0,y.useState)(null),ye=(0,y.useRef)(new Set),oe=[qp.app,qp.appChat,a===Q0.Light?qp.themeLight:qp.themeDark,a===Q0.Dark?"dark":void 0,r].filter(Boolean).join(" "),te=(0,y.useMemo)(()=>({...o,...GAe(s)}),[s,o]);return(0,y.useLayoutEffect)(()=>{if(typeof document>"u")return;let le=document.createElement("div");return le.dataset.webShellPortalRoot="",le.dataset.webShellShadcn="",document.body.appendChild(le),de(le),()=>{le.remove(),de(null)}},[]),(0,y.useLayoutEffect)(()=>{let le=O.current;if(!le||!ee)return;let J=null,_e=()=>{J=null;let W=getComputedStyle(le),ke=new Set;ee.dataset.webShellShadcn="",ee.classList.toggle("dark",a===Q0.Dark),ee.lang=G;for(let Ce=0;Ce<W.length;Ce+=1){let ze=W[Ce];ze.startsWith("--")&&(ke.add(ze),ee.style.setProperty(ze,W.getPropertyValue(ze)))}for(let Ce of ye.current)ke.has(Ce)||ee.style.removeProperty(Ce);ye.current=ke},xe=()=>{J===null&&(J=requestAnimationFrame(_e))};_e();let je=new MutationObserver(xe),be=le;for(;be;)je.observe(be,{attributes:!0,attributeFilter:["class","style","data-theme","lang"]}),be=be.parentElement;return window.addEventListener("resize",xe),()=>{je.disconnect(),window.removeEventListener("resize",xe),J!==null&&cancelAnimationFrame(J)}},[ee,G,oe,te,a]),(0,c.jsx)(vde,{value:a,children:(0,c.jsx)(tue,{language:G,children:(0,c.jsx)(wU.Provider,{value:N,children:(0,c.jsx)(yz.Provider,{value:ee,children:(0,c.jsx)(aue,{value:t,children:(0,c.jsx)(nue,{value:u,children:(0,c.jsx)(Zle,{value:K,children:(0,c.jsx)(Xle,{timeline:$,details:A,children:(0,c.jsx)(U9.Provider,{value:!1,children:(0,c.jsx)("div",{ref:O,className:oe,style:te,"data-web-shell-root":!0,"data-web-shell-shadcn":!0,"data-transcript-render-mode":t,"data-document-expanded":q?String(u):void 0,lang:G,children:(0,c.jsx)("div",{className:`${qp.content} ${qp.contentHasMessages}`,children:(0,c.jsx)(RAe,{messages:X,sourceSessionId:h,sourceEntries:q?void 0:V,onSourceOpen:x,pendingApproval:null,isResponding:!1,workspaceCwd:i,virtualScrollThreshold:q?Number.MAX_SAFE_INTEGER:p,hideSessionTimeline:q})})})})})})})})})})})})}function kH(e){let t=bH(e.language);return(0,c.jsx)($d,{label:"web-shell-transcript-root",resetKeys:[e.blocks,t],fallback:(a,n)=>(0,c.jsx)(OAe,{error:a,onRetry:n,language:t}),children:(0,c.jsx)(VAe,{...e})})}var yt=Fe(Ya(),1),CH="qwen-export-theme";function jd(e){return e===void 0||typeof e=="string"}function Hd(e){return e===void 0||typeof e=="number"&&Number.isFinite(e)&&e>=0}function KAe(){let e=document.getElementById("transcript-document");if(!(e instanceof HTMLScriptElement))throw new Error("Transcript document envelope is missing.");let t=e.textContent??"";if(t.length>33554432)throw new Error("Transcript document exceeds the envelope budget.");if(new TextEncoder().encode(t).byteLength>33554432)throw new Error("Transcript document exceeds the envelope budget.");let a=JSON.parse(t);if(a.schemaVersion!==1||a.rendererVersion!=="0.26.6+b809ea07d6b8f389"||!Array.isArray(a.blocks)||a.blocks.length>1e3||!a.metadata||typeof a.metadata!="object"||Array.isArray(a.metadata)||!jd(a.metadata.title)||!jd(a.metadata.startedAt)||!jd(a.metadata.projectName)||!jd(a.metadata.repository)||!jd(a.metadata.gitBranch)||!jd(a.metadata.model)||!jd(a.metadata.channel)||!Hd(a.metadata.promptCount)||!Hd(a.metadata.contextUsagePercent)||!Hd(a.metadata.contextWindowSize)||!Hd(a.metadata.totalTokens)||!Hd(a.metadata.filesWritten)||!Hd(a.metadata.linesAdded)||!Hd(a.metadata.linesRemoved)||typeof a.metadata.exportedAt!="string"||typeof a.metadata.complete!="boolean"||typeof a.metadata.truncated!="boolean")throw new Error("Transcript document is incompatible with this renderer.");return a}function XAe(){try{let e=localStorage.getItem(CH);if(e==="light"||e==="dark")return e}catch{}return"dark"}function xH(e){if(!e)return;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function ZAe(e){if(e!==void 0)return e>=1e6?`${e/1e6}m`:e>=1e3?`${e/1e3}k`:String(e)}function po({label:e,value:t}){return t===void 0||t===""?null:(0,yt.jsxs)("div",{className:"document-metadata-item",children:[(0,yt.jsx)("dt",{children:e}),(0,yt.jsx)("dd",{children:t})]})}function YAe({metadata:e}){let t=e.contextUsagePercent===void 0?void 0:`${e.contextUsagePercent>100?">100":e.contextUsagePercent}%${e.contextWindowSize===void 0?"":` of ${ZAe(e.contextWindowSize)}`}`;return(0,yt.jsxs)("aside",{className:"document-metadata","data-document-metadata":!0,children:[(0,yt.jsxs)("section",{children:[(0,yt.jsx)("h2",{children:"Session Info"}),(0,yt.jsxs)("dl",{children:[(0,yt.jsx)(po,{label:"Session",value:e.title??"Qwen Code Chat Export"}),(0,yt.jsx)(po,{label:"Started",value:xH(e.startedAt)}),(0,yt.jsx)(po,{label:"Exported",value:xH(e.exportedAt)}),(0,yt.jsx)(po,{label:"Project",value:e.projectName}),(0,yt.jsx)(po,{label:"Repository",value:e.repository}),(0,yt.jsx)(po,{label:"Branch",value:e.gitBranch}),(0,yt.jsx)(po,{label:"Model",value:e.model}),(0,yt.jsx)(po,{label:"Channel",value:e.channel})]})]}),(0,yt.jsxs)("section",{children:[(0,yt.jsx)("h2",{children:"Statistics"}),(0,yt.jsxs)("dl",{children:[(0,yt.jsx)(po,{label:"Prompts",value:e.promptCount}),(0,yt.jsx)(po,{label:"Context Usage",value:t}),(0,yt.jsx)(po,{label:"Tokens",value:e.totalTokens?.toLocaleString()})]})]}),(0,yt.jsxs)("section",{children:[(0,yt.jsx)("h2",{children:"File Operations"}),(0,yt.jsxs)("dl",{children:[(0,yt.jsx)(po,{label:"Files modified",value:e.filesWritten}),(0,yt.jsx)(po,{label:"Lines added",value:e.linesAdded}),(0,yt.jsx)(po,{label:"Lines removed",value:e.linesRemoved})]})]})]})}function QAe({value:e}){let[t,a]=(0,mo.useState)(XAe),[n,r]=(0,mo.useState)(!0),o=(0,mo.useRef)(n),s=(0,mo.useRef)(null);return(0,mo.useEffect)(()=>{document.documentElement.classList.toggle("dark",t==="dark"),document.documentElement.classList.toggle("light",t==="light");try{localStorage.setItem(CH,t)}catch{}},[t]),(0,mo.useEffect)(()=>{o.current=n},[n]),(0,mo.useEffect)(()=>{let i=()=>{s.current=o.current,(0,z7.flushSync)(()=>r(!0))},l=()=>{let u=s.current;s.current=null,u!==null&&(0,z7.flushSync)(()=>r(u))};return addEventListener("beforeprint",i),addEventListener("afterprint",l),()=>{removeEventListener("beforeprint",i),removeEventListener("afterprint",l)}},[]),(0,mo.useEffect)(()=>{document.title=e.metadata.title||"Qwen Code Chat Export",requestAnimationFrame(()=>{document.body.dataset.renderComplete="true"})},[e.metadata.title]),(0,yt.jsxs)("main",{className:"document-shell",children:[(0,yt.jsxs)("header",{className:"document-header",children:[(0,yt.jsxs)("div",{children:[(0,yt.jsx)("h1",{children:e.metadata.title||"Qwen Code Chat Export"}),(0,yt.jsx)("p",{children:e.metadata.startedAt?`Started ${e.metadata.startedAt}`:`Exported ${e.metadata.exportedAt}`})]}),(!e.metadata.complete||e.metadata.truncated)&&(0,yt.jsx)("span",{className:"document-warning",children:"Partial export"}),(0,yt.jsxs)("div",{className:"document-actions","aria-label":"Document controls",children:[(0,yt.jsx)("button",{type:"button","data-document-expand-all":!0,disabled:n,onClick:()=>r(!0),children:"Expand all"}),(0,yt.jsx)("button",{type:"button","data-document-collapse-all":!0,disabled:!n,onClick:()=>r(!1),children:"Collapse all"}),(0,yt.jsx)("button",{type:"button","data-document-theme-toggle":!0,"aria-label":`Switch to ${t==="dark"?"light":"dark"} theme`,onClick:()=>a(i=>i==="dark"?"light":"dark"),children:t==="dark"?"Light theme":"Dark theme"})]})]}),(0,yt.jsxs)("div",{className:"document-content",children:[(0,yt.jsx)("div",{className:"document-transcript",children:(0,yt.jsx)(kH,{blocks:e.blocks,renderMode:"document",compactThinking:!0,documentExpanded:n,theme:t})}),(0,yt.jsx)(YAe,{metadata:e.metadata})]})]})}function TH(){return(0,mo.useEffect)(()=>{document.body.dataset.renderComplete="error"},[]),(0,yt.jsxs)("main",{className:"document-error",role:"alert",children:[(0,yt.jsx)("h1",{children:"Unable to open this chat export"}),(0,yt.jsx)("p",{children:"The file is incomplete or uses an incompatible renderer version."})]})}var U7=class extends mo.Component{constructor(){super(...arguments);this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,yt.jsx)(TH,{}):this.props.children}},IH=document.getElementById("app");if(!IH)throw new Error("Transcript document root is missing.");if(document.body.dataset.renderComplete!=="error"){let e=(0,SH.createRoot)(IH);try{e.render((0,yt.jsx)(U7,{children:(0,yt.jsx)(QAe,{value:KAe()})}))}catch{e.render((0,yt.jsx)(TH,{}))}}})();