@kestra-io/ui-libs 0.0.248 → 0.0.249

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-WbOzUAko.cjs"),s=require("./VueFlowUtils-BhZNyVgG.cjs");require("vue");exports.DependenciesNode=e.DependenciesNode;exports.MDCRenderer=e._sfc_main$1;exports.PluginIndex=e._sfc_main;exports.RotatingDotsIcon=e.RotatingDots;exports.STATES=e.STATES;exports.SchemaToHtml=e.SchemaToHtml;exports.State=e.State;exports.TaskIcon=e.TaskIcon;exports.Topology=e.Topology;exports.YamlUtils=e.YamlUtils;exports.cssVariable=e.cssVariable;exports.getMDCParser=e.getMDCParser;exports.isEntryAPluginElementPredicate=e.isEntryAPluginElementPredicate;exports.slugify=e.slugify;exports.subGroupName=e.subGroupName;exports.CLUSTER_PREFIX=s.CLUSTER_PREFIX;exports.EVENTS=s.EVENTS;exports.NODE_SIZES=s.NODE_SIZES;exports.SECTIONS=s.SECTIONS;exports.Utils=s.Utils;exports.VueFlowUtils=s.VueFlowUtils;exports.editorViewTypes=s.editorViewTypes;exports.executeFlowBehaviours=s.executeFlowBehaviours;exports.logDisplayTypes=s.logDisplayTypes;exports.stateDisplayValues=s.stateDisplayValues;exports.stateGlobalChartTypes=s.stateGlobalChartTypes;exports.storageKeys=s.storageKeys;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-Btqd6xqX.cjs"),s=require("./VueFlowUtils-BhZNyVgG.cjs");require("vue");exports.DependenciesNode=e.DependenciesNode;exports.MDCRenderer=e._sfc_main$1;exports.PluginIndex=e._sfc_main;exports.RotatingDotsIcon=e.RotatingDots;exports.STATES=e.STATES;exports.SchemaToHtml=e.SchemaToHtml;exports.State=e.State;exports.TaskIcon=e.TaskIcon;exports.Topology=e.Topology;exports.YamlUtils=e.YamlUtils;exports.cssVariable=e.cssVariable;exports.getMDCParser=e.getMDCParser;exports.isEntryAPluginElementPredicate=e.isEntryAPluginElementPredicate;exports.slugify=e.slugify;exports.subGroupName=e.subGroupName;exports.CLUSTER_PREFIX=s.CLUSTER_PREFIX;exports.EVENTS=s.EVENTS;exports.NODE_SIZES=s.NODE_SIZES;exports.SECTIONS=s.SECTIONS;exports.Utils=s.Utils;exports.VueFlowUtils=s.VueFlowUtils;exports.editorViewTypes=s.editorViewTypes;exports.executeFlowBehaviours=s.executeFlowBehaviours;exports.logDisplayTypes=s.logDisplayTypes;exports.stateDisplayValues=s.stateDisplayValues;exports.stateGlobalChartTypes=s.stateGlobalChartTypes;exports.storageKeys=s.storageKeys;
2
2
  //# sourceMappingURL=kestra-index.cjs.js.map
@@ -1,4 +1,4 @@
1
- import { D as t, k as o, _ as i, R as l, a as r, j as S, S as T, e as n, T as p, Y as E, c as g, g as u, i as y, b as c, d as m } from "./index-l75aC6C7.js";
1
+ import { D as t, k as o, _ as i, R as l, a as r, j as S, S as T, e as n, T as p, Y as E, c as g, g as u, i as y, b as c, d as m } from "./index-DD-eCpul.js";
2
2
  import { C as d, E as C, N as I, S as N, U as V, V as b, e as P, i as R, b as U, j as f, s as x, f as h } from "./VueFlowUtils-BzTE7TIL.js";
3
3
  import "vue";
4
4
  export {
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("./index-WbOzUAko.cjs"),B=require("./python-BtzKlB8R.cjs");let w=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function $t(n){return Ee(n)}function Ee(n){return Array.isArray(n)?Mt(n):n instanceof RegExp?n:typeof n=="object"?Bt(n):n}function Mt(n){let e=[];for(let t=0,s=n.length;t<s;t++)e[t]=Ee(n[t]);return e}function Bt(n){let e={};for(let t in n)e[t]=Ee(n[t]);return e}function at(n,...e){return e.forEach(t=>{for(let s in t)n[s]=t[s]}),n}function ct(n){const e=~n.lastIndexOf("/")||~n.lastIndexOf("\\");return e===0?n:~e===n.length-1?ct(n.substring(0,n.length-1)):n.substr(~e+1)}var me=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,V=class{static hasCaptures(n){return n===null?!1:(me.lastIndex=0,me.test(n))}static replaceCaptures(n,e,t){return n.replace(me,(s,r,i,a)=>{let c=t[parseInt(r||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 s})}};function lt(n,e){return n<e?-1:n>e?1:0}function ut(n,e){if(n===null&&e===null)return 0;if(!n)return-1;if(!e)return 1;let t=n.length,s=e.length;if(t===s){for(let r=0;r<t;r++){let i=lt(n[r],e[r]);if(i!==0)return i}return 0}return t-s}function De(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 ht(n){return n.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var ft=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}},ee=class{constructor(n,e,t){this._colorMap=n,this._defaults=e,this._root=t}static createFromRawTheme(n,e){return this.createFromParsedTheme(Dt(n),e)}static createFromParsedTheme(n,e){return qt(n,e)}_cachedMatchRoot=new ft(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,s=this._cachedMatchRoot.get(e).find(r=>jt(n.parent,r.parentScopes));return s?new dt(s.fontStyle,s.foreground,s.background):null}},ge=class Q{constructor(e,t){this.parent=e,this.scopeName=t}static push(e,t){for(const s of t)e=new Q(e,s);return e}static from(...e){let t=null;for(let s=0;s<e.length;s++)t=new Q(t,e[s]);return t}push(e){return new Q(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 s=this;for(;s&&s!==e;)t.push(s.scopeName),s=s.parent;return s===e?t.reverse():void 0}};function jt(n,e){if(e.length===0)return!0;for(let t=0;t<e.length;t++){let s=e[t],r=!1;if(s===">"){if(t===e.length-1)return!1;s=e[++t],r=!0}for(;n&&!Ft(n.scopeName,s);){if(r)return!1;n=n.parent}if(!n)return!1;n=n.parent}return!0}function Ft(n,e){return e===n||n.startsWith(e)&&n[e.length]==="."}var dt=class{constructor(n,e,t){this.fontStyle=n,this.foregroundId=e,this.backgroundId=t}};function Dt(n){if(!n)return[];if(!n.settings||!Array.isArray(n.settings))return[];let e=n.settings,t=[],s=0;for(let r=0,i=e.length;r<i;r++){let a=e[r];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 d=0,p=h.length;d<p;d++)switch(h[d]){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"&&De(a.settings.foreground)&&(l=a.settings.foreground);let u=null;typeof a.settings.background=="string"&&De(a.settings.background)&&(u=a.settings.background);for(let h=0,d=c.length;h<d;h++){let f=c[h].trim().split(" "),b=f[f.length-1],_=null;f.length>1&&(_=f.slice(0,f.length-1),_.reverse()),t[s++]=new Wt(b,_,r,o,l,u)}}return t}var Wt=class{constructor(n,e,t,s,r,i){this.scope=n,this.parentScopes=e,this.index=t,this.fontStyle=s,this.foreground=r,this.background=i}},N=(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))(N||{});function qt(n,e){n.sort((o,l)=>{let u=lt(o.scope,l.scope);return u!==0||(u=ut(o.parentScopes,l.parentScopes),u!==0)?u:o.index-l.index});let t=0,s="#000000",r="#ffffff";for(;n.length>=1&&n[0].scope==="";){let o=n.shift();o.fontStyle!==-1&&(t=o.fontStyle),o.foreground!==null&&(s=o.foreground),o.background!==null&&(r=o.background)}let i=new zt(e),a=new dt(t,i.getId(s),i.getId(r)),c=new Ht(new Ce(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 ee(i,a,c)}var zt=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)}},Ut=Object.freeze([]),Ce=class pt{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,s,r,i){this.scopeDepth=e,this.parentScopes=t||Ut,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new pt(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let s=0,r=e.length;s<r;s++)t[s]=e[s].clone();return t}acceptOverwrite(e,t,s,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),s!==0&&(this.foreground=s),r!==0&&(this.background=r)}},Ht=class we{constructor(e,t=[],s={}){this._mainRule=e,this._children=s,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let s=0,r=0;for(;e.parentScopes[s]===">"&&s++,t.parentScopes[r]===">"&&r++,!(s>=e.parentScopes.length||r>=t.parentScopes.length);){const i=t.parentScopes[r].length-e.parentScopes[s].length;if(i!==0)return i;s++,r++}return t.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let s=e.indexOf("."),r,i;if(s===-1?(r=e,i=""):(r=e.substring(0,s),i=e.substring(s+1)),this._children.hasOwnProperty(r))return this._children[r].match(i)}const t=this._rulesWithParentScopes.concat(this._mainRule);return t.sort(we._cmpBySpecificity),t}insert(e,t,s,r,i,a){if(t===""){this._doInsertHere(e,s,r,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 we(this._mainRule.clone(),Ce.cloneArr(this._rulesWithParentScopes)),this._children[o]=u),u.insert(e+1,l,s,r,i,a)}_doInsertHere(e,t,s,r,i){if(t===null){this._mainRule.acceptOverwrite(e,s,r,i);return}for(let a=0,c=this._rulesWithParentScopes.length;a<c;a++){let o=this._rulesWithParentScopes[a];if(ut(o.parentScopes,t)===0){o.acceptOverwrite(e,s,r,i);return}}s===-1&&(s=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Ce(e,t,s,r,i))}},M=class v{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const t=v.getLanguageId(e),s=v.getTokenType(e),r=v.getFontStyle(e),i=v.getForeground(e),a=v.getBackground(e);console.log({languageId:t,tokenType:s,fontStyle:r,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,s,r,i,a,c){let o=v.getLanguageId(e),l=v.getTokenType(e),u=v.containsBalancedBrackets(e)?1:0,h=v.getFontStyle(e),d=v.getForeground(e),p=v.getBackground(e);return t!==0&&(o=t),s!==8&&(l=s),r!==null&&(u=r?1:0),i!==-1&&(h=i),a!==0&&(d=a),c!==0&&(p=c),(o<<0|l<<8|u<<10|h<<11|d<<15|p<<24)>>>0}};function te(n,e){const t=[],s=Kt(n);let r=s.next();for(;r!==null;){let o=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":o=1;break;case"L":o=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let l=a();if(t.push({matcher:l,priority:o}),r!==",")break;r=s.next()}return t;function i(){if(r==="-"){r=s.next();const o=i();return l=>!!o&&!o(l)}if(r==="("){r=s.next();const o=c();return r===")"&&(r=s.next()),o}if(We(r)){const o=[];do o.push(r),r=s.next();while(We(r));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),r==="|"||r===",");){do r=s.next();while(r==="|"||r===",");l=a()}return u=>o.some(h=>h(u))}}function We(n){return!!n&&!!n.match(/[\w\.:]+/)}function Kt(n){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,t=e.exec(n);return{next:()=>{if(!t)return null;const s=t[0];return t=e.exec(n),s}}}function mt(n){typeof n.dispose=="function"&&n.dispose()}var q=class{constructor(n){this.scopeName=n}toKey(){return this.scopeName}},Vt=class{constructor(n,e){this.scopeName=n,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},Jt=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))}},Yt=class{constructor(n,e){this.repo=n,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new q(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const n=this.Q;this.Q=[];const e=new Jt;for(const t of n)Qt(t,this.initialScopeName,this.repo,e);for(const t of e.references)if(t instanceof q){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 Qt(n,e,t,s){const r=t.lookup(n.scopeName);if(!r){if(n.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const i=t.lookup(e);n instanceof q?X({baseGrammar:i,selfGrammar:r},s):Re(n.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},s);const a=t.injections(n.scopeName);if(a)for(const c of a)s.add(new q(c))}function Re(n,e,t){if(e.repository&&e.repository[n]){const s=e.repository[n];ne([s],e,t)}}function X(n,e){n.selfGrammar.patterns&&Array.isArray(n.selfGrammar.patterns)&&ne(n.selfGrammar.patterns,{...n,repository:n.selfGrammar.repository},e),n.selfGrammar.injections&&ne(Object.values(n.selfGrammar.injections),{...n,repository:n.selfGrammar.repository},e)}function ne(n,e,t){for(const s of n){if(t.visitedRule.has(s))continue;t.visitedRule.add(s);const r=s.repository?at({},e.repository,s.repository):e.repository;Array.isArray(s.patterns)&&ne(s.patterns,{...e,repository:r},t);const i=s.include;if(!i)continue;const a=gt(i);switch(a.kind){case 0:X({...e,selfGrammar:e.baseGrammar},t);break;case 1:X(e,t);break;case 2:Re(a.ruleName,{...e,repository:r},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:r};a.kind===4?Re(a.ruleName,o,t):X(o,t)}else a.kind===4?t.add(new Vt(a.scopeName,a.ruleName)):t.add(new q(a.scopeName));break}}}var Xt=class{kind=0},Zt=class{kind=1},en=class{constructor(n){this.ruleName=n}kind=2},tn=class{constructor(n){this.scopeName=n}kind=3},nn=class{constructor(n,e){this.scopeName=n,this.ruleName=e}kind=4};function gt(n){if(n==="$base")return new Xt;if(n==="$self")return new Zt;const e=n.indexOf("#");if(e===-1)return new tn(n);if(e===0)return new en(n.substring(1));{const t=n.substring(0,e),s=n.substring(e+1);return new nn(t,s)}}var sn=/\\(\d+)/,qe=/\\(\d+)/g,rn=-1,_t=-2;var K=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(n,e,t,s){this.$location=n,this.id=e,this._name=t||null,this._nameIsCapturing=V.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=V.hasCaptures(this._contentName)}get debugName(){const n=this.$location?`${ct(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:V.replaceCaptures(this._name,n,e)}getContentName(n,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:V.replaceCaptures(this._contentName,n,e)}},on=class extends K{retokenizeCapturedWithRuleId;constructor(n,e,t,s,r){super(n,e,t,s),this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(n,e){throw new Error("Not supported!")}compile(n,e){throw new Error("Not supported!")}compileAG(n,e,t,s){throw new Error("Not supported!")}},an=class extends K{_match;captures;_cachedCompiledPatterns;constructor(n,e,t,s,r){super(n,e,t,null),this._match=new z(s,this.id),this.captures=r,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,s){return this._getCachedCompiledPatterns(n).compileAG(n,t,s)}_getCachedCompiledPatterns(n){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new U,this.collectPatterns(n,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ze=class extends K{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(n,e,t,s,r){super(n,e,t,s),this.patterns=r.patterns,this.hasMissingPatterns=r.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,s){return this._getCachedCompiledPatterns(n).compileAG(n,t,s)}_getCachedCompiledPatterns(n){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new U,this.collectPatterns(n,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ne=class extends K{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(n,e,t,s,r,i,a,c,o,l){super(n,e,t,s),this._begin=new z(r,this.id),this.beginCaptures=i,this._end=new z(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,s){return this._getCachedCompiledPatterns(n,e).compileAG(n,t,s)}_getCachedCompiledPatterns(n,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new U;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}},se=class extends K{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(n,e,t,s,r,i,a,c,o){super(n,e,t,s),this._begin=new z(r,this.id),this.beginCaptures=i,this.whileCaptures=c,this._while=new z(a,_t),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,s){return this._getCachedCompiledPatterns(n).compileAG(n,t,s)}_getCachedCompiledPatterns(n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new U;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,s){return this._getCachedCompiledWhilePatterns(n,e).compileAG(n,t,s)}_getCachedCompiledWhilePatterns(n,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new U,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||"￿"),this._cachedCompiledWhilePatterns}},yt=class R{static createCaptureRule(e,t,s,r,i){return e.registerRule(a=>new on(t,a,s,r,i))}static getCompiledRuleId(e,t,s){return e.id||t.registerRule(r=>{if(e.id=r,e.match)return new an(e.$vscodeTextmateLocation,e.id,e.name,e.match,R._compileCaptures(e.captures,t,s));if(typeof e.begin>"u"){e.repository&&(s=at({},s,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,R._compilePatterns(i,t,s))}return e.while?new se(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,R._compileCaptures(e.beginCaptures||e.captures,t,s),e.while,R._compileCaptures(e.whileCaptures||e.captures,t,s),R._compilePatterns(e.patterns,t,s)):new Ne(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,R._compileCaptures(e.beginCaptures||e.captures,t,s),e.end,R._compileCaptures(e.endCaptures||e.captures,t,s),e.applyEndPatternLast,R._compilePatterns(e.patterns,t,s))}),e.id}static _compileCaptures(e,t,s){let r=[];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++)r[a]=null;for(const a in e){if(a==="$vscodeTextmateLocation")continue;const c=parseInt(a,10);let o=0;e[a].patterns&&(o=R.getCompiledRuleId(e[a],t,s)),r[c]=R.createCaptureRule(t,e[a].$vscodeTextmateLocation,e[a].name,e[a].contentName,o)}}return r}static _compilePatterns(e,t,s){let r=[];if(e)for(let i=0,a=e.length;i<a;i++){const c=e[i];let o=-1;if(c.include){const l=gt(c.include);switch(l.kind){case 0:case 1:o=R.getCompiledRuleId(s[c.include],t,s);break;case 2:let u=s[l.ruleName];u&&(o=R.getCompiledRuleId(u,t,s));break;case 3:case 4:const h=l.scopeName,d=l.kind===4?l.ruleName:null,p=t.getExternalGrammar(h,s);if(p)if(d){let f=p.repository[d];f&&(o=R.getCompiledRuleId(f,t,p.repository))}else o=R.getCompiledRuleId(p.repository.$self,t,p.repository);break}}else o=R.getCompiledRuleId(c,t,s);if(o!==-1){const l=t.getRule(o);let u=!1;if((l instanceof ze||l instanceof Ne||l instanceof se)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;r.push(o)}}return{patterns:r,hasMissingPatterns:(e?e.length:0)!==r.length}}},z=class bt{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e=="string"){const s=e.length;let r=0,i=[],a=!1;for(let c=0;c<s;c++)if(e.charAt(c)==="\\"&&c+1<s){const l=e.charAt(c+1);l==="z"?(i.push(e.substring(r,c)),i.push("$(?!\\n)(?<!\\n)"),r=c+2):(l==="A"||l==="G")&&(a=!0),c++}this.hasAnchor=a,r===0?this.source=e:(i.push(e.substring(r,s)),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=sn.test(this.source):this.hasBackReferences=!1}clone(){return new bt(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 s=t.map(r=>e.substring(r.start,r.end));return qe.lastIndex=0,this.source.replace(qe,(r,i)=>ht(s[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=[],s=[],r=[],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,s[i]=c,r[i]=c,c==="\\"&&i+1<a&&(o=this.source.charAt(i+1),o==="A"?(e[i+1]="￿",t[i+1]="￿",s[i+1]="A",r[i+1]="A"):o==="G"?(e[i+1]="￿",t[i+1]="G",s[i+1]="￿",r[i+1]="G"):(e[i+1]=o,t[i+1]=o,s[i+1]=o,r[i+1]=o),i++);return{A0_G0:e.join(""),A0_G1:t.join(""),A1_G0:s.join(""),A1_G1:r.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}},U=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 Ue(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 s=this._items.map(r=>r.resolveAnchors(e,t));return new Ue(n,s,this._items.map(r=>r.ruleId))}},Ue=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(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("./index-Btqd6xqX.cjs"),B=require("./python-BtzKlB8R.cjs");let w=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function $t(n){return Ee(n)}function Ee(n){return Array.isArray(n)?Mt(n):n instanceof RegExp?n:typeof n=="object"?Bt(n):n}function Mt(n){let e=[];for(let t=0,s=n.length;t<s;t++)e[t]=Ee(n[t]);return e}function Bt(n){let e={};for(let t in n)e[t]=Ee(n[t]);return e}function at(n,...e){return e.forEach(t=>{for(let s in t)n[s]=t[s]}),n}function ct(n){const e=~n.lastIndexOf("/")||~n.lastIndexOf("\\");return e===0?n:~e===n.length-1?ct(n.substring(0,n.length-1)):n.substr(~e+1)}var me=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,V=class{static hasCaptures(n){return n===null?!1:(me.lastIndex=0,me.test(n))}static replaceCaptures(n,e,t){return n.replace(me,(s,r,i,a)=>{let c=t[parseInt(r||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 s})}};function lt(n,e){return n<e?-1:n>e?1:0}function ut(n,e){if(n===null&&e===null)return 0;if(!n)return-1;if(!e)return 1;let t=n.length,s=e.length;if(t===s){for(let r=0;r<t;r++){let i=lt(n[r],e[r]);if(i!==0)return i}return 0}return t-s}function De(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 ht(n){return n.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var ft=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}},ee=class{constructor(n,e,t){this._colorMap=n,this._defaults=e,this._root=t}static createFromRawTheme(n,e){return this.createFromParsedTheme(Dt(n),e)}static createFromParsedTheme(n,e){return qt(n,e)}_cachedMatchRoot=new ft(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,s=this._cachedMatchRoot.get(e).find(r=>jt(n.parent,r.parentScopes));return s?new dt(s.fontStyle,s.foreground,s.background):null}},ge=class Q{constructor(e,t){this.parent=e,this.scopeName=t}static push(e,t){for(const s of t)e=new Q(e,s);return e}static from(...e){let t=null;for(let s=0;s<e.length;s++)t=new Q(t,e[s]);return t}push(e){return new Q(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 s=this;for(;s&&s!==e;)t.push(s.scopeName),s=s.parent;return s===e?t.reverse():void 0}};function jt(n,e){if(e.length===0)return!0;for(let t=0;t<e.length;t++){let s=e[t],r=!1;if(s===">"){if(t===e.length-1)return!1;s=e[++t],r=!0}for(;n&&!Ft(n.scopeName,s);){if(r)return!1;n=n.parent}if(!n)return!1;n=n.parent}return!0}function Ft(n,e){return e===n||n.startsWith(e)&&n[e.length]==="."}var dt=class{constructor(n,e,t){this.fontStyle=n,this.foregroundId=e,this.backgroundId=t}};function Dt(n){if(!n)return[];if(!n.settings||!Array.isArray(n.settings))return[];let e=n.settings,t=[],s=0;for(let r=0,i=e.length;r<i;r++){let a=e[r];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 d=0,p=h.length;d<p;d++)switch(h[d]){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"&&De(a.settings.foreground)&&(l=a.settings.foreground);let u=null;typeof a.settings.background=="string"&&De(a.settings.background)&&(u=a.settings.background);for(let h=0,d=c.length;h<d;h++){let f=c[h].trim().split(" "),b=f[f.length-1],_=null;f.length>1&&(_=f.slice(0,f.length-1),_.reverse()),t[s++]=new Wt(b,_,r,o,l,u)}}return t}var Wt=class{constructor(n,e,t,s,r,i){this.scope=n,this.parentScopes=e,this.index=t,this.fontStyle=s,this.foreground=r,this.background=i}},N=(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))(N||{});function qt(n,e){n.sort((o,l)=>{let u=lt(o.scope,l.scope);return u!==0||(u=ut(o.parentScopes,l.parentScopes),u!==0)?u:o.index-l.index});let t=0,s="#000000",r="#ffffff";for(;n.length>=1&&n[0].scope==="";){let o=n.shift();o.fontStyle!==-1&&(t=o.fontStyle),o.foreground!==null&&(s=o.foreground),o.background!==null&&(r=o.background)}let i=new zt(e),a=new dt(t,i.getId(s),i.getId(r)),c=new Ht(new Ce(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 ee(i,a,c)}var zt=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)}},Ut=Object.freeze([]),Ce=class pt{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,s,r,i){this.scopeDepth=e,this.parentScopes=t||Ut,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new pt(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let s=0,r=e.length;s<r;s++)t[s]=e[s].clone();return t}acceptOverwrite(e,t,s,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),s!==0&&(this.foreground=s),r!==0&&(this.background=r)}},Ht=class we{constructor(e,t=[],s={}){this._mainRule=e,this._children=s,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let s=0,r=0;for(;e.parentScopes[s]===">"&&s++,t.parentScopes[r]===">"&&r++,!(s>=e.parentScopes.length||r>=t.parentScopes.length);){const i=t.parentScopes[r].length-e.parentScopes[s].length;if(i!==0)return i;s++,r++}return t.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let s=e.indexOf("."),r,i;if(s===-1?(r=e,i=""):(r=e.substring(0,s),i=e.substring(s+1)),this._children.hasOwnProperty(r))return this._children[r].match(i)}const t=this._rulesWithParentScopes.concat(this._mainRule);return t.sort(we._cmpBySpecificity),t}insert(e,t,s,r,i,a){if(t===""){this._doInsertHere(e,s,r,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 we(this._mainRule.clone(),Ce.cloneArr(this._rulesWithParentScopes)),this._children[o]=u),u.insert(e+1,l,s,r,i,a)}_doInsertHere(e,t,s,r,i){if(t===null){this._mainRule.acceptOverwrite(e,s,r,i);return}for(let a=0,c=this._rulesWithParentScopes.length;a<c;a++){let o=this._rulesWithParentScopes[a];if(ut(o.parentScopes,t)===0){o.acceptOverwrite(e,s,r,i);return}}s===-1&&(s=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Ce(e,t,s,r,i))}},M=class v{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const t=v.getLanguageId(e),s=v.getTokenType(e),r=v.getFontStyle(e),i=v.getForeground(e),a=v.getBackground(e);console.log({languageId:t,tokenType:s,fontStyle:r,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,s,r,i,a,c){let o=v.getLanguageId(e),l=v.getTokenType(e),u=v.containsBalancedBrackets(e)?1:0,h=v.getFontStyle(e),d=v.getForeground(e),p=v.getBackground(e);return t!==0&&(o=t),s!==8&&(l=s),r!==null&&(u=r?1:0),i!==-1&&(h=i),a!==0&&(d=a),c!==0&&(p=c),(o<<0|l<<8|u<<10|h<<11|d<<15|p<<24)>>>0}};function te(n,e){const t=[],s=Kt(n);let r=s.next();for(;r!==null;){let o=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":o=1;break;case"L":o=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let l=a();if(t.push({matcher:l,priority:o}),r!==",")break;r=s.next()}return t;function i(){if(r==="-"){r=s.next();const o=i();return l=>!!o&&!o(l)}if(r==="("){r=s.next();const o=c();return r===")"&&(r=s.next()),o}if(We(r)){const o=[];do o.push(r),r=s.next();while(We(r));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),r==="|"||r===",");){do r=s.next();while(r==="|"||r===",");l=a()}return u=>o.some(h=>h(u))}}function We(n){return!!n&&!!n.match(/[\w\.:]+/)}function Kt(n){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,t=e.exec(n);return{next:()=>{if(!t)return null;const s=t[0];return t=e.exec(n),s}}}function mt(n){typeof n.dispose=="function"&&n.dispose()}var q=class{constructor(n){this.scopeName=n}toKey(){return this.scopeName}},Vt=class{constructor(n,e){this.scopeName=n,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},Jt=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))}},Yt=class{constructor(n,e){this.repo=n,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new q(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const n=this.Q;this.Q=[];const e=new Jt;for(const t of n)Qt(t,this.initialScopeName,this.repo,e);for(const t of e.references)if(t instanceof q){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 Qt(n,e,t,s){const r=t.lookup(n.scopeName);if(!r){if(n.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const i=t.lookup(e);n instanceof q?X({baseGrammar:i,selfGrammar:r},s):Re(n.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},s);const a=t.injections(n.scopeName);if(a)for(const c of a)s.add(new q(c))}function Re(n,e,t){if(e.repository&&e.repository[n]){const s=e.repository[n];ne([s],e,t)}}function X(n,e){n.selfGrammar.patterns&&Array.isArray(n.selfGrammar.patterns)&&ne(n.selfGrammar.patterns,{...n,repository:n.selfGrammar.repository},e),n.selfGrammar.injections&&ne(Object.values(n.selfGrammar.injections),{...n,repository:n.selfGrammar.repository},e)}function ne(n,e,t){for(const s of n){if(t.visitedRule.has(s))continue;t.visitedRule.add(s);const r=s.repository?at({},e.repository,s.repository):e.repository;Array.isArray(s.patterns)&&ne(s.patterns,{...e,repository:r},t);const i=s.include;if(!i)continue;const a=gt(i);switch(a.kind){case 0:X({...e,selfGrammar:e.baseGrammar},t);break;case 1:X(e,t);break;case 2:Re(a.ruleName,{...e,repository:r},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:r};a.kind===4?Re(a.ruleName,o,t):X(o,t)}else a.kind===4?t.add(new Vt(a.scopeName,a.ruleName)):t.add(new q(a.scopeName));break}}}var Xt=class{kind=0},Zt=class{kind=1},en=class{constructor(n){this.ruleName=n}kind=2},tn=class{constructor(n){this.scopeName=n}kind=3},nn=class{constructor(n,e){this.scopeName=n,this.ruleName=e}kind=4};function gt(n){if(n==="$base")return new Xt;if(n==="$self")return new Zt;const e=n.indexOf("#");if(e===-1)return new tn(n);if(e===0)return new en(n.substring(1));{const t=n.substring(0,e),s=n.substring(e+1);return new nn(t,s)}}var sn=/\\(\d+)/,qe=/\\(\d+)/g,rn=-1,_t=-2;var K=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(n,e,t,s){this.$location=n,this.id=e,this._name=t||null,this._nameIsCapturing=V.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=V.hasCaptures(this._contentName)}get debugName(){const n=this.$location?`${ct(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:V.replaceCaptures(this._name,n,e)}getContentName(n,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:V.replaceCaptures(this._contentName,n,e)}},on=class extends K{retokenizeCapturedWithRuleId;constructor(n,e,t,s,r){super(n,e,t,s),this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(n,e){throw new Error("Not supported!")}compile(n,e){throw new Error("Not supported!")}compileAG(n,e,t,s){throw new Error("Not supported!")}},an=class extends K{_match;captures;_cachedCompiledPatterns;constructor(n,e,t,s,r){super(n,e,t,null),this._match=new z(s,this.id),this.captures=r,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,s){return this._getCachedCompiledPatterns(n).compileAG(n,t,s)}_getCachedCompiledPatterns(n){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new U,this.collectPatterns(n,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ze=class extends K{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(n,e,t,s,r){super(n,e,t,s),this.patterns=r.patterns,this.hasMissingPatterns=r.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,s){return this._getCachedCompiledPatterns(n).compileAG(n,t,s)}_getCachedCompiledPatterns(n){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new U,this.collectPatterns(n,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ne=class extends K{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(n,e,t,s,r,i,a,c,o,l){super(n,e,t,s),this._begin=new z(r,this.id),this.beginCaptures=i,this._end=new z(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,s){return this._getCachedCompiledPatterns(n,e).compileAG(n,t,s)}_getCachedCompiledPatterns(n,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new U;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}},se=class extends K{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(n,e,t,s,r,i,a,c,o){super(n,e,t,s),this._begin=new z(r,this.id),this.beginCaptures=i,this.whileCaptures=c,this._while=new z(a,_t),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,s){return this._getCachedCompiledPatterns(n).compileAG(n,t,s)}_getCachedCompiledPatterns(n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new U;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,s){return this._getCachedCompiledWhilePatterns(n,e).compileAG(n,t,s)}_getCachedCompiledWhilePatterns(n,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new U,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||"￿"),this._cachedCompiledWhilePatterns}},yt=class R{static createCaptureRule(e,t,s,r,i){return e.registerRule(a=>new on(t,a,s,r,i))}static getCompiledRuleId(e,t,s){return e.id||t.registerRule(r=>{if(e.id=r,e.match)return new an(e.$vscodeTextmateLocation,e.id,e.name,e.match,R._compileCaptures(e.captures,t,s));if(typeof e.begin>"u"){e.repository&&(s=at({},s,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,R._compilePatterns(i,t,s))}return e.while?new se(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,R._compileCaptures(e.beginCaptures||e.captures,t,s),e.while,R._compileCaptures(e.whileCaptures||e.captures,t,s),R._compilePatterns(e.patterns,t,s)):new Ne(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,R._compileCaptures(e.beginCaptures||e.captures,t,s),e.end,R._compileCaptures(e.endCaptures||e.captures,t,s),e.applyEndPatternLast,R._compilePatterns(e.patterns,t,s))}),e.id}static _compileCaptures(e,t,s){let r=[];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++)r[a]=null;for(const a in e){if(a==="$vscodeTextmateLocation")continue;const c=parseInt(a,10);let o=0;e[a].patterns&&(o=R.getCompiledRuleId(e[a],t,s)),r[c]=R.createCaptureRule(t,e[a].$vscodeTextmateLocation,e[a].name,e[a].contentName,o)}}return r}static _compilePatterns(e,t,s){let r=[];if(e)for(let i=0,a=e.length;i<a;i++){const c=e[i];let o=-1;if(c.include){const l=gt(c.include);switch(l.kind){case 0:case 1:o=R.getCompiledRuleId(s[c.include],t,s);break;case 2:let u=s[l.ruleName];u&&(o=R.getCompiledRuleId(u,t,s));break;case 3:case 4:const h=l.scopeName,d=l.kind===4?l.ruleName:null,p=t.getExternalGrammar(h,s);if(p)if(d){let f=p.repository[d];f&&(o=R.getCompiledRuleId(f,t,p.repository))}else o=R.getCompiledRuleId(p.repository.$self,t,p.repository);break}}else o=R.getCompiledRuleId(c,t,s);if(o!==-1){const l=t.getRule(o);let u=!1;if((l instanceof ze||l instanceof Ne||l instanceof se)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;r.push(o)}}return{patterns:r,hasMissingPatterns:(e?e.length:0)!==r.length}}},z=class bt{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e=="string"){const s=e.length;let r=0,i=[],a=!1;for(let c=0;c<s;c++)if(e.charAt(c)==="\\"&&c+1<s){const l=e.charAt(c+1);l==="z"?(i.push(e.substring(r,c)),i.push("$(?!\\n)(?<!\\n)"),r=c+2):(l==="A"||l==="G")&&(a=!0),c++}this.hasAnchor=a,r===0?this.source=e:(i.push(e.substring(r,s)),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=sn.test(this.source):this.hasBackReferences=!1}clone(){return new bt(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 s=t.map(r=>e.substring(r.start,r.end));return qe.lastIndex=0,this.source.replace(qe,(r,i)=>ht(s[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=[],s=[],r=[],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,s[i]=c,r[i]=c,c==="\\"&&i+1<a&&(o=this.source.charAt(i+1),o==="A"?(e[i+1]="￿",t[i+1]="￿",s[i+1]="A",r[i+1]="A"):o==="G"?(e[i+1]="￿",t[i+1]="G",s[i+1]="￿",r[i+1]="G"):(e[i+1]=o,t[i+1]=o,s[i+1]=o,r[i+1]=o),i++);return{A0_G0:e.join(""),A0_G1:t.join(""),A1_G0:s.join(""),A1_G1:r.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}},U=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 Ue(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 s=this._items.map(r=>r.resolveAnchors(e,t));return new Ue(n,s,this._items.map(r=>r.ruleId))}},Ue=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
2
  `)}findNextMatchSync(n,e,t){const s=this.scanner.findNextMatchSync(n,e,t);return s?{ruleId:this.rules[s.index],captureIndices:s.captureIndices}:null}},_e=class{constructor(n,e){this.languageId=n,this.tokenType=e}},cn=class ke{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new _e(e,8),this._embeddedLanguagesMatcher=new ln(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?ke._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new _e(0,0);_getBasicScopeAttributes=new ft(e=>{const t=this._scopeToLanguage(e),s=this._toStandardTokenType(e);return new _e(t,s)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const t=e.match(ke.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/},ln=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,s])=>ht(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])}};typeof process<"u"&&process.env.VSCODE_TEXTMATE_DEBUG;var He=class{constructor(n,e){this.stack=n,this.stoppedEarly=e}};function St(n,e,t,s,r,i,a,c){const o=e.content.length;let l=!1,u=-1;if(a){const p=un(n,e,t,s,r,i);r=p.stack,s=p.linePos,t=p.isFirstLine,u=p.anchorPosition}const h=Date.now();for(;!l;){if(c!==0&&Date.now()-h>c)return new He(r,!0);d()}return new He(r,!1);function d(){const p=hn(n,e,t,s,r,u);if(!p){i.produce(r,o),l=!0;return}const f=p.captureIndices,b=p.matchedRuleId,_=f&&f.length>0?f[0].end>s:!1;if(b===rn){const g=r.getRule(n);i.produce(r,f[0].start),r=r.withContentNameScopesList(r.nameScopesList),D(n,e,t,r,i,g.endCaptures,f),i.produce(r,f[0].end);const m=r;if(r=r.parent,u=m.getAnchorPos(),!_&&m.getEnterPos()===s){r=m,i.produce(r,o),l=!0;return}}else{const g=n.getRule(b);i.produce(r,f[0].start);const m=r,y=g.getName(e.content,f),k=r.contentNameScopesList.pushAttributed(y,n);if(r=r.push(b,s,u,f[0].end===o,null,k,k),g instanceof Ne){const S=g;D(n,e,t,r,i,S.beginCaptures,f),i.produce(r,f[0].end),u=f[0].end;const T=S.getContentName(e.content,f),x=k.pushAttributed(T,n);if(r=r.withContentNameScopesList(x),S.endHasBackReferences&&(r=r.withEndRule(S.getEndWithResolvedBackReferences(e.content,f))),!_&&m.hasSameRuleAs(r)){r=r.pop(),i.produce(r,o),l=!0;return}}else if(g instanceof se){const S=g;D(n,e,t,r,i,S.beginCaptures,f),i.produce(r,f[0].end),u=f[0].end;const T=S.getContentName(e.content,f),x=k.pushAttributed(T,n);if(r=r.withContentNameScopesList(x),S.whileHasBackReferences&&(r=r.withEndRule(S.getWhileWithResolvedBackReferences(e.content,f))),!_&&m.hasSameRuleAs(r)){r=r.pop(),i.produce(r,o),l=!0;return}}else if(D(n,e,t,r,i,g.captures,f),i.produce(r,f[0].end),r=r.pop(),!_){r=r.safePop(),i.produce(r,o),l=!0;return}}f[0].end>s&&(s=f[0].end,t=!1)}}function un(n,e,t,s,r,i){let a=r.beginRuleCapturedEOL?0:-1;const c=[];for(let o=r;o;o=o.pop()){const l=o.getRule(n);l instanceof se&&c.push({rule:l,stack:o})}for(let o=c.pop();o;o=c.pop()){const{ruleScanner:l,findOptions:u}=pn(o.rule,n,o.stack.endRule,t,s===a),h=l.findNextMatchSync(e,s,u);if(h){if(h.ruleId!==_t){r=o.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(i.produce(o.stack,h.captureIndices[0].start),D(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>s&&(s=h.captureIndices[0].end,t=!1))}else{r=o.stack.pop();break}}return{stack:r,linePos:s,anchorPosition:a,isFirstLine:t}}function hn(n,e,t,s,r,i){const a=fn(n,e,t,s,r,i),c=n.getInjections();if(c.length===0)return a;const o=dn(c,n,e,t,s,r,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 fn(n,e,t,s,r,i){const a=r.getRule(n),{ruleScanner:c,findOptions:o}=Ct(a,n,r.endRule,t,s===i),l=c.findNextMatchSync(e,s,o);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function dn(n,e,t,s,r,i,a){let c=Number.MAX_VALUE,o=null,l,u=0;const h=i.contentNameScopesList.getScopeNames();for(let d=0,p=n.length;d<p;d++){const f=n[d];if(!f.matcher(h))continue;const b=e.getRule(f.ruleId),{ruleScanner:_,findOptions:g}=Ct(b,e,null,s,r===a),m=_.findNextMatchSync(t,r,g);if(!m)continue;const y=m.captureIndices[0].start;if(!(y>=c)&&(c=y,o=m.captureIndices,l=m.ruleId,u=f.priority,c===r))break}return o?{priorityMatch:u===-1,captureIndices:o,matchedRuleId:l}:null}function Ct(n,e,t,s,r){return{ruleScanner:n.compileAG(e,t,s,r),findOptions:0}}function pn(n,e,t,s,r){return{ruleScanner:n.compileWhileAG(e,t,s,r),findOptions:0}}function D(n,e,t,s,r,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 d=i[h];if(d===null)continue;const p=a[h];if(p.length===0)continue;if(p.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=p.start;)r.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?r.produceFromScopes(l[l.length-1].scopes,p.start):r.produce(s,p.start),d.retokenizeCapturedWithRuleId){const b=d.getName(c,a),_=s.contentNameScopesList.pushAttributed(b,n),g=d.getContentName(c,a),m=_.pushAttributed(g,n),y=s.push(d.retokenizeCapturedWithRuleId,p.start,-1,!1,null,_,m),k=n.createOnigString(c.substring(0,p.end));St(n,k,t&&p.start===0,p.start,y,r,!1,0),mt(k);continue}const f=d.getName(c,a);if(f!==null){const _=(l.length>0?l[l.length-1].scopes:s.contentNameScopesList).pushAttributed(f,n);l.push(new mn(_,p.end))}}for(;l.length>0;)r.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var mn=class{scopes;endPos;constructor(n,e){this.scopes=n,this.endPos=e}};function gn(n,e,t,s,r,i,a,c){return new yn(n,e,t,s,r,i,a,c)}function Ke(n,e,t,s,r){const i=te(e,re),a=yt.getCompiledRuleId(t,s,r.repository);for(const c of i)n.push({debugSelector:e,matcher:c.matcher,ruleId:a,grammar:r,priority:c.priority})}function re(n,e){if(e.length<n.length)return!1;let t=0;return n.every(s=>{for(let r=t;r<e.length;r++)if(_n(e[r],s))return t=r+1,!0;return!1})}function _n(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 yn=class{constructor(n,e,t,s,r,i,a,c){if(this._rootScopeName=n,this.balancedBracketSelectors=i,this._onigLib=c,this._basicScopeAttributesProvider=new cn(t,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=a,this._grammar=Ve(e,null),this._injections=null,this._tokenTypeMatchers=[],r)for(const o of Object.keys(r)){const l=te(o,re);for(const u of l)this._tokenTypeMatchers.push({matcher:u.matcher,type:r[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:r=>r===this._rootScopeName?this._grammar:this.getExternalGrammar(r),injections:r=>this._grammarRepository.injections(r)},e=[],t=this._rootScopeName,s=n.lookup(t);if(s){const r=s.injections;if(r)for(let a in r)Ke(e,a,r[a],this,s);const i=this._grammarRepository.injections(t);i&&i.forEach(a=>{const c=this.getExternalGrammar(a);if(c){const o=c.injectionSelector;o&&Ke(e,o,c,this,c)}})}return e.sort((r,i)=>r.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]=Ve(t,e&&e.$base),this._includedGrammars[n]}}tokenizeLine(n,e,t=0){const s=this._tokenize(n,e,!1,t);return{tokens:s.lineTokens.getResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}tokenizeLine2(n,e,t=0){const s=this._tokenize(n,e,!0,t);return{tokens:s.lineTokens.getBinaryResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}_tokenize(n,e,t,s){this._rootId===-1&&(this._rootId=yt.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let r;if(!e||e===ve.NULL){r=!0;const l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),h=M.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),d=this.getRule(this._rootId).getName(null,null);let p;d?p=W.createRootAndLookUpScopeName(d,h,this):p=W.createRoot("unknown",h),e=new ve(null,this._rootId,-1,-1,!1,null,p,p)}else r=!1,e.reset();n=n+`
3
3
  `;const i=this.createOnigString(n),a=i.content.length,c=new Sn(t,n,this._tokenTypeMatchers,this.balancedBracketSelectors),o=St(this,i,r,0,e,c,!0,s);return mt(i),{lineLength:a,lineTokens:c,ruleStack:o.stack,stoppedEarly:o.stoppedEarly}}};function Ve(n,e){return n=$t(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 W=class A{constructor(e,t,s){this.parent=e,this.scopePath=t,this.tokenAttributes=s}static fromExtension(e,t){let s=e,r=e?.scopePath??null;for(const i of t)r=ge.push(r,i.scopeNames),s=new A(s,r,i.encodedTokenAttributes);return s}static createRoot(e,t){return new A(null,new ge(null,e),t)}static createRootAndLookUpScopeName(e,t,s){const r=s.getMetadataForScope(e),i=new ge(null,e),a=s.themeProvider.themeMatch(i),c=A.mergeAttributes(t,r,a);return new A(null,i,c)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return A.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,s){let r=-1,i=0,a=0;return s!==null&&(r=s.fontStyle,i=s.foregroundId,a=s.backgroundId),M.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(e,t){if(e===null)return this;if(e.indexOf(" ")===-1)return A._pushAttributed(this,e,t);const s=e.split(/ /g);let r=this;for(const i of s)r=A._pushAttributed(r,i,t);return r}static _pushAttributed(e,t,s){const r=s.getMetadataForScope(t),i=e.scopePath.push(t),a=s.themeProvider.themeMatch(i),c=A.mergeAttributes(e.tokenAttributes,r,a);return new A(e,i,c)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const t=[];let s=this;for(;s&&s!==e;)t.push({encodedTokenAttributes:s.tokenAttributes,scopeNames:s.scopePath.getExtensionIfDefined(s.parent?.scopePath??null)}),s=s.parent;return s===e?t.reverse():void 0}},ve=class P{constructor(e,t,s,r,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=s,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new P(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:P._equals(this,e)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?W.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(){P._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,t,s,r,i,a,c){return new P(this,e,t,s,r,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 P(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 s=W.fromExtension(e?.nameScopesList??null,t.nameScopesList);return new P(e,t.ruleId,t.enterPos??-1,t.anchorPos??-1,t.beginRuleCapturedEOL,t.endRule,s,W.fromExtension(s,t.contentNameScopesList))}},bn=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(n,e){this.balancedBracketScopes=n.flatMap(t=>t==="*"?(this.allowAny=!0,[]):te(t,re).map(s=>s.matcher)),this.unbalancedBracketScopes=e.flatMap(t=>te(t,re).map(s=>s.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}},Sn=class{constructor(n,e,t,s){this.balancedBracketSelectors=s,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 s=n?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!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)&&(s=M.set(s,0,a.type,null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(i))}if(r&&(s=M.set(s,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===s){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(s),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 s=0,r=this._binaryTokens.length;s<r;s++)t[s]=this._binaryTokens[s];return t}},Cn=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,s,r){if(!this._grammars.has(n)){let i=this._rawGrammars.get(n);if(!i)return null;this._grammars.set(n,gn(n,i,e,t,s,r,this,this._onigLib))}return this._grammars.get(n)}},wn=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Cn(ee.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(ee.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,s){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:s})}loadGrammarWithConfiguration(e,t,s){return this._loadGrammar(e,t,s.embeddedLanguages,s.tokenTypes,new bn(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,s,r,i){const a=new Yt(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(c=>this._loadSingleGrammar(c.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,s,r,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 s=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,s)}}addGrammar(e,t=[],s=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,s,r)}_grammarForScopeName(e,t=0,s=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,s,r,i)}},Ae=ve.NULL;const Rn=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Je={}.hasOwnProperty;function Nn(n,e){const t=e||{};function s(r,...i){let a=s.invalid;const c=s.handlers;if(r&&Je.call(r,n)){const o=String(r[n]);a=Je.call(c,o)?c[o]:s.unknown}if(a)return a.call(this,r,...i)}return s.handlers=t.handlers||{},s.invalid=t.invalid,s.unknown=t.unknown,s}const kn=/["&'<>`]/g,vn=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,An=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,In=/[|\\{}()[\]^$+*?.]/g,Ye=new WeakMap;function Tn(n,e){if(n=n.replace(e.subset?En(e.subset):kn,s),e.subset||e.escapeOnly)return n;return n.replace(vn,t).replace(An,s);function t(r,i,a){return e.format((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)-56320+65536,a.charCodeAt(i+2),e)}function s(r,i,a){return e.format(r.charCodeAt(0),a.charCodeAt(i+1),e)}}function En(n){let e=Ye.get(n);return e||(e=xn(n),Ye.set(n,e)),e}function xn(n){const e=[];let t=-1;for(;++t<n.length;)e.push(n[t].replace(In,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const Pn=/[\dA-Fa-f]/;function Ln(n,e,t){const s="&#x"+n.toString(16).toUpperCase();return t&&e&&!Pn.test(String.fromCharCode(e))?s:s+";"}const Gn=/\d/;function On(n,e,t){const s="&#"+String(n);return t&&e&&!Gn.test(String.fromCharCode(e))?s:s+";"}const $n=["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"],ye={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:"€"},Mn=["cent","copy","divide","gt","lt","not","para","times"],wt={}.hasOwnProperty,Ie={};let J;for(J in ye)wt.call(ye,J)&&(Ie[ye[J]]=J);const Bn=/[^\dA-Za-z]/;function jn(n,e,t,s){const r=String.fromCharCode(n);if(wt.call(Ie,r)){const i=Ie[r],a="&"+i;return t&&$n.includes(i)&&!Mn.includes(i)&&(!s||e&&e!==61&&Bn.test(String.fromCharCode(e)))?a:a+";"}return""}function Fn(n,e,t){let s=Ln(n,e,t.omitOptionalSemicolons),r;if((t.useNamedReferences||t.useShortestReferences)&&(r=jn(n,e,t.omitOptionalSemicolons,t.attribute)),(t.useShortestReferences||!r)&&t.useShortestReferences){const i=On(n,e,t.omitOptionalSemicolons);i.length<s.length&&(s=i)}return r&&(!t.useShortestReferences||r.length<s.length)?r:s}function $(n,e){return Tn(n,Object.assign({format:Fn},e))}const Dn=/^>|^->|<!--|-->|--!>|<!-$/g,Wn=[">"],qn=["<",">"];function zn(n,e,t,s){return s.settings.bogusComments?"<?"+$(n.value,Object.assign({},s.settings.characterReferences,{subset:Wn}))+">":"<!--"+n.value.replace(Dn,r)+"-->";function r(i){return $(i,Object.assign({},s.settings.characterReferences,{subset:qn}))}}function Un(n,e,t,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"}function Qe(n,e){const t=String(n);if(typeof e!="string")throw new TypeError("Expected character");let s=0,r=t.indexOf(e);for(;r!==-1;)s++,r=t.indexOf(e,r+e.length);return s}function Hn(n,e){const t=e||{};return(n[n.length-1]===""?[...n,""]:n).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}function Kn(n){return n.join(" ").trim()}const Vn=/[ \t\n\f\r]/g;function xe(n){return typeof n=="object"?n.type==="text"?Xe(n.value):!1:Xe(n)}function Xe(n){return n.replace(Vn,"")===""}const C=Nt(1),Rt=Nt(-1),Jn=[];function Nt(n){return e;function e(t,s,r){const i=t?t.children:Jn;let a=(s||0)+n,c=i[a];if(!r)for(;c&&xe(c);)a+=n,c=i[a];return c}}const Yn={}.hasOwnProperty;function kt(n){return e;function e(t,s,r){return Yn.call(n,t.tagName)&&n[t.tagName](t,s,r)}}const Pe=kt({body:Xn,caption:be,colgroup:be,dd:ns,dt:ts,head:be,html:Qn,li:es,optgroup:ss,option:rs,p:Zn,rp:Ze,rt:Ze,tbody:os,td:et,tfoot:as,th:et,thead:is,tr:cs});function be(n,e,t){const s=C(t,e,!0);return!s||s.type!=="comment"&&!(s.type==="text"&&xe(s.value.charAt(0)))}function Qn(n,e,t){const s=C(t,e);return!s||s.type!=="comment"}function Xn(n,e,t){const s=C(t,e);return!s||s.type!=="comment"}function Zn(n,e,t){const s=C(t,e);return s?s.type==="element"&&(s.tagName==="address"||s.tagName==="article"||s.tagName==="aside"||s.tagName==="blockquote"||s.tagName==="details"||s.tagName==="div"||s.tagName==="dl"||s.tagName==="fieldset"||s.tagName==="figcaption"||s.tagName==="figure"||s.tagName==="footer"||s.tagName==="form"||s.tagName==="h1"||s.tagName==="h2"||s.tagName==="h3"||s.tagName==="h4"||s.tagName==="h5"||s.tagName==="h6"||s.tagName==="header"||s.tagName==="hgroup"||s.tagName==="hr"||s.tagName==="main"||s.tagName==="menu"||s.tagName==="nav"||s.tagName==="ol"||s.tagName==="p"||s.tagName==="pre"||s.tagName==="section"||s.tagName==="table"||s.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 es(n,e,t){const s=C(t,e);return!s||s.type==="element"&&s.tagName==="li"}function ts(n,e,t){const s=C(t,e);return!!(s&&s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd"))}function ns(n,e,t){const s=C(t,e);return!s||s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd")}function Ze(n,e,t){const s=C(t,e);return!s||s.type==="element"&&(s.tagName==="rp"||s.tagName==="rt")}function ss(n,e,t){const s=C(t,e);return!s||s.type==="element"&&s.tagName==="optgroup"}function rs(n,e,t){const s=C(t,e);return!s||s.type==="element"&&(s.tagName==="option"||s.tagName==="optgroup")}function is(n,e,t){const s=C(t,e);return!!(s&&s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot"))}function os(n,e,t){const s=C(t,e);return!s||s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot")}function as(n,e,t){return!C(t,e)}function cs(n,e,t){const s=C(t,e);return!s||s.type==="element"&&s.tagName==="tr"}function et(n,e,t){const s=C(t,e);return!s||s.type==="element"&&(s.tagName==="td"||s.tagName==="th")}const ls=kt({body:fs,colgroup:ds,head:hs,html:us,tbody:ps});function us(n){const e=C(n,-1);return!e||e.type!=="comment"}function hs(n){const e=new Set;for(const s of n.children)if(s.type==="element"&&(s.tagName==="base"||s.tagName==="title")){if(e.has(s.tagName))return!1;e.add(s.tagName)}const t=n.children[0];return!t||t.type==="element"}function fs(n){const e=C(n,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&xe(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function ds(n,e,t){const s=Rt(t,e),r=C(n,-1,!0);return t&&s&&s.type==="element"&&s.tagName==="colgroup"&&Pe(s,t.children.indexOf(s),t)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function ps(n,e,t){const s=Rt(t,e),r=C(n,-1);return t&&s&&s.type==="element"&&(s.tagName==="thead"||s.tagName==="tbody")&&Pe(s,t.children.indexOf(s),t)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}const Y={name:[[`
4
4
  \f\r &/=>`.split(""),`
@@ -10,4 +10,4 @@
10
10
  \f\r "&'<=>\``.split(""),`\0
11
11
  \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function ms(n,e,t,s){const r=s.schema,i=r.space==="svg"?!1:s.settings.omitOptionalTags;let a=r.space==="svg"?s.settings.closeEmptyElements:s.settings.voids.includes(n.tagName.toLowerCase());const c=[];let o;r.space==="html"&&n.tagName==="svg"&&(s.schema=Z.svg);const l=gs(s,n.properties),u=s.all(r.space==="html"&&n.tagName==="template"?n.content:n);return s.schema=r,u&&(a=!1),(l||!i||!ls(n,e,t))&&(c.push("<",n.tagName,l?" "+l:""),a&&(r.space==="svg"||s.settings.closeSelfClosing)&&(o=l.charAt(l.length-1),(!s.settings.tightSelfClosing||o==="/"||o&&o!=='"'&&o!=="'")&&c.push(" "),c.push("/")),c.push(">")),c.push(u),!a&&(!i||!Pe(n,e,t))&&c.push("</"+n.tagName+">"),c.join("")}function gs(n,e){const t=[];let s=-1,r;if(e){for(r in e)if(e[r]!==null&&e[r]!==void 0){const i=_s(n,r,e[r]);i&&t.push(i)}}for(;++s<t.length;){const i=n.settings.tightAttributes?t[s].charAt(t[s].length-1):void 0;s!==t.length-1&&i!=='"'&&i!=="'"&&(t[s]+=" ")}return t.join("")}function _s(n,e,t){const s=Z.find(n.schema,e),r=n.settings.allowParseErrors&&n.schema.space==="html"?0:1,i=n.settings.allowDangerousCharacters?0:1;let a=n.quote,c;if(s.overloadedBoolean&&(t===s.attribute||t==="")?t=!0:(s.boolean||s.overloadedBoolean)&&(typeof t!="string"||t===s.attribute||t==="")&&(t=!!t),t==null||t===!1||typeof t=="number"&&Number.isNaN(t))return"";const o=$(s.attribute,Object.assign({},n.settings.characterReferences,{subset:Y.name[r][i]}));return t===!0||(t=Array.isArray(t)?(s.commaSeparated?Hn:Kn)(t,{padLeft:!n.settings.tightCommaSeparatedLists}):String(t),n.settings.collapseEmptyAttributes&&!t)?o:(n.settings.preferUnquoted&&(c=$(t,Object.assign({},n.settings.characterReferences,{attribute:!0,subset:Y.unquoted[r][i]}))),c!==t&&(n.settings.quoteSmart&&Qe(t,a)>Qe(t,n.alternative)&&(a=n.alternative),c=a+$(t,Object.assign({},n.settings.characterReferences,{subset:(a==="'"?Y.single:Y.double)[r][i],attribute:!0}))+a),o+(c&&"="+c))}const ys=["<","&"];function vt(n,e,t,s){return t&&t.type==="element"&&(t.tagName==="script"||t.tagName==="style")?n.value:$(n.value,Object.assign({},s.settings.characterReferences,{subset:ys}))}function bs(n,e,t,s){return s.settings.allowDangerousHtml?n.value:vt(n,e,t,s)}function Ss(n,e,t,s){return s.all(n)}const Cs=Nn("type",{invalid:ws,unknown:Rs,handlers:{comment:zn,doctype:Un,element:ms,raw:bs,root:Ss,text:vt}});function ws(n){throw new Error("Expected node, not `"+n+"`")}function Rs(n){const e=n;throw new Error("Cannot compile unknown node `"+e.type+"`")}const Ns={},ks={},vs=[];function As(n,e){const t=e||Ns,s=t.quote||'"',r=s==='"'?"'":'"';if(s!=='"'&&s!=="'")throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:Is,all:Ts,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||Rn,characterReferences:t.characterReferences||ks,closeSelfClosing:t.closeSelfClosing||!1,closeEmptyElements:t.closeEmptyElements||!1},schema:t.space==="svg"?Z.svg:Z.html,quote:s,alternative:r}.one(Array.isArray(n)?{type:"root",children:n}:n,void 0,void 0)}function Is(n,e,t){return Cs(n,e,t,this)}function Ts(n){const e=[],t=n&&n.children||vs;let s=-1;for(;++s<t.length;)e[s]=this.one(t[s],s,n);return e.join("")}function ie(n,e){const t=typeof n=="string"?{}:{...n.colorReplacements},s=typeof n=="string"?n:n.name;for(const[r,i]of Object.entries(e?.colorReplacements||{}))typeof i=="string"?t[r]=i:r===s&&Object.assign(t,i);return t}function E(n,e){return n&&(e?.[n?.toLowerCase()]||n)}function Es(n){return Array.isArray(n)?n:[n]}async function At(n){return Promise.resolve(typeof n=="function"?n():n).then(e=>e.default||e)}function Le(n){return!n||["plaintext","txt","text","plain"].includes(n)}function xs(n){return n==="ansi"||Le(n)}function Ge(n){return n==="none"}function Ps(n){return Ge(n)}function It(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 s of t)s&&!n.properties.class.includes(s)&&n.properties.class.push(s);return n}function he(n,e=!1){const t=n.split(/(\r?\n)/g);let s=0;const r=[];for(let i=0;i<t.length;i+=2){const a=e?t[i]+(t[i+1]||""):t[i];r.push([a,s]),s+=t[i].length,s+=t[i+1]?.length||0}return r}function Ls(n){const e=he(n,!0).map(([r])=>r);function t(r){if(r===n.length)return{line:e.length-1,character:e[e.length-1].length};let i=r,a=0;for(const c of e){if(i<c.length)break;i-=c.length,a++}return{line:a,character:i}}function s(r,i){let a=0;for(let c=0;c<r;c++)a+=e[c].length;return a+=i,a}return{lines:e,indexToPos:t,posToIndex:s}}const Oe="light-dark()",Gs=["color","background-color"];function Os(n,e){let t=0;const s=[];for(const r of e)r>t&&s.push({...n,content:n.content.slice(t,r),offset:n.offset+t}),t=r;return t<n.content.length&&s.push({...n,content:n.content.slice(t),offset:n.offset+t}),s}function $s(n,e){const t=Array.from(e instanceof Set?e:new Set(e)).sort((s,r)=>s-r);return t.length?n.map(s=>s.flatMap(r=>{const i=t.filter(a=>r.offset<a&&a<r.offset+r.content.length).map(a=>a-r.offset).sort((a,c)=>a-c);return i.length?Os(r,i):r})):n}function Ms(n,e,t,s,r="css-vars"){const i={content:n.content,explanation:n.explanation,offset:n.offset},a=e.map(u=>oe(n.variants[u])),c=new Set(a.flatMap(u=>Object.keys(u))),o={},l=(u,h)=>{const d=h==="color"?"":h==="background-color"?"-bg":`-${h}`;return t+e[u]+(h==="color"?"":d)};return a.forEach((u,h)=>{for(const d of c){const p=u[d]||"inherit";if(h===0&&s&&Gs.includes(d))if(s===Oe&&a.length>1){const f=e.findIndex(m=>m==="light"),b=e.findIndex(m=>m==="dark");if(f===-1||b===-1)throw new w('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const _=a[f][d]||"inherit",g=a[b][d]||"inherit";o[d]=`light-dark(${_}, ${g})`,r==="css-vars"&&(o[l(h,d)]=p)}else o[d]=p;else r==="css-vars"&&(o[l(h,d)]=p)}}),i.htmlStyle=o,i}function oe(n){const e={};if(n.color&&(e.color=n.color),n.bgColor&&(e["background-color"]=n.bgColor),n.fontStyle){n.fontStyle&N.Italic&&(e["font-style"]="italic"),n.fontStyle&N.Bold&&(e["font-weight"]="bold");const t=[];n.fontStyle&N.Underline&&t.push("underline"),n.fontStyle&N.Strikethrough&&t.push("line-through"),t.length&&(e["text-decoration"]=t.join(" "))}return e}function Te(n){return typeof n=="string"?n:Object.entries(n).map(([e,t])=>`${e}:${t}`).join(";")}const Tt=new WeakMap;function fe(n,e){Tt.set(n,e)}function H(n){return Tt.get(n)}class j{_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 j(Object.fromEntries(Es(t).map(s=>[s,Ae])),e)}constructor(...e){if(e.length===2){const[t,s]=e;this.lang=s,this._stacks=t}else{const[t,s,r]=e;this.lang=s,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return Bs(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function Bs(n){const e=[],t=new Set;function s(r){if(t.has(r))return;t.add(r);const i=r?.nameScopesList?.scopeName;i&&e.push(i),r.parent&&s(r.parent)}return s(n),e}function js(n,e){if(!(n instanceof j))throw new w("Invalid grammar state");return n.getInternalStack(e)}function Fs(){const n=new WeakMap;function e(t){if(!n.has(t.meta)){let s=function(a){if(typeof a=="number"){if(a<0||a>t.source.length)throw new w(`Invalid decoration offset: ${a}. Code length: ${t.source.length}`);return{...r.indexToPos(a),offset:a}}else{const c=r.lines[a.line];if(c===void 0)throw new w(`Invalid decoration position ${JSON.stringify(a)}. Lines length: ${r.lines.length}`);let o=a.character;if(o<0&&(o=c.length+o),o<0||o>c.length)throw new w(`Invalid decoration position ${JSON.stringify(a)}. Line ${a.line} length: ${c.length}`);return{...a,character:o,offset:r.posToIndex(a.line,o)}}};const r=Ls(t.source),i=(t.options.decorations||[]).map(a=>({...a,start:s(a.start),end:s(a.end)}));Ds(i),n.set(t.meta,{decorations:i,converter:r,source:t.source})}return n.get(t.meta)}return{name:"shiki:decorations",tokens(t){if(!this.options.decorations?.length)return;const r=e(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]);return $s(t,r)},code(t){if(!this.options.decorations?.length)return;const s=e(this),r=Array.from(t.children).filter(u=>u.type==="element"&&u.tagName==="span");if(r.length!==s.converter.lines.length)throw new w(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${s.converter.lines.length}). Failed to apply decorations.`);function i(u,h,d,p){const f=r[u];let b="",_=-1,g=-1;if(h===0&&(_=0),d===0&&(g=0),d===Number.POSITIVE_INFINITY&&(g=f.children.length),_===-1||g===-1)for(let y=0;y<f.children.length;y++)b+=Et(f.children[y]),_===-1&&b.length===h&&(_=y+1),g===-1&&b.length===d&&(g=y+1);if(_===-1)throw new w(`Failed to find start index for decoration ${JSON.stringify(p.start)}`);if(g===-1)throw new w(`Failed to find end index for decoration ${JSON.stringify(p.end)}`);const m=f.children.slice(_,g);if(!p.alwaysWrap&&m.length===f.children.length)c(f,p,"line");else if(!p.alwaysWrap&&m.length===1&&m[0].type==="element")c(m[0],p,"token");else{const y={type:"element",tagName:"span",properties:{},children:m};c(y,p,"wrapper"),f.children.splice(_,m.length,y)}}function a(u,h){r[u]=c(r[u],h,"line")}function c(u,h,d){const p=h.properties||{},f=h.transform||(b=>b);return u.tagName=h.tagName||"span",u.properties={...u.properties,...p,class:u.properties.class},h.properties?.class&&It(u,h.properties.class),u=f(u,d)||u,u}const o=[],l=s.decorations.sort((u,h)=>h.start.offset-u.start.offset||u.end.offset-h.end.offset);for(const u of l){const{start:h,end:d}=u;if(h.line===d.line)i(h.line,h.character,d.character,u);else if(h.line<d.line){i(h.line,h.character,Number.POSITIVE_INFINITY,u);for(let p=h.line+1;p<d.line;p++)o.unshift(()=>a(p,u));i(d.line,0,d.character,u)}}o.forEach(u=>u())}}}function Ds(n){for(let e=0;e<n.length;e++){const t=n[e];if(t.start.offset>t.end.offset)throw new w(`Invalid decoration range: ${JSON.stringify(t.start)} - ${JSON.stringify(t.end)}`);for(let s=e+1;s<n.length;s++){const r=n[s],i=t.start.offset<=r.start.offset&&r.start.offset<t.end.offset,a=t.start.offset<r.end.offset&&r.end.offset<=t.end.offset,c=r.start.offset<=t.start.offset&&t.start.offset<r.end.offset,o=r.start.offset<t.end.offset&&t.end.offset<=r.end.offset;if(i||a||c||o){if(i&&a||c&&o||c&&t.start.offset===t.end.offset||a&&r.start.offset===r.end.offset)continue;throw new w(`Decorations ${JSON.stringify(t.start)} and ${JSON.stringify(r.start)} intersect.`)}}}}function Et(n){return n.type==="text"?n.value:n.type==="element"?n.children.map(Et).join(""):""}const Ws=[Fs()];function ae(n){const e=qs(n.transformers||[]);return[...e.pre,...e.normal,...e.post,...Ws]}function qs(n){const e=[],t=[],s=[];for(const r of n)switch(r.enforce){case"pre":e.push(r);break;case"post":t.push(r);break;default:s.push(r)}return{pre:e,post:t,normal:s}}var L=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Se={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function zs(n,e){const t=n.indexOf("\x1B",e);if(t!==-1&&n[t+1]==="["){const s=n.indexOf("m",t);if(s!==-1)return{sequence:n.substring(t+2,s).split(";"),startPosition:t,position:s+1}}return{position:n.length}}function tt(n){const e=n.shift();if(e==="2"){const t=n.splice(0,3).map(s=>Number.parseInt(s));return t.length!==3||t.some(s=>Number.isNaN(s))?void 0:{type:"rgb",rgb:t}}else if(e==="5"){const t=n.shift();if(t)return{type:"table",index:Number(t)}}}function Us(n){const e=[];for(;n.length>0;){const t=n.shift();if(!t)continue;const s=Number.parseInt(t);if(!Number.isNaN(s))if(s===0)e.push({type:"resetAll"});else if(s<=9)Se[s]&&e.push({type:"setDecoration",value:Se[s]});else if(s<=29){const r=Se[s-20];r&&(e.push({type:"resetDecoration",value:r}),r==="dim"&&e.push({type:"resetDecoration",value:"bold"}))}else if(s<=37)e.push({type:"setForegroundColor",value:{type:"named",name:L[s-30]}});else if(s===38){const r=tt(n);r&&e.push({type:"setForegroundColor",value:r})}else if(s===39)e.push({type:"resetForegroundColor"});else if(s<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:L[s-40]}});else if(s===48){const r=tt(n);r&&e.push({type:"setBackgroundColor",value:r})}else s===49?e.push({type:"resetBackgroundColor"}):s===53?e.push({type:"setDecoration",value:"overline"}):s===55?e.push({type:"resetDecoration",value:"overline"}):s>=90&&s<=97?e.push({type:"setForegroundColor",value:{type:"named",name:L[s-90+8]}}):s>=100&&s<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:L[s-100+8]}})}return e}function Hs(){let n=null,e=null,t=new Set;return{parse(s){const r=[];let i=0;do{const a=zs(s,i),c=a.sequence?s.substring(i,a.startPosition):s.substring(i);if(c.length>0&&r.push({value:c,foreground:n,background:e,decorations:new Set(t)}),a.sequence){const o=Us(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<s.length);return r}}}var Ks={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 Vs(n=Ks){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 s;function r(){if(s)return s;s=[];for(let l=0;l<L.length;l++)s.push(e(L[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++)s.push(t([c[l],c[u],c[h]]));let o=8;for(let l=0;l<24;l++,o+=10)s.push(t([o,o,o]));return s}function i(c){return r()[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 Js(n,e,t){const s=ie(n,t),r=he(e),i=Vs(Object.fromEntries(L.map(c=>[c,n.colors?.[`terminal.ansi${c[0].toUpperCase()}${c.substring(1)}`]]))),a=Hs();return r.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=E(l,s),u=E(u,s),o.decorations.has("dim")&&(l=Ys(l));let h=N.None;return o.decorations.has("bold")&&(h|=N.Bold),o.decorations.has("italic")&&(h|=N.Italic),o.decorations.has("underline")&&(h|=N.Underline),o.decorations.has("strikethrough")&&(h|=N.Strikethrough),{content:o.value,offset:c[1],color:l,bgColor:u,fontStyle:h}}))}function Ys(n){const e=n.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(e)if(e[3]){const s=Math.round(Number.parseInt(e[3],16)/2).toString(16).padStart(2,"0");return`#${e[1]}${e[2]}${s}`}else return e[2]?`#${e[1]}${e[2]}80`:`#${Array.from(e[1]).map(s=>`${s}${s}`).join("")}80`;const t=n.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return t?`var(${t[1]}-dim)`:n}function $e(n,e,t={}){const{lang:s="text",theme:r=n.getLoadedThemes()[0]}=t;if(Le(s)||Ge(r))return he(e).map(o=>[{content:o[0],offset:o[1]}]);const{theme:i,colorMap:a}=n.setTheme(r);if(s==="ansi")return Js(i,e,t);const c=n.getLanguage(s);if(t.grammarState){if(t.grammarState.lang!==c.name)throw new w(`Grammar state language "${t.grammarState.lang}" does not match highlight language "${c.name}"`);if(!t.grammarState.themes.includes(i.name))throw new w(`Grammar state themes "${t.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Xs(e,c,i,a,t)}function Qs(...n){if(n.length===2)return H(n[1]);const[e,t,s={}]=n,{lang:r="text",theme:i=e.getLoadedThemes()[0]}=s;if(Le(r)||Ge(i))throw new w("Plain language does not have grammar state");if(r==="ansi")throw new w("ANSI language does not have grammar state");const{theme:a,colorMap:c}=e.setTheme(i),o=e.getLanguage(r);return new j(ce(t,o,a,c,s).stateStack,o.name,a.name)}function Xs(n,e,t,s,r){const i=ce(n,e,t,s,r),a=new j(ce(n,e,t,s,r).stateStack,e.name,t.name);return fe(i.tokens,a),i.tokens}function ce(n,e,t,s,r){const i=ie(t,r),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:c=500}=r,o=he(n);let l=r.grammarState?js(r.grammarState,t.name)??Ae:r.grammarContextCode!=null?ce(r.grammarContextCode,e,t,s,{...r,grammarState:void 0,grammarContextCode:void 0}).stateStack:Ae,u=[];const h=[];for(let d=0,p=o.length;d<p;d++){const[f,b]=o[d];if(f===""){u=[],h.push([]);continue}if(a>0&&f.length>=a){u=[],h.push([{content:f,offset:b,color:"",fontStyle:0}]);continue}let _,g,m;r.includeExplanation&&(_=e.tokenizeLine(f,l,c),g=_.tokens,m=0);const y=e.tokenizeLine2(f,l,c),k=y.tokens.length/2;for(let S=0;S<k;S++){const T=y.tokens[2*S],x=S+1<k?y.tokens[2*S+2]:f.length;if(T===x)continue;const Be=y.tokens[2*S+1],Gt=E(s[M.getForeground(Be)],i),Ot=M.getFontStyle(Be),de={content:f.substring(T,x),offset:b+T,color:Gt,fontStyle:Ot};if(r.includeExplanation){const je=[];if(r.includeExplanation!=="scopeName")for(const I of t.settings){let G;switch(typeof I.scope){case"string":G=I.scope.split(/,/).map(pe=>pe.trim());break;case"object":G=I.scope;break;default:continue}je.push({settings:I,selectors:G.map(pe=>pe.split(/ /))})}de.explanation=[];let Fe=0;for(;T+Fe<x;){const I=g[m],G=f.substring(I.startIndex,I.endIndex);Fe+=G.length,de.explanation.push({content:G,scopes:r.includeExplanation==="scopeName"?Zs(I.scopes):er(je,I.scopes)}),m+=1}}u.push(de)}h.push(u),u=[],l=y.ruleStack}return{tokens:h,stateStack:l}}function Zs(n){return n.map(e=>({scopeName:e}))}function er(n,e){const t=[];for(let s=0,r=e.length;s<r;s++){const i=e[s];t[s]={scopeName:i,themeMatches:nr(n,i,e.slice(0,s))}}return t}function nt(n,e){return n===e||e.substring(0,n.length)===n&&e[n.length]==="."}function tr(n,e,t){if(!nt(n[n.length-1],e))return!1;let s=n.length-2,r=t.length-1;for(;s>=0&&r>=0;)nt(n[s],t[r])&&(s-=1),r-=1;return s===-1}function nr(n,e,t){const s=[];for(const{selectors:r,settings:i}of n)for(const a of r)if(tr(a,e,t)){s.push(i);break}return s}function xt(n,e,t){const s=Object.entries(t.themes).filter(o=>o[1]).map(o=>({color:o[0],theme:o[1]})),r=s.map(o=>{const l=$e(n,e,{...t,theme:o.theme}),u=H(l),h=typeof o.theme=="string"?o.theme:o.theme.name;return{tokens:l,state:u,theme:h}}),i=sr(...r.map(o=>o.tokens)),a=i[0].map((o,l)=>o.map((u,h)=>{const d={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in t&&t.includeExplanation&&(d.explanation=u.explanation),i.forEach((p,f)=>{const{content:b,explanation:_,offset:g,...m}=p[l][h];d.variants[s[f].color]=m}),d})),c=r[0].state?new j(Object.fromEntries(r.map(o=>[o.theme,o.state?.getInternalStack(o.theme)])),r[0].state.lang):void 0;return c&&fe(a,c),a}function sr(...n){const e=n.map(()=>[]),t=n.length;for(let s=0;s<n[0].length;s++){const r=n.map(o=>o[s]),i=e.map(()=>[]);e.forEach((o,l)=>o.push(i[l]));const a=r.map(()=>0),c=r.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]=r[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 le(n,e,t){let s,r,i,a,c,o;if("themes"in t){const{defaultColor:l="light",cssVariablePrefix:u="--shiki-",colorsRendering:h="css-vars"}=t,d=Object.entries(t.themes).filter(g=>g[1]).map(g=>({color:g[0],theme:g[1]})).sort((g,m)=>g.color===l?-1:m.color===l?1:0);if(d.length===0)throw new w("`themes` option must not be empty");const p=xt(n,e,t);if(o=H(p),l&&Oe!==l&&!d.find(g=>g.color===l))throw new w(`\`themes\` option must contain the defaultColor key \`${l}\``);const f=d.map(g=>n.getTheme(g.theme)),b=d.map(g=>g.color);i=p.map(g=>g.map(m=>Ms(m,b,u,l,h))),o&&fe(i,o);const _=d.map(g=>ie(g.theme,t));r=st(d,f,_,u,l,"fg",h),s=st(d,f,_,u,l,"bg",h),a=`shiki-themes ${f.map(g=>g.name).join(" ")}`,c=l?void 0:[r,s].join(";")}else if("theme"in t){const l=ie(t.theme,t);i=$e(n,e,t);const u=n.getTheme(t.theme);s=E(u.bg,l),r=E(u.fg,l),a=u.name,o=H(i)}else throw new w("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:r,bg:s,themeName:a,rootStyle:c,grammarState:o}}function st(n,e,t,s,r,i,a){return n.map((c,o)=>{const l=E(e[o][i],t[o])||"inherit",u=`${s+c.color}${i==="bg"?"-bg":""}:${l}`;if(o===0&&r){if(r===Oe&&n.length>1){const h=n.findIndex(b=>b.color==="light"),d=n.findIndex(b=>b.color==="dark");if(h===-1||d===-1)throw new w('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const p=E(e[h][i],t[h])||"inherit",f=E(e[d][i],t[d])||"inherit";return`light-dark(${p}, ${f});${u}`}return l}return a==="css-vars"?u:null}).filter(c=>!!c).join(";")}function ue(n,e,t,s={meta:{},options:t,codeToHast:(r,i)=>ue(n,r,i),codeToTokens:(r,i)=>le(n,r,i)}){let r=e;for(const f of ae(t))r=f.preprocess?.call(s,r,t)||r;let{tokens:i,fg:a,bg:c,themeName:o,rootStyle:l,grammarState:u}=le(n,r,t);const{mergeWhitespaces:h=!0,mergeSameStyleTokens:d=!1}=t;h===!0?i=ir(i):h==="never"&&(i=or(i)),d&&(i=ar(i));const p={...s,get source(){return r}};for(const f of ae(t))i=f.tokens?.call(p,i)||i;return rr(i,{...t,fg:a,bg:c,themeName:o,rootStyle:l},p,u)}function rr(n,e,t,s=H(n)){const r=ae(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(([f])=>!f.startsWith("_")))},children:[]},u={type:"element",tagName:"code",properties:{},children:i};const h=[],d={...t,structure:c,addClassToHast:It,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((f,b)=>{b&&(c==="inline"?a.children.push({type:"element",tagName:"br",properties:{},children:[]}):c==="classic"&&i.push({type:"text",value:`
12
12
  `}));let _={type:"element",tagName:"span",properties:{class:"line"},children:[]},g=0;for(const m of f){let y={type:"element",tagName:"span",properties:{...m.htmlAttrs},children:[{type:"text",value:m.content}]};const k=Te(m.htmlStyle||oe(m));k&&(y.properties.style=k);for(const S of r)y=S?.span?.call(d,y,b+1,g,_,m)||y;c==="inline"?a.children.push(y):c==="classic"&&_.children.push(y),g+=m.content.length}if(c==="classic"){for(const m of r)_=m?.line?.call(d,_,b+1)||_;h.push(_),i.push(_)}}),c==="classic"){for(const f of r)u=f?.code?.call(d,u)||u;l.children.push(u);for(const f of r)l=f?.pre?.call(d,l)||l;a.children.push(l)}let p=a;for(const f of r)p=f?.root?.call(d,p)||p;return s&&fe(p,s),p}function ir(n){return n.map(e=>{const t=[];let s="",r=0;return e.forEach((i,a)=>{const o=!(i.fontStyle&&(i.fontStyle&N.Underline||i.fontStyle&N.Strikethrough));o&&i.content.match(/^\s+$/)&&e[a+1]?(r||(r=i.offset),s+=i.content):s?(o?t.push({...i,offset:r,content:s+i.content}):t.push({content:s,offset:r},i),r=0,s=""):t.push(i)}),t})}function or(n){return n.map(e=>e.flatMap(t=>{if(t.content.match(/^\s+$/))return t;const s=t.content.match(/^(\s*)(.*?)(\s*)$/);if(!s)return t;const[,r,i,a]=s;if(!r&&!a)return t;const c=[{...t,offset:t.offset+r.length,content:i}];return r&&c.unshift({content:r,offset:t.offset}),a&&c.push({content:a,offset:t.offset+r.length+i.length}),c}))}function ar(n){return n.map(e=>{const t=[];for(const s of e){if(t.length===0){t.push({...s});continue}const r=t[t.length-1],i=Te(r.htmlStyle||oe(r)),a=Te(s.htmlStyle||oe(s)),c=r.fontStyle&&(r.fontStyle&N.Underline||r.fontStyle&N.Strikethrough),o=s.fontStyle&&(s.fontStyle&N.Underline||s.fontStyle&N.Strikethrough);!c&&!o&&i===a?r.content+=s.content:t.push({...s})}return t})}const cr=As;function lr(n,e,t){const s={meta:{},options:t,codeToHast:(i,a)=>ue(n,i,a),codeToTokens:(i,a)=>le(n,i,a)};let r=cr(ue(n,e,t,s));for(const i of ae(t))r=i.postprocess?.call(s,r,t)||r;return r}const rt={light:"#333333",dark:"#bbbbbb"},it={light:"#fffffe",dark:"#1e1e1e"},ot="__shiki_resolved";function Me(n){if(n?.[ot])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:s}=e;if(!t||!s){const c=e.settings?e.settings.find(o=>!o.name&&!o.scope):void 0;c?.settings?.foreground&&(s=c.settings.foreground),c?.settings?.background&&(t=c.settings.background),!s&&e?.colors?.["editor.foreground"]&&(s=e.colors["editor.foreground"]),!t&&e?.colors?.["editor.background"]&&(t=e.colors["editor.background"]),s||(s=e.type==="light"?rt.light:rt.dark),t||(t=e.type==="light"?it.light:it.dark),e.fg=s,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 r=0;const i=new Map;function a(c){if(i.has(c))return i.get(c);r+=1;const o=`#${r.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,ot,{enumerable:!1,writable:!1,value:!0}),e}async function Pt(n){return Array.from(new Set((await Promise.all(n.filter(e=>!xs(e)).map(async e=>await At(e).then(t=>Array.isArray(t)?t:[t])))).flat()))}async function Lt(n){return(await Promise.all(n.map(async t=>Ps(t)?null:Me(await At(t))))).filter(t=>!!t)}let ur=3;function hr(n,e=3){e>ur||console.trace(`[SHIKI DEPRECATE]: ${n}`)}class O extends Error{constructor(e){super(e),this.name="ShikiError"}}class fr extends wn{constructor(e,t,s,r={}){super(e),this._resolver=e,this._themes=t,this._langs=s,this._alias=r,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=Me(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=ee.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 O(`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 s={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const r=this.loadGrammarWithConfiguration(e.scopeName,1,s);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),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 r of e)this.resolveEmbeddedLanguages(r);const t=Array.from(this._langGraph.entries()),s=t.filter(([r,i])=>!i);if(s.length){const r=t.filter(([i,a])=>a&&a.embeddedLangs?.some(c=>s.map(([o])=>o).includes(c))).filter(i=>!s.includes(i));throw new O(`Missing languages ${s.map(([i])=>`\`${i}\``).join(", ")}, required by ${r.map(([i])=>`\`${i}\``).join(", ")}`)}for(const[r,i]of t)this._resolver.addLanguage(i);for(const[r,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 dr{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:s=>e.createScanner(s),createOnigString:s=>e.createString(s)},t.forEach(s=>this.addLanguage(s))}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 s=[];for(let r=1;r<=t.length;r++){const i=t.slice(0,r).join(".");s=[...s,...this._injections.get(i)||[]]}return s}}let F=0;function pr(n){F+=1,n.warnings!==!1&&F>=10&&F%10===0&&console.warn(`[Shiki] ${F} 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 O("`engine` option is required for synchronous mode");const t=(n.langs||[]).flat(1),s=(n.themes||[]).flat(1).map(Me),r=new dr(n.engine,t),i=new fr(r,s,t,n.langAlias);let a;function c(m){_();const y=i.getGrammar(typeof m=="string"?m:m.name);if(!y)throw new O(`Language \`${m}\` not found, you may need to load it first`);return y}function o(m){if(m==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};_();const y=i.getTheme(m);if(!y)throw new O(`Theme \`${m}\` not found, you may need to load it first`);return y}function l(m){_();const y=o(m);a!==m&&(i.setTheme(y),a=m);const k=i.getColorMap();return{theme:y,colorMap:k}}function u(){return _(),i.getLoadedThemes()}function h(){return _(),i.getLoadedLanguages()}function d(...m){_(),i.loadLanguages(m.flat(1))}async function p(...m){return d(await Pt(m))}function f(...m){_();for(const y of m.flat(1))i.loadTheme(y)}async function b(...m){return _(),f(await Lt(m))}function _(){if(e)throw new O("Shiki instance has been disposed")}function g(){e||(e=!0,i.dispose(),F-=1)}return{setTheme:l,getTheme:o,getLanguage:c,getLoadedThemes:u,getLoadedLanguages:h,loadLanguage:p,loadLanguageSync:d,loadTheme:b,loadThemeSync:f,dispose:g,[Symbol.dispose]:g}}async function mr(n){n.engine||hr("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[e,t,s]=await Promise.all([Lt(n.themes||[]),Pt(n.langs||[]),n.engine]);return pr({...n,themes:e,langs:t,engine:s})}async function gr(n){const e=await mr(n);return{getLastGrammarState:(...t)=>Qs(e,...t),codeToTokensBase:(t,s)=>$e(e,t,s),codeToTokensWithThemes:(t,s)=>xt(e,t,s),codeToTokens:(t,s)=>le(e,t,s),codeToHast:(t,s)=>ue(e,t,s),codeToHtml:(t,s)=>lr(e,t,s),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...e,getInternalContext:()=>e}}exports.createJavaScriptRegexEngine=B.createJavaScriptRegexEngine;exports.githubDark=B.GithubDark;exports.githubLight=B.GithubLight;exports.javascript=B.javascript;exports.python=B.python;exports.yaml=B.yaml;exports.createHighlighterCore=gr;
13
- //# sourceMappingURL=shikiToolset-BixFI44v.cjs.map
13
+ //# sourceMappingURL=shikiToolset-JFZHkI0W.cjs.map