@rohansguliani/mux-chat-ui 0.3.0 → 0.4.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 (802) hide show
  1. package/README.md +47 -55
  2. package/dist/testing.d.ts +17 -13
  3. package/dist/testing.js +72 -58
  4. package/kit/THIRD_PARTY_NOTICES.txt +3696 -0
  5. package/kit/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  6. package/kit/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  7. package/kit/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  8. package/kit/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  9. package/kit/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  10. package/kit/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  11. package/kit/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  12. package/kit/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  13. package/kit/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  14. package/kit/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  15. package/kit/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  16. package/kit/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  17. package/kit/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  18. package/kit/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  19. package/kit/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  20. package/kit/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  21. package/kit/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  22. package/kit/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  23. package/kit/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  24. package/kit/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  25. package/kit/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  26. package/kit/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  27. package/kit/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  28. package/kit/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  29. package/kit/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  30. package/kit/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  31. package/kit/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  32. package/kit/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  33. package/kit/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  34. package/kit/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  35. package/kit/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  36. package/kit/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  37. package/kit/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  38. package/kit/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  39. package/kit/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  40. package/kit/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  41. package/kit/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  42. package/kit/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  43. package/kit/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  44. package/kit/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  45. package/kit/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  46. package/kit/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  47. package/kit/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  48. package/kit/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  49. package/kit/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  50. package/kit/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  51. package/kit/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  52. package/kit/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  53. package/kit/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  54. package/kit/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  55. package/kit/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  56. package/kit/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  57. package/kit/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  58. package/kit/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  59. package/kit/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  60. package/kit/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  61. package/kit/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  62. package/kit/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  63. package/kit/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  64. package/kit/assets/abap-Dg923wIy.js +1 -0
  65. package/kit/assets/actionscript-3-CqOcUQ0w.js +1 -0
  66. package/kit/assets/ada-CTi7YQtL.js +1 -0
  67. package/kit/assets/ahk-BJYYIeOs.js +1 -0
  68. package/kit/assets/ahk2-BLfzmBxo.js +1 -0
  69. package/kit/assets/andromeeda-CT0vplkN.js +1 -0
  70. package/kit/assets/angular-html-DX9ZP5JV.js +1 -0
  71. package/kit/assets/angular-ts-1O2hJJmY.js +1 -0
  72. package/kit/assets/apache-PcO-DBxQ.js +1 -0
  73. package/kit/assets/apex-B4ts4Pdn.js +1 -0
  74. package/kit/assets/apl-Dz5ncP8G.js +1 -0
  75. package/kit/assets/applescript-Ds_W2jPS.js +1 -0
  76. package/kit/assets/ara-C1--7J61.js +1 -0
  77. package/kit/assets/asciidoc-DaaWi4fn.js +1 -0
  78. package/kit/assets/asm-CTFRnVOM.js +1 -0
  79. package/kit/assets/astro-BWgTGUF8.js +1 -0
  80. package/kit/assets/aurora-x-C0VKFdlO.js +1 -0
  81. package/kit/assets/awk-CrWgQKhV.js +1 -0
  82. package/kit/assets/ayu-dark-wZ6ORhBL.js +1 -0
  83. package/kit/assets/ayu-light-xXLJ_Ch1.js +1 -0
  84. package/kit/assets/ayu-mirage-CQckA_sP.js +1 -0
  85. package/kit/assets/ballerina-a0yOSyc5.js +1 -0
  86. package/kit/assets/bat-C1qk1Jq1.js +1 -0
  87. package/kit/assets/beancount-dPJi_gci.js +1 -0
  88. package/kit/assets/berry-CVKoklHx.js +1 -0
  89. package/kit/assets/bibtex-DRcCXNgM.js +1 -0
  90. package/kit/assets/bicep-jWz-hQ8I.js +1 -0
  91. package/kit/assets/bird2-wc5D5_X9.js +1 -0
  92. package/kit/assets/blade-DFktsHST.js +1 -0
  93. package/kit/assets/bsl-BtUDvyR4.js +1 -0
  94. package/kit/assets/c-BG-tZi7o.js +1 -0
  95. package/kit/assets/c3-R-USHpyF.js +1 -0
  96. package/kit/assets/cadence-BuaeHeSu.js +1 -0
  97. package/kit/assets/cairo-BYiDgOF2.js +1 -0
  98. package/kit/assets/catppuccin-frappe-CquLvoVK.js +1 -0
  99. package/kit/assets/catppuccin-latte-G5tdnGFo.js +1 -0
  100. package/kit/assets/catppuccin-macchiato-BZRq1pKO.js +1 -0
  101. package/kit/assets/catppuccin-mocha-Bbf5uIw6.js +1 -0
  102. package/kit/assets/chapel-D6IdCptL.js +1 -0
  103. package/kit/assets/clarity-BJ-KISir.js +1 -0
  104. package/kit/assets/clojure-KnfDkB_V.js +1 -0
  105. package/kit/assets/cmake-bh2MLnkv.js +1 -0
  106. package/kit/assets/cobol-DbURsbuN.js +1 -0
  107. package/kit/assets/codeowners-CtwIM3TN.js +1 -0
  108. package/kit/assets/codeql-D164juXQ.js +1 -0
  109. package/kit/assets/coffee-Bk-z6oI_.js +1 -0
  110. package/kit/assets/common-lisp-DXc9XcIM.js +1 -0
  111. package/kit/assets/coq-BIZj6HM_.js +1 -0
  112. package/kit/assets/cpp-C-tF_bWl.js +1 -0
  113. package/kit/assets/crystal-Dvqzbpz8.js +1 -0
  114. package/kit/assets/csharp-CFxe5pRo.js +1 -0
  115. package/kit/assets/css-Br67jR8j.js +1 -0
  116. package/kit/assets/csv-D5aBhKLr.js +1 -0
  117. package/kit/assets/cue-WCin6O4e.js +1 -0
  118. package/kit/assets/cypher-DYQk2G82.js +1 -0
  119. package/kit/assets/d-DVc-yF-l.js +1 -0
  120. package/kit/assets/dark-plus-DLU5INA3.js +1 -0
  121. package/kit/assets/dart-ByalkS20.js +1 -0
  122. package/kit/assets/dax-oldcCaJg.js +1 -0
  123. package/kit/assets/desktop-DZfyBMgF.js +1 -0
  124. package/kit/assets/diff-jW5kmiru.js +1 -0
  125. package/kit/assets/docker-DG9neUKd.js +1 -0
  126. package/kit/assets/dotenv-Bea-FkXq.js +1 -0
  127. package/kit/assets/dracula-XcYHBZy6.js +1 -0
  128. package/kit/assets/dracula-soft-BPeX9gxW.js +1 -0
  129. package/kit/assets/dream-maker-DAHQwpwp.js +1 -0
  130. package/kit/assets/edge-DTiORMU5.js +1 -0
  131. package/kit/assets/elixir-DnIH90qd.js +1 -0
  132. package/kit/assets/elm-BjIDgKzz.js +1 -0
  133. package/kit/assets/emacs-lisp-Ckw2FTkV.js +1 -0
  134. package/kit/assets/erb-CazEJMPD.js +1 -0
  135. package/kit/assets/erlang-DNeY46SW.js +1 -0
  136. package/kit/assets/everforest-dark-WOub3wle.js +1 -0
  137. package/kit/assets/everforest-light-DCUg8VH8.js +1 -0
  138. package/kit/assets/fennel-DBMsxtrh.js +1 -0
  139. package/kit/assets/fish-BxskpYPN.js +1 -0
  140. package/kit/assets/fluent-Bwo2XpEt.js +1 -0
  141. package/kit/assets/fortran-fixed-form-DFFnVrrY.js +1 -0
  142. package/kit/assets/fortran-free-form-DB5N_DgY.js +1 -0
  143. package/kit/assets/fsharp-DRAF1jsN.js +1 -0
  144. package/kit/assets/gdresource-B0Kp4-ms.js +1 -0
  145. package/kit/assets/gdscript-DKyjuXKv.js +1 -0
  146. package/kit/assets/gdshader-G7X6ysY3.js +1 -0
  147. package/kit/assets/genie-DSsjfZMX.js +1 -0
  148. package/kit/assets/gherkin-Cl2Fw-_0.js +1 -0
  149. package/kit/assets/git-commit-CJPsQObV.js +1 -0
  150. package/kit/assets/git-rebase-DeZqv4fp.js +1 -0
  151. package/kit/assets/github-dark-BQV5ugrc.js +1 -0
  152. package/kit/assets/github-dark-default-DLWDM7FH.js +1 -0
  153. package/kit/assets/github-dark-dimmed-D1FmiR_p.js +1 -0
  154. package/kit/assets/github-dark-high-contrast-BilLoi0o.js +1 -0
  155. package/kit/assets/github-light-Rcb2q3L5.js +1 -0
  156. package/kit/assets/github-light-default-CQ75esMw.js +1 -0
  157. package/kit/assets/github-light-high-contrast-CRF1wyLy.js +1 -0
  158. package/kit/assets/gleam-BeBqoPwE.js +1 -0
  159. package/kit/assets/glimmer-js-F_qk9EQT.js +1 -0
  160. package/kit/assets/glimmer-ts-Dhzi-GJU.js +1 -0
  161. package/kit/assets/glsl-BOG9l2nV.js +1 -0
  162. package/kit/assets/gn-Dxr0sSUf.js +1 -0
  163. package/kit/assets/gnuplot-CtW3R_Hz.js +1 -0
  164. package/kit/assets/go-B7VTfpnm.js +1 -0
  165. package/kit/assets/graphql-B6XHM4uj.js +1 -0
  166. package/kit/assets/groovy-DFxE31Qs.js +1 -0
  167. package/kit/assets/gruvbox-dark-hard-C37G1gbc.js +1 -0
  168. package/kit/assets/gruvbox-dark-medium-C3G9m3TV.js +1 -0
  169. package/kit/assets/gruvbox-dark-soft-eZmcmZ9I.js +1 -0
  170. package/kit/assets/gruvbox-light-hard-BYj-vz_3.js +1 -0
  171. package/kit/assets/gruvbox-light-medium-BdQlDiiF.js +1 -0
  172. package/kit/assets/gruvbox-light-soft-BGNwjiRh.js +1 -0
  173. package/kit/assets/hack-jRhjsWHJ.js +1 -0
  174. package/kit/assets/haml-C4vGXCDX.js +1 -0
  175. package/kit/assets/handlebars-BsldGL5W.js +1 -0
  176. package/kit/assets/haskell-BfdhR_WN.js +1 -0
  177. package/kit/assets/haxe-wmAaY_mP.js +1 -0
  178. package/kit/assets/hcl-B6OePqme.js +1 -0
  179. package/kit/assets/hjson-D2jn7IRw.js +1 -0
  180. package/kit/assets/hlsl-MKeth5V9.js +1 -0
  181. package/kit/assets/horizon-bright-BVMyA0so.js +1 -0
  182. package/kit/assets/horizon-cslQss18.js +1 -0
  183. package/kit/assets/houston-RHIKkNfR.js +1 -0
  184. package/kit/assets/html-BW_6VhB7.js +1 -0
  185. package/kit/assets/html-derivative-BxANmYVz.js +1 -0
  186. package/kit/assets/http-CG3jvXcS.js +1 -0
  187. package/kit/assets/hurl-CxQrh4RI.js +1 -0
  188. package/kit/assets/hxml-In6F2XHE.js +1 -0
  189. package/kit/assets/hy-DI6mCUnw.js +1 -0
  190. package/kit/assets/imba-D-Pk5S0X.js +1 -0
  191. package/kit/assets/index-CN35FGBT.js +2 -0
  192. package/kit/assets/index-CvcU6KJI.js +2 -0
  193. package/kit/assets/index-DKDjvsnq.js +12 -0
  194. package/kit/assets/ini-Dix3pTmg.js +1 -0
  195. package/kit/assets/java-BTDmaRNO.js +1 -0
  196. package/kit/assets/javascript-WyGyM1wV.js +1 -0
  197. package/kit/assets/jinja-CGKoJZuT.js +1 -0
  198. package/kit/assets/jison-B9XHrcYJ.js +1 -0
  199. package/kit/assets/json-B8JryHcM.js +1 -0
  200. package/kit/assets/json5-Cdatmj9n.js +1 -0
  201. package/kit/assets/jsonc-CvUCa1o5.js +1 -0
  202. package/kit/assets/jsonl-9I_GBd5L.js +1 -0
  203. package/kit/assets/jsonnet-XoenQ2oc.js +1 -0
  204. package/kit/assets/jssm-CWE2S0Z5.js +1 -0
  205. package/kit/assets/jsx-8cLv2Six.js +1 -0
  206. package/kit/assets/julia-CHsXSRRi.js +1 -0
  207. package/kit/assets/just-BhMjiL1x.js +1 -0
  208. package/kit/assets/kanagawa-dragon-elpLL9d7.js +1 -0
  209. package/kit/assets/kanagawa-lotus-qwxsXd6N.js +1 -0
  210. package/kit/assets/kanagawa-wave-CmHwPSUq.js +1 -0
  211. package/kit/assets/katex-HP8lGamR.js +257 -0
  212. package/kit/assets/kdl-CMbyIXjQ.js +1 -0
  213. package/kit/assets/kotlin-BQy537ds.js +1 -0
  214. package/kit/assets/kusto-Bh6esMjd.js +1 -0
  215. package/kit/assets/laserwave-si7wuSrt.js +1 -0
  216. package/kit/assets/latex-l4EWm08Q.js +1 -0
  217. package/kit/assets/lean-C4RHkN41.js +1 -0
  218. package/kit/assets/less-XNfgnZC7.js +1 -0
  219. package/kit/assets/light-plus-g_Fi9vkG.js +1 -0
  220. package/kit/assets/liquid-VEiCTF4k.js +1 -0
  221. package/kit/assets/llvm-CQZjIlnZ.js +1 -0
  222. package/kit/assets/log-CcaF_xNv.js +1 -0
  223. package/kit/assets/logo-D9WQLoKQ.js +1 -0
  224. package/kit/assets/lua-8Av-h-ns.js +1 -0
  225. package/kit/assets/luau-CmQFRJk_.js +1 -0
  226. package/kit/assets/make-DXVx14cr.js +1 -0
  227. package/kit/assets/markdown-DX-TNHnc.js +1 -0
  228. package/kit/assets/markdown-parse.worker-D0WrtDJ7.js +59 -0
  229. package/kit/assets/markdown.worker-DQJC0QHv.js +83 -0
  230. package/kit/assets/marko-6XzqJfhW.js +1 -0
  231. package/kit/assets/material-theme-CIJ3cGaW.js +1 -0
  232. package/kit/assets/material-theme-darker-BWg3m1GB.js +1 -0
  233. package/kit/assets/material-theme-lighter-DR8HWMN7.js +1 -0
  234. package/kit/assets/material-theme-ocean-CZf9pk28.js +1 -0
  235. package/kit/assets/material-theme-palenight-BF01YeZy.js +1 -0
  236. package/kit/assets/matlab-DzreyMvm.js +1 -0
  237. package/kit/assets/mdc-DRPSCe6f.js +1 -0
  238. package/kit/assets/mdx-C2fqO2XY.js +1 -0
  239. package/kit/assets/mermaid-B3PwCbv_.js +1 -0
  240. package/kit/assets/min-dark-DhfaepVE.js +1 -0
  241. package/kit/assets/min-light-6xx0uMgm.js +1 -0
  242. package/kit/assets/mipsasm-yE_Aqo9y.js +1 -0
  243. package/kit/assets/mojo-DoyaMtMQ.js +1 -0
  244. package/kit/assets/monokai-CfflZzqd.js +1 -0
  245. package/kit/assets/moonbit-GUn1DCOq.js +1 -0
  246. package/kit/assets/move-DgW29s8x.js +1 -0
  247. package/kit/assets/narrat-DXUZ_ZkW.js +1 -0
  248. package/kit/assets/nextflow-D9i3Mg89.js +1 -0
  249. package/kit/assets/nextflow-groovy-BtKenbWl.js +1 -0
  250. package/kit/assets/nginx-DSXkacNc.js +1 -0
  251. package/kit/assets/night-owl-EdP2Hztp.js +1 -0
  252. package/kit/assets/night-owl-light-Bk-lYVyk.js +1 -0
  253. package/kit/assets/nim-D9lokC5T.js +1 -0
  254. package/kit/assets/nix-Ckjrpg0r.js +1 -0
  255. package/kit/assets/nord-BAu0wM6c.js +1 -0
  256. package/kit/assets/nsis-C1FUr9r5.js +1 -0
  257. package/kit/assets/nushell-D7aJuCS6.js +1 -0
  258. package/kit/assets/objective-c-BoaBTdtz.js +1 -0
  259. package/kit/assets/objective-cpp-DstR8hNy.js +1 -0
  260. package/kit/assets/ocaml-DTbn2Hv7.js +1 -0
  261. package/kit/assets/odin-Bxc4S6Xn.js +1 -0
  262. package/kit/assets/one-dark-pro-utPxbBbJ.js +1 -0
  263. package/kit/assets/one-light-BuCQ22aO.js +1 -0
  264. package/kit/assets/openscad-CXHpNBsb.js +1 -0
  265. package/kit/assets/org-DcqggXXW.js +1 -0
  266. package/kit/assets/pascal-Sr-XLSE6.js +1 -0
  267. package/kit/assets/perl-CP_GSK0L.js +1 -0
  268. package/kit/assets/php-CNeTOyEV.js +1 -0
  269. package/kit/assets/pkl-CRusufhw.js +1 -0
  270. package/kit/assets/plastic-CXnNNlFZ.js +1 -0
  271. package/kit/assets/plsql-Dbm3tV2N.js +1 -0
  272. package/kit/assets/po-LG0lFwH4.js +1 -0
  273. package/kit/assets/poimandres-BrOVMvuE.js +1 -0
  274. package/kit/assets/polar-DjOs3GWb.js +1 -0
  275. package/kit/assets/postcss-GRRkWn2F.js +1 -0
  276. package/kit/assets/powerquery-DHf-dtTS.js +1 -0
  277. package/kit/assets/powershell-CUnxWBRw.js +1 -0
  278. package/kit/assets/prisma-HKDfktb8.js +1 -0
  279. package/kit/assets/prolog-9JcfiY6I.js +1 -0
  280. package/kit/assets/proto-dqx_Sj2i.js +1 -0
  281. package/kit/assets/pug-kUpeg2wB.js +1 -0
  282. package/kit/assets/puppet-Di57VbSS.js +1 -0
  283. package/kit/assets/purescript-BgpM7rDH.js +1 -0
  284. package/kit/assets/python-B6Ihcp-E.js +1 -0
  285. package/kit/assets/qml-DmGQGbca.js +1 -0
  286. package/kit/assets/qmldir-DXd9s5XC.js +1 -0
  287. package/kit/assets/qss-B7NnhfIi.js +1 -0
  288. package/kit/assets/r-C2sK8mqY.js +1 -0
  289. package/kit/assets/racket-CeDx7KO2.js +1 -0
  290. package/kit/assets/raku-BMJwmrCS.js +1 -0
  291. package/kit/assets/razor-C2a5o_rD.js +1 -0
  292. package/kit/assets/rbs-BNdQsBCU.js +1 -0
  293. package/kit/assets/red-D0qvOrrt.js +1 -0
  294. package/kit/assets/reg-Cvyu2Gnx.js +1 -0
  295. package/kit/assets/regexp-DK-WlHNu.js +1 -0
  296. package/kit/assets/rel-BlqNHz8k.js +1 -0
  297. package/kit/assets/riscv-C5dpdlr7.js +1 -0
  298. package/kit/assets/ron-j5NfrB3z.js +1 -0
  299. package/kit/assets/rose-pine-B13eftVv.js +1 -0
  300. package/kit/assets/rose-pine-dawn-BcSoidev.js +1 -0
  301. package/kit/assets/rose-pine-moon-QhZovmiB.js +1 -0
  302. package/kit/assets/rosmsg-ZkSIzPhc.js +1 -0
  303. package/kit/assets/rst-CgFL6KOR.js +1 -0
  304. package/kit/assets/ruby-CoSFdlpl.js +1 -0
  305. package/kit/assets/rust-CxuBE0J8.js +1 -0
  306. package/kit/assets/sas-DPMpzP9X.js +1 -0
  307. package/kit/assets/sass-bfEVHPJ8.js +1 -0
  308. package/kit/assets/scala-DT3kbCHL.js +1 -0
  309. package/kit/assets/scheme-OJppFQF3.js +1 -0
  310. package/kit/assets/scss-n48HZsmL.js +1 -0
  311. package/kit/assets/sdbl-CvZs3G9c.js +1 -0
  312. package/kit/assets/shaderlab-CEJedz68.js +1 -0
  313. package/kit/assets/shellscript-DgJyDXW6.js +1 -0
  314. package/kit/assets/shellsession-DSlzxnCM.js +1 -0
  315. package/kit/assets/slack-dark-CWRQmTmo.js +1 -0
  316. package/kit/assets/slack-ochin-DO_ok7XK.js +1 -0
  317. package/kit/assets/smalltalk-De6KzMWc.js +1 -0
  318. package/kit/assets/smithy-BVTkKWO9.js +1 -0
  319. package/kit/assets/snazzy-light-B5llO_gK.js +1 -0
  320. package/kit/assets/solarized-dark-BWFpDpV1.js +1 -0
  321. package/kit/assets/solarized-light-eZCMDrWD.js +1 -0
  322. package/kit/assets/solidity-SYSxO-p1.js +1 -0
  323. package/kit/assets/soy-DEV4yxgM.js +1 -0
  324. package/kit/assets/sparql-BJh4JEw-.js +1 -0
  325. package/kit/assets/splunk-h-bNAnbk.js +1 -0
  326. package/kit/assets/sprite-Fb-TFjRY.svg +11707 -0
  327. package/kit/assets/sql-Dq2MiB0T.js +1 -0
  328. package/kit/assets/ssh-config-CywOjoXH.js +1 -0
  329. package/kit/assets/stata-BcICKvEt.js +1 -0
  330. package/kit/assets/stylus-CIg617SB.js +1 -0
  331. package/kit/assets/surrealql-CWlK9SzL.js +1 -0
  332. package/kit/assets/svelte-B-Z8GLL9.js +1 -0
  333. package/kit/assets/swift-CGD9CJBj.js +1 -0
  334. package/kit/assets/synthwave-84-DRVv-_m_.js +1 -0
  335. package/kit/assets/system-verilog-CG_VWOG3.js +1 -0
  336. package/kit/assets/systemd-DKMPPZjB.js +1 -0
  337. package/kit/assets/talonscript-eRuyeYHl.js +1 -0
  338. package/kit/assets/tasl-B9CVvjfG.js +1 -0
  339. package/kit/assets/tcl-Bq9dbVAF.js +1 -0
  340. package/kit/assets/templ-W185oS4p.js +1 -0
  341. package/kit/assets/terraform-CAp711iT.js +1 -0
  342. package/kit/assets/tex-DNkCctwf.js +1 -0
  343. package/kit/assets/tokyo-night-BvwC8l2v.js +1 -0
  344. package/kit/assets/toml-Ms459DBw.js +1 -0
  345. package/kit/assets/ts-tags-xUT7JH_c.js +1 -0
  346. package/kit/assets/tsv-BFtm7NXx.js +1 -0
  347. package/kit/assets/tsx-D6116Ycy.js +1 -0
  348. package/kit/assets/turtle-DpRhbQZY.js +1 -0
  349. package/kit/assets/twig-k5g5DPXm.js +1 -0
  350. package/kit/assets/typescript-BqvgUolh.js +1 -0
  351. package/kit/assets/typespec-B09nCZui.js +1 -0
  352. package/kit/assets/typst-Dfd71gQj.js +1 -0
  353. package/kit/assets/v-DUsAht2M.js +1 -0
  354. package/kit/assets/vala-z59IxkFd.js +1 -0
  355. package/kit/assets/vb-A7jYO8Gn.js +1 -0
  356. package/kit/assets/verilog-jqltjd44.js +1 -0
  357. package/kit/assets/vesper-DxfWgk_t.js +1 -0
  358. package/kit/assets/vhdl-DJCsFYgn.js +1 -0
  359. package/kit/assets/viml-pbKHW3Ia.js +1 -0
  360. package/kit/assets/vitesse-black-B_BYPdvp.js +1 -0
  361. package/kit/assets/vitesse-dark-DOSOf2Sz.js +1 -0
  362. package/kit/assets/vitesse-light-gUX51GpB.js +1 -0
  363. package/kit/assets/vue-D2T8AFdP.js +1 -0
  364. package/kit/assets/vue-html-zEfNEgpj.js +1 -0
  365. package/kit/assets/vue-vine-DQRWX4iy.js +1 -0
  366. package/kit/assets/vyper-DpazWNpx.js +1 -0
  367. package/kit/assets/wasm-CFi-k9--.js +1 -0
  368. package/kit/assets/wasm-CG6Dc4jp.js +1 -0
  369. package/kit/assets/wenyan-CYFFG9DK.js +1 -0
  370. package/kit/assets/wgsl-CxjTZs-b.js +1 -0
  371. package/kit/assets/wikitext-Bx2qct8O.js +1 -0
  372. package/kit/assets/wit-DDW3hD69.js +1 -0
  373. package/kit/assets/wolfram-pu21K997.js +1 -0
  374. package/kit/assets/worker-DPHDIlCt.js +156 -0
  375. package/kit/assets/xml-BkAJuBCc.js +1 -0
  376. package/kit/assets/xsl-C6UUWSil.js +1 -0
  377. package/kit/assets/yaml-Bopit2L3.js +1 -0
  378. package/kit/assets/zenscript-BIAKq-aR.js +1 -0
  379. package/kit/assets/zig-bSFrHQ7n.js +1 -0
  380. package/kit/build.json +3 -0
  381. package/kit/chunks/abap-BdImnpbu.js +1 -0
  382. package/kit/chunks/abnfDiagram-VCTEODGH-Ekbmv6AY.js +1 -0
  383. package/kit/chunks/actionscript-3-B3316cI-.js +1 -0
  384. package/kit/chunks/ada-bCR0ucgS.js +1 -0
  385. package/kit/chunks/ahk-CsyLZFj1.js +1 -0
  386. package/kit/chunks/ahk2-8Zs4aa1G.js +1 -0
  387. package/kit/chunks/andromeeda-C4gqWexZ.js +1 -0
  388. package/kit/chunks/angular-html-DA-rfuFy.js +1 -0
  389. package/kit/chunks/angular-ts-BrjP3tb8.js +1 -0
  390. package/kit/chunks/apache-Pmp26Uib.js +1 -0
  391. package/kit/chunks/apex-DhZFqWV2.js +1 -0
  392. package/kit/chunks/apl-CORt7UWP.js +1 -0
  393. package/kit/chunks/app-chat-kit-CmncbKE7.js +885 -0
  394. package/kit/chunks/applescript-Co6uUVPk.js +1 -0
  395. package/kit/chunks/ara-BRHolxvo.js +1 -0
  396. package/kit/chunks/arc-CTvemvxA.js +1 -0
  397. package/kit/chunks/architecture-7GRP2DOG-Ek37_97Z.js +1 -0
  398. package/kit/chunks/architectureDiagram-5GKGNRK7-Dfo6x88c.js +36 -0
  399. package/kit/chunks/asciidoc-CSVQ5wI8.js +1 -0
  400. package/kit/chunks/asm-D_Q5rh1f.js +1 -0
  401. package/kit/chunks/astro-HNnZUWAn.js +1 -0
  402. package/kit/chunks/aurora-x-D-2ljcwZ.js +1 -0
  403. package/kit/chunks/awk-DMzUqQB5.js +1 -0
  404. package/kit/chunks/ayu-dark-DYE7WIF3.js +1 -0
  405. package/kit/chunks/ayu-light-BA47KaF1.js +1 -0
  406. package/kit/chunks/ayu-mirage-32ctXXKs.js +1 -0
  407. package/kit/chunks/ballerina-BFfxhgS-.js +1 -0
  408. package/kit/chunks/bat-CickPsom.js +1 -0
  409. package/kit/chunks/beancount-k_qm7-4y.js +1 -0
  410. package/kit/chunks/berry-uYugtg8r.js +1 -0
  411. package/kit/chunks/bibtex-CHM0blh-.js +1 -0
  412. package/kit/chunks/bicep-Bmn6On1c.js +1 -0
  413. package/kit/chunks/bird2-Bx8U0n9b.js +1 -0
  414. package/kit/chunks/blade-2xfisSek.js +1 -0
  415. package/kit/chunks/blockDiagram-NRAW4CY4-BREhUg_n.js +129 -0
  416. package/kit/chunks/bsl-DlhNcFeZ.js +1 -0
  417. package/kit/chunks/c-BIGW1oBm.js +1 -0
  418. package/kit/chunks/c3-Dp5svz6Z.js +1 -0
  419. package/kit/chunks/c4Diagram-UCG6FXSJ-CAoiRqwq.js +38 -0
  420. package/kit/chunks/cadence-Bv_4Rxtq.js +1 -0
  421. package/kit/chunks/cairo-KRGpt6FW.js +1 -0
  422. package/kit/chunks/catppuccin-frappe-CZL1YF0i.js +1 -0
  423. package/kit/chunks/catppuccin-latte-DH-8KZSZ.js +1 -0
  424. package/kit/chunks/catppuccin-macchiato-B7yYVSCf.js +1 -0
  425. package/kit/chunks/catppuccin-mocha-Ct7hS0mc.js +1 -0
  426. package/kit/chunks/channel-BCuymVz7.js +1 -0
  427. package/kit/chunks/chapel-DTp_pixX.js +1 -0
  428. package/kit/chunks/chunk-2Q5K7J3B-Dfj9NWMK.js +1 -0
  429. package/kit/chunks/chunk-5VM5RSS4-DDPHEz3o.js +15 -0
  430. package/kit/chunks/chunk-F27PBJKO-DjjkcfXV.js +1 -0
  431. package/kit/chunks/chunk-G27WJ6UU-BbKnleUj.js +231 -0
  432. package/kit/chunks/chunk-JWPE2WC7-CTyE03Ky.js +1 -0
  433. package/kit/chunks/chunk-LCL6LL3I-DLCIPv63.js +206 -0
  434. package/kit/chunks/chunk-POPQ4Y6H-vHDe0Ab2.js +1 -0
  435. package/kit/chunks/chunk-RHFEMEQ7-MYjE_XE-.js +168 -0
  436. package/kit/chunks/chunk-SVP7TREG-B-Z53M0l.js +88 -0
  437. package/kit/chunks/chunk-XXDRQBXY-Byur0hqD.js +1 -0
  438. package/kit/chunks/clarity-Dn5IMItf.js +1 -0
  439. package/kit/chunks/classDiagram-DTDB5LWJ-RWAJ513G.js +1 -0
  440. package/kit/chunks/classDiagram-v2-JRS7N3AN-RWAJ513G.js +1 -0
  441. package/kit/chunks/clojure-P80f7IUj.js +1 -0
  442. package/kit/chunks/cmake-D1j8_8rp.js +1 -0
  443. package/kit/chunks/cobol-nBiQ_Alo.js +1 -0
  444. package/kit/chunks/codeowners-Bp6g37R7.js +1 -0
  445. package/kit/chunks/codeql-DsOJ9woJ.js +1 -0
  446. package/kit/chunks/coffee-Ch7k5sss.js +1 -0
  447. package/kit/chunks/common-lisp-Cg-RD9OK.js +1 -0
  448. package/kit/chunks/coq-C7JzOVbR.js +1 -0
  449. package/kit/chunks/cose-bilkent-JH36ORCC-BJBTUpzs.js +1 -0
  450. package/kit/chunks/cpp-BMRokrvK.js +1 -0
  451. package/kit/chunks/crystal-DGywbUpC.js +1 -0
  452. package/kit/chunks/csharp-DSvCPggb.js +1 -0
  453. package/kit/chunks/css-CLj8gQPS.js +1 -0
  454. package/kit/chunks/csv-fuZLfV_i.js +1 -0
  455. package/kit/chunks/cue-D82EKSYY.js +1 -0
  456. package/kit/chunks/cynefin-OW5HDTMX-DximYq9_.js +1 -0
  457. package/kit/chunks/cynefinDiagram-5FMLGOSQ-C_H0NP3V.js +62 -0
  458. package/kit/chunks/cypher-COkxafJQ.js +1 -0
  459. package/kit/chunks/cytoscape.esm-CNiYdHpY.js +331 -0
  460. package/kit/chunks/d-85-TOEBH.js +1 -0
  461. package/kit/chunks/dagre-3AP2YEHR-B40iBpXe.js +4 -0
  462. package/kit/chunks/dark-plus-C3mMm8J8.js +1 -0
  463. package/kit/chunks/dart-bE4Kk8sk.js +1 -0
  464. package/kit/chunks/dax-CEL-wOlO.js +1 -0
  465. package/kit/chunks/defaultLocale-DX6XiGOO.js +1 -0
  466. package/kit/chunks/desktop-BmXAJ9_W.js +1 -0
  467. package/kit/chunks/diagram-S7CK7UJ4-B2xIXmUw.js +30 -0
  468. package/kit/chunks/diagram-UQ7AKVKN-DLWlOhvf.js +41 -0
  469. package/kit/chunks/diagram-VSXAHHWV-CtxWAwpJ.js +3 -0
  470. package/kit/chunks/diagram-VX7I27RA-C0oOsr2R.js +24 -0
  471. package/kit/chunks/diagram-Z3DM3KII-DguGhB-N.js +24 -0
  472. package/kit/chunks/diff-D97Zzqfu.js +1 -0
  473. package/kit/chunks/docker-BcOcwvcX.js +1 -0
  474. package/kit/chunks/dotenv-Da5cRb03.js +1 -0
  475. package/kit/chunks/dracula-BzJJZx-M.js +1 -0
  476. package/kit/chunks/dracula-soft-BXkSAIEj.js +1 -0
  477. package/kit/chunks/dream-maker-BtqSS_iP.js +1 -0
  478. package/kit/chunks/ebnfDiagram-PWID7BFC-CM2jytSc.js +1 -0
  479. package/kit/chunks/edge-FbVlp4U3.js +1 -0
  480. package/kit/chunks/elixir-CkH2-t6x.js +1 -0
  481. package/kit/chunks/elm-DbKCFpqz.js +1 -0
  482. package/kit/chunks/emacs-lisp-C_m_b--Z.js +1 -0
  483. package/kit/chunks/engine-compile-BrcillB_.js +152 -0
  484. package/kit/chunks/erDiagram-SSCWMZ5O-6AVzexk8.js +99 -0
  485. package/kit/chunks/erb-DXfck5VN.js +1 -0
  486. package/kit/chunks/erlang-DsQrWhSR.js +1 -0
  487. package/kit/chunks/eventmodeling-NTZA5JFV-i5VApXqj.js +1 -0
  488. package/kit/chunks/everforest-dark-BgDCqdQA.js +1 -0
  489. package/kit/chunks/everforest-light-C8M2exoo.js +1 -0
  490. package/kit/chunks/fennel-BYunw83y.js +1 -0
  491. package/kit/chunks/file-p1zS5m55.js +1524 -0
  492. package/kit/chunks/fish-BvzEVeQv.js +1 -0
  493. package/kit/chunks/flowDiagram-A5DVABFB-BXMY48By.js +1 -0
  494. package/kit/chunks/fluent-C4IJs8-o.js +1 -0
  495. package/kit/chunks/fortran-fixed-form-CkoXwp7k.js +1 -0
  496. package/kit/chunks/fortran-free-form-BxgE0vQu.js +1 -0
  497. package/kit/chunks/fsharp-CXgrBDvD.js +1 -0
  498. package/kit/chunks/ganttDiagram-EL5Y4UJY-CV7SNBW7.js +292 -0
  499. package/kit/chunks/gdresource-TyuKm33G.js +1 -0
  500. package/kit/chunks/gdscript-DqcFQ5yU.js +1 -0
  501. package/kit/chunks/gdshader-DkwncUOv.js +1 -0
  502. package/kit/chunks/genie-D0YGMca9.js +1 -0
  503. package/kit/chunks/gherkin-DyxjwDmM.js +1 -0
  504. package/kit/chunks/git-commit-F4YmCXRG.js +1 -0
  505. package/kit/chunks/git-rebase-r7XF79zn.js +1 -0
  506. package/kit/chunks/gitGraph-4MIJSDKK-J1V9VTkA.js +1 -0
  507. package/kit/chunks/gitGraphDiagram-WWUBYQGX-BCHc9w_M.js +106 -0
  508. package/kit/chunks/github-dark-DHJKELXO.js +1 -0
  509. package/kit/chunks/github-dark-default-Cuk6v7N8.js +1 -0
  510. package/kit/chunks/github-dark-dimmed-DH5Ifo-i.js +1 -0
  511. package/kit/chunks/github-dark-high-contrast-E3gJ1_iC.js +1 -0
  512. package/kit/chunks/github-light-DAi9KRSo.js +1 -0
  513. package/kit/chunks/github-light-default-D7oLnXFd.js +1 -0
  514. package/kit/chunks/github-light-high-contrast-BfjtVDDH.js +1 -0
  515. package/kit/chunks/gleam-BspZqrRM.js +1 -0
  516. package/kit/chunks/glimmer-js-ByusRIyA.js +1 -0
  517. package/kit/chunks/glimmer-ts-BfAWNZQY.js +1 -0
  518. package/kit/chunks/glsl-DplSGwfg.js +1 -0
  519. package/kit/chunks/gn-n2N0HUVH.js +1 -0
  520. package/kit/chunks/gnuplot-DdkO51Og.js +1 -0
  521. package/kit/chunks/go-C27-OAKa.js +1 -0
  522. package/kit/chunks/graphql-ChdNCCLP.js +1 -0
  523. package/kit/chunks/groovy-gcz8RCvz.js +1 -0
  524. package/kit/chunks/gruvbox-dark-hard-CFHQjOhq.js +1 -0
  525. package/kit/chunks/gruvbox-dark-medium-GsRaNv29.js +1 -0
  526. package/kit/chunks/gruvbox-dark-soft-CVdnzihN.js +1 -0
  527. package/kit/chunks/gruvbox-light-hard-CH1njM8p.js +1 -0
  528. package/kit/chunks/gruvbox-light-medium-DRw_LuNl.js +1 -0
  529. package/kit/chunks/gruvbox-light-soft-hJgmCMqR.js +1 -0
  530. package/kit/chunks/hack-BWmVpMyf.js +1 -0
  531. package/kit/chunks/haml-D5jkg6IW.js +1 -0
  532. package/kit/chunks/handlebars-BpdQsYii.js +1 -0
  533. package/kit/chunks/haskell-Df6bDoY_.js +1 -0
  534. package/kit/chunks/haxe-CfZj7gIn.js +1 -0
  535. package/kit/chunks/hcl-BWvSN4gD.js +1 -0
  536. package/kit/chunks/hjson-D5-asLiD.js +1 -0
  537. package/kit/chunks/hlsl-D3lLCCz7.js +1 -0
  538. package/kit/chunks/horizon-BUw7H-hv.js +1 -0
  539. package/kit/chunks/horizon-bright-CUuTKBJd.js +1 -0
  540. package/kit/chunks/houston-DnULxvSX.js +1 -0
  541. package/kit/chunks/html-derivative-DlHx6ybY.js +1 -0
  542. package/kit/chunks/html-pp8916En.js +1 -0
  543. package/kit/chunks/http-jrhK8wxY.js +1 -0
  544. package/kit/chunks/hurl-irOxFIW8.js +1 -0
  545. package/kit/chunks/hxml-2-FPmUDs.js +1 -0
  546. package/kit/chunks/hy-DFXneXwc.js +1 -0
  547. package/kit/chunks/imba-DGztddWO.js +1 -0
  548. package/kit/chunks/index-CN35FGBT.js +2 -0
  549. package/kit/chunks/index-CvcU6KJI.js +2 -0
  550. package/kit/chunks/index-CzdAxbXm.js +1 -0
  551. package/kit/chunks/index-D-Q6ihx1.js +518 -0
  552. package/kit/chunks/info-A6RAGUB7-Df1RDY9x.js +1 -0
  553. package/kit/chunks/infoDiagram-RXCK75RN-DkViDaAy.js +2 -0
  554. package/kit/chunks/ini-BEwlwnbL.js +1 -0
  555. package/kit/chunks/init-Gi6I4Gst.js +1 -0
  556. package/kit/chunks/ishikawaDiagram-5VMMS53U-DxEqVVmG.js +70 -0
  557. package/kit/chunks/java-CylS5w8V.js +1 -0
  558. package/kit/chunks/javascript-wDzz0qaB.js +1 -0
  559. package/kit/chunks/jinja-f2NsQr07.js +1 -0
  560. package/kit/chunks/jison-wvAkD_A8.js +1 -0
  561. package/kit/chunks/journeyDiagram-EYS64GPL-C6PuEAZM.js +139 -0
  562. package/kit/chunks/json-Cp-IABpG.js +1 -0
  563. package/kit/chunks/json5-C9tS-k6U.js +1 -0
  564. package/kit/chunks/jsonc-Des-eS-w.js +1 -0
  565. package/kit/chunks/jsonl-DcaNXYhu.js +1 -0
  566. package/kit/chunks/jsonnet-DFQXde-d.js +1 -0
  567. package/kit/chunks/jssm-C2t-YnRu.js +1 -0
  568. package/kit/chunks/jsx-g9-lgVsj.js +1 -0
  569. package/kit/chunks/julia-5Bft2YPA.js +1 -0
  570. package/kit/chunks/just-Cwhn7H3k.js +1 -0
  571. package/kit/chunks/kanagawa-dragon-BuwD2xS4.js +1 -0
  572. package/kit/chunks/kanagawa-lotus-C3DzagqV.js +1 -0
  573. package/kit/chunks/kanagawa-wave-DFGoQZhC.js +1 -0
  574. package/kit/chunks/kanban-definition-3QL26DDD-DOTf6YFB.js +89 -0
  575. package/kit/chunks/katex-HP8lGamR.js +257 -0
  576. package/kit/chunks/kdl-DV7GczEv.js +1 -0
  577. package/kit/chunks/kotlin-BdnUsdx6.js +1 -0
  578. package/kit/chunks/kusto-wEQ09or8.js +1 -0
  579. package/kit/chunks/laserwave-DUszq2jm.js +1 -0
  580. package/kit/chunks/latex-D5pSuvFb.js +1 -0
  581. package/kit/chunks/layout-CdSidOqg.js +1 -0
  582. package/kit/chunks/lean-BZvkOJ9d.js +1 -0
  583. package/kit/chunks/less-B1dDrJ26.js +1 -0
  584. package/kit/chunks/light-plus-B7mTdjB0.js +1 -0
  585. package/kit/chunks/linear-2B_RRiLc.js +1 -0
  586. package/kit/chunks/liquid-C0sCDyMI.js +1 -0
  587. package/kit/chunks/llvm-BZoOZj88.js +1 -0
  588. package/kit/chunks/log-2UxHyX5q.js +1 -0
  589. package/kit/chunks/logo-BtOb2qkB.js +1 -0
  590. package/kit/chunks/lua-BaeVxFsk.js +1 -0
  591. package/kit/chunks/luau-BnpPk5vE.js +1 -0
  592. package/kit/chunks/make-CHLpvVh8.js +1 -0
  593. package/kit/chunks/markdown-Cvjx9yec.js +1 -0
  594. package/kit/chunks/markdown-PrvsCtkO.js +7 -0
  595. package/kit/chunks/markdown-code-BP4ED3mK.js +1 -0
  596. package/kit/chunks/markdown-mermaid-C7inlIvD.js +2 -0
  597. package/kit/chunks/marked-parser-ucXGUtxA.js +1 -0
  598. package/kit/chunks/marko-DjSrsDqO.js +1 -0
  599. package/kit/chunks/material-theme-D5KoaKCx.js +1 -0
  600. package/kit/chunks/material-theme-darker-BfHTSMKl.js +1 -0
  601. package/kit/chunks/material-theme-lighter-B0m2ddpp.js +1 -0
  602. package/kit/chunks/material-theme-ocean-CyktbL80.js +1 -0
  603. package/kit/chunks/material-theme-palenight-Csfq5Kiy.js +1 -0
  604. package/kit/chunks/matlab-D7o27uSR.js +1 -0
  605. package/kit/chunks/mdc-D1_yUvq7.js +1 -0
  606. package/kit/chunks/mdx-Cmh6b_Ma.js +1 -0
  607. package/kit/chunks/mermaid-CQcHuHx7.js +1 -0
  608. package/kit/chunks/mermaid-parser.core-mF5sU-Xg.js +178 -0
  609. package/kit/chunks/mermaid.core-xKeJvOaV.js +309 -0
  610. package/kit/chunks/min-dark-CafNBF8u.js +1 -0
  611. package/kit/chunks/min-light-CTRr51gU.js +1 -0
  612. package/kit/chunks/mindmap-definition-FBJOCRG2-YJlqhJDe.js +96 -0
  613. package/kit/chunks/mipsasm-CKIfxQSi.js +1 -0
  614. package/kit/chunks/mojo-Blby8dQK.js +1 -0
  615. package/kit/chunks/monokai-BRVnQi9A.js +1 -0
  616. package/kit/chunks/moonbit-CHtswR0a.js +1 -0
  617. package/kit/chunks/move-el3G9tDJ.js +1 -0
  618. package/kit/chunks/narrat-DRg8JJMk.js +1 -0
  619. package/kit/chunks/nextflow-C-mBbutL.js +1 -0
  620. package/kit/chunks/nextflow-groovy-vE_lwT2v.js +1 -0
  621. package/kit/chunks/nginx-BpAMiNFr.js +1 -0
  622. package/kit/chunks/night-owl-C39BiMTA.js +1 -0
  623. package/kit/chunks/night-owl-light-CMTm3GFP.js +1 -0
  624. package/kit/chunks/nim-BIad80T-.js +1 -0
  625. package/kit/chunks/nix-CwoSXNpI.js +1 -0
  626. package/kit/chunks/nord-Ddv68eIx.js +1 -0
  627. package/kit/chunks/nsis-BlV79W_Q.js +1 -0
  628. package/kit/chunks/nushell-D3jzshHO.js +1 -0
  629. package/kit/chunks/objective-c-DXmwc3jG.js +1 -0
  630. package/kit/chunks/objective-cpp-CLxacb5B.js +1 -0
  631. package/kit/chunks/ocaml-C0hk2d4L.js +1 -0
  632. package/kit/chunks/odin-BBf5iR-q.js +1 -0
  633. package/kit/chunks/one-dark-pro-DVMEJ2y_.js +1 -0
  634. package/kit/chunks/one-light-C3Wv6jpd.js +1 -0
  635. package/kit/chunks/openscad-C4EeE6gA.js +1 -0
  636. package/kit/chunks/ordinal-Cboi1Yqb.js +1 -0
  637. package/kit/chunks/org-DM6o9KBp.js +1 -0
  638. package/kit/chunks/packet-AYTQ26CC-BVWhELL0.js +1 -0
  639. package/kit/chunks/pascal-D93ZcfNL.js +1 -0
  640. package/kit/chunks/pegDiagram-XKGWAZYB-C4MT3RNK.js +1 -0
  641. package/kit/chunks/perl-B9cMNwum.js +1 -0
  642. package/kit/chunks/php-Csjmro_R.js +1 -0
  643. package/kit/chunks/pie-WAS4IAKB-DOImHQUJ.js +1 -0
  644. package/kit/chunks/pieDiagram-E7YTZNPT-Hm0WPgzn.js +39 -0
  645. package/kit/chunks/pierre-dark-CyvmCCZW.js +1 -0
  646. package/kit/chunks/pierre-dark-protanopia-deuteranopia-Rgc0TwpF.js +1 -0
  647. package/kit/chunks/pierre-dark-soft-BHGpRqa4.js +1 -0
  648. package/kit/chunks/pierre-dark-tritanopia-Beq2gCRQ.js +1 -0
  649. package/kit/chunks/pierre-dark-vibrant-BWBVywrn.js +1 -0
  650. package/kit/chunks/pierre-light-480U9XYS.js +1 -0
  651. package/kit/chunks/pierre-light-protanopia-deuteranopia-CaVOBURG.js +1 -0
  652. package/kit/chunks/pierre-light-soft-CVdyfjmI.js +1 -0
  653. package/kit/chunks/pierre-light-tritanopia-B4_gpKOM.js +1 -0
  654. package/kit/chunks/pierre-light-vibrant-DdTDNdfJ.js +1 -0
  655. package/kit/chunks/pkl-u5AG7uiY.js +1 -0
  656. package/kit/chunks/plastic-3e1v2bzS.js +1 -0
  657. package/kit/chunks/plsql-ChMvpjG-.js +1 -0
  658. package/kit/chunks/po-BTJTHyun.js +1 -0
  659. package/kit/chunks/poimandres-CS3Unz2-.js +1 -0
  660. package/kit/chunks/polar-C0HS_06l.js +1 -0
  661. package/kit/chunks/postcss-CXtECtnM.js +1 -0
  662. package/kit/chunks/powerquery-CEu0bR-o.js +1 -0
  663. package/kit/chunks/powershell-BmBUJMz7.js +1 -0
  664. package/kit/chunks/prisma-Vru482bI.js +1 -0
  665. package/kit/chunks/prolog-CbFg5uaA.js +1 -0
  666. package/kit/chunks/proto-C7zT0LnQ.js +1 -0
  667. package/kit/chunks/pug-DKIMFp6K.js +1 -0
  668. package/kit/chunks/puppet-BMWR74SV.js +1 -0
  669. package/kit/chunks/purescript-CklMAg4u.js +1 -0
  670. package/kit/chunks/python-B6aJPvgy.js +1 -0
  671. package/kit/chunks/qml-3beO22l8.js +1 -0
  672. package/kit/chunks/qmldir-C8lEn-DE.js +1 -0
  673. package/kit/chunks/qss-IeuSbFQv.js +1 -0
  674. package/kit/chunks/quadrantDiagram-AXDQQJYC-BZTp7tGN.js +7 -0
  675. package/kit/chunks/r-Cf5RLm7j.js +1 -0
  676. package/kit/chunks/racket-BqYA7rlc.js +1 -0
  677. package/kit/chunks/radar-RG4KPBEZ-KbpEH3G6.js +1 -0
  678. package/kit/chunks/railroad-74A4TZTK-Cy0CCThT.js +1 -0
  679. package/kit/chunks/railroad-abnf-HS5TGJTU-CvknKf9w.js +1 -0
  680. package/kit/chunks/railroad-ebnf-LZEXJU2U-DPsJAhot.js +1 -0
  681. package/kit/chunks/railroad-peg-WCYAUIDC-CAZC7-ro.js +1 -0
  682. package/kit/chunks/railroadDiagram-O6MQD6OU-Cslq_ZZh.js +1 -0
  683. package/kit/chunks/raku-DXvB9xmW.js +1 -0
  684. package/kit/chunks/razor-BjBPvh-w.js +1 -0
  685. package/kit/chunks/rbs-CpoqiR4B.js +1 -0
  686. package/kit/chunks/red-hvxz__6c.js +1 -0
  687. package/kit/chunks/reg-C-SQnVFl.js +1 -0
  688. package/kit/chunks/regexp-CDVJQ6XC.js +1 -0
  689. package/kit/chunks/rel-C3B-1QV4.js +1 -0
  690. package/kit/chunks/requirementDiagram-EFPCY7ZU-CvFiO4QY.js +84 -0
  691. package/kit/chunks/riscv-BM1_JUlF.js +1 -0
  692. package/kit/chunks/ron-D8l8udqQ.js +1 -0
  693. package/kit/chunks/rose-pine-5qJOZa0Y.js +1 -0
  694. package/kit/chunks/rose-pine-dawn-zx0QlTCp.js +1 -0
  695. package/kit/chunks/rose-pine-moon-C9pEdX9L.js +1 -0
  696. package/kit/chunks/rosmsg-BJDFO7_C.js +1 -0
  697. package/kit/chunks/rst-bs7f0vWN.js +1 -0
  698. package/kit/chunks/ruby-C0TQ7zu5.js +1 -0
  699. package/kit/chunks/rust-B1yitclQ.js +1 -0
  700. package/kit/chunks/sankeyDiagram-P5KCCOFB-Da1DpNmD.js +40 -0
  701. package/kit/chunks/sas-DEy46yEz.js +1 -0
  702. package/kit/chunks/sass-Cj5Yp3dK.js +1 -0
  703. package/kit/chunks/scala-CqE71os6.js +1 -0
  704. package/kit/chunks/scheme-C98Dy4si.js +1 -0
  705. package/kit/chunks/scss-D5BDwBP9.js +1 -0
  706. package/kit/chunks/sdbl-DVxCFoDh.js +1 -0
  707. package/kit/chunks/sequenceDiagram-WJ2MYXX4-DxoNyZwj.js +162 -0
  708. package/kit/chunks/shaderlab-Dg9Lc6iA.js +1 -0
  709. package/kit/chunks/shellscript-Yzrsuije.js +1 -0
  710. package/kit/chunks/shellsession-BADoaaVG.js +1 -0
  711. package/kit/chunks/sizeCapture-X5ZJPWSS-BYc4ks_u.js +1 -0
  712. package/kit/chunks/slack-dark-BthQWCQV.js +1 -0
  713. package/kit/chunks/slack-ochin-DqwNpetd.js +1 -0
  714. package/kit/chunks/smalltalk-BOQMe2GC.js +1 -0
  715. package/kit/chunks/smithy-cds9vsN8.js +1 -0
  716. package/kit/chunks/snazzy-light-Bw305WKR.js +1 -0
  717. package/kit/chunks/solarized-dark-CpvCGNkr.js +1 -0
  718. package/kit/chunks/solarized-light-Dlz6yCKv.js +1 -0
  719. package/kit/chunks/solidity-DijEV5ha.js +1 -0
  720. package/kit/chunks/soy-8wufbnw4.js +1 -0
  721. package/kit/chunks/sparql-rVzFXLq3.js +1 -0
  722. package/kit/chunks/splunk-BtCnVYZw.js +1 -0
  723. package/kit/chunks/sql-CRqJ_cUM.js +1 -0
  724. package/kit/chunks/ssh-config-_ykCGR6B.js +1 -0
  725. package/kit/chunks/stata-DI20mbqo.js +1 -0
  726. package/kit/chunks/stateDiagram-HBIQ2CUA-pcNSv_wf.js +1 -0
  727. package/kit/chunks/stateDiagram-v2-4QOOHH4V-BdB1HxLL.js +1 -0
  728. package/kit/chunks/stylus-BEDo0Tqx.js +1 -0
  729. package/kit/chunks/surrealql-Cjom0U5J.js +1 -0
  730. package/kit/chunks/svelte-Cy7k_4gC.js +1 -0
  731. package/kit/chunks/swift-C2oV4EkX.js +1 -0
  732. package/kit/chunks/swimlanes-XN3QIQJK-D7wXTch1.js +1 -0
  733. package/kit/chunks/swimlanesDiagram-VK2B7HYN-BmYbYnek.js +8 -0
  734. package/kit/chunks/synthwave-84-CbfX1IO0.js +1 -0
  735. package/kit/chunks/system-verilog-0hqHdDBg.js +1 -0
  736. package/kit/chunks/systemd-4A_iFExJ.js +1 -0
  737. package/kit/chunks/talonscript-CkByrt1z.js +1 -0
  738. package/kit/chunks/tasl-QIJgUcNo.js +1 -0
  739. package/kit/chunks/tcl-dwOrl1Do.js +1 -0
  740. package/kit/chunks/templ-DhtptRzy.js +1 -0
  741. package/kit/chunks/terraform-BETggiCN.js +1 -0
  742. package/kit/chunks/tex-D96PA37w.js +1 -0
  743. package/kit/chunks/timeline-definition-24CTP7MA-BrPc1tMu.js +120 -0
  744. package/kit/chunks/tokyo-night-hegEt444.js +1 -0
  745. package/kit/chunks/toml-vGWfd6FD.js +1 -0
  746. package/kit/chunks/treeView-Q6P3EWNA-hcKZ8Aqa.js +1 -0
  747. package/kit/chunks/treemap-WGGIJYW6-VledEerh.js +1 -0
  748. package/kit/chunks/ts-tags-D351s5mN.js +1 -0
  749. package/kit/chunks/tsv-B_m7g4N7.js +1 -0
  750. package/kit/chunks/tsx-COt5Ahok.js +1 -0
  751. package/kit/chunks/turtle-BsS91CYL.js +1 -0
  752. package/kit/chunks/twig-27uCiNez.js +1 -0
  753. package/kit/chunks/typescript-BPQ3VLAy.js +1 -0
  754. package/kit/chunks/typespec-CAFt9gP4.js +1 -0
  755. package/kit/chunks/typst-DHCkPAjA.js +1 -0
  756. package/kit/chunks/v-BGw2Nkan.js +1 -0
  757. package/kit/chunks/vala-CsfeWuGM.js +1 -0
  758. package/kit/chunks/vb-Cu-pLBUe.js +1 -0
  759. package/kit/chunks/vennDiagram-4TSXK5OY-CMfntOoF.js +34 -0
  760. package/kit/chunks/verilog-nZwndyjY.js +1 -0
  761. package/kit/chunks/vesper-DRje8inN.js +1 -0
  762. package/kit/chunks/vhdl-CeAyd5Ju.js +1 -0
  763. package/kit/chunks/viml-CJc9bBzg.js +1 -0
  764. package/kit/chunks/vitesse-black-Bkuqu6BP.js +1 -0
  765. package/kit/chunks/vitesse-dark-D0r3Knsf.js +1 -0
  766. package/kit/chunks/vitesse-light-CVO1_9PV.js +1 -0
  767. package/kit/chunks/vue-BqiEGhQt.js +1 -0
  768. package/kit/chunks/vue-html-AaS7Mt5G.js +1 -0
  769. package/kit/chunks/vue-vine-BoDAl6tE.js +1 -0
  770. package/kit/chunks/vyper-CDx5xZoG.js +1 -0
  771. package/kit/chunks/wardley-WFR3VGLG-Bx5FYIM5.js +1 -0
  772. package/kit/chunks/wardleyDiagram-VM6X3IG4-C9foyd_h.js +78 -0
  773. package/kit/chunks/wasm-CG6Dc4jp.js +1 -0
  774. package/kit/chunks/wasm-MzD3tlZU.js +1 -0
  775. package/kit/chunks/wenyan-BV7otONQ.js +1 -0
  776. package/kit/chunks/wgsl-Dx-B1_4e.js +1 -0
  777. package/kit/chunks/wikitext-BhOHFoWU.js +1 -0
  778. package/kit/chunks/wit-5i3qLPDT.js +1 -0
  779. package/kit/chunks/wolfram-lXgVvXCa.js +1 -0
  780. package/kit/chunks/xml-sdJ4AIDG.js +1 -0
  781. package/kit/chunks/xsl-CtQFsRM5.js +1 -0
  782. package/kit/chunks/xychartDiagram-S5SC5T6Z-Bp0MWYj-.js +7 -0
  783. package/kit/chunks/yaml-Buea-lGh.js +1 -0
  784. package/kit/chunks/zenscript-DVFEvuxE.js +1 -0
  785. package/kit/chunks/zig-VOosw3JB.js +1 -0
  786. package/kit/index.d.ts +95 -0
  787. package/kit/index.js +1 -0
  788. package/kit/mux-build.json +1 -0
  789. package/kit/style.css +1 -0
  790. package/package.json +9 -15
  791. package/dist/controller.d.ts +0 -66
  792. package/dist/index.d.ts +0 -2
  793. package/dist/index.js +0 -1237
  794. package/dist/index.js.map +0 -1
  795. package/dist/markdown.d.ts +0 -2
  796. package/dist/model.d.ts +0 -33
  797. package/dist/mount.d.ts +0 -56
  798. package/dist/styles.d.ts +0 -2
  799. package/dist/testing.js.map +0 -1
  800. package/dist/view/Chat.d.ts +0 -26
  801. package/dist/view/parts.d.ts +0 -19
  802. package/dist/view/primitives.d.ts +0 -10
@@ -0,0 +1,1524 @@
1
+ import{isServer as Di,createComponent as W,effect as Qe,setAttribute as le,insert as X,template as He,Portal as lo,use as _t,memo as _i,addEventListener as rt,setStyleProperty as Wn,delegateEvents as Pi,style as ho,classList as co}from"solid-js/web";import{getOwner as Fi,sharedConfig as uo,createRoot as zi,onCleanup as de,createMemo as Y,createEffect as Ee,on as fo,Switch as po,Match as mt,Show as ot,useContext as go,createContext as mo,onMount as Oi,createSignal as Pn,splitProps as Ni}from"solid-js";import{c as vo,m as bo,b as G,e as Ui,_ as E,C as Fn,H as zn,f as On,i as Nn,j as Vt,U as So,k as yo,l as Vi,T as Co,n as xo,E as Bi,o as Un,S as Lo,p as Fe,q as ce,r as Ne,s as Ue,v as ko,w as wo,a as $i,x as Eo,y as Ro,z as rn,A as on,F as To,G as Ao,I as Ho,J as vt,K as Mo,L as Io,N as Gn}from"./app-chat-kit-CmncbKE7.js";import{N as te,b as jn,A as Do,c as _o,m as Po,l as Fo}from"./engine-compile-BrcillB_.js";import{createStore as zo}from"solid-js/store";function Oo(e,t=Fi()){let n=0,i,r;return()=>(n++,de(()=>{n--,queueMicrotask(()=>{!n&&r&&(r(),r=i=void 0)})}),r||zi(o=>i=e(r=o),t),i)}function No(e){const t=Fi(),n=Oo(e,t);return()=>Di||uo.context?zi(e,t):n()}function Wi(e,t=!1){if(Di)return()=>t;const n=window.matchMedia(e),[i,r]=vo(t,()=>n.matches);return bo(n,"change",()=>r(n.matches)),i}function Uo(e){return Wi("(prefers-color-scheme: dark)",e)}Uo.bind(void 0,!1);const Xe=new Set;let Ze=null;function Q(e){Xe.add(e),Ze??=requestAnimationFrame(Gi)}function Bt(e){Xe.delete(e)&&Xe.size===0&&Ze!=null&&(cancelAnimationFrame(Ze),Ze=null)}function Gi(e){const t=new Set(Xe);Xe.clear();for(const n of t)try{n(e)}catch(i){console.error(i)}Xe.size>0?Ze=requestAnimationFrame(Gi):Ze=null}function $t(e,t,n){if(e===t||e==null||t==null)return e===t;const i=new Set(n),r=Object.keys(e),o=new Set(Object.keys(t));for(const s of r)if(o.delete(s),!i.has(s)&&(!(s in t)||e[s]!==t[s]))return!1;for(const s of Array.from(o))if(!i.has(s))return!1;return!0}function pt(e,t){return e==null||t==null||typeof e=="string"||typeof t=="string"?e===t:e.dark===t.dark&&e.light===t.light}function ji(e,t){const n=e?.theme??G,i=t?.theme??G,r=qn(e),o=qn(t);return pt(n,i)&&$t(e,t,["theme","parseDiffOptions"])&&$t(r,o)}function qn(e){if(e!=null&&"parseDiffOptions"in e)return e.parseDiffOptions}function mn(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Kn({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:i=!1,fitPerfectlyOverscroll:r=0,overscrollSize:o}){const s=n+o*2,l=i?n+r*2:s;if(t=Math.max(t,l),s>=t||i){const d=Math.max(e-r,0),c=Math.min(e+l,t);return{top:d,bottom:Math.max(c,d)}}let a=e+n/2-s/2,h=a+s;return a<0&&(a=0),h>t&&(h=t),a=Math.floor(Math.max(a,0)),{top:a,bottom:Math.ceil(Math.max(Math.min(h,t),a))}}class Vo extends Ui{}const Bo=new Vo;function $o(e,t,n){return Bo.diff(e,t,n)}const Yn="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class Wo extends Ui{tokenize(t){const n=new RegExp(`(\\r?\\n)|[${Yn}]+|[^\\S\\n\\r]+|[^${Yn}]`,"ug");return t.match(n)||[]}}const Go=new Wo;function jo(e,t,n){return Go.diff(e,t,n)}function Se(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Ce(e){return{type:"text",value:e}}function F({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function Wt({name:e,width:t=16,height:n=16,properties:i}){return F({tagName:"svg",properties:{width:t,height:n,viewBox:"0 0 16 16",...i},children:[F({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function qo(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t;"children"in t?t=t.children[0]:t=null}}function Ke(e){return F({tagName:"div",properties:{"data-gutter":""},children:e})}function qi(e,t,n,i={}){return F({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...i},children:t!=null?[F({tagName:"span",properties:{"data-line-number-content":""},children:[Ce(`${t}`)]})]:void 0})}function oe(e,t,n){return F({tagName:"div",properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t==="annotation"?void 0:e,style:t==="annotation"?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function Ko(){return F({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[Wt({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}function Yo(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function bt(e){for(const t of e)if(t instanceof HTMLElement&&(t.hasAttribute("data-utility-button")||t.hasAttribute("data-gutter-utility-slot")||t.getAttribute("slot")==="gutter-utility-slot"||t.getAttribute("name")==="gutter-utility-slot"))return!0;return!1}var Ki=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:"idle"};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener("click",this.handlePointerClick),this.pre?.removeEventListener("pointerdown",this.handlePointerDown),this.pre?.removeEventListener("pointermove",this.handlePointerMove),this.pre?.removeEventListener("pointerleave",this.handlePointerLeave),this.pre?.removeAttribute("data-interactive-lines"),this.pre?.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),Bt(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();const{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode==="gutterSelecting"&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){const n=!(e===this.selectedRange||mn(e??void 0,this.selectedRange??void 0)),i=t?.lineNumberOnly??!1,r=t?.activeLineSide!==this.selectedRangeHighlightSide||i!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!n&&!r||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=i,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){const i=e!==this.editorActiveLine,r=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!i&&!r||(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{const e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode==="diff"&&e.type==="diff-line")return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode==="file"&&e.type==="line")return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{const{onHunkExpand:t,onLineClick:n,onLineNumberClick:i,onTokenClick:r,onMergeConflictActionClick:o}=this.options;t==null&&n==null&&i==null&&o==null&&r==null||this.options.onGutterUtilityClick!=null&&bt(e.composedPath())||(xe(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))};handlePointerMove=e=>{if(e.pointerType!=="mouse")return;const{lineHoverHighlight:t="disabled",onLineEnter:n,onLineLeave:i,onTokenEnter:r,onTokenLeave:o,enableGutterUtility:s=!1}=this.options;t==="disabled"&&!s&&n==null&&i==null&&r==null&&o==null||(xe(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))};handlePointerLeave=e=>{const{__debugPointerEvents:t}=this.options;if(xe(t,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){xe(t,"move","FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token");return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){const{__debugPointerEvents:n}=this.options,i=t.composedPath();xe(n,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:i});const r=this.resolvePointerTarget(i);xe(n,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",r);const{onLineClick:o,onLineNumberClick:s,onLineEnter:l,onLineLeave:a,onTokenClick:h,onTokenEnter:d,onTokenLeave:c,onHunkExpand:u,onMergeConflictActionClick:p}=this.options;switch(e){case"move":{const g=sn(r)&&this.hoveredLine?.lineElement===r.lineElement;Pt(r)&&this.hoveredToken?.tokenElement===r.tokenElement||(this.hoveredToken!=null&&(c?.(this.hoveredToken,t),this.clearHoveredToken()),Pt(r)&&(this.setHoveredToken(this.toTokenEventBaseProps(r)),d?.(this.hoveredToken,t))),g||(this.hoveredLine!=null&&(a?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),sn(r)?(this.setHoveredLine(this.toEventBaseProps(r)),this.placeUtility(),l?.({...this.hoveredLine,event:t})):this.placeUtility());break}case"click":{if(r==null)break;if(Zo(r)&&p!=null){p(r);break}if(Xo(r)&&u!=null){u(r.hunkIndex,r.all||t.shiftKey?"both":r.direction,r.all||t.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!sn(r))break;Pt(r)&&h!=null&&h(this.toTokenEventBaseProps(r),t);const g=this.toEventBaseProps(r);s!=null&&r.numberColumn?s({...g,event:t}):o?.({...g,event:t});break}}}syncPointerListeners(e){const{__debugPointerEvents:t,lineHoverHighlight:n="disabled",onLineClick:i,onLineNumberClick:r,onLineEnter:o,onLineLeave:s,onTokenClick:l,onTokenEnter:a,onTokenLeave:h,onHunkExpand:d,onMergeConflictActionClick:c,enableGutterUtility:u=!1,enableLineSelection:p=!1,onGutterUtilityClick:g}=this.options,S=g!=null,C=n!=="disabled"||i!=null||r!=null||o!=null||s!=null||l!=null||a!=null||h!=null||d!=null||c!=null||u||p||S;C&&!this.hasPointerListeners?(e.addEventListener("click",this.handlePointerClick),e.addEventListener("pointerdown",this.handlePointerDown),e.addEventListener("pointermove",this.handlePointerMove),e.addEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!0,xe(t,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{const m=[];return(t==="both"||t==="click")&&(i!=null&&m.push("onLineClick"),r!=null&&m.push("onLineNumberClick"),d!=null&&m.push("expandable hunk separators"),c!=null&&m.push("merge conflict actions")),m})()),xe(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),xe(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")):!C&&this.hasPointerListeners&&(e.removeEventListener("click",this.handlePointerClick),e.removeEventListener("pointerdown",this.handlePointerDown),e.removeEventListener("pointermove",this.handlePointerMove),e.removeEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!1);const b=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",f=this.pointerSession.mode==="gutterSelecting";(!p&&b||!S&&f)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;const{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,i=e!=null,r=t!=null||n;i&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!i&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),r&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!r&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType==="mouse"&&e.button!==0||this.pre==null||this.pointerSession.mode!=="idle")return;const t=e.composedPath();bt(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!=="mouse"&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){const{enableLineSelection:t=!1}=this.options;if(!t)return;const n=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(n==null)return;const{pre:i}=this;if(i==null)return;const{lineNumber:r,eventSide:o,lineIndex:s}=n;if(e.shiftKey&&this.selectedRange!=null){const l=this.getIndexesFromSelection(this.selectedRange,i.getAttribute("data-diff-type")==="split");if(l==null)return;const a=l.start<=l.end?s>=l.start:s<=l.end;this.selectionAnchor={lineNumber:a?this.selectedRange.start:this.selectedRange.end,side:a?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===r&&this.selectedRange?.end===r){const l={lineNumber:r,side:o};this.selectionAnchor=l,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:l,pending:l},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:r,side:o},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){const{onGutterUtilityClick:t}=this.options;if(t==null)return;const n=this.currentSelectionEnds(),i=n?.bottom??this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),r=n?.top??i;i==null||r==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:r,current:i},this.selectionAnchor={lineNumber:r.lineNumber,side:r.side},this.updateSelection(i.lineNumber,i.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionPoint(e,{source:"coordinates-first"});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case"pendingSingleLineUnselect":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;const n={lineNumber:t.lineNumber,side:t.eventSide};if(Yo(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{const{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{const{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();const i=this.resolveSelectionPoint(e,{source:"coordinates-first"});i!=null&&(n.current=i,this.updateSelection(i.lineNumber,i.side));const r=this.buildSelectedLineRange(n.anchor,n.current);t?.({...r}),this.selectionAnchor=void 0,this.notifySelectionEnd(r),this.notifySelectionCommitted(r),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case"pendingSingleLineUnselect":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case"selecting":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":case"selecting":case"pendingSingleLineUnselect":if("pointerId"in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0)}setHoveredLine(e){const{lineHoverHighlight:t="disabled"}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!=="disabled"&&((t==="both"||t==="line")&&this.hoveredLine.lineElement.setAttribute("data-hovered",""),(t==="both"||t==="number")&&this.hoveredLine.numberElement.setAttribute("data-hovered",""))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer==null&&(this.gutterUtilityContainer=document.createElement("div"),this.gutterUtilityContainer.setAttribute("data-gutter-utility-slot","")),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot==null&&(this.gutterUtilitySlot=document.createElement("slot"),this.gutterUtilitySlot.name="gutter-utility-slot"),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){const t=document.createElement("div");t.innerHTML=te(Ko());const n=t.firstElementChild;if(!(n instanceof HTMLButtonElement))throw new Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");n.remove(),this.gutterUtilityButton=n}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;const t=this.resolvePointerTarget(e);nt(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){const e=this.currentSelectionEnds();if(e==null)return!1;const t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){const e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){const t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},i=this.selectionPointRowIndex(t),r=this.selectionPointRowIndex(n);if(!(i==null||r==null))return i>r?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){const t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;const t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;const n=this.mode==="diff"?`${t[0]},${t[1]}`:`${t[0]}`,i=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(const r of i){if(!(r instanceof HTMLElement))continue;const o=this.resolvePointerTarget(St(r));if(nt(o)&&!(this.mode==="diff"&&e.side!=null&&o.side!==e.side))return o}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){this.pointerSession.mode==="pendingSingleLineUnselect"&&(this.pointerSession={mode:"idle"})}selectionInfoFromPath(e,t){const n=this.resolvePointerTarget(e);if(nt(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode==="diff"?n.side:void 0}}resolveSelectionInfo(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionInfoFromPath(n,t.requireNumberColumn):void 0}selectionPointFromPath(e){const t=this.resolvePointerTarget(e);if(nt(t))return{lineNumber:t.lineNumber,side:this.mode==="diff"?t.side:void 0}}resolveSelectionPoint(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionPointFromPath(n):void 0}resolveSelectionPath(e,t){const n=t.excludeUtility!==!1;switch(t.source){case"event-path":return this.pathFromEventPath(e.composedPath(),n);case"coordinates-first":{const i=this.pathFromCoordinates(e,n);return i!==void 0?i??void 0:this.pathFromEventPath(e.composedPath(),n)}}}pathFromCoordinates(e,t){const n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&bt(e))){for(const n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){const n=St(e);if(t&&bt(n))return;const i=es(e);return i!=null?St(i):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){const t=ns(ts(e));if(t==null)return;const n=this.targetForSelectionPoint(t);return n!=null?St(n.lineElement):void 0}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;const t=this.pre?.getRootNode(),n=Xn(t)?t:Xn(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){const{getLineIndex:n}=this.options;return n!=null?n(e,t):[e-1,e-1]}getCurrentSelectionRange(){return this.proposedSelectedRange!==void 0?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){const i=this.getCurrentSelectionRange();let r;if(e==null)r=null;else{const o=this.selectionAnchor?.side??t,s=this.selectionAnchor?.lineNumber??e;r=this.buildSelectionRange(s,e,o,t)}mn(i??void 0,r??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=r:(this.selectedRange=r,Q(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;const n=this.getLineIndex(e.start,e.side),i=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&i!=null?{start:t?n[1]:n[0],end:t?i[1]:i[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;const i=this.getIndexesFromSelection(e.range,t);if(i==null)throw console.error({rowRange:i,range:e.range}),new Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return i}getLineRenderColumns(e,t,n,i){if(this.pre==null||t==null&&i==null)return[];const{children:r}=this.pre;if(r.length>2)throw console.error(r),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");const o=[];for(const s of r){const l=s.hasAttribute("data-deletions")?"deletions":s.hasAttribute("data-additions")?"additions":void 0,a=e!=null&&t!=null&&(e.highlightSide==null||l==null||e.highlightSide===l),h=n!=null&&i!=null&&(n.highlightSide==null||l==null||n.highlightSide===l);if(!a&&!h)continue;const[d,c]=s.children;if(!(d instanceof HTMLElement)||!(c instanceof HTMLElement))throw new Error("InteractionManager.renderSelection: missing gutter or content element");if(c.children.length!==d.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");o.push({content:c,gutter:d,renderEditorActiveLine:h,renderSelectedLines:a})}return o}renderSelection=()=>{Bt(this.renderSelection);const e=this.getSelectionRenderState();if(this.pre==null)return;const{editorActiveLine:t,selectedLines:n}=e,i=!Zn(this.renderedSelectedLinesState,n),r=!Zn(this.renderedEditorActiveLineState,t);if(!i&&!r)return;i&&(this.renderedSelectedLinesState=void 0),r&&(this.renderedEditorActiveLineState=void 0);const o=this.pre.getAttribute("data-diff-type")==="split",s=i?this.resolveLineRenderRange(n,o,"selected-lines"):void 0,l=r?this.resolveLineRenderRange(t,o,"editor-active-line"):void 0,a=this.getLineRenderColumns(i?n:void 0,s,r?t:void 0,l),h=n.range==null||a.some(S=>S.renderSelectedLines),d=t.range==null||a.some(S=>S.renderEditorActiveLine);if(i)for(const S of this.pre.querySelectorAll("[data-selected-line]"))S.removeAttribute("data-selected-line");if(r)for(const S of this.pre.querySelectorAll("[data-editor-active-line]"))S.removeAttribute("data-editor-active-line");const c=s==null?void 0:Math.min(s.start,s.end),u=s==null?void 0:Math.max(s.start,s.end),p=c===u,g=l?.start;for(const S of a){const{content:C,gutter:b,renderEditorActiveLine:f,renderSelectedLines:m}=S,y=Math.max(m?u??-1/0:-1/0,f?g??-1/0:-1/0),v=C.children.length;for(let k=0;k<v;k++){const x=C.children[k],T=b.children[k];if(!(x instanceof HTMLElement)||!(T instanceof HTMLElement))continue;const L=this.parseLineIndex(x,o);if((L??0)>y)break;if(L!=null){if(m&&c!=null&&u!=null&&L>=c&&L<=u){let A=p?"single":L===c?"first":L===u?"last":"";T.setAttribute("data-selected-line",A),n.lineNumberOnly||(x.setAttribute("data-selected-line",A),T.nextSibling instanceof HTMLElement&&x.nextSibling instanceof HTMLElement&&(x.nextSibling.hasAttribute("data-line-annotation")||x.nextSibling.hasAttribute("data-merge-conflict-actions"))&&(p?(A="last",x.setAttribute("data-selected-line","first")):L===c?A="":L===u&&x.setAttribute("data-selected-line",""),x.nextSibling.setAttribute("data-selected-line",A),T.nextSibling.setAttribute("data-selected-line",A)))}f&&L===g&&(T.setAttribute("data-editor-active-line",""),t.lineNumberOnly||x.setAttribute("data-editor-active-line",""))}}}i&&h&&(this.renderedSelectedLinesState=n),r&&d&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode==="file"?{type:"line",lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:"diff-line",annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:i,tokenElement:r,tokenText:o}){return this.mode==="file"?{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:r,tokenText:o}:{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,side:i,tokenElement:r,tokenText:o}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,i){return{start:e,end:t,...n!=null?{side:n}:{},...n!==i&&i!=null?{endSide:i}:{}}}resolvePointerTarget(e){let t=!1,n,i,r,o,s,l,a,h,d,c;for(const p of e){if(!(p instanceof HTMLElement))continue;if(c==null&&p.hasAttribute("data-merge-conflict-action")){const b=p.getAttribute("data-merge-conflict-action")??void 0,f=p.getAttribute("data-merge-conflict-conflict-index")??void 0,m=f!=null?Number.parseInt(f,10):NaN;Jo(b)&&Number.isFinite(m)&&(c={kind:"merge-conflict-action",resolution:b,conflictIndex:m})}if(l==null&&p.hasAttribute("data-char")){l=p;const b=p.getAttribute("data-char");if(b!=null){const f=Number.parseInt(b,10);if(!Number.isNaN(f)){const m=p.textContent??"",y=f+m.length;(m.trim()!==""||this.options.enableTokenInteractionsOnWhitespace===!0)&&(a={tokenElement:l,lineCharStart:f,lineCharEnd:y,tokenText:m});continue}}}const g=s==null?p.getAttribute("data-column-number")??void 0:void 0;if(g!=null){s=p,d=Number.parseInt(g,10),t=!0,n=ei(p),o=p.getAttribute("data-line-index")??void 0;continue}const S=r==null?p.getAttribute("data-line")??void 0:void 0;if(S!=null){r=p,d=Number.parseInt(S,10),n=ei(p),o=p.getAttribute("data-line-index")??void 0;continue}if(h==null&&(p.hasAttribute("data-expand-button")||p.hasAttribute("data-unmodified-lines"))){h={hunkIndex:void 0,direction:p.hasAttribute("data-expand-up")?"up":p.hasAttribute("data-expand-down")?"down":"both",all:p.hasAttribute("data-expand-all-button")};continue}const C=h!=null?p.getAttribute("data-expand-index")??void 0:void 0;if(h!=null&&C!=null){const b=Number.parseInt(C,10);Number.isNaN(b)||(h.hunkIndex=b);continue}if(i==null&&p.hasAttribute("data-code")){i=p;break}}if(c!=null)return c;if(h?.hunkIndex!=null)return{type:"line-info",hunkIndex:h.hunkIndex,direction:h.direction,all:h.all};if(r??=o!=null?Qn(i,`[data-line][data-line-index="${o}"]`):void 0,s??=o!=null?Qn(i,`[data-column-number][data-line-index="${o}"]`):void 0,i==null||r==null||s==null||n==null||d==null||Number.isNaN(d))return;const u=this.parseLineIndex(r,this.isSplitDiff());return a!=null?this.mode==="file"?{kind:"token",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:void 0,splitLineIndex:u,...a}:{kind:"token",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:Jn(n,i),splitLineIndex:u,...a}:this.mode==="file"?{kind:"line",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:void 0,splitLineIndex:u}:{kind:"line",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:Jn(n,i),splitLineIndex:u}}isSplitDiff(){return this.pre?.getAttribute("data-diff-type")==="split"}parseLineIndex(e,t){const n=(e.getAttribute("data-line-index")??"").split(",").map(i=>Number.parseInt(i,10)).filter(i=>!Number.isNaN(i));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Gt({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:i,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:h,onTokenLeave:d,renderGutterUtility:c,__debugPointerEvents:u,enableLineSelection:p,controlledSelection:g,onLineSelected:S,onLineSelectionStart:C,onLineSelectionChange:b,onLineSelectionEnd:f},m,y,v){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:Qo({enableGutterUtility:t,renderGutterUtility:c,onGutterUtilityClick:i}),usesCustomGutterUtility:c!=null,lineHoverHighlight:n,onGutterUtilityClick:i,onHunkExpand:m,onMergeConflictActionClick:v,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:h,onTokenLeave:d,__debugPointerEvents:u,enableLineSelection:p,controlledSelection:g,onLineSelected:S,onLineSelectionStart:C,onLineSelectionChange:b,onLineSelectionEnd:f,getLineIndex:y}}function Qo({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw new Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return e??!1}function nt(e){return e!=null&&"kind"in e&&e.kind==="line"}function Pt(e){return e!=null&&"kind"in e&&e.kind==="token"}function sn(e){return nt(e)||Pt(e)}function Xo(e){return"type"in e&&e.type==="line-info"}function Zo(e){return"kind"in e&&e.kind==="merge-conflict-action"}function Jo(e){return e==="current"||e==="incoming"||e==="both"}function Qn(e,t){const n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function St(e){const t=[];let n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function es(e){const t=e.closest("[data-line], [data-column-number]");if(t instanceof HTMLElement)return t;const n=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(n instanceof HTMLElement))return;const i=n.previousElementSibling;return i instanceof HTMLElement&&(i.hasAttribute("data-line")||i.hasAttribute("data-column-number"))?i:void 0}function ts(e){const t=e.closest('[slot^="annotation-"]');if(t instanceof HTMLElement)return t.getAttribute("slot")??void 0;if(e instanceof HTMLElement){const n=e.getAttribute("name")??void 0;return n!=null&&n.startsWith("annotation-")?n:void 0}}function ns(e){if(e==null)return;const t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;const n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function Xn(e){return e!=null&&typeof e.elementFromPoint=="function"}function is(e,t){return e===t||mn(e??void 0,t??void 0)}function Zn(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&is(e?.range??null,t.range)}function Jn(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function ei(e){const t=e.getAttribute("data-line-type");if(t!=null)switch(t){case"change-deletion":case"change-addition":case"context":case"context-expanded":return t;default:return}}function xe(e="none",t,...n){switch(e){case"none":return;case"both":break;case"click":if(t!=="click")return;break;case"move":if(t!=="move")return;break}console.log(...n)}var Yi=class ke{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){const t=ke.resizeObserver??new ResizeObserver(ke.handleSharedResizeEntries);return ke.resizeObserver=t,t}static handleSharedResizeEntries(t){const n=new Map;for(const i of t){const r=ke.managersByElement.get(i.target);if(r==null)continue;const o=n.get(r);o==null?n.set(r,[i]):o.push(i)}for(const[i,r]of n)i.handleResizeEntries(r)}observedNodes=new Map;setup(t,{disableAnnotations:n,columnVariables:i="apply"}){const r=new Set,o=i==="apply";let s=0;const l=new Map(this.observedNodes);this.observedNodes.clear();for(const a of t.children){if(s===2)break;const h=(()=>{if(a instanceof HTMLElement&&a.tagName==="CODE")return a})();if(h==null)continue;s++;let d=l.get(h);if(d!=null&&d.type!=="code")throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let c=h.firstElementChild;c instanceof HTMLElement||(c=null),d!=null?(this.observedNodes.set(h,d),l.delete(h),d.numberElement!==c?(d.numberElement!=null&&(this.unobserve(d.numberElement),l.delete(d.numberElement)),c!=null&&(this.observe(c),l.delete(c),this.observedNodes.set(c,d)),d.numberElement=c,d.numberWidth=0):d.numberElement!=null?(l.delete(d.numberElement),this.observedNodes.set(d.numberElement,d)):d.numberWidth=0,ss(d,o)):(d={type:"code",codeElement:h,numberElement:c,codeWidth:"auto",numberWidth:0,applyColumnVariables:o},this.observedNodes.set(h,d),this.observe(h),c!=null&&(this.observedNodes.set(c,d),this.observe(c)))}if(s>1&&!n){const a=t.querySelectorAll('[data-line-annotation*=","]'),h=new Map;for(const d of a){if(!(d instanceof HTMLElement))continue;const c=d.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(c)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:c,element:d});continue}let u=h.get(c);u==null&&(u=[],h.set(c,u)),u.push(d)}for(const[d,c]of h){if(c.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",d,c);continue}const[u,p]=c,g=u.firstElementChild,S=p.firstElementChild;if(!(u instanceof HTMLElement)||!(p instanceof HTMLElement)||!(g instanceof HTMLElement)||!(S instanceof HTMLElement))continue;let C=l.get(g);if(C!=null){this.observedNodes.set(g,C),this.observedNodes.set(S,C),l.delete(g),l.delete(S);continue}const b=g.getBoundingClientRect().height,f=S.getBoundingClientRect().height;C={type:"annotations",column1:{container:u,child:g,childHeight:b},column2:{container:p,child:S,childHeight:f},currentHeight:"auto"},r.add({child1:g,child2:S,item:C,newHeight:Math.max(b,f)})}for(const d of r)this.applyNewHeight(d.item,d.newHeight),this.observedNodes.set(d.child1,d.item),this.observedNodes.set(d.child2,d.item),this.observe(d.child1),this.observe(d.child2);r.clear()}for(const[a,h]of l)this.unobserve(a),h.type==="code"?as(h):ls(h);l.clear()}cleanUp(){for(const t of this.observedNodes.keys())this.unobserve(t);this.observedNodes.clear()}observe(t){const{managersByElement:n}=ke,i=n.get(t);if(i!==this){if(i!=null&&i!==this)throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");n.set(t,this),ke.getResizeObserver().observe(t)}}unobserve(t){const{managersByElement:n,resizeObserver:i}=ke,r=n.get(t);if(r!=null){if(r!==this)throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");n.delete(t),i?.unobserve(t),i!=null&&n.size===0&&(i.disconnect(),ke.resizeObserver=void 0)}}handleResizeEntries(t){const n=new Map,i=new Set;for(const r of t){const{target:o,borderBoxSize:s,contentBoxSize:l}=r;if(!(o instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",r);continue}const a=this.observedNodes.get(o);if(a==null){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",r);continue}if(a.type==="annotations"){const h=(()=>{if(o===a.column1.child)return a.column1;if(o===a.column2.child)return a.column2})();if(h==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:a,target:o});continue}h.childHeight=s[0].blockSize,i.add(a)}else if(a.type==="code"){const h=n.get(a)??{},d=l[0].inlineSize;o===a.codeElement?h.codeInlineSize=d:o===a.numberElement&&(h.numberInlineSize=d),n.set(a,h)}}this.applyAnnotationUpdates(i),i.clear(),this.applyColumnUpdates(n),n.clear()}applyAnnotationUpdates(t){for(const n of t)this.applyNewHeight(n,Math.max(n.column1.childHeight,n.column2.childHeight))}applyColumnUpdates=t=>{for(const[n,i]of t){const r=i.codeInlineSize!=null?rs(i.codeInlineSize):n.codeWidth,o=i.numberInlineSize!=null?os(i.numberInlineSize):n.numberWidth,s=r!==n.codeWidth,l=o!==n.numberWidth;!s&&!l||(n.codeWidth=r,n.numberWidth=o,n.applyColumnVariables&&Qi(n,{codeWidthChanged:s,numberWidthChanged:l}))}};applyNewHeight(t,n){n!==t.currentHeight&&(t.currentHeight=Math.max(n,0),t.column1.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`),t.column2.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`))}};function rs(e){const t=Math.max(Math.floor(e),0);return t===0?"auto":t}function os(e){return Math.max(Math.ceil(e),0)}function ss(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?Qi(e,{codeWidthChanged:!0,numberWidthChanged:!0}):Xi(e))}function Qi(e,{codeWidthChanged:t,numberWidthChanged:n}){const{codeElement:i,codeWidth:r,numberWidth:o}=e;if(t&&i.style.setProperty("--diffs-column-width",`${typeof r=="number"?`${r}px`:"auto"}`),n&&i.style.setProperty("--diffs-column-number-width",`${o===0?"auto":`${o}px`}`),t||n&&r!=="auto"){const s=typeof r=="number"?Math.max(r-o,0):0;i.style.setProperty("--diffs-column-content-width",`${s>0?`${s}px`:"auto"}`)}}function Xi(e){e.codeElement.style.removeProperty("--diffs-column-content-width"),e.codeElement.style.removeProperty("--diffs-column-number-width"),e.codeElement.style.removeProperty("--diffs-column-width")}function as(e){e.codeElement.isConnected&&Xi(e)}function ls(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty("--diffs-annotation-min-height"),e.column2.container.isConnected&&e.column2.container.style.removeProperty("--diffs-annotation-min-height")}const lt=new Map,an=new Map,ds=new Map,vn=new Set;function jt(e){for(const t of Array.isArray(e)?e:[e])if(!(t==="text"||t==="ansi")&&!vn.has(t))return!1;return!0}function ti(e,t){e=Array.isArray(e)?e:[e];for(const n of e){if(vn.has(n.name))continue;let i=lt.get(n.name);i==null&&(i=n,lt.set(n.name,i)),vn.add(i.name),t.loadLanguageSync(i.data)}}function Zi(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}async function hs(e){if(Zi())throw new Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);const t=an.get(e);if(t!=null)return t;try{let n=ds.get(e);if(n==null&&Object.prototype.hasOwnProperty.call(jn,e)&&(n=jn[e]),n==null)throw new Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);const i=n().then(({default:r})=>{const o={name:e,data:r};return lt.has(e)||lt.set(e,o),o});return an.set(e,i),await i}finally{an.delete(e)}}function cs(e){return lt.get(e)??hs(e)}const bn=new Set;function dt(e){const t=[],n=new Set;for(const c of us(e.themes)){const u=Ji(c)?c.getThemes():[c];for(const p of u){if(n.has(p.name))throw new Error(`Theme collection already contains theme "${p.name}"`);n.add(p.name),t.push(p)}}const i=Object.freeze([...t]),r=Object.freeze(i.filter(c=>c.colorScheme==="light")),o=Object.freeze(i.filter(c=>c.colorScheme==="dark")),s=new Map(i.map(c=>[c.name,c])),l=Object.freeze(i.map(c=>c.name)),a=Object.freeze(r.map(c=>c.name)),h=Object.freeze(o.map(c=>c.name));function d(c){if(c==null)return i;const{colorScheme:u,collection:p}=c;return p==null?u==="light"?r:u==="dark"?o:i:i.filter(g=>g.collection!==p?!1:u==null||g.colorScheme===u)}return{getTheme(c){return s.get(c)},getThemes(c){return d(c)},getThemeNames(c){return c?.collection==null?c?.colorScheme==="light"?a:c?.colorScheme==="dark"?h:l:d(c).map(u=>u.name)},hasTheme(c){return s.has(c)},orderBy(c){return dt({themes:i.map((u,p)=>({descriptor:u,index:p})).sort((u,p)=>{const g=c(u.descriptor,p.descriptor);return g!==0?g:u.index-p.index}).map(u=>u.descriptor)})},pick(c){const u=[],p=new Set;for(const g of c){if(p.has(g))throw new Error(`Theme collection pick already includes theme "${g}"`);p.add(g);const S=s.get(g);if(S==null)throw new Error(`Theme collection does not contain theme "${g}"`);u.push(S)}return dt({themes:u})},registerInto(c){for(const u of i)c.registerThemeIfAbsent(u.name,u.load)}}}function us(e){return fs(e)?[e]:e}function fs(e){return Ji(e)||ps(e)}function ps(e){return typeof e.name=="string"&&typeof e.load=="function"}function Ji(e){return typeof e.getThemes=="function"}function er(e){return e!==null&&typeof e=="object"&&"default"in e?e.default:e}var gs=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name="DuplicateThemeError"}},ms=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name="UnregisteredThemeError"}},vs=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name="UnresolvedThemeError"}};function bs(){const e=new Map,t=new Map,n=new Map;let i=0;function r(b,f){if(e.has(b))throw new gs(b);e.set(b,f)}function o(b,f){return e.has(b)?!1:(e.set(b,f),!0)}function s(b){return e.has(b)}function l(b){const f=t.get(b);if(f!==void 0)return Promise.resolve(f);const m=n.get(b);if(m!==void 0)return m;const y=e.get(b);if(y===void 0)return Promise.reject(new ms(b));const v=i,k=y().then(x=>{const T=er(x);return v===i&&t.set(b,T),n.get(b)===k&&n.delete(b),T}).catch(x=>{throw n.get(b)===k&&n.delete(b),x});return n.set(b,k),k}function a(b){return Promise.all(b.map(f=>l(f)))}function h(b,f){t.set(b,f)}function d(b){for(const[f,m]of b)h(f,m)}function c(b){return t.get(b)}function u(b){const f=[];for(const m of b){const y=t.get(m);if(y===void 0)throw new vs(m);f.push(y)}return f}function p(b){return t.has(b)}function g(b){for(const f of b)if(!t.has(f))return!1;return!0}function S(b){const f=t.get(b);return f!==void 0?f:l(b)}function C(){i++,t.clear(),n.clear()}return{clearResolvedThemes:C,getResolvedOrResolveTheme:S,getResolvedTheme:c,getResolvedThemes:u,hasRegisteredTheme:s,hasResolvedTheme:p,hasResolvedThemes:g,registerTheme:r,registerThemeIfAbsent:o,resolveTheme:l,resolveThemes:a,seedResolvedTheme:h,seedResolvedThemes:d}}const we=bs();function ni(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let i;if(typeof n=="string"){if(i=we.getResolvedTheme(n),i==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else i=n,n=n.name,we.getResolvedTheme(n)==null&&we.seedResolvedTheme(n,i);bn.has(n)||(bn.add(n),t.loadThemeSync(i))}}function tr({name:e,load:t,colorScheme:n,collection:i,displayName:r}){return{name:e,colorScheme:n,collection:i,displayName:r,load:Ss(t)}}function Ss(e){return async()=>Do(er(await e()))}const ys="pierre",Cs=["pierre-dark","pierre-dark-soft","pierre-dark-vibrant","pierre-dark-protanopia-deuteranopia","pierre-dark-tritanopia"],nr=["pierre-light","pierre-light-soft","pierre-light-vibrant","pierre-light-protanopia-deuteranopia","pierre-light-tritanopia"],xs=[...nr,...Cs],Ls=new Set(nr);function ks(e){return Ls.has(e)?"light":"dark"}const ws={"pierre-dark":"Pierre Dark","pierre-dark-soft":"Pierre Dark Soft","pierre-dark-vibrant":"Pierre Dark Vibrant","pierre-dark-protanopia-deuteranopia":"Pierre Dark Protanopia & Deuteranopia","pierre-dark-tritanopia":"Pierre Dark Tritanopia","pierre-light":"Pierre Light","pierre-light-soft":"Pierre Light Soft","pierre-light-vibrant":"Pierre Light Vibrant","pierre-light-protanopia-deuteranopia":"Pierre Light Protanopia & Deuteranopia","pierre-light-tritanopia":"Pierre Light Tritanopia"},Es={"pierre-dark":()=>E(()=>import("./pierre-dark-CyvmCCZW.js"),[],import.meta.url),"pierre-dark-soft":()=>E(()=>import("./pierre-dark-soft-BHGpRqa4.js"),[],import.meta.url),"pierre-dark-vibrant":()=>E(()=>import("./pierre-dark-vibrant-BWBVywrn.js"),[],import.meta.url),"pierre-dark-protanopia-deuteranopia":()=>E(()=>import("./pierre-dark-protanopia-deuteranopia-Rgc0TwpF.js"),[],import.meta.url),"pierre-dark-tritanopia":()=>E(()=>import("./pierre-dark-tritanopia-Beq2gCRQ.js"),[],import.meta.url),"pierre-light":()=>E(()=>import("./pierre-light-480U9XYS.js"),[],import.meta.url),"pierre-light-soft":()=>E(()=>import("./pierre-light-soft-CVdyfjmI.js"),[],import.meta.url),"pierre-light-vibrant":()=>E(()=>import("./pierre-light-vibrant-DdTDNdfJ.js"),[],import.meta.url),"pierre-light-protanopia-deuteranopia":()=>E(()=>import("./pierre-light-protanopia-deuteranopia-CaVOBURG.js"),[],import.meta.url),"pierre-light-tritanopia":()=>E(()=>import("./pierre-light-tritanopia-B4_gpKOM.js"),[],import.meta.url)};function Rs(e){return tr({name:e,collection:ys,colorScheme:ks(e),displayName:ws[e],load:Es[e]})}const ir=dt({themes:xs.map(e=>Rs(e))}),Ts="shiki",rr=["ayu-light","catppuccin-latte","everforest-light","github-light","github-light-default","github-light-high-contrast","gruvbox-light-hard","gruvbox-light-medium","gruvbox-light-soft","horizon-bright","kanagawa-lotus","light-plus","material-theme-lighter","min-light","night-owl-light","one-light","rose-pine-dawn","slack-ochin","snazzy-light","solarized-light","vitesse-light"],As=["andromeeda","aurora-x","ayu-dark","ayu-mirage","catppuccin-frappe","catppuccin-macchiato","catppuccin-mocha","dark-plus","dracula","dracula-soft","everforest-dark","github-dark","github-dark-default","github-dark-dimmed","github-dark-high-contrast","gruvbox-dark-hard","gruvbox-dark-medium","gruvbox-dark-soft","horizon","houston","kanagawa-dragon","kanagawa-wave","laserwave","material-theme","material-theme-darker","material-theme-ocean","material-theme-palenight","min-dark","monokai","night-owl","nord","one-dark-pro","plastic","poimandres","red","rose-pine","rose-pine-moon","slack-dark","solarized-dark","synthwave-84","tokyo-night","vesper","vitesse-black","vitesse-dark"],Hs=new Set(rr);function Ms(e){return Hs.has(e)?"light":"dark"}const Is={andromeeda:()=>E(()=>import("./andromeeda-C4gqWexZ.js"),[],import.meta.url),"aurora-x":()=>E(()=>import("./aurora-x-D-2ljcwZ.js"),[],import.meta.url),"ayu-dark":()=>E(()=>import("./ayu-dark-DYE7WIF3.js"),[],import.meta.url),"ayu-light":()=>E(()=>import("./ayu-light-BA47KaF1.js"),[],import.meta.url),"ayu-mirage":()=>E(()=>import("./ayu-mirage-32ctXXKs.js"),[],import.meta.url),"catppuccin-frappe":()=>E(()=>import("./catppuccin-frappe-CZL1YF0i.js"),[],import.meta.url),"catppuccin-latte":()=>E(()=>import("./catppuccin-latte-DH-8KZSZ.js"),[],import.meta.url),"catppuccin-macchiato":()=>E(()=>import("./catppuccin-macchiato-B7yYVSCf.js"),[],import.meta.url),"catppuccin-mocha":()=>E(()=>import("./catppuccin-mocha-Ct7hS0mc.js"),[],import.meta.url),"dark-plus":()=>E(()=>import("./dark-plus-C3mMm8J8.js"),[],import.meta.url),dracula:()=>E(()=>import("./dracula-BzJJZx-M.js"),[],import.meta.url),"dracula-soft":()=>E(()=>import("./dracula-soft-BXkSAIEj.js"),[],import.meta.url),"everforest-dark":()=>E(()=>import("./everforest-dark-BgDCqdQA.js"),[],import.meta.url),"everforest-light":()=>E(()=>import("./everforest-light-C8M2exoo.js"),[],import.meta.url),"github-dark":()=>E(()=>import("./github-dark-DHJKELXO.js"),[],import.meta.url),"github-dark-default":()=>E(()=>import("./github-dark-default-Cuk6v7N8.js"),[],import.meta.url),"github-dark-dimmed":()=>E(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[],import.meta.url),"github-dark-high-contrast":()=>E(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[],import.meta.url),"github-light":()=>E(()=>import("./github-light-DAi9KRSo.js"),[],import.meta.url),"github-light-default":()=>E(()=>import("./github-light-default-D7oLnXFd.js"),[],import.meta.url),"github-light-high-contrast":()=>E(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[],import.meta.url),"gruvbox-dark-hard":()=>E(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[],import.meta.url),"gruvbox-dark-medium":()=>E(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[],import.meta.url),"gruvbox-dark-soft":()=>E(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[],import.meta.url),"gruvbox-light-hard":()=>E(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[],import.meta.url),"gruvbox-light-medium":()=>E(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[],import.meta.url),"gruvbox-light-soft":()=>E(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[],import.meta.url),horizon:()=>E(()=>import("./horizon-BUw7H-hv.js"),[],import.meta.url),"horizon-bright":()=>E(()=>import("./horizon-bright-CUuTKBJd.js"),[],import.meta.url),houston:()=>E(()=>import("./houston-DnULxvSX.js"),[],import.meta.url),"kanagawa-dragon":()=>E(()=>import("./kanagawa-dragon-BuwD2xS4.js"),[],import.meta.url),"kanagawa-lotus":()=>E(()=>import("./kanagawa-lotus-C3DzagqV.js"),[],import.meta.url),"kanagawa-wave":()=>E(()=>import("./kanagawa-wave-DFGoQZhC.js"),[],import.meta.url),laserwave:()=>E(()=>import("./laserwave-DUszq2jm.js"),[],import.meta.url),"light-plus":()=>E(()=>import("./light-plus-B7mTdjB0.js"),[],import.meta.url),"material-theme":()=>E(()=>import("./material-theme-D5KoaKCx.js"),[],import.meta.url),"material-theme-darker":()=>E(()=>import("./material-theme-darker-BfHTSMKl.js"),[],import.meta.url),"material-theme-lighter":()=>E(()=>import("./material-theme-lighter-B0m2ddpp.js"),[],import.meta.url),"material-theme-ocean":()=>E(()=>import("./material-theme-ocean-CyktbL80.js"),[],import.meta.url),"material-theme-palenight":()=>E(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[],import.meta.url),"min-dark":()=>E(()=>import("./min-dark-CafNBF8u.js"),[],import.meta.url),"min-light":()=>E(()=>import("./min-light-CTRr51gU.js"),[],import.meta.url),monokai:()=>E(()=>import("./monokai-BRVnQi9A.js"),[],import.meta.url),"night-owl":()=>E(()=>import("./night-owl-C39BiMTA.js"),[],import.meta.url),"night-owl-light":()=>E(()=>import("./night-owl-light-CMTm3GFP.js"),[],import.meta.url),nord:()=>E(()=>import("./nord-Ddv68eIx.js"),[],import.meta.url),"one-dark-pro":()=>E(()=>import("./one-dark-pro-DVMEJ2y_.js"),[],import.meta.url),"one-light":()=>E(()=>import("./one-light-C3Wv6jpd.js"),[],import.meta.url),plastic:()=>E(()=>import("./plastic-3e1v2bzS.js"),[],import.meta.url),poimandres:()=>E(()=>import("./poimandres-CS3Unz2-.js"),[],import.meta.url),red:()=>E(()=>import("./red-hvxz__6c.js"),[],import.meta.url),"rose-pine":()=>E(()=>import("./rose-pine-5qJOZa0Y.js"),[],import.meta.url),"rose-pine-dawn":()=>E(()=>import("./rose-pine-dawn-zx0QlTCp.js"),[],import.meta.url),"rose-pine-moon":()=>E(()=>import("./rose-pine-moon-C9pEdX9L.js"),[],import.meta.url),"slack-dark":()=>E(()=>import("./slack-dark-BthQWCQV.js"),[],import.meta.url),"slack-ochin":()=>E(()=>import("./slack-ochin-DqwNpetd.js"),[],import.meta.url),"snazzy-light":()=>E(()=>import("./snazzy-light-Bw305WKR.js"),[],import.meta.url),"solarized-dark":()=>E(()=>import("./solarized-dark-CpvCGNkr.js"),[],import.meta.url),"solarized-light":()=>E(()=>import("./solarized-light-Dlz6yCKv.js"),[],import.meta.url),"synthwave-84":()=>E(()=>import("./synthwave-84-CbfX1IO0.js"),[],import.meta.url),"tokyo-night":()=>E(()=>import("./tokyo-night-hegEt444.js"),[],import.meta.url),vesper:()=>E(()=>import("./vesper-DRje8inN.js"),[],import.meta.url),"vitesse-black":()=>E(()=>import("./vitesse-black-Bkuqu6BP.js"),[],import.meta.url),"vitesse-dark":()=>E(()=>import("./vitesse-dark-D0r3Knsf.js"),[],import.meta.url),"vitesse-light":()=>E(()=>import("./vitesse-light-CVO1_9PV.js"),[],import.meta.url)};function ii(e){return tr({name:e,collection:Ts,colorScheme:Ms(e),load:Is[e]})}const or=dt({themes:Object.freeze([...rr.map(e=>ii(e)),...As.map(e=>ii(e))])});dt({themes:[ir,or]});function Ds(e){if(Zi())throw new Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(we.hasRegisteredTheme(e))return;const t=or.getTheme(e);if(t!=null){we.registerThemeIfAbsent(t.name,t.load);return}throw new Error(`No valid theme loader registered for "${e}"`)}function _s(e,t){if(t.name!==e)throw new Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function Ps(e){Ds(e);const t=await we.resolveTheme(e);return _s(e,t),t}function Fs(e){return we.getResolvedTheme(e)??Ps(e)}let be;async function sr({themes:e,langs:t,preferredHighlighter:n="shiki-js"}){be??=_o({themes:[],langs:["text"],engine:n==="shiki-wasm"?Po(E(()=>import("./wasm-CG6Dc4jp.js"),[],import.meta.url)):Fo()});const i=zs(be)?await be:be;be=i;const r=[];for(const s of t){if(s==="text"||s==="ansi")continue;const l=cs(s);"then"in l?r.push(l):ti(l,i)}const o=[];for(const s of e){const l=Fs(s);"then"in l?o.push(l):ni(l,be)}return(r.length>0||o.length>0)&&await Promise.all([Promise.all(r).then(s=>{ti(s,i)}),Promise.all(o).then(s=>{ni(s,i)})]),i}function ar(){if(be!=null&&!("then"in be))return be}function zs(e=be){return e!=null&&"then"in e}for(const e of ir.getThemes())we.registerThemeIfAbsent(e.name,e.load);function Vn(e=G){const t=[];return typeof e=="string"?t.push(e):(t.push(e.dark),t.push(e.light)),t}function st(e){for(const t of Vn(e))if(!bn.has(t))return!1;return!0}function Os(e){return we.hasResolvedThemes(e)}function Be(e,t){return pt(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function en(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function Sn(e){return F({tagName:"div",children:[F({tagName:"div",children:e.annotations?.map(t=>F({tagName:"slot",properties:{name:t}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function Ns(e){switch(e){case"file":return"diffs-icon-file-code";case"change":return"diffs-icon-symbol-modified";case"new":return"diffs-icon-symbol-added";case"deleted":return"diffs-icon-symbol-deleted";case"rename-pure":case"rename-changed":return"diffs-icon-symbol-moved"}}function lr({fileOrDiff:e,mode:t,stickyHeader:n}){const i="type"in e?e:void 0,r={"data-diffs-header":t,"data-change-type":i?.type,"data-sticky":n?"":void 0};return F({tagName:"div",children:[t==="custom"?F({tagName:"slot",properties:{name:Fn}}):Us({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:i?.type??"file"}),...t==="custom"?[]:[Vs(i)]],properties:r})}function Us({name:e,prevName:t,iconType:n}){const i=[F({tagName:"slot",properties:{name:zn}}),Wt({name:Ns(n),properties:{"data-change-icon":n}})];return t!=null&&(i.push(F({tagName:"div",children:[F({tagName:"bdi",children:[Ce(t)]})],properties:{"data-prev-name":""}})),i.push(Wt({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push(F({tagName:"div",children:[F({tagName:"bdi",children:[Ce(e)]})],properties:{"data-title":""}})),i.push(F({tagName:"slot",properties:{name:On}})),F({tagName:"div",children:i,properties:{"data-header-content":""}})}function Vs(e){const t=[];if(e!=null){let n=0,i=0;for(const r of e.hunks)n+=r.additionLines,i+=r.deletionLines;(i>0||n===0)&&t.push(F({tagName:"span",children:[Ce(`-${i}`)],properties:{"data-deletions-count":""}})),(n>0||i===0)&&t.push(F({tagName:"span",children:[Ce(`+${n}`)],properties:{"data-additions-count":""}}))}return t.push(F({tagName:"slot",properties:{name:Nn}})),F({tagName:"div",children:t,properties:{"data-metadata":""}})}function dr(e){return F({tagName:"pre",properties:Bs(e)})}function Bs({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:i,split:r,totalLines:o,type:s,customProperties:l}){return{...l,"data-diff":s==="diff"?"":void 0,"data-file":s==="file"?"":void 0,"data-diff-type":s==="diff"?r?"split":"single":void 0,"data-overflow":i,"data-disable-line-numbers":n?"":void 0,"data-background":t?void 0:"","data-indicators":e==="bars"||e==="classic"?e:void 0,style:`--diffs-min-number-column-width-default:${`${o}`.length}ch;`}}const $e=new Map,et={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",mts:"typescript",cts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function he(e){if($e.has(e))return $e.get(e)??"text";if(et[e]!=null)return et[e];const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if($e.has(t[1]))return $e.get(t[1])??"text";if(et[t[1]]!=null)return et[t[1]]??"text"}const n=e.match(/\.([^.]+)$/)?.[1]??"";return $e.has(n)?$e.get(n)??"text":et[n]??"text"}function hr(e,{theme:t,preferredHighlighter:n="shiki-js"}){return{langs:[e??"text"],themes:Vn(t),preferredHighlighter:n}}function Re(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function $s(e,t,n){const i=typeof n.lineInfo=="function"?n.lineInfo(t):n.lineInfo[t-1];if(i==null){const r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),new Error(r)}return e.tagName="div",e.properties["data-line"]=i.lineNumber,e.properties["data-alt-line"]=i.altLineNumber,e.properties["data-line-type"]=i.type,e.properties["data-line-index"]=i.lineIndex,e.children.length===0&&e.children.push(Ce(`
2
+ `)),e}const yt=Symbol("no-token"),ln=Symbol("multiple-tokens");function cr(e){const t=Ws(e);if(t!=null)return t;let n=yt;const i=[];let r=[],o;const s=()=>{if(r.length===0||o==null){r=[],o=void 0;return}if(r.length===1){const a=r[0];if(a?.type==="element"){Gs(a,o);for(const h of a.children)Ft(h)}else Ft(a);i.push(a),r=[],o=void 0;return}for(const a of r)Ft(a);i.push(F({tagName:"span",properties:{"data-char":o},children:r})),r=[],o=void 0},l=a=>{if(a!==yt){if(a===ln){n=ln;return}if(n===yt){n=a;return}n!==a&&(n=ln)}};for(const a of e.children){const h=a.type==="element"?cr(a):yt;if(l(h),typeof h!="number"){s(),i.push(a);continue}o!=null&&o!==h&&s(),o??=h,r.push(a)}return s(),e.children=i,n}function Ws(e){const t=e.properties["data-char"];if(typeof t=="number")return t}function Ft(e){if(e.type==="element"){e.properties["data-char"]=void 0;for(const t of e.children)Ft(t)}}function Gs(e,t){e.properties["data-char"]=t}function js(e={}){const{classPrefix:t="__shiki_",classSuffix:n="",classReplacer:i=l=>l}=e,r=new Map;function o(l){return Object.entries(l).map(([a,h])=>`${a}:${h}`).join(";")}function s(l){const a=typeof l=="string"?l:o(l);let h=t+qs(a)+n;return h=i(h),r.has(h)||r.set(h,typeof l=="string"?l:{...l}),h}return{name:"@shikijs/transformers:style-to-class",pre(l){if(!l.properties.style)return;const a=s(l.properties.style);delete l.properties.style,this.addClassToHast(l,a)},tokens(l){for(const a of l)for(const h of a){if(!h.htmlStyle)continue;const d=s(h.htmlStyle);h.htmlStyle={},h.htmlAttrs||={},h.htmlAttrs.class?h.htmlAttrs.class+=` ${d}`:h.htmlAttrs.class=d}},getClassRegistry(){return r},getCSS(){let l="";for(const[a,h]of r.entries())l+=`.${a}{${typeof h=="string"?h:o(h)}}`;return l},clearRegistry(){r.clear()}}}function qs(e,t=0){let n=3735928559^t,i=1103547991^t;for(let r=0,o;r<e.length;r++)o=e.charCodeAt(r),n=Math.imul(n^o,2654435761),i=Math.imul(i^o,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&i)+(n>>>0)).toString(36).slice(0,6)}function ur(e=!1,t=!1){const n={lineInfo:[]},i=[{line(r){return delete r.properties.class,r},pre(r){const o=qo(r),s=[];if(o!=null){let l=1;for(const a of o.children)a.type==="element"&&(e&&cr(a),s.push($s(a,l,n)),l++);o.children=s}return r},...e?{tokens(r){for(const o of r){let s=0;for(const l of o){const a=l;a.__lineChar??=s,s+=l.content.length}}},preprocess(r,o){o.mergeWhitespaces="never"},span(r,o,s,l,a){if(a?.offset!=null&&a.content!=null){const h=a.__lineChar;return h!=null&&(r.properties["data-char"]=h),r}return r}}:null}];return t&&i.push(Ks,ri),e&&i.push({line:r=>(r.type==="element"&&r.children.length===0&&r.children.push({type:"element",tagName:"br",properties:{},children:[]}),r)}),{state:n,transformers:i,toClass:ri}}const ri=js({classPrefix:"hl-"}),Ks={name:"token-style-normalizer",tokens(e){for(const t of e)for(const n of t){if(n.htmlStyle!=null)continue;const i={};n.color!=null&&(i.color=n.color),n.bgColor!=null&&(i["background-color"]=n.bgColor),n.fontStyle!=null&&n.fontStyle!==0&&((n.fontStyle&1)!==0&&(i["font-style"]="italic"),(n.fontStyle&2)!==0&&(i["font-weight"]="bold"),(n.fontStyle&4)!==0&&(i["text-decoration"]="underline")),Object.keys(i).length>0&&(n.htmlStyle=i)}}};function se(e){return`--${e==="token"?"diffs-token":"diffs"}-`}const Ys=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Qs=/^0(?:\.0+)?%?$/;function Xs(e){const t=e.indexOf("(");if(t<=0||!e.endsWith(")"))return;const n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;const i=e.slice(t+1,-1).trim();if(i.length===0)return;const r=i.lastIndexOf("/");if(r!==-1)return i.slice(r+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){const o=i.split(",");if(o.length===4)return o[3]?.trim()}}function ht(e){const t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;const n=t[1];let i,r=1;return n.length===3?i=n.split("").map(o=>o+o).join(""):n.length===6?i=n:(i=n.slice(0,6),r=parseInt(n.slice(6,8),16)/255),[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),r]}function ge(e){if(e==null)return null;const t=ht(e);if(t==null)return null;const n=t[0]/255,i=t[1]/255,r=t[2]/255,o=s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4;return .2126*o(n)+.7152*o(i)+.0722*o(r)}function fr(e,t){const[n,i]=e>t?[e,t]:[t,e];return(n+.05)/(i+.05)}function ah(e,t){if(t==null)return;const n=ht(e),i=ht(t);if(n==null||i==null)return;const[r,o,s,l]=n,[a,h,d]=i;return"#"+[Math.round(r*l+a*(1-l)),Math.round(o*l+h*(1-l)),Math.round(s*l+d*(1-l))].map(c=>c.toString(16).padStart(2,"0")).join("")}function oi(e){if(e==null)return!1;const t=e.trim().toLowerCase();if(t==="transparent"||Ys.test(t))return!0;const n=Xs(t);return n!=null&&Qs.test(n)}function lh(e,t){const n=ge(e);if(n!=null)return n<.4;const i=ge(t);return i!=null?i>.6:!1}function dh(e,t){if(e==null||t==null)return!1;if(e.trim().toLowerCase()===t.trim().toLowerCase())return!0;const n=ge(e),i=ge(t);return n==null||i==null?!1:Math.abs(n-i)<.06}function Zs(e,t,n){if(t==null||n==null)return!1;const i=ge(e),r=ge(t),o=ge(n);return i==null||r==null||o==null?!1:Math.abs(i-o)<Math.abs(i-r)}function hh(e,t){const n=ge(e),i=t.find(s=>s!=null&&s!=="");if(n==null)return i;let r,o=-1;for(const s of t){if(s==null||s==="")continue;const l=ge(s);if(l==null)continue;const a=fr(n,l);if(a>=3)return s;a>o&&(r=s,o=a)}return r??i}function ch(e,t){if(t==null)return e;const n=ht(e),i=ht(t),r=ge(t);if(n==null||i==null||r==null)return`color-mix(in srgb, ${e} 70%, ${t})`;const[o,s,l]=n,[a,h,d]=i;for(const c of[.6,.7,.8,.9]){const u="#"+[Math.round(o*c+a*(1-c)),Math.round(s*c+h*(1-c)),Math.round(l*c+d*(1-c))].map(g=>g.toString(16).padStart(2,"0")).join(""),p=ge(u);if(p!=null&&fr(r,p)>=4.5)return u}return e}const si=new WeakMap;function dn(e){const t=si.get(e);if(t!=null)return t;const n=e.colors??{},i={...n},r=n["editor.background"]??e.bg,o=n["editor.foreground"]??e.fg,s=n["sideBar.background"]??r,l=n["sideBar.foreground"]??o;me(i,"editor.background",r),me(i,"editor.foreground",o),me(i,"sideBar.background",s),me(i,"sideBar.foreground",l),me(i,"input.background",n["input.background"]??s),me(i,"sideBarSectionHeader.foreground",n["sideBarSectionHeader.foreground"]??l),me(i,"list.activeSelectionForeground",n["list.activeSelectionForeground"]??l),me(i,"gitDecoration.addedResourceForeground",hn(n["gitDecoration.addedResourceForeground"],n["terminal.ansiGreen"],n["editorGutter.addedBackground"])),me(i,"gitDecoration.modifiedResourceForeground",hn(n["gitDecoration.modifiedResourceForeground"],n["terminal.ansiBlue"],n["editorGutter.modifiedBackground"])),me(i,"gitDecoration.deletedResourceForeground",hn(n["gitDecoration.deletedResourceForeground"],n["terminal.ansiRed"],n["editorGutter.deletedBackground"]));const a=(oi(n["list.focusOutline"])?void 0:n["list.focusOutline"])??(oi(n.focusBorder)?void 0:n.focusBorder);a!=null?i["list.focusOutline"]=a:delete i["list.focusOutline"];const h=n["list.hoverBackground"];h!=null&&(Js(h,s)||Zs(h,s,l))&&delete i["list.hoverBackground"];const d=Object.freeze({...e,colors:Object.freeze(i)});return si.set(e,d),d}function me(e,t,n){n!=null&&n!==""&&(e[t]=n)}function hn(...e){for(const t of e)if(t!=null&&t!=="")return t}function Js(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function pr({theme:e=G,highlighter:t,prefix:n}){let i="";if(typeof e=="string"){const r=t.getTheme(e),o=dn(r);i+=`color:${o.fg};`,i+=`background-color:${o.bg};`,i+=`${se("global")}fg:${o.fg};`,i+=`${se("global")}bg:${o.bg};`,i+=cn(r,n)}else{let r=t.getTheme(e.dark),o=dn(r);i+=`${se("global")}dark:${o.fg};`,i+=`${se("global")}dark-bg:${o.bg};`,i+=cn(r,"dark"),r=t.getTheme(e.light),o=dn(r),i+=`${se("global")}light:${o.fg};`,i+=`${se("global")}light-bg:${o.bg};`,i+=cn(r,"light")}return i}function cn(e,t){t=t!=null?`${t}-`:"";let n="";const i=e.colors?.["gitDecoration.addedResourceForeground"]??e.colors?.["terminal.ansiGreen"];i!=null&&(n+=`${se("global")}${t}addition-color:${i};`);const r=e.colors?.["gitDecoration.deletedResourceForeground"]??e.colors?.["terminal.ansiRed"];r!=null&&(n+=`${se("global")}${t}deletion-color:${r};`);const o=e.colors?.["gitDecoration.modifiedResourceForeground"]??e.colors?.["terminal.ansiBlue"];return o!=null&&(n+=`${se("global")}${t}modified-color:${o};`),n}function yn(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t.children;"children"in t?t=t.children[0]:t=null}throw console.error(e),new Error("getLineNodes: Unable to find children")}const qt=10,Kt=13,ea=4,ta=40;function na(e){const t=[0];let n=e.indexOf("\r"),i=e.indexOf(`
3
+ `),r=0,o=0;for(;n!==-1||i!==-1;){let s;if(n!==-1&&(i===-1||n<i)?i===n+1?(s=i+1,n=e.indexOf("\r",s),i=e.indexOf(`
4
+ `,s)):(s=n+1,n=e.indexOf("\r",s)):(s=i+1,i=e.indexOf(`
5
+ `,s)),t.push(s),++o===ea){if(s-r<=ta){for(let l=s;l<e.length;l++){const a=e.charCodeAt(l);(a===qt||a===Kt)&&(a===Kt&&l+1<e.length&&e.charCodeAt(l+1)===qt&&l++,t.push(l+1))}return t}r=s,o=0}}return t}function uh(e){let t=0;for(let n=0;n<e.length;n++){const i=e.charCodeAt(n);(i===qt||i===Kt)&&(i===Kt&&n+1<e.length&&e.charCodeAt(n+1)===qt&&n++,t++)}return t}function zt(e){const t=na(e);return Array.from({length:t.length},(n,i)=>{const r=t[i],o=t[i+1]??e.length;return e.slice(r,o)})}const ia={forcePlainText:!1};function ra(e,t,{theme:n=G,tokenizeMaxLineLength:i,useTokenTransformer:r},{forcePlainText:o,startingLine:s,totalLines:l,lines:a}=ia){o?(s??=0,l??=1/0):(s=0,l=1/0);const h=s>0||l<1/0,{state:d,transformers:c}=ur(r),u=o?"text":e.lang??he(e.name),p=typeof n=="string"?t.getTheme(n).type:void 0,g=pr({theme:n,highlighter:t});d.lineInfo=f=>({type:"context",lineIndex:f-1+s,lineNumber:f+s});const S=typeof n=="string"?{lang:u,theme:n,transformers:c,defaultColor:!1,cssVariablePrefix:se("token"),tokenizeMaxLineLength:i,tokenizeTimeLimit:0}:{lang:u,themes:n,transformers:c,defaultColor:!1,cssVariablePrefix:se("token"),tokenizeMaxLineLength:i,tokenizeTimeLimit:0},C=yn(t.codeToHast(h?oa(a??zt(e.contents),s,l):e.contents,S)),b=h?new Array(s):C;return h&&b.push(...C),{code:b,themeStyles:g,baseThemeType:p}}function oa(e,t,n){if(e.length===0)return"";const i=Math.min(t+n,e.length);return e.slice(t,i).join("")}const gr="-1,-1";function Cn(e){return e?.some(t=>t.lineNumber===0)??!1}function xn(e){const t=e[0];return t!=null&&t.length>0?t:void 0}function tn(e){return e.startingLine===0&&e.totalLines>0}function mr(e,t){return e.endsWith(`\r
6
+ `)?t+`\r
7
+ `:e.endsWith("\r")?t+"\r":e.endsWith(`
8
+ `)?t+`
9
+ `:t}function vr(e,t){return F({tagName:"div",children:e,properties:{"data-content":"",style:`grid-row: span ${t}`}})}function Ln(e){return(e.lang??he(e.name))==="text"}function Ct(e,t){return t.cacheKey==null?e.file===t&&e.sourceContents===t.contents:e.cacheKey===t.cacheKey}let sa=-1;var aa=class{options;onRenderUpdate;workerManager;__id=`file-renderer:${++sa}`;highlighter;renderCache;computedLang="text";lineAnnotations={};lineCache;pendingStructuralRows;textDocumentCache=new WeakMap;editSessionActive=!1;constructor(e={theme:G},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=st(e.theme??G)?ar():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(const t of e){const n=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=n,n.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}beginEditSession(){this.editSessionActive=!0}endEditSession(){this.editSessionActive=!1}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0,this.endEditSession(),this.textDocumentCache=new WeakMap}syncEditedContentsToFile(){const{renderCache:e,lineCache:t}=this;e?.isDirty!==!0||t==null||!Ct(t,e.file)||(e.file.contents=t.lines.join(""))}hasUnkeyedFileContentsChanged(e){const{lineCache:t}=this;return e.cacheKey==null&&t!=null&&t.file===e&&t.sourceContents!==e.contents}invalidateChangedUnkeyedFile(e){this.hasUnkeyedFileContentsChanged(e)&&(this.workerManager?.cleanUpTasks(this),this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap)}clearRenderCache(){this.syncEditedContentsToFile(),this.pendingStructuralRows=void 0;const e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.file.cacheKey!=null&&this.workerManager?.evictFileFromCache(e.file.cacheKey)}hydrate(e){const{options:t}=this.getRenderOptions(e),n=un(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());let i=this.workerManager?.getFileResultCache(e);i!=null&&!Be(t,i.options)&&(i=void 0),this.renderCache??={file:e,options:t,highlighted:!n&&!Ln(e),result:n?void 0:i?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter==null&&(this.computedLang=e.lang??he(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??G}getEffectiveCodeOptions(){const e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getFileRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){const t=(()=>{if(this.workerManager?.isWorkingPool()===!0){const r=this.workerManager.getFileRenderOptions();return this.editSessionActive&&r.useTokenTransformer!==!0?{...r,useTokenTransformer:!0}:r}const{tokenizeMaxLineLength:i=1e3}=this.options;return{theme:this.getLocalHighlightTheme(),useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:i}})(),{renderCache:n}=this;return n?.result==null?{options:t,forceHighlight:!0}:!Se(e,n.file)||!Be(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getOrCreateLineCache(e){this.invalidateChangedUnkeyedFile(e);let{lineCache:t}=this;return(t==null||!Ct(t,e))&&(t={cacheKey:e.cacheKey,file:e,sourceContents:e.contents,lines:zt(e.contents)}),this.lineCache=t,t.lines}getLineCount(e){const t=this.getOrCreateLineCache(e);return this.textDocumentCache.get(e)?.lineCount??t.length}updateRenderCache(e,t,n=!1){if(this.pendingStructuralRows=void 0,this.renderCache==null)return;const{file:i,result:r}=this.renderCache;if(r==null)return;const o=n?new Map:void 0;this.pendingStructuralRows=o;const s=this.lineCache!=null&&Ct(this.lineCache,i)?this.lineCache:void 0;for(const[l,a]of e){if(o===void 0&&s!=null&&l<s.lines.length){const d=a.map(c=>c[2]).join("");s.lines[l]=mr(s.lines[l]??"",d)}const h={type:"element",tagName:"div",properties:{"data-line":l+1,"data-line-type":"context","data-line-index":l},children:a.map(([d,c,u])=>d===0&&c===""?u===""?{type:"element",tagName:"br",properties:{},children:[]}:{type:"text",value:u}:{type:"element",tagName:"span",properties:{"data-char":d,style:`color:${c};`},children:[{type:"text",value:u}]})};o!==void 0?o.set(l,h):r.code[l]=h}r.baseThemeType=t,this.renderCache.isDirty=!0}applyDocumentChange(e){const t=this.pendingStructuralRows;if(this.pendingStructuralRows=void 0,this.renderCache==null)return;const{file:n,result:i}=this.renderCache;if(i==null)return;const r=this.lineCache!=null&&Ct(this.lineCache,n)?this.lineCache.lines:zt(n.contents),o=zt(e.getText());if(r.length!==o.length){const s=Math.min(r.length,o.length);let l=0;for(;l<s&&r[l]===o[l];)l++;let a=0;for(;a<s-l&&r[r.length-1-a]===o[o.length-1-a];)a++;const h=i.code;i.code=new Array(o.length);for(let d=0;d<l;d++)i.code[d]=h[d];for(let d=0;d<a;d++)i.code[o.length-1-d]=h[r.length-1-d];if(t!==void 0)for(const[d,c]of t)d<o.length&&(i.code[d]=c);for(let d=l;d<o.length-a;d++)i.code[d]??={type:"element",tagName:"div",properties:{"data-line":d+1,"data-line-type":"context","data-line-index":d},children:[{type:"element",tagName:"span",properties:{"data-char":0},children:[{type:"text",value:e.getLineText(d)}]}]};for(let d=0;d<i.code.length;d++){const c=i.code[d];c?.type==="element"&&(c.properties["data-line"]=d+1,c.properties["data-line-index"]=d)}this.renderCache.isDirty=!0}this.lineCache={cacheKey:n.cacheKey,file:n,sourceContents:n.contents,lines:o},this.textDocumentCache.set(n,e)}renderFile(e=this.renderCache?.file,t=Vt){if(e==null)return;this.invalidateChangedUnkeyedFile(e),this.renderCache?.isDirty===!0&&!Se(e,this.renderCache.file)&&(this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap);let{options:n,forceHighlight:i}=this.getRenderOptions(e);this.renderCache?.isDirty===!0&&!Be(n,this.renderCache.options)&&this.clearRenderCache();const r=this.getMatchingWorkerResultCache(e,n);r!=null&&!this.hasHighlightedRenderCache(e,n)&&(this.renderCache={file:e,highlighted:!0,renderRange:void 0,...r},i=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};const o=this.getOrCreateLineCache(e),s=e.contents.length>0,l=!s||Ln(e)||un(o.length,this.getTokenizeMaxLength()),a=!Se(e,this.renderCache.file),h=!en(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0)(l||this.renderCache.result==null||!this.renderCache.highlighted&&(a||h))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||a||h||i)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,o)),this.renderCache.renderRange=t),!l&&s&&(!this.renderCache.highlighted||i)&&this.workerManager.highlightFileAST(this,e);else{this.computedLang=e.lang??he(e.name);const d=this.highlighter!=null&&st(n.theme),c=this.highlighter!=null&&jt(this.computedLang),u=!l&&c;if(this.highlighter!=null&&d&&(i||l||!this.renderCache.highlighted&&u||this.renderCache.result==null)){const{result:p,options:g}=this.renderFileWithHighlighter(e,this.highlighter,l||!c);this.renderCache={file:e,options:g,highlighted:u,result:p,renderRange:void 0}}(!d||!l&&!c)&&this.asyncHighlight(e).then(({result:p,options:g})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.applyHighlightResult(e,p,g,!l)})}return this.renderCache.result!=null?this.processFileResult(this.renderCache.file,t,this.renderCache.result):void 0}async asyncRender(e,t=Vt){const{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){const t=un(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?"text":e.lang??he(e.name);const n=this.highlighter!=null&&Os(Vn(this.getLocalHighlightTheme())),i=t||this.highlighter!=null&&jt(this.computedLang);return(this.highlighter==null||!n||!i)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){const{options:i}=this.getRenderOptions(e);return{result:ra(e,t,i,{forcePlainText:n}),options:i}}processFileResult(e,t,{code:n,themeStyles:i,baseThemeType:r}){const o=this.getLineCount(e),{disableFileHeader:s=!1}=this.options,l=[],a=Ke(),h=Math.min(t.startingLine+t.totalLines,o);let d=0;const c=tn(t)?xn(this.lineAnnotations):void 0;c!=null&&(a.children.push(oe("context","annotation",1)),l.push(Sn({hunkIndex:-1,lineIndex:-1,annotations:c.map(u=>Re(u))})),d++);for(let u=t.startingLine;u<h;u++){const p=u+1,g=n[u];if(g==null){const C="FileRenderer.processFileResult: Line doesnt exist";throw console.error(C,{name:e.name,lineIndex:u,lineNumber:p}),new Error(C)}a.children.push(qi("context",p,`${u}`)),l.push(g),d++;const S=this.lineAnnotations[p];S!=null&&(a.children.push(oe("context","annotation",1)),l.push(Sn({hunkIndex:0,lineIndex:p,annotations:S.map(C=>Re(C))})),d++)}return a.properties.style=`grid-row: span ${d}`,{gutterAST:a.children??[],contentAST:l,preAST:this.createPreElement(o),headerAST:s?void 0:this.renderHeader(e),totalLines:o,rowCount:d,themeStyles:i,baseThemeType:r,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderHeader(e){const{headerRenderMode:t="default",stickyHeader:n=!1}=this.options;return lr({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return te(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(F({tagName:"code",children:this.renderCodeAST(e),properties:{"data-code":""}})),{...e.preAST,children:t}}renderCodeAST(e){const t=Ke();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,vr(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return t?te(F({tagName:"code",children:e,properties:{"data-code":""}})):te(e)}async initializeHighlighter(){return this.highlighter=await sr(hr(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}onHighlightSuccess(e,t,n,i=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,i)}applyHighlightResult(e,t,n,i=!0){if(this.renderCache==null)return;const r=!Se(e,this.renderCache.file)||!this.renderCache.highlighted||!Be(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:i,result:t,renderRange:void 0},r&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;const n=this.workerManager?.getFileResultCache(e);if(!(n==null||!Be(t,n.options)))return n}hasHighlightedRenderCache(e,t){const{renderCache:n}=this;return n?.result!=null&&n.highlighted&&Se(e,n.file)&&Be(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){const{disableLineNumbers:t=!1,overflow:n="scroll"}=this.options;return dr({type:"file",diffIndicators:"none",disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function un(e,t){return e>t}const br=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
10
+ <symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
11
+ <path d="M8.47 4.22a.75.75 0 0 0 0 1.06l1.97 1.97H3.75a.75.75 0 0 0 0 1.5h6.69l-1.97 1.97a.75.75 0 1 0 1.06 1.06l3.25-3.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0"/>
12
+ </symbol>
13
+ <symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
14
+ <path d="M8 0c4.42 0 8 3.58 8 8a8.01 8.01 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27s-1.36.09-2 .27c-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8"/>
15
+ </symbol>
16
+ <symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
17
+ <path d="M1.47 4.47a.75.75 0 0 1 1.06 0L8 9.94l5.47-5.47a.75.75 0 1 1 1.06 1.06l-6 6a.75.75 0 0 1-1.06 0l-6-6a.75.75 0 0 1 0-1.06"/>
18
+ </symbol>
19
+ <symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
20
+ <path d="M4.47 2.22a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1-1.06 1.06L5 3.81 2.28 6.53a.75.75 0 0 1-1.06-1.06zM1.22 9.47a.75.75 0 0 1 1.06 0L5 12.19l2.72-2.72a.75.75 0 0 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 0 1 0-1.06"/>
21
+ </symbol>
22
+ <symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
23
+ <path d="M14 0H8.5v16H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2m-1.5 6.5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1v-1a.5.5 0 0 1 1 0"/><path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h5.5V0zm.5 7.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1" opacity=".3"/>
24
+ </symbol>
25
+ <symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
26
+ <path fill-rule="evenodd" d="M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8.5h16zm-8-4a.5.5 0 0 0-.5.5v1h-1a.5.5 0 0 0 0 1h1v1a.5.5 0 0 0 1 0v-1h1a.5.5 0 0 0 0-1h-1v-1A.5.5 0 0 0 8 10" clip-rule="evenodd"/><path fill-rule="evenodd" d="M14 0a2 2 0 0 1 2 2v5.5H0V2a2 2 0 0 1 2-2zM6.5 3.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1z" clip-rule="evenodd" opacity=".4"/>
27
+ </symbol>
28
+ <symbol id="diffs-icon-expand" viewBox="0 0 16 16">
29
+ <path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06"/>
30
+ </symbol>
31
+ <symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
32
+ <path d="M11.47 9.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06L8 12.94zM7.526 1.418a.75.75 0 0 1 1.004.052l4 4a.75.75 0 1 1-1.06 1.06L8 3.06 4.53 6.53a.75.75 0 1 1-1.06-1.06l4-4z"/>
33
+ </symbol>
34
+ <symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
35
+ <path d="M10.75 0c.199 0 .39.08.53.22l3.5 3.5c.14.14.22.331.22.53v9A2.75 2.75 0 0 1 12.25 16h-8.5A2.75 2.75 0 0 1 1 13.25V2.75A2.75 2.75 0 0 1 3.75 0zm-7 1.5c-.69 0-1.25.56-1.25 1.25v10.5c0 .69.56 1.25 1.25 1.25h8.5c.69 0 1.25-.56 1.25-1.25V5h-1.25A2.25 2.25 0 0 1 10 2.75V1.5z"/><path d="M7.248 6.19a.75.75 0 0 1 .063 1.058L5.753 9l1.558 1.752a.75.75 0 0 1-1.122.996l-2-2.25a.75.75 0 0 1 0-.996l2-2.25a.75.75 0 0 1 1.06-.063M8.69 7.248a.75.75 0 1 1 1.12-.996l2 2.25a.75.75 0 0 1 0 .996l-2 2.25a.75.75 0 1 1-1.12-.996L10.245 9z"/>
36
+ </symbol>
37
+ <symbol id="diffs-icon-plus" viewBox="0 0 16 16">
38
+ <path d="M8 3a.75.75 0 0 1 .75.75v3.5h3.5a.75.75 0 0 1 0 1.5h-3.5v3.5a.75.75 0 0 1-1.5 0v-3.5h-3.5a.75.75 0 0 1 0-1.5h3.5v-3.5A.75.75 0 0 1 8 3"/>
39
+ </symbol>
40
+ <symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
41
+ <path d="M8 4a.75.75 0 0 1 .75.75v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5A.75.75 0 0 1 8 4"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
42
+ </symbol>
43
+ <symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
44
+ <path d="M4 8a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5A.75.75 0 0 1 4 8"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
45
+ </symbol>
46
+ <symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
47
+ <path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.75 4.296a.75.75 0 0 0-1.5 0V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2zM5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5z"/>
48
+ </symbol>
49
+ <symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
50
+ <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m11.53-2.47a.75.75 0 0 0-1.06-1.06l-6 6a.75.75 0 1 0 1.06 1.06z"/>
51
+ </symbol>
52
+ <symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
53
+ <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m8 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6"/>
54
+ </symbol>
55
+ <symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
56
+ <path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.495 4.695a.75.75 0 0 0-.05 1.06L10.486 8l-2.041 2.246a.75.75 0 0 0 1.11 1.008l2.5-2.75a.75.75 0 0 0 0-1.008l-2.5-2.75a.75.75 0 0 0-1.06-.051m-4 0a.75.75 0 0 0-.05 1.06l2.044 2.248-1.796 1.995a.75.75 0 0 0 1.114 1.004l2.25-2.5a.75.75 0 0 0-.002-1.007l-2.5-2.75a.75.75 0 0 0-1.06-.05"/>
57
+ </symbol>
58
+ <symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
59
+ <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706.286.286.71.54 1.41.73V1.86c-.7.19-1.124.444-1.41.73-.324.325-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8m4 6.397c.697.07 1.522.103 2.5.103 1.613 0 2.806-.088 3.704-.288.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5c-.978 0-1.803.033-2.5.103zM0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m7-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"/>
60
+ </symbol>
61
+ </svg>`;function la(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function Sr(e,t){return e==null||t==null?e===t:da(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}const ai={};function da(e=ai,t=ai){if(e===t)return!0;const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(const r of n)if(e[r]!==t[r])return!1;return!0}function yr(e){const t=document.createElement("div");return t.dataset.annotationSlot="",t.slot=e,t.style.whiteSpace="normal",t}function Cr(){const e=document.createElement("div");return e.slot="gutter-utility-slot",e.style.position="absolute",e.style.top="0",e.style.bottom="0",e.style.textAlign="center",e.style.whiteSpace="normal",e.style.touchAction="none",e}function xr(){const e=document.createElement("style");return e.setAttribute(So,""),e}var ha=`@layer base {
62
+ :host {
63
+ --diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",
64
+ "Courier New", monospace;
65
+ --diffs-header-font-fallback: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
66
+ "Noto Sans", "Liberation Sans", Arial, sans-serif;
67
+ --diffs-mixer: light-dark(#000, #fff);
68
+ --diffs-gap-fallback: 8px;
69
+ --diffs-scrollbar-gutter-fallback: 6px;
70
+ --diffs-scrollbar-gutter: var(--diffs-scrollbar-gutter-override, var(--diffs-scrollbar-gutter-measured, var(--diffs-scrollbar-gutter-fallback)));
71
+ --diffs-added-light: #0dbe4e;
72
+ --diffs-added-dark: #5ecc71;
73
+ --diffs-modified-light: #009fff;
74
+ --diffs-modified-dark: #69b1ff;
75
+ --diffs-deleted-light: #ff2e3f;
76
+ --diffs-deleted-dark: #ff6762;
77
+ --diffs-warning-light: #d5a910;
78
+ --diffs-warning-dark: #ffd452;
79
+ color-scheme: light dark;
80
+ font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
81
+ font-size: var(--diffs-font-size, 13px);
82
+ line-height: var(--diffs-line-height, 20px);
83
+ font-feature-settings: var(--diffs-font-features);
84
+ --diffs-bg: light-dark(var(--diffs-light-bg, #fff), var(--diffs-dark-bg, #000));
85
+ --diffs-bg-buffer: var(--diffs-bg-buffer-override, light-dark(color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))));
86
+ --diffs-bg-context: var(--diffs-bg-context-override, light-dark(color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))));
87
+ --diffs-bg-context-gutter: var(--diffs-bg-context-gutter-override, light-dark(color-mix(in lab, var(--diffs-bg-context) 90%, var(--diffs-bg)), color-mix(in lab, var(--diffs-bg-context) 45%, var(--diffs-bg))));
88
+ --diffs-bg-separator: var(--diffs-bg-separator-override, light-dark(color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))));
89
+ --diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff));
90
+ --diffs-fg-number: var(--diffs-fg-number-override, light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))));
91
+ --diffs-fg-conflict-marker: var(--diffs-fg-conflict-marker-override, var(--diffs-fg-number));
92
+ --diffs-deletion-base: var(--diffs-deletion-color-override, light-dark(var(--diffs-light-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-light))), var(--diffs-dark-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-dark)))));
93
+ --diffs-addition-base: var(--diffs-addition-color-override, light-dark(var(--diffs-light-addition-color, var(--diffs-addition-color, var(--diffs-added-light))), var(--diffs-dark-addition-color, var(--diffs-addition-color, var(--diffs-added-dark)))));
94
+ --diffs-modified-base: var(--diffs-modified-color-override, light-dark(var(--diffs-light-modified-color, var(--diffs-modified-color, var(--diffs-modified-light))), var(--diffs-dark-modified-color, var(--diffs-modified-color, var(--diffs-modified-dark)))));
95
+ --diffs-bg-deletion: var(--diffs-bg-deletion-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))));
96
+ --diffs-bg-deletion-emphasis: var(--diffs-bg-deletion-emphasis-override, light-dark(rgb(from var(--diffs-deletion-base) r g b / .15), rgb(from var(--diffs-deletion-base) r g b / .2)));
97
+ --diffs-bg-addition: var(--diffs-bg-addition-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))));
98
+ --diffs-bg-addition-emphasis: var(--diffs-bg-addition-emphasis-override, light-dark(rgb(from var(--diffs-addition-base) r g b / .15), rgb(from var(--diffs-addition-base) r g b / .2)));
99
+ --diffs-selection-base: var(--diffs-modified-base);
100
+ --diffs-selection-number-fg: light-dark(color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)));
101
+ background-color: var(--diffs-bg);
102
+ color: var(--diffs-fg);
103
+ display: block;
104
+ }
105
+
106
+ pre, code, [data-error-wrapper] {
107
+ isolation: isolate;
108
+ font-family: var(--diffs-font-family, var(--diffs-font-fallback));
109
+ outline: none;
110
+ margin: 0;
111
+ padding: 0;
112
+ display: block;
113
+ }
114
+
115
+ pre, code {
116
+ background-color: var(--diffs-bg);
117
+ }
118
+
119
+ code {
120
+ contain: content;
121
+ }
122
+
123
+ input, button {
124
+ font-family: inherit;
125
+ font-size: inherit;
126
+ line-height: inherit;
127
+ }
128
+
129
+ *, :before, :after {
130
+ box-sizing: border-box;
131
+ }
132
+
133
+ [data-icon-sprite] {
134
+ display: none;
135
+ }
136
+
137
+ [data-diffs-header], [data-separator] {
138
+ font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
139
+ }
140
+
141
+ [data-diffs-header][data-sticky] {
142
+ z-index: 1;
143
+ background-color: var(--diffs-bg);
144
+ position: sticky;
145
+ top: 0;
146
+ }
147
+
148
+ [data-file-info] {
149
+ color: var(--fg);
150
+ background-color: color-mix(in lab, var(--bg) 98%, var(--fg));
151
+ border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));
152
+ padding: 10px;
153
+ font-weight: 700;
154
+ }
155
+
156
+ [data-diff], [data-file] {
157
+ --diffs-grid-number-column-width: minmax(min-content, max-content);
158
+ --diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;
159
+
160
+ &[data-dehydrated] {
161
+ --diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);
162
+ }
163
+
164
+ &:hover [data-code]::-webkit-scrollbar-thumb {
165
+ background-color: var(--diffs-bg-context);
166
+ }
167
+ }
168
+
169
+ @supports (-webkit-touch-callout: none) {
170
+ :host {
171
+ --diffs-scrollbar-gutter-fallback: 0px;
172
+ }
173
+ }
174
+
175
+ [data-line] span {
176
+ color: light-dark(var(--diffs-token-light, var(--diffs-light)), var(--diffs-token-dark, var(--diffs-dark)));
177
+ background-color: light-dark(var(--diffs-token-light-bg, inherit), var(--diffs-token-dark-bg, inherit));
178
+ font-weight: light-dark(var(--diffs-token-light-font-weight, inherit), var(--diffs-token-dark-font-weight, inherit));
179
+ font-style: light-dark(var(--diffs-token-light-font-style, inherit), var(--diffs-token-dark-font-style, inherit));
180
+ text-decoration: light-dark(var(--diffs-token-light-text-decoration, inherit), var(--diffs-token-dark-text-decoration, inherit));
181
+ }
182
+
183
+ [data-line], [data-gutter-buffer], [data-column-number], [data-line-annotation], [data-no-newline], [data-merge-conflict], [data-merge-conflict-actions], [data-editor-overlay] {
184
+ --diffs-computed-decoration-bg: var(--diffs-bg);
185
+ --diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
186
+ --diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
187
+ --diffs-computed-editor-active-line-bg: var(--diffs-computed-selected-line-bg);
188
+ --diffs-computed-hovered-line-bg: var(--diffs-computed-editor-active-line-bg);
189
+ --diffs-hover-mix-target: var(--diffs-bg-hover-override, var(--diffs-mixer));
190
+ --diffs-line-bg: var(--diffs-computed-hovered-line-bg);
191
+ color: var(--diffs-fg);
192
+ background-color: var(--diffs-line-bg, var(--diffs-bg));
193
+ }
194
+
195
+ [data-line], [data-no-newline] {
196
+ &[data-decoration-bg] {
197
+ --mix-deco-light: 92%;
198
+ --mix-deco-dark: 85%;
199
+
200
+ &[data-decoration-bg-depth="2"] {
201
+ --mix-deco-light: 88%;
202
+ --mix-deco-dark: 80%;
203
+ }
204
+
205
+ &[data-decoration-bg-depth="3"] {
206
+ --mix-deco-light: 85%;
207
+ --mix-deco-dark: 78%;
208
+ }
209
+
210
+ --diffs-hover-mix-target: var(--diffs-decoration-bg);
211
+ --diffs-computed-decoration-bg: light-dark(color-mix(in lab,
212
+ var(--diffs-bg) var(--mix-deco-light),
213
+ var(--diffs-decoration-bg)), color-mix(in lab,
214
+ var(--diffs-bg) var(--mix-deco-dark),
215
+ var(--diffs-decoration-bg)));
216
+ }
217
+ }
218
+
219
+ [data-line-annotation], [data-gutter-buffer="annotation"] {
220
+ --diffs-annotation-bg: var(--diffs-bg-context);
221
+ --diffs-computed-decoration-bg: var(--diffs-annotation-bg);
222
+ --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
223
+ }
224
+
225
+ [data-merge-conflict-actions], [data-gutter-buffer="merge-conflict-action"], [data-gutter-buffer="merge-conflict-marker-base"], [data-gutter-buffer="merge-conflict-marker-separator"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"] {
226
+ --diffs-computed-decoration-bg: var(--diffs-bg-context);
227
+ --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
228
+ }
229
+
230
+ [data-gutter-buffer="merge-conflict-marker-start"], [data-merge-conflict="marker-start"] {
231
+ --diffs-computed-decoration-bg: light-dark(color-mix(in lab,
232
+ var(--diffs-bg) 78%,
233
+ var(--conflict-bg-current-header-override, var(--diffs-addition-base))), color-mix(in lab,
234
+ var(--diffs-bg) 68%,
235
+ var(--conflict-bg-current-header-override, var(--diffs-addition-base))));
236
+ --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
237
+ }
238
+
239
+ [data-gutter-buffer="merge-conflict-marker-end"], [data-merge-conflict="marker-end"] {
240
+ --diffs-computed-decoration-bg: light-dark(color-mix(in lab,
241
+ var(--diffs-bg) 78%,
242
+ var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))), color-mix(in lab,
243
+ var(--diffs-bg) 68%,
244
+ var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))));
245
+ --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
246
+ }
247
+
248
+ [data-has-merge-conflict] [data-line-annotation], [data-has-merge-conflict] [data-gutter-buffer="annotation"] {
249
+ --diffs-computed-decoration-bg: var(--diffs-bg);
250
+ --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
251
+ }
252
+
253
+ :where([data-background]) {
254
+ & [data-gutter-buffer], & [data-column-number] {
255
+ --mix-light: 91%;
256
+ --mix-dark: 85%;
257
+ }
258
+
259
+ & [data-line], & [data-no-newline] {
260
+ --mix-light: 88%;
261
+ --mix-dark: 80%;
262
+ }
263
+
264
+ & [data-gutter-buffer], & [data-column-number], & [data-line], & [data-no-newline] {
265
+ --diffs-diff-line-mix-target: var(--diffs-bg);
266
+
267
+ &[data-line-type="change-deletion"] {
268
+ --diffs-diff-line-mix-target: var(--diffs-bg-deletion-override, var(--diffs-deletion-base));
269
+ --diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
270
+
271
+ &:where([data-gutter-buffer], [data-column-number]) {
272
+ color: var(--diffs-fg-number-deletion-override, var(--diffs-deletion-base));
273
+ --diffs-diff-line-mix-target: var(--diffs-bg-deletion-number-override, var(--diffs-deletion-base));
274
+ }
275
+
276
+ --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
277
+ var(--diffs-computed-decoration-bg) var(--mix-light),
278
+ var(--diffs-diff-line-mix-target)), color-mix(in lab,
279
+ var(--diffs-computed-decoration-bg) var(--mix-dark),
280
+ var(--diffs-diff-line-mix-target)));
281
+ }
282
+
283
+ &[data-line-type="change-addition"] {
284
+ --diffs-diff-line-mix-target: var(--diffs-bg-addition-override, var(--diffs-addition-base));
285
+ --diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
286
+
287
+ &:where([data-gutter-buffer], [data-column-number]) {
288
+ color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
289
+ --diffs-diff-line-mix-target: var(--diffs-bg-addition-number-override, var(--diffs-addition-base));
290
+ }
291
+
292
+ --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
293
+ var(--diffs-computed-decoration-bg) var(--mix-light),
294
+ var(--diffs-diff-line-mix-target)), color-mix(in lab,
295
+ var(--diffs-computed-decoration-bg) var(--mix-dark),
296
+ var(--diffs-diff-line-mix-target)));
297
+ }
298
+
299
+ &[data-merge-conflict="current"] {
300
+ --diffs-diff-line-mix-target: var(--conflict-bg-current-override, var(--diffs-addition-base));
301
+ --diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
302
+
303
+ &:where([data-gutter-buffer], [data-column-number]) {
304
+ color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
305
+ --diffs-diff-line-mix-target: var(--conflict-bg-current-number-override, var(--diffs-addition-base));
306
+ }
307
+
308
+ --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
309
+ var(--diffs-computed-decoration-bg) var(--mix-light),
310
+ var(--diffs-diff-line-mix-target)), color-mix(in lab,
311
+ var(--diffs-computed-decoration-bg) var(--mix-dark),
312
+ var(--diffs-diff-line-mix-target)));
313
+ }
314
+
315
+ &[data-merge-conflict="incoming"] {
316
+ --diffs-diff-line-mix-target: var(--conflict-bg-incoming-override, var(--diffs-modified-base));
317
+ --diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
318
+
319
+ &:where([data-gutter-buffer], [data-column-number]) {
320
+ color: var(--diffs-modified-base);
321
+ --diffs-diff-line-mix-target: var(--conflict-bg-incoming-number-override, var(--diffs-modified-base));
322
+ }
323
+
324
+ --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
325
+ var(--diffs-computed-decoration-bg) var(--mix-light),
326
+ var(--diffs-diff-line-mix-target)), color-mix(in lab,
327
+ var(--diffs-computed-decoration-bg) var(--mix-dark),
328
+ var(--diffs-diff-line-mix-target)));
329
+ }
330
+ }
331
+ }
332
+
333
+ [data-gutter-buffer], [data-column-number], [data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline], [data-editor-overlay] {
334
+ --diffs-selection-mix-target: var(--diffs-bg-selection-override, var(--diffs-selection-base));
335
+ --diffs-selection-emphasis-mix-target: var(--diffs-selection-mix-target);
336
+
337
+ &:where([data-editor-overlay]), &:where([data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline])[data-selected-line] {
338
+ --mix-selection-light: 82%;
339
+ --mix-selection-dark: 75%;
340
+ --diffs-hover-mix-target: var(--diffs-selection-mix-target);
341
+ }
342
+
343
+ &:where([data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line])) {
344
+ --mix-selection-light: 75%;
345
+ --mix-selection-dark: 60%;
346
+ --diffs-selection-mix-target: var(--diffs-bg-selection-number-override, var(--diffs-selection-base));
347
+ --diffs-hover-mix-target: var(--diffs-selection-mix-target);
348
+ }
349
+
350
+ &:where([data-line][data-selected-line]):is([data-line-type="change-addition"], [data-line-type="change-deletion"]) {
351
+ --diffs-selection-emphasis-mix-target: light-dark(color-mix(in lab,
352
+ var(--diffs-diff-line-mix-target, var(--diffs-selection-mix-target))
353
+ var(--mix-selection-light),
354
+ var(--diffs-selection-mix-target)), var(--diffs-selection-mix-target));
355
+ }
356
+
357
+ &:where([data-editor-overlay]), &[data-selected-line] {
358
+ --diffs-computed-selected-line-bg: light-dark(color-mix(in lab,
359
+ var(--diffs-computed-diff-line-bg) var(--mix-selection-light),
360
+ var(--diffs-selection-mix-target)), color-mix(in lab,
361
+ var(--diffs-computed-diff-line-bg) var(--mix-selection-dark),
362
+ var(--diffs-selection-mix-target)));
363
+ }
364
+ }
365
+
366
+ [data-line][data-editor-active-line], [data-column-number][data-editor-active-line] {
367
+ --diffs-computed-editor-active-line-bg: color-mix(in lab,
368
+ var(--diffs-computed-selected-line-bg)
369
+ var(--diffs-editor-active-line-source-mix, 100%),
370
+ var(--diffs-selection-emphasis-mix-target));
371
+ }
372
+
373
+ @media (pointer: fine) {
374
+ [data-line][data-hovered], [data-gutter-buffer][data-hovered], [data-column-number][data-hovered], [data-line-annotation][data-hovered], [data-no-newline][data-hovered], [data-merge-conflict][data-hovered], [data-merge-conflict-actions][data-hovered], [data-editor-overlay][data-hovered] {
375
+ --diffs-computed-hovered-line-bg: light-dark(color-mix(in lab,
376
+ var(--diffs-computed-editor-active-line-bg) 97%,
377
+ var(--diffs-hover-mix-target)), color-mix(in lab,
378
+ var(--diffs-computed-editor-active-line-bg) 91%,
379
+ var(--diffs-hover-mix-target)));
380
+ }
381
+ }
382
+
383
+ [data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line]) {
384
+ color: var(--diffs-selection-number-fg);
385
+ }
386
+
387
+ [data-no-newline] {
388
+ user-select: none;
389
+
390
+ & span {
391
+ opacity: .6;
392
+ }
393
+ }
394
+
395
+ [data-diff-type="split"][data-overflow="scroll"] {
396
+ grid-template-columns: 1fr 1fr;
397
+ display: grid;
398
+
399
+ & [data-additions] {
400
+ border-left: 1px solid var(--diffs-bg);
401
+ }
402
+
403
+ & [data-deletions] {
404
+ border-right: 1px solid var(--diffs-bg);
405
+ }
406
+ }
407
+
408
+ [data-code] {
409
+ grid-auto-flow: dense;
410
+ grid-template-columns: var(--diffs-code-grid);
411
+ overflow: var(--diffs-overflow-override, scroll) clip;
412
+ overscroll-behavior-x: none;
413
+ tab-size: var(--diffs-tab-size, 2);
414
+ padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));
415
+ padding-bottom: max(0px,
416
+ calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) -
417
+ var(--diffs-scrollbar-gutter)));
418
+ scrollbar-gutter: stable;
419
+ align-self: flex-start;
420
+ display: grid;
421
+ }
422
+
423
+ [data-diffs-scrollbar-measure] {
424
+ opacity: 0;
425
+ pointer-events: none;
426
+ scrollbar-gutter: auto;
427
+ grid-template-columns: none;
428
+ width: 100px;
429
+ height: 100px;
430
+ padding: 0;
431
+ position: absolute;
432
+ top: -200px;
433
+ left: -200px;
434
+ }
435
+
436
+ [data-container-size] {
437
+ container-type: inline-size;
438
+ }
439
+
440
+ [data-code]::-webkit-scrollbar {
441
+ width: 0;
442
+ height: var(--diffs-scrollbar-gutter);
443
+ }
444
+
445
+ [data-code]::-webkit-scrollbar-track {
446
+ background: none;
447
+ }
448
+
449
+ [data-code]::-webkit-scrollbar-thumb {
450
+ background-color: #0000;
451
+ background-clip: content-box;
452
+ border: 1px solid #0000;
453
+ border-radius: 3px;
454
+ }
455
+
456
+ [data-code]::-webkit-scrollbar-corner {
457
+ background-color: #0000;
458
+ }
459
+
460
+ @supports ((-moz-appearance: none)) {
461
+ [data-code] {
462
+ scrollbar-width: thin;
463
+ scrollbar-color: var(--diffs-bg-context) transparent;
464
+ padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));
465
+ }
466
+ }
467
+
468
+ [data-diffs-header] ~ [data-diff], [data-diffs-header] ~ [data-file] {
469
+ & [data-code], &[data-overflow="wrap"], &[data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
470
+ padding-top: 0;
471
+ }
472
+ }
473
+
474
+ [data-gutter] {
475
+ grid-template-rows: subgrid;
476
+ grid-template-columns: subgrid;
477
+ z-index: 3;
478
+ background-color: var(--diffs-bg);
479
+ grid-column: 1;
480
+ display: grid;
481
+ position: relative;
482
+
483
+ & [data-gutter-buffer], & [data-column-number] {
484
+ border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));
485
+ }
486
+ }
487
+
488
+ [data-content] {
489
+ grid-template-rows: subgrid;
490
+ grid-template-columns: subgrid;
491
+ background-color: var(--diffs-bg);
492
+ grid-column: 2;
493
+ min-width: 0;
494
+ display: grid;
495
+ }
496
+
497
+ [data-diff-type="split"][data-overflow="wrap"], [data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
498
+ grid-auto-flow: dense;
499
+ grid-template-columns: repeat(2, var(--diffs-code-grid));
500
+ padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
501
+ display: grid;
502
+
503
+ & [data-code] {
504
+ display: contents;
505
+ }
506
+
507
+ & [data-deletions] {
508
+ & [data-gutter] {
509
+ grid-column: 1;
510
+ }
511
+
512
+ & [data-content] {
513
+ border-right: 1px solid var(--diffs-bg);
514
+ grid-column: 2;
515
+ }
516
+ }
517
+
518
+ & [data-additions] {
519
+ & [data-gutter] {
520
+ border-left: 1px solid var(--diffs-bg);
521
+ grid-column: 3;
522
+ }
523
+
524
+ & [data-content] {
525
+ grid-column: 4;
526
+ }
527
+ }
528
+ }
529
+
530
+ [data-dehydrated][data-diff-type="split"][data-overflow="scroll"] [data-content] {
531
+ overflow: clip;
532
+ }
533
+
534
+ [data-overflow="scroll"] [data-gutter] {
535
+ position: sticky;
536
+ left: 0;
537
+ }
538
+
539
+ [data-interactive-lines] [data-line] {
540
+ cursor: pointer;
541
+ }
542
+
543
+ [data-interactive-line-numbers] [data-column-number] {
544
+ cursor: pointer;
545
+ touch-action: none;
546
+ }
547
+
548
+ [data-content-buffer], [data-gutter-buffer] {
549
+ user-select: none;
550
+ min-height: 1lh;
551
+ position: relative;
552
+ }
553
+
554
+ [data-gutter-buffer] {
555
+ padding-left: 2ch;
556
+ padding-right: 1ch;
557
+
558
+ &:before {
559
+ content: "";
560
+ min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
561
+ display: block;
562
+ }
563
+ }
564
+
565
+ [data-gutter-buffer="annotation"] {
566
+ --diffs-annotation-bg: var(--diffs-bg-context-gutter);
567
+ min-height: 0;
568
+ }
569
+
570
+ [data-gutter-buffer="buffer"] {
571
+ --diffs-line-bg: var(--diffs-bg-context-gutter);
572
+ }
573
+
574
+ [data-content-buffer] {
575
+ background-position: 5px 0;
576
+ background-size: 8px 8px;
577
+ background-origin: border-box;
578
+ background-image: repeating-linear-gradient(-45deg,
579
+ transparent,
580
+ transparent calc(3px * 1.414),
581
+ var(--diffs-bg-buffer) calc(3px * 1.414),
582
+ var(--diffs-bg-buffer) calc(4px * 1.414));
583
+ grid-column: 1;
584
+ }
585
+
586
+ [data-separator] {
587
+ box-sizing: content-box;
588
+ background-color: var(--diffs-bg);
589
+ }
590
+
591
+ [data-separator="simple"] {
592
+ min-height: 4px;
593
+ }
594
+
595
+ [data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"], [data-separator="simple"] {
596
+ background-color: var(--diffs-bg-separator);
597
+ }
598
+
599
+ [data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"] {
600
+ height: 32px;
601
+ position: relative;
602
+ }
603
+
604
+ [data-separator-wrapper] {
605
+ user-select: none;
606
+ fill: currentColor;
607
+ background-color: var(--diffs-bg);
608
+ align-items: center;
609
+ height: 100%;
610
+ display: flex;
611
+ position: absolute;
612
+ inset-inline: 0;
613
+ }
614
+
615
+ [data-content] [data-separator-wrapper] {
616
+ display: none;
617
+ }
618
+
619
+ [data-separator="metadata"] [data-separator-wrapper] {
620
+ background-color: var(--diffs-bg-separator);
621
+ height: 100%;
622
+ color: var(--diffs-fg-number);
623
+ white-space: nowrap;
624
+ text-overflow: ellipsis;
625
+ min-width: min-content;
626
+ padding-inline: 1ch;
627
+ inset-inline: 100% auto;
628
+ overflow: hidden;
629
+ }
630
+
631
+ [data-separator="line-info"] {
632
+ margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
633
+
634
+ & [data-separator-wrapper] {
635
+ min-width: 16px;
636
+ }
637
+ }
638
+
639
+ [data-separator="line-info-basic"], [data-separator="metadata"] {
640
+ margin-block: 0;
641
+ }
642
+
643
+ [data-separator="line-info"][data-separator-first] {
644
+ margin-top: 0;
645
+ }
646
+
647
+ [data-separator="line-info"][data-separator-last] {
648
+ margin-bottom: 0;
649
+ }
650
+
651
+ [data-expand-index] [data-separator-wrapper] {
652
+ grid-template-columns: 32px auto;
653
+ display: grid;
654
+ }
655
+
656
+ [data-expand-index] [data-separator-wrapper][data-separator-multi-button] {
657
+ grid-template-columns: 32px 32px auto;
658
+ }
659
+
660
+ [data-expand-button], [data-separator-content] {
661
+ background-color: var(--diffs-bg-separator);
662
+ flex: none;
663
+ align-items: center;
664
+ display: flex;
665
+ }
666
+
667
+ [data-expand-index] [data-separator-content]:hover {
668
+ cursor: pointer;
669
+ text-decoration: underline;
670
+ }
671
+
672
+ [data-expand-button] {
673
+ cursor: pointer;
674
+ min-width: 32px;
675
+ color: var(--diffs-fg-number);
676
+ border-right: 2px solid var(--diffs-bg);
677
+ flex-shrink: 0;
678
+ justify-content: center;
679
+ align-self: stretch;
680
+
681
+ &:hover {
682
+ color: var(--diffs-fg);
683
+ }
684
+
685
+ &[data-expand-all-button] {
686
+ display: none;
687
+ }
688
+ }
689
+
690
+ [data-expand-down] [data-icon] {
691
+ transform: scaleY(-1);
692
+ }
693
+
694
+ [data-separator-content] {
695
+ height: 100%;
696
+ color: var(--diffs-fg-number);
697
+ flex: auto;
698
+ justify-content: flex-start;
699
+ padding: 0 1ch;
700
+ overflow: hidden;
701
+ }
702
+
703
+ [data-separator="line-info"], [data-separator="line-info-basic"] {
704
+ & [data-separator-content] {
705
+ user-select: none;
706
+ height: 100%;
707
+ overflow: clip;
708
+ }
709
+ }
710
+
711
+ [data-unmodified-lines] {
712
+ text-overflow: ellipsis;
713
+ white-space: nowrap;
714
+ flex: 0 auto;
715
+ min-width: 0;
716
+ display: block;
717
+ overflow: hidden;
718
+ }
719
+
720
+ @supports (width: 1cqi) {
721
+ [data-unified] {
722
+ & [data-separator="line-info"] [data-separator-wrapper] {
723
+ padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));
724
+ width: 100cqi;
725
+
726
+ & [data-separator-content] {
727
+ border-radius: 6px;
728
+ }
729
+ }
730
+
731
+ & [data-separator="line-info"][data-expand-index] [data-separator-wrapper] [data-separator-content] {
732
+ border-top-left-radius: unset;
733
+ border-bottom-left-radius: unset;
734
+ }
735
+ }
736
+
737
+ [data-gutter] {
738
+ & [data-separator="line-info"] [data-separator-wrapper] {
739
+ padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));
740
+ }
741
+
742
+ & [data-separator="line-info"] [data-separator-content] {
743
+ border-top-left-radius: 6px;
744
+ border-bottom-left-radius: 6px;
745
+ }
746
+
747
+ & [data-separator="line-info"][data-expand-index] [data-separator-content] {
748
+ border-top-left-radius: unset;
749
+ border-bottom-left-radius: unset;
750
+ }
751
+ }
752
+
753
+ [data-additions] {
754
+ & [data-content] [data-separator="line-info"] {
755
+ background-color: var(--diffs-bg);
756
+
757
+ & [data-separator-wrapper] {
758
+ display: none;
759
+ }
760
+ }
761
+
762
+ & [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
763
+ background-color: var(--diffs-bg-separator);
764
+ border-top-right-radius: 6px;
765
+ border-bottom-right-radius: 6px;
766
+ height: 100%;
767
+ display: block;
768
+
769
+ & [data-separator-content], & [data-expand-button] {
770
+ display: none;
771
+ }
772
+ }
773
+ }
774
+
775
+ [data-overflow="scroll"] [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
776
+ width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));
777
+ }
778
+
779
+ [data-overflow="wrap"] [data-additions] [data-content] [data-separator="line-info"] [data-separator-wrapper] {
780
+ background-color: var(--diffs-bg-separator);
781
+ height: 100%;
782
+ margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));
783
+ border-top-right-radius: 6px;
784
+ border-bottom-right-radius: 6px;
785
+ display: block;
786
+
787
+ & [data-separator-content], & [data-expand-button] {
788
+ display: none;
789
+ }
790
+ }
791
+
792
+ [data-separator="line-info"] [data-separator-wrapper] {
793
+ & [data-expand-both], & [data-expand-down], & [data-expand-up] {
794
+ border-top-left-radius: 6px;
795
+ border-bottom-left-radius: 6px;
796
+ }
797
+ }
798
+
799
+ @media (pointer: fine) {
800
+ [data-separator="line-info"] [data-separator-wrapper] {
801
+ &[data-separator-multi-button] {
802
+ & [data-expand-up] {
803
+ border-top-left-radius: 6px;
804
+ border-bottom-left-radius: unset;
805
+ }
806
+
807
+ & [data-expand-down] {
808
+ border-bottom-left-radius: 6px;
809
+ border-top-left-radius: unset;
810
+ }
811
+ }
812
+ }
813
+ }
814
+ }
815
+
816
+ @media (pointer: coarse) {
817
+ [data-separator="line-info-basic"] [data-separator-wrapper][data-separator-multi-button] {
818
+ grid-template-columns: 34px 34px auto;
819
+
820
+ & [data-separator-content] {
821
+ grid-column: unset;
822
+ grid-row: unset;
823
+ }
824
+ }
825
+
826
+ @supports (width: 1cqi) {
827
+ [data-separator="line-info"] [data-separator-wrapper] {
828
+ & [data-expand-both], & [data-expand-down], & [data-expand-up] {
829
+ border-top-left-radius: 6px;
830
+ border-bottom-left-radius: 6px;
831
+ }
832
+
833
+ &[data-separator-multi-button] {
834
+ & [data-expand-up] {
835
+ border-top-left-radius: 6px;
836
+ border-bottom-left-radius: 6px;
837
+ }
838
+
839
+ & [data-expand-down] {
840
+ border-bottom-left-radius: unset;
841
+ border-top-left-radius: unset;
842
+ }
843
+ }
844
+ }
845
+ }
846
+ }
847
+
848
+ @media (pointer: fine) {
849
+ [data-separator-wrapper][data-separator-multi-button] {
850
+ grid-template-rows: 50% 50%;
851
+ display: grid;
852
+
853
+ & [data-separator-content] {
854
+ grid-area: 1 / 2 / -1;
855
+ min-width: min-content;
856
+ }
857
+
858
+ & [data-expand-button] {
859
+ grid-column: 1;
860
+ }
861
+ }
862
+
863
+ [data-separator="line-info"] [data-separator-wrapper], [data-separator="line-info"] [data-separator-wrapper][data-separator-multi-button] {
864
+ grid-template-columns: 34px auto;
865
+ }
866
+
867
+ [data-separator="line-info-basic"][data-expand-index] [data-separator-wrapper] {
868
+ grid-template-columns: 100% auto;
869
+ }
870
+
871
+ [data-separator="line-info"], [data-separator="line-info-basic"] {
872
+ & [data-separator-multi-button] {
873
+ & [data-expand-up] {
874
+ border-bottom: 1px solid var(--diffs-bg);
875
+ border-right: 2px solid var(--diffs-bg);
876
+ }
877
+
878
+ & [data-expand-down] {
879
+ border-top: 1px solid var(--diffs-bg);
880
+ border-right: 2px solid var(--diffs-bg);
881
+ }
882
+ }
883
+ }
884
+ }
885
+
886
+ [data-additions] [data-gutter] [data-separator-wrapper], [data-additions] [data-separator="line-info-basic"] [data-separator-wrapper], [data-content] [data-separator-wrapper] {
887
+ display: none;
888
+ }
889
+
890
+ [data-line-annotation] {
891
+ min-height: var(--diffs-annotation-min-height, 0);
892
+ z-index: 2;
893
+ }
894
+
895
+ [data-merge-conflict-actions] {
896
+ z-index: 2;
897
+ }
898
+
899
+ [data-separator="custom"] {
900
+ grid-template-columns: subgrid;
901
+ display: grid;
902
+ }
903
+
904
+ [data-line], [data-column-number], [data-no-newline] {
905
+ padding-inline: 1ch;
906
+ position: relative;
907
+ }
908
+
909
+ [data-indicators="classic"] [data-line] {
910
+ padding-inline-start: 2ch;
911
+ }
912
+
913
+ [data-indicators="classic"] {
914
+ & [data-line-type="change-addition"], & [data-line-type="change-deletion"] {
915
+ &[data-no-newline], &[data-line] {
916
+ &:before {
917
+ user-select: none;
918
+ width: 1ch;
919
+ height: 1lh;
920
+ display: inline-block;
921
+ position: absolute;
922
+ top: 0;
923
+ left: 0;
924
+ }
925
+ }
926
+ }
927
+
928
+ & [data-line-type="change-addition"] {
929
+ &[data-line], &[data-no-newline] {
930
+ &:before {
931
+ content: "+";
932
+ color: var(--diffs-addition-base);
933
+ }
934
+ }
935
+ }
936
+
937
+ & [data-line-type="change-deletion"] {
938
+ &[data-line], &[data-no-newline] {
939
+ &:before {
940
+ content: "-";
941
+ color: var(--diffs-deletion-base);
942
+ }
943
+ }
944
+ }
945
+ }
946
+
947
+ [data-indicators="bars"] {
948
+ & [data-line-type="change-deletion"], & [data-line-type="change-addition"] {
949
+ &[data-column-number] {
950
+ &:before {
951
+ content: "";
952
+ user-select: none;
953
+ contain: strict;
954
+ width: 4px;
955
+ height: 100%;
956
+ display: block;
957
+ position: absolute;
958
+ top: 0;
959
+ left: 0;
960
+ }
961
+ }
962
+ }
963
+
964
+ & [data-line-type="change-deletion"] {
965
+ &[data-column-number] {
966
+ &:before {
967
+ background-image: linear-gradient(0deg,
968
+ var(--diffs-bg-deletion) 50%,
969
+ var(--diffs-deletion-base) 50%);
970
+ background-repeat: repeat;
971
+ background-size: 2px 2px;
972
+ background-size: calc(1lh / round(1lh / 2px))
973
+ calc(1lh / round(1lh / 2px));
974
+ }
975
+ }
976
+ }
977
+
978
+ & [data-line-type="change-addition"] {
979
+ &[data-column-number] {
980
+ &:before {
981
+ background-color: var(--diffs-addition-base);
982
+ }
983
+ }
984
+ }
985
+ }
986
+
987
+ [data-overflow="wrap"] {
988
+ & [data-line] {
989
+ white-space: pre-wrap;
990
+ word-break: break-word;
991
+ }
992
+
993
+ & [data-annotation-content] {
994
+ word-break: break-word;
995
+ }
996
+ }
997
+
998
+ [data-overflow="scroll"] [data-line] {
999
+ white-space: pre;
1000
+ min-height: 1lh;
1001
+ }
1002
+
1003
+ [data-column-number] {
1004
+ box-sizing: content-box;
1005
+ text-align: right;
1006
+ user-select: none;
1007
+ color: var(--diffs-fg-number);
1008
+ padding-left: 2ch;
1009
+ }
1010
+
1011
+ [data-line-number-content] {
1012
+ min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
1013
+ z-index: 1;
1014
+ display: inline-block;
1015
+ position: relative;
1016
+ }
1017
+
1018
+ [data-disable-line-numbers] {
1019
+ & [data-gutter-buffer], & [data-column-number] {
1020
+ min-width: 4px;
1021
+ padding: 0;
1022
+
1023
+ &:before {
1024
+ min-width: 0;
1025
+ }
1026
+ }
1027
+
1028
+ & [data-line-number-content] {
1029
+ display: none;
1030
+ }
1031
+
1032
+ & [data-gutter-utility-slot] {
1033
+ right: unset;
1034
+ justify-content: flex-start;
1035
+ left: 0;
1036
+ }
1037
+
1038
+ &[data-indicators="bars"] [data-gutter-utility-slot] {
1039
+ left: 6px;
1040
+ }
1041
+ }
1042
+
1043
+ [data-file][data-disable-line-numbers] {
1044
+ & [data-gutter-buffer], & [data-column-number] {
1045
+ border-right: 0;
1046
+ min-width: 0;
1047
+ }
1048
+ }
1049
+
1050
+ [data-diff-span] {
1051
+ box-decoration-break: clone;
1052
+ border-radius: 3px;
1053
+ }
1054
+
1055
+ [data-line-type="change-addition"] [data-diff-span] {
1056
+ background-color: var(--diffs-bg-addition-emphasis);
1057
+ }
1058
+
1059
+ [data-line-type="change-deletion"] [data-diff-span] {
1060
+ background-color: var(--diffs-bg-deletion-emphasis);
1061
+ }
1062
+
1063
+ [data-merge-conflict="marker-start"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"], [data-merge-conflict="marker-end"] {
1064
+ color: var(--diffs-fg);
1065
+ padding-left: 1ch;
1066
+ }
1067
+
1068
+ [data-merge-conflict="marker-start"], [data-merge-conflict="marker-end"] {
1069
+ align-items: center;
1070
+ display: flex;
1071
+
1072
+ &:after {
1073
+ color: var(--diffs-fg-conflict-marker);
1074
+ font-size: .75rem;
1075
+ font-style: normal;
1076
+ line-height: 1.25rem;
1077
+ font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
1078
+ padding-left: 1ch;
1079
+ }
1080
+ }
1081
+
1082
+ [data-merge-conflict="marker-start"]:after {
1083
+ content: "(Current Change)";
1084
+ }
1085
+
1086
+ [data-merge-conflict="marker-end"]:after {
1087
+ content: "(Incoming Change)";
1088
+ }
1089
+
1090
+ [data-merge-conflict-actions-content] {
1091
+ min-height: 1.75rem;
1092
+ font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
1093
+ color: var(--diffs-fg);
1094
+ align-items: center;
1095
+ gap: .25rem;
1096
+ padding-inline: .5rem;
1097
+ font-size: .75rem;
1098
+ line-height: 1.2;
1099
+ display: flex;
1100
+ }
1101
+
1102
+ [data-merge-conflict-action] {
1103
+ appearance: none;
1104
+ color: var(--diffs-fg-number);
1105
+ font: inherit;
1106
+ cursor: pointer;
1107
+ background: none;
1108
+ border: 0;
1109
+ padding: 0;
1110
+ font-style: normal;
1111
+ }
1112
+
1113
+ [data-merge-conflict-action]:hover {
1114
+ color: var(--diffs-fg);
1115
+ }
1116
+
1117
+ [data-merge-conflict-action="current"]:hover {
1118
+ color: var(--diffs-addition-base);
1119
+ }
1120
+
1121
+ [data-merge-conflict-action="incoming"]:hover {
1122
+ color: var(--diffs-modified-base);
1123
+ }
1124
+
1125
+ [data-merge-conflict-action-separator] {
1126
+ color: var(--diffs-fg-number);
1127
+ opacity: .6;
1128
+ user-select: none;
1129
+ }
1130
+
1131
+ [data-diffs-header="default"] {
1132
+ background-color: var(--diffs-bg);
1133
+ justify-content: space-between;
1134
+ align-items: center;
1135
+ gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
1136
+ min-height: calc(1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3));
1137
+ z-index: 2;
1138
+ flex-direction: row;
1139
+ padding-inline: 16px;
1140
+ display: flex;
1141
+ position: relative;
1142
+ top: 0;
1143
+ }
1144
+
1145
+ [data-header-content] {
1146
+ align-items: center;
1147
+ gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
1148
+ white-space: nowrap;
1149
+ flex-direction: row;
1150
+ min-width: 0;
1151
+ display: flex;
1152
+ }
1153
+
1154
+ [data-header-content] [data-prev-name], [data-header-content] [data-title] {
1155
+ text-overflow: ellipsis;
1156
+ white-space: nowrap;
1157
+ direction: rtl;
1158
+ min-width: 0;
1159
+ overflow: hidden;
1160
+ }
1161
+
1162
+ [data-prev-name] {
1163
+ opacity: .7;
1164
+ }
1165
+
1166
+ [data-rename-icon] {
1167
+ fill: currentColor;
1168
+ flex-grow: 0;
1169
+ flex-shrink: 0;
1170
+ }
1171
+
1172
+ [data-diffs-header="default"] [data-metadata] {
1173
+ white-space: nowrap;
1174
+ align-items: center;
1175
+ gap: 1ch;
1176
+ display: flex;
1177
+ }
1178
+
1179
+ [data-diffs-header="default"] [data-additions-count] {
1180
+ font-family: var(--diffs-font-family, var(--diffs-font-fallback));
1181
+ color: var(--diffs-addition-base);
1182
+ }
1183
+
1184
+ [data-diffs-header="default"] [data-deletions-count] {
1185
+ font-family: var(--diffs-font-family, var(--diffs-font-fallback));
1186
+ color: var(--diffs-deletion-base);
1187
+ }
1188
+
1189
+ [data-change-icon] {
1190
+ fill: currentColor;
1191
+ flex-shrink: 0;
1192
+ }
1193
+
1194
+ [data-change-icon="change"], [data-change-icon="rename-pure"], [data-change-icon="rename-changed"] {
1195
+ color: var(--diffs-modified-base);
1196
+ }
1197
+
1198
+ [data-change-icon="new"] {
1199
+ color: var(--diffs-addition-base);
1200
+ }
1201
+
1202
+ [data-change-icon="deleted"] {
1203
+ color: var(--diffs-deletion-base);
1204
+ }
1205
+
1206
+ [data-change-icon="file"] {
1207
+ opacity: .6;
1208
+ }
1209
+
1210
+ [data-annotation-content] {
1211
+ z-index: 2;
1212
+ isolation: isolate;
1213
+ white-space: normal;
1214
+ align-self: flex-start;
1215
+ min-width: 0;
1216
+ display: flow-root;
1217
+ position: relative;
1218
+ }
1219
+
1220
+ [data-overflow="scroll"] [data-annotation-content], [data-overflow="scroll"] [data-merge-conflict-actions-content] {
1221
+ width: var(--diffs-column-content-width, auto);
1222
+ left: var(--diffs-column-number-width, 0);
1223
+ position: sticky;
1224
+ }
1225
+
1226
+ [data-annotation-slot] {
1227
+ text-wrap-mode: wrap;
1228
+ word-break: normal;
1229
+ white-space-collapse: collapse;
1230
+ }
1231
+
1232
+ [data-gutter-utility-slot] {
1233
+ touch-action: none;
1234
+ justify-content: flex-end;
1235
+ display: flex;
1236
+ position: absolute;
1237
+ top: 0;
1238
+ bottom: 0;
1239
+ right: 0;
1240
+ }
1241
+
1242
+ [data-utility-button] {
1243
+ appearance: none;
1244
+ cursor: pointer;
1245
+ width: 1lh;
1246
+ height: 1lh;
1247
+ font-size: var(--diffs-font-size, 13px);
1248
+ line-height: var(--diffs-line-height, 20px);
1249
+ background-color: var(--diffs-modified-base);
1250
+ color: var(--diffs-bg);
1251
+ fill: currentColor;
1252
+ z-index: 4;
1253
+ touch-action: none;
1254
+ border: none;
1255
+ border-radius: 4px;
1256
+ justify-content: center;
1257
+ align-items: center;
1258
+ margin-right: calc(-1lh + 1ch);
1259
+ padding: 0;
1260
+ display: flex;
1261
+ position: relative;
1262
+
1263
+ &:before {
1264
+ content: "";
1265
+ display: block;
1266
+ position: absolute;
1267
+ inset: 0 0 0 -4px;
1268
+ }
1269
+ }
1270
+
1271
+ [data-decoration-bar-stack] {
1272
+ pointer-events: none;
1273
+ isolation: isolate;
1274
+ z-index: 1;
1275
+ background-color: var(--diffs-decoration-bar-color, transparent);
1276
+ box-sizing: content-box;
1277
+ border-left: 2px solid var(--diffs-bg);
1278
+ border-right: 2px solid var(--diffs-bg);
1279
+ width: 6px;
1280
+ position: absolute;
1281
+ top: 0;
1282
+ bottom: 0;
1283
+ right: -2px;
1284
+
1285
+ [data-decoration-bar-depth="1"] & {
1286
+ background-color: color-mix(in lab,
1287
+ var(--diffs-bg) 20%,
1288
+ var(--diffs-decoration-bar-color, transparent));
1289
+ }
1290
+
1291
+ [data-decoration-bar-depth="2"] & {
1292
+ background-color: color-mix(in lab,
1293
+ var(--diffs-bg) 45%,
1294
+ var(--diffs-decoration-bar-color, transparent));
1295
+ }
1296
+
1297
+ [data-decoration-bar-depth="3"] & {
1298
+ background-color: color-mix(in lab,
1299
+ var(--diffs-bg) 65%,
1300
+ var(--diffs-decoration-bar-color, transparent));
1301
+ }
1302
+
1303
+ [data-decoration-bar-start] & {
1304
+ border-top-left-radius: 5px;
1305
+ border-top-right-radius: 5px;
1306
+ }
1307
+
1308
+ [data-decoration-bar-end] & {
1309
+ z-index: 3;
1310
+ border-bottom-right-radius: 5px;
1311
+ border-bottom-left-radius: 5px;
1312
+ }
1313
+ }
1314
+
1315
+ [data-placeholder] {
1316
+ contain: strict;
1317
+ }
1318
+
1319
+ [data-error-wrapper] {
1320
+ padding: var(--diffs-gap-block, var(--diffs-gap-fallback))
1321
+ var(--diffs-gap-inline, var(--diffs-gap-fallback));
1322
+ scrollbar-width: none;
1323
+ max-height: 400px;
1324
+ overflow: auto;
1325
+
1326
+ & [data-error-message] {
1327
+ color: var(--diffs-deletion-base);
1328
+ font-size: 18px;
1329
+ font-weight: bold;
1330
+ }
1331
+
1332
+ & [data-error-stack] {
1333
+ color: var(--diffs-fg-number);
1334
+ }
1335
+ }
1336
+ }
1337
+
1338
+ @layer theme, rendered, unsafe;
1339
+ `;let xt;function ct(e){if(xt!=null)return xt;const t=e.host;if(typeof HTMLElement<"u"&&t instanceof HTMLElement&&!t.isConnected)return;const n=document.createElement("div");n.setAttribute("data-code",""),n.setAttribute(yo,"true");const i=document.createElement("div");return i.style.position="relative",i.style.width="200%",i.style.height="200%",n.appendChild(i),e.appendChild(n),xt=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),xt}function Lr(e){return`${Vi}: ${e==null?"var(--diffs-scrollbar-gutter-fallback)":`${e}px`};`}const kr="@layer base, theme, rendered, unsafe;",ca=new RegExp(`${ua(Vi)}\\s*:\\s*[^;]+;`);function wr(e){return`${kr}
1340
+ @layer unsafe {
1341
+ ${e}
1342
+ }`}function Er(e,t="system",n){return`${kr}
1343
+ @layer rendered {
1344
+ :host {${t==="system"?"":`
1345
+ color-scheme: ${t};`}
1346
+ ${Lr(n)}
1347
+ ${e}
1348
+ }
1349
+ }`}function Rr(e,t){const n=Lr(t);return e.replace(ca,n)}function ua(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ot({code:e,pre:t,columnType:n,rowSpan:i,containerSize:r=!1}={}){return e==null&&(e=document.createElement("code"),e.setAttribute("data-code",""),n!=null&&e.setAttribute(`data-${n}`,""),t?.appendChild(e)),i!=null?e.style.setProperty("grid-row",`span ${i}`):e.style.removeProperty("grid-row"),r?e.setAttribute("data-container-size",""):e.removeAttribute("data-container-size"),e}function Tr(e,t){if(t==null)return;const n=e.shadowRoot??e.attachShadow({mode:"open"});n.innerHTML===""&&(n.innerHTML=t)}function Ar(e,{type:t,diffIndicators:n,disableBackground:i,disableLineNumbers:r,overflow:o,split:s,totalLines:l,customProperties:a}){if(a!=null)for(const h in a){const d=a[h];d!=null&&e.setAttribute(h,`${d}`)}switch(t==="diff"?(e.setAttribute("data-diff",""),e.removeAttribute("data-file")):(e.setAttribute("data-file",""),e.removeAttribute("data-diff")),n){case"bars":case"classic":e.setAttribute("data-indicators",n);break;case"none":e.removeAttribute("data-indicators");break}return r?e.setAttribute("data-disable-line-numbers",""):e.removeAttribute("data-disable-line-numbers"),i?e.removeAttribute("data-background"):e.setAttribute("data-background",""),t==="diff"?e.setAttribute("data-diff-type",s?"split":"single"):e.removeAttribute("data-diff-type"),e.setAttribute("data-overflow",o),e.style.setProperty("--diffs-min-number-column-width-default",`${`${l}`.length}ch`),e}function Yt(e){if(typeof HTMLStyleElement<"u"&&e instanceof HTMLStyleElement)return!0;const t=e.tagName??e.nodeName;return typeof t=="string"&&t.toLowerCase()==="style"}function Hr(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function li(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:Hr(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader!=null?"custom":"default"}}function kn(e,t){const n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=""}}function Mr({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===""){t?.remove();return}return t??=fa(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function fa(){const e=document.createElement("style");return e.setAttribute(Co,""),e}let pa,ga;function fh(){return pa??=/macOS|MacIntel|iPhone|iPad|iPod/i.test(ma())}function Ir(){return ga??="safari"in window&&"pushNotification"in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function ma(){const e=globalThis.navigator;return e?.platform??e?.userAgentData?.platform??"unknown"}if(typeof HTMLElement<"u"&&customElements.get("diffs-container")==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;const i=this.attachShadow({mode:"open"});e==null&&(e=new CSSStyleSheet,e.replaceSync(ha)),i.adoptedStyleSheets=[e]}connectedCallback(){ct(this.shadowRoot??this.attachShadow({mode:"open"}))}}customElements.define(xo,t)}const va=[""];let ba=-1;var Dr=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++ba}`;type="file";fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;renderRange;enabled=!0;editor;constructor(t={theme:G},n,i=!1){this.options=t,this.workerManager=n,this.isContainerManaged=i,this.fileRenderer=new aa(t,this.handleHighlightRender,this.workerManager),this.resizeManager=new Yi,this.interactionManager=new Ki("file",Gt(t)),this.workerManager?.subscribeToThemeChanges(this)}handleHighlightRender=()=>{this.rerender()};rerender(){!this.enabled||this.file==null||this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}__getCurrentFile(){return this.file}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(t){t!=null&&(this.options=t,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Gt(this.options))}mergeOptions(t){this.options={...this.options,...t}}setThemeType(t){(this.options.themeType??"system")!==t&&(this.mergeOptions({themeType:t}),this.applyCachedThemeState(t))}applyCachedThemeState(t){if(typeof this.options.theme=="string"||this.fileContainer==null||this.appliedThemeCSS==null)return!1;const n=this.appliedThemeCSS.baseThemeType??t;return this.appliedThemeCSS.themeType===n?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,t,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!pt(this.appliedThemeCSS.theme,this.options.theme??G)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(t){this.lineAnnotations=t}setSelectedLines(t,n){this.interactionManager.setSelection(t,n)}setEditorActiveLine(t,n){this.interactionManager.setEditorActiveLine(t,{lineNumberOnly:n?.lineNumberOnly,side:n?.side??"additions"})}getCodeScrollLeft(){return this.code?.scrollLeft??0}setCodeScrollLeft(t){this.code!=null&&(this.code.scrollLeft=t)}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions()}}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}const{overflow:t="scroll"}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t==="wrap",columnVariables:this.shouldApplyColumnVariables(t)?"apply":"measure"}),this.managersDirty=!1}shouldApplyColumnVariables(t){return t==="scroll"&&this.lineAnnotations.length>0}cleanUp(t=!1){this.emitPostRender(!0),this.editor?.cleanUp(t),this.editor=void 0,this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,t||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.pre=void 0,this.code=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,t||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,t?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(t){const{fileContainer:n,prerenderedHTML:i,preventEmit:r=!1,file:o,lineAnnotations:s}=t;if(!this.enabled)throw new Error("File.hydrate: attempting to call hydrate after cleaned up");if(this.fileContainer!=null)throw new Error("File.hydrate: hydrate can only be called before the instance has rendered or hydrated");this.hydrateElements(n,i),Sa(this.pre,o,this.options.collapsed)||ya(this.headerElement,o,this.options.disableFileHeader)?this.render({...t,preventEmit:!0}):this.hydrationSetup({file:o,lineAnnotations:s}),r||this.emitPostRender()}hydrateElements(t,n){this.fileContainer!==t&&this.emitPostRender(!0),Tr(t,n);for(const i of Array.from(t.shadowRoot?.children??[])){if(i instanceof SVGElement){this.spriteSVG=i;continue}if(i instanceof HTMLElement){if(i instanceof HTMLPreElement){this.pre=i,this.appliedPreAttributes=void 0;continue}if(i instanceof HTMLStyleElement&&i.hasAttribute("data-theme-css")){this.themeCSSStyle=i;continue}if(i instanceof HTMLStyleElement&&i.hasAttribute("data-unsafe-css")){this.unsafeCSSStyle=i,this.appliedUnsafeCSS=i.textContent;continue}if("diffsHeader"in i.dataset){this.headerElement=i,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute("data-dehydrated")),this.fileContainer=t,this.hydrateMeasuredScrollbar()}hydrationSetup({file:t,lineAnnotations:n}){this.lineAnnotations=n??this.lineAnnotations,this.file=t,this.fileRenderer.setOptions(li(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(t),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(t=this.file){return t!=null?this.fileRenderer.getOrCreateLineCache(t):va}updateBuffers(t){this.pre!=null&&this.applyBuffers(this.pre,t)}syncRenderViewToEditor(){const t=this.editor,n=this.fileContainer,i=this.file,r=this.lineAnnotations,o=this.renderRange;t!=null&&n!=null&&i!=null&&this.fileRenderer.initializeHighlighter().then(s=>{!this.enabled||this.editor!==t||this.fileContainer!==n||this.file!==i||t.__syncRenderView(s,n,i,r,o)})}attachEditor(t){this.editor?.cleanUp(),this.editor=t,this.fileRenderer.beginEditSession();const n=this.file==null?void 0:t.__prepareFile?.(this.file);return n!==void 0&&n!==this.file?this.renderPreparedFile({file:n,forceRender:!0,preventEmit:!0,renderRange:this.renderRange}):this.fileRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),()=>{this.editor=void 0,this.fileRenderer.endEditSession()}}applyDocumentChange(t,n){this.fileRenderer.applyDocumentChange(t),n!=null&&n!==this.lineAnnotations&&this.file!=null&&(this.setLineAnnotations(n),this.fileRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations())}updateRenderCache(t,n,i){this.fileRenderer.updateRenderCache(t,n,i?.lineCountChangeInFlight)}render(t){if(!this.enabled)throw new Error("File.render: attempting to call render after cleaned up");const n=this.editor?.__prepareFile?.(t.file)??t.file;return this.renderPreparedFile(n===t.file?t:{...t,file:n})}renderPreparedFile({file:t,fileContainer:n,forceRender:i=!1,preventEmit:r=!1,containerWrapper:o,deferManagers:s=!1,lineAnnotations:l,renderRange:a}){this.editor?.__postponeBgTokenizeToNextFrame();const{collapsed:h=!1,themeType:d="system"}=this.options,c=h?void 0:a,u=this.renderRange,p=this.hasThemeChanged(),g=l!=null&&(l.length>0||this.lineAnnotations.length>0)?l!==this.lineAnnotations:!1,S=!Se(this.file,t)||this.fileRenderer.hasUnkeyedFileContentsChanged(t);if(!h&&!i&&en(c,this.renderRange)&&!S&&!g&&!p)return this.applyCachedThemeState(d);this.renderRange=c,S&&(this.cachedHeaderHTML=void 0),this.file=t,this.fileRenderer.setOptions(li(this.options)),this.syncInteractionOptions(),l!=null&&this.setLineAnnotations(l),this.fileRenderer.setLineAnnotations(this.lineAnnotations);const{disableErrorHandling:C=!1,disableFileHeader:b=!1}=this.options;if(b&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),n=this.getOrCreateFileContainerNode(n,o),this.applyCachedThemeState(d),h){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{const f=this.fileRenderer.renderFile(t,Bi);f!=null&&this.applyThemeState(n,f.themeStyles,d,f.baseThemeType),f?.headerAST!=null&&this.applyHeaderToDOM(f.headerAST,n),this.injectUnsafeCSS()}catch(f){if(C)throw f;console.error(f),f instanceof Error&&this.applyErrorToDOM(f,n)}return r||this.emitPostRender(),!0}try{const f=this.getOrCreatePreNode(n);if(!this.canPartiallyRender(i,g,S||p)||!this.applyPartialRender(u,c)){const m=this.fileRenderer.renderFile(t,c);if(m==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(n,m.themeStyles,d,m.baseThemeType),m.headerAST!=null&&this.applyHeaderToDOM(m.headerAST,n),this.applyFullRender(m,f)}this.applyBuffers(f,c),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,s||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(f){if(C)throw f;console.error(f),f instanceof Error&&this.applyErrorToDOM(f,n)}return r||this.emitPostRender(),!0}emitPostRender(t=!1){const{fileContainer:n,options:{onPostRender:i}}=this;if(t){if(!this.mounted||(this.mounted=!1,n==null))return;i?.(n,this,"unmount");return}if(n==null)return;const r=this.mounted?"update":"mount";this.mounted=!0,i?.(n,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(const{element:t}of this.annotationCache.values())t.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(t,n,i){return!(t||n||i)}renderPlaceholder(t){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){const n=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",n.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty("height",`${t}px`),!0}async primeHighlightCache(t=this.file){const{workerManager:n}=this;if(t==null||n==null||!n.isWorkingPool()||t.cacheKey==null||Ln(t))return;const i=this.options.tokenizeMaxLength??1e5;this.fileRenderer.getOrCreateLineCache(t).length>i||await n.primeFileHighlightCache(t).catch(r=>{console.error(r)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(const{element:i}of this.annotationCache.values())i.remove();this.annotationCache.clear();return}const t=new Map(this.annotationCache),{renderAnnotation:n}=this.options;if(n!=null&&this.lineAnnotations.length>0)for(const[i,r]of this.lineAnnotations.entries()){const o=`${i}-${Re(r)}`;let s=this.annotationCache.get(o);if(s==null||!la(r,s.annotation)){s?.element.remove();const l=n(r);if(l==null)continue;s={element:yr(Re(r)),annotation:r},s.element.appendChild(l),this.fileContainer.appendChild(s.element),this.annotationCache.set(o,s)}t.delete(o)}for(const[i,{element:r}]of t.entries())this.annotationCache.delete(i),r.remove()}renderGutterUtility(){const{renderGutterUtility:t}=this.options;if(this.fileContainer==null||t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}const n=t(this.interactionManager.getHoveredLine);if(n!=null&&this.gutterUtilityContent!=null)return;if(n==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}const i=Cr();i.appendChild(n),this.fileContainer.appendChild(i),this.gutterUtilityContent=i}injectUnsafeCSS(){const{unsafeCSS:t}=this.options,n=this.fileContainer?.shadowRoot;if(n!=null){if(t==null||t===""){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}this.unsafeCSSStyle?.parentNode===n&&this.appliedUnsafeCSS===t||(this.unsafeCSSStyle??=xr(),this.unsafeCSSStyle.parentNode!==n&&n.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=wr(t),this.appliedUnsafeCSS=t)}}applyThemeState(t,n,i,r){const o=t.shadowRoot??t.attachShadow({mode:"open"}),s=r??i,l=this.options.theme??G,a=typeof l=="string"?l:{...l},h=ct(o);if(this.themeCSSStyle?.parentNode===o&&this.appliedThemeCSS?.themeStyles===n&&this.appliedThemeCSS.themeType===s&&this.appliedThemeCSS.scrollbarGutter===h){this.appliedThemeCSS.theme=a;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===o){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:a,themeStyles:n,themeType:s,baseThemeType:r,scrollbarGutter:h};return}this.themeCSSStyle=Mr({shadowRoot:o,currentNode:this.themeCSSStyle,themeCSS:Er(n,s,h)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:a,themeStyles:n,themeType:s,baseThemeType:r,scrollbarGutter:h}:void 0}hydrateMeasuredScrollbar(){const t=this.fileContainer?.shadowRoot;t==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=Rr(this.themeCSSStyle.textContent??"",ct(t)))}shouldGuardRebuildScroll(){return this.editor!=null&&Ir()}applyFullRender(t,n){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(n,t);const i=this.code=Ot({code:this.code}),r=this.fileRenderer.renderCodeAST(t);this.editor?.__captureFocusForDOMReplacement();const o=()=>{if(i.childElementCount>=2)for(let s=0;s<2;s++){const l=i.children[s],a=r[s];l.innerHTML=te(a.children),l.style.cssText=a.properties.style}else i.innerHTML=te(r);n.contains(i)||n.replaceChildren(i)};this.shouldGuardRebuildScroll()?kn(n,o):o(),this.lastRowCount=t.rowCount}applyPartialRender(t,n){if(t==null||n==null)return!1;const{file:i,code:r}=this,o=r!=null?this.getColumns(r):void 0;if(i==null||r==null||o==null)return!1;const s=t.startingLine,l=n.startingLine,a=t.totalLines===1/0?Number.POSITIVE_INFINITY:s+t.totalLines,h=n.totalLines===1/0?Number.POSITIVE_INFINITY:l+n.totalLines,d=Math.max(s,l),c=Math.min(a,h);if(c<=d)return!1;if(!this.trimDOMToOverlap(o.gutter,d,c)||!this.trimDOMToOverlap(o.content,d,c))throw new Error("File.applyPartialRender: failed to trim to overlap");let{length:u}=o.content.children;const p=(b,f)=>{if(!(f<=0))return this.fileRenderer.renderFile(i,{startingLine:b,totalLines:f,bufferBefore:0,bufferAfter:0})},g=l<d?p(l,d-l):void 0;if(g===void 0&&l<d)return!1;const S=h===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:Math.max(0,h-c),C=h>c?p(c,S):void 0;return C===void 0&&h>c?!1:(this.cleanupErrorWrapper(),g!=null&&(o.gutter.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(g.gutterAST)),o.content.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(g.contentAST)),u+=g.rowCount),C!=null&&(o.gutter.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(C.gutterAST)),o.content.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(C.contentAST)),u+=C.rowCount),this.lastRowCount!==u&&(o.gutter.style.setProperty("grid-row",`span ${u}`),o.content.style.setProperty("grid-row",`span ${u}`),this.lastRowCount=u),!0)}getColumns(t){const n=t.children[0],i=t.children[1];if(!(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||n.dataset.gutter==null||i.dataset.content==null))return{gutter:n,content:i}}trimDOMToOverlap(t,n,i){const r=this.getDOMBoundaryIndices(t,[n,i]),o=r.get(n)??t.children.length,s=r.get(i)??t.children.length;if(o>s)return!1;for(let l=t.children.length-1;l>=s;l-=1)t.children[l]?.remove();for(let l=o-1;l>=0;l-=1)t.children[l]?.remove();return!0}getDOMBoundaryIndices(t,n){const i=[...new Set(n)].sort((a,h)=>a-h),r=new Map;if(i.length===0)return r;let o=0,s=i[o];const{children:l}=t;s===0&&(r.set(0,0),o+=1,s=i[o]);for(let a=0;a<l.length;a+=1){const h=l[a];if(!(h instanceof HTMLElement))continue;const d=this.getLineIndexFromDOMNode(h);if(d!=null){for(;s!=null&&d>=s;)r.set(s,a),o+=1,s=i[o];if(o>=i.length)break}}for(const a of i)r.has(a)||r.set(a,l.length);return r}getLineIndexFromDOMNode(t){const n=t.dataset.lineIndex;if(n==null)return;const i=Number(n);return Number.isNaN(i)?void 0:i}applyBuffers(t,n){if(n==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}n.bufferBefore>0?(this.bufferBefore==null&&(this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",t.before(this.bufferBefore)),this.bufferBefore.style.setProperty("height",`${n.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),n.bufferAfter>0?(this.bufferAfter==null&&(this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",t.after(this.bufferAfter)),this.bufferAfter.style.setProperty("height",`${n.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(t,n){const{file:i}=this;if(i==null)return;this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;const r=this.cachedHeaderHTML??te(t);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){const h=document.createElement("div");h.innerHTML=r;const d=h.firstElementChild;if(!(d instanceof HTMLElement))return;this.headerElement!=null?n.shadowRoot?.replaceChild(d,this.headerElement):n.shadowRoot?.prepend(d),this.headerElement=d,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;const{renderHeaderPrefix:o,renderHeaderFilenameSuffix:s,renderCustomHeader:l,renderHeaderMetadata:a}=this.options;if(l!=null){const h=l(i)??void 0;this.headerCustom=this.upsertHeaderSlotElement(n,this.headerCustom,Fn,h),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{const h=o?.(i)??void 0,d=s?.(i)??void 0,c=a?.(i)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(n,this.headerPrefix,zn,h),this.headerFilenameSuffix=this.upsertHeaderSlotElement(n,this.headerFilenameSuffix,On,d),this.headerMetadata=this.upsertHeaderSlotElement(n,this.headerMetadata,Nn,c),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(t,n,i,r){if(r==null){n?.remove();return}const o=n??this.createHeaderSlotElement(i);return n==null&&t.appendChild(o),this.replaceHeaderSlotContent(o,r),o}replaceHeaderSlotContent(t,n){t.replaceChildren(),n instanceof Element?t.appendChild(n):t.innerText=`${n}`}createHeaderSlotElement(t){const n=document.createElement("div");return n.slot=t,n}getOrCreateFileContainerNode(t,n){const{fileContainer:i}=this,r=t??i??document.createElement("diffs-container"),o=i!==r;return i!=null&&o&&this.editor?.__captureFocusForDOMReplacement(),o&&this.emitPostRender(!0),this.fileContainer=r,i!=null&&o&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),n!=null&&this.fileContainer.parentNode!==n&&n.appendChild(this.fileContainer),o&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(t){const{shadowRoot:n}=t;if(n!=null)for(const i of n.children)i instanceof SVGElement?this.spriteSVG??=i:Yt(i)&&i.hasAttribute("data-theme-css")?(this.themeCSSStyle??=i,this.hasAdoptedThemeCSS=!0):Yt(i)&&i.hasAttribute("data-unsafe-css")&&(this.unsafeCSSStyle??=i,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(t){const n=t.shadowRoot??t.attachShadow({mode:"open"});if(this.spriteSVG==null){const i=document.createElement("div");i.innerHTML=br;const r=i.firstChild;r instanceof SVGElement&&(this.spriteSVG=r)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==n&&n.appendChild(this.spriteSVG)}getOrCreatePreNode(t){const n=t.shadowRoot??t.attachShadow({mode:"open"});return this.pre==null?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.code=void 0,n.appendChild(this.pre)):this.pre.parentNode!==n&&(this.editor?.__captureFocusForDOMReplacement(),t.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(t){this.code=void 0;for(const n of Array.from(t.children))if(n instanceof HTMLElement&&n.hasAttribute("data-code")){this.code=n;return}}applyPreNodeAttributes(t,{totalLines:n}){const{overflow:i="scroll",disableLineNumbers:r=!1}=this.options,o={type:"file",split:!1,overflow:i,disableLineNumbers:r,diffIndicators:"none",disableBackground:!0,totalLines:n};Sr(o,this.appliedPreAttributes)||(Ar(t,o),this.appliedPreAttributes=o)}applyErrorToDOM(t,n){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;const i=n.shadowRoot??n.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",i.appendChild(this.errorWrapper);const r=document.createElement("div");r.dataset.errorMessage="",r.innerText=t.message,this.errorWrapper.appendChild(r);const o=document.createElement("pre");o.dataset.errorStack="",o.innerText=t.stack??"No Error Stack",this.errorWrapper.appendChild(o)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Sa(e,t,n=!1){return!n&&e==null&&t!=null}function ya(e,t,n=!1){return e==null&&t!=null&&!n}function Nt(e){return{...Un,...e}}function ye(e,t){const n=Ca(e,t);return t?n:e.diffHeaderHeight+n}function Ca(e,t){return e.paddingTop??(t?e.spacing:0)}function Qt(e){return e.paddingBottom??e.spacing}function xa(e){switch(e){case"simple":return 4;case"metadata":case"line-info":case"line-info-basic":case"custom":return 32}}const La=5e3;let ka=-1;function wa(e,t){return(e.overflow??"scroll")!==(t.overflow??"scroll")||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS}var Ea=class extends Dr{virtualizer;metrics;__id=`virtualized-file:${++ka}`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0};isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=Un,i,r=!1){super(e,i,r),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){const n=Nt(e);!t&&$t(this.metrics,n)||(this.metrics=n,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}hasLineAnnotations(){return this.lineAnnotations.some(e=>e.lineNumber>0)}getLineHeight(e,t=!1){const n=this.cache.heights.get(e);if(n!=null)return n;const i=t?2:1;return this.metrics.lineHeight*i}setOptions(e){if(this.isAdvancedMode())throw new Error("VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(e==null)return;const{options:t}=this,n=!ji(t,e),i=wa(t,e);super.setOptions(e),i&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,i)}setThemeType(e){if(this.isAdvancedMode())throw new Error("VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.");super.setThemeType(e)}resetLayoutCache(e=!1,t=!0){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.renderRange!=null&&t&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){let e=!1;if(this.fileContainer==null||this.file==null)return this.height!==0&&(e=!0),this.height=0,e;const{overflow:t="scroll"}=this.options;if(this.top=this.getVirtualizedTop(),t==="scroll"&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled()||this.code==null)return e;const n=this.code.children[1];if(!(n instanceof HTMLElement))return e;const i=Cn(this.lineAnnotations);if(this.renderRange!=null&&i&&tn(this.renderRange)){const r=Ra(n)??0;r!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=r,e=!0)}else!i&&this.cache.fileAnnotationHeight!==0&&(this.cache.fileAnnotationHeight=0,e=!0);for(const r of n.children){if(!(r instanceof HTMLElement))continue;const o=r.dataset.lineIndex;if(o==null)continue;const s=Number(o);let l=r.getBoundingClientRect().height,a=!1;r.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in r.nextElementSibling.dataset||"noNewline"in r.nextElementSibling.dataset)&&("noNewline"in r.nextElementSibling.dataset&&(a=!0),l+=r.nextElementSibling.getBoundingClientRect().height);const h=this.getLineHeight(s,a);l!==h&&(e=!0,l===this.metrics.lineHeight*(a?2:1)?this.cache.heights.delete(s):this.cache.heights.set(s,l))}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null||this.file==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render({file:this.file}));prepareCodeViewItem(e,t,n,i){const r=this.syncLineAnnotations(i),o=!Se(this.file,e)||this.fileRenderer.hasUnkeyedFileContentsChanged(e);let s=n?.resetFileLayoutCache===!0||o||r;n?.metrics!=null&&(this.metrics=n.metrics,s=!0);const{collapsed:l=!1}=this.options;return this.currentCollapsed!==l&&(this.currentCollapsed=l,s=!0),s&&this.resetLayoutCache(),this.file!==e&&(this.layoutDirty=!0),this.file=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e){if(this.file==null||e<1)return;const{disableFileHeader:t=!1,collapsed:n=!1}=this.options,i=this.fileRenderer.getLineCount(this.file)-1;let r=ye(this.metrics,t);if(n||i<0)return{top:r,height:0};const o=Math.min(Math.max(e-1,0),i),{overflow:s="scroll"}=this.options,{lineHeight:l}=this.metrics;if(r+=this.cache.fileAnnotationHeight,s==="scroll"&&!this.hasLineAnnotations())return{top:r+o*l,height:l};const a=this.getLayoutCheckpointBeforeLineIndex(o);r=a?.top??r;for(let h=a?.lineIndex??0;h<o;h++)r+=this.getLineHeight(h,!1);return{top:r,height:this.getLineHeight(o,!1)}}getEditorViewport(){return this.virtualizer.type==="simple"?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){if(this.file==null||this.renderRange==null)return;const{disableFileHeader:t=!1,collapsed:n=!1,overflow:i="scroll"}=this.options;if(n||this.renderRange.totalLines<=0)return;const r=this.fileRenderer.getLineCount(this.file)-1;if(r<0)return;const o=ye(this.metrics,t),s=Math.min(this.renderRange.startingLine,r),l=Math.min(s+this.renderRange.totalLines-1,r);if(l<s)return;const{fileAnnotationHeight:a}=this.cache;if(i==="scroll"&&!this.hasLineAnnotations()){const{lineHeight:d}=this.metrics,c=o+(s===0?a:this.renderRange.bufferBefore),u=s+Math.max(Math.ceil((e-c)/d),0);return u>l?void 0:{lineNumber:u+1,top:o+a+u*d}}let h=o+(s===0?a:this.renderRange.bufferBefore);for(let d=s;d<=l;d++){if(h>=e)return{lineNumber:d+1,top:h};h+=this.getLineHeight(d)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.file==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};const t=e!=null?this.computeRenderRangeFromWindow(this.file,this.top,e):this.renderRange;if(t==null)return;const{bufferBefore:n,bufferAfter:i,totalLines:r}=t;let o=0;if(r===0){const s=e??this.virtualizer.getWindowSpecs();this.top<s.top&&(o=i)}return{topOffset:this.top+n+o,height:this.height-(n+i)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache(),this.isSetup=!1,super.cleanUp(e)}computeApproximateSize(e=!1,t=this.file){const n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;const i=this.height===0;if(this.height=0,this.cache.checkpoints=[],t==null){this.layoutDirty=!1;return}const{disableFileHeader:r=!1,collapsed:o=!1,overflow:s="scroll"}=this.options,{lineHeight:l}=this.metrics,a=this.fileRenderer.getLineCount(t),h=ye(this.metrics,r),d=Qt(this.metrics);if(this.height+=h,o){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,s==="scroll"&&!this.hasLineAnnotations())this.height+=a*l;else for(let c=0;c<a;c++)this.addLayoutCheckpoint(c,this.height),this.height+=this.getLineHeight(c,!1);if(a>0&&(this.height+=d),this.fileContainer!=null&&n&&!i){const c=this.fileContainer.getBoundingClientRect();c.height!==this.height?console.log("VirtualizedFile.computeApproximateSize: computed height doesnt match",{name:t.name,elementHeight:c.height,computedHeight:this.height}):console.log("VirtualizedFile.computeApproximateSize: computed height IS CORRECT")}this.layoutDirty=!1}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||this.file==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}applyDocumentChange(e,t,n=!1){const{renderRange:i}=this;if(this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(this.isSimpleMode(),!1),!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&i!==void 0&&this.file!==void 0){const r=this.virtualizer.getWindowSpecs(),o=this.computeRenderRangeFromWindow(this.file,this.top??0,r);o.bufferAfter!==i.bufferAfter&&this.updateBuffers(o)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}renderPreparedFile({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:i,...r}){const o=this.file==null||!Se(this.file,t)||this.fileRenderer.hasUnkeyedFileContentsChanged(t),{forceRenderOverride:s,isSetup:l}=this;this.forceRenderOverride=void 0;const a=this.syncLineAnnotations(i);if(a&&this.resetLayoutCache(),e=this.getOrCreateFileContainerNode(e),t==null)return console.error("VirtualizedFile.render: attempting to virtually render when we dont have file"),!1;if(l)this.top??=this.getVirtualizedTop(),o&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(!1),this.computeApproximateSize(!1,t));else{this.computeApproximateSize(!1,t);const p=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(p==null)throw new Error("VirtualizedFile.render: simple virtualizer is not available");p.connect(e,this),this.isVisible=p.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!o||!l))return this.file=t,o&&(this.cachedHeaderHTML=void 0),this.renderPlaceholder(this.height);const h=this.virtualizer.getWindowSpecs(),d=this.top??0,c=this.computeRenderRangeFromWindow(t,d,h),u=super.renderPreparedFile({file:t,fileContainer:e,renderRange:c,lineAnnotations:i,forceRender:(s??n)||a||o,...r});return this.isSimpleMode()&&u&&this.getSimpleVirtualizer()?.requestHeightReconcile(this),u}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type==="simple"}isAdvancedMode(){return this.virtualizer.type==="advanced"}addLayoutCheckpoint(e,t){e%La===0&&this.cache.checkpoints.push({lineIndex:e,top:t})}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,i;for(;t<=n;){const r=t+n>>1,o=this.cache.checkpoints[r];if(o==null)throw new Error("VirtualizedFile: invalid checkpoint index");o.lineIndex<=e?(i=o,t=r+1):n=r-1}return i}getLayoutCheckpointBeforeTop(e,t){let n=0,i=this.cache.checkpoints.length-1,r=-1;for(;n<=i;){const o=n+i>>1,s=this.cache.checkpoints[o];if(s==null)throw new Error("VirtualizedFile: invalid checkpoint index");s.top<=e?(r=o,n=o+1):i=o-1}if(t==null)return r>=0?this.cache.checkpoints[r]:void 0;for(let o=r;o>=0;o--){const s=this.cache.checkpoints[o];if(s==null)throw new Error("VirtualizedFile: invalid checkpoint index");if(s.lineIndex%t===0)return s}}getVirtualizedTop(){return this.virtualizer.type==="advanced"?this.virtualizer.getLocalTopForInstance(this):this.fileContainer!=null?this.virtualizer.getOffsetInScrollContainer(this.fileContainer):0}getSimpleVirtualizer(){return this.virtualizer.type==="simple"?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type==="advanced"?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}computeRenderRangeFromWindow(e,t,{top:n,bottom:i}){const{disableFileHeader:r=!1,overflow:o="scroll"}=this.options,{hunkLineCount:s,lineHeight:l}=this.metrics,a=this.fileRenderer.getLineCount(e),h=this.height,d=ye(this.metrics,r),c=a>0?Qt(this.metrics):0,{fileAnnotationHeight:u}=this.cache,p=d+u,g=Math.max(0,h-d-u-c),S=Cn(this.lineAnnotations),C=t+d,b=u>0&&S&&C<i&&C+u>n;if(t<n-h||t>i)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:h-d-c};if(a<=s)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};const f=Math.ceil(Math.max(i-n,0)/l),m=Math.ceil(f/s)*s+s,y=m/s,v=(n+i)/2;if(o==="scroll"&&!this.hasLineAnnotations()){const B=t+p,Z=B+g;if(!b&&!(B<i&&Z>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:h-d-c};const ne=Math.floor(b&&v<t+p?0:(v-(t+p))/l),j=Math.floor(ne/s)-Math.floor(y/2),$=Math.ceil(a/s),K=Math.max(0,Math.min(j,$))*s,Me=j<0?m+j*s:m,ie=K===0?0:u+K*l,ue=Math.min(Me,a-K);return{startingLine:K,totalLines:Me,bufferBefore:ie,bufferAfter:Math.max(0,(a-K-ue)*l)}}const k=y,x=[],T=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-m*l*2),s);let L=t+(T?.top??p),A=T?.lineIndex??0,U,w,R;const M=T?.lineIndex??0;for(let B=M;B<a;B++){const Z=A%s===0,ne=Math.floor(A/s);if(Z&&(x[ne]=L-(t+p),R!=null)){if(R<=0)break;R--}const j=this.getLineHeight(B,!1);L>n-j&&L<i&&(U??=ne),L+j>v&&(w??=ne),R==null&&L>=i&&Z&&(R=k),A++,L+=j}if(U==null)if(b)U=0,w=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:h-d-c};w??=U;const D=Math.round(w-y/2),H=Math.max(0,Math.ceil(a/s)-y),I=Math.max(0,Math.min(D,H)),P=I*s,O=D<0?m+D*s:m,_=x[I]??0,z=P===0?0:u+_,N=I+O/s,q=N<x.length?g-x[N]:g-(L-t-p);return{startingLine:P,totalLines:O,bufferBefore:z,bufferAfter:Math.max(0,q)}}};function Ra(e){let t;for(const n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===gr&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}function Ye(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}function Ta(e){return{...e,hunks:e.hunks.map(t=>({...t,hunkContent:t.hunkContent.map(n=>({...n}))})),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function wn(e){return e!==""?e.split(Lo):[]}function En(e,t,n){const i=e==="clone"?Ta(t):t;if(!i.isPartial)throw new Error("hydratePartialDiff: fileDiff must be partial");switch(i.type){case"change":case"rename-changed":return Aa(i,Ma(i,n),di(i,n));case"rename-pure":{const r=di(i,n);Ia(i,n);const o=wn(r.contents);return i.isPartial=!1,i.deletionLines=o,i.additionLines=o,_r(i,null,r),i}}throw new Error(`hydratePartialDiff: ${i.type} diffs cannot be hydrated from loaded files`)}function Aa(e,t,n){const i=wn(t.contents),r=wn(n.contents),{hunks:o,splitLineCount:s,unifiedLineCount:l}=Ha(e.hunks,r.length);return e.hunks=o,e.splitLineCount=s,e.unifiedLineCount=l,e.isPartial=!1,e.deletionLines=i,e.additionLines=r,_r(e,t,n),e}function Ha(e,t){let n=0,i=0,r=0;const o=[];for(const s of e){const l=Math.max(s.additionStart-1,0),a=Math.max(s.deletionStart-1,0);let h=l,d=a,c=0,u=0,p=0,g=0;const S=[];for(const b of s.hunkContent){if(b.type==="context"){S.push({...b,additionLineIndex:h,deletionLineIndex:d}),h+=b.lines,d+=b.lines,p+=b.lines,g+=b.lines;continue}S.push({...b,additionLineIndex:h,deletionLineIndex:d}),h+=b.additions,d+=b.deletions,c+=b.additions,u+=b.deletions,p+=Math.max(b.additions,b.deletions),g+=b.additions+b.deletions}const C=Math.max(Fe(s.additionStart,s.additionCount)-r,0);o.push({...s,collapsedBefore:C,additionLineIndex:l,deletionLineIndex:a,additionLines:c,deletionLines:u,hunkContent:S,splitLineStart:n+C,unifiedLineStart:i+C,splitLineCount:p,unifiedLineCount:g}),n+=C+p,i+=C+g,r=ce(s.additionStart,s.additionCount)}if(o.length>0){const s=o[o.length-1],l=ce(s.additionStart,s.additionCount),a=Math.max(t-l,0);n+=a,i+=a}return{hunks:o,splitLineCount:n,unifiedLineCount:i}}function Ma(e,t){if(t.oldFile==null)throw new Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function di(e,t){if(t.newFile==null)throw new Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function Ia(e,t){if(t.oldFile!==null)throw new Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function Da(e,t,n){return e.cacheKey!=null?`${e.cacheKey}:hydrated`:_a(t,n)}function _r(e,t,n){const i=Da(e,t,n);if(i==null){delete e.cacheKey;return}e.cacheKey=i}function _a(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?`${e.cacheKey}:${t.cacheKey}`:void 0:e?.cacheKey??t?.cacheKey}var Pa=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&(this.codeDeletions?.removeEventListener("scroll",this.handleDeletionsScroll),this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,this.enabled=!1)}setup(e,t,n){if(t==null||n==null)for(const i of e.children??[])i instanceof HTMLElement&&("deletions"in i.dataset?t=i:"additions"in i.dataset&&(n=i));if(n==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener("scroll",this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener("scroll",this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener("scroll",this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function We(e,t){return pt(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Lt(e){return F({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function kt(e){return F({tagName:"div",children:[F({tagName:"span",children:[Ce("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":e,"data-column-content":""}})}function fn(e){return F({tagName:"div",children:[Wt({name:e==="both"?"diffs-icon-expand-all":"diffs-icon-expand",properties:{"data-icon":""}})],properties:{role:"button","data-expand-button":"","data-expand-both":e==="both"?"":void 0,"data-expand-up":e==="up"?"":void 0,"data-expand-down":e==="down"?"":void 0}})}function Ge({type:e,content:t,expandIndex:n,chunked:i=!1,slotName:r,isFirstHunk:o,isLastHunk:s}){let l=0;const a=[];if(e==="metadata"&&t!=null&&a.push(F({tagName:"div",children:[Ce(t)],properties:{"data-separator-wrapper":""}})),(e==="line-info"||e==="line-info-basic")&&t!=null){const h=[];n!=null&&(i?(o||(h.push(fn("up")),l++),s||(h.push(fn("down")),l++)):(h.push(fn(!o&&!s?"both":o?"down":"up")),l++)),h.push(F({tagName:"div",children:[F({tagName:"span",children:[Ce(t)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),i&&n!=null&&h.push(F({tagName:"div",children:[Ce("Expand all")],properties:{role:"button","data-expand-button":"","data-expand-all-button":""}})),a.push(F({tagName:"div",children:h,properties:{"data-separator-wrapper":"","data-separator-multi-button":l>1?"":void 0}}))}return e==="custom"&&r!=null&&a.push(F({tagName:"slot",properties:{name:r}})),F({tagName:"div",children:a,properties:{"data-separator":a.length===0?"simple":e,"data-expand-index":n,"data-separator-first":o?"":void 0,"data-separator-last":s?"":void 0}})}function Fa(e,t){return`hunk-separator-${e}-${t}`}function za(e){const t=e.at(-1);return t==null?0:Math.max(ce(t.additionStart,t.additionCount),ce(t.deletionStart,t.deletionCount))}function Rn(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function hi({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":""},alwaysWrap:!0}}function wt({item:e,arr:t,enableJoin:n,isNeutral:i=!1,isLastItem:r=!1}){const o=t[t.length-1];if(o==null||r||!n){t.push([i?0:1,e.value]);return}const s=o[0]===0;if(i===s||i&&e.value.length===1&&!s){o[1]+=e.value;return}t.push([i?0:1,e.value])}function ut(e){return[Fe(e.additionStart,e.additionCount)+1,ce(e.additionStart,e.additionCount)+1]}function Te({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}){const o=Math.max(t,0);if(o===0||e)return{fromStart:0,fromEnd:0,rangeSize:o,collapsedLines:o,renderAll:!1};if(n===!0||o<=r)return{fromStart:o,fromEnd:0,rangeSize:o,collapsedLines:0,renderAll:!0};const s=n?.get(i),l=Math.min(Math.max(s?.fromStart??0,0),o),a=Math.min(Math.max(s?.fromEnd??0,0),o),h=l+a,d=h>=o;return{fromStart:d?o:l,fromEnd:d?0:a,rangeSize:o,collapsedLines:Math.max(o-h,0),renderAll:d}}function Oa(e){const t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;const n=e.additionLines.length-ce(t.additionStart,t.additionCount),i=e.deletionLines.length-ce(t.deletionStart,t.deletionCount);return n<=0&&i<=0?!1:n!==i}function Pr({fileDiff:e,errorPrefix:t}){const n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;const i=e.additionLines.length-ce(n.additionStart,n.additionCount),r=e.deletionLines.length-ce(n.deletionStart,n.deletionCount);if(i<=0&&r<=0)return 0;if(i!==r)throw new Error(`${t}: trailing context mismatch (additions=${i}, deletions=${r}) for ${e.name}`);return Math.min(i,r)}function Ae({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:i,errorPrefix:r}){if(t!==e.hunks.length-1)return;const o=Pr({fileDiff:e,errorPrefix:r});if(o<=0)return;if(n===!0||o<=i)return{fromStart:o,fromEnd:0,rangeSize:o,collapsedLines:0,renderAll:!0};const s=n?.get(e.hunks.length),l=Math.min(Math.max(s?.fromStart??0,0),o);return{fromStart:l,fromEnd:0,rangeSize:o,collapsedLines:o-l,renderAll:l>=o}}function Fr({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:i}){if(n===!0||e.isPartial)return!0;for(const[l,a]of e.hunks.entries()){const[h,d]=ut(a);if(t<h){const c=Te({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:l,collapsedContextThreshold:i}),u=h-c.rangeSize;return c.renderAll||t<u+c.fromStart||t>=h-c.fromEnd}if(t<d)return!0}const r=Ae({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:i,errorPrefix:"isAdditionLineRenderable"});if(r==null||r.renderAll)return!0;const o=e.hunks[e.hunks.length-1],[,s]=ut(o);return t<s+r.fromStart||t>=s+r.rangeSize}function Na({fileDiff:e,lineNumber:t,direction:n,expandedHunks:i,collapsedContextThreshold:r}){if(i===!0||e.isPartial)return t;const o=[];let s=1;for(const[a,h]of e.hunks.entries()){const[d,c]=ut(h),u=Te({isPartial:e.isPartial,rangeSize:h.collapsedBefore,expandedHunks:i,hunkIndex:a,collapsedContextThreshold:r}),p=d-u.rangeSize;u.renderAll?o.push([p,d]):(u.fromStart>0&&o.push([p,p+u.fromStart]),u.fromEnd>0&&o.push([d-u.fromEnd,d])),o.push([d,c]),s=c}const l=Ae({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:i,collapsedContextThreshold:r,errorPrefix:"getNearestRenderableAdditionLine"});if(l!=null){const a=s;s=a+l.rangeSize,l.renderAll?o.push([a,s]):l.fromStart>0&&o.push([a,a+l.fromStart])}if(t>=s)return t;if(n==="down"){for(const[a,h]of o)if(h>t)return Math.max(a,t);return}for(let a=o.length-1;a>=0;a--){const[h,d]=o[a];if(h<=t)return Math.min(d-1,t)}}function zr({type:e,metrics:t}){return t.hunkSeparatorHeight??xa(e)}function Or({type:e,metrics:t}){return e==="simple"||e==="metadata"||e==="line-info-basic"?0:t.spacing}function Ua({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case"simple":return t>0;case"metadata":return n!=null;case"line-info":case"line-info-basic":case"custom":return!0}}function Va(e){return e!=="simple"&&e!=="metadata"}function it({type:e,metrics:t,hunkIndex:n,hunkSpecs:i}){if(!Ua({type:e,hunkIndex:n,hunkSpecs:i}))return;const r=zr({type:e,metrics:t}),o=Or({type:e,metrics:t}),s=n>0?o:0,l=o;return{height:r,gapBefore:s,gapAfter:l,totalHeight:s+r+l}}function Oe({type:e,metrics:t}){if(!Va(e))return;const n=zr({type:e,metrics:t}),i=Or({type:e,metrics:t});return{height:n,gapBefore:i,gapAfter:0,totalHeight:i+n}}function Je({diff:e,diffStyle:t,startingLine:n=0,totalLines:i=1/0,expandedHunks:r,collapsedContextThreshold:o=1,callback:s}){const l=Ba({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:o}),a={viewportStart:n,viewportEnd:n+i,isWindowedHighlight:n>0||i<1/0,splitCount:l.splitCount,unifiedCount:l.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!a.isWindowedHighlight)return!1;const h=a.unifiedCount>=n+i,d=a.splitCount>=n+i;return t==="unified"?h:(t==="split"||h)&&d},shouldSkip(h,d){if(!a.isWindowedHighlight)return!1;const c=h>0&&a.unifiedCount+h<=n,u=d>0&&a.splitCount+d<=n;return t==="unified"?c:(t==="split"||c)&&u},incrementCounts(h,d){(t==="unified"||t==="both")&&(a.unifiedCount+=h),(t==="split"||t==="both")&&(a.splitCount+=d)},isInWindow(h,d){if(!a.isWindowedHighlight)return!0;const c=a.isInUnifiedWindow(h),u=a.isInSplitWindow(d);return t==="unified"?c:t==="split"?u:c||u},isInUnifiedWindow(h){return!a.isWindowedHighlight||a.unifiedCount>=n-h&&a.unifiedCount<n+i},isInSplitWindow(h){return!a.isWindowedHighlight||a.splitCount>=n-h&&a.splitCount<n+i},emit(h,d=!1){return d||(t==="unified"?a.incrementCounts(1,0):t==="split"?a.incrementCounts(0,1):a.incrementCounts(1,1)),s(h)??!1}};e:for(let h=l.hunkIndex;h<e.hunks.length;h++){let f=function(w,R){return C==null||C.collapsedLines<=0||C.fromStart+C.fromEnd>0?0:t==="unified"?w===d.unifiedLineStart+d.unifiedLineCount-1?C.collapsedLines:0:R===d.splitLineStart+d.splitLineCount-1?C.collapsedLines:0},y=function(){return m?0:(m=!0,S.collapsedLines)};const d=e.hunks[h];if(d==null)throw new Error("iterateOverDiff: invalid hunk index");if(a.shouldBreak())break;const c=Fe(d.deletionStart,d.deletionCount),u=Fe(d.additionStart,d.additionCount),p=!e.isPartial&&d.deletionCount===0?c:d.deletionLineIndex,g=!e.isPartial&&d.additionCount===0?u:d.additionLineIndex,S=Te({isPartial:e.isPartial,rangeSize:d.collapsedBefore,expandedHunks:r,hunkIndex:h,collapsedContextThreshold:o}),C=h===a.finalHunkIndex?Ae({fileDiff:e,hunkIndex:h,expandedHunks:r,collapsedContextThreshold:o,errorPrefix:"iterateOverDiff"}):void 0,b=S.fromStart+S.fromEnd;let m=S.collapsedLines===0;if(a.shouldSkip(b,b))a.incrementCounts(b,b),y();else{let w=d.unifiedLineStart-S.rangeSize,R=d.splitLineStart-S.rangeSize,M=p-S.rangeSize,D=g-S.rangeSize,H=c+1-S.rangeSize,I=u+1-S.rangeSize;if(Et(a,S.fromStart,t,P=>a.emit({hunkIndex:h,hunk:d,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:H+P,lineIndex:M+P,noEOFCR:!1,unifiedLineIndex:w+P,splitLineIndex:R+P},additionLine:{unifiedLineIndex:w+P,splitLineIndex:R+P,lineIndex:D+P,lineNumber:I+P,noEOFCR:!1}}))||(w=d.unifiedLineStart-S.fromEnd,R=d.splitLineStart-S.fromEnd,M=p-S.fromEnd,D=g-S.fromEnd,H=c+1-S.fromEnd,I=u+1-S.fromEnd,Et(a,S.fromEnd,t,P=>a.emit({hunkIndex:h,hunk:d,collapsedBefore:y(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:H+P,lineIndex:M+P,noEOFCR:!1,unifiedLineIndex:w+P,splitLineIndex:R+P},additionLine:{unifiedLineIndex:w+P,splitLineIndex:R+P,lineIndex:D+P,lineNumber:I+P,noEOFCR:!1}}),()=>{y()})))break e}let v=d.unifiedLineStart,k=d.splitLineStart,x=p,T=g,L=c+1,A=u+1;const U=d.hunkContent.at(-1);for(const w of d.hunkContent){if(a.shouldBreak())break e;const R=w===U;if(w.type==="context"){if(a.shouldSkip(w.lines,w.lines))a.incrementCounts(w.lines,w.lines),y();else if(Et(a,w.lines,t,M=>{const D=R&&M===w.lines-1,H=v+M,I=k+M;return a.emit({hunkIndex:h,hunk:d,collapsedBefore:y(),collapsedAfter:f(H,I),type:"context",deletionLine:{lineNumber:L+M,lineIndex:x+M,noEOFCR:D&&d.noEOFCRDeletions,unifiedLineIndex:H,splitLineIndex:I},additionLine:{unifiedLineIndex:H,splitLineIndex:I,lineIndex:T+M,lineNumber:A+M,noEOFCR:D&&d.noEOFCRAdditions}})},()=>{y()}))break e;v+=w.lines,k+=w.lines,x+=w.lines,T+=w.lines,L+=w.lines,A+=w.lines}else{const M=Math.max(w.deletions,w.additions),D=w.deletions+w.additions;if(!a.shouldSkip(D,M)){const H=Ga(a,w,t);(H[0]?.[0]??0)>0&&y();for(const[I,P]of H)for(let O=I;O<P;O++){const _=f(v+O,t==="unified"?k+(O<w.deletions?O:O-w.deletions):k+O);if(a.emit(ja({hunkIndex:h,hunk:d,collapsedBefore:y(),collapsedAfter:_,diffStyle:t,index:O,unifiedLineIndex:v,splitLineIndex:k,additionLineIndex:T,deletionLineIndex:x,additionLineNumber:A,deletionLineNumber:L,content:w,isLastContent:R,unifiedCount:D,splitCount:M}),!0))break e}}y(),a.incrementCounts(D,M),v+=D,k+=M,x+=w.deletions,T+=w.additions,L+=w.deletions,A+=w.additions}}if(C!=null){const{collapsedLines:w,fromStart:R,fromEnd:M}=C,D=R+M;if(Et(a,D,t,H=>{const I=H===D-1;return a.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:I?w:0,type:"context-expanded",deletionLine:{lineNumber:L+H,lineIndex:x+H,noEOFCR:!1,unifiedLineIndex:v+H,splitLineIndex:k+H},additionLine:{unifiedLineIndex:v+H,splitLineIndex:k+H,lineIndex:T+H,lineNumber:A+H,noEOFCR:!1}})},void 0,()=>a.shouldBreak()))break e}}}function Ba({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:r}){if(n<=0||t==="both")return{hunkIndex:0,splitCount:0,unifiedCount:0};const o=$a({diff:e,expandedHunks:i,collapsedContextThreshold:r});let s=0,l=e.hunks.length-1,a=e.hunks.length;for(;s<=l;){const d=s+l>>1,c=o[d+1];if(c==null)throw new Error("iterateOverDiff: invalid hunk prefix index");(t==="unified"?c.unifiedCount:c.splitCount)>n?(a=d,l=d-1):s=d+1}if(a>=e.hunks.length){const d=o[e.hunks.length];if(d==null)throw new Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:e.hunks.length,splitCount:d.splitCount,unifiedCount:d.unifiedCount}}const h=o[a];if(h==null)throw new Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:a,splitCount:h.splitCount,unifiedCount:h.unifiedCount}}function $a({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let i=0,r=0;const o=e.hunks.length-1,s=[{splitCount:0,unifiedCount:0}];for(let l=0;l<e.hunks.length;l++){const a=e.hunks[l];if(a==null)throw new Error("iterateOverDiff: invalid hunk summary index");const h=Te({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:l,collapsedContextThreshold:n}),d=h.fromStart+h.fromEnd;i+=d+a.splitLineCount,r+=d+a.unifiedLineCount;const c=l===o?Ae({fileDiff:e,hunkIndex:l,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:"iterateOverDiff"}):void 0;if(c!=null){const u=c.fromStart+c.fromEnd;i+=u,r+=u}s.push({splitCount:i,unifiedCount:r})}return s}function Wa(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];const i=[];function r(l){const a=Math.max(0,e.viewportStart-l),h=Math.min(t,e.viewportEnd-l);h>a&&i.push([a,h])}if(n!=="split"&&r(e.unifiedCount),n!=="unified"&&r(e.splitCount),i.length===0)return[0,0];let o=i[0][0],s=i[0][1];for(let l=1;l<i.length;l++){const a=i[l];o=Math.min(o,a[0]),s=Math.max(s,a[1])}return[o,s]}function Et(e,t,n,i,r,o){const[s,l]=Wa(e,t,n);s>0&&(e.incrementCounts(s,s),r?.());let a=s;for(;a<t;){if(o?.()===!0)return!0;if(a>=l){e.incrementCounts(t-a,t-a);break}if(e.isInWindow(0,0)){if(i(a)===!0)return!0}else e.incrementCounts(1,1);a++}return!1}function Ga(e,t,n){if(!e.isWindowedHighlight)return[[0,n==="unified"?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];const i=n!=="split",r=n!=="unified",o=n==="unified"?"unified":"split",s=[];function l(c,u){if(c+u<=e.viewportStart||c>=e.viewportEnd)return;const p=Math.max(0,e.viewportStart-c),g=Math.min(u,e.viewportEnd-c);return g>p?[p,g]:void 0}function a(c,u){return o==="split"?c:u==="additions"?[c[0]+t.deletions,c[1]+t.deletions]:c}function h(c,u){if(c==null)return;const[p,g]=a(c,u);g>p&&s.push([p,g])}if(i&&(h(l(e.unifiedCount,t.deletions),"deletions"),h(l(e.unifiedCount+t.deletions,t.additions),"additions")),r&&(h(l(e.splitCount,t.deletions),"deletions"),h(l(e.splitCount,t.additions),"additions")),s.length===0)return s;s.sort((c,u)=>c[0]-u[0]);const d=[s[0]];for(const[c,u]of s.slice(1)){const p=d[d.length-1];c<=p[1]?p[1]=Math.max(p[1],u):d.push([c,u])}return d}function ja({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,diffStyle:r,index:o,unifiedLineIndex:s,splitLineIndex:l,additionLineIndex:a,deletionLineIndex:h,additionLineNumber:d,deletionLineNumber:c,content:u,isLastContent:p,unifiedCount:g,splitCount:S}){const C=o<u.deletions?s+o:void 0,b=r==="unified"?o>=u.deletions?s+o:void 0:o<u.additions?s+u.deletions+o:void 0,f=r==="unified"?l+(o<u.deletions?o:o-u.deletions):l+o,m=o<u.deletions?h+o:void 0,y=o<u.deletions?c+o:void 0,v=r==="unified"?o>=u.deletions?a+(o-u.deletions):void 0:o<u.additions?a+o:void 0,k=r==="unified"?o>=u.deletions?d+(o-u.deletions):void 0:o<u.additions?d+o:void 0,x=r==="unified"?p&&o===u.deletions-1&&t.noEOFCRDeletions:p&&o===S-1&&t.noEOFCRDeletions,T=r==="unified"?p&&o===g-1&&t.noEOFCRAdditions:p&&o===S-1&&t.noEOFCRAdditions,L=m!=null&&y!=null&&C!=null?{lineNumber:y,lineIndex:m,noEOFCR:x,unifiedLineIndex:C,splitLineIndex:f}:void 0,A=v!=null&&k!=null&&b!=null?{unifiedLineIndex:b,splitLineIndex:f,lineIndex:v,lineNumber:k,noEOFCR:T}:void 0;if(L==null&&A!=null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:void 0,additionLine:A};if(L!=null&&A==null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:L,additionLine:void 0};if(L==null||A==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:L,additionLine:A}}const qa={forcePlainText:!1};function Ka(e,t,n,{forcePlainText:i,startingLine:r,totalLines:o,expandedHunks:s,collapsedContextThreshold:l=1}=qa){i?(r??=0,o??=1/0):(r=0,o=1/0);const a=r>0||o<1/0,h=typeof n.theme=="string"?t.getTheme(n.theme).type:void 0,d=pr({theme:n.theme,highlighter:t}),c=i&&!a&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?"none":n.lineDiffType,u={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,g=!i&&!e.isPartial,S=i?s:void 0,C=new Map;function b(m){const y=g?0:m,v=C.get(y)??Qa();return C.set(y,v),v}function f(m,y,v,k){if(a){let x=v.at(-1);(x==null||x.targetIndex+x.count!==y)&&(x={targetIndex:y,originalOffset:k.length,count:0},v.push(x)),x.count++}k.push(m)}Je({diff:e,diffStyle:"both",startingLine:r,totalLines:o,expandedHunks:a?S:!0,collapsedContextThreshold:l,callback:({hunkIndex:m,additionLine:y,deletionLine:v,type:k})=>{const x=b(m),T=y!=null?y.splitLineIndex:v.splitLineIndex;k==="change"&&y!=null&&v!=null&&Ya({additionLine:e.additionLines[y.lineIndex],deletionLine:e.deletionLines[v.lineIndex],deletionLineIndex:x.deletionContent.length,additionLineIndex:x.additionContent.length,deletionDecorations:x.deletionDecorations,additionDecorations:x.additionDecorations,lineDiffType:c,maxLineDiffLength:p}),v!=null&&(f(e.deletionLines[v.lineIndex],v.lineIndex,x.deletionSegments,x.deletionContent),x.deletionInfo.push({type:k==="change"?"change-deletion":k,lineNumber:v.lineNumber,altLineNumber:k==="change"?void 0:y.lineNumber??void 0,lineIndex:`${v.unifiedLineIndex},${T}`})),y!=null&&(f(e.additionLines[y.lineIndex],y.lineIndex,x.additionSegments,x.additionContent),x.additionInfo.push({type:k==="change"?"change-addition":k,lineNumber:y.lineNumber,altLineNumber:k==="change"?void 0:v.lineNumber??void 0,lineIndex:`${y.unifiedLineIndex},${T}`}))}});for(const m of C.values()){if(m.deletionContent.length===0&&m.additionContent.length===0)continue;const y={name:e.prevName??e.name,contents:m.deletionContent.value},v={name:e.name,contents:m.additionContent.value},{deletionLines:k,additionLines:x}=Xa({deletionFile:y,deletionInfo:m.deletionInfo,deletionDecorations:m.deletionDecorations,additionFile:v,additionInfo:m.additionInfo,additionDecorations:m.additionDecorations,highlighter:t,options:n,languageOverride:i?"text":e.lang});if(g){u.deletionLines=k,u.additionLines=x;continue}if(m.deletionSegments.length>0)for(const T of m.deletionSegments)for(let L=0;L<T.count;L++)u.deletionLines[T.targetIndex+L]=k[T.originalOffset+L];else u.deletionLines.push(...k);if(m.additionSegments.length>0)for(const T of m.additionSegments)for(let L=0;L<T.count;L++)u.additionLines[T.targetIndex+L]=x[T.originalOffset+L];else u.additionLines.push(...x)}return{code:u,themeStyles:d,baseThemeType:h}}function Ya({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:i,deletionDecorations:r,additionDecorations:o,lineDiffType:s,maxLineDiffLength:l}){if(e==null||t==null||s==="none"||(e=Ne(e),t=Ne(t),e.length>l||t.length>l))return;const a=s==="char"?$o(e,t):jo(e,t),h=[],d=[],c=s==="word-alt",u=a.at(-1);for(const g of a){const S=g===u;!g.added&&!g.removed?(wt({item:g,arr:h,enableJoin:c,isNeutral:!0,isLastItem:S}),wt({item:g,arr:d,enableJoin:c,isNeutral:!0,isLastItem:S})):g.removed?wt({item:g,arr:h,enableJoin:c,isLastItem:S}):wt({item:g,arr:d,enableJoin:c,isLastItem:S})}let p=0;for(const g of h)g[0]===1&&r.push(hi({line:n,spanStart:p,spanLength:g[1].length})),p+=g[1].length;p=0;for(const g of d)g[0]===1&&o.push(hi({line:i,spanStart:p,spanLength:g[1].length})),p+=g[1].length}function Qa(){return{deletionContent:{push(e){this.value+=e,this.length++},value:"",length:0},additionContent:{push(e){this.value+=e,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Xa({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:i,highlighter:r,deletionDecorations:o,additionDecorations:s,languageOverride:l,options:{theme:a=G,...h}}){const d=l??he(e.name),c=l??he(t.name),{state:u,transformers:p}=ur(h.useTokenTransformer),g=typeof a=="string"?{...h,lang:"text",theme:a,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:se("token"),tokenizeTimeLimit:0}:{...h,lang:"text",themes:a,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:se("token"),tokenizeTimeLimit:0};return{deletionLines:e.contents===""?[]:(g.lang=d,u.lineInfo=n,g.decorations=o,yn(r.codeToHast(Ne(e.contents),g))),additionLines:t.contents===""?[]:(g.lang=c,g.decorations=s,u.lineInfo=i,yn(r.codeToHast(Ne(t.contents),g)))}}function _e(e,t){const n=Ue({name:e.prevName??e.name,contents:e.deletionLines.join("")},{name:e.name,contents:e.additionLines.join(""),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function Za(e,t){const n=Math.max(e,1);let i=Array.from({length:n},(r,o)=>`${" ".repeat(o+1)}
1350
+ `).join("");return i===t&&(i=Array.from({length:n},(r,o)=>`\0${" ".repeat(o)}
1351
+ `).join("")),i}function Ja(e){for(const t of e)if(t.trim().length>0)return!1;return!0}function Tn(e,t){return t.length>0&&t.length<e.deletionLines.length&&Ja(t)}function Xt(e,t,n){const i=e.deletionLines.join(""),r=Za(t.length,i),o=Ue({name:e.prevName??e.name,contents:i},{name:e.name,contents:r,lang:e.lang},n);return{hunks:o.hunks,splitLineCount:o.splitLineCount,unifiedLineCount:o.unifiedLineCount,additionLines:t,deletionLines:o.deletionLines,type:o.type}}function An(e,t){return Xt(e,[""],t)}function Nr(e,t){if(e.additionLines.length===0)return An(e,t);if(Tn(e,e.additionLines))return Xt(e,e.additionLines,t);const n=e.additionLines,i=_e(e,t);return Ur(i,n),i}function el(e){return e.length>1&&e.at(-1)===""}function Ur(e,t){if(!el(t))return;const n=t.length-e.additionLines.length;if(n<=0)return;const i=e.additionLines.length,r=e.hunks.at(-1);if(r!=null&&ce(r.additionStart,r.additionCount)===i){for(const o of r.hunkContent)if(o.type==="change"&&o.additions<o.deletions&&o.additionLineIndex+o.additions===i){e.additionLines=t,o.additions+=n,r.additionCount+=n,r.additionLines+=n,$n(e);return}}}function tl(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return Le(e,_e(e,n));const i=Array.from(t);if(i.length===0)return Le(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(const o of i){const s=e.additionLines[o],l=e.deletionLines[o];if(s==null||l==null||Ne(s)===Ne(l))return Le(e,_e(e,n))}const r=nl(e,i);if(r.size===0)return Le(e,_e(e,n));for(const o of r)if(!rl(e,o,n))return Le(e,_e(e,n));return $n(e),Oa(e)?Le(e,_e(e,n)):Le(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function Le(e,t){return Object.assign(e,t),t}function nl(e,t){const n=new Set;for(const i of t){const r=il(e,i);if(r==null)return new Set;n.add(r)}return n}function il(e,t){for(const[n,i]of e.hunks.entries()){const r=i.additionLineIndex+i.additionCount;if(t>=i.additionLineIndex&&t<r)return n}}function rl(e,t,n){const i=e.hunks[t];if(i==null)return!1;const r=e.deletionLines.slice(i.deletionLineIndex,i.deletionLineIndex+i.deletionCount),o=e.additionLines.slice(i.additionLineIndex,i.additionLineIndex+i.additionCount),s=Ue({name:e.prevName??e.name,contents:r.join("")},{name:e.name,contents:o.join(""),lang:e.lang},{...n,context:0}),l=s.hunks[0];return l==null||s.hunks.length!==1?!1:(ol(i,l),Vr(e,t),!0)}function Vr(e,t){const n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}const i=e.additionLines.at(-1),r=e.deletionLines.at(-1);n.noEOFCRAdditions=i!=null&&i!==""&&!i.endsWith(`
1352
+ `),n.noEOFCRDeletions=r!=null&&r!==""&&!r.endsWith(`
1353
+ `)}function ol(e,t){const n=e.additionLineIndex,i=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(r=>Br(r,n,i)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart=e.additionStart+t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=i+t.deletionLineIndex,e.deletionStart=e.deletionStart+t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,Bn(e)}function Br(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function Bn(e){let t=0,n=0;for(const i of e.hunkContent)i.type==="context"?(t+=i.lines,n+=i.lines):(t+=Math.max(i.additions,i.deletions),n+=i.additions+i.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function $n(e){let t=0,n=0,i=0;for(const r of e.hunks)r.collapsedBefore=Math.max(Fe(r.additionStart,r.additionCount)-i,0),r.splitLineStart=t+r.collapsedBefore,r.unifiedLineStart=n+r.collapsedBefore,Bn(r),t+=r.collapsedBefore+r.splitLineCount,n+=r.collapsedBefore+r.unifiedLineCount,i=ce(r.additionStart,r.additionCount);if(e.hunks.length>0){const r=e.hunks[e.hunks.length-1],o=Math.max(e.additionLines.length-ce(r.additionStart,r.additionCount),0);t+=o,n+=o}e.splitLineCount=t,e.unifiedLineCount=n}const ci=new WeakMap;function sl(e){return e.length>1&&e[e.length-1]===""?e.slice(0,-1):e}function al(e,t){const n=Math.min(e.length,t.length);let i=0;for(;i<n&&e[i]===t[i];)i++;let r=e.length,o=t.length;for(;r>i&&o>i&&e[r-1]===t[o-1];)r--,o--;if(!(i===r&&i===o))return{start:i,deletionEnd:r,additionEnd:o}}function Hn(e,t){const n=e.hunks,i=e.additionLines,r=sl(i),o=r===i?e:{...e,additionLines:r},s=ml(n,gl(o,t),e.deletionLines.length),l=Sl(o,s);if(e.additionLines=r,e.hunks=l,e.editSessionDirty=!0,Ll(e),Ur(e,i),!!Cl(n,e.hunks))return{regions:s.map(a=>a.previousSpan)}}function ll(e,t,n,i){const r=Array.from(new Set(t)).filter(a=>a>=0&&a<e.additionLines.length).sort((a,h)=>a-h);if(r.length===0)return;const{hunks:o}=e;let s,l=0;for(const a of r){for(;l<o.length;){const c=o[l];if(a<Zt(c)+c.additionCount)break;l++}const h=o[l],d=h==null?void 0:Zt(h);if(d==null||a<d||s!=null&&s!==l)return Hn(e,n);s=l}if(s!=null){if(dl(e,r,s,i,n)){e.editSessionDirty=!0;return}return Hn(e,n)}}function dl(e,t,n,i,r){if(i==null||r?.ignoreWhitespace===!0||r?.stripTrailingCr===!0)return!1;const o=hl(e),s=e.hunks[n];if(s.hunkContent.some(cl))return!1;for(const l of t){const a=i.get(l),h=e.additionLines[l];if(a==null||h==null||o.has(a)||o.has(h))return!1;let d=!1;for(const c of s.hunkContent)if(c.type==="change"&&c.additions===c.deletions&&l>=c.additionLineIndex&&l<c.additionLineIndex+c.additions){d=!0;break}if(!d)return!1}return!0}function hl(e){const t=ci.get(e);if(t?.lines===e.deletionLines)return t.set;const n=new Set(e.deletionLines);return ci.set(e,{lines:e.deletionLines,set:n}),n}function cl(e){return e?.type==="change"&&(e.additions===0||e.deletions===0)}function ul(e,t){const n=new Map,{regions:i}=t;for(let r=0;r<=i.length;r++){const o=i[r-1],s=i[r],l=r===0?e.get(0):o==null?void 0:e.get(o.lastIndex+1),a=s==null?void 0:e.get(s.firstIndex),h=l?.fromStart??0,d=a?.fromEnd??0;(h>0||d>0)&&n.set(r,{fromStart:h,fromEnd:d})}return n}function fl(e,t,n){const i=[];if(e.isPartial)return i;for(const[o,s]of e.hunks.entries()){const l=Te({isPartial:e.isPartial,rangeSize:s.collapsedBefore,expandedHunks:t,hunkIndex:o,collapsedContextThreshold:n});if(l.rangeSize<=n)continue;const a=Ve(s),h=a-l.rangeSize;l.fromStart>0&&i.push([h,h+l.fromStart]),l.fromEnd>0&&i.push([a-l.fromEnd,a])}const r=Ae({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:"captureExpansionAnchors"});if(r!=null&&r.fromStart>0&&r.rangeSize>n){const o=e.hunks[e.hunks.length-1],s=Ve(o)+o.deletionCount;i.push([s,s+r.fromStart])}return i}function pl(e,t){const n=new Map;if(t.length===0)return n;const i=(o,s,l)=>{if(l<=s)return;let a=0,h=0;for(const[d,c]of t)c<=s||d>=l||(d<=s&&(a=Math.max(a,Math.min(c,l)-s)),c>=l&&(h=Math.max(h,l-Math.max(d,s))));(a>0||h>0)&&n.set(o,{fromStart:a,fromEnd:h})};for(const[o,s]of e.hunks.entries()){const l=Ve(s);i(o,l-Math.max(s.collapsedBefore,0),l)}const r=e.hunks[e.hunks.length-1];return r!=null&&!e.isPartial&&e.deletionLines.length>0&&i(e.hunks.length,Ve(r)+r.deletionCount,e.deletionLines.length),n}function ui(e,t){return e.editSessionDirty!==!0?!1:(e.editSessionDirty=void 0,Object.assign(e,Nr(e,t)),!0)}function gl(e,t){if(al(e.deletionLines,e.additionLines)==null)return[];const n=Ue({name:e.prevName??e.name,contents:e.deletionLines.join("")},{name:e.name,contents:e.additionLines.join(""),lang:e.lang},t),i=[];let r=0,o=0;for(const s of n.hunks){const l=s.additionCount>0?s.additionLineIndex-r:s.deletionLineIndex-o;r+=l,o+=l;for(const a of s.hunkContent){if(a.type==="context"){r+=a.lines,o+=a.lines;continue}const h=Br(a,0,0);h.additions===0&&(h.additionLineIndex=r),h.deletions===0&&(h.deletionLineIndex=o),i.push(h),r+=h.additions,o+=h.deletions}}return i}function ml(e,t,n){const i=e.map((s,l)=>{const a=Ve(s);return{deletionStart:a,deletionEnd:a+s.deletionCount,blocks:[],previousSpan:{firstIndex:l,lastIndex:l}}}),r=[];let o=0;for(const s of t){const l=s.deletionLineIndex,a=l+s.deletions;for(;o<i.length&&i[o].deletionEnd<l;)r.push(i[o]),o++;let h=r.length>0&&vl(l,a,r[r.length-1])?r.pop():void 0;for(;o<i.length&&i[o].deletionStart<=a;)h=bl(h,i[o]),o++;if(h==null){let d=l,c=a;if((s.deletions===0||s.additions===0)&&n>s.deletions){const u=r[r.length-1]?.deletionEnd??0,p=i[o]?.deletionStart??n;l>u?d--:a<p&&c++}h={deletionStart:d,deletionEnd:c,blocks:[],previousSpan:void 0}}h.deletionStart=Math.min(h.deletionStart,l),h.deletionEnd=Math.max(h.deletionEnd,a),h.blocks.push(s),r.push(h)}for(;o<i.length;)r.push(i[o]),o++;return r}function vl(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function bl(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function Sl(e,t){const n=[];let i=0,r=0;for(const o of t){const s=o.deletionStart-i;if(s<0)throw new Error("buildRegionHunks: overlapping old-side regions");i+=s,r+=s;const l=r,a=[];for(const d of o.blocks){const c=d.deletionLineIndex-i,u=d.additionLineIndex-r;if(c<0||c!==u)throw new Error("buildRegionHunks: canonical block context mismatch");fi(a,c,r,i),i+=c,r+=u,a.push({...d}),i+=d.deletions,r+=d.additions}const h=o.deletionEnd-i;if(h<0)throw new Error("buildRegionHunks: block exceeds its old-side region");fi(a,h,r,i),i+=h,r+=h,n.push(yl(e,{additionStart:l,additionEnd:r,deletionStart:o.deletionStart,deletionEnd:o.deletionEnd},a))}if(e.deletionLines.length-i!==e.additionLines.length-r)throw new Error("buildRegionHunks: trailing context mismatch");return n}function yl(e,t,n){const i=t.additionEnd-t.additionStart,r=t.deletionEnd-t.deletionStart;let o=0,s=0;for(const a of n)a.type==="change"&&(o+=a.additions,s+=a.deletions);const l={collapsedBefore:0,additionStart:Rt(t.additionStart,i),additionCount:i,additionLines:o,additionLineIndex:gi(t.additionStart,i),deletionStart:Rt(t.deletionStart,r),deletionCount:r,deletionLines:s,deletionLineIndex:gi(t.deletionStart,r),hunkContent:n,hunkSpecs:`@@ -${Rt(t.deletionStart,r)},${r} +${Rt(t.additionStart,i)},${i} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return Bn(l),l}function fi(e,t,n,i){t>0&&e.push({type:"context",lines:t,additionLineIndex:n,deletionLineIndex:i})}function Cl(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){const i=e[n],r=t[n];if(Ve(i)!==Ve(r)||i.deletionCount!==r.deletionCount||Zt(i)!==Zt(r)||i.additionCount!==r.additionCount||i.splitLineCount!==r.splitLineCount||!xl(i,r))return!0}return!1}function xl(e,t){const n=pi(e),i=pi(t);for(;;){const r=n.next(),o=i.next();if(r.done===!0||o.done===!0)return r.done===o.done;if(r.value[0]!==o.value[0]||r.value[1]!==o.value[1])return!1}}function*pi(e){for(const t of e.hunkContent){if(t.type==="context"){for(let i=0;i<t.lines;i++)yield[t.deletionLineIndex+i,t.additionLineIndex+i];continue}const n=Math.max(t.deletions,t.additions);for(let i=0;i<n;i++)yield[i<t.deletions?t.deletionLineIndex+i:void 0,i<t.additions?t.additionLineIndex+i:void 0]}}function Zt(e){return Fe(e.additionStart,e.additionCount)}function Ve(e){return Fe(e.deletionStart,e.deletionCount)}function Rt(e,t){return t===0?e:e+1}function gi(e,t){return t===0?e-1:e}function Ll(e){$n(e);for(let t=0;t<e.hunks.length;t++)Vr(e,t)}function Ut(e){const t=e.lang??he(e.name),n=e.lang??(e.prevName!=null?he(e.prevName):"text");return t==="text"&&n==="text"}let kl=-1;var wl=class{options;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++kl}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang="text";renderCache;editSessionActive=!1;constructor(e={theme:G},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=st(e.theme??G)?ar():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(){this.editSessionActive=!0}endEditSession(){this.editSessionActive=!1}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){const{renderCache:e}=this;if(e==null||Ut(e.diff)||Ht(e.diff,this.getTokenizeMaxLength()))return Promise.resolve();const{diff:t}=e,{workerManager:n}=this;return!this.editSessionActive&&n?.isWorkingPool()===!0&&t.cacheKey!=null?(n.evictDiffFromCache(t.cacheKey),n.primeDiffHighlightCache(t).then(()=>{this.applyRefreshedResult(t,n.getDiffResultCache(t))}).catch(i=>this.onHighlightError(i))):this.asyncHighlight(t).then(i=>this.applyRefreshedResult(t,i)).catch(i=>this.onHighlightError(i))}applyRefreshedResult(e,t){if(t==null||this.renderCache==null||this.renderCache.diff!==e||this.editSessionActive)return;const{options:n}=this.getRenderOptions(e);We(n,t.options)&&(this.renderCache={diff:e,options:t.options,highlighted:!0,result:t.result,renderRange:void 0},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){const e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.diff.cacheKey!=null&&this.workerManager?.evictDiffFromCache(e.diff.cacheKey)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){const i={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t==="up"||t==="both")&&(i.fromStart+=n),(t==="down"||t==="both")&&(i.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,i)}getExpandedHunk(e){return this.expandedHunks.get(e)??ko}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(const t of e){const n=(()=>{switch(t.side){case"deletions":return this.deletionAnnotations;case"additions":return this.additionAnnotations}})(),i=n[t.lineNumber]??[];n[t.lineNumber]=i,i.push(t)}}updateRenderCache(e,t,n=!1){if(this.renderCache==null)return!1;const{result:i,diff:r}=this.renderCache;if(i==null)return!1;if(r.isPartial)throw new Error("Could not update render cache for partial diff");const o=i.code.additionLines,s=[],l=new Map;for(const[h,d]of e){const c=o[h]?.properties??{},u=d.map(C=>C[2]).join(""),p=h<r.additionLines.length,g=p?r.additionLines[h]??"":"",S=Ne(g);p&&(r.additionLines[h]=mr(g,u),S!==u&&(s.push(h),l.set(h,g))),o[h]={type:"element",tagName:"div",properties:{"data-line":c["data-line"]??h+1,"data-line-index":c["data-line-index"]??h,"data-line-type":c["data-line-type"]??"context"},children:d.map(([C,b,f])=>C===0&&b===""?f===""?{type:"element",tagName:"br",properties:{},children:[]}:{type:"text",value:f}:{type:"element",tagName:"span",properties:{"data-char":C,style:`color:${b};`},children:[{type:"text",value:f}]})}}let a=!1;if(s.length>0)if(this.editSessionActive&&!r.isPartial){if(!n)if(r.additionLines.length<=1&&r.additionLines.join("")==="")Object.assign(r,An(r,this.options.parseDiffOptions)),this.markEditSessionPass(r),a=!0;else if(Tn(r,r.additionLines))Object.assign(r,Xt(r,r.additionLines,this.options.parseDiffOptions)),this.markEditSessionPass(r),a=!0;else{const h=ll(r,s,this.options.parseDiffOptions,l);this.applyExpansionRemap(h),a=h!=null}}else Object.assign(r,tl(r,s,this.options.parseDiffOptions));return i.baseThemeType=t,this.renderCache.isDirty=!0,a}applyExpansionRemap(e){e!=null&&(this.expandedHunks=ul(this.expandedHunks,e))}applyDocumentChange(e){if(this.renderCache==null)return;const{diff:t,result:n}=this.renderCache;if(n==null)return;if(t.isPartial)throw new Error("Could not apply document change for partial diff");const{additionLines:i}=t;t.additionLines=Al(e,i),n.code.additionLines=Tl(i,t.additionLines,n.code.additionLines,e),t.additionLines.length<=1&&t.additionLines.join("")===""?(Object.assign(t,An(t,this.options.parseDiffOptions)),n.code.additionLines[0]=$r(0,e),this.markEditSessionPass(t)):this.editSessionActive?this.applySessionDocumentChange(t):Object.assign(t,Nr(t,this.options.parseDiffOptions)),this.renderCache.isDirty=!0}applySessionDocumentChange(e){const{parseDiffOptions:t}=this.options,n=e.additionLines;if(Tn(e,n)){Object.assign(e,Xt(e,n,t)),this.markEditSessionPass(e);return}this.applyExpansionRemap(Hn(e,t))}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){const n=t==="change"?e==="deletions"?"change-deletion":"change-addition":t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>Sn(e);getOptionsWithDefaults(){const{diffIndicators:e="bars",diffStyle:t="split",disableBackground:n=!1,disableFileHeader:i=!1,disableLineNumbers:r=!1,disableVirtualizationBuffers:o=!1,collapsed:s=!1,expandUnchanged:l=!1,collapsedContextThreshold:a=1,expansionLineCount:h=100,hunkSeparators:d="line-info",lineDiffType:c="word-alt",maxLineDiffLength:u=1e3,overflow:p="scroll",stickyHeader:g=!1,theme:S=G,headerRenderMode:C="default",tokenizeMaxLineLength:b=1e3,tokenizeMaxLength:f=wo,useTokenTransformer:m=!1,useCSSClasses:y=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:i,disableLineNumbers:r,disableVirtualizationBuffers:o,collapsed:s,expandUnchanged:l,collapsedContextThreshold:a,expansionLineCount:h,hunkSeparators:d,lineDiffType:c,maxLineDiffLength:u,overflow:p,stickyHeader:g,theme:this.workerManager?.getDiffRenderOptions().theme??S,headerRenderMode:C,tokenizeMaxLineLength:b,tokenizeMaxLength:f,useTokenTransformer:m,useCSSClasses:y}}async initializeHighlighter(){return this.highlighter=await sr(hr(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;const{options:t}=this.getRenderOptions(e),n=Ht(e,this.getTokenizeMaxLength());let i=this.workerManager?.getDiffResultCache(e);i!=null&&!We(t,i.options)&&(i=void 0),this.renderCache??={diff:e,highlighted:!n&&!Ut(e),options:t,result:n?void 0:i?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter==null&&(this.computedLang=e.lang??he(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??G}getEffectiveCodeOptions(){const e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){const t=(()=>{if(this.workerManager?.isWorkingPool()===!0){const l=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&l.useTokenTransformer!==!0?{...l,useTokenTransformer:!0}:l}const{theme:i,tokenizeMaxLineLength:r,lineDiffType:o,maxLineDiffLength:s}=this.getOptionsWithDefaults();return{theme:i,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:r,lineDiffType:o,maxLineDiffLength:s}})();this.getOptionsWithDefaults();const{renderCache:n}=this;return n?.result==null?{options:t,forceHighlight:!0}:!Ye(e,n.diff)||!We(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=Vt){if(e==null)return;const{expandUnchanged:n,collapsedContextThreshold:i}=this.getOptionsWithDefaults();let{options:r,forceHighlight:o}=this.getRenderOptions(e);const s=this.getMatchingWorkerResultCache(e,r);s!=null&&!this.hasHighlightedRenderCache(e,r)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...s},o=!1),this.renderCache??={diff:e,highlighted:!1,options:r,result:void 0,renderRange:void 0};const l=e.additionLines.length>0||e.deletionLines.length>0,a=!l||Ut(e)||Ht(e,this.getTokenizeMaxLength()),h=!Ye(e,this.renderCache.diff),d=!en(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){const c=this.renderCache.result==null&&this.renderCache.highlighted&&!a&&!h&&Rn(t);c&&(this.renderCache.highlightPending=!0),!c&&(a||this.renderCache.result==null||!this.renderCache.highlighted&&(h||d))&&(this.renderCache.diff=e,this.renderCache.options=r,this.renderCache.highlighted=!1,(this.renderCache.result==null||h||d||o)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,Rn(t)||n?!0:this.expandedHunks,i)),this.renderCache.renderRange=t),!a&&l&&(!this.renderCache.highlighted||o)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLang=e.lang??he(e.name);const c=this.highlighter!=null&&st(r.theme),u=this.highlighter!=null&&jt(this.computedLang),p=!a&&u;if(this.highlighter!=null&&c&&(o||a||!this.renderCache.highlighted&&p||this.renderCache.result==null)){const{result:g,options:S}=this.renderDiffWithHighlighter(e,this.highlighter,a||!u);this.renderCache={diff:e,options:S,highlighted:p,result:g,renderRange:void 0}}(!c||!a&&!u)&&this.asyncHighlight(e).then(({result:g,options:S})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.applyHighlightResult(e,g,S,!a)})}return this.renderCache.result!=null?this.processDiffResult(this.renderCache.diff,t,this.renderCache.result):void 0}async asyncRender(e,t=Vt){const{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){const{diffIndicators:i,disableBackground:r,disableLineNumbers:o,overflow:s}=this.getOptionsWithDefaults();return dr({type:"diff",diffIndicators:i,disableBackground:r,disableLineNumbers:o,overflow:s,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){const t=Ht(e,this.getTokenizeMaxLength());this.computedLang=t?"text":e.lang??he(e.name);const n=this.highlighter!=null&&st(this.getLocalHighlightTheme()),i=t||this.highlighter!=null&&jt(this.computedLang);return(this.highlighter==null||!n||!i)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){const{options:i}=this.getRenderOptions(e),{collapsedContextThreshold:r}=this.getOptionsWithDefaults();return{result:Ka(e,t,i,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:r}),options:i}}onHighlightSuccess(e,t,n,i=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,i)}applyHighlightResult(e,t,n,i=!0){if(this.renderCache==null)return;const r=this.renderCache.highlightPending===!0||!this.renderCache.highlighted||!We(this.renderCache.options,n)||!Ye(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:i,result:t,renderRange:void 0},r&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;const n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!We(t,n.options)))return n}hasHighlightedRenderCache(e,t){const{renderCache:n}=this;return n?.result!=null&&n.highlighted&&Ye(e,n.diff)&&We(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:i,baseThemeType:r}){const{diffStyle:o,disableFileHeader:s,expandUnchanged:l,expansionLineCount:a,collapsedContextThreshold:h,hunkSeparators:d}=this.getOptionsWithDefaults(),c=this.renderCache?.isDirty??!1;this.diff=e;const u=o==="unified",p=Il(e,this.options.loadDiffFiles!=null),g=!e.isPartial||p;let S=[],C=[],b=[];const f=[],{additionLines:m,deletionLines:y}=n,v={rowCount:0,hunkSeparators:d,additionsContentAST:S,deletionsContentAST:C,unifiedContentAST:b,unifiedGutterAST:Ke(),deletionsGutterAST:Ke(),additionsGutterAST:Ke(),expansionLineCount:a,hunkData:f,incrementRowCount(H=1){v.rowCount+=H},pushToGutter(H,I){switch(H){case"unified":v.unifiedGutterAST.children.push(I);break;case"deletions":v.deletionsGutterAST.children.push(I);break;case"additions":v.additionsGutterAST.children.push(I);break}}},k=Pr({fileDiff:e,errorPrefix:"DiffHunksRenderer.processDiffResult"}),x={size:0,side:void 0,increment(){this.size+=1},flush(){if(o!=="unified"){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side==="additions"?(v.pushToGutter("additions",oe(void 0,"buffer",this.size)),S?.push(Lt(this.size))):(v.pushToGutter("deletions",oe(void 0,"buffer",this.size)),C?.push(Lt(this.size))),this.size=0,this.side=void 0}}},T=(H,I,P,O,_)=>{v.pushToGutter(H,qi(I,P,O,_))};function L(H){x.flush(),o==="unified"?pn("unified",H,v):(pn("deletions",H,v),pn("additions",H,v))}this.pushFileLevelAnnotations(e,o,t,v),Je({diff:e,diffStyle:o,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:l?!0:this.expandedHunks,collapsedContextThreshold:h,callback:({hunkIndex:H,hunk:I,collapsedBefore:P,collapsedAfter:O,additionLine:_,deletionLine:z,type:N})=>{const q=z!=null?z.splitLineIndex:_.splitLineIndex,B=_!=null?_.unifiedLineIndex:z.unifiedLineIndex;o==="split"&&N!=="change"&&x.flush(),P>0&&L({hunkIndex:H,collapsedLines:P,rangeSize:Math.max(I?.collapsedBefore??0,0),hunkSpecs:I?.hunkSpecs,isFirstHunk:H===0,isLastHunk:!1,isExpandable:g});const Z=o==="unified"?B:q,ne={type:N,hunkIndex:H,lineIndex:Z,unifiedLineIndex:B,splitLineIndex:q,deletionLine:z,additionLine:_};if(o==="unified"){const V=this.getUnifiedInjectedRowsForLine?.(ne);V?.before!=null&&vi(V.before,v);let J=z!=null?y[z.lineIndex]:void 0,re=_!=null?m[_.lineIndex]:void 0;if(J==null&&re==null){const pe="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(pe,{file:e.name}),new Error(pe)}const ze=N==="change"?_!=null?"change-addition":"change-deletion":N,fe=this.getUnifiedLineDecoration({type:N,lineType:ze,additionLineIndex:_?.lineIndex,deletionLineIndex:z?.lineIndex});T("unified",fe.gutterLineType,_!=null?_.lineNumber:z.lineNumber,`${B},${q}`,fe.gutterProperties),re!=null?re=At(re,fe.contentProperties,c&&_!=null?{"data-line":_.lineNumber,"data-line-index":`${B},${q}`}:void 0):J!=null&&(J=At(J,fe.contentProperties,c&&z!=null?{"data-line":z.lineNumber,"data-line-index":`${B},${q}`}:void 0)),Tt({diffStyle:"unified",type:N,deletionLine:J,additionLine:re,unifiedSpan:this.getAnnotations("unified",z?.lineNumber,_?.lineNumber,H,Z),createAnnotationElement:pe=>this.createAnnotationElement(pe),context:v}),V?.after!=null&&vi(V.after,v)}else{const V=this.getSplitInjectedRowsForLine?.(ne);V?.before!=null&&bi(V.before,v,x);let J=z!=null?y[z.lineIndex]:void 0,re=_!=null?m[_.lineIndex]:void 0;const ze=this.getSplitLineDecoration({side:"deletions",type:N,lineIndex:z?.lineIndex}),fe=this.getSplitLineDecoration({side:"additions",type:N,lineIndex:_?.lineIndex});if(J==null&&re==null){const ee="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(ee,{file:e.name}),new Error(ee)}const pe=(()=>{if(N==="change"){if(re==null)return"additions";if(J==null)return"deletions"}})();pe!=null?(x.side!=null&&x.side!==pe&&x.flush(),x.side=pe,x.increment()):N==="change"&&x.flush();const Ie=this.getAnnotations("split",z?.lineNumber,_?.lineNumber,H,Z);if(Ie!=null&&x.size>0&&x.flush(),z!=null){const ee=At(J,ze.contentProperties,c?{"data-line":z.lineNumber,"data-line-index":`${z.unifiedLineIndex},${q}`}:void 0);T("deletions",ze.gutterLineType,z.lineNumber,`${z.unifiedLineIndex},${q}`,ze.gutterProperties),ee!=null&&(J=ee)}if(_!=null){const ee=At(re,fe.contentProperties,c?{"data-line":_.lineNumber,"data-line-index":`${_.unifiedLineIndex},${q}`}:void 0);T("additions",fe.gutterLineType,_.lineNumber,`${_.unifiedLineIndex},${q}`,fe.gutterProperties),ee!=null&&(re=ee)}Tt({diffStyle:"split",type:N,additionLine:re,deletionLine:J,...Ie,createAnnotationElement:ee=>this.createAnnotationElement(ee),context:v}),V?.after!=null&&bi(V.after,v,x)}const j=o==="split"&&I!=null&&q===I.splitLineStart+I.splitLineCount-1,$=H===e.hunks.length-1&&I!=null&&(o==="split"?q===I.splitLineStart+I.splitLineCount-1:B===I.unifiedLineStart+I.unifiedLineCount-1),K=j?I.noEOFCRDeletions:!1,Me=j?I.noEOFCRAdditions:!1,ie=(z?.noEOFCR??!1)||K,ue=(_?.noEOFCR??!1)||Me;if(ue||ie){if(o==="split"&&x.flush(),ie){const V=N==="context"||N==="context-expanded"?N:"change-deletion";o==="unified"?(v.unifiedContentAST.push(kt(V)),v.pushToGutter("unified",oe(V,"metadata",1))):(v.deletionsContentAST.push(kt(V)),v.pushToGutter("deletions",oe(V,"metadata",1)),ue||(v.pushToGutter("additions",oe(void 0,"buffer",1)),v.additionsContentAST.push(Lt(1))))}if(ue){const V=N==="context"||N==="context-expanded"?N:"change-addition";o==="unified"?(v.unifiedContentAST.push(kt(V)),v.pushToGutter("unified",oe(V,"metadata",1))):(v.additionsContentAST.push(kt(V)),v.pushToGutter("additions",oe(V,"metadata",1)),ie||(v.pushToGutter("deletions",oe(void 0,"buffer",1)),v.deletionsContentAST.push(Lt(1))))}v.incrementRowCount(1)}d!=="simple"&&d!=="metadata"&&(O>0||$&&p)&&L({hunkIndex:N==="context-expanded"?H:H+1,collapsedLines:$&&p?"unknown":O,rangeSize:k,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:g}),v.incrementRowCount(1)}}),o==="split"&&x.flush();const A=Math.max(za(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),U=t.bufferBefore>0||t.bufferAfter>0,w=!u&&e.type!=="deleted",R=!u&&e.type!=="new",M=v.rowCount>0||U;S=w&&M?S:void 0,C=R&&M?C:void 0,b=u&&M?b:void 0;const D=this.createPreElement(C!=null&&S!=null,A);return{unifiedGutterAST:u&&M?v.unifiedGutterAST.children:void 0,unifiedContentAST:b,deletionsGutterAST:R&&M?v.deletionsGutterAST.children:void 0,deletionsContentAST:C,additionsGutterAST:w&&M?v.additionsGutterAST.children:void 0,additionsContentAST:S,hunkData:f,preNode:D,themeStyles:i,baseThemeType:r,headerElement:s?void 0:this.renderHeader(this.diff),totalLines:A,rowCount:v.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderCodeAST(e,t){const n=e==="unified"?t.unifiedGutterAST:e==="deletions"?t.deletionsGutterAST:t.additionsGutterAST,i=e==="unified"?t.unifiedContentAST:e==="deletions"?t.deletionsContentAST:t.additionsContentAST;if(n==null||i==null)return;const r=Ke(n);return r.properties.style=`grid-row: span ${t.rowCount}`,[r,vr(i,t.rowCount)]}renderFullAST(e,t=[]){const n=this.getOptionsWithDefaults().hunkSeparators==="line-info",i=this.renderCodeAST("unified",e);if(i!=null)return t.push(F({tagName:"code",children:i,properties:{"data-code":"","data-container-size":n?"":void 0,"data-unified":""}})),{...e.preNode,children:t};const r=this.renderCodeAST("deletions",e);r!=null&&t.push(F({tagName:"code",children:r,properties:{"data-code":"","data-container-size":n?"":void 0,"data-deletions":""}}));const o=this.renderCodeAST("additions",e);return o!=null&&t.push(F({tagName:"code",children:o,properties:{"data-code":"","data-container-size":n?"":void 0,"data-additions":""}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return te(this.renderFullAST(e,t))}renderPartialHTML(e,t){return t==null?te(e):te(F({tagName:"code",children:e,properties:{"data-code":"","data-container-size":this.getOptionsWithDefaults().hunkSeparators==="line-info"?"":void 0,[`data-${t}`]:""}}))}pushFileLevelAnnotations(e,t,n,i){if(!tn(n))return;const r=e.type!=="new"?mi(xn(this.deletionAnnotations)):[],o=e.type!=="deleted"?mi(xn(this.additionAnnotations)):[];if(r.length===0&&o.length===0)return;const s=-1,l=-1,{createAnnotationElement:a}=this;if(t==="unified"){Tt({diffStyle:t,type:"context",unifiedSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:r.concat(o)},createAnnotationElement:a,context:i});return}Tt({diffStyle:t,type:"context",deletionSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:r},additionSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:o},createAnnotationElement:a,context:i})}getAnnotations(e,t,n,i,r){const o={type:"annotation",hunkIndex:i,lineIndex:r,annotations:[]};if(t!=null)for(const l of this.deletionAnnotations[t]??[])o.annotations.push(Re(l));const s={type:"annotation",hunkIndex:i,lineIndex:r,annotations:[]};if(n!=null)for(const l of this.additionAnnotations[n]??[])(e==="unified"?o:s).annotations.push(Re(l));if(e==="unified")return o.annotations.length>0?o:void 0;if(!(s.annotations.length===0&&o.annotations.length===0))return{deletionSpan:o,additionSpan:s}}renderHeader(e){const{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return lr({fileOrDiff:e,mode:t,stickyHeader:n})}};function mi(e){return e?.map(t=>Re(t))??[]}const El=new Intl.PluralRules("en-US");function Rl(e){return`${e} unmodified line${El.select(e)==="one"?"":"s"}`}function vi(e,t){for(const n of e)t.unifiedContentAST.push(n.content),t.pushToGutter("unified",n.gutter),t.incrementRowCount(1)}function bi(e,t,n){for(const{deletion:i,addition:r}of e){if(i==null&&r==null)continue;const o=i!=null&&r!=null?void 0:i==null?"deletions":"additions";(o==null||n.side!==o)&&n.flush(),i!=null&&(t.deletionsContentAST.push(i.content),t.pushToGutter("deletions",i.gutter)),r!=null&&(t.additionsContentAST.push(r.content),t.pushToGutter("additions",r.gutter)),o!=null&&(n.side=o,n.increment()),t.incrementRowCount(1)}}function Tt({diffStyle:e,type:t,deletionLine:n,additionLine:i,unifiedSpan:r,deletionSpan:o,additionSpan:s,createAnnotationElement:l,context:a}){let h=!1;if(e==="unified"){if(i!=null?a.unifiedContentAST.push(i):n!=null&&a.unifiedContentAST.push(n),r!=null){const d=t==="change"?n!=null?"change-deletion":"change-addition":t;a.unifiedContentAST.push(l(r)),a.pushToGutter("unified",oe(d,"annotation",1)),h=!0}}else if(e==="split"){if(n!=null&&a.deletionsContentAST.push(n),i!=null&&a.additionsContentAST.push(i),o!=null){const d=t==="change"?n!=null?"change-deletion":"context":t;a.deletionsContentAST.push(l(o)),a.pushToGutter("deletions",oe(d,"annotation",1)),h=!0}if(s!=null){const d=t==="change"?i!=null?"change-addition":"context":t;a.additionsContentAST.push(l(s)),a.pushToGutter("additions",oe(d,"annotation",1)),h=!0}}h&&a.incrementRowCount(1)}function pn(e,{hunkIndex:t,collapsedLines:n,rangeSize:i,hunkSpecs:r,isFirstHunk:o,isLastHunk:s,isExpandable:l},a){if(typeof n=="number"&&n<=0)return;const h=e==="unified"?a.unifiedContentAST:e==="deletions"?a.deletionsContentAST:a.additionsContentAST;if(a.hunkSeparators==="metadata"){r!=null&&(a.pushToGutter(e,Ge({type:"metadata",content:r,isFirstHunk:o,isLastHunk:s})),h.push(Ge({type:"metadata",content:r,isFirstHunk:o,isLastHunk:s})),e!=="additions"&&a.incrementRowCount(1));return}if(a.hunkSeparators==="simple"){t>0&&(a.pushToGutter(e,Ge({type:"simple",isFirstHunk:o,isLastHunk:!1})),h.push(Ge({type:"simple",isFirstHunk:o,isLastHunk:!1})),e!=="additions"&&a.incrementRowCount(1));return}const d=Fa(e,t),c=i>a.expansionLineCount,u=l?t:void 0,p=typeof n=="number"?Rl(n):"More unchanged context may be available";a.pushToGutter(e,Ge({type:a.hunkSeparators,content:p,expandIndex:u,chunked:c,slotName:d,isFirstHunk:o,isLastHunk:s})),h.push(Ge({type:a.hunkSeparators,content:p,expandIndex:u,chunked:c,slotName:d,isFirstHunk:o,isLastHunk:s})),e!=="additions"&&a.incrementRowCount(1),a.hunkData.push({slotName:d,hunkIndex:t,lines:typeof n=="number"?n:0,lineCountKnown:typeof n=="number",type:e,expandable:l?{up:!o,down:!s,chunked:c}:void 0})}function At(e,t,n){return e==null||e.type!=="element"||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function Si(e){return e.length>0&&e[e.length-1]===""?e.length-1:e.length}function Tl(e,t,n,i){const r=Si(e),o=Si(t),s=Math.min(r,o);let l=0;for(;l<s&&e[l]===t[l];)l++;let a=0;for(;a<s-l&&e[r-1-a]===t[o-1-a];)a++;const h=new Array(t.length);for(let d=0;d<l;d++)h[d]=n[d];for(let d=0;d<a;d++)h[o-1-d]=n[r-1-d];r<e.length&&o<t.length&&(h[t.length-1]=n[e.length-1]);for(let d=e.length;d<t.length;d++)h[d]??=n[d];for(let d=l;d<t.length;d++)h[d]??=$r(d,i);return h}function $r(e,t){return{type:"element",tagName:"div",properties:{"data-line":e+1,"data-line-index":`${e},${e}`,"data-line-type":"context"},children:[{type:"element",tagName:"span",properties:{"data-char":0},children:[{type:"text",value:t.getLineText(e)}]}]}}function Al(e,t){const n=[],i=Ml(t);for(let r=0;r<e.lineCount;r++){const o=e.getLineText(r,!0);n.push(r<e.lineCount-1&&!Hl(o)?o+i:o)}return n}function Hl(e){return e.endsWith(`
1354
+ `)||e.endsWith("\r")}function Ml(e){for(const t of e){if(t.endsWith(`\r
1355
+ `))return`\r
1356
+ `;if(t.endsWith(`
1357
+ `))return`
1358
+ `;if(t.endsWith("\r"))return"\r"}return`
1359
+ `}function Ht(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Il(e,t){return e.isPartial&&t&&(e.type==="change"||e.type==="rename-changed")}function Dl(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function _l(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}async function Mn(e,t=300){let n;try{await Promise.race([e(),new Promise(i=>{n=setTimeout(i,t)})])}finally{n!=null&&clearTimeout(n)}}function In({oldFile:e,newFile:t},n){if(!(e===void 0&&t===void 0)){if(e===void 0||t===void 0)throw new Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw new Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return t===null?{oldFile:e,newFile:t}:{oldFile:e,newFile:t}}}function Pl(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:Hr(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators=="function"?"custom":e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader!=null?"custom":"default"}}function Fl(e){return e.isPartial&&(e.type==="change"||e.type==="rename-changed"||e.type==="rename-pure")}let zl=-1;var Wr=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++zl}`;type="file-diff";fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;renderRange;pendingFiles;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:G},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Yi,this.scrollSyncManager=new Pa,this.interactionManager=new Ki("diff",Gt(e,typeof e.hunkSeparators=="function"||(e.hunkSeparators??"line-info")==="line-info"||e.hunkSeparators==="line-info-basic"?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getHunksRendererOptions(e){return Pl(e)}createHunksRenderer(e){return new wl(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t="additions")=>{const n=this.fileDiffCache;if(n==null)return;const i=n.hunks.at(-1);let r,o;e:for(const s of n.hunks){const l=t==="deletions"?s.deletionStart:s.additionStart,a=t==="deletions"?s.deletionCount:s.additionCount;let h=Fe(l,a)+1,d=s.splitLineStart,c=s.unifiedLineStart;if(e<h){const u=h-e;r=Math.max(c-u,0),o=Math.max(d-u,0);break e}if(e>=h+a){if(s===i){const u=e-(h+a);r=c+s.unifiedLineCount+u,o=d+s.splitLineCount+u;break e}continue}for(const u of s.hunkContent)if(u.type==="context")if(e<h+u.lines){const p=e-h;o=d+p,r=c+p;break e}else h+=u.lines,d+=u.lines,c+=u.lines;else{const p=t==="deletions"?u.deletions:u.additions;if(e<h+p){const g=e-h;r=c+(t==="additions"?u.deletions:0)+g,o=d+g;break e}else h+=p,d+=Math.max(u.deletions,u.additions),c+=u.deletions+u.additions}break e}if(!(r==null||o==null))return[r,o]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Gt(this.options,typeof this.options.hunkSeparators=="function"||(this.options.hunkSeparators??"line-info")==="line-info"||this.options.hunkSeparators==="line-info-basic"?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??"system")!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme=="string"||this.fileContainer==null||this.appliedThemeCSS==null)return!1;const t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType===t?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!pt(this.appliedThemeCSS.theme,this.options.theme??G)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators=="function")}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??"additions"})}flushDeferredLineState(){const{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}const{diffStyle:e="split",overflow:t="scroll"}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t==="wrap",columnVariables:this.shouldApplyColumnVariables(t)?"apply":"measure"}),t==="scroll"&&e==="split"?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators=="function"?!0:e==="scroll"&&(this.lineAnnotations.length>0||this.pre?.hasAttribute("data-has-merge-conflict")===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){Bt(this.handleEditSessionRender),this.emitPostRender(!0),this.editor?.cleanUp(e),this.editor=void 0,this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.pendingFiles=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:i,fileDiff:r,...o}){if(!this.enabled)throw new Error("FileDiff.hydrate: attempting to call hydrate after cleaned up");if(this.fileContainer!=null)throw new Error("FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated");const s=In(o,"FileDiff.hydrate"),l=s?.oldFile,a=s?.newFile;this.hydrateElements(e,t),Ul(this.pre,Ol({fileDiff:r,oldFile:l,newFile:a}),this.options.collapsed)||Vl(this.headerElement,Nl({fileDiff:r,oldFile:l,newFile:a}),this.options.disableFileHeader)?this.render({...o,fileContainer:e,lineAnnotations:i,fileDiff:r,preventEmit:!0}):this.hydrationSetup({fileDiff:r,lineAnnotations:i,...s}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Tr(e,t);for(const n of e.shadowRoot?.children??[]){if(n instanceof SVGElement){this.spriteSVG=n;continue}if(n instanceof HTMLElement){if(n instanceof HTMLPreElement){this.pre=n;for(const i of n.children)!(i instanceof HTMLElement)||i.tagName.toLowerCase()!=="code"||("deletions"in i.dataset&&(this.codeDeletions=i),"additions"in i.dataset&&(this.codeAdditions=i),"unified"in i.dataset&&(this.codeUnified=i));continue}if("diffsHeader"in n.dataset){this.headerElement=n;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute("data-theme-css")){this.themeCSSStyle=n;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute("data-unsafe-css")){this.unsafeCSSStyle=n,this.appliedUnsafeCSS=n.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute("data-dehydrated")),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:i}){this.lineAnnotations=i??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?Ue(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){const{fileDiff:e,options:{loadDiffFiles:t}}=this;e==null||t==null||!Fl(e)||this.pendingFiles?.fileDiff===e||(this.pendingFiles={fileDiff:e,promise:this.loadFilesForDiff(e,t)})}async loadFilesForDiff(e,t){try{const n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(n){if(this.options.disableErrorHandling===!0)throw n;console.error(n)}finally{this.pendingFiles?.fileDiff===e&&(this.pendingFiles=void 0)}}async handleFilesLoaded(e,t){this.fileDiff!==e||!e.isPartial||(En("merge",e,t),this.setHydratedState(t),await Mn(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender())}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:i=!1,lineAnnotations:r,fileContainer:o,containerWrapper:s,renderRange:l,...a}){const h=In(a,"FileDiff.render"),d=h?.oldFile,c=h?.newFile;if(!this.enabled)throw new Error("FileDiff.render: attempting to call render after cleaned up");e!=null&&e.cacheKey===void 0&&(e.cacheKey=e.prevName!=null?e.prevName+":"+e.name:e.name),this.editor?.__postponeBgTokenizeToNextFrame();const{collapsed:u=!1,themeType:p="system",expandUnchanged:g=!1}=this.options,S=u?void 0:l,C=this.hasThemeChanged(),b=h!=null,f=b&&(!yi(d,this.deletionFile)||!yi(c,this.additionFile));let m=e!=null&&e!==this.fileDiff;const y=r!=null&&(r.length>0||this.lineAnnotations.length>0)?r!==this.lineAnnotations:!1;if(!u&&en(S,this.renderRange)&&!n&&!y&&!C&&(e!=null&&e===this.fileDiff||e==null&&!f))return this.applyCachedThemeState(p);let v;e==null&&b&&(f||this.fileDiff==null)&&(v=Ue(h.oldFile,h.newFile,this.options.parseDiffOptions));const{renderRange:k}=this;if(this.renderRange=S,b?(this.deletionFile=d,this.additionFile=c):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null?this.fileDiff=e:v!=null&&(m=!0,this.fileDiff=v),m&&(this.cachedHeaderHTML=void 0),r!=null&&this.setLineAnnotations(r),this.fileDiff==null)return!1;this.fileDiff.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(ui(this.fileDiff,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),g&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);const{disableErrorHandling:x=!1,disableFileHeader:T=!1}=this.options;if(T&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),o=this.getOrCreateFileContainer(o,s),this.applyCachedThemeState(p),u){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{const L=this.hunksRenderer.renderDiff(this.fileDiff,Bi);L!=null&&this.applyThemeState(o,L.themeStyles,p,L.baseThemeType),L?.headerElement!=null&&this.applyHeaderToDOM(L.headerElement,o),this.renderSeparators([]),this.injectUnsafeCSS()}catch(L){if(x)throw L;console.error(L),L instanceof Error&&this.applyErrorToDOM(L,o)}return i||this.emitPostRender(),!0}try{const L=this.getOrCreatePreNode(o);if(!(this.canPartiallyRender(n,y,f||m||C)&&this.applyPartialRender({previousRenderRange:k,renderRange:S}))){const A=this.hunksRenderer.renderDiff(this.fileDiff,S);if(A==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(o,A.themeStyles,p,A.baseThemeType),A.headerElement!=null&&this.applyHeaderToDOM(A.headerElement,o),A.additionsContentAST!=null||A.deletionsContentAST!=null||A.unifiedContentAST!=null?this.applyHunksToDOM(L,A):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(A.hunkData)}this.applyBuffers(L,S),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(L){if(x)throw L;console.error(L),L instanceof Error&&this.applyErrorToDOM(L,o)}return i||this.emitPostRender(),!0}emitPostRender(e=!1){const{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,"unmount");return}if(t==null)return;const i=this.mounted?"update":"mount";this.mounted=!0,n?.(t,this,i)}get fileDiffCache(){return this.hunksRenderer.diffCache??this.fileDiff}syncRenderViewToEditor(){const e=this.editor,t=this.fileContainer,n=this.fileDiffCache,i=this.lineAnnotations,r=this.computeEditorRenderRange(this.renderRange);e!=null&&t!=null&&n!=null&&!n.isPartial&&this.hunksRenderer.initializeHighlighter().then(o=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.fileDiffCache!==n||e.__syncRenderView(o,t,n,i,r)})}computeEditorRenderRange(e){const t=this.fileDiffCache;if(e==null||t==null||Rn(e))return e;const{diffStyle:n="split",expandUnchanged:i=!1,collapsedContextThreshold:r=1}=this.options;let o,s;return Je({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:i?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,callback:({additionLine:l})=>{l!=null&&(o??=l.lineNumber,s=l.lineNumber)}}),o==null||s==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:o-1,totalLines:s-o+1}}attachEditor(e){if(this.type!=="file-diff")throw new Error(`FileDiff.attachEditor: cannot attach an editor to a "${this.type}" diff`);return this.editor?.cleanUp(),this.editor=e,this.hunksRenderer.beginEditSession(),this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary(),this.hunksRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),t=>{this.editor=void 0,t!==!0&&this.finishEditSession()}}finishEditSession(){this.hunksRenderer.endEditSession(),this.completeEditSession()}completeEditSession(){const e=this.fileDiffCache;if(e==null||e.editSessionDirty!==!0)return!1;const{collapsedContextThreshold:t=1}=this.options,n=fl(e,this.hunksRenderer.getExpandedHunksMap(),t);return ui(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(pl(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){this.hunksRenderer.applyDocumentChange(e);const n=this.hunksRenderer.diffCache;if(n!=null){const i=this.fileDiff?.cacheKey;i!=null&&n.cacheKey==null&&(n.cacheKey=i),this.fileDiff=n}t!==void 0&&t!==this.lineAnnotations&&(this.setLineAnnotations(t),this.hunksRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations()),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){const{shouldRefreshDiffsView:i,lineCountChangeInFlight:r}=n;if(this.hunksRenderer.updateRenderCache(e,t,r)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}i===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle==="split"?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}isLineRenderable(e){const t=this.fileDiffCache;if(t==null)return!0;const{expandUnchanged:n=!1,collapsedContextThreshold:i=1}=this.options;return Fr({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}getNearestRenderableLine(e,t){const n=this.fileDiffCache;if(n==null)return e;const{expandUnchanged:i=!1,collapsedContextThreshold:r=1}=this.options;return Na({fileDiff:n,lineNumber:e,direction:t,expandedHunks:i?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}revealLine(e){const t=this.fileDiffCache,{expandUnchanged:n=!1,collapsedContextThreshold:i=1,expansionLineCount:r=100}=this.options;if(t==null||t.isPartial||n)return!1;const o=this.hunksRenderer.getExpandedHunksMap();for(const[h,d]of t.hunks.entries()){const[c,u]=ut(d);if(e<c){const p=Te({isPartial:t.isPartial,rangeSize:d.collapsedBefore,expandedHunks:o,hunkIndex:h,collapsedContextThreshold:i}),g=c-p.rangeSize;if(p.renderAll||e<g+p.fromStart||e>=c-p.fromEnd)return!1;const S=e-(g+p.fromStart)+1,C=c-p.fromEnd-e;return S<=C?this.expandHunk(h,"up",S+r):this.expandHunk(h,"down",C+r),!0}if(e<u)return!1}const s=Ae({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:o,collapsedContextThreshold:i,errorPrefix:"FileDiff.revealLine"});if(s==null||s.renderAll)return!1;const l=t.hunks[t.hunks.length-1],[,a]=ut(l);return e<a+s.fromStart||e>=a+s.rangeSize?!1:(this.expandHunk(t.hunks.length,"up",e-(a+s.fromStart)+1+r),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){Q(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(const{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(const{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){const t=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",t.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty("height",`${e}px`),!0}async primeHighlightCache(e=this.fileDiff){const{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||Ut(e))return;const n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(i=>{console.error(i)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){const{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!="function"){for(const{element:i}of this.separatorCache.values())i.remove();this.separatorCache.clear();return}const n=new Map(this.separatorCache);for(const i of e){const r=i.slotName;let o=this.separatorCache.get(r);if(o==null||!_l(i,o.hunkData)){o?.element.remove();const s=document.createElement("div");s.style.display="contents",s.slot=i.slotName;const l=t(i,this);l!=null&&s.appendChild(l),this.fileContainer.appendChild(s),o={element:s,hunkData:i},this.separatorCache.set(r,o)}n.delete(r)}for(const[i,{element:r}]of n.entries())this.separatorCache.delete(i),r.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(const{element:n}of this.annotationCache.values())n.remove();this.annotationCache.clear();return}const e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(const[n,i]of this.lineAnnotations.entries()){const r=`${n}-${Re(i)}`;let o=this.annotationCache.get(r);if(o==null||!Dl(i,o.annotation)){o?.element.remove();const s=t(i);if(s==null)continue;o={element:yr(Re(i)),annotation:i},o.element.appendChild(s),this.fileContainer.appendChild(o.element),this.annotationCache.set(r,o)}e.delete(r)}for(const[n,{element:i}]of e.entries())this.annotationCache.delete(n),i.remove()}renderGutterUtility(){const{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}const t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}const n=Cr();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){const{fileContainer:n}=this,i=e??n??document.createElement("diffs-container"),r=n!==i;return n!=null&&r&&this.editor?.__captureFocusForDOMReplacement(),r&&this.emitPostRender(!0),this.fileContainer=i,n!=null&&r&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),r&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){const{shadowRoot:t}=e;if(t!=null)for(const n of t.children)n instanceof SVGElement?this.spriteSVG??=n:Yt(n)&&n.hasAttribute("data-theme-css")?(this.themeCSSStyle??=n,this.hasAdoptedThemeCSS=!0):Yt(n)&&n.hasAttribute("data-unsafe-css")&&(this.unsafeCSSStyle??=n,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){const t=e.shadowRoot??e.attachShadow({mode:"open"});if(this.spriteSVG==null){const n=document.createElement("div");n.innerHTML=br;const i=n.firstChild;i instanceof SVGElement&&(this.spriteSVG=i)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){const t=e.shadowRoot??e.attachShadow({mode:"open"});return this.pre==null?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(const t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute("data-unified")?this.codeUnified=t:t.hasAttribute("data-deletions")?this.codeDeletions=t:t.hasAttribute("data-additions")&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;const{fileDiff:n}=this,i=this.cachedHeaderHTML??te(e);if(this.cachedHeaderHTML=i,i!==this.lastRenderedHeaderHTML){const c=document.createElement("div");c.innerHTML=i;const u=c.firstElementChild;if(!(u instanceof HTMLElement))return;this.headerElement!=null?t.shadowRoot?.replaceChild(u,this.headerElement):t.shadowRoot?.prepend(u),this.headerElement=u,this.lastRenderedHeaderHTML=i}if(this.isContainerManaged||n==null)return;const{renderCustomHeader:r,renderHeaderPrefix:o,renderHeaderFilenameSuffix:s,renderHeaderMetadata:l}=this.options;if(r!=null){const c=r(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Fn,c),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}const a=o?.(n)??void 0,h=s?.(n)??void 0,d=l?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,zn,a),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,On,h),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Nn,d),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,i){if(i==null){t?.remove();return}const r=t??this.createHeaderSlotElement(n);return t==null&&e.appendChild(r),this.replaceHeaderSlotContent(r,i),r}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){const t=document.createElement("div");return t.slot=e,t}injectUnsafeCSS(){const{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===""){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}this.unsafeCSSStyle?.parentNode===t&&this.appliedUnsafeCSS===e||(this.unsafeCSSStyle??=xr(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=wr(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,i){const r=e.shadowRoot??e.attachShadow({mode:"open"}),o=i??n,s=this.options.theme??G,l=typeof s=="string"?s:{...s},a=ct(r);if(this.themeCSSStyle?.parentNode===r&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===o&&this.appliedThemeCSS.scrollbarGutter===a){this.appliedThemeCSS.theme=l;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===r){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:l,themeStyles:t,themeType:o,baseThemeType:i,scrollbarGutter:a};return}this.themeCSSStyle=Mr({shadowRoot:r,currentNode:this.themeCSSStyle,themeCSS:Er(t,o,a)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:l,themeStyles:t,themeType:o,baseThemeType:i,scrollbarGutter:a}:void 0}hydrateMeasuredScrollbar(){const e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=Rr(this.themeCSSStyle.textContent??"",ct(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&Ir()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?kn(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){const i=this.getColumnPair(e);if(i==null)return!1;const r=De(t[0]),o=De(t[1]);return r==null||o==null?!1:(i.gutter.innerHTML=te(r),i.content.innerHTML=te(o),n!==this.lastRowCount&&(i.gutter.style.setProperty("grid-row",`span ${n}`),i.content.style.setProperty("grid-row",`span ${n}`)),!0)}replaceCodeColumns(e,t){const{overflow:n="scroll"}=this.options,i=(this.options.hunkSeparators??"line-info")==="line-info",r=n==="wrap"?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let o=!1;const s=[],l=this.hunksRenderer.renderCodeAST("unified",t),a=this.hunksRenderer.renderCodeAST("deletions",t),h=this.hunksRenderer.renderCodeAST("additions",t);this.editor?.__captureFocusForDOMReplacement(),l!=null?(o=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=Ot({code:this.codeUnified,columnType:"unified",rowSpan:r,containerSize:i}),this.applyCodeColumnsInPlace(this.codeUnified,l,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(l)),s.push(this.codeUnified)):a!=null||h!=null?(a!=null?(o=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Ot({code:this.codeDeletions,columnType:"deletions",rowSpan:r,containerSize:i}),this.applyCodeColumnsInPlace(this.codeDeletions,a,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(a)),s.push(this.codeDeletions)):(this.codeDeletions?.remove(),this.codeDeletions=void 0),h!=null?(o=o||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Ot({code:this.codeAdditions,columnType:"additions",rowSpan:r,containerSize:i}),this.applyCodeColumnsInPlace(this.codeAdditions,h,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(h)),s.push(this.codeAdditions)):(this.codeAdditions?.remove(),this.codeAdditions=void 0)):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0),s.length===0?e.textContent="":o&&e.replaceChildren(...s),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){const{pre:n,codeUnified:i,codeAdditions:r,codeDeletions:o,options:{diffStyle:s="split"}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;const l=this.getCodeColumns(s,i,o,r);if(l==null)return!1;const a=e.startingLine,h=t.startingLine,d=a+e.totalLines,c=h+t.totalLines,u=Math.max(a,h),p=Math.min(d,c);if(p<=u)return!1;const g=Math.max(0,u-a),S=Math.max(0,d-p),C=this.trimColumns({columns:l,trimStart:g,trimEnd:S,previousStart:a,overlapStart:u,overlapEnd:p,diffStyle:s});if(C<0)throw new Error("FileDiff.applyPartialRender: failed to trim to overlap");if(this.lastRowCount<C)throw new Error("FileDiff.applyPartialRender: trimmed beyond DOM row count");let b=this.lastRowCount-C;const f=(k,x)=>{if(!(x<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:k,totalLines:x,bufferBefore:0,bufferAfter:0})},m=f(h,Math.max(u-h,0));if(m==null&&h<u)return!1;const y=f(p,Math.max(c-p,0));if(y==null&&c>p)return!1;const v=(k,x)=>{if(k!=null){if(s==="unified"&&!Array.isArray(l))this.insertPartialHTML(s,l,k,x);else if(s==="split"&&Array.isArray(l))this.insertPartialHTML(s,l,k,x);else throw new Error("FileDiff.applyPartialRender.applyChunk: invalid chunk application");b+=k.rowCount}};return this.cleanupErrorWrapper(),v(m,"afterbegin"),v(y,"beforeend"),this.lastRowCount!==b&&(this.applyRowSpan(s,l,b),this.lastRowCount=b),!0}insertPartialHTML(e,t,n,i){if(e==="unified"&&!Array.isArray(t)){const r=this.hunksRenderer.renderCodeAST("unified",n);this.renderPartialColumn(t,r,i)}else if(e==="split"&&Array.isArray(t)){const r=this.hunksRenderer.renderCodeAST("deletions",n),o=this.hunksRenderer.renderCodeAST("additions",n);this.renderPartialColumn(t[0],r,i),this.renderPartialColumn(t[1],o,i)}else throw new Error("FileDiff.insertPartialHTML: Invalid argument composition")}refreshSplitDiffView(){if(this.options.diffStyle!=="split")return;const e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;const t=this.getCodeColumns("split",this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(t))return;const n=(i,r)=>{if(r==null)return;const o=this.hunksRenderer.renderCodeAST(i,e),s=De(o?.[0]),l=De(o?.[1]);for(const[a,h]of[[r.gutter,s],[r.content,l]])if(h!=null&&a.childElementCount===h.length)for(let d=0;d<h.length;d++){const c=a.children[d],u=h[d].properties["data-line-type"];u!=null&&c.dataset.lineType!==u&&(c.dataset.lineType=u)}};n("deletions",t[0]),n("additions",t[1])}refreshUnifiedDiffView(){if(this.options.diffStyle!=="unified")return;const e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;const t=this.getCodeColumns("unified",this.codeUnified,this.codeDeletions,this.codeAdditions);if(t==null||Array.isArray(t))return;const n=this.hunksRenderer.renderCodeAST("unified",e),i=De(n?.[0]),r=De(n?.[1]),o=()=>{for(const[s,l]of[[t.gutter,i],[t.content,r]])l!=null&&(s.innerHTML=te(l));e.rowCount!==this.lastRowCount&&(this.applyRowSpan("unified",t,e.rowCount),this.lastRowCount=e.rowCount)};this.shouldGuardRebuildScroll()?kn(this.pre,o):o(),this.renderSeparators(e.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;const i=De(t[0]),r=De(t[1]);if(i==null||r==null)throw new Error("FileDiff.insertPartialHTML: Unexpected AST structure");const o=r.at(0);n==="beforeend"&&o?.type==="element"&&typeof o.properties["data-buffer-size"]=="number"&&this.mergeBuffersIfNecessary(o.properties["data-buffer-size"],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],i,r,!0);const s=r.at(-1);n==="afterbegin"&&s?.type==="element"&&typeof s.properties["data-buffer-size"]=="number"&&this.mergeBuffersIfNecessary(s.properties["data-buffer-size"],e.content.children[0],e.gutter.children[0],i,r,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r))}mergeBuffersIfNecessary(e,t,n,i,r,o){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;const s=this.getBufferSize(t.dataset);s!=null&&(o?(i.shift(),r.shift()):(i.pop(),r.pop()),this.updateBufferSize(t,s+e),this.updateBufferSize(n,s+e))}applyRowSpan(e,t,n){const i=r=>{r!=null&&(r.gutter.style.setProperty("grid-row",`span ${n}`),r.content.style.setProperty("grid-row",`span ${n}`))};if(e==="unified"&&!Array.isArray(t))i(t);else if(e==="split"&&Array.isArray(t))i(t[0]),i(t[1]);else throw new Error("dun fuuuuked up")}trimColumnRows(e,t,n){let i=0,r=0,o=0,s=!1;const l=n>=0;if(e==null)return 0;const a=Array.from(e.content.children),h=Array.from(e.gutter.children);if(a.length!==h.length)throw new Error("FileDiff.trimColumnRows: columns do not match");for(;o<a.length&&!(t<=0&&!l&&!s);){const d=h[o],c=a[o];if(o++,!(d instanceof HTMLElement)||!(c instanceof HTMLElement))throw console.error({gutterElement:d,contentElement:c}),new Error("FileDiff.trimColumnRows: invalid row elements");if(s&&(s=!1,d.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in c.dataset||d.dataset.gutterBuffer==="metadata"&&"noNewline"in c.dataset)){d.remove(),c.remove(),r++;continue}if("lineIndex"in d.dataset&&"lineIndex"in c.dataset){(t>0||l&&i>=n)&&(d.remove(),c.remove(),t>0&&(t--,t===0&&(s=!0)),r++),i++;continue}if("separator"in d.dataset&&"separator"in c.dataset){(t>0||l&&i>=n)&&(d.remove(),c.remove(),r++);continue}if(d.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in c.dataset){(t>0||l&&i>=n)&&(d.remove(),c.remove(),r++);continue}if(d.dataset.gutterBuffer==="metadata"&&"noNewline"in c.dataset){(t>0||l&&i>=n)&&(d.remove(),c.remove(),r++);continue}if(d.dataset.gutterBuffer==="buffer"&&"contentBuffer"in c.dataset){const u=this.getBufferSize(c.dataset);if(u==null)throw new Error("FileDiff.trimColumnRows: invalid element");if(t>0){const p=Math.min(t,u),g=u-p;g>0?(this.updateBufferSize(d,g),this.updateBufferSize(c,g),r+=p):(d.remove(),c.remove(),r+=u),t-=p,t===0&&g===0&&(s=!0)}else if(l){const p=i,g=i+u-1;if(n<=p)d.remove(),c.remove(),r+=u;else if(n<=g){const S=g-n+1,C=u-S;this.updateBufferSize(d,C),this.updateBufferSize(c,C),r+=S}}i+=u;continue}throw console.error({gutterElement:d,contentElement:c}),new Error("FileDiff.trimColumnRows: unknown row elements")}return r}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:i,previousStart:r,trimEnd:o,trimStart:s}){const l=Math.max(0,i-r),a=n-r;if(a<0)throw new Error("FileDiff.trimColumns: overlap ends before previous");const h=s>0,d=o>0;if(!h&&!d)return 0;const c=h?l:0,u=d?a:-1;if(t==="unified"&&!Array.isArray(e))return this.trimColumnRows(e,c,u);if(t==="split"&&Array.isArray(e)){const p=this.trimColumnRows(e[0],c,u),g=this.trimColumnRows(e[1],c,u);if(e[0]!=null&&e[1]!=null&&p!==g)throw new Error("FileDiff.trimColumns: split columns out of sync");return e[0]!=null?p:g}else throw console.error({diffStyle:t,columns:e}),new Error("FileDiff.trimColumns: Invalid columns for diffType")}getBufferSize(e){const t=Number.parseInt(e?.bufferSize??"",10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty("grid-row",`span ${t}`),e.style.setProperty("min-height",`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;const t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}getCodeColumns(e,t,n,i){if(e==="unified")return this.getColumnPair(t);{const r=this.getColumnPair(n),o=this.getColumnPair(i);return r!=null||o!=null?[r,o]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore==null&&(this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",e.before(this.bufferBefore)),this.bufferBefore.style.setProperty("height",`${t.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter==null&&(this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",e.after(this.bufferAfter)),this.bufferAfter.style.setProperty("height",`${t.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:i},r){const{diffIndicators:o="bars",disableBackground:s=!1,disableLineNumbers:l=!1,overflow:a="scroll",diffStyle:h="split"}=this.options,d={type:"diff",diffIndicators:o,disableBackground:s,disableLineNumbers:l,overflow:a,split:h==="unified"?!1:t!=null&&n!=null,totalLines:i,customProperties:r};Sr(d,this.appliedPreAttributes)||(Ar(e,d),this.appliedPreAttributes=d)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;const n=t.shadowRoot??t.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",n.appendChild(this.errorWrapper);const i=document.createElement("div");i.dataset.errorMessage="",i.innerText=e.message,this.errorWrapper.appendChild(i);const r=document.createElement("pre");r.dataset.errorStack="",r.innerText=e.stack??"No Error Stack",this.errorWrapper.appendChild(r)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function yi(e,t){return e==null||t==null?e==null&&t==null:Se(e,t)}function Ol({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function Nl({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function Ul(e,t,n=!1){return!n&&e==null&&t}function Vl(e,t,n=!1){return e==null&&t&&!n}function De(e){if(!(e==null||e.type!=="element"))return e.children??[]}function Bl({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:i,expandUnchanged:r,expandedHunks:o,collapsedContextThreshold:s,canHydratePartialDiff:l}){let a=ye(t,n),h=a;const d=r?!0:o,c=e.hunks.length-1;for(let u=0;u<e.hunks.length;u++){const p=e.hunks[u];if(p==null)throw new Error("computeEstimatedDiffHeights: invalid hunk index");const g=Te({isPartial:e.isPartial,rangeSize:p.collapsedBefore,expandedHunks:d,hunkIndex:u,collapsedContextThreshold:s}),S=(g.fromStart+g.fromEnd)*t.lineHeight;if(a+=S,h+=S,g.collapsedLines>0){const f=it({type:i,metrics:t,hunkIndex:u,hunkSpecs:p.hunkSpecs})?.totalHeight??0;a+=f,h+=f}a+=p.splitLineCount*t.lineHeight,h+=p.unifiedLineCount*t.lineHeight;const C=$l(p);a+=C.split*t.lineHeight,h+=C.unified*t.lineHeight;const b=u===c?Ae({fileDiff:e,hunkIndex:u,expandedHunks:d,collapsedContextThreshold:s,errorPrefix:"computeEstimatedDiffHeights"}):void 0;if(b!=null){const f=(b.fromStart+b.fromEnd)*t.lineHeight;if(a+=f,h+=f,b.collapsedLines>0){const m=Oe({type:i,metrics:t})?.totalHeight??0;a+=m,h+=m}}else if(u===c&&e.isPartial&&l){const f=Oe({type:i,metrics:t})?.totalHeight??0;a+=f,h+=f}}if(e.hunks.length>0){const u=Qt(t);a+=u,h+=u}return{splitHeight:a,unifiedHeight:h}}function $l(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};const t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type==="context"){const n=t.lines>0?1:0;return{split:n,unified:n}}return Wl(e,t)}function Wl(e,t){const n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),i=t.deletions>0&&e.noEOFCRDeletions,r=t.additions>0&&e.noEOFCRAdditions;return{split:i||r?1:0,unified:n}}const Dn=3e3;let Gl=-1;var jl=class extends Wr{__id=`little-virtualized-file-diff:${++Gl}`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;currentExpandUnchanged;pendingHydratedDiff;pendingExpansions;constructor(e,t,n,i,r=!1){super(e,i,r),this.virtualizer=t,this.metrics=Nt(n)}setMetrics(e,t=!1){const n=Nt(e);!t&&$t(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}setFileAnnotationHeight(e){const t=this.cache.fileAnnotationHeight;return e===t?!1:(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e=this.fileDiff){return e==null||!Cn(this.lineAnnotations)?!1:this.lineAnnotations.some(t=>t.lineNumber!==0?!1:e.type==="new"?t.side==="additions":e.type==="deleted"?t.side==="deletions":!0)}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){const t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw new Error("VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(e==null)return;const{options:t}=this,n=!ji(t,e),i=n&&Zl(t,e);super.setOptions(e),i&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Jl(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,i)}setThemeType(e){if(this.isAdvancedMode())throw new Error("VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.");super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.size>0&&this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal!==0&&(this.cache.measuredHeightDeltaTotal=0),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}reconcileHeights(){let e=!1;const{overflow:t="scroll"}=this.options;if(this.fileContainer==null||this.fileDiff==null)return this.height!==0&&(e=!0),this.height=0,e;if(this.top=this.getVirtualizedTop(),t==="scroll"&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled())return e;const n=this.getDiffStyle(),i=n==="split"?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],r=this.hasFileAnnotations(this.fileDiff);if(this.renderRange!=null&&r&&tn(this.renderRange)){const o=ql(i)??0;this.setFileAnnotationHeight(o)&&(e=!0)}else!r&&this.setFileAnnotationHeight(0)&&(e=!0);for(const o of i){if(o==null)continue;const s=o.children[1];if(s instanceof HTMLElement)for(const l of s.children){if(!(l instanceof HTMLElement))continue;const a=l.dataset.lineIndex;if(a==null)continue;const h=td(a,n);let d=l.getBoundingClientRect().height,c=!1;l.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in l.nextElementSibling.dataset||"noNewline"in l.nextElementSibling.dataset)&&("noNewline"in l.nextElementSibling.dataset&&(c=!0),d+=l.nextElementSibling.getBoundingClientRect().height);const u=this.getEstimatedLineHeight(c),p=this.cache.heightDeltas.get(h)??0,g=d-u;g!==p&&(e=!0,this.cache.measuredHeightDeltaTotal+=g-p,g===0?this.cache.heightDeltas.delete(h):this.cache.heightDeltas.set(h,g))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}prepareCodeViewItem(e,t,n,i){const r=!Ye(this.fileDiff,e),o=this.syncLineAnnotations(i);let s=n?.resetDiffLayoutCache===!0||r||o,l=r||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights;n?.metrics!=null&&(this.metrics=Nt(n.metrics),s=!0,l=!0);const{collapsed:a=!1,expandUnchanged:h=!1}=this.options;return this.currentCollapsed!==a&&(this.currentCollapsed=a,s=!0),this.currentExpandUnchanged!==h&&(this.currentExpandUnchanged=h,s=!0,l=!0),s&&this.resetLayoutCache({includeEstimatedHeights:l}),this.fileDiff=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e,t="additions"){if(this.fileDiff==null||e<1)return;const n=this.getLineIndex(e,t);if(n==null)return;const{disableFileHeader:i=!1,expandUnchanged:r=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options,l=this.getDiffStyle(),a=this.getHunkSeparatorType(),h=l==="split"?n[1]:n[0];this.approximateLayoutCheckpoints();const d=ye(this.metrics,i),c=this.getLayoutCheckpointBeforeLineIndex(h);let u=c?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:d,height:0};let p;return Je({diff:this.fileDiff,diffStyle:l,startingLine:c?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:g,hunk:S,collapsedBefore:C,collapsedAfter:b,deletionLine:f,additionLine:m})=>{const y=l==="split"?m?.splitLineIndex??f?.splitLineIndex:m?.unifiedLineIndex??f?.unifiedLineIndex;if(y==null)throw new Error("VirtualizedFileDiff.getLinePosition: missing line index data");if(C>0){const k=it({type:a,metrics:this.metrics,hunkIndex:g,hunkSpecs:S?.hunkSpecs});if(k!=null){if(u+=k.gapBefore,h>=y-C&&h<y)return p={top:u,height:k.height},!0;u+=k.height+k.gapAfter}}const v=this.getLineHeight(y,(m?.noEOFCR??!1)||(f?.noEOFCR??!1));if(y===h)return p={top:u,height:v},!0;if(u+=v,b>0){const k=Oe({type:a,metrics:this.metrics});if(k!=null){if(h>y&&h<=y+b)return p={top:u+k.gapBefore,height:k.height},!0;u+=k.totalHeight}}return!1}}),p}getEditorViewport(){return this.virtualizer.type==="simple"?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){if(this.fileDiff==null)return;const{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:i=!1,collapsedContextThreshold:r=1}=this.options;if(i)return;const o=this.getDiffStyle(),s=this.getHunkSeparatorType();this.approximateLayoutCheckpoints();const l=this.getLayoutCheckpointBeforeTop(e);let a=l?.top??ye(this.metrics,t)+this.cache.fileAnnotationHeight,h;return Je({diff:this.fileDiff,diffStyle:o,startingLine:l?.renderedLineIndex??0,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,callback:({hunkIndex:d,hunk:c,collapsedBefore:u,collapsedAfter:p,deletionLine:g,additionLine:S})=>{const C=o==="split"?S?.splitLineIndex??g?.splitLineIndex:S?.unifiedLineIndex??g?.unifiedLineIndex;if(C==null)throw new Error("VirtualizedFileDiff.getNumericScrollAnchor: missing line index data");if(u>0){const f=it({type:s,metrics:this.metrics,hunkIndex:d,hunkSpecs:c?.hunkSpecs});f!=null&&(a+=f.totalHeight)}if(a>=e&&(g!=null?h={lineNumber:g.lineNumber,side:"deletions",top:a}:S!=null&&(h={lineNumber:S.lineNumber,side:"additions",top:a}),h!=null))return!0;const b=this.getLineHeight(C,(S?.noEOFCR??!1)||(g?.noEOFCR??!1));if(a+=b,p>0){const f=Oe({type:s,metrics:this.metrics});f!=null&&(a+=f.totalHeight)}return!1}}),h}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.fileDiff==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};const t=e!=null?this.computeRenderRangeFromWindow(this.fileDiff,this.top,e):this.renderRange;if(t==null)return;const{bufferBefore:n,bufferAfter:i,totalLines:r}=t;let o=0;if(r===0){const s=e??this.virtualizer.getWindowSpecs();this.top<s.top&&(o=i)}return{topOffset:this.top+n+o,height:this.height-(n+i)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.isSetup=!1,super.cleanUp(e)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.loadFilesIfNecessary(),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(!(this.fileDiff!==e||!e.isPartial)){if(this.isAdvancedMode()){const n=En("clone",e,t);if(await Mn(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(En("merge",e,t),this.setHydratedState(t),await Mn(()=>this.primeHighlightCache(e)),!this.enabled||this.fileDiff!==e)return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}consumeCodeViewLayoutChanges(e){let t=!1,n;const{pendingExpansions:i,pendingHydratedDiff:r}=this;if(i!=null){this.pendingExpansions=void 0;for(const o of i)this.hunksRenderer.expandHunk(o.hunkIndex,o.direction,o.expansionLineCountOverride),t=!0}return r!=null&&(this.pendingHydratedDiff=void 0,r.expectedDiff===e&&(this.setHydratedState(r.files),n=r.nextDiff)),n!=null?(this.forceRenderOverride=!0,this.resetLayoutCache({includeEstimatedHeights:!0})):t&&(this.forceRenderOverride=!0,this.invalidateDerivedLayoutCache(!0)),n}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;const{pendingExpansions:t}=this,n=this.fileDiffCache;if(t==null||t.length===0||n==null)return!1;const{expansionLineCount:i=100,collapsedContextThreshold:r=1}=this.options,o=new Map(this.hunksRenderer.getExpandedHunksMap());for(const s of t){const l={...o.get(s.hunkIndex)??{fromStart:0,fromEnd:0}},a=s.expansionLineCountOverride??i;(s.direction==="up"||s.direction==="both")&&(l.fromStart+=a),(s.direction==="down"||s.direction==="both")&&(l.fromEnd+=a),o.set(s.hunkIndex,l)}return Fr({fileDiff:n,lineNumber:e,expandedHunks:o,collapsedContextThreshold:r})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),!(!this.enabled||this.fileDiff==null)&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}applyDocumentChange(e,t,n=!1){const{renderRange:i}=this;if(this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&i!==void 0&&this.fileDiff!==void 0){const r=this.virtualizer.getWindowSpecs(),o=this.computeRenderRangeFromWindow(this.fileDiff,this.top??0,r);o.bufferAfter!==i.bufferAfter&&this.updateBuffers(o)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.fileDiff){const n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;const i=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}const{disableFileHeader:r=!1,collapsed:o=!1}=this.options,s=ye(this.metrics,r);if(this.height+=s,o){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!i&&this.validateComputedHeight(t),this.layoutDirty=!1}getActiveEstimatedHeight(e=this.fileDiff){this.ensureEstimatedDiffHeights(e);const t=this.getDiffStyle()==="split"?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw new Error("VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height");return t}ensureEstimatedDiffHeights(e=this.fileDiff){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;const{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:i=1}=this.options,{splitHeight:r,unifiedHeight:o}=Bl({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,canHydratePartialDiff:gn(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=r,this.cache.estimatedUnifiedHeight=o}validateComputedHeight(e=this.fileDiff){if(this.fileContainer==null||e==null)return;const t=this.fileContainer.getBoundingClientRect();t.height!==this.height?console.log("VirtualizedFileDiff.computeApproximateSize: computed height doesnt match",{name:e.name,elementHeight:t.height,computedHeight:this.height}):console.log("VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT")}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:i,...r}={}){const o=In(r,"VirtualizedFileDiff.render"),s=o!=null,l=o?.oldFile,a=o?.newFile,h=s&&(!Li(l,this.deletionFile)||!Li(a,this.additionFile));let d=t??this.fileDiff;t==null&&s&&(h||this.fileDiff==null)&&(d=Ue(o.oldFile,o.newFile,this.options.parseDiffOptions));const{forceRenderOverride:c,isSetup:u}=this;this.forceRenderOverride=void 0;const p=this.syncLineAnnotations(i);p&&this.resetLayoutCache({includeEstimatedHeights:!1});const g=t!=null&&t!==this.fileDiff,S=d!=null&&!Ye(this.fileDiff,d),C=g||h;if(S&&this.resetLayoutCache({includeEstimatedHeights:!0}),e=this.getOrCreateFileContainer(e),d==null)return console.error("VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data"),!1;if(u)this.top??=this.getVirtualizedTop(),S&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,d));else{this.computeApproximateSize(!1,d);const v=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(v==null)throw new Error("VirtualizedFileDiff.render: simple virtualizer is not available");v.connect(e,this),this.isVisible=v.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!C||!u))return this.fileDiff=d,o!=null&&(this.deletionFile=l,this.additionFile=a),S&&(this.cachedHeaderHTML=void 0),this.renderPlaceholder(this.height);const b=this.virtualizer.getWindowSpecs(),f=this.top??0,m=this.computeRenderRangeFromWindow(d,f,b),y=super.render({fileDiff:d,fileContainer:e,renderRange:m,lineAnnotations:i,forceRender:(c??n)||p||S,...o,...r});return this.isSimpleMode()&&y&&this.getSimpleVirtualizer()?.requestHeightReconcile(this),y}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type==="simple"}isAdvancedMode(){return this.virtualizer.type==="advanced"}getVirtualizedTop(){return this.virtualizer.type==="advanced"?this.virtualizer.getLocalTopForInstance(this):this.fileContainer!=null?this.virtualizer.getOffsetInScrollContainer(this.fileContainer):0}getSimpleVirtualizer(){return this.virtualizer.type==="simple"?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type==="advanced"?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??"split"}getHunkSeparatorType(){return ed(this.options.hunkSeparators)}approximateLayoutCheckpoints(e=this.fileDiff){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e==null||e.hunks.length===0||this.options.collapsed===!0)return;const{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:i=1}=this.options,r=e.hunks.length-1,o=gn(e,this.options.loadDiffFiles!=null),s=this.getDiffStyle(),l=this.getHunkSeparatorType(),a=n?!0:this.hunksRenderer.getExpandedHunksMap(),h=Kl(this.cache.heightDeltas);let d=ye(this.metrics,t)+this.cache.fileAnnotationHeight,c=0;const u=({rowCount:p,startLineIndex:g,preSeparatorHeight:S=0,postSeparatorHeight:C=0,metadataOffsets:b=[]})=>{if(p<=0)return;const f=c,m=c+p;let y=Yl(f);for(;y<m;){const v=y-f,k=d+(v>0?S:0)+v*this.metrics.lineHeight+Ql(b,v)*this.metrics.lineHeight+Ci(h,g,g+v);this.cache.checkpoints.push({renderedLineIndex:y,lineIndex:g+v,top:k}),y+=Dn}d+=S+p*this.metrics.lineHeight+b.length*this.metrics.lineHeight+Ci(h,g,g+p)+C,c=m};for(let p=0;p<e.hunks.length;p++){const g=e.hunks[p];if(g==null)throw new Error("VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index");const S=Te({isPartial:e.isPartial,rangeSize:g.collapsedBefore,expandedHunks:a,hunkIndex:p,collapsedContextThreshold:i}),C=S.collapsedLines>0?it({type:l,metrics:this.metrics,hunkIndex:p,hunkSpecs:g.hunkSpecs})?.totalHeight??0:0;u({rowCount:S.fromStart,startLineIndex:(s==="split"?g.splitLineStart:g.unifiedLineStart)-S.rangeSize});let b=C;u({rowCount:S.fromEnd,startLineIndex:(s==="split"?g.splitLineStart:g.unifiedLineStart)-S.fromEnd,preSeparatorHeight:b}),S.fromEnd>0&&(b=0);const f=p===r?Ae({fileDiff:e,hunkIndex:p,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:"VirtualizedFileDiff"}):void 0,m=f!=null&&f.collapsedLines>0?Oe({type:l,metrics:this.metrics})?.totalHeight??0:p===r&&o?Oe({type:l,metrics:this.metrics})?.totalHeight??0:0,y=f!=null?f.fromStart+f.fromEnd:0,v=s==="split"?g.splitLineCount:g.unifiedLineCount,k=s==="split"?g.splitLineStart:g.unifiedLineStart;u({rowCount:v,startLineIndex:k,preSeparatorHeight:b,postSeparatorHeight:y===0?m:0,metadataOffsets:Xl({diffStyle:s,hunk:g,rowCount:v})}),f!=null&&y>0&&u({rowCount:y,startLineIndex:k+v,postSeparatorHeight:m})}this.cache.totalLines=c}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,i;for(;t<=n;){const r=t+n>>1,o=this.cache.checkpoints[r];if(o==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");o.lineIndex<=e?(i=o,t=r+1):n=r-1}return i}getLayoutCheckpointBeforeTop(e,t){let n=0,i=this.cache.checkpoints.length-1,r=-1;for(;n<=i;){const o=n+i>>1,s=this.cache.checkpoints[o];if(s==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");s.top<=e?(r=o,n=o+1):i=o-1}if(t==null)return r>=0?this.cache.checkpoints[r]:void 0;for(let o=r;o>=0;o--){const s=this.cache.checkpoints[o];if(s==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");if(s.renderedLineIndex%t===0)return s}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(const l of e.hunks)n+=t==="split"?l.splitLineCount:l.unifiedLineCount;return n}const{expandUnchanged:i=!1,collapsedContextThreshold:r=1}=this.options,o=i?!0:this.hunksRenderer.getExpandedHunksMap();for(const[l,a]of e.hunks.entries()){const h=t==="split"?a.splitLineCount:a.unifiedLineCount;n+=h;const d=Math.max(a.collapsedBefore,0),{fromStart:c,fromEnd:u,renderAll:p}=Te({isPartial:e.isPartial,rangeSize:d,expandedHunks:o,hunkIndex:l,collapsedContextThreshold:r});d>0&&(n+=p?d:c+u)}const s=Ae({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:o,collapsedContextThreshold:r,errorPrefix:"VirtualizedFileDiff"});return s!=null&&(n+=s.fromStart+s.fromEnd),n}getLayoutLineCount(e,t){const n=this.getExpandedLineCount(e,t),i=t==="split"?e.splitLineCount:e.unifiedLineCount;return Math.max(n,i,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:i}){const{disableFileHeader:r=!1,expandUnchanged:o=!1,collapsedContextThreshold:s=1}=this.options,{hunkLineCount:l,lineHeight:a}=this.metrics,h=this.getDiffStyle(),d=this.getHunkSeparatorType(),c=gn(e,this.options.loadDiffFiles!=null),u=this.height;let p=this.getLayoutLineCount(e,h);const g=ye(this.metrics,r),S=e.hunks.length>0?Qt(this.metrics):0,{fileAnnotationHeight:C}=this.cache,b=g+C,f=Math.max(0,u-g-C-S),m=this.hasFileAnnotations(e),y=t+g,v=C>0&&m&&y<i&&y+C>n;if(t<n-u||t>i)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:u-g-S};if(p<=l||e.hunks.length===0)return{startingLine:0,totalLines:l,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,h);const k=Math.ceil(Math.max(i-n,0)/a),x=Math.ceil(k/l)*l+l,T=x/l,L=T,A=[],U=(n+i)/2,w=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-x*a*2),l);let R=t+(w?.top??b),M=w?.renderedLineIndex??0,D,H,I;if(Je({diff:e,diffStyle:h,startingLine:w?.renderedLineIndex??0,expandedHunks:o?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:j,hunk:$,collapsedBefore:K,collapsedAfter:Me,deletionLine:ie,additionLine:ue})=>{const V=ue!=null?ue.splitLineIndex:ie.splitLineIndex,J=ue!=null?ue.unifiedLineIndex:ie.unifiedLineIndex,re=(ue?.noEOFCR??!1)||(ie?.noEOFCR??!1),ze=j===e.hunks.length-1&&$!=null&&(h==="split"?V===$.splitLineStart+$.splitLineCount-1:J===$.unifiedLineStart+$.unifiedLineCount-1),fe=(K>0?it({type:d,metrics:this.metrics,hunkIndex:j,hunkSpecs:$?.hunkSpecs}):void 0)?.totalHeight??0;R+=fe;const pe=M%l===0,Ie=Math.floor(M/l);if(pe&&(A[Ie]=R-(t+b+fe),I!=null)){if(I<=0)return!0;I--}const ee=this.getLineHeight(h==="split"?V:J,re);if(R>n-ee&&R<i&&(D??=Ie),H==null&&R+ee>U&&(H=Ie),I==null&&R>=i&&pe&&(I=L),M++,R+=ee,Me>0||ze&&c){const gt=Oe({type:d,metrics:this.metrics});gt!=null&&(R<i&&R+gt.totalHeight>n&&(D??=Ie),H==null&&R+gt.totalHeight>U&&(H=Ie),R+=gt.totalHeight)}return!1}}),D==null)if(v)D=0,H=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:u-g-S};H??=D;const P=Math.round(H-T/2),O=Math.max(0,Math.ceil(p/l)-T),_=Math.max(0,Math.min(P,O)),z=_*l,N=P<0?x+P*l:x,q=A[_]??0,B=z===0?0:C+q,Z=_+N/l,ne=Z<A.length?f-A[Z]:f-(R-t-b);return{startingLine:z,totalLines:N,bufferBefore:B,bufferAfter:Math.max(0,ne)}}};function ql(e){let t;for(const n of e){if(n==null)continue;const i=n.children[1];if(i instanceof HTMLElement)for(const r of i.children)r instanceof HTMLElement&&r.dataset.lineAnnotation===gr&&(t=Math.max(t??0,r.getBoundingClientRect().height))}return t}function Kl(e){const t=Array.from(e).sort((o,s)=>o[0]-s[0]),n=[],i=[0];let r=0;for(const[o,s]of t)n.push(o),r+=s,i.push(r);return{lineIndexes:n,prefixTotals:i}}function Ci({lineIndexes:e,prefixTotals:t},n,i){if(n>=i||e.length===0)return 0;const r=xi(e,n);return(t[xi(e,i)]??0)-(t[r]??0)}function xi(e,t){let n=0,i=e.length;for(;n<i;){const r=n+i>>1,o=e[r];if(o==null)throw new Error("VirtualizedFileDiff: invalid prefix index");o<t?n=r+1:i=r}return n}function Yl(e){return Math.ceil(e/Dn)*Dn}function Ql(e,t){let n=0;for(const i of e)i<t&&n++;return n}function Xl({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];const i=t.hunkContent.at(-1);if(i==null)return[];if(i.type==="context")return[n-1];const r=Math.max(i.deletions,i.additions),o=i.deletions+i.additions;if(e==="split")return r>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];const s=[],l=n-o;return i.deletions>0&&t.noEOFCRDeletions&&s.push(l+i.deletions-1),i.additions>0&&t.noEOFCRAdditions&&s.push(n-1),s}function Zl(e,t){return(e.diffStyle??"split")!==(t.diffStyle??"split")||(e.overflow??"scroll")!==(t.overflow??"scroll")||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??"bars")!==(t.diffIndicators??"bars")||(e.hunkSeparators??"line-info")!==(t.hunkSeparators??"line-info")||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function Jl(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??"line-info")!==(t.hunkSeparators??"line-info")||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function gn(e,t){return e.isPartial&&t&&(e.type==="change"||e.type==="rename-changed")}function ed(e){return typeof e=="function"?"custom":e??"line-info"}function Li(e,t){return e==null||t==null?e==null&&t==null:Se(e,t)}function td(e,t){const[n,i]=e.split(",").map(Number);return t==="split"?i:n}function nd(e,t){return e==null||t==null?e===t:e.top===t.top&&e.bottom===t.bottom}const Gr=1e3,id=Gr*4,rd=[0,1e-6,.99999,1],od={overscrollSize:Gr,intersectionObserverMargin:id,resizeDebugging:!1};let Mt=0,sd=-1;var jr=class ve{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++sd}`;config;type="simple";intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;reconcileQueue=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(t){this.config={...od,...t}}setup(t,n){if(this.root==null){this.root=t,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:rd,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),t instanceof Document?this.setupWindow():this.setupElement(n),window.__INSTANCE=this,window.__TOGGLE=()=>{ve.__STOP?(ve.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:ve.__lastScrollPosition}),Q(this.computeRenderRangeAndEmit)):(ve.__lastScrollPosition=this.getScrollTop(),ve.__STOP=!0)};for(const[i,r]of this.connectQueue.entries())this.connect(i,r);this.connectQueue.clear(),this.markDOMDirty(),Q(this.computeRenderRangeAndEmit)}}instanceChanged(t,n){this.instancesChanged.add(t),n&&this.markDOMDirty(),Q(this.computeRenderRangeAndEmit)}requestHeightReconcile(t){this.reconcileQueue.add(t),Q(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=Kn({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}getRoot(){return this.root}isInstanceVisible(t,n){const i=this.getScrollTop(),r=this.getHeight(),o=this.config.intersectionObserverMargin,s=i-o,l=i+r+o;return!(t<s-n||t>l)}handleContainerResize=t=>{if(this.root==null)return;let n=!1;for(const i of t){const r=i.borderBoxSize[0].blockSize;this.root instanceof Document?r!==this.scrollHeight&&(this.scrollHeightDirty=!0,n=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:r-Mt,newSize:r}),Mt=r)):i.target===this.root?r!==this.height&&(this.heightDirty=!0,n=!0):i.target===this.contentContainer&&(this.scrollHeightDirty=!0,n=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:r-Mt,newSize:r}),Mt=r))}n&&Q(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(t){if(this.root==null||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),t??=this.root.firstElementChild??void 0,t instanceof HTMLElement&&(this.contentContainer=t,this.resizeObserver?.observe(t))}cleanUp(){Bt(this.computeRenderRangeAndEmit),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.reconcileQueue.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.scrollHeightDirty=!0}getOffsetInScrollContainer(t){return this.getScrollTop()+tt(t,this.getScrollContainerElement())}connect(t,n){if(this.observers.has(t))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(t,n):(this.intersectionObserver.observe(t),this.observers.set(t,n),this.instancesChanged.add(n),this.markDOMDirty(),Q(this.computeRenderRangeAndEmit)),()=>this.disconnect(t)}disconnect(t){const n=this.observers.get(t);this.connectQueue.delete(t),n!=null&&(this.intersectionObserver?.unobserve(t),this.observers.delete(t),this.instancesChanged.delete(n),this.reconcileQueue.delete(n),this.visibleInstances.delete(t)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),Q(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{ve.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,Q(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{ve.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,Q(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{ve.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,Q(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(ve.__STOP)return;const t=this.heightDirty||this.scrollHeightDirty;let n=this.instancesChanged.size>0;if(this.instancesChanged.size===0){const o=Kn({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!t&&nd(this.windowSpecs,o)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.reconcileQueue.size===0)return;this.windowSpecs=o}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const i=this.getScrollAnchor(this.height),r=new Set;for(const o of t?this.observers.values():this.visibleInstances.values())o.onRender(t)&&r.add(o);for(const o of this.instancesChanged)r.has(o)||o.onRender(t)&&r.add(o);this.scrollFix(i);for(const o of r)this.reconcileQueue.delete(o),o.reconcileHeights();for(const o of this.reconcileQueue)o.reconcileHeights()&&(n=!0);this.reconcileQueue.clear(),n||=this.instancesChanged.size>0,n&&this.markDOMDirty(),(n||t)&&Q(this.computeRenderRangeAndEmit),r.clear(),this.instancesChanged.clear()};scrollFix(t){if(t==null)return;const n=this.getScrollContainerElement(),{lineIndex:i,lineOffset:r,fileElement:o,fileOffset:s,fileTypeOffset:l}=t;if(i!=null&&r!=null){const h=o.shadowRoot?.querySelector(`[data-line][data-line-index="${i}"]`);if(h instanceof HTMLElement){const d=tt(h,n);if(d!==r){const c=d-r;this.applyScrollFix(c)}return}}const a=tt(o,n);if(l==="top")a!==s&&this.applyScrollFix(a-s);else{const h=a+o.getBoundingClientRect().height;h!==s&&this.applyScrollFix(h-s)}}applyScrollFix(t){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+t,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+t,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(t){const n=this.getScrollContainerElement();let i;for(const[r]of this.visibleInstances.entries()){const o=tt(r,n),s=o+r.offsetHeight;let l,a;s<=0?(l=s,a="bottom"):(l=o,a="top");let h,d;if(s>0&&o<t)for(const u of r.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(u instanceof HTMLElement))continue;const p=u.dataset.lineIndex;if(p==null)continue;const g=tt(u,n);if(!(g<0)){h=p,d=g;break}}if(i?.lineOffset!=null&&d==null)continue;let c=!1;(i==null||d!=null&&(i.lineOffset==null||d<i.lineOffset)||d==null&&i.lineOffset==null&&(l>=0&&(i.fileOffset<0||l<i.fileOffset)||l<0&&i.fileOffset<0&&l>i.fileOffset))&&(c=!0),c&&(i={fileElement:r,fileTypeOffset:a,fileOffset:l,lineIndex:h,lineOffset:d})}return i}handleIntersectionChange=t=>{this.scrollDirty=!0;for(const{target:n,isIntersecting:i}of t){if(!(n instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const r=this.observers.get(n);r!=null&&(i&&!this.visibleInstances.has(n)?(r.setVisibility(!0),this.visibleInstances.set(n,r),this.visibleInstancesDirty=!0):!i&&this.visibleInstances.has(n)&&(r.setVisibility(!1),this.visibleInstances.delete(n),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&Q(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let t=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return t=this.clampScrollTop(t),this.scrollTop=t,t}scrollTo({top:t,behavior:n="auto"}){const{root:i}=this;if(i==null)return;const r=this.clampScrollTop(t);i instanceof Document?window.scrollTo({top:r,behavior:n}):i.scrollTo({top:r,behavior:n}),this.scrollDirty=!0,Q(this.computeRenderRangeAndEmit)}clampScrollTop(t){return Math.max(0,Math.min(t,this.getScrollHeight()-this.getHeight()))}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function tt(e,t){const n=e.getBoundingClientRect(),i=t?.getBoundingClientRect().top??0;return n.top-i}var ad=He('<div class="flex min-h-56 flex-col items-center justify-center gap-2 px-6 py-10 text-center"><div class="text-14-semibold text-text-strong"></div><div class="text-14-regular text-text-weak">'),It=He('<div class="flex min-h-40 items-center justify-center px-6 py-4 text-center text-text-weak">'),ld=He('<div class="flex justify-center bg-background-stronger px-6 py-4"><img class="max-h-[60vh] max-w-full rounded border border-border-weak-base bg-background-base object-contain">'),dd=He('<div class="flex justify-center bg-background-stronger px-6 py-4"><audio class="w-full max-w-xl"controls preload=metadata><source>'),hd=He('<div class="flex flex-col gap-4 px-6 py-4">'),cd=He('<div class="flex justify-center"><img class="max-h-[60vh] max-w-full rounded border border-border-weak-base bg-background-base object-contain">');function ud(e,t){return e.current!==void 0?e.current:e.after??e.before}function ki(e){const t=$i(),n=()=>e.media,i=Y(()=>{const f=n();if(!(!f||f.mode==="off"))return Eo(f.path)}),r=Y(()=>{const f=n();return!f||f.mode==="off"||i()?!1:Ro(f.current)}),o=()=>e.media?.onLoad?.(),s=Y(()=>{const f=n(),m=i();return!f||!m||m==="svg"||f.current!==void 0?!1:!rn(f.after)&&rn(f.before)}),l=Y(()=>{const f=n(),m=i();if(!(!f||m!=="image"&&m!=="audio"))return on(ud(f,m),m)}),a=Y(()=>{const f=n(),m=i();if(!(!f||m!=="image"&&m!=="audio")&&f.current===void 0&&!s()&&!l()&&!(!f.path||!f.readFile))return{key:`${m}:${f.path}`,kind:m,path:f.path,readFile:f.readFile,onError:f.onError}}),h=To(a,async f=>f.readFile(f.path).then(m=>{const y=on(m,f.kind);return y?{key:f.key,src:y,mime:f.kind==="audio"?Ho(m?.mimeType):void 0}:(f.onError?.({kind:f.kind}),{key:f.key,error:!0})},()=>(f.onError?.({kind:f.kind}),{key:f.key,error:!0}))),d=Y(()=>{const f=a(),m=h();if(!(!f||!m||m.key!==f.key))return m}),c=Y(()=>{const f=d();return l()??(f&&"src"in f?f.src:void 0)}),u=Y(()=>l()?"ready":a()?h.loading?"loading":d()?.error?"error":c()?"ready":"idle":"idle"),p=Y(()=>{const f=d();return f&&"mime"in f?f.mime:void 0}),g=Y(()=>{const f=n();if(!(!f||i()!=="svg"))return Ao(f.current)}),S=Y(()=>{const f=n();if(!(!f||i()!=="svg"))return on(f.current,"svg")}),C=Y(()=>{const f=n();if(!(!f||i()!=="svg")&&g()===void 0&&rn(f.current))return[f.path,f.current]});Ee(fo(C,f=>{f&&n()?.onError?.({kind:"svg"})},{defer:!0}));const b=f=>t.t(f==="image"?"ui.fileMedia.kind.image":"ui.fileMedia.kind.audio");return W(po,{get children(){return[W(mt,{get when(){return i()==="image"||i()==="audio"},get children(){return W(ot,{get when(){return c()},get fallback(){const f=n(),m=i();if(!f||m!=="image"&&m!=="audio")return e.fallback();const y=b(m);return s()?(()=>{var v=It();return X(v,()=>t.t("ui.fileMedia.state.removed",{kind:y})),v})():u()==="loading"?(()=>{var v=It();return X(v,()=>t.t("ui.fileMedia.state.loading",{kind:y})),v})():u()==="error"?(()=>{var v=It();return X(v,()=>t.t("ui.fileMedia.state.error",{kind:y})),v})():(()=>{var v=It();return X(v,()=>t.t("ui.fileMedia.state.unavailable",{kind:y})),v})()},children:f=>{const m=i();return m!=="image"&&m!=="audio"?e.fallback():m==="image"?(()=>{var y=ld(),v=y.firstChild;return v.addEventListener("load",o),Qe(k=>{var x=f(),T=n()?.path;return x!==k.e&&le(v,"src",k.e=x),T!==k.t&&le(v,"alt",k.t=T),k},{e:void 0,t:void 0}),y})():(()=>{var y=dd(),v=y.firstChild,k=v.firstChild;return v.addEventListener("loadedmetadata",o),Qe(x=>{var T=f(),L=p();return T!==x.e&&le(k,"src",x.e=T),L!==x.t&&le(k,"type",x.t=L),x},{e:void 0,t:void 0}),y})()}})}}),W(mt,{get when(){return i()==="svg"},get children(){return g()===void 0&&S()==null?e.fallback():(()=>{var f=hd();return X(f,W(ot,{get when(){return g()!==void 0},get children(){return e.fallback()}}),null),X(f,W(ot,{get when(){return S()},children:m=>(()=>{var y=cd(),v=y.firstChild;return v.addEventListener("load",o),Qe(k=>{var x=m(),T=n()?.path;return x!==k.e&&le(v,"src",k.e=x),T!==k.t&&le(v,"alt",k.t=T),k},{e:void 0,t:void 0}),y})()}),null),f})()}}),W(mt,{get when(){return r()},get children(){var f=ad(),m=f.firstChild,y=m.nextSibling;return X(m,()=>n()?.path?.split("/").pop()??t.t("ui.fileMedia.binary.title")),X(y,()=>{const v=n()?.path;return v?t.t("ui.fileMedia.binary.description.path",{path:v}):t.t("ui.fileMedia.binary.description.default")}),f}}),W(mt,{when:!0,get children(){return e.fallback()}})]}})}const fd=`
1360
+ [data-diff],
1361
+ [data-file] {
1362
+ /*
1363
+ * Pierre mixes line tints from --diffs-bg + --diffs-*-base.
1364
+ * --diffs-bg-*-override must be the accent color to mix with, NOT a pre-mixed row color
1365
+ * (pre-mixing here made add/delete rows nearly identical to the page background).
1366
+ */
1367
+ --diffs-bg: var(--background-stronger, light-dark(#ffffff, #0a0a0a));
1368
+ --diffs-bg-buffer: var(--diffs-bg-buffer-override, light-dark( color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))));
1369
+ --diffs-bg-hover: var(--diffs-bg-hover-override, light-dark( color-mix(in lab, var(--diffs-bg) 97%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-mixer))));
1370
+ --diffs-bg-context: var(--diffs-bg-context-override, light-dark( color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))));
1371
+ --diffs-bg-separator: var(--diffs-bg-separator-override, light-dark( color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))));
1372
+ --diffs-fg: var(--text-strong, light-dark(#111111, #f5f5f5));
1373
+ --diffs-fg-number: var(--diffs-fg-number-override, light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))));
1374
+ --diffs-deletion-base: var(--syntax-diff-delete, var(--text-diff-delete-base, #fc533a));
1375
+ --diffs-addition-base: var(--syntax-diff-add, var(--text-diff-add-base, #9bcd97));
1376
+ --diffs-modified-base: var(--syntax-diff-unknown, #ff0000);
1377
+ /* Theme surface tokens: readable full-row red/green without double-mixing. */
1378
+ --diffs-bg-deletion: var(--surface-diff-delete-base);
1379
+ --diffs-bg-deletion-number: var(--surface-diff-delete-weak);
1380
+ --diffs-bg-deletion-hover: var(--surface-diff-delete-strong);
1381
+ --diffs-bg-deletion-emphasis: var(--diffs-bg-deletion-emphasis-override, light-dark(rgb(from var(--diffs-deletion-base) r g b / 0.18), rgb(from var(--diffs-deletion-base) r g b / 0.22)));
1382
+ --diffs-bg-addition: var(--surface-diff-add-base);
1383
+ --diffs-bg-addition-number: var(--surface-diff-add-weak);
1384
+ --diffs-bg-addition-hover: var(--surface-diff-add-strong);
1385
+ --diffs-bg-addition-emphasis: var(--diffs-bg-addition-emphasis-override, light-dark(rgb(from var(--diffs-addition-base) r g b / 0.14), rgb(from var(--diffs-addition-base) r g b / 0.2)));
1386
+ --diffs-selection-base: var(--surface-warning-strong);
1387
+ --diffs-selection-border: var(--border-warning-base);
1388
+ --diffs-selection-number-fg: #1c1917;
1389
+ /* Use explicit alpha instead of color-mix(..., transparent) to avoid Safari's non-premultiplied interpolation bugs. */
1390
+ --diffs-bg-selection: var(--diffs-bg-selection-override, rgb(from var(--surface-warning-base) r g b / 0.65));
1391
+ --diffs-bg-selection-number: var(
1392
+ --diffs-bg-selection-number-override,
1393
+ rgb(from var(--surface-warning-base) r g b / 0.85)
1394
+ );
1395
+ --diffs-bg-selection-text: rgb(from var(--surface-warning-strong) r g b / 0.2);
1396
+ }
1397
+
1398
+ /*
1399
+ * Paint full-row add/delete fills from theme tokens.
1400
+ * Pierre paints via --diffs-line-bg (color-mix of bg + accent). Our old override
1401
+ * pre-mixed that accent, so rows looked almost identical to the page background.
1402
+ * Drive both the variable and background-color so the tint always shows.
1403
+ * Skip selected rows so the selection highlight still wins.
1404
+ */
1405
+ [data-diff] [data-line][data-line-type='change-addition']:not([data-selected-line]),
1406
+ [data-diff] [data-column-number][data-line-type='change-addition']:not([data-selected-line]),
1407
+ [data-diff] [data-gutter-buffer][data-line-type='change-addition']:not([data-selected-line]),
1408
+ [data-diff] [data-no-newline][data-line-type='change-addition']:not([data-selected-line]) {
1409
+ --diffs-line-bg: var(--surface-diff-add-base);
1410
+ --diffs-computed-diff-line-bg: var(--surface-diff-add-base);
1411
+ background-color: var(--surface-diff-add-base);
1412
+ }
1413
+ [data-diff] [data-line][data-line-type='change-deletion']:not([data-selected-line]),
1414
+ [data-diff] [data-column-number][data-line-type='change-deletion']:not([data-selected-line]),
1415
+ [data-diff] [data-gutter-buffer][data-line-type='change-deletion']:not([data-selected-line]),
1416
+ [data-diff] [data-no-newline][data-line-type='change-deletion']:not([data-selected-line]) {
1417
+ --diffs-line-bg: var(--surface-diff-delete-base);
1418
+ --diffs-computed-diff-line-bg: var(--surface-diff-delete-base);
1419
+ background-color: var(--surface-diff-delete-base);
1420
+ }
1421
+
1422
+ :host([data-color-scheme='dark']) [data-diff],
1423
+ :host([data-color-scheme='dark']) [data-file] {
1424
+ --diffs-selection-number-fg: #fdfbfb;
1425
+ --diffs-bg-selection: var(--diffs-bg-selection-override, rgb(81 67 7 / 0.65));
1426
+ --diffs-bg-selection-number: var(
1427
+ --diffs-bg-selection-number-override,
1428
+ rgb(81 67 7 / 0.85)
1429
+ );
1430
+ }
1431
+
1432
+ [data-diff] ::selection,
1433
+ [data-file] ::selection {
1434
+ background-color: var(--diffs-bg-selection-text);
1435
+ }
1436
+
1437
+ ::highlight(mux-find) {
1438
+ background-color: rgb(from var(--surface-warning-base) r g b / 0.35);
1439
+ }
1440
+
1441
+ ::highlight(mux-find-current) {
1442
+ background-color: rgb(from var(--surface-warning-strong) r g b / 0.55);
1443
+ }
1444
+
1445
+
1446
+
1447
+ [data-diff] [data-line][data-selected-line] {
1448
+ background-color: var(--diffs-bg-selection);
1449
+ box-shadow: inset 2px 0 0 var(--diffs-selection-border);
1450
+ }
1451
+
1452
+ [data-file] [data-line][data-selected-line] {
1453
+ background-color: var(--diffs-bg-selection);
1454
+ box-shadow: inset 2px 0 0 var(--diffs-selection-border);
1455
+ }
1456
+
1457
+ [data-diff] [data-column-number][data-selected-line] {
1458
+ background-color: var(--diffs-bg-selection-number);
1459
+ color: var(--diffs-selection-number-fg);
1460
+ }
1461
+
1462
+ [data-file] [data-column-number][data-selected-line] {
1463
+ background-color: var(--diffs-bg-selection-number);
1464
+ color: var(--diffs-selection-number-fg);
1465
+ }
1466
+
1467
+ [data-diff] [data-column-number][data-line-type='context'][data-selected-line],
1468
+ [data-diff] [data-column-number][data-line-type='context-expanded'][data-selected-line],
1469
+ [data-diff] [data-column-number][data-line-type='change-addition'][data-selected-line],
1470
+ [data-diff] [data-column-number][data-line-type='change-deletion'][data-selected-line] {
1471
+ color: var(--diffs-selection-number-fg);
1472
+ }
1473
+
1474
+ /* The deletion word-diff emphasis is stronger than additions; soften it while selected so the selection highlight reads consistently. */
1475
+ [data-diff] [data-line][data-line-type='change-deletion'][data-selected-line] {
1476
+ --diffs-bg-deletion-emphasis: light-dark(
1477
+ rgb(from var(--diffs-deletion-base) r g b / 0.07),
1478
+ rgb(from var(--diffs-deletion-base) r g b / 0.1)
1479
+ );
1480
+ }
1481
+
1482
+ [data-diff-header],
1483
+ [data-diff],
1484
+ [data-file] {
1485
+ [data-separator] {
1486
+ height: 24px;
1487
+ }
1488
+ [data-column-number]:not([data-line-type='change-deletion']):not([data-line-type='change-addition']) {
1489
+ background-color: var(--background-stronger);
1490
+ }
1491
+
1492
+ [data-column-number] {
1493
+ cursor: default !important;
1494
+ }
1495
+
1496
+ [data-file] [data-column-number] {
1497
+ padding-inline: 0.5ch;
1498
+ padding-left: 1ch;
1499
+ font-size: 11px;
1500
+ }
1501
+
1502
+ [data-file] [data-line-number-content] {
1503
+ min-width: var(--diffs-min-number-column-width, 2ch);
1504
+ }
1505
+
1506
+ &[data-interactive-line-numbers] [data-column-number] {
1507
+ cursor: default !important;
1508
+ }
1509
+
1510
+ &[data-interactive-lines] [data-line] {
1511
+ cursor: auto !important;
1512
+ }
1513
+ [data-code] {
1514
+ overflow-x: auto !important;
1515
+ overflow-y: clip !important;
1516
+ }
1517
+ }
1518
+
1519
+
1520
+
1521
+ `;function qr(e){return{theme:G,themeType:"system",disableLineNumbers:!1,overflow:"wrap",diffStyle:e??"unified",diffIndicators:"bars",lineHoverHighlight:"both",disableBackground:!1,expansionLineCount:20,hunkSeparators:"line-info-basic",lineDiffType:e==="split"?"word-alt":"none",maxLineDiffLength:1e3,maxLineLengthForHighlighting:1e3,disableFileHeader:!0,unsafeCSS:fd}}const pd={"--diffs-font-family":"var(--font-family-mono)","--diffs-font-size":"var(--file-font-size, var(--font-size-small))","--diffs-line-height":"calc(var(--file-font-size, var(--font-size-small)) * 1.65)","--diffs-tab-size":2,"--diffs-font-features":"var(--font-family-mono--font-feature-settings)","--diffs-header-font-family":"var(--font-family-sans)","--diffs-gap-block":0,"--diffs-min-number-column-width":"2ch","--diffs-light-bg":"var(--background-stronger)","--diffs-dark-bg":"var(--background-stronger)"};function Kr(e){const t=e.closest("[data-line], [data-alt-line]");if(t instanceof HTMLElement){const i=t.dataset.lineType;if(i==="change-deletion")return"deletions";if(i==="change-addition"||i==="change-additions")return"additions"}const n=e.closest("[data-code]");return n instanceof HTMLElement&&n.hasAttribute("data-deletions")?"deletions":"additions"}function wi(e,t){const n=t.dataset.lineIndex;if(!n)return;const i=n.split(",").map(r=>parseInt(r,10)).filter(r=>!Number.isNaN(r));if(i.length!==0)return e&&i.length===2?i[1]:i[0]}function Ei(e,t,n,i){const r=Array.from(e.querySelectorAll(`[data-line="${n}"], [data-alt-line="${n}"]`)).filter(s=>s instanceof HTMLElement);if(r.length===0)return;const o=i??"additions";for(const s of r)if(Kr(s)===o||parseInt(s.dataset.altLine??"",10)===n)return wi(t,s)}function Ri(e,t){if(!t)return t;if(!e)return;const n=e.querySelector("[data-diff]");if(!(n instanceof HTMLElement))return;const i=n.dataset.diffType==="split",r=Ei(e,i,t.start,t.side),o=Ei(e,i,t.end,t.endSide??t.side);if(r===void 0||o===void 0)return e.querySelector("[data-line], [data-alt-line]")==null?void 0:null;if(r<=o)return t;const s=t.endSide??t.side,l={start:t.end,end:t.start};return s&&(l.side=s),t.endSide&&t.side&&(l.endSide=t.side),l}function gd(e){return e?e.start===e.end&&(e.endSide==null||e.endSide===e.side):!1}function md(e){if(e instanceof Range)return e;const t=new Range;return t.setStart(e.startContainer,e.startOffset),t.setEnd(e.endContainer,e.endOffset),t}function Yr(e,t){!e||!t||requestAnimationFrame(()=>{const n=e.getSelection?.()??window.getSelection();if(n)try{n.removeAllRanges(),n.addRange(t)}catch{}})}function vd(){let e="none",t,n=!1,i=!1;const r=()=>{e="none",t=void 0,n=!1};return{begin(o,s){if(!o){e="text";return}e="numbers",t=s,n=!1},track(o,s){return e!=="numbers"?!1:(o&1)===0?(r(),!0):(s!==void 0&&t!==void 0&&s!==t&&(n=!0),!0)},finish(){const o=e;return i=o==="numbers"&&n,r(),o},consume(o){const s=i&&!gd(o);return i=!1,s},reset(){i=!1,r()}}}function nn(e){if(e)return e instanceof HTMLElement?e:e.parentElement??void 0}function bd(e){const t=nn(e);if(!t)return;const n=t.closest("[data-line]");if(!(n instanceof HTMLElement))return;const i=parseInt(n.dataset.line??"",10);if(!Number.isNaN(i))return i}function Ti(e){const t=nn(e);if(!t)return;const n=t.closest("[data-line], [data-alt-line]");if(!(n instanceof HTMLElement))return;const i=parseInt(n.dataset.line??"",10);if(!Number.isNaN(i))return i;const r=parseInt(n.dataset.altLine??"",10);if(!Number.isNaN(r))return r}function Sd(e){const t=nn(e);if(!t)return;const n=t.closest("[data-code]");if(n instanceof HTMLElement)return n.hasAttribute("data-deletions")?"deletions":"additions"}function Qr(e){const t=e.root.getSelection?.()??window.getSelection();if(!t||t.isCollapsed)return;const n=t.getComposedRanges?.({shadowRoots:[e.root]})?.[0]??(t.rangeCount>0?t.getRangeAt(0):void 0),i=n?.startContainer??t.anchorNode,r=n?.endContainer??t.focusNode;if(!i||!r||!e.root.contains(i)||!e.root.contains(r))return;const o=e.lineForNode(i),s=e.lineForNode(r);if(o===void 0||s===void 0)return;const l=e.sideForNode?.(i),a=e.sideForNode?.(r),h=l??a,d={start:o,end:s};return h&&(d.side=h),a&&h&&a!==h&&(d.endSide=a),{range:d,text:e.preserveTextSelection&&n?md(n).cloneRange():void 0}}const Dt=new WeakMap,yd={lineHeight:24,hunkSeparatorHeight:24,spacing:0,paddingTop:0,paddingBottom:0};function Cd(e){return e==="auto"||e==="scroll"||e==="overlay"}function Ai(e){let t=e.parentElement;for(;t;){const n=getComputedStyle(t);if(Cd(n.overflowY))return t;t=t.parentElement}}function xd(e){if(typeof document>"u")return;const t=e.closest("[data-component='session-review']");if(t instanceof HTMLElement){const i=Ai(e)??t,r=t.querySelector("[data-slot='session-review-container']");return{key:t,root:i,content:r instanceof HTMLElement?r:void 0}}const n=Ai(e);if(n){const i=n.querySelector("[role='log']");return{key:n,root:n,content:i instanceof HTMLElement?i:void 0}}return{key:document,root:document,content:void 0}}function Ld(e){const t=xd(e);if(!t)return;let n=Dt.get(t.key);if(!n){const r=new jr;r.setup(t.root,t.content),n={virtualizer:r,refs:0},Dt.set(t.key,n)}n.refs+=1;let i=!1;return{virtualizer:n.virtualizer,release(){if(i)return;i=!0;const r=Dt.get(t.key);r&&(r.refs-=1,!(r.refs>0)&&(r.virtualizer.cleanUp(),Dt.delete(t.key)))}}}const kd=mo();function Xr(e){return go(kd)?.get(e)}const Zr=["mode","media","class","classList","annotations","selectedLines","search","onLineSelected","onLineSelectionEnd","onLineNumberSelectionEnd","onRendered","virtualize","preloadedDiff"],wd=["file","edit",...Zr],Ed=["fileDiff","before","after",...Zr];function Rd(e){if(!e.dataset.line)return;const t=parseInt(e.dataset.line,10);if(!Number.isNaN(t))return t}function Jr(e,t,n){const i=e.composedPath();let r=!1,o,s;for(const l of i)if(l instanceof HTMLElement&&(r=r||l.dataset.columnNumber!=null,o===void 0&&(o=t(l)),s===void 0&&n&&(s=n(l)),r&&o!==void 0&&(n==null||s!==void 0)))break;return{line:o,numberColumn:r,side:s}}function Td(e){const t=e.dataset.lineType;if(t==="change-deletion")return"deletions";if(t==="change-addition"||t==="change-additions")return"additions";if(e.dataset.code!=null)return e.hasAttribute("data-deletions")?"deletions":"additions"}function Ad(e){const t=nn(e);if(t)return Kr(t)}function ft(e){let t=e.parentElement;for(;t;){const n=getComputedStyle(t);if(n.overflowY==="auto"||n.overflowY==="scroll")return t;t=t.parentElement}}function Hd(e,t){const n=()=>{},i=ft(e);if(!i)return n;const r=t.getBoundingClientRect().height;if(!r)return n;const o=i.scrollTop,s=e.getBoundingClientRect().top-i.getBoundingClientRect().top,l=t.style.minHeight;t.style.minHeight=`${Math.ceil(r)}px`;let a=!1;return()=>{if(a)return;a=!0;const h=i.scrollTop!==o;if(t.style.minHeight=l,h||i.scrollTop!==o)return;const c=e.getBoundingClientRect().top-i.getBoundingClientRect().top-s;c&&(i.scrollTop+=c)}}const Jt=new Set;let Pe,ae,Hi=!1;function Md(e){return e instanceof HTMLElement?e.closest("[data-prevent-autofocus]")||e.isContentEditable?!0:/^(INPUT|TEXTAREA|SELECT|BUTTON)$/.test(e.tagName):!1}function Mi(e){if(e instanceof Node)for(const t of Jt){const n=t.element();if(n&&n.isConnected&&n.contains(e))return t}}function Id(){Hi||typeof window>"u"||(Hi=!0,window.addEventListener("keydown",e=>{if(e.defaultPrevented||Md(e.target)||!(e.metaKey||e.ctrlKey))return;const n=e.key.toLowerCase();if(n==="g"){const o=ae;if(!o||!o.isOpen())return;e.preventDefault(),e.stopPropagation(),o.next(e.shiftKey?-1:1);return}if(n!=="f")return;const i=ae;if(i&&i.isOpen()){e.preventDefault(),e.stopPropagation(),i.open();return}const r=Mi(document.activeElement)??Mi(e.target)??Pe??Array.from(Jt)[0];r&&(e.preventDefault(),e.stopPropagation(),r.open())},{capture:!0}))}function je(){const e=globalThis.CSS?.highlights;e&&(e.delete("mux-find"),e.delete("mux-find-current"))}function Ii(){const e=globalThis;return typeof e.Highlight=="function"&&e.CSS?.highlights!=null}function Dd(e){let t,n,i=[],r="overlay",o=[];const[s,l]=zo({open:!1,query:"",index:0,count:0,pos:{top:8,right:8}}),a=()=>s.open,h=()=>s.query,d=()=>s.index,c=()=>s.count,u=()=>s.pos,p=()=>{for(const w of i)w.removeEventListener("scroll",C);i=[]},g=()=>{const w=e.overlay();w&&(n!==void 0&&(cancelAnimationFrame(n),n=void 0),w.innerHTML="")},S=()=>{if(r!=="overlay"){g();return}const w=e.wrapper(),R=e.overlay();if(!w||!R||(g(),o.length===0))return;const M=w.getBoundingClientRect(),D=d(),H=document.createDocumentFragment();for(let I=0;I<o.length;I++){const P=o[I],O=I===D;for(const _ of Array.from(P.getClientRects())){if(!_.width||!_.height)continue;const z=document.createElement("div");z.style.position="absolute",z.style.left=`${Math.round(_.left-M.left)}px`,z.style.top=`${Math.round(_.top-M.top)}px`,z.style.width=`${Math.round(_.width)}px`,z.style.height=`${Math.round(_.height)}px`,z.style.borderRadius="2px",z.style.backgroundColor=O?"var(--surface-warning-strong)":"var(--surface-warning-base)",z.style.opacity=O?"0.55":"0.35",O&&(z.style.boxShadow="inset 0 0 0 1px var(--border-warning-base)"),H.appendChild(z)}}R.appendChild(H)};function C(){r==="overlay"&&a()&&n===void 0&&(n=requestAnimationFrame(()=>{n=void 0,S()}))}const b=()=>{if(r!=="overlay")return;const w=e.getRoot(),R=w?Array.from(w.querySelectorAll("[data-code]")).filter(M=>M instanceof HTMLElement):[];if(!(R.length===i.length&&R.every((M,D)=>M===i[D]))){p(),i=R;for(const M of i)M.addEventListener("scroll",C,{passive:!0})}},f=()=>{je(),g(),p(),o=[],l("count",0),l("index",0)},m=()=>{if(typeof window>"u")return;const w=e.wrapper();if(!w)return;const R=ft(w)??w,M=R.getBoundingClientRect(),D=parseFloat(getComputedStyle(R).getPropertyValue("--session-title-height")),H=Number.isNaN(D)?0:D;l("pos",{top:Math.round(M.top)+H-4,right:Math.round(window.innerWidth-M.right)+8})},y=(w,R)=>{const M=R.toLowerCase(),D=[],H=Array.from(w.querySelectorAll("[data-content] [data-line], [data-column-content]")).filter(I=>I instanceof HTMLElement);for(const I of H){const P=I.textContent;if(!P)continue;const O=P.toLowerCase();let _=O.indexOf(M);if(_===-1)continue;const z=[],N=[],q=document.createTreeWalker(I,NodeFilter.SHOW_TEXT);let B=q.nextNode(),Z=0;for(;B;)B instanceof Text&&(Z+=B.data.length,z.push(B),N.push(Z)),B=q.nextNode();if(z.length===0)continue;const ne=j=>{let $=0,K=N.length-1;for(;$<K;){const ie=$+K>>1;N[ie]>=j?K=ie:$=ie+1}const Me=$===0?0:N[$-1];return{node:z[$],offset:j-Me}};for(;_!==-1;){const j=ne(_),$=ne(_+R.length),K=document.createRange();K.setStart(j.node,j.offset),K.setEnd($.node,$.offset),D.push(K),_=O.indexOf(M,_+R.length)}}return D},v=w=>{const R=w.startContainer;(R instanceof Element?R:R.parentElement)?.scrollIntoView({block:"center",inline:"center"})},k=(w,R)=>{const M=globalThis,D=M.CSS?.highlights,H=M.Highlight;if(!D||typeof H!="function")return!1;D.delete("mux-find"),D.delete("mux-find-current");const I=w[R];I&&D.set("mux-find-current",new H(I));const P=w.filter((O,_)=>_!==R);return P.length>0&&D.set("mux-find",new H(...P)),!0},x=w=>{if(!a())return;const R=h().trim();if(!R){f();return}const M=e.getRoot();if(!M)return;r=Ii()?"highlights":"overlay";const D=y(M,R),H=D.length,I=w?.reset?0:d(),P=H?Math.min(I,H-1):0;o=D,l("count",H),l("index",P);const O=D[P];if(r==="highlights"){g(),p(),k(D,P)||(r="overlay",je(),b(),C()),w?.scroll&&O&&v(O);return}je(),b(),w?.scroll&&O&&v(O),C()},T=()=>{l("open",!1),l("query",""),f(),ae===U&&(ae=void 0)},L=()=>{ae&&ae!==U&&ae.close(),ae=U,Pe=U,a()||l("open",!0),requestAnimationFrame(()=>{x({scroll:!0}),t?.focus(),t?.select()})},A=w=>{if(!a())return;const R=c();if(R<=0)return;const M=(d()+w+R)%R;l("index",M);const D=o[M];if(D){if(r==="highlights"){if(!k(o,M)){r="overlay",x({reset:!0,scroll:!0});return}v(D);return}je(),b(),v(D),C()}},U={element:e.wrapper,isOpen:()=>a(),next:A,open:L,close:T};return Oi(()=>{r=Ii()?"highlights":"overlay",Id(),Jt.add(U),Pe||(Pe=U),de(()=>{Jt.delete(U),ae===U&&(ae=void 0,je()),Pe===U&&(Pe=void 0)})}),Ee(()=>{if(!a())return;const w=()=>m();requestAnimationFrame(w),window.addEventListener("resize",w,{passive:!0});const R=e.wrapper();if(!R)return;const M=ft(R)??R,D=typeof ResizeObserver>"u"?void 0:new ResizeObserver(()=>w());D?.observe(M),de(()=>{window.removeEventListener("resize",w),D?.disconnect()})}),de(()=>{p(),g(),ae===U&&(ae=void 0,je())}),{open:a,query:h,count:c,index:d,pos:u,setInput:w=>{t=w},setQuery:w=>{l("query",w),l("index",0),x({reset:!0,scroll:!0})},focus:L,close:T,next:A,refresh:w=>x(w),onPointerDown:()=>{Pe=U,e.wrapper()?.focus({preventScroll:!0})},onFocus:()=>{Pe=U},onInputKeyDown:w=>{if(w.key==="Escape"){w.preventDefault(),T();return}w.key==="Enter"&&(w.preventDefault(),A(w.shiftKey?-1:1))}}}function _d(){return{token:0}}function at(e){e.observer?.disconnect(),e.observer=void 0}function eo(e){if(!e)return;const t=e.querySelector("diffs-container");if(t instanceof HTMLElement)return t}function Pd(e){return eo(e)?.shadowRoot??void 0}function _n(e){if(!e||typeof document>"u")return;const t=document.documentElement.dataset.colorScheme;if(t==="dark"||t==="light"){e.dataset.colorScheme=t;return}e.removeAttribute("data-color-scheme")}function Fd(e){if(typeof document>"u")return()=>{};if(_n(e()),typeof MutationObserver>"u")return()=>{};const t=document.documentElement,n=new MutationObserver(()=>_n(e()));return n.observe(t,{attributes:!0,attributeFilter:["data-color-scheme"]}),()=>n.disconnect()}function zd(e){at(e.state),e.state.token+=1;const t=e.state.token,n=Math.max(0,e.settleFrames??0),i=()=>{const s=l=>{if(t===e.state.token){if(l<=0){e.onReady();return}requestAnimationFrame(()=>s(l-1))}};requestAnimationFrame(()=>s(n))},r=s=>{if(e.isReady(s)){i();return}typeof MutationObserver>"u"||(at(e.state),e.state.observer=new MutationObserver(()=>{t===e.state.token&&e.isReady(s)&&(at(e.state),i())}),e.state.observer.observe(s,{childList:!0,subtree:!0}))},o=e.getRoot();if(!o){if(typeof MutationObserver>"u")return;e.state.observer=new MutationObserver(()=>{if(t!==e.state.token)return;const s=e.getRoot();s&&r(s)}),e.state.observer.observe(e.container,{childList:!0,subtree:!0});return}r(o)}function Od(e){return e.composedPath().some(t=>t instanceof HTMLElement&&t.isContentEditable)}function to(e){let t,n,i,r,o,s,l,a=!1,h=null,d=!1;const c=_d(),u=vd(),[p,g]=Pn(0),S=()=>Pd(n),C=()=>eo(n),b=Dd({wrapper:()=>t,overlay:()=>i,getRoot:S}),f=()=>{r===void 0&&(r=requestAnimationFrame(()=>{r=void 0;const L=d;e.updateSelection(L),d&&(d=!1,e.onLineSelectionEnd(h))}))},m=()=>{o===void 0&&(o=requestAnimationFrame(()=>{o=void 0;const L=e.buildDragSelection();L&&e.setSelectedLines(L)}))},y=()=>{s=void 0,l=void 0,a=!1,e.onDragReset()},v=L=>{if(!e.enableLineSelection()||L.button!==0)return;const A=e.lineFromMouseEvent(L);if(A.numberColumn){u.begin(!0,A.line);return}Od(L)||A.line!==void 0&&(u.begin(!1,A.line),s=A.line,l=A.line,a=!1,e.onDragStart(A))},k=L=>{if(!e.enableLineSelection())return;const A=e.lineFromMouseEvent(L);if(!u.track(L.buttons,A.line)&&s!==void 0){if((L.buttons&1)===0){y(),u.finish();return}A.line!==void 0&&(l=A.line,a=!0,e.onDragMove(A),m())}},x=()=>{if(e.enableLineSelection()&&u.finish()!=="numbers"&&s!==void 0){if(!a){d=!1;const L=e.buildClickSelection();L&&e.setSelectedLines(L),e.onLineSelectionEnd(h),y();return}d=!0,m(),f(),y()}},T=()=>{if(!e.enableLineSelection()||s===void 0)return;const L=window.getSelection();!L||L.isCollapsed||f()};return Oi(()=>{de(Fd(C))}),Ee(()=>{e.setSelectedLines(e.selectedLines()??null)}),Ee(()=>{e.enableLineSelection()&&(n.addEventListener("mousedown",v),n.addEventListener("mousemove",k),window.addEventListener("mouseup",x),document.addEventListener("selectionchange",T),de(()=>{n.removeEventListener("mousedown",v),n.removeEventListener("mousemove",k),window.removeEventListener("mouseup",x),document.removeEventListener("selectionchange",T)}))}),de(()=>{at(c),r!==void 0&&cancelAnimationFrame(r),o!==void 0&&cancelAnimationFrame(o),r=void 0,o=void 0,s=void 0,l=void 0,a=!1,u.reset(),h=null,d=!1}),{get wrapper(){return t},set wrapper(L){t=L},get container(){return n},set container(L){n=L},get overlay(){return i},set overlay(L){i=L},get dragStart(){return s},get dragEnd(){return l},get lastSelection(){return h},set lastSelection(L){h=L},ready:c,bridge:u,rendered:p,setRendered:g,getRoot:S,getHost:C,find:b,scheduleSelectionUpdate:f}}function no(e){Ee(()=>{const t=e.search();if(!t)return;const n={focus:()=>e.find.focus()};t.register(n),de(()=>t.register(null))})}function io(e){const t=n=>{if(!e.normalize)return n;const i=e.normalize(n);return i!==void 0?i:n};return{onLineSelected:n=>{const i=t(n);e.viewer.lastSelection=i,e.props.onLineSelected?.(i)},onLineSelectionEnd:n=>{const i=t(n);e.viewer.lastSelection=i,e.props.onLineSelectionEnd?.(i),e.viewer.bridge.consume(i)&&requestAnimationFrame(()=>e.props.onLineNumberSelectionEnd?.(i))}}}function ro(e){let t;Ee(()=>{const n=e.viewer.rendered(),i=e.annotations(),r=e.current();if(r){if(!Nd(t,n,i)){t={generation:n,annotations:i};return}t={generation:n,annotations:i},r.setLineAnnotations(i),r.rerender(),requestAnimationFrame(()=>e.viewer.find.refresh({reset:!0}))}})}function Nd(e,t,n){return!e||e.generation!==t?n.length>0:e.annotations===n?!1:e.annotations.length>0||n.length>0}function oo(e){zd({state:e.viewer.ready,container:e.viewer.container,getRoot:e.viewer.getRoot,isReady:e.isReady,settleFrames:e.settleFrames,onReady:e.onReady})}function so(e){at(e.viewer.ready),e.current?.cleanUp();const t=e.create();e.assign(t),e.viewer.container.innerHTML="",e.draw(t),_n(e.viewer.getHost()),e.viewer.setRendered(n=>n+1),e.onReady()}var Ud=He('<div class="fixed z-50 flex h-8 items-center gap-2 rounded-md border border-border-base bg-background-base px-3 shadow-md"><input class="w-40 bg-transparent outline-none text-14-regular text-text-strong placeholder:text-text-weak"><div class="shrink-0 text-12-regular text-text-weak tabular-nums text-right"style=width:10ch></div><div class="flex items-center"><button type=button class="size-6 grid place-items-center rounded text-text-weak hover:bg-surface-base-hover hover:text-text-strong disabled:opacity-40 disabled:pointer-events-none"></button><button type=button class="size-6 grid place-items-center rounded text-text-weak hover:bg-surface-base-hover hover:text-text-strong disabled:opacity-40 disabled:pointer-events-none"></button></div><button type=button class="size-6 grid place-items-center rounded text-text-weak hover:bg-surface-base-hover hover:text-text-strong">');function Vd(e){const t=$i();return W(lo,{get mount(){return Mo()},get children(){var n=Ud(),i=n.firstChild,r=i.nextSibling,o=r.nextSibling,s=o.firstChild,l=s.nextSibling,a=o.nextSibling;n.$$pointerdown=d=>d.stopPropagation(),X(n,W(vt,{name:"magnifying-glass",size:"small",class:"text-text-weak shrink-0"}),i),i.$$keydown=d=>e.onKeyDown(d),i.$$input=d=>e.onInput(d.currentTarget.value);var h=e.setInput;return typeof h=="function"?_t(h,i):e.setInput=i,X(r,(()=>{var d=_i(()=>!!e.count());return()=>d()?`${e.index()+1}/${e.count()}`:"0/0"})()),rt(s,"click",e.onPrev,!0),X(s,W(vt,{name:"chevron-down",size:"small",class:"rotate-180"})),rt(l,"click",e.onNext,!0),X(l,W(vt,{name:"chevron-down",size:"small"})),rt(a,"click",e.onClose,!0),X(a,W(vt,{name:"close-small",size:"small"})),Qe(d=>{var c=`${e.pos().top}px`,u=`${e.pos().right}px`,p=t.t("ui.fileSearch.placeholder"),g=e.count()===0,S=t.t("ui.fileSearch.previousMatch"),C=e.count()===0,b=t.t("ui.fileSearch.nextMatch"),f=t.t("ui.fileSearch.close");return c!==d.e&&Wn(n,"top",d.e=c),u!==d.t&&Wn(n,"right",d.t=u),p!==d.a&&le(i,"placeholder",d.a=p),g!==d.o&&(s.disabled=d.o=g),S!==d.i&&le(s,"aria-label",d.i=S),C!==d.n&&(l.disabled=d.n=C),b!==d.s&&le(l,"aria-label",d.s=b),f!==d.h&&le(a,"aria-label",d.h=f),d},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),Qe(()=>i.value=e.query()),n}})}Pi(["pointerdown","input","keydown","click"]);var Bd=He('<div class="absolute inset-0 z-20 cursor-progress"aria-hidden=true>'),$d=He('<div data-component=file class="relative outline-none"tabindex=0><div></div><div class="pointer-events-none absolute inset-0 z-0">');function ao(e){return(()=>{var t=$d(),n=t.firstChild,i=n.nextSibling;return rt(t,"focus",e.viewer.find.onFocus),rt(t,"pointerdown",e.viewer.find.onPointerDown,!0),_t(r=>e.viewer.wrapper=r,t),X(t,W(ot,{get when(){return e.busy},get children(){return Bd()}}),n),X(t,W(ot,{get when(){return e.viewer.find.open()},get children(){return W(Vd,{get pos(){return e.viewer.find.pos},get query(){return e.viewer.find.query},get count(){return e.viewer.find.count},get index(){return e.viewer.find.index},get setInput(){return e.viewer.find.setInput},get onInput(){return e.viewer.find.setQuery},get onKeyDown(){return e.viewer.find.onInputKeyDown},get onClose(){return e.viewer.find.close},onPrev:()=>e.viewer.find.next(-1),onNext:()=>e.viewer.find.next(1)})}}),n),_t(r=>e.viewer.container=r,n),_t(r=>e.viewer.overlay=r,i),Qe(r=>{var o=e.mode,s=pd,l={...e.classList||{},[e.class??""]:!!e.class},a=e.busy||void 0;return o!==r.e&&le(t,"data-mode",r.e=o),r.t=ho(t,s,r.t),r.a=co(t,l,r.a),a!==r.o&&le(t,"aria-busy",r.o=a),r},{e:void 0,t:void 0,a:void 0,o:void 0}),t})()}Pi(["pointerdown"]);function Wd(e,t){let n,i;const r=()=>{n?.cleanUp(),n=void 0,i=void 0};return{get:()=>{if(!t()){r();return}if(typeof document>"u")return;const o=e();if(!o)return;const s=ft(o)??document;return n&&i===s||(r(),n=new jr,i=s,n.setup(s,s instanceof Document?void 0:o)),n},cleanup:r}}function Gd(e){let t,n;const i=()=>{t?.release(),t=void 0,n=void 0};return{get:()=>{const r=e();if(!r){i();return}const o=ft(r)??document;if(t&&n===o)return t.virtualizer;i();const s=Ld(r);if(s)return n=o,t=s,s.virtualizer},cleanup:i}}const jd=5e5,qd={lineDiffType:"none",maxLineDiffLength:0,tokenizeMaxLineLength:1};function qe(e){return typeof e?.contents=="string"?e.contents:""}function Kd(e){const[t,n]=Pn(!0);Io(t);let i,r,o,s,l;const[a,h]=Ni(e,Ed),d=Wi("(width < 768px)"),c=(f,m)=>{const y=i;if(!y)return;const v=Ri(s.getRoot(),f);if(v===void 0){s.lastSelection=f;return}s.lastSelection=v,y.setSelectedLines(v),Yr(m?.root,m?.text)};s=to({enableLineSelection:()=>e.enableLineSelection===!0,selectedLines:()=>a.selectedLines,onLineSelectionEnd:f=>a.onLineSelectionEnd?.(f),...{lineFromMouseEvent:f=>Jr(f,Ti,Td),setSelectedLines:c,updateSelection:f=>{const m=s.getRoot();if(!m)return;const y=Qr({root:m,lineForNode:Ti,sideForNode:Ad,preserveTextSelection:f});if(y){if(y.text){c(y.range,{root:m,text:y.text});return}c(y.range)}},buildDragSelection:()=>{if(s.dragStart===void 0||s.dragEnd===void 0)return;const f={start:s.dragStart,end:s.dragEnd};return r&&(f.side=r),o&&r&&o!==r&&(f.endSide=o),f},buildClickSelection:()=>{if(s.dragStart===void 0)return;const f={start:s.dragStart,end:s.dragStart};return r&&(f.side=r),f},onDragStart:f=>{r=f.side,o=f.side},onDragMove:f=>{o=f.side},onDragReset:()=>{r=void 0,o=void 0}}});const p=Gd(()=>a.virtualize===!1?void 0:s.container),g=Y(()=>{const[f,m]=a.fileDiff?[a.fileDiff.deletionLines.join(""),a.fileDiff.additionLines.join("")]:[qe(a.before),qe(a.after)];return Math.max(f.length,m.length)>jd}),S=io({viewer:s,props:a,normalize:f=>Ri(s.getRoot(),f)}),C=Y(()=>{const f={...qr(e.diffStyle),...h,...S},m=g()?{...f,...qd}:f;return d()?{...m,disableLineNumbers:!0}:m}),b=f=>{oo({viewer:s,isReady:m=>m.querySelector("[data-line]")!=null||(a.fileDiff?a.fileDiff.hunks.length===0:qe(a.before)===qe(a.after)),settleFrames:1,onReady:()=>{n(!1),f?.(),c(s.lastSelection),s.find.refresh({reset:!0}),a.onRendered?.()}})};return no({search:()=>a.search,find:s.find}),Ee(()=>{const f=C();n(!0);const m=Xr(g()?"unified":e.diffStyle),y=p.get(),v=qe(a.before),k=qe(a.after),x=Hd(s.wrapper,s.container);de(x),l||(l=document.createElement("diffs-container"),s.container.appendChild(l));const T=L=>g()?Gn(L):Gn(L,L.length);so({viewer:s,current:i,create:()=>y?new jl(f,y,yd,m):new Wr(f,m),assign:L=>{i=L},draw:L=>{if(a.fileDiff){L.render({fileContainer:l,fileDiff:a.fileDiff,lineAnnotations:[],containerWrapper:s.container});return}!a.before||!a.after||L.render({fileContainer:l,oldFile:{...a.before,contents:v,cacheKey:T(v)},newFile:{...a.after,contents:k,cacheKey:T(k)},lineAnnotations:[],containerWrapper:s.container})},onReady:()=>b(x)})}),ro({viewer:s,current:()=>i,annotations:()=>a.annotations??[]}),de(()=>{i?.cleanUp(),i=void 0,l=void 0,p.cleanup(),r=void 0,o=void 0}),W(ao,{mode:"diff",viewer:s,get class(){return a.class},get classList(){return a.classList}})}const Yd=5e5,Qd={...Un,lineHeight:24,spacing:0,paddingTop:0,paddingBottom:0};function Xd(e){const t=e;return typeof t=="string"?t:Array.isArray(t)?t.join(`
1522
+ `):t==null?"":String(t)}function Zd(e){const t=e;return typeof t=="string"?t.length:Array.isArray(t)?t.reduce((n,i)=>n+(typeof i=="string"?i.length+1:String(i).length+1),0):t==null?0:String(t).length}function Jd(e){if(e==="")return 0;const t=e.split(`
1523
+ `).length-(e.endsWith(`
1524
+ `)?1:0);return Math.max(1,t)}function eh(e){let t,n;const[i,r]=Ni(e,wd),o=()=>Xd(i.file.contents),s=()=>Jd(o()),l=Y(()=>Zd(i.file.contents)),a=Y(()=>l()>Yd),h=Wd(()=>n.wrapper,a),d=f=>{const m=t;if(!m)return!1;if(a())return m.setSelectedLines(f),!0;const y=n.getRoot();if(!y)return!1;const v=s();if(y.querySelectorAll("[data-line]").length<v)return!1;if(!f)return m.setSelectedLines(null),!0;const k=Math.min(f.start,f.end),x=Math.max(f.start,f.end);if(k<1||x>v||!y.querySelector(`[data-line="${k}"]`)||!y.querySelector(`[data-line="${x}"]`))return m.setSelectedLines(null),!0;const T=f.endSide!=null?{start:f.start,end:f.end}:f.side!=="deletions"||y.querySelector("[data-deletions]")!=null?f:{start:f.start,end:f.end};return m.setSelectedLines(T),!0},c=f=>{n.lastSelection=f,d(f)};n=to({enableLineSelection:()=>e.enableLineSelection===!0,selectedLines:()=>i.selectedLines,onLineSelectionEnd:f=>i.onLineSelectionEnd?.(f),...{lineFromMouseEvent:f=>Jr(f,Rd),setSelectedLines:c,updateSelection:f=>{const m=n.getRoot();if(!m)return;const y=Qr({root:m,lineForNode:bd,sideForNode:Sd,preserveTextSelection:f});y&&(c(y.range),!(!f||!y.text)&&Yr(m,y.text))},buildDragSelection:()=>{if(!(n.dragStart===void 0||n.dragEnd===void 0))return{start:Math.min(n.dragStart,n.dragEnd),end:Math.max(n.dragStart,n.dragEnd)}},buildClickSelection:()=>{if(n.dragStart!==void 0)return{start:n.dragStart,end:n.dragStart}},onDragStart:()=>{},onDragMove:()=>{},onDragReset:()=>{}}});const p=io({viewer:n,props:i}),g=Y(()=>({...qr("unified"),...r,...p})),S=()=>{oo({viewer:n,isReady:f=>a()?f.querySelector("[data-line]")!=null:f.querySelectorAll("[data-line]").length>=s(),onReady:()=>{d(n.lastSelection),n.find.refresh({reset:!0}),i.onRendered?.()}})};no({search:()=>i.search,find:n.find}),Ee(()=>{const f=g(),m=Xr("unified"),y=a(),v=h.get();so({viewer:n,current:t,create:()=>y&&v?new Ea(f,v,Qd,m):new Dr(f,m),assign:k=>{t=k},draw:k=>{const x=o();k.render({file:typeof i.file.contents=="string"?i.file:{...i.file,contents:x},lineAnnotations:[],containerWrapper:n.container})},onReady:S})}),ro({viewer:n,current:()=>t,annotations:()=>i.annotations??[]});const[C,b]=Pn(!1);return Ee(()=>{const f=i.edit,m=n.rendered();if(!f?.enabled){b(!1);return}const y=t;if(!y||m===0)return;b(!1);let v,k=!1;E(async()=>{const{Editor:x}=await import("./index-D-Q6ihx1.js");return{Editor:x}},[],import.meta.url).then(({Editor:x})=>{if(k)return;v=new x({roundedSelection:!1,onChange:L=>{const A=L.contents;typeof A=="string"&&f.onChange(A)},onBlur:()=>f.onBlur?.(),onAttach:L=>{if(k)return;const A=f.focusOnAttach;A&&L.focus(A.lineNumber===void 0?{preventScroll:!0}:{preventScroll:!0,lineNumber:A.lineNumber}),f.onAttached?.()}}).edit(y),b(!0)}).catch(x=>{const T=x instanceof Error?x.message:String(x);f.onError?.(T)}),de(()=>{k=!0,v?.()})}),de(()=>{t?.cleanUp(),t=void 0,h.cleanup()}),W(ao,{mode:"text",viewer:n,get class(){return i.class},get classList(){return i.classList},get busy(){return _i(()=>i.edit?.enabled===!0)()&&!C()}})}function th(e){return e.mode==="text"?W(ki,{get media(){return e.media},fallback:()=>eh(e)}):W(ki,{get media(){return e.media},fallback:()=>Kd(e)})}const gh=Object.freeze(Object.defineProperty({__proto__:null,File:th},Symbol.toStringTag,{value:"Module"}));export{lh as a,ah as b,fr as c,ch as d,na as e,uh as f,fh as g,Zs as h,oi as i,Re as j,Bt as k,he as l,Ir as m,bt as n,gh as o,hh as p,Q as q,ge as r,dh as s};