(y)
| 10 | \f\r "&'<=>\``.split(""),`\0 |
| 11 | \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function tr(n,e,t,a){const s=a.schema,i=s.space==="svg"?!1:a.settings.omitOptionalTags;let r=s.space==="svg"?a.settings.closeEmptyElements:a.settings.voids.includes(n.tagName.toLowerCase());const c=[];let o;s.space==="html"&&n.tagName==="svg"&&(a.schema=Ht);const l=ar(a,n.properties),u=a.all(s.space==="html"&&n.tagName==="template"?n.content:n);return a.schema=s,u&&(r=!1),(l||!i||!Yi(n,e,t))&&(c.push("<",n.tagName,l?" "+l:""),r&&(s.space==="svg"||a.settings.closeSelfClosing)&&(o=l.charAt(l.length-1),(!a.settings.tightSelfClosing||o==="/"||o&&o!=='"'&&o!=="'")&&c.push(" "),c.push("/")),c.push(">")),c.push(u),!r&&(!i||!zn(n,e,t))&&c.push("</"+n.tagName+">"),c.join("")}function ar(n,e){const t=[];let a=-1,s;if(e){for(s in e)if(e[s]!==null&&e[s]!==void 0){const i=sr(n,s,e[s]);i&&t.push(i)}}for(;++a<t.length;){const i=n.settings.tightAttributes?t[a].charAt(t[a].length-1):void 0;a!==t.length-1&&i!=='"'&&i!=="'"&&(t[a]+=" ")}return t.join("")}function sr(n,e,t){const a=oi(n.schema,e),s=n.settings.allowParseErrors&&n.schema.space==="html"?0:1,i=n.settings.allowDangerousCharacters?0:1;let r=n.quote,c;if(a.overloadedBoolean&&(t===a.attribute||t==="")?t=!0:(a.boolean||a.overloadedBoolean)&&(typeof t!="string"||t===a.attribute||t==="")&&(t=!!t),t==null||t===!1||typeof t=="number"&&Number.isNaN(t))return"";const o=ve(a.attribute,Object.assign({},n.settings.characterReferences,{subset:sn.name[s][i]}));return t===!0||(t=Array.isArray(t)?(a.commaSeparated?Bi:Gi)(t,{padLeft:!n.settings.tightCommaSeparatedLists}):String(t),n.settings.collapseEmptyAttributes&&!t)?o:(n.settings.preferUnquoted&&(c=ve(t,Object.assign({},n.settings.characterReferences,{attribute:!0,subset:sn.unquoted[s][i]}))),c!==t&&(n.settings.quoteSmart&&Yt(t,r)>Yt(t,n.alternative)&&(r=n.alternative),c=r+ve(t,Object.assign({},n.settings.characterReferences,{subset:(r==="'"?sn.single:sn.double)[s][i],attribute:!0}))+r),o+(c&&"="+c))}const ir=["<","&"];function aa(n,e,t,a){return t&&t.type==="element"&&(t.tagName==="script"||t.tagName==="style")?n.value:ve(n.value,Object.assign({},a.settings.characterReferences,{subset:ir}))}function rr(n,e,t,a){return a.settings.allowDangerousHtml?n.value:aa(n,e,t,a)}function or(n,e,t,a){return a.all(n)}const cr=mi("type",{invalid:lr,unknown:ur,handlers:{comment:Ni,doctype:Fi,element:tr,raw:rr,root:or,text:aa}});function lr(n){throw new Error("Expected node, not `"+n+"`")}function ur(n){const e=n;throw new Error("Cannot compile unknown node `"+e.type+"`")}const mr={},pr={},dr=[];function gr(n,e){const t=e||mr,a=t.quote||'"',s=a==='"'?"'":'"';if(a!=='"'&&a!=="'")throw new Error("Invalid quote `"+a+"`, expected `'` or `\"`");return{one:br,all:hr,settings:{omitOptionalTags:t.omitOptionalTags||!1,allowParseErrors:t.allowParseErrors||!1,allowDangerousCharacters:t.allowDangerousCharacters||!1,quoteSmart:t.quoteSmart||!1,preferUnquoted:t.preferUnquoted||!1,tightAttributes:t.tightAttributes||!1,upperDoctype:t.upperDoctype||!1,tightDoctype:t.tightDoctype||!1,bogusComments:t.bogusComments||!1,tightCommaSeparatedLists:t.tightCommaSeparatedLists||!1,tightSelfClosing:t.tightSelfClosing||!1,collapseEmptyAttributes:t.collapseEmptyAttributes||!1,allowDangerousHtml:t.allowDangerousHtml||!1,voids:t.voids||ni,characterReferences:t.characterReferences||pr,closeSelfClosing:t.closeSelfClosing||!1,closeEmptyElements:t.closeEmptyElements||!1},schema:t.space==="svg"?Ht:ui,quote:a,alternative:s}.one(Array.isArray(n)?{type:"root",children:n}:n,void 0,void 0)}function br(n,e,t){return cr(n,e,t,this)}function hr(n){const e=[],t=n&&n.children||dr;let a=-1;for(;++a<t.length;)e[a]=this.one(t[a],a,n);return e.join("")}function rn(n,e){const t=typeof n=="string"?{}:{...n.colorReplacements},a=typeof n=="string"?n:n.name;for(const[s,i]of Object.entries((e==null?void 0:e.colorReplacements)||{}))typeof i=="string"?t[s]=i:s===a&&Object.assign(t,i);return t}function re(n,e){return n&&((e==null?void 0:e[n==null?void 0:n.toLowerCase()])||n)}function fr(n){return Array.isArray(n)?n:[n]}async function sa(n){return Promise.resolve(typeof n=="function"?n():n).then(e=>e.default||e)}function Tn(n){return!n||["plaintext","txt","text","plain"].includes(n)}function yr(n){return n==="ansi"||Tn(n)}function On(n){return n==="none"}function _r(n){return On(n)}function ia(n,e){var a;if(!e)return n;n.properties||(n.properties={}),(a=n.properties).class||(a.class=[]),typeof n.properties.class=="string"&&(n.properties.class=n.properties.class.split(/\s+/g)),Array.isArray(n.properties.class)||(n.properties.class=[]);const t=Array.isArray(e)?e:e.split(/\s+/g);for(const s of t)s&&!n.properties.class.includes(s)&&n.properties.class.push(s);return n}function on(n,e=!1){var i;if(n.length===0)return[["",0]];const t=n.split(/(\r?\n)/g);let a=0;const s=[];for(let r=0;r<t.length;r+=2){const c=e?t[r]+(t[r+1]||""):t[r];s.push([c,a]),a+=t[r].length,a+=((i=t[r+1])==null?void 0:i.length)||0}return s}function $r(n){const e=on(n,!0).map(([s])=>s);function t(s){if(s===n.length)return{line:e.length-1,character:e[e.length-1].length};let i=s,r=0;for(const c of e){if(i<c.length)break;i-=c.length,r++}return{line:r,character:i}}function a(s,i){let r=0;for(let c=0;c<s;c++)r+=e[c].length;return r+=i,r}return{lines:e,indexToPos:t,posToIndex:a}}const Mn="light-dark()",xr=["color","background-color"];function wr(n,e){let t=0;const a=[];for(const s of e)s>t&&a.push({...n,content:n.content.slice(t,s),offset:n.offset+t}),t=s;return t<n.content.length&&a.push({...n,content:n.content.slice(t),offset:n.offset+t}),a}function kr(n,e){const t=Array.from(e instanceof Set?e:new Set(e)).sort((a,s)=>a-s);return t.length?n.map(a=>a.flatMap(s=>{const i=t.filter(r=>s.offset<r&&r<s.offset+s.content.length).map(r=>r-s.offset).sort((r,c)=>r-c);return i.length?wr(s,i):s})):n}function jr(n,e,t,a,s="css-vars"){const i={content:n.content,explanation:n.explanation,offset:n.offset},r=e.map(u=>cn(n.variants[u])),c=new Set(r.flatMap(u=>Object.keys(u))),o={},l=(u,m)=>{const p=m==="color"?"":m==="background-color"?"-bg":`-${m}`;return t+e[u]+(m==="color"?"":p)};return r.forEach((u,m)=>{for(const p of c){const g=u[p]||"inherit";if(m===0&&a&&xr.includes(p))if(a===Mn&&r.length>1){const d=e.findIndex(x=>x==="light"),f=e.findIndex(x=>x==="dark");if(d===-1||f===-1)throw new k('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const $=r[d][p]||"inherit",_=r[f][p]||"inherit";o[p]=`light-dark(${$}, ${_})`,s==="css-vars"&&(o[l(m,p)]=g)}else o[p]=g;else s==="css-vars"&&(o[l(m,p)]=g)}}),i.htmlStyle=o,i}function cn(n){const e={};if(n.color&&(e.color=n.color),n.bgColor&&(e["background-color"]=n.bgColor),n.fontStyle){n.fontStyle&z.Italic&&(e["font-style"]="italic"),n.fontStyle&z.Bold&&(e["font-weight"]="bold");const t=[];n.fontStyle&z.Underline&&t.push("underline"),n.fontStyle&z.Strikethrough&&t.push("line-through"),t.length&&(e["text-decoration"]=t.join(" "))}return e}function Dn(n){return typeof n=="string"?n:Object.entries(n).map(([e,t])=>`${e}:${t}`).join(";")}const ra=new WeakMap;function ln(n,e){ra.set(n,e)}function De(n){return ra.get(n)}class Ce{constructor(...e){b(this,"_stacks",{});b(this,"lang");if(e.length===2){const[t,a]=e;this.lang=a,this._stacks=t}else{const[t,a,s]=e;this.lang=a,this._stacks={[s]:t}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,t){return new Ce(Object.fromEntries(fr(t).map(a=>[a,qn])),e)}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return vr(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function vr(n){const e=[],t=new Set;function a(s){var r;if(t.has(s))return;t.add(s);const i=(r=s==null?void 0:s.nameScopesList)==null?void 0:r.scopeName;i&&e.push(i),s.parent&&a(s.parent)}return a(n),e}function Cr(n,e){if(!(n instanceof Ce))throw new k("Invalid grammar state");return n.getInternalStack(e)}function Sr(){const n=new WeakMap;function e(t){if(!n.has(t.meta)){let a=function(r){if(typeof r=="number"){if(r<0||r>t.source.length)throw new k(`Invalid decoration offset: ${r}. Code length: ${t.source.length}`);return{...s.indexToPos(r),offset:r}}else{const c=s.lines[r.line];if(c===void 0)throw new k(`Invalid decoration position ${JSON.stringify(r)}. Lines length: ${s.lines.length}`);let o=r.character;if(o<0&&(o=c.length+o),o<0||o>c.length)throw new k(`Invalid decoration position ${JSON.stringify(r)}. Line ${r.line} length: ${c.length}`);return{...r,character:o,offset:s.posToIndex(r.line,o)}}};const s=$r(t.source),i=(t.options.decorations||[]).map(r=>({...r,start:a(r.start),end:a(r.end)}));Er(i),n.set(t.meta,{decorations:i,converter:s,source:t.source})}return n.get(t.meta)}return{name:"shiki:decorations",tokens(t){var r;if(!((r=this.options.decorations)!=null&&r.length))return;const s=e(this).decorations.flatMap(c=>[c.start.offset,c.end.offset]);return kr(t,s)},code(t){var u;if(!((u=this.options.decorations)!=null&&u.length))return;const a=e(this),s=Array.from(t.children).filter(m=>m.type==="element"&&m.tagName==="span");if(s.length!==a.converter.lines.length)throw new k(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${a.converter.lines.length}). Failed to apply decorations.`);function i(m,p,g,d){const f=s[m];let $="",_=-1,x=-1;if(p===0&&(_=0),g===0&&(x=0),g===Number.POSITIVE_INFINITY&&(x=f.children.length),_===-1||x===-1)for(let w=0;w<f.children.length;w++)$+=oa(f.children[w]),_===-1&&$.length===p&&(_=w+1),x===-1&&$.length===g&&(x=w+1);if(_===-1)throw new k(`Failed to find start index for decoration ${JSON.stringify(d.start)}`);if(x===-1)throw new k(`Failed to find end index for decoration ${JSON.stringify(d.end)}`);const y=f.children.slice(_,x);if(!d.alwaysWrap&&y.length===f.children.length)c(f,d,"line");else if(!d.alwaysWrap&&y.length===1&&y[0].type==="element")c(y[0],d,"token");else{const w={type:"element",tagName:"span",properties:{},children:y};c(w,d,"wrapper"),f.children.splice(_,y.length,w)}}function r(m,p){s[m]=c(s[m],p,"line")}function c(m,p,g){var $;const d=p.properties||{},f=p.transform||(_=>_);return m.tagName=p.tagName||"span",m.properties={...m.properties,...d,class:m.properties.class},($=p.properties)!=null&&$.class&&ia(m,p.properties.class),m=f(m,g)||m,m}const o=[],l=a.decorations.sort((m,p)=>p.start.offset-m.start.offset||m.end.offset-p.end.offset);for(const m of l){const{start:p,end:g}=m;if(p.line===g.line)i(p.line,p.character,g.character,m);else if(p.line<g.line){i(p.line,p.character,Number.POSITIVE_INFINITY,m);for(let d=p.line+1;d<g.line;d++)o.unshift(()=>r(d,m));i(g.line,0,g.character,m)}}o.forEach(m=>m())}}}function Er(n){for(let e=0;e<n.length;e++){const t=n[e];if(t.start.offset>t.end.offset)throw new k(`Invalid decoration range: ${JSON.stringify(t.start)} - ${JSON.stringify(t.end)}`);for(let a=e+1;a<n.length;a++){const s=n[a],i=t.start.offset<=s.start.offset&&s.start.offset<t.end.offset,r=t.start.offset<s.end.offset&&s.end.offset<=t.end.offset,c=s.start.offset<=t.start.offset&&t.start.offset<s.end.offset,o=s.start.offset<t.end.offset&&t.end.offset<=s.end.offset;if(i||r||c||o){if(i&&r||c&&o||c&&t.start.offset===t.end.offset||r&&s.start.offset===s.end.offset)continue;throw new k(`Decorations ${JSON.stringify(t.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function oa(n){return n.type==="text"?n.value:n.type==="element"?n.children.map(oa).join(""):""}const qr=[Sr()];function un(n){const e=Ar(n.transformers||[]);return[...e.pre,...e.normal,...e.post,...qr]}function Ar(n){const e=[],t=[],a=[];for(const s of n)switch(s.enforce){case"pre":e.push(s);break;case"post":t.push(s);break;default:a.push(s)}return{pre:e,post:t,normal:a}}var ge=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Un={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Nr(n,e){const t=n.indexOf("\x1B",e);if(t!==-1&&n[t+1]==="["){const a=n.indexOf("m",t);if(a!==-1)return{sequence:n.substring(t+2,a).split(";"),startPosition:t,position:a+1}}return{position:n.length}}function ca(n){const e=n.shift();if(e==="2"){const t=n.splice(0,3).map(a=>Number.parseInt(a));return t.length!==3||t.some(a=>Number.isNaN(a))?void 0:{type:"rgb",rgb:t}}else if(e==="5"){const t=n.shift();if(t)return{type:"table",index:Number(t)}}}function Fr(n){const e=[];for(;n.length>0;){const t=n.shift();if(!t)continue;const a=Number.parseInt(t);if(!Number.isNaN(a))if(a===0)e.push({type:"resetAll"});else if(a<=9)Un[a]&&e.push({type:"setDecoration",value:Un[a]});else if(a<=29){const s=Un[a-20];s&&(e.push({type:"resetDecoration",value:s}),s==="dim"&&e.push({type:"resetDecoration",value:"bold"}))}else if(a<=37)e.push({type:"setForegroundColor",value:{type:"named",name:ge[a-30]}});else if(a===38){const s=ca(n);s&&e.push({type:"setForegroundColor",value:s})}else if(a===39)e.push({type:"resetForegroundColor"});else if(a<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:ge[a-40]}});else if(a===48){const s=ca(n);s&&e.push({type:"setBackgroundColor",value:s})}else a===49?e.push({type:"resetBackgroundColor"}):a===53?e.push({type:"setDecoration",value:"overline"}):a===55?e.push({type:"resetDecoration",value:"overline"}):a>=90&&a<=97?e.push({type:"setForegroundColor",value:{type:"named",name:ge[a-90+8]}}):a>=100&&a<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:ge[a-100+8]}})}return e}function Br(){let n=null,e=null,t=new Set;return{parse(a){const s=[];let i=0;do{const r=Nr(a,i),c=r.sequence?a.substring(i,r.startPosition):a.substring(i);if(c.length>0&&s.push({value:c,foreground:n,background:e,decorations:new Set(t)}),r.sequence){const o=Fr(r.sequence);for(const l of o)l.type==="resetAll"?(n=null,e=null,t.clear()):l.type==="resetForegroundColor"?n=null:l.type==="resetBackgroundColor"?e=null:l.type==="resetDecoration"&&t.delete(l.value);for(const l of o)l.type==="setForegroundColor"?n=l.value:l.type==="setBackgroundColor"?e=l.value:l.type==="setDecoration"&&t.add(l.value)}i=r.position}while(i<a.length);return s}}}var Gr={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 Ir(n=Gr){function e(c){return n[c]}function t(c){return`#${c.map(o=>Math.max(0,Math.min(o,255)).toString(16).padStart(2,"0")).join("")}`}let a;function s(){if(a)return a;a=[];for(let l=0;l<ge.length;l++)a.push(e(ge[l]));let c=[0,95,135,175,215,255];for(let l=0;l<6;l++)for(let u=0;u<6;u++)for(let m=0;m<6;m++)a.push(t([c[l],c[u],c[m]]));let o=8;for(let l=0;l<24;l++,o+=10)a.push(t([o,o,o]));return a}function i(c){return s()[c]}function r(c){switch(c.type){case"named":return e(c.name);case"rgb":return t(c.rgb);case"table":return i(c.index)}}return{value:r}}const Rr={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function Pr(n,e,t){const a=rn(n,t),s=on(e),i=Object.fromEntries(ge.map(o=>{var m;const l=`terminal.ansi${o[0].toUpperCase()}${o.substring(1)}`,u=(m=n.colors)==null?void 0:m[l];return[o,u||Rr[o]]})),r=Ir(i),c=Br();return s.map(o=>c.parse(o[0]).map(l=>{let u,m;l.decorations.has("reverse")?(u=l.background?r.value(l.background):n.bg,m=l.foreground?r.value(l.foreground):n.fg):(u=l.foreground?r.value(l.foreground):n.fg,m=l.background?r.value(l.background):void 0),u=re(u,a),m=re(m,a),l.decorations.has("dim")&&(u=zr(u));let p=z.None;return l.decorations.has("bold")&&(p|=z.Bold),l.decorations.has("italic")&&(p|=z.Italic),l.decorations.has("underline")&&(p|=z.Underline),l.decorations.has("strikethrough")&&(p|=z.Strikethrough),{content:l.value,offset:o[1],color:u,bgColor:m,fontStyle:p}}))}function zr(n){const e=n.match(/#([0-9a-f]{3,8})/i);if(e){const a=e[1];if(a.length===8){const s=Math.round(Number.parseInt(a.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${a.slice(0,6)}${s}`}else{if(a.length===6)return`#${a}80`;if(a.length===4){const s=a[0],i=a[1],r=a[2],c=a[3],o=Math.round(Number.parseInt(`${c}${c}`,16)/2).toString(16).padStart(2,"0");return`#${s}${s}${i}${i}${r}${r}${o}`}else if(a.length===3){const s=a[0],i=a[1],r=a[2];return`#${s}${s}${i}${i}${r}${r}80`}}}const t=n.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return t?`var(${t[1]}-dim)`:n}function Zn(n,e,t={}){const{theme:a=n.getLoadedThemes()[0]}=t,s=n.resolveLangAlias(t.lang||"text");if(Tn(s)||On(a))return on(e).map(o=>[{content:o[0],offset:o[1]}]);const{theme:i,colorMap:r}=n.setTheme(a);if(s==="ansi")return Pr(i,e,t);const c=n.getLanguage(t.lang||"text");if(t.grammarState){if(t.grammarState.lang!==c.name)throw new k(`Grammar state language "${t.grammarState.lang}" does not match highlight language "${c.name}"`);if(!t.grammarState.themes.includes(i.name))throw new k(`Grammar state themes "${t.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Tr(e,c,i,r,t)}function Lr(...n){if(n.length===2)return De(n[1]);const[e,t,a={}]=n,{lang:s="text",theme:i=e.getLoadedThemes()[0]}=a;if(Tn(s)||On(i))throw new k("Plain language does not have grammar state");if(s==="ansi")throw new k("ANSI language does not have grammar state");const{theme:r,colorMap:c}=e.setTheme(i),o=e.getLanguage(s);return new Ce(Hn(t,o,r,c,a).stateStack,o.name,r.name)}function Tr(n,e,t,a,s){const i=Hn(n,e,t,a,s),r=new Ce(i.stateStack,e.name,t.name);return ln(i.tokens,r),i.tokens}function Hn(n,e,t,a,s){var p;const i=rn(t,s),{tokenizeMaxLineLength:r=0,tokenizeTimeLimit:c=500}=s,o=on(n);let l=s.grammarState?(p=Cr(s.grammarState,t.name))!=null?p:qn:s.grammarContextCode!=null?Hn(s.grammarContextCode,e,t,a,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:qn,u=[];const m=[];for(let g=0,d=o.length;g<d;g++){const[f,$]=o[g];if(f===""){u=[],m.push([]);continue}if(r>0&&f.length>=r){u=[],m.push([{content:f,offset:$,color:"",fontStyle:0}]);continue}let _,x,y;s.includeExplanation&&(_=e.tokenizeLine(f,l,c),x=_.tokens,y=0);const w=e.tokenizeLine2(f,l,c),C=w.tokens.length/2;for(let E=0;E<C;E++){const S=w.tokens[2*E],D=E+1<C?w.tokens[2*E+2]:f.length;if(S===D)continue;const G=w.tokens[2*E+1],T=re(a[we.getForeground(G)],i),Ge=we.getFontStyle(G),se={content:f.substring(S,D),offset:$+S,color:T,fontStyle:Ge};if(s.includeExplanation){const pe=[];if(s.includeExplanation!=="scopeName")for(const ie of t.settings){let Ie;switch(typeof ie.scope){case"string":Ie=ie.scope.split(/,/).map(mt=>mt.trim());break;case"object":Ie=ie.scope;break;default:continue}pe.push({settings:ie,selectors:Ie.map(mt=>mt.split(/ /))})}se.explanation=[];let ps=0;for(;S+ps<D;){const ie=x[y],Ie=f.substring(ie.startIndex,ie.endIndex);ps+=Ie.length,se.explanation.push({content:Ie,scopes:s.includeExplanation==="scopeName"?Or(ie.scopes):Mr(pe,ie.scopes)}),y+=1}}u.push(se)}m.push(u),u=[],l=w.ruleStack}return{tokens:m,stateStack:l}}function Or(n){return n.map(e=>({scopeName:e}))}function Mr(n,e){const t=[];for(let a=0,s=e.length;a<s;a++){const i=e[a];t[a]={scopeName:i,themeMatches:Ur(n,i,e.slice(0,a))}}return t}function la(n,e){return n===e||e.substring(0,n.length)===n&&e[n.length]==="."}function Dr(n,e,t){if(!la(n[n.length-1],e))return!1;let a=n.length-2,s=t.length-1;for(;a>=0&&s>=0;)la(n[a],t[s])&&(a-=1),s-=1;return a===-1}function Ur(n,e,t){const a=[];for(const{selectors:s,settings:i}of n)for(const r of s)if(Dr(r,e,t)){a.push(i);break}return a}function ua(n,e,t){const a=Object.entries(t.themes).filter(o=>o[1]).map(o=>({color:o[0],theme:o[1]})),s=a.map(o=>{const l=Zn(n,e,{...t,theme:o.theme}),u=De(l),m=typeof o.theme=="string"?o.theme:o.theme.name;return{tokens:l,state:u,theme:m}}),i=Zr(...s.map(o=>o.tokens)),r=i[0].map((o,l)=>o.map((u,m)=>{const p={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in t&&t.includeExplanation&&(p.explanation=u.explanation),i.forEach((g,d)=>{const{content:f,explanation:$,offset:_,...x}=g[l][m];p.variants[a[d].color]=x}),p})),c=s[0].state?new Ce(Object.fromEntries(s.map(o=>{var l;return[o.theme,(l=o.state)==null?void 0:l.getInternalStack(o.theme)]})),s[0].state.lang):void 0;return c&&ln(r,c),r}function Zr(...n){const e=n.map(()=>[]),t=n.length;for(let a=0;a<n[0].length;a++){const s=n.map(o=>o[a]),i=e.map(()=>[]);e.forEach((o,l)=>o.push(i[l]));const r=s.map(()=>0),c=s.map(o=>o[0]);for(;c.every(o=>o);){const o=Math.min(...c.map(l=>l.content.length));for(let l=0;l<t;l++){const u=c[l];u.content.length===o?(i[l].push(u),r[l]+=1,c[l]=s[l][r[l]]):(i[l].push({...u,content:u.content.slice(0,o)}),c[l]={...u,content:u.content.slice(o),offset:u.offset+o})}}}return e}function mn(n,e,t){let a,s,i,r,c,o;if("themes"in t){const{defaultColor:l="light",cssVariablePrefix:u="--shiki-",colorsRendering:m="css-vars"}=t,p=Object.entries(t.themes).filter(_=>_[1]).map(_=>({color:_[0],theme:_[1]})).sort((_,x)=>_.color===l?-1:x.color===l?1:0);if(p.length===0)throw new k("`themes` option must not be empty");const g=ua(n,e,t);if(o=De(g),l&&Mn!==l&&!p.find(_=>_.color===l))throw new k(`\`themes\` option must contain the defaultColor key \`${l}\``);const d=p.map(_=>n.getTheme(_.theme)),f=p.map(_=>_.color);i=g.map(_=>_.map(x=>jr(x,f,u,l,m))),o&&ln(i,o);const $=p.map(_=>rn(_.theme,t));s=ma(p,d,$,u,l,"fg",m),a=ma(p,d,$,u,l,"bg",m),r=`shiki-themes ${d.map(_=>_.name).join(" ")}`,c=l?void 0:[s,a].join(";")}else if("theme"in t){const l=rn(t.theme,t);i=Zn(n,e,t);const u=n.getTheme(t.theme);a=re(u.bg,l),s=re(u.fg,l),r=u.name,o=De(i)}else throw new k("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:s,bg:a,themeName:r,rootStyle:c,grammarState:o}}function ma(n,e,t,a,s,i,r){return n.map((c,o)=>{const l=re(e[o][i],t[o])||"inherit",u=`${a+c.color}${i==="bg"?"-bg":""}:${l}`;if(o===0&&s){if(s===Mn&&n.length>1){const m=n.findIndex(f=>f.color==="light"),p=n.findIndex(f=>f.color==="dark");if(m===-1||p===-1)throw new k('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const g=re(e[m][i],t[m])||"inherit",d=re(e[p][i],t[p])||"inherit";return`light-dark(${g}, ${d});${u}`}return l}return r==="css-vars"?u:null}).filter(c=>!!c).join(";")}function pn(n,e,t,a={meta:{},options:t,codeToHast:(s,i)=>pn(n,s,i),codeToTokens:(s,i)=>mn(n,s,i)}){var d,f,$;let s=e;for(const _ of un(t))s=((d=_.preprocess)==null?void 0:d.call(a,s,t))||s;let{tokens:i,fg:r,bg:c,themeName:o,rootStyle:l,grammarState:u}=mn(n,s,t);const{mergeWhitespaces:m=!0,mergeSameStyleTokens:p=!1}=t;m===!0?i=Wr(i):m==="never"&&(i=Vr(i)),p&&(i=Xr(i));const g={...a,get source(){return s}};for(const _ of un(t))i=((f=_.tokens)==null?void 0:f.call(g,i))||i;return Hr(i,{...t,fg:r,bg:c,themeName:o,rootStyle:t.rootStyle===!1?!1:($=t.rootStyle)!=null?$:l},g,u)}function Hr(n,e,t,a=De(n)){var f,$,_,x;const s=un(e),i=[],r={type:"root",children:[]},{structure:c="classic",tabindex:o="0"}=e,l={class:`shiki ${e.themeName||""}`};e.rootStyle!==!1&&(e.rootStyle!=null?l.style=e.rootStyle:l.style=`background-color:${e.bg};color:${e.fg}`),o!==!1&&o!=null&&(l.tabindex=o.toString());for(const[y,w]of Object.entries(e.meta||{}))y.startsWith("_")||(l[y]=w);let u={type:"element",tagName:"pre",properties:l,children:[],data:e.data},m={type:"element",tagName:"code",properties:{},children:i};const p=[],g={...t,structure:c,addClassToHast:ia,get source(){return t.source},get tokens(){return n},get options(){return e},get root(){return r},get pre(){return u},get code(){return m},get lines(){return p}};if(n.forEach((y,w)=>{var S,D;w&&(c==="inline"?r.children.push({type:"element",tagName:"br",properties:{},children:[]}):c==="classic"&&i.push({type:"text",value:` |
| 12 | `}));let C={type:"element",tagName:"span",properties:{class:"line"},children:[]},E=0;for(const G of y){let T={type:"element",tagName:"span",properties:{...G.htmlAttrs},children:[{type:"text",value:G.content}]};const Ge=Dn(G.htmlStyle||cn(G));Ge&&(T.properties.style=Ge);for(const se of s)T=((S=se==null?void 0:se.span)==null?void 0:S.call(g,T,w+1,E,C,G))||T;c==="inline"?r.children.push(T):c==="classic"&&C.children.push(T),E+=G.content.length}if(c==="classic"){for(const G of s)C=((D=G==null?void 0:G.line)==null?void 0:D.call(g,C,w+1))||C;p.push(C),i.push(C)}else c==="inline"&&p.push(C)}),c==="classic"){for(const y of s)m=((f=y==null?void 0:y.code)==null?void 0:f.call(g,m))||m;u.children.push(m);for(const y of s)u=(($=y==null?void 0:y.pre)==null?void 0:$.call(g,u))||u;r.children.push(u)}else if(c==="inline"){const y=[];let w={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const S of r.children)S.type==="element"&&S.tagName==="br"?(y.push(w),w={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(S.type==="element"||S.type==="text")&&w.children.push(S);y.push(w);let E={type:"element",tagName:"code",properties:{},children:y};for(const S of s)E=((_=S==null?void 0:S.code)==null?void 0:_.call(g,E))||E;r.children=[];for(let S=0;S<E.children.length;S++){S>0&&r.children.push({type:"element",tagName:"br",properties:{},children:[]});const D=E.children[S];D.type==="element"&&r.children.push(...D.children)}}let d=r;for(const y of s)d=((x=y==null?void 0:y.root)==null?void 0:x.call(g,d))||d;return a&&ln(d,a),d}function Wr(n){return n.map(e=>{const t=[];let a="",s;return e.forEach((i,r)=>{const o=!(i.fontStyle&&(i.fontStyle&z.Underline||i.fontStyle&z.Strikethrough));o&&i.content.match(/^\s+$/)&&e[r+1]?(s===void 0&&(s=i.offset),a+=i.content):a?(o?t.push({...i,offset:s,content:a+i.content}):t.push({content:a,offset:s},i),s=void 0,a=""):t.push(i)}),t})}function Vr(n){return n.map(e=>e.flatMap(t=>{if(t.content.match(/^\s+$/))return t;const a=t.content.match(/^(\s*)(.*?)(\s*)$/);if(!a)return t;const[,s,i,r]=a;if(!s&&!r)return t;const c=[{...t,offset:t.offset+s.length,content:i}];return s&&c.unshift({content:s,offset:t.offset}),r&&c.push({content:r,offset:t.offset+s.length+i.length}),c}))}function Xr(n){return n.map(e=>{const t=[];for(const a of e){if(t.length===0){t.push({...a});continue}const s=t[t.length-1],i=Dn(s.htmlStyle||cn(s)),r=Dn(a.htmlStyle||cn(a)),c=s.fontStyle&&(s.fontStyle&z.Underline||s.fontStyle&z.Strikethrough),o=a.fontStyle&&(a.fontStyle&z.Underline||a.fontStyle&z.Strikethrough);!c&&!o&&i===r?s.content+=a.content:t.push({...a})}return t})}const Yr=gr;function Jr(n,e,t){var i;const a={meta:{},options:t,codeToHast:(r,c)=>pn(n,r,c),codeToTokens:(r,c)=>mn(n,r,c)};let s=Yr(pn(n,e,t,a));for(const r of un(t))s=((i=r.postprocess)==null?void 0:i.call(a,s,t))||s;return s}const pa={light:"#333333",dark:"#bbbbbb"},da={light:"#fffffe",dark:"#1e1e1e"},ga="__shiki_resolved";function Wn(n){var c,o,l,u,m;if(n!=null&&n[ga])return n;const e={...n};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||(e.type="dark"),e.colorReplacements={...e.colorReplacements},e.settings||(e.settings=[]);let{bg:t,fg:a}=e;if(!t||!a){const p=e.settings?e.settings.find(g=>!g.name&&!g.scope):void 0;(c=p==null?void 0:p.settings)!=null&&c.foreground&&(a=p.settings.foreground),(o=p==null?void 0:p.settings)!=null&&o.background&&(t=p.settings.background),!a&&((l=e==null?void 0:e.colors)!=null&&l["editor.foreground"])&&(a=e.colors["editor.foreground"]),!t&&((u=e==null?void 0:e.colors)!=null&&u["editor.background"])&&(t=e.colors["editor.background"]),a||(a=e.type==="light"?pa.light:pa.dark),t||(t=e.type==="light"?da.light:da.dark),e.fg=a,e.bg=t}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let s=0;const i=new Map;function r(p){var d;if(i.has(p))return i.get(p);s+=1;const g=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return(d=e.colorReplacements)!=null&&d[`#${g}`]?r(p):(i.set(p,g),g)}e.settings=e.settings.map(p=>{var $,_;const g=(($=p.settings)==null?void 0:$.foreground)&&!p.settings.foreground.startsWith("#"),d=((_=p.settings)==null?void 0:_.background)&&!p.settings.background.startsWith("#");if(!g&&!d)return p;const f={...p,settings:{...p.settings}};if(g){const x=r(p.settings.foreground);e.colorReplacements[x]=p.settings.foreground,f.settings.foreground=x}if(d){const x=r(p.settings.background);e.colorReplacements[x]=p.settings.background,f.settings.background=x}return f});for(const p of Object.keys(e.colors||{}))if((p==="editor.foreground"||p==="editor.background"||p.startsWith("terminal.ansi"))&&!((m=e.colors[p])!=null&&m.startsWith("#"))){const g=r(e.colors[p]);e.colorReplacements[g]=e.colors[p],e.colors[p]=g}return Object.defineProperty(e,ga,{enumerable:!1,writable:!1,value:!0}),e}async function Qr(n){return Array.from(new Set((await Promise.all(n.filter(e=>!yr(e)).map(async e=>await sa(e).then(t=>Array.isArray(t)?t:[t])))).flat()))}async function Kr(n){return(await Promise.all(n.map(async t=>_r(t)?null:Wn(await sa(t))))).filter(t=>!!t)}class Se extends Error{constructor(e){super(e),this.name="ShikiError"}}function ba(n,e){if(!e)return n;if(e[n]){const t=new Set([n]);for(;e[n];){if(n=e[n],t.has(n))throw new Se(`Circular alias \`${Array.from(t).join(" -> ")} -> ${n}\``);t.add(n)}}return n}class eo extends ei{constructor(t,a,s,i={}){super(t);b(this,"_resolvedThemes",new Map);b(this,"_resolvedGrammars",new Map);b(this,"_langMap",new Map);b(this,"_langGraph",new Map);b(this,"_textmateThemeCache",new WeakMap);b(this,"_loadedThemesCache",null);b(this,"_loadedLanguagesCache",null);this._resolver=t,this._themes=a,this._langs=s,this._alias=i,this._themes.map(r=>this.loadTheme(r)),this.loadLanguages(this._langs)}getTheme(t){return typeof t=="string"?this._resolvedThemes.get(t):this.loadTheme(t)}loadTheme(t){const a=Wn(t);return a.name&&(this._resolvedThemes.set(a.name,a),this._loadedThemesCache=null),a}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(t){let a=this._textmateThemeCache.get(t);a||(a=Je.createFromRawTheme(t),this._textmateThemeCache.set(t,a)),this._syncRegistry.setTheme(a)}getGrammar(t){return t=ba(t,this._alias),this._resolvedGrammars.get(t)}loadLanguage(t){var r,c,o,l;if(this.getGrammar(t.name))return;const a=new Set([...this._langMap.values()].filter(u=>{var m;return(m=u.embeddedLangsLazy)==null?void 0:m.includes(t.name)}));this._resolver.addLanguage(t);const s={balancedBracketSelectors:t.balancedBracketSelectors||["*"],unbalancedBracketSelectors:t.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(t.scopeName,t);const i=this.loadGrammarWithConfiguration(t.scopeName,1,s);if(i.name=t.name,this._resolvedGrammars.set(t.name,i),t.aliases&&t.aliases.forEach(u=>{this._alias[u]=t.name}),this._loadedLanguagesCache=null,a.size)for(const u of a)this._resolvedGrammars.delete(u.name),this._loadedLanguagesCache=null,(c=(r=this._syncRegistry)==null?void 0:r._injectionGrammars)==null||c.delete(u.scopeName),(l=(o=this._syncRegistry)==null?void 0:o._grammars)==null||l.delete(u.scopeName),this.loadLanguage(this._langMap.get(u.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(t){for(const i of t)this.resolveEmbeddedLanguages(i);const a=Array.from(this._langGraph.entries()),s=a.filter(([i,r])=>!r);if(s.length){const i=a.filter(([r,c])=>{if(!c)return!1;const o=c.embeddedLanguages||c.embeddedLangs;return o==null?void 0:o.some(l=>s.map(([u])=>u).includes(l))}).filter(r=>!s.includes(r));throw new Se(`Missing languages ${s.map(([r])=>`\`${r}\``).join(", ")}, required by ${i.map(([r])=>`\`${r}\``).join(", ")}`)}for(const[i,r]of a)this._resolver.addLanguage(r);for(const[i,r]of a)this.loadLanguage(r)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(t){var s;this._langMap.set(t.name,t),this._langGraph.set(t.name,t);const a=(s=t.embeddedLanguages)!=null?s:t.embeddedLangs;if(a)for(const i of a)this._langGraph.set(i,this._langMap.get(i))}}class no{constructor(e,t){b(this,"_langs",new Map);b(this,"_scopeToLang",new Map);b(this,"_injections",new Map);b(this,"_onigLib");this._onigLib={createOnigScanner:a=>e.createScanner(a),createOnigString:a=>e.createString(a)},t.forEach(a=>this.addLanguage(a))}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 a=[];for(let s=1;s<=t.length;s++){const i=t.slice(0,s).join(".");a=[...a,...this._injections.get(i)||[]]}return a}}let Ue=0;function to(n){Ue+=1,n.warnings!==!1&&Ue>=10&&Ue%10===0&&console.warn(`[Shiki] ${Ue} 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 Se("`engine` option is required for synchronous mode");const t=(n.langs||[]).flat(1),a=(n.themes||[]).flat(1).map(Wn),s=new no(n.engine,t),i=new eo(s,a,t,n.langAlias);let r;function c(y){return ba(y,n.langAlias)}function o(y){_();const w=i.getGrammar(typeof y=="string"?y:y.name);if(!w)throw new Se(`Language \`${y}\` not found, you may need to load it first`);return w}function l(y){if(y==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};_();const w=i.getTheme(y);if(!w)throw new Se(`Theme \`${y}\` not found, you may need to load it first`);return w}function u(y){_();const w=l(y);r!==y&&(i.setTheme(w),r=y);const C=i.getColorMap();return{theme:w,colorMap:C}}function m(){return _(),i.getLoadedThemes()}function p(){return _(),i.getLoadedLanguages()}function g(...y){_(),i.loadLanguages(y.flat(1))}async function d(...y){return g(await Qr(y))}function f(...y){_();for(const w of y.flat(1))i.loadTheme(w)}async function $(...y){return _(),f(await Kr(y))}function _(){if(e)throw new Se("Shiki instance has been disposed")}function x(){e||(e=!0,i.dispose(),Ue-=1)}return{setTheme:u,getTheme:l,getLanguage:o,getLoadedThemes:m,getLoadedLanguages:p,resolveLangAlias:c,loadLanguage:d,loadLanguageSync:g,loadTheme:$,loadThemeSync:f,dispose:x,[Symbol.dispose]:x}}function ao(n){const e=to(n);return{getLastGrammarState:(...t)=>Lr(e,...t),codeToTokensBase:(t,a)=>Zn(e,t,a),codeToTokensWithThemes:(t,a)=>ua(e,t,a),codeToTokens:(t,a)=>mn(e,t,a),codeToHast:(t,a)=>pn(e,t,a),codeToHtml:(t,a)=>Jr(e,t,a),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...e,getInternalContext:()=>e}}function Ee(n){if([...n].length!==1)throw new Error(`Expected "${n}" to be a single code point`);return n.codePointAt(0)}function so(n,e,t){return n.has(e)||n.set(e,t),n.get(e)}const Vn=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),P=String.raw;function qe(n,e){if(n==null)throw new Error(e!=null?e:"Value expected");return n}const ha=P`\[\^?`,fa=`c.? | C(?:-.?)?|${P`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${P`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${P`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${P`o\{[^\}]*\}?`}|${P`\d{1,3}`}`,Xn=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,dn=new RegExp(P` |
| 13 | \\ (?: |
| 14 | ${fa} |
| 15 | | [gk]<[^>]*>? |
no test coverage detected