nuxt-studio 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +2 -2
  2. package/dist/app/actionscript-3-DKotD2Vd.js +1 -0
  3. package/dist/app/{andromeeda-C-Jbm3Hp.js → andromeeda-C4gqWexZ.js} +1 -1
  4. package/dist/app/ayu-dark-CMjwMIkn.js +1 -0
  5. package/dist/app/ayu-light-C47S-Tmv.js +1 -0
  6. package/dist/app/ayu-mirage-CjoLj4QM.js +1 -0
  7. package/dist/app/bn-BXLyqIGp.js +1 -0
  8. package/dist/app/csharp-VAkxddOj.js +1 -0
  9. package/dist/app/en-BLcCUEmi.js +1 -0
  10. package/dist/app/{erb-Buz1_99_.js → erb-BkKzIHzi.js} +1 -1
  11. package/dist/app/{gdresource-BLuZCTp3.js → gdresource-pHyHNgx5.js} +1 -1
  12. package/dist/app/{gdscript-fffAh1pn.js → gdscript-BpxQpKjR.js} +1 -1
  13. package/dist/app/go-Ci1olR0S.js +1 -0
  14. package/dist/app/horizon-BUw7H-hv.js +1 -0
  15. package/dist/app/index-BR26Sfgr.js +2 -0
  16. package/dist/app/index-C-y2greB.js +2 -0
  17. package/dist/app/index-CS_mI4k2.js +2 -0
  18. package/dist/app/index-Cl-ktQMQ.js +1 -0
  19. package/dist/app/index-DPJS0mlQ.js +2 -0
  20. package/dist/app/km-ClEwYEyg.js +1 -0
  21. package/dist/app/latex-DHfEut71.js +1 -0
  22. package/dist/app/lua-DlAioYQl.js +1 -0
  23. package/dist/app/main--P1Cc3W1.js +90 -0
  24. package/dist/app/main-BJNMrnKc.js +90 -0
  25. package/dist/app/main-D38hv2hq.js +90 -0
  26. package/dist/app/main-DKqH6k_9.js +69 -0
  27. package/dist/app/main.d.ts +121 -15
  28. package/dist/app/main.js +1 -82
  29. package/dist/app/mdc-import-FmFgRqLi.js +1 -0
  30. package/dist/app/{move-Cr8dt_E3.js → move-Dg7rFHVC.js} +1 -1
  31. package/dist/app/{nginx-CX2EZAQM.js → nginx-B2z8CTeP.js} +1 -1
  32. package/dist/app/night-owl-light-CMTm3GFP.js +1 -0
  33. package/dist/app/odin-BINPiy40.js +1 -0
  34. package/dist/app/one-light-C3Wv6jpd.js +1 -0
  35. package/dist/app/php-Ch-cYjOD.js +1 -0
  36. package/dist/app/{razor-WF-JDWnd.js → razor-Dx4-zBXE.js} +1 -1
  37. package/dist/app/ron-1l4eGd0-.js +1 -0
  38. package/dist/app/{rst-DDesMrJR.js → rst-Db6JICNt.js} +1 -1
  39. package/dist/app/{ruby-D9zFRbhA.js → ruby-DQYiaCa_.js} +1 -1
  40. package/dist/app/service-worker.d.ts +48 -14
  41. package/dist/app/shared-Bk3qBOVF.js +1 -0
  42. package/dist/app/shared-DSAAKzND.js +1 -0
  43. package/dist/app/shared-cDYJuGWk.js +1 -0
  44. package/dist/app/shared.d.ts +91 -14
  45. package/dist/app/shared.js +1 -1
  46. package/dist/app/surrealql-C_6seBBi.js +1 -0
  47. package/dist/app/{templ-BpwXGbW_.js → templ-B_lDaXqj.js} +1 -1
  48. package/dist/app/th-CiKRqNnp.js +1 -0
  49. package/dist/app/{twig-D5851E2W.js → twig-DL5s0dWc.js} +1 -1
  50. package/dist/module/module.d.mts +86 -2
  51. package/dist/module/module.json +1 -1
  52. package/dist/module/module.mjs +151 -13
  53. package/dist/module/runtime/host.js +15 -2
  54. package/dist/module/runtime/plugins/studio.client.dev.js +3 -1
  55. package/dist/module/runtime/server/routes/admin.js +20 -1
  56. package/dist/module/runtime/server/routes/ai/analyze.post.d.ts +8 -0
  57. package/dist/module/runtime/server/routes/ai/analyze.post.js +132 -0
  58. package/dist/module/runtime/server/routes/ai/generate.post.d.ts +2 -0
  59. package/dist/module/runtime/server/routes/ai/generate.post.js +93 -0
  60. package/dist/module/runtime/server/routes/auth/github.get.js +1 -1
  61. package/dist/module/runtime/server/routes/auth/gitlab.get.js +1 -1
  62. package/dist/module/runtime/server/routes/auth/google.get.js +4 -2
  63. package/dist/module/runtime/server/routes/auth/sso.get.d.ts +32 -0
  64. package/dist/module/runtime/server/routes/auth/sso.get.js +122 -0
  65. package/dist/module/runtime/server/types/ai.d.ts +40 -0
  66. package/dist/module/runtime/server/types/ai.js +7 -0
  67. package/dist/module/runtime/server/utils/ai/analyze.d.ts +32 -0
  68. package/dist/module/runtime/server/utils/ai/analyze.js +222 -0
  69. package/dist/module/runtime/server/utils/ai/generate.d.ts +63 -0
  70. package/dist/module/runtime/server/utils/ai/generate.js +285 -0
  71. package/dist/module/runtime/server/utils/ai/index.d.ts +7 -0
  72. package/dist/module/runtime/server/utils/ai/index.js +23 -0
  73. package/dist/module/runtime/{utils → server/utils}/auth.d.ts +8 -0
  74. package/dist/module/runtime/{utils → server/utils}/auth.js +30 -0
  75. package/dist/module/runtime/utils/document/generate.js +4 -2
  76. package/package.json +25 -22
  77. package/dist/app/actionscript-3-CKUqbIUM.js +0 -1
  78. package/dist/app/ar-QyL_HV85.js +0 -1
  79. package/dist/app/ar-_-RGPmO-.js +0 -1
  80. package/dist/app/ayu-dark-CmMr59Fi.js +0 -1
  81. package/dist/app/bg-DFTPuayt.js +0 -1
  82. package/dist/app/bg-DQB5FGjP.js +0 -1
  83. package/dist/app/ckb-CrQ-WJac.js +0 -1
  84. package/dist/app/ckb-DeCBOUtF.js +0 -1
  85. package/dist/app/cs-B98a2yWu.js +0 -1
  86. package/dist/app/cs-BH_F8qAm.js +0 -1
  87. package/dist/app/csharp-D3FXe4qe.js +0 -1
  88. package/dist/app/de-CcUtq3BY.js +0 -1
  89. package/dist/app/de-D14ADfq2.js +0 -1
  90. package/dist/app/en-CLoTvFGQ.js +0 -1
  91. package/dist/app/en-Dyk18FLF.js +0 -1
  92. package/dist/app/en-F_yDmSyh.js +0 -1
  93. package/dist/app/es-DNYVG1iM.js +0 -1
  94. package/dist/app/es-rJr14jIF.js +0 -1
  95. package/dist/app/fa-D8D4Juss.js +0 -1
  96. package/dist/app/fa-UOQDxc9M.js +0 -1
  97. package/dist/app/fi-CsyV_FZD.js +0 -1
  98. package/dist/app/fi-DyQnrsZG.js +0 -1
  99. package/dist/app/fr-Cc2mJRiD.js +0 -1
  100. package/dist/app/fr-URL6oX9g.js +0 -1
  101. package/dist/app/go-BR7YH85S.js +0 -1
  102. package/dist/app/id-976pWZzj.js +0 -1
  103. package/dist/app/id-mTfAucSk.js +0 -1
  104. package/dist/app/index-CNPuuSSp.js +0 -2
  105. package/dist/app/index-CP1r4M_D.js +0 -2
  106. package/dist/app/it-8iEYreYb.js +0 -1
  107. package/dist/app/it-CFQqwAz6.js +0 -1
  108. package/dist/app/ja-C2XZ4KU_.js +0 -1
  109. package/dist/app/ja-Da99Av5s.js +0 -1
  110. package/dist/app/ko-Chupaw_G.js +0 -1
  111. package/dist/app/ko-DHiZMNLx.js +0 -1
  112. package/dist/app/latex-CR-T6Gpw.js +0 -1
  113. package/dist/app/lua-B09NiSMa.js +0 -1
  114. package/dist/app/nb-no-Bs1s6rMn.js +0 -1
  115. package/dist/app/nb-no-D0vQN_qu.js +0 -1
  116. package/dist/app/nl-AS0JBFCr.js +0 -1
  117. package/dist/app/nl-DctNb_j0.js +0 -1
  118. package/dist/app/nn-no-BU_NKR1i.js +0 -1
  119. package/dist/app/nn-no-CPYyqwLs.js +0 -1
  120. package/dist/app/one-light-PoHY5YXO.js +0 -1
  121. package/dist/app/php-e5ftf-lz.js +0 -1
  122. package/dist/app/pl-DUO5RNGl.js +0 -1
  123. package/dist/app/pl-DeKXNi4V.js +0 -1
  124. package/dist/app/pt-br-BYRvhfst.js +0 -1
  125. package/dist/app/pt-br-DsJvwYKK.js +0 -1
  126. package/dist/app/ru-Bw2nJg-C.js +0 -1
  127. package/dist/app/ru-Cb_-x51Z.js +0 -1
  128. package/dist/app/shared-CdpkDwpC.js +0 -1
  129. package/dist/app/ua-CU6rzhlT.js +0 -1
  130. package/dist/app/ua-u_LezIM_.js +0 -1
  131. package/dist/app/vi-Ct_2aJ1a.js +0 -1
  132. package/dist/app/vi-DeNlKpcQ.js +0 -1
  133. package/dist/app/zh-BKDNFp3l.js +0 -1
  134. package/dist/app/zh-VPUrMzjH.js +0 -1
  135. package/dist/app/zh-tw-D-gS4Ane.js +0 -1
  136. package/dist/app/zh-tw-DVLUqrlM.js +0 -1
@@ -0,0 +1 @@
1
+ const e=[Object.freeze(JSON.parse('{"displayName":"Go","name":"go","patterns":[{"include":"#statements"}],"repository":{"after_control_variables":{"captures":{"1":{"patterns":[{"include":"#type-declarations-without-brackets"},{"match":"\\\\[","name":"punctuation.definition.begin.bracket.square.go"},{"match":"]","name":"punctuation.definition.end.bracket.square.go"},{"match":"\\\\w+","name":"variable.other.go"}]}},"match":"(?<=\\\\brange\\\\b|;|\\\\bif\\\\b|\\\\bfor\\\\b|[<>]|<=|>=|==|!=|\\\\w[-%*+/]|\\\\w[-%*+/]=|\\\\|\\\\||&&)\\\\s*((?![]\\\\[]+)[-\\\\]!%*+./:<=>\\\\[_[:alnum:]]+)\\\\s*(?=\\\\{)"},"brackets":{"patterns":[{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.definition.begin.bracket.curly.go"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.curly.go"}},"patterns":[{"include":"$self"}]},{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.begin.bracket.round.go"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.round.go"}},"patterns":[{"include":"$self"}]},{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.begin.bracket.square.go"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.square.go"}},"patterns":[{"include":"$self"}]}]},"built_in_functions":{"patterns":[{"match":"\\\\b(append|cap|close|complex|copy|delete|imag|len|panic|print|println|real|recover|min|max|clear)\\\\b(?=\\\\()","name":"entity.name.function.support.builtin.go"},{"begin":"\\\\b(new)\\\\b(\\\\()","beginCaptures":{"1":{"name":"entity.name.function.support.builtin.go"},"2":{"name":"punctuation.definition.begin.bracket.round.go"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.round.go"}},"patterns":[{"include":"#functions"},{"include":"#struct_variables_types"},{"include":"#support_functions"},{"include":"#type-declarations"},{"include":"#generic_types"},{"match":"\\\\w+","name":"entity.name.type.go"},{"include":"$self"}]},{"begin":"\\\\b(make)\\\\b(\\\\()((?:(?:[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+(?:\\\\([^)]+\\\\))?)?[]*\\\\[]+{0,1}(?:(?!\\\\bmap\\\\b)[.\\\\w]+)?(\\\\[(?:\\\\S+(?:,\\\\s*\\\\S+)*)?])?,?)?","beginCaptures":{"1":{"name":"entity.name.function.support.builtin.go"},"2":{"name":"punctuation.definition.begin.bracket.round.go"},"3":{"patterns":[{"include":"#type-declarations-without-brackets"},{"include":"#parameter-variable-types"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.round.go"}},"patterns":[{"include":"$self"}]}]},"comments":{"patterns":[{"begin":"(/\\\\*)","beginCaptures":{"1":{"name":"punctuation.definition.comment.go"}},"end":"(\\\\*/)","endCaptures":{"1":{"name":"punctuation.definition.comment.go"}},"name":"comment.block.go"},{"begin":"(//)","beginCaptures":{"1":{"name":"punctuation.definition.comment.go"}},"end":"\\\\n|$","name":"comment.line.double-slash.go"}]},"const_assignment":{"patterns":[{"captures":{"1":{"patterns":[{"include":"#delimiters"},{"match":"\\\\w+","name":"variable.other.constant.go"}]},"2":{"patterns":[{"include":"#type-declarations-without-brackets"},{"include":"#generic_types"},{"match":"\\\\(","name":"punctuation.definition.begin.bracket.round.go"},{"match":"\\\\)","name":"punctuation.definition.end.bracket.round.go"},{"match":"\\\\[","name":"punctuation.definition.begin.bracket.square.go"},{"match":"]","name":"punctuation.definition.end.bracket.square.go"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"(?<=\\\\bconst\\\\b)\\\\s*\\\\b([.\\\\w]+(?:,\\\\s*[.\\\\w]+)*)\\\\s*((?:(?:[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+(?:\\\\([^)]+\\\\))?)?(?![]*\\\\[]+{0,1}\\\\b(?:struct|func|map)\\\\b)(?:[]*.\\\\[\\\\w]+(?:,\\\\s*[]*.\\\\[\\\\w]+)*)?\\\\s*=?)?"},{"begin":"(?<=\\\\bconst\\\\b)\\\\s*(\\\\()","beginCaptures":{"1":{"name":"punctuation.definition.begin.bracket.round.go"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.round.go"}},"patterns":[{"captures":{"1":{"patterns":[{"include":"#delimiters"},{"match":"\\\\w+","name":"variable.other.constant.go"}]},"2":{"patterns":[{"include":"#type-declarations-without-brackets"},{"include":"#generic_types"},{"match":"\\\\(","name":"punctuation.definition.begin.bracket.round.go"},{"match":"\\\\)","name":"punctuation.definition.end.bracket.round.go"},{"match":"\\\\[","name":"punctuation.definition.begin.bracket.square.go"},{"match":"]","name":"punctuation.definition.end.bracket.square.go"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"^\\\\s*\\\\b([.\\\\w]+(?:,\\\\s*[.\\\\w]+)*)\\\\s*((?:(?:[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+(?:\\\\([^)]+\\\\))?)?(?![]*\\\\[]+{0,1}\\\\b(?:struct|func|map)\\\\b)(?:[]*.\\\\[\\\\w]+(?:,\\\\s*[]*.\\\\[\\\\w]+)*)?\\\\s*=?)?"},{"include":"$self"}]}]},"delimiters":{"patterns":[{"match":",","name":"punctuation.other.comma.go"},{"match":"\\\\.(?!\\\\.\\\\.)","name":"punctuation.other.period.go"},{"match":":(?!=)","name":"punctuation.other.colon.go"}]},"double_parentheses_types":{"captures":{"1":{"patterns":[{"include":"#type-declarations-without-brackets"},{"match":"\\\\(","name":"punctuation.definition.begin.bracket.round.go"},{"match":"\\\\)","name":"punctuation.definition.end.bracket.round.go"},{"match":"\\\\[","name":"punctuation.definition.begin.bracket.square.go"},{"match":"]","name":"punctuation.definition.end.bracket.square.go"},{"match":"\\\\{","name":"punctuation.definition.begin.bracket.curly.go"},{"match":"}","name":"punctuation.definition.end.bracket.curly.go"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"(?<!\\\\w)(\\\\([]*\\\\[]+{0,1}[.\\\\w]+(?:\\\\[(?:[]*.\\\\[{}\\\\w]+(?:,\\\\s*[]*.\\\\[{}\\\\w]+)*)?])?\\\\))(?=\\\\()"},"function_declaration":{"begin":"^\\\\b(func)\\\\b\\\\s*(\\\\([^)]+\\\\)\\\\s*)?(?:(\\\\w+)(?=[(\\\\[]))?","beginCaptures":{"1":{"name":"keyword.function.go"},"2":{"patterns":[{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.begin.bracket.round.go"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.round.go"}},"patterns":[{"captures":{"1":{"name":"variable.parameter.go"},"2":{"patterns":[{"include":"#type-declarations-without-brackets"},{"include":"#parameter-variable-types"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"(\\\\w+\\\\s+)?([*.\\\\w]+(?:\\\\[(?:[*.\\\\w]+(?:,\\\\s+)?)+{0,1}])?)"},{"include":"$self"}]}]},"3":{"patterns":[{"match":"\\\\d\\\\w*","name":"invalid.illegal.identifier.go"},{"match":"\\\\w+","name":"entity.name.function.go"}]}},"end":"(?<=\\\\))\\\\s*((?:[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}(?![]*\\\\[]+{0,1}\\\\b(?:struct|interface)\\\\b)[-\\\\]*.\\\\[\\\\w]+)?\\\\s*(?=\\\\{)","endCaptures":{"1":{"patterns":[{"include":"#type-declarations-without-brackets"},{"include":"#parameter-variable-types"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"patterns":[{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.begin.bracket.round.go"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.round.go"}},"patterns":[{"include":"#function_param_types"}]},{"begin":"([*.\\\\w]+)?(\\\\[)","beginCaptures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]},"2":{"name":"punctuation.definition.begin.bracket.square.go"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.square.go"}},"patterns":[{"include":"#generic_param_types"}]},{"captures":{"1":{"patterns":[{"include":"#type-declarations-without-brackets"},{"include":"#parameter-variable-types"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"(?<=\\\\))\\\\s*((?:\\\\s*[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}[-\\\\]*.<>\\\\[\\\\w]+\\\\s*(?:/[*/].*)?)$"},{"include":"$self"}]},"function_param_types":{"patterns":[{"include":"#struct_variables_types"},{"include":"#interface_variables_types"},{"include":"#type-declarations-without-brackets"},{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"variable.parameter.go"}]}},"match":"((?:\\\\b\\\\w+,\\\\s*)+{0,1}\\\\b\\\\w+)\\\\s+(?=(?:\\\\s*[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}[]*\\\\[]+{0,1}\\\\b(?:struct|interface)\\\\b\\\\s*\\\\{)"},{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"variable.parameter.go"}]}},"match":"(?:(?<=\\\\()|^\\\\s*)((?:\\\\b\\\\w+,\\\\s*)+(?:/[*/].*)?)$"},{"captures":{"1":{"patterns":[{"include":"#delimiters"},{"match":"\\\\w+","name":"variable.parameter.go"}]},"2":{"patterns":[{"include":"#type-declarations-without-brackets"},{"include":"#parameter-variable-types"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"((?:\\\\b\\\\w+,\\\\s*)+{0,1}\\\\b\\\\w+)\\\\s+((?:\\\\s*[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}(?:[]*.\\\\[\\\\w]+{0,1}(?:\\\\bfunc\\\\b\\\\([^)]+{0,1}\\\\)(?:\\\\s*[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}\\\\s*)+(?:[]*.\\\\[\\\\w]+|\\\\([^)]+{0,1}\\\\))?|(?:[]*\\\\[]+{0,1}[*.\\\\w]+(?:\\\\[[^]]+])?[*.\\\\w]+{0,1})+))"},{"begin":"([*.\\\\w]+)?(\\\\[)","beginCaptures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]},"2":{"name":"punctuation.definition.begin.bracket.square.go"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.square.go"}},"patterns":[{"include":"#generic_param_types"}]},{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.begin.bracket.round.go"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.round.go"}},"patterns":[{"include":"#function_param_types"}]},{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"([.\\\\w]+)"},{"include":"$self"}]},"functions":{"begin":"\\\\b(func)\\\\b(?=\\\\()","beginCaptures":{"1":{"name":"keyword.function.go"}},"end":"(?<=\\\\))(\\\\s*(?:[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+)?(\\\\s*(?:[]*\\\\[]+{0,1}[*.\\\\w]+)?(?:\\\\[(?:[*.\\\\w]+{0,1}(?:\\\\[[^]]+{0,1}])?(?:,\\\\s+)?)+]|\\\\([^)]+{0,1}\\\\))?[*.\\\\w]+{0,1}\\\\s*(?=\\\\{)|\\\\s*(?:[]*\\\\[]+{0,1}(?!\\\\bfunc\\\\b)[*.\\\\w]+(?:\\\\[(?:[*.\\\\w]+{0,1}(?:\\\\[[^]]+{0,1}])?(?:,\\\\s+)?)+])?[*.\\\\w]+{0,1}|\\\\([^)]+{0,1}\\\\)))?","endCaptures":{"1":{"patterns":[{"include":"#type-declarations"}]},"2":{"patterns":[{"include":"#type-declarations-without-brackets"},{"include":"#parameter-variable-types"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"patterns":[{"include":"#parameter-variable-types"}]},"functions_inline":{"captures":{"1":{"name":"keyword.function.go"},"2":{"patterns":[{"include":"#type-declarations-without-brackets"},{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.begin.bracket.round.go"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.round.go"}},"patterns":[{"include":"#function_param_types"},{"include":"$self"}]},{"match":"\\\\[","name":"punctuation.definition.begin.bracket.square.go"},{"match":"]","name":"punctuation.definition.end.bracket.square.go"},{"match":"\\\\{","name":"punctuation.definition.begin.bracket.curly.go"},{"match":"}","name":"punctuation.definition.end.bracket.curly.go"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"\\\\b(func)\\\\b(\\\\([^/]*?\\\\)\\\\s+\\\\([^/]*?\\\\))\\\\s+(?=\\\\{)"},"generic_param_types":{"patterns":[{"include":"#struct_variables_types"},{"include":"#interface_variables_types"},{"include":"#type-declarations-without-brackets"},{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"variable.parameter.go"}]}},"match":"((?:\\\\b\\\\w+,\\\\s*)+{0,1}\\\\b\\\\w+)\\\\s+(?=(?:\\\\s*[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}[]*\\\\[]+{0,1}\\\\b(?:struct|interface)\\\\b\\\\s*\\\\{)"},{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"variable.parameter.go"}]}},"match":"(?:(?<=\\\\()|^\\\\s*)((?:\\\\b\\\\w+,\\\\s*)+(?:/[*/].*)?)$"},{"captures":{"1":{"patterns":[{"include":"#delimiters"},{"match":"\\\\w+","name":"variable.parameter.go"}]},"2":{"patterns":[{"include":"#type-declarations-without-brackets"},{"include":"#parameter-variable-types"},{"match":"\\\\w+","name":"entity.name.type.go"}]},"3":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"((?:\\\\b\\\\w+,\\\\s*)+{0,1}\\\\b\\\\w+)\\\\s+((?:\\\\s*[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}(?:[]*.\\\\[\\\\w]+{0,1}(?:\\\\bfunc\\\\b\\\\([^)]+{0,1}\\\\)(?:\\\\s*[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}\\\\s*)+(?:[*.\\\\w]+|\\\\([^)]+{0,1}\\\\))?|(?:(?:[*.~\\\\w]+|\\\\[(?:[*.\\\\w]+{0,1}(?:\\\\[[^]]+{0,1}])?(?:,\\\\s+)?)+])[*.\\\\w]+{0,1})+))"},{"begin":"([*.\\\\w]+)?(\\\\[)","beginCaptures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]},"2":{"name":"punctuation.definition.begin.bracket.square.go"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.square.go"}},"patterns":[{"include":"#generic_param_types"}]},{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.begin.bracket.round.go"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.round.go"}},"patterns":[{"include":"#function_param_types"}]},{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"\\\\b([.\\\\w]+)"},{"include":"$self"}]},"generic_types":{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]},"2":{"patterns":[{"include":"#parameter-variable-types"}]}},"match":"([*.\\\\w]+)(\\\\[[^]]+{0,1}])"},"group-functions":{"patterns":[{"include":"#function_declaration"},{"include":"#functions_inline"},{"include":"#functions"},{"include":"#built_in_functions"},{"include":"#support_functions"}]},"group-types":{"patterns":[{"include":"#other_struct_interface_expressions"},{"include":"#type_assertion_inline"},{"include":"#struct_variables_types"},{"include":"#interface_variables_types"},{"include":"#single_type"},{"include":"#multi_types"},{"include":"#struct_interface_declaration"},{"include":"#double_parentheses_types"},{"include":"#switch_types"},{"include":"#type-declarations"}]},"group-variables":{"patterns":[{"include":"#const_assignment"},{"include":"#var_assignment"},{"include":"#variable_assignment"},{"include":"#label_loop_variables"},{"include":"#slice_index_variables"},{"include":"#property_variables"},{"include":"#switch_variables"},{"include":"#other_variables"}]},"hover":{"patterns":[{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"variable.other.property.go"}]},"2":{"patterns":[{"match":"\\\\binvalid\\\\b\\\\s+\\\\btype\\\\b","name":"invalid.field.go"},{"include":"#type-declarations-without-brackets"},{"include":"#parameter-variable-types"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"(?<=^\\\\bfield\\\\b)\\\\s+([*.\\\\w]+)\\\\s+([\\\\s\\\\S]+)"},{"captures":{"1":{"patterns":[{"include":"#type-declarations-without-brackets"},{"include":"#parameter-variable-types"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"(?<=^\\\\breturns\\\\b)\\\\s+([\\\\s\\\\S]+)"}]},"import":{"patterns":[{"begin":"\\\\b(import)\\\\s+","beginCaptures":{"1":{"name":"keyword.control.import.go"}},"end":"(?!\\\\G)","patterns":[{"include":"#imports"}]}]},"imports":{"patterns":[{"captures":{"1":{"patterns":[{"include":"#delimiters"},{"match":"\\\\w+","name":"variable.other.import.go"}]},"2":{"name":"string.quoted.double.go"},"3":{"name":"punctuation.definition.string.begin.go"},"4":{"name":"entity.name.import.go"},"5":{"name":"punctuation.definition.string.end.go"}},"match":"(\\\\s*[.\\\\w]+)?\\\\s*((\\")([^\\"]*)(\\"))"},{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.imports.begin.bracket.round.go"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.imports.end.bracket.round.go"}},"patterns":[{"include":"#comments"},{"include":"#imports"}]},{"include":"$self"}]},"interface_variables_types":{"begin":"\\\\b(interface)\\\\b\\\\s*(\\\\{)","beginCaptures":{"1":{"name":"keyword.interface.go"},"2":{"name":"punctuation.definition.begin.bracket.curly.go"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.curly.go"}},"patterns":[{"include":"#interface_variables_types_field"},{"include":"$self"}]},"interface_variables_types_field":{"patterns":[{"include":"#support_functions"},{"include":"#type-declarations-without-brackets"},{"begin":"([*.\\\\w]+)?(\\\\[)","beginCaptures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]},"2":{"name":"punctuation.definition.begin.bracket.square.go"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.square.go"}},"patterns":[{"include":"#generic_param_types"}]},{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.begin.bracket.round.go"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.round.go"}},"patterns":[{"include":"#function_param_types"}]},{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"([.\\\\w]+)"}]},"keywords":{"patterns":[{"match":"\\\\b(break|case|continue|default|defer|else|fallthrough|for|go|goto|if|range|return|select|switch)\\\\b","name":"keyword.control.go"},{"match":"\\\\bchan\\\\b","name":"keyword.channel.go"},{"match":"\\\\bconst\\\\b","name":"keyword.const.go"},{"match":"\\\\bvar\\\\b","name":"keyword.var.go"},{"match":"\\\\bfunc\\\\b","name":"keyword.function.go"},{"match":"\\\\binterface\\\\b","name":"keyword.interface.go"},{"match":"\\\\bmap\\\\b","name":"keyword.map.go"},{"match":"\\\\bstruct\\\\b","name":"keyword.struct.go"},{"match":"\\\\bimport\\\\b","name":"keyword.control.import.go"},{"match":"\\\\btype\\\\b","name":"keyword.type.go"}]},"label_loop_variables":{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"variable.other.label.go"}]}},"match":"^(\\\\s*\\\\w+:\\\\s*|\\\\s*\\\\b(?:break|goto|continue)\\\\b\\\\s+\\\\w+(?:\\\\s*/[*/]\\\\s*.*)?)$"},"language_constants":{"captures":{"1":{"name":"constant.language.boolean.go"},"2":{"name":"constant.language.null.go"},"3":{"name":"constant.language.iota.go"}},"match":"\\\\b(?:(true|false)|(nil)|(iota))\\\\b"},"map_types":{"begin":"\\\\b(map)\\\\b(\\\\[)","beginCaptures":{"1":{"name":"keyword.map.go"},"2":{"name":"punctuation.definition.begin.bracket.square.go"}},"end":"(])((?:[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}(?![]*\\\\[]+{0,1}\\\\b(?:func|struct|map)\\\\b)[]*\\\\[]+{0,1}[.\\\\w]+(?:\\\\[(?:[]*.\\\\[{}\\\\w]+(?:,\\\\s*[]*.\\\\[{}\\\\w]+)*)?])?)?","endCaptures":{"1":{"name":"punctuation.definition.end.bracket.square.go"},"2":{"patterns":[{"include":"#type-declarations-without-brackets"},{"match":"\\\\[","name":"punctuation.definition.begin.bracket.square.go"},{"match":"]","name":"punctuation.definition.end.bracket.square.go"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"patterns":[{"include":"#type-declarations-without-brackets"},{"include":"#parameter-variable-types"},{"include":"#functions"},{"match":"\\\\[","name":"punctuation.definition.begin.bracket.square.go"},{"match":"]","name":"punctuation.definition.end.bracket.square.go"},{"match":"\\\\{","name":"punctuation.definition.begin.bracket.curly.go"},{"match":"}","name":"punctuation.definition.end.bracket.curly.go"},{"match":"\\\\(","name":"punctuation.definition.begin.bracket.round.go"},{"match":"\\\\)","name":"punctuation.definition.end.bracket.round.go"},{"match":"\\\\w+","name":"entity.name.type.go"}]},"multi_types":{"begin":"\\\\b(type)\\\\b\\\\s*(\\\\()","beginCaptures":{"1":{"name":"keyword.type.go"},"2":{"name":"punctuation.definition.begin.bracket.round.go"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.round.go"}},"patterns":[{"include":"#struct_variables_types"},{"include":"#interface_variables_types"},{"include":"#type-declarations-without-brackets"},{"include":"#parameter-variable-types"},{"match":"\\\\w+","name":"entity.name.type.go"}]},"numeric_literals":{"captures":{"0":{"patterns":[{"begin":"(?=.)","end":"\\\\n|$","patterns":[{"captures":{"1":{"name":"constant.numeric.decimal.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"2":{"name":"punctuation.separator.constant.numeric.go"},"3":{"name":"constant.numeric.decimal.point.go"},"4":{"name":"constant.numeric.decimal.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"5":{"name":"punctuation.separator.constant.numeric.go"},"6":{"name":"keyword.other.unit.exponent.decimal.go"},"7":{"name":"keyword.operator.plus.exponent.decimal.go"},"8":{"name":"keyword.operator.minus.exponent.decimal.go"},"9":{"name":"constant.numeric.exponent.decimal.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"10":{"name":"keyword.other.unit.imaginary.go"},"11":{"name":"constant.numeric.decimal.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"12":{"name":"punctuation.separator.constant.numeric.go"},"13":{"name":"keyword.other.unit.exponent.decimal.go"},"14":{"name":"keyword.operator.plus.exponent.decimal.go"},"15":{"name":"keyword.operator.minus.exponent.decimal.go"},"16":{"name":"constant.numeric.exponent.decimal.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"17":{"name":"keyword.other.unit.imaginary.go"},"18":{"name":"constant.numeric.decimal.point.go"},"19":{"name":"constant.numeric.decimal.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"20":{"name":"punctuation.separator.constant.numeric.go"},"21":{"name":"keyword.other.unit.exponent.decimal.go"},"22":{"name":"keyword.operator.plus.exponent.decimal.go"},"23":{"name":"keyword.operator.minus.exponent.decimal.go"},"24":{"name":"constant.numeric.exponent.decimal.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"25":{"name":"keyword.other.unit.imaginary.go"},"26":{"name":"keyword.other.unit.hexadecimal.go"},"27":{"name":"constant.numeric.hexadecimal.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"28":{"name":"punctuation.separator.constant.numeric.go"},"29":{"name":"constant.numeric.hexadecimal.go"},"30":{"name":"constant.numeric.hexadecimal.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"31":{"name":"punctuation.separator.constant.numeric.go"},"32":{"name":"keyword.other.unit.exponent.hexadecimal.go"},"33":{"name":"keyword.operator.plus.exponent.hexadecimal.go"},"34":{"name":"keyword.operator.minus.exponent.hexadecimal.go"},"35":{"name":"constant.numeric.exponent.hexadecimal.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"36":{"name":"keyword.other.unit.imaginary.go"},"37":{"name":"keyword.other.unit.hexadecimal.go"},"38":{"name":"constant.numeric.hexadecimal.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"39":{"name":"punctuation.separator.constant.numeric.go"},"40":{"name":"keyword.other.unit.exponent.hexadecimal.go"},"41":{"name":"keyword.operator.plus.exponent.hexadecimal.go"},"42":{"name":"keyword.operator.minus.exponent.hexadecimal.go"},"43":{"name":"constant.numeric.exponent.hexadecimal.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"44":{"name":"keyword.other.unit.imaginary.go"},"45":{"name":"keyword.other.unit.hexadecimal.go"},"46":{"name":"constant.numeric.hexadecimal.go"},"47":{"name":"constant.numeric.hexadecimal.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"48":{"name":"punctuation.separator.constant.numeric.go"},"49":{"name":"keyword.other.unit.exponent.hexadecimal.go"},"50":{"name":"keyword.operator.plus.exponent.hexadecimal.go"},"51":{"name":"keyword.operator.minus.exponent.hexadecimal.go"},"52":{"name":"constant.numeric.exponent.hexadecimal.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"53":{"name":"keyword.other.unit.imaginary.go"}},"match":"\\\\G(?:(?:(?:(?:(?:(?=[.0-9])(?!0[BOXbox])([0-9](?:[0-9]|((?<=\\\\h)_(?=\\\\h)))*)((?<=[0-9])\\\\.|\\\\.(?=[0-9]))([0-9](?:[0-9]|((?<=\\\\h)_(?=\\\\h)))*)?(?:(?<!_)([Ee])(\\\\+?)(-?)([0-9](?:[0-9]|(?<=\\\\h)_(?=\\\\h))*))?(i(?!\\\\w))?(?:\\\\n|$)|(?=[.0-9])(?!0[BOXbox])([0-9](?:[0-9]|((?<=\\\\h)_(?=\\\\h)))*)(?<!_)([Ee])(\\\\+?)(-?)([0-9](?:[0-9]|(?<=\\\\h)_(?=\\\\h))*)(i(?!\\\\w))?(?:\\\\n|$))|((?<=[0-9])\\\\.|\\\\.(?=[0-9]))([0-9](?:[0-9]|((?<=\\\\h)_(?=\\\\h)))*)(?:(?<!_)([Ee])(\\\\+?)(-?)([0-9](?:[0-9]|(?<=\\\\h)_(?=\\\\h))*))?(i(?!\\\\w))?(?:\\\\n|$))|(0[Xx])_?(\\\\h(?:\\\\h|((?<=\\\\h)_(?=\\\\h)))*)((?<=\\\\h)\\\\.|\\\\.(?=\\\\h))(\\\\h(?:\\\\h|((?<=\\\\h)_(?=\\\\h)))*)?(?<!_)([Pp])(\\\\+?)(-?)([0-9](?:[0-9]|(?<=\\\\h)_(?=\\\\h))*)(i(?!\\\\w))?(?:\\\\n|$))|(0[Xx])_?(\\\\h(?:\\\\h|((?<=\\\\h)_(?=\\\\h)))*)(?<!_)([Pp])(\\\\+?)(-?)([0-9](?:[0-9]|(?<=\\\\h)_(?=\\\\h))*)(i(?!\\\\w))?(?:\\\\n|$))|(0[Xx])((?<=\\\\h)\\\\.|\\\\.(?=\\\\h))(\\\\h(?:\\\\h|((?<=\\\\h)_(?=\\\\h)))*)(?<!_)([Pp])(\\\\+?)(-?)([0-9](?:[0-9]|(?<=\\\\h)_(?=\\\\h))*)(i(?!\\\\w))?(?:\\\\n|$))"},{"captures":{"1":{"name":"constant.numeric.decimal.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"2":{"name":"punctuation.separator.constant.numeric.go"},"3":{"name":"keyword.other.unit.imaginary.go"},"4":{"name":"keyword.other.unit.binary.go"},"5":{"name":"constant.numeric.binary.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"6":{"name":"punctuation.separator.constant.numeric.go"},"7":{"name":"keyword.other.unit.imaginary.go"},"8":{"name":"keyword.other.unit.octal.go"},"9":{"name":"constant.numeric.octal.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"10":{"name":"punctuation.separator.constant.numeric.go"},"11":{"name":"keyword.other.unit.imaginary.go"},"12":{"name":"keyword.other.unit.hexadecimal.go"},"13":{"name":"constant.numeric.hexadecimal.go","patterns":[{"match":"(?<=\\\\h)_(?=\\\\h)","name":"punctuation.separator.constant.numeric.go"}]},"14":{"name":"punctuation.separator.constant.numeric.go"},"15":{"name":"keyword.other.unit.imaginary.go"}},"match":"\\\\G(?:(?:(?:(?=[.0-9])(?!0[BOXbox])([0-9](?:[0-9]|((?<=\\\\h)_(?=\\\\h)))*)(i(?!\\\\w))?(?:\\\\n|$)|(0[Bb])_?([01](?:[01]|((?<=\\\\h)_(?=\\\\h)))*)(i(?!\\\\w))?(?:\\\\n|$))|(0[Oo]?)_?((?:[0-7]|((?<=\\\\h)_(?=\\\\h)))+)(i(?!\\\\w))?(?:\\\\n|$))|(0[Xx])_?(\\\\h(?:\\\\h|((?<=\\\\h)_(?=\\\\h)))*)(i(?!\\\\w))?(?:\\\\n|$))"},{"match":"(?:[.0-9A-Z_a-z]|(?<=[EPep])[-+])+","name":"invalid.illegal.constant.numeric.go"}]}]}},"match":"(?<!\\\\w)\\\\.?\\\\d(?:[.0-9A-Z_a-z]|(?<=[EPep])[-+])*"},"operators":{"patterns":[{"match":"(?<!\\\\w)[\\\\&*]+(?!\\\\d)(?=[]\\\\[\\\\w]|<-)","name":"keyword.operator.address.go"},{"match":"<-","name":"keyword.operator.channel.go"},{"match":"--","name":"keyword.operator.decrement.go"},{"match":"\\\\+\\\\+","name":"keyword.operator.increment.go"},{"match":"(==|!=|<=|>=|<(?!<)|>(?!>))","name":"keyword.operator.comparison.go"},{"match":"(&&|\\\\|\\\\||!)","name":"keyword.operator.logical.go"},{"match":"((?:|[-%*+/:^|]|<<|>>|&\\\\^?)=)","name":"keyword.operator.assignment.go"},{"match":"([-%*+/])","name":"keyword.operator.arithmetic.go"},{"match":"(&(?!\\\\^)|[\\\\^|]|&\\\\^|<<|>>|~)","name":"keyword.operator.arithmetic.bitwise.go"},{"match":"\\\\.\\\\.\\\\.","name":"keyword.operator.ellipsis.go"}]},"other_struct_interface_expressions":{"patterns":[{"include":"#after_control_variables"},{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]},"2":{"patterns":[{"include":"#type-declarations-without-brackets"},{"match":"\\\\[","name":"punctuation.definition.begin.bracket.square.go"},{"match":"]","name":"punctuation.definition.end.bracket.square.go"},{"match":"\\\\{","name":"punctuation.definition.begin.bracket.curly.go"},{"match":"}","name":"punctuation.definition.end.bracket.curly.go"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"\\\\b(?!(?:struct|interface)\\\\b)([.\\\\w]+)(?<brackets>\\\\[(?:[^]\\\\[]|\\\\g<brackets>)*])?(?=\\\\{)"}]},"other_variables":{"match":"\\\\w+","name":"variable.other.go"},"package_name":{"patterns":[{"begin":"\\\\b(package)\\\\s+","beginCaptures":{"1":{"name":"keyword.package.go"}},"end":"(?!\\\\G)","patterns":[{"match":"\\\\d\\\\w*","name":"invalid.illegal.identifier.go"},{"match":"\\\\w+","name":"entity.name.type.package.go"}]}]},"parameter-variable-types":{"patterns":[{"match":"\\\\{","name":"punctuation.definition.begin.bracket.curly.go"},{"match":"}","name":"punctuation.definition.end.bracket.curly.go"},{"begin":"([*.\\\\w]+)?(\\\\[)","beginCaptures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]},"2":{"name":"punctuation.definition.begin.bracket.square.go"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.square.go"}},"patterns":[{"include":"#generic_param_types"}]},{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.begin.bracket.round.go"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.round.go"}},"patterns":[{"include":"#function_param_types"}]}]},"property_variables":{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"variable.other.property.go"}]}},"match":"\\\\b([.\\\\w]+:(?!=))"},"raw_string_literals":{"begin":"`","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.go"}},"end":"`","endCaptures":{"0":{"name":"punctuation.definition.string.end.go"}},"name":"string.quoted.raw.go","patterns":[{"include":"#string_placeholder"}]},"runes":{"patterns":[{"begin":"\'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.go"}},"end":"\'","endCaptures":{"0":{"name":"punctuation.definition.string.end.go"}},"name":"string.quoted.rune.go","patterns":[{"match":"\\\\G(\\\\\\\\([0-7]{3}|[\\"\'\\\\\\\\abfnrtv]|x\\\\h{2}|u\\\\h{4}|U\\\\h{8})|.)(?=\')","name":"constant.other.rune.go"},{"match":"[^\']+","name":"invalid.illegal.unknown-rune.go"}]}]},"single_type":{"patterns":[{"captures":{"1":{"name":"keyword.type.go"},"2":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]},"3":{"patterns":[{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.begin.bracket.round.go"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.round.go"}},"patterns":[{"include":"#function_param_types"},{"include":"$self"}]},{"include":"#type-declarations"},{"include":"#generic_types"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"^\\\\s*\\\\b(type)\\\\b\\\\s*([*.\\\\w]+)\\\\s+(?!(?:=\\\\s*)?[]*\\\\[]+{0,1}\\\\b(?:struct|interface)\\\\b)([\\\\s\\\\S]+)"},{"begin":"(?:^|\\\\s+)\\\\b(type)\\\\b\\\\s*([*.\\\\w]+)(?=\\\\[)","beginCaptures":{"1":{"name":"keyword.type.go"},"2":{"patterns":[{"include":"#type-declarations-without-brackets"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"end":"(?<=])(\\\\s+(?:=\\\\s*)?(?:[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}(?![]*\\\\[]+{0,1}\\\\b(?:struct|interface|func)\\\\b)[-\\\\]*.\\\\[\\\\w]+(?:,\\\\s*[]*.\\\\[\\\\w]+)*)?","endCaptures":{"1":{"patterns":[{"include":"#type-declarations-without-brackets"},{"match":"\\\\[","name":"punctuation.definition.begin.bracket.square.go"},{"match":"]","name":"punctuation.definition.end.bracket.square.go"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"patterns":[{"include":"#struct_variables_types"},{"include":"#type-declarations-without-brackets"},{"include":"#parameter-variable-types"},{"match":"\\\\[","name":"punctuation.definition.begin.bracket.square.go"},{"match":"]","name":"punctuation.definition.end.bracket.square.go"},{"match":"\\\\{","name":"punctuation.definition.begin.bracket.curly.go"},{"match":"}","name":"punctuation.definition.end.bracket.curly.go"},{"match":"\\\\(","name":"punctuation.definition.begin.bracket.round.go"},{"match":"\\\\)","name":"punctuation.definition.end.bracket.round.go"},{"match":"\\\\w+","name":"entity.name.type.go"}]}]},"slice_index_variables":{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"variable.other.go"}]}},"match":"(?<=\\\\w\\\\[)((?:\\\\b[-%\\\\&*+./<>|\\\\w]+:|:\\\\b[-%\\\\&*+./<>|\\\\w]+)(?:\\\\b[-%\\\\&*+./<>|\\\\w]+)?(?::\\\\b[-%\\\\&*+./<>|\\\\w]+)?)(?=])"},"statements":{"patterns":[{"include":"#package_name"},{"include":"#import"},{"include":"#syntax_errors"},{"include":"#group-functions"},{"include":"#group-types"},{"include":"#group-variables"},{"include":"#hover"}]},"storage_types":{"patterns":[{"match":"\\\\bbool\\\\b","name":"storage.type.boolean.go"},{"match":"\\\\bbyte\\\\b","name":"storage.type.byte.go"},{"match":"\\\\berror\\\\b","name":"storage.type.error.go"},{"match":"\\\\b(complex(64|128)|float(32|64)|u?int(8|16|32|64)?)\\\\b","name":"storage.type.numeric.go"},{"match":"\\\\brune\\\\b","name":"storage.type.rune.go"},{"match":"\\\\bstring\\\\b","name":"storage.type.string.go"},{"match":"\\\\buintptr\\\\b","name":"storage.type.uintptr.go"},{"match":"\\\\bany\\\\b","name":"entity.name.type.any.go"},{"match":"\\\\bcomparable\\\\b","name":"entity.name.type.comparable.go"}]},"string_escaped_char":{"patterns":[{"match":"\\\\\\\\([0-7]{3}|[\\"\'\\\\\\\\abfnrtv]|x\\\\h{2}|u\\\\h{4}|U\\\\h{8})","name":"constant.character.escape.go"},{"match":"\\\\\\\\[^\\"\'0-7Uabfnrtuvx]","name":"invalid.illegal.unknown-escape.go"}]},"string_literals":{"patterns":[{"begin":"\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.go"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.go"}},"name":"string.quoted.double.go","patterns":[{"include":"#string_escaped_char"},{"include":"#string_placeholder"}]}]},"string_placeholder":{"patterns":[{"match":"%(\\\\[\\\\d+])?([- #+0]{0,2}((\\\\d+|\\\\*)?(\\\\.?(\\\\d+|\\\\*|(\\\\[\\\\d+])\\\\*?)?(\\\\[\\\\d+])?)?))?[%EFGTUXb-gopqstvwx]","name":"constant.other.placeholder.go"}]},"struct_interface_declaration":{"captures":{"1":{"name":"keyword.type.go"},"2":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"^\\\\s*\\\\b(type)\\\\b\\\\s*([.\\\\w]+)"},"struct_variable_types_fields_multi":{"patterns":[{"begin":"\\\\b(\\\\w+(?:,\\\\s*\\\\b\\\\w+)*(?:\\\\s*[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}\\\\s*[]*\\\\[]+{0,1})\\\\b(struct)\\\\b\\\\s*(\\\\{)","beginCaptures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"variable.other.property.go"}]},"2":{"name":"keyword.struct.go"},"3":{"name":"punctuation.definition.begin.bracket.curly.go"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.curly.go"}},"patterns":[{"include":"#struct_variables_types_fields"},{"include":"$self"}]},{"begin":"\\\\b(\\\\w+(?:,\\\\s*\\\\b\\\\w+)*(?:\\\\s*[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}\\\\s*[]*\\\\[]+{0,1})\\\\b(interface)\\\\b\\\\s*(\\\\{)","beginCaptures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"variable.other.property.go"}]},"2":{"name":"keyword.interface.go"},"3":{"name":"punctuation.definition.begin.bracket.curly.go"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.curly.go"}},"patterns":[{"include":"#interface_variables_types_field"},{"include":"$self"}]},{"begin":"\\\\b(\\\\w+(?:,\\\\s*\\\\b\\\\w+)*(?:\\\\s*[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}\\\\s*[]*\\\\[]+{0,1})\\\\b(func)\\\\b\\\\s*(\\\\()","beginCaptures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"variable.other.property.go"}]},"2":{"name":"keyword.function.go"},"3":{"name":"punctuation.definition.begin.bracket.round.go"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.round.go"}},"patterns":[{"include":"#function_param_types"},{"include":"$self"}]},{"include":"#parameter-variable-types"}]},"struct_variables_types":{"begin":"\\\\b(struct)\\\\b\\\\s*(\\\\{)","beginCaptures":{"1":{"name":"keyword.struct.go"},"2":{"name":"punctuation.definition.begin.bracket.curly.go"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.curly.go"}},"patterns":[{"include":"#struct_variables_types_fields"},{"include":"$self"}]},"struct_variables_types_fields":{"patterns":[{"include":"#struct_variable_types_fields_multi"},{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"(?<=\\\\{)\\\\s*((?:\\\\s*[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}[]*.\\\\[\\\\w]+)\\\\s*(?=})"},{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"variable.other.property.go"}]},"2":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"(?<=\\\\{)\\\\s*((?:\\\\w+,\\\\s*)+{0,1}\\\\w+\\\\s+)((?:\\\\s*[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}[]*.\\\\[\\\\w]+)\\\\s*(?=})"},{"captures":{"1":{"patterns":[{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"variable.other.property.go"}]},"2":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"((?:\\\\w+,\\\\s*)+{0,1}\\\\w+\\\\s+)?((?:\\\\s*[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}[^/\\\\s]+;?)"}]}},"match":"(?<=\\\\{)((?:\\\\s*(?:(?:\\\\w+,\\\\s*)+{0,1}\\\\w+\\\\s+)?(?:\\\\s*[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}[^/\\\\s]+;?)+)\\\\s*(?=})"},{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"((?:\\\\s*[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}[*.\\\\w]+\\\\s*)(?:(?=[\\"/`])|$)"},{"captures":{"1":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"variable.other.property.go"}]},"2":{"patterns":[{"include":"#type-declarations-without-brackets"},{"include":"#parameter-variable-types"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"\\\\b(\\\\w+(?:\\\\s*,\\\\s*\\\\b\\\\w+)*)\\\\s*([^\\"/`]+)"}]},"support_functions":{"captures":{"1":{"name":"entity.name.function.support.go"},"2":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\d\\\\w*","name":"invalid.illegal.identifier.go"},{"match":"\\\\w+","name":"entity.name.function.support.go"}]},"3":{"patterns":[{"include":"#type-declarations-without-brackets"},{"match":"\\\\[","name":"punctuation.definition.begin.bracket.square.go"},{"match":"]","name":"punctuation.definition.end.bracket.square.go"},{"match":"\\\\{","name":"punctuation.definition.begin.bracket.curly.go"},{"match":"}","name":"punctuation.definition.end.bracket.curly.go"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"(?:((?<=\\\\.)\\\\b\\\\w+)|\\\\b(\\\\w+))(?<brackets>\\\\[(?:[^]\\\\[]|\\\\g<brackets>)*])?(?=\\\\()"},"switch_types":{"begin":"(?<=\\\\bswitch\\\\b)\\\\s*(\\\\w+\\\\s*:=)?\\\\s*([-\\\\]%\\\\&(-+./<>\\\\[|\\\\w]+)(\\\\.\\\\(\\\\btype\\\\b\\\\)\\\\s*)(\\\\{)","beginCaptures":{"1":{"patterns":[{"include":"#operators"},{"match":"\\\\w+","name":"variable.other.assignment.go"}]},"2":{"patterns":[{"include":"#support_functions"},{"include":"#type-declarations"},{"match":"\\\\w+","name":"variable.other.go"}]},"3":{"patterns":[{"include":"#delimiters"},{"include":"#brackets"},{"match":"\\\\btype\\\\b","name":"keyword.type.go"}]},"4":{"name":"punctuation.definition.begin.bracket.curly.go"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.curly.go"}},"patterns":[{"captures":{"1":{"name":"keyword.control.go"},"2":{"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]},"3":{"name":"punctuation.other.colon.go"},"4":{"patterns":[{"include":"#comments"}]}},"match":"^\\\\s*\\\\b(case)\\\\b\\\\s+([!*,.<=>\\\\w\\\\s]+)(:)(\\\\s*/[*/]\\\\s*.*)?$"},{"begin":"\\\\bcase\\\\b","beginCaptures":{"0":{"name":"keyword.control.go"}},"end":":","endCaptures":{"0":{"name":"punctuation.other.colon.go"}},"patterns":[{"include":"#type-declarations"},{"match":"\\\\w+","name":"entity.name.type.go"}]},{"include":"$self"}]},"switch_variables":{"patterns":[{"captures":{"1":{"name":"keyword.control.go"},"2":{"patterns":[{"include":"#type-declarations"},{"include":"#support_functions"},{"include":"#variable_assignment"},{"match":"\\\\w+","name":"variable.other.go"}]}},"match":"^\\\\s*\\\\b(case)\\\\b\\\\s+([\\\\s\\\\S]+:\\\\s*(?:/[*/].*)?)$"},{"begin":"(?<=\\\\bswitch\\\\b)\\\\s*((?:[.\\\\w]+(?:\\\\s*[-!%\\\\&+,/:<=>|]+\\\\s*[.\\\\w]+)*\\\\s*[-!%\\\\&+,/:<=>|]+)?\\\\s*[-\\\\]%\\\\&(-+./<>\\\\[|\\\\w]+{0,1}\\\\s*(?:;\\\\s*[-\\\\]%\\\\&(-+./<>\\\\[|\\\\w]+\\\\s*)?)(\\\\{)","beginCaptures":{"1":{"patterns":[{"include":"#support_functions"},{"include":"#type-declarations"},{"include":"#variable_assignment"},{"match":"\\\\w+","name":"variable.other.go"}]},"2":{"name":"punctuation.definition.begin.bracket.curly.go"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.curly.go"}},"patterns":[{"begin":"\\\\bcase\\\\b","beginCaptures":{"0":{"name":"keyword.control.go"}},"end":":","endCaptures":{"0":{"name":"punctuation.other.colon.go"}},"patterns":[{"include":"#support_functions"},{"include":"#type-declarations"},{"include":"#variable_assignment"},{"match":"\\\\w+","name":"variable.other.go"}]},{"include":"$self"}]}]},"syntax_errors":{"patterns":[{"captures":{"1":{"name":"invalid.illegal.slice.go"}},"match":"\\\\[](\\\\s+)"},{"match":"\\\\b0[0-7]*[89]\\\\d*\\\\b","name":"invalid.illegal.numeric.go"}]},"terminators":{"match":";","name":"punctuation.terminator.go"},"type-declarations":{"patterns":[{"include":"#language_constants"},{"include":"#comments"},{"include":"#map_types"},{"include":"#brackets"},{"include":"#delimiters"},{"include":"#keywords"},{"include":"#operators"},{"include":"#runes"},{"include":"#storage_types"},{"include":"#raw_string_literals"},{"include":"#string_literals"},{"include":"#numeric_literals"},{"include":"#terminators"}]},"type-declarations-without-brackets":{"patterns":[{"include":"#language_constants"},{"include":"#comments"},{"include":"#map_types"},{"include":"#delimiters"},{"include":"#keywords"},{"include":"#operators"},{"include":"#runes"},{"include":"#storage_types"},{"include":"#raw_string_literals"},{"include":"#string_literals"},{"include":"#numeric_literals"},{"include":"#terminators"}]},"type_assertion_inline":{"captures":{"1":{"name":"keyword.type.go"},"2":{"patterns":[{"include":"#type-declarations-without-brackets"},{"match":"\\\\(","name":"punctuation.definition.begin.bracket.round.go"},{"match":"\\\\)","name":"punctuation.definition.end.bracket.round.go"},{"match":"\\\\[","name":"punctuation.definition.begin.bracket.square.go"},{"match":"]","name":"punctuation.definition.end.bracket.square.go"},{"match":"\\\\{","name":"punctuation.definition.begin.bracket.curly.go"},{"match":"}","name":"punctuation.definition.end.bracket.curly.go"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"(?<=\\\\.\\\\()(?:\\\\b(type)\\\\b|((?:\\\\s*[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+{0,1}[]*\\\\[]+{0,1}[.\\\\w]+(?:\\\\[(?:[]*.\\\\[{}\\\\w]+(?:,\\\\s*[]*.\\\\[{}\\\\w]+)*)?])?))(?=\\\\))"},"var_assignment":{"patterns":[{"captures":{"1":{"patterns":[{"include":"#delimiters"},{"match":"\\\\w+","name":"variable.other.assignment.go"}]},"2":{"patterns":[{"include":"#type-declarations-without-brackets"},{"include":"#generic_types"},{"match":"\\\\(","name":"punctuation.definition.begin.bracket.round.go"},{"match":"\\\\)","name":"punctuation.definition.end.bracket.round.go"},{"match":"\\\\[","name":"punctuation.definition.begin.bracket.square.go"},{"match":"]","name":"punctuation.definition.end.bracket.square.go"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"(?<=\\\\bvar\\\\b)\\\\s*\\\\b([.\\\\w]+(?:,\\\\s*[.\\\\w]+)*)\\\\s*((?:(?:[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+(?:\\\\([^)]+\\\\))?)?(?![]*\\\\[]+{0,1}\\\\b(?:struct|func|map)\\\\b)(?:[]*.\\\\[\\\\w]+(?:,\\\\s*[]*.\\\\[\\\\w]+)*)?\\\\s*=?)?"},{"begin":"(?<=\\\\bvar\\\\b)\\\\s*(\\\\()","beginCaptures":{"1":{"name":"punctuation.definition.begin.bracket.round.go"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.end.bracket.round.go"}},"patterns":[{"captures":{"1":{"patterns":[{"include":"#delimiters"},{"match":"\\\\w+","name":"variable.other.assignment.go"}]},"2":{"patterns":[{"include":"#type-declarations-without-brackets"},{"include":"#generic_types"},{"match":"\\\\(","name":"punctuation.definition.begin.bracket.round.go"},{"match":"\\\\)","name":"punctuation.definition.end.bracket.round.go"},{"match":"\\\\[","name":"punctuation.definition.begin.bracket.square.go"},{"match":"]","name":"punctuation.definition.end.bracket.square.go"},{"match":"\\\\w+","name":"entity.name.type.go"}]}},"match":"^\\\\s*\\\\b([.\\\\w]+(?:,\\\\s*[.\\\\w]+)*)\\\\s*((?:(?:[]*\\\\[]+{0,1}(?:<-\\\\s*)?\\\\bchan\\\\b(?:\\\\s*<-)?\\\\s*)+(?:\\\\([^)]+\\\\))?)?(?![]*\\\\[]+{0,1}\\\\b(?:struct|func|map)\\\\b)(?:[]*.\\\\[\\\\w]+(?:,\\\\s*[]*.\\\\[\\\\w]+)*)?\\\\s*=?)?"},{"include":"$self"}]}]},"variable_assignment":{"patterns":[{"captures":{"0":{"patterns":[{"include":"#delimiters"},{"match":"\\\\d\\\\w*","name":"invalid.illegal.identifier.go"},{"match":"\\\\w+","name":"variable.other.assignment.go"}]}},"match":"\\\\b\\\\w+(?:,\\\\s*\\\\w+)*(?=\\\\s*:=)"},{"captures":{"0":{"patterns":[{"include":"#delimiters"},{"include":"#operators"},{"match":"\\\\d\\\\w*","name":"invalid.illegal.identifier.go"},{"match":"\\\\w+","name":"variable.other.assignment.go"}]}},"match":"\\\\b[*.\\\\w]+(?:,\\\\s*[*.\\\\w]+)*(?=\\\\s*=(?!=))"}]}},"scopeName":"source.go"}'))];export{e as default};
@@ -0,0 +1 @@
1
+ const e=Object.freeze(JSON.parse('{"colors":{"activityBar.background":"#1C1E26","activityBar.dropBackground":"#6C6F9380","activityBar.foreground":"#D5D8DAB3","activityBarBadge.background":"#E95378","activityBarBadge.foreground":"#06060C","badge.background":"#2E303E","badge.foreground":"#D5D8DA","breadcrumbPicker.background":"#232530","button.background":"#2E303E","debugToolBar.background":"#1C1E26","diffEditor.insertedTextBackground":"#09F7A01A","diffEditor.removedTextBackground":"#F43E5C1A","dropdown.background":"#232530","dropdown.listBackground":"#2E303E","editor.background":"#1C1E26","editor.findMatchBackground":"#6C6F9380","editor.findMatchHighlightBackground":"#6C6F934D","editor.findRangeHighlightBackground":"#6C6F931A","editor.hoverHighlightBackground":"#6C6F934D","editor.lineHighlightBackground":"#2E303E4D","editor.rangeHighlightBackground":"#2E303E80","editor.selectionBackground":"#2E303EB3","editor.selectionHighlightBackground":"#6C6F934D","editor.wordHighlightBackground":"#6C6F9380","editor.wordHighlightStrongBackground":"#6C6F9380","editorBracketMatch.background":"#6C6F9380","editorBracketMatch.border":"#6C6F9300","editorCodeLens.foreground":"#6C6F9380","editorCursor.background":"#1C1E26","editorCursor.foreground":"#E95378","editorError.foreground":"#F43E5C","editorGroup.border":"#1A1C23","editorGroup.dropBackground":"#6C6F934D","editorGroupHeader.tabsBackground":"#1C1E26","editorGutter.addedBackground":"#09F7A0B3","editorGutter.deletedBackground":"#F43E5CB3","editorGutter.modifiedBackground":"#21BFC2B3","editorIndentGuide.activeBackground":"#2E303E","editorIndentGuide.background":"#2E303E80","editorLineNumber.activeForeground":"#D5D8DA80","editorLineNumber.foreground":"#D5D8DA1A","editorOverviewRuler.addedForeground":"#09F7A080","editorOverviewRuler.border":"#2E303EB3","editorOverviewRuler.bracketMatchForeground":"#D5D8DA80","editorOverviewRuler.deletedForeground":"#F43E5C80","editorOverviewRuler.errorForeground":"#F43E5CE6","editorOverviewRuler.findMatchForeground":"#6C6F93","editorOverviewRuler.modifiedForeground":"#21BFC280","editorOverviewRuler.warningForeground":"#27D79780","editorRuler.foreground":"#6C6F934D","editorSuggestWidget.highlightForeground":"#E95378","editorWarning.foreground":"#27D797B3","editorWidget.background":"#232530","editorWidget.border":"#232530","errorForeground":"#F43E5C","extensionButton.prominentBackground":"#E95378","extensionButton.prominentHoverBackground":"#E9436D","focusBorder":"#1A1C23","foreground":"#D5D8DA","gitDecoration.addedResourceForeground":"#27D797B3","gitDecoration.deletedResourceForeground":"#F43E5C","gitDecoration.ignoredResourceForeground":"#D5D8DA4D","gitDecoration.modifiedResourceForeground":"#FAB38E","gitDecoration.untrackedResourceForeground":"#27D797","input.background":"#2E303E","inputOption.activeBorder":"#E9436D80","inputValidation.errorBackground":"#F43E5C80","inputValidation.errorBorder":"#F43E5C00","list.activeSelectionBackground":"#2E303E80","list.activeSelectionForeground":"#D5D8DA","list.dropBackground":"#6C6F9380","list.errorForeground":"#F43E5CE6","list.focusBackground":"#2E303E80","list.focusForeground":"#D5D8DA","list.highlightForeground":"#E95378","list.hoverBackground":"#2E303E80","list.hoverForeground":"#D5D8DA","list.inactiveFocusBackground":"#2E303E80","list.inactiveSelectionBackground":"#2E303E4D","list.inactiveSelectionForeground":"#D5D8DA","list.warningForeground":"#27D797B3","panelTitle.activeBorder":"#E95378","peekView.border":"#1A1C23","peekViewEditor.background":"#232530","peekViewEditor.matchHighlightBackground":"#6C6F9380","peekViewResult.background":"#232530","peekViewResult.matchHighlightBackground":"#6C6F9380","peekViewResult.selectionBackground":"#2E303E80","peekViewTitle.background":"#232530","pickerGroup.foreground":"#E95378E6","progressBar.background":"#E95378","scrollbar.shadow":"#16161C","scrollbarSlider.activeBackground":"#6C6F9380","scrollbarSlider.background":"#6C6F931A","scrollbarSlider.hoverBackground":"#6C6F934D","selection.background":"#6C6F9380","sideBar.background":"#1C1E26","sideBar.dropBackground":"#6C6F934D","sideBar.foreground":"#D5D8DA80","sideBarSectionHeader.background":"#1C1E26","sideBarSectionHeader.foreground":"#D5D8DAB3","statusBar.background":"#1C1E26","statusBar.debuggingBackground":"#FAB38E","statusBar.debuggingForeground":"#06060C","statusBar.foreground":"#D5D8DA80","statusBar.noFolderBackground":"#1C1E26","statusBarItem.hoverBackground":"#2E303E","statusBarItem.prominentBackground":"#2E303E","statusBarItem.prominentHoverBackground":"#6C6F93","tab.activeBorder":"#E95378","tab.border":"#1C1E2600","tab.inactiveBackground":"#1C1E26","terminal.ansiBlue":"#26BBD9","terminal.ansiBrightBlue":"#3FC4DE","terminal.ansiBrightCyan":"#6BE4E6","terminal.ansiBrightGreen":"#3FDAA4","terminal.ansiBrightMagenta":"#F075B5","terminal.ansiBrightRed":"#EC6A88","terminal.ansiBrightYellow":"#FBC3A7","terminal.ansiCyan":"#59E1E3","terminal.ansiGreen":"#29D398","terminal.ansiMagenta":"#EE64AC","terminal.ansiRed":"#E95678","terminal.ansiYellow":"#FAB795","terminal.foreground":"#D5D8DA","terminal.selectionBackground":"#6C6F934D","terminalCursor.background":"#D5D8DA","terminalCursor.foreground":"#6C6F9380","textLink.activeForeground":"#E9436D","textLink.foreground":"#E95378","titleBar.activeBackground":"#1C1E26","titleBar.inactiveBackground":"#1C1E26","walkThrough.embeddedEditorBackground":"#232530","widget.shadow":"#16161C"},"displayName":"Horizon","name":"horizon","semanticHighlighting":true,"tokenColors":[{"scope":"comment","settings":{"fontStyle":"italic","foreground":"#BBBBBB4D"}},{"scope":"constant","settings":{"foreground":"#F09483E6"}},{"scope":"constant.character.escape","settings":{"foreground":"#25B0BCE6"}},{"scope":"entity.name","settings":{"foreground":"#FAC29AE6"}},{"scope":"entity.name.function","settings":{"foreground":"#25B0BCE6"}},{"scope":"entity.name.tag","settings":{"fontStyle":"normal","foreground":"#E95678E6"}},{"scope":["entity.name.type","storage.type.cs"],"settings":{"foreground":"#FAC29AE6"}},{"scope":"entity.other.attribute-name","settings":{"fontStyle":"normal","foreground":"#F09483E6"}},{"scope":"entity.other.inherited-class","settings":{"foreground":"#FAB795E6"}},{"scope":"entity.other.attribute-name.id","settings":{"foreground":"#25B0BCE6"}},{"scope":["entity.other.attribute-name.pseudo-element","entity.other.attribute-name.pseudo-class"],"settings":{"foreground":"#FAB795E6"}},{"scope":["entity.name.variable","variable"],"settings":{"foreground":"#E95678E6"}},{"scope":"keyword","settings":{"fontStyle":"normal","foreground":"#B877DBE6"}},{"scope":"keyword.operator","settings":{"foreground":"#BBBBBB"}},{"scope":["keyword.operator.new","keyword.operator.expression","keyword.operator.logical","keyword.operator.delete"],"settings":{"foreground":"#B877DBE6"}},{"scope":"keyword.other.unit","settings":{"foreground":"#F09483E6"}},{"scope":"markup.quote","settings":{"fontStyle":"italic","foreground":"#FAB795B3"}},{"scope":["markup.heading","entity.name.section"],"settings":{"foreground":"#E95678E6"}},{"scope":"markup.bold","settings":{"fontStyle":"bold","foreground":"#B877DBE6"}},{"scope":"markup.italic","settings":{"fontStyle":"italic","foreground":"#25B0BCE6"}},{"scope":["markup.inline.raw","markup.fenced_code.block"],"settings":{"foreground":"#F09483E6"}},{"scope":"markup.underline.link","settings":{"foreground":"#FAB795E6"}},{"scope":"storage","settings":{"fontStyle":"normal","foreground":"#B877DBE6"}},{"scope":["string.quoted","string.template"],"settings":{"foreground":"#FAB795E6"}},{"scope":"string.regexp","settings":{"foreground":"#F09483E6"}},{"scope":"string.other.link","settings":{"foreground":"#F09483E6"}},{"scope":"support","settings":{"foreground":"#FAC29AE6"}},{"scope":"support.function","settings":{"foreground":"#25B0BCE6"}},{"scope":"support.variable","settings":{"foreground":"#E95678E6"}},{"scope":["support.type.property-name","meta.object-literal.key"],"settings":{"foreground":"#E95678E6"}},{"scope":"support.type.property-name.css","settings":{"foreground":"#BBBBBB"}},{"scope":["variable.language"],"settings":{"fontStyle":"italic","foreground":"#FAC29AE6"}},{"scope":"variable.parameter","settings":{"fontStyle":"italic"}},{"scope":"string.template meta.embedded","settings":{"foreground":"#BBBBBB"}},{"scope":"punctuation.definition.tag","settings":{"fontStyle":"normal","foreground":"#E95678B3"}},{"scope":"punctuation.separator","settings":{"foreground":"#BBBBBB"}},{"scope":["punctuation.definition.template-expression","punctuation.quasi.element"],"settings":{"foreground":"#B877DBE6"}},{"scope":"punctuation.section.embedded","settings":{"foreground":"#B877DBE6"}},{"scope":"punctuation.definition.list","settings":{"foreground":"#F09483E6"}}],"type":"dark"}'));export{e as default};
@@ -0,0 +1,2 @@
1
+ var e,t,n=Object.defineProperty,s=(e,t,s)=>((e,t,s)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);import{t as r}from"./main-BJNMrnKc.js";let o=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function i(e){return Array.isArray(e)?function(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=i(e[n]);return t}(e):e instanceof RegExp?e:"object"==typeof e?function(e){let t={};for(let n in e)t[n]=i(e[n]);return t}(e):e}function a(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function c(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return 0===t?e:~t===e.length-1?c(e.substring(0,e.length-1)):e.substr(1+~t)}var l=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,u=class{static hasCaptures(e){return null!==e&&(l.lastIndex=0,l.test(e))}static replaceCaptures(e,t,n){return e.replace(l,(e,s,r,o)=>{let i=n[parseInt(s||r,10)];if(!i)return e;{let e=t.substring(i.start,i.end);for(;"."===e[0];)e=e.substring(1);switch(o){case"downcase":return e.toLowerCase();case"upcase":return e.toUpperCase();default:return e}}})}};function p(e,t){return e<t?-1:e>t?1:0}function d(e,t){if(null===e&&null===t)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,s=t.length;if(n===s){for(let s=0;s<n;s++){let n=p(e[s],t[s]);if(0!==n)return n}return 0}return n-s}function g(e){return!!/^#[0-9a-f]{6}$/i.test(e)||(!!/^#[0-9a-f]{8}$/i.test(e)||(!!/^#[0-9a-f]{3}$/i.test(e)||!!/^#[0-9a-f]{4}$/i.test(e)))}function f(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var m=class{constructor(e){s(this,"cache",/* @__PURE__ */new Map),this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},_=class{constructor(e,t,n){s(this,"_cachedMatchRoot",new m(e=>this._root.match(e))),this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(function(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],s=0;for(let r=0,o=t.length;r<o;r++){let e,o=t[r];if(!o.settings)continue;if("string"==typeof o.scope){let t=o.scope;t=t.replace(/^[,]+/,""),t=t.replace(/[,]+$/,""),e=t.split(",")}else e=Array.isArray(o.scope)?o.scope:[""];let i=-1;if("string"==typeof o.settings.fontStyle){i=0;let e=o.settings.fontStyle.split(" ");for(let t=0,n=e.length;t<n;t++){switch(e[t]){case"italic":i|=1;break;case"bold":i|=2;break;case"underline":i|=4;break;case"strikethrough":i|=8}}}let a=null;"string"==typeof o.settings.foreground&&g(o.settings.foreground)&&(a=o.settings.foreground);let c=null;"string"==typeof o.settings.background&&g(o.settings.background)&&(c=o.settings.background);for(let t=0,l=e.length;t<l;t++){let o=e[t].trim().split(" "),l=o[o.length-1],u=null;o.length>1&&(u=o.slice(0,o.length-1),u.reverse()),n[s++]=new S(l,u,r,i,a,c)}}return n}(e),t)}static createFromParsedTheme(e,t){return function(e,t){e.sort((e,t)=>{let n=p(e.scope,t.scope);return 0!==n?n:(n=d(e.parentScopes,t.parentScopes),0!==n?n:e.index-t.index)});let n=0,s="#000000",r="#ffffff";for(;e.length>=1&&""===e[0].scope;){let t=e.shift();-1!==t.fontStyle&&(n=t.fontStyle),null!==t.foreground&&(s=t.foreground),null!==t.background&&(r=t.background)}let o=new C(t),i=new k(n,o.getId(s),o.getId(r)),a=new v(new A(0,null,-1,0,0),[]);for(let c=0,l=e.length;c<l;c++){let t=e[c];a.insert(0,t.scope,t.parentScopes,t.fontStyle,o.getId(t.foreground),o.getId(t.background))}return new _(o,i,a)}(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(null===e)return this._defaults;const t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>function(e,t){if(0===t.length)return!0;for(let n=0;n<t.length;n++){let s=t[n],r=!1;if(">"===s){if(n===t.length-1)return!1;s=t[++n],r=!0}for(;e&&!b(e.scopeName,s);){if(r)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}(e.parent,t.parentScopes));return n?new k(n.fontStyle,n.foreground,n.background):null}},y=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(const s of n)t=new e(t,s);return t}static from(...t){let n=null;for(let s=0;s<t.length;s++)n=new e(n,t[s]);return n}push(t){return new e(this,t)}getSegments(){let e=this;const t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e||null!==this.parent&&this.parent.extends(e)}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function b(e,t){return t===e||e.startsWith(t)&&"."===e[t.length]}var k=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};var S=class{constructor(e,t,n,s,r,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=s,this.foreground=r,this.background=o}},w=/* @__PURE__ */(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(w||{});var C=class{constructor(e){if(s(this,"_isFrozen"),s(this,"_lastColorId"),s(this,"_id2color"),s(this,"_color2id"),this._lastColorId=0,this._id2color=[],this._color2id=/* @__PURE__ */Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(null===e)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},N=Object.freeze([]),A=class e{constructor(e,t,n,r,o){s(this,"scopeDepth"),s(this,"parentScopes"),s(this,"fontStyle"),s(this,"foreground"),s(this,"background"),this.scopeDepth=e,this.parentScopes=t||N,this.fontStyle=n,this.foreground=r,this.background=o}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,-1!==t&&(this.fontStyle=t),0!==n&&(this.foreground=n),0!==s&&(this.background=s)}},v=class e{constructor(e,t=[],n={}){s(this,"_rulesWithParentScopes"),this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,s=0;for(;">"===e.parentScopes[n]&&n++,">"===t.parentScopes[s]&&s++,!(n>=e.parentScopes.length||s>=t.parentScopes.length);){const r=t.parentScopes[s].length-e.parentScopes[n].length;if(0!==r)return r;n++,s++}return t.parentScopes.length-e.parentScopes.length}match(t){if(""!==t){let e,n,s=t.indexOf(".");if(-1===s?(e=t,n=""):(e=t.substring(0,s),n=t.substring(s+1)),this._children.hasOwnProperty(e))return this._children[e].match(n)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,s,r,o,i){if(""===n)return void this._doInsertHere(t,s,r,o,i);let a,c,l,u=n.indexOf(".");-1===u?(a=n,c=""):(a=n.substring(0,u),c=n.substring(u+1)),this._children.hasOwnProperty(a)?l=this._children[a]:(l=new e(this._mainRule.clone(),A.cloneArr(this._rulesWithParentScopes)),this._children[a]=l),l.insert(t+1,c,s,r,o,i)}_doInsertHere(e,t,n,s,r){if(null!==t){for(let o=0,i=this._rulesWithParentScopes.length;o<i;o++){let i=this._rulesWithParentScopes[o];if(0===d(i.parentScopes,t))return void i.acceptOverwrite(e,n,s,r)}-1===n&&(n=this._mainRule.fontStyle),0===s&&(s=this._mainRule.foreground),0===r&&(r=this._mainRule.background),this._rulesWithParentScopes.push(new A(e,t,n,s,r))}else this._mainRule.acceptOverwrite(e,n,s,r)}},P=class e{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(t){const n=e.getLanguageId(t),s=e.getTokenType(t),r=e.getFontStyle(t),o=e.getForeground(t),i=e.getBackground(t);console.log({languageId:n,tokenType:s,fontStyle:r,foreground:o,background:i})}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(768&e)>>>8}static containsBalancedBrackets(e){return!!(1024&e)}static getFontStyle(e){return(30720&e)>>>11}static getForeground(e){return(16744448&e)>>>15}static getBackground(e){return(4278190080&e)>>>24}static set(t,n,s,r,o,i,a){let c=e.getLanguageId(t),l=e.getTokenType(t),u=e.containsBalancedBrackets(t)?1:0,p=e.getFontStyle(t),d=e.getForeground(t),g=e.getBackground(t);return 0!==n&&(c=n),8!==s&&(l=s),null!==r&&(u=r?1:0),-1!==o&&(p=o),0!==i&&(d=i),0!==a&&(g=a),(c|l<<8|u<<10|p<<11|d<<15|g<<24)>>>0}};function I(e){return e}function R(e,t){const n=[],s=function(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const s=n[0];return n=t.exec(e),s}}}(e);let r=s.next();for(;null!==r;){let e=0;if(2===r.length&&":"===r.charAt(1)){switch(r.charAt(0)){case"R":e=1;break;case"L":e=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let t=i();if(n.push({matcher:t,priority:e}),","!==r)break;r=s.next()}return n;function o(){if("-"===r){r=s.next();const e=o();return t=>!!e&&!e(t)}if("("===r){r=s.next();const e=function(){const e=[];let t=i();for(;t&&(e.push(t),"|"===r||","===r);){do{r=s.next()}while("|"===r||","===r);t=i()}return t=>e.some(e=>e(t))}();return")"===r&&(r=s.next()),e}if(T(r)){const e=[];do{e.push(r),r=s.next()}while(T(r));return n=>t(e,n)}return null}function i(){const e=[];let t=o();for(;t;)e.push(t),t=o();return t=>e.every(e=>e(t))}}function T(e){return!!e&&!!e.match(/[\w\.:]+/)}function L(e){"function"==typeof e.dispose&&e.dispose()}var x=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},G=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},E=class{constructor(){s(this,"_references",[]),s(this,"_seenReferenceKeys",/* @__PURE__ */new Set),s(this,"visitedRule",/* @__PURE__ */new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},$=class{constructor(e,t){s(this,"seenFullScopeRequests",/* @__PURE__ */new Set),s(this,"seenPartialScopeRequests",/* @__PURE__ */new Set),s(this,"Q"),this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new x(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new E;for(const n of e)B(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof x){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 B(e,t,n,s){const r=n.lookup(e.scopeName);if(!r){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=n.lookup(t);e instanceof x?O({baseGrammar:o,selfGrammar:r},s):M(e.ruleName,{baseGrammar:o,selfGrammar:r,repository:r.repository},s);const i=n.injections(e.scopeName);if(i)for(const a of i)s.add(new x(a))}function M(e,t,n){if(t.repository&&t.repository[e]){j([t.repository[e]],t,n)}}function O(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&j(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&j(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function j(e,t,n){for(const s of e){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const e=s.repository?a({},t.repository,s.repository):t.repository;Array.isArray(s.patterns)&&j(s.patterns,{...t,repository:e},n);const r=s.include;if(!r)continue;const o=z(r);switch(o.kind){case 0:O({...t,selfGrammar:t.baseGrammar},n);break;case 1:O(t,n);break;case 2:M(o.ruleName,{...t,repository:e},n);break;case 3:case 4:const s=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(s){const r={baseGrammar:t.baseGrammar,selfGrammar:s,repository:e};4===o.kind?M(o.ruleName,r,n):O(r,n)}else 4===o.kind?n.add(new G(o.scopeName,o.ruleName)):n.add(new x(o.scopeName))}}}var F=class{constructor(){s(this,"kind",0)}},W=class{constructor(){s(this,"kind",1)}},D=class{constructor(e){s(this,"kind",2),this.ruleName=e}},q=class{constructor(e){s(this,"kind",3),this.scopeName=e}},U=class{constructor(e,t){s(this,"kind",4),this.scopeName=e,this.ruleName=t}};function z(e){if("$base"===e)return new F;if("$self"===e)return new W;const t=e.indexOf("#");if(-1===t)return new q(e);if(0===t)return new D(e.substring(1));{const n=e.substring(0,t),s=e.substring(t+1);return new U(n,s)}}var H=/\\(\d+)/,K=/\\(\d+)/g;var J=class{constructor(e,t,n,r){s(this,"$location"),s(this,"id"),s(this,"_nameIsCapturing"),s(this,"_name"),s(this,"_contentNameIsCapturing"),s(this,"_contentName"),this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=u.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=u.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${c(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return this._nameIsCapturing&&null!==this._name&&null!==e&&null!==t?u.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?u.replaceCaptures(this._contentName,e,t):this._contentName}},Q=class extends J{constructor(e,t,n,r,o){super(e,t,n,r),s(this,"retokenizeCapturedWithRuleId"),this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,s){throw new Error("Not supported!")}},Y=class extends J{constructor(e,t,n,r,o){super(e,t,n,null),s(this,"_match"),s(this,"captures"),s(this,"_cachedCompiledPatterns"),this._match=new te(r,this.id),this.captures=o,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ne,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},V=class extends J{constructor(e,t,n,r,o){super(e,t,n,r),s(this,"hasMissingPatterns"),s(this,"patterns"),s(this,"_cachedCompiledPatterns"),this.patterns=o.patterns,this.hasMissingPatterns=o.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns){e.getRule(n).collectPatterns(e,t)}}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ne,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},X=class extends J{constructor(e,t,n,r,o,i,a,c,l,u){super(e,t,n,r),s(this,"_begin"),s(this,"beginCaptures"),s(this,"_end"),s(this,"endHasBackReferences"),s(this,"endCaptures"),s(this,"applyEndPatternLast"),s(this,"hasMissingPatterns"),s(this,"patterns"),s(this,"_cachedCompiledPatterns"),this._begin=new te(o,this.id),this.beginCaptures=i,this._end=new te(a||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=c,this.applyEndPatternLast=l||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,s){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,s)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ne;for(const t of this.patterns){e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Z=class extends J{constructor(e,t,n,r,o,i,a,c,l){super(e,t,n,r),s(this,"_begin"),s(this,"beginCaptures"),s(this,"whileCaptures"),s(this,"_while"),s(this,"whileHasBackReferences"),s(this,"hasMissingPatterns"),s(this,"patterns"),s(this,"_cachedCompiledPatterns"),s(this,"_cachedCompiledWhilePatterns"),this._begin=new te(o,this.id),this.beginCaptures=i,this.whileCaptures=c,this._while=new te(a,-2),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ne;for(const t of this.patterns){e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,s){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,s)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new ne,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},ee=class e{static createCaptureRule(e,t,n,s,r){return e.registerRule(e=>new Q(t,e,n,s,r))}static getCompiledRuleId(t,n,s){return t.id||n.registerRule(r=>{if(t.id=r,t.match)return new Y(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,s));if(void 0===t.begin){t.repository&&(s=a({},s,t.repository));let r=t.patterns;return void 0===r&&t.include&&(r=[{include:t.include}]),new V(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(r,n,s))}return t.while?new Z(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,s),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,s),e._compilePatterns(t.patterns,n,s)):new X(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,s),t.end,e._compileCaptures(t.endCaptures||t.captures,n,s),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,s))}),t.id}static _compileCaptures(t,n,s){let r=[];if(t){let o=0;for(const e in t){if("$vscodeTextmateLocation"===e)continue;const t=parseInt(e,10);t>o&&(o=t)}for(let e=0;e<=o;e++)r[e]=null;for(const i in t){if("$vscodeTextmateLocation"===i)continue;const o=parseInt(i,10);let a=0;t[i].patterns&&(a=e.getCompiledRuleId(t[i],n,s)),r[o]=e.createCaptureRule(n,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,a)}}return r}static _compilePatterns(t,n,s){let r=[];if(t)for(let o=0,i=t.length;o<i;o++){const i=t[o];let a=-1;if(i.include){const t=z(i.include);switch(t.kind){case 0:case 1:a=e.getCompiledRuleId(s[i.include],n,s);break;case 2:let r=s[t.ruleName];r&&(a=e.getCompiledRuleId(r,n,s));break;case 3:case 4:const o=t.scopeName,c=4===t.kind?t.ruleName:null,l=n.getExternalGrammar(o,s);if(l)if(c){let t=l.repository[c];t&&(a=e.getCompiledRuleId(t,n,l.repository))}else a=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}else a=e.getCompiledRuleId(i,n,s);if(-1!==a){const e=n.getRule(a);let t=!1;if((e instanceof V||e instanceof X||e instanceof Z)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;r.push(a)}}return{patterns:r,hasMissingPatterns:(t?t.length:0)!==r.length}}},te=class e{constructor(e,t){if(s(this,"source"),s(this,"ruleId"),s(this,"hasAnchor"),s(this,"hasBackReferences"),s(this,"_anchorCache"),e&&"string"==typeof e){const t=e.length;let n=0,s=[],r=!1;for(let o=0;o<t;o++){if("\\"===e.charAt(o)&&o+1<t){const t=e.charAt(o+1);"z"===t?(s.push(e.substring(n,o)),s.push("$(?!\\n)(?<!\\n)"),n=o+2):"A"!==t&&"G"!==t||(r=!0),o++}}this.hasAnchor=r,0===n?this.source=e:(s.push(e.substring(n,t)),this.source=s.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,"string"==typeof this.source?this.hasBackReferences=H.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if("string"!=typeof this.source)throw new Error("This method should only be called if the source is a string");let n=t.map(t=>e.substring(t.start,t.end));return K.lastIndex=0,this.source.replace(K,(e,t)=>f(n[parseInt(t,10)]||""))}_buildAnchorCache(){if("string"!=typeof this.source)throw new Error("This method should only be called if the source is a string");let e,t,n,s,r=[],o=[],i=[],a=[];for(e=0,t=this.source.length;e<t;e++)n=this.source.charAt(e),r[e]=n,o[e]=n,i[e]=n,a[e]=n,"\\"===n&&e+1<t&&(s=this.source.charAt(e+1),"A"===s?(r[e+1]="￿",o[e+1]="￿",i[e+1]="A",a[e+1]="A"):"G"===s?(r[e+1]="￿",o[e+1]="G",i[e+1]="￿",a[e+1]="G"):(r[e+1]=s,o[e+1]=s,i[e+1]=s,a[e+1]=s),e++);return{A0_G0:r.join(""),A0_G1:o.join(""),A1_G0:i.join(""),A1_G1:a.join("")}}resolveAnchors(e,t){return this.hasAnchor&&this._anchorCache&&"string"==typeof this.source?e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0:this.source}},ne=class{constructor(){s(this,"_items"),s(this,"_hasAnchors"),s(this,"_cached"),s(this,"_anchorCache"),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(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new se(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let s=this._items.map(e=>e.resolveAnchors(t,n));return new se(e,s,this._items.map(e=>e.ruleId))}},se=class{constructor(e,t,n){s(this,"scanner"),this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}dispose(){"function"==typeof this.scanner.dispose&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join("\n")}findNextMatchSync(e,t,n){const s=this.scanner.findNextMatchSync(e,t,n);return s?{ruleId:this.rules[s.index],captureIndices:s.captureIndices}:null}},re=class{constructor(e,t){this.languageId=e,this.tokenType=t}},oe=(e=class{constructor(e,t){s(this,"_defaultAttributes"),s(this,"_embeddedLanguagesMatcher"),s(this,"_getBasicScopeAttributes",new m(e=>{const t=this._scopeToLanguage(e),n=this._toStandardTokenType(e);return new re(t,n)})),this._defaultAttributes=new re(e,8),this._embeddedLanguagesMatcher=new ie(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return null===t?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){const n=t.match(e.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 new Error("Unexpected match for standard token type!")}},s(e,"_NULL_SCOPE_METADATA",new re(0,0)),s(e,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),e),ie=class{constructor(e){if(s(this,"values"),s(this,"scopesRegExp"),0===e.length)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([e,t])=>f(e));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);return t?this.values.get(t[1]):void 0}};"undefined"!=typeof process&&process.env.VSCODE_TEXTMATE_DEBUG;var ae=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function ce(e,t,n,s,r,o,i,a){const c=t.content.length;let l=!1,u=-1;if(i){const i=function(e,t,n,s,r,o){let i=r.beginRuleCapturedEOL?0:-1;const a=[];for(let c=r;c;c=c.pop()){const t=c.getRule(e);t instanceof Z&&a.push({rule:t,stack:c})}for(let c=a.pop();c;c=a.pop()){const{ruleScanner:a,findOptions:l}=le(c.rule,e,c.stack.endRule,n,s===i),u=a.findNextMatchSync(t,s,l);if(!u){r=c.stack.pop();break}if(-2!==u.ruleId){r=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(o.produce(c.stack,u.captureIndices[0].start),ue(e,t,n,c.stack,o,c.rule.whileCaptures,u.captureIndices),o.produce(c.stack,u.captureIndices[0].end),i=u.captureIndices[0].end,u.captureIndices[0].end>s&&(s=u.captureIndices[0].end,n=!1))}return{stack:r,linePos:s,anchorPosition:i,isFirstLine:n}}(e,t,n,s,r,o);r=i.stack,s=i.linePos,n=i.isFirstLine,u=i.anchorPosition}const p=Date.now();for(;!l;){if(0!==a){if(Date.now()-p>a)return new ae(r,!0)}d()}return new ae(r,!1);function d(){const i=function(e,t,n,s,r,o){const i=function(e,t,n,s,r,o){const i=r.getRule(e),{ruleScanner:a,findOptions:c}=he(i,e,r.endRule,n,s===o),l=a.findNextMatchSync(t,s,c);if(l)return{captureIndices:l.captureIndices,matchedRuleId:l.ruleId};return null}(e,t,n,s,r,o),a=e.getInjections();if(0===a.length)return i;const c=function(e,t,n,s,r,o,i){let a,c=Number.MAX_VALUE,l=null,u=0;const p=o.contentNameScopesList.getScopeNames();for(let d=0,g=e.length;d<g;d++){const o=e[d];if(!o.matcher(p))continue;const g=t.getRule(o.ruleId),{ruleScanner:f,findOptions:m}=he(g,t,null,s,r===i),_=f.findNextMatchSync(n,r,m);if(!_)continue;const y=_.captureIndices[0].start;if(!(y>=c)&&(c=y,l=_.captureIndices,a=_.ruleId,u=o.priority,c===r))break}if(l)return{priorityMatch:-1===u,captureIndices:l,matchedRuleId:a};return null}(a,e,t,n,s,r,o);if(!c)return i;if(!i)return c;const l=i.captureIndices[0].start,u=c.captureIndices[0].start;if(u<l||c.priorityMatch&&u===l)return c;return i}(e,t,n,s,r,u);if(!i)return o.produce(r,c),void(l=!0);const a=i.captureIndices,p=i.matchedRuleId,d=!!(a&&a.length>0)&&a[0].end>s;if(-1===p){const i=r.getRule(e);o.produce(r,a[0].start),r=r.withContentNameScopesList(r.nameScopesList),ue(e,t,n,r,o,i.endCaptures,a),o.produce(r,a[0].end);const p=r;if(r=r.parent,u=p.getAnchorPos(),!d&&p.getEnterPos()===s)return r=p,o.produce(r,c),void(l=!0)}else{const i=e.getRule(p);o.produce(r,a[0].start);const g=r,f=i.getName(t.content,a),m=r.contentNameScopesList.pushAttributed(f,e);if(r=r.push(p,s,u,a[0].end===c,null,m,m),i instanceof X){const s=i;ue(e,t,n,r,o,s.beginCaptures,a),o.produce(r,a[0].end),u=a[0].end;const p=s.getContentName(t.content,a),f=m.pushAttributed(p,e);if(r=r.withContentNameScopesList(f),s.endHasBackReferences&&(r=r.withEndRule(s.getEndWithResolvedBackReferences(t.content,a))),!d&&g.hasSameRuleAs(r))return r=r.pop(),o.produce(r,c),void(l=!0)}else if(i instanceof Z){const s=i;ue(e,t,n,r,o,s.beginCaptures,a),o.produce(r,a[0].end),u=a[0].end;const p=s.getContentName(t.content,a),f=m.pushAttributed(p,e);if(r=r.withContentNameScopesList(f),s.whileHasBackReferences&&(r=r.withEndRule(s.getWhileWithResolvedBackReferences(t.content,a))),!d&&g.hasSameRuleAs(r))return r=r.pop(),o.produce(r,c),void(l=!0)}else{if(ue(e,t,n,r,o,i.captures,a),o.produce(r,a[0].end),r=r.pop(),!d)return r=r.safePop(),o.produce(r,c),void(l=!0)}}a[0].end>s&&(s=a[0].end,n=!1)}}function he(e,t,n,s,r){return{ruleScanner:e.compileAG(t,n,s,r),findOptions:0}}function le(e,t,n,s,r){return{ruleScanner:e.compileWhileAG(t,n,s,r),findOptions:0}}function ue(e,t,n,s,r,o,i){if(0===o.length)return;const a=t.content,c=Math.min(o.length,i.length),l=[],u=i[0].end;for(let p=0;p<c;p++){const t=o[p];if(null===t)continue;const c=i[p];if(0===c.length)continue;if(c.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=c.start;)r.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?r.produceFromScopes(l[l.length-1].scopes,c.start):r.produce(s,c.start),t.retokenizeCapturedWithRuleId){const o=t.getName(a,i),l=s.contentNameScopesList.pushAttributed(o,e),u=t.getContentName(a,i),p=l.pushAttributed(u,e),d=s.push(t.retokenizeCapturedWithRuleId,c.start,-1,!1,null,l,p),g=e.createOnigString(a.substring(0,c.end));ce(e,g,n&&0===c.start,c.start,d,r,!1,0),L(g);continue}const d=t.getName(a,i);if(null!==d){const t=(l.length>0?l[l.length-1].scopes:s.contentNameScopesList).pushAttributed(d,e);l.push(new pe(t,c.end))}}for(;l.length>0;)r.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var pe=class{constructor(e,t){s(this,"scopes"),s(this,"endPos"),this.scopes=e,this.endPos=t}};function de(e,t,n,s,r){const o=R(t,ge),i=ee.getCompiledRuleId(n,s,r.repository);for(const a of o)e.push({debugSelector:t,matcher:a.matcher,ruleId:i,grammar:r,priority:a.priority})}function ge(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let s=n;s<t.length;s++)if(fe(t[s],e))return n=s+1,!0;return!1})}function fe(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&"."===e[n]}var me=class{constructor(e,t,n,r,o,i,a,c){if(s(this,"_rootId"),s(this,"_lastRuleId"),s(this,"_ruleId2desc"),s(this,"_includedGrammars"),s(this,"_grammarRepository"),s(this,"_grammar"),s(this,"_injections"),s(this,"_basicScopeAttributesProvider"),s(this,"_tokenTypeMatchers"),this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=c,this._basicScopeAttributesProvider=new oe(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=a,this._grammar=_e(t,null),this._injections=null,this._tokenTypeMatchers=[],o)for(const s of Object.keys(o)){const e=R(s,ge);for(const t of e)this._tokenTypeMatchers.push({matcher:t.matcher,type:o[s]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e=e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),t=[],n=this._rootScopeName,s=e(n);if(s){const e=s.injections;if(e)for(let n in e)de(t,n,e[n],this,s);const r=this._grammarRepository.injections(n);r&&r.forEach(e=>{const n=this.getExternalGrammar(e);if(n){const e=n.injectionSelector;e&&de(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return null===this._injections&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=_e(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const s=this._tokenize(e,t,!1,n);return{tokens:s.lineTokens.getResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}tokenizeLine2(e,t,n=0){const s=this._tokenize(e,t,!0,n);return{tokens:s.lineTokens.getBinaryResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}_tokenize(e,t,n,s){let r;if(-1===this._rootId&&(this._rootId=ee.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==be.NULL)r=!1,t.reset();else{r=!0;const e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),s=P.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),o=this.getRule(this._rootId).getName(null,null);let i;i=o?ye.createRootAndLookUpScopeName(o,s,this):ye.createRoot("unknown",s),t=new be(null,this._rootId,-1,-1,!1,null,i,i)}e+="\n";const o=this.createOnigString(e),i=o.content.length,a=new Se(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=ce(this,o,r,0,t,a,!0,s);return L(o),{lineLength:i,lineTokens:a,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function _e(e,t){return(e=i(e)).repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var ye=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let s=t,r=t?.scopePath??null;for(const o of n)r=y.push(r,o.scopeNames),s=new e(s,r,o.encodedTokenAttributes);return s}static createRoot(t,n){return new e(null,new y(null,t),n)}static createRootAndLookUpScopeName(t,n,s){const r=s.getMetadataForScope(t),o=new y(null,t),i=s.themeProvider.themeMatch(o),a=e.mergeAttributes(n,r,i);return new e(null,o,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return e.equals(this,t)}static equals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}}static mergeAttributes(e,t,n){let s=-1,r=0,o=0;return null!==n&&(s=n.fontStyle,r=n.foregroundId,o=n.backgroundId),P.set(e,t.languageId,t.tokenType,null,s,r,o)}pushAttributed(t,n){if(null===t)return this;if(-1===t.indexOf(" "))return e._pushAttributed(this,t,n);const s=t.split(/ /g);let r=this;for(const o of s)r=e._pushAttributed(r,o,n);return r}static _pushAttributed(t,n,s){const r=s.getMetadataForScope(n),o=t.scopePath.push(n),i=s.themeProvider.themeMatch(o),a=e.mergeAttributes(t.tokenAttributes,r,i);return new e(t,o,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},be=(t=class{constructor(e,t,n,r,o,i,a,c){s(this,"_stackElementBrand"),s(this,"_enterPos"),s(this,"_anchorPos"),s(this,"depth"),this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=a,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}equals(e){return null!==e&&t._equals(this,e)}static _equals(e,t){return e===t||!!this._structuralEquals(e,t)&&ye.equals(e.contentNameScopesList,t.contentNameScopesList)}static _structuralEquals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){t._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,s,r,o,i,a){return new t(this,e,n,s,r,o,i,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new t(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId: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){const s=ye.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new t(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,ye.fromExtension(s,n.contentNameScopesList))}},s(t,"NULL",new t(null,0,0,0,!1,null,null,null)),t),ke=class{constructor(e,t){s(this,"balancedBracketScopes"),s(this,"unbalancedBracketScopes"),s(this,"allowAny",!1),this.balancedBracketScopes=e.flatMap(e=>"*"===e?(this.allowAny=!0,[]):R(e,ge).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>R(e,ge).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&0===this.unbalancedBracketScopes.length}get matchesNever(){return 0===this.balancedBracketScopes.length&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},Se=class{constructor(e,t,n,r){s(this,"_emitBinaryTokens"),s(this,"_lineText"),s(this,"_tokens"),s(this,"_binaryTokens"),s(this,"_lastTokenEndIndex"),s(this,"_tokenTypeOverrides"),this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const t=e?.getScopeNames()??[];for(const e of this._tokenTypeOverrides)e.matcher(t)&&(n=P.set(n,0,I(e.type),null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(t))}return s&&(n=P.set(n,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n?void(this._lastTokenEndIndex=t):(this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),void(this._lastTokenEndIndex=t))}const n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),0===this._tokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let s=0,r=this._binaryTokens.length;s<r;s++)n[s]=this._binaryTokens[s];return n}},we=class{constructor(e,t){s(this,"_grammars",/* @__PURE__ */new Map),s(this,"_rawGrammars",/* @__PURE__ */new Map),s(this,"_injectionGrammars",/* @__PURE__ */new Map),s(this,"_theme"),this._onigLib=t,this._theme=e}dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,s,r){if(!this._grammars.has(e)){let o=this._rawGrammars.get(e);if(!o)return null;this._grammars.set(e,function(e,t,n,s,r,o,i,a){return new me(e,t,n,s,r,o,i,a)}(e,o,t,n,s,r,this,this._onigLib))}return this._grammars.get(e)}},Ce=class{constructor(e){s(this,"_options"),s(this,"_syncRegistry"),s(this,"_ensureGrammarCache"),this._options=e,this._syncRegistry=new we(_.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=/* @__PURE__ */new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(_.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new ke(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,s,r){const o=new $(this._syncRegistry,e);for(;o.Q.length>0;)o.Q.map(e=>this._loadSingleGrammar(e.scopeName)),o.processQueue();return this._grammarForScopeName(e,t,n,s,r)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const t=this._options.loadGrammar(e);if(t){const n="function"==typeof this._options.getInjections?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,s=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,s)}_grammarForScopeName(e,t=0,n=null,s=null,r=null){return this._syncRegistry.grammarForScopeName(e,t,n,s,r)}},Ne=be.NULL;function Ae(e,t){const n="string"==typeof e?{}:{...e.colorReplacements},s="string"==typeof e?e:e.name;for(const[r,o]of Object.entries(t?.colorReplacements||{}))"string"==typeof o?n[r]=o:r===s&&Object.assign(n,o);return n}function ve(e,t){return e&&t?.[e?.toLowerCase()]||e}function Pe(e){return Array.isArray(e)?e:[e]}async function Ie(e){return Promise.resolve("function"==typeof e?e():e).then(e=>e.default||e)}function Re(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Te(e){return"ansi"===e||Re(e)}function Le(e){return"none"===e}function xe(e){return Le(e)}function Ge(e,t){var n;if(!t)return e;e.properties||(e.properties={}),(n=e.properties).class||(n.class=[]),"string"==typeof e.properties.class&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const s=Array.isArray(t)?t:t.split(/\s+/g);for(const r of s)r&&!e.properties.class.includes(r)&&e.properties.class.push(r);return e}function Ee(e,t=!1){if(0===e.length)return[["",0]];const n=e.split(/(\r?\n)/g);let s=0;const r=[];for(let o=0;o<n.length;o+=2){const e=t?n[o]+(n[o+1]||""):n[o];r.push([e,s]),s+=n[o].length,s+=n[o+1]?.length||0}return r}function $e(e){const t=Ee(e,!0).map(([e])=>e);return{lines:t,indexToPos:function(n){if(n===e.length)return{line:t.length-1,character:t[t.length-1].length};let s=n,r=0;for(const e of t){if(s<e.length)break;s-=e.length,r++}return{line:r,character:s}},posToIndex:function(e,n){let s=0;for(let r=0;r<e;r++)s+=t[r].length;return s+=n,s}}}const Be="light-dark()",Me=["color","background-color"];function Oe(e,t){let n=0;const s=[];for(const r of t)r>n&&s.push({...e,content:e.content.slice(n,r),offset:e.offset+n}),n=r;return n<e.content.length&&s.push({...e,content:e.content.slice(n),offset:e.offset+n}),s}function je(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{const t=n.filter(t=>e.offset<t&&t<e.offset+e.content.length).map(t=>t-e.offset).sort((e,t)=>e-t);return t.length?Oe(e,t):e})):e}function Fe(e,t,n,s,r="css-vars"){const i={content:e.content,explanation:e.explanation,offset:e.offset},a=t.map(t=>We(e.variants[t])),c=new Set(a.flatMap(e=>Object.keys(e))),l={},u=(e,s)=>{const r="color"===s?"":"background-color"===s?"-bg":`-${s}`;return n+t[e]+("color"===s?"":r)};return a.forEach((e,n)=>{for(const i of c){const c=e[i]||"inherit";if(0===n&&s&&Me.includes(i))if(s===Be&&a.length>1){const e=t.findIndex(e=>"light"===e),s=t.findIndex(e=>"dark"===e);if(-1===e||-1===s)throw new o('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const p=a[e][i]||"inherit",d=a[s][i]||"inherit";l[i]=`light-dark(${p}, ${d})`,"css-vars"===r&&(l[u(n,i)]=c)}else l[i]=c;else"css-vars"===r&&(l[u(n,i)]=c)}}),i.htmlStyle=l,i}function We(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&w.Italic&&(t["font-style"]="italic"),e.fontStyle&w.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&w.Underline&&n.push("underline"),e.fontStyle&w.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function De(e){return"string"==typeof e?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}const qe=/* @__PURE__ */new WeakMap;function Ue(e,t){qe.set(e,t)}function ze(e){return qe.get(e)}class He{constructor(...e){if(s(this,"_stacks",{}),s(this,"lang"),2===e.length){const[t,n]=e;this.lang=n,this._stacks=t}else{const[t,n,s]=e;this.lang=n,this._stacks={[s]:t}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,t){return new He(Object.fromEntries(Pe(t).map(e=>[e,Ne])),e)}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return function(e){const t=[],n=/* @__PURE__ */new Set;function s(e){if(n.has(e))return;n.add(e);const r=e?.nameScopesList?.scopeName;r&&t.push(r),e.parent&&s(e.parent)}return s(e),t}(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function Ke(){const e=/* @__PURE__ */new WeakMap;function t(t){if(!e.has(t.meta)){let n=function(e){if("number"==typeof e){if(e<0||e>t.source.length)throw new o(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...s.indexToPos(e),offset:e}}{const t=s.lines[e.line];if(void 0===t)throw new o(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${s.lines.length}`);let n=e.character;if(n<0&&(n=t.length+n),n<0||n>t.length)throw new o(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:n,offset:s.posToIndex(e.line,n)}}};const s=$e(t.source),r=(t.options.decorations||[]).map(e=>({...e,start:n(e.start),end:n(e.end)}));!function(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new o(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let s=t+1;s<e.length;s++){const t=e[s],r=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,i=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,a=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,c=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(r||i||a||c){if(r&&i)continue;if(a&&c)continue;if(a&&n.start.offset===n.end.offset)continue;if(i&&t.start.offset===t.end.offset)continue;throw new o(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}(r),e.set(t.meta,{decorations:r,converter:s,source:t.source})}return e.get(t.meta)}return{name:"shiki:decorations",tokens(e){if(!this.options.decorations?.length)return;return je(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;const n=t(this),s=Array.from(e.children).filter(e=>"element"===e.type&&"span"===e.tagName);if(s.length!==n.converter.lines.length)throw new o(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function r(e,t,n,r){const i=s[e];let c="",l=-1,u=-1;if(0===t&&(l=0),0===n&&(u=0),n===Number.POSITIVE_INFINITY&&(u=i.children.length),-1===l||-1===u)for(let s=0;s<i.children.length;s++)c+=Je(i.children[s]),-1===l&&c.length===t&&(l=s+1),-1===u&&c.length===n&&(u=s+1);if(-1===l)throw new o(`Failed to find start index for decoration ${JSON.stringify(r.start)}`);if(-1===u)throw new o(`Failed to find end index for decoration ${JSON.stringify(r.end)}`);const p=i.children.slice(l,u);if(r.alwaysWrap||p.length!==i.children.length)if(r.alwaysWrap||1!==p.length||"element"!==p[0].type){const e={type:"element",tagName:"span",properties:{},children:p};a(e,r,"wrapper"),i.children.splice(l,p.length,e)}else a(p[0],r,"token");else a(i,r,"line")}function i(e,t){s[e]=a(s[e],t,"line")}function a(e,t,n){const s=t.properties||{},r=t.transform||(e=>e);return e.tagName=t.tagName||"span",e.properties={...e.properties,...s,class:e.properties.class},t.properties?.class&&Ge(e,t.properties.class),e=r(e,n)||e}const c=[],l=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(const t of l){const{start:e,end:n}=t;if(e.line===n.line)r(e.line,e.character,n.character,t);else if(e.line<n.line){r(e.line,e.character,Number.POSITIVE_INFINITY,t);for(let s=e.line+1;s<n.line;s++)c.unshift(()=>i(s,t));r(n.line,0,n.character,t)}}c.forEach(e=>e())}}}function Je(e){return"text"===e.type?e.value:"element"===e.type?e.children.map(Je).join(""):""}const Qe=[
2
+ /* @__PURE__ */Ke()];function Ye(e){const t=function(e){const t=[],n=[],s=[];for(const r of e)switch(r.enforce){case"pre":t.push(r);break;case"post":n.push(r);break;default:s.push(r)}return{pre:t,post:n,normal:s}}(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...Qe]}var Ve=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Xe={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Ze(e,t){const n=e.indexOf("",t);if(-1!==n&&"["===e[n+1]){const t=e.indexOf("m",n);if(-1!==t)return{sequence:e.substring(n+2,t).split(";"),startPosition:n,position:t+1}}return{position:e.length}}function et(e){const t=e.shift();if("2"===t){const t=e.splice(0,3).map(e=>Number.parseInt(e));if(3!==t.length||t.some(e=>Number.isNaN(e)))return;return{type:"rgb",rgb:t}}if("5"===t){const t=e.shift();if(t)return{type:"table",index:Number(t)}}}function tt(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const s=Number.parseInt(n);if(!Number.isNaN(s))if(0===s)t.push({type:"resetAll"});else if(s<=9){Xe[s]&&t.push({type:"setDecoration",value:Xe[s]})}else if(s<=29){const e=Xe[s-20];e&&(t.push({type:"resetDecoration",value:e}),"dim"===e&&t.push({type:"resetDecoration",value:"bold"}))}else if(s<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Ve[s-30]}});else if(38===s){const n=et(e);n&&t.push({type:"setForegroundColor",value:n})}else if(39===s)t.push({type:"resetForegroundColor"});else if(s<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Ve[s-40]}});else if(48===s){const n=et(e);n&&t.push({type:"setBackgroundColor",value:n})}else 49===s?t.push({type:"resetBackgroundColor"}):53===s?t.push({type:"setDecoration",value:"overline"}):55===s?t.push({type:"resetDecoration",value:"overline"}):s>=90&&s<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Ve[s-90+8]}}):s>=100&&s<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Ve[s-100+8]}})}return t}var nt={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 st(e=nt){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,"0")).join("")}`}let s;function r(e){return function(){if(s)return s;s=[];for(let n=0;n<Ve.length;n++)s.push(t(Ve[n]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let r=0;r<6;r++)for(let o=0;o<6;o++)s.push(n([e[t],e[r],e[o]]));let r=8;for(let t=0;t<24;t++,r+=10)s.push(n([r,r,r]));return s}()[e]}return{value:function(e){switch(e.type){case"named":return t(e.name);case"rgb":return n(e.rgb);case"table":return r(e.index)}}}}const rt={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 ot(e,t,n){const s=Ae(e,n),r=Ee(t),o=st(Object.fromEntries(Ve.map(t=>{const n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`,s=e.colors?.[n];return[t,s||rt[t]]}))),i=function(){let e=null,t=null,n=/* @__PURE__ */new Set;return{parse(s){const r=[];let o=0;do{const i=Ze(s,o),a=i.sequence?s.substring(o,i.startPosition):s.substring(o);if(a.length>0&&r.push({value:a,foreground:e,background:t,decorations:new Set(n)}),i.sequence){const s=tt(i.sequence);for(const r of s)"resetAll"===r.type?(e=null,t=null,n.clear()):"resetForegroundColor"===r.type?e=null:"resetBackgroundColor"===r.type?t=null:"resetDecoration"===r.type&&n.delete(r.value);for(const r of s)"setForegroundColor"===r.type?e=r.value:"setBackgroundColor"===r.type?t=r.value:"setDecoration"===r.type&&n.add(r.value)}o=i.position}while(o<s.length);return r}}}();return r.map(t=>i.parse(t[0]).map(n=>{let r,i;n.decorations.has("reverse")?(r=n.background?o.value(n.background):e.bg,i=n.foreground?o.value(n.foreground):e.fg):(r=n.foreground?o.value(n.foreground):e.fg,i=n.background?o.value(n.background):void 0),r=ve(r,s),i=ve(i,s),n.decorations.has("dim")&&(r=function(e){const t=e.match(/#([0-9a-f]{3,8})/i);if(t){const e=t[1];if(8===e.length){const t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${e.slice(0,6)}${t}`}if(6===e.length)return`#${e}80`;if(4===e.length){const t=e[0],n=e[1],s=e[2],r=e[3];return`#${t}${t}${n}${n}${s}${s}${Math.round(Number.parseInt(`${r}${r}`,16)/2).toString(16).padStart(2,"0")}`}if(3===e.length){const t=e[0],n=e[1],s=e[2];return`#${t}${t}${n}${n}${s}${s}80`}}const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}(r));let a=w.None;return n.decorations.has("bold")&&(a|=w.Bold),n.decorations.has("italic")&&(a|=w.Italic),n.decorations.has("underline")&&(a|=w.Underline),n.decorations.has("strikethrough")&&(a|=w.Strikethrough),{content:n.value,offset:t[1],color:r,bgColor:i,fontStyle:a}}))}function it(e,t,n={}){const{theme:s=e.getLoadedThemes()[0]}=n,r=e.resolveLangAlias(n.lang||"text");if(Re(r)||Le(s))return Ee(t).map(e=>[{content:e[0],offset:e[1]}]);const{theme:i,colorMap:a}=e.setTheme(s);if("ansi"===r)return ot(i,t,n);const c=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==c.name)throw new o(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${c.name}"`);if(!n.grammarState.themes.includes(i.name))throw new o(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return at(t,c,i,a,n)}function at(e,t,n,s,r){const o=ct(e,t,n,s,r),i=new He(o.stateStack,t.name,n.name);return Ue(o.tokens,i),o.tokens}function ct(e,t,n,s,r){const i=Ae(n,r),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:c=500}=r,l=Ee(e);let u=r.grammarState?function(e,t){if(!(e instanceof He))throw new o("Invalid grammar state");return e.getInternalStack(t)}(r.grammarState,n.name)??Ne:null!=r.grammarContextCode?ct(r.grammarContextCode,t,n,s,{...r,grammarState:void 0,grammarContextCode:void 0}).stateStack:Ne,p=[];const d=[];for(let o=0,g=l.length;o<g;o++){const[e,g]=l[o];if(""===e){p=[],d.push([]);continue}if(a>0&&e.length>=a){p=[],d.push([{content:e,offset:g,color:"",fontStyle:0}]);continue}let f,m,_;r.includeExplanation&&(f=t.tokenizeLine(e,u,c),m=f.tokens,_=0);const y=t.tokenizeLine2(e,u,c),b=y.tokens.length/2;for(let t=0;t<b;t++){const o=y.tokens[2*t],a=t+1<b?y.tokens[2*t+2]:e.length;if(o===a)continue;const c=y.tokens[2*t+1],l=ve(s[P.getForeground(c)],i),u=P.getFontStyle(c),d={content:e.substring(o,a),offset:g+o,color:l,fontStyle:u};if(r.includeExplanation){const t=[];if("scopeName"!==r.includeExplanation)for(const e of n.settings){let n;switch(typeof e.scope){case"string":n=e.scope.split(/,/).map(e=>e.trim());break;case"object":n=e.scope;break;default:continue}t.push({settings:e,selectors:n.map(e=>e.split(/ /))})}d.explanation=[];let s=0;for(;o+s<a;){const n=m[_],o=e.substring(n.startIndex,n.endIndex);s+=o.length,d.explanation.push({content:o,scopes:"scopeName"===r.includeExplanation?ht(n.scopes):lt(t,n.scopes)}),_+=1}}p.push(d)}d.push(p),p=[],u=y.ruleStack}return{tokens:d,stateStack:u}}function ht(e){return e.map(e=>({scopeName:e}))}function lt(e,t){const n=[];for(let s=0,r=t.length;s<r;s++){const r=t[s];n[s]={scopeName:r,themeMatches:dt(e,r,t.slice(0,s))}}return n}function ut(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function pt(e,t,n){if(!ut(e[e.length-1],t))return!1;let s=e.length-2,r=n.length-1;for(;s>=0&&r>=0;)ut(e[s],n[r])&&(s-=1),r-=1;return-1===s}function dt(e,t,n){const s=[];for(const{selectors:r,settings:o}of e)for(const e of r)if(pt(e,t,n)){s.push(o);break}return s}function gt(e,t,n){const s=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),r=s.map(s=>{const r=it(e,t,{...n,theme:s.theme});return{tokens:r,state:ze(r),theme:"string"==typeof s.theme?s.theme:s.theme.name}}),o=function(...e){const t=e.map(()=>[]),n=e.length;for(let s=0;s<e[0].length;s++){const r=e.map(e=>e[s]),o=t.map(()=>[]);t.forEach((e,t)=>e.push(o[t]));const i=r.map(()=>0),a=r.map(e=>e[0]);for(;a.every(e=>e);){const e=Math.min(...a.map(e=>e.content.length));for(let t=0;t<n;t++){const n=a[t];n.content.length===e?(o[t].push(n),i[t]+=1,a[t]=r[t][i[t]]):(o[t].push({...n,content:n.content.slice(0,e)}),a[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}(...r.map(e=>e.tokens)),i=o[0].map((e,t)=>e.map((e,r)=>{const i={content:e.content,variants:{},offset:e.offset};return"includeExplanation"in n&&n.includeExplanation&&(i.explanation=e.explanation),o.forEach((e,n)=>{const{content:o,explanation:a,offset:c,...l}=e[t][r];i.variants[s[n].color]=l}),i})),a=r[0].state?new He(Object.fromEntries(r.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),r[0].state.lang):void 0;return a&&Ue(i,a),i}function ft(e,t,n){let s,r,i,a,c,l;if("themes"in n){const{defaultColor:u="light",cssVariablePrefix:p="--shiki-",colorsRendering:d="css-vars"}=n,g=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===u?-1:t.color===u?1:0);if(0===g.length)throw new o("`themes` option must not be empty");const f=gt(e,t,n);if(l=ze(f),u&&Be!==u&&!g.find(e=>e.color===u))throw new o(`\`themes\` option must contain the defaultColor key \`${u}\``);const m=g.map(t=>e.getTheme(t.theme)),_=g.map(e=>e.color);i=f.map(e=>e.map(e=>Fe(e,_,p,u,d))),l&&Ue(i,l);const y=g.map(e=>Ae(e.theme,n));r=mt(g,m,y,p,u,"fg",d),s=mt(g,m,y,p,u,"bg",d),a=`shiki-themes ${m.map(e=>e.name).join(" ")}`,c=u?void 0:[r,s].join(";")}else{if(!("theme"in n))throw new o("Invalid options, either `theme` or `themes` must be provided");{const o=Ae(n.theme,n);i=it(e,t,n);const c=e.getTheme(n.theme);s=ve(c.bg,o),r=ve(c.fg,o),a=c.name,l=ze(i)}}return{tokens:i,fg:r,bg:s,themeName:a,rootStyle:c,grammarState:l}}function mt(e,t,n,s,r,i,a){return e.map((c,l)=>{const u=ve(t[l][i],n[l])||"inherit",p=`${s+c.color}${"bg"===i?"-bg":""}:${u}`;if(0===l&&r){if(r===Be&&e.length>1){const s=e.findIndex(e=>"light"===e.color),r=e.findIndex(e=>"dark"===e.color);if(-1===s||-1===r)throw new o('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${ve(t[s][i],n[s])||"inherit"}, ${ve(t[r][i],n[r])||"inherit"});${p}`}return u}return"css-vars"===a?p:null}).filter(e=>!!e).join(";")}function _t(e,t,n,s={meta:{},options:n,codeToHast:(t,n)=>_t(e,t,n),codeToTokens:(t,n)=>ft(e,t,n)}){let r=t;for(const f of Ye(n))r=f.preprocess?.call(s,r,n)||r;let{tokens:o,fg:i,bg:a,themeName:c,rootStyle:l,grammarState:u}=ft(e,r,n);const{mergeWhitespaces:p=!0,mergeSameStyleTokens:d=!1}=n;!0===p?o=function(e){return e.map(e=>{const t=[];let n,s="";return e.forEach((r,o)=>{const i=!(r.fontStyle&&(r.fontStyle&w.Underline||r.fontStyle&w.Strikethrough));i&&r.content.match(/^\s+$/)&&e[o+1]?(void 0===n&&(n=r.offset),s+=r.content):s?(i?t.push({...r,offset:n,content:s+r.content}):t.push({content:s,offset:n},r),n=void 0,s=""):t.push(r)}),t})}(o):"never"===p&&(o=function(e){return e.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;const t=e.content.match(/^(\s*)(.*?)(\s*)$/);if(!t)return e;const[,n,s,r]=t;if(!n&&!r)return e;const o=[{...e,offset:e.offset+n.length,content:s}];return n&&o.unshift({content:n,offset:e.offset}),r&&o.push({content:r,offset:e.offset+n.length+s.length}),o}))}(o)),d&&(o=function(e){return e.map(e=>{const t=[];for(const n of e){if(0===t.length){t.push({...n});continue}const e=t[t.length-1],s=De(e.htmlStyle||We(e)),r=De(n.htmlStyle||We(n)),o=e.fontStyle&&(e.fontStyle&w.Underline||e.fontStyle&w.Strikethrough),i=n.fontStyle&&(n.fontStyle&w.Underline||n.fontStyle&w.Strikethrough);o||i||s!==r?t.push({...n}):e.content+=n.content}return t})}(o));const g={...s,get source(){return r}};for(const f of Ye(n))o=f.tokens?.call(g,o)||o;return yt(o,{...n,fg:i,bg:a,themeName:c,rootStyle:!1!==n.rootStyle&&(n.rootStyle??l)},g,u)}function yt(e,t,n,s=ze(e)){const r=Ye(t),o=[],i={type:"root",children:[]},{structure:a="classic",tabindex:c="0"}=t,l={class:`shiki ${t.themeName||""}`};!1!==t.rootStyle&&(null!=t.rootStyle?l.style=t.rootStyle:l.style=`background-color:${t.bg};color:${t.fg}`),!1!==c&&null!=c&&(l.tabindex=c.toString());for(const[m,_]of Object.entries(t.meta||{}))m.startsWith("_")||(l[m]=_);let u={type:"element",tagName:"pre",properties:l,children:[],data:t.data},p={type:"element",tagName:"code",properties:{},children:o};const d=[],g={...n,structure:a,addClassToHast:Ge,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return i},get pre(){return u},get code(){return p},get lines(){return d}};if(e.forEach((e,t)=>{t&&("inline"===a?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):"classic"===a&&o.push({type:"text",value:"\n"}));let n={type:"element",tagName:"span",properties:{class:"line"},children:[]},s=0;for(const o of e){let e={type:"element",tagName:"span",properties:{...o.htmlAttrs},children:[{type:"text",value:o.content}]};const c=De(o.htmlStyle||We(o));c&&(e.properties.style=c);for(const i of r)e=i?.span?.call(g,e,t+1,s,n,o)||e;"inline"===a?i.children.push(e):"classic"===a&&n.children.push(e),s+=o.content.length}if("classic"===a){for(const e of r)n=e?.line?.call(g,n,t+1)||n;d.push(n),o.push(n)}else"inline"===a&&d.push(n)}),"classic"===a){for(const e of r)p=e?.code?.call(g,p)||p;u.children.push(p);for(const e of r)u=e?.pre?.call(g,u)||u;i.children.push(u)}else if("inline"===a){const e=[];let t={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const s of i.children)"element"===s.type&&"br"===s.tagName?(e.push(t),t={type:"element",tagName:"span",properties:{class:"line"},children:[]}):"element"!==s.type&&"text"!==s.type||t.children.push(s);e.push(t);let n={type:"element",tagName:"code",properties:{},children:e};for(const s of r)n=s?.code?.call(g,n)||n;i.children=[];for(let s=0;s<n.children.length;s++){s>0&&i.children.push({type:"element",tagName:"br",properties:{},children:[]});const e=n.children[s];"element"===e.type&&i.children.push(...e.children)}}let f=i;for(const m of r)f=m?.root?.call(g,f)||f;return s&&Ue(f,s),f}const bt=r;function kt(e,t,n){const s={meta:{},options:n,codeToHast:(t,n)=>_t(e,t,n),codeToTokens:(t,n)=>ft(e,t,n)};let r=bt(_t(e,t,n,s));for(const o of Ye(n))r=o.postprocess?.call(s,r,n)||r;return r}const St="#333333",wt="#bbbbbb",Ct="#fffffe",Nt="#1e1e1e",At="__shiki_resolved";function vt(e){if(e?.[At])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:n,fg:s}=t;if(!n||!s){const e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(s=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!s&&t?.colors?.["editor.foreground"]&&(s=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),s||(s="light"===t.type?St:wt),n||(n="light"===t.type?Ct:Nt),t.fg=s,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let r=0;const o=/* @__PURE__ */new Map;function i(e){if(o.has(e))return o.get(e);r+=1;const n=`#${r.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?i(e):(o.set(e,n),n)}t.settings=t.settings.map(e=>{const n=e.settings?.foreground&&!e.settings.foreground.startsWith("#"),s=e.settings?.background&&!e.settings.background.startsWith("#");if(!n&&!s)return e;const r={...e,settings:{...e.settings}};if(n){const n=i(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,r.settings.foreground=n}if(s){const n=i(e.settings.background);t.colorReplacements[n]=e.settings.background,r.settings.background=n}return r});for(const a of Object.keys(t.colors||{}))if(("editor.foreground"===a||"editor.background"===a||a.startsWith("terminal.ansi"))&&!t.colors[a]?.startsWith("#")){const e=i(t.colors[a]);t.colorReplacements[e]=t.colors[a],t.colors[a]=e}return Object.defineProperty(t,At,{enumerable:!1,writable:!1,value:!0}),t}async function Pt(e){return Array.from(new Set((await Promise.all(e.filter(e=>!Te(e)).map(async e=>await Ie(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function It(e){return(await Promise.all(e.map(async e=>xe(e)?null:vt(await Ie(e))))).filter(e=>!!e)}function Rt(e,t=3){t>3||console.trace(`[SHIKI DEPRECATE]: ${e}`)}class Tt extends Error{constructor(e){super(e),this.name="ShikiError"}}function Lt(e,t){if(!t)return e;if(t[e]){const n=/* @__PURE__ */new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new Tt(`Circular alias \`${Array.from(n).join(" -> ")} -> ${e}\``);n.add(e)}}return e}class xt extends Ce{constructor(e,t,n,r={}){super(e),s(this,"_resolvedThemes",/* @__PURE__ */new Map),s(this,"_resolvedGrammars",/* @__PURE__ */new Map),s(this,"_langMap",/* @__PURE__ */new Map),s(this,"_langGraph",/* @__PURE__ */new Map),s(this,"_textmateThemeCache",/* @__PURE__ */new WeakMap),s(this,"_loadedThemesCache",null),s(this,"_loadedLanguagesCache",null),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return"string"==typeof e?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const t=vt(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=_.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=Lt(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const n={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const s=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(s.name=e.name,this._resolvedGrammars.set(e.name,s),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(const r of t)this._resolvedGrammars.delete(r.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(r.scopeName),this._syncRegistry?._grammars?.delete(r.scopeName),this.loadLanguage(this._langMap.get(r.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const s of e)this.resolveEmbeddedLanguages(s);const t=Array.from(this._langGraph.entries()),n=t.filter(([e,t])=>!t);if(n.length){const e=t.filter(([e,t])=>{if(!t)return!1;const s=t.embeddedLanguages||t.embeddedLangs;return s?.some(e=>n.map(([e])=>e).includes(e))}).filter(e=>!n.includes(e));throw new Tt(`Missing languages ${n.map(([e])=>`\`${e}\``).join(", ")}, required by ${e.map(([e])=>`\`${e}\``).join(", ")}`)}for(const[s,r]of t)this._resolver.addLanguage(r);for(const[s,r]of t)this.loadLanguage(r)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[.../* @__PURE__ */new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);const t=e.embeddedLanguages??e.embeddedLangs;if(t)for(const n of t)this._langGraph.set(n,this._langMap.get(n))}}class Gt{constructor(e,t){s(this,"_langs",/* @__PURE__ */new Map),s(this,"_scopeToLang",/* @__PURE__ */new Map),s(this,"_injections",/* @__PURE__ */new Map),s(this,"_onigLib"),this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){const t=e.split(".");let n=[];for(let s=1;s<=t.length;s++){const e=t.slice(0,s).join(".");n=[...n,...this._injections.get(e)||[]]}return n}}let Et=0;function $t(e){Et+=1,!1!==e.warnings&&Et>=10&&Et%10==0&&console.warn(`[Shiki] ${Et} 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 t=!1;if(!e.engine)throw new Tt("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),s=(e.themes||[]).flat(1).map(vt),r=new Gt(e.engine,n),o=new xt(r,s,n,e.langAlias);let i;function a(e){if("none"===e)return{bg:"",fg:"",name:"none",settings:[],type:"dark"};u();const t=o.getTheme(e);if(!t)throw new Tt(`Theme \`${e}\` not found, you may need to load it first`);return t}function c(...e){u(),o.loadLanguages(e.flat(1))}function l(...e){u();for(const t of e.flat(1))o.loadTheme(t)}function u(){if(t)throw new Tt("Shiki instance has been disposed")}function p(){t||(t=!0,o.dispose(),Et-=1)}return{setTheme:function(e){u();const t=a(e);return i!==e&&(o.setTheme(t),i=e),{theme:t,colorMap:o.getColorMap()}},getTheme:a,getLanguage:function(e){u();const t=o.getGrammar("string"==typeof e?e:e.name);if(!t)throw new Tt(`Language \`${e}\` not found, you may need to load it first`);return t},getLoadedThemes:function(){return u(),o.getLoadedThemes()},getLoadedLanguages:function(){return u(),o.getLoadedLanguages()},resolveLangAlias:function(t){return Lt(t,e.langAlias)},loadLanguage:async function(...e){return c(await Pt(e))},loadLanguageSync:c,loadTheme:async function(...e){return u(),l(await It(e))},loadThemeSync:l,dispose:p,[Symbol.dispose]:p}}async function Bt(e){e.engine||Rt("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,s]=await Promise.all([It(e.themes||[]),Pt(e.langs||[]),e.engine]);return $t({...e,themes:t,langs:n,engine:s})}async function Mt(e){const t=await Bt(e);return{getLastGrammarState:(...e)=>function(...e){if(2===e.length)return ze(e[1]);const[t,n,s={}]=e,{lang:r="text",theme:i=t.getLoadedThemes()[0]}=s;if(Re(r)||Le(i))throw new o("Plain language does not have grammar state");if("ansi"===r)throw new o("ANSI language does not have grammar state");const{theme:a,colorMap:c}=t.setTheme(i),l=t.getLanguage(r);return new He(ct(n,l,a,c,s).stateStack,l.name,a.name)}(t,...e),codeToTokensBase:(e,n)=>it(t,e,n),codeToTokensWithThemes:(e,n)=>gt(t,e,n),codeToTokens:(e,n)=>ft(t,e,n),codeToHast:(e,n)=>_t(t,e,n),codeToHtml:(e,n)=>kt(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}export{o as ShikiError,Ge as addClassToHast,ve as applyColorReplacements,_t as codeToHast,kt as codeToHtml,ft as codeToTokens,it as codeToTokensBase,gt as codeToTokensWithThemes,Mt as createHighlighterCore,$e as createPositionConverter,Bt as createShikiInternal,$t as createShikiInternalSync,Fe as flatTokenVariants,We as getTokenStyleObject,bt as hastToHtml,Le as isNoneTheme,Re as isPlainLang,Te as isSpecialLang,xe as isSpecialTheme,Ie as normalizeGetter,vt as normalizeTheme,Ae as resolveColorReplacements,Ee as splitLines,Oe as splitToken,je as splitTokens,De as stringifyTokenStyle,Pe as toArray,ot as tokenizeAnsiWithTheme,at as tokenizeWithTheme,yt as tokensToHast,Ke as transformerDecorations,Rt as warnDeprecated};
@@ -0,0 +1,2 @@
1
+ var e,t,n=Object.defineProperty,s=(e,t,s)=>((e,t,s)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);import{t as r}from"./main-D38hv2hq.js";let o=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function i(e){return Array.isArray(e)?function(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=i(e[n]);return t}(e):e instanceof RegExp?e:"object"==typeof e?function(e){let t={};for(let n in e)t[n]=i(e[n]);return t}(e):e}function a(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function c(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return 0===t?e:~t===e.length-1?c(e.substring(0,e.length-1)):e.substr(1+~t)}var l=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,u=class{static hasCaptures(e){return null!==e&&(l.lastIndex=0,l.test(e))}static replaceCaptures(e,t,n){return e.replace(l,(e,s,r,o)=>{let i=n[parseInt(s||r,10)];if(!i)return e;{let e=t.substring(i.start,i.end);for(;"."===e[0];)e=e.substring(1);switch(o){case"downcase":return e.toLowerCase();case"upcase":return e.toUpperCase();default:return e}}})}};function p(e,t){return e<t?-1:e>t?1:0}function d(e,t){if(null===e&&null===t)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,s=t.length;if(n===s){for(let s=0;s<n;s++){let n=p(e[s],t[s]);if(0!==n)return n}return 0}return n-s}function g(e){return!!/^#[0-9a-f]{6}$/i.test(e)||(!!/^#[0-9a-f]{8}$/i.test(e)||(!!/^#[0-9a-f]{3}$/i.test(e)||!!/^#[0-9a-f]{4}$/i.test(e)))}function f(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var m=class{constructor(e){s(this,"cache",/* @__PURE__ */new Map),this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},_=class{constructor(e,t,n){s(this,"_cachedMatchRoot",new m(e=>this._root.match(e))),this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(function(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],s=0;for(let r=0,o=t.length;r<o;r++){let e,o=t[r];if(!o.settings)continue;if("string"==typeof o.scope){let t=o.scope;t=t.replace(/^[,]+/,""),t=t.replace(/[,]+$/,""),e=t.split(",")}else e=Array.isArray(o.scope)?o.scope:[""];let i=-1;if("string"==typeof o.settings.fontStyle){i=0;let e=o.settings.fontStyle.split(" ");for(let t=0,n=e.length;t<n;t++){switch(e[t]){case"italic":i|=1;break;case"bold":i|=2;break;case"underline":i|=4;break;case"strikethrough":i|=8}}}let a=null;"string"==typeof o.settings.foreground&&g(o.settings.foreground)&&(a=o.settings.foreground);let c=null;"string"==typeof o.settings.background&&g(o.settings.background)&&(c=o.settings.background);for(let t=0,l=e.length;t<l;t++){let o=e[t].trim().split(" "),l=o[o.length-1],u=null;o.length>1&&(u=o.slice(0,o.length-1),u.reverse()),n[s++]=new S(l,u,r,i,a,c)}}return n}(e),t)}static createFromParsedTheme(e,t){return function(e,t){e.sort((e,t)=>{let n=p(e.scope,t.scope);return 0!==n?n:(n=d(e.parentScopes,t.parentScopes),0!==n?n:e.index-t.index)});let n=0,s="#000000",r="#ffffff";for(;e.length>=1&&""===e[0].scope;){let t=e.shift();-1!==t.fontStyle&&(n=t.fontStyle),null!==t.foreground&&(s=t.foreground),null!==t.background&&(r=t.background)}let o=new C(t),i=new k(n,o.getId(s),o.getId(r)),a=new v(new A(0,null,-1,0,0),[]);for(let c=0,l=e.length;c<l;c++){let t=e[c];a.insert(0,t.scope,t.parentScopes,t.fontStyle,o.getId(t.foreground),o.getId(t.background))}return new _(o,i,a)}(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(null===e)return this._defaults;const t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>function(e,t){if(0===t.length)return!0;for(let n=0;n<t.length;n++){let s=t[n],r=!1;if(">"===s){if(n===t.length-1)return!1;s=t[++n],r=!0}for(;e&&!b(e.scopeName,s);){if(r)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}(e.parent,t.parentScopes));return n?new k(n.fontStyle,n.foreground,n.background):null}},y=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(const s of n)t=new e(t,s);return t}static from(...t){let n=null;for(let s=0;s<t.length;s++)n=new e(n,t[s]);return n}push(t){return new e(this,t)}getSegments(){let e=this;const t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e||null!==this.parent&&this.parent.extends(e)}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function b(e,t){return t===e||e.startsWith(t)&&"."===e[t.length]}var k=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};var S=class{constructor(e,t,n,s,r,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=s,this.foreground=r,this.background=o}},w=/* @__PURE__ */(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(w||{});var C=class{constructor(e){if(s(this,"_isFrozen"),s(this,"_lastColorId"),s(this,"_id2color"),s(this,"_color2id"),this._lastColorId=0,this._id2color=[],this._color2id=/* @__PURE__ */Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(null===e)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},N=Object.freeze([]),A=class e{constructor(e,t,n,r,o){s(this,"scopeDepth"),s(this,"parentScopes"),s(this,"fontStyle"),s(this,"foreground"),s(this,"background"),this.scopeDepth=e,this.parentScopes=t||N,this.fontStyle=n,this.foreground=r,this.background=o}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,-1!==t&&(this.fontStyle=t),0!==n&&(this.foreground=n),0!==s&&(this.background=s)}},v=class e{constructor(e,t=[],n={}){s(this,"_rulesWithParentScopes"),this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,s=0;for(;">"===e.parentScopes[n]&&n++,">"===t.parentScopes[s]&&s++,!(n>=e.parentScopes.length||s>=t.parentScopes.length);){const r=t.parentScopes[s].length-e.parentScopes[n].length;if(0!==r)return r;n++,s++}return t.parentScopes.length-e.parentScopes.length}match(t){if(""!==t){let e,n,s=t.indexOf(".");if(-1===s?(e=t,n=""):(e=t.substring(0,s),n=t.substring(s+1)),this._children.hasOwnProperty(e))return this._children[e].match(n)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,s,r,o,i){if(""===n)return void this._doInsertHere(t,s,r,o,i);let a,c,l,u=n.indexOf(".");-1===u?(a=n,c=""):(a=n.substring(0,u),c=n.substring(u+1)),this._children.hasOwnProperty(a)?l=this._children[a]:(l=new e(this._mainRule.clone(),A.cloneArr(this._rulesWithParentScopes)),this._children[a]=l),l.insert(t+1,c,s,r,o,i)}_doInsertHere(e,t,n,s,r){if(null!==t){for(let o=0,i=this._rulesWithParentScopes.length;o<i;o++){let i=this._rulesWithParentScopes[o];if(0===d(i.parentScopes,t))return void i.acceptOverwrite(e,n,s,r)}-1===n&&(n=this._mainRule.fontStyle),0===s&&(s=this._mainRule.foreground),0===r&&(r=this._mainRule.background),this._rulesWithParentScopes.push(new A(e,t,n,s,r))}else this._mainRule.acceptOverwrite(e,n,s,r)}},P=class e{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(t){const n=e.getLanguageId(t),s=e.getTokenType(t),r=e.getFontStyle(t),o=e.getForeground(t),i=e.getBackground(t);console.log({languageId:n,tokenType:s,fontStyle:r,foreground:o,background:i})}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(768&e)>>>8}static containsBalancedBrackets(e){return!!(1024&e)}static getFontStyle(e){return(30720&e)>>>11}static getForeground(e){return(16744448&e)>>>15}static getBackground(e){return(4278190080&e)>>>24}static set(t,n,s,r,o,i,a){let c=e.getLanguageId(t),l=e.getTokenType(t),u=e.containsBalancedBrackets(t)?1:0,p=e.getFontStyle(t),d=e.getForeground(t),g=e.getBackground(t);return 0!==n&&(c=n),8!==s&&(l=s),null!==r&&(u=r?1:0),-1!==o&&(p=o),0!==i&&(d=i),0!==a&&(g=a),(c|l<<8|u<<10|p<<11|d<<15|g<<24)>>>0}};function I(e){return e}function R(e,t){const n=[],s=function(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const s=n[0];return n=t.exec(e),s}}}(e);let r=s.next();for(;null!==r;){let e=0;if(2===r.length&&":"===r.charAt(1)){switch(r.charAt(0)){case"R":e=1;break;case"L":e=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let t=i();if(n.push({matcher:t,priority:e}),","!==r)break;r=s.next()}return n;function o(){if("-"===r){r=s.next();const e=o();return t=>!!e&&!e(t)}if("("===r){r=s.next();const e=function(){const e=[];let t=i();for(;t&&(e.push(t),"|"===r||","===r);){do{r=s.next()}while("|"===r||","===r);t=i()}return t=>e.some(e=>e(t))}();return")"===r&&(r=s.next()),e}if(T(r)){const e=[];do{e.push(r),r=s.next()}while(T(r));return n=>t(e,n)}return null}function i(){const e=[];let t=o();for(;t;)e.push(t),t=o();return t=>e.every(e=>e(t))}}function T(e){return!!e&&!!e.match(/[\w\.:]+/)}function L(e){"function"==typeof e.dispose&&e.dispose()}var x=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},G=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},E=class{constructor(){s(this,"_references",[]),s(this,"_seenReferenceKeys",/* @__PURE__ */new Set),s(this,"visitedRule",/* @__PURE__ */new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},$=class{constructor(e,t){s(this,"seenFullScopeRequests",/* @__PURE__ */new Set),s(this,"seenPartialScopeRequests",/* @__PURE__ */new Set),s(this,"Q"),this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new x(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new E;for(const n of e)B(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof x){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 B(e,t,n,s){const r=n.lookup(e.scopeName);if(!r){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=n.lookup(t);e instanceof x?O({baseGrammar:o,selfGrammar:r},s):M(e.ruleName,{baseGrammar:o,selfGrammar:r,repository:r.repository},s);const i=n.injections(e.scopeName);if(i)for(const a of i)s.add(new x(a))}function M(e,t,n){if(t.repository&&t.repository[e]){j([t.repository[e]],t,n)}}function O(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&j(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&j(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function j(e,t,n){for(const s of e){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const e=s.repository?a({},t.repository,s.repository):t.repository;Array.isArray(s.patterns)&&j(s.patterns,{...t,repository:e},n);const r=s.include;if(!r)continue;const o=z(r);switch(o.kind){case 0:O({...t,selfGrammar:t.baseGrammar},n);break;case 1:O(t,n);break;case 2:M(o.ruleName,{...t,repository:e},n);break;case 3:case 4:const s=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(s){const r={baseGrammar:t.baseGrammar,selfGrammar:s,repository:e};4===o.kind?M(o.ruleName,r,n):O(r,n)}else 4===o.kind?n.add(new G(o.scopeName,o.ruleName)):n.add(new x(o.scopeName))}}}var F=class{constructor(){s(this,"kind",0)}},W=class{constructor(){s(this,"kind",1)}},D=class{constructor(e){s(this,"kind",2),this.ruleName=e}},q=class{constructor(e){s(this,"kind",3),this.scopeName=e}},U=class{constructor(e,t){s(this,"kind",4),this.scopeName=e,this.ruleName=t}};function z(e){if("$base"===e)return new F;if("$self"===e)return new W;const t=e.indexOf("#");if(-1===t)return new q(e);if(0===t)return new D(e.substring(1));{const n=e.substring(0,t),s=e.substring(t+1);return new U(n,s)}}var H=/\\(\d+)/,K=/\\(\d+)/g;var J=class{constructor(e,t,n,r){s(this,"$location"),s(this,"id"),s(this,"_nameIsCapturing"),s(this,"_name"),s(this,"_contentNameIsCapturing"),s(this,"_contentName"),this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=u.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=u.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${c(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return this._nameIsCapturing&&null!==this._name&&null!==e&&null!==t?u.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?u.replaceCaptures(this._contentName,e,t):this._contentName}},Q=class extends J{constructor(e,t,n,r,o){super(e,t,n,r),s(this,"retokenizeCapturedWithRuleId"),this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,s){throw new Error("Not supported!")}},Y=class extends J{constructor(e,t,n,r,o){super(e,t,n,null),s(this,"_match"),s(this,"captures"),s(this,"_cachedCompiledPatterns"),this._match=new te(r,this.id),this.captures=o,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ne,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},V=class extends J{constructor(e,t,n,r,o){super(e,t,n,r),s(this,"hasMissingPatterns"),s(this,"patterns"),s(this,"_cachedCompiledPatterns"),this.patterns=o.patterns,this.hasMissingPatterns=o.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns){e.getRule(n).collectPatterns(e,t)}}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ne,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},X=class extends J{constructor(e,t,n,r,o,i,a,c,l,u){super(e,t,n,r),s(this,"_begin"),s(this,"beginCaptures"),s(this,"_end"),s(this,"endHasBackReferences"),s(this,"endCaptures"),s(this,"applyEndPatternLast"),s(this,"hasMissingPatterns"),s(this,"patterns"),s(this,"_cachedCompiledPatterns"),this._begin=new te(o,this.id),this.beginCaptures=i,this._end=new te(a||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=c,this.applyEndPatternLast=l||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,s){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,s)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ne;for(const t of this.patterns){e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Z=class extends J{constructor(e,t,n,r,o,i,a,c,l){super(e,t,n,r),s(this,"_begin"),s(this,"beginCaptures"),s(this,"whileCaptures"),s(this,"_while"),s(this,"whileHasBackReferences"),s(this,"hasMissingPatterns"),s(this,"patterns"),s(this,"_cachedCompiledPatterns"),s(this,"_cachedCompiledWhilePatterns"),this._begin=new te(o,this.id),this.beginCaptures=i,this.whileCaptures=c,this._while=new te(a,-2),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ne;for(const t of this.patterns){e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,s){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,s)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new ne,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},ee=class e{static createCaptureRule(e,t,n,s,r){return e.registerRule(e=>new Q(t,e,n,s,r))}static getCompiledRuleId(t,n,s){return t.id||n.registerRule(r=>{if(t.id=r,t.match)return new Y(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,s));if(void 0===t.begin){t.repository&&(s=a({},s,t.repository));let r=t.patterns;return void 0===r&&t.include&&(r=[{include:t.include}]),new V(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(r,n,s))}return t.while?new Z(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,s),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,s),e._compilePatterns(t.patterns,n,s)):new X(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,s),t.end,e._compileCaptures(t.endCaptures||t.captures,n,s),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,s))}),t.id}static _compileCaptures(t,n,s){let r=[];if(t){let o=0;for(const e in t){if("$vscodeTextmateLocation"===e)continue;const t=parseInt(e,10);t>o&&(o=t)}for(let e=0;e<=o;e++)r[e]=null;for(const i in t){if("$vscodeTextmateLocation"===i)continue;const o=parseInt(i,10);let a=0;t[i].patterns&&(a=e.getCompiledRuleId(t[i],n,s)),r[o]=e.createCaptureRule(n,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,a)}}return r}static _compilePatterns(t,n,s){let r=[];if(t)for(let o=0,i=t.length;o<i;o++){const i=t[o];let a=-1;if(i.include){const t=z(i.include);switch(t.kind){case 0:case 1:a=e.getCompiledRuleId(s[i.include],n,s);break;case 2:let r=s[t.ruleName];r&&(a=e.getCompiledRuleId(r,n,s));break;case 3:case 4:const o=t.scopeName,c=4===t.kind?t.ruleName:null,l=n.getExternalGrammar(o,s);if(l)if(c){let t=l.repository[c];t&&(a=e.getCompiledRuleId(t,n,l.repository))}else a=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}else a=e.getCompiledRuleId(i,n,s);if(-1!==a){const e=n.getRule(a);let t=!1;if((e instanceof V||e instanceof X||e instanceof Z)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;r.push(a)}}return{patterns:r,hasMissingPatterns:(t?t.length:0)!==r.length}}},te=class e{constructor(e,t){if(s(this,"source"),s(this,"ruleId"),s(this,"hasAnchor"),s(this,"hasBackReferences"),s(this,"_anchorCache"),e&&"string"==typeof e){const t=e.length;let n=0,s=[],r=!1;for(let o=0;o<t;o++){if("\\"===e.charAt(o)&&o+1<t){const t=e.charAt(o+1);"z"===t?(s.push(e.substring(n,o)),s.push("$(?!\\n)(?<!\\n)"),n=o+2):"A"!==t&&"G"!==t||(r=!0),o++}}this.hasAnchor=r,0===n?this.source=e:(s.push(e.substring(n,t)),this.source=s.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,"string"==typeof this.source?this.hasBackReferences=H.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if("string"!=typeof this.source)throw new Error("This method should only be called if the source is a string");let n=t.map(t=>e.substring(t.start,t.end));return K.lastIndex=0,this.source.replace(K,(e,t)=>f(n[parseInt(t,10)]||""))}_buildAnchorCache(){if("string"!=typeof this.source)throw new Error("This method should only be called if the source is a string");let e,t,n,s,r=[],o=[],i=[],a=[];for(e=0,t=this.source.length;e<t;e++)n=this.source.charAt(e),r[e]=n,o[e]=n,i[e]=n,a[e]=n,"\\"===n&&e+1<t&&(s=this.source.charAt(e+1),"A"===s?(r[e+1]="￿",o[e+1]="￿",i[e+1]="A",a[e+1]="A"):"G"===s?(r[e+1]="￿",o[e+1]="G",i[e+1]="￿",a[e+1]="G"):(r[e+1]=s,o[e+1]=s,i[e+1]=s,a[e+1]=s),e++);return{A0_G0:r.join(""),A0_G1:o.join(""),A1_G0:i.join(""),A1_G1:a.join("")}}resolveAnchors(e,t){return this.hasAnchor&&this._anchorCache&&"string"==typeof this.source?e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0:this.source}},ne=class{constructor(){s(this,"_items"),s(this,"_hasAnchors"),s(this,"_cached"),s(this,"_anchorCache"),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(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new se(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let s=this._items.map(e=>e.resolveAnchors(t,n));return new se(e,s,this._items.map(e=>e.ruleId))}},se=class{constructor(e,t,n){s(this,"scanner"),this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}dispose(){"function"==typeof this.scanner.dispose&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join("\n")}findNextMatchSync(e,t,n){const s=this.scanner.findNextMatchSync(e,t,n);return s?{ruleId:this.rules[s.index],captureIndices:s.captureIndices}:null}},re=class{constructor(e,t){this.languageId=e,this.tokenType=t}},oe=(e=class{constructor(e,t){s(this,"_defaultAttributes"),s(this,"_embeddedLanguagesMatcher"),s(this,"_getBasicScopeAttributes",new m(e=>{const t=this._scopeToLanguage(e),n=this._toStandardTokenType(e);return new re(t,n)})),this._defaultAttributes=new re(e,8),this._embeddedLanguagesMatcher=new ie(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return null===t?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){const n=t.match(e.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 new Error("Unexpected match for standard token type!")}},s(e,"_NULL_SCOPE_METADATA",new re(0,0)),s(e,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),e),ie=class{constructor(e){if(s(this,"values"),s(this,"scopesRegExp"),0===e.length)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([e,t])=>f(e));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);return t?this.values.get(t[1]):void 0}};"undefined"!=typeof process&&process.env.VSCODE_TEXTMATE_DEBUG;var ae=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function ce(e,t,n,s,r,o,i,a){const c=t.content.length;let l=!1,u=-1;if(i){const i=function(e,t,n,s,r,o){let i=r.beginRuleCapturedEOL?0:-1;const a=[];for(let c=r;c;c=c.pop()){const t=c.getRule(e);t instanceof Z&&a.push({rule:t,stack:c})}for(let c=a.pop();c;c=a.pop()){const{ruleScanner:a,findOptions:l}=le(c.rule,e,c.stack.endRule,n,s===i),u=a.findNextMatchSync(t,s,l);if(!u){r=c.stack.pop();break}if(-2!==u.ruleId){r=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(o.produce(c.stack,u.captureIndices[0].start),ue(e,t,n,c.stack,o,c.rule.whileCaptures,u.captureIndices),o.produce(c.stack,u.captureIndices[0].end),i=u.captureIndices[0].end,u.captureIndices[0].end>s&&(s=u.captureIndices[0].end,n=!1))}return{stack:r,linePos:s,anchorPosition:i,isFirstLine:n}}(e,t,n,s,r,o);r=i.stack,s=i.linePos,n=i.isFirstLine,u=i.anchorPosition}const p=Date.now();for(;!l;){if(0!==a){if(Date.now()-p>a)return new ae(r,!0)}d()}return new ae(r,!1);function d(){const i=function(e,t,n,s,r,o){const i=function(e,t,n,s,r,o){const i=r.getRule(e),{ruleScanner:a,findOptions:c}=he(i,e,r.endRule,n,s===o),l=a.findNextMatchSync(t,s,c);if(l)return{captureIndices:l.captureIndices,matchedRuleId:l.ruleId};return null}(e,t,n,s,r,o),a=e.getInjections();if(0===a.length)return i;const c=function(e,t,n,s,r,o,i){let a,c=Number.MAX_VALUE,l=null,u=0;const p=o.contentNameScopesList.getScopeNames();for(let d=0,g=e.length;d<g;d++){const o=e[d];if(!o.matcher(p))continue;const g=t.getRule(o.ruleId),{ruleScanner:f,findOptions:m}=he(g,t,null,s,r===i),_=f.findNextMatchSync(n,r,m);if(!_)continue;const y=_.captureIndices[0].start;if(!(y>=c)&&(c=y,l=_.captureIndices,a=_.ruleId,u=o.priority,c===r))break}if(l)return{priorityMatch:-1===u,captureIndices:l,matchedRuleId:a};return null}(a,e,t,n,s,r,o);if(!c)return i;if(!i)return c;const l=i.captureIndices[0].start,u=c.captureIndices[0].start;if(u<l||c.priorityMatch&&u===l)return c;return i}(e,t,n,s,r,u);if(!i)return o.produce(r,c),void(l=!0);const a=i.captureIndices,p=i.matchedRuleId,d=!!(a&&a.length>0)&&a[0].end>s;if(-1===p){const i=r.getRule(e);o.produce(r,a[0].start),r=r.withContentNameScopesList(r.nameScopesList),ue(e,t,n,r,o,i.endCaptures,a),o.produce(r,a[0].end);const p=r;if(r=r.parent,u=p.getAnchorPos(),!d&&p.getEnterPos()===s)return r=p,o.produce(r,c),void(l=!0)}else{const i=e.getRule(p);o.produce(r,a[0].start);const g=r,f=i.getName(t.content,a),m=r.contentNameScopesList.pushAttributed(f,e);if(r=r.push(p,s,u,a[0].end===c,null,m,m),i instanceof X){const s=i;ue(e,t,n,r,o,s.beginCaptures,a),o.produce(r,a[0].end),u=a[0].end;const p=s.getContentName(t.content,a),f=m.pushAttributed(p,e);if(r=r.withContentNameScopesList(f),s.endHasBackReferences&&(r=r.withEndRule(s.getEndWithResolvedBackReferences(t.content,a))),!d&&g.hasSameRuleAs(r))return r=r.pop(),o.produce(r,c),void(l=!0)}else if(i instanceof Z){const s=i;ue(e,t,n,r,o,s.beginCaptures,a),o.produce(r,a[0].end),u=a[0].end;const p=s.getContentName(t.content,a),f=m.pushAttributed(p,e);if(r=r.withContentNameScopesList(f),s.whileHasBackReferences&&(r=r.withEndRule(s.getWhileWithResolvedBackReferences(t.content,a))),!d&&g.hasSameRuleAs(r))return r=r.pop(),o.produce(r,c),void(l=!0)}else{if(ue(e,t,n,r,o,i.captures,a),o.produce(r,a[0].end),r=r.pop(),!d)return r=r.safePop(),o.produce(r,c),void(l=!0)}}a[0].end>s&&(s=a[0].end,n=!1)}}function he(e,t,n,s,r){return{ruleScanner:e.compileAG(t,n,s,r),findOptions:0}}function le(e,t,n,s,r){return{ruleScanner:e.compileWhileAG(t,n,s,r),findOptions:0}}function ue(e,t,n,s,r,o,i){if(0===o.length)return;const a=t.content,c=Math.min(o.length,i.length),l=[],u=i[0].end;for(let p=0;p<c;p++){const t=o[p];if(null===t)continue;const c=i[p];if(0===c.length)continue;if(c.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=c.start;)r.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?r.produceFromScopes(l[l.length-1].scopes,c.start):r.produce(s,c.start),t.retokenizeCapturedWithRuleId){const o=t.getName(a,i),l=s.contentNameScopesList.pushAttributed(o,e),u=t.getContentName(a,i),p=l.pushAttributed(u,e),d=s.push(t.retokenizeCapturedWithRuleId,c.start,-1,!1,null,l,p),g=e.createOnigString(a.substring(0,c.end));ce(e,g,n&&0===c.start,c.start,d,r,!1,0),L(g);continue}const d=t.getName(a,i);if(null!==d){const t=(l.length>0?l[l.length-1].scopes:s.contentNameScopesList).pushAttributed(d,e);l.push(new pe(t,c.end))}}for(;l.length>0;)r.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var pe=class{constructor(e,t){s(this,"scopes"),s(this,"endPos"),this.scopes=e,this.endPos=t}};function de(e,t,n,s,r){const o=R(t,ge),i=ee.getCompiledRuleId(n,s,r.repository);for(const a of o)e.push({debugSelector:t,matcher:a.matcher,ruleId:i,grammar:r,priority:a.priority})}function ge(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let s=n;s<t.length;s++)if(fe(t[s],e))return n=s+1,!0;return!1})}function fe(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&"."===e[n]}var me=class{constructor(e,t,n,r,o,i,a,c){if(s(this,"_rootId"),s(this,"_lastRuleId"),s(this,"_ruleId2desc"),s(this,"_includedGrammars"),s(this,"_grammarRepository"),s(this,"_grammar"),s(this,"_injections"),s(this,"_basicScopeAttributesProvider"),s(this,"_tokenTypeMatchers"),this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=c,this._basicScopeAttributesProvider=new oe(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=a,this._grammar=_e(t,null),this._injections=null,this._tokenTypeMatchers=[],o)for(const s of Object.keys(o)){const e=R(s,ge);for(const t of e)this._tokenTypeMatchers.push({matcher:t.matcher,type:o[s]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e=e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),t=[],n=this._rootScopeName,s=e(n);if(s){const e=s.injections;if(e)for(let n in e)de(t,n,e[n],this,s);const r=this._grammarRepository.injections(n);r&&r.forEach(e=>{const n=this.getExternalGrammar(e);if(n){const e=n.injectionSelector;e&&de(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return null===this._injections&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=_e(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const s=this._tokenize(e,t,!1,n);return{tokens:s.lineTokens.getResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}tokenizeLine2(e,t,n=0){const s=this._tokenize(e,t,!0,n);return{tokens:s.lineTokens.getBinaryResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}_tokenize(e,t,n,s){let r;if(-1===this._rootId&&(this._rootId=ee.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==be.NULL)r=!1,t.reset();else{r=!0;const e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),s=P.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),o=this.getRule(this._rootId).getName(null,null);let i;i=o?ye.createRootAndLookUpScopeName(o,s,this):ye.createRoot("unknown",s),t=new be(null,this._rootId,-1,-1,!1,null,i,i)}e+="\n";const o=this.createOnigString(e),i=o.content.length,a=new Se(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=ce(this,o,r,0,t,a,!0,s);return L(o),{lineLength:i,lineTokens:a,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function _e(e,t){return(e=i(e)).repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var ye=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let s=t,r=t?.scopePath??null;for(const o of n)r=y.push(r,o.scopeNames),s=new e(s,r,o.encodedTokenAttributes);return s}static createRoot(t,n){return new e(null,new y(null,t),n)}static createRootAndLookUpScopeName(t,n,s){const r=s.getMetadataForScope(t),o=new y(null,t),i=s.themeProvider.themeMatch(o),a=e.mergeAttributes(n,r,i);return new e(null,o,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return e.equals(this,t)}static equals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}}static mergeAttributes(e,t,n){let s=-1,r=0,o=0;return null!==n&&(s=n.fontStyle,r=n.foregroundId,o=n.backgroundId),P.set(e,t.languageId,t.tokenType,null,s,r,o)}pushAttributed(t,n){if(null===t)return this;if(-1===t.indexOf(" "))return e._pushAttributed(this,t,n);const s=t.split(/ /g);let r=this;for(const o of s)r=e._pushAttributed(r,o,n);return r}static _pushAttributed(t,n,s){const r=s.getMetadataForScope(n),o=t.scopePath.push(n),i=s.themeProvider.themeMatch(o),a=e.mergeAttributes(t.tokenAttributes,r,i);return new e(t,o,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},be=(t=class{constructor(e,t,n,r,o,i,a,c){s(this,"_stackElementBrand"),s(this,"_enterPos"),s(this,"_anchorPos"),s(this,"depth"),this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=a,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}equals(e){return null!==e&&t._equals(this,e)}static _equals(e,t){return e===t||!!this._structuralEquals(e,t)&&ye.equals(e.contentNameScopesList,t.contentNameScopesList)}static _structuralEquals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){t._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,s,r,o,i,a){return new t(this,e,n,s,r,o,i,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new t(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId: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){const s=ye.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new t(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,ye.fromExtension(s,n.contentNameScopesList))}},s(t,"NULL",new t(null,0,0,0,!1,null,null,null)),t),ke=class{constructor(e,t){s(this,"balancedBracketScopes"),s(this,"unbalancedBracketScopes"),s(this,"allowAny",!1),this.balancedBracketScopes=e.flatMap(e=>"*"===e?(this.allowAny=!0,[]):R(e,ge).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>R(e,ge).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&0===this.unbalancedBracketScopes.length}get matchesNever(){return 0===this.balancedBracketScopes.length&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},Se=class{constructor(e,t,n,r){s(this,"_emitBinaryTokens"),s(this,"_lineText"),s(this,"_tokens"),s(this,"_binaryTokens"),s(this,"_lastTokenEndIndex"),s(this,"_tokenTypeOverrides"),this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const t=e?.getScopeNames()??[];for(const e of this._tokenTypeOverrides)e.matcher(t)&&(n=P.set(n,0,I(e.type),null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(t))}return s&&(n=P.set(n,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n?void(this._lastTokenEndIndex=t):(this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),void(this._lastTokenEndIndex=t))}const n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),0===this._tokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let s=0,r=this._binaryTokens.length;s<r;s++)n[s]=this._binaryTokens[s];return n}},we=class{constructor(e,t){s(this,"_grammars",/* @__PURE__ */new Map),s(this,"_rawGrammars",/* @__PURE__ */new Map),s(this,"_injectionGrammars",/* @__PURE__ */new Map),s(this,"_theme"),this._onigLib=t,this._theme=e}dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,s,r){if(!this._grammars.has(e)){let o=this._rawGrammars.get(e);if(!o)return null;this._grammars.set(e,function(e,t,n,s,r,o,i,a){return new me(e,t,n,s,r,o,i,a)}(e,o,t,n,s,r,this,this._onigLib))}return this._grammars.get(e)}},Ce=class{constructor(e){s(this,"_options"),s(this,"_syncRegistry"),s(this,"_ensureGrammarCache"),this._options=e,this._syncRegistry=new we(_.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=/* @__PURE__ */new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(_.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new ke(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,s,r){const o=new $(this._syncRegistry,e);for(;o.Q.length>0;)o.Q.map(e=>this._loadSingleGrammar(e.scopeName)),o.processQueue();return this._grammarForScopeName(e,t,n,s,r)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const t=this._options.loadGrammar(e);if(t){const n="function"==typeof this._options.getInjections?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,s=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,s)}_grammarForScopeName(e,t=0,n=null,s=null,r=null){return this._syncRegistry.grammarForScopeName(e,t,n,s,r)}},Ne=be.NULL;function Ae(e,t){const n="string"==typeof e?{}:{...e.colorReplacements},s="string"==typeof e?e:e.name;for(const[r,o]of Object.entries(t?.colorReplacements||{}))"string"==typeof o?n[r]=o:r===s&&Object.assign(n,o);return n}function ve(e,t){return e&&t?.[e?.toLowerCase()]||e}function Pe(e){return Array.isArray(e)?e:[e]}async function Ie(e){return Promise.resolve("function"==typeof e?e():e).then(e=>e.default||e)}function Re(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Te(e){return"ansi"===e||Re(e)}function Le(e){return"none"===e}function xe(e){return Le(e)}function Ge(e,t){var n;if(!t)return e;e.properties||(e.properties={}),(n=e.properties).class||(n.class=[]),"string"==typeof e.properties.class&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const s=Array.isArray(t)?t:t.split(/\s+/g);for(const r of s)r&&!e.properties.class.includes(r)&&e.properties.class.push(r);return e}function Ee(e,t=!1){if(0===e.length)return[["",0]];const n=e.split(/(\r?\n)/g);let s=0;const r=[];for(let o=0;o<n.length;o+=2){const e=t?n[o]+(n[o+1]||""):n[o];r.push([e,s]),s+=n[o].length,s+=n[o+1]?.length||0}return r}function $e(e){const t=Ee(e,!0).map(([e])=>e);return{lines:t,indexToPos:function(n){if(n===e.length)return{line:t.length-1,character:t[t.length-1].length};let s=n,r=0;for(const e of t){if(s<e.length)break;s-=e.length,r++}return{line:r,character:s}},posToIndex:function(e,n){let s=0;for(let r=0;r<e;r++)s+=t[r].length;return s+=n,s}}}const Be="light-dark()",Me=["color","background-color"];function Oe(e,t){let n=0;const s=[];for(const r of t)r>n&&s.push({...e,content:e.content.slice(n,r),offset:e.offset+n}),n=r;return n<e.content.length&&s.push({...e,content:e.content.slice(n),offset:e.offset+n}),s}function je(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{const t=n.filter(t=>e.offset<t&&t<e.offset+e.content.length).map(t=>t-e.offset).sort((e,t)=>e-t);return t.length?Oe(e,t):e})):e}function Fe(e,t,n,s,r="css-vars"){const i={content:e.content,explanation:e.explanation,offset:e.offset},a=t.map(t=>We(e.variants[t])),c=new Set(a.flatMap(e=>Object.keys(e))),l={},u=(e,s)=>{const r="color"===s?"":"background-color"===s?"-bg":`-${s}`;return n+t[e]+("color"===s?"":r)};return a.forEach((e,n)=>{for(const i of c){const c=e[i]||"inherit";if(0===n&&s&&Me.includes(i))if(s===Be&&a.length>1){const e=t.findIndex(e=>"light"===e),s=t.findIndex(e=>"dark"===e);if(-1===e||-1===s)throw new o('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const p=a[e][i]||"inherit",d=a[s][i]||"inherit";l[i]=`light-dark(${p}, ${d})`,"css-vars"===r&&(l[u(n,i)]=c)}else l[i]=c;else"css-vars"===r&&(l[u(n,i)]=c)}}),i.htmlStyle=l,i}function We(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&w.Italic&&(t["font-style"]="italic"),e.fontStyle&w.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&w.Underline&&n.push("underline"),e.fontStyle&w.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function De(e){return"string"==typeof e?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}const qe=/* @__PURE__ */new WeakMap;function Ue(e,t){qe.set(e,t)}function ze(e){return qe.get(e)}class He{constructor(...e){if(s(this,"_stacks",{}),s(this,"lang"),2===e.length){const[t,n]=e;this.lang=n,this._stacks=t}else{const[t,n,s]=e;this.lang=n,this._stacks={[s]:t}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,t){return new He(Object.fromEntries(Pe(t).map(e=>[e,Ne])),e)}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return function(e){const t=[],n=/* @__PURE__ */new Set;function s(e){if(n.has(e))return;n.add(e);const r=e?.nameScopesList?.scopeName;r&&t.push(r),e.parent&&s(e.parent)}return s(e),t}(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function Ke(){const e=/* @__PURE__ */new WeakMap;function t(t){if(!e.has(t.meta)){let n=function(e){if("number"==typeof e){if(e<0||e>t.source.length)throw new o(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...s.indexToPos(e),offset:e}}{const t=s.lines[e.line];if(void 0===t)throw new o(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${s.lines.length}`);let n=e.character;if(n<0&&(n=t.length+n),n<0||n>t.length)throw new o(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:n,offset:s.posToIndex(e.line,n)}}};const s=$e(t.source),r=(t.options.decorations||[]).map(e=>({...e,start:n(e.start),end:n(e.end)}));!function(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new o(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let s=t+1;s<e.length;s++){const t=e[s],r=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,i=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,a=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,c=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(r||i||a||c){if(r&&i)continue;if(a&&c)continue;if(a&&n.start.offset===n.end.offset)continue;if(i&&t.start.offset===t.end.offset)continue;throw new o(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}(r),e.set(t.meta,{decorations:r,converter:s,source:t.source})}return e.get(t.meta)}return{name:"shiki:decorations",tokens(e){if(!this.options.decorations?.length)return;return je(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;const n=t(this),s=Array.from(e.children).filter(e=>"element"===e.type&&"span"===e.tagName);if(s.length!==n.converter.lines.length)throw new o(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function r(e,t,n,r){const i=s[e];let c="",l=-1,u=-1;if(0===t&&(l=0),0===n&&(u=0),n===Number.POSITIVE_INFINITY&&(u=i.children.length),-1===l||-1===u)for(let s=0;s<i.children.length;s++)c+=Je(i.children[s]),-1===l&&c.length===t&&(l=s+1),-1===u&&c.length===n&&(u=s+1);if(-1===l)throw new o(`Failed to find start index for decoration ${JSON.stringify(r.start)}`);if(-1===u)throw new o(`Failed to find end index for decoration ${JSON.stringify(r.end)}`);const p=i.children.slice(l,u);if(r.alwaysWrap||p.length!==i.children.length)if(r.alwaysWrap||1!==p.length||"element"!==p[0].type){const e={type:"element",tagName:"span",properties:{},children:p};a(e,r,"wrapper"),i.children.splice(l,p.length,e)}else a(p[0],r,"token");else a(i,r,"line")}function i(e,t){s[e]=a(s[e],t,"line")}function a(e,t,n){const s=t.properties||{},r=t.transform||(e=>e);return e.tagName=t.tagName||"span",e.properties={...e.properties,...s,class:e.properties.class},t.properties?.class&&Ge(e,t.properties.class),e=r(e,n)||e}const c=[],l=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(const t of l){const{start:e,end:n}=t;if(e.line===n.line)r(e.line,e.character,n.character,t);else if(e.line<n.line){r(e.line,e.character,Number.POSITIVE_INFINITY,t);for(let s=e.line+1;s<n.line;s++)c.unshift(()=>i(s,t));r(n.line,0,n.character,t)}}c.forEach(e=>e())}}}function Je(e){return"text"===e.type?e.value:"element"===e.type?e.children.map(Je).join(""):""}const Qe=[
2
+ /* @__PURE__ */Ke()];function Ye(e){const t=function(e){const t=[],n=[],s=[];for(const r of e)switch(r.enforce){case"pre":t.push(r);break;case"post":n.push(r);break;default:s.push(r)}return{pre:t,post:n,normal:s}}(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...Qe]}var Ve=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Xe={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Ze(e,t){const n=e.indexOf("",t);if(-1!==n&&"["===e[n+1]){const t=e.indexOf("m",n);if(-1!==t)return{sequence:e.substring(n+2,t).split(";"),startPosition:n,position:t+1}}return{position:e.length}}function et(e){const t=e.shift();if("2"===t){const t=e.splice(0,3).map(e=>Number.parseInt(e));if(3!==t.length||t.some(e=>Number.isNaN(e)))return;return{type:"rgb",rgb:t}}if("5"===t){const t=e.shift();if(t)return{type:"table",index:Number(t)}}}function tt(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const s=Number.parseInt(n);if(!Number.isNaN(s))if(0===s)t.push({type:"resetAll"});else if(s<=9){Xe[s]&&t.push({type:"setDecoration",value:Xe[s]})}else if(s<=29){const e=Xe[s-20];e&&(t.push({type:"resetDecoration",value:e}),"dim"===e&&t.push({type:"resetDecoration",value:"bold"}))}else if(s<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Ve[s-30]}});else if(38===s){const n=et(e);n&&t.push({type:"setForegroundColor",value:n})}else if(39===s)t.push({type:"resetForegroundColor"});else if(s<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Ve[s-40]}});else if(48===s){const n=et(e);n&&t.push({type:"setBackgroundColor",value:n})}else 49===s?t.push({type:"resetBackgroundColor"}):53===s?t.push({type:"setDecoration",value:"overline"}):55===s?t.push({type:"resetDecoration",value:"overline"}):s>=90&&s<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Ve[s-90+8]}}):s>=100&&s<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Ve[s-100+8]}})}return t}var nt={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 st(e=nt){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,"0")).join("")}`}let s;function r(e){return function(){if(s)return s;s=[];for(let n=0;n<Ve.length;n++)s.push(t(Ve[n]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let r=0;r<6;r++)for(let o=0;o<6;o++)s.push(n([e[t],e[r],e[o]]));let r=8;for(let t=0;t<24;t++,r+=10)s.push(n([r,r,r]));return s}()[e]}return{value:function(e){switch(e.type){case"named":return t(e.name);case"rgb":return n(e.rgb);case"table":return r(e.index)}}}}const rt={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 ot(e,t,n){const s=Ae(e,n),r=Ee(t),o=st(Object.fromEntries(Ve.map(t=>{const n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`,s=e.colors?.[n];return[t,s||rt[t]]}))),i=function(){let e=null,t=null,n=/* @__PURE__ */new Set;return{parse(s){const r=[];let o=0;do{const i=Ze(s,o),a=i.sequence?s.substring(o,i.startPosition):s.substring(o);if(a.length>0&&r.push({value:a,foreground:e,background:t,decorations:new Set(n)}),i.sequence){const s=tt(i.sequence);for(const r of s)"resetAll"===r.type?(e=null,t=null,n.clear()):"resetForegroundColor"===r.type?e=null:"resetBackgroundColor"===r.type?t=null:"resetDecoration"===r.type&&n.delete(r.value);for(const r of s)"setForegroundColor"===r.type?e=r.value:"setBackgroundColor"===r.type?t=r.value:"setDecoration"===r.type&&n.add(r.value)}o=i.position}while(o<s.length);return r}}}();return r.map(t=>i.parse(t[0]).map(n=>{let r,i;n.decorations.has("reverse")?(r=n.background?o.value(n.background):e.bg,i=n.foreground?o.value(n.foreground):e.fg):(r=n.foreground?o.value(n.foreground):e.fg,i=n.background?o.value(n.background):void 0),r=ve(r,s),i=ve(i,s),n.decorations.has("dim")&&(r=function(e){const t=e.match(/#([0-9a-f]{3,8})/i);if(t){const e=t[1];if(8===e.length){const t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${e.slice(0,6)}${t}`}if(6===e.length)return`#${e}80`;if(4===e.length){const t=e[0],n=e[1],s=e[2],r=e[3];return`#${t}${t}${n}${n}${s}${s}${Math.round(Number.parseInt(`${r}${r}`,16)/2).toString(16).padStart(2,"0")}`}if(3===e.length){const t=e[0],n=e[1],s=e[2];return`#${t}${t}${n}${n}${s}${s}80`}}const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}(r));let a=w.None;return n.decorations.has("bold")&&(a|=w.Bold),n.decorations.has("italic")&&(a|=w.Italic),n.decorations.has("underline")&&(a|=w.Underline),n.decorations.has("strikethrough")&&(a|=w.Strikethrough),{content:n.value,offset:t[1],color:r,bgColor:i,fontStyle:a}}))}function it(e,t,n={}){const{theme:s=e.getLoadedThemes()[0]}=n,r=e.resolveLangAlias(n.lang||"text");if(Re(r)||Le(s))return Ee(t).map(e=>[{content:e[0],offset:e[1]}]);const{theme:i,colorMap:a}=e.setTheme(s);if("ansi"===r)return ot(i,t,n);const c=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==c.name)throw new o(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${c.name}"`);if(!n.grammarState.themes.includes(i.name))throw new o(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return at(t,c,i,a,n)}function at(e,t,n,s,r){const o=ct(e,t,n,s,r),i=new He(o.stateStack,t.name,n.name);return Ue(o.tokens,i),o.tokens}function ct(e,t,n,s,r){const i=Ae(n,r),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:c=500}=r,l=Ee(e);let u=r.grammarState?function(e,t){if(!(e instanceof He))throw new o("Invalid grammar state");return e.getInternalStack(t)}(r.grammarState,n.name)??Ne:null!=r.grammarContextCode?ct(r.grammarContextCode,t,n,s,{...r,grammarState:void 0,grammarContextCode:void 0}).stateStack:Ne,p=[];const d=[];for(let o=0,g=l.length;o<g;o++){const[e,g]=l[o];if(""===e){p=[],d.push([]);continue}if(a>0&&e.length>=a){p=[],d.push([{content:e,offset:g,color:"",fontStyle:0}]);continue}let f,m,_;r.includeExplanation&&(f=t.tokenizeLine(e,u,c),m=f.tokens,_=0);const y=t.tokenizeLine2(e,u,c),b=y.tokens.length/2;for(let t=0;t<b;t++){const o=y.tokens[2*t],a=t+1<b?y.tokens[2*t+2]:e.length;if(o===a)continue;const c=y.tokens[2*t+1],l=ve(s[P.getForeground(c)],i),u=P.getFontStyle(c),d={content:e.substring(o,a),offset:g+o,color:l,fontStyle:u};if(r.includeExplanation){const t=[];if("scopeName"!==r.includeExplanation)for(const e of n.settings){let n;switch(typeof e.scope){case"string":n=e.scope.split(/,/).map(e=>e.trim());break;case"object":n=e.scope;break;default:continue}t.push({settings:e,selectors:n.map(e=>e.split(/ /))})}d.explanation=[];let s=0;for(;o+s<a;){const n=m[_],o=e.substring(n.startIndex,n.endIndex);s+=o.length,d.explanation.push({content:o,scopes:"scopeName"===r.includeExplanation?ht(n.scopes):lt(t,n.scopes)}),_+=1}}p.push(d)}d.push(p),p=[],u=y.ruleStack}return{tokens:d,stateStack:u}}function ht(e){return e.map(e=>({scopeName:e}))}function lt(e,t){const n=[];for(let s=0,r=t.length;s<r;s++){const r=t[s];n[s]={scopeName:r,themeMatches:dt(e,r,t.slice(0,s))}}return n}function ut(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function pt(e,t,n){if(!ut(e[e.length-1],t))return!1;let s=e.length-2,r=n.length-1;for(;s>=0&&r>=0;)ut(e[s],n[r])&&(s-=1),r-=1;return-1===s}function dt(e,t,n){const s=[];for(const{selectors:r,settings:o}of e)for(const e of r)if(pt(e,t,n)){s.push(o);break}return s}function gt(e,t,n){const s=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),r=s.map(s=>{const r=it(e,t,{...n,theme:s.theme});return{tokens:r,state:ze(r),theme:"string"==typeof s.theme?s.theme:s.theme.name}}),o=function(...e){const t=e.map(()=>[]),n=e.length;for(let s=0;s<e[0].length;s++){const r=e.map(e=>e[s]),o=t.map(()=>[]);t.forEach((e,t)=>e.push(o[t]));const i=r.map(()=>0),a=r.map(e=>e[0]);for(;a.every(e=>e);){const e=Math.min(...a.map(e=>e.content.length));for(let t=0;t<n;t++){const n=a[t];n.content.length===e?(o[t].push(n),i[t]+=1,a[t]=r[t][i[t]]):(o[t].push({...n,content:n.content.slice(0,e)}),a[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}(...r.map(e=>e.tokens)),i=o[0].map((e,t)=>e.map((e,r)=>{const i={content:e.content,variants:{},offset:e.offset};return"includeExplanation"in n&&n.includeExplanation&&(i.explanation=e.explanation),o.forEach((e,n)=>{const{content:o,explanation:a,offset:c,...l}=e[t][r];i.variants[s[n].color]=l}),i})),a=r[0].state?new He(Object.fromEntries(r.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),r[0].state.lang):void 0;return a&&Ue(i,a),i}function ft(e,t,n){let s,r,i,a,c,l;if("themes"in n){const{defaultColor:u="light",cssVariablePrefix:p="--shiki-",colorsRendering:d="css-vars"}=n,g=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===u?-1:t.color===u?1:0);if(0===g.length)throw new o("`themes` option must not be empty");const f=gt(e,t,n);if(l=ze(f),u&&Be!==u&&!g.find(e=>e.color===u))throw new o(`\`themes\` option must contain the defaultColor key \`${u}\``);const m=g.map(t=>e.getTheme(t.theme)),_=g.map(e=>e.color);i=f.map(e=>e.map(e=>Fe(e,_,p,u,d))),l&&Ue(i,l);const y=g.map(e=>Ae(e.theme,n));r=mt(g,m,y,p,u,"fg",d),s=mt(g,m,y,p,u,"bg",d),a=`shiki-themes ${m.map(e=>e.name).join(" ")}`,c=u?void 0:[r,s].join(";")}else{if(!("theme"in n))throw new o("Invalid options, either `theme` or `themes` must be provided");{const o=Ae(n.theme,n);i=it(e,t,n);const c=e.getTheme(n.theme);s=ve(c.bg,o),r=ve(c.fg,o),a=c.name,l=ze(i)}}return{tokens:i,fg:r,bg:s,themeName:a,rootStyle:c,grammarState:l}}function mt(e,t,n,s,r,i,a){return e.map((c,l)=>{const u=ve(t[l][i],n[l])||"inherit",p=`${s+c.color}${"bg"===i?"-bg":""}:${u}`;if(0===l&&r){if(r===Be&&e.length>1){const s=e.findIndex(e=>"light"===e.color),r=e.findIndex(e=>"dark"===e.color);if(-1===s||-1===r)throw new o('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${ve(t[s][i],n[s])||"inherit"}, ${ve(t[r][i],n[r])||"inherit"});${p}`}return u}return"css-vars"===a?p:null}).filter(e=>!!e).join(";")}function _t(e,t,n,s={meta:{},options:n,codeToHast:(t,n)=>_t(e,t,n),codeToTokens:(t,n)=>ft(e,t,n)}){let r=t;for(const f of Ye(n))r=f.preprocess?.call(s,r,n)||r;let{tokens:o,fg:i,bg:a,themeName:c,rootStyle:l,grammarState:u}=ft(e,r,n);const{mergeWhitespaces:p=!0,mergeSameStyleTokens:d=!1}=n;!0===p?o=function(e){return e.map(e=>{const t=[];let n,s="";return e.forEach((r,o)=>{const i=!(r.fontStyle&&(r.fontStyle&w.Underline||r.fontStyle&w.Strikethrough));i&&r.content.match(/^\s+$/)&&e[o+1]?(void 0===n&&(n=r.offset),s+=r.content):s?(i?t.push({...r,offset:n,content:s+r.content}):t.push({content:s,offset:n},r),n=void 0,s=""):t.push(r)}),t})}(o):"never"===p&&(o=function(e){return e.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;const t=e.content.match(/^(\s*)(.*?)(\s*)$/);if(!t)return e;const[,n,s,r]=t;if(!n&&!r)return e;const o=[{...e,offset:e.offset+n.length,content:s}];return n&&o.unshift({content:n,offset:e.offset}),r&&o.push({content:r,offset:e.offset+n.length+s.length}),o}))}(o)),d&&(o=function(e){return e.map(e=>{const t=[];for(const n of e){if(0===t.length){t.push({...n});continue}const e=t[t.length-1],s=De(e.htmlStyle||We(e)),r=De(n.htmlStyle||We(n)),o=e.fontStyle&&(e.fontStyle&w.Underline||e.fontStyle&w.Strikethrough),i=n.fontStyle&&(n.fontStyle&w.Underline||n.fontStyle&w.Strikethrough);o||i||s!==r?t.push({...n}):e.content+=n.content}return t})}(o));const g={...s,get source(){return r}};for(const f of Ye(n))o=f.tokens?.call(g,o)||o;return yt(o,{...n,fg:i,bg:a,themeName:c,rootStyle:!1!==n.rootStyle&&(n.rootStyle??l)},g,u)}function yt(e,t,n,s=ze(e)){const r=Ye(t),o=[],i={type:"root",children:[]},{structure:a="classic",tabindex:c="0"}=t,l={class:`shiki ${t.themeName||""}`};!1!==t.rootStyle&&(null!=t.rootStyle?l.style=t.rootStyle:l.style=`background-color:${t.bg};color:${t.fg}`),!1!==c&&null!=c&&(l.tabindex=c.toString());for(const[m,_]of Object.entries(t.meta||{}))m.startsWith("_")||(l[m]=_);let u={type:"element",tagName:"pre",properties:l,children:[],data:t.data},p={type:"element",tagName:"code",properties:{},children:o};const d=[],g={...n,structure:a,addClassToHast:Ge,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return i},get pre(){return u},get code(){return p},get lines(){return d}};if(e.forEach((e,t)=>{t&&("inline"===a?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):"classic"===a&&o.push({type:"text",value:"\n"}));let n={type:"element",tagName:"span",properties:{class:"line"},children:[]},s=0;for(const o of e){let e={type:"element",tagName:"span",properties:{...o.htmlAttrs},children:[{type:"text",value:o.content}]};const c=De(o.htmlStyle||We(o));c&&(e.properties.style=c);for(const i of r)e=i?.span?.call(g,e,t+1,s,n,o)||e;"inline"===a?i.children.push(e):"classic"===a&&n.children.push(e),s+=o.content.length}if("classic"===a){for(const e of r)n=e?.line?.call(g,n,t+1)||n;d.push(n),o.push(n)}else"inline"===a&&d.push(n)}),"classic"===a){for(const e of r)p=e?.code?.call(g,p)||p;u.children.push(p);for(const e of r)u=e?.pre?.call(g,u)||u;i.children.push(u)}else if("inline"===a){const e=[];let t={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const s of i.children)"element"===s.type&&"br"===s.tagName?(e.push(t),t={type:"element",tagName:"span",properties:{class:"line"},children:[]}):"element"!==s.type&&"text"!==s.type||t.children.push(s);e.push(t);let n={type:"element",tagName:"code",properties:{},children:e};for(const s of r)n=s?.code?.call(g,n)||n;i.children=[];for(let s=0;s<n.children.length;s++){s>0&&i.children.push({type:"element",tagName:"br",properties:{},children:[]});const e=n.children[s];"element"===e.type&&i.children.push(...e.children)}}let f=i;for(const m of r)f=m?.root?.call(g,f)||f;return s&&Ue(f,s),f}const bt=r;function kt(e,t,n){const s={meta:{},options:n,codeToHast:(t,n)=>_t(e,t,n),codeToTokens:(t,n)=>ft(e,t,n)};let r=bt(_t(e,t,n,s));for(const o of Ye(n))r=o.postprocess?.call(s,r,n)||r;return r}const St="#333333",wt="#bbbbbb",Ct="#fffffe",Nt="#1e1e1e",At="__shiki_resolved";function vt(e){if(e?.[At])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:n,fg:s}=t;if(!n||!s){const e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(s=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!s&&t?.colors?.["editor.foreground"]&&(s=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),s||(s="light"===t.type?St:wt),n||(n="light"===t.type?Ct:Nt),t.fg=s,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let r=0;const o=/* @__PURE__ */new Map;function i(e){if(o.has(e))return o.get(e);r+=1;const n=`#${r.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?i(e):(o.set(e,n),n)}t.settings=t.settings.map(e=>{const n=e.settings?.foreground&&!e.settings.foreground.startsWith("#"),s=e.settings?.background&&!e.settings.background.startsWith("#");if(!n&&!s)return e;const r={...e,settings:{...e.settings}};if(n){const n=i(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,r.settings.foreground=n}if(s){const n=i(e.settings.background);t.colorReplacements[n]=e.settings.background,r.settings.background=n}return r});for(const a of Object.keys(t.colors||{}))if(("editor.foreground"===a||"editor.background"===a||a.startsWith("terminal.ansi"))&&!t.colors[a]?.startsWith("#")){const e=i(t.colors[a]);t.colorReplacements[e]=t.colors[a],t.colors[a]=e}return Object.defineProperty(t,At,{enumerable:!1,writable:!1,value:!0}),t}async function Pt(e){return Array.from(new Set((await Promise.all(e.filter(e=>!Te(e)).map(async e=>await Ie(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function It(e){return(await Promise.all(e.map(async e=>xe(e)?null:vt(await Ie(e))))).filter(e=>!!e)}function Rt(e,t=3){t>3||console.trace(`[SHIKI DEPRECATE]: ${e}`)}class Tt extends Error{constructor(e){super(e),this.name="ShikiError"}}function Lt(e,t){if(!t)return e;if(t[e]){const n=/* @__PURE__ */new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new Tt(`Circular alias \`${Array.from(n).join(" -> ")} -> ${e}\``);n.add(e)}}return e}class xt extends Ce{constructor(e,t,n,r={}){super(e),s(this,"_resolvedThemes",/* @__PURE__ */new Map),s(this,"_resolvedGrammars",/* @__PURE__ */new Map),s(this,"_langMap",/* @__PURE__ */new Map),s(this,"_langGraph",/* @__PURE__ */new Map),s(this,"_textmateThemeCache",/* @__PURE__ */new WeakMap),s(this,"_loadedThemesCache",null),s(this,"_loadedLanguagesCache",null),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return"string"==typeof e?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const t=vt(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=_.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=Lt(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const n={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const s=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(s.name=e.name,this._resolvedGrammars.set(e.name,s),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(const r of t)this._resolvedGrammars.delete(r.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(r.scopeName),this._syncRegistry?._grammars?.delete(r.scopeName),this.loadLanguage(this._langMap.get(r.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const s of e)this.resolveEmbeddedLanguages(s);const t=Array.from(this._langGraph.entries()),n=t.filter(([e,t])=>!t);if(n.length){const e=t.filter(([e,t])=>{if(!t)return!1;const s=t.embeddedLanguages||t.embeddedLangs;return s?.some(e=>n.map(([e])=>e).includes(e))}).filter(e=>!n.includes(e));throw new Tt(`Missing languages ${n.map(([e])=>`\`${e}\``).join(", ")}, required by ${e.map(([e])=>`\`${e}\``).join(", ")}`)}for(const[s,r]of t)this._resolver.addLanguage(r);for(const[s,r]of t)this.loadLanguage(r)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[.../* @__PURE__ */new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);const t=e.embeddedLanguages??e.embeddedLangs;if(t)for(const n of t)this._langGraph.set(n,this._langMap.get(n))}}class Gt{constructor(e,t){s(this,"_langs",/* @__PURE__ */new Map),s(this,"_scopeToLang",/* @__PURE__ */new Map),s(this,"_injections",/* @__PURE__ */new Map),s(this,"_onigLib"),this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){const t=e.split(".");let n=[];for(let s=1;s<=t.length;s++){const e=t.slice(0,s).join(".");n=[...n,...this._injections.get(e)||[]]}return n}}let Et=0;function $t(e){Et+=1,!1!==e.warnings&&Et>=10&&Et%10==0&&console.warn(`[Shiki] ${Et} 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 t=!1;if(!e.engine)throw new Tt("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),s=(e.themes||[]).flat(1).map(vt),r=new Gt(e.engine,n),o=new xt(r,s,n,e.langAlias);let i;function a(e){if("none"===e)return{bg:"",fg:"",name:"none",settings:[],type:"dark"};u();const t=o.getTheme(e);if(!t)throw new Tt(`Theme \`${e}\` not found, you may need to load it first`);return t}function c(...e){u(),o.loadLanguages(e.flat(1))}function l(...e){u();for(const t of e.flat(1))o.loadTheme(t)}function u(){if(t)throw new Tt("Shiki instance has been disposed")}function p(){t||(t=!0,o.dispose(),Et-=1)}return{setTheme:function(e){u();const t=a(e);return i!==e&&(o.setTheme(t),i=e),{theme:t,colorMap:o.getColorMap()}},getTheme:a,getLanguage:function(e){u();const t=o.getGrammar("string"==typeof e?e:e.name);if(!t)throw new Tt(`Language \`${e}\` not found, you may need to load it first`);return t},getLoadedThemes:function(){return u(),o.getLoadedThemes()},getLoadedLanguages:function(){return u(),o.getLoadedLanguages()},resolveLangAlias:function(t){return Lt(t,e.langAlias)},loadLanguage:async function(...e){return c(await Pt(e))},loadLanguageSync:c,loadTheme:async function(...e){return u(),l(await It(e))},loadThemeSync:l,dispose:p,[Symbol.dispose]:p}}async function Bt(e){e.engine||Rt("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,s]=await Promise.all([It(e.themes||[]),Pt(e.langs||[]),e.engine]);return $t({...e,themes:t,langs:n,engine:s})}async function Mt(e){const t=await Bt(e);return{getLastGrammarState:(...e)=>function(...e){if(2===e.length)return ze(e[1]);const[t,n,s={}]=e,{lang:r="text",theme:i=t.getLoadedThemes()[0]}=s;if(Re(r)||Le(i))throw new o("Plain language does not have grammar state");if("ansi"===r)throw new o("ANSI language does not have grammar state");const{theme:a,colorMap:c}=t.setTheme(i),l=t.getLanguage(r);return new He(ct(n,l,a,c,s).stateStack,l.name,a.name)}(t,...e),codeToTokensBase:(e,n)=>it(t,e,n),codeToTokensWithThemes:(e,n)=>gt(t,e,n),codeToTokens:(e,n)=>ft(t,e,n),codeToHast:(e,n)=>_t(t,e,n),codeToHtml:(e,n)=>kt(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}export{o as ShikiError,Ge as addClassToHast,ve as applyColorReplacements,_t as codeToHast,kt as codeToHtml,ft as codeToTokens,it as codeToTokensBase,gt as codeToTokensWithThemes,Mt as createHighlighterCore,$e as createPositionConverter,Bt as createShikiInternal,$t as createShikiInternalSync,Fe as flatTokenVariants,We as getTokenStyleObject,bt as hastToHtml,Le as isNoneTheme,Re as isPlainLang,Te as isSpecialLang,xe as isSpecialTheme,Ie as normalizeGetter,vt as normalizeTheme,Ae as resolveColorReplacements,Ee as splitLines,Oe as splitToken,je as splitTokens,De as stringifyTokenStyle,Pe as toArray,ot as tokenizeAnsiWithTheme,at as tokenizeWithTheme,yt as tokensToHast,Ke as transformerDecorations,Rt as warnDeprecated};