@bkm016/basalt 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/README.md +53 -5
  2. package/{chunk-y648fzx0.js → chunk-0039s4jt.js} +3 -3
  3. package/{chunk-m40gxwq4.js → chunk-00gwse5r.js} +3 -3
  4. package/{chunk-t6zs4kw0.js → chunk-0fwdxd45.js} +2 -2
  5. package/{chunk-nmca5h6m.js → chunk-0j0qggej.js} +1 -1
  6. package/chunk-0n99m9m4.js +2 -0
  7. package/{chunk-pjyn2s97.js → chunk-0stvywr8.js} +1 -1
  8. package/{chunk-ztsjgssj.js → chunk-1xa7d5mh.js} +1 -1
  9. package/chunk-2nb3d92s.js +2 -0
  10. package/chunk-2nkfxhef.js +3868 -0
  11. package/chunk-2pa1z37c.js +2 -0
  12. package/{chunk-fw2bpqmw.js → chunk-2qcpq99g.js} +1 -1
  13. package/{chunk-981f9dw8.js → chunk-36cqq0ga.js} +6 -6
  14. package/{chunk-whvj83b7.js → chunk-3c330qna.js} +2 -2
  15. package/chunk-3k627vf2.js +3 -0
  16. package/{chunk-r7fpkb49.js → chunk-3k7ejpkc.js} +1 -1
  17. package/chunk-4g5f43ea.js +3 -0
  18. package/{chunk-fjtvjrkg.js → chunk-539ekagy.js} +4 -4
  19. package/{chunk-97rzj7f6.js → chunk-5v4g21rw.js} +1 -1
  20. package/{chunk-r0scgfwx.js → chunk-6dsq0fns.js} +2 -2
  21. package/{chunk-pbcy6zdt.js → chunk-7as47pcw.js} +1 -1
  22. package/{chunk-g2t6t8fk.js → chunk-7jezts2n.js} +2 -2
  23. package/{chunk-8wc8qdx8.js → chunk-7qq99360.js} +6 -6
  24. package/{chunk-9rmqgc3c.js → chunk-7tgqhveh.js} +15 -15
  25. package/{chunk-mvfsxdx6.js → chunk-7w0mefgk.js} +10 -10
  26. package/{chunk-y58ygzn9.js → chunk-818nd6s1.js} +3 -3
  27. package/{chunk-vv7fp27r.js → chunk-8mezk0cb.js} +2 -2
  28. package/{chunk-q7t30zz2.js → chunk-8xb636vr.js} +5 -5
  29. package/{chunk-ev6yvy5y.js → chunk-980drajf.js} +15 -15
  30. package/{chunk-3x94302m.js → chunk-9z7sdh5e.js} +3 -3
  31. package/{chunk-zggzfa7j.js → chunk-a4b75ekk.js} +2 -2
  32. package/{chunk-2zp1mv3q.js → chunk-ar3dbfp9.js} +1 -1
  33. package/{chunk-vk1gxk1t.js → chunk-aw65h276.js} +1 -1
  34. package/{chunk-f3xadvab.js → chunk-b9fqretv.js} +2 -2
  35. package/{chunk-7tbya5b5.js → chunk-bgkegf0k.js} +22 -22
  36. package/{chunk-0y7ne3d0.js → chunk-bwawt15q.js} +2 -2
  37. package/{chunk-pxsrqrd0.js → chunk-c4qr1f41.js} +2 -2
  38. package/chunk-dddsrff6.js +478 -0
  39. package/{chunk-xfvvh1s5.js → chunk-e63c1186.js} +1 -1
  40. package/{chunk-em187cy3.js → chunk-ebzkckyw.js} +2 -2
  41. package/chunk-eegztdzb.js +2 -0
  42. package/{chunk-rmj5b73e.js → chunk-gw05p4g3.js} +1 -1
  43. package/{chunk-k23t7vhs.js → chunk-h1rypb99.js} +5 -5
  44. package/{chunk-akr0a8nc.js → chunk-hq5ke1yp.js} +1 -1
  45. package/{chunk-jwdb0ccj.js → chunk-jvwg4rn1.js} +3 -3
  46. package/{chunk-7afmgncg.js → chunk-jyrwk08p.js} +1 -1
  47. package/chunk-kns4kv7b.js +3 -0
  48. package/{chunk-8d46jtbj.js → chunk-mat08ab1.js} +2 -2
  49. package/{chunk-jk25nt60.js → chunk-mkp28k1x.js} +2 -2
  50. package/{chunk-3ct2tkr8.js → chunk-npez1492.js} +2 -2
  51. package/{chunk-shadcb9z.js → chunk-nx3jnbv8.js} +2 -2
  52. package/{chunk-ykens1hy.js → chunk-nxkmd29x.js} +1 -1
  53. package/{chunk-y7nma9rk.js → chunk-pjr91g6k.js} +2 -2
  54. package/{chunk-m8vkwdgr.js → chunk-r0jc8e7t.js} +4 -4
  55. package/chunk-rxj6tct8.js +2 -0
  56. package/{chunk-362g64pd.js → chunk-sqaam5ak.js} +1 -1
  57. package/{chunk-4w17tzp5.js → chunk-srjgvdvs.js} +12 -12
  58. package/{chunk-r9aatvwm.js → chunk-stj493dn.js} +2 -2
  59. package/{chunk-k6w6y71k.js → chunk-t7sc0wwc.js} +2 -2
  60. package/{chunk-kp22kaez.js → chunk-v4k3qmdm.js} +2 -2
  61. package/{chunk-1vd0f74z.js → chunk-vt1anydc.js} +4 -4
  62. package/chunk-wd3z74av.js +2 -0
  63. package/{chunk-xh3vr5vz.js → chunk-wfyrfvfn.js} +1 -1
  64. package/{chunk-2hbfk5xd.js → chunk-wnzvnskb.js} +2 -2
  65. package/{chunk-cjc90f84.js → chunk-x89em726.js} +3 -3
  66. package/{chunk-vexrrw1b.js → chunk-xtq1xpq0.js} +2 -2
  67. package/chunk-yna8bwqc.js +2 -0
  68. package/{chunk-aky4tztg.js → chunk-zn0g0859.js} +2 -2
  69. package/{chunk-qe0teyn1.js → chunk-zrkh5dw7.js} +1 -1
  70. package/chunk-zzwjt7fp.js +2 -0
  71. package/compiled.js +12 -12
  72. package/package.json +1 -1
  73. package/ui-test-worker.js +20 -20
  74. package/web/chunk-01hcjafh.js +2 -0
  75. package/web/{chunk-n8sky2q6.js → chunk-07agqp8h.js} +1 -1
  76. package/web/{chunk-hvw3gn2a.js → chunk-0k9aec1s.js} +20 -20
  77. package/web/{chunk-74j07k8k.js → chunk-0p1nmj5n.js} +2 -2
  78. package/web/chunk-0qr891eq.js +70 -0
  79. package/web/{chunk-ts7zrf5b.js → chunk-0whceqes.js} +2 -2
  80. package/web/chunk-0ytga215.js +1 -0
  81. package/web/{chunk-0z0y25zf.js → chunk-12z7d0hp.js} +3 -3
  82. package/web/chunk-14bad871.js +2 -0
  83. package/web/chunk-1amzv4ha.js +1 -0
  84. package/web/chunk-1cfh0e2e.js +324 -0
  85. package/web/chunk-1pasbxwh.js +89 -0
  86. package/web/{chunk-4d3a7xs2.js → chunk-1s2hp6h1.js} +1 -1
  87. package/web/chunk-26bwh1sb.js +169 -0
  88. package/web/{chunk-wnskxerq.js → chunk-2nht58dc.js} +5 -5
  89. package/web/chunk-2y0rc1fe.js +1 -0
  90. package/web/chunk-3hkgdw6f.js +36 -0
  91. package/web/chunk-4a4j030b.js +1 -0
  92. package/web/{chunk-nvhmq4z5.js → chunk-4m3zdd41.js} +6 -6
  93. package/web/chunk-4w298aqs.js +1 -0
  94. package/web/{chunk-t4c8xavd.js → chunk-56krfj3b.js} +7 -7
  95. package/web/{chunk-ds7srg4p.js → chunk-5nda24gv.js} +1 -1
  96. package/web/{chunk-42e3b9hv.js → chunk-5shygfgb.js} +19 -19
  97. package/web/chunk-65nwc4cf.js +1 -0
  98. package/web/chunk-6bwgdvf6.js +1 -0
  99. package/web/chunk-6enn8p66.js +1 -0
  100. package/web/chunk-6stt9d18.js +1 -0
  101. package/web/{chunk-4gavbw65.js → chunk-7a3c137d.js} +1 -1
  102. package/web/chunk-7e47b1sn.js +1 -0
  103. package/web/chunk-7pypx5h8.js +2 -0
  104. package/web/chunk-7znyd1mj.js +39 -0
  105. package/web/{chunk-3re8y26v.js → chunk-892nf39p.js} +7 -7
  106. package/web/chunk-8r0s8tx7.js +1 -0
  107. package/web/chunk-9dy7z3ej.js +2 -0
  108. package/web/chunk-9mq2cdtq.js +1 -0
  109. package/web/chunk-9w5tf22s.js +1 -0
  110. package/web/{chunk-bhsaj6qq.js → chunk-9xgspn75.js} +2 -2
  111. package/web/{chunk-zx8zec24.js → chunk-abhad4zj.js} +56 -56
  112. package/web/chunk-advfpyb9.js +140 -0
  113. package/web/chunk-affear07.js +3 -0
  114. package/web/chunk-ahztazsg.js +1 -0
  115. package/web/chunk-aqt7kc3s.js +106 -0
  116. package/web/chunk-b5hah4mf.js +1 -0
  117. package/web/chunk-b8tfetd8.js +1 -0
  118. package/web/{chunk-9cx1be43.js → chunk-bnb9xhgw.js} +15 -15
  119. package/web/{chunk-n1dmrz44.js → chunk-c01176kn.js} +2 -2
  120. package/web/chunk-c3nn0vvc.js +1 -0
  121. package/web/chunk-c53xmf48.js +30 -0
  122. package/web/chunk-ckgpy4r4.js +1 -0
  123. package/web/chunk-crzseqbx.js +24 -0
  124. package/web/chunk-d22wq71s.js +1 -0
  125. package/web/{chunk-pws2seas.js → chunk-d60dpf69.js} +19 -19
  126. package/web/{chunk-6cnek1xh.js → chunk-d6ddkh6e.js} +1 -1
  127. package/web/{chunk-cg3jterp.js → chunk-d9wdsjkk.js} +2 -2
  128. package/web/{chunk-ttg6tbwx.js → chunk-da7m1kva.js} +2 -2
  129. package/web/chunk-dbnrfxt1.js +8 -0
  130. package/web/chunk-ddxf8e84.js +1 -0
  131. package/web/chunk-dzg1pv80.js +200 -0
  132. package/web/{chunk-yqbnps3a.js → chunk-e8h45nyr.js} +1 -1
  133. package/web/chunk-ej9vb61c.js +1 -0
  134. package/web/chunk-f9k3xrwb.js +2 -0
  135. package/web/{chunk-fh2vj0wv.js → chunk-fjag6yg8.js} +2 -2
  136. package/web/chunk-fnnrrzqa.js +78 -0
  137. package/web/{chunk-n90cqdvg.js → chunk-fv6vm14n.js} +2 -2
  138. package/web/{chunk-b1bgzz66.js → chunk-g5jxwkdh.js} +1 -1
  139. package/web/{chunk-sspfxp5e.js → chunk-g8kkc6vz.js} +1 -1
  140. package/web/chunk-g9sqbafw.js +2 -0
  141. package/web/{chunk-0h0vb6gt.js → chunk-gcv91974.js} +4 -4
  142. package/web/{chunk-sfg2wkhe.js → chunk-gxqaa4sv.js} +7 -7
  143. package/web/chunk-gxsb5tx3.js +1 -0
  144. package/web/{chunk-54thej0t.js → chunk-gyp6v7jd.js} +2 -2
  145. package/web/chunk-h0c42zy3.js +1 -0
  146. package/web/chunk-h2ag4kvz.js +2 -0
  147. package/web/{chunk-kmr7r9xj.js → chunk-h6gh63xj.js} +2 -2
  148. package/web/{chunk-6m69hczt.js → chunk-h6k1x096.js} +2 -2
  149. package/web/{chunk-24mfx6w1.js → chunk-j1bw5v1g.js} +2 -2
  150. package/web/chunk-j34q5jn6.js +1 -0
  151. package/web/{chunk-0pbjgdgp.js → chunk-ja7w629n.js} +2 -2
  152. package/web/{chunk-zbj1trar.js → chunk-jam45rqg.js} +2 -2
  153. package/web/{chunk-f4tacm06.js → chunk-jcdw85mv.js} +1 -1
  154. package/web/chunk-jfvxxp5c.js +1 -0
  155. package/web/chunk-jg6fmz2d.js +1 -0
  156. package/web/{chunk-92ssjk2y.js → chunk-k67v6dyg.js} +40 -40
  157. package/web/chunk-ka7c5rhx.js +99 -0
  158. package/web/{chunk-df5zx17h.js → chunk-kza0t0gj.js} +1 -1
  159. package/web/{chunk-0b47eyrf.js → chunk-m8knte9z.js} +1 -1
  160. package/web/{chunk-v5cnt7c8.js → chunk-mnzramhc.js} +1 -1
  161. package/web/{chunk-a408enpy.js → chunk-mpfgr049.js} +1 -1
  162. package/web/chunk-mz1dabxh.js +1 -0
  163. package/web/chunk-mz9b5bsa.js +1 -0
  164. package/web/chunk-p53n0hwr.js +1 -0
  165. package/web/chunk-paywgcf7.js +40 -0
  166. package/web/chunk-pfcnr9tw.js +1 -0
  167. package/web/chunk-pyg1mr80.js +303 -0
  168. package/web/chunk-q7xkscc5.js +1 -0
  169. package/web/{chunk-xzp7jf7e.js → chunk-qcge7d6s.js} +2 -2
  170. package/web/chunk-qmbgb79a.js +1139 -0
  171. package/web/{chunk-pjkdrgm0.js → chunk-qq5gh5zr.js} +1 -1
  172. package/web/chunk-qrdh9j62.js +1 -0
  173. package/web/{chunk-9t5dnjaz.js → chunk-s24qs1bn.js} +9 -9
  174. package/web/chunk-sd22cnjy.js +1 -0
  175. package/web/{chunk-ydtrc1ay.js → chunk-sd3cdqcm.js} +2 -2
  176. package/web/{chunk-rykfak98.js → chunk-sf101c23.js} +2 -2
  177. package/web/{chunk-1gbd61z0.js → chunk-sfq6cw45.js} +2 -2
  178. package/web/chunk-svqj4az8.js +1 -0
  179. package/web/chunk-t7jwyvvr.js +1 -0
  180. package/web/{chunk-rvrf0f3h.js → chunk-tcp77cp2.js} +2 -2
  181. package/web/chunk-tf18d2dk.css +1 -0
  182. package/web/chunk-thbqwq6b.js +1 -0
  183. package/web/chunk-v0g4cqc1.js +4 -0
  184. package/web/chunk-vhzys0rr.js +292 -0
  185. package/web/chunk-vnt34mkb.js +1 -0
  186. package/web/chunk-vqfz99ff.js +1 -0
  187. package/web/chunk-vttgyb5v.js +2 -0
  188. package/web/chunk-x7sb3bwf.js +370 -0
  189. package/web/chunk-xce8n339.js +1 -0
  190. package/web/{chunk-kwccs9f6.js → chunk-xk1t58c4.js} +12 -12
  191. package/web/chunk-xsrvw7dt.js +4 -0
  192. package/web/chunk-xtss82z2.js +1 -0
  193. package/web/{chunk-2j4m0bh1.js → chunk-y7jq61nv.js} +2 -2
  194. package/web/{chunk-1eg9sbbt.js → chunk-ybw6vgf6.js} +2 -2
  195. package/web/{chunk-ybrf9mhz.js → chunk-yvgs6bm3.js} +4 -4
  196. package/web/{chunk-b53bfkys.js → chunk-z4aj066q.js} +1 -1
  197. package/web/chunk-zazs8p6c.js +1 -0
  198. package/web/{chunk-aqfpnhmt.js → chunk-zc1mk10n.js} +19 -19
  199. package/web/{chunk-d11v5s7w.js → chunk-zqht0jzx.js} +6 -6
  200. package/web/{chunk-pz9ps2jm.js → chunk-zz397b0v.js} +12 -12
  201. package/web/index.html +1 -1
  202. package/worker.js +1 -1
  203. package/chunk-06hdzq5n.js +0 -2
  204. package/chunk-5dfbezv9.js +0 -2
  205. package/chunk-5x1sankd.js +0 -3753
  206. package/chunk-71h08f4g.js +0 -2
  207. package/chunk-7nzhdrv9.js +0 -2
  208. package/chunk-7q51n619.js +0 -2
  209. package/chunk-9mmz6wt3.js +0 -2
  210. package/chunk-bpw6q7g0.js +0 -3
  211. package/chunk-fvn32nzj.js +0 -478
  212. package/chunk-n6e43rvk.js +0 -3
  213. package/chunk-ry0z4ev6.js +0 -2
  214. package/chunk-vkpvcxjr.js +0 -2
  215. package/web/chunk-0rmkpsgp.js +0 -1
  216. package/web/chunk-0s80zw00.js +0 -1
  217. package/web/chunk-0xkyryrq.js +0 -1
  218. package/web/chunk-2s0bmrkv.js +0 -39
  219. package/web/chunk-2z1rwr28.js +0 -2
  220. package/web/chunk-344bq59c.js +0 -89
  221. package/web/chunk-3t0211rw.js +0 -1
  222. package/web/chunk-44rmrmcn.js +0 -1
  223. package/web/chunk-4bzqrwr0.js +0 -1139
  224. package/web/chunk-4jmazh6x.js +0 -370
  225. package/web/chunk-4re74xwm.js +0 -140
  226. package/web/chunk-4rm1vy7w.js +0 -1
  227. package/web/chunk-59kqahb3.js +0 -1
  228. package/web/chunk-5qtyq3ce.js +0 -292
  229. package/web/chunk-5z4jcqct.js +0 -200
  230. package/web/chunk-5z6x2n5h.js +0 -1
  231. package/web/chunk-6beqrmtq.js +0 -1
  232. package/web/chunk-6f5ke0x9.js +0 -1
  233. package/web/chunk-6xaqxcq8.js +0 -1
  234. package/web/chunk-7q6wvv2x.js +0 -1
  235. package/web/chunk-7qsa4p8h.js +0 -1
  236. package/web/chunk-8nja0ygy.js +0 -1
  237. package/web/chunk-8y64fkpz.js +0 -24
  238. package/web/chunk-9ad7v7bm.js +0 -8
  239. package/web/chunk-9dzxv335.js +0 -4
  240. package/web/chunk-a497tykb.js +0 -70
  241. package/web/chunk-b6k9w215.js +0 -2
  242. package/web/chunk-cjfssg3m.js +0 -2
  243. package/web/chunk-cqp1d4p0.js +0 -1
  244. package/web/chunk-dy2gm1fs.js +0 -1
  245. package/web/chunk-e0zre35a.js +0 -1
  246. package/web/chunk-e9twvs9n.js +0 -3
  247. package/web/chunk-f2kgtyfp.js +0 -1
  248. package/web/chunk-f8bn5tzf.js +0 -1
  249. package/web/chunk-f91wzwtk.js +0 -1
  250. package/web/chunk-fdp9bsj7.js +0 -1
  251. package/web/chunk-g1ev11wx.js +0 -1
  252. package/web/chunk-gmzqdm7v.js +0 -1
  253. package/web/chunk-hfaffkrh.js +0 -1
  254. package/web/chunk-j2vt8c8v.js +0 -1
  255. package/web/chunk-ka3q31t1.js +0 -1
  256. package/web/chunk-khxcn8tt.js +0 -106
  257. package/web/chunk-kqqmp1am.js +0 -1
  258. package/web/chunk-m2d1sp30.js +0 -1
  259. package/web/chunk-nbgqbxcy.js +0 -1
  260. package/web/chunk-ncpnpe9w.js +0 -99
  261. package/web/chunk-ne0v8mfb.js +0 -2
  262. package/web/chunk-ngx2cp8x.js +0 -2
  263. package/web/chunk-nxcgf7ec.js +0 -1
  264. package/web/chunk-p0kvmf28.js +0 -2
  265. package/web/chunk-p3k7m5nr.js +0 -1
  266. package/web/chunk-pggaffrh.js +0 -169
  267. package/web/chunk-pxe3vna4.js +0 -1
  268. package/web/chunk-qh15dxav.css +0 -1
  269. package/web/chunk-qpmbxhh6.js +0 -1
  270. package/web/chunk-r0rctnxz.js +0 -1
  271. package/web/chunk-rn3dnqm8.js +0 -1
  272. package/web/chunk-rtf2zzzv.js +0 -1
  273. package/web/chunk-srrfphes.js +0 -1
  274. package/web/chunk-tdr6x2xc.js +0 -1
  275. package/web/chunk-tncvg1nn.js +0 -1
  276. package/web/chunk-vyp0ns1f.js +0 -2
  277. package/web/chunk-wvdehm9y.js +0 -303
  278. package/web/chunk-x7ahcpj7.js +0 -1
  279. package/web/chunk-y38bf0wm.js +0 -1
  280. package/web/chunk-y56aaba5.js +0 -2
  281. package/web/chunk-ye58t45p.js +0 -4
  282. package/web/chunk-z1h20s8c.js +0 -78
  283. package/web/chunk-zj4q9jth.js +0 -36
  284. package/web/chunk-zj5k94dk.js +0 -40
  285. package/web/chunk-zqch0sc8.js +0 -30
  286. package/web/install.ps1 +0 -91
  287. package/web/install.sh +0 -177
@@ -1 +1 @@
1
- import{e,r,p}from"./chunk-wvdehm9y.js";import{lt,sr}from"./chunk-3re8y26v.js";import{Ce,Se}from"./chunk-4bzqrwr0.js";var k=Se(function(F,Y){(function(g,a){if(typeof F==="object"&&typeof Y==="object")Y.exports=a(sr());else if(typeof define==="function"&&define.amd)define(["cose-base"],a);else if(typeof F==="object")F.cytoscapeCoseBilkent=a(sr());else g.cytoscapeCoseBilkent=a(g.coseBase)})(F,function(u){return function(g){var a={};function n(o){if(a[o])return a[o].exports;var d=a[o]={i:o,l:!1,exports:{}};return g[o].call(d.exports,d,d.exports,n),d.l=!0,d.exports}return n.m=g,n.c=a,n.i=function(o){return o},n.d=function(o,d,l){if(!n.o(o,d))Object.defineProperty(o,d,{configurable:!1,enumerable:!0,get:l})},n.n=function(o){var d=o&&o.__esModule?function(){return o.default}:function(){return o};return n.d(d,"a",d),d},n.o=function(o,d){return Object.prototype.hasOwnProperty.call(o,d)},n.p="",n(n.s=1)}([function(g,a){g.exports=u},function(g,a,n){var o=n(0).layoutBase.LayoutConstants,d=n(0).layoutBase.FDLayoutConstants,l=n(0).CoSEConstants,L=n(0).CoSELayout,b=n(0).CoSENode,H=n(0).layoutBase.PointD,v=n(0).layoutBase.DimensionD,_={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:0.45,nestingFactor:0.1,gravity:0.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:0.5};function D(E,t){var f={};for(var s in E)f[s]=E[s];for(var s in t)f[s]=t[s];return f}function I(E){this.options=D(_,E),U(this.options)}var U=function(t){if(t.nodeRepulsion!=null)l.DEFAULT_REPULSION_STRENGTH=d.DEFAULT_REPULSION_STRENGTH=t.nodeRepulsion;if(t.idealEdgeLength!=null)l.DEFAULT_EDGE_LENGTH=d.DEFAULT_EDGE_LENGTH=t.idealEdgeLength;if(t.edgeElasticity!=null)l.DEFAULT_SPRING_STRENGTH=d.DEFAULT_SPRING_STRENGTH=t.edgeElasticity;if(t.nestingFactor!=null)l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=t.nestingFactor;if(t.gravity!=null)l.DEFAULT_GRAVITY_STRENGTH=d.DEFAULT_GRAVITY_STRENGTH=t.gravity;if(t.numIter!=null)l.MAX_ITERATIONS=d.MAX_ITERATIONS=t.numIter;if(t.gravityRange!=null)l.DEFAULT_GRAVITY_RANGE_FACTOR=d.DEFAULT_GRAVITY_RANGE_FACTOR=t.gravityRange;if(t.gravityCompound!=null)l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH=t.gravityCompound;if(t.gravityRangeCompound!=null)l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=t.gravityRangeCompound;if(t.initialEnergyOnIncremental!=null)l.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.DEFAULT_COOLING_FACTOR_INCREMENTAL=t.initialEnergyOnIncremental;if(t.quality=="draft")o.QUALITY=0;else if(t.quality=="proof")o.QUALITY=2;else o.QUALITY=1;l.NODE_DIMENSIONS_INCLUDE_LABELS=d.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=t.nodeDimensionsIncludeLabels,l.DEFAULT_INCREMENTAL=d.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!t.randomize,l.ANIMATE=d.ANIMATE=o.ANIMATE=t.animate,l.TILE=t.tile,l.TILING_PADDING_VERTICAL=typeof t.tilingPaddingVertical==="function"?t.tilingPaddingVertical.call():t.tilingPaddingVertical,l.TILING_PADDING_HORIZONTAL=typeof t.tilingPaddingHorizontal==="function"?t.tilingPaddingHorizontal.call():t.tilingPaddingHorizontal};I.prototype.run=function(){var E,t,f=this.options,s=this.idToLNode={},c=this.layout=new L,i=this;i.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var y=c.newGraphManager();this.gm=y;var T=this.options.eles.nodes(),m=this.options.eles.edges();this.root=y.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(T),c);for(var h=0;h<m.length;h++){var P=m[h],x=this.idToLNode[P.data("source")],O=this.idToLNode[P.data("target")];if(x!==O&&x.getEdgesBetween(O).length==0){var et=y.add(c.newEdge(),x,O);et.id=P.id()}}var V=function(R,B){if(typeof R==="number")R=B;var C=R.data("id"),G=i.idToLNode[C];return{x:G.getRect().getCenterX(),y:G.getRect().getCenterY()}},nt=function X(){var R=function(){if(f.fit)f.cy.fit(f.eles,f.padding);if(!E)E=!0,i.cy.one("layoutready",f.ready),i.cy.trigger({type:"layoutready",layout:i})},B=i.options.refresh,C;for(var G=0;G<B&&!C;G++)C=i.stopped||i.layout.tick();if(C){if(c.checkLayoutSuccess()&&!c.isSubLayout)c.doPostLayout();if(c.tilingPostLayout)c.tilingPostLayout();if(c.isLayoutFinished=!0,i.options.eles.nodes().positions(V),R(),i.cy.one("layoutstop",i.options.stop),i.cy.trigger({type:"layoutstop",layout:i}),t)cancelAnimationFrame(t);E=!1;return}var M=i.layout.getPositionsData();f.eles.nodes().positions(function(A,it){if(typeof A==="number")A=it;if(!A.isParent()){var j=A.id(),N=M[j],w=A;while(N==null)if(N=M[w.data("parent")]||M["DummyCompound_"+w.data("parent")],M[j]=N,w=w.parent()[0],w==null)break;if(N!=null)return{x:N.x,y:N.y};else return{x:A.position("x"),y:A.position("y")}}}),R(),t=requestAnimationFrame(X)};if(c.addListener("layoutstarted",function(){if(i.options.animate==="during")t=requestAnimationFrame(nt)}),c.runLayout(),this.options.animate!=="during")i.options.eles.nodes().not(":parent").layoutPositions(i,i.options,V),E=!1;return this},I.prototype.getTopMostNodes=function(E){var t={};for(var f=0;f<E.length;f++)t[E[f].id()]=!0;var s=E.filter(function(c,i){if(typeof c==="number")c=i;var y=c.parent()[0];while(y!=null){if(t[y.id()])return!1;y=y.parent()[0]}return!0});return s},I.prototype.processChildrenList=function(E,t,f){var s=t.length;for(var c=0;c<s;c++){var i=t[c],y=i.children(),T,m=i.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(i.outerWidth()!=null&&i.outerHeight()!=null)T=E.add(new b(f.graphManager,new H(i.position("x")-m.w/2,i.position("y")-m.h/2),new v(parseFloat(m.w),parseFloat(m.h))));else T=E.add(new b(this.graphManager));if(T.id=i.data("id"),T.paddingLeft=parseInt(i.css("padding")),T.paddingTop=parseInt(i.css("padding")),T.paddingRight=parseInt(i.css("padding")),T.paddingBottom=parseInt(i.css("padding")),this.options.nodeDimensionsIncludeLabels){if(i.isParent()){var h=i.boundingBox({includeLabels:!0,includeNodes:!1}).w,P=i.boundingBox({includeLabels:!0,includeNodes:!1}).h,x=i.css("text-halign");T.labelWidth=h,T.labelHeight=P,T.labelPos=x}}if(this.idToLNode[i.data("id")]=T,isNaN(T.rect.x))T.rect.x=0;if(isNaN(T.rect.y))T.rect.y=0;if(y!=null&&y.length>0){var O=f.getGraphManager().add(f.newGraph(),T);this.processChildrenList(O,y,f)}}},I.prototype.stop=function(){return this.stopped=!0,this};var S=function(t){t("layout","cose-bilkent",I)};if(typeof cytoscape<"u")S(cytoscape);g.exports=S}])})});var z=Ce(k(),1);lt.use(z.default);function q(u,g){u.forEach((a)=>{let n={id:a.id,labelText:a.label,height:a.height,width:a.width,padding:a.padding??0};Object.keys(a).forEach((o)=>{if(!["id","label","height","width","padding","x","y"].includes(o))n[o]=a[o]}),g.add({group:"nodes",data:n,position:{x:a.x??0,y:a.y??0}})})}e(q,"addNodes");function W(u,g){u.forEach((a)=>{let n={id:a.id,source:a.start,target:a.end};Object.keys(a).forEach((o)=>{if(!["id","start","end"].includes(o))n[o]=a[o]}),g.add({group:"edges",data:n})})}e(W,"addEdges");function Q(u){return new Promise((g)=>{let a=p("body").append("div").attr("id","cy").attr("style","display:none"),n=lt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});a.remove(),q(u.nodes,n),W(u.edges,n),n.nodes().forEach(function(d){d.layoutDimensions=()=>{let l=d.data();return{w:l.width,h:l.height}}});let o={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};n.layout(o).run(),n.ready((d)=>{r.info("Cytoscape ready",d),g(n)})})}e(Q,"createCytoscapeInstance");function Z(u){return u.nodes().map((g)=>{let a=g.data(),n=g.position(),o={id:a.id,x:n.x,y:n.y};return Object.keys(a).forEach((d)=>{if(d!=="id")o[d]=a[d]}),o})}e(Z,"extractPositionedNodes");function J(u){return u.edges().map((g)=>{let a=g.data(),n=g._private.rscratch,o={id:a.id,source:a.source,target:a.target,startX:n.startX,startY:n.startY,midX:n.midX,midY:n.midY,endX:n.endX,endY:n.endY};return Object.keys(a).forEach((d)=>{if(!["id","source","target"].includes(d))o[d]=a[d]}),o})}e(J,"extractPositionedEdges");async function K(u,g){r.debug("Starting cose-bilkent layout algorithm");try{tt(u);let a=await Q(u),n=Z(a),o=J(a);return r.debug(`Layout completed: ${n.length} nodes, ${o.length} edges`),{nodes:n,edges:o}}catch(a){throw r.error("Error in cose-bilkent layout algorithm:",a),a}}e(K,"executeCoseBilkentLayout");function tt(u){if(!u)throw Error("Layout data is required");if(!u.config)throw Error("Configuration is required in layout data");if(!u.rootNode)throw Error("Root node is required");if(!u.nodes||!Array.isArray(u.nodes))throw Error("No nodes found in layout data");if(!Array.isArray(u.edges))throw Error("Edges array is required in layout data");return!0}e(tt,"validateLayoutData");var at=e(async(u,g,{insertCluster:a,insertEdge:n,insertEdgeLabel:o,insertMarkers:d,insertNode:l,log:L,positionEdgeLabel:b},{algorithm:H})=>{let v={},_={},D=g.select("g");d(D,u.markers,u.type,u.diagramId);let I=D.insert("g").attr("class","subgraphs"),U=D.insert("g").attr("class","edgePaths"),S=D.insert("g").attr("class","edgeLabels"),E=D.insert("g").attr("class","nodes");L.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(u.nodes.map(async(s)=>{if(s.isGroup){let c={...s};_[s.id]=c,v[s.id]=c,await a(I,s)}else{let c={...s};v[s.id]=c;let i=await l(E,s,{config:u.config,dir:u.direction||"TB"}),y=i.node().getBBox();c.width=y.width,c.height=y.height,c.domId=i,L.debug(`Node ${s.id} dimensions: ${y.width}x${y.height}`)}})),L.debug("Running cose-bilkent layout algorithm");let t={...u,nodes:u.nodes.map((s)=>{let c=v[s.id];return{...s,width:c.width,height:c.height}})},f=await K(t,u.config);L.debug("Positioning nodes based on layout results"),f.nodes.forEach((s)=>{let c=v[s.id];if(c?.domId)c.domId.attr("transform",`translate(${s.x}, ${s.y})`),c.x=s.x,c.y=s.y,L.debug(`Positioned node ${c.id} at center (${s.x}, ${s.y})`)}),f.edges.forEach((s)=>{let c=u.edges.find((i)=>i.id===s.id);if(c)c.points=[{x:s.startX,y:s.startY},{x:s.midX,y:s.midY},{x:s.endX,y:s.endY}]}),L.debug("Inserting and positioning edges"),await Promise.all(u.edges.map(async(s)=>{let c=await o(S,s),i=v[s.start??""],y=v[s.end??""];if(i&&y){let T=f.edges.find((m)=>m.id===s.id);if(T){L.debug("APA01 positionedEdge",T);let m={...s},h=n(U,m,_,u.type,i,y,u.diagramId);b(m,h)}else{let m={...s,points:[{x:i.x||0,y:i.y||0},{x:y.x||0,y:y.y||0}]},h=n(U,m,_,u.type,i,y,u.diagramId);b(m,h)}}})),L.debug("Cose-bilkent rendering completed")},"render"),ct=at;export{ct as render};
1
+ import{e,a,p}from"./chunk-pyg1mr80.js";import{ct,lr}from"./chunk-892nf39p.js";import{Se,Te}from"./chunk-qmbgb79a.js";var k=Te(function(F,Y){(function(g,r){if(typeof F==="object"&&typeof Y==="object")Y.exports=r(lr());else if(typeof define==="function"&&define.amd)define(["cose-base"],r);else if(typeof F==="object")F.cytoscapeCoseBilkent=r(lr());else g.cytoscapeCoseBilkent=r(g.coseBase)})(F,function(u){return function(g){var r={};function n(o){if(r[o])return r[o].exports;var d=r[o]={i:o,l:!1,exports:{}};return g[o].call(d.exports,d,d.exports,n),d.l=!0,d.exports}return n.m=g,n.c=r,n.i=function(o){return o},n.d=function(o,d,l){if(!n.o(o,d))Object.defineProperty(o,d,{configurable:!1,enumerable:!0,get:l})},n.n=function(o){var d=o&&o.__esModule?function(){return o.default}:function(){return o};return n.d(d,"a",d),d},n.o=function(o,d){return Object.prototype.hasOwnProperty.call(o,d)},n.p="",n(n.s=1)}([function(g,r){g.exports=u},function(g,r,n){var o=n(0).layoutBase.LayoutConstants,d=n(0).layoutBase.FDLayoutConstants,l=n(0).CoSEConstants,L=n(0).CoSELayout,b=n(0).CoSENode,H=n(0).layoutBase.PointD,v=n(0).layoutBase.DimensionD,_={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:0.45,nestingFactor:0.1,gravity:0.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:0.5};function D(E,t){var f={};for(var s in E)f[s]=E[s];for(var s in t)f[s]=t[s];return f}function I(E){this.options=D(_,E),U(this.options)}var U=function(t){if(t.nodeRepulsion!=null)l.DEFAULT_REPULSION_STRENGTH=d.DEFAULT_REPULSION_STRENGTH=t.nodeRepulsion;if(t.idealEdgeLength!=null)l.DEFAULT_EDGE_LENGTH=d.DEFAULT_EDGE_LENGTH=t.idealEdgeLength;if(t.edgeElasticity!=null)l.DEFAULT_SPRING_STRENGTH=d.DEFAULT_SPRING_STRENGTH=t.edgeElasticity;if(t.nestingFactor!=null)l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=t.nestingFactor;if(t.gravity!=null)l.DEFAULT_GRAVITY_STRENGTH=d.DEFAULT_GRAVITY_STRENGTH=t.gravity;if(t.numIter!=null)l.MAX_ITERATIONS=d.MAX_ITERATIONS=t.numIter;if(t.gravityRange!=null)l.DEFAULT_GRAVITY_RANGE_FACTOR=d.DEFAULT_GRAVITY_RANGE_FACTOR=t.gravityRange;if(t.gravityCompound!=null)l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH=t.gravityCompound;if(t.gravityRangeCompound!=null)l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=t.gravityRangeCompound;if(t.initialEnergyOnIncremental!=null)l.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.DEFAULT_COOLING_FACTOR_INCREMENTAL=t.initialEnergyOnIncremental;if(t.quality=="draft")o.QUALITY=0;else if(t.quality=="proof")o.QUALITY=2;else o.QUALITY=1;l.NODE_DIMENSIONS_INCLUDE_LABELS=d.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=t.nodeDimensionsIncludeLabels,l.DEFAULT_INCREMENTAL=d.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!t.randomize,l.ANIMATE=d.ANIMATE=o.ANIMATE=t.animate,l.TILE=t.tile,l.TILING_PADDING_VERTICAL=typeof t.tilingPaddingVertical==="function"?t.tilingPaddingVertical.call():t.tilingPaddingVertical,l.TILING_PADDING_HORIZONTAL=typeof t.tilingPaddingHorizontal==="function"?t.tilingPaddingHorizontal.call():t.tilingPaddingHorizontal};I.prototype.run=function(){var E,t,f=this.options,s=this.idToLNode={},c=this.layout=new L,i=this;i.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var y=c.newGraphManager();this.gm=y;var T=this.options.eles.nodes(),m=this.options.eles.edges();this.root=y.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(T),c);for(var h=0;h<m.length;h++){var P=m[h],x=this.idToLNode[P.data("source")],O=this.idToLNode[P.data("target")];if(x!==O&&x.getEdgesBetween(O).length==0){var et=y.add(c.newEdge(),x,O);et.id=P.id()}}var V=function(R,B){if(typeof R==="number")R=B;var C=R.data("id"),G=i.idToLNode[C];return{x:G.getRect().getCenterX(),y:G.getRect().getCenterY()}},nt=function X(){var R=function(){if(f.fit)f.cy.fit(f.eles,f.padding);if(!E)E=!0,i.cy.one("layoutready",f.ready),i.cy.trigger({type:"layoutready",layout:i})},B=i.options.refresh,C;for(var G=0;G<B&&!C;G++)C=i.stopped||i.layout.tick();if(C){if(c.checkLayoutSuccess()&&!c.isSubLayout)c.doPostLayout();if(c.tilingPostLayout)c.tilingPostLayout();if(c.isLayoutFinished=!0,i.options.eles.nodes().positions(V),R(),i.cy.one("layoutstop",i.options.stop),i.cy.trigger({type:"layoutstop",layout:i}),t)cancelAnimationFrame(t);E=!1;return}var M=i.layout.getPositionsData();f.eles.nodes().positions(function(A,it){if(typeof A==="number")A=it;if(!A.isParent()){var j=A.id(),N=M[j],w=A;while(N==null)if(N=M[w.data("parent")]||M["DummyCompound_"+w.data("parent")],M[j]=N,w=w.parent()[0],w==null)break;if(N!=null)return{x:N.x,y:N.y};else return{x:A.position("x"),y:A.position("y")}}}),R(),t=requestAnimationFrame(X)};if(c.addListener("layoutstarted",function(){if(i.options.animate==="during")t=requestAnimationFrame(nt)}),c.runLayout(),this.options.animate!=="during")i.options.eles.nodes().not(":parent").layoutPositions(i,i.options,V),E=!1;return this},I.prototype.getTopMostNodes=function(E){var t={};for(var f=0;f<E.length;f++)t[E[f].id()]=!0;var s=E.filter(function(c,i){if(typeof c==="number")c=i;var y=c.parent()[0];while(y!=null){if(t[y.id()])return!1;y=y.parent()[0]}return!0});return s},I.prototype.processChildrenList=function(E,t,f){var s=t.length;for(var c=0;c<s;c++){var i=t[c],y=i.children(),T,m=i.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(i.outerWidth()!=null&&i.outerHeight()!=null)T=E.add(new b(f.graphManager,new H(i.position("x")-m.w/2,i.position("y")-m.h/2),new v(parseFloat(m.w),parseFloat(m.h))));else T=E.add(new b(this.graphManager));if(T.id=i.data("id"),T.paddingLeft=parseInt(i.css("padding")),T.paddingTop=parseInt(i.css("padding")),T.paddingRight=parseInt(i.css("padding")),T.paddingBottom=parseInt(i.css("padding")),this.options.nodeDimensionsIncludeLabels){if(i.isParent()){var h=i.boundingBox({includeLabels:!0,includeNodes:!1}).w,P=i.boundingBox({includeLabels:!0,includeNodes:!1}).h,x=i.css("text-halign");T.labelWidth=h,T.labelHeight=P,T.labelPos=x}}if(this.idToLNode[i.data("id")]=T,isNaN(T.rect.x))T.rect.x=0;if(isNaN(T.rect.y))T.rect.y=0;if(y!=null&&y.length>0){var O=f.getGraphManager().add(f.newGraph(),T);this.processChildrenList(O,y,f)}}},I.prototype.stop=function(){return this.stopped=!0,this};var S=function(t){t("layout","cose-bilkent",I)};if(typeof cytoscape<"u")S(cytoscape);g.exports=S}])})});var z=Se(k(),1);ct.use(z.default);function q(u,g){u.forEach((r)=>{let n={id:r.id,labelText:r.label,height:r.height,width:r.width,padding:r.padding??0};Object.keys(r).forEach((o)=>{if(!["id","label","height","width","padding","x","y"].includes(o))n[o]=r[o]}),g.add({group:"nodes",data:n,position:{x:r.x??0,y:r.y??0}})})}e(q,"addNodes");function W(u,g){u.forEach((r)=>{let n={id:r.id,source:r.start,target:r.end};Object.keys(r).forEach((o)=>{if(!["id","start","end"].includes(o))n[o]=r[o]}),g.add({group:"edges",data:n})})}e(W,"addEdges");function Q(u){return new Promise((g)=>{let r=p("body").append("div").attr("id","cy").attr("style","display:none"),n=ct({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});r.remove(),q(u.nodes,n),W(u.edges,n),n.nodes().forEach(function(d){d.layoutDimensions=()=>{let l=d.data();return{w:l.width,h:l.height}}});let o={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};n.layout(o).run(),n.ready((d)=>{a.info("Cytoscape ready",d),g(n)})})}e(Q,"createCytoscapeInstance");function Z(u){return u.nodes().map((g)=>{let r=g.data(),n=g.position(),o={id:r.id,x:n.x,y:n.y};return Object.keys(r).forEach((d)=>{if(d!=="id")o[d]=r[d]}),o})}e(Z,"extractPositionedNodes");function J(u){return u.edges().map((g)=>{let r=g.data(),n=g._private.rscratch,o={id:r.id,source:r.source,target:r.target,startX:n.startX,startY:n.startY,midX:n.midX,midY:n.midY,endX:n.endX,endY:n.endY};return Object.keys(r).forEach((d)=>{if(!["id","source","target"].includes(d))o[d]=r[d]}),o})}e(J,"extractPositionedEdges");async function K(u,g){a.debug("Starting cose-bilkent layout algorithm");try{tt(u);let r=await Q(u),n=Z(r),o=J(r);return a.debug(`Layout completed: ${n.length} nodes, ${o.length} edges`),{nodes:n,edges:o}}catch(r){throw a.error("Error in cose-bilkent layout algorithm:",r),r}}e(K,"executeCoseBilkentLayout");function tt(u){if(!u)throw Error("Layout data is required");if(!u.config)throw Error("Configuration is required in layout data");if(!u.rootNode)throw Error("Root node is required");if(!u.nodes||!Array.isArray(u.nodes))throw Error("No nodes found in layout data");if(!Array.isArray(u.edges))throw Error("Edges array is required in layout data");return!0}e(tt,"validateLayoutData");var at=e(async(u,g,{insertCluster:r,insertEdge:n,insertEdgeLabel:o,insertMarkers:d,insertNode:l,log:L,positionEdgeLabel:b},{algorithm:H})=>{let v={},_={},D=g.select("g");d(D,u.markers,u.type,u.diagramId);let I=D.insert("g").attr("class","subgraphs"),U=D.insert("g").attr("class","edgePaths"),S=D.insert("g").attr("class","edgeLabels"),E=D.insert("g").attr("class","nodes");L.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(u.nodes.map(async(s)=>{if(s.isGroup){let c={...s};_[s.id]=c,v[s.id]=c,await r(I,s)}else{let c={...s};v[s.id]=c;let i=await l(E,s,{config:u.config,dir:u.direction||"TB"}),y=i.node().getBBox();c.width=y.width,c.height=y.height,c.domId=i,L.debug(`Node ${s.id} dimensions: ${y.width}x${y.height}`)}})),L.debug("Running cose-bilkent layout algorithm");let t={...u,nodes:u.nodes.map((s)=>{let c=v[s.id];return{...s,width:c.width,height:c.height}})},f=await K(t,u.config);L.debug("Positioning nodes based on layout results"),f.nodes.forEach((s)=>{let c=v[s.id];if(c?.domId)c.domId.attr("transform",`translate(${s.x}, ${s.y})`),c.x=s.x,c.y=s.y,L.debug(`Positioned node ${c.id} at center (${s.x}, ${s.y})`)}),f.edges.forEach((s)=>{let c=u.edges.find((i)=>i.id===s.id);if(c)c.points=[{x:s.startX,y:s.startY},{x:s.midX,y:s.midY},{x:s.endX,y:s.endY}]}),L.debug("Inserting and positioning edges"),await Promise.all(u.edges.map(async(s)=>{let c=await o(S,s),i=v[s.start??""],y=v[s.end??""];if(i&&y){let T=f.edges.find((m)=>m.id===s.id);if(T){L.debug("APA01 positionedEdge",T);let m={...s},h=n(U,m,_,u.type,i,y,u.diagramId);b(m,h)}else{let m={...s,points:[{x:i.x||0,y:i.y||0},{x:y.x||0,y:y.y||0}]},h=n(U,m,_,u.type,i,y,u.diagramId);b(m,h)}}})),L.debug("Cose-bilkent rendering completed")},"render"),ut=at;export{ut as render};
@@ -1 +1 @@
1
- import{h,o,i,a,t,n,_,Z,te,rt,vt}from"./chunk-4bzqrwr0.js";import{gn}from"./chunk-ngx2cp8x.js";var I={config:"自定义路径",env:"环境变量",system:"系统预装"};function L({connection:p,onClose:S}){let{Button:m,Input:O,Switch:C,SettingGroup:N,SettingRow:v,cn:w}=_(),[b,B]=a({}),[r,g]=a({}),[l,y]=a(null),[u,A]=a(!0),[k,z]=a(!1),[d,R]=a(!1),[f,c]=a(null),P=i(null),q=(r.executable??"")!==(b.executable??"")||Boolean(r.noSandbox)!==Boolean(b.noSandbox)||Boolean(r.ignoreCertErrors)!==Boolean(b.ignoreCertErrors),E=h(async(e)=>{z(!0);try{let s=await p.request("/api/plugins/browser/status",{signal:e});y(s)}catch(s){if(!e?.aborted)y({available:!1,error:s instanceof Error?s.message:"无法获取浏览器状态"})}finally{if(!e?.aborted)z(!1)}},[p]);o(()=>{let e=new AbortController;return P.current=e,Promise.all([p.request("/api/plugins/browser/settings",{signal:e.signal}),p.request("/api/plugins/browser/status",{signal:e.signal})]).then(([s,x])=>{if(!e.signal.aborted)B(s),g(s),y(x)}).catch((s)=>{if(!e.signal.aborted)c({type:"error",text:s instanceof Error?s.message:"读取浏览器设置失败"})}).finally(()=>{if(!e.signal.aborted)A(!1)}),()=>e.abort()},[p]);let T=async(e)=>{if(e?.preventDefault(),d||u)return;let s=new AbortController;R(!0),c(null);try{if(await p.request("/api/plugins/browser/settings",{method:"PATCH",signal:s.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),!s.signal.aborted)B(r),c({type:"success",text:"设置已保存,将在浏览器进程下次启动时生效。"}),await E(s.signal)}catch(x){if(!s.signal.aborted)c({type:"error",text:x instanceof Error?x.message:"保存设置失败"})}finally{if(!s.signal.aborted)R(!1)}},G=()=>{g(b),c(null)};return n("div",{className:"min-w-0 space-y-6",children:[t(N,{title:"运行环境",action:n(m,{size:"sm",variant:"ghost",disabled:u||k,onClick:()=>void E(),className:"h-8 px-2.5 text-xs text-dim hover:text-ink",children:[t(te,{className:w("mr-1.5 size-3.5",k&&"animate-spin")}),"重新检测"]}),children:t("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex items-center gap-2",children:[t("span",{className:w("size-2 shrink-0 rounded-full",l?.available?"bg-success shadow-[0_0_8px_var(--color-success)]":"bg-danger")}),t("span",{className:"text-sm font-medium text-ink",children:l?l.available?"浏览器可用":"未检测到可用浏览器":"正在检测…"}),l?.available&&l.source&&t("span",{className:"rounded-md bg-raised px-2 py-0.5 text-xs text-dim",children:I[l.source]??l.source})]}),l&&!l.available&&l.error&&t("p",{className:"mt-2 text-xs leading-5 text-danger",children:l.error})]})})}),n("form",{onSubmit:T,children:[n(N,{title:"启动参数",children:[t(v,{vertical:!0,title:"可执行文件路径",children:n("div",{className:"flex gap-2",children:[t(O,{id:"browser-executable",disabled:u||d,value:r.executable??"",placeholder:"留空自动探测系统浏览器",onChange:(e)=>{g({...r,executable:e.target.value}),c(null)}}),r.executable&&t(m,{type:"button",variant:"ghost",size:"sm",disabled:u||d,onClick:()=>{g({...r,executable:""}),c(null)},className:"shrink-0",children:"清空"})]})}),t(v,{title:"禁用沙箱 (--no-sandbox)",description:"容器或 root 环境使用",children:t(C,{label:"禁用沙箱",disabled:u||d,checked:r.noSandbox??!1,onCheckedChange:(e)=>{g({...r,noSandbox:e}),c(null)}})}),t(v,{title:"忽略证书错误 (--ignore-certificate-errors)",description:"跳过自签名与证书有效性检查",children:t(C,{label:"忽略证书错误",disabled:u||d,checked:r.ignoreCertErrors??!1,onCheckedChange:(e)=>{g({...r,ignoreCertErrors:e}),c(null)}})})]}),n("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3 px-0.5",children:[t("div",{className:"min-w-0 flex-1",children:f&&n("div",{className:w("flex items-center gap-2 text-xs",f.type==="success"?"text-success":"text-danger"),children:[f.type==="success"?t(gn,{className:"size-3.5 shrink-0"}):t(Z,{className:"size-3.5 shrink-0"}),t("span",{children:f.text})]})}),n("div",{className:"flex items-center gap-2",children:[q&&n(m,{type:"button",variant:"ghost",size:"sm",disabled:u||d,onClick:G,children:[t(rt,{className:"mr-1.5 size-3.5"}),"重置"]}),n(m,{type:"submit",variant:"primary",size:"sm",disabled:u||d,children:[t(vt,{className:"mr-1.5 size-3.5"}),d?"保存中…":"保存"]}),S&&t(m,{type:"button",variant:"secondary",size:"sm",onClick:S,children:"关闭"})]})]})]})]})}export{L as default};
1
+ import{h,o,i,r,t,n,_,Z,ae,rt,bt}from"./chunk-qmbgb79a.js";import{vn}from"./chunk-vttgyb5v.js";var I={config:"自定义路径",env:"环境变量",system:"系统预装"};function L({connection:p,onClose:S}){let{Button:m,Input:O,Switch:C,SettingGroup:N,SettingRow:v,cn:w}=_(),[b,B]=r({}),[a,g]=r({}),[l,y]=r(null),[u,A]=r(!0),[k,z]=r(!1),[d,R]=r(!1),[f,c]=r(null),P=i(null),q=(a.executable??"")!==(b.executable??"")||Boolean(a.noSandbox)!==Boolean(b.noSandbox)||Boolean(a.ignoreCertErrors)!==Boolean(b.ignoreCertErrors),E=h(async(e)=>{z(!0);try{let s=await p.request("/api/plugins/browser/status",{signal:e});y(s)}catch(s){if(!e?.aborted)y({available:!1,error:s instanceof Error?s.message:"无法获取浏览器状态"})}finally{if(!e?.aborted)z(!1)}},[p]);o(()=>{let e=new AbortController;return P.current=e,Promise.all([p.request("/api/plugins/browser/settings",{signal:e.signal}),p.request("/api/plugins/browser/status",{signal:e.signal})]).then(([s,x])=>{if(!e.signal.aborted)B(s),g(s),y(x)}).catch((s)=>{if(!e.signal.aborted)c({type:"error",text:s instanceof Error?s.message:"读取浏览器设置失败"})}).finally(()=>{if(!e.signal.aborted)A(!1)}),()=>e.abort()},[p]);let T=async(e)=>{if(e?.preventDefault(),d||u)return;let s=new AbortController;R(!0),c(null);try{if(await p.request("/api/plugins/browser/settings",{method:"PATCH",signal:s.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),!s.signal.aborted)B(a),c({type:"success",text:"设置已保存,将在浏览器进程下次启动时生效。"}),await E(s.signal)}catch(x){if(!s.signal.aborted)c({type:"error",text:x instanceof Error?x.message:"保存设置失败"})}finally{if(!s.signal.aborted)R(!1)}},G=()=>{g(b),c(null)};return n("div",{className:"min-w-0 space-y-6",children:[t(N,{title:"运行环境",action:n(m,{size:"sm",variant:"ghost",disabled:u||k,onClick:()=>void E(),className:"h-8 px-2.5 text-xs text-dim hover:text-ink",children:[t(ae,{className:w("mr-1.5 size-3.5",k&&"animate-spin")}),"重新检测"]}),children:t("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex items-center gap-2",children:[t("span",{className:w("size-2 shrink-0 rounded-full",l?.available?"bg-success shadow-[0_0_8px_var(--color-success)]":"bg-danger")}),t("span",{className:"text-sm font-medium text-ink",children:l?l.available?"浏览器可用":"未检测到可用浏览器":"正在检测…"}),l?.available&&l.source&&t("span",{className:"rounded-md bg-raised px-2 py-0.5 text-xs text-dim",children:I[l.source]??l.source})]}),l&&!l.available&&l.error&&t("p",{className:"mt-2 text-xs leading-5 text-danger",children:l.error})]})})}),n("form",{onSubmit:T,children:[n(N,{title:"启动参数",children:[t(v,{vertical:!0,title:"可执行文件路径",children:n("div",{className:"flex gap-2",children:[t(O,{id:"browser-executable",disabled:u||d,value:a.executable??"",placeholder:"留空自动探测系统浏览器",onChange:(e)=>{g({...a,executable:e.target.value}),c(null)}}),a.executable&&t(m,{type:"button",variant:"ghost",size:"sm",disabled:u||d,onClick:()=>{g({...a,executable:""}),c(null)},className:"shrink-0",children:"清空"})]})}),t(v,{title:"禁用沙箱 (--no-sandbox)",description:"容器或 root 环境使用",children:t(C,{label:"禁用沙箱",disabled:u||d,checked:a.noSandbox??!1,onCheckedChange:(e)=>{g({...a,noSandbox:e}),c(null)}})}),t(v,{title:"忽略证书错误 (--ignore-certificate-errors)",description:"跳过自签名与证书有效性检查",children:t(C,{label:"忽略证书错误",disabled:u||d,checked:a.ignoreCertErrors??!1,onCheckedChange:(e)=>{g({...a,ignoreCertErrors:e}),c(null)}})})]}),n("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3 px-0.5",children:[t("div",{className:"min-w-0 flex-1",children:f&&n("div",{className:w("flex items-center gap-2 text-xs",f.type==="success"?"text-success":"text-danger"),children:[f.type==="success"?t(vn,{className:"size-3.5 shrink-0"}):t(Z,{className:"size-3.5 shrink-0"}),t("span",{children:f.text})]})}),n("div",{className:"flex items-center gap-2",children:[q&&n(m,{type:"button",variant:"ghost",size:"sm",disabled:u||d,onClick:G,children:[t(rt,{className:"mr-1.5 size-3.5"}),"重置"]}),n(m,{type:"submit",variant:"primary",size:"sm",disabled:u||d,children:[t(bt,{className:"mr-1.5 size-3.5"}),d?"保存中…":"保存"]}),S&&t(m,{type:"button",variant:"secondary",size:"sm",onClick:S,children:"关闭"})]})]})]})]})}export{L as default};
@@ -0,0 +1,2 @@
1
+ import{r,y,t,n,_,s,Z,re,er}from"./chunk-qmbgb79a.js";var u=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],c=s("code-xml",u);function zr(e){let i=_();i.useTheme();let[m,d]=r("preview"),o=e.streaming&&!e.rendered,l=!e.streaming&&!e.rendered&&Boolean(e.error),a=m==="code"||o;return n(i.Panel,{"aria-label":e.title,"data-render-pending":e.pending&&!l?"true":void 0,className:"group/graph relative my-4 font-sans not-italic first:mt-0 last:mb-0",children:[t("div",{role:"toolbar","aria-label":`${e.title}操作`,className:o?"absolute top-2 right-2 z-10 flex items-center":i.style("surface.toolbarFloating","absolute top-2 right-2 z-10 opacity-0 transition-opacity duration-150 group-hover/graph:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-70"),children:o?n("span",{className:i.style("control.badge","gap-1.5 rounded-full px-2 py-0.5 text-[11px]"),children:[t(re,{className:"size-3 animate-spin"}),"生成",e.title]}):n(y,{children:[t("button",{type:"button","aria-label":a?"查看图表":"查看代码",title:a?"查看图表":"查看代码",onClick:()=>d(a?"preview":"code"),className:"flex size-6 items-center justify-center rounded-md text-dim hover:bg-raised hover:text-ink [&_svg]:size-3.5",children:a?t(er,{}):t(c,{})}),t(i.CopyButton,{text:e.code,size:"icon-sm",label:"复制代码"})]})}),a&&t(i.Code,{code:e.code,lang:e.codeLang,className:"px-4 py-3"}),l&&!a&&n("div",{role:"alert",className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:[t(Z,{className:"size-5 text-warning"}),t("p",{className:"max-w-full text-xs break-words text-dim",children:e.error}),t("button",{type:"button",onClick:()=>d("code"),className:"text-xs text-accent-strong underline underline-offset-2",children:"查看代码"})]}),t("div",{hidden:a||l,children:e.children})]})}
2
+ export{zr};
@@ -1,6 +1,6 @@
1
- import{Qr,ii,Mn,Nr,oi,si,pn}from"./chunk-4bzqrwr0.js";var S=class extends Error{constructor(t){super(t);this.name="ShikiError"}};function tn(t){return Ne(t)}function Ne(t){if(Array.isArray(t))return nn(t);if(t instanceof RegExp)return t;if(typeof t==="object")return rn(t);return t}function nn(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=Ne(t[n]);return e}function rn(t){let e={};for(let n in t)e[n]=Ne(t[n]);return e}function Ve(t,...e){return e.forEach((n)=>{for(let r in n)t[r]=n[r]}),t}function Ye(t){let e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");if(e===0)return t;else if(~e===t.length-1)return Ye(t.substring(0,t.length-1));else return t.substr(~e+1)}var ye=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,J=class{static hasCaptures(t){if(t===null)return!1;return ye.lastIndex=0,ye.test(t)}static replaceCaptures(t,e,n){return t.replace(ye,(r,s,i,o)=>{let a=n[parseInt(s||i,10)];if(a){let c=e.substring(a.start,a.end);while(c[0]===".")c=c.substring(1);switch(o){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function Je(t,e){if(t<e)return-1;if(t>e)return 1;return 0}function Qe(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let s=0;s<n;s++){let i=Je(t[s],e[s]);if(i!==0)return i}return 0}return n-r}function Fe(t){if(/^#[0-9a-f]{6}$/i.test(t))return!0;if(/^#[0-9a-f]{8}$/i.test(t))return!0;if(/^#[0-9a-f]{3}$/i.test(t))return!0;if(/^#[0-9a-f]{4}$/i.test(t))return!0;return!1}function Xe(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Ze=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);let e=this.fn(t);return this.cache.set(t,e),e}},M=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(an(t),e)}static createFromParsedTheme(t,e){return ln(t,e)}_cachedMatchRoot=new Ze((t)=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;let e=t.scopeName,r=this._cachedMatchRoot.get(e).find((s)=>sn(t.parent,s.parentScopes));if(!r)return null;return new et(r.fontStyle,r.foreground,r.background)}},be=class t{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(let r of n)e=new t(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new t(n,e[r]);return n}push(e){return new t(this,e)}getSegments(){let e=this,n=[];while(e)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){if(this===e)return!0;if(this.parent===null)return!1;return this.parent.extends(e)}getExtensionIfDefined(e){let n=[],r=this;while(r&&r!==e)n.push(r.scopeName),r=r.parent;return r===e?n.reverse():void 0}};function sn(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let r=e[n],s=!1;if(r===">"){if(n===e.length-1)return!1;r=e[++n],s=!0}while(t){if(on(t.scopeName,r))break;if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function on(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var et=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function an(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],r=0;for(let s=0,i=e.length;s<i;s++){let o=e[s];if(!o.settings)continue;let a;if(typeof o.scope==="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),a=h.split(",")}else if(Array.isArray(o.scope))a=o.scope;else a=[""];let c=-1;if(typeof o.settings.fontStyle==="string"){c=0;let h=o.settings.fontStyle.split(" ");for(let d=0,f=h.length;d<f;d++)switch(h[d]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let l=null;if(typeof o.settings.foreground==="string"&&Fe(o.settings.foreground))l=o.settings.foreground;let u=null;if(typeof o.settings.background==="string"&&Fe(o.settings.background))u=o.settings.background;for(let h=0,d=a.length;h<d;h++){let m=a[h].trim().split(" "),y=m[m.length-1],_=null;if(m.length>1)_=m.slice(0,m.length-1),_.reverse();n[r++]=new cn(y,_,s,c,l,u)}}return n}var cn=class{constructor(t,e,n,r,s,i){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=s,this.background=i}},k=((t)=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(k||{});function ln(t,e){t.sort((c,l)=>{let u=Je(c.scope,l.scope);if(u!==0)return u;if(u=Qe(c.parentScopes,l.parentScopes),u!==0)return u;return c.index-l.index});let n=0,r="#000000",s="#ffffff";while(t.length>=1&&t[0].scope===""){let c=t.shift();if(c.fontStyle!==-1)n=c.fontStyle;if(c.foreground!==null)r=c.foreground;if(c.background!==null)s=c.background}let i=new un(e),o=new et(n,i.getId(r),i.getId(s)),a=new fn(new we(0,null,-1,0,0),[]);for(let c=0,l=t.length;c<l;c++){let u=t[c];a.insert(0,u.scope,u.parentScopes,u.fontStyle,i.getId(u.foreground),i.getId(u.background))}return new M(i,o,a)}var un=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},hn=Object.freeze([]),we=class t{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,r,s,i){this.scopeDepth=e,this.parentScopes=n||hn,this.fontStyle=r,this.foreground=s,this.background=i}clone(){return new t(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let r=0,s=e.length;r<s;r++)n[r]=e[r].clone();return n}acceptOverwrite(e,n,r,s){if(this.scopeDepth>e)console.log("how did this happen?");else this.scopeDepth=e;if(n!==-1)this.fontStyle=n;if(r!==0)this.foreground=r;if(s!==0)this.background=s}},fn=class t{constructor(e,n=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,s=0;while(!0){if(e.parentScopes[r]===">")r++;if(n.parentScopes[s]===">")s++;if(r>=e.parentScopes.length||s>=n.parentScopes.length)break;let i=n.parentScopes[s].length-e.parentScopes[r].length;if(i!==0)return i;r++,s++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,i;if(r===-1)s=e,i="";else s=e.substring(0,r),i=e.substring(r+1);if(this._children.hasOwnProperty(s))return this._children[s].match(i)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(t._cmpBySpecificity),n}insert(e,n,r,s,i,o){if(n===""){this._doInsertHere(e,r,s,i,o);return}let a=n.indexOf("."),c,l;if(a===-1)c=n,l="";else c=n.substring(0,a),l=n.substring(a+1);let u;if(this._children.hasOwnProperty(c))u=this._children[c];else u=new t(this._mainRule.clone(),we.cloneArr(this._rulesWithParentScopes)),this._children[c]=u;u.insert(e+1,l,r,s,i,o)}_doInsertHere(e,n,r,s,i){if(n===null){this._mainRule.acceptOverwrite(e,r,s,i);return}for(let o=0,a=this._rulesWithParentScopes.length;o<a;o++){let c=this._rulesWithParentScopes[o];if(Qe(c.parentScopes,n)===0){c.acceptOverwrite(e,r,s,i);return}}if(r===-1)r=this._mainRule.fontStyle;if(s===0)s=this._mainRule.foreground;if(i===0)i=this._mainRule.background;this._rulesWithParentScopes.push(new we(e,n,r,s,i))}},x=class t{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){let n=t.getLanguageId(e),r=t.getTokenType(e),s=t.getFontStyle(e),i=t.getForeground(e),o=t.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:i,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,r,s,i,o,a){let c=t.getLanguageId(e),l=t.getTokenType(e),u=t.containsBalancedBrackets(e)?1:0,h=t.getFontStyle(e),d=t.getForeground(e),f=t.getBackground(e);if(n!==0)c=n;if(r!==8)l=mn(r);if(s!==null)u=s?1:0;if(i!==-1)h=i;if(o!==0)d=o;if(a!==0)f=a;return(c<<0|l<<8|u<<10|h<<11|d<<15|f<<24)>>>0}};function dn(t){return t}function mn(t){return t}function X(t,e){let n=[],r=gn(t),s=r.next();while(s!==null){let c=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let l=o();if(n.push({matcher:l,priority:c}),s!==",")break;s=r.next()}return n;function i(){if(s==="-"){s=r.next();let c=i();return(l)=>!!c&&!c(l)}if(s==="("){s=r.next();let c=a();if(s===")")s=r.next();return c}if(De(s)){let c=[];do c.push(s),s=r.next();while(De(s));return(l)=>e(c,l)}return null}function o(){let c=[],l=i();while(l)c.push(l),l=i();return(u)=>c.every((h)=>h(u))}function a(){let c=[],l=o();while(l){if(c.push(l),s==="|"||s===",")do s=r.next();while(s==="|"||s===",");else break;l=o()}return(u)=>c.some((h)=>h(u))}}function De(t){return!!t&&!!t.match(/[\w\.:]+/)}function gn(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;let r=n[0];return n=e.exec(t),r}}}function tt(t){if(typeof t.dispose==="function")t.dispose()}var j=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},_n=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},yn=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){let e=t.toKey();if(this._seenReferenceKeys.has(e))return;this._seenReferenceKeys.add(e),this._references.push(t)}},bn=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new j(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let t=this.Q;this.Q=[];let e=new yn;for(let n of t)Sn(n,this.initialScopeName,this.repo,e);for(let n of e.references)if(n instanceof j){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName))continue;if(this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function Sn(t,e,n,r){let s=n.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw Error(`No grammar provided for <${e}>`);return}let i=n.lookup(e);if(t instanceof j)Q({baseGrammar:i,selfGrammar:s},r);else Ce(t.ruleName,{baseGrammar:i,selfGrammar:s,repository:s.repository},r);let o=n.injections(t.scopeName);if(o)for(let a of o)r.add(new j(a))}function Ce(t,e,n){if(e.repository&&e.repository[t]){let r=e.repository[t];Z([r],e,n)}}function Q(t,e){if(t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns))Z(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e);if(t.selfGrammar.injections)Z(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function Z(t,e,n){for(let r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let s=r.repository?Ve({},e.repository,r.repository):e.repository;if(Array.isArray(r.patterns))Z(r.patterns,{...e,repository:s},n);let i=r.include;if(!i)continue;let o=nt(i);switch(o.kind){case 0:Q({...e,selfGrammar:e.baseGrammar},n);break;case 1:Q(e,n);break;case 2:Ce(o.ruleName,{...e,repository:s},n);break;case 3:case 4:let a=o.scopeName===e.selfGrammar.scopeName?e.selfGrammar:o.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(a){let c={baseGrammar:e.baseGrammar,selfGrammar:a,repository:s};if(o.kind===4)Ce(o.ruleName,c,n);else Q(c,n)}else if(o.kind===4)n.add(new _n(o.scopeName,o.ruleName));else n.add(new j(o.scopeName));break}}}var wn=class{kind=0},Cn=class{kind=1},kn=class{constructor(t){this.ruleName=t}kind=2},Rn=class{constructor(t){this.scopeName=t}kind=3},Nn=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function nt(t){if(t==="$base")return new wn;else if(t==="$self")return new Cn;let e=t.indexOf("#");if(e===-1)return new Rn(t);else if(e===0)return new kn(t.substring(1));else{let n=t.substring(0,e),r=t.substring(e+1);return new Nn(n,r)}}var Tn=/\\(\d+)/,We=/\\(\d+)/g,ws=Symbol("RuleId"),vn=-1,rt=-2;function st(t){return t}function it(t){return t}var W=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,r){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=J.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=J.hasCaptures(this._contentName)}get debugName(){let t=this.$location?`${Ye(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){if(!this._nameIsCapturing||this._name===null||t===null||e===null)return this._name;return J.replaceCaptures(this._name,t,e)}getContentName(t,e){if(!this._contentNameIsCapturing||this._contentName===null)return this._contentName;return J.replaceCaptures(this._contentName,t,e)}},An=class extends W{retokenizeCapturedWithRuleId;constructor(t,e,n,r,s){super(t,e,n,r);this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,e){throw Error("Not supported!")}compile(t,e){throw Error("Not supported!")}compileAG(t,e,n,r){throw Error("Not supported!")}},En=class extends W{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,null);this._match=new F(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns)this._cachedCompiledPatterns=new D,this.collectPatterns(t,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}},He=class extends W{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,r);this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null}collectPatterns(t,e){for(let n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns)this._cachedCompiledPatterns=new D,this.collectPatterns(t,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}},ke=class extends W{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s,i,o,a,c,l){super(t,e,n,r);this._begin=new F(s,this.id),this.beginCaptures=i,this._end=new F(o?o:"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,r)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new D;for(let n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns);if(this.applyEndPatternLast)this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end);else this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}if(this._end.hasBackReferences)if(this.applyEndPatternLast)this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e);else this._cachedCompiledPatterns.setSource(0,e);return this._cachedCompiledPatterns}},ee=class extends W{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,s,i,o,a,c){super(t,e,n,r);this._begin=new F(s,this.id),this.beginCaptures=i,this.whileCaptures=a,this._while=new F(o,rt),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null;if(this._cachedCompiledWhilePatterns)this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new D;for(let e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,r){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,r)}_getCachedCompiledWhilePatterns(t,e){if(!this._cachedCompiledWhilePatterns)this._cachedCompiledWhilePatterns=new D,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while);if(this._while.hasBackReferences)this._cachedCompiledWhilePatterns.setSource(0,e?e:"￿");return this._cachedCompiledWhilePatterns}},ot=class t{static createCaptureRule(e,n,r,s,i){return e.registerRule((o)=>new An(n,o,r,s,i))}static getCompiledRuleId(e,n,r){if(!e.id)n.registerRule((s)=>{if(e.id=s,e.match)return new En(e.$vscodeTextmateLocation,e.id,e.name,e.match,t._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){if(e.repository)r=Ve({},r,e.repository);let i=e.patterns;if(typeof i>"u"&&e.include)i=[{include:e.include}];return new He(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,t._compilePatterns(i,n,r))}if(e.while)return new ee(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,t._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,t._compileCaptures(e.whileCaptures||e.captures,n,r),t._compilePatterns(e.patterns,n,r));return new ke(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,t._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,t._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,t._compilePatterns(e.patterns,n,r))});return e.id}static _compileCaptures(e,n,r){let s=[];if(e){let i=0;for(let o in e){if(o==="$vscodeTextmateLocation")continue;let a=parseInt(o,10);if(a>i)i=a}for(let o=0;o<=i;o++)s[o]=null;for(let o in e){if(o==="$vscodeTextmateLocation")continue;let a=parseInt(o,10),c=0;if(e[o].patterns)c=t.getCompiledRuleId(e[o],n,r);s[a]=t.createCaptureRule(n,e[o].$vscodeTextmateLocation,e[o].name,e[o].contentName,c)}}return s}static _compilePatterns(e,n,r){let s=[];if(e)for(let i=0,o=e.length;i<o;i++){let a=e[i],c=-1;if(a.include){let l=nt(a.include);switch(l.kind){case 0:case 1:c=t.getCompiledRuleId(r[a.include],n,r);break;case 2:let u=r[l.ruleName];if(u)c=t.getCompiledRuleId(u,n,r);break;case 3:case 4:let h=l.scopeName,d=l.kind===4?l.ruleName:null,f=n.getExternalGrammar(h,r);if(f)if(d){let m=f.repository[d];if(m)c=t.getCompiledRuleId(m,n,f.repository)}else c=t.getCompiledRuleId(f.repository.$self,n,f.repository);break}}else c=t.getCompiledRuleId(a,n,r);if(c!==-1){let l=n.getRule(c),u=!1;if(l instanceof He||l instanceof ke||l instanceof ee){if(l.hasMissingPatterns&&l.patterns.length===0)u=!0}if(u)continue;s.push(c)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},F=class t{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e==="string"){let r=e.length,s=0,i=[],o=!1;for(let a=0;a<r;a++)if(e.charAt(a)==="\\"){if(a+1<r){let l=e.charAt(a+1);if(l==="z")i.push(e.substring(s,a)),i.push("$(?!\\n)(?<!\\n)"),s=a+2;else if(l==="A"||l==="G")o=!0;a++}}if(this.hasAnchor=o,s===0)this.source=e;else i.push(e.substring(s,r)),this.source=i.join("")}else this.hasAnchor=!1,this.source=e;if(this.hasAnchor)this._anchorCache=this._buildAnchorCache();else this._anchorCache=null;if(this.ruleId=n,typeof this.source==="string")this.hasBackReferences=Tn.test(this.source);else this.hasBackReferences=!1}clone(){return new t(this.source,this.ruleId)}setSource(e){if(this.source===e)return;if(this.source=e,this.hasAnchor)this._anchorCache=this._buildAnchorCache()}resolveBackReferences(e,n){if(typeof this.source!=="string")throw Error("This method should only be called if the source is a string");let r=n.map((s)=>e.substring(s.start,s.end));return We.lastIndex=0,this.source.replace(We,(s,i)=>Xe(r[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!=="string")throw Error("This method should only be called if the source is a string");let e=[],n=[],r=[],s=[],i,o,a,c;for(i=0,o=this.source.length;i<o;i++)if(a=this.source.charAt(i),e[i]=a,n[i]=a,r[i]=a,s[i]=a,a==="\\"){if(i+1<o){if(c=this.source.charAt(i+1),c==="A")e[i+1]="￿",n[i+1]="￿",r[i+1]="A",s[i+1]="A";else if(c==="G")e[i+1]="￿",n[i+1]="G",r[i+1]="￿",s[i+1]="G";else e[i+1]=c,n[i+1]=c,r[i+1]=c,s[i+1]=c;i++}}return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(e,n){if(!this.hasAnchor||!this._anchorCache||typeof this.source!=="string")return this.source;if(e)if(n)return this._anchorCache.A1_G1;else return this._anchorCache.A1_G0;else if(n)return this._anchorCache.A0_G1;else return this._anchorCache.A0_G0}},D=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){if(this._cached)this._cached.dispose(),this._cached=null;if(this._anchorCache.A0_G0)this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null;if(this._anchorCache.A0_G1)this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null;if(this._anchorCache.A1_G0)this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null;if(this._anchorCache.A1_G1)this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){if(this._items[t].source!==e)this._disposeCaches(),this._items[t].setSource(e)}compile(t){if(!this._cached){let e=this._items.map((n)=>n.source);this._cached=new qe(t,e,this._items.map((n)=>n.ruleId))}return this._cached}compileAG(t,e,n){if(!this._hasAnchors)return this.compile(t);else if(e)if(n){if(!this._anchorCache.A1_G1)this._anchorCache.A1_G1=this._resolveAnchors(t,e,n);return this._anchorCache.A1_G1}else{if(!this._anchorCache.A1_G0)this._anchorCache.A1_G0=this._resolveAnchors(t,e,n);return this._anchorCache.A1_G0}else if(n){if(!this._anchorCache.A0_G1)this._anchorCache.A0_G1=this._resolveAnchors(t,e,n);return this._anchorCache.A0_G1}else{if(!this._anchorCache.A0_G0)this._anchorCache.A0_G0=this._resolveAnchors(t,e,n);return this._anchorCache.A0_G0}}_resolveAnchors(t,e,n){let r=this._items.map((s)=>s.resolveAnchors(e,n));return new qe(t,r,this._items.map((s)=>s.ruleId))}},qe=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){if(typeof this.scanner.dispose==="function")this.scanner.dispose()}toString(){let t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
2
- `)}findNextMatchSync(t,e,n){let r=this.scanner.findNextMatchSync(t,e,n);if(!r)return null;return{ruleId:this.rules[r.index],captureIndices:r.captureIndices}}},Se=class{constructor(t,e){this.languageId=t,this.tokenType=e}},xn=class t{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new Se(e,8),this._embeddedLanguagesMatcher=new In(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){if(e===null)return t._NULL_SCOPE_METADATA;return this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new Se(0,0);_getBasicScopeAttributes=new Ze((e)=>{let n=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new Se(n,r)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){let n=e.match(t.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},In=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);let e=t.map(([n,r])=>Xe(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;let e=t.match(this.scopesRegExp);if(!e)return;return this.values.get(e[1])}},Cs={InDebugMode:typeof process<"u"&&!!process.env.VSCODE_TEXTMATE_DEBUG},at=!1,ze=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function ct(t,e,n,r,s,i,o,a){let c=e.content.length,l=!1,u=-1;if(o){let f=Ln(t,e,n,r,s,i);s=f.stack,r=f.linePos,n=f.isFirstLine,u=f.anchorPosition}let h=Date.now();while(!l){if(a!==0){if(Date.now()-h>a)return new ze(s,!0)}d()}return new ze(s,!1);function d(){let f=Pn(t,e,n,r,s,u);if(!f){i.produce(s,c),l=!0;return}let{captureIndices:m,matchedRuleId:y}=f,_=m&&m.length>0?m[0].end>r:!1;if(y===vn){let p=s.getRule(t);i.produce(s,m[0].start),s=s.withContentNameScopesList(s.nameScopesList),B(t,e,n,s,i,p.endCaptures,m),i.produce(s,m[0].end);let g=s;if(s=s.parent,u=g.getAnchorPos(),!_&&g.getEnterPos()===r){s=g,i.produce(s,c),l=!0;return}}else{let p=t.getRule(y);i.produce(s,m[0].start);let g=s,b=p.getName(e.content,m),C=s.contentNameScopesList.pushAttributed(b,t);if(s=s.push(y,r,u,m[0].end===c,null,C,C),p instanceof ke){let R=p;B(t,e,n,s,i,R.beginCaptures,m),i.produce(s,m[0].end),u=m[0].end;let N=R.getContentName(e.content,m),E=C.pushAttributed(N,t);if(s=s.withContentNameScopesList(E),R.endHasBackReferences)s=s.withEndRule(R.getEndWithResolvedBackReferences(e.content,m));if(!_&&g.hasSameRuleAs(s)){s=s.pop(),i.produce(s,c),l=!0;return}}else if(p instanceof ee){let R=p;B(t,e,n,s,i,R.beginCaptures,m),i.produce(s,m[0].end),u=m[0].end;let N=R.getContentName(e.content,m),E=C.pushAttributed(N,t);if(s=s.withContentNameScopesList(E),R.whileHasBackReferences)s=s.withEndRule(R.getWhileWithResolvedBackReferences(e.content,m));if(!_&&g.hasSameRuleAs(s)){s=s.pop(),i.produce(s,c),l=!0;return}}else if(B(t,e,n,s,i,p.captures,m),i.produce(s,m[0].end),s=s.pop(),!_){s=s.safePop(),i.produce(s,c),l=!0;return}}if(m[0].end>r)r=m[0].end,n=!1}}function Ln(t,e,n,r,s,i){let o=s.beginRuleCapturedEOL?0:-1,a=[];for(let c=s;c;c=c.pop()){let l=c.getRule(t);if(l instanceof ee)a.push({rule:l,stack:c})}for(let c=a.pop();c;c=a.pop()){let{ruleScanner:l,findOptions:u}=On(c.rule,t,c.stack.endRule,n,r===o),h=l.findNextMatchSync(e,r,u);if(h){if(h.ruleId!==rt){s=c.stack.pop();break}if(h.captureIndices&&h.captureIndices.length){if(i.produce(c.stack,h.captureIndices[0].start),B(t,e,n,c.stack,i,c.rule.whileCaptures,h.captureIndices),i.produce(c.stack,h.captureIndices[0].end),o=h.captureIndices[0].end,h.captureIndices[0].end>r)r=h.captureIndices[0].end,n=!1}}else{s=c.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:o,isFirstLine:n}}function Pn(t,e,n,r,s,i){let o=Gn(t,e,n,r,s,i),a=t.getInjections();if(a.length===0)return o;let c=Bn(a,t,e,n,r,s,i);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;if(u<l||c.priorityMatch&&u===l)return c;return o}function Gn(t,e,n,r,s,i){let o=s.getRule(t),{ruleScanner:a,findOptions:c}=lt(o,t,s.endRule,n,r===i),l=a.findNextMatchSync(e,r,c);if(l)return{captureIndices:l.captureIndices,matchedRuleId:l.ruleId};return null}function Bn(t,e,n,r,s,i,o){let a=Number.MAX_VALUE,c=null,l,u=0,h=i.contentNameScopesList.getScopeNames();for(let d=0,f=t.length;d<f;d++){let m=t[d];if(!m.matcher(h))continue;let y=e.getRule(m.ruleId),{ruleScanner:_,findOptions:p}=lt(y,e,null,r,s===o),g=_.findNextMatchSync(n,s,p);if(!g)continue;let b=g.captureIndices[0].start;if(b>=a)continue;if(a=b,c=g.captureIndices,l=g.ruleId,u=m.priority,a===s)break}if(c)return{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l};return null}function lt(t,e,n,r,s){if(at){let o=t.compile(e,n),a=ut(r,s);return{ruleScanner:o,findOptions:a}}return{ruleScanner:t.compileAG(e,n,r,s),findOptions:0}}function On(t,e,n,r,s){if(at){let o=t.compileWhile(e,n),a=ut(r,s);return{ruleScanner:o,findOptions:a}}return{ruleScanner:t.compileWhileAG(e,n,r,s),findOptions:0}}function ut(t,e){let n=0;if(!t)n|=1;if(!e)n|=4;return n}function B(t,e,n,r,s,i,o){if(i.length===0)return;let a=e.content,c=Math.min(i.length,o.length),l=[],u=o[0].end;for(let h=0;h<c;h++){let d=i[h];if(d===null)continue;let f=o[h];if(f.length===0)continue;if(f.start>u)break;while(l.length>0&&l[l.length-1].endPos<=f.start)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0)s.produceFromScopes(l[l.length-1].scopes,f.start);else s.produce(r,f.start);if(d.retokenizeCapturedWithRuleId){let y=d.getName(a,o),_=r.contentNameScopesList.pushAttributed(y,t),p=d.getContentName(a,o),g=_.pushAttributed(p,t),b=r.push(d.retokenizeCapturedWithRuleId,f.start,-1,!1,null,_,g),C=t.createOnigString(a.substring(0,f.end));ct(t,C,n&&f.start===0,f.start,b,s,!1,0),tt(C);continue}let m=d.getName(a,o);if(m!==null){let _=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(m,t);l.push(new $n(_,f.end))}}while(l.length>0)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var $n=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function jn(t,e,n,r,s,i,o,a){return new Dn(t,e,n,r,s,i,o,a)}function Ue(t,e,n,r,s){let i=X(e,te),o=ot.getCompiledRuleId(n,r,s.repository);for(let a of i)t.push({debugSelector:e,matcher:a.matcher,ruleId:o,grammar:s,priority:a.priority})}function te(t,e){if(e.length<t.length)return!1;let n=0;return t.every((r)=>{for(let s=n;s<e.length;s++)if(Fn(e[s],r))return n=s+1,!0;return!1})}function Fn(t,e){if(!t)return!1;if(t===e)return!0;let n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var Dn=class{constructor(t,e,n,r,s,i,o,a){if(this._rootScopeName=t,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new xn(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Ke(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(let c of Object.keys(s)){let l=X(c,te);for(let u of l)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[c]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let t of this._ruleId2desc)if(t)t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){let t={lookup:(s)=>{if(s===this._rootScopeName)return this._grammar;return this.getExternalGrammar(s)},injections:(s)=>this._grammarRepository.injections(s)},e=[],n=this._rootScopeName,r=t.lookup(n);if(r){let s=r.injections;if(s)for(let o in s)Ue(e,o,s[o],this,r);let i=this._grammarRepository.injections(n);if(i)i.forEach((o)=>{let a=this.getExternalGrammar(o);if(a){let c=a.injectionSelector;if(c)Ue(e,c,a,this,a)}})}return e.sort((s,i)=>s.priority-i.priority),e}getInjections(){if(this._injections===null)this._injections=this._collectInjections();return this._injections}registerRule(t){let e=++this._lastRuleId,n=t(st(e));return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[it(t)]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];else if(this._grammarRepository){let n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=Ke(n,e&&e.$base),this._includedGrammars[t]}return}tokenizeLine(t,e,n=0){let r=this._tokenize(t,e,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(t,e,n=0){let r=this._tokenize(t,e,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(t,e,n,r){if(this._rootId===-1)this._rootId=ot.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections();let s;if(!e||e===Re.NULL){s=!0;let l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),h=x.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),d=this.getRule(this._rootId).getName(null,null),f;if(d)f=O.createRootAndLookUpScopeName(d,h,this);else f=O.createRoot("unknown",h);e=new Re(null,this._rootId,-1,-1,!1,null,f,f)}else s=!1,e.reset();t=t+`
3
- `;let i=this.createOnigString(t),o=i.content.length,a=new Hn(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),c=ct(this,i,s,0,e,a,!0,r);return tt(i),{lineLength:o,lineTokens:a,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Ke(t,e){return t=tn(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var O=class t{constructor(e,n,r){this.parent=e,this.scopePath=n,this.tokenAttributes=r}static fromExtension(e,n){let r=e,s=e?.scopePath??null;for(let i of n)s=be.push(s,i.scopeNames),r=new t(r,s,i.encodedTokenAttributes);return r}static createRoot(e,n){return new t(null,new be(null,e),n)}static createRootAndLookUpScopeName(e,n,r){let s=r.getMetadataForScope(e),i=new be(null,e),o=r.themeProvider.themeMatch(i),a=t.mergeAttributes(n,s,o);return new t(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return t.equals(this,e)}static equals(e,n){do{if(e===n)return!0;if(!e&&!n)return!0;if(!e||!n)return!1;if(e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,r){let s=-1,i=0,o=0;if(r!==null)s=r.fontStyle,i=r.foregroundId,o=r.backgroundId;return x.set(e,n.languageId,n.tokenType,null,s,i,o)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return t._pushAttributed(this,e,n);let r=e.split(/ /g),s=this;for(let i of r)s=t._pushAttributed(s,i,n);return s}static _pushAttributed(e,n,r){let s=r.getMetadataForScope(n),i=e.scopePath.push(n),o=r.themeProvider.themeMatch(i),a=t.mergeAttributes(e.tokenAttributes,s,o);return new t(e,i,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let n=[],r=this;while(r&&r!==e)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?n.reverse():void 0}},Re=class t{constructor(e,n,r,s,i,o,a,c){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=a,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new t(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){if(e===null)return!1;return t._equals(this,e)}static _equals(e,n){if(e===n)return!0;if(!this._structuralEquals(e,n))return!1;return O.equals(e.contentNameScopesList,n.contentNameScopesList)}static _structuralEquals(e,n){do{if(e===n)return!0;if(!e&&!n)return!0;if(!e||!n)return!1;if(e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){while(e)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){t._reset(this)}pop(){return this.parent}safePop(){if(this.parent)return this.parent;return this}push(e,n,r,s,i,o,a){return new t(this,e,n,r,s,i,o,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,n){if(this.parent)n=this.parent._writeString(e,n);return e[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(e){if(this.contentNameScopesList===e)return this;return this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){if(this.endRule===e)return this;return new t(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;while(n&&n._enterPos===e._enterPos){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:it(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(e,n){let r=O.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new t(e,st(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,O.fromExtension(r,n.contentNameScopesList))}},Wn=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap((n)=>{if(n==="*")return this.allowAny=!0,[];return X(n,te).map((r)=>r.matcher)}),this.unbalancedBracketScopes=e.flatMap((n)=>X(n,te).map((r)=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(let e of this.unbalancedBracketScopes)if(e(t))return!1;for(let e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},Hn=class{constructor(t,e,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let r=t?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways)s=!0;if(this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let i=t?.getScopeNames()??[];for(let o of this._tokenTypeOverrides)if(o.matcher(i))r=x.set(r,0,dn(o.type),null,-1,0,0);if(this.balancedBracketSelectors)s=this.balancedBracketSelectors.match(i)}if(s)r=x.set(r,0,8,s,-1,0,0);if(this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=e;return}let n=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,e){if(this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1)this._tokens.pop();if(this._tokens.length===0)this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0;return this._tokens}getBinaryResult(t,e){if(this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1)this._binaryTokens.pop(),this._binaryTokens.pop();if(this._binaryTokens.length===0)this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0;let n=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},qn=class{constructor(t,e){this._onigLib=e,this._theme=t}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){if(this._rawGrammars.set(t.scopeName,t),e)this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,n,r,s){if(!this._grammars.has(t)){let i=this._rawGrammars.get(t);if(!i)return null;this._grammars.set(t,jn(t,i,e,n,r,s,this,this._onigLib))}return this._grammars.get(t)}},ht=class{_options;_syncRegistry;_ensureGrammarCache;constructor(t){this._options=t,this._syncRegistry=new qn(M.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,e){this._syncRegistry.setTheme(M.createFromRawTheme(t,e))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,e,n){return this.loadGrammarWithConfiguration(t,e,{embeddedLanguages:n})}loadGrammarWithConfiguration(t,e,n){return this._loadGrammar(t,e,n.embeddedLanguages,n.tokenTypes,new Wn(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,e,n,r,s){let i=new bn(this._syncRegistry,t);while(i.Q.length>0)i.Q.map((o)=>this._loadSingleGrammar(o.scopeName)),i.processQueue();return this._grammarForScopeName(t,e,n,r,s)}_loadSingleGrammar(t){if(!this._ensureGrammarCache.has(t))this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0)}_doLoadSingleGrammar(t){let e=this._options.loadGrammar(t);if(e){let n=typeof this._options.getInjections==="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(e,n)}}addGrammar(t,e=[],n=0,r=null){return this._syncRegistry.addGrammar(t,e),this._grammarForScopeName(t.scopeName,n,r)}_grammarForScopeName(t,e=0,n=null,r=null,s=null){return this._syncRegistry.grammarForScopeName(t,e,n,r,s)}},ne=Re.NULL;function q(t,e){let n=typeof t==="string"?{}:{...t.colorReplacements},r=typeof t==="string"?t:t.name;for(let[s,i]of Object.entries(e?.colorReplacements||{}))if(typeof i==="string")n[s]=i;else if(s===r)Object.assign(n,i);return n}function v(t,e){if(!t)return t;return e?.[t?.toLowerCase()]||t}function pt(t){return Array.isArray(t)?t:[t]}async function Te(t){return Promise.resolve(typeof t==="function"?t():t).then((e)=>e.default||e)}function z(t){return!t||["plaintext","txt","text","plain"].includes(t)}function _t(t){return t==="ansi"||z(t)}function U(t){return t==="none"}function yt(t){return U(t)}var zn=/(\r?\n)/g;function P(t,e=!1){if(t.length===0)return[["",0]];let n=t.split(zn),r=0,s=[];for(let i=0;i<n.length;i+=2){let o=e?n[i]+(n[i+1]||""):n[i];s.push([o,r]),r+=n[i].length,r+=n[i+1]?.length||0}return s}var ft={light:"#333333",dark:"#bbbbbb"},dt={light:"#fffffe",dark:"#1e1e1e"},mt="__shiki_resolved";function re(t){if(t?.[mt])return t;let e={...t};if(e.tokenColors&&!e.settings)e.settings=e.tokenColors,delete e.tokenColors;e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:n,fg:r}=e;if(!n||!r){let a=e.settings?e.settings.find((c)=>!c.name&&!c.scope):void 0;if(a?.settings?.foreground)r=a.settings.foreground;if(a?.settings?.background)n=a.settings.background;if(!r&&e?.colors?.["editor.foreground"])r=e.colors["editor.foreground"];if(!n&&e?.colors?.["editor.background"])n=e.colors["editor.background"];if(!r)r=e.type==="light"?ft.light:ft.dark;if(!n)n=e.type==="light"?dt.light:dt.dark;e.fg=r,e.bg=n}if(!(e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope))e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let s=0,i=new Map;function o(a){if(i.has(a))return i.get(a);s+=1;let c=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;if(e.colorReplacements?.[`#${c}`])return o(a);return i.set(a,c),c}e.settings=e.settings.map((a)=>{let c=a.settings?.foreground&&!a.settings.foreground.startsWith("#"),l=a.settings?.background&&!a.settings.background.startsWith("#");if(!c&&!l)return a;let u={...a,settings:{...a.settings}};if(c){let h=o(a.settings.foreground);e.colorReplacements[h]=a.settings.foreground,u.settings.foreground=h}if(l){let h=o(a.settings.background);e.colorReplacements[h]=a.settings.background,u.settings.background=h}return u});for(let a of Object.keys(e.colors||{}))if(a==="editor.foreground"||a==="editor.background"||a.startsWith("terminal.ansi")){if(!e.colors[a]?.startsWith("#")){let c=o(e.colors[a]);e.colorReplacements[c]=e.colors[a],e.colors[a]=c}}return Object.defineProperty(e,mt,{enumerable:!1,writable:!1,value:!0}),e}async function bt(t){return[...new Set((await Promise.all(t.filter((e)=>!_t(e)).map(async(e)=>await Te(e).then((n)=>Array.isArray(n)?n:[n])))).flat())]}async function St(t){return(await Promise.all(t.map(async(e)=>yt(e)?null:re(await Te(e))))).filter((e)=>!!e)}function wt(t,e){if(!e)return t;if(e[t]){let n=new Set([t]);while(e[t]){if(t=e[t],n.has(t))throw new S(`Circular alias \`${[...n].join(" -> ")} -> ${t}\``);n.add(t)}}return t}var Un=class extends ht{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(t,e,n,r={}){super(t);this._resolver=t,this._themes=e,this._langs=n,this._alias=r,this._themes.map((s)=>this.loadTheme(s)),this.loadLanguages(this._langs)}getTheme(t){if(typeof t==="string")return this._resolvedThemes.get(t);else return this.loadTheme(t)}loadTheme(t){let e=re(t);if(e.name)this._resolvedThemes.set(e.name,e),this._loadedThemesCache=null;return e}getLoadedThemes(){if(!this._loadedThemesCache)this._loadedThemesCache=[...this._resolvedThemes.keys()];return this._loadedThemesCache}setTheme(t){let e=this._textmateThemeCache.get(t);if(!e)e=M.createFromRawTheme(t),this._textmateThemeCache.set(t,e);this._syncRegistry.setTheme(e)}getGrammar(t){return t=wt(t,this._alias),this._resolvedGrammars.get(t)}loadLanguage(t){if(this.getGrammar(t.name))return;let e=new Set([...this._langMap.values()].filter((s)=>s.embeddedLangsLazy?.includes(t.name)));this._resolver.addLanguage(t);let n={balancedBracketSelectors:t.balancedBracketSelectors||["*"],unbalancedBracketSelectors:t.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(t.scopeName,t);let r=this.loadGrammarWithConfiguration(t.scopeName,1,n);if(r.name=t.name,this._resolvedGrammars.set(t.name,r),t.aliases)t.aliases.forEach((s)=>{this._alias[s]=t.name});if(this._loadedLanguagesCache=null,e.size)for(let s of e)this._resolvedGrammars.delete(s.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(s.scopeName),this._syncRegistry?._grammars?.delete(s.scopeName),this.loadLanguage(this._langMap.get(s.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(t){for(let r of t)this.resolveEmbeddedLanguages(r);let e=[...this._langGraph.entries()],n=e.filter(([r,s])=>!s);if(n.length){let r=e.filter(([s,i])=>{if(!i)return!1;return(i.embeddedLanguages||i.embeddedLangs)?.some((o)=>n.map(([a])=>a).includes(o))}).filter((s)=>!n.includes(s));throw new S(`Missing languages ${n.map(([s])=>`\`${s}\``).join(", ")}, required by ${r.map(([s])=>`\`${s}\``).join(", ")}`)}for(let[r,s]of e)this._resolver.addLanguage(s);for(let[r,s]of e)this.loadLanguage(s)}getLoadedLanguages(){if(!this._loadedLanguagesCache)this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])];return this._loadedLanguagesCache}resolveEmbeddedLanguages(t){this._langMap.set(t.name,t),this._langGraph.set(t.name,t);let e=t.embeddedLanguages??t.embeddedLangs;if(e)for(let n of e)this._langGraph.set(n,this._langMap.get(n))}},Kn=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(t,e){this._onigLib={createOnigScanner:(n)=>t.createScanner(n),createOnigString:(n)=>t.createString(n)},e.forEach((n)=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){if(this._langs.set(t.name,t),t.aliases)t.aliases.forEach((e)=>{this._langs.set(e,t)});if(this._scopeToLang.set(t.scopeName,t),t.injectTo)t.injectTo.forEach((e)=>{if(!this._injections.get(e))this._injections.set(e,[]);this._injections.get(e).push(t.scopeName)})}getInjections(t){let e=t.split("."),n=[];for(let r=1;r<=e.length;r++){let s=e.slice(0,r).join(".");n=[...n,...this._injections.get(s)||[]]}return n}},H=0;function ve(t){if(H+=1,t.warnings!==!1&&H>=10&&H%10===0)console.warn(`[Shiki] ${H} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let e=!1;if(!t.engine)throw new S("`engine` option is required for synchronous mode");let n=(t.langs||[]).flat(1),r=(t.themes||[]).flat(1).map(re),s=new Un(new Kn(t.engine,n),r,n,t.langAlias),i;function o(g){return wt(g,t.langAlias)}function a(g){_();let b=s.getGrammar(typeof g==="string"?g:g.name);if(!b)throw new S(`Language \`${g}\` not found, you may need to load it first`);return b}function c(g){if(g==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};_();let b=s.getTheme(g);if(!b)throw new S(`Theme \`${g}\` not found, you may need to load it first`);return b}function l(g){_();let b=c(g);if(i!==g)s.setTheme(b),i=g;return{theme:b,colorMap:s.getColorMap()}}function u(){return _(),s.getLoadedThemes()}function h(){return _(),s.getLoadedLanguages()}function d(...g){_(),s.loadLanguages(g.flat(1))}async function f(...g){return d(await bt(g))}function m(...g){_();for(let b of g.flat(1))s.loadTheme(b)}async function y(...g){return _(),m(await St(g))}function _(){if(e)throw new S("Shiki instance has been disposed")}function p(){if(e)return;e=!0,s.dispose(),H-=1}return{setTheme:l,getTheme:c,getLanguage:a,getLoadedThemes:u,getLoadedLanguages:h,resolveLangAlias:o,loadLanguage:f,loadLanguageSync:d,loadTheme:y,loadThemeSync:m,dispose:p,[Symbol.dispose]:p}}async function Ae(t){if(!t.engine)console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[e,n,r]=await Promise.all([St(t.themes||[]),bt(t.langs||[]),t.engine]);return ve({...t,themes:e,langs:n,engine:r})}var Ct=new WeakMap;function K(t,e){Ct.set(t,e)}function G(t){return Ct.get(t)}var se=class t{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,n){return new t(Object.fromEntries(pt(n).map((r)=>[r,ne])),e)}constructor(...e){if(e.length===2){let[n,r]=e;this.lang=r,this._stacks=n}else{let[n,r,s]=e;this.lang=r,this._stacks={[s]:n}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return Vn(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Vn(t){let e=[],n=new Set;function r(s){if(n.has(s))return;n.add(s);let i=s?.nameScopesList?.scopeName;if(i)e.push(i);if(s.parent)r(s.parent)}return r(t),e}function Yn(t,e){if(!(t instanceof se))throw new S("Invalid grammar state");return t.getInternalStack(e)}var Jn=/,/,Qn=/ /;function Ee(t,e,n={}){let{theme:r=t.getLoadedThemes()[0]}=n;if(z(t.resolveLangAlias(n.lang||"text"))||U(r))return P(e).map((a)=>[{content:a[0],offset:a[1]}]);let{theme:s,colorMap:i}=t.setTheme(r),o=t.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==o.name)throw new S(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(s.name))throw new S(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${s.name}"`)}return Rt(e,o,s,i,n)}function kt(...t){if(t.length===2)return G(t[1]);let[e,n,r={}]=t,{lang:s="text",theme:i=e.getLoadedThemes()[0]}=r;if(z(s)||U(i))throw new S("Plain language does not have grammar state");if(s==="ansi")throw new S("ANSI language does not have grammar state");let{theme:o,colorMap:a}=e.setTheme(i),c=e.getLanguage(s);return new se(xe(n,c,o,a,r).stateStack,c.name,o.name)}function Rt(t,e,n,r,s){let i=xe(t,e,n,r,s),o=new se(i.stateStack,e.name,n.name);return K(i.tokens,o),i.tokens}function xe(t,e,n,r,s){let i=q(n,s),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500,includeExplanation:c=!1}=s,l=P(t),u=s.grammarState?Yn(s.grammarState,n.name)??ne:s.grammarContextCode!=null?xe(s.grammarContextCode,e,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:ne,h=[],d=[];for(let f=0,m=l.length;f<m;f++){let[y,_]=l[f];if(y===""){h=[],d.push([]);continue}if(o>0&&y.length>=o){h=[],d.push([{content:y,offset:_,color:"",fontStyle:0}]);continue}let p,g,b;if(c&&c!=="tokenType")p=e.tokenizeLine(y,u,a),g=p.tokens,b=0;let C=e.tokenizeLine2(y,u,a),R=C.tokens.length/2;for(let N=0;N<R;N++){let E=C.tokens[2*N],ge=N+1<R?C.tokens[2*N+2]:y.length;if(E===ge)continue;let pe=C.tokens[2*N+1],Zt=v(r[x.getForeground(pe)],i),en=x.getFontStyle(pe),Y={content:y.substring(E,ge),offset:_+E,color:Zt,fontStyle:en};if(c==="tokenType")Y.type=x.getTokenType(pe);else if(c){let Me=[];if(c!=="scopeName")for(let T of n.settings){let L;switch(typeof T.scope){case"string":L=T.scope.split(Jn).map((_e)=>_e.trim());break;case"object":L=T.scope;break;default:continue}Me.push({settings:T,selectors:L.map((_e)=>_e.split(Qn))})}Y.explanation=[];let je=0;while(E+je<ge){let T=g[b],L=y.substring(T.startIndex,T.endIndex);je+=L.length,Y.explanation.push({content:L,scopes:c==="scopeName"?Xn(T.scopes):Zn(Me,T.scopes)}),b+=1}}h.push(Y)}d.push(h),h=[],u=C.ruleStack}return{tokens:d,stateStack:u}}function Xn(t){return t.map((e)=>({scopeName:e}))}function Zn(t,e){let n=[];for(let r=0,s=e.length;r<s;r++){let i=e[r];n[r]={scopeName:i,themeMatches:tr(t,i,e.slice(0,r))}}return n}function gt(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function er(t,e,n){if(!gt(t.at(-1),e))return!1;let r=t.length-2,s=n.length-1;while(r>=0&&s>=0){if(gt(t[r],n[s]))r-=1;s-=1}if(r===-1)return!0;return!1}function tr(t,e,n){let r=[];for(let{selectors:s,settings:i}of t)for(let o of s)if(er(o,e,n)){r.push(i);break}return r}function ie(t,e,n,r=Ee){let s=Object.entries(n.themes).filter((l)=>l[1]).map((l)=>({color:l[0],theme:l[1]})),i=s.map((l)=>{let u=r(t,e,{...n,theme:l.theme});return{tokens:u,state:G(u),theme:typeof l.theme==="string"?l.theme:l.theme.name}}),o=nr(...i.map((l)=>l.tokens)),a=o[0].map((l,u)=>l.map((h,d)=>{let f={content:h.content,variants:{},offset:h.offset};if("includeExplanation"in n&&n.includeExplanation)f.explanation=h.explanation;return o.forEach((m,y)=>{let{content:_,explanation:p,offset:g,...b}=m[u][d];f.variants[s[y].color]=b}),f})),c=i[0].state?new se(Object.fromEntries(i.map((l)=>[l.theme,l.state?.getInternalStack(l.theme)])),i[0].state.lang):void 0;if(c)K(a,c);return a}function nr(...t){let e=t.map(()=>[]),n=t.length;for(let r=0;r<t[0].length;r++){let s=t.map((c)=>c[r]),i=e.map(()=>[]);e.forEach((c,l)=>c.push(i[l]));let o=s.map(()=>0),a=s.map((c)=>c[0]);while(a.every((c)=>c)){let c=Math.min(...a.map((l)=>l.content.length));for(let l=0;l<n;l++){let u=a[l];if(u.content.length===c)i[l].push(u),o[l]+=1,a[l]=s[l][o[l]];else i[l].push({...u,content:u.content.slice(0,c)}),a[l]={...u,content:u.content.slice(c),offset:u.offset+c}}}}return e}var Nt=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var Tt={}.hasOwnProperty;function vt(t,e){let n=e||{};function r(s,...i){let{invalid:o,handlers:a}=r;if(s&&Tt.call(s,t)){let c=String(s[t]);o=Tt.call(a,c)?a[c]:r.unknown}if(o)return o.call(this,s,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var rr=/["&'<>`]/g,sr=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ir=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,or=/[|\\{}()[\]^$+*?.]/g,At=new WeakMap;function Et(t,e){if(t=t.replace(e.subset?ar(e.subset):rr,r),e.subset||e.escapeOnly)return t;return t.replace(sr,n).replace(ir,r);function n(s,i,o){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),e)}function r(s,i,o){return e.format(s.charCodeAt(0),o.charCodeAt(i+1),e)}}function ar(t){let e=At.get(t);if(!e)e=cr(t),At.set(t,e);return e}function cr(t){let e=[],n=-1;while(++n<t.length)e.push(t[n].replace(or,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}var lr=/[\dA-Fa-f]/;function xt(t,e,n){let r="&#x"+t.toString(16).toUpperCase();return n&&e&&!lr.test(String.fromCharCode(e))?r:r+";"}var ur=/\d/;function It(t,e,n){let r="&#"+String(t);return n&&e&&!ur.test(String.fromCharCode(e))?r:r+";"}var Lt=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var oe={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"};var Pt=["cent","copy","divide","gt","lt","not","para","times"];var Gt={}.hasOwnProperty,Ie={},ae;for(ae in oe)if(Gt.call(oe,ae))Ie[oe[ae]]=ae;var hr=/[^\dA-Za-z]/;function Bt(t,e,n,r){let s=String.fromCharCode(t);if(Gt.call(Ie,s)){let i=Ie[s],o="&"+i;if(n&&Lt.includes(i)&&!Pt.includes(i)&&(!r||e&&e!==61&&hr.test(String.fromCharCode(e))))return o;return o+";"}return""}function Ot(t,e,n){let r=xt(t,e,n.omitOptionalSemicolons),s;if(n.useNamedReferences||n.useShortestReferences)s=Bt(t,e,n.omitOptionalSemicolons,n.attribute);if((n.useShortestReferences||!s)&&n.useShortestReferences){let i=It(t,e,n.omitOptionalSemicolons);if(i.length<r.length)r=i}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function A(t,e){return Et(t,Object.assign({format:Ot},e))}var fr=/^>|^->|<!--|-->|--!>|<!-$/g,dr=[">"],mr=["<",">"];function $t(t,e,n,r){return r.settings.bogusComments?"<?"+A(t.value,Object.assign({},r.settings.characterReferences,{subset:dr}))+">":"<!--"+t.value.replace(fr,s)+"-->";function s(i){return A(i,Object.assign({},r.settings.characterReferences,{subset:mr}))}}function Mt(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}var w=jt(1),Le=jt(-1),gr=[];function jt(t){return e;function e(n,r,s){let i=n?n.children:gr,o=(r||0)+t,a=i[o];if(!s)while(a&&pn(a))o+=t,a=i[o];return a}}var pr={}.hasOwnProperty;function ce(t){return e;function e(n,r,s){return pr.call(t,n.tagName)&&t[n.tagName](n,r,s)}}var V=ce({body:yr,caption:Pe,colgroup:Pe,dd:Cr,dt:wr,head:Pe,html:_r,li:Sr,optgroup:kr,option:Rr,p:br,rp:Ft,rt:Ft,tbody:vr,td:Dt,tfoot:Ar,th:Dt,thead:Tr,tr:Er});function Pe(t,e,n){let r=w(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&pn(r.value.charAt(0)))}function _r(t,e,n){let r=w(n,e);return!r||r.type!=="comment"}function yr(t,e,n){let r=w(n,e);return!r||r.type!=="comment"}function br(t,e,n){let r=w(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function Sr(t,e,n){let r=w(n,e);return!r||r.type==="element"&&r.tagName==="li"}function wr(t,e,n){let r=w(n,e);return Boolean(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Cr(t,e,n){let r=w(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function Ft(t,e,n){let r=w(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function kr(t,e,n){let r=w(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function Rr(t,e,n){let r=w(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Tr(t,e,n){let r=w(n,e);return Boolean(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function vr(t,e,n){let r=w(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Ar(t,e,n){return!w(n,e)}function Er(t,e,n){let r=w(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function Dt(t,e,n){let r=w(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}var Wt=ce({body:Lr,colgroup:Pr,head:Ir,html:xr,tbody:Gr});function xr(t){let e=w(t,-1);return!e||e.type!=="comment"}function Ir(t){let e=new Set;for(let r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}let n=t.children[0];return!n||n.type==="element"}function Lr(t){let e=w(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&pn(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function Pr(t,e,n){let r=Le(n,e),s=w(t,-1,!0);if(n&&r&&r.type==="element"&&r.tagName==="colgroup"&&V(r,n.children.indexOf(r),n))return!1;return Boolean(s&&s.type==="element"&&s.tagName==="col")}function Gr(t,e,n){let r=Le(n,e),s=w(t,-1);if(n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&V(r,n.children.indexOf(r),n))return!1;return Boolean(s&&s.type==="element"&&s.tagName==="tr")}var le={name:[[`
1
+ import{Jr,oi,On,Nr,si,li,fn}from"./chunk-qmbgb79a.js";var S=class extends Error{constructor(t){super(t);this.name="ShikiError"}};function tn(t){return Ne(t)}function Ne(t){if(Array.isArray(t))return nn(t);if(t instanceof RegExp)return t;if(typeof t==="object")return rn(t);return t}function nn(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=Ne(t[n]);return e}function rn(t){let e={};for(let n in t)e[n]=Ne(t[n]);return e}function Ve(t,...e){return e.forEach((n)=>{for(let r in n)t[r]=n[r]}),t}function Ye(t){let e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");if(e===0)return t;else if(~e===t.length-1)return Ye(t.substring(0,t.length-1));else return t.substr(~e+1)}var ye=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,J=class{static hasCaptures(t){if(t===null)return!1;return ye.lastIndex=0,ye.test(t)}static replaceCaptures(t,e,n){return t.replace(ye,(r,s,i,o)=>{let a=n[parseInt(s||i,10)];if(a){let c=e.substring(a.start,a.end);while(c[0]===".")c=c.substring(1);switch(o){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function Je(t,e){if(t<e)return-1;if(t>e)return 1;return 0}function Qe(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let s=0;s<n;s++){let i=Je(t[s],e[s]);if(i!==0)return i}return 0}return n-r}function Fe(t){if(/^#[0-9a-f]{6}$/i.test(t))return!0;if(/^#[0-9a-f]{8}$/i.test(t))return!0;if(/^#[0-9a-f]{3}$/i.test(t))return!0;if(/^#[0-9a-f]{4}$/i.test(t))return!0;return!1}function Xe(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Ze=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);let e=this.fn(t);return this.cache.set(t,e),e}},M=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(an(t),e)}static createFromParsedTheme(t,e){return ln(t,e)}_cachedMatchRoot=new Ze((t)=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;let e=t.scopeName,r=this._cachedMatchRoot.get(e).find((s)=>sn(t.parent,s.parentScopes));if(!r)return null;return new et(r.fontStyle,r.foreground,r.background)}},be=class t{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(let r of n)e=new t(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new t(n,e[r]);return n}push(e){return new t(this,e)}getSegments(){let e=this,n=[];while(e)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){if(this===e)return!0;if(this.parent===null)return!1;return this.parent.extends(e)}getExtensionIfDefined(e){let n=[],r=this;while(r&&r!==e)n.push(r.scopeName),r=r.parent;return r===e?n.reverse():void 0}};function sn(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let r=e[n],s=!1;if(r===">"){if(n===e.length-1)return!1;r=e[++n],s=!0}while(t){if(on(t.scopeName,r))break;if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function on(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var et=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function an(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],r=0;for(let s=0,i=e.length;s<i;s++){let o=e[s];if(!o.settings)continue;let a;if(typeof o.scope==="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),a=h.split(",")}else if(Array.isArray(o.scope))a=o.scope;else a=[""];let c=-1;if(typeof o.settings.fontStyle==="string"){c=0;let h=o.settings.fontStyle.split(" ");for(let d=0,f=h.length;d<f;d++)switch(h[d]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let l=null;if(typeof o.settings.foreground==="string"&&Fe(o.settings.foreground))l=o.settings.foreground;let u=null;if(typeof o.settings.background==="string"&&Fe(o.settings.background))u=o.settings.background;for(let h=0,d=a.length;h<d;h++){let m=a[h].trim().split(" "),y=m[m.length-1],_=null;if(m.length>1)_=m.slice(0,m.length-1),_.reverse();n[r++]=new cn(y,_,s,c,l,u)}}return n}var cn=class{constructor(t,e,n,r,s,i){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=s,this.background=i}},k=((t)=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(k||{});function ln(t,e){t.sort((c,l)=>{let u=Je(c.scope,l.scope);if(u!==0)return u;if(u=Qe(c.parentScopes,l.parentScopes),u!==0)return u;return c.index-l.index});let n=0,r="#000000",s="#ffffff";while(t.length>=1&&t[0].scope===""){let c=t.shift();if(c.fontStyle!==-1)n=c.fontStyle;if(c.foreground!==null)r=c.foreground;if(c.background!==null)s=c.background}let i=new un(e),o=new et(n,i.getId(r),i.getId(s)),a=new dn(new we(0,null,-1,0,0),[]);for(let c=0,l=t.length;c<l;c++){let u=t[c];a.insert(0,u.scope,u.parentScopes,u.fontStyle,i.getId(u.foreground),i.getId(u.background))}return new M(i,o,a)}var un=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},hn=Object.freeze([]),we=class t{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,r,s,i){this.scopeDepth=e,this.parentScopes=n||hn,this.fontStyle=r,this.foreground=s,this.background=i}clone(){return new t(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let r=0,s=e.length;r<s;r++)n[r]=e[r].clone();return n}acceptOverwrite(e,n,r,s){if(this.scopeDepth>e)console.log("how did this happen?");else this.scopeDepth=e;if(n!==-1)this.fontStyle=n;if(r!==0)this.foreground=r;if(s!==0)this.background=s}},dn=class t{constructor(e,n=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,s=0;while(!0){if(e.parentScopes[r]===">")r++;if(n.parentScopes[s]===">")s++;if(r>=e.parentScopes.length||s>=n.parentScopes.length)break;let i=n.parentScopes[s].length-e.parentScopes[r].length;if(i!==0)return i;r++,s++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,i;if(r===-1)s=e,i="";else s=e.substring(0,r),i=e.substring(r+1);if(this._children.hasOwnProperty(s))return this._children[s].match(i)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(t._cmpBySpecificity),n}insert(e,n,r,s,i,o){if(n===""){this._doInsertHere(e,r,s,i,o);return}let a=n.indexOf("."),c,l;if(a===-1)c=n,l="";else c=n.substring(0,a),l=n.substring(a+1);let u;if(this._children.hasOwnProperty(c))u=this._children[c];else u=new t(this._mainRule.clone(),we.cloneArr(this._rulesWithParentScopes)),this._children[c]=u;u.insert(e+1,l,r,s,i,o)}_doInsertHere(e,n,r,s,i){if(n===null){this._mainRule.acceptOverwrite(e,r,s,i);return}for(let o=0,a=this._rulesWithParentScopes.length;o<a;o++){let c=this._rulesWithParentScopes[o];if(Qe(c.parentScopes,n)===0){c.acceptOverwrite(e,r,s,i);return}}if(r===-1)r=this._mainRule.fontStyle;if(s===0)s=this._mainRule.foreground;if(i===0)i=this._mainRule.background;this._rulesWithParentScopes.push(new we(e,n,r,s,i))}},x=class t{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){let n=t.getLanguageId(e),r=t.getTokenType(e),s=t.getFontStyle(e),i=t.getForeground(e),o=t.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:i,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,r,s,i,o,a){let c=t.getLanguageId(e),l=t.getTokenType(e),u=t.containsBalancedBrackets(e)?1:0,h=t.getFontStyle(e),d=t.getForeground(e),f=t.getBackground(e);if(n!==0)c=n;if(r!==8)l=gn(r);if(s!==null)u=s?1:0;if(i!==-1)h=i;if(o!==0)d=o;if(a!==0)f=a;return(c<<0|l<<8|u<<10|h<<11|d<<15|f<<24)>>>0}};function mn(t){return t}function gn(t){return t}function X(t,e){let n=[],r=pn(t),s=r.next();while(s!==null){let c=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let l=o();if(n.push({matcher:l,priority:c}),s!==",")break;s=r.next()}return n;function i(){if(s==="-"){s=r.next();let c=i();return(l)=>!!c&&!c(l)}if(s==="("){s=r.next();let c=a();if(s===")")s=r.next();return c}if(De(s)){let c=[];do c.push(s),s=r.next();while(De(s));return(l)=>e(c,l)}return null}function o(){let c=[],l=i();while(l)c.push(l),l=i();return(u)=>c.every((h)=>h(u))}function a(){let c=[],l=o();while(l){if(c.push(l),s==="|"||s===",")do s=r.next();while(s==="|"||s===",");else break;l=o()}return(u)=>c.some((h)=>h(u))}}function De(t){return!!t&&!!t.match(/[\w\.:]+/)}function pn(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;let r=n[0];return n=e.exec(t),r}}}function tt(t){if(typeof t.dispose==="function")t.dispose()}var j=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},_n=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},yn=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){let e=t.toKey();if(this._seenReferenceKeys.has(e))return;this._seenReferenceKeys.add(e),this._references.push(t)}},bn=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new j(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let t=this.Q;this.Q=[];let e=new yn;for(let n of t)Sn(n,this.initialScopeName,this.repo,e);for(let n of e.references)if(n instanceof j){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName))continue;if(this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function Sn(t,e,n,r){let s=n.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw Error(`No grammar provided for <${e}>`);return}let i=n.lookup(e);if(t instanceof j)Q({baseGrammar:i,selfGrammar:s},r);else Ce(t.ruleName,{baseGrammar:i,selfGrammar:s,repository:s.repository},r);let o=n.injections(t.scopeName);if(o)for(let a of o)r.add(new j(a))}function Ce(t,e,n){if(e.repository&&e.repository[t]){let r=e.repository[t];Z([r],e,n)}}function Q(t,e){if(t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns))Z(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e);if(t.selfGrammar.injections)Z(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function Z(t,e,n){for(let r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let s=r.repository?Ve({},e.repository,r.repository):e.repository;if(Array.isArray(r.patterns))Z(r.patterns,{...e,repository:s},n);let i=r.include;if(!i)continue;let o=nt(i);switch(o.kind){case 0:Q({...e,selfGrammar:e.baseGrammar},n);break;case 1:Q(e,n);break;case 2:Ce(o.ruleName,{...e,repository:s},n);break;case 3:case 4:let a=o.scopeName===e.selfGrammar.scopeName?e.selfGrammar:o.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(a){let c={baseGrammar:e.baseGrammar,selfGrammar:a,repository:s};if(o.kind===4)Ce(o.ruleName,c,n);else Q(c,n)}else if(o.kind===4)n.add(new _n(o.scopeName,o.ruleName));else n.add(new j(o.scopeName));break}}}var wn=class{kind=0},Cn=class{kind=1},kn=class{constructor(t){this.ruleName=t}kind=2},Rn=class{constructor(t){this.scopeName=t}kind=3},Nn=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function nt(t){if(t==="$base")return new wn;else if(t==="$self")return new Cn;let e=t.indexOf("#");if(e===-1)return new Rn(t);else if(e===0)return new kn(t.substring(1));else{let n=t.substring(0,e),r=t.substring(e+1);return new Nn(n,r)}}var Tn=/\\(\d+)/,We=/\\(\d+)/g,ws=Symbol("RuleId"),vn=-1,rt=-2;function st(t){return t}function it(t){return t}var W=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,r){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=J.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=J.hasCaptures(this._contentName)}get debugName(){let t=this.$location?`${Ye(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){if(!this._nameIsCapturing||this._name===null||t===null||e===null)return this._name;return J.replaceCaptures(this._name,t,e)}getContentName(t,e){if(!this._contentNameIsCapturing||this._contentName===null)return this._contentName;return J.replaceCaptures(this._contentName,t,e)}},An=class extends W{retokenizeCapturedWithRuleId;constructor(t,e,n,r,s){super(t,e,n,r);this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,e){throw Error("Not supported!")}compile(t,e){throw Error("Not supported!")}compileAG(t,e,n,r){throw Error("Not supported!")}},En=class extends W{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,null);this._match=new F(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns)this._cachedCompiledPatterns=new D,this.collectPatterns(t,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}},He=class extends W{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,r);this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null}collectPatterns(t,e){for(let n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns)this._cachedCompiledPatterns=new D,this.collectPatterns(t,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}},ke=class extends W{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s,i,o,a,c,l){super(t,e,n,r);this._begin=new F(s,this.id),this.beginCaptures=i,this._end=new F(o?o:"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,r)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new D;for(let n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns);if(this.applyEndPatternLast)this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end);else this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}if(this._end.hasBackReferences)if(this.applyEndPatternLast)this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e);else this._cachedCompiledPatterns.setSource(0,e);return this._cachedCompiledPatterns}},ee=class extends W{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,s,i,o,a,c){super(t,e,n,r);this._begin=new F(s,this.id),this.beginCaptures=i,this.whileCaptures=a,this._while=new F(o,rt),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null;if(this._cachedCompiledWhilePatterns)this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new D;for(let e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,r){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,r)}_getCachedCompiledWhilePatterns(t,e){if(!this._cachedCompiledWhilePatterns)this._cachedCompiledWhilePatterns=new D,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while);if(this._while.hasBackReferences)this._cachedCompiledWhilePatterns.setSource(0,e?e:"￿");return this._cachedCompiledWhilePatterns}},ot=class t{static createCaptureRule(e,n,r,s,i){return e.registerRule((o)=>new An(n,o,r,s,i))}static getCompiledRuleId(e,n,r){if(!e.id)n.registerRule((s)=>{if(e.id=s,e.match)return new En(e.$vscodeTextmateLocation,e.id,e.name,e.match,t._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){if(e.repository)r=Ve({},r,e.repository);let i=e.patterns;if(typeof i>"u"&&e.include)i=[{include:e.include}];return new He(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,t._compilePatterns(i,n,r))}if(e.while)return new ee(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,t._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,t._compileCaptures(e.whileCaptures||e.captures,n,r),t._compilePatterns(e.patterns,n,r));return new ke(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,t._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,t._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,t._compilePatterns(e.patterns,n,r))});return e.id}static _compileCaptures(e,n,r){let s=[];if(e){let i=0;for(let o in e){if(o==="$vscodeTextmateLocation")continue;let a=parseInt(o,10);if(a>i)i=a}for(let o=0;o<=i;o++)s[o]=null;for(let o in e){if(o==="$vscodeTextmateLocation")continue;let a=parseInt(o,10),c=0;if(e[o].patterns)c=t.getCompiledRuleId(e[o],n,r);s[a]=t.createCaptureRule(n,e[o].$vscodeTextmateLocation,e[o].name,e[o].contentName,c)}}return s}static _compilePatterns(e,n,r){let s=[];if(e)for(let i=0,o=e.length;i<o;i++){let a=e[i],c=-1;if(a.include){let l=nt(a.include);switch(l.kind){case 0:case 1:c=t.getCompiledRuleId(r[a.include],n,r);break;case 2:let u=r[l.ruleName];if(u)c=t.getCompiledRuleId(u,n,r);break;case 3:case 4:let h=l.scopeName,d=l.kind===4?l.ruleName:null,f=n.getExternalGrammar(h,r);if(f)if(d){let m=f.repository[d];if(m)c=t.getCompiledRuleId(m,n,f.repository)}else c=t.getCompiledRuleId(f.repository.$self,n,f.repository);break}}else c=t.getCompiledRuleId(a,n,r);if(c!==-1){let l=n.getRule(c),u=!1;if(l instanceof He||l instanceof ke||l instanceof ee){if(l.hasMissingPatterns&&l.patterns.length===0)u=!0}if(u)continue;s.push(c)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},F=class t{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e==="string"){let r=e.length,s=0,i=[],o=!1;for(let a=0;a<r;a++)if(e.charAt(a)==="\\"){if(a+1<r){let l=e.charAt(a+1);if(l==="z")i.push(e.substring(s,a)),i.push("$(?!\\n)(?<!\\n)"),s=a+2;else if(l==="A"||l==="G")o=!0;a++}}if(this.hasAnchor=o,s===0)this.source=e;else i.push(e.substring(s,r)),this.source=i.join("")}else this.hasAnchor=!1,this.source=e;if(this.hasAnchor)this._anchorCache=this._buildAnchorCache();else this._anchorCache=null;if(this.ruleId=n,typeof this.source==="string")this.hasBackReferences=Tn.test(this.source);else this.hasBackReferences=!1}clone(){return new t(this.source,this.ruleId)}setSource(e){if(this.source===e)return;if(this.source=e,this.hasAnchor)this._anchorCache=this._buildAnchorCache()}resolveBackReferences(e,n){if(typeof this.source!=="string")throw Error("This method should only be called if the source is a string");let r=n.map((s)=>e.substring(s.start,s.end));return We.lastIndex=0,this.source.replace(We,(s,i)=>Xe(r[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!=="string")throw Error("This method should only be called if the source is a string");let e=[],n=[],r=[],s=[],i,o,a,c;for(i=0,o=this.source.length;i<o;i++)if(a=this.source.charAt(i),e[i]=a,n[i]=a,r[i]=a,s[i]=a,a==="\\"){if(i+1<o){if(c=this.source.charAt(i+1),c==="A")e[i+1]="￿",n[i+1]="￿",r[i+1]="A",s[i+1]="A";else if(c==="G")e[i+1]="￿",n[i+1]="G",r[i+1]="￿",s[i+1]="G";else e[i+1]=c,n[i+1]=c,r[i+1]=c,s[i+1]=c;i++}}return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(e,n){if(!this.hasAnchor||!this._anchorCache||typeof this.source!=="string")return this.source;if(e)if(n)return this._anchorCache.A1_G1;else return this._anchorCache.A1_G0;else if(n)return this._anchorCache.A0_G1;else return this._anchorCache.A0_G0}},D=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){if(this._cached)this._cached.dispose(),this._cached=null;if(this._anchorCache.A0_G0)this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null;if(this._anchorCache.A0_G1)this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null;if(this._anchorCache.A1_G0)this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null;if(this._anchorCache.A1_G1)this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){if(this._items[t].source!==e)this._disposeCaches(),this._items[t].setSource(e)}compile(t){if(!this._cached){let e=this._items.map((n)=>n.source);this._cached=new qe(t,e,this._items.map((n)=>n.ruleId))}return this._cached}compileAG(t,e,n){if(!this._hasAnchors)return this.compile(t);else if(e)if(n){if(!this._anchorCache.A1_G1)this._anchorCache.A1_G1=this._resolveAnchors(t,e,n);return this._anchorCache.A1_G1}else{if(!this._anchorCache.A1_G0)this._anchorCache.A1_G0=this._resolveAnchors(t,e,n);return this._anchorCache.A1_G0}else if(n){if(!this._anchorCache.A0_G1)this._anchorCache.A0_G1=this._resolveAnchors(t,e,n);return this._anchorCache.A0_G1}else{if(!this._anchorCache.A0_G0)this._anchorCache.A0_G0=this._resolveAnchors(t,e,n);return this._anchorCache.A0_G0}}_resolveAnchors(t,e,n){let r=this._items.map((s)=>s.resolveAnchors(e,n));return new qe(t,r,this._items.map((s)=>s.ruleId))}},qe=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){if(typeof this.scanner.dispose==="function")this.scanner.dispose()}toString(){let t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
2
+ `)}findNextMatchSync(t,e,n){let r=this.scanner.findNextMatchSync(t,e,n);if(!r)return null;return{ruleId:this.rules[r.index],captureIndices:r.captureIndices}}},Se=class{constructor(t,e){this.languageId=t,this.tokenType=e}},xn=class t{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new Se(e,8),this._embeddedLanguagesMatcher=new In(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){if(e===null)return t._NULL_SCOPE_METADATA;return this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new Se(0,0);_getBasicScopeAttributes=new Ze((e)=>{let n=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new Se(n,r)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){let n=e.match(t.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},In=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);let e=t.map(([n,r])=>Xe(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;let e=t.match(this.scopesRegExp);if(!e)return;return this.values.get(e[1])}},Cs={InDebugMode:typeof process<"u"&&!!process.env.VSCODE_TEXTMATE_DEBUG},at=!1,ze=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function ct(t,e,n,r,s,i,o,a){let c=e.content.length,l=!1,u=-1;if(o){let f=Ln(t,e,n,r,s,i);s=f.stack,r=f.linePos,n=f.isFirstLine,u=f.anchorPosition}let h=Date.now();while(!l){if(a!==0){if(Date.now()-h>a)return new ze(s,!0)}d()}return new ze(s,!1);function d(){let f=Pn(t,e,n,r,s,u);if(!f){i.produce(s,c),l=!0;return}let{captureIndices:m,matchedRuleId:y}=f,_=m&&m.length>0?m[0].end>r:!1;if(y===vn){let p=s.getRule(t);i.produce(s,m[0].start),s=s.withContentNameScopesList(s.nameScopesList),B(t,e,n,s,i,p.endCaptures,m),i.produce(s,m[0].end);let g=s;if(s=s.parent,u=g.getAnchorPos(),!_&&g.getEnterPos()===r){s=g,i.produce(s,c),l=!0;return}}else{let p=t.getRule(y);i.produce(s,m[0].start);let g=s,b=p.getName(e.content,m),C=s.contentNameScopesList.pushAttributed(b,t);if(s=s.push(y,r,u,m[0].end===c,null,C,C),p instanceof ke){let R=p;B(t,e,n,s,i,R.beginCaptures,m),i.produce(s,m[0].end),u=m[0].end;let N=R.getContentName(e.content,m),E=C.pushAttributed(N,t);if(s=s.withContentNameScopesList(E),R.endHasBackReferences)s=s.withEndRule(R.getEndWithResolvedBackReferences(e.content,m));if(!_&&g.hasSameRuleAs(s)){s=s.pop(),i.produce(s,c),l=!0;return}}else if(p instanceof ee){let R=p;B(t,e,n,s,i,R.beginCaptures,m),i.produce(s,m[0].end),u=m[0].end;let N=R.getContentName(e.content,m),E=C.pushAttributed(N,t);if(s=s.withContentNameScopesList(E),R.whileHasBackReferences)s=s.withEndRule(R.getWhileWithResolvedBackReferences(e.content,m));if(!_&&g.hasSameRuleAs(s)){s=s.pop(),i.produce(s,c),l=!0;return}}else if(B(t,e,n,s,i,p.captures,m),i.produce(s,m[0].end),s=s.pop(),!_){s=s.safePop(),i.produce(s,c),l=!0;return}}if(m[0].end>r)r=m[0].end,n=!1}}function Ln(t,e,n,r,s,i){let o=s.beginRuleCapturedEOL?0:-1,a=[];for(let c=s;c;c=c.pop()){let l=c.getRule(t);if(l instanceof ee)a.push({rule:l,stack:c})}for(let c=a.pop();c;c=a.pop()){let{ruleScanner:l,findOptions:u}=$n(c.rule,t,c.stack.endRule,n,r===o),h=l.findNextMatchSync(e,r,u);if(h){if(h.ruleId!==rt){s=c.stack.pop();break}if(h.captureIndices&&h.captureIndices.length){if(i.produce(c.stack,h.captureIndices[0].start),B(t,e,n,c.stack,i,c.rule.whileCaptures,h.captureIndices),i.produce(c.stack,h.captureIndices[0].end),o=h.captureIndices[0].end,h.captureIndices[0].end>r)r=h.captureIndices[0].end,n=!1}}else{s=c.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:o,isFirstLine:n}}function Pn(t,e,n,r,s,i){let o=Gn(t,e,n,r,s,i),a=t.getInjections();if(a.length===0)return o;let c=Bn(a,t,e,n,r,s,i);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;if(u<l||c.priorityMatch&&u===l)return c;return o}function Gn(t,e,n,r,s,i){let o=s.getRule(t),{ruleScanner:a,findOptions:c}=lt(o,t,s.endRule,n,r===i),l=a.findNextMatchSync(e,r,c);if(l)return{captureIndices:l.captureIndices,matchedRuleId:l.ruleId};return null}function Bn(t,e,n,r,s,i,o){let a=Number.MAX_VALUE,c=null,l,u=0,h=i.contentNameScopesList.getScopeNames();for(let d=0,f=t.length;d<f;d++){let m=t[d];if(!m.matcher(h))continue;let y=e.getRule(m.ruleId),{ruleScanner:_,findOptions:p}=lt(y,e,null,r,s===o),g=_.findNextMatchSync(n,s,p);if(!g)continue;let b=g.captureIndices[0].start;if(b>=a)continue;if(a=b,c=g.captureIndices,l=g.ruleId,u=m.priority,a===s)break}if(c)return{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l};return null}function lt(t,e,n,r,s){if(at){let o=t.compile(e,n),a=ut(r,s);return{ruleScanner:o,findOptions:a}}return{ruleScanner:t.compileAG(e,n,r,s),findOptions:0}}function $n(t,e,n,r,s){if(at){let o=t.compileWhile(e,n),a=ut(r,s);return{ruleScanner:o,findOptions:a}}return{ruleScanner:t.compileWhileAG(e,n,r,s),findOptions:0}}function ut(t,e){let n=0;if(!t)n|=1;if(!e)n|=4;return n}function B(t,e,n,r,s,i,o){if(i.length===0)return;let a=e.content,c=Math.min(i.length,o.length),l=[],u=o[0].end;for(let h=0;h<c;h++){let d=i[h];if(d===null)continue;let f=o[h];if(f.length===0)continue;if(f.start>u)break;while(l.length>0&&l[l.length-1].endPos<=f.start)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0)s.produceFromScopes(l[l.length-1].scopes,f.start);else s.produce(r,f.start);if(d.retokenizeCapturedWithRuleId){let y=d.getName(a,o),_=r.contentNameScopesList.pushAttributed(y,t),p=d.getContentName(a,o),g=_.pushAttributed(p,t),b=r.push(d.retokenizeCapturedWithRuleId,f.start,-1,!1,null,_,g),C=t.createOnigString(a.substring(0,f.end));ct(t,C,n&&f.start===0,f.start,b,s,!1,0),tt(C);continue}let m=d.getName(a,o);if(m!==null){let _=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(m,t);l.push(new Mn(_,f.end))}}while(l.length>0)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Mn=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function jn(t,e,n,r,s,i,o,a){return new Dn(t,e,n,r,s,i,o,a)}function Ue(t,e,n,r,s){let i=X(e,te),o=ot.getCompiledRuleId(n,r,s.repository);for(let a of i)t.push({debugSelector:e,matcher:a.matcher,ruleId:o,grammar:s,priority:a.priority})}function te(t,e){if(e.length<t.length)return!1;let n=0;return t.every((r)=>{for(let s=n;s<e.length;s++)if(Fn(e[s],r))return n=s+1,!0;return!1})}function Fn(t,e){if(!t)return!1;if(t===e)return!0;let n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var Dn=class{constructor(t,e,n,r,s,i,o,a){if(this._rootScopeName=t,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new xn(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Ke(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(let c of Object.keys(s)){let l=X(c,te);for(let u of l)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[c]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let t of this._ruleId2desc)if(t)t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){let t={lookup:(s)=>{if(s===this._rootScopeName)return this._grammar;return this.getExternalGrammar(s)},injections:(s)=>this._grammarRepository.injections(s)},e=[],n=this._rootScopeName,r=t.lookup(n);if(r){let s=r.injections;if(s)for(let o in s)Ue(e,o,s[o],this,r);let i=this._grammarRepository.injections(n);if(i)i.forEach((o)=>{let a=this.getExternalGrammar(o);if(a){let c=a.injectionSelector;if(c)Ue(e,c,a,this,a)}})}return e.sort((s,i)=>s.priority-i.priority),e}getInjections(){if(this._injections===null)this._injections=this._collectInjections();return this._injections}registerRule(t){let e=++this._lastRuleId,n=t(st(e));return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[it(t)]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];else if(this._grammarRepository){let n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=Ke(n,e&&e.$base),this._includedGrammars[t]}return}tokenizeLine(t,e,n=0){let r=this._tokenize(t,e,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(t,e,n=0){let r=this._tokenize(t,e,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(t,e,n,r){if(this._rootId===-1)this._rootId=ot.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections();let s;if(!e||e===Re.NULL){s=!0;let l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),h=x.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),d=this.getRule(this._rootId).getName(null,null),f;if(d)f=O.createRootAndLookUpScopeName(d,h,this);else f=O.createRoot("unknown",h);e=new Re(null,this._rootId,-1,-1,!1,null,f,f)}else s=!1,e.reset();t=t+`
3
+ `;let i=this.createOnigString(t),o=i.content.length,a=new Hn(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),c=ct(this,i,s,0,e,a,!0,r);return tt(i),{lineLength:o,lineTokens:a,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Ke(t,e){return t=tn(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var O=class t{constructor(e,n,r){this.parent=e,this.scopePath=n,this.tokenAttributes=r}static fromExtension(e,n){let r=e,s=e?.scopePath??null;for(let i of n)s=be.push(s,i.scopeNames),r=new t(r,s,i.encodedTokenAttributes);return r}static createRoot(e,n){return new t(null,new be(null,e),n)}static createRootAndLookUpScopeName(e,n,r){let s=r.getMetadataForScope(e),i=new be(null,e),o=r.themeProvider.themeMatch(i),a=t.mergeAttributes(n,s,o);return new t(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return t.equals(this,e)}static equals(e,n){do{if(e===n)return!0;if(!e&&!n)return!0;if(!e||!n)return!1;if(e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,r){let s=-1,i=0,o=0;if(r!==null)s=r.fontStyle,i=r.foregroundId,o=r.backgroundId;return x.set(e,n.languageId,n.tokenType,null,s,i,o)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return t._pushAttributed(this,e,n);let r=e.split(/ /g),s=this;for(let i of r)s=t._pushAttributed(s,i,n);return s}static _pushAttributed(e,n,r){let s=r.getMetadataForScope(n),i=e.scopePath.push(n),o=r.themeProvider.themeMatch(i),a=t.mergeAttributes(e.tokenAttributes,s,o);return new t(e,i,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let n=[],r=this;while(r&&r!==e)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?n.reverse():void 0}},Re=class t{constructor(e,n,r,s,i,o,a,c){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=a,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new t(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){if(e===null)return!1;return t._equals(this,e)}static _equals(e,n){if(e===n)return!0;if(!this._structuralEquals(e,n))return!1;return O.equals(e.contentNameScopesList,n.contentNameScopesList)}static _structuralEquals(e,n){do{if(e===n)return!0;if(!e&&!n)return!0;if(!e||!n)return!1;if(e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){while(e)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){t._reset(this)}pop(){return this.parent}safePop(){if(this.parent)return this.parent;return this}push(e,n,r,s,i,o,a){return new t(this,e,n,r,s,i,o,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,n){if(this.parent)n=this.parent._writeString(e,n);return e[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(e){if(this.contentNameScopesList===e)return this;return this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){if(this.endRule===e)return this;return new t(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;while(n&&n._enterPos===e._enterPos){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:it(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(e,n){let r=O.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new t(e,st(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,O.fromExtension(r,n.contentNameScopesList))}},Wn=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap((n)=>{if(n==="*")return this.allowAny=!0,[];return X(n,te).map((r)=>r.matcher)}),this.unbalancedBracketScopes=e.flatMap((n)=>X(n,te).map((r)=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(let e of this.unbalancedBracketScopes)if(e(t))return!1;for(let e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},Hn=class{constructor(t,e,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let r=t?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways)s=!0;if(this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let i=t?.getScopeNames()??[];for(let o of this._tokenTypeOverrides)if(o.matcher(i))r=x.set(r,0,mn(o.type),null,-1,0,0);if(this.balancedBracketSelectors)s=this.balancedBracketSelectors.match(i)}if(s)r=x.set(r,0,8,s,-1,0,0);if(this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=e;return}let n=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,e){if(this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1)this._tokens.pop();if(this._tokens.length===0)this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0;return this._tokens}getBinaryResult(t,e){if(this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1)this._binaryTokens.pop(),this._binaryTokens.pop();if(this._binaryTokens.length===0)this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0;let n=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},qn=class{constructor(t,e){this._onigLib=e,this._theme=t}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){if(this._rawGrammars.set(t.scopeName,t),e)this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,n,r,s){if(!this._grammars.has(t)){let i=this._rawGrammars.get(t);if(!i)return null;this._grammars.set(t,jn(t,i,e,n,r,s,this,this._onigLib))}return this._grammars.get(t)}},ht=class{_options;_syncRegistry;_ensureGrammarCache;constructor(t){this._options=t,this._syncRegistry=new qn(M.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,e){this._syncRegistry.setTheme(M.createFromRawTheme(t,e))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,e,n){return this.loadGrammarWithConfiguration(t,e,{embeddedLanguages:n})}loadGrammarWithConfiguration(t,e,n){return this._loadGrammar(t,e,n.embeddedLanguages,n.tokenTypes,new Wn(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,e,n,r,s){let i=new bn(this._syncRegistry,t);while(i.Q.length>0)i.Q.map((o)=>this._loadSingleGrammar(o.scopeName)),i.processQueue();return this._grammarForScopeName(t,e,n,r,s)}_loadSingleGrammar(t){if(!this._ensureGrammarCache.has(t))this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0)}_doLoadSingleGrammar(t){let e=this._options.loadGrammar(t);if(e){let n=typeof this._options.getInjections==="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(e,n)}}addGrammar(t,e=[],n=0,r=null){return this._syncRegistry.addGrammar(t,e),this._grammarForScopeName(t.scopeName,n,r)}_grammarForScopeName(t,e=0,n=null,r=null,s=null){return this._syncRegistry.grammarForScopeName(t,e,n,r,s)}},ne=Re.NULL;function q(t,e){let n=typeof t==="string"?{}:{...t.colorReplacements},r=typeof t==="string"?t:t.name;for(let[s,i]of Object.entries(e?.colorReplacements||{}))if(typeof i==="string")n[s]=i;else if(s===r)Object.assign(n,i);return n}function v(t,e){if(!t)return t;return e?.[t?.toLowerCase()]||t}function pt(t){return Array.isArray(t)?t:[t]}async function Te(t){return Promise.resolve(typeof t==="function"?t():t).then((e)=>e.default||e)}function z(t){return!t||["plaintext","txt","text","plain"].includes(t)}function _t(t){return t==="ansi"||z(t)}function U(t){return t==="none"}function yt(t){return U(t)}var zn=/(\r?\n)/g;function P(t,e=!1){if(t.length===0)return[["",0]];let n=t.split(zn),r=0,s=[];for(let i=0;i<n.length;i+=2){let o=e?n[i]+(n[i+1]||""):n[i];s.push([o,r]),r+=n[i].length,r+=n[i+1]?.length||0}return s}var ft={light:"#333333",dark:"#bbbbbb"},dt={light:"#fffffe",dark:"#1e1e1e"},mt="__shiki_resolved";function re(t){if(t?.[mt])return t;let e={...t};if(e.tokenColors&&!e.settings)e.settings=e.tokenColors,delete e.tokenColors;e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:n,fg:r}=e;if(!n||!r){let a=e.settings?e.settings.find((c)=>!c.name&&!c.scope):void 0;if(a?.settings?.foreground)r=a.settings.foreground;if(a?.settings?.background)n=a.settings.background;if(!r&&e?.colors?.["editor.foreground"])r=e.colors["editor.foreground"];if(!n&&e?.colors?.["editor.background"])n=e.colors["editor.background"];if(!r)r=e.type==="light"?ft.light:ft.dark;if(!n)n=e.type==="light"?dt.light:dt.dark;e.fg=r,e.bg=n}if(!(e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope))e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let s=0,i=new Map;function o(a){if(i.has(a))return i.get(a);s+=1;let c=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;if(e.colorReplacements?.[`#${c}`])return o(a);return i.set(a,c),c}e.settings=e.settings.map((a)=>{let c=a.settings?.foreground&&!a.settings.foreground.startsWith("#"),l=a.settings?.background&&!a.settings.background.startsWith("#");if(!c&&!l)return a;let u={...a,settings:{...a.settings}};if(c){let h=o(a.settings.foreground);e.colorReplacements[h]=a.settings.foreground,u.settings.foreground=h}if(l){let h=o(a.settings.background);e.colorReplacements[h]=a.settings.background,u.settings.background=h}return u});for(let a of Object.keys(e.colors||{}))if(a==="editor.foreground"||a==="editor.background"||a.startsWith("terminal.ansi")){if(!e.colors[a]?.startsWith("#")){let c=o(e.colors[a]);e.colorReplacements[c]=e.colors[a],e.colors[a]=c}}return Object.defineProperty(e,mt,{enumerable:!1,writable:!1,value:!0}),e}async function bt(t){return[...new Set((await Promise.all(t.filter((e)=>!_t(e)).map(async(e)=>await Te(e).then((n)=>Array.isArray(n)?n:[n])))).flat())]}async function St(t){return(await Promise.all(t.map(async(e)=>yt(e)?null:re(await Te(e))))).filter((e)=>!!e)}function wt(t,e){if(!e)return t;if(e[t]){let n=new Set([t]);while(e[t]){if(t=e[t],n.has(t))throw new S(`Circular alias \`${[...n].join(" -> ")} -> ${t}\``);n.add(t)}}return t}var Un=class extends ht{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(t,e,n,r={}){super(t);this._resolver=t,this._themes=e,this._langs=n,this._alias=r,this._themes.map((s)=>this.loadTheme(s)),this.loadLanguages(this._langs)}getTheme(t){if(typeof t==="string")return this._resolvedThemes.get(t);else return this.loadTheme(t)}loadTheme(t){let e=re(t);if(e.name)this._resolvedThemes.set(e.name,e),this._loadedThemesCache=null;return e}getLoadedThemes(){if(!this._loadedThemesCache)this._loadedThemesCache=[...this._resolvedThemes.keys()];return this._loadedThemesCache}setTheme(t){let e=this._textmateThemeCache.get(t);if(!e)e=M.createFromRawTheme(t),this._textmateThemeCache.set(t,e);this._syncRegistry.setTheme(e)}getGrammar(t){return t=wt(t,this._alias),this._resolvedGrammars.get(t)}loadLanguage(t){if(this.getGrammar(t.name))return;let e=new Set([...this._langMap.values()].filter((s)=>s.embeddedLangsLazy?.includes(t.name)));this._resolver.addLanguage(t);let n={balancedBracketSelectors:t.balancedBracketSelectors||["*"],unbalancedBracketSelectors:t.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(t.scopeName,t);let r=this.loadGrammarWithConfiguration(t.scopeName,1,n);if(r.name=t.name,this._resolvedGrammars.set(t.name,r),t.aliases)t.aliases.forEach((s)=>{this._alias[s]=t.name});if(this._loadedLanguagesCache=null,e.size)for(let s of e)this._resolvedGrammars.delete(s.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(s.scopeName),this._syncRegistry?._grammars?.delete(s.scopeName),this.loadLanguage(this._langMap.get(s.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(t){for(let r of t)this.resolveEmbeddedLanguages(r);let e=[...this._langGraph.entries()],n=e.filter(([r,s])=>!s);if(n.length){let r=e.filter(([s,i])=>{if(!i)return!1;return(i.embeddedLanguages||i.embeddedLangs)?.some((o)=>n.map(([a])=>a).includes(o))}).filter((s)=>!n.includes(s));throw new S(`Missing languages ${n.map(([s])=>`\`${s}\``).join(", ")}, required by ${r.map(([s])=>`\`${s}\``).join(", ")}`)}for(let[r,s]of e)this._resolver.addLanguage(s);for(let[r,s]of e)this.loadLanguage(s)}getLoadedLanguages(){if(!this._loadedLanguagesCache)this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])];return this._loadedLanguagesCache}resolveEmbeddedLanguages(t){this._langMap.set(t.name,t),this._langGraph.set(t.name,t);let e=t.embeddedLanguages??t.embeddedLangs;if(e)for(let n of e)this._langGraph.set(n,this._langMap.get(n))}},Kn=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(t,e){this._onigLib={createOnigScanner:(n)=>t.createScanner(n),createOnigString:(n)=>t.createString(n)},e.forEach((n)=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){if(this._langs.set(t.name,t),t.aliases)t.aliases.forEach((e)=>{this._langs.set(e,t)});if(this._scopeToLang.set(t.scopeName,t),t.injectTo)t.injectTo.forEach((e)=>{if(!this._injections.get(e))this._injections.set(e,[]);this._injections.get(e).push(t.scopeName)})}getInjections(t){let e=t.split("."),n=[];for(let r=1;r<=e.length;r++){let s=e.slice(0,r).join(".");n=[...n,...this._injections.get(s)||[]]}return n}},H=0;function ve(t){if(H+=1,t.warnings!==!1&&H>=10&&H%10===0)console.warn(`[Shiki] ${H} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let e=!1;if(!t.engine)throw new S("`engine` option is required for synchronous mode");let n=(t.langs||[]).flat(1),r=(t.themes||[]).flat(1).map(re),s=new Un(new Kn(t.engine,n),r,n,t.langAlias),i;function o(g){return wt(g,t.langAlias)}function a(g){_();let b=s.getGrammar(typeof g==="string"?g:g.name);if(!b)throw new S(`Language \`${g}\` not found, you may need to load it first`);return b}function c(g){if(g==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};_();let b=s.getTheme(g);if(!b)throw new S(`Theme \`${g}\` not found, you may need to load it first`);return b}function l(g){_();let b=c(g);if(i!==g)s.setTheme(b),i=g;return{theme:b,colorMap:s.getColorMap()}}function u(){return _(),s.getLoadedThemes()}function h(){return _(),s.getLoadedLanguages()}function d(...g){_(),s.loadLanguages(g.flat(1))}async function f(...g){return d(await bt(g))}function m(...g){_();for(let b of g.flat(1))s.loadTheme(b)}async function y(...g){return _(),m(await St(g))}function _(){if(e)throw new S("Shiki instance has been disposed")}function p(){if(e)return;e=!0,s.dispose(),H-=1}return{setTheme:l,getTheme:c,getLanguage:a,getLoadedThemes:u,getLoadedLanguages:h,resolveLangAlias:o,loadLanguage:f,loadLanguageSync:d,loadTheme:y,loadThemeSync:m,dispose:p,[Symbol.dispose]:p}}async function Ae(t){if(!t.engine)console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[e,n,r]=await Promise.all([St(t.themes||[]),bt(t.langs||[]),t.engine]);return ve({...t,themes:e,langs:n,engine:r})}var Ct=new WeakMap;function K(t,e){Ct.set(t,e)}function G(t){return Ct.get(t)}var se=class t{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,n){return new t(Object.fromEntries(pt(n).map((r)=>[r,ne])),e)}constructor(...e){if(e.length===2){let[n,r]=e;this.lang=r,this._stacks=n}else{let[n,r,s]=e;this.lang=r,this._stacks={[s]:n}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return Vn(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Vn(t){let e=[],n=new Set;function r(s){if(n.has(s))return;n.add(s);let i=s?.nameScopesList?.scopeName;if(i)e.push(i);if(s.parent)r(s.parent)}return r(t),e}function Yn(t,e){if(!(t instanceof se))throw new S("Invalid grammar state");return t.getInternalStack(e)}var Jn=/,/,Qn=/ /;function Ee(t,e,n={}){let{theme:r=t.getLoadedThemes()[0]}=n;if(z(t.resolveLangAlias(n.lang||"text"))||U(r))return P(e).map((a)=>[{content:a[0],offset:a[1]}]);let{theme:s,colorMap:i}=t.setTheme(r),o=t.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==o.name)throw new S(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(s.name))throw new S(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${s.name}"`)}return Rt(e,o,s,i,n)}function kt(...t){if(t.length===2)return G(t[1]);let[e,n,r={}]=t,{lang:s="text",theme:i=e.getLoadedThemes()[0]}=r;if(z(s)||U(i))throw new S("Plain language does not have grammar state");if(s==="ansi")throw new S("ANSI language does not have grammar state");let{theme:o,colorMap:a}=e.setTheme(i),c=e.getLanguage(s);return new se(xe(n,c,o,a,r).stateStack,c.name,o.name)}function Rt(t,e,n,r,s){let i=xe(t,e,n,r,s),o=new se(i.stateStack,e.name,n.name);return K(i.tokens,o),i.tokens}function xe(t,e,n,r,s){let i=q(n,s),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500,includeExplanation:c=!1}=s,l=P(t),u=s.grammarState?Yn(s.grammarState,n.name)??ne:s.grammarContextCode!=null?xe(s.grammarContextCode,e,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:ne,h=[],d=[];for(let f=0,m=l.length;f<m;f++){let[y,_]=l[f];if(y===""){h=[],d.push([]);continue}if(o>0&&y.length>=o){h=[],d.push([{content:y,offset:_,color:"",fontStyle:0}]);continue}let p,g,b;if(c&&c!=="tokenType")p=e.tokenizeLine(y,u,a),g=p.tokens,b=0;let C=e.tokenizeLine2(y,u,a),R=C.tokens.length/2;for(let N=0;N<R;N++){let E=C.tokens[2*N],ge=N+1<R?C.tokens[2*N+2]:y.length;if(E===ge)continue;let pe=C.tokens[2*N+1],Zt=v(r[x.getForeground(pe)],i),en=x.getFontStyle(pe),Y={content:y.substring(E,ge),offset:_+E,color:Zt,fontStyle:en};if(c==="tokenType")Y.type=x.getTokenType(pe);else if(c){let Me=[];if(c!=="scopeName")for(let T of n.settings){let L;switch(typeof T.scope){case"string":L=T.scope.split(Jn).map((_e)=>_e.trim());break;case"object":L=T.scope;break;default:continue}Me.push({settings:T,selectors:L.map((_e)=>_e.split(Qn))})}Y.explanation=[];let je=0;while(E+je<ge){let T=g[b],L=y.substring(T.startIndex,T.endIndex);je+=L.length,Y.explanation.push({content:L,scopes:c==="scopeName"?Xn(T.scopes):Zn(Me,T.scopes)}),b+=1}}h.push(Y)}d.push(h),h=[],u=C.ruleStack}return{tokens:d,stateStack:u}}function Xn(t){return t.map((e)=>({scopeName:e}))}function Zn(t,e){let n=[];for(let r=0,s=e.length;r<s;r++){let i=e[r];n[r]={scopeName:i,themeMatches:tr(t,i,e.slice(0,r))}}return n}function gt(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function er(t,e,n){if(!gt(t.at(-1),e))return!1;let r=t.length-2,s=n.length-1;while(r>=0&&s>=0){if(gt(t[r],n[s]))r-=1;s-=1}if(r===-1)return!0;return!1}function tr(t,e,n){let r=[];for(let{selectors:s,settings:i}of t)for(let o of s)if(er(o,e,n)){r.push(i);break}return r}function ie(t,e,n,r=Ee){let s=Object.entries(n.themes).filter((l)=>l[1]).map((l)=>({color:l[0],theme:l[1]})),i=s.map((l)=>{let u=r(t,e,{...n,theme:l.theme});return{tokens:u,state:G(u),theme:typeof l.theme==="string"?l.theme:l.theme.name}}),o=nr(...i.map((l)=>l.tokens)),a=o[0].map((l,u)=>l.map((h,d)=>{let f={content:h.content,variants:{},offset:h.offset};if("includeExplanation"in n&&n.includeExplanation)f.explanation=h.explanation;return o.forEach((m,y)=>{let{content:_,explanation:p,offset:g,...b}=m[u][d];f.variants[s[y].color]=b}),f})),c=i[0].state?new se(Object.fromEntries(i.map((l)=>[l.theme,l.state?.getInternalStack(l.theme)])),i[0].state.lang):void 0;if(c)K(a,c);return a}function nr(...t){let e=t.map(()=>[]),n=t.length;for(let r=0;r<t[0].length;r++){let s=t.map((c)=>c[r]),i=e.map(()=>[]);e.forEach((c,l)=>c.push(i[l]));let o=s.map(()=>0),a=s.map((c)=>c[0]);while(a.every((c)=>c)){let c=Math.min(...a.map((l)=>l.content.length));for(let l=0;l<n;l++){let u=a[l];if(u.content.length===c)i[l].push(u),o[l]+=1,a[l]=s[l][o[l]];else i[l].push({...u,content:u.content.slice(0,c)}),a[l]={...u,content:u.content.slice(c),offset:u.offset+c}}}}return e}var Nt=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var Tt={}.hasOwnProperty;function vt(t,e){let n=e||{};function r(s,...i){let{invalid:o,handlers:a}=r;if(s&&Tt.call(s,t)){let c=String(s[t]);o=Tt.call(a,c)?a[c]:r.unknown}if(o)return o.call(this,s,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var rr=/["&'<>`]/g,sr=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ir=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,or=/[|\\{}()[\]^$+*?.]/g,At=new WeakMap;function Et(t,e){if(t=t.replace(e.subset?ar(e.subset):rr,r),e.subset||e.escapeOnly)return t;return t.replace(sr,n).replace(ir,r);function n(s,i,o){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),e)}function r(s,i,o){return e.format(s.charCodeAt(0),o.charCodeAt(i+1),e)}}function ar(t){let e=At.get(t);if(!e)e=cr(t),At.set(t,e);return e}function cr(t){let e=[],n=-1;while(++n<t.length)e.push(t[n].replace(or,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}var lr=/[\dA-Fa-f]/;function xt(t,e,n){let r="&#x"+t.toString(16).toUpperCase();return n&&e&&!lr.test(String.fromCharCode(e))?r:r+";"}var ur=/\d/;function It(t,e,n){let r="&#"+String(t);return n&&e&&!ur.test(String.fromCharCode(e))?r:r+";"}var Lt=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var oe={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"};var Pt=["cent","copy","divide","gt","lt","not","para","times"];var Gt={}.hasOwnProperty,Ie={},ae;for(ae in oe)if(Gt.call(oe,ae))Ie[oe[ae]]=ae;var hr=/[^\dA-Za-z]/;function Bt(t,e,n,r){let s=String.fromCharCode(t);if(Gt.call(Ie,s)){let i=Ie[s],o="&"+i;if(n&&Lt.includes(i)&&!Pt.includes(i)&&(!r||e&&e!==61&&hr.test(String.fromCharCode(e))))return o;return o+";"}return""}function Ot(t,e,n){let r=xt(t,e,n.omitOptionalSemicolons),s;if(n.useNamedReferences||n.useShortestReferences)s=Bt(t,e,n.omitOptionalSemicolons,n.attribute);if((n.useShortestReferences||!s)&&n.useShortestReferences){let i=It(t,e,n.omitOptionalSemicolons);if(i.length<r.length)r=i}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function A(t,e){return Et(t,Object.assign({format:Ot},e))}var fr=/^>|^->|<!--|-->|--!>|<!-$/g,dr=[">"],mr=["<",">"];function $t(t,e,n,r){return r.settings.bogusComments?"<?"+A(t.value,Object.assign({},r.settings.characterReferences,{subset:dr}))+">":"<!--"+t.value.replace(fr,s)+"-->";function s(i){return A(i,Object.assign({},r.settings.characterReferences,{subset:mr}))}}function Mt(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}var w=jt(1),Le=jt(-1),gr=[];function jt(t){return e;function e(n,r,s){let i=n?n.children:gr,o=(r||0)+t,a=i[o];if(!s)while(a&&fn(a))o+=t,a=i[o];return a}}var pr={}.hasOwnProperty;function ce(t){return e;function e(n,r,s){return pr.call(t,n.tagName)&&t[n.tagName](n,r,s)}}var V=ce({body:yr,caption:Pe,colgroup:Pe,dd:Cr,dt:wr,head:Pe,html:_r,li:Sr,optgroup:kr,option:Rr,p:br,rp:Ft,rt:Ft,tbody:vr,td:Dt,tfoot:Ar,th:Dt,thead:Tr,tr:Er});function Pe(t,e,n){let r=w(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&fn(r.value.charAt(0)))}function _r(t,e,n){let r=w(n,e);return!r||r.type!=="comment"}function yr(t,e,n){let r=w(n,e);return!r||r.type!=="comment"}function br(t,e,n){let r=w(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function Sr(t,e,n){let r=w(n,e);return!r||r.type==="element"&&r.tagName==="li"}function wr(t,e,n){let r=w(n,e);return Boolean(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Cr(t,e,n){let r=w(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function Ft(t,e,n){let r=w(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function kr(t,e,n){let r=w(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function Rr(t,e,n){let r=w(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Tr(t,e,n){let r=w(n,e);return Boolean(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function vr(t,e,n){let r=w(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Ar(t,e,n){return!w(n,e)}function Er(t,e,n){let r=w(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function Dt(t,e,n){let r=w(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}var Wt=ce({body:Lr,colgroup:Pr,head:Ir,html:xr,tbody:Gr});function xr(t){let e=w(t,-1);return!e||e.type!=="comment"}function Ir(t){let e=new Set;for(let r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}let n=t.children[0];return!n||n.type==="element"}function Lr(t){let e=w(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&fn(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function Pr(t,e,n){let r=Le(n,e),s=w(t,-1,!0);if(n&&r&&r.type==="element"&&r.tagName==="colgroup"&&V(r,n.children.indexOf(r),n))return!1;return Boolean(s&&s.type==="element"&&s.tagName==="col")}function Gr(t,e,n){let r=Le(n,e),s=w(t,-1);if(n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&V(r,n.children.indexOf(r),n))return!1;return Boolean(s&&s.type==="element"&&s.tagName==="tr")}var le={name:[[`
4
4
  \f\r &/=>`.split(""),`
5
5
  \f\r "&'/=>\``.split("")],[`\x00
6
6
  \f\r "&'/<=>`.split(""),`\x00
@@ -8,5 +8,5 @@ import{Qr,ii,Mn,Nr,oi,si,pn}from"./chunk-4bzqrwr0.js";var S=class extends Error{
8
8
  \f\r &>`.split(""),`\x00
9
9
  \f\r "&'<=>\``.split("")],[`\x00
10
10
  \f\r "&'<=>\``.split(""),`\x00
11
- \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\x00&'".split(""),"\x00\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\x00"&'.split(""),"\x00\"&'`".split("")]]};function Ht(t,e,n,r){let s=r.schema,i=s.space==="svg"?!1:r.settings.omitOptionalTags,o=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase()),a=[],c;if(s.space==="html"&&t.tagName==="svg")r.schema=Mn;let l=Br(r,t.properties),u=r.all(s.space==="html"&&t.tagName==="template"?t.content:t);if(r.schema=s,u)o=!1;if(l||!i||!Wt(t,e,n)){if(a.push("<",t.tagName,l?" "+l:""),o&&(s.space==="svg"||r.settings.closeSelfClosing)){if(c=l.charAt(l.length-1),!r.settings.tightSelfClosing||c==="/"||c&&c!=='"'&&c!=="'")a.push(" ");a.push("/")}a.push(">")}if(a.push(u),!o&&(!i||!V(t,e,n)))a.push("</"+t.tagName+">");return a.join("")}function Br(t,e){let n=[],r=-1,s;if(e){for(s in e)if(e[s]!==null&&e[s]!==void 0){let i=Or(t,s,e[s]);if(i)n.push(i)}}while(++r<n.length){let i=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;if(r!==n.length-1&&i!=='"'&&i!=="'")n[r]+=" "}return n.join("")}function Or(t,e,n){let r=Qr(t.schema,e),s=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,i=t.settings.allowDangerousCharacters?0:1,o=t.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n===""))n=!0;else if((r.boolean||r.overloadedBoolean)&&(typeof n!=="string"||n===r.attribute||n===""))n=Boolean(n);if(n===null||n===void 0||n===!1||typeof n==="number"&&Number.isNaN(n))return"";let c=A(r.attribute,Object.assign({},t.settings.characterReferences,{subset:le.name[s][i]}));if(n===!0)return c;if(n=Array.isArray(n)?(r.commaSeparated?oi:si)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)return c;if(t.settings.preferUnquoted)a=A(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:le.unquoted[s][i]}));if(a!==n){if(t.settings.quoteSmart&&Nr(n,o)>Nr(n,t.alternative))o=t.alternative;a=o+A(n,Object.assign({},t.settings.characterReferences,{subset:(o==="'"?le.single:le.double)[s][i],attribute:!0}))+o}return c+(a?"="+a:a)}var $r=["<","&"];function ue(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:A(t.value,Object.assign({},r.settings.characterReferences,{subset:$r}))}function qt(t,e,n,r){return r.settings.allowDangerousHtml?t.value:ue(t,e,n,r)}function zt(t,e,n,r){return r.all(t)}var Ut=vt("type",{invalid:Mr,unknown:jr,handlers:{comment:$t,doctype:Mt,element:Ht,raw:qt,root:zt,text:ue}});function Mr(t){throw Error("Expected node, not `"+t+"`")}function jr(t){throw Error("Cannot compile unknown node `"+t.type+"`")}var Fr={},Dr={},Wr=[];function Ge(t,e){let n=e||Fr,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Hr,all:qr,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Nt,characterReferences:n.characterReferences||Dr,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Mn:ii,quote:r,alternative:s}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function Hr(t,e,n){return Ut(t,e,n,this)}function qr(t){let e=[],n=t&&t.children||Wr,r=-1;while(++r<n.length)e[r]=this.one(n[r],r,t);return e.join("")}var Kt=/\s+/g;function Jt(t,e){if(!e)return t;if(t.properties||={},t.properties.class||=[],typeof t.properties.class==="string")t.properties.class=t.properties.class.split(Kt);if(!Array.isArray(t.properties.class))t.properties.class=[];let n=Array.isArray(e)?e:e.split(Kt);for(let r of n)if(r&&!t.properties.class.includes(r))t.properties.class.push(r);return t}function zr(t){let e=P(t,!0).map(([s])=>s);function n(s){if(s===t.length)return{line:e.length-1,character:e.at(-1).length};let i=s,o=0;for(let a of e){if(i<a.length)break;i-=a.length,o++}return{line:o,character:i}}function r(s,i){let o=0;for(let a=0;a<s;a++)o+=e[a].length;return o+=i,o}return{lines:e,indexToPos:n,posToIndex:r}}var Ur=["color","background-color"];function Kr(t,e){let n=0,r=[];for(let s of e){if(s>n)r.push({...t,content:t.content.slice(n,s),offset:t.offset+n});n=s}if(n<t.content.length)r.push({...t,content:t.content.slice(n),offset:t.offset+n});return r}function Vr(t,e){let n=0,r=t.length;while(n<r){let s=n+(r-n>>1);if(t[s]<=e)n=s+1;else r=s}return n}function Yr(t,e){let n=[...e instanceof Set?e:new Set(e)].sort((r,s)=>r-s);if(!n.length)return t;return t.map((r)=>r.flatMap((s)=>{let i=s.offset+s.content.length,o=Vr(n,s.offset),a=o;while(a<n.length&&n[a]<i)a++;if(o===a)return s;let c=n.slice(o,a);for(let l=0;l<c.length;l++)c[l]-=s.offset;return Kr(s,c)}))}function Jr(t,e,n,r,s="css-vars"){let i={content:t.content,explanation:t.explanation,offset:t.offset},o=e.map((u)=>he(t.variants[u])),a=new Set(o.flatMap((u)=>Object.keys(u))),c={},l=(u,h)=>{let d=h==="color"?"":h==="background-color"?"-bg":`-${h}`;return n+e[u]+(h==="color"?"":d)};return o.forEach((u,h)=>{for(let d of a){let f=u[d]||"inherit";if(h===0&&r&&Ur.includes(d))if(r==="light-dark()"&&o.length>1){let m=e.findIndex((g)=>g==="light"),y=e.findIndex((g)=>g==="dark");if(m===-1||y===-1)throw new S('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let _=o[m][d]||"inherit",p=o[y][d]||"inherit";if(c[d]=`light-dark(${_}, ${p})`,s==="css-vars")c[l(h,d)]=f}else c[d]=f;else if(s==="css-vars")c[l(h,d)]=f}}),i.htmlStyle=c,i}function he(t){let e={};if(t.color)e.color=t.color;if(t.bgColor)e["background-color"]=t.bgColor;if(t.fontStyle){if(t.fontStyle&k.Italic)e["font-style"]="italic";if(t.fontStyle&k.Bold)e["font-weight"]="bold";let n=[];if(t.fontStyle&k.Underline)n.push("underline");if(t.fontStyle&k.Strikethrough)n.push("line-through");if(n.length)e["text-decoration"]=n.join(" ")}return e}function Oe(t){if(typeof t==="string")return t;return Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}function Xr(){let t=new WeakMap;function e(n){if(!t.has(n.meta)){let s=function(o){if(typeof o==="number"){if(o<0||o>n.source.length)throw new S(`Invalid decoration offset: ${o}. Code length: ${n.source.length}`);return{...r.indexToPos(o),offset:o}}else{let a=r.lines[o.line];if(a===void 0)throw new S(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${r.lines.length}`);let c=o.character;if(c<0)c=a.length+c;if(c<0||c>a.length)throw new S(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);return{...o,character:c,offset:r.posToIndex(o.line,c)}}},r=zr(n.source),i=(n.options.decorations||[]).map((o)=>({...o,start:s(o.start),end:s(o.end)}));Zr(i),t.set(n.meta,{decorations:i,converter:r,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(!this.options.decorations?.length)return;return Yr(n,e(this).decorations.flatMap((r)=>[r.start.offset,r.end.offset]))},code(n){if(!this.options.decorations?.length)return;let r=e(this),s=[...n.children].filter((u)=>u.type==="element"&&u.tagName==="span");if(s.length!==r.converter.lines.length)throw new S(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function i(u,h,d,f){let m=s[u],y="",_=-1,p=-1;if(h===0)_=0;if(d===0)p=0;if(d===Number.POSITIVE_INFINITY)p=m.children.length;if(_===-1||p===-1)for(let b=0;b<m.children.length;b++){if(y+=Qt(m.children[b]),_===-1&&y.length===h)_=b+1;if(p===-1&&y.length===d)p=b+1}if(_===-1)throw new S(`Failed to find start index for decoration ${JSON.stringify(f.start)}`);if(p===-1)throw new S(`Failed to find end index for decoration ${JSON.stringify(f.end)}`);let g=m.children.slice(_,p);if(!f.alwaysWrap&&g.length===m.children.length)a(m,f,"line");else if(!f.alwaysWrap&&g.length===1&&g[0].type==="element")a(g[0],f,"token");else{let b={type:"element",tagName:"span",properties:{},children:g};a(b,f,"wrapper"),m.children.splice(_,g.length,b)}}function o(u,h){s[u]=a(s[u],h,"line")}function a(u,h,d){let f=h.properties||{},m=h.transform||((y)=>y);if(u.tagName=h.tagName||"span",u.properties={...u.properties,...f,class:u.properties.class},h.properties?.class)Jt(u,h.properties.class);return u=m(u,d)||u,u}let c=[],l=r.decorations.sort((u,h)=>h.start.offset-u.start.offset||u.end.offset-h.end.offset);for(let u of l){let{start:h,end:d}=u;if(h.line===d.line)i(h.line,h.character,d.character,u);else if(h.line<d.line){i(h.line,h.character,Number.POSITIVE_INFINITY,u);for(let f=h.line+1;f<d.line;f++)c.unshift(()=>o(f,u));i(d.line,0,d.character,u)}}c.forEach((u)=>u())}}}function Zr(t){for(let e=0;e<t.length;e++){let n=t[e];if(n.start.offset>n.end.offset)throw new S(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=e+1;r<t.length;r++){let s=t[r],i=n.start.offset<=s.start.offset&&s.start.offset<n.end.offset,o=n.start.offset<s.end.offset&&s.end.offset<=n.end.offset,a=s.start.offset<=n.start.offset&&n.start.offset<s.end.offset,c=s.start.offset<n.end.offset&&n.end.offset<=s.end.offset;if(i||o||a||c){if(i&&o)continue;if(a&&c)continue;if(a&&n.start.offset===n.end.offset)continue;if(o&&s.start.offset===s.end.offset)continue;throw new S(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function Qt(t){if(t.type==="text")return t.value;if(t.type==="element")return t.children.map(Qt).join("");return""}var es=[Xr()];function fe(t){let e=ts(t.transformers||[]);return[...e.pre,...e.normal,...e.post,...es]}function ts(t){let e=[],n=[],r=[];for(let s of t)switch(s.enforce){case"pre":e.push(s);break;case"post":n.push(s);break;default:r.push(s)}return{pre:e,post:n,normal:r}}var I=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Be={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function ns(t,e){let n=t.indexOf("\x1B",e);if(n!==-1){if(t[n+1]==="["){let r=t.indexOf("m",n);if(r!==-1)return{sequence:t.substring(n+2,r).split(";"),startPosition:n,position:r+1}}}return{position:t.length}}function Vt(t){let e=t.shift();if(e==="2"){let n=t.splice(0,3).map((r)=>Number.parseInt(r));if(n.length!==3||n.some((r)=>Number.isNaN(r)))return;return{type:"rgb",rgb:n}}else if(e==="5"){let n=t.shift();if(n)return{type:"table",index:Number(n)}}}function rs(t){let e=[];while(t.length>0){let n=t.shift();if(!n)continue;let r=Number.parseInt(n);if(Number.isNaN(r))continue;if(r===0)e.push({type:"resetAll"});else if(r<=9){if(Be[r])e.push({type:"setDecoration",value:Be[r]})}else if(r<=29){let s=Be[r-20];if(s){if(e.push({type:"resetDecoration",value:s}),s==="dim")e.push({type:"resetDecoration",value:"bold"})}}else if(r<=37)e.push({type:"setForegroundColor",value:{type:"named",name:I[r-30]}});else if(r===38){let s=Vt(t);if(s)e.push({type:"setForegroundColor",value:s})}else if(r===39)e.push({type:"resetForegroundColor"});else if(r<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:I[r-40]}});else if(r===48){let s=Vt(t);if(s)e.push({type:"setBackgroundColor",value:s})}else if(r===49)e.push({type:"resetBackgroundColor"});else if(r===53)e.push({type:"setDecoration",value:"overline"});else if(r===55)e.push({type:"resetDecoration",value:"overline"});else if(r>=90&&r<=97)e.push({type:"setForegroundColor",value:{type:"named",name:I[r-90+8]}});else if(r>=100&&r<=107)e.push({type:"setBackgroundColor",value:{type:"named",name:I[r-100+8]}})}return e}function ss(){let t=null,e=null,n=new Set;return{parse(r){let s=[],i=0;do{let o=ns(r,i),a=o.sequence?r.substring(i,o.startPosition):r.substring(i);if(a.length>0)s.push({value:a,foreground:t,background:e,decorations:new Set(n)});if(o.sequence){let c=rs(o.sequence);for(let l of c)if(l.type==="resetAll")t=null,e=null,n.clear();else if(l.type==="resetForegroundColor")t=null;else if(l.type==="resetBackgroundColor")e=null;else if(l.type==="resetDecoration")n.delete(l.value);for(let l of c)if(l.type==="setForegroundColor")t=l.value;else if(l.type==="setBackgroundColor")e=l.value;else if(l.type==="setDecoration")n.add(l.value)}i=o.position}while(i<r.length);return s}}}var is={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function os(t=is){function e(a){return t[a]}function n(a){return`#${a.map((c)=>Math.max(0,Math.min(c,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let l=0;l<I.length;l++)r.push(e(I[l]));let a=[0,95,135,175,215,255];for(let l=0;l<6;l++)for(let u=0;u<6;u++)for(let h=0;h<6;h++)r.push(n([a[l],a[u],a[h]]));let c=8;for(let l=0;l<24;l++,c+=10)r.push(n([c,c,c]));return r}function i(a){return s()[a]}function o(a){switch(a.type){case"named":return e(a.name);case"rgb":return n(a.rgb);case"table":return i(a.index)}}return{value:o}}var as=/#([0-9a-f]{3,8})/i,cs=/var\((--[\w-]+-ansi-[\w-]+)\)/,ls={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function us(t,e,n){let r=q(t,n),s=P(e),i=os(Object.fromEntries(I.map((a)=>{let c=`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`;return[a,t.colors?.[c]||ls[a]]}))),o=ss();return s.map((a)=>o.parse(a[0]).map((c)=>{let l,u;if(c.decorations.has("reverse"))l=c.background?i.value(c.background):t.bg,u=c.foreground?i.value(c.foreground):t.fg;else l=c.foreground?i.value(c.foreground):t.fg,u=c.background?i.value(c.background):void 0;if(l=v(l,r),u=v(u,r),c.decorations.has("dim"))l=hs(l);let h=k.None;if(c.decorations.has("bold"))h|=k.Bold;if(c.decorations.has("italic"))h|=k.Italic;if(c.decorations.has("underline"))h|=k.Underline;if(c.decorations.has("strikethrough"))h|=k.Strikethrough;return{content:c.value,offset:a[1],color:l,bgColor:u,fontStyle:h}}))}function hs(t){let e=t.match(as);if(e){let r=e[1];if(r.length===8){let s=Math.round(Number.parseInt(r.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${r.slice(0,6)}${s}`}else if(r.length===6)return`#${r}80`;else if(r.length===4){let s=r[0],i=r[1],o=r[2],a=r[3];return`#${s}${s}${i}${i}${o}${o}${Math.round(Number.parseInt(`${a}${a}`,16)/2).toString(16).padStart(2,"0")}`}else if(r.length===3){let s=r[0],i=r[1],o=r[2];return`#${s}${s}${i}${i}${o}${o}80`}}let n=t.match(cs);if(n)return`var(${n[1]}-dim)`;return t}function $e(t,e,n={}){let r=t.resolveLangAlias(n.lang||"text"),{theme:s=t.getLoadedThemes()[0]}=n;if(!z(r)&&!U(s)&&r==="ansi"){let{theme:i}=t.setTheme(s);return us(i,e,n)}return Ee(t,e,n)}function de(t,e,n){let r,s,i,o,a,c;if("themes"in n){let{defaultColor:l="light",cssVariablePrefix:u="--shiki-",colorsRendering:h="css-vars"}=n,d=Object.entries(n.themes).filter((p)=>p[1]).map((p)=>({color:p[0],theme:p[1]})).sort((p,g)=>p.color===l?-1:g.color===l?1:0);if(d.length===0)throw new S("`themes` option must not be empty");let f=ie(t,e,n,$e);if(c=G(f),l&&l!=="light-dark()"&&!d.some((p)=>p.color===l))throw new S(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=d.map((p)=>t.getTheme(p.theme)),y=d.map((p)=>p.color);if(i=f.map((p)=>p.map((g)=>Jr(g,y,u,l,h))),c)K(i,c);let _=d.map((p)=>q(p.theme,n));s=Yt(d,m,_,u,l,"fg",h),r=Yt(d,m,_,u,l,"bg",h),o=`shiki-themes ${m.map((p)=>p.name).join(" ")}`,a=l?void 0:[s,r].join(";")}else if("theme"in n){let l=q(n.theme,n);i=$e(t,e,n);let u=t.getTheme(n.theme);r=v(u.bg,l),s=v(u.fg,l),o=u.name,c=G(i)}else throw new S("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:s,bg:r,themeName:o,rootStyle:a,grammarState:c}}function Yt(t,e,n,r,s,i,o){return t.map((a,c)=>{let l=v(e[c][i],n[c])||"inherit",u=`${r+a.color}${i==="bg"?"-bg":""}:${l}`;if(c===0&&s){if(s==="light-dark()"&&t.length>1){let h=t.findIndex((f)=>f.color==="light"),d=t.findIndex((f)=>f.color==="dark");if(h===-1||d===-1)throw new S('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${v(e[h][i],n[h])||"inherit"}, ${v(e[d][i],n[d])||"inherit"});${u}`}return l}if(o==="css-vars")return u;return null}).filter((a)=>!!a).join(";")}var Xt=/^\s+$/,fs=/^(\s*)(.*?)(\s*)$/;function me(t,e,n,r={meta:{},options:n,codeToHast:(s,i)=>me(t,s,i),codeToTokens:(s,i)=>de(t,s,i)}){let s=e;for(let m of fe(n))s=m.preprocess?.call(r,s,n)||s;let{tokens:i,fg:o,bg:a,themeName:c,rootStyle:l,grammarState:u}=de(t,s,n),{mergeWhitespaces:h=!0,mergeSameStyleTokens:d=!1}=n;if(h===!0)i=ms(i);else if(h==="never")i=gs(i);if(d)i=ps(i);let f={...r,get source(){return s}};for(let m of fe(n))i=m.tokens?.call(f,i)||i;return ds(i,{...n,fg:o,bg:a,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},f,u)}function ds(t,e,n,r=G(t)){let s=fe(e),i=[],o={type:"root",children:[]},{structure:a="classic",tabindex:c="0"}=e,l={class:`shiki ${e.themeName||""}`};if(e.rootStyle!==!1)if(e.rootStyle!=null)l.style=e.rootStyle;else l.style=`background-color:${e.bg};color:${e.fg}`;if(c!==!1&&c!=null)l.tabindex=c.toString();for(let[y,_]of Object.entries(e.meta||{}))if(!y.startsWith("_"))l[y]=_;let u={type:"element",tagName:"pre",properties:l,children:[],data:e.data},h={type:"element",tagName:"code",properties:{},children:i},d=[],f={...n,structure:a,addClassToHast:Jt,get source(){return n.source},get tokens(){return t},get options(){return e},get root(){return o},get pre(){return u},get code(){return h},get lines(){return d}};if(t.forEach((y,_)=>{if(_){if(a==="inline")o.children.push({type:"element",tagName:"br",properties:{},children:[]});else if(a==="classic")i.push({type:"text",value:`
11
+ \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\x00&'".split(""),"\x00\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\x00"&'.split(""),"\x00\"&'`".split("")]]};function Ht(t,e,n,r){let s=r.schema,i=s.space==="svg"?!1:r.settings.omitOptionalTags,o=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase()),a=[],c;if(s.space==="html"&&t.tagName==="svg")r.schema=On;let l=Br(r,t.properties),u=r.all(s.space==="html"&&t.tagName==="template"?t.content:t);if(r.schema=s,u)o=!1;if(l||!i||!Wt(t,e,n)){if(a.push("<",t.tagName,l?" "+l:""),o&&(s.space==="svg"||r.settings.closeSelfClosing)){if(c=l.charAt(l.length-1),!r.settings.tightSelfClosing||c==="/"||c&&c!=='"'&&c!=="'")a.push(" ");a.push("/")}a.push(">")}if(a.push(u),!o&&(!i||!V(t,e,n)))a.push("</"+t.tagName+">");return a.join("")}function Br(t,e){let n=[],r=-1,s;if(e){for(s in e)if(e[s]!==null&&e[s]!==void 0){let i=Or(t,s,e[s]);if(i)n.push(i)}}while(++r<n.length){let i=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;if(r!==n.length-1&&i!=='"'&&i!=="'")n[r]+=" "}return n.join("")}function Or(t,e,n){let r=Jr(t.schema,e),s=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,i=t.settings.allowDangerousCharacters?0:1,o=t.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n===""))n=!0;else if((r.boolean||r.overloadedBoolean)&&(typeof n!=="string"||n===r.attribute||n===""))n=Boolean(n);if(n===null||n===void 0||n===!1||typeof n==="number"&&Number.isNaN(n))return"";let c=A(r.attribute,Object.assign({},t.settings.characterReferences,{subset:le.name[s][i]}));if(n===!0)return c;if(n=Array.isArray(n)?(r.commaSeparated?si:li)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)return c;if(t.settings.preferUnquoted)a=A(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:le.unquoted[s][i]}));if(a!==n){if(t.settings.quoteSmart&&Nr(n,o)>Nr(n,t.alternative))o=t.alternative;a=o+A(n,Object.assign({},t.settings.characterReferences,{subset:(o==="'"?le.single:le.double)[s][i],attribute:!0}))+o}return c+(a?"="+a:a)}var $r=["<","&"];function ue(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:A(t.value,Object.assign({},r.settings.characterReferences,{subset:$r}))}function qt(t,e,n,r){return r.settings.allowDangerousHtml?t.value:ue(t,e,n,r)}function zt(t,e,n,r){return r.all(t)}var Ut=vt("type",{invalid:Mr,unknown:jr,handlers:{comment:$t,doctype:Mt,element:Ht,raw:qt,root:zt,text:ue}});function Mr(t){throw Error("Expected node, not `"+t+"`")}function jr(t){throw Error("Cannot compile unknown node `"+t.type+"`")}var Fr={},Dr={},Wr=[];function Ge(t,e){let n=e||Fr,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Hr,all:qr,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Nt,characterReferences:n.characterReferences||Dr,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?On:oi,quote:r,alternative:s}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function Hr(t,e,n){return Ut(t,e,n,this)}function qr(t){let e=[],n=t&&t.children||Wr,r=-1;while(++r<n.length)e[r]=this.one(n[r],r,t);return e.join("")}var Kt=/\s+/g;function Jt(t,e){if(!e)return t;if(t.properties||={},t.properties.class||=[],typeof t.properties.class==="string")t.properties.class=t.properties.class.split(Kt);if(!Array.isArray(t.properties.class))t.properties.class=[];let n=Array.isArray(e)?e:e.split(Kt);for(let r of n)if(r&&!t.properties.class.includes(r))t.properties.class.push(r);return t}function zr(t){let e=P(t,!0).map(([s])=>s);function n(s){if(s===t.length)return{line:e.length-1,character:e.at(-1).length};let i=s,o=0;for(let a of e){if(i<a.length)break;i-=a.length,o++}return{line:o,character:i}}function r(s,i){let o=0;for(let a=0;a<s;a++)o+=e[a].length;return o+=i,o}return{lines:e,indexToPos:n,posToIndex:r}}var Ur=["color","background-color"];function Kr(t,e){let n=0,r=[];for(let s of e){if(s>n)r.push({...t,content:t.content.slice(n,s),offset:t.offset+n});n=s}if(n<t.content.length)r.push({...t,content:t.content.slice(n),offset:t.offset+n});return r}function Vr(t,e){let n=0,r=t.length;while(n<r){let s=n+(r-n>>1);if(t[s]<=e)n=s+1;else r=s}return n}function Yr(t,e){let n=[...e instanceof Set?e:new Set(e)].sort((r,s)=>r-s);if(!n.length)return t;return t.map((r)=>r.flatMap((s)=>{let i=s.offset+s.content.length,o=Vr(n,s.offset),a=o;while(a<n.length&&n[a]<i)a++;if(o===a)return s;let c=n.slice(o,a);for(let l=0;l<c.length;l++)c[l]-=s.offset;return Kr(s,c)}))}function Qr(t,e,n,r,s="css-vars"){let i={content:t.content,explanation:t.explanation,offset:t.offset},o=e.map((u)=>he(t.variants[u])),a=new Set(o.flatMap((u)=>Object.keys(u))),c={},l=(u,h)=>{let d=h==="color"?"":h==="background-color"?"-bg":`-${h}`;return n+e[u]+(h==="color"?"":d)};return o.forEach((u,h)=>{for(let d of a){let f=u[d]||"inherit";if(h===0&&r&&Ur.includes(d))if(r==="light-dark()"&&o.length>1){let m=e.findIndex((g)=>g==="light"),y=e.findIndex((g)=>g==="dark");if(m===-1||y===-1)throw new S('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let _=o[m][d]||"inherit",p=o[y][d]||"inherit";if(c[d]=`light-dark(${_}, ${p})`,s==="css-vars")c[l(h,d)]=f}else c[d]=f;else if(s==="css-vars")c[l(h,d)]=f}}),i.htmlStyle=c,i}function he(t){let e={};if(t.color)e.color=t.color;if(t.bgColor)e["background-color"]=t.bgColor;if(t.fontStyle){if(t.fontStyle&k.Italic)e["font-style"]="italic";if(t.fontStyle&k.Bold)e["font-weight"]="bold";let n=[];if(t.fontStyle&k.Underline)n.push("underline");if(t.fontStyle&k.Strikethrough)n.push("line-through");if(n.length)e["text-decoration"]=n.join(" ")}return e}function Oe(t){if(typeof t==="string")return t;return Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}function Xr(){let t=new WeakMap;function e(n){if(!t.has(n.meta)){let s=function(o){if(typeof o==="number"){if(o<0||o>n.source.length)throw new S(`Invalid decoration offset: ${o}. Code length: ${n.source.length}`);return{...r.indexToPos(o),offset:o}}else{let a=r.lines[o.line];if(a===void 0)throw new S(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${r.lines.length}`);let c=o.character;if(c<0)c=a.length+c;if(c<0||c>a.length)throw new S(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);return{...o,character:c,offset:r.posToIndex(o.line,c)}}},r=zr(n.source),i=(n.options.decorations||[]).map((o)=>({...o,start:s(o.start),end:s(o.end)}));Zr(i),t.set(n.meta,{decorations:i,converter:r,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(!this.options.decorations?.length)return;return Yr(n,e(this).decorations.flatMap((r)=>[r.start.offset,r.end.offset]))},code(n){if(!this.options.decorations?.length)return;let r=e(this),s=[...n.children].filter((u)=>u.type==="element"&&u.tagName==="span");if(s.length!==r.converter.lines.length)throw new S(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function i(u,h,d,f){let m=s[u],y="",_=-1,p=-1;if(h===0)_=0;if(d===0)p=0;if(d===Number.POSITIVE_INFINITY)p=m.children.length;if(_===-1||p===-1)for(let b=0;b<m.children.length;b++){if(y+=Qt(m.children[b]),_===-1&&y.length===h)_=b+1;if(p===-1&&y.length===d)p=b+1}if(_===-1)throw new S(`Failed to find start index for decoration ${JSON.stringify(f.start)}`);if(p===-1)throw new S(`Failed to find end index for decoration ${JSON.stringify(f.end)}`);let g=m.children.slice(_,p);if(!f.alwaysWrap&&g.length===m.children.length)a(m,f,"line");else if(!f.alwaysWrap&&g.length===1&&g[0].type==="element")a(g[0],f,"token");else{let b={type:"element",tagName:"span",properties:{},children:g};a(b,f,"wrapper"),m.children.splice(_,g.length,b)}}function o(u,h){s[u]=a(s[u],h,"line")}function a(u,h,d){let f=h.properties||{},m=h.transform||((y)=>y);if(u.tagName=h.tagName||"span",u.properties={...u.properties,...f,class:u.properties.class},h.properties?.class)Jt(u,h.properties.class);return u=m(u,d)||u,u}let c=[],l=r.decorations.sort((u,h)=>h.start.offset-u.start.offset||u.end.offset-h.end.offset);for(let u of l){let{start:h,end:d}=u;if(h.line===d.line)i(h.line,h.character,d.character,u);else if(h.line<d.line){i(h.line,h.character,Number.POSITIVE_INFINITY,u);for(let f=h.line+1;f<d.line;f++)c.unshift(()=>o(f,u));i(d.line,0,d.character,u)}}c.forEach((u)=>u())}}}function Zr(t){for(let e=0;e<t.length;e++){let n=t[e];if(n.start.offset>n.end.offset)throw new S(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=e+1;r<t.length;r++){let s=t[r],i=n.start.offset<=s.start.offset&&s.start.offset<n.end.offset,o=n.start.offset<s.end.offset&&s.end.offset<=n.end.offset,a=s.start.offset<=n.start.offset&&n.start.offset<s.end.offset,c=s.start.offset<n.end.offset&&n.end.offset<=s.end.offset;if(i||o||a||c){if(i&&o)continue;if(a&&c)continue;if(a&&n.start.offset===n.end.offset)continue;if(o&&s.start.offset===s.end.offset)continue;throw new S(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function Qt(t){if(t.type==="text")return t.value;if(t.type==="element")return t.children.map(Qt).join("");return""}var es=[Xr()];function fe(t){let e=ts(t.transformers||[]);return[...e.pre,...e.normal,...e.post,...es]}function ts(t){let e=[],n=[],r=[];for(let s of t)switch(s.enforce){case"pre":e.push(s);break;case"post":n.push(s);break;default:r.push(s)}return{pre:e,post:n,normal:r}}var I=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Be={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function ns(t,e){let n=t.indexOf("\x1B",e);if(n!==-1){if(t[n+1]==="["){let r=t.indexOf("m",n);if(r!==-1)return{sequence:t.substring(n+2,r).split(";"),startPosition:n,position:r+1}}}return{position:t.length}}function Vt(t){let e=t.shift();if(e==="2"){let n=t.splice(0,3).map((r)=>Number.parseInt(r));if(n.length!==3||n.some((r)=>Number.isNaN(r)))return;return{type:"rgb",rgb:n}}else if(e==="5"){let n=t.shift();if(n)return{type:"table",index:Number(n)}}}function rs(t){let e=[];while(t.length>0){let n=t.shift();if(!n)continue;let r=Number.parseInt(n);if(Number.isNaN(r))continue;if(r===0)e.push({type:"resetAll"});else if(r<=9){if(Be[r])e.push({type:"setDecoration",value:Be[r]})}else if(r<=29){let s=Be[r-20];if(s){if(e.push({type:"resetDecoration",value:s}),s==="dim")e.push({type:"resetDecoration",value:"bold"})}}else if(r<=37)e.push({type:"setForegroundColor",value:{type:"named",name:I[r-30]}});else if(r===38){let s=Vt(t);if(s)e.push({type:"setForegroundColor",value:s})}else if(r===39)e.push({type:"resetForegroundColor"});else if(r<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:I[r-40]}});else if(r===48){let s=Vt(t);if(s)e.push({type:"setBackgroundColor",value:s})}else if(r===49)e.push({type:"resetBackgroundColor"});else if(r===53)e.push({type:"setDecoration",value:"overline"});else if(r===55)e.push({type:"resetDecoration",value:"overline"});else if(r>=90&&r<=97)e.push({type:"setForegroundColor",value:{type:"named",name:I[r-90+8]}});else if(r>=100&&r<=107)e.push({type:"setBackgroundColor",value:{type:"named",name:I[r-100+8]}})}return e}function ss(){let t=null,e=null,n=new Set;return{parse(r){let s=[],i=0;do{let o=ns(r,i),a=o.sequence?r.substring(i,o.startPosition):r.substring(i);if(a.length>0)s.push({value:a,foreground:t,background:e,decorations:new Set(n)});if(o.sequence){let c=rs(o.sequence);for(let l of c)if(l.type==="resetAll")t=null,e=null,n.clear();else if(l.type==="resetForegroundColor")t=null;else if(l.type==="resetBackgroundColor")e=null;else if(l.type==="resetDecoration")n.delete(l.value);for(let l of c)if(l.type==="setForegroundColor")t=l.value;else if(l.type==="setBackgroundColor")e=l.value;else if(l.type==="setDecoration")n.add(l.value)}i=o.position}while(i<r.length);return s}}}var is={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function os(t=is){function e(a){return t[a]}function n(a){return`#${a.map((c)=>Math.max(0,Math.min(c,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let l=0;l<I.length;l++)r.push(e(I[l]));let a=[0,95,135,175,215,255];for(let l=0;l<6;l++)for(let u=0;u<6;u++)for(let h=0;h<6;h++)r.push(n([a[l],a[u],a[h]]));let c=8;for(let l=0;l<24;l++,c+=10)r.push(n([c,c,c]));return r}function i(a){return s()[a]}function o(a){switch(a.type){case"named":return e(a.name);case"rgb":return n(a.rgb);case"table":return i(a.index)}}return{value:o}}var as=/#([0-9a-f]{3,8})/i,cs=/var\((--[\w-]+-ansi-[\w-]+)\)/,ls={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function us(t,e,n){let r=q(t,n),s=P(e),i=os(Object.fromEntries(I.map((a)=>{let c=`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`;return[a,t.colors?.[c]||ls[a]]}))),o=ss();return s.map((a)=>o.parse(a[0]).map((c)=>{let l,u;if(c.decorations.has("reverse"))l=c.background?i.value(c.background):t.bg,u=c.foreground?i.value(c.foreground):t.fg;else l=c.foreground?i.value(c.foreground):t.fg,u=c.background?i.value(c.background):void 0;if(l=v(l,r),u=v(u,r),c.decorations.has("dim"))l=hs(l);let h=k.None;if(c.decorations.has("bold"))h|=k.Bold;if(c.decorations.has("italic"))h|=k.Italic;if(c.decorations.has("underline"))h|=k.Underline;if(c.decorations.has("strikethrough"))h|=k.Strikethrough;return{content:c.value,offset:a[1],color:l,bgColor:u,fontStyle:h}}))}function hs(t){let e=t.match(as);if(e){let r=e[1];if(r.length===8){let s=Math.round(Number.parseInt(r.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${r.slice(0,6)}${s}`}else if(r.length===6)return`#${r}80`;else if(r.length===4){let s=r[0],i=r[1],o=r[2],a=r[3];return`#${s}${s}${i}${i}${o}${o}${Math.round(Number.parseInt(`${a}${a}`,16)/2).toString(16).padStart(2,"0")}`}else if(r.length===3){let s=r[0],i=r[1],o=r[2];return`#${s}${s}${i}${i}${o}${o}80`}}let n=t.match(cs);if(n)return`var(${n[1]}-dim)`;return t}function $e(t,e,n={}){let r=t.resolveLangAlias(n.lang||"text"),{theme:s=t.getLoadedThemes()[0]}=n;if(!z(r)&&!U(s)&&r==="ansi"){let{theme:i}=t.setTheme(s);return us(i,e,n)}return Ee(t,e,n)}function de(t,e,n){let r,s,i,o,a,c;if("themes"in n){let{defaultColor:l="light",cssVariablePrefix:u="--shiki-",colorsRendering:h="css-vars"}=n,d=Object.entries(n.themes).filter((p)=>p[1]).map((p)=>({color:p[0],theme:p[1]})).sort((p,g)=>p.color===l?-1:g.color===l?1:0);if(d.length===0)throw new S("`themes` option must not be empty");let f=ie(t,e,n,$e);if(c=G(f),l&&l!=="light-dark()"&&!d.some((p)=>p.color===l))throw new S(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=d.map((p)=>t.getTheme(p.theme)),y=d.map((p)=>p.color);if(i=f.map((p)=>p.map((g)=>Qr(g,y,u,l,h))),c)K(i,c);let _=d.map((p)=>q(p.theme,n));s=Yt(d,m,_,u,l,"fg",h),r=Yt(d,m,_,u,l,"bg",h),o=`shiki-themes ${m.map((p)=>p.name).join(" ")}`,a=l?void 0:[s,r].join(";")}else if("theme"in n){let l=q(n.theme,n);i=$e(t,e,n);let u=t.getTheme(n.theme);r=v(u.bg,l),s=v(u.fg,l),o=u.name,c=G(i)}else throw new S("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:s,bg:r,themeName:o,rootStyle:a,grammarState:c}}function Yt(t,e,n,r,s,i,o){return t.map((a,c)=>{let l=v(e[c][i],n[c])||"inherit",u=`${r+a.color}${i==="bg"?"-bg":""}:${l}`;if(c===0&&s){if(s==="light-dark()"&&t.length>1){let h=t.findIndex((f)=>f.color==="light"),d=t.findIndex((f)=>f.color==="dark");if(h===-1||d===-1)throw new S('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${v(e[h][i],n[h])||"inherit"}, ${v(e[d][i],n[d])||"inherit"});${u}`}return l}if(o==="css-vars")return u;return null}).filter((a)=>!!a).join(";")}var Xt=/^\s+$/,fs=/^(\s*)(.*?)(\s*)$/;function me(t,e,n,r={meta:{},options:n,codeToHast:(s,i)=>me(t,s,i),codeToTokens:(s,i)=>de(t,s,i)}){let s=e;for(let m of fe(n))s=m.preprocess?.call(r,s,n)||s;let{tokens:i,fg:o,bg:a,themeName:c,rootStyle:l,grammarState:u}=de(t,s,n),{mergeWhitespaces:h=!0,mergeSameStyleTokens:d=!1}=n;if(h===!0)i=ms(i);else if(h==="never")i=gs(i);if(d)i=ps(i);let f={...r,get source(){return s}};for(let m of fe(n))i=m.tokens?.call(f,i)||i;return ds(i,{...n,fg:o,bg:a,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},f,u)}function ds(t,e,n,r=G(t)){let s=fe(e),i=[],o={type:"root",children:[]},{structure:a="classic",tabindex:c="0"}=e,l={class:`shiki ${e.themeName||""}`};if(e.rootStyle!==!1)if(e.rootStyle!=null)l.style=e.rootStyle;else l.style=`background-color:${e.bg};color:${e.fg}`;if(c!==!1&&c!=null)l.tabindex=c.toString();for(let[y,_]of Object.entries(e.meta||{}))if(!y.startsWith("_"))l[y]=_;let u={type:"element",tagName:"pre",properties:l,children:[],data:e.data},h={type:"element",tagName:"code",properties:{},children:i},d=[],f={...n,structure:a,addClassToHast:Jt,get source(){return n.source},get tokens(){return t},get options(){return e},get root(){return o},get pre(){return u},get code(){return h},get lines(){return d}};if(t.forEach((y,_)=>{if(_){if(a==="inline")o.children.push({type:"element",tagName:"br",properties:{},children:[]});else if(a==="classic")i.push({type:"text",value:`
12
12
  `})}let p={type:"element",tagName:"span",properties:{class:"line"},children:[]},g=0;for(let b of y){let C={type:"element",tagName:"span",properties:{...b.htmlAttrs},children:[{type:"text",value:b.content}]},R=Oe(b.htmlStyle||he(b));if(R)C.properties.style=R;for(let N of s)C=N?.span?.call(f,C,_+1,g,p,b)||C;if(a==="inline")o.children.push(C);else if(a==="classic")p.children.push(C);g+=b.content.length}if(a==="classic"){for(let b of s)p=b?.line?.call(f,p,_+1)||p;d.push(p),i.push(p)}else if(a==="inline")d.push(p)}),a==="classic"){for(let y of s)h=y?.code?.call(f,h)||h;u.children.push(h);for(let y of s)u=y?.pre?.call(f,u)||u;o.children.push(u)}else if(a==="inline"){let y=[],_={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(let g of o.children)if(g.type==="element"&&g.tagName==="br")y.push(_),_={type:"element",tagName:"span",properties:{class:"line"},children:[]};else if(g.type==="element"||g.type==="text")_.children.push(g);y.push(_);let p={type:"element",tagName:"code",properties:{},children:y};for(let g of s)p=g?.code?.call(f,p)||p;o.children=[];for(let g=0;g<p.children.length;g++){if(g>0)o.children.push({type:"element",tagName:"br",properties:{},children:[]});let b=p.children[g];if(b.type==="element")o.children.push(...b.children)}}let m=o;for(let y of s)m=y?.root?.call(f,m)||m;if(r)K(m,r);return m}function ms(t){return t.map((e)=>{let n=[],r="",s;return e.forEach((i,o)=>{let a=!(i.fontStyle&&(i.fontStyle&k.Underline||i.fontStyle&k.Strikethrough));if(a&&Xt.test(i.content)&&e[o+1]){if(s===void 0)s=i.offset;r+=i.content}else if(r){if(a)n.push({...i,offset:s,content:r+i.content});else n.push({content:r,offset:s},i);s=void 0,r=""}else n.push(i)}),n})}function gs(t){return t.map((e)=>e.flatMap((n)=>{if(Xt.test(n.content))return n;let r=n.content.match(fs);if(!r)return n;let[,s,i,o]=r;if(!s&&!o)return n;let a=[{...n,offset:n.offset+s.length,content:i}];if(s)a.unshift({content:s,offset:n.offset});if(o)a.push({content:o,offset:n.offset+s.length+i.length});return a}))}function ps(t){return t.map((e)=>{let n=[];for(let r of e){if(n.length===0){n.push({...r});continue}let s=n.at(-1),i=Oe(s.htmlStyle||he(s)),o=Oe(r.htmlStyle||he(r)),a=s.fontStyle&&(s.fontStyle&k.Underline||s.fontStyle&k.Strikethrough),c=r.fontStyle&&(r.fontStyle&k.Underline||r.fontStyle&k.Strikethrough);if(!a&&!c&&i===o)s.content+=r.content;else n.push({...r})}return n})}var _s=Ge;function ys(t,e,n){let r={meta:{},options:n,codeToHast:(i,o)=>me(t,i,o),codeToTokens:(i,o)=>de(t,i,o)},s=_s(me(t,e,n,r));for(let i of fe(n))s=i.postprocess?.call(r,s,n)||s;return s}async function No(t){let e=await Ae(t);return{getLastGrammarState:(...n)=>kt(e,...n),codeToTokensBase:(n,r)=>$e(e,n,r),codeToTokensWithThemes:(n,r)=>ie(e,n,r),codeToTokens:(n,r)=>de(e,n,r),codeToHast:(n,r)=>me(e,n,r),codeToHtml:(n,r)=>ys(e,n,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...e,getInternalContext:()=>e}}export{No as createHighlighterCore};