wherdr 2.4.0 → 2.6.0

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 (287) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/_nuxt/{CPlkxpge.js → 2fsYF-LK.js} +41 -41
  3. package/.output/public/_nuxt/2fsYF-LK.js.br +0 -0
  4. package/.output/public/_nuxt/2fsYF-LK.js.gz +0 -0
  5. package/.output/public/_nuxt/{CV6ukk-M.js → 3bE7s96N.js} +1 -1
  6. package/.output/public/_nuxt/6YTlf8ot.js +1 -0
  7. package/.output/public/_nuxt/6YTlf8ot.js.br +0 -0
  8. package/.output/public/_nuxt/6YTlf8ot.js.gz +0 -0
  9. package/.output/public/_nuxt/{BYZVrreW.js → 7KozZy5Y.js} +1 -1
  10. package/.output/public/_nuxt/AgentView.BwyQIUef.css +1 -0
  11. package/.output/public/_nuxt/AgentView.BwyQIUef.css.br +0 -0
  12. package/.output/public/_nuxt/AgentView.BwyQIUef.css.gz +0 -0
  13. package/.output/public/_nuxt/{BdJIc1Xf.js → B40shTLf.js} +1 -1
  14. package/.output/public/_nuxt/{BdJIc1Xf.js.br → B40shTLf.js.br} +0 -0
  15. package/.output/public/_nuxt/B40shTLf.js.gz +0 -0
  16. package/.output/public/_nuxt/B5cSia3P.js +62 -0
  17. package/.output/public/_nuxt/B5cSia3P.js.br +0 -0
  18. package/.output/public/_nuxt/B5cSia3P.js.gz +0 -0
  19. package/.output/public/_nuxt/BK1_9FXg.js +1 -0
  20. package/.output/public/_nuxt/BK1_9FXg.js.br +0 -0
  21. package/.output/public/_nuxt/BK1_9FXg.js.gz +0 -0
  22. package/.output/public/_nuxt/{CgUSTIM1.js → Bqz3nVVB.js} +1 -1
  23. package/.output/public/_nuxt/{CgUSTIM1.js.br → Bqz3nVVB.js.br} +0 -0
  24. package/.output/public/_nuxt/Bqz3nVVB.js.gz +0 -0
  25. package/.output/public/_nuxt/{B2KlcBQ-.js → ByLPJEo6.js} +1 -1
  26. package/.output/public/_nuxt/ByLPJEo6.js.br +0 -0
  27. package/.output/public/_nuxt/ByLPJEo6.js.gz +0 -0
  28. package/.output/public/_nuxt/C8tHIeGN.js +3 -0
  29. package/.output/public/_nuxt/C8tHIeGN.js.br +0 -0
  30. package/.output/public/_nuxt/C8tHIeGN.js.gz +0 -0
  31. package/.output/public/_nuxt/CAkH_IfS.js +9 -0
  32. package/.output/public/_nuxt/CAkH_IfS.js.br +0 -0
  33. package/.output/public/_nuxt/CAkH_IfS.js.gz +0 -0
  34. package/.output/public/_nuxt/COWXF9OU.js +123 -0
  35. package/.output/public/_nuxt/COWXF9OU.js.br +0 -0
  36. package/.output/public/_nuxt/COWXF9OU.js.gz +0 -0
  37. package/.output/public/_nuxt/{BDTOz37p.js → CiG2Lovu.js} +1 -1
  38. package/.output/public/_nuxt/CiG2Lovu.js.br +0 -0
  39. package/.output/public/_nuxt/CiG2Lovu.js.gz +0 -0
  40. package/.output/public/_nuxt/CnjxEm0H.js +27 -0
  41. package/.output/public/_nuxt/CnjxEm0H.js.br +0 -0
  42. package/.output/public/_nuxt/CnjxEm0H.js.gz +0 -0
  43. package/.output/public/_nuxt/DNs2cMBZ.js +23 -0
  44. package/.output/public/_nuxt/DNs2cMBZ.js.br +0 -0
  45. package/.output/public/_nuxt/DNs2cMBZ.js.gz +0 -0
  46. package/.output/public/_nuxt/D_x7Rysx.js +31 -0
  47. package/.output/public/_nuxt/D_x7Rysx.js.br +0 -0
  48. package/.output/public/_nuxt/D_x7Rysx.js.gz +0 -0
  49. package/.output/public/_nuxt/{CLf2i_DM.js → T-qXNaMY.js} +1 -1
  50. package/.output/public/_nuxt/{board.fZYj3O-m.css → board.CpFnG_Ho.css} +1 -1
  51. package/.output/public/_nuxt/board.CpFnG_Ho.css.br +0 -0
  52. package/.output/public/_nuxt/board.CpFnG_Ho.css.gz +0 -0
  53. package/.output/public/_nuxt/builds/latest.json +1 -1
  54. package/.output/public/_nuxt/builds/meta/e2ee8d99-6a6a-4754-934f-8b7dbecfcdcb.json +1 -0
  55. package/.output/public/_nuxt/entry.C_hImCpq.css +2 -0
  56. package/.output/public/_nuxt/entry.C_hImCpq.css.br +0 -0
  57. package/.output/public/_nuxt/entry.C_hImCpq.css.gz +0 -0
  58. package/.output/public/_nuxt/{settings.Cdb21nNw.css → settings.ycbeituV.css} +1 -1
  59. package/.output/public/_nuxt/settings.ycbeituV.css.br +0 -0
  60. package/.output/public/_nuxt/settings.ycbeituV.css.gz +0 -0
  61. package/.output/public/_nuxt/useViewport.D9mmYA6A.css +1 -0
  62. package/.output/public/_nuxt/useWorktrees.BWpb3OO0.css +1 -0
  63. package/.output/public/_nuxt/useWorktrees.BWpb3OO0.css.br +0 -0
  64. package/.output/public/_nuxt/useWorktrees.BWpb3OO0.css.gz +0 -0
  65. package/.output/public/sw.js +6 -2
  66. package/.output/server/chunks/_/branding.mjs +1 -1
  67. package/.output/server/chunks/_/fileDownload.mjs +1 -1
  68. package/.output/server/chunks/_/files.mjs +26 -3
  69. package/.output/server/chunks/_/machineOrder.mjs +1 -1
  70. package/.output/server/chunks/_/onboarding.mjs +1 -1
  71. package/.output/server/chunks/_/package.mjs +1 -1
  72. package/.output/server/chunks/_/plugins.mjs +1 -1
  73. package/.output/server/chunks/_/restart.mjs +1 -1
  74. package/.output/server/chunks/_/revoke.mjs +22 -0
  75. package/.output/server/chunks/_/selfupdate.mjs +2 -1
  76. package/.output/server/chunks/_/splitShell.mjs +42 -0
  77. package/.output/server/chunks/_/updates.mjs +18 -4
  78. package/.output/server/chunks/_/uploadHashes.mjs +46 -0
  79. package/.output/server/chunks/_/worktrees.mjs +1 -1
  80. package/.output/server/chunks/_/ws.mjs +3 -3
  81. package/.output/server/chunks/nitro/nitro.mjs +15815 -15082
  82. package/.output/server/chunks/raw/check-leaks.mjs +1 -1
  83. package/.output/server/chunks/raw/ci-browser-plan.mjs +5 -0
  84. package/.output/server/chunks/raw/engine-changes.mjs +5 -0
  85. package/.output/server/chunks/raw/engine-result.mjs +7 -0
  86. package/.output/server/chunks/raw/herdr-plugin.mjs +1 -1
  87. package/.output/server/chunks/raw/prerelease.mjs +1 -1
  88. package/.output/server/chunks/raw/test-affected.mjs +1 -1
  89. package/.output/server/chunks/routes/api/_..._.mjs +5 -5
  90. package/.output/server/chunks/routes/api/agents.post.mjs +5 -5
  91. package/.output/server/chunks/routes/api/ask-tab.post.mjs +5 -5
  92. package/.output/server/chunks/routes/api/attach.post.mjs +5 -5
  93. package/.output/server/chunks/routes/api/auth/disable.post.mjs +14 -7
  94. package/.output/server/chunks/routes/api/auth/lock-all.post.mjs +12 -6
  95. package/.output/server/chunks/routes/api/auth/lock.post.mjs +5 -5
  96. package/.output/server/chunks/routes/api/auth/login/options.post.mjs +7 -7
  97. package/.output/server/chunks/routes/api/auth/login/verify.post.mjs +5 -5
  98. package/.output/server/chunks/routes/api/auth/max-session.post.mjs +5 -5
  99. package/.output/server/chunks/routes/api/auth/register/options.post.mjs +5 -5
  100. package/.output/server/chunks/routes/api/auth/register/verify.post.mjs +5 -5
  101. package/.output/server/chunks/routes/api/auth/status.get.mjs +10 -10
  102. package/.output/server/chunks/routes/api/changes.get.mjs +6 -6
  103. package/.output/server/chunks/routes/api/chat/image.get.mjs +6 -6
  104. package/.output/server/chunks/routes/api/chat.get.mjs +20 -49
  105. package/.output/server/chunks/routes/api/choose.post.mjs +6 -6
  106. package/.output/server/chunks/routes/api/claude-setup.post.mjs +6 -6
  107. package/.output/server/chunks/routes/api/claude-statusline.post.mjs +6 -6
  108. package/.output/server/chunks/routes/api/clear-queued-input.post.mjs +6 -6
  109. package/.output/server/chunks/routes/api/close/status.get.mjs +6 -6
  110. package/.output/server/chunks/routes/api/close-preview.get.mjs +62 -0
  111. package/.output/server/chunks/routes/api/close.post.mjs +5 -5
  112. package/.output/server/chunks/routes/api/codex-update.post.mjs +6 -6
  113. package/.output/server/chunks/routes/api/commands.get.mjs +6 -6
  114. package/.output/server/chunks/routes/api/config.get.mjs +6 -6
  115. package/.output/server/chunks/routes/api/dirs.get.mjs +6 -6
  116. package/.output/server/chunks/routes/api/dismiss-stopped.post.mjs +6 -6
  117. package/.output/server/chunks/routes/api/dismiss.post.mjs +6 -6
  118. package/.output/server/chunks/routes/api/effort.post.mjs +6 -6
  119. package/.output/server/chunks/routes/api/efforts.get.mjs +6 -6
  120. package/.output/server/chunks/routes/api/file.post.mjs +6 -6
  121. package/.output/server/chunks/routes/api/files/download.get.mjs +5 -5
  122. package/.output/server/chunks/routes/api/files/download.head.mjs +5 -5
  123. package/.output/server/chunks/routes/api/files/read.get.mjs +6 -6
  124. package/.output/server/chunks/routes/api/files.get.mjs +6 -6
  125. package/.output/server/chunks/routes/api/health.get.mjs +5 -5
  126. package/.output/server/chunks/routes/api/input.post.mjs +6 -6
  127. package/.output/server/chunks/routes/api/interrupt.post.mjs +6 -6
  128. package/.output/server/chunks/routes/api/isgit.get.mjs +6 -6
  129. package/.output/server/chunks/routes/api/machine/awake.get.mjs +6 -6
  130. package/.output/server/chunks/routes/api/machine/awake.post.mjs +6 -6
  131. package/.output/server/chunks/routes/api/machine/order.get.mjs +5 -5
  132. package/.output/server/chunks/routes/api/machine/order.post.mjs +5 -5
  133. package/.output/server/chunks/routes/api/machine/reconnect.post.mjs +6 -6
  134. package/.output/server/chunks/routes/api/machine/rename.post.mjs +6 -6
  135. package/.output/server/chunks/routes/api/machine/status.post.mjs +6 -6
  136. package/.output/server/chunks/routes/api/menu-left.post.mjs +6 -6
  137. package/.output/server/chunks/routes/api/menu.post.mjs +6 -6
  138. package/.output/server/chunks/routes/api/model.post.mjs +6 -6
  139. package/.output/server/chunks/routes/api/models.get.mjs +6 -6
  140. package/.output/server/chunks/routes/api/nav.post.mjs +6 -6
  141. package/.output/server/chunks/routes/api/onboarding.get.mjs +5 -5
  142. package/.output/server/chunks/routes/api/onboarding.post.mjs +5 -5
  143. package/.output/server/chunks/routes/api/phone.get.mjs +6 -6
  144. package/.output/server/chunks/routes/api/phone.post.mjs +6 -6
  145. package/.output/server/chunks/routes/api/plugins/actions.get.mjs +5 -5
  146. package/.output/server/chunks/routes/api/plugins/invoke.post.mjs +5 -5
  147. package/.output/server/chunks/routes/api/plugins/projects.get.mjs +6 -6
  148. package/.output/server/chunks/routes/api/plugins/projects.post.mjs +6 -6
  149. package/.output/server/chunks/routes/api/prompt.post.mjs +6 -6
  150. package/.output/server/chunks/routes/api/push/devices.post.mjs +49 -0
  151. package/.output/server/chunks/routes/api/push/quiet.post.mjs +6 -6
  152. package/.output/server/chunks/routes/api/push/subscribe.post.mjs +8 -7
  153. package/.output/server/chunks/routes/api/push/test.post.mjs +6 -6
  154. package/.output/server/chunks/routes/api/push/unsubscribe.post.mjs +6 -6
  155. package/.output/server/chunks/routes/api/quotas.get.mjs +6 -6
  156. package/.output/server/chunks/routes/api/rename.post.mjs +5 -5
  157. package/.output/server/chunks/routes/api/requeue.post.mjs +6 -6
  158. package/.output/server/chunks/routes/api/restart.get.mjs +5 -5
  159. package/.output/server/chunks/routes/api/restart.post.mjs +5 -5
  160. package/.output/server/chunks/routes/api/reveal.post.mjs +6 -6
  161. package/.output/server/chunks/routes/api/screen-key.post.mjs +6 -6
  162. package/.output/server/chunks/routes/api/screen.get.mjs +6 -6
  163. package/.output/server/chunks/routes/api/search.get.mjs +6 -6
  164. package/.output/server/chunks/routes/api/seen.post.mjs +6 -6
  165. package/.output/server/chunks/routes/api/send-now.post.mjs +6 -6
  166. package/.output/server/chunks/routes/api/sessions.get.mjs +6 -6
  167. package/.output/server/chunks/routes/api/sessions.post.mjs +6 -6
  168. package/.output/server/chunks/routes/api/settings-tab.post.mjs +6 -6
  169. package/.output/server/chunks/routes/api/settings.get.mjs +6 -6
  170. package/.output/server/chunks/routes/api/settings.post.mjs +6 -6
  171. package/.output/server/chunks/routes/api/space.post.mjs +6 -6
  172. package/.output/server/chunks/routes/api/split-command.post.mjs +9 -44
  173. package/.output/server/chunks/routes/api/state.get.mjs +6 -6
  174. package/.output/server/chunks/routes/api/tasks/action.post.mjs +6 -6
  175. package/.output/server/chunks/routes/api/tasks/add.post.mjs +6 -6
  176. package/.output/server/chunks/routes/api/tasks/after.post.mjs +6 -6
  177. package/.output/server/chunks/routes/api/tasks/approve.post.mjs +6 -6
  178. package/.output/server/chunks/routes/api/tasks/archive-done.post.mjs +6 -6
  179. package/.output/server/chunks/routes/api/tasks/archived.get.mjs +6 -6
  180. package/.output/server/chunks/routes/api/tasks/autopilot.get.mjs +6 -6
  181. package/.output/server/chunks/routes/api/tasks/autopilot.post.mjs +6 -6
  182. package/.output/server/chunks/routes/api/tasks/board-settings.get.mjs +6 -6
  183. package/.output/server/chunks/routes/api/tasks/board-settings.post.mjs +6 -6
  184. package/.output/server/chunks/routes/api/tasks/coordinator.get.mjs +6 -6
  185. package/.output/server/chunks/routes/api/tasks/coordinator.post.mjs +6 -6
  186. package/.output/server/chunks/routes/api/tasks/describe.post.mjs +6 -6
  187. package/.output/server/chunks/routes/api/tasks/details.get.mjs +6 -6
  188. package/.output/server/chunks/routes/api/tasks/limit.post.mjs +6 -6
  189. package/.output/server/chunks/routes/api/tasks/links.get.mjs +7 -7
  190. package/.output/server/chunks/routes/api/tasks/models.get.mjs +6 -6
  191. package/.output/server/chunks/routes/api/tasks/pick.post.mjs +6 -6
  192. package/.output/server/chunks/routes/api/tasks/project.get.mjs +6 -6
  193. package/.output/server/chunks/routes/api/tasks/project.post.mjs +6 -6
  194. package/.output/server/chunks/routes/api/tasks/question.post.mjs +6 -6
  195. package/.output/server/chunks/routes/api/tasks/scheduled.get.mjs +6 -6
  196. package/.output/server/chunks/routes/api/tasks/settings.get.mjs +6 -6
  197. package/.output/server/chunks/routes/api/tasks/start.get.mjs +6 -6
  198. package/.output/server/chunks/routes/api/tasks/tell.post.mjs +6 -6
  199. package/.output/server/chunks/routes/api/tasks/transcript-image.get.mjs +47 -0
  200. package/.output/server/chunks/routes/api/tasks/transcript.get.mjs +48 -0
  201. package/.output/server/chunks/routes/api/tasks.get.mjs +6 -6
  202. package/.output/server/chunks/routes/api/unqueue.post.mjs +6 -6
  203. package/.output/server/chunks/routes/api/update/status.get.mjs +5 -5
  204. package/.output/server/chunks/routes/api/update.get.mjs +5 -5
  205. package/.output/server/chunks/routes/api/update.post.mjs +5 -5
  206. package/.output/server/chunks/routes/api/upload.post.mjs +6 -6
  207. package/.output/server/chunks/routes/api/worktrees/remove.post.mjs +5 -5
  208. package/.output/server/chunks/routes/api/worktrees.get.mjs +5 -5
  209. package/.output/server/chunks/routes/favicon.ico.get.mjs +5 -5
  210. package/.output/server/chunks/routes/icons/_name_.get.mjs +6 -6
  211. package/.output/server/chunks/routes/renderer.mjs +7 -7
  212. package/.output/server/chunks/routes/uploads/_...name_.get.mjs +6 -6
  213. package/.output/server/chunks/routes/ws/_..._.mjs +6 -6
  214. package/.output/server/chunks/routes/ws/events.mjs +6 -6
  215. package/.output/server/chunks/routes/ws/term.mjs +6 -6
  216. package/.output/server/chunks/virtual/precomputed.mjs +1 -1
  217. package/.output/server/index.mjs +6 -6
  218. package/.output/server/package.json +1 -1
  219. package/README.md +1 -1
  220. package/bin/lib/tailnet.d.mts +7 -4
  221. package/bin/lib/tailnet.mjs +76 -18
  222. package/bin/lib/updater.mjs +6 -0
  223. package/docs/README.md +4 -0
  224. package/docs/RELEASING.md +27 -5
  225. package/docs/configuration.md +3 -4
  226. package/docs/conversation.md +11 -3
  227. package/docs/design.md +1 -1
  228. package/docs/devices.md +28 -0
  229. package/docs/home.md +29 -0
  230. package/docs/installation.md +14 -5
  231. package/docs/networks.md +9 -4
  232. package/docs/notifications.md +7 -0
  233. package/docs/plugins.md +1 -1
  234. package/docs/quick-start.md +7 -6
  235. package/docs/quotas.md +10 -1
  236. package/docs/release-notes-2.5.0.md +25 -0
  237. package/docs/release-notes-2.6.0.md +29 -0
  238. package/docs/security.md +61 -11
  239. package/docs/troubleshooting.md +4 -0
  240. package/package.json +1 -1
  241. package/skills/wherdr/SKILL.md +21 -0
  242. package/.output/public/_nuxt/AgentView.B12D6ccj.css +0 -1
  243. package/.output/public/_nuxt/AgentView.B12D6ccj.css.br +0 -0
  244. package/.output/public/_nuxt/AgentView.B12D6ccj.css.gz +0 -0
  245. package/.output/public/_nuxt/B2KlcBQ-.js.br +0 -0
  246. package/.output/public/_nuxt/B2KlcBQ-.js.gz +0 -0
  247. package/.output/public/_nuxt/BDTOz37p.js.br +0 -0
  248. package/.output/public/_nuxt/BDTOz37p.js.gz +0 -0
  249. package/.output/public/_nuxt/BGD5AamG.js +0 -25
  250. package/.output/public/_nuxt/BGD5AamG.js.br +0 -0
  251. package/.output/public/_nuxt/BGD5AamG.js.gz +0 -0
  252. package/.output/public/_nuxt/BdJIc1Xf.js.gz +0 -0
  253. package/.output/public/_nuxt/BxlzUs1i.js +0 -23
  254. package/.output/public/_nuxt/BxlzUs1i.js.br +0 -0
  255. package/.output/public/_nuxt/BxlzUs1i.js.gz +0 -0
  256. package/.output/public/_nuxt/C-BDzEtI.js +0 -3
  257. package/.output/public/_nuxt/C-BDzEtI.js.br +0 -0
  258. package/.output/public/_nuxt/C-BDzEtI.js.gz +0 -0
  259. package/.output/public/_nuxt/CO4sDeSt.js +0 -62
  260. package/.output/public/_nuxt/CO4sDeSt.js.br +0 -0
  261. package/.output/public/_nuxt/CO4sDeSt.js.gz +0 -0
  262. package/.output/public/_nuxt/CPlkxpge.js.br +0 -0
  263. package/.output/public/_nuxt/CPlkxpge.js.gz +0 -0
  264. package/.output/public/_nuxt/CTPNZj4T.js +0 -9
  265. package/.output/public/_nuxt/CTPNZj4T.js.br +0 -0
  266. package/.output/public/_nuxt/CTPNZj4T.js.gz +0 -0
  267. package/.output/public/_nuxt/CgUSTIM1.js.gz +0 -0
  268. package/.output/public/_nuxt/CwurhZnh.js +0 -123
  269. package/.output/public/_nuxt/CwurhZnh.js.br +0 -0
  270. package/.output/public/_nuxt/CwurhZnh.js.gz +0 -0
  271. package/.output/public/_nuxt/D7fCPncR.js +0 -1
  272. package/.output/public/_nuxt/D7fCPncR.js.br +0 -0
  273. package/.output/public/_nuxt/D7fCPncR.js.gz +0 -0
  274. package/.output/public/_nuxt/DFe-cDm2.js +0 -1
  275. package/.output/public/_nuxt/DFe-cDm2.js.br +0 -0
  276. package/.output/public/_nuxt/DFe-cDm2.js.gz +0 -0
  277. package/.output/public/_nuxt/Dpe9TNcA.js +0 -31
  278. package/.output/public/_nuxt/Dpe9TNcA.js.br +0 -0
  279. package/.output/public/_nuxt/Dpe9TNcA.js.gz +0 -0
  280. package/.output/public/_nuxt/board.fZYj3O-m.css.br +0 -0
  281. package/.output/public/_nuxt/board.fZYj3O-m.css.gz +0 -0
  282. package/.output/public/_nuxt/builds/meta/75cc4ea7-3027-463a-aa3e-29e474ed7173.json +0 -1
  283. package/.output/public/_nuxt/entry.KNdllmoL.css +0 -2
  284. package/.output/public/_nuxt/entry.KNdllmoL.css.br +0 -0
  285. package/.output/public/_nuxt/entry.KNdllmoL.css.gz +0 -0
  286. package/.output/public/_nuxt/settings.Cdb21nNw.css.br +0 -0
  287. package/.output/public/_nuxt/settings.Cdb21nNw.css.gz +0 -0
@@ -1,33 +1,34 @@
1
- import{t as e}from"./hePW80VL.js";import{$ as t,A as n,An as r,At as i,B as a,Bn as o,Dn as s,Dt as c,Et as l,Fn as u,Ft as d,Hn as f,Jt as p,M as m,Mn as h,N as g,Ot as _,P as v,Pt as y,Qt as b,R as x,Rn as S,Rt as C,St as w,U as T,V as E,Yt as D,Zt as O,b as k,ct as A,fr as j,gr as M,hr as N,ht as P,in as F,j as I,ln as L,mr as R,mt as z,nn as B,pt as V,sn as H,vt as U,w as W,wn as G,z as ee,zn as K}from"./C25ROUa9.js";import{_t as te,dt as q,gt as ne,ht as J,vt as re}from"./CDWjMk9C.js";import{Bt as ie,D as ae,E as oe,En as se,G as ce,Gt as le,Ht as ue,In as de,Jt as fe,K as pe,Kt as me,Mt as he,Nn as ge,Ot as _e,Qt as ve,Sn as ye,Tn as be,Tt as xe,Un as Se,Ut as Ce,Vt as we,W as Te,Wt as Ee,Xt as De,Y as Oe,Yt as ke,Z as Ae,Zt as je,_ as Me,_t as Ne,ai as Pe,an as Fe,ar as Ie,at as Le,b as Re,bn as ze,ci as Be,di as Ve,dn as He,dt as Ue,ei as We,en as Ge,f as Ke,fi as qe,fn as Je,gt as Ye,hn as Xe,i as Ze,ii as Qe,in as $e,it as et,k as tt,kn as nt,kt as rt,lr as it,lt as at,m as ot,mi as st,n as ct,nn as lt,on as ut,ot as dt,pi as ft,qt as pt,r as mt,ri as ht,rn as gt,s as _t,sn as vt,st as yt,ti as bt,tn as xt,tr as St,u as Ct,ui as wt,un as Tt,ut as Et,v as Dt,vn as Ot,wn as kt,x as At,xn as jt,xt as Mt,y as Nt,yn as Pt,zr as Ft,zt as It}from"./BxlzUs1i.js";import{f as Lt,m as Rt,p as zt,u as Bt}from"./CXJnLmWv.js";import{A as Vt,At as Ht,C as Ut,Ct as Wt,D as Gt,Dt as Kt,Et as qt,F as Jt,G as Yt,H as Xt,I as Zt,J as Qt,K as $t,L as en,Mt as tn,N as nn,O as rn,Ot as an,P as on,R as sn,S as cn,St as ln,T as un,Tt as dn,U as fn,V as pn,W as mn,_ as hn,_t as gn,a as _n,at as vn,b as yn,bt as bn,c as xn,ct as Sn,dt as Cn,f as wn,ft as Tn,g as En,gt as Dn,h as On,ht as kn,i as An,j as jn,jt as Mn,k as Nn,kt as Pn,l as Fn,lt as In,m as Ln,mt as Rn,n as zn,o as Bn,ot as Vn,pt as Hn,r as Un,s as Wn,st as Gn,u as Kn,ut as qn,vt as Jn,wt as Yn,x as Xn,xt as Zn,y as Y,yt as Qn,z as $n}from"./CTPNZj4T.js";import{c as er}from"./B2KlcBQ-.js";import{$r as tr,$t as nr,An as rr,At as ir,B as ar,Bt as or,Ci as sr,Cr as cr,Ct as lr,D as ur,Dr as dr,E as fr,Et as pr,Ft as mr,G as hr,Gr as gr,Gt as _r,Hr as vr,Ht as yr,In as br,It as xr,J as Sr,Jr as X,Jt as Cr,K as wr,Kr as Tr,Kt as Er,Lt as Dr,Mi as Or,Mt as kr,Nt as Ar,On as jr,Or as Mr,Pt as Nr,Q as Pr,R as Fr,Rt as Ir,Si as Lr,T as Rr,Tt as zr,Ur as Br,Ut as Vr,V as Hr,Vr as Ur,Vt as Wr,Wr as Gr,Wt as Kr,X as qr,Xr as Jr,Y as Yr,Yr as Xr,Yt as Zr,Z as Qr,Zr as $r,_ as ei,_i as ti,at as ni,bi as ri,cr as ii,ct as ai,di as oi,ei as si,en as ci,er as li,et as ui,f as di,ft as fi,gi as pi,gr as mi,hi,i as gi,in as _i,j as vi,kr as yi,l as bi,li as Z,lr as xi,mi as Si,n as Ci,ni as wi,nn as Ti,ot as Ei,pi as Di,pr as Oi,qt as ki,ri as Ai,rn as ji,rt as Mi,sr as Ni,tn as Pi,ui as Q,ut as Fi,v as Ii,vr as Li,vt as Ri,w as zi,wi as Bi,wr as Vi,wt as $,x as Hi,xi as Ui,xr as Wi,xt as Gi,y as Ki,yi as qi,yr as Ji,yt as Yi,zt as Xi}from"./CwurhZnh.js";import{c as Zi,d as Qi,f as $i,h as ea,i as ta,l as na,m as ra,n as ia,p as aa,t as oa,u as sa}from"./CO4sDeSt.js";import{t as ca}from"./BDNMzG2s.js";var[la,ua]=xe(`CollapsibleRoot`),da=T({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=Ue(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=K(r);return ua({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),Oe(),(e,t)=>(_(),m(f(Te),{as:e.as,"as-child":r.asChild,"data-state":f(i)?`open`:`closed`,"data-disabled":f(a)?``:void 0},{default:H(()=>[d(e.$slots,`default`,{open:f(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),fa=T({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let r=e,i=t,a=la();a.contentId||=pe(void 0,`reka-collapsible-content`);let o=h(),{forwardRef:s,currentElement:c}=Oe(),l=h(0),u=h(0),p=n(()=>a.open.value),v=h(p.value),y=h();B(()=>[p.value,o.value?.present],async()=>{await P();let e=c.value;if(!e)return;y.value=y.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();u.value=t.height,l.value=t.width,v.value||(e.style.transitionDuration=y.value.transitionDuration,e.style.animationName=y.value.animationName)},{immediate:!0});let b=n(()=>v.value&&a.open.value);return w(()=>{requestAnimationFrame(()=>{v.value=!1})}),Le(c,`beforematch`,e=>{requestAnimationFrame(()=>{a.onOpenToggle(),i(`contentFound`)})}),(e,t)=>(_(),m(f(ce),{ref_key:`presentRef`,ref:o,present:e.forceMount||f(a).open.value,"force-mount":!0},{default:H(({present:t})=>[E(f(Te),z(e.$attrs,{id:f(a).contentId,ref:f(s),"as-child":r.asChild,as:e.as,hidden:t?void 0:f(a).unmountOnHide.value?``:`until-found`,"data-state":b.value?void 0:f(a).open.value?`open`:`closed`,"data-disabled":f(a).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${u.value}px`,"--reka-collapsible-content-width":`${l.value}px`}}),{default:H(()=>[!f(a).unmountOnHide.value||t?d(e.$slots,`default`,{key:0}):g(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),pa=T({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;Oe();let n=la();return(e,r)=>(_(),m(f(Te),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":f(n).contentId,"aria-expanded":f(n).open.value,"data-state":f(n).open.value?`open`:`closed`,"data-disabled":f(n).disabled?.value?``:void 0,disabled:f(n).disabled?.value,onClick:f(n).onOpenToggle},{default:H(()=>[d(e.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}}),[ma,ha]=xe(`TabsRoot`),ga=T({__name:`TabsRoot`,props:{defaultValue:{type:null,required:!1},orientation:{type:String,required:!1,default:`horizontal`},dir:{type:String,required:!1},activationMode:{type:String,required:!1,default:`automatic`},modelValue:{type:null,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{orientation:i,unmountOnHide:a,dir:o}=K(n),s=Ae(o);Oe();let c=Ue(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),l=h(),p=u(new Set);return ha({modelValue:c,changeModelValue:e=>{c.value=e},orientation:i,dir:s,unmountOnHide:a,activationMode:n.activationMode,baseId:pe(void 0,`reka-tabs`),tabsList:l,contentIds:p,registerContent:e=>{p.value=new Set([...p.value,e])},unregisterContent:e=>{let t=new Set(p.value);t.delete(e),p.value=t}}),(e,t)=>(_(),m(f(Te),{dir:f(s),"data-orientation":f(i),"as-child":e.asChild,as:e.as},{default:H(()=>[d(e.$slots,`default`,{modelValue:f(c)})]),_:3},8,[`dir`,`data-orientation`,`as-child`,`as`]))}});function _a(e,t){return`${e}-trigger-${t}`}function va(e,t){return`${e}-content-${t}`}var ya=T({__name:`TabsContent`,props:{value:{type:[String,Number],required:!0},forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,{forwardRef:r}=Oe(),i=ma(),a=n(()=>_a(i.baseId,t.value)),o=n(()=>va(i.baseId,t.value)),s=n(()=>t.value===i.modelValue.value),c=h(s.value);return w(()=>{i.registerContent(t.value),requestAnimationFrame(()=>{c.value=!1})}),U(()=>{i.unregisterContent(t.value)}),(e,t)=>(_(),m(f(ce),{present:e.forceMount||s.value,"force-mount":``},{default:H(({present:t})=>[E(f(Te),{id:o.value,ref:f(r),"as-child":e.asChild,as:e.as,role:`tabpanel`,"data-state":s.value?`active`:`inactive`,"data-orientation":f(i).orientation.value,"aria-labelledby":a.value,hidden:!t,tabindex:`0`,style:N({animationDuration:c.value?`0s`:void 0})},{default:H(()=>[!f(i).unmountOnHide.value||t?d(e.$slots,`default`,{key:0}):g(`v-if`,!0)]),_:2},1032,[`id`,`as-child`,`as`,`data-state`,`data-orientation`,`aria-labelledby`,`hidden`,`style`])]),_:3},8,[`present`]))}}),ba=T({__name:`TabsIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e,{expose:t}){let r=e,i=ma();t({updateIndicatorStyle:c}),Oe();let a=dt(),o=h({size:null,thickness:null,position:null}),s=h([]);B(()=>[i.modelValue.value,i?.dir.value],()=>{c()},{immediate:!0,flush:`post`}),F(()=>{s.value=Array.from(i.tabsList.value?.querySelectorAll(`[role="tab"]`)||[])}),at(n(()=>[i.tabsList.value,...s.value]),c);function c(){let e=i.tabsList.value?.querySelector(`[role="tab"][data-state="active"]`);e&&(i.orientation.value===`horizontal`?o.value={size:e.offsetWidth,thickness:e.offsetHeight,position:e.offsetLeft}:o.value={size:e.offsetHeight,thickness:e.offsetWidth,position:e.offsetTop})}return(e,t)=>f(a)&&typeof o.value.size==`number`?(_(),m(f(Te),z({key:0},r,{style:{"--reka-tabs-indicator-size":`${o.value.size}px`,"--reka-tabs-indicator-thickness":`${o.value.thickness}px`,"--reka-tabs-indicator-position":`${o.value.position}px`}}),{default:H(()=>[d(e.$slots,`default`)]),_:3},16,[`style`])):g(`v-if`,!0)}}),xa=T({__name:`TabsList`,props:{loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let{loop:t}=K(e),{forwardRef:n,currentElement:r}=Oe(),i=ma();return i.tabsList=r,(e,r)=>(_(),m(f(tt),{"as-child":``,orientation:f(i).orientation.value,dir:f(i).dir.value,loop:f(t)},{default:H(()=>[E(f(Te),{ref:f(n),role:`tablist`,"as-child":e.asChild,as:e.as,"aria-orientation":f(i).orientation.value},{default:H(()=>[d(e.$slots,`default`)]),_:3},8,[`as-child`,`as`,`aria-orientation`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),Sa=T({__name:`TabsTrigger`,props:{value:{type:[String,Number],required:!0},disabled:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,{forwardRef:r}=Oe(),i=ma(),a=n(()=>_a(i.baseId,t.value)),o=n(()=>i.contentIds.value.has(t.value)?va(i.baseId,t.value):void 0),s=n(()=>t.value===i.modelValue.value);return(e,t)=>(_(),m(f(ea),{"as-child":``,focusable:!e.disabled,active:s.value},{default:H(()=>[E(f(Te),{id:a.value,ref:f(r),role:`tab`,type:e.as===`button`?`button`:void 0,as:e.as,"as-child":e.asChild,"aria-selected":s.value?`true`:`false`,"aria-controls":o.value,"data-state":s.value?`active`:`inactive`,disabled:e.disabled,"data-disabled":e.disabled?``:void 0,"data-orientation":f(i).orientation.value,onMousedown:t[0]||=re(t=>{!e.disabled&&t.ctrlKey===!1?f(i).changeModelValue(e.value):t.preventDefault()},[`left`]),onKeydown:t[1]||=te(t=>f(i).changeModelValue(e.value),[`enter`,`space`]),onFocus:t[2]||=()=>{let t=f(i).activationMode!==`manual`;!s.value&&!e.disabled&&t&&f(i).changeModelValue(e.value)}},{default:H(()=>[d(e.$slots,`default`)]),_:3},8,[`id`,`type`,`as`,`as-child`,`aria-selected`,`aria-controls`,`data-state`,`disabled`,`data-disabled`,`data-orientation`])]),_:3},8,[`focusable`,`active`]))}}),Ca=[`aria-label`],wa=[`title`,`data-tab`,`aria-current`,`onPointerdown`,`onClick`],Ta={key:1,class:`tab-chip-dot`},Ea={class:`tab-chip-label`},Da=[`title`,`aria-label`,`disabled`],Oa=Object.assign(T({__name:`SpaceTabs`,props:{workspace:{},current:{}},setup(e){let t=e,r=n(()=>wt(t.workspace).map(e=>{let t=br(e.panes);return{...e,label:e.tab.label||String(e.tab.number),tone:t&&t.agent?ve(t):``,title:e.panes.map(e=>tr(e)).join(` · `)}}));B(()=>t.current,e=>{e&&Pe(e)},{immediate:!0});let i=e=>`${Z(`Tab`)} ${e}`,a=null,o=jn({onPress:()=>{a&&(X(),Pt(Se(a.id),i(a.label)))}});function s(e,t,n){fi.value&&(a={id:t,label:n},o.down(e))}function c(e){o.swallowClick()||e===t.current||qe(e)}return(t,n)=>{let i=pn,a=mn,l=Ke;return(`spaceTabControls`in t?t.spaceTabControls:f(Pi))(f(r).length).row?(_(),v(`nav`,{key:0,class:`tab-chips space-tabs`,"aria-label":(`t`in t?t.t:f(Z))(`Tabs`)},[(_(!0),v(k,null,y(f(r),r=>(_(),m(a,{key:r.tab.id,disabled:`sheetMenus`in t?t.sheetMenus:f(fi),items:(`sheetMenus`in t?t.sheetMenus:f(fi))?[]:(`toDropdown`in t?t.toDropdown:f(kt))((`tabItems`in t?t.tabItems:f(Se))(r.tab.id)),ui:{content:`hw-dropdown`}},{default:H(()=>[I(`button`,{type:`button`,class:j([`tab-chip`,r.tone]),title:r.title,"data-tab":r.tab.id,"aria-current":r.tab.id===e.current?`page`:void 0,onPointerdown:e=>s(e,r.tab.id,r.label),onPointermove:n[0]||=(...e)=>f(o).move&&f(o).move(...e),onPointerup:n[1]||=(...e)=>f(o).cancel&&f(o).cancel(...e),onPointercancel:n[2]||=(...e)=>f(o).cancel&&f(o).cancel(...e),onContextmenu:n[3]||=e=>(`sheetMenus`in t?t.sheetMenus:f(fi))&&e.preventDefault(),onClick:e=>c(r.tab.id)},[r.panes.length>1?(_(),m(i,{key:0,layout:r.layout,panes:r.panes},null,8,[`layout`,`panes`])):(_(),v(`i`,Ta)),I(`span`,Ea,M(r.label),1)],42,wa)]),_:2},1032,[`disabled`,`items`]))),128)),I(`button`,{type:`button`,class:`tab-chip tab-add`,title:(`t`in t?t.t:f(Z))(`New tab`),"aria-label":(`t`in t?t.t:f(Z))(`New tab`),disabled:`offlineView`in t?t.offlineView:f(Sr),onClick:n[4]||=n=>(`newTab`in t?t.newTab:f(ge))(e.workspace)},[E(l,{name:`i-lucide-plus`})],8,Da)],8,Ca)):g(``,!0)}}}),{__name:`SpaceTabs`}),ka={slots:{base:`font-medium inline-flex items-center`,label:`truncate`,leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,trailingIcon:`shrink-0`},variants:{fieldGroup:{horizontal:`not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]`,vertical:`not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]`},color:{primary:``,neutral:``,success:``,warning:``,error:``,info:``},variant:{solid:``,outline:``,soft:``,subtle:``},size:{xs:{base:`text-[8px]/3 px-1 py-0.5 gap-1 rounded-sm`,leadingIcon:`size-3`,leadingAvatarSize:`3xs`,trailingIcon:`size-3`},sm:{base:`text-[10px]/3 px-1.5 py-1 gap-1 rounded-sm`,leadingIcon:`size-3`,leadingAvatarSize:`3xs`,trailingIcon:`size-3`},md:{base:`text-xs px-2 py-1 gap-1 rounded-md`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`,trailingIcon:`size-4`},lg:{base:`text-sm px-2 py-1 gap-1.5 rounded-md`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`,trailingIcon:`size-5`},xl:{base:`text-base px-2.5 py-1 gap-1.5 rounded-md`,leadingIcon:`size-6`,leadingAvatarSize:`2xs`,trailingIcon:`size-6`}},square:{true:``}},compoundVariants:[{color:`primary`,variant:`solid`,class:`bg-primary text-inverted`},{color:`neutral`,variant:`solid`,class:`bg-neutral text-inverted`},{color:`success`,variant:`solid`,class:`bg-success text-inverted`},{color:`warning`,variant:`solid`,class:`bg-warning text-inverted`},{color:`error`,variant:`solid`,class:`bg-error text-inverted`},{color:`info`,variant:`solid`,class:`bg-info text-inverted`},{color:`primary`,variant:`outline`,class:`text-primary ring ring-inset ring-primary/50`},{color:`neutral`,variant:`outline`,class:`text-neutral ring ring-inset ring-neutral/50`},{color:`success`,variant:`outline`,class:`text-success ring ring-inset ring-success/50`},{color:`warning`,variant:`outline`,class:`text-warning ring ring-inset ring-warning/50`},{color:`error`,variant:`outline`,class:`text-error ring ring-inset ring-error/50`},{color:`info`,variant:`outline`,class:`text-info ring ring-inset ring-info/50`},{color:`primary`,variant:`soft`,class:`bg-primary/10 text-primary`},{color:`neutral`,variant:`soft`,class:`bg-neutral/10 text-neutral`},{color:`success`,variant:`soft`,class:`bg-success/10 text-success`},{color:`warning`,variant:`soft`,class:`bg-warning/10 text-warning`},{color:`error`,variant:`soft`,class:`bg-error/10 text-error`},{color:`info`,variant:`soft`,class:`bg-info/10 text-info`},{color:`primary`,variant:`subtle`,class:`bg-primary/10 text-primary ring ring-inset ring-primary/25`},{color:`neutral`,variant:`subtle`,class:`bg-neutral/10 text-neutral ring ring-inset ring-neutral/25`},{color:`success`,variant:`subtle`,class:`bg-success/10 text-success ring ring-inset ring-success/25`},{color:`warning`,variant:`subtle`,class:`bg-warning/10 text-warning ring ring-inset ring-warning/25`},{color:`error`,variant:`subtle`,class:`bg-error/10 text-error ring ring-inset ring-error/25`},{color:`info`,variant:`subtle`,class:`bg-info/10 text-info ring ring-inset ring-info/25`},{color:`neutral`,variant:`solid`,class:`text-inverted bg-inverted`},{color:`neutral`,variant:`outline`,class:`ring ring-inset ring-accented text-default bg-default`},{color:`neutral`,variant:`soft`,class:`text-default bg-elevated`},{color:`neutral`,variant:`subtle`,class:`ring ring-inset ring-accented text-default bg-elevated`},{size:`xs`,square:!0,class:`p-0.5`},{size:`sm`,square:!0,class:`p-1`},{size:`md`,square:!0,class:`p-1`},{size:`lg`,square:!0,class:`p-1`},{size:`xl`,square:!0,class:`p-1`}],defaultVariants:{color:`primary`,variant:`solid`,size:`md`}},Aa={__name:`UBadge`,props:{as:{type:null,required:!1,default:`span`},label:{type:[String,Number],required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},square:{type:Boolean,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1}},setup(e){let t=e,r=O(),i=Re(`badge`,t),a=er(),{orientation:o,size:s}=Me(t),{isLeading:c,isTrailing:l,leadingIconName:u,trailingIconName:p}=Dt(i),h=n(()=>ot({extend:ka,...a.ui?.badge||{}})({color:i.color,variant:i.variant,size:s.value??i.size,square:i.square||!r.default&&!i.label,fieldGroup:o.value}));return(e,t)=>(_(),m(f(Te),{as:f(i).as,"data-slot":`base`,class:j(h.value.base({class:[f(i).ui?.base,f(i).class]}))},{default:H(()=>[d(e.$slots,`leading`,{ui:h.value},()=>[f(c)&&f(u)?(_(),m(Ke,{key:0,name:f(u),"data-slot":`leadingIcon`,class:j(h.value.leadingIcon({class:f(i).ui?.leadingIcon}))},null,8,[`name`,`class`])):f(i).avatar?(_(),m(Ct,z({key:1,size:f(i).ui?.leadingAvatarSize||h.value.leadingAvatarSize()},f(i).avatar,{"data-slot":`leadingAvatar`,class:h.value.leadingAvatar({class:f(i).ui?.leadingAvatar})}),null,16,[`size`,`class`])):g(``,!0)]),d(e.$slots,`default`,{ui:h.value},()=>[f(i).label!==void 0&&f(i).label!==null?(_(),v(`span`,{key:0,"data-slot":`label`,class:j(h.value.label({class:f(i).ui?.label}))},M(f(i).label),3)):g(``,!0)]),d(e.$slots,`trailing`,{ui:h.value},()=>[f(l)&&f(p)?(_(),m(Ke,{key:0,name:f(p),"data-slot":`trailingIcon`,class:j(h.value.trailingIcon({class:f(i).ui?.trailingIcon}))},null,8,[`name`,`class`])):g(``,!0)])]),_:3},8,[`as`,`class`]))}},ja={slots:{root:`flex items-center gap-2`,list:`relative flex p-1 group`,indicator:`absolute transition-[translate,width] duration-200 ease-out motion-reduce:transition-none`,trigger:[`group relative inline-flex items-center min-w-0 data-[state=inactive]:text-muted hover:data-[state=inactive]:not-disabled:text-default font-medium rounded-md disabled:cursor-not-allowed disabled:opacity-75`,`transition-colors`],leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,label:`truncate`,trailingBadge:`shrink-0`,trailingBadgeSize:`sm`,content:`w-full rounded-md focus-visible:outline-3`},variants:{color:{primary:{content:`outline-primary/25`},neutral:{content:`outline-inverted/25`},success:{content:`outline-success/25`},warning:{content:`outline-warning/25`},error:{content:`outline-error/25`},info:{content:`outline-info/25`}},variant:{pill:{list:`bg-elevated rounded-lg`,trigger:[`grow`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:content-[''] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:absolute in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:inset-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:rounded-md in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:shadow-xs in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:-z-10 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:isolate`],indicator:`rounded-md shadow-xs`},link:{list:`border-default`,indicator:`rounded-full`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:content-[''] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:absolute in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:rounded-full`}},orientation:{horizontal:{root:`flex-col`,list:`w-full`,indicator:`left-0 w-(--reka-tabs-indicator-size) translate-x-(--reka-tabs-indicator-position)`,trigger:`justify-center`},vertical:{list:`flex-col`,indicator:`top-0 h-(--reka-tabs-indicator-size) translate-y-(--reka-tabs-indicator-position)`}},size:{xs:{trigger:`px-2 py-1 text-xs gap-1`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`},sm:{trigger:`px-2.5 py-1.5 text-xs gap-1.5`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`},md:{trigger:`px-3 py-1.5 text-sm gap-1.5`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},lg:{trigger:`px-3 py-2 text-sm gap-2`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},xl:{trigger:`px-3 py-2 text-base gap-2`,leadingIcon:`size-6`,leadingAvatarSize:`xs`}}},compoundVariants:[{orientation:`horizontal`,variant:`pill`,class:{indicator:`inset-y-1`}},{orientation:`horizontal`,variant:`link`,class:{list:`border-b -mb-px`,indicator:`-bottom-px h-px`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:inset-x-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:-bottom-[calc(var(--spacing)+1px)] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:h-px`}},{orientation:`vertical`,variant:`pill`,class:{indicator:`inset-x-1`,list:`items-center`,trigger:`w-full justify-center`}},{orientation:`vertical`,variant:`link`,class:{list:`border-s -ms-px`,indicator:`-start-px w-px`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:inset-y-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:-start-[calc(var(--spacing)+1px)] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:w-px`}},{color:`primary`,variant:`pill`,class:{indicator:`bg-primary`,trigger:[`data-[state=active]:text-inverted outline-primary/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-primary`]}},{color:`neutral`,variant:`pill`,class:{indicator:`bg-neutral`,trigger:[`data-[state=active]:text-inverted outline-neutral/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-neutral`]}},{color:`success`,variant:`pill`,class:{indicator:`bg-success`,trigger:[`data-[state=active]:text-inverted outline-success/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-success`]}},{color:`warning`,variant:`pill`,class:{indicator:`bg-warning`,trigger:[`data-[state=active]:text-inverted outline-warning/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-warning`]}},{color:`error`,variant:`pill`,class:{indicator:`bg-error`,trigger:[`data-[state=active]:text-inverted outline-error/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-error`]}},{color:`info`,variant:`pill`,class:{indicator:`bg-info`,trigger:[`data-[state=active]:text-inverted outline-info/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-info`]}},{color:`neutral`,variant:`pill`,class:{indicator:`bg-inverted`,trigger:[`data-[state=active]:text-inverted outline-inverted/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-inverted`]}},{color:`primary`,variant:`link`,class:{indicator:`bg-primary`,trigger:[`data-[state=active]:text-primary outline-primary/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-primary`]}},{color:`neutral`,variant:`link`,class:{indicator:`bg-neutral`,trigger:[`data-[state=active]:text-neutral outline-neutral/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-neutral`]}},{color:`success`,variant:`link`,class:{indicator:`bg-success`,trigger:[`data-[state=active]:text-success outline-success/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-success`]}},{color:`warning`,variant:`link`,class:{indicator:`bg-warning`,trigger:[`data-[state=active]:text-warning outline-warning/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-warning`]}},{color:`error`,variant:`link`,class:{indicator:`bg-error`,trigger:[`data-[state=active]:text-error outline-error/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-error`]}},{color:`info`,variant:`link`,class:{indicator:`bg-info`,trigger:[`data-[state=active]:text-info outline-info/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-info`]}},{color:`neutral`,variant:`link`,class:{indicator:`bg-inverted`,trigger:[`data-[state=active]:text-highlighted outline-inverted/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-inverted`]}}],defaultVariants:{color:`primary`,variant:`pill`,size:`md`}},Ma={__name:`UTabs`,props:{as:{type:null,required:!1},items:{type:Array,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},orientation:{type:null,required:!1,default:`horizontal`},content:{type:Boolean,required:!1,default:!0},valueKey:{type:null,required:!1,default:`value`},labelKey:{type:null,required:!1,default:`label`},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultValue:{type:[String,Number],required:!1,default:`0`},modelValue:{type:[String,Number],required:!1},activationMode:{type:String,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let i=e,o=r,s=O(),c=Re(`tabs`,i),l=er(),u=Nt(Ne(c,`as`,`unmountOnHide`),o),p=n(()=>ot({extend:ja,...l.ui?.tabs||{}})({color:c.color,variant:c.variant,size:c.size,orientation:c.orientation})),b=h([]);function x(e,t){b.value[e]=t}return t({triggersRef:b}),(e,t)=>(_(),m(f(ga),z(f(u),{"model-value":f(c).modelValue,"default-value":f(c).defaultValue,orientation:f(c).orientation,"activation-mode":f(c).activationMode,"data-slot":`root`,class:p.value.root({class:[f(c).ui?.root,f(c).class]})}),{default:H(()=>[E(f(xa),{"data-slot":`list`,class:j(p.value.list({class:f(c).ui?.list}))},{default:H(()=>[E(f(ba),{"data-slot":`indicator`,class:j(p.value.indicator({class:f(c).ui?.indicator}))},null,8,[`class`]),d(e.$slots,`list-leading`),(_(!0),v(k,null,y(f(c).items,(t,n)=>(_(),m(f(Sa),{key:f(At)(t,f(c).valueKey)??n,ref_for:!0,ref:e=>x(n,e),value:f(At)(t,f(c).valueKey)??String(n),disabled:t.disabled,"data-slot":`trigger`,class:j(p.value.trigger({class:[f(c).ui?.trigger,t.ui?.trigger]}))},{default:H(()=>[d(e.$slots,`leading`,{item:t,index:n,ui:p.value},()=>[t.icon?(_(),m(Ke,{key:0,name:t.icon,"data-slot":`leadingIcon`,class:j(p.value.leadingIcon({class:[f(c).ui?.leadingIcon,t.ui?.leadingIcon]}))},null,8,[`name`,`class`])):t.avatar?(_(),m(Ct,z({key:1,size:t.ui?.leadingAvatarSize||f(c).ui?.leadingAvatarSize||p.value.leadingAvatarSize()},{ref_for:!0},t.avatar,{"data-slot":`leadingAvatar`,class:p.value.leadingAvatar({class:[f(c).ui?.leadingAvatar,t.ui?.leadingAvatar]})}),null,16,[`size`,`class`])):g(``,!0)]),f(At)(t,f(c).labelKey)||s.default?(_(),v(`span`,{key:0,"data-slot":`label`,class:j(p.value.label({class:[f(c).ui?.label,t.ui?.label]}))},[d(e.$slots,`default`,{item:t,index:n},()=>[a(M(f(At)(t,f(c).labelKey)),1)])],2)):g(``,!0),d(e.$slots,`trailing`,{item:t,index:n,ui:p.value},()=>[t.badge||t.badge===0?(_(),m(Aa,z({key:0,color:`neutral`,variant:`outline`,size:t.ui?.trailingBadgeSize||f(c).ui?.trailingBadgeSize||p.value.trailingBadgeSize()},{ref_for:!0},typeof t.badge==`string`||typeof t.badge==`number`?{label:t.badge}:t.badge,{"data-slot":`trailingBadge`,class:p.value.trailingBadge({class:[f(c).ui?.trailingBadge,t.ui?.trailingBadge]})}),null,16,[`size`,`class`])):g(``,!0)])]),_:2},1032,[`value`,`disabled`,`class`]))),128)),d(e.$slots,`list-trailing`)]),_:3},8,[`class`]),f(c).content?(_(!0),v(k,{key:0},y(f(c).items,(t,n)=>(_(),m(f(ya),{key:f(At)(t,f(c).valueKey)??n,value:f(At)(t,f(c).valueKey)??String(n),"data-slot":`content`,class:j(p.value.content({class:[f(c).ui?.content,t.ui?.content,t.class]}))},{default:H(()=>[d(e.$slots,t.slot||`content`,{item:t,index:n,ui:p.value},()=>[a(M(t.content),1)])]),_:2},1032,[`value`,`class`]))),128)):g(``,!0)]),_:3},16,[`model-value`,`default-value`,`orientation`,`activation-mode`,`class`]))}},Na=`input, textarea, select, [contenteditable=""], [contenteditable="true"], .xterm, .term, .chat-list, .msg`,Pa=`button, a, [role="tab"], [role="button"]:not(.plan-cell), .cell-grip, ${Na}`;function Fa(e){return!!e?.closest?.(Na)}function Ia(e){return!!e?.closest?.(Pa)}var La=Object.assign(ca(T({__name:`HeaderMenu`,props:{items:{type:Function},title:{},disabled:{type:Boolean},manualPress:{type:Boolean}},setup(e){let t=e,n=h([]);function r(){document.dispatchEvent(new KeyboardEvent(`keydown`,{key:`Escape`,bubbles:!0}))}function i(e){e?(n.value=kt(t.items()),window.addEventListener(`scroll`,r,{capture:!0,passive:!0})):window.removeEventListener(`scroll`,r,{capture:!0})}l(()=>window.removeEventListener(`scroll`,r,{capture:!0}));let a=``;function o(e){Fa(e.target)?e.stopPropagation():fi.value&&(e.preventDefault(),a===`mouse`&&!t.disabled&&Pt(t.items(),t.title))}let s=jn({onPress:()=>{X(),Pt(t.items(),t.title)}});function c(e){a=e.pointerType,!(!fi.value||t.disabled||t.manualPress||Ia(e.target))&&s.down(e)}return(t,r)=>{let a=mn;return _(),m(a,{disabled:(`sheetMenus`in t?t.sheetMenus:f(fi))||e.disabled,items:f(n),ui:{content:`hw-dropdown`},"onUpdate:open":i},{default:H(()=>[I(`div`,{class:`header-menu`,onContextmenuCapture:o,onPointerdown:c,onPointermove:r[0]||=(...e)=>f(s).move&&f(s).move(...e),onPointerup:r[1]||=(...e)=>f(s).cancel&&f(s).cancel(...e),onPointercancel:r[2]||=(...e)=>f(s).cancel&&f(s).cancel(...e)},[d(t.$slots,`default`,{},void 0,!0)],32)]),_:3},8,[`disabled`,`items`])}}}),[[`__scopeId`,`data-v-562a5bfa`]]),{__name:`HeaderMenu`}),Ra=Object.assign(ca(T({__name:`GridBackdrop`,setup(e){let t=h(null),n=h(null),r=h(!1),i,a=!1,o=0,s;function c(){let e=n.value;if(!e||o>=3)return;let t=ie(e.clientWidth,e.clientHeight),r=document.createElement(`i`);r.className=`pkt ${t.vertical?`v`:`h`}${t.reverse?` rev`:``}${t.alt?` alt`:``}`,r.style.left=`${t.left}px`,r.style.top=`${t.top}px`;let i=t.vertical?`Y`:`X`;e.appendChild(r),o++;let a=r.animate([{transform:`translate${i}(${t.reverse?t.dist:0}px)`,opacity:0},{opacity:1,offset:.15},{opacity:1,offset:.7},{transform:`translate${i}(${t.reverse?0:t.dist}px)`,opacity:0}],{duration:t.duration,easing:`cubic-bezier(.4, 0, .6, 1)`});a.onfinish=()=>{r.remove(),o--}}function l(){clearTimeout(s),!a&&rt.value&&r.value&&!document.hidden&&(s=setTimeout(()=>{c(),l()},It()))}return B([r,rt],l),w(()=>{a=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,document.addEventListener(`visibilitychange`,l),t.value&&(i=new IntersectionObserver(([e])=>{r.value=!!e?.isIntersecting}),i.observe(t.value))}),U(()=>{i?.disconnect(),document.removeEventListener(`visibilitychange`,l),clearTimeout(s)}),(e,r)=>(_(),v(`div`,{ref_key:`root`,ref:t,class:`grid-backdrop`,"aria-hidden":`true`},[r[0]||=I(`div`,{class:`gbd-dots`},null,-1),I(`div`,{ref_key:`packets`,ref:n,class:`gbd-packets`},null,512),r[1]||=I(`div`,{class:`gbd-vignette`},null,-1)],512))}}),[[`__scopeId`,`data-v-a290ab6b`]]),{__name:`GridBackdrop`}),za={class:`chat-skel`,"aria-hidden":`true`},Ba=Object.assign(T({__name:`ChatSkeleton`,props:{agent:{}},setup(e){return(t,n)=>(_(),v(`div`,za,[n[0]||=I(`div`,{class:`skel-user`},[I(`i`,{style:{width:`78%`}}),I(`i`,{style:{width:`52%`}})],-1),I(`div`,{class:j([`skel-who`,e.agent||``])},null,2),n[1]||=ee(`<div class="skel-tool"><span></span><i style="width:62%;"></i></div><div class="skel-lines"><i style="width:92%;"></i><i style="width:84%;"></i><i style="width:66%;"></i></div><div class="skel-user"><i style="width:64%;"></i></div>`,3),I(`div`,{class:j([`skel-who`,e.agent||``])},null,2),n[2]||=ee(`<div class="skel-lines"><i style="width:90%;"></i><i style="width:86%;"></i><i style="width:80%;"></i><i style="width:42%;"></i></div>`,1)]))}}),{__name:`ChatSkeleton`}),Va=[`aria-expanded`],Ha=Object.assign(T({__name:`FoldText`,props:{lines:{}},setup(e){let t=e,r=n(()=>t.lines||12),i=h(null),a=h(!1),o=h(!1),s=null;function l(){let e=i.value;if(!e)return;let t=(Number.parseFloat(getComputedStyle(e).lineHeight)||22.5)*(r.value+.5);a.value=e.scrollHeight>t}return w(()=>{l(),s=new ResizeObserver(l),i.value&&s.observe(i.value)}),c(l),U(()=>s?.disconnect()),(e,n)=>(_(),v(k,null,[I(`span`,{ref_key:`box`,ref:i,class:j([`msg-fold`,{folded:f(a)&&!f(o)}]),style:N({display:`block`,"--fold-max":t.lines?`calc(${t.lines}lh)`:void 0})},[d(e.$slots,`default`)],6),f(a)?(_(),v(`button`,{key:0,type:`button`,class:`msg-fold-btn`,"aria-expanded":f(o),onClick:n[0]||=e=>o.value=!f(o)},M(f(o)?(`tl`in e?e.tl:f(Q))(`Show less`,`Afficher moins`):(`tl`in e?e.tl:f(Q))(`Show more`,`Afficher plus`)),9,Va)):g(``,!0)],64))}}),{__name:`FoldText`}),Ua={class:`msg-system`},Wa={class:`msg-autopilot-body`},Ga={class:`msg-autopilot-text`},Ka=Object.assign(T({__name:`AutopilotMessage`,props:{text:{}},emits:[`copy`],setup(e,{emit:t}){let r=t,i=h(!1),o=h(!1),s=h(!1),c=n(()=>i.value&&(o.value||s.value)),l;function u(){i.value=l?.matches??!1,o.value=!1,s.value=!1}function d(e){s.value=e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget)}return w(()=>{l=window.matchMedia(`(hover: hover) and (pointer: fine)`),u(),l.addEventListener(`change`,u)}),U(()=>l?.removeEventListener(`change`,u)),(t,n)=>{let l=Ha,u=_t;return _(),v(`div`,{class:`msg-autopilot`,onMouseenter:n[1]||=e=>o.value=!0,onMouseleave:n[2]||=e=>o.value=!1,onFocusin:n[3]||=e=>s.value=!0,onFocusout:d},[I(`div`,Ua,[I(`span`,null,M((`t`in t?t.t:f(Z))(`Autopilot`)),1)]),I(`div`,Wa,[I(`div`,Ga,[E(l,null,{default:H(()=>[a(M(e.text),1)]),_:1})]),L(E(u,{class:`msg-autopilot-copy`,style:N({opacity:+!!f(c),pointerEvents:f(c)?`auto`:`none`}),icon:`i-lucide-copy`,color:`neutral`,variant:`ghost`,size:`xs`,"aria-label":(`t`in t?t.t:f(Z))(`Copy message`),onClick:n[0]||=t=>r(`copy`,e.text)},null,8,[`style`,`aria-label`]),[[ne,f(i)]])])],32)}}}),{__name:`AutopilotMessage`}),qa={key:0,class:`offline-image`},Ja=[`src`,`onClick`],Ya=[`aria-label`],Xa=[`src`],Za=[`disabled`,`onClick`],Qa=Object.assign(T({__name:`MsgThumbs`,props:{srcs:{},offline:{type:Boolean},max:{},dupes:{}},setup(e){let t=e,r=n(()=>t.srcs.map((e,t)=>({src:e,i:t})).filter(e=>!t.dupes?.has(e.src))),i=n(()=>t.srcs.map((e,t)=>({src:e,i:t})).filter(e=>t.dupes?.has(e.src))),a=n(()=>Y(r.value.length,t.max));function o(e){Ot(t.srcs,e)}return(t,n)=>(_(),v(`span`,{class:j([`thumbs`,{one:f(r).length===1}])},[(_(!0),v(k,null,y(f(r).slice(0,f(a).shown),n=>(_(),v(`span`,{key:n.src},[e.offline?(_(),v(`span`,qa,M((`t`in t?t.t:f(Z))(`Image unavailable offline`)),1)):(_(),v(`img`,{key:1,class:`msg-img`,src:n.src,alt:``,loading:`lazy`,decoding:`async`,onClick:e=>o(n.i)},null,8,Ja))]))),128)),f(a).more?(_(),v(`button`,{key:0,type:`button`,class:`thumb-more`,"aria-label":(`tl`in t?t.tl:f(Q))(`Show all ${f(r).length} images`,`Voir les ${f(r).length} images`),onClick:n[0]||=e=>o(f(r)[f(a).shown].i)},[e.offline?g(``,!0):(_(),v(`img`,{key:0,src:f(r)[f(a).shown].src,alt:``,loading:`lazy`,decoding:`async`},null,8,Xa)),I(`span`,null,`+`+M(f(a).more),1)],8,Ya)):g(``,!0),(_(!0),v(k,null,y(f(i),n=>(_(),v(`button`,{key:n.src,type:`button`,class:`thumb-dupe`,disabled:e.offline,onClick:e=>o(n.i)},` ↑ `+M((`tl`in t?t.tl:f(Q))(`Same image as above`,`Image déjà affichée plus haut`)),9,Za))),128))],2))}}),{__name:`MsgThumbs`}),$a={class:`file-chip-icon`},eo={key:0,class:`spinner`},to={class:`file-chip-body`},no={class:`file-chip-name`},ro={class:`file-chip-meta`},io=[`aria-label`],ao=Object.assign(T({__name:`FileChip`,props:{name:{},size:{},kind:{},uploading:{type:Boolean},removable:{type:Boolean},clickable:{type:Boolean}},emits:[`remove`,`open`],setup(e,{emit:t}){let r=e,i=t,a=n(()=>Sn(r.name,r.kind)),o=n(()=>In(r.name).slice(0,6)||(r.kind===`text`?`txt`:``));function s(e){r.clickable&&i(`open`,e.currentTarget)}return(t,n)=>{let r=Ke;return _(),m(C(e.clickable?`button`:`div`),{type:e.clickable?`button`:void 0,class:j([`file-chip`,{up:e.uploading,clickable:e.clickable}]),title:e.name,onClick:s},{default:H(()=>[I(`span`,$a,[e.uploading?(_(),v(`span`,eo)):(_(),m(r,{key:1,name:f(a)},null,8,[`name`]))]),I(`span`,to,[I(`span`,no,M(e.name),1),I(`span`,ro,M([f(o),e.size?f(qn)(e.size):``].filter(Boolean).join(` · `)),1)]),e.removable?(_(),v(`button`,{key:0,type:`button`,class:`file-chip-x`,"aria-label":(`t`in t?t.t:f(Z))(`Remove`),onClick:n[0]||=re(e=>i(`remove`),[`stop`])},[E(r,{name:`i-lucide-x`})],8,io)):g(``,!0)]),_:1},8,[`type`,`class`,`title`])}}}),{__name:`FileChip`}),oo={key:0,class:`msg-ref-meta`},so={class:`msg-ref-text`},co={key:1,class:`msg-q`},lo=Object.assign(T({__name:`QuotedText`,props:{text:{}},setup(e){let t=e,r=n(()=>ri(t.text).map(e=>e.kind===`ref`?e:{...e,text:e.text.replace(/^\n+|\n+$/g,``)}).filter(e=>e.kind===`ref`||e.text)),i=A(`gotoRef`,null),o=e=>e.kind===`task`?e.label.replace(/\s*:$/,``):[e.time,e.n?`#${e.n}`:``].filter(Boolean).join(` · `);return(e,t)=>(_(!0),v(k,null,y(f(r),(n,r)=>(_(),v(k,{key:r},[n.kind===`ref`?(_(),m(C(f(i)&&n.ref.kind!==`task`?`button`:`span`),{key:0,class:`msg-ref`,"data-kind":n.ref.kind,type:f(i)&&n.ref.kind!==`task`?`button`:void 0,"aria-label":f(i)&&n.ref.kind!==`task`?`${(`t`in e?e.t:f(Z))(`Show original message`)}: ${n.ref.excerpt}`:void 0,onClick:e=>f(i)&&n.ref.kind!==`task`&&f(i)(n.ref,e.currentTarget)},{default:H(()=>[t[0]||=I(`span`,{class:`msg-ref-mark`,"aria-hidden":`true`},`↳`,-1),o(n.ref)?(_(),v(`span`,oo,M(o(n.ref)),1)):g(``,!0),I(`span`,so,M(n.ref.excerpt),1)]),_:2},1032,[`data-kind`,`type`,`aria-label`,`onClick`])):n.kind===`quote`?(_(),v(`span`,co,M(n.text),1)):(_(),v(k,{key:2},[a(M(n.text),1)],64))],64))),128))}}),{__name:`QuotedText`}),uo=[`aria-label`],fo={class:`pasted-head`},po=[`aria-label`],mo={class:`pasted-foot`},ho=Object.assign(T({__name:`PastedCard`,props:{text:{},removable:{type:Boolean}},emits:[`remove`],setup(e,{emit:t}){let r=e,i=t,o=h(!1),s=n(()=>gt(r.text)),c=n(()=>r.text.split(`
2
- `).filter(e=>e.trim()).slice(0,2).map(e=>e.trim())),l=n(()=>$e(r.text)),u=n(()=>Q(`Pasted text · ${s.value} line${s.value>1?`s`:``}`,`Texte collé · ${s.value} ligne${s.value>1?`s`:``}`));async function d(){try{await navigator.clipboard.writeText(r.text),$(Q(`Text copied`,`Texte copié`))}catch{$(Z(`Copy failed`),!0)}}return(t,n)=>{let r=Ke,s=_t,p=Gt;return _(),v(`div`,{class:j([`pasted-card`,{removable:e.removable}])},[I(`button`,{type:`button`,class:`pasted-open`,"aria-label":(`tl`in t?t.tl:f(Q))(`Open pasted text`,`Ouvrir le texte collé`),onClick:n[0]||=e=>o.value=!0},[I(`span`,fo,[E(r,{name:`i-lucide-clipboard-paste`}),a(M(f(u)),1)]),(_(!0),v(k,null,y(f(c),(e,t)=>(_(),v(`span`,{key:t,class:`pasted-line`},M(e),1))),128))],8,uo),e.removable?(_(),v(`button`,{key:0,type:`button`,class:`pasted-x`,"aria-label":(`t`in t?t.t:f(Z))(`Remove`),onClick:n[1]||=re(e=>i(`remove`),[`stop`])},[E(r,{name:`i-lucide-x`})],8,po)):g(``,!0),E(p,{open:f(o),"onUpdate:open":n[2]||=e=>G(o)?o.value=e:null,title:f(u),wide:``,tall:``},{footer:H(()=>[I(`div`,mo,[E(s,{icon:`i-lucide-copy`,color:`neutral`,variant:`outline`,onClick:d},{default:H(()=>[a(M((`tl`in t?t.tl:f(Q))(`Copy`,`Copier`)),1)]),_:1})])]),default:H(()=>[I(`pre`,{class:j([`pasted-full`,{mono:f(l)}])},M(e.text),3)]),_:1},8,[`open`,`title`])],2)}}}),{__name:`PastedCard`}),go={key:1,class:`msg-pastes`},_o=Object.assign(T({__name:`UserText`,props:{text:{},pasted:{}},setup(e){let t=e,r=n(()=>ut(t.text,t.pasted,xt.value));return(e,t)=>{let n=lo,i=Ha,a=ho;return _(),v(k,null,[f(r).text?(_(),m(i,{key:0},{default:H(()=>[E(n,{text:f(r).text},null,8,[`text`])]),_:1})):g(``,!0),f(r).pastes.length?(_(),v(`span`,go,[(_(!0),v(k,null,y(f(r).pastes,(e,t)=>(_(),m(a,{key:t,text:e},null,8,[`text`]))),128))])):g(``,!0)],64)}}}),{__name:`UserText`}),vo={slots:{root:`group/message relative w-full`,header:`flex mb-1.5`,container:`relative flex items-start`,body:`min-w-0`,leading:`inline-flex items-center justify-center min-h-6`,leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,files:`flex items-center gap-1.5`,content:`relative text-pretty wrap-break-word *:first:mt-0 *:last:mb-0`,actions:[`[@media(hover:hover)]:opacity-0 group-hover/message:opacity-100 absolute bottom-0 flex items-center`,`transition-opacity ease-out`]},variants:{variant:{solid:``,outline:``,soft:``,subtle:``,naked:``},color:{primary:``,neutral:``,success:``,warning:``,error:``,info:``},side:{left:{},right:{container:`justify-end ms-auto max-w-[75%]`,header:`justify-end`,actions:`right-0`}},leading:{true:``},actions:{true:``},compact:{true:{root:`scroll-mt-3`,container:`gap-1.5 pb-3`,content:`space-y-2`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},false:{root:`scroll-mt-4 sm:scroll-mt-6`,container:`gap-3 pb-8`,content:`space-y-4`,leadingIcon:`size-8`,leadingAvatarSize:`md`}}},compoundVariants:[{compact:!0,actions:!0,class:{container:`pb-8`}},{variant:[`solid`,`outline`,`soft`,`subtle`],compact:!1,class:{content:`px-4 py-3 rounded-lg min-h-12`,leading:`mt-2`}},{variant:[`solid`,`outline`,`soft`,`subtle`],compact:!0,class:{content:`px-2 py-1 rounded-lg min-h-8`,leading:`mt-1`}},{variant:`naked`,side:`left`,class:{body:`w-full`,content:`w-full`}},{color:`primary`,variant:`solid`,class:{content:`bg-primary text-inverted`}},{color:`neutral`,variant:`solid`,class:{content:`bg-neutral text-inverted`}},{color:`success`,variant:`solid`,class:{content:`bg-success text-inverted`}},{color:`warning`,variant:`solid`,class:{content:`bg-warning text-inverted`}},{color:`error`,variant:`solid`,class:{content:`bg-error text-inverted`}},{color:`info`,variant:`solid`,class:{content:`bg-info text-inverted`}},{color:`primary`,variant:`outline`,class:{content:`text-primary ring ring-primary/25`}},{color:`neutral`,variant:`outline`,class:{content:`text-neutral ring ring-neutral/25`}},{color:`success`,variant:`outline`,class:{content:`text-success ring ring-success/25`}},{color:`warning`,variant:`outline`,class:{content:`text-warning ring ring-warning/25`}},{color:`error`,variant:`outline`,class:{content:`text-error ring ring-error/25`}},{color:`info`,variant:`outline`,class:{content:`text-info ring ring-info/25`}},{color:`primary`,variant:`soft`,class:{content:`bg-primary/10 text-primary`}},{color:`neutral`,variant:`soft`,class:{content:`bg-neutral/10 text-neutral`}},{color:`success`,variant:`soft`,class:{content:`bg-success/10 text-success`}},{color:`warning`,variant:`soft`,class:{content:`bg-warning/10 text-warning`}},{color:`error`,variant:`soft`,class:{content:`bg-error/10 text-error`}},{color:`info`,variant:`soft`,class:{content:`bg-info/10 text-info`}},{color:`primary`,variant:`subtle`,class:{content:`bg-primary/10 text-primary ring ring-primary/25`}},{color:`neutral`,variant:`subtle`,class:{content:`bg-neutral/10 text-neutral ring ring-neutral/25`}},{color:`success`,variant:`subtle`,class:{content:`bg-success/10 text-success ring ring-success/25`}},{color:`warning`,variant:`subtle`,class:{content:`bg-warning/10 text-warning ring ring-warning/25`}},{color:`error`,variant:`subtle`,class:{content:`bg-error/10 text-error ring ring-error/25`}},{color:`info`,variant:`subtle`,class:{content:`bg-info/10 text-info ring ring-info/25`}},{color:`primary`,variant:`naked`,class:{content:`text-primary`}},{color:`neutral`,variant:`naked`,class:{content:`text-neutral`}},{color:`success`,variant:`naked`,class:{content:`text-success`}},{color:`warning`,variant:`naked`,class:{content:`text-warning`}},{color:`error`,variant:`naked`,class:{content:`text-error`}},{color:`info`,variant:`naked`,class:{content:`text-info`}},{color:`neutral`,variant:`solid`,class:{content:`bg-inverted text-inverted`}},{color:`neutral`,variant:`outline`,class:{content:`bg-default ring ring-default`}},{color:`neutral`,variant:`soft`,class:{content:`bg-elevated/50`}},{color:`neutral`,variant:`subtle`,class:{content:`bg-elevated/50 ring ring-default`}}],defaultVariants:{side:`left`,variant:`naked`,color:`neutral`}},yo={__name:`UChatMessage`,props:{as:{type:null,required:!1,default:`article`},icon:{type:null,required:!1},avatar:{type:Object,required:!1},variant:{type:null,required:!1},color:{type:null,required:!1},side:{type:null,required:!1},actions:{type:Array,required:!1},compact:{type:Boolean,required:!1},content:{type:String,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},id:{type:String,required:!0},role:{type:String,required:!0},metadata:{type:null,required:!1},parts:{type:Array,required:!0}},setup(e){let r=e,i=O(),o=Re(`chatMessage`,r),s=er(),c=n(()=>o.parts?.filter(e=>e.type===`file`)??[]),l=n(()=>o.parts?.filter(e=>e.type===`text`)??[]),u=n(()=>oe(o,[`as`,`icon`,`avatar`,`variant`,`color`,`side`,`actions`,`compact`,`class`,`ui`,`content`])),p=n(()=>ot({extend:vo,...s.ui?.chatMessage||{}})({variant:o.variant,color:o.color,side:o.side,leading:!!o.icon||!!o.avatar||!!i.leading,actions:!!o.actions||!!i.actions,compact:o.compact}));return(e,n)=>(_(),m(f(Te),{as:f(o).as,"data-role":f(o).role,"data-slot":`root`,class:j(p.value.root({class:[f(o).ui?.root,f(o).class]}))},{default:H(()=>[i.files&&c.value.length||i.header?(_(),v(`div`,{key:0,"data-slot":`header`,class:j(p.value.header({class:f(o).ui?.header}))},[d(e.$slots,`header`,R(t({...u.value})),()=>[i.files&&c.value.length?(_(),v(`div`,{key:0,"data-slot":`files`,class:j(p.value.files({class:f(o).ui?.files}))},[d(e.$slots,`files`,R(t({...u.value,parts:c.value})))],2)):g(``,!0)])],2)):g(``,!0),I(`div`,{"data-slot":`container`,class:j(p.value.container({class:f(o).ui?.container}))},[f(o).icon||f(o).avatar||i.leading?(_(),v(`div`,{key:0,"data-slot":`leading`,class:j(p.value.leading({class:f(o).ui?.leading}))},[d(e.$slots,`leading`,R(t({...u.value,avatar:f(o).avatar,ui:p.value})),()=>[f(o).icon?(_(),m(Ke,{key:0,name:f(o).icon,"data-slot":`leadingIcon`,class:j(p.value.leadingIcon({class:f(o).ui?.leadingIcon}))},null,8,[`name`,`class`])):f(o).avatar?(_(),m(Ct,z({key:1,size:f(o).ui?.leadingAvatarSize||p.value.leadingAvatarSize()},f(o).avatar,{"data-slot":`leadingAvatar`,class:p.value.leadingAvatar({class:f(o).ui?.leadingAvatar})}),null,16,[`size`,`class`])):g(``,!0)])],2)):g(``,!0),f(o).content||l.value.length||i.content||f(o).actions||i.actions||i.body?(_(),v(`div`,{key:1,"data-slot":`body`,class:j(p.value.body({class:f(o).ui?.body}))},[d(e.$slots,`body`,R(t({...u.value})),()=>[f(o).content||l.value.length||i.content?(_(),v(`div`,{key:0,"data-slot":`content`,class:j(p.value.content({class:f(o).ui?.content}))},[d(e.$slots,`content`,R(t({...u.value,content:f(o).content})),()=>[f(o).content?(_(),v(k,{key:0},[a(M(f(o).content),1)],64)):(_(!0),v(k,{key:1},y(l.value,(e,t)=>(_(),v(k,{key:`${f(o).id}-${e.type}-${t}`},[a(M(e.text),1)],64))),128))])],2)):g(``,!0),f(o).actions||i.actions?(_(),v(`div`,{key:1,"data-slot":`actions`,class:j(p.value.actions({class:f(o).ui?.actions}))},[d(e.$slots,`actions`,R(t({...u.value,actions:f(o).actions})),()=>[(_(!0),v(k,null,y(f(o).actions,(e,t)=>(_(),m(mt,{key:t,text:e.label},{default:H(()=>[E(_t,z({size:`sm`,color:`neutral`,variant:`ghost`},{ref_for:!0},f(oe)(e,[`onClick`]),{label:void 0,onClick:t=>typeof e.onClick==`function`?e.onClick(t,u.value):void 0}),null,16,[`onClick`])]),_:2},1032,[`text`]))),128))])],2)):g(``,!0)])],2)):g(``,!0)],2)]),_:3},8,[`as`,`data-role`,`class`]))}};function bo(e,t={}){let{arrivedState:r}=Et(e);return{style:n(()=>{let n=o(e),i=o(t.orientation)??`vertical`,[a,s]=i===`horizontal`?[`left`,`right`]:[`top`,`bottom`],c=!r[a],l=!r[s];if(!c&&!l||!(n&&(i===`horizontal`?n.scrollWidth>n.clientWidth:n.scrollHeight>n.clientHeight)))return;let u=`${o(t.size)??24}px`,d=i===`horizontal`?`90deg`:`180deg`;return c&&l?{maskImage:`linear-gradient(${d}, transparent, #000 ${u}, #000 calc(100% - ${u}), transparent)`}:c?{maskImage:`linear-gradient(${d}, transparent, #000 ${u})`}:{maskImage:`linear-gradient(${d}, #000, #000 calc(100% - ${u}), transparent)`}}),isOverflowing:n(()=>{r.top,r.bottom,r.left,r.right;let n=o(e);return n?(o(t.orientation)??`vertical`)===`horizontal`?n.scrollWidth>n.clientWidth:n.scrollHeight>n.clientHeight:!1}),arrivedState:r}}var xo={base:`text-transparent bg-clip-text bg-no-repeat bg-size-[calc(200%+var(--spread)*2+2px)_100%,auto] bg-[image:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--ui-text-highlighted),#0000_calc(50%+var(--spread))),linear-gradient(var(--ui-text-muted),var(--ui-text-muted))] motion-safe:animate-[shimmer_var(--duration)_linear_infinite] motion-safe:rtl:animate-[shimmer-rtl_var(--duration)_linear_infinite] will-change-[background-position] motion-reduce:bg-none motion-reduce:text-muted`},So={__name:`UChatShimmer`,props:{as:{type:null,required:!1,default:`span`},text:{type:String,required:!0},duration:{type:Number,required:!1,default:2},spread:{type:Number,required:!1,default:2},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e){let t=Re(`chatShimmer`,e),r=er(),i=n(()=>ot({extend:xo,...r.ui?.chatShimmer||{}})),o=n(()=>t.text.length*t.spread);return(e,n)=>(_(),m(f(Te),{as:f(t).as,style:N({"--spread":`${o.value}px`,"--duration":`${f(t).duration}s`}),"data-slot":`base`,class:j(i.value({class:[f(t).ui?.base,f(t).class]}))},{default:H(()=>[a(M(f(t).text),1)]),_:1},8,[`as`,`style`,`class`]))}},Co={slots:{root:``,trigger:[`group flex w-full items-center gap-1.5 text-muted text-sm disabled:cursor-default disabled:hover:text-muted hover:text-default rounded-sm outline-primary/25 focus-visible:outline-3 min-w-0`,`transition-colors`],leading:`relative size-4 shrink-0`,leadingIcon:`size-4 shrink-0`,chevronIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,label:`truncate`,trailingIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,content:`data-[state=open]:animate-[collapsible-down_200ms_var(--ease-out)] data-[state=closed]:animate-[collapsible-up_200ms_var(--ease-out)] data-[state=closed]:overflow-hidden rounded-sm outline-primary/25 has-focus-visible:outline-3`,body:`max-h-[200px] pt-2 overflow-y-auto text-sm text-dimmed whitespace-pre-wrap focus:outline-none`},variants:{chevron:{leading:{leadingIcon:`group-hover:opacity-0`},trailing:``},alone:{false:{leadingIcon:[`absolute inset-0 group-data-[state=open]:opacity-0`,`transition-opacity duration-200 ease-out`],chevronIcon:[`absolute inset-0 opacity-0 group-hover:opacity-100 group-data-[state=open]:opacity-100`,`transition-[rotate,opacity] duration-200 ease-out motion-reduce:transition-none`]}}}},wo={__name:`UChatReasoning`,props:{text:{type:String,required:!1},streaming:{type:Boolean,required:!1,default:!1},duration:{type:Number,required:!1},icon:{type:null,required:!1},chevron:{type:String,required:!1,default:`trailing`},chevronIcon:{type:null,required:!1},autoCloseDelay:{type:Number,required:!1,default:500},shimmer:{type:Object,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!1}},emits:[`update:open`],setup(e,{emit:t}){let r=e,i=t,o=Re(`chatReasoning`,r),{t:s,code:c}=Qt(),u=er(),p=n(()=>ot({extend:Co,...u.ui?.chatReasoning||{}})({chevron:o.chevron})),y=n(()=>o.open!==void 0),x=h(o.defaultOpen??o.streaming),S=h(o.streaming?Date.now():null),C=h(void 0),w=h(null);B(()=>o.streaming,(e,t)=>{e?(w.value&&=(clearTimeout(w.value),null),t||(k(!0),S.value=Date.now())):t&&(S.value!==null&&(C.value=Math.ceil((Date.now()-S.value)/1e3),S.value=null),o.autoCloseDelay>0&&(w.value=setTimeout(()=>{k(!1)},o.autoCloseDelay)))},{immediate:!0});let T=n(()=>o.duration??C.value),D=n(()=>{if(o.streaming||T.value===0)return s(`chatReasoning.thinking`);if(T.value===void 0)return s(`chatReasoning.thought`);let e=T.value,t=e<60?`second`:`minute`,n=e<60?e:Math.floor(e/60),r=new Intl.NumberFormat(c.value,{style:`unit`,unit:t,unitDisplay:`long`}).format(n);return s(`chatReasoning.thoughtFor`,{duration:r})}),O=n(()=>y.value?o.open:x.value);function k(e){w.value&&=(clearTimeout(w.value),null),x.value=e,i(`update:open`,e)}l(()=>{w.value&&clearTimeout(w.value)});let A=n(()=>!!o.text||o.streaming),F=n(()=>o.chevronIcon||u.ui.icons?.chevronDown),L=b(`bodyRef`),{style:R}=bo(L);return B(()=>o.text,()=>{if(!o.streaming||!L.value)return;let e=L.value;e.scrollHeight-e.scrollTop-e.clientHeight<50&&P(()=>{e.scrollTop=e.scrollHeight})}),(e,t)=>A.value?(_(),m(f(da),{key:0,open:O.value,disabled:f(o).disabled,"unmount-on-hide":f(o).unmountOnHide,"data-slot":`root`,class:j(p.value.root({class:[f(o).ui?.root,f(o).class]})),"onUpdate:open":k},{default:H(({open:t})=>[E(f(pa),{"as-child":``,disabled:!A.value},{default:H(()=>[I(`button`,{type:`button`,"data-slot":`trigger`,class:j(p.value.trigger({class:f(o).ui?.trigger}))},[f(o).icon||A.value&&f(o).chevron===`leading`?(_(),v(`span`,{key:0,"data-slot":`leading`,class:j(p.value.leading({class:f(o).ui?.leading}))},[f(o).icon?(_(),m(Ke,{key:0,name:f(o).icon,"data-slot":`leadingIcon`,class:j(p.value.leadingIcon({class:f(o).ui?.leadingIcon,alone:!(A.value&&f(o).chevron===`leading`)}))},null,8,[`name`,`class`])):g(``,!0),A.value&&f(o).chevron===`leading`?(_(),m(Ke,{key:1,name:F.value,"data-slot":`chevronIcon`,class:j(p.value.chevronIcon({class:f(o).ui?.chevronIcon,alone:!f(o).icon}))},null,8,[`name`,`class`])):g(``,!0)],2)):g(``,!0),f(o).streaming?(_(),m(So,z({key:1,text:D.value},f(o).shimmer,{"data-slot":`label`,class:p.value.label({class:f(o).ui?.label})}),null,16,[`text`,`class`])):(_(),v(`span`,{key:2,"data-slot":`label`,class:j(p.value.label({class:f(o).ui?.label}))},M(D.value),3)),A.value&&f(o).chevron===`trailing`?(_(),m(Ke,{key:3,name:F.value,"data-slot":`trailingIcon`,class:j(p.value.trailingIcon({class:f(o).ui?.trailingIcon}))},null,8,[`name`,`class`])):g(``,!0)],2)]),_:1},8,[`disabled`]),E(f(fa),{"data-slot":`content`,class:j(p.value.content({class:f(o).ui?.content}))},{default:H(()=>[I(`div`,{ref_key:`bodyRef`,ref:L,"data-slot":`body`,class:j(p.value.body({class:f(o).ui?.body})),style:N(f(R))},[d(e.$slots,`default`,{open:t},()=>[a(M(f(o).text),1)])],6)]),_:2},1032,[`class`])]),_:3},8,[`open`,`disabled`,`unmount-on-hide`,`class`])):g(``,!0)}},To=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`];function Eo(e,t=!1){return t?`⠿`:To[Math.floor(Math.max(0,e)/80)%To.length]}function Do(e,t){return t?e?1e3:80:null}function Oo(e,t){let n=Math.max(0,Math.floor((t-e)/1e3)),r=Math.floor(n/3600),i=Math.floor(n%3600/60);return r?`${r}h ${i}m`:i?`${i}m ${n%60}s`:`${n}s`}var ko={class:`omp-spinner`,"aria-hidden":`true`},Ao={key:0,class:`omp-elapsed`},jo=Object.assign(T({__name:`OmpSpinner`,props:{since:{}},setup(e){let t=e,r=h(0),i=h(Date.now()),a=n(()=>Eo(i.value-r.value,Mi.value)),o=n(()=>t.since?Oo(t.since,i.value):``),s;function c(){s&&clearInterval(s),s=void 0}function l(){i.value=Date.now()}function u(){c();let e=Do(Mi.value,qr.value);e!==null&&(l(),s=Or(l,e))}return w(()=>{B(Mi,()=>{r.value=i.value=Date.now(),u()},{immediate:!0}),B(qr,u)}),U(c),(e,t)=>(_(),v(k,null,[I(`span`,ko,M(f(a)),1),d(e.$slots,`default`),f(o)?(_(),v(`span`,Ao,M(f(o)),1)):g(``,!0)],64))}}),{__name:`OmpSpinner`}),Mo=Object.assign(T({__name:`OmpElapsed`,props:{since:{}},setup(e){let t=e,n=h(Date.now()),r;return w(()=>{r=Or(()=>{n.value=Date.now()},1e3)}),U(()=>{r&&clearInterval(r)}),(e,r)=>(_(),v(`span`,null,M(f(Oo)(t.since,f(n))),1))}}),{__name:`OmpElapsed`});function No(e){if(!(e>=0))return``;if(e<6e4)return`${(e/1e3).toFixed(2)}s`;let t=Math.round(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60);return n?`${n}h${r}m`:`${r}m${t%60}s`}var Po=(e,t,n,r,i)=>`${e} ${e===1?Q(t,r):Q(n,i)}`;function Fo(e){let t=[];return typeof e.matches==`number`?t.push(Po(e.matches,`match`,`matches`,`résultat`,`résultats`)+(e.files&&e.files>1&&e.files<e.matches?` ${Q(`in ${e.files} files`,`dans ${e.files} fichiers`)}`:``)):typeof e.files==`number`&&t.push(Po(e.files,`file`,`files`,`fichier`,`fichiers`)),e.scope&&t.push(`${Q(`in`,`dans`)} ${e.scope}`),(typeof e.added==`number`||typeof e.removed==`number`)&&t.push(`+${e.added||0}/-${e.removed||0}`),e.job&&t.push(`${Q(`Backgrounded`,`En arrière-plan`)}: ${e.job}`),e.cancelled&&t.push(Q(`cancelled`,`annulée`)),t}function Io(e){return!e.out||!e.outLines?0:Math.max(0,e.outLines-e.out.split(`
3
- `).length)}function Lo(e){return e.out?Po(Math.max(e.outLines||0,e.out.split(`
4
- `).length),`line`,`lines`,`ligne`,`lignes`):``}function Ro(e){if(e.title===`Bash`||e.title===`Python`)return e.target||e.title.toLowerCase();let t=e.title.toLowerCase().replace(/\s+/g,`_`);return e.target?`${t} ${e.target}`:t}function zo(e,t){let n=Io(e);return{label:e.diff?`Diff`:t?Q(`Error`,`Erreur`):`Output`,earlier:n?`… ${Po(n,`earlier line`,`earlier lines`,`ligne avant`,`lignes avant`)}`:``}}var Bo=e=>e.reduce((e,t)=>e+(t.omp&&typeof t.omp.ms==`number`?t.omp.ms:0),0),Vo=e=>e.length>0&&e.every(e=>e.omp);function Ho(e,t){return t||e.length<=3?{hidden:0,rows:e}:{hidden:e.length-3,rows:e.slice(-3)}}var Uo={class:`omp-tool-line`},Wo={class:`omp-tool-glyph`,"aria-hidden":`true`},Go={class:`omp-tool-cmd`},Ko={key:0,class:`omp-tool-wall`},qo={key:1,class:`omp-tool-wall`},Jo={class:`omp-tool-sub`},Yo={key:1,class:`omp-tool-intent`},Xo={key:2,class:`omp-tool-result`},Zo={class:`omp-tool-exit`},Qo={key:0,class:`omp-tool-out`},$o={class:`omp-tool-out-head`},es={class:`omp-tool-out-label`},ts={key:0,class:`omp-tool-out-earlier`},ns={class:`omp-tool-out-right`},rs={key:0,class:`omp-tool-exit`},is={key:1},as=Object.assign(T({__name:`OmpTool`,props:{tool:{},live:{type:Boolean},run:{type:Boolean}},setup(e){let t=e,r=h(!1),i=n(()=>t.tool.omp),o=n(()=>!!t.tool.error),s=n(()=>Fo(i.value).concat(t.run?[Lo(i.value)].filter(Boolean):[]).join(` · `)),c=n(()=>i.value.exit?String(i.value.exit):``),l=n(()=>t.live||i.value.ms===void 0?``:No(i.value.ms)),u=n(()=>t.live&&t.tool.ts&&Date.parse(t.tool.ts)||null),d=n(()=>i.value.intent||i.value.title),p=n(()=>!!i.value.out),b=n(()=>zo(i.value,o.value)),x=n(()=>(i.value.out||``).split(`
5
- `).map(e=>({text:e,cls:i.value.diff?/^\+\s*\d*\|/.test(e)?`add`:/^-\s*\d*\|/.test(e)?`del`:``:``})));return(t,n)=>{let h=jo,S=Mo,w=Ke,T=So;return _(),v(`div`,{class:j([`omp-tool`,{err:f(o),live:e.live,open:f(r)}])},[(_(),m(C(f(p)?`button`:`div`),{class:`omp-tool-head`,type:f(p)?`button`:void 0,"aria-expanded":f(p)?f(r):void 0,onClick:n[0]||=e=>f(p)&&(r.value=!f(r))},{default:H(()=>[I(`span`,Uo,[I(`span`,Wo,[e.live?(_(),m(h,{key:0})):(_(),v(k,{key:1},[a(M(f(o)?`✗`:`❯`),1)],64))]),I(`code`,Go,M(f(Ro)(f(i))),1),f(u)?(_(),v(`span`,Ko,[E(S,{since:f(u)},null,8,[`since`])])):f(l)?(_(),v(`span`,qo,M(f(l)),1)):g(``,!0),e.run&&f(p)?(_(),m(w,{key:2,name:f(r)?`i-lucide-chevron-up`:`i-lucide-chevron-down`,class:`omp-tool-chev`,"aria-hidden":`true`},null,8,[`name`])):g(``,!0)]),I(`span`,Jo,[e.live?(_(),m(T,{key:0,text:`# ${f(d)}`,duration:2.4,class:`omp-tool-intent`},null,8,[`text`])):f(i).intent?(_(),v(`span`,Yo,`# `+M(f(i).intent),1)):g(``,!0),f(s)||f(c)?(_(),v(`span`,Xo,[a(`→ `+M(f(s)),1),f(c)?(_(),v(k,{key:0},[f(s)?(_(),v(k,{key:0},[a(` · `)],64)):g(``,!0),I(`span`,Zo,`exit `+M(f(c)),1)],64)):g(``,!0)])):g(``,!0)])]),_:1},8,[`type`,`aria-expanded`])),f(p)&&f(r)?(_(),v(`div`,Qo,[I(`div`,$o,[I(`span`,es,M(f(b).label),1),f(b).earlier?(_(),v(`span`,ts,M(f(b).earlier),1)):g(``,!0),I(`span`,ns,[f(c)?(_(),v(`span`,rs,`exit `+M(f(c)),1)):g(``,!0),f(l)?(_(),v(`span`,is,M(f(l)),1)):g(``,!0)])]),I(`pre`,null,[(_(!0),v(k,null,y(f(x),(e,t)=>(_(),v(`span`,{key:t,class:j(e.cls)},M(e.text)+`
6
- `,3))),128))])])):g(``,!0)],2)}}}),{__name:`OmpTool`}),os={slots:{root:``,trigger:[`group flex w-full items-center gap-1.5 text-muted text-sm disabled:cursor-default disabled:hover:text-muted hover:text-default min-w-0`,`transition-colors`],leading:`relative size-4 shrink-0`,leadingIcon:`size-4 shrink-0`,chevronIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,label:`truncate`,suffix:`text-dimmed ms-1`,trailingIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,content:`data-[state=open]:animate-[collapsible-down_200ms_var(--ease-out)] data-[state=closed]:animate-[collapsible-up_200ms_var(--ease-out)] data-[state=closed]:overflow-hidden`,body:`text-sm text-dimmed whitespace-pre-wrap`,actions:`flex items-center justify-end gap-1.5`},variants:{variant:{inline:{trigger:`rounded-sm outline-primary/25 focus-visible:outline-3`,body:`pt-2`,actions:`pt-2`},card:{root:`rounded-md ring ring-default overflow-hidden outline-primary/25 has-focus-visible:outline-3 has-focus-visible:ring-primary`,trigger:`px-2 py-1 focus:outline-none`,trailingIcon:`ms-auto`,body:`border-t border-default p-2 max-h-[200px] overflow-y-auto focus:outline-none`,actions:`border-t border-default p-2`}},chevron:{leading:``,trailing:``},loading:{true:{leadingIcon:`animate-spin`}},alone:{false:{leadingIcon:[`absolute inset-0 group-hover:opacity-0 group-data-[state=open]:opacity-0`,`transition-opacity duration-200 ease-out`],chevronIcon:[`absolute inset-0 opacity-0 group-hover:opacity-100 group-data-[state=open]:opacity-100`,`transition-[rotate,opacity] duration-200 ease-out motion-reduce:transition-none`]}}}},ss=[`data-state`],cs={__name:`UChatTool`,props:{text:{type:String,required:!1},suffix:{type:String,required:!1},icon:{type:null,required:!1},loading:{type:Boolean,required:!1,default:!1},loadingIcon:{type:null,required:!1},streaming:{type:Boolean,required:!1,default:!1},variant:{type:null,required:!1,default:`inline`},chevron:{type:String,required:!1,default:`trailing`},chevronIcon:{type:null,required:!1},shimmer:{type:Object,required:!1},actions:{type:Array,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!1}},emits:[`update:open`],setup(e,{emit:t}){let r=e,i=t,o=O(),s=Re(`chatTool`,r),c=er(),l=n(()=>ot({extend:os,...c.ui?.chatTool||{}})({variant:s.variant,chevron:s.chevron,loading:s.loading})),u=n(()=>s.open!==void 0),p=h(s.defaultOpen??!1),b=n(()=>u.value?s.open:p.value);function x(e){p.value=e,i(`update:open`,e)}let S=n(()=>!!o.default);B(()=>!!s.actions?.length,e=>{e&&S.value&&s.open===void 0&&s.defaultOpen===void 0&&(p.value=!0)},{immediate:!0});let C=n(()=>s.loadingIcon||c.ui.icons?.loading),w=n(()=>s.loading?C.value:s.icon),T=n(()=>s.chevronIcon||c.ui.icons?.chevronDown);return(e,t)=>(_(),m(f(da),{open:b.value,disabled:f(s).disabled,"unmount-on-hide":f(s).unmountOnHide,"data-slot":`root`,class:j(l.value.root({class:[f(s).ui?.root,f(s).class]})),"onUpdate:open":x},{default:H(({open:t})=>[E(f(pa),{"as-child":``,disabled:!S.value},{default:H(()=>[I(`button`,{type:`button`,"data-slot":`trigger`,class:j(l.value.trigger({class:f(s).ui?.trigger}))},[w.value||S.value&&f(s).chevron===`leading`?(_(),v(`span`,{key:0,"data-slot":`leading`,class:j(l.value.leading({class:f(s).ui?.leading}))},[w.value?(_(),m(Ke,{key:0,name:w.value,"data-slot":`leadingIcon`,class:j(l.value.leadingIcon({class:f(s).ui?.leadingIcon,alone:!(S.value&&f(s).chevron===`leading`)}))},null,8,[`name`,`class`])):g(``,!0),S.value&&f(s).chevron===`leading`?(_(),m(Ke,{key:1,name:T.value,"data-slot":`chevronIcon`,class:j(l.value.chevronIcon({class:f(s).ui?.chevronIcon,alone:!w.value}))},null,8,[`name`,`class`])):g(``,!0)],2)):g(``,!0),I(`span`,{"data-slot":`label`,class:j(l.value.label({class:f(s).ui?.label}))},[f(s).streaming&&f(s).text?(_(),m(So,z({key:0,text:f(s).text},f(s).shimmer),null,16,[`text`])):(_(),v(k,{key:1},[a(M(f(s).text),1)],64)),f(s).suffix?(_(),v(`span`,{key:2,"data-slot":`suffix`,class:j(l.value.suffix({class:f(s).ui?.suffix}))},M(f(s).suffix),3)):g(``,!0)],2),S.value&&f(s).chevron===`trailing`?(_(),m(Ke,{key:1,name:T.value,"data-slot":`trailingIcon`,class:j(l.value.trailingIcon({class:f(s).ui?.trailingIcon}))},null,8,[`name`,`class`])):g(``,!0)],2)]),_:1},8,[`disabled`]),E(f(fa),{"data-slot":`content`,class:j(l.value.content({class:f(s).ui?.content}))},{default:H(()=>[I(`div`,{"data-slot":`body`,class:j(l.value.body({class:f(s).ui?.body}))},[d(e.$slots,`default`,{open:t})],2)]),_:2},1032,[`class`]),f(s).actions?.length||o.actions?(_(),v(`div`,{key:0,"data-slot":`actions`,"data-state":S.value&&t?`open`:`closed`,class:j(l.value.actions({class:f(s).ui?.actions}))},[d(e.$slots,`actions`,{},()=>[(_(!0),v(k,null,y(f(s).actions,(e,t)=>(_(),m(_t,z({key:t,size:`xs`},{ref_for:!0},e),null,16))),128))])],10,ss)):g(``,!0)]),_:3},8,[`open`,`disabled`,`unmount-on-hide`,`class`]))}},ls=[`·`,`✢`,`✳`,`✶`,`✻`,`✽`],us=[...ls,...[...ls].reverse()];function ds(e,t=!1){return t?`✻`:us[Math.floor(Math.max(0,e)/120)%us.length]}function fs(e,t){return e||!t?null:120}var ps={class:`claude-spinner`,"aria-hidden":`true`},ms=Object.assign(T({__name:`ClaudeSpinner`,setup(e){let t=h(0),r=n(()=>ds(t.value,Mi.value)),i,a=0;function o(){i&&clearInterval(i),i=void 0}function s(){t.value=performance.now()-a}function c(){o();let e=fs(Mi.value,qr.value);e!==null&&(s(),i=Or(s,e))}return w(()=>{B(Mi,()=>{a=performance.now(),c()},{immediate:!0}),B(qr,c)}),U(o),(e,t)=>(_(),v(`span`,ps,M(f(r)),1))}}),{__name:`ClaudeSpinner`}),hs={slots:{root:`w-full flex flex-col gap-1 flex-1 px-2.5 [&>article]:last-of-type:min-h-(--last-message-height)`,indicator:`h-6 flex items-center gap-1 py-3 *:size-2 *:rounded-full *:bg-elevated motion-safe:[&>*:nth-child(1)]:animate-[bounce_1s_infinite] motion-safe:[&>*:nth-child(2)]:animate-[bounce_1s_0.15s_infinite] motion-safe:[&>*:nth-child(3)]:animate-[bounce_1s_0.3s_infinite]`,viewport:`absolute inset-x-0 top-[86%] data-[state=open]:animate-[fade-in_200ms_var(--ease-out)] data-[state=closed]:animate-[fade-out_200ms_var(--ease-out)]`,autoScroll:`rounded-full absolute right-1/2 translate-x-1/2 bottom-0`},variants:{compact:{true:``,false:``}}},gs=[`data-status`],_s=[`data-state`],vs={__name:`UChatMessages`,props:{messages:{type:null,required:!1},status:{type:String,required:!1},shouldAutoScroll:{type:Boolean,required:!1,default:!1},shouldScrollToBottom:{type:Boolean,required:!1,default:!0},autoScroll:{type:[Boolean,Object],required:!1,default:!0},autoScrollIcon:{type:null,required:!1},user:{type:Object,required:!1},assistant:{type:Object,required:!1},compact:{type:Boolean,required:!1},spacingOffset:{type:Number,required:!1,default:0},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e,{expose:t}){let r=e,i=O(),a=Re(`chatMessages`,r),o=()=>oe(i,[`default`,`indicator`,`viewport`]);function s(){if(a.status===`submitted`)return!0;if(a.status!==`streaming`)return!1;let e=a.messages?.[a.messages.length-1];return e?.role===`assistant`&&!e.parts?.length}let c=er(),l=S(()=>Rt(a.user,{side:`right`,variant:`soft`})),u=S(()=>Rt(a.assistant,{side:`left`,variant:`naked`})),p=n(()=>ot({extend:hs,...c.ui?.chatMessages||{}})({compact:a.compact})),b=h(null),C=h(null),T=h(new Map),D=h(!1),A=h(0),M=h(!1),F=h(0),L=h(!1);function R(e,t){let n=t?.$el;n&&T.value.set(e,n)}function V(e){let t=T.value.get(e);t&&t.scrollIntoView({behavior:`smooth`,block:`start`})}function U(e=!0){C.value&&(e?C.value.scrollTo({top:C.value.scrollHeight,behavior:`smooth`}):C.value.scrollTop=C.value.scrollHeight)}Mt([()=>a.messages,()=>a.status],([e,t])=>{if(!a.messages?.length){D.value=!1,L.value=!1,F.value=0,T.value.clear();return}t===`streaming`&&W()},{deep:!0,throttle:50,leading:!0}),B(()=>a.status,e=>{if(e!==`submitted`)return;let t=a.messages?.[a.messages.length-1];t&&t.role===`user`&&(L.value=!1,P(()=>{M.value=!0,K(),P(()=>{V(t.id)})}))});function W(){if(!C.value)return;let e=C.value.scrollTop+C.value.clientHeight,t=C.value.scrollHeight;D.value=t-e>=100,C.value.scrollTop<F.value?L.value=!0:t-e<100&&(L.value=!1),F.value=C.value.scrollTop}function G(){L.value=!1,U()}function ee(e){if(!e)return document.documentElement;let t=/auto|scroll/,n=e;for(;n&&n!==document.body&&n!==document.documentElement;){let e=window.getComputedStyle(n);if(t.test(e.overflowY))return n;n=n.parentElement}return document.documentElement}function K(){if(!b.value||!C.value||!a.messages?.length||!M.value)return;let{height:e}=et(C.value),t=a.messages.findLast(e=>e.role===`user`);if(!t)return;let n=T.value.get(t.id);if(!n)return;let r=a.spacingOffset||0,i=window.getComputedStyle(b.value),o=window.getComputedStyle(C.value);r+=Number.parseFloat(i.rowGap)||Number.parseFloat(i.gap)||0,r+=Number.parseFloat(o.paddingTop)||0,r+=Number.parseFloat(o.paddingBottom)||0,A.value=Math.max(e.value-n.offsetHeight-r,0)}return w(()=>{C.value=ee(b.value),C.value&&(F.value=C.value.scrollTop,a.shouldScrollToBottom?(U(!1),setTimeout(()=>{U(!1)},100)):P(()=>{W()}),Le(C,`scroll`,W),Le(window,`resize`,()=>P(K)),b.value&&yt(b,()=>{a.shouldAutoScroll&&a.status===`streaming`&&!L.value&&U(!1)},{childList:!0,subtree:!0}))}),t({registerMessageRef:R}),(e,t)=>(_(),v(`div`,{ref_key:`el`,ref:b,"data-status":f(a).status,"data-slot":`root`,class:j(p.value.root({class:[f(a).ui?.root,f(a).class]})),style:N({"--last-message-height":`${A.value}px`})},[d(e.$slots,`default`,{registerMessageRef:R},()=>[(_(!0),v(k,null,y(f(a).messages,t=>(_(),v(k,{key:t.id},[t.parts?.length?(_(),m(yo,z({key:0,ref_for:!0},{...t.role===`user`?l.value:u.value,...t},{ref_for:!0,ref:e=>R(t.id,e),compact:f(a).compact}),x({_:2},[y(o(),(n,r)=>({name:r,fn:H(n=>[d(e.$slots,r,z({ref_for:!0},{...n,message:t}))])}))]),1040,[`compact`])):g(``,!0)],64))),128))]),s()?(_(),m(yo,z({key:0,id:`indicator`,role:`assistant`},{...u.value,actions:void 0,parts:[]},{compact:f(a).compact}),{content:H(()=>[d(e.$slots,`indicator`,{ui:p.value},()=>[I(`div`,{"data-slot":`indicator`,class:j(p.value.indicator({class:f(a).ui?.indicator}))},[...t[0]||=[I(`span`,null,null,-1),I(`span`,null,null,-1),I(`span`,null,null,-1)]],2)])]),_:3},16,[`compact`])):g(``,!0),E(f(ce),{present:D.value},{default:H(()=>[I(`div`,{"data-state":D.value?`open`:`closed`,"data-slot":`viewport`,class:j(p.value.viewport({class:f(a).ui?.viewport}))},[d(e.$slots,`viewport`,{ui:p.value,onClick:G},()=>[f(a).autoScroll?(_(),m(_t,z({key:0,icon:f(a).autoScrollIcon||f(c).ui.icons.arrowDown,color:`neutral`,variant:`outline`},typeof f(a).autoScroll==`object`?f(a).autoScroll:{},{"data-slot":`autoScroll`,class:p.value.autoScroll({class:f(a).ui?.autoScroll}),onClick:G}),null,16,[`icon`,`class`])):g(``,!0)])],10,_s)]),_:3},8,[`present`])],14,gs))}},ys=new URL(`pdf.min.t82Z80JU.mjs`,import.meta.url).href,bs=new URL(`pdf.worker.min.wgc6bjNh.mjs`,import.meta.url).href;function xs(e,t,n){return Math.min(Math.max(1,n),Math.sqrt(4194304/(e*t)))}var Ss=[`aria-label`,`aria-busy`],Cs={key:0,class:`changes-notice`,role:`status`},ws={key:1,class:`changes-notice error`,role:`alert`},Ts=[`data-page`,`aria-label`],Es=Object.assign(T({__name:`PdfPreview`,props:{src:{},title:{}},setup(e){let t=e,n=h(),r=h(0),i=h(2/3),a=h(!0),o=h(!1),s,c,l,u,d,p=!1,m=0,b=!1,x=0,S=new Set;async function C(){if(!b&&!p&&s&&x){b=!0;try{for(let e of S){if(p)break;if(e.querySelector(`canvas`))continue;let t=m,n=await s.getPage(Number(e.dataset.page));if(p||t!==m||!S.has(e))continue;let r=n.getViewport({scale:1}),i=n.getViewport({scale:x/r.width});e.style.aspectRatio=`${r.width} / ${r.height}`;let a=window.document.createElement(`canvas`),o=xs(i.width,i.height,window.devicePixelRatio||1);a.width=Math.ceil(i.width*o),a.height=Math.ceil(i.height*o);let c=a.getContext(`2d`);l=n.render({canvas:a,canvasContext:c,viewport:i,transform:[o,0,0,o,0,0]});try{await l.promise,!p&&t===m&&S.has(e)?(e.replaceChildren(a),e.dataset.rendered=`true`):a.width=a.height=0}catch(e){if(e.name!==`RenderingCancelledException`)throw e}finally{l=void 0,n.cleanup()}}}catch{p||(o.value=!0)}finally{b=!1,!p&&!o.value&&[...S].some(e=>!e.querySelector(`canvas`))&&C()}}}function T(e){let t=e.querySelector(`canvas`);t&&(t.width=t.height=0,t.remove()),delete e.dataset.rendered}return w(async()=>{try{let e=await tn(()=>import(ys),[],import.meta.url);if(p||(e.GlobalWorkerOptions.workerSrc=bs,c=e.getDocument({url:t.src,withCredentials:!0,isEvalSupported:!1}),s=await c.promise,p))return;let o=await s.getPage(1),f=o.getViewport({scale:1});if(i.value=f.height/f.width,o.cleanup(),r.value=s.numPages,a.value=!1,await P(),p||!n.value)return;x=n.value.clientWidth,u=new IntersectionObserver(e=>{for(let t of e){let e=t.target;t.isIntersecting?S.add(e):(S.delete(e),T(e))}C()},{rootMargin:`400px 0px`}),n.value.querySelectorAll(`.pdf-page`).forEach(e=>u.observe(e)),d=new ResizeObserver(()=>{let e=n.value?.clientWidth||0;e&&e!==x&&(x=e,m++,l?.cancel(),S.forEach(T),C())}),d.observe(n.value)}catch{p||(o.value=!0,a.value=!1)}}),U(()=>{p=!0,u?.disconnect(),d?.disconnect(),l?.cancel(),S.forEach(T),S.clear(),c?.destroy()}),(t,s)=>(_(),v(`div`,{ref_key:`root`,ref:n,class:`files-pdf`,role:`region`,"aria-label":e.title,"aria-busy":f(a)},[f(a)?(_(),v(`p`,Cs,M((`t`in t?t.t:f(Z))(`Loading PDF…`)),1)):g(``,!0),f(o)?(_(),v(`p`,ws,M((`t`in t?t.t:f(Z))(`Could not preview this PDF. Use Open to view it.`)),1)):g(``,!0),(_(!0),v(k,null,y(f(r),e=>(_(),v(`div`,{key:e,class:`pdf-page`,"data-page":e,style:N({aspectRatio:`1 / ${f(i)}`}),role:`img`,"aria-label":`${(`t`in t?t.t:f(Z))(`Page`)} ${e}`},null,12,Ts))),128))],8,Ss))}}),{__name:`PdfPreview`});function Ds(e){if(e<1e3)return`${e} B`;let t=[`kB`,`MB`,`GB`,`TB`],n=e/1e3,r=0;for(;;){let e=n.toFixed(+(n<10));if(Number(e)<1e3||r===t.length-1)return`${e} ${t[r]}`;n/=1e3,r++}}var Os=e=>/\.(?:md|markdown)$/i.test(e),ks=e=>{try{return decodeURIComponent(e)}catch{return e}};function As(e){let t=[];for(let n of e)if(n&&n!==`.`){if(n===`..`){if(!t.length)return null;t.pop()}else t.push(n)}return t}function js(e,t,n){let r=t.trim();if(!r)return null;if(r.startsWith(`#`))return{kind:`anchor`,anchor:ks(r.slice(1))};if(/^[a-z][a-z\d+.-]*:/i.test(r)||r.startsWith(`//`))return{kind:`external`};let i=r.indexOf(`#`),a=i<0?``:ks(r.slice(i+1)),o=ks((i<0?r:r.slice(0,i)).split(`?`)[0]).replace(/\\/g,`/`);if(!o)return null;let s=o.endsWith(`/`)?`dir`:`file`;if(n){if(o.startsWith(`~/`)){let e=As(o.slice(2).split(`/`));return e?{kind:s,path:`~/${e.join(`/`)}`,anchor:a}:{kind:`outside`}}let t=As([...o.startsWith(`/`)?[]:e.split(`/`).slice(0,-1),...o.split(`/`)]);return t?{kind:s,path:`/${t.join(`/`)}`,anchor:a}:{kind:`outside`}}let c=As([...o.startsWith(`/`)?[]:e.split(`/`).slice(0,-1),...o.split(`/`)]);return c?{kind:s,path:c.join(`/`),anchor:a}:{kind:`outside`}}function Ms(e){return e.trim().toLowerCase().replace(/[^\p{L}\p{N}\s_-]/gu,``).replace(/\s/g,`-`)}function Ns(e,t){let n=t.toLowerCase(),r=new Map;for(let t of e.querySelectorAll(`h1, h2, h3, h4, h5, h6`)){let e=Ms(t.textContent||``),i=r.get(e)??0;if(r.set(e,i+1),(i?`${e}-${i}`:e)===n)return t}return null}var Ps=`wherdr.files.hidden`,Fs=e=>e!==`0`,Is=e=>e?`1`:`0`,Ls=`wherdr.files.md`,Rs=e=>e===`source`?`source`:`rendered`,zs={class:`changes-view files-view`},Bs={class:`changes-toolbar`},Vs=[`aria-label`],Hs={key:0,class:`files-sep`},Us=[`onClick`],Ws={key:0,class:`files-sep`},Gs={class:`files-crumb current`},Ks={class:`files-actions`},qs={class:`files-label`},Js={key:0,class:`changes-notice error`,role:`alert`},Ys={key:1,class:`changes-notice`},Xs={class:`changes-location`},Zs=[`aria-label`],Qs=[`aria-pressed`,`onClick`],$s={key:1,class:`changes-limit`},ec=[`src`,`alt`],tc={key:0,class:`changes-notice`,role:`alert`},nc=[`src`,`aria-label`],rc={key:5,class:`changes-notice`},ic={key:6,class:`changes-notice`},ac=[`aria-label`,`innerHTML`],oc=[`aria-label`],sc={class:`files-num`,"aria-hidden":`true`},cc={class:`files-text`},lc={class:`changes-toggle`},uc={key:0,class:`changes-limit`},dc={key:1,class:`changes-notice`},fc={class:`files-list`},pc=[`disabled`,`onClick`],mc={class:`change-path`},hc={key:0,class:`change-status`},gc=40,_c=Object.assign(T({__name:`FilesView`,props:{paneId:{},file:{}},setup(e){let t=e,r=h(null),i=h(null),o=h(!1),s=h(``),c=ir(Ps,Fs,Is),u=0,d=()=>encodeURIComponent(t.paneId);async function p(e,t){let n=++u;o.value=!0,s.value=``;try{let r=await gi(e);n===u&&t(r)}catch(e){n===u&&(s.value=e.message)}finally{n===u&&(o.value=!1)}}function b(e){let t=e===null?``:`&path=${encodeURIComponent(e)}`;return p(`/api/files?pane=${d()}${t}`,e=>{r.value=e,i.value=null})}let x=e=>`pane=${d()}&path=${encodeURIComponent(e)}${t.file?`&from=chat`:``}`,S=``;function C(e){return S=e,p(`/api/files/read?${x(e)}`,e=>{i.value=e})}let T=null,D=h([]),O=h(0),A=n(()=>i.value?.kind===`pdf`||i.value?.kind===`video`?`/api/files/download?${x(i.value.path)}&inline=1`:``),N=h(!1);B(A,()=>{N.value=!1});let F=h(!1);async function R(){let e=i.value?.path;if(e&&!F.value){F.value=!0;try{await ai(`/api/files/download?${x(e)}`,e.split(`/`).pop()||e)}catch(e){$(e.message,!0)}finally{F.value=!1}}}let z=e=>r.value?.path?`${r.value.path}/${e}`:e;function V(e){e.kind===`dir`?b(z(e.name)):e.kind===`file`&&C(z(e.name))}function U(){u++,o.value=!1;let e=t.file?D.value.pop():void 0;e?C(e):i.value=null}function W(){O.value++,oe.clear(),N.value=!1,t.file?C(S||t.file):i.value?C(i.value.path):b(r.value?r.value.path:null)}w(()=>t.file?C(t.file):b(null)),l(()=>{u++});let ee=n(()=>{let e=r.value;if(!e)return[];let t=e.path?e.path.split(`/`):[];return[{label:e.root.split(`/`).filter(Boolean).pop()||`/`,path:``},...t.map((e,n)=>({label:e,path:t.slice(0,n+1).join(`/`)}))]}),K=n(()=>(r.value?.entries||[]).filter(e=>c.value||!e.name.startsWith(`.`))),te=n(()=>{let e=i.value?.text??``,t=e.endsWith(`
1
+ import{t as e}from"./hePW80VL.js";import{$ as t,A as n,An as r,At as i,B as a,Bn as o,Dn as s,Dt as c,Et as l,Fn as u,Ft as d,Hn as f,Jt as p,M as m,Mn as h,N as g,Ot as _,P as v,Pt as y,Qt as b,R as x,Rn as S,Rt as C,St as w,U as T,V as E,Yt as D,Zt as O,b as k,ct as A,fr as j,gr as M,hr as N,ht as P,j as F,ln as I,mr as L,mt as R,nn as z,pt as B,sn as V,vt as H,w as ee,wn as U,z as W,zn as G}from"./C25ROUa9.js";import{_t as K,dt as te,gt as ne,ht as q,vt as re}from"./CDWjMk9C.js";import{$t as ie,Ar as ae,At as J,Bt as oe,Ci as se,Cn as ce,D as le,Dn as ue,E as de,En as fe,Et as pe,Fn as me,G as he,Hn as ge,Ht as _e,Jt as ve,K as ye,Kt as be,Mn as xe,Nn as Se,Nt as Ce,Pn as we,Qr as Te,Qt as Ee,Si as De,Sn as Oe,St as ke,Tn as Ae,Ut as je,Vt as Me,W as Ne,Wt as Pe,X as Fe,Xt as Ie,Yn as Le,Yt as Re,Zt as ze,_i as Be,_t as Ve,an as He,at as Ue,b as We,bi as Ge,bn as Ke,cn as qe,dn as Je,dr as Ye,dt as Xe,en as Ze,f as Qe,fi as $e,fn as et,gn as tt,gt as nt,hr as rt,i as it,in as at,jn as ot,kr as st,kt as ct,m as lt,mi as ut,n as dt,nn as ft,on as pt,ot as mt,pi as ht,pn as gt,qt as _t,r as vt,rn as yt,s as bt,sn as xt,sr as St,st as Ct,tn as wt,u as Tt,ut as Et,xi as Dt,xn as Ot,y as kt,yi as At,yn as jt,zn as Mt}from"./DNs2cMBZ.js";import{f as Nt,m as Pt,p as Ft,u as It}from"./CXJnLmWv.js";import{A as Lt,At as Rt,B as zt,Bt,C as Vt,Ct as Ht,D as Ut,Dt as Wt,Et as Gt,F as Kt,Ft as qt,G as Jt,H as Yt,I as Xt,It as Zt,J as Qt,K as $t,L as en,Lt as tn,Mt as nn,N as rn,Nt as an,O as on,Ot as sn,P as cn,Pt as ln,Q as un,R as dn,Rt as fn,S as pn,St as mn,T as hn,Tt as gn,V as _n,Vt as vn,W as yn,X as bn,Y as xn,_ as Sn,_t as Cn,a as wn,b as Tn,bt as En,c as Dn,dt as On,f as kn,ft as An,g as jn,gt as Mn,h as Nn,ht as Pn,i as Fn,j as In,jt as Ln,k as Rn,kt as zn,l as Bn,lt as Vn,m as Hn,mt as Un,n as Wn,o as Gn,pt as Kn,q as qn,r as Jn,s as Yn,u as Xn,vt as Zn,wt as Qn,x as $n,xt as er,y as tr,yt as nr,z as rr,zt as ir}from"./CAkH_IfS.js";import{c as ar}from"./ByLPJEo6.js";import{$ as or,$r as sr,$t as cr,Ai as lr,Bt as ur,Ci as dr,Cr as fr,Ct as pr,D as mr,Di as Y,Dt as hr,E as gr,Ei as _r,Er as vr,Et as X,Fn as yr,Ft as br,Gt as xr,H as Sr,Ht as Cr,Jt as wr,K as Tr,Kt as Er,Lt as Dr,M as Or,Mr as kr,Nn as Ar,Nr as jr,O as Mr,Oi as Nr,Or as Pr,Ot as Fr,Pr as Ir,Q as Lr,Qr as Rr,Qt as zr,Rt as Br,Si as Vr,T as Hr,Tt as Ur,Ut as Wr,V as Gr,Vn as Kr,Vt as qr,Wt as Jr,X as Yr,Xr,Xt as Zr,Y as Qr,Yr as $r,Yt as ei,Z as ti,Zr as ni,Zt as ri,_ as ii,_i as Z,ai,an as oi,ar as si,at as ci,bi as li,bt as ui,ci as di,cn as fi,ct as pi,di as mi,ei as hi,en as gi,et as _i,f as vi,fr as yi,ft as bi,gi as Q,i as xi,ii as Si,in as Ci,ji as wi,ki as Ti,kr as Ei,l as Di,ln as Oi,mi as ki,mr as Ai,mt as ji,n as Mi,ni as $,nt as Ni,on as Pi,pr as Fi,q as Ii,qt as Li,ri as Ri,si as zi,sn as Bi,st as Vi,ui as Hi,ut as Ui,v as Wi,vi as Gi,vr as Ki,w as qi,wi as Ji,wr as Yi,x as Xi,xi as Zi,xr as Qi,xt as $i,y as ea,z as ta,zi as na,zt as ra}from"./COWXF9OU.js";import{t as ia}from"./BDNMzG2s.js";import{c as aa,d as oa,f as sa,g as ca,h as la,i as ua,l as da,m as fa,n as pa,p as ma,t as ha}from"./B5cSia3P.js";var[ga,_a]=pe(`CollapsibleRoot`),va=T({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=Xe(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=G(r);return _a({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),Fe(),(e,t)=>(_(),m(f(Ne),{as:e.as,"as-child":r.asChild,"data-state":f(i)?`open`:`closed`,"data-disabled":f(a)?``:void 0},{default:V(()=>[d(e.$slots,`default`,{open:f(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),ya=T({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let r=e,i=t,a=ga();a.contentId||=ye(void 0,`reka-collapsible-content`);let o=h(),{forwardRef:s,currentElement:c}=Fe(),l=h(0),u=h(0),p=n(()=>a.open.value),v=h(p.value),y=h();z(()=>[p.value,o.value?.present],async()=>{await P();let e=c.value;if(!e)return;y.value=y.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();u.value=t.height,l.value=t.width,v.value||(e.style.transitionDuration=y.value.transitionDuration,e.style.animationName=y.value.animationName)},{immediate:!0});let b=n(()=>v.value&&a.open.value);return w(()=>{requestAnimationFrame(()=>{v.value=!1})}),mt(c,`beforematch`,e=>{requestAnimationFrame(()=>{a.onOpenToggle(),i(`contentFound`)})}),(e,t)=>(_(),m(f(he),{ref_key:`presentRef`,ref:o,present:e.forceMount||f(a).open.value,"force-mount":!0},{default:V(({present:t})=>[E(f(Ne),R(e.$attrs,{id:f(a).contentId,ref:f(s),"as-child":r.asChild,as:e.as,hidden:t?void 0:f(a).unmountOnHide.value?``:`until-found`,"data-state":b.value?void 0:f(a).open.value?`open`:`closed`,"data-disabled":f(a).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${u.value}px`,"--reka-collapsible-content-width":`${l.value}px`}}),{default:V(()=>[!f(a).unmountOnHide.value||t?d(e.$slots,`default`,{key:0}):g(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),ba=T({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;Fe();let n=ga();return(e,r)=>(_(),m(f(Ne),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":f(n).contentId,"aria-expanded":f(n).open.value,"data-state":f(n).open.value?`open`:`closed`,"data-disabled":f(n).disabled?.value?``:void 0,disabled:f(n).disabled?.value,onClick:f(n).onOpenToggle},{default:V(()=>[d(e.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}}),xa=[`aria-label`],Sa=[`title`,`data-tab`,`aria-current`,`onPointerdown`,`onClick`],Ca={key:1,class:`tab-chip-dot`},wa={class:`tab-chip-label`},Ta=[`title`,`aria-label`,`disabled`],Ea=Object.assign(T({__name:`SpaceTabs`,props:{workspace:{},current:{}},setup(e){let t=e,r=n(()=>At(t.workspace).map(e=>{let t=Kr(e.panes);return{...e,label:e.tab.label||String(e.tab.number),tone:t&&t.agent?ie(t):``,title:e.panes.map(e=>zi(e)).join(` · `)}}));z(()=>t.current,e=>{e&&ut(e)},{immediate:!0});let i=e=>`${Q(`Tab`)} ${e}`,a=null,o=In({onPress:()=>{a&&($(),Ke(Le(a.id),i(a.label)))}});function s(e,t,n){ji.value&&(a={id:t,label:n},o.down(e))}function c(e){o.swallowClick()||e===t.current||Dt(e)}return(t,n)=>{let i=yn,a=Qt,l=Qe;return(`spaceTabControls`in t?t.spaceTabControls:f(Pi))(f(r).length).row?(_(),v(`nav`,{key:0,class:`tab-chips space-tabs`,"aria-label":(`t`in t?t.t:f(Q))(`Tabs`)},[(_(!0),v(k,null,y(f(r),r=>(_(),m(a,{key:r.tab.id,disabled:`sheetMenus`in t?t.sheetMenus:f(ji),items:(`sheetMenus`in t?t.sheetMenus:f(ji))?[]:(`toDropdown`in t?t.toDropdown:f(Ae))((`tabItems`in t?t.tabItems:f(Le))(r.tab.id)),ui:{content:`hw-dropdown`}},{default:V(()=>[F(`button`,{type:`button`,class:j([`tab-chip`,r.tone]),title:r.title,"data-tab":r.tab.id,"aria-current":r.tab.id===e.current?`page`:void 0,onPointerdown:e=>s(e,r.tab.id,r.label),onPointermove:n[0]||=(...e)=>f(o).move&&f(o).move(...e),onPointerup:n[1]||=(...e)=>f(o).cancel&&f(o).cancel(...e),onPointercancel:n[2]||=(...e)=>f(o).cancel&&f(o).cancel(...e),onContextmenu:n[3]||=e=>(`sheetMenus`in t?t.sheetMenus:f(ji))&&e.preventDefault(),onClick:e=>c(r.tab.id)},[r.panes.length>1?(_(),m(i,{key:0,layout:r.layout,panes:r.panes},null,8,[`layout`,`panes`])):(_(),v(`i`,Ca)),F(`span`,wa,M(r.label),1)],42,Sa)]),_:2},1032,[`disabled`,`items`]))),128)),F(`button`,{type:`button`,class:`tab-chip tab-add`,title:(`t`in t?t.t:f(Q))(`New tab`),"aria-label":(`t`in t?t.t:f(Q))(`New tab`),disabled:`offlineView`in t?t.offlineView:f(Qr),onClick:n[4]||=n=>(`newTab`in t?t.newTab:f(Mt))(e.workspace)},[E(l,{name:`i-lucide-plus`})],8,Ta)],8,xa)):g(``,!0)}}}),{__name:`SpaceTabs`}),Da=[`aria-label`,`aria-expanded`],Oa={class:`phone-identity-copy`,"aria-hidden":`true`},ka={class:`phone-identity-title`},Aa={class:`phone-identity-meta`},ja={class:`phone-identity-kind`},Ma={key:0,class:`phone-identity-position`},Na={class:`phone-identity-details`},Pa={class:`phone-identity-summary`},Fa={key:0,class:`phone-identity-current`},Ia={class:`phone-identity-current-title`},La={class:`phone-identity-current-meta`},Ra={class:`menu`},za={key:0,class:`menu-group`},Ba=[`aria-current`,`onClick`],Va={class:`menu-text`},Ha={class:`menu-sub`},Ua={key:1,class:`menu-group`},Wa=[`aria-current`,`onClick`],Ga={class:`menu-text`},Ka={class:`menu-sub`},qa={key:0,class:`menu-sep`},Ja={key:1,class:`menu-group`},Ya=[`disabled`,`onClick`],Xa={class:`menu-text`},Za=Object.assign(ia(T({__name:`PhoneIdentity`,props:{pane:{},workspace:{}},emits:[`overview`],setup(e,{emit:t}){let r=e,i=t,o=h(!1),s=n(()=>De(r.pane.tab)),c=n(()=>s.value?.panes||[r.pane]),l=n(()=>At(r.pane.workspace)),u=n(()=>r.pane.label||r.pane.name||ki(r.pane)),d=n(()=>ai(r.pane.agent)),p=n(()=>!!r.pane.agent&&u.value.toLocaleLowerCase()!==d.value.toLocaleLowerCase()),b=n(()=>`${c.value.findIndex(e=>e.id===r.pane.id)+1}/${c.value.length}`),x=n(()=>Gr(r.pane.machine)),S=n(()=>Sr(r.pane.machine)||r.pane.machine||Q(`This machine`)),C=n(()=>x.value&&x.value.status!==`online`),w=n(()=>C.value?x.value?.status===`connecting`?Q(`Reconnecting…`):Q(`Offline`):Ze(r.pane)),T=n(()=>C.value?`blocked`:ie(r.pane)),D=n(()=>[Z(`Panes and tabs`,`Panneaux et onglets`),u.value,p.value?d.value:null,w.value,...c.value.length>1?[`${Q(`Pane`)} ${b.value}`]:[],r.workspace?.label,S.value].filter(Boolean).join(`, `)),O=n(()=>[{kind:`group`,label:Q(`Current pane`)},...Se(r.pane),{kind:`group`,label:Q(`Current tab`)},...me(r.pane.tab,c.value.length>1?{label:Q(`Tab overview`),icon:`i-lucide-panels-top-left`,desc:Z(`All panes of this tab side by side`,`Tous les panneaux de cet onglet côte à côte`),run:()=>i(`overview`)}:void 0),...we(r.pane)]);z(()=>r.pane.tab,e=>ut(e),{immediate:!0}),z(()=>r.pane.id,()=>{o.value=!1});function A(e){o.value=!1,e.id!==r.pane.id&&It(Be(e.id))}function N(e){o.value=!1,e!==r.pane.tab&&Dt(e)}function P(e){e.disabled||(o.value=!1,e.run?.())}function I(e){let t=Kr(e.panes);return t?Ze(t):Q(`Closed`)}return(t,n)=>{let r=Qe,i=Ut;return _(),v(k,null,[F(`button`,{type:`button`,class:`phone-identity`,"aria-label":f(D),"aria-haspopup":`dialog`,"aria-expanded":f(o),onClick:n[0]||=e=>o.value=!0},[F(`span`,Oa,[F(`span`,ka,M(f(u)),1),F(`span`,Aa,[F(`span`,{class:j([`pill`,f(T)])},[n[2]||=F(`i`,null,null,-1),a(M(f(w)),1)],2),f(p)?(_(),v(k,{key:0},[n[3]||=F(`span`,null,`·`,-1),F(`span`,ja,M(f(d)),1)],64)):g(``,!0)])]),(`paneNotificationsMuted`in t?t.paneNotificationsMuted:f(Ye))(e.pane)?(_(),m(r,{key:0,name:`i-lucide-bell-off`,mode:`svg`,class:`phone-identity-muted`,"aria-hidden":`true`})):g(``,!0),F(`span`,{class:j([`phone-identity-toggle icon-btn`,{on:f(o),"has-position":f(c).length>1}]),"aria-hidden":`true`},[f(c).length>1?(_(),v(`span`,Ma,M(f(b)),1)):g(``,!0),E(r,{name:`i-lucide-chevron-down`,mode:`svg`,class:`phone-identity-chevron`})],2)],8,Da),E(i,{open:f(o),"onUpdate:open":n[1]||=e=>U(o)?o.value=e:null,title:(`tl`in t?t.tl:f(Z))(`Panes and tabs`,`Panneaux et onglets`),"hide-close":``},{default:V(()=>[F(`div`,Na,[F(`p`,Pa,M(f(S))+` · `+M(e.workspace?.label||e.pane.workspace),1),f(c).length<=1?(_(),v(`p`,Fa,[F(`span`,Ia,M(f(u)),1),F(`span`,La,[F(`span`,{class:j([`pill`,f(T)])},[n[4]||=F(`i`,null,null,-1),a(M(f(w)),1)],2),f(p)?(_(),v(k,{key:0},[a(` · `+M(f(d)),1)],64)):g(``,!0)])])):g(``,!0),F(`div`,Ra,[f(c).length>1?(_(),v(`p`,za,M((`tl`in t?t.tl:f(Z))(`Panes in this tab`,`Panneaux de cet onglet`)),1)):g(``,!0),(_(!0),v(k,null,y(f(c).length>1?f(c):[],(i,o)=>(_(),v(`button`,{key:i.id,type:`button`,"aria-current":i.id===e.pane.id?`page`:void 0,onClick:e=>A(i)},[E(r,{name:i.id===e.pane.id?`i-lucide-check`:`i-lucide-panel-top`,class:`menu-icon`},null,8,[`name`]),F(`span`,Va,[F(`span`,null,M(i.label||i.name||(`paneOwnTitle`in t?t.paneOwnTitle:f(ki))(i)),1),F(`span`,Ha,[F(`span`,{class:j([`pill`,(`statusKey`in t?t.statusKey:f(ie))(i)])},[n[5]||=F(`i`,null,null,-1),a(M((`statusLabel`in t?t.statusLabel:f(Ze))(i)),1)],2),a(` · `+M(o+1)+`/`+M(f(c).length),1)])])],8,Ba))),128)),f(l).length>1?(_(),v(`p`,Ua,M((`t`in t?t.t:f(Q))(`Tabs`)),1)):g(``,!0),(_(!0),v(k,null,y(f(l).length>1?f(l):[],i=>(_(),v(`button`,{key:i.tab.id,type:`button`,"aria-current":i.tab.id===e.pane.tab?`page`:void 0,onClick:e=>N(i.tab.id)},[E(r,{name:i.tab.id===e.pane.tab?`i-lucide-check`:`i-lucide-layers`,class:`menu-icon`},null,8,[`name`]),F(`span`,Ga,[F(`span`,null,M(i.tab.label||i.tab.number),1),F(`span`,Ka,[F(`span`,{class:j([`pill`,f(Kr)(i.panes)?(`statusKey`in t?t.statusKey:f(ie))(f(Kr)(i.panes)):`inactive`])},[n[6]||=F(`i`,null,null,-1),a(M(I(i)),1)],2),a(` · `+M(i.panes.length===1?(`tl`in t?t.tl:f(Z))(`1 pane`,`1 panneau`):(`tl`in t?t.tl:f(Z))(`${i.panes.length} panes`,`${i.panes.length} panneaux`)),1)])])],8,Wa))),128)),(_(!0),v(k,null,y(f(O),(e,t)=>(_(),v(k,{key:t},[e.kind===`separator`?(_(),v(`div`,qa)):e.kind===`group`?(_(),v(`p`,Ja,M(e.label),1)):(_(),v(`button`,{key:2,type:`button`,class:j({danger:e.danger}),disabled:e.disabled,onClick:t=>P(e)},[e.icon?(_(),m(r,{key:0,name:e.icon,class:`menu-icon`},null,8,[`name`])):g(``,!0),F(`span`,Xa,[F(`span`,null,M(e.label),1),e.desc?(_(),v(`span`,{key:0,class:j([`menu-sub`,{"font-mono":e.mono}])},M(e.desc),3)):g(``,!0)])],10,Ya))],64))),128))])])]),_:1},8,[`open`,`title`])],64)}}}),[[`__scopeId`,`data-v-54323d30`]]),{__name:`PhoneIdentity`}),Qa={class:`view-toggle-label`},$a=Object.assign(T({__name:`ViewToggle`,props:{mode:{}},emits:[`toggle`],setup(e,{emit:t}){let r=e,i=t,a=n(()=>r.mode===`term`?Q(`Show conversation`):Q(`Show terminal`));return(t,n)=>{let r=bt,o=vt;return _(),m(o,{text:f(a),kbds:f(dt)(`toggle-term`)},{default:V(()=>[E(r,{color:`neutral`,variant:`outline`,size:`sm`,class:`view-toggle mono-btn`,icon:e.mode===`term`?`i-lucide-message-square`:`i-lucide-square-terminal`,"aria-label":f(a),onClick:n[0]||=e=>i(`toggle`)},{default:V(()=>[F(`span`,Qa,M(e.mode===`term`?f(Q)(`Conversation`):f(Q)(`Terminal`)),1)]),_:1},8,[`icon`,`aria-label`])]),_:1},8,[`text`,`kbds`])}}}),{__name:`ViewToggle`}),eo=`input, textarea, select, [contenteditable=""], [contenteditable="true"], .xterm, .term, .chat-list, .msg`,to=`button, a, [role="tab"], [role="button"]:not(.plan-cell), .cell-grip, ${eo}`;function no(e){return!!e?.closest?.(eo)}function ro(e){return!!e?.closest?.(to)}var io=Object.assign(ia(T({__name:`HeaderMenu`,props:{items:{type:Function},title:{},disabled:{type:Boolean},manualPress:{type:Boolean}},setup(e){let t=e,n=h([]);function r(){document.dispatchEvent(new KeyboardEvent(`keydown`,{key:`Escape`,bubbles:!0}))}function i(e){e?(n.value=Ae(t.items()),window.addEventListener(`scroll`,r,{capture:!0,passive:!0})):window.removeEventListener(`scroll`,r,{capture:!0})}l(()=>window.removeEventListener(`scroll`,r,{capture:!0}));let a=``;function o(e){no(e.target)?e.stopPropagation():ji.value&&(e.preventDefault(),a===`mouse`&&!t.disabled&&Ke(t.items(),t.title))}let s=In({onPress:()=>{$(),Ke(t.items(),t.title)}});function c(e){a=e.pointerType,!(!ji.value||t.disabled||t.manualPress||ro(e.target))&&s.down(e)}return(t,r)=>{let a=Qt;return _(),m(a,{disabled:(`sheetMenus`in t?t.sheetMenus:f(ji))||e.disabled,items:f(n),ui:{content:`hw-dropdown`},"onUpdate:open":i},{default:V(()=>[F(`div`,{class:`header-menu`,onContextmenuCapture:o,onPointerdown:c,onPointermove:r[0]||=(...e)=>f(s).move&&f(s).move(...e),onPointerup:r[1]||=(...e)=>f(s).cancel&&f(s).cancel(...e),onPointercancel:r[2]||=(...e)=>f(s).cancel&&f(s).cancel(...e)},[d(t.$slots,`default`,{},void 0,!0)],32)]),_:3},8,[`disabled`,`items`])}}}),[[`__scopeId`,`data-v-562a5bfa`]]),{__name:`HeaderMenu`}),ao=Object.assign(ia(T({__name:`GridBackdrop`,setup(e){let t=h(null),n=h(null),r=h(!1),i,a=!1,o=0,s;function c(){let e=n.value;if(!e||o>=3)return;let t=Me(e.clientWidth,e.clientHeight),r=document.createElement(`i`);r.className=`pkt ${t.vertical?`v`:`h`}${t.reverse?` rev`:``}${t.alt?` alt`:``}`,r.style.left=`${t.left}px`,r.style.top=`${t.top}px`;let i=t.vertical?`Y`:`X`;e.appendChild(r),o++;let a=r.animate([{transform:`translate${i}(${t.reverse?t.dist:0}px)`,opacity:0},{opacity:1,offset:.15},{opacity:1,offset:.7},{transform:`translate${i}(${t.reverse?0:t.dist}px)`,opacity:0}],{duration:t.duration,easing:`cubic-bezier(.4, 0, .6, 1)`});a.onfinish=()=>{r.remove(),o--}}function l(){clearTimeout(s),!a&&J.value&&r.value&&!document.hidden&&(s=setTimeout(()=>{c(),l()},oe()))}return z([r,J],l),w(()=>{a=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,document.addEventListener(`visibilitychange`,l),t.value&&(i=new IntersectionObserver(([e])=>{r.value=!!e?.isIntersecting}),i.observe(t.value))}),H(()=>{i?.disconnect(),document.removeEventListener(`visibilitychange`,l),clearTimeout(s)}),(e,r)=>(_(),v(`div`,{ref_key:`root`,ref:t,class:`grid-backdrop`,"aria-hidden":`true`},[r[0]||=F(`div`,{class:`gbd-dots`},null,-1),F(`div`,{ref_key:`packets`,ref:n,class:`gbd-packets`},null,512),r[1]||=F(`div`,{class:`gbd-vignette`},null,-1)],512))}}),[[`__scopeId`,`data-v-a290ab6b`]]),{__name:`GridBackdrop`}),oo={class:`chat-skel`,"aria-hidden":`true`},so=Object.assign(T({__name:`ChatSkeleton`,props:{agent:{}},setup(e){return(t,n)=>(_(),v(`div`,oo,[n[0]||=F(`div`,{class:`skel-user`},[F(`i`,{style:{width:`78%`}}),F(`i`,{style:{width:`52%`}})],-1),F(`div`,{class:j([`skel-who`,e.agent||``])},null,2),n[1]||=W(`<div class="skel-tool"><span></span><i style="width:62%;"></i></div><div class="skel-lines"><i style="width:92%;"></i><i style="width:84%;"></i><i style="width:66%;"></i></div><div class="skel-user"><i style="width:64%;"></i></div>`,3),F(`div`,{class:j([`skel-who`,e.agent||``])},null,2),n[2]||=W(`<div class="skel-lines"><i style="width:90%;"></i><i style="width:86%;"></i><i style="width:80%;"></i><i style="width:42%;"></i></div>`,1)]))}}),{__name:`ChatSkeleton`}),co=[`aria-expanded`],lo=Object.assign(T({__name:`FoldText`,props:{lines:{}},setup(e){let t=e,r=n(()=>t.lines||12),i=h(null),a=h(!1),o=h(!1),s=null;function l(){let e=i.value;if(!e)return;let t=(Number.parseFloat(getComputedStyle(e).lineHeight)||22.5)*(r.value+.5);a.value=e.scrollHeight>t}return w(()=>{l(),s=new ResizeObserver(l),i.value&&s.observe(i.value)}),c(l),H(()=>s?.disconnect()),(e,n)=>(_(),v(k,null,[F(`span`,{ref_key:`box`,ref:i,class:j([`msg-fold`,{folded:f(a)&&!f(o)}]),style:N({display:`block`,"--fold-max":t.lines?`calc(${t.lines}lh)`:void 0})},[d(e.$slots,`default`)],6),f(a)?(_(),v(`button`,{key:0,type:`button`,class:`msg-fold-btn`,"aria-expanded":f(o),onClick:n[0]||=e=>o.value=!f(o)},M(f(o)?(`tl`in e?e.tl:f(Z))(`Show less`,`Afficher moins`):(`tl`in e?e.tl:f(Z))(`Show more`,`Afficher plus`)),9,co)):g(``,!0)],64))}}),{__name:`FoldText`}),uo={class:`msg-system`},fo={class:`msg-autopilot-body`},po={class:`msg-autopilot-text`},mo=Object.assign(T({__name:`AutopilotMessage`,props:{text:{}},emits:[`copy`],setup(e,{emit:t}){let r=t,i=h(!1),o=h(!1),s=h(!1),c=n(()=>i.value&&(o.value||s.value)),l;function u(){i.value=l?.matches??!1,o.value=!1,s.value=!1}function d(e){s.value=e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget)}return w(()=>{l=window.matchMedia(`(hover: hover) and (pointer: fine)`),u(),l.addEventListener(`change`,u)}),H(()=>l?.removeEventListener(`change`,u)),(t,n)=>{let l=lo,u=bt;return _(),v(`div`,{class:`msg-autopilot`,onMouseenter:n[1]||=e=>o.value=!0,onMouseleave:n[2]||=e=>o.value=!1,onFocusin:n[3]||=e=>s.value=!0,onFocusout:d},[F(`div`,uo,[F(`span`,null,M((`t`in t?t.t:f(Q))(`Autopilot`)),1)]),F(`div`,fo,[F(`div`,po,[E(l,null,{default:V(()=>[a(M(e.text),1)]),_:1})]),I(E(u,{class:`msg-autopilot-copy`,style:N({opacity:+!!f(c),pointerEvents:f(c)?`auto`:`none`}),icon:`i-lucide-copy`,color:`neutral`,variant:`ghost`,size:`xs`,"aria-label":(`t`in t?t.t:f(Q))(`Copy message`),onClick:n[0]||=t=>r(`copy`,e.text)},null,8,[`style`,`aria-label`]),[[ne,f(i)]])])],32)}}}),{__name:`AutopilotMessage`}),ho={key:0,class:`offline-image`},go=[`src`,`onClick`],_o=[`aria-label`],vo=[`src`],yo=[`disabled`,`onClick`],bo=Object.assign(T({__name:`MsgThumbs`,props:{srcs:{},offline:{type:Boolean},max:{},dupes:{}},setup(e){let t=e,r=n(()=>t.srcs.map((e,t)=>({src:e,i:t})).filter(e=>!t.dupes?.has(e.src))),i=n(()=>t.srcs.map((e,t)=>({src:e,i:t})).filter(e=>t.dupes?.has(e.src))),a=n(()=>tr(r.value.length,t.max));function o(e){jt(t.srcs,e)}return(t,n)=>(_(),v(`span`,{class:j([`thumbs`,{one:f(r).length===1}])},[(_(!0),v(k,null,y(f(r).slice(0,f(a).shown),n=>(_(),v(`span`,{key:n.src},[e.offline?(_(),v(`span`,ho,M((`t`in t?t.t:f(Q))(`Image unavailable offline`)),1)):(_(),v(`img`,{key:1,class:`msg-img`,src:n.src,alt:``,loading:`lazy`,decoding:`async`,onClick:e=>o(n.i)},null,8,go))]))),128)),f(a).more?(_(),v(`button`,{key:0,type:`button`,class:`thumb-more`,"aria-label":(`tl`in t?t.tl:f(Z))(`Show all ${f(r).length} images`,`Voir les ${f(r).length} images`),onClick:n[0]||=e=>o(f(r)[f(a).shown].i)},[e.offline?g(``,!0):(_(),v(`img`,{key:0,src:f(r)[f(a).shown].src,alt:``,loading:`lazy`,decoding:`async`},null,8,vo)),F(`span`,null,`+`+M(f(a).more),1)],8,_o)):g(``,!0),(_(!0),v(k,null,y(f(i),n=>(_(),v(`button`,{key:n.src,type:`button`,class:`thumb-dupe`,disabled:e.offline,onClick:e=>o(n.i)},` ↑ `+M((`tl`in t?t.tl:f(Z))(`Same image as above`,`Image déjà affichée plus haut`)),9,yo))),128))],2))}}),{__name:`MsgThumbs`}),xo={class:`file-chip-icon`},So={key:0,class:`spinner`},Co={class:`file-chip-body`},wo={class:`file-chip-name`},To={class:`file-chip-meta`},Eo=[`aria-label`],Do=Object.assign(T({__name:`FileChip`,props:{name:{},size:{},kind:{},uploading:{type:Boolean},removable:{type:Boolean},clickable:{type:Boolean}},emits:[`remove`,`open`],setup(e,{emit:t}){let r=e,i=t,a=n(()=>Un(r.name,r.kind)),o=n(()=>Pn(r.name).slice(0,6)||(r.kind===`text`?`txt`:``));function s(e){r.clickable&&i(`open`,e.currentTarget)}return(t,n)=>{let r=Qe;return _(),m(C(e.clickable?`button`:`div`),{type:e.clickable?`button`:void 0,class:j([`file-chip`,{up:e.uploading,clickable:e.clickable}]),title:e.name,onClick:s},{default:V(()=>[F(`span`,xo,[e.uploading?(_(),v(`span`,So)):(_(),m(r,{key:1,name:f(a)},null,8,[`name`]))]),F(`span`,Co,[F(`span`,wo,M(e.name),1),F(`span`,To,M([f(o),e.size?f(Mn)(e.size):``].filter(Boolean).join(` · `)),1)]),e.removable?(_(),v(`button`,{key:0,type:`button`,class:`file-chip-x`,"aria-label":(`t`in t?t.t:f(Q))(`Remove`),onClick:n[0]||=re(e=>i(`remove`),[`stop`])},[E(r,{name:`i-lucide-x`})],8,Eo)):g(``,!0)]),_:1},8,[`type`,`class`,`title`])}}}),{__name:`FileChip`}),Oo={key:0,class:`msg-ref-meta`},ko={class:`msg-ref-text`},Ao={key:1,class:`msg-q`},jo=Object.assign(T({__name:`QuotedText`,props:{text:{}},setup(e){let t=e,r=n(()=>Y(t.text).map(e=>e.kind===`ref`?e:{...e,text:e.text.replace(/^\n+|\n+$/g,``)}).filter(e=>e.kind===`ref`||e.text)),i=A(`gotoRef`,null),o=e=>e.kind===`task`?e.label.replace(/\s*:$/,``):[e.time,e.n?`#${e.n}`:``].filter(Boolean).join(` · `);return(e,t)=>(_(!0),v(k,null,y(f(r),(n,r)=>(_(),v(k,{key:r},[n.kind===`ref`?(_(),m(C(f(i)&&n.ref.kind!==`task`?`button`:`span`),{key:0,class:`msg-ref`,"data-kind":n.ref.kind,type:f(i)&&n.ref.kind!==`task`?`button`:void 0,"aria-label":f(i)&&n.ref.kind!==`task`?`${(`t`in e?e.t:f(Q))(`Show original message`)}: ${n.ref.excerpt}`:void 0,onClick:e=>f(i)&&n.ref.kind!==`task`&&f(i)(n.ref,e.currentTarget)},{default:V(()=>[t[0]||=F(`span`,{class:`msg-ref-mark`,"aria-hidden":`true`},`↳`,-1),o(n.ref)?(_(),v(`span`,Oo,M(o(n.ref)),1)):g(``,!0),F(`span`,ko,M(n.ref.excerpt),1)]),_:2},1032,[`data-kind`,`type`,`aria-label`,`onClick`])):n.kind===`quote`?(_(),v(`span`,Ao,M(n.text),1)):(_(),v(k,{key:2},[a(M(n.text),1)],64))],64))),128))}}),{__name:`QuotedText`}),Mo=[`aria-label`],No={class:`pasted-head`},Po=[`aria-label`],Fo={class:`pasted-foot`},Io=Object.assign(T({__name:`PastedCard`,props:{text:{},removable:{type:Boolean}},emits:[`remove`],setup(e,{emit:t}){let r=e,i=t,o=h(!1),s=n(()=>at(r.text)),c=n(()=>r.text.split(`
2
+ `).filter(e=>e.trim()).slice(0,2).map(e=>e.trim())),l=n(()=>He(r.text)),u=n(()=>Z(`Pasted text · ${s.value} line${s.value>1?`s`:``}`,`Texte collé · ${s.value} ligne${s.value>1?`s`:``}`));async function d(){try{await navigator.clipboard.writeText(r.text),X(Z(`Text copied`,`Texte copié`))}catch{X(Q(`Copy failed`),!0)}}return(t,n)=>{let r=Qe,s=bt,p=Ut;return _(),v(`div`,{class:j([`pasted-card`,{removable:e.removable}])},[F(`button`,{type:`button`,class:`pasted-open`,"aria-label":(`tl`in t?t.tl:f(Z))(`Open pasted text`,`Ouvrir le texte collé`),onClick:n[0]||=e=>o.value=!0},[F(`span`,No,[E(r,{name:`i-lucide-clipboard-paste`}),a(M(f(u)),1)]),(_(!0),v(k,null,y(f(c),(e,t)=>(_(),v(`span`,{key:t,class:`pasted-line`},M(e),1))),128))],8,Mo),e.removable?(_(),v(`button`,{key:0,type:`button`,class:`pasted-x`,"aria-label":(`t`in t?t.t:f(Q))(`Remove`),onClick:n[1]||=re(e=>i(`remove`),[`stop`])},[E(r,{name:`i-lucide-x`})],8,Po)):g(``,!0),E(p,{open:f(o),"onUpdate:open":n[2]||=e=>U(o)?o.value=e:null,title:f(u),wide:``,tall:``},{footer:V(()=>[F(`div`,Fo,[E(s,{icon:`i-lucide-copy`,color:`neutral`,variant:`outline`,onClick:d},{default:V(()=>[a(M((`tl`in t?t.tl:f(Z))(`Copy`,`Copier`)),1)]),_:1})])]),default:V(()=>[F(`pre`,{class:j([`pasted-full`,{mono:f(l)}])},M(e.text),3)]),_:1},8,[`open`,`title`])],2)}}}),{__name:`PastedCard`}),Lo={key:1,class:`msg-pastes`},Ro=Object.assign(T({__name:`UserText`,props:{text:{},pasted:{}},setup(e){let t=e,r=n(()=>xt(t.text,t.pasted,ft.value));return(e,t)=>{let n=jo,i=lo,a=Io;return _(),v(k,null,[f(r).text?(_(),m(i,{key:0},{default:V(()=>[E(n,{text:f(r).text},null,8,[`text`])]),_:1})):g(``,!0),f(r).pastes.length?(_(),v(`span`,Lo,[(_(!0),v(k,null,y(f(r).pastes,(e,t)=>(_(),m(a,{key:t,text:e},null,8,[`text`]))),128))])):g(``,!0)],64)}}}),{__name:`UserText`}),zo={slots:{root:`group/message relative w-full`,header:`flex mb-1.5`,container:`relative flex items-start`,body:`min-w-0`,leading:`inline-flex items-center justify-center min-h-6`,leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,files:`flex items-center gap-1.5`,content:`relative text-pretty wrap-break-word *:first:mt-0 *:last:mb-0`,actions:[`[@media(hover:hover)]:opacity-0 group-hover/message:opacity-100 absolute bottom-0 flex items-center`,`transition-opacity ease-out`]},variants:{variant:{solid:``,outline:``,soft:``,subtle:``,naked:``},color:{primary:``,neutral:``,success:``,warning:``,error:``,info:``},side:{left:{},right:{container:`justify-end ms-auto max-w-[75%]`,header:`justify-end`,actions:`right-0`}},leading:{true:``},actions:{true:``},compact:{true:{root:`scroll-mt-3`,container:`gap-1.5 pb-3`,content:`space-y-2`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},false:{root:`scroll-mt-4 sm:scroll-mt-6`,container:`gap-3 pb-8`,content:`space-y-4`,leadingIcon:`size-8`,leadingAvatarSize:`md`}}},compoundVariants:[{compact:!0,actions:!0,class:{container:`pb-8`}},{variant:[`solid`,`outline`,`soft`,`subtle`],compact:!1,class:{content:`px-4 py-3 rounded-lg min-h-12`,leading:`mt-2`}},{variant:[`solid`,`outline`,`soft`,`subtle`],compact:!0,class:{content:`px-2 py-1 rounded-lg min-h-8`,leading:`mt-1`}},{variant:`naked`,side:`left`,class:{body:`w-full`,content:`w-full`}},{color:`primary`,variant:`solid`,class:{content:`bg-primary text-inverted`}},{color:`neutral`,variant:`solid`,class:{content:`bg-neutral text-inverted`}},{color:`success`,variant:`solid`,class:{content:`bg-success text-inverted`}},{color:`warning`,variant:`solid`,class:{content:`bg-warning text-inverted`}},{color:`error`,variant:`solid`,class:{content:`bg-error text-inverted`}},{color:`info`,variant:`solid`,class:{content:`bg-info text-inverted`}},{color:`primary`,variant:`outline`,class:{content:`text-primary ring ring-primary/25`}},{color:`neutral`,variant:`outline`,class:{content:`text-neutral ring ring-neutral/25`}},{color:`success`,variant:`outline`,class:{content:`text-success ring ring-success/25`}},{color:`warning`,variant:`outline`,class:{content:`text-warning ring ring-warning/25`}},{color:`error`,variant:`outline`,class:{content:`text-error ring ring-error/25`}},{color:`info`,variant:`outline`,class:{content:`text-info ring ring-info/25`}},{color:`primary`,variant:`soft`,class:{content:`bg-primary/10 text-primary`}},{color:`neutral`,variant:`soft`,class:{content:`bg-neutral/10 text-neutral`}},{color:`success`,variant:`soft`,class:{content:`bg-success/10 text-success`}},{color:`warning`,variant:`soft`,class:{content:`bg-warning/10 text-warning`}},{color:`error`,variant:`soft`,class:{content:`bg-error/10 text-error`}},{color:`info`,variant:`soft`,class:{content:`bg-info/10 text-info`}},{color:`primary`,variant:`subtle`,class:{content:`bg-primary/10 text-primary ring ring-primary/25`}},{color:`neutral`,variant:`subtle`,class:{content:`bg-neutral/10 text-neutral ring ring-neutral/25`}},{color:`success`,variant:`subtle`,class:{content:`bg-success/10 text-success ring ring-success/25`}},{color:`warning`,variant:`subtle`,class:{content:`bg-warning/10 text-warning ring ring-warning/25`}},{color:`error`,variant:`subtle`,class:{content:`bg-error/10 text-error ring ring-error/25`}},{color:`info`,variant:`subtle`,class:{content:`bg-info/10 text-info ring ring-info/25`}},{color:`primary`,variant:`naked`,class:{content:`text-primary`}},{color:`neutral`,variant:`naked`,class:{content:`text-neutral`}},{color:`success`,variant:`naked`,class:{content:`text-success`}},{color:`warning`,variant:`naked`,class:{content:`text-warning`}},{color:`error`,variant:`naked`,class:{content:`text-error`}},{color:`info`,variant:`naked`,class:{content:`text-info`}},{color:`neutral`,variant:`solid`,class:{content:`bg-inverted text-inverted`}},{color:`neutral`,variant:`outline`,class:{content:`bg-default ring ring-default`}},{color:`neutral`,variant:`soft`,class:{content:`bg-elevated/50`}},{color:`neutral`,variant:`subtle`,class:{content:`bg-elevated/50 ring ring-default`}}],defaultVariants:{side:`left`,variant:`naked`,color:`neutral`}},Bo={__name:`UChatMessage`,props:{as:{type:null,required:!1,default:`article`},icon:{type:null,required:!1},avatar:{type:Object,required:!1},variant:{type:null,required:!1},color:{type:null,required:!1},side:{type:null,required:!1},actions:{type:Array,required:!1},compact:{type:Boolean,required:!1},content:{type:String,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},id:{type:String,required:!0},role:{type:String,required:!0},metadata:{type:null,required:!1},parts:{type:Array,required:!0}},setup(e){let r=e,i=O(),o=We(`chatMessage`,r),s=ar(),c=n(()=>o.parts?.filter(e=>e.type===`file`)??[]),l=n(()=>o.parts?.filter(e=>e.type===`text`)??[]),u=n(()=>de(o,[`as`,`icon`,`avatar`,`variant`,`color`,`side`,`actions`,`compact`,`class`,`ui`,`content`])),p=n(()=>lt({extend:zo,...s.ui?.chatMessage||{}})({variant:o.variant,color:o.color,side:o.side,leading:!!o.icon||!!o.avatar||!!i.leading,actions:!!o.actions||!!i.actions,compact:o.compact}));return(e,n)=>(_(),m(f(Ne),{as:f(o).as,"data-role":f(o).role,"data-slot":`root`,class:j(p.value.root({class:[f(o).ui?.root,f(o).class]}))},{default:V(()=>[i.files&&c.value.length||i.header?(_(),v(`div`,{key:0,"data-slot":`header`,class:j(p.value.header({class:f(o).ui?.header}))},[d(e.$slots,`header`,L(t({...u.value})),()=>[i.files&&c.value.length?(_(),v(`div`,{key:0,"data-slot":`files`,class:j(p.value.files({class:f(o).ui?.files}))},[d(e.$slots,`files`,L(t({...u.value,parts:c.value})))],2)):g(``,!0)])],2)):g(``,!0),F(`div`,{"data-slot":`container`,class:j(p.value.container({class:f(o).ui?.container}))},[f(o).icon||f(o).avatar||i.leading?(_(),v(`div`,{key:0,"data-slot":`leading`,class:j(p.value.leading({class:f(o).ui?.leading}))},[d(e.$slots,`leading`,L(t({...u.value,avatar:f(o).avatar,ui:p.value})),()=>[f(o).icon?(_(),m(Qe,{key:0,name:f(o).icon,"data-slot":`leadingIcon`,class:j(p.value.leadingIcon({class:f(o).ui?.leadingIcon}))},null,8,[`name`,`class`])):f(o).avatar?(_(),m(Tt,R({key:1,size:f(o).ui?.leadingAvatarSize||p.value.leadingAvatarSize()},f(o).avatar,{"data-slot":`leadingAvatar`,class:p.value.leadingAvatar({class:f(o).ui?.leadingAvatar})}),null,16,[`size`,`class`])):g(``,!0)])],2)):g(``,!0),f(o).content||l.value.length||i.content||f(o).actions||i.actions||i.body?(_(),v(`div`,{key:1,"data-slot":`body`,class:j(p.value.body({class:f(o).ui?.body}))},[d(e.$slots,`body`,L(t({...u.value})),()=>[f(o).content||l.value.length||i.content?(_(),v(`div`,{key:0,"data-slot":`content`,class:j(p.value.content({class:f(o).ui?.content}))},[d(e.$slots,`content`,L(t({...u.value,content:f(o).content})),()=>[f(o).content?(_(),v(k,{key:0},[a(M(f(o).content),1)],64)):(_(!0),v(k,{key:1},y(l.value,(e,t)=>(_(),v(k,{key:`${f(o).id}-${e.type}-${t}`},[a(M(e.text),1)],64))),128))])],2)):g(``,!0),f(o).actions||i.actions?(_(),v(`div`,{key:1,"data-slot":`actions`,class:j(p.value.actions({class:f(o).ui?.actions}))},[d(e.$slots,`actions`,L(t({...u.value,actions:f(o).actions})),()=>[(_(!0),v(k,null,y(f(o).actions,(e,t)=>(_(),m(vt,{key:t,text:e.label},{default:V(()=>[E(bt,R({size:`sm`,color:`neutral`,variant:`ghost`},{ref_for:!0},f(de)(e,[`onClick`]),{label:void 0,onClick:t=>typeof e.onClick==`function`?e.onClick(t,u.value):void 0}),null,16,[`onClick`])]),_:2},1032,[`text`]))),128))])],2)):g(``,!0)])],2)):g(``,!0)],2)]),_:3},8,[`as`,`data-role`,`class`]))}};function Vo(e,t={}){let{arrivedState:r}=Et(e);return{style:n(()=>{let n=o(e),i=o(t.orientation)??`vertical`,[a,s]=i===`horizontal`?[`left`,`right`]:[`top`,`bottom`],c=!r[a],l=!r[s];if(!c&&!l||!(n&&(i===`horizontal`?n.scrollWidth>n.clientWidth:n.scrollHeight>n.clientHeight)))return;let u=`${o(t.size)??24}px`,d=i===`horizontal`?`90deg`:`180deg`;return c&&l?{maskImage:`linear-gradient(${d}, transparent, #000 ${u}, #000 calc(100% - ${u}), transparent)`}:c?{maskImage:`linear-gradient(${d}, transparent, #000 ${u})`}:{maskImage:`linear-gradient(${d}, #000, #000 calc(100% - ${u}), transparent)`}}),isOverflowing:n(()=>{r.top,r.bottom,r.left,r.right;let n=o(e);return n?(o(t.orientation)??`vertical`)===`horizontal`?n.scrollWidth>n.clientWidth:n.scrollHeight>n.clientHeight:!1}),arrivedState:r}}var Ho={base:`text-transparent bg-clip-text bg-no-repeat bg-size-[calc(200%+var(--spread)*2+2px)_100%,auto] bg-[image:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--ui-text-highlighted),#0000_calc(50%+var(--spread))),linear-gradient(var(--ui-text-muted),var(--ui-text-muted))] motion-safe:animate-[shimmer_var(--duration)_linear_infinite] motion-safe:rtl:animate-[shimmer-rtl_var(--duration)_linear_infinite] will-change-[background-position] motion-reduce:bg-none motion-reduce:text-muted`},Uo={__name:`UChatShimmer`,props:{as:{type:null,required:!1,default:`span`},text:{type:String,required:!0},duration:{type:Number,required:!1,default:2},spread:{type:Number,required:!1,default:2},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e){let t=We(`chatShimmer`,e),r=ar(),i=n(()=>lt({extend:Ho,...r.ui?.chatShimmer||{}})),o=n(()=>t.text.length*t.spread);return(e,n)=>(_(),m(f(Ne),{as:f(t).as,style:N({"--spread":`${o.value}px`,"--duration":`${f(t).duration}s`}),"data-slot":`base`,class:j(i.value({class:[f(t).ui?.base,f(t).class]}))},{default:V(()=>[a(M(f(t).text),1)]),_:1},8,[`as`,`style`,`class`]))}},Wo={slots:{root:``,trigger:[`group flex w-full items-center gap-1.5 text-muted text-sm disabled:cursor-default disabled:hover:text-muted hover:text-default rounded-sm outline-primary/25 focus-visible:outline-3 min-w-0`,`transition-colors`],leading:`relative size-4 shrink-0`,leadingIcon:`size-4 shrink-0`,chevronIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,label:`truncate`,trailingIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,content:`data-[state=open]:animate-[collapsible-down_200ms_var(--ease-out)] data-[state=closed]:animate-[collapsible-up_200ms_var(--ease-out)] data-[state=closed]:overflow-hidden rounded-sm outline-primary/25 has-focus-visible:outline-3`,body:`max-h-[200px] pt-2 overflow-y-auto text-sm text-dimmed whitespace-pre-wrap focus:outline-none`},variants:{chevron:{leading:{leadingIcon:`group-hover:opacity-0`},trailing:``},alone:{false:{leadingIcon:[`absolute inset-0 group-data-[state=open]:opacity-0`,`transition-opacity duration-200 ease-out`],chevronIcon:[`absolute inset-0 opacity-0 group-hover:opacity-100 group-data-[state=open]:opacity-100`,`transition-[rotate,opacity] duration-200 ease-out motion-reduce:transition-none`]}}}},Go={__name:`UChatReasoning`,props:{text:{type:String,required:!1},streaming:{type:Boolean,required:!1,default:!1},duration:{type:Number,required:!1},icon:{type:null,required:!1},chevron:{type:String,required:!1,default:`trailing`},chevronIcon:{type:null,required:!1},autoCloseDelay:{type:Number,required:!1,default:500},shimmer:{type:Object,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!1}},emits:[`update:open`],setup(e,{emit:t}){let r=e,i=t,o=We(`chatReasoning`,r),{t:s,code:c}=un(),u=ar(),p=n(()=>lt({extend:Wo,...u.ui?.chatReasoning||{}})({chevron:o.chevron})),y=n(()=>o.open!==void 0),x=h(o.defaultOpen??o.streaming),S=h(o.streaming?Date.now():null),C=h(void 0),w=h(null);z(()=>o.streaming,(e,t)=>{e?(w.value&&=(clearTimeout(w.value),null),t||(k(!0),S.value=Date.now())):t&&(S.value!==null&&(C.value=Math.ceil((Date.now()-S.value)/1e3),S.value=null),o.autoCloseDelay>0&&(w.value=setTimeout(()=>{k(!1)},o.autoCloseDelay)))},{immediate:!0});let T=n(()=>o.duration??C.value),D=n(()=>{if(o.streaming||T.value===0)return s(`chatReasoning.thinking`);if(T.value===void 0)return s(`chatReasoning.thought`);let e=T.value,t=e<60?`second`:`minute`,n=e<60?e:Math.floor(e/60),r=new Intl.NumberFormat(c.value,{style:`unit`,unit:t,unitDisplay:`long`}).format(n);return s(`chatReasoning.thoughtFor`,{duration:r})}),O=n(()=>y.value?o.open:x.value);function k(e){w.value&&=(clearTimeout(w.value),null),x.value=e,i(`update:open`,e)}l(()=>{w.value&&clearTimeout(w.value)});let A=n(()=>!!o.text||o.streaming),I=n(()=>o.chevronIcon||u.ui.icons?.chevronDown),L=b(`bodyRef`),{style:B}=Vo(L);return z(()=>o.text,()=>{if(!o.streaming||!L.value)return;let e=L.value;e.scrollHeight-e.scrollTop-e.clientHeight<50&&P(()=>{e.scrollTop=e.scrollHeight})}),(e,t)=>A.value?(_(),m(f(va),{key:0,open:O.value,disabled:f(o).disabled,"unmount-on-hide":f(o).unmountOnHide,"data-slot":`root`,class:j(p.value.root({class:[f(o).ui?.root,f(o).class]})),"onUpdate:open":k},{default:V(({open:t})=>[E(f(ba),{"as-child":``,disabled:!A.value},{default:V(()=>[F(`button`,{type:`button`,"data-slot":`trigger`,class:j(p.value.trigger({class:f(o).ui?.trigger}))},[f(o).icon||A.value&&f(o).chevron===`leading`?(_(),v(`span`,{key:0,"data-slot":`leading`,class:j(p.value.leading({class:f(o).ui?.leading}))},[f(o).icon?(_(),m(Qe,{key:0,name:f(o).icon,"data-slot":`leadingIcon`,class:j(p.value.leadingIcon({class:f(o).ui?.leadingIcon,alone:!(A.value&&f(o).chevron===`leading`)}))},null,8,[`name`,`class`])):g(``,!0),A.value&&f(o).chevron===`leading`?(_(),m(Qe,{key:1,name:I.value,"data-slot":`chevronIcon`,class:j(p.value.chevronIcon({class:f(o).ui?.chevronIcon,alone:!f(o).icon}))},null,8,[`name`,`class`])):g(``,!0)],2)):g(``,!0),f(o).streaming?(_(),m(Uo,R({key:1,text:D.value},f(o).shimmer,{"data-slot":`label`,class:p.value.label({class:f(o).ui?.label})}),null,16,[`text`,`class`])):(_(),v(`span`,{key:2,"data-slot":`label`,class:j(p.value.label({class:f(o).ui?.label}))},M(D.value),3)),A.value&&f(o).chevron===`trailing`?(_(),m(Qe,{key:3,name:I.value,"data-slot":`trailingIcon`,class:j(p.value.trailingIcon({class:f(o).ui?.trailingIcon}))},null,8,[`name`,`class`])):g(``,!0)],2)]),_:1},8,[`disabled`]),E(f(ya),{"data-slot":`content`,class:j(p.value.content({class:f(o).ui?.content}))},{default:V(()=>[F(`div`,{ref_key:`bodyRef`,ref:L,"data-slot":`body`,class:j(p.value.body({class:f(o).ui?.body})),style:N(f(B))},[d(e.$slots,`default`,{open:t},()=>[a(M(f(o).text),1)])],6)]),_:2},1032,[`class`])]),_:3},8,[`open`,`disabled`,`unmount-on-hide`,`class`])):g(``,!0)}},Ko=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`];function qo(e,t=!1){return t?`⠿`:Ko[Math.floor(Math.max(0,e)/80)%Ko.length]}function Jo(e,t){return t?e?1e3:80:null}function Yo(e,t){let n=Math.max(0,Math.floor((t-e)/1e3)),r=Math.floor(n/3600),i=Math.floor(n%3600/60);return r?`${r}h ${i}m`:i?`${i}m ${n%60}s`:`${n}s`}var Xo={class:`omp-spinner`,"aria-hidden":`true`},Zo={key:0,class:`omp-elapsed`},Qo=Object.assign(T({__name:`OmpSpinner`,props:{since:{}},setup(e){let t=e,r=h(0),i=h(Date.now()),a=n(()=>qo(i.value-r.value,ci.value)),o=n(()=>t.since?Yo(t.since,i.value):``),s;function c(){s&&clearInterval(s),s=void 0}function l(){i.value=Date.now()}function u(){c();let e=Jo(ci.value,ti.value);e!==null&&(l(),s=na(l,e))}return w(()=>{z(ci,()=>{r.value=i.value=Date.now(),u()},{immediate:!0}),z(ti,u)}),H(c),(e,t)=>(_(),v(k,null,[F(`span`,Xo,M(f(a)),1),d(e.$slots,`default`),f(o)?(_(),v(`span`,Zo,M(f(o)),1)):g(``,!0)],64))}}),{__name:`OmpSpinner`}),$o=Object.assign(T({__name:`OmpElapsed`,props:{since:{}},setup(e){let t=e,n=h(Date.now()),r;return w(()=>{r=na(()=>{n.value=Date.now()},1e3)}),H(()=>{r&&clearInterval(r)}),(e,r)=>(_(),v(`span`,null,M(f(Yo)(t.since,f(n))),1))}}),{__name:`OmpElapsed`});function es(e){if(!(e>=0))return``;if(e<6e4)return`${(e/1e3).toFixed(2)}s`;let t=Math.round(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60);return n?`${n}h${r}m`:`${r}m${t%60}s`}var ts=(e,t,n,r,i)=>`${e} ${e===1?Z(t,r):Z(n,i)}`;function ns(e){let t=[];return typeof e.matches==`number`?t.push(ts(e.matches,`match`,`matches`,`résultat`,`résultats`)+(e.files&&e.files>1&&e.files<e.matches?` ${Z(`in ${e.files} files`,`dans ${e.files} fichiers`)}`:``)):typeof e.files==`number`&&t.push(ts(e.files,`file`,`files`,`fichier`,`fichiers`)),e.scope&&t.push(`${Z(`in`,`dans`)} ${e.scope}`),(typeof e.added==`number`||typeof e.removed==`number`)&&t.push(`+${e.added||0}/-${e.removed||0}`),e.job&&t.push(`${Z(`Backgrounded`,`En arrière-plan`)}: ${e.job}`),e.cancelled&&t.push(Z(`cancelled`,`annulée`)),t}function rs(e){return!e.out||!e.outLines?0:Math.max(0,e.outLines-e.out.split(`
3
+ `).length)}function is(e){return e.out?ts(Math.max(e.outLines||0,e.out.split(`
4
+ `).length),`line`,`lines`,`ligne`,`lignes`):``}function as(e){if(e.title===`Bash`||e.title===`Python`)return e.target||e.title.toLowerCase();let t=e.title.toLowerCase().replace(/\s+/g,`_`);return e.target?`${t} ${e.target}`:t}function os(e,t){let n=rs(e);return{label:e.diff?`Diff`:t?Z(`Error`,`Erreur`):`Output`,earlier:n?`… ${ts(n,`earlier line`,`earlier lines`,`ligne avant`,`lignes avant`)}`:``}}var ss=e=>e.reduce((e,t)=>e+(t.omp&&typeof t.omp.ms==`number`?t.omp.ms:0),0),cs=e=>e.length>0&&e.every(e=>e.omp);function ls(e,t){return t||e.length<=3?{hidden:0,rows:e}:{hidden:e.length-3,rows:e.slice(-3)}}var us={class:`omp-tool-line`},ds={class:`omp-tool-glyph`,"aria-hidden":`true`},fs={class:`omp-tool-cmd`},ps={key:0,class:`omp-tool-wall`},ms={key:1,class:`omp-tool-wall`},hs={class:`omp-tool-sub`},gs={key:1,class:`omp-tool-intent`},_s={key:2,class:`omp-tool-result`},vs={class:`omp-tool-exit`},ys={key:0,class:`omp-tool-out`},bs={class:`omp-tool-out-head`},xs={class:`omp-tool-out-label`},Ss={key:0,class:`omp-tool-out-earlier`},Cs={class:`omp-tool-out-right`},ws={key:0,class:`omp-tool-exit`},Ts={key:1},Es=Object.assign(T({__name:`OmpTool`,props:{tool:{},live:{type:Boolean},run:{type:Boolean}},setup(e){let t=e,r=h(!1),i=n(()=>t.tool.omp),o=n(()=>!!t.tool.error),s=n(()=>ns(i.value).concat(t.run?[is(i.value)].filter(Boolean):[]).join(` · `)),c=n(()=>i.value.exit?String(i.value.exit):``),l=n(()=>t.live||i.value.ms===void 0?``:es(i.value.ms)),u=n(()=>t.live&&t.tool.ts&&Date.parse(t.tool.ts)||null),d=n(()=>i.value.intent||i.value.title),p=n(()=>!!i.value.out),b=n(()=>os(i.value,o.value)),x=n(()=>(i.value.out||``).split(`
5
+ `).map(e=>({text:e,cls:i.value.diff?/^\+\s*\d*\|/.test(e)?`add`:/^-\s*\d*\|/.test(e)?`del`:``:``})));return(t,n)=>{let h=Qo,S=$o,w=Qe,T=Uo;return _(),v(`div`,{class:j([`omp-tool`,{err:f(o),live:e.live,open:f(r)}])},[(_(),m(C(f(p)?`button`:`div`),{class:`omp-tool-head`,type:f(p)?`button`:void 0,"aria-expanded":f(p)?f(r):void 0,onClick:n[0]||=e=>f(p)&&(r.value=!f(r))},{default:V(()=>[F(`span`,us,[F(`span`,ds,[e.live?(_(),m(h,{key:0})):(_(),v(k,{key:1},[a(M(f(o)?`✗`:`❯`),1)],64))]),F(`code`,fs,M(f(as)(f(i))),1),f(u)?(_(),v(`span`,ps,[E(S,{since:f(u)},null,8,[`since`])])):f(l)?(_(),v(`span`,ms,M(f(l)),1)):g(``,!0),e.run&&f(p)?(_(),m(w,{key:2,name:f(r)?`i-lucide-chevron-up`:`i-lucide-chevron-down`,class:`omp-tool-chev`,"aria-hidden":`true`},null,8,[`name`])):g(``,!0)]),F(`span`,hs,[e.live?(_(),m(T,{key:0,text:`# ${f(d)}`,duration:2.4,class:`omp-tool-intent`},null,8,[`text`])):f(i).intent?(_(),v(`span`,gs,`# `+M(f(i).intent),1)):g(``,!0),f(s)||f(c)?(_(),v(`span`,_s,[a(`→ `+M(f(s)),1),f(c)?(_(),v(k,{key:0},[f(s)?(_(),v(k,{key:0},[a(` · `)],64)):g(``,!0),F(`span`,vs,`exit `+M(f(c)),1)],64)):g(``,!0)])):g(``,!0)])]),_:1},8,[`type`,`aria-expanded`])),f(p)&&f(r)?(_(),v(`div`,ys,[F(`div`,bs,[F(`span`,xs,M(f(b).label),1),f(b).earlier?(_(),v(`span`,Ss,M(f(b).earlier),1)):g(``,!0),F(`span`,Cs,[f(c)?(_(),v(`span`,ws,`exit `+M(f(c)),1)):g(``,!0),f(l)?(_(),v(`span`,Ts,M(f(l)),1)):g(``,!0)])]),F(`pre`,null,[(_(!0),v(k,null,y(f(x),(e,t)=>(_(),v(`span`,{key:t,class:j(e.cls)},M(e.text)+`
6
+ `,3))),128))])])):g(``,!0)],2)}}}),{__name:`OmpTool`}),Ds={slots:{root:``,trigger:[`group flex w-full items-center gap-1.5 text-muted text-sm disabled:cursor-default disabled:hover:text-muted hover:text-default min-w-0`,`transition-colors`],leading:`relative size-4 shrink-0`,leadingIcon:`size-4 shrink-0`,chevronIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,label:`truncate`,suffix:`text-dimmed ms-1`,trailingIcon:`size-4 shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200 ease-out motion-reduce:transition-none`,content:`data-[state=open]:animate-[collapsible-down_200ms_var(--ease-out)] data-[state=closed]:animate-[collapsible-up_200ms_var(--ease-out)] data-[state=closed]:overflow-hidden`,body:`text-sm text-dimmed whitespace-pre-wrap`,actions:`flex items-center justify-end gap-1.5`},variants:{variant:{inline:{trigger:`rounded-sm outline-primary/25 focus-visible:outline-3`,body:`pt-2`,actions:`pt-2`},card:{root:`rounded-md ring ring-default overflow-hidden outline-primary/25 has-focus-visible:outline-3 has-focus-visible:ring-primary`,trigger:`px-2 py-1 focus:outline-none`,trailingIcon:`ms-auto`,body:`border-t border-default p-2 max-h-[200px] overflow-y-auto focus:outline-none`,actions:`border-t border-default p-2`}},chevron:{leading:``,trailing:``},loading:{true:{leadingIcon:`animate-spin`}},alone:{false:{leadingIcon:[`absolute inset-0 group-hover:opacity-0 group-data-[state=open]:opacity-0`,`transition-opacity duration-200 ease-out`],chevronIcon:[`absolute inset-0 opacity-0 group-hover:opacity-100 group-data-[state=open]:opacity-100`,`transition-[rotate,opacity] duration-200 ease-out motion-reduce:transition-none`]}}}},Os=[`data-state`],ks={__name:`UChatTool`,props:{text:{type:String,required:!1},suffix:{type:String,required:!1},icon:{type:null,required:!1},loading:{type:Boolean,required:!1,default:!1},loadingIcon:{type:null,required:!1},streaming:{type:Boolean,required:!1,default:!1},variant:{type:null,required:!1,default:`inline`},chevron:{type:String,required:!1,default:`trailing`},chevronIcon:{type:null,required:!1},shimmer:{type:Object,required:!1},actions:{type:Array,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultOpen:{type:Boolean,required:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!1}},emits:[`update:open`],setup(e,{emit:t}){let r=e,i=t,o=O(),s=We(`chatTool`,r),c=ar(),l=n(()=>lt({extend:Ds,...c.ui?.chatTool||{}})({variant:s.variant,chevron:s.chevron,loading:s.loading})),u=n(()=>s.open!==void 0),p=h(s.defaultOpen??!1),b=n(()=>u.value?s.open:p.value);function x(e){p.value=e,i(`update:open`,e)}let S=n(()=>!!o.default);z(()=>!!s.actions?.length,e=>{e&&S.value&&s.open===void 0&&s.defaultOpen===void 0&&(p.value=!0)},{immediate:!0});let C=n(()=>s.loadingIcon||c.ui.icons?.loading),w=n(()=>s.loading?C.value:s.icon),T=n(()=>s.chevronIcon||c.ui.icons?.chevronDown);return(e,t)=>(_(),m(f(va),{open:b.value,disabled:f(s).disabled,"unmount-on-hide":f(s).unmountOnHide,"data-slot":`root`,class:j(l.value.root({class:[f(s).ui?.root,f(s).class]})),"onUpdate:open":x},{default:V(({open:t})=>[E(f(ba),{"as-child":``,disabled:!S.value},{default:V(()=>[F(`button`,{type:`button`,"data-slot":`trigger`,class:j(l.value.trigger({class:f(s).ui?.trigger}))},[w.value||S.value&&f(s).chevron===`leading`?(_(),v(`span`,{key:0,"data-slot":`leading`,class:j(l.value.leading({class:f(s).ui?.leading}))},[w.value?(_(),m(Qe,{key:0,name:w.value,"data-slot":`leadingIcon`,class:j(l.value.leadingIcon({class:f(s).ui?.leadingIcon,alone:!(S.value&&f(s).chevron===`leading`)}))},null,8,[`name`,`class`])):g(``,!0),S.value&&f(s).chevron===`leading`?(_(),m(Qe,{key:1,name:T.value,"data-slot":`chevronIcon`,class:j(l.value.chevronIcon({class:f(s).ui?.chevronIcon,alone:!w.value}))},null,8,[`name`,`class`])):g(``,!0)],2)):g(``,!0),F(`span`,{"data-slot":`label`,class:j(l.value.label({class:f(s).ui?.label}))},[f(s).streaming&&f(s).text?(_(),m(Uo,R({key:0,text:f(s).text},f(s).shimmer),null,16,[`text`])):(_(),v(k,{key:1},[a(M(f(s).text),1)],64)),f(s).suffix?(_(),v(`span`,{key:2,"data-slot":`suffix`,class:j(l.value.suffix({class:f(s).ui?.suffix}))},M(f(s).suffix),3)):g(``,!0)],2),S.value&&f(s).chevron===`trailing`?(_(),m(Qe,{key:1,name:T.value,"data-slot":`trailingIcon`,class:j(l.value.trailingIcon({class:f(s).ui?.trailingIcon}))},null,8,[`name`,`class`])):g(``,!0)],2)]),_:1},8,[`disabled`]),E(f(ya),{"data-slot":`content`,class:j(l.value.content({class:f(s).ui?.content}))},{default:V(()=>[F(`div`,{"data-slot":`body`,class:j(l.value.body({class:f(s).ui?.body}))},[d(e.$slots,`default`,{open:t})],2)]),_:2},1032,[`class`]),f(s).actions?.length||o.actions?(_(),v(`div`,{key:0,"data-slot":`actions`,"data-state":S.value&&t?`open`:`closed`,class:j(l.value.actions({class:f(s).ui?.actions}))},[d(e.$slots,`actions`,{},()=>[(_(!0),v(k,null,y(f(s).actions,(e,t)=>(_(),m(bt,R({key:t,size:`xs`},{ref_for:!0},e),null,16))),128))])],10,Os)):g(``,!0)]),_:3},8,[`open`,`disabled`,`unmount-on-hide`,`class`]))}},As=[`·`,`✢`,`✳`,`✶`,`✻`,`✽`],js=[...As,...[...As].reverse()];function Ms(e,t=!1){return t?`✻`:js[Math.floor(Math.max(0,e)/120)%js.length]}function Ns(e,t){return e||!t?null:120}var Ps={class:`claude-spinner`,"aria-hidden":`true`},Fs=Object.assign(T({__name:`ClaudeSpinner`,setup(e){let t=h(0),r=n(()=>Ms(t.value,ci.value)),i,a=0;function o(){i&&clearInterval(i),i=void 0}function s(){t.value=performance.now()-a}function c(){o();let e=Ns(ci.value,ti.value);e!==null&&(s(),i=na(s,e))}return w(()=>{z(ci,()=>{a=performance.now(),c()},{immediate:!0}),z(ti,c)}),H(o),(e,t)=>(_(),v(`span`,Ps,M(f(r)),1))}}),{__name:`ClaudeSpinner`}),Is={slots:{root:`w-full flex flex-col gap-1 flex-1 px-2.5 [&>article]:last-of-type:min-h-(--last-message-height)`,indicator:`h-6 flex items-center gap-1 py-3 *:size-2 *:rounded-full *:bg-elevated motion-safe:[&>*:nth-child(1)]:animate-[bounce_1s_infinite] motion-safe:[&>*:nth-child(2)]:animate-[bounce_1s_0.15s_infinite] motion-safe:[&>*:nth-child(3)]:animate-[bounce_1s_0.3s_infinite]`,viewport:`absolute inset-x-0 top-[86%] data-[state=open]:animate-[fade-in_200ms_var(--ease-out)] data-[state=closed]:animate-[fade-out_200ms_var(--ease-out)]`,autoScroll:`rounded-full absolute right-1/2 translate-x-1/2 bottom-0`},variants:{compact:{true:``,false:``}}},Ls=[`data-status`],Rs=[`data-state`],zs={__name:`UChatMessages`,props:{messages:{type:null,required:!1},status:{type:String,required:!1},shouldAutoScroll:{type:Boolean,required:!1,default:!1},shouldScrollToBottom:{type:Boolean,required:!1,default:!0},autoScroll:{type:[Boolean,Object],required:!1,default:!0},autoScrollIcon:{type:null,required:!1},user:{type:Object,required:!1},assistant:{type:Object,required:!1},compact:{type:Boolean,required:!1},spacingOffset:{type:Number,required:!1,default:0},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e,{expose:t}){let r=e,i=O(),a=We(`chatMessages`,r),o=()=>de(i,[`default`,`indicator`,`viewport`]);function s(){if(a.status===`submitted`)return!0;if(a.status!==`streaming`)return!1;let e=a.messages?.[a.messages.length-1];return e?.role===`assistant`&&!e.parts?.length}let c=ar(),l=S(()=>Pt(a.user,{side:`right`,variant:`soft`})),u=S(()=>Pt(a.assistant,{side:`left`,variant:`naked`})),p=n(()=>lt({extend:Is,...c.ui?.chatMessages||{}})({compact:a.compact})),b=h(null),C=h(null),T=h(new Map),D=h(!1),A=h(0),M=h(!1),I=h(0),L=h(!1);function B(e,t){let n=t?.$el;n&&T.value.set(e,n)}function H(e){let t=T.value.get(e);t&&t.scrollIntoView({behavior:`smooth`,block:`start`})}function ee(e=!0){C.value&&(e?C.value.scrollTo({top:C.value.scrollHeight,behavior:`smooth`}):C.value.scrollTop=C.value.scrollHeight)}ke([()=>a.messages,()=>a.status],([e,t])=>{if(!a.messages?.length){D.value=!1,L.value=!1,I.value=0,T.value.clear();return}t===`streaming`&&U()},{deep:!0,throttle:50,leading:!0}),z(()=>a.status,e=>{if(e!==`submitted`)return;let t=a.messages?.[a.messages.length-1];t&&t.role===`user`&&(L.value=!1,P(()=>{M.value=!0,K(),P(()=>{H(t.id)})}))});function U(){if(!C.value)return;let e=C.value.scrollTop+C.value.clientHeight,t=C.value.scrollHeight;D.value=t-e>=100,C.value.scrollTop<I.value?L.value=!0:t-e<100&&(L.value=!1),I.value=C.value.scrollTop}function W(){L.value=!1,ee()}function G(e){if(!e)return document.documentElement;let t=/auto|scroll/,n=e;for(;n&&n!==document.body&&n!==document.documentElement;){let e=window.getComputedStyle(n);if(t.test(e.overflowY))return n;n=n.parentElement}return document.documentElement}function K(){if(!b.value||!C.value||!a.messages?.length||!M.value)return;let{height:e}=Ue(C.value),t=a.messages.findLast(e=>e.role===`user`);if(!t)return;let n=T.value.get(t.id);if(!n)return;let r=a.spacingOffset||0,i=window.getComputedStyle(b.value),o=window.getComputedStyle(C.value);r+=Number.parseFloat(i.rowGap)||Number.parseFloat(i.gap)||0,r+=Number.parseFloat(o.paddingTop)||0,r+=Number.parseFloat(o.paddingBottom)||0,A.value=Math.max(e.value-n.offsetHeight-r,0)}return w(()=>{C.value=G(b.value),C.value&&(I.value=C.value.scrollTop,a.shouldScrollToBottom?(ee(!1),setTimeout(()=>{ee(!1)},100)):P(()=>{U()}),mt(C,`scroll`,U),mt(window,`resize`,()=>P(K)),b.value&&Ct(b,()=>{a.shouldAutoScroll&&a.status===`streaming`&&!L.value&&ee(!1)},{childList:!0,subtree:!0}))}),t({registerMessageRef:B}),(e,t)=>(_(),v(`div`,{ref_key:`el`,ref:b,"data-status":f(a).status,"data-slot":`root`,class:j(p.value.root({class:[f(a).ui?.root,f(a).class]})),style:N({"--last-message-height":`${A.value}px`})},[d(e.$slots,`default`,{registerMessageRef:B},()=>[(_(!0),v(k,null,y(f(a).messages,t=>(_(),v(k,{key:t.id},[t.parts?.length?(_(),m(Bo,R({key:0,ref_for:!0},{...t.role===`user`?l.value:u.value,...t},{ref_for:!0,ref:e=>B(t.id,e),compact:f(a).compact}),x({_:2},[y(o(),(n,r)=>({name:r,fn:V(n=>[d(e.$slots,r,R({ref_for:!0},{...n,message:t}))])}))]),1040,[`compact`])):g(``,!0)],64))),128))]),s()?(_(),m(Bo,R({key:0,id:`indicator`,role:`assistant`},{...u.value,actions:void 0,parts:[]},{compact:f(a).compact}),{content:V(()=>[d(e.$slots,`indicator`,{ui:p.value},()=>[F(`div`,{"data-slot":`indicator`,class:j(p.value.indicator({class:f(a).ui?.indicator}))},[...t[0]||=[F(`span`,null,null,-1),F(`span`,null,null,-1),F(`span`,null,null,-1)]],2)])]),_:3},16,[`compact`])):g(``,!0),E(f(he),{present:D.value},{default:V(()=>[F(`div`,{"data-state":D.value?`open`:`closed`,"data-slot":`viewport`,class:j(p.value.viewport({class:f(a).ui?.viewport}))},[d(e.$slots,`viewport`,{ui:p.value,onClick:W},()=>[f(a).autoScroll?(_(),m(bt,R({key:0,icon:f(a).autoScrollIcon||f(c).ui.icons.arrowDown,color:`neutral`,variant:`outline`},typeof f(a).autoScroll==`object`?f(a).autoScroll:{},{"data-slot":`autoScroll`,class:p.value.autoScroll({class:f(a).ui?.autoScroll}),onClick:W}),null,16,[`icon`,`class`])):g(``,!0)])],10,Rs)]),_:3},8,[`present`])],14,Ls))}},Bs=new URL(`pdf.min.t82Z80JU.mjs`,import.meta.url).href,Vs=new URL(`pdf.worker.min.wgc6bjNh.mjs`,import.meta.url).href;function Hs(e,t,n){return Math.min(Math.max(1,n),Math.sqrt(4194304/(e*t)))}var Us=[`aria-label`,`aria-busy`],Ws={key:0,class:`changes-notice`,role:`status`},Gs={key:1,class:`changes-notice error`,role:`alert`},Ks=[`data-page`,`aria-label`],qs=Object.assign(T({__name:`PdfPreview`,props:{src:{},title:{}},setup(e){let t=e,n=h(),r=h(0),i=h(2/3),a=h(!0),o=h(!1),s,c,l,u,d,p=!1,m=0,b=!1,x=0,S=new Set;async function C(){if(!b&&!p&&s&&x){b=!0;try{for(let e of S){if(p)break;if(e.querySelector(`canvas`))continue;let t=m,n=await s.getPage(Number(e.dataset.page));if(p||t!==m||!S.has(e))continue;let r=n.getViewport({scale:1}),i=n.getViewport({scale:x/r.width});e.style.aspectRatio=`${r.width} / ${r.height}`;let a=window.document.createElement(`canvas`),o=Hs(i.width,i.height,window.devicePixelRatio||1);a.width=Math.ceil(i.width*o),a.height=Math.ceil(i.height*o);let c=a.getContext(`2d`);l=n.render({canvas:a,canvasContext:c,viewport:i,transform:[o,0,0,o,0,0]});try{await l.promise,!p&&t===m&&S.has(e)?(e.replaceChildren(a),e.dataset.rendered=`true`):a.width=a.height=0}catch(e){if(e.name!==`RenderingCancelledException`)throw e}finally{l=void 0,n.cleanup()}}}catch{p||(o.value=!0)}finally{b=!1,!p&&!o.value&&[...S].some(e=>!e.querySelector(`canvas`))&&C()}}}function T(e){let t=e.querySelector(`canvas`);t&&(t.width=t.height=0,t.remove()),delete e.dataset.rendered}return w(async()=>{try{let e=await vn(()=>import(Bs),[],import.meta.url);if(p||(e.GlobalWorkerOptions.workerSrc=Vs,c=e.getDocument({url:t.src,withCredentials:!0,isEvalSupported:!1}),s=await c.promise,p))return;let o=await s.getPage(1),f=o.getViewport({scale:1});if(i.value=f.height/f.width,o.cleanup(),r.value=s.numPages,a.value=!1,await P(),p||!n.value)return;x=n.value.clientWidth,u=new IntersectionObserver(e=>{for(let t of e){let e=t.target;t.isIntersecting?S.add(e):(S.delete(e),T(e))}C()},{rootMargin:`400px 0px`}),n.value.querySelectorAll(`.pdf-page`).forEach(e=>u.observe(e)),d=new ResizeObserver(()=>{let e=n.value?.clientWidth||0;e&&e!==x&&(x=e,m++,l?.cancel(),S.forEach(T),C())}),d.observe(n.value)}catch{p||(o.value=!0,a.value=!1)}}),H(()=>{p=!0,u?.disconnect(),d?.disconnect(),l?.cancel(),S.forEach(T),S.clear(),c?.destroy()}),(t,s)=>(_(),v(`div`,{ref_key:`root`,ref:n,class:`files-pdf`,role:`region`,"aria-label":e.title,"aria-busy":f(a)},[f(a)?(_(),v(`p`,Ws,M((`t`in t?t.t:f(Q))(`Loading PDF…`)),1)):g(``,!0),f(o)?(_(),v(`p`,Gs,M((`t`in t?t.t:f(Q))(`Could not preview this PDF. Use Open to view it.`)),1)):g(``,!0),(_(!0),v(k,null,y(f(r),e=>(_(),v(`div`,{key:e,class:`pdf-page`,"data-page":e,style:N({aspectRatio:`1 / ${f(i)}`}),role:`img`,"aria-label":`${(`t`in t?t.t:f(Q))(`Page`)} ${e}`},null,12,Ks))),128))],8,Us))}}),{__name:`PdfPreview`});function Js(e){if(e<1e3)return`${e} B`;let t=[`kB`,`MB`,`GB`,`TB`],n=e/1e3,r=0;for(;;){let e=n.toFixed(+(n<10));if(Number(e)<1e3||r===t.length-1)return`${e} ${t[r]}`;n/=1e3,r++}}var Ys=e=>/\.(?:md|markdown)$/i.test(e),Xs=e=>{try{return decodeURIComponent(e)}catch{return e}};function Zs(e){let t=[];for(let n of e)if(n&&n!==`.`){if(n===`..`){if(!t.length)return null;t.pop()}else t.push(n)}return t}function Qs(e,t,n){let r=t.trim();if(!r)return null;if(r.startsWith(`#`))return{kind:`anchor`,anchor:Xs(r.slice(1))};if(/^[a-z][a-z\d+.-]*:/i.test(r)||r.startsWith(`//`))return{kind:`external`};let i=r.indexOf(`#`),a=i<0?``:Xs(r.slice(i+1)),o=Xs((i<0?r:r.slice(0,i)).split(`?`)[0]).replace(/\\/g,`/`);if(!o)return null;let s=o.endsWith(`/`)?`dir`:`file`;if(n){if(o.startsWith(`~/`)){let e=Zs(o.slice(2).split(`/`));return e?{kind:s,path:`~/${e.join(`/`)}`,anchor:a}:{kind:`outside`}}let t=Zs([...o.startsWith(`/`)?[]:e.split(`/`).slice(0,-1),...o.split(`/`)]);return t?{kind:s,path:`/${t.join(`/`)}`,anchor:a}:{kind:`outside`}}let c=Zs([...o.startsWith(`/`)?[]:e.split(`/`).slice(0,-1),...o.split(`/`)]);return c?{kind:s,path:c.join(`/`),anchor:a}:{kind:`outside`}}function $s(e){return e.trim().toLowerCase().replace(/[^\p{L}\p{N}\s_-]/gu,``).replace(/\s/g,`-`)}function ec(e,t){let n=t.toLowerCase(),r=new Map;for(let t of e.querySelectorAll(`h1, h2, h3, h4, h5, h6`)){let e=$s(t.textContent||``),i=r.get(e)??0;if(r.set(e,i+1),(i?`${e}-${i}`:e)===n)return t}return null}var tc=`wherdr.files.hidden`,nc=e=>e!==`0`,rc=e=>e?`1`:`0`,ic=`wherdr.files.md`,ac=e=>e===`source`?`source`:`rendered`,oc={class:`changes-view files-view`},sc={class:`changes-toolbar`},cc=[`aria-label`],lc={key:0,class:`files-sep`},uc=[`onClick`],dc={key:0,class:`files-sep`},fc={class:`files-crumb current`},pc={class:`files-actions`},mc={class:`files-label`},hc={key:0,class:`changes-notice error`,role:`alert`},gc={key:1,class:`changes-notice`},_c={class:`changes-location`},vc=[`aria-label`],yc=[`aria-pressed`,`onClick`],bc={key:1,class:`changes-limit`},xc=[`src`,`alt`],Sc={key:0,class:`changes-notice`,role:`alert`},Cc=[`src`,`aria-label`],wc={key:5,class:`changes-notice`},Tc={key:6,class:`changes-notice`},Ec=[`aria-label`,`innerHTML`],Dc=[`aria-label`],Oc={class:`files-num`,"aria-hidden":`true`},kc={class:`files-text`},Ac={class:`changes-toggle`},jc={key:0,class:`changes-limit`},Mc={key:1,class:`changes-notice`},Nc={class:`files-list`},Pc=[`disabled`,`onClick`],Fc={class:`change-path`},Ic={key:0,class:`change-status`},Lc=40,Rc=Object.assign(T({__name:`FilesView`,props:{paneId:{},file:{}},setup(e){let t=e,r=h(null),i=h(null),o=h(!1),s=h(``),c=br(tc,nc,rc),u=0,d=()=>encodeURIComponent(t.paneId);async function p(e,t){let n=++u;o.value=!0,s.value=``;try{let r=await xi(e);n===u&&t(r)}catch(e){n===u&&(s.value=e.message)}finally{n===u&&(o.value=!1)}}function b(e){let t=e===null?``:`&path=${encodeURIComponent(e)}`;return p(`/api/files?pane=${d()}${t}`,e=>{r.value=e,i.value=null})}let x=e=>`pane=${d()}&path=${encodeURIComponent(e)}${t.file?`&from=chat`:``}`,S=``;function C(e){return S=e,p(`/api/files/read?${x(e)}`,e=>{i.value=e})}let T=null,D=h([]),O=h(0),A=n(()=>i.value?.kind===`pdf`||i.value?.kind===`video`?`/api/files/download?${x(i.value.path)}&inline=1`:``),N=h(!1);z(A,()=>{N.value=!1});let L=h(!1);async function R(){let e=i.value?.path;if(e&&!L.value){L.value=!0;try{await Ui(`/api/files/download?${x(e)}`,e.split(`/`).pop()||e)}catch(e){X(e.message,!0)}finally{L.value=!1}}}let B=e=>r.value?.path?`${r.value.path}/${e}`:e;function H(e){e.kind===`dir`?b(B(e.name)):e.kind===`file`&&C(B(e.name))}function ee(){u++,o.value=!1;let e=t.file?D.value.pop():void 0;e?C(e):i.value=null}function W(){O.value++,oe.clear(),N.value=!1,t.file?C(S||t.file):i.value?C(i.value.path):b(r.value?r.value.path:null)}w(()=>t.file?C(t.file):b(null)),l(()=>{u++});let G=n(()=>{let e=r.value;if(!e)return[];let t=e.path?e.path.split(`/`):[];return[{label:e.root.split(`/`).filter(Boolean).pop()||`/`,path:``},...t.map((e,n)=>({label:e,path:t.slice(0,n+1).join(`/`)}))]}),K=n(()=>(r.value?.entries||[]).filter(e=>c.value||!e.name.startsWith(`.`))),ne=n(()=>{let e=i.value?.text??``,t=e.endsWith(`
7
7
  `)?e.slice(0,-1):e,n=1;for(let e=0;e<t.length;e++)t.charCodeAt(e)===10&&n++;return{text:t,numbers:Array.from({length:n},(e,t)=>t+1).join(`
8
- `)}}),ne=ir(Ls,Rs,e=>e),J=n(()=>i.value?.kind===`text`&&Os(i.value.path)),re=n(()=>J.value&&ne.value===`rendered`?na(i.value.text??``,{doc:!0}):``),ie=h(null),ae=h(null),oe=new Map,se=``,ce=0;async function le(e,n){let r=++ce;se!==n&&oe.clear(),se=n;let i=!!t.file;for(let t of Array.from(e.querySelectorAll(`img[data-src]`)).slice(0,gc)){let e=js(n,t.dataset.src||``,i);if(e?.kind!==`file`)continue;let a=oe.get(e.path);if(a===void 0){try{let t=await gi(`/api/files/read?${x(e.path)}`);a=t.kind===`image`&&t.dataUrl?t.dataUrl:null}catch{a=null}oe.set(e.path,a)}if(r!==ce)return;a&&(t.src=a)}}let ue=h(0);B(i,()=>{ue.value++}),B([re,ae,ue],async([e,t])=>{if(ce++,!e||!t||!i.value)return;await P();let n=T;T=null,n&&Ns(t,n)?.scrollIntoView({block:`start`}),le(t,i.value.path)},{flush:`post`});function de(e){let n=e.target,r=n.closest?.(`.code-copy`);if(r){let e=r.closest(`.code-block`)?.querySelector(`pre`)?.textContent;if(e==null)return;navigator.clipboard.writeText(e).then(()=>{r.textContent=Z(`Copied`),r.classList.add(`done`),setTimeout(()=>{r.textContent=Z(`Copy`),r.classList.remove(`done`)},1400)}).catch(()=>$(Z(`Copy failed`),!0));return}let a=n.closest?.(`a[href]`),o=i.value?.path;if(!a||!o)return;let s=js(o,a.getAttribute(`href`)||``,!!t.file);s&&s.kind!==`external`&&(e.preventDefault(),s.kind===`anchor`?ae.value&&Ns(ae.value,s.anchor)?.scrollIntoView({block:`start`}):s.kind===`outside`?$(Z(`This link leads outside the folder.`),!0):s.kind===`dir`?t.file||b(s.path):fe(o,s.path,s.anchor))}async function fe(e,n,a){let o=n.split(`/`).slice(0,-1).join(`/`),s=t.file||r.value?.path===o?null:gi(`/api/files?pane=${d()}&path=${encodeURIComponent(o)}`).catch(()=>null);t.file&&D.value.push(e),T=a||null,await C(n);let c=await s;c&&i.value?.path===n&&(r.value=c),a||ie.value?.scrollIntoView({block:`start`})}function pe(e){return e.kind===`dir`?e.link?`i-lucide-folder-symlink`:`i-lucide-folder`:e.kind===`other`?`i-lucide-file-question`:e.link?`i-lucide-file-symlink`:`i-lucide-file`}return(t,n)=>{let l=_t,u=Es,d=Ke;return _(),v(`div`,zs,[I(`div`,{ref_key:`root`,ref:ie,class:`changes-inner`},[I(`div`,Bs,[I(`nav`,{class:`files-crumbs`,"aria-label":(`t`in t?t.t:f(Z))(`Folder`)},[f(i)&&(!e.file||f(D).length)?(_(),m(l,{key:0,icon:`i-lucide-arrow-left`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Z))(`Back to folder`),onClick:U},null,8,[`aria-label`])):g(``,!0),(_(!0),v(k,null,y(f(ee),(e,t)=>(_(),v(k,{key:e.path},[t?(_(),v(`span`,Hs,`/`)):g(``,!0),I(`button`,{type:`button`,class:`files-crumb`,onClick:t=>b(e.path)},M(e.label),9,Us)],64))),128)),f(i)?(_(),v(k,{key:1},[f(ee).length?(_(),v(`span`,Ws,`/`)):g(``,!0),I(`span`,Gs,M(f(i).path.split(`/`).pop()),1)],64)):g(``,!0)],8,Vs),I(`div`,Ks,[f(A)?(_(),m(l,{key:0,icon:`i-lucide-external-link`,color:`neutral`,variant:`outline`,size:`sm`,to:f(A),target:`_blank`,external:``,"aria-label":(`t`in t?t.t:f(Z))(`Open`)},{default:H(()=>[a(M((`t`in t?t.t:f(Z))(`Open`)),1)]),_:1},8,[`to`,`aria-label`])):g(``,!0),f(i)?(_(),m(l,{key:1,icon:`i-lucide-download`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(F),"aria-label":(`t`in t?t.t:f(Z))(`Download`),onClick:R},{default:H(()=>[a(M((`t`in t?t.t:f(Z))(`Download`)),1)]),_:1},8,[`loading`,`aria-label`])):g(``,!0),E(l,{icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(o),"aria-label":(`t`in t?t.t:f(Z))(`Refresh`),onClick:W},{default:H(()=>[I(`span`,qs,M((`t`in t?t.t:f(Z))(`Refresh`)),1)]),_:1},8,[`loading`,`aria-label`])])]),f(s)?(_(),v(`p`,Js,M(f(s)),1)):g(``,!0),f(o)&&!f(r)&&!f(i)?(_(),v(`p`,Ys,[n[2]||=I(`span`,{class:`spinner`},null,-1),a(` `+M((`t`in t?t.t:f(Z))(`Reading files…`)),1)])):f(i)?(_(),v(k,{key:2},[I(`p`,Xs,M(f(i).path)+` · `+M((`fmtBytes`in t?t.fmtBytes:f(Ds))(f(i).size)),1),f(J)?(_(),v(`div`,{key:0,class:`segmented files-md-mode`,role:`group`,"aria-label":(`t`in t?t.t:f(Z))(`Markdown view`),style:{"--segment-count":`2`}},[(_(),v(k,null,y([`rendered`,`source`],e=>I(`button`,{key:e,type:`button`,class:j({on:f(ne)===e}),"aria-pressed":f(ne)===e,onClick:t=>ne.value=e},[I(`span`,null,M(e===`rendered`?(`t`in t?t.t:f(Z))(`Rendered`):(`t`in t?t.t:f(Z))(`Source`)),1)],10,Qs)),64))],8,Zs)):g(``,!0),f(i).truncated&&f(i).kind===`text`?(_(),v(`p`,$s,M((`t`in t?t.t:f(Z))(`File truncated to keep this view responsive.`)),1)):g(``,!0),f(i).kind===`image`?(_(),v(`img`,{key:2,class:`files-image`,src:f(i).dataUrl,alt:f(i).path},null,8,ec)):f(i).kind===`pdf`?(_(),m(u,{key:`${f(A)}:${f(O)}`,src:f(A),title:f(i).path},null,8,[`src`,`title`])):f(i).kind===`video`?(_(),v(k,{key:4},[f(N)?(_(),v(`p`,tc,M((`t`in t?t.t:f(Z))(`This video cannot be played here. Use Open or Download.`)),1)):(_(),v(`video`,{key:`${f(A)}:${f(O)}`,class:`files-video`,src:f(A),"aria-label":f(i).path,controls:``,playsinline:``,preload:`metadata`,onError:n[0]||=e=>N.value=!0},null,40,nc))],64)):f(i).kind===`binary`?(_(),v(`p`,rc,M((`t`in t?t.t:f(Z))(`Binary file`)),1)):f(i).kind===`large`?(_(),v(`p`,ic,M(/\.pdf$/i.test(f(i).path)?(`t`in t?t.t:f(Z))(`PDF too large to preview (50 MB max).`):(`t`in t?t.t:f(Z))(`Image too large to preview.`)),1)):f(re)?(_(),v(`article`,{key:f(ue),ref_key:`doc`,ref:ae,class:`md md-body files-md`,"aria-label":f(i).path,onClick:de,innerHTML:f(re)},null,8,ac)):(_(),v(`div`,{key:8,class:`files-code`,role:`region`,"aria-label":f(i).path},[I(`pre`,sc,M(f(te).numbers),1),I(`pre`,cc,M(f(te).text),1)],8,oc))],64)):f(r)?(_(),v(k,{key:3},[I(`label`,lc,[L(I(`input`,{"onUpdate:modelValue":n[1]||=e=>G(c)?c.value=e:null,type:`checkbox`},null,512),[[q,f(c)]]),n[3]||=a(),I(`span`,null,M((`t`in t?t.t:f(Z))(`Show hidden files`)),1)]),f(r).truncated?(_(),v(`p`,uc,M((`t`in t?t.t:f(Z))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),f(K).length?g(``,!0):(_(),v(`p`,dc,M((`t`in t?t.t:f(Z))(`Empty folder.`)),1)),I(`ul`,fc,[(_(!0),v(k,null,y(f(K),e=>(_(),v(`li`,{key:e.name},[I(`button`,{type:`button`,class:`change-file files-entry`,disabled:e.kind===`other`,onClick:t=>V(e)},[E(d,{name:pe(e),class:j([`files-icon`,e.kind])},null,8,[`name`,`class`]),I(`span`,mc,M(e.name),1),e.kind===`file`&&e.size!==null?(_(),v(`span`,hc,M((`fmtBytes`in t?t.fmtBytes:f(Ds))(e.size)),1)):g(``,!0),e.kind===`dir`?(_(),m(d,{key:1,name:`i-lucide-chevron-right`,class:`files-chevron`})):g(``,!0)],8,pc)]))),128))])],64)):g(``,!0)],512)])}}}),{__name:`FilesView`});function vc(e,t=300,n=300){let r=h(!1),i=null,a=0,o=()=>{i&&=(clearTimeout(i),null)};return B(e,e=>{if(o(),e&&!r.value)i=setTimeout(()=>{i=null,r.value=!0,a=Date.now()},t);else if(!e&&r.value){let e=n-(Date.now()-a);e<=0?r.value=!1:i=setTimeout(()=>{i=null,r.value=!1},e)}},{immediate:!0}),s(o),r}var yc=e=>!!e&&zi.value&&!Sr.value&&!Qr(e)&&Qi(e.agent),bc=(e,t)=>!!t&&e.id===t.id&&(e.machine||``)===(t.machine||``)&&e.agent===t.agent&&e.agentSession===t.agentSession&&e.cwd===t.cwd,xc=e=>ur.value.panes.find(t=>t.id===e);function Sc(e){return yc(e)?e.status===`blocked`&&e.prompt?Q(`The agent is waiting for your answer: answer it first.`,`L’agent attend ta réponse : réponds-lui d’abord.`):null:Q(`The agent can no longer run commands (offline, or no agent in the pane): nothing was sent.`,`L’agent ne peut plus lancer de commande (hors ligne, ou plus d’agent dans le pane) : rien n’a été envoyé.`)}function Cc(e){let t=$r(e.agent),n=Ai(ur.value,e),r=tr(e),i=[n,r].filter((e,n,r)=>e&&e.toLowerCase()!==t.toLowerCase()&&r.indexOf(e)===n).join(` › `)||r,a=e.machine?Hr(e.machine):``,o=e.cwd?si(e.cwd):``;return Q(`Run this command in ${t} “${i}”${a?` on ${a}`:``}? It runs in its shell mode (!), in ${o||`its own folder`}, and shows the output in the conversation.`,`Lancer cette commande dans ${t} « ${i} »${a?` sur ${a}`:``} ? Elle s’exécute dans son mode shell (!), dans ${o||`son propre dossier`}, et la sortie s’affiche dans la conversation.`)}async function wc(e,t){let n=xc(e),r=Sc(n);if(r||!n)return r&&$(r,!0),!1;let i=$i(n.agent,t);if(!i||(X(),!await Tt(Cc(n),Q(`Run`,`Lancer`),`primary`,t)))return!1;let a=xc(e);if(!bc(n,a))return $(Q(`The agent changed while you were confirming: nothing was sent. Check it and run the command again.`,`L’agent a changé pendant la confirmation : rien n’a été envoyé. Vérifie-le et relance la commande.`),!0),!1;let o=Sc(a);if(o)return $(o,!0),!1;try{let e=await je(a,a.id,i);return X(),e}catch(e){return $(e.message,!0),!1}}async function Tc(e){try{await navigator.clipboard.writeText(e),$(Z(`Copied`))}catch{$(Z(`Copy failed`),!0)}}function Ec(e,t){return e.stopped||!e.agent?`stopped`:e.prompt?`question`:e.menu||e.screen||e.menuLeftOpen?`dialog`:e.status===`blocked`?`question`:e.pendingPrompt?`starting`:e.status===`working`?`working`:t.reason===`busy`?`busy`:`sending`}function Dc(e,t){return e.agent===`claude`&&[`idle`,`done`].includes(e.status||``)&&!e.leaving&&t.state===`held`&&Ec(e,t)===`busy`}var Oc=`/.cache/herdr-web/uploads/`,kc=e=>e.includes(Oc);function Ac(e){return String(e||``).split(`
9
- `).filter(kc).map(e=>e.trim().split(`/`).pop()).filter(Boolean)}var jc=e=>String(e||``).split(`
10
- `).filter(e=>!kc(e)).join(`
11
- `).trim(),Mc=e=>Ac(e).length>0&&!jc(e),Nc=/\[Image #\d+(?:, \d+x\d+)?\]/g,Pc=e=>(String(e||``).match(Nc)||[]).length,Fc=e=>Pc(e)>0&&!String(e||``).replace(Nc,``).trim();function Ic(e,t){return t.role!==`user`||!Mc(e)?!1:Ac(e).some(e=>t.text.includes(e))||(t.images||0)>0}var Lc=e=>`/uploads/${encodeURIComponent(e)}`,Rc=e=>/^\/[^\s/]*(?:\s|$)/.test(String(e||``).trim()),zc=`/.cache/herdr-web/uploads/`,Bc=e=>String(e||``).replace(/\[Image #\d+\]/g,` `).replace(/\s+/g,` `).trim().toLowerCase(),Vc=e=>Bc(String(e||``).split(`
12
- `).filter(e=>!e.includes(zc)).join(`
13
- `));function Hc(e,t){let n=e.replace(/\s+/g,``).slice(0,80),r=t.replace(/\s+/g,``).slice(0,80);return!n||!r?!1:n===r||Math.min(n.length,r.length)>=24&&(n.startsWith(r)||r.startsWith(n))}var Uc=(e,t)=>!!(e&&t)&&Ui(e,t,Hc),Wc=(e,t)=>Fc(t)&&Pc(t)===Ac(e).length,Gc=e=>/^\s*!/.test(e),Kc=e=>Bc(String(e||``).replace(/^\s*!!?\s*/,``));function qc(e,t){if(!t)return`queued`;if(Mc(e))return t.queued.some(t=>Wc(e,t))||!t.sent||!Wc(e,t.sent)?`queued`:`sent`;let n=Vc(e);if(!n||t.queued.some(e=>Uc(n,Bc(e))))return`queued`;let r=t.shell?t.shell.python?/^\s*\$/.test(e)?Bc(e.replace(/^\s*\$\$?\s*/,``)):``:Gc(e)?Kc(e):``:``;return t.shell&&Uc(r,Bc(t.shell.command))?`running`:Gc(e)?t.sent&&Gc(t.sent)&&Uc(Kc(e),Kc(t.sent))?`sent`:`queued`:t.sent&&!Gc(t.sent)&&Uc(n,Bc(t.sent))?`sent`:`queued`}function Jc(e,t){let n=e.map(e=>qc(e,t)),r=e.map(e=>!!(t&&t.queued.some(t=>Mc(e)?Wc(e,t):Uc(Vc(e),Bc(t))))),i=n.reduce((e,t,n)=>t===`queued`?e:n,-1);return n.map((e,t)=>t>i?e:r.slice(0,t+1).some(Boolean)?`queued`:e===`queued`?`sent`:e)}var Yc=e=>String(e||``).replace(/\s+/g,` `).trim().toLowerCase(),Xc=(e,t)=>Ui(Yc(e),Yc(t),(e,t)=>e.includes(t.slice(0,60))),Zc=new Map;function Qc(e,t){let n=(Zc.get(e)||[]).filter(e=>!t.some(t=>t.id===e.id));return n.push(...t.filter(e=>Ac(e.text).length)),Zc.set(e,n.slice(-30)),Zc.get(e)}function $c(e){let t=t=>{let n=e=>!t.at||!e.ts||Date.parse(e.ts)>=t.at-1e4;if(Mc(t.text))return e.items.some(e=>n(e)&&Ic(t.text,e));let r=jc(t.text),i=Yc(t.text.replace(/^\s*(?:!!?|\$\$?)\s*/,``)).slice(0,60);return!!Yc(r)&&e.items.some(e=>n(e)&&(e.role===`user`?Xc(e.text,r):e.role===`bash`&&!!i&&Yc(e.text).includes(i)))},n=[...e.mine].sort((e,t)=>e.at&&t.at?e.at-t.at:0),r=n.filter(e=>!t(e)),i=Jc(r.map(e=>e.text),e.screen),a=r.filter((e,t)=>Mc(e.text)&&!e.state&&i[t]===`queued`).length,o=(e.memory||[]).filter(e=>Mc(e.text)&&!n.some(t=>t.id===e.id));for(let t of e.idle?[]:e.claude){let i=t.images||0;if(!t.text){if(!i)continue;if(a>0){a--;continue}let e=o.shift(),n=t.sent||e?.text;r.push({id:`cc-${t.ts}`,text:n||``,missing:n?0:i});continue}if(!Yc(t.text)||n.some(e=>Xc(e.text,t.text))||e.items.some(e=>(!t.ts||!e.ts||e.ts>=t.ts)&&(e.role===`user`||e.role===`notice`)&&Xc(e.text,t.text)))continue;let s=i?t.sent||[...e.memory||[]].reverse().find(e=>Xc(jc(e.text),t.text))?.text:null;r.push({id:`cc-${t.ts}`,text:s||t.text,missing:s?0:i})}let s=Jc(r.map(e=>e.text),e.screen);return r.map((e,t)=>({id:e.id,raw:e.text,mine:!e.id.startsWith(`cc-`),phase:e.state?`queued`:s[t],state:e.state||null,...e.local?{local:!0}:{},...e.inputText?{inputText:e.inputText}:{},...e.reason?{reason:e.reason}:{},photos:Ac(e.text),missing:e.missing||0,...e.pasted?{pasted:e.pasted}:{}}))}function el(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.right-n.left>.5&&n.bottom-n.top>.5)return n}return null}function tl(e,t,n,r){if(e.bottom<n.top||e.top>n.bottom)return null;let i=n.width-t.width-8,a=Math.min(Math.max(8,e.right-t.width),i),o=r?22:6,s=e.bottom+o;if(!r&&e.right+6<=i){let r=Math.round(e.top+(e.bottom-e.top-t.height)/2);return{top:Math.min(Math.max(r,n.top),n.bottom-t.height),left:e.right+6}}if(s+t.height<=n.bottom)return{top:s,left:a};let c=e.top-6-t.height;return!r&&c>=n.top?{top:c,left:a}:{top:Math.max(n.top,n.bottom-t.height-8),left:a}}function nl(e){let t=!1,n=null,r=()=>{n&&clearTimeout(n),n=null},i=i=>{r(),n=setTimeout(()=>{n=null,t||e.show()},i)};return{down(){t=!0,r(),e.hide()},up(){t&&(t=!1,i(e.touch()?380:180))},change(n=!1){if(!n){if(e.hide(),t){r();return}i(e.touch()?380:350)}},scroll(){e.hide(),t||i(160)},dispose(){r()}}}function rl(e){for(let t=e.length-1;t>=0;t--){let n=e[t].replace(/\s+$/u,``).length;if(n>0)return{index:t,offset:n}}return null}function il(e,t){let n=e.cloneRange();if(!t.contains(n.startContainer)){if(n.comparePoint(t,0)<0)return null;n.setStart(t,0)}t.contains(n.endContainer)||n.setEnd(t,t.childNodes.length);let r=[],i=[],a=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let e=a.nextNode();e;e=a.nextNode()){if(!n.intersectsNode(e))continue;let t=e===n.startContainer?n.startOffset:0,a=e===n.endContainer?n.endOffset:e.data.length;r.push(e),i.push(e.data.slice(t,a))}let o=rl(i);if(!o)return null;let s=r[o.index];return n.setEnd(s,(s===n.startContainer?n.startOffset:0)+o.offset),n}function al(e,t,n){let r=null;for(let i of t)!e.has(i)&&n&&(r=i),e.add(i);return r}var ol=120,sl=50,cl=new Map;function ll(e,t,n){cl.delete(e),!(!t||n.scrollHeight-n.scrollTop-n.clientHeight<ol)&&(cl.set(e,{file:t,fromBottom:n.scrollHeight-n.scrollTop}),cl.size>sl&&cl.delete(cl.keys().next().value))}function ul(e,t,n){let r=cl.get(e);return!r||r.file!==t?null:Math.max(0,n-r.fromBottom)}var dl=()=>({misses:0,errors:0});function fl(e,t){if(!t)return{next:dl(),clear:!0};let n=e.misses+1;return n>=3?{next:dl(),clear:!0}:{next:{...e,misses:n},clear:!1}}var pl=e=>({...e,errors:e.errors+1}),ml=e=>e.misses+e.errors>=2;function hl(e){let t=new Set,n=new Set;for(let r of e)r.hashes&&r.hashes.forEach((e,i)=>{r.role!==`user`&&r.ref&&t.has(e)&&n.add(`${r.ref}:${(r.imageAt||0)+i}`),t.add(e)});return n}function gl(e){return e.role===`user`&&(e.text.startsWith(`Autopilot:`)||e.text.startsWith(`Autopilot woke:`))}var _l={key:0,class:`search-bar`},vl={class:`search-count`},yl={class:`chat-wrap`},bl={key:2,class:`cached-tag chat-cached`,role:`status`},xl={key:0,class:`chat-empty waiting`},Sl={key:0,class:`choices-screen-text`},Cl={key:1,class:`chat-empty no-integration`},wl={class:`no-integration-title`},Tl={class:`no-integration-text`},El={class:`no-integration-cmd`},Dl={class:`no-integration-actions`},Ol={key:2,class:`chat-empty`},kl={key:2,class:`chat-more`},Al={key:3,class:`chat-note`},jl={key:0,class:`day-sep`},Ml=[`data-hit-key`],Nl=[`aria-label`,`onClick`],Pl={class:`msg-quote-time`},Fl={class:`msg-quote-text`},Il={key:0,class:`msg-file-chips`},Ll=[`title`],Rl={key:0,class:`q-bar`},zl={class:`q-bar-h`},Bl=[`aria-label`,`onClick`,`onMouseenter`,`onMouseleave`,`onFocus`,`onBlur`],Vl=[`aria-pressed`,`aria-label`,`onClick`],Hl=[`aria-pressed`,`onClick`],Ul={key:1,class:`msg-actions`},Wl=[`onClick`],Gl=[`disabled`,`aria-expanded`,`onClick`],Kl={class:`omp-job-glyph`},ql={class:`omp-job-label`},Jl={key:0,class:`omp-job-wall`},Yl={key:0,class:`omp-tool-out`},Xl={class:`omp-tool-out-head`},Zl={class:`omp-tool-out-label`},Ql={key:0,class:`omp-tool-out-right`},$l={class:`msg-shell-cmd`},eu={class:`msg-shell-sign`,"aria-hidden":`true`},tu={key:0,class:`msg-shell-body`},nu={key:0,class:`msg-shell-out`},ru={key:1,class:`msg-shell-out err`},iu={key:1,class:`msg-shell-empty`},au=[`aria-expanded`,`onClick`],ou={key:8,class:`tools omp-console omp-run`},su={class:`omp-console-head`},cu={class:`omp-console-title`},lu={key:9,class:`msg-system`},uu={class:`msg-notice-head`},du=[`aria-expanded`,`onClick`],fu={key:11,class:`turn-end`},pu=[`onClick`],mu={class:`omp-console-head`},hu={key:0,class:`omp-console-total`},gu=[`aria-expanded`,`onClick`],_u={key:4,class:`chat-empty`},vu={key:5,class:`chat-empty`},yu=[`aria-label`],bu={key:0,class:`queued-list`},xu={key:0,class:`queued-tag`},Su=[`disabled`],Cu=[`aria-label`,`onClick`],wu={class:`msg-quote-time`},Tu={class:`msg-quote-text`},Eu=[`title`],Du={key:0,class:`msg-file-chips`},Ou={class:`queued-tag sent`},ku={key:1,class:`msg-user-wrap`},Au={class:`msg-shell bash running`},ju={class:`msg-shell-cmd`},Mu={class:`msg-shell-sign`,"aria-hidden":`true`},Nu={key:0,class:`msg-shell-body`},Pu={key:0,class:`msg-shell-hidden`},Fu={class:`msg-shell-out`},Iu={key:1,class:`msg-shell-empty`},Lu={class:`queued-tag running`},Ru=[`aria-label`,`onClick`],zu={class:`msg-quote-time`},Bu={class:`msg-quote-text`},Vu=[`title`],Hu={key:0,class:`msg-file-chips`},Uu={key:1,class:`queued-tag failed`,role:`alert`},Wu=[`disabled`,`onClick`],Gu=[`disabled`,`onClick`],Ku={key:2,class:`queued-tag`},qu=[`disabled`,`onClick`],Ju=[`disabled`,`onClick`],Yu={key:2,class:`menu-left`,role:`status`},Xu={class:`menu-left-text`},Zu={class:`menu-left-actions`},Qu=[`disabled`],$u=[`disabled`],ed={key:0,class:`claude-verb-line`},td={key:1,class:`omp-step-line`},nd={key:1},rd=30,id=10,ad=6,od=12,sd=Object.assign(T({__name:`ChatView`,props:V({pane:{},localQueued:{}},{search:{type:Boolean,default:!1},searchModifiers:{}}),emits:V([`gotoTerm`,`restored`,`quote`,`answered`,`unanswered`,`sent`],[`update:search`]),setup(e,{expose:t,emit:o}){let s=e;sa(xr);let c=Lt(),d=o,p=D(e,`search`),b=h(null),x=h(null),S=()=>({file:null,token:``,tailStart:null,older:[],olderCursor:0,tail:[],queue:[]}),C=u(S()),T=n(()=>C.value.older.concat(C.value.tail)),O=h(null),A=h(null),F=h(null),L=u(dl()),R=h(!1),z=h(!1),V=h(null),G=n(()=>Sr.value||Qr(s.pane)),ee=vc(n(()=>V.value!==null&&!G.value&&!wr.value),600,0),K=vc(n(()=>!R.value&&!O.value&&!F.value)),te=n(()=>yc(s.pane));async function q(){if(!ii(xi()))return;let e=s.pane.id,t=await Oi(e);!t||Te||R.value||O.value||e!==s.pane.id||(await ie(()=>{C.value={...S(),tail:t.items},V.value=t.at}),Li(s.pane.id))}let ne=e=>{let t=b.value;return!t||t.scrollHeight-t.scrollTop-t.clientHeight<e};function J(e){let t=b.value;t&&(e||!se&&(oe||ne(160)))&&(oe=!0,se=!1,requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight}))}async function ie(e,t=!1){let n=!se&&(oe||ne(120)),r=!R.value,i=ot.value.length;e(),r?de.value=rd:de.value!==1/0&&(de.value+=Math.max(0,ot.value.length-i)),await P(),R.value=!0,fe.value&&ye();let a=null;ae&&C.value.file&&b.value&&(ae=!1,fe.value&&ul(s.pane.id,C.value.file,b.value.scrollHeight)===0&&await ve(),a=ul(s.pane.id,C.value.file,b.value.scrollHeight)),!er&&p.value&&Y.q.length>=2?lr(!1):a!==null&&!er&&b.value?(oe=!1,b.value.scrollTop=a):!t&&(n||r)&&J(!0)}let ae=typeof c.query.hit!=`string`,oe=!0,se=!1;function ce(){se=!1,be()}let le=null;w(()=>{le=new ResizeObserver(()=>{let e=b.value;e&&oe&&(e.scrollTop=e.scrollHeight)}),b.value&&le.observe(b.value),x.value&&le.observe(x.value)}),U(()=>{b.value&&R.value&&ll(s.pane.id,C.value.file,b.value)}),l(()=>le?.disconnect());function ue(){let e=b.value;e&&(me=Date.now(),un.open=!1,se||(oe=e.scrollHeight-e.scrollTop-e.clientHeight<120),fe.value?e.scrollTop<1500&&_e(20):e.scrollTop<400&&R.value&&Le())}let de=h(1/0),fe=n(()=>Math.max(0,ot.value.length-de.value)),pe=n(()=>fe.value?ot.value.slice(fe.value):ot.value),me=0,he=!1,ge=!1;l(()=>{ge=!0});async function _e(e){if(!fe.value)return;let t=b.value,n=t?t.scrollHeight-t.scrollTop:0;de.value=e===1/0?1/0:ot.value.length-fe.value+e,await P(),t&&(t.scrollTop=t.scrollHeight-n)}let ve=()=>_e(1/0);function ye(){if(he||ge)return;he=!0;let e=()=>{if(he=!1,!ge&&fe.value){if(K.value||Date.now()-me<400||document.hidden)return ye();_e(id).then(()=>{fe.value&&ye()})}},t=globalThis.requestIdleCallback;t?t(e,{timeout:3e3}):setTimeout(e,250)}function be(){Ce.value=null}let xe=new Set,Se=new Set,Ce=h(null),we=h(null),Te=!1,Ee=!1;B(qr,e=>{e||(Ee=!0,be())}),B(Sr,e=>{e&&(Ee=!0,be())});function De(e){let t=Te&&!Ee&&pr.value&&!p.value&&!G.value,n=Te&&!Ee&&!p.value&&!G.value,r=al(Se,e.filter(e=>e.role===`thinking`).map(rr),n);r&&(Ce.value={id:r,at:Date.now()}),Ee=!1,Te=!0;let i=jr(xe,e.filter(e=>e.role===`assistant`).map(rr),t&&!r);i&&(we.value={id:i,at:Date.now()})}let Oe=e=>we.value&&we.value.id===e?we.value.at:null;function ke(e){we.value?.id===e&&(we.value=null)}B([pr,p],([e,t])=>{(!e||t)&&(we.value=null),t&&be()});function Ae(e){return Ce.value?.id===e?Ce.value.at:null}function je(e){Ce.value?.id===e&&be()}async function Me(){if(A.value){X();try{await navigator.clipboard.writeText(A.value.command),$(Q(`Command copied.`,`Commande copiée.`))}catch{$(Z(`Copy failed`),!0)}}}let Ne=Jt();async function Pe(e){let t=s.pane.id,n=()=>!e()||t!==s.pane.id;try{let e=C.value.tailStart===null?await Ne.take(s.pane):void 0;if(n())return!1;let r=e||await gi(`/api/chat?${$n(t,C.value)}`);if(n())return!1;if(!r.available){let e=fl(L.value,!!C.value.file&&T.value.length>0);return L.value=e.next,e.clear?(C.value=S(),O.value=r.reason||`unsupported`,A.value=r.reason===`no_integration`&&r.integration||null,Te=!0,!1):!1}if(O.value=null,A.value=null,F.value=null,(L.value.misses||L.value.errors)&&(L.value=dl()),r.unchanged)return!1;if(V.value=null,sn(C.value,r))return C.value=S(),Te=!1,!0;let i=en(C.value.tail,r);if(!i)return C.value={...C.value,token:``},!0;if(await ie(()=>{let e={...C.value};e.tailStart===null&&(e.tailStart=r.start??0,e.olderCursor=r.start??0),e.file=r.file||null,e.token=r.token||``,e.tail=i,e.queue=r.queue||[],C.value=e,De(e.tail)}),mi(t,T.value),e)return!0}catch(e){if(n())return!1;T.value.length?L.value=pl(L.value):F.value=e.message}return!1}let Fe=Zt(Pe),Ie=Fe.load;B(()=>s.pane.id,()=>Fe.invalidate());async function Le(){if(z.value||!(C.value.olderCursor>0))return;z.value=!0;let e=s.pane.id,t=C.value.file,n=C.value.olderCursor;try{let r=await gi(`/api/chat?pane=${encodeURIComponent(e)}&before=${n}`);if(e!==s.pane.id||r.file!==t||C.value.olderCursor!==n)return;let i=b.value,a=i?i.scrollHeight-i.scrollTop:0;await ie(()=>{de.value=1/0,C.value={...C.value,older:(r.items||[]).concat(C.value.older),olderCursor:(r.start??0)<n?r.start??0:0}},!0),mi(e,T.value),i&&(i.scrollTop=i.scrollHeight-a)}catch(e){$(e.message,!0)}finally{z.value=!1}}let Re;w(()=>{Promise.all([Ie(),q()]).then(Pr),Re=Or(()=>{!document.hidden&&!Sr.value&&Ie()},1500)}),l(()=>clearInterval(Re)),B(qr,e=>{e&&Ie()});let ze=Q(`Command`,`Commande`),Ve=Q(`Edit`,`Modif`),He=Q(`Subagent`,`Sous-agent`),Ue={Bash:ze,Read:Q(`Read`,`Lecture`),Write:Q(`Write`,`Écriture`),Edit:Ve,MultiEdit:Ve,Grep:Q(`Search`,`Recherche`),Glob:Q(`Files`,`Fichiers`),WebFetch:`Web`,WebSearch:Q(`Web search`,`Recherche web`),Task:He,Agent:He,TodoWrite:Q(`Tasks`,`Tâches`),exec:ze,shell:ze,apply_patch:Ve},We={Bash:`i-lucide-terminal`,exec:`i-lucide-terminal`,shell:`i-lucide-terminal`,Read:`i-lucide-file-text`,Write:`i-lucide-file-plus`,Edit:`i-lucide-file-pen`,MultiEdit:`i-lucide-file-pen`,apply_patch:`i-lucide-file-pen`,NotebookEdit:`i-lucide-file-pen`,Grep:`i-lucide-text-search`,Glob:`i-lucide-folder-search`,WebFetch:`i-lucide-globe`,WebSearch:`i-lucide-search`,Task:`i-lucide-bot`,Agent:`i-lucide-bot`,TodoWrite:`i-lucide-list-todo`,AskUserQuestion:`i-lucide-message-circle-question`},Ge=e=>e.name===`TodoWrite`?Z(e.text||``):e.text,qe=e=>e.name===`exec`&&/^\w+$/.test(e.text||``),Je=e=>qe(e)?Z(`Tool`):Ue[e.name||``]||e.name||``,Ye=e=>e.error?`i-lucide-circle-x`:qe(e)?`i-lucide-wrench`:We[e.name||``]||`i-lucide-wrench`,Xe=e=>`${Je(e)} · ${e.text}`,Ze=e=>Ho(e.list,ct(e.key)),Qe={advisor:[`Advisor`,`i-lucide-lightbulb`],"async-result":[`Background job done`,`i-lucide-circle-check`],"irc:incoming":[`Agent message`,`i-lucide-message-square`],"launch-completion":[`Process`,`i-lucide-cpu`],"lsp-late-diagnostic":[`Diagnostics`,`i-lucide-triangle-alert`],"background-tan-dispatch":[`Background task`,`i-lucide-bot`],scheduled:[`Scheduled task`,`i-lucide-clock`]},$e=/\/\.cache\/herdr-web\/uploads\/\S+/g;function et(e){let t=C.value.file,n=[];if(!e.ref||!e.images||!t)return n;for(let r=0;r<e.images;r++)n.push(`/api/chat/image?pane=${encodeURIComponent(s.pane.id)}&file=${encodeURIComponent(t)}&ref=${e.ref}&i=${(e.imageAt||0)+r}`);return n}let tt=n(()=>{let e=hl(T.value),t=new Set;if(!e.size)return t;for(let n of T.value)n.hashes&&n.role!==`user`&&et(n).forEach((r,i)=>{e.has(`${n.ref}:${(n.imageAt||0)+i}`)&&t.add(r)});return t});function nt(e){let t=Vo(e.list)?Ze(e).rows:e.list.length<=3||ct(e.key)?e.list:[];return e.list.filter(e=>e.images&&!t.includes(e)).map(et).filter(e=>e.length)}function rt(e,t){let n;return Object.defineProperty(e,"html",{get:()=>n??=t(),enumerable:!0})}let it=r(new Set),at=n(()=>!G.value&&s.pane.status===`working`),ot=n(()=>{let e=[],t=T.value,n=[],r=new Map,i=()=>{if(!n.length)return;let t=n[0],i=`t:${t.ts}:${t.text}`,a=r.get(i)||0;r.set(i,a+1),e.push({k:`tools`,key:`${i}#${a}`,list:n,live:!1}),n=[]},a=null,o=``,c=!0,l=null,u=null,d=[],f=()=>{if(a&&a.end&&a.start&&(a.tools||a.replies)){let t=Math.max(0,Math.round((Date.parse(a.end)-Date.parse(a.start))/1e3)),n=a.tools?` · ${a.tools} ${Z(a.tools>1?`actions`:`action`)}`:``;u&&(u.endsTurn=!0),e.push({k:`turn`,key:`e:${e.length}`,text:`✓ ${gr(t)}${n}`,copy:l,reply:u?.key||null})}a=null,l=null,u=null};t.forEach((t,r)=>{if(t.ts){let n=new Date(t.ts).toDateString();n!==o&&(t.role!==`tool`&&(i(),t.role===`user`&&f()),o&&e.push({k:`day`,key:`d:${n}`,label:Br(t.ts)}),o=n)}if(t.role===`user`||t.role===`cmd`||t.role===`bash`||t.role===`notice`&&t.name===`scheduled`?(i(),f(),c=!0,t.role!==`cmd`&&(a={start:t.ts,end:null,tools:0,replies:0})):a&&t.ts&&t.role!==`notice`&&t.role!==`job`&&(a.end=t.ts,t.role===`tool`?a.tools++:t.role===`assistant`&&a.replies++),(t.role===`tool`||t.role===`assistant`||t.role===`thinking`)&&c&&(c=!1,e.push({k:`who`,key:`w:${t.ts}:${r}`})),t.role===`tool`){n.push(t);return}i();let s=`${t.role}:${t.ts}:${r}`;if(gl(t))e.push({k:`autopilot`,key:s,text:t.text});else if(t.role===`user`){let n=t.text.match($e)||[],r=t.text.split(`
14
- `).map(Tn).filter(e=>!!e),i=t.text.replace(/^.*\/\.cache\/herdr-web\/uploads\/\S+\s*$/gm,``).split(`
8
+ `)}}),q=br(ic,ac,e=>e),re=n(()=>i.value?.kind===`text`&&Ys(i.value.path)),ie=n(()=>re.value&&q.value===`rendered`?oa(i.value.text??``,{doc:!0}):``),ae=h(null),J=h(null),oe=new Map,se=``,ce=0;async function le(e,n){let r=++ce;se!==n&&oe.clear(),se=n;let i=!!t.file;for(let t of Array.from(e.querySelectorAll(`img[data-src]`)).slice(0,Lc)){let e=Qs(n,t.dataset.src||``,i);if(e?.kind!==`file`)continue;let a=oe.get(e.path);if(a===void 0){try{let t=await xi(`/api/files/read?${x(e.path)}`);a=t.kind===`image`&&t.dataUrl?t.dataUrl:null}catch{a=null}oe.set(e.path,a)}if(r!==ce)return;a&&(t.src=a)}}let ue=h(0);z(i,()=>{ue.value++}),z([ie,J,ue],async([e,t])=>{if(ce++,!e||!t||!i.value)return;await P();let n=T;T=null,n&&ec(t,n)?.scrollIntoView({block:`start`}),le(t,i.value.path)},{flush:`post`});function de(e){let n=e.target,r=n.closest?.(`.code-copy`);if(r){let e=r.closest(`.code-block`)?.querySelector(`pre`)?.textContent;if(e==null)return;navigator.clipboard.writeText(e).then(()=>{r.textContent=Q(`Copied`),r.classList.add(`done`),setTimeout(()=>{r.textContent=Q(`Copy`),r.classList.remove(`done`)},1400)}).catch(()=>X(Q(`Copy failed`),!0));return}let a=n.closest?.(`a[href]`),o=i.value?.path;if(!a||!o)return;let s=Qs(o,a.getAttribute(`href`)||``,!!t.file);s&&s.kind!==`external`&&(e.preventDefault(),s.kind===`anchor`?J.value&&ec(J.value,s.anchor)?.scrollIntoView({block:`start`}):s.kind===`outside`?X(Q(`This link leads outside the folder.`),!0):s.kind===`dir`?t.file||b(s.path):fe(o,s.path,s.anchor))}async function fe(e,n,a){let o=n.split(`/`).slice(0,-1).join(`/`),s=t.file||r.value?.path===o?null:xi(`/api/files?pane=${d()}&path=${encodeURIComponent(o)}`).catch(()=>null);t.file&&D.value.push(e),T=a||null,await C(n);let c=await s;c&&i.value?.path===n&&(r.value=c),a||ae.value?.scrollIntoView({block:`start`})}function pe(e){return e.kind===`dir`?e.link?`i-lucide-folder-symlink`:`i-lucide-folder`:e.kind===`other`?`i-lucide-file-question`:e.link?`i-lucide-file-symlink`:`i-lucide-file`}return(t,n)=>{let l=bt,u=qs,d=Qe;return _(),v(`div`,oc,[F(`div`,{ref_key:`root`,ref:ae,class:`changes-inner`},[F(`div`,sc,[F(`nav`,{class:`files-crumbs`,"aria-label":(`t`in t?t.t:f(Q))(`Folder`)},[f(i)&&(!e.file||f(D).length)?(_(),m(l,{key:0,icon:`i-lucide-arrow-left`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Q))(`Back to folder`),onClick:ee},null,8,[`aria-label`])):g(``,!0),(_(!0),v(k,null,y(f(G),(e,t)=>(_(),v(k,{key:e.path},[t?(_(),v(`span`,lc,`/`)):g(``,!0),F(`button`,{type:`button`,class:`files-crumb`,onClick:t=>b(e.path)},M(e.label),9,uc)],64))),128)),f(i)?(_(),v(k,{key:1},[f(G).length?(_(),v(`span`,dc,`/`)):g(``,!0),F(`span`,fc,M(f(i).path.split(`/`).pop()),1)],64)):g(``,!0)],8,cc),F(`div`,pc,[f(A)?(_(),m(l,{key:0,icon:`i-lucide-external-link`,color:`neutral`,variant:`outline`,size:`sm`,to:f(A),target:`_blank`,external:``,"aria-label":(`t`in t?t.t:f(Q))(`Open`)},{default:V(()=>[a(M((`t`in t?t.t:f(Q))(`Open`)),1)]),_:1},8,[`to`,`aria-label`])):g(``,!0),f(i)?(_(),m(l,{key:1,icon:`i-lucide-download`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(L),"aria-label":(`t`in t?t.t:f(Q))(`Download`),onClick:R},{default:V(()=>[a(M((`t`in t?t.t:f(Q))(`Download`)),1)]),_:1},8,[`loading`,`aria-label`])):g(``,!0),E(l,{icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(o),"aria-label":(`t`in t?t.t:f(Q))(`Refresh`),onClick:W},{default:V(()=>[F(`span`,mc,M((`t`in t?t.t:f(Q))(`Refresh`)),1)]),_:1},8,[`loading`,`aria-label`])])]),f(s)?(_(),v(`p`,hc,M(f(s)),1)):g(``,!0),f(o)&&!f(r)&&!f(i)?(_(),v(`p`,gc,[n[2]||=F(`span`,{class:`spinner`},null,-1),a(` `+M((`t`in t?t.t:f(Q))(`Reading files…`)),1)])):f(i)?(_(),v(k,{key:2},[F(`p`,_c,M(f(i).path)+` · `+M((`fmtBytes`in t?t.fmtBytes:f(Js))(f(i).size)),1),f(re)?(_(),v(`div`,{key:0,class:`segmented files-md-mode`,role:`group`,"aria-label":(`t`in t?t.t:f(Q))(`Markdown view`),style:{"--segment-count":`2`}},[(_(),v(k,null,y([`rendered`,`source`],e=>F(`button`,{key:e,type:`button`,class:j({on:f(q)===e}),"aria-pressed":f(q)===e,onClick:t=>q.value=e},[F(`span`,null,M(e===`rendered`?(`t`in t?t.t:f(Q))(`Rendered`):(`t`in t?t.t:f(Q))(`Source`)),1)],10,yc)),64))],8,vc)):g(``,!0),f(i).truncated&&f(i).kind===`text`?(_(),v(`p`,bc,M((`t`in t?t.t:f(Q))(`File truncated to keep this view responsive.`)),1)):g(``,!0),f(i).kind===`image`?(_(),v(`img`,{key:2,class:`files-image`,src:f(i).dataUrl,alt:f(i).path},null,8,xc)):f(i).kind===`pdf`?(_(),m(u,{key:`${f(A)}:${f(O)}`,src:f(A),title:f(i).path},null,8,[`src`,`title`])):f(i).kind===`video`?(_(),v(k,{key:4},[f(N)?(_(),v(`p`,Sc,M((`t`in t?t.t:f(Q))(`This video cannot be played here. Use Open or Download.`)),1)):(_(),v(`video`,{key:`${f(A)}:${f(O)}`,class:`files-video`,src:f(A),"aria-label":f(i).path,controls:``,playsinline:``,preload:`metadata`,onError:n[0]||=e=>N.value=!0},null,40,Cc))],64)):f(i).kind===`binary`?(_(),v(`p`,wc,M((`t`in t?t.t:f(Q))(`Binary file`)),1)):f(i).kind===`large`?(_(),v(`p`,Tc,M(/\.pdf$/i.test(f(i).path)?(`t`in t?t.t:f(Q))(`PDF too large to preview (50 MB max).`):(`t`in t?t.t:f(Q))(`Image too large to preview.`)),1)):f(ie)?(_(),v(`article`,{key:f(ue),ref_key:`doc`,ref:J,class:`md md-body files-md`,"aria-label":f(i).path,onClick:de,innerHTML:f(ie)},null,8,Ec)):(_(),v(`div`,{key:8,class:`files-code`,role:`region`,"aria-label":f(i).path},[F(`pre`,Oc,M(f(ne).numbers),1),F(`pre`,kc,M(f(ne).text),1)],8,Dc))],64)):f(r)?(_(),v(k,{key:3},[F(`label`,Ac,[I(F(`input`,{"onUpdate:modelValue":n[1]||=e=>U(c)?c.value=e:null,type:`checkbox`},null,512),[[te,f(c)]]),n[3]||=a(),F(`span`,null,M((`t`in t?t.t:f(Q))(`Show hidden files`)),1)]),f(r).truncated?(_(),v(`p`,jc,M((`t`in t?t.t:f(Q))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),f(K).length?g(``,!0):(_(),v(`p`,Mc,M((`t`in t?t.t:f(Q))(`Empty folder.`)),1)),F(`ul`,Nc,[(_(!0),v(k,null,y(f(K),e=>(_(),v(`li`,{key:e.name},[F(`button`,{type:`button`,class:`change-file files-entry`,disabled:e.kind===`other`,onClick:t=>H(e)},[E(d,{name:pe(e),class:j([`files-icon`,e.kind])},null,8,[`name`,`class`]),F(`span`,Fc,M(e.name),1),e.kind===`file`&&e.size!==null?(_(),v(`span`,Ic,M((`fmtBytes`in t?t.fmtBytes:f(Js))(e.size)),1)):g(``,!0),e.kind===`dir`?(_(),m(d,{key:1,name:`i-lucide-chevron-right`,class:`files-chevron`})):g(``,!0)],8,Pc)]))),128))])],64)):g(``,!0)],512)])}}}),{__name:`FilesView`});function zc(e,t=300,n=300){let r=h(!1),i=null,a=0,o=()=>{i&&=(clearTimeout(i),null)};return z(e,e=>{if(o(),e&&!r.value)i=setTimeout(()=>{i=null,r.value=!0,a=Date.now()},t);else if(!e&&r.value){let e=n-(Date.now()-a);e<=0?r.value=!1:i=setTimeout(()=>{i=null,r.value=!1},e)}},{immediate:!0}),s(o),r}var Bc=e=>!!e&&Hr.value&&!Qr.value&&!Lr(e)&&ma(e.agent),Vc=(e,t)=>!!t&&e.id===t.id&&(e.machine||``)===(t.machine||``)&&e.agent===t.agent&&e.agentSession===t.agentSession&&e.cwd===t.cwd,Hc=e=>Mr.value.panes.find(t=>t.id===e);function Uc(e){return Bc(e)?e.status===`blocked`&&e.prompt?Z(`The agent is waiting for your answer: answer it first.`,`L’agent attend ta réponse : réponds-lui d’abord.`):null:Z(`The agent can no longer run commands (offline, or no agent in the pane): nothing was sent.`,`L’agent ne peut plus lancer de commande (hors ligne, ou plus d’agent dans le pane) : rien n’a été envoyé.`)}function Wc(e){let t=ai(e.agent),n=mi(Mr.value,e),r=zi(e),i=[n,r].filter((e,n,r)=>e&&e.toLowerCase()!==t.toLowerCase()&&r.indexOf(e)===n).join(` › `)||r,a=e.machine?Sr(e.machine):``,o=e.cwd?di(e.cwd):``;return Z(`Run this command in ${t} “${i}”${a?` on ${a}`:``}? It runs in its shell mode (!), in ${o||`its own folder`}, and shows the output in the conversation.`,`Lancer cette commande dans ${t} « ${i} »${a?` sur ${a}`:``} ? Elle s’exécute dans son mode shell (!), dans ${o||`son propre dossier`}, et la sortie s’affiche dans la conversation.`)}async function Gc(e,t){let n=Hc(e),r=Uc(n);if(r||!n)return r&&X(r,!0),!1;let i=fa(n.agent,t);if(!i||($(),!await Je(Wc(n),Z(`Run`,`Lancer`),`primary`,t)))return!1;let a=Hc(e);if(!Vc(n,a))return X(Z(`The agent changed while you were confirming: nothing was sent. Check it and run the command again.`,`L’agent a changé pendant la confirmation : rien n’a été envoyé. Vérifie-le et relance la commande.`),!0),!1;let o=Uc(a);if(o)return X(o,!0),!1;try{let e=await Ee(a,a.id,i);return $(),e}catch(e){return X(e.message,!0),!1}}async function Kc(e){try{await navigator.clipboard.writeText(e),X(Q(`Copied`))}catch{X(Q(`Copy failed`),!0)}}function qc(e,t){return e.stopped||!e.agent?`stopped`:e.prompt?`question`:e.menu||e.screen||e.menuLeftOpen?`dialog`:e.status===`blocked`?`question`:e.pendingPrompt?`starting`:e.status===`working`?`working`:t.reason===`busy`?`busy`:`sending`}function Jc(e,t){return e.agent===`claude`&&[`idle`,`done`].includes(e.status||``)&&!e.leaving&&t.state===`held`&&qc(e,t)===`busy`}var Yc=`/.cache/herdr-web/uploads/`,Xc=e=>e.includes(Yc);function Zc(e){return String(e||``).split(`
9
+ `).filter(Xc).map(e=>e.trim().split(`/`).pop()).filter(Boolean)}var Qc=e=>String(e||``).split(`
10
+ `).filter(e=>!Xc(e)).join(`
11
+ `).trim(),$c=e=>Zc(e).length>0&&!Qc(e),el=/\[Image #\d+(?:, \d+x\d+)?\]/g,tl=e=>(String(e||``).match(el)||[]).length,nl=e=>tl(e)>0&&!String(e||``).replace(el,``).trim();function rl(e,t){return t.role!==`user`||!$c(e)?!1:Zc(e).some(e=>t.text.includes(e))||(t.images||0)>0}var il=e=>`/uploads/${encodeURIComponent(e)}`,al=e=>/^\/[^\s/]*(?:\s|$)/.test(String(e||``).trim()),ol=`/.cache/herdr-web/uploads/`,sl=e=>String(e||``).replace(/\[Image #\d+\]/g,` `).replace(/\s+/g,` `).trim().toLowerCase(),cl=e=>sl(String(e||``).split(`
12
+ `).filter(e=>!e.includes(ol)).join(`
13
+ `));function ll(e,t){let n=e.replace(/\s+/g,``).slice(0,80),r=t.replace(/\s+/g,``).slice(0,80);return!n||!r?!1:n===r||Math.min(n.length,r.length)>=24&&(n.startsWith(r)||r.startsWith(n))}var ul=(e,t)=>!!(e&&t)&&Nr(e,t,ll),dl=(e,t)=>nl(t)&&tl(t)===Zc(e).length,fl=e=>/^\s*!/.test(e),pl=e=>sl(String(e||``).replace(/^\s*!!?\s*/,``));function ml(e,t){if(!t)return`queued`;if($c(e))return t.queued.some(t=>dl(e,t))||!t.sent||!dl(e,t.sent)?`queued`:`sent`;let n=cl(e);if(!n||t.queued.some(e=>ul(n,sl(e))))return`queued`;let r=t.shell?t.shell.python?/^\s*\$/.test(e)?sl(e.replace(/^\s*\$\$?\s*/,``)):``:fl(e)?pl(e):``:``;return t.shell&&ul(r,sl(t.shell.command))?`running`:fl(e)?t.sent&&fl(t.sent)&&ul(pl(e),pl(t.sent))?`sent`:`queued`:t.sent&&!fl(t.sent)&&ul(n,sl(t.sent))?`sent`:`queued`}function hl(e,t){let n=e.map(e=>ml(e,t)),r=e.map(e=>!!(t&&t.queued.some(t=>$c(e)?dl(e,t):ul(cl(e),sl(t))))),i=n.reduce((e,t,n)=>t===`queued`?e:n,-1);return n.map((e,t)=>t>i?e:r.slice(0,t+1).some(Boolean)?`queued`:e===`queued`?`sent`:e)}var gl=e=>String(e||``).replace(/\s+/g,` `).trim().toLowerCase(),_l=(e,t)=>Nr(gl(e),gl(t),(e,t)=>e.includes(t.slice(0,60))),vl=new Map;function yl(e,t){let n=(vl.get(e)||[]).filter(e=>!t.some(t=>t.id===e.id));return n.push(...t.filter(e=>Zc(e.text).length)),vl.set(e,n.slice(-30)),vl.get(e)}function bl(e){let t=t=>{let n=e=>!t.at||!e.ts||Date.parse(e.ts)>=t.at-1e4;if($c(t.text))return e.items.some(e=>n(e)&&rl(t.text,e));let r=Qc(t.text),i=gl(t.text.replace(/^\s*(?:!!?|\$\$?)\s*/,``)).slice(0,60);return!!gl(r)&&e.items.some(e=>n(e)&&(e.role===`user`?_l(e.text,r):e.role===`bash`&&!!i&&gl(e.text).includes(i)))},n=[...e.mine].sort((e,t)=>e.at&&t.at?e.at-t.at:0),r=n.filter(e=>!t(e)),i=hl(r.map(e=>e.text),e.screen),a=r.filter((e,t)=>$c(e.text)&&!e.state&&i[t]===`queued`).length,o=(e.memory||[]).filter(e=>$c(e.text)&&!n.some(t=>t.id===e.id));for(let t of e.idle?[]:e.claude){let i=t.images||0;if(!t.text){if(!i)continue;if(a>0){a--;continue}let e=o.shift(),n=t.sent||e?.text;r.push({id:`cc-${t.ts}`,text:n||``,missing:n?0:i});continue}if(!gl(t.text)||n.some(e=>_l(e.text,t.text))||e.items.some(e=>(!t.ts||!e.ts||e.ts>=t.ts)&&(e.role===`user`||e.role===`notice`)&&_l(e.text,t.text)))continue;let s=i?t.sent||[...e.memory||[]].reverse().find(e=>_l(Qc(e.text),t.text))?.text:null;r.push({id:`cc-${t.ts}`,text:s||t.text,missing:s?0:i})}let s=hl(r.map(e=>e.text),e.screen);return r.map((e,t)=>({id:e.id,raw:e.text,mine:!e.id.startsWith(`cc-`),phase:e.state?`queued`:s[t],state:e.state||null,...e.local?{local:!0}:{},...e.inputText?{inputText:e.inputText}:{},...e.reason?{reason:e.reason}:{},photos:Zc(e.text),missing:e.missing||0,...e.pasted?{pasted:e.pasted}:{}}))}function xl(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.right-n.left>.5&&n.bottom-n.top>.5)return n}return null}function Sl(e,t,n,r){if(e.bottom<n.top||e.top>n.bottom)return null;let i=n.width-t.width-8,a=Math.min(Math.max(8,e.right-t.width),i),o=r?22:6,s=e.bottom+o;if(!r&&e.right+6<=i){let r=Math.round(e.top+(e.bottom-e.top-t.height)/2);return{top:Math.min(Math.max(r,n.top),n.bottom-t.height),left:e.right+6}}if(s+t.height<=n.bottom)return{top:s,left:a};let c=e.top-6-t.height;return!r&&c>=n.top?{top:c,left:a}:{top:Math.max(n.top,n.bottom-t.height-8),left:a}}function Cl(e){let t=!1,n=null,r=()=>{n&&clearTimeout(n),n=null},i=i=>{r(),n=setTimeout(()=>{n=null,t||e.show()},i)};return{down(){t=!0,r(),e.hide()},up(){t&&(t=!1,i(e.touch()?380:180))},change(n=!1){if(!n){if(e.hide(),t){r();return}i(e.touch()?380:350)}},scroll(){e.hide(),t||i(160)},dispose(){r()}}}function wl(e){for(let t=e.length-1;t>=0;t--){let n=e[t].replace(/\s+$/u,``).length;if(n>0)return{index:t,offset:n}}return null}function Tl(e,t){let n=e.cloneRange();if(!t.contains(n.startContainer)){if(n.comparePoint(t,0)<0)return null;n.setStart(t,0)}t.contains(n.endContainer)||n.setEnd(t,t.childNodes.length);let r=[],i=[],a=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let e=a.nextNode();e;e=a.nextNode()){if(!n.intersectsNode(e))continue;let t=e===n.startContainer?n.startOffset:0,a=e===n.endContainer?n.endOffset:e.data.length;r.push(e),i.push(e.data.slice(t,a))}let o=wl(i);if(!o)return null;let s=r[o.index];return n.setEnd(s,(s===n.startContainer?n.startOffset:0)+o.offset),n}function El(e,t,n){let r=null;for(let i of t)!e.has(i)&&n&&(r=i),e.add(i);return r}var Dl=120,Ol=50,kl=new Map;function Al(e,t,n){kl.delete(e),!(!t||n.scrollHeight-n.scrollTop-n.clientHeight<Dl)&&(kl.set(e,{file:t,fromBottom:n.scrollHeight-n.scrollTop}),kl.size>Ol&&kl.delete(kl.keys().next().value))}function jl(e,t,n){let r=kl.get(e);return!r||t!==void 0&&r.file!==t?null:Math.max(0,n-r.fromBottom)}var Ml=()=>({misses:0,errors:0});function Nl(e,t){if(!t)return{next:Ml(),clear:!0};let n=e.misses+1;return n>=3?{next:Ml(),clear:!0}:{next:{...e,misses:n},clear:!1}}var Pl=e=>({...e,errors:e.errors+1}),Fl=e=>e.misses+e.errors>=2;function Il(e){let t=new Set,n=new Set;for(let r of e)r.hashes&&r.hashes.forEach((e,i)=>{r.role!==`user`&&r.ref&&t.has(e)&&n.add(`${r.ref}:${(r.imageAt||0)+i}`),t.add(e)});return n}function Ll(e){return e.role===`user`&&(e.text.startsWith(`Autopilot:`)||e.text.startsWith(`Autopilot woke:`))}var Rl={key:0,class:`search-bar`},zl={class:`search-count`},Bl={class:`chat-wrap`},Vl={key:2,class:`cached-tag chat-cached`,role:`status`},Hl={key:0,class:`chat-empty waiting`},Ul={key:0,class:`choices-screen-text`},Wl={key:1,class:`chat-empty no-integration`},Gl={class:`no-integration-title`},Kl={class:`no-integration-text`},ql={class:`no-integration-cmd`},Jl={class:`no-integration-actions`},Yl={key:2,class:`chat-empty`},Xl={key:2,class:`chat-more`},Zl={key:3,class:`chat-note`},Ql={key:0,class:`day-sep`},$l=[`data-hit-key`],eu=[`aria-label`,`onClick`],tu={class:`msg-quote-time`},nu={class:`msg-quote-text`},ru={key:0,class:`msg-file-chips`},iu=[`title`],au={key:0,class:`q-bar`},ou={class:`q-bar-h`},su=[`aria-label`,`onClick`,`onMouseenter`,`onMouseleave`,`onFocus`,`onBlur`],cu=[`aria-pressed`,`aria-label`,`onClick`],lu=[`aria-pressed`,`onClick`],uu={key:1,class:`msg-actions`},du=[`onClick`],fu=[`disabled`,`aria-expanded`,`onClick`],pu={class:`omp-job-glyph`},mu={class:`omp-job-label`},hu={key:0,class:`omp-job-wall`},gu={key:0,class:`omp-tool-out`},_u={class:`omp-tool-out-head`},vu={class:`omp-tool-out-label`},yu={key:0,class:`omp-tool-out-right`},bu={class:`msg-shell-cmd`},xu={class:`msg-shell-sign`,"aria-hidden":`true`},Su={key:0,class:`msg-shell-body`},Cu={key:0,class:`msg-shell-out`},wu={key:1,class:`msg-shell-out err`},Tu={key:1,class:`msg-shell-empty`},Eu=[`aria-expanded`,`onClick`],Du={key:8,class:`tools omp-console omp-run`},Ou={class:`omp-console-head`},ku={class:`omp-console-title`},Au={key:9,class:`msg-system`},ju={class:`msg-notice-head`},Mu={class:`msg-notice-body msg-error-text`},Nu=[`aria-expanded`,`onClick`],Pu={class:`msg-notice-head`},Fu=[`aria-expanded`,`onClick`],Iu={key:12,class:`turn-end`},Lu=[`onClick`],Ru={class:`omp-console-head`},zu={key:0,class:`omp-console-total`},Bu=[`aria-expanded`,`onClick`],Vu={key:4,class:`chat-empty`},Hu={key:5,class:`chat-empty`},Uu=[`aria-label`],Wu={key:0,class:`queued-list`},Gu={key:0,class:`queued-tag`},Ku=[`disabled`],qu=[`aria-label`,`onClick`],Ju={class:`msg-quote-time`},Yu={class:`msg-quote-text`},Xu=[`title`],Zu={key:0,class:`msg-file-chips`},Qu={class:`queued-tag sent`},$u={key:1,class:`msg-user-wrap`},ed={class:`msg-shell bash running`},td={class:`msg-shell-cmd`},nd={class:`msg-shell-sign`,"aria-hidden":`true`},rd={key:0,class:`msg-shell-body`},id={key:0,class:`msg-shell-hidden`},ad={class:`msg-shell-out`},od={key:1,class:`msg-shell-empty`},sd={class:`queued-tag running`},cd=[`aria-label`,`onClick`],ld={class:`msg-quote-time`},ud={class:`msg-quote-text`},dd=[`title`],fd={key:0,class:`msg-file-chips`},pd={key:1,class:`queued-tag failed`,role:`alert`},md=[`disabled`,`onClick`],hd=[`disabled`,`onClick`],gd={key:2,class:`queued-tag`},_d=[`disabled`,`onClick`],vd=[`disabled`,`onClick`],yd={key:2,class:`menu-left`,role:`status`},bd={class:`menu-left-text`},xd={class:`menu-left-actions`},Sd=[`disabled`],Cd=[`disabled`],wd={key:0,class:`claude-verb-line`},Td={key:1,class:`omp-step-line`},Ed={key:1},Dd=30,Od=10,kd=6,Ad=12,jd=Object.assign(T({__name:`ChatView`,props:B({pane:{},localQueued:{},source:{}},{search:{type:Boolean,default:!1},searchModifiers:{}}),emits:B([`gotoTerm`,`restored`,`quote`,`answered`,`unanswered`,`sent`],[`update:search`]),setup(e,{expose:t,emit:o}){let s=e;sa(qr);let c=Nt(),d=o,p=D(e,`search`),b=h(null),x=h(null),S=()=>({file:null,token:``,tailStart:null,older:[],olderCursor:0,tail:[],queue:[]}),C=u(S()),T=n(()=>C.value.older.concat(C.value.tail)),O=h(null),A=h(null),I=h(null),L=u(Ml()),R=h(!1),B=h(!1),U=h(null),W=n(()=>!!s.source),G=n(()=>W.value||Qr.value||Lr(s.pane));function K(e){let t=s.source;return t?(e.delete(`pane`),`/api/tasks/transcript?${new URLSearchParams({machine:t.machine,id:t.id,role:t.role})}&${e}`):`/api/chat?${e}`}let te=zc(n(()=>U.value!==null&&!G.value&&!Ii.value),600,0),ne=zc(n(()=>!R.value&&!O.value&&!I.value)),q=n(()=>!W.value&&Bc(s.pane));async function ie(){if(!Fi(Ai()))return;let e=s.pane.id,t=await Ki(e);!t||Me||R.value||O.value||e!==s.pane.id||(await ue(()=>{C.value={...S(),tail:t.items},U.value=t.at,oe=t.file}),fr(s.pane.id))}let ae=e=>{let t=b.value;return!t||t.scrollHeight-t.scrollTop-t.clientHeight<e};function J(e){let t=b.value;t&&(e||!pe&&(fe||ae(160)))&&(fe=!0,pe=!1,requestAnimationFrame(()=>{fe&&(t.scrollTop=t.scrollHeight)}))}let oe=null,ce=!1,le=()=>ne.value?new Promise(e=>{let t=z(ne,n=>{n||(t(),e())})}).then(()=>P()):Promise.resolve();async function ue(e,t=!1){let n=!pe&&(fe||ae(120)),r=!R.value,i=ce&&U.value===null&&!n&&b.value?b.value.scrollHeight-b.value.scrollTop:null,a=oe;U.value===null&&(ce=!1);let o=mt.value.length;e(),r?_e.value=Dd:_e.value!==1/0&&(_e.value+=Math.max(0,mt.value.length-o)),await P(),R.value=!0,ve.value&&Te();let c=null,l=U.value!==null,u=l?oe:C.value.file;de&&u!==null&&b.value?(de=!1,await le(),ve.value&&jl(s.pane.id,u,b.value.scrollHeight)===0&&await we(),c=jl(s.pane.id,u,b.value.scrollHeight),ce=l&&c!==null):i!==null&&(a===void 0||a===C.value.file)&&b.value&&b.value.scrollHeight-b.value.scrollTop!==i&&(c=b.value.scrollHeight-i),!hr&&p.value&&Y.q.length>=2?Tr(!1):c!==null&&!hr&&b.value?(fe=!1,b.value.scrollTop=c):!t&&(n||r)&&J(!0)}let de=typeof c.query.hit!=`string`,fe=!0,pe=!1;function me(){pe=!1,ce=!1,Ee()}let he=null;w(()=>{he=new ResizeObserver(()=>{let e=b.value;e&&fe&&(e.scrollTop=e.scrollHeight)}),b.value&&he.observe(b.value),x.value&&he.observe(x.value)}),H(()=>{b.value&&R.value&&Al(s.pane.id,C.value.file,b.value)}),l(()=>he?.disconnect());function ge(){let e=b.value;e&&(be=Date.now(),vn.open=!1,pe||(fe=e.scrollHeight-e.scrollTop-e.clientHeight<120),ve.value?e.scrollTop<1500&&Ce(20):e.scrollTop<400&&R.value&&Ge())}let _e=h(1/0),ve=n(()=>Math.max(0,mt.value.length-_e.value)),ye=n(()=>ve.value?mt.value.slice(ve.value):mt.value),be=0,xe=!1,Se=!1;l(()=>{Se=!0});async function Ce(e){if(!ve.value)return;let t=b.value,n=t?t.scrollHeight-t.scrollTop:0;_e.value=e===1/0?1/0:mt.value.length-ve.value+e,await P(),t&&(t.scrollTop=t.scrollHeight-n)}let we=()=>Ce(1/0);function Te(){if(xe||Se)return;xe=!0;let e=()=>{if(xe=!1,!Se&&ve.value){if(ne.value||Date.now()-be<400||document.hidden)return Te();Ce(Od).then(()=>{ve.value&&Te()})}},t=globalThis.requestIdleCallback;t?t(e,{timeout:3e3}):setTimeout(e,250)}function Ee(){ke.value=null}let De=new Set,Oe=new Set,ke=h(null),je=h(null),Me=!1,Ne=!1;z(ti,e=>{e||(Ne=!0,Ee())}),z(Qr,e=>{e&&(Ne=!0,Ee())});function Pe(e){let t=Me&&!Ne&&Fr.value&&!p.value&&!G.value,n=Me&&!Ne&&!p.value&&!G.value,r=El(Oe,e.filter(e=>e.role===`thinking`).map(yr),n);r&&(ke.value={id:r,at:Date.now()}),Ne=!1,Me=!0;let i=Ar(De,e.filter(e=>e.role===`assistant`).map(yr),t&&!r);i&&(je.value={id:i,at:Date.now()})}let Fe=e=>je.value&&je.value.id===e?je.value.at:null;function Ie(e){je.value?.id===e&&(je.value=null)}z([Fr,p],([e,t])=>{(!e||t)&&(je.value=null),t&&Ee()});function Le(e){return ke.value?.id===e?ke.value.at:null}function Re(e){ke.value?.id===e&&Ee()}async function ze(){if(A.value){$();try{await navigator.clipboard.writeText(A.value.command),X(Z(`Command copied.`,`Commande copiée.`))}catch{X(Q(`Copy failed`),!0)}}}let Ve=Kt();async function He(e){let t=s.pane.id,n=()=>!e()||t!==s.pane.id;try{let e=C.value.tailStart===null&&!W.value?await Ve.take(s.pane):void 0;if(n())return!1;let r=Date.now(),i=e||await xi(K(Yt(t,C.value)),void 0,AbortSignal.timeout(8e3));if(n())return!1;if(!i.available){let e=Nl(L.value,!!C.value.file&&T.value.length>0);return L.value=e.next,e.clear?(C.value=S(),O.value=i.reason||`unsupported`,A.value=i.reason===`no_integration`&&i.integration||null,Me=!0,!1):!1}if(O.value=null,A.value=null,I.value=null,!e&&!W.value&&Qn(t,r),(L.value.misses||L.value.errors)&&(L.value=Ml()),i.unchanged)return!1;if(U.value=null,zt(C.value,i))return C.value=S(),Me=!1,!0;let a=dn(C.value.tail,i);if(!a)return C.value={...C.value,token:``},!0;if(a=rr(C.value.tail,a),a===C.value.tail&&(i.file||null)===C.value.file&&C.value.tailStart!==null&&_n(C.value.queue,i.queue||[]))return C.value.token=i.token||``,Ne=!1,!1;if(await ue(()=>{let e={...C.value};e.tailStart===null&&(e.tailStart=i.start??0,e.olderCursor=i.start??0),e.file=i.file||null,e.token=i.token||``,e.tail=a,e.queue=i.queue||[],C.value=e,Pe(e.tail)}),Qi(t,T.value,C.value.file),e)return!0}catch(e){if(n())return!1;T.value.length?L.value=Pl(L.value):I.value=e.message}return!1}let Ue=en(He),We=Ue.load;z(()=>s.pane.id,()=>Ue.invalidate());async function Ge(){if(B.value||!(C.value.olderCursor>0))return;B.value=!0;let e=s.pane.id,t=C.value.file,n=C.value.olderCursor;try{let r=await xi(K(new URLSearchParams({pane:e,before:String(n)})),void 0,AbortSignal.timeout(Xt));if(e!==s.pane.id||r.file!==t||C.value.olderCursor!==n)return;let i=b.value,a=i?i.scrollHeight-i.scrollTop:0;await ue(()=>{_e.value=1/0,C.value={...C.value,older:(r.items||[]).concat(C.value.older),olderCursor:(r.start??0)<n?r.start??0:0}},!0),Qi(e,T.value,C.value.file),i&&(i.scrollTop=i.scrollHeight-a)}catch(e){X(e.message,!0)}finally{B.value=!1}}let qe;w(()=>{Promise.all([We(),ie()]).then(Ur),qe=na(()=>{!document.hidden&&!Qr.value&&We()},W.value?5e3:1500)}),l(()=>clearInterval(qe)),z(ti,e=>{e&&We()}),z(qi,()=>{Mr.value.ok&&!Ii.value&&!Qr.value&&(Ue.invalidate(),We())});let Je=Z(`Command`,`Commande`),Ye=Z(`Edit`,`Modif`),Xe=Z(`Subagent`,`Sous-agent`),Ze={Bash:Je,Read:Z(`Read`,`Lecture`),Write:Z(`Write`,`Écriture`),Edit:Ye,MultiEdit:Ye,Grep:Z(`Search`,`Recherche`),Glob:Z(`Files`,`Fichiers`),WebFetch:`Web`,WebSearch:Z(`Web search`,`Recherche web`),Task:Xe,Agent:Xe,TodoWrite:Z(`Tasks`,`Tâches`),exec:Je,shell:Je,apply_patch:Ye},$e={Bash:`i-lucide-terminal`,exec:`i-lucide-terminal`,shell:`i-lucide-terminal`,Read:`i-lucide-file-text`,Write:`i-lucide-file-plus`,Edit:`i-lucide-file-pen`,MultiEdit:`i-lucide-file-pen`,apply_patch:`i-lucide-file-pen`,NotebookEdit:`i-lucide-file-pen`,Grep:`i-lucide-text-search`,Glob:`i-lucide-folder-search`,WebFetch:`i-lucide-globe`,WebSearch:`i-lucide-search`,Task:`i-lucide-bot`,Agent:`i-lucide-bot`,TodoWrite:`i-lucide-list-todo`,AskUserQuestion:`i-lucide-message-circle-question`},et=e=>e.name===`TodoWrite`?Q(e.text||``):e.text,tt=e=>e.name===`exec`&&/^\w+$/.test(e.text||``),nt=e=>tt(e)?Q(`Tool`):Ze[e.name||``]||e.name||``,rt=e=>e.error?`i-lucide-circle-x`:tt(e)?`i-lucide-wrench`:$e[e.name||``]||`i-lucide-wrench`,it=e=>`${nt(e)} · ${e.text}`,at=e=>ls(e.list,ht(e.key)),ot={advisor:[`Advisor`,`i-lucide-lightbulb`],"async-result":[`Background job done`,`i-lucide-circle-check`],"irc:incoming":[`Agent message`,`i-lucide-message-square`],"launch-completion":[`Process`,`i-lucide-cpu`],"lsp-late-diagnostic":[`Diagnostics`,`i-lucide-triangle-alert`],"background-tan-dispatch":[`Background task`,`i-lucide-bot`],scheduled:[`Scheduled task`,`i-lucide-clock`]},st=/\/\.cache\/herdr-web\/uploads\/\S+/g;function ct(e){let t=C.value.file,n=[];if(!e.ref||!e.images||!t)return n;let r=s.source,i=r?`/api/tasks/transcript-image?${new URLSearchParams({machine:r.machine,id:r.id,role:r.role})}`:`/api/chat/image?pane=${encodeURIComponent(s.pane.id)}`;for(let r=0;r<e.images;r++)n.push(`${i}&file=${encodeURIComponent(t)}&ref=${e.ref}&i=${(e.imageAt||0)+r}`);return n}let lt=n(()=>{let e=Il(T.value),t=new Set;if(!e.size)return t;for(let n of T.value)n.hashes&&n.role!==`user`&&ct(n).forEach((r,i)=>{e.has(`${n.ref}:${(n.imageAt||0)+i}`)&&t.add(r)});return t});function ut(e){let t=cs(e.list)?at(e).rows:e.list.length<=3||ht(e.key)?e.list:[];return e.list.filter(e=>e.images&&!t.includes(e)).map(ct).filter(e=>e.length)}function dt(e,t){let n;return Object.defineProperty(e,"html",{get:()=>n??=t(),enumerable:!0})}let ft=r(new Set),pt=n(()=>!G.value&&s.pane.status===`working`),mt=n(()=>{let e=[],t=T.value,n=[],r=new Map,i=()=>{if(!n.length)return;let t=n[0],i=`t:${t.ts}:${t.text}`,a=r.get(i)||0;r.set(i,a+1),e.push({k:`tools`,key:`${i}#${a}`,list:n,live:!1}),n=[]},a=null,o=``,c=!0,l=null,u=null,d=[],f=()=>{if(a&&a.end&&a.start&&(a.tools||a.replies)){let t=Math.max(0,Math.round((Date.parse(a.end)-Date.parse(a.start))/1e3)),n=a.tools?` · ${a.tools} ${Q(a.tools>1?`actions`:`action`)}`:``;u&&(u.endsTurn=!0),e.push({k:`turn`,key:`e:${e.length}`,text:`✓ ${sr(t)}${n}`,copy:l,reply:u?.key||null})}a=null,l=null,u=null};t.forEach((t,r)=>{if(t.ts){let n=new Date(t.ts).toDateString();n!==o&&(t.role!==`tool`&&(i(),t.role===`user`&&f()),o&&e.push({k:`day`,key:`d:${n}`,label:ni(t.ts)}),o=n)}if(t.role===`user`||t.role===`cmd`||t.role===`bash`||t.role===`notice`&&t.name===`scheduled`?(i(),f(),c=!0,t.role!==`cmd`&&(a={start:t.ts,end:null,tools:0,replies:0})):a&&t.ts&&t.role!==`notice`&&t.role!==`job`&&(a.end=t.ts,t.role===`tool`?a.tools++:t.role===`assistant`&&a.replies++),(t.role===`tool`||t.role===`assistant`||t.role===`thinking`)&&c&&(c=!1,e.push({k:`who`,key:`w:${t.ts}:${r}`})),t.role===`tool`){n.push(t);return}i();let s=`${t.role}:${t.ts}:${r}`;if(Ll(t))e.push({k:`autopilot`,key:s,text:t.text});else if(t.role===`user`){let n=t.text.match(st)||[],r=t.text.split(`
14
+ `).map(Zn).filter(e=>!!e),i=t.text.replace(/^.*\/\.cache\/herdr-web\/uploads\/\S+\s*$/gm,``).split(`
15
15
  `).filter(e=>!Cn(e)).join(`
16
- `).trim(),a=et(t);for(let e of n)a.push(`/uploads/${encodeURIComponent(e.split(`/`).pop())}`);let o=Bi(i),c=o&&sr(d,o.reply)?.key||null;e.push({k:`user`,key:s,text:o?o.body:i,pasted:t.pasted,srcs:a,files:r,time:t.ts?Tr(t.ts):null,at:t.ts?Gr(t.ts):null,reply:o?.reply||null,origin:c})}else if(t.role===`assistant`){l=t.text;let n=t.ts?Tr(t.ts):null;u=rt({k:`assistant`,key:s,id:rr(t),rid:Si(t),text:t.text,time:n,endsTurn:!1},()=>Zr(na(t.text),{reply:Z(`Reply`),quoted:Z(`Quoted`),discuss:Z(`Discuss`),yes:Z(`Yes`),no:Z(`No`),okAll:Z(`OK to all`),decisions:Z(`Decisions`)})),e.push(u),d.push({key:s,time:n,text:t.text,rid:u.rid})}else if(t.role===`thinking`)e.push(rt({k:`thinking`,key:s,id:rr(t),text:t.text,ms:t.ms},()=>na(t.text)));else if(t.role===`job`&&t.job)e.push({k:`job`,key:s,id:t.job.id,tool:t.job.tool,out:t.job.out,ms:t.ms,error:!!t.error});else if(t.role===`bash`&&t.omp)e.push({k:`ompRun`,key:`s:${t.ts}:${t.text.slice(0,40)}`,tool:{...t,omp:t.omp}});else if(t.role===`bash`){let n=t.out||``,r=t.err||``,i=(n?n.split(`
16
+ `).trim(),a=ct(t);for(let e of n)a.push(`/uploads/${encodeURIComponent(e.split(`/`).pop())}`);let o=wi(i),c=o&&lr(d,o.reply)?.key||null;e.push({k:`user`,key:s,text:o?o.body:i,pasted:t.pasted,srcs:a,files:r,time:t.ts?hi(t.ts):null,at:t.ts?Rr(t.ts):null,reply:o?.reply||null,origin:c})}else if(t.role===`assistant`){l=t.text;let n=t.ts?hi(t.ts):null;u=dt({k:`assistant`,key:s,id:yr(t),rid:Zi(t),text:t.text,time:n,endsTurn:!1},()=>gi(oa(t.text),{reply:Q(`Reply`),quoted:Q(`Quoted`),discuss:Q(`Discuss`),yes:Q(`Yes`),no:Q(`No`),okAll:Q(`OK to all`),decisions:Q(`Decisions`)})),e.push(u),d.push({key:s,time:n,text:t.text,rid:u.rid})}else if(t.role===`thinking`)e.push(dt({k:`thinking`,key:s,id:yr(t),text:t.text,ms:t.ms},()=>oa(t.text)));else if(t.role===`job`&&t.job)e.push({k:`job`,key:s,id:t.job.id,tool:t.job.tool,out:t.job.out,ms:t.ms,error:!!t.error});else if(t.role===`bash`&&t.omp)e.push({k:`ompRun`,key:`s:${t.ts}:${t.text.slice(0,40)}`,tool:{...t,omp:t.omp}});else if(t.role===`bash`){let n=t.out||``,r=t.err||``,i=(n?n.split(`
17
17
  `).length:0)+(r?r.split(`
18
- `).length:0);e.push({k:`shell`,key:`s:${t.ts}:${t.text.slice(0,40)}`,bash:t.role===`bash`,text:t.text,out:n,err:r,lines:i,long:i>od||n.length+r.length>1500})}else if(t.role===`notice`){let[n,r]=Qe[t.name||``]||[t.name||`Note`,`i-lucide-info`];e.push(rt({k:`notice`,key:s,label:Z(n),icon:r,scheduled:t.name===`scheduled`,long:t.name===`scheduled`||t.text.split(`
19
- `).length>od||t.text.length>1200},()=>na(t.text)))}else{let n=t.role===`system`?t.text.match(/^Effort : (low|medium|high|xhigh|max|ultracode) \(cette session\)$/):null;e.push({k:`system`,key:s,text:n?Q(`Effort: ${n[1]} (this session)`,`Effort : ${n[1]} (cette session)`):t.role===`system`?Z(t.text):t.text})}}),i();let p=!G.value&&s.pane.status===`blocked`;if(!at.value&&!p&&!s.pane.pendingPrompt)f();else{let t=e[e.length-1];t&&t.k===`tools`&&(at.value||p)&&(t.live=!0)}return e}),ct=e=>it.has(e);function lt(e,t){t?it.add(e):it.delete(e)}let ut=e=>[...x.value?.querySelectorAll(`[data-hit-key]`)||[]].find(t=>t.dataset.hitKey===e)||null,dt=e=>{let t=e?.closest(`[data-hit-key]`)?.dataset.hitKey,n=t?ot.value.find(e=>e.key===t):null;return n&&n.k===`assistant`?{time:n.time,id:n.rid}:{time:null,id:null}};function ft(e){let{time:t,id:n}=dt(e);if(e.classList.contains(`q-all`))return _r({n:e.dataset.n||``,text:e.dataset.q||``},t,n,Kr(e));let r=e.closest(`.q-trow`);return r?yr(Wr(r),t,n):e.dataset.q?ti(e.dataset.q,t,n):null}function pt(e){let t=ot.value.find(t=>t.key===e);t&&t.k===`assistant`&&ht(pi(t.text,t.time,t.rid))}function ht(e){let t=an(s.pane.id),n=e?Ar(t.text,e):null;Ft.value=null,window.getSelection()?.removeAllRanges(),n!==null&&(t.text=n),X(),d(`quote`)}let gt=e=>Z(e===`yes`?`Yes`:`No`),vt=()=>{oe=!1,se=!0};function yt(e,t,n){if(!e)return;vt();let r=an(s.pane.id),i=kr(r.text,e,gt(t));i!==null&&(r.text=i),X(),n&&d(`answered`,Nr(r.text,e))}function bt(e,t){if(!e)return;vt();let n=an(s.pane.id);n.text=ki(n.text,e,Q(`OK to all`,`OK tout`)),X(),t&&d(`answered`,Nr(n.text,e))}let xt=(e,t)=>Er(mr(At.value,e)||``)===t;function St(){let e=an(s.pane.id).text;for(let t of x.value?.querySelectorAll(`.q-ans, .q-tans`)||[]){let n=ft(t);t.setAttribute(`aria-pressed`,String(!!n&&Er(mr(e,n)||``)===t.dataset.a))}for(let t of x.value?.querySelectorAll(`.q-all`)||[])t.setAttribute(`aria-pressed`,String(Dr(e,ft(t))));for(let t of x.value?.querySelectorAll(`.q-reply, .q-point, .q-tquote`)||[]){let n=ft(t),r=!!n&&Dr(e,n);if(t.classList.toggle(`quoted`,r),t.dataset.n&&!t.classList.contains(`q-tquote`))for(let e of Ct(t))e.classList.toggle(`quoted`,r)}}let Ct=e=>e.closest(`.md-body`)?.querySelectorAll(`.q-text[data-n="${e.dataset.n}"]`)||[],wt=e=>e.closest(`.md-body`)?.querySelector(`.q-reply[data-n="${e.dataset.n}"]`)||null,Tt=null;function Et(e){Tt?.classList.remove(`q-armed`),Tt=e,e?.classList.add(`q-armed`)}let Dt=h(null),At=n(()=>an(s.pane.id).text);B(At,e=>{e||(se=!1)});function jt(e,t,n){for(let r of ut(e)?.querySelectorAll(`.q-text[data-n="${t}"]`)||[])r.classList.toggle(`q-hot`,n)}let Mt;function Nt(e,t){let n=t.closest(`.msg-ai .md-body .q-pt`),r=n?.querySelector(`:scope > .q-point`),i=r?.dataset.q;if(clearTimeout(Mt),!n||!i||t.closest(`a, button, summary, input`))return Et(null);if(ni.value===`list`){Dt.value&&n.closest(`[data-hit-key]`)?.dataset.hitKey===Dt.value&&(Dt.value=null,ht(ft(r)));return}if(ni.value!==`text`||window.getSelection()?.isCollapsed===!1)return Et(null);if(Rt())return Et(n===Tt?null:n);e.detail>1||(Mt=setTimeout(()=>{window.getSelection()?.isCollapsed!==!1&&ht(ft(r))},220))}l(()=>clearTimeout(Mt)),B([()=>an(s.pane.id).text,pe],()=>P(St),{flush:`post`});let Ft=h(null),It=h(null),Rt=()=>window.matchMedia(`(pointer: coarse)`).matches;function zt(){let e=window.getSelection(),t=e&&!e.isCollapsed&&e.rangeCount?e.getRangeAt(0):null,n=(t?t.startContainer.nodeType===1?t.startContainer:t.startContainer.parentElement:null)?.closest(`.msg-ai[data-hit-key]`);if(!t||!n||G.value||!x.value?.contains(n))return null;let r=il(t,n.querySelector(`.md`)||n),i=r?.toString().trim()||``;if(!r||!i)return null;let a=el(r.getClientRects())||r.getBoundingClientRect();return{host:n,text:i,end:a,sig:`${i}|${Math.round(a.right)}|${Math.round(a.top)}`}}function Vt(){let e=zt();if(!e||!x.value){Ft.value=null;return}let t=x.value.getBoundingClientRect(),n=tl(e.end,{width:It.value?.offsetWidth||104,height:It.value?.offsetHeight||32},{width:window.innerWidth,top:Math.max(0,t.top),bottom:Math.min(window.innerHeight,t.bottom)},Rt());Ft.value=n?{text:e.text,...dt(e.host),sig:e.sig,...n}:null}let Ht=nl({show:Vt,hide:()=>{Ft.value=null},touch:Rt}),Ut=e=>{e.button===0&&!e.target?.closest?.(`.sel-reply`)&&Ht.down()},Wt=()=>Ht.up(),Kt=()=>Ht.change(!!Ft.value&&zt()?.sig===Ft.value.sig),qt=()=>{(Ft.value||window.getSelection()?.isCollapsed===!1)&&Ht.scroll()};w(()=>{document.addEventListener(`pointerdown`,Ut,!0),document.addEventListener(`pointerup`,Wt,!0),document.addEventListener(`pointercancel`,Wt,!0),document.addEventListener(`selectionchange`,Kt),window.addEventListener(`scroll`,qt,!0),window.addEventListener(`resize`,qt)}),l(()=>{Ht.dispose(),document.removeEventListener(`pointerdown`,Ut,!0),document.removeEventListener(`pointerup`,Wt,!0),document.removeEventListener(`pointercancel`,Wt,!0),document.removeEventListener(`selectionchange`,Kt),window.removeEventListener(`scroll`,qt,!0),window.removeEventListener(`resize`,qt)}),i(`gotoRef`,(e,t)=>{let n=t.closest(`[data-hit-key]`)?.dataset.hitKey,r=n?ot.value.findIndex(e=>e.key===n):-1,i=(r<0?ot.value:ot.value.slice(0,r)).flatMap(e=>e.k===`assistant`?[{key:e.key,time:e.time,text:e.text,rid:e.rid}]:[]);Qt(sr(i,{time:e.time||``,excerpt:e.excerpt,id:e.id&&hi(e.id)})?.key||null)});async function Qt(e){e&&!ut(e)&&fe.value&&await ve();let t=e?ut(e):null;if(!t)return $(Z(`Original message not found (further up the conversation?)`),!0);t.scrollIntoView({block:`center`,behavior:`smooth`}),t.classList.remove(`msg-flash`),t.offsetWidth,t.classList.add(`msg-flash`),setTimeout(()=>t.classList.remove(`msg-flash`),1700)}let tn=Tc;function nn(e){let t=e.target,n=t.closest?.(`.q-ans`),r=e.detail>0;if(n?.dataset.q){e.preventDefault(),Et(null),Dt.value=null,yt(ft(n),n.dataset.a===`no`?`no`:`yes`,r);return}let i=t.closest?.(`.q-tans`);if(i?.dataset.n){e.preventDefault(),Et(null),Dt.value=null,yt(ft(i),i.dataset.a===`no`?`no`:`yes`,r);return}let a=t.closest?.(`.q-all`);if(a){e.preventDefault(),Et(null),Dt.value=null,bt(ft(a),r);return}let o=t.closest?.(`.q-reply, .q-point, .q-tquote`);if(o){e.preventDefault(),Et(null),Dt.value=null,ht(ft(o));return}let s=ni.value===`text`&&!G.value?t.closest?.(`.q-text`):null,c=s&&window.getSelection()?.isCollapsed!==!1?wt(s):null;if(c){e.preventDefault(),Et(null),ht(ft(c));return}let l=t.closest?.(`.md-body .md-path`);if(l){e.preventDefault(),_n(l);return}let u=t.closest?.(`.md-body .md-cmd`);if(u){e.preventDefault(),ln(u);return}let d=t.closest?.(`.md-body img`);if(d&&d.src){e.preventDefault(),Lr(d.src);return}!G.value&&!t.closest?.(`.code-block`)&&Nt(e,t);let f=(t.closest?.(`.can-run .code-run`))?.closest(`.code-block`)?.dataset.cmd;if(f){rn(f);return}let p=t.closest?.(`.code-copy`);if(!p)return;let m=p.closest(`.code-block`),h=m?.dataset.cmd??m?.querySelector(`pre`)?.textContent;h!=null&&navigator.clipboard.writeText(h).then(()=>{p.textContent=Z(`Copied`),p.classList.add(`done`),setTimeout(()=>{p.textContent=Z(`Copy`),p.classList.remove(`done`)},1400)}).catch(()=>$(Z(`Copy failed`),!0))}async function rn(e){let t=await wc(s.pane.id,e);t!==!1&&d(`sent`,t)}async function on(e){if(!G.value)try{let t=await gi(`/api/split-command`,{pane_id:s.pane.id,command:e});$(t.created?Z(`Command sent to a new split terminal`):Z(`Command sent to split terminal`)),await Bt(Hi.value?{path:st(s.pane.tab),query:{pane:t.pane_id}}:Be(t.pane_id))}catch(e){$(e.message,!0)}}function cn(e,t){let n=[];return t&&n.push({label:Q(`Run…`,`Lancer…`),icon:`i-lucide-play`,run:()=>rn(e)}),G.value||n.push({label:Z(`Run in split terminal`),icon:`i-lucide-columns-2`,run:()=>on(e)}),n.push({label:Z(`Copy command`),icon:`i-lucide-copy`,desc:e,mono:!0,run:()=>tn(e)}),n}function ln(e){let t=e.dataset.cmd;t&&pn(e,cn(t,te.value&&!!e.closest(`.can-run`)),Q(`Command`,`Commande`))}let un=r({open:!1,x:0,y:0,w:0,h:0}),dn=h([]);function pn(e,t,n){if(fi.value){X(),Pt(t,n);return}let r=e.getBoundingClientRect();Object.assign(un,{x:r.left,y:r.top,w:r.width,h:r.height}),dn.value=kt(t),un.open=!0}let mn=e=>e.replace(/\/+$/,``).split(`/`).pop()||e;function hn(e){let t=[];return!Sr.value&&!e.endsWith(`/`)&&t.push({label:Z(`Preview`),icon:`i-lucide-eye`,run:()=>bn(e)},{label:Z(`Download`),icon:`i-lucide-download`,run:()=>xn(e)}),bi(s.pane)&&!Sr.value&&t.push({label:Z(`Reveal in Finder`),icon:`i-lucide-folder-search`,run:()=>wn(e,`reveal`)},{label:Z(`Open`),icon:`i-lucide-external-link`,run:()=>wn(e,`open`)}),t.push({label:Z(`Copy path`),icon:`i-lucide-copy`,desc:e,mono:!0,run:()=>tn(e)}),t}function _n(e,t){let n=t||(e.textContent||``).trim();n&&pn(e,hn(n),mn(n))}let yn=r({open:!1,path:``});function bn(e){Object.assign(yn,{open:!0,path:e})}async function xn(e){try{await ai(`/api/files/download?pane=${encodeURIComponent(s.pane.id)}&path=${encodeURIComponent(e)}&from=chat`,mn(aa(e)))}catch(e){$(e.message,!0)}}function Sn(e){if(e.key===`Escape`&&(Dt.value||Tt)){Dt.value=null,Et(null);return}if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target.closest?.(`.md-body .md-path, .md-body .md-cmd`);t&&(e.preventDefault(),t.classList.contains(`md-cmd`)?ln(t):_n(t))}async function wn(e,t){try{let n=await gi(`/api/reveal`,{pane_id:s.pane.id,path:e,mode:t});$(t===`reveal`?Q(`Shown in Finder on ${n.machine}`,`Affiché dans le Finder sur ${n.machine}`):Q(`Opened in the editor on ${n.machine}`,`Ouvert dans l’éditeur sur ${n.machine}`))}catch(e){$(e.message,!0)}}let En=n(()=>{if(G.value)return null;let e=s.pane;return e.agent===`omp`?e.ompShell?{shell:e.ompShell,sent:null,queued:[]}:null:e.agent===`claude`&&e.status===`working`&&e.claudeScreen||null}),Dn=n(()=>En.value&&En.value.shell||null),On=h(Date.now()),kn;B(Dn,e=>{e&&!kn&&(kn=Or(()=>{On.value=Date.now()},1e3)),!e&&kn&&(clearInterval(kn),kn=void 0)},{immediate:!0}),l(()=>clearInterval(kn));let An=n(()=>{let e=Dn.value&&Dn.value.since;if(!e)return null;let t=Math.max(0,Math.round((On.value-e)/1e3));return t<60?`${t} s`:`${Math.floor(t/60)} min ${String(t%60).padStart(2,`0`)} s`}),jn=n(()=>{let e=s.pane,t=Qn(G.value?[]:(e.queued||[]).filter(e=>!e.back),s.localQueued),n=Qc(e.id,t),r=ot.value.filter(e=>e.k===`assistant`),i=Ec(e,{})===`sending`;return $c({mine:t,claude:C.value.queue||[],items:T.value,screen:En.value,memory:n,idle:i}).map(e=>{let t=e.raw.split(`
20
- `),n=t.filter(e=>!kc(e)&&!Cn(e)).join(`
21
- `).trim(),i=Bi(n);return{...e,srcs:e.photos.map(Lc),files:t.map(Tn).filter(e=>!!e),text:n,body:i?i.body:n,reply:i?.reply||null,origin:i&&sr(r,i.reply)?.key||null}})}),Mn=h(!1);async function Nn(){if(!Mn.value){Mn.value=!0;try{await gi(`/api/send-now`,{pane_id:s.pane.id})}catch(e){$(e.message,!0)}finally{Mn.value=!1}}}let Pn=e=>[...e.srcs.map(e=>({type:`file`,mediaType:`image/jpeg`,url:e})),...Array.from({length:e.missing},()=>({type:`file`,mediaType:`image/jpeg`,url:``})),...e.body||e.files.length?[{type:`text`,text:e.body||` `}]:[]],Fn=n(()=>!G.value&&vn(s.pane)),In=h(null);async function Ln(e){if(!In.value){if(e.local){Gn(an(s.pane.id),Rn(s.pane.id,e.id)||e.raw),d(`restored`);return}In.value=e.id,X();try{let t=await gi(`/api/unqueue`,{pane_id:s.pane.id,text:e.raw,id:e.mine?e.id:void 0});Gn(an(s.pane.id),t.text||e.raw,e.pasted),d(`restored`),t.lost?$(Z(`Removed from the queue`),!0,Vn(t.lost)):$(Z(`Removed from the queue`)),setTimeout(Ie,400)}catch(e){$(e.message,!0)}finally{In.value=null}}}let zn=h(null);async function Bn(e){if(!zn.value){zn.value=e.id,X();try{e.local?await gn(s.pane,s.pane.id,e.id):await gi(`/api/requeue`,{pane_id:s.pane.id,id:e.id})}catch(e){$(e.message,!0)}finally{zn.value=null}}}let Hn=n(()=>!!s.pane.menuLeftOpen&&jn.value.some(e=>e.phase===`queued`)),Un=h(null);async function Wn(e){if(!Un.value){Un.value=e,X();try{await gi(`/api/menu-left`,{pane_id:s.pane.id,action:e})}catch(e){$(e.message,!0)}finally{Un.value=null}}}function Kn(e){return Z(e===`busy`?`Not sent — the agent’s input contains text`:e===`no_input`?`Not sent — the agent’s input field was not found on its screen`:e===`lost`?`Not sent — it was taken out of the agent’s queue before being read`:e===`unseen`?`Not sent — still not in the conversation after an hour`:`Not sent`)}let qn=h(null);async function Jn(e){if(!qn.value){qn.value=e.id;try{await gi(`/api/clear-queued-input`,{pane_id:s.pane.id,id:e.id,input_text:e.inputText})}catch(e){$(e.message,!0)}finally{qn.value=null}}}function Yn(e){if(e.state===`sending`)return Z(`Queued · `)+Z(`sending…`);switch(Ec(s.pane,e)){case`busy`:return e.inputText?Q(`Not sent: the agent’s input already contains text (“${e.inputText}”)`,`Pas envoyé : la saisie de l’agent contient déjà du texte (« ${e.inputText} »)`):Z(`Not sent — the agent’s input contains text`);case`stopped`:return Z(`Queued · `)+Z(`agent stopped`);case`question`:return Z(`Queued · `)+Z(`after you answer the question`);case`dialog`:return Z(`Queued · `)+Z(`will be sent when the menu closes`);case`starting`:return Z(`Queued · `)+Z(`agent starting`);case`working`:return Z(`Queued`);default:return Z(`Queued · `)+Z(`sending…`)}}B(()=>jn.value.map(e=>`${e.id}:${e.phase}`).join(`,`),()=>P(()=>J(!1))),B(()=>Dn.value&&Dn.value.lines.join(`
22
- `),()=>P(()=>J(!1)));let Xn=n(()=>{let e=s.pane;if(e.menu||e.interaction===`terminal`||!O.value||O.value===`unsupported`||!e.screen||e.status===`working`||G.value)return null;let t=$r(e.agent);return Vi(e)?{text:Q(`${t} is waiting for your answer, below or in the terminal.`,`${t} attend ta réponse, ci-dessous ou dans le terminal.`),lines:[]}:{text:Q(`${t} is waiting for an action in the terminal.`,`${t} attend une action dans le terminal.`),lines:e.screen.lines}}),Zn=n(()=>{if(G.value)return null;let e=s.pane;if(e.pendingPrompt&&e.status!==`working`)return{typing:!0,text:Q(`Your first message will be sent when ${$r(e.agent)} is ready`,`Ton premier message partira dès que ${$r(e.agent)} sera prêt`)};if(Dn.value)return{typing:!0,text:Q(`Command running…`,`Commande en cours…`)};if(e.status===`working`&&e.agent===`claude`&&e.activity)return{typing:!0,verb:!0,text:`${e.activity}…`};if(e.status===`working`&&e.agent===`omp`&&e.ompActivity){let t=e.ompActivity;return{typing:!0,omp:!0,since:t.since,text:t.step||`${$r(e.agent)} ${Q(`is working…`,`travaille…`)}`}}return e.status===`working`?{typing:!0,text:`${$r(e.agent)} ${Q(`is working…`,`travaille…`)}`}:e.status===`blocked`&&!e.menu&&!Xn.value&&!(e.prompt&&e.prompt.options)&&!Vi(e)?{typing:!1,text:Z(`Waiting for your reply — details in the Terminal tab`)}:null});B(()=>s.pane.status,()=>P(()=>J(!1)));let Y=r({q:``,hits:[],cur:-1,loading:!1}),er=!1,tr=h(null),nr=e=>e.normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase(),ir=typeof CSS<`u`&&`highlights`in CSS?CSS.highlights:null,ar=globalThis.Highlight;function cr(){ir?.delete(`hw-hit`),ir?.delete(`hw-cur`)}function lr(e,t){if(cr(),Y.hits=[],!p.value||Y.q.length<2||!x.value)return;let n=nr(Y.q),r=document.createTreeWalker(x.value,NodeFilter.SHOW_TEXT);for(let e=r.nextNode();e;e=r.nextNode()){let t=nr(e.nodeValue||``),r=0,i;for(;(i=t.indexOf(n,r))>=0;){let t=document.createRange();t.setStart(e,i),t.setEnd(e,Math.min(i+n.length,(e.nodeValue||``).length)),Y.hits.push(t),r=i+n.length}}if(t){let e=Y.hits.findIndex(e=>t.contains(e.startContainer));Y.cur=e>=0?e:0}else(e||Y.cur>=Y.hits.length)&&(Y.cur=Y.hits.length-1);ur()}function ur(){if(ir&&ar){ir.set(`hw-hit`,new ar(...Y.hits.filter((e,t)=>t!==Y.cur)));let e=Y.hits[Y.cur];e?ir.set(`hw-cur`,new ar(e)):ir.delete(`hw-cur`)}let e=Y.hits[Y.cur],t=b.value;if(e&&t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();t.scrollTo({top:t.scrollTop+n.top-r.top-t.clientHeight/2,behavior:`smooth`})}}let dr=n(()=>Y.loading?Z(`loading…`):Y.q.length<2?``:Y.hits.length?`${Y.cur+1}/${Y.hits.length}`:Z(`no results`));function fr(e){Y.hits.length&&(Y.cur=(Y.cur+e+Y.hits.length)%Y.hits.length,ur())}async function hr(){for(;C.value.olderCursor>0;){let e=C.value.olderCursor;if(await Le(),C.value.olderCursor===e)break}}let vr;function br(){clearTimeout(vr),vr=setTimeout(Mr,250)}async function Mr(){if(Y.q.trim().length<2){cr(),Y.hits=[],Y.cur=-1;return}C.value.olderCursor>0&&!G.value&&(Y.loading=!0,await hr(),Y.loading=!1),await ve(),lr(!0)}async function Pr(){let e=c.query.hit,t=c.query.q;if(typeof e!=`string`||typeof t!=`string`||!/^\d+$/.test(e))return;let n=Number(e);p.value=!0,Y.q=t,Y.loading=!0,er=!0;try{for(;C.value.olderCursor>n&&!G.value;){let e=C.value.olderCursor;if(await Le(),C.value.olderCursor>=e)break}await ve();let e=String(c.query.role||``),t=String(c.query.ts||``),r=String(c.query.prefix||``),i=T.value.findIndex(n=>n.role===e&&n.ts===t&&n.text.startsWith(r)),a=i<0?``:`${e}:${t}:${i}`,o=[...x.value?.querySelectorAll(`[data-hit-key]`)||[]].find(e=>e.dataset.hitKey===a);lr(!1,o),o&&!Y.hits.length&&o.scrollIntoView({block:`center`})}finally{er=!1,Y.loading=!1}}B(()=>c.query.hit,()=>{c.params.pane===s.pane.id&&Pr()});function Fr(){p.value=!1}B(p,e=>{e?P(()=>tr.value?.inputRef?.focus()):(Y.q=``,Y.hits=[],Y.cur=-1,cr())}),l(cr);function Ir(e){e.key===`Enter`&&(e.preventDefault(),fr(e.shiftKey?1:-1)),e.key===`Escape`&&(e.preventDefault(),Fr())}function Lr(e){Ot([e])}function Rr(){let e=tr.value?.inputRef;e?.focus(),e?.select()}let zr=n(()=>{if(G.value||at.value||s.pane.status===`blocked`||jn.value.length||Dn.value)return null;let e=ot.value.findLast(e=>e.k===`assistant`||e.k===`user`||e.k===`autopilot`||e.k===`shell`||e.k===`ompRun`);if(!e||e.k!==`assistant`||Oe(e.id)!==null)return null;let t=or(e.html);return t.questions.length+t.rows.length?{key:e.key,time:e.time,rid:e.rid,targets:t}:null}),Hr=n(()=>{let e=zr.value?Cr(zr.value.targets,At.value,zr.value.time,zr.value.rid):0;return zr.value&&e?{key:zr.value.key,count:e}:null});B(()=>Hr.value?.count||0,e=>d(`unanswered`,e),{immediate:!0}),l(()=>d(`unanswered`,0));function Ur(){let e=Hr.value?ut(Hr.value.key):null,t=At.value,n=dt(e),r=[...e?.querySelectorAll(`.q-reply, .q-trow`)||[]].find(e=>e.classList.contains(`q-trow`)?!Vr(t,Wr(e),n.time,n.id):!Dr(t,ft(e)));if(!r)return;let i=r.classList.contains(`q-trow`)?[r]:[...Ct(r)];(i[0]||r).scrollIntoView({block:`center`,behavior:Mi.value?`auto`:`smooth`});for(let e of i)e.classList.remove(`q-flash`),e.offsetWidth,e.classList.add(`q-flash`),setTimeout(()=>e.classList.remove(`q-flash`),1700);X()}return t({scrollToEnd:J,reload:()=>setTimeout(Ie,400),focusSearch:Rr,gotoUnanswered:Ur}),(t,n)=>{let r=$t,i=_t,o=fn,s=Ke,c=Ba,l=Ka,u=Qa,h=ao,S=_o,w=yo,D=ra,P=wo,B=mt,U=as,q=cs,ne=ms,J=So,ie=jo,ae=vs,oe=Yt,se=_c,le=Gt;return _(),v(k,null,[p.value?(_(),v(`div`,_l,[E(r,{ref_key:`searchInput`,ref:tr,modelValue:f(Y).q,"onUpdate:modelValue":[n[0]||=e=>f(Y).q=e,br],type:`search`,enterkeyhint:`search`,autocomplete:`off`,icon:`i-lucide-search`,variant:`none`,placeholder:(`t`in t?t.t:f(Z))(`Search the conversation`),class:`flex-1 min-w-0`,onKeydown:Ir},null,8,[`modelValue`,`placeholder`]),I(`span`,vl,M(f(dr)),1),E(i,{icon:`i-lucide-chevron-up`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Z))(`Previous`),onClick:n[1]||=e=>fr(-1)},null,8,[`aria-label`]),E(i,{icon:`i-lucide-chevron-down`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Z))(`Next`),onClick:n[2]||=e=>fr(1)},null,8,[`aria-label`]),E(i,{icon:`i-lucide-x`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Z))(`Close`),onClick:Fr},null,8,[`aria-label`])])):g(``,!0),I(`div`,yl,[f(G)||(`netDown`in t?t.netDown:f(wr))?(_(),m(o,{key:0,label:f(G)?(`t`in t?t.t:f(Z))(`Offline reading`):void 0,at:f(V)},null,8,[`label`,`at`])):f(ml)(f(L))?(_(),m(o,{key:1,label:(`t`in t?t.t:f(Z))(`Conversation not up to date — reconnecting…`)},null,8,[`label`])):g(``,!0),f(ee)&&f(V)?(_(),v(`span`,bl,M((`tl`in t?t.tl:f(Q))(`Read at ${(`fmtTime`in t?t.fmtTime:f(Tr))(f(V))}`,`Lu à ${(`fmtTime`in t?t.fmtTime:f(Tr))(f(V))}`)),1)):g(``,!0),I(`div`,{ref_key:`box`,ref:b,class:`chat`,onScrollPassive:ue,onWheelPassive:ce,onTouchmovePassive:ce},[E(ae,{status:f(at)?`streaming`:`ready`,"should-auto-scroll":!1,"auto-scroll":{color:`neutral`,variant:`outline`},"auto-scroll-icon":`i-lucide-arrow-down`,ui:{root:`chat-msgs`,viewport:`hw-jump-vp`,autoScroll:`hw-jump`}},{default:H(()=>[I(`div`,{ref_key:`listEl`,ref:x,class:j([`chat-list`,[f(G)?`no-reply`:`rs-${`replyStyle`in t?t.replyStyle:f(ni)}`,{asking:f(zr),skeleton:f(K)}]]),onClick:nn,onKeydown:Sn},[f(O)&&f(Xn)?(_(),v(`div`,xl,[E(s,{name:`i-lucide-square-terminal`,class:`chat-empty-icon`}),I(`p`,null,M(f(Xn).text),1),f(Xn).lines.length?(_(),v(`pre`,Sl,M(f(Xn).lines.join(`
23
- `)),1)):g(``,!0),E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-square-terminal`,onClick:n[3]||=e=>d(`gotoTerm`)},{default:H(()=>[a(M((`t`in t?t.t:f(Z))(`View terminal`)),1)]),_:1})])):f(O)===`no_integration`&&f(A)?(_(),v(`div`,Cl,[E(s,{name:`i-lucide-plug-zap`,class:`chat-empty-icon`}),I(`p`,wl,M((`tl`in t?t.tl:f(Q))(`Herdr's ${(`kindLabel`in t?t.kindLabel:f($r))(f(A).agent)} integration is missing`,`L’intégration ${(`kindLabel`in t?t.kindLabel:f($r))(f(A).agent)} de Herdr manque`)),1),I(`p`,Tl,M(f(A).machine?(`tl`in t?t.tl:f(Q))(`Without it, wherdr cannot find this agent's conversation. Run this in a terminal on ${f(A).machine}, then restart the agent:`,`Sans elle, wherdr ne retrouve pas la conversation de cet agent. Lance cette commande dans un terminal de ${f(A).machine}, puis relance l’agent :`):(`tl`in t?t.tl:f(Q))(`Without it, wherdr cannot find this agent's conversation. Run this in a terminal on the agent's machine, then restart the agent:`,`Sans elle, wherdr ne retrouve pas la conversation de cet agent. Lance cette commande dans un terminal de la machine de l’agent, puis relance l’agent :`)),1),I(`code`,El,M(f(A).command),1),I(`div`,Dl,[E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-copy`,onClick:Me},{default:H(()=>[a(M((`t`in t?t.t:f(Z))(`Copy command`)),1)]),_:1}),E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-square-terminal`,onClick:n[4]||=e=>d(`gotoTerm`)},{default:H(()=>[a(M((`t`in t?t.t:f(Z))(`View terminal`)),1)]),_:1})])])):f(O)?(_(),v(`div`,Ol,[E(s,{name:`i-lucide-message-square-dashed`,class:`chat-empty-icon`}),I(`p`,null,M(f(O)===`not_found`?(`t`in t?t.t:f(Z))(`No conversation for this agent yet.`):(`t`in t?t.t:f(Z))(`Conversation unavailable for this agent.`)),1),E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-square-terminal`,onClick:n[5]||=e=>d(`gotoTerm`)},{default:H(()=>[a(M((`t`in t?t.t:f(Z))(`View terminal`)),1)]),_:1})])):(_(),v(k,{key:3},[f(K)?(_(),m(c,{key:0,agent:e.pane.agent},null,8,[`agent`])):f(fe)?(_(),v(k,{key:1},[],64)):f(C).olderCursor>0?(_(),v(`div`,kl,[E(i,{size:`xs`,color:`neutral`,variant:`outline`,class:`mono-btn`,loading:f(z),icon:`i-lucide-arrow-up`,onClick:Le},{default:H(()=>[a(M((`t`in t?t.t:f(Z))(`Load earlier messages`)),1)]),_:1},8,[`loading`])])):f(C).older.length?(_(),v(`div`,Al,M((`t`in t?t.t:f(Z))(`Start of conversation`)),1)):g(``,!0),(_(!0),v(k,null,y(f(K)?[]:f(pe),r=>(_(),v(k,{key:r.key},[r.k===`day`?(_(),v(`div`,jl,[I(`span`,null,M(r.label),1)])):r.k===`who`?(_(),v(`div`,{key:1,class:j([`msg-who`,e.pane.agent||``])},[E(s,{name:(`agentIcon`in t?t.agentIcon:f(Xt))(e.pane.agent)||`i-lucide-bot`},null,8,[`name`]),I(`span`,null,M((`kindLabel`in t?t.kindLabel:f($r))(e.pane.agent)),1)],2)):r.k===`autopilot`?(_(),m(l,{key:2,text:r.text,"data-hit-key":r.key,onCopy:f(tn)},null,8,[`text`,`data-hit-key`,`onCopy`])):r.k===`user`?(_(),v(`div`,{key:3,class:`msg-user-wrap`,"data-hit-key":r.key},[r.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Z))(`Show original message`),onClick:e=>Qt(r.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),I(`span`,Pl,M(r.reply.time),1),I(`span`,Fl,M(r.reply.excerpt),1)],8,Nl)):g(``,!0),E(w,{id:r.key,role:`user`,side:`right`,variant:`soft`,parts:[...r.srcs.map(e=>({type:`file`,mediaType:`image/jpeg`,url:e})),...r.text||r.files.length?[{type:`text`,text:r.text||` `}]:[]],ui:{root:r.text.trim()||r.files.length?`msg msg-user`:`msg msg-user msg-no-text`,container:`msg-c`,content:`msg-bubble`,header:`msg-files`}},{files:H(()=>[E(u,{srcs:r.srcs,offline:f(G)},null,8,[`srcs`,`offline`])]),content:H(()=>[r.files.length?(_(),v(`span`,Il,[(_(!0),v(k,null,y(r.files,e=>(_(),m(h,{key:e.path,name:e.name,clickable:``,onOpen:t=>_n(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(S,{text:r.text,pasted:r.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),r.time?(_(),v(`div`,{key:1,class:`msg-time`,title:r.at||void 0},M(r.time),9,Ll)):g(``,!0)],8,Ml)):r.k===`assistant`?(_(),v(k,{key:4},[E(w,{id:r.key,role:`assistant`,side:`left`,variant:`naked`,"data-hit-key":r.key,parts:[{type:`text`,text:r.text}],ui:{root:`msg msg-ai tw-${e.pane.agent||`agent`}${f(te)?` can-run`:``}${f(Dt)===r.key?` q-picking`:``}`,container:`msg-c`,content:`md`}},{content:H(()=>[E(D,{html:r.html,typing:Oe(r.id),onDone:e=>ke(r.id)},null,8,[`html`,`typing`,`onDone`])]),_:2},1032,[`id`,`data-hit-key`,`parts`,`ui`]),(`replyStyle`in t?t.replyStyle:f(ni))===`list`&&!f(G)&&Oe(r.id)===null&&(f(or)(r.html).questions.length||f(or)(r.html).pick)?(_(),v(`div`,Rl,[f(or)(r.html).questions.length?(_(),v(k,{key:0},[I(`p`,zl,M((`tl`in t?t.tl:f(Q))(`Questions · reply to`,`Questions · répondre à`)),1),(_(!0),v(k,null,y(f(or)(r.html).questions,e=>(_(),v(`div`,{key:e.n,class:`q-line`},[I(`button`,{type:`button`,class:j([`q-row`,{quoted:f(Dr)(f(At),f(ti)(e.text,r.time,r.rid))}]),"aria-label":`${(`t`in t?t.t:f(Z))(`Reply`)}: ${e.text}`,onClick:t=>ht(f(ti)(e.text,r.time,r.rid)),onMouseenter:t=>jt(r.key,e.n,!0),onMouseleave:t=>jt(r.key,e.n,!1),onFocus:t=>jt(r.key,e.n,!0),onBlur:t=>jt(r.key,e.n,!1)},[I(`b`,null,M(f(Dr)(f(At),f(ti)(e.text,r.time,r.rid))?`✓`:e.n),1),I(`span`,null,M(e.text),1),I(`i`,null,[n[14]||=a(`↳`,-1),I(`em`,null,M(f(Dr)(f(At),f(ti)(e.text,r.time,r.rid))?(`t`in t?t.t:f(Z))(`Quoted`):(`t`in t?t.t:f(Z))(`Reply`)),1)])],42,Bl),e.closed?(_(),v(k,{key:0},y([`yes`,`no`],t=>I(`button`,{key:t,type:`button`,class:`q-row-ans`,"aria-pressed":xt(f(ti)(e.text,r.time,r.rid),t),"aria-label":`${gt(t)}: ${e.text}`,onClick:n=>yt(f(ti)(e.text,r.time,r.rid),t,n.detail>0)},M(gt(t)),9,Vl)),64)):g(``,!0)]))),128))],64)):g(``,!0),f(or)(r.html).pick?(_(),v(`button`,{key:1,type:`button`,class:`q-pick`,"aria-pressed":f(Dt)===r.key,onClick:e=>Dt.value=f(Dt)===r.key?null:r.key},M(f(Dt)===r.key?(`tl`in t?t.tl:f(Q))(`Pick the point to quote · Cancel`,`Choisis le point à citer · Annuler`):(`tl`in t?t.tl:f(Q))(`+ Quote a point`,`+ Citer un point`)),9,Hl)):g(``,!0)])):g(``,!0),!r.endsTurn&&!f(G)?(_(),v(`div`,Ul,[I(`button`,{type:`button`,class:`msg-reply`,onClick:e=>pt(r.key)},[E(s,{name:`i-lucide-reply`}),I(`span`,null,M((`t`in t?t.t:f(Z))(`Reply`)),1)],8,Wl)])):g(``,!0)],64)):r.k===`thinking`?(_(),m(P,{key:5,class:`omp-thinking`,text:r.text,streaming:Ae(r.id)!==null,duration:r.ms===void 0?void 0:Math.max(1,Math.round(r.ms/1e3)),"auto-close-delay":450,ui:{root:`omp-thinking`,trigger:`omp-thinking-head`,label:`omp-thinking-label`,content:`omp-thinking-content`,body:`omp-thinking-body`}},{default:H(()=>[E(D,{class:`md`,html:r.html,typing:Ae(r.id),speed:(`reducedMotion`in t?t.reducedMotion:f(Mi))?`off`:`fast`,cipher:!1,onDone:e=>je(r.id)},null,8,[`html`,`typing`,`speed`,`onDone`])]),_:2},1032,[`text`,`streaming`,`duration`])):r.k===`job`?(_(),v(`div`,{key:6,class:j([`omp-job`,{err:r.error,open:ct(r.key)}])},[I(`button`,{type:`button`,class:`omp-job-head`,disabled:!r.out,"aria-expanded":r.out?ct(r.key):void 0,onClick:e=>lt(r.key,!ct(r.key))},[I(`span`,Kl,M(r.error?`✗`:`✓`),1),I(`span`,ql,M((`tl`in t?t.tl:f(Q))(`Background job completed`,`Tâche de fond terminée`)),1),I(`code`,null,`[`+M(r.tool)+`] `+M(r.id),1),r.ms===void 0?g(``,!0):(_(),v(`span`,Jl,M(f(No)(r.ms)),1)),r.out?(_(),m(s,{key:1,name:ct(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`])):g(``,!0)],8,Gl),r.out&&ct(r.key)?(_(),v(`div`,Yl,[I(`div`,Xl,[I(`span`,Zl,M(r.error?(`tl`in t?t.tl:f(Q))(`Error`,`Erreur`):(`tl`in t?t.tl:f(Q))(`Output`,`Sortie`)),1),r.ms===void 0?g(``,!0):(_(),v(`span`,Ql,`wall `+M(f(No)(r.ms)),1))]),I(`pre`,null,M(r.out),1)])):g(``,!0)],2)):r.k===`shell`?(_(),v(`div`,{key:7,class:j([`msg-shell`,{bash:r.bash,long:r.long,open:ct(r.key)}])},[I(`div`,$l,[I(`span`,eu,M(r.bash?`!`:`❯`),1),I(`code`,null,M(r.text),1),E(B,{text:(`t`in t?t.t:f(Z))(`Copy command`),disabled:!(`desk`in t?t.desk:f(Hi))},{default:H(()=>[E(i,{icon:`i-lucide-copy`,color:`neutral`,variant:`ghost`,size:`xs`,class:`msg-shell-copy`,"aria-label":(`t`in t?t.t:f(Z))(`Copy command`),onClick:e=>f(tn)(r.bash?`!${r.text}`:r.text)},null,8,[`aria-label`,`onClick`])]),_:2},1032,[`text`,`disabled`])]),r.out||r.err?(_(),v(`div`,tu,[r.out?(_(),v(`pre`,nu,M(r.out),1)):g(``,!0),r.err?(_(),v(`pre`,ru,M(r.err),1)):g(``,!0)])):r.bash?(_(),v(`div`,iu,M((`t`in t?t.t:f(Z))(`No output`)),1)):g(``,!0),r.long?(_(),v(`button`,{key:2,type:`button`,class:`msg-shell-more`,"aria-expanded":ct(r.key),onClick:e=>lt(r.key,!ct(r.key))},[E(s,{name:ct(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),I(`span`,null,M(ct(r.key)?(`t`in t?t.t:f(Z))(`Collapse`):(`tl`in t?t.tl:f(Q))(`Show all · ${r.lines} lines`,`Tout afficher · ${r.lines} lignes`)),1)],8,au)):g(``,!0)],2)):r.k===`ompRun`?(_(),v(`div`,ou,[I(`div`,su,[I(`span`,cu,M(r.tool.omp.title===`Python`?`$`:`!`),1),I(`span`,null,M((`tl`in t?t.tl:f(Q))(`You ran`,`Lancé par toi`)),1)]),E(U,{tool:r.tool,run:``},null,8,[`tool`])])):r.k===`system`?(_(),v(`div`,lu,[I(`span`,null,M(r.text),1)])):r.k===`notice`?(_(),v(`div`,{key:10,class:j([`msg-notice`,{long:r.long,open:ct(r.key),scheduled:r.scheduled}])},[I(`div`,uu,[E(s,{name:r.icon},null,8,[`name`]),I(`span`,null,M(r.label),1)]),E(D,{class:`msg-notice-body md`,html:r.html,typing:null},null,8,[`html`]),r.long?(_(),v(`button`,{key:0,type:`button`,class:`msg-shell-more`,"aria-expanded":ct(r.key),onClick:e=>lt(r.key,!ct(r.key))},[E(s,{name:ct(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),I(`span`,null,M(ct(r.key)?(`t`in t?t.t:f(Z))(`Collapse`):(`t`in t?t.t:f(Z))(`Show all`)),1)],8,du)):g(``,!0)],2)):r.k===`turn`?(_(),v(`div`,fu,[r.copy?(_(),m(B,{key:0,text:(`t`in t?t.t:f(Z))(`Copy reply`),disabled:!(`desk`in t?t.desk:f(Hi))},{default:H(()=>[E(i,{icon:`i-lucide-copy`,color:`neutral`,variant:`ghost`,size:`xs`,class:`turn-copy`,"aria-label":(`t`in t?t.t:f(Z))(`Copy reply`),onClick:e=>f(tn)(r.copy)},null,8,[`aria-label`,`onClick`])]),_:2},1032,[`text`,`disabled`])):g(``,!0),r.reply&&!f(G)?(_(),v(`button`,{key:1,type:`button`,class:`msg-reply`,onClick:e=>pt(r.reply)},[E(s,{name:`i-lucide-reply`}),I(`span`,null,M((`t`in t?t.t:f(Z))(`Reply`)),1)],8,pu)):g(``,!0),I(`span`,null,M(r.text),1)])):r.k===`tools`&&f(Vo)(r.list)?(_(),v(`div`,{key:12,class:j([`tools omp-console`,{live:r.live}])},[n[16]||=I(`span`,{class:`fx-ring omp-ring`,"aria-hidden":`true`},[I(`span`,{class:`fx-spin`})],-1),I(`div`,mu,[n[15]||=I(`span`,{class:`omp-console-title`},`omp`,-1),I(`span`,null,M(r.list.length)+` `+M((`t`in t?t.t:f(Z))(`actions`)),1),f(Bo)(r.list)?(_(),v(`span`,hu,`Σ `+M(f(No)(f(Bo)(r.list))),1)):g(``,!0)]),Ze(r).hidden||r.list.length>f(3)&&ct(r.key)?(_(),v(`button`,{key:0,type:`button`,class:`omp-console-more`,"aria-expanded":ct(r.key),onClick:e=>lt(r.key,!ct(r.key))},[Ze(r).hidden?(_(),v(k,{key:0},[a(`⋯ `+M((`tl`in t?t.tl:f(Q))(`${Ze(r).hidden} earlier actions`,`${Ze(r).hidden} actions avant`)),1)],64)):(_(),v(k,{key:1},[a(`⋯ `+M((`t`in t?t.t:f(Z))(`Collapse`)),1)],64))],8,gu)):g(``,!0),(_(!0),v(k,null,y(nt(r),(e,t)=>(_(),m(u,{key:`h${t}`,class:`tool-thumbs`,srcs:e,max:ad,offline:f(G),dupes:f(tt)},null,8,[`srcs`,`offline`,`dupes`]))),128)),(_(!0),v(k,null,y(Ze(r).rows,(e,t)=>(_(),v(k,{key:`${r.key}:${r.list.length-Ze(r).rows.length+t}`},[E(U,{tool:{...e,omp:e.omp},live:r.live&&e===r.list[r.list.length-1]},null,8,[`tool`,`live`]),e.images?(_(),m(u,{key:0,class:`tool-thumbs`,srcs:et(e),max:ad,offline:f(G),dupes:f(tt)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128))],2)):r.k===`tools`?(_(),v(`div`,{key:13,class:j([`tools`,{live:r.live}])},[r.list.length<=3?(_(!0),v(k,{key:0},y(r.list,(e,t)=>(_(),v(k,{key:t},[E(q,{text:Je(e),suffix:Ge(e),icon:Ye(e),loading:r.live&&t===r.list.length-1,streaming:r.live&&t===r.list.length-1,ui:{root:`tool`,trigger:`tool-trigger`,label:`tool-label`,suffix:`tool-suffix`,leading:`tool-leading`},class:j({err:e.error})},null,8,[`text`,`suffix`,`icon`,`loading`,`streaming`,`class`]),e.images?(_(),m(u,{key:0,class:`tool-thumbs`,srcs:et(e),max:ad,offline:f(G),dupes:f(tt)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128)):(_(),m(q,{key:1,open:ct(r.key),text:`${r.list.length} ${(`t`in t?t.t:f(Z))(`actions`)}`,suffix:Xe(r.list[r.list.length-1]),icon:r.live?void 0:`i-lucide-layers`,loading:r.live,streaming:r.live,chevron:`trailing`,ui:{root:`tool group`,trigger:`tool-trigger`,label:`tool-label`,suffix:`tool-suffix`,leading:`tool-leading`,body:`tool-body`,trailingIcon:`tool-chev`},"onUpdate:open":e=>lt(r.key,e)},{default:H(()=>[(_(!0),v(k,null,y(r.list,(e,t)=>(_(),v(k,{key:t},[I(`div`,{class:j([`tool-row`,{err:e.error}])},[E(s,{name:Ye(e)},null,8,[`name`]),I(`b`,null,M(Je(e)),1),I(`span`,null,M(Ge(e)),1)],2),e.images?(_(),m(u,{key:0,class:`tool-thumbs`,srcs:et(e),max:ad,offline:f(G),dupes:f(tt)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128))]),_:2},1032,[`open`,`text`,`suffix`,`icon`,`loading`,`streaming`,`onUpdate:open`])),(_(!0),v(k,null,y(nt(r),(e,t)=>(_(),m(u,{key:`h${t}`,class:`tool-thumbs`,srcs:e,max:ad,offline:f(G),dupes:f(tt)},null,8,[`srcs`,`offline`,`dupes`]))),128))],2)):g(``,!0)],64))),128)),f(R)&&!f(T).length&&!f(F)?(_(),v(`div`,_u,[E(s,{name:`i-lucide-message-square-dashed`,class:`chat-empty-icon`}),I(`p`,null,M((`t`in t?t.t:f(Z))(`No messages yet.`)),1)])):g(``,!0),f(F)?(_(),v(`div`,vu,[I(`p`,null,M(f(F)),1)])):g(``,!0)],64))],34),(_(),m(W,{to:`body`},[f(Ft)?(_(),v(`button`,{key:0,ref_key:`selBtn`,ref:It,type:`button`,class:`sel-reply`,style:N({top:`${f(Ft).top}px`,left:`${f(Ft).left}px`}),"aria-label":(`t`in t?t.t:f(Z))(`Reply to this passage`),onPointerdown:n[6]||=re(()=>{},[`prevent`]),onMousedown:n[7]||=re(()=>{},[`prevent`]),onClick:n[8]||=e=>ht(f(ti)(f(Ft).text,f(Ft).time,f(Ft).id))},[E(s,{name:`i-lucide-reply`}),I(`span`,null,M((`t`in t?t.t:f(Z))(`Reply`)),1)],44,yu)):g(``,!0)])),f(jn).length||f(Dn)||f(En)?.sendNow?(_(),v(`div`,bu,[!f(G)&&f(En)?.sendNow?(_(),v(`div`,xu,[I(`button`,{type:`button`,class:`queued-cancel`,disabled:f(Mn),onClick:Nn},M((`t`in t?t.t:f(Z))(`Send now`)),9,Su)])):g(``,!0),(_(!0),v(k,null,y(f(jn).filter(e=>e.phase===`sent`),e=>(_(),v(`div`,{key:e.id,class:`msg-user-wrap`},[e.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Z))(`Show original message`),onClick:t=>Qt(e.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),I(`span`,wu,M(e.reply.time),1),I(`span`,Tu,M(e.reply.excerpt),1)],8,Cu)):g(``,!0),E(w,{id:`q:${e.id}`,role:`user`,side:`right`,variant:`soft`,parts:Pn(e),ui:{root:`msg msg-user msg-pending sent${e.body||e.files.length?``:` msg-no-text`}`,container:`msg-c`,content:`msg-bubble`,header:`msg-files`}},{files:H(()=>[e.srcs.length?(_(),m(u,{key:0,srcs:e.srcs},null,8,[`srcs`])):g(``,!0),(_(!0),v(k,null,y(e.missing,e=>(_(),v(`span`,{key:e,class:`thumb-missing`,title:(`t`in t?t.t:f(Z))(`Image`)},[E(s,{name:`i-lucide-image`})],8,Eu))),128))]),content:H(()=>[e.files.length?(_(),v(`span`,Du,[(_(!0),v(k,null,y(e.files,e=>(_(),m(h,{key:e.path,name:e.name,clickable:``,onOpen:t=>_n(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(S,{text:e.body,pasted:e.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),I(`div`,Ou,[E(s,{name:`i-lucide-check`}),I(`span`,null,M((`t`in t?t.t:f(Z))(`Sent · read by the agent`)),1)])]))),128)),f(Dn)?(_(),v(`div`,ku,[I(`div`,Au,[I(`div`,ju,[I(`span`,Mu,M(e.pane.agent===`omp`?f(Dn).python?`>>>`:`$`:`!`),1),I(`code`,null,M(f(Dn).command),1)]),f(Dn).lines.length?(_(),v(`div`,Nu,[f(Dn).hidden?(_(),v(`div`,Pu,M((`tl`in t?t.tl:f(Q))(`+ ${f(Dn).hidden} lines above`,`+ ${f(Dn).hidden} lignes au-dessus`)),1)):g(``,!0),I(`pre`,Fu,M(f(Dn).lines.join(`
24
- `)),1)])):(_(),v(`div`,Iu,M((`t`in t?t.t:f(Z))(`No output yet`)),1))]),I(`div`,Lu,[E(s,{name:`i-lucide-loader-circle`,class:`spin`}),I(`span`,null,[a(M((`t`in t?t.t:f(Z))(`Running`)),1),f(An)?(_(),v(k,{key:0},[a(` · `+M(f(An)),1)],64)):g(``,!0)])])])):g(``,!0),(_(!0),v(k,null,y(f(jn).filter(e=>e.phase===`queued`),r=>(_(),v(`div`,{key:r.id,class:`msg-user-wrap`},[r.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Z))(`Show original message`),onClick:e=>Qt(r.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),I(`span`,zu,M(r.reply.time),1),I(`span`,Bu,M(r.reply.excerpt),1)],8,Ru)):g(``,!0),E(w,{id:`q:${r.id}`,role:`user`,side:`right`,variant:`soft`,parts:Pn(r),ui:{root:`msg msg-user msg-pending queued${r.body||r.files.length?``:` msg-no-text`}`,container:`msg-c`,content:`msg-bubble queued`,header:`msg-files`}},{files:H(()=>[r.srcs.length?(_(),m(u,{key:0,srcs:r.srcs},null,8,[`srcs`])):g(``,!0),(_(!0),v(k,null,y(r.missing,e=>(_(),v(`span`,{key:e,class:`thumb-missing`,title:(`t`in t?t.t:f(Z))(`Image`)},[E(s,{name:`i-lucide-image`})],8,Vu))),128))]),content:H(()=>[r.files.length?(_(),v(`span`,Hu,[(_(!0),v(k,null,y(r.files,e=>(_(),m(h,{key:e.path,name:e.name,clickable:``,onOpen:t=>_n(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(S,{text:r.body,pasted:r.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),r.state===`failed`?(_(),v(`div`,Uu,[E(s,{name:`i-lucide-circle-alert`}),I(`span`,null,M(Kn(r.reason)),1),I(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(zn),onClick:e=>Bn(r)},[E(s,{name:f(zn)===r.id?`i-lucide-loader-circle`:`i-lucide-rotate-cw`,class:j({spin:f(zn)===r.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Z))(`Retry`)),1)],8,Wu),I(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(In),onClick:e=>Ln(r)},[E(s,{name:f(In)===r.id?`i-lucide-loader-circle`:`i-lucide-undo-2`,class:j({spin:f(In)===r.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Z))(`Cancel`)),1)],8,Gu)])):(_(),v(`div`,Ku,[E(s,{name:`i-lucide-clock`}),I(`span`,null,M(Yn(r)),1),f(Dc)(e.pane,r)?(_(),v(`button`,{key:0,type:`button`,class:`queued-cancel`,disabled:!!f(qn),onClick:e=>Jn(r)},M((`t`in t?t.t:f(Z))(`Clear and send`)),9,qu)):g(``,!0),r.state===`held`&&f(Ec)(e.pane,r)!==`working`?(_(),v(`button`,{key:1,type:`button`,class:`queued-cancel`,onClick:n[9]||=e=>d(`gotoTerm`)},M((`t`in t?t.t:f(Z))(`Open terminal`)),1)):g(``,!0),r.state!==`sending`&&(f(Fn)||r.state===`held`)&&r.raw?(_(),v(`button`,{key:2,type:`button`,class:`queued-cancel`,disabled:!!f(In),onClick:e=>Ln(r)},[E(s,{name:f(In)===r.id?`i-lucide-loader-circle`:`i-lucide-undo-2`,class:j({spin:f(In)===r.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Z))(`Cancel`)),1)],8,Ju)):g(``,!0)]))]))),128)),f(Hn)?(_(),v(`div`,Yu,[I(`p`,Xu,[E(s,{name:`i-lucide-square-terminal`}),I(`span`,null,M((`t`in t?t.t:f(Z))(`A menu is still open in the agent’s terminal. Your messages wait for it to close.`)),1)]),I(`div`,Zu,[I(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(Un),onClick:n[10]||=e=>Wn(`close`)},[E(s,{name:f(Un)===`close`?`i-lucide-loader-circle`:`i-lucide-x`,class:j({spin:f(Un)===`close`})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Z))(`Close menu`)),1)],8,Qu),I(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(Un),onClick:n[11]||=e=>Wn(`send`)},[E(s,{name:f(Un)===`send`?`i-lucide-loader-circle`:`i-lucide-send`,class:j({spin:f(Un)===`send`})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Z))(`Send anyway`)),1)],8,$u)])])):g(``,!0)])):g(``,!0),f(Zn)?(_(),v(`div`,{key:1,class:j([`chat-status`,{typing:f(Zn).typing,waiting:!f(Zn).typing}])},[`verb`in f(Zn)?(_(),v(`span`,ed,[E(ne),E(J,{text:f(Zn).text,duration:2.4,class:`claude-verb`},null,8,[`text`])])):`omp`in f(Zn)?(_(),v(`span`,td,[E(ie,{since:f(Zn).since},{default:H(()=>[E(J,{text:f(Zn).text,duration:2.4,class:`omp-step`},null,8,[`text`])]),_:1},8,[`since`])])):(_(),v(k,{key:2},[n[17]||=I(`i`,{class:`status-dot`},null,-1),f(Zn).typing?(_(),m(J,{key:0,text:f(Zn).text,duration:2.4},null,8,[`text`])):(_(),v(`span`,nd,M(f(Zn).text),1))],64))],2)):g(``,!0)]),_:1},8,[`status`])],544),(`sheetMenus`in t?t.sheetMenus:f(fi))?g(``,!0):(_(),m(oe,{key:3,open:f(un).open,"onUpdate:open":n[12]||=e=>f(un).open=e,items:f(dn),content:{align:`start`,side:`bottom`,sideOffset:4},ui:{content:`hw-dropdown`}},{default:H(()=>[I(`span`,{class:`path-anchor`,style:N({left:`${f(un).x}px`,top:`${f(un).y}px`,width:`${f(un).w}px`,height:`${f(un).h}px`}),"aria-hidden":`true`},null,4)]),_:1},8,[`open`,`items`])),E(le,{open:f(yn).open,"onUpdate:open":n[13]||=e=>f(yn).open=e,title:mn(f(aa)(f(yn).path)),wide:``,full:``,screen:``},{default:H(()=>[f(yn).open?(_(),m(se,{key:f(yn).path,"pane-id":e.pane.id,file:f(yn).path},null,8,[`pane-id`,`file`])):g(``,!0)]),_:1},8,[`open`,`title`])])],64)}}}),{__name:`ChatView`});function cd(e,t,n,r){return t===1?e*n:t===2?e*n*Math.max(1,r):e}function ld(e,t){let n=t>0?t:16,r=Math.trunc(e/n);return{lines:r,rest:e-r*n}}function ud(e,t){let n=Math.max(1,t);return Math.max(-n,Math.min(n,e))}function dd({vertical:e,momentum:t,horizontal:n,canHorizontal:r,maxMomentum:i,now:a=()=>performance.now(),frame:o=e=>requestAnimationFrame(e),cancelFrame:s=e=>cancelAnimationFrame(e)}){let c=null,l={x:0,y:0},u=0,d=null,f=0,p=[],m=0,h=()=>{m&&s(m),m=0},g=()=>{h(),c=null,f=0,d=null,p=[]};return{start(e,t){g(),c=l={x:e,y:t},u=a()},move(t,i){if(!c)return;let o=a(),s={x:t,y:i},m=t-l.x,h=i-l.y,g=Math.max(1,o-u);if(!d){let e=t-c.x,n=i-c.y;if(Math.hypot(e,n)<5)return;d=r()&&Math.abs(e)>Math.abs(n)*1.25?`x`:`y`}if(d===`x`)n(m);else{e(h,s),h&&f&&Math.sign(h)!==Math.sign(f)&&(p=[]),p.push({dy:h,dt:g});let t=0,n=p.length;for(;n>0&&t<100;)t+=p[--n].dt;p=p.slice(n);let r=p.reduce((e,t)=>e+t.dt,0);f=Math.max(-3,Math.min(3,p.reduce((e,t)=>e+t.dy,0)/Math.max(1,r)))}l=s,u=o},end(){if(!c)return!1;let n=d===null;c=null;let r=a()-u;if(d!==`y`||r>90||(f*=Math.exp(-Math.max(0,r-25)/50),Math.abs(f)<.16))return n;let s=a(),p=s,h=0,g=Math.max(0,i()),_=()=>{m=0;let n=a(),r=Math.min(40,Math.max(0,n-p));p=n,f*=Math.exp(-r/170);let i=Math.sign(f)*Math.min(Math.abs(f*r),Math.max(0,g-h));h+=Math.abs(i),i&&(t??e)(i,l),Math.abs(f)>.045&&n-s<750&&h<g&&(m=o(_))};return m=o(_),n},stopMomentum:h,cancel:g}}var fd={key:0,class:`term-loading`},pd={key:1,class:`terminal-selection-hint`},md=[`aria-label`],hd=Object.assign(T({__name:`TerminalView`,props:{ctl:{}},setup(e){let t=e,n=h(null),r=null,i=null,o=0,s=0,c=0,u=!1,d=()=>{c=0,s&&=(t.ctl.scroll(s),0)},p=e=>{s+=e,c||=requestAnimationFrame(d)};function m(e){r=e.touches[0].clientY,i=e.touches[0].clientX,o=0,u=!1}function y(e){if(e.preventDefault(),r===null)return;let a=e.touches[0].clientY,s=e.touches[0].clientX,c=i===null?0:s-i,l=a-r;i=s;let d=n.value?.querySelector(`.xterm`);if(d&&d.scrollWidth>d.clientWidth&&Math.abs(c)>Math.abs(l)){d.scrollLeft-=c,r=a,u=!0;return}o+=l,r=a;let{lines:f,rest:m}=ld(o,t.ctl.rowHeight());o=m,f&&(u=!0,p(f))}function b(e){let n=e.changedTouches[0];r=null,i=null,u||(n&&(t.ctl.tapLink(n.clientX,n.clientY)?e.preventDefault():t.ctl.tapMouse(n.clientX,n.clientY)),t.ctl.blur(),document.activeElement?.blur?.())}function x(){t.ctl.focus()}function S(e){e.preventDefault(),e.stopPropagation();let r=n.value?.querySelector(`.xterm`);if(r&&r.scrollWidth>r.clientWidth&&(e.shiftKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))){r.scrollLeft+=e.shiftKey?e.deltaY:e.deltaX;return}let i=t.ctl.rowHeight();o-=cd(e.deltaY,e.deltaMode,i,t.ctl.pageRows());let{lines:a,rest:s}=ld(o,i);o=s,a&&p(a)}let C=0,T=0,E=0,D=0,O=0,k=0,A,N=0,F=0,L=-1/0,R=-1/0,z=!1,V=!1,H=!1,U=()=>n.value?.querySelector(`.xterm-screen`),W=()=>{let e=U();if(!e)return;let n=Ri.value?ud(C+(T+E)*t.ctl.rowHeight(),t.ctl.rowHeight()):0;e.style.willChange=n?`transform`:``,e.style.transform=n?`translate3d(0, ${n}px, 0)`:``};function G(){H&&(clearTimeout(A),A=setTimeout(()=>{E=T=C=0,cancelAnimationFrame(O),O=0,t.ctl.cancelTouchScroll(),W()},180))}function ee(){if(O=0,!T)return;let e=T;T=0,t.ctl.scroll(e,N,F,0,!0)?E+=e:E=C=0,W(),G()}B(t.ctl.scrollAck,(e,t)=>{let n=e-t;n&&Ri.value&&(Math.sign(n)===Math.sign(E)&&(E-=Math.sign(n)*Math.min(Math.abs(n),Math.abs(E))),cancelAnimationFrame(k),k=requestAnimationFrame(()=>{k=0,W()}))},{flush:`sync`});let K=()=>n.value?.querySelector(`.xterm`),te=dd({vertical(e,n){R=performance.now(),E&&Math.sign(e)!==Math.sign(E)&&(t.ctl.cancelTouchScroll(),E=T=C=0),N=n.x,F=n.y,C+=e;let{lines:r,rest:i}=ld(C,t.ctl.rowHeight());C=i,T+=r,H=!0,r&&!O&&(O=requestAnimationFrame(ee)),W(),G()},momentum(e,n){R=performance.now(),D+=e;let{lines:r,rest:i}=ld(D,t.ctl.rowHeight());D=i,r&&t.ctl.scroll(r,n.x,n.y,0,!0,!1)},horizontal(e){R=performance.now();let t=K();t&&(t.scrollLeft-=e)},canHorizontal:()=>{let e=K();return!!e&&e.scrollWidth>e.clientWidth},maxMomentum:()=>t.ctl.rowHeight()*t.ctl.pageRows()*1.5});function q(){te.cancel(),cancelAnimationFrame(O),O=0,cancelAnimationFrame(k),k=0,clearTimeout(A),T=E=D=C=0,H&&t.ctl.cancelTouchScroll(),H=!1,W()}B(t.ctl.scrollInputVersion,q),B(qr,e=>{e||q()}),B(Ri,()=>{q(),cancelAnimationFrame(c),c=0,s=o=0,i=r=null},{flush:`sync`});function ne(e){if(!Ri.value)return m(e);L=performance.now(),z=L-R<700,V=!1,q(),e.touches.length===1&&te.start(e.touches[0].clientX,e.touches[0].clientY)}function J(e){if(!Ri.value)return y(e);if(e.preventDefault(),e.touches.length!==1){q();return}te.move(e.touches[0].clientX,e.touches[0].clientY)}function ie(e){if(!Ri.value)return b(e);L=performance.now();let n=e.changedTouches[0];V=te.end()&&!z,V?(n&&(t.ctl.tapLink(n.clientX,n.clientY)?(V=!1,e.preventDefault()):t.ctl.tapMouse(n.clientX,n.clientY)),t.ctl.blur(),document.activeElement?.blur?.()):e.preventDefault(),G()}function ae(e){if(!Ri.value)return x();let n=e.sourceCapabilities?.firesTouchEvents;(n||n===void 0&&performance.now()-L<700)&&!V||(V=!1,t.ctl.focus())}function oe(e){Ri.value&&q(),S(e)}let se;function ce(){Ri.value&&q(),!se&&(se=setTimeout(()=>{se=void 0,t.ctl.fitNow(!0)},50))}B(An,ce);let le=null;return w(()=>{document.addEventListener(`pointerdown`,q,!0),t.ctl.mount(n.value),P(()=>{t.ctl.fitNow(!1),t.ctl.hasBanner()||t.ctl.connect(!1)}),le=new ResizeObserver(ce),le.observe(n.value)}),l(()=>{document.removeEventListener(`pointerdown`,q,!0),q(),le?.disconnect(),clearTimeout(se),cancelAnimationFrame(c),t.ctl.dispose()}),(t,r)=>(_(),v(`div`,{id:`termWrap`,class:j({"smooth-touch":`smoothTouchScrolling`in t?t.smoothTouchScrolling:f(Ri)}),onWheelCapture:oe},[I(`div`,{id:`term`,ref_key:`host`,ref:n},null,512),I(`div`,{id:`touch`,"aria-hidden":`true`,onTouchstartPassive:ne,onTouchmove:J,onTouchend:ie,onTouchcancel:q,onMousedown:re(ae,[`prevent`])},null,32),e.ctl.loading.value?(_(),v(`div`,fd,[...r[1]||=[I(`span`,{class:`spinner`},null,-1)]])):g(``,!0),e.ctl.selectionHint.visible.value?(_(),v(`div`,pd,[a(M((`tl`in t?t.tl:f(Q))(`Shift + drag to select`,`Shift + glisser pour sélectionner`))+` `,1),I(`button`,{type:`button`,"aria-label":(`t`in t?t.t:f(Z))(`Hide`),onClick:r[0]||=t=>e.ctl.selectionHint.dismiss()},`×`,8,md)])):g(``,!0)],34))}}),{__name:`TerminalView`}),gd=[`ctrl`,`alt`,`shift`];function _d(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function vd(e,t){let n=(e===`+`?`plus`:e).toLowerCase().split(`+`),r=n.pop(),i=new Set([...t,...n]);return[...gd.filter(e=>i.has(e)),r].join(`+`)}var yd={"\r":`enter`,"\n":`enter`," ":`tab`,"\x1B":`esc`,"":`backspace`,"\b":`backspace`," ":`space`,"\x1B[A":`up`,"\x1B[B":`down`,"\x1B[C":`right`,"\x1B[D":`left`,"\x1BOA":`up`,"\x1BOB":`down`,"\x1BOC":`right`,"\x1BOD":`left`,"\x1B[Z":`shift+tab`};function bd(e){if(Object.hasOwn(yd,e))return yd[e];if(/^[!-~]$/.test(e)){if(e===`+`)return`plus`;let t=e.toLowerCase();return t===e?t:`shift+${t}`}if(e.length===1){let t=e.charCodeAt(0);if(t===0)return`ctrl+space`;if(t>=1&&t<=26)return`ctrl+${String.fromCharCode(t+96)}`}return null}function xd(){let e=!1,t=!1;return{start(){e=!0,t=!1},end(){e=!1,t=!0},keydown(n){!e&&!n?.isComposing&&n?.keyCode!==229&&(t=!1)},get active(){return e},takeEnded(){let e=t;return t=!1,e}}}var Sd=[`aria-label`],Cd=[`aria-label`,`aria-pressed`,`onClick`],wd=[`onClick`],Td=[`aria-label`],Ed=Object.assign(ca(T({__name:`Keybar`,props:{ctl:{},allDigits:{type:Boolean}},setup(e){let t=e,r={ctrl:`Ctrl`,alt:`Alt`,shift:`Shift`},i=n(()=>t.ctl.virtualModifiers.value);function a(e){X(),t.ctl.toggleModifier(e)}let o=[{key:`esc`,label:`esc`},{key:`enter`,label:`⏎`,cls:`wide`},{key:`up`,label:`↑`},{key:`down`,label:`↓`},{key:`1`,label:`1`},{key:`2`,label:`2`},{key:`3`,label:`3`},{key:`tab`,label:`tab`},{key:`shift+tab`,label:`⇧tab`},{key:`left`,label:`←`},{key:`right`,label:`→`},{key:`ctrl+c`,label:`^C`,cls:`danger`},{key:`backspace`,label:`⌫`},{key:`y`,label:`y`},{key:`n`,label:`n`}],s=n(()=>t.allDigits?[...o.slice(0,7),...[`4`,`5`,`6`,`7`,`8`,`9`,`0`].map(e=>({key:e,label:e})),...o.slice(7)]:o);function c(e){X(),t.ctl.sendVirtualKey(e)}function l(){t.ctl.hasFocus()?t.ctl.blur():t.ctl.focus()}return(t,n)=>{let o=Ke;return _(),v(`div`,{class:`keybar`,role:`toolbar`,"aria-label":(`t`in t?t.t:f(Z))(`Keys`)},[(_(!0),v(k,null,y(f(gd),e=>(_(),v(`button`,{key:e,type:`button`,class:`key-modifier`,"aria-label":(`t`in t?t.t:f(Z))(r[e]),"aria-pressed":f(i).includes(e),onPointerdown:n[0]||=re(()=>{},[`prevent`]),onClick:t=>a(e)},M((`t`in t?t.t:f(Z))(r[e])),41,Cd))),128)),(_(!0),v(k,null,y(f(s),e=>(_(),v(`button`,{key:e.key,type:`button`,class:j(e.cls),onPointerdown:n[1]||=re(()=>{},[`prevent`]),onClick:t=>c(e.key)},M(e.label),43,wd))),128)),I(`button`,{type:`button`,class:j([`kbd`,{on:e.ctl.kbdOn.value}]),"aria-label":(`t`in t?t.t:f(Z))(`Type in terminal`),onPointerdown:n[2]||=re(()=>{},[`prevent`]),onClick:l},[E(o,{name:`i-lucide-keyboard`})],42,Td)],8,Sd)}}}),[[`__scopeId`,`data-v-33673e53`]]),{__name:`Keybar`}),Dd=`wherdr.mouse-selection-hint.dismissed`,Od=h(!1),kd=!1;function Ad(){if(!kd&&typeof localStorage<`u`){kd=!0;try{Od.value=localStorage.getItem(Dd)===`1`}catch{}}let e=h(!1),t=typeof matchMedia<`u`&&matchMedia(`(hover: hover) and (pointer: fine)`).matches,r=n(()=>t&&e.value&&!Od.value);function i(t,n=!1){e.value=n||t.modes.mouseTrackingMode!==`none`}function a(){Od.value=!0;try{localStorage.setItem(Dd,`1`)}catch{}}return{visible:r,refresh:i,dismiss:a}}var jd=e(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(globalThis,(()=>(()=>{var e={4567:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;let a=n(9042),o=n(9924),s=n(844),c=n(4725),l=n(2585),u=n(3656),d=t.AccessibilityManager=class extends s.Disposable{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``,this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new o.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this.register(this._terminal.onResize((e=>this._handleResize(e.rows)))),this.register(this._terminal.onRender((e=>this._refreshRows(e.start,e.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((e=>this._handleChar(e)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
18
+ `).length:0);e.push({k:`shell`,key:`s:${t.ts}:${t.text.slice(0,40)}`,bash:t.role===`bash`,text:t.text,out:n,err:r,lines:i,long:i>Ad||n.length+r.length>1500})}else if(t.role===`notice`&&t.name===`error`&&t.error)e.push({k:`error`,key:s,text:t.text,long:t.text.split(`
19
+ `).length>Ad||t.text.length>1200});else if(t.role===`notice`){let[n,r]=ot[t.name||``]||[t.name||`Note`,`i-lucide-info`];e.push(dt({k:`notice`,key:s,label:Q(n),icon:r,scheduled:t.name===`scheduled`,long:t.name===`scheduled`||t.text.split(`
20
+ `).length>Ad||t.text.length>1200},()=>oa(t.text)))}else{let n=t.role===`system`?t.text.match(/^Effort : (low|medium|high|xhigh|max|ultracode) \(cette session\)$/):null;e.push({k:`system`,key:s,text:n?Z(`Effort: ${n[1]} (this session)`,`Effort : ${n[1]} (cette session)`):t.role===`system`?Q(t.text):t.text})}}),i();let p=!G.value&&s.pane.status===`blocked`;if(!pt.value&&!p&&!s.pane.pendingPrompt)f();else{let t=e[e.length-1];t&&t.k===`tools`&&(pt.value||p)&&(t.live=!0)}return e}),ht=e=>ft.has(e);function gt(e,t){t?ft.add(e):ft.delete(e)}let _t=e=>[...x.value?.querySelectorAll(`[data-hit-key]`)||[]].find(t=>t.dataset.hitKey===e)||null,yt=e=>{let t=e?.closest(`[data-hit-key]`)?.dataset.hitKey,n=t?mt.value.find(e=>e.key===t):null;return n&&n.k===`assistant`?{time:n.time,id:n.rid}:{time:null,id:null}};function xt(e){let{time:t,id:n}=yt(e);if(e.classList.contains(`q-all`))return Zr({n:e.dataset.n||``,text:e.dataset.q||``},t,n,ei(e));let r=e.closest(`.q-trow`);return r?Li(Er(r),t,n):e.dataset.q?Ji(e.dataset.q,t,n):null}function St(e){let t=mt.value.find(t=>t.key===e);t&&t.k===`assistant`&&Ct(dr(t.text,t.time,t.rid))}function Ct(e){let t=tn(s.pane.id),n=e?Br(t.text,e):null;Wt.value=null,window.getSelection()?.removeAllRanges(),n!==null&&(t.text=n),$(),d(`quote`)}let wt=e=>Q(e===`yes`?`Yes`:`No`),Tt=()=>{fe=!1,pe=!0};function Et(e,t,n){if(!e)return;Tt();let r=tn(s.pane.id),i=Dr(r.text,e,wt(t));i!==null&&(r.text=i),$(),n&&d(`answered`,ra(r.text,e))}function Dt(e,t){if(!e)return;Tt();let n=tn(s.pane.id);n.text=zr(n.text,e,Z(`OK to all`,`OK tout`)),$(),t&&d(`answered`,ra(n.text,e))}let Ot=(e,t)=>ri(ur(Rt.value,e)||``)===t;function kt(){let e=tn(s.pane.id).text;for(let t of x.value?.querySelectorAll(`.q-ans, .q-tans`)||[]){let n=xt(t);t.setAttribute(`aria-pressed`,String(!!n&&ri(ur(e,n)||``)===t.dataset.a))}for(let t of x.value?.querySelectorAll(`.q-all`)||[])t.setAttribute(`aria-pressed`,String(Cr(e,xt(t))));for(let t of x.value?.querySelectorAll(`.q-reply, .q-point, .q-tquote`)||[]){let n=xt(t),r=!!n&&Cr(e,n);if(t.classList.toggle(`quoted`,r),t.dataset.n&&!t.classList.contains(`q-tquote`))for(let e of At(t))e.classList.toggle(`quoted`,r)}}let At=e=>e.closest(`.md-body`)?.querySelectorAll(`.q-text[data-n="${e.dataset.n}"]`)||[],Mt=e=>e.closest(`.md-body`)?.querySelector(`.q-reply[data-n="${e.dataset.n}"]`)||null,Pt=null;function Ft(e){Pt?.classList.remove(`q-armed`),Pt=e,e?.classList.add(`q-armed`)}let Lt=h(null),Rt=n(()=>tn(s.pane.id).text);z(Rt,e=>{e||(pe=!1)});function Bt(e,t,n){for(let r of _t(e)?.querySelectorAll(`.q-text[data-n="${t}"]`)||[])r.classList.toggle(`q-hot`,n)}let Vt;function Ht(e,t){let n=t.closest(`.msg-ai .md-body .q-pt`),r=n?.querySelector(`:scope > .q-point`),i=r?.dataset.q;if(clearTimeout(Vt),!n||!i||t.closest(`a, button, summary, input`))return Ft(null);if(Vi.value===`list`){Lt.value&&n.closest(`[data-hit-key]`)?.dataset.hitKey===Lt.value&&(Lt.value=null,Ct(xt(r)));return}if(Vi.value!==`text`||window.getSelection()?.isCollapsed===!1)return Ft(null);if(qt())return Ft(n===Pt?null:n);e.detail>1||(Vt=setTimeout(()=>{window.getSelection()?.isCollapsed!==!1&&Ct(xt(r))},220))}l(()=>clearTimeout(Vt)),z([()=>tn(s.pane.id).text,ye],()=>P(kt),{flush:`post`});let Wt=h(null),Gt=h(null),qt=()=>window.matchMedia(`(pointer: coarse)`).matches;function Jt(){let e=window.getSelection(),t=e&&!e.isCollapsed&&e.rangeCount?e.getRangeAt(0):null,n=(t?t.startContainer.nodeType===1?t.startContainer:t.startContainer.parentElement:null)?.closest(`.msg-ai[data-hit-key]`);if(!t||!n||G.value||!x.value?.contains(n))return null;let r=Tl(t,n.querySelector(`.md`)||n),i=r?.toString().trim()||``;if(!r||!i)return null;let a=xl(r.getClientRects())||r.getBoundingClientRect();return{host:n,text:i,end:a,sig:`${i}|${Math.round(a.right)}|${Math.round(a.top)}`}}function Zt(){let e=Jt();if(!e||!x.value){Wt.value=null;return}let t=x.value.getBoundingClientRect(),n=Sl(e.end,{width:Gt.value?.offsetWidth||104,height:Gt.value?.offsetHeight||32},{width:window.innerWidth,top:Math.max(0,t.top),bottom:Math.min(window.innerHeight,t.bottom)},qt());Wt.value=n?{text:e.text,...yt(e.host),sig:e.sig,...n}:null}let Qt=Cl({show:Zt,hide:()=>{Wt.value=null},touch:qt}),nn=e=>{e.button===0&&!e.target?.closest?.(`.sel-reply`)&&Qt.down()},rn=()=>Qt.up(),an=()=>Qt.change(!!Wt.value&&Jt()?.sig===Wt.value.sig),on=()=>{(Wt.value||window.getSelection()?.isCollapsed===!1)&&Qt.scroll()};w(()=>{document.addEventListener(`pointerdown`,nn,!0),document.addEventListener(`pointerup`,rn,!0),document.addEventListener(`pointercancel`,rn,!0),document.addEventListener(`selectionchange`,an),window.addEventListener(`scroll`,on,!0),window.addEventListener(`resize`,on)}),l(()=>{Qt.dispose(),document.removeEventListener(`pointerdown`,nn,!0),document.removeEventListener(`pointerup`,rn,!0),document.removeEventListener(`pointercancel`,rn,!0),document.removeEventListener(`selectionchange`,an),window.removeEventListener(`scroll`,on,!0),window.removeEventListener(`resize`,on)}),i(`gotoRef`,(e,t)=>{let n=t.closest(`[data-hit-key]`)?.dataset.hitKey,r=n?mt.value.findIndex(e=>e.key===n):-1,i=(r<0?mt.value:mt.value.slice(0,r)).flatMap(e=>e.k===`assistant`?[{key:e.key,time:e.time,text:e.text,rid:e.rid}]:[]);cn(lr(i,{time:e.time||``,excerpt:e.excerpt,id:e.id&&Vr(e.id)})?.key||null)});async function cn(e){e&&!_t(e)&&ve.value&&await we();let t=e?_t(e):null;if(!t)return X(Q(`Original message not found (further up the conversation?)`),!0);t.scrollIntoView({block:`center`,behavior:`smooth`}),t.classList.remove(`msg-flash`),t.offsetWidth,t.classList.add(`msg-flash`),setTimeout(()=>t.classList.remove(`msg-flash`),1700)}let ln=Kc;function un(e){let t=e.target,n=t.closest?.(`.q-ans`),r=e.detail>0;if(n?.dataset.q){e.preventDefault(),Ft(null),Lt.value=null,Et(xt(n),n.dataset.a===`no`?`no`:`yes`,r);return}let i=t.closest?.(`.q-tans`);if(i?.dataset.n){e.preventDefault(),Ft(null),Lt.value=null,Et(xt(i),i.dataset.a===`no`?`no`:`yes`,r);return}let a=t.closest?.(`.q-all`);if(a){e.preventDefault(),Ft(null),Lt.value=null,Dt(xt(a),r);return}let o=t.closest?.(`.q-reply, .q-point, .q-tquote`);if(o){e.preventDefault(),Ft(null),Lt.value=null,Ct(xt(o));return}let s=Vi.value===`text`&&!G.value?t.closest?.(`.q-text`):null,c=s&&window.getSelection()?.isCollapsed!==!1?Mt(s):null;if(c){e.preventDefault(),Ft(null),Ct(xt(c));return}let l=t.closest?.(`.md-body .md-path`);if(l){e.preventDefault(),En(l);return}let u=t.closest?.(`.md-body .md-cmd`);if(u){e.preventDefault(),hn(u);return}let d=t.closest?.(`.md-body img`);if(d&&d.src){e.preventDefault(),Kr(d.src);return}!G.value&&!t.closest?.(`.code-block`)&&Ht(e,t);let f=(t.closest?.(`.can-run .code-run`))?.closest(`.code-block`)?.dataset.cmd;if(f){fn(f);return}let p=t.closest?.(`.code-copy`);if(!p)return;let m=p.closest(`.code-block`),h=m?.dataset.cmd??m?.querySelector(`pre`)?.textContent;h!=null&&navigator.clipboard.writeText(h).then(()=>{p.textContent=Q(`Copied`),p.classList.add(`done`),setTimeout(()=>{p.textContent=Q(`Copy`),p.classList.remove(`done`)},1400)}).catch(()=>X(Q(`Copy failed`),!0))}async function fn(e){let t=await Gc(s.pane.id,e);t!==!1&&d(`sent`,t)}async function pn(e){if(!G.value)try{let t=await xi(`/api/split-command`,{pane_id:s.pane.id,command:e});X(t.created?Q(`Command sent to a new split terminal`):Q(`Command sent to split terminal`)),await It(Xi.value?{path:se(s.pane.tab),query:{pane:t.pane_id}}:Be(t.pane_id))}catch(e){X(e.message,!0)}}function mn(e,t){let n=[];return t&&n.push({label:Z(`Run…`,`Lancer…`),icon:`i-lucide-play`,run:()=>fn(e)}),G.value||n.push({label:Q(`Run in split terminal`),icon:`i-lucide-columns-2`,run:()=>pn(e)}),n.push({label:Q(`Copy command`),icon:`i-lucide-copy`,desc:e,mono:!0,run:()=>ln(e)}),n}function hn(e){let t=e.dataset.cmd;t&&Sn(e,mn(t,q.value&&!!e.closest(`.can-run`)),Z(`Command`,`Commande`))}let vn=r({open:!1,x:0,y:0,w:0,h:0}),yn=h([]);function Sn(e,t,n){if(ji.value){$(),Ke(t,n);return}let r=e.getBoundingClientRect();Object.assign(vn,{x:r.left,y:r.top,w:r.width,h:r.height}),yn.value=Ae(t),vn.open=!0}let wn=e=>e.replace(/\/+$/,``).split(`/`).pop()||e;function Tn(e){let t=[];return!Qr.value&&!e.endsWith(`/`)&&t.push({label:Q(`Preview`),icon:`i-lucide-eye`,run:()=>kn(e)},{label:Q(`Download`),icon:`i-lucide-download`,run:()=>jn(e)}),Di(s.pane)&&!Qr.value&&t.push({label:Q(`Reveal in Finder`),icon:`i-lucide-folder-search`,run:()=>Nn(e,`reveal`)},{label:Q(`Open`),icon:`i-lucide-external-link`,run:()=>Nn(e,`open`)}),t.push({label:Q(`Copy path`),icon:`i-lucide-copy`,desc:e,mono:!0,run:()=>ln(e)}),t}function En(e,t){let n=t||(e.textContent||``).trim();n&&Sn(e,Tn(n),wn(n))}let Dn=r({open:!1,path:``});function kn(e){Object.assign(Dn,{open:!0,path:e})}async function jn(e){try{await Ui(`/api/files/download?pane=${encodeURIComponent(s.pane.id)}&path=${encodeURIComponent(e)}&from=chat`,wn(la(e)))}catch(e){X(e.message,!0)}}function Mn(e){if(e.key===`Escape`&&(Lt.value||Pt)){Lt.value=null,Ft(null);return}if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target.closest?.(`.md-body .md-path, .md-body .md-cmd`);t&&(e.preventDefault(),t.classList.contains(`md-cmd`)?hn(t):En(t))}async function Nn(e,t){try{let n=await xi(`/api/reveal`,{pane_id:s.pane.id,path:e,mode:t});X(t===`reveal`?Z(`Shown in Finder on ${n.machine}`,`Affiché dans le Finder sur ${n.machine}`):Z(`Opened in the editor on ${n.machine}`,`Ouvert dans l’éditeur sur ${n.machine}`))}catch(e){X(e.message,!0)}}let Pn=n(()=>{if(G.value)return null;let e=s.pane;return e.agent===`omp`?e.ompShell?{shell:e.ompShell,sent:null,queued:[]}:null:e.agent===`claude`&&e.status===`working`&&e.claudeScreen||null}),Fn=n(()=>Pn.value&&Pn.value.shell||null),In=h(Date.now()),Ln;z(Fn,e=>{e&&!Ln&&(Ln=na(()=>{In.value=Date.now()},1e3)),!e&&Ln&&(clearInterval(Ln),Ln=void 0)},{immediate:!0}),l(()=>clearInterval(Ln));let Rn=n(()=>{let e=Fn.value&&Fn.value.since;if(!e)return null;let t=Math.max(0,Math.round((In.value-e)/1e3));return t<60?`${t} s`:`${Math.floor(t/60)} min ${String(t%60).padStart(2,`0`)} s`}),zn=n(()=>{let e=s.pane,t=sn(G.value?[]:(e.queued||[]).filter(e=>!e.back),s.localQueued),n=yl(e.id,t),r=mt.value.filter(e=>e.k===`assistant`),i=qc(e,{})===`sending`;return bl({mine:t,claude:C.value.queue||[],items:T.value,screen:Pn.value,memory:n,idle:i}).map(e=>{let t=e.raw.split(`
21
+ `),n=t.filter(e=>!Xc(e)&&!Cn(e)).join(`
22
+ `).trim(),i=wi(n);return{...e,srcs:e.photos.map(il),files:t.map(Zn).filter(e=>!!e),text:n,body:i?i.body:n,reply:i?.reply||null,origin:i&&lr(r,i.reply)?.key||null}})}),Bn=h(!1);async function Vn(){if(!Bn.value){Bn.value=!0;try{await xi(`/api/send-now`,{pane_id:s.pane.id})}catch(e){X(e.message,!0)}finally{Bn.value=!1}}}let Hn=e=>[...e.srcs.map(e=>({type:`file`,mediaType:`image/jpeg`,url:e})),...Array.from({length:e.missing},()=>({type:`file`,mediaType:`image/jpeg`,url:``})),...e.body||e.files.length?[{type:`text`,text:e.body||` `}]:[]],Un=n(()=>!G.value&&On(s.pane)),Wn=h(null);async function Gn(e){if(!Wn.value){if(e.local){Kn(tn(s.pane.id),er(s.pane.id,e.id)||e.raw),d(`restored`);return}Wn.value=e.id,$();try{let t=await xi(`/api/unqueue`,{pane_id:s.pane.id,text:e.raw,id:e.mine?e.id:void 0});Kn(tn(s.pane.id),t.text||e.raw,e.pasted),d(`restored`),t.lost?X(Q(`Removed from the queue`),!0,An(t.lost)):X(Q(`Removed from the queue`)),setTimeout(We,400)}catch(e){X(e.message,!0)}finally{Wn.value=null}}}let Jn=h(null);async function Yn(e){if(!Jn.value){Jn.value=e.id,$();try{e.local?await gn(s.pane,s.pane.id,e.id):await xi(`/api/requeue`,{pane_id:s.pane.id,id:e.id})}catch(e){X(e.message,!0)}finally{Jn.value=null}}}let Xn=n(()=>!!s.pane.menuLeftOpen&&zn.value.some(e=>e.phase===`queued`)),$n=h(null);async function tr(e){if(!$n.value){$n.value=e,$();try{await xi(`/api/menu-left`,{pane_id:s.pane.id,action:e})}catch(e){X(e.message,!0)}finally{$n.value=null}}}function nr(e){return Q(e===`busy`?`Not sent — the agent’s input contains text`:e===`no_input`?`Not sent — the agent’s input field was not found on its screen`:e===`lost`?`Not sent — it was taken out of the agent’s queue before being read`:e===`unseen`?`Not sent — still not in the conversation after an hour`:`Not sent`)}let ir=h(null);async function ar(e){if(!ir.value){ir.value=e.id;try{await xi(`/api/clear-queued-input`,{pane_id:s.pane.id,id:e.id,input_text:e.inputText})}catch(e){X(e.message,!0)}finally{ir.value=null}}}function or(e){if(e.state===`sending`)return Q(`Queued · `)+Q(`sending…`);switch(qc(s.pane,e)){case`busy`:return e.inputText?Z(`Not sent: the agent’s input already contains text (“${e.inputText}”)`,`Pas envoyé : la saisie de l’agent contient déjà du texte (« ${e.inputText} »)`):Q(`Not sent — the agent’s input contains text`);case`stopped`:return Q(`Queued · `)+Q(`agent stopped`);case`question`:return Q(`Queued · `)+Q(`after you answer the question`);case`dialog`:return Q(`Queued · `)+Q(`will be sent when the menu closes`);case`starting`:return Q(`Queued · `)+Q(`agent starting`);case`working`:return Q(`Queued`);default:return Q(`Queued · `)+Q(`sending…`)}}z(()=>zn.value.map(e=>`${e.id}:${e.phase}`).join(`,`),()=>P(()=>J(!1))),z(()=>Fn.value&&Fn.value.lines.join(`
23
+ `),()=>P(()=>J(!1)));let pr=n(()=>{let e=s.pane;if(e.menu||e.interaction===`terminal`||!O.value||O.value===`unsupported`||!e.screen||e.status===`working`||G.value)return null;let t=ai(e.agent);return Ei(e)?{text:Z(`${t} is waiting for your answer, below or in the terminal.`,`${t} attend ta réponse, ci-dessous ou dans le terminal.`),lines:[]}:{text:Z(`${t} is waiting for an action in the terminal.`,`${t} attend une action dans le terminal.`),lines:e.screen.lines}}),mr=n(()=>{if(G.value)return null;let e=s.pane;if(e.pendingPrompt&&e.status!==`working`)return{typing:!0,text:Z(`Your first message will be sent when ${ai(e.agent)} is ready`,`Ton premier message partira dès que ${ai(e.agent)} sera prêt`)};if(Fn.value)return{typing:!0,text:Z(`Command running…`,`Commande en cours…`)};if(e.status===`working`&&e.agent===`claude`&&e.activity)return{typing:!0,verb:!0,text:`${e.activity}…`};if(e.status===`working`&&e.agent===`omp`&&e.ompActivity){let t=e.ompActivity;return{typing:!0,omp:!0,since:t.since,text:t.step||`${ai(e.agent)} ${Z(`is working…`,`travaille…`)}`}}return e.status===`working`?{typing:!0,text:`${ai(e.agent)} ${Z(`is working…`,`travaille…`)}`}:e.status===`blocked`&&!e.menu&&!pr.value&&!(e.prompt&&e.prompt.options)&&!Ei(e)?{typing:!1,text:Q(`Waiting for your reply — details in the Terminal tab`)}:null});z(()=>s.pane.status,()=>P(()=>J(!1)));let Y=r({q:``,hits:[],cur:-1,loading:!1}),hr=!1,gr=h(null),_r=e=>e.normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase(),vr=typeof CSS<`u`&&`highlights`in CSS?CSS.highlights:null,br=globalThis.Highlight;function Sr(){vr?.delete(`hw-hit`),vr?.delete(`hw-cur`)}function Tr(e,t){if(Sr(),Y.hits=[],!p.value||Y.q.length<2||!x.value)return;let n=_r(Y.q),r=document.createTreeWalker(x.value,NodeFilter.SHOW_TEXT);for(let e=r.nextNode();e;e=r.nextNode()){let t=_r(e.nodeValue||``),r=0,i;for(;(i=t.indexOf(n,r))>=0;){let t=document.createRange();t.setStart(e,i),t.setEnd(e,Math.min(i+n.length,(e.nodeValue||``).length)),Y.hits.push(t),r=i+n.length}}if(t){let e=Y.hits.findIndex(e=>t.contains(e.startContainer));Y.cur=e>=0?e:0}else(e||Y.cur>=Y.hits.length)&&(Y.cur=Y.hits.length-1);Or()}function Or(){if(vr&&br){vr.set(`hw-hit`,new br(...Y.hits.filter((e,t)=>t!==Y.cur)));let e=Y.hits[Y.cur];e?vr.set(`hw-cur`,new br(e)):vr.delete(`hw-cur`)}let e=Y.hits[Y.cur],t=b.value;if(e&&t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();t.scrollTo({top:t.scrollTop+n.top-r.top-t.clientHeight/2,behavior:`smooth`})}}let kr=n(()=>Y.loading?Q(`loading…`):Y.q.length<2?``:Y.hits.length?`${Y.cur+1}/${Y.hits.length}`:Q(`no results`));function jr(e){Y.hits.length&&(Y.cur=(Y.cur+e+Y.hits.length)%Y.hits.length,Or())}async function Nr(){for(;C.value.olderCursor>0;){let e=C.value.olderCursor;if(await Ge(),C.value.olderCursor===e)break}}let Pr;function Ir(){clearTimeout(Pr),Pr=setTimeout(Hr,250)}async function Hr(){if(Y.q.trim().length<2){Sr(),Y.hits=[],Y.cur=-1;return}C.value.olderCursor>0&&!G.value&&(Y.loading=!0,await Nr(),Y.loading=!1),await we(),Tr(!0)}async function Ur(){let e=c.query.hit,t=c.query.q;if(typeof e!=`string`||typeof t!=`string`||!/^\d+$/.test(e))return;let n=Number(e);p.value=!0,Y.q=t,Y.loading=!0,hr=!0;try{for(;C.value.olderCursor>n&&!G.value;){let e=C.value.olderCursor;if(await Ge(),C.value.olderCursor>=e)break}await we();let e=String(c.query.role||``),t=String(c.query.ts||``),r=String(c.query.prefix||``),i=T.value.findIndex(n=>n.role===e&&n.ts===t&&n.text.startsWith(r)),a=i<0?``:`${e}:${t}:${i}`,o=[...x.value?.querySelectorAll(`[data-hit-key]`)||[]].find(e=>e.dataset.hitKey===a);Tr(!1,o),o&&!Y.hits.length&&o.scrollIntoView({block:`center`})}finally{hr=!1,Y.loading=!1}}z(()=>c.query.hit,()=>{c.params.pane===s.pane.id&&Ur()});function Wr(){p.value=!1}z(p,e=>{e?P(()=>gr.value?.inputRef?.focus()):(Y.q=``,Y.hits=[],Y.cur=-1,Sr())}),l(Sr);function Gr(e){e.key===`Enter`&&(e.preventDefault(),jr(e.shiftKey?1:-1)),e.key===`Escape`&&(e.preventDefault(),Wr())}function Kr(e){jt([e])}function Jr(){let e=gr.value?.inputRef;e?.focus(),e?.select()}let Yr=n(()=>{if(G.value||pt.value||s.pane.status===`blocked`||zn.value.length||Fn.value)return null;let e=mt.value.findLast(e=>e.k===`assistant`||e.k===`user`||e.k===`autopilot`||e.k===`shell`||e.k===`ompRun`);if(!e||e.k!==`assistant`||Fe(e.id)!==null)return null;let t=xr(e.html);return t.questions.length+t.rows.length?{key:e.key,time:e.time,rid:e.rid,targets:t}:null}),Xr=n(()=>{let e=Yr.value?cr(Yr.value.targets,Rt.value,Yr.value.time,Yr.value.rid):0;return Yr.value&&e?{key:Yr.value.key,count:e}:null});z(()=>Xr.value?.count||0,e=>d(`unanswered`,e),{immediate:!0}),l(()=>d(`unanswered`,0));function $r(){let e=Xr.value?_t(Xr.value.key):null,t=Rt.value,n=yt(e),r=[...e?.querySelectorAll(`.q-reply, .q-trow`)||[]].find(e=>e.classList.contains(`q-trow`)?!wr(t,Er(e),n.time,n.id):!Cr(t,xt(e)));if(!r)return;let i=r.classList.contains(`q-trow`)?[r]:[...At(r)];(i[0]||r).scrollIntoView({block:`center`,behavior:ci.value?`auto`:`smooth`});for(let e of i)e.classList.remove(`q-flash`),e.offsetWidth,e.classList.add(`q-flash`),setTimeout(()=>e.classList.remove(`q-flash`),1700);$()}return t({scrollToEnd:J,reload:()=>setTimeout(We,400),focusSearch:Jr,gotoUnanswered:$r}),(t,n)=>{let r=bn,i=bt,o=qn,s=Qe,c=so,l=mo,u=bo,h=Do,S=Ro,w=Bo,D=ca,P=Go,z=vt,H=Es,K=ks,ie=Fs,ae=Uo,J=Qo,oe=zs,se=xn,ce=Rc,le=Ut;return _(),v(k,null,[p.value?(_(),v(`div`,Rl,[E(r,{ref_key:`searchInput`,ref:gr,modelValue:f(Y).q,"onUpdate:modelValue":[n[0]||=e=>f(Y).q=e,Ir],type:`search`,enterkeyhint:`search`,autocomplete:`off`,icon:`i-lucide-search`,variant:`none`,placeholder:(`t`in t?t.t:f(Q))(`Search the conversation`),class:`flex-1 min-w-0`,onKeydown:Gr},null,8,[`modelValue`,`placeholder`]),F(`span`,zl,M(f(kr)),1),E(i,{icon:`i-lucide-chevron-up`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Q))(`Previous`),onClick:n[1]||=e=>jr(-1)},null,8,[`aria-label`]),E(i,{icon:`i-lucide-chevron-down`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Q))(`Next`),onClick:n[2]||=e=>jr(1)},null,8,[`aria-label`]),E(i,{icon:`i-lucide-x`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":(`t`in t?t.t:f(Q))(`Close`),onClick:Wr},null,8,[`aria-label`])])):g(``,!0),F(`div`,Bl,[f(G)&&!f(W)||(`netDown`in t?t.netDown:f(Ii))?(_(),m(o,{key:0,label:f(G)?(`t`in t?t.t:f(Q))(`Offline reading`):void 0,at:f(U)},null,8,[`label`,`at`])):f(Fl)(f(L))?(_(),m(o,{key:1,label:(`t`in t?t.t:f(Q))(`Conversation not up to date — reconnecting…`)},null,8,[`label`])):g(``,!0),f(te)&&f(U)?(_(),v(`span`,Vl,M((`tl`in t?t.tl:f(Z))(`Read at ${(`fmtTime`in t?t.fmtTime:f(hi))(f(U))}`,`Lu à ${(`fmtTime`in t?t.fmtTime:f(hi))(f(U))}`)),1)):g(``,!0),F(`div`,{ref_key:`box`,ref:b,class:`chat`,onScrollPassive:ge,onWheelPassive:me,onTouchmovePassive:me},[E(oe,{status:f(pt)?`streaming`:`ready`,"should-auto-scroll":!1,"should-scroll-to-bottom":!1,"auto-scroll":{color:`neutral`,variant:`outline`},"auto-scroll-icon":`i-lucide-arrow-down`,ui:{root:`chat-msgs`,viewport:`hw-jump-vp`,autoScroll:`hw-jump`}},{default:V(()=>[F(`div`,{ref_key:`listEl`,ref:x,class:j([`chat-list`,[f(G)?`no-reply`:`rs-${`replyStyle`in t?t.replyStyle:f(Vi)}`,{asking:f(Yr),skeleton:f(ne)}]]),onClick:un,onKeydown:Mn},[f(O)&&f(pr)?(_(),v(`div`,Hl,[E(s,{name:`i-lucide-square-terminal`,class:`chat-empty-icon`}),F(`p`,null,M(f(pr).text),1),f(pr).lines.length?(_(),v(`pre`,Ul,M(f(pr).lines.join(`
24
+ `)),1)):g(``,!0),E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-square-terminal`,onClick:n[3]||=e=>d(`gotoTerm`)},{default:V(()=>[a(M((`t`in t?t.t:f(Q))(`View terminal`)),1)]),_:1})])):f(O)===`no_integration`&&f(A)?(_(),v(`div`,Wl,[E(s,{name:`i-lucide-plug-zap`,class:`chat-empty-icon`}),F(`p`,Gl,M((`tl`in t?t.tl:f(Z))(`Herdr's ${(`kindLabel`in t?t.kindLabel:f(ai))(f(A).agent)} integration is missing`,`L’intégration ${(`kindLabel`in t?t.kindLabel:f(ai))(f(A).agent)} de Herdr manque`)),1),F(`p`,Kl,M(f(A).machine?(`tl`in t?t.tl:f(Z))(`Without it, wherdr cannot find this agent's conversation. Run this in a terminal on ${f(A).machine}, then restart the agent:`,`Sans elle, wherdr ne retrouve pas la conversation de cet agent. Lance cette commande dans un terminal de ${f(A).machine}, puis relance l’agent :`):(`tl`in t?t.tl:f(Z))(`Without it, wherdr cannot find this agent's conversation. Run this in a terminal on the agent's machine, then restart the agent:`,`Sans elle, wherdr ne retrouve pas la conversation de cet agent. Lance cette commande dans un terminal de la machine de l’agent, puis relance l’agent :`)),1),F(`code`,ql,M(f(A).command),1),F(`div`,Jl,[E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-copy`,onClick:ze},{default:V(()=>[a(M((`t`in t?t.t:f(Q))(`Copy command`)),1)]),_:1}),E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-square-terminal`,onClick:n[4]||=e=>d(`gotoTerm`)},{default:V(()=>[a(M((`t`in t?t.t:f(Q))(`View terminal`)),1)]),_:1})])])):f(O)?(_(),v(`div`,Yl,[E(s,{name:`i-lucide-message-square-dashed`,class:`chat-empty-icon`}),F(`p`,null,M(f(O)===`not_found`?(`t`in t?t.t:f(Q))(`No conversation for this agent yet.`):(`t`in t?t.t:f(Q))(`Conversation unavailable for this agent.`)),1),E(i,{size:`sm`,color:`neutral`,variant:`outline`,class:`mono-btn`,icon:`i-lucide-square-terminal`,onClick:n[5]||=e=>d(`gotoTerm`)},{default:V(()=>[a(M((`t`in t?t.t:f(Q))(`View terminal`)),1)]),_:1})])):(_(),v(k,{key:3},[f(ne)?(_(),m(c,{key:0,agent:e.pane.agent},null,8,[`agent`])):f(ve)?(_(),v(k,{key:1},[],64)):f(C).olderCursor>0?(_(),v(`div`,Xl,[E(i,{size:`xs`,color:`neutral`,variant:`outline`,class:`mono-btn`,loading:f(B),icon:`i-lucide-arrow-up`,onClick:Ge},{default:V(()=>[a(M((`t`in t?t.t:f(Q))(`Load earlier messages`)),1)]),_:1},8,[`loading`])])):f(C).older.length?(_(),v(`div`,Zl,M((`t`in t?t.t:f(Q))(`Start of conversation`)),1)):g(``,!0),(_(!0),v(k,null,y(f(ne)?[]:f(ye),r=>(_(),v(k,{key:r.key},[r.k===`day`?(_(),v(`div`,Ql,[F(`span`,null,M(r.label),1)])):r.k===`who`?(_(),v(`div`,{key:1,class:j([`msg-who`,e.pane.agent||``])},[E(s,{name:(`agentIcon`in t?t.agentIcon:f($t))(e.pane.agent)||`i-lucide-bot`},null,8,[`name`]),F(`span`,null,M((`kindLabel`in t?t.kindLabel:f(ai))(e.pane.agent)),1)],2)):r.k===`autopilot`?(_(),m(l,{key:2,text:r.text,"data-hit-key":r.key,onCopy:f(ln)},null,8,[`text`,`data-hit-key`,`onCopy`])):r.k===`user`?(_(),v(`div`,{key:3,class:`msg-user-wrap`,"data-hit-key":r.key},[r.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Q))(`Show original message`),onClick:e=>cn(r.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),F(`span`,tu,M(r.reply.time),1),F(`span`,nu,M(r.reply.excerpt),1)],8,eu)):g(``,!0),E(w,{id:r.key,role:`user`,side:`right`,variant:`soft`,parts:[...r.srcs.map(e=>({type:`file`,mediaType:`image/jpeg`,url:e})),...r.text||r.files.length?[{type:`text`,text:r.text||` `}]:[]],ui:{root:r.text.trim()||r.files.length?`msg msg-user`:`msg msg-user msg-no-text`,container:`msg-c`,content:`msg-bubble`,header:`msg-files`}},{files:V(()=>[E(u,{srcs:r.srcs,offline:f(G)},null,8,[`srcs`,`offline`])]),content:V(()=>[r.files.length?(_(),v(`span`,ru,[(_(!0),v(k,null,y(r.files,e=>(_(),m(h,{key:e.path,name:e.name,clickable:``,onOpen:t=>En(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(S,{text:r.text,pasted:r.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),r.time?(_(),v(`div`,{key:1,class:`msg-time`,title:r.at||void 0},M(r.time),9,iu)):g(``,!0)],8,$l)):r.k===`assistant`?(_(),v(k,{key:4},[E(w,{id:r.key,role:`assistant`,side:`left`,variant:`naked`,"data-hit-key":r.key,parts:[{type:`text`,text:r.text}],ui:{root:`msg msg-ai tw-${e.pane.agent||`agent`}${f(q)?` can-run`:``}${f(Lt)===r.key?` q-picking`:``}`,container:`msg-c`,content:`md`}},{content:V(()=>[E(D,{html:r.html,typing:Fe(r.id),onDone:e=>Ie(r.id)},null,8,[`html`,`typing`,`onDone`])]),_:2},1032,[`id`,`data-hit-key`,`parts`,`ui`]),(`replyStyle`in t?t.replyStyle:f(Vi))===`list`&&!f(G)&&Fe(r.id)===null&&(f(xr)(r.html).questions.length||f(xr)(r.html).pick)?(_(),v(`div`,au,[f(xr)(r.html).questions.length?(_(),v(k,{key:0},[F(`p`,ou,M((`tl`in t?t.tl:f(Z))(`Questions · reply to`,`Questions · répondre à`)),1),(_(!0),v(k,null,y(f(xr)(r.html).questions,e=>(_(),v(`div`,{key:e.n,class:`q-line`},[F(`button`,{type:`button`,class:j([`q-row`,{quoted:f(Cr)(f(Rt),f(Ji)(e.text,r.time,r.rid))}]),"aria-label":`${(`t`in t?t.t:f(Q))(`Reply`)}: ${e.text}`,onClick:t=>Ct(f(Ji)(e.text,r.time,r.rid)),onMouseenter:t=>Bt(r.key,e.n,!0),onMouseleave:t=>Bt(r.key,e.n,!1),onFocus:t=>Bt(r.key,e.n,!0),onBlur:t=>Bt(r.key,e.n,!1)},[F(`b`,null,M(f(Cr)(f(Rt),f(Ji)(e.text,r.time,r.rid))?`✓`:e.n),1),F(`span`,null,M(e.text),1),F(`i`,null,[n[14]||=a(`↳`,-1),F(`em`,null,M(f(Cr)(f(Rt),f(Ji)(e.text,r.time,r.rid))?(`t`in t?t.t:f(Q))(`Quoted`):(`t`in t?t.t:f(Q))(`Reply`)),1)])],42,su),e.closed?(_(),v(k,{key:0},y([`yes`,`no`],t=>F(`button`,{key:t,type:`button`,class:`q-row-ans`,"aria-pressed":Ot(f(Ji)(e.text,r.time,r.rid),t),"aria-label":`${wt(t)}: ${e.text}`,onClick:n=>Et(f(Ji)(e.text,r.time,r.rid),t,n.detail>0)},M(wt(t)),9,cu)),64)):g(``,!0)]))),128))],64)):g(``,!0),f(xr)(r.html).pick?(_(),v(`button`,{key:1,type:`button`,class:`q-pick`,"aria-pressed":f(Lt)===r.key,onClick:e=>Lt.value=f(Lt)===r.key?null:r.key},M(f(Lt)===r.key?(`tl`in t?t.tl:f(Z))(`Pick the point to quote · Cancel`,`Choisis le point à citer · Annuler`):(`tl`in t?t.tl:f(Z))(`+ Quote a point`,`+ Citer un point`)),9,lu)):g(``,!0)])):g(``,!0),!r.endsTurn&&!f(G)?(_(),v(`div`,uu,[F(`button`,{type:`button`,class:`msg-reply`,onClick:e=>St(r.key)},[E(s,{name:`i-lucide-reply`}),F(`span`,null,M((`t`in t?t.t:f(Q))(`Reply`)),1)],8,du)])):g(``,!0)],64)):r.k===`thinking`?(_(),m(P,{key:5,class:`omp-thinking`,text:r.text,streaming:Le(r.id)!==null,duration:r.ms===void 0?void 0:Math.max(1,Math.round(r.ms/1e3)),"auto-close-delay":450,ui:{root:`omp-thinking`,trigger:`omp-thinking-head`,label:`omp-thinking-label`,content:`omp-thinking-content`,body:`omp-thinking-body`}},{default:V(()=>[E(D,{class:`md`,html:r.html,typing:Le(r.id),speed:(`reducedMotion`in t?t.reducedMotion:f(ci))?`off`:`fast`,cipher:!1,onDone:e=>Re(r.id)},null,8,[`html`,`typing`,`speed`,`onDone`])]),_:2},1032,[`text`,`streaming`,`duration`])):r.k===`job`?(_(),v(`div`,{key:6,class:j([`omp-job`,{err:r.error,open:ht(r.key)}])},[F(`button`,{type:`button`,class:`omp-job-head`,disabled:!r.out,"aria-expanded":r.out?ht(r.key):void 0,onClick:e=>gt(r.key,!ht(r.key))},[F(`span`,pu,M(r.error?`✗`:`✓`),1),F(`span`,mu,M((`tl`in t?t.tl:f(Z))(`Background job completed`,`Tâche de fond terminée`)),1),F(`code`,null,`[`+M(r.tool)+`] `+M(r.id),1),r.ms===void 0?g(``,!0):(_(),v(`span`,hu,M(f(es)(r.ms)),1)),r.out?(_(),m(s,{key:1,name:ht(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`])):g(``,!0)],8,fu),r.out&&ht(r.key)?(_(),v(`div`,gu,[F(`div`,_u,[F(`span`,vu,M(r.error?(`tl`in t?t.tl:f(Z))(`Error`,`Erreur`):(`tl`in t?t.tl:f(Z))(`Output`,`Sortie`)),1),r.ms===void 0?g(``,!0):(_(),v(`span`,yu,`wall `+M(f(es)(r.ms)),1))]),F(`pre`,null,M(r.out),1)])):g(``,!0)],2)):r.k===`shell`?(_(),v(`div`,{key:7,class:j([`msg-shell`,{bash:r.bash,long:r.long,open:ht(r.key)}])},[F(`div`,bu,[F(`span`,xu,M(r.bash?`!`:`❯`),1),F(`code`,null,M(r.text),1),E(z,{text:(`t`in t?t.t:f(Q))(`Copy command`),disabled:!(`desk`in t?t.desk:f(Xi))},{default:V(()=>[E(i,{icon:`i-lucide-copy`,color:`neutral`,variant:`ghost`,size:`xs`,class:`msg-shell-copy`,"aria-label":(`t`in t?t.t:f(Q))(`Copy command`),onClick:e=>f(ln)(r.bash?`!${r.text}`:r.text)},null,8,[`aria-label`,`onClick`])]),_:2},1032,[`text`,`disabled`])]),r.out||r.err?(_(),v(`div`,Su,[r.out?(_(),v(`pre`,Cu,M(r.out),1)):g(``,!0),r.err?(_(),v(`pre`,wu,M(r.err),1)):g(``,!0)])):r.bash?(_(),v(`div`,Tu,M((`t`in t?t.t:f(Q))(`No output`)),1)):g(``,!0),r.long?(_(),v(`button`,{key:2,type:`button`,class:`msg-shell-more`,"aria-expanded":ht(r.key),onClick:e=>gt(r.key,!ht(r.key))},[E(s,{name:ht(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),F(`span`,null,M(ht(r.key)?(`t`in t?t.t:f(Q))(`Collapse`):(`tl`in t?t.tl:f(Z))(`Show all · ${r.lines} lines`,`Tout afficher · ${r.lines} lignes`)),1)],8,Eu)):g(``,!0)],2)):r.k===`ompRun`?(_(),v(`div`,Du,[F(`div`,Ou,[F(`span`,ku,M(r.tool.omp.title===`Python`?`$`:`!`),1),F(`span`,null,M((`tl`in t?t.tl:f(Z))(`You ran`,`Lancé par toi`)),1)]),E(H,{tool:r.tool,run:``},null,8,[`tool`])])):r.k===`system`?(_(),v(`div`,Au,[F(`span`,null,M(r.text),1)])):r.k===`error`?(_(),v(`div`,{key:10,class:j([`msg-notice msg-error`,{long:r.long,open:ht(r.key)}])},[F(`div`,ju,[E(s,{name:`i-lucide-circle-alert`}),F(`span`,null,M((`t`in t?t.t:f(Q))(`Error`)),1)]),F(`div`,Mu,M(r.text),1),r.long?(_(),v(`button`,{key:0,type:`button`,class:`msg-shell-more`,"aria-expanded":ht(r.key),onClick:e=>gt(r.key,!ht(r.key))},[E(s,{name:ht(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),F(`span`,null,M(ht(r.key)?(`t`in t?t.t:f(Q))(`Collapse`):(`t`in t?t.t:f(Q))(`Show all`)),1)],8,Nu)):g(``,!0)],2)):r.k===`notice`?(_(),v(`div`,{key:11,class:j([`msg-notice`,{long:r.long,open:ht(r.key),scheduled:r.scheduled}])},[F(`div`,Pu,[E(s,{name:r.icon},null,8,[`name`]),F(`span`,null,M(r.label),1)]),E(D,{class:`msg-notice-body md`,html:r.html,typing:null},null,8,[`html`]),r.long?(_(),v(`button`,{key:0,type:`button`,class:`msg-shell-more`,"aria-expanded":ht(r.key),onClick:e=>gt(r.key,!ht(r.key))},[E(s,{name:ht(r.key)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),F(`span`,null,M(ht(r.key)?(`t`in t?t.t:f(Q))(`Collapse`):(`t`in t?t.t:f(Q))(`Show all`)),1)],8,Fu)):g(``,!0)],2)):r.k===`turn`?(_(),v(`div`,Iu,[r.copy?(_(),m(z,{key:0,text:(`t`in t?t.t:f(Q))(`Copy reply`),disabled:!(`desk`in t?t.desk:f(Xi))},{default:V(()=>[E(i,{icon:`i-lucide-copy`,color:`neutral`,variant:`ghost`,size:`xs`,class:`turn-copy`,"aria-label":(`t`in t?t.t:f(Q))(`Copy reply`),onClick:e=>f(ln)(r.copy)},null,8,[`aria-label`,`onClick`])]),_:2},1032,[`text`,`disabled`])):g(``,!0),r.reply&&!f(G)?(_(),v(`button`,{key:1,type:`button`,class:`msg-reply`,onClick:e=>St(r.reply)},[E(s,{name:`i-lucide-reply`}),F(`span`,null,M((`t`in t?t.t:f(Q))(`Reply`)),1)],8,Lu)):g(``,!0),F(`span`,null,M(r.text),1)])):r.k===`tools`&&f(cs)(r.list)?(_(),v(`div`,{key:13,class:j([`tools omp-console`,{live:r.live}])},[n[16]||=F(`span`,{class:`fx-ring omp-ring`,"aria-hidden":`true`},[F(`span`,{class:`fx-spin`})],-1),F(`div`,Ru,[n[15]||=F(`span`,{class:`omp-console-title`},`omp`,-1),F(`span`,null,M(r.list.length)+` `+M((`t`in t?t.t:f(Q))(`actions`)),1),f(ss)(r.list)?(_(),v(`span`,zu,`Σ `+M(f(es)(f(ss)(r.list))),1)):g(``,!0)]),at(r).hidden||r.list.length>f(3)&&ht(r.key)?(_(),v(`button`,{key:0,type:`button`,class:`omp-console-more`,"aria-expanded":ht(r.key),onClick:e=>gt(r.key,!ht(r.key))},[at(r).hidden?(_(),v(k,{key:0},[a(`⋯ `+M((`tl`in t?t.tl:f(Z))(`${at(r).hidden} earlier actions`,`${at(r).hidden} actions avant`)),1)],64)):(_(),v(k,{key:1},[a(`⋯ `+M((`t`in t?t.t:f(Q))(`Collapse`)),1)],64))],8,Bu)):g(``,!0),(_(!0),v(k,null,y(ut(r),(e,t)=>(_(),m(u,{key:`h${t}`,class:`tool-thumbs`,srcs:e,max:kd,offline:f(G),dupes:f(lt)},null,8,[`srcs`,`offline`,`dupes`]))),128)),(_(!0),v(k,null,y(at(r).rows,(e,t)=>(_(),v(k,{key:`${r.key}:${r.list.length-at(r).rows.length+t}`},[E(H,{tool:{...e,omp:e.omp},live:r.live&&e===r.list[r.list.length-1]},null,8,[`tool`,`live`]),e.images?(_(),m(u,{key:0,class:`tool-thumbs`,srcs:ct(e),max:kd,offline:f(G),dupes:f(lt)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128))],2)):r.k===`tools`?(_(),v(`div`,{key:14,class:j([`tools`,{live:r.live}])},[r.list.length<=3?(_(!0),v(k,{key:0},y(r.list,(e,t)=>(_(),v(k,{key:t},[E(K,{text:nt(e),suffix:et(e),icon:rt(e),loading:r.live&&t===r.list.length-1,streaming:r.live&&t===r.list.length-1,ui:{root:`tool`,trigger:`tool-trigger`,label:`tool-label`,suffix:`tool-suffix`,leading:`tool-leading`},class:j({err:e.error})},null,8,[`text`,`suffix`,`icon`,`loading`,`streaming`,`class`]),e.images?(_(),m(u,{key:0,class:`tool-thumbs`,srcs:ct(e),max:kd,offline:f(G),dupes:f(lt)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128)):(_(),m(K,{key:1,open:ht(r.key),text:`${r.list.length} ${(`t`in t?t.t:f(Q))(`actions`)}`,suffix:it(r.list[r.list.length-1]),icon:r.live?void 0:`i-lucide-layers`,loading:r.live,streaming:r.live,chevron:`trailing`,ui:{root:`tool group`,trigger:`tool-trigger`,label:`tool-label`,suffix:`tool-suffix`,leading:`tool-leading`,body:`tool-body`,trailingIcon:`tool-chev`},"onUpdate:open":e=>gt(r.key,e)},{default:V(()=>[(_(!0),v(k,null,y(r.list,(e,t)=>(_(),v(k,{key:t},[F(`div`,{class:j([`tool-row`,{err:e.error}])},[E(s,{name:rt(e)},null,8,[`name`]),F(`b`,null,M(nt(e)),1),F(`span`,null,M(et(e)),1)],2),e.images?(_(),m(u,{key:0,class:`tool-thumbs`,srcs:ct(e),max:kd,offline:f(G),dupes:f(lt)},null,8,[`srcs`,`offline`,`dupes`])):g(``,!0)],64))),128))]),_:2},1032,[`open`,`text`,`suffix`,`icon`,`loading`,`streaming`,`onUpdate:open`])),(_(!0),v(k,null,y(ut(r),(e,t)=>(_(),m(u,{key:`h${t}`,class:`tool-thumbs`,srcs:e,max:kd,offline:f(G),dupes:f(lt)},null,8,[`srcs`,`offline`,`dupes`]))),128))],2)):g(``,!0)],64))),128)),f(R)&&!f(T).length&&!f(I)?(_(),v(`div`,Vu,[E(s,{name:`i-lucide-message-square-dashed`,class:`chat-empty-icon`}),F(`p`,null,M((`t`in t?t.t:f(Q))(`No messages yet.`)),1)])):g(``,!0),f(I)?(_(),v(`div`,Hu,[F(`p`,null,M(f(I)),1)])):g(``,!0)],64))],34),(_(),m(ee,{to:`body`},[f(Wt)?(_(),v(`button`,{key:0,ref_key:`selBtn`,ref:Gt,type:`button`,class:`sel-reply`,style:N({top:`${f(Wt).top}px`,left:`${f(Wt).left}px`}),"aria-label":(`t`in t?t.t:f(Q))(`Reply to this passage`),onPointerdown:n[6]||=re(()=>{},[`prevent`]),onMousedown:n[7]||=re(()=>{},[`prevent`]),onClick:n[8]||=e=>Ct(f(Ji)(f(Wt).text,f(Wt).time,f(Wt).id))},[E(s,{name:`i-lucide-reply`}),F(`span`,null,M((`t`in t?t.t:f(Q))(`Reply`)),1)],44,Uu)):g(``,!0)])),f(zn).length||f(Fn)||f(Pn)?.sendNow?(_(),v(`div`,Wu,[!f(G)&&f(Pn)?.sendNow?(_(),v(`div`,Gu,[F(`button`,{type:`button`,class:`queued-cancel`,disabled:f(Bn),onClick:Vn},M((`t`in t?t.t:f(Q))(`Send now`)),9,Ku)])):g(``,!0),(_(!0),v(k,null,y(f(zn).filter(e=>e.phase===`sent`),e=>(_(),v(`div`,{key:e.id,class:`msg-user-wrap`},[e.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Q))(`Show original message`),onClick:t=>cn(e.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),F(`span`,Ju,M(e.reply.time),1),F(`span`,Yu,M(e.reply.excerpt),1)],8,qu)):g(``,!0),E(w,{id:`q:${e.id}`,role:`user`,side:`right`,variant:`soft`,parts:Hn(e),ui:{root:`msg msg-user msg-pending sent${e.body||e.files.length?``:` msg-no-text`}`,container:`msg-c`,content:`msg-bubble`,header:`msg-files`}},{files:V(()=>[e.srcs.length?(_(),m(u,{key:0,srcs:e.srcs},null,8,[`srcs`])):g(``,!0),(_(!0),v(k,null,y(e.missing,e=>(_(),v(`span`,{key:e,class:`thumb-missing`,title:(`t`in t?t.t:f(Q))(`Image`)},[E(s,{name:`i-lucide-image`})],8,Xu))),128))]),content:V(()=>[e.files.length?(_(),v(`span`,Zu,[(_(!0),v(k,null,y(e.files,e=>(_(),m(h,{key:e.path,name:e.name,clickable:``,onOpen:t=>En(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(S,{text:e.body,pasted:e.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),F(`div`,Qu,[E(s,{name:`i-lucide-check`}),F(`span`,null,M((`t`in t?t.t:f(Q))(`Sent · read by the agent`)),1)])]))),128)),f(Fn)?(_(),v(`div`,$u,[F(`div`,ed,[F(`div`,td,[F(`span`,nd,M(e.pane.agent===`omp`?f(Fn).python?`>>>`:`$`:`!`),1),F(`code`,null,M(f(Fn).command),1)]),f(Fn).lines.length?(_(),v(`div`,rd,[f(Fn).hidden?(_(),v(`div`,id,M((`tl`in t?t.tl:f(Z))(`+ ${f(Fn).hidden} lines above`,`+ ${f(Fn).hidden} lignes au-dessus`)),1)):g(``,!0),F(`pre`,ad,M(f(Fn).lines.join(`
25
+ `)),1)])):(_(),v(`div`,od,M((`t`in t?t.t:f(Q))(`No output yet`)),1))]),F(`div`,sd,[E(s,{name:`i-lucide-loader-circle`,class:`spin`}),F(`span`,null,[a(M((`t`in t?t.t:f(Q))(`Running`)),1),f(Rn)?(_(),v(k,{key:0},[a(` · `+M(f(Rn)),1)],64)):g(``,!0)])])])):g(``,!0),(_(!0),v(k,null,y(f(zn).filter(e=>e.phase===`queued`),r=>(_(),v(`div`,{key:r.id,class:`msg-user-wrap`},[r.reply?(_(),v(`button`,{key:0,type:`button`,class:`msg-quote`,"aria-label":(`t`in t?t.t:f(Q))(`Show original message`),onClick:e=>cn(r.origin)},[E(s,{name:`i-lucide-corner-left-up`,class:`msg-quote-time`}),F(`span`,ld,M(r.reply.time),1),F(`span`,ud,M(r.reply.excerpt),1)],8,cd)):g(``,!0),E(w,{id:`q:${r.id}`,role:`user`,side:`right`,variant:`soft`,parts:Hn(r),ui:{root:`msg msg-user msg-pending queued${r.body||r.files.length?``:` msg-no-text`}`,container:`msg-c`,content:`msg-bubble queued`,header:`msg-files`}},{files:V(()=>[r.srcs.length?(_(),m(u,{key:0,srcs:r.srcs},null,8,[`srcs`])):g(``,!0),(_(!0),v(k,null,y(r.missing,e=>(_(),v(`span`,{key:e,class:`thumb-missing`,title:(`t`in t?t.t:f(Q))(`Image`)},[E(s,{name:`i-lucide-image`})],8,dd))),128))]),content:V(()=>[r.files.length?(_(),v(`span`,fd,[(_(!0),v(k,null,y(r.files,e=>(_(),m(h,{key:e.path,name:e.name,clickable:``,onOpen:t=>En(t,e.path)},null,8,[`name`,`onOpen`]))),128))])):g(``,!0),E(S,{text:r.body,pasted:r.pasted},null,8,[`text`,`pasted`])]),_:2},1032,[`id`,`parts`,`ui`]),r.state===`failed`?(_(),v(`div`,pd,[E(s,{name:`i-lucide-circle-alert`}),F(`span`,null,M(nr(r.reason)),1),F(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(Jn),onClick:e=>Yn(r)},[E(s,{name:f(Jn)===r.id?`i-lucide-loader-circle`:`i-lucide-rotate-cw`,class:j({spin:f(Jn)===r.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Q))(`Retry`)),1)],8,md),F(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f(Wn),onClick:e=>Gn(r)},[E(s,{name:f(Wn)===r.id?`i-lucide-loader-circle`:`i-lucide-undo-2`,class:j({spin:f(Wn)===r.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Q))(`Cancel`)),1)],8,hd)])):(_(),v(`div`,gd,[E(s,{name:`i-lucide-clock`}),F(`span`,null,M(or(r)),1),f(Jc)(e.pane,r)?(_(),v(`button`,{key:0,type:`button`,class:`queued-cancel`,disabled:!!f(ir),onClick:e=>ar(r)},M((`t`in t?t.t:f(Q))(`Clear and send`)),9,_d)):g(``,!0),r.state===`held`&&f(qc)(e.pane,r)!==`working`?(_(),v(`button`,{key:1,type:`button`,class:`queued-cancel`,onClick:n[9]||=e=>d(`gotoTerm`)},M((`t`in t?t.t:f(Q))(`Open terminal`)),1)):g(``,!0),r.state!==`sending`&&(f(Un)||r.state===`held`)&&r.raw?(_(),v(`button`,{key:2,type:`button`,class:`queued-cancel`,disabled:!!f(Wn),onClick:e=>Gn(r)},[E(s,{name:f(Wn)===r.id?`i-lucide-loader-circle`:`i-lucide-undo-2`,class:j({spin:f(Wn)===r.id})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Q))(`Cancel`)),1)],8,vd)):g(``,!0)]))]))),128)),f(Xn)?(_(),v(`div`,yd,[F(`p`,bd,[E(s,{name:`i-lucide-square-terminal`}),F(`span`,null,M((`t`in t?t.t:f(Q))(`A menu is still open in the agent’s terminal. Your messages wait for it to close.`)),1)]),F(`div`,xd,[F(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f($n),onClick:n[10]||=e=>tr(`close`)},[E(s,{name:f($n)===`close`?`i-lucide-loader-circle`:`i-lucide-x`,class:j({spin:f($n)===`close`})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Q))(`Close menu`)),1)],8,Sd),F(`button`,{type:`button`,class:`queued-cancel`,disabled:!!f($n),onClick:n[11]||=e=>tr(`send`)},[E(s,{name:f($n)===`send`?`i-lucide-loader-circle`:`i-lucide-send`,class:j({spin:f($n)===`send`})},null,8,[`name`,`class`]),a(M((`t`in t?t.t:f(Q))(`Send anyway`)),1)],8,Cd)])])):g(``,!0)])):g(``,!0),f(mr)?(_(),v(`div`,{key:1,class:j([`chat-status`,{typing:f(mr).typing,waiting:!f(mr).typing}])},[`verb`in f(mr)?(_(),v(`span`,wd,[E(ie),E(ae,{text:f(mr).text,duration:2.4,class:`claude-verb`},null,8,[`text`])])):`omp`in f(mr)?(_(),v(`span`,Td,[E(J,{since:f(mr).since},{default:V(()=>[E(ae,{text:f(mr).text,duration:2.4,class:`omp-step`},null,8,[`text`])]),_:1},8,[`since`])])):(_(),v(k,{key:2},[n[17]||=F(`i`,{class:`status-dot`},null,-1),f(mr).typing?(_(),m(ae,{key:0,text:f(mr).text,duration:2.4},null,8,[`text`])):(_(),v(`span`,Ed,M(f(mr).text),1))],64))],2)):g(``,!0)]),_:1},8,[`status`])],544),(`sheetMenus`in t?t.sheetMenus:f(ji))?g(``,!0):(_(),m(se,{key:3,open:f(vn).open,"onUpdate:open":n[12]||=e=>f(vn).open=e,items:f(yn),content:{align:`start`,side:`bottom`,sideOffset:4},ui:{content:`hw-dropdown`}},{default:V(()=>[F(`span`,{class:`path-anchor`,style:N({left:`${f(vn).x}px`,top:`${f(vn).y}px`,width:`${f(vn).w}px`,height:`${f(vn).h}px`}),"aria-hidden":`true`},null,4)]),_:1},8,[`open`,`items`])),E(le,{open:f(Dn).open,"onUpdate:open":n[13]||=e=>f(Dn).open=e,title:wn(f(la)(f(Dn).path)),wide:``,full:``,screen:``},{default:V(()=>[f(Dn).open?(_(),m(ce,{key:f(Dn).path,"pane-id":e.pane.id,file:f(Dn).path},null,8,[`pane-id`,`file`])):g(``,!0)]),_:1},8,[`open`,`title`])])],64)}}}),{__name:`ChatView`});function Md(e,t,n,r){return t===1?e*n:t===2?e*n*Math.max(1,r):e}function Nd(e,t){let n=t>0?t:16,r=Math.trunc(e/n);return{lines:r,rest:e-r*n}}function Pd(e,t){let n=Math.max(1,t);return Math.max(-n,Math.min(n,e))}function Fd({vertical:e,momentum:t,horizontal:n,canHorizontal:r,maxMomentum:i,now:a=()=>performance.now(),frame:o=e=>requestAnimationFrame(e),cancelFrame:s=e=>cancelAnimationFrame(e)}){let c=null,l={x:0,y:0},u=0,d=null,f=0,p=[],m=0,h=()=>{m&&s(m),m=0},g=()=>{h(),c=null,f=0,d=null,p=[]};return{start(e,t){g(),c=l={x:e,y:t},u=a()},move(t,i){if(!c)return;let o=a(),s={x:t,y:i},m=t-l.x,h=i-l.y,g=Math.max(1,o-u);if(!d){let e=t-c.x,n=i-c.y;if(Math.hypot(e,n)<5)return;d=r()&&Math.abs(e)>Math.abs(n)*1.25?`x`:`y`}if(d===`x`)n(m);else{e(h,s),h&&f&&Math.sign(h)!==Math.sign(f)&&(p=[]),p.push({dy:h,dt:g});let t=0,n=p.length;for(;n>0&&t<100;)t+=p[--n].dt;p=p.slice(n);let r=p.reduce((e,t)=>e+t.dt,0);f=Math.max(-3,Math.min(3,p.reduce((e,t)=>e+t.dy,0)/Math.max(1,r)))}l=s,u=o},end(){if(!c)return!1;let n=d===null;c=null;let r=a()-u;if(d!==`y`||r>90||(f*=Math.exp(-Math.max(0,r-25)/50),Math.abs(f)<.16))return n;let s=a(),p=s,h=0,g=Math.max(0,i()),_=()=>{m=0;let n=a(),r=Math.min(40,Math.max(0,n-p));p=n,f*=Math.exp(-r/170);let i=Math.sign(f)*Math.min(Math.abs(f*r),Math.max(0,g-h));h+=Math.abs(i),i&&(t??e)(i,l),Math.abs(f)>.045&&n-s<750&&h<g&&(m=o(_))};return m=o(_),n},stopMomentum:h,cancel:g}}function Id(e){return!/^Apple\b/.test(e??``)}function Ld(e,t){return e??t<700}var Rd={key:0,class:`term-loading`},zd={key:1,class:`terminal-selection-hint`},Bd=[`aria-label`],Vd=Object.assign(T({__name:`TerminalView`,props:{ctl:{}},setup(e){let t=e,n=h(null),r=null,i=null,o=0,s=0,c=0,u=!1,d=()=>{c=0,s&&=(t.ctl.scroll(s),0)},p=e=>{s+=e,c||=requestAnimationFrame(d)},m=Id(navigator.vendor);function y(e){r=e.touches[0].clientY,i=e.touches[0].clientX,o=0,u=!1}function b(e){if(e.preventDefault(),r===null)return;let a=e.touches[0].clientY,s=e.touches[0].clientX,c=i===null?0:s-i,l=a-r;i=s;let d=n.value?.querySelector(`.xterm`);if(d&&d.scrollWidth>d.clientWidth&&Math.abs(c)>Math.abs(l)){d.scrollLeft-=c,r=a,u=!0;return}o+=l,r=a;let{lines:f,rest:m}=Nd(o,t.ctl.rowHeight());o=m,f&&(u=!0,p(f))}function x(e){let n=e.changedTouches[0];r=null,i=null,u||(n&&(t.ctl.tapLink(n.clientX,n.clientY)?e.preventDefault():t.ctl.tapMouse(n.clientX,n.clientY)),t.ctl.blur(),document.activeElement?.blur?.())}function S(){t.ctl.focus()}function C(e){e.preventDefault(),e.stopPropagation();let r=n.value?.querySelector(`.xterm`);if(r&&r.scrollWidth>r.clientWidth&&(e.shiftKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))){r.scrollLeft+=e.shiftKey?e.deltaY:e.deltaX;return}let i=t.ctl.rowHeight();o-=Md(e.deltaY,e.deltaMode,i,t.ctl.pageRows());let{lines:a,rest:s}=Nd(o,i);o=s,a&&p(a)}let T=0,E=0,D=0,O=0,k=0,A=0,N,I=0,L=0,R=-1/0,B=-1/0,V=!1,H=!1,ee=!1,U=()=>n.value?.querySelector(`.xterm-screen`),W=()=>{let e=U();if(!e)return;let n=ui.value?Pd(T+(E+D)*t.ctl.rowHeight(),t.ctl.rowHeight()):0;e.style.willChange=n?`transform`:``,e.style.transform=n?`translate3d(0, ${n}px, 0)`:``};function G(){ee&&(clearTimeout(N),N=setTimeout(()=>{D=E=T=0,cancelAnimationFrame(k),k=0,t.ctl.cancelTouchScroll(),W()},180))}function K(){if(k=0,!E)return;let e=E;E=0,t.ctl.scroll(e,I,L,0,!0)?D+=e:D=T=0,W(),G()}z(t.ctl.scrollAck,(e,t)=>{let n=e-t;n&&ui.value&&(Math.sign(n)===Math.sign(D)&&(D-=Math.sign(n)*Math.min(Math.abs(n),Math.abs(D))),cancelAnimationFrame(A),A=requestAnimationFrame(()=>{A=0,W()}))},{flush:`sync`});let te=()=>n.value?.querySelector(`.xterm`),ne=Fd({vertical(e,n){B=performance.now(),D&&Math.sign(e)!==Math.sign(D)&&(t.ctl.cancelTouchScroll(),D=E=T=0),I=n.x,L=n.y,T+=e;let{lines:r,rest:i}=Nd(T,t.ctl.rowHeight());T=i,E+=r,ee=!0,r&&!k&&(k=requestAnimationFrame(K)),W(),G()},momentum(e,n){B=performance.now(),O+=e;let{lines:r,rest:i}=Nd(O,t.ctl.rowHeight());O=i,r&&t.ctl.scroll(r,n.x,n.y,0,!0,!1)},horizontal(e){B=performance.now();let t=te();t&&(t.scrollLeft-=e)},canHorizontal:()=>{let e=te();return!!e&&e.scrollWidth>e.clientWidth},maxMomentum:()=>t.ctl.rowHeight()*t.ctl.pageRows()*1.5});function q(){ne.cancel(),cancelAnimationFrame(k),k=0,cancelAnimationFrame(A),A=0,clearTimeout(N),E=D=O=T=0,ee&&t.ctl.cancelTouchScroll(),ee=!1,W()}z(t.ctl.scrollInputVersion,q),z(ti,e=>{e||q()}),z(ui,()=>{q(),cancelAnimationFrame(c),c=0,s=o=0,i=r=null},{flush:`sync`});function ie(e){if(R=performance.now(),!ui.value)return y(e);V=R-B<700,H=!1,q(),e.touches.length===1&&ne.start(e.touches[0].clientX,e.touches[0].clientY)}function ae(e){if(!ui.value)return b(e);if(e.preventDefault(),e.touches.length!==1){q();return}ne.move(e.touches[0].clientX,e.touches[0].clientY)}function J(e){if(R=performance.now(),!ui.value)return x(e);let n=e.changedTouches[0];H=ne.end()&&!V,H?(n&&(t.ctl.tapLink(n.clientX,n.clientY)?(H=!1,e.preventDefault()):t.ctl.tapMouse(n.clientX,n.clientY)),t.ctl.blur(),document.activeElement?.blur?.()):e.preventDefault(),G()}function oe(e){let n=Ld(e.sourceCapabilities?.firesTouchEvents,performance.now()-R);if(n&&!m){H=!1;return}if(!ui.value)return S();(!n||H)&&(H=!1,t.ctl.focus())}function se(e){ui.value&&q(),C(e)}let ce;function le(){ui.value&&q(),!ce&&(ce=setTimeout(()=>{ce=void 0,t.ctl.fitNow(!0)},50))}z(Fn,le);let ue=null;return w(()=>{document.addEventListener(`pointerdown`,q,!0),t.ctl.mount(n.value),P(()=>{t.ctl.fitNow(!1),t.ctl.hasBanner()||t.ctl.connect(!1)}),ue=new ResizeObserver(le),ue.observe(n.value)}),l(()=>{document.removeEventListener(`pointerdown`,q,!0),q(),ue?.disconnect(),clearTimeout(ce),cancelAnimationFrame(c),t.ctl.dispose()}),(t,r)=>(_(),v(`div`,{id:`termWrap`,class:j({"smooth-touch":`smoothTouchScrolling`in t?t.smoothTouchScrolling:f(ui)}),onWheelCapture:se},[F(`div`,{id:`term`,ref_key:`host`,ref:n},null,512),F(`div`,{id:`touch`,"aria-hidden":`true`,onTouchstartPassive:ie,onTouchmove:ae,onTouchend:J,onTouchcancel:q,onMousedown:re(oe,[`prevent`])},null,32),e.ctl.loading.value?(_(),v(`div`,Rd,[...r[1]||=[F(`span`,{class:`spinner`},null,-1)]])):g(``,!0),e.ctl.selectionHint.visible.value?(_(),v(`div`,zd,[a(M((`tl`in t?t.tl:f(Z))(`Shift + drag to select`,`Shift + glisser pour sélectionner`))+` `,1),F(`button`,{type:`button`,"aria-label":(`t`in t?t.t:f(Q))(`Hide`),onClick:r[0]||=t=>e.ctl.selectionHint.dismiss()},`×`,8,Bd)])):g(``,!0)],34))}}),{__name:`TerminalView`});function Hd(e,t,n,r=20){return t>=e.left-r&&t<=e.right+r&&n>=e.top-r&&n<=e.bottom+r}function Ud(e){let t=null,n=()=>{t!==null&&e.press?.(!1),t=null};return{start(r){n();let i=r.changedTouches[0];r.touches.length===1&&i&&e.enabled()&&(r.preventDefault(),t=i.identifier,e.press?.(!0))},end(r){if(t===null)return;let i=Array.from(r.changedTouches).find(e=>e.identifier===t);if(!i)return;n(),r.preventDefault();let a=r.currentTarget;a&&Hd(a.getBoundingClientRect(),i.clientX,i.clientY,e.slop)&&e.enabled()&&e.run()},cancel:n}}function Wd(e){let t=null,n=-1/0;function r(e){let n=e.changedTouches[0];t=e.touches.length===1&&n?{id:n.identifier,x:n.clientX,y:n.clientY}:null}function i(e){let n=t&&Array.from(e.changedTouches).find(e=>e.identifier===t.id);n&&Math.hypot(n.clientX-t.x,n.clientY-t.y)>10&&(t=null)}function a(r){let i=t&&Array.from(r.changedTouches).find(e=>e.identifier===t.id);if(t=null,!i)return;let a=r.currentTarget;a&&Hd(a.getBoundingClientRect(),i.clientX,i.clientY)&&(r.preventDefault(),n=performance.now(),e())}function o(){t=null}function s(){performance.now()-n<700||e()}return{start:r,move:i,end:a,cancel:o,click:s}}var Gd=[`ctrl`,`alt`,`shift`];function Kd(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function qd(e,t){let n=(e===`+`?`plus`:e).toLowerCase().split(`+`),r=n.pop(),i=new Set([...t,...n]);return[...Gd.filter(e=>i.has(e)),r].join(`+`)}var Jd={"\r":`enter`,"\n":`enter`," ":`tab`,"\x1B":`esc`,"":`backspace`,"\b":`backspace`," ":`space`,"\x1B[A":`up`,"\x1B[B":`down`,"\x1B[C":`right`,"\x1B[D":`left`,"\x1BOA":`up`,"\x1BOB":`down`,"\x1BOC":`right`,"\x1BOD":`left`,"\x1B[Z":`shift+tab`};function Yd(e){if(Object.hasOwn(Jd,e))return Jd[e];if(/^[!-~]$/.test(e)){if(e===`+`)return`plus`;let t=e.toLowerCase();return t===e?t:`shift+${t}`}if(e.length===1){let t=e.charCodeAt(0);if(t===0)return`ctrl+space`;if(t>=1&&t<=26)return`ctrl+${String.fromCharCode(t+96)}`}return null}function Xd(){let e=!1,t=!1;return{start(){e=!0,t=!1},end(){e=!1,t=!0},keydown(n){!e&&!n?.isComposing&&n?.keyCode!==229&&(t=!1)},get active(){return e},takeEnded(){let e=t;return t=!1,e}}}function Zd(e){let t={ctrl:`Ctrl`,alt:`Alt`,shift:`Shift`,super:`Win/⌘`,left:`←`,right:`→`,up:`↑`,down:`↓`,enter:`Enter`,tab:`Tab`,esc:`Esc`,space:`Space`,backspace:`⌫`,delete:`Del`,plus:`+`,home:`Home`,end:`End`,pageup:`PgUp`,pagedown:`PgDn`};return e.split(`+`).map(e=>t[e]||e.toUpperCase()).join(` + `)}function Qd(e){let t=e.split(`+`),n={home:`H`,end:`F`,insert:`2~`,delete:`3~`,pageup:`5~`,pagedown:`6~`}[t.pop()];if(!n)return null;let r={shift:1,alt:2,ctrl:4,super:8},i=1+t.reduce((e,t)=>e|(r[t]||0),0);return i===1?`\x1b[${n}`:n.endsWith(`~`)?`\x1b[${n.slice(0,-1)};${i}~`:`\x1b[1;${i}${n}`}function $d(e){return Array.from(Qd(e)||``,e=>Yd(e))}var ef=[`aria-label`],tf={class:`vk-announcement`,"aria-live":`polite`},nf=[`aria-label`],rf=[`data-key`,`aria-pressed`,`aria-label`,`onClick`,`onTouchstartPassive`,`onTouchmovePassive`,`onTouchend`,`onTouchcancel`],af=[`aria-label`,`onClick`],of=Object.assign(ia(T({__name:`PhoneKeybar`,props:{ctl:{},allDigits:{type:Boolean},terminal:{type:Boolean}},emits:[`keyboard`],setup(e,{emit:t}){let r=e,i=t,o=n(()=>_i.value.map(e=>da[e])),s=[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`0`],c=n(()=>r.ctl.virtualModifiers.value),l=n(()=>c.value.length?`${Zd(c.value.join(`+`))} + …`:r.ctl.lastVirtualChord.value||Q(`One-shot chord`));function u(e){$(),r.ctl.toggleVirtualModifier(e)}function d(e){$(),r.ctl.sendVirtualKey(e)}function p(){if(!r.terminal){i(`keyboard`);return}r.ctl.hasFocus()?r.ctl.blur():r.ctl.focus()}let h=Wd(p),b=e=>e.kind===`keyboard`;function x(e){b(e)?h.click():e.kind===`modifier`?u(e.modifier):d(e.send)}let S=e=>b(e)?!!(r.terminal&&r.ctl.kbdOn.value):e.kind===`modifier`&&c.value.includes(e.modifier);return(t,n)=>{let r=Qe;return _(),v(`div`,{class:`keybar virtual-keyboard`,role:`group`,"aria-label":(`t`in t?t.t:f(Q))(`Terminal function keys`)},[F(`output`,tf,M(f(l)),1),F(`div`,{class:`vk-strip`,role:`toolbar`,"aria-label":(`t`in t?t.t:f(Q))(`Common keys and modifiers`)},[(_(!0),v(k,null,y(f(o),e=>(_(),v(`button`,{key:e.id,type:`button`,"data-key":e.id,class:j({"vk-mod":e.kind===`modifier`,danger:e.danger,selected:S(e)}),"aria-pressed":e.kind===`modifier`?S(e):void 0,"aria-label":e.label(),onPointerdown:n[0]||=re(()=>{},[`prevent`]),onClick:t=>x(e),onTouchstartPassive:t=>b(e)&&f(h).start(t),onTouchmovePassive:t=>b(e)&&f(h).move(t),onTouchend:t=>b(e)&&f(h).end(t),onTouchcancel:t=>b(e)&&f(h).cancel()},[e.icon&&e.kind===`keyboard`?(_(),m(r,{key:0,name:e.icon,mode:`svg`},null,8,[`name`])):e.icon?(_(),m(r,{key:1,name:e.icon,mode:`svg`,class:`vk-key-icon`,"aria-hidden":`true`},null,8,[`name`])):(_(),v(k,{key:2},[a(M(e.cap()),1)],64))],42,rf))),128)),e.allDigits?(_(),v(k,{key:0},y(s,e=>F(`button`,{key:e,type:`button`,"aria-label":e,onPointerdown:n[1]||=re(()=>{},[`prevent`]),onClick:t=>d(e)},M(e),41,af)),64)):g(``,!0)],8,nf)],8,ef)}}}),[[`__scopeId`,`data-v-53ea1dfd`]]),{__name:`PhoneKeybar`}),sf=[`aria-label`],cf=[`aria-label`,`aria-pressed`,`onClick`],lf=[`onClick`],uf=[`aria-label`],df=Object.assign(ia(T({__name:`Keybar`,props:{ctl:{},allDigits:{type:Boolean},compact:{type:Boolean},terminal:{type:Boolean}},emits:[`keyboard`],setup(e,{emit:t}){let r=e,i=t,a={ctrl:`Ctrl`,alt:`Alt`,shift:`Shift`},o=n(()=>r.ctl.virtualModifiers.value);function s(e){$(),r.ctl.toggleModifier(e)}let c=[{key:`esc`,label:`esc`},{key:`enter`,label:`⏎`,cls:`wide`},{key:`up`,label:`↑`},{key:`down`,label:`↓`},{key:`1`,label:`1`},{key:`2`,label:`2`},{key:`3`,label:`3`},{key:`tab`,label:`tab`},{key:`shift+tab`,label:`⇧tab`},{key:`left`,label:`←`},{key:`right`,label:`→`},{key:`ctrl+c`,label:`^C`,cls:`danger`},{key:`backspace`,label:`⌫`},{key:`y`,label:`y`},{key:`n`,label:`n`}],l=n(()=>r.allDigits?[...c.slice(0,7),...[`4`,`5`,`6`,`7`,`8`,`9`,`0`].map(e=>({key:e,label:e})),...c.slice(7)]:c);function u(e){$(),r.ctl.sendVirtualKey(e)}function d(){r.ctl.hasFocus()?r.ctl.blur():r.ctl.focus()}let p=Wd(d);return(t,n)=>{let r=of,c=Qe;return e.compact?(_(),m(r,{key:0,ctl:e.ctl,"all-digits":e.allDigits,terminal:e.terminal,onKeyboard:n[0]||=e=>i(`keyboard`)},null,8,[`ctl`,`all-digits`,`terminal`])):(_(),v(`div`,{key:1,class:`keybar`,role:`toolbar`,"aria-label":(`t`in t?t.t:f(Q))(`Keys`)},[(_(!0),v(k,null,y(f(Gd),e=>(_(),v(`button`,{key:e,type:`button`,class:`key-modifier`,"aria-label":(`t`in t?t.t:f(Q))(a[e]),"aria-pressed":f(o).includes(e),onPointerdown:n[1]||=re(()=>{},[`prevent`]),onClick:t=>s(e)},M((`t`in t?t.t:f(Q))(a[e])),41,cf))),128)),(_(!0),v(k,null,y(f(l),e=>(_(),v(`button`,{key:e.key,type:`button`,class:j(e.cls),onPointerdown:n[2]||=re(()=>{},[`prevent`]),onClick:t=>u(e.key)},M(e.label),43,lf))),128)),F(`button`,{type:`button`,class:j([`kbd`,{on:e.ctl.kbdOn.value}]),"aria-label":(`t`in t?t.t:f(Q))(`Type in terminal`),onPointerdown:n[3]||=re(()=>{},[`prevent`]),onClick:n[4]||=(...e)=>f(p).click&&f(p).click(...e),onTouchstartPassive:n[5]||=(...e)=>f(p).start&&f(p).start(...e),onTouchmovePassive:n[6]||=(...e)=>f(p).move&&f(p).move(...e),onTouchend:n[7]||=(...e)=>f(p).end&&f(p).end(...e),onTouchcancel:n[8]||=(...e)=>f(p).cancel&&f(p).cancel(...e)},[E(c,{name:`i-lucide-keyboard`})],42,uf)],8,sf))}}}),[[`__scopeId`,`data-v-e476eb50`]]),{__name:`Keybar`}),ff=`wherdr.mouse-selection-hint.dismissed`,pf=h(!1),mf=!1;function hf(){if(!mf&&typeof localStorage<`u`){mf=!0;try{pf.value=localStorage.getItem(ff)===`1`}catch{}}let e=h(!1),t=typeof matchMedia<`u`&&matchMedia(`(hover: hover) and (pointer: fine)`).matches,r=n(()=>t&&e.value&&!pf.value);function i(t,n=!1){e.value=n||t.modes.mouseTrackingMode!==`none`}function a(){pf.value=!0;try{localStorage.setItem(ff,`1`)}catch{}}return{visible:r,refresh:i,dismiss:a}}var gf=e(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(globalThis,(()=>(()=>{var e={4567:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;let a=n(9042),o=n(9924),s=n(844),c=n(4725),l=n(2585),u=n(3656),d=t.AccessibilityManager=class extends s.Disposable{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``,this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new o.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this.register(this._terminal.onResize((e=>this._handleResize(e.rows)))),this.register(this._terminal.onRender((e=>this._refreshRows(e.start,e.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((e=>this._handleChar(e)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
25
26
  `)))),this.register(this._terminal.onA11yTab((e=>this._handleTab(e)))),this.register(this._terminal.onKey((e=>this._handleKey(e.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,u.addDisposableDomListener)(document,`selectionchange`,(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,s.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
26
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.innerText=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error(`anchorNode and/or focusNode are null`);let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=d=r([i(1,l.IInstantiationService),i(2,c.ICoreBrowserService),i(3,c.IRenderService)],d)},3614:(e,t)=>{function n(e){return e.replace(/\r?\n/g,`\r`)}function r(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function i(e,t,i,a){e=r(e=n(e),i.decPrivateModes.bracketedPasteMode&&!0!==a.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=``}function a(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=n,t.bracketTextForPaste=r,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,n,r){e.stopPropagation(),e.clipboardData&&i(e.clipboardData.getData(`text/plain`),t,n,r)},t.paste=i,t.moveTextAreaUnderMouseCursor=a,t.rightClickHandler=function(e,t,n,r,i){a(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}},7239:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;let r=n(1505);t.ColorContrastCache=class{constructor(){this._color=new r.TwoKeyMap,this._css=new r.TwoKeyMap}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},3656:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},3551:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;let a=n(3656),o=n(8460),s=n(844),c=n(2585),l=n(4725),u=t.Linkifier=class extends s.Disposable{get currentLink(){return this._currentLink}constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new o.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new o.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,s.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,s.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,a.addDisposableDomListener)(this._element,`mouseleave`,(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,`mousemove`,this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mousedown`,this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mouseup`,this._handleMouseUp.bind(this)))}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}this._lastBufferCell&&t.x===this._lastBufferCell.x&&t.y===this._lastBufferCell.y||(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){this._activeProviderReplies&&t||(this._activeProviderReplies?.forEach((e=>{e?.forEach((e=>{e.link.dispose&&e.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,(t=>{if(this._isMouseOut)return;let i=t?.map((e=>({link:e})));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)this._activeProviderReplies.has(t)&&!this._activeProviderReplies.get(t)||(i=!0);if(!i&&r){let e=r.find((e=>this._linkAtPosition(e.link,t)));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find((e=>this._linkAtPosition(e.link,t)));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,s.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}}))))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};t.Linkifier=u=r([i(1,l.IMouseService),i(2,l.IRenderService),i(3,c.IBufferService),i(4,l.ILinkProviderService)],u)},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel=`Terminal input`,t.tooMuchOutput=`Too much output to announce, navigate to rows manually to read`},3730:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;let a=n(511),o=n(2585),s=t.OscLinkProvider=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n)return void t(void 0);let r=[],i=this._optionsService.rawOptions.linkHandler,o=new a.CellData,s=n.getTrimmedLength(),l=-1,u=-1,d=!1;for(let t=0;t<s;t++)if(u!==-1||n.hasContent(t)){if(n.loadCell(t,o),o.hasExtendedAttrs()&&o.extended.urlId){if(u===-1){u=t,l=o.extended.urlId;continue}d=o.extended.urlId!==l}else u!==-1&&(d=!0);if(d||u!==-1&&t===s-1){let n=this._oscLinkService.getLinkData(l)?.uri;if(n){let a={start:{x:u+1,y:e},end:{x:t+(d||t!==s-1?0:1),y:e}},o=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(o=!0)}catch{o=!0}o||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):c(0,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(u=t,l=o.extended.urlId):(u=-1,l=-1)}}t(r)}};function c(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}t.OscLinkProvider=s=r([i(0,o.IBufferService),i(1,o.IOptionsService),i(2,o.IOscLinkService)],s)},6193:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},3236:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;let r=n(3614),i=n(3656),a=n(3551),o=n(9042),s=n(3730),c=n(1680),l=n(3107),u=n(5744),d=n(2950),f=n(1296),p=n(428),m=n(4269),h=n(5114),g=n(8934),_=n(3230),v=n(9312),y=n(4725),b=n(6731),x=n(8055),S=n(8969),C=n(8460),w=n(844),T=n(6114),E=n(8437),D=n(2584),O=n(7399),k=n(5941),A=n(9074),j=n(2585),M=n(5435),N=n(4567),P=n(779);class F extends S.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(e={}){super(e),this.browser=T,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new w.MutableDisposable),this._onCursorMove=this.register(new C.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new C.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new C.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new C.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new C.EventEmitter),this._onBlur=this.register(new C.EventEmitter),this._onA11yCharEmitter=this.register(new C.EventEmitter),this._onA11yTabEmitter=this.register(new C.EventEmitter),this._onWillOpen=this.register(new C.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(A.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(P.LinkProviderService),this._instantiationService.setService(y.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(s.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((e,t)=>this.refresh(e,t)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((e=>this._reportWindowsOptions(e)))),this.register(this._inputHandler.onColor((e=>this._handleColorEvent(e)))),this.register((0,C.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,C.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((e=>this._afterResize(e.cols,e.rows)))),this.register((0,w.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=x.color.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${D.C0.ESC}]${n};${(0,k.toRgbString)(r)}${D.C1_ESCAPED.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors((e=>e.ansi[t.index]=x.channels.toColor(...t.color)));else{let n=e;this._themeService.modifyColors((e=>e[n]=x.channels.toColor(...t.color)))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this.register((0,i.addDisposableDomListener)(this.element,`copy`,(e=>{this.hasSelection()&&(0,r.copyHandler)(e,this._selectionService)})));let e=e=>(0,r.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,i.addDisposableDomListener)(this.textarea,`paste`,e)),this.register((0,i.addDisposableDomListener)(this.element,`paste`,e)),T.isFirefox?this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>{e.button===2&&(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,i.addDisposableDomListener)(this.element,`contextmenu`,(e=>{(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),T.isLinux&&this.register((0,i.addDisposableDomListener)(this.element,`auxclick`,(e=>{e.button===1&&(0,r.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,i.addDisposableDomListener)(this.textarea,`keyup`,(e=>this._keyUp(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keydown`,(e=>this._keyDown(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keypress`,(e=>this._keyPress(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionstart`,(()=>this._compositionHelper.compositionstart()))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionupdate`,(e=>this._compositionHelper.compositionupdate(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionend`,(()=>this._compositionHelper.compositionend()))),this.register((0,i.addDisposableDomListener)(this.textarea,`input`,(e=>this._inputEvent(e)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement(`div`),this._viewportScrollArea.classList.add(`xterm-scroll-area`),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this.register((0,i.addDisposableDomListener)(this.screenElement,`mousemove`,(e=>this.updateCursorStyle(e)))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement),this.textarea=this._document.createElement(`textarea`),this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,o.promptLabel),T.isChromeOS||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(h.CoreBrowserService,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(y.ICoreBrowserService,this._coreBrowserService),this.register((0,i.addDisposableDomListener)(this.textarea,`focus`,(e=>this._handleTextAreaFocus(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`blur`,(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(y.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(b.ThemeService),this._instantiationService.setService(y.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(m.CharacterJoinerService),this._instantiationService.setService(y.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(_.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(y.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((e=>this._onRender.fire(e)))),this.onResize((e=>this._renderService.resize(e.cols,e.rows))),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(y.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(a.Linkifier,this.screenElement)),this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(c.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(v.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(y.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,i.addDisposableDomListener)(this._viewportElement,`scroll`,(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(l.BufferDecorationRenderer,this.screenElement)),this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>this._selectionService.handleMouseDown(e)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,(e=>this._handleScreenReaderModeOptionChange(e)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRulerWidth`,(e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(f.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t)||e.viewport.getLinesScrolled(t)===0)return!1;i=t.deltaY<0?0:1,r=4;break;default:return!1}return!(i===void 0||r===void 0||r>4)&&e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this.register(this.coreMouseService.onProtocolChange((e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),8&e?r.mousemove||=(t.addEventListener(`mousemove`,a.mousemove),a.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),16&e?r.wheel||=(t.addEventListener(`wheel`,a.wheel,{passive:!1}),a.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),2&e?r.mouseup||=a.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),4&e?r.mousedrag||=a.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,i.addDisposableDomListener)(t,`mousedown`,(e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)}))),this.register((0,i.addDisposableDomListener)(t,`wheel`,(e=>{if(!r.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(e))return!1;if(!this.buffer.hasScrollback){let t=this.viewport.getLinesScrolled(e);if(t===0)return;let n=D.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(e.deltaY<0?`A`:`B`),r=``;for(let e=0;e<Math.abs(t);e++)r+=n;return this.coreService.triggerDataEvent(r,!0),this.cancel(e,!0)}return this.viewport.handleWheel(e)?this.cancel(e):void 0}}),{passive:!1})),this.register((0,i.addDisposableDomListener)(t,`touchstart`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)}),{passive:!0})),this.register((0,i.addDisposableDomListener)(t,`touchmove`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)}),{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t,n=0){n===1?(super.scrollLines(e,t,n),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(e)}paste(e){(0,r.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;t||e.key!==`Dead`&&e.key!==`AltGraph`||(this._unprocessedDeadKey=!0);let n=(0,O.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}return n.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(n.key!==D.C0.ETX&&n.key!==D.C0.CR||(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else{if(e.which===0||e.charCode===0)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(E.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(D.C0.ESC+`[I`):this.coreService.triggerDataEvent(D.C0.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[4;${t};${e}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}}t.Terminal=F},9924:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=Date.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},1680:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;let a=n(3656),o=n(4725),s=n(8460),c=n(844),l=n(2585),u=t.Viewport=class extends c.Disposable{constructor(e,t,n,r,i,o,c,l){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=n,this._optionsService=r,this._charSizeService=i,this._renderService=o,this._coreBrowserService=c,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new s.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,`scroll`,this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((e=>this._renderDimensions=e))),this._handleThemeChange(l.colors),this.register(l.onChangeColors((e=>this._handleThemeChange(e)))),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(e){if(e)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+`px`)}let e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){let n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&n<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}handleWheel(e){let t=this._getPixelsScrolled(e);return t!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}scrollLines(e){if(e!==0){if(this._optionsService.rawOptions.smoothScrollDuration){let t=e*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!1})}}_getPixelsScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(e,t){let n,r=``,i=[],a=t??this._bufferService.buffer.lines.length,o=this._bufferService.buffer.lines;for(let t=e;t<a;t++){let e=o.get(t);if(!e)continue;let a=o.get(t+1)?.isWrapped;if(r+=e.translateToString(!a),!a||t===o.length-1){let e=document.createElement(`div`);e.textContent=r,i.push(e),r.length>0&&(n=e),r=``}}return{bufferElements:i,cursorElement:n}}getLinesScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){let n=this._optionsService.rawOptions.fastScrollModifier;return n===`alt`&&t.altKey||n===`ctrl`&&t.ctrlKey||n===`shift`&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){let t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=u=r([i(2,l.IBufferService),i(3,l.IOptionsService),i(4,o.ICharSizeService),i(5,o.IRenderService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],u)},3107:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;let a=n(4725),o=n(844),s=n(2585),c=t.BufferDecorationRenderer=class extends o.Disposable{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((e=>this._removeDecoration(e)))),this.register((0,o.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+`px`,t.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+`px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose((()=>{this._decorationElements.delete(e),n.remove()}))),n.style.top=t*this._renderService.dimensions.css.cell.height+`px`,n.style.display=this._altBufferIsActive?`none`:`block`,e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?n*this._renderService.dimensions.css.cell.width+`px`:``:t.style.left=n?n*this._renderService.dimensions.css.cell.width+`px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=c=r([i(1,s.IBufferService),i(2,a.ICoreBrowserService),i(3,s.IDecorationService),i(4,a.IRenderService)],c)},5871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;let a=n(5871),o=n(4725),s=n(844),c=n(2585),l={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},f=t.OverviewRulerRenderer=class extends s.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,n,r,i,o,c){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=o,this._coreBrowserService=c,this._colorZoneStore=new a.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let l=this._canvas.getContext(`2d`);if(!l)throw Error(`Ctx cannot be null`);this._ctx=l,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,s.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange(`overviewRulerWidth`,(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);u.full=this._canvas.width,u.left=e,u.center=t,u.right=e,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=u.left,d.right=u.left+u.center}_refreshDrawHeightConstants(){l.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);l.left=t,l.center=t,l.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1;let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(d[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-l[e.position||`full`]/2),u[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+l[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=f=r([i(2,c.IBufferService),i(3,c.IDecorationService),i(4,o.IRenderService),i(5,c.IOptionsService),i(6,o.ICoreBrowserService)],f)},2950:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;let a=n(4725),o=n(2585),s=n(2584),c=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}}),0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${s.C0.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}}),0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};t.CompositionHelper=c=r([i(2,o.IBufferService),i(3,o.IOptionsService),i(4,o.ICoreService),i(5,a.IRenderService)],c)},9806:(e,t)=>{function n(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=n,t.getCoords=function(e,t,r,i,a,o,s,c,l){if(!o)return;let u=n(e,t,r);return u?(u[0]=Math.ceil((u[0]+(l?s/2:0))/s),u[1]=Math.ceil(u[1]/c),u[0]=Math.min(Math.max(u[0],1),i+ +!!l),u[1]=Math.min(Math.max(u[1],1),a),u):void 0}},9504:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;let r=n(2584);function i(e,t,n,r){let i=e-a(e,n),s=t-a(t,n);return l(Math.abs(i-s)-function(e,t,n){let r=0,i=e-a(e,n),s=t-a(t,n);for(let a=0;a<Math.abs(i-s);a++){let s=o(e,t)===`A`?-1:1;n.buffer.lines.get(i+s*a)?.isWrapped&&r++}return r}(e,t,n),c(o(e,t),r))}function a(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function o(e,t){return e>t?`A`:`B`}function s(e,t,n,r,i,a){let o=e,s=t,c=``;for(;o!==n||s!==r;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function c(e,t){let n=t?`O`:`[`;return r.C0.ESC+n+e}function l(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}t.moveToCellSequence=function(e,t,n,r){let o=n.buffer.x,u=n.buffer.y;if(!n.buffer.hasScrollback)return function(e,t,n,r,o,u){return i(t,r,o,u).length===0?``:l(s(e,t,e,t-a(t,o),!1,o).length,c(`D`,u))}(o,u,0,t,n,r)+i(u,t,n,r)+function(e,t,n,r,o,u){let d;d=i(t,r,o,u).length>0?r-a(r,o):t;let f=r,p=function(e,t,n,r,o,s){let c;return c=i(n,r,o,s).length>0?r-a(r,o):t,e<n&&c<=r||e>=n&&c<r?`C`:`D`}(e,t,n,r,o,u);return l(s(e,d,n,f,p===`C`,o).length,c(p,u))}(o,u,e,t,n,r);let d;if(u===t)return d=o>e?`D`:`C`,l(Math.abs(o-e),c(d,r));d=u>t?`D`:`C`;let f=Math.abs(u-t);return l(function(e,t){return t.cols-e}(u>t?e:o,n)+(f-1)*n.cols+1+((u>t?o:e)-1),c(d,r))}},1296:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;let a=n(3787),o=n(2550),s=n(2223),c=n(6171),l=n(6052),u=n(4725),d=n(8055),f=n(8460),p=n(844),m=n(2585),h=`xterm-dom-renderer-owner-`,g=`xterm-rows`,_=`xterm-fg-`,v=`xterm-bg-`,y=`xterm-focus`,b=`xterm-selection`,x=1,S=t.DomRenderer=class extends p.Disposable{constructor(e,t,n,r,i,s,u,d,m,_,v,y,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=u,this._charSizeService=m,this._optionsService=_,this._bufferService=v,this._coreBrowserService=y,this._themeService=S,this._terminalClass=x++,this._rowElements=[],this._selectionRenderModel=(0,l.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new f.EventEmitter).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(g),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(b),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=(0,c.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((e=>this._injectCss(e)))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(h+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((e=>this._handleLinkHover(e)))),this.register(this._linkifier2.onHideLinkUnderline((e=>this._handleLinkLeave(e)))),this.register((0,p.toDisposable)((()=>{this._element.classList.remove(h+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new o.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${g} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${g} { color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${g} .xterm-dim { color: ${d.color.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${b} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${b} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${b} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${_}${n} { color: ${r.css}; }${this._terminalSelector} .${_}${n}.xterm-dim { color: ${d.color.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${v}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e.background).css}; }${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${v}${s.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(y),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(y),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;this._selectionRenderModel.update(this._terminal,e,t,n);let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow;if(a>=this._bufferService.rows||o<0)return;let s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=r*this.dimensions.css.cell.height+`px`,i.style.top=e*this.dimensions.css.cell.height+`px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._optionsService.rawOptions.cursorBlink,o=this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${h}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};t.DomRenderer=S=r([i(7,m.IInstantiationService),i(8,u.ICharSizeService),i(9,m.IOptionsService),i(10,m.IBufferService),i(11,u.ICoreBrowserService),i(12,u.IThemeService)],S)},3787:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;let a=n(2223),o=n(643),s=n(511),c=n(2585),l=n(8055),u=n(4725),d=n(4269),f=n(6171),p=n(3734),m=t.DomRendererRowFactory=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new s.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,c,u,f,m,g){let _=[],v=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,b,x=e.getNoBgTrimmedLength();n&&x<s+1&&(x=s+1);let S=0,C=``,w=0,T=0,E=0,D=!1,O=0,k=!1,A=0,j=[],M=m!==-1&&g!==-1;for(let N=0;N<x;N++){e.loadCell(N,this._workCell);let x=this._workCell.getWidth();if(x===0)continue;let P=!1,F=N,I=this._workCell;if(v.length>0&&N===v[0][0]){P=!0;let t=v.shift();I=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),F=t[1]-1,x=I.getWidth()}let L=this._isCellInSelection(N,t),R=n&&N===s,z=M&&N>=m&&N<=g,B=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,(e=>{B=!0}));let V=I.getChars()||o.WHITESPACE_CELL_CHAR;if(V===` `&&(I.isUnderline()||I.isOverline())&&(V=`\xA0`),A=x*u-f.get(V,I.isBold(),I.isItalic()),b){if(S&&(L&&k||!L&&!k&&I.bg===w)&&(L&&k&&y.selectionForeground||I.fg===T)&&I.extended.ext===E&&z===D&&A===O&&!R&&!P&&!B){I.isInvisible()?C+=o.WHITESPACE_CELL_CHAR:C+=V,S++;continue}S&&(b.textContent=C),b=this._document.createElement(`span`),S=0,C=``}else b=this._document.createElement(`span`);if(w=I.bg,T=I.fg,E=I.extended.ext,D=z,O=A,k=L,P&&s>=N&&s<=F&&(s=N),!this._coreService.isCursorHidden&&R&&this._coreService.isCursorInitialized){if(j.push(`xterm-cursor`),this._coreBrowserService.isFocused)c&&j.push(`xterm-cursor-blink`),j.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:j.push(`xterm-cursor-outline`);break;case`block`:j.push(`xterm-cursor-block`);break;case`bar`:j.push(`xterm-cursor-bar`);break;case`underline`:j.push(`xterm-cursor-underline`)}}if(I.isBold()&&j.push(`xterm-bold`),I.isItalic()&&j.push(`xterm-italic`),I.isDim()&&j.push(`xterm-dim`),C=I.isInvisible()?o.WHITESPACE_CELL_CHAR:I.getChars()||o.WHITESPACE_CELL_CHAR,I.isUnderline()&&(j.push(`xterm-underline-${I.extended.underlineStyle}`),C===` `&&(C=`\xA0`),!I.isUnderlineColorDefault())){if(I.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(I.getUnderlineColor()).join(`,`)})`;else{let e=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&e<8&&(e+=8),b.style.textDecorationColor=y.ansi[e].css}}I.isOverline()&&(j.push(`xterm-overline`),C===` `&&(C=`\xA0`)),I.isStrikethrough()&&j.push(`xterm-strikethrough`),z&&(b.style.textDecoration=`underline`);let H=I.getFgColor(),U=I.getFgColorMode(),W=I.getBgColor(),G=I.getBgColorMode(),ee=!!I.isInverse();if(ee){let e=H;H=W,W=e;let t=U;U=G,G=t}let K,te,q,ne=!1;switch(this._decorationService.forEachDecorationAtCell(N,t,void 0,(e=>{e.options.layer!==`top`&&ne||(e.backgroundColorRGB&&(G=50331648,W=e.backgroundColorRGB.rgba>>8&16777215,K=e.backgroundColorRGB),e.foregroundColorRGB&&(U=50331648,H=e.foregroundColorRGB.rgba>>8&16777215,te=e.foregroundColorRGB),ne=e.options.layer===`top`)})),!ne&&L&&(K=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,W=K.rgba>>8&16777215,G=50331648,ne=!0,y.selectionForeground&&(U=50331648,H=y.selectionForeground.rgba>>8&16777215,te=y.selectionForeground)),ne&&j.push(`xterm-decoration-top`),G){case 16777216:case 33554432:q=y.ansi[W],j.push(`xterm-bg-${W}`);break;case 50331648:q=l.channels.toColor(W>>16,W>>8&255,255&W),this._addStyle(b,`background-color:#${h((W>>>0).toString(16),`0`,6)}`);break;default:ee?(q=y.foreground,j.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):q=y.background}switch(K||I.isDim()&&(K=l.color.multiplyOpacity(q,.5)),U){case 16777216:case 33554432:I.isBold()&&H<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(H+=8),this._applyMinimumContrast(b,q,y.ansi[H],I,K,void 0)||j.push(`xterm-fg-${H}`);break;case 50331648:let e=l.channels.toColor(H>>16&255,H>>8&255,255&H);this._applyMinimumContrast(b,q,e,I,K,te)||this._addStyle(b,`color:#${h(H.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(b,q,y.foreground,I,K,te)||ee&&j.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}j.length&&=(b.className=j.join(` `),0),R||P||B?b.textContent=C:S++,A!==this.defaultSpacing&&(b.style.letterSpacing=`${A}px`),_.push(b),N=F}return b&&S&&(b.textContent=C),_}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,f.treatGlyphAsBackgroundColor)(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(i||a||(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=l.color.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return!!s&&(this._addStyle(e,`color:${s.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!(!n||!r)&&(this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0])}};function h(e,t,n){for(;e.length<n;)e=t+e;return e}t.DomRendererRowFactory=m=r([i(1,u.ICharacterJoinerService),i(2,c.IOptionsService),i(3,u.ICoreBrowserService),i(4,c.ICoreService),i(5,c.IDecorationService),i(6,u.IThemeService)],m)},2550:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}}},2223:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},6171:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},6052:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},456:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;let a=n(2585),o=n(8460),s=n(844),c=t.CharSizeService=class extends s.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this.register(new o.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new u(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=c=r([i(2,a.IOptionsService)],c);class l extends s.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}}class u extends l{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class d extends l{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}}},4269:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;let a=n(3734),o=n(643),s=n(511),c=n(2585);class l extends a.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=l;let u=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new s.CellData}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,s=0,c=t.getFg(0),l=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==c||this._workCell.bg!==l){if(e-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,s=a,c=this._workCell.fg,l=this._workCell.bg}a+=this._workCell.getChars().length||o.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(t,n,r,i,a){let o=t.substring(n,r),s=[];try{s=this._characterJoiners[0].handler(o)}catch(e){console.error(e)}for(let t=1;t<this._characterJoiners.length;t++)try{let n=this._characterJoiners[t].handler(o);for(let t=0;t<n.length;t++)e._mergeRanges(s,n[t])}catch(e){console.error(e)}return this._stringRangesToCellRanges(s,i,a),s}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,s=e[r];if(s){for(let c=n;c<this._bufferService.cols;c++){let n=t.getWidth(c),l=t.getString(c).length||o.WHITESPACE_CELL_CHAR.length;if(n!==0){if(!i&&s[0]<=a&&(s[0]=c,i=!0),s[1]<=a){if(s[1]=c,s=e[++r],!s)break;s[0]<=a?(s[0]=c,i=!0):i=!1}a+=l}}s&&(s[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0)}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};t.CharacterJoinerService=u=r([i(0,c.IBufferService)],u)},5114:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;let r=n(844),i=n(8460),a=n(3656);class o extends r.Disposable{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new s(this._window),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new i.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,i.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener(`focus`,(()=>this._isFocused=!0)),this._textarea.addEventListener(`blur`,(()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}t.CoreBrowserService=o;class s extends r.Disposable{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this.register(new r.MutableDisposable),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,r.toDisposable)((()=>this.clearListener())))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,a.addDisposableDomListener)(this._parentWindow,`resize`,(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;let r=n(844);class i extends r.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,r.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}}t.LinkProviderService=i},8934:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;let a=n(4725),o=n(9806),s=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return(0,o.getCoords)(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=(0,o.getCoordsRelativeToElement)(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};t.MouseService=s=r([i(0,a.IRenderService),i(1,a.ICharSizeService)],s)},3230:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;let a=n(6193),o=n(4725),s=n(8460),c=n(844),l=n(7226),u=n(2585),d=t.RenderService=class extends c.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,n,r,i,o,u,d){super(),this._rowCount=e,this._charSizeService=r,this._renderer=this.register(new c.MutableDisposable),this._pausedResizeTask=new l.DebouncedIdleTask,this._observerDisposable=this.register(new c.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new s.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new s.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new s.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new s.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new a.RenderDebouncer(((e,t)=>this._renderRows(e,t)),u),this.register(this._renderDebouncer),this.register(u.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(o.onResize((()=>this._fullRefresh()))),this.register(o.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(n.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(i.onDecorationRegistered((()=>this._fullRefresh()))),this.register(i.onDecorationRemoved((()=>this._fullRefresh()))),this.register(n.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],(()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()}))),this.register(n.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],(()=>this.refreshRows(o.buffer.y,o.buffer.y,!0)))),this.register(d.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(u.window,t),this.register(u.onWindowChange((e=>this._registerIntersectionObserver(e,t))))}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver((e=>this._handleIntersectionChange(e[e.length-1])),{threshold:0});n.observe(t),this._observerDisposable.value=(0,c.toDisposable)((()=>n.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){this._isPaused?this._needsFullRefresh=!0:(n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((e=>this.refreshRows(e.start,e.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=d=r([i(2,u.IOptionsService),i(3,o.ICharSizeService),i(4,u.IDecorationService),i(5,u.IBufferService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],d)},9312:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;let a=n(9806),o=n(9504),s=n(456),c=n(4725),l=n(8460),u=n(844),d=n(6114),f=n(4841),p=n(511),m=n(2585),h=RegExp(`\xA0`,`g`),g=t.SelectionService=class extends u.Disposable{constructor(e,t,n,r,i,a,o,c,d){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=c,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new l.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new l.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new l.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((e=>this._handleTrim(e))),this.register(this._bufferService.buffers.onBufferActivate((e=>this._handleBufferActivate(e)))),this.enable(),this._model=new s.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map((e=>e.replace(h,` `))).join(d.isWindows?`\r
27
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.innerText=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error(`anchorNode and/or focusNode are null`);let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=d=r([i(1,l.IInstantiationService),i(2,c.ICoreBrowserService),i(3,c.IRenderService)],d)},3614:(e,t)=>{function n(e){return e.replace(/\r?\n/g,`\r`)}function r(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function i(e,t,i,a){e=r(e=n(e),i.decPrivateModes.bracketedPasteMode&&!0!==a.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=``}function a(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=n,t.bracketTextForPaste=r,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,n,r){e.stopPropagation(),e.clipboardData&&i(e.clipboardData.getData(`text/plain`),t,n,r)},t.paste=i,t.moveTextAreaUnderMouseCursor=a,t.rightClickHandler=function(e,t,n,r,i){a(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}},7239:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;let r=n(1505);t.ColorContrastCache=class{constructor(){this._color=new r.TwoKeyMap,this._css=new r.TwoKeyMap}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},3656:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},3551:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;let a=n(3656),o=n(8460),s=n(844),c=n(2585),l=n(4725),u=t.Linkifier=class extends s.Disposable{get currentLink(){return this._currentLink}constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new o.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new o.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,s.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,s.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,a.addDisposableDomListener)(this._element,`mouseleave`,(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,`mousemove`,this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mousedown`,this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mouseup`,this._handleMouseUp.bind(this)))}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}this._lastBufferCell&&t.x===this._lastBufferCell.x&&t.y===this._lastBufferCell.y||(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){this._activeProviderReplies&&t||(this._activeProviderReplies?.forEach((e=>{e?.forEach((e=>{e.link.dispose&&e.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,(t=>{if(this._isMouseOut)return;let i=t?.map((e=>({link:e})));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)this._activeProviderReplies.has(t)&&!this._activeProviderReplies.get(t)||(i=!0);if(!i&&r){let e=r.find((e=>this._linkAtPosition(e.link,t)));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find((e=>this._linkAtPosition(e.link,t)));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,s.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}}))))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};t.Linkifier=u=r([i(1,l.IMouseService),i(2,l.IRenderService),i(3,c.IBufferService),i(4,l.ILinkProviderService)],u)},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel=`Terminal input`,t.tooMuchOutput=`Too much output to announce, navigate to rows manually to read`},3730:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;let a=n(511),o=n(2585),s=t.OscLinkProvider=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n)return void t(void 0);let r=[],i=this._optionsService.rawOptions.linkHandler,o=new a.CellData,s=n.getTrimmedLength(),l=-1,u=-1,d=!1;for(let t=0;t<s;t++)if(u!==-1||n.hasContent(t)){if(n.loadCell(t,o),o.hasExtendedAttrs()&&o.extended.urlId){if(u===-1){u=t,l=o.extended.urlId;continue}d=o.extended.urlId!==l}else u!==-1&&(d=!0);if(d||u!==-1&&t===s-1){let n=this._oscLinkService.getLinkData(l)?.uri;if(n){let a={start:{x:u+1,y:e},end:{x:t+(d||t!==s-1?0:1),y:e}},o=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(o=!0)}catch{o=!0}o||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):c(0,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(u=t,l=o.extended.urlId):(u=-1,l=-1)}}t(r)}};function c(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}t.OscLinkProvider=s=r([i(0,o.IBufferService),i(1,o.IOptionsService),i(2,o.IOscLinkService)],s)},6193:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},3236:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;let r=n(3614),i=n(3656),a=n(3551),o=n(9042),s=n(3730),c=n(1680),l=n(3107),u=n(5744),d=n(2950),f=n(1296),p=n(428),m=n(4269),h=n(5114),g=n(8934),_=n(3230),v=n(9312),y=n(4725),b=n(6731),x=n(8055),S=n(8969),C=n(8460),w=n(844),T=n(6114),E=n(8437),D=n(2584),O=n(7399),k=n(5941),A=n(9074),j=n(2585),M=n(5435),N=n(4567),P=n(779);class F extends S.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(e={}){super(e),this.browser=T,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new w.MutableDisposable),this._onCursorMove=this.register(new C.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new C.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new C.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new C.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new C.EventEmitter),this._onBlur=this.register(new C.EventEmitter),this._onA11yCharEmitter=this.register(new C.EventEmitter),this._onA11yTabEmitter=this.register(new C.EventEmitter),this._onWillOpen=this.register(new C.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(A.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(P.LinkProviderService),this._instantiationService.setService(y.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(s.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((e,t)=>this.refresh(e,t)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((e=>this._reportWindowsOptions(e)))),this.register(this._inputHandler.onColor((e=>this._handleColorEvent(e)))),this.register((0,C.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,C.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((e=>this._afterResize(e.cols,e.rows)))),this.register((0,w.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=x.color.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${D.C0.ESC}]${n};${(0,k.toRgbString)(r)}${D.C1_ESCAPED.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors((e=>e.ansi[t.index]=x.channels.toColor(...t.color)));else{let n=e;this._themeService.modifyColors((e=>e[n]=x.channels.toColor(...t.color)))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this.register((0,i.addDisposableDomListener)(this.element,`copy`,(e=>{this.hasSelection()&&(0,r.copyHandler)(e,this._selectionService)})));let e=e=>(0,r.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,i.addDisposableDomListener)(this.textarea,`paste`,e)),this.register((0,i.addDisposableDomListener)(this.element,`paste`,e)),T.isFirefox?this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>{e.button===2&&(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,i.addDisposableDomListener)(this.element,`contextmenu`,(e=>{(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),T.isLinux&&this.register((0,i.addDisposableDomListener)(this.element,`auxclick`,(e=>{e.button===1&&(0,r.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,i.addDisposableDomListener)(this.textarea,`keyup`,(e=>this._keyUp(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keydown`,(e=>this._keyDown(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keypress`,(e=>this._keyPress(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionstart`,(()=>this._compositionHelper.compositionstart()))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionupdate`,(e=>this._compositionHelper.compositionupdate(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionend`,(()=>this._compositionHelper.compositionend()))),this.register((0,i.addDisposableDomListener)(this.textarea,`input`,(e=>this._inputEvent(e)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement(`div`),this._viewportScrollArea.classList.add(`xterm-scroll-area`),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this.register((0,i.addDisposableDomListener)(this.screenElement,`mousemove`,(e=>this.updateCursorStyle(e)))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement),this.textarea=this._document.createElement(`textarea`),this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,o.promptLabel),T.isChromeOS||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(h.CoreBrowserService,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(y.ICoreBrowserService,this._coreBrowserService),this.register((0,i.addDisposableDomListener)(this.textarea,`focus`,(e=>this._handleTextAreaFocus(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`blur`,(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(y.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(b.ThemeService),this._instantiationService.setService(y.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(m.CharacterJoinerService),this._instantiationService.setService(y.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(_.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(y.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((e=>this._onRender.fire(e)))),this.onResize((e=>this._renderService.resize(e.cols,e.rows))),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(y.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(a.Linkifier,this.screenElement)),this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(c.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(v.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(y.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,i.addDisposableDomListener)(this._viewportElement,`scroll`,(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(l.BufferDecorationRenderer,this.screenElement)),this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>this._selectionService.handleMouseDown(e)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,(e=>this._handleScreenReaderModeOptionChange(e)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRulerWidth`,(e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(f.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t)||e.viewport.getLinesScrolled(t)===0)return!1;i=t.deltaY<0?0:1,r=4;break;default:return!1}return!(i===void 0||r===void 0||r>4)&&e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this.register(this.coreMouseService.onProtocolChange((e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),8&e?r.mousemove||=(t.addEventListener(`mousemove`,a.mousemove),a.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),16&e?r.wheel||=(t.addEventListener(`wheel`,a.wheel,{passive:!1}),a.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),2&e?r.mouseup||=a.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),4&e?r.mousedrag||=a.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,i.addDisposableDomListener)(t,`mousedown`,(e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)}))),this.register((0,i.addDisposableDomListener)(t,`wheel`,(e=>{if(!r.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(e))return!1;if(!this.buffer.hasScrollback){let t=this.viewport.getLinesScrolled(e);if(t===0)return;let n=D.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(e.deltaY<0?`A`:`B`),r=``;for(let e=0;e<Math.abs(t);e++)r+=n;return this.coreService.triggerDataEvent(r,!0),this.cancel(e,!0)}return this.viewport.handleWheel(e)?this.cancel(e):void 0}}),{passive:!1})),this.register((0,i.addDisposableDomListener)(t,`touchstart`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)}),{passive:!0})),this.register((0,i.addDisposableDomListener)(t,`touchmove`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)}),{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t,n=0){n===1?(super.scrollLines(e,t,n),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(e)}paste(e){(0,r.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;t||e.key!==`Dead`&&e.key!==`AltGraph`||(this._unprocessedDeadKey=!0);let n=(0,O.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}return n.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(n.key!==D.C0.ETX&&n.key!==D.C0.CR||(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else{if(e.which===0||e.charCode===0)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(E.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(D.C0.ESC+`[I`):this.coreService.triggerDataEvent(D.C0.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[4;${t};${e}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}}t.Terminal=F},9924:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=Date.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},1680:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;let a=n(3656),o=n(4725),s=n(8460),c=n(844),l=n(2585),u=t.Viewport=class extends c.Disposable{constructor(e,t,n,r,i,o,c,l){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=n,this._optionsService=r,this._charSizeService=i,this._renderService=o,this._coreBrowserService=c,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new s.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,`scroll`,this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((e=>this._renderDimensions=e))),this._handleThemeChange(l.colors),this.register(l.onChangeColors((e=>this._handleThemeChange(e)))),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(e){if(e)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+`px`)}let e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){let n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&n<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}handleWheel(e){let t=this._getPixelsScrolled(e);return t!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}scrollLines(e){if(e!==0){if(this._optionsService.rawOptions.smoothScrollDuration){let t=e*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!1})}}_getPixelsScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(e,t){let n,r=``,i=[],a=t??this._bufferService.buffer.lines.length,o=this._bufferService.buffer.lines;for(let t=e;t<a;t++){let e=o.get(t);if(!e)continue;let a=o.get(t+1)?.isWrapped;if(r+=e.translateToString(!a),!a||t===o.length-1){let e=document.createElement(`div`);e.textContent=r,i.push(e),r.length>0&&(n=e),r=``}}return{bufferElements:i,cursorElement:n}}getLinesScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){let n=this._optionsService.rawOptions.fastScrollModifier;return n===`alt`&&t.altKey||n===`ctrl`&&t.ctrlKey||n===`shift`&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){let t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=u=r([i(2,l.IBufferService),i(3,l.IOptionsService),i(4,o.ICharSizeService),i(5,o.IRenderService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],u)},3107:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;let a=n(4725),o=n(844),s=n(2585),c=t.BufferDecorationRenderer=class extends o.Disposable{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((e=>this._removeDecoration(e)))),this.register((0,o.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+`px`,t.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+`px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose((()=>{this._decorationElements.delete(e),n.remove()}))),n.style.top=t*this._renderService.dimensions.css.cell.height+`px`,n.style.display=this._altBufferIsActive?`none`:`block`,e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?n*this._renderService.dimensions.css.cell.width+`px`:``:t.style.left=n?n*this._renderService.dimensions.css.cell.width+`px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=c=r([i(1,s.IBufferService),i(2,a.ICoreBrowserService),i(3,s.IDecorationService),i(4,a.IRenderService)],c)},5871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;let a=n(5871),o=n(4725),s=n(844),c=n(2585),l={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},f=t.OverviewRulerRenderer=class extends s.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,n,r,i,o,c){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=o,this._coreBrowserService=c,this._colorZoneStore=new a.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let l=this._canvas.getContext(`2d`);if(!l)throw Error(`Ctx cannot be null`);this._ctx=l,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,s.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange(`overviewRulerWidth`,(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);u.full=this._canvas.width,u.left=e,u.center=t,u.right=e,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=u.left,d.right=u.left+u.center}_refreshDrawHeightConstants(){l.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);l.left=t,l.center=t,l.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1;let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(d[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-l[e.position||`full`]/2),u[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+l[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=f=r([i(2,c.IBufferService),i(3,c.IDecorationService),i(4,o.IRenderService),i(5,c.IOptionsService),i(6,o.ICoreBrowserService)],f)},2950:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;let a=n(4725),o=n(2585),s=n(2584),c=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}}),0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${s.C0.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}}),0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};t.CompositionHelper=c=r([i(2,o.IBufferService),i(3,o.IOptionsService),i(4,o.ICoreService),i(5,a.IRenderService)],c)},9806:(e,t)=>{function n(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=n,t.getCoords=function(e,t,r,i,a,o,s,c,l){if(!o)return;let u=n(e,t,r);return u?(u[0]=Math.ceil((u[0]+(l?s/2:0))/s),u[1]=Math.ceil(u[1]/c),u[0]=Math.min(Math.max(u[0],1),i+ +!!l),u[1]=Math.min(Math.max(u[1],1),a),u):void 0}},9504:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;let r=n(2584);function i(e,t,n,r){let i=e-a(e,n),s=t-a(t,n);return l(Math.abs(i-s)-function(e,t,n){let r=0,i=e-a(e,n),s=t-a(t,n);for(let a=0;a<Math.abs(i-s);a++){let s=o(e,t)===`A`?-1:1;n.buffer.lines.get(i+s*a)?.isWrapped&&r++}return r}(e,t,n),c(o(e,t),r))}function a(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function o(e,t){return e>t?`A`:`B`}function s(e,t,n,r,i,a){let o=e,s=t,c=``;for(;o!==n||s!==r;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function c(e,t){let n=t?`O`:`[`;return r.C0.ESC+n+e}function l(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}t.moveToCellSequence=function(e,t,n,r){let o=n.buffer.x,u=n.buffer.y;if(!n.buffer.hasScrollback)return function(e,t,n,r,o,u){return i(t,r,o,u).length===0?``:l(s(e,t,e,t-a(t,o),!1,o).length,c(`D`,u))}(o,u,0,t,n,r)+i(u,t,n,r)+function(e,t,n,r,o,u){let d;d=i(t,r,o,u).length>0?r-a(r,o):t;let f=r,p=function(e,t,n,r,o,s){let c;return c=i(n,r,o,s).length>0?r-a(r,o):t,e<n&&c<=r||e>=n&&c<r?`C`:`D`}(e,t,n,r,o,u);return l(s(e,d,n,f,p===`C`,o).length,c(p,u))}(o,u,e,t,n,r);let d;if(u===t)return d=o>e?`D`:`C`,l(Math.abs(o-e),c(d,r));d=u>t?`D`:`C`;let f=Math.abs(u-t);return l(function(e,t){return t.cols-e}(u>t?e:o,n)+(f-1)*n.cols+1+((u>t?o:e)-1),c(d,r))}},1296:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;let a=n(3787),o=n(2550),s=n(2223),c=n(6171),l=n(6052),u=n(4725),d=n(8055),f=n(8460),p=n(844),m=n(2585),h=`xterm-dom-renderer-owner-`,g=`xterm-rows`,_=`xterm-fg-`,v=`xterm-bg-`,y=`xterm-focus`,b=`xterm-selection`,x=1,S=t.DomRenderer=class extends p.Disposable{constructor(e,t,n,r,i,s,u,d,m,_,v,y,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=u,this._charSizeService=m,this._optionsService=_,this._bufferService=v,this._coreBrowserService=y,this._themeService=S,this._terminalClass=x++,this._rowElements=[],this._selectionRenderModel=(0,l.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new f.EventEmitter).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(g),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(b),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=(0,c.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((e=>this._injectCss(e)))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(h+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((e=>this._handleLinkHover(e)))),this.register(this._linkifier2.onHideLinkUnderline((e=>this._handleLinkLeave(e)))),this.register((0,p.toDisposable)((()=>{this._element.classList.remove(h+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new o.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${g} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${g} { color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${g} .xterm-dim { color: ${d.color.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${b} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${b} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${b} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${_}${n} { color: ${r.css}; }${this._terminalSelector} .${_}${n}.xterm-dim { color: ${d.color.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${v}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e.background).css}; }${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${v}${s.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(y),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(y),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;this._selectionRenderModel.update(this._terminal,e,t,n);let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow;if(a>=this._bufferService.rows||o<0)return;let s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=r*this.dimensions.css.cell.height+`px`,i.style.top=e*this.dimensions.css.cell.height+`px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._optionsService.rawOptions.cursorBlink,o=this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${h}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};t.DomRenderer=S=r([i(7,m.IInstantiationService),i(8,u.ICharSizeService),i(9,m.IOptionsService),i(10,m.IBufferService),i(11,u.ICoreBrowserService),i(12,u.IThemeService)],S)},3787:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;let a=n(2223),o=n(643),s=n(511),c=n(2585),l=n(8055),u=n(4725),d=n(4269),f=n(6171),p=n(3734),m=t.DomRendererRowFactory=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new s.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,c,u,f,m,g){let _=[],v=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,b,x=e.getNoBgTrimmedLength();n&&x<s+1&&(x=s+1);let S=0,C=``,w=0,T=0,E=0,D=!1,O=0,k=!1,A=0,j=[],M=m!==-1&&g!==-1;for(let N=0;N<x;N++){e.loadCell(N,this._workCell);let x=this._workCell.getWidth();if(x===0)continue;let P=!1,F=N,I=this._workCell;if(v.length>0&&N===v[0][0]){P=!0;let t=v.shift();I=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),F=t[1]-1,x=I.getWidth()}let L=this._isCellInSelection(N,t),R=n&&N===s,z=M&&N>=m&&N<=g,B=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,(e=>{B=!0}));let V=I.getChars()||o.WHITESPACE_CELL_CHAR;if(V===` `&&(I.isUnderline()||I.isOverline())&&(V=`\xA0`),A=x*u-f.get(V,I.isBold(),I.isItalic()),b){if(S&&(L&&k||!L&&!k&&I.bg===w)&&(L&&k&&y.selectionForeground||I.fg===T)&&I.extended.ext===E&&z===D&&A===O&&!R&&!P&&!B){I.isInvisible()?C+=o.WHITESPACE_CELL_CHAR:C+=V,S++;continue}S&&(b.textContent=C),b=this._document.createElement(`span`),S=0,C=``}else b=this._document.createElement(`span`);if(w=I.bg,T=I.fg,E=I.extended.ext,D=z,O=A,k=L,P&&s>=N&&s<=F&&(s=N),!this._coreService.isCursorHidden&&R&&this._coreService.isCursorInitialized){if(j.push(`xterm-cursor`),this._coreBrowserService.isFocused)c&&j.push(`xterm-cursor-blink`),j.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:j.push(`xterm-cursor-outline`);break;case`block`:j.push(`xterm-cursor-block`);break;case`bar`:j.push(`xterm-cursor-bar`);break;case`underline`:j.push(`xterm-cursor-underline`)}}if(I.isBold()&&j.push(`xterm-bold`),I.isItalic()&&j.push(`xterm-italic`),I.isDim()&&j.push(`xterm-dim`),C=I.isInvisible()?o.WHITESPACE_CELL_CHAR:I.getChars()||o.WHITESPACE_CELL_CHAR,I.isUnderline()&&(j.push(`xterm-underline-${I.extended.underlineStyle}`),C===` `&&(C=`\xA0`),!I.isUnderlineColorDefault())){if(I.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(I.getUnderlineColor()).join(`,`)})`;else{let e=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&e<8&&(e+=8),b.style.textDecorationColor=y.ansi[e].css}}I.isOverline()&&(j.push(`xterm-overline`),C===` `&&(C=`\xA0`)),I.isStrikethrough()&&j.push(`xterm-strikethrough`),z&&(b.style.textDecoration=`underline`);let H=I.getFgColor(),ee=I.getFgColorMode(),U=I.getBgColor(),W=I.getBgColorMode(),G=!!I.isInverse();if(G){let e=H;H=U,U=e;let t=ee;ee=W,W=t}let K,te,ne,q=!1;switch(this._decorationService.forEachDecorationAtCell(N,t,void 0,(e=>{e.options.layer!==`top`&&q||(e.backgroundColorRGB&&(W=50331648,U=e.backgroundColorRGB.rgba>>8&16777215,K=e.backgroundColorRGB),e.foregroundColorRGB&&(ee=50331648,H=e.foregroundColorRGB.rgba>>8&16777215,te=e.foregroundColorRGB),q=e.options.layer===`top`)})),!q&&L&&(K=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,U=K.rgba>>8&16777215,W=50331648,q=!0,y.selectionForeground&&(ee=50331648,H=y.selectionForeground.rgba>>8&16777215,te=y.selectionForeground)),q&&j.push(`xterm-decoration-top`),W){case 16777216:case 33554432:ne=y.ansi[U],j.push(`xterm-bg-${U}`);break;case 50331648:ne=l.channels.toColor(U>>16,U>>8&255,255&U),this._addStyle(b,`background-color:#${h((U>>>0).toString(16),`0`,6)}`);break;default:G?(ne=y.foreground,j.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):ne=y.background}switch(K||I.isDim()&&(K=l.color.multiplyOpacity(ne,.5)),ee){case 16777216:case 33554432:I.isBold()&&H<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(H+=8),this._applyMinimumContrast(b,ne,y.ansi[H],I,K,void 0)||j.push(`xterm-fg-${H}`);break;case 50331648:let e=l.channels.toColor(H>>16&255,H>>8&255,255&H);this._applyMinimumContrast(b,ne,e,I,K,te)||this._addStyle(b,`color:#${h(H.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(b,ne,y.foreground,I,K,te)||G&&j.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}j.length&&=(b.className=j.join(` `),0),R||P||B?b.textContent=C:S++,A!==this.defaultSpacing&&(b.style.letterSpacing=`${A}px`),_.push(b),N=F}return b&&S&&(b.textContent=C),_}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,f.treatGlyphAsBackgroundColor)(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(i||a||(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=l.color.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return!!s&&(this._addStyle(e,`color:${s.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!(!n||!r)&&(this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0])}};function h(e,t,n){for(;e.length<n;)e=t+e;return e}t.DomRendererRowFactory=m=r([i(1,u.ICharacterJoinerService),i(2,c.IOptionsService),i(3,u.ICoreBrowserService),i(4,c.ICoreService),i(5,c.IDecorationService),i(6,u.IThemeService)],m)},2550:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}}},2223:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},6171:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},6052:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},456:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;let a=n(2585),o=n(8460),s=n(844),c=t.CharSizeService=class extends s.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this.register(new o.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new u(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=c=r([i(2,a.IOptionsService)],c);class l extends s.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}}class u extends l{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class d extends l{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}}},4269:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;let a=n(3734),o=n(643),s=n(511),c=n(2585);class l extends a.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=l;let u=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new s.CellData}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,s=0,c=t.getFg(0),l=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==c||this._workCell.bg!==l){if(e-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,s=a,c=this._workCell.fg,l=this._workCell.bg}a+=this._workCell.getChars().length||o.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(t,n,r,i,a){let o=t.substring(n,r),s=[];try{s=this._characterJoiners[0].handler(o)}catch(e){console.error(e)}for(let t=1;t<this._characterJoiners.length;t++)try{let n=this._characterJoiners[t].handler(o);for(let t=0;t<n.length;t++)e._mergeRanges(s,n[t])}catch(e){console.error(e)}return this._stringRangesToCellRanges(s,i,a),s}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,s=e[r];if(s){for(let c=n;c<this._bufferService.cols;c++){let n=t.getWidth(c),l=t.getString(c).length||o.WHITESPACE_CELL_CHAR.length;if(n!==0){if(!i&&s[0]<=a&&(s[0]=c,i=!0),s[1]<=a){if(s[1]=c,s=e[++r],!s)break;s[0]<=a?(s[0]=c,i=!0):i=!1}a+=l}}s&&(s[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0)}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};t.CharacterJoinerService=u=r([i(0,c.IBufferService)],u)},5114:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;let r=n(844),i=n(8460),a=n(3656);class o extends r.Disposable{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new s(this._window),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new i.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,i.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener(`focus`,(()=>this._isFocused=!0)),this._textarea.addEventListener(`blur`,(()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}t.CoreBrowserService=o;class s extends r.Disposable{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this.register(new r.MutableDisposable),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,r.toDisposable)((()=>this.clearListener())))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,a.addDisposableDomListener)(this._parentWindow,`resize`,(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;let r=n(844);class i extends r.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,r.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}}t.LinkProviderService=i},8934:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;let a=n(4725),o=n(9806),s=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return(0,o.getCoords)(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=(0,o.getCoordsRelativeToElement)(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};t.MouseService=s=r([i(0,a.IRenderService),i(1,a.ICharSizeService)],s)},3230:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;let a=n(6193),o=n(4725),s=n(8460),c=n(844),l=n(7226),u=n(2585),d=t.RenderService=class extends c.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,n,r,i,o,u,d){super(),this._rowCount=e,this._charSizeService=r,this._renderer=this.register(new c.MutableDisposable),this._pausedResizeTask=new l.DebouncedIdleTask,this._observerDisposable=this.register(new c.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new s.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new s.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new s.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new s.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new a.RenderDebouncer(((e,t)=>this._renderRows(e,t)),u),this.register(this._renderDebouncer),this.register(u.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(o.onResize((()=>this._fullRefresh()))),this.register(o.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(n.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(i.onDecorationRegistered((()=>this._fullRefresh()))),this.register(i.onDecorationRemoved((()=>this._fullRefresh()))),this.register(n.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],(()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()}))),this.register(n.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],(()=>this.refreshRows(o.buffer.y,o.buffer.y,!0)))),this.register(d.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(u.window,t),this.register(u.onWindowChange((e=>this._registerIntersectionObserver(e,t))))}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver((e=>this._handleIntersectionChange(e[e.length-1])),{threshold:0});n.observe(t),this._observerDisposable.value=(0,c.toDisposable)((()=>n.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){this._isPaused?this._needsFullRefresh=!0:(n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((e=>this.refreshRows(e.start,e.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=d=r([i(2,u.IOptionsService),i(3,o.ICharSizeService),i(4,u.IDecorationService),i(5,u.IBufferService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],d)},9312:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;let a=n(9806),o=n(9504),s=n(456),c=n(4725),l=n(8460),u=n(844),d=n(6114),f=n(4841),p=n(511),m=n(2585),h=RegExp(`\xA0`,`g`),g=t.SelectionService=class extends u.Disposable{constructor(e,t,n,r,i,a,o,c,d){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=c,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new l.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new l.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new l.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((e=>this._handleTrim(e))),this.register(this._bufferService.buffers.onBufferActivate((e=>this._handleBufferActivate(e)))),this.enable(),this._model=new s.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map((e=>e.replace(h,` `))).join(d.isWindows?`\r
27
28
  `:`
28
29
  `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh())),d.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!!(n&&r&&t)&&this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!(!n||!r)&&this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=(0,f.getRangeLength)(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return!!r&&(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=(0,a.getCoordsRelativeToElement)(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return d.isMac?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,(e.button!==2||!this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}t&&t[0]===this._model.selectionEnd[0]&&t[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=(0,o.moveToCellSequence)(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);n?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,n)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((e=>this._handleTrim(e)))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(t||o.slice(s,c).trim()!==``){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,f.getRangeLength)(n,this._bufferService.cols)}};t.SelectionService=g=r([i(3,m.IBufferService),i(4,m.ICoreService),i(5,c.IMouseService),i(6,m.IOptionsService),i(7,c.IRenderService),i(8,c.ICoreBrowserService)],g)},4725:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;let r=n(8343);t.ICharSizeService=(0,r.createDecorator)(`CharSizeService`),t.ICoreBrowserService=(0,r.createDecorator)(`CoreBrowserService`),t.IMouseService=(0,r.createDecorator)(`MouseService`),t.IRenderService=(0,r.createDecorator)(`RenderService`),t.ISelectionService=(0,r.createDecorator)(`SelectionService`),t.ICharacterJoinerService=(0,r.createDecorator)(`CharacterJoinerService`),t.IThemeService=(0,r.createDecorator)(`ThemeService`),t.ILinkProviderService=(0,r.createDecorator)(`LinkProviderService`)},6731:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;let a=n(7239),o=n(8055),s=n(8460),c=n(844),l=n(2585),u=o.css.toColor(`#ffffff`),d=o.css.toColor(`#000000`),f=o.css.toColor(`#ffffff`),p=o.css.toColor(`#000000`),m={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let e=[o.css.toColor(`#2e3436`),o.css.toColor(`#cc0000`),o.css.toColor(`#4e9a06`),o.css.toColor(`#c4a000`),o.css.toColor(`#3465a4`),o.css.toColor(`#75507b`),o.css.toColor(`#06989a`),o.css.toColor(`#d3d7cf`),o.css.toColor(`#555753`),o.css.toColor(`#ef2929`),o.css.toColor(`#8ae234`),o.css.toColor(`#fce94f`),o.css.toColor(`#729fcf`),o.css.toColor(`#ad7fa8`),o.css.toColor(`#34e2e2`),o.css.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:o.channels.toCss(r,i,a),rgba:o.channels.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+10*t;e.push({css:o.channels.toCss(n,n,n),rgba:o.channels.toRgba(n,n,n)})}return e})());let h=t.ThemeService=class extends c.Disposable{get colors(){return this._colors}constructor(e){super(),this._optionsService=e,this._contrastCache=new a.ColorContrastCache,this._halfContrastCache=new a.ColorContrastCache,this._onChangeColors=this.register(new s.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:u,background:d,cursor:f,cursorAccent:p,selectionForeground:void 0,selectionBackgroundTransparent:m,selectionBackgroundOpaque:o.color.blend(d,m),selectionInactiveBackgroundTransparent:m,selectionInactiveBackgroundOpaque:o.color.blend(d,m),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange(`theme`,(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(e={}){let n=this._colors;if(n.foreground=g(e.foreground,u),n.background=g(e.background,d),n.cursor=g(e.cursor,f),n.cursorAccent=g(e.cursorAccent,p),n.selectionBackgroundTransparent=g(e.selectionBackground,m),n.selectionBackgroundOpaque=o.color.blend(n.background,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundTransparent=g(e.selectionInactiveBackground,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundOpaque=o.color.blend(n.background,n.selectionInactiveBackgroundTransparent),n.selectionForeground=e.selectionForeground?g(e.selectionForeground,o.NULL_COLOR):void 0,n.selectionForeground===o.NULL_COLOR&&(n.selectionForeground=void 0),o.color.isOpaque(n.selectionBackgroundTransparent)&&(n.selectionBackgroundTransparent=o.color.opacity(n.selectionBackgroundTransparent,.3)),o.color.isOpaque(n.selectionInactiveBackgroundTransparent)&&(n.selectionInactiveBackgroundTransparent=o.color.opacity(n.selectionInactiveBackgroundTransparent,.3)),n.ansi=t.DEFAULT_ANSI_COLORS.slice(),n.ansi[0]=g(e.black,t.DEFAULT_ANSI_COLORS[0]),n.ansi[1]=g(e.red,t.DEFAULT_ANSI_COLORS[1]),n.ansi[2]=g(e.green,t.DEFAULT_ANSI_COLORS[2]),n.ansi[3]=g(e.yellow,t.DEFAULT_ANSI_COLORS[3]),n.ansi[4]=g(e.blue,t.DEFAULT_ANSI_COLORS[4]),n.ansi[5]=g(e.magenta,t.DEFAULT_ANSI_COLORS[5]),n.ansi[6]=g(e.cyan,t.DEFAULT_ANSI_COLORS[6]),n.ansi[7]=g(e.white,t.DEFAULT_ANSI_COLORS[7]),n.ansi[8]=g(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),n.ansi[9]=g(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),n.ansi[10]=g(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),n.ansi[11]=g(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),n.ansi[12]=g(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),n.ansi[13]=g(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),n.ansi[14]=g(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),n.ansi[15]=g(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){let r=Math.min(n.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<r;i++)n.ansi[i+16]=g(e.extendedAnsi[i],t.DEFAULT_ANSI_COLORS[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e!==void 0)switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}else for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e]}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function g(e,t){if(e!==void 0)try{return o.css.toColor(e)}catch{}return t}t.ThemeService=h=r([i(0,l.IOptionsService)],h)},6349:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this.register(new r.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new r.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new r.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}}t.CircularList=a},1439:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function e(t,n=5){if(typeof t!=`object`)return t;let r=Array.isArray(t)?[]:{};for(let i in t)r[i]=n<=1?t[i]:t[i]&&e(t[i],n-1);return r}},8055:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let n=0,r=0,i=0,a=0;var o,s,c,l,u;function d(e){let t=e.toString(16);return t.length<2?`0`+t:t}function f(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:`#00000000`,rgba:0},function(e){e.toCss=function(e,t,n,r){return r===void 0?`#${d(e)}${d(t)}${d(n)}`:`#${d(e)}${d(t)}${d(n)}${d(r)}`},e.toRgba=function(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0},e.toColor=function(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}}(o||(t.channels=o={})),function(e){function t(e,t){return a=Math.round(255*t),[n,r,i]=u.toChannels(e.rgba),{css:o.toCss(n,r,i,a),rgba:o.toRgba(n,r,i,a)}}e.blend=function(e,t){if(a=(255&t.rgba)/255,a===1)return{css:t.css,rgba:t.rgba};let s=t.rgba>>24&255,c=t.rgba>>16&255,l=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,f=e.rgba>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),{css:o.toCss(n,r,i),rgba:o.toRgba(n,r,i)}},e.isOpaque=function(e){return(255&e.rgba)==255},e.ensureContrastRatio=function(e,t,n){let r=u.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[n,r,i]=u.toChannels(t),{css:o.toCss(n,r,i),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return a=255&e.rgba,t(e,a*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(s||(t.color=s={})),function(e){let t,s;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let n=e.getContext(`2d`,{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation=`copy`,s=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),o.toColor(n,r,i);case 5:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),o.toColor(n,r,i,a);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let c=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return n=parseInt(c[1]),r=parseInt(c[2]),i=parseInt(c[3]),a=Math.round(255*(c[5]===void 0?1:parseFloat(c[5]))),o.toColor(n,r,i,a);if(!t||!s||(t.fillStyle=s,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[n,r,i,a]=t.getImageData(0,0,1,1).data,a!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:o.toRgba(n,r,i,a),css:e}}}(c||(t.css=c={})),function(e){function t(e,t,n){let r=e/255,i=t/255,a=n/255;return .2126*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.7152*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)+.0722*(a<=.03928?a/12.92:((a+.055)/1.055)**2.4)}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(l||(t.rgb=l={})),function(e){function t(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(.1*o)),s-=Math.max(0,Math.ceil(.1*s)),c-=Math.max(0,Math.ceil(.1*c)),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}function s(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),s=Math.min(255,s+Math.ceil(.1*(255-s))),c=Math.min(255,c+Math.ceil(.1*(255-c))),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.blend=function(e,t){if(a=(255&t)/255,a===1)return t;let s=t>>24&255,c=t>>16&255,l=t>>8&255,u=e>>24&255,d=e>>16&255,f=e>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),o.toRgba(n,r,i)},e.ensureContrastRatio=function(e,n,r){let i=l.relativeLuminance(e>>8),a=l.relativeLuminance(n>>8);if(f(i,a)<r){if(a<i){let a=t(e,n,r),o=f(i,l.relativeLuminance(a>>8));if(o<r){let t=s(e,n,r);return o>f(i,l.relativeLuminance(t>>8))?a:t}return a}let o=s(e,n,r),c=f(i,l.relativeLuminance(o>>8));if(c<r){let a=t(e,n,r);return c>f(i,l.relativeLuminance(a>>8))?o:a}return o}},e.reduceLuminance=t,e.increaseLuminance=s,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(u||(t.rgba=u={})),t.toPaddedHex=d,t.contrastRatio=f},8969:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;let r=n(844),i=n(2585),a=n(4348),o=n(7866),s=n(744),c=n(7302),l=n(6975),u=n(8460),d=n(1753),f=n(1480),p=n(7994),m=n(9282),h=n(5435),g=n(5981),_=n(2660),v=!1;class y extends r.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new u.EventEmitter),this._onScroll.event((e=>{this._onScrollApi?.fire(e.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}constructor(e){super(),this._windowsWrappingHeuristics=this.register(new r.MutableDisposable),this._onBinary=this.register(new u.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new u.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new u.EventEmitter),this._instantiationService=new a.InstantiationService,this.optionsService=this.register(new c.OptionsService(e)),this._instantiationService.setService(i.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(s.BufferService)),this._instantiationService.setService(i.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(o.LogService)),this._instantiationService.setService(i.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(l.CoreService)),this._instantiationService.setService(i.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(i.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(f.UnicodeService)),this._instantiationService.setService(i.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(p.CharsetService),this._instantiationService.setService(i.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(_.OscLinkService),this._instantiationService.setService(i.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new h.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,u.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,u.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,u.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,u.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new g.WriteBuffer(((e,t)=>this._inputHandler.parse(e,t)))),this.register((0,u.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=i.LogLevelEnum.WARN&&!v&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),v=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,s.MINIMUM_COLS),t=Math.max(t,s.MINIMUM_ROWS),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t,n){this._bufferService.scrollLines(e,t,n)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(m.updateWindowsModeWrappedState.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},(()=>((0,m.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,r.toDisposable)((()=>{for(let t of e)t.dispose()}))}}}t.CoreTerminal=y},8460:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},5435:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;let a=n(2584),o=n(7116),s=n(2015),c=n(844),l=n(482),u=n(8437),d=n(8460),f=n(643),p=n(511),m=n(3734),h=n(2585),g=n(1480),_=n(6242),v=n(6351),y=n(5941),b={"(":0,")":1,"*":2,"+":3,"-":1,".":2},x=131072;function S(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var C;(function(e){e[e.GET_WIN_SIZE_PIXELS=0]=`GET_WIN_SIZE_PIXELS`,e[e.GET_CELL_SIZE_PIXELS=1]=`GET_CELL_SIZE_PIXELS`})(C||(t.WindowsOptionsReportType=C={}));let w=0;class T extends c.Disposable{getAttrData(){return this._curAttrData}constructor(e,t,n,r,i,c,f,m,h=new s.EscapeSequenceParser){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=c,this._coreMouseService=f,this._unicodeService=m,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new l.StringToUtf32,this._utf8Decoder=new l.Utf8ToUtf32,this._workCell=new p.CellData,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new E(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._parser.setCsiHandlerFallback(((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})})),this._parser.setEscHandlerFallback((e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})})),this._parser.setExecuteHandlerFallback((e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})})),this._parser.setOscHandlerFallback(((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})})),this._parser.setDcsHandlerFallback(((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})})),this._parser.setPrintHandler(((e,t,n)=>this.print(e,t,n))),this._parser.registerCsiHandler({final:`@`},(e=>this.insertChars(e))),this._parser.registerCsiHandler({intermediates:` `,final:`@`},(e=>this.scrollLeft(e))),this._parser.registerCsiHandler({final:`A`},(e=>this.cursorUp(e))),this._parser.registerCsiHandler({intermediates:` `,final:`A`},(e=>this.scrollRight(e))),this._parser.registerCsiHandler({final:`B`},(e=>this.cursorDown(e))),this._parser.registerCsiHandler({final:`C`},(e=>this.cursorForward(e))),this._parser.registerCsiHandler({final:`D`},(e=>this.cursorBackward(e))),this._parser.registerCsiHandler({final:`E`},(e=>this.cursorNextLine(e))),this._parser.registerCsiHandler({final:`F`},(e=>this.cursorPrecedingLine(e))),this._parser.registerCsiHandler({final:`G`},(e=>this.cursorCharAbsolute(e))),this._parser.registerCsiHandler({final:`H`},(e=>this.cursorPosition(e))),this._parser.registerCsiHandler({final:`I`},(e=>this.cursorForwardTab(e))),this._parser.registerCsiHandler({final:`J`},(e=>this.eraseInDisplay(e,!1))),this._parser.registerCsiHandler({prefix:`?`,final:`J`},(e=>this.eraseInDisplay(e,!0))),this._parser.registerCsiHandler({final:`K`},(e=>this.eraseInLine(e,!1))),this._parser.registerCsiHandler({prefix:`?`,final:`K`},(e=>this.eraseInLine(e,!0))),this._parser.registerCsiHandler({final:`L`},(e=>this.insertLines(e))),this._parser.registerCsiHandler({final:`M`},(e=>this.deleteLines(e))),this._parser.registerCsiHandler({final:`P`},(e=>this.deleteChars(e))),this._parser.registerCsiHandler({final:`S`},(e=>this.scrollUp(e))),this._parser.registerCsiHandler({final:`T`},(e=>this.scrollDown(e))),this._parser.registerCsiHandler({final:`X`},(e=>this.eraseChars(e))),this._parser.registerCsiHandler({final:`Z`},(e=>this.cursorBackwardTab(e))),this._parser.registerCsiHandler({final:"`"},(e=>this.charPosAbsolute(e))),this._parser.registerCsiHandler({final:`a`},(e=>this.hPositionRelative(e))),this._parser.registerCsiHandler({final:`b`},(e=>this.repeatPrecedingCharacter(e))),this._parser.registerCsiHandler({final:`c`},(e=>this.sendDeviceAttributesPrimary(e))),this._parser.registerCsiHandler({prefix:`>`,final:`c`},(e=>this.sendDeviceAttributesSecondary(e))),this._parser.registerCsiHandler({final:`d`},(e=>this.linePosAbsolute(e))),this._parser.registerCsiHandler({final:`e`},(e=>this.vPositionRelative(e))),this._parser.registerCsiHandler({final:`f`},(e=>this.hVPosition(e))),this._parser.registerCsiHandler({final:`g`},(e=>this.tabClear(e))),this._parser.registerCsiHandler({final:`h`},(e=>this.setMode(e))),this._parser.registerCsiHandler({prefix:`?`,final:`h`},(e=>this.setModePrivate(e))),this._parser.registerCsiHandler({final:`l`},(e=>this.resetMode(e))),this._parser.registerCsiHandler({prefix:`?`,final:`l`},(e=>this.resetModePrivate(e))),this._parser.registerCsiHandler({final:`m`},(e=>this.charAttributes(e))),this._parser.registerCsiHandler({final:`n`},(e=>this.deviceStatus(e))),this._parser.registerCsiHandler({prefix:`?`,final:`n`},(e=>this.deviceStatusPrivate(e))),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},(e=>this.softReset(e))),this._parser.registerCsiHandler({intermediates:` `,final:`q`},(e=>this.setCursorStyle(e))),this._parser.registerCsiHandler({final:`r`},(e=>this.setScrollRegion(e))),this._parser.registerCsiHandler({final:`s`},(e=>this.saveCursor(e))),this._parser.registerCsiHandler({final:`t`},(e=>this.windowOptions(e))),this._parser.registerCsiHandler({final:`u`},(e=>this.restoreCursor(e))),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},(e=>this.insertColumns(e))),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},(e=>this.deleteColumns(e))),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},(e=>this.selectProtected(e))),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},(e=>this.requestMode(e,!0))),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},(e=>this.requestMode(e,!1))),this._parser.setExecuteHandler(a.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(a.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(a.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(a.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(a.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(a.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(a.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(a.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(a.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new _.OscHandler((e=>(this.setTitle(e),this.setIconName(e),!0)))),this._parser.registerOscHandler(1,new _.OscHandler((e=>this.setIconName(e)))),this._parser.registerOscHandler(2,new _.OscHandler((e=>this.setTitle(e)))),this._parser.registerOscHandler(4,new _.OscHandler((e=>this.setOrReportIndexedColor(e)))),this._parser.registerOscHandler(8,new _.OscHandler((e=>this.setHyperlink(e)))),this._parser.registerOscHandler(10,new _.OscHandler((e=>this.setOrReportFgColor(e)))),this._parser.registerOscHandler(11,new _.OscHandler((e=>this.setOrReportBgColor(e)))),this._parser.registerOscHandler(12,new _.OscHandler((e=>this.setOrReportCursorColor(e)))),this._parser.registerOscHandler(104,new _.OscHandler((e=>this.restoreIndexedColor(e)))),this._parser.registerOscHandler(110,new _.OscHandler((e=>this.restoreFgColor(e)))),this._parser.registerOscHandler(111,new _.OscHandler((e=>this.restoreBgColor(e)))),this._parser.registerOscHandler(112,new _.OscHandler((e=>this.restoreCursorColor(e)))),this._parser.registerEscHandler({final:`7`},(()=>this.saveCursor())),this._parser.registerEscHandler({final:`8`},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:`D`},(()=>this.index())),this._parser.registerEscHandler({final:`E`},(()=>this.nextLine())),this._parser.registerEscHandler({final:`H`},(()=>this.tabSet())),this._parser.registerEscHandler({final:`M`},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:`=`},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:`>`},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:`c`},(()=>this.fullReset())),this._parser.registerEscHandler({final:`n`},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:`o`},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:`|`},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:`}`},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:`~`},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:`%`,final:`@`},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:`%`,final:`G`},(()=>this.selectDefaultCharset()));for(let e in o.CHARSETS)this._parser.registerEscHandler({intermediates:`(`,final:e},(()=>this.selectCharset(`(`+e))),this._parser.registerEscHandler({intermediates:`)`,final:e},(()=>this.selectCharset(`)`+e))),this._parser.registerEscHandler({intermediates:`*`,final:e},(()=>this.selectCharset(`*`+e))),this._parser.registerEscHandler({intermediates:`+`,final:e},(()=>this.selectCharset(`+`+e))),this._parser.registerEscHandler({intermediates:`-`,final:e},(()=>this.selectCharset(`-`+e))),this._parser.registerEscHandler({intermediates:`.`,final:e},(()=>this.selectCharset(`.`+e))),this._parser.registerEscHandler({intermediates:`/`,final:e},(()=>this.selectCharset(`/`+e)));this._parser.registerEscHandler({intermediates:`#`,final:`8`},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((e=>(this._logService.error(`Parsing error: `,e),e))),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new v.DcsHandler(((e,t)=>this.requestStatusString(e,t))))}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=h.LogLevelEnum.WARN&&Promise.race([e,new Promise(((e,t)=>setTimeout((()=>t(`#SLOW_TIMEOUT`)),5e3)))]).catch((e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than 5000 ms`)}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>x&&(a=this._parseStack.position+x)}if(this._logService.logLevel<=h.LogLevelEnum.DEBUG&&this._logService.debug(`parsing data`+(typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,(e=>String.fromCharCode(e))).join(``)}"`),typeof e==`string`?e.split(``).map((e=>e.charCodeAt(0))):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<x&&(this._parseBuffer=new Uint32Array(Math.min(e.length,x))),o||this._dirtyRowTracker.clearRange(),e.length>x)for(let t=a;t<e.length;t+=x){let a=t+x<e.length?t+x:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}this._activeBuffer.x===r&&this._activeBuffer.y===i||this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(c,this._bufferService.rows-1),Math.min(s,this._bufferService.rows-1))}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,p=this._curAttrData,m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&m.getWidth(this._activeBuffer.x-1)===2&&m.setCellFromCodepoint(this._activeBuffer.x-1,0,1,p);let h=this._parser.precedingJoinState;for(let _=t;_<n;++_){if(r=e[_],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,h);i=g.UnicodeService.extractWidth(t);let n=g.UnicodeService.extractShouldJoin(t),v=n?g.UnicodeService.extractWidth(h):0;if(h=t,o&&this._onA11yChar.fire((0,l.stringFromCodePoint)(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-v>s){if(c){let e=m,t=this._activeBuffer.x-v;for(this._activeBuffer.x=v,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),v>0&&m instanceof u.BufferLine&&m.copyCellsFrom(e,t,0,v,!1);t<s;)e.setCellFromCodepoint(t++,0,1,p)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=m.getWidth(this._activeBuffer.x-1)?1:2;m.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-v;--e>=0;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}else if(d&&(m.insertCells(this._activeBuffer.x,i-v,this._activeBuffer.getNullCell(p)),m.getWidth(s-1)===2&&m.setCellFromCodepoint(s-1,f.NULL_CELL_CODE,f.NULL_CELL_WIDTH,p)),m.setCellFromCodepoint(this._activeBuffer.x++,r,i,p),i>0)for(;--i;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}this._parser.precedingJoinState=h,this._activeBuffer.x<s&&n-t>0&&m.getWidth(this._activeBuffer.x)===0&&!m.hasContent(this._activeBuffer.x)&&m.setCellFromCodepoint(this._activeBuffer.x,0,1,p),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final!==`t`||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,(e=>!S(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new v.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new _.OscHandler(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),t!==2&&t!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){let n;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(u.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=g.UnicodeService.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(a.C0.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(a.C0.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(a.C0.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(a.C0.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(a.C0.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,o.DEFAULT_CHARSET),this._charsetService.setgCharset(1,o.DEFAULT_CHARSET),this._charsetService.setgCharset(2,o.DEFAULT_CHARSET),this._charsetService.setgCharset(3,o.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(e,t){let n=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:i}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=e=>e?1:2,p=e.params[0];return m=p,h=t?p===2?4:p===4?f(o.modes.insertMode):p===12?3:p===20?f(d.convertEol):0:p===1?f(n.applicationCursorKeys):p===3?d.windowOptions.setWinLines?c===80?2:+(c===132):0:p===6?f(n.origin):p===7?f(n.wraparound):p===8?3:p===9?f(r===`X10`):p===12?f(d.cursorBlink):p===25?f(!o.isCursorHidden):p===45?f(n.reverseWraparound):p===66?f(n.applicationKeypad):p===67?4:p===1e3?f(r===`VT200`):p===1002?f(r===`DRAG`):p===1003?f(r===`ANY`):p===1004?f(n.sendFocus):p===1005?4:p===1006?f(i===`SGR`):p===1015?4:p===1016?f(i===`SGR_PIXELS`):p===1048?1:p===47||p===1047||p===1049?f(l===u):p===2004?f(n.bracketedPasteMode):0,o.triggerDataEvent(`${a.C0.ESC}[${t?``:`?`}${m};${h}$y`),!0;var m,h}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=m.AttributeData.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|255&n),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=u.DEFAULT_ATTR_DATA.fg,e.bg=u.DEFAULT_ATTR_DATA.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777224|n-90):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777224|n-100):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=16777215&u.DEFAULT_ATTR_DATA.fg):n===49?(r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=16777215&u.DEFAULT_ATTR_DATA.fg,r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${a.C0.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.params[0]||1;switch(t){case 1:case 2:this._optionsService.options.cursorStyle=`block`;break;case 3:case 4:this._optionsService.options.cursorStyle=`underline`;break;case 5:case 6:this._optionsService.options.cursorStyle=`bar`}let n=t%2==1;return this._optionsService.options.cursorBlink=n,!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!S(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(C.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(C.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${a.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:t!==0&&t!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),t!==0&&t!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:t!==0&&t!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),t!==0&&t!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(D(n)){if(r===`?`)t.push({type:0,index:n});else{let e=(0,y.parseColor)(r);e&&t.push({type:1,index:n,color:e})}}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.split(`;`);return!(t.length<2)&&(t[1]?this._createHyperlink(t[0],t[1]):!t[0]&&this._finishHyperlink())}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex((e=>e.startsWith(`id=`)));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=(0,y.parseColor)(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);D(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,o.DEFAULT_CHARSET),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(b[e[0]],o.CHARSETS[e[1]]||o.DEFAULT_CHARSET),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new p.CellData;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=this._bufferService.buffer,r=this._optionsService.rawOptions;return(e=>(this._coreService.triggerDataEvent(`${a.C0.ESC}${e}${a.C0.ESC}\\`),!0))(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-+!!r.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}}t.InputHandler=T;let E=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(w=e,e=t,t=w),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function D(e){return 0<=e&&e<256}E=r([i(0,h.IBufferService)],E)},844:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}},1505:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=n,t.FourKeyMap=class{constructor(){this._data=new n}set(e,t,r,i,a){this._data.get(e,t)||this._data.set(e,t,new n),this._data.get(e,t).set(r,i,a)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}}},6114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<`u`&&`title`in process;let n=t.isNode?`node`:navigator.userAgent,r=t.isNode?`node`:navigator.platform;t.isFirefox=n.includes(`Firefox`),t.isLegacyEdge=n.includes(`Edge`),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.getSafariVersion=function(){if(!t.isSafari)return 0;let e=n.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])},t.isMac=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(r),t.isIpad=r===`iPad`,t.isIphone=r===`iPhone`,t.isWindows=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(r),t.isLinux=r.indexOf(`Linux`)>=0,t.isChromeOS=/\bCrOS\b/.test(n)},6106:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let n=0;t.SortedList=class{constructor(e){this._getKey=e,this._array=[]}clear(){this._array.length=0}insert(e){this._array.length===0?this._array.push(e):(n=this._search(this._getKey(e)),this._array.splice(n,0,e))}delete(e){if(this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(n=this._search(t),n===-1)||this._getKey(this._array[n])!==t)return!1;do if(this._array[n]===e)return this._array.splice(n,1),!0;while(++n<this._array.length&&this._getKey(this._array[n])===t);return!1}*getKeyIterator(e){if(this._array.length!==0&&(n=this._search(e),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===e))do yield this._array[n];while(++n<this._array.length&&this._getKey(this._array[n])===e)}forEachByKey(e,t){if(this._array.length!==0&&(n=this._search(e),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===e))do t(this._array[n]);while(++n<this._array.length&&this._getKey(this._array[n])===e)}values(){return[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else{if(!(i<e)){for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}t=r+1}}return t}}},7226:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let r=n(6114);class i{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),n=Math.max(t,n),i=e.timeRemaining(),1.5*n>i)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}}class a extends i{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=a,t.IdleTaskQueue=!r.isNode&&`requestIdleCallback`in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:a,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},9282:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;let r=n(643);t.updateWindowsModeWrappedState=function(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[r.CHAR_DATA_CODE_INDEX]!==r.NULL_CELL_CODE&&t[r.CHAR_DATA_CODE_INDEX]!==r.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new r}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let e=new n;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=n;class r{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=r},9092:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;let r=n(6349),i=n(7226),a=n(3734),o=n(8437),s=n(4634),c=n(511),l=n(643),u=n(4863),d=n(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=o.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=c.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]),this._whitespaceCell=c.CellData.fromCharData([0,l.WHITESPACE_CELL_CHAR,l.WHITESPACE_CELL_WIDTH,l.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new i.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new a.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new a.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new o.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let n=e+this._optionsService.rawOptions.scrollback;return n>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:n}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=o.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(o.DEFAULT_ATTR_DATA),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new o.BufferLine(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new o.BufferLine(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=(0,s.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(o.DEFAULT_ATTR_DATA));if(n.length>0){let r=(0,s.reflowLargerCreateNewLayout)(this.lines,n);(0,s.reflowLargerApplyNewLayout)(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(o.DEFAULT_ATTR_DATA),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new o.BufferLine(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this.getNullCell(o.DEFAULT_ATTR_DATA),r=[],i=0;for(let a=this.lines.length-1;a>=0;a--){let c=this.lines.get(a);if(!c||!c.isWrapped&&c.getTrimmedLength()<=e)continue;let l=[c];for(;c.isWrapped&&a>0;)c=this.lines.get(--a),l.unshift(c);let u=this.ybase+this.y;if(u>=a&&u<a+l.length)continue;let d=l[l.length-1].getTrimmedLength(),f=(0,s.reflowSmallerGetNewLineLengths)(l,this._cols,e),p=f.length-l.length,m;m=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+p):Math.max(0,this.lines.length-this.lines.maxLength+p);let h=[];for(let e=0;e<p;e++){let e=this.getBlankLine(o.DEFAULT_ATTR_DATA,!0);h.push(e)}h.length>0&&(r.push({start:a+l.length+i,newLines:h}),i+=h.length),l.push(...h);let g=f.length-1,_=f[g];_===0&&(g--,_=f[g]);let v=l.length-p-1,y=d;for(;v>=0;){let e=Math.min(y,_);if(l[g]===void 0)break;if(l[g].copyCellsFrom(l[v],y-e,_-e,e,!0),_-=e,_===0&&(g--,_=f[g]),y-=e,y===0){v--;let e=Math.max(v,0);y=(0,s.getWrappedLineTrimmedLength)(l,e,this._cols)}}for(let t=0;t<l.length;t++)f[t]<e&&l[t].setCell(f[t],n);let b=p-m;for(;b-->0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+i)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+p,this.ybase+t-1)}if(r.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,a=n-1,o=0,s=r[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+i);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+i-1);l>=0;l--)if(s&&s.start>a+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:a+1,amount:s.newLines.length}),c+=s.newLines.length,s=r[++o]}else this.lines.set(l,t[a--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+i-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){let t=new u.Marker(e);return this.markers.push(t),t.register(this.lines.onTrim((e=>{t.line-=e,t.line<0&&t.dispose()}))),t.register(this.lines.onInsert((e=>{t.line>=e.index&&(t.line+=e.amount)}))),t.register(this.lines.onDelete((e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)}))),t.register(t.onDispose((()=>this._removeMarker(t)))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;let r=n(3734),i=n(511),a=n(643),o=n(482);t.DEFAULT_ATTR_DATA=Object.freeze(new r.AttributeData);let s=0;class c{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let r=t||i.CellData.fromCharData([0,a.NULL_CELL_CHAR,a.NULL_CELL_WIDTH,a.NULL_CELL_CODE]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[3*e+0],n=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:n?(0,o.stringFromCodePoint)(n):``,t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[3*e+1]=t[a.CHAR_DATA_ATTR_INDEX],t[a.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[a.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[a.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[a.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,o.stringFromCodePoint)(2097151&t):``}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return s=3*e,t.content=this._data[s+0],t.fg=this._data[s+1],t.bg=this._data[s+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,n,r){268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=t|n<<22,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[3*e+0];2097152&r?this._combined[e]+=(0,o.stringFromCodePoint)(t):2097151&r?(this._combined[e]=(0,o.stringFromCodePoint)(2097151&r)+(0,o.stringFromCodePoint)(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[3*e+0]=r}insertCells(e,t,n){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new i.CellData;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new i.CellData;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let n=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*n)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,4*n*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t)for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let e=new c(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let t in this._combined)e._combined[t]=this._combined[t];for(let t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<3;e++)this._data[3*(n+i)+e]=a[3*(t+i)+e];268435456&a[3*(t+i)+2]&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<3;e++)this._data[3*(n+i)+e]=a[3*(t+i)+e];268435456&a[3*(t+i)+2]&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[3*t+0],n=2097151&e,s=2097152&e?this._combined[t]:n?(0,o.stringFromCodePoint)(n):a.WHITESPACE_CELL_CHAR;if(i+=s,r)for(let e=0;e<s.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}}t.BufferLine=c},4841:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}},4634:(e,t)=>{function n(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(i>=s&&i<c){s+=u.length-1;continue}let d=0,f=n(u,d,t),p=1,m=0;for(;p<u.length;){let e=n(u,p,t),i=e-m,o=r-f,s=Math.min(i,o);u[d].copyCellsFrom(u[p],m,f,s,!1),f+=s,f===r&&(d++,f=0),m+=s,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(r-1)===2&&(u[d].copyCellsFrom(u[d-1],r-1,f++,1,!1),u[d-1].setCell(r-1,a))}u[d].replaceCells(f,r,a);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o},t.reflowLargerCreateNewLayout=function(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}},t.reflowLargerApplyNewLayout=function(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length},t.reflowSmallerGetNewLineLengths=function(e,t,r){let i=[],a=e.map(((r,i)=>n(e,i,t))).reduce(((e,t)=>e+t)),o=0,s=0,c=0;for(;c<a;){if(a-c<r){i.push(a-c);break}o+=r;let l=n(e,s,t);o>l&&(o-=l,s++);let u=e[s].getWidth(o-1)===2;u&&o--;let d=u?r-1:r;i.push(d),c+=d}return i},t.getWrappedLineTrimmedLength=n},5295:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;let r=n(8460),i=n(844),a=n(9092);class o extends i.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this.register(new r.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,(()=>this.setupTabStops())))}reset(){this._normal=new a.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new a.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}}t.BufferSet=o},511:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;let r=n(482),i=n(643),a=n(3734);class o extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=``}static fromCharData(e){let t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,r.stringFromCodePoint)(2097151&this.content):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(e[i.CHAR_DATA_CHAR_INDEX].length===2){let n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},643:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR=``,t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=` `,t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;let r=n(8460),i=n(844);class a{get id(){return this._id}constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=a._nextId++,this._onDispose=this.register(new r.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,i.disposeArray)(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}}t.Marker=a,a._nextId=1},7116:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:`␤`,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},t.CHARSETS.A={"#":`£`},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},t.CHARSETS.C=t.CHARSETS[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},t.CHARSETS.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},t.CHARSETS.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},t.CHARSETS.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},t.CHARSETS.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},t.CHARSETS.E=t.CHARSETS[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},t.CHARSETS.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},t.CHARSETS.H=t.CHARSETS[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},t.CHARSETS[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`}},2584:(e,t)=>{var n,r,i;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(e){e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
29
30
  `,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``}(n||(t.C0=n={})),function(e){e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`}(r||(t.C1=r={})),function(e){e.ST=`${n.ESC}\\`}(i||(t.C1_ESCAPED=i={}))},7399:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;let r=n(2584),i={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};t.evaluateKeyboardEvent=function(e,t,n,a){let o={type:0,cancel:!1,key:void 0},s=+!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`:e.key===`UIKeyInputRightArrow`?o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`);break;case 8:o.key=e.ctrlKey?`\b`:r.C0.DEL,e.altKey&&(o.key=r.C0.ESC+o.key);break;case 9:if(e.shiftKey){o.key=r.C0.ESC+`[Z`;break}o.key=r.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?r.C0.ESC+r.C0.CR:r.C0.CR,o.cancel=!0;break;case 27:o.key=r.C0.ESC,e.altKey&&(o.key=r.C0.ESC+r.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`D`,o.key===r.C0.ESC+`[1;3D`&&(o.key=r.C0.ESC+(n?`b`:`[1;5D`))):o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`;break;case 39:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`C`,o.key===r.C0.ESC+`[1;3C`&&(o.key=r.C0.ESC+(n?`f`:`[1;5C`))):o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`;break;case 38:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`A`,n||o.key!==r.C0.ESC+`[1;3A`||(o.key=r.C0.ESC+`[1;5A`)):o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`;break;case 40:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`B`,n||o.key!==r.C0.ESC+`[1;3B`||(o.key=r.C0.ESC+`[1;5B`)):o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`;break;case 45:e.shiftKey||e.ctrlKey||(o.key=r.C0.ESC+`[2~`);break;case 46:o.key=s?r.C0.ESC+`[3;`+(s+1)+`~`:r.C0.ESC+`[3~`;break;case 36:o.key=s?r.C0.ESC+`[1;`+(s+1)+`H`:t?r.C0.ESC+`OH`:r.C0.ESC+`[H`;break;case 35:o.key=s?r.C0.ESC+`[1;`+(s+1)+`F`:t?r.C0.ESC+`OF`:r.C0.ESC+`[F`;break;case 33:e.shiftKey?o.type=2:o.key=e.ctrlKey?r.C0.ESC+`[5;`+(s+1)+`~`:r.C0.ESC+`[5~`;break;case 34:e.shiftKey?o.type=3:o.key=e.ctrlKey?r.C0.ESC+`[6;`+(s+1)+`~`:r.C0.ESC+`[6~`;break;case 112:o.key=s?r.C0.ESC+`[1;`+(s+1)+`P`:r.C0.ESC+`OP`;break;case 113:o.key=s?r.C0.ESC+`[1;`+(s+1)+`Q`:r.C0.ESC+`OQ`;break;case 114:o.key=s?r.C0.ESC+`[1;`+(s+1)+`R`:r.C0.ESC+`OR`;break;case 115:o.key=s?r.C0.ESC+`[1;`+(s+1)+`S`:r.C0.ESC+`OS`;break;case 116:o.key=s?r.C0.ESC+`[15;`+(s+1)+`~`:r.C0.ESC+`[15~`;break;case 117:o.key=s?r.C0.ESC+`[17;`+(s+1)+`~`:r.C0.ESC+`[17~`;break;case 118:o.key=s?r.C0.ESC+`[18;`+(s+1)+`~`:r.C0.ESC+`[18~`;break;case 119:o.key=s?r.C0.ESC+`[19;`+(s+1)+`~`:r.C0.ESC+`[19~`;break;case 120:o.key=s?r.C0.ESC+`[20;`+(s+1)+`~`:r.C0.ESC+`[20~`;break;case 121:o.key=s?r.C0.ESC+`[21;`+(s+1)+`~`:r.C0.ESC+`[21~`;break;case 122:o.key=s?r.C0.ESC+`[23;`+(s+1)+`~`:r.C0.ESC+`[23~`;break;case 123:o.key=s?r.C0.ESC+`[24;`+(s+1)+`~`:r.C0.ESC+`[24~`;break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey){if(n&&!a||!e.altKey||e.metaKey)!n||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(o.key=r.C0.US),e.key===`@`&&(o.key=r.C0.NUL)):e.keyCode===65&&(o.type=1);else{let t=i[e.keyCode]?.[+!!e.shiftKey];if(t)o.key=r.C0.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),o.key=r.C0.ESC+n}else if(e.keyCode===32)o.key=r.C0.ESC+(e.ctrlKey?r.C0.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),o.key=r.C0.ESC+t,o.cancel=!0}}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=r.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=r.C0.DEL:e.keyCode===219?o.key=r.C0.ESC:e.keyCode===220?o.key=r.C0.FS:e.keyCode===221&&(o.key=r.C0.GS)}return o}},482:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(a=e[d+2])||128&(o=e[d+3]));)t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=o,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((224&r)==192){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},225:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;let r=n(1480),i=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],a=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],o;t.UnicodeV6=class{constructor(){if(this.version=`6`,!o){o=new Uint8Array(65536),o.fill(1),o[0]=0,o.fill(0,1,32),o.fill(0,127,160),o.fill(2,4352,4448),o[9001]=2,o[9002]=2,o.fill(2,11904,42192),o[12351]=1,o.fill(2,44032,55204),o.fill(2,63744,64256),o.fill(2,65040,65050),o.fill(2,65072,65136),o.fill(2,65280,65377),o.fill(2,65504,65511);for(let e=0;e<i.length;++e)o.fill(0,i[e][0],i[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?o[e]:function(e,t){let n,r=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e<t[n][0]))return!0;i=n-1}return!1}(e,a)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let e=r.UnicodeService.extractWidth(t);e===0?i=!1:e>n&&(n=e)}return r.UnicodeService.createPropertyValue(0,n,i)}}},5981:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new r.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let n;for(this._isSyncWriting=!0;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>5e7)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch((e=>(queueMicrotask((()=>{throw e})),Promise.resolve(!1)))).then(e=>Date.now()-n>=12?setTimeout((()=>this._innerWrite(0,e))):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-n>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=a},5941:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;let n=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,r=/^[\da-f]+$/;function i(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=n.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),r.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}},t.toRgbString=function(e,t=16){let[n,r,a]=e;return`rgb:${i(n,t)}/${i(r,t)}/${i(a,t)}`}},5770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;let r=n(482),i=n(8742),a=n(5770),o=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=o,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t);else this._handlerFb(this._ident,`HOOK`,t)}put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._ident,`PUT`,(0,r.utf32ToString)(e,t,n))}unhook(e,t=!0){if(this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].unhook(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,`UNHOOK`,e);this._active=o,this._ident=0}};let s=new i.Params;s.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data=``,this._params=s,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():s,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,r.utf32ToString)(e,t,n),this._data.length>a.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then((e=>(this._params=s,this._data=``,this._hitLimit=!1,e)));return this._params=s,this._data=``,this._hitLimit=!1,t}}},2015:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;let r=n(844),i=n(8742),a=n(6242),o=n(6351);class s{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}}t.TransitionTable=s,t.VT500_TRANSITION_TABLE=function(){let e=new s(4095),t=Array.apply(null,Array(256)).map(((e,t)=>t)),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}();class c extends r.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new i.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,r.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new a.OscParser),this._dcsParser=this.register(new o.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},(()=>!0))}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r,i=0,a=0,o=0;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](this._params),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 4:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],r=this._dcsParser.unhook(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],r=this._oscParser.end(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}}for(let n=o;n<t;++n){switch(i=e[n],a=this._transitions.table[this.currentState<<8|(i<160?i:160)],a>>4){case 2:for(let r=n+1;;++r){if(r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|i],s=o?o.length-1:-1;for(;s>=0&&(r=o[s](this._params),!0!==r);s--)if(r instanceof Promise)return this._preserveStack(3,o,s,a,n),r;s<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++n<t&&(i=e[n])>47&&i<60);n--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let c=this._escHandlers[this._collect<<8|i],l=c?c.length-1:-1;for(;l>=0&&(r=c[l](),!0!==r);l--)if(r instanceof Promise)return this._preserveStack(4,c,l,a,n),r;l<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let r=n+1;;++r)if(r>=t||(i=e[r])===24||i===26||i===27||i>127&&i<160){this._dcsParser.put(e,n,r),n=r-1;break}break;case 14:if(r=this._dcsParser.unhook(i!==24&&i!==26),r)return this._preserveStack(6,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let r=n+1;;r++)if(r>=t||(i=e[r])<32||i>127&&i<160){this._oscParser.put(e,n,r),n=r-1;break}break;case 6:if(r=this._oscParser.end(i!==24&&i!==26),r)return this._preserveStack(5,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&a}}}t.EscapeSequenceParser=c},6242:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;let r=n(5770),i=n(482),a=[];t.OscParser=class{constructor(){this._state=0,this._active=a,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=a}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||a,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,`START`)}_put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._id,`PUT`,(0,i.utf32ToString)(e,t,n))}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3){if(this._state===1&&this._start(),this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].end(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._id,`END`,e)}this._active=a,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,i.utf32ToString)(e,t,n),this._data.length>r.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then((e=>(this._data=``,this._hitLimit=!1,e)));return this._data=``,this._hitLimit=!1,t}}},8742:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;let n=2147483647;class r{static fromArray(e){let t=new r;if(!e.length)return t;for(let n=+!!Array.isArray(e[0]);n<e.length;++n){let r=e[n];if(Array.isArray(r))for(let e=0;e<r.length;++e)t.addSubParam(r[e]);else t.addParam(r)}return t}constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let e=new r(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>n?n:e}}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>n?n:e,this._subParamsIdx[this.length-1]++}}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=255&this._subParamsIdx[e];return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[t-1];r[t-1]=~i?Math.min(10*i+e,n):e}}t.Params=r},5741:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}}},8771:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;let r=n(3785),i=n(511);t.BufferApiView=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new r.BufferLineApiView(t)}getNullCell(){return new i.CellData}}},3785:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;let r=n(511);t.BufferLineApiView=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new r.CellData)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}}},8285:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;let r=n(8771),i=n(8460),a=n(844);class o extends a.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(new i.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new r.BufferApiView(this._core.buffers.normal,`normal`),this._alternate=new r.BufferApiView(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=o},7975:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,(e=>t(e.toArray())))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,((e,n)=>t(e,n.toArray())))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}}},7090:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}}},744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;let a=n(8460),o=n(844),s=n(5295),c=n(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let l=t.BufferService=class extends o.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new s.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t,n){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};t.BufferService=l=r([i(0,c.IOptionsService)],l)},7994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}}},1753:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;let a=n(2585),o=n(8460),s=n(844),c={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button!==4&&e.action===1&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function l(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=3&e.button,4&e.button&&(n|=64),8&e.button&&(n|=128),e.action===32?n|=32:e.action!==0||t||(n|=3)),n}let u=String.fromCharCode,d={DEFAULT:e=>{let t=[l(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`${u(t[0])}${u(t[1])}${u(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.x};${e.y}${t}`}},f=t.CoreMouseService=class extends s.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._onProtocolChange=this.register(new o.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(c))this.addProtocol(e,c[e]);for(let e of Object.keys(d))this.addEncoding(e,d[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};t.CoreMouseService=f=r([i(0,a.IBufferService),i(1,a.ICoreService)],f)},6975:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;let a=n(1439),o=n(8460),s=n(844),c=n(2585),l=Object.freeze({insertMode:!1}),u=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=t.CoreService=class extends s.Disposable{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new o.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new o.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new o.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new o.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}reset(){this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onBinary.fire(e))}};t.CoreService=d=r([i(0,c.IBufferService),i(1,c.ILogService),i(2,c.IOptionsService)],d)},9074:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;let r=n(8055),i=n(8460),a=n(844),o=n(6106),s=0,c=0;class l extends a.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new o.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new i.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new i.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,a.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let t=new u(e);if(t){let e=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())})),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,(t=>{s=t.options.x??0,c=s+(t.options.width??1),e>=s&&e<c&&(!n||(t.options.layer??`bottom`)===n)&&r(t)}))}}t.DecorationService=l;class u extends a.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this._cachedBg=this.options.backgroundColor?r.css.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?r.css.toColor(this.options.foregroundColor):void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new i.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new i.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;let r=n(2585),i=n(8343);class a{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}}t.ServiceCollection=a,t.InstantiationService=class{constructor(){this._services=new a,this._services.set(r.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=(0,i.getServiceDependencies)(e).sort(((e,t)=>e.index-t.index)),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id}.`);r.push(n)}let a=n.length>0?n[0].index:t.length;if(t.length!==a)throw Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}}},7866:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(844),o=n(2585),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:`xterm.js: `)+t,...n)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=l=r([i(0,o.IOptionsService)],l),t.setTraceLogger=function(e){c=e},t.traceCall=function(e,t,n){if(typeof n.value!=`function`)throw Error(`not supported`);let r=n.value;n.value=function(...e){if(c.logLevel!==o.LogLevelEnum.TRACE)return r.apply(this,e);c.trace(`GlyphRenderer#${r.name}(${e.map((e=>JSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},7302:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;let r=n(8460),i=n(844);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`courier-new, courier, monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:n(6114).isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRulerWidth:0};let a=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`];class o extends i.Disposable{constructor(e){super(),this._onOptionChange=this.register(new r.EventEmitter),this.onOptionChange=this._onOptionChange.event;let n={...t.DEFAULT_OPTIONS};for(let t in e)if(t in n)try{let r=e[t];n[t]=this._sanitizeAndValidateOption(t,r)}catch(e){console.error(e)}this.rawOptions=n,this.options={...n},this._setupOptions(),this.register((0,i.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(e,t){return this.onOptionChange((n=>{n===e&&t(this.rawOptions[e])}))}onMultipleOptionChange(e,t){return this.onOptionChange((n=>{e.indexOf(n)!==-1&&t()}))}_setupOptions(){let e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},n=(e,n)=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);n=this._sanitizeAndValidateOption(e,n),this.rawOptions[e]!==n&&(this.rawOptions[e]=n,this._onOptionChange.fire(e))};for(let t in this.rawOptions){let r={get:e.bind(this,t),set:n.bind(this,t)};Object.defineProperty(this.options,t,r)}}_sanitizeAndValidateOption(e,n){switch(e){case`cursorStyle`:if(n||=t.DEFAULT_OPTIONS[e],!function(e){return e===`block`||e===`underline`||e===`bar`}(n))throw Error(`"${n}" is not a valid value for ${e}`);break;case`wordSeparator`:n||=t.DEFAULT_OPTIONS[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof n==`number`&&1<=n&&n<=1e3)break;n=a.includes(n)?n:t.DEFAULT_OPTIONS[e];break;case`cursorWidth`:n=Math.floor(n);case`lineHeight`:case`tabStopWidth`:if(n<1)throw Error(`${e} cannot be less than 1, value: ${n}`);break;case`minimumContrastRatio`:n=Math.max(1,Math.min(21,Math.round(10*n)/10));break;case`scrollback`:if((n=Math.min(n,4294967295))<0)throw Error(`${e} cannot be less than 0, value: ${n}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(n<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${n}`);break;case`rows`:case`cols`:if(!n&&n!==0)throw Error(`${e} must be numeric, value: ${n}`);break;case`windowsPty`:n??={}}return n}}t.OptionsService=o},2660:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;let a=n(2585),o=t.OscLinkService=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose((()=>this._removeMarkerFromLink(r,n))),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose((()=>this._removeMarkerFromLink(o,a))),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every((e=>e.line!==t))){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(n,e)))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};t.OscLinkService=o=r([i(0,a.IBufferService)],o)},8343:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},2585:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(8343);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)},1480:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;let r=n(8460),i=n(225);class a{static extractShouldJoin(e){return!!(1&e)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(16777215&e)<<3|(3&t)<<1|!!n}constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new r.EventEmitter,this.onChange=this._onChange.event;let e=new i.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,n=0,r=e.length;for(let i=0;i<r;++i){let o=e.charCodeAt(i);if(55296<=o&&o<=56319){if(++i>=r)return t+this.wcwidth(o);let n=e.charCodeAt(i);56320<=n&&n<=57343?o=1024*(o-55296)+n-56320+65536:t+=this.wcwidth(n)}let s=this.charProperties(o,n),c=a.extractWidth(s);a.extractShouldJoin(s)&&(c-=a.extractWidth(n)),t+=c,n=s}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}}t.UnicodeService=a}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.Terminal=void 0;let t=n(9042),i=n(3236),a=n(844),o=n(5741),s=n(8285),c=n(7975),l=n(7090),u=[`cols`,`rows`];class d extends a.Disposable{constructor(e){super(),this._core=this.register(new i.Terminal(e)),this._addonManager=this.register(new o.AddonManager),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(u.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new c.ParserApi(this._core),this._parser}get unicode(){return this._checkProposedApi(),new l.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this.register(new s.BufferNamespaceApi(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
30
- `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(let t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw Error(`This API only accepts positive integers`)}}e.Terminal=d})(),r})()))})),Md=e(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.FitAddon=r():n.FitAddon=r()})(self,(()=>(()=>{var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core,t=e._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let n=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue(`height`)),a=Math.max(0,parseInt(r.getPropertyValue(`width`))),o=window.getComputedStyle(this._terminal.element),s=i-(parseInt(o.getPropertyValue(`padding-top`))+parseInt(o.getPropertyValue(`padding-bottom`))),c=a-(parseInt(o.getPropertyValue(`padding-right`))+parseInt(o.getPropertyValue(`padding-left`)))-n;return{cols:Math.max(2,Math.floor(c/t.css.cell.width)),rows:Math.max(1,Math.floor(s/t.css.cell.height))}}}})(),e})()))})),Nd=e(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.WebglAddon=r():n.WebglAddon=r()})(self,(()=>(()=>{var e={965:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;let r=n(374),i=n(509),a=n(855),o=n(859),s=n(381),c=11*Float32Array.BYTES_PER_ELEMENT,l,u=0,d=0,f=0;class p extends o.Disposable{constructor(e,t,n,a){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._optionsService=a,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array,attributesBuffers:[new Float32Array,new Float32Array]};let l=this._gl;i.TextureAtlas.maxAtlasPages===void 0&&(i.TextureAtlas.maxAtlasPages=Math.min(32,(0,r.throwIfFalsy)(l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS))),i.TextureAtlas.maxTextureSize=(0,r.throwIfFalsy)(l.getParameter(l.MAX_TEXTURE_SIZE))),this._program=(0,r.throwIfFalsy)((0,s.createProgram)(l,`#version 300 es
31
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(let t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw Error(`This API only accepts positive integers`)}}e.Terminal=d})(),r})()))})),_f=e(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.FitAddon=r():n.FitAddon=r()})(self,(()=>(()=>{var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core,t=e._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let n=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue(`height`)),a=Math.max(0,parseInt(r.getPropertyValue(`width`))),o=window.getComputedStyle(this._terminal.element),s=i-(parseInt(o.getPropertyValue(`padding-top`))+parseInt(o.getPropertyValue(`padding-bottom`))),c=a-(parseInt(o.getPropertyValue(`padding-right`))+parseInt(o.getPropertyValue(`padding-left`)))-n;return{cols:Math.max(2,Math.floor(c/t.css.cell.width)),rows:Math.max(1,Math.floor(s/t.css.cell.height))}}}})(),e})()))})),vf=e(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.WebglAddon=r():n.WebglAddon=r()})(self,(()=>(()=>{var e={965:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;let r=n(374),i=n(509),a=n(855),o=n(859),s=n(381),c=11*Float32Array.BYTES_PER_ELEMENT,l,u=0,d=0,f=0;class p extends o.Disposable{constructor(e,t,n,a){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._optionsService=a,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array,attributesBuffers:[new Float32Array,new Float32Array]};let l=this._gl;i.TextureAtlas.maxAtlasPages===void 0&&(i.TextureAtlas.maxAtlasPages=Math.min(32,(0,r.throwIfFalsy)(l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS))),i.TextureAtlas.maxTextureSize=(0,r.throwIfFalsy)(l.getParameter(l.MAX_TEXTURE_SIZE))),this._program=(0,r.throwIfFalsy)((0,s.createProgram)(l,`#version 300 es
31
32
  layout (location = 0) in vec2 a_unitquad;
32
33
  layout (location = 1) in vec2 a_cellpos;
33
34
  layout (location = 2) in vec2 a_offset;
@@ -70,28 +71,27 @@ out vec4 outColor;
70
71
 
71
72
  void main() {
72
73
  outColor = v_color;
73
- }`)),this.register((0,i.toDisposable)((()=>l.deleteProgram(this._program)))),this._projectionLocation=(0,r.throwIfFalsy)(l.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=l.createVertexArray(),l.bindVertexArray(this._vertexArrayObject);let u=new Float32Array([0,0,1,0,0,1,1,1]),d=l.createBuffer();this.register((0,i.toDisposable)((()=>l.deleteBuffer(d)))),l.bindBuffer(l.ARRAY_BUFFER,d),l.bufferData(l.ARRAY_BUFFER,u,l.STATIC_DRAW),l.enableVertexAttribArray(3),l.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let f=new Uint8Array([0,1,2,3]),p=l.createBuffer();this.register((0,i.toDisposable)((()=>l.deleteBuffer(p)))),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,p),l.bufferData(l.ELEMENT_ARRAY_BUFFER,f,l.STATIC_DRAW),this._attributesBuffer=(0,r.throwIfFalsy)(l.createBuffer()),this.register((0,i.toDisposable)((()=>l.deleteBuffer(this._attributesBuffer)))),l.bindBuffer(l.ARRAY_BUFFER,this._attributesBuffer),l.enableVertexAttribArray(0),l.vertexAttribPointer(0,2,l.FLOAT,!1,s,0),l.vertexAttribDivisor(0,1),l.enableVertexAttribArray(1),l.vertexAttribPointer(1,2,l.FLOAT,!1,s,2*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(1,1),l.enableVertexAttribArray(2),l.vertexAttribPointer(2,4,l.FLOAT,!1,s,4*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(2,1),this._updateCachedColors(a.colors),this.register(this._themeService.onChangeColors((e=>{this._updateCachedColors(e),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,o.PROJECTION_MATRIX),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r,i,o,s,c,l,u,d,f,p,m,h=1;for(r=0;r<t.rows;r++){for(o=-1,s=0,c=0,l=!1,i=0;i<t.cols;i++)u=(r*t.cols+i)*a.RENDER_MODEL_INDICIES_PER_CELL,d=e.cells[u+a.RENDER_MODEL_BG_OFFSET],f=e.cells[u+a.RENDER_MODEL_FG_OFFSET],p=!!(67108864&f),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=8*h++,this._updateRectangle(n,m,c,s,o,i,r)),o=i,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=8*h++,this._updateRectangle(n,m,c,s,o,t.cols,r))}n.count=h}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`)return void(t.count=0);let r,i=0;n.style!==`bar`&&n.style!==`outline`||(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),n.style!==`underline`&&n.style!==`outline`||(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=8*i++,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,s){if(67108864&n)switch(50331648&n){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&n].rgba;break;case 50331648:l=(16777215&n)<<8;break;default:l=this._themeService.colors.foreground.rgba}else switch(50331648&r){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&r].rgba;break;case 50331648:l=(16777215&r)<<8;break;default:l=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=(0,o.expandFloat32Array)(e.attributes,this._terminal.rows*this._terminal.cols*8)),u=i*this._dimensions.device.cell.width,d=s*this._dimensions.device.cell.height,f=(l>>24&255)/255,p=(l>>16&255)/255,m=(l>>8&255)/255,h=1,this._addRectangle(e.attributes,t,u,d,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,f,p,m,h)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(255&e.rgba)/255])}}t.RectangleRenderer=g},310:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;let r=n(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array,this.lineLengths=new Uint32Array,this.selection=(0,r.createSelectionRenderModel)()}resize(e,n){let r=e*n*t.RENDER_MODEL_INDICIES_PER_CELL;r!==this.cells.length&&(this.cells=new Uint32Array(r),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;let r=n(820),i=n(274),a=n(627),o=n(457),s=n(56),c=n(374),l=n(345),u=n(859),d=n(147),f=n(782),p=n(855),m=n(965),h=n(742),g=n(310),_=n(733);class v extends u.Disposable{constructor(e,t,n,o,d,p,m,h,v){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=o,this._coreService=d,this._decorationService=p,this._optionsService=m,this._themeService=h,this._cursorBlinkStateManager=new u.MutableDisposable,this._charAtlasDisposable=this.register(new u.MutableDisposable),this._observerDisposable=this.register(new u.MutableDisposable),this._model=new g.RenderModel,this._workCell=new f.CellData,this._workCell2=new f.CellData,this._rectangleRenderer=this.register(new u.MutableDisposable),this._glyphRenderer=this.register(new u.MutableDisposable),this._onChangeTextureAtlas=this.register(new l.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new l.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new l.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new l.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors((()=>this._handleColorChange()))),this._cellColorResolver=new i.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new _.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,m,this._themeService)],this.dimensions=(0,c.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(m.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let y={antialias:!1,depth:!1,preserveDrawingBuffer:v};if(this._gl=this._canvas.getContext(`webgl2`,y),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this.register((0,r.addDisposableDomListener)(this._canvas,`webglcontextlost`,(e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)}),3e3)}))),this.register((0,r.addDisposableDomListener)(this._canvas,`webglcontextrestored`,(e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,a.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,s.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((e,t)=>this._setCanvasDevicePixelDimensions(e,t))),this.register(this._coreBrowserService.onWindowChange((e=>{this._observerDisposable.value=(0,s.observeDevicePixelDimensions)(this._canvas,e,((e,t)=>this._setCanvasDevicePixelDimensions(e,t)))}))),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,u.toDisposable)((()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),(0,a.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new h.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new m.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);let e=(0,a.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=(0,u.getDisposeArrayDisposable)([(0,l.forwardEvent)(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,l.forwardEvent)(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(e){return-1}deregisterCharacterJoiner(e){return!1}renderRows(e,t){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new o.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r,i,a,o,s,c,l,u,d,f,m,h,_,v,x=this._workCell;e=b(e,n.rows-1,0),t=b(t,n.rows-1,0);let S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=S-n.buffer.ydisp,w=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),T=-1,E=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let D=!1;for(i=e;i<=t;i++)for(a=i+n.buffer.ydisp,o=n.buffer.lines.get(a),this._model.lineLengths[i]=0,s=this._characterJoinerService.getJoinedCharacters(a),_=0;_<n.cols;_++)if(r=this._cellColorResolver.result.bg,o.loadCell(_,x),_===0&&(r=this._cellColorResolver.result.bg),c=!1,l=_,s.length>0&&_===s[0][0]&&(c=!0,u=s.shift(),x=new y(x,o.translateToString(!0,u[0],u[1]),u[1]-u[0]),l=u[1]-1),d=x.getChars(),f=x.getCode(),h=(i*n.cols+_)*g.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(x,_,a,this.dimensions.device.cell.width),E&&a===S&&(_===w&&(this._model.cursor={x:w,y:C,width:x.getWidth(),style:this._coreBrowserService.isFocused?n.options.cursorStyle||`block`:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},T=w+x.getWidth()-1),_>=w&&_<=T&&(this._coreBrowserService.isFocused&&(n.options.cursorStyle||`block`)===`block`||!1===this._coreBrowserService.isFocused&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),f!==p.NULL_CELL_CODE&&(this._model.lineLengths[i]=_+1),(this._model.cells[h]!==f||this._model.cells[h+g.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[h+g.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[h+g.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(D=!0,d.length>1&&(f|=g.COMBINED_CHAR_BIT_MASK),this._model.cells[h]=f,this._model.cells[h+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[h+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[h+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,m=x.getWidth(),this._glyphRenderer.value.updateCell(_,i,f,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,m,r),c))for(x=this._workCell,_++;_<l;_++)v=(i*n.cols+_)*g.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(_,i,p.NULL_CELL_CODE,0,0,0,p.NULL_CELL_CHAR,0,0),this._model.cells[v]=p.NULL_CELL_CODE,this._model.cells[v+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[v+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[v+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;D&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}}t.WebglRenderer=v;class y extends d.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function b(e,t,n=0){return Math.max(Math.min(e,t),n)}t.JoinedCellData=y},381:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;let r=n(374);function i(e,t,n){let i=(0,r.throwIfFalsy)(e.createShader(t));if(e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(e,t,n){let a=(0,r.throwIfFalsy)(e.createProgram());if(e.attachShader(a,(0,r.throwIfFalsy)(i(e,e.VERTEX_SHADER,t))),e.attachShader(a,(0,r.throwIfFalsy)(i(e,e.FRAGMENT_SHADER,n))),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS))return a;console.error(e.getProgramInfoLog(a)),e.deleteProgram(a)},t.createShader=i,t.expandFloat32Array=function(e,t){let n=Math.min(2*e.length,t),r=new Float32Array(n);for(let t=0;t<e.length;t++)r[t]=e[t];return r},t.GLTexture=class{constructor(e){this.texture=e,this.version=-1}}},592:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;let r=n(627),i=n(237),a=n(374),o=n(859);class s extends o.Disposable{constructor(e,t,n,r,i,a,s,c){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=s,this._themeService=c,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((t=>{this._refreshCharAtlas(e,t),this.reset(e)}))),this.register((0,o.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,a.throwIfFalsy)(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,r.acquireTextureAtlas)(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=i.TEXT_BASELINE,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){return`${n?`italic`:``} ${t?e.options.fontWeightBold:e.options.fontWeight} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}}t.BaseRenderLayer=s},733:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;let r=n(197),i=n(237),a=n(592);class o extends a.BaseRenderLayer{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this.register(r.onShowLinkUnderline((e=>this._handleShowLinkUnderline(e)))),this.register(r.onHideLinkUnderline((e=>this._handleHideLinkUnderline(e))))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===i.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&(0,r.is256Color)(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}}t.LinkRenderLayer=o},820:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},274:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;let r=n(855),i=n(160),a=n(374),o,s=0,c=0,l=!1,u=!1,d=!1,f=0;t.CellColorResolver=class{constructor(e,t,n,r,i,a){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=r,this._coreBrowserService=i,this._themeService=a,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,p){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=268435456&e.bg?e.extended.ext:0,c=0,s=0,u=!1,l=!1,d=!1,o=this._themeService.colors,f=0,e.getCode()!==r.NULL_CELL_CODE&&e.extended.underlineStyle===4){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));f=t*p%(2*Math.round(e))}if(this._decorationService.forEachDecorationAtCell(t,n,`bottom`,(e=>{e.backgroundColorRGB&&(c=e.backgroundColorRGB.rgba>>8&16777215,u=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,l=!0)})),d=this._selectionRenderModel.isCellSelected(this._terminal,t,n),d){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:c=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:c=(16777215&this.result.fg)<<8|255;break;default:c=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:c=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:c=(16777215&this.result.bg)<<8|255}c=i.rgba.blend(c,4294967040&(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else c=(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(u=!0,o.selectionForeground&&(s=o.selectionForeground.rgba>>8&16777215,l=!0),(0,a.treatGlyphAsBackgroundColor)(e.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))s=(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:s=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:s=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:s=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:s=(16777215&this.result.fg)<<8|255;break;default:s=this._themeService.colors.foreground.rgba}s=i.rgba.blend(s,4294967040&(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}l=!0}}this._decorationService.forEachDecorationAtCell(t,n,`top`,(e=>{e.backgroundColorRGB&&(c=e.backgroundColorRGB.rgba>>8&16777215,u=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,l=!0)})),u&&(c=d?e.bg&-150994944|c|50331648:-16777216&e.bg|c|50331648),l&&(s=e.fg&-83886080|s|50331648),67108864&this.result.fg&&(u&&!l&&(s=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&o.background.rgba>>8|50331648,l=!0),!u&&l&&(c=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&o.foreground.rgba>>8|50331648,u=!0)),o=void 0,this.result.bg=u?c:this.result.bg,this.result.fg=l?s:this.result.fg,this.result.ext&=536870911,this.result.ext|=f<<29&3758096384}}},627:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;let r=n(509),i=n(197),a=[];t.acquireTextureAtlas=function(e,t,n,o,s,c,l,u){let d=(0,i.generateConfig)(o,s,c,l,t,n,u);for(let t=0;t<a.length;t++){let n=a[t],r=n.ownedBy.indexOf(e);if(r>=0){if((0,i.configEquals)(n.config,d))return n.atlas;n.ownedBy.length===1?(n.atlas.dispose(),a.splice(t,1)):n.ownedBy.splice(r,1);break}}for(let t=0;t<a.length;t++){let n=a[t];if((0,i.configEquals)(n.config,d))return n.ownedBy.push(e),n.atlas}let f=e._core,p={atlas:new r.TextureAtlas(document,d,f.unicodeService),config:d,ownedBy:[e]};return a.push(p),p.atlas},t.removeTerminalFromCache=function(e){for(let t=0;t<a.length;t++){let n=a[t].ownedBy.indexOf(e);if(n!==-1){a[t].ownedBy.length===1?(a[t].atlas.dispose(),a.splice(t,1)):a[t].ownedBy.splice(n,1);break}}}},197:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;let r=n(160);t.generateConfig=function(e,t,n,i,a,o,s){let c={foreground:o.foreground,background:o.background,cursor:r.NULL_COLOR,cursorAccent:r.NULL_COLOR,selectionForeground:r.NULL_COLOR,selectionBackgroundTransparent:r.NULL_COLOR,selectionBackgroundOpaque:r.NULL_COLOR,selectionInactiveBackgroundTransparent:r.NULL_COLOR,selectionInactiveBackgroundOpaque:r.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:a.customGlyphs,devicePixelRatio:s,letterSpacing:a.letterSpacing,lineHeight:a.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:i,fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,allowTransparency:a.allowTransparency,drawBoldTextInBrightColors:a.drawBoldTextInBrightColors,minimumContrastRatio:a.minimumContrastRatio,colors:c}},t.configEquals=function(e,t){for(let n=0;n<e.colors.ansi.length;n++)if(e.colors.ansi[n].rgba!==t.colors.ansi[n].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba},t.is256Color=function(e){return(50331648&e)==16777216||(50331648&e)==33554432}},237:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},457:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=600){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0)return void this._restartInterval(e)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})),this._blinkInterval=this._coreBrowserService.window.setInterval((()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;let r=n(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};let i={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:`M0,.5 L1,.5`},"━":{3:`M0,.5 L1,.5`},"│":{1:`M.5,0 L.5,1`},"┃":{3:`M.5,0 L.5,1`},"┌":{1:`M0.5,1 L.5,.5 L1,.5`},"┏":{3:`M0.5,1 L.5,.5 L1,.5`},"┐":{1:`M0,.5 L.5,.5 L.5,1`},"┓":{3:`M0,.5 L.5,.5 L.5,1`},"└":{1:`M.5,0 L.5,.5 L1,.5`},"┗":{3:`M.5,0 L.5,.5 L1,.5`},"┘":{1:`M.5,0 L.5,.5 L0,.5`},"┛":{3:`M.5,0 L.5,.5 L0,.5`},"├":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┣":{3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┤":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┫":{3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┬":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┳":{3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┴":{1:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┻":{3:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┼":{1:`M0,.5 L1,.5 M.5,0 L.5,1`},"╋":{3:`M0,.5 L1,.5 M.5,0 L.5,1`},"╴":{1:`M.5,.5 L0,.5`},"╸":{3:`M.5,.5 L0,.5`},"╵":{1:`M.5,.5 L.5,0`},"╹":{3:`M.5,.5 L.5,0`},"╶":{1:`M.5,.5 L1,.5`},"╺":{3:`M.5,.5 L1,.5`},"╷":{1:`M.5,.5 L.5,1`},"╻":{3:`M.5,.5 L.5,1`},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:`M1,0 L0,1`},"╲":{1:`M0,0 L1,1`},"╳":{1:`M1,0 L0,1 M0,0 L1,1`},"╼":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"╽":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L.5,1`},"╾":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"╿":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┍":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┎":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┑":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L0,.5`},"┒":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┕":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L1,.5`},"┖":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┙":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L0,.5`},"┚":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,0`},"┝":{1:`M.5,0 L.5,1`,3:`M.5,.5 L1,.5`},"┞":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┟":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┠":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1`},"┡":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"┢":{1:`M.5,.5 L.5,0`,3:`M0.5,1 L.5,.5 L1,.5`},"┥":{1:`M.5,0 L.5,1`,3:`M.5,.5 L0,.5`},"┦":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┧":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┨":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1`},"┩":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L0,.5`},"┪":{1:`M.5,.5 L.5,0`,3:`M0,.5 L.5,.5 L.5,1`},"┭":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┮":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┯":{1:`M.5,.5 L.5,1`,3:`M0,.5 L1,.5`},"┰":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┱":{1:`M.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"┲":{1:`M.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"┵":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┶":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┷":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5`},"┸":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┹":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"┺":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,.5 L1,.5`},"┽":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┾":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┿":{1:`M.5,0 L.5,1`,3:`M0,.5 L1,.5`},"╀":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"╁":{1:`M.5,.5 L.5,0 M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"╂":{1:`M0,.5 L1,.5`,3:`M.5,0 L.5,1`},"╃":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"╄":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"╅":{1:`M.5,0 L.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"╆":{1:`M.5,0 L.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"╇":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0 M0,.5 L1,.5`},"╈":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"╉":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"╊":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"╌":{1:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"╍":{3:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"┄":{1:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┅":{3:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┈":{1:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"┉":{3:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"╎":{1:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"╏":{3:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"┆":{1:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┇":{3:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┊":{1:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"┋":{3:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:`M0,0 L1,.5 L0,1`,type:0,rightPadding:2},"":{d:`M-1,-.5 L1,.5 L-1,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1,0 L0,.5 L1,1`,type:0,leftPadding:2},"":{d:`M2,-.5 L0,.5 L2,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0`,type:0,rightPadding:1},"":{d:`M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0`,type:1,rightPadding:1},"":{d:`M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0`,type:0,leftPadding:1},"":{d:`M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0`,type:1,leftPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L-.5,1.5`,type:0},"":{d:`M-.5,-.5 L1.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1.5,-.5 L-.5,1.5 L1.5,1.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5 L-.5,-.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L1.5,-.5`,type:0}},t.powerlineDefinitions[``]=t.powerlineDefinitions[``],t.powerlineDefinitions[``]=t.powerlineDefinitions[``],t.tryDrawCustomChar=function(e,n,o,l,u,d,f,p){let m=t.blockElementDefinitions[n];if(m)return function(e,t,n,r,i,a){for(let o=0;o<t.length;o++){let s=t[o],c=i/8,l=a/8;e.fillRect(n+s.x*c,r+s.y*l,s.w*c,s.h*l)}}(e,m,o,l,u,d),!0;let h=i[n];if(h)return function(e,t,n,i,o,s){let c=a.get(t);c||(c=new Map,a.set(t,c));let l=e.fillStyle;if(typeof l!=`string`)throw Error(`Unexpected fillStyle type "${l}"`);let u=c.get(l);if(!u){let n=t[0].length,i=t.length,a=e.canvas.ownerDocument.createElement(`canvas`);a.width=n,a.height=i;let o=(0,r.throwIfFalsy)(a.getContext(`2d`)),s=new ImageData(n,i),d,f,p,m;if(l.startsWith(`#`))d=parseInt(l.slice(1,3),16),f=parseInt(l.slice(3,5),16),p=parseInt(l.slice(5,7),16),m=l.length>7&&parseInt(l.slice(7,9),16)||1;else{if(!l.startsWith(`rgba`))throw Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);[d,f,p,m]=l.substring(5,l.length-1).split(`,`).map((e=>parseFloat(e)))}for(let e=0;e<i;e++)for(let r=0;r<n;r++)s.data[4*(e*n+r)]=d,s.data[4*(e*n+r)+1]=f,s.data[4*(e*n+r)+2]=p,s.data[4*(e*n+r)+3]=t[e][r]*(255*m);o.putImageData(s,0,0),u=(0,r.throwIfFalsy)(e.createPattern(a,null)),c.set(l,u)}e.fillStyle=u,e.fillRect(n,i,o,s)}(e,h,o,l,u,d),!0;let g=t.boxDrawingDefinitions[n];if(g)return function(e,t,n,r,i,a,o){e.strokeStyle=e.fillStyle;for(let[l,u]of Object.entries(t)){let t;e.beginPath(),e.lineWidth=o*Number.parseInt(l),t=typeof u==`function`?u(.15,.15/a*i):u;for(let l of t.split(` `)){let t=l[0],u=s[t];if(!u){console.error(`Could not find drawing instructions for "${t}"`);continue}let d=l.substring(1).split(`,`);d[0]&&d[1]&&u(e,c(d,i,a,n,r,!0,o))}e.stroke(),e.closePath()}}(e,g,o,l,u,d,p),!0;let _=t.powerlineDefinitions[n];return!!_&&(function(e,t,n,r,i,a,o,l){let u=new Path2D;u.rect(n,r,i,a),e.clip(u),e.beginPath();let d=o/12;e.lineWidth=l*d;for(let o of t.d.split(` `)){let u=o[0],f=s[u];if(!f){console.error(`Could not find drawing instructions for "${u}"`);continue}let p=o.substring(1).split(`,`);p[0]&&p[1]&&f(e,c(p,i,a,n,r,!1,l,(t.leftPadding??0)*(d/2),(t.rightPadding??0)*(d/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}(e,_,o,l,u,d,f,p),!0)};let a=new Map;function o(e,t,n=0){return Math.max(Math.min(e,t),n)}let s={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function c(e,t,n,r,i,a,s,c=0,l=0){let u=e.map((e=>parseFloat(e)||parseInt(e)));if(u.length<2)throw Error(`Too few arguments for instruction`);for(let e=0;e<u.length;e+=2)u[e]*=t-c*s-l*s,a&&u[e]!==0&&(u[e]=o(Math.round(u[e]+.5)-.5,t,0)),u[e]+=r+c*s;for(let e=1;e<u.length;e+=2)u[e]*=n,a&&u[e]!==0&&(u[e]=o(Math.round(u[e]+.5)-.5,n,0)),u[e]+=i;return u}},56:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;let r=n(859);t.observeDevicePixelDimensions=function(e,t,n){let i=new t.ResizeObserver((t=>{let r=t.find((t=>t.target===e));if(!r)return;if(!(`devicePixelContentBoxSize`in r))return i?.disconnect(),void(i=void 0);let a=r.devicePixelContentBoxSize[0].inlineSize,o=r.devicePixelContentBoxSize[0].blockSize;a>0&&o>0&&n(a,o)}));try{i.observe(e,{box:[`device-pixel-content-box`]})}catch{i.disconnect(),i=void 0}return(0,r.toDisposable)((()=>i?.disconnect()))}},374:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},296:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},509:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;let r=n(237),i=n(860),a=n(374),o=n(160),s=n(345),c=n(485),l=n(385),u=n(147),d=n(855),f={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},p;class m{get pages(){return this._pages}constructor(e,t,n){this._document=e,this._config=t,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new c.FourKeyMap,this._cacheMapCombined=new c.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new u.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new s.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new s.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=_(e,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,a.throwIfFalsy)(this._tmpCanvas.getContext(`2d`,{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||=(this._doWarmUp(),!0)}_doWarmUp(){let e=new l.IdleTaskQueue;for(let t=33;t<126;t++)e.enqueue((()=>{if(!this._cacheMap.get(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT)){let e=this._drawToCache(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT);this._cacheMap.set(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT,e)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(m.maxAtlasPages&&this._pages.length>=Math.max(4,m.maxAtlasPages)){let e=this._pages.filter((e=>2*e.canvas.width<=(m.maxTextureSize||4096))).sort(((e,t)=>t.canvas.width===e.canvas.width?t.percentageUsed-e.percentageUsed:t.canvas.width-e.canvas.width)),t=-1,n=0;for(let r=0;r<e.length;r++)if(e[r].canvas.width!==n)t=r,n=e[r].canvas.width;else if(r-t==3)break;let r=e.slice(t,t+4),i=r.map((e=>e.glyphs[0].texturePage)).sort(((e,t)=>e>t?1:-1)),a=this.pages.length-r.length,o=this._mergePages(r,a);o.version++;for(let e=i.length-1;e>=0;e--)this._deletePage(i[e]);this.pages.push(o),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(o.canvas)}let e=new h(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,t){let n=2*e[0].canvas.width,r=new h(this._document,n,e);for(let[i,a]of e.entries()){let e=i*a.canvas.width%n,o=Math.floor(i/2)*a.canvas.height;r.ctx.drawImage(a.canvas,e,o);for(let r of a.glyphs)r.texturePage=t,r.sizeClipSpace.x=r.size.x/n,r.sizeClipSpace.y=r.size.y/n,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/n,r.texturePositionClipSpace.y=r.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(a.canvas);let s=this._activePages.indexOf(a);s!==-1&&this._activePages.splice(s,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let e=this._pages[t];for(let t of e.glyphs)t.texturePage--;e.version++}}getRasterizedGlyphCombinedChar(e,t,n,r,i){return this._getFromCacheMap(this._cacheMapCombined,e,t,n,r,i)}getRasterizedGlyph(e,t,n,r,i){return this._getFromCacheMap(this._cacheMap,e,t,n,r,i)}_getFromCacheMap(e,t,n,r,i,a=!1){return p=e.get(t,n,r,i),p||(p=this._drawToCache(t,n,r,i,a),e.set(t,n,r,i,p)),p}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw Error(`No color found for idx `+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,n,r){if(this._config.allowTransparency)return o.NULL_COLOR;let i;switch(e){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(t);break;case 50331648:let e=u.AttributeData.toColorRGB(t);i=o.channels.toColor(e[0],e[1],e[2]);break;default:i=n?o.color.opaque(this._config.colors.foreground):this._config.colors.background}return i}_getForegroundColor(e,t,n,i,a,s,c,l,d,f){let p=this._getMinimumContrastColor(e,t,n,i,a,s,c,d,l,f);if(p)return p;let m;switch(a){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&d&&s<8&&(s+=8),m=this._getColorFromAnsiIndex(s);break;case 50331648:let e=u.AttributeData.toColorRGB(s);m=o.channels.toColor(e[0],e[1],e[2]);break;default:m=c?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(m=o.color.opaque(m)),l&&(m=o.color.multiplyOpacity(m,r.DIM_OPACITY)),m}_resolveBackgroundRgba(e,t,n){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,n,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,n,r,i,a,s,c,l,u){if(this._config.minimumContrastRatio===1||u)return;let d=this._getContrastCache(l),f=d.getColor(e,r);if(f!==void 0)return f||void 0;let p=this._resolveBackgroundRgba(t,n,s),m=this._resolveForegroundRgba(i,a,s,c),h=o.rgba.ensureContrastRatio(p,m,this._config.minimumContrastRatio/(l?2:1));if(!h)return void d.setColor(e,r,null);let g=o.channels.toColor(h>>24&255,h>>16&255,h>>8&255);return d.setColor(e,r,g),g}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,t,n,o,s=!1){let c=typeof e==`number`?String.fromCharCode(e):e,l=Math.min(this._config.deviceCellWidth*Math.max(c.length,2)+4,this._textureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);let d=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<d&&(this._tmpCanvas.height=d),this._tmpCtx.save(),this._workAttributeData.fg=n,this._workAttributeData.bg=t,this._workAttributeData.extended.ext=o,this._workAttributeData.isInvisible())return f;let p=!!this._workAttributeData.isBold(),h=!!this._workAttributeData.isInverse(),_=!!this._workAttributeData.isDim(),v=!!this._workAttributeData.isItalic(),y=!!this._workAttributeData.isUnderline(),b=!!this._workAttributeData.isStrikethrough(),x=!!this._workAttributeData.isOverline(),S=this._workAttributeData.getFgColor(),C=this._workAttributeData.getFgColorMode(),w=this._workAttributeData.getBgColor(),T=this._workAttributeData.getBgColorMode();if(h){let e=S;S=w,w=e;let t=C;C=T,T=t}let E=this._getBackgroundColor(T,w,h,_);this._tmpCtx.globalCompositeOperation=`copy`,this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation=`source-over`;let D=p?this._config.fontWeightBold:this._config.fontWeight,O=v?`italic`:``;this._tmpCtx.font=`${O} ${D} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=r.TEXT_BASELINE;let k=c.length===1&&(0,a.isPowerlineGlyph)(c.charCodeAt(0)),A=c.length===1&&(0,a.isRestrictedPowerlineGlyph)(c.charCodeAt(0)),j=this._getForegroundColor(t,T,w,n,C,S,h,_,p,(0,a.treatGlyphAsBackgroundColor)(c.charCodeAt(0)));this._tmpCtx.fillStyle=j.css;let M=A?0:4,N=!1;!1!==this._config.customGlyphs&&(N=(0,i.tryDrawCustomChar)(this._tmpCtx,c,M,M,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let P,F=!k;if(P=typeof e==`number`?this._unicodeService.wcwidth(e):this._unicodeService.getStringCellWidth(e),y){this._tmpCtx.save();let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;if(this._tmpCtx.lineWidth=e,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())F=!1,this._tmpCtx.strokeStyle=`rgb(${u.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(`,`)})`;else{F=!1;let e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&e<8&&(e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(e).css}this._tmpCtx.beginPath();let n=M,r=Math.ceil(M+this._config.deviceCharHeight)-t-(s?2*e:0),i=r+e,o=r+2*e,l=this._workAttributeData.getUnderlineVariantOffset();for(let s=0;s<P;s++){this._tmpCtx.save();let c=n+s*this._config.deviceCellWidth,u=n+(s+1)*this._config.deviceCellWidth,d=c+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r),this._tmpCtx.moveTo(c,o),this._tmpCtx.lineTo(u,o);break;case 3:let n=e<=1?o:Math.ceil(M+this._config.deviceCharHeight-e/2)-t,s=e<=1?r:Math.ceil(M+this._config.deviceCharHeight+e/2)-t,f=new Path2D;f.rect(c,r,this._config.deviceCellWidth,o-r),this._tmpCtx.clip(f),this._tmpCtx.moveTo(c-this._config.deviceCellWidth/2,i),this._tmpCtx.bezierCurveTo(c-this._config.deviceCellWidth/2,s,c,s,c,i),this._tmpCtx.bezierCurveTo(c,n,d,n,d,i),this._tmpCtx.bezierCurveTo(d,s,u,s,u,i),this._tmpCtx.bezierCurveTo(u,n,u+this._config.deviceCellWidth/2,n,u+this._config.deviceCellWidth/2,i);break;case 4:let p=l===0?0:l>=e?2*e-l:e-l;!(l>=e)==0||p===0?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(c+p,r),this._tmpCtx.lineTo(u,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(c+p,r),this._tmpCtx.moveTo(c+p+e,r),this._tmpCtx.lineTo(u,r)),l=(0,a.computeNextVariantOffset)(u-c,e,l);break;case 5:let m=u-c,h=Math.floor(.6*m),g=Math.floor(.3*m),_=m-h-g;this._tmpCtx.setLineDash([h,g,_]),this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r);break;default:this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!N&&this._config.fontSize>=12&&!this._config.allowTransparency&&c!==` `){this._tmpCtx.save(),this._tmpCtx.textBaseline=`alphabetic`;let t=this._tmpCtx.measureText(c);if(this._tmpCtx.restore(),`actualBoundingBoxDescent`in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(n,r-Math.ceil(e/2),this._config.deviceCellWidth*P,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=E.css,this._tmpCtx.strokeText(c,M,M+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(x){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(M,M+t),this._tmpCtx.lineTo(M+this._config.deviceCharWidth*P,M+t),this._tmpCtx.stroke()}if(N||this._tmpCtx.fillText(c,M,M+this._config.deviceCharHeight),c===`_`&&!this._config.allowTransparency){let e=g(this._tmpCtx.getImageData(M,M,this._config.deviceCellWidth,this._config.deviceCellHeight),E,j,F);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(c,M,M+this._config.deviceCharHeight-t),e=g(this._tmpCtx.getImageData(M,M,this._config.deviceCellWidth,this._config.deviceCellHeight),E,j,F),e);t++);}if(b){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(M,M+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(M+this._config.deviceCharWidth*P,M+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let I=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),L;if(L=this._config.allowTransparency?function(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}(I):g(I,E,j,F),L)return f;let R=this._findGlyphBoundingBox(I,this._workBoundingBox,l,A,N,M),z,B;for(;;){if(this._activePages.length===0){let e=this._createNewPage();z=e,B=e.currentRow,B.height=R.size.y;break}z=this._activePages[this._activePages.length-1],B=z.currentRow;for(let e of this._activePages)R.size.y<=e.currentRow.height&&(z=e,B=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=B.height&&R.size.y<=t.height&&(z=this._activePages[e],B=t);if(B.y+R.size.y>=z.canvas.height||B.height>R.size.y+2){let e=!1;if(z.currentRow.y+z.currentRow.height+R.size.y>=z.canvas.height){let t;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+R.size.y<e.canvas.height){t=e;break}if(t)z=t;else if(m.maxAtlasPages&&this._pages.length>=m.maxAtlasPages&&B.y+R.size.y<=z.canvas.height&&B.height>=R.size.y&&B.x+R.size.x<=z.canvas.width)e=!0;else{let t=this._createNewPage();z=t,B=t.currentRow,B.height=R.size.y,e=!0}}e||(z.currentRow.height>0&&z.fixedRows.push(z.currentRow),B={x:0,y:z.currentRow.y+z.currentRow.height,height:R.size.y},z.fixedRows.push(B),z.currentRow={x:0,y:B.y+B.height,height:0})}if(B.x+R.size.x<=z.canvas.width)break;B===z.currentRow?(B.x=0,B.y+=B.height,B.height=0):z.fixedRows.splice(z.fixedRows.indexOf(B),1)}return R.texturePage=this._pages.indexOf(z),R.texturePosition.x=B.x,R.texturePosition.y=B.y,R.texturePositionClipSpace.x=B.x/z.canvas.width,R.texturePositionClipSpace.y=B.y/z.canvas.height,R.sizeClipSpace.x/=z.canvas.width,R.sizeClipSpace.y/=z.canvas.height,B.height=Math.max(B.height,R.size.y),B.x+=R.size.x,z.ctx.putImageData(I,R.texturePosition.x-this._workBoundingBox.left,R.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,R.size.x,R.size.y),z.addGlyph(R),z.version++,R}_findGlyphBoundingBox(e,t,n,r,i,a){t.top=0;let o=r?this._config.deviceCellHeight:this._tmpCanvas.height,s=r?this._config.deviceCellWidth:n,c=!1;for(let n=0;n<o;n++){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+4*r+3;if(e.data[i]!==0){t.top=n,c=!0;break}}if(c)break}t.left=0,c=!1;for(let n=0;n<a+s;n++){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+4*n+3;if(e.data[i]!==0){t.left=n,c=!0;break}}if(c)break}t.right=s,c=!1;for(let n=a+s-1;n>=a;n--){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+4*n+3;if(e.data[i]!==0){t.right=n,c=!0;break}}if(c)break}t.bottom=o,c=!1;for(let n=o-1;n>=0;n--){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+4*r+3;if(e.data[i]!==0){t.bottom=n,c=!0;break}}if(c)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+a+(r||i?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+a+(r||i?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=m;class h{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}constructor(e,t,n){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],n)for(let e of n)this._glyphs.push(...e.glyphs),this._usedPixels+=e._usedPixels;this.canvas=_(e,t,t),this.ctx=(0,a.throwIfFalsy)(this.canvas.getContext(`2d`,{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function g(e,t,n,r){let i=t.rgba>>>24,a=t.rgba>>>16&255,o=t.rgba>>>8&255,s=n.rgba>>>24,c=n.rgba>>>16&255,l=n.rgba>>>8&255,u=Math.floor((Math.abs(i-s)+Math.abs(a-c)+Math.abs(o-l))/12),d=!0;for(let t=0;t<e.data.length;t+=4)e.data[t]===i&&e.data[t+1]===a&&e.data[t+2]===o||r&&Math.abs(e.data[t]-i)+Math.abs(e.data[t+1]-a)+Math.abs(e.data[t+2]-o)<u?e.data[t+3]=0:d=!1;return d}function _(e,t,n){let r=e.createElement(`canvas`);return r.width=t,r.height=n,r}},160:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let n=0,r=0,i=0,a=0;var o,s,c,l,u;function d(e){let t=e.toString(16);return t.length<2?`0`+t:t}function f(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:`#00000000`,rgba:0},function(e){e.toCss=function(e,t,n,r){return r===void 0?`#${d(e)}${d(t)}${d(n)}`:`#${d(e)}${d(t)}${d(n)}${d(r)}`},e.toRgba=function(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0},e.toColor=function(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}}(o||(t.channels=o={})),function(e){function t(e,t){return a=Math.round(255*t),[n,r,i]=u.toChannels(e.rgba),{css:o.toCss(n,r,i,a),rgba:o.toRgba(n,r,i,a)}}e.blend=function(e,t){if(a=(255&t.rgba)/255,a===1)return{css:t.css,rgba:t.rgba};let s=t.rgba>>24&255,c=t.rgba>>16&255,l=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,f=e.rgba>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),{css:o.toCss(n,r,i),rgba:o.toRgba(n,r,i)}},e.isOpaque=function(e){return(255&e.rgba)==255},e.ensureContrastRatio=function(e,t,n){let r=u.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[n,r,i]=u.toChannels(t),{css:o.toCss(n,r,i),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return a=255&e.rgba,t(e,a*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(s||(t.color=s={})),function(e){let t,s;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let n=e.getContext(`2d`,{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation=`copy`,s=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),o.toColor(n,r,i);case 5:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),o.toColor(n,r,i,a);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let c=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return n=parseInt(c[1]),r=parseInt(c[2]),i=parseInt(c[3]),a=Math.round(255*(c[5]===void 0?1:parseFloat(c[5]))),o.toColor(n,r,i,a);if(!t||!s||(t.fillStyle=s,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[n,r,i,a]=t.getImageData(0,0,1,1).data,a!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:o.toRgba(n,r,i,a),css:e}}}(c||(t.css=c={})),function(e){function t(e,t,n){let r=e/255,i=t/255,a=n/255;return .2126*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.7152*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)+.0722*(a<=.03928?a/12.92:((a+.055)/1.055)**2.4)}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(l||(t.rgb=l={})),function(e){function t(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(.1*o)),s-=Math.max(0,Math.ceil(.1*s)),c-=Math.max(0,Math.ceil(.1*c)),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}function s(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),s=Math.min(255,s+Math.ceil(.1*(255-s))),c=Math.min(255,c+Math.ceil(.1*(255-c))),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.blend=function(e,t){if(a=(255&t)/255,a===1)return t;let s=t>>24&255,c=t>>16&255,l=t>>8&255,u=e>>24&255,d=e>>16&255,f=e>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),o.toRgba(n,r,i)},e.ensureContrastRatio=function(e,n,r){let i=l.relativeLuminance(e>>8),a=l.relativeLuminance(n>>8);if(f(i,a)<r){if(a<i){let a=t(e,n,r),o=f(i,l.relativeLuminance(a>>8));if(o<r){let t=s(e,n,r);return o>f(i,l.relativeLuminance(t>>8))?a:t}return a}let o=s(e,n,r),c=f(i,l.relativeLuminance(o>>8));if(c<r){let a=t(e,n,r);return c>f(i,l.relativeLuminance(a>>8))?o:a}return o}},e.reduceLuminance=t,e.increaseLuminance=s,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(u||(t.rgba=u={})),t.toPaddedHex=d,t.contrastRatio=f},345:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},859:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}},485:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=n,t.FourKeyMap=class{constructor(){this._data=new n}set(e,t,r,i,a){this._data.get(e,t)||this._data.set(e,t,new n),this._data.get(e,t).set(r,i,a)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}}},399:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<`u`&&`title`in process;let n=t.isNode?`node`:navigator.userAgent,r=t.isNode?`node`:navigator.platform;t.isFirefox=n.includes(`Firefox`),t.isLegacyEdge=n.includes(`Edge`),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.getSafariVersion=function(){if(!t.isSafari)return 0;let e=n.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])},t.isMac=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(r),t.isIpad=r===`iPad`,t.isIphone=r===`iPhone`,t.isWindows=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(r),t.isLinux=r.indexOf(`Linux`)>=0,t.isChromeOS=/\bCrOS\b/.test(n)},385:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let r=n(399);class i{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),n=Math.max(t,n),i=e.timeRemaining(),1.5*n>i)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}}class a extends i{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=a,t.IdleTaskQueue=!r.isNode&&`requestIdleCallback`in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:a,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},147:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new r}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let e=new n;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=n;class r{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=r},782:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;let r=n(133),i=n(855),a=n(147);class o extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=``}static fromCharData(e){let t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,r.stringFromCodePoint)(2097151&this.content):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(e[i.CHAR_DATA_CHAR_INDEX].length===2){let n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},855:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR=``,t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=` `,t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},133:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(a=e[d+2])||128&(o=e[d+3]));)t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=o,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((224&r)==192){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},776:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(859),o=n(97),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:`xterm.js: `)+t,...n)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=l=r([i(0,o.IOptionsService)],l),t.setTraceLogger=function(e){c=e},t.traceCall=function(e,t,n){if(typeof n.value!=`function`)throw Error(`not supported`);let r=n.value;n.value=function(...e){if(c.logLevel!==o.LogLevelEnum.TRACE)return r.apply(this,e);c.trace(`GlyphRenderer#${r.name}(${e.map((e=>JSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},726:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},97:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(726);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.WebglAddon=void 0;let t=n(345),i=n(859),a=n(399),o=n(666),s=n(776);class c extends i.Disposable{constructor(e){if(a.isSafari&&(0,a.getSafariVersion)()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(e){let n=e._core;if(!e.element)return void this.register(n.onWillOpen((()=>this.activate(e))));this._terminal=e;let r=n.coreService,a=n.optionsService,c=n,l=c._renderService,u=c._characterJoinerService,d=c._charSizeService,f=c._coreBrowserService,p=c._decorationService,m=c._logService,h=c._themeService;(0,s.setTraceLogger)(m),this._renderer=this.register(new o.WebglRenderer(e,u,d,f,r,p,a,h,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this.register((0,i.toDisposable)((()=>{let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)})))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}}e.WebglAddon=c})(),r})()))})),Pd=jd(),Fd=Md(),Id=Nd();function Ld(e,t,n=!0){return n?t===`normal`?Math.min(Math.max(0,e),760):Math.min(t===`wide`?1100:1/0,Math.max(0,e-48)):Math.max(0,e)}var Rd=/https?:\/\/[^\s"'<>`─-▟]+/g,zd=/[─-▟|]/,Bd={")":`(`,"]":`[`,"}":`{`};function Vd(e){let t;try{t=new URL(e.trim())}catch{return null}return t.protocol===`http:`||t.protocol===`https:`?t.href:null}function Hd(e,t){let n=e[e.length-1],r=t[0];return!!n&&!!r&&n!==` `&&r!==` `&&!zd.test(n)&&!zd.test(r)}function Ud(e){for(;;){let t=e[e.length-1];if(`.,;:!?'"`.includes(t))e=e.slice(0,-1);else if(Bd[t]&&e.split(Bd[t]).length<=e.split(t).length-1)e=e.slice(0,-1);else return e}}function Wd(e){let t=[];for(let n of e.matchAll(Rd)){let e=Ud(n[0]);Vd(e)&&e.length>8&&t.push({start:n.index,end:n.index+e.length,url:e})}return t}function Gd(e,t,n=()=>!1){if(!e[t])return[];let r=t=>n(t+1)||Hd(e[t],e[t+1]??``),i=t;for(;i>0&&r(i-1);)i--;let a=t;for(;a<e.length-1&&r(a);)a++;let o=[],s=``;for(let t=i;t<=a;t++)o.push(s.length),s+=e[t];let c=e=>{let t=o.length-1;for(;t>0&&o[t]>e;)t--;return{row:i+t,col:e-o[t]}};return Wd(s).map(e=>({url:e.url,start:c(e.start),end:c(e.end-1)})).filter(e=>e.start.row<=t&&e.end.row>=t).map(e=>({...e,end:{row:e.end.row,col:e.end.col+1}}))}function Kd(e,t){let n=``;for(let r=0;r<t;r++){let t=e?.getCell(r)?.getChars()||` `;n+=t.length===1?t:` `}return n}function qd(e){let t=e.buffer.active,n=[];for(let r=0;r<t.length;r++)n.push(Kd(t.getLine(r),e.cols));return n}var Jd=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),Yd=()=>typeof matchMedia<`u`&&matchMedia(`(hover: hover) and (pointer: fine)`).matches;function Xd(e,t,n){return!t||(n?e.metaKey:e.ctrlKey)}function Zd(e){let t=Vd(e);return t?(window.open(t,`_blank`,`noopener,noreferrer`),!0):!1}function Qd(e,t){let n=Jd(),r=Yd(),i=e=>`${e}\n${t(n?`⌘+click to open`:`Ctrl+click to open`)}`,a=!1,o=(e,t)=>{Xd(e,r,n)&&(a=Zd(t)||a)},s=()=>e.element?.querySelector(`.xterm-screen`),c=(e,t)=>{let n=s();n&&r&&Vd(t)&&(n.title=i(t))},l=()=>{let e=s();e&&e.removeAttribute(`title`)},u={activate:o,hover:c,leave:l,allowNonHttpProtocols:!1};e.options.linkHandler=u;let d=e.registerLinkProvider({provideLinks(t,n){let r=qd(e),i=e.buffer.active,a=Gd(r,t-1,e=>!!i.getLine(e)?.isWrapped);n(a.length?a.map(e=>({text:e.url,range:{start:{x:e.start.col+1,y:e.start.row+1},end:{x:e.end.col,y:e.end.row+1}},activate:t=>o(t,e.url),hover:t=>c(t,e.url),leave:l})):void 0)}});return{tap:(t,n)=>{let r=s();if(!r)return!1;a=!1;let i={bubbles:!0,cancelable:!0,view:window,clientX:t,clientY:n,button:0};for(let e of[`mousemove`,`mousedown`,`mouseup`])r.dispatchEvent(new MouseEvent(e,{...i,buttons:+(e===`mousedown`)}));return e.element?.dispatchEvent(new MouseEvent(`mouseleave`,i)),e.clearSelection(),a},dispose(){d.dispose(),l()}}}function $d(e){return e.key.toLowerCase()===`c`&&!e.altKey&&(e.metaKey||e.ctrlKey&&e.shiftKey)}function ef(e,t,n){return e.button!==0||!e.shiftKey||e.altKey?null:n?t?{shiftKey:!1,altKey:!0}:null:{shiftKey:!1,altKey:!1}}function tf(e){return e.replace(/[ \t]+$/gm,``)}function nf(e,t,n=()=>!1){let r=e.split(`
74
- `);return r.length===t.length?r.reduce((e,r,i)=>i===0?r:e+(n(i)||Hd(t[i-1],t[i])?``:`
75
- `)+r,``):e}function rf(e){let t=e.getSelection(),n=e.getSelectionPosition();if(!n)return tf(t);let r=Math.min(n.start.y,n.end.y),i=Math.max(n.start.y,n.end.y),a=e.buffer.active;return tf(nf(t,qd(e).slice(r,i+1),e=>!!a.getLine(r+e)?.isWrapped))}function af(e,t=globalThis.navigator?.clipboard){if(!e||!t?.writeText)return Promise.resolve(!1);try{return t.writeText(e).then(()=>!0,()=>!1)}catch{return Promise.resolve(!1)}}var of=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent);function sf(e,t){let n=e.element;if(!n)return()=>{};let r=of(),i=()=>{e.hasSelection()&&af(rf(e)).then(e=>e&&t?.())},a=t=>{$d(t)&&e.hasSelection()&&(t.preventDefault(),t.stopPropagation(),i())},o=()=>i(),s=t=>{t.button===0&&window.addEventListener(`mouseup`,o,{capture:!0,once:!0});let n=ef(t,r,e.modes.mouseTrackingMode!==`none`);n&&(t.preventDefault(),t.stopImmediatePropagation(),t.target?.dispatchEvent(new MouseEvent(`mousedown`,{bubbles:!0,cancelable:!0,composed:!0,view:window,detail:t.detail,clientX:t.clientX,clientY:t.clientY,screenX:t.screenX,screenY:t.screenY,button:t.button,buttons:t.buttons,ctrlKey:t.ctrlKey,metaKey:t.metaKey,...n})))};return n.addEventListener(`keydown`,a,!0),n.addEventListener(`mousedown`,s,!0),()=>{window.removeEventListener(`mouseup`,o,{capture:!0}),n.removeEventListener(`keydown`,a,!0),n.removeEventListener(`mousedown`,s,!0)}}function cf(e=globalThis.navigator){let t=e?.userAgentData?.platform||e?.platform||``;return/^(mac|iphone|ipad|ipod|ios)/i.test(t)}function lf(e){let t=e.key.toLowerCase();return t===`v`||e.code===`KeyV`&&!/^[a-z]$/.test(t)}function uf(e,t){if(e.isComposing)return`xterm`;let n=e.ctrlKey||e.altKey||e.metaKey;return e.key===`Enter`&&!e.shiftKey&&!e.altKey&&(e.ctrlKey&&!e.metaKey||t&&e.metaKey&&!e.ctrlKey)?`ctrl+enter`:e.key===`Enter`&&e.shiftKey&&!n?`shift+enter`:e.key===`F12`&&!e.shiftKey&&!n||!t&&e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&lf(e)?`browser`:`xterm`}function df(e,t,n=cf()){e.attachCustomKeyEventHandler(e=>{let r=uf(e,n);return r===`xterm`||((r===`shift+enter`||r===`ctrl+enter`)&&e.type===`keydown`&&(e.preventDefault(),t(r)),!1)})}function ff(e){return!e||e.getData(`text/plain`)?[]:[...e.items||[]].filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(e=>!!e)}function pf(e,t){async function n(e){let n=[];for(let r of e)try{n.push(await t.upload(r))}catch(e){t.report(`${Z(`Photo upload failed`)} : ${e.message}`)}n.length&&!t.paste(n.join(` `))&&t.report(Z(`Terminal not connected — image not pasted`))}let r=e=>{let r=ff(e.clipboardData);!r.length||t.enabled&&!t.enabled()||(e.preventDefault(),e.stopPropagation(),n(r))};return e.addEventListener(`paste`,r,!0),()=>e.removeEventListener(`paste`,r,!0)}var mf=1e5,hf=/^[cpqs0-7]*$/,gf=/^[A-Za-z0-9+/]*={0,2}$/;function _f(e){let t=e.endsWith(`==`)?2:+!!e.endsWith(`=`);return Math.floor(e.length*3/4)-t}function vf(e,t=mf){let n=e.indexOf(`;`);if(n<0||!hf.test(e.slice(0,n)))return{kind:`invalid`};let r=e.slice(n+1).replace(/\s+/g,``);if(r===`?`)return{kind:`read`};if(!r||r.length%4==1||!gf.test(r))return{kind:`invalid`};let i=_f(r);if(i>t)return{kind:`too-large`,bytes:i};let a;try{a=atob(r)}catch{return{kind:`invalid`}}let o=new TextDecoder().decode(Uint8Array.from(a,e=>e.charCodeAt(0)));return o?{kind:`write`,text:o}:{kind:`invalid`}}async function yf(e,t,n){try{if(!t)throw Error(`no clipboard`);return await t.writeText(e),n.copied(),!0}catch{return n.refused(e),!1}}function bf(e,t){let n=e.parser.registerOscHandler(52,e=>{if(!t.enabled())return!0;let n=vf(e,t.maxBytes);return n.kind===`write`?t.write(n.text):n.kind===`too-large`&&t.tooLarge(n.bytes),!0});return()=>n.dispose()}async function xf(e){let t=URL.createObjectURL(e);try{let e=await new Promise((e,n)=>{let r=new Image;r.onload=()=>e(r),r.onerror=n,r.src=t}),n=Math.min(1,2048/Math.max(e.naturalWidth,e.naturalHeight)),r=document.createElement(`canvas`);r.width=Math.round(e.naturalWidth*n),r.height=Math.round(e.naturalHeight*n);let i=r.getContext(`2d`);i.fillStyle=`#fff`,i.fillRect(0,0,r.width,r.height),i.drawImage(e,0,0,r.width,r.height);let a=await new Promise(e=>r.toBlob(e,`image/jpeg`,.86));if(a)return a}catch{}finally{URL.revokeObjectURL(t)}return e}async function Sf(e,t){let n=await xf(t),r=await fetch(`/api/upload?pane=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":n.type||`image/jpeg`},body:n}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(Z(i.error||`HTTP ${r.status}`));return{path:i.path,name:i.name}}function Cf(e){return e.code===`unreachable`?Q(`${e.machine||`Machine`} unreachable`,`${e.machine||`Machine`} injoignable`):e.code===`unknown_machine`?Q(`unknown machine`,`machine inconnue`):Z(e.reason||``)}function wf(e){return e?Q(`Terminal unavailable: ${e}`,`Terminal indisponible : ${e}`):Z(`Terminal unavailable`)}function Tf(e,t,n,r,i){return n.width<=0||n.height<=0||r<=0||i<=0?null:{column:Math.max(0,Math.min(r-1,Math.floor((e-n.left)*r/n.width))),row:Math.max(0,Math.min(i-1,Math.floor((t-n.top)*i/n.height)))}}function Ef(e,t,n){let r=e.element,i=null,a=null,o=null,s=0,c=(t,n)=>{let i=r.querySelector(`.xterm-screen`)?.getBoundingClientRect();return i?Tf(t,n,i,e.cols,e.rows):null},l=(e,t,n)=>{let r=c(e.clientX,e.clientY);return r&&{type:`terminal.mouse`,action:t,button:n,...r,modifiers:+!!e.shiftKey|(e.ctrlKey?2:0)|(e.altKey?4:0)|(e.metaKey?8:0)}},u=()=>{cancelAnimationFrame(s),s=0,o&&t()&&n(o),o=null},d=r=>{if(!t()||r.pointerType===`touch`||r.shiftKey||r.ctrlKey||r.metaKey||r.button>2)return;let o=[`left`,`middle`,`right`][r.button],s=l(r,`down`,o);s&&(r.preventDefault(),r.stopPropagation(),i=o,a=r.pointerId,e.clearSelection(),e.focus(),n(s))},f=e=>{!t()||e.pointerType===`touch`||e.shiftKey||e.ctrlKey||e.metaKey||(i?e.pointerId!==a:!r.contains(e.target))||(o=l(e,i?`drag`:`move`,i||`left`),s||=requestAnimationFrame(u))},p=e=>{if(!i||e.pointerId!==a)return;u();let r=l(e,`up`,i);i=null,a=null,r&&t()&&n(r)},m=e=>{t()&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&e.preventDefault()};return r.addEventListener(`contextmenu`,m),r.addEventListener(`pointerdown`,d,!0),window.addEventListener(`pointermove`,f,!0),window.addEventListener(`pointerup`,p,!0),window.addEventListener(`pointercancel`,p,!0),{tap(e,r){let i=t()&&c(e,r);if(i)for(let e of[`down`,`up`])n({type:`terminal.mouse`,action:e,button:`left`,...i,modifiers:0})},dispose(){cancelAnimationFrame(s),r.removeEventListener(`contextmenu`,m),r.removeEventListener(`pointerdown`,d,!0),window.removeEventListener(`pointermove`,f,!0),window.removeEventListener(`pointerup`,p,!0),window.removeEventListener(`pointercancel`,p,!0)}}}var Df=`"Wherdr Symbols", "JetBrains Mono Variable", "JetBrains Mono", "Wherdr Nerd Symbols", ui-monospace, "SF Mono", Menlo, monospace`;function Of(e){let t=typeof document<`u`?document.fonts:void 0;return t?.addEventListener?(t.addEventListener(`loadingdone`,e),()=>t.removeEventListener(`loadingdone`,e)):()=>{}}function kf(e,t){let n=null,r=null,i=null,a=null,o=null,s=0,c,l=!1,u={cols:0,rows:0},d=!1,f=h(!1),p=h(!1),m=h(0),g=h(0),_=h(0),v=0,y=h([]),b=xd(),x=e=>{y.value=_d(y.value,e)},S=()=>{y.value=[]},C=Ad(),w=null,T=null,E=null,D=null,O=null,k=null,A=!1,j=()=>`${location.protocol===`https:`?`wss`:`ws`}://${location.host}`;function M(i){a=i,i.addEventListener(`paste`,S,!0),d=!1,s=0,n=new Pd.Terminal({fontFamily:Df,fontSize:Rr.value,lineHeight:1,scrollback:0,cursorBlink:!1,allowProposedApi:!0,macOptionIsMeta:!0,macOptionClickForcesSelection:!0,theme:he.value}),r=new Fd.FitAddon,n.loadAddon(r),n.open(i),k=Ef(n,()=>A&&t.input?.()!==!1,e=>I(e)),w=sf(n,()=>$(Z(`Copied`))),O=Qd(n,Z),T=pf(i,{upload:async t=>(await Sf(e,t)).path,paste:e=>I({type:`paste`,text:e}),report:e=>$(e,!0)}),E=bf(n,{enabled:()=>Ci.value,write:e=>yf(e,navigator.clipboard,{copied:()=>$(Z(`The agent copied text`)),refused:e=>zr(Z(`The agent copied text — tap to copy`),Z(`Copy`),()=>{yf(e,navigator.clipboard,{copied:()=>$(Z(`Copied`)),refused:()=>$(Z(`Copy failed`),!0)})})}),tooLarge:e=>$(Q(`Agent copy ignored: ${Ds(e)} (limit ${Ds(mf)})`,`Copie de l’agent ignorée : ${Ds(e)} (limite ${Ds(mf)})`))}),V(lr.value);let o=n;Promise.all([document.fonts?.load(`${Rr.value}px "JetBrains Mono Variable"`),document.fonts?.load(`${Rr.value}px "Wherdr Symbols"`,`─▀█⎿⏵⏺✻✳`)]).then(()=>{d||n!==o||(o.options.fontFamily=Df,z(!0),o.refresh(0,o.rows-1))}).catch(()=>{}),D=Of(()=>{d||n!==o||(o.clearTextureAtlas(),o.refresh(0,o.rows-1))});let c=n.textarea;c&&(c.setAttribute(`autocorrect`,`off`),c.setAttribute(`autocapitalize`,`off`),c.setAttribute(`spellcheck`,`false`),c.addEventListener(`blur`,()=>{p.value=!1}),c.addEventListener(`focus`,()=>{p.value=!0}),c.addEventListener(`compositionstart`,b.start),c.addEventListener(`compositionend`,b.end)),n.element?.addEventListener(`keydown`,b.keydown,!0),n.attachCustomWheelEventHandler(()=>!1),df(n,e=>R(e)),n.onData(e=>{if(t.input?.()!==!1){if(b.active||b.takeEnded()){S(),I({type:`terminal.input`,text:e});return}if(y.value.length){let t=bd(e);if(t){R(t);return}S()}I({type:`terminal.input`,text:e})}}),n.onBinary(e=>{if(t.input?.()===!1)return;let n=Uint8Array.from(e,e=>e.charCodeAt(0)&255);I({type:`terminal.input`,bytes:vr(n)})})}let N=cr(()=>o),F;B(Yi,()=>{document.hidden||!l||d||t.hasBanner()||(G()?N.recover(()=>{!d&&l&&!document.hidden&&!t.hasBanner()&&U(!1)}):U(!1))});function I(e){return e?.type===`paste`&&S(),Ri.value&&[`terminal.input`,`paste`].includes(e?.type||``)&&(m.value++,ae()),o&&o.readyState===1?(o.send(JSON.stringify(e)),!0):!1}async function L(t){if(Ri.value&&(m.value++,ae()),!I({type:`keys`,keys:t}))try{await gi(`/api/input`,{pane_id:e,keys:t}),X()}catch(e){$(e.message,!0)}}async function R(e){if(t.input?.()===!1)return;let n=vd(e,y.value);S(),await L([n])}function z(e){if(!n||!r||!a||!a.parentElement)return;let i=matchMedia(Ji).matches&&!t.fill?.();a.style.width=i?`${Ld(a.parentElement.clientWidth,ei.value)}px`:``;let o=r.proposeDimensions();if(!o||!o.cols||!o.rows)return;let s={cols:o.cols,rows:o.rows};(s.cols!==n.cols||s.rows!==n.rows)&&n.resize(s.cols,s.rows),e&&(s.cols!==u.cols||s.rows!==u.rows)&&I({type:`terminal.resize`,cols:s.cols,rows:s.rows})&&(u={cols:s.cols,rows:s.rows})}B(he,e=>{n&&(n.options.theme=e)}),B(ei,()=>P(()=>z(!0)));function V(e){if(n){if(i){let e=i;i=null,e.dispose()}if(e===`webgl`){let e=null;try{e=new Id.WebglAddon;let t=e;e.onContextLoss(()=>{i===t&&(i=null,t.dispose(),Ei(`html-fallback`),z(!0))}),n.loadAddon(e),Ni(e),i=e,Ei(`webgl`)}catch{try{e?.dispose()}catch{}Ei(`html-fallback`)}}else Ei(`html`);z(!0)}}B(lr,V);function H(e){n&&(n.options.fontSize=e,z(!0))}function U(r){if(d||!n)return;if(clearTimeout(c),clearTimeout(F),N.cancel(),o){o.onclose=null;try{o.close(1e3)}catch{}}z(!1);let i=new URLSearchParams({pane:e,cols:String(n.cols),rows:String(n.rows)});r&&i.set(`takeover`,`1`),A=!1,f.value=!0,l=!0;let a=null,p=!1,h=``;v++,Ri.value&&m.value++;let y=new WebSocket(`${j()}/ws/term?${i}`);o=y,F=setTimeout(()=>{if(o===y&&y.readyState===0)try{y.close()}catch{}},6e3),y.onopen=()=>{o===y&&(clearTimeout(F),n&&(u={cols:n.cols,rows:n.rows}),y.send(JSON.stringify({type:`visibility`,visible:!document.hidden})))},y.onmessage=e=>{if(o!==y)return;let t;try{t=JSON.parse(e.data)}catch{return}if(t.type===`web.capabilities`)A=t.mouse===!0;else if(t.type===`terminal.frame`){if(p||(p=!0,s=0),f.value=!1,!n)return;t.width&&t.height&&(t.width!==n.cols||t.height!==n.rows)&&(Ri.value&&(m.value++,ae()),n.resize(t.width,t.height));let e=n;e.write(Ur(t.bytes||``),()=>{C.refresh(e,A),Ri.value&&g.value++})}else if(t.type===`scroll.ack`){if(Ri.value&&t.epoch===v&&Number.isFinite(t.lines)&&n){let e=v;n.write(``,()=>{e===v&&Ri.value&&(_.value+=t.lines)})}}else t.type===`pong`?N.pong(y):t.type===`terminal.closed`?a=Cf(t):t.type===`herdr.stderr`?/^run 'herdr --help'/.test(t.message)||(h=t.message):t.type===`web.error`&&$(t.message,!0)},y.onclose=()=>{if(o===y&&(Ri.value&&(m.value++,v++),clearTimeout(F),o=null,A=!1,f.value=!1,N.cancel(),l&&!d)){if(a&&/already has an attached client/.test(a))return t.setBanner({text:Z(`This terminal is already open elsewhere.`),btn:Z(`Take control`),fn:()=>{t.setBanner(null),U(!0)}});if(a&&/taken over/.test(a))return t.setBanner({text:Z(`Another client took control.`),btn:Z(`Take back control`),fn:()=>{t.setBanner(null),U(!0)}});if((Ki.value||!ur.value.ok)&&!document.hidden){if(!p&&s>=3&&(h||a)){s=0;let e=h||a;return t.setBanner({text:wf(e),btn:Z(`Retry`),fn:()=>{t.setBanner(null),U(!1)}})}c=setTimeout(()=>U(!1),Math.min(6e3,400*2**s++))}}}}function W(){if(S(),Ri.value&&(m.value++,v++),A=!1,l=!1,clearTimeout(c),clearTimeout(F),N.cancel(),o){let e=o;o=null;try{e.close(1e3)}catch{}}}let G=()=>!!(o&&o.readyState<=1);function ee(){n?.reset()}function K(){n?.focus(),p.value=!0}function te(){n?.textarea?.blur()}let q=(e,t)=>O?.tap(e,t)??!1,ne=()=>!!(n&&document.activeElement===n.textarea),J=()=>{if(!Ri.value)return n&&n.rows&&a?a.clientHeight/n.rows:16;let e=a?.querySelector(`.xterm-screen`);return n?.rows&&e?.clientHeight?e.clientHeight/n.rows:16},re=()=>n?.rows||24;function ie(e,t,r,i=0,a=!1,o=!0){if(!Ri.value||!a)return I({type:`terminal.scroll`,direction:e>0?`up`:`down`,lines:Math.abs(e)});let s=n?.element?.querySelector(`.xterm-screen`),c=s?.getBoundingClientRect(),l=s?.style.transform?new DOMMatrixReadOnly(s.style.transform).m42:0,u=c?{left:c.left,top:c.top-l,width:c.width,height:c.height}:null,d=u&&n&&t!==void 0&&r!==void 0?Tf(t,r,u,n.cols,n.rows):null;return I({type:`terminal.scroll`,direction:e>0?`up`:`down`,lines:Math.abs(e),...d,modifiers:i,source:`touch`,epoch:v,preview:o})}function ae(){v++,Ri.value&&I({type:`touch.cancel`})}let oe=B(Ri,(e,t)=>{v++,m.value++,t&&I({type:`touch.cancel`,disabled:!0})},{flush:`sync`});function se(e){!e&&Ri.value&&(m.value++,ae()),I({type:`visibility`,visible:e}),e&&P(()=>z(!0))}function ce(){a?.removeEventListener(`paste`,S,!0),d=!0,oe(),W(),w?.(),T?.(),E?.(),E=null,D?.(),D=null,w=null,T=null,k?.dispose(),k=null,O?.dispose(),O=null,i=null,n?.dispose(),n=null}return{mount:M,connect:U,disconnect:W,isConnected:G,sendTerm:I,sendKeys:L,fitNow:z,setFontSize:H,reset:ee,scroll:ie,focus:K,blur:te,tapLink:q,tapMouse:(e,t)=>k?.tap(e,t),hasFocus:ne,rowHeight:J,pageRows:re,setVisible:se,dispose:ce,loading:f,kbdOn:p,hasBanner:t.hasBanner,selectionHint:C,cancelTouchScroll:ae,scrollInputVersion:m,frameTick:g,scrollAck:_,virtualModifiers:y,toggleModifier:x,sendVirtualKey:R}}var Af={key:0},jf={class:`interactive-terminal-note`},Mf={key:0,class:`term-banner`},Nf=Object.assign(T({__name:`InteractiveTerminal`,props:{paneId:{},active:{type:Boolean},title:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=u(null),o=kf(n.paneId,{setBanner:e=>{i.value=e},hasBanner:()=>!!i.value,fill:()=>!0,input:()=>n.active});B(qr,e=>o.setVisible(e));let s=!1;function c(){if(!s||!Hi.value||o.hasFocus())return;let e=document.activeElement;e instanceof HTMLElement&&e.closest(`.interactive-terminal`)&&e.matches(`button, input, textarea`)||o.focus()}function l(e){e.preventDefault(),s=!0,e.currentTarget?.focus(),setTimeout(c,50)}B(()=>o.loading.value,e=>{e||P(c)});let d={onOpenAutoFocus:l,onEscapeKeyDown:e=>e.preventDefault()},p={overlay:`hw-scrim interactive-terminal-scrim`,content:`interactive-terminal`};return(t,n)=>{let s=Ke,c=_t,l=hd,u=Ed,h=rn;return _(),m(h,{open:``,title:(`tl`in t?t.tl:f(Q))(`Interactive terminal`,`Terminal interactif`),content:d,ui:p,"onUpdate:open":n[5]||=e=>e||r(`close`)},{content:H(()=>[I(`header`,{class:`interactive-terminal-head`,onKeydown:n[1]||=re(()=>{},[`stop`])},[I(`span`,null,[E(s,{name:`i-lucide-square-terminal`}),a(M((`tl`in t?t.tl:f(Q))(`Interactive terminal`,`Terminal interactif`)),1),e.title?(_(),v(`small`,Af,M(e.title),1)):g(``,!0)]),E(c,{icon:`i-lucide-x`,color:`neutral`,variant:`ghost`,"aria-label":(`tl`in t?t.tl:f(Q))(`Close terminal window`,`Fermer la fenêtre terminal`),onClick:n[0]||=e=>r(`close`)},null,8,[`aria-label`])],32),I(`p`,jf,M((`tl`in t?t.tl:f(Q))(`Live agent screen · closes when the message field returns`,`Écran réel de l’agent · se ferme au retour du champ libre`)),1),f(i)?(_(),v(`div`,Mf,[I(`span`,null,M(f(i).text),1),E(c,{size:`xs`,color:`warning`,variant:`outline`,onClick:n[2]||=e=>f(i).fn()},{default:H(()=>[a(M(f(i).btn),1)]),_:1})])):g(``,!0),E(l,{ctl:f(o),onKeydown:n[3]||=re(()=>{},[`stop`])},null,8,[`ctl`]),E(u,{ctl:f(o),"all-digits":``,onKeydown:n[4]||=re(()=>{},[`stop`])},null,8,[`ctl`])]),_:1},8,[`title`])}}}),{__name:`InteractiveTerminal`}),Pf={class:`prompt-detail-head`},Ff={class:`prompt-detail-tool`},If={key:0,class:`prompt-detail-desc`},Lf={key:0,class:`prompt-detail-file`},Rf={class:`path`},zf={key:0,class:`prompt-detail-stats`},Bf={key:0,class:`add`},Vf={key:1,class:`del`},Hf={key:2,class:`prompt-detail-note`},Uf=Object.assign(T({__name:`PromptDetailBlock`,props:{detail:{}},setup(e){let t=e,r=h(!1);B(()=>t.detail.command,()=>{r.value=!1});let i=n(()=>(t.detail.command||``).split(`
76
- `)),o=n(()=>i.value.length>8||(t.detail.command||``).length>800),s=n(()=>nn(t.detail));return(t,n)=>{let c=Ke;return _(),v(`div`,{class:j([`prompt-detail`,{file:e.detail.file}])},[I(`p`,Pf,[I(`span`,Ff,M(e.detail.tool),1),e.detail.description?(_(),v(`span`,If,M(e.detail.description),1)):g(``,!0)]),e.detail.file?(_(),v(`p`,Lf,[E(c,{name:`i-lucide-file-pen`}),I(`span`,Rf,M(e.detail.file),1),f(s)?(_(),v(`span`,zf,[e.detail.added?(_(),v(`span`,Bf,`+`+M(e.detail.added),1)):g(``,!0),e.detail.removed?(_(),v(`span`,Vf,`−`+M(e.detail.removed),1)):g(``,!0)])):g(``,!0)])):g(``,!0),e.detail.command?(_(),v(`pre`,{key:1,class:j([`prompt-detail-code`,{collapsed:f(o)&&!f(r)}])},[I(`code`,null,[(_(!0),v(k,null,y(f(i),(n,r)=>(_(),v(`span`,{key:r,class:j((`diffKind`in t?t.diffKind:f(on))(n,!!e.detail.file))},M(n),3))),128))])],2)):g(``,!0),e.detail.truncated?(_(),v(`p`,Hf,M((`t`in t?t.t:f(Z))(`Too long: only the beginning is shown. The terminal shows the rest.`)),1)):g(``,!0),f(o)?(_(),v(`button`,{key:3,type:`button`,class:`prompt-detail-more`,onClick:n[0]||=e=>r.value=!f(r)},[E(c,{name:f(r)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),a(` `+M(f(r)?(`t`in t?t.t:f(Z))(`Collapse`):(`tl`in t?t.tl:f(Q))(`Show all (${f(i).length} lines)`,`Tout afficher (${f(i).length} lignes)`)),1)])):g(``,!0)],2)}}}),{__name:`PromptDetailBlock`}),Wf={class:`eyebrow choices-eyebrow`},Gf=[`aria-label`],Kf=[`aria-current`,`disabled`,`onClick`],qf={key:2,class:`choices-q`},Jf={key:3,class:`choices-note`,role:`status`},Yf={key:4,class:`choices-note`},Xf=[`aria-pressed`,`aria-expanded`,`disabled`,`onClick`],Zf={key:0,class:`n`},Qf={key:1,class:`n`},$f={class:`l`},ep={key:0},tp=[`onSubmit`],np={class:`choices-free-actions`},rp=[`disabled`],ip={key:7,class:`choices-keys`},ap=[`disabled`],op=[`disabled`,`onClick`],sp={key:1,class:`card-kbd`,"aria-hidden":`true`},cp={key:0},lp=Object.assign(T({__name:`ChoicesPanel`,props:{paneId:{},prompt:{},screen:{},keys:{type:Boolean}},setup(e){let t=e,r=h(!1),i=h(t.prompt?.cursor),o=0;B(()=>t.prompt,(e,t)=>{o&&e&&t&&e.cursor===t.cursor&&e.identity===t.identity||(i.value=e?.cursor)}),B(()=>[t.prompt,t.screen],()=>{r.value=!1});let s=n(()=>t.screen?t.screen.actions.filter(e=>!(t.prompt&&e.key===`enter`)):[]),c=n(()=>t.screen?yi(t.screen.kind):null),l=n(()=>!!(t.screen&&t.screen.lines.some(e=>/\S {3,}\S/.test(e)))),u=n(()=>t.prompt?.kind===`self-update`?Z(t.prompt.question||``):t.screen&&t.screen.title||t.prompt&&t.prompt.question);async function d(e,n){r.value=!0,await Ce(t.paneId,e,n,t.prompt?.identity)||(r.value=!1)}async function p(e){r.value=!0,await ke(t.paneId,e,t.screen?.identity)||(r.value=!1)}let b=n(()=>t.prompt?.kind===`self-update`);async function x(){r.value=!0,await me(t.paneId)||(r.value=!1)}async function S(){r.value=!0,await fe(t.paneId,`enter`,t.prompt?.identity)||(r.value=!1)}let C=n(()=>!!(t.prompt&&t.prompt.options.some(e=>e.checked===void 0))),w=n(()=>t.prompt&&t.prompt.tabs&&t.prompt.tab!==void 0&&!t.prompt.typing?t.prompt.tabs:null);async function T(e){let n=t.prompt;n&&n.tabs&&e!==n.tab&&!z.value&&(r.value=!0,await we(t.paneId,e,n.tabs[e])?O.value=``:r.value=!1)}let D=h(null),O=h(``),A=h(!1),N=n(()=>t.prompt?.typing?t.prompt.options.findIndex(e=>e.free):D.value);B(()=>t.prompt?.question,()=>{D.value=null});let P=n(()=>Hi.value&&!Jr&&!wi);async function F(e,n){let i=O.value.trim();if(!(!i||z.value||A.value)){r.value=!0,A.value=!0;try{await Ce(t.paneId,e,n,t.prompt?.identity,{text:i,question:t.prompt?.question??null})?(O.value=``,D.value=null):r.value=!1}finally{A.value=!1}}}function L(){t.prompt?.typing?fe(t.paneId,`esc`):D.value=null}function R(e,t,n){e.isComposing||e.keyCode===229||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),L()):e.key===`Enter`&&!e.shiftKey&&P.value&&(e.preventDefault(),F(t,n)))}let z=n(()=>r.value||t.prompt?.unavailable||t.screen?.unavailable||!zi.value||Sr.value),V=n(()=>!!(t.keys&&Hi.value&&t.prompt&&!t.prompt.kind&&t.prompt.options.length&&N.value===null&&!z.value));return Ln(()=>V.value,()=>({digits:Math.min(9,t.prompt?.options.length||0),enter:!0,tabs:!!w.value}),e=>{let n=t.prompt;if(n){if(e.kind===`digit`){let t=n.options[e.n-1];t.free?D.value=e.n-1:d(e.n-1,t.label);return}if(e.kind===`tab`)return fe(t.paneId,e.dir>0?`right`:`left`);e.kind===`nav`&&((e.key===`up`||e.key===`down`)&&i.value!==null&&i.value!==void 0&&(i.value=Math.max(0,Math.min(n.options.length-1,i.value+(e.key===`down`?1:-1)))),o++,fe(t.paneId,e.key,n.identity).then(e=>{o--,e||(i.value=t.prompt?.cursor)}))}}),(t,n)=>{let r=Uf,o=Ke,h=yn,P=_t;return _(),v(`div`,{class:j([`choices`,{"choices-screen":e.screen}])},[I(`p`,Wf,[n[1]||=I(`i`,null,null,-1),a(M((`t`in t?t.t:f(Z))(`Your turn`)),1)]),f(w)?(_(),v(`div`,{key:0,class:`choices-tabs`,role:`group`,"aria-label":(`t`in t?t.t:f(Z))(`Questions`)},[(_(!0),v(k,null,y(f(w),(t,n)=>(_(),v(`button`,{key:n,type:`button`,class:j({on:n===e.prompt.tab}),"aria-current":n===e.prompt.tab?`step`:void 0,disabled:f(z),onClick:e=>T(n)},M(t),11,Kf))),128))],8,Gf)):g(``,!0),e.prompt?.detail?(_(),m(r,{key:1,detail:e.prompt.detail},null,8,[`detail`])):g(``,!0),f(u)?(_(),v(`p`,qf,M(f(u)),1)):g(``,!0),e.prompt?.unavailable||e.screen?.unavailable?(_(),v(`p`,Jf,M((`tl`in t?t.tl:f(Q))(`Screen read failed. Retrying…`,`Lecture de l’écran impossible. Nouvelle tentative…`)),1)):g(``,!0),f(c)?(_(),v(`p`,Yf,M(f(c)),1)):g(``,!0),e.screen&&e.screen.lines.length&&!e.prompt?.detail?(_(),v(`pre`,{key:5,class:j([`choices-screen-text`,{wrap:!f(l)}])},M(e.screen.lines.join(`
77
- `)),3)):g(``,!0),e.prompt?(_(),v(`div`,{key:6,class:j([`choices-list`,{multi:e.prompt.multi}])},[(_(!0),v(k,null,y(e.prompt.options,(r,s)=>(_(),v(k,{key:s},[I(`button`,{type:`button`,class:j({cur:s===f(i),on:r.checked}),"aria-pressed":e.prompt.multi&&!r.free?!!r.checked:void 0,"aria-expanded":r.free?f(N)===s:void 0,disabled:f(z),onClick:t=>r.free?D.value=e.prompt.typing||f(D)===s?null:s:d(s,r.label)},[e.prompt.multi&&r.checked!==void 0?(_(),v(`span`,Zf,[E(o,{name:r.checked?`i-lucide-square-check`:`i-lucide-square`},null,8,[`name`])])):(_(),v(`span`,Qf,M(s+1),1)),I(`span`,$f,[a(M(e.prompt.kind===`self-update`?(`t`in t?t.t:f(Z))(r.label):r.label),1),r.hint?(_(),v(`small`,ep,M(e.prompt.kind===`self-update`?(`t`in t?t.t:f(Z))(r.hint):r.hint),1)):g(``,!0)]),r.free?(_(),m(o,{key:2,name:`i-lucide-pencil-line`,class:`choices-free-icon`})):g(``,!0)],10,Xf),r.free&&f(N)===s?(_(),v(`form`,{key:0,class:`choices-free`,onSubmit:re(e=>F(s,r.label),[`prevent`])},[E(h,{modelValue:f(O),"onUpdate:modelValue":n[0]||=e=>G(O)?O.value=e:null,rows:1,maxrows:6,autoresize:``,autofocus:!e.prompt.typing,size:`lg`,class:`w-full`,placeholder:(`t`in t?t.t:f(Z))(`Your answer…`),disabled:f(z)||f(A),onKeydown:e=>R(e,s,r.label)},null,8,[`modelValue`,`autofocus`,`placeholder`,`disabled`,`onKeydown`]),I(`div`,np,[E(P,{type:`button`,color:`neutral`,variant:`ghost`,size:`sm`,disabled:f(z)||f(A),onClick:L},{default:H(()=>[a(M((`t`in t?t.t:f(Z))(`Cancel`)),1)]),_:1},8,[`disabled`]),E(P,{type:`submit`,color:`primary`,variant:`solid`,size:`sm`,loading:f(A),disabled:f(z)||f(A)||!f(O).trim()},{default:H(()=>[a(M((`t`in t?t.t:f(Z))(`Send`)),1)]),_:1},8,[`loading`,`disabled`])])],40,tp)):g(``,!0)],64))),128)),e.prompt.multi&&!f(C)?(_(),v(`button`,{key:0,type:`button`,class:`choices-next`,disabled:f(z),onClick:S},[a(M((`t`in t?t.t:f(Z))(`Continue`)),1),I(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(Mr))(`enter`)),1)],8,rp)):g(``,!0)],2)):g(``,!0),f(s).length||f(V)||f(b)?(_(),v(`div`,ip,[f(b)?(_(),v(`button`,{key:0,type:`button`,disabled:f(z),onClick:x},M((`t`in t?t.t:f(Z))(`Dismiss`)),9,ap)):g(``,!0),(_(!0),v(k,null,y(f(s),e=>(_(),v(`button`,{key:e.key+e.label,type:`button`,disabled:f(z),onClick:t=>p(e)},[a(M((`screenActionText`in t?t.screenActionText:f(dr))(e)),1),I(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(Mr))(e.key)),1)],8,op))),128)),f(V)?(_(),v(`span`,sp,[f(w)?(_(),v(`kbd`,cp,`←→`)):g(``,!0),n[2]||=I(`kbd`,null,`↑↓`,-1),I(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(Mr))(`enter`)),1),I(`kbd`,null,`1–`+M(Math.min(9,e.prompt.options.length)),1)])):g(``,!0)])):g(``,!0)],2)}}}),{__name:`ChoicesPanel`}),up={class:`choices choices-menu`},dp={class:`eyebrow choices-eyebrow`},fp={class:`menu-kind`},pp={key:0,class:`choices-note`,role:`status`},mp={key:1,class:`choices-q`},hp={key:2,class:`choices-note`},gp={key:3,class:`choices-note`},_p=[`placeholder`,`aria-label`,`disabled`],vp={key:0,class:`menu-group`},yp=[`aria-current`,`disabled`,`onClick`],bp={class:`n`,"aria-hidden":`true`},xp={class:`l`},Sp={key:0},Cp={key:0,class:`menu-more`},wp={key:0,class:`choices-screen-text wrap`},Tp={class:`choices-note`},Ep={class:`choices-keys`},Dp=[`disabled`,`onClick`],Op={key:0,class:`card-kbd`,"aria-hidden":`true`},kp={key:0},Ap=Object.assign(T({__name:`MenuPanel`,props:{paneId:{},menu:{},keys:{type:Boolean}},emits:[`terminal`],setup(e,{emit:t}){let r=e,i=t,o=h(!1),s=h(r.menu.cursor),c=n(()=>s.value===null?r.menu.identity:r.menu.items[s.value]?.identity),l=h(null),u=()=>P(()=>l.value?.querySelector(`.cur`)?.scrollIntoView({block:`nearest`})),d=0;B(()=>r.menu,(e,t)=>{o.value=!1,!(d&&t&&e.cursor===t.cursor&&e.identity===t.identity)&&(s.value=e.cursor,u())}),w(u);let p=n(()=>o.value||r.menu.unavailable||!zi.value||Sr.value),m=n(()=>se(r.menu)),b=n(()=>r.menu.actions.filter(e=>!(e.key===`enter`&&r.menu.cursor!==null&&!m.value))),x=n(()=>r.menu.items.length>0);async function S(e,t){o.value=!0,await pt(r.paneId,{op:`select`,index:e,label:t},r.menu.items[e]?.identity)||(o.value=!1)}async function C(e){o.value=!0,await pt(r.paneId,{op:`key`,key:e.key,label:e.label},c.value)||(o.value=!1)}let T=h(r.menu.search||``),D=h(!1);B(()=>r.menu.search,e=>{D.value||(T.value=e||``)});let O=null;function A(){D.value=!0,O&&clearTimeout(O),O=setTimeout(N,450)}async function N(){O&&=(clearTimeout(O),null);let e=T.value;e!==(r.menu.search||``)&&await pt(r.paneId,{op:`search`,text:e},r.menu.identity),D.value=!1}U(()=>{O&&clearTimeout(O)});let F=h(null),R=n(()=>r.menu.actions.some(e=>e.key===`esc`)),z=n(()=>r.menu.actions.filter(e=>/^ctrl\+[a-z]$/.test(e.key)).map(e=>e.key)),V=n(()=>!!(r.keys&&Hi.value&&x.value&&!p.value));return Ln(()=>!!(r.keys&&Hi.value&&!p.value&&(x.value||z.value.length)),()=>({digits:0,enter:!m.value,own:F.value,ctrl:z.value,nav:V.value}),e=>{if(e.kind===`ctrl`){let t=r.menu.actions.find(t=>t.key===e.key);t&&C(t);return}if(!(e.kind!==`nav`||e.key===`esc`&&!R.value)){if(e.key===`up`||e.key===`down`){let t=r.menu.items.map((e,t)=>e.header?-1:t).filter(e=>e>=0),n=t.indexOf(s.value??-1);s.value=t[n+(e.key===`down`?1:-1)]??s.value,u()}d++,fe(r.paneId,e.key,c.value).then(e=>{d--,e||(s.value=r.menu.cursor,u())})}}),(t,n)=>{let r=Ke;return _(),v(`div`,up,[I(`p`,dp,[n[2]||=I(`i`,null,null,-1),a(M((`t`in t?t.t:f(Z))(`Your turn`)),1),I(`span`,fp,M((`t`in t?t.t:f(Z))(`Interactive menu`)),1)]),e.menu.unavailable?(_(),v(`p`,pp,M((`tl`in t?t.tl:f(Q))(`Screen read failed. Retrying…`,`Lecture de l’écran impossible. Nouvelle tentative…`)),1)):g(``,!0),e.menu.title?(_(),v(`p`,mp,M(e.menu.title),1)):g(``,!0),f(x)&&e.menu.lines.length?(_(),v(`p`,hp,M(e.menu.lines[0]),1)):g(``,!0),f(x)&&f(m)?(_(),v(`p`,gp,M((`tl`in t?t.tl:f(Q))(`Tap an entry to move the cursor there, then confirm with a button below.`,`Toucher une entrée y place le curseur ; valide ensuite avec un bouton ci-dessous.`)),1)):g(``,!0),e.menu.search===null?g(``,!0):(_(),v(`form`,{key:4,class:`menu-search`,onSubmit:re(N,[`prevent`])},[E(r,{name:`i-lucide-search`,"aria-hidden":`true`}),L(I(`input`,{ref_key:`searchRef`,ref:F,"onUpdate:modelValue":n[0]||=e=>G(T)?T.value=e:null,type:`search`,placeholder:(`t`in t?t.t:f(Z))(`Search…`),"aria-label":(`t`in t?t.t:f(Z))(`Search the menu`),enterkeyhint:`search`,autocomplete:`off`,autocapitalize:`off`,spellcheck:`false`,disabled:f(p),onInput:A},null,40,_p),[[J,f(T)]])],32)),f(x)?(_(),v(`div`,{key:5,ref_key:`listRef`,ref:l,class:`choices-list menu-list`},[(_(!0),v(k,null,y(e.menu.items,(e,t)=>(_(),v(k,{key:t},[e.header?(_(),v(`p`,vp,M(e.label),1)):(_(),v(`button`,{key:1,type:`button`,class:j({cur:t===f(s)}),"aria-current":t===f(s)?`true`:void 0,disabled:f(p),onClick:n=>S(t,e.label)},[I(`span`,bp,M(t===f(s)?`❯`:``),1),I(`span`,xp,[a(M(e.label),1),e.hint?(_(),v(`small`,Sp,M(e.hint),1)):g(``,!0)])],10,yp))],64))),128)),e.menu.more?(_(),v(`p`,Cp,M(e.menu.more),1)):g(``,!0)],512)):(_(),v(k,{key:6},[e.menu.lines.length?(_(),v(`pre`,wp,M(e.menu.lines.join(`
78
- `)),1)):g(``,!0),I(`p`,Tp,M((`tl`in t?t.tl:f(Q))(`Interactive menu open: pick its entries in the terminal.`,`Menu interactif en cours : ses entrées se choisissent dans le terminal.`)),1)],64)),I(`div`,Ep,[(_(!0),v(k,null,y(f(b),e=>(_(),v(`button`,{key:e.key+e.label,type:`button`,disabled:f(p),onClick:t=>C(e)},[a(M((`screenActionText`in t?t.screenActionText:f(dr))(e)),1),I(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(Mr))(e.key)),1)],8,Dp))),128)),f(V)?(_(),v(`span`,Op,[n[3]||=I(`kbd`,null,`↑↓`,-1),f(m)?g(``,!0):(_(),v(`kbd`,kp,M((`screenKeyName`in t?t.screenKeyName:f(Mr))(`enter`)),1))])):g(``,!0),I(`button`,{type:`button`,class:`menu-term`,onClick:n[1]||=e=>i(`terminal`)},[E(r,{name:`i-lucide-square-terminal`,"aria-hidden":`true`}),a(M((`t`in t?t.t:f(Z))(`View terminal`)),1)])])])}}}),{__name:`MenuPanel`}),jp={class:`usage-limit-card composer-notice`,role:`status`},Mp={class:`restart-text`},Np={key:1},Pp=[`disabled`],Fp=[`disabled`],Ip={key:2,class:`notice-btn`,href:`https://clau.de/reset`,target:`_blank`,rel:`noopener noreferrer`},Lp=Object.assign(ca(T({__name:`UsageLimitCard`,props:{limit:{},readOnly:{type:Boolean},sendKeys:{type:Function}},emits:[`credits`],setup(e,{emit:t}){let n=e,r=t,i=h(!1);async function o(){if(!(n.readOnly||i.value)){i.value=!0;try{await n.sendKeys([`esc`])}catch(e){$(e.message,!0)}finally{i.value=!1}}}return(t,n)=>(_(),v(`div`,jp,[I(`span`,Mp,[a(M(f(Q)(`Provider quota reached`,`Quota fournisseur atteint`)),1),e.limit.resets?(_(),v(k,{key:0},[a(` · `+M(f(Q)(`Resets`,`Réinitialisation`))+` `+M(e.limit.resets),1)],64)):g(``,!0),e.limit.automatic?(_(),v(`small`,Np,M(f(Q)(`Will continue automatically`,`Reprise automatique`)),1)):g(``,!0)]),e.limit.automatic?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,disabled:e.readOnly||f(i),onClick:o},M(f(Q)(`Cancel wait`,`Annuler l’attente`)),9,Pp)):g(``,!0),e.limit.credits?(_(),v(`button`,{key:1,type:`button`,class:`notice-btn`,disabled:e.readOnly||f(i),onClick:n[0]||=e=>r(`credits`)},`/usage-credits`,8,Fp)):g(``,!0),e.limit.resetLink?(_(),v(`a`,Ip,M(f(Q)(`Reset quota ↗`,`Réinitialiser le quota ↗`)),1)):g(``,!0)]))}}),[[`__scopeId`,`data-v-8c0c9595`]]),{__name:`UsageLimitCard`}),Rp={key:0,class:`composer-notice restart`,role:`status`},zp={class:`restart-text`},Bp={key:1,class:`composer-notice failed`,role:`status`},Vp={class:`restart-text`},Hp={key:2,class:`composer-notice`,role:`status`},Up={class:`restart-text`},Wp=[`disabled`,`title`],Gp={key:3,class:`composer-notice codex-update`,role:`status`},Kp=[`title`],qp={key:0,class:`notice-extra`},Jp=[`href`,`aria-label`,`title`],Yp={class:`notice-label`},Xp=[`disabled`,`title`],Zp={key:2,class:`notice-reason`},Qp=[`aria-label`,`title`],$p=[`title`],em=[`disabled`,`title`],tm=`wherdr.codexUpdate.dismissed`,nm=Object.assign(T({__name:`CodexNotices`,props:{pane:{},paneId:{},readOnly:{type:Boolean}},setup(e){let t=e,r=h(``);try{r.value=localStorage.getItem(tm)||``}catch{}let i=n(()=>{let e=t.pane.codexStatus?.update;return!e||e.state===`available`&&!e.job&&e.latest===r.value?null:e}),o=n(()=>t.pane.codexStatus?.weekly||null),s=n(()=>i.value?.job||null),c=n(()=>{let e=oi(t.pane.id),n=ur.value.machines?.find(t=>t.key===e);return n&&n.label||vi.value||Z(`This machine`)}),l=n(()=>{let e=i.value;if(!e)return``;let t=Q(`Codex ${e.latest} available`,`Codex ${e.latest} disponible`);return e.current?`${t} ${Q(`(you have ${e.current})`,`(tu as la ${e.current})`)}`:t}),u=n(()=>{let e=o.value;return e?e.lessThan?Q(`Weekly limit: less than ${e.left}% left`,`Limite hebdo : moins de ${e.left} % restants`):Q(`Weekly limit: ${e.left}% left`,`Limite hebdo : ${e.left} % restants`):``});function d(){let e=i.value?.latest;if(e){r.value=e;try{localStorage.setItem(tm,e)}catch{}}}async function p(){let e=i.value?.command;if(e){X();try{await navigator.clipboard.writeText(e),$(Q(`Command copied: paste it into a terminal on ${c.value}.`,`Commande copiée : colle-la dans un terminal sur ${c.value}.`))}catch{$(Z(`Copy failed`),!0)}}}let m=n(()=>{if(i.value?.method!==`terminal`)return``;let e=t.pane.status;return e===`working`?Q(`Codex is working: update it once it is done`,`Codex travaille : mets-le à jour quand il a fini`):e===`blocked`?Q(`Codex is waiting for an answer: answer it first`,`Codex attend une réponse : réponds-lui d’abord`):``});async function y(){let e=i.value;if(e&&e.runnable&&e.command&&!m.value&&(e.method===`terminal`?await Tt([Q(`Update Codex to ${e.latest} on ${c.value}?`,`Mettre à jour Codex en ${e.latest} sur ${c.value} ?`),Q(`wherdr will exit Codex in this pane, type Codex’s official update command in its terminal:`,`wherdr va quitter Codex dans ce panneau et taper dans son terminal la commande de mise à jour officielle de Codex :`),e.command,Q(`then restart Codex on this conversation (codex resume). If the update fails, the pane stays at its shell.`,`puis relancer Codex sur cette conversation (codex resume). Si la mise à jour échoue, le panneau reste sur son shell.`)].join(`
74
+ }`)),this.register((0,i.toDisposable)((()=>l.deleteProgram(this._program)))),this._projectionLocation=(0,r.throwIfFalsy)(l.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=l.createVertexArray(),l.bindVertexArray(this._vertexArrayObject);let u=new Float32Array([0,0,1,0,0,1,1,1]),d=l.createBuffer();this.register((0,i.toDisposable)((()=>l.deleteBuffer(d)))),l.bindBuffer(l.ARRAY_BUFFER,d),l.bufferData(l.ARRAY_BUFFER,u,l.STATIC_DRAW),l.enableVertexAttribArray(3),l.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let f=new Uint8Array([0,1,2,3]),p=l.createBuffer();this.register((0,i.toDisposable)((()=>l.deleteBuffer(p)))),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,p),l.bufferData(l.ELEMENT_ARRAY_BUFFER,f,l.STATIC_DRAW),this._attributesBuffer=(0,r.throwIfFalsy)(l.createBuffer()),this.register((0,i.toDisposable)((()=>l.deleteBuffer(this._attributesBuffer)))),l.bindBuffer(l.ARRAY_BUFFER,this._attributesBuffer),l.enableVertexAttribArray(0),l.vertexAttribPointer(0,2,l.FLOAT,!1,s,0),l.vertexAttribDivisor(0,1),l.enableVertexAttribArray(1),l.vertexAttribPointer(1,2,l.FLOAT,!1,s,2*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(1,1),l.enableVertexAttribArray(2),l.vertexAttribPointer(2,4,l.FLOAT,!1,s,4*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(2,1),this._updateCachedColors(a.colors),this.register(this._themeService.onChangeColors((e=>{this._updateCachedColors(e),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,o.PROJECTION_MATRIX),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r,i,o,s,c,l,u,d,f,p,m,h=1;for(r=0;r<t.rows;r++){for(o=-1,s=0,c=0,l=!1,i=0;i<t.cols;i++)u=(r*t.cols+i)*a.RENDER_MODEL_INDICIES_PER_CELL,d=e.cells[u+a.RENDER_MODEL_BG_OFFSET],f=e.cells[u+a.RENDER_MODEL_FG_OFFSET],p=!!(67108864&f),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=8*h++,this._updateRectangle(n,m,c,s,o,i,r)),o=i,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=8*h++,this._updateRectangle(n,m,c,s,o,t.cols,r))}n.count=h}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`)return void(t.count=0);let r,i=0;n.style!==`bar`&&n.style!==`outline`||(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),n.style!==`underline`&&n.style!==`outline`||(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=8*i++,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,s){if(67108864&n)switch(50331648&n){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&n].rgba;break;case 50331648:l=(16777215&n)<<8;break;default:l=this._themeService.colors.foreground.rgba}else switch(50331648&r){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&r].rgba;break;case 50331648:l=(16777215&r)<<8;break;default:l=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=(0,o.expandFloat32Array)(e.attributes,this._terminal.rows*this._terminal.cols*8)),u=i*this._dimensions.device.cell.width,d=s*this._dimensions.device.cell.height,f=(l>>24&255)/255,p=(l>>16&255)/255,m=(l>>8&255)/255,h=1,this._addRectangle(e.attributes,t,u,d,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,f,p,m,h)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(255&e.rgba)/255])}}t.RectangleRenderer=g},310:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;let r=n(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array,this.lineLengths=new Uint32Array,this.selection=(0,r.createSelectionRenderModel)()}resize(e,n){let r=e*n*t.RENDER_MODEL_INDICIES_PER_CELL;r!==this.cells.length&&(this.cells=new Uint32Array(r),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;let r=n(820),i=n(274),a=n(627),o=n(457),s=n(56),c=n(374),l=n(345),u=n(859),d=n(147),f=n(782),p=n(855),m=n(965),h=n(742),g=n(310),_=n(733);class v extends u.Disposable{constructor(e,t,n,o,d,p,m,h,v){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=o,this._coreService=d,this._decorationService=p,this._optionsService=m,this._themeService=h,this._cursorBlinkStateManager=new u.MutableDisposable,this._charAtlasDisposable=this.register(new u.MutableDisposable),this._observerDisposable=this.register(new u.MutableDisposable),this._model=new g.RenderModel,this._workCell=new f.CellData,this._workCell2=new f.CellData,this._rectangleRenderer=this.register(new u.MutableDisposable),this._glyphRenderer=this.register(new u.MutableDisposable),this._onChangeTextureAtlas=this.register(new l.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new l.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new l.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new l.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors((()=>this._handleColorChange()))),this._cellColorResolver=new i.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new _.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,m,this._themeService)],this.dimensions=(0,c.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(m.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let y={antialias:!1,depth:!1,preserveDrawingBuffer:v};if(this._gl=this._canvas.getContext(`webgl2`,y),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this.register((0,r.addDisposableDomListener)(this._canvas,`webglcontextlost`,(e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)}),3e3)}))),this.register((0,r.addDisposableDomListener)(this._canvas,`webglcontextrestored`,(e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,a.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,s.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((e,t)=>this._setCanvasDevicePixelDimensions(e,t))),this.register(this._coreBrowserService.onWindowChange((e=>{this._observerDisposable.value=(0,s.observeDevicePixelDimensions)(this._canvas,e,((e,t)=>this._setCanvasDevicePixelDimensions(e,t)))}))),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,u.toDisposable)((()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),(0,a.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new h.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new m.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);let e=(0,a.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=(0,u.getDisposeArrayDisposable)([(0,l.forwardEvent)(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,l.forwardEvent)(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(e){return-1}deregisterCharacterJoiner(e){return!1}renderRows(e,t){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new o.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r,i,a,o,s,c,l,u,d,f,m,h,_,v,x=this._workCell;e=b(e,n.rows-1,0),t=b(t,n.rows-1,0);let S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=S-n.buffer.ydisp,w=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),T=-1,E=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let D=!1;for(i=e;i<=t;i++)for(a=i+n.buffer.ydisp,o=n.buffer.lines.get(a),this._model.lineLengths[i]=0,s=this._characterJoinerService.getJoinedCharacters(a),_=0;_<n.cols;_++)if(r=this._cellColorResolver.result.bg,o.loadCell(_,x),_===0&&(r=this._cellColorResolver.result.bg),c=!1,l=_,s.length>0&&_===s[0][0]&&(c=!0,u=s.shift(),x=new y(x,o.translateToString(!0,u[0],u[1]),u[1]-u[0]),l=u[1]-1),d=x.getChars(),f=x.getCode(),h=(i*n.cols+_)*g.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(x,_,a,this.dimensions.device.cell.width),E&&a===S&&(_===w&&(this._model.cursor={x:w,y:C,width:x.getWidth(),style:this._coreBrowserService.isFocused?n.options.cursorStyle||`block`:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},T=w+x.getWidth()-1),_>=w&&_<=T&&(this._coreBrowserService.isFocused&&(n.options.cursorStyle||`block`)===`block`||!1===this._coreBrowserService.isFocused&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),f!==p.NULL_CELL_CODE&&(this._model.lineLengths[i]=_+1),(this._model.cells[h]!==f||this._model.cells[h+g.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[h+g.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[h+g.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(D=!0,d.length>1&&(f|=g.COMBINED_CHAR_BIT_MASK),this._model.cells[h]=f,this._model.cells[h+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[h+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[h+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,m=x.getWidth(),this._glyphRenderer.value.updateCell(_,i,f,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,m,r),c))for(x=this._workCell,_++;_<l;_++)v=(i*n.cols+_)*g.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(_,i,p.NULL_CELL_CODE,0,0,0,p.NULL_CELL_CHAR,0,0),this._model.cells[v]=p.NULL_CELL_CODE,this._model.cells[v+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[v+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[v+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;D&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}}t.WebglRenderer=v;class y extends d.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function b(e,t,n=0){return Math.max(Math.min(e,t),n)}t.JoinedCellData=y},381:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;let r=n(374);function i(e,t,n){let i=(0,r.throwIfFalsy)(e.createShader(t));if(e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(e,t,n){let a=(0,r.throwIfFalsy)(e.createProgram());if(e.attachShader(a,(0,r.throwIfFalsy)(i(e,e.VERTEX_SHADER,t))),e.attachShader(a,(0,r.throwIfFalsy)(i(e,e.FRAGMENT_SHADER,n))),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS))return a;console.error(e.getProgramInfoLog(a)),e.deleteProgram(a)},t.createShader=i,t.expandFloat32Array=function(e,t){let n=Math.min(2*e.length,t),r=new Float32Array(n);for(let t=0;t<e.length;t++)r[t]=e[t];return r},t.GLTexture=class{constructor(e){this.texture=e,this.version=-1}}},592:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;let r=n(627),i=n(237),a=n(374),o=n(859);class s extends o.Disposable{constructor(e,t,n,r,i,a,s,c){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=s,this._themeService=c,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((t=>{this._refreshCharAtlas(e,t),this.reset(e)}))),this.register((0,o.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,a.throwIfFalsy)(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,r.acquireTextureAtlas)(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=i.TEXT_BASELINE,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){return`${n?`italic`:``} ${t?e.options.fontWeightBold:e.options.fontWeight} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}}t.BaseRenderLayer=s},733:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;let r=n(197),i=n(237),a=n(592);class o extends a.BaseRenderLayer{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this.register(r.onShowLinkUnderline((e=>this._handleShowLinkUnderline(e)))),this.register(r.onHideLinkUnderline((e=>this._handleHideLinkUnderline(e))))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===i.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&(0,r.is256Color)(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}}t.LinkRenderLayer=o},820:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},274:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;let r=n(855),i=n(160),a=n(374),o,s=0,c=0,l=!1,u=!1,d=!1,f=0;t.CellColorResolver=class{constructor(e,t,n,r,i,a){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=r,this._coreBrowserService=i,this._themeService=a,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,p){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=268435456&e.bg?e.extended.ext:0,c=0,s=0,u=!1,l=!1,d=!1,o=this._themeService.colors,f=0,e.getCode()!==r.NULL_CELL_CODE&&e.extended.underlineStyle===4){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));f=t*p%(2*Math.round(e))}if(this._decorationService.forEachDecorationAtCell(t,n,`bottom`,(e=>{e.backgroundColorRGB&&(c=e.backgroundColorRGB.rgba>>8&16777215,u=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,l=!0)})),d=this._selectionRenderModel.isCellSelected(this._terminal,t,n),d){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:c=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:c=(16777215&this.result.fg)<<8|255;break;default:c=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:c=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:c=(16777215&this.result.bg)<<8|255}c=i.rgba.blend(c,4294967040&(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else c=(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(u=!0,o.selectionForeground&&(s=o.selectionForeground.rgba>>8&16777215,l=!0),(0,a.treatGlyphAsBackgroundColor)(e.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))s=(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:s=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:s=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:s=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:s=(16777215&this.result.fg)<<8|255;break;default:s=this._themeService.colors.foreground.rgba}s=i.rgba.blend(s,4294967040&(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}l=!0}}this._decorationService.forEachDecorationAtCell(t,n,`top`,(e=>{e.backgroundColorRGB&&(c=e.backgroundColorRGB.rgba>>8&16777215,u=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,l=!0)})),u&&(c=d?e.bg&-150994944|c|50331648:-16777216&e.bg|c|50331648),l&&(s=e.fg&-83886080|s|50331648),67108864&this.result.fg&&(u&&!l&&(s=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&o.background.rgba>>8|50331648,l=!0),!u&&l&&(c=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&o.foreground.rgba>>8|50331648,u=!0)),o=void 0,this.result.bg=u?c:this.result.bg,this.result.fg=l?s:this.result.fg,this.result.ext&=536870911,this.result.ext|=f<<29&3758096384}}},627:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;let r=n(509),i=n(197),a=[];t.acquireTextureAtlas=function(e,t,n,o,s,c,l,u){let d=(0,i.generateConfig)(o,s,c,l,t,n,u);for(let t=0;t<a.length;t++){let n=a[t],r=n.ownedBy.indexOf(e);if(r>=0){if((0,i.configEquals)(n.config,d))return n.atlas;n.ownedBy.length===1?(n.atlas.dispose(),a.splice(t,1)):n.ownedBy.splice(r,1);break}}for(let t=0;t<a.length;t++){let n=a[t];if((0,i.configEquals)(n.config,d))return n.ownedBy.push(e),n.atlas}let f=e._core,p={atlas:new r.TextureAtlas(document,d,f.unicodeService),config:d,ownedBy:[e]};return a.push(p),p.atlas},t.removeTerminalFromCache=function(e){for(let t=0;t<a.length;t++){let n=a[t].ownedBy.indexOf(e);if(n!==-1){a[t].ownedBy.length===1?(a[t].atlas.dispose(),a.splice(t,1)):a[t].ownedBy.splice(n,1);break}}}},197:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;let r=n(160);t.generateConfig=function(e,t,n,i,a,o,s){let c={foreground:o.foreground,background:o.background,cursor:r.NULL_COLOR,cursorAccent:r.NULL_COLOR,selectionForeground:r.NULL_COLOR,selectionBackgroundTransparent:r.NULL_COLOR,selectionBackgroundOpaque:r.NULL_COLOR,selectionInactiveBackgroundTransparent:r.NULL_COLOR,selectionInactiveBackgroundOpaque:r.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:a.customGlyphs,devicePixelRatio:s,letterSpacing:a.letterSpacing,lineHeight:a.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:i,fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,allowTransparency:a.allowTransparency,drawBoldTextInBrightColors:a.drawBoldTextInBrightColors,minimumContrastRatio:a.minimumContrastRatio,colors:c}},t.configEquals=function(e,t){for(let n=0;n<e.colors.ansi.length;n++)if(e.colors.ansi[n].rgba!==t.colors.ansi[n].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba},t.is256Color=function(e){return(50331648&e)==16777216||(50331648&e)==33554432}},237:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},457:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=600){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0)return void this._restartInterval(e)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})),this._blinkInterval=this._coreBrowserService.window.setInterval((()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;let r=n(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};let i={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:`M0,.5 L1,.5`},"━":{3:`M0,.5 L1,.5`},"│":{1:`M.5,0 L.5,1`},"┃":{3:`M.5,0 L.5,1`},"┌":{1:`M0.5,1 L.5,.5 L1,.5`},"┏":{3:`M0.5,1 L.5,.5 L1,.5`},"┐":{1:`M0,.5 L.5,.5 L.5,1`},"┓":{3:`M0,.5 L.5,.5 L.5,1`},"└":{1:`M.5,0 L.5,.5 L1,.5`},"┗":{3:`M.5,0 L.5,.5 L1,.5`},"┘":{1:`M.5,0 L.5,.5 L0,.5`},"┛":{3:`M.5,0 L.5,.5 L0,.5`},"├":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┣":{3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┤":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┫":{3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┬":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┳":{3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┴":{1:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┻":{3:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┼":{1:`M0,.5 L1,.5 M.5,0 L.5,1`},"╋":{3:`M0,.5 L1,.5 M.5,0 L.5,1`},"╴":{1:`M.5,.5 L0,.5`},"╸":{3:`M.5,.5 L0,.5`},"╵":{1:`M.5,.5 L.5,0`},"╹":{3:`M.5,.5 L.5,0`},"╶":{1:`M.5,.5 L1,.5`},"╺":{3:`M.5,.5 L1,.5`},"╷":{1:`M.5,.5 L.5,1`},"╻":{3:`M.5,.5 L.5,1`},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:`M1,0 L0,1`},"╲":{1:`M0,0 L1,1`},"╳":{1:`M1,0 L0,1 M0,0 L1,1`},"╼":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"╽":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L.5,1`},"╾":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"╿":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┍":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┎":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┑":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L0,.5`},"┒":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┕":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L1,.5`},"┖":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┙":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L0,.5`},"┚":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,0`},"┝":{1:`M.5,0 L.5,1`,3:`M.5,.5 L1,.5`},"┞":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┟":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┠":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1`},"┡":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"┢":{1:`M.5,.5 L.5,0`,3:`M0.5,1 L.5,.5 L1,.5`},"┥":{1:`M.5,0 L.5,1`,3:`M.5,.5 L0,.5`},"┦":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┧":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┨":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1`},"┩":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L0,.5`},"┪":{1:`M.5,.5 L.5,0`,3:`M0,.5 L.5,.5 L.5,1`},"┭":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┮":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┯":{1:`M.5,.5 L.5,1`,3:`M0,.5 L1,.5`},"┰":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┱":{1:`M.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"┲":{1:`M.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"┵":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┶":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┷":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5`},"┸":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┹":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"┺":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,.5 L1,.5`},"┽":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┾":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┿":{1:`M.5,0 L.5,1`,3:`M0,.5 L1,.5`},"╀":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"╁":{1:`M.5,.5 L.5,0 M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"╂":{1:`M0,.5 L1,.5`,3:`M.5,0 L.5,1`},"╃":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"╄":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"╅":{1:`M.5,0 L.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"╆":{1:`M.5,0 L.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"╇":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0 M0,.5 L1,.5`},"╈":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"╉":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"╊":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"╌":{1:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"╍":{3:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"┄":{1:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┅":{3:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┈":{1:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"┉":{3:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"╎":{1:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"╏":{3:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"┆":{1:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┇":{3:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┊":{1:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"┋":{3:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:`M0,0 L1,.5 L0,1`,type:0,rightPadding:2},"":{d:`M-1,-.5 L1,.5 L-1,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1,0 L0,.5 L1,1`,type:0,leftPadding:2},"":{d:`M2,-.5 L0,.5 L2,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0`,type:0,rightPadding:1},"":{d:`M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0`,type:1,rightPadding:1},"":{d:`M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0`,type:0,leftPadding:1},"":{d:`M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0`,type:1,leftPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L-.5,1.5`,type:0},"":{d:`M-.5,-.5 L1.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1.5,-.5 L-.5,1.5 L1.5,1.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5 L-.5,-.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L1.5,-.5`,type:0}},t.powerlineDefinitions[``]=t.powerlineDefinitions[``],t.powerlineDefinitions[``]=t.powerlineDefinitions[``],t.tryDrawCustomChar=function(e,n,o,l,u,d,f,p){let m=t.blockElementDefinitions[n];if(m)return function(e,t,n,r,i,a){for(let o=0;o<t.length;o++){let s=t[o],c=i/8,l=a/8;e.fillRect(n+s.x*c,r+s.y*l,s.w*c,s.h*l)}}(e,m,o,l,u,d),!0;let h=i[n];if(h)return function(e,t,n,i,o,s){let c=a.get(t);c||(c=new Map,a.set(t,c));let l=e.fillStyle;if(typeof l!=`string`)throw Error(`Unexpected fillStyle type "${l}"`);let u=c.get(l);if(!u){let n=t[0].length,i=t.length,a=e.canvas.ownerDocument.createElement(`canvas`);a.width=n,a.height=i;let o=(0,r.throwIfFalsy)(a.getContext(`2d`)),s=new ImageData(n,i),d,f,p,m;if(l.startsWith(`#`))d=parseInt(l.slice(1,3),16),f=parseInt(l.slice(3,5),16),p=parseInt(l.slice(5,7),16),m=l.length>7&&parseInt(l.slice(7,9),16)||1;else{if(!l.startsWith(`rgba`))throw Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);[d,f,p,m]=l.substring(5,l.length-1).split(`,`).map((e=>parseFloat(e)))}for(let e=0;e<i;e++)for(let r=0;r<n;r++)s.data[4*(e*n+r)]=d,s.data[4*(e*n+r)+1]=f,s.data[4*(e*n+r)+2]=p,s.data[4*(e*n+r)+3]=t[e][r]*(255*m);o.putImageData(s,0,0),u=(0,r.throwIfFalsy)(e.createPattern(a,null)),c.set(l,u)}e.fillStyle=u,e.fillRect(n,i,o,s)}(e,h,o,l,u,d),!0;let g=t.boxDrawingDefinitions[n];if(g)return function(e,t,n,r,i,a,o){e.strokeStyle=e.fillStyle;for(let[l,u]of Object.entries(t)){let t;e.beginPath(),e.lineWidth=o*Number.parseInt(l),t=typeof u==`function`?u(.15,.15/a*i):u;for(let l of t.split(` `)){let t=l[0],u=s[t];if(!u){console.error(`Could not find drawing instructions for "${t}"`);continue}let d=l.substring(1).split(`,`);d[0]&&d[1]&&u(e,c(d,i,a,n,r,!0,o))}e.stroke(),e.closePath()}}(e,g,o,l,u,d,p),!0;let _=t.powerlineDefinitions[n];return!!_&&(function(e,t,n,r,i,a,o,l){let u=new Path2D;u.rect(n,r,i,a),e.clip(u),e.beginPath();let d=o/12;e.lineWidth=l*d;for(let o of t.d.split(` `)){let u=o[0],f=s[u];if(!f){console.error(`Could not find drawing instructions for "${u}"`);continue}let p=o.substring(1).split(`,`);p[0]&&p[1]&&f(e,c(p,i,a,n,r,!1,l,(t.leftPadding??0)*(d/2),(t.rightPadding??0)*(d/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}(e,_,o,l,u,d,f,p),!0)};let a=new Map;function o(e,t,n=0){return Math.max(Math.min(e,t),n)}let s={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function c(e,t,n,r,i,a,s,c=0,l=0){let u=e.map((e=>parseFloat(e)||parseInt(e)));if(u.length<2)throw Error(`Too few arguments for instruction`);for(let e=0;e<u.length;e+=2)u[e]*=t-c*s-l*s,a&&u[e]!==0&&(u[e]=o(Math.round(u[e]+.5)-.5,t,0)),u[e]+=r+c*s;for(let e=1;e<u.length;e+=2)u[e]*=n,a&&u[e]!==0&&(u[e]=o(Math.round(u[e]+.5)-.5,n,0)),u[e]+=i;return u}},56:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;let r=n(859);t.observeDevicePixelDimensions=function(e,t,n){let i=new t.ResizeObserver((t=>{let r=t.find((t=>t.target===e));if(!r)return;if(!(`devicePixelContentBoxSize`in r))return i?.disconnect(),void(i=void 0);let a=r.devicePixelContentBoxSize[0].inlineSize,o=r.devicePixelContentBoxSize[0].blockSize;a>0&&o>0&&n(a,o)}));try{i.observe(e,{box:[`device-pixel-content-box`]})}catch{i.disconnect(),i=void 0}return(0,r.toDisposable)((()=>i?.disconnect()))}},374:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},296:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},509:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;let r=n(237),i=n(860),a=n(374),o=n(160),s=n(345),c=n(485),l=n(385),u=n(147),d=n(855),f={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},p;class m{get pages(){return this._pages}constructor(e,t,n){this._document=e,this._config=t,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new c.FourKeyMap,this._cacheMapCombined=new c.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new u.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new s.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new s.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=_(e,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,a.throwIfFalsy)(this._tmpCanvas.getContext(`2d`,{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||=(this._doWarmUp(),!0)}_doWarmUp(){let e=new l.IdleTaskQueue;for(let t=33;t<126;t++)e.enqueue((()=>{if(!this._cacheMap.get(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT)){let e=this._drawToCache(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT);this._cacheMap.set(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT,e)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(m.maxAtlasPages&&this._pages.length>=Math.max(4,m.maxAtlasPages)){let e=this._pages.filter((e=>2*e.canvas.width<=(m.maxTextureSize||4096))).sort(((e,t)=>t.canvas.width===e.canvas.width?t.percentageUsed-e.percentageUsed:t.canvas.width-e.canvas.width)),t=-1,n=0;for(let r=0;r<e.length;r++)if(e[r].canvas.width!==n)t=r,n=e[r].canvas.width;else if(r-t==3)break;let r=e.slice(t,t+4),i=r.map((e=>e.glyphs[0].texturePage)).sort(((e,t)=>e>t?1:-1)),a=this.pages.length-r.length,o=this._mergePages(r,a);o.version++;for(let e=i.length-1;e>=0;e--)this._deletePage(i[e]);this.pages.push(o),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(o.canvas)}let e=new h(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,t){let n=2*e[0].canvas.width,r=new h(this._document,n,e);for(let[i,a]of e.entries()){let e=i*a.canvas.width%n,o=Math.floor(i/2)*a.canvas.height;r.ctx.drawImage(a.canvas,e,o);for(let r of a.glyphs)r.texturePage=t,r.sizeClipSpace.x=r.size.x/n,r.sizeClipSpace.y=r.size.y/n,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/n,r.texturePositionClipSpace.y=r.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(a.canvas);let s=this._activePages.indexOf(a);s!==-1&&this._activePages.splice(s,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let e=this._pages[t];for(let t of e.glyphs)t.texturePage--;e.version++}}getRasterizedGlyphCombinedChar(e,t,n,r,i){return this._getFromCacheMap(this._cacheMapCombined,e,t,n,r,i)}getRasterizedGlyph(e,t,n,r,i){return this._getFromCacheMap(this._cacheMap,e,t,n,r,i)}_getFromCacheMap(e,t,n,r,i,a=!1){return p=e.get(t,n,r,i),p||(p=this._drawToCache(t,n,r,i,a),e.set(t,n,r,i,p)),p}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw Error(`No color found for idx `+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,n,r){if(this._config.allowTransparency)return o.NULL_COLOR;let i;switch(e){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(t);break;case 50331648:let e=u.AttributeData.toColorRGB(t);i=o.channels.toColor(e[0],e[1],e[2]);break;default:i=n?o.color.opaque(this._config.colors.foreground):this._config.colors.background}return i}_getForegroundColor(e,t,n,i,a,s,c,l,d,f){let p=this._getMinimumContrastColor(e,t,n,i,a,s,c,d,l,f);if(p)return p;let m;switch(a){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&d&&s<8&&(s+=8),m=this._getColorFromAnsiIndex(s);break;case 50331648:let e=u.AttributeData.toColorRGB(s);m=o.channels.toColor(e[0],e[1],e[2]);break;default:m=c?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(m=o.color.opaque(m)),l&&(m=o.color.multiplyOpacity(m,r.DIM_OPACITY)),m}_resolveBackgroundRgba(e,t,n){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,n,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,n,r,i,a,s,c,l,u){if(this._config.minimumContrastRatio===1||u)return;let d=this._getContrastCache(l),f=d.getColor(e,r);if(f!==void 0)return f||void 0;let p=this._resolveBackgroundRgba(t,n,s),m=this._resolveForegroundRgba(i,a,s,c),h=o.rgba.ensureContrastRatio(p,m,this._config.minimumContrastRatio/(l?2:1));if(!h)return void d.setColor(e,r,null);let g=o.channels.toColor(h>>24&255,h>>16&255,h>>8&255);return d.setColor(e,r,g),g}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,t,n,o,s=!1){let c=typeof e==`number`?String.fromCharCode(e):e,l=Math.min(this._config.deviceCellWidth*Math.max(c.length,2)+4,this._textureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);let d=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<d&&(this._tmpCanvas.height=d),this._tmpCtx.save(),this._workAttributeData.fg=n,this._workAttributeData.bg=t,this._workAttributeData.extended.ext=o,this._workAttributeData.isInvisible())return f;let p=!!this._workAttributeData.isBold(),h=!!this._workAttributeData.isInverse(),_=!!this._workAttributeData.isDim(),v=!!this._workAttributeData.isItalic(),y=!!this._workAttributeData.isUnderline(),b=!!this._workAttributeData.isStrikethrough(),x=!!this._workAttributeData.isOverline(),S=this._workAttributeData.getFgColor(),C=this._workAttributeData.getFgColorMode(),w=this._workAttributeData.getBgColor(),T=this._workAttributeData.getBgColorMode();if(h){let e=S;S=w,w=e;let t=C;C=T,T=t}let E=this._getBackgroundColor(T,w,h,_);this._tmpCtx.globalCompositeOperation=`copy`,this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation=`source-over`;let D=p?this._config.fontWeightBold:this._config.fontWeight,O=v?`italic`:``;this._tmpCtx.font=`${O} ${D} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=r.TEXT_BASELINE;let k=c.length===1&&(0,a.isPowerlineGlyph)(c.charCodeAt(0)),A=c.length===1&&(0,a.isRestrictedPowerlineGlyph)(c.charCodeAt(0)),j=this._getForegroundColor(t,T,w,n,C,S,h,_,p,(0,a.treatGlyphAsBackgroundColor)(c.charCodeAt(0)));this._tmpCtx.fillStyle=j.css;let M=A?0:4,N=!1;!1!==this._config.customGlyphs&&(N=(0,i.tryDrawCustomChar)(this._tmpCtx,c,M,M,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let P,F=!k;if(P=typeof e==`number`?this._unicodeService.wcwidth(e):this._unicodeService.getStringCellWidth(e),y){this._tmpCtx.save();let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;if(this._tmpCtx.lineWidth=e,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())F=!1,this._tmpCtx.strokeStyle=`rgb(${u.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(`,`)})`;else{F=!1;let e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&e<8&&(e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(e).css}this._tmpCtx.beginPath();let n=M,r=Math.ceil(M+this._config.deviceCharHeight)-t-(s?2*e:0),i=r+e,o=r+2*e,l=this._workAttributeData.getUnderlineVariantOffset();for(let s=0;s<P;s++){this._tmpCtx.save();let c=n+s*this._config.deviceCellWidth,u=n+(s+1)*this._config.deviceCellWidth,d=c+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r),this._tmpCtx.moveTo(c,o),this._tmpCtx.lineTo(u,o);break;case 3:let n=e<=1?o:Math.ceil(M+this._config.deviceCharHeight-e/2)-t,s=e<=1?r:Math.ceil(M+this._config.deviceCharHeight+e/2)-t,f=new Path2D;f.rect(c,r,this._config.deviceCellWidth,o-r),this._tmpCtx.clip(f),this._tmpCtx.moveTo(c-this._config.deviceCellWidth/2,i),this._tmpCtx.bezierCurveTo(c-this._config.deviceCellWidth/2,s,c,s,c,i),this._tmpCtx.bezierCurveTo(c,n,d,n,d,i),this._tmpCtx.bezierCurveTo(d,s,u,s,u,i),this._tmpCtx.bezierCurveTo(u,n,u+this._config.deviceCellWidth/2,n,u+this._config.deviceCellWidth/2,i);break;case 4:let p=l===0?0:l>=e?2*e-l:e-l;!(l>=e)==0||p===0?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(c+p,r),this._tmpCtx.lineTo(u,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(c+p,r),this._tmpCtx.moveTo(c+p+e,r),this._tmpCtx.lineTo(u,r)),l=(0,a.computeNextVariantOffset)(u-c,e,l);break;case 5:let m=u-c,h=Math.floor(.6*m),g=Math.floor(.3*m),_=m-h-g;this._tmpCtx.setLineDash([h,g,_]),this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r);break;default:this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!N&&this._config.fontSize>=12&&!this._config.allowTransparency&&c!==` `){this._tmpCtx.save(),this._tmpCtx.textBaseline=`alphabetic`;let t=this._tmpCtx.measureText(c);if(this._tmpCtx.restore(),`actualBoundingBoxDescent`in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(n,r-Math.ceil(e/2),this._config.deviceCellWidth*P,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=E.css,this._tmpCtx.strokeText(c,M,M+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(x){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(M,M+t),this._tmpCtx.lineTo(M+this._config.deviceCharWidth*P,M+t),this._tmpCtx.stroke()}if(N||this._tmpCtx.fillText(c,M,M+this._config.deviceCharHeight),c===`_`&&!this._config.allowTransparency){let e=g(this._tmpCtx.getImageData(M,M,this._config.deviceCellWidth,this._config.deviceCellHeight),E,j,F);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(c,M,M+this._config.deviceCharHeight-t),e=g(this._tmpCtx.getImageData(M,M,this._config.deviceCellWidth,this._config.deviceCellHeight),E,j,F),e);t++);}if(b){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(M,M+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(M+this._config.deviceCharWidth*P,M+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let I=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),L;if(L=this._config.allowTransparency?function(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}(I):g(I,E,j,F),L)return f;let R=this._findGlyphBoundingBox(I,this._workBoundingBox,l,A,N,M),z,B;for(;;){if(this._activePages.length===0){let e=this._createNewPage();z=e,B=e.currentRow,B.height=R.size.y;break}z=this._activePages[this._activePages.length-1],B=z.currentRow;for(let e of this._activePages)R.size.y<=e.currentRow.height&&(z=e,B=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=B.height&&R.size.y<=t.height&&(z=this._activePages[e],B=t);if(B.y+R.size.y>=z.canvas.height||B.height>R.size.y+2){let e=!1;if(z.currentRow.y+z.currentRow.height+R.size.y>=z.canvas.height){let t;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+R.size.y<e.canvas.height){t=e;break}if(t)z=t;else if(m.maxAtlasPages&&this._pages.length>=m.maxAtlasPages&&B.y+R.size.y<=z.canvas.height&&B.height>=R.size.y&&B.x+R.size.x<=z.canvas.width)e=!0;else{let t=this._createNewPage();z=t,B=t.currentRow,B.height=R.size.y,e=!0}}e||(z.currentRow.height>0&&z.fixedRows.push(z.currentRow),B={x:0,y:z.currentRow.y+z.currentRow.height,height:R.size.y},z.fixedRows.push(B),z.currentRow={x:0,y:B.y+B.height,height:0})}if(B.x+R.size.x<=z.canvas.width)break;B===z.currentRow?(B.x=0,B.y+=B.height,B.height=0):z.fixedRows.splice(z.fixedRows.indexOf(B),1)}return R.texturePage=this._pages.indexOf(z),R.texturePosition.x=B.x,R.texturePosition.y=B.y,R.texturePositionClipSpace.x=B.x/z.canvas.width,R.texturePositionClipSpace.y=B.y/z.canvas.height,R.sizeClipSpace.x/=z.canvas.width,R.sizeClipSpace.y/=z.canvas.height,B.height=Math.max(B.height,R.size.y),B.x+=R.size.x,z.ctx.putImageData(I,R.texturePosition.x-this._workBoundingBox.left,R.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,R.size.x,R.size.y),z.addGlyph(R),z.version++,R}_findGlyphBoundingBox(e,t,n,r,i,a){t.top=0;let o=r?this._config.deviceCellHeight:this._tmpCanvas.height,s=r?this._config.deviceCellWidth:n,c=!1;for(let n=0;n<o;n++){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+4*r+3;if(e.data[i]!==0){t.top=n,c=!0;break}}if(c)break}t.left=0,c=!1;for(let n=0;n<a+s;n++){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+4*n+3;if(e.data[i]!==0){t.left=n,c=!0;break}}if(c)break}t.right=s,c=!1;for(let n=a+s-1;n>=a;n--){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+4*n+3;if(e.data[i]!==0){t.right=n,c=!0;break}}if(c)break}t.bottom=o,c=!1;for(let n=o-1;n>=0;n--){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+4*r+3;if(e.data[i]!==0){t.bottom=n,c=!0;break}}if(c)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+a+(r||i?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+a+(r||i?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=m;class h{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}constructor(e,t,n){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],n)for(let e of n)this._glyphs.push(...e.glyphs),this._usedPixels+=e._usedPixels;this.canvas=_(e,t,t),this.ctx=(0,a.throwIfFalsy)(this.canvas.getContext(`2d`,{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function g(e,t,n,r){let i=t.rgba>>>24,a=t.rgba>>>16&255,o=t.rgba>>>8&255,s=n.rgba>>>24,c=n.rgba>>>16&255,l=n.rgba>>>8&255,u=Math.floor((Math.abs(i-s)+Math.abs(a-c)+Math.abs(o-l))/12),d=!0;for(let t=0;t<e.data.length;t+=4)e.data[t]===i&&e.data[t+1]===a&&e.data[t+2]===o||r&&Math.abs(e.data[t]-i)+Math.abs(e.data[t+1]-a)+Math.abs(e.data[t+2]-o)<u?e.data[t+3]=0:d=!1;return d}function _(e,t,n){let r=e.createElement(`canvas`);return r.width=t,r.height=n,r}},160:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let n=0,r=0,i=0,a=0;var o,s,c,l,u;function d(e){let t=e.toString(16);return t.length<2?`0`+t:t}function f(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:`#00000000`,rgba:0},function(e){e.toCss=function(e,t,n,r){return r===void 0?`#${d(e)}${d(t)}${d(n)}`:`#${d(e)}${d(t)}${d(n)}${d(r)}`},e.toRgba=function(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0},e.toColor=function(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}}(o||(t.channels=o={})),function(e){function t(e,t){return a=Math.round(255*t),[n,r,i]=u.toChannels(e.rgba),{css:o.toCss(n,r,i,a),rgba:o.toRgba(n,r,i,a)}}e.blend=function(e,t){if(a=(255&t.rgba)/255,a===1)return{css:t.css,rgba:t.rgba};let s=t.rgba>>24&255,c=t.rgba>>16&255,l=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,f=e.rgba>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),{css:o.toCss(n,r,i),rgba:o.toRgba(n,r,i)}},e.isOpaque=function(e){return(255&e.rgba)==255},e.ensureContrastRatio=function(e,t,n){let r=u.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[n,r,i]=u.toChannels(t),{css:o.toCss(n,r,i),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return a=255&e.rgba,t(e,a*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(s||(t.color=s={})),function(e){let t,s;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let n=e.getContext(`2d`,{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation=`copy`,s=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),o.toColor(n,r,i);case 5:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),o.toColor(n,r,i,a);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let c=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return n=parseInt(c[1]),r=parseInt(c[2]),i=parseInt(c[3]),a=Math.round(255*(c[5]===void 0?1:parseFloat(c[5]))),o.toColor(n,r,i,a);if(!t||!s||(t.fillStyle=s,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[n,r,i,a]=t.getImageData(0,0,1,1).data,a!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:o.toRgba(n,r,i,a),css:e}}}(c||(t.css=c={})),function(e){function t(e,t,n){let r=e/255,i=t/255,a=n/255;return .2126*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.7152*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)+.0722*(a<=.03928?a/12.92:((a+.055)/1.055)**2.4)}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(l||(t.rgb=l={})),function(e){function t(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(.1*o)),s-=Math.max(0,Math.ceil(.1*s)),c-=Math.max(0,Math.ceil(.1*c)),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}function s(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),s=Math.min(255,s+Math.ceil(.1*(255-s))),c=Math.min(255,c+Math.ceil(.1*(255-c))),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.blend=function(e,t){if(a=(255&t)/255,a===1)return t;let s=t>>24&255,c=t>>16&255,l=t>>8&255,u=e>>24&255,d=e>>16&255,f=e>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),o.toRgba(n,r,i)},e.ensureContrastRatio=function(e,n,r){let i=l.relativeLuminance(e>>8),a=l.relativeLuminance(n>>8);if(f(i,a)<r){if(a<i){let a=t(e,n,r),o=f(i,l.relativeLuminance(a>>8));if(o<r){let t=s(e,n,r);return o>f(i,l.relativeLuminance(t>>8))?a:t}return a}let o=s(e,n,r),c=f(i,l.relativeLuminance(o>>8));if(c<r){let a=t(e,n,r);return c>f(i,l.relativeLuminance(a>>8))?o:a}return o}},e.reduceLuminance=t,e.increaseLuminance=s,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(u||(t.rgba=u={})),t.toPaddedHex=d,t.contrastRatio=f},345:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},859:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}},485:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=n,t.FourKeyMap=class{constructor(){this._data=new n}set(e,t,r,i,a){this._data.get(e,t)||this._data.set(e,t,new n),this._data.get(e,t).set(r,i,a)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}}},399:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<`u`&&`title`in process;let n=t.isNode?`node`:navigator.userAgent,r=t.isNode?`node`:navigator.platform;t.isFirefox=n.includes(`Firefox`),t.isLegacyEdge=n.includes(`Edge`),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.getSafariVersion=function(){if(!t.isSafari)return 0;let e=n.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])},t.isMac=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(r),t.isIpad=r===`iPad`,t.isIphone=r===`iPhone`,t.isWindows=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(r),t.isLinux=r.indexOf(`Linux`)>=0,t.isChromeOS=/\bCrOS\b/.test(n)},385:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let r=n(399);class i{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),n=Math.max(t,n),i=e.timeRemaining(),1.5*n>i)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}}class a extends i{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=a,t.IdleTaskQueue=!r.isNode&&`requestIdleCallback`in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:a,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},147:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new r}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let e=new n;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=n;class r{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=r},782:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;let r=n(133),i=n(855),a=n(147);class o extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=``}static fromCharData(e){let t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,r.stringFromCodePoint)(2097151&this.content):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(e[i.CHAR_DATA_CHAR_INDEX].length===2){let n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},855:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR=``,t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=` `,t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},133:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(a=e[d+2])||128&(o=e[d+3]));)t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=o,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((224&r)==192){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},776:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(859),o=n(97),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:`xterm.js: `)+t,...n)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=l=r([i(0,o.IOptionsService)],l),t.setTraceLogger=function(e){c=e},t.traceCall=function(e,t,n){if(typeof n.value!=`function`)throw Error(`not supported`);let r=n.value;n.value=function(...e){if(c.logLevel!==o.LogLevelEnum.TRACE)return r.apply(this,e);c.trace(`GlyphRenderer#${r.name}(${e.map((e=>JSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},726:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},97:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(726);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.WebglAddon=void 0;let t=n(345),i=n(859),a=n(399),o=n(666),s=n(776);class c extends i.Disposable{constructor(e){if(a.isSafari&&(0,a.getSafariVersion)()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(e){let n=e._core;if(!e.element)return void this.register(n.onWillOpen((()=>this.activate(e))));this._terminal=e;let r=n.coreService,a=n.optionsService,c=n,l=c._renderService,u=c._characterJoinerService,d=c._charSizeService,f=c._coreBrowserService,p=c._decorationService,m=c._logService,h=c._themeService;(0,s.setTraceLogger)(m),this._renderer=this.register(new o.WebglRenderer(e,u,d,f,r,p,a,h,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this.register((0,i.toDisposable)((()=>{let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)})))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}}e.WebglAddon=c})(),r})()))})),yf=gf(),bf=_f(),xf=vf();function Sf(e,t,n=!0){return n?t===`normal`?Math.min(Math.max(0,e),760):Math.min(t===`wide`?1100:1/0,Math.max(0,e-48)):Math.max(0,e)}var Cf=/https?:\/\/[^\s"'<>`─-▟]+/g,wf=/[─-▟|]/,Tf={")":`(`,"]":`[`,"}":`{`};function Ef(e){let t;try{t=new URL(e.trim())}catch{return null}return t.protocol===`http:`||t.protocol===`https:`?t.href:null}function Df(e,t){let n=e[e.length-1],r=t[0];return!!n&&!!r&&n!==` `&&r!==` `&&!wf.test(n)&&!wf.test(r)}function Of(e){for(;;){let t=e[e.length-1];if(`.,;:!?'"`.includes(t))e=e.slice(0,-1);else if(Tf[t]&&e.split(Tf[t]).length<=e.split(t).length-1)e=e.slice(0,-1);else return e}}function kf(e){let t=[];for(let n of e.matchAll(Cf)){let e=Of(n[0]);Ef(e)&&e.length>8&&t.push({start:n.index,end:n.index+e.length,url:e})}return t}function Af(e,t,n=()=>!1){if(!e[t])return[];let r=t=>n(t+1)||Df(e[t],e[t+1]??``),i=t;for(;i>0&&r(i-1);)i--;let a=t;for(;a<e.length-1&&r(a);)a++;let o=[],s=``;for(let t=i;t<=a;t++)o.push(s.length),s+=e[t];let c=e=>{let t=o.length-1;for(;t>0&&o[t]>e;)t--;return{row:i+t,col:e-o[t]}};return kf(s).map(e=>({url:e.url,start:c(e.start),end:c(e.end-1)})).filter(e=>e.start.row<=t&&e.end.row>=t).map(e=>({...e,end:{row:e.end.row,col:e.end.col+1}}))}function jf(e,t){let n=``;for(let r=0;r<t;r++){let t=e?.getCell(r)?.getChars()||` `;n+=t.length===1?t:` `}return n}function Mf(e){let t=e.buffer.active,n=[];for(let r=0;r<t.length;r++)n.push(jf(t.getLine(r),e.cols));return n}var Nf=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),Pf=()=>typeof matchMedia<`u`&&matchMedia(`(hover: hover) and (pointer: fine)`).matches;function Ff(e,t,n){return!t||(n?e.metaKey:e.ctrlKey)}function If(e){let t=Ef(e);if(!t)return!1;let n=new URL(t);return!Pf()&&n.origin===window.location.origin?n.pathname===window.location.pathname&&n.search===window.location.search?window.location.hash=n.hash||`#/`:window.location.assign(t):window.open(t,`_blank`,`noopener,noreferrer`),!0}function Lf(e,t){let n=Nf(),r=Pf(),i=e=>`${e}\n${t(n?`⌘+click to open`:`Ctrl+click to open`)}`,a=!1,o=(e,t)=>{Ff(e,r,n)&&(a=If(t)||a)},s=()=>e.element?.querySelector(`.xterm-screen`),c=(e,t)=>{let n=s();n&&r&&Ef(t)&&(n.title=i(t))},l=()=>{let e=s();e&&e.removeAttribute(`title`)},u={activate:o,hover:c,leave:l,allowNonHttpProtocols:!1};e.options.linkHandler=u;let d=e.registerLinkProvider({provideLinks(t,n){let r=Mf(e),i=e.buffer.active,a=Af(r,t-1,e=>!!i.getLine(e)?.isWrapped);n(a.length?a.map(e=>({text:e.url,range:{start:{x:e.start.col+1,y:e.start.row+1},end:{x:e.end.col,y:e.end.row+1}},activate:t=>o(t,e.url),hover:t=>c(t,e.url),leave:l})):void 0)}});return{tap:(t,n)=>{let r=s();if(!r)return!1;a=!1;let i={bubbles:!0,cancelable:!0,view:window,clientX:t,clientY:n,button:0};for(let e of[`mousemove`,`mousedown`,`mouseup`])r.dispatchEvent(new MouseEvent(e,{...i,bubbles:e!==`mousedown`,buttons:+(e===`mousedown`)}));return e.element?.dispatchEvent(new MouseEvent(`mouseleave`,i)),e.clearSelection(),a},dispose(){d.dispose(),l()}}}function Rf(e){return e.key.toLowerCase()===`c`&&!e.altKey&&(e.metaKey||e.ctrlKey&&e.shiftKey)}function zf(e,t,n){return e.button!==0||!e.shiftKey||e.altKey?null:n?t?{shiftKey:!1,altKey:!0}:null:{shiftKey:!1,altKey:!1}}function Bf(e){return e.replace(/[ \t]+$/gm,``)}function Vf(e,t,n=()=>!1){let r=e.split(`
75
+ `);return r.length===t.length?r.reduce((e,r,i)=>i===0?r:e+(n(i)||Df(t[i-1],t[i])?``:`
76
+ `)+r,``):e}function Hf(e){let t=e.getSelection(),n=e.getSelectionPosition();if(!n)return Bf(t);let r=Math.min(n.start.y,n.end.y),i=Math.max(n.start.y,n.end.y),a=e.buffer.active;return Bf(Vf(t,Mf(e).slice(r,i+1),e=>!!a.getLine(r+e)?.isWrapped))}function Uf(e,t=globalThis.navigator?.clipboard){if(!e||!t?.writeText)return Promise.resolve(!1);try{return t.writeText(e).then(()=>!0,()=>!1)}catch{return Promise.resolve(!1)}}var Wf=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent);function Gf(e,t){let n=e.element;if(!n)return()=>{};let r=Wf(),i=()=>{e.hasSelection()&&Uf(Hf(e)).then(e=>e&&t?.())},a=t=>{Rf(t)&&e.hasSelection()&&(t.preventDefault(),t.stopPropagation(),i())},o=()=>i(),s=t=>{t.button===0&&window.addEventListener(`mouseup`,o,{capture:!0,once:!0});let n=zf(t,r,e.modes.mouseTrackingMode!==`none`);n&&(t.preventDefault(),t.stopImmediatePropagation(),t.target?.dispatchEvent(new MouseEvent(`mousedown`,{bubbles:!0,cancelable:!0,composed:!0,view:window,detail:t.detail,clientX:t.clientX,clientY:t.clientY,screenX:t.screenX,screenY:t.screenY,button:t.button,buttons:t.buttons,ctrlKey:t.ctrlKey,metaKey:t.metaKey,...n})))};return n.addEventListener(`keydown`,a,!0),n.addEventListener(`mousedown`,s,!0),()=>{window.removeEventListener(`mouseup`,o,{capture:!0}),n.removeEventListener(`keydown`,a,!0),n.removeEventListener(`mousedown`,s,!0)}}function Kf(e=globalThis.navigator){let t=e?.userAgentData?.platform||e?.platform||``;return/^(mac|iphone|ipad|ipod|ios)/i.test(t)}function qf(e){let t=e.key.toLowerCase();return t===`v`||e.code===`KeyV`&&!/^[a-z]$/.test(t)}function Jf(e,t){if(e.isComposing)return`xterm`;let n=e.ctrlKey||e.altKey||e.metaKey;return e.key===`Enter`&&!e.shiftKey&&!e.altKey&&(e.ctrlKey&&!e.metaKey||t&&e.metaKey&&!e.ctrlKey)?`ctrl+enter`:e.key===`Enter`&&e.shiftKey&&!n?`shift+enter`:e.key===`F12`&&!e.shiftKey&&!n||!t&&e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&qf(e)?`browser`:`xterm`}function Yf(e,t,n=Kf()){e.attachCustomKeyEventHandler(e=>{let r=Jf(e,n);return r===`xterm`||((r===`shift+enter`||r===`ctrl+enter`)&&e.type===`keydown`&&(e.preventDefault(),t(r)),!1)})}function Xf(e){return!e||e.getData(`text/plain`)?[]:[...e.items||[]].filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(e=>!!e)}function Zf(e,t){async function n(e){let n=[];for(let r of e)try{n.push(await t.upload(r))}catch(e){t.report(`${Q(`Photo upload failed`)} : ${e.message}`)}n.length&&!t.paste(n.join(` `))&&t.report(Q(`Terminal not connected — image not pasted`))}let r=e=>{let r=Xf(e.clipboardData);!r.length||t.enabled&&!t.enabled()||(e.preventDefault(),e.stopPropagation(),n(r))};return e.addEventListener(`paste`,r,!0),()=>e.removeEventListener(`paste`,r,!0)}var Qf=1e5,$f=/^[cpqs0-7]*$/,ep=/^[A-Za-z0-9+/]*={0,2}$/;function tp(e){let t=e.endsWith(`==`)?2:+!!e.endsWith(`=`);return Math.floor(e.length*3/4)-t}function np(e,t=Qf){let n=e.indexOf(`;`);if(n<0||!$f.test(e.slice(0,n)))return{kind:`invalid`};let r=e.slice(n+1).replace(/\s+/g,``);if(r===`?`)return{kind:`read`};if(!r||r.length%4==1||!ep.test(r))return{kind:`invalid`};let i=tp(r);if(i>t)return{kind:`too-large`,bytes:i};let a;try{a=atob(r)}catch{return{kind:`invalid`}}let o=new TextDecoder().decode(Uint8Array.from(a,e=>e.charCodeAt(0)));return o?{kind:`write`,text:o}:{kind:`invalid`}}async function rp(e,t,n){try{if(!t)throw Error(`no clipboard`);return await t.writeText(e),n.copied(),!0}catch{return n.refused(e),!1}}function ip(e,t){let n=e.parser.registerOscHandler(52,e=>{if(!t.enabled())return!0;let n=np(e,t.maxBytes);return n.kind===`write`?t.write(n.text):n.kind===`too-large`&&t.tooLarge(n.bytes),!0});return()=>n.dispose()}async function ap(e){let t=URL.createObjectURL(e);try{let e=await new Promise((e,n)=>{let r=new Image;r.onload=()=>e(r),r.onerror=n,r.src=t}),n=Math.min(1,2048/Math.max(e.naturalWidth,e.naturalHeight)),r=document.createElement(`canvas`);r.width=Math.round(e.naturalWidth*n),r.height=Math.round(e.naturalHeight*n);let i=r.getContext(`2d`);i.fillStyle=`#fff`,i.fillRect(0,0,r.width,r.height),i.drawImage(e,0,0,r.width,r.height);let a=await new Promise(e=>r.toBlob(e,`image/jpeg`,.86));if(a)return a}catch{}finally{URL.revokeObjectURL(t)}return e}async function op(e,t){let n=await ap(t),r=await fetch(`/api/upload?pane=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":n.type||`image/jpeg`},body:n}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(Q(i.error||`HTTP ${r.status}`));return{path:i.path,name:i.name}}function sp(e){return e.code===`unreachable`?Z(`${e.machine||`Machine`} unreachable`,`${e.machine||`Machine`} injoignable`):e.code===`unknown_machine`?Z(`unknown machine`,`machine inconnue`):Q(e.reason||``)}function cp(e){return e?Z(`Terminal unavailable: ${e}`,`Terminal indisponible : ${e}`):Q(`Terminal unavailable`)}function lp(e,t,n,r,i){return n.width<=0||n.height<=0||r<=0||i<=0?null:{column:Math.max(0,Math.min(r-1,Math.floor((e-n.left)*r/n.width))),row:Math.max(0,Math.min(i-1,Math.floor((t-n.top)*i/n.height)))}}function up(e,t,n){let r=e.element,i=null,a=null,o=null,s=0,c=(t,n)=>{let i=r.querySelector(`.xterm-screen`)?.getBoundingClientRect();return i?lp(t,n,i,e.cols,e.rows):null},l=(e,t,n)=>{let r=c(e.clientX,e.clientY);return r&&{type:`terminal.mouse`,action:t,button:n,...r,modifiers:+!!e.shiftKey|(e.ctrlKey?2:0)|(e.altKey?4:0)|(e.metaKey?8:0)}},u=()=>{cancelAnimationFrame(s),s=0,o&&t()&&n(o),o=null},d=r=>{if(!t()||r.pointerType===`touch`||r.shiftKey||r.ctrlKey||r.metaKey||r.button>2)return;let o=[`left`,`middle`,`right`][r.button],s=l(r,`down`,o);s&&(r.preventDefault(),r.stopPropagation(),i=o,a=r.pointerId,e.clearSelection(),e.focus(),n(s))},f=e=>{!t()||e.pointerType===`touch`||e.shiftKey||e.ctrlKey||e.metaKey||(i?e.pointerId!==a:!r.contains(e.target))||(o=l(e,i?`drag`:`move`,i||`left`),s||=requestAnimationFrame(u))},p=e=>{if(!i||e.pointerId!==a)return;u();let r=l(e,`up`,i);i=null,a=null,r&&t()&&n(r)},m=e=>{t()&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&e.preventDefault()};return r.addEventListener(`contextmenu`,m),r.addEventListener(`pointerdown`,d,!0),window.addEventListener(`pointermove`,f,!0),window.addEventListener(`pointerup`,p,!0),window.addEventListener(`pointercancel`,p,!0),{tap(e,r){let i=t()&&c(e,r);if(i)for(let e of[`down`,`up`])n({type:`terminal.mouse`,action:e,button:`left`,...i,modifiers:0})},dispose(){cancelAnimationFrame(s),r.removeEventListener(`contextmenu`,m),r.removeEventListener(`pointerdown`,d,!0),window.removeEventListener(`pointermove`,f,!0),window.removeEventListener(`pointerup`,p,!0),window.removeEventListener(`pointercancel`,p,!0)}}}var dp=`"Wherdr Symbols", "JetBrains Mono Variable", "JetBrains Mono", "Wherdr Nerd Symbols", ui-monospace, "SF Mono", Menlo, monospace`;function fp(e){let t=typeof document<`u`?document.fonts:void 0;return t?.addEventListener?(t.addEventListener(`loadingdone`,e),()=>t.removeEventListener(`loadingdone`,e)):()=>{}}function pp(e,t){let n=null,r=null,i=null,a=null,o=null,s=0,c,l=!1,u={cols:0,rows:0},d=!1,f=h(!1),p=h(!1),m=h(0),g=h(0),_=h(0),v=0,y=h([]),b=h(``),x=Xd(),S=e=>{y.value=Kd(y.value,e)},C=()=>{y.value=[]},w=hf(),T=null,E=null,D=null,O=null,k=null,A=null,j=!1,M=()=>`${location.protocol===`https:`?`wss`:`ws`}://${location.host}`;function N(i){a=i,i.addEventListener(`paste`,C,!0),d=!1,s=0,n=new yf.Terminal({fontFamily:dp,fontSize:gr.value,lineHeight:1,scrollback:0,cursorBlink:!1,allowProposedApi:!0,macOptionIsMeta:!0,macOptionClickForcesSelection:!0,theme:Ce.value}),r=new bf.FitAddon,n.loadAddon(r),n.open(i),A=up(n,()=>j&&t.input?.()!==!1,e=>R(e)),T=Gf(n,()=>X(Q(`Copied`))),k=Lf(n,Q),E=Zf(i,{upload:async t=>(await op(e,t)).path,paste:e=>R({type:`paste`,text:e}),report:e=>X(e,!0)}),D=ip(n,{enabled:()=>Mi.value,write:e=>rp(e,navigator.clipboard,{copied:()=>X(Q(`The agent copied text`)),refused:e=>hr(Q(`The agent copied text — tap to copy`),Q(`Copy`),()=>{rp(e,navigator.clipboard,{copied:()=>X(Q(`Copied`)),refused:()=>X(Q(`Copy failed`),!0)})})}),tooLarge:e=>X(Z(`Agent copy ignored: ${Js(e)} (limit ${Js(Qf)})`,`Copie de l’agent ignorée : ${Js(e)} (limite ${Js(Qf)})`))}),ee(Ur.value);let o=n;Promise.all([document.fonts?.load(`${gr.value}px "JetBrains Mono Variable"`),document.fonts?.load(`${gr.value}px "Wherdr Symbols"`,`─▀█⎿⏵⏺✻✳`)]).then(()=>{d||n!==o||(o.options.fontFamily=dp,H(!0),o.refresh(0,o.rows-1))}).catch(()=>{}),O=fp(()=>{d||n!==o||(o.clearTextureAtlas(),o.refresh(0,o.rows-1))});let c=n.textarea;c&&(c.setAttribute(`autocorrect`,`off`),c.setAttribute(`autocapitalize`,`off`),c.setAttribute(`spellcheck`,`false`),c.addEventListener(`blur`,()=>{p.value=!1}),c.addEventListener(`focus`,()=>{p.value=!0}),c.addEventListener(`compositionstart`,x.start),c.addEventListener(`compositionend`,x.end)),n.element?.addEventListener(`keydown`,x.keydown,!0),n.attachCustomWheelEventHandler(()=>!1),Yf(n,e=>V(e)),n.onData(e=>{if(t.input?.()!==!1){if(x.active||x.takeEnded()){C(),R({type:`terminal.input`,text:e});return}if(y.value.length){let t=Yd(e);if(t){V(t);return}C()}R({type:`terminal.input`,text:e})}}),n.onBinary(e=>{if(t.input?.()===!1)return;let n=Uint8Array.from(e,e=>e.charCodeAt(0)&255);R({type:`terminal.input`,bytes:Xr(n)})})}let F=Pr(()=>o),I,L;z($i,()=>{document.hidden||!l||d||t.hasBanner()||(K()?F.recover(()=>{!d&&l&&!document.hidden&&!t.hasBanner()&&W(!1)}):W(!1))});function R(e){return e?.type===`paste`&&C(),ui.value&&[`terminal.input`,`paste`].includes(e?.type||``)&&(m.value++,se()),o&&o.readyState===1?(o.send(JSON.stringify(e)),!0):!1}async function B(t){if(ui.value&&(m.value++,se()),!R({type:`keys`,keys:t}))try{await xi(`/api/input`,{pane_id:e,keys:t}),$()}catch(e){X(e.message,!0)}}async function V(e){if(t.input?.()===!1)return;let n=qd(e,y.value);C(),b.value=n;let r=Qd(n);if(r){R({type:`terminal.input`,text:r})||await B($d(n));return}await B([n])}function H(e){if(!n||!r||!a||!a.parentElement)return;let i=matchMedia(Yi).matches&&!t.fill?.();a.style.width=i?`${Sf(a.parentElement.clientWidth,ii.value)}px`:``;let o=r.proposeDimensions();if(!o||!o.cols||!o.rows)return;let s={cols:o.cols,rows:o.rows};(s.cols!==n.cols||s.rows!==n.rows)&&n.resize(s.cols,s.rows),e&&(s.cols!==u.cols||s.rows!==u.rows)&&R({type:`terminal.resize`,cols:s.cols,rows:s.rows})&&(u={cols:s.cols,rows:s.rows})}z(Ce,e=>{n&&(n.options.theme=e)}),z(ii,()=>P(()=>H(!0)));function ee(e){if(n){if(i){let e=i;i=null,e.dispose()}if(e===`webgl`){let e=null;try{e=new xf.WebglAddon;let t=e;e.onContextLoss(()=>{i===t&&(i=null,t.dispose(),pi(`html-fallback`),H(!0))}),n.loadAddon(e),yi(e),i=e,pi(`webgl`)}catch{try{e?.dispose()}catch{}pi(`html-fallback`)}}else pi(`html`);H(!0)}}z(Ur,ee);function U(e){n&&(n.options.fontSize=e,H(!0))}function W(r){if(d||!n)return;if(clearTimeout(c),clearTimeout(I),clearTimeout(L),F.cancel(),o){o.onclose=null;try{o.close(1e3)}catch{}}H(!1);let i=new URLSearchParams({pane:e,cols:String(n.cols),rows:String(n.rows)});r&&i.set(`takeover`,`1`),j=!1,f.value=!0,l=!0;let a=null,p=!1,h=``;v++,ui.value&&m.value++;let y=new WebSocket(`${M()}/ws/term?${i}`);o=y,I=setTimeout(()=>{if(o===y&&y.readyState===0)try{y.close()}catch{}},6e3),y.onopen=()=>{o===y&&(clearTimeout(I),L=setTimeout(()=>{if(!(o!==y||p)){h||=`no terminal frame`;try{y.close()}catch{}}},12e3),n&&(u={cols:n.cols,rows:n.rows}),y.send(JSON.stringify({type:`visibility`,visible:!document.hidden})))},y.onmessage=e=>{if(o!==y)return;let t;try{t=JSON.parse(e.data)}catch{return}if(t.type===`web.capabilities`)j=t.mouse===!0;else if(t.type===`terminal.frame`){if(p||(p=!0,s=0,clearTimeout(L)),f.value=!1,!n)return;t.width&&t.height&&(t.width!==n.cols||t.height!==n.rows)&&(ui.value&&(m.value++,se()),n.resize(t.width,t.height));let e=n;e.write($r(t.bytes||``),()=>{w.refresh(e,j),ui.value&&g.value++})}else if(t.type===`scroll.ack`){if(ui.value&&t.epoch===v&&Number.isFinite(t.lines)&&n){let e=v;n.write(``,()=>{e===v&&ui.value&&(_.value+=t.lines)})}}else t.type===`pong`?F.pong(y):t.type===`terminal.closed`?a=sp(t):t.type===`herdr.stderr`?/^run 'herdr --help'/.test(t.message)||(h=t.message):t.type===`web.error`&&X(t.message,!0)},y.onclose=()=>{if(o===y&&(ui.value&&(m.value++,v++),clearTimeout(I),clearTimeout(L),o=null,j=!1,f.value=!1,F.cancel(),l&&!d)){if(a&&/already has an attached client/.test(a))return t.setBanner({text:Q(`This terminal is already open elsewhere.`),btn:Q(`Take control`),fn:()=>{t.setBanner(null),W(!0)}});if(a&&/taken over/.test(a))return t.setBanner({text:Q(`Another client took control.`),btn:Q(`Take back control`),fn:()=>{t.setBanner(null),W(!0)}});if((ea.value||!Mr.value.ok)&&!document.hidden){if(!p&&s>=3&&(h||a)){s=0;let e=h||a;return t.setBanner({text:cp(e),btn:Q(`Retry`),fn:()=>{t.setBanner(null),W(!1)}})}c=setTimeout(()=>W(!1),Math.min(6e3,400*2**s++))}}}}function G(){if(C(),ui.value&&(m.value++,v++),j=!1,l=!1,clearTimeout(c),clearTimeout(I),clearTimeout(L),F.cancel(),o){let e=o;o=null;try{e.close(1e3)}catch{}}}let K=()=>!!(o&&o.readyState<=1);function te(){n?.reset()}function ne(){n?.focus(),p.value=!0}function q(){n?.textarea?.blur()}let re=(e,t)=>k?.tap(e,t)??!1,ie=()=>!!(n&&document.activeElement===n.textarea),ae=()=>{if(!ui.value)return n&&n.rows&&a?a.clientHeight/n.rows:16;let e=a?.querySelector(`.xterm-screen`);return n?.rows&&e?.clientHeight?e.clientHeight/n.rows:16},J=()=>n?.rows||24;function oe(e,t,r,i=0,a=!1,o=!0){if(!ui.value||!a)return R({type:`terminal.scroll`,direction:e>0?`up`:`down`,lines:Math.abs(e)});let s=n?.element?.querySelector(`.xterm-screen`),c=s?.getBoundingClientRect(),l=s?.style.transform?new DOMMatrixReadOnly(s.style.transform).m42:0,u=c?{left:c.left,top:c.top-l,width:c.width,height:c.height}:null,d=u&&n&&t!==void 0&&r!==void 0?lp(t,r,u,n.cols,n.rows):null;return R({type:`terminal.scroll`,direction:e>0?`up`:`down`,lines:Math.abs(e),...d,modifiers:i,source:`touch`,epoch:v,preview:o})}function se(){v++,ui.value&&R({type:`touch.cancel`})}let ce=z(ui,(e,t)=>{v++,m.value++,t&&R({type:`touch.cancel`,disabled:!0})},{flush:`sync`});function le(e){!e&&ui.value&&(m.value++,se()),R({type:`visibility`,visible:e}),e&&P(()=>H(!0))}function ue(){a?.removeEventListener(`paste`,C,!0),d=!0,ce(),G(),T?.(),E?.(),D?.(),D=null,O?.(),O=null,T=null,E=null,A?.dispose(),A=null,k?.dispose(),k=null,i=null,n?.dispose(),n=null}return{mount:N,connect:W,disconnect:G,isConnected:K,sendTerm:R,sendKeys:B,fitNow:H,setFontSize:U,reset:te,scroll:oe,focus:ne,blur:q,tapLink:re,tapMouse:(e,t)=>A?.tap(e,t),hasFocus:ie,rowHeight:ae,pageRows:J,setVisible:le,dispose:ue,loading:f,kbdOn:p,hasBanner:t.hasBanner,selectionHint:w,cancelTouchScroll:se,scrollInputVersion:m,frameTick:g,scrollAck:_,virtualModifiers:y,lastVirtualChord:b,toggleModifier:S,toggleVirtualModifier:S,clearVirtualModifiers:C,sendVirtualKey:V}}var mp={key:0},hp={class:`interactive-terminal-note`},gp={key:0,class:`term-banner`},_p=Object.assign(T({__name:`InteractiveTerminal`,props:{paneId:{},active:{type:Boolean},title:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=u(null),o=pp(n.paneId,{setBanner:e=>{i.value=e},hasBanner:()=>!!i.value,fill:()=>!0,input:()=>n.active});z(ti,e=>o.setVisible(e));let s=!1;function c(){if(!s||!Xi.value||o.hasFocus())return;let e=document.activeElement;e instanceof HTMLElement&&e.closest(`.interactive-terminal`)&&e.matches(`button, input, textarea`)||o.focus()}function l(e){e.preventDefault(),s=!0,e.currentTarget?.focus(),setTimeout(c,50)}z(()=>o.loading.value,e=>{e||P(c)});let d={onOpenAutoFocus:l,onEscapeKeyDown:e=>e.preventDefault()},p={overlay:`hw-scrim interactive-terminal-scrim`,content:`interactive-terminal`};return(t,n)=>{let s=Qe,c=bt,l=Vd,u=df,h=on;return _(),m(h,{open:``,title:(`tl`in t?t.tl:f(Z))(`Interactive terminal`,`Terminal interactif`),content:d,ui:p,"onUpdate:open":n[5]||=e=>e||r(`close`)},{content:V(()=>[F(`header`,{class:`interactive-terminal-head`,onKeydown:n[1]||=re(()=>{},[`stop`])},[F(`span`,null,[E(s,{name:`i-lucide-square-terminal`}),a(M((`tl`in t?t.tl:f(Z))(`Interactive terminal`,`Terminal interactif`)),1),e.title?(_(),v(`small`,mp,M(e.title),1)):g(``,!0)]),E(c,{icon:`i-lucide-x`,color:`neutral`,variant:`ghost`,"aria-label":(`tl`in t?t.tl:f(Z))(`Close terminal window`,`Fermer la fenêtre terminal`),onClick:n[0]||=e=>r(`close`)},null,8,[`aria-label`])],32),F(`p`,hp,M((`tl`in t?t.tl:f(Z))(`Live agent screen · closes when the message field returns`,`Écran réel de l’agent · se ferme au retour du champ libre`)),1),f(i)?(_(),v(`div`,gp,[F(`span`,null,M(f(i).text),1),E(c,{size:`xs`,color:`warning`,variant:`outline`,onClick:n[2]||=e=>f(i).fn()},{default:V(()=>[a(M(f(i).btn),1)]),_:1})])):g(``,!0),E(l,{ctl:f(o),onKeydown:n[3]||=re(()=>{},[`stop`])},null,8,[`ctl`]),E(u,{ctl:f(o),"all-digits":``,onKeydown:n[4]||=re(()=>{},[`stop`])},null,8,[`ctl`])]),_:1},8,[`title`])}}}),{__name:`InteractiveTerminal`}),vp={class:`prompt-detail-head`},yp={class:`prompt-detail-tool`},bp={key:0,class:`prompt-detail-desc`},xp={key:0,class:`prompt-detail-file`},Sp={class:`path`},Cp={key:0,class:`prompt-detail-stats`},wp={key:0,class:`add`},Tp={key:1,class:`del`},Ep={key:2,class:`prompt-detail-note`},Dp=Object.assign(T({__name:`PromptDetailBlock`,props:{detail:{}},setup(e){let t=e,r=h(!1);z(()=>t.detail.command,()=>{r.value=!1});let i=n(()=>(t.detail.command||``).split(`
77
+ `)),o=n(()=>i.value.length>8||(t.detail.command||``).length>800),s=n(()=>rn(t.detail));return(t,n)=>{let c=Qe;return _(),v(`div`,{class:j([`prompt-detail`,{file:e.detail.file}])},[F(`p`,vp,[F(`span`,yp,M(e.detail.tool),1),e.detail.description?(_(),v(`span`,bp,M(e.detail.description),1)):g(``,!0)]),e.detail.file?(_(),v(`p`,xp,[E(c,{name:`i-lucide-file-pen`}),F(`span`,Sp,M(e.detail.file),1),f(s)?(_(),v(`span`,Cp,[e.detail.added?(_(),v(`span`,wp,`+`+M(e.detail.added),1)):g(``,!0),e.detail.removed?(_(),v(`span`,Tp,`−`+M(e.detail.removed),1)):g(``,!0)])):g(``,!0)])):g(``,!0),e.detail.command?(_(),v(`pre`,{key:1,class:j([`prompt-detail-code`,{collapsed:f(o)&&!f(r)}])},[F(`code`,null,[(_(!0),v(k,null,y(f(i),(n,r)=>(_(),v(`span`,{key:r,class:j((`diffKind`in t?t.diffKind:f(cn))(n,!!e.detail.file))},M(n),3))),128))])],2)):g(``,!0),e.detail.truncated?(_(),v(`p`,Ep,M((`t`in t?t.t:f(Q))(`Too long: only the beginning is shown. The terminal shows the rest.`)),1)):g(``,!0),f(o)?(_(),v(`button`,{key:3,type:`button`,class:`prompt-detail-more`,onClick:n[0]||=e=>r.value=!f(r)},[E(c,{name:f(r)?`i-lucide-chevron-up`:`i-lucide-chevron-down`},null,8,[`name`]),a(` `+M(f(r)?(`t`in t?t.t:f(Q))(`Collapse`):(`tl`in t?t.tl:f(Z))(`Show all (${f(i).length} lines)`,`Tout afficher (${f(i).length} lignes)`)),1)])):g(``,!0)],2)}}}),{__name:`PromptDetailBlock`}),Op={class:`eyebrow choices-eyebrow`},kp=[`aria-label`],Ap=[`aria-current`,`disabled`,`onClick`],jp={key:2,class:`choices-q`},Mp={key:3,class:`choices-note`,role:`status`},Np={key:4,class:`choices-note`},Pp=[`aria-pressed`,`aria-expanded`,`disabled`,`onClick`],Fp={key:0,class:`n`},Ip={key:1,class:`n`},Lp={class:`l`},Rp={key:0},zp=[`onSubmit`],Bp={class:`choices-free-actions`},Vp=[`disabled`],Hp={key:7,class:`choices-keys`},Up=[`disabled`],Wp=[`disabled`,`onClick`],Gp={key:1,class:`card-kbd`,"aria-hidden":`true`},Kp={key:0},qp=Object.assign(T({__name:`ChoicesPanel`,props:{paneId:{},prompt:{},screen:{},keys:{type:Boolean}},setup(e){let t=e,r=h(!1),i=h(t.prompt?.cursor),o=0;z(()=>t.prompt,(e,t)=>{o&&e&&t&&e.cursor===t.cursor&&e.identity===t.identity||(i.value=e?.cursor)}),z(()=>[t.prompt,t.screen],()=>{r.value=!1});let s=n(()=>t.screen?t.screen.actions.filter(e=>!(t.prompt&&e.key===`enter`)):[]),c=n(()=>t.screen?Ir(t.screen.kind):null),l=n(()=>!!(t.screen&&t.screen.lines.some(e=>/\S {3,}\S/.test(e)))),u=n(()=>t.prompt?.kind===`self-update`?Q(t.prompt.question||``):t.screen&&t.screen.title||t.prompt&&t.prompt.question);async function d(e,n){r.value=!0,await Pe(t.paneId,e,n,t.prompt?.identity)||(r.value=!1)}async function p(e){r.value=!0,await Ie(t.paneId,e,t.screen?.identity)||(r.value=!1)}let b=n(()=>t.prompt?.kind===`self-update`);async function x(){r.value=!0,await _t(t.paneId)||(r.value=!1)}async function S(){r.value=!0,await Re(t.paneId,`enter`,t.prompt?.identity)||(r.value=!1)}let C=n(()=>!!(t.prompt&&t.prompt.options.some(e=>e.checked===void 0))),w=n(()=>t.prompt&&t.prompt.tabs&&t.prompt.tab!==void 0&&!t.prompt.typing?t.prompt.tabs:null);async function T(e){let n=t.prompt;n&&n.tabs&&e!==n.tab&&!B.value&&(r.value=!0,await _e(t.paneId,e,n.tabs[e])?O.value=``:r.value=!1)}let D=h(null),O=h(``),A=h(!1),N=n(()=>t.prompt?.typing?t.prompt.options.findIndex(e=>e.free):D.value);z(()=>t.prompt?.question,()=>{D.value=null});let P=n(()=>Xi.value&&!Si&&!Hi);async function I(e,n){let i=O.value.trim();if(!(!i||B.value||A.value)){r.value=!0,A.value=!0;try{await Pe(t.paneId,e,n,t.prompt?.identity,{text:i,question:t.prompt?.question??null})?(O.value=``,D.value=null):r.value=!1}finally{A.value=!1}}}function L(){t.prompt?.typing?Re(t.paneId,`esc`):D.value=null}function R(e,t,n){e.isComposing||e.keyCode===229||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),L()):e.key===`Enter`&&!e.shiftKey&&P.value&&(e.preventDefault(),I(t,n)))}let B=n(()=>r.value||t.prompt?.unavailable||t.screen?.unavailable||!Hr.value||Qr.value),H=n(()=>!!(t.keys&&Xi.value&&t.prompt&&!t.prompt.kind&&t.prompt.options.length&&N.value===null&&!B.value));return Hn(()=>H.value,()=>({digits:Math.min(9,t.prompt?.options.length||0),enter:!0,tabs:!!w.value}),e=>{let n=t.prompt;if(n){if(e.kind===`digit`){let t=n.options[e.n-1];t.free?D.value=e.n-1:d(e.n-1,t.label);return}if(e.kind===`tab`)return Re(t.paneId,e.dir>0?`right`:`left`);e.kind===`nav`&&((e.key===`up`||e.key===`down`)&&i.value!==null&&i.value!==void 0&&(i.value=Math.max(0,Math.min(n.options.length-1,i.value+(e.key===`down`?1:-1)))),o++,Re(t.paneId,e.key,n.identity).then(e=>{o--,e||(i.value=t.prompt?.cursor)}))}}),(t,n)=>{let r=Dp,o=Qe,h=Tn,P=bt;return _(),v(`div`,{class:j([`choices`,{"choices-screen":e.screen}])},[F(`p`,Op,[n[1]||=F(`i`,null,null,-1),a(M((`t`in t?t.t:f(Q))(`Your turn`)),1)]),f(w)?(_(),v(`div`,{key:0,class:`choices-tabs`,role:`group`,"aria-label":(`t`in t?t.t:f(Q))(`Questions`)},[(_(!0),v(k,null,y(f(w),(t,n)=>(_(),v(`button`,{key:n,type:`button`,class:j({on:n===e.prompt.tab}),"aria-current":n===e.prompt.tab?`step`:void 0,disabled:f(B),onClick:e=>T(n)},M(t),11,Ap))),128))],8,kp)):g(``,!0),e.prompt?.detail?(_(),m(r,{key:1,detail:e.prompt.detail},null,8,[`detail`])):g(``,!0),f(u)?(_(),v(`p`,jp,M(f(u)),1)):g(``,!0),e.prompt?.unavailable||e.screen?.unavailable?(_(),v(`p`,Mp,M((`tl`in t?t.tl:f(Z))(`Screen read failed. Retrying…`,`Lecture de l’écran impossible. Nouvelle tentative…`)),1)):g(``,!0),f(c)?(_(),v(`p`,Np,M(f(c)),1)):g(``,!0),e.screen&&e.screen.lines.length&&!e.prompt?.detail?(_(),v(`pre`,{key:5,class:j([`choices-screen-text`,{wrap:!f(l)}])},M(e.screen.lines.join(`
78
+ `)),3)):g(``,!0),e.prompt?(_(),v(`div`,{key:6,class:j([`choices-list`,{multi:e.prompt.multi}])},[(_(!0),v(k,null,y(e.prompt.options,(r,s)=>(_(),v(k,{key:s},[F(`button`,{type:`button`,class:j({cur:s===f(i),on:r.checked}),"aria-pressed":e.prompt.multi&&!r.free?!!r.checked:void 0,"aria-expanded":r.free?f(N)===s:void 0,disabled:f(B),onClick:t=>r.free?D.value=e.prompt.typing||f(D)===s?null:s:d(s,r.label)},[e.prompt.multi&&r.checked!==void 0?(_(),v(`span`,Fp,[E(o,{name:r.checked?`i-lucide-square-check`:`i-lucide-square`},null,8,[`name`])])):(_(),v(`span`,Ip,M(s+1),1)),F(`span`,Lp,[a(M(e.prompt.kind===`self-update`?(`t`in t?t.t:f(Q))(r.label):r.label),1),r.hint?(_(),v(`small`,Rp,M(e.prompt.kind===`self-update`?(`t`in t?t.t:f(Q))(r.hint):r.hint),1)):g(``,!0)]),r.free?(_(),m(o,{key:2,name:`i-lucide-pencil-line`,class:`choices-free-icon`})):g(``,!0)],10,Pp),r.free&&f(N)===s?(_(),v(`form`,{key:0,class:`choices-free`,onSubmit:re(e=>I(s,r.label),[`prevent`])},[E(h,{modelValue:f(O),"onUpdate:modelValue":n[0]||=e=>U(O)?O.value=e:null,rows:1,maxrows:6,autoresize:``,autofocus:!e.prompt.typing,size:`lg`,class:`w-full`,placeholder:(`t`in t?t.t:f(Q))(`Your answer…`),disabled:f(B)||f(A),onKeydown:e=>R(e,s,r.label)},null,8,[`modelValue`,`autofocus`,`placeholder`,`disabled`,`onKeydown`]),F(`div`,Bp,[E(P,{type:`button`,color:`neutral`,variant:`ghost`,size:`sm`,disabled:f(B)||f(A),onClick:L},{default:V(()=>[a(M((`t`in t?t.t:f(Q))(`Cancel`)),1)]),_:1},8,[`disabled`]),E(P,{type:`submit`,color:`primary`,variant:`solid`,size:`sm`,loading:f(A),disabled:f(B)||f(A)||!f(O).trim()},{default:V(()=>[a(M((`t`in t?t.t:f(Q))(`Send`)),1)]),_:1},8,[`loading`,`disabled`])])],40,zp)):g(``,!0)],64))),128)),e.prompt.multi&&!f(C)?(_(),v(`button`,{key:0,type:`button`,class:`choices-next`,disabled:f(B),onClick:S},[a(M((`t`in t?t.t:f(Q))(`Continue`)),1),F(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(jr))(`enter`)),1)],8,Vp)):g(``,!0)],2)):g(``,!0),f(s).length||f(H)||f(b)?(_(),v(`div`,Hp,[f(b)?(_(),v(`button`,{key:0,type:`button`,disabled:f(B),onClick:x},M((`t`in t?t.t:f(Q))(`Dismiss`)),9,Up)):g(``,!0),(_(!0),v(k,null,y(f(s),e=>(_(),v(`button`,{key:e.key+e.label,type:`button`,disabled:f(B),onClick:t=>p(e)},[a(M((`screenActionText`in t?t.screenActionText:f(kr))(e)),1),F(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(jr))(e.key)),1)],8,Wp))),128)),f(H)?(_(),v(`span`,Gp,[f(w)?(_(),v(`kbd`,Kp,`←→`)):g(``,!0),n[2]||=F(`kbd`,null,`↑↓`,-1),F(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(jr))(`enter`)),1),F(`kbd`,null,`1–`+M(Math.min(9,e.prompt.options.length)),1)])):g(``,!0)])):g(``,!0)],2)}}}),{__name:`ChoicesPanel`}),Jp={class:`choices choices-menu`},Yp={class:`eyebrow choices-eyebrow`},Xp={class:`menu-kind`},Zp={key:0,class:`choices-note`,role:`status`},Qp={key:1,class:`choices-q`},$p={key:2,class:`choices-note`},em={key:3,class:`choices-note`},tm=[`placeholder`,`aria-label`,`disabled`],nm={key:0,class:`menu-group`},rm=[`aria-current`,`disabled`,`onClick`],im={class:`n`,"aria-hidden":`true`},am={class:`l`},om={key:0},sm={key:0,class:`menu-more`},cm={key:0,class:`choices-screen-text wrap`},lm={class:`choices-note`},um={class:`choices-keys`},dm=[`disabled`,`onClick`],fm={key:0,class:`card-kbd`,"aria-hidden":`true`},pm={key:0},mm=Object.assign(T({__name:`MenuPanel`,props:{paneId:{},menu:{},keys:{type:Boolean}},emits:[`terminal`],setup(e,{emit:t}){let r=e,i=t,o=h(!1),s=h(r.menu.cursor),c=n(()=>s.value===null?r.menu.identity:r.menu.items[s.value]?.identity),l=h(null),u=()=>P(()=>l.value?.querySelector(`.cur`)?.scrollIntoView({block:`nearest`})),d=0;z(()=>r.menu,(e,t)=>{o.value=!1,!(d&&t&&e.cursor===t.cursor&&e.identity===t.identity)&&(s.value=e.cursor,u())}),w(u);let p=n(()=>o.value||r.menu.unavailable||!Hr.value||Qr.value),m=n(()=>ue(r.menu)),b=n(()=>r.menu.actions.filter(e=>!(e.key===`enter`&&r.menu.cursor!==null&&!m.value))),x=n(()=>r.menu.items.length>0);async function S(e,t){o.value=!0,await ve(r.paneId,{op:`select`,index:e,label:t},r.menu.items[e]?.identity)||(o.value=!1)}async function C(e){o.value=!0,await ve(r.paneId,{op:`key`,key:e.key,label:e.label},c.value)||(o.value=!1)}let T=h(r.menu.search||``),D=h(!1);z(()=>r.menu.search,e=>{D.value||(T.value=e||``)});let O=null;function A(){D.value=!0,O&&clearTimeout(O),O=setTimeout(N,450)}async function N(){O&&=(clearTimeout(O),null);let e=T.value;e!==(r.menu.search||``)&&await ve(r.paneId,{op:`search`,text:e},r.menu.identity),D.value=!1}H(()=>{O&&clearTimeout(O)});let L=h(null),R=n(()=>r.menu.actions.some(e=>e.key===`esc`)),B=n(()=>r.menu.actions.filter(e=>/^ctrl\+[a-z]$/.test(e.key)).map(e=>e.key)),V=n(()=>!!(r.keys&&Xi.value&&x.value&&!p.value));return Hn(()=>!!(r.keys&&Xi.value&&!p.value&&(x.value||B.value.length)),()=>({digits:0,enter:!m.value,own:L.value,ctrl:B.value,nav:V.value}),e=>{if(e.kind===`ctrl`){let t=r.menu.actions.find(t=>t.key===e.key);t&&C(t);return}if(!(e.kind!==`nav`||e.key===`esc`&&!R.value)){if(e.key===`up`||e.key===`down`){let t=r.menu.items.map((e,t)=>e.header?-1:t).filter(e=>e>=0),n=t.indexOf(s.value??-1);s.value=t[n+(e.key===`down`?1:-1)]??s.value,u()}d++,Re(r.paneId,e.key,c.value).then(e=>{d--,e||(s.value=r.menu.cursor,u())})}}),(t,n)=>{let r=Qe;return _(),v(`div`,Jp,[F(`p`,Yp,[n[2]||=F(`i`,null,null,-1),a(M((`t`in t?t.t:f(Q))(`Your turn`)),1),F(`span`,Xp,M((`t`in t?t.t:f(Q))(`Interactive menu`)),1)]),e.menu.unavailable?(_(),v(`p`,Zp,M((`tl`in t?t.tl:f(Z))(`Screen read failed. Retrying…`,`Lecture de l’écran impossible. Nouvelle tentative…`)),1)):g(``,!0),e.menu.title?(_(),v(`p`,Qp,M(e.menu.title),1)):g(``,!0),f(x)&&e.menu.lines.length?(_(),v(`p`,$p,M(e.menu.lines[0]),1)):g(``,!0),f(x)&&f(m)?(_(),v(`p`,em,M((`tl`in t?t.tl:f(Z))(`Tap an entry to move the cursor there, then confirm with a button below.`,`Toucher une entrée y place le curseur ; valide ensuite avec un bouton ci-dessous.`)),1)):g(``,!0),e.menu.search===null?g(``,!0):(_(),v(`form`,{key:4,class:`menu-search`,onSubmit:re(N,[`prevent`])},[E(r,{name:`i-lucide-search`,"aria-hidden":`true`}),I(F(`input`,{ref_key:`searchRef`,ref:L,"onUpdate:modelValue":n[0]||=e=>U(T)?T.value=e:null,type:`search`,placeholder:(`t`in t?t.t:f(Q))(`Search…`),"aria-label":(`t`in t?t.t:f(Q))(`Search the menu`),enterkeyhint:`search`,autocomplete:`off`,autocapitalize:`off`,spellcheck:`false`,disabled:f(p),onInput:A},null,40,tm),[[q,f(T)]])],32)),f(x)?(_(),v(`div`,{key:5,ref_key:`listRef`,ref:l,class:`choices-list menu-list`},[(_(!0),v(k,null,y(e.menu.items,(e,t)=>(_(),v(k,{key:t},[e.header?(_(),v(`p`,nm,M(e.label),1)):(_(),v(`button`,{key:1,type:`button`,class:j({cur:t===f(s)}),"aria-current":t===f(s)?`true`:void 0,disabled:f(p),onClick:n=>S(t,e.label)},[F(`span`,im,M(t===f(s)?`❯`:``),1),F(`span`,am,[a(M(e.label),1),e.hint?(_(),v(`small`,om,M(e.hint),1)):g(``,!0)])],10,rm))],64))),128)),e.menu.more?(_(),v(`p`,sm,M(e.menu.more),1)):g(``,!0)],512)):(_(),v(k,{key:6},[e.menu.lines.length?(_(),v(`pre`,cm,M(e.menu.lines.join(`
79
+ `)),1)):g(``,!0),F(`p`,lm,M((`tl`in t?t.tl:f(Z))(`Interactive menu open: pick its entries in the terminal.`,`Menu interactif en cours : ses entrées se choisissent dans le terminal.`)),1)],64)),F(`div`,um,[(_(!0),v(k,null,y(f(b),e=>(_(),v(`button`,{key:e.key+e.label,type:`button`,disabled:f(p),onClick:t=>C(e)},[a(M((`screenActionText`in t?t.screenActionText:f(kr))(e)),1),F(`kbd`,null,M((`screenKeyName`in t?t.screenKeyName:f(jr))(e.key)),1)],8,dm))),128)),f(V)?(_(),v(`span`,fm,[n[3]||=F(`kbd`,null,`↑↓`,-1),f(m)?g(``,!0):(_(),v(`kbd`,pm,M((`screenKeyName`in t?t.screenKeyName:f(jr))(`enter`)),1))])):g(``,!0),F(`button`,{type:`button`,class:`menu-term`,onClick:n[1]||=e=>i(`terminal`)},[E(r,{name:`i-lucide-square-terminal`,"aria-hidden":`true`}),a(M((`t`in t?t.t:f(Q))(`View terminal`)),1)])])])}}}),{__name:`MenuPanel`}),hm={class:`usage-limit-card composer-notice`,role:`status`},gm={class:`restart-text`},_m={key:1},vm=[`disabled`],ym=[`disabled`],bm={key:2,class:`notice-btn`,href:`https://clau.de/reset`,target:`_blank`,rel:`noopener noreferrer`},xm=Object.assign(ia(T({__name:`UsageLimitCard`,props:{limit:{},readOnly:{type:Boolean},sendKeys:{type:Function}},emits:[`credits`],setup(e,{emit:t}){let n=e,r=t,i=h(!1);async function o(){if(!(n.readOnly||i.value)){i.value=!0;try{await n.sendKeys([`esc`])}catch(e){X(e.message,!0)}finally{i.value=!1}}}return(t,n)=>(_(),v(`div`,hm,[F(`span`,gm,[a(M(f(Z)(`Provider quota reached`,`Quota fournisseur atteint`)),1),e.limit.resets?(_(),v(k,{key:0},[a(` · `+M(f(Z)(`Resets`,`Réinitialisation`))+` `+M(e.limit.resets),1)],64)):g(``,!0),e.limit.automatic?(_(),v(`small`,_m,M(f(Z)(`Will continue automatically`,`Reprise automatique`)),1)):g(``,!0)]),e.limit.automatic?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,disabled:e.readOnly||f(i),onClick:o},M(f(Z)(`Cancel wait`,`Annuler l’attente`)),9,vm)):g(``,!0),e.limit.credits?(_(),v(`button`,{key:1,type:`button`,class:`notice-btn`,disabled:e.readOnly||f(i),onClick:n[0]||=e=>r(`credits`)},`/usage-credits`,8,ym)):g(``,!0),e.limit.resetLink?(_(),v(`a`,bm,M(f(Z)(`Reset quota ↗`,`Réinitialiser le quota ↗`)),1)):g(``,!0)]))}}),[[`__scopeId`,`data-v-8c0c9595`]]),{__name:`UsageLimitCard`}),Sm={key:0,class:`composer-notice restart`,role:`status`},Cm={class:`restart-text`},wm={key:1,class:`composer-notice failed`,role:`status`},Tm={class:`restart-text`},Em={key:2,class:`composer-notice`,role:`status`},Dm={class:`restart-text`},Om=[`disabled`,`title`],km={key:3,class:`composer-notice codex-update`,role:`status`},Am=[`title`],jm={key:0,class:`notice-extra`},Mm=[`href`,`aria-label`,`title`],Nm={class:`notice-label`},Pm=[`disabled`,`title`],Fm={key:2,class:`notice-reason`},Im=[`aria-label`,`title`],Lm=[`title`],Rm=[`disabled`,`title`],zm=`wherdr.codexUpdate.dismissed`,Bm=Object.assign(T({__name:`CodexNotices`,props:{pane:{},paneId:{},readOnly:{type:Boolean}},setup(e){let t=e,r=h(``);try{r.value=localStorage.getItem(zm)||``}catch{}let i=n(()=>{let e=t.pane.codexStatus?.update;return!e||e.state===`available`&&!e.job&&e.latest===r.value?null:e}),o=n(()=>t.pane.codexStatus?.weekly||null),s=n(()=>i.value?.job||null),c=n(()=>{let e=Gi(t.pane.id),n=Mr.value.machines?.find(t=>t.key===e);return n&&n.label||Or.value||Q(`This machine`)}),l=n(()=>{let e=i.value;if(!e)return``;let t=Z(`Codex ${e.latest} available`,`Codex ${e.latest} disponible`);return e.current?`${t} ${Z(`(you have ${e.current})`,`(tu as la ${e.current})`)}`:t}),u=n(()=>{let e=o.value;return e?e.lessThan?Z(`Weekly limit: less than ${e.left}% left`,`Limite hebdo : moins de ${e.left} % restants`):Z(`Weekly limit: ${e.left}% left`,`Limite hebdo : ${e.left} % restants`):``});function d(){let e=i.value?.latest;if(e){r.value=e;try{localStorage.setItem(zm,e)}catch{}}}async function p(){let e=i.value?.command;if(e){$();try{await navigator.clipboard.writeText(e),X(Z(`Command copied: paste it into a terminal on ${c.value}.`,`Commande copiée : colle-la dans un terminal sur ${c.value}.`))}catch{X(Q(`Copy failed`),!0)}}}let m=n(()=>{if(i.value?.method!==`terminal`)return``;let e=t.pane.status;return e===`working`?Z(`Codex is working: update it once it is done`,`Codex travaille : mets-le à jour quand il a fini`):e===`blocked`?Z(`Codex is waiting for an answer: answer it first`,`Codex attend une réponse : réponds-lui d’abord`):``});async function y(){let e=i.value;if(e&&e.runnable&&e.command&&!m.value&&(e.method===`terminal`?await Je([Z(`Update Codex to ${e.latest} on ${c.value}?`,`Mettre à jour Codex en ${e.latest} sur ${c.value} ?`),Z(`wherdr will exit Codex in this pane, type Codex’s official update command in its terminal:`,`wherdr va quitter Codex dans ce panneau et taper dans son terminal la commande de mise à jour officielle de Codex :`),e.command,Z(`then restart Codex on this conversation (codex resume). If the update fails, the pane stays at its shell.`,`puis relancer Codex sur cette conversation (codex resume). Si la mise à jour échoue, le panneau reste sur son shell.`)].join(`
79
80
 
80
- `),Z(`Update`),`primary`):await Tt([Q(`Update Codex to ${e.latest} on ${c.value}?`,`Mettre à jour Codex en ${e.latest} sur ${c.value} ?`),Q(`wherdr will run Codex’s official update command there:`,`wherdr y lancera la commande de mise à jour officielle de Codex :`),e.command,Q(`Running Codex agents keep their version until they are restarted; you can then restart this one on the same conversation.`,`Les Codex en cours gardent leur version jusqu’à leur redémarrage ; tu pourras ensuite redémarrer celui-ci sur la même conversation.`)].join(`
81
+ `),Q(`Update`),`primary`):await Je([Z(`Update Codex to ${e.latest} on ${c.value}?`,`Mettre à jour Codex en ${e.latest} sur ${c.value} ?`),Z(`wherdr will run Codex’s official update command there:`,`wherdr y lancera la commande de mise à jour officielle de Codex :`),e.command,Z(`Running Codex agents keep their version until they are restarted; you can then restart this one on the same conversation.`,`Les Codex en cours gardent leur version jusqu’à leur redémarrage ; tu pourras ensuite redémarrer celui-ci sur la même conversation.`)].join(`
81
82
 
82
- `),Z(`Update`),`primary`))){X();try{await gi(`/api/codex-update`,{pane_id:t.paneId})}catch(e){$(e.message,!0)}}}async function b(){try{await gi(`/api/codex-update`,{pane_id:t.paneId,dismiss:!0})}catch(e){$(e.message,!0)}}async function x(){try{await gi(`/api/prompt`,{pane_id:t.paneId,text:`/status`}),X()}catch(e){return $(e.message,!0)}ye(t.paneId,`/status`)}return(t,n)=>{let r=Ke;return _(),v(k,null,[f(i)&&f(s)?.phase===`running`?(_(),v(`div`,Rp,[n[1]||=I(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),I(`span`,zp,M((`tl`in t?t.tl:f(Q))(`Updating Codex on ${f(c)}…`,`Mise à jour de Codex sur ${f(c)}…`)),1)])):f(i)&&f(s)?.phase===`failed`?(_(),v(`div`,Bp,[I(`span`,Vp,M((`t`in t?t.t:f(Z))(`Codex update failed`))+M((`tl`in t?t.tl:f(Q))(`: `,` : `))+M((`t`in t?t.t:f(Z))(f(s).error)),1),f(i).command?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:p},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Z))(`Copy command`)),1)])):g(``,!0),I(`button`,{type:`button`,class:`notice-btn`,onClick:b},M((`t`in t?t.t:f(Z))(`Hide`)),1)])):f(i)&&f(i).state===`installed`?(_(),v(`div`,Hp,[I(`span`,Up,M((`tl`in t?t.tl:f(Q))(`Codex ${f(i).latest} installed`,`Codex ${f(i).latest} installé`))+` ·`,1),I(`button`,{type:`button`,class:`notice-btn`,disabled:e.readOnly||!(`canRestart`in t?t.canRestart:f(ue))(e.pane),title:(`tl`in t?t.tl:f(Q))(`Restarts Codex in this pane on the same conversation (codex resume)`,`Relance Codex dans ce panneau sur la même conversation (codex resume)`),onClick:n[0]||=n=>(`restartAgent`in t?t.restartAgent:f(De))(e.pane)},[E(r,{name:`i-lucide-rotate-cw`}),a(M((`t`in t?t.t:f(Z))(`Restart to update`)),1)],8,Wp)])):f(i)?(_(),v(`div`,Gp,[I(`span`,{class:`restart-text`,title:f(l)},[a(M((`tl`in t?t.tl:f(Q))(`Codex ${f(i).latest} available`,`Codex ${f(i).latest} disponible`)),1),f(i).current?(_(),v(`span`,qp,M(` `)+M((`tl`in t?t.tl:f(Q))(`(you have ${f(i).current})`,`(tu as la ${f(i).current})`)),1)):g(``,!0),n[2]||=a(` ·`,-1)],8,Kp),I(`a`,{class:`notice-btn`,href:f(i).notes,target:`_blank`,rel:`noopener noreferrer`,"aria-label":(`t`in t?t.t:f(Z))(`Release notes`),title:(`t`in t?t.t:f(Z))(`Release notes`)},[E(r,{name:`i-lucide-external-link`}),I(`span`,Yp,M((`t`in t?t.t:f(Z))(`Release notes`)),1)],8,Jp),f(i).runnable?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,disabled:e.readOnly||!!f(m),title:f(m)||(f(i).method===`terminal`?(`tl`in t?t.tl:f(Q))(`Exits Codex, updates it in this pane’s terminal, then resumes this conversation`,`Quitte Codex, le met à jour dans le terminal de ce panneau, puis reprend cette conversation`):void 0),onClick:y},[E(r,{name:`i-lucide-circle-arrow-up`}),a(M((`t`in t?t.t:f(Z))(`Update`)),1)],8,Xp)):f(i).command?(_(),v(`button`,{key:1,type:`button`,class:`notice-btn`,onClick:p},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Z))(`Copy command`)),1)])):g(``,!0),f(m)?(_(),v(`span`,Zp,M(e.pane.status===`blocked`?(`tl`in t?t.tl:f(Q))(`answer first`,`réponds d’abord`):(`tl`in t?t.tl:f(Q))(`after this turn`,`après ce tour`)),1)):g(``,!0),I(`button`,{type:`button`,class:`notice-btn notice-x`,"aria-label":(`t`in t?t.t:f(Z))(`Hide until the next version`),title:(`t`in t?t.t:f(Z))(`Hide until the next version`),onClick:d},[E(r,{name:`i-lucide-x`})],8,Qp)])):g(``,!0),f(o)?(_(),v(`div`,{key:4,class:j([`composer-notice codex-weekly`,{low:f(o).left<=10}]),role:`status`},[E(r,{name:`i-lucide-triangle-alert`,class:`notice-icon`}),I(`span`,{class:`restart-text`,title:f(u)},M(f(u)),9,$p),I(`button`,{type:`button`,class:`notice-btn`,disabled:e.readOnly,title:(`t`in t?t.t:f(Z))(`Show Codex’s usage breakdown`),onClick:x},`/status`,8,em)],2)):g(``,!0)],64)}}}),{__name:`CodexNotices`}),rm=e=>e.toLowerCase().replace(/\bwith 1m context\b/g,`(1m)`).replace(/\b1m context\b/g,`1m`).replace(/\s*\((?:default|current)\)/g,``).replace(/\s+/g,` `).trim();function im(e,t){if(!t)return!1;if(t.id&&e.label.includes(`/`))return e.label===t.id;let n=rm(t.label);if(rm(e.label)===n)return!0;let r=e.hint?.split(`·`)[0]?.trim()||``;return!!r&&rm(r)===n}function am(e,t){let n=e.findIndex(e=>!/^default\b/i.test(e.label)&&im(e,t));return n>=0?n:e.findIndex(e=>im(e,t))}var om={key:0,class:`model-pick-none`,role:`status`},sm={class:`model-pick-wrap`},cm={class:`model-name`},lm={class:`model-pick-wrap`},um=Object.assign(T({__name:`ModelPicker`,props:V({pane:{},launch:{}},{model:{default:null},modelModifiers:{},effort:{default:null},effortModifiers:{}}),emits:[`update:model`,`update:effort`],setup(e){let t=e,r=D(e,`model`),i=D(e,`effort`),o=h(!1),s=h(!1),c=h(!1),l=h(!1),u=h(!1),d=h(null),p=h(null),y=h(null),b=e=>String(e||``).trim().toLowerCase(),x=(e,t)=>!!(e&&t)&&b(e)===b(t),S=n(()=>{if(!t.pane)return null;let e=y.value;if(e&&Date.now()-e.at<2e4&&(!x(t.pane.model?.label,e.info.label)||t.pane.model?.effort!==e.info.effort))return e.info;let n=t.pane.model;return n?{...n,effort:n.effort||p.value?.current||null}:null});B(()=>[t.pane?.model?.label,t.pane?.model?.effort],()=>{t.pane&&y.value&&x(t.pane.model?.label,y.value.info.label)&&t.pane.model?.effort===y.value.info.effort&&(y.value=null)});let w=n(()=>{if(t.launch)return null;if(!zi.value||Sr.value||Qr(t.pane))return Z(`Changes unavailable offline`);let e=t.pane.status;return e===`working`?Z(`The agent is working — change the model once it’s done.`):e===`blocked`?Z(`The agent is waiting for an answer — reply first.`):null}),T=n(()=>!!w.value||u.value);async function O(e=!1){if(!c.value){c.value=!0;try{d.value=await gi(`/api/models?pane=${encodeURIComponent(t.pane.id)}${e?`&refresh=1`:``}`)}catch(e){o.value=!1,$(e.message,!0)}finally{c.value=!1}}}async function A(){if(!l.value){l.value=!0;try{p.value=await gi(`/api/efforts?pane=${encodeURIComponent(t.pane.id)}`)}catch(e){s.value=!1,$(e.message,!0)}finally{l.value=!1}}}B(o,e=>{t.launch||e&&(!d.value||d.value.agent!==t.pane.agent)&&O()}),B(s,e=>{e&&!p.value&&!t.launch&&A()}),B(()=>[zi.value,t.pane?.status,t.pane?.model?.label,t.pane?.model?.effort],()=>{t.pane&&[`claude`,`codex`,`omp`].includes(t.pane.agent||``)&&[`idle`,`done`].includes(t.pane.status||``)&&!t.pane.model?.effort&&t.pane.model&&!p.value&&!w.value&&A()},{immediate:!0}),B(()=>t.pane?.id,()=>{d.value=null,p.value=null,y.value=null});let N=n(()=>am(d.value?.options||[],S.value)),P=e=>d.value?.options.indexOf(e)===N.value,F=e=>/^default \(recommended\)$/i.test(e.label)?Z(`Default (recommended)`):e.label;async function L(e){if(!(P(e)||T.value)){u.value=!0,X();try{let n=await gi(`/api/model`,{pane_id:t.pane.id,label:e.label});y.value={info:n.model,at:Date.now()},p.value=null,$(Q(`Model: ${n.model.label} (this session)`,`Modèle : ${n.model.label} (cette session)`))}catch(e){$(e.message,!0)}finally{u.value=!1}w.value||await A()}}async function V(e){if(!(T.value||S.value?.effort===e)){u.value=!0,X();try{let n=await gi(`/api/effort`,{pane_id:t.pane.id,level:e});y.value={info:n.model,at:Date.now()},p.value&&(p.value.current=e),$(Q(`Effort: ${e} (this session)`,`Effort : ${e} (cette session)`))}catch(e){$(e.message,!0)}finally{u.value=!1}t.pane.agent===`omp`&&!w.value&&await A()}}let U=n(()=>{let e=[{type:`label`,label:Z(`For this session only`)}];return c.value||!d.value?[e,[{label:Z(`Reading models…`),icon:`i-lucide-loader-circle`,disabled:!0,class:`model-loading`}]]:[e,d.value.options.map(e=>({type:`checkbox`,label:F(e),description:e.hint||void 0,checked:P(e),onSelect:()=>L(e)})),[{label:Z(`Reload list`),icon:`i-lucide-refresh-cw`,onSelect:e=>{e.preventDefault(),O(!0)}}]]}),W=n(()=>{let e=[{type:`label`,label:Z(`For this session only`)}];return l.value||!p.value?[e,[{label:Z(`Reading effort levels…`),icon:`i-lucide-loader-circle`,disabled:!0}]]:[e,p.value.levels.map(e=>({type:`checkbox`,label:e,checked:S.value?.effort===e,description:e===`auto`?S.value?.effort===`auto`&&S.value.effortResolved?Q(`This turn: ${S.value.effortResolved}`,`Ce tour : ${S.value.effortResolved}`):t.pane.agent===`omp`?Z(`Picks the level each turn`):void 0:void 0,onSelect:()=>V(e)}))]}),G=n(()=>{let e=S.value;return e?.effort?e.effort===`auto`&&e.effortResolved?`auto · ${e.effortResolved}`:e.effort:null}),ee=n(()=>[`claude`,`codex`,`omp`].includes(t.pane?.agent||``)&&!!(p.value?.levels.length||S.value?.effort&&!p.value)),K=h(null),te=h(!1),q=0;async function ne(e=!1){let n=t.launch;if(!n)return;let r=++q;c.value=!0,te.value=!1;try{let t=await gi(`/api/tasks/models?machine=${encodeURIComponent(n.machine)}&program=${encodeURIComponent(n.program)}${e?`&refresh=1`:``}`);r===q&&(K.value=t,te.value=!t.models.length)}catch{r===q&&(K.value=null,te.value=!0)}finally{r===q&&(c.value=!1)}}B(()=>t.launch&&`${t.launch.machine}|${t.launch.program}`,e=>{K.value=null,r.value=null,i.value=null,e&&ne()},{immediate:!0});let J=n(()=>Ft(K.value,r.value));B(J,e=>{i.value&&!e.includes(i.value)&&(i.value=null)});let re=n(()=>{let e=[{type:`label`,label:Z(`For this start only`)}];return c.value||!K.value?[e,[{label:Z(`Reading models…`),icon:`i-lucide-loader-circle`,disabled:!0,class:`model-loading`}]]:[e,[{type:`checkbox`,label:Z(`Program’s default`),checked:!r.value,onSelect:()=>{r.value=null}},...K.value.models.map(e=>({type:`checkbox`,label:e,checked:r.value===e,onSelect:()=>{r.value=e}}))],[{label:Z(`Reload list`),icon:`i-lucide-refresh-cw`,onSelect:e=>{e.preventDefault(),ne(!0)}}]]}),ie=n(()=>[[{type:`label`,label:Z(`For this start only`)}],[{type:`checkbox`,label:Z(`Model’s default`),checked:!i.value,onSelect:()=>{i.value=null}},...J.value.map(e=>({type:`checkbox`,label:e,checked:i.value===e,onSelect:()=>{i.value=e}}))]]),ae=n(()=>t.launch?re.value:U.value),oe=n(()=>t.launch?ie.value:W.value),se=n(()=>t.launch?r.value||Z(`Model`):S.value?S.value.label:Z(`Model`)),ce=n(()=>t.launch?i.value:G.value),le=n(()=>t.launch?!!J.value.length:ee.value),ue=n(()=>!t.launch||!te.value),de=mt,fe=n(()=>t.launch?`span`:de),pe=n(()=>t.launch?{}:{text:w.value||Z(`Change model`),disabled:!Hi.value||!w.value&&o.value,content:{side:`top`}}),me=n(()=>t.launch?{}:{text:w.value||Z(`Change effort`),disabled:!Hi.value||!w.value&&s.value,content:{side:`top`}});function he(e,t){if(t&&T.value){w.value&&$(w.value,!0);return}e===`model`?(o.value=t,t&&(s.value=!1)):(s.value=t,t&&(o.value=!1))}return B(T,e=>{e&&(o.value=!1,s.value=!1)}),(t,n)=>{let i=_t,c=Yt;return _(),v(k,null,[f(ue)?g(``,!0):(_(),v(`span`,om,M((`t`in t?t.t:f(Z))(`Models could not be read: Start uses the program alone.`)),1)),f(ue)?(_(),m(C(f(fe)),R(z({key:1},f(pe))),{default:H(()=>[I(`span`,sm,[E(c,{open:f(o),items:f(ae),modal:!1,content:{side:`top`,align:`start`,sideOffset:6},ui:{content:`hw-dropdown model-menu${e.launch?` z-[30]`:``}`,itemDescription:`model-hint`,label:`model-menu-label`},"onUpdate:open":n[0]||=e=>he(`model`,e)},{default:H(()=>[E(i,{color:`neutral`,variant:`ghost`,size:`xs`,class:j([`model-pick`,{off:f(T)}]),"aria-disabled":f(T),"aria-label":`${(`t`in t?t.t:f(Z))(`Model`)} : ${e.launch?r.value||(`t`in t?t.t:f(Z))(`Program’s default`):f(S)?f(S).label:(`t`in t?t.t:f(Z))(`Unknown model`)}`,"trailing-icon":f(u)?`i-lucide-loader-circle`:`i-lucide-chevron-down`,ui:{trailingIcon:f(u)?`animate-spin model-caret`:`model-caret`}},{default:H(()=>[I(`span`,cm,M(f(se)),1)]),_:1},8,[`class`,`aria-disabled`,`aria-label`,`trailing-icon`,`ui`])]),_:1},8,[`open`,`items`,`ui`])])]),_:1},16)):g(``,!0),f(le)?(_(),m(C(f(fe)),R(z({key:2},f(me))),{default:H(()=>[I(`span`,lm,[E(c,{open:f(s),items:f(oe),modal:!1,content:{side:`top`,align:`start`,sideOffset:6},ui:{content:`hw-dropdown model-menu effort-menu${e.launch?` z-[30]`:``}`,itemDescription:`model-hint`,label:`model-menu-label`},"onUpdate:open":n[1]||=e=>he(`effort`,e)},{default:H(()=>[E(i,{color:`neutral`,variant:`ghost`,size:`xs`,class:j([`model-pick effort-pick`,{off:f(T)}]),"aria-disabled":f(T),"aria-label":`${(`t`in t?t.t:f(Z))(`Effort`)} : ${f(ce)||(e.launch?(`t`in t?t.t:f(Z))(`Model’s default`):(`t`in t?t.t:f(Z))(`Unknown effort`))}`,"trailing-icon":f(u)?`i-lucide-loader-circle`:`i-lucide-chevron-down`,ui:{trailingIcon:f(u)?`animate-spin model-caret`:`model-caret`}},{default:H(()=>[a(M(f(ce)||(`t`in t?t.t:f(Z))(`Effort`)),1)]),_:1},8,[`class`,`aria-disabled`,`aria-label`,`trailing-icon`,`ui`])]),_:1},8,[`open`,`items`,`ui`])])]),_:1},16)):g(``,!0)],64)}}}),{__name:`ModelPicker`}),dm={slots:{base:``}},fm=Object.assign({inheritAttrs:!1},{__name:`UChatPromptSubmit`,props:{status:{type:String,required:!1,default:`ready`},icon:{type:[String,Boolean],required:!1,skipCheck:!0},color:{type:null,required:!1},variant:{type:null,required:!1},streamingIcon:{type:null,required:!1},streamingColor:{type:null,required:!1,default:`neutral`},streamingVariant:{type:null,required:!1,default:`subtle`},submittedIcon:{type:null,required:!1},submittedColor:{type:null,required:!1,default:`neutral`},submittedVariant:{type:null,required:!1,default:`subtle`},errorIcon:{type:null,required:!1},errorColor:{type:null,required:!1,default:`error`},errorVariant:{type:null,required:!1,default:`soft`},ui:{type:Object,required:!1},class:{type:null,required:!1},label:{type:String,required:!1},activeColor:{type:null,required:!1},activeVariant:{type:null,required:!1},size:{type:null,required:!1},square:{type:Boolean,required:!1},block:{type:Boolean,required:!1},loadingAuto:{type:Boolean,required:!1},onClick:{type:[Function,Array],required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},as:{type:null,required:!1},type:{type:null,required:!1},disabled:{type:Boolean,required:!1},exactActiveClass:{type:String,required:!1},viewTransition:{type:Boolean,required:!1}},emits:[`stop`,`reload`],setup(e,{emit:r}){let i=e,a=r,o=O(),s=Re(`chatPromptSubmit`,i),{t:c}=Qt(),l=er(),u=Nt(Ye(s,`icon`,`color`,`variant`,`status`,`disabled`,`streamingIcon`,`streamingColor`,`streamingVariant`,`submittedIcon`,`submittedColor`,`submittedVariant`,`errorIcon`,`errorColor`,`errorVariant`,`class`,`ui`)),p=n(()=>s.status===`ready`&&s.disabled),h=n(()=>({ready:{icon:s.icon===!1?void 0:s.icon??l.ui.icons.arrowUp,color:s.color,variant:s.variant,type:`submit`},submitted:{icon:s.submittedIcon||l.ui.icons.stop,color:s.submittedColor,variant:s.submittedVariant,onClick(e){a(`stop`,e)}},streaming:{icon:s.streamingIcon||l.ui.icons.stop,color:s.streamingColor,variant:s.streamingVariant,onClick(e){a(`stop`,e)}},error:{icon:s.errorIcon||l.ui.icons.reload,color:s.errorColor,variant:s.errorVariant,onClick(e){a(`reload`,e)}}})[s.status]),g=n(()=>ot({extend:dm,...l.ui?.chatPromptSubmit||{}})());return(e,n)=>(_(),m(_t,z({...f(u),...h.value,disabled:p.value,"aria-label":f(c)(`chatPromptSubmit.label`),...e.$attrs},{class:g.value.base({class:[f(s).ui?.base,f(s).class]}),ui:f(ae)(g.value,f(s).ui)}),x({_:2},[y(o,(n,r)=>({name:r,fn:H(n=>[d(e.$slots,r,R(t(n)))])}))]),1040,[`class`,`ui`]))}});function pm(e){let t=!1;function n(e){return e.isComposing||e.keyCode===229}function r(r){t||n(r)||(r.preventDefault(),e(r))}let i;function a(){clearTimeout(i),t=!0,i=setTimeout(()=>{t=!1},50)}return{onKeydown:r,onCompositionEnd:a}}var mm={slots:{root:`relative flex flex-col items-stretch gap-2 px-2.5 py-2 w-full rounded-lg backdrop-blur-sm`,header:`flex items-center gap-1.5`,body:`items-start gap-1.5`,footer:`flex items-center justify-between gap-1.5`,base:`px-0`},variants:{color:{primary:``,neutral:``,success:``,warning:``,error:``,info:``},variant:{outline:{root:`bg-default/75 ring ring-default`},soft:{root:`bg-elevated/50`},subtle:{root:`bg-elevated/50 ring ring-default`},naked:{root:``}}},compoundVariants:[{color:`primary`,variant:[`outline`,`subtle`],class:{root:`outline-primary/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-primary has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-primary`}},{color:`neutral`,variant:[`outline`,`subtle`],class:{root:`outline-neutral/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-neutral has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-neutral`}},{color:`success`,variant:[`outline`,`subtle`],class:{root:`outline-success/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-success has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-success`}},{color:`warning`,variant:[`outline`,`subtle`],class:{root:`outline-warning/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-warning has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-warning`}},{color:`error`,variant:[`outline`,`subtle`],class:{root:`outline-error/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-error has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-error`}},{color:`info`,variant:[`outline`,`subtle`],class:{root:`outline-info/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-info has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-info`}},{color:`primary`,variant:`soft`,class:{root:`outline-primary/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`neutral`,variant:`soft`,class:{root:`outline-neutral/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`success`,variant:`soft`,class:{root:`outline-success/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`warning`,variant:`soft`,class:{root:`outline-warning/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`error`,variant:`soft`,class:{root:`outline-error/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`info`,variant:`soft`,class:{root:`outline-info/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`neutral`,variant:[`outline`,`subtle`],class:{root:`outline-inverted/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-inverted has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-inverted`}},{color:`neutral`,variant:`soft`,class:{root:`outline-inverted/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}}],defaultVariants:{color:`primary`,variant:`outline`}},hm=Object.assign({inheritAttrs:!1},{__name:`UChatPrompt`,props:V({as:{type:null,required:!1,default:`form`},placeholder:{type:String,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},submitOnEnter:{type:Boolean,required:!1,default:!0},error:{type:Error,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},rows:{type:Number,required:!1,default:1},autofocus:{type:Boolean,required:!1,default:!0},autofocusDelay:{type:Number,required:!1},autoresize:{type:Boolean,required:!1,default:!0},autoresizeDelay:{type:Number,required:!1},maxrows:{type:Number,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},disabled:{type:Boolean,required:!1}},{modelValue:{type:String,default:``},modelModifiers:{}}),emits:V([`submit`,`close`],[`update:modelValue`]),setup(e,{expose:r,emit:i}){let a=e,o=i,s=O(),c=Re(`chatPrompt`,a),l=D(e,`modelValue`,{type:String,default:``}),{t:u}=Qt(),p=er(),h=Nt(Ne(c,`rows`,`autofocus`,`autofocusDelay`,`autoresize`,`autoresizeDelay`,`maxrows`,`icon`,`avatar`,`loading`,`loadingIcon`)),C=()=>oe(s,[`header`,`footer`,`body`]),w=n(()=>ot({extend:mm,...p.ui?.chatPrompt||{}})({color:c.color,variant:c.variant})),T=b(`textareaRef`);function k(e){l.value.trim()!==``&&o(`submit`,e??new Event(`submit`))}function A(e){T.value?.textareaRef?.blur(),o(`close`,e??new Event(`close`))}let{onKeydown:M,onCompositionEnd:N}=pm(e=>{k(e)});function P(e){if(c.submitOnEnter){if(e.shiftKey||e.ctrlKey||e.metaKey||e.altKey)return}else if(!e.ctrlKey&&!e.metaKey)return;M(e)}function F(e){e.key===`Enter`?P(e):e.key===`Escape`&&A(e)}return r({textareaRef:S(()=>T.value?.textareaRef)}),(e,n)=>(_(),m(f(Te),{as:f(c).as,"data-slot":e.$attrs[`data-slot`]??`root`,class:j(w.value.root({class:[f(c).ui?.root,f(c).class]})),onSubmit:re(k,[`prevent`])},{default:H(()=>[s.header?(_(),v(`div`,{key:0,"data-slot":`header`,class:j(w.value.header({class:f(c).ui?.header}))},[d(e.$slots,`header`)],2)):g(``,!0),d(e.$slots,`body`,{submit:k,close:A,placeholder:f(c).placeholder??f(u)(`chatPrompt.placeholder`),disabled:!!f(c).error||f(c).disabled,ui:w.value},()=>[E(yn,z({ref_key:`textareaRef`,ref:T,modelValue:l.value,"onUpdate:modelValue":n[0]||=e=>l.value=e,placeholder:f(c).placeholder??f(u)(`chatPrompt.placeholder`),disabled:!!f(c).error||f(c).disabled,variant:`none`,fixed:``},{...f(h),...e.$attrs},{ui:f(ae)(f(oe)(w.value,[`root`,`body`,`header`,`footer`]),f(c).ui),"data-slot":`body`,class:w.value.body({class:f(c).ui?.body}),onKeydown:F,onCompositionend:f(N)}),x({_:2},[y(C(),(n,r)=>({name:r,fn:H(n=>[d(e.$slots,r,R(t(n)))])}))]),1040,[`modelValue`,`placeholder`,`disabled`,`ui`,`class`,`onCompositionend`])]),s.footer?(_(),v(`div`,{key:1,"data-slot":`footer`,class:j(w.value.footer({class:f(c).ui?.footer}))},[d(e.$slots,`footer`)],2)):g(``,!0)]),_:3},8,[`as`,`data-slot`,`class`]))}}),gm=e=>e.split(`
83
- `).filter(e=>!Di(e)).join(`
84
- `).trim();function _m(e,t){let n=gm(t);return!n||e.at(-1)===n?e:[...e,n].slice(-100)}function vm(e,t){return e.defaultPrevented||e.isComposing||e.keyCode===229||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey||t.start!==t.end?null:e.key===`ArrowUp`&&!t.text.slice(0,t.start).includes(`
83
+ `),Q(`Update`),`primary`))){$();try{await xi(`/api/codex-update`,{pane_id:t.paneId})}catch(e){X(e.message,!0)}}}async function b(){try{await xi(`/api/codex-update`,{pane_id:t.paneId,dismiss:!0})}catch(e){X(e.message,!0)}}async function x(){try{await xi(`/api/prompt`,{pane_id:t.paneId,text:`/status`}),$()}catch(e){return X(e.message,!0)}ce(t.paneId,`/status`)}return(t,n)=>{let r=Qe;return _(),v(k,null,[f(i)&&f(s)?.phase===`running`?(_(),v(`div`,Sm,[n[1]||=F(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),F(`span`,Cm,M((`tl`in t?t.tl:f(Z))(`Updating Codex on ${f(c)}…`,`Mise à jour de Codex sur ${f(c)}…`)),1)])):f(i)&&f(s)?.phase===`failed`?(_(),v(`div`,wm,[F(`span`,Tm,M((`t`in t?t.t:f(Q))(`Codex update failed`))+M((`tl`in t?t.tl:f(Z))(`: `,` : `))+M((`t`in t?t.t:f(Q))(f(s).error)),1),f(i).command?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:p},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Q))(`Copy command`)),1)])):g(``,!0),F(`button`,{type:`button`,class:`notice-btn`,onClick:b},M((`t`in t?t.t:f(Q))(`Hide`)),1)])):f(i)&&f(i).state===`installed`?(_(),v(`div`,Em,[F(`span`,Dm,M((`tl`in t?t.tl:f(Z))(`Codex ${f(i).latest} installed`,`Codex ${f(i).latest} installé`))+` ·`,1),F(`button`,{type:`button`,class:`notice-btn`,disabled:e.readOnly||!(`canRestart`in t?t.canRestart:f(je))(e.pane),title:(`tl`in t?t.tl:f(Z))(`Restarts Codex in this pane on the same conversation (codex resume)`,`Relance Codex dans ce panneau sur la même conversation (codex resume)`),onClick:n[0]||=n=>(`restartAgent`in t?t.restartAgent:f(ze))(e.pane)},[E(r,{name:`i-lucide-rotate-cw`}),a(M((`t`in t?t.t:f(Q))(`Restart to update`)),1)],8,Om)])):f(i)?(_(),v(`div`,km,[F(`span`,{class:`restart-text`,title:f(l)},[a(M((`tl`in t?t.tl:f(Z))(`Codex ${f(i).latest} available`,`Codex ${f(i).latest} disponible`)),1),f(i).current?(_(),v(`span`,jm,M(` `)+M((`tl`in t?t.tl:f(Z))(`(you have ${f(i).current})`,`(tu as la ${f(i).current})`)),1)):g(``,!0),n[2]||=a(` ·`,-1)],8,Am),F(`a`,{class:`notice-btn`,href:f(i).notes,target:`_blank`,rel:`noopener noreferrer`,"aria-label":(`t`in t?t.t:f(Q))(`Release notes`),title:(`t`in t?t.t:f(Q))(`Release notes`)},[E(r,{name:`i-lucide-external-link`}),F(`span`,Nm,M((`t`in t?t.t:f(Q))(`Release notes`)),1)],8,Mm),f(i).runnable?(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,disabled:e.readOnly||!!f(m),title:f(m)||(f(i).method===`terminal`?(`tl`in t?t.tl:f(Z))(`Exits Codex, updates it in this pane’s terminal, then resumes this conversation`,`Quitte Codex, le met à jour dans le terminal de ce panneau, puis reprend cette conversation`):void 0),onClick:y},[E(r,{name:`i-lucide-circle-arrow-up`}),a(M((`t`in t?t.t:f(Q))(`Update`)),1)],8,Pm)):f(i).command?(_(),v(`button`,{key:1,type:`button`,class:`notice-btn`,onClick:p},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Q))(`Copy command`)),1)])):g(``,!0),f(m)?(_(),v(`span`,Fm,M(e.pane.status===`blocked`?(`tl`in t?t.tl:f(Z))(`answer first`,`réponds d’abord`):(`tl`in t?t.tl:f(Z))(`after this turn`,`après ce tour`)),1)):g(``,!0),F(`button`,{type:`button`,class:`notice-btn notice-x`,"aria-label":(`t`in t?t.t:f(Q))(`Hide until the next version`),title:(`t`in t?t.t:f(Q))(`Hide until the next version`),onClick:d},[E(r,{name:`i-lucide-x`})],8,Im)])):g(``,!0),f(o)?(_(),v(`div`,{key:4,class:j([`composer-notice codex-weekly`,{low:f(o).left<=10}]),role:`status`},[E(r,{name:`i-lucide-triangle-alert`,class:`notice-icon`}),F(`span`,{class:`restart-text`,title:f(u)},M(f(u)),9,Lm),F(`button`,{type:`button`,class:`notice-btn`,disabled:e.readOnly,title:(`t`in t?t.t:f(Q))(`Show Codex’s usage breakdown`),onClick:x},`/status`,8,Rm)],2)):g(``,!0)],64)}}}),{__name:`CodexNotices`}),Vm=e=>e.toLowerCase().replace(/\bwith 1m context\b/g,`(1m)`).replace(/\b1m context\b/g,`1m`).replace(/\s*\((?:default|current)\)/g,``).replace(/\s+/g,` `).trim();function Hm(e,t){if(!t)return!1;if(t.id&&e.label.includes(`/`))return e.label===t.id;let n=Vm(t.label);if(Vm(e.label)===n)return!0;let r=e.hint?.split(`·`)[0]?.trim()||``;return!!r&&Vm(r)===n}function Um(e,t){let n=e.findIndex(e=>!/^default\b/i.test(e.label)&&Hm(e,t));return n>=0?n:e.findIndex(e=>Hm(e,t))}var Wm={key:0,class:`model-pick-none`,role:`status`},Gm={class:`model-pick-wrap`},Km={class:`model-name`},qm={class:`model-pick-wrap effort-pick-wrap`},Jm={class:`model-name`},Ym=Object.assign(T({__name:`ModelPicker`,props:B({pane:{},launch:{}},{model:{default:null},modelModifiers:{},effort:{default:null},effortModifiers:{}}),emits:[`update:model`,`update:effort`],setup(e){let t=e,r=D(e,`model`),i=D(e,`effort`),a=h(!1),o=h(!1),s=h(!1),c=h(!1),l=h(!1),u=h(null),d=h(null),p=h(null),y=e=>String(e||``).trim().toLowerCase(),b=(e,t)=>!!(e&&t)&&y(e)===y(t),x=n(()=>{if(!t.pane)return null;let e=p.value;if(e&&Date.now()-e.at<2e4&&(!b(t.pane.model?.label,e.info.label)||t.pane.model?.effort!==e.info.effort))return e.info;let n=t.pane.model;return n?{...n,effort:n.effort||d.value?.current||null}:null});z(()=>[t.pane?.model?.label,t.pane?.model?.effort],()=>{t.pane&&p.value&&b(t.pane.model?.label,p.value.info.label)&&t.pane.model?.effort===p.value.info.effort&&(p.value=null)});let S=n(()=>{if(t.launch)return null;if(!Hr.value||Qr.value||Lr(t.pane))return Q(`Changes unavailable offline`);let e=t.pane.status;return e===`working`?Q(`The agent is working — change the model once it’s done.`):e===`blocked`?Q(`The agent is waiting for an answer — reply first.`):null}),w=n(()=>!!S.value||l.value);async function T(e=!1){if(!s.value){s.value=!0;try{u.value=await xi(`/api/models?pane=${encodeURIComponent(t.pane.id)}${e?`&refresh=1`:``}`)}catch(e){a.value=!1,X(e.message,!0)}finally{s.value=!1}}}async function O(){if(!c.value){c.value=!0;try{d.value=await xi(`/api/efforts?pane=${encodeURIComponent(t.pane.id)}`)}catch(e){o.value=!1,X(e.message,!0)}finally{c.value=!1}}}z(a,e=>{t.launch||e&&(!u.value||u.value.agent!==t.pane.agent)&&T()}),z(o,e=>{e&&!d.value&&!t.launch&&O()}),z(()=>[Hr.value,t.pane?.status,t.pane?.model?.label,t.pane?.model?.effort],()=>{t.pane&&[`claude`,`codex`,`omp`].includes(t.pane.agent||``)&&[`idle`,`done`].includes(t.pane.status||``)&&!t.pane.model?.effort&&t.pane.model&&!d.value&&!S.value&&O()},{immediate:!0}),z(()=>t.pane?.id,()=>{u.value=null,d.value=null,p.value=null});let A=n(()=>Um(u.value?.options||[],x.value)),N=e=>u.value?.options.indexOf(e)===A.value,P=e=>/^default \(recommended\)$/i.test(e.label)?Q(`Default (recommended)`):e.label;async function I(e){if(!(N(e)||w.value)){l.value=!0,$();try{let n=await xi(`/api/model`,{pane_id:t.pane.id,label:e.label});p.value={info:n.model,at:Date.now()},d.value=null,X(Z(`Model: ${n.model.label} (this session)`,`Modèle : ${n.model.label} (cette session)`))}catch(e){X(e.message,!0)}finally{l.value=!1}S.value||await O()}}async function B(e){if(!(w.value||x.value?.effort===e)){l.value=!0,$();try{let n=await xi(`/api/effort`,{pane_id:t.pane.id,level:e});p.value={info:n.model,at:Date.now()},d.value&&(d.value.current=e),X(Z(`Effort: ${e} (this session)`,`Effort : ${e} (cette session)`))}catch(e){X(e.message,!0)}finally{l.value=!1}t.pane.agent===`omp`&&!S.value&&await O()}}let H=n(()=>{let e=[{type:`label`,label:Q(`For this session only`)}];return s.value||!u.value?[e,[{label:Q(`Reading models…`),icon:`i-lucide-loader-circle`,disabled:!0,class:`model-loading`}]]:[e,u.value.options.map(e=>({type:`checkbox`,label:P(e),description:e.hint||void 0,checked:N(e),onSelect:()=>I(e)})),[{label:Q(`Reload list`),icon:`i-lucide-refresh-cw`,onSelect:e=>{e.preventDefault(),T(!0)}}]]}),ee=n(()=>{let e=[{type:`label`,label:Q(`For this session only`)}];return c.value||!d.value?[e,[{label:Q(`Reading effort levels…`),icon:`i-lucide-loader-circle`,disabled:!0}]]:[e,d.value.levels.map(e=>({type:`checkbox`,label:e,checked:x.value?.effort===e,description:e===`auto`?x.value?.effort===`auto`&&x.value.effortResolved?Z(`This turn: ${x.value.effortResolved}`,`Ce tour : ${x.value.effortResolved}`):t.pane.agent===`omp`?Q(`Picks the level each turn`):void 0:void 0,onSelect:()=>B(e)}))]}),U=n(()=>{let e=x.value;return e?.effort?e.effort===`auto`&&e.effortResolved?`auto · ${e.effortResolved}`:e.effort:null}),W=n(()=>[`claude`,`codex`,`omp`].includes(t.pane?.agent||``)&&!!(d.value?.levels.length||x.value?.effort&&!d.value)),G=h(null),K=h(!1),te=0;async function ne(e=!1){let n=t.launch;if(!n)return;let r=++te;s.value=!0,K.value=!1;try{let t=await xi(`/api/tasks/models?machine=${encodeURIComponent(n.machine)}&program=${encodeURIComponent(n.program)}${e?`&refresh=1`:``}`);r===te&&(G.value=t,K.value=!t.models.length)}catch{r===te&&(G.value=null,K.value=!0)}finally{r===te&&(s.value=!1)}}z(()=>t.launch&&`${t.launch.machine}|${t.launch.program}`,e=>{G.value=null,r.value=null,i.value=null,e&&ne()},{immediate:!0});let q=n(()=>Te(G.value,r.value));z(q,e=>{i.value&&!e.includes(i.value)&&(i.value=null)});let re=n(()=>{let e=[{type:`label`,label:Q(`For this start only`)}];return s.value||!G.value?[e,[{label:Q(`Reading models…`),icon:`i-lucide-loader-circle`,disabled:!0,class:`model-loading`}]]:[e,[{type:`checkbox`,label:Q(`Program’s default`),checked:!r.value,onSelect:()=>{r.value=null}},...G.value.models.map(e=>({type:`checkbox`,label:e,checked:r.value===e,onSelect:()=>{r.value=e}}))],[{label:Q(`Reload list`),icon:`i-lucide-refresh-cw`,onSelect:e=>{e.preventDefault(),ne(!0)}}]]}),ie=n(()=>[[{type:`label`,label:Q(`For this start only`)}],[{type:`checkbox`,label:Q(`Model’s default`),checked:!i.value,onSelect:()=>{i.value=null}},...q.value.map(e=>({type:`checkbox`,label:e,checked:i.value===e,onSelect:()=>{i.value=e}}))]]),ae=n(()=>t.launch?re.value:H.value),J=n(()=>t.launch?ie.value:ee.value),oe=n(()=>t.launch?r.value||Q(`Model`):x.value?x.value.label:Q(`Model`)),se=n(()=>t.launch?i.value:U.value),ce=n(()=>t.launch?!!q.value.length:W.value),le=n(()=>!t.launch||!K.value),ue=vt,de=n(()=>t.launch?`span`:ue),fe=n(()=>t.launch?{}:{text:S.value||Q(`Change model`),disabled:!Xi.value||!S.value&&a.value,content:{side:`top`}}),pe=n(()=>t.launch?{}:{text:S.value||Q(`Change effort`),disabled:!Xi.value||!S.value&&o.value,content:{side:`top`}});function me(e,t){if(t&&w.value){S.value&&X(S.value,!0);return}e===`model`?(a.value=t,t&&(o.value=!1)):(o.value=t,t&&(a.value=!1))}return z(w,e=>{e&&(a.value=!1,o.value=!1)}),(t,n)=>{let i=bt,s=xn;return _(),v(k,null,[f(le)?g(``,!0):(_(),v(`span`,Wm,M((`t`in t?t.t:f(Q))(`Models could not be read: Start uses the program alone.`)),1)),f(le)?(_(),m(C(f(de)),L(R({key:1},f(fe))),{default:V(()=>[F(`span`,Gm,[E(s,{open:f(a),items:f(ae),modal:!1,content:{side:`top`,align:`start`,sideOffset:6},ui:{content:`hw-dropdown model-menu${e.launch?` z-[30]`:``}`,itemDescription:`model-hint`,label:`model-menu-label`},"onUpdate:open":n[0]||=e=>me(`model`,e)},{default:V(()=>[E(i,{color:`neutral`,variant:`ghost`,size:`xs`,class:j([`model-pick`,{off:f(w)}]),"aria-disabled":f(w),"aria-label":`${(`t`in t?t.t:f(Q))(`Model`)} : ${e.launch?r.value||(`t`in t?t.t:f(Q))(`Program’s default`):f(x)?f(x).label:(`t`in t?t.t:f(Q))(`Unknown model`)}`,"trailing-icon":f(l)?`i-lucide-loader-circle`:`i-lucide-chevron-down`,ui:{trailingIcon:f(l)?`animate-spin model-caret`:`model-caret`}},{default:V(()=>[F(`span`,Km,M(f(oe)),1)]),_:1},8,[`class`,`aria-disabled`,`aria-label`,`trailing-icon`,`ui`])]),_:1},8,[`open`,`items`,`ui`])])]),_:1},16)):g(``,!0),f(ce)?(_(),m(C(f(de)),L(R({key:2},f(pe))),{default:V(()=>[F(`span`,qm,[E(s,{open:f(o),items:f(J),modal:!1,content:{side:`top`,align:`start`,sideOffset:6},ui:{content:`hw-dropdown model-menu effort-menu${e.launch?` z-[30]`:``}`,itemDescription:`model-hint`,label:`model-menu-label`},"onUpdate:open":n[1]||=e=>me(`effort`,e)},{default:V(()=>[E(i,{color:`neutral`,variant:`ghost`,size:`xs`,class:j([`model-pick effort-pick`,{off:f(w)}]),"aria-disabled":f(w),"aria-label":`${(`t`in t?t.t:f(Q))(`Effort`)} : ${f(se)||(e.launch?(`t`in t?t.t:f(Q))(`Model’s default`):(`t`in t?t.t:f(Q))(`Unknown effort`))}`,"trailing-icon":f(l)?`i-lucide-loader-circle`:`i-lucide-chevron-down`,ui:{trailingIcon:f(l)?`animate-spin model-caret`:`model-caret`}},{default:V(()=>[F(`span`,Jm,M(f(se)||(`t`in t?t.t:f(Q))(`Effort`)),1)]),_:1},8,[`class`,`aria-disabled`,`aria-label`,`trailing-icon`,`ui`])]),_:1},8,[`open`,`items`,`ui`])])]),_:1},16)):g(``,!0)],64)}}}),{__name:`ModelPicker`}),Xm={slots:{base:``}},Zm=Object.assign({inheritAttrs:!1},{__name:`UChatPromptSubmit`,props:{status:{type:String,required:!1,default:`ready`},icon:{type:[String,Boolean],required:!1,skipCheck:!0},color:{type:null,required:!1},variant:{type:null,required:!1},streamingIcon:{type:null,required:!1},streamingColor:{type:null,required:!1,default:`neutral`},streamingVariant:{type:null,required:!1,default:`subtle`},submittedIcon:{type:null,required:!1},submittedColor:{type:null,required:!1,default:`neutral`},submittedVariant:{type:null,required:!1,default:`subtle`},errorIcon:{type:null,required:!1},errorColor:{type:null,required:!1,default:`error`},errorVariant:{type:null,required:!1,default:`soft`},ui:{type:Object,required:!1},class:{type:null,required:!1},label:{type:String,required:!1},activeColor:{type:null,required:!1},activeVariant:{type:null,required:!1},size:{type:null,required:!1},square:{type:Boolean,required:!1},block:{type:Boolean,required:!1},loadingAuto:{type:Boolean,required:!1},onClick:{type:[Function,Array],required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},as:{type:null,required:!1},type:{type:null,required:!1},disabled:{type:Boolean,required:!1},exactActiveClass:{type:String,required:!1},viewTransition:{type:Boolean,required:!1}},emits:[`stop`,`reload`],setup(e,{emit:r}){let i=e,a=r,o=O(),s=We(`chatPromptSubmit`,i),{t:c}=un(),l=ar(),u=kt(nt(s,`icon`,`color`,`variant`,`status`,`disabled`,`streamingIcon`,`streamingColor`,`streamingVariant`,`submittedIcon`,`submittedColor`,`submittedVariant`,`errorIcon`,`errorColor`,`errorVariant`,`class`,`ui`)),p=n(()=>s.status===`ready`&&s.disabled),h=n(()=>({ready:{icon:s.icon===!1?void 0:s.icon??l.ui.icons.arrowUp,color:s.color,variant:s.variant,type:`submit`},submitted:{icon:s.submittedIcon||l.ui.icons.stop,color:s.submittedColor,variant:s.submittedVariant,onClick(e){a(`stop`,e)}},streaming:{icon:s.streamingIcon||l.ui.icons.stop,color:s.streamingColor,variant:s.streamingVariant,onClick(e){a(`stop`,e)}},error:{icon:s.errorIcon||l.ui.icons.reload,color:s.errorColor,variant:s.errorVariant,onClick(e){a(`reload`,e)}}})[s.status]),g=n(()=>lt({extend:Xm,...l.ui?.chatPromptSubmit||{}})());return(e,n)=>(_(),m(bt,R({...f(u),...h.value,disabled:p.value,"aria-label":f(c)(`chatPromptSubmit.label`),...e.$attrs},{class:g.value.base({class:[f(s).ui?.base,f(s).class]}),ui:f(le)(g.value,f(s).ui)}),x({_:2},[y(o,(n,r)=>({name:r,fn:V(n=>[d(e.$slots,r,L(t(n)))])}))]),1040,[`class`,`ui`]))}});function Qm(e){let t=!1;function n(e){return e.isComposing||e.keyCode===229}function r(r){t||n(r)||(r.preventDefault(),e(r))}let i;function a(){clearTimeout(i),t=!0,i=setTimeout(()=>{t=!1},50)}return{onKeydown:r,onCompositionEnd:a}}var $m={slots:{root:`relative flex flex-col items-stretch gap-2 px-2.5 py-2 w-full rounded-lg backdrop-blur-sm`,header:`flex items-center gap-1.5`,body:`items-start gap-1.5`,footer:`flex items-center justify-between gap-1.5`,base:`px-0`},variants:{color:{primary:``,neutral:``,success:``,warning:``,error:``,info:``},variant:{outline:{root:`bg-default/75 ring ring-default`},soft:{root:`bg-elevated/50`},subtle:{root:`bg-elevated/50 ring ring-default`},naked:{root:``}}},compoundVariants:[{color:`primary`,variant:[`outline`,`subtle`],class:{root:`outline-primary/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-primary has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-primary`}},{color:`neutral`,variant:[`outline`,`subtle`],class:{root:`outline-neutral/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-neutral has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-neutral`}},{color:`success`,variant:[`outline`,`subtle`],class:{root:`outline-success/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-success has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-success`}},{color:`warning`,variant:[`outline`,`subtle`],class:{root:`outline-warning/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-warning has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-warning`}},{color:`error`,variant:[`outline`,`subtle`],class:{root:`outline-error/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-error has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-error`}},{color:`info`,variant:[`outline`,`subtle`],class:{root:`outline-info/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-info has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-info`}},{color:`primary`,variant:`soft`,class:{root:`outline-primary/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`neutral`,variant:`soft`,class:{root:`outline-neutral/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`success`,variant:`soft`,class:{root:`outline-success/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`warning`,variant:`soft`,class:{root:`outline-warning/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`error`,variant:`soft`,class:{root:`outline-error/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`info`,variant:`soft`,class:{root:`outline-info/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}},{color:`neutral`,variant:[`outline`,`subtle`],class:{root:`outline-inverted/25 has-[textarea:focus-visible]:outline-3 has-[textarea:focus-visible]:ring-inverted has-[[contenteditable]:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:ring-inverted`}},{color:`neutral`,variant:`soft`,class:{root:`outline-inverted/25 has-[textarea:focus-visible]:outline-3 has-[[contenteditable]:focus-visible]:outline-3`}}],defaultVariants:{color:`primary`,variant:`outline`}},eh=Object.assign({inheritAttrs:!1},{__name:`UChatPrompt`,props:B({as:{type:null,required:!1,default:`form`},placeholder:{type:String,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},submitOnEnter:{type:Boolean,required:!1,default:!0},error:{type:Error,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},rows:{type:Number,required:!1,default:1},autofocus:{type:Boolean,required:!1,default:!0},autofocusDelay:{type:Number,required:!1},autoresize:{type:Boolean,required:!1,default:!0},autoresizeDelay:{type:Number,required:!1},maxrows:{type:Number,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},disabled:{type:Boolean,required:!1}},{modelValue:{type:String,default:``},modelModifiers:{}}),emits:B([`submit`,`close`],[`update:modelValue`]),setup(e,{expose:r,emit:i}){let a=e,o=i,s=O(),c=We(`chatPrompt`,a),l=D(e,`modelValue`,{type:String,default:``}),{t:u}=un(),p=ar(),h=kt(Ve(c,`rows`,`autofocus`,`autofocusDelay`,`autoresize`,`autoresizeDelay`,`maxrows`,`icon`,`avatar`,`loading`,`loadingIcon`)),C=()=>de(s,[`header`,`footer`,`body`]),w=n(()=>lt({extend:$m,...p.ui?.chatPrompt||{}})({color:c.color,variant:c.variant})),T=b(`textareaRef`);function k(e){l.value.trim()!==``&&o(`submit`,e??new Event(`submit`))}function A(e){T.value?.textareaRef?.blur(),o(`close`,e??new Event(`close`))}let{onKeydown:M,onCompositionEnd:N}=Qm(e=>{k(e)});function P(e){if(c.submitOnEnter){if(e.shiftKey||e.ctrlKey||e.metaKey||e.altKey)return}else if(!e.ctrlKey&&!e.metaKey)return;M(e)}function F(e){e.key===`Enter`?P(e):e.key===`Escape`&&A(e)}return r({textareaRef:S(()=>T.value?.textareaRef)}),(e,n)=>(_(),m(f(Ne),{as:f(c).as,"data-slot":e.$attrs[`data-slot`]??`root`,class:j(w.value.root({class:[f(c).ui?.root,f(c).class]})),onSubmit:re(k,[`prevent`])},{default:V(()=>[s.header?(_(),v(`div`,{key:0,"data-slot":`header`,class:j(w.value.header({class:f(c).ui?.header}))},[d(e.$slots,`header`)],2)):g(``,!0),d(e.$slots,`body`,{submit:k,close:A,placeholder:f(c).placeholder??f(u)(`chatPrompt.placeholder`),disabled:!!f(c).error||f(c).disabled,ui:w.value},()=>[E(Tn,R({ref_key:`textareaRef`,ref:T,modelValue:l.value,"onUpdate:modelValue":n[0]||=e=>l.value=e,placeholder:f(c).placeholder??f(u)(`chatPrompt.placeholder`),disabled:!!f(c).error||f(c).disabled,variant:`none`,fixed:``},{...f(h),...e.$attrs},{ui:f(le)(f(de)(w.value,[`root`,`body`,`header`,`footer`]),f(c).ui),"data-slot":`body`,class:w.value.body({class:f(c).ui?.body}),onKeydown:F,onCompositionend:f(N)}),x({_:2},[y(C(),(n,r)=>({name:r,fn:V(n=>[d(e.$slots,r,L(t(n)))])}))]),1040,[`modelValue`,`placeholder`,`disabled`,`ui`,`class`,`onCompositionend`])]),s.footer?(_(),v(`div`,{key:1,"data-slot":`footer`,class:j(w.value.footer({class:f(c).ui?.footer}))},[d(e.$slots,`footer`)],2)):g(``,!0)]),_:3},8,[`as`,`data-slot`,`class`]))}}),th=e=>e.split(`
84
+ `).filter(e=>!li(e)).join(`
85
+ `).trim();function nh(e,t){let n=th(t);return!n||e.at(-1)===n?e:[...e,n].slice(-100)}function rh(e,t){return e.defaultPrevented||e.isComposing||e.keyCode===229||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey||t.start!==t.end?null:e.key===`ArrowUp`&&!t.text.slice(0,t.start).includes(`
85
86
  `)?-1:e.key===`ArrowDown`&&!t.text.slice(t.end).includes(`
86
- `)?1:null}var ym=class{snapshot=[];index=0;draft=null;reset(){this.draft=null,this.snapshot=[],this.index=0}move(e,t,n){if(!this.draft){if(e===1||!n.length)return null;this.draft={...t},this.snapshot=[...n],this.index=n.length}let r=Math.max(0,this.index+e);if(r===this.index)return null;if(r>=this.snapshot.length){let e=this.draft;return this.reset(),e}this.index=r;let i=this.snapshot[r];return{text:i,start:i.length,end:i.length}}},bm=new Map,xm=e=>`prompt-history:${e}`;function Sm(e){let t=bm.get(e);if(!t){t=[];try{let n=JSON.parse(localStorage.getItem(xm(e))||`[]`);Array.isArray(n)&&(t=n.filter(e=>typeof e==`string`&&!!e.trim()).slice(-100))}catch{}bm.set(e,t)}return t}function Cm(e,t){let n=_m(Sm(e),t);bm.set(e,n);try{localStorage.setItem(xm(e),JSON.stringify(n))}catch{}}function wm(e){return e.split(`
87
- `).map(e=>{let t=e.startsWith(`↳`)?qi(e):null;return t?{ref:!0,head:t.head,text:t.ref.excerpt,tail:t.tail}:{ref:!1,head:``,text:e,tail:``}})}var Tm=`fontFamily.fontSize.fontWeight.fontStyle.fontStretch.fontVariant.fontKerning.fontFeatureSettings.fontVariationSettings.fontVariantLigatures.fontOpticalSizing.lineHeight.letterSpacing.wordSpacing.textTransform.textIndent.textRendering.tabSize.whiteSpace.overflowWrap.wordBreak.hyphens.direction.paddingTop.paddingRight.paddingBottom.paddingLeft.borderTopWidth.borderRightWidth.borderBottomWidth.borderLeftWidth.boxSizing`.split(`.`);function Em(e){let t=e.parentElement,n=document.createElement(`div`);n.className=`qm-mirror`,n.setAttribute(`aria-hidden`,`true`);let r=document.createElement(`div`);n.append(r),t.insertBefore(n,e),t.classList.add(`qm-host`),e.classList.add(`qm-on`);let i=!0;function a(){r.style.transform=`translateY(${-e.scrollTop}px)`}function o(){if(!i)return;let t=getComputedStyle(e);for(let e of Tm)n.style[e]=t[e];n.style.borderStyle=`solid`,n.style.borderColor=`transparent`;let r=e.offsetWidth-e.clientWidth-parseFloat(t.borderLeftWidth)-parseFloat(t.borderRightWidth);n.style.paddingRight=`${parseFloat(t.paddingRight)+Math.max(0,r)}px`,n.style.top=`${e.offsetTop}px`,n.style.left=`${e.offsetLeft}px`,n.style.width=`${e.offsetWidth}px`,n.style.height=`${e.offsetHeight}px`,n.style.setProperty(`--qm-pl`,t.paddingLeft),n.style.setProperty(`--qm-pr`,n.style.paddingRight),a()}function s(){r.textContent=``;for(let t of wm(e.value)){let e=document.createElement(`div`);if(t.ref){e.className=`qm-q`;let n=document.createElement(`span`);n.className=`qm-a`,n.textContent=t.head.slice(0,1);let r=document.createElement(`span`);r.className=`qm-h`,r.textContent=t.head.slice(1);let i=document.createElement(`span`);i.className=`qm-h`,i.textContent=t.tail,e.append(n,r,t.text,i)}else e.append(t.text||`​`);r.append(e)}o()}e.addEventListener(`input`,s),e.addEventListener(`scroll`,a,{passive:!0});let c=new ResizeObserver(o);return c.observe(e),document.fonts?.ready.then(o),s(),{render:s,destroy(){i=!1,c.disconnect(),e.removeEventListener(`input`,s),e.removeEventListener(`scroll`,a),e.classList.remove(`qm-on`),t.classList.remove(`qm-host`),n.remove()}}}function Dm(e,t,n,r=20){return t>=e.left-r&&t<=e.right+r&&n>=e.top-r&&n<=e.bottom+r}function Om(e){let t=null,n=()=>{t!==null&&e.press?.(!1),t=null};return{start(r){n();let i=r.changedTouches[0];r.touches.length===1&&i&&e.enabled()&&(r.preventDefault(),t=i.identifier,e.press?.(!0))},end(r){if(t===null)return;let i=Array.from(r.changedTouches).find(e=>e.identifier===t);if(!i)return;n(),r.preventDefault();let a=r.currentTarget;a&&Dm(a.getBoundingClientRect(),i.clientX,i.clientY,e.slop)&&e.enabled()&&e.run()},cancel:n}}function km(e){let t=new DOMParser().parseFromString(e,`text/html`).body,n=``,r=0,i=e=>{r=Math.max(r,e)};function a(e){if(e){if(n&&r){let e=n.match(/\n*$/)[0].length;n+=`
87
+ `)?1:null}var ih=class{snapshot=[];index=0;draft=null;reset(){this.draft=null,this.snapshot=[],this.index=0}move(e,t,n){if(!this.draft){if(e===1||!n.length)return null;this.draft={...t},this.snapshot=[...n],this.index=n.length}let r=Math.max(0,this.index+e);if(r===this.index)return null;if(r>=this.snapshot.length){let e=this.draft;return this.reset(),e}this.index=r;let i=this.snapshot[r];return{text:i,start:i.length,end:i.length}}},ah=new Map,oh=e=>`prompt-history:${e}`;function sh(e){let t=ah.get(e);if(!t){t=[];try{let n=JSON.parse(localStorage.getItem(oh(e))||`[]`);Array.isArray(n)&&(t=n.filter(e=>typeof e==`string`&&!!e.trim()).slice(-100))}catch{}ah.set(e,t)}return t}function ch(e,t){let n=nh(sh(e),t);ah.set(e,n);try{localStorage.setItem(oh(e),JSON.stringify(n))}catch{}}function lh(e){return e.split(`
88
+ `).map(e=>{let t=e.startsWith(`↳`)?_r(e):null;return t?{ref:!0,head:t.head,text:t.ref.excerpt,tail:t.tail}:{ref:!1,head:``,text:e,tail:``}})}var uh=`fontFamily.fontSize.fontWeight.fontStyle.fontStretch.fontVariant.fontKerning.fontFeatureSettings.fontVariationSettings.fontVariantLigatures.fontOpticalSizing.lineHeight.letterSpacing.wordSpacing.textTransform.textIndent.textRendering.tabSize.whiteSpace.overflowWrap.wordBreak.hyphens.direction.paddingTop.paddingRight.paddingBottom.paddingLeft.borderTopWidth.borderRightWidth.borderBottomWidth.borderLeftWidth.boxSizing`.split(`.`);function dh(e){let t=e.parentElement,n=document.createElement(`div`);n.className=`qm-mirror`,n.setAttribute(`aria-hidden`,`true`);let r=document.createElement(`div`);n.append(r),t.insertBefore(n,e),t.classList.add(`qm-host`),e.classList.add(`qm-on`);let i=!0;function a(){r.style.transform=`translateY(${-e.scrollTop}px)`}function o(){if(!i)return;let t=getComputedStyle(e);for(let e of uh)n.style[e]=t[e];n.style.borderStyle=`solid`,n.style.borderColor=`transparent`;let r=e.offsetWidth-e.clientWidth-parseFloat(t.borderLeftWidth)-parseFloat(t.borderRightWidth);n.style.paddingRight=`${parseFloat(t.paddingRight)+Math.max(0,r)}px`,n.style.top=`${e.offsetTop}px`,n.style.left=`${e.offsetLeft}px`,n.style.width=`${e.offsetWidth}px`,n.style.height=`${e.offsetHeight}px`,n.style.setProperty(`--qm-pl`,t.paddingLeft),n.style.setProperty(`--qm-pr`,n.style.paddingRight),a()}function s(){r.textContent=``;for(let t of lh(e.value)){let e=document.createElement(`div`);if(t.ref){e.className=`qm-q`;let n=document.createElement(`span`);n.className=`qm-a`,n.textContent=t.head.slice(0,1);let r=document.createElement(`span`);r.className=`qm-h`,r.textContent=t.head.slice(1);let i=document.createElement(`span`);i.className=`qm-h`,i.textContent=t.tail,e.append(n,r,t.text,i)}else e.append(t.text||`​`);r.append(e)}o()}e.addEventListener(`input`,s),e.addEventListener(`scroll`,a,{passive:!0});let c=new ResizeObserver(o);return c.observe(e),document.fonts?.ready.then(o),s(),{render:s,destroy(){i=!1,c.disconnect(),e.removeEventListener(`input`,s),e.removeEventListener(`scroll`,a),e.classList.remove(`qm-on`),t.classList.remove(`qm-host`),n.remove()}}}var fh=1500;function ph(e,t){let n=e.at!==null&&t-e.at>=0&&t-e.at<1500;return e.at=n?null:t,n}function mh(e){let t=new DOMParser().parseFromString(e,`text/html`).body,n=``,r=0,i=e=>{r=Math.max(r,e)};function a(e){if(e){if(n&&r){let e=n.match(/\n*$/)[0].length;n+=`
88
89
  `.repeat(Math.max(0,r-e))}r=0,n+=e}}function o(e,t=!1){if(e.nodeType===3){let n=e.textContent||``;if(r&&!n.trim()&&!t)return;a(t?n:n.replace(/[\t\n\r ]+/g,` `));return}if(e.nodeType!==1)return;let n=e;if([`SCRIPT`,`STYLE`,`TEMPLATE`].includes(n.tagName))return;if(n.tagName===`BR`){a(`
89
- `);return}let s=n.tagName===`P`?2:+!!/^(ADDRESS|ARTICLE|ASIDE|BLOCKQUOTE|CAPTION|CENTER|DD|DETAILS|DIALOG|DIV|DL|DT|FIELDSET|FIGCAPTION|FIGURE|FOOTER|FORM|HEADER|HR|LI|MAIN|MENU|NAV|OL|PRE|SECTION|SUMMARY|TABLE|TBODY|TD|TFOOT|TH|THEAD|TR|UL|H[1-6])$/.test(n.tagName);s&&i(s);for(let e of n.childNodes)o(e,t||n.tagName===`PRE`);s&&i(s)}for(let e of t.childNodes)o(e);return n}var Am=[`data-agent`],jm={class:`restart-text`},Mm={class:`restart-text`},Nm={class:`restart-text`},Pm={class:`restart-text`},Fm={class:`restart-text`},Im=[`disabled`],Lm={key:5,class:`composer-notice codex-field`,role:`status`},Rm=[`title`],zm=[`disabled`,`title`],Bm={class:`notice-label`},Vm=[`aria-label`],Hm=[`aria-selected`,`onMousemove`,`onClick`],Um={class:`slash-name`},Wm={key:0},Gm={class:`slash-desc`},Km={key:1,class:`slash-denied`,role:`status`},qm={class:`slash-denied-label`},Jm={class:`dir-denied-path`},Ym={key:7,class:`composer-ask-anchor`},Xm=[`aria-label`],Zm={class:`composer-quotes-label`},Qm={class:`composer-quote-text`},$m=[`aria-label`,`onClick`],eh={class:`attachments`},th=[`aria-label`,`onClick`,`onKeydown`],nh=[`src`],rh={key:0,class:`spinner`},ih=[`aria-label`,`onClick`],ah=[`aria-label`],oh={key:2,class:`prompt-hint`},sh={key:3,class:`prompt-hint`},ch={key:4,class:`prompt-hint`},lh=[`title`],uh={class:`composer-status-line`},dh={key:0,class:`composer-status-meters`},fh=Object.assign(T({__name:`Composer`,props:{pane:{},paneId:{},sendKeys:{type:Function},conversation:{type:Boolean},escStops:{type:Boolean},takeBack:{type:Boolean},unanswered:{},termShown:{type:Boolean}},emits:[`sent`,`showTerminal`,`showUnanswered`],setup(e,{expose:t,emit:i}){let o=e,s=i,c=n(()=>Q(`Text typed in Codex’s terminal, or arrived there by mistake: your next message would be sent after it.`,`Texte tapé dans le terminal de Codex, ou arrivé là par erreur : ton prochain message serait envoyé à sa suite.`)),l=h(!1);async function u(){l.value=!0;try{await o.sendKeys(Array.from({length:10},()=>[`ctrl+u`,`backspace`]).flat())}finally{l.value=!1}}let d=n(()=>/\b(failed|error)\b/i.test(o.pane?.claudeNotice||``)),p=n(()=>!!(o.pane?.claudeNotice&&/Restart to update/i.test(o.pane.claudeNotice)&&ue(o.pane))),b=n(()=>{let e=o.pane?.restart;if(!e)return``;let t=$r(e.agent);return e.update&&e.phase===`stopping`?Q(`Exiting ${t}…`,`Fermeture de ${t}…`):e.phase===`updating`?Q(`Updating ${t} in its terminal…`,`Mise à jour de ${t} dans son terminal…`):e.phase===`stopping`?Q(`Stopping ${t}…`,`Arrêt de ${t}…`):Q(`Restarting ${t} on the same conversation…`,`Relance de ${t} sur la même conversation…`)});async function C(){let e=o.pane?.restart?.update;if(e)try{await navigator.clipboard.writeText(e),$(Q(`Command copied: paste it into the terminal of this pane.`,`Commande copiée : colle-la dans le terminal de ce panneau.`))}catch{$(Z(`Copy failed`),!0)}}let T=an(o.paneId),D=S(T,`text`),O=h(null),A=n(()=>O.value?.textareaRef||null),F=h(null),L=h(null),R=h(!1),z=n(()=>Wi({desk:Hi.value,touch:!!(Jr||wi),tablet:Gi.value,hardwareKeyboard:fr.value,softKeyboard:zn.value})),V=S(T,`atts`),W=n(()=>Ir(D.value)),ee=null;B([()=>ui.value===`native`&&W.value.length>0,A],([e,t])=>{ee&&(!e||!t)&&(ee.destroy(),ee=null),e&&t&&!ee&&(ee=Em(t))},{immediate:!0,flush:`post`}),B(D,()=>P(()=>ee?.render()),{flush:`post`}),U(()=>{ee?.destroy(),ee=null});let K=n(()=>!!(D.value.trim()||V.value.length)),q=n(()=>!!(o.pane?.stopped||o.pane?.prompt?.unavailable)||!zi.value||Sr.value||Qr(o.pane)),ne=n(()=>!!(o.pane&&o.pane.agent===`omp`&&o.pane.ompShell&&o.pane.status!==`working`)),J=n(()=>!(q.value||!o.pane||!o.pane.agent||o.pane.status!==`working`&&!ne.value||K.value)),ie=n(()=>!q.value&&!K.value&&o.pane?.claudeSuggestion||null),ae=n(()=>!(!ie.value||z.value));function oe(){let e=ie.value;e&&(D.value=e,ft())}let se=h(null),ce=h(0);B(ae,()=>P(()=>{ce.value=se.value?se.value.offsetWidth+16:0}),{immediate:!0});function de(){let e=ie.value;if(!e)return;let t=!!(A.value&&document.activeElement===A.value);D.value=e,t&&ft()}let fe=n(()=>{let e=o.pane;return e?e.status===`blocked`?Z(`Type a reply…`):ie.value?ie.value:e.agent?Q(`Message to ${$r(e.agent)}…`,`Message à ${$r(e.agent)}…`):Z(`Command…`):Z(`Message to agent…`)});function pe(e){if(it.value&&!e.isComposing){let t=rt.value.length;if(e.key===`ArrowDown`){e.preventDefault(),at=`kb`,Qe.value=(Qe.value+1)%t;return}if(e.key===`ArrowUp`){e.preventDefault(),at=`kb`,Qe.value=(Qe.value-1+t)%t;return}if(e.key===`Escape`){e.preventDefault(),$e.value=!0;return}if(e.key===`Tab`||z.value&&e.key===`Enter`&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),st(rt.value[Qe.value]||rt.value[0]);return}}if(e.key===`Tab`&&!e.shiftKey&&!e.isComposing&&ie.value&&!D.value){e.preventDefault(),oe();return}z.value&&e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&!D.value.trim()&&(e.preventDefault(),Te())}let me=new ym;function he(e){let t=A.value;if(!t||e.target!==t||it.value||R.value)return;let n={text:t.value,start:t.selectionStart,end:t.selectionEnd},r=vm(e,n);if(r===null)return;let i=me.move(r,n,Sm(o.paneId));i&&(e.preventDefault(),D.value=i.text,$e.value=!0,P(()=>{$e.value=!0,t.setSelectionRange(i.start,i.end)}))}w(()=>window.addEventListener(`keydown`,he)),U(()=>{window.removeEventListener(`keydown`,he),me.draft&&(D.value=me.draft.text)});function ge(e){Cm(o.paneId,e),me.reset()}function _e(e){e.preventDefault(),Te()}let ve=n(()=>q.value||!K.value&&!J.value||R.value||Ee.value===`running`),xe=h(!1),Se=Om({enabled:()=>J.value||!ve.value,run:()=>{J.value?ke():Te()},press:e=>{xe.value=e}}),we=n(()=>Hi.value&&!J.value);async function Te(){if(q.value)return $(Z(`Sending unavailable offline`),!0);if(J.value)return ke();if(V.value.some(e=>!e.paste&&!e.path))return $(Z(V.value.some(e=>!e.path&&e.file)?`File is uploading…`:`Photo is uploading…`));let e=V.value.flatMap(e=>e.paste?[e.paste]:[]),t=V.value.flatMap(e=>e.paste?[]:[e.ref||e.path]),n=D.value,r=Fe(n,e,t);if(!r||R.value)return;let i=o.pane,a=i&&i.status===`blocked`?i.prompt:null,c=a?a.options.findIndex(e=>e.free):-1;if(c<0&&vt(i)&&!Rc(r)){ge(n),D.value=``,Me(),Ge(e),X(),s(`sent`,null),Jn(i,o.paneId,r).then(()=>s(`sent`,null),e=>$(e.message,!0));return}R.value=!0,Ge(e);try{let e=null;if(a&&c>=0){if(!await Ce(o.paneId,c,a.options[c].label,a.identity,{text:r,question:a.question}))return}else e=await je(i,o.paneId,r);ge(n),D.value=``,Me(),X(),s(`sent`,e);let l=r.split(/\s/)[0],u=qe.get(o.paneId)?.list||Je.value;c<0&&i&&i.agent&&!t.length&&/^\/\S+$/.test(l)&&!r.includes(`
90
- `)&&!be(l,u)&&ye(o.paneId,l,u.some(e=>e.source===`builtin`&&`/${e.name}`===l))}catch(e){$(e.message,!0)}finally{R.value=!1}}let Ee=h(null),Oe=h(!1);async function ke(){if(Ee.value!==`running`){X(),Ee.value=`running`,Oe.value=ne.value;try{let e=await gi(`/api/interrupt`,{pane_id:o.paneId,restore:!!o.takeBack});if(Ee.value=e.stopped?null:`failed`,Oe.value=!!e.shell,e.shell){e.stopped&&$(Q(`Command cancelled`,`Commande annulée`));return}if(e.restored!==void 0){Gn(T,e.restored),ft();let t=Q(`Stopped: your message is back in the field`,`Arrêté : ton message est revenu dans le champ`);e.lost?$(t,!0,Vn(e.lost)):$(t)}else e.stopped&&$(e.background?Q(`Agent stopped (${e.background} background task${e.background>1?`s`:``} stopped)`,`Agent arrêté (${e.background} tâche${e.background>1?`s`:``} de fond arrêtée${e.background>1?`s`:``})`):Z(`Agent stopped`))}catch(e){Ee.value=null,$(e.message,!0)}}}B(()=>o.pane?.status,e=>{Ee.value===`failed`&&!Oe.value&&e!==`working`&&(Ee.value=null)}),B(ne,e=>{Ee.value===`failed`&&Oe.value&&!e&&(Ee.value=null)});function Ae(){return!o.escStops||!J.value||R.value||Ee.value===`running`?!1:(ke(),A.value?.focus(),!0)}function Me(){for(let e of V.value)e.url&&URL.revokeObjectURL(e.url);V.value=[]}function Ne(e){Xe.value=e.url}function Pe(e){let[t]=V.value.splice(e,1);t&&t.url&&URL.revokeObjectURL(t.url)}B(()=>V.value.length,()=>P(Un)),B(D,()=>P(()=>{let e=A.value;!e||e.scrollHeight<=e.clientHeight||document.activeElement!==e||e.selectionEnd>=e.value.length-1&&(e.scrollTop=e.scrollHeight)}));async function Ie(e){for(let t of e){let e=r({url:URL.createObjectURL(t),path:null});V.value.push(e);try{let n=await Sf(o.paneId,t);e.path=n.path,e.name=n.name}catch(t){$(`${Z(`Photo upload failed`)} : ${t.message}`,!0),V.value=V.value.filter(t=>t!==e),URL.revokeObjectURL(e.url)}}}async function Le(e){let t=o.pane,{images:n,files:r,refused:i}=await Kn(e,t?.agent);if(i.length){let e=$r(t?.agent),n=i.map(e=>e.file.name).join(`, `),r=[...new Set(i.map(t=>Fn(t.reason,e,t.kind)))];$(Q(`Not attached: ${n}`,`Non joint : ${n}`),!0,r.join(` · `))}n.length&&Ie(n);for(let e of r)Re(e.file,e.kind);return n.length+r.length}async function Re(e,t){let n=r({url:``,path:null,file:{label:e.name,size:e.size,kind:t}});V.value.push(n);try{let t=await fetch(`/api/attach?pane=${encodeURIComponent(o.paneId)}&name=${encodeURIComponent(e.name)}`,{method:`POST`,headers:{"content-type":`application/octet-stream`},body:e}),r=await t.json().catch(()=>({}));if(!t.ok)throw Error(Z(r.error||`HTTP ${t.status}`));n.path=r.path,n.name=r.name,n.ref=r.ref}catch(t){$(`${e.name} : ${Z(`File upload failed`)} — ${t.message}`,!0),V.value=V.value.filter(e=>e!==n)}}function ze(e){let t=e.target,n=[...t.files||[]];t.value=``,Le(n)}function Be(e){He(e,e.clipboardData)}function Ve(e){e.inputType===`insertFromPaste`&&He(e,e.dataTransfer,e.data||``)}function He(e,t,n=``){let r=e.target,i=t?.getData(`text/plain`)||n||km(t?.getData(`text/html`)||``);if(Zi(e,t,i.length,r,()=>V.value.length),!e.cancelable)return;let a=[...t?.items||[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>!!e);if(a.length){e.preventDefault(),Le(a),X();return}if(!i)return;e.preventDefault();let o=i.replace(/\r\n?/g,`
91
- `);if(lt(o))return Ue(o);let s=Lr(o),c=r.value;if(!(document.activeElement===r&&typeof document.execCommand==`function`&&document.execCommand(`insertText`,!1,s))){let e=r.selectionStart??c.length;r.value=c.slice(0,e)+s+c.slice(r.selectionEnd??e),r.setSelectionRange(e+s.length,e+s.length),r.dispatchEvent(new Event(`input`,{bubbles:!0}))}D.value=r.value}function Ue(e){V.value.push({url:``,path:null,paste:e}),X()}async function We(){if(!navigator.clipboard||!navigator.clipboard.read)return $(Z(`Clipboard unavailable here — paste into the message field.`),!0);try{let e=[];for(let t of await navigator.clipboard.read()){let n=t.types.find(e=>e.startsWith(`image/`));n&&e.push(new File([await t.getType(n)],`presse-papiers.${n.split(`/`)[1]}`,{type:n}))}if(!e.length)return $(Z(`No image in the clipboard`),!0);Ie(e)}catch(e){let t=e;$(t.name===`NotAllowedError`?Z(`Paste denied`):`${Z(`Paste failed`)} : ${t.message}`,!0)}}let qe=new Map,Je=h([]),Ye=h(null),Qe=h(0),$e=h(!1),et=h(null),tt=n(()=>{let e=/^\/(\S*)$/.exec(D.value);return o.pane&&o.pane.agent&&e?e[1].toLowerCase():null});async function nt(){let e=o.paneId,t=qe.get(e);if(!(t&&(Je.value=t.list,Ye.value=t.denied,Date.now()-t.at<15e3)))try{let n=await gi(`/api/commands?pane=${encodeURIComponent(e)}`);if(n.partial&&t)return;let r=n.denied?{remote:!!n.remote}:null;n.partial||qe.set(e,{at:Date.now(),list:n.commands,denied:r}),e===o.paneId&&(Je.value=n.commands,Ye.value=r)}catch{}}B(tt,(e,t)=>{if(e===null){$e.value=!1;return}t??nt(),Qe.value=0}),B(()=>o.paneId,()=>{Je.value=[],Ye.value=null});let rt=n(()=>{let e=tt.value;if(e===null)return[];let t=[],n=[],r=[];for(let i of Je.value){let a=i.name.toLowerCase();a.startsWith(e)?t.push(i):a.includes(e)?n.push(i):e.length>1&&i.desc.toLowerCase().includes(e)&&r.push(i)}return[...t,...n,...r]}),it=n(()=>tt.value!==null&&!$e.value&&(rt.value.length>0||!!Ye.value)&&(rt.value.length!==1||rt.value[0].name.toLowerCase()!==tt.value)),at=``;function ot(e,t){let n=`${e.screenX},${e.screenY}`,r=at===`kb`;n!==at&&(at=n,!r&&(Qe.value=t))}function st(e){D.value=`/${e.name} `,X(),P(()=>A.value?.focus())}B(Qe,e=>P(()=>{(et.value?.children[e])?.scrollIntoView({block:`nearest`})}));let ct={claude:[[`/compact`,`Summarize context`],[`/clear`,`New conversation`],[`/context`,`Context usage`],[`/usage`,`Plan usage`],[`/model`,`Change model`],[`/review`,`Code review`]],codex:[[`/compact`,`Summarize context`],[`/new`,`New conversation`],[`/status`,`Session status`],[`/model`,`Change model`],[`/review`,`Code review`],[`/diff`,`View diff`]],omp:[[`/compact`,`Summarize context`],[`/new`,`New conversation`],[`/plan`,`Plan mode`],[`/model`,`Change model`],[`/fast`,`Priority service tier`]]};function ut(){let e=o.pane;if(!e)return;let t=[{label:Z(`Photo or screenshot`),icon:`i-lucide-image`,run:()=>F.value?.click()},{label:e.agent===`claude`?Z(`File (PDF, text, code)`):Z(`File (text, code)`),icon:`i-lucide-paperclip`,run:()=>L.value?.click()},{label:Z(`Paste copied image`),icon:`i-lucide-clipboard-paste`,run:We}];if(e.agent){t.push({kind:`separator`}),t.push({kind:`command`,cmd:`esc`,desc:Z(`Interrupt agent`),run:()=>o.sendKeys([`esc`])});for(let[n,r]of ct[e.agent]||[])t.push({kind:`command`,cmd:n,desc:Z(r),run:()=>dt(n)});t.push({kind:`note`,label:Z(`Commands that open a menu (model…) can then be controlled in the Terminal tab.`)})}Pt(t)}async function dt(e,t=!0){try{await gi(`/api/prompt`,{pane_id:o.paneId,text:e}),Cm(o.paneId,e),X()}catch(e){return $(e.message,!0)}t&&ye(o.paneId,e)}function ft(){pt(null)}function pt(e){A.value?.focus(),P(()=>{let t=A.value;if(!t)return;t.focus();let n=e===null?t.value.length:Math.min(e,t.value.length);t.setSelectionRange(n,n),e===null&&(t.scrollTop=t.scrollHeight)})}function mt(e){z.value&&pt(e)}return t({focus:()=>A.value?.focus(),focusEnd:ft,focusAnswer:mt,blur:()=>A.value?.blur(),addImages:Ie,addFiles:Le,stop:Ae}),(t,n)=>{let r=Ke,i=Lp,o=nm,h=ho,S=ao,w=_t,T=um,A=Ze,P=fm,R=hm;return _(),v(`div`,{class:`composer`,"data-agent":e.pane?.agent||void 0},[f(Ee)?(_(),v(`div`,{key:0,class:j([`composer-notice restart`,{failed:f(Ee)===`failed`}]),role:`status`},[f(Ee)===`failed`?(_(),v(k,{key:0},[I(`span`,jm,M(f(Oe)?(`tl`in t?t.tl:f(Q))(`The command is still running.`,`La commande tourne encore.`):(`t`in t?t.t:f(Z))(`The agent is still working.`)),1),e.termShown?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:n[0]||=e=>s(`showTerminal`)},M((`t`in t?t.t:f(Z))(`View terminal`)),1)),I(`button`,{type:`button`,class:`notice-btn`,onClick:n[1]||=e=>Ee.value=null},M((`t`in t?t.t:f(Z))(`Hide`)),1)],64)):(_(),v(k,{key:1},[n[14]||=I(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),I(`span`,Mm,M(f(Oe)?(`tl`in t?t.tl:f(Q))(`Cancelling the command…`,`Annulation de la commande…`):(`t`in t?t.t:f(Z))(`Stopping…`)),1)],64))],2)):e.pane?.restart?(_(),v(`div`,{key:1,class:j([`composer-notice restart`,e.pane.restart.phase]),role:`status`},[e.pane.restart.phase===`failed`?(_(),v(k,{key:0},[I(`span`,Nm,M(e.pane.restart.update?(`t`in t?t.t:f(Z))(`Codex update failed`):(`t`in t?t.t:f(Z))(`Restart failed`))+M((`tl`in t?t.tl:f(Q))(`: `,` : `))+M((`t`in t?t.t:f(Z))(e.pane.restart.error||``)),1),e.termShown?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:n[2]||=e=>s(`showTerminal`)},M((`t`in t?t.t:f(Z))(`View terminal`)),1)),e.pane.restart.update?(_(),v(`button`,{key:1,type:`button`,class:`notice-btn`,onClick:C},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Z))(`Copy command`)),1)])):g(``,!0),I(`button`,{type:`button`,class:`notice-btn`,onClick:n[3]||=n=>(`dismissRestart`in t?t.dismissRestart:f(le))(e.paneId)},M((`t`in t?t.t:f(Z))(`Hide`)),1)],64)):(_(),v(k,{key:1},[n[15]||=I(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),I(`span`,Pm,M(f(b)),1)],64))],2)):e.conversation&&e.pane?.usageLimit?(_(),m(i,{key:2,limit:e.pane.usageLimit,"read-only":f(q),"send-keys":e.sendKeys,onCredits:n[4]||=e=>dt(`/usage-credits`,!1)},null,8,[`limit`,`read-only`,`send-keys`])):e.pane?.claudeNotice?(_(),v(`div`,{key:3,class:j([`composer-notice`,{error:f(d)}]),role:`status`},[f(p)?(_(),v(k,{key:0},[I(`span`,Fm,M(e.pane.claudeNotice.replace(/\s*·\s*Restart to update\b.*$/,``))+` ·`,1),I(`button`,{type:`button`,class:`notice-btn`,disabled:f(q),onClick:n[5]||=n=>(`restartAgent`in t?t.restartAgent:f(De))(e.pane)},[E(r,{name:`i-lucide-rotate-cw`}),a(M((`t`in t?t.t:f(Z))(`Restart to update`)),1)],8,Im)],64)):(_(),v(k,{key:1},[a(M(f(d)&&!/^[✗✘]/.test(e.pane.claudeNotice)?`✘ ${e.pane.claudeNotice}`:e.pane.claudeNotice),1)],64))],2)):e.pane?.codexStatus?(_(),m(o,{key:4,pane:e.pane,"pane-id":e.paneId,"read-only":f(q)},null,8,[`pane`,`pane-id`,`read-only`])):g(``,!0),e.pane?.agent===`codex`&&e.pane.codexField&&!f(Ee)?(_(),v(`div`,Lm,[E(r,{name:`i-lucide-text-cursor-input`,class:`notice-icon`}),I(`span`,{class:`restart-text`,title:f(c)},[a(M((`tl`in t?t.tl:f(Q))(`In Codex’s field:`,`Dans le champ de Codex :`))+` `,1),I(`code`,null,M(e.pane.codexField),1)],8,Rm),I(`button`,{type:`button`,class:`notice-btn`,disabled:f(q)||f(l),title:f(c),onClick:u},M((`tl`in t?t.tl:f(Q))(`Clear`,`Vider`)),9,zm),e.termShown?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:n[6]||=e=>s(`showTerminal`)},[E(r,{name:`i-lucide-terminal`}),I(`span`,Bm,M((`t`in t?t.t:f(Z))(`View terminal`)),1)]))])):g(``,!0),f(it)?(_(),v(`div`,{key:6,class:`slash-menu`,role:`listbox`,"aria-label":(`t`in t?t.t:f(Z))(`Commands`)},[f(rt).length?(_(),v(`div`,{key:0,ref_key:`slashListEl`,ref:et,class:`slash-list`},[(_(!0),v(k,null,y(f(rt),(e,t)=>(_(),v(`button`,{key:e.name,type:`button`,role:`option`,class:j([`slash-item`,{on:t===f(Qe)}]),"aria-selected":t===f(Qe),onMousedown:n[7]||=re(()=>{},[`prevent`]),onMousemove:e=>ot(e,t),onClick:t=>st(e)},[I(`span`,Um,[a(`/`+M(e.name),1),e.hint?(_(),v(`small`,Wm,M(e.hint),1)):g(``,!0)]),I(`span`,Gm,M(e.desc),1)],42,Hm))),128))],512)):g(``,!0),f(Ye)?(_(),v(`div`,Km,[I(`p`,qm,[E(r,{name:`i-lucide-shield-alert`}),a(M((`tl`in t?t.tl:f(Q))(`macOS hides this project’s commands`,`macOS masque les commandes de ce projet`)),1)]),I(`p`,null,[a(M((`tl`in t?t.tl:f(Q))(`Typed in full, they still work. To list them, on the Mac:`,`Tapées en entier, elles marchent quand même. Pour les lister, sur le Mac :`))+` `,1),I(`span`,Jm,M(f(Ye).remote?(`tl`in t?t.tl:f(Q))(`System Settings › General › Sharing › Remote Login ⓘ › “Allow full disk access for remote users”`,`Réglages Système › Général › Partage › Session à distance ⓘ › « Autoriser l’accès complet au disque pour les utilisateurs distants »`):(`tl`in t?t.tl:f(Q))(`System Settings › Privacy & Security › Full Disk Access`,`Réglages Système › Confidentialité et sécurité › Accès complet au disque`)),1)])])):g(``,!0)],8,Vm)):g(``,!0),e.unanswered&&!f(q)?(_(),v(`div`,Ym,[I(`button`,{type:`button`,class:`composer-ask`,onMousedown:n[8]||=re(()=>{},[`prevent`]),onClick:n[9]||=e=>s(`showUnanswered`)},[E(r,{name:`i-lucide-arrow-up`}),I(`span`,null,M(e.unanswered>1?(`tl`in t?t.tl:f(Q))(`${e.unanswered} questions unanswered`,`${e.unanswered} questions sans réponse`):(`tl`in t?t.tl:f(Q))(`1 question unanswered`,`1 question sans réponse`)),1)],32)])):g(``,!0),f(W).length?(_(),v(`div`,{key:8,class:`composer-quotes`,role:`list`,"aria-label":(`t`in t?t.t:f(Z))(`Quoted questions`)},[I(`span`,Zm,`↳ `+M(f(W).length),1),(_(!0),v(k,null,y(f(W),e=>(_(),v(`span`,{key:e.start,class:`composer-quote`,role:`listitem`},[I(`span`,Qm,M(e.excerpt),1),I(`button`,{type:`button`,class:`composer-quote-x`,"aria-label":(`t`in t?t.t:f(Z))(`Remove quote`),onMousedown:n[10]||=re(()=>{},[`prevent`]),onClick:t=>D.value=f(Xi)(f(D),e)},[E(r,{name:`i-lucide-x`})],40,$m)]))),128))],8,Xm)):g(``,!0),E(R,{ref_key:`promptRef`,ref:O,modelValue:f(D),"onUpdate:modelValue":n[13]||=e=>G(D)?D.value=e:null,disabled:!!e.pane?.stopped,placeholder:e.pane?.stopped?(`t`in t?t.t:f(Z))(`Restart Codex before sending a message`):f(q)?(`t`in t?t.t:f(Z))(`Draft saved — sending unavailable offline`):f(fe),variant:`outline`,color:`neutral`,rows:1,maxrows:7,autofocus:!1,"submit-on-enter":f(z)&&!f(it),enterkeyhint:f(z)?`send`:`enter`,autocapitalize:`sentences`,class:j([`prompt`,{suggesting:f(ae)}]),style:N(f(ce)?{"--suggest-room":`${f(ce)}px`}:void 0),ui:{header:`prompt-head`,body:`prompt-body`,base:`prompt-input`,footer:`prompt-foot`},onSubmit:Te,onKeydown:pe,onPaste:Be,onBeforeinput:Ve},x({footer:H(()=>[n[20]||=I(`span`,{class:`fx-ring`,"aria-hidden":`true`},[I(`span`,{class:`fx-spin`})],-1),n[21]||=I(`span`,{class:`fx-halo`,"aria-hidden":`true`},[I(`span`,{class:`fx-spin`})],-1),f(ae)?(_(),v(`button`,{key:0,ref_key:`suggestBtn`,ref:se,type:`button`,class:`prompt-suggest`,"aria-label":(`t`in t?t.t:f(Z))(`Use suggestion`),onMousedown:n[11]||=re(()=>{},[`prevent`]),onClick:de},[E(r,{name:`i-lucide-corner-down-left`}),I(`span`,null,M((`tl`in t?t.tl:f(Q))(`Use`,`Utiliser`)),1)],40,ah)):g(``,!0),E(w,{icon:`i-lucide-plus`,color:`neutral`,variant:`outline`,size:`sm`,class:`prompt-plus`,disabled:f(q),"aria-label":(`t`in t?t.t:f(Z))(`Photo, file, paste, commands`),onClick:ut},null,8,[`disabled`,`aria-label`]),I(`input`,{ref_key:`fileInput`,ref:F,type:`file`,accept:`image/*`,multiple:``,hidden:``,onChange:ze},null,544),I(`input`,{ref_key:`anyFileInput`,ref:L,type:`file`,multiple:``,hidden:``,"data-testid":`attach-any`,onChange:ze},null,544),e.pane&&(e.pane.agent===`claude`||e.pane.agent===`codex`||e.pane.agent===`omp`)?(_(),m(T,{key:1,pane:e.pane},null,8,[`pane`])):g(``,!0),f(we)&&f(ie)?(_(),v(`span`,oh,[E(A,{value:`tab`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Z))(`suggestion`))+` `,1),n[16]||=I(`span`,{class:`sep`},`·`,-1),n[17]||=a(),E(A,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Z))(`send`)),1)])):f(we)?(_(),v(`span`,sh,[E(A,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Z))(`send`))+` `,1),n[18]||=I(`span`,{class:`sep`},`·`,-1),n[19]||=a(),E(A,{value:`shift`,size:`sm`}),E(A,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Z))(`new line`)),1)])):(`desk`in t?t.desk:f(Hi))&&e.escStops&&f(J)&&f(Ee)!==`running`?(_(),v(`span`,ch,[E(A,{value:`escape`,size:`sm`}),a(` `+M((`tl`in t?t.tl:f(Q))(`stop`,`arrêter`)),1)])):g(``,!0),E(P,{status:f(J)?`streaming`:`ready`,disabled:f(ve),color:`primary`,variant:`solid`,"streaming-color":`neutral`,"streaming-variant":`solid`,"streaming-icon":`i-herdr-stop`,size:`sm`,class:j([`prompt-send`,{stop:f(J),pressed:f(xe)}]),"aria-label":f(J)&&f(ne)?(`tl`in t?t.tl:f(Q))(`Cancel the command`,`Annuler la commande`):(`t`in t?t.t:f(Z))(f(J)?`Stop the agent`:`Send`),onMousedown:n[12]||=re(()=>{},[`prevent`]),onClick:_e,onStop:ke,onTouchstart:f(Se).start,onTouchend:f(Se).end,onTouchcancel:f(Se).cancel},null,8,[`status`,`disabled`,`class`,`aria-label`,`onTouchstart`,`onTouchend`,`onTouchcancel`])]),_:2},[f(V).length?{name:`header`,fn:H(()=>[I(`div`,eh,[(_(!0),v(k,null,y(f(V),(e,n)=>(_(),v(k,{key:e.url||e.path||e.file?.label||`paste:${n}`},[e.paste?(_(),m(h,{key:0,text:e.paste,removable:``,onRemove:e=>Pe(n)},null,8,[`text`,`onRemove`])):e.file?(_(),m(S,{key:1,name:e.file.label,size:e.file.size,kind:e.file.kind,uploading:!e.path,removable:``,onRemove:e=>Pe(n)},null,8,[`name`,`size`,`kind`,`uploading`,`onRemove`])):(_(),v(`div`,{key:2,class:j([`att`,{up:!e.path}]),role:`button`,tabindex:`0`,"aria-label":(`t`in t?t.t:f(Z))(`View image`),onClick:t=>Ne(e),onKeydown:te(re(t=>Ne(e),[`self`]),[`enter`])},[I(`img`,{src:e.url,alt:``},null,8,nh),e.path?g(``,!0):(_(),v(`span`,rh)),I(`button`,{type:`button`,"aria-label":(`t`in t?t.t:f(Z))(`Remove`),onClick:re(e=>Pe(n),[`stop`])},[E(r,{name:`i-lucide-x`})],8,ih)],42,th))],64))),128))])]),key:`0`}:void 0]),1032,[`modelValue`,`disabled`,`placeholder`,`submit-on-enter`,`enterkeyhint`,`class`,`style`]),e.pane?.ompStatus?(_(),v(`div`,{key:9,class:`composer-status`,title:[e.pane.ompStatus.line,e.pane.ompStatus.meters].filter(Boolean).join(`
92
- `)},[I(`span`,uh,M(e.pane.ompStatus.line),1),e.pane.ompStatus.meters?(_(),v(`span`,dh,M(e.pane.ompStatus.meters),1)):g(``,!0)],8,lh)):g(``,!0)],8,Am)}}}),{__name:`Composer`}),ph=[`aria-label`],mh={class:`review-note-head`},hh={class:`review-range`},gh={key:0,class:`review-path`},_h={key:0,class:`review-warning`,role:`status`},vh=[`id`,`value`,`placeholder`,`aria-label`],yh={class:`review-note-actions`},bh={class:`review-keys`,"aria-hidden":`true`},xh=[`disabled`],Sh={class:`review-body`},Ch={class:`review-note-actions`},wh=[`aria-label`],Th=[`aria-label`],Eh=Object.assign(T({__name:`ReviewNote`,props:{comment:{},label:{},missing:{type:Boolean},changed:{type:Boolean}},emits:[`act`,`hover`],setup(e,{emit:t}){let r=e,i=t,a=n(()=>r.comment.draft!==void 0),o=n(()=>r.comment.draft??``),s=n(()=>o.value.trim()!==r.comment.body.trim()),c=h(``);B(a,()=>{c.value=``});let l=/Mac|iPhone|iPad/.test(globalThis.navigator?.platform||``)?`⌘↵`:`Ctrl+↵`;function u(e){c.value=``,i(`act`,`draft`,r.comment.id,e.target.value)}function d(){o.value.trim()&&i(`act`,`save`,r.comment.id)}function p(){if(s.value&&c.value!==`cancel`){c.value=`cancel`;return}i(`act`,`cancel`,r.comment.id)}function m(){if(c.value!==`remove`){c.value=`remove`;return}i(`act`,`remove`,r.comment.id)}function y(e){if(!e.isComposing){if(e.key===`Escape`&&(a.value||c.value))e.preventDefault(),e.stopPropagation(),a.value?p():c.value=``;else if(a.value)e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),d());else return}}return(t,n)=>(_(),v(`div`,{class:j([`review-note`,{missing:e.missing,editing:f(a)}]),role:`group`,"aria-label":`${e.label}: ${(`t`in t?t.t:f(Z))(`review comment`)}`,onKeydown:y,onMouseenter:n[3]||=t=>i(`hover`,e.comment.id),onMouseleave:n[4]||=e=>i(`hover`,null),onFocusin:n[5]||=t=>i(`hover`,e.comment.id),onFocusout:n[6]||=e=>i(`hover`,null)},[I(`div`,mh,[I(`span`,hh,M(e.label),1),e.missing?(_(),v(`span`,gh,M(e.comment.path),1)):g(``,!0)]),e.missing?(_(),v(`p`,_h,M(e.changed?(`t`in t?t.t:f(Z))(`The code of this block changed. Check this comment before sending.`):(`t`in t?t.t:f(Z))(`No longer in the diff. Check this comment before sending.`)),1)):g(``,!0),f(a)?(_(),v(k,{key:1},[I(`textarea`,{id:`review-${e.comment.id}`,value:f(o),placeholder:(`t`in t?t.t:f(Z))(`Write a review comment…`),"aria-label":`${e.label}: ${(`t`in t?t.t:f(Z))(`review comment`)}`,rows:`3`,onInput:u,onFocus:n[0]||=e=>e.target.scrollIntoView({block:`nearest`})},null,40,vh),I(`div`,yh,[I(`span`,bh,M(f(l))+` `+M((`t`in t?t.t:f(Z))(`to save`))+` · Esc `+M((`t`in t?t.t:f(Z))(`to cancel`)),1),I(`button`,{type:`button`,class:j([`review-btn`,{armed:f(c)===`cancel`}]),onClick:p},M(f(c)===`cancel`?(`t`in t?t.t:f(Z))(`Discard this text?`):(`t`in t?t.t:f(Z))(`Cancel`)),3),I(`button`,{type:`button`,class:`review-btn primary`,disabled:!f(o).trim(),onClick:d},M(e.comment.body?(`t`in t?t.t:f(Z))(`Save`):(`t`in t?t.t:f(Z))(`Comment`)),9,xh)])],64)):(_(),v(k,{key:2},[I(`p`,Sh,M(e.comment.body),1),I(`div`,Ch,[I(`button`,{type:`button`,class:`review-btn`,"aria-label":(`t`in t?t.t:f(Z))(`Edit comment`),onClick:n[1]||=t=>i(`act`,`edit`,e.comment.id)},M((`tl`in t?t.tl:f(Q))(`Edit`,`Modifier`)),9,wh),I(`button`,{type:`button`,class:j([`review-btn`,{armed:f(c)===`remove`}]),"aria-label":f(c)===`remove`?(`t`in t?t.t:f(Z))(`Confirm delete`):(`t`in t?t.t:f(Z))(`Delete comment`),onClick:m,onBlur:n[2]||=e=>c.value=``},M(f(c)===`remove`?(`t`in t?t.t:f(Z))(`Confirm delete`):(`t`in t?t.t:f(Z))(`Delete`)),43,Th)])],64))],42,ph))}}),{__name:`ReviewNote`});function Dh(e){let t=null,n=null;return e.map(e=>{let r=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(e.text);e.kind===`hunk`&&(t=r?Number(r[1]):null,n=r?Number(r[2]):null);let i=e.kind===`del`?`old`:`new`,a=[`add`,`del`,`context`].includes(e.kind)?i===`old`?t:n:null;return(e.kind===`del`||e.kind===`context`)&&t!==null&&t++,(e.kind===`add`||e.kind===`context`)&&n!==null&&n++,{...e,number:a,side:i}})}function Oh(e,t){let n=t,r=t;for(;n>0&&e[n-1].kind!==`hunk`;)n--;for(;r<e.length-1&&e[r+1].kind!==`hunk`;)r++;for(;n<t&&e[n].number===null;)n++;for(;r>t&&e[r].number===null;)r--;return[n,r]}function kh(e,t,n){let[r,i]=Oh(e,t),a=Math.min(Math.max(n,r),i);for(;a!==t&&e[a].number===null;)a+=a<t?1:-1;return t<=a?[t,a]:[a,t]}var Ah=e=>e.filter(e=>e.number!==null);function jh(e){let t={};for(let n of Ah(e)){let e=t[n.side];t[n.side]=e?[Math.min(e[0],n.number),Math.max(e[1],n.number)]:[n.number,n.number]}return t}var Mh=100;function Nh(e){let t=Ah(e).map(e=>e.text.trimEnd()).filter(e=>e.length>1);return(t.length>3?[t[0],`…`,t.at(-1)]:t).map(e=>e.length>Mh?`${e.slice(0,99)}…`:e)}function Ph(e){let t=2166136261;for(let n of Ah(e).map(e=>e.text).join(`
93
- `))t=Math.imul(t^n.codePointAt(0),16777619);return(t>>>0).toString(16)}function Fh(e){let t=Ah(e),n=t[0],r=t.at(-1);return{number:n.number,side:n.side,text:n.text,end:t.length>1?{number:r.number,side:r.side,text:r.text}:void 0,span:jh(t),excerpt:Nh(t),hash:Ph(t)}}var Ih=(e,t)=>e.number===t.number&&e.side===t.side&&e.text===t.text;function Lh(e,t){return Ih(e,t)&&!!e.end==!!t.end&&(!e.end||Ih(e.end,t.end))}function Rh(e,t){for(let n=0;n<t.length;n++)if(Ih(e,t[n])){if(!e.end)return[n,n];for(let r=n+1;r<t.length&&t[r].kind!==`hunk`;r++)if(Ih(e.end,t[r]))return[n,r]}return null}function zh(e,t){let n=Rh(e,t);return n&&(!e.hash||e.hash===Ph(t.slice(n[0],n[1]+1)))?n:null}function Bh(e,t){let n=t[e.scope]?.files.find(t=>t.path===e.path);return n?Dh(n.lines):null}function Vh(e,t,n=!1){if(t.git&&e.scope===`committed`&&!t.committed&&!n)return null;let r=Bh(e,t);return r&&zh(e,r)?null:r&&Rh(e,r)?`changed`:`gone`}function Hh(e,t,n=!1){return e.filter(e=>Vh(e,t,n))}function Uh(e,t){return e.map(e=>{let n=Bh(e,t),r=n&&zh(e,n);return r?{...e,...Fh(n.slice(r[0],r[1]+1)),end:e.end}:e})}function Wh(e){return(e.draft?.trim()?e.draft:e.body).trim()}function Gh(e){let t=[e.number,e.number];return e.span??(e.side===`old`?{old:t}:{new:t})}var Kh=(e,t)=>e[0]===e[1]?`${e[0]}`:`${e[0]}${t}${e[1]}`,qh=e=>e[0]!==e[1];function Jh(e,t){let n=e.old&&(qh(e.old)?t.oldLines:t.oldLine);if(!e.new)return e.old?`${qh(e.old)?t.lines:t.line} ${Kh(e.old,`–`)} (${n})`:``;let r=`${qh(e.new)?t.lines:t.line} ${Kh(e.new,`–`)}`;return e.old?`${r} + ${n} ${Kh(e.old,`–`)}`:r}function Yh(e,t,n={}){let r=new Map;for(let i of e){let e=Wh(i).replace(/\s*\n\s*/g,` `);if(!e)continue;let a=Gh(i),o=a.old&&(qh(a.old)?t.oldLines:t.oldLine),s=[a.old?a.new?`${o} ${Kh(a.old,`-`)}`:o:``,n[i.id]===`changed`?t.changed??t.missing:n[i.id]?t.missing:``].filter(Boolean),c=`${i.path}:${Kh(a.new??a.old,`-`)}${s.length?` (${s.join(`, `)})`:``} — ${e}`,l=(i.excerpt??[i.text.trimEnd()]).filter(Boolean).map(e=>` ${e}`);r.has(i.path)||r.set(i.path,[]),r.get(i.path).push([c,...l].join(`
90
+ `);return}let s=n.tagName===`P`?2:+!!/^(ADDRESS|ARTICLE|ASIDE|BLOCKQUOTE|CAPTION|CENTER|DD|DETAILS|DIALOG|DIV|DL|DT|FIELDSET|FIGCAPTION|FIGURE|FOOTER|FORM|HEADER|HR|LI|MAIN|MENU|NAV|OL|PRE|SECTION|SUMMARY|TABLE|TBODY|TD|TFOOT|TH|THEAD|TR|UL|H[1-6])$/.test(n.tagName);s&&i(s);for(let e of n.childNodes)o(e,t||n.tagName===`PRE`);s&&i(s)}for(let e of t.childNodes)o(e);return n}var hh=[`data-agent`],gh={class:`restart-text`},_h={class:`restart-text`},vh={class:`restart-text`},yh={class:`restart-text`},bh={class:`restart-text`},xh=[`disabled`],Sh={key:5,class:`composer-notice codex-field`,role:`status`},Ch=[`title`],wh=[`disabled`,`title`],Th={class:`notice-label`},Eh=[`aria-label`],Dh=[`aria-selected`,`onMousemove`,`onClick`],Oh={class:`slash-name`},kh={key:0},Ah={class:`slash-desc`},jh={key:1,class:`slash-denied`,role:`status`},Mh={class:`slash-denied-label`},Nh={class:`dir-denied-path`},Ph={key:7,class:`composer-ask-anchor`},Fh=[`aria-label`],Ih={class:`composer-quotes-label`},Lh={class:`composer-quote-text`},Rh=[`aria-label`,`onClick`],zh={class:`attachments`},Bh=[`aria-label`,`onClick`,`onKeydown`],Vh=[`src`],Hh={key:0,class:`spinner`},Uh=[`aria-label`,`onClick`],Wh=[`aria-label`],Gh={key:1,class:`prompt-models`},Kh={key:3,class:`prompt-hint`},qh={key:4,class:`prompt-hint`},Jh=Object.assign(T({__name:`Composer`,props:{pane:{},paneId:{},sendKeys:{type:Function},conversation:{type:Boolean},escStops:{type:Boolean},takeBack:{type:Boolean},unanswered:{},termShown:{type:Boolean}},emits:[`sent`,`showTerminal`,`showUnanswered`],setup(e,{expose:t,emit:i}){let o=e,s=i,c=n(()=>Z(`Text typed in Codex’s terminal, or arrived there by mistake: your next message would be sent after it.`,`Texte tapé dans le terminal de Codex, ou arrivé là par erreur : ton prochain message serait envoyé à sa suite.`)),l=h(!1);async function u(){l.value=!0;try{await o.sendKeys(Array.from({length:10},()=>[`ctrl+u`,`backspace`]).flat())}finally{l.value=!1}}let d=n(()=>/\b(failed|error)\b/i.test(o.pane?.claudeNotice||``)),p=n(()=>!!(o.pane?.claudeNotice&&/Restart to update/i.test(o.pane.claudeNotice)&&je(o.pane))),b=n(()=>{let e=o.pane?.restart;if(!e)return``;let t=ai(e.agent);return e.update&&e.phase===`stopping`?Z(`Exiting ${t}…`,`Fermeture de ${t}…`):e.phase===`updating`?Z(`Updating ${t} in its terminal…`,`Mise à jour de ${t} dans son terminal…`):e.phase===`stopping`?Z(`Stopping ${t}…`,`Arrêt de ${t}…`):Z(`Restarting ${t} on the same conversation…`,`Relance de ${t} sur la même conversation…`)});async function C(){let e=o.pane?.restart?.update;if(e)try{await navigator.clipboard.writeText(e),X(Z(`Command copied: paste it into the terminal of this pane.`,`Commande copiée : colle-la dans le terminal de ce panneau.`))}catch{X(Q(`Copy failed`),!0)}}let T=tn(o.paneId),D=S(T,`text`),O=h(null),A=n(()=>O.value?.textareaRef||null),I=h(!1),L=!1,R=!1,B=0;function ee(){cancelAnimationFrame(B),R=!1,I.value=!0}function W(){vi.value&&L?R=!0:I.value=!1}function G(){L=!0}function te(){L=!1,R&&(R=!1,B=requestAnimationFrame(()=>{B=0,I.value=document.activeElement===A.value}))}w(()=>{document.addEventListener(`pointerdown`,G,!0),window.addEventListener(`pointerup`,te,!0),window.addEventListener(`pointercancel`,te,!0)}),H(()=>{document.removeEventListener(`pointerdown`,G,!0),window.removeEventListener(`pointerup`,te,!0),window.removeEventListener(`pointercancel`,te,!0),cancelAnimationFrame(B)}),z(Wn,e=>{e||(I.value=!1)});let ne=h(null),q=h(null),ie=h(!1),ae=n(()=>vr({desk:Xi.value,touch:!!(Si||Hi),tablet:pr.value,hardwareKeyboard:mr.value,softKeyboard:Wn.value})),J=S(T,`atts`),oe=n(()=>I.value||Wn.value||D.value.length>0||J.value.length>0),se=n(()=>Wr(D.value)),le=null;z([()=>Ni.value===`native`&&se.value.length>0,A],([e,t])=>{le&&(!e||!t)&&(le.destroy(),le=null),e&&t&&!le&&(le=dh(t))},{immediate:!0,flush:`post`}),z(D,()=>P(()=>le?.render()),{flush:`post`}),H(()=>{le?.destroy(),le=null});let ue=n(()=>!!(D.value.trim()||J.value.length)),de=n(()=>!!(o.pane?.stopped||o.pane?.prompt?.unavailable)||!Hr.value||Qr.value||Lr(o.pane)),pe=n(()=>!!(o.pane&&o.pane.agent===`omp`&&o.pane.ompShell&&o.pane.status!==`working`)),me=n(()=>!(de.value||!o.pane||!o.pane.agent||o.pane.status!==`working`&&!pe.value||ue.value)),he=n(()=>!de.value&&!ue.value&&o.pane?.claudeSuggestion||null),ge=n(()=>!(!he.value||ae.value));function _e(){let e=he.value;e&&(D.value=e,Dt())}let ve=h(null),ye=h(0);z(ge,()=>P(()=>{ye.value=ve.value?ve.value.offsetWidth+16:0}),{immediate:!0});function xe(){let e=he.value;if(!e)return;let t=!!(A.value&&document.activeElement===A.value);D.value=e,t&&Dt()}let Se=n(()=>{let e=o.pane;return e?e.status===`blocked`?Q(`Type a reply…`):he.value?he.value:e.agent?Z(`Message to ${ai(e.agent)}…`,`Message à ${ai(e.agent)}…`):Q(`Command…`):Q(`Message to agent…`)});function Ce(e){if(_t.value&&!e.isComposing){let t=gt.value.length;if(e.key===`ArrowDown`){e.preventDefault(),vt=`kb`,ut.value=(ut.value+1)%t;return}if(e.key===`ArrowUp`){e.preventDefault(),vt=`kb`,ut.value=(ut.value-1+t)%t;return}if(e.key===`Escape`){e.preventDefault(),dt.value=!0;return}if(e.key===`Tab`||ae.value&&e.key===`Enter`&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),St(gt.value[ut.value]||gt.value[0]);return}}if(e.key===`Tab`&&!e.shiftKey&&!e.isComposing&&he.value&&!D.value){e.preventDefault(),_e();return}ae.value&&e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&!D.value.trim()&&(e.preventDefault(),Fe())}let we=new ih;function Te(e){let t=A.value;if(!t||e.target!==t||_t.value||ie.value)return;let n={text:t.value,start:t.selectionStart,end:t.selectionEnd},r=rh(e,n);if(r===null)return;let i=we.move(r,n,sh(o.paneId));i&&(e.preventDefault(),D.value=i.text,dt.value=!0,P(()=>{dt.value=!0,t.setSelectionRange(i.start,i.end)}))}w(()=>window.addEventListener(`keydown`,Te)),H(()=>{window.removeEventListener(`keydown`,Te),we.draft&&(D.value=we.draft.text)});function De(e){ch(o.paneId,e),we.reset()}function Oe(e){e.preventDefault(),Fe()}let ke=n(()=>de.value||!ue.value&&!me.value||ie.value||Ie.value===`running`),Ae=h(!1),Me=Ud({enabled:()=>me.value||!ke.value,run:()=>{me.value?Re():Fe()},press:e=>{Ae.value=e}}),Ne=n(()=>Xi.value&&!me.value);async function Fe(){if(de.value)return X(Q(`Sending unavailable offline`),!0);if(me.value)return Re();if(J.value.some(e=>!e.paste&&!e.path))return X(Q(J.value.some(e=>!e.path&&e.file)?`File is uploading…`:`Photo is uploading…`));let e=J.value.flatMap(e=>e.paste?[e.paste]:[]),t=J.value.flatMap(e=>e.paste?[]:[e.ref||e.path]),n=D.value,r=pt(n,e,t);if(!r||ie.value)return;if(!nr(o.paneId,r)){D.value=``,We(),X(Q(`Already sent`));return}let i=o.pane,a=i&&i.status===`blocked`?i.prompt:null,c=a?a.options.findIndex(e=>e.free):-1;if(c<0&&qe(i)&&!al(r)){De(n),D.value=``,We(),wt(e),$(),s(`sent`,null),Gt(i,o.paneId,r).then(()=>s(`sent`,null),e=>X(e.message,!0));return}ie.value=!0,wt(e);let l=J.value;D.value=``,J.value=[];let u=()=>{Wt(o.paneId,r),!D.value&&!J.value.length?(D.value=n,J.value=l):Kn(T,r,e)};try{let e=null;if(a&&c>=0){if(!await Pe(o.paneId,c,a.options[c].label,a.identity,{text:r,question:a.question}))return u()}else e=await Ee(i,o.paneId,r);De(n);for(let e of l)e.url&&URL.revokeObjectURL(e.url);$(),s(`sent`,e);let d=r.split(/\s/)[0],f=st.get(o.paneId)?.list||ct.value;c<0&&i&&i.agent&&!t.length&&/^\/\S+$/.test(d)&&!r.includes(`
91
+ `)&&!fe(d,f)&&ce(o.paneId,d,f.some(e=>e.source===`builtin`&&`/${e.name}`===d))}catch(e){u(),X(e.message,!0)}finally{ie.value=!1}}let Ie=h(null),Le=h(!1);async function Re(){if(Ie.value!==`running`){$(),Ie.value=`running`,Le.value=pe.value;try{let e=await xi(`/api/interrupt`,{pane_id:o.paneId,restore:!!o.takeBack});if(Ie.value=e.stopped?null:`failed`,Le.value=!!e.shell,e.shell){e.stopped&&X(Z(`Command cancelled`,`Commande annulée`));return}if(e.restored!==void 0){Kn(T,e.restored),Dt();let t=Z(`Stopped: your message is back in the field`,`Arrêté : ton message est revenu dans le champ`);e.lost?X(t,!0,An(e.lost)):X(t)}else e.stopped&&X(e.background?Z(`Agent stopped (${e.background} background task${e.background>1?`s`:``} stopped)`,`Agent arrêté (${e.background} tâche${e.background>1?`s`:``} de fond arrêtée${e.background>1?`s`:``})`):Q(`Agent stopped`))}catch(e){Ie.value=null,X(e.message,!0)}}}z(()=>o.pane?.status,e=>{Ie.value===`failed`&&!Le.value&&e!==`working`&&(Ie.value=null)}),z(pe,e=>{Ie.value===`failed`&&Le.value&&!e&&(Ie.value=null)});let Be={at:null},Ve=h(!1),He;function Ue(){return!o.escStops||!me.value||ie.value||Ie.value===`running`?!1:(clearTimeout(He),Ve.value=!ph(Be,Date.now()),Ve.value?He=setTimeout(()=>{Ve.value=!1},fh):Re(),A.value?.focus(),!0)}H(()=>clearTimeout(He));function We(){for(let e of J.value)e.url&&URL.revokeObjectURL(e.url);J.value=[]}function Ge(e){tt.value=e.url}function Je(e){let[t]=J.value.splice(e,1);t&&t.url&&URL.revokeObjectURL(t.url)}z(()=>J.value.length,()=>P(Jn)),z(D,()=>P(()=>{let e=A.value;!e||e.scrollHeight<=e.clientHeight||document.activeElement!==e||e.selectionEnd>=e.value.length-1&&(e.scrollTop=e.scrollHeight)}));async function Ye(e){for(let t of e){let e=r({url:URL.createObjectURL(t),path:null});J.value.push(e);try{let n=await op(o.paneId,t);e.path=n.path,e.name=n.name}catch(t){X(`${Q(`Photo upload failed`)} : ${t.message}`,!0),J.value=J.value.filter(t=>t!==e),URL.revokeObjectURL(e.url)}}}async function Xe(e){let t=o.pane,{images:n,files:r,refused:i}=await Xn(e,t?.agent);if(i.length){let e=ai(t?.agent),n=i.map(e=>e.file.name).join(`, `),r=[...new Set(i.map(t=>Bn(t.reason,e,t.kind)))];X(Z(`Not attached: ${n}`,`Non joint : ${n}`),!0,r.join(` · `))}n.length&&Ye(n);for(let e of r)Ze(e.file,e.kind);return n.length+r.length}async function Ze(e,t){let n=r({url:``,path:null,file:{label:e.name,size:e.size,kind:t}});J.value.push(n);try{let t=await fetch(`/api/attach?pane=${encodeURIComponent(o.paneId)}&name=${encodeURIComponent(e.name)}`,{method:`POST`,headers:{"content-type":`application/octet-stream`},body:e}),r=await t.json().catch(()=>({}));if(!t.ok)throw Error(Q(r.error||`HTTP ${t.status}`));n.path=r.path,n.name=r.name,n.ref=r.ref}catch(t){X(`${e.name} : ${Q(`File upload failed`)} — ${t.message}`,!0),J.value=J.value.filter(e=>e!==n)}}function $e(e){let t=e.target,n=[...t.files||[]];t.value=``,Xe(n)}function et(e){rt(e,e.clipboardData)}function nt(e){e.inputType===`insertFromPaste`&&rt(e,e.dataTransfer,e.data||``)}function rt(e,t,n=``){let r=e.target,i=t?.getData(`text/plain`)||n||mh(t?.getData(`text/html`)||``);if(aa(e,t,i.length,r,()=>J.value.length),!e.cancelable)return;let a=[...t?.items||[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>!!e);if(a.length){e.preventDefault(),Xe(a),$();return}if(!i)return;e.preventDefault();let o=i.replace(/\r\n?/g,`
92
+ `);if(yt(o))return at(o);let s=Ti(o),c=r.value;if(!(document.activeElement===r&&typeof document.execCommand==`function`&&document.execCommand(`insertText`,!1,s))){let e=r.selectionStart??c.length;r.value=c.slice(0,e)+s+c.slice(r.selectionEnd??e),r.setSelectionRange(e+s.length,e+s.length),r.dispatchEvent(new Event(`input`,{bubbles:!0}))}D.value=r.value}function at(e){J.value.push({url:``,path:null,paste:e}),$()}async function ot(){if(!navigator.clipboard||!navigator.clipboard.read)return X(Q(`Clipboard unavailable here — paste into the message field.`),!0);try{let e=[];for(let t of await navigator.clipboard.read()){let n=t.types.find(e=>e.startsWith(`image/`));n&&e.push(new File([await t.getType(n)],`presse-papiers.${n.split(`/`)[1]}`,{type:n}))}if(!e.length)return X(Q(`No image in the clipboard`),!0);Ye(e)}catch(e){let t=e;X(t.name===`NotAllowedError`?Q(`Paste denied`):`${Q(`Paste failed`)} : ${t.message}`,!0)}}let st=new Map,ct=h([]),lt=h(null),ut=h(0),dt=h(!1),ft=h(null),mt=n(()=>{let e=/^\/(\S*)$/.exec(D.value);return o.pane&&o.pane.agent&&e?e[1].toLowerCase():null});async function ht(){let e=o.paneId,t=st.get(e);if(!(t&&(ct.value=t.list,lt.value=t.denied,Date.now()-t.at<15e3)))try{let n=await xi(`/api/commands?pane=${encodeURIComponent(e)}`);if(n.partial&&t)return;let r=n.denied?{remote:!!n.remote}:null;n.partial||st.set(e,{at:Date.now(),list:n.commands,denied:r}),e===o.paneId&&(ct.value=n.commands,lt.value=r)}catch{}}z(mt,(e,t)=>{if(e===null){dt.value=!1;return}t??ht(),ut.value=0}),z(()=>o.paneId,()=>{ct.value=[],lt.value=null});let gt=n(()=>{let e=mt.value;if(e===null)return[];let t=[],n=[],r=[];for(let i of ct.value){let a=i.name.toLowerCase();a.startsWith(e)?t.push(i):a.includes(e)?n.push(i):e.length>1&&i.desc.toLowerCase().includes(e)&&r.push(i)}return[...t,...n,...r]}),_t=n(()=>mt.value!==null&&!dt.value&&(gt.value.length>0||!!lt.value)&&(gt.value.length!==1||gt.value[0].name.toLowerCase()!==mt.value)),vt=``;function xt(e,t){let n=`${e.screenX},${e.screenY}`,r=vt===`kb`;n!==vt&&(vt=n,!r&&(ut.value=t))}function St(e){D.value=`/${e.name} `,$(),P(()=>A.value?.focus())}z(ut,e=>P(()=>{(ft.value?.children[e])?.scrollIntoView({block:`nearest`})}));let Ct={claude:[[`/compact`,`Summarize context`],[`/clear`,`New conversation`],[`/context`,`Context usage`],[`/usage`,`Plan usage`],[`/model`,`Change model`],[`/review`,`Code review`]],codex:[[`/compact`,`Summarize context`],[`/new`,`New conversation`],[`/status`,`Session status`],[`/model`,`Change model`],[`/review`,`Code review`],[`/diff`,`View diff`]],omp:[[`/compact`,`Summarize context`],[`/new`,`New conversation`],[`/plan`,`Plan mode`],[`/model`,`Change model`],[`/fast`,`Priority service tier`]]};function Tt(){let e=o.pane;if(!e)return;let t=[{label:Q(`Photo or screenshot`),icon:`i-lucide-image`,run:()=>ne.value?.click()},{label:e.agent===`claude`?Q(`File (PDF, text, code)`):Q(`File (text, code)`),icon:`i-lucide-paperclip`,run:()=>q.value?.click()},{label:Q(`Paste copied image`),icon:`i-lucide-clipboard-paste`,run:ot}];if(e.agent){t.push({kind:`separator`}),t.push({kind:`command`,cmd:`esc`,desc:Q(`Interrupt agent`),run:()=>o.sendKeys([`esc`])});for(let[n,r]of Ct[e.agent]||[])t.push({kind:`command`,cmd:n,desc:Q(r),run:()=>Et(n)});t.push({kind:`note`,label:Q(`Commands that open a menu (model…) can then be controlled in the Terminal tab.`)})}Ke(t)}async function Et(e,t=!0){try{await xi(`/api/prompt`,{pane_id:o.paneId,text:e}),ch(o.paneId,e),$()}catch(e){return X(e.message,!0)}t&&ce(o.paneId,e)}function Dt(){Ot(null)}function Ot(e){A.value?.focus(),P(()=>{let t=A.value;if(!t)return;t.focus();let n=e===null?t.value.length:Math.min(e,t.value.length);t.setSelectionRange(n,n),e===null&&(t.scrollTop=t.scrollHeight)})}function kt(e){ae.value&&Ot(e)}return t({focus:()=>A.value?.focus(),focusEnd:Dt,focusAnswer:kt,blur:()=>A.value?.blur(),addImages:Ye,addFiles:Xe,stop:Ue}),(t,n)=>{let r=Qe,i=xm,o=Bm,h=Io,S=Do,w=bt,T=Ym,A=Jt,P=it,I=Zm,L=eh;return _(),v(`div`,{class:`composer`,"data-agent":e.pane?.agent||void 0},[f(Ie)?(_(),v(`div`,{key:0,class:j([`composer-notice restart`,{failed:f(Ie)===`failed`}]),role:`status`},[f(Ie)===`failed`?(_(),v(k,{key:0},[F(`span`,gh,M(f(Le)?(`tl`in t?t.tl:f(Z))(`The command is still running.`,`La commande tourne encore.`):(`t`in t?t.t:f(Q))(`The agent is still working.`)),1),e.termShown?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:n[0]||=e=>s(`showTerminal`)},M((`t`in t?t.t:f(Q))(`View terminal`)),1)),F(`button`,{type:`button`,class:`notice-btn`,onClick:n[1]||=e=>Ie.value=null},M((`t`in t?t.t:f(Q))(`Hide`)),1)],64)):(_(),v(k,{key:1},[n[14]||=F(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),F(`span`,_h,M(f(Le)?(`tl`in t?t.tl:f(Z))(`Cancelling the command…`,`Annulation de la commande…`):(`t`in t?t.t:f(Q))(`Stopping…`)),1)],64))],2)):e.pane?.restart?(_(),v(`div`,{key:1,class:j([`composer-notice restart`,e.pane.restart.phase]),role:`status`},[e.pane.restart.phase===`failed`?(_(),v(k,{key:0},[F(`span`,vh,M(e.pane.restart.update?(`t`in t?t.t:f(Q))(`Codex update failed`):(`t`in t?t.t:f(Q))(`Restart failed`))+M((`tl`in t?t.tl:f(Z))(`: `,` : `))+M((`t`in t?t.t:f(Q))(e.pane.restart.error||``)),1),e.termShown?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:n[2]||=e=>s(`showTerminal`)},M((`t`in t?t.t:f(Q))(`View terminal`)),1)),e.pane.restart.update?(_(),v(`button`,{key:1,type:`button`,class:`notice-btn`,onClick:C},[E(r,{name:`i-lucide-copy`}),a(M((`t`in t?t.t:f(Q))(`Copy command`)),1)])):g(``,!0),F(`button`,{type:`button`,class:`notice-btn`,onClick:n[3]||=n=>(`dismissRestart`in t?t.dismissRestart:f(be))(e.paneId)},M((`t`in t?t.t:f(Q))(`Hide`)),1)],64)):(_(),v(k,{key:1},[n[15]||=F(`span`,{class:`notice-spin`,"aria-hidden":`true`},null,-1),F(`span`,yh,M(f(b)),1)],64))],2)):e.conversation&&e.pane?.usageLimit?(_(),m(i,{key:2,limit:e.pane.usageLimit,"read-only":f(de),"send-keys":e.sendKeys,onCredits:n[4]||=e=>Et(`/usage-credits`,!1)},null,8,[`limit`,`read-only`,`send-keys`])):e.pane?.claudeNotice?(_(),v(`div`,{key:3,class:j([`composer-notice`,{error:f(d)}]),role:`status`},[f(p)?(_(),v(k,{key:0},[F(`span`,bh,M(e.pane.claudeNotice.replace(/\s*·\s*Restart to update\b.*$/,``))+` ·`,1),F(`button`,{type:`button`,class:`notice-btn`,disabled:f(de),onClick:n[5]||=n=>(`restartAgent`in t?t.restartAgent:f(ze))(e.pane)},[E(r,{name:`i-lucide-rotate-cw`}),a(M((`t`in t?t.t:f(Q))(`Restart to update`)),1)],8,xh)],64)):(_(),v(k,{key:1},[a(M(f(d)&&!/^[✗✘]/.test(e.pane.claudeNotice)?`✘ ${e.pane.claudeNotice}`:e.pane.claudeNotice),1)],64))],2)):e.pane?.codexStatus?(_(),m(o,{key:4,pane:e.pane,"pane-id":e.paneId,"read-only":f(de)},null,8,[`pane`,`pane-id`,`read-only`])):g(``,!0),e.pane?.agent===`codex`&&e.pane.codexField&&!f(Ie)?(_(),v(`div`,Sh,[E(r,{name:`i-lucide-text-cursor-input`,class:`notice-icon`}),F(`span`,{class:`restart-text`,title:f(c)},[a(M((`tl`in t?t.tl:f(Z))(`In Codex’s field:`,`Dans le champ de Codex :`))+` `,1),F(`code`,null,M(e.pane.codexField),1)],8,Ch),F(`button`,{type:`button`,class:`notice-btn`,disabled:f(de)||f(l),title:f(c),onClick:u},M((`tl`in t?t.tl:f(Z))(`Clear`,`Vider`)),9,wh),e.termShown?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`notice-btn`,onClick:n[6]||=e=>s(`showTerminal`)},[E(r,{name:`i-lucide-terminal`}),F(`span`,Th,M((`t`in t?t.t:f(Q))(`View terminal`)),1)]))])):g(``,!0),f(_t)?(_(),v(`div`,{key:6,class:`slash-menu`,role:`listbox`,"aria-label":(`t`in t?t.t:f(Q))(`Commands`)},[f(gt).length?(_(),v(`div`,{key:0,ref_key:`slashListEl`,ref:ft,class:`slash-list`},[(_(!0),v(k,null,y(f(gt),(e,t)=>(_(),v(`button`,{key:e.name,type:`button`,role:`option`,class:j([`slash-item`,{on:t===f(ut)}]),"aria-selected":t===f(ut),onMousedown:n[7]||=re(()=>{},[`prevent`]),onMousemove:e=>xt(e,t),onClick:t=>St(e)},[F(`span`,Oh,[a(`/`+M(e.name),1),e.hint?(_(),v(`small`,kh,M(e.hint),1)):g(``,!0)]),F(`span`,Ah,M(e.desc),1)],42,Dh))),128))],512)):g(``,!0),f(lt)?(_(),v(`div`,jh,[F(`p`,Mh,[E(r,{name:`i-lucide-shield-alert`}),a(M((`tl`in t?t.tl:f(Z))(`macOS hides this project’s commands`,`macOS masque les commandes de ce projet`)),1)]),F(`p`,null,[a(M((`tl`in t?t.tl:f(Z))(`Typed in full, they still work. To list them, on the Mac:`,`Tapées en entier, elles marchent quand même. Pour les lister, sur le Mac :`))+` `,1),F(`span`,Nh,M(f(lt).remote?(`tl`in t?t.tl:f(Z))(`System Settings › General › Sharing › Remote Login ⓘ › “Allow full disk access for remote users”`,`Réglages Système › Général › Partage › Session à distance ⓘ › « Autoriser l’accès complet au disque pour les utilisateurs distants »`):(`tl`in t?t.tl:f(Z))(`System Settings › Privacy & Security › Full Disk Access`,`Réglages Système › Confidentialité et sécurité › Accès complet au disque`)),1)])])):g(``,!0)],8,Eh)):g(``,!0),e.unanswered&&!f(de)?(_(),v(`div`,Ph,[F(`button`,{type:`button`,class:`composer-ask`,onMousedown:n[8]||=re(()=>{},[`prevent`]),onClick:n[9]||=e=>s(`showUnanswered`)},[E(r,{name:`i-lucide-arrow-up`}),F(`span`,null,M(e.unanswered>1?(`tl`in t?t.tl:f(Z))(`${e.unanswered} questions unanswered`,`${e.unanswered} questions sans réponse`):(`tl`in t?t.tl:f(Z))(`1 question unanswered`,`1 question sans réponse`)),1)],32)])):g(``,!0),f(se).length?(_(),v(`div`,{key:8,class:`composer-quotes`,role:`list`,"aria-label":(`t`in t?t.t:f(Q))(`Quoted questions`)},[F(`span`,Ih,`↳ `+M(f(se).length),1),(_(!0),v(k,null,y(f(se),e=>(_(),v(`span`,{key:e.start,class:`composer-quote`,role:`listitem`},[F(`span`,Lh,M(e.excerpt),1),F(`button`,{type:`button`,class:`composer-quote-x`,"aria-label":(`t`in t?t.t:f(Q))(`Remove quote`),onMousedown:n[10]||=re(()=>{},[`prevent`]),onClick:t=>D.value=f(Jr)(f(D),e)},[E(r,{name:`i-lucide-x`})],40,Rh)]))),128))],8,Fh)):g(``,!0),E(L,{ref_key:`promptRef`,ref:O,modelValue:f(D),"onUpdate:modelValue":n[13]||=e=>U(D)?D.value=e:null,disabled:!!e.pane?.stopped,placeholder:e.pane?.stopped?(`t`in t?t.t:f(Q))(`Restart Codex before sending a message`):f(de)?(`t`in t?t.t:f(Q))(`Draft saved — sending unavailable offline`):f(Se),variant:`outline`,color:`neutral`,rows:1,maxrows:7,autofocus:!1,"submit-on-enter":f(ae)&&!f(_t),enterkeyhint:f(ae)?`send`:`enter`,autocapitalize:`sentences`,class:j([`prompt`,{suggesting:f(ge),expanded:f(oe)}]),style:N(f(ye)?{"--suggest-room":`${f(ye)}px`}:void 0),ui:{header:`prompt-head`,body:`prompt-body`,base:`prompt-input`,footer:`prompt-foot`},onFocus:ee,onBlur:W,onSubmit:Fe,onKeydown:Ce,onPaste:et,onBeforeinput:nt},x({footer:V(()=>[n[20]||=F(`span`,{class:`fx-ring`,"aria-hidden":`true`},[F(`span`,{class:`fx-spin`})],-1),n[21]||=F(`span`,{class:`fx-halo`,"aria-hidden":`true`},[F(`span`,{class:`fx-spin`})],-1),f(ge)?(_(),v(`button`,{key:0,ref_key:`suggestBtn`,ref:ve,type:`button`,class:`prompt-suggest`,"aria-label":(`t`in t?t.t:f(Q))(`Use suggestion`),onMousedown:n[11]||=re(()=>{},[`prevent`]),onClick:xe},[E(r,{name:`i-lucide-corner-down-left`}),F(`span`,null,M((`tl`in t?t.tl:f(Z))(`Use`,`Utiliser`)),1)],40,Wh)):g(``,!0),E(w,{icon:`i-lucide-plus`,color:`neutral`,variant:`outline`,size:`sm`,class:`prompt-plus`,disabled:f(de),"aria-label":(`t`in t?t.t:f(Q))(`Photo, file, paste, commands`),onClick:Tt},null,8,[`disabled`,`aria-label`]),F(`input`,{ref_key:`fileInput`,ref:ne,type:`file`,accept:`image/*`,multiple:``,hidden:``,onChange:$e},null,544),F(`input`,{ref_key:`anyFileInput`,ref:q,type:`file`,multiple:``,hidden:``,"data-testid":`attach-any`,onChange:$e},null,544),e.pane&&(e.pane.agent===`claude`||e.pane.agent===`codex`||e.pane.agent===`omp`)?(_(),v(`div`,Gh,[E(T,{pane:e.pane},null,8,[`pane`])])):g(``,!0),e.pane?.agent===`omp`?(_(),m(A,{key:2,pane:e.pane},null,8,[`pane`])):g(``,!0),f(Ne)&&f(he)?(_(),v(`span`,Kh,[E(P,{value:`tab`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Q))(`suggestion`))+` `,1),n[16]||=F(`span`,{class:`sep`},`·`,-1),n[17]||=a(),E(P,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Q))(`send`)),1)])):f(Ne)?(_(),v(`span`,qh,[E(P,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Q))(`send`))+` `,1),n[18]||=F(`span`,{class:`sep`},`·`,-1),n[19]||=a(),E(P,{value:`shift`,size:`sm`}),E(P,{value:`enter`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Q))(`new line`)),1)])):(`desk`in t?t.desk:f(Xi))&&e.escStops&&f(me)&&f(Ie)!==`running`?(_(),v(`span`,{key:5,class:j([`prompt-hint`,{armed:f(Ve)}]),"data-testid":`esc-hint`},[f(Ve)?(_(),v(k,{key:0},[E(P,{value:`escape`,size:`sm`}),a(` `+M((`t`in t?t.t:f(Q))(`again to stop`)),1)],64)):(_(),v(k,{key:1},[E(P,{value:`escape`,size:`sm`}),E(P,{value:`escape`,size:`sm`}),a(` `+M((`tl`in t?t.tl:f(Z))(`stop`,`arrêter`)),1)],64))],2)):g(``,!0),E(I,{status:f(me)?`streaming`:`ready`,disabled:f(ke),color:`primary`,variant:`solid`,"streaming-color":`neutral`,"streaming-variant":`solid`,"streaming-icon":`i-herdr-stop`,size:`sm`,class:j([`prompt-send`,{stop:f(me),pressed:f(Ae)}]),"aria-label":f(me)&&f(pe)?(`tl`in t?t.tl:f(Z))(`Cancel the command`,`Annuler la commande`):(`t`in t?t.t:f(Q))(f(me)?`Stop the agent`:`Send`),onMousedown:n[12]||=re(()=>{},[`prevent`]),onClick:Oe,onStop:Re,onTouchstart:f(Me).start,onTouchend:f(Me).end,onTouchcancel:f(Me).cancel},null,8,[`status`,`disabled`,`class`,`aria-label`,`onTouchstart`,`onTouchend`,`onTouchcancel`])]),_:2},[f(J).length?{name:`header`,fn:V(()=>[F(`div`,zh,[(_(!0),v(k,null,y(f(J),(e,n)=>(_(),v(k,{key:e.url||e.path||e.file?.label||`paste:${n}`},[e.paste?(_(),m(h,{key:0,text:e.paste,removable:``,onRemove:e=>Je(n)},null,8,[`text`,`onRemove`])):e.file?(_(),m(S,{key:1,name:e.file.label,size:e.file.size,kind:e.file.kind,uploading:!e.path,removable:``,onRemove:e=>Je(n)},null,8,[`name`,`size`,`kind`,`uploading`,`onRemove`])):(_(),v(`div`,{key:2,class:j([`att`,{up:!e.path}]),role:`button`,tabindex:`0`,"aria-label":(`t`in t?t.t:f(Q))(`View image`),onClick:t=>Ge(e),onKeydown:K(re(t=>Ge(e),[`self`]),[`enter`])},[F(`img`,{src:e.url,alt:``},null,8,Vh),e.path?g(``,!0):(_(),v(`span`,Hh)),F(`button`,{type:`button`,"aria-label":(`t`in t?t.t:f(Q))(`Remove`),onClick:re(e=>Je(n),[`stop`])},[E(r,{name:`i-lucide-x`})],8,Uh)],42,Bh))],64))),128))])]),key:`0`}:void 0]),1032,[`modelValue`,`disabled`,`placeholder`,`submit-on-enter`,`enterkeyhint`,`class`,`style`])],8,hh)}}}),{__name:`Composer`}),Yh=[`aria-label`],Xh={class:`review-note-head`},Zh={class:`review-range`},Qh={key:0,class:`review-path`},$h={key:0,class:`review-warning`,role:`status`},eg=[`id`,`value`,`placeholder`,`aria-label`],tg={class:`review-note-actions`},ng={class:`review-keys`,"aria-hidden":`true`},rg=[`disabled`],ig={class:`review-body`},ag={class:`review-note-actions`},og=[`aria-label`],sg=[`aria-label`],cg=Object.assign(T({__name:`ReviewNote`,props:{comment:{},label:{},missing:{type:Boolean},changed:{type:Boolean}},emits:[`act`,`hover`],setup(e,{emit:t}){let r=e,i=t,a=n(()=>r.comment.draft!==void 0),o=n(()=>r.comment.draft??``),s=n(()=>o.value.trim()!==r.comment.body.trim()),c=h(``);z(a,()=>{c.value=``});let l=/Mac|iPhone|iPad/.test(globalThis.navigator?.platform||``)?`⌘↵`:`Ctrl+↵`;function u(e){c.value=``,i(`act`,`draft`,r.comment.id,e.target.value)}function d(){o.value.trim()&&i(`act`,`save`,r.comment.id)}function p(){if(s.value&&c.value!==`cancel`){c.value=`cancel`;return}i(`act`,`cancel`,r.comment.id)}function m(){if(c.value!==`remove`){c.value=`remove`;return}i(`act`,`remove`,r.comment.id)}function y(e){if(!e.isComposing){if(e.key===`Escape`&&(a.value||c.value))e.preventDefault(),e.stopPropagation(),a.value?p():c.value=``;else if(a.value)e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),d());else return}}return(t,n)=>(_(),v(`div`,{class:j([`review-note`,{missing:e.missing,editing:f(a)}]),role:`group`,"aria-label":`${e.label}: ${(`t`in t?t.t:f(Q))(`review comment`)}`,onKeydown:y,onMouseenter:n[3]||=t=>i(`hover`,e.comment.id),onMouseleave:n[4]||=e=>i(`hover`,null),onFocusin:n[5]||=t=>i(`hover`,e.comment.id),onFocusout:n[6]||=e=>i(`hover`,null)},[F(`div`,Xh,[F(`span`,Zh,M(e.label),1),e.missing?(_(),v(`span`,Qh,M(e.comment.path),1)):g(``,!0)]),e.missing?(_(),v(`p`,$h,M(e.changed?(`t`in t?t.t:f(Q))(`The code of this block changed. Check this comment before sending.`):(`t`in t?t.t:f(Q))(`No longer in the diff. Check this comment before sending.`)),1)):g(``,!0),f(a)?(_(),v(k,{key:1},[F(`textarea`,{id:`review-${e.comment.id}`,value:f(o),placeholder:(`t`in t?t.t:f(Q))(`Write a review comment…`),"aria-label":`${e.label}: ${(`t`in t?t.t:f(Q))(`review comment`)}`,rows:`3`,onInput:u,onFocus:n[0]||=e=>e.target.scrollIntoView({block:`nearest`})},null,40,eg),F(`div`,tg,[F(`span`,ng,M(f(l))+` `+M((`t`in t?t.t:f(Q))(`to save`))+` · Esc `+M((`t`in t?t.t:f(Q))(`to cancel`)),1),F(`button`,{type:`button`,class:j([`review-btn`,{armed:f(c)===`cancel`}]),onClick:p},M(f(c)===`cancel`?(`t`in t?t.t:f(Q))(`Discard this text?`):(`t`in t?t.t:f(Q))(`Cancel`)),3),F(`button`,{type:`button`,class:`review-btn primary`,disabled:!f(o).trim(),onClick:d},M(e.comment.body?(`t`in t?t.t:f(Q))(`Save`):(`t`in t?t.t:f(Q))(`Comment`)),9,rg)])],64)):(_(),v(k,{key:2},[F(`p`,ig,M(e.comment.body),1),F(`div`,ag,[F(`button`,{type:`button`,class:`review-btn`,"aria-label":(`t`in t?t.t:f(Q))(`Edit comment`),onClick:n[1]||=t=>i(`act`,`edit`,e.comment.id)},M((`tl`in t?t.tl:f(Z))(`Edit`,`Modifier`)),9,og),F(`button`,{type:`button`,class:j([`review-btn`,{armed:f(c)===`remove`}]),"aria-label":f(c)===`remove`?(`t`in t?t.t:f(Q))(`Confirm delete`):(`t`in t?t.t:f(Q))(`Delete comment`),onClick:m,onBlur:n[2]||=e=>c.value=``},M(f(c)===`remove`?(`t`in t?t.t:f(Q))(`Confirm delete`):(`t`in t?t.t:f(Q))(`Delete`)),43,sg)])],64))],42,Yh))}}),{__name:`ReviewNote`});function lg(e){let t=null,n=null;return e.map(e=>{let r=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(e.text);e.kind===`hunk`&&(t=r?Number(r[1]):null,n=r?Number(r[2]):null);let i=e.kind===`del`?`old`:`new`,a=[`add`,`del`,`context`].includes(e.kind)?i===`old`?t:n:null;return(e.kind===`del`||e.kind===`context`)&&t!==null&&t++,(e.kind===`add`||e.kind===`context`)&&n!==null&&n++,{...e,number:a,side:i}})}function ug(e,t){let n=t,r=t;for(;n>0&&e[n-1].kind!==`hunk`;)n--;for(;r<e.length-1&&e[r+1].kind!==`hunk`;)r++;for(;n<t&&e[n].number===null;)n++;for(;r>t&&e[r].number===null;)r--;return[n,r]}function dg(e,t,n){let[r,i]=ug(e,t),a=Math.min(Math.max(n,r),i);for(;a!==t&&e[a].number===null;)a+=a<t?1:-1;return t<=a?[t,a]:[a,t]}var fg=e=>e.filter(e=>e.number!==null);function pg(e){let t={};for(let n of fg(e)){let e=t[n.side];t[n.side]=e?[Math.min(e[0],n.number),Math.max(e[1],n.number)]:[n.number,n.number]}return t}var mg=100;function hg(e){let t=fg(e).map(e=>e.text.trimEnd()).filter(e=>e.length>1);return(t.length>3?[t[0],`…`,t.at(-1)]:t).map(e=>e.length>mg?`${e.slice(0,99)}…`:e)}function gg(e){let t=2166136261;for(let n of fg(e).map(e=>e.text).join(`
93
+ `))t=Math.imul(t^n.codePointAt(0),16777619);return(t>>>0).toString(16)}function _g(e){let t=fg(e),n=t[0],r=t.at(-1);return{number:n.number,side:n.side,text:n.text,end:t.length>1?{number:r.number,side:r.side,text:r.text}:void 0,span:pg(t),excerpt:hg(t),hash:gg(t)}}var vg=(e,t)=>e.number===t.number&&e.side===t.side&&e.text===t.text;function yg(e,t){return vg(e,t)&&!!e.end==!!t.end&&(!e.end||vg(e.end,t.end))}function bg(e,t){for(let n=0;n<t.length;n++)if(vg(e,t[n])){if(!e.end)return[n,n];for(let r=n+1;r<t.length&&t[r].kind!==`hunk`;r++)if(vg(e.end,t[r]))return[n,r]}return null}function xg(e,t){let n=bg(e,t);return n&&(!e.hash||e.hash===gg(t.slice(n[0],n[1]+1)))?n:null}function Sg(e,t){let n=t[e.scope]?.files.find(t=>t.path===e.path);return n?lg(n.lines):null}function Cg(e,t,n=!1){if(t.git&&e.scope===`committed`&&!t.committed&&!n)return null;let r=Sg(e,t);return r&&xg(e,r)?null:r&&bg(e,r)?`changed`:`gone`}function wg(e,t,n=!1){return e.filter(e=>Cg(e,t,n))}function Tg(e,t){return e.map(e=>{let n=Sg(e,t),r=n&&xg(e,n);return r?{...e,..._g(n.slice(r[0],r[1]+1)),end:e.end}:e})}function Eg(e){return(e.draft?.trim()?e.draft:e.body).trim()}function Dg(e){let t=[e.number,e.number];return e.span??(e.side===`old`?{old:t}:{new:t})}var Og=(e,t)=>e[0]===e[1]?`${e[0]}`:`${e[0]}${t}${e[1]}`,kg=e=>e[0]!==e[1];function Ag(e,t){let n=e.old&&(kg(e.old)?t.oldLines:t.oldLine);if(!e.new)return e.old?`${kg(e.old)?t.lines:t.line} ${Og(e.old,`–`)} (${n})`:``;let r=`${kg(e.new)?t.lines:t.line} ${Og(e.new,`–`)}`;return e.old?`${r} + ${n} ${Og(e.old,`–`)}`:r}function jg(e,t,n={}){let r=new Map;for(let i of e){let e=Eg(i).replace(/\s*\n\s*/g,` `);if(!e)continue;let a=Dg(i),o=a.old&&(kg(a.old)?t.oldLines:t.oldLine),s=[a.old?a.new?`${o} ${Og(a.old,`-`)}`:o:``,n[i.id]===`changed`?t.changed??t.missing:n[i.id]?t.missing:``].filter(Boolean),c=`${i.path}:${Og(a.new??a.old,`-`)}${s.length?` (${s.join(`, `)})`:``} — ${e}`,l=(i.excerpt??[i.text.trimEnd()]).filter(Boolean).map(e=>` ${e}`);r.has(i.path)||r.set(i.path,[]),r.get(i.path).push([c,...l].join(`
94
94
  `))}return r.size?`${t.intro}\n\n${[...r.values()].map(e=>e.join(`
95
95
  `)).join(`
96
96
 
97
- `)}`:``}var Xh=[`aria-label`,`aria-describedby`],Zh=[`id`],Qh=[`data-row`,`onClick`],$h=[`tabindex`,`aria-label`,`aria-pressed`,`onPointerdown`,`onClick`,`onKeydown`,`onFocus`],eg={class:`review-number`},tg={class:`review-source`},ng=Object.assign(T({__name:`ReviewDiff`,props:{file:{},scope:{},comments:{},selection:{}},emits:[`add`,`select`,`act`],setup(e,{emit:t}){let r=e,i=t,a=h(null),o=p(),s=n(()=>Dh(r.file.lines)),c=n(()=>({line:Z(`Line`),lines:Z(`Lines`),oldLine:Z(`old line`),oldLines:Z(`old lines`)})),u=h(null),d=n(()=>r.comments.flatMap(e=>{let t=e.scope===r.scope&&e.path===r.file.path?zh(e,s.value):null;return t?[{c:e,at:t}]:[]})),b=n(()=>{let e=new Map,t=new Set,n=new Set;for(let{c:r,at:i}of d.value){e.set(i[1],[...e.get(i[1])??[],r]);let a=r.draft!==void 0||r.id===u.value?t:n;for(let e=i[0];e<=i[1];e++)a.add(e)}return{notes:e,open:t,noted:n}});function x(e){let t=d.value.find(t=>t.c.id===e.id)?.at;return Jh(t?jh(s.value.slice(t[0],t[1]+1)):Gh(e),c.value)}let S=n(()=>r.selection&&r.selection.scope===r.scope&&r.selection.path===r.file.path?r.selection:null),C=n(()=>S.value?[Math.min(S.value.anchor,S.value.head),Math.max(S.value.anchor,S.value.head)]:null),w=n(()=>S.value?Oh(s.value,S.value.anchor):null);function T(e,t,n){let a=kh(s.value,e,t);return i(`select`,{scope:r.scope,path:r.file.path,anchor:e,head:a[0]===e?a[1]:a[0],via:n,block:s.value.slice(a[0],a[1]+1)}),a}function E(e,t,n){let a=s.value.slice(e,t+1);a.some(e=>e.number!==null)&&i(`add`,r.scope,r.file.path,a,n),i(`select`,null)}let D=``;function O(e){D=e.pointerType}let A=null;function N(e){let t=a.value?.getBoundingClientRect(),n=t&&document.elementFromPoint(t.left+4,e)?.closest(`[data-row]`);return n&&a.value.contains(n)?Number(n.dataset.row):null}function F(e){let t=N(e.clientY);A&&t!==null&&s.value[t]?.number!=null&&(A.at=T(A.anchor,t,`drag`))}function L(){A=null,window.removeEventListener(`pointermove`,F),window.removeEventListener(`pointerup`,R),window.removeEventListener(`pointercancel`,z),window.removeEventListener(`keydown`,V,!0)}function R(){let e=A;L(),e&&E(e.at[0],e.at[1],e.extend)}function z(){L(),i(`select`,null)}function V(e){e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),z())}function H(e,t){if(e.pointerType!==`mouse`||e.button!==0)return;e.preventDefault(),e.currentTarget.focus();let[n,r]=Oh(s.value,t),i=e.shiftKey?d.value.findLast(e=>e.c.draft!==void 0&&e.at[0]>=n&&e.at[1]<=r):void 0,a=i?t>=i.at[0]?i.at[0]:i.at[1]:t;A={anchor:a,at:T(a,t,`drag`),extend:i?.c.id},window.addEventListener(`pointermove`,F),window.addEventListener(`pointerup`,R),window.addEventListener(`pointercancel`,z),window.addEventListener(`keydown`,V,!0)}l(L),B(()=>r.file,()=>{A&&z()});function U(e){let t=S.value,n=w.value;!t||!n||t.via===`drag`||e<n[0]||e>n[1]?T(e,e,`touch`):e===t.anchor&&t.head===t.anchor?i(`select`,null):T(t.anchor,e,`touch`)}function W(e,t){if(!e.detail){let e=S.value?.via===`keys`?C.value:null;return E(e?e[0]:t,e?e[1]:t)}D!==`mouse`&&U(t)}function G(e,t){D===`mouse`||S.value?.via!==`touch`||e.number===null||window.getSelection()?.toString()||U(t)}let ee=h(-1),K=n(()=>ee.value>=0&&s.value[ee.value]?.number!=null?ee.value:s.value.findIndex(e=>e.number!==null));function te(e){a.value?.querySelector(`[data-row="${e}"] .review-gutter`)?.focus()}function q(e,t,[n,r]){for(let i=e+t;i>=n&&i<=r;i+=t)if(s.value[i].number!==null)return i;return e}function ne(e,t){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let n=e.key===`ArrowDown`?1:-1;if(e.shiftKey){let e=S.value?.via===`keys`?S.value.anchor:t,r=q(t,n,Oh(s.value,e));T(e,r,`keys`),te(r)}else S.value&&i(`select`,null),te(q(t,n,[0,s.value.length-1]))}else e.key===`Escape`&&S.value&&(e.preventDefault(),e.stopPropagation(),i(`select`,null))}function J(e,t,n){let r=d.value.find(e=>e.c.id===t)?.at[1];i(`act`,e,t,n),e!==`draft`&&e!==`edit`&&(u.value=null,r!==void 0&&a.value?.contains(document.activeElement)&&P(()=>te(r)))}function ie(e){return`${Z(`Comment on line`)} ${e.number}${e.side===`old`?` (${Z(`old line`)})`:``}`}return(t,n)=>{let r=Eh;return _(),v(`div`,{ref_key:`root`,ref:a,class:j([`change-code`,{picking:f(S),dragging:f(S)?.via===`drag`}]),role:`region`,"aria-label":e.file.path,"aria-describedby":f(o)},[I(`p`,{id:f(o),class:`sr-only`},M((`t`in t?t.t:f(Z))(`Arrow keys move between lines. Shift+Arrow selects a block of lines. Enter writes a comment.`)),9,Zh),(_(!0),v(k,null,y(f(s),(e,t)=>(_(),v(k,{key:t},[I(`div`,{class:j([`change-line review-line`,[e.kind,{picked:f(C)&&t>=f(C)[0]&&t<=f(C)[1],open:f(b).open.has(t),noted:f(b).noted.has(t),out:f(w)&&(t<f(w)[0]-1||t>f(w)[1])}]]),"data-row":t,onPointerdown:O,onClick:n=>G(e,t)},[e.number===null?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`review-gutter`,tabindex:t===f(K)?0:-1,"aria-label":ie(e),"aria-pressed":f(C)?t>=f(C)[0]&&t<=f(C)[1]:void 0,onPointerdown:e=>H(e,t),onClick:re(e=>W(e,t),[`stop`]),onKeydown:e=>ne(e,t),onFocus:e=>ee.value=t},[n[1]||=I(`span`,{class:`review-plus`,"aria-hidden":`true`},`+`,-1),I(`span`,eg,M(e.number),1)],40,$h)),I(`span`,tg,M(e.text),1)],42,Qh),(_(!0),v(k,null,y(f(b).notes.get(t),e=>(_(),m(r,{key:e.id,comment:e,label:x(e),onAct:J,onHover:n[0]||=e=>u.value=e},null,8,[`comment`,`label`]))),128))],64))),128))],10,Xh)}}}),{__name:`ReviewDiff`}),rg=e=>e===`old`||e===`new`,ig=e=>Number.isInteger(e)&&e>0,ag=e=>!!e&&ig(e.number)&&rg(e.side)&&typeof e.text==`string`,og=e=>e===void 0||Array.isArray(e)&&e.length===2&&e.every(ig);function sg(e){return e&&typeof e.id==`string`&&[`working`,`committed`].includes(e.scope)&&typeof e.path==`string`&&ag(e)&&typeof e.body==`string`&&(e.end===void 0||ag(e.end))&&(e.span===void 0||typeof e.span==`object`&&e.span!==null&&og(e.span.new)&&og(e.span.old)&&!!(e.span.new||e.span.old))&&(e.excerpt===void 0||Array.isArray(e.excerpt)&&e.excerpt.every(e=>typeof e==`string`))&&(e.draft===void 0||typeof e.draft==`string`)&&(e.hash===void 0||typeof e.hash==`string`)}function cg(e){try{let t=JSON.parse(e||`[]`);return Array.isArray(t)?t.filter(e=>sg(e)&&(e.body.trim()||e.draft?.trim())):[]}catch{return[]}}function lg(e){let t=`review:${e}`,n=h([]);try{n.value=cg(localStorage.getItem(t))}catch{}B(n,e=>{try{let n=e.length?JSON.stringify(e):null;if(n===localStorage.getItem(t))return;n?localStorage.setItem(t,n):localStorage.removeItem(t)}catch{}},{deep:!0,flush:`sync`});function r(e){if(e.key!==t&&e.key!==null)return;let r=new Map(n.value.filter(e=>e.draft!==void 0).map(e=>[e.id,e]));n.value=cg(e.key===null?null:e.newValue).map(e=>r.get(e.id)??e)}return typeof window<`u`&&(window.addEventListener(`storage`,r),s(()=>window.removeEventListener(`storage`,r))),n}var ug={class:`changes-view`},dg={class:`changes-inner`},fg={class:`changes-toolbar`},pg={key:0,class:`changes-location`},mg={key:0,class:`review-hint`},hg={class:`by-mouse`},gg={class:`by-touch`},_g={key:1,class:`review-toolbar`},vg={role:`status`},yg={key:2,class:`changes-notice error`,role:`alert`},bg={key:3,class:`changes-notice`},xg={key:4,class:`changes-notice`},Sg={class:`changes-section`},Cg={key:0,class:`changes-notice`},wg={key:0,class:`changes-limit`},Tg={class:`change-path`},Eg={key:0,class:`change-binary`},Dg={key:1,class:`change-totals`},Og={class:`change-status`},kg={key:0,class:`change-note`},Ag={key:1,class:`change-note`},jg={class:`changes-section`},Mg={class:`changes-toggle`},Ng={class:`changes-location`},Pg={key:0,class:`changes-limit`},Fg={key:1,class:`changes-notice`},Ig={class:`change-path`},Lg={key:0,class:`change-binary`},Rg={key:1,class:`change-totals`},zg={key:0,class:`change-note`},Bg={key:1,class:`changes-notice`},Vg={class:`sr-only`,role:`status`},Hg={key:6,class:`review-pick`},Ug=Object.assign(T({__name:`ChangesView`,props:{paneId:{}},emits:[`review`],setup(e,{emit:t}){let r=e,i=t,o=lg(r.paneId),s=n(()=>O.value?Hh(o.value,O.value,N.value):[]),c=n(()=>Object.fromEntries(s.value.map(e=>[e.id,Vh(e,O.value,N.value)??void 0]))),u=n(()=>o.value.filter(Wh).length),d=n(()=>({line:Z(`Line`),lines:Z(`Lines`),oldLine:Z(`old line`),oldLines:Z(`old lines`)})),p=h(null),b=n(()=>p.value?Jh(jh(p.value.block),d.value):``);function x(e){P(()=>document.getElementById(`review-${e}`)?.focus())}function S(e){o.value=o.value.filter(t=>t.id!==e)}function C(e,t,n){let r=o.value.find(e=>e.id===t);r&&(e===`draft`?r.draft=n??``:e===`edit`?(r.draft=r.body,x(t)):e===`save`&&Wh(r)?(r.body=Wh(r),delete r.draft):e===`cancel`&&r.body?delete r.draft:S(t))}function T(e,t,n,r){if(!n.some(e=>e.number!==null))return;let i=Fh(n),a=o.value.find(n=>r?n.id===r:n.scope===e&&n.path===t&&Lh(n,i));a&&r?Object.assign(a,i):a?a.draft??=a.body:(a={id:crypto.randomUUID(),scope:e,path:t,...i,body:``,draft:``},o.value.push(a)),p.value=null,x(a.id)}function D(){let e=Yh(O.value?Uh(o.value,O.value):o.value,{intro:Z(`Please review these points:`),oldLine:Z(`old line`),oldLines:Z(`old lines`),missing:Z(`no longer in diff`),changed:Z(`code changed since this comment`)},c.value);e&&(i(`review`,e),o.value=[])}let O=h(null),A=h(!1),j=h(``),N=h(o.value.some(e=>e.scope===`committed`)),F=0;async function R(){let e=++F;A.value=!0,j.value=``;try{let t=await gi(`/api/changes?pane=${encodeURIComponent(r.paneId)}&commits=${N.value?`1`:`0`}`);e===F&&(O.value=t)}catch(t){e===F&&(j.value=t.message)}finally{e===F&&(A.value=!1)}}w(R),B(N,R),B(O,()=>{p.value=null}),l(()=>{F++});function z(e){return e.status===`??`?Z(`Untracked`):e.status===`commit`?Z(`Commit`):e.status.includes(`R`)?Z(`Renamed`):e.status.includes(`D`)?Z(`Deleted`):e.status.includes(`A`)?Z(`Added`):Z(`Modified`)}function V(e,t){return e===null?`${t}—`:`${t}${e}`}return(e,t)=>{let n=_t,r=Eh,i=ng;return _(),v(`div`,ug,[I(`div`,dg,[I(`div`,fg,[I(`div`,null,[f(O)?.git?(_(),v(`p`,pg,M(f(O).branch||`HEAD`)+` · `+M(f(O).root),1)):g(``,!0)]),E(n,{icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(A),"aria-label":(`t`in e?e.t:f(Z))(`Refresh changes`),onClick:R},{default:H(()=>[a(M((`t`in e?e.t:f(Z))(`Refresh`)),1)]),_:1},8,[`loading`,`aria-label`])]),f(O)?.git&&!f(o).length?(_(),v(`p`,mg,[I(`span`,hg,M((`t`in e?e.t:f(Z))(`To comment, hover a line and click +. Drag from the + to comment a block of lines.`)),1),I(`span`,gg,M((`t`in e?e.t:f(Z))(`To comment, tap a line number, then another line for a block.`)),1)])):g(``,!0),f(o).length?(_(),v(`div`,_g,[I(`span`,vg,M(f(u))+` `+M((`t`in e?e.t:f(Z))(f(u)===1?`review comment`:`review comments`)),1),E(n,{color:`neutral`,variant:`outline`,onClick:t[0]||=e=>o.value=[]},{default:H(()=>[a(M((`t`in e?e.t:f(Z))(`Discard`)),1)]),_:1}),E(n,{disabled:!f(u),onClick:D},{default:H(()=>[a(M((`t`in e?e.t:f(Z))(`Send review`)),1)]),_:1},8,[`disabled`]),I(`p`,null,M((`t`in e?e.t:f(Z))(`Adds to your message draft. You send it yourself.`)),1)])):g(``,!0),(_(!0),v(k,null,y(f(s),e=>(_(),m(r,{key:e.id,comment:e,label:f(Jh)(f(Gh)(e),f(d)),missing:``,changed:f(c)[e.id]===`changed`,onAct:C},null,8,[`comment`,`label`,`changed`]))),128)),f(j)?(_(),v(`p`,yg,M(f(j)),1)):g(``,!0),f(A)&&!f(O)?(_(),v(`p`,bg,[t[6]||=I(`span`,{class:`spinner`},null,-1),a(` `+M((`t`in e?e.t:f(Z))(`Reading changes…`)),1)])):f(O)&&!f(O).git?(_(),v(`p`,xg,M((`t`in e?e.t:f(Z))(`This folder is not a Git repository.`)),1)):f(O)?.git?(_(),v(k,{key:5},[I(`section`,Sg,[I(`h3`,null,[a(M((`t`in e?e.t:f(Z))(`Working tree`))+` `,1),I(`span`,null,M(f(O).working?.count||0),1)]),f(O).working?.count?(_(),v(k,{key:1},[f(O).working?.truncated?(_(),v(`p`,wg,M((`t`in e?e.t:f(Z))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),(_(!0),v(k,null,y(f(O).working?.files,n=>(_(),v(`details`,{key:n.path,class:`change-file`},[I(`summary`,null,[I(`span`,Tg,M(n.path),1),n.binary?(_(),v(`span`,Eg,M((`t`in e?e.t:f(Z))(`Binary`)),1)):(_(),v(`span`,Dg,[I(`b`,null,M(V(n.added,`+`)),1),I(`i`,null,M(V(n.deleted,`−`)),1)])),I(`span`,Og,M(z(n)),1)]),n.previousPath?(_(),v(`p`,kg,M((`t`in e?e.t:f(Z))(`From`))+` `+M(n.previousPath),1)):g(``,!0),n.summary?(_(),v(`p`,Ag,M((`t`in e?e.t:f(Z))(n.summary)),1)):g(``,!0),n.lines.length?(_(),m(i,{key:2,file:n,scope:`working`,comments:f(o),selection:f(p),onAdd:T,onSelect:t[1]||=e=>p.value=e,onAct:C},null,8,[`file`,`comments`,`selection`])):g(``,!0)]))),128))],64)):(_(),v(`p`,Cg,M((`t`in e?e.t:f(Z))(`No working tree changes.`)),1))]),I(`section`,jg,[I(`label`,Mg,[L(I(`input`,{"onUpdate:modelValue":t[2]||=e=>G(N)?N.value=e:null,type:`checkbox`},null,512),[[q,f(N)]]),t[7]||=a(),I(`span`,null,M((`t`in e?e.t:f(Z))(`Also show unpushed commits`)),1)]),f(N)&&f(O).committed?(_(),v(k,{key:0},[I(`h3`,null,[a(M((`t`in e?e.t:f(Z))(`Commits`))+` `,1),I(`span`,null,M(f(O).commits??0),1)]),I(`p`,Ng,M(f(O).comparison)+` → HEAD`,1),f(O).committed.truncated?(_(),v(`p`,Pg,M((`t`in e?e.t:f(Z))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),f(O).committed.count?g(``,!0):(_(),v(`p`,Fg,M((`t`in e?e.t:f(Z))(`No committed changes to show.`)),1)),(_(!0),v(k,null,y(f(O).committed.files,n=>(_(),v(`details`,{key:n.path,class:`change-file`},[I(`summary`,null,[I(`span`,Ig,M(n.path),1),n.binary?(_(),v(`span`,Lg,M((`t`in e?e.t:f(Z))(`Binary`)),1)):(_(),v(`span`,Rg,[I(`b`,null,M(V(n.added,`+`)),1),I(`i`,null,M(V(n.deleted,`−`)),1)]))]),n.summary?(_(),v(`p`,zg,M((`t`in e?e.t:f(Z))(n.summary)),1)):g(``,!0),n.lines.length?(_(),m(i,{key:1,file:n,scope:`committed`,comments:f(o),selection:f(p),onAdd:T,onSelect:t[3]||=e=>p.value=e,onAct:C},null,8,[`file`,`comments`,`selection`])):g(``,!0)]))),128))],64)):f(N)&&!f(A)&&!f(O).comparison?(_(),v(`p`,Bg,M((`t`in e?e.t:f(Z))(`No upstream or base branch available for comparison.`)),1)):g(``,!0)])],64)):g(``,!0),I(`p`,Vg,M(f(b)&&`${(`t`in e?e.t:f(Z))(`Selection:`)} ${f(b)}`),1),f(p)&&f(p).via!==`drag`?(_(),v(`div`,Hg,[I(`div`,null,[I(`b`,null,M(f(b)),1),I(`p`,null,M(f(p).via===`touch`?(`t`in e?e.t:f(Z))(`Tap another line of this hunk to extend the block.`):(`t`in e?e.t:f(Z))(`Shift+Arrow extends the block within this hunk.`)),1)]),I(`button`,{type:`button`,class:`review-btn`,onClick:t[4]||=e=>p.value=null},M((`t`in e?e.t:f(Z))(`Cancel`)),1),I(`button`,{type:`button`,class:`review-btn primary`,onClick:t[5]||=e=>T(f(p).scope,f(p).path,f(p).block)},M((`t`in e?e.t:f(Z))(`Comment`)),1)])):g(``,!0)])])}}}),{__name:`ChangesView`}),Wg=[`id`,`data-pane`],Gg={key:0,class:`file-drop`,"aria-hidden":`true`},Kg={class:`file-drop-label`},qg={class:`top bar agent-top`},Jg=[`aria-label`,`title`],Yg={class:`agent-head`},Xg={class:`agent-title`},Zg={class:`agent-meta`},Qg={key:0,class:`agent-subtitle`},$g={key:1,class:`agent-subtitle agent-command`},e_={key:2,class:`agent-subtitle`},t_=[`title`],n_={class:`machine-inline-name`},r_={key:4,class:`where`},i_={class:`agent-actions`},a_=[`aria-label`],o_={class:`agent-body`},s_={class:`agent-main hw-backdrop-host`},c_={key:1,class:`term-banner machine-banner`},l_={key:0},u_={key:2,class:`term-banner closed-banner`},d_={key:5,class:`chat-empty offline-terminal`},f_={key:7,class:`chat`},p_={key:8,class:`terminal-transcript-note dismissible-transcript-note`},m_=[`aria-label`,`title`],h_=null,g_=Object.assign(ca(T({__name:`AgentView`,props:{paneId:{},cell:{type:Boolean},active:{type:Boolean},grip:{type:Boolean},embedded:{type:Boolean},selectedMode:{}},emits:[`activate`,`update:selectedMode`],setup(e,{emit:t}){let r=e,i=t,o=Lt(),s=zt(),c=n(()=>!r.cell||!!r.active),d=Symbol(`vue agent`);B(c,e=>{e&&(Ii.value=r.paneId,h_=d)},{immediate:!0}),l(()=>{h_===d&&(Ii.value=null)});let p=n(()=>ur.value.panes.find(e=>e.id===r.paneId)),y=n(()=>{let e=p.value;return e?.agent?`wherdr:transcript-note:hidden:${e.id.includes(`~`)?e.id.split(`~`)[0]:`local`}:${e.agent}:${e.agentSession||e.id}`:``}),b=h(!1);B(y,e=>{if(b.value=!1,e&&typeof window<`u`)try{b.value=localStorage.getItem(e)===`1`}catch{}},{immediate:!0});function x(){b.value=!0;try{y.value&&localStorage.setItem(y.value,`1`)}catch{}}let S=n(()=>ur.value.workspaces.find(e=>e.id===p.value?.workspace)),C=n(()=>!!(r.cell||Ot.value&&Ot.value.panes.length>1)),T=n(()=>p.value?C.value?tr(p.value):Zn(p.value,S.value):`—`),D=n(()=>{let e=p.value?bn(p.value,S.value):``;return e&&e!==T.value?e:``}),O=n(()=>p.value?.command&&p.value.command!==T.value&&p.value.command!==D.value?p.value.command:``),k=n(()=>p.value&&ur.value.tabs?.filter(e=>e.workspace===p.value?.workspace).length>1?p.value.tabLabel:``),A=n({get:()=>Pr(r.paneId),set:e=>Fi(r.paneId,e)}),F=n(()=>{let e=p.value;return e?r.embedded&&r.selectedMode?r.selectedMode:r.cell?nr({chat:Xr(e),viewMode:A.value,active:r.active}):Xr(e)?A.value:`term`:null}),L=u(null),R=kf(r.paneId,{setBanner:e=>{L.value=e},hasBanner:()=>!!L.value,fill:()=>!!r.cell,input:()=>c.value}),z=h(null),V=h(0),U=h(null),W=h(typeof o.query.q==`string`&&typeof o.query.hit==`string`),ee=h(!!p.value),K=h(!1),te=setTimeout(()=>{K.value=!0},4e3);l(()=>clearTimeout(te));let q={text:Z(`This pane has been closed.`),btn:Z(`Back`),fn:()=>Bt(`/`)},ne=n(()=>!p.value&&ur.value.ok&&(ee.value||K.value)&&!Qe(r.paneId));B(p,e=>{e&&(ee.value=!0,L.value===q&&(L.value=null,F.value===`term`&&!R.isConnected()&&P(()=>R.connect(!1))))}),B(ne,e=>{e&&(L.value=q)},{immediate:!0}),B(F,(e,t)=>{e===`chat`&&t===`term`&&(L.value=ne.value?L.value:null)},{immediate:!0});function J(e){r.embedded&&i(`update:selectedMode`,e),r.cell&&i(`activate`),A.value=e,Hi.value&&e===`term`&&P(()=>R.focus()),X()}function re(e){J(ji(F.value,e))}function ie(){W.value?W.value=!1:(W.value=!0,F.value!==`chat`&&(A.value=`chat`))}wn(()=>r.paneId,()=>c.value,{searchChat(){return!p.value||!Xr(p.value)||F.value!==`chat`?!1:(W.value?z.value?.focusSearch():W.value=!0,!0)},toggleTerm(){if(!p.value||!Xr(p.value)||!F.value)return!1;let e=F.value!==`chat`;return J(e?`chat`:`term`),e&&P(()=>U.value?.focus()),!0},stop:()=>F.value===`chat`&&!!U.value?.stop()});let ae=an(r.paneId),oe=bt(),se=u(dn(r.paneId)),ce=n(()=>ur.value.ok?ur.value.panes.map(e=>e.id).join(` `):``);B([()=>p.value&&Pn(p.value,oe.value).join(` `),ce],([e,t])=>{if(!e||!t)return;let n=e.split(` `);se.value=Ht(se.value,n),Kt(r.paneId,n),ln(r.paneId,n,new Set(t.split(` `)))&&$(Q(`Draft from the closed pane restored`,`Brouillon du pane fermé récupéré`))},{immediate:!0});let le=n(()=>ne.value?Mn(r.paneId,se.value,ur.value.panes,oe.value):null);B(le,e=>{e&&(qt(r.paneId,e.id),!(r.cell||r.embedded)&&($(Q(`The agent restarted in a new pane: opened it`,`L’agent a redémarré dans un nouveau pane : il est ouvert`)),s.replace(Be(e.id))))},{immediate:!0});let fe;B(()=>ne.value&&!le.value,e=>{if(clearInterval(fe),fe=void 0,!e)return;We();let t=20;fe=Or(()=>{--t<=0&&(clearInterval(fe),fe=void 0),qr.value&&We()},3e3)},{immediate:!0}),l(()=>clearInterval(fe));let pe=n(()=>Yn(ae));async function me(){try{await navigator.clipboard.writeText(Wt(ae)),$(Q(`Draft copied`,`Brouillon copié`))}catch{$(Z(`Copy failed`),!0)}}let he=n(()=>kn(r.paneId));function ve(e){e&&Hn(r.paneId,e),z.value?.scrollToEnd(!0),z.value?.reload()}B(p,e=>Dn(r.paneId,e?.queued||[]));let ye=n(()=>p.value&&p.value.status===`blocked`&&p.value.prompt&&p.value.prompt.options?p.value.prompt:null),be=n(()=>Vi(p.value)),xe=n(()=>p.value&&p.value.menu&&p.value.status!==`working`&&!ye.value&&!be.value?p.value.menu:null);B(()=>JSON.stringify([ye.value,be.value,xe.value]),()=>P(()=>z.value?.scrollToEnd(!1)));let Se=n(()=>{let e=p.value;return e?si(e.cwd):``}),Ce=n(()=>hr.value&&p.value?ar(p.value.machine):void 0),we=n(()=>!!(Ce.value&&Ce.value.status!==`online`));function Te(e){ae.text=ae.text?`${ae.text}\n\n${e}`:e,Oe.value=!1,J(`chat`),P(()=>U.value?.focusEnd())}let Oe=h(!1),ke=h(!1),Ae=h(null),Me=n(()=>F.value===`term`),Ne=Vt(r.paneId),Pe=h(Ne.resume(p.value?.interaction||`unknown`)),Fe=n(()=>F.value===`chat`&&zi.value&&!Sr.value&&!we.value&&!Qr(p.value)),Le=n(()=>p.value?.interaction===`terminal`),Re;function Ue(){clearTimeout(Re),Re=void 0;let e=Date.now();Pe.value=Ne.update(p.value?.interaction||`unknown`,e);let t=Ne.deadline();t!==null&&qr.value&&(Re=setTimeout(Ue,Math.max(0,t-e))),(Le.value||Pe.value||ye.value||xe.value||be.value)&&Je.open&&Je.pane===r.paneId&&He(!1)}B([()=>p.value?.interaction,ye,xe,be,()=>Je.open,()=>Je.pane,qr],Ue,{immediate:!0});let Ge=Ne.subscribe(Ue);l(()=>{clearTimeout(Re),Ge()});function qe(){Ne.dismiss(),Pe.value=!1}function Ye(){r.cell&&i(`activate`),Ne.reopen(),Pe.value=!0}let Xe=n(()=>Pe.value&&Fe.value&&c.value&&!Fr.value),Ze=n(()=>ci({desk:Hi.value,live:c.value,mode:F.value,cell:!!r.cell})&&!(xe.value&&F.value!==`term`)&&!(F.value===`chat`&&Pe.value)),$e=n(()=>Ti({desk:Hi.value,live:c.value,mode:F.value,available:!(!p.value||!zi.value||Sr.value||we.value||Qr(p.value))}));function et(e){let t=e.target,n=[...t.files||[]];t.value=``,tt(n)}async function tt(e){if($e.value&&p.value)for(let t of e)try{let e=t.name.includes(`.`)&&t.name.split(`.`).pop()||``,n=await fetch(`/api/file?pane=${encodeURIComponent(r.paneId)}&ext=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/octet-stream`},body:t}),i=await n.json().catch(()=>({}));if(!n.ok)throw Error(Z(i.error||`HTTP ${n.status}`));ve(await je(p.value,r.paneId,i.path)),X()}catch(e){$(`${Z(`File upload failed`)} : ${e.message}`,!0)}}let rt=n(()=>$e.value?`term`:Ze.value&&!Sr.value?`chat`:null),at=h(0);function ot(e){Wn(e.dataTransfer)&&rt.value&&(e.preventDefault(),e.type===`dragover`&&e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),at.value=xn(at.value,e.type))}function lt(e){if(at.value=0,!Wn(e.dataTransfer)||!rt.value)return;e.preventDefault();let t=[...e.dataTransfer?.files||[]];if(t.length){if(rt.value===`term`)return tt(t);U.value?.addFiles(t).then(e=>{e&&(U.value?.focus(),X())})}}let ut=n(()=>p.value?.agent===`claude`?Z(`Images, PDFs, text and code files`):Z(`Images, text and code files`));it();let dt=n(()=>{let e=p.value,t=e?[St(e)]:[];if($e.value&&t.push({label:Z(`Attach a file…`),icon:`i-lucide-paperclip`,run:()=>Ae.value?.click()}),e&&t.push({label:Z(`View changes`),icon:`i-lucide-file-diff`,run:()=>{Oe.value=!0}}),e&&t.push({label:Z(`Browse files`),icon:`i-lucide-folder-tree`,run:()=>{ke.value=!0}}),e&&bi(e)&&t.push({label:Z(`Open in editor`),icon:`i-lucide-external-link`,kbds:c.value?ct(`open-editor`):void 0,run:()=>Yr(e)}),e&&t.push({label:Z(`Rename pane`),icon:`i-lucide-pencil`,run:()=>{ze.value=e.id}}),e&&t.push(...de(e)),e&&t.push(nt(e)),e&&cn(e.machine).length&&t.push({label:Z(`Plugin actions`),icon:`i-lucide-puzzle`,run:()=>un({pane:e})}),t.push({label:Z(`Take control of this terminal`),icon:`i-lucide-arrow-left-right`,run:()=>{L.value=null,A.value=`term`,P(()=>R.connect(!0))}}),e&&ue(e)&&!e.restart&&t.push({label:Z(`Restart agent`),icon:`i-lucide-rotate-cw`,run:()=>De(e)}),t.push({label:Z(`Reconnect`),icon:`i-lucide-refresh-cw`,run:()=>{L.value=null,A.value=`term`,P(()=>{R.reset(),R.connect(!1)})}}),r.cell||t.push(...jt()),e){t.push({kind:`separator`}),t.push({label:e.agent?Q(`Close this pane (stops ${$r(e.agent)})`,`Fermer ce pane (arrête ${$r(e.agent)})`):Z(`Close this terminal`),icon:`i-lucide-trash-2`,danger:!0,kbds:c.value?ct(`close-pane`):void 0,run:()=>Ee(e)});let n=ur.value.workspaces.find(t=>t.id===e.workspace);n&&n.worktree&&t.push({label:Z(`Delete this worktree`),icon:`i-lucide-git-branch`,danger:!0,run:()=>pt(e.workspace)})}return t});async function pt(e){await oa();let t=(ta.value||[]).find(t=>t.workspace===e);if(!t)return $(Z(`Worktree not found`),!0);await ia(t)&&Bt(`/`)}let gt=n(()=>kt(dt.value));function vt(){Pt(dt.value)}B(()=>p.value&&(p.value.machine||``),e=>{e!==void 0&&Ut(e)},{immediate:!0});let yt=n(()=>[{label:Z(`Conversation`),value:`chat`,icon:`i-lucide-message-square`},{label:Z(`Terminal`),value:`term`,icon:`i-lucide-square-terminal`}]),xt={list:`hw-tabs`,trigger:`hw-tab`,indicator:`hw-tab-ind`,leadingIcon:`hw-tab-icon`,label:`hw-tab-label`},Ct=n({get:()=>F.value===`term`?`term`:`chat`,set:e=>J(e===`term`?`term`:`chat`)}),Tt=n(()=>F.value===`term`&&(!r.cell||!!(di.value&&r.active))&&zi.value&&!Sr.value&&!we.value),Et=n(()=>_i({desk:Hi.value,cell:!!r.cell,chat:Xr(p.value),live:c.value})),Dt=n(()=>!r.cell&&p.value&&Pi(wt(p.value.workspace).length).headerAdd);B(Rr,e=>R.setFontSize(e)),B(qr,e=>{R.setVisible(e)});let Ot=n(()=>p.value?ft(p.value.tab):null),At=n(()=>!!(Ot.value&&Ot.value.panes.length>1));function Mt(){Ot.value&&(Hi.value?Bt({path:st(Ot.value.tab.id),query:{pane:r.paneId}}):ht(Ot.value.tab.id))}function Nt(){let e=history.state?.back;e===`/board`||Ot.value&&e===st(Ot.value.tab.id)?s.back():Bt(`/`)}let Ft=Ve.value;Ve.value=0;let It=h(0),Rt=h(!1),Jt=0,Xt=0,Zt=0,Qt=`off`,$t=e=>Ot.value?li(Ot.value.layout,r.paneId,e):null;function en(e,t){for(let n=e;n&&n!==t;n=n.parentElement)if(n.scrollWidth>n.clientWidth+1&&/(auto|scroll)/.test(getComputedStyle(n).overflowX))return!0;return!1}function tn(e){if(Qt=`off`,r.cell||Hi.value||!At.value||e.touches.length!==1)return;let t=e.target?.closest?.(`.swipe-area, .choices, #termWrap`);t&&!en(e.target,t)&&(Jt=e.touches[0].clientX,Xt=e.touches[0].clientY,Zt=Date.now(),Qt=null)}function nn(e){if(Qt===`off`||Qt===`y`)return;let t=e.touches[0].clientX-Jt,n=e.touches[0].clientY-Xt;Qt===null&&(Qt=On(t,n)),Qt===`x`&&(e.preventDefault(),Rt.value=!0,It.value=En(t,!!$t(t<0?1:-1)))}function rn(e){if(Qt===`x`){let t=(e.changedTouches[0]?.clientX??Jt)-Jt,n=hn(t,Date.now()-Zt,window.innerWidth),r=n?$t(n):null;r&&(X(),Ve.value=n,s.replace(Be(r)))}Qt=`off`,Rt.value=!1,It.value=0}let on=n(()=>At.value&&!Hi.value?{transform:It.value?`translateX(${It.value}px)`:void 0,transition:Rt.value?`none`:`transform .18s ease`}:{});w(()=>{Hi.value&&c.value&&setTimeout(()=>(F.value===`term`?R:U.value)?.focus(),50)}),B(()=>r.active,(e,t)=>{e&&!t&&r.cell&&setTimeout(()=>{document.activeElement?.closest(`.cell-view.active`)||(F.value===`term`?R:U.value)?.focus()},50)});function sn(e){let t=e.target;r.cell&&Hi.value&&t?.closest?.(`.agent-top`)&&!t.closest(`button, a, input, [role="tab"], .cell-grip`)&&(document.activeElement&&document.activeElement!==document.body||(F.value===`term`?R:U.value)?.focus())}let fn=n(()=>zn.value?{height:`${_n.value}px`,top:`${Bn.value}px`}:{});return(t,n)=>{let r=Ke,o=Oa,s=_t,l=Xn,u=Nn,d=Ma,h=mt,y=pn,S=Yt,C=La,w=Ra,A=sd,P=hd,B=Nf,ee=lp,K=Ap,te=Ed,ne=fh,ae=Ug,oe=Gt,se=_c;return _(),v(`section`,{id:e.cell?void 0:`agent`,class:j(e.cell?[`cell-view`,{active:e.active,gripped:e.grip}]:`view`),style:N(e.cell?void 0:f(fn)),"data-pane":e.cell?e.paneId:void 0,onTouchstart:tn,onTouchmove:nn,onTouchend:rn,onTouchcancel:rn,onPointerdownCapture:n[16]||=t=>e.cell&&i(`activate`),onFocusin:n[17]||=t=>e.cell&&i(`activate`),onClick:sn,onDragenter:ot,onDragover:ot,onDragleave:ot,onDrop:lt},[f(at)&&f(rt)?(_(),v(`div`,Gg,[E(r,{name:f(rt)===`term`?`i-lucide-paperclip`:`i-lucide-file-plus`,class:`file-drop-icon`},null,8,[`name`]),I(`span`,Kg,M((`t`in t?t.t:f(Z))(`Drop to attach`)),1),I(`small`,null,M(f(rt)===`term`?(`t`in t?t.t:f(Z))(`The file path is sent to the terminal`):f(ut)),1)])):g(``,!0),!e.cell&&f(p)?(_(),m(o,{key:1,workspace:f(p).workspace,current:f(p).tab},null,8,[`workspace`,`current`])):g(``,!0),e.embedded?g(``,!0):(_(),m(C,{key:2,items:()=>f(dt),disabled:!f(p)},{default:H(()=>[I(`header`,qg,[e.cell&&e.grip?(_(),v(`span`,{key:0,class:`cell-grip`,role:`button`,"aria-label":(`t`in t?t.t:f(Z))(`Drag to move the pane`),title:(`t`in t?t.t:f(Z))(`Drag to move the pane`)},[E(r,{name:`i-lucide-grip-vertical`})],8,Jg)):g(``,!0),e.cell?g(``,!0):(_(),m(s,{key:1,id:`btnBack`,icon:`i-lucide-chevron-left`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn back`,"aria-label":(`t`in t?t.t:f(Z))(`Back`),onClick:Nt},null,8,[`aria-label`])),I(`div`,Yg,[I(`div`,Xg,[a(M(f(T))+` `,1),f(p)&&(`paneNotificationsMuted`in t?t.paneNotificationsMuted:f(Ie))(f(p))?(_(),m(r,{key:0,name:`i-lucide-bell-off`,class:`notification-muted`,title:(`t`in t?t.t:f(Z))(`Muted`)},null,8,[`title`])):g(``,!0)]),I(`div`,Zg,[E(l,{pane:f(p),kind:``},null,8,[`pane`]),f(D)?(_(),v(`span`,Qg,M(f(D)),1)):g(``,!0),f(O)?(_(),v(`span`,$g,M(f(O)),1)):g(``,!0),f(k)?(_(),v(`span`,e_,M(f(k)),1)):g(``,!0),f(Ce)?(_(),v(`span`,{key:3,class:j([`agent-machine`,f(Ce).status]),title:f(Ce).target?`ssh ${f(Ce).target}`:void 0},[E(r,{name:f(Ce).local?`i-lucide-server`:`i-lucide-laptop`},null,8,[`name`]),I(`span`,n_,M((`machineName`in t?t.machineName:f(Hr))(f(Ce).key)),1),f(Ce).local?(_(),m(u,{key:0})):g(``,!0)],10,t_)):g(``,!0),f(Se)?(_(),v(`span`,r_,M(f(Se)),1)):g(``,!0)])]),f(Et).selector===`cell`?(_(),m(d,{key:2,modelValue:f(Ct),"onUpdate:modelValue":n[0]||=e=>G(Ct)?Ct.value=e:null,items:f(yt),content:!1,color:`neutral`,variant:`pill`,size:`xs`,class:`view-tabs`,ui:xt},null,8,[`modelValue`,`items`])):g(``,!0),I(`div`,i_,[f(Et).selector===`header`?(_(),m(d,{key:0,modelValue:f(Ct),"onUpdate:modelValue":n[1]||=e=>G(Ct)?Ct.value=e:null,items:f(yt),content:!1,color:`neutral`,variant:`pill`,size:`xs`,class:`view-tabs`,ui:xt},null,8,[`modelValue`,`items`])):g(``,!0),f(Dt)&&f(p)?(_(),m(s,{key:1,icon:`i-lucide-plus`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Z))(`New tab`),title:(`t`in t?t.t:f(Z))(`New tab`),disabled:`offlineView`in t?t.offlineView:f(Sr),onClick:n[2]||=e=>(`newTab`in t?t.newTab:f(ge))(f(p).workspace)},null,8,[`aria-label`,`title`,`disabled`])):g(``,!0),e.cell?(_(),m(h,{key:2,text:(`t`in t?t.t:f(Z))(`Open alone`)},{default:H(()=>[E(s,{icon:`i-lucide-maximize-2`,color:`neutral`,variant:`ghost`,size:`md`,class:`icon-btn cell-extra`,"aria-label":(`t`in t?t.t:f(Z))(`Open alone`),to:(`panePath`in t?t.panePath:f(Be))(e.paneId)},null,8,[`aria-label`,`to`])]),_:1},8,[`text`])):f(At)&&f(Ot)?(_(),m(h,{key:3,text:(`t`in t?t.t:f(Z))(`Side by side`),disabled:!(`desk`in t?t.desk:f(Hi))},{default:H(()=>[I(`button`,{type:`button`,class:`map-btn`,"aria-label":(`desk`in t?t.desk:f(Hi))?(`t`in t?t.t:f(Z))(`Side by side`):(`t`in t?t.t:f(Z))(`Tab overview`),onClick:Mt},[E(y,{layout:f(Ot).layout,panes:f(Ot).panes,current:e.paneId},null,8,[`layout`,`panes`,`current`])],8,a_)]),_:1},8,[`text`,`disabled`])):g(``,!0),f(Et).term?(_(),m(s,{key:4,icon:`i-lucide-square-terminal`,color:`neutral`,variant:`ghost`,size:`lg`,class:j([`icon-btn mode-btn`,{on:f(F)===`term`}]),"aria-label":(`t`in t?t.t:f(Z))(`Terminal`),"aria-pressed":f(F)===`term`,onClick:n[3]||=e=>re(`term`)},null,8,[`class`,`aria-label`,`aria-pressed`])):g(``,!0),(`hasChat`in t?t.hasChat:f(Xr))(f(p))&&(f(c)||e.cell)?(_(),m(h,{key:5,text:(`t`in t?t.t:f(Z))(`Search`),kbds:f(F)===`chat`?(`shortcutKbds`in t?t.shortcutKbds:f(ct))(`search-chat`):void 0,disabled:!(`desk`in t?t.desk:f(Hi))},{default:H(()=>[E(s,{icon:`i-lucide-search`,color:`neutral`,variant:`ghost`,size:`lg`,class:j([`icon-btn cell-extra`,{on:f(W)}]),"aria-label":(`t`in t?t.t:f(Z))(`Search`),onClick:ie},null,8,[`class`,`aria-label`])]),_:1},8,[`text`,`kbds`,`disabled`])):g(``,!0),(`sheetMenus`in t?t.sheetMenus:f(fi))?(_(),m(s,{key:7,icon:`i-lucide-ellipsis`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Z))(`Options`),onClick:vt},null,8,[`aria-label`])):(_(),m(S,{key:6,items:f(gt),content:{align:`end`,sideOffset:6},ui:{content:`hw-dropdown`}},{default:H(()=>[E(s,{icon:`i-lucide-ellipsis`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Z))(`Options`)},null,8,[`aria-label`])]),_:1},8,[`items`]))])])]),_:1},8,[`items`,`disabled`])),I(`div`,o_,[I(`div`,s_,[(`desk`in t?t.desk:f(Hi))&&!e.cell&&(`backdrop`in t?t.backdrop:f(_e))===`wherdr`&&f(F)===`chat`?(_(),m(w,{key:0})):g(``,!0),f(we)&&f(Ce)?(_(),v(`div`,c_,[E(r,{name:`i-lucide-unplug`,class:`term-banner-icon`}),I(`span`,null,[a(M(f(Ce).status===`connecting`?(`tl`in t?t.tl:f(Q))(`${(`machineName`in t?t.machineName:f(Hr))(f(Ce).key)} unreachable — reconnecting…`,`${(`machineName`in t?t.machineName:f(Hr))(f(Ce).key)} injoignable — reconnexion…`):(`tl`in t?t.tl:f(Q))(`${(`machineName`in t?t.machineName:f(Hr))(f(Ce).key)} offline`,`${(`machineName`in t?t.machineName:f(Hr))(f(Ce).key)} hors ligne`)),1),f(Ce).error?(_(),v(`small`,l_,M((`t`in t?t.t:f(Z))(f(Ce).error)),1)):g(``,!0)])])):g(``,!0),f(L)===q&&f(le)?(_(),v(`div`,u_,[E(r,{name:`i-lucide-refresh-cw`,class:`term-banner-icon`}),I(`span`,null,M((`tl`in t?t.tl:f(Q))(`This agent continues in a new pane.`,`Cet agent continue dans un nouveau pane.`)),1),E(s,{size:`xs`,color:`warning`,variant:`outline`,to:(`panePath`in t?t.panePath:f(Be))(f(le).id)},{default:H(()=>[a(M((`tl`in t?t.tl:f(Q))(`Open`,`Ouvrir`)),1)]),_:1},8,[`to`])])):f(L)?(_(),v(`div`,{key:3,class:j([`term-banner`,{"closed-banner":f(L)===q}])},[E(r,{name:`i-lucide-triangle-alert`,class:`term-banner-icon`}),I(`span`,null,M(f(L)===q&&f(pe)?(`tl`in t?t.tl:f(Q))(`This pane has been closed. Your draft is kept below.`,`Ce pane a été fermé. Ton brouillon est gardé ci-dessous.`):f(L).text),1),f(L)===q&&f(pe)?(_(),m(s,{key:0,size:`xs`,color:`warning`,variant:`outline`,icon:`i-lucide-copy`,onClick:me},{default:H(()=>[a(M((`tl`in t?t.tl:f(Q))(`Copy draft`,`Copier le brouillon`)),1)]),_:1})):g(``,!0),E(s,{size:`xs`,color:`warning`,variant:`outline`,onClick:n[4]||=e=>f(L).fn()},{default:H(()=>[a(M(f(L).btn),1)]),_:1})],2)):g(``,!0),f(p)&&f(F)===`chat`?(_(),v(`div`,{key:4,class:j([`swipe-area`,f(Ft)?f(Ft)>0?`enter-next`:`enter-prev`:void 0]),style:N(f(on))},[E(A,{ref_key:`chatRef`,ref:z,search:f(W),"onUpdate:search":n[5]||=e=>G(W)?W.value=e:null,pane:f(p),"local-queued":f(he),onGotoTerm:n[6]||=e=>J(`term`),onRestored:n[7]||=e=>f(U)?.focus(),onQuote:n[8]||=e=>f(U)?.focusEnd(),onAnswered:n[9]||=e=>f(U)?.focusAnswer(e),onUnanswered:n[10]||=e=>V.value=e,onSent:ve},null,8,[`search`,`pane`,`local-queued`])],6)):f(F)===`term`&&(!(`eventsOpen`in t?t.eventsOpen:f(zi))||(`offlineView`in t?t.offlineView:f(Sr))||f(we))?(_(),v(`div`,d_,[E(r,{name:`i-lucide-wifi-off`,class:`chat-empty-icon`}),I(`p`,null,M((`t`in t?t.t:f(Z))(`Terminal unavailable offline`)),1)])):f(F)===`term`?(_(),m(P,{key:6,ctl:f(R),class:j(f(Ft)?f(Ft)>0?`enter-next`:`enter-prev`:void 0),style:N(f(on))},null,8,[`ctl`,`class`,`style`])):(_(),v(`div`,f_)),f(p)?.agent&&!(`hasChat`in t?t.hasChat:f(Xr))(f(p))&&f(F)===`term`&&!e.cell&&!f(b)?(_(),v(`div`,p_,[I(`span`,null,M((`tl`in t?t.tl:f(Q))(`Conversation unavailable for this agent · follow it in the terminal`,`Conversation non disponible pour cet agent · suivi dans le terminal`)),1),I(`button`,{type:`button`,"aria-label":(`t`in t?t.t:f(Z))(`Hide`),title:(`t`in t?t.t:f(Z))(`Hide`),onClick:x},`×`,8,m_)])):g(``,!0),f(Xe)?(_(),m(B,{key:9,"pane-id":e.paneId,active:f(c),title:f(T),onClose:qe},null,8,[`pane-id`,`active`,`title`])):(f(Le)||f(Pe))&&f(Fe)?(_(),v(`button`,{key:10,type:`button`,class:`interactive-terminal-reopen`,onClick:Ye},[E(r,{name:`i-lucide-square-terminal`}),a(M((`tl`in t?t.tl:f(Q))(`Open interactive terminal`,`Ouvrir le terminal interactif`)),1)])):g(``,!0),(f(ye)||f(be))&&!f(Pe)&&!f(Le)&&!f(Me)&&(`eventsOpen`in t?t.eventsOpen:f(zi))&&!(`offlineView`in t?t.offlineView:f(Sr))&&!f(we)?(_(),m(ee,{key:11,"pane-id":e.paneId,prompt:f(ye),screen:f(be),keys:f(c)},null,8,[`pane-id`,`prompt`,`screen`,`keys`])):f(xe)&&!f(Pe)&&!f(Le)&&!f(Me)&&(`eventsOpen`in t?t.eventsOpen:f(zi))&&!(`offlineView`in t?t.offlineView:f(Sr))&&!f(we)?(_(),m(K,{key:12,"pane-id":e.paneId,menu:f(xe),keys:f(c),onTerminal:n[11]||=e=>J(`term`)},null,8,[`pane-id`,`menu`,`keys`])):g(``,!0),f(Tt)?(_(),m(te,{key:13,ctl:f(R)},null,8,[`ctl`])):g(``,!0),f(Ze)?(_(),m(ne,{key:14,ref_key:`composer`,ref:U,pane:f(p),"pane-id":e.paneId,"send-keys":f(R).sendKeys,conversation:f(F)===`chat`,"term-shown":f(Me),"esc-stops":!f(W),"take-back":f(F)===`chat`,unanswered:f(F)===`chat`?f(V):0,onSent:ve,onShowTerminal:n[12]||=e=>J(`term`),onShowUnanswered:n[13]||=e=>f(z)?.gotoUnanswered()},null,8,[`pane`,`pane-id`,`send-keys`,`conversation`,`term-shown`,`esc-stops`,`take-back`,`unanswered`])):g(``,!0)])]),E(oe,{open:f(Oe),"onUpdate:open":n[14]||=e=>G(Oe)?Oe.value=e:null,title:(`t`in t?t.t:f(Z))(`Changes`),wide:``,full:``,screen:``},{default:H(()=>[f(Oe)&&f(p)?(_(),m(ae,{key:0,"pane-id":e.paneId,onReview:Te},null,8,[`pane-id`])):g(``,!0)]),_:1},8,[`open`,`title`]),E(oe,{open:f(ke),"onUpdate:open":n[15]||=e=>G(ke)?ke.value=e:null,title:(`t`in t?t.t:f(Z))(`Files`),wide:``,full:``,screen:``},{default:H(()=>[f(ke)&&f(p)?(_(),m(se,{key:0,"pane-id":e.paneId},null,8,[`pane-id`])):g(``,!0)]),_:1},8,[`open`,`title`]),I(`input`,{ref_key:`attachInput`,ref:Ae,type:`file`,multiple:``,hidden:``,onChange:et},null,544)],46,Wg)}}}),[[`__scopeId`,`data-v-745f7953`]]),{__name:`AgentView`});export{La as a,Ba as i,um as n,Ia as o,vc as r,Oa as s,g_ as t};
97
+ `)}`:``}var Mg=[`aria-label`,`aria-describedby`],Ng=[`id`],Pg=[`data-row`,`onClick`],Fg=[`tabindex`,`aria-label`,`aria-pressed`,`onPointerdown`,`onClick`,`onKeydown`,`onFocus`],Ig={class:`review-number`},Lg={class:`review-source`},Rg=Object.assign(T({__name:`ReviewDiff`,props:{file:{},scope:{},comments:{},selection:{}},emits:[`add`,`select`,`act`],setup(e,{emit:t}){let r=e,i=t,a=h(null),o=p(),s=n(()=>lg(r.file.lines)),c=n(()=>({line:Q(`Line`),lines:Q(`Lines`),oldLine:Q(`old line`),oldLines:Q(`old lines`)})),u=h(null),d=n(()=>r.comments.flatMap(e=>{let t=e.scope===r.scope&&e.path===r.file.path?xg(e,s.value):null;return t?[{c:e,at:t}]:[]})),b=n(()=>{let e=new Map,t=new Set,n=new Set;for(let{c:r,at:i}of d.value){e.set(i[1],[...e.get(i[1])??[],r]);let a=r.draft!==void 0||r.id===u.value?t:n;for(let e=i[0];e<=i[1];e++)a.add(e)}return{notes:e,open:t,noted:n}});function x(e){let t=d.value.find(t=>t.c.id===e.id)?.at;return Ag(t?pg(s.value.slice(t[0],t[1]+1)):Dg(e),c.value)}let S=n(()=>r.selection&&r.selection.scope===r.scope&&r.selection.path===r.file.path?r.selection:null),C=n(()=>S.value?[Math.min(S.value.anchor,S.value.head),Math.max(S.value.anchor,S.value.head)]:null),w=n(()=>S.value?ug(s.value,S.value.anchor):null);function T(e,t,n){let a=dg(s.value,e,t);return i(`select`,{scope:r.scope,path:r.file.path,anchor:e,head:a[0]===e?a[1]:a[0],via:n,block:s.value.slice(a[0],a[1]+1)}),a}function E(e,t,n){let a=s.value.slice(e,t+1);a.some(e=>e.number!==null)&&i(`add`,r.scope,r.file.path,a,n),i(`select`,null)}let D=``;function O(e){D=e.pointerType}let A=null;function N(e){let t=a.value?.getBoundingClientRect(),n=t&&document.elementFromPoint(t.left+4,e)?.closest(`[data-row]`);return n&&a.value.contains(n)?Number(n.dataset.row):null}function I(e){let t=N(e.clientY);A&&t!==null&&s.value[t]?.number!=null&&(A.at=T(A.anchor,t,`drag`))}function L(){A=null,window.removeEventListener(`pointermove`,I),window.removeEventListener(`pointerup`,R),window.removeEventListener(`pointercancel`,B),window.removeEventListener(`keydown`,V,!0)}function R(){let e=A;L(),e&&E(e.at[0],e.at[1],e.extend)}function B(){L(),i(`select`,null)}function V(e){e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),B())}function H(e,t){if(e.pointerType!==`mouse`||e.button!==0)return;e.preventDefault(),e.currentTarget.focus();let[n,r]=ug(s.value,t),i=e.shiftKey?d.value.findLast(e=>e.c.draft!==void 0&&e.at[0]>=n&&e.at[1]<=r):void 0,a=i?t>=i.at[0]?i.at[0]:i.at[1]:t;A={anchor:a,at:T(a,t,`drag`),extend:i?.c.id},window.addEventListener(`pointermove`,I),window.addEventListener(`pointerup`,R),window.addEventListener(`pointercancel`,B),window.addEventListener(`keydown`,V,!0)}l(L),z(()=>r.file,()=>{A&&B()});function ee(e){let t=S.value,n=w.value;!t||!n||t.via===`drag`||e<n[0]||e>n[1]?T(e,e,`touch`):e===t.anchor&&t.head===t.anchor?i(`select`,null):T(t.anchor,e,`touch`)}function U(e,t){if(!e.detail){let e=S.value?.via===`keys`?C.value:null;return E(e?e[0]:t,e?e[1]:t)}D!==`mouse`&&ee(t)}function W(e,t){D===`mouse`||S.value?.via!==`touch`||e.number===null||window.getSelection()?.toString()||ee(t)}let G=h(-1),K=n(()=>G.value>=0&&s.value[G.value]?.number!=null?G.value:s.value.findIndex(e=>e.number!==null));function te(e){a.value?.querySelector(`[data-row="${e}"] .review-gutter`)?.focus()}function ne(e,t,[n,r]){for(let i=e+t;i>=n&&i<=r;i+=t)if(s.value[i].number!==null)return i;return e}function q(e,t){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let n=e.key===`ArrowDown`?1:-1;if(e.shiftKey){let e=S.value?.via===`keys`?S.value.anchor:t,r=ne(t,n,ug(s.value,e));T(e,r,`keys`),te(r)}else S.value&&i(`select`,null),te(ne(t,n,[0,s.value.length-1]))}else e.key===`Escape`&&S.value&&(e.preventDefault(),e.stopPropagation(),i(`select`,null))}function ie(e,t,n){let r=d.value.find(e=>e.c.id===t)?.at[1];i(`act`,e,t,n),e!==`draft`&&e!==`edit`&&(u.value=null,r!==void 0&&a.value?.contains(document.activeElement)&&P(()=>te(r)))}function ae(e){return`${Q(`Comment on line`)} ${e.number}${e.side===`old`?` (${Q(`old line`)})`:``}`}return(t,n)=>{let r=cg;return _(),v(`div`,{ref_key:`root`,ref:a,class:j([`change-code`,{picking:f(S),dragging:f(S)?.via===`drag`}]),role:`region`,"aria-label":e.file.path,"aria-describedby":f(o)},[F(`p`,{id:f(o),class:`sr-only`},M((`t`in t?t.t:f(Q))(`Arrow keys move between lines. Shift+Arrow selects a block of lines. Enter writes a comment.`)),9,Ng),(_(!0),v(k,null,y(f(s),(e,t)=>(_(),v(k,{key:t},[F(`div`,{class:j([`change-line review-line`,[e.kind,{picked:f(C)&&t>=f(C)[0]&&t<=f(C)[1],open:f(b).open.has(t),noted:f(b).noted.has(t),out:f(w)&&(t<f(w)[0]-1||t>f(w)[1])}]]),"data-row":t,onPointerdown:O,onClick:n=>W(e,t)},[e.number===null?g(``,!0):(_(),v(`button`,{key:0,type:`button`,class:`review-gutter`,tabindex:t===f(K)?0:-1,"aria-label":ae(e),"aria-pressed":f(C)?t>=f(C)[0]&&t<=f(C)[1]:void 0,onPointerdown:e=>H(e,t),onClick:re(e=>U(e,t),[`stop`]),onKeydown:e=>q(e,t),onFocus:e=>G.value=t},[n[1]||=F(`span`,{class:`review-plus`,"aria-hidden":`true`},`+`,-1),F(`span`,Ig,M(e.number),1)],40,Fg)),F(`span`,Lg,M(e.text),1)],42,Pg),(_(!0),v(k,null,y(f(b).notes.get(t),e=>(_(),m(r,{key:e.id,comment:e,label:x(e),onAct:ie,onHover:n[0]||=e=>u.value=e},null,8,[`comment`,`label`]))),128))],64))),128))],10,Mg)}}}),{__name:`ReviewDiff`}),zg=e=>e===`old`||e===`new`,Bg=e=>Number.isInteger(e)&&e>0,Vg=e=>!!e&&Bg(e.number)&&zg(e.side)&&typeof e.text==`string`,Hg=e=>e===void 0||Array.isArray(e)&&e.length===2&&e.every(Bg);function Ug(e){return e&&typeof e.id==`string`&&[`working`,`committed`].includes(e.scope)&&typeof e.path==`string`&&Vg(e)&&typeof e.body==`string`&&(e.end===void 0||Vg(e.end))&&(e.span===void 0||typeof e.span==`object`&&e.span!==null&&Hg(e.span.new)&&Hg(e.span.old)&&!!(e.span.new||e.span.old))&&(e.excerpt===void 0||Array.isArray(e.excerpt)&&e.excerpt.every(e=>typeof e==`string`))&&(e.draft===void 0||typeof e.draft==`string`)&&(e.hash===void 0||typeof e.hash==`string`)}function Wg(e){try{let t=JSON.parse(e||`[]`);return Array.isArray(t)?t.filter(e=>Ug(e)&&(e.body.trim()||e.draft?.trim())):[]}catch{return[]}}function Gg(e){let t=`review:${e}`,n=h([]);try{n.value=Wg(localStorage.getItem(t))}catch{}z(n,e=>{try{let n=e.length?JSON.stringify(e):null;if(n===localStorage.getItem(t))return;n?localStorage.setItem(t,n):localStorage.removeItem(t)}catch{}},{deep:!0,flush:`sync`});function r(e){if(e.key!==t&&e.key!==null)return;let r=new Map(n.value.filter(e=>e.draft!==void 0).map(e=>[e.id,e]));n.value=Wg(e.key===null?null:e.newValue).map(e=>r.get(e.id)??e)}return typeof window<`u`&&(window.addEventListener(`storage`,r),s(()=>window.removeEventListener(`storage`,r))),n}var Kg={class:`changes-view`},qg={class:`changes-inner`},Jg={class:`changes-toolbar`},Yg={key:0,class:`changes-location`},Xg={key:0,class:`review-hint`},Zg={class:`by-mouse`},Qg={class:`by-touch`},$g={key:1,class:`review-toolbar`},e_={role:`status`},t_={key:2,class:`changes-notice error`,role:`alert`},n_={key:3,class:`changes-notice`},r_={key:4,class:`changes-notice`},i_={class:`changes-section`},a_={key:0,class:`changes-notice`},o_={key:0,class:`changes-limit`},s_={class:`change-path`},c_={key:0,class:`change-binary`},l_={key:1,class:`change-totals`},u_={class:`change-status`},d_={key:0,class:`change-note`},f_={key:1,class:`change-note`},p_={class:`changes-section`},m_={class:`changes-toggle`},h_={class:`changes-location`},g_={key:0,class:`changes-limit`},__={key:1,class:`changes-notice`},v_={class:`change-path`},y_={key:0,class:`change-binary`},b_={key:1,class:`change-totals`},x_={key:0,class:`change-note`},S_={key:1,class:`changes-notice`},C_={class:`sr-only`,role:`status`},w_={key:6,class:`review-pick`},T_=Object.assign(T({__name:`ChangesView`,props:{paneId:{}},emits:[`review`],setup(e,{emit:t}){let r=e,i=t,o=Gg(r.paneId),s=n(()=>O.value?wg(o.value,O.value,N.value):[]),c=n(()=>Object.fromEntries(s.value.map(e=>[e.id,Cg(e,O.value,N.value)??void 0]))),u=n(()=>o.value.filter(Eg).length),d=n(()=>({line:Q(`Line`),lines:Q(`Lines`),oldLine:Q(`old line`),oldLines:Q(`old lines`)})),p=h(null),b=n(()=>p.value?Ag(pg(p.value.block),d.value):``);function x(e){P(()=>document.getElementById(`review-${e}`)?.focus())}function S(e){o.value=o.value.filter(t=>t.id!==e)}function C(e,t,n){let r=o.value.find(e=>e.id===t);r&&(e===`draft`?r.draft=n??``:e===`edit`?(r.draft=r.body,x(t)):e===`save`&&Eg(r)?(r.body=Eg(r),delete r.draft):e===`cancel`&&r.body?delete r.draft:S(t))}function T(e,t,n,r){if(!n.some(e=>e.number!==null))return;let i=_g(n),a=o.value.find(n=>r?n.id===r:n.scope===e&&n.path===t&&yg(n,i));a&&r?Object.assign(a,i):a?a.draft??=a.body:(a={id:crypto.randomUUID(),scope:e,path:t,...i,body:``,draft:``},o.value.push(a)),p.value=null,x(a.id)}function D(){let e=jg(O.value?Tg(o.value,O.value):o.value,{intro:Q(`Please review these points:`),oldLine:Q(`old line`),oldLines:Q(`old lines`),missing:Q(`no longer in diff`),changed:Q(`code changed since this comment`)},c.value);e&&(i(`review`,e),o.value=[])}let O=h(null),A=h(!1),j=h(``),N=h(o.value.some(e=>e.scope===`committed`)),L=0;async function R(){let e=++L;A.value=!0,j.value=``;try{let t=await xi(`/api/changes?pane=${encodeURIComponent(r.paneId)}&commits=${N.value?`1`:`0`}`);e===L&&(O.value=t)}catch(t){e===L&&(j.value=t.message)}finally{e===L&&(A.value=!1)}}w(R),z(N,R),z(O,()=>{p.value=null}),l(()=>{L++});function B(e){return e.status===`??`?Q(`Untracked`):e.status===`commit`?Q(`Commit`):e.status.includes(`R`)?Q(`Renamed`):e.status.includes(`D`)?Q(`Deleted`):e.status.includes(`A`)?Q(`Added`):Q(`Modified`)}function H(e,t){return e===null?`${t}—`:`${t}${e}`}return(e,t)=>{let n=bt,r=cg,i=Rg;return _(),v(`div`,Kg,[F(`div`,qg,[F(`div`,Jg,[F(`div`,null,[f(O)?.git?(_(),v(`p`,Yg,M(f(O).branch||`HEAD`)+` · `+M(f(O).root),1)):g(``,!0)]),E(n,{icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`outline`,size:`sm`,loading:f(A),"aria-label":(`t`in e?e.t:f(Q))(`Refresh changes`),onClick:R},{default:V(()=>[a(M((`t`in e?e.t:f(Q))(`Refresh`)),1)]),_:1},8,[`loading`,`aria-label`])]),f(O)?.git&&!f(o).length?(_(),v(`p`,Xg,[F(`span`,Zg,M((`t`in e?e.t:f(Q))(`To comment, hover a line and click +. Drag from the + to comment a block of lines.`)),1),F(`span`,Qg,M((`t`in e?e.t:f(Q))(`To comment, tap a line number, then another line for a block.`)),1)])):g(``,!0),f(o).length?(_(),v(`div`,$g,[F(`span`,e_,M(f(u))+` `+M((`t`in e?e.t:f(Q))(f(u)===1?`review comment`:`review comments`)),1),E(n,{color:`neutral`,variant:`outline`,onClick:t[0]||=e=>o.value=[]},{default:V(()=>[a(M((`t`in e?e.t:f(Q))(`Discard`)),1)]),_:1}),E(n,{disabled:!f(u),onClick:D},{default:V(()=>[a(M((`t`in e?e.t:f(Q))(`Send review`)),1)]),_:1},8,[`disabled`]),F(`p`,null,M((`t`in e?e.t:f(Q))(`Adds to your message draft. You send it yourself.`)),1)])):g(``,!0),(_(!0),v(k,null,y(f(s),e=>(_(),m(r,{key:e.id,comment:e,label:f(Ag)(f(Dg)(e),f(d)),missing:``,changed:f(c)[e.id]===`changed`,onAct:C},null,8,[`comment`,`label`,`changed`]))),128)),f(j)?(_(),v(`p`,t_,M(f(j)),1)):g(``,!0),f(A)&&!f(O)?(_(),v(`p`,n_,[t[6]||=F(`span`,{class:`spinner`},null,-1),a(` `+M((`t`in e?e.t:f(Q))(`Reading changes…`)),1)])):f(O)&&!f(O).git?(_(),v(`p`,r_,M((`t`in e?e.t:f(Q))(`This folder is not a Git repository.`)),1)):f(O)?.git?(_(),v(k,{key:5},[F(`section`,i_,[F(`h3`,null,[a(M((`t`in e?e.t:f(Q))(`Working tree`))+` `,1),F(`span`,null,M(f(O).working?.count||0),1)]),f(O).working?.count?(_(),v(k,{key:1},[f(O).working?.truncated?(_(),v(`p`,o_,M((`t`in e?e.t:f(Q))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),(_(!0),v(k,null,y(f(O).working?.files,n=>(_(),v(`details`,{key:n.path,class:`change-file`},[F(`summary`,null,[F(`span`,s_,M(n.path),1),n.binary?(_(),v(`span`,c_,M((`t`in e?e.t:f(Q))(`Binary`)),1)):(_(),v(`span`,l_,[F(`b`,null,M(H(n.added,`+`)),1),F(`i`,null,M(H(n.deleted,`−`)),1)])),F(`span`,u_,M(B(n)),1)]),n.previousPath?(_(),v(`p`,d_,M((`t`in e?e.t:f(Q))(`From`))+` `+M(n.previousPath),1)):g(``,!0),n.summary?(_(),v(`p`,f_,M((`t`in e?e.t:f(Q))(n.summary)),1)):g(``,!0),n.lines.length?(_(),m(i,{key:2,file:n,scope:`working`,comments:f(o),selection:f(p),onAdd:T,onSelect:t[1]||=e=>p.value=e,onAct:C},null,8,[`file`,`comments`,`selection`])):g(``,!0)]))),128))],64)):(_(),v(`p`,a_,M((`t`in e?e.t:f(Q))(`No working tree changes.`)),1))]),F(`section`,p_,[F(`label`,m_,[I(F(`input`,{"onUpdate:modelValue":t[2]||=e=>U(N)?N.value=e:null,type:`checkbox`},null,512),[[te,f(N)]]),t[7]||=a(),F(`span`,null,M((`t`in e?e.t:f(Q))(`Also show unpushed commits`)),1)]),f(N)&&f(O).committed?(_(),v(k,{key:0},[F(`h3`,null,[a(M((`t`in e?e.t:f(Q))(`Commits`))+` `,1),F(`span`,null,M(f(O).commits??0),1)]),F(`p`,h_,M(f(O).comparison)+` → HEAD`,1),f(O).committed.truncated?(_(),v(`p`,g_,M((`t`in e?e.t:f(Q))(`File list or diff limited to keep this view responsive.`)),1)):g(``,!0),f(O).committed.count?g(``,!0):(_(),v(`p`,__,M((`t`in e?e.t:f(Q))(`No committed changes to show.`)),1)),(_(!0),v(k,null,y(f(O).committed.files,n=>(_(),v(`details`,{key:n.path,class:`change-file`},[F(`summary`,null,[F(`span`,v_,M(n.path),1),n.binary?(_(),v(`span`,y_,M((`t`in e?e.t:f(Q))(`Binary`)),1)):(_(),v(`span`,b_,[F(`b`,null,M(H(n.added,`+`)),1),F(`i`,null,M(H(n.deleted,`−`)),1)]))]),n.summary?(_(),v(`p`,x_,M((`t`in e?e.t:f(Q))(n.summary)),1)):g(``,!0),n.lines.length?(_(),m(i,{key:1,file:n,scope:`committed`,comments:f(o),selection:f(p),onAdd:T,onSelect:t[3]||=e=>p.value=e,onAct:C},null,8,[`file`,`comments`,`selection`])):g(``,!0)]))),128))],64)):f(N)&&!f(A)&&!f(O).comparison?(_(),v(`p`,S_,M((`t`in e?e.t:f(Q))(`No upstream or base branch available for comparison.`)),1)):g(``,!0)])],64)):g(``,!0),F(`p`,C_,M(f(b)&&`${(`t`in e?e.t:f(Q))(`Selection:`)} ${f(b)}`),1),f(p)&&f(p).via!==`drag`?(_(),v(`div`,w_,[F(`div`,null,[F(`b`,null,M(f(b)),1),F(`p`,null,M(f(p).via===`touch`?(`t`in e?e.t:f(Q))(`Tap another line of this hunk to extend the block.`):(`t`in e?e.t:f(Q))(`Shift+Arrow extends the block within this hunk.`)),1)]),F(`button`,{type:`button`,class:`review-btn`,onClick:t[4]||=e=>p.value=null},M((`t`in e?e.t:f(Q))(`Cancel`)),1),F(`button`,{type:`button`,class:`review-btn primary`,onClick:t[5]||=e=>T(f(p).scope,f(p).path,f(p).block)},M((`t`in e?e.t:f(Q))(`Comment`)),1)])):g(``,!0)])])}}}),{__name:`ChangesView`});function E_(){let e=Ft();return()=>{Vn(history.state?.back)?e.back():e.replace(`/`)}}var D_=[`id`,`data-pane`],O_={key:0,class:`file-drop`,"aria-hidden":`true`},k_={class:`file-drop-label`},A_={class:`top bar agent-top`},j_=[`aria-label`,`title`],M_={key:3,class:`agent-head`},N_={class:`agent-title`},P_={class:`agent-meta`},F_={key:0,class:`agent-subtitle`},I_={key:1,class:`agent-subtitle agent-command`},L_={key:2,class:`agent-subtitle`},R_=[`title`],z_={class:`machine-inline-name`},B_={key:4,class:`where`},V_={class:`agent-actions`},H_=[`aria-label`],U_={class:`agent-body`},W_={class:`agent-main hw-backdrop-host`},G_={key:1,class:`term-banner machine-banner`},K_={key:0},q_={key:2,class:`term-banner closed-banner`},J_={key:5,class:`chat-empty offline-terminal`},Y_={key:7,class:`chat`},X_={key:8,class:`terminal-transcript-note dismissible-transcript-note`},Z_=[`aria-label`,`title`],Q_={key:13,class:`phone-keybar-controls`},$_=[`aria-label`,`aria-expanded`,`aria-controls`],ev=null,tv=Object.assign(ia(T({__name:`AgentView`,props:{paneId:{},cell:{type:Boolean},active:{type:Boolean},grip:{type:Boolean},embedded:{type:Boolean},selectedMode:{}},emits:[`activate`,`update:selectedMode`],setup(e,{emit:t}){let r=e,i=t,o=Nt(),s=Ft(),c=n(()=>!r.cell||!!r.active),d=Symbol(`vue agent`);z(c,e=>{e&&(Wi.value=r.paneId,ev=d)},{immediate:!0}),l(()=>{ev===d&&(Wi.value=null)});let p=n(()=>Mr.value.panes.find(e=>e.id===r.paneId)),y=n(()=>!Xi.value&&!pr.value&&!r.cell),b=h(!1);z(()=>r.paneId,()=>{b.value=!1});let x=n(()=>{let e=p.value;return e?.agent?`wherdr:transcript-note:hidden:${e.id.includes(`~`)?e.id.split(`~`)[0]:`local`}:${e.agent}:${e.agentSession||e.id}`:``}),S=h(!1);z(x,e=>{if(S.value=!1,e&&typeof window<`u`)try{S.value=localStorage.getItem(e)===`1`}catch{}},{immediate:!0});function C(){S.value=!0;try{x.value&&localStorage.setItem(x.value,`1`)}catch{}}let T=n(()=>Mr.value.workspaces.find(e=>e.id===p.value?.workspace)),D=n(()=>!!(r.cell||Gt.value&&Gt.value.panes.length>1)),O=n(()=>p.value?D.value?zi(p.value):Rt(p.value,T.value):`—`),k=n(()=>{let e=p.value?zn(p.value,T.value):``;return e&&e!==O.value?e:``}),A=n(()=>p.value?.command&&p.value.command!==O.value&&p.value.command!==k.value?p.value.command:``),I=n(()=>p.value&&Mr.value.tabs?.filter(e=>e.workspace===p.value?.workspace).length>1?p.value.tabLabel:``),L=n({get:()=>or(r.paneId),set:e=>bi(r.paneId,e)}),R=n(()=>{let e=p.value;return e?r.embedded&&r.selectedMode?r.selectedMode:r.cell?Ci({chat:Ri(e),viewMode:L.value,active:r.active}):Ri(e)?L.value:`term`:null}),B=u(null),H=pp(r.paneId,{setBanner:e=>{B.value=e},hasBanner:()=>!!B.value,fill:()=>!!r.cell,input:()=>c.value}),ee=h(null),W=h(0),G=h(null),K=h(typeof o.query.q==`string`&&typeof o.query.hit==`string`),te=h(!!p.value),ne=h(!1),q=setTimeout(()=>{ne.value=!0},4e3);l(()=>clearTimeout(q));let ie={text:Q(`This pane has been closed.`),btn:Q(`Back`),fn:()=>It(`/`)},J=n(()=>!p.value&&Mr.value.ok&&(te.value||ne.value)&&!ht(r.paneId));z(p,e=>{e&&(te.value=!0,B.value===ie&&(B.value=null,R.value===`term`&&!H.isConnected()&&P(()=>H.connect(!1))))}),z(J,e=>{e&&(B.value=ie)},{immediate:!0}),z(R,(e,t)=>{e===`chat`&&t===`term`&&(B.value=J.value?B.value:null)},{immediate:!0});function oe(e){r.embedded&&i(`update:selectedMode`,e),r.cell&&i(`activate`),L.value=e,Xi.value&&e===`term`&&P(()=>H.focus()),$()}function ce(e){oe(fi(R.value,e))}function le(){K.value?K.value=!1:(K.value=!0,R.value!==`chat`&&(L.value=`chat`))}kn(()=>r.paneId,()=>c.value,{searchChat(){return!p.value||!Ri(p.value)||R.value!==`chat`?!1:(K.value?ee.value?.focusSearch():K.value=!0,!0)},toggleTerm(){if(!p.value||!Ri(p.value)||!R.value)return!1;let e=R.value!==`chat`;return oe(e?`chat`:`term`),e&&P(()=>G.value?.focus()),!0},stop:()=>R.value===`chat`&&!!G.value?.stop()});let ue=tn(r.paneId),de=ae(),fe=u(ln(r.paneId)),pe=n(()=>Mr.value.ok?Mr.value.panes.map(e=>e.id).join(` `):``);z([()=>p.value&&fn(p.value,de.value).join(` `),pe],([e,t])=>{if(!e||!t)return;let n=e.split(` `);fe.value=ir(fe.value,n),Zt(r.paneId,n),Ln(r.paneId,n,new Set(t.split(` `)))&&X(Z(`Draft from the closed pane restored`,`Brouillon du pane fermé récupéré`))},{immediate:!0});let me=n(()=>J.value?Bt(r.paneId,fe.value,Mr.value.panes,de.value):null);z(me,e=>{e&&(qt(r.paneId,e.id),!(r.cell||r.embedded)&&(X(Z(`The agent restarted in a new pane: opened it`,`L’agent a redémarré dans un nouveau pane : il est ouvert`)),s.replace(Be(e.id))))},{immediate:!0});let he;z(()=>J.value&&!me.value,e=>{if(clearInterval(he),he=void 0,!e)return;st();let t=20;he=na(()=>{--t<=0&&(clearInterval(he),he=void 0),ti.value&&st()},3e3)},{immediate:!0}),l(()=>clearInterval(he));let _e=n(()=>an(ue));async function ve(){try{await navigator.clipboard.writeText(nn(ue)),X(Z(`Draft copied`,`Brouillon copié`))}catch{X(Q(`Copy failed`),!0)}}let ye=n(()=>mn(r.paneId));function be(e){e&&En(r.paneId,e),ee.value?.scrollToEnd(!0),ee.value?.reload()}z(p,e=>Ht(r.paneId,e?.queued||[]));let Se=n(()=>p.value&&p.value.status===`blocked`&&p.value.prompt&&p.value.prompt.options?p.value.prompt:null),Ce=n(()=>Ei(p.value)),we=n(()=>p.value&&p.value.menu&&p.value.status!==`working`&&!Se.value&&!Ce.value?p.value.menu:null);z(()=>JSON.stringify([Se.value,Ce.value,we.value]),()=>P(()=>ee.value?.scrollToEnd(!1)));let Te=n(()=>{let e=p.value;return e?di(e.cwd):``}),ke=n(()=>Tr.value&&p.value?Gr(p.value.machine):void 0),Me=n(()=>!!(ke.value&&ke.value.status!==`online`));function Ne(e){ue.text=ue.text?`${ue.text}\n\n${e}`:e,Pe.value=!1,oe(`chat`),P(()=>G.value?.focusEnd())}let Pe=h(!1),Fe=h(!1),Ie=h(null),Le=n(()=>R.value===`term`),Re=Lt(r.paneId),Ve=h(Re.resume(p.value?.interaction||`unknown`)),He=n(()=>R.value===`chat`&&Hr.value&&!Qr.value&&!Me.value&&!Lr(p.value)),Ue=n(()=>p.value?.interaction===`terminal`),We;function qe(){clearTimeout(We),We=void 0;let e=Date.now();Ve.value=Re.update(p.value?.interaction||`unknown`,e);let t=Re.deadline();t!==null&&ti.value&&(We=setTimeout(qe,Math.max(0,t-e))),(Ue.value||Ve.value||Se.value||we.value||Ce.value)&&gt.open&&gt.pane===r.paneId&&et(!1)}z([()=>p.value?.interaction,Se,we,Ce,()=>gt.open,()=>gt.pane,ti],qe,{immediate:!0});let Je=Re.subscribe(qe);l(()=>{clearTimeout(We),Je()});function Xe(){Re.dismiss(),Ve.value=!1}function Ze(){r.cell&&i(`activate`),Re.reopen(),Ve.value=!0}let tt=n(()=>Ve.value&&He.value&&c.value&&!ta.value),nt=n(()=>oi({desk:Xi.value,live:c.value,mode:R.value,cell:!!r.cell})&&!(we.value&&R.value!==`term`)&&!(R.value===`chat`&&Ve.value)),it=n(()=>Bi({desk:Xi.value,live:c.value,mode:R.value,available:!(!p.value||!Hr.value||Qr.value||Me.value||Lr(p.value))}));function at(e){let t=e.target,n=[...t.files||[]];t.value=``,lt(n)}async function lt(e){if(it.value&&p.value)for(let t of e)try{let e=t.name.includes(`.`)&&t.name.split(`.`).pop()||``,n=await fetch(`/api/file?pane=${encodeURIComponent(r.paneId)}&ext=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/octet-stream`},body:t}),i=await n.json().catch(()=>({}));if(!n.ok)throw Error(Q(i.error||`HTTP ${n.status}`));be(await Ee(p.value,r.paneId,i.path)),$()}catch(e){X(`${Q(`File upload failed`)} : ${e.message}`,!0)}}let ut=n(()=>it.value?`term`:nt.value&&!Qr.value?`chat`:null),ft=h(0);function pt(e){Yn(e.dataTransfer)&&ut.value&&(e.preventDefault(),e.type===`dragover`&&e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),ft.value=Dn(ft.value,e.type))}function mt(e){if(ft.value=0,!Yn(e.dataTransfer)||!ut.value)return;e.preventDefault();let t=[...e.dataTransfer?.files||[]];if(t.length){if(ut.value===`term`)return lt(t);G.value?.addFiles(t).then(e=>{e&&(G.value?.focus(),$())})}}let _t=n(()=>p.value?.agent===`claude`?Q(`Images, PDFs, text and code files`):Q(`Images, text and code files`));rt();let yt=n(()=>{let e=p.value,t=e?[St(e)]:[];if(y.value&&Ri(e)&&t.unshift({label:R.value===`term`?Q(`Conversation`):Q(`Terminal`),icon:R.value===`term`?`i-lucide-message-square`:`i-lucide-square-terminal`,run:()=>ce(`term`)},{label:Q(`Search`),icon:`i-lucide-search`,run:le},{kind:`separator`}),it.value&&t.push({label:Q(`Attach a file…`),icon:`i-lucide-paperclip`,run:()=>Ie.value?.click()}),e&&t.push({label:Q(`View changes`),icon:`i-lucide-file-diff`,run:()=>{Pe.value=!0}}),e&&t.push({label:Q(`Browse files`),icon:`i-lucide-folder-tree`,run:()=>{Fe.value=!0}}),e&&Di(e)&&t.push({label:Q(`Open in editor`),icon:`i-lucide-external-link`,kbds:c.value?dt(`open-editor`):void 0,run:()=>Yr(e)}),e&&!y.value&&(t.push({label:Q(`Rename pane`),icon:`i-lucide-pencil`,run:()=>{Ot.value=e.id}}),t.push(...ge(e),xe(e))),e&&pn(e.machine).length&&t.push({label:Q(`Plugin actions`),icon:`i-lucide-puzzle`,run:()=>hn({pane:e})}),t.push({label:Q(`Take control of this terminal`),icon:`i-lucide-arrow-left-right`,run:()=>{B.value=null,L.value=`term`,P(()=>H.connect(!0))}}),e&&je(e)&&!e.restart&&t.push({label:Q(`Restart agent`),icon:`i-lucide-rotate-cw`,run:()=>ze(e)}),t.push({label:Q(`Reconnect`),icon:`i-lucide-refresh-cw`,run:()=>{B.value=null,L.value=`term`,P(()=>{H.reset(),H.connect(!1)})}}),r.cell||t.push(...Oe()),e){let n=Mr.value.workspaces.find(t=>t.id===e.workspace);(!y.value||n?.worktree)&&t.push({kind:`separator`}),y.value||t.push(ot(e,c.value?dt(`close-pane`):void 0)),n&&n.worktree&&t.push({label:Q(`Delete this worktree`),icon:`i-lucide-git-branch`,danger:!0,run:()=>xt(e.workspace)})}return t});async function xt(e){await ha();let t=(ua.value||[]).find(t=>t.workspace===e);if(!t)return X(Q(`Worktree not found`),!0);await pa(t)&&It(`/`)}let Ct=n(()=>Ae(yt.value));function wt(){Ke(yt.value)}z(()=>p.value&&(p.value.machine||``),e=>{e!==void 0&&Vt(e)},{immediate:!0});let Tt=n(()=>!!p.value&&c.value&&Hr.value&&!Qr.value&&!Me.value),Et=n(()=>y.value&&Tt.value&&!tt.value),Dt=n(()=>`pane-keys-${encodeURIComponent(r.paneId)}`),kt=n(()=>Tt.value&&(y.value?b.value:R.value===`term`&&(!r.cell||!!(vi.value&&r.active))));z(Et,e=>{e||(b.value=!1)}),z(b,e=>{e||H.clearVirtualModifiers()});function jt(){document.activeElement?.matches(`.composer textarea`)?G.value?.blur():G.value?.focus()}function Pt(){$(),b.value=!b.value}let zt=n(()=>Oi({desk:Xi.value,cell:!!r.cell,chat:Ri(p.value),live:c.value})),Wt=n(()=>!r.cell&&p.value&&Pi(At(p.value.workspace).length).headerAdd);z(gr,e=>H.setFontSize(e)),z(ti,e=>{H.setVisible(e)});let Gt=n(()=>p.value?De(p.value.tab):null),Kt=n(()=>!!(Gt.value&&Gt.value.panes.length>1));function Jt(){Gt.value&&(Xi.value?It({path:se(Gt.value.tab.id),query:{pane:r.paneId}}):$e(Gt.value.tab.id))}let Yt=E_(),Xt=Ge.value;Ge.value=0;let Qt=h(0),$t=h(!1),en=0,rn=0,on=0,sn=`off`,cn=e=>Gt.value?si(Gt.value.layout,r.paneId,e):null;function un(e,t){for(let n=e;n&&n!==t;n=n.parentElement)if(n.scrollWidth>n.clientWidth+1&&/(auto|scroll)/.test(getComputedStyle(n).overflowX))return!0;return!1}function dn(e){if(sn=`off`,r.cell||Xi.value||!Kt.value||e.touches.length!==1)return;let t=e.target?.closest?.(`.swipe-area, .choices, #termWrap`);t&&!un(e.target,t)&&(en=e.touches[0].clientX,rn=e.touches[0].clientY,on=Date.now(),sn=null)}function gn(e){if(sn===`off`||sn===`y`)return;let t=e.touches[0].clientX-en,n=e.touches[0].clientY-rn;sn===null&&(sn=Nn(t,n)),sn===`x`&&(e.preventDefault(),$t.value=!0,Qt.value=jn(t,!!cn(t<0?1:-1)))}function _n(e){if(sn===`x`){let t=(e.changedTouches[0]?.clientX??en)-en,n=Sn(t,Date.now()-on,window.innerWidth),r=n?cn(n):null;r&&($(),Ge.value=n,s.replace(Be(r)))}sn=`off`,$t.value=!1,Qt.value=0}let vn=n(()=>Kt.value&&!Xi.value?{transform:Qt.value?`translateX(${Qt.value}px)`:void 0,transition:$t.value?`none`:`transform .18s ease`}:{});w(()=>{Xi.value&&c.value&&setTimeout(()=>(R.value===`term`?H:G.value)?.focus(),50)}),z(()=>r.active,(e,t)=>{e&&!t&&r.cell&&setTimeout(()=>{document.activeElement?.closest(`.cell-view.active`)||(R.value===`term`?H:G.value)?.focus()},50)});function bn(e){let t=e.target;r.cell&&Xi.value&&t?.closest?.(`.agent-top`)&&!t.closest(`button, a, input, [role="tab"], .cell-grip`)&&(document.activeElement&&document.activeElement!==document.body||(R.value===`term`?H:G.value)?.focus())}let Cn=n(()=>Wn.value?{height:`${wn.value}px`,top:`${Gn.value}px`}:{});return(t,n)=>{let r=Qe,o=Ea,s=bt,l=Za,u=$n,d=Rn,h=$a,x=vt,w=yn,D=xn,P=io,L=ao,z=jd,te=Vd,ne=_p,q=qp,ae=mm,J=df,se=Jh,ue=T_,de=Ut,fe=Rc;return _(),v(`section`,{id:e.cell?void 0:`agent`,class:j([e.cell?[`cell-view`,{active:e.active,gripped:e.grip}]:`view`,{"phone-chrome":f(y)}]),style:N(e.cell?void 0:f(Cn)),"data-pane":e.cell?e.paneId:void 0,onTouchstart:dn,onTouchmove:gn,onTouchend:_n,onTouchcancel:_n,onPointerdownCapture:n[18]||=t=>e.cell&&i(`activate`),onFocusin:n[19]||=t=>e.cell&&i(`activate`),onClick:bn,onDragenter:pt,onDragover:pt,onDragleave:pt,onDrop:mt},[f(ft)&&f(ut)?(_(),v(`div`,O_,[E(r,{name:f(ut)===`term`?`i-lucide-paperclip`:`i-lucide-file-plus`,class:`file-drop-icon`},null,8,[`name`]),F(`span`,k_,M((`t`in t?t.t:f(Q))(`Drop to attach`)),1),F(`small`,null,M(f(ut)===`term`?(`t`in t?t.t:f(Q))(`The file path is sent to the terminal`):f(_t)),1)])):g(``,!0),!e.cell&&f(p)&&!f(y)?(_(),m(o,{key:1,workspace:f(p).workspace,current:f(p).tab},null,8,[`workspace`,`current`])):g(``,!0),e.embedded?g(``,!0):(_(),m(P,{key:2,items:()=>f(yt),disabled:!f(p)},{default:V(()=>[F(`header`,A_,[e.cell&&e.grip?(_(),v(`span`,{key:0,class:`cell-grip`,role:`button`,"aria-label":(`t`in t?t.t:f(Q))(`Drag to move the pane`),title:(`t`in t?t.t:f(Q))(`Drag to move the pane`)},[E(r,{name:`i-lucide-grip-vertical`})],8,j_)):g(``,!0),e.cell?g(``,!0):(_(),m(s,{key:1,id:`btnBack`,icon:`i-lucide-chevron-left`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn back`,"aria-label":(`t`in t?t.t:f(Q))(`Back`),onClick:f(Yt)},null,8,[`aria-label`,`onClick`])),f(y)&&f(p)?(_(),m(l,{key:2,pane:f(p),workspace:f(T),onOverview:Jt},null,8,[`pane`,`workspace`])):(_(),v(`div`,M_,[F(`div`,N_,[a(M(f(O))+` `,1),f(p)&&(`paneNotificationsMuted`in t?t.paneNotificationsMuted:f(Ye))(f(p))?(_(),m(r,{key:0,name:`i-lucide-bell-off`,class:`notification-muted`,title:(`t`in t?t.t:f(Q))(`Muted`)},null,8,[`title`])):g(``,!0)]),F(`div`,P_,[E(u,{pane:f(p),kind:``},null,8,[`pane`]),f(k)?(_(),v(`span`,F_,M(f(k)),1)):g(``,!0),f(A)?(_(),v(`span`,I_,M(f(A)),1)):g(``,!0),f(I)?(_(),v(`span`,L_,M(f(I)),1)):g(``,!0),f(ke)?(_(),v(`span`,{key:3,class:j([`agent-machine`,f(ke).status]),title:f(ke).target?`ssh ${f(ke).target}`:void 0},[E(r,{name:f(ke).local?`i-lucide-server`:`i-lucide-laptop`},null,8,[`name`]),F(`span`,z_,M((`machineName`in t?t.machineName:f(Sr))(f(ke).key)),1),f(ke).local?(_(),m(d,{key:0})):g(``,!0)],10,R_)):g(``,!0),f(Te)?(_(),v(`span`,B_,M(f(Te)),1)):g(``,!0)])])),f(zt).selector===`cell`?(_(),m(h,{key:4,mode:f(R),onToggle:n[0]||=e=>ce(`term`)},null,8,[`mode`])):g(``,!0),F(`div`,V_,[f(zt).selector===`header`?(_(),m(h,{key:0,mode:f(R),onToggle:n[1]||=e=>ce(`term`)},null,8,[`mode`])):g(``,!0),f(Wt)&&f(p)&&!f(y)?(_(),m(s,{key:1,icon:`i-lucide-plus`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Q))(`New tab`),title:(`t`in t?t.t:f(Q))(`New tab`),disabled:`offlineView`in t?t.offlineView:f(Qr),onClick:n[2]||=e=>(`newTab`in t?t.newTab:f(Mt))(f(p).workspace)},null,8,[`aria-label`,`title`,`disabled`])):g(``,!0),e.cell?(_(),m(x,{key:2,text:(`t`in t?t.t:f(Q))(`Open alone`)},{default:V(()=>[E(s,{icon:`i-lucide-maximize-2`,color:`neutral`,variant:`ghost`,size:`md`,class:`icon-btn cell-extra`,"aria-label":(`t`in t?t.t:f(Q))(`Open alone`),to:(`panePath`in t?t.panePath:f(Be))(e.paneId)},null,8,[`aria-label`,`to`])]),_:1},8,[`text`])):f(Kt)&&f(Gt)&&!f(y)?(_(),m(x,{key:3,text:(`t`in t?t.t:f(Q))(`Side by side`),disabled:!(`desk`in t?t.desk:f(Xi))},{default:V(()=>[F(`button`,{type:`button`,class:`map-btn`,"aria-label":(`desk`in t?t.desk:f(Xi))?(`t`in t?t.t:f(Q))(`Side by side`):(`t`in t?t.t:f(Q))(`Tab overview`),onClick:Jt},[E(w,{layout:f(Gt).layout,panes:f(Gt).panes,current:e.paneId},null,8,[`layout`,`panes`,`current`])],8,H_)]),_:1},8,[`text`,`disabled`])):g(``,!0),f(zt).term?(_(),m(s,{key:4,icon:`i-lucide-square-terminal`,color:`neutral`,variant:`ghost`,size:`lg`,class:j([`icon-btn mode-btn`,{on:f(R)===`term`}]),"aria-label":(`t`in t?t.t:f(Q))(`Terminal`),"aria-pressed":f(R)===`term`,onClick:n[3]||=e=>ce(`term`)},null,8,[`class`,`aria-label`,`aria-pressed`])):g(``,!0),(`hasChat`in t?t.hasChat:f(Ri))(f(p))&&(f(c)||e.cell)&&!f(y)?(_(),m(x,{key:5,text:(`t`in t?t.t:f(Q))(`Search`),kbds:f(R)===`chat`?(`shortcutKbds`in t?t.shortcutKbds:f(dt))(`search-chat`):void 0,disabled:!(`desk`in t?t.desk:f(Xi))},{default:V(()=>[E(s,{icon:`i-lucide-search`,color:`neutral`,variant:`ghost`,size:`lg`,class:j([`icon-btn cell-extra`,{on:f(K)}]),"aria-label":(`t`in t?t.t:f(Q))(`Search`),onClick:le},null,8,[`class`,`aria-label`])]),_:1},8,[`text`,`kbds`,`disabled`])):g(``,!0),(`sheetMenus`in t?t.sheetMenus:f(ji))?(_(),m(s,{key:7,icon:`i-lucide-ellipsis`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Q))(`Options`),onClick:wt},null,8,[`aria-label`])):(_(),m(D,{key:6,items:f(Ct),content:{align:`end`,sideOffset:6},ui:{content:`hw-dropdown`}},{default:V(()=>[E(s,{icon:`i-lucide-ellipsis`,color:`neutral`,variant:`ghost`,size:`lg`,class:`icon-btn`,"aria-label":(`t`in t?t.t:f(Q))(`Options`)},null,8,[`aria-label`])]),_:1},8,[`items`]))])])]),_:1},8,[`items`,`disabled`])),F(`div`,U_,[F(`div`,W_,[(`desk`in t?t.desk:f(Xi))&&!e.cell&&(`backdrop`in t?t.backdrop:f(ct))===`wherdr`&&f(R)===`chat`?(_(),m(L,{key:0})):g(``,!0),f(Me)&&f(ke)?(_(),v(`div`,G_,[E(r,{name:`i-lucide-unplug`,class:`term-banner-icon`}),F(`span`,null,[a(M(f(ke).status===`connecting`?(`tl`in t?t.tl:f(Z))(`${(`machineName`in t?t.machineName:f(Sr))(f(ke).key)} unreachable — reconnecting…`,`${(`machineName`in t?t.machineName:f(Sr))(f(ke).key)} injoignable — reconnexion…`):(`tl`in t?t.tl:f(Z))(`${(`machineName`in t?t.machineName:f(Sr))(f(ke).key)} offline`,`${(`machineName`in t?t.machineName:f(Sr))(f(ke).key)} hors ligne`)),1),f(ke).error?(_(),v(`small`,K_,M((`t`in t?t.t:f(Q))(f(ke).error)),1)):g(``,!0)])])):g(``,!0),f(B)===ie&&f(me)?(_(),v(`div`,q_,[E(r,{name:`i-lucide-refresh-cw`,class:`term-banner-icon`}),F(`span`,null,M((`tl`in t?t.tl:f(Z))(`This agent continues in a new pane.`,`Cet agent continue dans un nouveau pane.`)),1),E(s,{size:`xs`,color:`warning`,variant:`outline`,to:(`panePath`in t?t.panePath:f(Be))(f(me).id)},{default:V(()=>[a(M((`tl`in t?t.tl:f(Z))(`Open`,`Ouvrir`)),1)]),_:1},8,[`to`])])):f(B)?(_(),v(`div`,{key:3,class:j([`term-banner`,{"closed-banner":f(B)===ie}])},[E(r,{name:`i-lucide-triangle-alert`,class:`term-banner-icon`}),F(`span`,null,M(f(B)===ie&&f(_e)?(`tl`in t?t.tl:f(Z))(`This pane has been closed. Your draft is kept below.`,`Ce pane a été fermé. Ton brouillon est gardé ci-dessous.`):f(B).text),1),f(B)===ie&&f(_e)?(_(),m(s,{key:0,size:`xs`,color:`warning`,variant:`outline`,icon:`i-lucide-copy`,onClick:ve},{default:V(()=>[a(M((`tl`in t?t.tl:f(Z))(`Copy draft`,`Copier le brouillon`)),1)]),_:1})):g(``,!0),E(s,{size:`xs`,color:`warning`,variant:`outline`,onClick:n[4]||=e=>f(B).fn()},{default:V(()=>[a(M(f(B).btn),1)]),_:1})],2)):g(``,!0),f(p)&&f(R)===`chat`?(_(),v(`div`,{key:4,class:j([`swipe-area`,f(Xt)?f(Xt)>0?`enter-next`:`enter-prev`:void 0]),style:N(f(vn))},[E(z,{ref_key:`chatRef`,ref:ee,search:f(K),"onUpdate:search":n[5]||=e=>U(K)?K.value=e:null,pane:f(p),"local-queued":f(ye),onGotoTerm:n[6]||=e=>oe(`term`),onRestored:n[7]||=e=>f(G)?.focus(),onQuote:n[8]||=e=>f(G)?.focusEnd(),onAnswered:n[9]||=e=>f(G)?.focusAnswer(e),onUnanswered:n[10]||=e=>W.value=e,onSent:be},null,8,[`search`,`pane`,`local-queued`])],6)):f(R)===`term`&&(!(`eventsOpen`in t?t.eventsOpen:f(Hr))||(`offlineView`in t?t.offlineView:f(Qr))||f(Me))?(_(),v(`div`,J_,[E(r,{name:`i-lucide-wifi-off`,class:`chat-empty-icon`}),F(`p`,null,M((`t`in t?t.t:f(Q))(`Terminal unavailable offline`)),1)])):f(R)===`term`?(_(),m(te,{key:6,ctl:f(H),class:j(f(Xt)?f(Xt)>0?`enter-next`:`enter-prev`:void 0),style:N(f(vn))},null,8,[`ctl`,`class`,`style`])):(_(),v(`div`,Y_)),f(p)?.agent&&!(`hasChat`in t?t.hasChat:f(Ri))(f(p))&&f(R)===`term`&&!e.cell&&!f(S)?(_(),v(`div`,X_,[F(`span`,null,M((`tl`in t?t.tl:f(Z))(`Conversation unavailable for this agent · follow it in the terminal`,`Conversation non disponible pour cet agent · suivi dans le terminal`)),1),F(`button`,{type:`button`,"aria-label":(`t`in t?t.t:f(Q))(`Hide`),title:(`t`in t?t.t:f(Q))(`Hide`),onClick:C},`×`,8,Z_)])):g(``,!0),f(tt)?(_(),m(ne,{key:9,"pane-id":e.paneId,active:f(c),title:f(O),onClose:Xe},null,8,[`pane-id`,`active`,`title`])):(f(Ue)||f(Ve))&&f(He)?(_(),v(`button`,{key:10,type:`button`,class:`interactive-terminal-reopen`,onClick:Ze},[E(r,{name:`i-lucide-square-terminal`}),a(M((`tl`in t?t.tl:f(Z))(`Open interactive terminal`,`Ouvrir le terminal interactif`)),1)])):g(``,!0),(f(Se)||f(Ce))&&!f(Ve)&&!f(Ue)&&!f(Le)&&(`eventsOpen`in t?t.eventsOpen:f(Hr))&&!(`offlineView`in t?t.offlineView:f(Qr))&&!f(Me)?(_(),m(q,{key:11,"pane-id":e.paneId,prompt:f(Se),screen:f(Ce),keys:f(c)},null,8,[`pane-id`,`prompt`,`screen`,`keys`])):f(we)&&!f(Ve)&&!f(Ue)&&!f(Le)&&(`eventsOpen`in t?t.eventsOpen:f(Hr))&&!(`offlineView`in t?t.offlineView:f(Qr))&&!f(Me)?(_(),m(ae,{key:12,"pane-id":e.paneId,menu:f(we),keys:f(c),onTerminal:n[11]||=e=>oe(`term`)},null,8,[`pane-id`,`menu`,`keys`])):g(``,!0),f(Et)?(_(),v(`div`,Q_,[F(`button`,{type:`button`,class:j([`phone-keybar-toggle`,{on:f(b)}]),"aria-label":(`t`in t?t.t:f(Q))(`Show or hide terminal keys`),"aria-expanded":f(b),"aria-controls":f(Dt),onPointerdown:n[12]||=re(()=>{},[`prevent`]),onMousedown:n[13]||=re(()=>{},[`prevent`]),onClick:re(Pt,[`stop`])},[E(r,{name:f(b)?`i-lucide-chevron-down`:`i-lucide-chevron-up`},null,8,[`name`])],42,$_)])):g(``,!0),f(kt)?(_(),m(J,{key:14,id:f(Dt),ctl:f(H),compact:f(y),terminal:f(Le),onKeyboard:jt},null,8,[`id`,`ctl`,`compact`,`terminal`])):g(``,!0),f(nt)?(_(),m(se,{key:15,ref_key:`composer`,ref:G,pane:f(p),"pane-id":e.paneId,"send-keys":f(H).sendKeys,conversation:f(R)===`chat`,"term-shown":f(Le),"esc-stops":!f(K),"take-back":f(R)===`chat`,unanswered:f(R)===`chat`?f(W):0,onSent:be,onShowTerminal:n[14]||=e=>oe(`term`),onShowUnanswered:n[15]||=e=>f(ee)?.gotoUnanswered()},null,8,[`pane`,`pane-id`,`send-keys`,`conversation`,`term-shown`,`esc-stops`,`take-back`,`unanswered`])):g(``,!0)])]),E(de,{open:f(Pe),"onUpdate:open":n[16]||=e=>U(Pe)?Pe.value=e:null,title:(`t`in t?t.t:f(Q))(`Changes`),wide:``,full:``,screen:``},{default:V(()=>[f(Pe)&&f(p)?(_(),m(ue,{key:0,"pane-id":e.paneId,onReview:Ne},null,8,[`pane-id`])):g(``,!0)]),_:1},8,[`open`,`title`]),E(de,{open:f(Fe),"onUpdate:open":n[17]||=e=>U(Fe)?Fe.value=e:null,title:(`t`in t?t.t:f(Q))(`Files`),wide:``,full:``,screen:``},{default:V(()=>[f(Fe)&&f(p)?(_(),m(fe,{key:0,"pane-id":e.paneId},null,8,[`pane-id`])):g(``,!0)]),_:1},8,[`open`,`title`]),F(`input`,{ref_key:`attachInput`,ref:Ie,type:`file`,multiple:``,hidden:``,onChange:at},null,544)],46,D_)}}}),[[`__scopeId`,`data-v-82cacc7d`]]),{__name:`AgentView`});export{zc as a,ro as c,jd as i,Ea as l,E_ as n,so as o,Ym as r,io as s,tv as t};