@qwen-code/qwen-code 0.26.2-preview.0 → 0.26.2-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 (300) hide show
  1. package/chunks/{MaxSizedBox-K6YUM3DX.js → MaxSizedBox-EGHZ2BPF.js} +1 -1
  2. package/chunks/{StandaloneSessionPicker-75IC33SN.js → StandaloneSessionPicker-UVCW6YW3.js} +1 -1
  3. package/chunks/{acp-subagent-executor-3NHBJRPL.js → acp-subagent-executor-AQ7AWSD4.js} +1 -1
  4. package/chunks/{acpAgent-JT6KQPTH.js → acpAgent-IV7JAGD7.js} +3 -3
  5. package/chunks/{advisor-TI2UVEZK.js → advisor-UZ4TF65D.js} +1 -1
  6. package/chunks/{agent-SWIZZZMY.js → agent-CNLVAWDD.js} +1 -1
  7. package/chunks/{agent-headless-USWEJ4GW.js → agent-headless-ZJUJLUJS.js} +1 -1
  8. package/chunks/{agent-host-client-ZFIMQX33.js → agent-host-client-SN5V2KBH.js} +1 -1
  9. package/chunks/{agent-host-connections-LOFD7O7Q.js → agent-host-connections-VKMAJIIU.js} +1 -1
  10. package/chunks/{anthropicContentGenerator-HMLEI4FI.js → anthropicContentGenerator-QTJVPAMI.js} +1 -1
  11. package/chunks/{autofix-pr-NKR2VSLB.js → autofix-pr-U7GNSH27.js} +1 -1
  12. package/chunks/{batch-JQZ3TOHA.js → batch-MBEWETXN.js} +1 -1
  13. package/chunks/{bridge-EIWWT4P6.js → bridge-TEJLNYV3.js} +1 -1
  14. package/chunks/{channel-settings-store-FLRLUA67.js → channel-settings-store-QNCKWWBL.js} +1 -1
  15. package/chunks/{chunk-244YTFYD.js → chunk-23KDY7UW.js} +1 -1
  16. package/chunks/{chunk-7TDMQJTD.js → chunk-2DWWSMTV.js} +1 -1
  17. package/chunks/{chunk-UU2LTNSF.js → chunk-3IZMVLVZ.js} +1 -1
  18. package/chunks/{chunk-B6T4ESBM.js → chunk-3JI7IKJL.js} +1 -1
  19. package/chunks/{chunk-Y5TT2G3N.js → chunk-427MARCP.js} +1 -1
  20. package/chunks/{chunk-KX7JS2P7.js → chunk-4NNNGSQY.js} +3 -3
  21. package/chunks/{chunk-6TQS2WQO.js → chunk-4RM7KY3Z.js} +2 -2
  22. package/chunks/{chunk-YL3N2UGG.js → chunk-5X7S4AE6.js} +5 -5
  23. package/chunks/{chunk-K2HAY5PY.js → chunk-5XAECBED.js} +1 -1
  24. package/chunks/{chunk-VCHFBETO.js → chunk-66KKSLUO.js} +1 -1
  25. package/chunks/{chunk-BSJR2KEF.js → chunk-6CIIDUZW.js} +1 -1
  26. package/chunks/{chunk-22CLK7PK.js → chunk-7EBRMQYW.js} +1 -1
  27. package/chunks/{chunk-J4TFGZ4A.js → chunk-7FSC2NKA.js} +1 -1
  28. package/chunks/{chunk-6JFC5M6B.js → chunk-A5TAAMML.js} +1 -1
  29. package/chunks/{chunk-DHHACQVN.js → chunk-AOYSX44A.js} +1 -1
  30. package/chunks/{chunk-VFVZ2DY7.js → chunk-AZCMQ3DD.js} +2 -2
  31. package/chunks/{chunk-BQJXWIMR.js → chunk-B6F7CVBP.js} +1 -1
  32. package/chunks/{chunk-OVPEAKOQ.js → chunk-BDQOLT37.js} +1 -1
  33. package/chunks/{chunk-5SYUBQNO.js → chunk-BIWEUAKG.js} +1 -1
  34. package/chunks/{chunk-BZM66PQO.js → chunk-BJ5R7LOM.js} +1 -1
  35. package/chunks/{chunk-4R2OHBH3.js → chunk-BKUFRNME.js} +1 -1
  36. package/chunks/{chunk-NIYWNFVF.js → chunk-BNZSPX2I.js} +1 -1
  37. package/chunks/{chunk-FJV2ECNY.js → chunk-D2URRVOK.js} +1 -1
  38. package/chunks/{chunk-GT6CHVAI.js → chunk-DANP7CMW.js} +1 -1
  39. package/chunks/{chunk-FHFLD4DR.js → chunk-DBHLRZGI.js} +1 -1
  40. package/chunks/{chunk-Y2UXZJLM.js → chunk-DL7TKH2E.js} +2 -2
  41. package/chunks/{chunk-MCQE2U7N.js → chunk-DOWKH5OZ.js} +6 -6
  42. package/chunks/{chunk-UHRLBY3C.js → chunk-DPHQJPCU.js} +1 -1
  43. package/chunks/{chunk-PV2VT25U.js → chunk-DPNGBOI7.js} +1 -1
  44. package/chunks/{chunk-NCDNF7UJ.js → chunk-DXRXF4QD.js} +1 -1
  45. package/chunks/{chunk-OCVRMNEQ.js → chunk-DZ3GV34J.js} +1 -1
  46. package/chunks/{chunk-3QIAXWWW.js → chunk-EU2MKUK4.js} +1 -1
  47. package/chunks/{chunk-KMAVI6FB.js → chunk-EVBUXPGM.js} +1 -1
  48. package/chunks/{chunk-BVSTV4JM.js → chunk-F3ZRU2SA.js} +1 -1
  49. package/chunks/{chunk-TBZY477Y.js → chunk-FCZYH27X.js} +1 -1
  50. package/chunks/{chunk-JCOK67LT.js → chunk-FNDMWG43.js} +1 -1
  51. package/chunks/{chunk-5SF32OGU.js → chunk-GDXLJJSW.js} +1 -1
  52. package/chunks/{chunk-SO6FCPRI.js → chunk-GZYIXB7Y.js} +1 -1
  53. package/chunks/{chunk-WZPTWC7X.js → chunk-HHNAH4IH.js} +1 -1
  54. package/chunks/{chunk-7KCAOXNL.js → chunk-HOKROBQZ.js} +1 -1
  55. package/chunks/{chunk-34ZBUQJV.js → chunk-IGPAATQW.js} +1 -1
  56. package/chunks/{chunk-2ZTRKK2O.js → chunk-INFBJDWM.js} +1 -1
  57. package/chunks/{chunk-IEJ2CGRN.js → chunk-J3R7ZNSA.js} +1 -1
  58. package/chunks/{chunk-KT5MPRYB.js → chunk-JCRS367I.js} +1 -1
  59. package/chunks/{chunk-7JWJTRP6.js → chunk-JFVXZFMV.js} +1 -1
  60. package/chunks/{chunk-47LP4MBD.js → chunk-JKMGS2VD.js} +1 -1
  61. package/chunks/{chunk-WRJ3PMDZ.js → chunk-JUQ7T2MV.js} +1 -1
  62. package/chunks/{chunk-NZX3UWNF.js → chunk-KQ4TDFNE.js} +1 -1
  63. package/chunks/{chunk-X7D4VKMX.js → chunk-L6BKKN42.js} +1 -1
  64. package/chunks/{chunk-YG5HVFMY.js → chunk-L7Y6MOHS.js} +1 -1
  65. package/chunks/{chunk-UFTIUKD4.js → chunk-LGYXZJI3.js} +1 -1
  66. package/chunks/{chunk-JQGGILML.js → chunk-LPOEVTKD.js} +1 -1
  67. package/chunks/{chunk-5KI55A6S.js → chunk-LRXS7ZI2.js} +1 -1
  68. package/chunks/{chunk-CKVHEYXW.js → chunk-LYYVSCNL.js} +1 -1
  69. package/chunks/{chunk-LIIMQ4DI.js → chunk-LZNBHBAJ.js} +6 -6
  70. package/chunks/{chunk-H4GDEXMF.js → chunk-M3C6RDGC.js} +1 -1
  71. package/chunks/{chunk-KKKUB3RQ.js → chunk-MNVMHVQJ.js} +1 -1
  72. package/chunks/{chunk-2B3W7IQY.js → chunk-MVGQFFIK.js} +1 -1
  73. package/chunks/{chunk-Q35A2RGO.js → chunk-NC7BCZPQ.js} +1 -1
  74. package/chunks/{chunk-2ZOTG3NW.js → chunk-NE627MUW.js} +1 -1
  75. package/chunks/{chunk-W4P2EN3V.js → chunk-NZNRCPGE.js} +1 -1
  76. package/chunks/{chunk-YPDQJQ3S.js → chunk-P3M4WWRA.js} +1 -1
  77. package/chunks/{chunk-DVB36ASH.js → chunk-P534ONQN.js} +1 -1
  78. package/chunks/{chunk-EL5J4ESB.js → chunk-QF44NNSC.js} +1 -1
  79. package/chunks/{chunk-IQPJOBPI.js → chunk-QHGCDHNW.js} +1 -1
  80. package/chunks/{chunk-EVZC4KEQ.js → chunk-QWJX7NIP.js} +1 -1
  81. package/chunks/{chunk-J2TJL2F4.js → chunk-S53G54DW.js} +2 -2
  82. package/chunks/{chunk-3A6LFJJV.js → chunk-SMNFL3AD.js} +1 -1
  83. package/chunks/{chunk-WDO3K3P2.js → chunk-TOBNWST4.js} +1 -1
  84. package/chunks/{chunk-AVGJ4HE3.js → chunk-TQSBUHAM.js} +1 -1
  85. package/chunks/{chunk-ABUS7DNN.js → chunk-TW5QEP2J.js} +1 -1
  86. package/chunks/{chunk-WYM4Z4D5.js → chunk-UEB2F43V.js} +1 -1
  87. package/chunks/{chunk-FUUPMVD2.js → chunk-UPPE4I6H.js} +1 -1
  88. package/chunks/{chunk-UHBJVFZA.js → chunk-US42COBM.js} +1 -1
  89. package/chunks/{chunk-RMQNBSMK.js → chunk-UUY6XSQI.js} +1 -1
  90. package/chunks/{chunk-UVQUQNCA.js → chunk-UZI3IA27.js} +1 -1
  91. package/chunks/{chunk-SXJ2E33J.js → chunk-V6VMUJ47.js} +1 -1
  92. package/chunks/{chunk-5UFCNJGN.js → chunk-VG2ZINTO.js} +1 -1
  93. package/chunks/{chunk-JPPPJ2GN.js → chunk-VJI6MHWX.js} +1 -1
  94. package/chunks/{chunk-AUI7WVSU.js → chunk-VOBNHBCJ.js} +1 -1
  95. package/chunks/{chunk-3BNJDZHU.js → chunk-VUEZWMI4.js} +1 -1
  96. package/chunks/{chunk-LMNKCL55.js → chunk-W7ZX6WB3.js} +2 -2
  97. package/chunks/{chunk-HVS6V2UZ.js → chunk-WA2LKUVP.js} +1 -1
  98. package/chunks/{chunk-7APLU2XE.js → chunk-WFFCJ5PF.js} +1 -1
  99. package/chunks/{chunk-3TD4WAG5.js → chunk-WQY5GE65.js} +1 -1
  100. package/chunks/{chunk-3YWRMF6C.js → chunk-WSESLSKK.js} +1 -1
  101. package/chunks/{chunk-NILCQMZ7.js → chunk-XFJV5NYT.js} +1 -1
  102. package/chunks/{chunk-LGBGUITT.js → chunk-XIYLRIW4.js} +1 -1
  103. package/chunks/{chunk-KS74L67R.js → chunk-XQ2NYKJH.js} +1 -1
  104. package/chunks/{chunk-JB2NOB6W.js → chunk-Y3VRWG52.js} +1 -1
  105. package/chunks/{chunk-GVZ6D2NL.js → chunk-YBISME5B.js} +1 -1
  106. package/chunks/{chunk-2C2253QI.js → chunk-YJNWPSB3.js} +1 -1
  107. package/chunks/{chunk-O2T3GQ6F.js → chunk-YWVV5STA.js} +1 -1
  108. package/chunks/{chunk-MAQZSOHI.js → chunk-ZH4J3FL6.js} +1 -1
  109. package/chunks/{chunk-THNEKTPK.js → chunk-ZSKCF6DI.js} +1 -1
  110. package/chunks/{chunk-Z7BAHKO5.js → chunk-ZW6456SD.js} +1 -1
  111. package/chunks/{chunk-DMSZ2TB3.js → chunk-ZWM3LLT7.js} +1 -1
  112. package/chunks/{codex-subagent-executor-DQ5LQQWO.js → codex-subagent-executor-DWWT7246.js} +1 -1
  113. package/chunks/{config-utils-CY6HLKZ5.js → config-utils-NGZB522W.js} +1 -1
  114. package/chunks/{contextCommand-SGBWI7O6.js → contextCommand-7QCW2YNX.js} +1 -1
  115. package/chunks/{core-runtime-4DP27LCC.js → core-runtime-PSVNDJPD.js} +1 -1
  116. package/chunks/{create-sub-session-ECPDZMBX.js → create-sub-session-JTSEMEJE.js} +1 -1
  117. package/chunks/{cron-create-OO4OG3EI.js → cron-create-VGIDTUMX.js} +1 -1
  118. package/chunks/{daemon-git-worktree-guard-OYDNHT7P.js → daemon-git-worktree-guard-IQRGS7IH.js} +1 -1
  119. package/chunks/{daemon-status-provider-JGDLXPC6.js → daemon-status-provider-R4MYCYPG.js} +1 -1
  120. package/chunks/{daemon-trust-policy-5HRARS54.js → daemon-trust-policy-VAUKFZ2N.js} +1 -1
  121. package/chunks/{daemon-trust-policy-monitor-RM7FVIIC.js → daemon-trust-policy-monitor-E5HIO6RP.js} +1 -1
  122. package/chunks/{deferred-core-runtime-3CXBZIOG.js → deferred-core-runtime-FLOFQJPU.js} +1 -1
  123. package/chunks/{edit-DJPESAAY.js → edit-OOVQUGKV.js} +1 -1
  124. package/chunks/{enterPlanMode-IHBLRIF3.js → enterPlanMode-AUWVTQLT.js} +1 -1
  125. package/chunks/{environment-JN5SD347.js → environment-RM5OXYP4.js} +1 -1
  126. package/chunks/{errors-NUJCME3Y.js → errors-CLDJGHVD.js} +1 -1
  127. package/chunks/{execution-tool-I3SWG6I3.js → execution-tool-JFBVOKPW.js} +1 -1
  128. package/chunks/{execution-worker-62UZMAMJ.js → execution-worker-MNJZD72W.js} +1 -1
  129. package/chunks/{exitPlanMode-JIC4V3FE.js → exitPlanMode-PC6XG4TW.js} +1 -1
  130. package/chunks/{fast-path-NIOIL5YI.js → fast-path-V4DN3CRZ.js} +1 -1
  131. package/chunks/{glob-EQ4QNAHF.js → glob-DTZROBDS.js} +1 -1
  132. package/chunks/{goal-tools-DYTTSBQG.js → goal-tools-FUVGTY33.js} +1 -1
  133. package/chunks/{handleAutoUpdate-44BTG5L5.js → handleAutoUpdate-U4LVTHGU.js} +1 -1
  134. package/chunks/{i18n-FTHZAHCT.js → i18n-XOKNDFYP.js} +1 -1
  135. package/chunks/{initializer-MSGKXC75.js → initializer-XBR5J4CY.js} +1 -1
  136. package/chunks/{installationInfo-4XJMJJYU.js → installationInfo-4AOEOUI6.js} +1 -1
  137. package/chunks/{interactive-mod-session-DFLRYO2Q.js → interactive-mod-session-YGZK2JK2.js} +1 -1
  138. package/chunks/{list-ODZ7Z6VI.js → list-TCGKVPH4.js} +1 -1
  139. package/chunks/{llm-O64DHKP7.js → llm-SKFTN5UN.js} +4 -4
  140. package/chunks/{llm-content-generator-SK24I6QS.js → llm-content-generator-GWHXT3WS.js} +1 -1
  141. package/chunks/{loadedSettingsAdapter-6PEBUZT5.js → loadedSettingsAdapter-ZALZGZE7.js} +1 -1
  142. package/chunks/{local-ED3UEKWP.js → local-RWTWYS5Z.js} +1 -1
  143. package/chunks/{local-execution-environment-PUKES5LO.js → local-execution-environment-R6JWLD65.js} +1 -1
  144. package/chunks/{loggingContentGenerator-UHOJVSRR.js → loggingContentGenerator-UJV6QFOY.js} +1 -1
  145. package/chunks/{loop-wakeup-NSJQETPZ.js → loop-wakeup-BU2RRYHA.js} +1 -1
  146. package/chunks/{manage-memory-5RRB6FLH.js → manage-memory-XI57JN4T.js} +1 -1
  147. package/chunks/{managed-execution-engine-MZAP7SK6.js → managed-execution-engine-BA5PABMP.js} +1 -1
  148. package/chunks/{managed-local-serve-XMES3HXL.js → managed-local-serve-MFKN22K6.js} +1 -1
  149. package/chunks/{managed-npm-update-R5KGY7G2.js → managed-npm-update-ZGN43NUA.js} +1 -1
  150. package/chunks/{managed-runtime-attestation-worker-O2KNHHV6.js → managed-runtime-attestation-worker-YN2VBGYN.js} +1 -1
  151. package/chunks/{managed-runtime-bootstrap-HOTLM6DE.js → managed-runtime-bootstrap-SGQVMUJE.js} +1 -1
  152. package/chunks/{managed-runtime-session-worker-QZX44ZTD.js → managed-runtime-session-worker-4UMF3VBY.js} +1 -1
  153. package/chunks/{managed-runtime-ssh-worker-U425WQ65.js → managed-runtime-ssh-worker-7XA6KRBN.js} +1 -1
  154. package/chunks/{managed-session-authority-THHDHCBP.js → managed-session-authority-IJGYAOEL.js} +1 -1
  155. package/chunks/{mcp-AR7EK4WY.js → mcp-V3L7B5YK.js} +1 -1
  156. package/chunks/{memory-C2TSF6BK.js → memory-3T6FPNAK.js} +1 -1
  157. package/chunks/{model-call-collection-25WR55OH.js → model-call-collection-WTTITWWM.js} +1 -1
  158. package/chunks/{model-configuration-KC7DQGKV.js → model-configuration-T6SSGI4J.js} +1 -1
  159. package/chunks/{modelConfigUtils-QEHMVLSQ.js → modelConfigUtils-TQA25QJC.js} +1 -1
  160. package/chunks/{monitor-PDQUZD23.js → monitor-5ZAOJSEE.js} +1 -1
  161. package/chunks/{nonInteractiveCli-WY2YFONU.js → nonInteractiveCli-YFINLVA7.js} +1 -1
  162. package/chunks/{nonInteractiveToolExecutor-7RJZYPHJ.js → nonInteractiveToolExecutor-DE3WACL5.js} +1 -1
  163. package/chunks/{notebook-edit-P4ITXF5H.js → notebook-edit-UK6HBRO3.js} +1 -1
  164. package/chunks/{omni-AYUPB2QM.js → omni-65LF5QK4.js} +1 -1
  165. package/chunks/{openaiContentGenerator-V5IK4ITO.js → openaiContentGenerator-HX7NCSV5.js} +1 -1
  166. package/chunks/{openaiResponsesContentGenerator-DYDH6KWT.js → openaiResponsesContentGenerator-CFA6U6Y5.js} +1 -1
  167. package/chunks/{pidfile-INPBL2DK.js → pidfile-ZVKJUNTZ.js} +1 -1
  168. package/chunks/{processUtils-J4UDEDS4.js → processUtils-VS6CJT7E.js} +1 -1
  169. package/chunks/{prompt-terminal-ledger-QLOQWHYE.js → prompt-terminal-ledger-UF5RDB57.js} +1 -1
  170. package/chunks/{qwenContentGenerator-RU43XKKB.js → qwenContentGenerator-GM3ZSI7E.js} +1 -1
  171. package/chunks/{reactive-degrade-2Q3Z3KAR.js → reactive-degrade-TSAQWZ5F.js} +1 -1
  172. package/chunks/{read-file-472BQ25I.js → read-file-J267NT45.js} +1 -1
  173. package/chunks/{resumeHistoryUtils-7SUFKZDC.js → resumeHistoryUtils-IM46VFDV.js} +1 -1
  174. package/chunks/{review-WX52IWJR.js → review-4B64XTCL.js} +1 -1
  175. package/chunks/{ripGrep-4GPGLKAM.js → ripGrep-YLOSXO7P.js} +1 -1
  176. package/chunks/{run-qwen-serve-MXK4RBKL.js → run-qwen-serve-SAHEC44O.js} +1 -1
  177. package/chunks/{runtime-WHU3AGFT.js → runtime-SJDZHV6J.js} +1 -1
  178. package/chunks/{sandboxConfig-7DBXEQJH.js → sandboxConfig-47EXXMUA.js} +1 -1
  179. package/chunks/{scheduled-tasks-O5RV6G6U.js → scheduled-tasks-E6RCTUUS.js} +1 -1
  180. package/chunks/{scheduler-HLMS5LR5.js → scheduler-SE3IWIWA.js} +1 -1
  181. package/chunks/{search-memory-PYND7ZX3.js → search-memory-2W7VJC4Q.js} +1 -1
  182. package/chunks/{send-message-TMLYTQOI.js → send-message-63YGQP6G.js} +1 -1
  183. package/chunks/{serve-EBNBRAME.js → serve-F4ML2WNL.js} +1 -1
  184. package/chunks/{server-63BRDBL5.js → server-S56IB4TT.js} +3 -3
  185. package/chunks/{session-XB6J4CZD.js → session-2CUVLZ4H.js} +1 -1
  186. package/chunks/{session-attachments-root-PFK475N2.js → session-attachments-root-FINBX7K5.js} +1 -1
  187. package/chunks/{session-execution-engine-selector-P6TJTCKR.js → session-execution-engine-selector-UGC7DGUN.js} +1 -1
  188. package/chunks/{session-pr-refresh-PM7VAQTV.js → session-pr-refresh-KQLQ4MZY.js} +1 -1
  189. package/chunks/{sessionService-PO3LLZIZ.js → sessionService-Q6N7LF7Z.js} +1 -1
  190. package/chunks/{settings-JDQSRXP3.js → settings-23I6H76E.js} +1 -1
  191. package/chunks/{shell-JCEX3HKM.js → shell-IUECEVVY.js} +1 -1
  192. package/chunks/{skill-JSZBONIZ.js → skill-YKUETMPC.js} +1 -1
  193. package/chunks/{skill-settings-YGFG6GPN.js → skill-settings-ODYXOPCA.js} +1 -1
  194. package/chunks/{spawnChannel-VIIWSWTL.js → spawnChannel-7XU2SRWZ.js} +1 -1
  195. package/chunks/{standalone-update-2UU6FQZL.js → standalone-update-SWI2RL3L.js} +1 -1
  196. package/chunks/{start-opentui-ui-OSZZNSLY.js → start-opentui-ui-T53QJGCH.js} +1 -1
  197. package/chunks/{startInteractiveUI-FFH66MYH.js → startInteractiveUI-USTZGQOE.js} +1 -1
  198. package/chunks/{team-create-TKGDJ3NU.js → team-create-4A2XUE3D.js} +1 -1
  199. package/chunks/{team-plan-approval-3VJF4G6Z.js → team-plan-approval-4TS5CYN6.js} +1 -1
  200. package/chunks/{terminal-image-renderer-T3VJRZGP.js → terminal-image-renderer-C7553YV6.js} +1 -1
  201. package/chunks/{theme-manager-ZGUFLFUI.js → theme-manager-GTW75GOO.js} +1 -1
  202. package/chunks/{tool-call-3EQS5KSE.js → tool-call-YTUMWL3A.js} +1 -1
  203. package/chunks/{tool-result-media-7LFNVQ6E.js → tool-result-media-JYOYBX4J.js} +1 -1
  204. package/chunks/{tool-search-UDZ4S7T5.js → tool-search-Y4XTT2WF.js} +1 -1
  205. package/chunks/{total-session-admission-U4MII4RA.js → total-session-admission-EMJ5NRGL.js} +1 -1
  206. package/chunks/{trustedFolders-2NQJCIN3.js → trustedFolders-YG6WAVRE.js} +1 -1
  207. package/chunks/{update-relaunch-YKLWSCLC.js → update-relaunch-4QYQRCP4.js} +1 -1
  208. package/chunks/{updateCheck-YDLTQQRU.js → updateCheck-VRFPSX4G.js} +1 -1
  209. package/chunks/{upload-config-5QQKWF4O.js → upload-config-UCKGUYYQ.js} +1 -1
  210. package/chunks/{useAutoAcceptIndicator-AJS4WTU2.js → useAutoAcceptIndicator-2VGLKD7B.js} +1 -1
  211. package/chunks/{validateNonInterActiveAuth-AETOT7ZW.js → validateNonInterActiveAuth-GGMQXKKU.js} +1 -1
  212. package/chunks/{version-IB6DLRAG.js → version-Y46PG7II.js} +1 -1
  213. package/chunks/{web-fetch-LS3QARNR.js → web-fetch-7MPU555L.js} +1 -1
  214. package/chunks/{web-search-FGHRIVEB.js → web-search-HU2CL2X2.js} +1 -1
  215. package/chunks/{workflow-FX6XNETQ.js → workflow-U3D34QQX.js} +1 -1
  216. package/chunks/{workflow-ancestor-trust-5XXBGN6F.js → workflow-ancestor-trust-OWC4YTMR.js} +1 -1
  217. package/chunks/{workspace-agents-UJKLYPUK.js → workspace-agents-KHLAWSAR.js} +1 -1
  218. package/chunks/{workspace-providers-status-4JOHMTAW.js → workspace-providers-status-T57SE3YX.js} +1 -1
  219. package/chunks/{workspace-recovery-worker-XFEYQ4TP.js → workspace-recovery-worker-VYQ723ZE.js} +1 -1
  220. package/chunks/{workspace-registration-store-LWAPVNYC.js → workspace-registration-store-I7PR3A2Y.js} +1 -1
  221. package/chunks/{workspace-registry-M7OC376O.js → workspace-registry-YYUBXCLH.js} +1 -1
  222. package/chunks/{workspace-runtime-coordinator-CYHIL47L.js → workspace-runtime-coordinator-5ICAQO7W.js} +1 -1
  223. package/chunks/{workspace-service-43VZZ56B.js → workspace-service-YROWXOLQ.js} +1 -1
  224. package/chunks/{workspace-skills-status-V2TT6UJQ.js → workspace-skills-status-DKKQDTZJ.js} +1 -1
  225. package/chunks/{workspace-trust-reconciler-YZ4AG5ZW.js → workspace-trust-reconciler-3FPMUZDO.js} +1 -1
  226. package/chunks/{write-file-TGEH5MEZ.js → write-file-7QQVYFDT.js} +1 -1
  227. package/chunks/{zoom-image-TT6R7H2H.js → zoom-image-WL5EB6Q7.js} +1 -1
  228. package/cli.js +2 -2
  229. package/execution-worker.js +1 -1
  230. package/export-transcript-document.js +1 -1
  231. package/package.json +3 -3
  232. package/web-shell/assets/{PierreFilePreview-OsApm5-S.js → PierreFilePreview-BZ17f56_.js} +1 -1
  233. package/web-shell/assets/{SpreadsheetPreview-I1v1EzV7.js → SpreadsheetPreview-Bvkvr_5u.js} +1 -1
  234. package/web-shell/assets/{WorkspaceFileBrowser-BO6aug7i.js → WorkspaceFileBrowser-BJ_I4Uoz.js} +1 -1
  235. package/web-shell/assets/{abnfDiagram-VCTEODGH-DxuLMyN0.js → abnfDiagram-VCTEODGH-iuaBM15V.js} +1 -1
  236. package/web-shell/assets/{agents-route-CSJf6QPO.js → agents-route-CycwfNSC.js} +1 -1
  237. package/web-shell/assets/{arc-3--LekYQ.js → arc-C0lt8n55.js} +1 -1
  238. package/web-shell/assets/{architectureDiagram-5GKGNRK7-Dihq4uto.js → architectureDiagram-5GKGNRK7-Bw326d-A.js} +1 -1
  239. package/web-shell/assets/{blockDiagram-NRAW4CY4-BnaRPM2o.js → blockDiagram-NRAW4CY4-CHtFgBjV.js} +1 -1
  240. package/web-shell/assets/{c4Diagram-UCG6FXSJ-BtC94eMa.js → c4Diagram-UCG6FXSJ-Bx66oJT9.js} +1 -1
  241. package/web-shell/assets/channel-CRJuO00u.js +1 -0
  242. package/web-shell/assets/{chunk-2Q5K7J3B-2ZTXWP6M.js → chunk-2Q5K7J3B-BIshvfa_.js} +1 -1
  243. package/web-shell/assets/{chunk-5VM5RSS4-DBh7DP1F.js → chunk-5VM5RSS4-BZeRS6uD.js} +1 -1
  244. package/web-shell/assets/{chunk-F27PBJKO-xzqbWXBw.js → chunk-F27PBJKO-El-CGY2R.js} +1 -1
  245. package/web-shell/assets/{chunk-G27WJ6UU-DxnCrpxK.js → chunk-G27WJ6UU-DO8ZfQL_.js} +1 -1
  246. package/web-shell/assets/{chunk-JWPE2WC7-BPjRsozm.js → chunk-JWPE2WC7-yYFrrKAj.js} +1 -1
  247. package/web-shell/assets/{chunk-LCL6LL3I-Q2HgB3lf.js → chunk-LCL6LL3I-BFGuOKN0.js} +1 -1
  248. package/web-shell/assets/{chunk-POPQ4Y6H-9tlPaKu-.js → chunk-POPQ4Y6H-GRHK6sdV.js} +1 -1
  249. package/web-shell/assets/{chunk-SVP7TREG-DkNdOHCU.js → chunk-SVP7TREG-DwDu6GqZ.js} +1 -1
  250. package/web-shell/assets/{chunk-XXDRQBXY-D0G-Dhfi.js → chunk-XXDRQBXY-RoNDjkIy.js} +1 -1
  251. package/web-shell/assets/classDiagram-DTDB5LWJ-pPPByLA7.js +1 -0
  252. package/web-shell/assets/classDiagram-v2-JRS7N3AN-pPPByLA7.js +1 -0
  253. package/web-shell/assets/{cose-bilkent-JH36ORCC-Ck0tHxul.js → cose-bilkent-JH36ORCC-CYNiiONE.js} +1 -1
  254. package/web-shell/assets/{cynefin-OW5HDTMX-a4-NTMHi.js → cynefin-OW5HDTMX-DC1_lDIG.js} +1 -1
  255. package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-Pg41Zbf2.js → cynefinDiagram-5FMLGOSQ-D2VxKm2n.js} +1 -1
  256. package/web-shell/assets/{dagre-3AP2YEHR-DT_ZmqkF.js → dagre-3AP2YEHR-C4_BHzpM.js} +1 -1
  257. package/web-shell/assets/{diagram-S7CK7UJ4-hapdMOl1.js → diagram-S7CK7UJ4-BpAO4-Gv.js} +1 -1
  258. package/web-shell/assets/{diagram-UQ7AKVKN-YZ0nbk56.js → diagram-UQ7AKVKN-DqUsFdsX.js} +1 -1
  259. package/web-shell/assets/{diagram-VSXAHHWV-DA_yNbWy.js → diagram-VSXAHHWV-DcMXIYMy.js} +1 -1
  260. package/web-shell/assets/{diagram-VX7I27RA-DoULuCLT.js → diagram-VX7I27RA-I3nr09ex.js} +1 -1
  261. package/web-shell/assets/{diagram-Z3DM3KII-B5c9o9zL.js → diagram-Z3DM3KII-CN-gvsTo.js} +1 -1
  262. package/web-shell/assets/{docx-preview-BulxdBjs.js → docx-preview-31J6RsS0.js} +1 -1
  263. package/web-shell/assets/{ebnfDiagram-PWID7BFC-B5hgIg3m.js → ebnfDiagram-PWID7BFC-DOQvLWlM.js} +1 -1
  264. package/web-shell/assets/{erDiagram-SSCWMZ5O-BEfEPozi.js → erDiagram-SSCWMZ5O-Cb5ijFZh.js} +1 -1
  265. package/web-shell/assets/{flowDiagram-A5DVABFB-CQHNk92v.js → flowDiagram-A5DVABFB-BecqqjnZ.js} +1 -1
  266. package/web-shell/assets/{ganttDiagram-EL5Y4UJY-BabdVgIM.js → ganttDiagram-EL5Y4UJY-DWY5vzQl.js} +1 -1
  267. package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-ujRZBFUo.js → gitGraphDiagram-WWUBYQGX-DqBnsZmZ.js} +1 -1
  268. package/web-shell/assets/{index-B9uXebIR.js → index-DDmiUW3b.js} +6 -6
  269. package/web-shell/assets/{index-DSZXdZnu.js → index-DabH7kHA.js} +1 -1
  270. package/web-shell/assets/{infoDiagram-RXCK75RN-CUHj9jJC.js → infoDiagram-RXCK75RN-MlotyOdT.js} +1 -1
  271. package/web-shell/assets/{ishikawaDiagram-5VMMS53U-CulW_q81.js → ishikawaDiagram-5VMMS53U-Daq_85C7.js} +1 -1
  272. package/web-shell/assets/{journeyDiagram-EYS64GPL-BR46CvRQ.js → journeyDiagram-EYS64GPL-OipivCxL.js} +1 -1
  273. package/web-shell/assets/{kanban-definition-3QL26DDD-HAoUqzFy.js → kanban-definition-3QL26DDD-zqaz7dLu.js} +1 -1
  274. package/web-shell/assets/{layout-DYLl7fyA.js → layout-Bi3msQMQ.js} +1 -1
  275. package/web-shell/assets/{linear-DPXABjDZ.js → linear-D4gPORvD.js} +1 -1
  276. package/web-shell/assets/{mermaid.core-Bi30Gi0n.js → mermaid.core-BUnytF7a.js} +6 -6
  277. package/web-shell/assets/{mindmap-definition-FBJOCRG2-B1_lUq4o.js → mindmap-definition-FBJOCRG2-B_X4iChu.js} +1 -1
  278. package/web-shell/assets/{pegDiagram-XKGWAZYB-Cy8tjJJC.js → pegDiagram-XKGWAZYB-z4wYBoBW.js} +1 -1
  279. package/web-shell/assets/{pieDiagram-E7YTZNPT-D6waLVVi.js → pieDiagram-E7YTZNPT-Dvyg6FYo.js} +1 -1
  280. package/web-shell/assets/{quadrantDiagram-AXDQQJYC--6ehi_FI.js → quadrantDiagram-AXDQQJYC-CJBWU2Dk.js} +1 -1
  281. package/web-shell/assets/{railroadDiagram-O6MQD6OU-BhLy40X4.js → railroadDiagram-O6MQD6OU-Dl_An1O0.js} +1 -1
  282. package/web-shell/assets/{requirementDiagram-EFPCY7ZU-BVNXTgNP.js → requirementDiagram-EFPCY7ZU-Tw8FwaYU.js} +1 -1
  283. package/web-shell/assets/{sankeyDiagram-P5KCCOFB-BHgTytxV.js → sankeyDiagram-P5KCCOFB-BCPCkbR0.js} +1 -1
  284. package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-CgOsTvhu.js → sequenceDiagram-WJ2MYXX4-DDj7uFTG.js} +1 -1
  285. package/web-shell/assets/{sizeCapture-X5ZJPWSS-vCQBQ5FI.js → sizeCapture-X5ZJPWSS-B9eVSpKb.js} +1 -1
  286. package/web-shell/assets/{stateDiagram-HBIQ2CUA-DytMYRWJ.js → stateDiagram-HBIQ2CUA-Bf4BZP_V.js} +1 -1
  287. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-BPJi6Gre.js +1 -0
  288. package/web-shell/assets/{swimlanes-XN3QIQJK-CTGnifOP.js → swimlanes-XN3QIQJK-dyTWsZFj.js} +1 -1
  289. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-Bw4NRtJQ.js +8 -0
  290. package/web-shell/assets/{timeline-definition-24CTP7MA-DEJ1cbn2.js → timeline-definition-24CTP7MA-DVl1A4uL.js} +1 -1
  291. package/web-shell/assets/{vennDiagram-4TSXK5OY-K1e4SjS0.js → vennDiagram-4TSXK5OY-Boosxy9D.js} +1 -1
  292. package/web-shell/assets/{wardleyDiagram-VM6X3IG4-DEX-GkRp.js → wardleyDiagram-VM6X3IG4-C6wlY8jy.js} +1 -1
  293. package/web-shell/assets/{xychartDiagram-S5SC5T6Z-B6wYXreH.js → xychartDiagram-S5SC5T6Z-CkzZe3ro.js} +1 -1
  294. package/web-shell/index.html +1 -1
  295. package/web-shell/sw.js +1 -1
  296. package/web-shell/assets/channel-CLVrtVFX.js +0 -1
  297. package/web-shell/assets/classDiagram-DTDB5LWJ-Df2T70oB.js +0 -1
  298. package/web-shell/assets/classDiagram-v2-JRS7N3AN-Df2T70oB.js +0 -1
  299. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-CcjUJGng.js +0 -1
  300. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-Dt8NvQfX.js +0 -8
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{DescriptiveRadioButtonSelect,DualOutputBridge,EDITOR_DISPLAY_NAMES,EffortDialog,MAIN_CONTENT_HEIGHT_RESERVATION,MAX_STATUS_LINES,ProviderSetupSteps,RANGE_CYCLE,RemoteInputWatcher,STATIC_EXTRA_HEIGHT,STATUS_LINE_DIALOG_FIXED_ROWS,STATUS_LINE_OPTIONS,SuggestionsDisplay,TAB_DEFS,TableRow,VISIBLE_RESOURCES_COUNT,VISIBLE_TOOLS_COUNT,VimModeProvider,buildConfigFromKeys,buildInitialSelectedKeys,buildThoughtHeadIdMap,calculatePromptWidths,clampDialogHeight,classifyPastedImagePaths,computeWindowTitle,editorSettingsManager,expandPendingPastePlaceholders,extensionComponentsSummary,findLastUserItemIndex,fmtDurationShort,fmtSuccessBar,fmtTokens,formatServerCommand,formatSessionWindowTitle,formatSourceLabels,framePasteExpansion,getCacheColor,getConfigSourceDisplay,getDialogMaxHeight,getEffectiveStatusLineScope,getHeatmapColors,getPreviewData,getRangeLabel,getScopeItems,getScopeMessageForSetting,getSeriesColors,getStatusColor as getStatusColor2,getStatusIcon,getSuccessColor,getToolInvalidReasons,groupServersBySource,isNarrowWidth,isRealUserTurn,isRewindableUserTurn,isSyntheticHistoryItem,isToolValid,itemsAfterAreOnlySynthetic,mapToDisplay,observeInteractiveModTool,pickAsciiArtTier,primeGitBranchName,realUserPromptTexts,resolveCustomBanner,restorePasteDraft,rewindSession,shortAsciiLogo,stripLeadingSystemReminders,titleStatusPrefix,unframeClipboardPastes,useAnimationFrame,useAtCompletion,useAuthCommand,useAwaySummary,useCompletion,useDeleteCommand,useDoublePress,useFollowupSuggestionsCLI,useGitBranchName,useLogger,useMcpApproval,usePhraseCycler,usePromptVoiceInput,useProviderSetupFlow,useReactToolScheduler,useReverseSearchCompletion,useShellCommandProcessor,useShellHistory,useStatusLineState,useTimer,useVim,useVimModeActions,useVimModeState,useWorktreeSession,writeTerminalTitle}from"./chunk-3QIAXWWW.js";import{startPostRenderPrefetches}from"./chunk-Y2UXZJLM.js";import{buildPermissionSuggestions}from"./chunk-2Z36XVH7.js";import{TUI_CHAT_RECORDING_FAILURE_MESSAGE,describeLoopStop,formatInteractiveLoopDetectedMessage}from"./chunk-U3Q6WES3.js";import"./chunk-5SF32OGU.js";import{AboutBox,BtwMessage,CommandFormatMigrationNudge,FolderTrustDialog,Help,HistoryItemDisplay,IdeIntegrationNudge,SessionPicker,ThoughtExpandedProvider,ToolDetailsExpandedProvider,UIActionsContext,UIStateContext,dist_default as dist_default2,extensionUpdatesReducer,getScreenBuffer,hyperlinkAtCell,initialExtensionUpdatesState,useArenaCommand,useHistory,useIdeTrustListener,useProviderUpdates,useThoughtExpanded,useUIActions,useUIState}from"./chunk-KS74L67R.js";import{Colors,ConfigContext,DiffRenderer,ErrorBoundary,MCPServerApprovalDialog,MarkdownDisplay,RadioButtonSelect,RenderModeProvider,RespondingSpinner,SCREEN_READER_USER_PREFIX,SessionStatsProvider,SettingsContext,Spinner,StreamingContext,TOOL_DISPLAY_BY_NAME,TOOL_SUCCESS_RATE_HIGH,TOOL_SUCCESS_RATE_MEDIUM,TerminalOutputProvider,TextInput,ToolConfirmationMessage,USER_AGREEMENT_RATE_HIGH,USER_AGREEMENT_RATE_MEDIUM,VirtualViewportContext,buildStatusLinePresetLines,build_default,checkExhaustive,colorizeCode,consumeLastRenderError,countMarkdownSourceBlocks,dist_default,findLastSafeSplitPoint,fitPendingSlice,formatTokenCount as formatTokenCount2,frameAnchor,getArenaStatusLabel,getEnclosingFenceInfo,getRenderableGradientColors,getStatusColor,isDeletionKey,isPrintableSearchChar,keyMatchers,layoutRowForEvent,loadLowlight,logicalPosToOffset,measureElementPosition,removeLastGrapheme,renderSoftwareCursor,splitFencedMarkdown,truncateText,useConfig,useLaunchEditor,useMouseEvents,useMouseTrackingEnabled,usePreferredEditor,useSelectionList,useSessionStats,useSettings,useStreamingContext,useTerminalSize,useTextBuffer,useVirtualViewport}from"./chunk-7KCAOXNL.js";import{ICON,WAITING_SPINNER_FRAME,applyCollapsePolicyAndSummary,buildResumedHistoryItems,computeResumedPromptCountSeed,shouldDisplayGoalStateCause,waitForGoalRuntime}from"./chunk-IEJ2CGRN.js";import{stopAndGetCapturedInput}from"./chunk-ZUQDG3KO.js";import{useAutoAcceptIndicator}from"./chunk-LR2HEHYW.js";import{ContextMenuProvider,KeypressProvider,clampMenuPosition,contextMenuSize,useContextMenu,useFocus,useKeypress,useKeypressContext}from"./chunk-ZKNRRYWK.js";import{MAX_ACCEPTED_BACKLOG,PeerMessaging,classifyApiError}from"./chunk-2ZOTG3NW.js";import"./chunk-F64AWDLW.js";import{normalizePartList}from"./chunk-HIO3M52C.js";import{MAX_SUGGESTION_LABEL_WIDTH,buildMcpResourceRef,handleAtCommand,resolveAtCommandQuery}from"./chunk-6TQS2WQO.js";import{BuiltinCommandLoader,BundledSkillLoader,CONTEXT_FILES_ANNOUNCEMENT_PREFIX,CommandService,DISPLAY_HOOK_EVENTS,FileCommandLoader,MAX_STACKED_SKILLS,McpPromptLoader,SLASH_COMMANDS_SKIP_RECORDING,SavedWorkflowLoader,SkillCommandLoader,addConfigToMatcherGroup,appendUserPromptExpansionAdditionalContext,applyOutputStyleSelection,buildBackgroundWorkBlockedMessage,completeRestoreToolResponse,consumesContextAnnouncementLatch,copyToClipboard,createEmptyHookEventInfo,dayKey,findMidInputSlashCommand,findSlashCommandTokens,formatApprovalModeDescription,formatApprovalModeName,formatEffortChangeMessage,formatUserPromptExpansionBlockedMessage,getAllConfigs,getBestSlashCommandMatch,getTranslatedSourceDisplayMap,hasBlockingBackgroundWork,hasSlashCommandPathSeparator,isAtCommand,isBtwCommand,isContextFilesAnnouncement,isCrossSessionMessagingActive,isCrossSessionMessagingOptedIn,isMidInputCompletableCommand,isPickerOnlyModelInvocation,isSlashCommand,isStackedSkillCompletableCommand,isValidStackedSkillPrefix,loadSessionOutputStyles,parseDayKey,parseSlashCommand,parseStackedSlashCommands,quitCommand,recordAutoSkillCommandUsage,refreshExtensionContentRuntime,resetBackgroundStateForSessionSwitch,resolveOutputStyleChoice,rewindCommand,serializeUserPromptExpansionPrompt,supportsMatchers}from"./chunk-KX7JS2P7.js";import{EXTENSION_RELOAD_FAILED_REASON,ExtensionRefreshState}from"./chunk-2CVFRSGX.js";import{MAX_EXTENSION_OWNER_LABEL_WIDTH,computeSessionStats,contextUsageLabel,formatDuration,formatPercentageUsed,formatRelativeTime,formatTokenCount,getCommandDisplayName,getCommandSourceBadge,skillOriginLabel}from"./chunk-SO6FCPRI.js";import{disableKittyProtocol,isKittyProtocolEnabled,isKittyProtocolSupported,pushKittyProtocolFlags}from"./chunk-HKA2IEQ6.js";import{BEL,OSC_PREFIX,cleanupOldClipboardImages,clipboardHasImage,detectTerminal,generateKittyId,oscGhosttyNotify,oscITerm2Notify,oscKittyNotify,readClipboardText,saveClipboardImage}from"./chunk-DI36DSAF.js";import{getInteractiveModSession,isModRecoveryCommand}from"./chunk-KT5MPRYB.js";import{sanitizeDisplayText}from"./chunk-Z7BAHKO5.js";import"./chunk-EVBKKQ7Y.js";import"./chunk-UGLQO5K7.js";import{MaxSizedBox,OverflowProvider,theme,useOverflowState}from"./chunk-E2NIVXLK.js";import{require_jsx_runtime}from"./chunk-REPFZQ7R.js";import{Box_default,Static,Text,base_exports,measure_element_default,render_default,use_box_metrics_default,use_cursor_default,use_is_screen_reader_enabled_default,use_stdin_default,use_stdout_default}from"./chunk-YIJNS5IJ.js";import{require_react}from"./chunk-5QKDV4CD.js";import{setUpdateHandler}from"./chunk-O2T3GQ6F.js";import{isHistoryItemVisibleAfterRestore}from"./chunk-4TZUKLPC.js";import"./chunk-Y5TT2G3N.js";import{AUTO_THEME_NAME,DEFAULT_THEME,themeManager}from"./chunk-W3YCOEIP.js";import{cleanupReviewWorktreeLeases}from"./chunk-3BNJDZHU.js";import"./chunk-TD6VSPYX.js";import"./chunk-2ZTRKK2O.js";import"./chunk-TZV5T7CF.js";import{MAX_INLINE_IMAGES_PER_ITEM,getInlineImageData}from"./chunk-VRNYIKVL.js";import"./chunk-KKKUB3RQ.js";import"./chunk-OPJXNOWV.js";import"./chunk-MCQE2U7N.js";import"./chunk-LWJBPGIT.js";import"./chunk-WQUA4G2X.js";import"./chunk-QXYN3PTW.js";import{allowsFastOnlyAdvisorModel,appEvents,checkAdvisorModelAvailability,isAdvisorModelEligible,loadHierarchicalMemory}from"./chunk-YL3N2UGG.js";import"./chunk-VURTGFJP.js";import{cpLen,cpSlice,escapeAnsiCtrlCodes,getAsciiArtWidth,getCachedStringWidth,sanitizeFilenameForDisplay,sanitizeMultilineForDisplay,sanitizeTerminalLine,sanitizeTerminalText,stringWidth,stripUnsafeCharacters,toCodePoints,truncateToWidth}from"./chunk-64CA3W6G.js";import"./chunk-S34YI2NO.js";import"./chunk-R4VUFIDQ.js";import"./chunk-UVQUQNCA.js";import"./chunk-XIFNBULA.js";import"./chunk-J2TJL2F4.js";import"./chunk-Z57KDB5F.js";import"./chunk-OX4QMNUW.js";import"./chunk-THNEKTPK.js";import"./chunk-GGM3I5AO.js";import"./chunk-6BSQDDUG.js";import"./chunk-R7TNFTT4.js";import"./chunk-F52ARBN5.js";import{formatUnsupportedVoiceModelMessage,isSelectableVoiceModel}from"./chunk-5PR7OLG6.js";import"./chunk-G2SXDY2E.js";import"./chunk-NCDNF7UJ.js";import"./chunk-XKSB7VTV.js";import"./chunk-3SHHYK7S.js";import"./chunk-DHYCGKLG.js";import{buildHigherDisabled,computeWorkspaceSkillListUpdates,skillSettingStrings}from"./chunk-AVCBF5WL.js";import{isValidSessionId}from"./chunk-LGFF5PJA.js";import"./chunk-O222HKZN.js";import"./chunk-YZUKMJW7.js";import"./chunk-3TK35SQL.js";import"./chunk-2HLVSWM6.js";import"./chunk-VDUNIK4I.js";import{getRawModelProviders}from"./chunk-NIYWNFVF.js";import{formatExecutionSandbox,getExtendedSystemInfo}from"./chunk-YPDQJQ3S.js";import"./chunk-244YTFYD.js";import"./chunk-BWQ5AIEA.js";import"./chunk-WDR5XP3Y.js";import"./chunk-2QYDBHYZ.js";import{getReasoningEffortsForConfig}from"./chunk-4R2OHBH3.js";import{formatSettingRowValue}from"./chunk-L42NTHIT.js";import"./chunk-LUDNUVSA.js";import"./chunk-CCTQPUAG.js";import"./chunk-WBDNGVHU.js";import"./chunk-L5UULTGF.js";import"./chunk-AVJJ62OC.js";import"./chunk-SPYNWVDZ.js";import"./chunk-XSG7HKSN.js";import"./chunk-KOJ7WZ63.js";import"./chunk-O6ZQAVRG.js";import"./chunk-3KZHPZVZ.js";import"./chunk-NIEO2TBE.js";import"./chunk-CFTFKWPW.js";import"./chunk-E4UMXDOZ.js";import"./chunk-BZAH4DTS.js";import"./chunk-BVSTV4JM.js";import"./chunk-FJUXMWZW.js";import"./chunk-MHZY2JYX.js";import"./chunk-JBJA2Y7T.js";import"./chunk-W7V6J2VV.js";import"./chunk-4BFQ7QQC.js";import"./chunk-B6T4ESBM.js";import{requestConsentInteractive,requestConsentOrFail}from"./chunk-W4P2EN3V.js";import"./chunk-D2NY7HVY.js";import{exitCleanly,relaunchApp}from"./chunk-HVS6V2UZ.js";import"./chunk-QO46QMCC.js";import"./chunk-BP62QEKY.js";import"./chunk-IHXJOVAH.js";import"./chunk-XZZBAJQS.js";import"./chunk-3SWMGBN3.js";import"./chunk-AZ3CKMCT.js";import"./chunk-TDDRZUJO.js";import"./chunk-44WSAMWG.js";import"./chunk-WSOEJTOC.js";import{loadMcpApprovals}from"./chunk-WRJ3PMDZ.js";import"./chunk-JB2NOB6W.js";import{CORRUPTED_SUFFIX,getDefaultValue,getDialogSettingKeys,getDisplayValue,getEffectiveValue,getNestedValue,getPersistScopeForModelSelection,getRestartRequiredFromModified,getSettingDefinition,isAutoLanguage,isDefaultValue,loadSettings,nextBooleanSettingValue,requiresRestart,saveModifiedSettings,setPendingSettingValue,setPendingSettingValueAny,validateSettingValue,writeOutputLanguageAndRegisterPath}from"./chunk-2B3W7IQY.js";import{TOGGLE_TYPES,isNumericSettingType}from"./chunk-FUUPMVD2.js";import"./chunk-UWCF7JIF.js";import"./chunk-LMUSSYJH.js";import{getCurrentLanguage,localizeToolDisplayName,t}from"./chunk-EZMTX4EU.js";import"./chunk-MWABT6CH.js";import"./chunk-ABUS7DNN.js";import"./chunk-PKK2D2W4.js";import"./chunk-HZ4Y7DH5.js";import"./chunk-E5T4R2PM.js";import"./chunk-AUI7WVSU.js";import{isInlineModelOverrideAllowed,publicProviderBaseUrl}from"./chunk-GT4TCQ3R.js";import{getErrorMessage as getErrorMessage2}from"./chunk-JQGGILML.js";import{isWorkspaceTrusted,loadTrustedFolders}from"./chunk-LGBGUITT.js";import"./chunk-EIPLDYEY.js";import"./chunk-IDXJIDME.js";import{AsyncFzf,AutonomousLoopTickResolver,DroppedNotificationTally,IDLE_SPECULATION,MAX_BACKGROUND_NOTIFICATION_QUEUE,abortSpeculation,acceptSpeculation,buildSessionRecoveryPlan,clearWelcomeBackState,decideNotificationAdmission,describePeerInboxFailure,detectAutonomousSentinel,generatePromptSuggestion,generateToolUseSummary,getLastPeerInboxFailure,getProjectSummaryInfo,getWelcomeBackState,isWsl,renderGoalContinuationTurn,saveWelcomeBackRestartChoice,startSpeculation,subagentGenerator}from"./chunk-6JFC5M6B.js";import"./chunk-QS2ZMQIS.js";import"./chunk-S7IKHQ6I.js";import"./chunk-SEQAVABL.js";import"./chunk-IEWZIDC6.js";import{formatVersionLabel,getCliVersion}from"./chunk-J4TFGZ4A.js";import"./chunk-O4EDHV64.js";import{require_strip_json_comments}from"./chunk-DOLUT3XC.js";import"./chunk-PTHIQ7ZN.js";import"./chunk-PAD5GPDY.js";import"./chunk-MD3ZEOBX.js";import"./chunk-X5QSFJVS.js";import{WorktreeRestoreRefusedError,clearWorktreeSession,isSessionRuntimeActive,restoreWorktreeContext}from"./chunk-2Q7T5CR2.js";import"./chunk-46VUDNCL.js";import{PEER_ADMISSION_LIMITS,describeDeliveryStatus,describeDropReason,describeHoldCause,parseHeldExpiry}from"./chunk-MKH3EH7O.js";import"./chunk-7JWJTRP6.js";import"./chunk-BNYJY4OL.js";import"./chunk-JKV4ODXE.js";import"./chunk-GVZ6D2NL.js";import"./chunk-ZHHFNZ5J.js";import"./chunk-H4GDEXMF.js";import"./chunk-AKWYMQKU.js";import"./chunk-MZUOREFD.js";import"./chunk-34ZBUQJV.js";import"./chunk-XZACON5H.js";import"./chunk-22CLK7PK.js";import"./chunk-ZZJXFLVM.js";import"./chunk-RKDS7A4H.js";import"./chunk-SXJ2E33J.js";import"./chunk-IV3HAIUN.js";import"./chunk-UYYQB2TU.js";import"./chunk-VET7MLTV.js";import"./chunk-HN5UYLPU.js";import"./chunk-DECUAM3U.js";import"./chunk-PGRN3GZY.js";import"./chunk-YFTVFH2A.js";import"./chunk-ZBHL2CXR.js";import"./chunk-NIOS3B3V.js";import{ConditionalRulesRegistry,DEFAULT_BUILTIN_SUBAGENT_TYPE,DISPLAY_MODE,IdeClient,MAX_RECENT_ACTIVITIES,MCPOAuthProvider,MCPOAuthTokenStorage,SessionService,aggregateUsage,allowEditorTypeInSandbox,buildBackgroundEntryLabel,buildWorkflowSizeGuidelineChangeNotice,checkForExtensionUpdate,checkHasEditorType,computeThresholds,computeUniqueBranchTitle,convertTomlToMarkdown,createDuplicateProviderToolCallResponse,createInstructionsLoadedCallback,didWriteProjectContextFile,finalizeToolResponses,findRepeatedDuplicateProviderToolCall,fireNotificationHook,getCachedToolCallFingerprint,getExtensionDisplayName,getTimeRangeBounds,goalToolResultProvenance,ideContextStore,isActiveWorkflowStatus,isEditorAvailable,isExtensionCommittedWithWarningsError,isGatedMcpScope,isReplayOfHandledToolCall,isSettledStatus,isSuccessStatus,isTerminalStatus,isTerminalWorkflowStatus,loadUsageHistory,markDuplicateProviderToolCallResponseSent,matchesAnyServerPattern,mcpServerRequiresOAuth,metricsToUsageRecord,normalizeDerivedBranchTitle,parseAndFormatApiError,parseCron,parseInstallSource,parseVisionModelSetting,recordHandledToolCall,refreshMemoryAfterManagedWrite,refreshMemoryInstruction,resolveWorkflowIntent,resolveWorkflowSizeGuidelineSetting,saveWorkflowScript,validateWorkflowName}from"./chunk-LIIMQ4DI.js";import"./chunk-R2EHHA2C.js";import"./chunk-ZLZF2ZDD.js";import"./chunk-YK7NDQKM.js";import"./chunk-TLROJH6O.js";import"./chunk-PHIPLV2I.js";import"./chunk-2EUNU5M5.js";import"./chunk-7DCW657A.js";import"./chunk-FIXDX63I.js";import"./chunk-T7CHK6C2.js";import"./chunk-PT7NZBDY.js";import"./chunk-TWP72VRH.js";import"./chunk-UYEWRLGD.js";import"./chunk-2MB4ZSKF.js";import"./chunk-WK2IBT6D.js";import{GitWorktreeService,fetchGitDiff,fetchGitDiffHunks,readWorktreeSessionMarker,writeRuntimeStatus}from"./chunk-ILECDNJX.js";import"./chunk-QXQGUM3Y.js";import"./chunk-TRA6EVDT.js";import"./chunk-DBA3F3D7.js";import"./chunk-QVPT37XZ.js";import{readCronTasks,taskHasLegacyCondition}from"./chunk-T6W33SET.js";import"./chunk-4WFGJVTF.js";import{flattenPeerLabel,registerSession}from"./chunk-BYU42MLK.js";import"./chunk-JWQXU3SR.js";import"./chunk-5LZ2DPLH.js";import"./chunk-XQJOZDV7.js";import"./chunk-CV2UAEZA.js";import"./chunk-LO76B6GW.js";import{GOAL_PAUSE_REASON_USER_INTERRUPT,elapsedActiveTime,goalPauseReasonForFailure,goalRequiresExactPermit}from"./chunk-CMLAE3UB.js";import"./chunk-KLC3OD2M.js";import"./chunk-QZV4PFQK.js";import"./chunk-VXRLLVOP.js";import"./chunk-G5PYYZMM.js";import"./chunk-BG67XABA.js";import{buildModelIdContext,resolveModelId}from"./chunk-BEKROCWN.js";import{glob}from"./chunk-OBOU4ZZM.js";import"./chunk-D7XCQWP2.js";import"./chunk-AE5OMKRY.js";import"./chunk-EL5J4ESB.js";import"./chunk-QX4PIAJI.js";import"./chunk-7DQ2T3TA.js";import{parseRule}from"./chunk-TDHEAGDX.js";import{APPROVAL_MODES}from"./chunk-JZK2WGXA.js";import"./chunk-MPHSE7M4.js";import"./chunk-S2ZKZXHX.js";import"./chunk-4GP3PH7Z.js";import"./chunk-4QQKOW5M.js";import{BUILT_IN_OUTPUT_STYLES}from"./chunk-OV3EBH6J.js";import{NO_EXEC_CONFIG,getGitBranch}from"./chunk-EBMCWXGZ.js";import"./chunk-PV2VT25U.js";import"./chunk-7UK4WJWS.js";import"./chunk-HMIP4IK2.js";import"./chunk-SG3M7EYB.js";import"./chunk-YIW3H46P.js";import"./chunk-E6MI76C2.js";import"./chunk-NTNKD4KR.js";import"./chunk-4ZRCV3JY.js";import"./chunk-K7TPIVP4.js";import{ShellExecutionService}from"./chunk-CQCSNHPU.js";import{stripAnsi}from"./chunk-YGLM5XPP.js";import"./chunk-WGNF7FPC.js";import"./chunk-4NPYOXJO.js";import{promptIdContext}from"./chunk-MWGB5RCF.js";import"./chunk-SCD5TUBG.js";import"./chunk-NTRFETZB.js";import"./chunk-TL3SF2GA.js";import"./chunk-GRW3GBXN.js";import"./chunk-4JNHUZ7M.js";import"./chunk-SW54YEPK.js";import"./chunk-JCOK67LT.js";import{captureHookExecutionOwner,runOutsideAgentContext}from"./chunk-AGQBNWGY.js";import"./chunk-AGEDDL7Z.js";import"./chunk-2NJJHZ52.js";import"./chunk-BN4FIQ77.js";import{osc8Hyperlink,supportsHyperlinks,wrapForMultiplexer}from"./chunk-IKDZVJH2.js";import{openBrowserSecurely}from"./chunk-3YWXKSOI.js";import"./chunk-OZGM5CCE.js";import"./chunk-S4KYECMU.js";import"./chunk-VFB6Q74I.js";import"./chunk-A6LT3FIJ.js";import"./chunk-S6RXVOY6.js";import"./chunk-X64RXJQQ.js";import"./chunk-HETUGUHE.js";import{ALIBABA_PROVIDERS,QWENCLOUD_PROVIDERS,THIRD_PARTY_PROVIDERS,customProvider,findExistingProviderModels,findProviderByCredentials,findProviderById,isImageGenerationCapable,resolveMetadataKey}from"./chunk-OVPEAKOQ.js";import"./chunk-NCVLAQE5.js";import"./chunk-476F6QIM.js";import"./chunk-4R67LXKL.js";import"./chunk-VTDSLBET.js";import{ApiCancelEvent,ConversationFinishedEvent,DiscoveredMCPTool,ModelSlashCommandEvent,PromptSuggestionEvent,SpeculationEvent,UserFeedbackEvent,UserPromptEvent,UserRetryEvent,addMCPStatusChangeListener,formatFullTurnVisionNotice,formatVisionBridgeNotice,getAllMCPServerStatuses,getFullTurnVisionModelSelector,getMCPServerStatus,hasImageParts,isImageCapable,logApiCancel,logConversationFinishedEvent,logModelSlashCommand,logPromptSuggestion,logSlashCommand,logSpeculation,logUserFeedback,logUserPrompt,logUserRetry,makeSlashCommandEvent,recordSkillInvocation,removeMCPServerStatus,removeMCPStatusChangeListener,runVisionBridge,shouldRunVisionBridge,splitImageParts}from"./chunk-TNCN2JX2.js";import"./chunk-UQFTXKEB.js";import"./chunk-HDGTWJ24.js";import"./chunk-W5NWIGKO.js";import{AUTO_MEMORY_INDEX_FILENAME,getAutoMemoryProjectStateDir,getAutoMemoryRoot,getUserAutoMemoryRoot}from"./chunk-KVA6DHHF.js";import"./chunk-PWOQASXT.js";import"./chunk-K7JCVESI.js";import{getAllMemoryFilenames,getUnsupportedImageFormatWarning,isSupportedImageMimeType}from"./chunk-Y6HHV4LC.js";import"./chunk-RP57XAJ2.js";import"./chunk-Z6AR5XE5.js";import"./chunk-77V43YOE.js";import"./chunk-7U7CWMP7.js";import"./chunk-SLD7H2FA.js";import"./chunk-7DOOXUDG.js";import"./chunk-4DIWAQ5G.js";import{clampInlineMediaPart}from"./chunk-Q6UAOTP3.js";import{MAINLINE_CODER_MODEL}from"./chunk-OCVRMNEQ.js";import{DEFAULT_TOKEN_LIMIT,applyReasoningEffort}from"./chunk-HEDN54OB.js";import"./chunk-4ZBZL23U.js";import"./chunk-ZZZAYAJW.js";import"./chunk-XMANRGPK.js";import{endInteractionSpan,getActiveInteractionSpan,redactUrlCredentials}from"./chunk-XHV5HLJS.js";import"./chunk-KQX4H2D3.js";import"./chunk-URNNJMIC.js";import"./chunk-HTW7PYHK.js";import"./chunk-AMGUAA4G.js";import{atomicWriteFileSync}from"./chunk-BMHYEQTI.js";import{FinishReason}from"./chunk-QKX6AI4W.js";import"./chunk-GU22I6TY.js";import"./chunk-YEYW7PPR.js";import"./chunk-U6C6ONIN.js";import"./chunk-GLXNCFWC.js";import"./chunk-NPAX2UFU.js";import"./chunk-RMQNBSMK.js";import{finalizeStartupProfile,profileCheckpoint}from"./chunk-H4XFFVZ2.js";import"./chunk-X7QN6R6K.js";import"./chunk-FUK4Y5AJ.js";import{registerCleanup,runExitCleanup}from"./chunk-UFTIUKD4.js";import{clearScreen,writeStderrLine,writeStderrLineSafe,writeStdoutLine}from"./chunk-SLPJ4OII.js";import"./chunk-4YLXNRRH.js";import{getApiHistoryPromptId}from"./chunk-B3ZFUGTC.js";import"./chunk-IRINPFG7.js";import{HOOKS_CONFIG_FIELDS}from"./chunk-6GTPLW7K.js";import"./chunk-NGVRCUYD.js";import"./chunk-5DTFN37U.js";import{isPathWithinRoot}from"./chunk-2YUBAWQ6.js";import"./chunk-O5EKX7LG.js";import"./chunk-TM6ZCBR7.js";import"./chunk-SVAPAMMG.js";import"./chunk-3KUHQGOS.js";import"./chunk-I6S7NGX3.js";import{ToolNames}from"./chunk-SBZFGYYS.js";import{createDebugLogger,isDebugLogFileEnabled,isDebugLoggingDegraded}from"./chunk-JAUJI56S.js";import"./chunk-I4H7NUVP.js";import{Storage}from"./chunk-EPODBRBP.js";import{shortenPath,tildeifyPath}from"./chunk-OKN3Z5C5.js";import{UnauthorizedError,getErrorMessage,isNodeError}from"./chunk-XYB7GC5U.js";import"./chunk-2UOMCYQG.js";import"./chunk-I7L2TX4M.js";import"./chunk-MK3OONRA.js";import"./chunk-COGTQ5KZ.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name,__toESM}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import{stat as stat2}from"node:fs/promises";import{basename as basename4}from"node:path";var import_react142=__toESM(require_react(),1);init_esbuild_shims();var import_react=__toESM(require_react(),1);var PeerMessagingContext=(0,import_react.createContext)(null);var usePeerMessaging=__name(()=>(0,import_react.useContext)(PeerMessagingContext),"usePeerMessaging");var PeerInboxFailureContext=(0,import_react.createContext)(null);var usePeerInboxFailure=__name(()=>(0,import_react.useContext)(PeerInboxFailureContext),"usePeerInboxFailure");init_esbuild_shims();import{isDeepStrictEqual}from"node:util";function inboundPolicyScope(settings){const merged=settings.merged.agents?.crossSessionInbound;if(merged===void 0)return void 0;const valueIn=__name(scope=>settings.forScope(scope).settings.agents?.crossSessionInbound,"valueIn");if(valueIn("System")!==void 0)return"system";const user=valueIn("User");const systemDefaults=valueIn("SystemDefaults");const workspace=valueIn("Workspace");if(isDeepStrictEqual(user,merged))return"user";if(isDeepStrictEqual(systemDefaults,merged))return"system";if(settings.isTrusted&&settings.workspaceSettingsActive&&isDeepStrictEqual(workspace,merged)){return"workspace"}if(user!==void 0)return"user";if(systemDefaults!==void 0)return"system";return void 0}__name(inboundPolicyScope,"inboundPolicyScope");init_esbuild_shims();var import_react2=__toESM(require_react(),1);var DualOutputContext=(0,import_react2.createContext)(null);function useDualOutput(){return(0,import_react2.useContext)(DualOutputContext)}__name(useDualOutput,"useDualOutput");init_esbuild_shims();var import_react3=__toESM(require_react(),1);var RemoteInputContext=(0,import_react3.createContext)(null);var useRemoteInput=__name(()=>(0,import_react3.useContext)(RemoteInputContext),"useRemoteInput");init_esbuild_shims();var import_react140=__toESM(require_react(),1);init_esbuild_shims();var import_react104=__toESM(require_react(),1);init_esbuild_shims();var import_jsx_runtime=__toESM(require_jsx_runtime(),1);var QuittingDisplay=__name(()=>{const uiState=useUIState();const{rows:terminalHeight,columns:terminalWidth}=useTerminalSize();const availableTerminalHeight=terminalHeight;const{mainAreaWidth}=uiState;if(!uiState.quittingMessages){return null}return(0,import_jsx_runtime.jsx)(Box_default,{flexDirection:"column",marginBottom:1,children:uiState.quittingMessages.map(item=>(0,import_jsx_runtime.jsx)(HistoryItemDisplay,{availableTerminalHeight:uiState.constrainHeight?availableTerminalHeight:void 0,terminalWidth,mainAreaWidth,item,isPending:false},item.id))})},"QuittingDisplay");init_esbuild_shims();var import_react4=__toESM(require_react(),1);var import_jsx_runtime2=__toESM(require_jsx_runtime(),1);var EXIT_INDEX=0;var CONTINUE_INDEX=1;var SettingsCorruptedDialog=__name(({corruptedPath,wasRecovered,onExit,onContinue})=>{const[selectedIndex,setSelectedIndex]=(0,import_react4.useState)(EXIT_INDEX);useKeypress(key=>{if(key.name==="escape"){onContinue();return}if(key.ctrl&&key.name==="c"){onExit();return}if(key.name==="up"){setSelectedIndex(EXIT_INDEX)}if(key.name==="down"){setSelectedIndex(CONTINUE_INDEX)}if(key.name==="return"){if(selectedIndex===EXIT_INDEX){onExit()}else{onContinue()}}},{isActive:true});const continueLabel=wasRecovered?t("Continue with recovered settings (esc)"):t("Continue with empty settings (esc)");return(0,import_jsx_runtime2.jsxs)(Box_default,{flexDirection:"column",borderStyle:"round",borderColor:theme.status.error,padding:1,width:"100%",marginLeft:1,children:[(0,import_jsx_runtime2.jsxs)(Box_default,{marginBottom:1,flexDirection:"column",children:[(0,import_jsx_runtime2.jsxs)(Text,{children:[(0,import_jsx_runtime2.jsx)(Text,{color:theme.status.error,children:"> "}),(0,import_jsx_runtime2.jsx)(Text,{bold:true,color:theme.status.error,children:t("Settings file corrupted")})]}),(0,import_jsx_runtime2.jsx)(Text,{color:theme.text.secondary,children:t("Your settings file had invalid JSON. A copy of the corrupted file has been saved for reference.")}),(0,import_jsx_runtime2.jsx)(Text,{color:theme.text.secondary,children:corruptedPath})]}),(0,import_jsx_runtime2.jsxs)(Box_default,{flexDirection:"column",children:[(0,import_jsx_runtime2.jsxs)(Box_default,{children:[(0,import_jsx_runtime2.jsx)(Text,{children:selectedIndex===EXIT_INDEX?(0,import_jsx_runtime2.jsx)(Text,{color:theme.status.success,children:"> "}):" "}),(0,import_jsx_runtime2.jsx)(Text,{color:selectedIndex===EXIT_INDEX?theme.status.success:theme.text.primary,children:t("Exit and restore corrupted file")})]}),(0,import_jsx_runtime2.jsxs)(Box_default,{children:[(0,import_jsx_runtime2.jsx)(Text,{children:selectedIndex===CONTINUE_INDEX?(0,import_jsx_runtime2.jsx)(Text,{color:theme.status.success,children:"> "}):" "}),(0,import_jsx_runtime2.jsx)(Text,{color:selectedIndex===CONTINUE_INDEX?theme.status.success:theme.text.primary,children:continueLabel})]})]})]})},"SettingsCorruptedDialog");init_esbuild_shims();init_esbuild_shims();init_esbuild_shims();var import_react5=__toESM(require_react(),1);var AppContext=(0,import_react5.createContext)(null);var useAppContext=__name(()=>{const context=(0,import_react5.useContext)(AppContext);if(!context){throw new Error("useAppContext must be used within an AppProvider")}return context},"useAppContext");var import_jsx_runtime3=__toESM(require_jsx_runtime(),1);var Notifications=__name(()=>{const{startupWarnings}=useAppContext();const{initError,streamingState}=useUIState();const showStartupWarnings=startupWarnings.length>0;const showInitError=initError&&streamingState!=="responding";return(0,import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment,{children:[showStartupWarnings&&(0,import_jsx_runtime3.jsx)(Box_default,{borderStyle:"round",borderColor:theme.status.warning,paddingX:1,marginY:1,flexDirection:"column",children:startupWarnings.map((warning,index)=>(0,import_jsx_runtime3.jsx)(Text,{color:theme.status.warning,children:warning},index))}),showInitError&&(0,import_jsx_runtime3.jsxs)(Box_default,{borderStyle:"round",borderColor:theme.status.error,paddingX:1,marginBottom:1,children:[(0,import_jsx_runtime3.jsxs)(Text,{color:theme.status.error,children:["Initialization Error: ",initError]}),(0,import_jsx_runtime3.jsxs)(Text,{color:theme.status.error,children:[" ","Please check API key and configuration."]})]})]})},"Notifications");init_esbuild_shims();var import_jsx_runtime4=__toESM(require_jsx_runtime(),1);var UpdateNotification=__name(({message})=>(0,import_jsx_runtime4.jsx)(Box_default,{borderStyle:"round",borderColor:theme.status.warning,paddingX:1,marginY:1,children:(0,import_jsx_runtime4.jsx)(Text,{color:theme.status.warning,children:message})}),"UpdateNotification");init_esbuild_shims();var import_react16=__toESM(require_react(),1);init_esbuild_shims();var import_jsx_runtime5=__toESM(require_jsx_runtime(),1);var ShowMoreLines=__name(({constrainHeight})=>{const overflowState=useOverflowState();const streamingState=useStreamingContext();if(overflowState===void 0||overflowState.overflowingIds.size===0||!constrainHeight||!(streamingState==="idle"||streamingState==="waiting_for_confirmation")){return null}return(0,import_jsx_runtime5.jsx)(Box_default,{children:(0,import_jsx_runtime5.jsx)(Text,{color:theme.text.secondary,wrap:"truncate",children:"Press ctrl-s to show more lines"})})},"ShowMoreLines");init_esbuild_shims();var import_react7=__toESM(require_react(),1);init_esbuild_shims();var import_jsx_runtime6=__toESM(require_jsx_runtime(),1);function formatAuthDisplayType(authDisplayType){if(!authDisplayType||!authDisplayType.trim()){return t("Unknown")}const value=authDisplayType.trim();switch(value){case"qwen_oauth":return t("Qwen OAuth");case"coding_plan":return t("Coding Plan");case"api_key":return t("API Key");case"unknown":return t("Unknown");default:return authDisplayType}}__name(formatAuthDisplayType,"formatAuthDisplayType");var Header=__name(({customAsciiArt,customBannerTitle,customBannerSubtitle,version,authDisplayType,model,workingDirectory})=>{const{columns:terminalWidth}=useTerminalSize();const formattedAuthType=formatAuthDisplayType(authDisplayType);const versionLabel=formatVersionLabel(version);const containerMarginX=2;const logoGap=2;const infoPanelPaddingX=1;const infoPanelBorderWidth=2;const infoPanelChromeWidth=infoPanelBorderWidth+infoPanelPaddingX*2;const minPathLength=40;const minInfoPanelWidth=minPathLength+infoPanelChromeWidth;const availableTerminalWidth=Math.max(0,terminalWidth-containerMarginX*2);const hasCustomArt=Boolean(customAsciiArt?.small||customAsciiArt?.large);const customTier=pickAsciiArtTier(customAsciiArt?.small,customAsciiArt?.large,availableTerminalWidth,logoGap,minInfoPanelWidth,getAsciiArtWidth);const displayLogo=customTier??(hasCustomArt?"":shortAsciiLogo);const logoWidth=getAsciiArtWidth(displayLogo);const showLogo=displayLogo!==""&&availableTerminalWidth>=logoWidth+logoGap+minInfoPanelWidth;const maxInfoPanelWidth=60;const availableInfoPanelWidth=showLogo?Math.min(availableTerminalWidth-logoWidth-logoGap,maxInfoPanelWidth):availableTerminalWidth;const maxPathLength=Math.max(0,availableInfoPanelWidth-infoPanelChromeWidth);const infoPanelContentWidth=Math.max(0,availableInfoPanelWidth-infoPanelChromeWidth);const authModelText=`${formattedAuthType} | ${model}`;const modelHintText=" (/model to change)";const showModelHint=infoPanelContentWidth>0&&getCachedStringWidth(authModelText+modelHintText)<=infoPanelContentWidth;const tildeifiedPath=tildeifyPath(workingDirectory);const shortenedPath=shortenPath(tildeifiedPath,Math.max(3,maxPathLength));const displayPath=maxPathLength<=0?"":shortenedPath.length>maxPathLength?shortenedPath.slice(0,maxPathLength):shortenedPath;const gradientColors=getRenderableGradientColors(theme.ui.gradient,[theme.text.secondary,theme.text.link,theme.text.accent]);return(0,import_jsx_runtime6.jsxs)(Box_default,{flexDirection:"row",alignItems:"center",marginX:containerMarginX,width:availableTerminalWidth,children:[showLogo&&(0,import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment,{children:[(0,import_jsx_runtime6.jsx)(Box_default,{flexShrink:0,children:gradientColors?(0,import_jsx_runtime6.jsx)(dist_default2,{colors:gradientColors,children:(0,import_jsx_runtime6.jsx)(Text,{children:displayLogo})}):(0,import_jsx_runtime6.jsx)(Text,{children:displayLogo})}),(0,import_jsx_runtime6.jsx)(Box_default,{width:logoGap})]}),(0,import_jsx_runtime6.jsxs)(Box_default,{flexDirection:"column",borderStyle:"single",borderColor:theme.border.default,paddingX:infoPanelPaddingX,flexGrow:showLogo?0:1,width:showLogo?availableInfoPanelWidth:void 0,children:[(0,import_jsx_runtime6.jsxs)(Text,{children:[(0,import_jsx_runtime6.jsx)(Text,{bold:true,color:theme.text.accent,children:customBannerTitle?customBannerTitle:">_ Qwen Code"}),(0,import_jsx_runtime6.jsxs)(Text,{color:theme.text.secondary,children:[" (",versionLabel,")"]})]}),customBannerSubtitle?(0,import_jsx_runtime6.jsx)(Text,{color:theme.text.secondary,children:customBannerSubtitle}):(0,import_jsx_runtime6.jsx)(Text,{children:" "}),(0,import_jsx_runtime6.jsxs)(Text,{children:[(0,import_jsx_runtime6.jsx)(Text,{color:theme.text.secondary,children:authModelText}),showModelHint&&(0,import_jsx_runtime6.jsx)(Text,{color:theme.text.secondary,children:modelHintText})]}),(0,import_jsx_runtime6.jsx)(Text,{color:theme.text.secondary,children:displayPath})]})]})},"Header");init_esbuild_shims();var import_react6=__toESM(require_react(),1);init_esbuild_shims();init_esbuild_shims();import*as fs from"node:fs";import*as path from"node:path";var TipHistory=class _TipHistory{static{__name(this,"TipHistory")}sessionShown=new Map;data;filePath;constructor(data,filePath){this.data=data;this.filePath=filePath}get sessionCount(){return this.data.sessionCount}isCooledDown(tipId,cooldownPrompts,currentPromptCount){const lastShown=this.sessionShown.get(tipId);if(lastShown===void 0)return true;return currentPromptCount-lastShown>=cooldownPrompts}getLastShown(tipId){if(this.sessionShown.has(tipId)){return Number.MAX_SAFE_INTEGER-1e6+(this.sessionShown.get(tipId)??0)}return this.normalizeEntry(this.data.tips[tipId]).lastSessionTimestamp}normalizeEntry(raw){if(typeof raw!=="object"||raw===null||Array.isArray(raw)){return{totalShown:0,lastSessionTimestamp:0}}const candidate=raw;return{totalShown:typeof candidate.totalShown==="number"&&Number.isFinite(candidate.totalShown)?candidate.totalShown:0,lastSessionTimestamp:typeof candidate.lastSessionTimestamp==="number"&&Number.isFinite(candidate.lastSessionTimestamp)?candidate.lastSessionTimestamp:0}}recordShown(tipId,currentPromptCount){this.sessionShown.set(tipId,currentPromptCount);const entry=this.normalizeEntry(this.data.tips[tipId]);entry.totalShown++;entry.lastSessionTimestamp=Date.now();this.data.tips[tipId]=entry;this.persist()}persist(){try{const dir=path.dirname(this.filePath);if(!fs.existsSync(dir)){fs.mkdirSync(dir,{recursive:true})}atomicWriteFileSync(this.filePath,JSON.stringify(this.data,null,2),{mode:384,forceMode:true,noFollow:true})}catch{}}static load(){const filePath=path.join(Storage.getGlobalQwenDir(),"tip_history.json");let data={sessionCount:0,tips:{}};try{if(fs.existsSync(filePath)){const raw=fs.readFileSync(filePath,"utf-8");const parsed=JSON.parse(raw);if(typeof parsed==="object"&&parsed!==null&&typeof parsed.sessionCount==="number"){data={sessionCount:Number.isFinite(parsed.sessionCount)&&parsed.sessionCount>=0?Math.floor(parsed.sessionCount):0,tips:parsed.tips??{}}}}}catch{}data.sessionCount++;data.tips=typeof data.tips==="object"&&data.tips!==null&&!Array.isArray(data.tips)?data.tips:{};const history=new _TipHistory(data,filePath);history.persist();return history}};init_esbuild_shims();function selectTip(trigger,context,tips,history){const candidates=tips.filter(tip=>tip.trigger===trigger).filter(tip=>{try{return tip.isRelevant(context)}catch{return false}}).filter(tip=>history.isCooledDown(tip.id,tip.cooldownPrompts,context.sessionPromptCount));if(candidates.length===0)return null;candidates.sort((a,b)=>{if(b.priority!==a.priority)return b.priority-a.priority;return history.getLastShown(a.id)-history.getLastShown(b.id)});return candidates[0]??null}__name(selectTip,"selectTip");init_esbuild_shims();var tipRegistry=[{id:"context-critical",content:"Context near hard limit \u2014 auto-compact will force on next send. Consider /clear if you want to start fresh.",trigger:"post-response",isRelevant:__name(ctx=>ctx.thresholds!==void 0&&ctx.lastPromptTokenCount>=ctx.thresholds.hard,"isRelevant"),cooldownPrompts:3,priority:100},{id:"context-high",content:"Context is getting full. Use /compress to free up space.",trigger:"post-response",isRelevant:__name(ctx=>ctx.thresholds!==void 0&&ctx.lastPromptTokenCount>=ctx.thresholds.auto&&ctx.lastPromptTokenCount<ctx.thresholds.hard,"isRelevant"),cooldownPrompts:5,priority:90},{id:"compress-intro",content:"Long conversation? /compress summarizes history to free context.",trigger:"post-response",isRelevant:__name(ctx=>ctx.thresholds!==void 0&&ctx.lastPromptTokenCount>=ctx.thresholds.warn&&ctx.lastPromptTokenCount<ctx.thresholds.auto&&ctx.sessionPromptCount>5,"isRelevant"),cooldownPrompts:10,priority:50},{id:"new-user-slash",content:"Type / to open the command popup; Tab autocompletes slash commands and saved prompts.",trigger:"startup",isRelevant:__name(ctx=>ctx.sessionCount<5,"isRelevant"),cooldownPrompts:0,priority:70},{id:"new-user-qwenmd",content:"Add a QWEN.md file to give Qwen Code persistent project context.",trigger:"startup",isRelevant:__name(ctx=>ctx.sessionCount<10,"isRelevant"),cooldownPrompts:0,priority:70},{id:"new-user-resume",content:"You can resume a previous conversation by running qwen --continue or qwen --resume.",trigger:"startup",isRelevant:__name(ctx=>ctx.sessionCount<10,"isRelevant"),cooldownPrompts:0,priority:70},{id:"shell-commands",content:"You can run any shell commands from Qwen Code using ! (e.g. !ls).",trigger:"startup",isRelevant:__name(ctx=>ctx.sessionCount<15,"isRelevant"),cooldownPrompts:0,priority:70},{id:"compress-startup",content:"Use /compress when the conversation gets long to summarize history and free up context.",trigger:"startup",isRelevant:__name(()=>true,"isRelevant"),cooldownPrompts:0,priority:50},{id:"approval-mode-win32",content:"You can switch permission mode quickly with Tab or /approval-mode.",trigger:"startup",isRelevant:__name(ctx=>ctx.platform==="win32","isRelevant"),cooldownPrompts:0,priority:50},{id:"approval-mode",content:"You can switch permission mode quickly with Shift+Tab or /approval-mode.",trigger:"startup",isRelevant:__name(ctx=>ctx.platform!=="win32","isRelevant"),cooldownPrompts:0,priority:50},{id:"insight-command",content:"Try /insight to generate personalized insights from your chat history.",trigger:"startup",isRelevant:__name(ctx=>ctx.sessionCount>20,"isRelevant"),cooldownPrompts:0,priority:70},{id:"btw-command",content:"Use /btw to ask a quick side question without disrupting the conversation.",trigger:"startup",isRelevant:__name(()=>true,"isRelevant"),cooldownPrompts:0,priority:50},{id:"clear-new",content:"Start a fresh idea with /clear or /new; the previous session stays available in history.",trigger:"startup",isRelevant:__name(()=>true,"isRelevant"),cooldownPrompts:0,priority:50},{id:"bug-report",content:"Use /bug to submit issues to the maintainers when something goes off.",trigger:"startup",isRelevant:__name(()=>true,"isRelevant"),cooldownPrompts:0,priority:50},{id:"auth-switch",content:"Switch auth type quickly with /auth.",trigger:"startup",isRelevant:__name(()=>true,"isRelevant"),cooldownPrompts:0,priority:50}];var _tipHistory=null;function getTipHistory(){if(!_tipHistory){_tipHistory=TipHistory.load()}return _tipHistory}__name(getTipHistory,"getTipHistory");var import_jsx_runtime7=__toESM(require_jsx_runtime(),1);function pickStartupTip(){const history=getTipHistory();const context={lastPromptTokenCount:0,contextWindowSize:0,sessionPromptCount:0,sessionCount:history.sessionCount,platform:process.platform};const tip=selectTip("startup",context,tipRegistry,history);if(tip){history.recordShown(tip.id,0);return tip.content}return"Type / to see all available commands."}__name(pickStartupTip,"pickStartupTip");var Tips=__name(()=>{const selectedTip=(0,import_react6.useMemo)(()=>pickStartupTip(),[]);return(0,import_jsx_runtime7.jsx)(Box_default,{marginLeft:2,marginRight:2,children:(0,import_jsx_runtime7.jsxs)(Text,{color:theme.text.secondary,children:[t("Tips:")," ",t(selectedTip)]})})},"Tips");var import_jsx_runtime8=__toESM(require_jsx_runtime(),1);function getAuthDisplayType(authType,baseUrl,apiKeyEnvKey){if(!authType){return"unknown"}const matched=findProviderByCredentials(baseUrl,apiKeyEnvKey);if(matched&&resolveMetadataKey(matched)){return matched.label}switch(authType){case"qwen-oauth":return"qwen_oauth";default:return"api_key"}}__name(getAuthDisplayType,"getAuthDisplayType");var AppHeader=__name(({version})=>{const settings=useSettings();const config=useConfig();const contentGeneratorConfig=config.getContentGeneratorConfig();const authType=contentGeneratorConfig?.authType;const{currentModel}=useUIState();const model=config.getModelsConfig().getModelDisplayName(currentModel);const targetDir=config.getTargetDir();const showBanner=!config.getScreenReader()&&!settings.merged.ui?.hideBanner;const showTips=!(settings.merged.ui?.hideTips||config.getScreenReader());const authDisplayType=getAuthDisplayType(authType,contentGeneratorConfig?.baseUrl,contentGeneratorConfig?.apiKeyEnvKey);const resolvedBanner=(0,import_react7.useMemo)(()=>showBanner?resolveCustomBanner(settings):void 0,[showBanner,settings]);return(0,import_jsx_runtime8.jsxs)(Box_default,{flexDirection:"column",children:[showBanner&&(0,import_jsx_runtime8.jsx)(Header,{version,authDisplayType,model,workingDirectory:targetDir,customAsciiArt:resolvedBanner?.asciiArt,customBannerTitle:resolvedBanner?.title,customBannerSubtitle:resolvedBanner?.subtitle}),showTips&&(0,import_jsx_runtime8.jsx)(Tips,{})]})},"AppHeader");init_esbuild_shims();var import_jsx_runtime9=__toESM(require_jsx_runtime(),1);var DebugModeNotification=__name(()=>{const config=useConfig();if(!config.getDebugMode()){return null}const isFileLoggingEnabled=isDebugLogFileEnabled();const isDegraded=isDebugLoggingDegraded();return(0,import_jsx_runtime9.jsxs)(Box_default,{paddingX:1,marginTop:1,flexDirection:"column",children:[(0,import_jsx_runtime9.jsx)(Text,{color:theme.status.warning,children:"Debug mode enabled"}),isFileLoggingEnabled?(0,import_jsx_runtime9.jsxs)(Text,{dimColor:true,children:["Logging to: ",Storage.getDebugLogPath(config.getSessionId())]}):(0,import_jsx_runtime9.jsx)(Text,{dimColor:true,children:"Debug log file disabled by QWEN_DEBUG_LOG_FILE"}),isDegraded&&(0,import_jsx_runtime9.jsx)(Text,{dimColor:true,children:"Warning: Debug logging is degraded (write failures occurred)"})]})},"DebugModeNotification");init_esbuild_shims();var import_react13=__toESM(require_react(),1);init_esbuild_shims();var import_react11=__toESM(require_react(),1);init_esbuild_shims();var import_react8=__toESM(require_react(),1);function useBatchedScroll(currentScrollTop){const pendingScrollTopRef=(0,import_react8.useRef)(null);const currentScrollTopRef=(0,import_react8.useRef)(currentScrollTop);(0,import_react8.useLayoutEffect)(()=>{currentScrollTopRef.current=currentScrollTop;pendingScrollTopRef.current=null});const getScrollTop=(0,import_react8.useCallback)(()=>pendingScrollTopRef.current??currentScrollTopRef.current,[]);const setPendingScrollTop=(0,import_react8.useCallback)(newScrollTop=>{pendingScrollTopRef.current=newScrollTop},[]);return{getScrollTop,setPendingScrollTop}}__name(useBatchedScroll,"useBatchedScroll");init_esbuild_shims();var import_react9=__toESM(require_react(),1);function useAnimatedScrollbar(options={}){const{idleHideMs=1500}=options;const[isVisible,setIsVisible]=(0,import_react9.useState)(false);const timerRef=(0,import_react9.useRef)(null);const flashScrollbar=(0,import_react9.useCallback)(()=>{setIsVisible(true);if(timerRef.current!==null){clearTimeout(timerRef.current)}if(idleHideMs<=0){timerRef.current=null;return}timerRef.current=setTimeout(()=>{setIsVisible(false);timerRef.current=null},idleHideMs)},[idleHideMs]);(0,import_react9.useEffect)(()=>()=>{if(timerRef.current!==null){clearTimeout(timerRef.current);timerRef.current=null}},[]);return{isVisible,flashScrollbar}}__name(useAnimatedScrollbar,"useAnimatedScrollbar");init_esbuild_shims();var import_react10=__toESM(require_react(),1);var import_jsx_runtime10=__toESM(require_jsx_runtime(),1);var StaticRender=(0,import_react10.memo)(({children,width})=>(0,import_jsx_runtime10.jsx)(Box_default,{width,flexDirection:"column",flexShrink:0,children}),(prev,next)=>prev.children===next.children&&prev.width===next.width);StaticRender.displayName="StaticRender";var import_jsx_runtime11=__toESM(require_jsx_runtime(),1);var debugLogger=createDebugLogger("VIRTUALIZED_LIST");var SCROLL_TO_ITEM_END=Number.MAX_SAFE_INTEGER;function upperBound(arr,target){let lo=0;let hi=arr.length;while(lo<hi){const mid=lo+hi>>>1;if(arr[mid]<=target)lo=mid+1;else hi=mid}return lo}__name(upperBound,"upperBound");function findLastLE(arr,target){return upperBound(arr,target)-1}__name(findLastLE,"findLastLE");function firstIndexOfOffsetRun(offsets,index){let i=index;while(i>0&&offsets[i-1]===offsets[i]){i--}return i}__name(firstIndexOfOffsetRun,"firstIndexOfOffsetRun");var VirtualizedListItem=(0,import_react11.memo)(({content,shouldBeStatic,width,containerWidth,itemKey,onHeightChange})=>{const itemRef=(0,import_react11.useRef)(null);const{height,hasMeasured}=use_box_metrics_default(itemRef);const onHeightChangeRef=(0,import_react11.useRef)(onHeightChange);onHeightChangeRef.current=onHeightChange;(0,import_react11.useLayoutEffect)(()=>{const measuredHeight=itemRef.current?.yogaNode?.getComputedHeight()??height;if(hasMeasured){onHeightChangeRef.current(itemKey,measuredHeight)}},[itemKey,height,hasMeasured,content]);return(0,import_jsx_runtime11.jsx)(Box_default,{width:"100%",flexDirection:"column",flexShrink:0,ref:itemRef,children:shouldBeStatic?(0,import_jsx_runtime11.jsx)(StaticRender,{width:typeof width==="number"?width:containerWidth,children:content},itemKey+"-static-"+(typeof width==="number"?width:containerWidth)):content})});VirtualizedListItem.displayName="VirtualizedListItem";function VirtualizedList(props,ref){const{data,renderItem,estimatedItemHeight,keyExtractor,initialScrollIndex,initialScrollOffsetInIndex,renderStatic,isStaticItem,width}=props;const[scrollAnchor,setScrollAnchor]=(0,import_react11.useState)(()=>{const scrollToEnd=initialScrollIndex===SCROLL_TO_ITEM_END||typeof initialScrollIndex==="number"&&initialScrollIndex>=data.length-1&&initialScrollOffsetInIndex===SCROLL_TO_ITEM_END;if(scrollToEnd){return{index:data.length>0?data.length-1:0,offset:SCROLL_TO_ITEM_END}}if(typeof initialScrollIndex==="number"){return{index:Math.max(0,Math.min(data.length-1,initialScrollIndex)),offset:initialScrollOffsetInIndex??0}}if(typeof props.targetScrollIndex==="number"){return{index:props.targetScrollIndex,offset:0}}return{index:0,offset:0}});const[isStickingToBottom,setIsStickingToBottom]=(0,import_react11.useState)(()=>{const scrollToEnd=initialScrollIndex===SCROLL_TO_ITEM_END||typeof initialScrollIndex==="number"&&initialScrollIndex>=data.length-1&&initialScrollOffsetInIndex===SCROLL_TO_ITEM_END;return scrollToEnd});const containerRef=(0,import_react11.useRef)(null);const rootRef=(0,import_react11.useRef)(null);const{width:measuredContainerWidth,height:measuredContainerHeight}=use_box_metrics_default(containerRef);const containerHeight=props.containerHeight??measuredContainerHeight;const containerWidth=measuredContainerWidth;const[heights,setHeights]=(0,import_react11.useState)({});const measureAtFullHeight=props.measureAtFullHeight===true;const[fullHeightMeasurementPending,setFullHeightMeasurementPending]=(0,import_react11.useState)(measureAtFullHeight);const[previousMeasurementInputs,setPreviousMeasurementInputs]=(0,import_react11.useState)({enabled:measureAtFullHeight,data,renderItem});if(previousMeasurementInputs.enabled!==measureAtFullHeight||measureAtFullHeight&&(previousMeasurementInputs.data!==data||previousMeasurementInputs.renderItem!==renderItem)){setPreviousMeasurementInputs({enabled:measureAtFullHeight,data,renderItem});setFullHeightMeasurementPending(measureAtFullHeight)}const isInitialScrollSet=(0,import_react11.useRef)(false);const onHeightChange=(0,import_react11.useCallback)((key,height)=>{setHeights(prev=>{if(prev[key]===height)return prev;return{...prev,[key]:height}});setFullHeightMeasurementPending(false)},[]);(0,import_react11.useLayoutEffect)(()=>{setHeights(prev=>{const prevKeys=Object.keys(prev);if(prevKeys.length<=Math.max(8,2*data.length))return prev;const currentKeys=new Set;for(let i=0;i<data.length;i++){currentKeys.add(keyExtractor(data[i],i))}let staleSeen=false;for(const k of prevKeys){if(!currentKeys.has(k)){staleSeen=true;break}}if(!staleSeen)return prev;const next={};for(const k of prevKeys){if(currentKeys.has(k))next[k]=prev[k]}return next})},[data,keyExtractor]);const{totalHeight,offsets}=(0,import_react11.useMemo)(()=>{const offsets2=[0];let totalHeight2=0;for(let i=0;i<data.length;i++){const key=keyExtractor(data[i],i);const raw=heights[key]??estimatedItemHeight(i);const height=Number.isFinite(raw)&&raw>0?raw:0;totalHeight2+=height;offsets2.push(totalHeight2)}return{totalHeight:totalHeight2,offsets:offsets2}},[heights,data,estimatedItemHeight,keyExtractor]);const scrollableContainerHeight=containerHeight;const getAnchorForScrollTop=(0,import_react11.useCallback)((scrollTop2,offsets2)=>{const found=findLastLE(offsets2,scrollTop2);if(found===-1){return{index:0,offset:0}}const index=firstIndexOfOffsetRun(offsets2,found);return{index,offset:scrollTop2-offsets2[index]}},[]);const[prevTargetScrollIndex,setPrevTargetScrollIndex]=(0,import_react11.useState)(props.targetScrollIndex);const prevOffsetsLength=(0,import_react11.useRef)(1);const target=props.targetScrollIndex;if(target!==void 0&&offsets.length>1){const targetChanged=target!==prevTargetScrollIndex;const offsetsJustBecameUsable=prevOffsetsLength.current<=1;if(targetChanged||offsetsJustBecameUsable){if(targetChanged){setPrevTargetScrollIndex(target)}if(isStickingToBottom){setIsStickingToBottom(false)}const anchoredIndex=firstIndexOfOffsetRun(offsets,Math.max(0,Math.min(data.length-1,target)));if(scrollAnchor.index!==anchoredIndex||scrollAnchor.offset!==0){setScrollAnchor({index:anchoredIndex,offset:0})}}}prevOffsetsLength.current=offsets.length;const actualScrollTop=(0,import_react11.useMemo)(()=>{const offset=offsets[scrollAnchor.index];if(typeof offset!=="number"){return 0}if(scrollAnchor.offset===SCROLL_TO_ITEM_END){const item=data[scrollAnchor.index];const key=item?keyExtractor(item,scrollAnchor.index):"";const itemHeight=heights[key]??0;return offset+itemHeight-scrollableContainerHeight}return offset+scrollAnchor.offset},[scrollAnchor,offsets,heights,scrollableContainerHeight,data,keyExtractor]);const scrollTop=isStickingToBottom?Number.MAX_SAFE_INTEGER:actualScrollTop;const prevDataLength=(0,import_react11.useRef)(data.length);const prevTotalHeight=(0,import_react11.useRef)(totalHeight);const prevScrollTop=(0,import_react11.useRef)(actualScrollTop);const prevContainerHeight=(0,import_react11.useRef)(scrollableContainerHeight);(0,import_react11.useLayoutEffect)(()=>{const contentPreviouslyFit=prevTotalHeight.current<=prevContainerHeight.current;const wasScrolledToBottomPixels=prevScrollTop.current>=prevTotalHeight.current-prevContainerHeight.current-1;const wasAtBottom=contentPreviouslyFit||wasScrolledToBottomPixels;if(wasAtBottom&&actualScrollTop>=prevScrollTop.current){if(!isStickingToBottom){setIsStickingToBottom(true)}}const listGrew=data.length>prevDataLength.current;const containerChanged=prevContainerHeight.current!==scrollableContainerHeight;const shouldAutoScroll=props.targetScrollIndex===void 0;if(shouldAutoScroll&&(listGrew&&(isStickingToBottom||wasAtBottom)||isStickingToBottom&&containerChanged)){const newIndex=data.length>0?data.length-1:0;if(scrollAnchor.index!==newIndex||scrollAnchor.offset!==SCROLL_TO_ITEM_END){setScrollAnchor({index:newIndex,offset:SCROLL_TO_ITEM_END})}if(!isStickingToBottom){setIsStickingToBottom(true)}}else if((scrollAnchor.index>=data.length||actualScrollTop>totalHeight-scrollableContainerHeight)&&data.length>0){const newScrollTop=Math.max(0,totalHeight-scrollableContainerHeight);const newAnchor=getAnchorForScrollTop(newScrollTop,offsets);if(scrollAnchor.index!==newAnchor.index||scrollAnchor.offset!==newAnchor.offset){setScrollAnchor(newAnchor)}}else if(data.length===0){if(scrollAnchor.index!==0||scrollAnchor.offset!==0){setScrollAnchor({index:0,offset:0})}}prevDataLength.current=data.length;prevTotalHeight.current=totalHeight;prevScrollTop.current=actualScrollTop;prevContainerHeight.current=scrollableContainerHeight},[data.length,totalHeight,actualScrollTop,scrollableContainerHeight,scrollAnchor.index,scrollAnchor.offset,getAnchorForScrollTop,offsets,isStickingToBottom,props.targetScrollIndex]);(0,import_react11.useLayoutEffect)(()=>{if(isInitialScrollSet.current||offsets.length<=1||totalHeight<=0||scrollableContainerHeight<=0){return}if(props.targetScrollIndex!==void 0){isInitialScrollSet.current=true;return}if(typeof initialScrollIndex==="number"){const scrollToEnd=initialScrollIndex===SCROLL_TO_ITEM_END||initialScrollIndex>=data.length-1&&initialScrollOffsetInIndex===SCROLL_TO_ITEM_END;if(scrollToEnd){setScrollAnchor({index:data.length-1,offset:SCROLL_TO_ITEM_END});setIsStickingToBottom(true);isInitialScrollSet.current=true;return}const index=Math.max(0,Math.min(data.length-1,initialScrollIndex));const offset=initialScrollOffsetInIndex??0;const newScrollTop=(offsets[index]??0)+offset;const clampedScrollTop2=Math.max(0,Math.min(totalHeight-scrollableContainerHeight,newScrollTop));setScrollAnchor(getAnchorForScrollTop(clampedScrollTop2,offsets));isInitialScrollSet.current=true}},[initialScrollIndex,initialScrollOffsetInIndex,offsets,totalHeight,scrollableContainerHeight,getAnchorForScrollTop,data.length,heights,props.targetScrollIndex]);const maxScroll=Math.max(0,totalHeight-scrollableContainerHeight);const clampedScrollTop=Math.min(Math.max(0,isStickingToBottom?maxScroll:actualScrollTop),maxScroll);const startIndex=firstIndexOfOffsetRun(offsets,Math.max(0,findLastLE(offsets,clampedScrollTop)-1));const viewHeightForEndIndex=scrollableContainerHeight>0?scrollableContainerHeight:50;const endIndexOffsetRaw=upperBound(offsets,clampedScrollTop+viewHeightForEndIndex);const endIndex=endIndexOffsetRaw>=offsets.length?data.length-1:Math.min(data.length-1,endIndexOffsetRaw);const topSpacerHeight=renderStatic===true?0:offsets[startIndex]??0;const bottomSpacerHeight=renderStatic?0:totalHeight-(offsets[endIndex+1]??totalHeight);const isReady=containerHeight>0||false||width!==void 0&&typeof width==="number";if(!isReady){debugLogger.debug(`viewport not ready (containerHeight=${containerHeight}, width=${String(width)}); rendering empty until measurement settles`)}const renderRangeStart=renderStatic?0:startIndex;const renderRangeEnd=renderStatic?data.length-1:endIndex;const renderedItems=(0,import_react11.useMemo)(()=>{if(!isReady){return[]}const items=[];for(let i=renderRangeStart;i<=renderRangeEnd;i++){const item=data[i];if(item){const isOutsideViewport=i<startIndex||i>endIndex;const shouldBeStatic=renderStatic===true&&isOutsideViewport||isStaticItem?.(item,i)===true;let content;try{content=renderItem({item,index:i})}catch(err){debugLogger.debug(`renderItem threw at index ${i}`,err);content=(0,import_jsx_runtime11.jsx)(Box_default,{flexDirection:"column",flexShrink:0,children:(0,import_jsx_runtime11.jsx)(Text,{color:"red",children:"[render error]"})})}const key=keyExtractor(item,i);items.push((0,import_jsx_runtime11.jsx)(VirtualizedListItem,{itemKey:key,content,shouldBeStatic,width,containerWidth,onHeightChange},key))}}return items},[isReady,renderRangeStart,renderRangeEnd,data,startIndex,endIndex,renderStatic,isStaticItem,renderItem,keyExtractor,width,containerWidth,onHeightChange]);const{getScrollTop,setPendingScrollTop}=useBatchedScroll(scrollTop);const getScrollbarGeometry=(0,import_react11.useCallback)(()=>{const shouldShowScrollbar=(props.showScrollbar??true)&&maxScroll>0;if(!shouldShowScrollbar||!rootRef.current||scrollableContainerHeight<=0){return null}const metrics=measureElementPosition(rootRef.current);if(metrics.width<=0||metrics.height<=0)return null;return{col:metrics.x+metrics.width-1,top:metrics.y,height:scrollableContainerHeight}},[props.showScrollbar,maxScroll,scrollableContainerHeight]);const hitTestScrollbar=(0,import_react11.useCallback)(({col,row})=>{const geometry=getScrollbarGeometry();if(!geometry)return false;const zeroBasedCol=col-1;const zeroBasedRow=row-1;return zeroBasedCol===geometry.col&&zeroBasedRow>=geometry.top&&zeroBasedRow<geometry.top+geometry.height},[getScrollbarGeometry]);const scrollToScrollbarRow=(0,import_react11.useCallback)(row=>{const geometry=getScrollbarGeometry();if(!geometry)return;const zeroBasedRow=row-1;const rowInTrack=Math.max(0,Math.min(geometry.height-1,zeroBasedRow-geometry.top));const scrollRatio=rowInTrack/Math.max(1,geometry.height-1);const newScrollTop=Math.round(scrollRatio*maxScroll);if(newScrollTop>=maxScroll){setIsStickingToBottom(true);setPendingScrollTop(Number.MAX_SAFE_INTEGER);if(data.length>0){setScrollAnchor({index:data.length-1,offset:SCROLL_TO_ITEM_END})}}else{setIsStickingToBottom(false);setPendingScrollTop(newScrollTop);setScrollAnchor(getAnchorForScrollTop(newScrollTop,offsets))}},[data.length,getAnchorForScrollTop,getScrollbarGeometry,maxScroll,offsets,setPendingScrollTop]);(0,import_react11.useImperativeHandle)(ref,()=>({scrollBy:__name(delta=>{if(delta<0){setIsStickingToBottom(false)}const currentScrollTop=getScrollTop();const maxScroll2=Math.max(0,totalHeight-scrollableContainerHeight);const actualCurrent=Math.min(currentScrollTop,maxScroll2);const newScrollTop=Math.max(0,actualCurrent+delta);if(newScrollTop>=maxScroll2){setIsStickingToBottom(true);setPendingScrollTop(Number.MAX_SAFE_INTEGER);if(data.length>0){setScrollAnchor({index:data.length-1,offset:SCROLL_TO_ITEM_END})}return}setPendingScrollTop(newScrollTop);setScrollAnchor(getAnchorForScrollTop(newScrollTop,offsets))},"scrollBy"),scrollTo:__name(offset=>{const maxScroll2=Math.max(0,totalHeight-scrollableContainerHeight);if(offset>=maxScroll2||offset===SCROLL_TO_ITEM_END){setIsStickingToBottom(true);setPendingScrollTop(Number.MAX_SAFE_INTEGER);if(data.length>0){setScrollAnchor({index:data.length-1,offset:SCROLL_TO_ITEM_END})}}else{setIsStickingToBottom(false);const newScrollTop=Math.max(0,offset);setPendingScrollTop(newScrollTop);setScrollAnchor(getAnchorForScrollTop(newScrollTop,offsets))}},"scrollTo"),scrollToEnd:__name(()=>{setIsStickingToBottom(true);setPendingScrollTop(Number.MAX_SAFE_INTEGER);if(data.length>0){setScrollAnchor({index:data.length-1,offset:SCROLL_TO_ITEM_END})}},"scrollToEnd"),scrollToIndex:__name(({index,viewOffset=0,viewPosition=0})=>{setIsStickingToBottom(false);const offset=offsets[index];if(offset!==void 0){const maxScroll2=Math.max(0,totalHeight-scrollableContainerHeight);const newScrollTop=Math.max(0,Math.min(maxScroll2,offset-viewPosition*scrollableContainerHeight+viewOffset));setPendingScrollTop(newScrollTop);setScrollAnchor(getAnchorForScrollTop(newScrollTop,offsets))}},"scrollToIndex"),scrollToItem:__name(({item,viewOffset=0,viewPosition=0})=>{setIsStickingToBottom(false);const index=data.indexOf(item);if(index!==-1){const offset=offsets[index];if(offset!==void 0){const maxScroll2=Math.max(0,totalHeight-scrollableContainerHeight);const newScrollTop=Math.max(0,Math.min(maxScroll2,offset-viewPosition*scrollableContainerHeight+viewOffset));setPendingScrollTop(newScrollTop);setScrollAnchor(getAnchorForScrollTop(newScrollTop,offsets))}}},"scrollToItem"),hitTestScrollbar,scrollToScrollbarRow,getScrollIndex:__name(()=>scrollAnchor.index,"getScrollIndex"),getScrollState:__name(()=>{const maxScroll2=Math.max(0,totalHeight-scrollableContainerHeight);return{scrollTop:Math.min(getScrollTop(),maxScroll2),scrollHeight:totalHeight,innerHeight:scrollableContainerHeight}},"getScrollState"),getViewportRect:__name(()=>rootRef.current?measureElementPosition(rootRef.current):null,"getViewportRect")}),[offsets,scrollAnchor,totalHeight,getAnchorForScrollTop,data,scrollableContainerHeight,getScrollTop,setPendingScrollTop,hitTestScrollbar,scrollToScrollbarRow]);const showScrollbar=(props.showScrollbar??true)&&maxScroll>0;const{isVisible:scrollbarThumbActive,flashScrollbar}=useAnimatedScrollbar();const isInitialScrollFlash=(0,import_react11.useRef)(true);(0,import_react11.useLayoutEffect)(()=>{if(isInitialScrollFlash.current){isInitialScrollFlash.current=false;return}flashScrollbar()},[clampedScrollTop,flashScrollbar]);const scrollbarContent=(0,import_react11.useMemo)(()=>{if(!showScrollbar||scrollableContainerHeight<=0)return null;const trackLen=scrollableContainerHeight;const thumbLen=Math.max(1,Math.round(trackLen*trackLen/totalHeight));const thumbTop=Math.round(clampedScrollTop/maxScroll*(trackLen-thumbLen));return(0,import_jsx_runtime11.jsx)(Box_default,{width:1,flexDirection:"column",flexShrink:0,children:Array.from({length:trackLen},(_,i)=>{const inThumb=i>=thumbTop&&i<thumbTop+thumbLen;if(!scrollbarThumbActive){return(0,import_jsx_runtime11.jsx)(Text,{selectable:false,children:" "},i)}return(0,import_jsx_runtime11.jsx)(Text,{dimColor:!inThumb,selectable:false,children:inThumb?"\u2588":"\u2502"},i)})})},[showScrollbar,scrollableContainerHeight,totalHeight,clampedScrollTop,maxScroll,scrollbarThumbActive]);const rootHeight=props.containerHeight!==void 0?fullHeightMeasurementPending?props.containerHeight:Math.min(props.containerHeight,totalHeight):"100%";return(0,import_jsx_runtime11.jsxs)(Box_default,{ref:rootRef,width:"100%",height:rootHeight,flexDirection:"row",children:[(0,import_jsx_runtime11.jsx)(Box_default,{ref:containerRef,overflowY:"hidden",overflowX:"hidden",flexGrow:1,flexDirection:"column",children:(0,import_jsx_runtime11.jsxs)(Box_default,{flexShrink:0,width:"100%",flexDirection:"column",marginTop:-clampedScrollTop,children:[(0,import_jsx_runtime11.jsx)(Box_default,{height:topSpacerHeight,flexShrink:0}),renderedItems,(0,import_jsx_runtime11.jsx)(Box_default,{height:bottomSpacerHeight,flexShrink:0})]})}),scrollbarContent]})}__name(VirtualizedList,"VirtualizedList");var VirtualizedListWithForwardRef=(0,import_react11.forwardRef)(VirtualizedList);VirtualizedList.displayName="VirtualizedList";init_esbuild_shims();var import_react12=__toESM(require_react(),1);var SCROLL_FRAME_MS=16;function useFrameCoalescedFlush(flush,frameMs=SCROLL_FRAME_MS){const timer=(0,import_react12.useRef)(null);const flushRef=(0,import_react12.useRef)(flush);flushRef.current=flush;const run=(0,import_react12.useCallback)(()=>{timer.current=null;flushRef.current()},[]);const schedule=(0,import_react12.useCallback)(()=>{if(timer.current!==null)return;timer.current=setTimeout(run,frameMs)},[run,frameMs]);const cancel=(0,import_react12.useCallback)(()=>{if(timer.current!==null){clearTimeout(timer.current);timer.current=null}},[]);(0,import_react12.useEffect)(()=>cancel,[cancel]);return{schedule,cancel}}__name(useFrameCoalescedFlush,"useFrameCoalescedFlush");var import_jsx_runtime12=__toESM(require_jsx_runtime(),1);function ScrollableList(props,ref){const{hasFocus,...virtualizedListProps}=props;const virtualizedListRef=(0,import_react13.useRef)(null);const isDraggingScrollbar=(0,import_react13.useRef)(false);(0,import_react13.useImperativeHandle)(ref,()=>({scrollBy:__name(delta=>virtualizedListRef.current?.scrollBy(delta),"scrollBy"),scrollTo:__name(offset=>virtualizedListRef.current?.scrollTo(offset),"scrollTo"),scrollToEnd:__name(()=>virtualizedListRef.current?.scrollToEnd(),"scrollToEnd"),scrollToIndex:__name(params=>virtualizedListRef.current?.scrollToIndex(params),"scrollToIndex"),scrollToItem:__name(params=>virtualizedListRef.current?.scrollToItem(params),"scrollToItem"),hitTestScrollbar:__name(location=>virtualizedListRef.current?.hitTestScrollbar(location)??false,"hitTestScrollbar"),scrollToScrollbarRow:__name(row=>virtualizedListRef.current?.scrollToScrollbarRow(row),"scrollToScrollbarRow"),getScrollIndex:__name(()=>virtualizedListRef.current?.getScrollIndex()??0,"getScrollIndex"),getScrollState:__name(()=>virtualizedListRef.current?.getScrollState()??{scrollTop:0,scrollHeight:0,innerHeight:0},"getScrollState"),getViewportRect:__name(()=>virtualizedListRef.current?.getViewportRect()??null,"getViewportRect")}),[]);const getScrollState=(0,import_react13.useCallback)(()=>virtualizedListRef.current?.getScrollState()??{scrollTop:0,scrollHeight:0,innerHeight:0},[]);useKeypress((0,import_react13.useCallback)(key=>{if(keyMatchers["scrollUp"](key)){virtualizedListRef.current?.scrollBy(-1)}else if(keyMatchers["scrollDown"](key)){virtualizedListRef.current?.scrollBy(1)}else if(keyMatchers["pageUp"](key)){const state=getScrollState();const delta=state.innerHeight>0?state.innerHeight:20;virtualizedListRef.current?.scrollBy(-delta)}else if(keyMatchers["pageDown"](key)){const state=getScrollState();const delta=state.innerHeight>0?state.innerHeight:20;virtualizedListRef.current?.scrollBy(delta)}else if(keyMatchers["scrollHome"](key)){virtualizedListRef.current?.scrollTo(0)}else if(keyMatchers["scrollEnd"](key)){virtualizedListRef.current?.scrollToEnd()}},[getScrollState]),{isActive:hasFocus});const WHEEL_LINES_PER_TICK=3;const pendingWheelDelta=(0,import_react13.useRef)(0);const pendingDragRow=(0,import_react13.useRef)(null);const applyPendingScroll=(0,import_react13.useCallback)(()=>{const list=virtualizedListRef.current;const dragRow=pendingDragRow.current;const wheelDelta=pendingWheelDelta.current;pendingDragRow.current=null;pendingWheelDelta.current=0;if(!list)return;if(dragRow!==null){list.scrollToScrollbarRow(dragRow);return}if(wheelDelta!==0){list.scrollBy(wheelDelta)}},[]);const{schedule:scheduleScrollFlush,cancel:cancelScrollFlush}=useFrameCoalescedFlush(applyPendingScroll);const cancelPendingScroll=(0,import_react13.useCallback)(()=>{pendingWheelDelta.current=0;pendingDragRow.current=null;cancelScrollFlush()},[cancelScrollFlush]);(0,import_react13.useEffect)(()=>{if(!hasFocus)cancelPendingScroll()},[hasFocus,cancelPendingScroll]);const handleMouseEvent=(0,import_react13.useCallback)(event=>{if(!virtualizedListRef.current)return;if(event.name==="left-release"){isDraggingScrollbar.current=false;return}if(event.name==="left-press"){isDraggingScrollbar.current=virtualizedListRef.current.hitTestScrollbar(event);if(isDraggingScrollbar.current){cancelPendingScroll();virtualizedListRef.current.scrollToScrollbarRow(event.row)}return}if(event.name==="move"&&isDraggingScrollbar.current){pendingDragRow.current=event.row;scheduleScrollFlush();return}if(event.name==="scroll-up"){pendingWheelDelta.current-=WHEEL_LINES_PER_TICK;scheduleScrollFlush()}else if(event.name==="scroll-down"){pendingWheelDelta.current+=WHEEL_LINES_PER_TICK;scheduleScrollFlush()}},[scheduleScrollFlush,cancelPendingScroll]);useMouseEvents(handleMouseEvent,{isActive:hasFocus,bypassVpGate:true});return(0,import_jsx_runtime12.jsx)(VirtualizedListWithForwardRef,{ref:virtualizedListRef,...virtualizedListProps})}__name(ScrollableList,"ScrollableList");var ScrollableListWithForwardRef=(0,import_react13.forwardRef)(ScrollableList);init_esbuild_shims();var import_react14=__toESM(require_react(),1);init_esbuild_shims();var SelectionState=class{static{__name(this,"SelectionState")}anchor=null;focus=null;dragging=false;mode="char";start(point,mode="char"){this.anchor=point;this.focus=point;this.dragging=true;this.mode=mode}extend(point){if(this.anchor){this.focus=point}}finish(){this.dragging=false}clear(){this.anchor=null;this.focus=null;this.dragging=false;this.mode="char"}get isEmpty(){return this.anchor===null||this.focus===null}get isCollapsed(){return!this.isEmpty&&this.anchor.x===this.focus.x&&this.anchor.y===this.focus.y}get isBareClick(){return this.isCollapsed&&this.mode==="char"}normalized(){if(!this.anchor||!this.focus){return null}const{anchor,focus}=this;const anchorFirst=anchor.y<focus.y||anchor.y===focus.y&&anchor.x<=focus.x;const start=anchorFirst?anchor:focus;const end=anchorFirst?focus:anchor;return{sx:start.x,sy:start.y,ex:end.x,ey:end.y}}};init_esbuild_shims();function getSelectedText(frame,selection){if(!frame){return""}const{sx,sy,ex,ey}=selection;let text="";for(let y=sy;y<=ey;y++){const row=frame.cells[y];if(!row){if(y<ey){text+="\n"}continue}const startX=y===sy?sx:0;const endX=y===ey?ex:row.length-1;let rowText="";let skippedLayoutGap=false;for(let x=Math.max(0,startX);x<=endX&&x<row.length;x++){const cell=row[x];if(cell.selectable){if(skippedLayoutGap&&rowText.length>0&&cell.value!==""&&!/\s$/u.test(rowText)&&!/^\s/u.test(cell.value)){rowText+=" "}rowText+=cell.value;skippedLayoutGap=false}else if(rowText.length>0){skippedLayoutGap=true}}text+=rowText;if(y<ey){text+=boundaryJoiner(frame,selection,y)}}return text}__name(getSelectedText,"getSelectedText");function selectedFlows(frame,selection,y){const row=frame.cells[y]??[];const startX=y===selection.sy?selection.sx:0;const endX=y===selection.ey?selection.ex:row.length-1;const flows=new Set;for(let x=Math.max(0,startX);x<=endX&&x<row.length;x++){const cell=row[x];if(cell.selectable&&cell.flowId!==null){flows.add(cell.flowId)}}if(flows.size>0){return flows}for(const boundaryY of[y-1,y]){const boundaryRow=frame.boundaries[boundaryY]??[];for(let x=Math.max(0,startX);x<=endX&&x<boundaryRow.length;x++){const claim=boundaryRow[x];if(claim?.selectable){flows.add(claim.flowId)}}}return flows}__name(selectedFlows,"selectedFlows");function boundaryJoiner(frame,selection,y){const currentFlows=selectedFlows(frame,selection,y);const nextFlows=selectedFlows(frame,selection,y+1);const[currentFlow]=currentFlows;const[nextFlow]=nextFlows;if(currentFlows.size!==1||nextFlows.size!==1||currentFlow!==nextFlow){return"\n"}const flowId=currentFlow;const claims=(frame.boundaries[y]??[]).filter(claim=>claim!==null&&claim.selectable&&claim.flowId===flowId);if(claims.length===0){return"\n"}const first=claims[0];if(claims.some(claim=>claim.kind!==first.kind||claim.joiner!==first.joiner)){return"\n"}return first.kind==="soft"?first.joiner:"\n"}__name(boundaryJoiner,"boundaryJoiner");init_esbuild_shims();function isWordCell(value){return value!==""&&value!==" "&&!/^\s$/u.test(value)}__name(isWordCell,"isWordCell");function lastContentColumn(row,start,end){for(let x=end;x>=start;x--){if(row[x].value!==""&&row[x].value!==" "){return x}}return-1}__name(lastContentColumn,"lastContentColumn");function wordSpanAt(frame,x,y){const row=frame?.cells[y];if(!row){return null}const cell=row[x];if(!cell||!isWordCell(cell.value)){return null}let sx=x;while(sx>0&&(row[sx-1].value===""||isWordCell(row[sx-1].value))){sx--}let ex=x;while(ex<row.length-1&&(row[ex+1].value===""||isWordCell(row[ex+1].value))){ex++}return{sx,sy:y,ex,ey:y}}__name(wordSpanAt,"wordSpanAt");function selectableLineSpan(row,x,y){let start=x;while(start>0&&row[start-1].selectable){start--}let runEnd=x;while(runEnd<row.length-1&&row[runEnd+1].selectable){runEnd++}const contentEnd=lastContentColumn(row,start,runEnd);return{sx:start,sy:y,ex:contentEnd,ey:y}}__name(selectableLineSpan,"selectableLineSpan");function isSelectableContent(cell){return cell.selectable&&cell.value!==""&&cell.value!==" "}__name(isSelectableContent,"isSelectableContent");function lineSpanAt(frame,x,y){const row=frame?.cells[y];if(!row||row.length===0){return null}const origin=Math.max(0,Math.min(x,row.length-1));for(let distance=0;distance<row.length;distance++){const left=origin-distance;if(left>=0&&isSelectableContent(row[left])){return selectableLineSpan(row,left,y)}const right=origin+distance;if(distance>0&&right<row.length&&isSelectableContent(row[right])){return selectableLineSpan(row,right,y)}}return null}__name(lineSpanAt,"lineSpanAt");function spanAtForMode(frame,mode,point){return mode==="word"?wordSpanAt(frame,point.x,point.y):lineSpanAt(frame,point.x,point.y)}__name(spanAtForMode,"spanAtForMode");init_esbuild_shims();function terminalToGrid(col,row,terminalHeight,frameHeight){const anchor=frameAnchor(terminalHeight,frameHeight);return{x:col-1,y:row-1-anchor}}__name(terminalToGrid,"terminalToGrid");function snapWideChar(frame,point){const row=frame?.cells[point.y];if(point.x>0&&row?.[point.x]?.value===""&&row[point.x-1]?.fullWidth){return{...point,x:point.x-1}}return point}__name(snapWideChar,"snapWideChar");function pointInViewport(point,rect){return point.y>=rect.y&&point.y<rect.y+rect.height&&point.x>=rect.x&&point.x<rect.x+rect.width}__name(pointInViewport,"pointInViewport");function clampToViewport(point,rect){return{x:Math.max(rect.x,Math.min(rect.x+rect.width-1,point.x)),y:Math.max(rect.y,Math.min(rect.y+rect.height-1,point.y))}}__name(clampToViewport,"clampToViewport");var sameViewportContent=__name((previous,current,rect)=>{if(!previous){return false}for(let y=rect.y;y<rect.y+rect.height;y++){for(let x=rect.x;x<rect.x+rect.width;x++){const cell=previous.cells[y]?.[x];const currentCell=current.cells[y]?.[x];if(cell?.value!==currentCell?.value||cell?.fullWidth!==currentCell?.fullWidth){return false}}}return true},"sameViewportContent");var sameViewportRect=__name((previous,current)=>previous!==null&&current!==null&&previous.x===current.x&&previous.y===current.y&&previous.width===current.width&&previous.height===current.height,"sameViewportRect");var MULTI_CLICK_MS=400;var debugLogger2=createDebugLogger("TEXT_SELECTION");function TextSelectionController(props){const{stdout}=use_stdout_default();const selectionRef=(0,import_react14.useRef)(new SelectionState);const dragScrollTopRef=(0,import_react14.useRef)(null);const baselineScrollTopRef=(0,import_react14.useRef)(0);const baselineScrollHeightRef=(0,import_react14.useRef)(0);const baselineFrameRef=(0,import_react14.useRef)(null);const baselineRectRef=(0,import_react14.useRef)(null);const activeRectIndexRef=(0,import_react14.useRef)(null);const selectionGenerationRef=(0,import_react14.useRef)(0);const pendingInvalidationGenRef=(0,import_react14.useRef)(null);const lastClickRef=(0,import_react14.useRef)(null);const anchorSpanRef=(0,import_react14.useRef)(null);const bufferRef=(0,import_react14.useRef)(void 0);const propsRef=(0,import_react14.useRef)(props);propsRef.current=props;const getBuffer=(0,import_react14.useCallback)(()=>{if(!bufferRef.current){bufferRef.current=getScreenBuffer(stdout)}return bufferRef.current},[stdout]);const clearSelection=(0,import_react14.useCallback)(()=>{selectionGenerationRef.current+=1;activeRectIndexRef.current=null;const selection=selectionRef.current;anchorSpanRef.current=null;if(selection.isEmpty){return}selection.clear();getBuffer()?.setSelection(null)},[getBuffer]);const applyHighlight=(0,import_react14.useCallback)(()=>{const selection=selectionRef.current;const normalized=selection.normalized();getBuffer()?.setSelection(normalized&&!selection.isBareClick?normalized:null)},[getBuffer]);const getSelectableRects=(0,import_react14.useCallback)(()=>{const viewportRect=propsRef.current.getViewportRect();if(!viewportRect){return[]}const additionalRects=propsRef.current.getAdditionalSelectableRects?.()??[];return[viewportRect,...additionalRects]},[]);const getActiveRect=(0,import_react14.useCallback)(()=>{const index=activeRectIndexRef.current;return index===null?null:getSelectableRects()[index]??null},[getSelectableRects]);const recordBaseline=(0,import_react14.useCallback)(rect=>{const scrollState=propsRef.current.getScrollState();baselineScrollTopRef.current=scrollState.scrollTop;baselineScrollHeightRef.current=scrollState.scrollHeight;baselineFrameRef.current=getBuffer()?.frame??null;baselineRectRef.current=rect},[getBuffer]);const copySelection=(0,import_react14.useCallback)(()=>{const normalized=selectionRef.current.normalized();const text=normalized?getSelectedText(getBuffer()?.frame??null,normalized):"";if(text){void copyToClipboard(text).catch(error=>{debugLogger2.warn("Failed to copy selected text:",error)})}},[getBuffer]);const mapEvent=(0,import_react14.useCallback)(event=>{const buffer=getBuffer();if(!buffer){return null}const frameHeight=buffer.dimensions.height;const terminalHeight=stdout.rows??frameHeight;const point=terminalToGrid(event.col,event.row,terminalHeight,frameHeight);return snapWideChar(buffer.frame,point)},[getBuffer,stdout]);const extendSpanDrag=(0,import_react14.useCallback)(point=>{const anchor=anchorSpanRef.current;if(!anchor)return;const{span,mode}=anchor;const selection=selectionRef.current;const frame=getBuffer()?.frame??null;const current=spanAtForMode(frame,mode,point)??{sx:point.x,sy:point.y,ex:point.x,ey:point.y};const cursorAfter=point.y>span.ey||point.y===span.ey&&point.x>=span.ex;selection.anchor=cursorAfter?{x:span.sx,y:span.sy}:{x:span.ex,y:span.ey};selection.focus=cursorAfter?{x:current.ex,y:current.ey}:{x:current.sx,y:current.sy}},[getBuffer]);const extendActiveDrag=(0,import_react14.useCallback)(point=>{if(anchorSpanRef.current){extendSpanDrag(point)}else{selectionRef.current.extend(point)}},[extendSpanDrag]);const handleMouse=(0,import_react14.useCallback)(event=>{const selection=selectionRef.current;if(propsRef.current.eventsPaused){if(event.name==="left-release"){selection.finish()}return}if(event.name.startsWith("scroll-")){if(activeRectIndexRef.current===0){clearSelection()}return}if(event.name==="left-press"){selectionGenerationRef.current+=1;if(propsRef.current.hitTestScrollbar({col:event.col,row:event.row})){clearSelection();return}const point=mapEvent(event);const rects=getSelectableRects();const rectIndex=point?rects.findIndex(rect2=>pointInViewport(point,rect2)):-1;if(!point||rectIndex<0){clearSelection();return}const rect=rects[rectIndex];activeRectIndexRef.current=rectIndex;const now=Date.now();const prev=lastClickRef.current;const near=prev!=null&&prev.y===point.y&&Math.abs(prev.x-point.x)<=1&&now-prev.time<MULTI_CLICK_MS;const count=near?Math.min(prev.count+1,3):1;lastClickRef.current={x:point.x,y:point.y,time:now,count};if(count>=2){const frame=getBuffer()?.frame??null;const mode=count===2?"word":"line";const span=spanAtForMode(frame,mode,point);if(span){selection.start({x:span.sx,y:span.sy},mode);selection.extend({x:span.ex,y:span.ey});anchorSpanRef.current={span,mode};dragScrollTopRef.current=propsRef.current.getScrollState().scrollTop;recordBaseline(rect);applyHighlight();copySelection();return}}anchorSpanRef.current=null;selection.start(point);dragScrollTopRef.current=propsRef.current.getScrollState().scrollTop;recordBaseline(rect);applyHighlight();return}if(event.name==="move"){if(!selection.dragging){return}if(!anchorSpanRef.current){lastClickRef.current=null}if(activeRectIndexRef.current===0&&propsRef.current.getScrollState().scrollTop!==dragScrollTopRef.current){clearSelection();return}const point=mapEvent(event);const rect=getActiveRect();if(!point||!rect){clearSelection();return}extendActiveDrag(clampToViewport(point,rect));applyHighlight();return}if(event.name==="left-release"){if(!selection.dragging){return}if(pendingInvalidationGenRef.current===selectionGenerationRef.current){clearSelection();return}const point=mapEvent(event);const rect=getActiveRect();if(point&&rect){extendActiveDrag(clampToViewport(point,rect))}anchorSpanRef.current=null;selection.finish();if(selection.isEmpty||selection.isBareClick){clearSelection();return}applyHighlight();copySelection();return}},[clearSelection,applyHighlight,copySelection,recordBaseline,mapEvent,getBuffer,getSelectableRects,getActiveRect,extendActiveDrag]);useMouseEvents(handleMouse,{isActive:props.isActive,tracking:"button"});(0,import_react14.useEffect)(()=>{const buffer=getBuffer();if(!buffer){return}return buffer.subscribe(frame=>{if(selectionRef.current.isEmpty){return}const{scrollTop,scrollHeight}=propsRef.current.getScrollState();const activeRect=getActiveRect();const isViewportSelection=activeRectIndexRef.current===0;if(isViewportSelection&&(scrollTop!==baselineScrollTopRef.current||scrollHeight!==baselineScrollHeightRef.current)||!sameViewportRect(baselineRectRef.current,activeRect)||!sameViewportContent(baselineFrameRef.current,frame,activeRect)){const invalidatedGeneration=selectionGenerationRef.current;pendingInvalidationGenRef.current=invalidatedGeneration;queueMicrotask(()=>{pendingInvalidationGenRef.current=null;if(selectionGenerationRef.current===invalidatedGeneration){clearSelection()}})}})},[getBuffer,getActiveRect,clearSelection]);(0,import_react14.useEffect)(()=>{if(!props.isActive){clearSelection()}},[props.isActive,clearSelection]);(0,import_react14.useEffect)(()=>()=>getBuffer()?.setSelection(null),[getBuffer]);const selectionQueryRef=props.selectionQueryRef;(0,import_react14.useEffect)(()=>{if(!selectionQueryRef){return}selectionQueryRef.current={getRange:__name(()=>{const selection=selectionRef.current;if(selection.isEmpty||selection.isCollapsed&&selection.mode==="char"){return null}return selection.normalized()},"getRange")};return()=>{selectionQueryRef.current=null}},[selectionQueryRef]);return null}__name(TextSelectionController,"TextSelectionController");init_esbuild_shims();var import_react15=__toESM(require_react(),1);var debugLogger3=createDebugLogger("CONTENT_MOUSE");function ContentMouseController(props){const{stdout}=use_stdout_default();const{columns,rows}=useTerminalSize();const menu=useContextMenu();const bufferRef=(0,import_react15.useRef)(void 0);const pressRef=(0,import_react15.useRef)(null);const lastClickRef=(0,import_react15.useRef)(null);const pendingOpenRef=(0,import_react15.useRef)(null);const propsRef=(0,import_react15.useRef)(props);propsRef.current=props;const getBuffer=(0,import_react15.useCallback)(()=>{if(!bufferRef.current){bufferRef.current=getScreenBuffer(stdout)}return bufferRef.current},[stdout]);const mapPoint=(0,import_react15.useCallback)(event=>{const buffer=getBuffer();if(!buffer)return null;const frameHeight=buffer.dimensions.height;const terminalHeight=stdout.rows??frameHeight;const point=terminalToGrid(event.col,event.row,terminalHeight,frameHeight);return snapWideChar(buffer.frame,point)},[getBuffer,stdout]);const fallbackCopy=(0,import_react15.useCallback)(url=>{void copyToClipboard(url).then(()=>{console.warn(`Link copied to clipboard (not openable directly): ${url}`)}).catch(error=>{console.warn(`Unable to copy link to clipboard: ${url}`);debugLogger3.warn("Clipboard copy failed:",error)})},[]);const openLink=(0,import_react15.useCallback)(url=>{if(/^https?:\/\//i.test(url)){void openBrowserSecurely(url).catch(()=>fallbackCopy(url));return}fallbackCopy(url)},[fallbackCopy]);const cancelPendingOpen=(0,import_react15.useCallback)(()=>{const pending=pendingOpenRef.current;if(pending){clearTimeout(pending.timer);pendingOpenRef.current=null}},[]);const armPendingOpen=(0,import_react15.useCallback)(url=>{cancelPendingOpen();const timer=setTimeout(()=>{pendingOpenRef.current=null;openLink(url)},MULTI_CLICK_MS);pendingOpenRef.current={url,timer}},[cancelPendingOpen,openLink]);const handleMouse=(0,import_react15.useCallback)(event=>{if(event.name.endsWith("-press")||event.name.startsWith("scroll-")){cancelPendingOpen()}const openMenuState=menu.menu;if(openMenuState){const{position,items}=openMenuState;const size=contextMenuSize(items);const inMenu=__name(p=>p.x>=position.x&&p.x<position.x+size.width&&p.y>=position.y&&p.y<position.y+size.height,"inMenu");const itemIndexOf=__name(p=>p.y-position.y-1,"itemIndexOf");if(event.name==="move"){const p=mapPoint(event);if(p&&inMenu(p)){const index=itemIndexOf(p);if(index>=0&&index<items.length){menu.setSelectedIndex(index)}}return}if(event.name==="left-press"){const p=mapPoint(event);if(p&&inMenu(p)){const index=itemIndexOf(p);if(index>=0&&index<items.length){menu.executeIndex(index);return}}menu.closeMenu();return}if(event.name.startsWith("scroll-")){menu.closeMenu();return}if(event.name==="right-press"){menu.closeMenu()}else if(event.name.endsWith("-press")){menu.closeMenu();return}else{return}}if(event.name.startsWith("scroll-")){pressRef.current=null;lastClickRef.current=null;return}if(event.name==="move"&&event.button!=="none"){if(lastClickRef.current?.count===1){lastClickRef.current=null}const anchor=pressRef.current;if(anchor){const point2=mapPoint(event);if(!point2||point2.x!==anchor.x||point2.y!==anchor.y){pressRef.current=null}}return}const rect=propsRef.current.getViewportRect();if(!rect)return;if(propsRef.current.hitTestScrollbar({col:event.col,row:event.row})){return}const point=mapPoint(event);if(!point||!pointInViewport(point,rect))return;if(event.name==="right-press"){const frame=getBuffer()?.frame??null;const items=[];const url=hyperlinkAtCell(frame,point.x,point.y);if(url){items.push({id:"open-link",label:"Open Link",onSelect:__name(()=>openLink(url),"onSelect")});items.push({id:"copy-link",label:"Copy Link Address",onSelect:__name(()=>{void copyToClipboard(url).catch(error=>{debugLogger3.warn("Failed to copy link address:",error)})},"onSelect")})}const range=propsRef.current.selectionQueryRef?.current?.getRange();if(range){const selectionText=getSelectedText(frame,range);if(selectionText){items.push({id:"copy-selection",label:"Copy Selection",onSelect:__name(()=>{void copyToClipboard(selectionText).catch(error=>{debugLogger3.warn("Failed to copy selected text:",error)})},"onSelect")})}}if(items.length===0)return;const frameHeight=getBuffer()?.dimensions.height??rows;const visibleTop=Math.max(0,frameHeight-rows);const position=clampMenuPosition({x:point.x,y:Math.max(point.y,visibleTop)},contextMenuSize(items),columns,frameHeight);menu.openMenu(items,position);return}if(event.name==="left-press"){pressRef.current=point;const now=Date.now();const prev=lastClickRef.current;const near=prev!=null&&prev.y===point.y&&Math.abs(prev.x-point.x)<=1&&now-prev.time<MULTI_CLICK_MS;lastClickRef.current={x:point.x,y:point.y,time:now,count:near?Math.min(prev.count+1,3):1};return}if(event.name==="left-release"){const press=pressRef.current;pressRef.current=null;if(!press||press.x!==point.x||press.y!==point.y)return;if(lastClickRef.current?.count!==1)return;const url=hyperlinkAtCell(getBuffer()?.frame??null,point.x,point.y);if(url){armPendingOpen(url)}return}},[menu,mapPoint,getBuffer,openLink,armPendingOpen,cancelPendingOpen,columns,rows]);useMouseEvents(handleMouse,{isActive:props.isActive,tracking:menu.menu!==null?"any":"button"});const{closeMenu}=menu;const isActive=props.isActive;(0,import_react15.useEffect)(()=>{if(!isActive){closeMenu();cancelPendingOpen()}return()=>{closeMenu();cancelPendingOpen()}},[isActive,closeMenu,cancelPendingOpen]);const prevSizeRef=(0,import_react15.useRef)({columns,rows});(0,import_react15.useEffect)(()=>{const prev=prevSizeRef.current;prevSizeRef.current={columns,rows};if(prev.columns!==columns||prev.rows!==rows){closeMenu()}},[columns,rows,closeMenu]);return null}__name(ContentMouseController,"ContentMouseController");var import_jsx_runtime13=__toESM(require_jsx_runtime(),1);var MAX_GEMINI_MESSAGE_LINES=65536;function createEmptySourceCopyOffsets(){return{codeBlockLanguageCounts:new Map,mathBlockCount:0}}__name(createEmptySourceCopyOffsets,"createEmptySourceCopyOffsets");function cloneSourceCopyOffsets(offsets){return{codeBlockLanguageCounts:new Map(offsets.codeBlockLanguageCounts),mathBlockCount:offsets.mathBlockCount}}__name(cloneSourceCopyOffsets,"cloneSourceCopyOffsets");function addSourceBlockCounts(offsets,text){const counts=countMarkdownSourceBlocks(text);for(const[lang,count]of counts.codeBlockLanguageCounts){const current=offsets.codeBlockLanguageCounts.get(lang)??0;offsets.codeBlockLanguageCounts.set(lang,current+count)}offsets.mathBlockCount+=counts.mathBlockCount}__name(addSourceBlockCounts,"addSourceBlockCounts");var PROGRESSIVE_REPLAY_THRESHOLD=100;var PROGRESSIVE_REPLAY_CHUNK_SIZE=50;function initialReplayCount(length){return length<=PROGRESSIVE_REPLAY_THRESHOLD?length:Math.min(PROGRESSIVE_REPLAY_CHUNK_SIZE,length)}__name(initialReplayCount,"initialReplayCount");var VirtualHistoryItem=(0,import_react16.memo)(HistoryItemDisplay);var VP_BANNER_ID=Number.MIN_SAFE_INTEGER;var VP_BANNER_ITEM={type:"vp-banner",id:VP_BANNER_ID};var virtualEstimatedItemHeight=__name(index=>index===0?10:3,"virtualEstimatedItemHeight");var virtualKeyExtractor=__name(item=>item.type==="vp-banner"?"vp-banner":item.id>=0?`h-${item.id}`:`p-${-item.id-1}`,"virtualKeyExtractor");var virtualIsStaticItem=__name(item=>item.type==="vp-banner"||item.id>0,"virtualIsStaticItem");var MainContent=__name(({footerRef,scrollActionsRef})=>{const{version}=useAppContext();const uiState=useUIState();const{allExpanded:fullDetail}=useThoughtExpanded();const streamingState=uiState.streamingState;const showScrollbar=uiState.showScrollbar??true;const{pendingHistoryItems,terminalWidth,mainAreaWidth,staticAreaMaxItemHeight,availableTerminalHeight,historyRemountKey}=uiState;const visibleHistory=(0,import_react16.useMemo)(()=>uiState.history.filter(isHistoryItemVisibleAfterRestore),[uiState.history]);const useVirtualScroll=uiState.useTerminalBuffer;const scrollRef=(0,import_react16.useRef)(null);const selectionQueryRef=(0,import_react16.useRef)(null);const{menu:contextMenuOpen}=useContextMenu();(0,import_react16.useEffect)(()=>{if(!scrollActionsRef)return;scrollActionsRef.current={scrollBy:__name(delta=>scrollRef.current?.scrollBy(delta),"scrollBy"),hasScrollableTranscript:__name(()=>{const state=scrollRef.current?.getScrollState();return!!state&&state.innerHeight>0&&state.scrollHeight>state.innerHeight},"hasScrollableTranscript")};return()=>{scrollActionsRef.current=null}},[scrollActionsRef]);const{historyItemsWithSourceCopyOffsets,pendingStartSourceCopyOffsets}=(0,import_react16.useMemo)(()=>{let runningOffsets=createEmptySourceCopyOffsets();const items=visibleHistory.map(item=>{if(item.type==="gemini"){runningOffsets=createEmptySourceCopyOffsets();const offsets=cloneSourceCopyOffsets(runningOffsets);addSourceBlockCounts(runningOffsets,item.text);return{item,sourceCopyIndexOffsets:offsets}}if(item.type==="gemini_content"){const offsets=cloneSourceCopyOffsets(runningOffsets);addSourceBlockCounts(runningOffsets,item.text);return{item,sourceCopyIndexOffsets:offsets}}if(item.type==="user"&&item.sentToModel!==false){runningOffsets=createEmptySourceCopyOffsets()}return{item,sourceCopyIndexOffsets:void 0}});return{historyItemsWithSourceCopyOffsets:items,pendingStartSourceCopyOffsets:cloneSourceCopyOffsets(runningOffsets)}},[visibleHistory]);const pendingHistoryItemsWithSourceCopyOffsets=(0,import_react16.useMemo)(()=>{let runningOffsets=cloneSourceCopyOffsets(pendingStartSourceCopyOffsets);return pendingHistoryItems.map(item=>{if(item.type==="gemini"){runningOffsets=createEmptySourceCopyOffsets();const offsets=cloneSourceCopyOffsets(runningOffsets);addSourceBlockCounts(runningOffsets,item.text);return{item,sourceCopyIndexOffsets:offsets}}if(item.type==="gemini_content"){const offsets=cloneSourceCopyOffsets(runningOffsets);addSourceBlockCounts(runningOffsets,item.text);return{item,sourceCopyIndexOffsets:offsets}}if(item.type==="user"&&item.sentToModel!==false){runningOffsets=createEmptySourceCopyOffsets()}return{item,sourceCopyIndexOffsets:void 0}})},[pendingHistoryItems,pendingStartSourceCopyOffsets]);const[replayCount,setReplayCount]=(0,import_react16.useState)(()=>initialReplayCount(visibleHistory.length));const visibleHistoryLengthRef=(0,import_react16.useRef)(visibleHistory.length);visibleHistoryLengthRef.current=visibleHistory.length;const[lastRemountKey,setLastRemountKey]=(0,import_react16.useState)(historyRemountKey);if(lastRemountKey!==historyRemountKey){setLastRemountKey(historyRemountKey);if(!useVirtualScroll){setReplayCount(initialReplayCount(visibleHistoryLengthRef.current))}}(0,import_react16.useEffect)(()=>{if(useVirtualScroll)return;if(replayCount>=visibleHistory.length)return;const remaining=visibleHistory.length-replayCount;if(remaining<=PROGRESSIVE_REPLAY_CHUNK_SIZE){setReplayCount(visibleHistory.length);return}const handle=setImmediate(()=>{setReplayCount(c=>Math.min(c+PROGRESSIVE_REPLAY_CHUNK_SIZE,visibleHistoryLengthRef.current))});return()=>clearImmediate(handle)},[useVirtualScroll,replayCount,visibleHistory.length]);const visibleHistoryItemsWithSourceCopyOffsets=historyItemsWithSourceCopyOffsets.length-replayCount<=PROGRESSIVE_REPLAY_CHUNK_SIZE?historyItemsWithSourceCopyOffsets:historyItemsWithSourceCopyOffsets.slice(0,replayCount);const allVirtualItems=(0,import_react16.useMemo)(()=>{const combined=[VP_BANNER_ITEM,...visibleHistory,...pendingHistoryItems.map((item,i)=>({...item,id:-(i+1)}))];const livePendingBatchIds=new Set;for(const item of pendingHistoryItems){if(item.type==="tool_group"&&item.batchId!==void 0){livePendingBatchIds.add(item.batchId)}}if(livePendingBatchIds.size===0)return combined;const dropped=new Set;const committedByBatchId=new Map;const keptPendingByBatchId=new Map;for(const item of combined){if(item.type!=="tool_group"||item.batchId===void 0||!livePendingBatchIds.has(item.batchId)){continue}if(item.id>0){committedByBatchId.set(item.batchId,item)}else{const kept=keptPendingByBatchId.get(item.batchId);if(kept)dropped.add(kept);keptPendingByBatchId.set(item.batchId,item)}}for(const item of committedByBatchId.values())dropped.add(item);if(dropped.size===0)return combined;return combined.filter(item=>!dropped.has(item))},[visibleHistory,pendingHistoryItems]);const sourceCopyOffsetsByHistoryItem=(0,import_react16.useMemo)(()=>{const map=new Map;for(const{item,sourceCopyIndexOffsets}of historyItemsWithSourceCopyOffsets){if(sourceCopyIndexOffsets){map.set(item,sourceCopyIndexOffsets)}}return map},[historyItemsWithSourceCopyOffsets]);const thoughtHeadIdByItem=(0,import_react16.useMemo)(()=>buildThoughtHeadIdMap(visibleHistory),[visibleHistory]);const thoughtHeadIdByItemRef=(0,import_react16.useRef)(thoughtHeadIdByItem);thoughtHeadIdByItemRef.current=thoughtHeadIdByItem;const pendingSourceCopyOffsetsByIndex=(0,import_react16.useMemo)(()=>pendingHistoryItemsWithSourceCopyOffsets.map(({sourceCopyIndexOffsets})=>sourceCopyIndexOffsets),[pendingHistoryItemsWithSourceCopyOffsets]);const pendingStateRef=(0,import_react16.useRef)({activePtyId:uiState.activePtyId,embeddedShellFocused:uiState.embeddedShellFocused,isEditorDialogOpen:uiState.isEditorDialogOpen});pendingStateRef.current={activePtyId:uiState.activePtyId,embeddedShellFocused:uiState.embeddedShellFocused,isEditorDialogOpen:uiState.isEditorDialogOpen};const pendingAvailableTerminalHeight=pendingHistoryItems.length>0&&uiState.constrainHeight?availableTerminalHeight:void 0;const hasPendingPlainTextConfirmation=pendingHistoryItems.some(item=>item.type==="tool_group"&&item.tools.some(tool=>tool.status==="Confirming"&&tool.confirmationDetails?.type==="info"&&tool.confirmationDetails.renderPromptAsPlainText===true));const pendingSourceCopyOffsetsRef=(0,import_react16.useRef)(pendingSourceCopyOffsetsByIndex);pendingSourceCopyOffsetsRef.current=pendingSourceCopyOffsetsByIndex;const renderVirtualItem=(0,import_react16.useCallback)(({item})=>{if(item.type==="vp-banner"){return(0,import_jsx_runtime13.jsxs)(Box_default,{flexDirection:"column",children:[(0,import_jsx_runtime13.jsx)(AppHeader,{version}),(0,import_jsx_runtime13.jsx)(DebugModeNotification,{}),(0,import_jsx_runtime13.jsx)(Notifications,{})]})}const isPending=item.id<0;const sourceCopyIndexOffsets=isPending?pendingSourceCopyOffsetsRef.current[-item.id-1]:sourceCopyOffsetsByHistoryItem.get(item);if(isPending){const ps=pendingStateRef.current;return(0,import_jsx_runtime13.jsx)(VirtualHistoryItem,{terminalWidth,mainAreaWidth,availableTerminalHeight:pendingAvailableTerminalHeight,item:{...item,id:0},isPending:true,isFocused:!ps.isEditorDialogOpen,activeShellPtyId:ps.activePtyId,embeddedShellFocused:ps.embeddedShellFocused,commands:uiState.slashCommands,sourceCopyIndexOffsets,fullDetail})}return(0,import_jsx_runtime13.jsx)(VirtualHistoryItem,{terminalWidth,mainAreaWidth,availableTerminalHeight:uiState.constrainHeight?staticAreaMaxItemHeight:void 0,availableTerminalHeightLlm:uiState.constrainHeight?MAX_GEMINI_MESSAGE_LINES:void 0,item,isPending:false,commands:uiState.slashCommands,sourceCopyIndexOffsets,thoughtHeadId:thoughtHeadIdByItemRef.current.get(item),fullDetail})},[version,terminalWidth,mainAreaWidth,staticAreaMaxItemHeight,uiState.slashCommands,sourceCopyOffsetsByHistoryItem,fullDetail,pendingAvailableTerminalHeight,uiState.constrainHeight]);if(useVirtualScroll){const scrollContainerHeight=Math.max(0,uiState.availableTerminalHeight??0);const viewportInteractive=!uiState.dialogsVisible&&contextMenuOpen===null;return(0,import_jsx_runtime13.jsxs)(OverflowProvider,{children:[(0,import_jsx_runtime13.jsx)(ScrollableListWithForwardRef,{ref:scrollRef,hasFocus:viewportInteractive,data:allVirtualItems,renderItem:renderVirtualItem,estimatedItemHeight:virtualEstimatedItemHeight,keyExtractor:virtualKeyExtractor,initialScrollIndex:allVirtualItems.length<=1?0:SCROLL_TO_ITEM_END,isStaticItem:virtualIsStaticItem,containerHeight:scrollContainerHeight,measureAtFullHeight:hasPendingPlainTextConfirmation,showScrollbar}),(0,import_jsx_runtime13.jsx)(TextSelectionController,{isActive:!uiState.dialogsVisible,eventsPaused:contextMenuOpen!==null,getViewportRect:()=>scrollRef.current?.getViewportRect()??null,getAdditionalSelectableRects:()=>footerRef?.current?[measureElementPosition(footerRef.current)]:[],getScrollState:()=>scrollRef.current?.getScrollState()??{scrollTop:0,scrollHeight:0,innerHeight:0},hitTestScrollbar:location=>scrollRef.current?.hitTestScrollbar(location)??false,selectionQueryRef}),(0,import_jsx_runtime13.jsx)(ContentMouseController,{isActive:!uiState.dialogsVisible,getViewportRect:()=>scrollRef.current?.getViewportRect()??null,hitTestScrollbar:location=>scrollRef.current?.hitTestScrollbar(location)??false,selectionQueryRef}),(0,import_jsx_runtime13.jsx)(ShowMoreLines,{constrainHeight:uiState.constrainHeight})]})}return(0,import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment,{children:[(0,import_jsx_runtime13.jsx)(Static,{items:[(0,import_jsx_runtime13.jsx)(AppHeader,{version},"app-header"),(0,import_jsx_runtime13.jsx)(DebugModeNotification,{},"debug-notification"),(0,import_jsx_runtime13.jsx)(Notifications,{},"notifications"),...visibleHistoryItemsWithSourceCopyOffsets.map(({item:h,sourceCopyIndexOffsets})=>(0,import_jsx_runtime13.jsx)(HistoryItemDisplay,{terminalWidth,mainAreaWidth,availableTerminalHeight:staticAreaMaxItemHeight,availableTerminalHeightLlm:MAX_GEMINI_MESSAGE_LINES,item:h,isPending:false,commands:uiState.slashCommands,sourceCopyIndexOffsets,thoughtHeadId:thoughtHeadIdByItem.get(h),fullDetail},h.id))],children:item=>item},`${historyRemountKey}-${uiState.currentModel}`),(0,import_jsx_runtime13.jsx)(OverflowProvider,{children:(0,import_jsx_runtime13.jsxs)(Box_default,{flexDirection:"column",children:[(0,import_jsx_runtime13.jsx)(Box_default,{flexDirection:"column",flexShrink:0,maxHeight:uiState.constrainHeight||streamingState==="responding"?availableTerminalHeight||void 0:void 0,overflow:"hidden",children:pendingHistoryItemsWithSourceCopyOffsets.map(({item,sourceCopyIndexOffsets},i)=>(0,import_jsx_runtime13.jsx)(HistoryItemDisplay,{availableTerminalHeight:uiState.constrainHeight?availableTerminalHeight:void 0,terminalWidth,mainAreaWidth,item:{...item,id:0},isPending:true,isFocused:!uiState.isEditorDialogOpen,activeShellPtyId:uiState.activePtyId,embeddedShellFocused:uiState.embeddedShellFocused,sourceCopyIndexOffsets,fullDetail},i))}),(0,import_jsx_runtime13.jsx)(ShowMoreLines,{constrainHeight:uiState.constrainHeight})]})})]})},"MainContent");init_esbuild_shims();init_esbuild_shims();var import_jsx_runtime14=__toESM(require_jsx_runtime(),1);function LoopDetectionConfirmation({cause,onComplete}){useKeypress(key=>{if(key.name==="escape"){onComplete({userSelection:"keep"})}},{isActive:true});const quotedCause=cause?.replace(/`([^`]+)`/g,'"$1"');const OPTIONS=[{label:"Keep loop detection enabled (esc)",value:{userSelection:"keep"},key:"Keep loop detection enabled (esc)"},{label:"Disable loop detection for this session",value:{userSelection:"disable"},key:"Disable loop detection for this session"}];return(0,import_jsx_runtime14.jsx)(Box_default,{flexDirection:"column",borderStyle:"round",borderColor:theme.status.warning,width:"100%",marginLeft:1,children:(0,import_jsx_runtime14.jsxs)(Box_default,{paddingX:1,paddingY:0,flexDirection:"column",children:[(0,import_jsx_runtime14.jsxs)(Box_default,{minHeight:1,children:[(0,import_jsx_runtime14.jsx)(Box_default,{minWidth:3,children:(0,import_jsx_runtime14.jsx)(Text,{color:theme.status.warning,"aria-label":"Loop detected:",children:"?"})}),(0,import_jsx_runtime14.jsx)(Box_default,{children:(0,import_jsx_runtime14.jsxs)(Text,{wrap:"truncate-end",children:[(0,import_jsx_runtime14.jsx)(Text,{color:theme.text.primary,bold:true,children:"A potential loop was detected"})," "]})})]}),(0,import_jsx_runtime14.jsx)(Box_default,{width:"100%",marginTop:1,children:(0,import_jsx_runtime14.jsxs)(Box_default,{flexDirection:"column",children:[quotedCause&&(0,import_jsx_runtime14.jsxs)(Text,{color:theme.text.primary,children:["Cause: ",quotedCause,"."]}),(0,import_jsx_runtime14.jsx)(Text,{color:theme.text.secondary,children:"This can happen due to repetitive tool calls or other model behavior. Do you want to keep loop detection enabled or disable it for this session?"}),(0,import_jsx_runtime14.jsx)(Box_default,{marginTop:1,children:(0,import_jsx_runtime14.jsx)(RadioButtonSelect,{items:OPTIONS,onSelect:onComplete})}),(0,import_jsx_runtime14.jsx)(Box_default,{marginTop:1,children:(0,import_jsx_runtime14.jsx)(Text,{color:theme.text.secondary,children:'Note: Setting "model.loopProtection" in your settings.json to "warn" reminds the model instead of stopping, and "off" turns loop protection off, for future sessions. "model.skipLoopDetection" disables only the heuristic loop checks. The tool-call budget is tunable via "model.maxToolCallsPerTurn" (0 disables it). Disabling for this session above suppresses everything.'})})]})})]})})}__name(LoopDetectionConfirmation,"LoopDetectionConfirmation");init_esbuild_shims();var import_jsx_runtime15=__toESM(require_jsx_runtime(),1);var SHELL_CONFIRMATION_FIXED_ROWS=9;var MIN_HEIGHT_WITH_HIDDEN_COMMAND_OPTIONS=8;var ShellConfirmationDialog=__name(({request,availableTerminalHeight,contentWidth=80})=>{const{commands,onConfirm}=request;const constrainedHeight=clampDialogHeight(availableTerminalHeight);const commandPreviewHeight=constrainedHeight===void 0?void 0:constrainedHeight>=SHELL_CONFIRMATION_FIXED_ROWS+2?Math.max(2,constrainedHeight-SHELL_CONFIRMATION_FIXED_ROWS):0;const commandsHidden=constrainedHeight!==void 0&&commandPreviewHeight===0&&commands.length>0;const commandApprovalUnavailable=commandsHidden&&constrainedHeight!==void 0&&constrainedHeight<MIN_HEIGHT_WITH_HIDDEN_COMMAND_OPTIONS;const compactHiddenCommandsLayout=commandsHidden&&constrainedHeight<=SHELL_CONFIRMATION_FIXED_ROWS;useKeypress(key=>{if(key.name==="escape"){onConfirm("cancel")}},{isActive:true});const handleSelect=__name(item=>{if(item==="cancel"){onConfirm(item)}else{onConfirm(item,commands)}},"handleSelect");const options=[{label:t("Yes, allow once"),value:"proceed_once",key:"Yes, allow once"},{label:t("Always allow in this project"),value:"proceed_always_project",key:"Always allow in this project"},{label:t("Always allow for this user"),value:"proceed_always_user",key:"Always allow for this user"},{label:t("No (esc)"),value:"cancel",key:"No (esc)"}];const visibleOptions=commandApprovalUnavailable?options.filter(option=>option.value==="cancel"):options;return(0,import_jsx_runtime15.jsxs)(Box_default,{flexDirection:"column",borderStyle:"round",borderColor:theme.status.warning,paddingX:1,paddingY:constrainedHeight===void 0?1:0,width:"100%",marginLeft:1,height:constrainedHeight,overflow:"hidden",children:[(0,import_jsx_runtime15.jsx)(Text,{bold:true,color:theme.text.primary,wrap:"truncate",children:t("Shell Command Execution")}),!compactHiddenCommandsLayout&&(0,import_jsx_runtime15.jsx)(Text,{color:theme.text.primary,wrap:"truncate",children:t("A custom command wants to run the following shell commands:")}),constrainedHeight===void 0?(0,import_jsx_runtime15.jsx)(Box_default,{flexDirection:"column",marginTop:1,marginBottom:1,flexShrink:1,children:(0,import_jsx_runtime15.jsx)(Box_default,{flexDirection:"column",borderStyle:"round",borderColor:theme.border.default,paddingX:1,children:commands.map(cmd=>(0,import_jsx_runtime15.jsx)(Text,{color:theme.text.link,children:cmd},cmd))})}):commandPreviewHeight!==void 0&&commandPreviewHeight>0?(0,import_jsx_runtime15.jsx)(Box_default,{flexDirection:"column",flexShrink:1,children:(0,import_jsx_runtime15.jsx)(MaxSizedBox,{maxHeight:commandPreviewHeight,maxWidth:Math.max(1,contentWidth-8),overflowDirection:"top",children:commands.map(cmd=>(0,import_jsx_runtime15.jsx)(Box_default,{children:(0,import_jsx_runtime15.jsx)(Text,{color:theme.text.link,children:cmd})},cmd))})}):commandsHidden?(0,import_jsx_runtime15.jsxs)(Text,{color:theme.status.warning,wrap:"truncate",children:[commands.length," ",t("shell commands hidden - resize terminal to review")]}):null,!compactHiddenCommandsLayout&&(0,import_jsx_runtime15.jsx)(Box_default,{marginBottom:constrainedHeight===void 0?1:0,flexShrink:0,children:(0,import_jsx_runtime15.jsx)(Text,{color:theme.text.primary,children:t("Do you want to proceed?")})}),(0,import_jsx_runtime15.jsx)(Box_default,{flexShrink:0,children:(0,import_jsx_runtime15.jsx)(RadioButtonSelect,{items:visibleOptions,onSelect:handleSelect,isFocused:true})})]})},"ShellConfirmationDialog");init_esbuild_shims();var import_react17=__toESM(require_react(),1);var import_jsx_runtime16=__toESM(require_jsx_runtime(),1);var CONSENT_PROMPT_CHROME_ROWS=7;var ConsentPrompt=__name(props=>{const{prompt,onConfirm,terminalWidth,availableTerminalHeight}=props;const constrainedHeight=clampDialogHeight(availableTerminalHeight);const availablePromptRows=constrainedHeight===void 0?void 0:Math.max(1,constrainedHeight-CONSENT_PROMPT_CHROME_ROWS);const showPromptTruncationNotice=typeof prompt==="string"&&availablePromptRows!==void 0&&availablePromptRows<=2;const promptHeight=availablePromptRows===void 0?void 0:Math.max(1,availablePromptRows-(showPromptTruncationNotice?1:0));return(0,import_jsx_runtime16.jsxs)(Box_default,{borderStyle:"round",borderColor:theme.border.default,flexDirection:"column",paddingY:1,paddingX:2,height:constrainedHeight,overflow:"hidden",children:[(0,import_jsx_runtime16.jsx)(Box_default,{flexDirection:"column",flexShrink:1,overflow:"hidden",children:typeof prompt==="string"?(0,import_jsx_runtime16.jsx)(MarkdownDisplay,{isPending:true,text:prompt,contentWidth:terminalWidth,...promptHeight!==void 0?{availableTerminalHeight:promptHeight}:{}}):prompt}),showPromptTruncationNotice&&(0,import_jsx_runtime16.jsx)(Text,{color:theme.text.secondary,wrap:"truncate",children:t("Content truncated - resize terminal to review")}),(0,import_jsx_runtime16.jsx)(Box_default,{marginTop:1,flexShrink:0,children:(0,import_jsx_runtime16.jsx)(RadioButtonSelect,{items:[{label:"Yes",value:true,key:"Yes"},{label:"No",value:false,key:"No"}],onSelect:onConfirm})})]})},"ConsentPrompt");init_esbuild_shims();var import_react18=__toESM(require_react(),1);var import_jsx_runtime17=__toESM(require_jsx_runtime(),1);var ProviderDiffSection=__name(({entry})=>{const{providerLabel,diff}=entry;const hasModelChanges=diff.added.length>0||diff.removed.length>0;return(0,import_jsx_runtime17.jsxs)(Box_default,{flexDirection:"column",children:[(0,import_jsx_runtime17.jsx)(Text,{bold:true,color:theme.text.secondary,children:providerLabel}),hasModelChanges?(0,import_jsx_runtime17.jsxs)(Box_default,{flexDirection:"column",children:[diff.added.map(model=>(0,import_jsx_runtime17.jsxs)(Text,{color:theme.status.success,children:[" + ",model]},model)),diff.removed.map(model=>(0,import_jsx_runtime17.jsxs)(Text,{color:theme.status.error,children:[" - ",model]},model))]}):(0,import_jsx_runtime17.jsxs)(Text,{color:theme.text.secondary,children:[" ",t("Model parameters updated (context window, capabilities, etc.)")]})]})},"ProviderDiffSection");var ProviderUpdatePrompt=__name(({entries,onConfirm})=>{const handleKeypress=(0,import_react18.useCallback)(key=>{if(key.name==="escape"){onConfirm("later")}},[onConfirm]);useKeypress(handleKeypress,{isActive:true});const affectedEntry=entries.find(e=>e.diff.currentModelAffected);const title=entries.length===1?t("Built-in Provider Update \xB7 {{provider}}",{provider:entries[0].providerLabel}):t("Built-in Provider Updates");return(0,import_jsx_runtime17.jsxs)(Box_default,{borderStyle:"round",borderColor:theme.border.default,flexDirection:"column",paddingY:1,paddingX:2,children:[(0,import_jsx_runtime17.jsx)(Text,{bold:true,children:title}),(0,import_jsx_runtime17.jsx)(Box_default,{flexDirection:"column",marginTop:1,gap:1,children:entries.map(entry=>(0,import_jsx_runtime17.jsx)(ProviderDiffSection,{entry},entry.providerLabel))}),(0,import_jsx_runtime17.jsxs)(Box_default,{flexDirection:"column",marginTop:1,children:[affectedEntry&&(0,import_jsx_runtime17.jsx)(Text,{color:theme.status.warning,children:t("Note: Your selected model is being removed. Please choose a new one with /model.")}),(0,import_jsx_runtime17.jsx)(Text,{color:theme.text.secondary,children:t("Tips: Your credentials will not be modified.")})]}),(0,import_jsx_runtime17.jsx)(Box_default,{marginTop:1,children:(0,import_jsx_runtime17.jsx)(RadioButtonSelect,{items:[{label:t("Update all"),value:"update",key:"update"},{label:t("Skip this version"),value:"skip",key:"skip"},{label:t("Remind me later (esc)"),value:"later",key:"later"}],onSelect:onConfirm})})]})},"ProviderUpdatePrompt");init_esbuild_shims();var import_react19=__toESM(require_react(),1);var import_jsx_runtime18=__toESM(require_jsx_runtime(),1);var isPrintableAscii=__name(character=>{const charCode=character.charCodeAt(0);return charCode>=32&&charCode<=126},"isPrintableAscii");var PasswordInput=__name(({value,onChange,onSubmit,placeholder})=>{useKeypress(key=>{if(key.paste){const pastedValue=key.sequence.split("").filter(isPrintableAscii).join("");if(pastedValue){onChange(value+pastedValue)}return}if(key.name==="return"){onSubmit();return}if(key.name==="backspace"||key.name==="delete"){onChange(value.slice(0,-1));return}if(key.ctrl&&key.name==="u"){onChange("");return}if(key.sequence&&!key.ctrl&&!key.meta&&key.sequence.length===1){if(isPrintableAscii(key.sequence)){onChange(value+key.sequence)}}},{isActive:true});const maskedValue="*".repeat(value.length);const displayValue=maskedValue||"";const cursorChar=renderSoftwareCursor(" ");return(0,import_jsx_runtime18.jsxs)(Box_default,{children:[(0,import_jsx_runtime18.jsx)(Text,{color:theme.text.accent,children:"> "}),value.length===0?(0,import_jsx_runtime18.jsxs)(Text,{children:[cursorChar,(0,import_jsx_runtime18.jsx)(Text,{dimColor:true,children:placeholder.slice(1)})]}):(0,import_jsx_runtime18.jsxs)(Text,{children:[displayValue,cursorChar]})]})},"PasswordInput");var SettingInputPrompt=__name(props=>{const{settingName,settingDescription,sensitive,onSubmit,onCancel,terminalWidth}=props;const[value,setValue]=(0,import_react19.useState)("");useKeypress(key=>{if(key.name==="escape"){onCancel()}},{isActive:true});const handleSubmit=__name(()=>{if(value.trim()){onSubmit(value)}},"handleSubmit");return(0,import_jsx_runtime18.jsxs)(Box_default,{borderStyle:"round",borderColor:theme.border.default,flexDirection:"column",paddingY:1,paddingX:2,children:[(0,import_jsx_runtime18.jsx)(Text,{bold:true,color:theme.text.accent,children:settingName}),(0,import_jsx_runtime18.jsx)(Box_default,{marginTop:1,children:(0,import_jsx_runtime18.jsx)(Text,{children:settingDescription})}),(0,import_jsx_runtime18.jsx)(Box_default,{marginTop:1,flexDirection:"column",children:sensitive?(0,import_jsx_runtime18.jsx)(PasswordInput,{value,onChange:setValue,onSubmit:handleSubmit,placeholder:t("Enter sensitive value...")}):(0,import_jsx_runtime18.jsx)(TextInput,{value,onChange:setValue,onSubmit:handleSubmit,placeholder:t("Enter value..."),inputWidth:Math.min(terminalWidth-10,60),isActive:true})}),(0,import_jsx_runtime18.jsx)(Box_default,{marginTop:1,children:(0,import_jsx_runtime18.jsx)(Text,{dimColor:true,children:t("Press Enter to submit, Escape to cancel")})})]})},"SettingInputPrompt");init_esbuild_shims();var import_react20=__toESM(require_react(),1);var import_jsx_runtime19=__toESM(require_jsx_runtime(),1);var MAX_VISIBLE_ITEMS=8;var PluginChoicePrompt=__name(props=>{const{marketplaceName,plugins,onSelect,onCancel}=props;const[selectedIndex,setSelectedIndex]=(0,import_react20.useState)(0);const prefixWidth=2;const handleKeypress=(0,import_react20.useCallback)(key=>{const{name,sequence}=key;if(name==="escape"){onCancel();return}if(name==="return"){const plugin=plugins[selectedIndex];if(plugin){onSelect(plugin.name)}return}if(keyMatchers["selectionUp"](key)){setSelectedIndex(prev=>prev>0?prev-1:plugins.length-1);return}if(keyMatchers["selectionDown"](key)){setSelectedIndex(prev=>prev<plugins.length-1?prev+1:0);return}const num=parseInt(sequence||"",10);if(!isNaN(num)&&num>=1&&num<=plugins.length&&num<=9){setSelectedIndex(num-1);const plugin=plugins[num-1];if(plugin){onSelect(plugin.name)}}},[plugins,selectedIndex,onSelect,onCancel]);useKeypress(handleKeypress,{isActive:true});const{visiblePlugins,startIndex,hasMore,hasLess}=(0,import_react20.useMemo)(()=>{const total=plugins.length;if(total<=MAX_VISIBLE_ITEMS){return{visiblePlugins:plugins,startIndex:0,hasMore:false,hasLess:false}}let start=0;const halfWindow=Math.floor(MAX_VISIBLE_ITEMS/2);if(selectedIndex<=halfWindow){start=0}else if(selectedIndex>=total-halfWindow){start=total-MAX_VISIBLE_ITEMS}else{start=selectedIndex-halfWindow}const end=Math.min(start+MAX_VISIBLE_ITEMS,total);return{visiblePlugins:plugins.slice(start,end),startIndex:start,hasLess:start>0,hasMore:end<total}},[plugins,selectedIndex]);return(0,import_jsx_runtime19.jsxs)(Box_default,{borderStyle:"round",borderColor:theme.border.default,flexDirection:"column",paddingY:1,paddingX:2,width:"100%",children:[(0,import_jsx_runtime19.jsx)(Text,{bold:true,color:theme.text.accent,children:t('Select a plugin from "{{name}}"',{name:marketplaceName})}),(0,import_jsx_runtime19.jsxs)(Box_default,{marginTop:1,flexDirection:"column",children:[hasLess&&(0,import_jsx_runtime19.jsx)(Box_default,{children:(0,import_jsx_runtime19.jsxs)(Text,{dimColor:true,children:[" ","\u2191 ",t("{{count}} more above",{count:String(startIndex)})]})}),visiblePlugins.map((plugin,visibleIndex)=>{const actualIndex=startIndex+visibleIndex;const isSelected=actualIndex===selectedIndex;const prefix=isSelected?"\u276F ":" ";return(0,import_jsx_runtime19.jsxs)(Box_default,{flexDirection:"column",children:[(0,import_jsx_runtime19.jsxs)(Box_default,{flexDirection:"row",children:[(0,import_jsx_runtime19.jsx)(Text,{color:isSelected?theme.text.accent:void 0,children:prefix}),(0,import_jsx_runtime19.jsx)(Text,{bold:isSelected,color:isSelected?theme.text.accent:void 0,children:plugin.name})]}),isSelected&&plugin.description&&(0,import_jsx_runtime19.jsx)(Box_default,{marginLeft:prefixWidth,children:(0,import_jsx_runtime19.jsx)(Text,{color:theme.text.accent,children:plugin.description})})]},plugin.name)}),hasMore&&(0,import_jsx_runtime19.jsx)(Box_default,{children:(0,import_jsx_runtime19.jsxs)(Text,{dimColor:true,children:[" ","\u2193"," ",t("{{count}} more below",{count:String(plugins.length-startIndex-MAX_VISIBLE_ITEMS)})]})})]}),(0,import_jsx_runtime19.jsxs)(Box_default,{marginTop:1,flexDirection:"row",gap:2,children:[(0,import_jsx_runtime19.jsx)(Text,{dimColor:true,children:t("Use \u2191\u2193 or j/k to navigate, Enter to select, Escape to cancel")}),plugins.length>MAX_VISIBLE_ITEMS&&(0,import_jsx_runtime19.jsxs)(Text,{dimColor:true,children:["(",selectedIndex+1,"/",plugins.length,")"]})]})]})},"PluginChoicePrompt");init_esbuild_shims();var import_react21=__toESM(require_react(),1);init_esbuild_shims();var import_jsx_runtime20=__toESM(require_jsx_runtime(),1);function ScopeSelector({onSelect,onHighlight,isFocused,initialScope}){const scopeItems3=getScopeItems().map(item=>({...item,label:t(item.label),key:item.value}));const initialIndex=scopeItems3.findIndex(item=>item.value===initialScope);const safeInitialIndex=initialIndex>=0?initialIndex:0;return(0,import_jsx_runtime20.jsxs)(Box_default,{flexDirection:"column",children:[(0,import_jsx_runtime20.jsxs)(Text,{bold:isFocused,wrap:"truncate",children:[isFocused?"> ":" ",t("Apply To")]}),(0,import_jsx_runtime20.jsx)(Box_default,{height:1}),(0,import_jsx_runtime20.jsx)(RadioButtonSelect,{items:scopeItems3,initialIndex:safeInitialIndex,onSelect,onHighlight,isFocused,showNumbers:isFocused})]})}__name(ScopeSelector,"ScopeSelector");var import_jsx_runtime21=__toESM(require_jsx_runtime(),1);function ThemeDialog({onSelect,onHighlight,settings,availableTerminalHeight,terminalWidth}){const[selectedScope,setSelectedScope]=(0,import_react21.useState)("User");const[highlightedThemeName,setHighlightedThemeName]=(0,import_react21.useState)(settings.merged.ui?.theme||AUTO_THEME_NAME);const customThemes=selectedScope==="User"?settings.user.settings.ui?.customThemes||{}:settings.merged.ui?.customThemes||{};const builtInThemes=themeManager.getAvailableThemes().filter(theme2=>theme2.type!=="custom");const customThemeNames=Object.keys(customThemes);const capitalize=__name(s=>s.charAt(0).toUpperCase()+s.slice(1),"capitalize");const themeItems=[{label:t("Auto (detect terminal theme)"),value:AUTO_THEME_NAME,themeNameDisplay:t("Auto"),themeTypeDisplay:t("Auto"),key:AUTO_THEME_NAME},...builtInThemes.map(theme2=>({label:theme2.name,value:theme2.name,themeNameDisplay:theme2.name,themeTypeDisplay:capitalize(theme2.type),key:theme2.name})),...customThemeNames.map(name=>({label:name,value:name,themeNameDisplay:name,themeTypeDisplay:t("Custom"),key:name}))];const initialThemeIndex=themeItems.findIndex(item=>item.value===highlightedThemeName);const safeInitialThemeIndex=initialThemeIndex>=0?initialThemeIndex:0;const handleThemeSelect=(0,import_react21.useCallback)(themeName=>{onSelect(themeName,selectedScope)},[onSelect,selectedScope]);const handleThemeHighlight=__name(themeName=>{setHighlightedThemeName(themeName);onHighlight(themeName)},"handleThemeHighlight");const handleScopeHighlight=(0,import_react21.useCallback)(scope=>{setSelectedScope(scope)},[]);const handleScopeSelect=(0,import_react21.useCallback)(scope=>{onSelect(highlightedThemeName,scope)},[onSelect,highlightedThemeName]);const[mode,setMode]=(0,import_react21.useState)("theme");useKeypress(key=>{if(key.name==="tab"){setMode(prev=>prev==="theme"?"scope":"theme")}if(key.name==="escape"){onSelect(void 0,selectedScope)}},{isActive:true});const otherScopeModifiedMessage=getScopeMessageForSetting("ui.theme",selectedScope,settings);const PREVIEW_PANE_WIDTH_PERCENTAGE=.55;const PREVIEW_PANE_WIDTH_SAFETY_MARGIN=.9;const TOTAL_HORIZONTAL_PADDING=4;const colorizeCodeWidth=Math.max(Math.floor((terminalWidth-TOTAL_HORIZONTAL_PADDING)*PREVIEW_PANE_WIDTH_PERCENTAGE*PREVIEW_PANE_WIDTH_SAFETY_MARGIN),1);const DIALOG_PADDING=2;const selectThemeHeight=themeItems.length+1;const TAB_TO_SELECT_HEIGHT=2;availableTerminalHeight=availableTerminalHeight??Number.MAX_SAFE_INTEGER;availableTerminalHeight-=2;availableTerminalHeight-=TAB_TO_SELECT_HEIGHT;let totalLeftHandSideHeight=DIALOG_PADDING+selectThemeHeight;let includePadding=true;if(totalLeftHandSideHeight>availableTerminalHeight){includePadding=false;totalLeftHandSideHeight-=DIALOG_PADDING}const PREVIEW_PANE_FIXED_VERTICAL_SPACE=8;availableTerminalHeight=Math.max(availableTerminalHeight,totalLeftHandSideHeight);const availableTerminalHeightCodeBlock=availableTerminalHeight-PREVIEW_PANE_FIXED_VERTICAL_SPACE-(includePadding?2:0)*2;const availableHeightForPanes=Math.max(0,availableTerminalHeightCodeBlock-1);const codeBlockHeight=Math.ceil(availableHeightForPanes*.6);const diffHeight=Math.floor(availableHeightForPanes*.4);return(0,import_jsx_runtime21.jsxs)(Box_default,{borderStyle:"round",borderColor:theme.border.default,flexDirection:"column",paddingTop:includePadding?1:0,paddingBottom:includePadding?1:0,paddingLeft:1,paddingRight:1,width:"100%",children:[mode==="theme"?(0,import_jsx_runtime21.jsxs)(Box_default,{flexDirection:"row",children:[(0,import_jsx_runtime21.jsxs)(Box_default,{flexDirection:"column",width:"45%",paddingRight:2,children:[(0,import_jsx_runtime21.jsxs)(Text,{bold:mode==="theme",wrap:"truncate",children:[mode==="theme"?"> ":" ",t("Select Theme")," ",(0,import_jsx_runtime21.jsx)(Text,{color:theme.text.secondary,children:otherScopeModifiedMessage})]}),(0,import_jsx_runtime21.jsx)(RadioButtonSelect,{items:themeItems,initialIndex:safeInitialThemeIndex,onSelect:handleThemeSelect,onHighlight:handleThemeHighlight,isFocused:mode==="theme",maxItemsToShow:12,showScrollArrows:true,showNumbers:mode==="theme"})]}),(0,import_jsx_runtime21.jsxs)(Box_default,{flexDirection:"column",width:"55%",paddingLeft:2,children:[(0,import_jsx_runtime21.jsx)(Text,{bold:true,color:theme.text.primary,children:t("Preview")}),(()=>{const previewTheme=highlightedThemeName===AUTO_THEME_NAME?themeManager.getActiveTheme():themeManager.getTheme(highlightedThemeName||DEFAULT_THEME.name)||DEFAULT_THEME;return(0,import_jsx_runtime21.jsxs)(Box_default,{borderStyle:"single",borderColor:theme.border.default,paddingTop:includePadding?1:0,paddingBottom:includePadding?1:0,paddingLeft:1,paddingRight:1,flexDirection:"column",children:[colorizeCode(`# function
3
+ import{DescriptiveRadioButtonSelect,DualOutputBridge,EDITOR_DISPLAY_NAMES,EffortDialog,MAIN_CONTENT_HEIGHT_RESERVATION,MAX_STATUS_LINES,ProviderSetupSteps,RANGE_CYCLE,RemoteInputWatcher,STATIC_EXTRA_HEIGHT,STATUS_LINE_DIALOG_FIXED_ROWS,STATUS_LINE_OPTIONS,SuggestionsDisplay,TAB_DEFS,TableRow,VISIBLE_RESOURCES_COUNT,VISIBLE_TOOLS_COUNT,VimModeProvider,buildConfigFromKeys,buildInitialSelectedKeys,buildThoughtHeadIdMap,calculatePromptWidths,clampDialogHeight,classifyPastedImagePaths,computeWindowTitle,editorSettingsManager,expandPendingPastePlaceholders,extensionComponentsSummary,findLastUserItemIndex,fmtDurationShort,fmtSuccessBar,fmtTokens,formatServerCommand,formatSessionWindowTitle,formatSourceLabels,framePasteExpansion,getCacheColor,getConfigSourceDisplay,getDialogMaxHeight,getEffectiveStatusLineScope,getHeatmapColors,getPreviewData,getRangeLabel,getScopeItems,getScopeMessageForSetting,getSeriesColors,getStatusColor as getStatusColor2,getStatusIcon,getSuccessColor,getToolInvalidReasons,groupServersBySource,isNarrowWidth,isRealUserTurn,isRewindableUserTurn,isSyntheticHistoryItem,isToolValid,itemsAfterAreOnlySynthetic,mapToDisplay,observeInteractiveModTool,pickAsciiArtTier,primeGitBranchName,realUserPromptTexts,resolveCustomBanner,restorePasteDraft,rewindSession,shortAsciiLogo,stripLeadingSystemReminders,titleStatusPrefix,unframeClipboardPastes,useAnimationFrame,useAtCompletion,useAuthCommand,useAwaySummary,useCompletion,useDeleteCommand,useDoublePress,useFollowupSuggestionsCLI,useGitBranchName,useLogger,useMcpApproval,usePhraseCycler,usePromptVoiceInput,useProviderSetupFlow,useReactToolScheduler,useReverseSearchCompletion,useShellCommandProcessor,useShellHistory,useStatusLineState,useTimer,useVim,useVimModeActions,useVimModeState,useWorktreeSession,writeTerminalTitle}from"./chunk-EU2MKUK4.js";import{startPostRenderPrefetches}from"./chunk-DL7TKH2E.js";import{buildPermissionSuggestions}from"./chunk-2Z36XVH7.js";import{TUI_CHAT_RECORDING_FAILURE_MESSAGE,describeLoopStop,formatInteractiveLoopDetectedMessage}from"./chunk-U3Q6WES3.js";import"./chunk-GDXLJJSW.js";import{AboutBox,BtwMessage,CommandFormatMigrationNudge,FolderTrustDialog,Help,HistoryItemDisplay,IdeIntegrationNudge,SessionPicker,ThoughtExpandedProvider,ToolDetailsExpandedProvider,UIActionsContext,UIStateContext,dist_default as dist_default2,extensionUpdatesReducer,getScreenBuffer,hyperlinkAtCell,initialExtensionUpdatesState,useArenaCommand,useHistory,useIdeTrustListener,useProviderUpdates,useThoughtExpanded,useUIActions,useUIState}from"./chunk-XQ2NYKJH.js";import{Colors,ConfigContext,DiffRenderer,ErrorBoundary,MCPServerApprovalDialog,MarkdownDisplay,RadioButtonSelect,RenderModeProvider,RespondingSpinner,SCREEN_READER_USER_PREFIX,SessionStatsProvider,SettingsContext,Spinner,StreamingContext,TOOL_DISPLAY_BY_NAME,TOOL_SUCCESS_RATE_HIGH,TOOL_SUCCESS_RATE_MEDIUM,TerminalOutputProvider,TextInput,ToolConfirmationMessage,USER_AGREEMENT_RATE_HIGH,USER_AGREEMENT_RATE_MEDIUM,VirtualViewportContext,buildStatusLinePresetLines,build_default,checkExhaustive,colorizeCode,consumeLastRenderError,countMarkdownSourceBlocks,dist_default,findLastSafeSplitPoint,fitPendingSlice,formatTokenCount as formatTokenCount2,frameAnchor,getArenaStatusLabel,getEnclosingFenceInfo,getRenderableGradientColors,getStatusColor,isDeletionKey,isPrintableSearchChar,keyMatchers,layoutRowForEvent,loadLowlight,logicalPosToOffset,measureElementPosition,removeLastGrapheme,renderSoftwareCursor,splitFencedMarkdown,truncateText,useConfig,useLaunchEditor,useMouseEvents,useMouseTrackingEnabled,usePreferredEditor,useSelectionList,useSessionStats,useSettings,useStreamingContext,useTerminalSize,useTextBuffer,useVirtualViewport}from"./chunk-HOKROBQZ.js";import{ICON,WAITING_SPINNER_FRAME,applyCollapsePolicyAndSummary,buildResumedHistoryItems,computeResumedPromptCountSeed,shouldDisplayGoalStateCause,waitForGoalRuntime}from"./chunk-J3R7ZNSA.js";import{stopAndGetCapturedInput}from"./chunk-ZUQDG3KO.js";import{useAutoAcceptIndicator}from"./chunk-LR2HEHYW.js";import{ContextMenuProvider,KeypressProvider,clampMenuPosition,contextMenuSize,useContextMenu,useFocus,useKeypress,useKeypressContext}from"./chunk-ZKNRRYWK.js";import{MAX_ACCEPTED_BACKLOG,PeerMessaging,classifyApiError}from"./chunk-NE627MUW.js";import"./chunk-F64AWDLW.js";import{normalizePartList}from"./chunk-HIO3M52C.js";import{MAX_SUGGESTION_LABEL_WIDTH,buildMcpResourceRef,handleAtCommand,resolveAtCommandQuery}from"./chunk-4RM7KY3Z.js";import{BuiltinCommandLoader,BundledSkillLoader,CONTEXT_FILES_ANNOUNCEMENT_PREFIX,CommandService,DISPLAY_HOOK_EVENTS,FileCommandLoader,MAX_STACKED_SKILLS,McpPromptLoader,SLASH_COMMANDS_SKIP_RECORDING,SavedWorkflowLoader,SkillCommandLoader,addConfigToMatcherGroup,appendUserPromptExpansionAdditionalContext,applyOutputStyleSelection,buildBackgroundWorkBlockedMessage,completeRestoreToolResponse,consumesContextAnnouncementLatch,copyToClipboard,createEmptyHookEventInfo,dayKey,findMidInputSlashCommand,findSlashCommandTokens,formatApprovalModeDescription,formatApprovalModeName,formatEffortChangeMessage,formatUserPromptExpansionBlockedMessage,getAllConfigs,getBestSlashCommandMatch,getTranslatedSourceDisplayMap,hasBlockingBackgroundWork,hasSlashCommandPathSeparator,isAtCommand,isBtwCommand,isContextFilesAnnouncement,isCrossSessionMessagingActive,isCrossSessionMessagingOptedIn,isMidInputCompletableCommand,isPickerOnlyModelInvocation,isSlashCommand,isStackedSkillCompletableCommand,isValidStackedSkillPrefix,loadSessionOutputStyles,parseDayKey,parseSlashCommand,parseStackedSlashCommands,quitCommand,recordAutoSkillCommandUsage,refreshExtensionContentRuntime,resetBackgroundStateForSessionSwitch,resolveOutputStyleChoice,rewindCommand,serializeUserPromptExpansionPrompt,supportsMatchers}from"./chunk-4NNNGSQY.js";import{EXTENSION_RELOAD_FAILED_REASON,ExtensionRefreshState}from"./chunk-2CVFRSGX.js";import{MAX_EXTENSION_OWNER_LABEL_WIDTH,computeSessionStats,contextUsageLabel,formatDuration,formatPercentageUsed,formatRelativeTime,formatTokenCount,getCommandDisplayName,getCommandSourceBadge,skillOriginLabel}from"./chunk-GZYIXB7Y.js";import{disableKittyProtocol,isKittyProtocolEnabled,isKittyProtocolSupported,pushKittyProtocolFlags}from"./chunk-HKA2IEQ6.js";import{BEL,OSC_PREFIX,cleanupOldClipboardImages,clipboardHasImage,detectTerminal,generateKittyId,oscGhosttyNotify,oscITerm2Notify,oscKittyNotify,readClipboardText,saveClipboardImage}from"./chunk-DI36DSAF.js";import{getInteractiveModSession,isModRecoveryCommand}from"./chunk-JCRS367I.js";import{sanitizeDisplayText}from"./chunk-ZW6456SD.js";import"./chunk-EVBKKQ7Y.js";import"./chunk-UGLQO5K7.js";import{MaxSizedBox,OverflowProvider,theme,useOverflowState}from"./chunk-E2NIVXLK.js";import{require_jsx_runtime}from"./chunk-REPFZQ7R.js";import{Box_default,Static,Text,base_exports,measure_element_default,render_default,use_box_metrics_default,use_cursor_default,use_is_screen_reader_enabled_default,use_stdin_default,use_stdout_default}from"./chunk-YIJNS5IJ.js";import{require_react}from"./chunk-5QKDV4CD.js";import{setUpdateHandler}from"./chunk-YWVV5STA.js";import{isHistoryItemVisibleAfterRestore}from"./chunk-4TZUKLPC.js";import"./chunk-427MARCP.js";import{AUTO_THEME_NAME,DEFAULT_THEME,themeManager}from"./chunk-W3YCOEIP.js";import{cleanupReviewWorktreeLeases}from"./chunk-VUEZWMI4.js";import"./chunk-TD6VSPYX.js";import"./chunk-INFBJDWM.js";import"./chunk-TZV5T7CF.js";import{MAX_INLINE_IMAGES_PER_ITEM,getInlineImageData}from"./chunk-VRNYIKVL.js";import"./chunk-MNVMHVQJ.js";import"./chunk-OPJXNOWV.js";import"./chunk-DOWKH5OZ.js";import"./chunk-LWJBPGIT.js";import"./chunk-WQUA4G2X.js";import"./chunk-QXYN3PTW.js";import{allowsFastOnlyAdvisorModel,appEvents,checkAdvisorModelAvailability,isAdvisorModelEligible,loadHierarchicalMemory}from"./chunk-5X7S4AE6.js";import"./chunk-VURTGFJP.js";import{cpLen,cpSlice,escapeAnsiCtrlCodes,getAsciiArtWidth,getCachedStringWidth,sanitizeFilenameForDisplay,sanitizeMultilineForDisplay,sanitizeTerminalLine,sanitizeTerminalText,stringWidth,stripUnsafeCharacters,toCodePoints,truncateToWidth}from"./chunk-64CA3W6G.js";import"./chunk-S34YI2NO.js";import"./chunk-R4VUFIDQ.js";import"./chunk-UZI3IA27.js";import"./chunk-XIFNBULA.js";import"./chunk-S53G54DW.js";import"./chunk-Z57KDB5F.js";import"./chunk-OX4QMNUW.js";import"./chunk-ZSKCF6DI.js";import"./chunk-GGM3I5AO.js";import"./chunk-6BSQDDUG.js";import"./chunk-R7TNFTT4.js";import"./chunk-F52ARBN5.js";import{formatUnsupportedVoiceModelMessage,isSelectableVoiceModel}from"./chunk-5PR7OLG6.js";import"./chunk-G2SXDY2E.js";import"./chunk-DXRXF4QD.js";import"./chunk-XKSB7VTV.js";import"./chunk-3SHHYK7S.js";import"./chunk-DHYCGKLG.js";import{buildHigherDisabled,computeWorkspaceSkillListUpdates,skillSettingStrings}from"./chunk-AVCBF5WL.js";import{isValidSessionId}from"./chunk-LGFF5PJA.js";import"./chunk-O222HKZN.js";import"./chunk-YZUKMJW7.js";import"./chunk-3TK35SQL.js";import"./chunk-2HLVSWM6.js";import"./chunk-VDUNIK4I.js";import{getRawModelProviders}from"./chunk-BNZSPX2I.js";import{formatExecutionSandbox,getExtendedSystemInfo}from"./chunk-P3M4WWRA.js";import"./chunk-23KDY7UW.js";import"./chunk-BWQ5AIEA.js";import"./chunk-WDR5XP3Y.js";import"./chunk-2QYDBHYZ.js";import{getReasoningEffortsForConfig}from"./chunk-BKUFRNME.js";import{formatSettingRowValue}from"./chunk-L42NTHIT.js";import"./chunk-LUDNUVSA.js";import"./chunk-CCTQPUAG.js";import"./chunk-WBDNGVHU.js";import"./chunk-L5UULTGF.js";import"./chunk-AVJJ62OC.js";import"./chunk-SPYNWVDZ.js";import"./chunk-XSG7HKSN.js";import"./chunk-KOJ7WZ63.js";import"./chunk-O6ZQAVRG.js";import"./chunk-3KZHPZVZ.js";import"./chunk-NIEO2TBE.js";import"./chunk-CFTFKWPW.js";import"./chunk-E4UMXDOZ.js";import"./chunk-BZAH4DTS.js";import"./chunk-F3ZRU2SA.js";import"./chunk-FJUXMWZW.js";import"./chunk-MHZY2JYX.js";import"./chunk-JBJA2Y7T.js";import"./chunk-W7V6J2VV.js";import"./chunk-4BFQ7QQC.js";import"./chunk-3JI7IKJL.js";import{requestConsentInteractive,requestConsentOrFail}from"./chunk-NZNRCPGE.js";import"./chunk-D2NY7HVY.js";import{exitCleanly,relaunchApp}from"./chunk-WA2LKUVP.js";import"./chunk-QO46QMCC.js";import"./chunk-BP62QEKY.js";import"./chunk-IHXJOVAH.js";import"./chunk-XZZBAJQS.js";import"./chunk-3SWMGBN3.js";import"./chunk-AZ3CKMCT.js";import"./chunk-TDDRZUJO.js";import"./chunk-44WSAMWG.js";import"./chunk-WSOEJTOC.js";import{loadMcpApprovals}from"./chunk-JUQ7T2MV.js";import"./chunk-Y3VRWG52.js";import{CORRUPTED_SUFFIX,getDefaultValue,getDialogSettingKeys,getDisplayValue,getEffectiveValue,getNestedValue,getPersistScopeForModelSelection,getRestartRequiredFromModified,getSettingDefinition,isAutoLanguage,isDefaultValue,loadSettings,nextBooleanSettingValue,requiresRestart,saveModifiedSettings,setPendingSettingValue,setPendingSettingValueAny,validateSettingValue,writeOutputLanguageAndRegisterPath}from"./chunk-MVGQFFIK.js";import{TOGGLE_TYPES,isNumericSettingType}from"./chunk-UPPE4I6H.js";import"./chunk-UWCF7JIF.js";import"./chunk-LMUSSYJH.js";import{getCurrentLanguage,localizeToolDisplayName,t}from"./chunk-EZMTX4EU.js";import"./chunk-MWABT6CH.js";import"./chunk-TW5QEP2J.js";import"./chunk-PKK2D2W4.js";import"./chunk-HZ4Y7DH5.js";import"./chunk-E5T4R2PM.js";import"./chunk-VOBNHBCJ.js";import{isInlineModelOverrideAllowed,publicProviderBaseUrl}from"./chunk-GT4TCQ3R.js";import{getErrorMessage as getErrorMessage2}from"./chunk-LPOEVTKD.js";import{isWorkspaceTrusted,loadTrustedFolders}from"./chunk-XIYLRIW4.js";import"./chunk-EIPLDYEY.js";import"./chunk-IDXJIDME.js";import{AsyncFzf,AutonomousLoopTickResolver,DroppedNotificationTally,IDLE_SPECULATION,MAX_BACKGROUND_NOTIFICATION_QUEUE,abortSpeculation,acceptSpeculation,buildSessionRecoveryPlan,clearWelcomeBackState,decideNotificationAdmission,describePeerInboxFailure,detectAutonomousSentinel,generatePromptSuggestion,generateToolUseSummary,getLastPeerInboxFailure,getProjectSummaryInfo,getWelcomeBackState,isWsl,renderGoalContinuationTurn,saveWelcomeBackRestartChoice,startSpeculation,subagentGenerator}from"./chunk-A5TAAMML.js";import"./chunk-QS2ZMQIS.js";import"./chunk-S7IKHQ6I.js";import"./chunk-SEQAVABL.js";import"./chunk-IEWZIDC6.js";import{formatVersionLabel,getCliVersion}from"./chunk-7FSC2NKA.js";import"./chunk-O4EDHV64.js";import{require_strip_json_comments}from"./chunk-DOLUT3XC.js";import"./chunk-PTHIQ7ZN.js";import"./chunk-PAD5GPDY.js";import"./chunk-MD3ZEOBX.js";import"./chunk-X5QSFJVS.js";import{WorktreeRestoreRefusedError,clearWorktreeSession,isSessionRuntimeActive,restoreWorktreeContext}from"./chunk-2Q7T5CR2.js";import"./chunk-46VUDNCL.js";import{PEER_ADMISSION_LIMITS,describeDeliveryStatus,describeDropReason,describeHoldCause,parseHeldExpiry}from"./chunk-MKH3EH7O.js";import"./chunk-JFVXZFMV.js";import"./chunk-BNYJY4OL.js";import"./chunk-JKV4ODXE.js";import"./chunk-YBISME5B.js";import"./chunk-ZHHFNZ5J.js";import"./chunk-M3C6RDGC.js";import"./chunk-AKWYMQKU.js";import"./chunk-MZUOREFD.js";import"./chunk-IGPAATQW.js";import"./chunk-XZACON5H.js";import"./chunk-7EBRMQYW.js";import"./chunk-ZZJXFLVM.js";import"./chunk-RKDS7A4H.js";import"./chunk-V6VMUJ47.js";import"./chunk-IV3HAIUN.js";import"./chunk-UYYQB2TU.js";import"./chunk-VET7MLTV.js";import"./chunk-HN5UYLPU.js";import"./chunk-DECUAM3U.js";import"./chunk-PGRN3GZY.js";import"./chunk-YFTVFH2A.js";import"./chunk-ZBHL2CXR.js";import"./chunk-NIOS3B3V.js";import{ConditionalRulesRegistry,DEFAULT_BUILTIN_SUBAGENT_TYPE,DISPLAY_MODE,IdeClient,MAX_RECENT_ACTIVITIES,MCPOAuthProvider,MCPOAuthTokenStorage,SessionService,aggregateUsage,allowEditorTypeInSandbox,buildBackgroundEntryLabel,buildWorkflowSizeGuidelineChangeNotice,checkForExtensionUpdate,checkHasEditorType,computeThresholds,computeUniqueBranchTitle,convertTomlToMarkdown,createDuplicateProviderToolCallResponse,createInstructionsLoadedCallback,didWriteProjectContextFile,finalizeToolResponses,findRepeatedDuplicateProviderToolCall,fireNotificationHook,getCachedToolCallFingerprint,getExtensionDisplayName,getTimeRangeBounds,goalToolResultProvenance,ideContextStore,isActiveWorkflowStatus,isEditorAvailable,isExtensionCommittedWithWarningsError,isGatedMcpScope,isReplayOfHandledToolCall,isSettledStatus,isSuccessStatus,isTerminalStatus,isTerminalWorkflowStatus,loadUsageHistory,markDuplicateProviderToolCallResponseSent,matchesAnyServerPattern,mcpServerRequiresOAuth,metricsToUsageRecord,normalizeDerivedBranchTitle,parseAndFormatApiError,parseCron,parseInstallSource,parseVisionModelSetting,recordHandledToolCall,refreshMemoryAfterManagedWrite,refreshMemoryInstruction,resolveWorkflowIntent,resolveWorkflowSizeGuidelineSetting,saveWorkflowScript,validateWorkflowName}from"./chunk-LZNBHBAJ.js";import"./chunk-R2EHHA2C.js";import"./chunk-ZLZF2ZDD.js";import"./chunk-YK7NDQKM.js";import"./chunk-TLROJH6O.js";import"./chunk-PHIPLV2I.js";import"./chunk-2EUNU5M5.js";import"./chunk-7DCW657A.js";import"./chunk-FIXDX63I.js";import"./chunk-T7CHK6C2.js";import"./chunk-PT7NZBDY.js";import"./chunk-TWP72VRH.js";import"./chunk-UYEWRLGD.js";import"./chunk-2MB4ZSKF.js";import"./chunk-WK2IBT6D.js";import{GitWorktreeService,fetchGitDiff,fetchGitDiffHunks,readWorktreeSessionMarker,writeRuntimeStatus}from"./chunk-ILECDNJX.js";import"./chunk-QXQGUM3Y.js";import"./chunk-TRA6EVDT.js";import"./chunk-DBA3F3D7.js";import"./chunk-QVPT37XZ.js";import{readCronTasks,taskHasLegacyCondition}from"./chunk-T6W33SET.js";import"./chunk-4WFGJVTF.js";import{flattenPeerLabel,registerSession}from"./chunk-BYU42MLK.js";import"./chunk-JWQXU3SR.js";import"./chunk-5LZ2DPLH.js";import"./chunk-XQJOZDV7.js";import"./chunk-CV2UAEZA.js";import"./chunk-LO76B6GW.js";import{GOAL_PAUSE_REASON_USER_INTERRUPT,elapsedActiveTime,goalPauseReasonForFailure,goalRequiresExactPermit}from"./chunk-CMLAE3UB.js";import"./chunk-KLC3OD2M.js";import"./chunk-QZV4PFQK.js";import"./chunk-VXRLLVOP.js";import"./chunk-G5PYYZMM.js";import"./chunk-BG67XABA.js";import{buildModelIdContext,resolveModelId}from"./chunk-BEKROCWN.js";import{glob}from"./chunk-OBOU4ZZM.js";import"./chunk-D7XCQWP2.js";import"./chunk-AE5OMKRY.js";import"./chunk-QF44NNSC.js";import"./chunk-QX4PIAJI.js";import"./chunk-7DQ2T3TA.js";import{parseRule}from"./chunk-TDHEAGDX.js";import{APPROVAL_MODES}from"./chunk-JZK2WGXA.js";import"./chunk-MPHSE7M4.js";import"./chunk-S2ZKZXHX.js";import"./chunk-4GP3PH7Z.js";import"./chunk-4QQKOW5M.js";import{BUILT_IN_OUTPUT_STYLES}from"./chunk-OV3EBH6J.js";import{NO_EXEC_CONFIG,getGitBranch}from"./chunk-EBMCWXGZ.js";import"./chunk-DPNGBOI7.js";import"./chunk-7UK4WJWS.js";import"./chunk-HMIP4IK2.js";import"./chunk-SG3M7EYB.js";import"./chunk-YIW3H46P.js";import"./chunk-E6MI76C2.js";import"./chunk-NTNKD4KR.js";import"./chunk-4ZRCV3JY.js";import"./chunk-K7TPIVP4.js";import{ShellExecutionService}from"./chunk-CQCSNHPU.js";import{stripAnsi}from"./chunk-YGLM5XPP.js";import"./chunk-WGNF7FPC.js";import"./chunk-4NPYOXJO.js";import{promptIdContext}from"./chunk-MWGB5RCF.js";import"./chunk-SCD5TUBG.js";import"./chunk-NTRFETZB.js";import"./chunk-TL3SF2GA.js";import"./chunk-GRW3GBXN.js";import"./chunk-4JNHUZ7M.js";import"./chunk-SW54YEPK.js";import"./chunk-FNDMWG43.js";import{captureHookExecutionOwner,runOutsideAgentContext}from"./chunk-AGQBNWGY.js";import"./chunk-AGEDDL7Z.js";import"./chunk-2NJJHZ52.js";import"./chunk-BN4FIQ77.js";import{osc8Hyperlink,supportsHyperlinks,wrapForMultiplexer}from"./chunk-IKDZVJH2.js";import{openBrowserSecurely}from"./chunk-3YWXKSOI.js";import"./chunk-OZGM5CCE.js";import"./chunk-S4KYECMU.js";import"./chunk-VFB6Q74I.js";import"./chunk-A6LT3FIJ.js";import"./chunk-S6RXVOY6.js";import"./chunk-X64RXJQQ.js";import"./chunk-HETUGUHE.js";import{ALIBABA_PROVIDERS,QWENCLOUD_PROVIDERS,THIRD_PARTY_PROVIDERS,customProvider,findExistingProviderModels,findProviderByCredentials,findProviderById,isImageGenerationCapable,resolveMetadataKey}from"./chunk-BDQOLT37.js";import"./chunk-NCVLAQE5.js";import"./chunk-476F6QIM.js";import"./chunk-4R67LXKL.js";import"./chunk-VTDSLBET.js";import{ApiCancelEvent,ConversationFinishedEvent,DiscoveredMCPTool,ModelSlashCommandEvent,PromptSuggestionEvent,SpeculationEvent,UserFeedbackEvent,UserPromptEvent,UserRetryEvent,addMCPStatusChangeListener,formatFullTurnVisionNotice,formatVisionBridgeNotice,getAllMCPServerStatuses,getFullTurnVisionModelSelector,getMCPServerStatus,hasImageParts,isImageCapable,logApiCancel,logConversationFinishedEvent,logModelSlashCommand,logPromptSuggestion,logSlashCommand,logSpeculation,logUserFeedback,logUserPrompt,logUserRetry,makeSlashCommandEvent,recordSkillInvocation,removeMCPServerStatus,removeMCPStatusChangeListener,runVisionBridge,shouldRunVisionBridge,splitImageParts}from"./chunk-TNCN2JX2.js";import"./chunk-UQFTXKEB.js";import"./chunk-HDGTWJ24.js";import"./chunk-W5NWIGKO.js";import{AUTO_MEMORY_INDEX_FILENAME,getAutoMemoryProjectStateDir,getAutoMemoryRoot,getUserAutoMemoryRoot}from"./chunk-KVA6DHHF.js";import"./chunk-PWOQASXT.js";import"./chunk-K7JCVESI.js";import{getAllMemoryFilenames,getUnsupportedImageFormatWarning,isSupportedImageMimeType}from"./chunk-Y6HHV4LC.js";import"./chunk-RP57XAJ2.js";import"./chunk-Z6AR5XE5.js";import"./chunk-77V43YOE.js";import"./chunk-7U7CWMP7.js";import"./chunk-SLD7H2FA.js";import"./chunk-7DOOXUDG.js";import"./chunk-4DIWAQ5G.js";import{clampInlineMediaPart}from"./chunk-Q6UAOTP3.js";import{MAINLINE_CODER_MODEL}from"./chunk-DZ3GV34J.js";import{DEFAULT_TOKEN_LIMIT,applyReasoningEffort}from"./chunk-HEDN54OB.js";import"./chunk-4ZBZL23U.js";import"./chunk-ZZZAYAJW.js";import"./chunk-XMANRGPK.js";import{endInteractionSpan,getActiveInteractionSpan,redactUrlCredentials}from"./chunk-XHV5HLJS.js";import"./chunk-KQX4H2D3.js";import"./chunk-URNNJMIC.js";import"./chunk-HTW7PYHK.js";import"./chunk-AMGUAA4G.js";import{atomicWriteFileSync}from"./chunk-BMHYEQTI.js";import{FinishReason}from"./chunk-QKX6AI4W.js";import"./chunk-GU22I6TY.js";import"./chunk-YEYW7PPR.js";import"./chunk-U6C6ONIN.js";import"./chunk-GLXNCFWC.js";import"./chunk-NPAX2UFU.js";import"./chunk-UUY6XSQI.js";import{finalizeStartupProfile,profileCheckpoint}from"./chunk-H4XFFVZ2.js";import"./chunk-X7QN6R6K.js";import"./chunk-FUK4Y5AJ.js";import{registerCleanup,runExitCleanup}from"./chunk-LGYXZJI3.js";import{clearScreen,writeStderrLine,writeStderrLineSafe,writeStdoutLine}from"./chunk-SLPJ4OII.js";import"./chunk-4YLXNRRH.js";import{getApiHistoryPromptId}from"./chunk-B3ZFUGTC.js";import"./chunk-IRINPFG7.js";import{HOOKS_CONFIG_FIELDS}from"./chunk-6GTPLW7K.js";import"./chunk-NGVRCUYD.js";import"./chunk-5DTFN37U.js";import{isPathWithinRoot}from"./chunk-2YUBAWQ6.js";import"./chunk-O5EKX7LG.js";import"./chunk-TM6ZCBR7.js";import"./chunk-SVAPAMMG.js";import"./chunk-3KUHQGOS.js";import"./chunk-I6S7NGX3.js";import{ToolNames}from"./chunk-SBZFGYYS.js";import{createDebugLogger,isDebugLogFileEnabled,isDebugLoggingDegraded}from"./chunk-JAUJI56S.js";import"./chunk-I4H7NUVP.js";import{Storage}from"./chunk-EPODBRBP.js";import{shortenPath,tildeifyPath}from"./chunk-OKN3Z5C5.js";import{UnauthorizedError,getErrorMessage,isNodeError}from"./chunk-XYB7GC5U.js";import"./chunk-2UOMCYQG.js";import"./chunk-I7L2TX4M.js";import"./chunk-MK3OONRA.js";import"./chunk-COGTQ5KZ.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name,__toESM}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import{stat as stat2}from"node:fs/promises";import{basename as basename4}from"node:path";var import_react142=__toESM(require_react(),1);init_esbuild_shims();var import_react=__toESM(require_react(),1);var PeerMessagingContext=(0,import_react.createContext)(null);var usePeerMessaging=__name(()=>(0,import_react.useContext)(PeerMessagingContext),"usePeerMessaging");var PeerInboxFailureContext=(0,import_react.createContext)(null);var usePeerInboxFailure=__name(()=>(0,import_react.useContext)(PeerInboxFailureContext),"usePeerInboxFailure");init_esbuild_shims();import{isDeepStrictEqual}from"node:util";function inboundPolicyScope(settings){const merged=settings.merged.agents?.crossSessionInbound;if(merged===void 0)return void 0;const valueIn=__name(scope=>settings.forScope(scope).settings.agents?.crossSessionInbound,"valueIn");if(valueIn("System")!==void 0)return"system";const user=valueIn("User");const systemDefaults=valueIn("SystemDefaults");const workspace=valueIn("Workspace");if(isDeepStrictEqual(user,merged))return"user";if(isDeepStrictEqual(systemDefaults,merged))return"system";if(settings.isTrusted&&settings.workspaceSettingsActive&&isDeepStrictEqual(workspace,merged)){return"workspace"}if(user!==void 0)return"user";if(systemDefaults!==void 0)return"system";return void 0}__name(inboundPolicyScope,"inboundPolicyScope");init_esbuild_shims();var import_react2=__toESM(require_react(),1);var DualOutputContext=(0,import_react2.createContext)(null);function useDualOutput(){return(0,import_react2.useContext)(DualOutputContext)}__name(useDualOutput,"useDualOutput");init_esbuild_shims();var import_react3=__toESM(require_react(),1);var RemoteInputContext=(0,import_react3.createContext)(null);var useRemoteInput=__name(()=>(0,import_react3.useContext)(RemoteInputContext),"useRemoteInput");init_esbuild_shims();var import_react140=__toESM(require_react(),1);init_esbuild_shims();var import_react104=__toESM(require_react(),1);init_esbuild_shims();var import_jsx_runtime=__toESM(require_jsx_runtime(),1);var QuittingDisplay=__name(()=>{const uiState=useUIState();const{rows:terminalHeight,columns:terminalWidth}=useTerminalSize();const availableTerminalHeight=terminalHeight;const{mainAreaWidth}=uiState;if(!uiState.quittingMessages){return null}return(0,import_jsx_runtime.jsx)(Box_default,{flexDirection:"column",marginBottom:1,children:uiState.quittingMessages.map(item=>(0,import_jsx_runtime.jsx)(HistoryItemDisplay,{availableTerminalHeight:uiState.constrainHeight?availableTerminalHeight:void 0,terminalWidth,mainAreaWidth,item,isPending:false},item.id))})},"QuittingDisplay");init_esbuild_shims();var import_react4=__toESM(require_react(),1);var import_jsx_runtime2=__toESM(require_jsx_runtime(),1);var EXIT_INDEX=0;var CONTINUE_INDEX=1;var SettingsCorruptedDialog=__name(({corruptedPath,wasRecovered,onExit,onContinue})=>{const[selectedIndex,setSelectedIndex]=(0,import_react4.useState)(EXIT_INDEX);useKeypress(key=>{if(key.name==="escape"){onContinue();return}if(key.ctrl&&key.name==="c"){onExit();return}if(key.name==="up"){setSelectedIndex(EXIT_INDEX)}if(key.name==="down"){setSelectedIndex(CONTINUE_INDEX)}if(key.name==="return"){if(selectedIndex===EXIT_INDEX){onExit()}else{onContinue()}}},{isActive:true});const continueLabel=wasRecovered?t("Continue with recovered settings (esc)"):t("Continue with empty settings (esc)");return(0,import_jsx_runtime2.jsxs)(Box_default,{flexDirection:"column",borderStyle:"round",borderColor:theme.status.error,padding:1,width:"100%",marginLeft:1,children:[(0,import_jsx_runtime2.jsxs)(Box_default,{marginBottom:1,flexDirection:"column",children:[(0,import_jsx_runtime2.jsxs)(Text,{children:[(0,import_jsx_runtime2.jsx)(Text,{color:theme.status.error,children:"> "}),(0,import_jsx_runtime2.jsx)(Text,{bold:true,color:theme.status.error,children:t("Settings file corrupted")})]}),(0,import_jsx_runtime2.jsx)(Text,{color:theme.text.secondary,children:t("Your settings file had invalid JSON. A copy of the corrupted file has been saved for reference.")}),(0,import_jsx_runtime2.jsx)(Text,{color:theme.text.secondary,children:corruptedPath})]}),(0,import_jsx_runtime2.jsxs)(Box_default,{flexDirection:"column",children:[(0,import_jsx_runtime2.jsxs)(Box_default,{children:[(0,import_jsx_runtime2.jsx)(Text,{children:selectedIndex===EXIT_INDEX?(0,import_jsx_runtime2.jsx)(Text,{color:theme.status.success,children:"> "}):" "}),(0,import_jsx_runtime2.jsx)(Text,{color:selectedIndex===EXIT_INDEX?theme.status.success:theme.text.primary,children:t("Exit and restore corrupted file")})]}),(0,import_jsx_runtime2.jsxs)(Box_default,{children:[(0,import_jsx_runtime2.jsx)(Text,{children:selectedIndex===CONTINUE_INDEX?(0,import_jsx_runtime2.jsx)(Text,{color:theme.status.success,children:"> "}):" "}),(0,import_jsx_runtime2.jsx)(Text,{color:selectedIndex===CONTINUE_INDEX?theme.status.success:theme.text.primary,children:continueLabel})]})]})]})},"SettingsCorruptedDialog");init_esbuild_shims();init_esbuild_shims();init_esbuild_shims();var import_react5=__toESM(require_react(),1);var AppContext=(0,import_react5.createContext)(null);var useAppContext=__name(()=>{const context=(0,import_react5.useContext)(AppContext);if(!context){throw new Error("useAppContext must be used within an AppProvider")}return context},"useAppContext");var import_jsx_runtime3=__toESM(require_jsx_runtime(),1);var Notifications=__name(()=>{const{startupWarnings}=useAppContext();const{initError,streamingState}=useUIState();const showStartupWarnings=startupWarnings.length>0;const showInitError=initError&&streamingState!=="responding";return(0,import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment,{children:[showStartupWarnings&&(0,import_jsx_runtime3.jsx)(Box_default,{borderStyle:"round",borderColor:theme.status.warning,paddingX:1,marginY:1,flexDirection:"column",children:startupWarnings.map((warning,index)=>(0,import_jsx_runtime3.jsx)(Text,{color:theme.status.warning,children:warning},index))}),showInitError&&(0,import_jsx_runtime3.jsxs)(Box_default,{borderStyle:"round",borderColor:theme.status.error,paddingX:1,marginBottom:1,children:[(0,import_jsx_runtime3.jsxs)(Text,{color:theme.status.error,children:["Initialization Error: ",initError]}),(0,import_jsx_runtime3.jsxs)(Text,{color:theme.status.error,children:[" ","Please check API key and configuration."]})]})]})},"Notifications");init_esbuild_shims();var import_jsx_runtime4=__toESM(require_jsx_runtime(),1);var UpdateNotification=__name(({message})=>(0,import_jsx_runtime4.jsx)(Box_default,{borderStyle:"round",borderColor:theme.status.warning,paddingX:1,marginY:1,children:(0,import_jsx_runtime4.jsx)(Text,{color:theme.status.warning,children:message})}),"UpdateNotification");init_esbuild_shims();var import_react16=__toESM(require_react(),1);init_esbuild_shims();var import_jsx_runtime5=__toESM(require_jsx_runtime(),1);var ShowMoreLines=__name(({constrainHeight})=>{const overflowState=useOverflowState();const streamingState=useStreamingContext();if(overflowState===void 0||overflowState.overflowingIds.size===0||!constrainHeight||!(streamingState==="idle"||streamingState==="waiting_for_confirmation")){return null}return(0,import_jsx_runtime5.jsx)(Box_default,{children:(0,import_jsx_runtime5.jsx)(Text,{color:theme.text.secondary,wrap:"truncate",children:"Press ctrl-s to show more lines"})})},"ShowMoreLines");init_esbuild_shims();var import_react7=__toESM(require_react(),1);init_esbuild_shims();var import_jsx_runtime6=__toESM(require_jsx_runtime(),1);function formatAuthDisplayType(authDisplayType){if(!authDisplayType||!authDisplayType.trim()){return t("Unknown")}const value=authDisplayType.trim();switch(value){case"qwen_oauth":return t("Qwen OAuth");case"coding_plan":return t("Coding Plan");case"api_key":return t("API Key");case"unknown":return t("Unknown");default:return authDisplayType}}__name(formatAuthDisplayType,"formatAuthDisplayType");var Header=__name(({customAsciiArt,customBannerTitle,customBannerSubtitle,version,authDisplayType,model,workingDirectory})=>{const{columns:terminalWidth}=useTerminalSize();const formattedAuthType=formatAuthDisplayType(authDisplayType);const versionLabel=formatVersionLabel(version);const containerMarginX=2;const logoGap=2;const infoPanelPaddingX=1;const infoPanelBorderWidth=2;const infoPanelChromeWidth=infoPanelBorderWidth+infoPanelPaddingX*2;const minPathLength=40;const minInfoPanelWidth=minPathLength+infoPanelChromeWidth;const availableTerminalWidth=Math.max(0,terminalWidth-containerMarginX*2);const hasCustomArt=Boolean(customAsciiArt?.small||customAsciiArt?.large);const customTier=pickAsciiArtTier(customAsciiArt?.small,customAsciiArt?.large,availableTerminalWidth,logoGap,minInfoPanelWidth,getAsciiArtWidth);const displayLogo=customTier??(hasCustomArt?"":shortAsciiLogo);const logoWidth=getAsciiArtWidth(displayLogo);const showLogo=displayLogo!==""&&availableTerminalWidth>=logoWidth+logoGap+minInfoPanelWidth;const maxInfoPanelWidth=60;const availableInfoPanelWidth=showLogo?Math.min(availableTerminalWidth-logoWidth-logoGap,maxInfoPanelWidth):availableTerminalWidth;const maxPathLength=Math.max(0,availableInfoPanelWidth-infoPanelChromeWidth);const infoPanelContentWidth=Math.max(0,availableInfoPanelWidth-infoPanelChromeWidth);const authModelText=`${formattedAuthType} | ${model}`;const modelHintText=" (/model to change)";const showModelHint=infoPanelContentWidth>0&&getCachedStringWidth(authModelText+modelHintText)<=infoPanelContentWidth;const tildeifiedPath=tildeifyPath(workingDirectory);const shortenedPath=shortenPath(tildeifiedPath,Math.max(3,maxPathLength));const displayPath=maxPathLength<=0?"":shortenedPath.length>maxPathLength?shortenedPath.slice(0,maxPathLength):shortenedPath;const gradientColors=getRenderableGradientColors(theme.ui.gradient,[theme.text.secondary,theme.text.link,theme.text.accent]);return(0,import_jsx_runtime6.jsxs)(Box_default,{flexDirection:"row",alignItems:"center",marginX:containerMarginX,width:availableTerminalWidth,children:[showLogo&&(0,import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment,{children:[(0,import_jsx_runtime6.jsx)(Box_default,{flexShrink:0,children:gradientColors?(0,import_jsx_runtime6.jsx)(dist_default2,{colors:gradientColors,children:(0,import_jsx_runtime6.jsx)(Text,{children:displayLogo})}):(0,import_jsx_runtime6.jsx)(Text,{children:displayLogo})}),(0,import_jsx_runtime6.jsx)(Box_default,{width:logoGap})]}),(0,import_jsx_runtime6.jsxs)(Box_default,{flexDirection:"column",borderStyle:"single",borderColor:theme.border.default,paddingX:infoPanelPaddingX,flexGrow:showLogo?0:1,width:showLogo?availableInfoPanelWidth:void 0,children:[(0,import_jsx_runtime6.jsxs)(Text,{children:[(0,import_jsx_runtime6.jsx)(Text,{bold:true,color:theme.text.accent,children:customBannerTitle?customBannerTitle:">_ Qwen Code"}),(0,import_jsx_runtime6.jsxs)(Text,{color:theme.text.secondary,children:[" (",versionLabel,")"]})]}),customBannerSubtitle?(0,import_jsx_runtime6.jsx)(Text,{color:theme.text.secondary,children:customBannerSubtitle}):(0,import_jsx_runtime6.jsx)(Text,{children:" "}),(0,import_jsx_runtime6.jsxs)(Text,{children:[(0,import_jsx_runtime6.jsx)(Text,{color:theme.text.secondary,children:authModelText}),showModelHint&&(0,import_jsx_runtime6.jsx)(Text,{color:theme.text.secondary,children:modelHintText})]}),(0,import_jsx_runtime6.jsx)(Text,{color:theme.text.secondary,children:displayPath})]})]})},"Header");init_esbuild_shims();var import_react6=__toESM(require_react(),1);init_esbuild_shims();init_esbuild_shims();import*as fs from"node:fs";import*as path from"node:path";var TipHistory=class _TipHistory{static{__name(this,"TipHistory")}sessionShown=new Map;data;filePath;constructor(data,filePath){this.data=data;this.filePath=filePath}get sessionCount(){return this.data.sessionCount}isCooledDown(tipId,cooldownPrompts,currentPromptCount){const lastShown=this.sessionShown.get(tipId);if(lastShown===void 0)return true;return currentPromptCount-lastShown>=cooldownPrompts}getLastShown(tipId){if(this.sessionShown.has(tipId)){return Number.MAX_SAFE_INTEGER-1e6+(this.sessionShown.get(tipId)??0)}return this.normalizeEntry(this.data.tips[tipId]).lastSessionTimestamp}normalizeEntry(raw){if(typeof raw!=="object"||raw===null||Array.isArray(raw)){return{totalShown:0,lastSessionTimestamp:0}}const candidate=raw;return{totalShown:typeof candidate.totalShown==="number"&&Number.isFinite(candidate.totalShown)?candidate.totalShown:0,lastSessionTimestamp:typeof candidate.lastSessionTimestamp==="number"&&Number.isFinite(candidate.lastSessionTimestamp)?candidate.lastSessionTimestamp:0}}recordShown(tipId,currentPromptCount){this.sessionShown.set(tipId,currentPromptCount);const entry=this.normalizeEntry(this.data.tips[tipId]);entry.totalShown++;entry.lastSessionTimestamp=Date.now();this.data.tips[tipId]=entry;this.persist()}persist(){try{const dir=path.dirname(this.filePath);if(!fs.existsSync(dir)){fs.mkdirSync(dir,{recursive:true})}atomicWriteFileSync(this.filePath,JSON.stringify(this.data,null,2),{mode:384,forceMode:true,noFollow:true})}catch{}}static load(){const filePath=path.join(Storage.getGlobalQwenDir(),"tip_history.json");let data={sessionCount:0,tips:{}};try{if(fs.existsSync(filePath)){const raw=fs.readFileSync(filePath,"utf-8");const parsed=JSON.parse(raw);if(typeof parsed==="object"&&parsed!==null&&typeof parsed.sessionCount==="number"){data={sessionCount:Number.isFinite(parsed.sessionCount)&&parsed.sessionCount>=0?Math.floor(parsed.sessionCount):0,tips:parsed.tips??{}}}}}catch{}data.sessionCount++;data.tips=typeof data.tips==="object"&&data.tips!==null&&!Array.isArray(data.tips)?data.tips:{};const history=new _TipHistory(data,filePath);history.persist();return history}};init_esbuild_shims();function selectTip(trigger,context,tips,history){const candidates=tips.filter(tip=>tip.trigger===trigger).filter(tip=>{try{return tip.isRelevant(context)}catch{return false}}).filter(tip=>history.isCooledDown(tip.id,tip.cooldownPrompts,context.sessionPromptCount));if(candidates.length===0)return null;candidates.sort((a,b)=>{if(b.priority!==a.priority)return b.priority-a.priority;return history.getLastShown(a.id)-history.getLastShown(b.id)});return candidates[0]??null}__name(selectTip,"selectTip");init_esbuild_shims();var tipRegistry=[{id:"context-critical",content:"Context near hard limit \u2014 auto-compact will force on next send. Consider /clear if you want to start fresh.",trigger:"post-response",isRelevant:__name(ctx=>ctx.thresholds!==void 0&&ctx.lastPromptTokenCount>=ctx.thresholds.hard,"isRelevant"),cooldownPrompts:3,priority:100},{id:"context-high",content:"Context is getting full. Use /compress to free up space.",trigger:"post-response",isRelevant:__name(ctx=>ctx.thresholds!==void 0&&ctx.lastPromptTokenCount>=ctx.thresholds.auto&&ctx.lastPromptTokenCount<ctx.thresholds.hard,"isRelevant"),cooldownPrompts:5,priority:90},{id:"compress-intro",content:"Long conversation? /compress summarizes history to free context.",trigger:"post-response",isRelevant:__name(ctx=>ctx.thresholds!==void 0&&ctx.lastPromptTokenCount>=ctx.thresholds.warn&&ctx.lastPromptTokenCount<ctx.thresholds.auto&&ctx.sessionPromptCount>5,"isRelevant"),cooldownPrompts:10,priority:50},{id:"new-user-slash",content:"Type / to open the command popup; Tab autocompletes slash commands and saved prompts.",trigger:"startup",isRelevant:__name(ctx=>ctx.sessionCount<5,"isRelevant"),cooldownPrompts:0,priority:70},{id:"new-user-qwenmd",content:"Add a QWEN.md file to give Qwen Code persistent project context.",trigger:"startup",isRelevant:__name(ctx=>ctx.sessionCount<10,"isRelevant"),cooldownPrompts:0,priority:70},{id:"new-user-resume",content:"You can resume a previous conversation by running qwen --continue or qwen --resume.",trigger:"startup",isRelevant:__name(ctx=>ctx.sessionCount<10,"isRelevant"),cooldownPrompts:0,priority:70},{id:"shell-commands",content:"You can run any shell commands from Qwen Code using ! (e.g. !ls).",trigger:"startup",isRelevant:__name(ctx=>ctx.sessionCount<15,"isRelevant"),cooldownPrompts:0,priority:70},{id:"compress-startup",content:"Use /compress when the conversation gets long to summarize history and free up context.",trigger:"startup",isRelevant:__name(()=>true,"isRelevant"),cooldownPrompts:0,priority:50},{id:"approval-mode-win32",content:"You can switch permission mode quickly with Tab or /approval-mode.",trigger:"startup",isRelevant:__name(ctx=>ctx.platform==="win32","isRelevant"),cooldownPrompts:0,priority:50},{id:"approval-mode",content:"You can switch permission mode quickly with Shift+Tab or /approval-mode.",trigger:"startup",isRelevant:__name(ctx=>ctx.platform!=="win32","isRelevant"),cooldownPrompts:0,priority:50},{id:"insight-command",content:"Try /insight to generate personalized insights from your chat history.",trigger:"startup",isRelevant:__name(ctx=>ctx.sessionCount>20,"isRelevant"),cooldownPrompts:0,priority:70},{id:"btw-command",content:"Use /btw to ask a quick side question without disrupting the conversation.",trigger:"startup",isRelevant:__name(()=>true,"isRelevant"),cooldownPrompts:0,priority:50},{id:"clear-new",content:"Start a fresh idea with /clear or /new; the previous session stays available in history.",trigger:"startup",isRelevant:__name(()=>true,"isRelevant"),cooldownPrompts:0,priority:50},{id:"bug-report",content:"Use /bug to submit issues to the maintainers when something goes off.",trigger:"startup",isRelevant:__name(()=>true,"isRelevant"),cooldownPrompts:0,priority:50},{id:"auth-switch",content:"Switch auth type quickly with /auth.",trigger:"startup",isRelevant:__name(()=>true,"isRelevant"),cooldownPrompts:0,priority:50}];var _tipHistory=null;function getTipHistory(){if(!_tipHistory){_tipHistory=TipHistory.load()}return _tipHistory}__name(getTipHistory,"getTipHistory");var import_jsx_runtime7=__toESM(require_jsx_runtime(),1);function pickStartupTip(){const history=getTipHistory();const context={lastPromptTokenCount:0,contextWindowSize:0,sessionPromptCount:0,sessionCount:history.sessionCount,platform:process.platform};const tip=selectTip("startup",context,tipRegistry,history);if(tip){history.recordShown(tip.id,0);return tip.content}return"Type / to see all available commands."}__name(pickStartupTip,"pickStartupTip");var Tips=__name(()=>{const selectedTip=(0,import_react6.useMemo)(()=>pickStartupTip(),[]);return(0,import_jsx_runtime7.jsx)(Box_default,{marginLeft:2,marginRight:2,children:(0,import_jsx_runtime7.jsxs)(Text,{color:theme.text.secondary,children:[t("Tips:")," ",t(selectedTip)]})})},"Tips");var import_jsx_runtime8=__toESM(require_jsx_runtime(),1);function getAuthDisplayType(authType,baseUrl,apiKeyEnvKey){if(!authType){return"unknown"}const matched=findProviderByCredentials(baseUrl,apiKeyEnvKey);if(matched&&resolveMetadataKey(matched)){return matched.label}switch(authType){case"qwen-oauth":return"qwen_oauth";default:return"api_key"}}__name(getAuthDisplayType,"getAuthDisplayType");var AppHeader=__name(({version})=>{const settings=useSettings();const config=useConfig();const contentGeneratorConfig=config.getContentGeneratorConfig();const authType=contentGeneratorConfig?.authType;const{currentModel}=useUIState();const model=config.getModelsConfig().getModelDisplayName(currentModel);const targetDir=config.getTargetDir();const showBanner=!config.getScreenReader()&&!settings.merged.ui?.hideBanner;const showTips=!(settings.merged.ui?.hideTips||config.getScreenReader());const authDisplayType=getAuthDisplayType(authType,contentGeneratorConfig?.baseUrl,contentGeneratorConfig?.apiKeyEnvKey);const resolvedBanner=(0,import_react7.useMemo)(()=>showBanner?resolveCustomBanner(settings):void 0,[showBanner,settings]);return(0,import_jsx_runtime8.jsxs)(Box_default,{flexDirection:"column",children:[showBanner&&(0,import_jsx_runtime8.jsx)(Header,{version,authDisplayType,model,workingDirectory:targetDir,customAsciiArt:resolvedBanner?.asciiArt,customBannerTitle:resolvedBanner?.title,customBannerSubtitle:resolvedBanner?.subtitle}),showTips&&(0,import_jsx_runtime8.jsx)(Tips,{})]})},"AppHeader");init_esbuild_shims();var import_jsx_runtime9=__toESM(require_jsx_runtime(),1);var DebugModeNotification=__name(()=>{const config=useConfig();if(!config.getDebugMode()){return null}const isFileLoggingEnabled=isDebugLogFileEnabled();const isDegraded=isDebugLoggingDegraded();return(0,import_jsx_runtime9.jsxs)(Box_default,{paddingX:1,marginTop:1,flexDirection:"column",children:[(0,import_jsx_runtime9.jsx)(Text,{color:theme.status.warning,children:"Debug mode enabled"}),isFileLoggingEnabled?(0,import_jsx_runtime9.jsxs)(Text,{dimColor:true,children:["Logging to: ",Storage.getDebugLogPath(config.getSessionId())]}):(0,import_jsx_runtime9.jsx)(Text,{dimColor:true,children:"Debug log file disabled by QWEN_DEBUG_LOG_FILE"}),isDegraded&&(0,import_jsx_runtime9.jsx)(Text,{dimColor:true,children:"Warning: Debug logging is degraded (write failures occurred)"})]})},"DebugModeNotification");init_esbuild_shims();var import_react13=__toESM(require_react(),1);init_esbuild_shims();var import_react11=__toESM(require_react(),1);init_esbuild_shims();var import_react8=__toESM(require_react(),1);function useBatchedScroll(currentScrollTop){const pendingScrollTopRef=(0,import_react8.useRef)(null);const currentScrollTopRef=(0,import_react8.useRef)(currentScrollTop);(0,import_react8.useLayoutEffect)(()=>{currentScrollTopRef.current=currentScrollTop;pendingScrollTopRef.current=null});const getScrollTop=(0,import_react8.useCallback)(()=>pendingScrollTopRef.current??currentScrollTopRef.current,[]);const setPendingScrollTop=(0,import_react8.useCallback)(newScrollTop=>{pendingScrollTopRef.current=newScrollTop},[]);return{getScrollTop,setPendingScrollTop}}__name(useBatchedScroll,"useBatchedScroll");init_esbuild_shims();var import_react9=__toESM(require_react(),1);function useAnimatedScrollbar(options={}){const{idleHideMs=1500}=options;const[isVisible,setIsVisible]=(0,import_react9.useState)(false);const timerRef=(0,import_react9.useRef)(null);const flashScrollbar=(0,import_react9.useCallback)(()=>{setIsVisible(true);if(timerRef.current!==null){clearTimeout(timerRef.current)}if(idleHideMs<=0){timerRef.current=null;return}timerRef.current=setTimeout(()=>{setIsVisible(false);timerRef.current=null},idleHideMs)},[idleHideMs]);(0,import_react9.useEffect)(()=>()=>{if(timerRef.current!==null){clearTimeout(timerRef.current);timerRef.current=null}},[]);return{isVisible,flashScrollbar}}__name(useAnimatedScrollbar,"useAnimatedScrollbar");init_esbuild_shims();var import_react10=__toESM(require_react(),1);var import_jsx_runtime10=__toESM(require_jsx_runtime(),1);var StaticRender=(0,import_react10.memo)(({children,width})=>(0,import_jsx_runtime10.jsx)(Box_default,{width,flexDirection:"column",flexShrink:0,children}),(prev,next)=>prev.children===next.children&&prev.width===next.width);StaticRender.displayName="StaticRender";var import_jsx_runtime11=__toESM(require_jsx_runtime(),1);var debugLogger=createDebugLogger("VIRTUALIZED_LIST");var SCROLL_TO_ITEM_END=Number.MAX_SAFE_INTEGER;function upperBound(arr,target){let lo=0;let hi=arr.length;while(lo<hi){const mid=lo+hi>>>1;if(arr[mid]<=target)lo=mid+1;else hi=mid}return lo}__name(upperBound,"upperBound");function findLastLE(arr,target){return upperBound(arr,target)-1}__name(findLastLE,"findLastLE");function firstIndexOfOffsetRun(offsets,index){let i=index;while(i>0&&offsets[i-1]===offsets[i]){i--}return i}__name(firstIndexOfOffsetRun,"firstIndexOfOffsetRun");var VirtualizedListItem=(0,import_react11.memo)(({content,shouldBeStatic,width,containerWidth,itemKey,onHeightChange})=>{const itemRef=(0,import_react11.useRef)(null);const{height,hasMeasured}=use_box_metrics_default(itemRef);const onHeightChangeRef=(0,import_react11.useRef)(onHeightChange);onHeightChangeRef.current=onHeightChange;(0,import_react11.useLayoutEffect)(()=>{const measuredHeight=itemRef.current?.yogaNode?.getComputedHeight()??height;if(hasMeasured){onHeightChangeRef.current(itemKey,measuredHeight)}},[itemKey,height,hasMeasured,content]);return(0,import_jsx_runtime11.jsx)(Box_default,{width:"100%",flexDirection:"column",flexShrink:0,ref:itemRef,children:shouldBeStatic?(0,import_jsx_runtime11.jsx)(StaticRender,{width:typeof width==="number"?width:containerWidth,children:content},itemKey+"-static-"+(typeof width==="number"?width:containerWidth)):content})});VirtualizedListItem.displayName="VirtualizedListItem";function VirtualizedList(props,ref){const{data,renderItem,estimatedItemHeight,keyExtractor,initialScrollIndex,initialScrollOffsetInIndex,renderStatic,isStaticItem,width}=props;const[scrollAnchor,setScrollAnchor]=(0,import_react11.useState)(()=>{const scrollToEnd=initialScrollIndex===SCROLL_TO_ITEM_END||typeof initialScrollIndex==="number"&&initialScrollIndex>=data.length-1&&initialScrollOffsetInIndex===SCROLL_TO_ITEM_END;if(scrollToEnd){return{index:data.length>0?data.length-1:0,offset:SCROLL_TO_ITEM_END}}if(typeof initialScrollIndex==="number"){return{index:Math.max(0,Math.min(data.length-1,initialScrollIndex)),offset:initialScrollOffsetInIndex??0}}if(typeof props.targetScrollIndex==="number"){return{index:props.targetScrollIndex,offset:0}}return{index:0,offset:0}});const[isStickingToBottom,setIsStickingToBottom]=(0,import_react11.useState)(()=>{const scrollToEnd=initialScrollIndex===SCROLL_TO_ITEM_END||typeof initialScrollIndex==="number"&&initialScrollIndex>=data.length-1&&initialScrollOffsetInIndex===SCROLL_TO_ITEM_END;return scrollToEnd});const containerRef=(0,import_react11.useRef)(null);const rootRef=(0,import_react11.useRef)(null);const{width:measuredContainerWidth,height:measuredContainerHeight}=use_box_metrics_default(containerRef);const containerHeight=props.containerHeight??measuredContainerHeight;const containerWidth=measuredContainerWidth;const[heights,setHeights]=(0,import_react11.useState)({});const measureAtFullHeight=props.measureAtFullHeight===true;const[fullHeightMeasurementPending,setFullHeightMeasurementPending]=(0,import_react11.useState)(measureAtFullHeight);const[previousMeasurementInputs,setPreviousMeasurementInputs]=(0,import_react11.useState)({enabled:measureAtFullHeight,data,renderItem});if(previousMeasurementInputs.enabled!==measureAtFullHeight||measureAtFullHeight&&(previousMeasurementInputs.data!==data||previousMeasurementInputs.renderItem!==renderItem)){setPreviousMeasurementInputs({enabled:measureAtFullHeight,data,renderItem});setFullHeightMeasurementPending(measureAtFullHeight)}const isInitialScrollSet=(0,import_react11.useRef)(false);const onHeightChange=(0,import_react11.useCallback)((key,height)=>{setHeights(prev=>{if(prev[key]===height)return prev;return{...prev,[key]:height}});setFullHeightMeasurementPending(false)},[]);(0,import_react11.useLayoutEffect)(()=>{setHeights(prev=>{const prevKeys=Object.keys(prev);if(prevKeys.length<=Math.max(8,2*data.length))return prev;const currentKeys=new Set;for(let i=0;i<data.length;i++){currentKeys.add(keyExtractor(data[i],i))}let staleSeen=false;for(const k of prevKeys){if(!currentKeys.has(k)){staleSeen=true;break}}if(!staleSeen)return prev;const next={};for(const k of prevKeys){if(currentKeys.has(k))next[k]=prev[k]}return next})},[data,keyExtractor]);const{totalHeight,offsets}=(0,import_react11.useMemo)(()=>{const offsets2=[0];let totalHeight2=0;for(let i=0;i<data.length;i++){const key=keyExtractor(data[i],i);const raw=heights[key]??estimatedItemHeight(i);const height=Number.isFinite(raw)&&raw>0?raw:0;totalHeight2+=height;offsets2.push(totalHeight2)}return{totalHeight:totalHeight2,offsets:offsets2}},[heights,data,estimatedItemHeight,keyExtractor]);const scrollableContainerHeight=containerHeight;const getAnchorForScrollTop=(0,import_react11.useCallback)((scrollTop2,offsets2)=>{const found=findLastLE(offsets2,scrollTop2);if(found===-1){return{index:0,offset:0}}const index=firstIndexOfOffsetRun(offsets2,found);return{index,offset:scrollTop2-offsets2[index]}},[]);const[prevTargetScrollIndex,setPrevTargetScrollIndex]=(0,import_react11.useState)(props.targetScrollIndex);const prevOffsetsLength=(0,import_react11.useRef)(1);const target=props.targetScrollIndex;if(target!==void 0&&offsets.length>1){const targetChanged=target!==prevTargetScrollIndex;const offsetsJustBecameUsable=prevOffsetsLength.current<=1;if(targetChanged||offsetsJustBecameUsable){if(targetChanged){setPrevTargetScrollIndex(target)}if(isStickingToBottom){setIsStickingToBottom(false)}const anchoredIndex=firstIndexOfOffsetRun(offsets,Math.max(0,Math.min(data.length-1,target)));if(scrollAnchor.index!==anchoredIndex||scrollAnchor.offset!==0){setScrollAnchor({index:anchoredIndex,offset:0})}}}prevOffsetsLength.current=offsets.length;const actualScrollTop=(0,import_react11.useMemo)(()=>{const offset=offsets[scrollAnchor.index];if(typeof offset!=="number"){return 0}if(scrollAnchor.offset===SCROLL_TO_ITEM_END){const item=data[scrollAnchor.index];const key=item?keyExtractor(item,scrollAnchor.index):"";const itemHeight=heights[key]??0;return offset+itemHeight-scrollableContainerHeight}return offset+scrollAnchor.offset},[scrollAnchor,offsets,heights,scrollableContainerHeight,data,keyExtractor]);const scrollTop=isStickingToBottom?Number.MAX_SAFE_INTEGER:actualScrollTop;const prevDataLength=(0,import_react11.useRef)(data.length);const prevTotalHeight=(0,import_react11.useRef)(totalHeight);const prevScrollTop=(0,import_react11.useRef)(actualScrollTop);const prevContainerHeight=(0,import_react11.useRef)(scrollableContainerHeight);(0,import_react11.useLayoutEffect)(()=>{const contentPreviouslyFit=prevTotalHeight.current<=prevContainerHeight.current;const wasScrolledToBottomPixels=prevScrollTop.current>=prevTotalHeight.current-prevContainerHeight.current-1;const wasAtBottom=contentPreviouslyFit||wasScrolledToBottomPixels;if(wasAtBottom&&actualScrollTop>=prevScrollTop.current){if(!isStickingToBottom){setIsStickingToBottom(true)}}const listGrew=data.length>prevDataLength.current;const containerChanged=prevContainerHeight.current!==scrollableContainerHeight;const shouldAutoScroll=props.targetScrollIndex===void 0;if(shouldAutoScroll&&(listGrew&&(isStickingToBottom||wasAtBottom)||isStickingToBottom&&containerChanged)){const newIndex=data.length>0?data.length-1:0;if(scrollAnchor.index!==newIndex||scrollAnchor.offset!==SCROLL_TO_ITEM_END){setScrollAnchor({index:newIndex,offset:SCROLL_TO_ITEM_END})}if(!isStickingToBottom){setIsStickingToBottom(true)}}else if((scrollAnchor.index>=data.length||actualScrollTop>totalHeight-scrollableContainerHeight)&&data.length>0){const newScrollTop=Math.max(0,totalHeight-scrollableContainerHeight);const newAnchor=getAnchorForScrollTop(newScrollTop,offsets);if(scrollAnchor.index!==newAnchor.index||scrollAnchor.offset!==newAnchor.offset){setScrollAnchor(newAnchor)}}else if(data.length===0){if(scrollAnchor.index!==0||scrollAnchor.offset!==0){setScrollAnchor({index:0,offset:0})}}prevDataLength.current=data.length;prevTotalHeight.current=totalHeight;prevScrollTop.current=actualScrollTop;prevContainerHeight.current=scrollableContainerHeight},[data.length,totalHeight,actualScrollTop,scrollableContainerHeight,scrollAnchor.index,scrollAnchor.offset,getAnchorForScrollTop,offsets,isStickingToBottom,props.targetScrollIndex]);(0,import_react11.useLayoutEffect)(()=>{if(isInitialScrollSet.current||offsets.length<=1||totalHeight<=0||scrollableContainerHeight<=0){return}if(props.targetScrollIndex!==void 0){isInitialScrollSet.current=true;return}if(typeof initialScrollIndex==="number"){const scrollToEnd=initialScrollIndex===SCROLL_TO_ITEM_END||initialScrollIndex>=data.length-1&&initialScrollOffsetInIndex===SCROLL_TO_ITEM_END;if(scrollToEnd){setScrollAnchor({index:data.length-1,offset:SCROLL_TO_ITEM_END});setIsStickingToBottom(true);isInitialScrollSet.current=true;return}const index=Math.max(0,Math.min(data.length-1,initialScrollIndex));const offset=initialScrollOffsetInIndex??0;const newScrollTop=(offsets[index]??0)+offset;const clampedScrollTop2=Math.max(0,Math.min(totalHeight-scrollableContainerHeight,newScrollTop));setScrollAnchor(getAnchorForScrollTop(clampedScrollTop2,offsets));isInitialScrollSet.current=true}},[initialScrollIndex,initialScrollOffsetInIndex,offsets,totalHeight,scrollableContainerHeight,getAnchorForScrollTop,data.length,heights,props.targetScrollIndex]);const maxScroll=Math.max(0,totalHeight-scrollableContainerHeight);const clampedScrollTop=Math.min(Math.max(0,isStickingToBottom?maxScroll:actualScrollTop),maxScroll);const startIndex=firstIndexOfOffsetRun(offsets,Math.max(0,findLastLE(offsets,clampedScrollTop)-1));const viewHeightForEndIndex=scrollableContainerHeight>0?scrollableContainerHeight:50;const endIndexOffsetRaw=upperBound(offsets,clampedScrollTop+viewHeightForEndIndex);const endIndex=endIndexOffsetRaw>=offsets.length?data.length-1:Math.min(data.length-1,endIndexOffsetRaw);const topSpacerHeight=renderStatic===true?0:offsets[startIndex]??0;const bottomSpacerHeight=renderStatic?0:totalHeight-(offsets[endIndex+1]??totalHeight);const isReady=containerHeight>0||false||width!==void 0&&typeof width==="number";if(!isReady){debugLogger.debug(`viewport not ready (containerHeight=${containerHeight}, width=${String(width)}); rendering empty until measurement settles`)}const renderRangeStart=renderStatic?0:startIndex;const renderRangeEnd=renderStatic?data.length-1:endIndex;const renderedItems=(0,import_react11.useMemo)(()=>{if(!isReady){return[]}const items=[];for(let i=renderRangeStart;i<=renderRangeEnd;i++){const item=data[i];if(item){const isOutsideViewport=i<startIndex||i>endIndex;const shouldBeStatic=renderStatic===true&&isOutsideViewport||isStaticItem?.(item,i)===true;let content;try{content=renderItem({item,index:i})}catch(err){debugLogger.debug(`renderItem threw at index ${i}`,err);content=(0,import_jsx_runtime11.jsx)(Box_default,{flexDirection:"column",flexShrink:0,children:(0,import_jsx_runtime11.jsx)(Text,{color:"red",children:"[render error]"})})}const key=keyExtractor(item,i);items.push((0,import_jsx_runtime11.jsx)(VirtualizedListItem,{itemKey:key,content,shouldBeStatic,width,containerWidth,onHeightChange},key))}}return items},[isReady,renderRangeStart,renderRangeEnd,data,startIndex,endIndex,renderStatic,isStaticItem,renderItem,keyExtractor,width,containerWidth,onHeightChange]);const{getScrollTop,setPendingScrollTop}=useBatchedScroll(scrollTop);const getScrollbarGeometry=(0,import_react11.useCallback)(()=>{const shouldShowScrollbar=(props.showScrollbar??true)&&maxScroll>0;if(!shouldShowScrollbar||!rootRef.current||scrollableContainerHeight<=0){return null}const metrics=measureElementPosition(rootRef.current);if(metrics.width<=0||metrics.height<=0)return null;return{col:metrics.x+metrics.width-1,top:metrics.y,height:scrollableContainerHeight}},[props.showScrollbar,maxScroll,scrollableContainerHeight]);const hitTestScrollbar=(0,import_react11.useCallback)(({col,row})=>{const geometry=getScrollbarGeometry();if(!geometry)return false;const zeroBasedCol=col-1;const zeroBasedRow=row-1;return zeroBasedCol===geometry.col&&zeroBasedRow>=geometry.top&&zeroBasedRow<geometry.top+geometry.height},[getScrollbarGeometry]);const scrollToScrollbarRow=(0,import_react11.useCallback)(row=>{const geometry=getScrollbarGeometry();if(!geometry)return;const zeroBasedRow=row-1;const rowInTrack=Math.max(0,Math.min(geometry.height-1,zeroBasedRow-geometry.top));const scrollRatio=rowInTrack/Math.max(1,geometry.height-1);const newScrollTop=Math.round(scrollRatio*maxScroll);if(newScrollTop>=maxScroll){setIsStickingToBottom(true);setPendingScrollTop(Number.MAX_SAFE_INTEGER);if(data.length>0){setScrollAnchor({index:data.length-1,offset:SCROLL_TO_ITEM_END})}}else{setIsStickingToBottom(false);setPendingScrollTop(newScrollTop);setScrollAnchor(getAnchorForScrollTop(newScrollTop,offsets))}},[data.length,getAnchorForScrollTop,getScrollbarGeometry,maxScroll,offsets,setPendingScrollTop]);(0,import_react11.useImperativeHandle)(ref,()=>({scrollBy:__name(delta=>{if(delta<0){setIsStickingToBottom(false)}const currentScrollTop=getScrollTop();const maxScroll2=Math.max(0,totalHeight-scrollableContainerHeight);const actualCurrent=Math.min(currentScrollTop,maxScroll2);const newScrollTop=Math.max(0,actualCurrent+delta);if(newScrollTop>=maxScroll2){setIsStickingToBottom(true);setPendingScrollTop(Number.MAX_SAFE_INTEGER);if(data.length>0){setScrollAnchor({index:data.length-1,offset:SCROLL_TO_ITEM_END})}return}setPendingScrollTop(newScrollTop);setScrollAnchor(getAnchorForScrollTop(newScrollTop,offsets))},"scrollBy"),scrollTo:__name(offset=>{const maxScroll2=Math.max(0,totalHeight-scrollableContainerHeight);if(offset>=maxScroll2||offset===SCROLL_TO_ITEM_END){setIsStickingToBottom(true);setPendingScrollTop(Number.MAX_SAFE_INTEGER);if(data.length>0){setScrollAnchor({index:data.length-1,offset:SCROLL_TO_ITEM_END})}}else{setIsStickingToBottom(false);const newScrollTop=Math.max(0,offset);setPendingScrollTop(newScrollTop);setScrollAnchor(getAnchorForScrollTop(newScrollTop,offsets))}},"scrollTo"),scrollToEnd:__name(()=>{setIsStickingToBottom(true);setPendingScrollTop(Number.MAX_SAFE_INTEGER);if(data.length>0){setScrollAnchor({index:data.length-1,offset:SCROLL_TO_ITEM_END})}},"scrollToEnd"),scrollToIndex:__name(({index,viewOffset=0,viewPosition=0})=>{setIsStickingToBottom(false);const offset=offsets[index];if(offset!==void 0){const maxScroll2=Math.max(0,totalHeight-scrollableContainerHeight);const newScrollTop=Math.max(0,Math.min(maxScroll2,offset-viewPosition*scrollableContainerHeight+viewOffset));setPendingScrollTop(newScrollTop);setScrollAnchor(getAnchorForScrollTop(newScrollTop,offsets))}},"scrollToIndex"),scrollToItem:__name(({item,viewOffset=0,viewPosition=0})=>{setIsStickingToBottom(false);const index=data.indexOf(item);if(index!==-1){const offset=offsets[index];if(offset!==void 0){const maxScroll2=Math.max(0,totalHeight-scrollableContainerHeight);const newScrollTop=Math.max(0,Math.min(maxScroll2,offset-viewPosition*scrollableContainerHeight+viewOffset));setPendingScrollTop(newScrollTop);setScrollAnchor(getAnchorForScrollTop(newScrollTop,offsets))}}},"scrollToItem"),hitTestScrollbar,scrollToScrollbarRow,getScrollIndex:__name(()=>scrollAnchor.index,"getScrollIndex"),getScrollState:__name(()=>{const maxScroll2=Math.max(0,totalHeight-scrollableContainerHeight);return{scrollTop:Math.min(getScrollTop(),maxScroll2),scrollHeight:totalHeight,innerHeight:scrollableContainerHeight}},"getScrollState"),getViewportRect:__name(()=>rootRef.current?measureElementPosition(rootRef.current):null,"getViewportRect")}),[offsets,scrollAnchor,totalHeight,getAnchorForScrollTop,data,scrollableContainerHeight,getScrollTop,setPendingScrollTop,hitTestScrollbar,scrollToScrollbarRow]);const showScrollbar=(props.showScrollbar??true)&&maxScroll>0;const{isVisible:scrollbarThumbActive,flashScrollbar}=useAnimatedScrollbar();const isInitialScrollFlash=(0,import_react11.useRef)(true);(0,import_react11.useLayoutEffect)(()=>{if(isInitialScrollFlash.current){isInitialScrollFlash.current=false;return}flashScrollbar()},[clampedScrollTop,flashScrollbar]);const scrollbarContent=(0,import_react11.useMemo)(()=>{if(!showScrollbar||scrollableContainerHeight<=0)return null;const trackLen=scrollableContainerHeight;const thumbLen=Math.max(1,Math.round(trackLen*trackLen/totalHeight));const thumbTop=Math.round(clampedScrollTop/maxScroll*(trackLen-thumbLen));return(0,import_jsx_runtime11.jsx)(Box_default,{width:1,flexDirection:"column",flexShrink:0,children:Array.from({length:trackLen},(_,i)=>{const inThumb=i>=thumbTop&&i<thumbTop+thumbLen;if(!scrollbarThumbActive){return(0,import_jsx_runtime11.jsx)(Text,{selectable:false,children:" "},i)}return(0,import_jsx_runtime11.jsx)(Text,{dimColor:!inThumb,selectable:false,children:inThumb?"\u2588":"\u2502"},i)})})},[showScrollbar,scrollableContainerHeight,totalHeight,clampedScrollTop,maxScroll,scrollbarThumbActive]);const rootHeight=props.containerHeight!==void 0?fullHeightMeasurementPending?props.containerHeight:Math.min(props.containerHeight,totalHeight):"100%";return(0,import_jsx_runtime11.jsxs)(Box_default,{ref:rootRef,width:"100%",height:rootHeight,flexDirection:"row",children:[(0,import_jsx_runtime11.jsx)(Box_default,{ref:containerRef,overflowY:"hidden",overflowX:"hidden",flexGrow:1,flexDirection:"column",children:(0,import_jsx_runtime11.jsxs)(Box_default,{flexShrink:0,width:"100%",flexDirection:"column",marginTop:-clampedScrollTop,children:[(0,import_jsx_runtime11.jsx)(Box_default,{height:topSpacerHeight,flexShrink:0}),renderedItems,(0,import_jsx_runtime11.jsx)(Box_default,{height:bottomSpacerHeight,flexShrink:0})]})}),scrollbarContent]})}__name(VirtualizedList,"VirtualizedList");var VirtualizedListWithForwardRef=(0,import_react11.forwardRef)(VirtualizedList);VirtualizedList.displayName="VirtualizedList";init_esbuild_shims();var import_react12=__toESM(require_react(),1);var SCROLL_FRAME_MS=16;function useFrameCoalescedFlush(flush,frameMs=SCROLL_FRAME_MS){const timer=(0,import_react12.useRef)(null);const flushRef=(0,import_react12.useRef)(flush);flushRef.current=flush;const run=(0,import_react12.useCallback)(()=>{timer.current=null;flushRef.current()},[]);const schedule=(0,import_react12.useCallback)(()=>{if(timer.current!==null)return;timer.current=setTimeout(run,frameMs)},[run,frameMs]);const cancel=(0,import_react12.useCallback)(()=>{if(timer.current!==null){clearTimeout(timer.current);timer.current=null}},[]);(0,import_react12.useEffect)(()=>cancel,[cancel]);return{schedule,cancel}}__name(useFrameCoalescedFlush,"useFrameCoalescedFlush");var import_jsx_runtime12=__toESM(require_jsx_runtime(),1);function ScrollableList(props,ref){const{hasFocus,...virtualizedListProps}=props;const virtualizedListRef=(0,import_react13.useRef)(null);const isDraggingScrollbar=(0,import_react13.useRef)(false);(0,import_react13.useImperativeHandle)(ref,()=>({scrollBy:__name(delta=>virtualizedListRef.current?.scrollBy(delta),"scrollBy"),scrollTo:__name(offset=>virtualizedListRef.current?.scrollTo(offset),"scrollTo"),scrollToEnd:__name(()=>virtualizedListRef.current?.scrollToEnd(),"scrollToEnd"),scrollToIndex:__name(params=>virtualizedListRef.current?.scrollToIndex(params),"scrollToIndex"),scrollToItem:__name(params=>virtualizedListRef.current?.scrollToItem(params),"scrollToItem"),hitTestScrollbar:__name(location=>virtualizedListRef.current?.hitTestScrollbar(location)??false,"hitTestScrollbar"),scrollToScrollbarRow:__name(row=>virtualizedListRef.current?.scrollToScrollbarRow(row),"scrollToScrollbarRow"),getScrollIndex:__name(()=>virtualizedListRef.current?.getScrollIndex()??0,"getScrollIndex"),getScrollState:__name(()=>virtualizedListRef.current?.getScrollState()??{scrollTop:0,scrollHeight:0,innerHeight:0},"getScrollState"),getViewportRect:__name(()=>virtualizedListRef.current?.getViewportRect()??null,"getViewportRect")}),[]);const getScrollState=(0,import_react13.useCallback)(()=>virtualizedListRef.current?.getScrollState()??{scrollTop:0,scrollHeight:0,innerHeight:0},[]);useKeypress((0,import_react13.useCallback)(key=>{if(keyMatchers["scrollUp"](key)){virtualizedListRef.current?.scrollBy(-1)}else if(keyMatchers["scrollDown"](key)){virtualizedListRef.current?.scrollBy(1)}else if(keyMatchers["pageUp"](key)){const state=getScrollState();const delta=state.innerHeight>0?state.innerHeight:20;virtualizedListRef.current?.scrollBy(-delta)}else if(keyMatchers["pageDown"](key)){const state=getScrollState();const delta=state.innerHeight>0?state.innerHeight:20;virtualizedListRef.current?.scrollBy(delta)}else if(keyMatchers["scrollHome"](key)){virtualizedListRef.current?.scrollTo(0)}else if(keyMatchers["scrollEnd"](key)){virtualizedListRef.current?.scrollToEnd()}},[getScrollState]),{isActive:hasFocus});const WHEEL_LINES_PER_TICK=3;const pendingWheelDelta=(0,import_react13.useRef)(0);const pendingDragRow=(0,import_react13.useRef)(null);const applyPendingScroll=(0,import_react13.useCallback)(()=>{const list=virtualizedListRef.current;const dragRow=pendingDragRow.current;const wheelDelta=pendingWheelDelta.current;pendingDragRow.current=null;pendingWheelDelta.current=0;if(!list)return;if(dragRow!==null){list.scrollToScrollbarRow(dragRow);return}if(wheelDelta!==0){list.scrollBy(wheelDelta)}},[]);const{schedule:scheduleScrollFlush,cancel:cancelScrollFlush}=useFrameCoalescedFlush(applyPendingScroll);const cancelPendingScroll=(0,import_react13.useCallback)(()=>{pendingWheelDelta.current=0;pendingDragRow.current=null;cancelScrollFlush()},[cancelScrollFlush]);(0,import_react13.useEffect)(()=>{if(!hasFocus)cancelPendingScroll()},[hasFocus,cancelPendingScroll]);const handleMouseEvent=(0,import_react13.useCallback)(event=>{if(!virtualizedListRef.current)return;if(event.name==="left-release"){isDraggingScrollbar.current=false;return}if(event.name==="left-press"){isDraggingScrollbar.current=virtualizedListRef.current.hitTestScrollbar(event);if(isDraggingScrollbar.current){cancelPendingScroll();virtualizedListRef.current.scrollToScrollbarRow(event.row)}return}if(event.name==="move"&&isDraggingScrollbar.current){pendingDragRow.current=event.row;scheduleScrollFlush();return}if(event.name==="scroll-up"){pendingWheelDelta.current-=WHEEL_LINES_PER_TICK;scheduleScrollFlush()}else if(event.name==="scroll-down"){pendingWheelDelta.current+=WHEEL_LINES_PER_TICK;scheduleScrollFlush()}},[scheduleScrollFlush,cancelPendingScroll]);useMouseEvents(handleMouseEvent,{isActive:hasFocus,bypassVpGate:true});return(0,import_jsx_runtime12.jsx)(VirtualizedListWithForwardRef,{ref:virtualizedListRef,...virtualizedListProps})}__name(ScrollableList,"ScrollableList");var ScrollableListWithForwardRef=(0,import_react13.forwardRef)(ScrollableList);init_esbuild_shims();var import_react14=__toESM(require_react(),1);init_esbuild_shims();var SelectionState=class{static{__name(this,"SelectionState")}anchor=null;focus=null;dragging=false;mode="char";start(point,mode="char"){this.anchor=point;this.focus=point;this.dragging=true;this.mode=mode}extend(point){if(this.anchor){this.focus=point}}finish(){this.dragging=false}clear(){this.anchor=null;this.focus=null;this.dragging=false;this.mode="char"}get isEmpty(){return this.anchor===null||this.focus===null}get isCollapsed(){return!this.isEmpty&&this.anchor.x===this.focus.x&&this.anchor.y===this.focus.y}get isBareClick(){return this.isCollapsed&&this.mode==="char"}normalized(){if(!this.anchor||!this.focus){return null}const{anchor,focus}=this;const anchorFirst=anchor.y<focus.y||anchor.y===focus.y&&anchor.x<=focus.x;const start=anchorFirst?anchor:focus;const end=anchorFirst?focus:anchor;return{sx:start.x,sy:start.y,ex:end.x,ey:end.y}}};init_esbuild_shims();function getSelectedText(frame,selection){if(!frame){return""}const{sx,sy,ex,ey}=selection;let text="";for(let y=sy;y<=ey;y++){const row=frame.cells[y];if(!row){if(y<ey){text+="\n"}continue}const startX=y===sy?sx:0;const endX=y===ey?ex:row.length-1;let rowText="";let skippedLayoutGap=false;for(let x=Math.max(0,startX);x<=endX&&x<row.length;x++){const cell=row[x];if(cell.selectable){if(skippedLayoutGap&&rowText.length>0&&cell.value!==""&&!/\s$/u.test(rowText)&&!/^\s/u.test(cell.value)){rowText+=" "}rowText+=cell.value;skippedLayoutGap=false}else if(rowText.length>0){skippedLayoutGap=true}}text+=rowText;if(y<ey){text+=boundaryJoiner(frame,selection,y)}}return text}__name(getSelectedText,"getSelectedText");function selectedFlows(frame,selection,y){const row=frame.cells[y]??[];const startX=y===selection.sy?selection.sx:0;const endX=y===selection.ey?selection.ex:row.length-1;const flows=new Set;for(let x=Math.max(0,startX);x<=endX&&x<row.length;x++){const cell=row[x];if(cell.selectable&&cell.flowId!==null){flows.add(cell.flowId)}}if(flows.size>0){return flows}for(const boundaryY of[y-1,y]){const boundaryRow=frame.boundaries[boundaryY]??[];for(let x=Math.max(0,startX);x<=endX&&x<boundaryRow.length;x++){const claim=boundaryRow[x];if(claim?.selectable){flows.add(claim.flowId)}}}return flows}__name(selectedFlows,"selectedFlows");function boundaryJoiner(frame,selection,y){const currentFlows=selectedFlows(frame,selection,y);const nextFlows=selectedFlows(frame,selection,y+1);const[currentFlow]=currentFlows;const[nextFlow]=nextFlows;if(currentFlows.size!==1||nextFlows.size!==1||currentFlow!==nextFlow){return"\n"}const flowId=currentFlow;const claims=(frame.boundaries[y]??[]).filter(claim=>claim!==null&&claim.selectable&&claim.flowId===flowId);if(claims.length===0){return"\n"}const first=claims[0];if(claims.some(claim=>claim.kind!==first.kind||claim.joiner!==first.joiner)){return"\n"}return first.kind==="soft"?first.joiner:"\n"}__name(boundaryJoiner,"boundaryJoiner");init_esbuild_shims();function isWordCell(value){return value!==""&&value!==" "&&!/^\s$/u.test(value)}__name(isWordCell,"isWordCell");function lastContentColumn(row,start,end){for(let x=end;x>=start;x--){if(row[x].value!==""&&row[x].value!==" "){return x}}return-1}__name(lastContentColumn,"lastContentColumn");function wordSpanAt(frame,x,y){const row=frame?.cells[y];if(!row){return null}const cell=row[x];if(!cell||!isWordCell(cell.value)){return null}let sx=x;while(sx>0&&(row[sx-1].value===""||isWordCell(row[sx-1].value))){sx--}let ex=x;while(ex<row.length-1&&(row[ex+1].value===""||isWordCell(row[ex+1].value))){ex++}return{sx,sy:y,ex,ey:y}}__name(wordSpanAt,"wordSpanAt");function selectableLineSpan(row,x,y){let start=x;while(start>0&&row[start-1].selectable){start--}let runEnd=x;while(runEnd<row.length-1&&row[runEnd+1].selectable){runEnd++}const contentEnd=lastContentColumn(row,start,runEnd);return{sx:start,sy:y,ex:contentEnd,ey:y}}__name(selectableLineSpan,"selectableLineSpan");function isSelectableContent(cell){return cell.selectable&&cell.value!==""&&cell.value!==" "}__name(isSelectableContent,"isSelectableContent");function lineSpanAt(frame,x,y){const row=frame?.cells[y];if(!row||row.length===0){return null}const origin=Math.max(0,Math.min(x,row.length-1));for(let distance=0;distance<row.length;distance++){const left=origin-distance;if(left>=0&&isSelectableContent(row[left])){return selectableLineSpan(row,left,y)}const right=origin+distance;if(distance>0&&right<row.length&&isSelectableContent(row[right])){return selectableLineSpan(row,right,y)}}return null}__name(lineSpanAt,"lineSpanAt");function spanAtForMode(frame,mode,point){return mode==="word"?wordSpanAt(frame,point.x,point.y):lineSpanAt(frame,point.x,point.y)}__name(spanAtForMode,"spanAtForMode");init_esbuild_shims();function terminalToGrid(col,row,terminalHeight,frameHeight){const anchor=frameAnchor(terminalHeight,frameHeight);return{x:col-1,y:row-1-anchor}}__name(terminalToGrid,"terminalToGrid");function snapWideChar(frame,point){const row=frame?.cells[point.y];if(point.x>0&&row?.[point.x]?.value===""&&row[point.x-1]?.fullWidth){return{...point,x:point.x-1}}return point}__name(snapWideChar,"snapWideChar");function pointInViewport(point,rect){return point.y>=rect.y&&point.y<rect.y+rect.height&&point.x>=rect.x&&point.x<rect.x+rect.width}__name(pointInViewport,"pointInViewport");function clampToViewport(point,rect){return{x:Math.max(rect.x,Math.min(rect.x+rect.width-1,point.x)),y:Math.max(rect.y,Math.min(rect.y+rect.height-1,point.y))}}__name(clampToViewport,"clampToViewport");var sameViewportContent=__name((previous,current,rect)=>{if(!previous){return false}for(let y=rect.y;y<rect.y+rect.height;y++){for(let x=rect.x;x<rect.x+rect.width;x++){const cell=previous.cells[y]?.[x];const currentCell=current.cells[y]?.[x];if(cell?.value!==currentCell?.value||cell?.fullWidth!==currentCell?.fullWidth){return false}}}return true},"sameViewportContent");var sameViewportRect=__name((previous,current)=>previous!==null&&current!==null&&previous.x===current.x&&previous.y===current.y&&previous.width===current.width&&previous.height===current.height,"sameViewportRect");var MULTI_CLICK_MS=400;var debugLogger2=createDebugLogger("TEXT_SELECTION");function TextSelectionController(props){const{stdout}=use_stdout_default();const selectionRef=(0,import_react14.useRef)(new SelectionState);const dragScrollTopRef=(0,import_react14.useRef)(null);const baselineScrollTopRef=(0,import_react14.useRef)(0);const baselineScrollHeightRef=(0,import_react14.useRef)(0);const baselineFrameRef=(0,import_react14.useRef)(null);const baselineRectRef=(0,import_react14.useRef)(null);const activeRectIndexRef=(0,import_react14.useRef)(null);const selectionGenerationRef=(0,import_react14.useRef)(0);const pendingInvalidationGenRef=(0,import_react14.useRef)(null);const lastClickRef=(0,import_react14.useRef)(null);const anchorSpanRef=(0,import_react14.useRef)(null);const bufferRef=(0,import_react14.useRef)(void 0);const propsRef=(0,import_react14.useRef)(props);propsRef.current=props;const getBuffer=(0,import_react14.useCallback)(()=>{if(!bufferRef.current){bufferRef.current=getScreenBuffer(stdout)}return bufferRef.current},[stdout]);const clearSelection=(0,import_react14.useCallback)(()=>{selectionGenerationRef.current+=1;activeRectIndexRef.current=null;const selection=selectionRef.current;anchorSpanRef.current=null;if(selection.isEmpty){return}selection.clear();getBuffer()?.setSelection(null)},[getBuffer]);const applyHighlight=(0,import_react14.useCallback)(()=>{const selection=selectionRef.current;const normalized=selection.normalized();getBuffer()?.setSelection(normalized&&!selection.isBareClick?normalized:null)},[getBuffer]);const getSelectableRects=(0,import_react14.useCallback)(()=>{const viewportRect=propsRef.current.getViewportRect();if(!viewportRect){return[]}const additionalRects=propsRef.current.getAdditionalSelectableRects?.()??[];return[viewportRect,...additionalRects]},[]);const getActiveRect=(0,import_react14.useCallback)(()=>{const index=activeRectIndexRef.current;return index===null?null:getSelectableRects()[index]??null},[getSelectableRects]);const recordBaseline=(0,import_react14.useCallback)(rect=>{const scrollState=propsRef.current.getScrollState();baselineScrollTopRef.current=scrollState.scrollTop;baselineScrollHeightRef.current=scrollState.scrollHeight;baselineFrameRef.current=getBuffer()?.frame??null;baselineRectRef.current=rect},[getBuffer]);const copySelection=(0,import_react14.useCallback)(()=>{const normalized=selectionRef.current.normalized();const text=normalized?getSelectedText(getBuffer()?.frame??null,normalized):"";if(text){void copyToClipboard(text).catch(error=>{debugLogger2.warn("Failed to copy selected text:",error)})}},[getBuffer]);const mapEvent=(0,import_react14.useCallback)(event=>{const buffer=getBuffer();if(!buffer){return null}const frameHeight=buffer.dimensions.height;const terminalHeight=stdout.rows??frameHeight;const point=terminalToGrid(event.col,event.row,terminalHeight,frameHeight);return snapWideChar(buffer.frame,point)},[getBuffer,stdout]);const extendSpanDrag=(0,import_react14.useCallback)(point=>{const anchor=anchorSpanRef.current;if(!anchor)return;const{span,mode}=anchor;const selection=selectionRef.current;const frame=getBuffer()?.frame??null;const current=spanAtForMode(frame,mode,point)??{sx:point.x,sy:point.y,ex:point.x,ey:point.y};const cursorAfter=point.y>span.ey||point.y===span.ey&&point.x>=span.ex;selection.anchor=cursorAfter?{x:span.sx,y:span.sy}:{x:span.ex,y:span.ey};selection.focus=cursorAfter?{x:current.ex,y:current.ey}:{x:current.sx,y:current.sy}},[getBuffer]);const extendActiveDrag=(0,import_react14.useCallback)(point=>{if(anchorSpanRef.current){extendSpanDrag(point)}else{selectionRef.current.extend(point)}},[extendSpanDrag]);const handleMouse=(0,import_react14.useCallback)(event=>{const selection=selectionRef.current;if(propsRef.current.eventsPaused){if(event.name==="left-release"){selection.finish()}return}if(event.name.startsWith("scroll-")){if(activeRectIndexRef.current===0){clearSelection()}return}if(event.name==="left-press"){selectionGenerationRef.current+=1;if(propsRef.current.hitTestScrollbar({col:event.col,row:event.row})){clearSelection();return}const point=mapEvent(event);const rects=getSelectableRects();const rectIndex=point?rects.findIndex(rect2=>pointInViewport(point,rect2)):-1;if(!point||rectIndex<0){clearSelection();return}const rect=rects[rectIndex];activeRectIndexRef.current=rectIndex;const now=Date.now();const prev=lastClickRef.current;const near=prev!=null&&prev.y===point.y&&Math.abs(prev.x-point.x)<=1&&now-prev.time<MULTI_CLICK_MS;const count=near?Math.min(prev.count+1,3):1;lastClickRef.current={x:point.x,y:point.y,time:now,count};if(count>=2){const frame=getBuffer()?.frame??null;const mode=count===2?"word":"line";const span=spanAtForMode(frame,mode,point);if(span){selection.start({x:span.sx,y:span.sy},mode);selection.extend({x:span.ex,y:span.ey});anchorSpanRef.current={span,mode};dragScrollTopRef.current=propsRef.current.getScrollState().scrollTop;recordBaseline(rect);applyHighlight();copySelection();return}}anchorSpanRef.current=null;selection.start(point);dragScrollTopRef.current=propsRef.current.getScrollState().scrollTop;recordBaseline(rect);applyHighlight();return}if(event.name==="move"){if(!selection.dragging){return}if(!anchorSpanRef.current){lastClickRef.current=null}if(activeRectIndexRef.current===0&&propsRef.current.getScrollState().scrollTop!==dragScrollTopRef.current){clearSelection();return}const point=mapEvent(event);const rect=getActiveRect();if(!point||!rect){clearSelection();return}extendActiveDrag(clampToViewport(point,rect));applyHighlight();return}if(event.name==="left-release"){if(!selection.dragging){return}if(pendingInvalidationGenRef.current===selectionGenerationRef.current){clearSelection();return}const point=mapEvent(event);const rect=getActiveRect();if(point&&rect){extendActiveDrag(clampToViewport(point,rect))}anchorSpanRef.current=null;selection.finish();if(selection.isEmpty||selection.isBareClick){clearSelection();return}applyHighlight();copySelection();return}},[clearSelection,applyHighlight,copySelection,recordBaseline,mapEvent,getBuffer,getSelectableRects,getActiveRect,extendActiveDrag]);useMouseEvents(handleMouse,{isActive:props.isActive,tracking:"button"});(0,import_react14.useEffect)(()=>{const buffer=getBuffer();if(!buffer){return}return buffer.subscribe(frame=>{if(selectionRef.current.isEmpty){return}const{scrollTop,scrollHeight}=propsRef.current.getScrollState();const activeRect=getActiveRect();const isViewportSelection=activeRectIndexRef.current===0;if(isViewportSelection&&(scrollTop!==baselineScrollTopRef.current||scrollHeight!==baselineScrollHeightRef.current)||!sameViewportRect(baselineRectRef.current,activeRect)||!sameViewportContent(baselineFrameRef.current,frame,activeRect)){const invalidatedGeneration=selectionGenerationRef.current;pendingInvalidationGenRef.current=invalidatedGeneration;queueMicrotask(()=>{pendingInvalidationGenRef.current=null;if(selectionGenerationRef.current===invalidatedGeneration){clearSelection()}})}})},[getBuffer,getActiveRect,clearSelection]);(0,import_react14.useEffect)(()=>{if(!props.isActive){clearSelection()}},[props.isActive,clearSelection]);(0,import_react14.useEffect)(()=>()=>getBuffer()?.setSelection(null),[getBuffer]);const selectionQueryRef=props.selectionQueryRef;(0,import_react14.useEffect)(()=>{if(!selectionQueryRef){return}selectionQueryRef.current={getRange:__name(()=>{const selection=selectionRef.current;if(selection.isEmpty||selection.isCollapsed&&selection.mode==="char"){return null}return selection.normalized()},"getRange")};return()=>{selectionQueryRef.current=null}},[selectionQueryRef]);return null}__name(TextSelectionController,"TextSelectionController");init_esbuild_shims();var import_react15=__toESM(require_react(),1);var debugLogger3=createDebugLogger("CONTENT_MOUSE");function ContentMouseController(props){const{stdout}=use_stdout_default();const{columns,rows}=useTerminalSize();const menu=useContextMenu();const bufferRef=(0,import_react15.useRef)(void 0);const pressRef=(0,import_react15.useRef)(null);const lastClickRef=(0,import_react15.useRef)(null);const pendingOpenRef=(0,import_react15.useRef)(null);const propsRef=(0,import_react15.useRef)(props);propsRef.current=props;const getBuffer=(0,import_react15.useCallback)(()=>{if(!bufferRef.current){bufferRef.current=getScreenBuffer(stdout)}return bufferRef.current},[stdout]);const mapPoint=(0,import_react15.useCallback)(event=>{const buffer=getBuffer();if(!buffer)return null;const frameHeight=buffer.dimensions.height;const terminalHeight=stdout.rows??frameHeight;const point=terminalToGrid(event.col,event.row,terminalHeight,frameHeight);return snapWideChar(buffer.frame,point)},[getBuffer,stdout]);const fallbackCopy=(0,import_react15.useCallback)(url=>{void copyToClipboard(url).then(()=>{console.warn(`Link copied to clipboard (not openable directly): ${url}`)}).catch(error=>{console.warn(`Unable to copy link to clipboard: ${url}`);debugLogger3.warn("Clipboard copy failed:",error)})},[]);const openLink=(0,import_react15.useCallback)(url=>{if(/^https?:\/\//i.test(url)){void openBrowserSecurely(url).catch(()=>fallbackCopy(url));return}fallbackCopy(url)},[fallbackCopy]);const cancelPendingOpen=(0,import_react15.useCallback)(()=>{const pending=pendingOpenRef.current;if(pending){clearTimeout(pending.timer);pendingOpenRef.current=null}},[]);const armPendingOpen=(0,import_react15.useCallback)(url=>{cancelPendingOpen();const timer=setTimeout(()=>{pendingOpenRef.current=null;openLink(url)},MULTI_CLICK_MS);pendingOpenRef.current={url,timer}},[cancelPendingOpen,openLink]);const handleMouse=(0,import_react15.useCallback)(event=>{if(event.name.endsWith("-press")||event.name.startsWith("scroll-")){cancelPendingOpen()}const openMenuState=menu.menu;if(openMenuState){const{position,items}=openMenuState;const size=contextMenuSize(items);const inMenu=__name(p=>p.x>=position.x&&p.x<position.x+size.width&&p.y>=position.y&&p.y<position.y+size.height,"inMenu");const itemIndexOf=__name(p=>p.y-position.y-1,"itemIndexOf");if(event.name==="move"){const p=mapPoint(event);if(p&&inMenu(p)){const index=itemIndexOf(p);if(index>=0&&index<items.length){menu.setSelectedIndex(index)}}return}if(event.name==="left-press"){const p=mapPoint(event);if(p&&inMenu(p)){const index=itemIndexOf(p);if(index>=0&&index<items.length){menu.executeIndex(index);return}}menu.closeMenu();return}if(event.name.startsWith("scroll-")){menu.closeMenu();return}if(event.name==="right-press"){menu.closeMenu()}else if(event.name.endsWith("-press")){menu.closeMenu();return}else{return}}if(event.name.startsWith("scroll-")){pressRef.current=null;lastClickRef.current=null;return}if(event.name==="move"&&event.button!=="none"){if(lastClickRef.current?.count===1){lastClickRef.current=null}const anchor=pressRef.current;if(anchor){const point2=mapPoint(event);if(!point2||point2.x!==anchor.x||point2.y!==anchor.y){pressRef.current=null}}return}const rect=propsRef.current.getViewportRect();if(!rect)return;if(propsRef.current.hitTestScrollbar({col:event.col,row:event.row})){return}const point=mapPoint(event);if(!point||!pointInViewport(point,rect))return;if(event.name==="right-press"){const frame=getBuffer()?.frame??null;const items=[];const url=hyperlinkAtCell(frame,point.x,point.y);if(url){items.push({id:"open-link",label:"Open Link",onSelect:__name(()=>openLink(url),"onSelect")});items.push({id:"copy-link",label:"Copy Link Address",onSelect:__name(()=>{void copyToClipboard(url).catch(error=>{debugLogger3.warn("Failed to copy link address:",error)})},"onSelect")})}const range=propsRef.current.selectionQueryRef?.current?.getRange();if(range){const selectionText=getSelectedText(frame,range);if(selectionText){items.push({id:"copy-selection",label:"Copy Selection",onSelect:__name(()=>{void copyToClipboard(selectionText).catch(error=>{debugLogger3.warn("Failed to copy selected text:",error)})},"onSelect")})}}if(items.length===0)return;const frameHeight=getBuffer()?.dimensions.height??rows;const visibleTop=Math.max(0,frameHeight-rows);const position=clampMenuPosition({x:point.x,y:Math.max(point.y,visibleTop)},contextMenuSize(items),columns,frameHeight);menu.openMenu(items,position);return}if(event.name==="left-press"){pressRef.current=point;const now=Date.now();const prev=lastClickRef.current;const near=prev!=null&&prev.y===point.y&&Math.abs(prev.x-point.x)<=1&&now-prev.time<MULTI_CLICK_MS;lastClickRef.current={x:point.x,y:point.y,time:now,count:near?Math.min(prev.count+1,3):1};return}if(event.name==="left-release"){const press=pressRef.current;pressRef.current=null;if(!press||press.x!==point.x||press.y!==point.y)return;if(lastClickRef.current?.count!==1)return;const url=hyperlinkAtCell(getBuffer()?.frame??null,point.x,point.y);if(url){armPendingOpen(url)}return}},[menu,mapPoint,getBuffer,openLink,armPendingOpen,cancelPendingOpen,columns,rows]);useMouseEvents(handleMouse,{isActive:props.isActive,tracking:menu.menu!==null?"any":"button"});const{closeMenu}=menu;const isActive=props.isActive;(0,import_react15.useEffect)(()=>{if(!isActive){closeMenu();cancelPendingOpen()}return()=>{closeMenu();cancelPendingOpen()}},[isActive,closeMenu,cancelPendingOpen]);const prevSizeRef=(0,import_react15.useRef)({columns,rows});(0,import_react15.useEffect)(()=>{const prev=prevSizeRef.current;prevSizeRef.current={columns,rows};if(prev.columns!==columns||prev.rows!==rows){closeMenu()}},[columns,rows,closeMenu]);return null}__name(ContentMouseController,"ContentMouseController");var import_jsx_runtime13=__toESM(require_jsx_runtime(),1);var MAX_GEMINI_MESSAGE_LINES=65536;function createEmptySourceCopyOffsets(){return{codeBlockLanguageCounts:new Map,mathBlockCount:0}}__name(createEmptySourceCopyOffsets,"createEmptySourceCopyOffsets");function cloneSourceCopyOffsets(offsets){return{codeBlockLanguageCounts:new Map(offsets.codeBlockLanguageCounts),mathBlockCount:offsets.mathBlockCount}}__name(cloneSourceCopyOffsets,"cloneSourceCopyOffsets");function addSourceBlockCounts(offsets,text){const counts=countMarkdownSourceBlocks(text);for(const[lang,count]of counts.codeBlockLanguageCounts){const current=offsets.codeBlockLanguageCounts.get(lang)??0;offsets.codeBlockLanguageCounts.set(lang,current+count)}offsets.mathBlockCount+=counts.mathBlockCount}__name(addSourceBlockCounts,"addSourceBlockCounts");var PROGRESSIVE_REPLAY_THRESHOLD=100;var PROGRESSIVE_REPLAY_CHUNK_SIZE=50;function initialReplayCount(length){return length<=PROGRESSIVE_REPLAY_THRESHOLD?length:Math.min(PROGRESSIVE_REPLAY_CHUNK_SIZE,length)}__name(initialReplayCount,"initialReplayCount");var VirtualHistoryItem=(0,import_react16.memo)(HistoryItemDisplay);var VP_BANNER_ID=Number.MIN_SAFE_INTEGER;var VP_BANNER_ITEM={type:"vp-banner",id:VP_BANNER_ID};var virtualEstimatedItemHeight=__name(index=>index===0?10:3,"virtualEstimatedItemHeight");var virtualKeyExtractor=__name(item=>item.type==="vp-banner"?"vp-banner":item.id>=0?`h-${item.id}`:`p-${-item.id-1}`,"virtualKeyExtractor");var virtualIsStaticItem=__name(item=>item.type==="vp-banner"||item.id>0,"virtualIsStaticItem");var MainContent=__name(({footerRef,scrollActionsRef})=>{const{version}=useAppContext();const uiState=useUIState();const{allExpanded:fullDetail}=useThoughtExpanded();const streamingState=uiState.streamingState;const showScrollbar=uiState.showScrollbar??true;const{pendingHistoryItems,terminalWidth,mainAreaWidth,staticAreaMaxItemHeight,availableTerminalHeight,historyRemountKey}=uiState;const visibleHistory=(0,import_react16.useMemo)(()=>uiState.history.filter(isHistoryItemVisibleAfterRestore),[uiState.history]);const useVirtualScroll=uiState.useTerminalBuffer;const scrollRef=(0,import_react16.useRef)(null);const selectionQueryRef=(0,import_react16.useRef)(null);const{menu:contextMenuOpen}=useContextMenu();(0,import_react16.useEffect)(()=>{if(!scrollActionsRef)return;scrollActionsRef.current={scrollBy:__name(delta=>scrollRef.current?.scrollBy(delta),"scrollBy"),hasScrollableTranscript:__name(()=>{const state=scrollRef.current?.getScrollState();return!!state&&state.innerHeight>0&&state.scrollHeight>state.innerHeight},"hasScrollableTranscript")};return()=>{scrollActionsRef.current=null}},[scrollActionsRef]);const{historyItemsWithSourceCopyOffsets,pendingStartSourceCopyOffsets}=(0,import_react16.useMemo)(()=>{let runningOffsets=createEmptySourceCopyOffsets();const items=visibleHistory.map(item=>{if(item.type==="gemini"){runningOffsets=createEmptySourceCopyOffsets();const offsets=cloneSourceCopyOffsets(runningOffsets);addSourceBlockCounts(runningOffsets,item.text);return{item,sourceCopyIndexOffsets:offsets}}if(item.type==="gemini_content"){const offsets=cloneSourceCopyOffsets(runningOffsets);addSourceBlockCounts(runningOffsets,item.text);return{item,sourceCopyIndexOffsets:offsets}}if(item.type==="user"&&item.sentToModel!==false){runningOffsets=createEmptySourceCopyOffsets()}return{item,sourceCopyIndexOffsets:void 0}});return{historyItemsWithSourceCopyOffsets:items,pendingStartSourceCopyOffsets:cloneSourceCopyOffsets(runningOffsets)}},[visibleHistory]);const pendingHistoryItemsWithSourceCopyOffsets=(0,import_react16.useMemo)(()=>{let runningOffsets=cloneSourceCopyOffsets(pendingStartSourceCopyOffsets);return pendingHistoryItems.map(item=>{if(item.type==="gemini"){runningOffsets=createEmptySourceCopyOffsets();const offsets=cloneSourceCopyOffsets(runningOffsets);addSourceBlockCounts(runningOffsets,item.text);return{item,sourceCopyIndexOffsets:offsets}}if(item.type==="gemini_content"){const offsets=cloneSourceCopyOffsets(runningOffsets);addSourceBlockCounts(runningOffsets,item.text);return{item,sourceCopyIndexOffsets:offsets}}if(item.type==="user"&&item.sentToModel!==false){runningOffsets=createEmptySourceCopyOffsets()}return{item,sourceCopyIndexOffsets:void 0}})},[pendingHistoryItems,pendingStartSourceCopyOffsets]);const[replayCount,setReplayCount]=(0,import_react16.useState)(()=>initialReplayCount(visibleHistory.length));const visibleHistoryLengthRef=(0,import_react16.useRef)(visibleHistory.length);visibleHistoryLengthRef.current=visibleHistory.length;const[lastRemountKey,setLastRemountKey]=(0,import_react16.useState)(historyRemountKey);if(lastRemountKey!==historyRemountKey){setLastRemountKey(historyRemountKey);if(!useVirtualScroll){setReplayCount(initialReplayCount(visibleHistoryLengthRef.current))}}(0,import_react16.useEffect)(()=>{if(useVirtualScroll)return;if(replayCount>=visibleHistory.length)return;const remaining=visibleHistory.length-replayCount;if(remaining<=PROGRESSIVE_REPLAY_CHUNK_SIZE){setReplayCount(visibleHistory.length);return}const handle=setImmediate(()=>{setReplayCount(c=>Math.min(c+PROGRESSIVE_REPLAY_CHUNK_SIZE,visibleHistoryLengthRef.current))});return()=>clearImmediate(handle)},[useVirtualScroll,replayCount,visibleHistory.length]);const visibleHistoryItemsWithSourceCopyOffsets=historyItemsWithSourceCopyOffsets.length-replayCount<=PROGRESSIVE_REPLAY_CHUNK_SIZE?historyItemsWithSourceCopyOffsets:historyItemsWithSourceCopyOffsets.slice(0,replayCount);const allVirtualItems=(0,import_react16.useMemo)(()=>{const combined=[VP_BANNER_ITEM,...visibleHistory,...pendingHistoryItems.map((item,i)=>({...item,id:-(i+1)}))];const livePendingBatchIds=new Set;for(const item of pendingHistoryItems){if(item.type==="tool_group"&&item.batchId!==void 0){livePendingBatchIds.add(item.batchId)}}if(livePendingBatchIds.size===0)return combined;const dropped=new Set;const committedByBatchId=new Map;const keptPendingByBatchId=new Map;for(const item of combined){if(item.type!=="tool_group"||item.batchId===void 0||!livePendingBatchIds.has(item.batchId)){continue}if(item.id>0){committedByBatchId.set(item.batchId,item)}else{const kept=keptPendingByBatchId.get(item.batchId);if(kept)dropped.add(kept);keptPendingByBatchId.set(item.batchId,item)}}for(const item of committedByBatchId.values())dropped.add(item);if(dropped.size===0)return combined;return combined.filter(item=>!dropped.has(item))},[visibleHistory,pendingHistoryItems]);const sourceCopyOffsetsByHistoryItem=(0,import_react16.useMemo)(()=>{const map=new Map;for(const{item,sourceCopyIndexOffsets}of historyItemsWithSourceCopyOffsets){if(sourceCopyIndexOffsets){map.set(item,sourceCopyIndexOffsets)}}return map},[historyItemsWithSourceCopyOffsets]);const thoughtHeadIdByItem=(0,import_react16.useMemo)(()=>buildThoughtHeadIdMap(visibleHistory),[visibleHistory]);const thoughtHeadIdByItemRef=(0,import_react16.useRef)(thoughtHeadIdByItem);thoughtHeadIdByItemRef.current=thoughtHeadIdByItem;const pendingSourceCopyOffsetsByIndex=(0,import_react16.useMemo)(()=>pendingHistoryItemsWithSourceCopyOffsets.map(({sourceCopyIndexOffsets})=>sourceCopyIndexOffsets),[pendingHistoryItemsWithSourceCopyOffsets]);const pendingStateRef=(0,import_react16.useRef)({activePtyId:uiState.activePtyId,embeddedShellFocused:uiState.embeddedShellFocused,isEditorDialogOpen:uiState.isEditorDialogOpen});pendingStateRef.current={activePtyId:uiState.activePtyId,embeddedShellFocused:uiState.embeddedShellFocused,isEditorDialogOpen:uiState.isEditorDialogOpen};const pendingAvailableTerminalHeight=pendingHistoryItems.length>0&&uiState.constrainHeight?availableTerminalHeight:void 0;const hasPendingPlainTextConfirmation=pendingHistoryItems.some(item=>item.type==="tool_group"&&item.tools.some(tool=>tool.status==="Confirming"&&tool.confirmationDetails?.type==="info"&&tool.confirmationDetails.renderPromptAsPlainText===true));const pendingSourceCopyOffsetsRef=(0,import_react16.useRef)(pendingSourceCopyOffsetsByIndex);pendingSourceCopyOffsetsRef.current=pendingSourceCopyOffsetsByIndex;const renderVirtualItem=(0,import_react16.useCallback)(({item})=>{if(item.type==="vp-banner"){return(0,import_jsx_runtime13.jsxs)(Box_default,{flexDirection:"column",children:[(0,import_jsx_runtime13.jsx)(AppHeader,{version}),(0,import_jsx_runtime13.jsx)(DebugModeNotification,{}),(0,import_jsx_runtime13.jsx)(Notifications,{})]})}const isPending=item.id<0;const sourceCopyIndexOffsets=isPending?pendingSourceCopyOffsetsRef.current[-item.id-1]:sourceCopyOffsetsByHistoryItem.get(item);if(isPending){const ps=pendingStateRef.current;return(0,import_jsx_runtime13.jsx)(VirtualHistoryItem,{terminalWidth,mainAreaWidth,availableTerminalHeight:pendingAvailableTerminalHeight,item:{...item,id:0},isPending:true,isFocused:!ps.isEditorDialogOpen,activeShellPtyId:ps.activePtyId,embeddedShellFocused:ps.embeddedShellFocused,commands:uiState.slashCommands,sourceCopyIndexOffsets,fullDetail})}return(0,import_jsx_runtime13.jsx)(VirtualHistoryItem,{terminalWidth,mainAreaWidth,availableTerminalHeight:uiState.constrainHeight?staticAreaMaxItemHeight:void 0,availableTerminalHeightLlm:uiState.constrainHeight?MAX_GEMINI_MESSAGE_LINES:void 0,item,isPending:false,commands:uiState.slashCommands,sourceCopyIndexOffsets,thoughtHeadId:thoughtHeadIdByItemRef.current.get(item),fullDetail})},[version,terminalWidth,mainAreaWidth,staticAreaMaxItemHeight,uiState.slashCommands,sourceCopyOffsetsByHistoryItem,fullDetail,pendingAvailableTerminalHeight,uiState.constrainHeight]);if(useVirtualScroll){const scrollContainerHeight=Math.max(0,uiState.availableTerminalHeight??0);const viewportInteractive=!uiState.dialogsVisible&&contextMenuOpen===null;return(0,import_jsx_runtime13.jsxs)(OverflowProvider,{children:[(0,import_jsx_runtime13.jsx)(ScrollableListWithForwardRef,{ref:scrollRef,hasFocus:viewportInteractive,data:allVirtualItems,renderItem:renderVirtualItem,estimatedItemHeight:virtualEstimatedItemHeight,keyExtractor:virtualKeyExtractor,initialScrollIndex:allVirtualItems.length<=1?0:SCROLL_TO_ITEM_END,isStaticItem:virtualIsStaticItem,containerHeight:scrollContainerHeight,measureAtFullHeight:hasPendingPlainTextConfirmation,showScrollbar}),(0,import_jsx_runtime13.jsx)(TextSelectionController,{isActive:!uiState.dialogsVisible,eventsPaused:contextMenuOpen!==null,getViewportRect:()=>scrollRef.current?.getViewportRect()??null,getAdditionalSelectableRects:()=>footerRef?.current?[measureElementPosition(footerRef.current)]:[],getScrollState:()=>scrollRef.current?.getScrollState()??{scrollTop:0,scrollHeight:0,innerHeight:0},hitTestScrollbar:location=>scrollRef.current?.hitTestScrollbar(location)??false,selectionQueryRef}),(0,import_jsx_runtime13.jsx)(ContentMouseController,{isActive:!uiState.dialogsVisible,getViewportRect:()=>scrollRef.current?.getViewportRect()??null,hitTestScrollbar:location=>scrollRef.current?.hitTestScrollbar(location)??false,selectionQueryRef}),(0,import_jsx_runtime13.jsx)(ShowMoreLines,{constrainHeight:uiState.constrainHeight})]})}return(0,import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment,{children:[(0,import_jsx_runtime13.jsx)(Static,{items:[(0,import_jsx_runtime13.jsx)(AppHeader,{version},"app-header"),(0,import_jsx_runtime13.jsx)(DebugModeNotification,{},"debug-notification"),(0,import_jsx_runtime13.jsx)(Notifications,{},"notifications"),...visibleHistoryItemsWithSourceCopyOffsets.map(({item:h,sourceCopyIndexOffsets})=>(0,import_jsx_runtime13.jsx)(HistoryItemDisplay,{terminalWidth,mainAreaWidth,availableTerminalHeight:staticAreaMaxItemHeight,availableTerminalHeightLlm:MAX_GEMINI_MESSAGE_LINES,item:h,isPending:false,commands:uiState.slashCommands,sourceCopyIndexOffsets,thoughtHeadId:thoughtHeadIdByItem.get(h),fullDetail},h.id))],children:item=>item},`${historyRemountKey}-${uiState.currentModel}`),(0,import_jsx_runtime13.jsx)(OverflowProvider,{children:(0,import_jsx_runtime13.jsxs)(Box_default,{flexDirection:"column",children:[(0,import_jsx_runtime13.jsx)(Box_default,{flexDirection:"column",flexShrink:0,maxHeight:uiState.constrainHeight||streamingState==="responding"?availableTerminalHeight||void 0:void 0,overflow:"hidden",children:pendingHistoryItemsWithSourceCopyOffsets.map(({item,sourceCopyIndexOffsets},i)=>(0,import_jsx_runtime13.jsx)(HistoryItemDisplay,{availableTerminalHeight:uiState.constrainHeight?availableTerminalHeight:void 0,terminalWidth,mainAreaWidth,item:{...item,id:0},isPending:true,isFocused:!uiState.isEditorDialogOpen,activeShellPtyId:uiState.activePtyId,embeddedShellFocused:uiState.embeddedShellFocused,sourceCopyIndexOffsets,fullDetail},i))}),(0,import_jsx_runtime13.jsx)(ShowMoreLines,{constrainHeight:uiState.constrainHeight})]})})]})},"MainContent");init_esbuild_shims();init_esbuild_shims();var import_jsx_runtime14=__toESM(require_jsx_runtime(),1);function LoopDetectionConfirmation({cause,onComplete}){useKeypress(key=>{if(key.name==="escape"){onComplete({userSelection:"keep"})}},{isActive:true});const quotedCause=cause?.replace(/`([^`]+)`/g,'"$1"');const OPTIONS=[{label:"Keep loop detection enabled (esc)",value:{userSelection:"keep"},key:"Keep loop detection enabled (esc)"},{label:"Disable loop detection for this session",value:{userSelection:"disable"},key:"Disable loop detection for this session"}];return(0,import_jsx_runtime14.jsx)(Box_default,{flexDirection:"column",borderStyle:"round",borderColor:theme.status.warning,width:"100%",marginLeft:1,children:(0,import_jsx_runtime14.jsxs)(Box_default,{paddingX:1,paddingY:0,flexDirection:"column",children:[(0,import_jsx_runtime14.jsxs)(Box_default,{minHeight:1,children:[(0,import_jsx_runtime14.jsx)(Box_default,{minWidth:3,children:(0,import_jsx_runtime14.jsx)(Text,{color:theme.status.warning,"aria-label":"Loop detected:",children:"?"})}),(0,import_jsx_runtime14.jsx)(Box_default,{children:(0,import_jsx_runtime14.jsxs)(Text,{wrap:"truncate-end",children:[(0,import_jsx_runtime14.jsx)(Text,{color:theme.text.primary,bold:true,children:"A potential loop was detected"})," "]})})]}),(0,import_jsx_runtime14.jsx)(Box_default,{width:"100%",marginTop:1,children:(0,import_jsx_runtime14.jsxs)(Box_default,{flexDirection:"column",children:[quotedCause&&(0,import_jsx_runtime14.jsxs)(Text,{color:theme.text.primary,children:["Cause: ",quotedCause,"."]}),(0,import_jsx_runtime14.jsx)(Text,{color:theme.text.secondary,children:"This can happen due to repetitive tool calls or other model behavior. Do you want to keep loop detection enabled or disable it for this session?"}),(0,import_jsx_runtime14.jsx)(Box_default,{marginTop:1,children:(0,import_jsx_runtime14.jsx)(RadioButtonSelect,{items:OPTIONS,onSelect:onComplete})}),(0,import_jsx_runtime14.jsx)(Box_default,{marginTop:1,children:(0,import_jsx_runtime14.jsx)(Text,{color:theme.text.secondary,children:'Note: Setting "model.loopProtection" in your settings.json to "warn" reminds the model instead of stopping, and "off" turns loop protection off, for future sessions. "model.skipLoopDetection" disables only the heuristic loop checks. The tool-call budget is tunable via "model.maxToolCallsPerTurn" (0 disables it). Disabling for this session above suppresses everything.'})})]})})]})})}__name(LoopDetectionConfirmation,"LoopDetectionConfirmation");init_esbuild_shims();var import_jsx_runtime15=__toESM(require_jsx_runtime(),1);var SHELL_CONFIRMATION_FIXED_ROWS=9;var MIN_HEIGHT_WITH_HIDDEN_COMMAND_OPTIONS=8;var ShellConfirmationDialog=__name(({request,availableTerminalHeight,contentWidth=80})=>{const{commands,onConfirm}=request;const constrainedHeight=clampDialogHeight(availableTerminalHeight);const commandPreviewHeight=constrainedHeight===void 0?void 0:constrainedHeight>=SHELL_CONFIRMATION_FIXED_ROWS+2?Math.max(2,constrainedHeight-SHELL_CONFIRMATION_FIXED_ROWS):0;const commandsHidden=constrainedHeight!==void 0&&commandPreviewHeight===0&&commands.length>0;const commandApprovalUnavailable=commandsHidden&&constrainedHeight!==void 0&&constrainedHeight<MIN_HEIGHT_WITH_HIDDEN_COMMAND_OPTIONS;const compactHiddenCommandsLayout=commandsHidden&&constrainedHeight<=SHELL_CONFIRMATION_FIXED_ROWS;useKeypress(key=>{if(key.name==="escape"){onConfirm("cancel")}},{isActive:true});const handleSelect=__name(item=>{if(item==="cancel"){onConfirm(item)}else{onConfirm(item,commands)}},"handleSelect");const options=[{label:t("Yes, allow once"),value:"proceed_once",key:"Yes, allow once"},{label:t("Always allow in this project"),value:"proceed_always_project",key:"Always allow in this project"},{label:t("Always allow for this user"),value:"proceed_always_user",key:"Always allow for this user"},{label:t("No (esc)"),value:"cancel",key:"No (esc)"}];const visibleOptions=commandApprovalUnavailable?options.filter(option=>option.value==="cancel"):options;return(0,import_jsx_runtime15.jsxs)(Box_default,{flexDirection:"column",borderStyle:"round",borderColor:theme.status.warning,paddingX:1,paddingY:constrainedHeight===void 0?1:0,width:"100%",marginLeft:1,height:constrainedHeight,overflow:"hidden",children:[(0,import_jsx_runtime15.jsx)(Text,{bold:true,color:theme.text.primary,wrap:"truncate",children:t("Shell Command Execution")}),!compactHiddenCommandsLayout&&(0,import_jsx_runtime15.jsx)(Text,{color:theme.text.primary,wrap:"truncate",children:t("A custom command wants to run the following shell commands:")}),constrainedHeight===void 0?(0,import_jsx_runtime15.jsx)(Box_default,{flexDirection:"column",marginTop:1,marginBottom:1,flexShrink:1,children:(0,import_jsx_runtime15.jsx)(Box_default,{flexDirection:"column",borderStyle:"round",borderColor:theme.border.default,paddingX:1,children:commands.map(cmd=>(0,import_jsx_runtime15.jsx)(Text,{color:theme.text.link,children:cmd},cmd))})}):commandPreviewHeight!==void 0&&commandPreviewHeight>0?(0,import_jsx_runtime15.jsx)(Box_default,{flexDirection:"column",flexShrink:1,children:(0,import_jsx_runtime15.jsx)(MaxSizedBox,{maxHeight:commandPreviewHeight,maxWidth:Math.max(1,contentWidth-8),overflowDirection:"top",children:commands.map(cmd=>(0,import_jsx_runtime15.jsx)(Box_default,{children:(0,import_jsx_runtime15.jsx)(Text,{color:theme.text.link,children:cmd})},cmd))})}):commandsHidden?(0,import_jsx_runtime15.jsxs)(Text,{color:theme.status.warning,wrap:"truncate",children:[commands.length," ",t("shell commands hidden - resize terminal to review")]}):null,!compactHiddenCommandsLayout&&(0,import_jsx_runtime15.jsx)(Box_default,{marginBottom:constrainedHeight===void 0?1:0,flexShrink:0,children:(0,import_jsx_runtime15.jsx)(Text,{color:theme.text.primary,children:t("Do you want to proceed?")})}),(0,import_jsx_runtime15.jsx)(Box_default,{flexShrink:0,children:(0,import_jsx_runtime15.jsx)(RadioButtonSelect,{items:visibleOptions,onSelect:handleSelect,isFocused:true})})]})},"ShellConfirmationDialog");init_esbuild_shims();var import_react17=__toESM(require_react(),1);var import_jsx_runtime16=__toESM(require_jsx_runtime(),1);var CONSENT_PROMPT_CHROME_ROWS=7;var ConsentPrompt=__name(props=>{const{prompt,onConfirm,terminalWidth,availableTerminalHeight}=props;const constrainedHeight=clampDialogHeight(availableTerminalHeight);const availablePromptRows=constrainedHeight===void 0?void 0:Math.max(1,constrainedHeight-CONSENT_PROMPT_CHROME_ROWS);const showPromptTruncationNotice=typeof prompt==="string"&&availablePromptRows!==void 0&&availablePromptRows<=2;const promptHeight=availablePromptRows===void 0?void 0:Math.max(1,availablePromptRows-(showPromptTruncationNotice?1:0));return(0,import_jsx_runtime16.jsxs)(Box_default,{borderStyle:"round",borderColor:theme.border.default,flexDirection:"column",paddingY:1,paddingX:2,height:constrainedHeight,overflow:"hidden",children:[(0,import_jsx_runtime16.jsx)(Box_default,{flexDirection:"column",flexShrink:1,overflow:"hidden",children:typeof prompt==="string"?(0,import_jsx_runtime16.jsx)(MarkdownDisplay,{isPending:true,text:prompt,contentWidth:terminalWidth,...promptHeight!==void 0?{availableTerminalHeight:promptHeight}:{}}):prompt}),showPromptTruncationNotice&&(0,import_jsx_runtime16.jsx)(Text,{color:theme.text.secondary,wrap:"truncate",children:t("Content truncated - resize terminal to review")}),(0,import_jsx_runtime16.jsx)(Box_default,{marginTop:1,flexShrink:0,children:(0,import_jsx_runtime16.jsx)(RadioButtonSelect,{items:[{label:"Yes",value:true,key:"Yes"},{label:"No",value:false,key:"No"}],onSelect:onConfirm})})]})},"ConsentPrompt");init_esbuild_shims();var import_react18=__toESM(require_react(),1);var import_jsx_runtime17=__toESM(require_jsx_runtime(),1);var ProviderDiffSection=__name(({entry})=>{const{providerLabel,diff}=entry;const hasModelChanges=diff.added.length>0||diff.removed.length>0;return(0,import_jsx_runtime17.jsxs)(Box_default,{flexDirection:"column",children:[(0,import_jsx_runtime17.jsx)(Text,{bold:true,color:theme.text.secondary,children:providerLabel}),hasModelChanges?(0,import_jsx_runtime17.jsxs)(Box_default,{flexDirection:"column",children:[diff.added.map(model=>(0,import_jsx_runtime17.jsxs)(Text,{color:theme.status.success,children:[" + ",model]},model)),diff.removed.map(model=>(0,import_jsx_runtime17.jsxs)(Text,{color:theme.status.error,children:[" - ",model]},model))]}):(0,import_jsx_runtime17.jsxs)(Text,{color:theme.text.secondary,children:[" ",t("Model parameters updated (context window, capabilities, etc.)")]})]})},"ProviderDiffSection");var ProviderUpdatePrompt=__name(({entries,onConfirm})=>{const handleKeypress=(0,import_react18.useCallback)(key=>{if(key.name==="escape"){onConfirm("later")}},[onConfirm]);useKeypress(handleKeypress,{isActive:true});const affectedEntry=entries.find(e=>e.diff.currentModelAffected);const title=entries.length===1?t("Built-in Provider Update \xB7 {{provider}}",{provider:entries[0].providerLabel}):t("Built-in Provider Updates");return(0,import_jsx_runtime17.jsxs)(Box_default,{borderStyle:"round",borderColor:theme.border.default,flexDirection:"column",paddingY:1,paddingX:2,children:[(0,import_jsx_runtime17.jsx)(Text,{bold:true,children:title}),(0,import_jsx_runtime17.jsx)(Box_default,{flexDirection:"column",marginTop:1,gap:1,children:entries.map(entry=>(0,import_jsx_runtime17.jsx)(ProviderDiffSection,{entry},entry.providerLabel))}),(0,import_jsx_runtime17.jsxs)(Box_default,{flexDirection:"column",marginTop:1,children:[affectedEntry&&(0,import_jsx_runtime17.jsx)(Text,{color:theme.status.warning,children:t("Note: Your selected model is being removed. Please choose a new one with /model.")}),(0,import_jsx_runtime17.jsx)(Text,{color:theme.text.secondary,children:t("Tips: Your credentials will not be modified.")})]}),(0,import_jsx_runtime17.jsx)(Box_default,{marginTop:1,children:(0,import_jsx_runtime17.jsx)(RadioButtonSelect,{items:[{label:t("Update all"),value:"update",key:"update"},{label:t("Skip this version"),value:"skip",key:"skip"},{label:t("Remind me later (esc)"),value:"later",key:"later"}],onSelect:onConfirm})})]})},"ProviderUpdatePrompt");init_esbuild_shims();var import_react19=__toESM(require_react(),1);var import_jsx_runtime18=__toESM(require_jsx_runtime(),1);var isPrintableAscii=__name(character=>{const charCode=character.charCodeAt(0);return charCode>=32&&charCode<=126},"isPrintableAscii");var PasswordInput=__name(({value,onChange,onSubmit,placeholder})=>{useKeypress(key=>{if(key.paste){const pastedValue=key.sequence.split("").filter(isPrintableAscii).join("");if(pastedValue){onChange(value+pastedValue)}return}if(key.name==="return"){onSubmit();return}if(key.name==="backspace"||key.name==="delete"){onChange(value.slice(0,-1));return}if(key.ctrl&&key.name==="u"){onChange("");return}if(key.sequence&&!key.ctrl&&!key.meta&&key.sequence.length===1){if(isPrintableAscii(key.sequence)){onChange(value+key.sequence)}}},{isActive:true});const maskedValue="*".repeat(value.length);const displayValue=maskedValue||"";const cursorChar=renderSoftwareCursor(" ");return(0,import_jsx_runtime18.jsxs)(Box_default,{children:[(0,import_jsx_runtime18.jsx)(Text,{color:theme.text.accent,children:"> "}),value.length===0?(0,import_jsx_runtime18.jsxs)(Text,{children:[cursorChar,(0,import_jsx_runtime18.jsx)(Text,{dimColor:true,children:placeholder.slice(1)})]}):(0,import_jsx_runtime18.jsxs)(Text,{children:[displayValue,cursorChar]})]})},"PasswordInput");var SettingInputPrompt=__name(props=>{const{settingName,settingDescription,sensitive,onSubmit,onCancel,terminalWidth}=props;const[value,setValue]=(0,import_react19.useState)("");useKeypress(key=>{if(key.name==="escape"){onCancel()}},{isActive:true});const handleSubmit=__name(()=>{if(value.trim()){onSubmit(value)}},"handleSubmit");return(0,import_jsx_runtime18.jsxs)(Box_default,{borderStyle:"round",borderColor:theme.border.default,flexDirection:"column",paddingY:1,paddingX:2,children:[(0,import_jsx_runtime18.jsx)(Text,{bold:true,color:theme.text.accent,children:settingName}),(0,import_jsx_runtime18.jsx)(Box_default,{marginTop:1,children:(0,import_jsx_runtime18.jsx)(Text,{children:settingDescription})}),(0,import_jsx_runtime18.jsx)(Box_default,{marginTop:1,flexDirection:"column",children:sensitive?(0,import_jsx_runtime18.jsx)(PasswordInput,{value,onChange:setValue,onSubmit:handleSubmit,placeholder:t("Enter sensitive value...")}):(0,import_jsx_runtime18.jsx)(TextInput,{value,onChange:setValue,onSubmit:handleSubmit,placeholder:t("Enter value..."),inputWidth:Math.min(terminalWidth-10,60),isActive:true})}),(0,import_jsx_runtime18.jsx)(Box_default,{marginTop:1,children:(0,import_jsx_runtime18.jsx)(Text,{dimColor:true,children:t("Press Enter to submit, Escape to cancel")})})]})},"SettingInputPrompt");init_esbuild_shims();var import_react20=__toESM(require_react(),1);var import_jsx_runtime19=__toESM(require_jsx_runtime(),1);var MAX_VISIBLE_ITEMS=8;var PluginChoicePrompt=__name(props=>{const{marketplaceName,plugins,onSelect,onCancel}=props;const[selectedIndex,setSelectedIndex]=(0,import_react20.useState)(0);const prefixWidth=2;const handleKeypress=(0,import_react20.useCallback)(key=>{const{name,sequence}=key;if(name==="escape"){onCancel();return}if(name==="return"){const plugin=plugins[selectedIndex];if(plugin){onSelect(plugin.name)}return}if(keyMatchers["selectionUp"](key)){setSelectedIndex(prev=>prev>0?prev-1:plugins.length-1);return}if(keyMatchers["selectionDown"](key)){setSelectedIndex(prev=>prev<plugins.length-1?prev+1:0);return}const num=parseInt(sequence||"",10);if(!isNaN(num)&&num>=1&&num<=plugins.length&&num<=9){setSelectedIndex(num-1);const plugin=plugins[num-1];if(plugin){onSelect(plugin.name)}}},[plugins,selectedIndex,onSelect,onCancel]);useKeypress(handleKeypress,{isActive:true});const{visiblePlugins,startIndex,hasMore,hasLess}=(0,import_react20.useMemo)(()=>{const total=plugins.length;if(total<=MAX_VISIBLE_ITEMS){return{visiblePlugins:plugins,startIndex:0,hasMore:false,hasLess:false}}let start=0;const halfWindow=Math.floor(MAX_VISIBLE_ITEMS/2);if(selectedIndex<=halfWindow){start=0}else if(selectedIndex>=total-halfWindow){start=total-MAX_VISIBLE_ITEMS}else{start=selectedIndex-halfWindow}const end=Math.min(start+MAX_VISIBLE_ITEMS,total);return{visiblePlugins:plugins.slice(start,end),startIndex:start,hasLess:start>0,hasMore:end<total}},[plugins,selectedIndex]);return(0,import_jsx_runtime19.jsxs)(Box_default,{borderStyle:"round",borderColor:theme.border.default,flexDirection:"column",paddingY:1,paddingX:2,width:"100%",children:[(0,import_jsx_runtime19.jsx)(Text,{bold:true,color:theme.text.accent,children:t('Select a plugin from "{{name}}"',{name:marketplaceName})}),(0,import_jsx_runtime19.jsxs)(Box_default,{marginTop:1,flexDirection:"column",children:[hasLess&&(0,import_jsx_runtime19.jsx)(Box_default,{children:(0,import_jsx_runtime19.jsxs)(Text,{dimColor:true,children:[" ","\u2191 ",t("{{count}} more above",{count:String(startIndex)})]})}),visiblePlugins.map((plugin,visibleIndex)=>{const actualIndex=startIndex+visibleIndex;const isSelected=actualIndex===selectedIndex;const prefix=isSelected?"\u276F ":" ";return(0,import_jsx_runtime19.jsxs)(Box_default,{flexDirection:"column",children:[(0,import_jsx_runtime19.jsxs)(Box_default,{flexDirection:"row",children:[(0,import_jsx_runtime19.jsx)(Text,{color:isSelected?theme.text.accent:void 0,children:prefix}),(0,import_jsx_runtime19.jsx)(Text,{bold:isSelected,color:isSelected?theme.text.accent:void 0,children:plugin.name})]}),isSelected&&plugin.description&&(0,import_jsx_runtime19.jsx)(Box_default,{marginLeft:prefixWidth,children:(0,import_jsx_runtime19.jsx)(Text,{color:theme.text.accent,children:plugin.description})})]},plugin.name)}),hasMore&&(0,import_jsx_runtime19.jsx)(Box_default,{children:(0,import_jsx_runtime19.jsxs)(Text,{dimColor:true,children:[" ","\u2193"," ",t("{{count}} more below",{count:String(plugins.length-startIndex-MAX_VISIBLE_ITEMS)})]})})]}),(0,import_jsx_runtime19.jsxs)(Box_default,{marginTop:1,flexDirection:"row",gap:2,children:[(0,import_jsx_runtime19.jsx)(Text,{dimColor:true,children:t("Use \u2191\u2193 or j/k to navigate, Enter to select, Escape to cancel")}),plugins.length>MAX_VISIBLE_ITEMS&&(0,import_jsx_runtime19.jsxs)(Text,{dimColor:true,children:["(",selectedIndex+1,"/",plugins.length,")"]})]})]})},"PluginChoicePrompt");init_esbuild_shims();var import_react21=__toESM(require_react(),1);init_esbuild_shims();var import_jsx_runtime20=__toESM(require_jsx_runtime(),1);function ScopeSelector({onSelect,onHighlight,isFocused,initialScope}){const scopeItems3=getScopeItems().map(item=>({...item,label:t(item.label),key:item.value}));const initialIndex=scopeItems3.findIndex(item=>item.value===initialScope);const safeInitialIndex=initialIndex>=0?initialIndex:0;return(0,import_jsx_runtime20.jsxs)(Box_default,{flexDirection:"column",children:[(0,import_jsx_runtime20.jsxs)(Text,{bold:isFocused,wrap:"truncate",children:[isFocused?"> ":" ",t("Apply To")]}),(0,import_jsx_runtime20.jsx)(Box_default,{height:1}),(0,import_jsx_runtime20.jsx)(RadioButtonSelect,{items:scopeItems3,initialIndex:safeInitialIndex,onSelect,onHighlight,isFocused,showNumbers:isFocused})]})}__name(ScopeSelector,"ScopeSelector");var import_jsx_runtime21=__toESM(require_jsx_runtime(),1);function ThemeDialog({onSelect,onHighlight,settings,availableTerminalHeight,terminalWidth}){const[selectedScope,setSelectedScope]=(0,import_react21.useState)("User");const[highlightedThemeName,setHighlightedThemeName]=(0,import_react21.useState)(settings.merged.ui?.theme||AUTO_THEME_NAME);const customThemes=selectedScope==="User"?settings.user.settings.ui?.customThemes||{}:settings.merged.ui?.customThemes||{};const builtInThemes=themeManager.getAvailableThemes().filter(theme2=>theme2.type!=="custom");const customThemeNames=Object.keys(customThemes);const capitalize=__name(s=>s.charAt(0).toUpperCase()+s.slice(1),"capitalize");const themeItems=[{label:t("Auto (detect terminal theme)"),value:AUTO_THEME_NAME,themeNameDisplay:t("Auto"),themeTypeDisplay:t("Auto"),key:AUTO_THEME_NAME},...builtInThemes.map(theme2=>({label:theme2.name,value:theme2.name,themeNameDisplay:theme2.name,themeTypeDisplay:capitalize(theme2.type),key:theme2.name})),...customThemeNames.map(name=>({label:name,value:name,themeNameDisplay:name,themeTypeDisplay:t("Custom"),key:name}))];const initialThemeIndex=themeItems.findIndex(item=>item.value===highlightedThemeName);const safeInitialThemeIndex=initialThemeIndex>=0?initialThemeIndex:0;const handleThemeSelect=(0,import_react21.useCallback)(themeName=>{onSelect(themeName,selectedScope)},[onSelect,selectedScope]);const handleThemeHighlight=__name(themeName=>{setHighlightedThemeName(themeName);onHighlight(themeName)},"handleThemeHighlight");const handleScopeHighlight=(0,import_react21.useCallback)(scope=>{setSelectedScope(scope)},[]);const handleScopeSelect=(0,import_react21.useCallback)(scope=>{onSelect(highlightedThemeName,scope)},[onSelect,highlightedThemeName]);const[mode,setMode]=(0,import_react21.useState)("theme");useKeypress(key=>{if(key.name==="tab"){setMode(prev=>prev==="theme"?"scope":"theme")}if(key.name==="escape"){onSelect(void 0,selectedScope)}},{isActive:true});const otherScopeModifiedMessage=getScopeMessageForSetting("ui.theme",selectedScope,settings);const PREVIEW_PANE_WIDTH_PERCENTAGE=.55;const PREVIEW_PANE_WIDTH_SAFETY_MARGIN=.9;const TOTAL_HORIZONTAL_PADDING=4;const colorizeCodeWidth=Math.max(Math.floor((terminalWidth-TOTAL_HORIZONTAL_PADDING)*PREVIEW_PANE_WIDTH_PERCENTAGE*PREVIEW_PANE_WIDTH_SAFETY_MARGIN),1);const DIALOG_PADDING=2;const selectThemeHeight=themeItems.length+1;const TAB_TO_SELECT_HEIGHT=2;availableTerminalHeight=availableTerminalHeight??Number.MAX_SAFE_INTEGER;availableTerminalHeight-=2;availableTerminalHeight-=TAB_TO_SELECT_HEIGHT;let totalLeftHandSideHeight=DIALOG_PADDING+selectThemeHeight;let includePadding=true;if(totalLeftHandSideHeight>availableTerminalHeight){includePadding=false;totalLeftHandSideHeight-=DIALOG_PADDING}const PREVIEW_PANE_FIXED_VERTICAL_SPACE=8;availableTerminalHeight=Math.max(availableTerminalHeight,totalLeftHandSideHeight);const availableTerminalHeightCodeBlock=availableTerminalHeight-PREVIEW_PANE_FIXED_VERTICAL_SPACE-(includePadding?2:0)*2;const availableHeightForPanes=Math.max(0,availableTerminalHeightCodeBlock-1);const codeBlockHeight=Math.ceil(availableHeightForPanes*.6);const diffHeight=Math.floor(availableHeightForPanes*.4);return(0,import_jsx_runtime21.jsxs)(Box_default,{borderStyle:"round",borderColor:theme.border.default,flexDirection:"column",paddingTop:includePadding?1:0,paddingBottom:includePadding?1:0,paddingLeft:1,paddingRight:1,width:"100%",children:[mode==="theme"?(0,import_jsx_runtime21.jsxs)(Box_default,{flexDirection:"row",children:[(0,import_jsx_runtime21.jsxs)(Box_default,{flexDirection:"column",width:"45%",paddingRight:2,children:[(0,import_jsx_runtime21.jsxs)(Text,{bold:mode==="theme",wrap:"truncate",children:[mode==="theme"?"> ":" ",t("Select Theme")," ",(0,import_jsx_runtime21.jsx)(Text,{color:theme.text.secondary,children:otherScopeModifiedMessage})]}),(0,import_jsx_runtime21.jsx)(RadioButtonSelect,{items:themeItems,initialIndex:safeInitialThemeIndex,onSelect:handleThemeSelect,onHighlight:handleThemeHighlight,isFocused:mode==="theme",maxItemsToShow:12,showScrollArrows:true,showNumbers:mode==="theme"})]}),(0,import_jsx_runtime21.jsxs)(Box_default,{flexDirection:"column",width:"55%",paddingLeft:2,children:[(0,import_jsx_runtime21.jsx)(Text,{bold:true,color:theme.text.primary,children:t("Preview")}),(()=>{const previewTheme=highlightedThemeName===AUTO_THEME_NAME?themeManager.getActiveTheme():themeManager.getTheme(highlightedThemeName||DEFAULT_THEME.name)||DEFAULT_THEME;return(0,import_jsx_runtime21.jsxs)(Box_default,{borderStyle:"single",borderColor:theme.border.default,paddingTop:includePadding?1:0,paddingBottom:includePadding?1:0,paddingLeft:1,paddingRight:1,flexDirection:"column",children:[colorizeCode(`# function
4
4
  def fibonacci(n):
5
5
  a, b = 0, 1
6
6
  for _ in range(n):