@mastra/deployer-sandbox 0.0.0 → 0.1.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.
- package/CHANGELOG.md +58 -0
- package/LICENSE.md +30 -0
- package/dist/alias.d.ts +10 -0
- package/dist/alias.d.ts.map +1 -0
- package/dist/chunk-CSXC6CZL.cjs +115 -0
- package/dist/chunk-CSXC6CZL.cjs.map +1 -0
- package/dist/chunk-Z636GNUQ.js +101 -0
- package/dist/chunk-Z636GNUQ.js.map +1 -0
- package/dist/client/index.cjs +159 -0
- package/dist/client/index.cjs.map +1 -0
- package/dist/client/index.d.ts +98 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +155 -0
- package/dist/client/index.js.map +1 -0
- package/dist/deployer.d.ts +57 -0
- package/dist/deployer.d.ts.map +1 -0
- package/dist/engine.d.ts +19 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/index.cjs +381 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +372 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +7 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/shared.d.ts +63 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/studio/assets/CommitMono-400-Regular-DzkyLZ26.woff2 +0 -0
- package/dist/studio/assets/CommitMono-700-Regular-DmOSN4kd.woff2 +0 -0
- package/dist/studio/assets/MonaSans-VariableFont_wdth-wght-CX-7s9jm.ttf +0 -0
- package/dist/studio/assets/babel-lWBcy2sH.js +16 -0
- package/dist/studio/assets/bash-atvbtKCR.js +1 -0
- package/dist/studio/assets/core-CBT9ED6Q.js +12 -0
- package/dist/studio/assets/engine-compile-BkERmzkH.js +137 -0
- package/dist/studio/assets/engine-javascript-CSIo_1eZ.js +1 -0
- package/dist/studio/assets/estree-Dd9JfUIE.js +44 -0
- package/dist/studio/assets/github-dark-DHJKELXO.js +1 -0
- package/dist/studio/assets/github-light-DAi9KRSo.js +1 -0
- package/dist/studio/assets/index-CORJOrgI.js +2 -0
- package/dist/studio/assets/index-yUiD89B4.js +1 -0
- package/dist/studio/assets/javascript-ySlJ1b_l.js +1 -0
- package/dist/studio/assets/json-BQoSv7ci.js +1 -0
- package/dist/studio/assets/jsx-BAng5TT0.js +1 -0
- package/dist/studio/assets/livekit-client.esm-CKIgC2IJ.js +39 -0
- package/dist/studio/assets/main-BYaOwSFl.js +784 -0
- package/dist/studio/assets/markdown-UIAJJxZW.js +1 -0
- package/dist/studio/assets/preload-helper-PPVm8Dsz.js +1 -0
- package/dist/studio/assets/python-DhUJRlN_.js +1 -0
- package/dist/studio/assets/shell-CjFT_Tl9.js +1 -0
- package/dist/studio/assets/standalone-Dfz2oS5J.js +29 -0
- package/dist/studio/assets/style-DMLmyAwy.css +1 -0
- package/dist/studio/assets/tsx-B6W0miNI.js +1 -0
- package/dist/studio/assets/typescript-Dj6nwHGl.js +1 -0
- package/dist/studio/index.html +100 -0
- package/dist/studio/mastra.svg +17 -0
- package/dist/studio/routes-manifest.json +27 -0
- package/dist/types.d.ts +90 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +18 -18
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=Object.freeze(JSON.parse(`{"displayName":"Shell","name":"shellscript","patterns":[{"include":"#initial_context"}],"repository":{"alias_statement":{"begin":"(?:(?:[ \\\\t]*+)(alias)(?:[ \\\\t]*+)((?:(?:((?<!\\\\w)-\\\\w+\\\\b)(?:[ \\\\t]*+))*))(?:(?:[ \\\\t]*+)(?:((?<!\\\\w)(?:[a-zA-Z_0-9-]+)(?!\\\\w))(?:(?:(\\\\[)((?:(?:(?:(?:\\\\$?)(?:(?<!\\\\w)(?:[a-zA-Z_0-9-]+)(?!\\\\w))|@)|\\\\*)|(-?\\\\d+)))(\\\\]))?))(?:(?:(\\\\=)|(\\\\+\\\\=))|(\\\\-\\\\=))))","beginCaptures":{"1":{"name":"storage.type.alias.shell"},"2":{"patterns":[{"match":"(?<!\\\\w)-\\\\w+\\\\b","name":"string.unquoted.argument.shell constant.other.option.shell"}]},"3":{"name":"string.unquoted.argument.shell constant.other.option.shell"},"4":{"name":"variable.other.assignment.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"variable.other.assignment.shell"},"7":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"8":{"name":"punctuation.definition.array.access.shell"},"9":{"name":"keyword.operator.assignment.shell"},"10":{"name":"keyword.operator.assignment.compound.shell"},"11":{"name":"keyword.operator.assignment.compound.shell"}},"end":"(?:(?= |\\\\t|$)|(?:(?:(?:(;)|(&&))|(\\\\|\\\\|))|(&)))","endCaptures":{"1":{"name":"punctuation.terminator.statement.semicolon.shell"},"2":{"name":"punctuation.separator.statement.and.shell"},"3":{"name":"punctuation.separator.statement.or.shell"},"4":{"name":"punctuation.separator.statement.background.shell"}},"name":"meta.expression.assignment.alias.shell","patterns":[{"include":"#normal_context"}]},"argument":{"begin":"(?:[ \\\\t]++)(?!(?:&|\\\\||\\\\(|\\\\[|#|\\\\n|$|;))","beginCaptures":{},"end":"(?= |\\\\t|;|\\\\||&|$|\\\\n|\\\\)|\\\\\`)","endCaptures":{},"name":"meta.argument.shell","patterns":[{"include":"#argument_context"},{"include":"#line_continuation"}]},"argument_context":{"patterns":[{"captures":{"1":{"name":"string.unquoted.argument.shell","patterns":[{"match":"\\\\*","name":"variable.language.special.wildcard.shell"},{"include":"#variable"},{"include":"#numeric_literal"},{"captures":{"1":{"name":"constant.language.$1.shell"}},"match":"(?<!\\\\w)(\\\\b(?:true|false)\\\\b)(?!\\\\w)"}]}},"match":"(?:[ \\\\t]*+)((?:[^ \\t\\n>&;<>\\\\(\\\\)\\\\$\`\\\\\\\\\\"'<\\\\|]+)(?!>))"},{"include":"#normal_context"}]},"arithmetic_double":{"patterns":[{"begin":"\\\\(\\\\(","beginCaptures":{"0":{"name":"punctuation.section.arithmetic.double.shell"}},"end":"\\\\)(?:\\\\s*)\\\\)","endCaptures":{"0":{"name":"punctuation.section.arithmetic.double.shell"}},"name":"meta.arithmetic.shell","patterns":[{"include":"#math"},{"include":"#string"}]}]},"arithmetic_no_dollar":{"patterns":[{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.section.arithmetic.single.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.section.arithmetic.single.shell"}},"name":"meta.arithmetic.shell","patterns":[{"include":"#math"},{"include":"#string"}]}]},"array_access_inline":{"captures":{"1":{"name":"punctuation.section.array.shell"},"2":{"patterns":[{"include":"#special_expansion"},{"include":"#string"},{"include":"#variable"}]},"3":{"name":"punctuation.section.array.shell"}},"match":"(?:(\\\\[)([^\\\\[\\\\]]+)(\\\\]))"},"array_value":{"begin":"(?:[ \\\\t]*+)(?:((?<!\\\\w)(?:[a-zA-Z_0-9-]+)(?!\\\\w))(?:(?:(\\\\[)((?:(?:(?:(?:\\\\$?)(?:(?<!\\\\w)(?:[a-zA-Z_0-9-]+)(?!\\\\w))|@)|\\\\*)|(-?\\\\d+)))(\\\\]))?))(?:(?:(\\\\=)|(\\\\+\\\\=))|(\\\\-\\\\=))(?:[ \\\\t]*+)(\\\\()","beginCaptures":{"1":{"name":"variable.other.assignment.shell"},"2":{"name":"punctuation.definition.array.access.shell"},"3":{"name":"variable.other.assignment.shell"},"4":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"keyword.operator.assignment.shell"},"7":{"name":"keyword.operator.assignment.compound.shell"},"8":{"name":"keyword.operator.assignment.compound.shell"},"9":{"name":"punctuation.definition.array.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.array.shell"}},"patterns":[{"include":"#comment"},{"captures":{"1":{"name":"variable.other.assignment.array.shell entity.other.attribute-name.shell"},"2":{"name":"keyword.operator.assignment.shell punctuation.definition.assignment.shell"}},"match":"(?:((?<!\\\\w)(?:[a-zA-Z_0-9-]+)(?!\\\\w))(\\\\=))"},{"captures":{"1":{"name":"punctuation.definition.bracket.named-array.shell"},"2":{"name":"string.unquoted.shell entity.other.attribute-name.bracket.shell"},"3":{"name":"punctuation.definition.bracket.named-array.shell"},"4":{"name":"punctuation.definition.assignment.shell"}},"match":"(?:(\\\\[)(.+?)(\\\\])(\\\\=))"},{"include":"#normal_context"},{"include":"#simple_unquoted"}]},"assignment_statement":{"patterns":[{"include":"#array_value"},{"include":"#modified_assignment_statement"},{"include":"#normal_assignment_statement"}]},"basic_command_name":{"captures":{"1":{"name":"storage.modifier.$1.shell"},"2":{"name":"entity.name.function.call.shell entity.name.command.shell","patterns":[{"match":"(?<!\\\\w)(?:continue|return|break)(?!\\\\w)","name":"keyword.control.$0.shell"},{"match":"(?<!\\\\w)(?:(?:unfunction|continue|autoload|unsetopt|bindkey|builtin|getopts|command|declare|unalias|history|unlimit|typeset|suspend|source|printf|unhash|disown|ulimit|return|which|alias|break|false|print|shift|times|umask|umask|unset|read|type|exec|eval|wait|echo|dirs|jobs|kill|hash|stat|exit|test|trap|true|let|set|pwd|cd|fg|bg|fc|:|\\\\.)(?!\\\\/))(?!\\\\w)(?!-)","name":"support.function.builtin.shell"},{"include":"#variable"}]}},"match":"(?:(?:(?!(?:!|&|\\\\||\\\\(|\\\\)|\\\\{|\\\\[|<|>|#|\\\\n|$|;|[ \\\\t]))(?!nocorrect |nocorrect\\t|nocorrect$|readonly |readonly\\t|readonly$|function |function\\t|function$|foreach |foreach\\t|foreach$|coproc |coproc\\t|coproc$|logout |logout\\t|logout$|export |export\\t|export$|select |select\\t|select$|repeat |repeat\\t|repeat$|pushd |pushd\\t|pushd$|until |until\\t|until$|while |while\\t|while$|local |local\\t|local$|case |case\\t|case$|done |done\\t|done$|elif |elif\\t|elif$|else |else\\t|else$|esac |esac\\t|esac$|popd |popd\\t|popd$|then |then\\t|then$|time |time\\t|time$|for |for\\t|for$|end |end\\t|end$|fi |fi\\t|fi$|do |do\\t|do$|in |in\\t|in$|if |if\\t|if$))(?:((?<=^|;|&|[ \\\\t])(?:readonly|declare|typeset|export|local)(?=[ \\\\t]|;|&|$))|((?!\\"|'|\\\\\\\\\\\\n?$)(?:[^!'\\"<> \\\\t\\\\n\\\\r]+?)))(?:(?= |\\\\t)|(?:(?=;|\\\\||&|\\\\n|\\\\)|\\\\\`|\\\\{|\\\\}|[ \\\\t]*#|\\\\])(?<!\\\\\\\\))))","name":"meta.statement.command.name.basic.shell"},"block_comment":{"begin":"(?:(?:\\\\s*+)(\\\\/\\\\*))","beginCaptures":{"1":{"name":"punctuation.definition.comment.begin.shell"}},"end":"\\\\*\\\\/","endCaptures":{"0":{"name":"punctuation.definition.comment.end.shell"}},"name":"comment.block.shell"},"boolean":{"match":"\\\\b(?:true|false)\\\\b","name":"constant.language.$0.shell"},"case_statement":{"begin":"(?:(\\\\bcase\\\\b)(?:[ \\\\t]*+)(.+?)(?:[ \\\\t]*+)(\\\\bin\\\\b))","beginCaptures":{"1":{"name":"keyword.control.case.shell"},"2":{"patterns":[{"include":"#initial_context"}]},"3":{"name":"keyword.control.in.shell"}},"end":"\\\\besac\\\\b","endCaptures":{"0":{"name":"keyword.control.esac.shell"}},"name":"meta.case.shell","patterns":[{"include":"#comment"},{"captures":{"1":{"name":"keyword.operator.pattern.case.default.shell"}},"match":"(?:[ \\\\t]*+)(\\\\* *\\\\))"},{"begin":"(?<!\\\\))(?!(?:[ \\\\t]*+)(?:esac\\\\b|$))","beginCaptures":{},"end":"(?:(?=\\\\besac\\\\b)|(\\\\)))","endCaptures":{"1":{"name":"keyword.operator.pattern.case.shell"}},"name":"meta.case.entry.pattern.shell","patterns":[{"include":"#case_statement_context"}]},{"begin":"(?<=\\\\))","beginCaptures":{},"end":"(?:(;;)|(?=\\\\besac\\\\b))","endCaptures":{"1":{"name":"punctuation.terminator.statement.case.shell"}},"name":"meta.case.entry.body.shell","patterns":[{"include":"#typical_statements"},{"include":"#initial_context"}]}]},"case_statement_context":{"patterns":[{"match":"\\\\*","name":"variable.language.special.quantifier.star.shell keyword.operator.quantifier.star.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"},{"match":"\\\\+","name":"variable.language.special.quantifier.plus.shell keyword.operator.quantifier.plus.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"},{"match":"\\\\?","name":"variable.language.special.quantifier.question.shell keyword.operator.quantifier.question.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"},{"match":"@","name":"variable.language.special.at.shell keyword.operator.at.shell punctuation.definition.regex.at.shell"},{"match":"\\\\|","name":"keyword.operator.orvariable.language.special.or.shell keyword.operator.alternation.ruby.shell punctuation.definition.regex.alternation.shell punctuation.separator.regex.alternation.shell"},{"match":"\\\\\\\\.","name":"constant.character.escape.shell"},{"match":"(?<=\\\\tin| in| |\\\\t|;;)\\\\(","name":"keyword.operator.pattern.case.shell"},{"begin":"(?<=\\\\S)(\\\\()","beginCaptures":{"1":{"name":"punctuation.definition.group.shell punctuation.definition.regex.group.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.definition.regex.group.shell"}},"name":"meta.parenthese.shell","patterns":[{"include":"#case_statement_context"}]},{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.character-class.shell"}},"end":"\\\\]","endCaptures":{"0":{"name":"punctuation.definition.character-class.shell"}},"name":"string.regexp.character-class.shell","patterns":[{"match":"\\\\\\\\.","name":"constant.character.escape.shell"}]},{"include":"#string"},{"match":"[^) \\\\t\\\\n\\\\[\\\\?\\\\*\\\\|\\\\@]","name":"string.unquoted.pattern.shell string.regexp.unquoted.shell"}]},"command_name_range":{"begin":"\\\\G","beginCaptures":{},"end":"(?:(?= |\\\\t|;|\\\\||&|$|\\\\n|\\\\)|\\\\\`)|(?=<))","endCaptures":{},"name":"meta.statement.command.name.shell","patterns":[{"match":"(?<!\\\\w)(?:continue|return|break)(?!\\\\w)","name":"entity.name.function.call.shell entity.name.command.shell keyword.control.$0.shell"},{"match":"(?<!\\\\w)(?:(?:unfunction|continue|autoload|unsetopt|bindkey|builtin|getopts|command|declare|unalias|history|unlimit|typeset|suspend|source|printf|unhash|disown|ulimit|return|which|alias|break|false|print|shift|times|umask|umask|unset|read|type|exec|eval|wait|echo|dirs|jobs|kill|hash|stat|exit|test|trap|true|let|set|pwd|cd|fg|bg|fc|:|\\\\.)(?!\\\\/))(?!\\\\w)(?!-)","name":"entity.name.function.call.shell entity.name.command.shell support.function.builtin.shell"},{"include":"#variable"},{"captures":{"1":{"name":"entity.name.function.call.shell entity.name.command.shell"}},"match":"(?:(?<!\\\\w)(?<=\\\\G|'|\\"|\\\\}|\\\\))([^ \\\\n\\\\t\\\\r\\"'=;&\\\\|\`\\\\)\\\\{<>]+))"},{"begin":"(?:(?:\\\\G|(?<! |\\\\t|;|\\\\||&|\\\\n|\\\\{|#))(?:(\\\\$?)((?:(\\")|(')))))","beginCaptures":{"1":{"name":"meta.statement.command.name.quoted.shell punctuation.definition.string.shell entity.name.function.call.shell entity.name.command.shell"},"2":{},"3":{"name":"meta.statement.command.name.quoted.shell string.quoted.double.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell"},"4":{"name":"meta.statement.command.name.quoted.shell string.quoted.single.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell"}},"end":"(?<!\\\\G)(?<=(?:\\\\2))","endCaptures":{},"patterns":[{"include":"#continuation_of_single_quoted_command_name"},{"include":"#continuation_of_double_quoted_command_name"}]},{"include":"#line_continuation"},{"include":"#simple_unquoted"}]},"command_statement":{"begin":"(?:(?:[ \\\\t]*+)(?:(?!(?:!|&|\\\\||\\\\(|\\\\)|\\\\{|\\\\[|<|>|#|\\\\n|$|;|[ \\\\t]))(?!nocorrect |nocorrect\\t|nocorrect$|readonly |readonly\\t|readonly$|function |function\\t|function$|foreach |foreach\\t|foreach$|coproc |coproc\\t|coproc$|logout |logout\\t|logout$|export |export\\t|export$|select |select\\t|select$|repeat |repeat\\t|repeat$|pushd |pushd\\t|pushd$|until |until\\t|until$|while |while\\t|while$|local |local\\t|local$|case |case\\t|case$|done |done\\t|done$|elif |elif\\t|elif$|else |else\\t|else$|esac |esac\\t|esac$|popd |popd\\t|popd$|then |then\\t|then$|time |time\\t|time$|for |for\\t|for$|end |end\\t|end$|fi |fi\\t|fi$|do |do\\t|do$|in |in\\t|in$|if |if\\t|if$)(?!\\\\\\\\\\\\n?$)))","beginCaptures":{},"end":"(?=;|\\\\||&|\\\\n|\\\\)|\\\\\`|\\\\{|\\\\}|[ \\\\t]*#|\\\\])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.command.shell","patterns":[{"include":"#command_name_range"},{"include":"#line_continuation"},{"include":"#option"},{"include":"#argument"},{"include":"#string"},{"include":"#heredoc"}]},"comment":{"captures":{"1":{"name":"comment.line.number-sign.shell meta.shebang.shell"},"2":{"name":"punctuation.definition.comment.shebang.shell"},"3":{"name":"comment.line.number-sign.shell"},"4":{"name":"punctuation.definition.comment.shell"}},"match":"(?:(?:^|(?:[ \\\\t]++))(?:((?:(#!)(?:.*)))|((?:(#)(?:.*)))))"},"comments":{"patterns":[{"include":"#block_comment"},{"include":"#line_comment"}]},"compound-command":{"patterns":[{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"end":"\\\\]","endCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"name":"meta.scope.logical-expression.shell","patterns":[{"include":"#logical-expression"},{"include":"#initial_context"}]},{"begin":"(?<=\\\\s|^){(?=\\\\s|$)","beginCaptures":{"0":{"name":"punctuation.definition.group.shell"}},"end":"(?<=^|;)\\\\s*(})","endCaptures":{"1":{"name":"punctuation.definition.group.shell"}},"name":"meta.scope.group.shell","patterns":[{"include":"#initial_context"}]}]},"continuation_of_double_quoted_command_name":{"begin":"(?:\\\\G(?<=\\"))","beginCaptures":{},"contentName":"meta.statement.command.name.continuation string.quoted.double entity.name.function.call entity.name.command","end":"\\"","endCaptures":{"0":{"name":"string.quoted.double.shell punctuation.definition.string.end.shell entity.name.function.call.shell entity.name.command.shell"}},"patterns":[{"match":"\\\\\\\\[\\\\$\\\\n\`\\"\\\\\\\\]","name":"constant.character.escape.shell"},{"include":"#variable"},{"include":"#interpolation"}]},"continuation_of_single_quoted_command_name":{"begin":"(?:\\\\G(?<='))","beginCaptures":{},"contentName":"meta.statement.command.name.continuation string.quoted.single entity.name.function.call entity.name.command","end":"'","endCaptures":{"0":{"name":"string.quoted.single.shell punctuation.definition.string.end.shell entity.name.function.call.shell entity.name.command.shell"}}},"custom_command_names":{"patterns":[]},"custom_commands":{"patterns":[]},"double_quote_context":{"patterns":[{"match":"\\\\\\\\[\\\\$\`\\"\\\\\\\\\\\\n]","name":"constant.character.escape.shell"},{"include":"#variable"},{"include":"#interpolation"}]},"double_quote_escape_char":{"match":"\\\\\\\\[\\\\$\`\\"\\\\\\\\\\\\n]","name":"constant.character.escape.shell"},"floating_keyword":{"patterns":[{"match":"(?<=^|;|&| |\\\\t)(?:then|elif|else|done|end|do|if|fi)(?= |\\\\t|;|&|$)","name":"keyword.control.$0.shell"}]},"for_statement":{"patterns":[{"begin":"(?:(\\\\bfor\\\\b)(?:(?:[ \\\\t]*+)((?<!\\\\w)(?:[a-zA-Z_0-9-]+)(?!\\\\w))(?:[ \\\\t]*+)(\\\\bin\\\\b)))","beginCaptures":{"1":{"name":"keyword.control.for.shell"},"2":{"name":"variable.other.for.shell"},"3":{"name":"keyword.control.in.shell"}},"end":"(?=;|\\\\||&|\\\\n|\\\\)|\\\\\`|\\\\{|\\\\}|[ \\\\t]*#|\\\\])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.for.in.shell","patterns":[{"include":"#string"},{"include":"#simple_unquoted"},{"include":"#normal_context"}]},{"begin":"(\\\\bfor\\\\b)","beginCaptures":{"1":{"name":"keyword.control.for.shell"}},"end":"(?=;|\\\\||&|\\\\n|\\\\)|\\\\\`|\\\\{|\\\\}|[ \\\\t]*#|\\\\])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.for.shell","patterns":[{"include":"#arithmetic_double"},{"include":"#normal_context"}]}]},"function_definition":{"applyEndPatternLast":1,"begin":"(?:[ \\\\t]*+)(?:(?:(\\\\bfunction\\\\b)(?:[ \\\\t]*+)([^ \\\\t\\\\n\\\\r\\\\(\\\\)=\\"']+)(?:(?:(\\\\()(?:[ \\\\t]*+)(\\\\)))?))|(?:([^ \\\\t\\\\n\\\\r\\\\(\\\\)=\\"']+)(?:[ \\\\t]*+)(\\\\()(?:[ \\\\t]*+)(\\\\))))","beginCaptures":{"1":{"name":"storage.type.function.shell"},"2":{"name":"entity.name.function.shell"},"3":{"name":"punctuation.definition.arguments.shell"},"4":{"name":"punctuation.definition.arguments.shell"},"5":{"name":"entity.name.function.shell"},"6":{"name":"punctuation.definition.arguments.shell"},"7":{"name":"punctuation.definition.arguments.shell"}},"end":"(?<=\\\\}|\\\\))","endCaptures":{},"name":"meta.function.shell","patterns":[{"match":"(?:\\\\G(?:\\\\t| |\\\\n))"},{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"end":"\\\\}","endCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"name":"meta.function.body.shell","patterns":[{"include":"#initial_context"}]},{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"name":"meta.function.body.shell","patterns":[{"include":"#initial_context"}]},{"include":"#initial_context"}]},"heredoc":{"patterns":[{"begin":"(?:((?<!<)(?:<<-))(?:[ \\\\t]*+)(\\"|')(?:[ \\\\t]*+)([^\\"']+?)(?=\\\\s|;|&|<|\\"|')((?:\\\\2))(.*))","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.quote.shell"},"3":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"4":{"name":"punctuation.definition.string.heredoc.quote.shell"},"5":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.quoted.heredoc.indent.$3","end":"(?:(?:^\\\\t*)(?:\\\\3)(?=\\\\s|;|&|$))","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.$0.shell"}},"patterns":[]},{"begin":"(?:((?<!<)(?:<<)(?!<))(?:[ \\\\t]*+)(\\"|')(?:[ \\\\t]*+)([^\\"']+?)(?=\\\\s|;|&|<|\\"|')((?:\\\\2))(.*))","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.quote.shell"},"3":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"4":{"name":"punctuation.definition.string.heredoc.quote.shell"},"5":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.quoted.heredoc.no-indent.$3","end":"(?:^(?:\\\\3)(?=\\\\s|;|&|$))","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.delimiter.shell"}},"patterns":[]},{"begin":"(?:((?<!<)(?:<<-))(?:[ \\\\t]*+)([^\\"' \\\\t]+)(?=\\\\s|;|&|<|\\"|')(.*))","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"3":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.unquoted.heredoc.indent.$2","end":"(?:(?:^\\\\t*)(?:\\\\2)(?=\\\\s|;|&|$))","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.delimiter.shell"}},"patterns":[{"include":"#double_quote_escape_char"},{"include":"#variable"},{"include":"#interpolation"}]},{"begin":"(?:((?<!<)(?:<<)(?!<))(?:[ \\\\t]*+)([^\\"' \\\\t]+)(?=\\\\s|;|&|<|\\"|')(.*))","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"3":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.unquoted.heredoc.no-indent.$2","end":"(?:^(?:\\\\2)(?=\\\\s|;|&|$))","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.delimiter.shell"}},"patterns":[{"include":"#double_quote_escape_char"},{"include":"#variable"},{"include":"#interpolation"}]}]},"herestring":{"patterns":[{"begin":"(<<<)\\\\s*(('))","beginCaptures":{"1":{"name":"keyword.operator.herestring.shell"},"2":{"name":"string.quoted.single.shell"},"3":{"name":"punctuation.definition.string.begin.shell"}},"contentName":"string.quoted.single.shell","end":"(')","endCaptures":{"0":{"name":"string.quoted.single.shell"},"1":{"name":"punctuation.definition.string.end.shell"}},"name":"meta.herestring.shell"},{"begin":"(<<<)\\\\s*((\\"))","beginCaptures":{"1":{"name":"keyword.operator.herestring.shell"},"2":{"name":"string.quoted.double.shell"},"3":{"name":"punctuation.definition.string.begin.shell"}},"contentName":"string.quoted.double.shell","end":"(\\")","endCaptures":{"0":{"name":"string.quoted.double.shell"},"1":{"name":"punctuation.definition.string.end.shell"}},"name":"meta.herestring.shell","patterns":[{"include":"#double_quote_context"}]},{"captures":{"1":{"name":"keyword.operator.herestring.shell"},"2":{"name":"string.unquoted.herestring.shell","patterns":[{"include":"#initial_context"}]}},"match":"(<<<)\\\\s*(([^\\\\s)\\\\\\\\]|\\\\\\\\.)+)","name":"meta.herestring.shell"}]},"initial_context":{"patterns":[{"include":"#comment"},{"include":"#pipeline"},{"include":"#normal_statement_seperator"},{"include":"#logical_expression_double"},{"include":"#logical_expression_single"},{"include":"#assignment_statement"},{"include":"#case_statement"},{"include":"#for_statement"},{"include":"#loop"},{"include":"#function_definition"},{"include":"#line_continuation"},{"include":"#arithmetic_double"},{"include":"#misc_ranges"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#redirection"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#alias_statement"},{"include":"#normal_statement"},{"include":"#string"},{"include":"#support"}]},"inline_comment":{"captures":{"1":{"name":"comment.block.shell punctuation.definition.comment.begin.shell"},"2":{"name":"comment.block.shell"},"3":{"patterns":[{"match":"\\\\*\\\\/","name":"comment.block.shell punctuation.definition.comment.end.shell"},{"match":"\\\\*","name":"comment.block.shell"}]}},"match":"(\\\\/\\\\*)((?:(?:[^\\\\*]|(?:(?:\\\\*++)[^\\\\/]))*+)((?:(?:\\\\*++)\\\\/)))"},"interpolation":{"patterns":[{"include":"#arithmetic_dollar"},{"include":"#subshell_dollar"},{"begin":"\`","beginCaptures":{"0":{"name":"punctuation.definition.evaluation.backticks.shell"}},"end":"\`","endCaptures":{"0":{"name":"punctuation.definition.evaluation.backticks.shell"}},"name":"string.interpolated.backtick.shell","patterns":[{"match":"\\\\\\\\[\`\\\\\\\\$]","name":"constant.character.escape.shell"},{"begin":"(?<=\\\\W)(?=#)(?!#{)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.shell"}},"end":"(?!\\\\G)","patterns":[{"begin":"#","beginCaptures":{"0":{"name":"punctuation.definition.comment.shell"}},"end":"(?=\`)","name":"comment.line.number-sign.shell"}]},{"include":"#initial_context"}]}]},"keyword":{"patterns":[{"match":"(?<=^|;|&|\\\\s)(then|else|elif|fi|for|in|do|done|select|continue|esac|while|until|return)(?=\\\\s|;|&|$)","name":"keyword.control.shell"},{"match":"(?<=^|;|&|\\\\s)(?:export|declare|typeset|local|readonly)(?=\\\\s|;|&|$)","name":"storage.modifier.shell"}]},"line_comment":{"begin":"(?:\\\\s*+)(\\\\/\\\\/)","beginCaptures":{"1":{"name":"punctuation.definition.comment.shell"}},"end":"(?<=\\\\n)(?<!\\\\\\\\\\\\n)","endCaptures":{},"name":"comment.line.double-slash.shell","patterns":[{"include":"#line_continuation_character"}]},"line_continuation":{"match":"\\\\\\\\(?=\\\\n)","name":"constant.character.escape.line-continuation.shell"},"logical-expression":{"patterns":[{"include":"#arithmetic_no_dollar"},{"comment":"do we want a special rule for ( expr )?","match":"=[=~]?|!=?|<|>|&&|\\\\|\\\\|","name":"keyword.operator.logical.shell"},{"match":"(?<!\\\\S)-(nt|ot|ef|eq|ne|l[te]|g[te]|[a-hknoprstuwxzOGLSN])\\\\b","name":"keyword.operator.logical.shell"}]},"logical_expression_context":{"patterns":[{"include":"#regex_comparison"},{"include":"#arithmetic_no_dollar"},{"include":"#logical-expression"},{"include":"#logical_expression_single"},{"include":"#logical_expression_double"},{"include":"#comment"},{"include":"#boolean"},{"include":"#redirect_number"},{"include":"#numeric_literal"},{"include":"#pipeline"},{"include":"#normal_statement_seperator"},{"include":"#string"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#support"}]},"logical_expression_double":{"begin":"\\\\[\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"end":"\\\\]\\\\]","endCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"name":"meta.scope.logical-expression.shell","patterns":[{"include":"#logical_expression_context"}]},"logical_expression_single":{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"end":"\\\\]","endCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"name":"meta.scope.logical-expression.shell","patterns":[{"include":"#logical_expression_context"}]},"loop":{"patterns":[{"begin":"(?<=^|;|&|\\\\s)(for)\\\\s+(.+?)\\\\s+(in)(?=\\\\s|;|&|$)","beginCaptures":{"1":{"name":"keyword.control.shell"},"2":{"name":"variable.other.loop.shell","patterns":[{"include":"#string"}]},"3":{"name":"keyword.control.shell"}},"end":"(?<=^|;|&|\\\\s)done(?=\\\\s|;|&|$|\\\\))","endCaptures":{"0":{"name":"keyword.control.shell"}},"name":"meta.scope.for-in-loop.shell","patterns":[{"include":"#initial_context"}]},{"begin":"(?<=^|;|&|\\\\s)(while|until)(?=\\\\s|;|&|$)","beginCaptures":{"1":{"name":"keyword.control.shell"}},"end":"(?<=^|;|&|\\\\s)done(?=\\\\s|;|&|$|\\\\))","endCaptures":{"0":{"name":"keyword.control.shell"}},"name":"meta.scope.while-loop.shell","patterns":[{"include":"#initial_context"}]},{"begin":"(?<=^|;|&|\\\\s)(select)\\\\s+((?:[^\\\\s\\\\\\\\]|\\\\\\\\.)+)(?=\\\\s|;|&|$)","beginCaptures":{"1":{"name":"keyword.control.shell"},"2":{"name":"variable.other.loop.shell"}},"end":"(?<=^|;|&|\\\\s)(done)(?=\\\\s|;|&|$|\\\\))","endCaptures":{"1":{"name":"keyword.control.shell"}},"name":"meta.scope.select-block.shell","patterns":[{"include":"#initial_context"}]},{"begin":"(?<=^|;|&|\\\\s)if(?=\\\\s|;|&|$)","beginCaptures":{"0":{"name":"keyword.control.if.shell"}},"end":"(?<=^|;|&|\\\\s)fi(?=\\\\s|;|&|$)","endCaptures":{"0":{"name":"keyword.control.fi.shell"}},"name":"meta.scope.if-block.shell","patterns":[{"include":"#initial_context"}]}]},"math":{"patterns":[{"include":"#variable"},{"match":"\\\\+{1,2}|-{1,2}|!|~|\\\\*{1,2}|/|%|<[<=]?|>[>=]?|==|!=|^|\\\\|{1,2}|&{1,2}|\\\\?|\\\\:|,|=|[*/%+\\\\-&^|]=|<<=|>>=","name":"keyword.operator.arithmetic.shell"},{"match":"0[xX][0-9A-Fa-f]+","name":"constant.numeric.hex.shell"},{"match":";","name":"punctuation.separator.semicolon.range"},{"match":"0\\\\d+","name":"constant.numeric.octal.shell"},{"match":"\\\\d{1,2}#[0-9a-zA-Z@_]+","name":"constant.numeric.other.shell"},{"match":"\\\\d+","name":"constant.numeric.integer.shell"},{"match":"(?<!\\\\w)(?:[a-zA-Z_0-9]+)(?!\\\\w)","name":"variable.other.normal.shell"}]},"math_operators":{"patterns":[{"match":"\\\\+{1,2}|-{1,2}|!|~|\\\\*{1,2}|/|%|<[<=]?|>[>=]?|==|!=|^|\\\\|{1,2}|&{1,2}|\\\\?|\\\\:|,|=|[*/%+\\\\-&^|]=|<<=|>>=","name":"keyword.operator.arithmetic.shell"},{"match":"0[xX][0-9A-Fa-f]+","name":"constant.numeric.hex.shell"},{"match":"0\\\\d+","name":"constant.numeric.octal.shell"},{"match":"\\\\d{1,2}#[0-9a-zA-Z@_]+","name":"constant.numeric.other.shell"},{"match":"\\\\d+","name":"constant.numeric.integer.shell"}]},"misc_ranges":{"patterns":[{"include":"#logical_expression_single"},{"include":"#logical_expression_double"},{"include":"#subshell_dollar"},{"begin":"(?<![^ \\\\t])({)(?!\\\\w|\\\\$)","beginCaptures":{"1":{"name":"punctuation.definition.group.shell"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.group.shell"}},"name":"meta.scope.group.shell","patterns":[{"include":"#initial_context"}]}]},"modified_assignment_statement":{"begin":"(?<=^|;|&|[ \\\\t])(?:readonly|declare|typeset|export|local)(?=[ \\\\t]|;|&|$)","beginCaptures":{"0":{"name":"storage.modifier.$0.shell"}},"end":"(?=;|\\\\||&|\\\\n|\\\\)|\\\\\`|\\\\{|\\\\}|[ \\\\t]*#|\\\\])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.shell meta.expression.assignment.modified.shell","patterns":[{"match":"(?<!\\\\w)-\\\\w+\\\\b","name":"string.unquoted.argument.shell constant.other.option.shell"},{"include":"#array_value"},{"captures":{"1":{"name":"variable.other.assignment.shell"},"2":{"name":"punctuation.definition.array.access.shell"},"3":{"name":"variable.other.assignment.shell"},"4":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"keyword.operator.assignment.shell"},"7":{"name":"keyword.operator.assignment.compound.shell"},"8":{"name":"keyword.operator.assignment.compound.shell"},"9":{"name":"constant.numeric.shell constant.numeric.hex.shell"},"10":{"name":"constant.numeric.shell constant.numeric.octal.shell"},"11":{"name":"constant.numeric.shell constant.numeric.other.shell"},"12":{"name":"constant.numeric.shell constant.numeric.decimal.shell"},"13":{"name":"constant.numeric.shell constant.numeric.version.shell"},"14":{"name":"constant.numeric.shell constant.numeric.integer.shell"}},"match":"(?:((?<!\\\\w)(?:[a-zA-Z_0-9-]+)(?!\\\\w))(?:(?:(\\\\[)((?:(?:(?:(?:\\\\$?)(?:(?<!\\\\w)(?:[a-zA-Z_0-9-]+)(?!\\\\w))|@)|\\\\*)|(-?\\\\d+)))(\\\\]))?)(?:(?:(?:(\\\\=)|(\\\\+\\\\=))|(\\\\-\\\\=))?)(?:(?:(?<==| |\\\\t|^|\\\\{|\\\\(|\\\\[)(?:(?:(?:(?:(?:(0[xX][0-9A-Fa-f]+)|(0\\\\d+))|(\\\\d{1,2}#[0-9a-zA-Z@_]+))|(-?\\\\d+(?:\\\\.\\\\d+)))|(-?\\\\d+(?:\\\\.\\\\d+)+))|(-?\\\\d+))(?= |\\\\t|$|\\\\}|\\\\)|;))?))"},{"include":"#normal_context"}]},"modifiers":{"match":"(?<=^|;|&|[ \\\\t])(?:readonly|declare|typeset|export|local)(?=[ \\\\t]|;|&|$)","name":"storage.modifier.$0.shell"},"normal_assignment_statement":{"begin":"(?:[ \\\\t]*+)(?:((?<!\\\\w)(?:[a-zA-Z_0-9-]+)(?!\\\\w))(?:(?:(\\\\[)((?:(?:(?:(?:\\\\$?)(?:(?<!\\\\w)(?:[a-zA-Z_0-9-]+)(?!\\\\w))|@)|\\\\*)|(-?\\\\d+)))(\\\\]))?))(?:(?:(\\\\=)|(\\\\+\\\\=))|(\\\\-\\\\=))","beginCaptures":{"1":{"name":"variable.other.assignment.shell"},"2":{"name":"punctuation.definition.array.access.shell"},"3":{"name":"variable.other.assignment.shell"},"4":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"keyword.operator.assignment.shell"},"7":{"name":"keyword.operator.assignment.compound.shell"},"8":{"name":"keyword.operator.assignment.compound.shell"}},"end":"(?=;|\\\\||&|\\\\n|\\\\)|\\\\\`|\\\\{|\\\\}|[ \\\\t]*#|\\\\])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.expression.assignment.shell","patterns":[{"include":"#comment"},{"include":"#string"},{"include":"#normal_assignment_statement"},{"begin":"(?<= |\\\\t)(?! |\\\\t|\\\\w+=)","beginCaptures":{},"end":"(?=;|\\\\||&|\\\\n|\\\\)|\\\\\`|\\\\{|\\\\}|[ \\\\t]*#|\\\\])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.command.env.shell","patterns":[{"include":"#command_name_range"},{"include":"#line_continuation"},{"include":"#option"},{"include":"#argument"},{"include":"#string"}]},{"include":"#simple_unquoted"},{"include":"#normal_context"}]},"normal_context":{"patterns":[{"include":"#comment"},{"include":"#pipeline"},{"include":"#normal_statement_seperator"},{"include":"#misc_ranges"},{"include":"#boolean"},{"include":"#redirect_number"},{"include":"#numeric_literal"},{"include":"#string"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#redirection"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#support"},{"include":"#parenthese"}]},"normal_statement":{"begin":"(?:(?!^[ \\\\t]*+$)(?:(?<=^until | until |\\\\tuntil |^while | while |\\\\twhile |^elif | elif |\\\\telif |^else | else |\\\\telse |^then | then |\\\\tthen |^do | do |\\\\tdo |^if | if |\\\\tif )|(?<=(?:^|;|\\\\||&|!|\\\\(|\\\\{|\\\\\`)))(?:[ \\\\t]*+)(?!nocorrect\\\\W|nocorrect\\\\$|function\\\\W|function\\\\$|foreach\\\\W|foreach\\\\$|repeat\\\\W|repeat\\\\$|logout\\\\W|logout\\\\$|coproc\\\\W|coproc\\\\$|select\\\\W|select\\\\$|while\\\\W|while\\\\$|pushd\\\\W|pushd\\\\$|until\\\\W|until\\\\$|case\\\\W|case\\\\$|done\\\\W|done\\\\$|elif\\\\W|elif\\\\$|else\\\\W|else\\\\$|esac\\\\W|esac\\\\$|popd\\\\W|popd\\\\$|then\\\\W|then\\\\$|time\\\\W|time\\\\$|for\\\\W|for\\\\$|end\\\\W|end\\\\$|fi\\\\W|fi\\\\$|do\\\\W|do\\\\$|in\\\\W|in\\\\$|if\\\\W|if\\\\$))","beginCaptures":{},"end":"(?=;|\\\\||&|\\\\n|\\\\)|\\\\\`|\\\\{|\\\\}|[ \\\\t]*#|\\\\])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.shell","patterns":[{"include":"#typical_statements"}]},"normal_statement_seperator":{"captures":{"1":{"name":"punctuation.terminator.statement.semicolon.shell"},"2":{"name":"punctuation.separator.statement.and.shell"},"3":{"name":"punctuation.separator.statement.or.shell"},"4":{"name":"punctuation.separator.statement.background.shell"}},"match":"(?:(?:(?:(;)|(&&))|(\\\\|\\\\|))|(&))"},"numeric_literal":{"captures":{"1":{"name":"constant.numeric.shell constant.numeric.hex.shell"},"2":{"name":"constant.numeric.shell constant.numeric.octal.shell"},"3":{"name":"constant.numeric.shell constant.numeric.other.shell"},"4":{"name":"constant.numeric.shell constant.numeric.decimal.shell"},"5":{"name":"constant.numeric.shell constant.numeric.version.shell"},"6":{"name":"constant.numeric.shell constant.numeric.integer.shell"}},"match":"(?<==| |\\\\t|^|\\\\{|\\\\(|\\\\[)(?:(?:(?:(?:(?:(0[xX][0-9A-Fa-f]+)|(0\\\\d+))|(\\\\d{1,2}#[0-9a-zA-Z@_]+))|(-?\\\\d+(?:\\\\.\\\\d+)))|(-?\\\\d+(?:\\\\.\\\\d+)+))|(-?\\\\d+))(?= |\\\\t|$|\\\\}|\\\\)|;)"},"option":{"begin":"(?:(?:[ \\\\t]++)(-)((?!(?:!|&|\\\\||\\\\(|\\\\)|\\\\{|\\\\[|<|>|#|\\\\n|$|;|[ \\\\t]))))","beginCaptures":{"1":{"name":"string.unquoted.argument.shell constant.other.option.dash.shell"},"2":{"name":"string.unquoted.argument.shell constant.other.option.shell"}},"contentName":"string.unquoted.argument constant.other.option","end":"(?:(?=[ \\\\t])|(?:(?=;|\\\\||&|\\\\n|\\\\)|\\\\\`|\\\\{|\\\\}|[ \\\\t]*#|\\\\])(?<!\\\\\\\\)))","endCaptures":{},"patterns":[{"include":"#option_context"}]},"option_context":{"patterns":[{"include":"#misc_ranges"},{"include":"#string"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#redirection"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#support"}]},"parenthese":{"patterns":[{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.section.parenthese.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.section.parenthese.shell"}},"name":"meta.parenthese.group.shell","patterns":[{"include":"#initial_context"}]}]},"pathname":{"patterns":[{"match":"(?<=\\\\s|:|=|^)~","name":"keyword.operator.tilde.shell"},{"match":"\\\\*|\\\\?","name":"keyword.operator.glob.shell"},{"begin":"([?*+@!])(\\\\()","beginCaptures":{"1":{"name":"keyword.operator.extglob.shell"},"2":{"name":"punctuation.definition.extglob.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.extglob.shell"}},"name":"meta.structure.extglob.shell","patterns":[{"include":"#initial_context"}]}]},"pipeline":{"patterns":[{"match":"(?<=^|;|&|\\\\s)(time)(?=\\\\s|;|&|$)","name":"keyword.other.shell"},{"match":"[|!]","name":"keyword.operator.pipe.shell"}]},"redirect_fix":{"captures":{"1":{"name":"keyword.operator.redirect.shell"},"2":{"name":"string.unquoted.argument.shell"}},"match":"(?:(>>?)(?:[ \\\\t]*+)([^ \\t\\n>&;<>\\\\(\\\\)\\\\$\`\\\\\\\\\\"'<\\\\|]+))"},"redirect_number":{"captures":{"1":{"name":"keyword.operator.redirect.stdout.shell"},"2":{"name":"keyword.operator.redirect.stderr.shell"},"3":{"name":"keyword.operator.redirect.$3.shell"}},"match":"(?<=[ \\\\t])(?:(?:(1)|(2)|(\\\\d+))(?=>))"},"redirection":{"patterns":[{"begin":"[><]\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.interpolated.process-substitution.shell","patterns":[{"include":"#initial_context"}]},{"match":"(?<![<>])(&>|\\\\d*>&\\\\d*|\\\\d*(>>|>|<)|\\\\d*<&|\\\\d*<>)(?![<>])","name":"keyword.operator.redirect.shell"}]},"regex_comparison":{"match":"\\\\=~","name":"keyword.operator.logical.regex.shell"},"regexp":{"patterns":[{"match":"(?:.+)"}]},"simple_options":{"captures":{"0":{"patterns":[{"captures":{"1":{"name":"string.unquoted.argument.shell constant.other.option.dash.shell"},"2":{"name":"string.unquoted.argument.shell constant.other.option.shell"}},"match":"(?:[ \\\\t]++)(\\\\-)(\\\\w+)"}]}},"match":"(?:(?:[ \\\\t]++)\\\\-(?:\\\\w+))*"},"simple_unquoted":{"match":"[^ \\\\t\\\\n>&;<>\\\\(\\\\)\\\\$\`\\\\\\\\\\"'<\\\\|]","name":"string.unquoted.shell"},"special_expansion":{"match":"!|:[-=?]?|\\\\*|@|##|#|%%|%|\\\\/","name":"keyword.operator.expansion.shell"},"start_of_command":{"match":"(?:(?:[ \\\\t]*+)(?:(?!(?:!|&|\\\\||\\\\(|\\\\)|\\\\{|\\\\[|<|>|#|\\\\n|$|;|[ \\\\t]))(?!nocorrect |nocorrect\\t|nocorrect$|readonly |readonly\\t|readonly$|function |function\\t|function$|foreach |foreach\\t|foreach$|coproc |coproc\\t|coproc$|logout |logout\\t|logout$|export |export\\t|export$|select |select\\t|select$|repeat |repeat\\t|repeat$|pushd |pushd\\t|pushd$|until |until\\t|until$|while |while\\t|while$|local |local\\t|local$|case |case\\t|case$|done |done\\t|done$|elif |elif\\t|elif$|else |else\\t|else$|esac |esac\\t|esac$|popd |popd\\t|popd$|then |then\\t|then$|time |time\\t|time$|for |for\\t|for$|end |end\\t|end$|fi |fi\\t|fi$|do |do\\t|do$|in |in\\t|in$|if |if\\t|if$)(?!\\\\\\\\\\\\n?$)))"},"string":{"patterns":[{"match":"\\\\\\\\.","name":"constant.character.escape.shell"},{"begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"'","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.quoted.single.shell"},{"begin":"\\\\$?\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.quoted.double.shell","patterns":[{"match":"\\\\\\\\[\\\\$\\\\n\`\\"\\\\\\\\]","name":"constant.character.escape.shell"},{"include":"#variable"},{"include":"#interpolation"}]},{"begin":"\\\\$'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"'","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.quoted.single.dollar.shell","patterns":[{"match":"\\\\\\\\(?:a|b|e|f|n|r|t|v|\\\\\\\\|')","name":"constant.character.escape.ansi-c.shell"},{"match":"\\\\\\\\[0-9]{3}\\"","name":"constant.character.escape.octal.shell"},{"match":"\\\\\\\\x[0-9a-fA-F]{2}\\"","name":"constant.character.escape.hex.shell"},{"match":"\\\\\\\\c.\\"","name":"constant.character.escape.control-char.shell"}]}]},"subshell_dollar":{"patterns":[{"begin":"(?:\\\\$\\\\()","beginCaptures":{"0":{"name":"punctuation.definition.subshell.single.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.subshell.single.shell"}},"name":"meta.scope.subshell","patterns":[{"include":"#parenthese"},{"include":"#initial_context"}]}]},"support":{"patterns":[{"match":"(?<=^|;|&|\\\\s)(?::|\\\\.)(?=\\\\s|;|&|$)","name":"support.function.builtin.shell"}]},"typical_statements":{"patterns":[{"include":"#assignment_statement"},{"include":"#case_statement"},{"include":"#for_statement"},{"include":"#while_statement"},{"include":"#function_definition"},{"include":"#command_statement"},{"include":"#line_continuation"},{"include":"#arithmetic_double"},{"include":"#normal_context"}]},"variable":{"patterns":[{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.parameter.positional.all.shell"},"2":{"name":"variable.parameter.positional.all.shell"}},"match":"(?:(\\\\$)(\\\\@(?!\\\\w)))"},{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.parameter.positional.shell"},"2":{"name":"variable.parameter.positional.shell"}},"match":"(?:(\\\\$)([0-9](?!\\\\w)))"},{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.language.special.shell"},"2":{"name":"variable.language.special.shell"}},"match":"(?:(\\\\$)([-*#?$!0_](?!\\\\w)))"},{"begin":"(?:(\\\\$)(\\\\{)(?:[ \\\\t]*+)(?=\\\\d))","beginCaptures":{"1":{"name":"punctuation.definition.variable.shell variable.parameter.positional.shell"},"2":{"name":"punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell variable.parameter.positional.shell"}},"contentName":"meta.parameter-expansion","end":"\\\\}","endCaptures":{"0":{"name":"punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell variable.parameter.positional.shell"}},"patterns":[{"include":"#special_expansion"},{"include":"#array_access_inline"},{"match":"[0-9]+","name":"variable.parameter.positional.shell"},{"match":"(?<!\\\\w)(?:[a-zA-Z_0-9-]+)(?!\\\\w)","name":"variable.other.normal.shell"},{"include":"#variable"},{"include":"#string"}]},{"begin":"(?:(\\\\$)(\\\\{))","beginCaptures":{"1":{"name":"punctuation.definition.variable.shell"},"2":{"name":"punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell"}},"contentName":"meta.parameter-expansion","end":"\\\\}","endCaptures":{"0":{"name":"punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell"}},"patterns":[{"include":"#special_expansion"},{"include":"#array_access_inline"},{"match":"(?<!\\\\w)(?:[a-zA-Z_0-9-]+)(?!\\\\w)","name":"variable.other.normal.shell"},{"include":"#variable"},{"include":"#string"}]},{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.other.normal.shell"},"2":{"name":"variable.other.normal.shell"}},"match":"(?:(\\\\$)((?:\\\\w+)(?!\\\\w)))"}]},"while_statement":{"patterns":[{"begin":"(\\\\bwhile\\\\b)","beginCaptures":{"1":{"name":"keyword.control.while.shell"}},"end":"(?=;|\\\\||&|\\\\n|\\\\)|\\\\\`|\\\\{|\\\\}|[ \\\\t]*#|\\\\])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.while.shell","patterns":[{"include":"#line_continuation"},{"include":"#math_operators"},{"include":"#option"},{"include":"#simple_unquoted"},{"include":"#normal_context"},{"include":"#string"}]}]}},"scopeName":"source.shell","aliases":["bash","sh","shell","zsh"]}`)),n=[e];export{n as default};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{w as Be,s as gt,f as Xt,a as Zt,b as en,c as Je,h as tn}from"./main-BYaOwSFl.js";import{c as nn,d as rn}from"./engine-compile-BkERmzkH.js";import"./preload-helper-PPVm8Dsz.js";let O=class extends Error{constructor(e){super(e),this.name="ShikiError"}},Me=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function sn(){return 2147483648}function an(){return typeof performance<"u"?performance.now():Date.now()}const on=(n,e)=>n+(e-n%e)%e;async function cn(n){let e,t;const r={};function s(f){t=f,r.HEAPU8=new Uint8Array(f),r.HEAPU32=new Uint32Array(f)}function i(f,d,b){r.HEAPU8.copyWithin(f,d,d+b)}function a(f){try{return e.grow(f-t.byteLength+65535>>>16),s(e.buffer),1}catch{}}function c(f){const d=r.HEAPU8.length;f=f>>>0;const b=sn();if(f>b)return!1;for(let m=1;m<=4;m*=2){let _=d*(1+.2/m);_=Math.min(_,f+100663296);const p=Math.min(b,on(Math.max(f,_),65536));if(a(p))return!0}return!1}const o=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function l(f,d,b=1024){const m=d+b;let _=d;for(;f[_]&&!(_>=m);)++_;if(_-d>16&&f.buffer&&o)return o.decode(f.subarray(d,_));let p="";for(;d<_;){let y=f[d++];if(!(y&128)){p+=String.fromCharCode(y);continue}const w=f[d++]&63;if((y&224)===192){p+=String.fromCharCode((y&31)<<6|w);continue}const S=f[d++]&63;if((y&240)===224?y=(y&15)<<12|w<<6|S:y=(y&7)<<18|w<<12|S<<6|f[d++]&63,y<65536)p+=String.fromCharCode(y);else{const v=y-65536;p+=String.fromCharCode(55296|v>>10,56320|v&1023)}}return p}function u(f,d){return f?l(r.HEAPU8,f,d):""}const h={emscripten_get_now:an,emscripten_memcpy_big:i,emscripten_resize_heap:c,fd_write:()=>0};async function g(){const d=await n({env:h,wasi_snapshot_preview1:h});e=d.memory,s(e.buffer),Object.assign(r,d),r.UTF8ToString=u}return await g(),r}var ln=Object.defineProperty,un=(n,e,t)=>e in n?ln(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,C=(n,e,t)=>(un(n,typeof e!="symbol"?e+"":e,t),t);let R=null;function hn(n){throw new Me(n.UTF8ToString(n.getLastOnigError()))}class me{constructor(e){C(this,"utf16Length"),C(this,"utf8Length"),C(this,"utf16Value"),C(this,"utf8Value"),C(this,"utf16OffsetToUtf8"),C(this,"utf8OffsetToUtf16");const t=e.length,r=me._utf8ByteLength(e),s=r!==t,i=s?new Uint32Array(t+1):null;s&&(i[t]=r);const a=s?new Uint32Array(r+1):null;s&&(a[r]=t);const c=new Uint8Array(r);let o=0;for(let l=0;l<t;l++){const u=e.charCodeAt(l);let h=u,g=!1;if(u>=55296&&u<=56319&&l+1<t){const f=e.charCodeAt(l+1);f>=56320&&f<=57343&&(h=(u-55296<<10)+65536|f-56320,g=!0)}s&&(i[l]=o,g&&(i[l+1]=o),h<=127?a[o+0]=l:h<=2047?(a[o+0]=l,a[o+1]=l):h<=65535?(a[o+0]=l,a[o+1]=l,a[o+2]=l):(a[o+0]=l,a[o+1]=l,a[o+2]=l,a[o+3]=l)),h<=127?c[o++]=h:h<=2047?(c[o++]=192|(h&1984)>>>6,c[o++]=128|(h&63)>>>0):h<=65535?(c[o++]=224|(h&61440)>>>12,c[o++]=128|(h&4032)>>>6,c[o++]=128|(h&63)>>>0):(c[o++]=240|(h&1835008)>>>18,c[o++]=128|(h&258048)>>>12,c[o++]=128|(h&4032)>>>6,c[o++]=128|(h&63)>>>0),g&&l++}this.utf16Length=t,this.utf8Length=r,this.utf16Value=e,this.utf8Value=c,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=a}static _utf8ByteLength(e){let t=0;for(let r=0,s=e.length;r<s;r++){const i=e.charCodeAt(r);let a=i,c=!1;if(i>=55296&&i<=56319&&r+1<s){const o=e.charCodeAt(r+1);o>=56320&&o<=57343&&(a=(i-55296<<10)+65536|o-56320,c=!0)}a<=127?t+=1:a<=2047?t+=2:a<=65535?t+=3:t+=4,c&&r++}return t}createString(e){const t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}}const E=class{constructor(n){if(C(this,"id",++E.LAST_ID),C(this,"_onigBinding"),C(this,"content"),C(this,"utf16Length"),C(this,"utf8Length"),C(this,"utf16OffsetToUtf8"),C(this,"utf8OffsetToUtf16"),C(this,"ptr"),!R)throw new Me("Must invoke loadWasm first.");this._onigBinding=R,this.content=n;const e=new me(n);this.utf16Length=e.utf16Length,this.utf8Length=e.utf8Length,this.utf16OffsetToUtf8=e.utf16OffsetToUtf8,this.utf8OffsetToUtf16=e.utf8OffsetToUtf16,this.utf8Length<1e4&&!E._sharedPtrInUse?(E._sharedPtr||(E._sharedPtr=R.omalloc(1e4)),E._sharedPtrInUse=!0,R.HEAPU8.set(e.utf8Value,E._sharedPtr),this.ptr=E._sharedPtr):this.ptr=e.createString(R)}convertUtf8OffsetToUtf16(n){return this.utf8OffsetToUtf16?n<0?0:n>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[n]:n}convertUtf16OffsetToUtf8(n){return this.utf16OffsetToUtf8?n<0?0:n>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[n]:n}dispose(){this.ptr===E._sharedPtr?E._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let X=E;C(X,"LAST_ID",0);C(X,"_sharedPtr",0);C(X,"_sharedPtrInUse",!1);class fn{constructor(e){if(C(this,"_onigBinding"),C(this,"_ptr"),!R)throw new Me("Must invoke loadWasm first.");const t=[],r=[];for(let c=0,o=e.length;c<o;c++){const l=new me(e[c]);t[c]=l.createString(R),r[c]=l.utf8Length}const s=R.omalloc(4*e.length);R.HEAPU32.set(t,s/4);const i=R.omalloc(4*e.length);R.HEAPU32.set(r,i/4);const a=R.createOnigScanner(s,i,e.length);for(let c=0,o=e.length;c<o;c++)R.ofree(t[c]);R.ofree(i),R.ofree(s),a===0&&hn(R),this._onigBinding=R,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,r){let s=0;if(typeof r=="number"&&(s=r),typeof e=="string"){e=new X(e);const i=this._findNextMatchSync(e,t,!1,s);return e.dispose(),i}return this._findNextMatchSync(e,t,!1,s)}_findNextMatchSync(e,t,r,s){const i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),s);if(a===0)return null;const c=i.HEAPU32;let o=a/4;const l=c[o++],u=c[o++],h=[];for(let g=0;g<u;g++){const f=e.convertUtf8OffsetToUtf16(c[o++]),d=e.convertUtf8OffsetToUtf16(c[o++]);h[g]={start:f,end:d,length:d-f}}return{index:l,captureIndices:h}}}function dn(n){return typeof n.instantiator=="function"}function gn(n){return typeof n.default=="function"}function mn(n){return typeof n.data<"u"}function pn(n){return typeof Response<"u"&&n instanceof Response}function _n(n){return typeof ArrayBuffer<"u"&&(n instanceof ArrayBuffer||ArrayBuffer.isView(n))||typeof Buffer<"u"&&Buffer.isBuffer?.(n)||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&n instanceof Uint32Array}let ee;function mt(n){if(ee)return ee;async function e(){R=await cn(async t=>{let r=n;return r=await r,typeof r=="function"&&(r=await r(t)),typeof r=="function"&&(r=await r(t)),dn(r)?r=await r.instantiator(t):gn(r)?r=await r.default(t):(mn(r)&&(r=r.data),pn(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await yn(r)(t):r=await bn(r)(t):_n(r)?r=await we(r)(t):r instanceof WebAssembly.Module?r=await we(r)(t):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await we(r.default)(t))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return ee=e(),ee}function we(n){return e=>WebAssembly.instantiate(n,e)}function yn(n){return e=>WebAssembly.instantiateStreaming(n,e)}function bn(n){return async e=>{const t=await n.arrayBuffer();return WebAssembly.instantiate(t,e)}}let Sn;function wn(){return Sn}async function $e(n){return n&&await mt(n),{createScanner(e){return new fn(e.map(t=>typeof t=="string"?t:t.source))},createString(e){return new X(e)}}}let se=!1,pt=!1;function Ks(n=!0,e=!1){se=n,pt=e}function I(n,e=3){if(se&&!(typeof se=="number"&&e>se)){if(pt)throw new Error(`[SHIKI DEPRECATE]: ${n}`);console.trace(`[SHIKI DEPRECATE]: ${n}`)}}function Cn(n){return je(n)}function je(n){return Array.isArray(n)?kn(n):n instanceof RegExp?n:typeof n=="object"?Rn(n):n}function kn(n){let e=[];for(let t=0,r=n.length;t<r;t++)e[t]=je(n[t]);return e}function Rn(n){let e={};for(let t in n)e[t]=je(n[t]);return e}function _t(n,...e){return e.forEach(t=>{for(let r in t)n[r]=t[r]}),n}function yt(n){const e=~n.lastIndexOf("/")||~n.lastIndexOf("\\");return e===0?n:~e===n.length-1?yt(n.substring(0,n.length-1)):n.substr(~e+1)}var Ce=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,te=class{static hasCaptures(n){return n===null?!1:(Ce.lastIndex=0,Ce.test(n))}static replaceCaptures(n,e,t){return n.replace(Ce,(r,s,i,a)=>{let c=t[parseInt(s||i,10)];if(c){let o=e.substring(c.start,c.end);for(;o[0]===".";)o=o.substring(1);switch(a){case"downcase":return o.toLowerCase();case"upcase":return o.toUpperCase();default:return o}}else return r})}};function bt(n,e){return n<e?-1:n>e?1:0}function St(n,e){if(n===null&&e===null)return 0;if(!n)return-1;if(!e)return 1;let t=n.length,r=e.length;if(t===r){for(let s=0;s<t;s++){let i=bt(n[s],e[s]);if(i!==0)return i}return 0}return t-r}function Ye(n){return!!(/^#[0-9a-f]{6}$/i.test(n)||/^#[0-9a-f]{8}$/i.test(n)||/^#[0-9a-f]{3}$/i.test(n)||/^#[0-9a-f]{4}$/i.test(n))}function wt(n){return n.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Ct=class{constructor(n){this.fn=n}cache=new Map;get(n){if(this.cache.has(n))return this.cache.get(n);const e=this.fn(n);return this.cache.set(n,e),e}},oe=class{constructor(n,e,t){this._colorMap=n,this._defaults=e,this._root=t}static createFromRawTheme(n,e){return this.createFromParsedTheme(An(n),e)}static createFromParsedTheme(n,e){return In(n,e)}_cachedMatchRoot=new Ct(n=>this._root.match(n));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(n){if(n===null)return this._defaults;const e=n.scopeName,r=this._cachedMatchRoot.get(e).find(s=>Nn(n.parent,s.parentScopes));return r?new kt(r.fontStyle,r.foreground,r.background):null}},ke=class ie{constructor(e,t){this.parent=e,this.scopeName=t}static push(e,t){for(const r of t)e=new ie(e,r);return e}static from(...e){let t=null;for(let r=0;r<e.length;r++)t=new ie(t,e[r]);return t}push(e){return new ie(this,e)}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?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const t=[];let r=this;for(;r&&r!==e;)t.push(r.scopeName),r=r.parent;return r===e?t.reverse():void 0}};function Nn(n,e){if(e.length===0)return!0;for(let t=0;t<e.length;t++){let r=e[t],s=!1;if(r===">"){if(t===e.length-1)return!1;r=e[++t],s=!0}for(;n&&!Tn(n.scopeName,r);){if(s)return!1;n=n.parent}if(!n)return!1;n=n.parent}return!0}function Tn(n,e){return e===n||n.startsWith(e)&&n[e.length]==="."}var kt=class{constructor(n,e,t){this.fontStyle=n,this.foregroundId=e,this.backgroundId=t}};function An(n){if(!n)return[];if(!n.settings||!Array.isArray(n.settings))return[];let e=n.settings,t=[],r=0;for(let s=0,i=e.length;s<i;s++){let a=e[s];if(!a.settings)continue;let c;if(typeof a.scope=="string"){let h=a.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),c=h.split(",")}else Array.isArray(a.scope)?c=a.scope:c=[""];let o=-1;if(typeof a.settings.fontStyle=="string"){o=0;let h=a.settings.fontStyle.split(" ");for(let g=0,f=h.length;g<f;g++)switch(h[g]){case"italic":o=o|1;break;case"bold":o=o|2;break;case"underline":o=o|4;break;case"strikethrough":o=o|8;break}}let l=null;typeof a.settings.foreground=="string"&&Ye(a.settings.foreground)&&(l=a.settings.foreground);let u=null;typeof a.settings.background=="string"&&Ye(a.settings.background)&&(u=a.settings.background);for(let h=0,g=c.length;h<g;h++){let d=c[h].trim().split(" "),b=d[d.length-1],m=null;d.length>1&&(m=d.slice(0,d.length-1),m.reverse()),t[r++]=new vn(b,m,s,o,l,u)}}return t}var vn=class{constructor(n,e,t,r,s,i){this.scope=n,this.parentScopes=e,this.index=t,this.fontStyle=r,this.foreground=s,this.background=i}},x=(n=>(n[n.NotSet=-1]="NotSet",n[n.None=0]="None",n[n.Italic=1]="Italic",n[n.Bold=2]="Bold",n[n.Underline=4]="Underline",n[n.Strikethrough=8]="Strikethrough",n))(x||{});function In(n,e){n.sort((o,l)=>{let u=bt(o.scope,l.scope);return u!==0||(u=St(o.parentScopes,l.parentScopes),u!==0)?u:o.index-l.index});let t=0,r="#000000",s="#ffffff";for(;n.length>=1&&n[0].scope==="";){let o=n.shift();o.fontStyle!==-1&&(t=o.fontStyle),o.foreground!==null&&(r=o.foreground),o.background!==null&&(s=o.background)}let i=new En(e),a=new kt(t,i.getId(r),i.getId(s)),c=new Ln(new ve(0,null,-1,0,0),[]);for(let o=0,l=n.length;o<l;o++){let u=n[o];c.insert(0,u.scope,u.parentScopes,u.fontStyle,i.getId(u.foreground),i.getId(u.background))}return new oe(i,a,c)}var En=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(n){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(n)){this._isFrozen=!0;for(let e=0,t=n.length;e<t;e++)this._color2id[n[e]]=e,this._id2color[e]=n[e]}else this._isFrozen=!1}getId(n){if(n===null)return 0;n=n.toUpperCase();let e=this._color2id[n];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${n}`);return e=++this._lastColorId,this._color2id[n]=e,this._id2color[e]=n,e}getColorMap(){return this._id2color.slice(0)}},Pn=Object.freeze([]),ve=class Rt{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,r,s,i){this.scopeDepth=e,this.parentScopes=t||Pn,this.fontStyle=r,this.foreground=s,this.background=i}clone(){return new Rt(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let r=0,s=e.length;r<s;r++)t[r]=e[r].clone();return t}acceptOverwrite(e,t,r,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},Ln=class Ie{constructor(e,t=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let r=0,s=0;for(;e.parentScopes[r]===">"&&r++,t.parentScopes[s]===">"&&s++,!(r>=e.parentScopes.length||s>=t.parentScopes.length);){const i=t.parentScopes[s].length-e.parentScopes[r].length;if(i!==0)return i;r++,s++}return t.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,i;if(r===-1?(s=e,i=""):(s=e.substring(0,r),i=e.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(i)}const t=this._rulesWithParentScopes.concat(this._mainRule);return t.sort(Ie._cmpBySpecificity),t}insert(e,t,r,s,i,a){if(t===""){this._doInsertHere(e,r,s,i,a);return}let c=t.indexOf("."),o,l;c===-1?(o=t,l=""):(o=t.substring(0,c),l=t.substring(c+1));let u;this._children.hasOwnProperty(o)?u=this._children[o]:(u=new Ie(this._mainRule.clone(),ve.cloneArr(this._rulesWithParentScopes)),this._children[o]=u),u.insert(e+1,l,r,s,i,a)}_doInsertHere(e,t,r,s,i){if(t===null){this._mainRule.acceptOverwrite(e,r,s,i);return}for(let a=0,c=this._rulesWithParentScopes.length;a<c;a++){let o=this._rulesWithParentScopes[a];if(St(o.parentScopes,t)===0){o.acceptOverwrite(e,r,s,i);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new ve(e,t,r,s,i))}},W=class A{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const t=A.getLanguageId(e),r=A.getTokenType(e),s=A.getFontStyle(e),i=A.getForeground(e),a=A.getBackground(e);console.log({languageId:t,tokenType:r,fontStyle:s,foreground:i,background:a})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,t,r,s,i,a,c){let o=A.getLanguageId(e),l=A.getTokenType(e),u=A.containsBalancedBrackets(e)?1:0,h=A.getFontStyle(e),g=A.getForeground(e),f=A.getBackground(e);return t!==0&&(o=t),r!==8&&(l=r),s!==null&&(u=s?1:0),i!==-1&&(h=i),a!==0&&(g=a),c!==0&&(f=c),(o<<0|l<<8|u<<10|h<<11|g<<15|f<<24)>>>0}};function ce(n,e){const t=[],r=xn(n);let s=r.next();for(;s!==null;){let o=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":o=1;break;case"L":o=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let l=a();if(t.push({matcher:l,priority:o}),s!==",")break;s=r.next()}return t;function i(){if(s==="-"){s=r.next();const o=i();return l=>!!o&&!o(l)}if(s==="("){s=r.next();const o=c();return s===")"&&(s=r.next()),o}if(Qe(s)){const o=[];do o.push(s),s=r.next();while(Qe(s));return l=>e(o,l)}return null}function a(){const o=[];let l=i();for(;l;)o.push(l),l=i();return u=>o.every(h=>h(u))}function c(){const o=[];let l=a();for(;l&&(o.push(l),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");l=a()}return u=>o.some(h=>h(u))}}function Qe(n){return!!n&&!!n.match(/[\w\.:]+/)}function xn(n){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,t=e.exec(n);return{next:()=>{if(!t)return null;const r=t[0];return t=e.exec(n),r}}}function Nt(n){typeof n.dispose=="function"&&n.dispose()}var z=class{constructor(n){this.scopeName=n}toKey(){return this.scopeName}},On=class{constructor(n,e){this.scopeName=n,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},Gn=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(n){const e=n.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(n))}},Bn=class{constructor(n,e){this.repo=n,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new z(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const n=this.Q;this.Q=[];const e=new Gn;for(const t of n)Mn(t,this.initialScopeName,this.repo,e);for(const t of e.references)if(t instanceof z){if(this.seenFullScopeRequests.has(t.scopeName))continue;this.seenFullScopeRequests.add(t.scopeName),this.Q.push(t)}else{if(this.seenFullScopeRequests.has(t.scopeName)||this.seenPartialScopeRequests.has(t.toKey()))continue;this.seenPartialScopeRequests.add(t.toKey()),this.Q.push(t)}}};function Mn(n,e,t,r){const s=t.lookup(n.scopeName);if(!s){if(n.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const i=t.lookup(e);n instanceof z?ae({baseGrammar:i,selfGrammar:s},r):Ee(n.ruleName,{baseGrammar:i,selfGrammar:s,repository:s.repository},r);const a=t.injections(n.scopeName);if(a)for(const c of a)r.add(new z(c))}function Ee(n,e,t){if(e.repository&&e.repository[n]){const r=e.repository[n];le([r],e,t)}}function ae(n,e){n.selfGrammar.patterns&&Array.isArray(n.selfGrammar.patterns)&&le(n.selfGrammar.patterns,{...n,repository:n.selfGrammar.repository},e),n.selfGrammar.injections&&le(Object.values(n.selfGrammar.injections),{...n,repository:n.selfGrammar.repository},e)}function le(n,e,t){for(const r of n){if(t.visitedRule.has(r))continue;t.visitedRule.add(r);const s=r.repository?_t({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&le(r.patterns,{...e,repository:s},t);const i=r.include;if(!i)continue;const a=Tt(i);switch(a.kind){case 0:ae({...e,selfGrammar:e.baseGrammar},t);break;case 1:ae(e,t);break;case 2:Ee(a.ruleName,{...e,repository:s},t);break;case 3:case 4:const c=a.scopeName===e.selfGrammar.scopeName?e.selfGrammar:a.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(c){const o={baseGrammar:e.baseGrammar,selfGrammar:c,repository:s};a.kind===4?Ee(a.ruleName,o,t):ae(o,t)}else a.kind===4?t.add(new On(a.scopeName,a.ruleName)):t.add(new z(a.scopeName));break}}}var $n=class{kind=0},jn=class{kind=1},Un=class{constructor(n){this.ruleName=n}kind=2},Wn=class{constructor(n){this.scopeName=n}kind=3},Dn=class{constructor(n,e){this.scopeName=n,this.ruleName=e}kind=4};function Tt(n){if(n==="$base")return new $n;if(n==="$self")return new jn;const e=n.indexOf("#");if(e===-1)return new Wn(n);if(e===0)return new Un(n.substring(1));{const t=n.substring(0,e),r=n.substring(e+1);return new Dn(t,r)}}var Hn=/\\(\d+)/,Xe=/\\(\d+)/g,Fn=-1,At=-2;var Z=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(n,e,t,r){this.$location=n,this.id=e,this._name=t||null,this._nameIsCapturing=te.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=te.hasCaptures(this._contentName)}get debugName(){const n=this.$location?`${yt(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${n}`}getName(n,e){return!this._nameIsCapturing||this._name===null||n===null||e===null?this._name:te.replaceCaptures(this._name,n,e)}getContentName(n,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:te.replaceCaptures(this._contentName,n,e)}},qn=class extends Z{retokenizeCapturedWithRuleId;constructor(n,e,t,r,s){super(n,e,t,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(n,e){throw new Error("Not supported!")}compile(n,e){throw new Error("Not supported!")}compileAG(n,e,t,r){throw new Error("Not supported!")}},zn=class extends Z{_match;captures;_cachedCompiledPatterns;constructor(n,e,t,r,s){super(n,e,t,null),this._match=new V(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(n,e){e.push(this._match)}compile(n,e){return this._getCachedCompiledPatterns(n).compile(n)}compileAG(n,e,t,r){return this._getCachedCompiledPatterns(n).compileAG(n,t,r)}_getCachedCompiledPatterns(n){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new K,this.collectPatterns(n,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ze=class extends Z{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(n,e,t,r,s){super(n,e,t,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(n,e){for(const t of this.patterns)n.getRule(t).collectPatterns(n,e)}compile(n,e){return this._getCachedCompiledPatterns(n).compile(n)}compileAG(n,e,t,r){return this._getCachedCompiledPatterns(n).compileAG(n,t,r)}_getCachedCompiledPatterns(n){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new K,this.collectPatterns(n,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Pe=class extends Z{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(n,e,t,r,s,i,a,c,o,l){super(n,e,t,r),this._begin=new V(s,this.id),this.beginCaptures=i,this._end=new V(a||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=c,this.applyEndPatternLast=o||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.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(n,e){return this._end.resolveBackReferences(n,e)}collectPatterns(n,e){e.push(this._begin)}compile(n,e){return this._getCachedCompiledPatterns(n,e).compile(n)}compileAG(n,e,t,r){return this._getCachedCompiledPatterns(n,e).compileAG(n,t,r)}_getCachedCompiledPatterns(n,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new K;for(const t of this.patterns)n.getRule(t).collectPatterns(n,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,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},ue=class extends Z{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(n,e,t,r,s,i,a,c,o){super(n,e,t,r),this._begin=new V(s,this.id),this.beginCaptures=i,this.whileCaptures=c,this._while=new V(a,At),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=o.patterns,this.hasMissingPatterns=o.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(n,e){return this._while.resolveBackReferences(n,e)}collectPatterns(n,e){e.push(this._begin)}compile(n,e){return this._getCachedCompiledPatterns(n).compile(n)}compileAG(n,e,t,r){return this._getCachedCompiledPatterns(n).compileAG(n,t,r)}_getCachedCompiledPatterns(n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new K;for(const e of this.patterns)n.getRule(e).collectPatterns(n,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(n,e){return this._getCachedCompiledWhilePatterns(n,e).compile(n)}compileWhileAG(n,e,t,r){return this._getCachedCompiledWhilePatterns(n,e).compileAG(n,t,r)}_getCachedCompiledWhilePatterns(n,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new K,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||""),this._cachedCompiledWhilePatterns}},vt=class N{static createCaptureRule(e,t,r,s,i){return e.registerRule(a=>new qn(t,a,r,s,i))}static getCompiledRuleId(e,t,r){return e.id||t.registerRule(s=>{if(e.id=s,e.match)return new zn(e.$vscodeTextmateLocation,e.id,e.name,e.match,N._compileCaptures(e.captures,t,r));if(typeof e.begin>"u"){e.repository&&(r=_t({},r,e.repository));let i=e.patterns;return typeof i>"u"&&e.include&&(i=[{include:e.include}]),new Ze(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,N._compilePatterns(i,t,r))}return e.while?new ue(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,N._compileCaptures(e.beginCaptures||e.captures,t,r),e.while,N._compileCaptures(e.whileCaptures||e.captures,t,r),N._compilePatterns(e.patterns,t,r)):new Pe(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,N._compileCaptures(e.beginCaptures||e.captures,t,r),e.end,N._compileCaptures(e.endCaptures||e.captures,t,r),e.applyEndPatternLast,N._compilePatterns(e.patterns,t,r))}),e.id}static _compileCaptures(e,t,r){let s=[];if(e){let i=0;for(const a in e){if(a==="$vscodeTextmateLocation")continue;const c=parseInt(a,10);c>i&&(i=c)}for(let a=0;a<=i;a++)s[a]=null;for(const a in e){if(a==="$vscodeTextmateLocation")continue;const c=parseInt(a,10);let o=0;e[a].patterns&&(o=N.getCompiledRuleId(e[a],t,r)),s[c]=N.createCaptureRule(t,e[a].$vscodeTextmateLocation,e[a].name,e[a].contentName,o)}}return s}static _compilePatterns(e,t,r){let s=[];if(e)for(let i=0,a=e.length;i<a;i++){const c=e[i];let o=-1;if(c.include){const l=Tt(c.include);switch(l.kind){case 0:case 1:o=N.getCompiledRuleId(r[c.include],t,r);break;case 2:let u=r[l.ruleName];u&&(o=N.getCompiledRuleId(u,t,r));break;case 3:case 4:const h=l.scopeName,g=l.kind===4?l.ruleName:null,f=t.getExternalGrammar(h,r);if(f)if(g){let d=f.repository[g];d&&(o=N.getCompiledRuleId(d,t,f.repository))}else o=N.getCompiledRuleId(f.repository.$self,t,f.repository);break}}else o=N.getCompiledRuleId(c,t,r);if(o!==-1){const l=t.getRule(o);let u=!1;if((l instanceof Ze||l instanceof Pe||l instanceof ue)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;s.push(o)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},V=class It{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e=="string"){const r=e.length;let s=0,i=[],a=!1;for(let c=0;c<r;c++)if(e.charAt(c)==="\\"&&c+1<r){const l=e.charAt(c+1);l==="z"?(i.push(e.substring(s,c)),i.push("$(?!\\n)(?<!\\n)"),s=c+2):(l==="A"||l==="G")&&(a=!0),c++}this.hasAnchor=a,s===0?this.source=e:(i.push(e.substring(s,r)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source=="string"?this.hasBackReferences=Hn.test(this.source):this.hasBackReferences=!1}clone(){return new It(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=t.map(s=>e.substring(s.start,s.end));return Xe.lastIndex=0,this.source.replace(Xe,(s,i)=>wt(r[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],t=[],r=[],s=[],i,a,c,o;for(i=0,a=this.source.length;i<a;i++)c=this.source.charAt(i),e[i]=c,t[i]=c,r[i]=c,s[i]=c,c==="\\"&&i+1<a&&(o=this.source.charAt(i+1),o==="A"?(e[i+1]="",t[i+1]="",r[i+1]="A",s[i+1]="A"):o==="G"?(e[i+1]="",t[i+1]="G",r[i+1]="",s[i+1]="G"):(e[i+1]=o,t[i+1]=o,r[i+1]=o,s[i+1]=o),i++);return{A0_G0:e.join(""),A0_G1:t.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},K=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){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(n){this._items.push(n),this._hasAnchors=this._hasAnchors||n.hasAnchor}unshift(n){this._items.unshift(n),this._hasAnchors=this._hasAnchors||n.hasAnchor}length(){return this._items.length}setSource(n,e){this._items[n].source!==e&&(this._disposeCaches(),this._items[n].setSource(e))}compile(n){if(!this._cached){let e=this._items.map(t=>t.source);this._cached=new et(n,e,this._items.map(t=>t.ruleId))}return this._cached}compileAG(n,e,t){return this._hasAnchors?e?t?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(n,e,t)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(n,e,t)),this._anchorCache.A1_G0):t?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(n,e,t)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(n,e,t)),this._anchorCache.A0_G0):this.compile(n)}_resolveAnchors(n,e,t){let r=this._items.map(s=>s.resolveAnchors(e,t));return new et(n,r,this._items.map(s=>s.ruleId))}},et=class{constructor(n,e,t){this.regExps=e,this.rules=t,this.scanner=n.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const n=[];for(let e=0,t=this.rules.length;e<t;e++)n.push(" - "+this.rules[e]+": "+this.regExps[e]);return n.join(`
|
|
2
|
+
`)}findNextMatchSync(n,e,t){const r=this.scanner.findNextMatchSync(n,e,t);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Re=class{constructor(n,e){this.languageId=n,this.tokenType=e}},Vn=class Le{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Re(e,8),this._embeddedLanguagesMatcher=new Kn(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?Le._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new Re(0,0);_getBasicScopeAttributes=new Ct(e=>{const t=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new Re(t,r)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const t=e.match(Le.STANDARD_TOKEN_TYPE_REGEXP);if(!t)return 8;switch(t[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!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Kn=class{values;scopesRegExp;constructor(n){if(n.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(n);const e=n.map(([t,r])=>wt(t));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(n){if(!this.scopesRegExp)return;const e=n.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},tt=class{constructor(n,e){this.stack=n,this.stoppedEarly=e}};function Et(n,e,t,r,s,i,a,c){const o=e.content.length;let l=!1,u=-1;if(a){const f=Jn(n,e,t,r,s,i);s=f.stack,r=f.linePos,t=f.isFirstLine,u=f.anchorPosition}const h=Date.now();for(;!l;){if(c!==0&&Date.now()-h>c)return new tt(s,!0);g()}return new tt(s,!1);function g(){const f=Yn(n,e,t,r,s,u);if(!f){i.produce(s,o),l=!0;return}const d=f.captureIndices,b=f.matchedRuleId,m=d&&d.length>0?d[0].end>r:!1;if(b===Fn){const _=s.getRule(n);i.produce(s,d[0].start),s=s.withContentNameScopesList(s.nameScopesList),F(n,e,t,s,i,_.endCaptures,d),i.produce(s,d[0].end);const p=s;if(s=s.parent,u=p.getAnchorPos(),!m&&p.getEnterPos()===r){s=p,i.produce(s,o),l=!0;return}}else{const _=n.getRule(b);i.produce(s,d[0].start);const p=s,y=_.getName(e.content,d),w=s.contentNameScopesList.pushAttributed(y,n);if(s=s.push(b,r,u,d[0].end===o,null,w,w),_ instanceof Pe){const S=_;F(n,e,t,s,i,S.beginCaptures,d),i.produce(s,d[0].end),u=d[0].end;const v=S.getContentName(e.content,d),G=w.pushAttributed(v,n);if(s=s.withContentNameScopesList(G),S.endHasBackReferences&&(s=s.withEndRule(S.getEndWithResolvedBackReferences(e.content,d))),!m&&p.hasSameRuleAs(s)){s=s.pop(),i.produce(s,o),l=!0;return}}else if(_ instanceof ue){const S=_;F(n,e,t,s,i,S.beginCaptures,d),i.produce(s,d[0].end),u=d[0].end;const v=S.getContentName(e.content,d),G=w.pushAttributed(v,n);if(s=s.withContentNameScopesList(G),S.whileHasBackReferences&&(s=s.withEndRule(S.getWhileWithResolvedBackReferences(e.content,d))),!m&&p.hasSameRuleAs(s)){s=s.pop(),i.produce(s,o),l=!0;return}}else if(F(n,e,t,s,i,_.captures,d),i.produce(s,d[0].end),s=s.pop(),!m){s=s.safePop(),i.produce(s,o),l=!0;return}}d[0].end>r&&(r=d[0].end,t=!1)}}function Jn(n,e,t,r,s,i){let a=s.beginRuleCapturedEOL?0:-1;const c=[];for(let o=s;o;o=o.pop()){const l=o.getRule(n);l instanceof ue&&c.push({rule:l,stack:o})}for(let o=c.pop();o;o=c.pop()){const{ruleScanner:l,findOptions:u}=Zn(o.rule,n,o.stack.endRule,t,r===a),h=l.findNextMatchSync(e,r,u);if(h){if(h.ruleId!==At){s=o.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(i.produce(o.stack,h.captureIndices[0].start),F(n,e,t,o.stack,i,o.rule.whileCaptures,h.captureIndices),i.produce(o.stack,h.captureIndices[0].end),a=h.captureIndices[0].end,h.captureIndices[0].end>r&&(r=h.captureIndices[0].end,t=!1))}else{s=o.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:a,isFirstLine:t}}function Yn(n,e,t,r,s,i){const a=Qn(n,e,t,r,s,i),c=n.getInjections();if(c.length===0)return a;const o=Xn(c,n,e,t,r,s,i);if(!o)return a;if(!a)return o;const l=a.captureIndices[0].start,u=o.captureIndices[0].start;return u<l||o.priorityMatch&&u===l?o:a}function Qn(n,e,t,r,s,i){const a=s.getRule(n),{ruleScanner:c,findOptions:o}=Pt(a,n,s.endRule,t,r===i),l=c.findNextMatchSync(e,r,o);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function Xn(n,e,t,r,s,i,a){let c=Number.MAX_VALUE,o=null,l,u=0;const h=i.contentNameScopesList.getScopeNames();for(let g=0,f=n.length;g<f;g++){const d=n[g];if(!d.matcher(h))continue;const b=e.getRule(d.ruleId),{ruleScanner:m,findOptions:_}=Pt(b,e,null,r,s===a),p=m.findNextMatchSync(t,s,_);if(!p)continue;const y=p.captureIndices[0].start;if(!(y>=c)&&(c=y,o=p.captureIndices,l=p.ruleId,u=d.priority,c===s))break}return o?{priorityMatch:u===-1,captureIndices:o,matchedRuleId:l}:null}function Pt(n,e,t,r,s){return{ruleScanner:n.compileAG(e,t,r,s),findOptions:0}}function Zn(n,e,t,r,s){return{ruleScanner:n.compileWhileAG(e,t,r,s),findOptions:0}}function F(n,e,t,r,s,i,a){if(i.length===0)return;const c=e.content,o=Math.min(i.length,a.length),l=[],u=a[0].end;for(let h=0;h<o;h++){const g=i[h];if(g===null)continue;const f=a[h];if(f.length===0)continue;if(f.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=f.start;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?s.produceFromScopes(l[l.length-1].scopes,f.start):s.produce(r,f.start),g.retokenizeCapturedWithRuleId){const b=g.getName(c,a),m=r.contentNameScopesList.pushAttributed(b,n),_=g.getContentName(c,a),p=m.pushAttributed(_,n),y=r.push(g.retokenizeCapturedWithRuleId,f.start,-1,!1,null,m,p),w=n.createOnigString(c.substring(0,f.end));Et(n,w,t&&f.start===0,f.start,y,s,!1,0),Nt(w);continue}const d=g.getName(c,a);if(d!==null){const m=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(d,n);l.push(new er(m,f.end))}}for(;l.length>0;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var er=class{scopes;endPos;constructor(n,e){this.scopes=n,this.endPos=e}};function tr(n,e,t,r,s,i,a,c){return new rr(n,e,t,r,s,i,a,c)}function nt(n,e,t,r,s){const i=ce(e,he),a=vt.getCompiledRuleId(t,r,s.repository);for(const c of i)n.push({debugSelector:e,matcher:c.matcher,ruleId:a,grammar:s,priority:c.priority})}function he(n,e){if(e.length<n.length)return!1;let t=0;return n.every(r=>{for(let s=t;s<e.length;s++)if(nr(e[s],r))return t=s+1,!0;return!1})}function nr(n,e){if(!n)return!1;if(n===e)return!0;const t=e.length;return n.length>t&&n.substr(0,t)===e&&n[t]==="."}var rr=class{constructor(n,e,t,r,s,i,a,c){if(this._rootScopeName=n,this.balancedBracketSelectors=i,this._onigLib=c,this._basicScopeAttributesProvider=new Vn(t,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=a,this._grammar=rt(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const o of Object.keys(s)){const l=ce(o,he);for(const u of l)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[o]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const n of this._ruleId2desc)n&&n.dispose()}createOnigScanner(n){return this._onigLib.createOnigScanner(n)}createOnigString(n){return this._onigLib.createOnigString(n)}getMetadataForScope(n){return this._basicScopeAttributesProvider.getBasicScopeAttributes(n)}_collectInjections(){const n={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},e=[],t=this._rootScopeName,r=n.lookup(t);if(r){const s=r.injections;if(s)for(let a in s)nt(e,a,s[a],this,r);const i=this._grammarRepository.injections(t);i&&i.forEach(a=>{const c=this.getExternalGrammar(a);if(c){const o=c.injectionSelector;o&&nt(e,o,c,this,c)}})}return e.sort((s,i)=>s.priority-i.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(n){const e=++this._lastRuleId,t=n(e);return this._ruleId2desc[e]=t,t}getRule(n){return this._ruleId2desc[n]}getExternalGrammar(n,e){if(this._includedGrammars[n])return this._includedGrammars[n];if(this._grammarRepository){const t=this._grammarRepository.lookup(n);if(t)return this._includedGrammars[n]=rt(t,e&&e.$base),this._includedGrammars[n]}}tokenizeLine(n,e,t=0){const r=this._tokenize(n,e,!1,t);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(n,e,t=0){const r=this._tokenize(n,e,!0,t);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(n,e,t,r){this._rootId===-1&&(this._rootId=vt.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===xe.NULL){s=!0;const l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),h=W.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),g=this.getRule(this._rootId).getName(null,null);let f;g?f=q.createRootAndLookUpScopeName(g,h,this):f=q.createRoot("unknown",h),e=new xe(null,this._rootId,-1,-1,!1,null,f,f)}else s=!1,e.reset();n=n+`
|
|
3
|
+
`;const i=this.createOnigString(n),a=i.content.length,c=new ir(t,n,this._tokenTypeMatchers,this.balancedBracketSelectors),o=Et(this,i,s,0,e,c,!0,r);return Nt(i),{lineLength:a,lineTokens:c,ruleStack:o.stack,stoppedEarly:o.stoppedEarly}}};function rt(n,e){return n=Cn(n),n.repository=n.repository||{},n.repository.$self={$vscodeTextmateLocation:n.$vscodeTextmateLocation,patterns:n.patterns,name:n.scopeName},n.repository.$base=e||n.repository.$self,n}var q=class P{constructor(e,t,r){this.parent=e,this.scopePath=t,this.tokenAttributes=r}static fromExtension(e,t){let r=e,s=e?.scopePath??null;for(const i of t)s=ke.push(s,i.scopeNames),r=new P(r,s,i.encodedTokenAttributes);return r}static createRoot(e,t){return new P(null,new ke(null,e),t)}static createRootAndLookUpScopeName(e,t,r){const s=r.getMetadataForScope(e),i=new ke(null,e),a=r.themeProvider.themeMatch(i),c=P.mergeAttributes(t,s,a);return new P(null,i,c)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return P.equals(this,e)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,r){let s=-1,i=0,a=0;return r!==null&&(s=r.fontStyle,i=r.foregroundId,a=r.backgroundId),W.set(e,t.languageId,t.tokenType,null,s,i,a)}pushAttributed(e,t){if(e===null)return this;if(e.indexOf(" ")===-1)return P._pushAttributed(this,e,t);const r=e.split(/ /g);let s=this;for(const i of r)s=P._pushAttributed(s,i,t);return s}static _pushAttributed(e,t,r){const s=r.getMetadataForScope(t),i=e.scopePath.push(t),a=r.themeProvider.themeMatch(i),c=P.mergeAttributes(e.tokenAttributes,s,a);return new P(e,i,c)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const t=[];let r=this;for(;r&&r!==e;)t.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?t.reverse():void 0}},xe=class B{constructor(e,t,r,s,i,a,c,o){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=c,this.contentNameScopesList=o,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new B(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:B._equals(this,e)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?q.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){B._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,t,r,s,i,a,c){return new B(this,e,t,r,s,i,a,c)}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 B(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,t){const r=q.fromExtension(e?.nameScopesList??null,t.nameScopesList);return new B(e,t.ruleId,t.enterPos??-1,t.anchorPos??-1,t.beginRuleCapturedEOL,t.endRule,r,q.fromExtension(r,t.contentNameScopesList))}},sr=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(n,e){this.balancedBracketScopes=n.flatMap(t=>t==="*"?(this.allowAny=!0,[]):ce(t,he).map(r=>r.matcher)),this.unbalancedBracketScopes=e.flatMap(t=>ce(t,he).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(n){for(const e of this.unbalancedBracketScopes)if(e(n))return!1;for(const e of this.balancedBracketScopes)if(e(n))return!0;return this.allowAny}},ir=class{constructor(n,e,t,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=n,this._tokenTypeOverrides=t,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(n,e){this.produceFromScopes(n.contentNameScopesList,e)}produceFromScopes(n,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let r=n?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const i=n?.getScopeNames()??[];for(const a of this._tokenTypeOverrides)a.matcher(i)&&(r=W.set(r,0,a.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(i))}if(s&&(r=W.set(r,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=e;return}const t=n?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:t}),this._lastTokenEndIndex=e}getResult(n,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(n,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(n,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(n,e),this._binaryTokens[this._binaryTokens.length-2]=0);const t=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)t[r]=this._binaryTokens[r];return t}},ar=class{constructor(n,e){this._onigLib=e,this._theme=n}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const n of this._grammars.values())n.dispose()}setTheme(n){this._theme=n}getColorMap(){return this._theme.getColorMap()}addGrammar(n,e){this._rawGrammars.set(n.scopeName,n),e&&this._injectionGrammars.set(n.scopeName,e)}lookup(n){return this._rawGrammars.get(n)}injections(n){return this._injectionGrammars.get(n)}getDefaults(){return this._theme.getDefaults()}themeMatch(n){return this._theme.match(n)}grammarForScopeName(n,e,t,r,s){if(!this._grammars.has(n)){let i=this._rawGrammars.get(n);if(!i)return null;this._grammars.set(n,tr(n,i,e,t,r,s,this,this._onigLib))}return this._grammars.get(n)}},or=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new ar(oe.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(oe.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,r){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:r})}loadGrammarWithConfiguration(e,t,r){return this._loadGrammar(e,t,r.embeddedLanguages,r.tokenTypes,new sr(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,r,s,i){const a=new Bn(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(c=>this._loadSingleGrammar(c.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,r,s,i)}_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 r=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,r)}}addGrammar(e,t=[],r=0,s=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,r,s)}_grammarForScopeName(e,t=0,r=null,s=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,r,s,i)}},Oe=xe.NULL;const cr=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],st={}.hasOwnProperty;function lr(n,e){const t=e||{};function r(s,...i){let a=r.invalid;const c=r.handlers;if(s&&st.call(s,n)){const o=String(s[n]);a=st.call(c,o)?c[o]:r.unknown}if(a)return a.call(this,s,...i)}return r.handlers=t.handlers||{},r.invalid=t.invalid,r.unknown=t.unknown,r}const ur=/["&'<>`]/g,hr=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,fr=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,dr=/[|\\{}()[\]^$+*?.]/g,it=new WeakMap;function gr(n,e){if(n=n.replace(e.subset?mr(e.subset):ur,r),e.subset||e.escapeOnly)return n;return n.replace(hr,t).replace(fr,r);function t(s,i,a){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,a.charCodeAt(i+2),e)}function r(s,i,a){return e.format(s.charCodeAt(0),a.charCodeAt(i+1),e)}}function mr(n){let e=it.get(n);return e||(e=pr(n),it.set(n,e)),e}function pr(n){const e=[];let t=-1;for(;++t<n.length;)e.push(n[t].replace(dr,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const _r=/[\dA-Fa-f]/;function yr(n,e,t){const r="&#x"+n.toString(16).toUpperCase();return t&&e&&!_r.test(String.fromCharCode(e))?r:r+";"}const br=/\d/;function Sr(n,e,t){const r="&#"+String(n);return t&&e&&!br.test(String.fromCharCode(e))?r:r+";"}const wr=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],Ne={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},Cr=["cent","copy","divide","gt","lt","not","para","times"],Lt={}.hasOwnProperty,Ge={};let ne;for(ne in Ne)Lt.call(Ne,ne)&&(Ge[Ne[ne]]=ne);const kr=/[^\dA-Za-z]/;function Rr(n,e,t,r){const s=String.fromCharCode(n);if(Lt.call(Ge,s)){const i=Ge[s],a="&"+i;return t&&wr.includes(i)&&!Cr.includes(i)&&(!r||e&&e!==61&&kr.test(String.fromCharCode(e)))?a:a+";"}return""}function Nr(n,e,t){let r=yr(n,e,t.omitOptionalSemicolons),s;if((t.useNamedReferences||t.useShortestReferences)&&(s=Rr(n,e,t.omitOptionalSemicolons,t.attribute)),(t.useShortestReferences||!s)&&t.useShortestReferences){const i=Sr(n,e,t.omitOptionalSemicolons);i.length<r.length&&(r=i)}return s&&(!t.useShortestReferences||s.length<r.length)?s:r}function U(n,e){return gr(n,Object.assign({format:Nr},e))}const Tr=/^>|^->|<!--|-->|--!>|<!-$/g,Ar=[">"],vr=["<",">"];function Ir(n,e,t,r){return r.settings.bogusComments?"<?"+U(n.value,Object.assign({},r.settings.characterReferences,{subset:Ar}))+">":"<!--"+n.value.replace(Tr,s)+"-->";function s(i){return U(i,Object.assign({},r.settings.characterReferences,{subset:vr}))}}function Er(n,e,t,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const k=Ot(1),xt=Ot(-1),Pr=[];function Ot(n){return e;function e(t,r,s){const i=t?t.children:Pr;let a=(r||0)+n,c=i[a];if(!s)for(;c&&Be(c);)a+=n,c=i[a];return c}}const Lr={}.hasOwnProperty;function Gt(n){return e;function e(t,r,s){return Lr.call(n,t.tagName)&&n[t.tagName](t,r,s)}}const Ue=Gt({body:Or,caption:Te,colgroup:Te,dd:$r,dt:Mr,head:Te,html:xr,li:Br,optgroup:jr,option:Ur,p:Gr,rp:at,rt:at,tbody:Dr,td:ot,tfoot:Hr,th:ot,thead:Wr,tr:Fr});function Te(n,e,t){const r=k(t,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Be(r.value.charAt(0)))}function xr(n,e,t){const r=k(t,e);return!r||r.type!=="comment"}function Or(n,e,t){const r=k(t,e);return!r||r.type!=="comment"}function Gr(n,e,t){const r=k(t,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!t||!(t.type==="element"&&(t.tagName==="a"||t.tagName==="audio"||t.tagName==="del"||t.tagName==="ins"||t.tagName==="map"||t.tagName==="noscript"||t.tagName==="video"))}function Br(n,e,t){const r=k(t,e);return!r||r.type==="element"&&r.tagName==="li"}function Mr(n,e,t){const r=k(t,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function $r(n,e,t){const r=k(t,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function at(n,e,t){const r=k(t,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function jr(n,e,t){const r=k(t,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function Ur(n,e,t){const r=k(t,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Wr(n,e,t){const r=k(t,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Dr(n,e,t){const r=k(t,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Hr(n,e,t){return!k(t,e)}function Fr(n,e,t){const r=k(t,e);return!r||r.type==="element"&&r.tagName==="tr"}function ot(n,e,t){const r=k(t,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const qr=Gt({body:Kr,colgroup:Jr,head:Vr,html:zr,tbody:Yr});function zr(n){const e=k(n,-1);return!e||e.type!=="comment"}function Vr(n){const e=new Set;for(const r of n.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const t=n.children[0];return!t||t.type==="element"}function Kr(n){const e=k(n,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&Be(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function Jr(n,e,t){const r=xt(t,e),s=k(n,-1,!0);return t&&r&&r.type==="element"&&r.tagName==="colgroup"&&Ue(r,t.children.indexOf(r),t)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function Yr(n,e,t){const r=xt(t,e),s=k(n,-1);return t&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Ue(r,t.children.indexOf(r),t)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const re={name:[[`
|
|
4
|
+
\f\r &/=>`.split(""),`
|
|
5
|
+
\f\r "&'/=>\``.split("")],[`\0
|
|
6
|
+
\f\r "&'/<=>`.split(""),`\0
|
|
7
|
+
\f\r "&'/<=>\``.split("")]],unquoted:[[`
|
|
8
|
+
\f\r &>`.split(""),`\0
|
|
9
|
+
\f\r "&'<=>\``.split("")],[`\0
|
|
10
|
+
\f\r "&'<=>\``.split(""),`\0
|
|
11
|
+
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Qr(n,e,t,r){const s=r.schema,i=s.space==="svg"?!1:r.settings.omitOptionalTags;let a=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(n.tagName.toLowerCase());const c=[];let o;s.space==="html"&&n.tagName==="svg"&&(r.schema=gt);const l=Xr(r,n.properties),u=r.all(s.space==="html"&&n.tagName==="template"?n.content:n);return r.schema=s,u&&(a=!1),(l||!i||!qr(n,e,t))&&(c.push("<",n.tagName,l?" "+l:""),a&&(s.space==="svg"||r.settings.closeSelfClosing)&&(o=l.charAt(l.length-1),(!r.settings.tightSelfClosing||o==="/"||o&&o!=='"'&&o!=="'")&&c.push(" "),c.push("/")),c.push(">")),c.push(u),!a&&(!i||!Ue(n,e,t))&&c.push("</"+n.tagName+">"),c.join("")}function Xr(n,e){const t=[];let r=-1,s;if(e){for(s in e)if(e[s]!==null&&e[s]!==void 0){const i=Zr(n,s,e[s]);i&&t.push(i)}}for(;++r<t.length;){const i=n.settings.tightAttributes?t[r].charAt(t[r].length-1):void 0;r!==t.length-1&&i!=='"'&&i!=="'"&&(t[r]+=" ")}return t.join("")}function Zr(n,e,t){const r=Xt(n.schema,e),s=n.settings.allowParseErrors&&n.schema.space==="html"?0:1,i=n.settings.allowDangerousCharacters?0:1;let a=n.quote,c;if(r.overloadedBoolean&&(t===r.attribute||t==="")?t=!0:(r.boolean||r.overloadedBoolean)&&(typeof t!="string"||t===r.attribute||t==="")&&(t=!!t),t==null||t===!1||typeof t=="number"&&Number.isNaN(t))return"";const o=U(r.attribute,Object.assign({},n.settings.characterReferences,{subset:re.name[s][i]}));return t===!0||(t=Array.isArray(t)?(r.commaSeparated?Zt:en)(t,{padLeft:!n.settings.tightCommaSeparatedLists}):String(t),n.settings.collapseEmptyAttributes&&!t)?o:(n.settings.preferUnquoted&&(c=U(t,Object.assign({},n.settings.characterReferences,{attribute:!0,subset:re.unquoted[s][i]}))),c!==t&&(n.settings.quoteSmart&&Je(t,a)>Je(t,n.alternative)&&(a=n.alternative),c=a+U(t,Object.assign({},n.settings.characterReferences,{subset:(a==="'"?re.single:re.double)[s][i],attribute:!0}))+a),o+(c&&"="+c))}const es=["<","&"];function Bt(n,e,t,r){return t&&t.type==="element"&&(t.tagName==="script"||t.tagName==="style")?n.value:U(n.value,Object.assign({},r.settings.characterReferences,{subset:es}))}function ts(n,e,t,r){return r.settings.allowDangerousHtml?n.value:Bt(n,e,t,r)}function ns(n,e,t,r){return r.all(n)}const rs=lr("type",{invalid:ss,unknown:is,handlers:{comment:Ir,doctype:Er,element:Qr,raw:ts,root:ns,text:Bt}});function ss(n){throw new Error("Expected node, not `"+n+"`")}function is(n){const e=n;throw new Error("Cannot compile unknown node `"+e.type+"`")}const as={},os={},cs=[];function ls(n,e){const t=e||as,r=t.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:us,all:hs,settings:{omitOptionalTags:t.omitOptionalTags||!1,allowParseErrors:t.allowParseErrors||!1,allowDangerousCharacters:t.allowDangerousCharacters||!1,quoteSmart:t.quoteSmart||!1,preferUnquoted:t.preferUnquoted||!1,tightAttributes:t.tightAttributes||!1,upperDoctype:t.upperDoctype||!1,tightDoctype:t.tightDoctype||!1,bogusComments:t.bogusComments||!1,tightCommaSeparatedLists:t.tightCommaSeparatedLists||!1,tightSelfClosing:t.tightSelfClosing||!1,collapseEmptyAttributes:t.collapseEmptyAttributes||!1,allowDangerousHtml:t.allowDangerousHtml||!1,voids:t.voids||cr,characterReferences:t.characterReferences||os,closeSelfClosing:t.closeSelfClosing||!1,closeEmptyElements:t.closeEmptyElements||!1},schema:t.space==="svg"?gt:tn,quote:r,alternative:s}.one(Array.isArray(n)?{type:"root",children:n}:n,void 0,void 0)}function us(n,e,t){return rs(n,e,t,this)}function hs(n){const e=[],t=n&&n.children||cs;let r=-1;for(;++r<t.length;)e[r]=this.one(t[r],r,n);return e.join("")}function fs(n){return I("import `createOnigurumaEngine` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead"),$e(n)}function Ys(n){return I("import `createOnigurumaEngine` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead"),$e(n)}function Qs(n){return I("import `loadWasm` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead"),mt(n)}function ds(n){return Array.isArray(n)?n:[n]}function pe(n,e=!1){const t=n.split(/(\r?\n)/g);let r=0;const s=[];for(let i=0;i<t.length;i+=2){const a=e?t[i]+(t[i+1]||""):t[i];s.push([a,r]),r+=t[i].length,r+=t[i+1]?.length||0}return s}function We(n){return!n||["plaintext","txt","text","plain"].includes(n)}function Mt(n){return n==="ansi"||We(n)}function De(n){return n==="none"}function $t(n){return De(n)}function jt(n,e){if(!e)return n;n.properties||={},n.properties.class||=[],typeof n.properties.class=="string"&&(n.properties.class=n.properties.class.split(/\s+/g)),Array.isArray(n.properties.class)||(n.properties.class=[]);const t=Array.isArray(e)?e:e.split(/\s+/g);for(const r of t)r&&!n.properties.class.includes(r)&&n.properties.class.push(r);return n}function gs(n,e){let t=0;const r=[];for(const s of e)s>t&&r.push({...n,content:n.content.slice(t,s),offset:n.offset+t}),t=s;return t<n.content.length&&r.push({...n,content:n.content.slice(t),offset:n.offset+t}),r}function ms(n,e){const t=Array.from(e instanceof Set?e:new Set(e)).sort((r,s)=>r-s);return t.length?n.map(r=>r.flatMap(s=>{const i=t.filter(a=>s.offset<a&&a<s.offset+s.content.length).map(a=>a-s.offset).sort((a,c)=>a-c);return i.length?gs(s,i):s})):n}async function Ut(n){return Promise.resolve(typeof n=="function"?n():n).then(e=>e.default||e)}function fe(n,e){const t=typeof n=="string"?{}:{...n.colorReplacements},r=typeof n=="string"?n:n.name;for(const[s,i]of Object.entries(e?.colorReplacements||{}))typeof i=="string"?t[s]=i:s===r&&Object.assign(t,i);return t}function M(n,e){return n&&(e?.[n?.toLowerCase()]||n)}function Wt(n){const e={};return n.color&&(e.color=n.color),n.bgColor&&(e["background-color"]=n.bgColor),n.fontStyle&&(n.fontStyle&x.Italic&&(e["font-style"]="italic"),n.fontStyle&x.Bold&&(e["font-weight"]="bold"),n.fontStyle&x.Underline&&(e["text-decoration"]="underline")),e}function ps(n){return typeof n=="string"?n:Object.entries(n).map(([e,t])=>`${e}:${t}`).join(";")}function _s(n){const e=pe(n,!0).map(([s])=>s);function t(s){if(s===n.length)return{line:e.length-1,character:e[e.length-1].length};let i=s,a=0;for(const c of e){if(i<c.length)break;i-=c.length,a++}return{line:a,character:i}}function r(s,i){let a=0;for(let c=0;c<s;c++)a+=e[c].length;return a+=i,a}return{lines:e,indexToPos:t,posToIndex:r}}class T extends Error{constructor(e){super(e),this.name="ShikiError"}}const Dt=new WeakMap;function _e(n,e){Dt.set(n,e)}function J(n){return Dt.get(n)}class D{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,t){return new D(Object.fromEntries(ds(t).map(r=>[r,Oe])),e)}constructor(...e){if(e.length===2){const[t,r]=e;this.lang=r,this._stacks=t}else{const[t,r,s]=e;this.lang=r,this._stacks={[s]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}get scopes(){return I("GrammarState.scopes is deprecated, use GrammarState.getScopes() instead"),ct(this._stacks[this.theme])}getScopes(e=this.theme){return ct(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function ct(n){const e=[],t=new Set;function r(s){if(t.has(s))return;t.add(s);const i=s?.nameScopesList?.scopeName;i&&e.push(i),s.parent&&r(s.parent)}return r(n),e}function ys(n,e){if(!(n instanceof D))throw new T("Invalid grammar state");return n.getInternalStack(e)}function bs(){const n=new WeakMap;function e(t){if(!n.has(t.meta)){let r=function(a){if(typeof a=="number"){if(a<0||a>t.source.length)throw new T(`Invalid decoration offset: ${a}. Code length: ${t.source.length}`);return{...s.indexToPos(a),offset:a}}else{const c=s.lines[a.line];if(c===void 0)throw new T(`Invalid decoration position ${JSON.stringify(a)}. Lines length: ${s.lines.length}`);if(a.character<0||a.character>c.length)throw new T(`Invalid decoration position ${JSON.stringify(a)}. Line ${a.line} length: ${c.length}`);return{...a,offset:s.posToIndex(a.line,a.character)}}};const s=_s(t.source),i=(t.options.decorations||[]).map(a=>({...a,start:r(a.start),end:r(a.end)}));Ss(i),n.set(t.meta,{decorations:i,converter:s,source:t.source})}return n.get(t.meta)}return{name:"shiki:decorations",tokens(t){if(!this.options.decorations?.length)return;const s=e(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]);return ms(t,s)},code(t){if(!this.options.decorations?.length)return;const r=e(this),s=Array.from(t.children).filter(u=>u.type==="element"&&u.tagName==="span");if(s.length!==r.converter.lines.length)throw new T(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function i(u,h,g,f){const d=s[u];let b="",m=-1,_=-1;if(h===0&&(m=0),g===0&&(_=0),g===Number.POSITIVE_INFINITY&&(_=d.children.length),m===-1||_===-1)for(let y=0;y<d.children.length;y++)b+=Ht(d.children[y]),m===-1&&b.length===h&&(m=y+1),_===-1&&b.length===g&&(_=y+1);if(m===-1)throw new T(`Failed to find start index for decoration ${JSON.stringify(f.start)}`);if(_===-1)throw new T(`Failed to find end index for decoration ${JSON.stringify(f.end)}`);const p=d.children.slice(m,_);if(!f.alwaysWrap&&p.length===d.children.length)c(d,f,"line");else if(!f.alwaysWrap&&p.length===1&&p[0].type==="element")c(p[0],f,"token");else{const y={type:"element",tagName:"span",properties:{},children:p};c(y,f,"wrapper"),d.children.splice(m,p.length,y)}}function a(u,h){s[u]=c(s[u],h,"line")}function c(u,h,g){const f=h.properties||{},d=h.transform||(b=>b);return u.tagName=h.tagName||"span",u.properties={...u.properties,...f,class:u.properties.class},h.properties?.class&&jt(u,h.properties.class),u=d(u,g)||u,u}const o=[],l=r.decorations.sort((u,h)=>h.start.offset-u.start.offset);for(const u of l){const{start:h,end:g}=u;if(h.line===g.line)i(h.line,h.character,g.character,u);else if(h.line<g.line){i(h.line,h.character,Number.POSITIVE_INFINITY,u);for(let f=h.line+1;f<g.line;f++)o.unshift(()=>a(f,u));i(g.line,0,g.character,u)}}o.forEach(u=>u())}}}function Ss(n){for(let e=0;e<n.length;e++){const t=n[e];if(t.start.offset>t.end.offset)throw new T(`Invalid decoration range: ${JSON.stringify(t.start)} - ${JSON.stringify(t.end)}`);for(let r=e+1;r<n.length;r++){const s=n[r],i=t.start.offset<s.start.offset&&s.start.offset<t.end.offset,a=t.start.offset<s.end.offset&&s.end.offset<t.end.offset,c=s.start.offset<t.start.offset&&t.start.offset<s.end.offset,o=s.start.offset<t.end.offset&&t.end.offset<s.end.offset;if(i||a||c||o){if(a&&a||c&&o)continue;throw new T(`Decorations ${JSON.stringify(t.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function Ht(n){return n.type==="text"?n.value:n.type==="element"?n.children.map(Ht).join(""):""}const ws=[bs()];function de(n){return[...n.transformers||[],...ws]}var $=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Ae={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function Cs(n,e){const t=n.indexOf("\x1B[",e);if(t!==-1){const r=n.indexOf("m",t);return{sequence:n.substring(t+2,r).split(";"),startPosition:t,position:r+1}}return{position:n.length}}function lt(n,e){let t=1;const r=n[e+t++];let s;if(r==="2"){const i=[n[e+t++],n[e+t++],n[e+t]].map(a=>Number.parseInt(a));i.length===3&&!i.some(a=>Number.isNaN(a))&&(s={type:"rgb",rgb:i})}else if(r==="5"){const i=Number.parseInt(n[e+t]);Number.isNaN(i)||(s={type:"table",index:Number(i)})}return[t,s]}function ks(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t],s=Number.parseInt(r);if(!Number.isNaN(s))if(s===0)e.push({type:"resetAll"});else if(s<=9)Ae[s]&&e.push({type:"setDecoration",value:Ae[s]});else if(s<=29){const i=Ae[s-20];i&&e.push({type:"resetDecoration",value:i})}else if(s<=37)e.push({type:"setForegroundColor",value:{type:"named",name:$[s-30]}});else if(s===38){const[i,a]=lt(n,t);a&&e.push({type:"setForegroundColor",value:a}),t+=i}else if(s===39)e.push({type:"resetForegroundColor"});else if(s<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:$[s-40]}});else if(s===48){const[i,a]=lt(n,t);a&&e.push({type:"setBackgroundColor",value:a}),t+=i}else s===49?e.push({type:"resetBackgroundColor"}):s>=90&&s<=97?e.push({type:"setForegroundColor",value:{type:"named",name:$[s-90+8]}}):s>=100&&s<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:$[s-100+8]}})}return e}function Rs(){let n=null,e=null,t=new Set;return{parse(r){const s=[];let i=0;do{const a=Cs(r,i),c=a.sequence?r.substring(i,a.startPosition):r.substring(i);if(c.length>0&&s.push({value:c,foreground:n,background:e,decorations:new Set(t)}),a.sequence){const o=ks(a.sequence);for(const l of o)l.type==="resetAll"?(n=null,e=null,t.clear()):l.type==="resetForegroundColor"?n=null:l.type==="resetBackgroundColor"?e=null:l.type==="resetDecoration"&&t.delete(l.value);for(const l of o)l.type==="setForegroundColor"?n=l.value:l.type==="setBackgroundColor"?e=l.value:l.type==="setDecoration"&&t.add(l.value)}i=a.position}while(i<r.length);return s}}}var Ns={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 Ts(n=Ns){function e(c){return n[c]}function t(c){return`#${c.map(o=>Math.max(0,Math.min(o,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let l=0;l<$.length;l++)r.push(e($[l]));let c=[0,95,135,175,215,255];for(let l=0;l<6;l++)for(let u=0;u<6;u++)for(let h=0;h<6;h++)r.push(t([c[l],c[u],c[h]]));let o=8;for(let l=0;l<24;l++,o+=10)r.push(t([o,o,o]));return r}function i(c){return s()[c]}function a(c){switch(c.type){case"named":return e(c.name);case"rgb":return t(c.rgb);case"table":return i(c.index)}}return{value:a}}function As(n,e,t){const r=fe(n,t),s=pe(e),i=Ts(Object.fromEntries($.map(c=>[c,n.colors?.[`terminal.ansi${c[0].toUpperCase()}${c.substring(1)}`]]))),a=Rs();return s.map(c=>a.parse(c[0]).map(o=>{let l,u;o.decorations.has("reverse")?(l=o.background?i.value(o.background):n.bg,u=o.foreground?i.value(o.foreground):n.fg):(l=o.foreground?i.value(o.foreground):n.fg,u=o.background?i.value(o.background):void 0),l=M(l,r),u=M(u,r),o.decorations.has("dim")&&(l=vs(l));let h=x.None;return o.decorations.has("bold")&&(h|=x.Bold),o.decorations.has("italic")&&(h|=x.Italic),o.decorations.has("underline")&&(h|=x.Underline),{content:o.value,offset:c[1],color:l,bgColor:u,fontStyle:h}}))}function vs(n){const e=n.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(e)if(e[3]){const r=Math.round(Number.parseInt(e[3],16)/2).toString(16).padStart(2,"0");return`#${e[1]}${e[2]}${r}`}else return e[2]?`#${e[1]}${e[2]}80`:`#${Array.from(e[1]).map(r=>`${r}${r}`).join("")}80`;const t=n.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return t?`var(${t[1]}-dim)`:n}function ye(n,e,t={}){const{lang:r="text",theme:s=n.getLoadedThemes()[0]}=t;if(We(r)||De(s))return pe(e).map(o=>[{content:o[0],offset:o[1]}]);const{theme:i,colorMap:a}=n.setTheme(s);if(r==="ansi")return As(i,e,t);const c=n.getLanguage(r);if(t.grammarState){if(t.grammarState.lang!==c.name)throw new O(`Grammar state language "${t.grammarState.lang}" does not match highlight language "${c.name}"`);if(!t.grammarState.themes.includes(i.name))throw new O(`Grammar state themes "${t.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Is(e,c,i,a,t)}function Ft(...n){if(n.length===2)return J(n[1]);const[e,t,r={}]=n,{lang:s="text",theme:i=e.getLoadedThemes()[0]}=r;if(We(s)||De(i))throw new O("Plain language does not have grammar state");if(s==="ansi")throw new O("ANSI language does not have grammar state");const{theme:a,colorMap:c}=e.setTheme(i),o=e.getLanguage(s);return new D(ge(t,o,a,c,r).stateStack,o.name,a.name)}function Is(n,e,t,r,s){const i=ge(n,e,t,r,s),a=new D(ge(n,e,t,r,s).stateStack,e.name,t.name);return _e(i.tokens,a),i.tokens}function ge(n,e,t,r,s){const i=fe(t,s),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:c=500}=s,o=pe(n);let l=s.grammarState?ys(s.grammarState,t.name)??Oe:s.grammarContextCode!=null?ge(s.grammarContextCode,e,t,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:Oe,u=[];const h=[];for(let g=0,f=o.length;g<f;g++){const[d,b]=o[g];if(d===""){u=[],h.push([]);continue}if(a>0&&d.length>=a){u=[],h.push([{content:d,offset:b,color:"",fontStyle:0}]);continue}let m,_,p;s.includeExplanation&&(m=e.tokenizeLine(d,l),_=m.tokens,p=0);const y=e.tokenizeLine2(d,l,c),w=y.tokens.length/2;for(let S=0;S<w;S++){const v=y.tokens[2*S],G=S+1<w?y.tokens[2*S+2]:d.length;if(v===G)continue;const ze=y.tokens[2*S+1],Yt=M(r[W.getForeground(ze)],i),Qt=W.getFontStyle(ze),be={content:d.substring(v,G),offset:b+v,color:Yt,fontStyle:Qt};if(s.includeExplanation){const Ve=[];if(s.includeExplanation!=="scopeName")for(const L of t.settings){let j;switch(typeof L.scope){case"string":j=L.scope.split(/,/).map(Se=>Se.trim());break;case"object":j=L.scope;break;default:continue}Ve.push({settings:L,selectors:j.map(Se=>Se.split(/ /))})}be.explanation=[];let Ke=0;for(;v+Ke<G;){const L=_[p],j=d.substring(L.startIndex,L.endIndex);Ke+=j.length,be.explanation.push({content:j,scopes:s.includeExplanation==="scopeName"?Es(L.scopes):Ps(Ve,L.scopes)}),p+=1}}u.push(be)}h.push(u),u=[],l=y.ruleStack}return{tokens:h,stateStack:l}}function Es(n){return n.map(e=>({scopeName:e}))}function Ps(n,e){const t=[];for(let r=0,s=e.length;r<s;r++){const i=e[r];t[r]={scopeName:i,themeMatches:xs(n,i,e.slice(0,r))}}return t}function ut(n,e){return n===e||e.substring(0,n.length)===n&&e[n.length]==="."}function Ls(n,e,t){if(!ut(n[n.length-1],e))return!1;let r=n.length-2,s=t.length-1;for(;r>=0&&s>=0;)ut(n[r],t[s])&&(r-=1),s-=1;return r===-1}function xs(n,e,t){const r=[];for(const{selectors:s,settings:i}of n)for(const a of s)if(Ls(a,e,t)){r.push(i);break}return r}function He(n,e,t){const r=Object.entries(t.themes).filter(o=>o[1]).map(o=>({color:o[0],theme:o[1]})),s=r.map(o=>{const l=ye(n,e,{...t,theme:o.theme}),u=J(l),h=typeof o.theme=="string"?o.theme:o.theme.name;return{tokens:l,state:u,theme:h}}),i=Os(...s.map(o=>o.tokens)),a=i[0].map((o,l)=>o.map((u,h)=>{const g={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in t&&t.includeExplanation&&(g.explanation=u.explanation),i.forEach((f,d)=>{const{content:b,explanation:m,offset:_,...p}=f[l][h];g.variants[r[d].color]=p}),g})),c=s[0].state?new D(Object.fromEntries(s.map(o=>[o.theme,o.state?.getInternalStack(o.theme)])),s[0].state.lang):void 0;return c&&_e(a,c),a}function Os(...n){const e=n.map(()=>[]),t=n.length;for(let r=0;r<n[0].length;r++){const s=n.map(o=>o[r]),i=e.map(()=>[]);e.forEach((o,l)=>o.push(i[l]));const a=s.map(()=>0),c=s.map(o=>o[0]);for(;c.every(o=>o);){const o=Math.min(...c.map(l=>l.content.length));for(let l=0;l<t;l++){const u=c[l];u.content.length===o?(i[l].push(u),a[l]+=1,c[l]=s[l][a[l]]):(i[l].push({...u,content:u.content.slice(0,o)}),c[l]={...u,content:u.content.slice(o),offset:u.offset+o})}}}return e}function Y(n,e,t){let r,s,i,a,c,o;if("themes"in t){const{defaultColor:l="light",cssVariablePrefix:u="--shiki-"}=t,h=Object.entries(t.themes).filter(m=>m[1]).map(m=>({color:m[0],theme:m[1]})).sort((m,_)=>m.color===l?-1:_.color===l?1:0);if(h.length===0)throw new O("`themes` option must not be empty");const g=He(n,e,t);if(o=J(g),l&&!h.find(m=>m.color===l))throw new O(`\`themes\` option must contain the defaultColor key \`${l}\``);const f=h.map(m=>n.getTheme(m.theme)),d=h.map(m=>m.color);i=g.map(m=>m.map(_=>Gs(_,d,u,l))),o&&_e(i,o);const b=h.map(m=>fe(m.theme,t));s=h.map((m,_)=>(_===0&&l?"":`${u+m.color}:`)+(M(f[_].fg,b[_])||"inherit")).join(";"),r=h.map((m,_)=>(_===0&&l?"":`${u+m.color}-bg:`)+(M(f[_].bg,b[_])||"inherit")).join(";"),a=`shiki-themes ${f.map(m=>m.name).join(" ")}`,c=l?void 0:[s,r].join(";")}else if("theme"in t){const l=fe(t.theme,t);i=ye(n,e,t);const u=n.getTheme(t.theme);r=M(u.bg,l),s=M(u.fg,l),a=u.name,o=J(i)}else throw new O("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:s,bg:r,themeName:a,rootStyle:c,grammarState:o}}function Gs(n,e,t,r){const s={content:n.content,explanation:n.explanation,offset:n.offset},i=e.map(o=>Wt(n.variants[o])),a=new Set(i.flatMap(o=>Object.keys(o))),c={};return i.forEach((o,l)=>{for(const u of a){const h=o[u]||"inherit";if(l===0&&r)c[u]=h;else{const g=u==="color"?"":u==="background-color"?"-bg":`-${u}`,f=t+e[l]+(u==="color"?"":g);c[f]=h}}}),s.htmlStyle=c,s}function Q(n,e,t,r={meta:{},options:t,codeToHast:(s,i)=>Q(n,s,i),codeToTokens:(s,i)=>Y(n,s,i)}){let s=e;for(const f of de(t))s=f.preprocess?.call(r,s,t)||s;let{tokens:i,fg:a,bg:c,themeName:o,rootStyle:l,grammarState:u}=Y(n,s,t);const{mergeWhitespaces:h=!0}=t;h===!0?i=Ms(i):h==="never"&&(i=$s(i));const g={...r,get source(){return s}};for(const f of de(t))i=f.tokens?.call(g,i)||i;return Bs(i,{...t,fg:a,bg:c,themeName:o,rootStyle:l},g,u)}function Bs(n,e,t,r=J(n)){const s=de(e),i=[],a={type:"root",children:[]},{structure:c="classic",tabindex:o="0"}=e;let l={type:"element",tagName:"pre",properties:{class:`shiki ${e.themeName||""}`,style:e.rootStyle||`background-color:${e.bg};color:${e.fg}`,...o!==!1&&o!=null?{tabindex:o.toString()}:{},...Object.fromEntries(Array.from(Object.entries(e.meta||{})).filter(([d])=>!d.startsWith("_")))},children:[]},u={type:"element",tagName:"code",properties:{},children:i};const h=[],g={...t,structure:c,addClassToHast:jt,get source(){return t.source},get tokens(){return n},get options(){return e},get root(){return a},get pre(){return l},get code(){return u},get lines(){return h}};if(n.forEach((d,b)=>{b&&(c==="inline"?a.children.push({type:"element",tagName:"br",properties:{},children:[]}):c==="classic"&&i.push({type:"text",value:`
|
|
12
|
+
`}));let m={type:"element",tagName:"span",properties:{class:"line"},children:[]},_=0;for(const p of d){let y={type:"element",tagName:"span",properties:{...p.htmlAttrs},children:[{type:"text",value:p.content}]};typeof p.htmlStyle=="string"&&I("`htmlStyle` as a string is deprecated. Use an object instead.");const w=ps(p.htmlStyle||Wt(p));w&&(y.properties.style=w);for(const S of s)y=S?.span?.call(g,y,b+1,_,m,p)||y;c==="inline"?a.children.push(y):c==="classic"&&m.children.push(y),_+=p.content.length}if(c==="classic"){for(const p of s)m=p?.line?.call(g,m,b+1)||m;h.push(m),i.push(m)}}),c==="classic"){for(const d of s)u=d?.code?.call(g,u)||u;l.children.push(u);for(const d of s)l=d?.pre?.call(g,l)||l;a.children.push(l)}let f=a;for(const d of s)f=d?.root?.call(g,f)||f;return r&&_e(f,r),f}function Ms(n){return n.map(e=>{const t=[];let r="",s=0;return e.forEach((i,a)=>{const o=!(i.fontStyle&&i.fontStyle&x.Underline);o&&i.content.match(/^\s+$/)&&e[a+1]?(s||(s=i.offset),r+=i.content):r?(o?t.push({...i,offset:s,content:r+i.content}):t.push({content:r,offset:s},i),s=0,r=""):t.push(i)}),t})}function $s(n){return n.map(e=>e.flatMap(t=>{if(t.content.match(/^\s+$/))return t;const r=t.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return t;const[,s,i,a]=r;if(!s&&!a)return t;const c=[{...t,offset:t.offset+s.length,content:i}];return s&&c.unshift({content:s,offset:t.offset}),a&&c.push({content:a,offset:t.offset+s.length+i.length}),c}))}function qt(n,e,t){const r={meta:{},options:t,codeToHast:(i,a)=>Q(n,i,a),codeToTokens:(i,a)=>Y(n,i,a)};let s=ls(Q(n,e,t,r));for(const i of de(t))s=i.postprocess?.call(r,s,t)||s;return s}const ht={light:"#333333",dark:"#bbbbbb"},ft={light:"#fffffe",dark:"#1e1e1e"},dt="__shiki_resolved";function Fe(n){if(n?.[dt])return n;const e={...n};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:t,fg:r}=e;if(!t||!r){const c=e.settings?e.settings.find(o=>!o.name&&!o.scope):void 0;c?.settings?.foreground&&(r=c.settings.foreground),c?.settings?.background&&(t=c.settings.background),!r&&e?.colors?.["editor.foreground"]&&(r=e.colors["editor.foreground"]),!t&&e?.colors?.["editor.background"]&&(t=e.colors["editor.background"]),r||(r=e.type==="light"?ht.light:ht.dark),t||(t=e.type==="light"?ft.light:ft.dark),e.fg=r,e.bg=t}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let s=0;const i=new Map;function a(c){if(i.has(c))return i.get(c);s+=1;const o=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return e.colorReplacements?.[`#${o}`]?a(c):(i.set(c,o),o)}e.settings=e.settings.map(c=>{const o=c.settings?.foreground&&!c.settings.foreground.startsWith("#"),l=c.settings?.background&&!c.settings.background.startsWith("#");if(!o&&!l)return c;const u={...c,settings:{...c.settings}};if(o){const h=a(c.settings.foreground);e.colorReplacements[h]=c.settings.foreground,u.settings.foreground=h}if(l){const h=a(c.settings.background);e.colorReplacements[h]=c.settings.background,u.settings.background=h}return u});for(const c of Object.keys(e.colors||{}))if((c==="editor.foreground"||c==="editor.background"||c.startsWith("terminal.ansi"))&&!e.colors[c]?.startsWith("#")){const o=a(e.colors[c]);e.colorReplacements[o]=e.colors[c],e.colors[c]=o}return Object.defineProperty(e,dt,{enumerable:!1,writable:!1,value:!0}),e}async function zt(n){return Array.from(new Set((await Promise.all(n.filter(e=>!Mt(e)).map(async e=>await Ut(e).then(t=>Array.isArray(t)?t:[t])))).flat()))}async function Vt(n){return(await Promise.all(n.map(async t=>$t(t)?null:Fe(await Ut(t))))).filter(t=>!!t)}class js extends or{constructor(e,t,r,s={}){super(e),this._resolver=e,this._themes=t,this._langs=r,this._alias=s,this._themes.map(i=>this.loadTheme(i)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const t=Fe(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=oe.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){if(this._alias[e]){const t=new Set([e]);for(;this._alias[e];){if(e=this._alias[e],t.has(e))throw new T(`Circular alias \`${Array.from(t).join(" -> ")} -> ${e}\``);t.add(e)}}return this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const t=new Set([...this._langMap.values()].filter(i=>i.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const r={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const s=this.loadGrammarWithConfiguration(e.scopeName,1,r);if(s.name=e.name,this._resolvedGrammars.set(e.name,s),e.aliases&&e.aliases.forEach(i=>{this._alias[i]=e.name}),this._loadedLanguagesCache=null,t.size)for(const i of t)this._resolvedGrammars.delete(i.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(i.scopeName),this._syncRegistry?._grammars?.delete(i.scopeName),this.loadLanguage(this._langMap.get(i.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()),r=t.filter(([s,i])=>!i);if(r.length){const s=t.filter(([i,a])=>a&&a.embeddedLangs?.some(c=>r.map(([o])=>o).includes(c))).filter(i=>!r.includes(i));throw new T(`Missing languages ${r.map(([i])=>`\`${i}\``).join(", ")}, required by ${s.map(([i])=>`\`${i}\``).join(", ")}`)}for(const[s,i]of t)this._resolver.addLanguage(i);for(const[s,i]of t)this.loadLanguage(i)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){if(this._langMap.set(e.name,e),this._langGraph.set(e.name,e),e.embeddedLangs)for(const t of e.embeddedLangs)this._langGraph.set(t,this._langMap.get(t))}}class Us{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:r=>e.createScanner(r),createOnigString:r=>e.createString(r)},t.forEach(r=>this.addLanguage(r))}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 r=[];for(let s=1;s<=t.length;s++){const i=t.slice(0,s).join(".");r=[...r,...this._injections.get(i)||[]]}return r}}let H=0;function Kt(n){H+=1,n.warnings!==!1&&H>=10&&H%10===0&&console.warn(`[Shiki] ${H} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let e=!1;if(!n.engine)throw new T("`engine` option is required for synchronous mode");const t=(n.langs||[]).flat(1),r=(n.themes||[]).flat(1).map(Fe),s=new Us(n.engine,t),i=new js(s,r,t,n.langAlias);let a;function c(p){m();const y=i.getGrammar(typeof p=="string"?p:p.name);if(!y)throw new T(`Language \`${p}\` not found, you may need to load it first`);return y}function o(p){if(p==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};m();const y=i.getTheme(p);if(!y)throw new T(`Theme \`${p}\` not found, you may need to load it first`);return y}function l(p){m();const y=o(p);a!==p&&(i.setTheme(y),a=p);const w=i.getColorMap();return{theme:y,colorMap:w}}function u(){return m(),i.getLoadedThemes()}function h(){return m(),i.getLoadedLanguages()}function g(...p){m(),i.loadLanguages(p.flat(1))}async function f(...p){return g(await zt(p))}function d(...p){m();for(const y of p.flat(1))i.loadTheme(y)}async function b(...p){return m(),d(await Vt(p))}function m(){if(e)throw new T("Shiki instance has been disposed")}function _(){e||(e=!0,i.dispose(),H-=1)}return{setTheme:l,getTheme:o,getLanguage:c,getLoadedThemes:u,getLoadedLanguages:h,loadLanguage:f,loadLanguageSync:g,loadTheme:b,loadThemeSync:d,dispose:_,[Symbol.dispose]:_}}async function Jt(n={}){n.loadWasm&&I("`loadWasm` option is deprecated. Use `engine: createOnigurumaEngine(loadWasm)` instead.");const[e,t,r]=await Promise.all([Vt(n.themes||[]),zt(n.langs||[]),n.engine||$e(n.loadWasm||wn())]);return Kt({...n,themes:e,langs:t,engine:r})}function Xs(n={}){return I("`getShikiInternal` is deprecated. Use `createShikiInternal` instead."),Jt(n)}async function qe(n={}){const e=await Jt(n);return{getLastGrammarState:(...t)=>Ft(e,...t),codeToTokensBase:(t,r)=>ye(e,t,r),codeToTokensWithThemes:(t,r)=>He(e,t,r),codeToTokens:(t,r)=>Y(e,t,r),codeToHast:(t,r)=>Q(e,t,r),codeToHtml:(t,r)=>qt(e,t,r),...e,getInternalContext:()=>e}}function Zs(n={}){const e=Kt(n);return{getLastGrammarState:(...t)=>Ft(e,...t),codeToTokensBase:(t,r)=>ye(e,t,r),codeToTokensWithThemes:(t,r)=>He(e,t,r),codeToTokens:(t,r)=>Y(e,t,r),codeToHast:(t,r)=>Q(e,t,r),codeToHtml:(t,r)=>qt(e,t,r),...e,getInternalContext:()=>e}}function Ws(n){let e;async function t(r={}){if(e){const s=await e;return await Promise.all([s.loadTheme(...r.themes||[]),s.loadLanguage(...r.langs||[])]),s}else return e=n({...r,themes:r.themes||[],langs:r.langs||[]}),e}return t}const ei=Ws(qe);function ti(n={}){return I("`getHighlighterCore` is deprecated. Use `createHighlighterCore` or `getSingletonHighlighterCore` instead."),qe(n)}function ni(n,e,t){let r,s,i;if(e)I("`createdBundledHighlighter` signature with `bundledLanguages` and `bundledThemes` is deprecated. Use the options object signature instead."),r=n,s=e,i=()=>fs(t);else{const c=n;r=c.langs,s=c.themes,i=c.engine}async function a(c){function o(f){if(typeof f=="string"){if(Mt(f))return[];const d=r[f];if(!d)throw new O(`Language \`${f}\` is not included in this bundle. You may want to load it from external source.`);return d}return f}function l(f){if($t(f))return"none";if(typeof f=="string"){const d=s[f];if(!d)throw new O(`Theme \`${f}\` is not included in this bundle. You may want to load it from external source.`);return d}return f}const u=(c.themes??[]).map(f=>l(f)),h=(c.langs??[]).map(f=>o(f)),g=await qe({engine:c.engine??i(),...c,themes:u,langs:h});return{...g,loadLanguage(...f){return g.loadLanguage(...f.map(o))},loadTheme(...f){return g.loadTheme(...f.map(l))}}}return a}function Ds(n){let e;async function t(r={}){if(e){const s=await e;return await Promise.all([s.loadTheme(...r.themes||[]),s.loadLanguage(...r.langs||[])]),s}else return e=n({...r,themes:r.themes||[],langs:r.langs||[]}),e}return t}function ri(n){const e=Ds(n);return{getSingletonHighlighter(t){return e(t)},async codeToHtml(t,r){return(await e({langs:[r.lang],themes:"theme"in r?[r.theme]:Object.values(r.themes)})).codeToHtml(t,r)},async codeToHast(t,r){return(await e({langs:[r.lang],themes:"theme"in r?[r.theme]:Object.values(r.themes)})).codeToHast(t,r)},async codeToTokens(t,r){return(await e({langs:[r.lang],themes:"theme"in r?[r.theme]:Object.values(r.themes)})).codeToTokens(t,r)},async codeToTokensBase(t,r){return(await e({langs:[r.lang],themes:[r.theme]})).codeToTokensBase(t,r)},async codeToTokensWithThemes(t,r){return(await e({langs:[r.lang],themes:Object.values(r.themes).filter(Boolean)})).codeToTokensWithThemes(t,r)},async getLastGrammarState(t,r){return(await e({langs:[r.lang],themes:[r.theme]})).getLastGrammarState(t,r)}}}function si(n){return I("import `createJavaScriptRegexEngine` from `@shikijs/engine-javascript` or `shiki/engine/javascript` instead"),nn(n)}function ii(n){return I("import `defaultJavaScriptRegexConstructor` from `@shikijs/engine-javascript` or `shiki/engine/javascript` instead"),rn(n)}function ai(n={}){const{name:e="css-variables",variablePrefix:t="--shiki-",fontStyle:r=!0}=n,s=a=>n.variableDefaults?.[a]?`var(${t}${a}, ${n.variableDefaults[a]})`:`var(${t}${a})`,i={name:e,type:"dark",colors:{"editor.foreground":s("foreground"),"editor.background":s("background"),"terminal.ansiBlack":s("ansi-black"),"terminal.ansiRed":s("ansi-red"),"terminal.ansiGreen":s("ansi-green"),"terminal.ansiYellow":s("ansi-yellow"),"terminal.ansiBlue":s("ansi-blue"),"terminal.ansiMagenta":s("ansi-magenta"),"terminal.ansiCyan":s("ansi-cyan"),"terminal.ansiWhite":s("ansi-white"),"terminal.ansiBrightBlack":s("ansi-bright-black"),"terminal.ansiBrightRed":s("ansi-bright-red"),"terminal.ansiBrightGreen":s("ansi-bright-green"),"terminal.ansiBrightYellow":s("ansi-bright-yellow"),"terminal.ansiBrightBlue":s("ansi-bright-blue"),"terminal.ansiBrightMagenta":s("ansi-bright-magenta"),"terminal.ansiBrightCyan":s("ansi-bright-cyan"),"terminal.ansiBrightWhite":s("ansi-bright-white")},tokenColors:[{scope:["keyword.operator.accessor","meta.group.braces.round.function.arguments","meta.template.expression","markup.fenced_code meta.embedded.block"],settings:{foreground:s("foreground")}},{scope:"emphasis",settings:{fontStyle:"italic"}},{scope:["strong","markup.heading.markdown","markup.bold.markdown"],settings:{fontStyle:"bold"}},{scope:["markup.italic.markdown"],settings:{fontStyle:"italic"}},{scope:"meta.link.inline.markdown",settings:{fontStyle:"underline",foreground:s("token-link")}},{scope:["string","markup.fenced_code","markup.inline"],settings:{foreground:s("token-string")}},{scope:["comment","string.quoted.docstring.multi"],settings:{foreground:s("token-comment")}},{scope:["constant.numeric","constant.language","constant.other.placeholder","constant.character.format.placeholder","variable.language.this","variable.other.object","variable.other.class","variable.other.constant","meta.property-name","meta.property-value","support"],settings:{foreground:s("token-constant")}},{scope:["keyword","storage.modifier","storage.type","storage.control.clojure","entity.name.function.clojure","entity.name.tag.yaml","support.function.node","support.type.property-name.json","punctuation.separator.key-value","punctuation.definition.template-expression"],settings:{foreground:s("token-keyword")}},{scope:"variable.parameter.function",settings:{foreground:s("token-parameter")}},{scope:["support.function","entity.name.type","entity.other.inherited-class","meta.function-call","meta.instance.constructor","entity.other.attribute-name","entity.name.function","constant.keyword.clojure"],settings:{foreground:s("token-function")}},{scope:["entity.name.tag","string.quoted","string.regexp","string.interpolated","string.template","string.unquoted.plain.out.yaml","keyword.other.template"],settings:{foreground:s("token-string-expression")}},{scope:["punctuation.definition.arguments","punctuation.definition.dict","punctuation.separator","meta.function-call.arguments"],settings:{foreground:s("token-punctuation")}},{scope:["markup.underline.link","punctuation.definition.metadata.markdown"],settings:{foreground:s("token-link")}},{scope:["beginning.punctuation.definition.list.markdown"],settings:{foreground:s("token-string")}},{scope:["punctuation.definition.string.begin.markdown","punctuation.definition.string.end.markdown","string.other.link.title.markdown","string.other.link.description.markdown"],settings:{foreground:s("token-keyword")}},{scope:["markup.inserted","meta.diff.header.to-file","punctuation.definition.inserted"],settings:{foreground:s("token-inserted")}},{scope:["markup.deleted","meta.diff.header.from-file","punctuation.definition.deleted"],settings:{foreground:s("token-deleted")}},{scope:["markup.changed","punctuation.definition.changed"],settings:{foreground:s("token-changed")}}]};return r||(i.tokenColors=i.tokenColors?.map(a=>(a.settings?.fontStyle&&delete a.settings.fontStyle,a))),i}export{x as FontStyle,O as ShikiError,W as StackElementMetadata,jt as addClassToHast,M as applyColorReplacements,Q as codeToHast,qt as codeToHtml,Y as codeToTokens,ye as codeToTokensBase,He as codeToTokensWithThemes,ai as createCssVariablesTheme,qe as createHighlighterCore,Zs as createHighlighterCoreSync,si as createJavaScriptRegexEngine,fs as createOnigurumaEngine,_s as createPositionConverter,Jt as createShikiInternal,Kt as createShikiInternalSync,ri as createSingletonShorthands,Ys as createWasmOnigEngine,ni as createdBundledHighlighter,ii as defaultJavaScriptRegexConstructor,Ks as enableDeprecationWarnings,ti as getHighlighterCore,Xs as getShikiInternal,ei as getSingletonHighlighterCore,Wt as getTokenStyleObject,ls as hastToHtml,De as isNoneTheme,We as isPlainLang,Mt as isSpecialLang,$t as isSpecialTheme,Qs as loadWasm,Ds as makeSingletonHighlighter,Ws as makeSingletonHighlighterCore,Ut as normalizeGetter,Fe as normalizeTheme,fe as resolveColorReplacements,pe as splitLines,gs as splitToken,ms as splitTokens,ps as stringifyTokenStyle,ds as toArray,As as tokenizeAnsiWithTheme,Is as tokenizeWithTheme,Bs as tokensToHast,bs as transformerDecorations,I as warnDeprecated};
|