@vap/shiki
Version:
shiki, stripped of assets + browser only
1 lines • 85.9 kB
JavaScript
!function(e){"use strict";var t;e.FontStyle=void 0,(t=e.FontStyle||(e.FontStyle={}))[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline";class n{static toBinaryStr(e){let t=e.toString(2);for(;t.length<32;)t="0"+t;return t}static printMetadata(e){let t=n.getLanguageId(e),r=n.getTokenType(e),o=n.getFontStyle(e),i=n.getForeground(e),s=n.getBackground(e);console.log({languageId:t,tokenType:r,fontStyle:o,foreground:i,background:s})}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(1792&e)>>>8}static getFontStyle(e){return(14336&e)>>>11}static getForeground(e){return(8372224&e)>>>14}static getBackground(e){return(4286578688&e)>>>23}static set(t,r,o,i,s,a){let c=n.getLanguageId(t),u=n.getTokenType(t),l=n.getFontStyle(t),h=n.getForeground(t),f=n.getBackground(t);return 0!==r&&(c=r),0!==o&&(u=8===o?0:o),i!==e.FontStyle.NotSet&&(l=i),0!==s&&(h=s),0!==a&&(f=a),(c<<0|u<<8|l<<11|h<<14|f<<23)>>>0}}class r{constructor(e,t){this.languagesPath="languages/",this.languageMap={},this.scopeToLangMap={},this._onigLibPromise=e,this._onigLibName=t}get onigLib(){return this._onigLibPromise}getOnigLibName(){return this._onigLibName}getLangRegistration(e){return this.languageMap[e]}async loadGrammar(e){const t=this.scopeToLangMap[e];return t&&t.grammar?t.grammar:null}addLanguage(e){this.languageMap[e.id]=e,e.aliases&&e.aliases.forEach((t=>{this.languageMap[t]=e})),this.scopeToLangMap[e.scopeName]=e}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var o={exports:{}};function i(e,t){let n=[];for(let r=0,o=t.length;r<o;r++){let o=t.slice(0,r),i=t[r];n[r]={scopeName:i,themeMatches:u(e,i,o)}}return n}function s(e,t){let n=e+".";return e===t||t.substring(0,n.length)===n}function a(e,t,n,r){if(!s(e,n))return!1;let o=t.length-1,i=r.length-1;for(;o>=0&&i>=0;)s(t[o],r[i])&&o--,i--;return-1===o}o.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(5),i=n(6),s=n(2),a="undefined"==typeof performance?function(){return Date.now()}:function(){return performance.now()};t.createGrammar=function(e,t,n,r,o,i){return new v(e,t,n,r,o,i)};var c=function(e){this.scopeName=e};t.FullScopeDependency=c;var u=function(){function e(e,t){this.scopeName=e,this.include=t}return e.prototype.toKey=function(){return this.scopeName+"#"+this.include},e}();t.PartialScopeDependency=u;var l=function(){function e(){this.full=[],this.partial=[],this.visitedRule=new Set,this._seenFull=new Set,this._seenPartial=new Set}return e.prototype.add=function(e){e instanceof c?this._seenFull.has(e.scopeName)||(this._seenFull.add(e.scopeName),this.full.push(e)):this._seenPartial.has(e.toKey())||(this._seenPartial.add(e.toKey()),this.partial.push(e))},e}();function h(e,t,n,o,i){for(var s=0,a=o;s<a.length;s++){var l=a[s];if(!e.visitedRule.has(l)){e.visitedRule.add(l);var d=l.repository?r.mergeObjects({},i,l.repository):i;Array.isArray(l.patterns)&&h(e,t,n,l.patterns,d);var g=l.include;if(g)if("$base"===g||g===t.scopeName)p(e,t,t);else if("$self"===g||g===n.scopeName)p(e,t,n);else if("#"===g.charAt(0))f(e,t,n,g.substring(1),d);else{var m=g.indexOf("#");if(m>=0){var _=g.substring(0,m),y=g.substring(m+1);_===t.scopeName?f(e,t,t,y,d):_===n.scopeName?f(e,t,n,y,d):e.add(new u(_,g.substring(m+1)))}else e.add(new c(g))}}}}function f(e,t,n,r,o){void 0===o&&(o=n.repository),o&&o[r]&&h(e,t,n,[o[r]],o)}function p(e,t,n){if(n.patterns&&Array.isArray(n.patterns)&&h(e,t,n,n.patterns,n.repository),n.injections){var r=[];for(var o in n.injections)r.push(n.injections[o]);h(e,t,n,r,n.repository)}}function d(e,t){if(!e)return!1;if(e===t)return!0;var n=t.length;return e.length>n&&e.substr(0,n)===t&&"."===e[n]}function g(e,t){if(t.length<e.length)return!1;var n=0;return e.every((function(e){for(var r=n;r<t.length;r++)if(d(t[r],e))return n=r+1,!0;return!1}))}function m(e,t,n,r,s){for(var a=i.createMatchers(t,g),c=o.RuleFactory.getCompiledRuleId(n,r,s.repository),u=0,l=a;u<l.length;u++){var h=l[u];e.push({matcher:h.matcher,ruleId:c,grammar:s,priority:h.priority})}}t.ScopeDependencyCollector=l,t.collectSpecificDependencies=f,t.collectDependencies=p;var _=function(e,t,n,r){this.scopeName=e,this.languageId=t,this.tokenType=n,this.themeData=r};t.ScopeMetadata=_;var y=function(){function e(t,n,r){if(this._initialLanguage=t,this._themeProvider=n,this._cache=new Map,this._defaultMetaData=new _("",this._initialLanguage,0,[this._themeProvider.getDefaults()]),this._embeddedLanguages=Object.create(null),r)for(var o=Object.keys(r),i=0,s=o.length;i<s;i++){var a=o[i],c=r[a];"number"==typeof c&&0!==c?this._embeddedLanguages[a]=c:console.warn("Invalid embedded language found at scope "+a+": <<"+c+">>")}var u=Object.keys(this._embeddedLanguages).map((function(t){return e._escapeRegExpCharacters(t)}));0===u.length?this._embeddedLanguagesRegex=null:(u.sort(),u.reverse(),this._embeddedLanguagesRegex=new RegExp("^(("+u.join(")|(")+"))($|\\.)",""))}return e.prototype.onDidChangeTheme=function(){this._cache=new Map,this._defaultMetaData=new _("",this._initialLanguage,0,[this._themeProvider.getDefaults()])},e.prototype.getDefaultMetadata=function(){return this._defaultMetaData},e._escapeRegExpCharacters=function(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")},e.prototype.getMetadataForScope=function(t){if(null===t)return e._NULL_SCOPE_METADATA;var n=this._cache.get(t);return n||(n=this._doGetMetadataForScope(t),this._cache.set(t,n),n)},e.prototype._doGetMetadataForScope=function(e){var t=this._scopeToLanguage(e),n=this._toStandardTokenType(e),r=this._themeProvider.themeMatch(e);return new _(e,t,n,r)},e.prototype._scopeToLanguage=function(e){if(!e)return 0;if(!this._embeddedLanguagesRegex)return 0;var t=e.match(this._embeddedLanguagesRegex);return t&&(this._embeddedLanguages[t[1]]||0)||0},e.prototype._toStandardTokenType=function(t){var n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 0;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 4;case"meta.embedded":return 8}throw new Error("Unexpected match for standard token type!")},e._NULL_SCOPE_METADATA=new _("",0,0,null),e.STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/,e}(),v=function(){function e(e,t,n,r,o,s){if(this._scopeMetadataProvider=new y(t,o,n),this._onigLib=s,this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=k(e,null),this._injections=null,this._tokenTypeMatchers=[],r)for(var a=0,c=Object.keys(r);a<c.length;a++)for(var u=c[a],l=0,h=i.createMatchers(u,g);l<h.length;l++){var f=h[l];this._tokenTypeMatchers.push({matcher:f.matcher,type:r[u]})}}return e.prototype.dispose=function(){for(var e=0,t=this._ruleId2desc;e<t.length;e++){var n=t[e];n&&n.dispose()}},e.prototype.createOnigScanner=function(e){return this._onigLib.createOnigScanner(e)},e.prototype.createOnigString=function(e){return this._onigLib.createOnigString(e)},e.prototype.onDidChangeTheme=function(){this._scopeMetadataProvider.onDidChangeTheme()},e.prototype.getMetadataForScope=function(e){return this._scopeMetadataProvider.getMetadataForScope(e)},e.prototype.getInjections=function(){var e=this;if(null===this._injections){this._injections=[];var t=this._grammar.injections;if(t)for(var n in t)m(this._injections,n,t[n],this,this._grammar);if(this._grammarRepository){var r=this._grammarRepository.injections(this._grammar.scopeName);r&&r.forEach((function(t){var n=e.getExternalGrammar(t);if(n){var r=n.injectionSelector;r&&m(e._injections,r,n,e,n)}}))}this._injections.sort((function(e,t){return e.priority-t.priority}))}return this._injections},e.prototype.registerRule=function(e){var t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n},e.prototype.getRule=function(e){return this._ruleId2desc[e]},e.prototype.getExternalGrammar=function(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){var n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=k(n,t&&t.$base),this._includedGrammars[e]}return null},e.prototype.tokenizeLine=function(e,t){var n=this._tokenize(e,t,!1);return{tokens:n.lineTokens.getResult(n.ruleStack,n.lineLength),ruleStack:n.ruleStack}},e.prototype.tokenizeLine2=function(e,t){var n=this._tokenize(e,t,!0);return{tokens:n.lineTokens.getBinaryResult(n.ruleStack,n.lineLength),ruleStack:n.ruleStack}},e.prototype._tokenize=function(e,t,n){var r;if(-1===this._rootId&&(this._rootId=o.RuleFactory.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository)),t&&t!==P.NULL)r=!1,t.reset();else{r=!0;var i=this._scopeMetadataProvider.getDefaultMetadata(),s=i.themeData[0],a=A.set(0,i.languageId,i.tokenType,s.fontStyle,s.foreground,s.background),c=this.getRule(this._rootId).getName(null,null),u=this._scopeMetadataProvider.getMetadataForScope(c),l=R.mergeMetadata(a,null,u),h=new R(null,null===c?"unknown":c,l);t=new P(null,this._rootId,-1,-1,!1,null,h,h)}e+="\n";var f=this.createOnigString(e),p=f.content.length,d=new L(n,e,this._tokenTypeMatchers),g=T(this,f,r,0,t,d,!0);return b(f),{lineLength:p,lineTokens:d,ruleStack:g}},e}();function b(e){"function"==typeof e.dispose&&e.dispose()}function k(e,t){return(e=r.clone(e)).repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}function w(e,t,n,r,o,i,s){if(0!==i.length){for(var a=t.content,c=Math.min(i.length,s.length),u=[],l=s[0].end,h=0;h<c;h++){var f=i[h];if(null!==f){var p=s[h];if(0!==p.length){if(p.start>l)break;for(;u.length>0&&u[u.length-1].endPos<=p.start;)o.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?o.produceFromScopes(u[u.length-1].scopes,p.start):o.produce(r,p.start),f.retokenizeCapturedWithRuleId){var d=f.getName(a,s),g=r.contentNameScopesList.push(e,d),m=f.getContentName(a,s),_=g.push(e,m),y=r.push(f.retokenizeCapturedWithRuleId,p.start,-1,!1,null,g,_),v=e.createOnigString(a.substring(0,p.end));T(e,v,n&&0===p.start,p.start,y,o,!1),b(v)}else{var k=f.getName(a,s);if(null!==k){var w=(u.length>0?u[u.length-1].scopes:r.contentNameScopesList).push(e,k);u.push(new x(w,p.end))}}}}}for(;u.length>0;)o.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}}function S(e){for(var t=[],n=0,r=e.rules.length;n<r;n++)t.push(" - "+e.rules[n]+": "+e.debugRegExps[n]);return t.join("\n")}function C(e,t,n,r,o,i){var c=function(e,t,n,r,o,i){var c=o.getRule(e),u=c.compile(e,o.endRule,n,r===i),l=0;s.DebugFlags.InDebugMode&&(l=a());var h=u.scanner.findNextMatchSync(t,r);if(s.DebugFlags.InDebugMode){var f=a()-l;f>5&&console.warn("Rule "+c.debugName+" ("+c.id+") matching took "+f+" against '"+t+"'"),h&&console.log("matched rule id: "+u.rules[h.index]+" from "+h.captureIndices[0].start+" to "+h.captureIndices[0].end)}return h?{captureIndices:h.captureIndices,matchedRuleId:u.rules[h.index]}:null}(e,t,n,r,o,i),u=e.getInjections();if(0===u.length)return c;var l=function(e,t,n,r,o,i,a){for(var c,u=Number.MAX_VALUE,l=null,h=0,f=i.contentNameScopesList.generateScopes(),p=0,d=e.length;p<d;p++){var g=e[p];if(g.matcher(f)){var m=t.getRule(g.ruleId).compile(t,null,r,o===a),_=m.scanner.findNextMatchSync(n,o);if(s.DebugFlags.InDebugMode&&(console.log(" scanning for injections"),console.log(S(m))),_){var y=_.captureIndices[0].start;if(!(y>=u)&&(u=y,l=_.captureIndices,c=m.rules[_.index],h=g.priority,u===o))break}}}return l?{priorityMatch:-1===h,captureIndices:l,matchedRuleId:c}:null}(u,e,t,n,r,o,i);if(!l)return c;if(!c)return l;var h=c.captureIndices[0].start,f=l.captureIndices[0].start;return f<h||l.priorityMatch&&f===h?l:c}function T(e,t,n,r,i,a,c){var u=t.content.length,l=!1,h=-1;if(c){var f=function(e,t,n,r,i,a){for(var c=i.beginRuleCapturedEOL?0:-1,u=[],l=i;l;l=l.pop()){var h=l.getRule(e);h instanceof o.BeginWhileRule&&u.push({rule:h,stack:l})}for(var f=u.pop();f;f=u.pop()){var p=f.rule.compileWhile(e,f.stack.endRule,n,c===r),d=p.scanner.findNextMatchSync(t,r);if(s.DebugFlags.InDebugMode&&(console.log(" scanning for while rule"),console.log(S(p))),!d){s.DebugFlags.InDebugMode&&console.log(" popping "+f.rule.debugName+" - "+f.rule.debugWhileRegExp),i=f.stack.pop();break}if(-2!==p.rules[d.index]){i=f.stack.pop();break}d.captureIndices&&d.captureIndices.length&&(a.produce(f.stack,d.captureIndices[0].start),w(e,t,n,f.stack,a,f.rule.whileCaptures,d.captureIndices),a.produce(f.stack,d.captureIndices[0].end),c=d.captureIndices[0].end,d.captureIndices[0].end>r&&(r=d.captureIndices[0].end,n=!1))}return{stack:i,linePos:r,anchorPosition:c,isFirstLine:n}}(e,t,n,r,i,a);i=f.stack,r=f.linePos,n=f.isFirstLine,h=f.anchorPosition}for(;!l;)p();function p(){s.DebugFlags.InDebugMode&&(console.log(""),console.log("@@scanNext "+r+": |"+t.content.substr(r).replace(/\n$/,"\\n")+"|"));var c=C(e,t,n,r,i,h);if(!c)return s.DebugFlags.InDebugMode&&console.log(" no more matches."),a.produce(i,u),void(l=!0);var f=c.captureIndices,p=c.matchedRuleId,d=!!(f&&f.length>0)&&f[0].end>r;if(-1===p){var g=i.getRule(e);s.DebugFlags.InDebugMode&&console.log(" popping "+g.debugName+" - "+g.debugEndRegExp),a.produce(i,f[0].start),i=i.setContentNameScopesList(i.nameScopesList),w(e,t,n,i,a,g.endCaptures,f),a.produce(i,f[0].end);var m=i;if(i=i.pop(),h=m.getAnchorPos(),!d&&m.getEnterPos()===r)return s.DebugFlags.InDebugMode&&console.error("[1] - Grammar is in an endless loop - Grammar pushed & popped a rule without advancing"),i=m,a.produce(i,u),void(l=!0)}else{var _=e.getRule(p);a.produce(i,f[0].start);var y=i,v=_.getName(t.content,f),b=i.contentNameScopesList.push(e,v);if(i=i.push(p,r,h,f[0].end===u,null,b,b),_ instanceof o.BeginEndRule){var k=_;s.DebugFlags.InDebugMode&&console.log(" pushing "+k.debugName+" - "+k.debugBeginRegExp),w(e,t,n,i,a,k.beginCaptures,f),a.produce(i,f[0].end),h=f[0].end;var S=k.getContentName(t.content,f),T=b.push(e,S);if(i=i.setContentNameScopesList(T),k.endHasBackReferences&&(i=i.setEndRule(k.getEndWithResolvedBackReferences(t.content,f))),!d&&y.hasSameRuleAs(i))return s.DebugFlags.InDebugMode&&console.error("[2] - Grammar is in an endless loop - Grammar pushed the same rule without advancing"),i=i.pop(),a.produce(i,u),void(l=!0)}else if(_ instanceof o.BeginWhileRule){if(k=_,s.DebugFlags.InDebugMode&&console.log(" pushing "+k.debugName),w(e,t,n,i,a,k.beginCaptures,f),a.produce(i,f[0].end),h=f[0].end,S=k.getContentName(t.content,f),T=b.push(e,S),i=i.setContentNameScopesList(T),k.whileHasBackReferences&&(i=i.setEndRule(k.getWhileWithResolvedBackReferences(t.content,f))),!d&&y.hasSameRuleAs(i))return s.DebugFlags.InDebugMode&&console.error("[3] - Grammar is in an endless loop - Grammar pushed the same rule without advancing"),i=i.pop(),a.produce(i,u),void(l=!0)}else{var A=_;if(s.DebugFlags.InDebugMode&&console.log(" matched "+A.debugName+" - "+A.debugMatchRegExp),w(e,t,n,i,a,A.captures,f),a.produce(i,f[0].end),i=i.pop(),!d)return s.DebugFlags.InDebugMode&&console.error("[4] - Grammar is in an endless loop - Grammar is not advancing, nor is it pushing/popping"),i=i.safePop(),a.produce(i,u),void(l=!0)}}f[0].end>r&&(r=f[0].end,n=!1)}return i}t.Grammar=v;var A=function(){function e(){}return e.toBinaryStr=function(e){for(var t=e.toString(2);t.length<32;)t="0"+t;return t},e.printMetadata=function(t){var n=e.getLanguageId(t),r=e.getTokenType(t),o=e.getFontStyle(t),i=e.getForeground(t),s=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:o,foreground:i,background:s})},e.getLanguageId=function(e){return(255&e)>>>0},e.getTokenType=function(e){return(1792&e)>>>8},e.getFontStyle=function(e){return(14336&e)>>>11},e.getForeground=function(e){return(8372224&e)>>>14},e.getBackground=function(e){return(4286578688&e)>>>23},e.set=function(t,n,r,o,i,s){var a=e.getLanguageId(t),c=e.getTokenType(t),u=e.getFontStyle(t),l=e.getForeground(t),h=e.getBackground(t);return 0!==n&&(a=n),0!==r&&(c=8===r?0:r),-1!==o&&(u=o),0!==i&&(l=i),0!==s&&(h=s),(a<<0|c<<8|u<<11|l<<14|h<<23)>>>0},e}();t.StackElementMetadata=A;var R=function(){function e(e,t,n){this.parent=e,this.scope=t,this.metadata=n}return e._equals=function(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.scope!==t.scope||e.metadata!==t.metadata)return!1;e=e.parent,t=t.parent}},e.prototype.equals=function(t){return e._equals(this,t)},e._matchesScope=function(e,t,n){return t===e||e.substring(0,n.length)===n},e._matches=function(e,t){if(null===t)return!0;for(var n=t.length,r=0,o=t[r],i=o+".";e;){if(this._matchesScope(e.scope,o,i)){if(++r===n)return!0;i=(o=t[r])+"."}e=e.parent}return!1},e.mergeMetadata=function(e,t,n){if(null===n)return e;var r=-1,o=0,i=0;if(null!==n.themeData)for(var s=0,a=n.themeData.length;s<a;s++){var c=n.themeData[s];if(this._matches(t,c.parentScopes)){r=c.fontStyle,o=c.foreground,i=c.background;break}}return A.set(e,n.languageId,n.tokenType,r,o,i)},e._push=function(t,n,r){for(var o=0,i=r.length;o<i;o++){var s=r[o],a=n.getMetadataForScope(s),c=e.mergeMetadata(t.metadata,t,a);t=new e(t,s,c)}return t},e.prototype.push=function(t,n){return null===n?this:n.indexOf(" ")>=0?e._push(this,t,n.split(/ /g)):e._push(this,t,[n])},e._generateScopes=function(e){for(var t=[],n=0;e;)t[n++]=e.scope,e=e.parent;return t.reverse(),t},e.prototype.generateScopes=function(){return e._generateScopes(this)},e}();t.ScopeListElement=R;var P=function(){function e(e,t,n,r,o,i,s,a){this.parent=e,this.depth=this.parent?this.parent.depth+1:1,this.ruleId=t,this._enterPos=n,this._anchorPos=r,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=s,this.contentNameScopesList=a}return e._structuralEquals=function(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}},e._equals=function(e,t){return e===t||!!this._structuralEquals(e,t)&&e.contentNameScopesList.equals(t.contentNameScopesList)},e.prototype.clone=function(){return this},e.prototype.equals=function(t){return null!==t&&e._equals(this,t)},e._reset=function(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent},e.prototype.reset=function(){e._reset(this)},e.prototype.pop=function(){return this.parent},e.prototype.safePop=function(){return this.parent?this.parent:this},e.prototype.push=function(t,n,r,o,i,s,a){return new e(this,t,n,r,o,i,s,a)},e.prototype.getEnterPos=function(){return this._enterPos},e.prototype.getAnchorPos=function(){return this._anchorPos},e.prototype.getRule=function(e){return e.getRule(this.ruleId)},e.prototype._writeString=function(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]="("+this.ruleId+", TODO-"+this.nameScopesList+", TODO-"+this.contentNameScopesList+")",t},e.prototype.toString=function(){var e=[];return this._writeString(e,0),"["+e.join(",")+"]"},e.prototype.setContentNameScopesList=function(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)},e.prototype.setEndRule=function(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)},e.prototype.hasSameRuleAs=function(e){return this.ruleId===e.ruleId},e.NULL=new e(null,0,0,0,!1,null,null,null),e}();t.StackElement=P;var x=function(e,t){this.scopes=e,this.endPos=t};t.LocalStackElement=x;var L=function(){function e(e,t,n){this._emitBinaryTokens=e,this._tokenTypeOverrides=n,s.DebugFlags.InDebugMode?this._lineText=t:this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}return e.prototype.produce=function(e,t){this.produceFromScopes(e.contentNameScopesList,t)},e.prototype.produceFromScopes=function(e,t){if(!(this._lastTokenEndIndex>=t)){if(this._emitBinaryTokens){for(var n=e.metadata,r=0,o=this._tokenTypeOverrides;r<o.length;r++){var i=o[r];i.matcher(e.generateScopes())&&(n=A.set(n,0,I(i.type),-1,0,0))}return this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n||(this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n)),void(this._lastTokenEndIndex=t)}var a=e.generateScopes();if(s.DebugFlags.InDebugMode){console.log(" token: |"+this._lineText.substring(this._lastTokenEndIndex,t).replace(/\n$/,"\\n")+"|");for(var c=0;c<a.length;c++)console.log(" * "+a[c])}this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:a}),this._lastTokenEndIndex=t}},e.prototype.getResult=function(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),0===this._tokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens},e.prototype.getBinaryResult=function(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);for(var n=new Uint32Array(this._binaryTokens.length),r=0,o=this._binaryTokens.length;r<o;r++)n[r]=this._binaryTokens[r];return n},e}();function I(e){switch(e){case 4:return 4;case 2:return 2;case 1:return 1;case 0:default:return 8}}},function(e,t,n){function r(e){return Array.isArray(e)?function(e){for(var t=[],n=0,o=e.length;n<o;n++)t[n]=r(e[n]);return t}(e):"object"==typeof e?function(e){var t={};for(var n in e)t[n]=r(e[n]);return t}(e):e}Object.defineProperty(t,"__esModule",{value:!0}),t.clone=function(e){return r(e)},t.mergeObjects=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.forEach((function(t){for(var n in t)e[n]=t[n]})),e},t.basename=function e(t){var n=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return 0===n?t:~n==t.length-1?e(t.substring(0,t.length-1)):t.substr(1+~n)};var o=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/,i=function(){function e(){}return e.hasCaptures=function(e){return null!==e&&o.test(e)},e.replaceCaptures=function(e,t,n){return e.replace(o,(function(e,r,o,i){var s=n[parseInt(r||o,10)];if(!s)return e;for(var a=t.substring(s.start,s.end);"."===a[0];)a=a.substring(1);switch(i){case"downcase":return a.toLowerCase();case"upcase":return a.toUpperCase();default:return a}}))},e}();t.RegexSource=i},function(e,t,n){(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.DebugFlags={InDebugMode:void 0!==e&&!!e.env.VSCODE_TEXTMATE_DEBUG}}).call(this,n(7))},function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=n(4),s=n(8),a=n(11),c=n(0),u=function(){function e(e){this._options=e,this._syncRegistry=new i.SyncRegistry(a.Theme.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}return e.prototype.dispose=function(){this._syncRegistry.dispose()},e.prototype.setTheme=function(e,t){this._syncRegistry.setTheme(a.Theme.createFromRawTheme(e,t))},e.prototype.getColorMap=function(){return this._syncRegistry.getColorMap()},e.prototype.loadGrammarWithEmbeddedLanguages=function(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})},e.prototype.loadGrammarWithConfiguration=function(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes)},e.prototype.loadGrammar=function(e){return this._loadGrammar(e,0,null,null)},e.prototype._doLoadSingleGrammar=function(e){return r(this,void 0,void 0,(function(){var t,n;return o(this,(function(r){switch(r.label){case 0:return[4,this._options.loadGrammar(e)];case 1:return(t=r.sent())&&(n="function"==typeof this._options.getInjections?this._options.getInjections(e):void 0,this._syncRegistry.addGrammar(t,n)),[2]}}))}))},e.prototype._loadSingleGrammar=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return this._ensureGrammarCache.has(e)||this._ensureGrammarCache.set(e,this._doLoadSingleGrammar(e)),[2,this._ensureGrammarCache.get(e)]}))}))},e.prototype._collectDependenciesForDep=function(e,t,n){var r=this._syncRegistry.lookup(n.scopeName);if(r){n instanceof c.FullScopeDependency?c.collectDependencies(t,this._syncRegistry.lookup(e),r):c.collectSpecificDependencies(t,this._syncRegistry.lookup(e),r,n.include);var o=this._syncRegistry.injections(n.scopeName);if(o)for(var i=0,s=o;i<s.length;i++){var a=s[i];t.add(new c.FullScopeDependency(a))}}else if(n.scopeName===e)throw new Error("No grammar provided for <"+e+">")},e.prototype._loadGrammar=function(e,t,n,i){return r(this,void 0,void 0,(function(){var r,s,a,u,l,h,f,p,d,g,m,_,y=this;return o(this,(function(o){switch(o.label){case 0:r=new Set,s=new Set,r.add(e),a=[new c.FullScopeDependency(e)],o.label=1;case 1:return a.length>0?(u=a,a=[],[4,Promise.all(u.map((function(e){return y._loadSingleGrammar(e.scopeName)})))]):[3,3];case 2:for(o.sent(),l=new c.ScopeDependencyCollector,h=0,f=u;h<f.length;h++)_=f[h],this._collectDependenciesForDep(e,l,_);for(p=0,d=l.full;p<d.length;p++)_=d[p],r.has(_.scopeName)||(r.add(_.scopeName),a.push(_));for(g=0,m=l.partial;g<m.length;g++)_=m[g],r.has(_.scopeName)||s.has(_.toKey())||(s.add(_.toKey()),a.push(_));return[3,1];case 3:return[2,this.grammarForScopeName(e,t,n,i)]}}))}))},e.prototype.addGrammar=function(e,t,n,i){return void 0===t&&(t=[]),void 0===n&&(n=0),void 0===i&&(i=null),r(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return this._syncRegistry.addGrammar(e,t),[4,this.grammarForScopeName(e.scopeName,n,i)];case 1:return[2,r.sent()]}}))}))},e.prototype.grammarForScopeName=function(e,t,n,r){return void 0===t&&(t=0),void 0===n&&(n=null),void 0===r&&(r=null),this._syncRegistry.grammarForScopeName(e,t,n,r)},e}();t.Registry=u,t.INITIAL=c.StackElement.NULL,t.parseRawGrammar=s.parseRawGrammar},function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),s=function(){function e(e,t){this._theme=e,this._grammars={},this._rawGrammars={},this._injectionGrammars={},this._onigLibPromise=t}return e.prototype.dispose=function(){for(var e in this._grammars)this._grammars.hasOwnProperty(e)&&this._grammars[e].dispose()},e.prototype.setTheme=function(e){var t=this;this._theme=e,Object.keys(this._grammars).forEach((function(e){t._grammars[e].onDidChangeTheme()}))},e.prototype.getColorMap=function(){return this._theme.getColorMap()},e.prototype.addGrammar=function(e,t){this._rawGrammars[e.scopeName]=e,t&&(this._injectionGrammars[e.scopeName]=t)},e.prototype.lookup=function(e){return this._rawGrammars[e]},e.prototype.injections=function(e){return this._injectionGrammars[e]},e.prototype.getDefaults=function(){return this._theme.getDefaults()},e.prototype.themeMatch=function(e){return this._theme.match(e)},e.prototype.grammarForScopeName=function(e,t,n,s){return r(this,void 0,void 0,(function(){var r,a,c,u,l;return o(this,(function(o){switch(o.label){case 0:return this._grammars[e]?[3,2]:(r=this._rawGrammars[e])?(a=this._grammars,c=e,u=i.createGrammar,l=[r,t,n,s,this],[4,this._onigLibPromise]):[2,null];case 1:a[c]=u.apply(void 0,l.concat([o.sent()])),o.label=2;case 2:return[2,this._grammars[e]]}}))}))},e}();t.SyncRegistry=s},function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),s=/\\(\d+)/,a=/\\(\d+)/g,c=function(){function e(e,t,n){this.debugRegExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}return e.prototype.dispose=function(){"function"==typeof this.scanner.dispose&&this.scanner.dispose()},e}();t.CompiledRule=c;var u=function(){function e(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=i.RegexSource.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=i.RegexSource.hasCaptures(this._contentName)}return Object.defineProperty(e.prototype,"debugName",{get:function(){var e=this.$location?i.basename(this.$location.filename)+":"+this.$location.line:"unknown";return this.constructor.name+"#"+this.id+" @ "+e},enumerable:!0,configurable:!0}),e.prototype.getName=function(e,t){return this._nameIsCapturing&&null!==this._name&&null!==e&&null!==t?i.RegexSource.replaceCaptures(this._name,e,t):this._name},e.prototype.getContentName=function(e,t){return this._contentNameIsCapturing&&null!==this._contentName?i.RegexSource.replaceCaptures(this._contentName,e,t):this._contentName},e}();t.Rule=u;var l=function(e){function t(t,n,r,o,i){var s=e.call(this,t,n,r,o)||this;return s.retokenizeCapturedWithRuleId=i,s}return o(t,e),t.prototype.dispose=function(){},t.prototype.collectPatternsRecursive=function(e,t,n){throw new Error("Not supported!")},t.prototype.compile=function(e,t,n,r){throw new Error("Not supported!")},t}(u);t.CaptureRule=l;var h=function(){function e(e,t,n){if(void 0===n&&(n=!0),n)if(e){for(var r=e.length,o=0,i=[],a=!1,c=0;c<r;c++)if("\\"===e.charAt(c)&&c+1<r){var u=e.charAt(c+1);"z"===u?(i.push(e.substring(o,c)),i.push("$(?!\\n)(?<!\\n)"),o=c+2):"A"!==u&&"G"!==u||(a=!0),c++}this.hasAnchor=a,0===o?this.source=e:(i.push(e.substring(o,r)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=e;else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,this.hasBackReferences=s.test(this.source)}return e.prototype.clone=function(){return new e(this.source,this.ruleId,!0)},e.prototype.setSource=function(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))},e.prototype.resolveBackReferences=function(e,t){var n=t.map((function(t){return e.substring(t.start,t.end)}));return a.lastIndex=0,this.source.replace(a,(function(e,t){return(n[parseInt(t,10)]||"").replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}))},e.prototype._buildAnchorCache=function(){var e,t,n,r,o=[],i=[],s=[],a=[];for(e=0,t=this.source.length;e<t;e++)n=this.source.charAt(e),o[e]=n,i[e]=n,s[e]=n,a[e]=n,"\\"===n&&e+1<t&&("A"===(r=this.source.charAt(e+1))?(o[e+1]="",i[e+1]="",s[e+1]="A",a[e+1]="A"):"G"===r?(o[e+1]="",i[e+1]="G",s[e+1]="",a[e+1]="G"):(o[e+1]=r,i[e+1]=r,s[e+1]=r,a[e+1]=r),e++);return{A0_G0:o.join(""),A0_G1:i.join(""),A1_G0:s.join(""),A1_G1:a.join("")}},e.prototype.resolveAnchors=function(e,t){return this.hasAnchor&&this._anchorCache?e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0:this.source},e}();t.RegExpSource=h;var f=function(){function e(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}return e.prototype.dispose=function(){this._disposeCaches()},e.prototype._disposeCaches=function(){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)},e.prototype.push=function(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor},e.prototype.unshift=function(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor},e.prototype.length=function(){return this._items.length},e.prototype.setSource=function(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))},e.prototype.compile=function(e,t,n){if(this._hasAnchors)return t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0);if(!this._cached){var r=this._items.map((function(e){return e.source}));this._cached=new c(e,r,this._items.map((function(e){return e.ruleId})))}return this._cached},e.prototype._resolveAnchors=function(e,t,n){var r=this._items.map((function(e){return e.resolveAnchors(t,n)}));return new c(e,r,this._items.map((function(e){return e.ruleId})))},e}();t.RegExpSourceList=f;var p=function(e){function t(t,n,r,o,i){var s=e.call(this,t,n,r,null)||this;return s._match=new h(o,s.id),s.captures=i,s._cachedCompiledPatterns=null,s}return o(t,e),t.prototype.dispose=function(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)},Object.defineProperty(t.prototype,"debugMatchRegExp",{get:function(){return""+this._match.source},enumerable:!0,configurable:!0}),t.prototype.collectPatternsRecursive=function(e,t,n){t.push(this._match)},t.prototype.compile=function(e,t,n,r){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new f,this.collectPatternsRecursive(e,this._cachedCompiledPatterns,!0)),this._cachedCompiledPatterns.compile(e,n,r)},t}(u);t.MatchRule=p;var d=function(e){function t(t,n,r,o,i){var s=e.call(this,t,n,r,o)||this;return s.patterns=i.patterns,s.hasMissingPatterns=i.hasMissingPatterns,s._cachedCompiledPatterns=null,s}return o(t,e),t.prototype.dispose=function(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)},t.prototype.collectPatternsRecursive=function(e,t,n){var r,o;for(r=0,o=this.patterns.length;r<o;r++)e.getRule(this.patterns[r]).collectPatternsRecursive(e,t,!1)},t.prototype.compile=function(e,t,n,r){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new f,this.collectPatternsRecursive(e,this._cachedCompiledPatterns,!0)),this._cachedCompiledPatterns.compile(e,n,r)},t}(u);t.IncludeOnlyRule=d;var g=function(e){function t(t,n,r,o,i,s,a,c,u,l){var f=e.call(this,t,n,r,o)||this;return f._begin=new h(i,f.id),f.beginCaptures=s,f._end=new h(a||"",-1),f.endHasBackReferences=f._end.hasBackReferences,f.endCaptures=c,f.applyEndPatternLast=u||!1,f.patterns=l.patterns,f.hasMissingPatterns=l.hasMissingPatterns,f._cachedCompiledPatterns=null,f}return o(t,e),t.prototype.dispose=function(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)},Object.defineProperty(t.prototype,"debugBeginRegExp",{get:function(){return""+this._begin.source},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"debugEndRegExp",{get:function(){return""+this._end.source},enumerable:!0,configurable:!0}),t.prototype.getEndWithResolvedBackReferences=function(e,t){return this._end.resolveBackReferences(e,t)},t.prototype.collectPatternsRecursive=function(e,t,n){if(n){var r,o=void 0;for(o=0,r=this.patterns.length;o<r;o++)e.getRule(this.patterns[o]).collectPatternsRecursive(e,t,!1)}else t.push(this._begin)},t.prototype.compile=function(e,t,n,r){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new f,this.collectPatternsRecursive(e,this._cachedCompiledPatterns,!0),this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)),this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns.compile(e,n,r)},t}(u);t.BeginEndRule=g;var m=function(e){function t(t,n,r,o,i,s,a,c,u){var l=e.call(this,t,n,r,o)||this;return l._begin=new h(i,l.id),l.beginCaptures=s,l.whileCaptures=c,l._while=new h(a,-2),l.whileHasBackReferences=l._while.hasBackReferences,l.patterns=u.patterns,l.hasMissingPatterns=u.hasMissingPatterns,l._cachedCompiledPatterns=null,l._cachedCompiledWhilePatterns=null,l}return o(t,e),t.prototype.dispose=function(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)},Object.defineProperty(t.prototype,"debugBeginRegExp",{get:function(){return""+this._begin.source},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"debugWhileRegExp",{get:function(){return""+this._while.source},enumerable:!0,configurable:!0}),t.prototype.getWhileWithResolvedBackReferences=function(e,t){return this._while.resolveBackReferences(e,t)},t.prototype.collectPatternsRecursive=function(e,t,n){if(n){var r,o=void 0;for(o=0,r=this.patterns.length;o<r;o++)e.getRule(this.patterns[o]).collectPatternsRecursive(e,t,!1)}else t.push(this._begin)},t.prototype.compile=function(e,t,n,r){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new f,this.collectPatternsRecursive(e,this._cachedCompiledPatterns,!0)),this._cachedCompiledPatterns.compile(e,n,r)},t.prototype.compileWhile=function(e,t,n,r){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new f,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||""),this._cachedCompiledWhilePatterns.compile(e,n,r)},t}(u);t.BeginWhileRule=m;var _=function(){function e(){}return e.createCaptureRule=function(e,t,n,r,o){return e.registerRule((function(e){return new l(t,e,n,r,o)}))},e.getCompiledRuleId=function(t,n,r){return t.id||n.registerRule((function(o){if(t.id=o,t.match)return new p(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(void 0===t.begin){t.repository&&(r=i.mergeObjects({},r,t.repository));var s=t.patterns;return void 0===s&&t.include&&(s=[{include:t.include}]),new d(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(s,n,r))}return t.while?new m(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new g(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))})),t.id},e._compileCaptures=function(t,n,r){var o=[];if(t){var i=0;for(var s in t)"$vscodeTextmateLocation"!==s&&(c=parseInt(s,10))>i&&(i=c);for(var a=0;a<=i;a++)o[a]=null;for(var s in t)if("$vscodeTextmateLocation"!==s){var c=parseInt(s,10),u=0;t[s].patterns&&(u=e.getCompiledRuleId(t[s],n,r)),o[c]=e.createCaptureRule(n,t[s].$vscodeTextmateLocation,t[s].name,t[s].contentName,u)}}return o},e._compilePatterns=function(t,n,r){var o=[];if(t)for(var i=0,s=t.length;i<s;i++){var a=t[i],c=-1;if(a.include)if("#"===a.include.charAt(0)){var u=r[a.include.substr(1)];u&&(c=e.getCompiledRuleId(u,n,r))}else if("$base"===a.include||"$self"===a.include)c=e.getCompiledRuleId(r[a.include],n,r);else{var l=null,h=null,f=a.include.indexOf("#");f>=0?(l=a.include.substring(0,f),h=a.include.substring(f+1)):l=a.include;var p=n.getExternalGrammar(l,r);if(p)if(h){var _=p.repository[h];_&&(c=e.getCompiledRuleId(_,n,p.repository))}else c=e.getCompiledRuleId(p.repository.$self,n,p.repository)}else c=e.getCompiledRuleId(a,n,r);if(-1!==c){var y=n.getRule(c),v=!1;if((y instanceof d||y instanceof g||y instanceof m)&&y.hasMissingPatterns&&0===y.patterns.length&&(v=!0),v)continue;o.push(c)}}return{patterns:o,hasMissingPatterns:(t?t.length:0)!==o.length}},e}();t.RuleFactory=_},function(e,t,n){function r(e){return!!e&&!!e.match(/[\w\.:]+/)}Object.defineProperty(t,"__esModule",{value:!0}),t.createMatchers=function(e,t){for(var n,o,i,s=[],a=(i=(o=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g).exec(n=e),{next:function(){if(!i)return null;var e=i[0];return i=o.exec(n),e}}),c=a.next();null!==c;){var u=0;if(2===c.length&&":"===c.charAt(1)){switch(c.charAt(0)){case"R":u=1;break;case"L":u=-1;break;default:console.log("Unknown priority "+c+" in scope selector")}c=a.next()}var l=f();if(s.push({matcher:l,priority:u}),","!==c)break;c=a.next()}return s;function h(){if("-"===c){c=a.next();var e=h();return function(t){return!!e&&!e(t)}}if("("===c){c=a.next();var n=function(){for(var e=[],t=f();t&&(e.push(t),"|"===c||","===c);){do{c=a.next()}while("|"===c||","===c);t=f()}return function(t){return e.some((function(e){return e(t)}))}}();return")"===c&&(c=a.next()),n}if(r(c)){var o=[];do{o.push(c),c=a.next()}while(r(c));return function(e){return t(o,e)}}return null}function f(){for(var e=[],t=h();t;)e.push(t),t=h();return function(t){return e.every((function(e){return e(t)}))}}}},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c,u=[],l=!1,h=-1;function f(){l&&c&&(l=!1,c.length?u=c.concat(u):h=-1,u.length&&p())}function p(){if(!l){var e=a(f);l=!0;for(var t=u.length;t;){for(c=u,u=[];++h<t;)c&&c[h].run();h=-1,t=u.length}c=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function g(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new d(e,t)),1!==u.length||l||a(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=n(2),i=n(10);t.parseRawGrammar=function(e,t){return void 0===t&&(t=null),null!==t&&/\.json$/.test(t)?function(e,t){return o.DebugFlags.InDebugMode?i.parse(e,t,!0):JSON.parse(e)}(e,t):function(e,t){return o.DebugFlags.InDebugMode?r.parseWithLocation(e,t,"$vscodeTextmateLocation"):r.parse(e)}(e,t)}},function(e,t,n){function r(e,t,n){var r=e.length,o=0,i=1,s=0;function a(t){if(null===n)o+=t;else for(;t>0;)10===e.charCodeAt(o)?(o++,i++,s=0):(o++,s++),t--}function c(e){null===n?o=e:a(e-o)}function u(){for(;o<r;){var t=e.charCodeAt(o);if(32!==t&&9!==t&&13!==t&&10!==t)break;a(1)}}function l(t){return e.substr(o,t.length)===t&&(a(t.length),!0)}function h(t){var n=e.indexOf(t,o);c(-1!==n?n+t.length:r)}function f(t){var n=e.indexOf(t,o);if(-1!==n){var i=e.substring(o,n);return c(n+t.length),i}return i=e.substr(o),c(r),i}r>0&&65279===e.charCodeAt(0)&&(o=1);var p=0,d=null,g=[],m=[],_=null;function y(e,t){g.push(p),m.push(d),p=e,d=t}function v(){if(0===g.length)return b("illegal state stack");p=g.pop(),d=m.pop()}function b(t){throw new Error("Near offset "+o+": "+t+" ~~~"+e.substr(o,50)+"~~~")}var k,w,S,C=function(){if(null===_)return b("missing <key>");var e={};null!==n&&(e[n]={filename:t,line:i,char:s}),d[_]=e,_=null,y(1,e)},T=function(){if(null===_)return b("missing <key>");var e=[];d[_]=e,_=null,y(2,e)},A=function(){var e={};null!==n&&(e[n]={filename:t,line:i,char:s}),d.push(e),y(1,e)},R=function(){var e=[];d.push(e),y(2,e)};function P(){if(1!==p)return b("unexpected </dict>");v()}function x(){return 1===p||2!==p?b("unexpected </array>"):void v()}function L(e){if(1===p){if(null===_)return b("missing <key>");d[_]=e,_=null}else 2===p?d.push(e):d=e}function I(e){if(isNaN(e))return b("cannot parse float");if(1===p){if(null===_)return b("missing <key>");d[_]=e,_=null}else 2===p?d.push(e):d=e}function O(e){if(isNaN(e))return b("cannot parse integer");if(1===p){if(null===_)return b("missing <key>");d[_]=e,_=null}else 2===p?d.push(e):d=e}function M(e){if(1===p){if(null===_)return b("missing <key>");d[_]=e,_=null}else 2===p?d.push(e):d=e}function E(e){if(1===p){if(null===_)return b("missing <key>");d[_]=e,_=null}else 2===p?d.push(e):d=e}function N(e){if(1===p){if(null===_)return b("missing <key>");d[_]=e,_=null}else 2===p?d.push(e):d=e}function D(e){if(e.isClosed)return"";var t=f("</");return h(">"),t.replace(/&#([0-9]+);/g,(function(e,t){return String.fromCodePoint(parseInt(t,10))})).replace(/&#x([0-9a-f]+);/g,(function(e,t){return String.fromCodePoint(parseInt(t,16))})).replace(/&|<|>|"|'/g,(function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case""":return'"';case"'":return"'"}return e}))}for(;o<r&&(u(),!(o>=r));){var G=e.charCodeAt(o);if(a(1),60!==G)return b("expected <");if(o>=r)return b("unexpected end of input");var j=e.charCodeAt(o);if(63!==j)if(33!==j){if(47===j){if(a(1),u(),l("plist")){h(">");continue}if(l("dict")){h(">"),P();continue}if(l("array")){h(">"),x();continue}return b("unexpected closed tag")}var F=(w=void 0,S=void 0,S=!1,47===(w=f(">")).charCodeAt(w.length-1)&&(S=!0,w=w.substring(0,w.length-1)),{name:w.trim(),isClosed:S});switch(F.name){case"dict":1===p?C():2===p?A():(d={},null!==n&&(d[n]={filename:t,line:i,char:s}),y(1,d)),F.isClosed&&P();continue;case"array":1===p?T():2===p?R():y(2,d=[]),F.isClosed&&x();continue;case"key":k=D(F),1!==p?b("unexpected <key>"):null!==_?b("too many <key>"):_=k;continue;case"string":L(D(F));continue;case"real":I(parseFloat(D(F)));continue;case"integer":O(parseInt(D(F),10));continue;case"date":M(new D