@bud.sh/app 0.1.0 → 0.2.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 (348) hide show
  1. package/dist/hosted/hosted.js +121 -35
  2. package/dist/node-host/assets/abap-LtYK6g-v.js +3 -0
  3. package/dist/node-host/assets/actionscript-3-CfsDl31I.js +3 -0
  4. package/dist/node-host/assets/ada-CvTdxb4T.js +3 -0
  5. package/dist/node-host/assets/ahk-HN_I_y_3.js +3 -0
  6. package/dist/node-host/assets/ahk2-bJ5Wm9-K.js +3 -0
  7. package/dist/node-host/assets/andromeeda-BASpqCeJ.js +4 -0
  8. package/dist/node-host/assets/angular-html-C4SmZqv0.js +33 -0
  9. package/dist/node-host/assets/angular-ts-X1i_WOxI.js +27 -0
  10. package/dist/node-host/assets/apache-BIl2qPOf.js +3 -0
  11. package/dist/node-host/assets/apex-CybrBQ0z.js +3 -0
  12. package/dist/node-host/assets/api_vite-DSBC5Nzy.js +5 -0
  13. package/dist/node-host/assets/apl-CDTyNgE2.js +17 -0
  14. package/dist/node-host/assets/applescript-CJ80B5XJ.js +3 -0
  15. package/dist/node-host/assets/ara-IxnQjO6j.js +3 -0
  16. package/dist/node-host/assets/asciidoc-xKuVlNk6.js +3 -0
  17. package/dist/node-host/assets/asm-wBDSgBbA.js +3 -0
  18. package/dist/node-host/assets/astro-BiZFCPSt.js +19 -0
  19. package/dist/node-host/assets/aurora-x-DugsLcii.js +4 -0
  20. package/dist/node-host/assets/awk-D6dA05Ye.js +3 -0
  21. package/dist/node-host/assets/ayu-dark-BT3qdi3o.js +4 -0
  22. package/dist/node-host/assets/ayu-light-BVZyHoh9.js +4 -0
  23. package/dist/node-host/assets/ayu-mirage-XFwUVZQZ.js +4 -0
  24. package/dist/node-host/assets/ballerina-DIdXD2KH.js +3 -0
  25. package/dist/node-host/assets/bat-Dx8nnxXE.js +3 -0
  26. package/dist/node-host/assets/beancount-BG2UQN2D.js +3 -0
  27. package/dist/node-host/assets/berry-CgA2ea0_.js +3 -0
  28. package/dist/node-host/assets/bibtex-BzgdqG3s.js +3 -0
  29. package/dist/node-host/assets/bicep-CZ338dSk.js +3 -0
  30. package/dist/node-host/assets/bird2-BMprQDNV.js +3 -0
  31. package/dist/node-host/assets/blade-cZjv4Qad.js +21 -0
  32. package/dist/node-host/assets/bsl-Bh8bzcoy.js +6 -0
  33. package/dist/node-host/assets/build-Dn-L17Oj.js +5372 -0
  34. package/dist/node-host/assets/c-BXsbGxlp.js +6 -0
  35. package/dist/node-host/assets/c3-u0qNrniV.js +3 -0
  36. package/dist/node-host/assets/cadence-B1ELWULD.js +3 -0
  37. package/dist/node-host/assets/cairo-BsQhEq3R.js +6 -0
  38. package/dist/node-host/assets/canvas-BZhzizzt.js +1066 -0
  39. package/dist/node-host/assets/catppuccin-frappe-D20KODDN.js +4 -0
  40. package/dist/node-host/assets/catppuccin-latte-eGLVHIUJ.js +4 -0
  41. package/dist/node-host/assets/catppuccin-macchiato-bQGch4PY.js +4 -0
  42. package/dist/node-host/assets/catppuccin-mocha-Bes8-0Mr.js +4 -0
  43. package/dist/node-host/assets/chapel-cEZNBFmv.js +6 -0
  44. package/dist/node-host/assets/clarity-BkOxTQMf.js +3 -0
  45. package/dist/node-host/assets/clojure-DDsQ0FaV.js +3 -0
  46. package/dist/node-host/assets/cloneFileDiffMetadata-C1BcNpxN.js +3075 -0
  47. package/dist/node-host/assets/cmake-DPsCB_V6.js +3 -0
  48. package/dist/node-host/assets/cobol-BpMD18Rr.js +11 -0
  49. package/dist/node-host/assets/codeowners-CxEKPWu0.js +3 -0
  50. package/dist/node-host/assets/codeql-BwdvwJnv.js +3 -0
  51. package/dist/node-host/assets/coffee-BX_u-2R1.js +6 -0
  52. package/dist/node-host/assets/comment-data-nUlI0szN.js +92501 -0
  53. package/dist/node-host/assets/common-lisp-DJtwvW4V.js +3 -0
  54. package/dist/node-host/assets/coq-Byd42hNw.js +3 -0
  55. package/dist/node-host/assets/cpp-DjJRL98I.js +22 -0
  56. package/dist/node-host/assets/crystal-Cz-dKioR.js +19 -0
  57. package/dist/node-host/assets/csharp-Cx443ZdC.js +3 -0
  58. package/dist/node-host/assets/css-CWNyyZRg.js +6 -0
  59. package/dist/node-host/assets/csv-DqIVFkK7.js +3 -0
  60. package/dist/node-host/assets/cue-B5KneM5p.js +3 -0
  61. package/dist/node-host/assets/cypher-D8Bb8Cq2.js +3 -0
  62. package/dist/node-host/assets/d-BQY8TDgQ.js +3 -0
  63. package/dist/node-host/assets/dark-plus-BGuiqa1B.js +4 -0
  64. package/dist/node-host/assets/dart-BZ3YsgDB.js +3 -0
  65. package/dist/node-host/assets/dax-S-Noo-ku.js +3 -0
  66. package/dist/node-host/assets/desktop-BgOb7Aj4.js +3 -0
  67. package/dist/node-host/assets/diff-Blb4MjsC.js +3 -0
  68. package/dist/node-host/assets/dist-CVXhIZqO.js +6659 -0
  69. package/dist/node-host/assets/docker-PC1tuYpa.js +3 -0
  70. package/dist/node-host/assets/dotenv-BNWDqzYB.js +3 -0
  71. package/dist/node-host/assets/dracula-0CVA2XY5.js +4 -0
  72. package/dist/node-host/assets/dracula-soft-Dk9bpbVU.js +4 -0
  73. package/dist/node-host/assets/dream-maker-CngiPd8U.js +3 -0
  74. package/dist/node-host/assets/edge-D1_nghia.js +13 -0
  75. package/dist/node-host/assets/edit-DjpTbnEc.js +9788 -0
  76. package/dist/node-host/assets/elixir-x6BMZ6zW.js +6 -0
  77. package/dist/node-host/assets/elm-CiAjb3qf.js +6 -0
  78. package/dist/node-host/assets/emacs-lisp-DPCJASlD.js +3 -0
  79. package/dist/node-host/assets/erb-DzXTnEFa.js +11 -0
  80. package/dist/node-host/assets/erlang-DALBVNgL.js +6 -0
  81. package/dist/node-host/assets/everforest-dark-CRjTbhh5.js +4 -0
  82. package/dist/node-host/assets/everforest-light-CEeYFLn8.js +4 -0
  83. package/dist/node-host/assets/fennel-B3wtZRne.js +3 -0
  84. package/dist/node-host/assets/files-CTzcWGjb.js +3771 -0
  85. package/dist/node-host/assets/fish-D7qAeWQz.js +3 -0
  86. package/dist/node-host/assets/fluent-BjfpB34g.js +3 -0
  87. package/dist/node-host/assets/fortran-fixed-form-BbzsUHx4.js +6 -0
  88. package/dist/node-host/assets/fortran-free-form-yxJ7igsv.js +3 -0
  89. package/dist/node-host/assets/fsharp-D2o1Vyx0.js +6 -0
  90. package/dist/node-host/assets/gdresource-aTcOcjSd.js +11 -0
  91. package/dist/node-host/assets/gdscript-CSSSWtkL.js +3 -0
  92. package/dist/node-host/assets/gdshader-D7JfdFV3.js +3 -0
  93. package/dist/node-host/assets/genie-DnK2KWIP.js +3 -0
  94. package/dist/node-host/assets/gherkin-D6Lr12YQ.js +3 -0
  95. package/dist/node-host/assets/git-commit-BU1ZeqU-.js +6 -0
  96. package/dist/node-host/assets/git-rebase-BBwLmuqc.js +6 -0
  97. package/dist/node-host/assets/github-dark-BXgKmOw_.js +4 -0
  98. package/dist/node-host/assets/github-dark-default-DzJQXksd.js +4 -0
  99. package/dist/node-host/assets/github-dark-dimmed-B1pEmGtS.js +4 -0
  100. package/dist/node-host/assets/github-dark-high-contrast-BkHIa6jc.js +4 -0
  101. package/dist/node-host/assets/github-light-BKRlUbaB.js +4 -0
  102. package/dist/node-host/assets/github-light-default-BU3eYkzs.js +4 -0
  103. package/dist/node-host/assets/github-light-high-contrast-B3MumDcI.js +4 -0
  104. package/dist/node-host/assets/gleam-CTllUdfC.js +3 -0
  105. package/dist/node-host/assets/glimmer-js-Cr4KUylv.js +15 -0
  106. package/dist/node-host/assets/glimmer-ts-W_3bhuUU.js +15 -0
  107. package/dist/node-host/assets/glsl-CV8OarLe.js +8 -0
  108. package/dist/node-host/assets/gn-CpIn4Dcw.js +3 -0
  109. package/dist/node-host/assets/gnuplot-DgWvVXI8.js +3 -0
  110. package/dist/node-host/assets/go-aXtTCanQ.js +3 -0
  111. package/dist/node-host/assets/graphql-BzQEBhBd.js +17 -0
  112. package/dist/node-host/assets/groovy-Bw2Ku4bU.js +3 -0
  113. package/dist/node-host/assets/gruvbox-dark-hard-B0ecF443.js +4 -0
  114. package/dist/node-host/assets/gruvbox-dark-medium-BQnpC39k.js +4 -0
  115. package/dist/node-host/assets/gruvbox-dark-soft-DFZUgESr.js +4 -0
  116. package/dist/node-host/assets/gruvbox-light-hard-CuB_LOJr.js +4 -0
  117. package/dist/node-host/assets/gruvbox-light-medium-idDHgxjs.js +4 -0
  118. package/dist/node-host/assets/gruvbox-light-soft-CfWH49MY.js +4 -0
  119. package/dist/node-host/assets/hack-DhYZEMlu.js +11 -0
  120. package/dist/node-host/assets/haml-CRid5kR3.js +13 -0
  121. package/dist/node-host/assets/handlebars-Sm6kCGmL.js +15 -0
  122. package/dist/node-host/assets/haskell-CfGsE1Cf.js +3 -0
  123. package/dist/node-host/assets/haxe-QaqXWmIB.js +3 -0
  124. package/dist/node-host/assets/hcl-DHg_Osgo.js +3 -0
  125. package/dist/node-host/assets/hjson-Cuaphql8.js +3 -0
  126. package/dist/node-host/assets/hlsl-BJLUNfne.js +3 -0
  127. package/dist/node-host/assets/horizon-bright-Ba6M8QSV.js +4 -0
  128. package/dist/node-host/assets/horizon-h92C5OlZ.js +4 -0
  129. package/dist/node-host/assets/houston-EQnPegWq.js +4 -0
  130. package/dist/node-host/assets/html-derivative-Cm8plTfc.js +6 -0
  131. package/dist/node-host/assets/html-j1vihRKA.js +13 -0
  132. package/dist/node-host/assets/http-BZNc4yhO.js +15 -0
  133. package/dist/node-host/assets/hurl-O8ckTHPH.js +13 -0
  134. package/dist/node-host/assets/hxml-9hvSHCPQ.js +6 -0
  135. package/dist/node-host/assets/hy-CJKxDzbh.js +3 -0
  136. package/dist/node-host/assets/imba-96qKoJCa.js +3 -0
  137. package/dist/node-host/assets/ini-C24lZfdM.js +3 -0
  138. package/dist/node-host/assets/java-CFxSaKyu.js +6 -0
  139. package/dist/node-host/assets/javascript-D44WgUBn.js +6 -0
  140. package/dist/node-host/assets/jinja-BkVH86If.js +10 -0
  141. package/dist/node-host/assets/jison-DOInKsmT.js +6 -0
  142. package/dist/node-host/assets/jiti-CjBwKumX.js +5461 -0
  143. package/dist/node-host/assets/json-CnGl9idC.js +6 -0
  144. package/dist/node-host/assets/json5-xULSgPQI.js +3 -0
  145. package/dist/node-host/assets/jsonc-Cu6rqcrJ.js +3 -0
  146. package/dist/node-host/assets/jsonl-Bp0qqr10.js +3 -0
  147. package/dist/node-host/assets/jsonnet-BafgE6cE.js +3 -0
  148. package/dist/node-host/assets/jssm-Dx5A5sBR.js +3 -0
  149. package/dist/node-host/assets/jsx-Dv6553c2.js +6 -0
  150. package/dist/node-host/assets/julia-CnoY-eZu.js +17 -0
  151. package/dist/node-host/assets/just-rCgUmVkD.js +19 -0
  152. package/dist/node-host/assets/kanagawa-dragon-DgDvwi3B.js +4 -0
  153. package/dist/node-host/assets/kanagawa-lotus-BgoQro20.js +4 -0
  154. package/dist/node-host/assets/kanagawa-wave-DgXEowHs.js +4 -0
  155. package/dist/node-host/assets/kdl-DkTyxPcj.js +3 -0
  156. package/dist/node-host/assets/kotlin-BHE8CoV9.js +3 -0
  157. package/dist/node-host/assets/kusto-6FdaWTzR.js +3 -0
  158. package/dist/node-host/assets/laserwave-IxBH_3yW.js +4 -0
  159. package/dist/node-host/assets/latex-DTvJHHg_.js +6 -0
  160. package/dist/node-host/assets/lean-BwOKScIt.js +3 -0
  161. package/dist/node-host/assets/less-BzbdhFUi.js +3 -0
  162. package/dist/node-host/assets/lib-BzDu3tbz.js +17484 -0
  163. package/dist/node-host/assets/light-plus-S8JBx6is.js +4 -0
  164. package/dist/node-host/assets/liquid-praBF2DO.js +15 -0
  165. package/dist/node-host/assets/llvm-ZNG_yAr9.js +3 -0
  166. package/dist/node-host/assets/log-Dad54gsi.js +3 -0
  167. package/dist/node-host/assets/logo-DTXV8SKw.js +3 -0
  168. package/dist/node-host/assets/lru-C0_oUet4.js +134 -0
  169. package/dist/node-host/assets/lua-CiYoSQn2.js +8 -0
  170. package/dist/node-host/assets/luau-DlImmvOM.js +3 -0
  171. package/dist/node-host/assets/main-D0ab5M4V.js +2353 -0
  172. package/dist/node-host/assets/make-B2ukzWs3.js +3 -0
  173. package/dist/node-host/assets/markdown-CkmxmzqY.js +3 -0
  174. package/dist/node-host/assets/marko-Din1W3ot.js +15 -0
  175. package/dist/node-host/assets/material-theme-D1f3HBq-.js +4 -0
  176. package/dist/node-host/assets/material-theme-darker-ExzYhT0j.js +4 -0
  177. package/dist/node-host/assets/material-theme-lighter-D6gH9nnA.js +4 -0
  178. package/dist/node-host/assets/material-theme-ocean-D1w5BPAa.js +4 -0
  179. package/dist/node-host/assets/material-theme-palenight-CkqWmVpF.js +4 -0
  180. package/dist/node-host/assets/matlab-CfRK6IMC.js +3 -0
  181. package/dist/node-host/assets/mdc-DrUS0kOP.js +13 -0
  182. package/dist/node-host/assets/mdx-BK9ZufRc.js +3 -0
  183. package/dist/node-host/assets/mermaid-ItFqCK9s.js +3 -0
  184. package/dist/node-host/assets/min-dark-npsJH98j.js +4 -0
  185. package/dist/node-host/assets/min-light-DUk1XsVt.js +4 -0
  186. package/dist/node-host/assets/mipsasm-EL46Y4Xg.js +3 -0
  187. package/dist/node-host/assets/mojo-CsUSYzsu.js +3 -0
  188. package/dist/node-host/assets/monokai-CfFRWUNl.js +4 -0
  189. package/dist/node-host/assets/moonbit-BuY4M1CG.js +3 -0
  190. package/dist/node-host/assets/move-B-o8dn0N.js +3 -0
  191. package/dist/node-host/assets/narrat-D9rrR0H5.js +3 -0
  192. package/dist/node-host/assets/nextflow-ByPelpfh.js +6 -0
  193. package/dist/node-host/assets/nextflow-groovy-kiH-pxwE.js +3 -0
  194. package/dist/node-host/assets/nginx-CqxQjy7t.js +6 -0
  195. package/dist/node-host/assets/night-owl-BS7V-av_.js +4 -0
  196. package/dist/node-host/assets/night-owl-light-CZtRawYE.js +4 -0
  197. package/dist/node-host/assets/nim-BJfyW_Eo.js +21 -0
  198. package/dist/node-host/assets/nix-NHxlegoK.js +7 -0
  199. package/dist/node-host/assets/node-CaLaDAar.js +783 -0
  200. package/dist/node-host/assets/nord-BFh54Nqz.js +4 -0
  201. package/dist/node-host/assets/nsis-C3tUpeAt.js +3 -0
  202. package/dist/node-host/assets/nushell-Dx3871HW.js +3 -0
  203. package/dist/node-host/assets/objective-c-6dJF64Dt.js +3 -0
  204. package/dist/node-host/assets/objective-cpp-_ooRQ-PY.js +3 -0
  205. package/dist/node-host/assets/ocaml-vm1Y8An6.js +3 -0
  206. package/dist/node-host/assets/odin-vjOJSyfV.js +3 -0
  207. package/dist/node-host/assets/one-dark-pro-zDovGosB.js +4 -0
  208. package/dist/node-host/assets/one-light-gmHK3iK6.js +4 -0
  209. package/dist/node-host/assets/openscad-jn-f1Ocl.js +3 -0
  210. package/dist/node-host/assets/org-kbyZnkNe.js +101 -0
  211. package/dist/node-host/assets/pages-0aWH7z1j.js +578 -0
  212. package/dist/node-host/assets/pascal-D8-gNZ2I.js +3 -0
  213. package/dist/node-host/assets/perl-Ck21ZEIA.js +17 -0
  214. package/dist/node-host/assets/php-BI2xxNig.js +19 -0
  215. package/dist/node-host/assets/pierre-dark-DDWDl8g6.js +4 -0
  216. package/dist/node-host/assets/pierre-dark-protanopia-deuteranopia-C35UMuvO.js +4 -0
  217. package/dist/node-host/assets/pierre-dark-soft-Bb-4-biO.js +4 -0
  218. package/dist/node-host/assets/pierre-dark-tritanopia-CIJISGWF.js +4 -0
  219. package/dist/node-host/assets/pierre-dark-vibrant-8oZzB3gw.js +4 -0
  220. package/dist/node-host/assets/pierre-light-CWhW4NrH.js +4 -0
  221. package/dist/node-host/assets/pierre-light-protanopia-deuteranopia-u0U7N4Hn.js +4 -0
  222. package/dist/node-host/assets/pierre-light-soft-BCU6fuhO.js +4 -0
  223. package/dist/node-host/assets/pierre-light-tritanopia-3c8Yx3co.js +4 -0
  224. package/dist/node-host/assets/pierre-light-vibrant-Cwh332o_.js +4 -0
  225. package/dist/node-host/assets/pkl-C7lWzykI.js +3 -0
  226. package/dist/node-host/assets/plastic-DtdaCjub.js +4 -0
  227. package/dist/node-host/assets/plsql-DCNXypXO.js +3 -0
  228. package/dist/node-host/assets/po-IjpR1yHO.js +3 -0
  229. package/dist/node-host/assets/poimandres-Hdda6aHK.js +4 -0
  230. package/dist/node-host/assets/polar-4pN1JrJ8.js +3 -0
  231. package/dist/node-host/assets/postcss-0FnF2XR3.js +5833 -0
  232. package/dist/node-host/assets/postcss-D1gKt4z_.js +3 -0
  233. package/dist/node-host/assets/postcss-import-D5DErX4i.js +445 -0
  234. package/dist/node-host/assets/powerquery-SrvS_NBM.js +3 -0
  235. package/dist/node-host/assets/powershell-DvPkO2jl.js +3 -0
  236. package/dist/node-host/assets/prisma-4G_BaF_i.js +3 -0
  237. package/dist/node-host/assets/project-branches-1zs_0J_y.js +600 -0
  238. package/dist/node-host/assets/project-thread-links-LpUAGcDr.js +241 -0
  239. package/dist/node-host/assets/prolog-Bacii3Ue.js +3 -0
  240. package/dist/node-host/assets/prompt-CH6TK0bC-ZEO69UbU.js +885 -0
  241. package/dist/node-host/assets/proto-ClkOcAW0.js +3 -0
  242. package/dist/node-host/assets/pug-Du-dOfS3.js +13 -0
  243. package/dist/node-host/assets/puppet-CQlPp728.js +3 -0
  244. package/dist/node-host/assets/purescript-CLpaGMbw.js +3 -0
  245. package/dist/node-host/assets/python-BjnOIxPe.js +3 -0
  246. package/dist/node-host/assets/qml-BcFatdsQ.js +6 -0
  247. package/dist/node-host/assets/qmldir-Dz8ttxjf.js +3 -0
  248. package/dist/node-host/assets/qss-Iltvkn1C.js +3 -0
  249. package/dist/node-host/assets/r-DvDYa_8Q.js +6 -0
  250. package/dist/node-host/assets/racket-DRv7j6nv.js +3 -0
  251. package/dist/node-host/assets/raku-DI9yGpeW.js +3 -0
  252. package/dist/node-host/assets/razor-vGjCiVYw.js +11 -0
  253. package/dist/node-host/assets/rbs-D_4FkXDS.js +3 -0
  254. package/dist/node-host/assets/red-VqZFRByZ.js +4 -0
  255. package/dist/node-host/assets/reg-DpJf71oO.js +3 -0
  256. package/dist/node-host/assets/regexp-CE_3vZDh.js +6 -0
  257. package/dist/node-host/assets/rel-BT0iIKKw.js +3 -0
  258. package/dist/node-host/assets/riscv-CvzikGLb.js +3 -0
  259. package/dist/node-host/assets/rolldown-runtime-DktXgydw.js +35 -0
  260. package/dist/node-host/assets/ron-DzAo6FTJ.js +3 -0
  261. package/dist/node-host/assets/rose-pine-DiTkEueR.js +4 -0
  262. package/dist/node-host/assets/rose-pine-dawn-tfo5y2X0.js +4 -0
  263. package/dist/node-host/assets/rose-pine-moon-C0gON9XN.js +4 -0
  264. package/dist/node-host/assets/rosmsg-CyYq6XdT.js +3 -0
  265. package/dist/node-host/assets/rst-BqrTc4by.js +23 -0
  266. package/dist/node-host/assets/ruby-DLXfYriJ.js +31 -0
  267. package/dist/node-host/assets/rust-CaJo2YYS.js +3 -0
  268. package/dist/node-host/assets/sas-DJAJgMrq.js +6 -0
  269. package/dist/node-host/assets/sass-DI2zJwx7.js +3 -0
  270. package/dist/node-host/assets/scala-pMGZAs9j.js +3 -0
  271. package/dist/node-host/assets/scheme-D3A2QBtM.js +3 -0
  272. package/dist/node-host/assets/screen-DQoTOWYR.js +494 -0
  273. package/dist/node-host/assets/scss-n4nz8dJI.js +8 -0
  274. package/dist/node-host/assets/sdbl-CdQg5gu1.js +3 -0
  275. package/dist/node-host/assets/shaderlab-5KHT7nQ3.js +6 -0
  276. package/dist/node-host/assets/shellscript-BfuVOb-a.js +6 -0
  277. package/dist/node-host/assets/shellsession-hT9eQUDu.js +6 -0
  278. package/dist/node-host/assets/slack-dark-v8P_eXr6.js +4 -0
  279. package/dist/node-host/assets/slack-ochin-D8SyEdKz.js +4 -0
  280. package/dist/node-host/assets/smalltalk-D4IpSogw.js +3 -0
  281. package/dist/node-host/assets/smithy-BRyN83Yn.js +3 -0
  282. package/dist/node-host/assets/snazzy-light-BtkQkvXb.js +4 -0
  283. package/dist/node-host/assets/solarized-dark-B8nAdMfM.js +4 -0
  284. package/dist/node-host/assets/solarized-light-B-3F1INj.js +4 -0
  285. package/dist/node-host/assets/solidity-DPVu0wkJ.js +3 -0
  286. package/dist/node-host/assets/soy-Cbnz3v4z.js +6 -0
  287. package/dist/node-host/assets/sparql-cTZV4yOr.js +6 -0
  288. package/dist/node-host/assets/splunk-xP_ZjUH2.js +3 -0
  289. package/dist/node-host/assets/sql-DEvbt_rU.js +6 -0
  290. package/dist/node-host/assets/ssh-config-DXFPABYp.js +3 -0
  291. package/dist/node-host/assets/stata-0wnAnxv2.js +6 -0
  292. package/dist/node-host/assets/stylus-ZZDn1yUO.js +3 -0
  293. package/dist/node-host/assets/surrealql-70--UPGf.js +6 -0
  294. package/dist/node-host/assets/svelte-COI8WXVC.js +15 -0
  295. package/dist/node-host/assets/swift-DWmMn3lF.js +3 -0
  296. package/dist/node-host/assets/synthwave-84-DcsXCF_c.js +4 -0
  297. package/dist/node-host/assets/system-verilog-DW0KSMVO.js +3 -0
  298. package/dist/node-host/assets/systemd-DFbUltlW.js +3 -0
  299. package/dist/node-host/assets/talonscript-CLxaFu-b.js +3 -0
  300. package/dist/node-host/assets/tasks-C0WqnM7Q.js +644 -0
  301. package/dist/node-host/assets/tasks-request-Bwky5ORf.js +114 -0
  302. package/dist/node-host/assets/tasl-_AAbKiWM.js +3 -0
  303. package/dist/node-host/assets/tcl-DLe0Tsfm.js +3 -0
  304. package/dist/node-host/assets/templ-Bd0jzThC.js +13 -0
  305. package/dist/node-host/assets/terraform-v0KN9QQh.js +3 -0
  306. package/dist/node-host/assets/tex-C1Wtngrr.js +8 -0
  307. package/dist/node-host/assets/tokyo-night-Bvpqduda.js +4 -0
  308. package/dist/node-host/assets/toml-B7BHZIqX.js +3 -0
  309. package/dist/node-host/assets/ts-tags-BSGaPI18.js +59 -0
  310. package/dist/node-host/assets/tsv-BorGVq2Z.js +3 -0
  311. package/dist/node-host/assets/tsx-BxnCmyTp.js +6 -0
  312. package/dist/node-host/assets/turtle-BEG5g_eT.js +3 -0
  313. package/dist/node-host/assets/twig-BJG2k0MA.js +19 -0
  314. package/dist/node-host/assets/typescript-Cr5OHcug.js +6 -0
  315. package/dist/node-host/assets/typespec--jp0a8Qj.js +3 -0
  316. package/dist/node-host/assets/typst-BAvHLpwp.js +121 -0
  317. package/dist/node-host/assets/v-DBTjbKF9.js +3 -0
  318. package/dist/node-host/assets/vala-BnnASFsX.js +3 -0
  319. package/dist/node-host/assets/vb-eGVhCUXq.js +3 -0
  320. package/dist/node-host/assets/verilog-Ma7yBE30.js +3 -0
  321. package/dist/node-host/assets/vesper-CfxmMOy3.js +4 -0
  322. package/dist/node-host/assets/vhdl-Co2XFKY7.js +3 -0
  323. package/dist/node-host/assets/viml-BReTXeDA.js +3 -0
  324. package/dist/node-host/assets/vitesse-black-D9-_1mjV.js +4 -0
  325. package/dist/node-host/assets/vitesse-dark-DlSMLlr9.js +4 -0
  326. package/dist/node-host/assets/vitesse-light-KRWWWztf.js +4 -0
  327. package/dist/node-host/assets/vue-C3fWU2fi.js +31 -0
  328. package/dist/node-host/assets/vue-html-DxOM9wex.js +6 -0
  329. package/dist/node-host/assets/vue-vine-OKzSGBlX.js +19 -0
  330. package/dist/node-host/assets/vyper-C6KGx0YU.js +3 -0
  331. package/dist/node-host/assets/wasm-CvHAs-FG.js +7 -0
  332. package/dist/node-host/assets/wasm-gNIKwGlD.js +3 -0
  333. package/dist/node-host/assets/wenyan-BeysbCrW.js +3 -0
  334. package/dist/node-host/assets/wgsl-1s5rV5xS.js +3 -0
  335. package/dist/node-host/assets/wikitext-wjhjmmzD.js +3 -0
  336. package/dist/node-host/assets/wit-CeQiCbz_.js +3 -0
  337. package/dist/node-host/assets/wolfram-CcZPfnLd.js +3 -0
  338. package/dist/node-host/assets/worker-factory-C80HGMWf.js +14 -0
  339. package/dist/node-host/assets/xml-BsBjJrlv.js +8 -0
  340. package/dist/node-host/assets/xsl-BYwWzvT_.js +6 -0
  341. package/dist/node-host/assets/yaml-BRgACZP0.js +6 -0
  342. package/dist/node-host/assets/zenscript-BoijL7rl.js +3 -0
  343. package/dist/node-host/assets/zig-lTQvxhLD.js +3 -0
  344. package/dist/node-host/node-host.js +41395 -0
  345. package/dist/types/assets/contract-jA5pqK6h.d.ts +111 -0
  346. package/dist/types/hosted.d.ts +2 -98
  347. package/dist/types/node-host.d.ts +40 -0
  348. package/package.json +6 -2
@@ -0,0 +1,3075 @@
1
+ //#region ../../node_modules/.pnpm/@pierre+diffs@1.5.2_@shikijs+themes@4.5.0_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/@pierre/diffs/dist/constants.js
2
+ var DIFFS_TAG_NAME = "diffs-container";
3
+ var DIFFS_DEVELOPMENT_BUILD = (() => {
4
+ try {
5
+ return process.env.NODE_ENV === "development";
6
+ } catch {
7
+ return false;
8
+ }
9
+ })();
10
+ var GIT_DIFF_FILE_BREAK_REGEX = /(?=^diff --git)/gm;
11
+ var SPLIT_WITH_NEWLINES = /(?<=\n)/;
12
+ var FILENAME_HEADER_REGEX = /^(---|\+\+\+)\s+([^\t\r\n]+)/;
13
+ var INDEX_LINE_METADATA = /^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;
14
+ var HEADER_PREFIX_SLOT_ID = "header-prefix";
15
+ var HEADER_FILENAME_SUFFIX_SLOT_ID = "header-filename-suffix";
16
+ var HEADER_METADATA_SLOT_ID = "header-metadata";
17
+ var CUSTOM_HEADER_SLOT_ID = "header-custom";
18
+ var DEFAULT_THEMES = {
19
+ dark: "pierre-dark",
20
+ light: "pierre-light"
21
+ };
22
+ var THEME_CSS_ATTRIBUTE = "data-theme-css";
23
+ var UNSAFE_CSS_ATTRIBUTE = "data-unsafe-css";
24
+ var DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE = "data-diffs-scrollbar-measure";
25
+ var CODE_VIEW_HEADER_ATTRIBUTE = "data-diffs-code-view-header";
26
+ var CODE_VIEW_FOOTER_ATTRIBUTE = "data-diffs-code-view-footer";
27
+ var DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY = "--diffs-scrollbar-gutter-measured";
28
+ var DEFAULT_TOKENIZE_MAX_LENGTH = 1e5;
29
+ var DEFAULT_VIRTUAL_FILE_METRICS = {
30
+ hunkLineCount: 50,
31
+ lineHeight: 20,
32
+ diffHeaderHeight: 44,
33
+ spacing: 8
34
+ };
35
+ var DEFAULT_CODE_VIEW_FILE_METRICS = {
36
+ ...DEFAULT_VIRTUAL_FILE_METRICS,
37
+ hunkLineCount: 1
38
+ };
39
+ var DEFAULT_CODE_VIEW_LAYOUT = {
40
+ paddingTop: 8,
41
+ paddingBottom: 8,
42
+ gap: 8
43
+ };
44
+ var DEFAULT_SMOOTH_SCROLL_SETTINGS = {
45
+ omega: .015,
46
+ positionEpsilon: .5,
47
+ velocityEpsilon: .05
48
+ };
49
+ var DEFAULT_EXPANDED_REGION = Object.freeze({
50
+ fromStart: 0,
51
+ fromEnd: 0
52
+ });
53
+ var DEFAULT_RENDER_RANGE = {
54
+ startingLine: 0,
55
+ totalLines: Infinity,
56
+ bufferBefore: 0,
57
+ bufferAfter: 0
58
+ };
59
+ var EMPTY_RENDER_RANGE = {
60
+ startingLine: 0,
61
+ totalLines: 0,
62
+ bufferBefore: 0,
63
+ bufferAfter: 0
64
+ };
65
+ //#endregion
66
+ //#region ../../node_modules/.pnpm/@shikijs+vscode-textmate@10.0.2/node_modules/@shikijs/vscode-textmate/dist/index.js
67
+ function clone(something) {
68
+ return doClone(something);
69
+ }
70
+ function doClone(something) {
71
+ if (Array.isArray(something)) return cloneArray(something);
72
+ if (something instanceof RegExp) return something;
73
+ if (typeof something === "object") return cloneObj(something);
74
+ return something;
75
+ }
76
+ function cloneArray(arr) {
77
+ let r = [];
78
+ for (let i = 0, len = arr.length; i < len; i++) r[i] = doClone(arr[i]);
79
+ return r;
80
+ }
81
+ function cloneObj(obj) {
82
+ let r = {};
83
+ for (let key in obj) r[key] = doClone(obj[key]);
84
+ return r;
85
+ }
86
+ function mergeObjects(target, ...sources) {
87
+ sources.forEach((source) => {
88
+ for (let key in source) target[key] = source[key];
89
+ });
90
+ return target;
91
+ }
92
+ function basename(path) {
93
+ const idx = ~path.lastIndexOf("/") || ~path.lastIndexOf("\\");
94
+ if (idx === 0) return path;
95
+ else if (~idx === path.length - 1) return basename(path.substring(0, path.length - 1));
96
+ else return path.substr(~idx + 1);
97
+ }
98
+ var CAPTURING_REGEX_SOURCE = /\$(\d+)|\${(\d+):\/(downcase|upcase)}/g;
99
+ var RegexSource = class {
100
+ static hasCaptures(regexSource) {
101
+ if (regexSource === null) return false;
102
+ CAPTURING_REGEX_SOURCE.lastIndex = 0;
103
+ return CAPTURING_REGEX_SOURCE.test(regexSource);
104
+ }
105
+ static replaceCaptures(regexSource, captureSource, captureIndices) {
106
+ return regexSource.replace(CAPTURING_REGEX_SOURCE, (match, index, commandIndex, command) => {
107
+ let capture = captureIndices[parseInt(index || commandIndex, 10)];
108
+ if (capture) {
109
+ let result = captureSource.substring(capture.start, capture.end);
110
+ while (result[0] === ".") result = result.substring(1);
111
+ switch (command) {
112
+ case "downcase": return result.toLowerCase();
113
+ case "upcase": return result.toUpperCase();
114
+ default: return result;
115
+ }
116
+ } else return match;
117
+ });
118
+ }
119
+ };
120
+ function strcmp(a, b) {
121
+ if (a < b) return -1;
122
+ if (a > b) return 1;
123
+ return 0;
124
+ }
125
+ function strArrCmp(a, b) {
126
+ if (a === null && b === null) return 0;
127
+ if (!a) return -1;
128
+ if (!b) return 1;
129
+ let len1 = a.length;
130
+ let len2 = b.length;
131
+ if (len1 === len2) {
132
+ for (let i = 0; i < len1; i++) {
133
+ let res = strcmp(a[i], b[i]);
134
+ if (res !== 0) return res;
135
+ }
136
+ return 0;
137
+ }
138
+ return len1 - len2;
139
+ }
140
+ function isValidHexColor(hex) {
141
+ if (/^#[0-9a-f]{6}$/i.test(hex)) return true;
142
+ if (/^#[0-9a-f]{8}$/i.test(hex)) return true;
143
+ if (/^#[0-9a-f]{3}$/i.test(hex)) return true;
144
+ if (/^#[0-9a-f]{4}$/i.test(hex)) return true;
145
+ return false;
146
+ }
147
+ function escapeRegExpCharacters(value) {
148
+ return value.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, "\\$&");
149
+ }
150
+ var CachedFn = class {
151
+ constructor(fn) {
152
+ this.fn = fn;
153
+ }
154
+ cache = /* @__PURE__ */ new Map();
155
+ get(key) {
156
+ if (this.cache.has(key)) return this.cache.get(key);
157
+ const value = this.fn(key);
158
+ this.cache.set(key, value);
159
+ return value;
160
+ }
161
+ };
162
+ var Theme = class {
163
+ constructor(_colorMap, _defaults, _root) {
164
+ this._colorMap = _colorMap;
165
+ this._defaults = _defaults;
166
+ this._root = _root;
167
+ }
168
+ static createFromRawTheme(source, colorMap) {
169
+ return this.createFromParsedTheme(parseTheme(source), colorMap);
170
+ }
171
+ static createFromParsedTheme(source, colorMap) {
172
+ return resolveParsedThemeRules(source, colorMap);
173
+ }
174
+ _cachedMatchRoot = new CachedFn((scopeName) => this._root.match(scopeName));
175
+ getColorMap() {
176
+ return this._colorMap.getColorMap();
177
+ }
178
+ getDefaults() {
179
+ return this._defaults;
180
+ }
181
+ match(scopePath) {
182
+ if (scopePath === null) return this._defaults;
183
+ const scopeName = scopePath.scopeName;
184
+ const effectiveRule = this._cachedMatchRoot.get(scopeName).find((v) => _scopePathMatchesParentScopes(scopePath.parent, v.parentScopes));
185
+ if (!effectiveRule) return null;
186
+ return new StyleAttributes(effectiveRule.fontStyle, effectiveRule.foreground, effectiveRule.background);
187
+ }
188
+ };
189
+ var ScopeStack = class _ScopeStack {
190
+ constructor(parent, scopeName) {
191
+ this.parent = parent;
192
+ this.scopeName = scopeName;
193
+ }
194
+ static push(path, scopeNames) {
195
+ for (const name of scopeNames) path = new _ScopeStack(path, name);
196
+ return path;
197
+ }
198
+ static from(...segments) {
199
+ let result = null;
200
+ for (let i = 0; i < segments.length; i++) result = new _ScopeStack(result, segments[i]);
201
+ return result;
202
+ }
203
+ push(scopeName) {
204
+ return new _ScopeStack(this, scopeName);
205
+ }
206
+ getSegments() {
207
+ let item = this;
208
+ const result = [];
209
+ while (item) {
210
+ result.push(item.scopeName);
211
+ item = item.parent;
212
+ }
213
+ result.reverse();
214
+ return result;
215
+ }
216
+ toString() {
217
+ return this.getSegments().join(" ");
218
+ }
219
+ extends(other) {
220
+ if (this === other) return true;
221
+ if (this.parent === null) return false;
222
+ return this.parent.extends(other);
223
+ }
224
+ getExtensionIfDefined(base) {
225
+ const result = [];
226
+ let item = this;
227
+ while (item && item !== base) {
228
+ result.push(item.scopeName);
229
+ item = item.parent;
230
+ }
231
+ return item === base ? result.reverse() : void 0;
232
+ }
233
+ };
234
+ function _scopePathMatchesParentScopes(scopePath, parentScopes) {
235
+ if (parentScopes.length === 0) return true;
236
+ for (let index = 0; index < parentScopes.length; index++) {
237
+ let scopePattern = parentScopes[index];
238
+ let scopeMustMatch = false;
239
+ if (scopePattern === ">") {
240
+ if (index === parentScopes.length - 1) return false;
241
+ scopePattern = parentScopes[++index];
242
+ scopeMustMatch = true;
243
+ }
244
+ while (scopePath) {
245
+ if (_matchesScope(scopePath.scopeName, scopePattern)) break;
246
+ if (scopeMustMatch) return false;
247
+ scopePath = scopePath.parent;
248
+ }
249
+ if (!scopePath) return false;
250
+ scopePath = scopePath.parent;
251
+ }
252
+ return true;
253
+ }
254
+ function _matchesScope(scopeName, scopePattern) {
255
+ return scopePattern === scopeName || scopeName.startsWith(scopePattern) && scopeName[scopePattern.length] === ".";
256
+ }
257
+ var StyleAttributes = class {
258
+ constructor(fontStyle, foregroundId, backgroundId) {
259
+ this.fontStyle = fontStyle;
260
+ this.foregroundId = foregroundId;
261
+ this.backgroundId = backgroundId;
262
+ }
263
+ };
264
+ function parseTheme(source) {
265
+ if (!source) return [];
266
+ if (!source.settings || !Array.isArray(source.settings)) return [];
267
+ let settings = source.settings;
268
+ let result = [], resultLen = 0;
269
+ for (let i = 0, len = settings.length; i < len; i++) {
270
+ let entry = settings[i];
271
+ if (!entry.settings) continue;
272
+ let scopes;
273
+ if (typeof entry.scope === "string") {
274
+ let _scope = entry.scope;
275
+ _scope = _scope.replace(/^[,]+/, "");
276
+ _scope = _scope.replace(/[,]+$/, "");
277
+ scopes = _scope.split(",");
278
+ } else if (Array.isArray(entry.scope)) scopes = entry.scope;
279
+ else scopes = [""];
280
+ let fontStyle = -1;
281
+ if (typeof entry.settings.fontStyle === "string") {
282
+ fontStyle = 0;
283
+ let segments = entry.settings.fontStyle.split(" ");
284
+ for (let j = 0, lenJ = segments.length; j < lenJ; j++) switch (segments[j]) {
285
+ case "italic":
286
+ fontStyle = fontStyle | 1;
287
+ break;
288
+ case "bold":
289
+ fontStyle = fontStyle | 2;
290
+ break;
291
+ case "underline":
292
+ fontStyle = fontStyle | 4;
293
+ break;
294
+ case "strikethrough": fontStyle = fontStyle | 8;
295
+ }
296
+ }
297
+ let foreground = null;
298
+ if (typeof entry.settings.foreground === "string" && isValidHexColor(entry.settings.foreground)) foreground = entry.settings.foreground;
299
+ let background = null;
300
+ if (typeof entry.settings.background === "string" && isValidHexColor(entry.settings.background)) background = entry.settings.background;
301
+ for (let j = 0, lenJ = scopes.length; j < lenJ; j++) {
302
+ let segments = scopes[j].trim().split(" ");
303
+ let scope = segments[segments.length - 1];
304
+ let parentScopes = null;
305
+ if (segments.length > 1) {
306
+ parentScopes = segments.slice(0, segments.length - 1);
307
+ parentScopes.reverse();
308
+ }
309
+ result[resultLen++] = new ParsedThemeRule(scope, parentScopes, i, fontStyle, foreground, background);
310
+ }
311
+ }
312
+ return result;
313
+ }
314
+ var ParsedThemeRule = class {
315
+ constructor(scope, parentScopes, index, fontStyle, foreground, background) {
316
+ this.scope = scope;
317
+ this.parentScopes = parentScopes;
318
+ this.index = index;
319
+ this.fontStyle = fontStyle;
320
+ this.foreground = foreground;
321
+ this.background = background;
322
+ }
323
+ };
324
+ var FontStyle = /* @__PURE__ */ ((FontStyle2) => {
325
+ FontStyle2[FontStyle2["NotSet"] = -1] = "NotSet";
326
+ FontStyle2[FontStyle2["None"] = 0] = "None";
327
+ FontStyle2[FontStyle2["Italic"] = 1] = "Italic";
328
+ FontStyle2[FontStyle2["Bold"] = 2] = "Bold";
329
+ FontStyle2[FontStyle2["Underline"] = 4] = "Underline";
330
+ FontStyle2[FontStyle2["Strikethrough"] = 8] = "Strikethrough";
331
+ return FontStyle2;
332
+ })(FontStyle || {});
333
+ function resolveParsedThemeRules(parsedThemeRules, _colorMap) {
334
+ parsedThemeRules.sort((a, b) => {
335
+ let r = strcmp(a.scope, b.scope);
336
+ if (r !== 0) return r;
337
+ r = strArrCmp(a.parentScopes, b.parentScopes);
338
+ if (r !== 0) return r;
339
+ return a.index - b.index;
340
+ });
341
+ let defaultFontStyle = 0;
342
+ let defaultForeground = "#000000";
343
+ let defaultBackground = "#ffffff";
344
+ while (parsedThemeRules.length >= 1 && parsedThemeRules[0].scope === "") {
345
+ let incomingDefaults = parsedThemeRules.shift();
346
+ if (incomingDefaults.fontStyle !== -1) defaultFontStyle = incomingDefaults.fontStyle;
347
+ if (incomingDefaults.foreground !== null) defaultForeground = incomingDefaults.foreground;
348
+ if (incomingDefaults.background !== null) defaultBackground = incomingDefaults.background;
349
+ }
350
+ let colorMap = new ColorMap(_colorMap);
351
+ let defaults = new StyleAttributes(defaultFontStyle, colorMap.getId(defaultForeground), colorMap.getId(defaultBackground));
352
+ let root = new ThemeTrieElement(new ThemeTrieElementRule(0, null, -1, 0, 0), []);
353
+ for (let i = 0, len = parsedThemeRules.length; i < len; i++) {
354
+ let rule = parsedThemeRules[i];
355
+ root.insert(0, rule.scope, rule.parentScopes, rule.fontStyle, colorMap.getId(rule.foreground), colorMap.getId(rule.background));
356
+ }
357
+ return new Theme(colorMap, defaults, root);
358
+ }
359
+ var ColorMap = class {
360
+ _isFrozen;
361
+ _lastColorId;
362
+ _id2color;
363
+ _color2id;
364
+ constructor(_colorMap) {
365
+ this._lastColorId = 0;
366
+ this._id2color = [];
367
+ this._color2id = /* @__PURE__ */ Object.create(null);
368
+ if (Array.isArray(_colorMap)) {
369
+ this._isFrozen = true;
370
+ for (let i = 0, len = _colorMap.length; i < len; i++) {
371
+ this._color2id[_colorMap[i]] = i;
372
+ this._id2color[i] = _colorMap[i];
373
+ }
374
+ } else this._isFrozen = false;
375
+ }
376
+ getId(color) {
377
+ if (color === null) return 0;
378
+ color = color.toUpperCase();
379
+ let value = this._color2id[color];
380
+ if (value) return value;
381
+ if (this._isFrozen) throw new Error(`Missing color in color map - ${color}`);
382
+ value = ++this._lastColorId;
383
+ this._color2id[color] = value;
384
+ this._id2color[value] = color;
385
+ return value;
386
+ }
387
+ getColorMap() {
388
+ return this._id2color.slice(0);
389
+ }
390
+ };
391
+ var emptyParentScopes = Object.freeze([]);
392
+ var ThemeTrieElementRule = class _ThemeTrieElementRule {
393
+ scopeDepth;
394
+ parentScopes;
395
+ fontStyle;
396
+ foreground;
397
+ background;
398
+ constructor(scopeDepth, parentScopes, fontStyle, foreground, background) {
399
+ this.scopeDepth = scopeDepth;
400
+ this.parentScopes = parentScopes || emptyParentScopes;
401
+ this.fontStyle = fontStyle;
402
+ this.foreground = foreground;
403
+ this.background = background;
404
+ }
405
+ clone() {
406
+ return new _ThemeTrieElementRule(this.scopeDepth, this.parentScopes, this.fontStyle, this.foreground, this.background);
407
+ }
408
+ static cloneArr(arr) {
409
+ let r = [];
410
+ for (let i = 0, len = arr.length; i < len; i++) r[i] = arr[i].clone();
411
+ return r;
412
+ }
413
+ acceptOverwrite(scopeDepth, fontStyle, foreground, background) {
414
+ if (this.scopeDepth > scopeDepth) console.log("how did this happen?");
415
+ else this.scopeDepth = scopeDepth;
416
+ if (fontStyle !== -1) this.fontStyle = fontStyle;
417
+ if (foreground !== 0) this.foreground = foreground;
418
+ if (background !== 0) this.background = background;
419
+ }
420
+ };
421
+ var ThemeTrieElement = class _ThemeTrieElement {
422
+ constructor(_mainRule, rulesWithParentScopes = [], _children = {}) {
423
+ this._mainRule = _mainRule;
424
+ this._children = _children;
425
+ this._rulesWithParentScopes = rulesWithParentScopes;
426
+ }
427
+ _rulesWithParentScopes;
428
+ static _cmpBySpecificity(a, b) {
429
+ if (a.scopeDepth !== b.scopeDepth) return b.scopeDepth - a.scopeDepth;
430
+ let aParentIndex = 0;
431
+ let bParentIndex = 0;
432
+ while (true) {
433
+ if (a.parentScopes[aParentIndex] === ">") aParentIndex++;
434
+ if (b.parentScopes[bParentIndex] === ">") bParentIndex++;
435
+ if (aParentIndex >= a.parentScopes.length || bParentIndex >= b.parentScopes.length) break;
436
+ const parentScopeLengthDiff = b.parentScopes[bParentIndex].length - a.parentScopes[aParentIndex].length;
437
+ if (parentScopeLengthDiff !== 0) return parentScopeLengthDiff;
438
+ aParentIndex++;
439
+ bParentIndex++;
440
+ }
441
+ return b.parentScopes.length - a.parentScopes.length;
442
+ }
443
+ match(scope) {
444
+ if (scope !== "") {
445
+ let dotIndex = scope.indexOf(".");
446
+ let head;
447
+ let tail;
448
+ if (dotIndex === -1) {
449
+ head = scope;
450
+ tail = "";
451
+ } else {
452
+ head = scope.substring(0, dotIndex);
453
+ tail = scope.substring(dotIndex + 1);
454
+ }
455
+ if (this._children.hasOwnProperty(head)) return this._children[head].match(tail);
456
+ }
457
+ const rules = this._rulesWithParentScopes.concat(this._mainRule);
458
+ rules.sort(_ThemeTrieElement._cmpBySpecificity);
459
+ return rules;
460
+ }
461
+ insert(scopeDepth, scope, parentScopes, fontStyle, foreground, background) {
462
+ if (scope === "") {
463
+ this._doInsertHere(scopeDepth, parentScopes, fontStyle, foreground, background);
464
+ return;
465
+ }
466
+ let dotIndex = scope.indexOf(".");
467
+ let head;
468
+ let tail;
469
+ if (dotIndex === -1) {
470
+ head = scope;
471
+ tail = "";
472
+ } else {
473
+ head = scope.substring(0, dotIndex);
474
+ tail = scope.substring(dotIndex + 1);
475
+ }
476
+ let child;
477
+ if (this._children.hasOwnProperty(head)) child = this._children[head];
478
+ else {
479
+ child = new _ThemeTrieElement(this._mainRule.clone(), ThemeTrieElementRule.cloneArr(this._rulesWithParentScopes));
480
+ this._children[head] = child;
481
+ }
482
+ child.insert(scopeDepth + 1, tail, parentScopes, fontStyle, foreground, background);
483
+ }
484
+ _doInsertHere(scopeDepth, parentScopes, fontStyle, foreground, background) {
485
+ if (parentScopes === null) {
486
+ this._mainRule.acceptOverwrite(scopeDepth, fontStyle, foreground, background);
487
+ return;
488
+ }
489
+ for (let i = 0, len = this._rulesWithParentScopes.length; i < len; i++) {
490
+ let rule = this._rulesWithParentScopes[i];
491
+ if (strArrCmp(rule.parentScopes, parentScopes) === 0) {
492
+ rule.acceptOverwrite(scopeDepth, fontStyle, foreground, background);
493
+ return;
494
+ }
495
+ }
496
+ if (fontStyle === -1) fontStyle = this._mainRule.fontStyle;
497
+ if (foreground === 0) foreground = this._mainRule.foreground;
498
+ if (background === 0) background = this._mainRule.background;
499
+ this._rulesWithParentScopes.push(new ThemeTrieElementRule(scopeDepth, parentScopes, fontStyle, foreground, background));
500
+ }
501
+ };
502
+ var EncodedTokenMetadata = class _EncodedTokenMetadata {
503
+ static toBinaryStr(encodedTokenAttributes) {
504
+ return encodedTokenAttributes.toString(2).padStart(32, "0");
505
+ }
506
+ static print(encodedTokenAttributes) {
507
+ const languageId = _EncodedTokenMetadata.getLanguageId(encodedTokenAttributes);
508
+ const tokenType = _EncodedTokenMetadata.getTokenType(encodedTokenAttributes);
509
+ const fontStyle = _EncodedTokenMetadata.getFontStyle(encodedTokenAttributes);
510
+ const foreground = _EncodedTokenMetadata.getForeground(encodedTokenAttributes);
511
+ const background = _EncodedTokenMetadata.getBackground(encodedTokenAttributes);
512
+ console.log({
513
+ languageId,
514
+ tokenType,
515
+ fontStyle,
516
+ foreground,
517
+ background
518
+ });
519
+ }
520
+ static getLanguageId(encodedTokenAttributes) {
521
+ return (encodedTokenAttributes & 255) >>> 0;
522
+ }
523
+ static getTokenType(encodedTokenAttributes) {
524
+ return (encodedTokenAttributes & 768) >>> 8;
525
+ }
526
+ static containsBalancedBrackets(encodedTokenAttributes) {
527
+ return (encodedTokenAttributes & 1024) !== 0;
528
+ }
529
+ static getFontStyle(encodedTokenAttributes) {
530
+ return (encodedTokenAttributes & 30720) >>> 11;
531
+ }
532
+ static getForeground(encodedTokenAttributes) {
533
+ return (encodedTokenAttributes & 16744448) >>> 15;
534
+ }
535
+ static getBackground(encodedTokenAttributes) {
536
+ return (encodedTokenAttributes & 4278190080) >>> 24;
537
+ }
538
+ /**
539
+ * Updates the fields in `metadata`.
540
+ * A value of `0`, `NotSet` or `null` indicates that the corresponding field should be left as is.
541
+ */
542
+ static set(encodedTokenAttributes, languageId, tokenType, containsBalancedBrackets, fontStyle, foreground, background) {
543
+ let _languageId = _EncodedTokenMetadata.getLanguageId(encodedTokenAttributes);
544
+ let _tokenType = _EncodedTokenMetadata.getTokenType(encodedTokenAttributes);
545
+ let _containsBalancedBracketsBit = _EncodedTokenMetadata.containsBalancedBrackets(encodedTokenAttributes) ? 1 : 0;
546
+ let _fontStyle = _EncodedTokenMetadata.getFontStyle(encodedTokenAttributes);
547
+ let _foreground = _EncodedTokenMetadata.getForeground(encodedTokenAttributes);
548
+ let _background = _EncodedTokenMetadata.getBackground(encodedTokenAttributes);
549
+ if (languageId !== 0) _languageId = languageId;
550
+ if (tokenType !== 8) _tokenType = fromOptionalTokenType(tokenType);
551
+ if (containsBalancedBrackets !== null) _containsBalancedBracketsBit = containsBalancedBrackets ? 1 : 0;
552
+ if (fontStyle !== -1) _fontStyle = fontStyle;
553
+ if (foreground !== 0) _foreground = foreground;
554
+ if (background !== 0) _background = background;
555
+ return (_languageId << 0 | _tokenType << 8 | _containsBalancedBracketsBit << 10 | _fontStyle << 11 | _foreground << 15 | _background << 24) >>> 0;
556
+ }
557
+ };
558
+ function toOptionalTokenType(standardType) {
559
+ return standardType;
560
+ }
561
+ function fromOptionalTokenType(standardType) {
562
+ return standardType;
563
+ }
564
+ function createMatchers(selector, matchesName) {
565
+ const results = [];
566
+ const tokenizer = newTokenizer(selector);
567
+ let token = tokenizer.next();
568
+ while (token !== null) {
569
+ let priority = 0;
570
+ if (token.length === 2 && token.charAt(1) === ":") {
571
+ switch (token.charAt(0)) {
572
+ case "R":
573
+ priority = 1;
574
+ break;
575
+ case "L":
576
+ priority = -1;
577
+ break;
578
+ default: console.log(`Unknown priority ${token} in scope selector`);
579
+ }
580
+ token = tokenizer.next();
581
+ }
582
+ let matcher = parseConjunction();
583
+ results.push({
584
+ matcher,
585
+ priority
586
+ });
587
+ if (token !== ",") break;
588
+ token = tokenizer.next();
589
+ }
590
+ return results;
591
+ function parseOperand() {
592
+ if (token === "-") {
593
+ token = tokenizer.next();
594
+ const expressionToNegate = parseOperand();
595
+ return (matcherInput) => !!expressionToNegate && !expressionToNegate(matcherInput);
596
+ }
597
+ if (token === "(") {
598
+ token = tokenizer.next();
599
+ const expressionInParents = parseInnerExpression();
600
+ if (token === ")") token = tokenizer.next();
601
+ return expressionInParents;
602
+ }
603
+ if (isIdentifier(token)) {
604
+ const identifiers = [];
605
+ do {
606
+ identifiers.push(token);
607
+ token = tokenizer.next();
608
+ } while (isIdentifier(token));
609
+ return (matcherInput) => matchesName(identifiers, matcherInput);
610
+ }
611
+ return null;
612
+ }
613
+ function parseConjunction() {
614
+ const matchers = [];
615
+ let matcher = parseOperand();
616
+ while (matcher) {
617
+ matchers.push(matcher);
618
+ matcher = parseOperand();
619
+ }
620
+ return (matcherInput) => matchers.every((matcher2) => matcher2(matcherInput));
621
+ }
622
+ function parseInnerExpression() {
623
+ const matchers = [];
624
+ let matcher = parseConjunction();
625
+ while (matcher) {
626
+ matchers.push(matcher);
627
+ if (token === "|" || token === ",") do
628
+ token = tokenizer.next();
629
+ while (token === "|" || token === ",");
630
+ else break;
631
+ matcher = parseConjunction();
632
+ }
633
+ return (matcherInput) => matchers.some((matcher2) => matcher2(matcherInput));
634
+ }
635
+ }
636
+ function isIdentifier(token) {
637
+ return !!token && !!token.match(/[\w\.:]+/);
638
+ }
639
+ function newTokenizer(input) {
640
+ let regex = /([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g;
641
+ let match = regex.exec(input);
642
+ return { next: () => {
643
+ if (!match) return null;
644
+ const res = match[0];
645
+ match = regex.exec(input);
646
+ return res;
647
+ } };
648
+ }
649
+ function disposeOnigString(str) {
650
+ if (typeof str.dispose === "function") str.dispose();
651
+ }
652
+ var TopLevelRuleReference = class {
653
+ constructor(scopeName) {
654
+ this.scopeName = scopeName;
655
+ }
656
+ toKey() {
657
+ return this.scopeName;
658
+ }
659
+ };
660
+ var TopLevelRepositoryRuleReference = class {
661
+ constructor(scopeName, ruleName) {
662
+ this.scopeName = scopeName;
663
+ this.ruleName = ruleName;
664
+ }
665
+ toKey() {
666
+ return `${this.scopeName}#${this.ruleName}`;
667
+ }
668
+ };
669
+ var ExternalReferenceCollector = class {
670
+ _references = [];
671
+ _seenReferenceKeys = /* @__PURE__ */ new Set();
672
+ get references() {
673
+ return this._references;
674
+ }
675
+ visitedRule = /* @__PURE__ */ new Set();
676
+ add(reference) {
677
+ const key = reference.toKey();
678
+ if (this._seenReferenceKeys.has(key)) return;
679
+ this._seenReferenceKeys.add(key);
680
+ this._references.push(reference);
681
+ }
682
+ };
683
+ var ScopeDependencyProcessor = class {
684
+ constructor(repo, initialScopeName) {
685
+ this.repo = repo;
686
+ this.initialScopeName = initialScopeName;
687
+ this.seenFullScopeRequests.add(this.initialScopeName);
688
+ this.Q = [new TopLevelRuleReference(this.initialScopeName)];
689
+ }
690
+ seenFullScopeRequests = /* @__PURE__ */ new Set();
691
+ seenPartialScopeRequests = /* @__PURE__ */ new Set();
692
+ Q;
693
+ processQueue() {
694
+ const q = this.Q;
695
+ this.Q = [];
696
+ const deps = new ExternalReferenceCollector();
697
+ for (const dep of q) collectReferencesOfReference(dep, this.initialScopeName, this.repo, deps);
698
+ for (const dep of deps.references) if (dep instanceof TopLevelRuleReference) {
699
+ if (this.seenFullScopeRequests.has(dep.scopeName)) continue;
700
+ this.seenFullScopeRequests.add(dep.scopeName);
701
+ this.Q.push(dep);
702
+ } else {
703
+ if (this.seenFullScopeRequests.has(dep.scopeName)) continue;
704
+ if (this.seenPartialScopeRequests.has(dep.toKey())) continue;
705
+ this.seenPartialScopeRequests.add(dep.toKey());
706
+ this.Q.push(dep);
707
+ }
708
+ }
709
+ };
710
+ function collectReferencesOfReference(reference, baseGrammarScopeName, repo, result) {
711
+ const selfGrammar = repo.lookup(reference.scopeName);
712
+ if (!selfGrammar) {
713
+ if (reference.scopeName === baseGrammarScopeName) throw new Error(`No grammar provided for <${baseGrammarScopeName}>`);
714
+ return;
715
+ }
716
+ const baseGrammar = repo.lookup(baseGrammarScopeName);
717
+ if (reference instanceof TopLevelRuleReference) collectExternalReferencesInTopLevelRule({
718
+ baseGrammar,
719
+ selfGrammar
720
+ }, result);
721
+ else collectExternalReferencesInTopLevelRepositoryRule(reference.ruleName, {
722
+ baseGrammar,
723
+ selfGrammar,
724
+ repository: selfGrammar.repository
725
+ }, result);
726
+ const injections = repo.injections(reference.scopeName);
727
+ if (injections) for (const injection of injections) result.add(new TopLevelRuleReference(injection));
728
+ }
729
+ function collectExternalReferencesInTopLevelRepositoryRule(ruleName, context, result) {
730
+ if (context.repository && context.repository[ruleName]) {
731
+ const rule = context.repository[ruleName];
732
+ collectExternalReferencesInRules([rule], context, result);
733
+ }
734
+ }
735
+ function collectExternalReferencesInTopLevelRule(context, result) {
736
+ if (context.selfGrammar.patterns && Array.isArray(context.selfGrammar.patterns)) collectExternalReferencesInRules(context.selfGrammar.patterns, {
737
+ ...context,
738
+ repository: context.selfGrammar.repository
739
+ }, result);
740
+ if (context.selfGrammar.injections) collectExternalReferencesInRules(Object.values(context.selfGrammar.injections), {
741
+ ...context,
742
+ repository: context.selfGrammar.repository
743
+ }, result);
744
+ }
745
+ function collectExternalReferencesInRules(rules, context, result) {
746
+ for (const rule of rules) {
747
+ if (result.visitedRule.has(rule)) continue;
748
+ result.visitedRule.add(rule);
749
+ const patternRepository = rule.repository ? mergeObjects({}, context.repository, rule.repository) : context.repository;
750
+ if (Array.isArray(rule.patterns)) collectExternalReferencesInRules(rule.patterns, {
751
+ ...context,
752
+ repository: patternRepository
753
+ }, result);
754
+ const include = rule.include;
755
+ if (!include) continue;
756
+ const reference = parseInclude(include);
757
+ switch (reference.kind) {
758
+ case 0:
759
+ collectExternalReferencesInTopLevelRule({
760
+ ...context,
761
+ selfGrammar: context.baseGrammar
762
+ }, result);
763
+ break;
764
+ case 1:
765
+ collectExternalReferencesInTopLevelRule(context, result);
766
+ break;
767
+ case 2:
768
+ collectExternalReferencesInTopLevelRepositoryRule(reference.ruleName, {
769
+ ...context,
770
+ repository: patternRepository
771
+ }, result);
772
+ break;
773
+ case 3:
774
+ case 4:
775
+ const selfGrammar = reference.scopeName === context.selfGrammar.scopeName ? context.selfGrammar : reference.scopeName === context.baseGrammar.scopeName ? context.baseGrammar : void 0;
776
+ if (selfGrammar) {
777
+ const newContext = {
778
+ baseGrammar: context.baseGrammar,
779
+ selfGrammar,
780
+ repository: patternRepository
781
+ };
782
+ if (reference.kind === 4) collectExternalReferencesInTopLevelRepositoryRule(reference.ruleName, newContext, result);
783
+ else collectExternalReferencesInTopLevelRule(newContext, result);
784
+ } else if (reference.kind === 4) result.add(new TopLevelRepositoryRuleReference(reference.scopeName, reference.ruleName));
785
+ else result.add(new TopLevelRuleReference(reference.scopeName));
786
+ }
787
+ }
788
+ }
789
+ var BaseReference = class {
790
+ kind = 0;
791
+ };
792
+ var SelfReference = class {
793
+ kind = 1;
794
+ };
795
+ var RelativeReference = class {
796
+ constructor(ruleName) {
797
+ this.ruleName = ruleName;
798
+ }
799
+ kind = 2;
800
+ };
801
+ var TopLevelReference = class {
802
+ constructor(scopeName) {
803
+ this.scopeName = scopeName;
804
+ }
805
+ kind = 3;
806
+ };
807
+ var TopLevelRepositoryReference = class {
808
+ constructor(scopeName, ruleName) {
809
+ this.scopeName = scopeName;
810
+ this.ruleName = ruleName;
811
+ }
812
+ kind = 4;
813
+ };
814
+ function parseInclude(include) {
815
+ if (include === "$base") return new BaseReference();
816
+ else if (include === "$self") return new SelfReference();
817
+ const indexOfSharp = include.indexOf("#");
818
+ if (indexOfSharp === -1) return new TopLevelReference(include);
819
+ else if (indexOfSharp === 0) return new RelativeReference(include.substring(1));
820
+ else return new TopLevelRepositoryReference(include.substring(0, indexOfSharp), include.substring(indexOfSharp + 1));
821
+ }
822
+ var HAS_BACK_REFERENCES = /\\(\d+)/;
823
+ var BACK_REFERENCING_END = /\\(\d+)/g;
824
+ var endRuleId = -1;
825
+ var whileRuleId = -2;
826
+ function ruleIdFromNumber(id) {
827
+ return id;
828
+ }
829
+ function ruleIdToNumber(id) {
830
+ return id;
831
+ }
832
+ var Rule = class {
833
+ $location;
834
+ id;
835
+ _nameIsCapturing;
836
+ _name;
837
+ _contentNameIsCapturing;
838
+ _contentName;
839
+ constructor($location, id, name, contentName) {
840
+ this.$location = $location;
841
+ this.id = id;
842
+ this._name = name || null;
843
+ this._nameIsCapturing = RegexSource.hasCaptures(this._name);
844
+ this._contentName = contentName || null;
845
+ this._contentNameIsCapturing = RegexSource.hasCaptures(this._contentName);
846
+ }
847
+ get debugName() {
848
+ const location = this.$location ? `${basename(this.$location.filename)}:${this.$location.line}` : "unknown";
849
+ return `${this.constructor.name}#${this.id} @ ${location}`;
850
+ }
851
+ getName(lineText, captureIndices) {
852
+ if (!this._nameIsCapturing || this._name === null || lineText === null || captureIndices === null) return this._name;
853
+ return RegexSource.replaceCaptures(this._name, lineText, captureIndices);
854
+ }
855
+ getContentName(lineText, captureIndices) {
856
+ if (!this._contentNameIsCapturing || this._contentName === null) return this._contentName;
857
+ return RegexSource.replaceCaptures(this._contentName, lineText, captureIndices);
858
+ }
859
+ };
860
+ var CaptureRule = class extends Rule {
861
+ retokenizeCapturedWithRuleId;
862
+ constructor($location, id, name, contentName, retokenizeCapturedWithRuleId) {
863
+ super($location, id, name, contentName);
864
+ this.retokenizeCapturedWithRuleId = retokenizeCapturedWithRuleId;
865
+ }
866
+ dispose() {}
867
+ collectPatterns(grammar, out) {
868
+ throw new Error("Not supported!");
869
+ }
870
+ compile(grammar, endRegexSource) {
871
+ throw new Error("Not supported!");
872
+ }
873
+ compileAG(grammar, endRegexSource, allowA, allowG) {
874
+ throw new Error("Not supported!");
875
+ }
876
+ };
877
+ var MatchRule = class extends Rule {
878
+ _match;
879
+ captures;
880
+ _cachedCompiledPatterns;
881
+ constructor($location, id, name, match, captures) {
882
+ super($location, id, name, null);
883
+ this._match = new RegExpSource(match, this.id);
884
+ this.captures = captures;
885
+ this._cachedCompiledPatterns = null;
886
+ }
887
+ dispose() {
888
+ if (this._cachedCompiledPatterns) {
889
+ this._cachedCompiledPatterns.dispose();
890
+ this._cachedCompiledPatterns = null;
891
+ }
892
+ }
893
+ get debugMatchRegExp() {
894
+ return `${this._match.source}`;
895
+ }
896
+ collectPatterns(grammar, out) {
897
+ out.push(this._match);
898
+ }
899
+ compile(grammar, endRegexSource) {
900
+ return this._getCachedCompiledPatterns(grammar).compile(grammar);
901
+ }
902
+ compileAG(grammar, endRegexSource, allowA, allowG) {
903
+ return this._getCachedCompiledPatterns(grammar).compileAG(grammar, allowA, allowG);
904
+ }
905
+ _getCachedCompiledPatterns(grammar) {
906
+ if (!this._cachedCompiledPatterns) {
907
+ this._cachedCompiledPatterns = new RegExpSourceList();
908
+ this.collectPatterns(grammar, this._cachedCompiledPatterns);
909
+ }
910
+ return this._cachedCompiledPatterns;
911
+ }
912
+ };
913
+ var IncludeOnlyRule = class extends Rule {
914
+ hasMissingPatterns;
915
+ patterns;
916
+ _cachedCompiledPatterns;
917
+ constructor($location, id, name, contentName, patterns) {
918
+ super($location, id, name, contentName);
919
+ this.patterns = patterns.patterns;
920
+ this.hasMissingPatterns = patterns.hasMissingPatterns;
921
+ this._cachedCompiledPatterns = null;
922
+ }
923
+ dispose() {
924
+ if (this._cachedCompiledPatterns) {
925
+ this._cachedCompiledPatterns.dispose();
926
+ this._cachedCompiledPatterns = null;
927
+ }
928
+ }
929
+ collectPatterns(grammar, out) {
930
+ for (const pattern of this.patterns) grammar.getRule(pattern).collectPatterns(grammar, out);
931
+ }
932
+ compile(grammar, endRegexSource) {
933
+ return this._getCachedCompiledPatterns(grammar).compile(grammar);
934
+ }
935
+ compileAG(grammar, endRegexSource, allowA, allowG) {
936
+ return this._getCachedCompiledPatterns(grammar).compileAG(grammar, allowA, allowG);
937
+ }
938
+ _getCachedCompiledPatterns(grammar) {
939
+ if (!this._cachedCompiledPatterns) {
940
+ this._cachedCompiledPatterns = new RegExpSourceList();
941
+ this.collectPatterns(grammar, this._cachedCompiledPatterns);
942
+ }
943
+ return this._cachedCompiledPatterns;
944
+ }
945
+ };
946
+ var BeginEndRule = class extends Rule {
947
+ _begin;
948
+ beginCaptures;
949
+ _end;
950
+ endHasBackReferences;
951
+ endCaptures;
952
+ applyEndPatternLast;
953
+ hasMissingPatterns;
954
+ patterns;
955
+ _cachedCompiledPatterns;
956
+ constructor($location, id, name, contentName, begin, beginCaptures, end, endCaptures, applyEndPatternLast, patterns) {
957
+ super($location, id, name, contentName);
958
+ this._begin = new RegExpSource(begin, this.id);
959
+ this.beginCaptures = beginCaptures;
960
+ this._end = new RegExpSource(end ? end : "￿", -1);
961
+ this.endHasBackReferences = this._end.hasBackReferences;
962
+ this.endCaptures = endCaptures;
963
+ this.applyEndPatternLast = applyEndPatternLast || false;
964
+ this.patterns = patterns.patterns;
965
+ this.hasMissingPatterns = patterns.hasMissingPatterns;
966
+ this._cachedCompiledPatterns = null;
967
+ }
968
+ dispose() {
969
+ if (this._cachedCompiledPatterns) {
970
+ this._cachedCompiledPatterns.dispose();
971
+ this._cachedCompiledPatterns = null;
972
+ }
973
+ }
974
+ get debugBeginRegExp() {
975
+ return `${this._begin.source}`;
976
+ }
977
+ get debugEndRegExp() {
978
+ return `${this._end.source}`;
979
+ }
980
+ getEndWithResolvedBackReferences(lineText, captureIndices) {
981
+ return this._end.resolveBackReferences(lineText, captureIndices);
982
+ }
983
+ collectPatterns(grammar, out) {
984
+ out.push(this._begin);
985
+ }
986
+ compile(grammar, endRegexSource) {
987
+ return this._getCachedCompiledPatterns(grammar, endRegexSource).compile(grammar);
988
+ }
989
+ compileAG(grammar, endRegexSource, allowA, allowG) {
990
+ return this._getCachedCompiledPatterns(grammar, endRegexSource).compileAG(grammar, allowA, allowG);
991
+ }
992
+ _getCachedCompiledPatterns(grammar, endRegexSource) {
993
+ if (!this._cachedCompiledPatterns) {
994
+ this._cachedCompiledPatterns = new RegExpSourceList();
995
+ for (const pattern of this.patterns) grammar.getRule(pattern).collectPatterns(grammar, this._cachedCompiledPatterns);
996
+ if (this.applyEndPatternLast) this._cachedCompiledPatterns.push(this._end.hasBackReferences ? this._end.clone() : this._end);
997
+ else this._cachedCompiledPatterns.unshift(this._end.hasBackReferences ? this._end.clone() : this._end);
998
+ }
999
+ if (this._end.hasBackReferences) {
1000
+ if (this.applyEndPatternLast) this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length() - 1, endRegexSource);
1001
+ else this._cachedCompiledPatterns.setSource(0, endRegexSource);
1002
+ }
1003
+ return this._cachedCompiledPatterns;
1004
+ }
1005
+ };
1006
+ var BeginWhileRule = class extends Rule {
1007
+ _begin;
1008
+ beginCaptures;
1009
+ whileCaptures;
1010
+ _while;
1011
+ whileHasBackReferences;
1012
+ hasMissingPatterns;
1013
+ patterns;
1014
+ _cachedCompiledPatterns;
1015
+ _cachedCompiledWhilePatterns;
1016
+ constructor($location, id, name, contentName, begin, beginCaptures, _while, whileCaptures, patterns) {
1017
+ super($location, id, name, contentName);
1018
+ this._begin = new RegExpSource(begin, this.id);
1019
+ this.beginCaptures = beginCaptures;
1020
+ this.whileCaptures = whileCaptures;
1021
+ this._while = new RegExpSource(_while, whileRuleId);
1022
+ this.whileHasBackReferences = this._while.hasBackReferences;
1023
+ this.patterns = patterns.patterns;
1024
+ this.hasMissingPatterns = patterns.hasMissingPatterns;
1025
+ this._cachedCompiledPatterns = null;
1026
+ this._cachedCompiledWhilePatterns = null;
1027
+ }
1028
+ dispose() {
1029
+ if (this._cachedCompiledPatterns) {
1030
+ this._cachedCompiledPatterns.dispose();
1031
+ this._cachedCompiledPatterns = null;
1032
+ }
1033
+ if (this._cachedCompiledWhilePatterns) {
1034
+ this._cachedCompiledWhilePatterns.dispose();
1035
+ this._cachedCompiledWhilePatterns = null;
1036
+ }
1037
+ }
1038
+ get debugBeginRegExp() {
1039
+ return `${this._begin.source}`;
1040
+ }
1041
+ get debugWhileRegExp() {
1042
+ return `${this._while.source}`;
1043
+ }
1044
+ getWhileWithResolvedBackReferences(lineText, captureIndices) {
1045
+ return this._while.resolveBackReferences(lineText, captureIndices);
1046
+ }
1047
+ collectPatterns(grammar, out) {
1048
+ out.push(this._begin);
1049
+ }
1050
+ compile(grammar, endRegexSource) {
1051
+ return this._getCachedCompiledPatterns(grammar).compile(grammar);
1052
+ }
1053
+ compileAG(grammar, endRegexSource, allowA, allowG) {
1054
+ return this._getCachedCompiledPatterns(grammar).compileAG(grammar, allowA, allowG);
1055
+ }
1056
+ _getCachedCompiledPatterns(grammar) {
1057
+ if (!this._cachedCompiledPatterns) {
1058
+ this._cachedCompiledPatterns = new RegExpSourceList();
1059
+ for (const pattern of this.patterns) grammar.getRule(pattern).collectPatterns(grammar, this._cachedCompiledPatterns);
1060
+ }
1061
+ return this._cachedCompiledPatterns;
1062
+ }
1063
+ compileWhile(grammar, endRegexSource) {
1064
+ return this._getCachedCompiledWhilePatterns(grammar, endRegexSource).compile(grammar);
1065
+ }
1066
+ compileWhileAG(grammar, endRegexSource, allowA, allowG) {
1067
+ return this._getCachedCompiledWhilePatterns(grammar, endRegexSource).compileAG(grammar, allowA, allowG);
1068
+ }
1069
+ _getCachedCompiledWhilePatterns(grammar, endRegexSource) {
1070
+ if (!this._cachedCompiledWhilePatterns) {
1071
+ this._cachedCompiledWhilePatterns = new RegExpSourceList();
1072
+ this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences ? this._while.clone() : this._while);
1073
+ }
1074
+ if (this._while.hasBackReferences) this._cachedCompiledWhilePatterns.setSource(0, endRegexSource ? endRegexSource : "￿");
1075
+ return this._cachedCompiledWhilePatterns;
1076
+ }
1077
+ };
1078
+ var RuleFactory = class _RuleFactory {
1079
+ static createCaptureRule(helper, $location, name, contentName, retokenizeCapturedWithRuleId) {
1080
+ return helper.registerRule((id) => {
1081
+ return new CaptureRule($location, id, name, contentName, retokenizeCapturedWithRuleId);
1082
+ });
1083
+ }
1084
+ static getCompiledRuleId(desc, helper, repository) {
1085
+ if (!desc.id) helper.registerRule((id) => {
1086
+ desc.id = id;
1087
+ if (desc.match) return new MatchRule(desc.$vscodeTextmateLocation, desc.id, desc.name, desc.match, _RuleFactory._compileCaptures(desc.captures, helper, repository));
1088
+ if (typeof desc.begin === "undefined") {
1089
+ if (desc.repository) repository = mergeObjects({}, repository, desc.repository);
1090
+ let patterns = desc.patterns;
1091
+ if (typeof patterns === "undefined" && desc.include) patterns = [{ include: desc.include }];
1092
+ return new IncludeOnlyRule(desc.$vscodeTextmateLocation, desc.id, desc.name, desc.contentName, _RuleFactory._compilePatterns(patterns, helper, repository));
1093
+ }
1094
+ if (desc.while) return new BeginWhileRule(desc.$vscodeTextmateLocation, desc.id, desc.name, desc.contentName, desc.begin, _RuleFactory._compileCaptures(desc.beginCaptures || desc.captures, helper, repository), desc.while, _RuleFactory._compileCaptures(desc.whileCaptures || desc.captures, helper, repository), _RuleFactory._compilePatterns(desc.patterns, helper, repository));
1095
+ return new BeginEndRule(desc.$vscodeTextmateLocation, desc.id, desc.name, desc.contentName, desc.begin, _RuleFactory._compileCaptures(desc.beginCaptures || desc.captures, helper, repository), desc.end, _RuleFactory._compileCaptures(desc.endCaptures || desc.captures, helper, repository), desc.applyEndPatternLast, _RuleFactory._compilePatterns(desc.patterns, helper, repository));
1096
+ });
1097
+ return desc.id;
1098
+ }
1099
+ static _compileCaptures(captures, helper, repository) {
1100
+ let r = [];
1101
+ if (captures) {
1102
+ let maximumCaptureId = 0;
1103
+ for (const captureId in captures) {
1104
+ if (captureId === "$vscodeTextmateLocation") continue;
1105
+ const numericCaptureId = parseInt(captureId, 10);
1106
+ if (numericCaptureId > maximumCaptureId) maximumCaptureId = numericCaptureId;
1107
+ }
1108
+ for (let i = 0; i <= maximumCaptureId; i++) r[i] = null;
1109
+ for (const captureId in captures) {
1110
+ if (captureId === "$vscodeTextmateLocation") continue;
1111
+ const numericCaptureId = parseInt(captureId, 10);
1112
+ let retokenizeCapturedWithRuleId = 0;
1113
+ if (captures[captureId].patterns) retokenizeCapturedWithRuleId = _RuleFactory.getCompiledRuleId(captures[captureId], helper, repository);
1114
+ r[numericCaptureId] = _RuleFactory.createCaptureRule(helper, captures[captureId].$vscodeTextmateLocation, captures[captureId].name, captures[captureId].contentName, retokenizeCapturedWithRuleId);
1115
+ }
1116
+ }
1117
+ return r;
1118
+ }
1119
+ static _compilePatterns(patterns, helper, repository) {
1120
+ let r = [];
1121
+ if (patterns) for (let i = 0, len = patterns.length; i < len; i++) {
1122
+ const pattern = patterns[i];
1123
+ let ruleId = -1;
1124
+ if (pattern.include) {
1125
+ const reference = parseInclude(pattern.include);
1126
+ switch (reference.kind) {
1127
+ case 0:
1128
+ case 1:
1129
+ ruleId = _RuleFactory.getCompiledRuleId(repository[pattern.include], helper, repository);
1130
+ break;
1131
+ case 2:
1132
+ let localIncludedRule = repository[reference.ruleName];
1133
+ if (localIncludedRule) ruleId = _RuleFactory.getCompiledRuleId(localIncludedRule, helper, repository);
1134
+ break;
1135
+ case 3:
1136
+ case 4:
1137
+ const externalGrammarName = reference.scopeName;
1138
+ const externalGrammarInclude = reference.kind === 4 ? reference.ruleName : null;
1139
+ const externalGrammar = helper.getExternalGrammar(externalGrammarName, repository);
1140
+ if (externalGrammar) {
1141
+ if (externalGrammarInclude) {
1142
+ let externalIncludedRule = externalGrammar.repository[externalGrammarInclude];
1143
+ if (externalIncludedRule) ruleId = _RuleFactory.getCompiledRuleId(externalIncludedRule, helper, externalGrammar.repository);
1144
+ } else ruleId = _RuleFactory.getCompiledRuleId(externalGrammar.repository.$self, helper, externalGrammar.repository);
1145
+ }
1146
+ }
1147
+ } else ruleId = _RuleFactory.getCompiledRuleId(pattern, helper, repository);
1148
+ if (ruleId !== -1) {
1149
+ const rule = helper.getRule(ruleId);
1150
+ let skipRule = false;
1151
+ if (rule instanceof IncludeOnlyRule || rule instanceof BeginEndRule || rule instanceof BeginWhileRule) {
1152
+ if (rule.hasMissingPatterns && rule.patterns.length === 0) skipRule = true;
1153
+ }
1154
+ if (skipRule) continue;
1155
+ r.push(ruleId);
1156
+ }
1157
+ }
1158
+ return {
1159
+ patterns: r,
1160
+ hasMissingPatterns: (patterns ? patterns.length : 0) !== r.length
1161
+ };
1162
+ }
1163
+ };
1164
+ var RegExpSource = class _RegExpSource {
1165
+ source;
1166
+ ruleId;
1167
+ hasAnchor;
1168
+ hasBackReferences;
1169
+ _anchorCache;
1170
+ constructor(regExpSource, ruleId) {
1171
+ if (regExpSource && typeof regExpSource === "string") {
1172
+ const len = regExpSource.length;
1173
+ let lastPushedPos = 0;
1174
+ let output = [];
1175
+ let hasAnchor = false;
1176
+ for (let pos = 0; pos < len; pos++) if (regExpSource.charAt(pos) === "\\") {
1177
+ if (pos + 1 < len) {
1178
+ const nextCh = regExpSource.charAt(pos + 1);
1179
+ if (nextCh === "z") {
1180
+ output.push(regExpSource.substring(lastPushedPos, pos));
1181
+ output.push("$(?!\\n)(?<!\\n)");
1182
+ lastPushedPos = pos + 2;
1183
+ } else if (nextCh === "A" || nextCh === "G") hasAnchor = true;
1184
+ pos++;
1185
+ }
1186
+ }
1187
+ this.hasAnchor = hasAnchor;
1188
+ if (lastPushedPos === 0) this.source = regExpSource;
1189
+ else {
1190
+ output.push(regExpSource.substring(lastPushedPos, len));
1191
+ this.source = output.join("");
1192
+ }
1193
+ } else {
1194
+ this.hasAnchor = false;
1195
+ this.source = regExpSource;
1196
+ }
1197
+ if (this.hasAnchor) this._anchorCache = this._buildAnchorCache();
1198
+ else this._anchorCache = null;
1199
+ this.ruleId = ruleId;
1200
+ if (typeof this.source === "string") this.hasBackReferences = HAS_BACK_REFERENCES.test(this.source);
1201
+ else this.hasBackReferences = false;
1202
+ }
1203
+ clone() {
1204
+ return new _RegExpSource(this.source, this.ruleId);
1205
+ }
1206
+ setSource(newSource) {
1207
+ if (this.source === newSource) return;
1208
+ this.source = newSource;
1209
+ if (this.hasAnchor) this._anchorCache = this._buildAnchorCache();
1210
+ }
1211
+ resolveBackReferences(lineText, captureIndices) {
1212
+ if (typeof this.source !== "string") throw new Error("This method should only be called if the source is a string");
1213
+ let capturedValues = captureIndices.map((capture) => {
1214
+ return lineText.substring(capture.start, capture.end);
1215
+ });
1216
+ BACK_REFERENCING_END.lastIndex = 0;
1217
+ return this.source.replace(BACK_REFERENCING_END, (match, g1) => {
1218
+ return escapeRegExpCharacters(capturedValues[parseInt(g1, 10)] || "");
1219
+ });
1220
+ }
1221
+ _buildAnchorCache() {
1222
+ if (typeof this.source !== "string") throw new Error("This method should only be called if the source is a string");
1223
+ let A0_G0_result = [];
1224
+ let A0_G1_result = [];
1225
+ let A1_G0_result = [];
1226
+ let A1_G1_result = [];
1227
+ let pos, len, ch, nextCh;
1228
+ for (pos = 0, len = this.source.length; pos < len; pos++) {
1229
+ ch = this.source.charAt(pos);
1230
+ A0_G0_result[pos] = ch;
1231
+ A0_G1_result[pos] = ch;
1232
+ A1_G0_result[pos] = ch;
1233
+ A1_G1_result[pos] = ch;
1234
+ if (ch === "\\") {
1235
+ if (pos + 1 < len) {
1236
+ nextCh = this.source.charAt(pos + 1);
1237
+ if (nextCh === "A") {
1238
+ A0_G0_result[pos + 1] = "￿";
1239
+ A0_G1_result[pos + 1] = "￿";
1240
+ A1_G0_result[pos + 1] = "A";
1241
+ A1_G1_result[pos + 1] = "A";
1242
+ } else if (nextCh === "G") {
1243
+ A0_G0_result[pos + 1] = "￿";
1244
+ A0_G1_result[pos + 1] = "G";
1245
+ A1_G0_result[pos + 1] = "￿";
1246
+ A1_G1_result[pos + 1] = "G";
1247
+ } else {
1248
+ A0_G0_result[pos + 1] = nextCh;
1249
+ A0_G1_result[pos + 1] = nextCh;
1250
+ A1_G0_result[pos + 1] = nextCh;
1251
+ A1_G1_result[pos + 1] = nextCh;
1252
+ }
1253
+ pos++;
1254
+ }
1255
+ }
1256
+ }
1257
+ return {
1258
+ A0_G0: A0_G0_result.join(""),
1259
+ A0_G1: A0_G1_result.join(""),
1260
+ A1_G0: A1_G0_result.join(""),
1261
+ A1_G1: A1_G1_result.join("")
1262
+ };
1263
+ }
1264
+ resolveAnchors(allowA, allowG) {
1265
+ if (!this.hasAnchor || !this._anchorCache || typeof this.source !== "string") return this.source;
1266
+ if (allowA) {
1267
+ if (allowG) return this._anchorCache.A1_G1;
1268
+ else return this._anchorCache.A1_G0;
1269
+ } else if (allowG) return this._anchorCache.A0_G1;
1270
+ else return this._anchorCache.A0_G0;
1271
+ }
1272
+ };
1273
+ var RegExpSourceList = class {
1274
+ _items;
1275
+ _hasAnchors;
1276
+ _cached;
1277
+ _anchorCache;
1278
+ constructor() {
1279
+ this._items = [];
1280
+ this._hasAnchors = false;
1281
+ this._cached = null;
1282
+ this._anchorCache = {
1283
+ A0_G0: null,
1284
+ A0_G1: null,
1285
+ A1_G0: null,
1286
+ A1_G1: null
1287
+ };
1288
+ }
1289
+ dispose() {
1290
+ this._disposeCaches();
1291
+ }
1292
+ _disposeCaches() {
1293
+ if (this._cached) {
1294
+ this._cached.dispose();
1295
+ this._cached = null;
1296
+ }
1297
+ if (this._anchorCache.A0_G0) {
1298
+ this._anchorCache.A0_G0.dispose();
1299
+ this._anchorCache.A0_G0 = null;
1300
+ }
1301
+ if (this._anchorCache.A0_G1) {
1302
+ this._anchorCache.A0_G1.dispose();
1303
+ this._anchorCache.A0_G1 = null;
1304
+ }
1305
+ if (this._anchorCache.A1_G0) {
1306
+ this._anchorCache.A1_G0.dispose();
1307
+ this._anchorCache.A1_G0 = null;
1308
+ }
1309
+ if (this._anchorCache.A1_G1) {
1310
+ this._anchorCache.A1_G1.dispose();
1311
+ this._anchorCache.A1_G1 = null;
1312
+ }
1313
+ }
1314
+ push(item) {
1315
+ this._items.push(item);
1316
+ this._hasAnchors = this._hasAnchors || item.hasAnchor;
1317
+ }
1318
+ unshift(item) {
1319
+ this._items.unshift(item);
1320
+ this._hasAnchors = this._hasAnchors || item.hasAnchor;
1321
+ }
1322
+ length() {
1323
+ return this._items.length;
1324
+ }
1325
+ setSource(index, newSource) {
1326
+ if (this._items[index].source !== newSource) {
1327
+ this._disposeCaches();
1328
+ this._items[index].setSource(newSource);
1329
+ }
1330
+ }
1331
+ compile(onigLib) {
1332
+ if (!this._cached) {
1333
+ let regExps = this._items.map((e) => e.source);
1334
+ this._cached = new CompiledRule(onigLib, regExps, this._items.map((e) => e.ruleId));
1335
+ }
1336
+ return this._cached;
1337
+ }
1338
+ compileAG(onigLib, allowA, allowG) {
1339
+ if (!this._hasAnchors) return this.compile(onigLib);
1340
+ else if (allowA) {
1341
+ if (allowG) {
1342
+ if (!this._anchorCache.A1_G1) this._anchorCache.A1_G1 = this._resolveAnchors(onigLib, allowA, allowG);
1343
+ return this._anchorCache.A1_G1;
1344
+ } else {
1345
+ if (!this._anchorCache.A1_G0) this._anchorCache.A1_G0 = this._resolveAnchors(onigLib, allowA, allowG);
1346
+ return this._anchorCache.A1_G0;
1347
+ }
1348
+ } else if (allowG) {
1349
+ if (!this._anchorCache.A0_G1) this._anchorCache.A0_G1 = this._resolveAnchors(onigLib, allowA, allowG);
1350
+ return this._anchorCache.A0_G1;
1351
+ } else {
1352
+ if (!this._anchorCache.A0_G0) this._anchorCache.A0_G0 = this._resolveAnchors(onigLib, allowA, allowG);
1353
+ return this._anchorCache.A0_G0;
1354
+ }
1355
+ }
1356
+ _resolveAnchors(onigLib, allowA, allowG) {
1357
+ return new CompiledRule(onigLib, this._items.map((e) => e.resolveAnchors(allowA, allowG)), this._items.map((e) => e.ruleId));
1358
+ }
1359
+ };
1360
+ var CompiledRule = class {
1361
+ constructor(onigLib, regExps, rules) {
1362
+ this.regExps = regExps;
1363
+ this.rules = rules;
1364
+ this.scanner = onigLib.createOnigScanner(regExps);
1365
+ }
1366
+ scanner;
1367
+ dispose() {
1368
+ if (typeof this.scanner.dispose === "function") this.scanner.dispose();
1369
+ }
1370
+ toString() {
1371
+ const r = [];
1372
+ for (let i = 0, len = this.rules.length; i < len; i++) r.push(" - " + this.rules[i] + ": " + this.regExps[i]);
1373
+ return r.join("\n");
1374
+ }
1375
+ findNextMatchSync(string, startPosition, options) {
1376
+ const result = this.scanner.findNextMatchSync(string, startPosition, options);
1377
+ if (!result) return null;
1378
+ return {
1379
+ ruleId: this.rules[result.index],
1380
+ captureIndices: result.captureIndices
1381
+ };
1382
+ }
1383
+ };
1384
+ var BasicScopeAttributes = class {
1385
+ constructor(languageId, tokenType) {
1386
+ this.languageId = languageId;
1387
+ this.tokenType = tokenType;
1388
+ }
1389
+ };
1390
+ var BasicScopeAttributesProvider = class _BasicScopeAttributesProvider {
1391
+ _defaultAttributes;
1392
+ _embeddedLanguagesMatcher;
1393
+ constructor(initialLanguageId, embeddedLanguages) {
1394
+ this._defaultAttributes = new BasicScopeAttributes(initialLanguageId, 8);
1395
+ this._embeddedLanguagesMatcher = new ScopeMatcher(Object.entries(embeddedLanguages || {}));
1396
+ }
1397
+ getDefaultAttributes() {
1398
+ return this._defaultAttributes;
1399
+ }
1400
+ getBasicScopeAttributes(scopeName) {
1401
+ if (scopeName === null) return _BasicScopeAttributesProvider._NULL_SCOPE_METADATA;
1402
+ return this._getBasicScopeAttributes.get(scopeName);
1403
+ }
1404
+ static _NULL_SCOPE_METADATA = new BasicScopeAttributes(0, 0);
1405
+ _getBasicScopeAttributes = new CachedFn((scopeName) => {
1406
+ return new BasicScopeAttributes(this._scopeToLanguage(scopeName), this._toStandardTokenType(scopeName));
1407
+ });
1408
+ /**
1409
+ * Given a produced TM scope, return the language that token describes or null if unknown.
1410
+ * e.g. source.html => html, source.css.embedded.html => css, punctuation.definition.tag.html => null
1411
+ */
1412
+ _scopeToLanguage(scope) {
1413
+ return this._embeddedLanguagesMatcher.match(scope) || 0;
1414
+ }
1415
+ _toStandardTokenType(scopeName) {
1416
+ const m = scopeName.match(_BasicScopeAttributesProvider.STANDARD_TOKEN_TYPE_REGEXP);
1417
+ if (!m) return 8;
1418
+ switch (m[1]) {
1419
+ case "comment": return 1;
1420
+ case "string": return 2;
1421
+ case "regex": return 3;
1422
+ case "meta.embedded": return 0;
1423
+ }
1424
+ throw new Error("Unexpected match for standard token type!");
1425
+ }
1426
+ static STANDARD_TOKEN_TYPE_REGEXP = /\b(comment|string|regex|meta\.embedded)\b/;
1427
+ };
1428
+ var ScopeMatcher = class {
1429
+ values;
1430
+ scopesRegExp;
1431
+ constructor(values) {
1432
+ if (values.length === 0) {
1433
+ this.values = null;
1434
+ this.scopesRegExp = null;
1435
+ } else {
1436
+ this.values = new Map(values);
1437
+ const escapedScopes = values.map(([scopeName, value]) => escapeRegExpCharacters(scopeName));
1438
+ escapedScopes.sort();
1439
+ escapedScopes.reverse();
1440
+ this.scopesRegExp = new RegExp(`^((${escapedScopes.join(")|(")}))($|\\.)`, "");
1441
+ }
1442
+ }
1443
+ match(scope) {
1444
+ if (!this.scopesRegExp) return;
1445
+ const m = scope.match(this.scopesRegExp);
1446
+ if (!m) return;
1447
+ return this.values.get(m[1]);
1448
+ }
1449
+ };
1450
+ typeof process !== "undefined" && process.env["VSCODE_TEXTMATE_DEBUG"];
1451
+ var UseOnigurumaFindOptions = false;
1452
+ var TokenizeStringResult = class {
1453
+ constructor(stack, stoppedEarly) {
1454
+ this.stack = stack;
1455
+ this.stoppedEarly = stoppedEarly;
1456
+ }
1457
+ };
1458
+ function _tokenizeString(grammar, lineText, isFirstLine, linePos, stack, lineTokens, checkWhileConditions, timeLimit) {
1459
+ const lineLength = lineText.content.length;
1460
+ let STOP = false;
1461
+ let anchorPosition = -1;
1462
+ if (checkWhileConditions) {
1463
+ const whileCheckResult = _checkWhileConditions(grammar, lineText, isFirstLine, linePos, stack, lineTokens);
1464
+ stack = whileCheckResult.stack;
1465
+ linePos = whileCheckResult.linePos;
1466
+ isFirstLine = whileCheckResult.isFirstLine;
1467
+ anchorPosition = whileCheckResult.anchorPosition;
1468
+ }
1469
+ const startTime = Date.now();
1470
+ while (!STOP) {
1471
+ if (timeLimit !== 0) {
1472
+ if (Date.now() - startTime > timeLimit) return new TokenizeStringResult(stack, true);
1473
+ }
1474
+ scanNext();
1475
+ }
1476
+ return new TokenizeStringResult(stack, false);
1477
+ function scanNext() {
1478
+ const r = matchRuleOrInjections(grammar, lineText, isFirstLine, linePos, stack, anchorPosition);
1479
+ if (!r) {
1480
+ lineTokens.produce(stack, lineLength);
1481
+ STOP = true;
1482
+ return;
1483
+ }
1484
+ const captureIndices = r.captureIndices;
1485
+ const matchedRuleId = r.matchedRuleId;
1486
+ const hasAdvanced = captureIndices && captureIndices.length > 0 ? captureIndices[0].end > linePos : false;
1487
+ if (matchedRuleId === endRuleId) {
1488
+ const poppedRule = stack.getRule(grammar);
1489
+ lineTokens.produce(stack, captureIndices[0].start);
1490
+ stack = stack.withContentNameScopesList(stack.nameScopesList);
1491
+ handleCaptures(grammar, lineText, isFirstLine, stack, lineTokens, poppedRule.endCaptures, captureIndices);
1492
+ lineTokens.produce(stack, captureIndices[0].end);
1493
+ const popped = stack;
1494
+ stack = stack.parent;
1495
+ anchorPosition = popped.getAnchorPos();
1496
+ if (!hasAdvanced && popped.getEnterPos() === linePos) {
1497
+ stack = popped;
1498
+ lineTokens.produce(stack, lineLength);
1499
+ STOP = true;
1500
+ return;
1501
+ }
1502
+ } else {
1503
+ const _rule = grammar.getRule(matchedRuleId);
1504
+ lineTokens.produce(stack, captureIndices[0].start);
1505
+ const beforePush = stack;
1506
+ const scopeName = _rule.getName(lineText.content, captureIndices);
1507
+ const nameScopesList = stack.contentNameScopesList.pushAttributed(scopeName, grammar);
1508
+ stack = stack.push(matchedRuleId, linePos, anchorPosition, captureIndices[0].end === lineLength, null, nameScopesList, nameScopesList);
1509
+ if (_rule instanceof BeginEndRule) {
1510
+ const pushedRule = _rule;
1511
+ handleCaptures(grammar, lineText, isFirstLine, stack, lineTokens, pushedRule.beginCaptures, captureIndices);
1512
+ lineTokens.produce(stack, captureIndices[0].end);
1513
+ anchorPosition = captureIndices[0].end;
1514
+ const contentName = pushedRule.getContentName(lineText.content, captureIndices);
1515
+ const contentNameScopesList = nameScopesList.pushAttributed(contentName, grammar);
1516
+ stack = stack.withContentNameScopesList(contentNameScopesList);
1517
+ if (pushedRule.endHasBackReferences) stack = stack.withEndRule(pushedRule.getEndWithResolvedBackReferences(lineText.content, captureIndices));
1518
+ if (!hasAdvanced && beforePush.hasSameRuleAs(stack)) {
1519
+ stack = stack.pop();
1520
+ lineTokens.produce(stack, lineLength);
1521
+ STOP = true;
1522
+ return;
1523
+ }
1524
+ } else if (_rule instanceof BeginWhileRule) {
1525
+ const pushedRule = _rule;
1526
+ handleCaptures(grammar, lineText, isFirstLine, stack, lineTokens, pushedRule.beginCaptures, captureIndices);
1527
+ lineTokens.produce(stack, captureIndices[0].end);
1528
+ anchorPosition = captureIndices[0].end;
1529
+ const contentName = pushedRule.getContentName(lineText.content, captureIndices);
1530
+ const contentNameScopesList = nameScopesList.pushAttributed(contentName, grammar);
1531
+ stack = stack.withContentNameScopesList(contentNameScopesList);
1532
+ if (pushedRule.whileHasBackReferences) stack = stack.withEndRule(pushedRule.getWhileWithResolvedBackReferences(lineText.content, captureIndices));
1533
+ if (!hasAdvanced && beforePush.hasSameRuleAs(stack)) {
1534
+ stack = stack.pop();
1535
+ lineTokens.produce(stack, lineLength);
1536
+ STOP = true;
1537
+ return;
1538
+ }
1539
+ } else {
1540
+ handleCaptures(grammar, lineText, isFirstLine, stack, lineTokens, _rule.captures, captureIndices);
1541
+ lineTokens.produce(stack, captureIndices[0].end);
1542
+ stack = stack.pop();
1543
+ if (!hasAdvanced) {
1544
+ stack = stack.safePop();
1545
+ lineTokens.produce(stack, lineLength);
1546
+ STOP = true;
1547
+ return;
1548
+ }
1549
+ }
1550
+ }
1551
+ if (captureIndices[0].end > linePos) {
1552
+ linePos = captureIndices[0].end;
1553
+ isFirstLine = false;
1554
+ }
1555
+ }
1556
+ }
1557
+ function _checkWhileConditions(grammar, lineText, isFirstLine, linePos, stack, lineTokens) {
1558
+ let anchorPosition = stack.beginRuleCapturedEOL ? 0 : -1;
1559
+ const whileRules = [];
1560
+ for (let node = stack; node; node = node.pop()) {
1561
+ const nodeRule = node.getRule(grammar);
1562
+ if (nodeRule instanceof BeginWhileRule) whileRules.push({
1563
+ rule: nodeRule,
1564
+ stack: node
1565
+ });
1566
+ }
1567
+ for (let whileRule = whileRules.pop(); whileRule; whileRule = whileRules.pop()) {
1568
+ const { ruleScanner, findOptions } = prepareRuleWhileSearch(whileRule.rule, grammar, whileRule.stack.endRule, isFirstLine, linePos === anchorPosition);
1569
+ const r = ruleScanner.findNextMatchSync(lineText, linePos, findOptions);
1570
+ if (r) {
1571
+ if (r.ruleId !== whileRuleId) {
1572
+ stack = whileRule.stack.pop();
1573
+ break;
1574
+ }
1575
+ if (r.captureIndices && r.captureIndices.length) {
1576
+ lineTokens.produce(whileRule.stack, r.captureIndices[0].start);
1577
+ handleCaptures(grammar, lineText, isFirstLine, whileRule.stack, lineTokens, whileRule.rule.whileCaptures, r.captureIndices);
1578
+ lineTokens.produce(whileRule.stack, r.captureIndices[0].end);
1579
+ anchorPosition = r.captureIndices[0].end;
1580
+ if (r.captureIndices[0].end > linePos) {
1581
+ linePos = r.captureIndices[0].end;
1582
+ isFirstLine = false;
1583
+ }
1584
+ }
1585
+ } else {
1586
+ stack = whileRule.stack.pop();
1587
+ break;
1588
+ }
1589
+ }
1590
+ return {
1591
+ stack,
1592
+ linePos,
1593
+ anchorPosition,
1594
+ isFirstLine
1595
+ };
1596
+ }
1597
+ function matchRuleOrInjections(grammar, lineText, isFirstLine, linePos, stack, anchorPosition) {
1598
+ const matchResult = matchRule(grammar, lineText, isFirstLine, linePos, stack, anchorPosition);
1599
+ const injections = grammar.getInjections();
1600
+ if (injections.length === 0) return matchResult;
1601
+ const injectionResult = matchInjections(injections, grammar, lineText, isFirstLine, linePos, stack, anchorPosition);
1602
+ if (!injectionResult) return matchResult;
1603
+ if (!matchResult) return injectionResult;
1604
+ const matchResultScore = matchResult.captureIndices[0].start;
1605
+ const injectionResultScore = injectionResult.captureIndices[0].start;
1606
+ if (injectionResultScore < matchResultScore || injectionResult.priorityMatch && injectionResultScore === matchResultScore) return injectionResult;
1607
+ return matchResult;
1608
+ }
1609
+ function matchRule(grammar, lineText, isFirstLine, linePos, stack, anchorPosition) {
1610
+ const { ruleScanner, findOptions } = prepareRuleSearch(stack.getRule(grammar), grammar, stack.endRule, isFirstLine, linePos === anchorPosition);
1611
+ const r = ruleScanner.findNextMatchSync(lineText, linePos, findOptions);
1612
+ if (r) return {
1613
+ captureIndices: r.captureIndices,
1614
+ matchedRuleId: r.ruleId
1615
+ };
1616
+ return null;
1617
+ }
1618
+ function matchInjections(injections, grammar, lineText, isFirstLine, linePos, stack, anchorPosition) {
1619
+ let bestMatchRating = Number.MAX_VALUE;
1620
+ let bestMatchCaptureIndices = null;
1621
+ let bestMatchRuleId;
1622
+ let bestMatchResultPriority = 0;
1623
+ const scopes = stack.contentNameScopesList.getScopeNames();
1624
+ for (let i = 0, len = injections.length; i < len; i++) {
1625
+ const injection = injections[i];
1626
+ if (!injection.matcher(scopes)) continue;
1627
+ const { ruleScanner, findOptions } = prepareRuleSearch(grammar.getRule(injection.ruleId), grammar, null, isFirstLine, linePos === anchorPosition);
1628
+ const matchResult = ruleScanner.findNextMatchSync(lineText, linePos, findOptions);
1629
+ if (!matchResult) continue;
1630
+ const matchRating = matchResult.captureIndices[0].start;
1631
+ if (matchRating >= bestMatchRating) continue;
1632
+ bestMatchRating = matchRating;
1633
+ bestMatchCaptureIndices = matchResult.captureIndices;
1634
+ bestMatchRuleId = matchResult.ruleId;
1635
+ bestMatchResultPriority = injection.priority;
1636
+ if (bestMatchRating === linePos) break;
1637
+ }
1638
+ if (bestMatchCaptureIndices) return {
1639
+ priorityMatch: bestMatchResultPriority === -1,
1640
+ captureIndices: bestMatchCaptureIndices,
1641
+ matchedRuleId: bestMatchRuleId
1642
+ };
1643
+ return null;
1644
+ }
1645
+ function prepareRuleSearch(rule, grammar, endRegexSource, allowA, allowG) {
1646
+ if (UseOnigurumaFindOptions) return {
1647
+ ruleScanner: rule.compile(grammar, endRegexSource),
1648
+ findOptions: getFindOptions(allowA, allowG)
1649
+ };
1650
+ return {
1651
+ ruleScanner: rule.compileAG(grammar, endRegexSource, allowA, allowG),
1652
+ findOptions: 0
1653
+ };
1654
+ }
1655
+ function prepareRuleWhileSearch(rule, grammar, endRegexSource, allowA, allowG) {
1656
+ if (UseOnigurumaFindOptions) return {
1657
+ ruleScanner: rule.compileWhile(grammar, endRegexSource),
1658
+ findOptions: getFindOptions(allowA, allowG)
1659
+ };
1660
+ return {
1661
+ ruleScanner: rule.compileWhileAG(grammar, endRegexSource, allowA, allowG),
1662
+ findOptions: 0
1663
+ };
1664
+ }
1665
+ function getFindOptions(allowA, allowG) {
1666
+ let options = 0;
1667
+ if (!allowA) options |= 1;
1668
+ if (!allowG) options |= 4;
1669
+ return options;
1670
+ }
1671
+ function handleCaptures(grammar, lineText, isFirstLine, stack, lineTokens, captures, captureIndices) {
1672
+ if (captures.length === 0) return;
1673
+ const lineTextContent = lineText.content;
1674
+ const len = Math.min(captures.length, captureIndices.length);
1675
+ const localStack = [];
1676
+ const maxEnd = captureIndices[0].end;
1677
+ for (let i = 0; i < len; i++) {
1678
+ const captureRule = captures[i];
1679
+ if (captureRule === null) continue;
1680
+ const captureIndex = captureIndices[i];
1681
+ if (captureIndex.length === 0) continue;
1682
+ if (captureIndex.start > maxEnd) break;
1683
+ while (localStack.length > 0 && localStack[localStack.length - 1].endPos <= captureIndex.start) {
1684
+ lineTokens.produceFromScopes(localStack[localStack.length - 1].scopes, localStack[localStack.length - 1].endPos);
1685
+ localStack.pop();
1686
+ }
1687
+ if (localStack.length > 0) lineTokens.produceFromScopes(localStack[localStack.length - 1].scopes, captureIndex.start);
1688
+ else lineTokens.produce(stack, captureIndex.start);
1689
+ if (captureRule.retokenizeCapturedWithRuleId) {
1690
+ const scopeName = captureRule.getName(lineTextContent, captureIndices);
1691
+ const nameScopesList = stack.contentNameScopesList.pushAttributed(scopeName, grammar);
1692
+ const contentName = captureRule.getContentName(lineTextContent, captureIndices);
1693
+ const contentNameScopesList = nameScopesList.pushAttributed(contentName, grammar);
1694
+ const stackClone = stack.push(captureRule.retokenizeCapturedWithRuleId, captureIndex.start, -1, false, null, nameScopesList, contentNameScopesList);
1695
+ const onigSubStr = grammar.createOnigString(lineTextContent.substring(0, captureIndex.end));
1696
+ _tokenizeString(grammar, onigSubStr, isFirstLine && captureIndex.start === 0, captureIndex.start, stackClone, lineTokens, false, 0);
1697
+ disposeOnigString(onigSubStr);
1698
+ continue;
1699
+ }
1700
+ const captureRuleScopeName = captureRule.getName(lineTextContent, captureIndices);
1701
+ if (captureRuleScopeName !== null) {
1702
+ const captureRuleScopesList = (localStack.length > 0 ? localStack[localStack.length - 1].scopes : stack.contentNameScopesList).pushAttributed(captureRuleScopeName, grammar);
1703
+ localStack.push(new LocalStackElement(captureRuleScopesList, captureIndex.end));
1704
+ }
1705
+ }
1706
+ while (localStack.length > 0) {
1707
+ lineTokens.produceFromScopes(localStack[localStack.length - 1].scopes, localStack[localStack.length - 1].endPos);
1708
+ localStack.pop();
1709
+ }
1710
+ }
1711
+ var LocalStackElement = class {
1712
+ scopes;
1713
+ endPos;
1714
+ constructor(scopes, endPos) {
1715
+ this.scopes = scopes;
1716
+ this.endPos = endPos;
1717
+ }
1718
+ };
1719
+ function createGrammar(scopeName, grammar, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors, grammarRepository, onigLib) {
1720
+ return new Grammar(scopeName, grammar, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors, grammarRepository, onigLib);
1721
+ }
1722
+ function collectInjections(result, selector, rule, ruleFactoryHelper, grammar) {
1723
+ const matchers = createMatchers(selector, nameMatcher);
1724
+ const ruleId = RuleFactory.getCompiledRuleId(rule, ruleFactoryHelper, grammar.repository);
1725
+ for (const matcher of matchers) result.push({
1726
+ debugSelector: selector,
1727
+ matcher: matcher.matcher,
1728
+ ruleId,
1729
+ grammar,
1730
+ priority: matcher.priority
1731
+ });
1732
+ }
1733
+ function nameMatcher(identifers, scopes) {
1734
+ if (scopes.length < identifers.length) return false;
1735
+ let lastIndex = 0;
1736
+ return identifers.every((identifier) => {
1737
+ for (let i = lastIndex; i < scopes.length; i++) if (scopesAreMatching(scopes[i], identifier)) {
1738
+ lastIndex = i + 1;
1739
+ return true;
1740
+ }
1741
+ return false;
1742
+ });
1743
+ }
1744
+ function scopesAreMatching(thisScopeName, scopeName) {
1745
+ if (!thisScopeName) return false;
1746
+ if (thisScopeName === scopeName) return true;
1747
+ const len = scopeName.length;
1748
+ return thisScopeName.length > len && thisScopeName.substr(0, len) === scopeName && thisScopeName[len] === ".";
1749
+ }
1750
+ var Grammar = class {
1751
+ constructor(_rootScopeName, grammar, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors, grammarRepository, _onigLib) {
1752
+ this._rootScopeName = _rootScopeName;
1753
+ this.balancedBracketSelectors = balancedBracketSelectors;
1754
+ this._onigLib = _onigLib;
1755
+ this._basicScopeAttributesProvider = new BasicScopeAttributesProvider(initialLanguage, embeddedLanguages);
1756
+ this._rootId = -1;
1757
+ this._lastRuleId = 0;
1758
+ this._ruleId2desc = [null];
1759
+ this._includedGrammars = {};
1760
+ this._grammarRepository = grammarRepository;
1761
+ this._grammar = initGrammar(grammar, null);
1762
+ this._injections = null;
1763
+ this._tokenTypeMatchers = [];
1764
+ if (tokenTypes) for (const selector of Object.keys(tokenTypes)) {
1765
+ const matchers = createMatchers(selector, nameMatcher);
1766
+ for (const matcher of matchers) this._tokenTypeMatchers.push({
1767
+ matcher: matcher.matcher,
1768
+ type: tokenTypes[selector]
1769
+ });
1770
+ }
1771
+ }
1772
+ _rootId;
1773
+ _lastRuleId;
1774
+ _ruleId2desc;
1775
+ _includedGrammars;
1776
+ _grammarRepository;
1777
+ _grammar;
1778
+ _injections;
1779
+ _basicScopeAttributesProvider;
1780
+ _tokenTypeMatchers;
1781
+ get themeProvider() {
1782
+ return this._grammarRepository;
1783
+ }
1784
+ dispose() {
1785
+ for (const rule of this._ruleId2desc) if (rule) rule.dispose();
1786
+ }
1787
+ createOnigScanner(sources) {
1788
+ return this._onigLib.createOnigScanner(sources);
1789
+ }
1790
+ createOnigString(sources) {
1791
+ return this._onigLib.createOnigString(sources);
1792
+ }
1793
+ getMetadataForScope(scope) {
1794
+ return this._basicScopeAttributesProvider.getBasicScopeAttributes(scope);
1795
+ }
1796
+ _collectInjections() {
1797
+ const grammarRepository = {
1798
+ lookup: (scopeName2) => {
1799
+ if (scopeName2 === this._rootScopeName) return this._grammar;
1800
+ return this.getExternalGrammar(scopeName2);
1801
+ },
1802
+ injections: (scopeName2) => {
1803
+ return this._grammarRepository.injections(scopeName2);
1804
+ }
1805
+ };
1806
+ const result = [];
1807
+ const scopeName = this._rootScopeName;
1808
+ const grammar = grammarRepository.lookup(scopeName);
1809
+ if (grammar) {
1810
+ const rawInjections = grammar.injections;
1811
+ if (rawInjections) for (let expression in rawInjections) collectInjections(result, expression, rawInjections[expression], this, grammar);
1812
+ const injectionScopeNames = this._grammarRepository.injections(scopeName);
1813
+ if (injectionScopeNames) injectionScopeNames.forEach((injectionScopeName) => {
1814
+ const injectionGrammar = this.getExternalGrammar(injectionScopeName);
1815
+ if (injectionGrammar) {
1816
+ const selector = injectionGrammar.injectionSelector;
1817
+ if (selector) collectInjections(result, selector, injectionGrammar, this, injectionGrammar);
1818
+ }
1819
+ });
1820
+ }
1821
+ result.sort((i1, i2) => i1.priority - i2.priority);
1822
+ return result;
1823
+ }
1824
+ getInjections() {
1825
+ if (this._injections === null) this._injections = this._collectInjections();
1826
+ return this._injections;
1827
+ }
1828
+ registerRule(factory) {
1829
+ const id = ++this._lastRuleId;
1830
+ const result = factory(ruleIdFromNumber(id));
1831
+ this._ruleId2desc[id] = result;
1832
+ return result;
1833
+ }
1834
+ getRule(ruleId) {
1835
+ return this._ruleId2desc[ruleIdToNumber(ruleId)];
1836
+ }
1837
+ getExternalGrammar(scopeName, repository) {
1838
+ if (this._includedGrammars[scopeName]) return this._includedGrammars[scopeName];
1839
+ else if (this._grammarRepository) {
1840
+ const rawIncludedGrammar = this._grammarRepository.lookup(scopeName);
1841
+ if (rawIncludedGrammar) {
1842
+ this._includedGrammars[scopeName] = initGrammar(rawIncludedGrammar, repository && repository.$base);
1843
+ return this._includedGrammars[scopeName];
1844
+ }
1845
+ }
1846
+ }
1847
+ tokenizeLine(lineText, prevState, timeLimit = 0) {
1848
+ const r = this._tokenize(lineText, prevState, false, timeLimit);
1849
+ return {
1850
+ tokens: r.lineTokens.getResult(r.ruleStack, r.lineLength),
1851
+ ruleStack: r.ruleStack,
1852
+ stoppedEarly: r.stoppedEarly
1853
+ };
1854
+ }
1855
+ tokenizeLine2(lineText, prevState, timeLimit = 0) {
1856
+ const r = this._tokenize(lineText, prevState, true, timeLimit);
1857
+ return {
1858
+ tokens: r.lineTokens.getBinaryResult(r.ruleStack, r.lineLength),
1859
+ ruleStack: r.ruleStack,
1860
+ stoppedEarly: r.stoppedEarly
1861
+ };
1862
+ }
1863
+ _tokenize(lineText, prevState, emitBinaryTokens, timeLimit) {
1864
+ if (this._rootId === -1) {
1865
+ this._rootId = RuleFactory.getCompiledRuleId(this._grammar.repository.$self, this, this._grammar.repository);
1866
+ this.getInjections();
1867
+ }
1868
+ let isFirstLine;
1869
+ if (!prevState || prevState === StateStackImpl.NULL) {
1870
+ isFirstLine = true;
1871
+ const rawDefaultMetadata = this._basicScopeAttributesProvider.getDefaultAttributes();
1872
+ const defaultStyle = this.themeProvider.getDefaults();
1873
+ const defaultMetadata = EncodedTokenMetadata.set(0, rawDefaultMetadata.languageId, rawDefaultMetadata.tokenType, null, defaultStyle.fontStyle, defaultStyle.foregroundId, defaultStyle.backgroundId);
1874
+ const rootScopeName = this.getRule(this._rootId).getName(null, null);
1875
+ let scopeList;
1876
+ if (rootScopeName) scopeList = AttributedScopeStack.createRootAndLookUpScopeName(rootScopeName, defaultMetadata, this);
1877
+ else scopeList = AttributedScopeStack.createRoot("unknown", defaultMetadata);
1878
+ prevState = new StateStackImpl(null, this._rootId, -1, -1, false, null, scopeList, scopeList);
1879
+ } else {
1880
+ isFirstLine = false;
1881
+ prevState.reset();
1882
+ }
1883
+ lineText = lineText + "\n";
1884
+ const onigLineText = this.createOnigString(lineText);
1885
+ const lineLength = onigLineText.content.length;
1886
+ const lineTokens = new LineTokens(emitBinaryTokens, lineText, this._tokenTypeMatchers, this.balancedBracketSelectors);
1887
+ const r = _tokenizeString(this, onigLineText, isFirstLine, 0, prevState, lineTokens, true, timeLimit);
1888
+ disposeOnigString(onigLineText);
1889
+ return {
1890
+ lineLength,
1891
+ lineTokens,
1892
+ ruleStack: r.stack,
1893
+ stoppedEarly: r.stoppedEarly
1894
+ };
1895
+ }
1896
+ };
1897
+ function initGrammar(grammar, base) {
1898
+ grammar = clone(grammar);
1899
+ grammar.repository = grammar.repository || {};
1900
+ grammar.repository.$self = {
1901
+ $vscodeTextmateLocation: grammar.$vscodeTextmateLocation,
1902
+ patterns: grammar.patterns,
1903
+ name: grammar.scopeName
1904
+ };
1905
+ grammar.repository.$base = base || grammar.repository.$self;
1906
+ return grammar;
1907
+ }
1908
+ var AttributedScopeStack = class _AttributedScopeStack {
1909
+ /**
1910
+ * Invariant:
1911
+ * ```
1912
+ * if (parent && !scopePath.extends(parent.scopePath)) {
1913
+ * throw new Error();
1914
+ * }
1915
+ * ```
1916
+ */
1917
+ constructor(parent, scopePath, tokenAttributes) {
1918
+ this.parent = parent;
1919
+ this.scopePath = scopePath;
1920
+ this.tokenAttributes = tokenAttributes;
1921
+ }
1922
+ static fromExtension(namesScopeList, contentNameScopesList) {
1923
+ let current = namesScopeList;
1924
+ let scopeNames = namesScopeList?.scopePath ?? null;
1925
+ for (const frame of contentNameScopesList) {
1926
+ scopeNames = ScopeStack.push(scopeNames, frame.scopeNames);
1927
+ current = new _AttributedScopeStack(current, scopeNames, frame.encodedTokenAttributes);
1928
+ }
1929
+ return current;
1930
+ }
1931
+ static createRoot(scopeName, tokenAttributes) {
1932
+ return new _AttributedScopeStack(null, new ScopeStack(null, scopeName), tokenAttributes);
1933
+ }
1934
+ static createRootAndLookUpScopeName(scopeName, tokenAttributes, grammar) {
1935
+ const rawRootMetadata = grammar.getMetadataForScope(scopeName);
1936
+ const scopePath = new ScopeStack(null, scopeName);
1937
+ const rootStyle = grammar.themeProvider.themeMatch(scopePath);
1938
+ const resolvedTokenAttributes = _AttributedScopeStack.mergeAttributes(tokenAttributes, rawRootMetadata, rootStyle);
1939
+ return new _AttributedScopeStack(null, scopePath, resolvedTokenAttributes);
1940
+ }
1941
+ get scopeName() {
1942
+ return this.scopePath.scopeName;
1943
+ }
1944
+ toString() {
1945
+ return this.getScopeNames().join(" ");
1946
+ }
1947
+ equals(other) {
1948
+ return _AttributedScopeStack.equals(this, other);
1949
+ }
1950
+ static equals(a, b) {
1951
+ do {
1952
+ if (a === b) return true;
1953
+ if (!a && !b) return true;
1954
+ if (!a || !b) return false;
1955
+ if (a.scopeName !== b.scopeName || a.tokenAttributes !== b.tokenAttributes) return false;
1956
+ a = a.parent;
1957
+ b = b.parent;
1958
+ } while (true);
1959
+ }
1960
+ static mergeAttributes(existingTokenAttributes, basicScopeAttributes, styleAttributes) {
1961
+ let fontStyle = -1;
1962
+ let foreground = 0;
1963
+ let background = 0;
1964
+ if (styleAttributes !== null) {
1965
+ fontStyle = styleAttributes.fontStyle;
1966
+ foreground = styleAttributes.foregroundId;
1967
+ background = styleAttributes.backgroundId;
1968
+ }
1969
+ return EncodedTokenMetadata.set(existingTokenAttributes, basicScopeAttributes.languageId, basicScopeAttributes.tokenType, null, fontStyle, foreground, background);
1970
+ }
1971
+ pushAttributed(scopePath, grammar) {
1972
+ if (scopePath === null) return this;
1973
+ if (scopePath.indexOf(" ") === -1) return _AttributedScopeStack._pushAttributed(this, scopePath, grammar);
1974
+ const scopes = scopePath.split(/ /g);
1975
+ let result = this;
1976
+ for (const scope of scopes) result = _AttributedScopeStack._pushAttributed(result, scope, grammar);
1977
+ return result;
1978
+ }
1979
+ static _pushAttributed(target, scopeName, grammar) {
1980
+ const rawMetadata = grammar.getMetadataForScope(scopeName);
1981
+ const newPath = target.scopePath.push(scopeName);
1982
+ const scopeThemeMatchResult = grammar.themeProvider.themeMatch(newPath);
1983
+ const metadata = _AttributedScopeStack.mergeAttributes(target.tokenAttributes, rawMetadata, scopeThemeMatchResult);
1984
+ return new _AttributedScopeStack(target, newPath, metadata);
1985
+ }
1986
+ getScopeNames() {
1987
+ return this.scopePath.getSegments();
1988
+ }
1989
+ getExtensionIfDefined(base) {
1990
+ const result = [];
1991
+ let self = this;
1992
+ while (self && self !== base) {
1993
+ result.push({
1994
+ encodedTokenAttributes: self.tokenAttributes,
1995
+ scopeNames: self.scopePath.getExtensionIfDefined(self.parent?.scopePath ?? null)
1996
+ });
1997
+ self = self.parent;
1998
+ }
1999
+ return self === base ? result.reverse() : void 0;
2000
+ }
2001
+ };
2002
+ var StateStackImpl = class _StateStackImpl {
2003
+ /**
2004
+ * Invariant:
2005
+ * ```
2006
+ * if (contentNameScopesList !== nameScopesList && contentNameScopesList?.parent !== nameScopesList) {
2007
+ * throw new Error();
2008
+ * }
2009
+ * if (this.parent && !nameScopesList.extends(this.parent.contentNameScopesList)) {
2010
+ * throw new Error();
2011
+ * }
2012
+ * ```
2013
+ */
2014
+ constructor(parent, ruleId, enterPos, anchorPos, beginRuleCapturedEOL, endRule, nameScopesList, contentNameScopesList) {
2015
+ this.parent = parent;
2016
+ this.ruleId = ruleId;
2017
+ this.beginRuleCapturedEOL = beginRuleCapturedEOL;
2018
+ this.endRule = endRule;
2019
+ this.nameScopesList = nameScopesList;
2020
+ this.contentNameScopesList = contentNameScopesList;
2021
+ this.depth = this.parent ? this.parent.depth + 1 : 1;
2022
+ this._enterPos = enterPos;
2023
+ this._anchorPos = anchorPos;
2024
+ }
2025
+ _stackElementBrand = void 0;
2026
+ static NULL = new _StateStackImpl(null, 0, 0, 0, false, null, null, null);
2027
+ /**
2028
+ * The position on the current line where this state was pushed.
2029
+ * This is relevant only while tokenizing a line, to detect endless loops.
2030
+ * Its value is meaningless across lines.
2031
+ */
2032
+ _enterPos;
2033
+ /**
2034
+ * The captured anchor position when this stack element was pushed.
2035
+ * This is relevant only while tokenizing a line, to restore the anchor position when popping.
2036
+ * Its value is meaningless across lines.
2037
+ */
2038
+ _anchorPos;
2039
+ /**
2040
+ * The depth of the stack.
2041
+ */
2042
+ depth;
2043
+ equals(other) {
2044
+ if (other === null) return false;
2045
+ return _StateStackImpl._equals(this, other);
2046
+ }
2047
+ static _equals(a, b) {
2048
+ if (a === b) return true;
2049
+ if (!this._structuralEquals(a, b)) return false;
2050
+ return AttributedScopeStack.equals(a.contentNameScopesList, b.contentNameScopesList);
2051
+ }
2052
+ /**
2053
+ * A structural equals check. Does not take into account `scopes`.
2054
+ */
2055
+ static _structuralEquals(a, b) {
2056
+ do {
2057
+ if (a === b) return true;
2058
+ if (!a && !b) return true;
2059
+ if (!a || !b) return false;
2060
+ if (a.depth !== b.depth || a.ruleId !== b.ruleId || a.endRule !== b.endRule) return false;
2061
+ a = a.parent;
2062
+ b = b.parent;
2063
+ } while (true);
2064
+ }
2065
+ clone() {
2066
+ return this;
2067
+ }
2068
+ static _reset(el) {
2069
+ while (el) {
2070
+ el._enterPos = -1;
2071
+ el._anchorPos = -1;
2072
+ el = el.parent;
2073
+ }
2074
+ }
2075
+ reset() {
2076
+ _StateStackImpl._reset(this);
2077
+ }
2078
+ pop() {
2079
+ return this.parent;
2080
+ }
2081
+ safePop() {
2082
+ if (this.parent) return this.parent;
2083
+ return this;
2084
+ }
2085
+ push(ruleId, enterPos, anchorPos, beginRuleCapturedEOL, endRule, nameScopesList, contentNameScopesList) {
2086
+ return new _StateStackImpl(this, ruleId, enterPos, anchorPos, beginRuleCapturedEOL, endRule, nameScopesList, contentNameScopesList);
2087
+ }
2088
+ getEnterPos() {
2089
+ return this._enterPos;
2090
+ }
2091
+ getAnchorPos() {
2092
+ return this._anchorPos;
2093
+ }
2094
+ getRule(grammar) {
2095
+ return grammar.getRule(this.ruleId);
2096
+ }
2097
+ toString() {
2098
+ const r = [];
2099
+ this._writeString(r, 0);
2100
+ return "[" + r.join(",") + "]";
2101
+ }
2102
+ _writeString(res, outIndex) {
2103
+ if (this.parent) outIndex = this.parent._writeString(res, outIndex);
2104
+ res[outIndex++] = `(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`;
2105
+ return outIndex;
2106
+ }
2107
+ withContentNameScopesList(contentNameScopeStack) {
2108
+ if (this.contentNameScopesList === contentNameScopeStack) return this;
2109
+ return this.parent.push(this.ruleId, this._enterPos, this._anchorPos, this.beginRuleCapturedEOL, this.endRule, this.nameScopesList, contentNameScopeStack);
2110
+ }
2111
+ withEndRule(endRule) {
2112
+ if (this.endRule === endRule) return this;
2113
+ return new _StateStackImpl(this.parent, this.ruleId, this._enterPos, this._anchorPos, this.beginRuleCapturedEOL, endRule, this.nameScopesList, this.contentNameScopesList);
2114
+ }
2115
+ hasSameRuleAs(other) {
2116
+ let el = this;
2117
+ while (el && el._enterPos === other._enterPos) {
2118
+ if (el.ruleId === other.ruleId) return true;
2119
+ el = el.parent;
2120
+ }
2121
+ return false;
2122
+ }
2123
+ toStateStackFrame() {
2124
+ return {
2125
+ ruleId: ruleIdToNumber(this.ruleId),
2126
+ beginRuleCapturedEOL: this.beginRuleCapturedEOL,
2127
+ endRule: this.endRule,
2128
+ nameScopesList: this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList ?? null) ?? [],
2129
+ contentNameScopesList: this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList) ?? []
2130
+ };
2131
+ }
2132
+ static pushFrame(self, frame) {
2133
+ const namesScopeList = AttributedScopeStack.fromExtension(self?.nameScopesList ?? null, frame.nameScopesList);
2134
+ return new _StateStackImpl(self, ruleIdFromNumber(frame.ruleId), frame.enterPos ?? -1, frame.anchorPos ?? -1, frame.beginRuleCapturedEOL, frame.endRule, namesScopeList, AttributedScopeStack.fromExtension(namesScopeList, frame.contentNameScopesList));
2135
+ }
2136
+ };
2137
+ var BalancedBracketSelectors = class {
2138
+ balancedBracketScopes;
2139
+ unbalancedBracketScopes;
2140
+ allowAny = false;
2141
+ constructor(balancedBracketScopes, unbalancedBracketScopes) {
2142
+ this.balancedBracketScopes = balancedBracketScopes.flatMap((selector) => {
2143
+ if (selector === "*") {
2144
+ this.allowAny = true;
2145
+ return [];
2146
+ }
2147
+ return createMatchers(selector, nameMatcher).map((m) => m.matcher);
2148
+ });
2149
+ this.unbalancedBracketScopes = unbalancedBracketScopes.flatMap((selector) => createMatchers(selector, nameMatcher).map((m) => m.matcher));
2150
+ }
2151
+ get matchesAlways() {
2152
+ return this.allowAny && this.unbalancedBracketScopes.length === 0;
2153
+ }
2154
+ get matchesNever() {
2155
+ return this.balancedBracketScopes.length === 0 && !this.allowAny;
2156
+ }
2157
+ match(scopes) {
2158
+ for (const excluder of this.unbalancedBracketScopes) if (excluder(scopes)) return false;
2159
+ for (const includer of this.balancedBracketScopes) if (includer(scopes)) return true;
2160
+ return this.allowAny;
2161
+ }
2162
+ };
2163
+ var LineTokens = class {
2164
+ constructor(emitBinaryTokens, lineText, tokenTypeOverrides, balancedBracketSelectors) {
2165
+ this.balancedBracketSelectors = balancedBracketSelectors;
2166
+ this._emitBinaryTokens = emitBinaryTokens;
2167
+ this._tokenTypeOverrides = tokenTypeOverrides;
2168
+ this._lineText = null;
2169
+ this._tokens = [];
2170
+ this._binaryTokens = [];
2171
+ this._lastTokenEndIndex = 0;
2172
+ }
2173
+ _emitBinaryTokens;
2174
+ /**
2175
+ * defined only if `false`.
2176
+ */
2177
+ _lineText;
2178
+ /**
2179
+ * used only if `_emitBinaryTokens` is false.
2180
+ */
2181
+ _tokens;
2182
+ /**
2183
+ * used only if `_emitBinaryTokens` is true.
2184
+ */
2185
+ _binaryTokens;
2186
+ _lastTokenEndIndex;
2187
+ _tokenTypeOverrides;
2188
+ produce(stack, endIndex) {
2189
+ this.produceFromScopes(stack.contentNameScopesList, endIndex);
2190
+ }
2191
+ produceFromScopes(scopesList, endIndex) {
2192
+ if (this._lastTokenEndIndex >= endIndex) return;
2193
+ if (this._emitBinaryTokens) {
2194
+ let metadata = scopesList?.tokenAttributes ?? 0;
2195
+ let containsBalancedBrackets = false;
2196
+ if (this.balancedBracketSelectors?.matchesAlways) containsBalancedBrackets = true;
2197
+ if (this._tokenTypeOverrides.length > 0 || this.balancedBracketSelectors && !this.balancedBracketSelectors.matchesAlways && !this.balancedBracketSelectors.matchesNever) {
2198
+ const scopes2 = scopesList?.getScopeNames() ?? [];
2199
+ for (const tokenType of this._tokenTypeOverrides) if (tokenType.matcher(scopes2)) metadata = EncodedTokenMetadata.set(metadata, 0, toOptionalTokenType(tokenType.type), null, -1, 0, 0);
2200
+ if (this.balancedBracketSelectors) containsBalancedBrackets = this.balancedBracketSelectors.match(scopes2);
2201
+ }
2202
+ if (containsBalancedBrackets) metadata = EncodedTokenMetadata.set(metadata, 0, 8, containsBalancedBrackets, -1, 0, 0);
2203
+ if (this._binaryTokens.length > 0 && this._binaryTokens[this._binaryTokens.length - 1] === metadata) {
2204
+ this._lastTokenEndIndex = endIndex;
2205
+ return;
2206
+ }
2207
+ this._binaryTokens.push(this._lastTokenEndIndex);
2208
+ this._binaryTokens.push(metadata);
2209
+ this._lastTokenEndIndex = endIndex;
2210
+ return;
2211
+ }
2212
+ const scopes = scopesList?.getScopeNames() ?? [];
2213
+ this._tokens.push({
2214
+ startIndex: this._lastTokenEndIndex,
2215
+ endIndex,
2216
+ scopes
2217
+ });
2218
+ this._lastTokenEndIndex = endIndex;
2219
+ }
2220
+ getResult(stack, lineLength) {
2221
+ if (this._tokens.length > 0 && this._tokens[this._tokens.length - 1].startIndex === lineLength - 1) this._tokens.pop();
2222
+ if (this._tokens.length === 0) {
2223
+ this._lastTokenEndIndex = -1;
2224
+ this.produce(stack, lineLength);
2225
+ this._tokens[this._tokens.length - 1].startIndex = 0;
2226
+ }
2227
+ return this._tokens;
2228
+ }
2229
+ getBinaryResult(stack, lineLength) {
2230
+ if (this._binaryTokens.length > 0 && this._binaryTokens[this._binaryTokens.length - 2] === lineLength - 1) {
2231
+ this._binaryTokens.pop();
2232
+ this._binaryTokens.pop();
2233
+ }
2234
+ if (this._binaryTokens.length === 0) {
2235
+ this._lastTokenEndIndex = -1;
2236
+ this.produce(stack, lineLength);
2237
+ this._binaryTokens[this._binaryTokens.length - 2] = 0;
2238
+ }
2239
+ const result = new Uint32Array(this._binaryTokens.length);
2240
+ for (let i = 0, len = this._binaryTokens.length; i < len; i++) result[i] = this._binaryTokens[i];
2241
+ return result;
2242
+ }
2243
+ };
2244
+ var SyncRegistry = class {
2245
+ constructor(theme, _onigLib) {
2246
+ this._onigLib = _onigLib;
2247
+ this._theme = theme;
2248
+ }
2249
+ _grammars = /* @__PURE__ */ new Map();
2250
+ _rawGrammars = /* @__PURE__ */ new Map();
2251
+ _injectionGrammars = /* @__PURE__ */ new Map();
2252
+ _theme;
2253
+ dispose() {
2254
+ for (const grammar of this._grammars.values()) grammar.dispose();
2255
+ }
2256
+ setTheme(theme) {
2257
+ this._theme = theme;
2258
+ }
2259
+ getColorMap() {
2260
+ return this._theme.getColorMap();
2261
+ }
2262
+ /**
2263
+ * Add `grammar` to registry and return a list of referenced scope names
2264
+ */
2265
+ addGrammar(grammar, injectionScopeNames) {
2266
+ this._rawGrammars.set(grammar.scopeName, grammar);
2267
+ if (injectionScopeNames) this._injectionGrammars.set(grammar.scopeName, injectionScopeNames);
2268
+ }
2269
+ /**
2270
+ * Lookup a raw grammar.
2271
+ */
2272
+ lookup(scopeName) {
2273
+ return this._rawGrammars.get(scopeName);
2274
+ }
2275
+ /**
2276
+ * Returns the injections for the given grammar
2277
+ */
2278
+ injections(targetScope) {
2279
+ return this._injectionGrammars.get(targetScope);
2280
+ }
2281
+ /**
2282
+ * Get the default theme settings
2283
+ */
2284
+ getDefaults() {
2285
+ return this._theme.getDefaults();
2286
+ }
2287
+ /**
2288
+ * Match a scope in the theme.
2289
+ */
2290
+ themeMatch(scopePath) {
2291
+ return this._theme.match(scopePath);
2292
+ }
2293
+ /**
2294
+ * Lookup a grammar.
2295
+ */
2296
+ grammarForScopeName(scopeName, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors) {
2297
+ if (!this._grammars.has(scopeName)) {
2298
+ let rawGrammar = this._rawGrammars.get(scopeName);
2299
+ if (!rawGrammar) return null;
2300
+ this._grammars.set(scopeName, createGrammar(scopeName, rawGrammar, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors, this, this._onigLib));
2301
+ }
2302
+ return this._grammars.get(scopeName);
2303
+ }
2304
+ };
2305
+ var Registry = class {
2306
+ _options;
2307
+ _syncRegistry;
2308
+ _ensureGrammarCache;
2309
+ constructor(options) {
2310
+ this._options = options;
2311
+ this._syncRegistry = new SyncRegistry(Theme.createFromRawTheme(options.theme, options.colorMap), options.onigLib);
2312
+ this._ensureGrammarCache = /* @__PURE__ */ new Map();
2313
+ }
2314
+ dispose() {
2315
+ this._syncRegistry.dispose();
2316
+ }
2317
+ /**
2318
+ * Change the theme. Once called, no previous `ruleStack` should be used anymore.
2319
+ */
2320
+ setTheme(theme, colorMap) {
2321
+ this._syncRegistry.setTheme(Theme.createFromRawTheme(theme, colorMap));
2322
+ }
2323
+ /**
2324
+ * Returns a lookup array for color ids.
2325
+ */
2326
+ getColorMap() {
2327
+ return this._syncRegistry.getColorMap();
2328
+ }
2329
+ /**
2330
+ * Load the grammar for `scopeName` and all referenced included grammars asynchronously.
2331
+ * Please do not use language id 0.
2332
+ */
2333
+ loadGrammarWithEmbeddedLanguages(initialScopeName, initialLanguage, embeddedLanguages) {
2334
+ return this.loadGrammarWithConfiguration(initialScopeName, initialLanguage, { embeddedLanguages });
2335
+ }
2336
+ /**
2337
+ * Load the grammar for `scopeName` and all referenced included grammars asynchronously.
2338
+ * Please do not use language id 0.
2339
+ */
2340
+ loadGrammarWithConfiguration(initialScopeName, initialLanguage, configuration) {
2341
+ return this._loadGrammar(initialScopeName, initialLanguage, configuration.embeddedLanguages, configuration.tokenTypes, new BalancedBracketSelectors(configuration.balancedBracketSelectors || [], configuration.unbalancedBracketSelectors || []));
2342
+ }
2343
+ /**
2344
+ * Load the grammar for `scopeName` and all referenced included grammars asynchronously.
2345
+ */
2346
+ loadGrammar(initialScopeName) {
2347
+ return this._loadGrammar(initialScopeName, 0, null, null, null);
2348
+ }
2349
+ _loadGrammar(initialScopeName, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors) {
2350
+ const dependencyProcessor = new ScopeDependencyProcessor(this._syncRegistry, initialScopeName);
2351
+ while (dependencyProcessor.Q.length > 0) {
2352
+ dependencyProcessor.Q.map((request) => this._loadSingleGrammar(request.scopeName));
2353
+ dependencyProcessor.processQueue();
2354
+ }
2355
+ return this._grammarForScopeName(initialScopeName, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors);
2356
+ }
2357
+ _loadSingleGrammar(scopeName) {
2358
+ if (!this._ensureGrammarCache.has(scopeName)) {
2359
+ this._doLoadSingleGrammar(scopeName);
2360
+ this._ensureGrammarCache.set(scopeName, true);
2361
+ }
2362
+ }
2363
+ _doLoadSingleGrammar(scopeName) {
2364
+ const grammar = this._options.loadGrammar(scopeName);
2365
+ if (grammar) {
2366
+ const injections = typeof this._options.getInjections === "function" ? this._options.getInjections(scopeName) : void 0;
2367
+ this._syncRegistry.addGrammar(grammar, injections);
2368
+ }
2369
+ }
2370
+ /**
2371
+ * Adds a rawGrammar.
2372
+ */
2373
+ addGrammar(rawGrammar, injections = [], initialLanguage = 0, embeddedLanguages = null) {
2374
+ this._syncRegistry.addGrammar(rawGrammar, injections);
2375
+ return this._grammarForScopeName(rawGrammar.scopeName, initialLanguage, embeddedLanguages);
2376
+ }
2377
+ /**
2378
+ * Get the grammar for `scopeName`. The grammar must first be created via `loadGrammar` or `addGrammar`.
2379
+ */
2380
+ _grammarForScopeName(scopeName, initialLanguage = 0, embeddedLanguages = null, tokenTypes = null, balancedBracketSelectors = null) {
2381
+ return this._syncRegistry.grammarForScopeName(scopeName, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors);
2382
+ }
2383
+ };
2384
+ var INITIAL = StateStackImpl.NULL;
2385
+ //#endregion
2386
+ //#region ../../node_modules/.pnpm/@pierre+diffs@1.5.2_@shikijs+themes@4.5.0_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/@pierre/diffs/dist/managers/UniversalRenderingManager.js
2387
+ var callbacks = /* @__PURE__ */ new Set();
2388
+ var frameId = null;
2389
+ function queueRender(callback) {
2390
+ callbacks.add(callback);
2391
+ frameId ??= requestAnimationFrame(render);
2392
+ }
2393
+ function dequeueRender(callback) {
2394
+ if (callbacks.delete(callback) && callbacks.size === 0 && frameId != null) {
2395
+ cancelAnimationFrame(frameId);
2396
+ frameId = null;
2397
+ }
2398
+ }
2399
+ function render(time) {
2400
+ const toIterate = new Set(callbacks);
2401
+ callbacks.clear();
2402
+ for (const callback of toIterate) try {
2403
+ callback(time);
2404
+ } catch (error) {
2405
+ console.error(error);
2406
+ }
2407
+ if (callbacks.size > 0) frameId = requestAnimationFrame(render);
2408
+ else frameId = null;
2409
+ }
2410
+ //#endregion
2411
+ //#region ../../node_modules/.pnpm/@pierre+diffs@1.5.2_@shikijs+themes@4.5.0_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/@pierre/diffs/dist/utils/isGutterUtilityPath.js
2412
+ function isGutterUtilityPath(path) {
2413
+ for (const element of path) {
2414
+ if (!(element instanceof HTMLElement)) continue;
2415
+ if (element.hasAttribute("data-utility-button") || element.hasAttribute("data-gutter-utility-slot") || element.getAttribute("slot") === "gutter-utility-slot" || element.getAttribute("name") === "gutter-utility-slot") return true;
2416
+ }
2417
+ return false;
2418
+ }
2419
+ //#endregion
2420
+ //#region ../../node_modules/.pnpm/@pierre+diffs@1.5.2_@shikijs+themes@4.5.0_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/@pierre/diffs/dist/utils/getFiletypeFromFileName.js
2421
+ var CUSTOM_EXTENSION_TO_FILE_FORMAT = /* @__PURE__ */ new Map();
2422
+ var customExtensionsVersion = 0;
2423
+ var EXTENSION_TO_FILE_FORMAT = {
2424
+ "1c": "1c",
2425
+ abap: "abap",
2426
+ as: "actionscript-3",
2427
+ ada: "ada",
2428
+ adb: "ada",
2429
+ ads: "ada",
2430
+ adoc: "asciidoc",
2431
+ asciidoc: "asciidoc",
2432
+ "component.html": "angular-html",
2433
+ "component.ts": "angular-ts",
2434
+ conf: "nginx",
2435
+ htaccess: "apache",
2436
+ cls: "tex",
2437
+ trigger: "apex",
2438
+ apl: "apl",
2439
+ applescript: "applescript",
2440
+ scpt: "applescript",
2441
+ ara: "ara",
2442
+ asm: "asm",
2443
+ s: "riscv",
2444
+ astro: "astro",
2445
+ awk: "awk",
2446
+ bal: "ballerina",
2447
+ sh: "zsh",
2448
+ bash: "zsh",
2449
+ bat: "cmd",
2450
+ cmd: "cmd",
2451
+ be: "berry",
2452
+ beancount: "beancount",
2453
+ bib: "bibtex",
2454
+ bicep: "bicep",
2455
+ "blade.php": "blade",
2456
+ bsl: "bsl",
2457
+ c: "c",
2458
+ h: "objective-cpp",
2459
+ cs: "csharp",
2460
+ cpp: "cpp",
2461
+ hpp: "cpp",
2462
+ cc: "cpp",
2463
+ cxx: "cpp",
2464
+ hh: "cpp",
2465
+ cdc: "cdc",
2466
+ cairo: "cairo",
2467
+ clar: "clarity",
2468
+ clj: "clojure",
2469
+ cljs: "clojure",
2470
+ cljc: "clojure",
2471
+ soy: "soy",
2472
+ cmake: "cmake",
2473
+ "CMakeLists.txt": "cmake",
2474
+ cob: "cobol",
2475
+ cbl: "cobol",
2476
+ cobol: "cobol",
2477
+ CODEOWNERS: "codeowners",
2478
+ ql: "ql",
2479
+ coffee: "coffeescript",
2480
+ lisp: "lisp",
2481
+ cl: "lisp",
2482
+ lsp: "lisp",
2483
+ log: "log",
2484
+ v: "verilog",
2485
+ cql: "cql",
2486
+ cr: "crystal",
2487
+ css: "css",
2488
+ csv: "csv",
2489
+ cue: "cue",
2490
+ cypher: "cypher",
2491
+ cyp: "cypher",
2492
+ d: "d",
2493
+ dart: "dart",
2494
+ dax: "dax",
2495
+ desktop: "desktop",
2496
+ diff: "diff",
2497
+ patch: "diff",
2498
+ Dockerfile: "dockerfile",
2499
+ dockerfile: "dockerfile",
2500
+ env: "dotenv",
2501
+ dm: "dream-maker",
2502
+ edge: "edge",
2503
+ el: "emacs-lisp",
2504
+ ex: "elixir",
2505
+ exs: "elixir",
2506
+ elm: "elm",
2507
+ erb: "erb",
2508
+ erl: "erlang",
2509
+ hrl: "erlang",
2510
+ f: "fortran-fixed-form",
2511
+ for: "fortran-fixed-form",
2512
+ fs: "fsharp",
2513
+ fsi: "fsharp",
2514
+ fsx: "fsharp",
2515
+ f03: "f03",
2516
+ f08: "f08",
2517
+ f18: "f18",
2518
+ f77: "f77",
2519
+ f90: "fortran-free-form",
2520
+ f95: "fortran-free-form",
2521
+ fnl: "fennel",
2522
+ fish: "fish",
2523
+ ftl: "ftl",
2524
+ tres: "gdresource",
2525
+ res: "gdresource",
2526
+ gd: "gdscript",
2527
+ gdshader: "gdshader",
2528
+ gs: "genie",
2529
+ feature: "gherkin",
2530
+ COMMIT_EDITMSG: "git-commit",
2531
+ "git-rebase-todo": "git-rebase",
2532
+ gjs: "glimmer-js",
2533
+ gleam: "gleam",
2534
+ gts: "glimmer-ts",
2535
+ glsl: "glsl",
2536
+ vert: "glsl",
2537
+ frag: "glsl",
2538
+ shader: "shaderlab",
2539
+ gp: "gnuplot",
2540
+ plt: "gnuplot",
2541
+ gnuplot: "gnuplot",
2542
+ go: "go",
2543
+ graphql: "graphql",
2544
+ gql: "graphql",
2545
+ groovy: "groovy",
2546
+ gvy: "groovy",
2547
+ hack: "hack",
2548
+ haml: "haml",
2549
+ hbs: "handlebars",
2550
+ handlebars: "handlebars",
2551
+ hs: "haskell",
2552
+ lhs: "haskell",
2553
+ hx: "haxe",
2554
+ hcl: "hcl",
2555
+ hjson: "hjson",
2556
+ hlsl: "hlsl",
2557
+ fx: "hlsl",
2558
+ html: "html",
2559
+ htm: "html",
2560
+ http: "http",
2561
+ rest: "http",
2562
+ hxml: "hxml",
2563
+ hy: "hy",
2564
+ imba: "imba",
2565
+ ini: "ini",
2566
+ cfg: "ini",
2567
+ jade: "pug",
2568
+ pug: "pug",
2569
+ java: "java",
2570
+ js: "javascript",
2571
+ mjs: "javascript",
2572
+ cjs: "javascript",
2573
+ jinja: "jinja",
2574
+ jinja2: "jinja",
2575
+ j2: "jinja",
2576
+ jison: "jison",
2577
+ jl: "julia",
2578
+ json: "json",
2579
+ json5: "json5",
2580
+ jsonc: "jsonc",
2581
+ jsonl: "jsonl",
2582
+ jsonnet: "jsonnet",
2583
+ libsonnet: "jsonnet",
2584
+ jssm: "jssm",
2585
+ jsx: "jsx",
2586
+ kt: "kotlin",
2587
+ kts: "kts",
2588
+ kql: "kusto",
2589
+ tex: "tex",
2590
+ ltx: "tex",
2591
+ lean: "lean4",
2592
+ less: "less",
2593
+ liquid: "liquid",
2594
+ lit: "lit",
2595
+ ll: "llvm",
2596
+ logo: "logo",
2597
+ lua: "lua",
2598
+ luau: "luau",
2599
+ Makefile: "makefile",
2600
+ mk: "makefile",
2601
+ makefile: "makefile",
2602
+ md: "markdown",
2603
+ markdown: "markdown",
2604
+ marko: "marko",
2605
+ m: "wolfram",
2606
+ mat: "matlab",
2607
+ mdc: "mdc",
2608
+ mdx: "mdx",
2609
+ wiki: "wikitext",
2610
+ mediawiki: "wikitext",
2611
+ mmd: "mermaid",
2612
+ mermaid: "mermaid",
2613
+ mips: "mipsasm",
2614
+ mojo: "mojo",
2615
+ "🔥": "mojo",
2616
+ move: "move",
2617
+ nar: "narrat",
2618
+ nf: "nextflow",
2619
+ nim: "nim",
2620
+ nims: "nim",
2621
+ nimble: "nim",
2622
+ nix: "nix",
2623
+ nu: "nushell",
2624
+ mm: "objective-cpp",
2625
+ ml: "ocaml",
2626
+ mli: "ocaml",
2627
+ mll: "ocaml",
2628
+ mly: "ocaml",
2629
+ odin: "odin",
2630
+ pas: "pascal",
2631
+ p: "pascal",
2632
+ pl: "prolog",
2633
+ pm: "perl",
2634
+ t: "perl",
2635
+ raku: "raku",
2636
+ p6: "raku",
2637
+ pl6: "raku",
2638
+ php: "php",
2639
+ phtml: "php",
2640
+ pls: "plsql",
2641
+ sql: "sql",
2642
+ po: "po",
2643
+ polar: "polar",
2644
+ pcss: "postcss",
2645
+ pot: "pot",
2646
+ potx: "potx",
2647
+ pq: "powerquery",
2648
+ pqm: "powerquery",
2649
+ ps1: "powershell",
2650
+ psm1: "powershell",
2651
+ psd1: "powershell",
2652
+ prisma: "prisma",
2653
+ pro: "prolog",
2654
+ P: "prolog",
2655
+ properties: "properties",
2656
+ proto: "protobuf",
2657
+ pp: "puppet",
2658
+ purs: "purescript",
2659
+ py: "python",
2660
+ pyw: "python",
2661
+ pyi: "python",
2662
+ BUCK: "python",
2663
+ BUILD: "python",
2664
+ PACKAGE: "python",
2665
+ WORKSPACE: "python",
2666
+ Tiltfile: "python",
2667
+ bazel: "python",
2668
+ bxl: "python",
2669
+ bzl: "python",
2670
+ bzlmod: "python",
2671
+ star: "python",
2672
+ sky: "python",
2673
+ qml: "qml",
2674
+ qmldir: "qmldir",
2675
+ qss: "qss",
2676
+ r: "r",
2677
+ R: "r",
2678
+ rkt: "racket",
2679
+ rktl: "racket",
2680
+ razor: "razor",
2681
+ cshtml: "razor",
2682
+ rb: "ruby",
2683
+ rbw: "ruby",
2684
+ reg: "reg",
2685
+ regex: "regexp",
2686
+ rel: "rel",
2687
+ rs: "rust",
2688
+ rst: "rst",
2689
+ rake: "ruby",
2690
+ gemspec: "ruby",
2691
+ jbuilder: "ruby",
2692
+ builder: "ruby",
2693
+ rabl: "ruby",
2694
+ arb: "ruby",
2695
+ ru: "ruby",
2696
+ podspec: "ruby",
2697
+ Gemfile: "ruby",
2698
+ Rakefile: "ruby",
2699
+ Guardfile: "ruby",
2700
+ Capfile: "ruby",
2701
+ Berksfile: "ruby",
2702
+ Brewfile: "ruby",
2703
+ Vagrantfile: "ruby",
2704
+ Thorfile: "ruby",
2705
+ Appraisals: "ruby",
2706
+ Dangerfile: "ruby",
2707
+ sas: "sas",
2708
+ sass: "sass",
2709
+ scala: "scala",
2710
+ sc: "scala",
2711
+ scm: "scheme",
2712
+ ss: "scheme",
2713
+ sld: "scheme",
2714
+ scss: "scss",
2715
+ sdbl: "sdbl",
2716
+ shadergraph: "shader",
2717
+ st: "smalltalk",
2718
+ sol: "solidity",
2719
+ sparql: "sparql",
2720
+ rq: "sparql",
2721
+ spl: "splunk",
2722
+ config: "ssh-config",
2723
+ do: "stata",
2724
+ ado: "stata",
2725
+ dta: "stata",
2726
+ styl: "stylus",
2727
+ stylus: "stylus",
2728
+ svelte: "svelte",
2729
+ swift: "swift",
2730
+ sv: "system-verilog",
2731
+ svh: "system-verilog",
2732
+ service: "systemd",
2733
+ socket: "systemd",
2734
+ device: "systemd",
2735
+ timer: "systemd",
2736
+ talon: "talonscript",
2737
+ tasl: "tasl",
2738
+ tcl: "tcl",
2739
+ templ: "templ",
2740
+ tf: "tf",
2741
+ tfvars: "tfvars",
2742
+ toml: "toml",
2743
+ ts: "typescript",
2744
+ mts: "typescript",
2745
+ cts: "typescript",
2746
+ tsp: "typespec",
2747
+ tsv: "tsv",
2748
+ tsx: "tsx",
2749
+ ttl: "turtle",
2750
+ twig: "twig",
2751
+ typ: "typst",
2752
+ vv: "v",
2753
+ vala: "vala",
2754
+ vapi: "vala",
2755
+ vb: "vb",
2756
+ vbs: "vb",
2757
+ bas: "vb",
2758
+ vh: "verilog",
2759
+ vhd: "vhdl",
2760
+ vhdl: "vhdl",
2761
+ vim: "vimscript",
2762
+ vue: "vue",
2763
+ "vine.ts": "vue-vine",
2764
+ vy: "vyper",
2765
+ wasm: "wasm",
2766
+ wat: "wasm",
2767
+ wy: "文言",
2768
+ wgsl: "wgsl",
2769
+ wit: "wit",
2770
+ wl: "wolfram",
2771
+ nb: "wolfram",
2772
+ xml: "xml",
2773
+ xsl: "xsl",
2774
+ xslt: "xsl",
2775
+ yaml: "yaml",
2776
+ yml: "yml",
2777
+ zs: "zenscript",
2778
+ zig: "zig",
2779
+ zsh: "zsh",
2780
+ sty: "tex"
2781
+ };
2782
+ function getFiletypeFromFileName(fileName) {
2783
+ const format = matchFiletypeFromName(fileName);
2784
+ if (format != null) return format;
2785
+ const baseName = fileName.split(/[/\\]/).pop() ?? fileName;
2786
+ return baseName === fileName ? "text" : matchFiletypeFromName(baseName) ?? "text";
2787
+ }
2788
+ function matchFiletypeFromName(fileName) {
2789
+ if (CUSTOM_EXTENSION_TO_FILE_FORMAT.has(fileName)) return CUSTOM_EXTENSION_TO_FILE_FORMAT.get(fileName) ?? "text";
2790
+ if (Object.hasOwn(EXTENSION_TO_FILE_FORMAT, fileName)) return EXTENSION_TO_FILE_FORMAT[fileName] ?? null;
2791
+ const compoundMatch = fileName.match(/\.([^/\\]+\.[^/\\]+)$/);
2792
+ if (compoundMatch != null) {
2793
+ if (CUSTOM_EXTENSION_TO_FILE_FORMAT.has(compoundMatch[1])) return CUSTOM_EXTENSION_TO_FILE_FORMAT.get(compoundMatch[1]) ?? "text";
2794
+ if (Object.hasOwn(EXTENSION_TO_FILE_FORMAT, compoundMatch[1])) return EXTENSION_TO_FILE_FORMAT[compoundMatch[1]] ?? "text";
2795
+ }
2796
+ const simpleMatch = fileName.match(/\.([^.]+)$/)?.[1] ?? "";
2797
+ if (CUSTOM_EXTENSION_TO_FILE_FORMAT.has(simpleMatch)) return CUSTOM_EXTENSION_TO_FILE_FORMAT.get(simpleMatch) ?? "text";
2798
+ return Object.hasOwn(EXTENSION_TO_FILE_FORMAT, simpleMatch) ? EXTENSION_TO_FILE_FORMAT[simpleMatch] ?? "text" : null;
2799
+ }
2800
+ function getCustomExtensionsVersion() {
2801
+ return customExtensionsVersion;
2802
+ }
2803
+ function getCustomExtensionsMap() {
2804
+ return Object.fromEntries(CUSTOM_EXTENSION_TO_FILE_FORMAT);
2805
+ }
2806
+ //#endregion
2807
+ //#region ../../node_modules/.pnpm/@pierre+diffs@1.5.2_@shikijs+themes@4.5.0_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/@pierre/diffs/dist/utils/getLineAnnotationName.js
2808
+ function getLineAnnotationName(annotation) {
2809
+ return `annotation-${"side" in annotation ? `${annotation.side}-` : ""}${annotation.lineNumber}`;
2810
+ }
2811
+ //#endregion
2812
+ //#region ../../node_modules/.pnpm/@pierre+theming@1.0.1_@pierre+theme@2.0.0_@shikijs+themes@4.5.0_react-dom@19.3.1_react@19.3.1__react@19.3.1_shiki@4.5.0/node_modules/@pierre/theming/dist/modules/color.js
2813
+ var HEX_TRANSPARENT_RE = /^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i;
2814
+ var ALPHA_ZERO_RE = /^0(?:\.0+)?%?$/;
2815
+ function getFunctionalAlpha(color) {
2816
+ const openParen = color.indexOf("(");
2817
+ if (openParen <= 0 || !color.endsWith(")")) return;
2818
+ const fn = color.slice(0, openParen).trim();
2819
+ if (!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(fn)) return;
2820
+ const inner = color.slice(openParen + 1, -1).trim();
2821
+ if (inner.length === 0) return;
2822
+ const slashIndex = inner.lastIndexOf("/");
2823
+ if (slashIndex !== -1) return inner.slice(slashIndex + 1).trim();
2824
+ if (/^(?:rgba|hsla)$/i.test(fn)) {
2825
+ const parts = inner.split(",");
2826
+ if (parts.length === 4) return parts[3]?.trim();
2827
+ }
2828
+ }
2829
+ function parseHexRgba(color) {
2830
+ const match = /^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(color.trim());
2831
+ if (match == null) return null;
2832
+ const hex = match[1];
2833
+ let expanded;
2834
+ let alpha = 1;
2835
+ if (hex.length === 3) expanded = hex.split("").map((c) => c + c).join("");
2836
+ else if (hex.length === 6) expanded = hex;
2837
+ else {
2838
+ expanded = hex.slice(0, 6);
2839
+ alpha = parseInt(hex.slice(6, 8), 16) / 255;
2840
+ }
2841
+ return [
2842
+ parseInt(expanded.slice(0, 2), 16),
2843
+ parseInt(expanded.slice(2, 4), 16),
2844
+ parseInt(expanded.slice(4, 6), 16),
2845
+ alpha
2846
+ ];
2847
+ }
2848
+ function relativeLuminance(color) {
2849
+ if (color == null) return null;
2850
+ const rgba = parseHexRgba(color);
2851
+ if (rgba == null) return null;
2852
+ const r = rgba[0] / 255;
2853
+ const g = rgba[1] / 255;
2854
+ const b = rgba[2] / 255;
2855
+ const channel = (v) => v <= .03928 ? v / 12.92 : ((v + .055) / 1.055) ** 2.4;
2856
+ return .2126 * channel(r) + .7152 * channel(g) + .0722 * channel(b);
2857
+ }
2858
+ function contrastRatio(a, b) {
2859
+ const [hi, lo] = a > b ? [a, b] : [b, a];
2860
+ return (hi + .05) / (lo + .05);
2861
+ }
2862
+ function compositeOverBg(fgColor, bgColor) {
2863
+ if (bgColor == null) return void 0;
2864
+ const fgParts = parseHexRgba(fgColor);
2865
+ const bgParts = parseHexRgba(bgColor);
2866
+ if (fgParts == null || bgParts == null) return void 0;
2867
+ const [fr, fg, fb, fa] = fgParts;
2868
+ const [br, bg, bb] = bgParts;
2869
+ return "#" + [
2870
+ Math.round(fr * fa + br * (1 - fa)),
2871
+ Math.round(fg * fa + bg * (1 - fa)),
2872
+ Math.round(fb * fa + bb * (1 - fa))
2873
+ ].map((v) => v.toString(16).padStart(2, "0")).join("");
2874
+ }
2875
+ function isFullyTransparent(color) {
2876
+ if (color == null) return false;
2877
+ const normalized = color.trim().toLowerCase();
2878
+ if (normalized === "transparent") return true;
2879
+ if (HEX_TRANSPARENT_RE.test(normalized)) return true;
2880
+ const alpha = getFunctionalAlpha(normalized);
2881
+ return alpha != null && ALPHA_ZERO_RE.test(alpha);
2882
+ }
2883
+ function isDarkSurface(bg, fgHint) {
2884
+ const fromBg = relativeLuminance(bg);
2885
+ if (fromBg != null) return fromBg < .4;
2886
+ const fromFg = relativeLuminance(fgHint);
2887
+ return fromFg != null ? fromFg > .6 : false;
2888
+ }
2889
+ function surfacesMatch(a, b) {
2890
+ if (a == null || b == null) return false;
2891
+ if (a.trim().toLowerCase() === b.trim().toLowerCase()) return true;
2892
+ const la = relativeLuminance(a);
2893
+ const lb = relativeLuminance(b);
2894
+ if (la == null || lb == null) return false;
2895
+ return Math.abs(la - lb) < .06;
2896
+ }
2897
+ function hoverWouldEraseText(hover, bg, fg) {
2898
+ if (bg == null || fg == null) return false;
2899
+ const hoverL = relativeLuminance(hover);
2900
+ const bgL = relativeLuminance(bg);
2901
+ const fgL = relativeLuminance(fg);
2902
+ if (hoverL == null || bgL == null || fgL == null) return false;
2903
+ return Math.abs(hoverL - fgL) < Math.abs(hoverL - bgL);
2904
+ }
2905
+ function pickReadableForeground(bg, candidates) {
2906
+ const bgL = relativeLuminance(bg);
2907
+ const firstDefined = candidates.find((candidate) => candidate != null && candidate !== "");
2908
+ if (bgL == null) return firstDefined;
2909
+ let best;
2910
+ let bestRatio = -1;
2911
+ for (const candidate of candidates) {
2912
+ if (candidate == null || candidate === "") continue;
2913
+ const candidateL = relativeLuminance(candidate);
2914
+ if (candidateL == null) continue;
2915
+ const ratio = contrastRatio(bgL, candidateL);
2916
+ if (ratio >= 3) return candidate;
2917
+ if (ratio > bestRatio) {
2918
+ best = candidate;
2919
+ bestRatio = ratio;
2920
+ }
2921
+ }
2922
+ return best ?? firstDefined;
2923
+ }
2924
+ function deriveMutedFg(primaryFg, bg) {
2925
+ if (bg == null) return primaryFg;
2926
+ const fgParts = parseHexRgba(primaryFg);
2927
+ const bgParts = parseHexRgba(bg);
2928
+ const bgL = relativeLuminance(bg);
2929
+ if (fgParts == null || bgParts == null || bgL == null) return `color-mix(in srgb, ${primaryFg} 70%, ${bg})`;
2930
+ const [fr, fg2, fb] = fgParts;
2931
+ const [br, bg3, bb] = bgParts;
2932
+ for (const weight of [
2933
+ .6,
2934
+ .7,
2935
+ .8,
2936
+ .9
2937
+ ]) {
2938
+ const hex = "#" + [
2939
+ Math.round(fr * weight + br * (1 - weight)),
2940
+ Math.round(fg2 * weight + bg3 * (1 - weight)),
2941
+ Math.round(fb * weight + bb * (1 - weight))
2942
+ ].map((v) => v.toString(16).padStart(2, "0")).join("");
2943
+ const L = relativeLuminance(hex);
2944
+ if (L != null && contrastRatio(bgL, L) >= 4.5) return hex;
2945
+ }
2946
+ return primaryFg;
2947
+ }
2948
+ //#endregion
2949
+ //#region ../../node_modules/.pnpm/@pierre+diffs@1.5.2_@shikijs+themes@4.5.0_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/@pierre/diffs/dist/utils/computeFileOffsets.js
2950
+ var LINE_FEED = 10;
2951
+ var CARRIAGE_RETURN = 13;
2952
+ var DENSE_LINE_BREAK_BLOCK_SIZE = 4;
2953
+ var DENSE_LINE_BREAK_BLOCK_SPAN = 40;
2954
+ /**
2955
+ * Computes line start offsets for a string.
2956
+ */
2957
+ function computeLineOffsets(contents) {
2958
+ const offsets = [0];
2959
+ let carriageReturn = contents.indexOf("\r");
2960
+ let lineFeed = contents.indexOf("\n");
2961
+ let blockStart = 0;
2962
+ let blockBreaks = 0;
2963
+ while (carriageReturn !== -1 || lineFeed !== -1) {
2964
+ let nextOffset;
2965
+ if (carriageReturn !== -1 && (lineFeed === -1 || carriageReturn < lineFeed)) {
2966
+ if (lineFeed === carriageReturn + 1) {
2967
+ nextOffset = lineFeed + 1;
2968
+ carriageReturn = contents.indexOf("\r", nextOffset);
2969
+ lineFeed = contents.indexOf("\n", nextOffset);
2970
+ } else {
2971
+ nextOffset = carriageReturn + 1;
2972
+ carriageReturn = contents.indexOf("\r", nextOffset);
2973
+ }
2974
+ } else {
2975
+ nextOffset = lineFeed + 1;
2976
+ lineFeed = contents.indexOf("\n", nextOffset);
2977
+ }
2978
+ offsets.push(nextOffset);
2979
+ if (++blockBreaks === DENSE_LINE_BREAK_BLOCK_SIZE) {
2980
+ if (nextOffset - blockStart <= DENSE_LINE_BREAK_BLOCK_SPAN) {
2981
+ for (let i = nextOffset; i < contents.length; i++) {
2982
+ const char = contents.charCodeAt(i);
2983
+ if (char === LINE_FEED || char === CARRIAGE_RETURN) {
2984
+ if (char === CARRIAGE_RETURN && i + 1 < contents.length && contents.charCodeAt(i + 1) === LINE_FEED) i++;
2985
+ offsets.push(i + 1);
2986
+ }
2987
+ }
2988
+ return offsets;
2989
+ }
2990
+ blockStart = nextOffset;
2991
+ blockBreaks = 0;
2992
+ }
2993
+ }
2994
+ return offsets;
2995
+ }
2996
+ /**
2997
+ * Counts line breaks in a string, treating `\n`, `\r`, and `\r\n` the same way
2998
+ * {@link computeLineOffsets} does (a `\r\n` pair is one break). Mirrors that
2999
+ * scan but counts in a single pass instead of building and discarding an
3000
+ * offsets array, so sizing the changed-line range for large edits stays cheap.
3001
+ * A unit test asserts it stays in lockstep with `computeLineOffsets`.
3002
+ */
3003
+ function countLineBreaks(contents) {
3004
+ let count = 0;
3005
+ for (let i = 0; i < contents.length; i++) {
3006
+ const char = contents.charCodeAt(i);
3007
+ if (char === LINE_FEED || char === CARRIAGE_RETURN) {
3008
+ if (char === CARRIAGE_RETURN && i + 1 < contents.length && contents.charCodeAt(i + 1) === LINE_FEED) i++;
3009
+ count++;
3010
+ }
3011
+ }
3012
+ return count;
3013
+ }
3014
+ /**
3015
+ * Splits file contents into lines aligned with {@link computeLineOffsets}.
3016
+ * Unlike splitFileContents, a trailing newline produces a final empty line.
3017
+ */
3018
+ function linesFromFileContents(contents) {
3019
+ const offsets = computeLineOffsets(contents);
3020
+ return Array.from({ length: offsets.length }, (_, i) => {
3021
+ const start = offsets[i];
3022
+ const end = offsets[i + 1] ?? contents.length;
3023
+ return contents.slice(start, end);
3024
+ });
3025
+ }
3026
+ //#endregion
3027
+ //#region ../../node_modules/.pnpm/@pierre+diffs@1.5.2_@shikijs+themes@4.5.0_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/@pierre/diffs/dist/utils/lineAnnotationIdentity.js
3028
+ var lineAnnotationSources = /* @__PURE__ */ new WeakMap();
3029
+ /**
3030
+ * Resolve a possibly-remapped annotation back to the original object it
3031
+ * descends from. Annotations that were never cloned resolve to themselves.
3032
+ */
3033
+ function getLineAnnotationSource(annotation) {
3034
+ const source = lineAnnotationSources.get(annotation);
3035
+ return source == null ? annotation : source;
3036
+ }
3037
+ function recordLineAnnotationSource(moved, annotation) {
3038
+ lineAnnotationSources.set(moved, annotation);
3039
+ }
3040
+ //#endregion
3041
+ //#region ../../node_modules/.pnpm/@pierre+diffs@1.5.2_@shikijs+themes@4.5.0_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/@pierre/diffs/dist/utils/platform.js
3042
+ var _isMacLike = void 0;
3043
+ var _isSafari = void 0;
3044
+ var _isFirefox = void 0;
3045
+ function isMacLike() {
3046
+ return _isMacLike ??= /macOS|MacIntel|iPhone|iPad|iPod/i.test(getPlatform());
3047
+ }
3048
+ function isSafari() {
3049
+ return _isSafari ??= "safari" in window && "pushNotification" in window.safari || /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
3050
+ }
3051
+ function isFirefox() {
3052
+ return _isFirefox ??= /\bFirefox\//.test(navigator.userAgent);
3053
+ }
3054
+ function getPlatform() {
3055
+ const navigator = globalThis.navigator;
3056
+ return navigator?.platform ?? navigator?.userAgentData?.platform ?? "unknown";
3057
+ }
3058
+ //#endregion
3059
+ //#region ../../node_modules/.pnpm/@pierre+diffs@1.5.2_@shikijs+themes@4.5.0_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/@pierre/diffs/dist/utils/cloneFileDiffMetadata.js
3060
+ function cloneHunks(hunks) {
3061
+ return hunks.map((hunk) => ({
3062
+ ...hunk,
3063
+ hunkContent: hunk.hunkContent.map((content) => ({ ...content }))
3064
+ }));
3065
+ }
3066
+ function cloneFileDiffMetadata(fileDiff) {
3067
+ return {
3068
+ ...fileDiff,
3069
+ hunks: cloneHunks(fileDiff.hunks),
3070
+ deletionLines: [...fileDiff.deletionLines],
3071
+ additionLines: [...fileDiff.additionLines]
3072
+ };
3073
+ }
3074
+ //#endregion
3075
+ export { INDEX_LINE_METADATA as $, Registry as A, DEFAULT_THEMES as B, getFiletypeFromFileName as C, EncodedTokenMetadata as D, queueRender as E, DEFAULT_CODE_VIEW_FILE_METRICS as F, DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE as G, DEFAULT_VIRTUAL_FILE_METRICS as H, DEFAULT_CODE_VIEW_LAYOUT as I, FILENAME_HEADER_REGEX as J, DIFFS_TAG_NAME as K, DEFAULT_EXPANDED_REGION as L, CODE_VIEW_FOOTER_ATTRIBUTE as M, CODE_VIEW_HEADER_ATTRIBUTE as N, FontStyle as O, CUSTOM_HEADER_SLOT_ID as P, HEADER_PREFIX_SLOT_ID as Q, DEFAULT_RENDER_RANGE as R, getCustomExtensionsVersion as S, dequeueRender as T, DIFFS_DEVELOPMENT_BUILD as U, DEFAULT_TOKENIZE_MAX_LENGTH as V, DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY as W, HEADER_FILENAME_SUFFIX_SLOT_ID as X, GIT_DIFF_FILE_BREAK_REGEX as Y, HEADER_METADATA_SLOT_ID as Z, pickReadableForeground as _, isSafari as a, getLineAnnotationName as b, computeLineOffsets as c, compositeOverBg as d, SPLIT_WITH_NEWLINES as et, contrastRatio as f, isFullyTransparent as g, isDarkSurface as h, isMacLike as i, Theme as j, INITIAL as k, countLineBreaks as l, hoverWouldEraseText as m, cloneHunks as n, UNSAFE_CSS_ATTRIBUTE as nt, getLineAnnotationSource as o, deriveMutedFg as p, EMPTY_RENDER_RANGE as q, isFirefox as r, recordLineAnnotationSource as s, cloneFileDiffMetadata as t, THEME_CSS_ATTRIBUTE as tt, linesFromFileContents as u, relativeLuminance as v, isGutterUtilityPath as w, getCustomExtensionsMap as x, surfacesMatch as y, DEFAULT_SMOOTH_SCROLL_SETTINGS as z };