@mastra/deployer-cloud 1.75.0-alpha.1 → 1.75.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/studio/assets/{CodeDiff.es-C1lxLuQQ.js → CodeDiff.es-D8Uyq6L8.js} +1 -1
- package/dist/studio/assets/{core-Bvf9yuUJ.js → core-BaXpB0wl.js} +1 -1
- package/dist/studio/assets/{index-C7s_9QxU.js → index-BxLHpcVV.js} +1 -1
- package/dist/studio/assets/{index-bGwSIf5t.js → index-Dwv69KI2.js} +2 -2
- package/dist/studio/assets/{main-kkw9cfno.js → main-C7bJF57-.js} +249 -249
- package/dist/studio/assets/style-CctdyGvP.css +1 -0
- package/dist/studio/index.html +2 -2
- package/package.json +4 -4
- package/versions.json +1 -1
- package/dist/studio/assets/style-BOhakmO5.css +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as Ue,F as O,I as ee,R as je,T as Me,E as ue}from"./index-C7s_9QxU.js";import{c as Pe,d as He}from"./engine-compile-CUTZfOIo.js";import"./main-kkw9cfno.js";import"./preload-helper-PPVm8Dsz.js";import"./index-2BQyy0xI.js";let E=class extends Error{constructor(e){super(e),this.name="ShikiError"}},te=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function We(){return 2147483648}function Re(){return typeof performance<"u"?performance.now():Date.now()}const Ge=(n,e)=>n+(e-n%e)%e;async function Fe(n){let e,t;const r={};function s(h){t=h,r.HEAPU8=new Uint8Array(h),r.HEAPU32=new Uint32Array(h)}function o(h,g,S){r.HEAPU8.copyWithin(h,g,g+S)}function a(h){try{return e.grow(h-t.byteLength+65535>>>16),s(e.buffer),1}catch{}}function i(h){const g=r.HEAPU8.length;h=h>>>0;const S=We();if(h>S)return!1;for(let m=1;m<=4;m*=2){let b=g*(1+.2/m);b=Math.min(b,h+100663296);const p=Math.min(S,Ge(Math.max(h,b),65536));if(a(p))return!0}return!1}const c=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function l(h,g,S=1024){const m=g+S;let b=g;for(;h[b]&&!(b>=m);)++b;if(b-g>16&&h.buffer&&c)return c.decode(h.subarray(g,b));let p="";for(;g<b;){let y=h[g++];if(!(y&128)){p+=String.fromCharCode(y);continue}const _=h[g++]&63;if((y&224)===192){p+=String.fromCharCode((y&31)<<6|_);continue}const L=h[g++]&63;if((y&240)===224?y=(y&15)<<12|_<<6|L:y=(y&7)<<18|_<<12|L<<6|h[g++]&63,y<65536)p+=String.fromCharCode(y);else{const N=y-65536;p+=String.fromCharCode(55296|N>>10,56320|N&1023)}}return p}function f(h,g){return h?l(r.HEAPU8,h,g):""}const u={emscripten_get_now:Re,emscripten_memcpy_big:o,emscripten_resize_heap:i,fd_write:()=>0};async function d(){const g=await n({env:u,wasi_snapshot_preview1:u});e=g.memory,s(e.buffer),Object.assign(r,g),r.UTF8ToString=f}return await d(),r}var De=Object.defineProperty,Ve=(n,e,t)=>e in n?De(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,w=(n,e,t)=>(Ve(n,typeof e!="symbol"?e+"":e,t),t);let k=null;function ze(n){throw new te(n.UTF8ToString(n.getLastOnigError()))}class V{constructor(e){w(this,"utf16Length"),w(this,"utf8Length"),w(this,"utf16Value"),w(this,"utf8Value"),w(this,"utf16OffsetToUtf8"),w(this,"utf8OffsetToUtf16");const t=e.length,r=V._utf8ByteLength(e),s=r!==t,o=s?new Uint32Array(t+1):null;s&&(o[t]=r);const a=s?new Uint32Array(r+1):null;s&&(a[r]=t);const i=new Uint8Array(r);let c=0;for(let l=0;l<t;l++){const f=e.charCodeAt(l);let u=f,d=!1;if(f>=55296&&f<=56319&&l+1<t){const h=e.charCodeAt(l+1);h>=56320&&h<=57343&&(u=(f-55296<<10)+65536|h-56320,d=!0)}s&&(o[l]=c,d&&(o[l+1]=c),u<=127?a[c+0]=l:u<=2047?(a[c+0]=l,a[c+1]=l):u<=65535?(a[c+0]=l,a[c+1]=l,a[c+2]=l):(a[c+0]=l,a[c+1]=l,a[c+2]=l,a[c+3]=l)),u<=127?i[c++]=u:u<=2047?(i[c++]=192|(u&1984)>>>6,i[c++]=128|(u&63)>>>0):u<=65535?(i[c++]=224|(u&61440)>>>12,i[c++]=128|(u&4032)>>>6,i[c++]=128|(u&63)>>>0):(i[c++]=240|(u&1835008)>>>18,i[c++]=128|(u&258048)>>>12,i[c++]=128|(u&4032)>>>6,i[c++]=128|(u&63)>>>0),d&&l++}this.utf16Length=t,this.utf8Length=r,this.utf16Value=e,this.utf8Value=i,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=a}static _utf8ByteLength(e){let t=0;for(let r=0,s=e.length;r<s;r++){const o=e.charCodeAt(r);let a=o,i=!1;if(o>=55296&&o<=56319&&r+1<s){const c=e.charCodeAt(r+1);c>=56320&&c<=57343&&(a=(o-55296<<10)+65536|c-56320,i=!0)}a<=127?t+=1:a<=2047?t+=2:a<=65535?t+=3:t+=4,i&&r++}return t}createString(e){const t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}}const C=class{constructor(n){if(w(this,"id",++C.LAST_ID),w(this,"_onigBinding"),w(this,"content"),w(this,"utf16Length"),w(this,"utf8Length"),w(this,"utf16OffsetToUtf8"),w(this,"utf8OffsetToUtf16"),w(this,"ptr"),!k)throw new te("Must invoke loadWasm first.");this._onigBinding=k,this.content=n;const e=new V(n);this.utf16Length=e.utf16Length,this.utf8Length=e.utf8Length,this.utf16OffsetToUtf8=e.utf16OffsetToUtf8,this.utf8OffsetToUtf16=e.utf8OffsetToUtf16,this.utf8Length<1e4&&!C._sharedPtrInUse?(C._sharedPtr||(C._sharedPtr=k.omalloc(1e4)),C._sharedPtrInUse=!0,k.HEAPU8.set(e.utf8Value,C._sharedPtr),this.ptr=C._sharedPtr):this.ptr=e.createString(k)}convertUtf8OffsetToUtf16(n){return this.utf8OffsetToUtf16?n<0?0:n>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[n]:n}convertUtf16OffsetToUtf8(n){return this.utf16OffsetToUtf8?n<0?0:n>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[n]:n}dispose(){this.ptr===C._sharedPtr?C._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let H=C;w(H,"LAST_ID",0);w(H,"_sharedPtr",0);w(H,"_sharedPtrInUse",!1);class Je{constructor(e){if(w(this,"_onigBinding"),w(this,"_ptr"),!k)throw new te("Must invoke loadWasm first.");const t=[],r=[];for(let i=0,c=e.length;i<c;i++){const l=new V(e[i]);t[i]=l.createString(k),r[i]=l.utf8Length}const s=k.omalloc(4*e.length);k.HEAPU32.set(t,s/4);const o=k.omalloc(4*e.length);k.HEAPU32.set(r,o/4);const a=k.createOnigScanner(s,o,e.length);for(let i=0,c=e.length;i<c;i++)k.ofree(t[i]);k.ofree(o),k.ofree(s),a===0&&ze(k),this._onigBinding=k,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,r){let s=0;if(typeof r=="number"&&(s=r),typeof e=="string"){e=new H(e);const o=this._findNextMatchSync(e,t,!1,s);return e.dispose(),o}return this._findNextMatchSync(e,t,!1,s)}_findNextMatchSync(e,t,r,s){const o=this._onigBinding,a=o.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),s);if(a===0)return null;const i=o.HEAPU32;let c=a/4;const l=i[c++],f=i[c++],u=[];for(let d=0;d<f;d++){const h=e.convertUtf8OffsetToUtf16(i[c++]),g=e.convertUtf8OffsetToUtf16(i[c++]);u[d]={start:h,end:g,length:g-h}}return{index:l,captureIndices:u}}}function Ye(n){return typeof n.instantiator=="function"}function Ke(n){return typeof n.default=="function"}function qe(n){return typeof n.data<"u"}function Qe(n){return typeof Response<"u"&&n instanceof Response}function Xe(n){return typeof ArrayBuffer<"u"&&(n instanceof ArrayBuffer||ArrayBuffer.isView(n))||typeof Buffer<"u"&&Buffer.isBuffer?.(n)||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&n instanceof Uint32Array}let W;function be(n){if(W)return W;async function e(){k=await Fe(async t=>{let r=n;return r=await r,typeof r=="function"&&(r=await r(t)),typeof r=="function"&&(r=await r(t)),Ye(r)?r=await r.instantiator(t):Ke(r)?r=await r.default(t):(qe(r)&&(r=r.data),Qe(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await Ze(r)(t):r=await et(r)(t):Xe(r)?r=await X(r)(t):r instanceof WebAssembly.Module?r=await X(r)(t):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await X(r.default)(t))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return W=e(),W}function X(n){return e=>WebAssembly.instantiate(n,e)}function Ze(n){return e=>WebAssembly.instantiateStreaming(n,e)}function et(n){return async e=>{const t=await n.arrayBuffer();return WebAssembly.instantiate(t,e)}}let tt;function nt(){return tt}async function ne(n){return n&&await be(n),{createScanner(e){return new Je(e.map(t=>typeof t=="string"?t:t.source))},createString(e){return new H(e)}}}let R=!1,Se=!1;function Rt(n=!0,e=!1){R=n,Se=e}function v(n,e=3){if(R&&!(typeof R=="number"&&e>R)){if(Se)throw new Error(`[SHIKI DEPRECATE]: ${n}`);console.trace(`[SHIKI DEPRECATE]: ${n}`)}}function rt(n){return v("import `createOnigurumaEngine` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead"),ne(n)}function Gt(n){return v("import `createOnigurumaEngine` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead"),ne(n)}function Ft(n){return v("import `loadWasm` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead"),be(n)}function st(n){return Array.isArray(n)?n:[n]}function z(n,e=!1){const t=n.split(/(\r?\n)/g);let r=0;const s=[];for(let o=0;o<t.length;o+=2){const a=e?t[o]+(t[o+1]||""):t[o];s.push([a,r]),r+=t[o].length,r+=t[o+1]?.length||0}return s}function re(n){return!n||["plaintext","txt","text","plain"].includes(n)}function we(n){return n==="ansi"||re(n)}function se(n){return n==="none"}function ke(n){return se(n)}function Te(n,e){if(!e)return n;n.properties||={},n.properties.class||=[],typeof n.properties.class=="string"&&(n.properties.class=n.properties.class.split(/\s+/g)),Array.isArray(n.properties.class)||(n.properties.class=[]);const t=Array.isArray(e)?e:e.split(/\s+/g);for(const r of t)r&&!n.properties.class.includes(r)&&n.properties.class.push(r);return n}function ot(n,e){let t=0;const r=[];for(const s of e)s>t&&r.push({...n,content:n.content.slice(t,s),offset:n.offset+t}),t=s;return t<n.content.length&&r.push({...n,content:n.content.slice(t),offset:n.offset+t}),r}function it(n,e){const t=Array.from(e instanceof Set?e:new Set(e)).sort((r,s)=>r-s);return t.length?n.map(r=>r.flatMap(s=>{const o=t.filter(a=>s.offset<a&&a<s.offset+s.content.length).map(a=>a-s.offset).sort((a,i)=>a-i);return o.length?ot(s,o):s})):n}async function _e(n){return Promise.resolve(typeof n=="function"?n():n).then(e=>e.default||e)}function G(n,e){const t=typeof n=="string"?{}:{...n.colorReplacements},r=typeof n=="string"?n:n.name;for(const[s,o]of Object.entries(e?.colorReplacements||{}))typeof o=="string"?t[s]=o:s===r&&Object.assign(t,o);return t}function I(n,e){return n&&(e?.[n?.toLowerCase()]||n)}function Le(n){const e={};return n.color&&(e.color=n.color),n.bgColor&&(e["background-color"]=n.bgColor),n.fontStyle&&(n.fontStyle&O.Italic&&(e["font-style"]="italic"),n.fontStyle&O.Bold&&(e["font-weight"]="bold"),n.fontStyle&O.Underline&&(e["text-decoration"]="underline")),e}function at(n){return typeof n=="string"?n:Object.entries(n).map(([e,t])=>`${e}:${t}`).join(";")}function ct(n){const e=z(n,!0).map(([s])=>s);function t(s){if(s===n.length)return{line:e.length-1,character:e[e.length-1].length};let o=s,a=0;for(const i of e){if(o<i.length)break;o-=i.length,a++}return{line:a,character:o}}function r(s,o){let a=0;for(let i=0;i<s;i++)a+=e[i].length;return a+=o,a}return{lines:e,indexToPos:t,posToIndex:r}}class T extends Error{constructor(e){super(e),this.name="ShikiError"}}const ve=new WeakMap;function J(n,e){ve.set(n,e)}function j(n){return ve.get(n)}class B{_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 B(Object.fromEntries(st(t).map(r=>[r,ee])),e)}constructor(...e){if(e.length===2){const[t,r]=e;this.lang=r,this._stacks=t}else{const[t,r,s]=e;this.lang=r,this._stacks={[s]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}get scopes(){return v("GrammarState.scopes is deprecated, use GrammarState.getScopes() instead"),he(this._stacks[this.theme])}getScopes(e=this.theme){return he(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function he(n){const e=[],t=new Set;function r(s){if(t.has(s))return;t.add(s);const o=s?.nameScopesList?.scopeName;o&&e.push(o),s.parent&&r(s.parent)}return r(n),e}function lt(n,e){if(!(n instanceof B))throw new T("Invalid grammar state");return n.getInternalStack(e)}function ft(){const n=new WeakMap;function e(t){if(!n.has(t.meta)){let r=function(a){if(typeof a=="number"){if(a<0||a>t.source.length)throw new T(`Invalid decoration offset: ${a}. Code length: ${t.source.length}`);return{...s.indexToPos(a),offset:a}}else{const i=s.lines[a.line];if(i===void 0)throw new T(`Invalid decoration position ${JSON.stringify(a)}. Lines length: ${s.lines.length}`);if(a.character<0||a.character>i.length)throw new T(`Invalid decoration position ${JSON.stringify(a)}. Line ${a.line} length: ${i.length}`);return{...a,offset:s.posToIndex(a.line,a.character)}}};const s=ct(t.source),o=(t.options.decorations||[]).map(a=>({...a,start:r(a.start),end:r(a.end)}));ut(o),n.set(t.meta,{decorations:o,converter:s,source:t.source})}return n.get(t.meta)}return{name:"shiki:decorations",tokens(t){if(!this.options.decorations?.length)return;const s=e(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]);return it(t,s)},code(t){if(!this.options.decorations?.length)return;const r=e(this),s=Array.from(t.children).filter(f=>f.type==="element"&&f.tagName==="span");if(s.length!==r.converter.lines.length)throw new T(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function o(f,u,d,h){const g=s[f];let S="",m=-1,b=-1;if(u===0&&(m=0),d===0&&(b=0),d===Number.POSITIVE_INFINITY&&(b=g.children.length),m===-1||b===-1)for(let y=0;y<g.children.length;y++)S+=Ce(g.children[y]),m===-1&&S.length===u&&(m=y+1),b===-1&&S.length===d&&(b=y+1);if(m===-1)throw new T(`Failed to find start index for decoration ${JSON.stringify(h.start)}`);if(b===-1)throw new T(`Failed to find end index for decoration ${JSON.stringify(h.end)}`);const p=g.children.slice(m,b);if(!h.alwaysWrap&&p.length===g.children.length)i(g,h,"line");else if(!h.alwaysWrap&&p.length===1&&p[0].type==="element")i(p[0],h,"token");else{const y={type:"element",tagName:"span",properties:{},children:p};i(y,h,"wrapper"),g.children.splice(m,p.length,y)}}function a(f,u){s[f]=i(s[f],u,"line")}function i(f,u,d){const h=u.properties||{},g=u.transform||(S=>S);return f.tagName=u.tagName||"span",f.properties={...f.properties,...h,class:f.properties.class},u.properties?.class&&Te(f,u.properties.class),f=g(f,d)||f,f}const c=[],l=r.decorations.sort((f,u)=>u.start.offset-f.start.offset);for(const f of l){const{start:u,end:d}=f;if(u.line===d.line)o(u.line,u.character,d.character,f);else if(u.line<d.line){o(u.line,u.character,Number.POSITIVE_INFINITY,f);for(let h=u.line+1;h<d.line;h++)c.unshift(()=>a(h,f));o(d.line,0,d.character,f)}}c.forEach(f=>f())}}}function ut(n){for(let e=0;e<n.length;e++){const t=n[e];if(t.start.offset>t.end.offset)throw new T(`Invalid decoration range: ${JSON.stringify(t.start)} - ${JSON.stringify(t.end)}`);for(let r=e+1;r<n.length;r++){const s=n[r],o=t.start.offset<s.start.offset&&s.start.offset<t.end.offset,a=t.start.offset<s.end.offset&&s.end.offset<t.end.offset,i=s.start.offset<t.start.offset&&t.start.offset<s.end.offset,c=s.start.offset<t.end.offset&&t.end.offset<s.end.offset;if(o||a||i||c){if(a&&a||i&&c)continue;throw new T(`Decorations ${JSON.stringify(t.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function Ce(n){return n.type==="text"?n.value:n.type==="element"?n.children.map(Ce).join(""):""}const ht=[ft()];function F(n){return[...n.transformers||[],...ht]}var $=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Z={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function gt(n,e){const t=n.indexOf("\x1B[",e);if(t!==-1){const r=n.indexOf("m",t);return{sequence:n.substring(t+2,r).split(";"),startPosition:t,position:r+1}}return{position:n.length}}function ge(n,e){let t=1;const r=n[e+t++];let s;if(r==="2"){const o=[n[e+t++],n[e+t++],n[e+t]].map(a=>Number.parseInt(a));o.length===3&&!o.some(a=>Number.isNaN(a))&&(s={type:"rgb",rgb:o})}else if(r==="5"){const o=Number.parseInt(n[e+t]);Number.isNaN(o)||(s={type:"table",index:Number(o)})}return[t,s]}function mt(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t],s=Number.parseInt(r);if(!Number.isNaN(s))if(s===0)e.push({type:"resetAll"});else if(s<=9)Z[s]&&e.push({type:"setDecoration",value:Z[s]});else if(s<=29){const o=Z[s-20];o&&e.push({type:"resetDecoration",value:o})}else if(s<=37)e.push({type:"setForegroundColor",value:{type:"named",name:$[s-30]}});else if(s===38){const[o,a]=ge(n,t);a&&e.push({type:"setForegroundColor",value:a}),t+=o}else if(s===39)e.push({type:"resetForegroundColor"});else if(s<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:$[s-40]}});else if(s===48){const[o,a]=ge(n,t);a&&e.push({type:"setBackgroundColor",value:a}),t+=o}else s===49?e.push({type:"resetBackgroundColor"}):s>=90&&s<=97?e.push({type:"setForegroundColor",value:{type:"named",name:$[s-90+8]}}):s>=100&&s<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:$[s-100+8]}})}return e}function dt(){let n=null,e=null,t=new Set;return{parse(r){const s=[];let o=0;do{const a=gt(r,o),i=a.sequence?r.substring(o,a.startPosition):r.substring(o);if(i.length>0&&s.push({value:i,foreground:n,background:e,decorations:new Set(t)}),a.sequence){const c=mt(a.sequence);for(const l of c)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 c)l.type==="setForegroundColor"?n=l.value:l.type==="setBackgroundColor"?e=l.value:l.type==="setDecoration"&&t.add(l.value)}o=a.position}while(o<r.length);return s}}}var pt={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 yt(n=pt){function e(i){return n[i]}function t(i){return`#${i.map(c=>Math.max(0,Math.min(c,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let l=0;l<$.length;l++)r.push(e($[l]));let i=[0,95,135,175,215,255];for(let l=0;l<6;l++)for(let f=0;f<6;f++)for(let u=0;u<6;u++)r.push(t([i[l],i[f],i[u]]));let c=8;for(let l=0;l<24;l++,c+=10)r.push(t([c,c,c]));return r}function o(i){return s()[i]}function a(i){switch(i.type){case"named":return e(i.name);case"rgb":return t(i.rgb);case"table":return o(i.index)}}return{value:a}}function bt(n,e,t){const r=G(n,t),s=z(e),o=yt(Object.fromEntries($.map(i=>[i,n.colors?.[`terminal.ansi${i[0].toUpperCase()}${i.substring(1)}`]]))),a=dt();return s.map(i=>a.parse(i[0]).map(c=>{let l,f;c.decorations.has("reverse")?(l=c.background?o.value(c.background):n.bg,f=c.foreground?o.value(c.foreground):n.fg):(l=c.foreground?o.value(c.foreground):n.fg,f=c.background?o.value(c.background):void 0),l=I(l,r),f=I(f,r),c.decorations.has("dim")&&(l=St(l));let u=O.None;return c.decorations.has("bold")&&(u|=O.Bold),c.decorations.has("italic")&&(u|=O.Italic),c.decorations.has("underline")&&(u|=O.Underline),{content:c.value,offset:i[1],color:l,bgColor:f,fontStyle:u}}))}function St(n){const e=n.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(e)if(e[3]){const r=Math.round(Number.parseInt(e[3],16)/2).toString(16).padStart(2,"0");return`#${e[1]}${e[2]}${r}`}else return e[2]?`#${e[1]}${e[2]}80`:`#${Array.from(e[1]).map(r=>`${r}${r}`).join("")}80`;const t=n.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return t?`var(${t[1]}-dim)`:n}function Y(n,e,t={}){const{lang:r="text",theme:s=n.getLoadedThemes()[0]}=t;if(re(r)||se(s))return z(e).map(c=>[{content:c[0],offset:c[1]}]);const{theme:o,colorMap:a}=n.setTheme(s);if(r==="ansi")return bt(o,e,t);const i=n.getLanguage(r);if(t.grammarState){if(t.grammarState.lang!==i.name)throw new E(`Grammar state language "${t.grammarState.lang}" does not match highlight language "${i.name}"`);if(!t.grammarState.themes.includes(o.name))throw new E(`Grammar state themes "${t.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return wt(e,i,o,a,t)}function xe(...n){if(n.length===2)return j(n[1]);const[e,t,r={}]=n,{lang:s="text",theme:o=e.getLoadedThemes()[0]}=r;if(re(s)||se(o))throw new E("Plain language does not have grammar state");if(s==="ansi")throw new E("ANSI language does not have grammar state");const{theme:a,colorMap:i}=e.setTheme(o),c=e.getLanguage(s);return new B(D(t,c,a,i,r).stateStack,c.name,a.name)}function wt(n,e,t,r,s){const o=D(n,e,t,r,s),a=new B(D(n,e,t,r,s).stateStack,e.name,t.name);return J(o.tokens,a),o.tokens}function D(n,e,t,r,s){const o=G(t,s),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:i=500}=s,c=z(n);let l=s.grammarState?lt(s.grammarState,t.name)??ee:s.grammarContextCode!=null?D(s.grammarContextCode,e,t,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:ee,f=[];const u=[];for(let d=0,h=c.length;d<h;d++){const[g,S]=c[d];if(g===""){f=[],u.push([]);continue}if(a>0&&g.length>=a){f=[],u.push([{content:g,offset:S,color:"",fontStyle:0}]);continue}let m,b,p;s.includeExplanation&&(m=e.tokenizeLine(g,l),b=m.tokens,p=0);const y=e.tokenizeLine2(g,l,i),_=y.tokens.length/2;for(let L=0;L<_;L++){const N=y.tokens[2*L],K=L+1<_?y.tokens[2*L+2]:g.length;if(N===K)continue;const ce=y.tokens[2*L+1],Ae=I(r[ue.getForeground(ce)],o),Be=ue.getFontStyle(ce),q={content:g.substring(N,K),offset:S+N,color:Ae,fontStyle:Be};if(s.includeExplanation){const le=[];if(s.includeExplanation!=="scopeName")for(const x of t.settings){let A;switch(typeof x.scope){case"string":A=x.scope.split(/,/).map(Q=>Q.trim());break;case"object":A=x.scope;break;default:continue}le.push({settings:x,selectors:A.map(Q=>Q.split(/ /))})}q.explanation=[];let fe=0;for(;N+fe<K;){const x=b[p],A=g.substring(x.startIndex,x.endIndex);fe+=A.length,q.explanation.push({content:A,scopes:s.includeExplanation==="scopeName"?kt(x.scopes):Tt(le,x.scopes)}),p+=1}}f.push(q)}u.push(f),f=[],l=y.ruleStack}return{tokens:u,stateStack:l}}function kt(n){return n.map(e=>({scopeName:e}))}function Tt(n,e){const t=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];t[r]={scopeName:o,themeMatches:Lt(n,o,e.slice(0,r))}}return t}function me(n,e){return n===e||e.substring(0,n.length)===n&&e[n.length]==="."}function _t(n,e,t){if(!me(n[n.length-1],e))return!1;let r=n.length-2,s=t.length-1;for(;r>=0&&s>=0;)me(n[r],t[s])&&(r-=1),s-=1;return r===-1}function Lt(n,e,t){const r=[];for(const{selectors:s,settings:o}of n)for(const a of s)if(_t(a,e,t)){r.push(o);break}return r}function oe(n,e,t){const r=Object.entries(t.themes).filter(c=>c[1]).map(c=>({color:c[0],theme:c[1]})),s=r.map(c=>{const l=Y(n,e,{...t,theme:c.theme}),f=j(l),u=typeof c.theme=="string"?c.theme:c.theme.name;return{tokens:l,state:f,theme:u}}),o=vt(...s.map(c=>c.tokens)),a=o[0].map((c,l)=>c.map((f,u)=>{const d={content:f.content,variants:{},offset:f.offset};return"includeExplanation"in t&&t.includeExplanation&&(d.explanation=f.explanation),o.forEach((h,g)=>{const{content:S,explanation:m,offset:b,...p}=h[l][u];d.variants[r[g].color]=p}),d})),i=s[0].state?new B(Object.fromEntries(s.map(c=>[c.theme,c.state?.getInternalStack(c.theme)])),s[0].state.lang):void 0;return i&&J(a,i),a}function vt(...n){const e=n.map(()=>[]),t=n.length;for(let r=0;r<n[0].length;r++){const s=n.map(c=>c[r]),o=e.map(()=>[]);e.forEach((c,l)=>c.push(o[l]));const a=s.map(()=>0),i=s.map(c=>c[0]);for(;i.every(c=>c);){const c=Math.min(...i.map(l=>l.content.length));for(let l=0;l<t;l++){const f=i[l];f.content.length===c?(o[l].push(f),a[l]+=1,i[l]=s[l][a[l]]):(o[l].push({...f,content:f.content.slice(0,c)}),i[l]={...f,content:f.content.slice(c),offset:f.offset+c})}}}return e}function M(n,e,t){let r,s,o,a,i,c;if("themes"in t){const{defaultColor:l="light",cssVariablePrefix:f="--shiki-"}=t,u=Object.entries(t.themes).filter(m=>m[1]).map(m=>({color:m[0],theme:m[1]})).sort((m,b)=>m.color===l?-1:b.color===l?1:0);if(u.length===0)throw new E("`themes` option must not be empty");const d=oe(n,e,t);if(c=j(d),l&&!u.find(m=>m.color===l))throw new E(`\`themes\` option must contain the defaultColor key \`${l}\``);const h=u.map(m=>n.getTheme(m.theme)),g=u.map(m=>m.color);o=d.map(m=>m.map(b=>Ct(b,g,f,l))),c&&J(o,c);const S=u.map(m=>G(m.theme,t));s=u.map((m,b)=>(b===0&&l?"":`${f+m.color}:`)+(I(h[b].fg,S[b])||"inherit")).join(";"),r=u.map((m,b)=>(b===0&&l?"":`${f+m.color}-bg:`)+(I(h[b].bg,S[b])||"inherit")).join(";"),a=`shiki-themes ${h.map(m=>m.name).join(" ")}`,i=l?void 0:[s,r].join(";")}else if("theme"in t){const l=G(t.theme,t);o=Y(n,e,t);const f=n.getTheme(t.theme);r=I(f.bg,l),s=I(f.fg,l),a=f.name,c=j(o)}else throw new E("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:s,bg:r,themeName:a,rootStyle:i,grammarState:c}}function Ct(n,e,t,r){const s={content:n.content,explanation:n.explanation,offset:n.offset},o=e.map(c=>Le(n.variants[c])),a=new Set(o.flatMap(c=>Object.keys(c))),i={};return o.forEach((c,l)=>{for(const f of a){const u=c[f]||"inherit";if(l===0&&r)i[f]=u;else{const d=f==="color"?"":f==="background-color"?"-bg":`-${f}`,h=t+e[l]+(f==="color"?"":d);i[h]=u}}}),s.htmlStyle=i,s}function P(n,e,t,r={meta:{},options:t,codeToHast:(s,o)=>P(n,s,o),codeToTokens:(s,o)=>M(n,s,o)}){let s=e;for(const h of F(t))s=h.preprocess?.call(r,s,t)||s;let{tokens:o,fg:a,bg:i,themeName:c,rootStyle:l,grammarState:f}=M(n,s,t);const{mergeWhitespaces:u=!0}=t;u===!0?o=Et(o):u==="never"&&(o=Ot(o));const d={...r,get source(){return s}};for(const h of F(t))o=h.tokens?.call(d,o)||o;return xt(o,{...t,fg:a,bg:i,themeName:c,rootStyle:l},d,f)}function xt(n,e,t,r=j(n)){const s=F(e),o=[],a={type:"root",children:[]},{structure:i="classic",tabindex:c="0"}=e;let l={type:"element",tagName:"pre",properties:{class:`shiki ${e.themeName||""}`,style:e.rootStyle||`background-color:${e.bg};color:${e.fg}`,...c!==!1&&c!=null?{tabindex:c.toString()}:{},...Object.fromEntries(Array.from(Object.entries(e.meta||{})).filter(([g])=>!g.startsWith("_")))},children:[]},f={type:"element",tagName:"code",properties:{},children:o};const u=[],d={...t,structure:i,addClassToHast:Te,get source(){return t.source},get tokens(){return n},get options(){return e},get root(){return a},get pre(){return l},get code(){return f},get lines(){return u}};if(n.forEach((g,S)=>{S&&(i==="inline"?a.children.push({type:"element",tagName:"br",properties:{},children:[]}):i==="classic"&&o.push({type:"text",value:`
|
|
1
|
+
import{t as Ue,F as O,I as ee,R as je,T as Me,E as ue}from"./index-BxLHpcVV.js";import{c as Pe,d as He}from"./engine-compile-CUTZfOIo.js";import"./main-C7bJF57-.js";import"./preload-helper-PPVm8Dsz.js";import"./index-2BQyy0xI.js";let E=class extends Error{constructor(e){super(e),this.name="ShikiError"}},te=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function We(){return 2147483648}function Re(){return typeof performance<"u"?performance.now():Date.now()}const Ge=(n,e)=>n+(e-n%e)%e;async function Fe(n){let e,t;const r={};function s(h){t=h,r.HEAPU8=new Uint8Array(h),r.HEAPU32=new Uint32Array(h)}function o(h,g,S){r.HEAPU8.copyWithin(h,g,g+S)}function a(h){try{return e.grow(h-t.byteLength+65535>>>16),s(e.buffer),1}catch{}}function i(h){const g=r.HEAPU8.length;h=h>>>0;const S=We();if(h>S)return!1;for(let m=1;m<=4;m*=2){let b=g*(1+.2/m);b=Math.min(b,h+100663296);const p=Math.min(S,Ge(Math.max(h,b),65536));if(a(p))return!0}return!1}const c=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function l(h,g,S=1024){const m=g+S;let b=g;for(;h[b]&&!(b>=m);)++b;if(b-g>16&&h.buffer&&c)return c.decode(h.subarray(g,b));let p="";for(;g<b;){let y=h[g++];if(!(y&128)){p+=String.fromCharCode(y);continue}const _=h[g++]&63;if((y&224)===192){p+=String.fromCharCode((y&31)<<6|_);continue}const L=h[g++]&63;if((y&240)===224?y=(y&15)<<12|_<<6|L:y=(y&7)<<18|_<<12|L<<6|h[g++]&63,y<65536)p+=String.fromCharCode(y);else{const N=y-65536;p+=String.fromCharCode(55296|N>>10,56320|N&1023)}}return p}function f(h,g){return h?l(r.HEAPU8,h,g):""}const u={emscripten_get_now:Re,emscripten_memcpy_big:o,emscripten_resize_heap:i,fd_write:()=>0};async function d(){const g=await n({env:u,wasi_snapshot_preview1:u});e=g.memory,s(e.buffer),Object.assign(r,g),r.UTF8ToString=f}return await d(),r}var De=Object.defineProperty,Ve=(n,e,t)=>e in n?De(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,w=(n,e,t)=>(Ve(n,typeof e!="symbol"?e+"":e,t),t);let k=null;function ze(n){throw new te(n.UTF8ToString(n.getLastOnigError()))}class V{constructor(e){w(this,"utf16Length"),w(this,"utf8Length"),w(this,"utf16Value"),w(this,"utf8Value"),w(this,"utf16OffsetToUtf8"),w(this,"utf8OffsetToUtf16");const t=e.length,r=V._utf8ByteLength(e),s=r!==t,o=s?new Uint32Array(t+1):null;s&&(o[t]=r);const a=s?new Uint32Array(r+1):null;s&&(a[r]=t);const i=new Uint8Array(r);let c=0;for(let l=0;l<t;l++){const f=e.charCodeAt(l);let u=f,d=!1;if(f>=55296&&f<=56319&&l+1<t){const h=e.charCodeAt(l+1);h>=56320&&h<=57343&&(u=(f-55296<<10)+65536|h-56320,d=!0)}s&&(o[l]=c,d&&(o[l+1]=c),u<=127?a[c+0]=l:u<=2047?(a[c+0]=l,a[c+1]=l):u<=65535?(a[c+0]=l,a[c+1]=l,a[c+2]=l):(a[c+0]=l,a[c+1]=l,a[c+2]=l,a[c+3]=l)),u<=127?i[c++]=u:u<=2047?(i[c++]=192|(u&1984)>>>6,i[c++]=128|(u&63)>>>0):u<=65535?(i[c++]=224|(u&61440)>>>12,i[c++]=128|(u&4032)>>>6,i[c++]=128|(u&63)>>>0):(i[c++]=240|(u&1835008)>>>18,i[c++]=128|(u&258048)>>>12,i[c++]=128|(u&4032)>>>6,i[c++]=128|(u&63)>>>0),d&&l++}this.utf16Length=t,this.utf8Length=r,this.utf16Value=e,this.utf8Value=i,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=a}static _utf8ByteLength(e){let t=0;for(let r=0,s=e.length;r<s;r++){const o=e.charCodeAt(r);let a=o,i=!1;if(o>=55296&&o<=56319&&r+1<s){const c=e.charCodeAt(r+1);c>=56320&&c<=57343&&(a=(o-55296<<10)+65536|c-56320,i=!0)}a<=127?t+=1:a<=2047?t+=2:a<=65535?t+=3:t+=4,i&&r++}return t}createString(e){const t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}}const C=class{constructor(n){if(w(this,"id",++C.LAST_ID),w(this,"_onigBinding"),w(this,"content"),w(this,"utf16Length"),w(this,"utf8Length"),w(this,"utf16OffsetToUtf8"),w(this,"utf8OffsetToUtf16"),w(this,"ptr"),!k)throw new te("Must invoke loadWasm first.");this._onigBinding=k,this.content=n;const e=new V(n);this.utf16Length=e.utf16Length,this.utf8Length=e.utf8Length,this.utf16OffsetToUtf8=e.utf16OffsetToUtf8,this.utf8OffsetToUtf16=e.utf8OffsetToUtf16,this.utf8Length<1e4&&!C._sharedPtrInUse?(C._sharedPtr||(C._sharedPtr=k.omalloc(1e4)),C._sharedPtrInUse=!0,k.HEAPU8.set(e.utf8Value,C._sharedPtr),this.ptr=C._sharedPtr):this.ptr=e.createString(k)}convertUtf8OffsetToUtf16(n){return this.utf8OffsetToUtf16?n<0?0:n>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[n]:n}convertUtf16OffsetToUtf8(n){return this.utf16OffsetToUtf8?n<0?0:n>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[n]:n}dispose(){this.ptr===C._sharedPtr?C._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let H=C;w(H,"LAST_ID",0);w(H,"_sharedPtr",0);w(H,"_sharedPtrInUse",!1);class Je{constructor(e){if(w(this,"_onigBinding"),w(this,"_ptr"),!k)throw new te("Must invoke loadWasm first.");const t=[],r=[];for(let i=0,c=e.length;i<c;i++){const l=new V(e[i]);t[i]=l.createString(k),r[i]=l.utf8Length}const s=k.omalloc(4*e.length);k.HEAPU32.set(t,s/4);const o=k.omalloc(4*e.length);k.HEAPU32.set(r,o/4);const a=k.createOnigScanner(s,o,e.length);for(let i=0,c=e.length;i<c;i++)k.ofree(t[i]);k.ofree(o),k.ofree(s),a===0&&ze(k),this._onigBinding=k,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,r){let s=0;if(typeof r=="number"&&(s=r),typeof e=="string"){e=new H(e);const o=this._findNextMatchSync(e,t,!1,s);return e.dispose(),o}return this._findNextMatchSync(e,t,!1,s)}_findNextMatchSync(e,t,r,s){const o=this._onigBinding,a=o.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),s);if(a===0)return null;const i=o.HEAPU32;let c=a/4;const l=i[c++],f=i[c++],u=[];for(let d=0;d<f;d++){const h=e.convertUtf8OffsetToUtf16(i[c++]),g=e.convertUtf8OffsetToUtf16(i[c++]);u[d]={start:h,end:g,length:g-h}}return{index:l,captureIndices:u}}}function Ye(n){return typeof n.instantiator=="function"}function Ke(n){return typeof n.default=="function"}function qe(n){return typeof n.data<"u"}function Qe(n){return typeof Response<"u"&&n instanceof Response}function Xe(n){return typeof ArrayBuffer<"u"&&(n instanceof ArrayBuffer||ArrayBuffer.isView(n))||typeof Buffer<"u"&&Buffer.isBuffer?.(n)||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&n instanceof Uint32Array}let W;function be(n){if(W)return W;async function e(){k=await Fe(async t=>{let r=n;return r=await r,typeof r=="function"&&(r=await r(t)),typeof r=="function"&&(r=await r(t)),Ye(r)?r=await r.instantiator(t):Ke(r)?r=await r.default(t):(qe(r)&&(r=r.data),Qe(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await Ze(r)(t):r=await et(r)(t):Xe(r)?r=await X(r)(t):r instanceof WebAssembly.Module?r=await X(r)(t):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await X(r.default)(t))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return W=e(),W}function X(n){return e=>WebAssembly.instantiate(n,e)}function Ze(n){return e=>WebAssembly.instantiateStreaming(n,e)}function et(n){return async e=>{const t=await n.arrayBuffer();return WebAssembly.instantiate(t,e)}}let tt;function nt(){return tt}async function ne(n){return n&&await be(n),{createScanner(e){return new Je(e.map(t=>typeof t=="string"?t:t.source))},createString(e){return new H(e)}}}let R=!1,Se=!1;function Rt(n=!0,e=!1){R=n,Se=e}function v(n,e=3){if(R&&!(typeof R=="number"&&e>R)){if(Se)throw new Error(`[SHIKI DEPRECATE]: ${n}`);console.trace(`[SHIKI DEPRECATE]: ${n}`)}}function rt(n){return v("import `createOnigurumaEngine` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead"),ne(n)}function Gt(n){return v("import `createOnigurumaEngine` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead"),ne(n)}function Ft(n){return v("import `loadWasm` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead"),be(n)}function st(n){return Array.isArray(n)?n:[n]}function z(n,e=!1){const t=n.split(/(\r?\n)/g);let r=0;const s=[];for(let o=0;o<t.length;o+=2){const a=e?t[o]+(t[o+1]||""):t[o];s.push([a,r]),r+=t[o].length,r+=t[o+1]?.length||0}return s}function re(n){return!n||["plaintext","txt","text","plain"].includes(n)}function we(n){return n==="ansi"||re(n)}function se(n){return n==="none"}function ke(n){return se(n)}function Te(n,e){if(!e)return n;n.properties||={},n.properties.class||=[],typeof n.properties.class=="string"&&(n.properties.class=n.properties.class.split(/\s+/g)),Array.isArray(n.properties.class)||(n.properties.class=[]);const t=Array.isArray(e)?e:e.split(/\s+/g);for(const r of t)r&&!n.properties.class.includes(r)&&n.properties.class.push(r);return n}function ot(n,e){let t=0;const r=[];for(const s of e)s>t&&r.push({...n,content:n.content.slice(t,s),offset:n.offset+t}),t=s;return t<n.content.length&&r.push({...n,content:n.content.slice(t),offset:n.offset+t}),r}function it(n,e){const t=Array.from(e instanceof Set?e:new Set(e)).sort((r,s)=>r-s);return t.length?n.map(r=>r.flatMap(s=>{const o=t.filter(a=>s.offset<a&&a<s.offset+s.content.length).map(a=>a-s.offset).sort((a,i)=>a-i);return o.length?ot(s,o):s})):n}async function _e(n){return Promise.resolve(typeof n=="function"?n():n).then(e=>e.default||e)}function G(n,e){const t=typeof n=="string"?{}:{...n.colorReplacements},r=typeof n=="string"?n:n.name;for(const[s,o]of Object.entries(e?.colorReplacements||{}))typeof o=="string"?t[s]=o:s===r&&Object.assign(t,o);return t}function I(n,e){return n&&(e?.[n?.toLowerCase()]||n)}function Le(n){const e={};return n.color&&(e.color=n.color),n.bgColor&&(e["background-color"]=n.bgColor),n.fontStyle&&(n.fontStyle&O.Italic&&(e["font-style"]="italic"),n.fontStyle&O.Bold&&(e["font-weight"]="bold"),n.fontStyle&O.Underline&&(e["text-decoration"]="underline")),e}function at(n){return typeof n=="string"?n:Object.entries(n).map(([e,t])=>`${e}:${t}`).join(";")}function ct(n){const e=z(n,!0).map(([s])=>s);function t(s){if(s===n.length)return{line:e.length-1,character:e[e.length-1].length};let o=s,a=0;for(const i of e){if(o<i.length)break;o-=i.length,a++}return{line:a,character:o}}function r(s,o){let a=0;for(let i=0;i<s;i++)a+=e[i].length;return a+=o,a}return{lines:e,indexToPos:t,posToIndex:r}}class T extends Error{constructor(e){super(e),this.name="ShikiError"}}const ve=new WeakMap;function J(n,e){ve.set(n,e)}function j(n){return ve.get(n)}class B{_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 B(Object.fromEntries(st(t).map(r=>[r,ee])),e)}constructor(...e){if(e.length===2){const[t,r]=e;this.lang=r,this._stacks=t}else{const[t,r,s]=e;this.lang=r,this._stacks={[s]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}get scopes(){return v("GrammarState.scopes is deprecated, use GrammarState.getScopes() instead"),he(this._stacks[this.theme])}getScopes(e=this.theme){return he(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function he(n){const e=[],t=new Set;function r(s){if(t.has(s))return;t.add(s);const o=s?.nameScopesList?.scopeName;o&&e.push(o),s.parent&&r(s.parent)}return r(n),e}function lt(n,e){if(!(n instanceof B))throw new T("Invalid grammar state");return n.getInternalStack(e)}function ft(){const n=new WeakMap;function e(t){if(!n.has(t.meta)){let r=function(a){if(typeof a=="number"){if(a<0||a>t.source.length)throw new T(`Invalid decoration offset: ${a}. Code length: ${t.source.length}`);return{...s.indexToPos(a),offset:a}}else{const i=s.lines[a.line];if(i===void 0)throw new T(`Invalid decoration position ${JSON.stringify(a)}. Lines length: ${s.lines.length}`);if(a.character<0||a.character>i.length)throw new T(`Invalid decoration position ${JSON.stringify(a)}. Line ${a.line} length: ${i.length}`);return{...a,offset:s.posToIndex(a.line,a.character)}}};const s=ct(t.source),o=(t.options.decorations||[]).map(a=>({...a,start:r(a.start),end:r(a.end)}));ut(o),n.set(t.meta,{decorations:o,converter:s,source:t.source})}return n.get(t.meta)}return{name:"shiki:decorations",tokens(t){if(!this.options.decorations?.length)return;const s=e(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]);return it(t,s)},code(t){if(!this.options.decorations?.length)return;const r=e(this),s=Array.from(t.children).filter(f=>f.type==="element"&&f.tagName==="span");if(s.length!==r.converter.lines.length)throw new T(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function o(f,u,d,h){const g=s[f];let S="",m=-1,b=-1;if(u===0&&(m=0),d===0&&(b=0),d===Number.POSITIVE_INFINITY&&(b=g.children.length),m===-1||b===-1)for(let y=0;y<g.children.length;y++)S+=Ce(g.children[y]),m===-1&&S.length===u&&(m=y+1),b===-1&&S.length===d&&(b=y+1);if(m===-1)throw new T(`Failed to find start index for decoration ${JSON.stringify(h.start)}`);if(b===-1)throw new T(`Failed to find end index for decoration ${JSON.stringify(h.end)}`);const p=g.children.slice(m,b);if(!h.alwaysWrap&&p.length===g.children.length)i(g,h,"line");else if(!h.alwaysWrap&&p.length===1&&p[0].type==="element")i(p[0],h,"token");else{const y={type:"element",tagName:"span",properties:{},children:p};i(y,h,"wrapper"),g.children.splice(m,p.length,y)}}function a(f,u){s[f]=i(s[f],u,"line")}function i(f,u,d){const h=u.properties||{},g=u.transform||(S=>S);return f.tagName=u.tagName||"span",f.properties={...f.properties,...h,class:f.properties.class},u.properties?.class&&Te(f,u.properties.class),f=g(f,d)||f,f}const c=[],l=r.decorations.sort((f,u)=>u.start.offset-f.start.offset);for(const f of l){const{start:u,end:d}=f;if(u.line===d.line)o(u.line,u.character,d.character,f);else if(u.line<d.line){o(u.line,u.character,Number.POSITIVE_INFINITY,f);for(let h=u.line+1;h<d.line;h++)c.unshift(()=>a(h,f));o(d.line,0,d.character,f)}}c.forEach(f=>f())}}}function ut(n){for(let e=0;e<n.length;e++){const t=n[e];if(t.start.offset>t.end.offset)throw new T(`Invalid decoration range: ${JSON.stringify(t.start)} - ${JSON.stringify(t.end)}`);for(let r=e+1;r<n.length;r++){const s=n[r],o=t.start.offset<s.start.offset&&s.start.offset<t.end.offset,a=t.start.offset<s.end.offset&&s.end.offset<t.end.offset,i=s.start.offset<t.start.offset&&t.start.offset<s.end.offset,c=s.start.offset<t.end.offset&&t.end.offset<s.end.offset;if(o||a||i||c){if(a&&a||i&&c)continue;throw new T(`Decorations ${JSON.stringify(t.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function Ce(n){return n.type==="text"?n.value:n.type==="element"?n.children.map(Ce).join(""):""}const ht=[ft()];function F(n){return[...n.transformers||[],...ht]}var $=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Z={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function gt(n,e){const t=n.indexOf("\x1B[",e);if(t!==-1){const r=n.indexOf("m",t);return{sequence:n.substring(t+2,r).split(";"),startPosition:t,position:r+1}}return{position:n.length}}function ge(n,e){let t=1;const r=n[e+t++];let s;if(r==="2"){const o=[n[e+t++],n[e+t++],n[e+t]].map(a=>Number.parseInt(a));o.length===3&&!o.some(a=>Number.isNaN(a))&&(s={type:"rgb",rgb:o})}else if(r==="5"){const o=Number.parseInt(n[e+t]);Number.isNaN(o)||(s={type:"table",index:Number(o)})}return[t,s]}function mt(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t],s=Number.parseInt(r);if(!Number.isNaN(s))if(s===0)e.push({type:"resetAll"});else if(s<=9)Z[s]&&e.push({type:"setDecoration",value:Z[s]});else if(s<=29){const o=Z[s-20];o&&e.push({type:"resetDecoration",value:o})}else if(s<=37)e.push({type:"setForegroundColor",value:{type:"named",name:$[s-30]}});else if(s===38){const[o,a]=ge(n,t);a&&e.push({type:"setForegroundColor",value:a}),t+=o}else if(s===39)e.push({type:"resetForegroundColor"});else if(s<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:$[s-40]}});else if(s===48){const[o,a]=ge(n,t);a&&e.push({type:"setBackgroundColor",value:a}),t+=o}else s===49?e.push({type:"resetBackgroundColor"}):s>=90&&s<=97?e.push({type:"setForegroundColor",value:{type:"named",name:$[s-90+8]}}):s>=100&&s<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:$[s-100+8]}})}return e}function dt(){let n=null,e=null,t=new Set;return{parse(r){const s=[];let o=0;do{const a=gt(r,o),i=a.sequence?r.substring(o,a.startPosition):r.substring(o);if(i.length>0&&s.push({value:i,foreground:n,background:e,decorations:new Set(t)}),a.sequence){const c=mt(a.sequence);for(const l of c)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 c)l.type==="setForegroundColor"?n=l.value:l.type==="setBackgroundColor"?e=l.value:l.type==="setDecoration"&&t.add(l.value)}o=a.position}while(o<r.length);return s}}}var pt={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 yt(n=pt){function e(i){return n[i]}function t(i){return`#${i.map(c=>Math.max(0,Math.min(c,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let l=0;l<$.length;l++)r.push(e($[l]));let i=[0,95,135,175,215,255];for(let l=0;l<6;l++)for(let f=0;f<6;f++)for(let u=0;u<6;u++)r.push(t([i[l],i[f],i[u]]));let c=8;for(let l=0;l<24;l++,c+=10)r.push(t([c,c,c]));return r}function o(i){return s()[i]}function a(i){switch(i.type){case"named":return e(i.name);case"rgb":return t(i.rgb);case"table":return o(i.index)}}return{value:a}}function bt(n,e,t){const r=G(n,t),s=z(e),o=yt(Object.fromEntries($.map(i=>[i,n.colors?.[`terminal.ansi${i[0].toUpperCase()}${i.substring(1)}`]]))),a=dt();return s.map(i=>a.parse(i[0]).map(c=>{let l,f;c.decorations.has("reverse")?(l=c.background?o.value(c.background):n.bg,f=c.foreground?o.value(c.foreground):n.fg):(l=c.foreground?o.value(c.foreground):n.fg,f=c.background?o.value(c.background):void 0),l=I(l,r),f=I(f,r),c.decorations.has("dim")&&(l=St(l));let u=O.None;return c.decorations.has("bold")&&(u|=O.Bold),c.decorations.has("italic")&&(u|=O.Italic),c.decorations.has("underline")&&(u|=O.Underline),{content:c.value,offset:i[1],color:l,bgColor:f,fontStyle:u}}))}function St(n){const e=n.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(e)if(e[3]){const r=Math.round(Number.parseInt(e[3],16)/2).toString(16).padStart(2,"0");return`#${e[1]}${e[2]}${r}`}else return e[2]?`#${e[1]}${e[2]}80`:`#${Array.from(e[1]).map(r=>`${r}${r}`).join("")}80`;const t=n.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return t?`var(${t[1]}-dim)`:n}function Y(n,e,t={}){const{lang:r="text",theme:s=n.getLoadedThemes()[0]}=t;if(re(r)||se(s))return z(e).map(c=>[{content:c[0],offset:c[1]}]);const{theme:o,colorMap:a}=n.setTheme(s);if(r==="ansi")return bt(o,e,t);const i=n.getLanguage(r);if(t.grammarState){if(t.grammarState.lang!==i.name)throw new E(`Grammar state language "${t.grammarState.lang}" does not match highlight language "${i.name}"`);if(!t.grammarState.themes.includes(o.name))throw new E(`Grammar state themes "${t.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return wt(e,i,o,a,t)}function xe(...n){if(n.length===2)return j(n[1]);const[e,t,r={}]=n,{lang:s="text",theme:o=e.getLoadedThemes()[0]}=r;if(re(s)||se(o))throw new E("Plain language does not have grammar state");if(s==="ansi")throw new E("ANSI language does not have grammar state");const{theme:a,colorMap:i}=e.setTheme(o),c=e.getLanguage(s);return new B(D(t,c,a,i,r).stateStack,c.name,a.name)}function wt(n,e,t,r,s){const o=D(n,e,t,r,s),a=new B(D(n,e,t,r,s).stateStack,e.name,t.name);return J(o.tokens,a),o.tokens}function D(n,e,t,r,s){const o=G(t,s),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:i=500}=s,c=z(n);let l=s.grammarState?lt(s.grammarState,t.name)??ee:s.grammarContextCode!=null?D(s.grammarContextCode,e,t,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:ee,f=[];const u=[];for(let d=0,h=c.length;d<h;d++){const[g,S]=c[d];if(g===""){f=[],u.push([]);continue}if(a>0&&g.length>=a){f=[],u.push([{content:g,offset:S,color:"",fontStyle:0}]);continue}let m,b,p;s.includeExplanation&&(m=e.tokenizeLine(g,l),b=m.tokens,p=0);const y=e.tokenizeLine2(g,l,i),_=y.tokens.length/2;for(let L=0;L<_;L++){const N=y.tokens[2*L],K=L+1<_?y.tokens[2*L+2]:g.length;if(N===K)continue;const ce=y.tokens[2*L+1],Ae=I(r[ue.getForeground(ce)],o),Be=ue.getFontStyle(ce),q={content:g.substring(N,K),offset:S+N,color:Ae,fontStyle:Be};if(s.includeExplanation){const le=[];if(s.includeExplanation!=="scopeName")for(const x of t.settings){let A;switch(typeof x.scope){case"string":A=x.scope.split(/,/).map(Q=>Q.trim());break;case"object":A=x.scope;break;default:continue}le.push({settings:x,selectors:A.map(Q=>Q.split(/ /))})}q.explanation=[];let fe=0;for(;N+fe<K;){const x=b[p],A=g.substring(x.startIndex,x.endIndex);fe+=A.length,q.explanation.push({content:A,scopes:s.includeExplanation==="scopeName"?kt(x.scopes):Tt(le,x.scopes)}),p+=1}}f.push(q)}u.push(f),f=[],l=y.ruleStack}return{tokens:u,stateStack:l}}function kt(n){return n.map(e=>({scopeName:e}))}function Tt(n,e){const t=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];t[r]={scopeName:o,themeMatches:Lt(n,o,e.slice(0,r))}}return t}function me(n,e){return n===e||e.substring(0,n.length)===n&&e[n.length]==="."}function _t(n,e,t){if(!me(n[n.length-1],e))return!1;let r=n.length-2,s=t.length-1;for(;r>=0&&s>=0;)me(n[r],t[s])&&(r-=1),s-=1;return r===-1}function Lt(n,e,t){const r=[];for(const{selectors:s,settings:o}of n)for(const a of s)if(_t(a,e,t)){r.push(o);break}return r}function oe(n,e,t){const r=Object.entries(t.themes).filter(c=>c[1]).map(c=>({color:c[0],theme:c[1]})),s=r.map(c=>{const l=Y(n,e,{...t,theme:c.theme}),f=j(l),u=typeof c.theme=="string"?c.theme:c.theme.name;return{tokens:l,state:f,theme:u}}),o=vt(...s.map(c=>c.tokens)),a=o[0].map((c,l)=>c.map((f,u)=>{const d={content:f.content,variants:{},offset:f.offset};return"includeExplanation"in t&&t.includeExplanation&&(d.explanation=f.explanation),o.forEach((h,g)=>{const{content:S,explanation:m,offset:b,...p}=h[l][u];d.variants[r[g].color]=p}),d})),i=s[0].state?new B(Object.fromEntries(s.map(c=>[c.theme,c.state?.getInternalStack(c.theme)])),s[0].state.lang):void 0;return i&&J(a,i),a}function vt(...n){const e=n.map(()=>[]),t=n.length;for(let r=0;r<n[0].length;r++){const s=n.map(c=>c[r]),o=e.map(()=>[]);e.forEach((c,l)=>c.push(o[l]));const a=s.map(()=>0),i=s.map(c=>c[0]);for(;i.every(c=>c);){const c=Math.min(...i.map(l=>l.content.length));for(let l=0;l<t;l++){const f=i[l];f.content.length===c?(o[l].push(f),a[l]+=1,i[l]=s[l][a[l]]):(o[l].push({...f,content:f.content.slice(0,c)}),i[l]={...f,content:f.content.slice(c),offset:f.offset+c})}}}return e}function M(n,e,t){let r,s,o,a,i,c;if("themes"in t){const{defaultColor:l="light",cssVariablePrefix:f="--shiki-"}=t,u=Object.entries(t.themes).filter(m=>m[1]).map(m=>({color:m[0],theme:m[1]})).sort((m,b)=>m.color===l?-1:b.color===l?1:0);if(u.length===0)throw new E("`themes` option must not be empty");const d=oe(n,e,t);if(c=j(d),l&&!u.find(m=>m.color===l))throw new E(`\`themes\` option must contain the defaultColor key \`${l}\``);const h=u.map(m=>n.getTheme(m.theme)),g=u.map(m=>m.color);o=d.map(m=>m.map(b=>Ct(b,g,f,l))),c&&J(o,c);const S=u.map(m=>G(m.theme,t));s=u.map((m,b)=>(b===0&&l?"":`${f+m.color}:`)+(I(h[b].fg,S[b])||"inherit")).join(";"),r=u.map((m,b)=>(b===0&&l?"":`${f+m.color}-bg:`)+(I(h[b].bg,S[b])||"inherit")).join(";"),a=`shiki-themes ${h.map(m=>m.name).join(" ")}`,i=l?void 0:[s,r].join(";")}else if("theme"in t){const l=G(t.theme,t);o=Y(n,e,t);const f=n.getTheme(t.theme);r=I(f.bg,l),s=I(f.fg,l),a=f.name,c=j(o)}else throw new E("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:s,bg:r,themeName:a,rootStyle:i,grammarState:c}}function Ct(n,e,t,r){const s={content:n.content,explanation:n.explanation,offset:n.offset},o=e.map(c=>Le(n.variants[c])),a=new Set(o.flatMap(c=>Object.keys(c))),i={};return o.forEach((c,l)=>{for(const f of a){const u=c[f]||"inherit";if(l===0&&r)i[f]=u;else{const d=f==="color"?"":f==="background-color"?"-bg":`-${f}`,h=t+e[l]+(f==="color"?"":d);i[h]=u}}}),s.htmlStyle=i,s}function P(n,e,t,r={meta:{},options:t,codeToHast:(s,o)=>P(n,s,o),codeToTokens:(s,o)=>M(n,s,o)}){let s=e;for(const h of F(t))s=h.preprocess?.call(r,s,t)||s;let{tokens:o,fg:a,bg:i,themeName:c,rootStyle:l,grammarState:f}=M(n,s,t);const{mergeWhitespaces:u=!0}=t;u===!0?o=Et(o):u==="never"&&(o=Ot(o));const d={...r,get source(){return s}};for(const h of F(t))o=h.tokens?.call(d,o)||o;return xt(o,{...t,fg:a,bg:i,themeName:c,rootStyle:l},d,f)}function xt(n,e,t,r=j(n)){const s=F(e),o=[],a={type:"root",children:[]},{structure:i="classic",tabindex:c="0"}=e;let l={type:"element",tagName:"pre",properties:{class:`shiki ${e.themeName||""}`,style:e.rootStyle||`background-color:${e.bg};color:${e.fg}`,...c!==!1&&c!=null?{tabindex:c.toString()}:{},...Object.fromEntries(Array.from(Object.entries(e.meta||{})).filter(([g])=>!g.startsWith("_")))},children:[]},f={type:"element",tagName:"code",properties:{},children:o};const u=[],d={...t,structure:i,addClassToHast:Te,get source(){return t.source},get tokens(){return n},get options(){return e},get root(){return a},get pre(){return l},get code(){return f},get lines(){return u}};if(n.forEach((g,S)=>{S&&(i==="inline"?a.children.push({type:"element",tagName:"br",properties:{},children:[]}):i==="classic"&&o.push({type:"text",value:`
|
|
2
2
|
`}));let m={type:"element",tagName:"span",properties:{class:"line"},children:[]},b=0;for(const p of g){let y={type:"element",tagName:"span",properties:{...p.htmlAttrs},children:[{type:"text",value:p.content}]};typeof p.htmlStyle=="string"&&v("`htmlStyle` as a string is deprecated. Use an object instead.");const _=at(p.htmlStyle||Le(p));_&&(y.properties.style=_);for(const L of s)y=L?.span?.call(d,y,S+1,b,m,p)||y;i==="inline"?a.children.push(y):i==="classic"&&m.children.push(y),b+=p.content.length}if(i==="classic"){for(const p of s)m=p?.line?.call(d,m,S+1)||m;u.push(m),o.push(m)}}),i==="classic"){for(const g of s)f=g?.code?.call(d,f)||f;l.children.push(f);for(const g of s)l=g?.pre?.call(d,l)||l;a.children.push(l)}let h=a;for(const g of s)h=g?.root?.call(d,h)||h;return r&&J(h,r),h}function Et(n){return n.map(e=>{const t=[];let r="",s=0;return e.forEach((o,a)=>{const c=!(o.fontStyle&&o.fontStyle&O.Underline);c&&o.content.match(/^\s+$/)&&e[a+1]?(s||(s=o.offset),r+=o.content):r?(c?t.push({...o,offset:s,content:r+o.content}):t.push({content:r,offset:s},o),s=0,r=""):t.push(o)}),t})}function Ot(n){return n.map(e=>e.flatMap(t=>{if(t.content.match(/^\s+$/))return t;const r=t.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return t;const[,s,o,a]=r;if(!s&&!a)return t;const i=[{...t,offset:t.offset+s.length,content:o}];return s&&i.unshift({content:s,offset:t.offset}),a&&i.push({content:a,offset:t.offset+s.length+o.length}),i}))}function Ee(n,e,t){const r={meta:{},options:t,codeToHast:(o,a)=>P(n,o,a),codeToTokens:(o,a)=>M(n,o,a)};let s=Ue(P(n,e,t,r));for(const o of F(t))s=o.postprocess?.call(r,s,t)||s;return s}const de={light:"#333333",dark:"#bbbbbb"},pe={light:"#fffffe",dark:"#1e1e1e"},ye="__shiki_resolved";function ie(n){if(n?.[ye])return n;const e={...n};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:t,fg:r}=e;if(!t||!r){const i=e.settings?e.settings.find(c=>!c.name&&!c.scope):void 0;i?.settings?.foreground&&(r=i.settings.foreground),i?.settings?.background&&(t=i.settings.background),!r&&e?.colors?.["editor.foreground"]&&(r=e.colors["editor.foreground"]),!t&&e?.colors?.["editor.background"]&&(t=e.colors["editor.background"]),r||(r=e.type==="light"?de.light:de.dark),t||(t=e.type==="light"?pe.light:pe.dark),e.fg=r,e.bg=t}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let s=0;const o=new Map;function a(i){if(o.has(i))return o.get(i);s+=1;const c=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return e.colorReplacements?.[`#${c}`]?a(i):(o.set(i,c),c)}e.settings=e.settings.map(i=>{const c=i.settings?.foreground&&!i.settings.foreground.startsWith("#"),l=i.settings?.background&&!i.settings.background.startsWith("#");if(!c&&!l)return i;const f={...i,settings:{...i.settings}};if(c){const u=a(i.settings.foreground);e.colorReplacements[u]=i.settings.foreground,f.settings.foreground=u}if(l){const u=a(i.settings.background);e.colorReplacements[u]=i.settings.background,f.settings.background=u}return f});for(const i of Object.keys(e.colors||{}))if((i==="editor.foreground"||i==="editor.background"||i.startsWith("terminal.ansi"))&&!e.colors[i]?.startsWith("#")){const c=a(e.colors[i]);e.colorReplacements[c]=e.colors[i],e.colors[i]=c}return Object.defineProperty(e,ye,{enumerable:!1,writable:!1,value:!0}),e}async function Oe(n){return Array.from(new Set((await Promise.all(n.filter(e=>!we(e)).map(async e=>await _e(e).then(t=>Array.isArray(t)?t:[t])))).flat()))}async function Ne(n){return(await Promise.all(n.map(async t=>ke(t)?null:ie(await _e(t))))).filter(t=>!!t)}class Nt extends je{constructor(e,t,r,s={}){super(e),this._resolver=e,this._themes=t,this._langs=r,this._alias=s,this._themes.map(o=>this.loadTheme(o)),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=ie(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=Me.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){if(this._alias[e]){const t=new Set([e]);for(;this._alias[e];){if(e=this._alias[e],t.has(e))throw new T(`Circular alias \`${Array.from(t).join(" -> ")} -> ${e}\``);t.add(e)}}return this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const t=new Set([...this._langMap.values()].filter(o=>o.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const r={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const s=this.loadGrammarWithConfiguration(e.scopeName,1,r);if(s.name=e.name,this._resolvedGrammars.set(e.name,s),e.aliases&&e.aliases.forEach(o=>{this._alias[o]=e.name}),this._loadedLanguagesCache=null,t.size)for(const o of t)this._resolvedGrammars.delete(o.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(o.scopeName),this._syncRegistry?._grammars?.delete(o.scopeName),this.loadLanguage(this._langMap.get(o.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const s of e)this.resolveEmbeddedLanguages(s);const t=Array.from(this._langGraph.entries()),r=t.filter(([s,o])=>!o);if(r.length){const s=t.filter(([o,a])=>a&&a.embeddedLangs?.some(i=>r.map(([c])=>c).includes(i))).filter(o=>!r.includes(o));throw new T(`Missing languages ${r.map(([o])=>`\`${o}\``).join(", ")}, required by ${s.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[s,o]of t)this._resolver.addLanguage(o);for(const[s,o]of t)this.loadLanguage(o)}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 It{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:r=>e.createScanner(r),createOnigString:r=>e.createString(r)},t.forEach(r=>this.addLanguage(r))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){const t=e.split(".");let r=[];for(let s=1;s<=t.length;s++){const o=t.slice(0,s).join(".");r=[...r,...this._injections.get(o)||[]]}return r}}let U=0;function Ie(n){U+=1,n.warnings!==!1&&U>=10&&U%10===0&&console.warn(`[Shiki] ${U} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let e=!1;if(!n.engine)throw new T("`engine` option is required for synchronous mode");const t=(n.langs||[]).flat(1),r=(n.themes||[]).flat(1).map(ie),s=new It(n.engine,t),o=new Nt(s,r,t,n.langAlias);let a;function i(p){m();const y=o.getGrammar(typeof p=="string"?p:p.name);if(!y)throw new T(`Language \`${p}\` not found, you may need to load it first`);return y}function c(p){if(p==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};m();const y=o.getTheme(p);if(!y)throw new T(`Theme \`${p}\` not found, you may need to load it first`);return y}function l(p){m();const y=c(p);a!==p&&(o.setTheme(y),a=p);const _=o.getColorMap();return{theme:y,colorMap:_}}function f(){return m(),o.getLoadedThemes()}function u(){return m(),o.getLoadedLanguages()}function d(...p){m(),o.loadLanguages(p.flat(1))}async function h(...p){return d(await Oe(p))}function g(...p){m();for(const y of p.flat(1))o.loadTheme(y)}async function S(...p){return m(),g(await Ne(p))}function m(){if(e)throw new T("Shiki instance has been disposed")}function b(){e||(e=!0,o.dispose(),U-=1)}return{setTheme:l,getTheme:c,getLanguage:i,getLoadedThemes:f,getLoadedLanguages:u,loadLanguage:h,loadLanguageSync:d,loadTheme:S,loadThemeSync:g,dispose:b,[Symbol.dispose]:b}}async function $e(n={}){n.loadWasm&&v("`loadWasm` option is deprecated. Use `engine: createOnigurumaEngine(loadWasm)` instead.");const[e,t,r]=await Promise.all([Ne(n.themes||[]),Oe(n.langs||[]),n.engine||ne(n.loadWasm||nt())]);return Ie({...n,themes:e,langs:t,engine:r})}function Dt(n={}){return v("`getShikiInternal` is deprecated. Use `createShikiInternal` instead."),$e(n)}async function ae(n={}){const e=await $e(n);return{getLastGrammarState:(...t)=>xe(e,...t),codeToTokensBase:(t,r)=>Y(e,t,r),codeToTokensWithThemes:(t,r)=>oe(e,t,r),codeToTokens:(t,r)=>M(e,t,r),codeToHast:(t,r)=>P(e,t,r),codeToHtml:(t,r)=>Ee(e,t,r),...e,getInternalContext:()=>e}}function Vt(n={}){const e=Ie(n);return{getLastGrammarState:(...t)=>xe(e,...t),codeToTokensBase:(t,r)=>Y(e,t,r),codeToTokensWithThemes:(t,r)=>oe(e,t,r),codeToTokens:(t,r)=>M(e,t,r),codeToHast:(t,r)=>P(e,t,r),codeToHtml:(t,r)=>Ee(e,t,r),...e,getInternalContext:()=>e}}function $t(n){let e;async function t(r={}){if(e){const s=await e;return await Promise.all([s.loadTheme(...r.themes||[]),s.loadLanguage(...r.langs||[])]),s}else return e=n({...r,themes:r.themes||[],langs:r.langs||[]}),e}return t}const zt=$t(ae);function Jt(n={}){return v("`getHighlighterCore` is deprecated. Use `createHighlighterCore` or `getSingletonHighlighterCore` instead."),ae(n)}function Yt(n,e,t){let r,s,o;if(e)v("`createdBundledHighlighter` signature with `bundledLanguages` and `bundledThemes` is deprecated. Use the options object signature instead."),r=n,s=e,o=()=>rt(t);else{const i=n;r=i.langs,s=i.themes,o=i.engine}async function a(i){function c(h){if(typeof h=="string"){if(we(h))return[];const g=r[h];if(!g)throw new E(`Language \`${h}\` is not included in this bundle. You may want to load it from external source.`);return g}return h}function l(h){if(ke(h))return"none";if(typeof h=="string"){const g=s[h];if(!g)throw new E(`Theme \`${h}\` is not included in this bundle. You may want to load it from external source.`);return g}return h}const f=(i.themes??[]).map(h=>l(h)),u=(i.langs??[]).map(h=>c(h)),d=await ae({engine:i.engine??o(),...i,themes:f,langs:u});return{...d,loadLanguage(...h){return d.loadLanguage(...h.map(c))},loadTheme(...h){return d.loadTheme(...h.map(l))}}}return a}function At(n){let e;async function t(r={}){if(e){const s=await e;return await Promise.all([s.loadTheme(...r.themes||[]),s.loadLanguage(...r.langs||[])]),s}else return e=n({...r,themes:r.themes||[],langs:r.langs||[]}),e}return t}function Kt(n){const e=At(n);return{getSingletonHighlighter(t){return e(t)},async codeToHtml(t,r){return(await e({langs:[r.lang],themes:"theme"in r?[r.theme]:Object.values(r.themes)})).codeToHtml(t,r)},async codeToHast(t,r){return(await e({langs:[r.lang],themes:"theme"in r?[r.theme]:Object.values(r.themes)})).codeToHast(t,r)},async codeToTokens(t,r){return(await e({langs:[r.lang],themes:"theme"in r?[r.theme]:Object.values(r.themes)})).codeToTokens(t,r)},async codeToTokensBase(t,r){return(await e({langs:[r.lang],themes:[r.theme]})).codeToTokensBase(t,r)},async codeToTokensWithThemes(t,r){return(await e({langs:[r.lang],themes:Object.values(r.themes).filter(Boolean)})).codeToTokensWithThemes(t,r)},async getLastGrammarState(t,r){return(await e({langs:[r.lang],themes:[r.theme]})).getLastGrammarState(t,r)}}}function qt(n){return v("import `createJavaScriptRegexEngine` from `@shikijs/engine-javascript` or `shiki/engine/javascript` instead"),Pe(n)}function Qt(n){return v("import `defaultJavaScriptRegexConstructor` from `@shikijs/engine-javascript` or `shiki/engine/javascript` instead"),He(n)}function Xt(n={}){const{name:e="css-variables",variablePrefix:t="--shiki-",fontStyle:r=!0}=n,s=a=>n.variableDefaults?.[a]?`var(${t}${a}, ${n.variableDefaults[a]})`:`var(${t}${a})`,o={name:e,type:"dark",colors:{"editor.foreground":s("foreground"),"editor.background":s("background"),"terminal.ansiBlack":s("ansi-black"),"terminal.ansiRed":s("ansi-red"),"terminal.ansiGreen":s("ansi-green"),"terminal.ansiYellow":s("ansi-yellow"),"terminal.ansiBlue":s("ansi-blue"),"terminal.ansiMagenta":s("ansi-magenta"),"terminal.ansiCyan":s("ansi-cyan"),"terminal.ansiWhite":s("ansi-white"),"terminal.ansiBrightBlack":s("ansi-bright-black"),"terminal.ansiBrightRed":s("ansi-bright-red"),"terminal.ansiBrightGreen":s("ansi-bright-green"),"terminal.ansiBrightYellow":s("ansi-bright-yellow"),"terminal.ansiBrightBlue":s("ansi-bright-blue"),"terminal.ansiBrightMagenta":s("ansi-bright-magenta"),"terminal.ansiBrightCyan":s("ansi-bright-cyan"),"terminal.ansiBrightWhite":s("ansi-bright-white")},tokenColors:[{scope:["keyword.operator.accessor","meta.group.braces.round.function.arguments","meta.template.expression","markup.fenced_code meta.embedded.block"],settings:{foreground:s("foreground")}},{scope:"emphasis",settings:{fontStyle:"italic"}},{scope:["strong","markup.heading.markdown","markup.bold.markdown"],settings:{fontStyle:"bold"}},{scope:["markup.italic.markdown"],settings:{fontStyle:"italic"}},{scope:"meta.link.inline.markdown",settings:{fontStyle:"underline",foreground:s("token-link")}},{scope:["string","markup.fenced_code","markup.inline"],settings:{foreground:s("token-string")}},{scope:["comment","string.quoted.docstring.multi"],settings:{foreground:s("token-comment")}},{scope:["constant.numeric","constant.language","constant.other.placeholder","constant.character.format.placeholder","variable.language.this","variable.other.object","variable.other.class","variable.other.constant","meta.property-name","meta.property-value","support"],settings:{foreground:s("token-constant")}},{scope:["keyword","storage.modifier","storage.type","storage.control.clojure","entity.name.function.clojure","entity.name.tag.yaml","support.function.node","support.type.property-name.json","punctuation.separator.key-value","punctuation.definition.template-expression"],settings:{foreground:s("token-keyword")}},{scope:"variable.parameter.function",settings:{foreground:s("token-parameter")}},{scope:["support.function","entity.name.type","entity.other.inherited-class","meta.function-call","meta.instance.constructor","entity.other.attribute-name","entity.name.function","constant.keyword.clojure"],settings:{foreground:s("token-function")}},{scope:["entity.name.tag","string.quoted","string.regexp","string.interpolated","string.template","string.unquoted.plain.out.yaml","keyword.other.template"],settings:{foreground:s("token-string-expression")}},{scope:["punctuation.definition.arguments","punctuation.definition.dict","punctuation.separator","meta.function-call.arguments"],settings:{foreground:s("token-punctuation")}},{scope:["markup.underline.link","punctuation.definition.metadata.markdown"],settings:{foreground:s("token-link")}},{scope:["beginning.punctuation.definition.list.markdown"],settings:{foreground:s("token-string")}},{scope:["punctuation.definition.string.begin.markdown","punctuation.definition.string.end.markdown","string.other.link.title.markdown","string.other.link.description.markdown"],settings:{foreground:s("token-keyword")}},{scope:["markup.inserted","meta.diff.header.to-file","punctuation.definition.inserted"],settings:{foreground:s("token-inserted")}},{scope:["markup.deleted","meta.diff.header.from-file","punctuation.definition.deleted"],settings:{foreground:s("token-deleted")}},{scope:["markup.changed","punctuation.definition.changed"],settings:{foreground:s("token-changed")}}]};return r||(o.tokenColors=o.tokenColors?.map(a=>(a.settings?.fontStyle&&delete a.settings.fontStyle,a))),o}export{O as FontStyle,E as ShikiError,ue as StackElementMetadata,Te as addClassToHast,I as applyColorReplacements,P as codeToHast,Ee as codeToHtml,M as codeToTokens,Y as codeToTokensBase,oe as codeToTokensWithThemes,Xt as createCssVariablesTheme,ae as createHighlighterCore,Vt as createHighlighterCoreSync,qt as createJavaScriptRegexEngine,rt as createOnigurumaEngine,ct as createPositionConverter,$e as createShikiInternal,Ie as createShikiInternalSync,Kt as createSingletonShorthands,Gt as createWasmOnigEngine,Yt as createdBundledHighlighter,Qt as defaultJavaScriptRegexConstructor,Rt as enableDeprecationWarnings,Jt as getHighlighterCore,Dt as getShikiInternal,zt as getSingletonHighlighterCore,Le as getTokenStyleObject,Ue as hastToHtml,se as isNoneTheme,re as isPlainLang,we as isSpecialLang,ke as isSpecialTheme,Ft as loadWasm,At as makeSingletonHighlighter,$t as makeSingletonHighlighterCore,_e as normalizeGetter,ie as normalizeTheme,G as resolveColorReplacements,z as splitLines,ot as splitToken,it as splitTokens,at as stringifyTokenStyle,st as toArray,bt as tokenizeAnsiWithTheme,wt as tokenizeWithTheme,xt as tokensToHast,ft as transformerDecorations,v as warnDeprecated};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{w as ie,s as Re,f as qe,a as We,b as Fe,c as ce,z as ze,h as Ue}from"./main-kkw9cfno.js";function He(t){return ae(t)}function ae(t){return Array.isArray(t)?Ke(t):t instanceof RegExp?t:typeof t=="object"?Qe(t):t}function Ke(t){let e=[];for(let n=0,s=t.length;n<s;n++)e[n]=ae(t[n]);return e}function Qe(t){let e={};for(let n in t)e[n]=ae(t[n]);return e}function Se(t,...e){return e.forEach(n=>{for(let s in n)t[s]=n[s]}),t}function be(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?be(t.substring(0,t.length-1)):t.substr(~e+1)}var H=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,T=class{static hasCaptures(t){return t===null?!1:(H.lastIndex=0,H.test(t))}static replaceCaptures(t,e,n){return t.replace(H,(s,r,i,a)=>{let c=n[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 we(t,e){return t<e?-1:t>e?1:0}function Ne(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,s=e.length;if(n===s){for(let r=0;r<n;r++){let i=we(t[r],e[r]);if(i!==0)return i}return 0}return n-s}function le(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function Ae(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Ie=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},V=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Ve(t),e)}static createFromParsedTheme(t,e){return et(t,e)}_cachedMatchRoot=new Ie(t=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,s=this._cachedMatchRoot.get(e).find(r=>Ye(t.parent,r.parentScopes));return s?new Pe(s.fontStyle,s.foreground,s.background):null}},K=class M{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const s of n)e=new M(e,s);return e}static from(...e){let n=null;for(let s=0;s<e.length;s++)n=new M(n,e[s]);return n}push(e){return new M(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let s=this;for(;s&&s!==e;)n.push(s.scopeName),s=s.parent;return s===e?n.reverse():void 0}};function Ye(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let s=e[n],r=!1;if(s===">"){if(n===e.length-1)return!1;s=e[++n],r=!0}for(;t&&!Xe(t.scopeName,s);){if(r)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Xe(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var Pe=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Ve(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],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 m=0,d=h.length;m<d;m++)switch(h[m]){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"&&le(a.settings.foreground)&&(l=a.settings.foreground);let u=null;typeof a.settings.background=="string"&&le(a.settings.background)&&(u=a.settings.background);for(let h=0,m=c.length;h<m;h++){let p=c[h].trim().split(" "),S=p[p.length-1],_=null;p.length>1&&(_=p.slice(0,p.length-1),_.reverse()),n[s++]=new Je(S,_,r,o,l,u)}}return n}var Je=class{constructor(t,e,n,s,r,i){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=s,this.foreground=r,this.background=i}},Ze=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(Ze||{});function et(t,e){t.sort((o,l)=>{let u=we(o.scope,l.scope);return u!==0||(u=Ne(o.parentScopes,l.parentScopes),u!==0)?u:o.index-l.index});let n=0,s="#000000",r="#ffffff";for(;t.length>=1&&t[0].scope==="";){let o=t.shift();o.fontStyle!==-1&&(n=o.fontStyle),o.foreground!==null&&(s=o.foreground),o.background!==null&&(r=o.background)}let i=new tt(e),a=new Pe(n,i.getId(s),i.getId(r)),c=new st(new J(0,null,-1,0,0),[]);for(let o=0,l=t.length;o<l;o++){let u=t[o];c.insert(0,u.scope,u.parentScopes,u.fontStyle,i.getId(u.foreground),i.getId(u.background))}return new V(i,a,c)}var tt=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},nt=Object.freeze([]),J=class Ee{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,s,r,i){this.scopeDepth=e,this.parentScopes=n||nt,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new Ee(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let s=0,r=e.length;s<r;s++)n[s]=e[s].clone();return n}acceptOverwrite(e,n,s,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),s!==0&&(this.foreground=s),r!==0&&(this.background=r)}},st=class Z{constructor(e,n=[],s={}){this._mainRule=e,this._children=s,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let s=0,r=0;for(;e.parentScopes[s]===">"&&s++,n.parentScopes[r]===">"&&r++,!(s>=e.parentScopes.length||r>=n.parentScopes.length);){const i=n.parentScopes[r].length-e.parentScopes[s].length;if(i!==0)return i;s++,r++}return n.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 n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Z._cmpBySpecificity),n}insert(e,n,s,r,i,a){if(n===""){this._doInsertHere(e,s,r,i,a);return}let c=n.indexOf("."),o,l;c===-1?(o=n,l=""):(o=n.substring(0,c),l=n.substring(c+1));let u;this._children.hasOwnProperty(o)?u=this._children[o]:(u=new Z(this._mainRule.clone(),J.cloneArr(this._rulesWithParentScopes)),this._children[o]=u),u.insert(e+1,l,s,r,i,a)}_doInsertHere(e,n,s,r,i){if(n===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(Ne(o.parentScopes,n)===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 J(e,n,s,r,i))}},$=class R{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=R.getLanguageId(e),s=R.getTokenType(e),r=R.getFontStyle(e),i=R.getForeground(e),a=R.getBackground(e);console.log({languageId:n,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,n,s,r,i,a,c){let o=R.getLanguageId(e),l=R.getTokenType(e),u=R.containsBalancedBrackets(e)?1:0,h=R.getFontStyle(e),m=R.getForeground(e),d=R.getBackground(e);return n!==0&&(o=n),s!==8&&(l=s),r!==null&&(u=r?1:0),i!==-1&&(h=i),a!==0&&(m=a),c!==0&&(d=c),(o<<0|l<<8|u<<10|h<<11|m<<15|d<<24)>>>0}};function D(t,e){const n=[],s=rt(t);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(n.push({matcher:l,priority:o}),r!==",")break;r=s.next()}return n;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(ue(r)){const o=[];do o.push(r),r=s.next();while(ue(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 ue(t){return!!t&&!!t.match(/[\w\.:]+/)}function rt(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const s=n[0];return n=e.exec(t),s}}}function ve(t){typeof t.dispose=="function"&&t.dispose()}var k=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},it=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},at=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},ot=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new k(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new at;for(const n of t)ct(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof k){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function ct(t,e,n,s){const r=n.lookup(t.scopeName);if(!r){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const i=n.lookup(e);t instanceof k?j({baseGrammar:i,selfGrammar:r},s):ee(t.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},s);const a=n.injections(t.scopeName);if(a)for(const c of a)s.add(new k(c))}function ee(t,e,n){if(e.repository&&e.repository[t]){const s=e.repository[t];q([s],e,n)}}function j(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&q(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&q(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function q(t,e,n){for(const s of t){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const r=s.repository?Se({},e.repository,s.repository):e.repository;Array.isArray(s.patterns)&&q(s.patterns,{...e,repository:r},n);const i=s.include;if(!i)continue;const a=ke(i);switch(a.kind){case 0:j({...e,selfGrammar:e.baseGrammar},n);break;case 1:j(e,n);break;case 2:ee(a.ruleName,{...e,repository:r},n);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?ee(a.ruleName,o,n):j(o,n)}else a.kind===4?n.add(new it(a.scopeName,a.ruleName)):n.add(new k(a.scopeName));break}}}var lt=class{kind=0},ut=class{kind=1},ht=class{constructor(t){this.ruleName=t}kind=2},pt=class{constructor(t){this.scopeName=t}kind=3},dt=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function ke(t){if(t==="$base")return new lt;if(t==="$self")return new ut;const e=t.indexOf("#");if(e===-1)return new pt(t);if(e===0)return new ht(t.substring(1));{const n=t.substring(0,e),s=t.substring(e+1);return new dt(n,s)}}var mt=/\\(\d+)/,he=/\\(\d+)/g,ft=-1,xe=-2;var L=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,s){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=T.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=T.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${be(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:T.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:T.replaceCaptures(this._contentName,t,e)}},gt=class extends L{retokenizeCapturedWithRuleId;constructor(t,e,n,s,r){super(t,e,n,s),this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,s){throw new Error("Not supported!")}},_t=class extends L{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,s,r){super(t,e,n,null),this._match=new x(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(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new G,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},pe=class extends L{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,s,r){super(t,e,n,s),this.patterns=r.patterns,this.hasMissingPatterns=r.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new G,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},te=class extends L{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,s,r,i,a,c,o,l){super(t,e,n,s),this._begin=new x(r,this.id),this.beginCaptures=i,this._end=new x(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(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,s)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new G;for(const n of this.patterns)t.getRule(n).collectPatterns(t,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}},W=class extends L{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,s,r,i,a,c,o){super(t,e,n,s),this._begin=new x(r,this.id),this.beginCaptures=i,this.whileCaptures=c,this._while=new x(a,xe),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(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new G;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,s){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,s)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new G,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||""),this._cachedCompiledWhilePatterns}},Ge=class g{static createCaptureRule(e,n,s,r,i){return e.registerRule(a=>new gt(n,a,s,r,i))}static getCompiledRuleId(e,n,s){return e.id||n.registerRule(r=>{if(e.id=r,e.match)return new _t(e.$vscodeTextmateLocation,e.id,e.name,e.match,g._compileCaptures(e.captures,n,s));if(typeof e.begin>"u"){e.repository&&(s=Se({},s,e.repository));let i=e.patterns;return typeof i>"u"&&e.include&&(i=[{include:e.include}]),new pe(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,g._compilePatterns(i,n,s))}return e.while?new W(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,g._compileCaptures(e.beginCaptures||e.captures,n,s),e.while,g._compileCaptures(e.whileCaptures||e.captures,n,s),g._compilePatterns(e.patterns,n,s)):new te(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,g._compileCaptures(e.beginCaptures||e.captures,n,s),e.end,g._compileCaptures(e.endCaptures||e.captures,n,s),e.applyEndPatternLast,g._compilePatterns(e.patterns,n,s))}),e.id}static _compileCaptures(e,n,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=g.getCompiledRuleId(e[a],n,s)),r[c]=g.createCaptureRule(n,e[a].$vscodeTextmateLocation,e[a].name,e[a].contentName,o)}}return r}static _compilePatterns(e,n,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=ke(c.include);switch(l.kind){case 0:case 1:o=g.getCompiledRuleId(s[c.include],n,s);break;case 2:let u=s[l.ruleName];u&&(o=g.getCompiledRuleId(u,n,s));break;case 3:case 4:const h=l.scopeName,m=l.kind===4?l.ruleName:null,d=n.getExternalGrammar(h,s);if(d)if(m){let p=d.repository[m];p&&(o=g.getCompiledRuleId(p,n,d.repository))}else o=g.getCompiledRuleId(d.repository.$self,n,d.repository);break}}else o=g.getCompiledRuleId(c,n,s);if(o!==-1){const l=n.getRule(o);let u=!1;if((l instanceof pe||l instanceof te||l instanceof W)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;r.push(o)}}return{patterns:r,hasMissingPatterns:(e?e.length:0)!==r.length}}},x=class Le{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){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=n,typeof this.source=="string"?this.hasBackReferences=mt.test(this.source):this.hasBackReferences=!1}clone(){return new Le(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let s=n.map(r=>e.substring(r.start,r.end));return he.lastIndex=0,this.source.replace(he,(r,i)=>Ae(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=[],n=[],s=[],r=[],i,a,c,o;for(i=0,a=this.source.length;i<a;i++)c=this.source.charAt(i),e[i]=c,n[i]=c,s[i]=c,r[i]=c,c==="\\"&&i+1<a&&(o=this.source.charAt(i+1),o==="A"?(e[i+1]="",n[i+1]="",s[i+1]="A",r[i+1]="A"):o==="G"?(e[i+1]="",n[i+1]="G",s[i+1]="",r[i+1]="G"):(e[i+1]=o,n[i+1]=o,s[i+1]=o,r[i+1]=o),i++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:s.join(""),A1_G1:r.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},G=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(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new de(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let s=this._items.map(r=>r.resolveAnchors(e,n));return new de(t,s,this._items.map(r=>r.ruleId))}},de=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
|
|
1
|
+
import{w as ie,s as Re,f as qe,a as We,b as Fe,c as ce,z as ze,h as Ue}from"./main-C7bJF57-.js";function He(t){return ae(t)}function ae(t){return Array.isArray(t)?Ke(t):t instanceof RegExp?t:typeof t=="object"?Qe(t):t}function Ke(t){let e=[];for(let n=0,s=t.length;n<s;n++)e[n]=ae(t[n]);return e}function Qe(t){let e={};for(let n in t)e[n]=ae(t[n]);return e}function Se(t,...e){return e.forEach(n=>{for(let s in n)t[s]=n[s]}),t}function be(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?be(t.substring(0,t.length-1)):t.substr(~e+1)}var H=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,T=class{static hasCaptures(t){return t===null?!1:(H.lastIndex=0,H.test(t))}static replaceCaptures(t,e,n){return t.replace(H,(s,r,i,a)=>{let c=n[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 we(t,e){return t<e?-1:t>e?1:0}function Ne(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,s=e.length;if(n===s){for(let r=0;r<n;r++){let i=we(t[r],e[r]);if(i!==0)return i}return 0}return n-s}function le(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function Ae(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Ie=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},V=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Ve(t),e)}static createFromParsedTheme(t,e){return et(t,e)}_cachedMatchRoot=new Ie(t=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,s=this._cachedMatchRoot.get(e).find(r=>Ye(t.parent,r.parentScopes));return s?new Pe(s.fontStyle,s.foreground,s.background):null}},K=class M{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const s of n)e=new M(e,s);return e}static from(...e){let n=null;for(let s=0;s<e.length;s++)n=new M(n,e[s]);return n}push(e){return new M(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let s=this;for(;s&&s!==e;)n.push(s.scopeName),s=s.parent;return s===e?n.reverse():void 0}};function Ye(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let s=e[n],r=!1;if(s===">"){if(n===e.length-1)return!1;s=e[++n],r=!0}for(;t&&!Xe(t.scopeName,s);){if(r)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Xe(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var Pe=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Ve(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],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 m=0,d=h.length;m<d;m++)switch(h[m]){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"&&le(a.settings.foreground)&&(l=a.settings.foreground);let u=null;typeof a.settings.background=="string"&&le(a.settings.background)&&(u=a.settings.background);for(let h=0,m=c.length;h<m;h++){let p=c[h].trim().split(" "),S=p[p.length-1],_=null;p.length>1&&(_=p.slice(0,p.length-1),_.reverse()),n[s++]=new Je(S,_,r,o,l,u)}}return n}var Je=class{constructor(t,e,n,s,r,i){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=s,this.foreground=r,this.background=i}},Ze=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(Ze||{});function et(t,e){t.sort((o,l)=>{let u=we(o.scope,l.scope);return u!==0||(u=Ne(o.parentScopes,l.parentScopes),u!==0)?u:o.index-l.index});let n=0,s="#000000",r="#ffffff";for(;t.length>=1&&t[0].scope==="";){let o=t.shift();o.fontStyle!==-1&&(n=o.fontStyle),o.foreground!==null&&(s=o.foreground),o.background!==null&&(r=o.background)}let i=new tt(e),a=new Pe(n,i.getId(s),i.getId(r)),c=new st(new J(0,null,-1,0,0),[]);for(let o=0,l=t.length;o<l;o++){let u=t[o];c.insert(0,u.scope,u.parentScopes,u.fontStyle,i.getId(u.foreground),i.getId(u.background))}return new V(i,a,c)}var tt=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},nt=Object.freeze([]),J=class Ee{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,s,r,i){this.scopeDepth=e,this.parentScopes=n||nt,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new Ee(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let s=0,r=e.length;s<r;s++)n[s]=e[s].clone();return n}acceptOverwrite(e,n,s,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),s!==0&&(this.foreground=s),r!==0&&(this.background=r)}},st=class Z{constructor(e,n=[],s={}){this._mainRule=e,this._children=s,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let s=0,r=0;for(;e.parentScopes[s]===">"&&s++,n.parentScopes[r]===">"&&r++,!(s>=e.parentScopes.length||r>=n.parentScopes.length);){const i=n.parentScopes[r].length-e.parentScopes[s].length;if(i!==0)return i;s++,r++}return n.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 n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Z._cmpBySpecificity),n}insert(e,n,s,r,i,a){if(n===""){this._doInsertHere(e,s,r,i,a);return}let c=n.indexOf("."),o,l;c===-1?(o=n,l=""):(o=n.substring(0,c),l=n.substring(c+1));let u;this._children.hasOwnProperty(o)?u=this._children[o]:(u=new Z(this._mainRule.clone(),J.cloneArr(this._rulesWithParentScopes)),this._children[o]=u),u.insert(e+1,l,s,r,i,a)}_doInsertHere(e,n,s,r,i){if(n===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(Ne(o.parentScopes,n)===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 J(e,n,s,r,i))}},$=class R{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=R.getLanguageId(e),s=R.getTokenType(e),r=R.getFontStyle(e),i=R.getForeground(e),a=R.getBackground(e);console.log({languageId:n,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,n,s,r,i,a,c){let o=R.getLanguageId(e),l=R.getTokenType(e),u=R.containsBalancedBrackets(e)?1:0,h=R.getFontStyle(e),m=R.getForeground(e),d=R.getBackground(e);return n!==0&&(o=n),s!==8&&(l=s),r!==null&&(u=r?1:0),i!==-1&&(h=i),a!==0&&(m=a),c!==0&&(d=c),(o<<0|l<<8|u<<10|h<<11|m<<15|d<<24)>>>0}};function D(t,e){const n=[],s=rt(t);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(n.push({matcher:l,priority:o}),r!==",")break;r=s.next()}return n;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(ue(r)){const o=[];do o.push(r),r=s.next();while(ue(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 ue(t){return!!t&&!!t.match(/[\w\.:]+/)}function rt(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const s=n[0];return n=e.exec(t),s}}}function ve(t){typeof t.dispose=="function"&&t.dispose()}var k=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},it=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},at=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},ot=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new k(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new at;for(const n of t)ct(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof k){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function ct(t,e,n,s){const r=n.lookup(t.scopeName);if(!r){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const i=n.lookup(e);t instanceof k?j({baseGrammar:i,selfGrammar:r},s):ee(t.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},s);const a=n.injections(t.scopeName);if(a)for(const c of a)s.add(new k(c))}function ee(t,e,n){if(e.repository&&e.repository[t]){const s=e.repository[t];q([s],e,n)}}function j(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&q(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&q(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function q(t,e,n){for(const s of t){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const r=s.repository?Se({},e.repository,s.repository):e.repository;Array.isArray(s.patterns)&&q(s.patterns,{...e,repository:r},n);const i=s.include;if(!i)continue;const a=ke(i);switch(a.kind){case 0:j({...e,selfGrammar:e.baseGrammar},n);break;case 1:j(e,n);break;case 2:ee(a.ruleName,{...e,repository:r},n);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?ee(a.ruleName,o,n):j(o,n)}else a.kind===4?n.add(new it(a.scopeName,a.ruleName)):n.add(new k(a.scopeName));break}}}var lt=class{kind=0},ut=class{kind=1},ht=class{constructor(t){this.ruleName=t}kind=2},pt=class{constructor(t){this.scopeName=t}kind=3},dt=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function ke(t){if(t==="$base")return new lt;if(t==="$self")return new ut;const e=t.indexOf("#");if(e===-1)return new pt(t);if(e===0)return new ht(t.substring(1));{const n=t.substring(0,e),s=t.substring(e+1);return new dt(n,s)}}var mt=/\\(\d+)/,he=/\\(\d+)/g,ft=-1,xe=-2;var L=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,s){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=T.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=T.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${be(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:T.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:T.replaceCaptures(this._contentName,t,e)}},gt=class extends L{retokenizeCapturedWithRuleId;constructor(t,e,n,s,r){super(t,e,n,s),this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,s){throw new Error("Not supported!")}},_t=class extends L{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,s,r){super(t,e,n,null),this._match=new x(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(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new G,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},pe=class extends L{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,s,r){super(t,e,n,s),this.patterns=r.patterns,this.hasMissingPatterns=r.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new G,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},te=class extends L{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,s,r,i,a,c,o,l){super(t,e,n,s),this._begin=new x(r,this.id),this.beginCaptures=i,this._end=new x(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(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,s)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new G;for(const n of this.patterns)t.getRule(n).collectPatterns(t,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}},W=class extends L{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,s,r,i,a,c,o){super(t,e,n,s),this._begin=new x(r,this.id),this.beginCaptures=i,this.whileCaptures=c,this._while=new x(a,xe),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(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new G;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,s){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,s)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new G,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||""),this._cachedCompiledWhilePatterns}},Ge=class g{static createCaptureRule(e,n,s,r,i){return e.registerRule(a=>new gt(n,a,s,r,i))}static getCompiledRuleId(e,n,s){return e.id||n.registerRule(r=>{if(e.id=r,e.match)return new _t(e.$vscodeTextmateLocation,e.id,e.name,e.match,g._compileCaptures(e.captures,n,s));if(typeof e.begin>"u"){e.repository&&(s=Se({},s,e.repository));let i=e.patterns;return typeof i>"u"&&e.include&&(i=[{include:e.include}]),new pe(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,g._compilePatterns(i,n,s))}return e.while?new W(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,g._compileCaptures(e.beginCaptures||e.captures,n,s),e.while,g._compileCaptures(e.whileCaptures||e.captures,n,s),g._compilePatterns(e.patterns,n,s)):new te(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,g._compileCaptures(e.beginCaptures||e.captures,n,s),e.end,g._compileCaptures(e.endCaptures||e.captures,n,s),e.applyEndPatternLast,g._compilePatterns(e.patterns,n,s))}),e.id}static _compileCaptures(e,n,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=g.getCompiledRuleId(e[a],n,s)),r[c]=g.createCaptureRule(n,e[a].$vscodeTextmateLocation,e[a].name,e[a].contentName,o)}}return r}static _compilePatterns(e,n,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=ke(c.include);switch(l.kind){case 0:case 1:o=g.getCompiledRuleId(s[c.include],n,s);break;case 2:let u=s[l.ruleName];u&&(o=g.getCompiledRuleId(u,n,s));break;case 3:case 4:const h=l.scopeName,m=l.kind===4?l.ruleName:null,d=n.getExternalGrammar(h,s);if(d)if(m){let p=d.repository[m];p&&(o=g.getCompiledRuleId(p,n,d.repository))}else o=g.getCompiledRuleId(d.repository.$self,n,d.repository);break}}else o=g.getCompiledRuleId(c,n,s);if(o!==-1){const l=n.getRule(o);let u=!1;if((l instanceof pe||l instanceof te||l instanceof W)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;r.push(o)}}return{patterns:r,hasMissingPatterns:(e?e.length:0)!==r.length}}},x=class Le{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){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=n,typeof this.source=="string"?this.hasBackReferences=mt.test(this.source):this.hasBackReferences=!1}clone(){return new Le(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let s=n.map(r=>e.substring(r.start,r.end));return he.lastIndex=0,this.source.replace(he,(r,i)=>Ae(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=[],n=[],s=[],r=[],i,a,c,o;for(i=0,a=this.source.length;i<a;i++)c=this.source.charAt(i),e[i]=c,n[i]=c,s[i]=c,r[i]=c,c==="\\"&&i+1<a&&(o=this.source.charAt(i+1),o==="A"?(e[i+1]="",n[i+1]="",s[i+1]="A",r[i+1]="A"):o==="G"?(e[i+1]="",n[i+1]="G",s[i+1]="",r[i+1]="G"):(e[i+1]=o,n[i+1]=o,s[i+1]=o,r[i+1]=o),i++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:s.join(""),A1_G1:r.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},G=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(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new de(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let s=this._items.map(r=>r.resolveAnchors(e,n));return new de(t,s,this._items.map(r=>r.ruleId))}},de=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
|
|
2
2
|
`)}findNextMatchSync(t,e,n){const s=this.scanner.findNextMatchSync(t,e,n);return s?{ruleId:this.rules[s.index],captureIndices:s.captureIndices}:null}},Q=class{constructor(t,e){this.languageId=t,this.tokenType=e}},yt=class ne{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new Q(e,8),this._embeddedLanguagesMatcher=new Ct(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?ne._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new Q(0,0);_getBasicScopeAttributes=new Ie(e=>{const n=this._scopeToLanguage(e),s=this._toStandardTokenType(e);return new Q(n,s)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(ne.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Ct=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([n,s])=>Ae(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},me=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function Te(t,e,n,s,r,i,a,c){const o=e.content.length;let l=!1,u=-1;if(a){const d=Rt(t,e,n,s,r,i);r=d.stack,s=d.linePos,n=d.isFirstLine,u=d.anchorPosition}const h=Date.now();for(;!l;){if(c!==0&&Date.now()-h>c)return new me(r,!0);m()}return new me(r,!1);function m(){const d=St(t,e,n,s,r,u);if(!d){i.produce(r,o),l=!0;return}const p=d.captureIndices,S=d.matchedRuleId,_=p&&p.length>0?p[0].end>s:!1;if(S===ft){const C=r.getRule(t);i.produce(r,p[0].start),r=r.withContentNameScopesList(r.nameScopesList),E(t,e,n,r,i,C.endCaptures,p),i.produce(r,p[0].end);const y=r;if(r=r.parent,u=y.getAnchorPos(),!_&&y.getEnterPos()===s){r=y,i.produce(r,o),l=!0;return}}else{const C=t.getRule(S);i.produce(r,p[0].start);const y=r,I=C.getName(e.content,p),N=r.contentNameScopesList.pushAttributed(I,t);if(r=r.push(S,s,u,p[0].end===o,null,N,N),C instanceof te){const b=C;E(t,e,n,r,i,b.beginCaptures,p),i.produce(r,p[0].end),u=p[0].end;const z=b.getContentName(e.content,p),U=N.pushAttributed(z,t);if(r=r.withContentNameScopesList(U),b.endHasBackReferences&&(r=r.withEndRule(b.getEndWithResolvedBackReferences(e.content,p))),!_&&y.hasSameRuleAs(r)){r=r.pop(),i.produce(r,o),l=!0;return}}else if(C instanceof W){const b=C;E(t,e,n,r,i,b.beginCaptures,p),i.produce(r,p[0].end),u=p[0].end;const z=b.getContentName(e.content,p),U=N.pushAttributed(z,t);if(r=r.withContentNameScopesList(U),b.whileHasBackReferences&&(r=r.withEndRule(b.getWhileWithResolvedBackReferences(e.content,p))),!_&&y.hasSameRuleAs(r)){r=r.pop(),i.produce(r,o),l=!0;return}}else if(E(t,e,n,r,i,C.captures,p),i.produce(r,p[0].end),r=r.pop(),!_){r=r.safePop(),i.produce(r,o),l=!0;return}}p[0].end>s&&(s=p[0].end,n=!1)}}function Rt(t,e,n,s,r,i){let a=r.beginRuleCapturedEOL?0:-1;const c=[];for(let o=r;o;o=o.pop()){const l=o.getRule(t);l instanceof W&&c.push({rule:l,stack:o})}for(let o=c.pop();o;o=c.pop()){const{ruleScanner:l,findOptions:u}=Nt(o.rule,t,o.stack.endRule,n,s===a),h=l.findNextMatchSync(e,s,u);if(h){if(h.ruleId!==xe){r=o.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(i.produce(o.stack,h.captureIndices[0].start),E(t,e,n,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,n=!1))}else{r=o.stack.pop();break}}return{stack:r,linePos:s,anchorPosition:a,isFirstLine:n}}function St(t,e,n,s,r,i){const a=bt(t,e,n,s,r,i),c=t.getInjections();if(c.length===0)return a;const o=wt(c,t,e,n,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 bt(t,e,n,s,r,i){const a=r.getRule(t),{ruleScanner:c,findOptions:o}=Oe(a,t,r.endRule,n,s===i),l=c.findNextMatchSync(e,s,o);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function wt(t,e,n,s,r,i,a){let c=Number.MAX_VALUE,o=null,l,u=0;const h=i.contentNameScopesList.getScopeNames();for(let m=0,d=t.length;m<d;m++){const p=t[m];if(!p.matcher(h))continue;const S=e.getRule(p.ruleId),{ruleScanner:_,findOptions:C}=Oe(S,e,null,s,r===a),y=_.findNextMatchSync(n,r,C);if(!y)continue;const I=y.captureIndices[0].start;if(!(I>=c)&&(c=I,o=y.captureIndices,l=y.ruleId,u=p.priority,c===r))break}return o?{priorityMatch:u===-1,captureIndices:o,matchedRuleId:l}:null}function Oe(t,e,n,s,r){return{ruleScanner:t.compileAG(e,n,s,r),findOptions:0}}function Nt(t,e,n,s,r){return{ruleScanner:t.compileWhileAG(e,n,s,r),findOptions:0}}function E(t,e,n,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 m=i[h];if(m===null)continue;const d=a[h];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.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,d.start):r.produce(s,d.start),m.retokenizeCapturedWithRuleId){const S=m.getName(c,a),_=s.contentNameScopesList.pushAttributed(S,t),C=m.getContentName(c,a),y=_.pushAttributed(C,t),I=s.push(m.retokenizeCapturedWithRuleId,d.start,-1,!1,null,_,y),N=t.createOnigString(c.substring(0,d.end));Te(t,N,n&&d.start===0,d.start,I,r,!1,0),ve(N);continue}const p=m.getName(c,a);if(p!==null){const _=(l.length>0?l[l.length-1].scopes:s.contentNameScopesList).pushAttributed(p,t);l.push(new At(_,d.end))}}for(;l.length>0;)r.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var At=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function It(t,e,n,s,r,i,a,c){return new Et(t,e,n,s,r,i,a,c)}function fe(t,e,n,s,r){const i=D(e,F),a=Ge.getCompiledRuleId(n,s,r.repository);for(const c of i)t.push({debugSelector:e,matcher:c.matcher,ruleId:a,grammar:r,priority:c.priority})}function F(t,e){if(e.length<t.length)return!1;let n=0;return t.every(s=>{for(let r=n;r<e.length;r++)if(Pt(e[r],s))return n=r+1,!0;return!1})}function Pt(t,e){if(!t)return!1;if(t===e)return!0;const n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var Et=class{constructor(t,e,n,s,r,i,a,c){if(this._rootScopeName=t,this.balancedBracketSelectors=i,this._onigLib=c,this._basicScopeAttributesProvider=new yt(n,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=a,this._grammar=ge(e,null),this._injections=null,this._tokenTypeMatchers=[],r)for(const o of Object.keys(r)){const l=D(o,F);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 t of this._ruleId2desc)t&&t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){const t={lookup:r=>r===this._rootScopeName?this._grammar:this.getExternalGrammar(r),injections:r=>this._grammarRepository.injections(r)},e=[],n=this._rootScopeName,s=t.lookup(n);if(s){const r=s.injections;if(r)for(let a in r)fe(e,a,r[a],this,s);const i=this._grammarRepository.injections(n);i&&i.forEach(a=>{const c=this.getExternalGrammar(a);if(c){const o=c.injectionSelector;o&&fe(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(t){const e=++this._lastRuleId,n=t(e);return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=ge(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const s=this._tokenize(t,e,!1,n);return{tokens:s.lineTokens.getResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}tokenizeLine2(t,e,n=0){const s=this._tokenize(t,e,!0,n);return{tokens:s.lineTokens.getBinaryResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}_tokenize(t,e,n,s){this._rootId===-1&&(this._rootId=Ge.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let r;if(!e||e===se.NULL){r=!0;const l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),h=$.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),m=this.getRule(this._rootId).getName(null,null);let d;m?d=v.createRootAndLookUpScopeName(m,h,this):d=v.createRoot("unknown",h),e=new se(null,this._rootId,-1,-1,!1,null,d,d)}else r=!1,e.reset();t=t+`
|
|
3
3
|
`;const i=this.createOnigString(t),a=i.content.length,c=new kt(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),o=Te(this,i,r,0,e,c,!0,s);return ve(i),{lineLength:a,lineTokens:c,ruleStack:o.stack,stoppedEarly:o.stoppedEarly}}};function ge(t,e){return t=He(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var v=class w{constructor(e,n,s){this.parent=e,this.scopePath=n,this.tokenAttributes=s}static fromExtension(e,n){let s=e,r=e?.scopePath??null;for(const i of n)r=K.push(r,i.scopeNames),s=new w(s,r,i.encodedTokenAttributes);return s}static createRoot(e,n){return new w(null,new K(null,e),n)}static createRootAndLookUpScopeName(e,n,s){const r=s.getMetadataForScope(e),i=new K(null,e),a=s.themeProvider.themeMatch(i),c=w.mergeAttributes(n,r,a);return new w(null,i,c)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return w.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,s){let r=-1,i=0,a=0;return s!==null&&(r=s.fontStyle,i=s.foregroundId,a=s.backgroundId),$.set(e,n.languageId,n.tokenType,null,r,i,a)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return w._pushAttributed(this,e,n);const s=e.split(/ /g);let r=this;for(const i of s)r=w._pushAttributed(r,i,n);return r}static _pushAttributed(e,n,s){const r=s.getMetadataForScope(n),i=e.scopePath.push(n),a=s.themeProvider.themeMatch(i),c=w.mergeAttributes(e.tokenAttributes,r,a);return new w(e,i,c)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const n=[];let s=this;for(;s&&s!==e;)n.push({encodedTokenAttributes:s.tokenAttributes,scopeNames:s.scopePath.getExtensionIfDefined(s.parent?.scopePath??null)}),s=s.parent;return s===e?n.reverse():void 0}},se=class A{constructor(e,n,s,r,i,a,c,o){this.parent=e,this.ruleId=n,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 A(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:A._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?v.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){A._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,s,r,i,a,c){return new A(this,e,n,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,n){return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}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 A(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(e,n){const s=v.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new A(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,v.fromExtension(s,n.contentNameScopesList))}},vt=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):D(n,F).map(s=>s.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>D(n,F).map(s=>s.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(const e of this.unbalancedBracketScopes)if(e(t))return!1;for(const e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},kt=class{constructor(t,e,n,s){this.balancedBracketSelectors=s,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let s=t?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const i=t?.getScopeNames()??[];for(const a of this._tokenTypeOverrides)a.matcher(i)&&(s=$.set(s,0,a.type,null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(i))}if(r&&(s=$.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 n=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,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(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,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(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let s=0,r=this._binaryTokens.length;s<r;s++)n[s]=this._binaryTokens[s];return n}},xt=class{constructor(t,e){this._onigLib=e,this._theme=t}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){this._rawGrammars.set(t.scopeName,t),e&&this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,n,s,r){if(!this._grammars.has(t)){let i=this._rawGrammars.get(t);if(!i)return null;this._grammars.set(t,It(t,i,e,n,s,r,this,this._onigLib))}return this._grammars.get(t)}},Bn=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new xt(V.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,n){this._syncRegistry.setTheme(V.createFromRawTheme(e,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,n,s){return this.loadGrammarWithConfiguration(e,n,{embeddedLanguages:s})}loadGrammarWithConfiguration(e,n,s){return this._loadGrammar(e,n,s.embeddedLanguages,s.tokenTypes,new vt(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,n,s,r,i){const a=new ot(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(c=>this._loadSingleGrammar(c.scopeName)),a.processQueue();return this._grammarForScopeName(e,n,s,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const n=this._options.loadGrammar(e);if(n){const s=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,s)}}addGrammar(e,n=[],s=0,r=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,s,r)}_grammarForScopeName(e,n=0,s=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,n,s,r,i)}},jn=se.NULL;const Gt=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Lt=/["&'<>`]/g,Tt=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Ot=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Bt=/[|\\{}()[\]^$+*?.]/g,_e=new WeakMap;function Mt(t,e){if(t=t.replace(e.subset?jt(e.subset):Lt,s),e.subset||e.escapeOnly)return t;return t.replace(Tt,n).replace(Ot,s);function n(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 jt(t){let e=_e.get(t);return e||(e=$t(t),_e.set(t,e)),e}function $t(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(Bt,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const Dt=/[\dA-Fa-f]/;function qt(t,e,n){const s="&#x"+t.toString(16).toUpperCase();return n&&e&&!Dt.test(String.fromCharCode(e))?s:s+";"}const Wt=/\d/;function Ft(t,e,n){const s="&#"+String(t);return n&&e&&!Wt.test(String.fromCharCode(e))?s:s+";"}const zt=["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"],Y={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:"€"},Ut=["cent","copy","divide","gt","lt","not","para","times"],Be={}.hasOwnProperty,re={};let O;for(O in Y)Be.call(Y,O)&&(re[Y[O]]=O);const Ht=/[^\dA-Za-z]/;function Kt(t,e,n,s){const r=String.fromCharCode(t);if(Be.call(re,r)){const i=re[r],a="&"+i;return n&&zt.includes(i)&&!Ut.includes(i)&&(!s||e&&e!==61&&Ht.test(String.fromCharCode(e)))?a:a+";"}return""}function Qt(t,e,n){let s=qt(t,e,n.omitOptionalSemicolons),r;if((n.useNamedReferences||n.useShortestReferences)&&(r=Kt(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const i=Ft(t,e,n.omitOptionalSemicolons);i.length<s.length&&(s=i)}return r&&(!n.useShortestReferences||r.length<s.length)?r:s}function P(t,e){return Mt(t,Object.assign({format:Qt},e))}const Yt=/^>|^->|<!--|-->|--!>|<!-$/g,Xt=[">"],Vt=["<",">"];function Jt(t,e,n,s){return s.settings.bogusComments?"<?"+P(t.value,Object.assign({},s.settings.characterReferences,{subset:Xt}))+">":"<!--"+t.value.replace(Yt,r)+"-->";function r(i){return P(i,Object.assign({},s.settings.characterReferences,{subset:Vt}))}}function Zt(t,e,n,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"}const f=je(1),Me=je(-1),en=[];function je(t){return e;function e(n,s,r){const i=n?n.children:en;let a=(s||0)+t,c=i[a];if(!r)for(;c&&ie(c);)a+=t,c=i[a];return c}}const tn={}.hasOwnProperty;function $e(t){return e;function e(n,s,r){return tn.call(t,n.tagName)&&t[n.tagName](n,s,r)}}const oe=$e({body:sn,caption:X,colgroup:X,dd:cn,dt:on,head:X,html:nn,li:an,optgroup:ln,option:un,p:rn,rp:ye,rt:ye,tbody:pn,td:Ce,tfoot:dn,th:Ce,thead:hn,tr:mn});function X(t,e,n){const s=f(n,e,!0);return!s||s.type!=="comment"&&!(s.type==="text"&&ie(s.value.charAt(0)))}function nn(t,e,n){const s=f(n,e);return!s||s.type!=="comment"}function sn(t,e,n){const s=f(n,e);return!s||s.type!=="comment"}function rn(t,e,n){const s=f(n,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"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function an(t,e,n){const s=f(n,e);return!s||s.type==="element"&&s.tagName==="li"}function on(t,e,n){const s=f(n,e);return!!(s&&s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd"))}function cn(t,e,n){const s=f(n,e);return!s||s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd")}function ye(t,e,n){const s=f(n,e);return!s||s.type==="element"&&(s.tagName==="rp"||s.tagName==="rt")}function ln(t,e,n){const s=f(n,e);return!s||s.type==="element"&&s.tagName==="optgroup"}function un(t,e,n){const s=f(n,e);return!s||s.type==="element"&&(s.tagName==="option"||s.tagName==="optgroup")}function hn(t,e,n){const s=f(n,e);return!!(s&&s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot"))}function pn(t,e,n){const s=f(n,e);return!s||s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot")}function dn(t,e,n){return!f(n,e)}function mn(t,e,n){const s=f(n,e);return!s||s.type==="element"&&s.tagName==="tr"}function Ce(t,e,n){const s=f(n,e);return!s||s.type==="element"&&(s.tagName==="td"||s.tagName==="th")}const fn=$e({body:yn,colgroup:Cn,head:_n,html:gn,tbody:Rn});function gn(t){const e=f(t,-1);return!e||e.type!=="comment"}function _n(t){const e=new Set;for(const s of t.children)if(s.type==="element"&&(s.tagName==="base"||s.tagName==="title")){if(e.has(s.tagName))return!1;e.add(s.tagName)}const n=t.children[0];return!n||n.type==="element"}function yn(t){const e=f(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&ie(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function Cn(t,e,n){const s=Me(n,e),r=f(t,-1,!0);return n&&s&&s.type==="element"&&s.tagName==="colgroup"&&oe(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function Rn(t,e,n){const s=Me(n,e),r=f(t,-1);return n&&s&&s.type==="element"&&(s.tagName==="thead"||s.tagName==="tbody")&&oe(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}const B={name:[[`
|
|
4
4
|
\f\r &/=>`.split(""),`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./main-
|
|
2
|
-
import{_ as a}from"./preload-helper-PPVm8Dsz.js";(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))n(e);new MutationObserver(e=>{for(const t of e)if(t.type==="childList")for(const s of t.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function i(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?t.credentials="include":e.crossOrigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function n(e){if(e.ep)return;e.ep=!0;const t=i(e);fetch(e.href,t)}})();const c=!1;function d(r){return r instanceof Error?r.stack||r.message:String(r)}function l(r,{showDetails:o=c}={}){const i=document.getElementById("root");if(!i||i.childElementCount>0)return;const n=document.createElement("main");n.setAttribute("role","alert"),n.style.cssText='min-height:100vh;background:#0b0d10;color:#f4f4f5;font-family:"Mona Sans",ui-sans-serif,system-ui,sans-serif;font-feature-settings:"ss06" on;padding:32px;box-sizing:border-box;';const e=document.createElement("h1");e.textContent="Mastra Studio failed to start",e.style.cssText="font-size:20px;line-height:1.4;margin:0 0 8px;";const t=document.createElement("p");if(t.textContent=o?"The startup module failed before React could render. Check the Vite terminal and browser console for the original request details.":"The startup module failed before React could render. Run Studio in development mode to view detailed diagnostics.",t.style.cssText="color:#a1a1aa;max-width:760px;margin:0 0 20px;line-height:1.6;",n.append(e,t),o){const s=document.createElement("pre");s.textContent=d(r),s.style.cssText="white-space:pre-wrap;overflow:auto;background:#18181b;border:1px solid #3f3f46;border-radius:8px;padding:16px;max-width:100%;line-height:1.5;",n.append(s)}i.replaceChildren(n)}try{const{startStudio:r}=await a(async()=>{const{startStudio:o}=await import("./main-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./main-C7bJF57-.js","./preload-helper-PPVm8Dsz.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as a}from"./preload-helper-PPVm8Dsz.js";(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))n(e);new MutationObserver(e=>{for(const t of e)if(t.type==="childList")for(const s of t.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function i(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?t.credentials="include":e.crossOrigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function n(e){if(e.ep)return;e.ep=!0;const t=i(e);fetch(e.href,t)}})();const c=!1;function d(r){return r instanceof Error?r.stack||r.message:String(r)}function l(r,{showDetails:o=c}={}){const i=document.getElementById("root");if(!i||i.childElementCount>0)return;const n=document.createElement("main");n.setAttribute("role","alert"),n.style.cssText='min-height:100vh;background:#0b0d10;color:#f4f4f5;font-family:"Mona Sans",ui-sans-serif,system-ui,sans-serif;font-feature-settings:"ss06" on;padding:32px;box-sizing:border-box;';const e=document.createElement("h1");e.textContent="Mastra Studio failed to start",e.style.cssText="font-size:20px;line-height:1.4;margin:0 0 8px;";const t=document.createElement("p");if(t.textContent=o?"The startup module failed before React could render. Check the Vite terminal and browser console for the original request details.":"The startup module failed before React could render. Run Studio in development mode to view detailed diagnostics.",t.style.cssText="color:#a1a1aa;max-width:760px;margin:0 0 20px;line-height:1.6;",n.append(e,t),o){const s=document.createElement("pre");s.textContent=d(r),s.style.cssText="white-space:pre-wrap;overflow:auto;background:#18181b;border:1px solid #3f3f46;border-radius:8px;padding:16px;max-width:100%;line-height:1.5;",n.append(s)}i.replaceChildren(n)}try{const{startStudio:r}=await a(async()=>{const{startStudio:o}=await import("./main-C7bJF57-.js").then(i=>i.m);return{startStudio:o}},__vite__mapDeps([0,1]),import.meta.url);r()}catch(r){console.error("Mastra Studio failed to start",r),l(r)}
|