@qwen-code/qwen-code 0.25.4-preview.0 → 0.25.4-preview.1

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 (306) hide show
  1. package/bundled/browser-use/runtime/native-host.js +0 -0
  2. package/bundled/browser-use/runtime/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh +0 -0
  3. package/bundled/browser-use/runtime/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh +0 -0
  4. package/bundled/browser-use/runtime/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh +0 -0
  5. package/bundled/browser-use/runtime/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh +0 -0
  6. package/bundled/browser-use/runtime/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh +0 -0
  7. package/bundled/browser-use/runtime/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh +0 -0
  8. package/bundled/browser-use/runtime/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh +0 -0
  9. package/bundled/browser-use/runtime/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh +0 -0
  10. package/bundled/browser-use/runtime/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh +0 -0
  11. package/bundled/browser-use/runtime/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh +0 -0
  12. package/bundled/browser-use/runtime/node_modules/playwright-core/cli.js +0 -0
  13. package/bundled/browser-use/runtime/node_modules/playwright-core/lib/webp_codec.wasm +0 -0
  14. package/bundled/browser-use/runtime/node_modules/playwright-core/lib/xdg-open +0 -0
  15. package/bundled/browser-use/runtime/scripts/native-host-setup.js +0 -0
  16. package/chunks/{MaxSizedBox-M27H235V.js → MaxSizedBox-E4RKSA7W.js} +1 -1
  17. package/chunks/{StandaloneSessionPicker-LWWDDYOW.js → StandaloneSessionPicker-2D3UKLVS.js} +1 -1
  18. package/chunks/{acp-subagent-executor-NUV52JVS.js → acp-subagent-executor-UQYUN6AB.js} +1 -1
  19. package/chunks/{acpAgent-IUJDXLZM.js → acpAgent-P7WGK2BP.js} +3 -3
  20. package/chunks/{advisor-MSOUBMJ6.js → advisor-GCH2MBXT.js} +1 -1
  21. package/chunks/{agent-H7XIWYWQ.js → agent-57T4YAYP.js} +1 -1
  22. package/chunks/{agent-headless-XDN3D3S3.js → agent-headless-IBON3A7N.js} +1 -1
  23. package/chunks/{agent-host-client-AZP3PZXS.js → agent-host-client-LE7P72FR.js} +1 -1
  24. package/chunks/{agent-host-connections-JRVX7I6I.js → agent-host-connections-4DM57L26.js} +1 -1
  25. package/chunks/{anthropicContentGenerator-N7TV53LD.js → anthropicContentGenerator-C4TPFXUK.js} +1 -1
  26. package/chunks/{batch-MKSJFJUH.js → batch-YJJGMJWO.js} +1 -1
  27. package/chunks/{bridge-GNMKKHQ4.js → bridge-FIO2ENBG.js} +1 -1
  28. package/chunks/{channel-settings-store-Y4YCS7JX.js → channel-settings-store-TEBCLK2B.js} +1 -1
  29. package/chunks/{chunk-GPOUP5OK.js → chunk-27MTSS3T.js} +1 -1
  30. package/chunks/{chunk-C4ANA47H.js → chunk-2MGCRPM3.js} +1 -1
  31. package/chunks/{chunk-6DQNNRRC.js → chunk-2WBKWPSO.js} +1 -1
  32. package/chunks/{chunk-CATL2PQS.js → chunk-34WLYVDK.js} +5 -5
  33. package/chunks/{chunk-B7CXPNCV.js → chunk-3J2YNEHG.js} +1 -1
  34. package/chunks/{chunk-VTNHPXNL.js → chunk-3TBFTELA.js} +1 -1
  35. package/chunks/{chunk-7JT34VGK.js → chunk-46I6JBVL.js} +1 -1
  36. package/chunks/{chunk-FEMWELCV.js → chunk-4ZKFLOEH.js} +1 -1
  37. package/chunks/{chunk-7AYXAVTZ.js → chunk-5DUJIOOX.js} +3 -3
  38. package/chunks/{chunk-6QLHJSVW.js → chunk-6PWOLWTH.js} +1 -1
  39. package/chunks/{chunk-OW4QBRSR.js → chunk-6UZ65Z2P.js} +1 -1
  40. package/chunks/{chunk-V2JZO5MS.js → chunk-7DSJE3CL.js} +1 -1
  41. package/chunks/{chunk-TJMHIEYI.js → chunk-7LCY7GGX.js} +1 -1
  42. package/chunks/{chunk-TLJHBK3A.js → chunk-7RNTXEWH.js} +1 -1
  43. package/chunks/{chunk-YZ7OO4AQ.js → chunk-A3IF6IOB.js} +1 -1
  44. package/chunks/{chunk-VTF6AVZB.js → chunk-A6OQSOUO.js} +1 -1
  45. package/chunks/{chunk-Y7YDHCON.js → chunk-AJ6JUUP7.js} +1 -1
  46. package/chunks/{chunk-QTMHQGWQ.js → chunk-AOMEBVFW.js} +1 -1
  47. package/chunks/{chunk-KVTG2ZNH.js → chunk-AUNAS7AS.js} +1 -1
  48. package/chunks/{chunk-BOFD4CN3.js → chunk-AVIDPC5K.js} +1 -1
  49. package/chunks/{chunk-ETYTRKB2.js → chunk-BOLPBPWC.js} +1 -1
  50. package/chunks/{chunk-OAPA66DR.js → chunk-BQQBFDBY.js} +1 -1
  51. package/chunks/{chunk-NOS2CNOI.js → chunk-CN22ATWU.js} +1 -1
  52. package/chunks/{chunk-XYBEQRSZ.js → chunk-DIHJELGW.js} +1 -1
  53. package/chunks/{chunk-XCEL3EDX.js → chunk-DJFCI7TU.js} +1 -1
  54. package/chunks/{chunk-VKEL2XTM.js → chunk-DQPDMFS3.js} +1 -1
  55. package/chunks/{chunk-DJRFEZBY.js → chunk-DSYKB77N.js} +1 -1
  56. package/chunks/{chunk-UEW7Q26E.js → chunk-EDNOGHMN.js} +2 -2
  57. package/chunks/{chunk-RXNGYG64.js → chunk-EE36D2EV.js} +1 -1
  58. package/chunks/{chunk-NZKX7HYL.js → chunk-EGQDN3FJ.js} +1 -1
  59. package/chunks/{chunk-DFRSQK5Q.js → chunk-FHFBCG6N.js} +1 -1
  60. package/chunks/{chunk-PECV2VVZ.js → chunk-GI6T3RBV.js} +1 -1
  61. package/chunks/{chunk-37BNHIUB.js → chunk-GOLT5JXA.js} +1 -1
  62. package/chunks/{chunk-KITFF4GL.js → chunk-IDGXHMNL.js} +1 -1
  63. package/chunks/{chunk-6HIOSLUM.js → chunk-IIZWK7ZP.js} +1 -1
  64. package/chunks/{chunk-MPGEAX4K.js → chunk-IJC6ZH2S.js} +1 -1
  65. package/chunks/{chunk-TLYJVB5H.js → chunk-IO6LSEPV.js} +1 -1
  66. package/chunks/{chunk-QIJKEZZR.js → chunk-IYVNCBMS.js} +1 -1
  67. package/chunks/{chunk-S4GOHFRN.js → chunk-JHGOWK7M.js} +1 -1
  68. package/chunks/{chunk-GHRD2MMC.js → chunk-JRJY343T.js} +1 -1
  69. package/chunks/{chunk-WCYZSCG7.js → chunk-JVUXQU3W.js} +1 -1
  70. package/chunks/{chunk-DMCTJUIJ.js → chunk-K2K2YYWO.js} +1 -1
  71. package/chunks/{chunk-37OHWQHB.js → chunk-KF6HU732.js} +2 -2
  72. package/chunks/{chunk-5LSV73BG.js → chunk-KVWUOBH7.js} +1 -1
  73. package/chunks/{chunk-7V4BAHFT.js → chunk-LBWBGFHD.js} +1 -1
  74. package/chunks/{chunk-RKPHDO42.js → chunk-LDXZT3SG.js} +5 -5
  75. package/chunks/{chunk-BGFA2SAQ.js → chunk-LFOZ6AIH.js} +1 -1
  76. package/chunks/{chunk-4322TZID.js → chunk-LGQHT42X.js} +2 -2
  77. package/chunks/{chunk-PDXZ2CUO.js → chunk-M3O2XDHA.js} +1 -1
  78. package/chunks/{chunk-47K2NMP6.js → chunk-M3UC46LS.js} +1 -1
  79. package/chunks/{chunk-UFRY7WND.js → chunk-M7JLPTQI.js} +1 -1
  80. package/chunks/{chunk-SATEKHQP.js → chunk-MBUXP3IS.js} +1 -1
  81. package/chunks/{chunk-RN6JS263.js → chunk-MEZA3VVH.js} +1 -1
  82. package/chunks/{chunk-OBFKP7RI.js → chunk-MWN6TR36.js} +1 -1
  83. package/chunks/{chunk-VHJ43ZYJ.js → chunk-O7XRQWCG.js} +1 -1
  84. package/chunks/{chunk-H224LNV3.js → chunk-OYFRLT5E.js} +1 -1
  85. package/chunks/{chunk-3NWFV2YF.js → chunk-PMBGV76N.js} +1 -1
  86. package/chunks/{chunk-YFAPACDE.js → chunk-PVM4IVFL.js} +6 -6
  87. package/chunks/{chunk-7WS2EYMQ.js → chunk-PWHD4NK3.js} +1 -1
  88. package/chunks/{chunk-JZIQSEFO.js → chunk-Q54NROBX.js} +1 -1
  89. package/chunks/{chunk-FCLAPJ22.js → chunk-QE7R4DPT.js} +1 -1
  90. package/chunks/{chunk-J6TW7GNF.js → chunk-QIUTQICH.js} +1 -1
  91. package/chunks/{chunk-TWDCN5H2.js → chunk-QK63EULE.js} +1 -1
  92. package/chunks/{chunk-HZZT75LI.js → chunk-QTAC4W7J.js} +1 -1
  93. package/chunks/{chunk-P7DIAJNX.js → chunk-R7HBR4QQ.js} +1 -1
  94. package/chunks/{chunk-U2FJSKS3.js → chunk-RHEMFKMX.js} +1 -1
  95. package/chunks/{chunk-TRRY3QMM.js → chunk-RL57IU47.js} +1 -1
  96. package/chunks/{chunk-SPWDYRDH.js → chunk-S2OOQRLJ.js} +1 -1
  97. package/chunks/{chunk-QBRADQ7L.js → chunk-SWTMWNTZ.js} +1 -1
  98. package/chunks/{chunk-AZUDF52L.js → chunk-SXTKQHFZ.js} +1 -1
  99. package/chunks/{chunk-5RQRSPPD.js → chunk-T5S3MJIK.js} +1 -1
  100. package/chunks/{chunk-I3ORWQ2U.js → chunk-UDGDEIBB.js} +1 -1
  101. package/chunks/{chunk-EMDEBV33.js → chunk-UIFBF3E7.js} +1 -1
  102. package/chunks/{chunk-BGEMWNES.js → chunk-UQDPWI7D.js} +1 -1
  103. package/chunks/{chunk-I5LKOTZT.js → chunk-VON4MVIM.js} +1 -1
  104. package/chunks/{chunk-HJPO6MEW.js → chunk-W5D2T2JK.js} +1 -1
  105. package/chunks/{chunk-F6YYDRMH.js → chunk-WNGYYU67.js} +1 -1
  106. package/chunks/{chunk-S2GKUZZZ.js → chunk-WO3F62ZD.js} +1 -1
  107. package/chunks/{chunk-K7KW3ZJQ.js → chunk-WVY5Q6YY.js} +1 -1
  108. package/chunks/{chunk-GH6DPLWU.js → chunk-Y4Q667BW.js} +1 -1
  109. package/chunks/{chunk-FH74N7Y7.js → chunk-YJLMFUCS.js} +2 -2
  110. package/chunks/{chunk-C3Y2S5AM.js → chunk-YKHRCSKP.js} +1 -1
  111. package/chunks/{chunk-P4UJ7CXJ.js → chunk-YLIS36QA.js} +1 -1
  112. package/chunks/{chunk-4QIFOIBS.js → chunk-YVZ4XZRB.js} +1 -1
  113. package/chunks/{chunk-KGRD6G5J.js → chunk-Z27JJPKN.js} +1 -1
  114. package/chunks/{chunk-KOHHDB2L.js → chunk-ZCIS6MJZ.js} +1 -1
  115. package/chunks/{chunk-QNNDZYVW.js → chunk-ZHLQ222N.js} +1 -1
  116. package/chunks/{chunk-KWRZ3WJO.js → chunk-ZP7MTWMR.js} +1 -1
  117. package/chunks/{codex-subagent-executor-H44VDB5E.js → codex-subagent-executor-6OJVGF2S.js} +1 -1
  118. package/chunks/{config-utils-4X4SV4RL.js → config-utils-FI3A4QAN.js} +1 -1
  119. package/chunks/{contextCommand-4KVOHTAJ.js → contextCommand-YEBZQHG4.js} +1 -1
  120. package/chunks/{core-runtime-4RARI4NX.js → core-runtime-CFMHUAS7.js} +1 -1
  121. package/chunks/{create-sub-session-CNSRJFYG.js → create-sub-session-G26337FT.js} +1 -1
  122. package/chunks/{daemon-git-worktree-guard-6XQQPP2H.js → daemon-git-worktree-guard-ITU6NQIV.js} +1 -1
  123. package/chunks/{daemon-status-provider-PRTEQT5T.js → daemon-status-provider-CSWRGMRX.js} +1 -1
  124. package/chunks/{daemon-trust-policy-GXKJVZDU.js → daemon-trust-policy-IYD7NOGK.js} +1 -1
  125. package/chunks/{daemon-trust-policy-monitor-L2ORKHMM.js → daemon-trust-policy-monitor-OWUP5SYB.js} +1 -1
  126. package/chunks/{deferred-core-runtime-RZQFUSPX.js → deferred-core-runtime-CVCQU7O4.js} +1 -1
  127. package/chunks/{edit-W44XQCIS.js → edit-7YBQLILC.js} +1 -1
  128. package/chunks/{enterPlanMode-B456A2XO.js → enterPlanMode-L3PVSD2P.js} +1 -1
  129. package/chunks/{environment-DSGQSQFS.js → environment-BVEOYQHO.js} +1 -1
  130. package/chunks/{errors-KL725247.js → errors-VQWBGR6D.js} +1 -1
  131. package/chunks/{execution-tool-KT3EBWHG.js → execution-tool-P7CBXSGZ.js} +1 -1
  132. package/chunks/{execution-worker-LPQ4HMN4.js → execution-worker-RZXNYK4B.js} +1 -1
  133. package/chunks/{exitPlanMode-JLKS76IA.js → exitPlanMode-MBUTM3NW.js} +1 -1
  134. package/chunks/{fast-path-5UD52IHH.js → fast-path-T2FDUSHV.js} +1 -1
  135. package/chunks/{glob-LYA2H6X3.js → glob-RH7XXSYE.js} +1 -1
  136. package/chunks/{goal-tools-SHSIDLZX.js → goal-tools-K6XBCE5E.js} +1 -1
  137. package/chunks/{handleAutoUpdate-T4RE6CZN.js → handleAutoUpdate-PG7R3KPH.js} +1 -1
  138. package/chunks/{i18n-5DK327WA.js → i18n-EGTBMA3N.js} +1 -1
  139. package/chunks/{initializer-TJGE4OJA.js → initializer-RIKH4PCP.js} +1 -1
  140. package/chunks/{installationInfo-MZ62GDIC.js → installationInfo-BBADHZLD.js} +1 -1
  141. package/chunks/{interactive-mod-session-YCUBQ6RM.js → interactive-mod-session-7RDKAHZ4.js} +1 -1
  142. package/chunks/{list-4L3LYDQM.js → list-YEGWEHJX.js} +1 -1
  143. package/chunks/{llm-3JQWBZXV.js → llm-D3LHPY27.js} +4 -4
  144. package/chunks/{llm-content-generator-6UPJWPOM.js → llm-content-generator-BLTBMV66.js} +1 -1
  145. package/chunks/{loadedSettingsAdapter-STPKAFJG.js → loadedSettingsAdapter-PLGMKMFO.js} +1 -1
  146. package/chunks/{local-execution-environment-IE5BOI7Y.js → local-execution-environment-4LDKFNC4.js} +1 -1
  147. package/chunks/{loggingContentGenerator-4KKWPZJA.js → loggingContentGenerator-376R7DRI.js} +1 -1
  148. package/chunks/{manage-memory-CRV5SXZZ.js → manage-memory-2ZTIVKNU.js} +1 -1
  149. package/chunks/{managed-execution-engine-FHLEWVND.js → managed-execution-engine-5LOM3MXG.js} +1 -1
  150. package/chunks/{managed-npm-update-BRHPOKDU.js → managed-npm-update-2C5JYEXW.js} +1 -1
  151. package/chunks/{managed-runtime-attestation-worker-GIQKZ5BH.js → managed-runtime-attestation-worker-R2FECMZK.js} +1 -1
  152. package/chunks/{managed-runtime-bootstrap-P72BT46H.js → managed-runtime-bootstrap-KPLGH4UE.js} +1 -1
  153. package/chunks/{managed-runtime-session-worker-IYCJDB5K.js → managed-runtime-session-worker-EVKNPK3V.js} +1 -1
  154. package/chunks/{managed-runtime-ssh-worker-ONT4V5ZG.js → managed-runtime-ssh-worker-IA4HZ3PD.js} +1 -1
  155. package/chunks/{mcp-NXCQVE2Y.js → mcp-S67IJLI6.js} +1 -1
  156. package/chunks/{model-call-collection-3DNL45M5.js → model-call-collection-6OGPDTPG.js} +1 -1
  157. package/chunks/{model-configuration-6HRNYBWV.js → model-configuration-6RWVBOQS.js} +1 -1
  158. package/chunks/{modelConfigUtils-SKBN64ZW.js → modelConfigUtils-M3TVVYAO.js} +1 -1
  159. package/chunks/{monitor-7I7Q73UR.js → monitor-ZHOFTN7N.js} +1 -1
  160. package/chunks/{nonInteractiveCli-YLYRJUBE.js → nonInteractiveCli-6SUGPTJ4.js} +1 -1
  161. package/chunks/{nonInteractiveToolExecutor-U2ASWT63.js → nonInteractiveToolExecutor-SAHBGO3A.js} +1 -1
  162. package/chunks/{notebook-edit-WAD7IQCF.js → notebook-edit-ETUOQH6G.js} +1 -1
  163. package/chunks/{omni-POUUDVU3.js → omni-HV2UBGMZ.js} +1 -1
  164. package/chunks/{openaiContentGenerator-L7X6IVPL.js → openaiContentGenerator-RZCG7E4M.js} +1 -1
  165. package/chunks/{openaiResponsesContentGenerator-7XCMFI6P.js → openaiResponsesContentGenerator-X23L5JV3.js} +1 -1
  166. package/chunks/{pidfile-MQQT2ZDA.js → pidfile-26WXQCHG.js} +1 -1
  167. package/chunks/{processUtils-OZLF72NC.js → processUtils-WXLFGNBT.js} +1 -1
  168. package/chunks/{prompt-terminal-ledger-IYUF6SUU.js → prompt-terminal-ledger-EIZZHF4A.js} +1 -1
  169. package/chunks/{qwenContentGenerator-DKH3ILUO.js → qwenContentGenerator-GOY7Y6KH.js} +1 -1
  170. package/chunks/{reactive-degrade-KSNGHMBN.js → reactive-degrade-MNMTTHO5.js} +1 -1
  171. package/chunks/{read-file-VEELW4OQ.js → read-file-OJNGPNTQ.js} +1 -1
  172. package/chunks/{resumeHistoryUtils-4SFDTBXU.js → resumeHistoryUtils-QWOWF4VY.js} +1 -1
  173. package/chunks/{review-QA6HRLVU.js → review-5S24HP2V.js} +1 -1
  174. package/chunks/{ripGrep-4J6ASSE3.js → ripGrep-Y4PY2MQF.js} +1 -1
  175. package/chunks/{run-qwen-serve-EJ67LA5O.js → run-qwen-serve-EOUUDZUK.js} +2 -2
  176. package/chunks/{runtime-6E2FSB5U.js → runtime-ZBPOQX6E.js} +1 -1
  177. package/chunks/{sandboxConfig-4VE4LNRI.js → sandboxConfig-R7KDS3P5.js} +1 -1
  178. package/chunks/{scheduled-tasks-GM5EJMK7.js → scheduled-tasks-Q6V7D6K6.js} +1 -1
  179. package/chunks/{scheduler-HOSVIIOE.js → scheduler-EBQY6BOK.js} +1 -1
  180. package/chunks/{search-memory-HEAQCHIK.js → search-memory-HX6E23JC.js} +1 -1
  181. package/chunks/{send-message-FAQ7XEZ5.js → send-message-OZCCCH2F.js} +1 -1
  182. package/chunks/{serve-VNKPOWSW.js → serve-CMGCI4BK.js} +1 -1
  183. package/chunks/{server-U2XBJLOV.js → server-7LOAKPDN.js} +3 -3
  184. package/chunks/{session-AZGROSFX.js → session-LVQYZSJE.js} +1 -1
  185. package/chunks/{session-attachments-root-6M2ECUNK.js → session-attachments-root-NWG7JOMN.js} +1 -1
  186. package/chunks/{session-execution-engine-selector-PYDVOSJF.js → session-execution-engine-selector-PHH47ZMA.js} +1 -1
  187. package/chunks/{session-pr-refresh-3IS7DLEV.js → session-pr-refresh-5IACZPCY.js} +1 -1
  188. package/chunks/{sessionService-3FWNA4ZB.js → sessionService-7PFAWLHC.js} +1 -1
  189. package/chunks/{settings-VHKT7JJC.js → settings-CPZBOHN5.js} +1 -1
  190. package/chunks/{shell-TYOPVB7H.js → shell-A7NLPS2W.js} +1 -1
  191. package/chunks/{skill-GJQIE5AX.js → skill-VGANGVOD.js} +1 -1
  192. package/chunks/{skill-settings-76NI6SF3.js → skill-settings-TSZO3X6N.js} +1 -1
  193. package/chunks/{spawnChannel-FMSYLDKB.js → spawnChannel-2JQYNQKT.js} +1 -1
  194. package/chunks/{standalone-update-BPZQDQHD.js → standalone-update-QXC3RM6I.js} +1 -1
  195. package/chunks/{start-opentui-ui-X7XYV5N3.js → start-opentui-ui-BKJ4JHVK.js} +1 -1
  196. package/chunks/{startInteractiveUI-UZDF4JUB.js → startInteractiveUI-4QIPR7ZY.js} +1 -1
  197. package/chunks/{team-create-RFZNEF76.js → team-create-5MU6BGXX.js} +1 -1
  198. package/chunks/{team-plan-approval-MGW3JGSC.js → team-plan-approval-NZUJ6FSA.js} +1 -1
  199. package/chunks/{terminal-image-renderer-3UED5GZV.js → terminal-image-renderer-CTMJULJ2.js} +1 -1
  200. package/chunks/{theme-manager-SF6FSSZW.js → theme-manager-6H7GA6QR.js} +1 -1
  201. package/chunks/{tool-call-W2CJR74U.js → tool-call-XG4CAD5X.js} +1 -1
  202. package/chunks/{tool-result-media-XSFON2ZQ.js → tool-result-media-RJ5ONO7R.js} +1 -1
  203. package/chunks/{tool-search-7GY5YTOU.js → tool-search-KBINGEWV.js} +1 -1
  204. package/chunks/{total-session-admission-OATGW6M5.js → total-session-admission-XNWYCO7G.js} +1 -1
  205. package/chunks/{trustedFolders-AM4PSGUB.js → trustedFolders-JT5MOB3A.js} +1 -1
  206. package/chunks/{update-relaunch-YKY52XUT.js → update-relaunch-HXMQI3HO.js} +1 -1
  207. package/chunks/{updateCheck-RKQ5CPZM.js → updateCheck-XWE3TWL5.js} +1 -1
  208. package/chunks/{upload-config-CBT7ARZY.js → upload-config-ET7NRHU7.js} +1 -1
  209. package/chunks/{useAutoAcceptIndicator-Z3YWPUNO.js → useAutoAcceptIndicator-TPMYKNJX.js} +1 -1
  210. package/chunks/{validateNonInterActiveAuth-7CQHU2RF.js → validateNonInterActiveAuth-U52KMEDS.js} +1 -1
  211. package/chunks/{version-N2OB6KWP.js → version-CW4RTJ3H.js} +1 -1
  212. package/chunks/{web-fetch-L5XCBCBA.js → web-fetch-UPMJ3XIZ.js} +1 -1
  213. package/chunks/{web-search-4EHUA3LJ.js → web-search-PXABWQVC.js} +1 -1
  214. package/chunks/{workflow-FGAUAYIP.js → workflow-UQ4V3NBZ.js} +1 -1
  215. package/chunks/{workflow-ancestor-trust-F7RRN6I3.js → workflow-ancestor-trust-QII5KTUJ.js} +1 -1
  216. package/chunks/{workspace-agents-QW4TKC52.js → workspace-agents-Q3KKMDX2.js} +1 -1
  217. package/chunks/{workspace-providers-status-MFSZT3YA.js → workspace-providers-status-3ASB64FB.js} +1 -1
  218. package/chunks/{workspace-registration-store-WQRDSIEI.js → workspace-registration-store-2NPD6U3B.js} +1 -1
  219. package/chunks/{workspace-registry-FXZFRSCH.js → workspace-registry-6QJKRCDR.js} +1 -1
  220. package/chunks/{workspace-runtime-coordinator-LJ5YAT3A.js → workspace-runtime-coordinator-ZXUWDQIB.js} +1 -1
  221. package/chunks/{workspace-service-U632SUWU.js → workspace-service-YPYTYYUN.js} +1 -1
  222. package/chunks/{workspace-skills-status-M7YXM3LF.js → workspace-skills-status-VTFHQ6R7.js} +1 -1
  223. package/chunks/{workspace-trust-reconciler-NLJGGI4K.js → workspace-trust-reconciler-52CZVPKH.js} +1 -1
  224. package/chunks/{write-file-BJCKSXX7.js → write-file-FDBR76G5.js} +1 -1
  225. package/chunks/{zoom-image-TLJPD4DB.js → zoom-image-MYKWCCXO.js} +1 -1
  226. package/cli.js +2 -2
  227. package/execution-worker.js +1 -1
  228. package/export-transcript-document.js +1 -1
  229. package/package.json +4 -4
  230. package/vendor/landlock-run/arm64-linux/qwen-landlock-run +0 -0
  231. package/vendor/landlock-run/x64-linux/qwen-landlock-run +0 -0
  232. package/vendor/ripgrep/arm64-darwin/rg +0 -0
  233. package/vendor/ripgrep/arm64-linux/rg +0 -0
  234. package/vendor/ripgrep/x64-darwin/rg +0 -0
  235. package/vendor/ripgrep/x64-linux/rg +0 -0
  236. package/vendor/tree-sitter/tree-sitter-bash.wasm +0 -0
  237. package/vendor/tree-sitter/tree-sitter.wasm +0 -0
  238. package/web-shell/assets/{PierreFilePreview-D9tbdFw8.js → PierreFilePreview-DGTp45Z4.js} +1 -1
  239. package/web-shell/assets/{SpreadsheetPreview-CeFAk2s-.js → SpreadsheetPreview-DVC_YVei.js} +1 -1
  240. package/web-shell/assets/{WorkspaceFileBrowser-iaURw8SR.js → WorkspaceFileBrowser-DaQNpS06.js} +1 -1
  241. package/web-shell/assets/{abnfDiagram-VCTEODGH-Z4CT1NCF.js → abnfDiagram-VCTEODGH-wJbiOoPK.js} +1 -1
  242. package/web-shell/assets/{agents-route-B7o2Rq-a.js → agents-route-DUhhA1KI.js} +1 -1
  243. package/web-shell/assets/{arc-DcHBdUJQ.js → arc-CvpNMy1d.js} +1 -1
  244. package/web-shell/assets/{architectureDiagram-5GKGNRK7-DRDhEC81.js → architectureDiagram-5GKGNRK7-DIhi3dIz.js} +1 -1
  245. package/web-shell/assets/{blockDiagram-NRAW4CY4-CYRE6WIc.js → blockDiagram-NRAW4CY4-CoeyTlVJ.js} +1 -1
  246. package/web-shell/assets/{c4Diagram-UCG6FXSJ-CIM8N_Sj.js → c4Diagram-UCG6FXSJ-BYoK_I9M.js} +1 -1
  247. package/web-shell/assets/channel-DvtGOCg6.js +1 -0
  248. package/web-shell/assets/{chunk-2Q5K7J3B-Bbfka9Fe.js → chunk-2Q5K7J3B-BeD4GwPg.js} +1 -1
  249. package/web-shell/assets/{chunk-5VM5RSS4-C02zF3RY.js → chunk-5VM5RSS4-BpkJsB_y.js} +1 -1
  250. package/web-shell/assets/{chunk-F27PBJKO-Dn0wRD2F.js → chunk-F27PBJKO-BROEWQ1J.js} +1 -1
  251. package/web-shell/assets/{chunk-G27WJ6UU-Dwpl3l0W.js → chunk-G27WJ6UU-DA8Wtppt.js} +1 -1
  252. package/web-shell/assets/{chunk-JWPE2WC7-sQbzSoTR.js → chunk-JWPE2WC7-GqB-QFh5.js} +1 -1
  253. package/web-shell/assets/{chunk-LCL6LL3I-DNlNDtfr.js → chunk-LCL6LL3I-DIPUwYsX.js} +1 -1
  254. package/web-shell/assets/{chunk-POPQ4Y6H-BOgf1Dl3.js → chunk-POPQ4Y6H-DbnU-jxX.js} +1 -1
  255. package/web-shell/assets/{chunk-SVP7TREG-DOofWP00.js → chunk-SVP7TREG-DvH7bQ-w.js} +1 -1
  256. package/web-shell/assets/{chunk-XXDRQBXY-Bj9FxhWU.js → chunk-XXDRQBXY-DdVWVo3U.js} +1 -1
  257. package/web-shell/assets/classDiagram-DTDB5LWJ-9NR5W1rE.js +1 -0
  258. package/web-shell/assets/classDiagram-v2-JRS7N3AN-9NR5W1rE.js +1 -0
  259. package/web-shell/assets/{cose-bilkent-JH36ORCC-CUlPjyww.js → cose-bilkent-JH36ORCC-JgMKxP9H.js} +1 -1
  260. package/web-shell/assets/{cynefin-OW5HDTMX-5noArzI7.js → cynefin-OW5HDTMX-BVUpNgVm.js} +1 -1
  261. package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-DELvTqmf.js → cynefinDiagram-5FMLGOSQ-CxAdk-iS.js} +1 -1
  262. package/web-shell/assets/{dagre-3AP2YEHR-CAL6Z3hL.js → dagre-3AP2YEHR-CvXWkM86.js} +1 -1
  263. package/web-shell/assets/{diagram-S7CK7UJ4-DQC2gaIi.js → diagram-S7CK7UJ4-DD_PS4nm.js} +1 -1
  264. package/web-shell/assets/{diagram-UQ7AKVKN-CkU6M-3R.js → diagram-UQ7AKVKN-EVZkTODD.js} +1 -1
  265. package/web-shell/assets/{diagram-VSXAHHWV-CvHpHwVx.js → diagram-VSXAHHWV-CGZc1pZU.js} +1 -1
  266. package/web-shell/assets/{diagram-VX7I27RA-D9l5F9iB.js → diagram-VX7I27RA-DjNql499.js} +1 -1
  267. package/web-shell/assets/{diagram-Z3DM3KII-DW-VFvYx.js → diagram-Z3DM3KII-CCa0WtmR.js} +1 -1
  268. package/web-shell/assets/{docx-preview-8MQfOGQh.js → docx-preview-DpVElxvj.js} +1 -1
  269. package/web-shell/assets/{ebnfDiagram-PWID7BFC-C0Q71wC_.js → ebnfDiagram-PWID7BFC-W2hoOJZF.js} +1 -1
  270. package/web-shell/assets/{erDiagram-SSCWMZ5O-DWDLRh1S.js → erDiagram-SSCWMZ5O-Dz5NxxEb.js} +1 -1
  271. package/web-shell/assets/{flowDiagram-A5DVABFB-CVzJnl1P.js → flowDiagram-A5DVABFB-BTMAn8b5.js} +1 -1
  272. package/web-shell/assets/{ganttDiagram-EL5Y4UJY-B320pcgR.js → ganttDiagram-EL5Y4UJY-BaFrd5ZY.js} +1 -1
  273. package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-Di4uZh-J.js → gitGraphDiagram-WWUBYQGX-IlmdUqRk.js} +1 -1
  274. package/web-shell/assets/{index-Csr8Hx_O.js → index-C2ez0ZjE.js} +1 -1
  275. package/web-shell/assets/{index-C9BecA_H.js → index-Cs-XBNmB.js} +101 -101
  276. package/web-shell/assets/{infoDiagram-RXCK75RN-CbafhxET.js → infoDiagram-RXCK75RN-BHs9kpar.js} +1 -1
  277. package/web-shell/assets/{ishikawaDiagram-5VMMS53U-DrQuIDeR.js → ishikawaDiagram-5VMMS53U-DWCEQ85v.js} +1 -1
  278. package/web-shell/assets/{journeyDiagram-EYS64GPL-BschmjBj.js → journeyDiagram-EYS64GPL-RTDAw9yc.js} +1 -1
  279. package/web-shell/assets/{kanban-definition-3QL26DDD-B7x9BU9N.js → kanban-definition-3QL26DDD-B7Nl9bq6.js} +1 -1
  280. package/web-shell/assets/{layout-BewPaOyO.js → layout-BabjFEb1.js} +1 -1
  281. package/web-shell/assets/{linear-CnLILCVp.js → linear-CZuGjuQd.js} +1 -1
  282. package/web-shell/assets/{mermaid.core-Csj9KPfJ.js → mermaid.core-CK78bIGt.js} +6 -6
  283. package/web-shell/assets/{mindmap-definition-FBJOCRG2-CIGTi5gg.js → mindmap-definition-FBJOCRG2-BbcCi_jP.js} +1 -1
  284. package/web-shell/assets/{pegDiagram-XKGWAZYB-CuWBRQzb.js → pegDiagram-XKGWAZYB-DpLQ7u8i.js} +1 -1
  285. package/web-shell/assets/{pieDiagram-E7YTZNPT-Co5ukXCE.js → pieDiagram-E7YTZNPT-BpWFVtM0.js} +1 -1
  286. package/web-shell/assets/{quadrantDiagram-AXDQQJYC-B0hzjh6o.js → quadrantDiagram-AXDQQJYC-CGzYlaN1.js} +1 -1
  287. package/web-shell/assets/{railroadDiagram-O6MQD6OU-nhkJB0xD.js → railroadDiagram-O6MQD6OU-BNQYW-Zi.js} +1 -1
  288. package/web-shell/assets/{requirementDiagram-EFPCY7ZU-C7NpxjVR.js → requirementDiagram-EFPCY7ZU-C4fCdIDW.js} +1 -1
  289. package/web-shell/assets/{sankeyDiagram-P5KCCOFB-CUWlnhZC.js → sankeyDiagram-P5KCCOFB-BvbbAnMA.js} +1 -1
  290. package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-BoykH0_J.js → sequenceDiagram-WJ2MYXX4-DGXNc6E1.js} +1 -1
  291. package/web-shell/assets/{sizeCapture-X5ZJPWSS-aF-PkSe5.js → sizeCapture-X5ZJPWSS-C4W45Xf5.js} +1 -1
  292. package/web-shell/assets/{stateDiagram-HBIQ2CUA-g5q0b922.js → stateDiagram-HBIQ2CUA-D3q0fen-.js} +1 -1
  293. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-XKoYIi05.js +1 -0
  294. package/web-shell/assets/{swimlanes-XN3QIQJK-BbASszfe.js → swimlanes-XN3QIQJK-D8n-ResR.js} +1 -1
  295. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-C7qJMSzs.js +8 -0
  296. package/web-shell/assets/{timeline-definition-24CTP7MA-AXIV0TJJ.js → timeline-definition-24CTP7MA-Cio4y1mM.js} +1 -1
  297. package/web-shell/assets/{vennDiagram-4TSXK5OY-B-E0rj1h.js → vennDiagram-4TSXK5OY-DVlg0xnc.js} +1 -1
  298. package/web-shell/assets/{wardleyDiagram-VM6X3IG4-DiOOYJ2D.js → wardleyDiagram-VM6X3IG4-CgeIsimQ.js} +1 -1
  299. package/web-shell/assets/{xychartDiagram-S5SC5T6Z-De_z7HkS.js → xychartDiagram-S5SC5T6Z-UXjyTLnU.js} +1 -1
  300. package/web-shell/index.html +1 -1
  301. package/web-shell/sw.js +1 -1
  302. package/web-shell/assets/channel-Bwr9aS_E.js +0 -1
  303. package/web-shell/assets/classDiagram-DTDB5LWJ-BmY8Mmyo.js +0 -1
  304. package/web-shell/assets/classDiagram-v2-JRS7N3AN-BmY8Mmyo.js +0 -1
  305. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-CTOjUMow.js +0 -1
  306. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-Bz6ia3oL.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:oe().optional().describe("User's language and region preference in BCP 47 format."),timeZone:oe().optional().describe("User's timezone in IANA format."),userAgent:oe().optional().describe("Host application identifier."),platform:aa([re("web"),re("desktop"),re("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:ce({touch:$a().optional().describe("Whether the device supports touch input."),hover:$a().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:ce({top:Wt().describe("Top safe area inset in pixels."),right:Wt().describe("Right safe area inset in pixels."),bottom:Wt().describe("Bottom safe area inset in pixels."),left:Wt().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough();ce({method:re("ui/notifications/host-context-changed"),params:Oj.describe("Partial context update containing only changed fields.")});var _8e=ce({method:re("ui/update-model-context"),params:ce({content:Mt(Bg).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:ra(oe(),Ea().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),L8e=ce({method:re("ui/initialize"),params:ce({appInfo:mk.describe("App identification (name and version)."),appCapabilities:x8e.describe("Features and capabilities this app provides."),protocolVersion:oe().describe("Protocol version this app supports.")})});ce({protocolVersion:oe().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:mk.describe("Host application identification and version."),hostCapabilities:k8e.describe("Features and capabilities provided by the host."),hostContext:Oj.describe("Rich context about the host environment.")}).passthrough();var j9=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=$7e.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!==u8e&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}},A8e=[Pj],W9=class extends H9{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:g8e,sandboxready:h8e,initialized:S8e,requestteardown:b8e,loggingmessage:Ej}),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(L8e,o=>this._oninitialize(o)),this.setRequestHandler(hk,(o,s)=>(this.onping?.(o.params,s),{})),this.replaceRequestHandler(Tq,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(I8e,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(m8e,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(T8e,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(Tq,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(_8e,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(Lj,async(a,n)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(a.params,n)})}set oncreatesamplingmessage(t){this.setRequestHandler(Mj,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(hj,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(vj,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(wj,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(xj,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:A8e.includes(a)?a:Pj,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];R8e(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},w8e,a)}callTool(t,a){return this.request({method:"tools/call",params:t},bg,a)}listTools(t,a){return this.request({method:"tools/list",params:t},_j,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},bg,{signal:r.signal}),a.tools.listChanged&&this._client.setNotificationHandler(Aj,n=>this.sendToolListChanged(n.params))),a.resources&&(this.onlistresources=async(n,r)=>this._client.request({method:"resources/list",params:n},gj,{signal:r.signal}),this.onlistresourcetemplates=async(n,r)=>this._client.request({method:"resources/templates/list",params:n},yj,{signal:r.signal}),this.onreadresource=async(n,r)=>this._client.request({method:"resources/read",params:n},bj,{signal:r.signal}),a.resources.listChanged&&this._client.setNotificationHandler(kj,n=>this.sendResourceListChanged(n.params))),a.prompts&&(this.onlistprompts=async(n,r)=>this._client.request({method:"prompts/list",params:n},Sj,{signal:r.signal}),a.prompts.listChanged&&this._client.setNotificationHandler(Ij,n=>this.sendPromptListChanged(n.params)))}return super.connect(t)}};function R8e(e,t){return JSON.stringify(e)===JSON.stringify(t)}var E8e="_card_1vjff_1",M8e="_header_1vjff_9",N8e="_server_1vjff_20",P8e="_frame_1vjff_25",O8e="_fallback_1vjff_40",Wp={card:E8e,header:M8e,server:N8e,frame:P8e,fallback:O8e};function Q6(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function xg(e){if(!(!Q6(e)||e.type!=="mcp_app")&&!(typeof e.serverName!="string"||typeof e.resourceUri!="string"||typeof e.html!="string"||typeof e.fallbackText!="string"||!Q6(e.toolResult)||!Q6(e.toolArguments)))return e}var D8e=8192;function Iq(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 $8e(e){if(e==="127.0.0.1"||e==="[::1]")return"localhost"}function B8e(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:"||!Iq(n.hostname)||!Iq(r.hostname),!a&&(r.hostname==="[::1]"&&(r.hostname="localhost"),r.origin===n.origin)){let o=$8e(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 F8e(e,t){if(!t)return e;let a=new URL(e);return a.searchParams.set("csp",t),a.search.length<=D8e?a.toString():e}function _q(e){return{theme:e,platform:"web",displayMode:"inline",availableDisplayModes:["inline"],containerDimensions:{maxHeight:640}}}var Z6=0,Tb=new Set;function z8e(e){return new Promise((t,a)=>{let n=()=>{Tb.delete(r),a(e.reason)},r=()=>{e.removeEventListener("abort",n),Z6+=1,t(()=>{Z6-=1;let o=Tb.values().next().value;o&&(Tb.delete(o),o())})};e.aborted?a(e.reason):Z6<2?r():(Tb.add(r),e.addEventListener("abort",n,{once:!0}))})}function q8e({display:e}){let t=(0,w.useContext)(rH),a=(0,w.useContext)(oH),n=(0,w.useContext)(mye),r=(0,w.useContext)(pye);a&&r?.sessionId;let o=void 0,s=a&&n?.sessionId===a?n.callTool:void 0,i=Cg(),l=(0,w.useRef)(null),c=(0,w.useRef)(null),d=(0,w.useRef)(0),f=(0,w.useRef)(e),p=(0,w.useRef)(i);f.current=e,p.current=i;let[m,g]=(0,w.useState)(260),[h,b]=(0,w.useState)(),[v,y]=(0,w.useState)(!1),k=e.csp?JSON.stringify(e.csp):"",C=JSON.stringify(e.toolArguments),T=JSON.stringify(e.toolResult),I=(0,w.useMemo)(()=>{if(!t||typeof window>"u")return;let S=B8e(t,window.location.href,v);if(S)return F8e(S,k)},[t,k,v]);return(0,w.useEffect)(()=>{b(void 0);let S=l.current;if(!S||!I)return;let L=++d.current,E=!1,R=!0,N=!1,O=f.current,$=new W9(null,{name:"qwen-code-web-shell",version:"0.0.1"},{...s?{serverTools:{}}:{},sandbox:{...O.csp?{csp:O.csp}:{}}},{hostContext:_q(p.current)});c.current=$;let z=new AbortController;s&&($.oncalltool=async(J,Q)=>{let W=AbortSignal.any([Q.signal,z.signal]),A=0,U=J._meta?.progressToken,Y=Q.sendNotification,P=W.aborted||typeof U!="string"&&typeof U!="number"?void 0:setInterval(()=>{Y({method:"notifications/progress",params:{progressToken:U,progress:++A}}).catch(()=>{})},3e4),ae=()=>clearInterval(P);W.addEventListener("abort",ae,{once:!0});let le;try{return le=await z8e(W),W.throwIfAborted(),await s({serverName:O.serverName,resourceUri:O.resourceUri,name:J.name,arguments:J.arguments??{}},W)}finally{le?.(),ae(),W.removeEventListener("abort",ae)}});let H=()=>{!R||d.current!==L||(R=!1,clearTimeout(G),$.oncalltool=void 0,$.onmessage=void 0,z.abort(),S.removeAttribute("src"),c.current=null,$.close().catch(()=>{}),b("sandbox-load-failed"))},G=setTimeout(()=>{R&&(new URL(I).searchParams.get("mode")!=="data"?y(!0):H())},1e4);return $.onsandboxready=()=>{if(!R||N)return;N=!0,clearTimeout(G),G=setTimeout(()=>{R&&!E&&H()},3e4);let J=f.current;$.sendSandboxResourceReady({html:J.html,...J.csp?{csp:J.csp}:{}}).catch(H)},$.oninitialized=()=>{if(!R)return;E=!0,clearTimeout(G);let J=f.current;$.sendToolInput({arguments:J.toolArguments}).then(()=>{if(R)return $.sendToolResult(J.toolResult)}).catch(H)},$.onsizechange=({height:J})=>{typeof J=="number"&&Number.isFinite(J)&&g(Math.min(640,Math.max(120,Math.ceil(J))))},$.connect(new j9(S.contentWindow??void 0,S.contentWindow)).then(()=>{R&&(S.src=I)}).catch(H),()=>{R=!1,clearTimeout(G),$.oncalltool=void 0,$.onmessage=void 0,z.abort(),c.current=null;let J=()=>{d.current===L&&S.removeAttribute("src"),$.close().catch(()=>{})};if(E){$.teardownResource({},{timeout:500}).catch(()=>{}).finally(J);return}J()}},[I,v,s,o,a,e.serverName,e.resourceUri,e.html,k,C,T]),(0,w.useEffect)(()=>{c.current?.setHostContext(_q(i))},[i]),!e.html||!I?(0,u.jsx)("div",{className:Wp.fallback,children:e.fallbackText}):(0,u.jsxs)("div",{className:Wp.card,"data-testid":"mcp-app",children:[(0,u.jsxs)("div",{className:Wp.header,children:[(0,u.jsx)("span",{children:"MCP App"}),(0,u.jsx)("span",{className:Wp.server,children:e.serverName})]}),h?(0,u.jsx)("div",{className:Wp.fallback,children:e.fallbackText||"MCP App could not initialize."}):null,(0,u.jsx)("iframe",{ref:l,title:`${e.serverName} MCP App`,className:Wp.frame,style:{height:m,display:h?"none":void 0},sandbox:"allow-scripts allow-forms allow-same-origin",referrerPolicy:"origin",onError:()=>b("sandbox-load-failed")})]})}function U8e(e){let t=H8e(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 H8e(e,...t){if(e)for(let a of t){let n=e[a];if(typeof n=="string")return n}}function j8e(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:W8e(r)}if(e.workspaceCwd===t)return{cwd:t,primary:!0}}function W8e(e){return{cwd:e.cwd,id:e.id,primary:e.primary}}function G8e(e,t){return e?.cwd===t.cwd&&e.id===t.id&&e.primary===t.primary}function Dj(e){let t=lk(),a=wye(),n=(0,w.useMemo)(()=>j8e(t.capabilities,e),[t.capabilities,e]),r=!1,o=r,s=(0,w.useRef)(o);s.current=o;let i=r,l=r,c=r,d=(0,w.useRef)(c);d.current=c;let f=(0,w.useRef)({file:i,directory:l});f.current={file:i,directory:l};let p=!1,m=(0,w.useRef)(p);m.current=p;let g=(0,w.useRef)(void 0);n?G8e(g.current?.owner,n)||(g.current={owner:n}):g.current=void 0;let h=g.current,b=(0,w.useRef)(void 0);(0,w.useEffect)(()=>{if(!h){b.current=void 0;return}let y={};return b.current=y,()=>{queueMicrotask(()=>{b.current===y&&g.current===h&&(g.current=void 0)})}},[h]);let v=(0,w.useMemo)(()=>{if(!h)return;let y=h,k=()=>{let T=g.current;if(T!==y)throw new Error("Workspace artifact owner is no longer available");return T.owner},C=T=>{let I=k();if(I.id!==T)throw new Error("Scheduled task workspace owner no longer matches");return I};return{async listDirectory(T){let I=k(),S=await(I.id?t.client.workspaceByCwd(I.cwd).dirList(T):a.listDirectory(T));return k(),S},async readWorkspaceFile(T,I){let S=k(),L=await(S.primary?a.readWorkspaceFile(T,I):t.client.workspaceByCwd(S.cwd).readWorkspaceFile(T,I));return k(),L},async readFileBytes(T,I){let S=k(),L=await(S.primary?a.readFileBytes(T,I):t.client.workspaceByCwd(S.cwd).readWorkspaceFileBytes(T,I));return k(),L},async stat(T){let I=k(),S=await(I.primary?a.stat(T):t.client.workspaceByCwd(I.cwd).fileStat(T));return k(),S},async listScheduledTasks(T){C(T);let I=await a.listScheduledTasks(T);return C(T),I},async updateScheduledTask(T,I,S){C(S);let L=await a.updateScheduledTask(T,I,S);return C(S),L},async deleteScheduledTask(T,I){C(I),await a.deleteScheduledTask(T,I),C(I)}}},[h,a,t.client,o,i,l,c,p]);if(!(!h||!v))return{workspaceCwd:h.owner.cwd,...h.owner.id?{workspaceId:h.owner.id}:{},actions:v}}function Lq({tool:e,workspaceCwd:t,onOpen:a,iconOnly:n}){let r=Na(),o=U8e(e);return r!=="interactive"||!a||!t||!o?.trim()?null:(0,u.jsx)(V8e,{filePath:o,workspaceCwd:t,tool:e,onOpen:a,iconOnly:n},JSON.stringify([t,o,e.callId]))}function V8e({filePath:e,workspaceCwd:t,tool:a,onOpen:n,iconOnly:r}){let{t:o}=at(),{status:s}=lk(),i=Dj(t)?.actions,[l,c]=(0,w.useState)(),d=(0,w.useRef)({sequence:0}).current,f=(0,w.useRef)({actions:i,status:s,onOpen:n});if(f.current={actions:i,status:s,onOpen:n},(0,w.useEffect)(()=>{if(c(void 0),!i||s!=="connected")return;let m=async()=>{let g=++d.sequence;try{let h=await i.stat(e);g===d.sequence&&c(h.type==="file"?i:void 0)}catch{g===d.sequence&&c(void 0)}};return m(),window.addEventListener("focus",m),()=>{d.sequence++,window.removeEventListener("focus",m)}},[i,e,d,s,a.status]),!i||s!=="connected"||l!==i)return null;let p=async()=>{let m=++d.sequence;try{let g=await i.stat(e);if(m!==d.sequence||f.current.actions!==i||f.current.status!=="connected"||f.current.onOpen!==n)return;if(g.type!=="file"){c(void 0);return}n({id:`file:${t}:${e}`,kind:"attachment",title:e.split(/[/\\]/).pop()||e,turnId:a.callId,workspacePath:e,workspaceCwd:t,silentUnavailable:!0})}catch{m===d.sequence&&c(void 0)}};return(0,u.jsxs)(Ra,{type:"button",variant:"ghost",size:r?"icon-xs":"xs",className:"ml-auto text-muted-foreground",title:o("tool.viewCurrentFile"),"aria-label":o(h9(e)?"tool.viewImage":"tool.viewFile"),onClick:()=>void p(),children:[!r&&o(h9(e)?"tool.viewImage":"tool.viewFile"),(0,u.jsx)(ll,{"aria-hidden":"true"})]})}function K8e({result:e,onOpen:t}){let{t:a}=at();return(0,u.jsxs)("div",{className:"flex flex-wrap items-center gap-2 px-3 py-2 text-xs","data-managed-tool-result":e.id,children:[(0,u.jsx)(j6,{variant:"outline",children:a(`managed.result.execution.${e.execution_status}`)}),(0,u.jsx)(j6,{variant:"outline",children:a(`managed.result.capture.${e.capture_status??"none"}`)}),(0,u.jsx)(j6,{variant:"outline",children:a(`managed.result.delivery.${e.delivery_status}`)}),t&&(0,u.jsx)(Ra,{size:"sm",variant:"ghost",onClick:()=>t(e.item_id),children:a("managed.result.view")})]})}function $j(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 X8e(e){let t=e.toolName.toLowerCase();return qs(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||h7(t)||f7(t)||zo(e.toolName)||m7(t)}function Nb(e){let t=e.toLowerCase();return t==="edit"||t==="editfile"||t==="write"||t==="write_file"||t==="writefile"}function Y8e(e){let t=Q8e(e);if(t)return t;if(e.content){let o=e.content.find(s=>s.type==="diff");if(o&&o.type==="diff")return aq(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"?aq(typeof r=="string"?r:"",typeof n=="string"?n:""):""}function Q8e(e){if(e.rawOutput&&typeof e.rawOutput=="object"){let t=e.rawOutput;if(Z8e(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function Z8e(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}var J8e=60,eIe=2e5,tIe=1e3,aIe={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 nIe({tool:e}){let{t}=at(),a=(0,w.useMemo)(()=>Gd(e)||"",[e]);if(!a)return(0,u.jsx)("div",{className:he.expandedRead,children:(0,u.jsx)("pre",{className:he.expandedOutput,children:t(tn(e.status)?"shell.result.waiting":GU(e)?"shell.result.empty":"shell.result.unavailable")})});let n=sIe(rIe(e)),r=n==="text"||a.length>eIe||oIe(a,tIe);return(0,u.jsx)("div",{className:he.expandedRead,children:r?(0,u.jsx)("pre",{className:he.expandedOutput,children:a}):(0,u.jsx)(Ti,{content:iIe(n,a)})})}function rIe(e){let t=e.args?.file_path??e.args?.path;return typeof t=="string"?t:""}function oIe(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 sIe(e){let t=e.split(/[?#]/,1)[0]?.split(".").pop()?.toLowerCase();if(!t||t===e.toLowerCase()||t==="mermaid"||t==="mmd")return"text";let a=aIe[t]??t;return/^[\w+.#-]+$/.test(a)?a:"text"}function iIe(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 Aq({tool:e}){let t=(0,w.useMemo)(()=>Y8e(e),[e]),a=(0,w.useMemo)(()=>e.content&&Gd(e)||"",[e]);return!t&&!a?null:(0,u.jsx)("div",{className:he.expandedEdit,children:t?(0,u.jsx)(XSe,{diff:t}):(0,u.jsx)("pre",{className:he.expandedOutput,children:a})})}function mg({title:e,action:t,detail:a,status:n,children:r}){return(0,u.jsxs)("div",{className:he.expandedCard,children:[(0,u.jsxs)("div",{className:he.expandedCardHeader,children:[(0,u.jsxs)("span",{className:he.expandedCardTitleRow,children:[n&&(0,u.jsx)(Jp,{status:n}),(0,u.jsx)("span",{className:he.expandedCardTitle,children:e}),t]}),a&&(0,u.jsx)("span",{className:he.expandedCardDetail,children:a})]}),r&&(0,u.jsx)("div",{className:he.expandedCardBody,children:r})]})}function lIe({tool:e,todos:t,expanded:a,title:n}){let r=(0,w.useContext)(t7).get(e.callId)?.events??[];return a?(0,u.jsx)(mg,{title:n,status:e.status,children:(0,u.jsx)("div",{className:he.todoBody,children:(0,u.jsx)(LH,{todos:t})})}):(0,u.jsx)("div",{className:he.todoBody,children:(0,u.jsx)(_H,{todos:t,events:r})})}function cIe({tool:e,displayName:t,detail:a,result:n}){let{t:r}=at(),o=l5e(),s=o?u5e(o.tasks,e):void 0;return s?(0,u.jsx)(bH,{task:s}):(0,u.jsx)(mg,{title:t,detail:a,children:(0,u.jsx)("div",{className:he.workflowFallback,role:"status",children:e.status==="pending"||e.status==="in_progress"?r("workflow.inline.loading"):n||r("workflow.inline.unavailable")})})}function Bj(e,t){let a=om(e.rawOutput),n=g7(e),r=vg(e),o=w7(e),s=uIe(e),i=ok(e),l=e.subTools?.length||a?.toolCalls?.length||0,c=a?.executionSummary,d=c&&typeof c.totalDurationMs=="number"?xH(c.totalDurationMs):am(e.startTime,e.endTime??(e.status==="in_progress"&&t?t:void 0)),f=a&&typeof a.tokenCount=="number"&&a.tokenCount>0?a.tokenCount:c&&typeof c.outputTokens=="number"&&c.outputTokens>0?c.outputTokens:0,p=f>0?y7(f):"";return{agentType:o,explicitAgentType:s,description:i,subToolCount:l,elapsed:d,tokens:p,status:r,reason:n}}function uIe(e){let t=om(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 Rq(e){if(e.status==="completed")return!1;let t=e.toolName.toLowerCase();return!!(zo(e.toolName)||Nb(t)||qs(t))}function dIe({tool:e}){let t=Gd(e)||"";return(0,u.jsx)("pre",{className:he.expandedOutput,children:t})}function fIe({tool:e}){let t=pIe(e)||(typeof e.args?.args=="string"&&e.args.args.trim()?e.args.args.trim():e.title??"");return(0,u.jsx)("pre",{className:he.expandedOutput,children:t})}function pIe(e){let t=e.content?.[0];return t?.type!=="content"?"":typeof t.content?.text=="string"?t.content.text:""}function Jb(e){let t=e.toolName.toLowerCase();return hr(e)?"agent":zo(e.toolName)?"ask":qs(t)?"shell":V9(t)?"fetch":Vd(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 mIe({description:e,elapsed:t}){return(0,u.jsxs)(u.Fragment,{children:[e&&(0,u.jsx)("span",{className:he.lineArg,children:e}),t&&(0,u.jsx)("span",{className:he.lineElapsed,children:t})]})}function lg({info:e}){let{renderToolHeaderExtra:t}=qo(),a=t?.(e);return a?(0,u.jsx)(u.Fragment,{children:a}):(0,u.jsx)(mIe,{description:e.description,elapsed:e.kind==="agent"||tn(e.tool.status)?e.elapsed:""})}function hIe(e){return e.length>J8e||e.includes(`
630
- `)}function gIe(e){return e.find(t=>tn(t.status))??e[e.length-1]}function vIe(e,t,a,n=!1){if(a7(e)){let o=e.filter(i=>tn(i.status)&&!Us(i));if(o.length===0)return t("subagent.background");if(o.length===1&&zo(o[0].toolName))return t("toolGroup.summary.provideInformation");let s=o.map(i=>zo(i.toolName)?t("toolGroup.summary.provideInformation"):Fj(i,t,a));return t("toolGroup.running",{name:s.join(" \xB7 "),count:o.length})}return wIe(e,t,n)||t("toolGroup.summary",{count:e.length})}function Fj(e,t,a){if(Vd(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if(zo(e.toolName))return tn(e.status)?t("toolGroup.summary.provideInformation"):t("toolGroup.summary.askedQuestions",{count:qj(e)});let{displayName:n,description:r,hideDisplayName:o}=zj(e,t,a);return[o?"":n,r].filter(Boolean).join(" ")}function zj(e,t,a){let n=fu(e.toolName,t),r=vn(WU(e,a),120);return{kind:Jb(e),tool:e,displayName:n,description:r,elapsed:"",workspaceCwd:a,hideDisplayName:!!J0e(e)}}function yIe({tool:e,workspaceCwd:t}){let{t:a}=at(),n=zo(e.toolName),r=tn(e.status),o=Us(e),s=r&&!o&&hr(e),i=ck(s),l=!n&&r?o?a("subagent.background"):a("toolGroup.runningPrefix").trim():"";if(Vd(e.toolName)||n)return(0,u.jsxs)(u.Fragment,{children:[l&&(0,u.jsxs)("span",{children:[l," "]}),Fj(e,a,t)]});let c=zj(e,a,t),d=s?QU(e,a):"",f=s?{...c,description:[c.description,d&&`(${d})`].filter(Boolean).join(" "),elapsed:Bj(e,i).elapsed}:c;return(0,u.jsxs)(u.Fragment,{children:[l&&(0,u.jsxs)("span",{children:[l," "]}),(0,u.jsxs)("span",{className:he.chatSummaryInline,children:[!f.hideDisplayName&&(0,u.jsx)("span",{className:he.lineName,children:f.displayName}),(0,u.jsx)(lg,{info:f})]})]})}function wIe(e,t,a){let n=a?e.filter(hr).length:0;if(n>0){let f=e.length-n;return[t("toolGroup.summary.ranAgents",{count:n}),f?t("toolGroup.summary",{count:f}):""].filter(Boolean).join(" \xB7 ")}let r=0,o=0,s=0,i=0,l=0,c=0,d=0;for(let f of e){let p=f.toolName.toLowerCase();qs(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++:Vd(p)?l++:zo(p)?c+=qj(f):d++}return[r?t("toolGroup.summary.editedFiles",{count:r}):"",o?t("toolGroup.summary.ranCommands",{count:o}):"",s?t("toolGroup.summary.readFiles",{count:s}):"",i?t("toolGroup.summary.searched",{count:i}):"",l?t("toolGroup.summary.updatedTodos",{count:l}):"",c?t("toolGroup.summary.askedQuestions",{count:c}):"",d?t("toolGroup.summary.otherTools",{count:d}):""].filter(Boolean).join(" ")}function qj(e){let t=e.args?.questions;return Array.isArray(t)&&t.length>0?t.length:1}function bIe(){return(0,u.jsxs)("svg",{className:he.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,u.jsx)("path",{d:"M12 20h9"}),(0,u.jsx)("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function Uj(){return(0,u.jsxs)("svg",{className:he.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[(0,u.jsx)("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),(0,u.jsx)("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function kIe(){return(0,u.jsxs)("svg",{className:he.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[(0,u.jsx)("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.25"}),(0,u.jsx)("path",{d:"M1.8 7h10.4M7 1.5c1.3 1.5 2 3.3 2 5.5s-.7 4-2 5.5M7 1.5C5.7 3 5 4.8 5 7s.7 4 2 5.5",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function xIe(){return(0,u.jsxs)("svg",{className:he.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[(0,u.jsx)("rect",{x:"2",y:"1.6",width:"10",height:"10.8",rx:"2.2",stroke:"currentColor",strokeWidth:"1.25"}),(0,u.jsx)("path",{d:"M4.5 5.2h5M4.5 7h5M4.5 8.8h5",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function SIe(){return(0,u.jsx)("svg",{className:he.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:(0,u.jsx)("path",{d:"M3 4.2 4.2 5.4 6.1 3.3M7.5 4.5h3.6M3 9.1l1.2 1.2 1.9-2.1M7.5 9.4h3.6",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function CIe(){return(0,u.jsx)("svg",{className:he.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:(0,u.jsx)("path",{d:"M3.4 3.2h7.2c.7 0 1.25.55 1.25 1.25v3.4c0 .7-.55 1.25-1.25 1.25H7.5L4.5 11V9.1H3.4c-.7 0-1.25-.55-1.25-1.25v-3.4c0-.7.55-1.25 1.25-1.25Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function G9(){return(0,u.jsx)("svg",{className:he.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:(0,u.jsx)("path",{d:"M770.08 96.32c1.728.64 3.072 1.984 3.712 3.712l38.848 107.584c.64 1.728 1.984 3.104 3.712 3.712l107.584 38.848a6.144 6.144 0 0 1 0 11.584l-107.584 38.848a6.144 6.144 0 0 0-3.712 3.712l-38.848 107.584a6.144 6.144 0 0 1-11.584 0L723.36 304.32a6.144 6.144 0 0 0-3.712-3.712L612.064 261.76a6.144 6.144 0 0 1 0-11.584l107.584-38.848a6.144 6.144 0 0 0 3.712-3.712l38.848-107.584c1.184-3.2 4.704-4.8 7.872-3.68zM576 160H384q-119.296 0-203.648 84.352Q96 328.704 96 448v192q0 119.296 84.352 203.648Q264.704 928 384 928h256q119.296 0 203.648-84.352Q928 759.296 928 640V512h-64v128q0 92.8-65.6 158.4Q732.8 864 640 864H384q-92.8 0-158.4-65.6Q160 732.8 160 640V448q0-92.8 65.6-158.4Q291.2 224 384 224h192v-64zm96 248.224L568.224 512 672 615.776l45.248-45.28L658.752 512l58.496-58.496L672 408.224zM320 608V448h64v160h-64z",stroke:"currentColor",strokeWidth:"28",strokeLinejoin:"round"})})}function Hj({tool:e}){let t=Jb(e);return t==="agent"?(0,u.jsx)(G9,{}):t==="ask"?(0,u.jsx)(CIe,{}):t==="edit"||t==="write"?(0,u.jsx)(bIe,{}):t==="fetch"?(0,u.jsx)(kIe,{}):t==="read"?(0,u.jsx)(xIe,{}):t==="todo"?(0,u.jsx)(SIe,{}):(0,u.jsx)(Uj,{})}function V9(e){let t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}function TIe(e,t){if(e.approval?.id!==t.approval?.id||e.workspaceCwd!==t.workspaceCwd||e.onTurnOutputOpen!==t.onTurnOutputOpen||e.onToolResultOpen!==t.onToolResultOpen||e.summaryOnly!==t.summaryOnly||e.forceExpanded!==t.forceExpanded||e.detailsVisible!==t.detailsVisible||e.hideHeader!==t.hideHeader||e.hideCollapsedOutput!==t.hideCollapsedOutput)return!1;let a=e.tool,n=t.tool;return a.callId===n.callId&&a.toolName===n.toolName&&a.status===n.status&&a.subagentSessionReady===n.subagentSessionReady&&a.startTime===n.startTime&&a.endTime===n.endTime&&a.subContent===n.subContent&&a.rawOutput===n.rawOutput&&a.toolResult===n.toolResult&&a.toolDetailsRevision===n.toolDetailsRevision&&a.wasCancelled===n.wasCancelled&&a.args===n.args&&a.content===n.content&&a.locations===n.locations&&a.title===n.title&&IIe(a.subTools,n.subTools)}function IIe(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let a=0;a<e.length;a++){let n=e[a],r=t[a];if(n.callId!==r.callId||n.toolName!==r.toolName||n.status!==r.status||n.subagentSessionReady!==r.subagentSessionReady||n.endTime!==r.endTime||n.rawOutput!==r.rawOutput||n.toolResult!==r.toolResult||n.toolDetailsRevision!==r.toolDetailsRevision||n.wasCancelled!==r.wasCancelled||n.args!==r.args||n.subContent!==r.subContent||n.title!==r.title)return!1}return!0}var Eq=/\[([^\]]+)\]\(qwen-session:\/\/([^)]+)\)/g;function J6(e,t){if(!e||!e.includes("qwen-session://"))return e;let a=[],n=0,r;for(Eq.lastIndex=0;(r=Eq.exec(e))!==null;){r.index>n&&a.push(e.slice(n,r.index));let o=r[2];a.push(t!=="interactive"?(0,u.jsx)("span",{style:{textDecoration:"underline"},children:r[1]},r.index):(0,u.jsx)("a",{href:"#",role:"button",style:{textDecoration:"underline",cursor:"pointer"},onClick:s=>{s.preventDefault(),s.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:o}))},children:r[1]},r.index)),n=r.index+r[0].length}return n<e.length&&a.push(e.slice(n)),a.length===1?a[0]:(0,u.jsx)(u.Fragment,{children:a})}var K9=(0,w.memo)(function({tool:e,approval:t,workspaceCwd:a,onTurnOutputOpen:n,onToolResultOpen:r,summaryOnly:o=!1,forceExpanded:s=!1,detailsVisible:i=!0,hideHeader:l=!1,hideCollapsedOutput:c=!1}){let{t:d}=at(),f=Na(),p=sk(),m=IH(),{hostOwnsEditDiffPreview:g}=qo(),h=m!==void 0,b=xg(e.rawOutput),v=s||!!b,y=t?.toolCallId===e.callId,k=!!(g&&y&&t?.hasDiffPreview&&Nb(t?.toolName??e.toolName)),C=k,[T,I]=(0,w.useState)(!1),[S,L]=(0,w.useState)(()=>v||!o&&Rq(e)&&!C),E=(0,w.useRef)(null),R=(0,w.useRef)(!1),N=m7(e.toolName);(0,w.useEffect)(()=>{L(v||!o&&Rq(e)&&!C),I(!1),E.current=null,R.current=!1},[v,C,h,o,e.callId,e.toolName]);let O=hr(e),$=!y&&t?.toolCallId&&O&&Hs(e,t.toolCallId),z=!!(k||g&&$&&t?.hasDiffPreview&&Nb(t.toolName??"")),H=tn(e.status),G=H&&!qs(e.toolName)&&!V9(e.toolName)&&!z,J=ck(G);if((0,w.useEffect)(()=>{!v&&!O&&e.status==="completed"&&!R.current&&L(!1)},[v,O,e.status]),O){let X=Bj(e,J),fe=X.explicitAgentType?`${d("agent.label")} (${Lg(X.explicitAgentType,d)})`:d("agent.label"),ke=e.status==="completed"||e.status==="failed",Ve=Us(e),Xe=[Ve&&!ke?d("subagent.background"):e.status==="pending"?d("subagent.pending"):d("subagent.running"),Ve&&!ke||z?"":X.elapsed].filter(Boolean).join(" \xB7 "),kt=[X.subToolCount>0?d("subagent.toolsCount",{count:X.subToolCount}):"",X.elapsed,X.tokens,X.reason?vn(X.reason,80):""].filter(Boolean).join(" \xB7 "),Xt=s||S||!!$,nt=!!y,Lt=Ci(e),et=(0,u.jsx)(S7,{tool:e,approval:g?t:void 0,hideHeader:!0,defaultExpanded:!0,inline:!0});if(p&&!l){let Gt=(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(G9,{}),(0,u.jsx)(Jp,{status:ke?X.status:e.status}),(0,u.jsx)("span",{className:he.lineName,children:fe}),(0,u.jsx)(lg,{info:{kind:"agent",tool:e,displayName:fe,description:X.description?vn(X.description,60):"",elapsed:ke?kt:Xe,workspaceCwd:a}})]});return(0,u.jsx)("div",{className:he.line,"data-transcript-tool-call-id":e.callId,children:nt?(0,u.jsx)("div",{className:`${he.lineMain} ${he.lineButton}`,"aria-disabled":"true",children:Gt}):(0,u.jsxs)("button",{type:"button",className:`${he.lineMain} ${he.lineExpandable} ${he.lineButton}`,"aria-disabled":!!Lt||void 0,title:Lt?d(Lt):void 0,onClick:()=>{Lt||p.onOpen(e)},children:[Gt,(0,u.jsx)("span",{className:he.lineChevronRight,"aria-hidden":"true"})]})})}return(0,u.jsxs)("div",{className:he.line,"data-transcript-tool-call-id":e.callId,children:[!l&&(0,u.jsxs)("div",{className:`${he.lineMain} ${nt?"":he.lineExpandable}`,"aria-disabled":!!Lt||void 0,title:Lt?d(Lt):void 0,onClick:nt||Lt?void 0:()=>L(!S),children:[(0,u.jsx)(G9,{}),(0,u.jsx)(Jp,{status:ke?X.status:e.status}),(0,u.jsx)("span",{className:he.lineName,children:fe}),(0,u.jsx)(lg,{info:{kind:"agent",tool:e,displayName:fe,description:X.description?vn(X.description,60):"",elapsed:ke?kt:Xe,workspaceCwd:a}}),!nt&&(0,u.jsx)("span",{className:S?he.lineChevronDown:he.lineChevronRight,"aria-hidden":"true"})]}),Xt&&(0,u.jsx)("div",{className:he.lineDetail,children:l?(0,u.jsx)("div",{className:he.expandedAgentCard,children:et}):et})]})}let Q=Hb(e,a),W=ege(e),A=qs(e.toolName)?WU(e,a):Q,U=fu(e.toolName,d),Y=z||qs(e.toolName)||V9(e.toolName)?"":am(e.startTime,H?J:e.endTime),P=e.toolName.toLowerCase(),ae=P==="monitor"&&h&&!T&&!l,le=Vd(P),Te=le?iH(e):void 0,q=!!Te&&Te.length>0,ne=Te?Te.filter(X=>X.status==="completed").length:0,ie=qs(P),te=P==="grep"||P==="grep_search"||P==="search"||P==="glob",me=P==="read"||P==="read_file"||P==="readfile",xe=f7(P),Fe=i&&(me||Nb(P)||P==="display_image"||P==="zoom_image")?(0,u.jsx)(Lq,{tool:e,workspaceCwd:a,onOpen:n}):void 0,ve=!le&&hIe(A),K=!v&&!C,Se=ae||K,Le=()=>{R.current=!0,L(X=>!X)},Ye=()=>{I(!0),K&&Le()},ut=()=>{m&&$j(E,()=>m.onOpen(e),Ye)},qt=X8e(e),ua=S&&ve,ye=me||xe,qe=ua&&!ie&&!te&&!me,ue=Q,Oe=S&&!qt&&(!le||!q&&!W);return(0,u.jsxs)("div",{className:he.line,"data-transcript-tool-call-id":e.callId,children:[l&&H&&Y&&(0,u.jsx)("div",{className:he.lineMain,children:(0,u.jsx)(lg,{info:{kind:Jb(e),tool:e,displayName:U,description:"",elapsed:Y,workspaceCwd:a}})}),!l&&(0,u.jsxs)("div",{className:`${he.lineMain} ${Se?he.lineExpandable:""}`,title:ae?void 0:K?d(S?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":ae?void 0:K?S:void 0,role:Se?"button":void 0,tabIndex:Se?0:void 0,onClick:Se?()=>{if(ae){ut();return}Le()}:void 0,onKeyDown:Se?X=>{if(!(X.key!=="Enter"&&X.key!==" ")){if(X.preventDefault(),ae){ut();return}Le()}}:void 0,children:[(0,u.jsx)(Hj,{tool:e}),(0,u.jsx)(Jp,{status:e.status}),(0,u.jsx)("span",{className:he.lineName,children:U}),le&&q&&(0,u.jsxs)("span",{className:he.todoProgress,children:[ne,"/",Te.length]}),(0,u.jsx)(lg,{info:{kind:Jb(e),tool:e,displayName:U,description:le||qe?"":A,elapsed:le?"":Y,workspaceCwd:a}}),Se&&(0,u.jsx)("span",{className:!ae&&S?he.lineChevronDown:he.lineChevronRight,"aria-hidden":"true"})]}),b&&(!o||S)&&(0,u.jsx)(q8e,{display:b}),!b&&(!o||S)&&le&&q&&(0,u.jsx)(lIe,{tool:e,todos:Te,expanded:S,title:U}),!b&&(!o||S)&&le&&!q&&W&&(0,u.jsx)("div",{className:he.lineOutput,children:J6(W,f)}),!b&&Oe&&(0,u.jsx)(mg,{title:U,detail:ue,status:e.status,action:Fe,children:W&&(0,u.jsx)("div",{className:`${he.lineOutput} ${he.expandedLineOutput}`,children:J6(W,f)})}),!b&&!le&&!c&&W&&!Oe&&(!S||!qt)&&(!o||S)&&(0,u.jsx)("div",{className:S?`${he.lineOutput} ${he.expandedLineOutput}`:he.lineOutput,children:J6(W,f)}),!b&&!le&&S&&qt&&(!N||i)&&(0,u.jsx)("div",{className:N?`${he.lineDetail} ${he.workflowLineDetail}`:ye?`${he.lineDetail} ${he.markdownLineDetail}`:he.lineDetail,children:(0,u.jsx)(o5e,{tool:e,enabled:i&&(ie||me),children:X=>N?(0,u.jsx)(cIe,{tool:X,displayName:U,detail:ue,result:W}):ie?(0,u.jsx)(a5e,{tool:X}):me?(0,u.jsx)(mg,{title:U,status:X.status,action:i?(0,u.jsx)(Lq,{tool:X,workspaceCwd:a,onOpen:n}):void 0,children:(0,u.jsx)(nIe,{tool:X})}):(0,u.jsxs)(mg,{title:U,detail:ue,status:X.status,action:Fe,children:[(P==="write_file"||P==="writefile")&&(0,u.jsx)(Aq,{tool:X}),(P==="edit"||P==="write"||P==="editfile")&&(0,u.jsx)(Aq,{tool:X}),zo(X.toolName)&&(0,u.jsx)(dIe,{tool:X}),h7(P)&&(0,u.jsx)(fIe,{tool:X}),xe&&(0,u.jsx)(Ti,{content:VU(X)??""})]})})}),e.toolResult&&(S||e.toolResult.execution_status!=="success"||e.toolResult.capture_status==="partial"||e.toolResult.capture_status==="unavailable"||e.toolResult.delivery_status!=="committed")&&(0,u.jsx)(K8e,{result:e.toolResult,onOpen:r})]})},TIe),_Ie=(0,w.memo)(function({isStreaming:e,expanded:t,documentMode:a,translateContent:n,generateContent:r,onToggle:o}){let{language:s,t:i}=at();return(0,u.jsxs)("div",{className:`${he.chatSummaryThoughtHeader}${t?` ${he.chatSummaryThoughtHeaderExpanded}`:""}`,onClick:l=>{!a&&l.currentTarget.contains(l.target)&&o()},children:[(0,u.jsxs)("button",{type:"button",disabled:a,tabIndex:a?-1:void 0,className:he.chatSummaryThoughtSummary,"data-testid":"compact-thinking-summary","aria-expanded":a?void 0:t,title:a?void 0:i(t?"thinking.collapse":"thinking.expand"),children:[(0,u.jsx)("span",{className:he.chatSummaryThoughtIcon,"aria-hidden":"true",children:(0,u.jsx)(b7,{})}),(0,u.jsx)("span",{className:`${he.chatSummaryThoughtLabel}${e?` ${he.chatSummaryThoughtLabelActive}`:""}`,children:i(e?"thinking.running":"thinking.done")})]}),s==="zh-CN"&&n!==void 0&&r&&(0,u.jsx)(JU,{content:n,generateContent:r,className:he.chatSummaryThoughtTranslate}),(0,u.jsx)("span",{className:t?he.chatSummaryThoughtChevronDown:he.chatSummaryThoughtChevronRight,"aria-hidden":"true"})]})}),e9=(0,w.memo)(function({content:e,isStreaming:t,generateContent:a}){let n=Na()==="document",r=tk(),[o,s]=(0,w.useState)(!1),i=n?r:o,l=(0,w.useCallback)(()=>{n||s(c=>!c)},[n]);return(0,u.jsxs)("div",{className:he.chatSummaryThought,children:[(0,u.jsx)(_Ie,{isStreaming:t,expanded:i,documentMode:n,translateContent:n||t?void 0:e,generateContent:a,onToggle:l}),i&&(0,u.jsx)("div",{className:he.chatSummaryThoughtContent,children:(0,u.jsx)(Ti,{content:e,source:"thinking",isStreaming:t})})]})}),LIe=(0,w.memo)(function({tools:e,compactSummary:t=!1,thoughts:a,pendingApproval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,isLocateFlashing:i=!1,generateContent:l}){let{t:c}=at(),d=Na()==="document",f=tk(),p=sk(),m=IH(),g=m!==void 0,[h,b]=(0,w.useState)(!1),[v,y]=(0,w.useState)(!1),k=d?f:v,C=(0,w.useRef)(null),T=a7(e),I=e.find(q=>tn(q.status)&&!Us(q))??(e.length>0?gIe(e):void 0),S=e.length===1?e[0]:void 0,L=!!a?.length,E=S&&hr(S)?S:void 0,R=S&&S.toolName.toLowerCase()==="monitor"?S:void 0,N=(S?xg(S.rawOutput):void 0)?.resourceUri,O=e.some(q=>xg(q.rawOutput)),$=e.some(q=>m7(q.toolName)),z=e.some(q=>tn(q.status)&&!Us(q)),H=a?.find(q=>q.isStreaming),G=T&&z?!0:H!==void 0,J=!G&&e.some(q=>tn(q.status)&&Us(q)),Q=!!(!t&&E&&p),W=!!(!t&&R&&g&&!h),A=Q||W,U=!t&&E?Ci(E):void 0,Y=T?I??e[0]:e[0],P=n?.toolCallId&&e.some(q=>Hs(q,n.toolCallId)),ae=new Map,le=new Set;for(let q=0;t&&q<e.length;q++){if(!hr(e[q]))continue;let ne=q+1;for(;ne<e.length&&hr(e[ne]);)ne++;if(ne-q>=2){let ie=e.slice(q,ne);ae.set(ie[0].callId,ie);for(let te of ie.slice(1))le.add(te.callId)}q=ne-1}(0,w.useEffect)(()=>{b(!1),y(!1),C.current=null},[g,R?.callId]),(0,w.useEffect)(()=>{(N||O)&&y(!0)},[N,O]);let Te=()=>{!R||!m||$j(C,()=>m.onOpen(R),()=>{b(!0),y(q=>!q)})};return P?(0,u.jsx)("div",{className:`${he.group}${i?` ${Ul.flash}`:""}`,children:e.map(q=>(0,u.jsx)(K9,{tool:q,approval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,forceExpanded:d},q.callId))}):(0,u.jsxs)("div",{className:i?Ul.flash:void 0,children:[(0,u.jsxs)("button",{type:"button",disabled:d,"aria-disabled":!!U||void 0,tabIndex:d?-1:void 0,className:he.chatSummary,onClick:()=>{if(!(d||U)){if(Q&&E&&p){p.onOpen(E);return}if(W&&R&&m){Te();return}y(q=>!q)}},"aria-expanded":d||A?void 0:v,title:U?c(U):d||A?void 0:c(k?"tool.collapseHint":"tool.expand"),children:[(0,u.jsx)("span",{className:J?`${he.chatSummaryIcon} ${he.chatSummaryIconDetached}`:he.chatSummaryIcon,"aria-hidden":"true",children:H?(0,u.jsx)(b7,{}):Y?(0,u.jsx)(Hj,{tool:Y}):(0,u.jsx)(Uj,{})}),(0,u.jsx)("span",{className:G?`${he.chatSummaryText} ${he.chatSummaryTextActive}`:he.chatSummaryText,children:H?c("thinking.running"):S?(0,u.jsx)(yIe,{tool:S,workspaceCwd:r}):vIe(e,c,r,t)}),(0,u.jsx)("span",{className:k?he.chatChevronDown:he.chatChevronRight,"aria-hidden":"true"})]}),(k||O||$)&&(0,u.jsx)("div",{"aria-hidden":!k,ref:q=>{q?.toggleAttribute("inert",!k)},className:k?he.chatSummaryContentClip:`${he.chatSummaryContentClip} ${he.chatSummaryContentCollapsed}`,style:!k&&O&&!$?{display:"none"}:void 0,children:(0,u.jsx)("div",{className:he.chatSummaryContentInner,children:(0,u.jsxs)("div",{className:`${he.group} ${he.chatSummaryGroup}`,children:[e.map(q=>{if(le.has(q.callId))return null;let ne=ae.get(q.callId);return(0,u.jsxs)(w.Fragment,{children:[a?.filter(ie=>ie.beforeToolCallId===q.callId).map((ie,te)=>(0,u.jsx)(e9,{content:ie.content,isStreaming:ie.isStreaming,generateContent:l},`thought-${q.callId}-${te}`)),ne?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{className:he.chatSummaryParallelAgents,"data-testid":"compact-parallel-agents",children:(0,u.jsx)(CH,{agents:ne,pendingApproval:n})}),ne.slice(1).flatMap(ie=>a?.filter(te=>te.beforeToolCallId===ie.callId).map((te,me)=>(0,u.jsx)(e9,{content:te.content,isStreaming:te.isStreaming,generateContent:l},`thought-${ie.callId}-${me}`)))]}):(0,u.jsx)(K9,{tool:q,approval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,summaryOnly:!S||L,forceExpanded:d||!!S&&!L,detailsVisible:k,hideHeader:!!S&&!L})]},q.callId)}),a?.filter(q=>q.beforeToolCallId===void 0).map((q,ne)=>(0,u.jsx)(e9,{content:q.content,isStreaming:q.isStreaming,generateContent:l},`thought-trailing-${ne}`))]})})})]})}),Q7="summary-",hg=e=>`${Q7}${e}`,jj=e=>e.startsWith(Q7),gg=e=>jj(e)?e.slice(Q7.length):void 0,AIe="_message_1ujhf_1",RIe="_header_1ujhf_6",EIe="_headerStatic_1ujhf_7",MIe="_chevron_1ujhf_24",NIe="_title_1ujhf_30",PIe="_progress_1ujhf_39",su={message:AIe,header:RIe,headerStatic:EIe,chevron:MIe,title:NIe,progress:PIe};function OIe({id:e,todos:t}){let a=(0,w.useContext)(t7).get(e)?.events??[];return(0,u.jsx)(_H,{todos:t,events:a})}var DIe=(0,w.memo)(function({id:e,todos:t,isLocateFlashing:a=!1}){let{t:n}=at(),r=Na()==="document",o=tk(),[s,i]=(0,w.useState)(!1);if(t.length===0)return null;let l=r?o:s,c=t.length,d=t.filter(f=>f.status==="completed").length;return(0,u.jsxs)("div",{className:`${su.message}${a?` ${Ul.flash}`:""}`,children:[r?(0,u.jsxs)("div",{className:su.headerStatic,children:[(0,u.jsx)("span",{className:su.title,children:n("plan.title")}),(0,u.jsxs)("span",{className:su.progress,children:[d,"/",c]})]}):(0,u.jsxs)("button",{type:"button",className:su.header,onClick:()=>i(f=>!f),"aria-expanded":s,title:n(s?"todo.collapse":"todo.expand"),children:[(0,u.jsx)("span",{className:su.chevron,"aria-hidden":"true",children:s?"\u25BE":"\u25B8"}),(0,u.jsx)("span",{className:su.title,children:n("plan.title")}),(0,u.jsxs)("span",{className:su.progress,children:[d,"/",c]})]}),l?(0,u.jsx)(LH,{todos:t,numbered:!0}):(0,u.jsx)(OIe,{id:e,todos:t})]})}),$Ie="_message_1abcu_1",BIe="_content_1abcu_11",FIe="_question_1abcu_17",zIe="_prefix_1abcu_24",qIe="_answer_1abcu_28",UIe="_pending_1abcu_32",HIe="_shortcuts_1abcu_36",Md={message:$Ie,content:BIe,question:FIe,prefix:zIe,answer:qIe,pending:UIe,shortcuts:HIe},jIe=(0,w.memo)(function({question:e,answer:t,isPending:a}){let{t:n}=at();return(0,u.jsxs)("div",{className:Md.message,children:[(0,u.jsxs)("div",{className:Md.content,children:[(0,u.jsxs)("div",{className:Md.question,children:[(0,u.jsx)("span",{className:Md.prefix,children:"/btw "}),(0,u.jsx)("span",{children:e})]}),(0,u.jsx)("div",{className:Md.answer,children:a?(0,u.jsx)("span",{className:Md.pending,children:n("btw.answering")}):(0,u.jsx)(Ti,{content:t})})]}),(0,u.jsx)("div",{className:Md.shortcuts,children:n(a?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),WIe="_message_1g0wi_1",GIe="_header_1g0wi_21",VIe="_status_1g0wi_30",KIe="_name_1g0wi_35",XIe="_command_1g0wi_42",YIe="_output_1g0wi_51",Gp={message:WIe,header:GIe,status:VIe,name:KIe,command:XIe,output:YIe},QIe=(0,w.memo)(function({command:e,output:t}){let{t:a}=at();return(0,u.jsxs)("div",{className:Gp.message,children:[(0,u.jsxs)("div",{className:Gp.header,children:[(0,u.jsx)("span",{className:Gp.status,children:"\u2713"}),(0,u.jsx)("span",{className:Gp.name,children:a("shell.command")}),e&&(0,u.jsx)("span",{className:Gp.command,children:e})]}),t&&(0,u.jsx)("pre",{className:Gp.output,children:t})]})}),ZIe="_progress_1ik59_1",JIe="_spinner_1ik59_12",e_e="_bar_1ik59_19",t_e="_stage_1ik59_25",a_e="_icon_1ik59_29",n_e="_done_1ik59_35",r_e="_error_1ik59_43",o_e="_detail_1ik59_51",s_e="_path_1ik59_56",i_e="_pathButton_1ik59_61",Wn={progress:ZIe,spinner:JIe,bar:e_e,stage:t_e,icon:a_e,done:n_e,error:r_e,detail:o_e,path:s_e,pathButton:i_e},Mq=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827"];function l_e({progress:e}){let{stage:t,progress:a,detail:n,isComplete:r,error:o}=e,[s,i]=(0,w.useState)(0),l=30,c=Math.round(a/100*l),d=l-c,f="\u2588".repeat(Math.max(0,c))+"\u2591".repeat(Math.max(0,d));return(0,w.useEffect)(()=>{if(r||o)return;let p=setInterval(()=>{i(m=>(m+1)%Mq.length)},120);return()=>clearInterval(p)},[r,o]),o?(0,u.jsxs)("div",{className:`${Wn.progress} ${Wn.error}`,children:[(0,u.jsx)("span",{className:Wn.icon,children:"\u2715"}),(0,u.jsx)("span",{className:Wn.stage,children:t}),(0,u.jsx)("div",{className:Wn.detail,children:o})]}):r?(0,u.jsxs)("div",{className:`${Wn.progress} ${Wn.done}`,children:[(0,u.jsx)("span",{className:Wn.icon,children:"\u2713"}),(0,u.jsx)("span",{className:Wn.stage,children:t})]}):(0,u.jsxs)("div",{className:Wn.progress,children:[(0,u.jsx)("span",{className:Wn.spinner,children:Mq[s]}),(0,u.jsx)("span",{className:Wn.bar,children:f}),(0,u.jsxs)("span",{className:Wn.stage,children:[t,n?` (${n})`:""]})]})}function c_e({path:e,onInsightReportOpen:t}){let{t:a}=at();return(0,u.jsxs)("div",{className:`${Wn.progress} ${Wn.done}`,children:[(0,u.jsx)("span",{className:Wn.icon,children:"\u2713"}),(0,u.jsx)("span",{className:Wn.stage,children:a("insight.ready")}),t?(0,u.jsx)("button",{type:"button",className:`${Wn.path} ${Wn.pathButton}`,onClick:()=>t(e),children:e}):(0,u.jsx)("span",{className:Wn.path,children:e})]})}var u_e=(0,w.createContext)(void 0);function d_e(e,t){return e!=="background_notification"&&e!=="mid_turn_message_injected"&&e!=="goal_runtime"&&e!=="goal_control"&&(e!=="cron"||t.trim().length>0)}function f_e(){return(0,w.useContext)(u_e)}var p_e=(0,w.memo)(function({message:e,pendingApproval:t,onShowContextDetail:a,onLocateBackgroundSource:n,onImagePreview:r,onAttachmentPreview:o,onTurnOutputOpen:s,onToolResultOpen:i,onInsightReportOpen:l,workspaceCwd:c,showRetryHint:d=!1,onRetryClick:f,sendFailed:p=!1,onRetrySend:m,onEditUserMessage:g,onDeleteMessage:h,deleteMessageDisabled:b,onSubmitUserMessageEdit:v,onBranchSession:y,branchRecordId:k,showAssistantActions:C=!1,showAssistantBranch:T=!1,assistantFeedbackTurnId:I,assistantFeedbackPromptId:S,assistantFeedbackRating:L,onAssistantFeedbackRate:E,isLocateFlashing:R=!1,assistantTurnFooterInfo:N,turnSources:O,onSourceOpen:$,generateContent:z}){let{t:H}=at(),[G,J]=(0,w.useState)(!1),[Q,W]=(0,w.useState)(!1),A=(0,w.useCallback)(()=>{g?.()!==!0&&J(!0)},[g]),U=(0,w.useCallback)(()=>{J(!1)},[]),Y=(0,w.useCallback)(ve=>{v&&(W(!0),Promise.resolve(v(ve)).catch(()=>!1).then(K=>{W(!1),K!==!1&&J(!1)}))},[v]),P=(0,w.useMemo)(()=>y&&k?()=>y(k):void 0,[y,k]),ae=(0,w.useMemo)(()=>E&&S?ve=>E(S,I??"",ve):void 0,[E,S,I]),le=(0,w.useContext)(e7),Te=e.role==="tool_group"&&e.tools.length===1&&p7(e.tools[0])?e.tools[0]:void 0,q=Te?Z0e(Te):null,ne=!!q||e.role==="user"||e.role==="system"&&e.source==="mid_turn_message_injected",ie=f_e(),te=(()=>{switch(e.role){case"user":return(0,u.jsx)(UU,{content:e.content,images:e.images,files:e.files,inputAnnotations:e.inputAnnotations,isLocateFlashing:R,sendFailed:p,onRetrySend:m,editing:G,submittingEdit:Q,onEditSubmit:Y,onEditCancel:U,onImagePreview:r,onAttachmentPreview:o,author:e.author});case"assistant":return(0,u.jsx)(g1e,{content:e.content,author:e.author,agentMessage:e.agentMessage,isStreaming:e.isStreaming,timestamp:e.timestamp,onBranchSession:P,showFooterActions:C,showBranchAction:T,showAssistantFeedback:S!==void 0,assistantFeedbackRating:L,onAssistantFeedbackRate:ae,isLocateFlashing:R,customFooterInfo:N,turnSources:O,onSourceOpen:$});case"thinking":return(0,u.jsx)(x1e,{content:e.content,author:e.author,isStreaming:e.isStreaming,timestamp:e.timestamp,isLocateFlashing:R,generateContent:z});case"tool_group":return Te&&!q&&!Gd(Te)?.trim()?null:q&&Te?!q.answers.length&&!q.text.trim()?null:(0,u.jsx)(X0e,{tool:Te,result:q,isLocateFlashing:R}):(0,u.jsx)(LIe,{tools:e.tools,onTurnOutputOpen:s,onToolResultOpen:i,thoughts:e.thoughts,compactSummary:le&&jj(e.id),pendingApproval:t,workspaceCwd:c,isLocateFlashing:R,generateContent:z});case"plan":return(0,u.jsx)(DIe,{id:e.id,todos:e.todos,isLocateFlashing:R});case"system":return(0,u.jsx)(T4e,{content:e.content,variant:e.variant,source:e.source,data:e.data,images:e.images,files:e.files,onShowContextDetail:a,onLocateBackgroundSource:n,onImagePreview:r,onAttachmentPreview:o,showRetryHint:d&&e.retryable===!0,onRetryClick:f});case"user_shell":return(0,u.jsx)(QIe,{command:e.command,output:e.output});case"btw":return(0,u.jsx)(jIe,{question:e.question,answer:e.answer,isPending:e.isPending});case"insight_progress":return(0,u.jsx)(l_e,{progress:{stage:e.stage,progress:e.progress,detail:e.detail}});case"insight_ready":return(0,u.jsx)(c_e,{path:e.path,onInsightReportOpen:l});case"insight_error":return(0,u.jsx)("div",{style:{color:"var(--error-color, #e06c75)"},children:e.error});default:return null}})();if(te===null)return null;let me=(0,u.jsx)(zd,{label:`message:${e.role}`,resetKeys:[e],fallback:(0,u.jsx)(m_e,{align:ne?"end":"start"}),children:te}),xe=(0,u.jsx)("div",{"data-user-selectable":"true",style:{display:"contents"},children:me});if(e.role==="assistant")return C?xe:(0,u.jsx)(m9,{timestamp:e.timestamp,children:xe});if(e.role==="system"&&e.source==="prompt_cancelled")return xe;let Fe=ie&&e.role==="user"&&d_e(e.source,e.content)?e.id:void 0;return(0,u.jsx)(m9,{timestamp:e.timestamp,hideTimestamp:e.role==="system"&&(e.source==="background_task_completed"||e.source==="background_notification_turn_started"),chatMode:ne,toolGroupSpacing:e.role==="tool_group"&&le,copyText:ne&&"content"in e?e.content:void 0,copyTitle:H("common.copy"),onEdit:g&&!G?A:void 0,editTitle:H("userMessage.edit"),onDelete:h,deleteDisabled:b,deleteTitle:H("messageDelete.entry"),onOpenTurnCalls:ie&&Fe?()=>ie(Fe):void 0,turnCallsTitle:H("turnCalls.open"),children:xe})},h_e);function m_e({align:e}){let{t}=at();return(0,u.jsx)("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:(0,u.jsx)("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function h_e(e,t){return e.pendingApproval?.id!==t.pendingApproval?.id||e.onShowContextDetail!==t.onShowContextDetail||e.onLocateBackgroundSource!==t.onLocateBackgroundSource||e.onImagePreview!==t.onImagePreview||e.onAttachmentPreview!==t.onAttachmentPreview||e.onTurnOutputOpen!==t.onTurnOutputOpen||e.onToolResultOpen!==t.onToolResultOpen||e.workspaceCwd!==t.workspaceCwd||e.showRetryHint!==t.showRetryHint||e.onRetryClick!==t.onRetryClick||e.sendFailed!==t.sendFailed||e.onRetrySend!==t.onRetrySend||e.onEditUserMessage!==t.onEditUserMessage||e.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.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||!g_e(e.assistantTurnFooterInfo,t.assistantTurnFooterInfo)?!1:y_e(e.message,t.message)}function g_e(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 v_e(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 y_e(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&&Pq(e.images,t.images);case"assistant":return t.role==="assistant"&&e.content===t.content&&e.isStreaming===t.isStreaming&&v_e(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&&Pq(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"&&w_e(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&b_e(e.thoughts,t.thoughts)&&e.tools.length===t.tools.length&&e.tools.every((a,n)=>Wj(a,t.tools[n]));default:return!1}}function w_e(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 Wj(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&&Si(e.args)===Si(t.args)&&Si(e.rawOutput)===Si(t.rawOutput)&&Si(e.toolResult)===Si(t.toolResult)&&e.wasCancelled===t.wasCancelled&&Si(e.locations)===Si(t.locations)&&Si(e.content)===Si(t.content)&&k_e(e.subTools,t.subTools):!1}function b_e(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 k_e(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((a,n)=>Wj(a,t[n]))}var Nq=new WeakMap;function Pq(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 Si(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=Nq.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return Nq.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}function Oq({additions:e,deletions:t,className:a,additionsClassName:n,deletionsClassName:r}){return e===void 0||t===void 0?null:(0,u.jsxs)("span",{className:a,children:[(0,u.jsxs)("span",{className:n,children:["+",e]}),(0,u.jsxs)("span",{className:r,children:["-",t]})]})}function x_e(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 S_e="_root_numdi_1",C_e="_card_numdi_7",T_e="_summary_numdi_14",I_e="_icon_numdi_22",__e="_iconSvg_numdi_33",L_e="_title_numdi_39",A_e="_artifactTitle_numdi_46",R_e="_reviewSummary_numdi_52",E_e="_reviewSummaryWithStats_numdi_59",M_e="_reviewMeta_numdi_64",N_e="_linkButton_numdi_71",P_e="_reviewButton_numdi_72",O_e="_showMoreButton_numdi_73",D_e="_actions_numdi_102",$_e="_openButtonWrapper_numdi_108",B_e="_list_numdi_132",F_e="_fileRow_numdi_139",z_e="_path_numdi_159",q_e="_lineStats_numdi_168",U_e="_additions_numdi_177",H_e="_deletions_numdi_181",j_e="_chevronIcon_numdi_195",W_e="_chevronIconOpen_numdi_203",G_e="_artifactInfo_numdi_207",V_e="_artifactMeta_numdi_212",_t={root:S_e,card:C_e,summary:T_e,icon:I_e,iconSvg:__e,title:L_e,artifactTitle:A_e,reviewSummary:R_e,reviewSummaryWithStats:E_e,reviewMeta:M_e,linkButton:N_e,reviewButton:P_e,showMoreButton:O_e,actions:D_e,openButtonWrapper:$_e,list:B_e,fileRow:F_e,path:z_e,lineStats:q_e,additions:U_e,deletions:H_e,chevronIcon:j_e,chevronIconOpen:W_e,artifactInfo:G_e,artifactMeta:V_e},X9=3;function Dq(e,t){return t?e:e.slice(0,X9)}function K_e({turnId:e,changes:t,artifacts:a,sourceSessionId:n,scheduledTasks:r,workspaceCwd:o,onOpenRequest:s,onReviewChanges:i,onOpenArtifact:l,onOpenScheduledTask:c,onError:d}){let{t:f}=at(),{filterArtifact:p}=qo(),m=p?a.filter(O=>p(O,{turnId:e,sourceSessionId:n})):a,g=Dj(o),h=g?.actions,[b,v]=(0,w.useState)(!1),[y,k]=(0,w.useState)(!1);if(t.length===0&&m.length===0&&r.length===0)return null;let C=Dq(t,b),T=t.length-X9,I=Dq(m,y),S=m.length-X9,L=x_e(t),E=O=>{if(s){s({id:"review",kind:"review",title:f("turnOutputs.review"),turnId:e,changes:t,...o?{workspaceCwd:o}:{},...g?.workspaceId?{workspaceId:g.workspaceId}:{},...O?{selectedPath:O}:{}});return}i(t,O)},R=O=>{let $=J_e(O,t,o);if(s){s({id:`artifact:${O.id}`,kind:"artifact",title:pU(O),turnId:e,artifactId:O.id,...O.managedId?{managedId:O.managedId}:{},artifact:O,...o?{workspaceCwd:o}:{},...g?.workspaceId?{workspaceId:g.workspaceId}:{},...$!==void 0?{previewContent:$}:{}});return}l(O.id,$)},N=O=>{if(s){s({id:`scheduled-task:${O.toolCallId}`,kind:"scheduled_task",title:f("scheduledTasks.title"),turnId:e,task:g?.workspaceId?{...O,workspaceId:g.workspaceId}:O,...o?{workspaceCwd:o}:{},...g?.workspaceId?{workspaceId:g.workspaceId}:{}});return}c(O)};return(0,u.jsxs)("div",{className:_t.root,children:[t.length>0&&(0,u.jsxs)("div",{className:_t.card,children:[(0,u.jsxs)("div",{className:_t.summary,children:[(0,u.jsx)("span",{className:_t.icon,"aria-hidden":"true",children:(0,u.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",focusable:"false",className:_t.iconSvg,children:[(0,u.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),(0,u.jsx)("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,u.jsx)("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),(0,u.jsxs)("div",{className:[_t.reviewSummary,L?_t.reviewSummaryWithStats:""].filter(Boolean).join(" "),children:[(0,u.jsx)("div",{className:_t.title,children:f("turnOutputs.filesEdited",{count:t.length})}),(0,u.jsxs)("div",{className:_t.reviewMeta,children:[(0,u.jsx)(Oq,{additions:L?.additions,deletions:L?.deletions,className:_t.lineStats,additionsClassName:_t.additions,deletionsClassName:_t.deletions}),(0,u.jsxs)("button",{type:"button",className:_t.linkButton,onClick:()=>E(),children:[f("turnOutputs.viewChanges")," \u2197"]})]})]}),(0,u.jsx)("div",{className:_t.actions,children:(0,u.jsx)("button",{type:"button",className:_t.reviewButton,onClick:()=>E(),children:f("turnOutputs.review")})})]}),(0,u.jsxs)("div",{className:_t.list,children:[C.map(O=>(0,u.jsxs)("button",{type:"button",className:_t.fileRow,onClick:()=>E(O.path),title:O.path,children:[(0,u.jsx)("span",{className:_t.path,children:sLe(O.path,o)}),(0,u.jsx)(Oq,{additions:O.additions,deletions:O.deletions,className:_t.lineStats,additionsClassName:_t.additions,deletionsClassName:_t.deletions})]},`${O.toolCallId}:${O.path}`)),T>0&&(0,u.jsxs)("button",{type:"button",className:_t.showMoreButton,onClick:()=>v(O=>!O),children:[(0,u.jsx)("span",{children:b?f("turnOutputs.collapseFiles"):f("turnOutputs.showMoreFiles",{count:T})}),(0,u.jsx)($q,{open:b})]})]})]}),I.map(O=>{let $=rLe(O);return(0,u.jsx)(X_e,{artifact:O,externalUrl:$,onOpen:$||!Gj(O)?void 0:()=>R(O),onError:d,onDownload:nLe(O)&&h?z=>Hde(h,O.workspacePath,O.mimeType,z):void 0},O.id)}),S>0&&(0,u.jsxs)("button",{type:"button",className:_t.showMoreButton,onClick:()=>k(O=>!O),children:[(0,u.jsx)("span",{children:y?f("turnOutputs.collapseArtifacts"):f("turnOutputs.showMoreArtifacts",{count:S})}),(0,u.jsx)($q,{open:y})]}),r.map(O=>(0,u.jsx)(Y_e,{task:O,scheduleLabel:vU(O.cron,f),onOpen:()=>N(O)},O.toolCallId))]})}function X_e({artifact:e,externalUrl:t,onOpen:a,onDownload:n,onError:r}){let{t:o}=at(),s=ak(),[i,l]=(0,w.useState)(!1),c=(0,w.useRef)(!0);(0,w.useEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]);let d=Bde(e.sizeBytes),f=oLe(e,o),p=pU(e),m=async()=>{if(!(!n||i)){l(!0);try{await n(()=>!c.current)}catch(h){if(!c.current)return;let b=o("common.downloadFailed",{message:Db(h)});r?r(new Error(b,{cause:h}),b):console.error(b,h)}finally{l(!1)}}},g=(0,u.jsx)(ll,{size:16,strokeWidth:1.8,"aria-hidden":"true"});return(0,u.jsx)("div",{className:_t.card,children:(0,u.jsxs)("div",{className:_t.summary,children:[(0,u.jsx)("span",{className:_t.icon,"aria-hidden":"true",children:(0,u.jsx)(Vde,{artifact:e,className:_t.iconSvg})}),(0,u.jsxs)("div",{className:_t.artifactInfo,children:[(0,u.jsx)("div",{className:`${_t.title} ${_t.artifactTitle}`,children:p}),(0,u.jsx)("div",{className:_t.artifactMeta,children:[e.metadata?.artifactType==="web_preview_snapshot"?o("webPreview.saved"):$de(e),d,e.status==="changed"&&o("turnOutputs.artifactChanged")].filter(Boolean).join(" \xB7 ")})]}),(0,u.jsxs)("div",{className:_t.actions,children:[n&&(0,u.jsxs)("button",{type:"button",className:_t.reviewButton,onClick:()=>void m(),title:`${o("common.download")} ${p}`,disabled:i,children:[(0,u.jsx)(Dh,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),o(i?"common.downloading":"common.download")]}),(0,u.jsx)("span",{className:_t.openButtonWrapper,title:f??p,children:t?(0,u.jsxs)("a",{className:_t.reviewButton,href:t,target:"_blank",rel:"noopener noreferrer",onClick:h=>s(h,t),children:[g,o("common.open")]}):(0,u.jsxs)("button",{type:"button",className:_t.reviewButton,onClick:a,disabled:!a,children:[g,o("common.open")]})})]})]})})}function Y_e({task:e,scheduleLabel:t,onOpen:a}){let{t:n}=at();return(0,u.jsx)("div",{className:_t.card,children:(0,u.jsxs)("div",{className:_t.summary,children:[(0,u.jsx)("span",{className:_t.icon,"aria-hidden":"true",children:(0,u.jsx)(Q_e,{})}),(0,u.jsxs)("div",{className:_t.artifactInfo,children:[(0,u.jsx)("div",{className:_t.title,children:e.title}),(0,u.jsx)("div",{className:_t.artifactMeta,children:[t,e.recurring?n("scheduledTasks.repeats"):n("scheduledTasks.runsOnce")].filter(Boolean).join(" \xB7 ")})]}),(0,u.jsx)("div",{className:_t.actions,children:(0,u.jsx)("button",{type:"button",className:_t.reviewButton,onClick:a,title:e.title,children:n("common.open")})})]})})}function Q_e(){return(0,u.jsxs)("svg",{className:_t.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[(0,u.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),(0,u.jsx)("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function $q({open:e}){return(0,u.jsx)("svg",{className:[_t.chevronIcon,e?_t.chevronIconOpen:""].filter(Boolean).join(" "),viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:(0,u.jsx)("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}var Z_e=(0,w.memo)(K_e);function J_e(e,t,a){if(!tLe(e)||!e.workspacePath)return;let n=t.find(r=>jde(r.path,e.workspacePath,a));if(n)return eLe(n)}function eLe(e){for(let t=e.diffs.length-1;t>=0;t--){let a=e.diffs[t];if(a?.fullContent)return a.newText}}function tLe(e){let t=e.workspacePath?.toLowerCase()??"",a=e.mimeType?.toLowerCase()??"";return e.kind==="html"||aLe(t)||a==="text/html"||a==="text/markdown"}function aLe(e){let t=e.toLowerCase();return t.endsWith(".html")||t.endsWith(".htm")||t.endsWith(".md")||t.endsWith(".markdown")||h9(t)!==void 0}function nLe(e){return e.storage==="workspace"&&(e.status==="available"||e.status==="changed")&&!!e.workspacePath}function Gj(e){return e.storage!=="workspace"?!0:e.status==="available"||e.status==="changed"}function rLe(e){if(e.kind!=="link"||e.storage==="published")return;let t=e.url?.trim();return l7(t)?t:void 0}function oLe(e,t){if(!Gj(e))return e.workspacePath?t("turnOutputs.artifactUnavailable",{path:e.workspacePath}):t("turnOutputs.artifactMissing")}function sLe(e,t){return g9(e,t)}function iLe(e,t){let[a,n]=(0,w.useState)(!1);return(0,w.useLayoutEffect)(()=>{let r=e.current;if(!r||!t){n(!1);return}let o=r.closest("[data-history-viewport]")??r,s=()=>{let d=Number.parseFloat(getComputedStyle(r).getPropertyValue("--chat-regular-content-width"))||1e3;n(o.getBoundingClientRect().width>=d)};s();let i=typeof ResizeObserver>"u"?null:new ResizeObserver(s);i?.observe(o);let l=r.closest("[data-web-shell-root]"),c=new MutationObserver(s);return l&&c.observe(l,{attributes:!0,attributeFilter:["style"]}),()=>{i?.disconnect(),c.disconnect()}},[e,t]),a}var lLe="_collapseRow_d7f01_1",cLe="_collapseRowClickable_d7f01_14",uLe="_collapseLabel_d7f01_19",dLe="_processedLabel_d7f01_36",fLe="_processedMeta_d7f01_43",pLe="_hiddenMetrics_d7f01_47",mLe="_summaryMetrics_d7f01_51",hLe="_collapseIcon_d7f01_59",gLe="_chevronRight_d7f01_72",vLe="_chevronDown_d7f01_73",zs={collapseRow:lLe,collapseRowClickable:cLe,collapseLabel:uLe,processedLabel:dLe,processedMeta:fLe,hiddenMetrics:pLe,summaryMetrics:mLe,collapseIcon:hLe,chevronRight:gLe,chevronDown:vLe},yLe="_list_mrow6_1",wLe="_listWithWelcomeHeader_mrow6_12",bLe="_historyStatus_mrow6_32",kLe="_historyRetryButton_mrow6_38",xLe="_virtualSizer_mrow6_64",SLe="_virtualRow_mrow6_73",CLe="_loadingSkeleton_mrow6_83",TLe="_srOnly_mrow6_91",ILe="_loadingSkeletonUserRow_mrow6_103",_Le="_loadingSkeletonAssistantRow_mrow6_109",LLe="_loadingSkeletonUserBubble_mrow6_115",ALe="_loadingSkeletonUserBubbleCompact_mrow6_116",RLe="_loadingSkeletonAssistantBlock_mrow6_130",ELe="_loadingSkeletonLineWide_mrow6_138",MLe="_loadingSkeletonLineMedium_mrow6_139",NLe="_loadingSkeletonLineShort_mrow6_140",PLe="_loadingSkeletonLineNarrow_mrow6_141",OLe="_turnStatusRow_mrow6_181",DLe="_turnAnswerRow_mrow6_182",$Le="_turnContentRow_mrow6_193",BLe="_sessionTimelineLayer_mrow6_197",FLe="_sessionTimelinePanel_mrow6_210",zLe="_sessionTimelineViewport_mrow6_226",qLe="_sessionTimelineList_mrow6_275",ULe="_sessionTimelineItem_mrow6_285",HLe="_sessionTimelineButton_mrow6_290",jLe="_sessionTimelineTick_mrow6_310",WLe="_sessionTimelineButtonInRange_mrow6_400",GLe="_sessionTimelineButtonCurrent_mrow6_404",VLe="_sessionTimelineDetails_mrow6_415",KLe="_sessionTimelineDetailsTitle_mrow6_453",XLe="_sessionTimelineDetailsIcon_mrow6_460",YLe="_sessionTimelineDetailsTitleText_mrow6_472",QLe="_sessionTimelineDetailsDetail_mrow6_482",ZLe="_deletionMode_mrow6_501",JLe="_deletionCheckbox_mrow6_507",Et={list:yLe,listWithWelcomeHeader:wLe,historyStatus:bLe,historyRetryButton:kLe,virtualSizer:xLe,virtualRow:SLe,loadingSkeleton:CLe,srOnly:TLe,loadingSkeletonUserRow:ILe,loadingSkeletonAssistantRow:_Le,loadingSkeletonUserBubble:LLe,loadingSkeletonUserBubbleCompact:ALe,loadingSkeletonAssistantBlock:RLe,loadingSkeletonLineWide:ELe,loadingSkeletonLineMedium:MLe,loadingSkeletonLineShort:NLe,loadingSkeletonLineNarrow:PLe,turnStatusRow:OLe,turnAnswerRow:DLe,turnContentRow:$Le,sessionTimelineLayer:BLe,sessionTimelinePanel:FLe,sessionTimelineViewport:zLe,sessionTimelineList:qLe,sessionTimelineItem:ULe,sessionTimelineButton:HLe,sessionTimelineTick:jLe,sessionTimelineButtonInRange:WLe,sessionTimelineButtonCurrent:GLe,sessionTimelineDetails:VLe,sessionTimelineDetailsTitle:KLe,sessionTimelineDetailsIcon:XLe,sessionTimelineDetailsTitleText:YLe,sessionTimelineDetailsDetail:QLe,deletionMode:ZLe,deletionCheckbox:JLe},t9=()=>{},eAe=15e3,a9=180,tAe=400,Bq=5e3;function aAe(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 Fq(e,t){return e.length===t.length&&e.every((a,n)=>Object.is(a,t[n]))}function nAe(e){for(let t=e.length-1;t>=0;t--){let a=e[t];if(a?.role==="user")return a.id}return null}function rAe(e){return e[e.length-1]}function oAe(e){for(let t=e.length-1;t>=0;t--){let a=e[t];if(a&&oo(a))return a.id}return null}function sAe(e,t){return e.role!=="tool_group"?!1:!!(t?.toolCallId&&e.tools.some(a=>Hs(a,t.toolCallId)))}function Y9(e){return p7(e)||!!xg(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(Y9)){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)Y9(i)?(s(r),r=[],s([i])):r.push(i);s(r)}return a?t:e}function iAe(e,t){let a=[],n=0,r=o=>o.role==="tool_group"&&!sAe(o,t)&&!o.tools.some(Y9);for(;n<e.length;){let o=e[n];if(o.role!=="thinking"&&!r(o)){a.push(o),n++;continue}let s=[],i=n-1,l=n;for(;l<e.length;){let p=e[l];if(p.role==="thinking"||r(p)){s.push(p),i=l,l++;continue}break}let c=s.filter(p=>p.role==="tool_group").flatMap(p=>p.tools);if(c.length===0||s.length<=1||s.length>=2&&s.every(u9)){for(let p of s)a.push(p);n=i+1;continue}let d=[],f=[];for(let p of s)if(p.role==="thinking"){let m={content:p.content,...p.isStreaming===!0?{isStreaming:!0}:{}};d.push(m),f.push(m)}else if(p.role==="tool_group"&&p.tools.length>0){let m=p.tools[0].callId;for(let g of f)g.beforeToolCallId=m;f.length=0}a.push({id:hg(s[0].id),role:"tool_group",tools:c,...d.length>0?{thoughts:d}:{},timestamp:s[0].timestamp}),n=i+1}return a}function lAe(e,t){let a=e[e.length-1];if(a?.role!=="tool_group"||gg(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===hg(t.id)?{timestamp:t.timestamp}:{}},o}function cAe(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 qq(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 Uq(e,t){let a=e.get(t);if(a!==void 0)return a;let n=cAe(t);return e.set(t,n),n}function Vj(e){return kue(HAe(e))}function Ib(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 uAe(e,t,a,n,r){if((!a||a.size===0)&&(!n||n.size===0)&&(!r||r.size===0))return e;let o=[],s=null,i=(l,c)=>{if(c&&t||!l)return;let d=a?.get(l)??[],f=n?.get(l)??[],p=r?.get(l)??[];if(d.length===0&&f.length===0&&p.length===0)return;let m=o.length;for(let g=o.length-1;g>=0;g-=1){let h=o[g];if(h.type!=="message"||h.message.role!=="system")break;h.message.source==="recap"&&(m=g)}o.splice(m,0,{type:"turn_outputs",key:l,turnId:l,changes:d,artifacts:f,scheduledTasks:p})};for(let l of e)l.type==="message"&&oo(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 dAe(e,t){let a=s=>s.type==="parallel_agents"&&(t?.has(s.key)===!0||s.agents.some(i=>tn(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"&&oo(s.message)?(o(),n.push(s)):a(s)?r.push(s):n.push(s);return o(),n}function Kj(e){return e.type==="message"&&e.message.role==="assistant"&&e.message.agentMessage?.kind==="agent_message"}function Xj(e,t){return e.type==="message"&&!Kj(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 gk(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(_Ae(s))r=!0;else if(!r&&Xj(s,n))return o}return-1}function fAe(e,{isResponding:t,latestTurnAwaitsAgentSummary:a,gateBackgroundAgentStatus:n}){let r=[];for(let s=0;s<e.length;s++){let i=e[s];i.type==="message"&&oo(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&&Jj(e,i,l))continue;let c=e[i],d=gk(e,i,l,!1);if(d<0)continue;let f=e[d];c?.type==="message"&&f.type==="message"&&f.message.role==="assistant"&&o.set(f.message.id,c.message.id)}return o}function Hq(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(p7);case"plan":return!0;case"assistant":return!t&&!Kj(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 Yj(e){return e.source==="mid_turn_message_injected"}function pAe(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}:jd(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 Yj(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 jd(e,t,a={}){let n=(a.stripMarkdown===!0?mAe(e):e??"").replace(/\s+/g," ").trim();if(t<=0||!n)return"";let r=Array.from(n);return r.length>t?`${r.slice(0,t-1).join("")}\u2026`:n}function mAe(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=n9(n,"~~"),n=n9(n,"**"),n=n9(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 n9(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 hAe(e,t){let a=e.role==="user"?e.content:e.role==="user_shell"?e.command:"";return jd(a,32)||(t?t("timeline.userTurn"):"User turn")}function gAe(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function oo(e){return e.role==="user"||e.role==="user_shell"}function vAe(e,t){if(!t.startsWith("msg:"))return;let a=t.slice(4);a=gg(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&&oo(o))return o.id}return}}function yAe(e,t){for(let a of e)if(a.type==="turn_collapse"&&a.turnCollapse.turnId===t)return a.turnCollapse.collapsed;return!1}function wAe(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return jd(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 Yj(e)?jd(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 bAe(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"?"":wAe(e.message,t)}function kAe(e,t){return t?t(`timeline.kind.${e}`):nRe[e]}function xAe(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=jd(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=bAe(i,n);l&&r.push(l)}return jd(r.join(" \xB7 "),180)||(a.length>0?a.map(s=>kAe(s,n)).join(" \xB7 "):n?n("timeline.noActivity"):"No activity")}function SAe(e,t){let a=[],n=null,r=[],o=()=>{if(!n)return;let s=Vj(r),i=gk(s,-1,s.length-1,!1),l=i>=0?s[i]:null,c=l?.type==="message"&&l.message.role==="assistant"&&!l.message.isStreaming&&jd(l.message.content,1,{stripMarkdown:!0}).length>0?l.message.id:null,d=[];for(let f of s){if(f.type==="message"&&c!==null&&f.message.id===c)continue;let p=pAe(f,t);p.kind!=="none"&&!d.includes(p.kind)&&d.push(p.kind)}a.push({id:n.id,label:hAe(n,t),detail:xAe(s,c,d,t),timestamp:n.timestamp,nodeKinds:d,...gAe(n)?{isScheduledTask:!0}:{}})};for(let s of e){if(oo(s)){o(),n=s,r=[];continue}n&&r.push(s)}return o(),a}function CAe(){return(0,u.jsxs)("svg",{className:Et.sessionTimelineDetailsIcon,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,u.jsx)("circle",{cx:"8",cy:"8",r:"6.25"}),(0,u.jsx)("path",{d:"M8 4.5v4l-2.5 2"})]})}function TAe(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 IAe(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(TAe).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 _Ae(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 LAe(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=>tn(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=>tn(a.status));return t.length===0?null:`tools:${e.message.id}:${t.map(a=>a.callId).join(",")}`}function AAe(e){for(let t=e.length-1;t>=0;t--){let a=LAe(e[t]);if(a)return a}return null}function RAe(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 MAe(e){if(!(e.type!=="message"||e.message.role!=="assistant"))return e.message.content?.trim()?e.message.timestamp:void 0}function NAe(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function r9(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function jq(e){if(e.parentToolCallId||!hr(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=r9(a?.inputTokens),r=r9(a?.outputTokens);if(n===void 0&&r===void 0)return;let o=r9(a?.cachedTokens);return{callId:e.callId,usage:{inputTokens:n??0,outputTokens:r??0,...o!==void 0?{cachedTokens:o}:{}}}}function PAe(e){return e.type==="parallel_agents"?e.agents.flatMap(t=>jq(t)??[]):e.type!=="message"||e.message.role!=="tool_group"?[]:e.message.tools.flatMap(t=>jq(t)??[])}function OAe(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=>!zo(t.toolName)).length:0}function Qj(e,t){for(let a=Math.min(t,e.length-1);a>=0;a--){let n=e[a];if(n.type==="message"&&oo(n.message))return n.message.id}return null}function Zj(e){let t=[],a=null;for(let n of e)n.type==="message"&&oo(n.message)&&(a=n.message.id),t.push(a);return t}function Wq(e,t,a,n){let r=n===void 0?Qj(e,t):n[t]??null;return r?a.get(r)??null:null}function DAe(e,t,a,n,r=Zj(e)){let o=Number.POSITIVE_INFINITY,s=-1;for(let l of t){if(l<0||l>=e.length)continue;let c=Wq(e,l,a,r);c!==null&&(o=Math.min(o,c),s=Math.max(s,c))}if(s<0)return null;let i=n==null?null:Wq(e,n,a,r);return{startIndex:o,endIndex:s,currentIndex:i!==null&&i>=o&&i<=s?i:s}}function Fg(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 $Ae(e,t,a,n){return n?Fg(e,t,a,r=>Hs(r,n)):!1}function BAe(e,t,a){return Fg(e,t,a,n=>hr(n)&&tn(n.status))}function FAe(e,t,a){return Fg(e,t,a,n=>xg(n.rawOutput)!==void 0)}function zAe(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 qAe(e,t,a,n){return Fg(e,t,a,r=>{let o=bue(r);return o!==void 0&&!n.has(o)})}function Jj(e,t,a){return Fg(e,t,a,n=>Us(n)&&tn(n.status))}function UAe(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 o9(e){return e.type==="parallel_agents"?e.agents.filter(t=>Us(t)&&t.status!=="failed").map(t=>t.callId):e.type==="message"&&e.message.role==="tool_group"?e.message.tools.filter(t=>Us(t)&&t.status!=="failed").map(t=>t.callId):[]}function eW(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":aU(o)?o:void 0;return s?{...typeof r=="string"?{callId:r}:{},status:s,...e.timestamp!==void 0?{endTime:e.timestamp}:{}}:null}function Q9(e){return e.type==="message"?eW(e.message):null}function HAe(e){let t=new Map;for(let r of e){let o=eW(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||!Us(i)||!tn(i.status))return i;let c=nU(i,l.status,l.endTime);return c===i?i:(o=!0,c)});return o?(a=!0,{...r,tools:s}):r});return a?n:e}function tW(e,t,a,n){let r=-1,o;for(let c=a;c>t;c--){let d=e[c];if(!(d.type!=="message"||d.message.role!=="system")){if(d.message.source==="turn_error"||d.message.source==="prompt_cancelled"){if(r<0)return null;continue}if(d.message.source==="background_notification"){let f=Q9(d);if(n&&!f)continue;r<0&&(r=c,o=f?.callId)}}}if(r<0)return null;let s=-1;if(o){for(let c=a;c>=0;c--)if(o9(e[c]).includes(o)){s=c;break}}for(let c=a;c>=t&&!(s>=0);c--)if(o9(e[c]).length>0){s=c;break}let i=new Set,l=!1;if(s>=0){let c=s;for(let f=s;f>=0;f--){let p=e[f];if(p.type==="message"&&oo(p.message)){c=f;break}}let d=[];for(let f=c;f<=a;f++){let p=e[f];for(let g of o9(p))i.add(g);let m=Q9(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 Z9(e,t,a,n=!1,r=!0,o=!0){let s=tW(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&&gk(e,t,a,!1)<s.lastNotificationIndex}function jAe(e,{overrides:t,isResponding:a,activeTurnStartedAt:n,backgroundSummaryGraceActive:r=!0,waitForUnmatchedAgentCompletions:o=!0,waitForOrderedNarration:s=!0,terminalBackgroundShellTaskIds:i,automaticallyExpandedAgentKeys:l,pendingApprovalCallId:c,includeSubagentToolUsageInMetrics:d=!0,paginatedExpanded:f,enabled:p}){if(!p||e.length===0)return e;let m=[];for(let b=0;b<e.length;b++){let v=e[b];v.type==="message"&&oo(v.message)&&m.push(b)}if(m.length===0)return e;let g=zAe(e,i),h=[];for(let b=0;b<m[0];b++)h.push(e[b]);for(let b=0;b<m.length;b++){let v=m[b],y=(b+1<m.length?m[b+1]:e.length)-1,k=e[v],C=k.message.id,T=k.message.timestamp,I=b===m.length-1,S=I&&a,L=BAe(e,v,y),E=FAe(e,v,y),R=qAe(e,v,y,g),N=UAe(e,v,y,l),O=I&&r&&Z9(e,v,y,!1,o,s),$=$Ae(e,v,y,c),z=gk(e,v,y),H=z;if(z>=0&&Xj(e[z],!1)){let ve=!1;for(let K=z-1;K>v;K--){let Se=e[K];if(Se.type!=="message")break;if(Se.message.role==="system"&&Se.message.source==="background_task_completed")ve=!0;else if(ve&&Se.message.role==="assistant")H=K,ve=!1;else break}}let G=0,J,Q,W,A=0,U=0,Y=0,P=0,ae=0,le=!1,Te=new Set,q=!1;for(let ve=v+1;ve<=y;ve++){let K=e[ve];if(Hq(K,ve>=H&&ve<=z)&&G++,EAe(K)&&(q=!0),P+=OAe(K),K.type==="message"&&K.message.role==="thinking"?ae++:K.type==="message"&&K.message.role==="tool_group"&&K.message.thoughts&&(ae+=K.message.thoughts.length),K.type==="message"&&K.message.role==="system"&&K.message.source==="prompt_cancelled"){let ut=K.message.data,qt=ut&&typeof ut=="object"&&"elapsedMs"in ut?ut.elapsedMs:void 0;typeof qt=="number"&&Number.isFinite(qt)&&qt>=0&&(Q=qt)}let Se=RAe(K);Se!==void 0&&(J=J===void 0?Se:Math.max(J,Se));let Le=MAe(K);Le!==void 0&&(W=W===void 0?Le:Math.max(W,Le));let Ye=NAe(K);if(Ye&&(A+=Ye.inputTokens,U+=Ye.outputTokens,Y+=Ye.cachedTokens??0,le=!0),d)for(let ut of PAe(K))Te.has(ut.callId)||(Te.add(ut.callId),A+=ut.usage.inputTokens,U+=ut.usage.outputTokens,Y+=ut.usage.cachedTokens??0,le=!0)}let ne=S||O?n??T??Date.now():void 0,ie=J??W,te=Q??(T!==void 0&&ie!==void 0&&ie>=T?ie-T:void 0);if($||G===0&&!(le||te!==void 0||ne!==void 0)){for(let ve=v;ve<=y;ve++)h.push(e[ve]);continue}let me=S||L||E||R||N||O||(q||z<0)&&I,xe=!(G===0||(t.has(C)?t.get(C):f?.has(C)||me));h.push({type:"message",key:k.key,message:k.message});let Fe={turnId:C,collapsed:xe,hiddenCount:G,...te!==void 0?{elapsedMs:te}:{},...le?{inputTokens:A,outputTokens:U}:{},...Y>0?{cachedTokens:Y}:{},...P>0?{toolCallCount:P}:{},...ae>0?{thinkingCount:ae}:{},...ne!==void 0?{liveStartedAt:ne}:{}};if(h.push({type:"turn_collapse",key:`tc-${C}`,turnCollapse:Fe}),!xe){for(let ve=v+1;ve<=y;ve++){let K=e[ve];ve===z&&K.type==="message"&&K.message.role==="assistant"?h.push({...K,turnCollapse:Fe}):h.push(K)}continue}for(let ve=v+1;ve<=y;ve++){let K=e[ve];if(!(ve===z&&S)){if(ve===z&&K.type==="message"&&K.message.role==="assistant"){h.push({...K,turnCollapse:Fe});continue}Hq(K,ve>=H&&ve<=z)||h.push(K)}}}return h}function _b(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=>Hs(o,a))||r.type==="parallel_agents"&&r.agents.some(o=>Hs(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 Gq(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=>Hs(n,a)):e.message.id===t.messageId:e.type==="parallel_agents"?!!a&&e.agents.some(n=>Hs(n,a)):(e.type,!1)}function Vq(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=>Hs(r,n.callId))):a.id===(e.type==="turn_outputs"?e.turnId:e.turnCollapse.turnId)).flatMap(a=>a.sourceBlockIds??[]).join(",")||void 0:void 0}var s9=0,WAe=120,GAe=80,VAe=32,KAe=240,Lb=30,i9=160,Kq=30,aW=200;function XAe(e,t=aW){return e>t}function YAe(e,t){return e<=t}function QAe(e){let t=Math.max(0,Math.ceil(e/1e3));if(t<60)return`${t}s`;let a=Math.floor(t/60),n=t-a*60;return`${a}m ${n}s`}function ZAe(e){return e!==void 0&&e>=0?QAe(e):""}function JAe(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";let a=e.cachedTokens??0,n=a>0&&e.inputTokens>0?` (${Vn(a)} ${t("turn.cached")}, ${Math.round(a/e.inputTokens*100)}%)`:"";return`\u2191${Vn(e.inputTokens)}${n} \u2193${Vn(e.outputTokens)}`}function Xq(e,t){let a=[],n=JAe(e,t);return n&&a.push(n),e.toolCallCount!==void 0&&e.toolCallCount>0&&a.push(t("turn.toolCalls",{count:e.toolCallCount})),e.thinkingCount!==void 0&&e.thinkingCount>0&&a.push(t("turn.thinkingCount",{count:e.thinkingCount})),a.join(" \xB7 ")}function eRe(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}function nW(e){return e.hiddenCount>0||e.liveStartedAt!==void 0||eRe(e)}var tRe=(0,w.memo)(function({turnCollapse:e,onToggleCollapse:t}){let{t:a}=at(),n=e.hiddenCount>0,r=e.liveStartedAt,o=nW(e),s=ck(r!==void 0&&o),i=(0,w.useRef)(0),l=(0,w.useRef)(r);l.current!==r&&(l.current=r,i.current=0);let c;r!==void 0&&o?(i.current=Math.max(i.current,Math.max(0,s-r)),c=i.current):o&&e.elapsedMs!==void 0?(i.current=0,c=e.elapsedMs):(i.current=0,c=void 0);let d=ZAe(c),f=Xq(e,a),p=Xq(e,a),m=a(r!==void 0?"turn.processing":"turn.processed"),g=!!d&&o,h=!!f&&o,b=!!p&&o;if(!o)return null;let v=()=>{if(!n)return;let y=e.collapsed;t(e.turnId,y)};return(0,u.jsxs)("div",{className:n?`${zs.collapseRow} ${zs.collapseRowClickable}`:zs.collapseRow,role:n?"button":void 0,tabIndex:n?0:void 0,"aria-expanded":n?!e.collapsed:void 0,"aria-label":n?e.collapsed?a("turn.expand"):a("turn.collapse"):void 0,title:n?e.collapsed?a("turn.expand"):a("turn.collapse"):void 0,onClick:n?v:void 0,onKeyDown:n?y=>{y.key!=="Enter"&&y.key!==" "||(y.preventDefault(),v())}:void 0,children:[(0,u.jsxs)("span",{className:zs.collapseLabel,children:[(0,u.jsxs)("span",{className:zs.processedLabel,children:[m,g&&(0,u.jsxs)("span",{className:zs.processedMeta,children:[" ",d]})]}),b&&(0,u.jsx)("span",{className:zs.summaryMetrics,children:p}),h&&(0,u.jsx)("span",{className:zs.hiddenMetrics,children:f})]}),n&&(0,u.jsx)("span",{"data-testid":`toggle-${e.turnId}`,className:zs.collapseIcon,onClick:y=>{y.stopPropagation(),v()},children:(0,u.jsx)("span",{className:e.collapsed?zs.chevronRight:zs.chevronDown,"aria-hidden":"true"})})]})});function aRe(e){if(e.type==="turn_collapse")return Et.turnStatusRow;if(e.type==="turn_outputs")return Et.turnContentRow;if(e.type==="message"&&e.turnCollapse)return Et.turnAnswerRow}var nRe={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},rRe=["--background","--foreground","--muted-foreground","--border","--font-sans"],Yq="session-timeline-detail-tooltip",oRe=(0,w.memo)(function({entries:e,currentTurnId:t,currentRange:a,hidden:n,onSelect:r,action:o}){let s=Wd(),{t:i}=at(),l=(0,w.useRef)(null),c=(0,w.useRef)(null),d=(0,w.useRef)(null),f=(0,w.useRef)(!1),p=(0,w.useRef)(!1),m=(0,w.useRef)(null),g=(0,w.useRef)(null),[h,b]=(0,w.useState)(null),v=a!==null?a.currentIndex:e.findIndex(R=>R.id===t),y=(0,w.useCallback)(()=>b(null),[]),k=(0,w.useCallback)(()=>{f.current||p.current||y()},[y]),C=(0,w.useCallback)((R,N)=>{let O=l.current;if(!O)return null;let $=getComputedStyle(O),z=N.getBoundingClientRect();return{entry:R,top:z.top+z.height/2,left:z.right+8,clamped:!1,themeVars:Object.fromEntries(rRe.map(H=>[H,$.getPropertyValue(H)]))}},[]),T=(0,w.useCallback)(R=>{let N=c.current;return N?Array.from(N.querySelectorAll('[data-testid="session-timeline-entry"]')).find(O=>O.getAttribute("data-turn-id")===R.id)?.querySelector("button")??null:null},[]),I=(0,w.useCallback)(R=>{let N=c.current;if(!N)return!1;let O=N.getBoundingClientRect(),$=R.getBoundingClientRect();return $.bottom>=O.top&&$.top<=O.bottom},[]),S=(0,w.useCallback)(()=>{b(R=>{if(!R)return null;let N=T(R.entry);return!N||!I(N)?null:C(R.entry,N)})},[C,T,I]),L=(0,w.useCallback)((R,N)=>{b(C(R,N))},[C]),E=(0,w.useCallback)(()=>{typeof window>"u"||(m.current!==null&&window.cancelAnimationFrame(m.current),g.current!==null&&window.clearTimeout(g.current),p.current=!0,m.current=window.requestAnimationFrame(()=>{m.current=null,p.current=!1,S()}),g.current=window.setTimeout(()=>{g.current=null,p.current=!1},100))},[S]);return(0,w.useLayoutEffect)(()=>{if(n)return;let R=c.current;if(!R||v<0)return;let N=R.querySelector(`[data-timeline-index="${v}"]`);if(!N)return;let O=N.offsetTop+N.offsetHeight/2,$=R.scrollHeight-R.clientHeight,z=Math.max(0,Math.min(O-R.clientHeight/2,$));if(R.scrollTop===z)return;f.current=!0,R.scrollTop=z;let H=window.requestAnimationFrame(()=>{f.current=!1,S()}),G=window.setTimeout(()=>{f.current=!1},100);return()=>{window.cancelAnimationFrame(H),window.clearTimeout(G),f.current=!1}},[v,n,S]),(0,w.useLayoutEffect)(()=>{if(!(!h||typeof window>"u"))return window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)}},[S,h]),(0,w.useLayoutEffect)(()=>()=>{m.current!==null&&window.cancelAnimationFrame(m.current),g.current!==null&&window.clearTimeout(g.current),p.current=!1},[]),(0,w.useLayoutEffect)(()=>{if(!h||h.clamped)return;let R=l.current,N=d.current;if(!R||!N||typeof window>"u")return;let O=N.getBoundingClientRect(),$=12,z=h.top;O.top<$?z+=$-O.top:O.bottom>window.innerHeight-$&&(z-=O.bottom-(window.innerHeight-$)),z!==h.top&&b(H=>H?.entry.id===h.entry.id?{...H,top:z,clamped:!0}:H)},[h]),n||e.length===0?null:(0,u.jsx)("div",{className:Et.sessionTimelineLayer,"aria-hidden":"false",children:(0,u.jsxs)("nav",{ref:l,className:Et.sessionTimelinePanel,"aria-label":i("timeline.sessionTimeline"),"data-testid":"session-timeline",onMouseLeave:y,children:[(0,u.jsx)("div",{ref:c,className:Et.sessionTimelineViewport,"data-testid":"session-timeline-viewport",onScroll:k,children:(0,u.jsx)("ol",{className:Et.sessionTimelineList,children:e.map((R,N)=>{let O=a!==null&&N>=a.startIndex&&N<=a.endIndex,$=a!==null?N===a.currentIndex:R.id===t,z=R.nodeKinds.join(","),H=[`${i("timeline.turnPrefix",{index:N+1})}: ${R.label}`,$?i("timeline.currentTurn"):null].filter(Boolean).join(". "),G=W=>L(R,W.currentTarget),J=W=>{E(),L(R,W.currentTarget)},Q=h?.entry.id===R.id;return(0,u.jsx)("li",{className:Et.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":R.id,"data-timeline-index":N,"data-node-kinds":z,"data-in-current-range":O?"true":void 0,children:(0,u.jsx)("button",{type:"button",className:J9(Et.sessionTimelineButton,O?Et.sessionTimelineButtonInRange:void 0,$?Et.sessionTimelineButtonCurrent:void 0),"aria-current":$?"step":void 0,"aria-describedby":Q?Yq:void 0,"aria-label":H,onClick:()=>r(R.id),onFocus:J,onBlur:y,onMouseEnter:G,onMouseLeave:y,children:(0,u.jsx)("span",{className:Et.sessionTimelineTick})})},R.id)})})}),o,h&&typeof document<"u"&&(0,Sg.createPortal)((0,u.jsxs)("div",{ref:d,className:Et.sessionTimelineDetails,id:Yq,"data-testid":"session-timeline-detail","data-title":h.entry.label,"data-detail":h.entry.detail,"data-scheduled-task":h.entry.isScheduledTask?"true":void 0,role:"tooltip",style:{...h.themeVars,top:h.top,left:h.left},children:[(0,u.jsxs)("span",{className:Et.sessionTimelineDetailsTitle,children:[h.entry.isScheduledTask&&(0,u.jsx)(CAe,{}),(0,u.jsx)("span",{className:Et.sessionTimelineDetailsTitleText,children:h.entry.label})]}),(0,u.jsx)("span",{className:Et.sessionTimelineDetailsDetail,children:h.entry.detail})]}),s??document.body)]})})});function J9(...e){return e.filter(Boolean).join(" ")||void 0}var sRe=[];function iRe({label:e}){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{role:"status","aria-live":"polite",className:Et.srOnly,children:e}),(0,u.jsxs)("div",{className:Et.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[(0,u.jsx)("div",{className:Et.loadingSkeletonUserRow,children:(0,u.jsxs)("div",{className:Et.loadingSkeletonUserBubble,children:[(0,u.jsx)("span",{className:Et.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Et.loadingSkeletonLineShort})]})}),(0,u.jsx)("div",{className:Et.loadingSkeletonAssistantRow,children:(0,u.jsxs)("div",{className:Et.loadingSkeletonAssistantBlock,children:[(0,u.jsx)("span",{className:Et.loadingSkeletonLineMedium}),(0,u.jsx)("span",{className:Et.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Et.loadingSkeletonLineNarrow})]})}),(0,u.jsx)("div",{className:Et.loadingSkeletonUserRow,children:(0,u.jsx)("div",{className:Et.loadingSkeletonUserBubbleCompact,children:(0,u.jsx)("span",{className:Et.loadingSkeletonLineMedium})})}),(0,u.jsx)("div",{className:Et.loadingSkeletonAssistantRow,children:(0,u.jsxs)("div",{className:Et.loadingSkeletonAssistantBlock,children:[(0,u.jsx)("span",{className:Et.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Et.loadingSkeletonLineMedium})]})})]})]})}var lRe=(0,w.memo)((0,w.forwardRef)(function({messages:e,deletion:t,frozenViewport:a=!1,sessionKey:n,terminalBackgroundShellTaskIds:r,pendingApproval:o,onShowContextDetail:s,onImagePreview:i,onAttachmentPreview:l,onInsightReportOpen:c,onEditUserMessage:d,onSubmitUserMessageEdit:f,loadingTranscript:p,catchingUp:m,hasOlderHistory:g=!1,loadingOlderHistory:h=!1,historyCapacityReached:b=!1,historyPaginationError:v=!1,onLoadOlderHistory:y,transcriptBlockCount:k=0,transcriptActivity:C,onReloadTranscript:T,isResponding:I=!1,transcriptReloadPaused:S=I,activeTurnStartedAt:L,welcomeHeader:E,centerWelcomeHeader:R=!1,workspaceCwd:N,tailContent:O,tailKey:$="tail",virtualScrollThreshold:z=aW,autoScrollTailIntoView:H=!1,bottomOverlayInset:G=0,hideSessionTimeline:J=!1,timelineAction:Q,hideFirstUserMessage:W=!1,firstTurnMetrics:A,includeSubagentToolUsageInMetrics:U=!0,showRetryHint:Y=!1,onRetryClick:P,failedPromptMessageId:ae,onRetryFailedPrompt:le,onBranchSession:Te,onCanScrollToBottomChange:q,turnFileChanges:ne,turnArtifacts:ie,sourceEntries:te,sourceSessionId:me,mcpAppSessionId:xe=me,onSourceOpen:Fe,turnScheduledTasks:ve,onReviewChanges:K,onOpenArtifact:Se,onOpenScheduledTask:Le,onTurnOutputOpen:Ye,onToolResultOpen:ut,onError:qt,generateContent:ua},ye){let qe=(0,w.useRef)(a);qe.current=a;let{t:ue}=at(),Oe=Na(),X=(0,w.useContext)(e7),fe=(0,w.useMemo)(()=>{let F=new Map,ee,we=0;for(let Ae of e)Ae.role==="user"&&(F.set(Ae.id,we),ee=Ae.id,we+=1);return{lastId:ee,turnIndexById:F}},[e]),ke=(0,w.useMemo)(()=>{if(!a)return;let F=[...fe.turnIndexById.keys()];return new Set(F.filter((ee,we)=>we===0||we===F.length-1))},[fe,a]),Ve=(0,w.useRef)(void 0),Xe=aAe(Ve.current,e);(0,w.useLayoutEffect)(()=>{Ve.current=e},[e]);let kt=(0,w.useRef)(void 0),Xt=(0,w.useRef)(void 0),nt=(0,w.useRef)(void 0),Lt=(0,w.useRef)(void 0),et=(0,w.useMemo)(()=>{let F=kt.current,ee=e[e.length-1],we;if(Xe&&F?.sourceMessages===Ve.current&&F?.compactMode===X&&F.pendingApproval===o&&(ee?.role==="assistant"&&F.value[F.value.length-1]?.id===ee.id?(we=F.value.slice(),we[we.length-1]=ee):ee?.role==="thinking"&&(we=X?lAe(F.value,ee):zq(e))),!we){let it=zq(e);we=X?iAe(it,o):it}kt.current={sourceMessages:e,compactMode:X,pendingApproval:o,value:we};let Ae=Lt.current??=new WeakMap,pe=Xt.current,bt=pe!==void 0&&pe.sessionKey===n?pe.ids:void 0;if(I){if(nt.current=void 0,!bt?.size)return we;let it,Ot=!1,ft=we.map(_a=>{let xa=gg(_a.id);if(xa!==void 0){let r1=bt.get(xa);r1!==void 0&&(it??=new Map).set(xa,r1)}let Mn=bt.get(hg(_a.id));Mn!==void 0&&(it??=new Map).set(hg(_a.id),Mn);let ws=bt.get(_a.id);return ws===void 0||qq(_a)!==ws?_a:((it??=new Map).set(_a.id,ws),Ot=!0,Uq(Ae,_a))});return(it?.size??0)!==bt.size&&(nt.current={sessionKey:n,ids:it??new Map}),Ot?ft:we}let Ut,la=we.map(it=>{let Ot=Uq(Ae,it);if(Ot!==it){let ft=qq(it);if(ft!==void 0){(Ut??=new Map).set(it.id,ft);let _a=gg(it.id),xa=it.role==="tool_group"?it.thoughts?.[0]?.content:void 0;_a!==void 0&&xa!==void 0&&Ut.set(_a,xa),it.role==="thinking"&&Ut.set(hg(it.id),JSON.stringify([it.content]))}}return Ot});return Ut?(nt.current={sessionKey:n,ids:new Map([...bt??[],...Ut])},la):we},[X,I,e,o,n,Xe]);(0,w.useLayoutEffect)(()=>{let F=nt.current;F&&(Xt.current=F,nt.current=void 0)},[et]);let Gt=(0,w.useRef)(void 0),Ue=(0,w.useMemo)(()=>{let F=Gt.current,ee=et[et.length-1],we;if(Xe&&I&&F?.sourceMessages===Ve.current&&F?.compactMode===X&&F.pendingApproval===o&&F.isResponding===I&&F.turnFileChanges===ne&&F.turnArtifacts===ie&&F.turnScheduledTasks===ve){let Ae=F.value[F.value.length-1];Ae?.type==="message"&&Ae.message.id===ee.id&&(we=F.value.slice(),we[we.length-1]={...Ae,message:ee})}return we??=uAe(Vj(et),I,ne,ie,ve),Gt.current={sourceMessages:e,compactMode:X,pendingApproval:o,isResponding:I,turnFileChanges:ne,turnArtifacts:ie,turnScheduledTasks:ve,value:we},we},[et,e,Xe,X,o,I,ne,ie,ve]),Vt=(0,w.useMemo)(()=>{for(let F=et.length-1;F>=0;F-=1){let ee=et[F];if(ee?.role==="system"&&ee.source==="background_notification")return ee.id}return null},[et]),[Rr,sr]=(0,w.useState)(Vt),jo=!!(p||m),Ft=(0,w.useRef)(jo),jr=(0,w.useRef)(et.length>0),Ba=!jr.current&&et.length>0,on=jo||Ft.current||Ba;(0,w.useLayoutEffect)(()=>{on&&sr(Vt),et.length>0&&(jr.current=!0),Ft.current=jo},[on,Vt,jo,et.length]);let Fa=!on&&Vt!==null&&Rr!==Vt,sa=(0,w.useMemo)(()=>{for(let F=Ue.length-1;F>=0;F-=1){let ee=Ue[F];if(ee.type==="message"&&oo(ee.message))return F}return 0},[Ue]),so=Oe==="interactive",sn=(0,w.useMemo)(()=>so&&Jj(Ue,sa,Ue.length-1),[Ue,so,sa]),In=(0,w.useMemo)(()=>tW(Ue,sa,Ue.length-1,!0),[Ue,sa]),gr=(0,w.useMemo)(()=>{let F=In?.unmatchedAgentCallIds;return F&&F.size>0?[...F].sort().join("|"):""},[In]),Wr=Fa&&!sn&&(In?.sawAgentCompletion??!1)&&(In?.unmatchedAgentCallIds.size??0)>0,[Er,Wo]=(0,w.useState)(!1);(0,w.useEffect)(()=>{Wo(!1)},[gr,sa,I]),(0,w.useEffect)(()=>{if(!Wr||I)return;let F=setTimeout(()=>Wo(!0),Bq);return()=>clearTimeout(F)},[Wr,gr,sa,I]);let Hl=(0,w.useMemo)(()=>Fa&&!sn&&!I&&(In?.sawAgentCompletion??!1)&&(In?.unmatchedAgentCallIds.size??0)===0&&Z9(Ue,sa,Ue.length-1,!0,!0,!0),[Fa,Ue,I,In,sn,sa]),[Mr,im]=(0,w.useState)(!1),ln=(0,w.useMemo)(()=>{let F=In;if(!F||F.lastNotificationIndex<0)return"";let ee=Ue[F.lastNotificationIndex];return ee?.type==="message"?ee.message.id:""},[Ue,In]);(0,w.useEffect)(()=>{im(!1)},[ln,sa,I]),(0,w.useEffect)(()=>{if(!Hl)return;let F=setTimeout(()=>im(!0),Bq);return()=>clearTimeout(F)},[Hl,ln,sa,I]);let Ii=(0,w.useMemo)(()=>Fa&&Z9(Ue,sa,Ue.length-1,!0,sn||!Er,!Mr),[Fa,Ue,sn,sa,Mr,Er]),zg=(0,w.useMemo)(()=>{let F=new Set;for(let ee=sa;ee<Ue.length;ee+=1){let we=Ue[ee];we.type==="parallel_agents"&&F.add(we.key)}return F},[Ue,sa]),za=(0,w.useMemo)(()=>{if(!Fa)return{key:null};let F=-1,ee;for(let we=Ue.length-1;we>=0;we-=1){let Ae=Ue[we];if(Ae.type!=="message"||Ae.message.role!=="system"||Ae.message.source!=="background_notification")continue;let pe=Q9(Ae);if(pe){F=we,ee=pe.callId;break}}for(let we=F-1;we>=0;we-=1){let Ae=Ue[we];if(Ae.type==="parallel_agents"&&(!ee||Ae.agents.some(pe=>pe.callId===ee)))return{key:Ae.key}}return{key:null}},[Fa,Ue]),En=(0,w.useRef)(null),js=iLe(En,!J),[Qd,qg]=(0,w.useState)(()=>new Set),hu=(0,w.useCallback)((F,ee)=>{qg(we=>{if(we.has(F)===ee)return we;let Ae=new Set(we);return ee?Ae.add(F):Ae.delete(F),Ae})},[]),_i=(0,w.useRef)(null),Li=(0,w.useMemo)(()=>{if(!js)return sRe;let F=IAe(et);return(_i.current?.signature!==F||_i.current?.t!==ue)&&(_i.current={signature:F,t:ue,entries:SAe(et,ue)}),_i.current.entries},[js,et,ue]),vk=(0,w.useMemo)(()=>new Map(Li.map((F,ee)=>[F.id,ee])),[Li]),Ug=(0,w.useMemo)(()=>oAe(et),[et]),[lm,Hg]=(0,w.useState)(null),yk=lm!==null?Li[lm.currentIndex]?.id??Ug:Ug,jg=(0,w.useRef)(void 0),cm=(0,w.useMemo)(()=>{let F=jg.current,ee;return Xe&&I&&F?.sourceMessages===Ve.current&&F?.isResponding===I&&F.latestTurnAwaitsAgentSummary===Ii&&F.gateBackgroundAgentStatus===so?ee=F.value:ee=fAe(Ue,{isResponding:I,latestTurnAwaitsAgentSummary:Ii,gateBackgroundAgentStatus:so}),jg.current={sourceMessages:e,isResponding:I,latestTurnAwaitsAgentSummary:Ii,gateBackgroundAgentStatus:so,value:ee},ee},[Ue,e,Xe,so,I,Ii]),{collapseCompletedTurns:wk,sourceReferences:gu,assistantFeedback:um}=qo(),{ratings:Wg,rate:Gg,ratingForTurn:dm}=lde(me),Vg=(0,w.useMemo)(()=>{let F=new Map;for(let ee of e)oo(ee)&&F.set(ee.id,ee);return F},[e]),vu=Jue({renderMode:Oe,sessionId:me,options:um}),Kg=(0,w.useRef)(um);Kg.current=um;let Xg=(0,w.useRef)(e);Xg.current=e;let Yg=(0,w.useCallback)((F,ee,we)=>{let Ae=dm(F);Gg(F,we);let pe=Kg.current?.onRate;pe&&ede(pe,{rating:we,previousRating:Ae,sessionId:me,promptId:F,userMessage:tde(Xg.current,ee)})},[dm,Gg,me]),Qg=(0,w.useRef)(void 0),Zd=(0,w.useMemo)(()=>{let F=[te,N,me,gu],ee=Qg.current;return Xe&&I&&ee&&ee.sourceMessages===Ve.current&&Fq(ee.dependencies,F)?ee.value:Zce(e,te??[],N,me,gu)},[e,te,N,me,gu,Xe,I]);(0,w.useLayoutEffect)(()=>{Qg.current={sourceMessages:e,dependencies:[te,N,me,gu],value:Zd}},[e,te,N,me,gu,Zd]);let fm=wk??!0,[yu,wu]=(0,w.useState)(()=>new Map),[jl,bu]=(0,w.useState)(()=>new Set),Ai=(0,w.useRef)(new Map),[Zg,bk]=(0,w.useTransition)(),pm=(0,w.useRef)(!1),Jd=(0,w.useRef)(new Map),Wl=(0,w.useRef)(void 0),Ri=(0,w.useRef)([]),Gl=(0,w.useRef)(!0);a&&(Gl.current=!1);let ia=(0,w.useRef)(!1),mm=(0,w.useRef)(0),ku=(0,w.useRef)(0),Ia=(0,w.useRef)(!1),Gr=(0,w.useRef)(0),Ei=(0,w.useRef)(!1),Vl=(0,w.useRef)(0),Mi=(0,w.useRef)(null),xu=(0,w.useRef)(!1),Ni=(0,w.useRef)(null),hm=(0,w.useRef)(null),ef=(0,w.useRef)(!1),Su=(0,w.useRef)(null),B=(0,w.useRef)(!1),se=(0,w.useRef)(p),de=(0,w.useRef)(!!p),je=(0,w.useRef)(void 0),dt=(0,w.useRef)(void 0),va=(0,w.useRef)(G),vr=(0,w.useRef)(null),Co=(0,w.useRef)(m),Kn=(0,w.useRef)(m),Pi=(0,w.useRef)(!1),Oi=(0,w.useRef)(!1),Ws=(0,w.useRef)(void 0),Vr=(0,w.useRef)(void 0);Kn.current=m;let Di=(0,w.useRef)(!1),Xn=(0,w.useRef)(void 0),gm=(0,w.useRef)(void 0),$i=(0,w.useRef)(void 0),vm=(0,w.useRef)(void 0),ym=(0,w.useRef)(void 0),tf=(0,w.useRef)(void 0),Jg=(0,w.useRef)(void 0),kk=(0,w.useRef)(k),xk=(0,w.useRef)(S);kk.current=k,xk.current=S||a;let Sk=(0,w.useRef)(null),[qa,Gs]=(0,w.useState)(null),eT=(0,w.useRef)(!1);eT.current=qa?.virtual===!0;let tT=(0,w.useRef)(et.length);(0,w.useLayoutEffect)(()=>{tT.current=et.length},[et.length]);let Ck=(0,w.useRef)(e);(0,w.useLayoutEffect)(()=>{Ck.current=e},[e]);let[dW,e1]=(0,w.useState)(!1),[fW,pW]=(0,w.useState)(n);fW!==n&&(pW(n),Ai.current.clear(),Gr.current+=1,Ia.current=!1,Di.current=!1,Gs(null),wu(F=>F.size?new Map:F),bu(F=>F.size?new Set:F)),(0,w.useEffect)(()=>{g||(Di.current=!1,Sk.current=null)},[g]);let wm=(0,w.useCallback)(()=>{let F=En.current,ee=F?F.scrollHeight-F.scrollTop-F.clientHeight:0,we=!Gl.current&&ee>1;hm.current!==we&&(hm.current=we,q?.(we))},[q]),yr=(0,w.useCallback)(()=>{Vr.current!==void 0&&window.cancelAnimationFrame(Vr.current),Vr.current=window.requestAnimationFrame(wm)},[wm]),Kt=(0,w.useCallback)(F=>{qe.current&&(F=!1),Gl.current!==F&&(Gl.current=F,yr())},[yr]),af=(0,w.useRef)(void 0),Tk=(0,w.useRef)(!1),cn=(0,w.useMemo)(()=>{Tk.current=!1;let F=[ke,yu,I,L,r,Fa,sn,Er,Mr,fm,W,A,U,Qd,X,o,ne,ie,ve,jl],ee=af.current,we=Ue[Ue.length-1];if(Xe&&I&&ee&&ee.sourceMessages===Ve.current&&Fq(ee.dependencies,F)&&we?.type==="message"){let ft=Ib(we),_a=-1;for(let xa=ee.value.length-1;xa>=0;xa-=1)if(Ib(ee.value[xa])===ft){_a=xa;break}if(_a>=0){let xa=ee.value[_a];if(xa?.type==="message"){let Mn=ee.value.slice();return Mn[_a]={...xa,message:we.message},af.current={sourceMessages:e,dependencies:F,value:Mn,virtualizerItems:ee.virtualizerItems},Tk.current=!0,Mn}}}let Ae=jAe(Ue,{overrides:yu,isResponding:I,activeTurnStartedAt:L,terminalBackgroundShellTaskIds:r,backgroundSummaryGraceActive:Fa,waitForUnmatchedAgentCompletions:sn||!Er,waitForOrderedNarration:!Mr,automaticallyExpandedAgentKeys:Qd,pendingApprovalCallId:o?.toolCallId??null,includeSubagentToolUsageInMetrics:U,paginatedExpanded:ke?new Set([...jl,...ke]):jl,enabled:fm}),pe=ke?Ae.map(ft=>{if(!("turnCollapse"in ft)||!ft.turnCollapse||!ke.has(ft.turnCollapse.turnId))return ft;let{turnId:_a,collapsed:xa,hiddenCount:Mn}=ft.turnCollapse;return{...ft,turnCollapse:{turnId:_a,collapsed:xa,hiddenCount:Mn}}}):Ae,bt=!1,Ut=A?pe.map(ft=>bt||ft.type!=="turn_collapse"?ft:(bt=!0,{...ft,turnCollapse:{...ft.turnCollapse,...A.durationMs!==void 0&&A.durationMs>0?{elapsedMs:A.durationMs}:{},...A.inputTokens!==void 0?{inputTokens:A.inputTokens}:{},...A.outputTokens!==void 0?{outputTokens:A.outputTokens}:{},...A.cachedTokens!==void 0?{cachedTokens:A.cachedTokens}:{}}})):pe,la=dAe(Ut,Qd);if(!W)return af.current={sourceMessages:e,dependencies:F,value:la,virtualizerItems:la},la;let it=et.find(ft=>ft.role==="user")?.id,Ot=it?la.filter(ft=>ft.type!=="message"||ft.message.id!==it):la;return af.current={sourceMessages:e,dependencies:F,value:Ot,virtualizerItems:Ot},Ot},[Ue,Xe,yu,I,L,r,Fa,sn,Er,Mr,fm,ke,W,A,U,et,e,Qd,X,o,ne,ie,ve,jl]),nf=af.current?.sourceMessages===e?af.current.virtualizerItems:cn,bm=(0,w.useCallback)(F=>nf.some(ee=>String(Ib(ee))===F),[nf]),Ik=(0,w.useRef)(void 0),mW=(0,w.useMemo)(()=>{if(Tk.current&&Ik.current?.length===cn.length)return Ik.current.value;let F=Zj(cn);return Ik.current={length:cn.length,value:F},F},[cn]),hW=Li.length>=pwe,gs=O!=null,rf=!!p,Kl=!!E,ir=Kl?1:0,Cu=ir+cn.length,km=Cu+(gs?1:0),gW=ir+Ue.length+(gs?1:0),Bi=XAe(gW,z),lr=(0,w.useCallback)(()=>En.current,[]),aT=(0,w.useCallback)(()=>{let F=En.current;if(!F)return;let ee=F.scrollHeight-F.scrollTop-F.clientHeight<Lb;ia.current=!ee,Kt(ee),yr()},[yr,Kt]),xm=(0,w.useCallback)(()=>{mm.current=Date.now()+1e3},[]),t1=(0,w.useCallback)(()=>{ym.current!==void 0&&(window.clearTimeout(ym.current),ym.current=void 0)},[]),vs=(0,w.useCallback)(()=>{t1(),tf.current?.abort(),tf.current=void 0},[t1]),of=(0,w.useCallback)(()=>{t1();let F=Jg.current;if(F){if(C?.getSnapshot().lastEventId===F.lastEventId)return;Jg.current=void 0}!T||tf.current!==void 0||ia.current||xk.current||kk.current<=Dz||(ym.current=window.setTimeout(()=>{if(ym.current=void 0,xk.current||ia.current||kk.current<=Dz)return;let ee=En.current;if(!ee||ee.scrollHeight-ee.scrollTop-ee.clientHeight>=Lb)return;let we=new AbortController;tf.current=we,T(we.signal).then(()=>{if(we.signal.aborted)return;let Ae=C?.getSnapshot();Jg.current={...Ae?.lastEventId!==void 0?{lastEventId:Ae.lastEventId}:{}}}).catch(Ae=>{Ae instanceof Error&&Ae.name==="AbortError"||console.warn("[MessageList] transcript reload failed:",Ae)}).finally(()=>{tf.current===we&&(tf.current=void 0)})},eAe))},[t1,T,C]);(0,w.useEffect)(()=>{Jg.current=void 0},[C]),(0,w.useEffect)(()=>{if(!C)return vs;let F=C.getSnapshot().lastEventId,ee=C.subscribe(()=>{let we=C.getSnapshot().lastEventId;we!==F&&(F=we,of())});return()=>{ee(),vs()}},[C,of,vs]),(0,w.useEffect)(()=>{if(S){vs();return}of()},[vs,S,of,k]);let sf=(0,w.useCallback)(()=>{Oi.current=!0,Ws.current!==void 0&&window.cancelAnimationFrame(Ws.current),Ws.current=window.requestAnimationFrame(()=>{Oi.current=!1,Ws.current=void 0,aT()})},[aT]);(0,w.useEffect)(()=>()=>{Ws.current!==void 0&&window.cancelAnimationFrame(Ws.current),Vr.current!==void 0&&window.cancelAnimationFrame(Vr.current),Xn.current!==void 0&&window.cancelAnimationFrame(Xn.current),gm.current!==void 0&&window.cancelAnimationFrame(gm.current),$i.current!==void 0&&window.cancelAnimationFrame($i.current),vs(),je.current!==void 0&&window.cancelAnimationFrame(je.current),dt.current!==void 0&&window.cancelAnimationFrame(dt.current)},[vs]);let nT=(0,w.useCallback)((F,ee)=>{let we=En.current;(!we||we.scrollHeight>we.clientHeight+1)&&(ia.current=!0,Kt(!1)),sf(),Wl.current!==void 0&&window.clearTimeout(Wl.current),Jd.current.clear(),En.current?.querySelectorAll("[data-message-row-key]").forEach(Ae=>{let pe=Ae.dataset.messageRowKey;pe&&Jd.current.set(pe,Ae.getBoundingClientRect().top)}),pm.current=!0,bk(()=>{bu(Ae=>{if(!Ae.has(F))return Ae;let pe=new Set(Ae);return pe.delete(F),pe}),wu(Ae=>{let pe=new Map(Ae);return pe.set(F,ee),pe})})},[sf,Kt]);(0,w.useLayoutEffect)(()=>{if(Zg||!pm.current)return;pm.current=!1;for(let ee of Ri.current)ee.cancel();Ri.current=[];let F=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;F||En.current?.querySelectorAll("[data-message-row-key]").forEach(ee=>{if(typeof ee.animate!="function")return;let we=ee.dataset.messageRowKey,Ae=we?Jd.current.get(we):void 0;if(Ae===void 0){Ri.current.push(ee.animate([{opacity:0},{opacity:1}],{duration:a9,easing:"ease-out"}));return}let pe=Ae-ee.getBoundingClientRect().top;Math.abs(pe)<1||Ri.current.push(ee.animate([{translate:`0 ${pe}px`},{translate:"0 0"}],{duration:a9,easing:"ease-out"}))}),Jd.current.clear(),Wl.current=window.setTimeout(()=>{Wl.current=void 0,sf()},F?0:a9)},[sf,Zg]),(0,w.useEffect)(()=>()=>{Wl.current!==void 0&&window.clearTimeout(Wl.current);for(let F of Ri.current)F.cancel();Ri.current=[]},[]);let vW=(0,w.useCallback)(F=>{let ee=F.target;ee instanceof HTMLElement&&ee.closest("[aria-expanded], summary")&&(ia.current=!0,Kt(!1),sf())},[sf,Kt]),Tu=(0,w.useCallback)(F=>{if(Kl&&F===s9)return"slot:header";if(gs&&F===Cu)return`slot:tail:${$}`;let ee=nf[F-ir];return ee?Ib(ee):`slot:row:${F}`},[Kl,gs,Cu,$,nf,ir]),yW=(0,w.useCallback)(F=>Kl&&F===s9?WAe:gs&&F===Cu?KAe:nf[F-ir]?.type==="turn_collapse"?VAe:GAe,[Kl,gs,ir,Cu,nf]),cr=(0,w.useCallback)((F="auto")=>{if(qe.current)return;let ee=lr();if(!ee||ee.scrollHeight<=ee.clientHeight)return;xu.current=!1,Vl.current+=1;let we=Vl.current;Ei.current=!0,F==="smooth"?ee.scrollTo({top:ee.scrollHeight,behavior:F}):ee.scrollTop=ee.scrollHeight,yr(),ku.current=Math.max(0,ee.scrollHeight-ee.clientHeight),wm();let Ae=()=>{if(Vl.current!==we||(Ei.current=!1,!xu.current)||(xu.current=!1,Kn.current||ia.current))return;let pe=lr();!pe||pe.scrollHeight<=pe.clientHeight||(Kt(!0),pe.scrollTop=pe.scrollHeight,yr(),ku.current=Math.max(0,pe.scrollHeight-pe.clientHeight),wm())};F==="smooth"?setTimeout(Ae,350):requestAnimationFrame(Ae)},[lr,wm,yr,Kt]),rT=(0,w.useCallback)((F="smooth")=>{ia.current=!1,Kt(!0),cr(F)},[cr,Kt]),ys=gue({count:km,enabled:Bi,getScrollElement:lr,getItemKey:Tu,estimateSize:yW,overscan:20,anchorTo:"end",useFlushSync:!1,useAnimationFrameWithResizeObserver:!0,directDomUpdates:!0});ys.shouldAdjustScrollPositionOnItemSizeChange=(F,ee,we)=>YAe(F.end,En.current?.scrollTop??we.scrollOffset??0);let wW=(0,w.useCallback)(F=>{if(ys.measureElement(F),!F||!eT.current)return;let ee=Number(F.dataset.index);Number.isFinite(ee)&&!ys.itemSizeCache.has(Tu(ee))&&ys.resizeItem(ee,F.offsetHeight)},[Tu,ys]);(0,w.useLayoutEffect)(()=>{if(!qa)return;let F=En.current;if(qa.rowKey&&!bm(qa.rowKey)){let ee=vAe(Ck.current,qa.rowKey);if(ee!==void 0&&yAe(cn,ee)&&yu.get(ee)!==!1&&!jl.has(ee)){bu(we=>we.has(ee)?we:new Set(we).add(ee)),Gs(we=>we&&{...we,rowKey:`msg:${ee}`});return}qa.generation===Gr.current&&(Gr.current+=1),Ia.current=!1,vm.current=void 0,e1(!1),Gs(null);return}if(qa.settled){if(!F){Ia.current=!1,Gs(null);return}if(qa.virtual?et.length===qa.messageCount:F.scrollHeight===qa.scrollHeight){if(Ia.current=!1,Xn.current!==void 0)return;let ee=Kq,we=()=>{if(Xn.current=void 0,qa.generation===Gr.current&&tT.current===qa.messageCount){if(ee-=1,ee>0){Xn.current=requestAnimationFrame(we);return}Gs(Ae=>Ae===qa?null:Ae)}};Xn.current=requestAnimationFrame(we);return}Xn.current!==void 0&&(cancelAnimationFrame(Xn.current),Xn.current=void 0),Xn.current=requestAnimationFrame(()=>{if(Xn.current=void 0,qa.generation!==Gr.current)return;if(qa.rowKey&&!bm(qa.rowKey)){Ia.current=!1,Gs(null);return}let ee=qa.rowKey?Array.from(F.querySelectorAll("[data-message-row-key]")).find(we=>we.dataset.messageRowKey===qa.rowKey):void 0;ee&&qa.rowTop!==void 0?F.scrollTop+=ee.getBoundingClientRect().top-qa.rowTop:F.scrollTop=qa.scrollTop+Math.max(0,F.scrollHeight-qa.scrollHeight),Ia.current=!1,Gs(null)})}},[bm,et.length,qa,cn,yu,jl]);let oT=ys.getVirtualItems(),lf=ys.getTotalSize(),sT=(0,w.useRef)({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});sT.current={entryIndexById:vk,headerOffset:ir,isVisible:js,turnIdByDisplayIndex:mW,visibleItems:cn};let iT=(0,w.useCallback)(()=>{let F=lr(),ee=sT.current;if(!F||!ee.isVisible||ee.entryIndexById.size===0){Hg(ft=>ft===null?ft:null);return}let we=F.getBoundingClientRect(),Ae=we.top,pe=we.bottom,bt=Ae+(pe-Ae)/2,Ut=[],la=null,it=Number.POSITIVE_INFINITY;F.querySelectorAll("[data-index]").forEach(ft=>{let _a=ft.dataset.index;if(_a===void 0)return;let xa=Number(_a);if(!Number.isFinite(xa))return;let Mn=xa-ee.headerOffset;if(Mn<0||Mn>=ee.visibleItems.length)return;let ws=ft.getBoundingClientRect();if(ws.bottom<Ae||ws.top>pe)return;Ut.push(Mn);let r1=ws.top+(ws.bottom-ws.top)/2,mT=Math.abs(r1-bt);mT<it&&(it=mT,la=Mn)});let Ot=DAe(ee.visibleItems,Ut,ee.entryIndexById,la,ee.turnIdByDisplayIndex);Hg(ft=>ft?.startIndex===Ot?.startIndex&&ft?.endIndex===Ot?.endIndex&&ft?.currentIndex===Ot?.currentIndex?ft:Ot)},[lr]),Xl=(0,w.useCallback)(()=>{Ni.current!==null&&cancelAnimationFrame(Ni.current),Ni.current=requestAnimationFrame(()=>{Ni.current=null,iT()})},[iT]);(0,w.useEffect)(()=>()=>{Mi.current!==null&&(clearTimeout(Mi.current),Mi.current=null),Ni.current!==null&&(cancelAnimationFrame(Ni.current),Ni.current=null)},[]),(0,w.useEffect)(()=>{Xl()},[Xl,km,lf,Bi,oT.length,js]);let[Sm,_k]=(0,w.useState)(null);(0,w.useEffect)(()=>{if(!Sm)return;let F=setTimeout(()=>_k(null),1600);return()=>clearTimeout(F)},[Sm]);let Lk=(0,w.useCallback)((F,ee)=>{ia.current=!0,Kt(!1),Vl.current+=1;let we=Vl.current;if(Ei.current=!0,Bi)if(qe.current){let Ae=ys.getOffsetForIndex(F,"center");Ae&&En.current&&(En.current.scrollTop=Ae[0])}else ys.scrollToIndex(F,{align:"center"});else En.current?.querySelector(`[data-index="${F}"]`)?.scrollIntoView({block:"center"});Mi.current!==null&&clearTimeout(Mi.current),Mi.current=setTimeout(()=>{Mi.current=null,Vl.current===we&&(Ei.current=!1,Xl(),yr())},150),_k(null),requestAnimationFrame(()=>_k(ee))},[Bi,ys,Kt,Xl,yr]),lT=(0,w.useRef)({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});lT.current={visibleItems:cn,displayItems:Ue,headerOffset:ir,performScrollToRow:Lk};let Iu=(0,w.useRef)(null),Cm=(0,w.useCallback)((F,ee)=>{let{visibleItems:we,displayItems:Ae,headerOffset:pe,performScrollToRow:bt}=lT.current,Ut=_b(we,F,ee);if(Ut>=0)return Iu.current=null,bt(Ut+pe,{messageId:F,callId:ee}),!0;let la=_b(Ae,F,ee);if(la<0)return!1;let it=Qj(Ae,la);return it?(Iu.current={messageId:F,callId:ee},wu(Ot=>{if(Ot.get(it)===!0)return Ot;let ft=new Map(Ot);return ft.set(it,!0),ft}),!0):!1},[]);(0,w.useImperativeHandle)(ye,()=>({scrollToMessage:Cm,scrollToBottom:rT}),[Cm,rT]),(0,w.useEffect)(()=>{let F=Iu.current;if(!F)return;let ee=_b(cn,F.messageId,F.callId);ee<0||(Iu.current=null,Lk(ee+ir,F))},[cn,ir,Lk]);let Vs=(0,w.useCallback)(async(F=!1,ee=!1)=>{let we=En.current;if(!we||!y||h||Ia.current||v&&!ee||Di.current&&!F)return;Di.current=!1,Ia.current=!0;let Ae=++Gr.current;Xn.current!==void 0&&(cancelAnimationFrame(Xn.current),Xn.current=void 0),e1(!ee);let pe;if(Bi){let Ot=String(Tu(ir)),ft=Kq;if(pe=await new Promise(_a=>{let xa=()=>{if(gm.current=void 0,Ae!==Gr.current||En.current!==we||!bm(Ot)||ft--<=0){_a(void 0);return}let Mn=Array.from(we.querySelectorAll("[data-message-row-key]")).find(ws=>ws.dataset.messageRowKey===Ot);Mn?_a({rowKey:Ot,rowTop:Mn.getBoundingClientRect().top}):gm.current=requestAnimationFrame(xa)};gm.current=requestAnimationFrame(xa)}),!pe){Ae===Gr.current&&(Ia.current=!1,vm.current=void 0,e1(!1));return}}let bt=we.scrollHeight,Ut=we.scrollTop,la=we.getBoundingClientRect().top,it=pe?void 0:Array.from(we.querySelectorAll("[data-message-row-key]")).find(Ot=>{let ft=Ot.dataset.messageRowKey;return ft!==void 0&&ft.startsWith("msg:")&&Ot.getBoundingClientRect().bottom>la});ia.current=!0,Gs({scrollHeight:bt,scrollTop:Ut,messageCount:et.length,virtual:Bi,settled:!1,generation:Ae,...pe??(it?{rowKey:it.dataset.messageRowKey,rowTop:it.getBoundingClientRect().top}:{})});try{Ai.current.set(Ae,{ids:new Set(Ck.current.map(ft=>ft.id)),resolved:!1}),await y(ee?{force:!0}:void 0);let Ot=Ai.current.get(Ae);Ot&&(Ot.resolved=!0),Ae===Gr.current&&Gs(ft=>ft?.generation===Ae?{...ft,settled:!0}:ft)}catch{Ai.current.delete(Ae),Ae===Gr.current&&(Di.current=!0,Ia.current=!1,Gs(null))}finally{Ae===Gr.current&&e1(!1)}},[h,y,v,Tu,bm,ir,et.length,Bi]),bW=(0,w.useCallback)(()=>{Vs(!0,!0)},[Vs]);(0,w.useLayoutEffect)(()=>{let F=Ai.current;if(F.size===0)return;let ee=e.find(Ut=>!Ut?.id.startsWith("local-"));if(!ee)return;let we=F.entries().next().value;if(!we)return;let[Ae,pe]=we;if(pe.ids.has(ee.id))return;let bt=[];for(let Ut=0;Ut<e.length;Ut++){let la=e[Ut];if(!la||!oo(la)||pe.ids.has(la.id))continue;let it=!1;for(let Ot=Ut+1;Ot<e.length;Ot++){let ft=e[Ot];if(oo(ft))break;if(pe.ids.has(ft.id)){it=!0;break}}it&&bt.push(la.id)}if(bt.length===0){if(!pe.resolved)return}else bu(Ut=>{let la=null;for(let it of bt)Ut.has(it)||(la??=new Set(Ut),la.add(it));return la??Ut});F.delete(Ae);for(let Ut of F.values())for(let la of e)la&&Ut.ids.add(la.id)},[e]),(0,w.useEffect)(()=>{let F=vm.current;if(F===void 0||h||qa||Ia.current||(vm.current=void 0,!g||F!==Gr.current))return;let ee=lr();ee&&ee.scrollTop<=i9&&Vs(!0)},[lr,g,Vs,h,qa]);let Ak=(0,w.useCallback)(()=>{let F=lr();if(!F)return;let ee=F.scrollTop;g&&ee<=i9&&Vs(!0);let we=Date.now()<=mm.current;if(Ei.current&&!we){ku.current=ee;return}Xl();let Ae=ku.current;ku.current=ee;let pe=F.scrollHeight-ee-F.clientHeight;if(yr(),ee<Ae-1){let bt=pe<Lb;we?(vs(),ia.current=!0,Kt(!1)):bt?(ia.current=!1,Kt(!0)):ia.current||(vs(),Kt(!1));return}pe<Lb?(ia.current=!1,Kt(!0),of()):vs()},[lr,g,Vs,yr,Xl,of,vs,Kt]);(0,w.useEffect)(()=>{let F=lr();if(F)return F.addEventListener("scroll",Ak,{passive:!0}),()=>F.removeEventListener("scroll",Ak)},[lr,Ak]);let a1=(0,w.useCallback)(()=>{if(!g||h||m||rf)return;let F=lr();if(!F||F.scrollHeight>F.clientHeight+1)return;let ee=Sk.current;if(ee!==null&&ee.loader===y&&ee.totalVirtualSize===lf){Di.current=!0;return}Sk.current={loader:y,totalVirtualSize:lf},Vs()},[m,lr,g,Vs,h,y,rf,lf]);(0,w.useEffect)(()=>{a1()},[a1,lf]),(0,w.useEffect)(()=>{let F=lr();if(!F)return;let ee=()=>{if($i.current=void 0,!(F.scrollTop>i9)){if(h||Ia.current){vm.current=Gr.current;return}Vs(!0)}},we=()=>{$i.current!==void 0&&cancelAnimationFrame($i.current),$i.current=requestAnimationFrame(ee)},Ae=it=>{xm(),it.deltaY<0&&we()},pe=()=>{xm()},bt=()=>we(),Ut=it=>{let Ot=F.getBoundingClientRect(),ft=20;(it.clientX>=Ot.right-ft||it.clientY>=Ot.bottom-ft)&&xm()},la=it=>{(it.key==="ArrowUp"||it.key==="ArrowDown"||it.key==="PageUp"||it.key==="PageDown"||it.key==="Home"||it.key==="End"||it.key===" ")&&(xm(),(it.key==="ArrowUp"||it.key==="PageUp"||it.key==="Home")&&we())};return F.addEventListener("wheel",Ae,{passive:!0}),F.addEventListener("touchstart",pe,{passive:!0}),F.addEventListener("touchmove",bt,{passive:!0}),F.addEventListener("pointerdown",Ut,{passive:!0}),F.addEventListener("keydown",la,{passive:!0}),()=>{F.removeEventListener("wheel",Ae),F.removeEventListener("touchstart",pe),F.removeEventListener("touchmove",bt),F.removeEventListener("pointerdown",Ut),F.removeEventListener("keydown",la),$i.current!==void 0&&(cancelAnimationFrame($i.current),$i.current=void 0)}},[lr,Vs,h,xm]),(0,w.useEffect)(()=>{let F=lr();if(!F||typeof ResizeObserver>"u")return;let ee=new ResizeObserver(()=>{yr(),a1(),!(Kn.current||ia.current)&&(Kt(!0),cr())});ee.observe(F);for(let Ae of Array.from(F.children))ee.observe(Ae);let we=new MutationObserver(Ae=>{for(let pe of Ae){for(let bt of Array.from(pe.addedNodes))bt instanceof HTMLElement&&ee.observe(bt);for(let bt of Array.from(pe.removedNodes))bt instanceof HTMLElement&&ee.unobserve(bt)}yr()});return we.observe(F,{childList:!0}),yr(),()=>{ee.disconnect(),we.disconnect()}},[lr,a1,yr,cr,Kt]),(0,w.useEffect)(()=>{e.length===0&&(ia.current=!1,xu.current=!1,Kt(!0),Iu.current=null,Ai.current.clear(),Xt.current=void 0,nt.current=void 0,wu(F=>F.size?new Map:F),bu(F=>F.size?new Set:F))},[e.length,Kt]),(0,w.useEffect)(()=>{let F=En.current;if(!F)return;let ee=new ResizeObserver(()=>{Xl(),!Kn.current&&(ia.current||(Kt(!0),requestAnimationFrame(()=>{!Kn.current&&!ia.current&&cr()})))});return ee.observe(F),()=>ee.disconnect()},[cr,Xl,Kt]),(0,w.useLayoutEffect)(()=>{let F=nAe(e);if(m||p||se.current){Su.current=F,ef.current=!0,B.current=!1,se.current=p;return}if(se.current=p,!ef.current){Su.current=F,ef.current=!0,B.current=!1;return}let ee=rAe(e);F&&ee?.role==="user"&&F!==Su.current?(ia.current=!1,Kt(!0),Iu.current=null,B.current=!0):B.current=!1,Su.current=F},[e,m,p,Kt]),(0,w.useLayoutEffect)(()=>{Co.current&&!m&&(ia.current=!1,Kt(!0),cr("auto")),Co.current=m},[m,cr,Kt]),(0,w.useLayoutEffect)(()=>{if(p){de.current=!0;return}if(!de.current||m||e.length===0)return;de.current=!1,ia.current=!1,Kt(!0),Iu.current=null,je.current!==void 0&&window.cancelAnimationFrame(je.current),dt.current!==void 0&&window.cancelAnimationFrame(dt.current);let F=()=>{Kn.current||ia.current||(Kt(!0),cr("auto"))};je.current=window.requestAnimationFrame(()=>{je.current=void 0,F(),dt.current=window.requestAnimationFrame(()=>{dt.current=void 0,F()})})},[m,p,e.length,cr,Kt]),(0,w.useLayoutEffect)(()=>{let F=va.current!==G;va.current=G,F&&(m||ia.current||(Kt(!0),requestAnimationFrame(()=>{!Kn.current&&!ia.current&&cr("auto")})))},[G,m,cr,Kt]);let n1=(0,w.useMemo)(()=>AAe(cn),[cn]);(0,w.useLayoutEffect)(()=>{if(!m){if(!n1){vr.current=null;return}n1!==vr.current&&(vr.current=n1,(Gl.current||!ia.current)&&requestAnimationFrame(()=>{ia.current||(Kt(!0),cr())}))}},[m,n1,cr,Kt]),(0,w.useEffect)(()=>{H&&gs&&!Pi.current&&(ia.current=!1,Kt(!0),requestAnimationFrame(()=>{ia.current||cr()})),Pi.current=gs},[H,gs,cr,Kt]);let cT=(0,w.useCallback)(F=>{let ee=pe=>{if(pe.type==="parallel_agents")return(0,u.jsx)(m9,{timestamp:pe.timestamp,children:(0,u.jsx)("div",{className:Gq(pe,Sm)?Ul.flash:void 0,children:(0,u.jsx)(CH,{agents:pe.agents,autoManageExpansion:Oe==="interactive"&&!m,automaticCollapseDelayMs:za.key===pe.key&&!Ii?tAe:void 0,deferAutomaticCollapse:za.key===pe.key&&Ii,expandActiveWhenLive:I&&zg.has(pe.key),onAutomaticExpansionChange:Mn=>hu(pe.key,Mn),pendingApproval:o})})});if(pe.type==="turn_outputs")return(0,u.jsx)(Z_e,{changes:pe.changes,turnId:pe.turnId,artifacts:pe.artifacts,sourceSessionId:me,scheduledTasks:pe.scheduledTasks,workspaceCwd:N,onOpenRequest:Ye,onReviewChanges:K??t9,onOpenArtifact:Se??t9,onOpenScheduledTask:Le??t9,onError:qt});if(pe.type==="turn_collapse")return(0,u.jsx)(tRe,{turnCollapse:pe.turnCollapse,onToggleCollapse:nT});let bt=pe.message.role==="assistant"?cm.get(pe.message.id):void 0,Ut;pe.message.role==="assistant"&&bt&&!a&&(Ut={turnId:bt,message:{id:pe.message.id,content:pe.message.content,isStreaming:pe.message.isStreaming,timestamp:pe.message.timestamp}});let la=bt?Vg.get(bt):void 0,it=pe.message.promptId??la?.promptId,Ot=pe.message.role==="assistant"&&pe.message.agentMessage?.kind==="agent_message",ft=pe.message.role==="assistant"&&!Ot?pe.message.branchRecordId:void 0,_a=pe.message.role==="user"?pe.message.content:void 0,xa=_a!==void 0&&pe.message.id===fe.lastId&&!I&&!g&&!b?{turnIndex:fe.turnIndexById.get(pe.message.id)??0,content:_a}:void 0;return(0,u.jsx)(p_e,{message:pe.message,onLocateBackgroundSource:pe.message.role==="system"&&pe.message.source==="background_notification_turn_started"&&pe.message.backgroundTurn?.toolUseId&&_b(Ue,"",pe.message.backgroundTurn.toolUseId)>=0?Cm: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,onImagePreview:i,onAttachmentPreview:l,onTurnOutputOpen:Ye,onToolResultOpen:ut,onInsightReportOpen:c,onEditUserMessage:d&&xa?()=>d(xa.turnIndex,xa.content):void 0,onSubmitUserMessageEdit:f&&xa?Mn=>f(xa.turnIndex,Mn):void 0,workspaceCwd:N,showRetryHint:Y,onRetryClick:P,sendFailed:pe.message.role==="user"&&pe.message.id===ae,onRetrySend:le,onBranchSession:Te,branchRecordId:ft,showAssistantActions:pe.message.role==="assistant"&&(Ot||cm.has(pe.message.id)),showAssistantBranch:pe.message.role==="assistant"&&!Ot&&!I&&ft!==void 0,assistantFeedbackTurnId:vu&&!Ot?bt:void 0,assistantFeedbackPromptId:vu&&!Ot?it:void 0,assistantFeedbackRating:vu&&!Ot&&it?Wg[it]:void 0,onAssistantFeedbackRate:Yg,isLocateFlashing:Gq(pe,Sm),assistantTurnFooterInfo:Ut,turnSources:bt?Zd.get(bt):void 0,onSourceOpen:Fe,generateContent:ua})};if(Kl&&F===s9)return E;if(gs&&F===Cu)return O;let we=F-ir,Ae=cn[we];return Ae?ee(Ae):null},[Kl,E,gs,O,Cu,o,m,I,Ii,zg,za,Oe,hu,s,Ue,Cm,i,l,c,d,t,f,fe,g,b,ua,ir,cn,Sm,cm,vu,Vg,Wg,Yg,a,N,Y,P,ae,le,Te,nT,me,Se,Le,K,Ye,ut,Zd,Fe,qt]),uT=(0,w.useCallback)(F=>F?aRe(F):void 0,[]),dT=Bi?lf:e;(0,w.useLayoutEffect)(()=>{if(m)return;let F=B.current;if(Ei.current&&!F){ia.current||(xu.current=!0);return}Oi.current&&!F||(Gl.current||F||!ia.current)&&(ia.current||Kt(!0),cr(F?"smooth":"auto"),B.current=!1)},[dT,km,m,cr,Kt]),(0,w.useLayoutEffect)(()=>{yr()},[dT,yr,km]);let fT=(0,w.useMemo)(()=>{let F=new Map;if(!t?.active)return F;let ee=pe=>{let bt=pe.type==="message"?pe.message.id:pe.type==="turn_collapse"?pe.turnCollapse.turnId:pe.turnId;return t.groupByMessage.get(bt)??t.groupByMessage.get(gg(bt)??bt)},we=new Set;for(let pe of cn)if(pe.type==="turn_collapse"&&nW(pe.turnCollapse)){let bt=ee(pe),Ut=bt??pe.turnCollapse.turnId;we.has(Ut)||(F.set(pe,bt),we.add(Ut))}let Ae="unowned";for(let pe of cn){if(pe.type==="turn_collapse"||pe.type==="turn_outputs")continue;let bt=ee(pe);if(pe.type==="message"&&oo(pe.message))Ae=pe.message.id,F.set(pe,bt);else{let Ut=bt??Ae;we.has(Ut)||(F.set(pe,bt),we.add(Ut))}}return F},[t,cn]),pT=F=>{if(!t?.active||!F||!fT.has(F))return null;let ee=fT.get(F);return(0,u.jsx)(Dd,{className:Et.deletionCheckbox,"aria-label":ue("messageDelete.selectGroup"),title:ee?void 0:ue("messageDelete.unavailable"),checked:ee?t.selected.has(ee):!1,disabled:!ee||t.disabled||!t.allowed.has(ee),onCheckedChange:()=>{ee&&t.toggle(ee)}})};return(0,u.jsx)(oH.Provider,{value:xe,children:(0,u.jsxs)("div",{ref:En,className:J9(Et.list,t?.active?Et.deletionMode:void 0,Kl&&R?Et.listWithWelcomeHeader:void 0),"data-web-shell-message-list":!0,onClickCapture:vW,children:[rf&&(0,u.jsx)(iRe,{label:ue("editor.sessionLoading")}),h&&!rf&&!dW&&(0,u.jsx)("div",{className:Et.historyStatus,role:"status",children:ue("history.loadingEarlier")}),b&&!rf&&(0,u.jsx)("div",{className:Et.historyStatus,role:"status",children:ue("history.capacityReached")}),v&&!rf&&!b&&(0,u.jsxs)("div",{className:Et.historyStatus,children:[(0,u.jsx)("span",{role:"status",children:ue("history.paginationError")}),y&&(0,u.jsx)("button",{type:"button",className:Et.historyRetryButton,onClick:bW,children:ue("history.retry")})]}),(0,u.jsx)(oRe,{action:Q,entries:Li,currentTurnId:yk,currentRange:lm,hidden:!js||!hW,onSelect:Cm}),Bi?(0,u.jsx)("div",{ref:ys.containerRef,className:Et.virtualSizer,children:oT.map(F=>(0,u.jsxs)("div",{"data-index":F.index,ref:wW,className:J9(Et.virtualRow,uT(cn[F.index-ir])),"data-message-row-key":String(Tu(F.index)),"data-source-block-ids":Vq(cn[F.index-ir],e),"data-web-shell-message-row":!0,style:{position:"absolute",top:0,left:0,right:0},children:[pT(cn[F.index-ir]),cT(F.index)]},F.key))}):Array.from({length:km},(F,ee)=>{let we=Tu(ee),Ae=cn[ee-ir];return(0,u.jsxs)("div",{"data-index":ee,className:uT(Ae),"data-message-row-key":String(we),"data-source-block-ids":Vq(Ae,e),"data-web-shell-message-row":!0,children:[pT(Ae),cT(ee)]},we)})]})})})),Qq={en:{title:"Something went wrong",body:"An unexpected error occurred and this content could not be displayed.",retry:"Try again",reload:"Reload page"},"zh-CN":{title:"\u51FA\u4E86\u70B9\u95EE\u9898",body:"\u53D1\u751F\u610F\u5916\u9519\u8BEF\uFF0C\u65E0\u6CD5\u663E\u793A\u6B64\u5185\u5BB9\u3002",retry:"\u91CD\u8BD5",reload:"\u91CD\u65B0\u52A0\u8F7D"}},cRe={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},uRe={margin:0,fontSize:"1rem",fontWeight:600},dRe={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},fRe={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 pRe({error:e,onRetry:t,language:a="en",retryMode:n="reset"}){let r=Qq[a]??Qq.en;return(0,u.jsxs)("div",{role:"alert",style:cRe,"data-web-shell-error":!0,children:[(0,u.jsx)("p",{style:uRe,children:r.title}),(0,u.jsx)("p",{style:dRe,children:r.body}),!1,(0,u.jsx)("button",{type:"button",style:fRe,onClick:t,children:n==="reload"?r.reload:r.retry})]})}function mRe(e,t,a=!1){return Wye(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=>hRe(n,t)}})}function hRe(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 gRe="_app_34yd6_1",vRe="_appChat_34yd6_66",yRe="_content_34yd6_120",wRe="_themeDark_34yd6_435",bRe="_themeLight_34yd6_509",kRe="_contentHasMessages_34yd6_591",Vp={app:gRe,appChat:vRe,content:yRe,themeDark:wRe,themeLight:bRe,contentHasMessages:kRe},xRe=1e3,SRe=40;function rW(e){if(e!==void 0)return HF(e);if(typeof window>"u")return"en";let t=new URLSearchParams(window.location.search);return HF(t.get("language")??t.get("lang")??navigator.language)}function CRe(e){let t=`${typeof e=="number"&&Number.isFinite(e)&&e>0?e:xRe}px`,a=`calc(${t} + ${SRe}px)`;return{"--chat-regular-content-width":t,"--chat-regular-shell-width":a,"--chat-content-width":t,"--chat-shell-width":a}}function TRe({blocks:e,renderMode:t="readonly",theme:a=ng.Dark,language:n,className:r,style:o,chatMaxWidth:s,workspaceCwd:i="",compactThinking:l=!1,documentExpanded:c=!0,collapseCompletedTurns:d,markdownTableMode:f="basic",virtualScrollThreshold:p,markdown:m,sourceSessionId:g,sources:h,sourceAttachments:b,sourceReferences:v,getAssistantSourcesIcon:y,onSourceOpen:k,composerTagIcons:C,artifact:T,renderToolHeaderExtra:I,parseUserMessageContent:S,renderUserMessageContent:L,renderComposerTag:E,renderComposerTagTooltip:R,renderAssistantTurnFooter:N,mcpAppBaseUrl:O}){let $=t==="document",z=!$&&(d??!0),H=$?"basic":f,G=rW(n),J=(0,w.useMemo)(()=>oU(G),[G]),Q=(0,w.useMemo)(()=>mRe(e,J,$),[e,$,J]),W=(0,w.useMemo)(()=>Yce(h??[],b??[]),[h,b]),A=(0,w.useMemo)(()=>_ye(Q),[Q]),U=(0,w.useMemo)(()=>kye(Q),[Q]),Y=(0,w.useMemo)(()=>({artifact:T,composerTagIcons:C,renderToolHeaderExtra:I,parseUserMessageContent:S,renderUserMessageContent:L,renderComposerTag:E,renderComposerTagTooltip:R,renderAssistantTurnFooter:N,compactThinking:l,collapseCompletedTurns:z,markdownTableMode:H,markdown:m,sourceReferences:v,getAssistantSourcesIcon:y}),[T,z,l,C,m,v,y,H,S,N,E,R,I,L]),P=(0,w.useRef)(null),[ae,le]=(0,w.useState)(null),Te=(0,w.useRef)(new Set),q=[Vp.app,Vp.appChat,a===ng.Light?Vp.themeLight:Vp.themeDark,a===ng.Dark?"dark":void 0,r].filter(Boolean).join(" "),ne=(0,w.useMemo)(()=>({...o,...CRe(s)}),[s,o]);return(0,w.useLayoutEffect)(()=>{if(typeof document>"u")return;let ie=document.createElement("div");return ie.dataset.webShellPortalRoot="",ie.dataset.webShellShadcn="",document.body.appendChild(ie),le(ie),()=>{ie.remove(),le(null)}},[]),(0,w.useLayoutEffect)(()=>{let ie=P.current;if(!ie||!ae)return;let te=null,me=()=>{te=null;let K=getComputedStyle(ie),Se=new Set;ae.dataset.webShellShadcn="",ae.classList.toggle("dark",a===ng.Dark),ae.lang=G;for(let Le=0;Le<K.length;Le+=1){let Ye=K[Le];Ye.startsWith("--")&&(Se.add(Ye),ae.style.setProperty(Ye,K.getPropertyValue(Ye)))}for(let Le of Te.current)Se.has(Le)||ae.style.removeProperty(Le);Te.current=Se},xe=()=>{te===null&&(te=requestAnimationFrame(me))};me();let Fe=new MutationObserver(xe),ve=ie;for(;ve;)Fe.observe(ve,{attributes:!0,attributeFilter:["class","style","data-theme","lang"]}),ve=ve.parentElement;return window.addEventListener("resize",xe),()=>{Fe.disconnect(),window.removeEventListener("resize",xe),te!==null&&cancelAnimationFrame(te)}},[ae,G,q,ne,a]),(0,u.jsx)(mfe,{value:a,children:(0,u.jsx)(Yue,{language:G,children:(0,u.jsx)(rH.Provider,{value:O,children:(0,u.jsx)(sU.Provider,{value:ae,children:(0,u.jsx)(Que,{value:t,children:(0,u.jsx)(Zue,{value:c,children:(0,u.jsx)(eue,{value:Y,children:(0,u.jsx)(Jce,{timeline:U,details:A,children:(0,u.jsx)(e7.Provider,{value:!1,children:(0,u.jsx)("div",{ref:P,className:q,style:ne,"data-web-shell-root":!0,"data-web-shell-shadcn":!0,"data-transcript-render-mode":t,"data-document-expanded":$?String(c):void 0,lang:G,children:(0,u.jsx)("div",{className:`${Vp.content} ${Vp.contentHasMessages}`,children:(0,u.jsx)(lRe,{messages:Q,sourceSessionId:g,sourceEntries:$?void 0:W,onSourceOpen:k,pendingApproval:null,isResponding:!1,workspaceCwd:i,virtualScrollThreshold:$?Number.MAX_SAFE_INTEGER:p,hideSessionTimeline:$})})})})})})})})})})})})}function oW(e){let t=rW(e.language);return(0,u.jsx)(zd,{label:"web-shell-transcript-root",resetKeys:[e.blocks,t],fallback:(a,n)=>(0,u.jsx)(pRe,{error:a,onRetry:n,language:t}),children:(0,u.jsx)(TRe,{...e})})}var wt=Be(Ga(),1),lW="qwen-export-theme";function Xd(e){return e===void 0||typeof e=="string"}function Yd(e){return e===void 0||typeof e=="number"&&Number.isFinite(e)&&e>=0}function IRe(){let e=document.getElementById("transcript-document");if(!(e instanceof HTMLScriptElement))throw new Error("Transcript document envelope is missing.");let t=e.textContent??"";if(t.length>33554432)throw new Error("Transcript document exceeds the envelope budget.");if(new TextEncoder().encode(t).byteLength>33554432)throw new Error("Transcript document exceeds the envelope budget.");let a=JSON.parse(t);if(a.schemaVersion!==1||a.rendererVersion!=="0.25.4-preview.0+2af183f50c53582d"||!Array.isArray(a.blocks)||a.blocks.length>1e3||!a.metadata||typeof a.metadata!="object"||Array.isArray(a.metadata)||!Xd(a.metadata.title)||!Xd(a.metadata.startedAt)||!Xd(a.metadata.projectName)||!Xd(a.metadata.repository)||!Xd(a.metadata.gitBranch)||!Xd(a.metadata.model)||!Xd(a.metadata.channel)||!Yd(a.metadata.promptCount)||!Yd(a.metadata.contextUsagePercent)||!Yd(a.metadata.contextWindowSize)||!Yd(a.metadata.totalTokens)||!Yd(a.metadata.filesWritten)||!Yd(a.metadata.linesAdded)||!Yd(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 _Re(){try{let e=localStorage.getItem(lW);if(e==="light"||e==="dark")return e}catch{}return"dark"}function sW(e){if(!e)return;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function LRe(e){if(e!==void 0)return e>=1e6?`${e/1e6}m`:e>=1e3?`${e/1e3}k`:String(e)}function xo({label:e,value:t}){return t===void 0||t===""?null:(0,wt.jsxs)("div",{className:"document-metadata-item",children:[(0,wt.jsx)("dt",{children:e}),(0,wt.jsx)("dd",{children:t})]})}function ARe({metadata:e}){let t=e.contextUsagePercent===void 0?void 0:`${e.contextUsagePercent>100?">100":e.contextUsagePercent}%${e.contextWindowSize===void 0?"":` of ${LRe(e.contextWindowSize)}`}`;return(0,wt.jsxs)("aside",{className:"document-metadata","data-document-metadata":!0,children:[(0,wt.jsxs)("section",{children:[(0,wt.jsx)("h2",{children:"Session Info"}),(0,wt.jsxs)("dl",{children:[(0,wt.jsx)(xo,{label:"Session",value:e.title??"Qwen Code Chat Export"}),(0,wt.jsx)(xo,{label:"Started",value:sW(e.startedAt)}),(0,wt.jsx)(xo,{label:"Exported",value:sW(e.exportedAt)}),(0,wt.jsx)(xo,{label:"Project",value:e.projectName}),(0,wt.jsx)(xo,{label:"Repository",value:e.repository}),(0,wt.jsx)(xo,{label:"Branch",value:e.gitBranch}),(0,wt.jsx)(xo,{label:"Model",value:e.model}),(0,wt.jsx)(xo,{label:"Channel",value:e.channel})]})]}),(0,wt.jsxs)("section",{children:[(0,wt.jsx)("h2",{children:"Statistics"}),(0,wt.jsxs)("dl",{children:[(0,wt.jsx)(xo,{label:"Prompts",value:e.promptCount}),(0,wt.jsx)(xo,{label:"Context Usage",value:t}),(0,wt.jsx)(xo,{label:"Tokens",value:e.totalTokens?.toLocaleString()})]})]}),(0,wt.jsxs)("section",{children:[(0,wt.jsx)("h2",{children:"File Operations"}),(0,wt.jsxs)("dl",{children:[(0,wt.jsx)(xo,{label:"Files modified",value:e.filesWritten}),(0,wt.jsx)(xo,{label:"Lines added",value:e.linesAdded}),(0,wt.jsx)(xo,{label:"Lines removed",value:e.linesRemoved})]})]})]})}function RRe({value:e}){let[t,a]=(0,So.useState)(_Re),[n,r]=(0,So.useState)(!0),o=(0,So.useRef)(n),s=(0,So.useRef)(null);return(0,So.useEffect)(()=>{document.documentElement.classList.toggle("dark",t==="dark"),document.documentElement.classList.toggle("light",t==="light");try{localStorage.setItem(lW,t)}catch{}},[t]),(0,So.useEffect)(()=>{o.current=n},[n]),(0,So.useEffect)(()=>{let i=()=>{s.current=o.current,(0,Z7.flushSync)(()=>r(!0))},l=()=>{let c=s.current;s.current=null,c!==null&&(0,Z7.flushSync)(()=>r(c))};return addEventListener("beforeprint",i),addEventListener("afterprint",l),()=>{removeEventListener("beforeprint",i),removeEventListener("afterprint",l)}},[]),(0,So.useEffect)(()=>{document.title=e.metadata.title||"Qwen Code Chat Export",requestAnimationFrame(()=>{document.body.dataset.renderComplete="true"})},[e.metadata.title]),(0,wt.jsxs)("main",{className:"document-shell",children:[(0,wt.jsxs)("header",{className:"document-header",children:[(0,wt.jsxs)("div",{children:[(0,wt.jsx)("h1",{children:e.metadata.title||"Qwen Code Chat Export"}),(0,wt.jsx)("p",{children:e.metadata.startedAt?`Started ${e.metadata.startedAt}`:`Exported ${e.metadata.exportedAt}`})]}),(!e.metadata.complete||e.metadata.truncated)&&(0,wt.jsx)("span",{className:"document-warning",children:"Partial export"}),(0,wt.jsxs)("div",{className:"document-actions","aria-label":"Document controls",children:[(0,wt.jsx)("button",{type:"button","data-document-expand-all":!0,disabled:n,onClick:()=>r(!0),children:"Expand all"}),(0,wt.jsx)("button",{type:"button","data-document-collapse-all":!0,disabled:!n,onClick:()=>r(!1),children:"Collapse all"}),(0,wt.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,wt.jsxs)("div",{className:"document-content",children:[(0,wt.jsx)("div",{className:"document-transcript",children:(0,wt.jsx)(oW,{blocks:e.blocks,renderMode:"document",compactThinking:!0,documentExpanded:n,theme:t})}),(0,wt.jsx)(ARe,{metadata:e.metadata})]})]})}function cW(){return(0,So.useEffect)(()=>{document.body.dataset.renderComplete="error"},[]),(0,wt.jsxs)("main",{className:"document-error",role:"alert",children:[(0,wt.jsx)("h1",{children:"Unable to open this chat export"}),(0,wt.jsx)("p",{children:"The file is incomplete or uses an incompatible renderer version."})]})}var J7=class extends So.Component{constructor(){super(...arguments);this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,wt.jsx)(cW,{}):this.props.children}},uW=document.getElementById("app");if(!uW)throw new Error("Transcript document root is missing.");if(document.body.dataset.renderComplete!=="error"){let e=(0,iW.createRoot)(uW);try{e.render((0,wt.jsx)(J7,{children:(0,wt.jsx)(RRe,{value:IRe()})}))}catch{e.render((0,wt.jsx)(cW,{}))}}})();
630
+ `)}function gIe(e){return e.find(t=>tn(t.status))??e[e.length-1]}function vIe(e,t,a,n=!1){if(a7(e)){let o=e.filter(i=>tn(i.status)&&!Us(i));if(o.length===0)return t("subagent.background");if(o.length===1&&zo(o[0].toolName))return t("toolGroup.summary.provideInformation");let s=o.map(i=>zo(i.toolName)?t("toolGroup.summary.provideInformation"):Fj(i,t,a));return t("toolGroup.running",{name:s.join(" \xB7 "),count:o.length})}return wIe(e,t,n)||t("toolGroup.summary",{count:e.length})}function Fj(e,t,a){if(Vd(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if(zo(e.toolName))return tn(e.status)?t("toolGroup.summary.provideInformation"):t("toolGroup.summary.askedQuestions",{count:qj(e)});let{displayName:n,description:r,hideDisplayName:o}=zj(e,t,a);return[o?"":n,r].filter(Boolean).join(" ")}function zj(e,t,a){let n=fu(e.toolName,t),r=vn(WU(e,a),120);return{kind:Jb(e),tool:e,displayName:n,description:r,elapsed:"",workspaceCwd:a,hideDisplayName:!!J0e(e)}}function yIe({tool:e,workspaceCwd:t}){let{t:a}=at(),n=zo(e.toolName),r=tn(e.status),o=Us(e),s=r&&!o&&hr(e),i=ck(s),l=!n&&r?o?a("subagent.background"):a("toolGroup.runningPrefix").trim():"";if(Vd(e.toolName)||n)return(0,u.jsxs)(u.Fragment,{children:[l&&(0,u.jsxs)("span",{children:[l," "]}),Fj(e,a,t)]});let c=zj(e,a,t),d=s?QU(e,a):"",f=s?{...c,description:[c.description,d&&`(${d})`].filter(Boolean).join(" "),elapsed:Bj(e,i).elapsed}:c;return(0,u.jsxs)(u.Fragment,{children:[l&&(0,u.jsxs)("span",{children:[l," "]}),(0,u.jsxs)("span",{className:he.chatSummaryInline,children:[!f.hideDisplayName&&(0,u.jsx)("span",{className:he.lineName,children:f.displayName}),(0,u.jsx)(lg,{info:f})]})]})}function wIe(e,t,a){let n=a?e.filter(hr).length:0;if(n>0){let f=e.length-n;return[t("toolGroup.summary.ranAgents",{count:n}),f?t("toolGroup.summary",{count:f}):""].filter(Boolean).join(" \xB7 ")}let r=0,o=0,s=0,i=0,l=0,c=0,d=0;for(let f of e){let p=f.toolName.toLowerCase();qs(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++:Vd(p)?l++:zo(p)?c+=qj(f):d++}return[r?t("toolGroup.summary.editedFiles",{count:r}):"",o?t("toolGroup.summary.ranCommands",{count:o}):"",s?t("toolGroup.summary.readFiles",{count:s}):"",i?t("toolGroup.summary.searched",{count:i}):"",l?t("toolGroup.summary.updatedTodos",{count:l}):"",c?t("toolGroup.summary.askedQuestions",{count:c}):"",d?t("toolGroup.summary.otherTools",{count:d}):""].filter(Boolean).join(" ")}function qj(e){let t=e.args?.questions;return Array.isArray(t)&&t.length>0?t.length:1}function bIe(){return(0,u.jsxs)("svg",{className:he.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,u.jsx)("path",{d:"M12 20h9"}),(0,u.jsx)("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function Uj(){return(0,u.jsxs)("svg",{className:he.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[(0,u.jsx)("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),(0,u.jsx)("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function kIe(){return(0,u.jsxs)("svg",{className:he.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[(0,u.jsx)("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.25"}),(0,u.jsx)("path",{d:"M1.8 7h10.4M7 1.5c1.3 1.5 2 3.3 2 5.5s-.7 4-2 5.5M7 1.5C5.7 3 5 4.8 5 7s.7 4 2 5.5",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function xIe(){return(0,u.jsxs)("svg",{className:he.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[(0,u.jsx)("rect",{x:"2",y:"1.6",width:"10",height:"10.8",rx:"2.2",stroke:"currentColor",strokeWidth:"1.25"}),(0,u.jsx)("path",{d:"M4.5 5.2h5M4.5 7h5M4.5 8.8h5",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function SIe(){return(0,u.jsx)("svg",{className:he.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:(0,u.jsx)("path",{d:"M3 4.2 4.2 5.4 6.1 3.3M7.5 4.5h3.6M3 9.1l1.2 1.2 1.9-2.1M7.5 9.4h3.6",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function CIe(){return(0,u.jsx)("svg",{className:he.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:(0,u.jsx)("path",{d:"M3.4 3.2h7.2c.7 0 1.25.55 1.25 1.25v3.4c0 .7-.55 1.25-1.25 1.25H7.5L4.5 11V9.1H3.4c-.7 0-1.25-.55-1.25-1.25v-3.4c0-.7.55-1.25 1.25-1.25Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function G9(){return(0,u.jsx)("svg",{className:he.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:(0,u.jsx)("path",{d:"M770.08 96.32c1.728.64 3.072 1.984 3.712 3.712l38.848 107.584c.64 1.728 1.984 3.104 3.712 3.712l107.584 38.848a6.144 6.144 0 0 1 0 11.584l-107.584 38.848a6.144 6.144 0 0 0-3.712 3.712l-38.848 107.584a6.144 6.144 0 0 1-11.584 0L723.36 304.32a6.144 6.144 0 0 0-3.712-3.712L612.064 261.76a6.144 6.144 0 0 1 0-11.584l107.584-38.848a6.144 6.144 0 0 0 3.712-3.712l38.848-107.584c1.184-3.2 4.704-4.8 7.872-3.68zM576 160H384q-119.296 0-203.648 84.352Q96 328.704 96 448v192q0 119.296 84.352 203.648Q264.704 928 384 928h256q119.296 0 203.648-84.352Q928 759.296 928 640V512h-64v128q0 92.8-65.6 158.4Q732.8 864 640 864H384q-92.8 0-158.4-65.6Q160 732.8 160 640V448q0-92.8 65.6-158.4Q291.2 224 384 224h192v-64zm96 248.224L568.224 512 672 615.776l45.248-45.28L658.752 512l58.496-58.496L672 408.224zM320 608V448h64v160h-64z",stroke:"currentColor",strokeWidth:"28",strokeLinejoin:"round"})})}function Hj({tool:e}){let t=Jb(e);return t==="agent"?(0,u.jsx)(G9,{}):t==="ask"?(0,u.jsx)(CIe,{}):t==="edit"||t==="write"?(0,u.jsx)(bIe,{}):t==="fetch"?(0,u.jsx)(kIe,{}):t==="read"?(0,u.jsx)(xIe,{}):t==="todo"?(0,u.jsx)(SIe,{}):(0,u.jsx)(Uj,{})}function V9(e){let t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}function TIe(e,t){if(e.approval?.id!==t.approval?.id||e.workspaceCwd!==t.workspaceCwd||e.onTurnOutputOpen!==t.onTurnOutputOpen||e.onToolResultOpen!==t.onToolResultOpen||e.summaryOnly!==t.summaryOnly||e.forceExpanded!==t.forceExpanded||e.detailsVisible!==t.detailsVisible||e.hideHeader!==t.hideHeader||e.hideCollapsedOutput!==t.hideCollapsedOutput)return!1;let a=e.tool,n=t.tool;return a.callId===n.callId&&a.toolName===n.toolName&&a.status===n.status&&a.subagentSessionReady===n.subagentSessionReady&&a.startTime===n.startTime&&a.endTime===n.endTime&&a.subContent===n.subContent&&a.rawOutput===n.rawOutput&&a.toolResult===n.toolResult&&a.toolDetailsRevision===n.toolDetailsRevision&&a.wasCancelled===n.wasCancelled&&a.args===n.args&&a.content===n.content&&a.locations===n.locations&&a.title===n.title&&IIe(a.subTools,n.subTools)}function IIe(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let a=0;a<e.length;a++){let n=e[a],r=t[a];if(n.callId!==r.callId||n.toolName!==r.toolName||n.status!==r.status||n.subagentSessionReady!==r.subagentSessionReady||n.endTime!==r.endTime||n.rawOutput!==r.rawOutput||n.toolResult!==r.toolResult||n.toolDetailsRevision!==r.toolDetailsRevision||n.wasCancelled!==r.wasCancelled||n.args!==r.args||n.subContent!==r.subContent||n.title!==r.title)return!1}return!0}var Eq=/\[([^\]]+)\]\(qwen-session:\/\/([^)]+)\)/g;function J6(e,t){if(!e||!e.includes("qwen-session://"))return e;let a=[],n=0,r;for(Eq.lastIndex=0;(r=Eq.exec(e))!==null;){r.index>n&&a.push(e.slice(n,r.index));let o=r[2];a.push(t!=="interactive"?(0,u.jsx)("span",{style:{textDecoration:"underline"},children:r[1]},r.index):(0,u.jsx)("a",{href:"#",role:"button",style:{textDecoration:"underline",cursor:"pointer"},onClick:s=>{s.preventDefault(),s.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:o}))},children:r[1]},r.index)),n=r.index+r[0].length}return n<e.length&&a.push(e.slice(n)),a.length===1?a[0]:(0,u.jsx)(u.Fragment,{children:a})}var K9=(0,w.memo)(function({tool:e,approval:t,workspaceCwd:a,onTurnOutputOpen:n,onToolResultOpen:r,summaryOnly:o=!1,forceExpanded:s=!1,detailsVisible:i=!0,hideHeader:l=!1,hideCollapsedOutput:c=!1}){let{t:d}=at(),f=Na(),p=sk(),m=IH(),{hostOwnsEditDiffPreview:g}=qo(),h=m!==void 0,b=xg(e.rawOutput),v=s||!!b,y=t?.toolCallId===e.callId,k=!!(g&&y&&t?.hasDiffPreview&&Nb(t?.toolName??e.toolName)),C=k,[T,I]=(0,w.useState)(!1),[S,L]=(0,w.useState)(()=>v||!o&&Rq(e)&&!C),E=(0,w.useRef)(null),R=(0,w.useRef)(!1),N=m7(e.toolName);(0,w.useEffect)(()=>{L(v||!o&&Rq(e)&&!C),I(!1),E.current=null,R.current=!1},[v,C,h,o,e.callId,e.toolName]);let O=hr(e),$=!y&&t?.toolCallId&&O&&Hs(e,t.toolCallId),z=!!(k||g&&$&&t?.hasDiffPreview&&Nb(t.toolName??"")),H=tn(e.status),G=H&&!qs(e.toolName)&&!V9(e.toolName)&&!z,J=ck(G);if((0,w.useEffect)(()=>{!v&&!O&&e.status==="completed"&&!R.current&&L(!1)},[v,O,e.status]),O){let X=Bj(e,J),fe=X.explicitAgentType?`${d("agent.label")} (${Lg(X.explicitAgentType,d)})`:d("agent.label"),ke=e.status==="completed"||e.status==="failed",Ve=Us(e),Xe=[Ve&&!ke?d("subagent.background"):e.status==="pending"?d("subagent.pending"):d("subagent.running"),Ve&&!ke||z?"":X.elapsed].filter(Boolean).join(" \xB7 "),kt=[X.subToolCount>0?d("subagent.toolsCount",{count:X.subToolCount}):"",X.elapsed,X.tokens,X.reason?vn(X.reason,80):""].filter(Boolean).join(" \xB7 "),Xt=s||S||!!$,nt=!!y,Lt=Ci(e),et=(0,u.jsx)(S7,{tool:e,approval:g?t:void 0,hideHeader:!0,defaultExpanded:!0,inline:!0});if(p&&!l){let Gt=(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(G9,{}),(0,u.jsx)(Jp,{status:ke?X.status:e.status}),(0,u.jsx)("span",{className:he.lineName,children:fe}),(0,u.jsx)(lg,{info:{kind:"agent",tool:e,displayName:fe,description:X.description?vn(X.description,60):"",elapsed:ke?kt:Xe,workspaceCwd:a}})]});return(0,u.jsx)("div",{className:he.line,"data-transcript-tool-call-id":e.callId,children:nt?(0,u.jsx)("div",{className:`${he.lineMain} ${he.lineButton}`,"aria-disabled":"true",children:Gt}):(0,u.jsxs)("button",{type:"button",className:`${he.lineMain} ${he.lineExpandable} ${he.lineButton}`,"aria-disabled":!!Lt||void 0,title:Lt?d(Lt):void 0,onClick:()=>{Lt||p.onOpen(e)},children:[Gt,(0,u.jsx)("span",{className:he.lineChevronRight,"aria-hidden":"true"})]})})}return(0,u.jsxs)("div",{className:he.line,"data-transcript-tool-call-id":e.callId,children:[!l&&(0,u.jsxs)("div",{className:`${he.lineMain} ${nt?"":he.lineExpandable}`,"aria-disabled":!!Lt||void 0,title:Lt?d(Lt):void 0,onClick:nt||Lt?void 0:()=>L(!S),children:[(0,u.jsx)(G9,{}),(0,u.jsx)(Jp,{status:ke?X.status:e.status}),(0,u.jsx)("span",{className:he.lineName,children:fe}),(0,u.jsx)(lg,{info:{kind:"agent",tool:e,displayName:fe,description:X.description?vn(X.description,60):"",elapsed:ke?kt:Xe,workspaceCwd:a}}),!nt&&(0,u.jsx)("span",{className:S?he.lineChevronDown:he.lineChevronRight,"aria-hidden":"true"})]}),Xt&&(0,u.jsx)("div",{className:he.lineDetail,children:l?(0,u.jsx)("div",{className:he.expandedAgentCard,children:et}):et})]})}let Q=Hb(e,a),W=ege(e),A=qs(e.toolName)?WU(e,a):Q,U=fu(e.toolName,d),Y=z||qs(e.toolName)||V9(e.toolName)?"":am(e.startTime,H?J:e.endTime),P=e.toolName.toLowerCase(),ae=P==="monitor"&&h&&!T&&!l,le=Vd(P),Te=le?iH(e):void 0,q=!!Te&&Te.length>0,ne=Te?Te.filter(X=>X.status==="completed").length:0,ie=qs(P),te=P==="grep"||P==="grep_search"||P==="search"||P==="glob",me=P==="read"||P==="read_file"||P==="readfile",xe=f7(P),Fe=i&&(me||Nb(P)||P==="display_image"||P==="zoom_image")?(0,u.jsx)(Lq,{tool:e,workspaceCwd:a,onOpen:n}):void 0,ve=!le&&hIe(A),K=!v&&!C,Se=ae||K,Le=()=>{R.current=!0,L(X=>!X)},Ye=()=>{I(!0),K&&Le()},ut=()=>{m&&$j(E,()=>m.onOpen(e),Ye)},qt=X8e(e),ua=S&&ve,ye=me||xe,qe=ua&&!ie&&!te&&!me,ue=Q,Oe=S&&!qt&&(!le||!q&&!W);return(0,u.jsxs)("div",{className:he.line,"data-transcript-tool-call-id":e.callId,children:[l&&H&&Y&&(0,u.jsx)("div",{className:he.lineMain,children:(0,u.jsx)(lg,{info:{kind:Jb(e),tool:e,displayName:U,description:"",elapsed:Y,workspaceCwd:a}})}),!l&&(0,u.jsxs)("div",{className:`${he.lineMain} ${Se?he.lineExpandable:""}`,title:ae?void 0:K?d(S?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":ae?void 0:K?S:void 0,role:Se?"button":void 0,tabIndex:Se?0:void 0,onClick:Se?()=>{if(ae){ut();return}Le()}:void 0,onKeyDown:Se?X=>{if(!(X.key!=="Enter"&&X.key!==" ")){if(X.preventDefault(),ae){ut();return}Le()}}:void 0,children:[(0,u.jsx)(Hj,{tool:e}),(0,u.jsx)(Jp,{status:e.status}),(0,u.jsx)("span",{className:he.lineName,children:U}),le&&q&&(0,u.jsxs)("span",{className:he.todoProgress,children:[ne,"/",Te.length]}),(0,u.jsx)(lg,{info:{kind:Jb(e),tool:e,displayName:U,description:le||qe?"":A,elapsed:le?"":Y,workspaceCwd:a}}),Se&&(0,u.jsx)("span",{className:!ae&&S?he.lineChevronDown:he.lineChevronRight,"aria-hidden":"true"})]}),b&&(!o||S)&&(0,u.jsx)(q8e,{display:b}),!b&&(!o||S)&&le&&q&&(0,u.jsx)(lIe,{tool:e,todos:Te,expanded:S,title:U}),!b&&(!o||S)&&le&&!q&&W&&(0,u.jsx)("div",{className:he.lineOutput,children:J6(W,f)}),!b&&Oe&&(0,u.jsx)(mg,{title:U,detail:ue,status:e.status,action:Fe,children:W&&(0,u.jsx)("div",{className:`${he.lineOutput} ${he.expandedLineOutput}`,children:J6(W,f)})}),!b&&!le&&!c&&W&&!Oe&&(!S||!qt)&&(!o||S)&&(0,u.jsx)("div",{className:S?`${he.lineOutput} ${he.expandedLineOutput}`:he.lineOutput,children:J6(W,f)}),!b&&!le&&S&&qt&&(!N||i)&&(0,u.jsx)("div",{className:N?`${he.lineDetail} ${he.workflowLineDetail}`:ye?`${he.lineDetail} ${he.markdownLineDetail}`:he.lineDetail,children:(0,u.jsx)(o5e,{tool:e,enabled:i&&(ie||me),children:X=>N?(0,u.jsx)(cIe,{tool:X,displayName:U,detail:ue,result:W}):ie?(0,u.jsx)(a5e,{tool:X}):me?(0,u.jsx)(mg,{title:U,status:X.status,action:i?(0,u.jsx)(Lq,{tool:X,workspaceCwd:a,onOpen:n}):void 0,children:(0,u.jsx)(nIe,{tool:X})}):(0,u.jsxs)(mg,{title:U,detail:ue,status:X.status,action:Fe,children:[(P==="write_file"||P==="writefile")&&(0,u.jsx)(Aq,{tool:X}),(P==="edit"||P==="write"||P==="editfile")&&(0,u.jsx)(Aq,{tool:X}),zo(X.toolName)&&(0,u.jsx)(dIe,{tool:X}),h7(P)&&(0,u.jsx)(fIe,{tool:X}),xe&&(0,u.jsx)(Ti,{content:VU(X)??""})]})})}),e.toolResult&&(S||e.toolResult.execution_status!=="success"||e.toolResult.capture_status==="partial"||e.toolResult.capture_status==="unavailable"||e.toolResult.delivery_status!=="committed")&&(0,u.jsx)(K8e,{result:e.toolResult,onOpen:r})]})},TIe),_Ie=(0,w.memo)(function({isStreaming:e,expanded:t,documentMode:a,translateContent:n,generateContent:r,onToggle:o}){let{language:s,t:i}=at();return(0,u.jsxs)("div",{className:`${he.chatSummaryThoughtHeader}${t?` ${he.chatSummaryThoughtHeaderExpanded}`:""}`,onClick:l=>{!a&&l.currentTarget.contains(l.target)&&o()},children:[(0,u.jsxs)("button",{type:"button",disabled:a,tabIndex:a?-1:void 0,className:he.chatSummaryThoughtSummary,"data-testid":"compact-thinking-summary","aria-expanded":a?void 0:t,title:a?void 0:i(t?"thinking.collapse":"thinking.expand"),children:[(0,u.jsx)("span",{className:he.chatSummaryThoughtIcon,"aria-hidden":"true",children:(0,u.jsx)(b7,{})}),(0,u.jsx)("span",{className:`${he.chatSummaryThoughtLabel}${e?` ${he.chatSummaryThoughtLabelActive}`:""}`,children:i(e?"thinking.running":"thinking.done")})]}),s==="zh-CN"&&n!==void 0&&r&&(0,u.jsx)(JU,{content:n,generateContent:r,className:he.chatSummaryThoughtTranslate}),(0,u.jsx)("span",{className:t?he.chatSummaryThoughtChevronDown:he.chatSummaryThoughtChevronRight,"aria-hidden":"true"})]})}),e9=(0,w.memo)(function({content:e,isStreaming:t,generateContent:a}){let n=Na()==="document",r=tk(),[o,s]=(0,w.useState)(!1),i=n?r:o,l=(0,w.useCallback)(()=>{n||s(c=>!c)},[n]);return(0,u.jsxs)("div",{className:he.chatSummaryThought,children:[(0,u.jsx)(_Ie,{isStreaming:t,expanded:i,documentMode:n,translateContent:n||t?void 0:e,generateContent:a,onToggle:l}),i&&(0,u.jsx)("div",{className:he.chatSummaryThoughtContent,children:(0,u.jsx)(Ti,{content:e,source:"thinking",isStreaming:t})})]})}),LIe=(0,w.memo)(function({tools:e,compactSummary:t=!1,thoughts:a,pendingApproval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,isLocateFlashing:i=!1,generateContent:l}){let{t:c}=at(),d=Na()==="document",f=tk(),p=sk(),m=IH(),g=m!==void 0,[h,b]=(0,w.useState)(!1),[v,y]=(0,w.useState)(!1),k=d?f:v,C=(0,w.useRef)(null),T=a7(e),I=e.find(q=>tn(q.status)&&!Us(q))??(e.length>0?gIe(e):void 0),S=e.length===1?e[0]:void 0,L=!!a?.length,E=S&&hr(S)?S:void 0,R=S&&S.toolName.toLowerCase()==="monitor"?S:void 0,N=(S?xg(S.rawOutput):void 0)?.resourceUri,O=e.some(q=>xg(q.rawOutput)),$=e.some(q=>m7(q.toolName)),z=e.some(q=>tn(q.status)&&!Us(q)),H=a?.find(q=>q.isStreaming),G=T&&z?!0:H!==void 0,J=!G&&e.some(q=>tn(q.status)&&Us(q)),Q=!!(!t&&E&&p),W=!!(!t&&R&&g&&!h),A=Q||W,U=!t&&E?Ci(E):void 0,Y=T?I??e[0]:e[0],P=n?.toolCallId&&e.some(q=>Hs(q,n.toolCallId)),ae=new Map,le=new Set;for(let q=0;t&&q<e.length;q++){if(!hr(e[q]))continue;let ne=q+1;for(;ne<e.length&&hr(e[ne]);)ne++;if(ne-q>=2){let ie=e.slice(q,ne);ae.set(ie[0].callId,ie);for(let te of ie.slice(1))le.add(te.callId)}q=ne-1}(0,w.useEffect)(()=>{b(!1),y(!1),C.current=null},[g,R?.callId]),(0,w.useEffect)(()=>{(N||O)&&y(!0)},[N,O]);let Te=()=>{!R||!m||$j(C,()=>m.onOpen(R),()=>{b(!0),y(q=>!q)})};return P?(0,u.jsx)("div",{className:`${he.group}${i?` ${Ul.flash}`:""}`,children:e.map(q=>(0,u.jsx)(K9,{tool:q,approval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,forceExpanded:d},q.callId))}):(0,u.jsxs)("div",{className:i?Ul.flash:void 0,children:[(0,u.jsxs)("button",{type:"button",disabled:d,"aria-disabled":!!U||void 0,tabIndex:d?-1:void 0,className:he.chatSummary,onClick:()=>{if(!(d||U)){if(Q&&E&&p){p.onOpen(E);return}if(W&&R&&m){Te();return}y(q=>!q)}},"aria-expanded":d||A?void 0:v,title:U?c(U):d||A?void 0:c(k?"tool.collapseHint":"tool.expand"),children:[(0,u.jsx)("span",{className:J?`${he.chatSummaryIcon} ${he.chatSummaryIconDetached}`:he.chatSummaryIcon,"aria-hidden":"true",children:H?(0,u.jsx)(b7,{}):Y?(0,u.jsx)(Hj,{tool:Y}):(0,u.jsx)(Uj,{})}),(0,u.jsx)("span",{className:G?`${he.chatSummaryText} ${he.chatSummaryTextActive}`:he.chatSummaryText,children:H?c("thinking.running"):S?(0,u.jsx)(yIe,{tool:S,workspaceCwd:r}):vIe(e,c,r,t)}),(0,u.jsx)("span",{className:k?he.chatChevronDown:he.chatChevronRight,"aria-hidden":"true"})]}),(k||O||$)&&(0,u.jsx)("div",{"aria-hidden":!k,ref:q=>{q?.toggleAttribute("inert",!k)},className:k?he.chatSummaryContentClip:`${he.chatSummaryContentClip} ${he.chatSummaryContentCollapsed}`,style:!k&&O&&!$?{display:"none"}:void 0,children:(0,u.jsx)("div",{className:he.chatSummaryContentInner,children:(0,u.jsxs)("div",{className:`${he.group} ${he.chatSummaryGroup}`,children:[e.map(q=>{if(le.has(q.callId))return null;let ne=ae.get(q.callId);return(0,u.jsxs)(w.Fragment,{children:[a?.filter(ie=>ie.beforeToolCallId===q.callId).map((ie,te)=>(0,u.jsx)(e9,{content:ie.content,isStreaming:ie.isStreaming,generateContent:l},`thought-${q.callId}-${te}`)),ne?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{className:he.chatSummaryParallelAgents,"data-testid":"compact-parallel-agents",children:(0,u.jsx)(CH,{agents:ne,pendingApproval:n})}),ne.slice(1).flatMap(ie=>a?.filter(te=>te.beforeToolCallId===ie.callId).map((te,me)=>(0,u.jsx)(e9,{content:te.content,isStreaming:te.isStreaming,generateContent:l},`thought-${ie.callId}-${me}`)))]}):(0,u.jsx)(K9,{tool:q,approval:n,workspaceCwd:r,onTurnOutputOpen:o,onToolResultOpen:s,summaryOnly:!S||L,forceExpanded:d||!!S&&!L,detailsVisible:k,hideHeader:!!S&&!L})]},q.callId)}),a?.filter(q=>q.beforeToolCallId===void 0).map((q,ne)=>(0,u.jsx)(e9,{content:q.content,isStreaming:q.isStreaming,generateContent:l},`thought-trailing-${ne}`))]})})})]})}),Q7="summary-",hg=e=>`${Q7}${e}`,jj=e=>e.startsWith(Q7),gg=e=>jj(e)?e.slice(Q7.length):void 0,AIe="_message_1ujhf_1",RIe="_header_1ujhf_6",EIe="_headerStatic_1ujhf_7",MIe="_chevron_1ujhf_24",NIe="_title_1ujhf_30",PIe="_progress_1ujhf_39",su={message:AIe,header:RIe,headerStatic:EIe,chevron:MIe,title:NIe,progress:PIe};function OIe({id:e,todos:t}){let a=(0,w.useContext)(t7).get(e)?.events??[];return(0,u.jsx)(_H,{todos:t,events:a})}var DIe=(0,w.memo)(function({id:e,todos:t,isLocateFlashing:a=!1}){let{t:n}=at(),r=Na()==="document",o=tk(),[s,i]=(0,w.useState)(!1);if(t.length===0)return null;let l=r?o:s,c=t.length,d=t.filter(f=>f.status==="completed").length;return(0,u.jsxs)("div",{className:`${su.message}${a?` ${Ul.flash}`:""}`,children:[r?(0,u.jsxs)("div",{className:su.headerStatic,children:[(0,u.jsx)("span",{className:su.title,children:n("plan.title")}),(0,u.jsxs)("span",{className:su.progress,children:[d,"/",c]})]}):(0,u.jsxs)("button",{type:"button",className:su.header,onClick:()=>i(f=>!f),"aria-expanded":s,title:n(s?"todo.collapse":"todo.expand"),children:[(0,u.jsx)("span",{className:su.chevron,"aria-hidden":"true",children:s?"\u25BE":"\u25B8"}),(0,u.jsx)("span",{className:su.title,children:n("plan.title")}),(0,u.jsxs)("span",{className:su.progress,children:[d,"/",c]})]}),l?(0,u.jsx)(LH,{todos:t,numbered:!0}):(0,u.jsx)(OIe,{id:e,todos:t})]})}),$Ie="_message_1abcu_1",BIe="_content_1abcu_11",FIe="_question_1abcu_17",zIe="_prefix_1abcu_24",qIe="_answer_1abcu_28",UIe="_pending_1abcu_32",HIe="_shortcuts_1abcu_36",Md={message:$Ie,content:BIe,question:FIe,prefix:zIe,answer:qIe,pending:UIe,shortcuts:HIe},jIe=(0,w.memo)(function({question:e,answer:t,isPending:a}){let{t:n}=at();return(0,u.jsxs)("div",{className:Md.message,children:[(0,u.jsxs)("div",{className:Md.content,children:[(0,u.jsxs)("div",{className:Md.question,children:[(0,u.jsx)("span",{className:Md.prefix,children:"/btw "}),(0,u.jsx)("span",{children:e})]}),(0,u.jsx)("div",{className:Md.answer,children:a?(0,u.jsx)("span",{className:Md.pending,children:n("btw.answering")}):(0,u.jsx)(Ti,{content:t})})]}),(0,u.jsx)("div",{className:Md.shortcuts,children:n(a?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),WIe="_message_1g0wi_1",GIe="_header_1g0wi_21",VIe="_status_1g0wi_30",KIe="_name_1g0wi_35",XIe="_command_1g0wi_42",YIe="_output_1g0wi_51",Gp={message:WIe,header:GIe,status:VIe,name:KIe,command:XIe,output:YIe},QIe=(0,w.memo)(function({command:e,output:t}){let{t:a}=at();return(0,u.jsxs)("div",{className:Gp.message,children:[(0,u.jsxs)("div",{className:Gp.header,children:[(0,u.jsx)("span",{className:Gp.status,children:"\u2713"}),(0,u.jsx)("span",{className:Gp.name,children:a("shell.command")}),e&&(0,u.jsx)("span",{className:Gp.command,children:e})]}),t&&(0,u.jsx)("pre",{className:Gp.output,children:t})]})}),ZIe="_progress_1ik59_1",JIe="_spinner_1ik59_12",e_e="_bar_1ik59_19",t_e="_stage_1ik59_25",a_e="_icon_1ik59_29",n_e="_done_1ik59_35",r_e="_error_1ik59_43",o_e="_detail_1ik59_51",s_e="_path_1ik59_56",i_e="_pathButton_1ik59_61",Wn={progress:ZIe,spinner:JIe,bar:e_e,stage:t_e,icon:a_e,done:n_e,error:r_e,detail:o_e,path:s_e,pathButton:i_e},Mq=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827"];function l_e({progress:e}){let{stage:t,progress:a,detail:n,isComplete:r,error:o}=e,[s,i]=(0,w.useState)(0),l=30,c=Math.round(a/100*l),d=l-c,f="\u2588".repeat(Math.max(0,c))+"\u2591".repeat(Math.max(0,d));return(0,w.useEffect)(()=>{if(r||o)return;let p=setInterval(()=>{i(m=>(m+1)%Mq.length)},120);return()=>clearInterval(p)},[r,o]),o?(0,u.jsxs)("div",{className:`${Wn.progress} ${Wn.error}`,children:[(0,u.jsx)("span",{className:Wn.icon,children:"\u2715"}),(0,u.jsx)("span",{className:Wn.stage,children:t}),(0,u.jsx)("div",{className:Wn.detail,children:o})]}):r?(0,u.jsxs)("div",{className:`${Wn.progress} ${Wn.done}`,children:[(0,u.jsx)("span",{className:Wn.icon,children:"\u2713"}),(0,u.jsx)("span",{className:Wn.stage,children:t})]}):(0,u.jsxs)("div",{className:Wn.progress,children:[(0,u.jsx)("span",{className:Wn.spinner,children:Mq[s]}),(0,u.jsx)("span",{className:Wn.bar,children:f}),(0,u.jsxs)("span",{className:Wn.stage,children:[t,n?` (${n})`:""]})]})}function c_e({path:e,onInsightReportOpen:t}){let{t:a}=at();return(0,u.jsxs)("div",{className:`${Wn.progress} ${Wn.done}`,children:[(0,u.jsx)("span",{className:Wn.icon,children:"\u2713"}),(0,u.jsx)("span",{className:Wn.stage,children:a("insight.ready")}),t?(0,u.jsx)("button",{type:"button",className:`${Wn.path} ${Wn.pathButton}`,onClick:()=>t(e),children:e}):(0,u.jsx)("span",{className:Wn.path,children:e})]})}var u_e=(0,w.createContext)(void 0);function d_e(e,t){return e!=="background_notification"&&e!=="mid_turn_message_injected"&&e!=="goal_runtime"&&e!=="goal_control"&&(e!=="cron"||t.trim().length>0)}function f_e(){return(0,w.useContext)(u_e)}var p_e=(0,w.memo)(function({message:e,pendingApproval:t,onShowContextDetail:a,onLocateBackgroundSource:n,onImagePreview:r,onAttachmentPreview:o,onTurnOutputOpen:s,onToolResultOpen:i,onInsightReportOpen:l,workspaceCwd:c,showRetryHint:d=!1,onRetryClick:f,sendFailed:p=!1,onRetrySend:m,onEditUserMessage:g,onDeleteMessage:h,deleteMessageDisabled:b,onSubmitUserMessageEdit:v,onBranchSession:y,branchRecordId:k,showAssistantActions:C=!1,showAssistantBranch:T=!1,assistantFeedbackTurnId:I,assistantFeedbackPromptId:S,assistantFeedbackRating:L,onAssistantFeedbackRate:E,isLocateFlashing:R=!1,assistantTurnFooterInfo:N,turnSources:O,onSourceOpen:$,generateContent:z}){let{t:H}=at(),[G,J]=(0,w.useState)(!1),[Q,W]=(0,w.useState)(!1),A=(0,w.useCallback)(()=>{g?.()!==!0&&J(!0)},[g]),U=(0,w.useCallback)(()=>{J(!1)},[]),Y=(0,w.useCallback)(ve=>{v&&(W(!0),Promise.resolve(v(ve)).catch(()=>!1).then(K=>{W(!1),K!==!1&&J(!1)}))},[v]),P=(0,w.useMemo)(()=>y&&k?()=>y(k):void 0,[y,k]),ae=(0,w.useMemo)(()=>E&&S?ve=>E(S,I??"",ve):void 0,[E,S,I]),le=(0,w.useContext)(e7),Te=e.role==="tool_group"&&e.tools.length===1&&p7(e.tools[0])?e.tools[0]:void 0,q=Te?Z0e(Te):null,ne=!!q||e.role==="user"||e.role==="system"&&e.source==="mid_turn_message_injected",ie=f_e(),te=(()=>{switch(e.role){case"user":return(0,u.jsx)(UU,{content:e.content,images:e.images,files:e.files,inputAnnotations:e.inputAnnotations,isLocateFlashing:R,sendFailed:p,onRetrySend:m,editing:G,submittingEdit:Q,onEditSubmit:Y,onEditCancel:U,onImagePreview:r,onAttachmentPreview:o,author:e.author});case"assistant":return(0,u.jsx)(g1e,{content:e.content,author:e.author,agentMessage:e.agentMessage,isStreaming:e.isStreaming,timestamp:e.timestamp,onBranchSession:P,showFooterActions:C,showBranchAction:T,showAssistantFeedback:S!==void 0,assistantFeedbackRating:L,onAssistantFeedbackRate:ae,isLocateFlashing:R,customFooterInfo:N,turnSources:O,onSourceOpen:$});case"thinking":return(0,u.jsx)(x1e,{content:e.content,author:e.author,isStreaming:e.isStreaming,timestamp:e.timestamp,isLocateFlashing:R,generateContent:z});case"tool_group":return Te&&!q&&!Gd(Te)?.trim()?null:q&&Te?!q.answers.length&&!q.text.trim()?null:(0,u.jsx)(X0e,{tool:Te,result:q,isLocateFlashing:R}):(0,u.jsx)(LIe,{tools:e.tools,onTurnOutputOpen:s,onToolResultOpen:i,thoughts:e.thoughts,compactSummary:le&&jj(e.id),pendingApproval:t,workspaceCwd:c,isLocateFlashing:R,generateContent:z});case"plan":return(0,u.jsx)(DIe,{id:e.id,todos:e.todos,isLocateFlashing:R});case"system":return(0,u.jsx)(T4e,{content:e.content,variant:e.variant,source:e.source,data:e.data,images:e.images,files:e.files,onShowContextDetail:a,onLocateBackgroundSource:n,onImagePreview:r,onAttachmentPreview:o,showRetryHint:d&&e.retryable===!0,onRetryClick:f});case"user_shell":return(0,u.jsx)(QIe,{command:e.command,output:e.output});case"btw":return(0,u.jsx)(jIe,{question:e.question,answer:e.answer,isPending:e.isPending});case"insight_progress":return(0,u.jsx)(l_e,{progress:{stage:e.stage,progress:e.progress,detail:e.detail}});case"insight_ready":return(0,u.jsx)(c_e,{path:e.path,onInsightReportOpen:l});case"insight_error":return(0,u.jsx)("div",{style:{color:"var(--error-color, #e06c75)"},children:e.error});default:return null}})();if(te===null)return null;let me=(0,u.jsx)(zd,{label:`message:${e.role}`,resetKeys:[e],fallback:(0,u.jsx)(m_e,{align:ne?"end":"start"}),children:te}),xe=(0,u.jsx)("div",{"data-user-selectable":"true",style:{display:"contents"},children:me});if(e.role==="assistant")return C?xe:(0,u.jsx)(m9,{timestamp:e.timestamp,children:xe});if(e.role==="system"&&e.source==="prompt_cancelled")return xe;let Fe=ie&&e.role==="user"&&d_e(e.source,e.content)?e.id:void 0;return(0,u.jsx)(m9,{timestamp:e.timestamp,hideTimestamp:e.role==="system"&&(e.source==="background_task_completed"||e.source==="background_notification_turn_started"),chatMode:ne,toolGroupSpacing:e.role==="tool_group"&&le,copyText:ne&&"content"in e?e.content:void 0,copyTitle:H("common.copy"),onEdit:g&&!G?A:void 0,editTitle:H("userMessage.edit"),onDelete:h,deleteDisabled:b,deleteTitle:H("messageDelete.entry"),onOpenTurnCalls:ie&&Fe?()=>ie(Fe):void 0,turnCallsTitle:H("turnCalls.open"),children:xe})},h_e);function m_e({align:e}){let{t}=at();return(0,u.jsx)("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:(0,u.jsx)("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function h_e(e,t){return e.pendingApproval?.id!==t.pendingApproval?.id||e.onShowContextDetail!==t.onShowContextDetail||e.onLocateBackgroundSource!==t.onLocateBackgroundSource||e.onImagePreview!==t.onImagePreview||e.onAttachmentPreview!==t.onAttachmentPreview||e.onTurnOutputOpen!==t.onTurnOutputOpen||e.onToolResultOpen!==t.onToolResultOpen||e.workspaceCwd!==t.workspaceCwd||e.showRetryHint!==t.showRetryHint||e.onRetryClick!==t.onRetryClick||e.sendFailed!==t.sendFailed||e.onRetrySend!==t.onRetrySend||e.onEditUserMessage!==t.onEditUserMessage||e.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.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||!g_e(e.assistantTurnFooterInfo,t.assistantTurnFooterInfo)?!1:y_e(e.message,t.message)}function g_e(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 v_e(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 y_e(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&&Pq(e.images,t.images);case"assistant":return t.role==="assistant"&&e.content===t.content&&e.isStreaming===t.isStreaming&&v_e(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&&Pq(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"&&w_e(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&b_e(e.thoughts,t.thoughts)&&e.tools.length===t.tools.length&&e.tools.every((a,n)=>Wj(a,t.tools[n]));default:return!1}}function w_e(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 Wj(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&&Si(e.args)===Si(t.args)&&Si(e.rawOutput)===Si(t.rawOutput)&&Si(e.toolResult)===Si(t.toolResult)&&e.wasCancelled===t.wasCancelled&&Si(e.locations)===Si(t.locations)&&Si(e.content)===Si(t.content)&&k_e(e.subTools,t.subTools):!1}function b_e(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 k_e(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((a,n)=>Wj(a,t[n]))}var Nq=new WeakMap;function Pq(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 Si(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=Nq.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return Nq.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}function Oq({additions:e,deletions:t,className:a,additionsClassName:n,deletionsClassName:r}){return e===void 0||t===void 0?null:(0,u.jsxs)("span",{className:a,children:[(0,u.jsxs)("span",{className:n,children:["+",e]}),(0,u.jsxs)("span",{className:r,children:["-",t]})]})}function x_e(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 S_e="_root_numdi_1",C_e="_card_numdi_7",T_e="_summary_numdi_14",I_e="_icon_numdi_22",__e="_iconSvg_numdi_33",L_e="_title_numdi_39",A_e="_artifactTitle_numdi_46",R_e="_reviewSummary_numdi_52",E_e="_reviewSummaryWithStats_numdi_59",M_e="_reviewMeta_numdi_64",N_e="_linkButton_numdi_71",P_e="_reviewButton_numdi_72",O_e="_showMoreButton_numdi_73",D_e="_actions_numdi_102",$_e="_openButtonWrapper_numdi_108",B_e="_list_numdi_132",F_e="_fileRow_numdi_139",z_e="_path_numdi_159",q_e="_lineStats_numdi_168",U_e="_additions_numdi_177",H_e="_deletions_numdi_181",j_e="_chevronIcon_numdi_195",W_e="_chevronIconOpen_numdi_203",G_e="_artifactInfo_numdi_207",V_e="_artifactMeta_numdi_212",_t={root:S_e,card:C_e,summary:T_e,icon:I_e,iconSvg:__e,title:L_e,artifactTitle:A_e,reviewSummary:R_e,reviewSummaryWithStats:E_e,reviewMeta:M_e,linkButton:N_e,reviewButton:P_e,showMoreButton:O_e,actions:D_e,openButtonWrapper:$_e,list:B_e,fileRow:F_e,path:z_e,lineStats:q_e,additions:U_e,deletions:H_e,chevronIcon:j_e,chevronIconOpen:W_e,artifactInfo:G_e,artifactMeta:V_e},X9=3;function Dq(e,t){return t?e:e.slice(0,X9)}function K_e({turnId:e,changes:t,artifacts:a,sourceSessionId:n,scheduledTasks:r,workspaceCwd:o,onOpenRequest:s,onReviewChanges:i,onOpenArtifact:l,onOpenScheduledTask:c,onError:d}){let{t:f}=at(),{filterArtifact:p}=qo(),m=p?a.filter(O=>p(O,{turnId:e,sourceSessionId:n})):a,g=Dj(o),h=g?.actions,[b,v]=(0,w.useState)(!1),[y,k]=(0,w.useState)(!1);if(t.length===0&&m.length===0&&r.length===0)return null;let C=Dq(t,b),T=t.length-X9,I=Dq(m,y),S=m.length-X9,L=x_e(t),E=O=>{if(s){s({id:"review",kind:"review",title:f("turnOutputs.review"),turnId:e,changes:t,...o?{workspaceCwd:o}:{},...g?.workspaceId?{workspaceId:g.workspaceId}:{},...O?{selectedPath:O}:{}});return}i(t,O)},R=O=>{let $=J_e(O,t,o);if(s){s({id:`artifact:${O.id}`,kind:"artifact",title:pU(O),turnId:e,artifactId:O.id,...O.managedId?{managedId:O.managedId}:{},artifact:O,...o?{workspaceCwd:o}:{},...g?.workspaceId?{workspaceId:g.workspaceId}:{},...$!==void 0?{previewContent:$}:{}});return}l(O.id,$)},N=O=>{if(s){s({id:`scheduled-task:${O.toolCallId}`,kind:"scheduled_task",title:f("scheduledTasks.title"),turnId:e,task:g?.workspaceId?{...O,workspaceId:g.workspaceId}:O,...o?{workspaceCwd:o}:{},...g?.workspaceId?{workspaceId:g.workspaceId}:{}});return}c(O)};return(0,u.jsxs)("div",{className:_t.root,children:[t.length>0&&(0,u.jsxs)("div",{className:_t.card,children:[(0,u.jsxs)("div",{className:_t.summary,children:[(0,u.jsx)("span",{className:_t.icon,"aria-hidden":"true",children:(0,u.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",focusable:"false",className:_t.iconSvg,children:[(0,u.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),(0,u.jsx)("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,u.jsx)("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),(0,u.jsxs)("div",{className:[_t.reviewSummary,L?_t.reviewSummaryWithStats:""].filter(Boolean).join(" "),children:[(0,u.jsx)("div",{className:_t.title,children:f("turnOutputs.filesEdited",{count:t.length})}),(0,u.jsxs)("div",{className:_t.reviewMeta,children:[(0,u.jsx)(Oq,{additions:L?.additions,deletions:L?.deletions,className:_t.lineStats,additionsClassName:_t.additions,deletionsClassName:_t.deletions}),(0,u.jsxs)("button",{type:"button",className:_t.linkButton,onClick:()=>E(),children:[f("turnOutputs.viewChanges")," \u2197"]})]})]}),(0,u.jsx)("div",{className:_t.actions,children:(0,u.jsx)("button",{type:"button",className:_t.reviewButton,onClick:()=>E(),children:f("turnOutputs.review")})})]}),(0,u.jsxs)("div",{className:_t.list,children:[C.map(O=>(0,u.jsxs)("button",{type:"button",className:_t.fileRow,onClick:()=>E(O.path),title:O.path,children:[(0,u.jsx)("span",{className:_t.path,children:sLe(O.path,o)}),(0,u.jsx)(Oq,{additions:O.additions,deletions:O.deletions,className:_t.lineStats,additionsClassName:_t.additions,deletionsClassName:_t.deletions})]},`${O.toolCallId}:${O.path}`)),T>0&&(0,u.jsxs)("button",{type:"button",className:_t.showMoreButton,onClick:()=>v(O=>!O),children:[(0,u.jsx)("span",{children:b?f("turnOutputs.collapseFiles"):f("turnOutputs.showMoreFiles",{count:T})}),(0,u.jsx)($q,{open:b})]})]})]}),I.map(O=>{let $=rLe(O);return(0,u.jsx)(X_e,{artifact:O,externalUrl:$,onOpen:$||!Gj(O)?void 0:()=>R(O),onError:d,onDownload:nLe(O)&&h?z=>Hde(h,O.workspacePath,O.mimeType,z):void 0},O.id)}),S>0&&(0,u.jsxs)("button",{type:"button",className:_t.showMoreButton,onClick:()=>k(O=>!O),children:[(0,u.jsx)("span",{children:y?f("turnOutputs.collapseArtifacts"):f("turnOutputs.showMoreArtifacts",{count:S})}),(0,u.jsx)($q,{open:y})]}),r.map(O=>(0,u.jsx)(Y_e,{task:O,scheduleLabel:vU(O.cron,f),onOpen:()=>N(O)},O.toolCallId))]})}function X_e({artifact:e,externalUrl:t,onOpen:a,onDownload:n,onError:r}){let{t:o}=at(),s=ak(),[i,l]=(0,w.useState)(!1),c=(0,w.useRef)(!0);(0,w.useEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]);let d=Bde(e.sizeBytes),f=oLe(e,o),p=pU(e),m=async()=>{if(!(!n||i)){l(!0);try{await n(()=>!c.current)}catch(h){if(!c.current)return;let b=o("common.downloadFailed",{message:Db(h)});r?r(new Error(b,{cause:h}),b):console.error(b,h)}finally{l(!1)}}},g=(0,u.jsx)(ll,{size:16,strokeWidth:1.8,"aria-hidden":"true"});return(0,u.jsx)("div",{className:_t.card,children:(0,u.jsxs)("div",{className:_t.summary,children:[(0,u.jsx)("span",{className:_t.icon,"aria-hidden":"true",children:(0,u.jsx)(Vde,{artifact:e,className:_t.iconSvg})}),(0,u.jsxs)("div",{className:_t.artifactInfo,children:[(0,u.jsx)("div",{className:`${_t.title} ${_t.artifactTitle}`,children:p}),(0,u.jsx)("div",{className:_t.artifactMeta,children:[e.metadata?.artifactType==="web_preview_snapshot"?o("webPreview.saved"):$de(e),d,e.status==="changed"&&o("turnOutputs.artifactChanged")].filter(Boolean).join(" \xB7 ")})]}),(0,u.jsxs)("div",{className:_t.actions,children:[n&&(0,u.jsxs)("button",{type:"button",className:_t.reviewButton,onClick:()=>void m(),title:`${o("common.download")} ${p}`,disabled:i,children:[(0,u.jsx)(Dh,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),o(i?"common.downloading":"common.download")]}),(0,u.jsx)("span",{className:_t.openButtonWrapper,title:f??p,children:t?(0,u.jsxs)("a",{className:_t.reviewButton,href:t,target:"_blank",rel:"noopener noreferrer",onClick:h=>s(h,t),children:[g,o("common.open")]}):(0,u.jsxs)("button",{type:"button",className:_t.reviewButton,onClick:a,disabled:!a,children:[g,o("common.open")]})})]})]})})}function Y_e({task:e,scheduleLabel:t,onOpen:a}){let{t:n}=at();return(0,u.jsx)("div",{className:_t.card,children:(0,u.jsxs)("div",{className:_t.summary,children:[(0,u.jsx)("span",{className:_t.icon,"aria-hidden":"true",children:(0,u.jsx)(Q_e,{})}),(0,u.jsxs)("div",{className:_t.artifactInfo,children:[(0,u.jsx)("div",{className:_t.title,children:e.title}),(0,u.jsx)("div",{className:_t.artifactMeta,children:[t,e.recurring?n("scheduledTasks.repeats"):n("scheduledTasks.runsOnce")].filter(Boolean).join(" \xB7 ")})]}),(0,u.jsx)("div",{className:_t.actions,children:(0,u.jsx)("button",{type:"button",className:_t.reviewButton,onClick:a,title:e.title,children:n("common.open")})})]})})}function Q_e(){return(0,u.jsxs)("svg",{className:_t.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[(0,u.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),(0,u.jsx)("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function $q({open:e}){return(0,u.jsx)("svg",{className:[_t.chevronIcon,e?_t.chevronIconOpen:""].filter(Boolean).join(" "),viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:(0,u.jsx)("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}var Z_e=(0,w.memo)(K_e);function J_e(e,t,a){if(!tLe(e)||!e.workspacePath)return;let n=t.find(r=>jde(r.path,e.workspacePath,a));if(n)return eLe(n)}function eLe(e){for(let t=e.diffs.length-1;t>=0;t--){let a=e.diffs[t];if(a?.fullContent)return a.newText}}function tLe(e){let t=e.workspacePath?.toLowerCase()??"",a=e.mimeType?.toLowerCase()??"";return e.kind==="html"||aLe(t)||a==="text/html"||a==="text/markdown"}function aLe(e){let t=e.toLowerCase();return t.endsWith(".html")||t.endsWith(".htm")||t.endsWith(".md")||t.endsWith(".markdown")||h9(t)!==void 0}function nLe(e){return e.storage==="workspace"&&(e.status==="available"||e.status==="changed")&&!!e.workspacePath}function Gj(e){return e.storage!=="workspace"?!0:e.status==="available"||e.status==="changed"}function rLe(e){if(e.kind!=="link"||e.storage==="published")return;let t=e.url?.trim();return l7(t)?t:void 0}function oLe(e,t){if(!Gj(e))return e.workspacePath?t("turnOutputs.artifactUnavailable",{path:e.workspacePath}):t("turnOutputs.artifactMissing")}function sLe(e,t){return g9(e,t)}function iLe(e,t){let[a,n]=(0,w.useState)(!1);return(0,w.useLayoutEffect)(()=>{let r=e.current;if(!r||!t){n(!1);return}let o=r.closest("[data-history-viewport]")??r,s=()=>{let d=Number.parseFloat(getComputedStyle(r).getPropertyValue("--chat-regular-content-width"))||1e3;n(o.getBoundingClientRect().width>=d)};s();let i=typeof ResizeObserver>"u"?null:new ResizeObserver(s);i?.observe(o);let l=r.closest("[data-web-shell-root]"),c=new MutationObserver(s);return l&&c.observe(l,{attributes:!0,attributeFilter:["style"]}),()=>{i?.disconnect(),c.disconnect()}},[e,t]),a}var lLe="_collapseRow_d7f01_1",cLe="_collapseRowClickable_d7f01_14",uLe="_collapseLabel_d7f01_19",dLe="_processedLabel_d7f01_36",fLe="_processedMeta_d7f01_43",pLe="_hiddenMetrics_d7f01_47",mLe="_summaryMetrics_d7f01_51",hLe="_collapseIcon_d7f01_59",gLe="_chevronRight_d7f01_72",vLe="_chevronDown_d7f01_73",zs={collapseRow:lLe,collapseRowClickable:cLe,collapseLabel:uLe,processedLabel:dLe,processedMeta:fLe,hiddenMetrics:pLe,summaryMetrics:mLe,collapseIcon:hLe,chevronRight:gLe,chevronDown:vLe},yLe="_list_mrow6_1",wLe="_listWithWelcomeHeader_mrow6_12",bLe="_historyStatus_mrow6_32",kLe="_historyRetryButton_mrow6_38",xLe="_virtualSizer_mrow6_64",SLe="_virtualRow_mrow6_73",CLe="_loadingSkeleton_mrow6_83",TLe="_srOnly_mrow6_91",ILe="_loadingSkeletonUserRow_mrow6_103",_Le="_loadingSkeletonAssistantRow_mrow6_109",LLe="_loadingSkeletonUserBubble_mrow6_115",ALe="_loadingSkeletonUserBubbleCompact_mrow6_116",RLe="_loadingSkeletonAssistantBlock_mrow6_130",ELe="_loadingSkeletonLineWide_mrow6_138",MLe="_loadingSkeletonLineMedium_mrow6_139",NLe="_loadingSkeletonLineShort_mrow6_140",PLe="_loadingSkeletonLineNarrow_mrow6_141",OLe="_turnStatusRow_mrow6_181",DLe="_turnAnswerRow_mrow6_182",$Le="_turnContentRow_mrow6_193",BLe="_sessionTimelineLayer_mrow6_197",FLe="_sessionTimelinePanel_mrow6_210",zLe="_sessionTimelineViewport_mrow6_226",qLe="_sessionTimelineList_mrow6_275",ULe="_sessionTimelineItem_mrow6_285",HLe="_sessionTimelineButton_mrow6_290",jLe="_sessionTimelineTick_mrow6_310",WLe="_sessionTimelineButtonInRange_mrow6_400",GLe="_sessionTimelineButtonCurrent_mrow6_404",VLe="_sessionTimelineDetails_mrow6_415",KLe="_sessionTimelineDetailsTitle_mrow6_453",XLe="_sessionTimelineDetailsIcon_mrow6_460",YLe="_sessionTimelineDetailsTitleText_mrow6_472",QLe="_sessionTimelineDetailsDetail_mrow6_482",ZLe="_deletionMode_mrow6_501",JLe="_deletionCheckbox_mrow6_507",Et={list:yLe,listWithWelcomeHeader:wLe,historyStatus:bLe,historyRetryButton:kLe,virtualSizer:xLe,virtualRow:SLe,loadingSkeleton:CLe,srOnly:TLe,loadingSkeletonUserRow:ILe,loadingSkeletonAssistantRow:_Le,loadingSkeletonUserBubble:LLe,loadingSkeletonUserBubbleCompact:ALe,loadingSkeletonAssistantBlock:RLe,loadingSkeletonLineWide:ELe,loadingSkeletonLineMedium:MLe,loadingSkeletonLineShort:NLe,loadingSkeletonLineNarrow:PLe,turnStatusRow:OLe,turnAnswerRow:DLe,turnContentRow:$Le,sessionTimelineLayer:BLe,sessionTimelinePanel:FLe,sessionTimelineViewport:zLe,sessionTimelineList:qLe,sessionTimelineItem:ULe,sessionTimelineButton:HLe,sessionTimelineTick:jLe,sessionTimelineButtonInRange:WLe,sessionTimelineButtonCurrent:GLe,sessionTimelineDetails:VLe,sessionTimelineDetailsTitle:KLe,sessionTimelineDetailsIcon:XLe,sessionTimelineDetailsTitleText:YLe,sessionTimelineDetailsDetail:QLe,deletionMode:ZLe,deletionCheckbox:JLe},t9=()=>{},eAe=15e3,a9=180,tAe=400,Bq=5e3;function aAe(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 Fq(e,t){return e.length===t.length&&e.every((a,n)=>Object.is(a,t[n]))}function nAe(e){for(let t=e.length-1;t>=0;t--){let a=e[t];if(a?.role==="user")return a.id}return null}function rAe(e){return e[e.length-1]}function oAe(e){for(let t=e.length-1;t>=0;t--){let a=e[t];if(a&&oo(a))return a.id}return null}function sAe(e,t){return e.role!=="tool_group"?!1:!!(t?.toolCallId&&e.tools.some(a=>Hs(a,t.toolCallId)))}function Y9(e){return p7(e)||!!xg(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(Y9)){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)Y9(i)?(s(r),r=[],s([i])):r.push(i);s(r)}return a?t:e}function iAe(e,t){let a=[],n=0,r=o=>o.role==="tool_group"&&!sAe(o,t)&&!o.tools.some(Y9);for(;n<e.length;){let o=e[n];if(o.role!=="thinking"&&!r(o)){a.push(o),n++;continue}let s=[],i=n-1,l=n;for(;l<e.length;){let p=e[l];if(p.role==="thinking"||r(p)){s.push(p),i=l,l++;continue}break}let c=s.filter(p=>p.role==="tool_group").flatMap(p=>p.tools);if(c.length===0||s.length<=1||s.length>=2&&s.every(u9)){for(let p of s)a.push(p);n=i+1;continue}let d=[],f=[];for(let p of s)if(p.role==="thinking"){let m={content:p.content,...p.isStreaming===!0?{isStreaming:!0}:{}};d.push(m),f.push(m)}else if(p.role==="tool_group"&&p.tools.length>0){let m=p.tools[0].callId;for(let g of f)g.beforeToolCallId=m;f.length=0}a.push({id:hg(s[0].id),role:"tool_group",tools:c,...d.length>0?{thoughts:d}:{},timestamp:s[0].timestamp}),n=i+1}return a}function lAe(e,t){let a=e[e.length-1];if(a?.role!=="tool_group"||gg(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===hg(t.id)?{timestamp:t.timestamp}:{}},o}function cAe(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 qq(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 Uq(e,t){let a=e.get(t);if(a!==void 0)return a;let n=cAe(t);return e.set(t,n),n}function Vj(e){return kue(HAe(e))}function Ib(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 uAe(e,t,a,n,r){if((!a||a.size===0)&&(!n||n.size===0)&&(!r||r.size===0))return e;let o=[],s=null,i=(l,c)=>{if(c&&t||!l)return;let d=a?.get(l)??[],f=n?.get(l)??[],p=r?.get(l)??[];if(d.length===0&&f.length===0&&p.length===0)return;let m=o.length;for(let g=o.length-1;g>=0;g-=1){let h=o[g];if(h.type!=="message"||h.message.role!=="system")break;h.message.source==="recap"&&(m=g)}o.splice(m,0,{type:"turn_outputs",key:l,turnId:l,changes:d,artifacts:f,scheduledTasks:p})};for(let l of e)l.type==="message"&&oo(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 dAe(e,t){let a=s=>s.type==="parallel_agents"&&(t?.has(s.key)===!0||s.agents.some(i=>tn(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"&&oo(s.message)?(o(),n.push(s)):a(s)?r.push(s):n.push(s);return o(),n}function Kj(e){return e.type==="message"&&e.message.role==="assistant"&&e.message.agentMessage?.kind==="agent_message"}function Xj(e,t){return e.type==="message"&&!Kj(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 gk(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(_Ae(s))r=!0;else if(!r&&Xj(s,n))return o}return-1}function fAe(e,{isResponding:t,latestTurnAwaitsAgentSummary:a,gateBackgroundAgentStatus:n}){let r=[];for(let s=0;s<e.length;s++){let i=e[s];i.type==="message"&&oo(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&&Jj(e,i,l))continue;let c=e[i],d=gk(e,i,l,!1);if(d<0)continue;let f=e[d];c?.type==="message"&&f.type==="message"&&f.message.role==="assistant"&&o.set(f.message.id,c.message.id)}return o}function Hq(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(p7);case"plan":return!0;case"assistant":return!t&&!Kj(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 Yj(e){return e.source==="mid_turn_message_injected"}function pAe(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}:jd(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 Yj(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 jd(e,t,a={}){let n=(a.stripMarkdown===!0?mAe(e):e??"").replace(/\s+/g," ").trim();if(t<=0||!n)return"";let r=Array.from(n);return r.length>t?`${r.slice(0,t-1).join("")}\u2026`:n}function mAe(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=n9(n,"~~"),n=n9(n,"**"),n=n9(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 n9(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 hAe(e,t){let a=e.role==="user"?e.content:e.role==="user_shell"?e.command:"";return jd(a,32)||(t?t("timeline.userTurn"):"User turn")}function gAe(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function oo(e){return e.role==="user"||e.role==="user_shell"}function vAe(e,t){if(!t.startsWith("msg:"))return;let a=t.slice(4);a=gg(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&&oo(o))return o.id}return}}function yAe(e,t){for(let a of e)if(a.type==="turn_collapse"&&a.turnCollapse.turnId===t)return a.turnCollapse.collapsed;return!1}function wAe(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return jd(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 Yj(e)?jd(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 bAe(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"?"":wAe(e.message,t)}function kAe(e,t){return t?t(`timeline.kind.${e}`):nRe[e]}function xAe(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=jd(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=bAe(i,n);l&&r.push(l)}return jd(r.join(" \xB7 "),180)||(a.length>0?a.map(s=>kAe(s,n)).join(" \xB7 "):n?n("timeline.noActivity"):"No activity")}function SAe(e,t){let a=[],n=null,r=[],o=()=>{if(!n)return;let s=Vj(r),i=gk(s,-1,s.length-1,!1),l=i>=0?s[i]:null,c=l?.type==="message"&&l.message.role==="assistant"&&!l.message.isStreaming&&jd(l.message.content,1,{stripMarkdown:!0}).length>0?l.message.id:null,d=[];for(let f of s){if(f.type==="message"&&c!==null&&f.message.id===c)continue;let p=pAe(f,t);p.kind!=="none"&&!d.includes(p.kind)&&d.push(p.kind)}a.push({id:n.id,label:hAe(n,t),detail:xAe(s,c,d,t),timestamp:n.timestamp,nodeKinds:d,...gAe(n)?{isScheduledTask:!0}:{}})};for(let s of e){if(oo(s)){o(),n=s,r=[];continue}n&&r.push(s)}return o(),a}function CAe(){return(0,u.jsxs)("svg",{className:Et.sessionTimelineDetailsIcon,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,u.jsx)("circle",{cx:"8",cy:"8",r:"6.25"}),(0,u.jsx)("path",{d:"M8 4.5v4l-2.5 2"})]})}function TAe(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 IAe(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(TAe).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 _Ae(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 LAe(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=>tn(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=>tn(a.status));return t.length===0?null:`tools:${e.message.id}:${t.map(a=>a.callId).join(",")}`}function AAe(e){for(let t=e.length-1;t>=0;t--){let a=LAe(e[t]);if(a)return a}return null}function RAe(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 MAe(e){if(!(e.type!=="message"||e.message.role!=="assistant"))return e.message.content?.trim()?e.message.timestamp:void 0}function NAe(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function r9(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function jq(e){if(e.parentToolCallId||!hr(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=r9(a?.inputTokens),r=r9(a?.outputTokens);if(n===void 0&&r===void 0)return;let o=r9(a?.cachedTokens);return{callId:e.callId,usage:{inputTokens:n??0,outputTokens:r??0,...o!==void 0?{cachedTokens:o}:{}}}}function PAe(e){return e.type==="parallel_agents"?e.agents.flatMap(t=>jq(t)??[]):e.type!=="message"||e.message.role!=="tool_group"?[]:e.message.tools.flatMap(t=>jq(t)??[])}function OAe(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=>!zo(t.toolName)).length:0}function Qj(e,t){for(let a=Math.min(t,e.length-1);a>=0;a--){let n=e[a];if(n.type==="message"&&oo(n.message))return n.message.id}return null}function Zj(e){let t=[],a=null;for(let n of e)n.type==="message"&&oo(n.message)&&(a=n.message.id),t.push(a);return t}function Wq(e,t,a,n){let r=n===void 0?Qj(e,t):n[t]??null;return r?a.get(r)??null:null}function DAe(e,t,a,n,r=Zj(e)){let o=Number.POSITIVE_INFINITY,s=-1;for(let l of t){if(l<0||l>=e.length)continue;let c=Wq(e,l,a,r);c!==null&&(o=Math.min(o,c),s=Math.max(s,c))}if(s<0)return null;let i=n==null?null:Wq(e,n,a,r);return{startIndex:o,endIndex:s,currentIndex:i!==null&&i>=o&&i<=s?i:s}}function Fg(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 $Ae(e,t,a,n){return n?Fg(e,t,a,r=>Hs(r,n)):!1}function BAe(e,t,a){return Fg(e,t,a,n=>hr(n)&&tn(n.status))}function FAe(e,t,a){return Fg(e,t,a,n=>xg(n.rawOutput)!==void 0)}function zAe(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 qAe(e,t,a,n){return Fg(e,t,a,r=>{let o=bue(r);return o!==void 0&&!n.has(o)})}function Jj(e,t,a){return Fg(e,t,a,n=>Us(n)&&tn(n.status))}function UAe(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 o9(e){return e.type==="parallel_agents"?e.agents.filter(t=>Us(t)&&t.status!=="failed").map(t=>t.callId):e.type==="message"&&e.message.role==="tool_group"?e.message.tools.filter(t=>Us(t)&&t.status!=="failed").map(t=>t.callId):[]}function eW(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":aU(o)?o:void 0;return s?{...typeof r=="string"?{callId:r}:{},status:s,...e.timestamp!==void 0?{endTime:e.timestamp}:{}}:null}function Q9(e){return e.type==="message"?eW(e.message):null}function HAe(e){let t=new Map;for(let r of e){let o=eW(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||!Us(i)||!tn(i.status))return i;let c=nU(i,l.status,l.endTime);return c===i?i:(o=!0,c)});return o?(a=!0,{...r,tools:s}):r});return a?n:e}function tW(e,t,a,n){let r=-1,o;for(let c=a;c>t;c--){let d=e[c];if(!(d.type!=="message"||d.message.role!=="system")){if(d.message.source==="turn_error"||d.message.source==="prompt_cancelled"){if(r<0)return null;continue}if(d.message.source==="background_notification"){let f=Q9(d);if(n&&!f)continue;r<0&&(r=c,o=f?.callId)}}}if(r<0)return null;let s=-1;if(o){for(let c=a;c>=0;c--)if(o9(e[c]).includes(o)){s=c;break}}for(let c=a;c>=t&&!(s>=0);c--)if(o9(e[c]).length>0){s=c;break}let i=new Set,l=!1;if(s>=0){let c=s;for(let f=s;f>=0;f--){let p=e[f];if(p.type==="message"&&oo(p.message)){c=f;break}}let d=[];for(let f=c;f<=a;f++){let p=e[f];for(let g of o9(p))i.add(g);let m=Q9(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 Z9(e,t,a,n=!1,r=!0,o=!0){let s=tW(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&&gk(e,t,a,!1)<s.lastNotificationIndex}function jAe(e,{overrides:t,isResponding:a,activeTurnStartedAt:n,backgroundSummaryGraceActive:r=!0,waitForUnmatchedAgentCompletions:o=!0,waitForOrderedNarration:s=!0,terminalBackgroundShellTaskIds:i,automaticallyExpandedAgentKeys:l,pendingApprovalCallId:c,includeSubagentToolUsageInMetrics:d=!0,paginatedExpanded:f,enabled:p}){if(!p||e.length===0)return e;let m=[];for(let b=0;b<e.length;b++){let v=e[b];v.type==="message"&&oo(v.message)&&m.push(b)}if(m.length===0)return e;let g=zAe(e,i),h=[];for(let b=0;b<m[0];b++)h.push(e[b]);for(let b=0;b<m.length;b++){let v=m[b],y=(b+1<m.length?m[b+1]:e.length)-1,k=e[v],C=k.message.id,T=k.message.timestamp,I=b===m.length-1,S=I&&a,L=BAe(e,v,y),E=FAe(e,v,y),R=qAe(e,v,y,g),N=UAe(e,v,y,l),O=I&&r&&Z9(e,v,y,!1,o,s),$=$Ae(e,v,y,c),z=gk(e,v,y),H=z;if(z>=0&&Xj(e[z],!1)){let ve=!1;for(let K=z-1;K>v;K--){let Se=e[K];if(Se.type!=="message")break;if(Se.message.role==="system"&&Se.message.source==="background_task_completed")ve=!0;else if(ve&&Se.message.role==="assistant")H=K,ve=!1;else break}}let G=0,J,Q,W,A=0,U=0,Y=0,P=0,ae=0,le=!1,Te=new Set,q=!1;for(let ve=v+1;ve<=y;ve++){let K=e[ve];if(Hq(K,ve>=H&&ve<=z)&&G++,EAe(K)&&(q=!0),P+=OAe(K),K.type==="message"&&K.message.role==="thinking"?ae++:K.type==="message"&&K.message.role==="tool_group"&&K.message.thoughts&&(ae+=K.message.thoughts.length),K.type==="message"&&K.message.role==="system"&&K.message.source==="prompt_cancelled"){let ut=K.message.data,qt=ut&&typeof ut=="object"&&"elapsedMs"in ut?ut.elapsedMs:void 0;typeof qt=="number"&&Number.isFinite(qt)&&qt>=0&&(Q=qt)}let Se=RAe(K);Se!==void 0&&(J=J===void 0?Se:Math.max(J,Se));let Le=MAe(K);Le!==void 0&&(W=W===void 0?Le:Math.max(W,Le));let Ye=NAe(K);if(Ye&&(A+=Ye.inputTokens,U+=Ye.outputTokens,Y+=Ye.cachedTokens??0,le=!0),d)for(let ut of PAe(K))Te.has(ut.callId)||(Te.add(ut.callId),A+=ut.usage.inputTokens,U+=ut.usage.outputTokens,Y+=ut.usage.cachedTokens??0,le=!0)}let ne=S||O?n??T??Date.now():void 0,ie=J??W,te=Q??(T!==void 0&&ie!==void 0&&ie>=T?ie-T:void 0);if($||G===0&&!(le||te!==void 0||ne!==void 0)){for(let ve=v;ve<=y;ve++)h.push(e[ve]);continue}let me=S||L||E||R||N||O||(q||z<0)&&I,xe=!(G===0||(t.has(C)?t.get(C):f?.has(C)||me));h.push({type:"message",key:k.key,message:k.message});let Fe={turnId:C,collapsed:xe,hiddenCount:G,...te!==void 0?{elapsedMs:te}:{},...le?{inputTokens:A,outputTokens:U}:{},...Y>0?{cachedTokens:Y}:{},...P>0?{toolCallCount:P}:{},...ae>0?{thinkingCount:ae}:{},...ne!==void 0?{liveStartedAt:ne}:{}};if(h.push({type:"turn_collapse",key:`tc-${C}`,turnCollapse:Fe}),!xe){for(let ve=v+1;ve<=y;ve++){let K=e[ve];ve===z&&K.type==="message"&&K.message.role==="assistant"?h.push({...K,turnCollapse:Fe}):h.push(K)}continue}for(let ve=v+1;ve<=y;ve++){let K=e[ve];if(!(ve===z&&S)){if(ve===z&&K.type==="message"&&K.message.role==="assistant"){h.push({...K,turnCollapse:Fe});continue}Hq(K,ve>=H&&ve<=z)||h.push(K)}}}return h}function _b(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=>Hs(o,a))||r.type==="parallel_agents"&&r.agents.some(o=>Hs(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 Gq(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=>Hs(n,a)):e.message.id===t.messageId:e.type==="parallel_agents"?!!a&&e.agents.some(n=>Hs(n,a)):(e.type,!1)}function Vq(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=>Hs(r,n.callId))):a.id===(e.type==="turn_outputs"?e.turnId:e.turnCollapse.turnId)).flatMap(a=>a.sourceBlockIds??[]).join(",")||void 0:void 0}var s9=0,WAe=120,GAe=80,VAe=32,KAe=240,Lb=30,i9=160,Kq=30,aW=200;function XAe(e,t=aW){return e>t}function YAe(e,t){return e<=t}function QAe(e){let t=Math.max(0,Math.ceil(e/1e3));if(t<60)return`${t}s`;let a=Math.floor(t/60),n=t-a*60;return`${a}m ${n}s`}function ZAe(e){return e!==void 0&&e>=0?QAe(e):""}function JAe(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";let a=e.cachedTokens??0,n=a>0&&e.inputTokens>0?` (${Vn(a)} ${t("turn.cached")}, ${Math.round(a/e.inputTokens*100)}%)`:"";return`\u2191${Vn(e.inputTokens)}${n} \u2193${Vn(e.outputTokens)}`}function Xq(e,t){let a=[],n=JAe(e,t);return n&&a.push(n),e.toolCallCount!==void 0&&e.toolCallCount>0&&a.push(t("turn.toolCalls",{count:e.toolCallCount})),e.thinkingCount!==void 0&&e.thinkingCount>0&&a.push(t("turn.thinkingCount",{count:e.thinkingCount})),a.join(" \xB7 ")}function eRe(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}function nW(e){return e.hiddenCount>0||e.liveStartedAt!==void 0||eRe(e)}var tRe=(0,w.memo)(function({turnCollapse:e,onToggleCollapse:t}){let{t:a}=at(),n=e.hiddenCount>0,r=e.liveStartedAt,o=nW(e),s=ck(r!==void 0&&o),i=(0,w.useRef)(0),l=(0,w.useRef)(r);l.current!==r&&(l.current=r,i.current=0);let c;r!==void 0&&o?(i.current=Math.max(i.current,Math.max(0,s-r)),c=i.current):o&&e.elapsedMs!==void 0?(i.current=0,c=e.elapsedMs):(i.current=0,c=void 0);let d=ZAe(c),f=Xq(e,a),p=Xq(e,a),m=a(r!==void 0?"turn.processing":"turn.processed"),g=!!d&&o,h=!!f&&o,b=!!p&&o;if(!o)return null;let v=()=>{if(!n)return;let y=e.collapsed;t(e.turnId,y)};return(0,u.jsxs)("div",{className:n?`${zs.collapseRow} ${zs.collapseRowClickable}`:zs.collapseRow,role:n?"button":void 0,tabIndex:n?0:void 0,"aria-expanded":n?!e.collapsed:void 0,"aria-label":n?e.collapsed?a("turn.expand"):a("turn.collapse"):void 0,title:n?e.collapsed?a("turn.expand"):a("turn.collapse"):void 0,onClick:n?v:void 0,onKeyDown:n?y=>{y.key!=="Enter"&&y.key!==" "||(y.preventDefault(),v())}:void 0,children:[(0,u.jsxs)("span",{className:zs.collapseLabel,children:[(0,u.jsxs)("span",{className:zs.processedLabel,children:[m,g&&(0,u.jsxs)("span",{className:zs.processedMeta,children:[" ",d]})]}),b&&(0,u.jsx)("span",{className:zs.summaryMetrics,children:p}),h&&(0,u.jsx)("span",{className:zs.hiddenMetrics,children:f})]}),n&&(0,u.jsx)("span",{"data-testid":`toggle-${e.turnId}`,className:zs.collapseIcon,onClick:y=>{y.stopPropagation(),v()},children:(0,u.jsx)("span",{className:e.collapsed?zs.chevronRight:zs.chevronDown,"aria-hidden":"true"})})]})});function aRe(e){if(e.type==="turn_collapse")return Et.turnStatusRow;if(e.type==="turn_outputs")return Et.turnContentRow;if(e.type==="message"&&e.turnCollapse)return Et.turnAnswerRow}var nRe={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},rRe=["--background","--foreground","--muted-foreground","--border","--font-sans"],Yq="session-timeline-detail-tooltip",oRe=(0,w.memo)(function({entries:e,currentTurnId:t,currentRange:a,hidden:n,onSelect:r,action:o}){let s=Wd(),{t:i}=at(),l=(0,w.useRef)(null),c=(0,w.useRef)(null),d=(0,w.useRef)(null),f=(0,w.useRef)(!1),p=(0,w.useRef)(!1),m=(0,w.useRef)(null),g=(0,w.useRef)(null),[h,b]=(0,w.useState)(null),v=a!==null?a.currentIndex:e.findIndex(R=>R.id===t),y=(0,w.useCallback)(()=>b(null),[]),k=(0,w.useCallback)(()=>{f.current||p.current||y()},[y]),C=(0,w.useCallback)((R,N)=>{let O=l.current;if(!O)return null;let $=getComputedStyle(O),z=N.getBoundingClientRect();return{entry:R,top:z.top+z.height/2,left:z.right+8,clamped:!1,themeVars:Object.fromEntries(rRe.map(H=>[H,$.getPropertyValue(H)]))}},[]),T=(0,w.useCallback)(R=>{let N=c.current;return N?Array.from(N.querySelectorAll('[data-testid="session-timeline-entry"]')).find(O=>O.getAttribute("data-turn-id")===R.id)?.querySelector("button")??null:null},[]),I=(0,w.useCallback)(R=>{let N=c.current;if(!N)return!1;let O=N.getBoundingClientRect(),$=R.getBoundingClientRect();return $.bottom>=O.top&&$.top<=O.bottom},[]),S=(0,w.useCallback)(()=>{b(R=>{if(!R)return null;let N=T(R.entry);return!N||!I(N)?null:C(R.entry,N)})},[C,T,I]),L=(0,w.useCallback)((R,N)=>{b(C(R,N))},[C]),E=(0,w.useCallback)(()=>{typeof window>"u"||(m.current!==null&&window.cancelAnimationFrame(m.current),g.current!==null&&window.clearTimeout(g.current),p.current=!0,m.current=window.requestAnimationFrame(()=>{m.current=null,p.current=!1,S()}),g.current=window.setTimeout(()=>{g.current=null,p.current=!1},100))},[S]);return(0,w.useLayoutEffect)(()=>{if(n)return;let R=c.current;if(!R||v<0)return;let N=R.querySelector(`[data-timeline-index="${v}"]`);if(!N)return;let O=N.offsetTop+N.offsetHeight/2,$=R.scrollHeight-R.clientHeight,z=Math.max(0,Math.min(O-R.clientHeight/2,$));if(R.scrollTop===z)return;f.current=!0,R.scrollTop=z;let H=window.requestAnimationFrame(()=>{f.current=!1,S()}),G=window.setTimeout(()=>{f.current=!1},100);return()=>{window.cancelAnimationFrame(H),window.clearTimeout(G),f.current=!1}},[v,n,S]),(0,w.useLayoutEffect)(()=>{if(!(!h||typeof window>"u"))return window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)}},[S,h]),(0,w.useLayoutEffect)(()=>()=>{m.current!==null&&window.cancelAnimationFrame(m.current),g.current!==null&&window.clearTimeout(g.current),p.current=!1},[]),(0,w.useLayoutEffect)(()=>{if(!h||h.clamped)return;let R=l.current,N=d.current;if(!R||!N||typeof window>"u")return;let O=N.getBoundingClientRect(),$=12,z=h.top;O.top<$?z+=$-O.top:O.bottom>window.innerHeight-$&&(z-=O.bottom-(window.innerHeight-$)),z!==h.top&&b(H=>H?.entry.id===h.entry.id?{...H,top:z,clamped:!0}:H)},[h]),n||e.length===0?null:(0,u.jsx)("div",{className:Et.sessionTimelineLayer,"aria-hidden":"false",children:(0,u.jsxs)("nav",{ref:l,className:Et.sessionTimelinePanel,"aria-label":i("timeline.sessionTimeline"),"data-testid":"session-timeline",onMouseLeave:y,children:[(0,u.jsx)("div",{ref:c,className:Et.sessionTimelineViewport,"data-testid":"session-timeline-viewport",onScroll:k,children:(0,u.jsx)("ol",{className:Et.sessionTimelineList,children:e.map((R,N)=>{let O=a!==null&&N>=a.startIndex&&N<=a.endIndex,$=a!==null?N===a.currentIndex:R.id===t,z=R.nodeKinds.join(","),H=[`${i("timeline.turnPrefix",{index:N+1})}: ${R.label}`,$?i("timeline.currentTurn"):null].filter(Boolean).join(". "),G=W=>L(R,W.currentTarget),J=W=>{E(),L(R,W.currentTarget)},Q=h?.entry.id===R.id;return(0,u.jsx)("li",{className:Et.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":R.id,"data-timeline-index":N,"data-node-kinds":z,"data-in-current-range":O?"true":void 0,children:(0,u.jsx)("button",{type:"button",className:J9(Et.sessionTimelineButton,O?Et.sessionTimelineButtonInRange:void 0,$?Et.sessionTimelineButtonCurrent:void 0),"aria-current":$?"step":void 0,"aria-describedby":Q?Yq:void 0,"aria-label":H,onClick:()=>r(R.id),onFocus:J,onBlur:y,onMouseEnter:G,onMouseLeave:y,children:(0,u.jsx)("span",{className:Et.sessionTimelineTick})})},R.id)})})}),o,h&&typeof document<"u"&&(0,Sg.createPortal)((0,u.jsxs)("div",{ref:d,className:Et.sessionTimelineDetails,id:Yq,"data-testid":"session-timeline-detail","data-title":h.entry.label,"data-detail":h.entry.detail,"data-scheduled-task":h.entry.isScheduledTask?"true":void 0,role:"tooltip",style:{...h.themeVars,top:h.top,left:h.left},children:[(0,u.jsxs)("span",{className:Et.sessionTimelineDetailsTitle,children:[h.entry.isScheduledTask&&(0,u.jsx)(CAe,{}),(0,u.jsx)("span",{className:Et.sessionTimelineDetailsTitleText,children:h.entry.label})]}),(0,u.jsx)("span",{className:Et.sessionTimelineDetailsDetail,children:h.entry.detail})]}),s??document.body)]})})});function J9(...e){return e.filter(Boolean).join(" ")||void 0}var sRe=[];function iRe({label:e}){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{role:"status","aria-live":"polite",className:Et.srOnly,children:e}),(0,u.jsxs)("div",{className:Et.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[(0,u.jsx)("div",{className:Et.loadingSkeletonUserRow,children:(0,u.jsxs)("div",{className:Et.loadingSkeletonUserBubble,children:[(0,u.jsx)("span",{className:Et.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Et.loadingSkeletonLineShort})]})}),(0,u.jsx)("div",{className:Et.loadingSkeletonAssistantRow,children:(0,u.jsxs)("div",{className:Et.loadingSkeletonAssistantBlock,children:[(0,u.jsx)("span",{className:Et.loadingSkeletonLineMedium}),(0,u.jsx)("span",{className:Et.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Et.loadingSkeletonLineNarrow})]})}),(0,u.jsx)("div",{className:Et.loadingSkeletonUserRow,children:(0,u.jsx)("div",{className:Et.loadingSkeletonUserBubbleCompact,children:(0,u.jsx)("span",{className:Et.loadingSkeletonLineMedium})})}),(0,u.jsx)("div",{className:Et.loadingSkeletonAssistantRow,children:(0,u.jsxs)("div",{className:Et.loadingSkeletonAssistantBlock,children:[(0,u.jsx)("span",{className:Et.loadingSkeletonLineWide}),(0,u.jsx)("span",{className:Et.loadingSkeletonLineMedium})]})})]})]})}var lRe=(0,w.memo)((0,w.forwardRef)(function({messages:e,deletion:t,frozenViewport:a=!1,sessionKey:n,terminalBackgroundShellTaskIds:r,pendingApproval:o,onShowContextDetail:s,onImagePreview:i,onAttachmentPreview:l,onInsightReportOpen:c,onEditUserMessage:d,onSubmitUserMessageEdit:f,loadingTranscript:p,catchingUp:m,hasOlderHistory:g=!1,loadingOlderHistory:h=!1,historyCapacityReached:b=!1,historyPaginationError:v=!1,onLoadOlderHistory:y,transcriptBlockCount:k=0,transcriptActivity:C,onReloadTranscript:T,isResponding:I=!1,transcriptReloadPaused:S=I,activeTurnStartedAt:L,welcomeHeader:E,centerWelcomeHeader:R=!1,workspaceCwd:N,tailContent:O,tailKey:$="tail",virtualScrollThreshold:z=aW,autoScrollTailIntoView:H=!1,bottomOverlayInset:G=0,hideSessionTimeline:J=!1,timelineAction:Q,hideFirstUserMessage:W=!1,firstTurnMetrics:A,includeSubagentToolUsageInMetrics:U=!0,showRetryHint:Y=!1,onRetryClick:P,failedPromptMessageId:ae,onRetryFailedPrompt:le,onBranchSession:Te,onCanScrollToBottomChange:q,turnFileChanges:ne,turnArtifacts:ie,sourceEntries:te,sourceSessionId:me,mcpAppSessionId:xe=me,onSourceOpen:Fe,turnScheduledTasks:ve,onReviewChanges:K,onOpenArtifact:Se,onOpenScheduledTask:Le,onTurnOutputOpen:Ye,onToolResultOpen:ut,onError:qt,generateContent:ua},ye){let qe=(0,w.useRef)(a);qe.current=a;let{t:ue}=at(),Oe=Na(),X=(0,w.useContext)(e7),fe=(0,w.useMemo)(()=>{let F=new Map,ee,we=0;for(let Ae of e)Ae.role==="user"&&(F.set(Ae.id,we),ee=Ae.id,we+=1);return{lastId:ee,turnIndexById:F}},[e]),ke=(0,w.useMemo)(()=>{if(!a)return;let F=[...fe.turnIndexById.keys()];return new Set(F.filter((ee,we)=>we===0||we===F.length-1))},[fe,a]),Ve=(0,w.useRef)(void 0),Xe=aAe(Ve.current,e);(0,w.useLayoutEffect)(()=>{Ve.current=e},[e]);let kt=(0,w.useRef)(void 0),Xt=(0,w.useRef)(void 0),nt=(0,w.useRef)(void 0),Lt=(0,w.useRef)(void 0),et=(0,w.useMemo)(()=>{let F=kt.current,ee=e[e.length-1],we;if(Xe&&F?.sourceMessages===Ve.current&&F?.compactMode===X&&F.pendingApproval===o&&(ee?.role==="assistant"&&F.value[F.value.length-1]?.id===ee.id?(we=F.value.slice(),we[we.length-1]=ee):ee?.role==="thinking"&&(we=X?lAe(F.value,ee):zq(e))),!we){let it=zq(e);we=X?iAe(it,o):it}kt.current={sourceMessages:e,compactMode:X,pendingApproval:o,value:we};let Ae=Lt.current??=new WeakMap,pe=Xt.current,bt=pe!==void 0&&pe.sessionKey===n?pe.ids:void 0;if(I){if(nt.current=void 0,!bt?.size)return we;let it,Ot=!1,ft=we.map(_a=>{let xa=gg(_a.id);if(xa!==void 0){let r1=bt.get(xa);r1!==void 0&&(it??=new Map).set(xa,r1)}let Mn=bt.get(hg(_a.id));Mn!==void 0&&(it??=new Map).set(hg(_a.id),Mn);let ws=bt.get(_a.id);return ws===void 0||qq(_a)!==ws?_a:((it??=new Map).set(_a.id,ws),Ot=!0,Uq(Ae,_a))});return(it?.size??0)!==bt.size&&(nt.current={sessionKey:n,ids:it??new Map}),Ot?ft:we}let Ut,la=we.map(it=>{let Ot=Uq(Ae,it);if(Ot!==it){let ft=qq(it);if(ft!==void 0){(Ut??=new Map).set(it.id,ft);let _a=gg(it.id),xa=it.role==="tool_group"?it.thoughts?.[0]?.content:void 0;_a!==void 0&&xa!==void 0&&Ut.set(_a,xa),it.role==="thinking"&&Ut.set(hg(it.id),JSON.stringify([it.content]))}}return Ot});return Ut?(nt.current={sessionKey:n,ids:new Map([...bt??[],...Ut])},la):we},[X,I,e,o,n,Xe]);(0,w.useLayoutEffect)(()=>{let F=nt.current;F&&(Xt.current=F,nt.current=void 0)},[et]);let Gt=(0,w.useRef)(void 0),Ue=(0,w.useMemo)(()=>{let F=Gt.current,ee=et[et.length-1],we;if(Xe&&I&&F?.sourceMessages===Ve.current&&F?.compactMode===X&&F.pendingApproval===o&&F.isResponding===I&&F.turnFileChanges===ne&&F.turnArtifacts===ie&&F.turnScheduledTasks===ve){let Ae=F.value[F.value.length-1];Ae?.type==="message"&&Ae.message.id===ee.id&&(we=F.value.slice(),we[we.length-1]={...Ae,message:ee})}return we??=uAe(Vj(et),I,ne,ie,ve),Gt.current={sourceMessages:e,compactMode:X,pendingApproval:o,isResponding:I,turnFileChanges:ne,turnArtifacts:ie,turnScheduledTasks:ve,value:we},we},[et,e,Xe,X,o,I,ne,ie,ve]),Vt=(0,w.useMemo)(()=>{for(let F=et.length-1;F>=0;F-=1){let ee=et[F];if(ee?.role==="system"&&ee.source==="background_notification")return ee.id}return null},[et]),[Rr,sr]=(0,w.useState)(Vt),jo=!!(p||m),Ft=(0,w.useRef)(jo),jr=(0,w.useRef)(et.length>0),Ba=!jr.current&&et.length>0,on=jo||Ft.current||Ba;(0,w.useLayoutEffect)(()=>{on&&sr(Vt),et.length>0&&(jr.current=!0),Ft.current=jo},[on,Vt,jo,et.length]);let Fa=!on&&Vt!==null&&Rr!==Vt,sa=(0,w.useMemo)(()=>{for(let F=Ue.length-1;F>=0;F-=1){let ee=Ue[F];if(ee.type==="message"&&oo(ee.message))return F}return 0},[Ue]),so=Oe==="interactive",sn=(0,w.useMemo)(()=>so&&Jj(Ue,sa,Ue.length-1),[Ue,so,sa]),In=(0,w.useMemo)(()=>tW(Ue,sa,Ue.length-1,!0),[Ue,sa]),gr=(0,w.useMemo)(()=>{let F=In?.unmatchedAgentCallIds;return F&&F.size>0?[...F].sort().join("|"):""},[In]),Wr=Fa&&!sn&&(In?.sawAgentCompletion??!1)&&(In?.unmatchedAgentCallIds.size??0)>0,[Er,Wo]=(0,w.useState)(!1);(0,w.useEffect)(()=>{Wo(!1)},[gr,sa,I]),(0,w.useEffect)(()=>{if(!Wr||I)return;let F=setTimeout(()=>Wo(!0),Bq);return()=>clearTimeout(F)},[Wr,gr,sa,I]);let Hl=(0,w.useMemo)(()=>Fa&&!sn&&!I&&(In?.sawAgentCompletion??!1)&&(In?.unmatchedAgentCallIds.size??0)===0&&Z9(Ue,sa,Ue.length-1,!0,!0,!0),[Fa,Ue,I,In,sn,sa]),[Mr,im]=(0,w.useState)(!1),ln=(0,w.useMemo)(()=>{let F=In;if(!F||F.lastNotificationIndex<0)return"";let ee=Ue[F.lastNotificationIndex];return ee?.type==="message"?ee.message.id:""},[Ue,In]);(0,w.useEffect)(()=>{im(!1)},[ln,sa,I]),(0,w.useEffect)(()=>{if(!Hl)return;let F=setTimeout(()=>im(!0),Bq);return()=>clearTimeout(F)},[Hl,ln,sa,I]);let Ii=(0,w.useMemo)(()=>Fa&&Z9(Ue,sa,Ue.length-1,!0,sn||!Er,!Mr),[Fa,Ue,sn,sa,Mr,Er]),zg=(0,w.useMemo)(()=>{let F=new Set;for(let ee=sa;ee<Ue.length;ee+=1){let we=Ue[ee];we.type==="parallel_agents"&&F.add(we.key)}return F},[Ue,sa]),za=(0,w.useMemo)(()=>{if(!Fa)return{key:null};let F=-1,ee;for(let we=Ue.length-1;we>=0;we-=1){let Ae=Ue[we];if(Ae.type!=="message"||Ae.message.role!=="system"||Ae.message.source!=="background_notification")continue;let pe=Q9(Ae);if(pe){F=we,ee=pe.callId;break}}for(let we=F-1;we>=0;we-=1){let Ae=Ue[we];if(Ae.type==="parallel_agents"&&(!ee||Ae.agents.some(pe=>pe.callId===ee)))return{key:Ae.key}}return{key:null}},[Fa,Ue]),En=(0,w.useRef)(null),js=iLe(En,!J),[Qd,qg]=(0,w.useState)(()=>new Set),hu=(0,w.useCallback)((F,ee)=>{qg(we=>{if(we.has(F)===ee)return we;let Ae=new Set(we);return ee?Ae.add(F):Ae.delete(F),Ae})},[]),_i=(0,w.useRef)(null),Li=(0,w.useMemo)(()=>{if(!js)return sRe;let F=IAe(et);return(_i.current?.signature!==F||_i.current?.t!==ue)&&(_i.current={signature:F,t:ue,entries:SAe(et,ue)}),_i.current.entries},[js,et,ue]),vk=(0,w.useMemo)(()=>new Map(Li.map((F,ee)=>[F.id,ee])),[Li]),Ug=(0,w.useMemo)(()=>oAe(et),[et]),[lm,Hg]=(0,w.useState)(null),yk=lm!==null?Li[lm.currentIndex]?.id??Ug:Ug,jg=(0,w.useRef)(void 0),cm=(0,w.useMemo)(()=>{let F=jg.current,ee;return Xe&&I&&F?.sourceMessages===Ve.current&&F?.isResponding===I&&F.latestTurnAwaitsAgentSummary===Ii&&F.gateBackgroundAgentStatus===so?ee=F.value:ee=fAe(Ue,{isResponding:I,latestTurnAwaitsAgentSummary:Ii,gateBackgroundAgentStatus:so}),jg.current={sourceMessages:e,isResponding:I,latestTurnAwaitsAgentSummary:Ii,gateBackgroundAgentStatus:so,value:ee},ee},[Ue,e,Xe,so,I,Ii]),{collapseCompletedTurns:wk,sourceReferences:gu,assistantFeedback:um}=qo(),{ratings:Wg,rate:Gg,ratingForTurn:dm}=lde(me),Vg=(0,w.useMemo)(()=>{let F=new Map;for(let ee of e)oo(ee)&&F.set(ee.id,ee);return F},[e]),vu=Jue({renderMode:Oe,sessionId:me,options:um}),Kg=(0,w.useRef)(um);Kg.current=um;let Xg=(0,w.useRef)(e);Xg.current=e;let Yg=(0,w.useCallback)((F,ee,we)=>{let Ae=dm(F);Gg(F,we);let pe=Kg.current?.onRate;pe&&ede(pe,{rating:we,previousRating:Ae,sessionId:me,promptId:F,userMessage:tde(Xg.current,ee)})},[dm,Gg,me]),Qg=(0,w.useRef)(void 0),Zd=(0,w.useMemo)(()=>{let F=[te,N,me,gu],ee=Qg.current;return Xe&&I&&ee&&ee.sourceMessages===Ve.current&&Fq(ee.dependencies,F)?ee.value:Zce(e,te??[],N,me,gu)},[e,te,N,me,gu,Xe,I]);(0,w.useLayoutEffect)(()=>{Qg.current={sourceMessages:e,dependencies:[te,N,me,gu],value:Zd}},[e,te,N,me,gu,Zd]);let fm=wk??!0,[yu,wu]=(0,w.useState)(()=>new Map),[jl,bu]=(0,w.useState)(()=>new Set),Ai=(0,w.useRef)(new Map),[Zg,bk]=(0,w.useTransition)(),pm=(0,w.useRef)(!1),Jd=(0,w.useRef)(new Map),Wl=(0,w.useRef)(void 0),Ri=(0,w.useRef)([]),Gl=(0,w.useRef)(!0);a&&(Gl.current=!1);let ia=(0,w.useRef)(!1),mm=(0,w.useRef)(0),ku=(0,w.useRef)(0),Ia=(0,w.useRef)(!1),Gr=(0,w.useRef)(0),Ei=(0,w.useRef)(!1),Vl=(0,w.useRef)(0),Mi=(0,w.useRef)(null),xu=(0,w.useRef)(!1),Ni=(0,w.useRef)(null),hm=(0,w.useRef)(null),ef=(0,w.useRef)(!1),Su=(0,w.useRef)(null),B=(0,w.useRef)(!1),se=(0,w.useRef)(p),de=(0,w.useRef)(!!p),je=(0,w.useRef)(void 0),dt=(0,w.useRef)(void 0),va=(0,w.useRef)(G),vr=(0,w.useRef)(null),Co=(0,w.useRef)(m),Kn=(0,w.useRef)(m),Pi=(0,w.useRef)(!1),Oi=(0,w.useRef)(!1),Ws=(0,w.useRef)(void 0),Vr=(0,w.useRef)(void 0);Kn.current=m;let Di=(0,w.useRef)(!1),Xn=(0,w.useRef)(void 0),gm=(0,w.useRef)(void 0),$i=(0,w.useRef)(void 0),vm=(0,w.useRef)(void 0),ym=(0,w.useRef)(void 0),tf=(0,w.useRef)(void 0),Jg=(0,w.useRef)(void 0),kk=(0,w.useRef)(k),xk=(0,w.useRef)(S);kk.current=k,xk.current=S||a;let Sk=(0,w.useRef)(null),[qa,Gs]=(0,w.useState)(null),eT=(0,w.useRef)(!1);eT.current=qa?.virtual===!0;let tT=(0,w.useRef)(et.length);(0,w.useLayoutEffect)(()=>{tT.current=et.length},[et.length]);let Ck=(0,w.useRef)(e);(0,w.useLayoutEffect)(()=>{Ck.current=e},[e]);let[dW,e1]=(0,w.useState)(!1),[fW,pW]=(0,w.useState)(n);fW!==n&&(pW(n),Ai.current.clear(),Gr.current+=1,Ia.current=!1,Di.current=!1,Gs(null),wu(F=>F.size?new Map:F),bu(F=>F.size?new Set:F)),(0,w.useEffect)(()=>{g||(Di.current=!1,Sk.current=null)},[g]);let wm=(0,w.useCallback)(()=>{let F=En.current,ee=F?F.scrollHeight-F.scrollTop-F.clientHeight:0,we=!Gl.current&&ee>1;hm.current!==we&&(hm.current=we,q?.(we))},[q]),yr=(0,w.useCallback)(()=>{Vr.current!==void 0&&window.cancelAnimationFrame(Vr.current),Vr.current=window.requestAnimationFrame(wm)},[wm]),Kt=(0,w.useCallback)(F=>{qe.current&&(F=!1),Gl.current!==F&&(Gl.current=F,yr())},[yr]),af=(0,w.useRef)(void 0),Tk=(0,w.useRef)(!1),cn=(0,w.useMemo)(()=>{Tk.current=!1;let F=[ke,yu,I,L,r,Fa,sn,Er,Mr,fm,W,A,U,Qd,X,o,ne,ie,ve,jl],ee=af.current,we=Ue[Ue.length-1];if(Xe&&I&&ee&&ee.sourceMessages===Ve.current&&Fq(ee.dependencies,F)&&we?.type==="message"){let ft=Ib(we),_a=-1;for(let xa=ee.value.length-1;xa>=0;xa-=1)if(Ib(ee.value[xa])===ft){_a=xa;break}if(_a>=0){let xa=ee.value[_a];if(xa?.type==="message"){let Mn=ee.value.slice();return Mn[_a]={...xa,message:we.message},af.current={sourceMessages:e,dependencies:F,value:Mn,virtualizerItems:ee.virtualizerItems},Tk.current=!0,Mn}}}let Ae=jAe(Ue,{overrides:yu,isResponding:I,activeTurnStartedAt:L,terminalBackgroundShellTaskIds:r,backgroundSummaryGraceActive:Fa,waitForUnmatchedAgentCompletions:sn||!Er,waitForOrderedNarration:!Mr,automaticallyExpandedAgentKeys:Qd,pendingApprovalCallId:o?.toolCallId??null,includeSubagentToolUsageInMetrics:U,paginatedExpanded:ke?new Set([...jl,...ke]):jl,enabled:fm}),pe=ke?Ae.map(ft=>{if(!("turnCollapse"in ft)||!ft.turnCollapse||!ke.has(ft.turnCollapse.turnId))return ft;let{turnId:_a,collapsed:xa,hiddenCount:Mn}=ft.turnCollapse;return{...ft,turnCollapse:{turnId:_a,collapsed:xa,hiddenCount:Mn}}}):Ae,bt=!1,Ut=A?pe.map(ft=>bt||ft.type!=="turn_collapse"?ft:(bt=!0,{...ft,turnCollapse:{...ft.turnCollapse,...A.durationMs!==void 0&&A.durationMs>0?{elapsedMs:A.durationMs}:{},...A.inputTokens!==void 0?{inputTokens:A.inputTokens}:{},...A.outputTokens!==void 0?{outputTokens:A.outputTokens}:{},...A.cachedTokens!==void 0?{cachedTokens:A.cachedTokens}:{}}})):pe,la=dAe(Ut,Qd);if(!W)return af.current={sourceMessages:e,dependencies:F,value:la,virtualizerItems:la},la;let it=et.find(ft=>ft.role==="user")?.id,Ot=it?la.filter(ft=>ft.type!=="message"||ft.message.id!==it):la;return af.current={sourceMessages:e,dependencies:F,value:Ot,virtualizerItems:Ot},Ot},[Ue,Xe,yu,I,L,r,Fa,sn,Er,Mr,fm,ke,W,A,U,et,e,Qd,X,o,ne,ie,ve,jl]),nf=af.current?.sourceMessages===e?af.current.virtualizerItems:cn,bm=(0,w.useCallback)(F=>nf.some(ee=>String(Ib(ee))===F),[nf]),Ik=(0,w.useRef)(void 0),mW=(0,w.useMemo)(()=>{if(Tk.current&&Ik.current?.length===cn.length)return Ik.current.value;let F=Zj(cn);return Ik.current={length:cn.length,value:F},F},[cn]),hW=Li.length>=pwe,gs=O!=null,rf=!!p,Kl=!!E,ir=Kl?1:0,Cu=ir+cn.length,km=Cu+(gs?1:0),gW=ir+Ue.length+(gs?1:0),Bi=XAe(gW,z),lr=(0,w.useCallback)(()=>En.current,[]),aT=(0,w.useCallback)(()=>{let F=En.current;if(!F)return;let ee=F.scrollHeight-F.scrollTop-F.clientHeight<Lb;ia.current=!ee,Kt(ee),yr()},[yr,Kt]),xm=(0,w.useCallback)(()=>{mm.current=Date.now()+1e3},[]),t1=(0,w.useCallback)(()=>{ym.current!==void 0&&(window.clearTimeout(ym.current),ym.current=void 0)},[]),vs=(0,w.useCallback)(()=>{t1(),tf.current?.abort(),tf.current=void 0},[t1]),of=(0,w.useCallback)(()=>{t1();let F=Jg.current;if(F){if(C?.getSnapshot().lastEventId===F.lastEventId)return;Jg.current=void 0}!T||tf.current!==void 0||ia.current||xk.current||kk.current<=Dz||(ym.current=window.setTimeout(()=>{if(ym.current=void 0,xk.current||ia.current||kk.current<=Dz)return;let ee=En.current;if(!ee||ee.scrollHeight-ee.scrollTop-ee.clientHeight>=Lb)return;let we=new AbortController;tf.current=we,T(we.signal).then(()=>{if(we.signal.aborted)return;let Ae=C?.getSnapshot();Jg.current={...Ae?.lastEventId!==void 0?{lastEventId:Ae.lastEventId}:{}}}).catch(Ae=>{Ae instanceof Error&&Ae.name==="AbortError"||console.warn("[MessageList] transcript reload failed:",Ae)}).finally(()=>{tf.current===we&&(tf.current=void 0)})},eAe))},[t1,T,C]);(0,w.useEffect)(()=>{Jg.current=void 0},[C]),(0,w.useEffect)(()=>{if(!C)return vs;let F=C.getSnapshot().lastEventId,ee=C.subscribe(()=>{let we=C.getSnapshot().lastEventId;we!==F&&(F=we,of())});return()=>{ee(),vs()}},[C,of,vs]),(0,w.useEffect)(()=>{if(S){vs();return}of()},[vs,S,of,k]);let sf=(0,w.useCallback)(()=>{Oi.current=!0,Ws.current!==void 0&&window.cancelAnimationFrame(Ws.current),Ws.current=window.requestAnimationFrame(()=>{Oi.current=!1,Ws.current=void 0,aT()})},[aT]);(0,w.useEffect)(()=>()=>{Ws.current!==void 0&&window.cancelAnimationFrame(Ws.current),Vr.current!==void 0&&window.cancelAnimationFrame(Vr.current),Xn.current!==void 0&&window.cancelAnimationFrame(Xn.current),gm.current!==void 0&&window.cancelAnimationFrame(gm.current),$i.current!==void 0&&window.cancelAnimationFrame($i.current),vs(),je.current!==void 0&&window.cancelAnimationFrame(je.current),dt.current!==void 0&&window.cancelAnimationFrame(dt.current)},[vs]);let nT=(0,w.useCallback)((F,ee)=>{let we=En.current;(!we||we.scrollHeight>we.clientHeight+1)&&(ia.current=!0,Kt(!1)),sf(),Wl.current!==void 0&&window.clearTimeout(Wl.current),Jd.current.clear(),En.current?.querySelectorAll("[data-message-row-key]").forEach(Ae=>{let pe=Ae.dataset.messageRowKey;pe&&Jd.current.set(pe,Ae.getBoundingClientRect().top)}),pm.current=!0,bk(()=>{bu(Ae=>{if(!Ae.has(F))return Ae;let pe=new Set(Ae);return pe.delete(F),pe}),wu(Ae=>{let pe=new Map(Ae);return pe.set(F,ee),pe})})},[sf,Kt]);(0,w.useLayoutEffect)(()=>{if(Zg||!pm.current)return;pm.current=!1;for(let ee of Ri.current)ee.cancel();Ri.current=[];let F=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;F||En.current?.querySelectorAll("[data-message-row-key]").forEach(ee=>{if(typeof ee.animate!="function")return;let we=ee.dataset.messageRowKey,Ae=we?Jd.current.get(we):void 0;if(Ae===void 0){Ri.current.push(ee.animate([{opacity:0},{opacity:1}],{duration:a9,easing:"ease-out"}));return}let pe=Ae-ee.getBoundingClientRect().top;Math.abs(pe)<1||Ri.current.push(ee.animate([{translate:`0 ${pe}px`},{translate:"0 0"}],{duration:a9,easing:"ease-out"}))}),Jd.current.clear(),Wl.current=window.setTimeout(()=>{Wl.current=void 0,sf()},F?0:a9)},[sf,Zg]),(0,w.useEffect)(()=>()=>{Wl.current!==void 0&&window.clearTimeout(Wl.current);for(let F of Ri.current)F.cancel();Ri.current=[]},[]);let vW=(0,w.useCallback)(F=>{let ee=F.target;ee instanceof HTMLElement&&ee.closest("[aria-expanded], summary")&&(ia.current=!0,Kt(!1),sf())},[sf,Kt]),Tu=(0,w.useCallback)(F=>{if(Kl&&F===s9)return"slot:header";if(gs&&F===Cu)return`slot:tail:${$}`;let ee=nf[F-ir];return ee?Ib(ee):`slot:row:${F}`},[Kl,gs,Cu,$,nf,ir]),yW=(0,w.useCallback)(F=>Kl&&F===s9?WAe:gs&&F===Cu?KAe:nf[F-ir]?.type==="turn_collapse"?VAe:GAe,[Kl,gs,ir,Cu,nf]),cr=(0,w.useCallback)((F="auto")=>{if(qe.current)return;let ee=lr();if(!ee||ee.scrollHeight<=ee.clientHeight)return;xu.current=!1,Vl.current+=1;let we=Vl.current;Ei.current=!0,F==="smooth"?ee.scrollTo({top:ee.scrollHeight,behavior:F}):ee.scrollTop=ee.scrollHeight,yr(),ku.current=Math.max(0,ee.scrollHeight-ee.clientHeight),wm();let Ae=()=>{if(Vl.current!==we||(Ei.current=!1,!xu.current)||(xu.current=!1,Kn.current||ia.current))return;let pe=lr();!pe||pe.scrollHeight<=pe.clientHeight||(Kt(!0),pe.scrollTop=pe.scrollHeight,yr(),ku.current=Math.max(0,pe.scrollHeight-pe.clientHeight),wm())};F==="smooth"?setTimeout(Ae,350):requestAnimationFrame(Ae)},[lr,wm,yr,Kt]),rT=(0,w.useCallback)((F="smooth")=>{ia.current=!1,Kt(!0),cr(F)},[cr,Kt]),ys=gue({count:km,enabled:Bi,getScrollElement:lr,getItemKey:Tu,estimateSize:yW,overscan:20,anchorTo:"end",useFlushSync:!1,useAnimationFrameWithResizeObserver:!0,directDomUpdates:!0});ys.shouldAdjustScrollPositionOnItemSizeChange=(F,ee,we)=>YAe(F.end,En.current?.scrollTop??we.scrollOffset??0);let wW=(0,w.useCallback)(F=>{if(ys.measureElement(F),!F||!eT.current)return;let ee=Number(F.dataset.index);Number.isFinite(ee)&&!ys.itemSizeCache.has(Tu(ee))&&ys.resizeItem(ee,F.offsetHeight)},[Tu,ys]);(0,w.useLayoutEffect)(()=>{if(!qa)return;let F=En.current;if(qa.rowKey&&!bm(qa.rowKey)){let ee=vAe(Ck.current,qa.rowKey);if(ee!==void 0&&yAe(cn,ee)&&yu.get(ee)!==!1&&!jl.has(ee)){bu(we=>we.has(ee)?we:new Set(we).add(ee)),Gs(we=>we&&{...we,rowKey:`msg:${ee}`});return}qa.generation===Gr.current&&(Gr.current+=1),Ia.current=!1,vm.current=void 0,e1(!1),Gs(null);return}if(qa.settled){if(!F){Ia.current=!1,Gs(null);return}if(qa.virtual?et.length===qa.messageCount:F.scrollHeight===qa.scrollHeight){if(Ia.current=!1,Xn.current!==void 0)return;let ee=Kq,we=()=>{if(Xn.current=void 0,qa.generation===Gr.current&&tT.current===qa.messageCount){if(ee-=1,ee>0){Xn.current=requestAnimationFrame(we);return}Gs(Ae=>Ae===qa?null:Ae)}};Xn.current=requestAnimationFrame(we);return}Xn.current!==void 0&&(cancelAnimationFrame(Xn.current),Xn.current=void 0),Xn.current=requestAnimationFrame(()=>{if(Xn.current=void 0,qa.generation!==Gr.current)return;if(qa.rowKey&&!bm(qa.rowKey)){Ia.current=!1,Gs(null);return}let ee=qa.rowKey?Array.from(F.querySelectorAll("[data-message-row-key]")).find(we=>we.dataset.messageRowKey===qa.rowKey):void 0;ee&&qa.rowTop!==void 0?F.scrollTop+=ee.getBoundingClientRect().top-qa.rowTop:F.scrollTop=qa.scrollTop+Math.max(0,F.scrollHeight-qa.scrollHeight),Ia.current=!1,Gs(null)})}},[bm,et.length,qa,cn,yu,jl]);let oT=ys.getVirtualItems(),lf=ys.getTotalSize(),sT=(0,w.useRef)({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});sT.current={entryIndexById:vk,headerOffset:ir,isVisible:js,turnIdByDisplayIndex:mW,visibleItems:cn};let iT=(0,w.useCallback)(()=>{let F=lr(),ee=sT.current;if(!F||!ee.isVisible||ee.entryIndexById.size===0){Hg(ft=>ft===null?ft:null);return}let we=F.getBoundingClientRect(),Ae=we.top,pe=we.bottom,bt=Ae+(pe-Ae)/2,Ut=[],la=null,it=Number.POSITIVE_INFINITY;F.querySelectorAll("[data-index]").forEach(ft=>{let _a=ft.dataset.index;if(_a===void 0)return;let xa=Number(_a);if(!Number.isFinite(xa))return;let Mn=xa-ee.headerOffset;if(Mn<0||Mn>=ee.visibleItems.length)return;let ws=ft.getBoundingClientRect();if(ws.bottom<Ae||ws.top>pe)return;Ut.push(Mn);let r1=ws.top+(ws.bottom-ws.top)/2,mT=Math.abs(r1-bt);mT<it&&(it=mT,la=Mn)});let Ot=DAe(ee.visibleItems,Ut,ee.entryIndexById,la,ee.turnIdByDisplayIndex);Hg(ft=>ft?.startIndex===Ot?.startIndex&&ft?.endIndex===Ot?.endIndex&&ft?.currentIndex===Ot?.currentIndex?ft:Ot)},[lr]),Xl=(0,w.useCallback)(()=>{Ni.current!==null&&cancelAnimationFrame(Ni.current),Ni.current=requestAnimationFrame(()=>{Ni.current=null,iT()})},[iT]);(0,w.useEffect)(()=>()=>{Mi.current!==null&&(clearTimeout(Mi.current),Mi.current=null),Ni.current!==null&&(cancelAnimationFrame(Ni.current),Ni.current=null)},[]),(0,w.useEffect)(()=>{Xl()},[Xl,km,lf,Bi,oT.length,js]);let[Sm,_k]=(0,w.useState)(null);(0,w.useEffect)(()=>{if(!Sm)return;let F=setTimeout(()=>_k(null),1600);return()=>clearTimeout(F)},[Sm]);let Lk=(0,w.useCallback)((F,ee)=>{ia.current=!0,Kt(!1),Vl.current+=1;let we=Vl.current;if(Ei.current=!0,Bi)if(qe.current){let Ae=ys.getOffsetForIndex(F,"center");Ae&&En.current&&(En.current.scrollTop=Ae[0])}else ys.scrollToIndex(F,{align:"center"});else En.current?.querySelector(`[data-index="${F}"]`)?.scrollIntoView({block:"center"});Mi.current!==null&&clearTimeout(Mi.current),Mi.current=setTimeout(()=>{Mi.current=null,Vl.current===we&&(Ei.current=!1,Xl(),yr())},150),_k(null),requestAnimationFrame(()=>_k(ee))},[Bi,ys,Kt,Xl,yr]),lT=(0,w.useRef)({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});lT.current={visibleItems:cn,displayItems:Ue,headerOffset:ir,performScrollToRow:Lk};let Iu=(0,w.useRef)(null),Cm=(0,w.useCallback)((F,ee)=>{let{visibleItems:we,displayItems:Ae,headerOffset:pe,performScrollToRow:bt}=lT.current,Ut=_b(we,F,ee);if(Ut>=0)return Iu.current=null,bt(Ut+pe,{messageId:F,callId:ee}),!0;let la=_b(Ae,F,ee);if(la<0)return!1;let it=Qj(Ae,la);return it?(Iu.current={messageId:F,callId:ee},wu(Ot=>{if(Ot.get(it)===!0)return Ot;let ft=new Map(Ot);return ft.set(it,!0),ft}),!0):!1},[]);(0,w.useImperativeHandle)(ye,()=>({scrollToMessage:Cm,scrollToBottom:rT}),[Cm,rT]),(0,w.useEffect)(()=>{let F=Iu.current;if(!F)return;let ee=_b(cn,F.messageId,F.callId);ee<0||(Iu.current=null,Lk(ee+ir,F))},[cn,ir,Lk]);let Vs=(0,w.useCallback)(async(F=!1,ee=!1)=>{let we=En.current;if(!we||!y||h||Ia.current||v&&!ee||Di.current&&!F)return;Di.current=!1,Ia.current=!0;let Ae=++Gr.current;Xn.current!==void 0&&(cancelAnimationFrame(Xn.current),Xn.current=void 0),e1(!ee);let pe;if(Bi){let Ot=String(Tu(ir)),ft=Kq;if(pe=await new Promise(_a=>{let xa=()=>{if(gm.current=void 0,Ae!==Gr.current||En.current!==we||!bm(Ot)||ft--<=0){_a(void 0);return}let Mn=Array.from(we.querySelectorAll("[data-message-row-key]")).find(ws=>ws.dataset.messageRowKey===Ot);Mn?_a({rowKey:Ot,rowTop:Mn.getBoundingClientRect().top}):gm.current=requestAnimationFrame(xa)};gm.current=requestAnimationFrame(xa)}),!pe){Ae===Gr.current&&(Ia.current=!1,vm.current=void 0,e1(!1));return}}let bt=we.scrollHeight,Ut=we.scrollTop,la=we.getBoundingClientRect().top,it=pe?void 0:Array.from(we.querySelectorAll("[data-message-row-key]")).find(Ot=>{let ft=Ot.dataset.messageRowKey;return ft!==void 0&&ft.startsWith("msg:")&&Ot.getBoundingClientRect().bottom>la});ia.current=!0,Gs({scrollHeight:bt,scrollTop:Ut,messageCount:et.length,virtual:Bi,settled:!1,generation:Ae,...pe??(it?{rowKey:it.dataset.messageRowKey,rowTop:it.getBoundingClientRect().top}:{})});try{Ai.current.set(Ae,{ids:new Set(Ck.current.map(ft=>ft.id)),resolved:!1}),await y(ee?{force:!0}:void 0);let Ot=Ai.current.get(Ae);Ot&&(Ot.resolved=!0),Ae===Gr.current&&Gs(ft=>ft?.generation===Ae?{...ft,settled:!0}:ft)}catch{Ai.current.delete(Ae),Ae===Gr.current&&(Di.current=!0,Ia.current=!1,Gs(null))}finally{Ae===Gr.current&&e1(!1)}},[h,y,v,Tu,bm,ir,et.length,Bi]),bW=(0,w.useCallback)(()=>{Vs(!0,!0)},[Vs]);(0,w.useLayoutEffect)(()=>{let F=Ai.current;if(F.size===0)return;let ee=e.find(Ut=>!Ut?.id.startsWith("local-"));if(!ee)return;let we=F.entries().next().value;if(!we)return;let[Ae,pe]=we;if(pe.ids.has(ee.id))return;let bt=[];for(let Ut=0;Ut<e.length;Ut++){let la=e[Ut];if(!la||!oo(la)||pe.ids.has(la.id))continue;let it=!1;for(let Ot=Ut+1;Ot<e.length;Ot++){let ft=e[Ot];if(oo(ft))break;if(pe.ids.has(ft.id)){it=!0;break}}it&&bt.push(la.id)}if(bt.length===0){if(!pe.resolved)return}else bu(Ut=>{let la=null;for(let it of bt)Ut.has(it)||(la??=new Set(Ut),la.add(it));return la??Ut});F.delete(Ae);for(let Ut of F.values())for(let la of e)la&&Ut.ids.add(la.id)},[e]),(0,w.useEffect)(()=>{let F=vm.current;if(F===void 0||h||qa||Ia.current||(vm.current=void 0,!g||F!==Gr.current))return;let ee=lr();ee&&ee.scrollTop<=i9&&Vs(!0)},[lr,g,Vs,h,qa]);let Ak=(0,w.useCallback)(()=>{let F=lr();if(!F)return;let ee=F.scrollTop;g&&ee<=i9&&Vs(!0);let we=Date.now()<=mm.current;if(Ei.current&&!we){ku.current=ee;return}Xl();let Ae=ku.current;ku.current=ee;let pe=F.scrollHeight-ee-F.clientHeight;if(yr(),ee<Ae-1){let bt=pe<Lb;we?(vs(),ia.current=!0,Kt(!1)):bt?(ia.current=!1,Kt(!0)):ia.current||(vs(),Kt(!1));return}pe<Lb?(ia.current=!1,Kt(!0),of()):vs()},[lr,g,Vs,yr,Xl,of,vs,Kt]);(0,w.useEffect)(()=>{let F=lr();if(F)return F.addEventListener("scroll",Ak,{passive:!0}),()=>F.removeEventListener("scroll",Ak)},[lr,Ak]);let a1=(0,w.useCallback)(()=>{if(!g||h||m||rf)return;let F=lr();if(!F||F.scrollHeight>F.clientHeight+1)return;let ee=Sk.current;if(ee!==null&&ee.loader===y&&ee.totalVirtualSize===lf){Di.current=!0;return}Sk.current={loader:y,totalVirtualSize:lf},Vs()},[m,lr,g,Vs,h,y,rf,lf]);(0,w.useEffect)(()=>{a1()},[a1,lf]),(0,w.useEffect)(()=>{let F=lr();if(!F)return;let ee=()=>{if($i.current=void 0,!(F.scrollTop>i9)){if(h||Ia.current){vm.current=Gr.current;return}Vs(!0)}},we=()=>{$i.current!==void 0&&cancelAnimationFrame($i.current),$i.current=requestAnimationFrame(ee)},Ae=it=>{xm(),it.deltaY<0&&we()},pe=()=>{xm()},bt=()=>we(),Ut=it=>{let Ot=F.getBoundingClientRect(),ft=20;(it.clientX>=Ot.right-ft||it.clientY>=Ot.bottom-ft)&&xm()},la=it=>{(it.key==="ArrowUp"||it.key==="ArrowDown"||it.key==="PageUp"||it.key==="PageDown"||it.key==="Home"||it.key==="End"||it.key===" ")&&(xm(),(it.key==="ArrowUp"||it.key==="PageUp"||it.key==="Home")&&we())};return F.addEventListener("wheel",Ae,{passive:!0}),F.addEventListener("touchstart",pe,{passive:!0}),F.addEventListener("touchmove",bt,{passive:!0}),F.addEventListener("pointerdown",Ut,{passive:!0}),F.addEventListener("keydown",la,{passive:!0}),()=>{F.removeEventListener("wheel",Ae),F.removeEventListener("touchstart",pe),F.removeEventListener("touchmove",bt),F.removeEventListener("pointerdown",Ut),F.removeEventListener("keydown",la),$i.current!==void 0&&(cancelAnimationFrame($i.current),$i.current=void 0)}},[lr,Vs,h,xm]),(0,w.useEffect)(()=>{let F=lr();if(!F||typeof ResizeObserver>"u")return;let ee=new ResizeObserver(()=>{yr(),a1(),!(Kn.current||ia.current)&&(Kt(!0),cr())});ee.observe(F);for(let Ae of Array.from(F.children))ee.observe(Ae);let we=new MutationObserver(Ae=>{for(let pe of Ae){for(let bt of Array.from(pe.addedNodes))bt instanceof HTMLElement&&ee.observe(bt);for(let bt of Array.from(pe.removedNodes))bt instanceof HTMLElement&&ee.unobserve(bt)}yr()});return we.observe(F,{childList:!0}),yr(),()=>{ee.disconnect(),we.disconnect()}},[lr,a1,yr,cr,Kt]),(0,w.useEffect)(()=>{e.length===0&&(ia.current=!1,xu.current=!1,Kt(!0),Iu.current=null,Ai.current.clear(),Xt.current=void 0,nt.current=void 0,wu(F=>F.size?new Map:F),bu(F=>F.size?new Set:F))},[e.length,Kt]),(0,w.useEffect)(()=>{let F=En.current;if(!F)return;let ee=new ResizeObserver(()=>{Xl(),!Kn.current&&(ia.current||(Kt(!0),requestAnimationFrame(()=>{!Kn.current&&!ia.current&&cr()})))});return ee.observe(F),()=>ee.disconnect()},[cr,Xl,Kt]),(0,w.useLayoutEffect)(()=>{let F=nAe(e);if(m||p||se.current){Su.current=F,ef.current=!0,B.current=!1,se.current=p;return}if(se.current=p,!ef.current){Su.current=F,ef.current=!0,B.current=!1;return}let ee=rAe(e);F&&ee?.role==="user"&&F!==Su.current?(ia.current=!1,Kt(!0),Iu.current=null,B.current=!0):B.current=!1,Su.current=F},[e,m,p,Kt]),(0,w.useLayoutEffect)(()=>{Co.current&&!m&&(ia.current=!1,Kt(!0),cr("auto")),Co.current=m},[m,cr,Kt]),(0,w.useLayoutEffect)(()=>{if(p){de.current=!0;return}if(!de.current||m||e.length===0)return;de.current=!1,ia.current=!1,Kt(!0),Iu.current=null,je.current!==void 0&&window.cancelAnimationFrame(je.current),dt.current!==void 0&&window.cancelAnimationFrame(dt.current);let F=()=>{Kn.current||ia.current||(Kt(!0),cr("auto"))};je.current=window.requestAnimationFrame(()=>{je.current=void 0,F(),dt.current=window.requestAnimationFrame(()=>{dt.current=void 0,F()})})},[m,p,e.length,cr,Kt]),(0,w.useLayoutEffect)(()=>{let F=va.current!==G;va.current=G,F&&(m||ia.current||(Kt(!0),requestAnimationFrame(()=>{!Kn.current&&!ia.current&&cr("auto")})))},[G,m,cr,Kt]);let n1=(0,w.useMemo)(()=>AAe(cn),[cn]);(0,w.useLayoutEffect)(()=>{if(!m){if(!n1){vr.current=null;return}n1!==vr.current&&(vr.current=n1,(Gl.current||!ia.current)&&requestAnimationFrame(()=>{ia.current||(Kt(!0),cr())}))}},[m,n1,cr,Kt]),(0,w.useEffect)(()=>{H&&gs&&!Pi.current&&(ia.current=!1,Kt(!0),requestAnimationFrame(()=>{ia.current||cr()})),Pi.current=gs},[H,gs,cr,Kt]);let cT=(0,w.useCallback)(F=>{let ee=pe=>{if(pe.type==="parallel_agents")return(0,u.jsx)(m9,{timestamp:pe.timestamp,children:(0,u.jsx)("div",{className:Gq(pe,Sm)?Ul.flash:void 0,children:(0,u.jsx)(CH,{agents:pe.agents,autoManageExpansion:Oe==="interactive"&&!m,automaticCollapseDelayMs:za.key===pe.key&&!Ii?tAe:void 0,deferAutomaticCollapse:za.key===pe.key&&Ii,expandActiveWhenLive:I&&zg.has(pe.key),onAutomaticExpansionChange:Mn=>hu(pe.key,Mn),pendingApproval:o})})});if(pe.type==="turn_outputs")return(0,u.jsx)(Z_e,{changes:pe.changes,turnId:pe.turnId,artifacts:pe.artifacts,sourceSessionId:me,scheduledTasks:pe.scheduledTasks,workspaceCwd:N,onOpenRequest:Ye,onReviewChanges:K??t9,onOpenArtifact:Se??t9,onOpenScheduledTask:Le??t9,onError:qt});if(pe.type==="turn_collapse")return(0,u.jsx)(tRe,{turnCollapse:pe.turnCollapse,onToggleCollapse:nT});let bt=pe.message.role==="assistant"?cm.get(pe.message.id):void 0,Ut;pe.message.role==="assistant"&&bt&&!a&&(Ut={turnId:bt,message:{id:pe.message.id,content:pe.message.content,isStreaming:pe.message.isStreaming,timestamp:pe.message.timestamp}});let la=bt?Vg.get(bt):void 0,it=pe.message.promptId??la?.promptId,Ot=pe.message.role==="assistant"&&pe.message.agentMessage?.kind==="agent_message",ft=pe.message.role==="assistant"&&!Ot?pe.message.branchRecordId:void 0,_a=pe.message.role==="user"?pe.message.content:void 0,xa=_a!==void 0&&pe.message.id===fe.lastId&&!I&&!g&&!b?{turnIndex:fe.turnIndexById.get(pe.message.id)??0,content:_a}:void 0;return(0,u.jsx)(p_e,{message:pe.message,onLocateBackgroundSource:pe.message.role==="system"&&pe.message.source==="background_notification_turn_started"&&pe.message.backgroundTurn?.toolUseId&&_b(Ue,"",pe.message.backgroundTurn.toolUseId)>=0?Cm: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,onImagePreview:i,onAttachmentPreview:l,onTurnOutputOpen:Ye,onToolResultOpen:ut,onInsightReportOpen:c,onEditUserMessage:d&&xa?()=>d(xa.turnIndex,xa.content):void 0,onSubmitUserMessageEdit:f&&xa?Mn=>f(xa.turnIndex,Mn):void 0,workspaceCwd:N,showRetryHint:Y,onRetryClick:P,sendFailed:pe.message.role==="user"&&pe.message.id===ae,onRetrySend:le,onBranchSession:Te,branchRecordId:ft,showAssistantActions:pe.message.role==="assistant"&&(Ot||cm.has(pe.message.id)),showAssistantBranch:pe.message.role==="assistant"&&!Ot&&!I&&ft!==void 0,assistantFeedbackTurnId:vu&&!Ot?bt:void 0,assistantFeedbackPromptId:vu&&!Ot?it:void 0,assistantFeedbackRating:vu&&!Ot&&it?Wg[it]:void 0,onAssistantFeedbackRate:Yg,isLocateFlashing:Gq(pe,Sm),assistantTurnFooterInfo:Ut,turnSources:bt?Zd.get(bt):void 0,onSourceOpen:Fe,generateContent:ua})};if(Kl&&F===s9)return E;if(gs&&F===Cu)return O;let we=F-ir,Ae=cn[we];return Ae?ee(Ae):null},[Kl,E,gs,O,Cu,o,m,I,Ii,zg,za,Oe,hu,s,Ue,Cm,i,l,c,d,t,f,fe,g,b,ua,ir,cn,Sm,cm,vu,Vg,Wg,Yg,a,N,Y,P,ae,le,Te,nT,me,Se,Le,K,Ye,ut,Zd,Fe,qt]),uT=(0,w.useCallback)(F=>F?aRe(F):void 0,[]),dT=Bi?lf:e;(0,w.useLayoutEffect)(()=>{if(m)return;let F=B.current;if(Ei.current&&!F){ia.current||(xu.current=!0);return}Oi.current&&!F||(Gl.current||F||!ia.current)&&(ia.current||Kt(!0),cr(F?"smooth":"auto"),B.current=!1)},[dT,km,m,cr,Kt]),(0,w.useLayoutEffect)(()=>{yr()},[dT,yr,km]);let fT=(0,w.useMemo)(()=>{let F=new Map;if(!t?.active)return F;let ee=pe=>{let bt=pe.type==="message"?pe.message.id:pe.type==="turn_collapse"?pe.turnCollapse.turnId:pe.turnId;return t.groupByMessage.get(bt)??t.groupByMessage.get(gg(bt)??bt)},we=new Set;for(let pe of cn)if(pe.type==="turn_collapse"&&nW(pe.turnCollapse)){let bt=ee(pe),Ut=bt??pe.turnCollapse.turnId;we.has(Ut)||(F.set(pe,bt),we.add(Ut))}let Ae="unowned";for(let pe of cn){if(pe.type==="turn_collapse"||pe.type==="turn_outputs")continue;let bt=ee(pe);if(pe.type==="message"&&oo(pe.message))Ae=pe.message.id,F.set(pe,bt);else{let Ut=bt??Ae;we.has(Ut)||(F.set(pe,bt),we.add(Ut))}}return F},[t,cn]),pT=F=>{if(!t?.active||!F||!fT.has(F))return null;let ee=fT.get(F);return(0,u.jsx)(Dd,{className:Et.deletionCheckbox,"aria-label":ue("messageDelete.selectGroup"),title:ee?void 0:ue("messageDelete.unavailable"),checked:ee?t.selected.has(ee):!1,disabled:!ee||t.disabled||!t.allowed.has(ee),onCheckedChange:()=>{ee&&t.toggle(ee)}})};return(0,u.jsx)(oH.Provider,{value:xe,children:(0,u.jsxs)("div",{ref:En,className:J9(Et.list,t?.active?Et.deletionMode:void 0,Kl&&R?Et.listWithWelcomeHeader:void 0),"data-web-shell-message-list":!0,onClickCapture:vW,children:[rf&&(0,u.jsx)(iRe,{label:ue("editor.sessionLoading")}),h&&!rf&&!dW&&(0,u.jsx)("div",{className:Et.historyStatus,role:"status",children:ue("history.loadingEarlier")}),b&&!rf&&(0,u.jsx)("div",{className:Et.historyStatus,role:"status",children:ue("history.capacityReached")}),v&&!rf&&!b&&(0,u.jsxs)("div",{className:Et.historyStatus,children:[(0,u.jsx)("span",{role:"status",children:ue("history.paginationError")}),y&&(0,u.jsx)("button",{type:"button",className:Et.historyRetryButton,onClick:bW,children:ue("history.retry")})]}),(0,u.jsx)(oRe,{action:Q,entries:Li,currentTurnId:yk,currentRange:lm,hidden:!js||!hW,onSelect:Cm}),Bi?(0,u.jsx)("div",{ref:ys.containerRef,className:Et.virtualSizer,children:oT.map(F=>(0,u.jsxs)("div",{"data-index":F.index,ref:wW,className:J9(Et.virtualRow,uT(cn[F.index-ir])),"data-message-row-key":String(Tu(F.index)),"data-source-block-ids":Vq(cn[F.index-ir],e),"data-web-shell-message-row":!0,style:{position:"absolute",top:0,left:0,right:0},children:[pT(cn[F.index-ir]),cT(F.index)]},F.key))}):Array.from({length:km},(F,ee)=>{let we=Tu(ee),Ae=cn[ee-ir];return(0,u.jsxs)("div",{"data-index":ee,className:uT(Ae),"data-message-row-key":String(we),"data-source-block-ids":Vq(Ae,e),"data-web-shell-message-row":!0,children:[pT(Ae),cT(ee)]},we)})]})})})),Qq={en:{title:"Something went wrong",body:"An unexpected error occurred and this content could not be displayed.",retry:"Try again",reload:"Reload page"},"zh-CN":{title:"\u51FA\u4E86\u70B9\u95EE\u9898",body:"\u53D1\u751F\u610F\u5916\u9519\u8BEF\uFF0C\u65E0\u6CD5\u663E\u793A\u6B64\u5185\u5BB9\u3002",retry:"\u91CD\u8BD5",reload:"\u91CD\u65B0\u52A0\u8F7D"}},cRe={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},uRe={margin:0,fontSize:"1rem",fontWeight:600},dRe={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},fRe={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 pRe({error:e,onRetry:t,language:a="en",retryMode:n="reset"}){let r=Qq[a]??Qq.en;return(0,u.jsxs)("div",{role:"alert",style:cRe,"data-web-shell-error":!0,children:[(0,u.jsx)("p",{style:uRe,children:r.title}),(0,u.jsx)("p",{style:dRe,children:r.body}),!1,(0,u.jsx)("button",{type:"button",style:fRe,onClick:t,children:n==="reload"?r.reload:r.retry})]})}function mRe(e,t,a=!1){return Wye(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=>hRe(n,t)}})}function hRe(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 gRe="_app_34yd6_1",vRe="_appChat_34yd6_66",yRe="_content_34yd6_120",wRe="_themeDark_34yd6_435",bRe="_themeLight_34yd6_509",kRe="_contentHasMessages_34yd6_591",Vp={app:gRe,appChat:vRe,content:yRe,themeDark:wRe,themeLight:bRe,contentHasMessages:kRe},xRe=1e3,SRe=40;function rW(e){if(e!==void 0)return HF(e);if(typeof window>"u")return"en";let t=new URLSearchParams(window.location.search);return HF(t.get("language")??t.get("lang")??navigator.language)}function CRe(e){let t=`${typeof e=="number"&&Number.isFinite(e)&&e>0?e:xRe}px`,a=`calc(${t} + ${SRe}px)`;return{"--chat-regular-content-width":t,"--chat-regular-shell-width":a,"--chat-content-width":t,"--chat-shell-width":a}}function TRe({blocks:e,renderMode:t="readonly",theme:a=ng.Dark,language:n,className:r,style:o,chatMaxWidth:s,workspaceCwd:i="",compactThinking:l=!1,documentExpanded:c=!0,collapseCompletedTurns:d,markdownTableMode:f="basic",virtualScrollThreshold:p,markdown:m,sourceSessionId:g,sources:h,sourceAttachments:b,sourceReferences:v,getAssistantSourcesIcon:y,onSourceOpen:k,composerTagIcons:C,artifact:T,renderToolHeaderExtra:I,parseUserMessageContent:S,renderUserMessageContent:L,renderComposerTag:E,renderComposerTagTooltip:R,renderAssistantTurnFooter:N,mcpAppBaseUrl:O}){let $=t==="document",z=!$&&(d??!0),H=$?"basic":f,G=rW(n),J=(0,w.useMemo)(()=>oU(G),[G]),Q=(0,w.useMemo)(()=>mRe(e,J,$),[e,$,J]),W=(0,w.useMemo)(()=>Yce(h??[],b??[]),[h,b]),A=(0,w.useMemo)(()=>_ye(Q),[Q]),U=(0,w.useMemo)(()=>kye(Q),[Q]),Y=(0,w.useMemo)(()=>({artifact:T,composerTagIcons:C,renderToolHeaderExtra:I,parseUserMessageContent:S,renderUserMessageContent:L,renderComposerTag:E,renderComposerTagTooltip:R,renderAssistantTurnFooter:N,compactThinking:l,collapseCompletedTurns:z,markdownTableMode:H,markdown:m,sourceReferences:v,getAssistantSourcesIcon:y}),[T,z,l,C,m,v,y,H,S,N,E,R,I,L]),P=(0,w.useRef)(null),[ae,le]=(0,w.useState)(null),Te=(0,w.useRef)(new Set),q=[Vp.app,Vp.appChat,a===ng.Light?Vp.themeLight:Vp.themeDark,a===ng.Dark?"dark":void 0,r].filter(Boolean).join(" "),ne=(0,w.useMemo)(()=>({...o,...CRe(s)}),[s,o]);return(0,w.useLayoutEffect)(()=>{if(typeof document>"u")return;let ie=document.createElement("div");return ie.dataset.webShellPortalRoot="",ie.dataset.webShellShadcn="",document.body.appendChild(ie),le(ie),()=>{ie.remove(),le(null)}},[]),(0,w.useLayoutEffect)(()=>{let ie=P.current;if(!ie||!ae)return;let te=null,me=()=>{te=null;let K=getComputedStyle(ie),Se=new Set;ae.dataset.webShellShadcn="",ae.classList.toggle("dark",a===ng.Dark),ae.lang=G;for(let Le=0;Le<K.length;Le+=1){let Ye=K[Le];Ye.startsWith("--")&&(Se.add(Ye),ae.style.setProperty(Ye,K.getPropertyValue(Ye)))}for(let Le of Te.current)Se.has(Le)||ae.style.removeProperty(Le);Te.current=Se},xe=()=>{te===null&&(te=requestAnimationFrame(me))};me();let Fe=new MutationObserver(xe),ve=ie;for(;ve;)Fe.observe(ve,{attributes:!0,attributeFilter:["class","style","data-theme","lang"]}),ve=ve.parentElement;return window.addEventListener("resize",xe),()=>{Fe.disconnect(),window.removeEventListener("resize",xe),te!==null&&cancelAnimationFrame(te)}},[ae,G,q,ne,a]),(0,u.jsx)(mfe,{value:a,children:(0,u.jsx)(Yue,{language:G,children:(0,u.jsx)(rH.Provider,{value:O,children:(0,u.jsx)(sU.Provider,{value:ae,children:(0,u.jsx)(Que,{value:t,children:(0,u.jsx)(Zue,{value:c,children:(0,u.jsx)(eue,{value:Y,children:(0,u.jsx)(Jce,{timeline:U,details:A,children:(0,u.jsx)(e7.Provider,{value:!1,children:(0,u.jsx)("div",{ref:P,className:q,style:ne,"data-web-shell-root":!0,"data-web-shell-shadcn":!0,"data-transcript-render-mode":t,"data-document-expanded":$?String(c):void 0,lang:G,children:(0,u.jsx)("div",{className:`${Vp.content} ${Vp.contentHasMessages}`,children:(0,u.jsx)(lRe,{messages:Q,sourceSessionId:g,sourceEntries:$?void 0:W,onSourceOpen:k,pendingApproval:null,isResponding:!1,workspaceCwd:i,virtualScrollThreshold:$?Number.MAX_SAFE_INTEGER:p,hideSessionTimeline:$})})})})})})})})})})})})}function oW(e){let t=rW(e.language);return(0,u.jsx)(zd,{label:"web-shell-transcript-root",resetKeys:[e.blocks,t],fallback:(a,n)=>(0,u.jsx)(pRe,{error:a,onRetry:n,language:t}),children:(0,u.jsx)(TRe,{...e})})}var wt=Be(Ga(),1),lW="qwen-export-theme";function Xd(e){return e===void 0||typeof e=="string"}function Yd(e){return e===void 0||typeof e=="number"&&Number.isFinite(e)&&e>=0}function IRe(){let e=document.getElementById("transcript-document");if(!(e instanceof HTMLScriptElement))throw new Error("Transcript document envelope is missing.");let t=e.textContent??"";if(t.length>33554432)throw new Error("Transcript document exceeds the envelope budget.");if(new TextEncoder().encode(t).byteLength>33554432)throw new Error("Transcript document exceeds the envelope budget.");let a=JSON.parse(t);if(a.schemaVersion!==1||a.rendererVersion!=="0.25.4-preview.1+2af183f50c53582d"||!Array.isArray(a.blocks)||a.blocks.length>1e3||!a.metadata||typeof a.metadata!="object"||Array.isArray(a.metadata)||!Xd(a.metadata.title)||!Xd(a.metadata.startedAt)||!Xd(a.metadata.projectName)||!Xd(a.metadata.repository)||!Xd(a.metadata.gitBranch)||!Xd(a.metadata.model)||!Xd(a.metadata.channel)||!Yd(a.metadata.promptCount)||!Yd(a.metadata.contextUsagePercent)||!Yd(a.metadata.contextWindowSize)||!Yd(a.metadata.totalTokens)||!Yd(a.metadata.filesWritten)||!Yd(a.metadata.linesAdded)||!Yd(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 _Re(){try{let e=localStorage.getItem(lW);if(e==="light"||e==="dark")return e}catch{}return"dark"}function sW(e){if(!e)return;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function LRe(e){if(e!==void 0)return e>=1e6?`${e/1e6}m`:e>=1e3?`${e/1e3}k`:String(e)}function xo({label:e,value:t}){return t===void 0||t===""?null:(0,wt.jsxs)("div",{className:"document-metadata-item",children:[(0,wt.jsx)("dt",{children:e}),(0,wt.jsx)("dd",{children:t})]})}function ARe({metadata:e}){let t=e.contextUsagePercent===void 0?void 0:`${e.contextUsagePercent>100?">100":e.contextUsagePercent}%${e.contextWindowSize===void 0?"":` of ${LRe(e.contextWindowSize)}`}`;return(0,wt.jsxs)("aside",{className:"document-metadata","data-document-metadata":!0,children:[(0,wt.jsxs)("section",{children:[(0,wt.jsx)("h2",{children:"Session Info"}),(0,wt.jsxs)("dl",{children:[(0,wt.jsx)(xo,{label:"Session",value:e.title??"Qwen Code Chat Export"}),(0,wt.jsx)(xo,{label:"Started",value:sW(e.startedAt)}),(0,wt.jsx)(xo,{label:"Exported",value:sW(e.exportedAt)}),(0,wt.jsx)(xo,{label:"Project",value:e.projectName}),(0,wt.jsx)(xo,{label:"Repository",value:e.repository}),(0,wt.jsx)(xo,{label:"Branch",value:e.gitBranch}),(0,wt.jsx)(xo,{label:"Model",value:e.model}),(0,wt.jsx)(xo,{label:"Channel",value:e.channel})]})]}),(0,wt.jsxs)("section",{children:[(0,wt.jsx)("h2",{children:"Statistics"}),(0,wt.jsxs)("dl",{children:[(0,wt.jsx)(xo,{label:"Prompts",value:e.promptCount}),(0,wt.jsx)(xo,{label:"Context Usage",value:t}),(0,wt.jsx)(xo,{label:"Tokens",value:e.totalTokens?.toLocaleString()})]})]}),(0,wt.jsxs)("section",{children:[(0,wt.jsx)("h2",{children:"File Operations"}),(0,wt.jsxs)("dl",{children:[(0,wt.jsx)(xo,{label:"Files modified",value:e.filesWritten}),(0,wt.jsx)(xo,{label:"Lines added",value:e.linesAdded}),(0,wt.jsx)(xo,{label:"Lines removed",value:e.linesRemoved})]})]})]})}function RRe({value:e}){let[t,a]=(0,So.useState)(_Re),[n,r]=(0,So.useState)(!0),o=(0,So.useRef)(n),s=(0,So.useRef)(null);return(0,So.useEffect)(()=>{document.documentElement.classList.toggle("dark",t==="dark"),document.documentElement.classList.toggle("light",t==="light");try{localStorage.setItem(lW,t)}catch{}},[t]),(0,So.useEffect)(()=>{o.current=n},[n]),(0,So.useEffect)(()=>{let i=()=>{s.current=o.current,(0,Z7.flushSync)(()=>r(!0))},l=()=>{let c=s.current;s.current=null,c!==null&&(0,Z7.flushSync)(()=>r(c))};return addEventListener("beforeprint",i),addEventListener("afterprint",l),()=>{removeEventListener("beforeprint",i),removeEventListener("afterprint",l)}},[]),(0,So.useEffect)(()=>{document.title=e.metadata.title||"Qwen Code Chat Export",requestAnimationFrame(()=>{document.body.dataset.renderComplete="true"})},[e.metadata.title]),(0,wt.jsxs)("main",{className:"document-shell",children:[(0,wt.jsxs)("header",{className:"document-header",children:[(0,wt.jsxs)("div",{children:[(0,wt.jsx)("h1",{children:e.metadata.title||"Qwen Code Chat Export"}),(0,wt.jsx)("p",{children:e.metadata.startedAt?`Started ${e.metadata.startedAt}`:`Exported ${e.metadata.exportedAt}`})]}),(!e.metadata.complete||e.metadata.truncated)&&(0,wt.jsx)("span",{className:"document-warning",children:"Partial export"}),(0,wt.jsxs)("div",{className:"document-actions","aria-label":"Document controls",children:[(0,wt.jsx)("button",{type:"button","data-document-expand-all":!0,disabled:n,onClick:()=>r(!0),children:"Expand all"}),(0,wt.jsx)("button",{type:"button","data-document-collapse-all":!0,disabled:!n,onClick:()=>r(!1),children:"Collapse all"}),(0,wt.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,wt.jsxs)("div",{className:"document-content",children:[(0,wt.jsx)("div",{className:"document-transcript",children:(0,wt.jsx)(oW,{blocks:e.blocks,renderMode:"document",compactThinking:!0,documentExpanded:n,theme:t})}),(0,wt.jsx)(ARe,{metadata:e.metadata})]})]})}function cW(){return(0,So.useEffect)(()=>{document.body.dataset.renderComplete="error"},[]),(0,wt.jsxs)("main",{className:"document-error",role:"alert",children:[(0,wt.jsx)("h1",{children:"Unable to open this chat export"}),(0,wt.jsx)("p",{children:"The file is incomplete or uses an incompatible renderer version."})]})}var J7=class extends So.Component{constructor(){super(...arguments);this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,wt.jsx)(cW,{}):this.props.children}},uW=document.getElementById("app");if(!uW)throw new Error("Transcript document root is missing.");if(document.body.dataset.renderComplete!=="error"){let e=(0,iW.createRoot)(uW);try{e.render((0,wt.jsx)(J7,{children:(0,wt.jsx)(RRe,{value:IRe()})}))}catch{e.render((0,wt.jsx)(cW,{}))}}})();