@openchamber/web 1.4.7 → 1.4.9

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.
@@ -150,4 +150,4 @@ XID_Start XIDS`.split(/\s/).map(t=>[it(t),t])),vo=new Map([["s",R(383)],[R(383),
150
150
  \f\r "&'<=>\``.split(""),`\0
151
151
  \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Vi(t,e,n,r){const s=r.schema,o=s.space==="svg"?!1:r.settings.omitOptionalTags;let a=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const i=[];let l;s.space==="html"&&t.tagName==="svg"&&(r.schema=rs);const c=Xi(r,t.properties),u=r.all(s.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=s,u&&(a=!1),(c||!o||!ji(t,e,n))&&(i.push("<",t.tagName,c?" "+c:""),a&&(s.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&i.push(" "),i.push("/")),i.push(">")),i.push(u),!a&&(!o||!on(t,e,n))&&i.push("</"+t.tagName+">"),i.join("")}function Xi(t,e){const n=[];let r=-1,s;if(e){for(s in e)if(e[s]!==null&&e[s]!==void 0){const o=Ki(t,s,e[s]);o&&n.push(o)}}for(;++r<n.length;){const o=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&o!=='"'&&o!=="'"&&(n[r]+=" ")}return n.join("")}function Ki(t,e,n){const r=Ya(t.schema,e),s=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,o=t.settings.allowDangerousCharacters?0:1;let a=t.quote,i;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=pe(r.attribute,Object.assign({},t.settings.characterReferences,{subset:ze.name[s][o]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?vi:xi)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?l:(t.settings.preferUnquoted&&(i=pe(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:ze.unquoted[s][o]}))),i!==n&&(t.settings.quoteSmart&&Hn(n,a)>Hn(n,t.alternative)&&(a=t.alternative),i=a+pe(n,Object.assign({},t.settings.characterReferences,{subset:(a==="'"?ze.single:ze.double)[s][o],attribute:!0}))+a),l+(i&&"="+i))}const Zi=["<","&"];function ls(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:pe(t.value,Object.assign({},r.settings.characterReferences,{subset:Zi}))}function Qi(t,e,n,r){return r.settings.allowDangerousHtml?t.value:ls(t,e,n,r)}function Yi(t,e,n,r){return r.all(t)}const Ji=ni("type",{invalid:el,unknown:tl,handlers:{comment:Si,doctype:ki,element:Vi,raw:Qi,root:Yi,text:ls}});function el(t){throw new Error("Expected node, not `"+t+"`")}function tl(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const nl={},rl={},sl=[];function ol(t,e){const n=e||nl,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:al,all:il,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Ha,characterReferences:n.characterReferences||rl,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?rs:ti,quote:r,alternative:s}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function al(t,e,n){return Ji(t,e,n,this)}function il(t){const e=[],n=t&&t.children||sl;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}function et(t,e){const n=typeof t=="string"?{}:{...t.colorReplacements},r=typeof t=="string"?t:t.name;for(const[s,o]of Object.entries(e?.colorReplacements||{}))typeof o=="string"?n[s]=o:s===r&&Object.assign(n,o);return n}function J(t,e){return t&&(e?.[t?.toLowerCase()]||t)}function ll(t){return Array.isArray(t)?t:[t]}async function cs(t){return Promise.resolve(typeof t=="function"?t():t).then(e=>e.default||e)}function an(t){return!t||["plaintext","txt","text","plain"].includes(t)}function cl(t){return t==="ansi"||an(t)}function ln(t){return t==="none"}function ul(t){return ln(t)}function us(t,e){if(!e)return t;t.properties||={},t.properties.class||=[],typeof t.properties.class=="string"&&(t.properties.class=t.properties.class.split(/\s+/g)),Array.isArray(t.properties.class)||(t.properties.class=[]);const n=Array.isArray(e)?e:e.split(/\s+/g);for(const r of n)r&&!t.properties.class.includes(r)&&t.properties.class.push(r);return t}function ct(t,e=!1){if(t.length===0)return[["",0]];const n=t.split(/(\r?\n)/g);let r=0;const s=[];for(let o=0;o<n.length;o+=2){const a=e?n[o]+(n[o+1]||""):n[o];s.push([a,r]),r+=n[o].length,r+=n[o+1]?.length||0}return s}function hl(t){const e=ct(t,!0).map(([s])=>s);function n(s){if(s===t.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:n,posToIndex:r}}const cn="light-dark()",fl=["color","background-color"];function dl(t,e){let n=0;const r=[];for(const s of e)s>n&&r.push({...t,content:t.content.slice(n,s),offset:t.offset+n}),n=s;return n<t.content.length&&r.push({...t,content:t.content.slice(n),offset:t.offset+n}),r}function pl(t,e){const n=Array.from(e instanceof Set?e:new Set(e)).sort((r,s)=>r-s);return n.length?t.map(r=>r.flatMap(s=>{const o=n.filter(a=>s.offset<a&&a<s.offset+s.content.length).map(a=>a-s.offset).sort((a,i)=>a-i);return o.length?dl(s,o):s})):t}function gl(t,e,n,r,s="css-vars"){const o={content:t.content,explanation:t.explanation,offset:t.offset},a=e.map(u=>tt(t.variants[u])),i=new Set(a.flatMap(u=>Object.keys(u))),l={},c=(u,h)=>{const f=h==="color"?"":h==="background-color"?"-bg":`-${h}`;return n+e[u]+(h==="color"?"":f)};return a.forEach((u,h)=>{for(const f of i){const d=u[f]||"inherit";if(h===0&&r&&fl.includes(f))if(r===cn&&a.length>1){const p=e.findIndex(y=>y==="light"),w=e.findIndex(y=>y==="dark");if(p===-1||w===-1)throw new $('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const C=a[p][f]||"inherit",g=a[w][f]||"inherit";l[f]=`light-dark(${C}, ${g})`,s==="css-vars"&&(l[c(h,f)]=d)}else l[f]=d;else s==="css-vars"&&(l[c(h,f)]=d)}}),o.htmlStyle=l,o}function tt(t){const e={};if(t.color&&(e.color=t.color),t.bgColor&&(e["background-color"]=t.bgColor),t.fontStyle){t.fontStyle&M.Italic&&(e["font-style"]="italic"),t.fontStyle&M.Bold&&(e["font-weight"]="bold");const n=[];t.fontStyle&M.Underline&&n.push("underline"),t.fontStyle&M.Strikethrough&&n.push("line-through"),n.length&&(e["text-decoration"]=n.join(" "))}return e}function Xt(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}const hs=new WeakMap;function ut(t,e){hs.set(t,e)}function $e(t){return hs.get(t)}class Ce{_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,n){return new Ce(Object.fromEntries(ll(n).map(r=>[r,zt])),e)}constructor(...e){if(e.length===2){const[n,r]=e;this.lang=r,this._stacks=n}else{const[n,r,s]=e;this.lang=r,this._stacks={[s]:n}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return ml(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function ml(t){const e=[],n=new Set;function r(s){if(n.has(s))return;n.add(s);const o=s?.nameScopesList?.scopeName;o&&e.push(o),s.parent&&r(s.parent)}return r(t),e}function yl(t,e){if(!(t instanceof Ce))throw new $("Invalid grammar state");return t.getInternalStack(e)}function bl(){const t=new WeakMap;function e(n){if(!t.has(n.meta)){let r=function(a){if(typeof a=="number"){if(a<0||a>n.source.length)throw new $(`Invalid decoration offset: ${a}. Code length: ${n.source.length}`);return{...s.indexToPos(a),offset:a}}else{const i=s.lines[a.line];if(i===void 0)throw new $(`Invalid decoration position ${JSON.stringify(a)}. Lines length: ${s.lines.length}`);let l=a.character;if(l<0&&(l=i.length+l),l<0||l>i.length)throw new $(`Invalid decoration position ${JSON.stringify(a)}. Line ${a.line} length: ${i.length}`);return{...a,character:l,offset:s.posToIndex(a.line,l)}}};const s=hl(n.source),o=(n.options.decorations||[]).map(a=>({...a,start:r(a.start),end:r(a.end)}));wl(o),t.set(n.meta,{decorations:o,converter:s,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(!this.options.decorations?.length)return;const s=e(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]);return pl(n,s)},code(n){if(!this.options.decorations?.length)return;const r=e(this),s=Array.from(n.children).filter(u=>u.type==="element"&&u.tagName==="span");if(s.length!==r.converter.lines.length)throw new $(`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(u,h,f,d){const p=s[u];let w="",C=-1,g=-1;if(h===0&&(C=0),f===0&&(g=0),f===Number.POSITIVE_INFINITY&&(g=p.children.length),C===-1||g===-1)for(let m=0;m<p.children.length;m++)w+=fs(p.children[m]),C===-1&&w.length===h&&(C=m+1),g===-1&&w.length===f&&(g=m+1);if(C===-1)throw new $(`Failed to find start index for decoration ${JSON.stringify(d.start)}`);if(g===-1)throw new $(`Failed to find end index for decoration ${JSON.stringify(d.end)}`);const y=p.children.slice(C,g);if(!d.alwaysWrap&&y.length===p.children.length)i(p,d,"line");else if(!d.alwaysWrap&&y.length===1&&y[0].type==="element")i(y[0],d,"token");else{const m={type:"element",tagName:"span",properties:{},children:y};i(m,d,"wrapper"),p.children.splice(C,y.length,m)}}function a(u,h){s[u]=i(s[u],h,"line")}function i(u,h,f){const d=h.properties||{},p=h.transform||(w=>w);return u.tagName=h.tagName||"span",u.properties={...u.properties,...d,class:u.properties.class},h.properties?.class&&us(u,h.properties.class),u=p(u,f)||u,u}const l=[],c=r.decorations.sort((u,h)=>h.start.offset-u.start.offset||u.end.offset-h.end.offset);for(const u of c){const{start:h,end:f}=u;if(h.line===f.line)o(h.line,h.character,f.character,u);else if(h.line<f.line){o(h.line,h.character,Number.POSITIVE_INFINITY,u);for(let d=h.line+1;d<f.line;d++)l.unshift(()=>a(d,u));o(f.line,0,f.character,u)}}l.forEach(u=>u())}}}function wl(t){for(let e=0;e<t.length;e++){const n=t[e];if(n.start.offset>n.end.offset)throw new $(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=e+1;r<t.length;r++){const s=t[r],o=n.start.offset<=s.start.offset&&s.start.offset<n.end.offset,a=n.start.offset<s.end.offset&&s.end.offset<=n.end.offset,i=s.start.offset<=n.start.offset&&n.start.offset<s.end.offset,l=s.start.offset<n.end.offset&&n.end.offset<=s.end.offset;if(o||a||i||l){if(o&&a||i&&l||i&&n.start.offset===n.end.offset||a&&s.start.offset===s.end.offset)continue;throw new $(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function fs(t){return t.type==="text"?t.value:t.type==="element"?t.children.map(fs).join(""):""}const Cl=[bl()];function nt(t){const e=_l(t.transformers||[]);return[...e.pre,...e.normal,...e.post,...Cl]}function _l(t){const e=[],n=[],r=[];for(const s of t)switch(s.enforce){case"pre":e.push(s);break;case"post":n.push(s);break;default:r.push(s)}return{pre:e,post:n,normal:r}}var se=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],At={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Sl(t,e){const n=t.indexOf("\x1B",e);if(n!==-1&&t[n+1]==="["){const r=t.indexOf("m",n);if(r!==-1)return{sequence:t.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:t.length}}function Zn(t){const e=t.shift();if(e==="2"){const n=t.splice(0,3).map(r=>Number.parseInt(r));return n.length!==3||n.some(r=>Number.isNaN(r))?void 0:{type:"rgb",rgb:n}}else if(e==="5"){const n=t.shift();if(n)return{type:"table",index:Number(n)}}}function kl(t){const e=[];for(;t.length>0;){const n=t.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)e.push({type:"resetAll"});else if(r<=9)At[r]&&e.push({type:"setDecoration",value:At[r]});else if(r<=29){const s=At[r-20];s&&(e.push({type:"resetDecoration",value:s}),s==="dim"&&e.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)e.push({type:"setForegroundColor",value:{type:"named",name:se[r-30]}});else if(r===38){const s=Zn(t);s&&e.push({type:"setForegroundColor",value:s})}else if(r===39)e.push({type:"resetForegroundColor"});else if(r<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:se[r-40]}});else if(r===48){const s=Zn(t);s&&e.push({type:"setBackgroundColor",value:s})}else r===49?e.push({type:"resetBackgroundColor"}):r===53?e.push({type:"setDecoration",value:"overline"}):r===55?e.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?e.push({type:"setForegroundColor",value:{type:"named",name:se[r-90+8]}}):r>=100&&r<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:se[r-100+8]}})}return e}function vl(){let t=null,e=null,n=new Set;return{parse(r){const s=[];let o=0;do{const a=Sl(r,o),i=a.sequence?r.substring(o,a.startPosition):r.substring(o);if(i.length>0&&s.push({value:i,foreground:t,background:e,decorations:new Set(n)}),a.sequence){const l=kl(a.sequence);for(const c of l)c.type==="resetAll"?(t=null,e=null,n.clear()):c.type==="resetForegroundColor"?t=null:c.type==="resetBackgroundColor"?e=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of l)c.type==="setForegroundColor"?t=c.value:c.type==="setBackgroundColor"?e=c.value:c.type==="setDecoration"&&n.add(c.value)}o=a.position}while(o<r.length);return s}}}var xl={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 El(t=xl){function e(i){return t[i]}function n(i){return`#${i.map(l=>Math.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let c=0;c<se.length;c++)r.push(e(se[c]));let i=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let u=0;u<6;u++)for(let h=0;h<6;h++)r.push(n([i[c],i[u],i[h]]));let l=8;for(let c=0;c<24;c++,l+=10)r.push(n([l,l,l]));return r}function o(i){return s()[i]}function a(i){switch(i.type){case"named":return e(i.name);case"rgb":return n(i.rgb);case"table":return o(i.index)}}return{value:a}}const Al={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 Il(t,e,n){const r=et(t,n),s=ct(e),o=Object.fromEntries(se.map(l=>{const c=`terminal.ansi${l[0].toUpperCase()}${l.substring(1)}`,u=t.colors?.[c];return[l,u||Al[l]]})),a=El(o),i=vl();return s.map(l=>i.parse(l[0]).map(c=>{let u,h;c.decorations.has("reverse")?(u=c.background?a.value(c.background):t.bg,h=c.foreground?a.value(c.foreground):t.fg):(u=c.foreground?a.value(c.foreground):t.fg,h=c.background?a.value(c.background):void 0),u=J(u,r),h=J(h,r),c.decorations.has("dim")&&(u=Rl(u));let f=M.None;return c.decorations.has("bold")&&(f|=M.Bold),c.decorations.has("italic")&&(f|=M.Italic),c.decorations.has("underline")&&(f|=M.Underline),c.decorations.has("strikethrough")&&(f|=M.Strikethrough),{content:c.value,offset:l[1],color:u,bgColor:h,fontStyle:f}}))}function Rl(t){const e=t.match(/#([0-9a-f]{3,8})/i);if(e){const r=e[1];if(r.length===8){const s=Math.round(Number.parseInt(r.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${r.slice(0,6)}${s}`}else{if(r.length===6)return`#${r}80`;if(r.length===4){const s=r[0],o=r[1],a=r[2],i=r[3],l=Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,"0");return`#${s}${s}${o}${o}${a}${a}${l}`}else if(r.length===3){const s=r[0],o=r[1],a=r[2];return`#${s}${s}${o}${o}${a}${a}80`}}}const n=t.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:t}function un(t,e,n={}){const{theme:r=t.getLoadedThemes()[0]}=n,s=t.resolveLangAlias(n.lang||"text");if(an(s)||ln(r))return ct(e).map(l=>[{content:l[0],offset:l[1]}]);const{theme:o,colorMap:a}=t.setTheme(r);if(s==="ansi")return Il(o,e,n);const i=t.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==i.name)throw new $(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${i.name}"`);if(!n.grammarState.themes.includes(o.name))throw new $(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return $l(e,i,o,a,n)}function Nl(...t){if(t.length===2)return $e(t[1]);const[e,n,r={}]=t,{lang:s="text",theme:o=e.getLoadedThemes()[0]}=r;if(an(s)||ln(o))throw new $("Plain language does not have grammar state");if(s==="ansi")throw new $("ANSI language does not have grammar state");const{theme:a,colorMap:i}=e.setTheme(o),l=e.getLanguage(s);return new Ce(rt(n,l,a,i,r).stateStack,l.name,a.name)}function $l(t,e,n,r,s){const o=rt(t,e,n,r,s),a=new Ce(rt(t,e,n,r,s).stateStack,e.name,n.name);return ut(o.tokens,a),o.tokens}function rt(t,e,n,r,s){const o=et(n,s),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:i=500}=s,l=ct(t);let c=s.grammarState?yl(s.grammarState,n.name)??zt:s.grammarContextCode!=null?rt(s.grammarContextCode,e,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:zt,u=[];const h=[];for(let f=0,d=l.length;f<d;f++){const[p,w]=l[f];if(p===""){u=[],h.push([]);continue}if(a>0&&p.length>=a){u=[],h.push([{content:p,offset:w,color:"",fontStyle:0}]);continue}let C,g,y;s.includeExplanation&&(C=e.tokenizeLine(p,c,i),g=C.tokens,y=0);const m=e.tokenizeLine2(p,c,i),_=m.tokens.length/2;for(let S=0;S<_;S++){const E=m.tokens[2*S],L=S+1<_?m.tokens[2*S+2]:p.length;if(E===L)continue;const B=m.tokens[2*S+1],Ge=J(r[ge.getForeground(B)],o),ft=ge.getFontStyle(B),_e={content:p.substring(E,L),offset:w+E,color:Ge,fontStyle:ft};if(s.includeExplanation){const Z=[];if(s.includeExplanation!=="scopeName")for(const q of n.settings){let ie;switch(typeof q.scope){case"string":ie=q.scope.split(/,/).map(dt=>dt.trim());break;case"object":ie=q.scope;break;default:continue}Z.push({settings:q,selectors:ie.map(dt=>dt.split(/ /))})}_e.explanation=[];let dn=0;for(;E+dn<L;){const q=g[y],ie=p.substring(q.startIndex,q.endIndex);dn+=ie.length,_e.explanation.push({content:ie,scopes:s.includeExplanation==="scopeName"?Pl(q.scopes):Ll(Z,q.scopes)}),y+=1}}u.push(_e)}h.push(u),u=[],c=m.ruleStack}return{tokens:h,stateStack:c}}function Pl(t){return t.map(e=>({scopeName:e}))}function Ll(t,e){const n=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];n[r]={scopeName:o,themeMatches:Ml(t,o,e.slice(0,r))}}return n}function Qn(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function Tl(t,e,n){if(!Qn(t[t.length-1],e))return!1;let r=t.length-2,s=n.length-1;for(;r>=0&&s>=0;)Qn(t[r],n[s])&&(r-=1),s-=1;return r===-1}function Ml(t,e,n){const r=[];for(const{selectors:s,settings:o}of t)for(const a of s)if(Tl(a,e,n)){r.push(o);break}return r}function ds(t,e,n){const r=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),s=r.map(l=>{const c=un(t,e,{...n,theme:l.theme}),u=$e(c),h=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:u,theme:h}}),o=Ol(...s.map(l=>l.tokens)),a=o[0].map((l,c)=>l.map((u,h)=>{const f={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in n&&n.includeExplanation&&(f.explanation=u.explanation),o.forEach((d,p)=>{const{content:w,explanation:C,offset:g,...y}=d[c][h];f.variants[r[p].color]=y}),f})),i=s[0].state?new Ce(Object.fromEntries(s.map(l=>[l.theme,l.state?.getInternalStack(l.theme)])),s[0].state.lang):void 0;return i&&ut(a,i),a}function Ol(...t){const e=t.map(()=>[]),n=t.length;for(let r=0;r<t[0].length;r++){const s=t.map(l=>l[r]),o=e.map(()=>[]);e.forEach((l,c)=>l.push(o[c]));const a=s.map(()=>0),i=s.map(l=>l[0]);for(;i.every(l=>l);){const l=Math.min(...i.map(c=>c.content.length));for(let c=0;c<n;c++){const u=i[c];u.content.length===l?(o[c].push(u),a[c]+=1,i[c]=s[c][a[c]]):(o[c].push({...u,content:u.content.slice(0,l)}),i[c]={...u,content:u.content.slice(l),offset:u.offset+l})}}}return e}function st(t,e,n){let r,s,o,a,i,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-",colorsRendering:h="css-vars"}=n,f=Object.entries(n.themes).filter(g=>g[1]).map(g=>({color:g[0],theme:g[1]})).sort((g,y)=>g.color===c?-1:y.color===c?1:0);if(f.length===0)throw new $("`themes` option must not be empty");const d=ds(t,e,n);if(l=$e(d),c&&cn!==c&&!f.find(g=>g.color===c))throw new $(`\`themes\` option must contain the defaultColor key \`${c}\``);const p=f.map(g=>t.getTheme(g.theme)),w=f.map(g=>g.color);o=d.map(g=>g.map(y=>gl(y,w,u,c,h))),l&&ut(o,l);const C=f.map(g=>et(g.theme,n));s=Yn(f,p,C,u,c,"fg",h),r=Yn(f,p,C,u,c,"bg",h),a=`shiki-themes ${p.map(g=>g.name).join(" ")}`,i=c?void 0:[s,r].join(";")}else if("theme"in n){const c=et(n.theme,n);o=un(t,e,n);const u=t.getTheme(n.theme);r=J(u.bg,c),s=J(u.fg,c),a=u.name,l=$e(o)}else throw new $("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:s,bg:r,themeName:a,rootStyle:i,grammarState:l}}function Yn(t,e,n,r,s,o,a){return t.map((i,l)=>{const c=J(e[l][o],n[l])||"inherit",u=`${r+i.color}${o==="bg"?"-bg":""}:${c}`;if(l===0&&s){if(s===cn&&t.length>1){const h=t.findIndex(w=>w.color==="light"),f=t.findIndex(w=>w.color==="dark");if(h===-1||f===-1)throw new $('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const d=J(e[h][o],n[h])||"inherit",p=J(e[f][o],n[f])||"inherit";return`light-dark(${d}, ${p});${u}`}return c}return a==="css-vars"?u:null}).filter(i=>!!i).join(";")}function ot(t,e,n,r={meta:{},options:n,codeToHast:(s,o)=>ot(t,s,o),codeToTokens:(s,o)=>st(t,s,o)}){let s=e;for(const p of nt(n))s=p.preprocess?.call(r,s,n)||s;let{tokens:o,fg:a,bg:i,themeName:l,rootStyle:c,grammarState:u}=st(t,s,n);const{mergeWhitespaces:h=!0,mergeSameStyleTokens:f=!1}=n;h===!0?o=Dl(o):h==="never"&&(o=Bl(o)),f&&(o=Fl(o));const d={...r,get source(){return s}};for(const p of nt(n))o=p.tokens?.call(d,o)||o;return Gl(o,{...n,fg:a,bg:i,themeName:l,rootStyle:n.rootStyle===!1?!1:n.rootStyle??c},d,u)}function Gl(t,e,n,r=$e(t)){const s=nt(e),o=[],a={type:"root",children:[]},{structure:i="classic",tabindex:l="0"}=e,c={class:`shiki ${e.themeName||""}`};e.rootStyle!==!1&&(e.rootStyle!=null?c.style=e.rootStyle:c.style=`background-color:${e.bg};color:${e.fg}`),l!==!1&&l!=null&&(c.tabindex=l.toString());for(const[w,C]of Object.entries(e.meta||{}))w.startsWith("_")||(c[w]=C);let u={type:"element",tagName:"pre",properties:c,children:[]},h={type:"element",tagName:"code",properties:{},children:o};const f=[],d={...n,structure:i,addClassToHast:us,get source(){return n.source},get tokens(){return t},get options(){return e},get root(){return a},get pre(){return u},get code(){return h},get lines(){return f}};if(t.forEach((w,C)=>{C&&(i==="inline"?a.children.push({type:"element",tagName:"br",properties:{},children:[]}):i==="classic"&&o.push({type:"text",value:`
152
152
  `}));let g={type:"element",tagName:"span",properties:{class:"line"},children:[]},y=0;for(const m of w){let _={type:"element",tagName:"span",properties:{...m.htmlAttrs},children:[{type:"text",value:m.content}]};const S=Xt(m.htmlStyle||tt(m));S&&(_.properties.style=S);for(const E of s)_=E?.span?.call(d,_,C+1,y,g,m)||_;i==="inline"?a.children.push(_):i==="classic"&&g.children.push(_),y+=m.content.length}if(i==="classic"){for(const m of s)g=m?.line?.call(d,g,C+1)||g;f.push(g),o.push(g)}else i==="inline"&&f.push(g)}),i==="classic"){for(const w of s)h=w?.code?.call(d,h)||h;u.children.push(h);for(const w of s)u=w?.pre?.call(d,u)||u;a.children.push(u)}else if(i==="inline"){const w=[];let C={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const m of a.children)m.type==="element"&&m.tagName==="br"?(w.push(C),C={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(m.type==="element"||m.type==="text")&&C.children.push(m);w.push(C);let y={type:"element",tagName:"code",properties:{},children:w};for(const m of s)y=m?.code?.call(d,y)||y;a.children=[];for(let m=0;m<y.children.length;m++){m>0&&a.children.push({type:"element",tagName:"br",properties:{},children:[]});const _=y.children[m];_.type==="element"&&a.children.push(..._.children)}}let p=a;for(const w of s)p=w?.root?.call(d,p)||p;return r&&ut(p,r),p}function Dl(t){return t.map(e=>{const n=[];let r="",s;return e.forEach((o,a)=>{const l=!(o.fontStyle&&(o.fontStyle&M.Underline||o.fontStyle&M.Strikethrough));l&&o.content.match(/^\s+$/)&&e[a+1]?(s===void 0&&(s=o.offset),r+=o.content):r?(l?n.push({...o,offset:s,content:r+o.content}):n.push({content:r,offset:s},o),s=void 0,r=""):n.push(o)}),n})}function Bl(t){return t.map(e=>e.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,s,o,a]=r;if(!s&&!a)return n;const i=[{...n,offset:n.offset+s.length,content:o}];return s&&i.unshift({content:s,offset:n.offset}),a&&i.push({content:a,offset:n.offset+s.length+o.length}),i}))}function Fl(t){return t.map(e=>{const n=[];for(const r of e){if(n.length===0){n.push({...r});continue}const s=n[n.length-1],o=Xt(s.htmlStyle||tt(s)),a=Xt(r.htmlStyle||tt(r)),i=s.fontStyle&&(s.fontStyle&M.Underline||s.fontStyle&M.Strikethrough),l=r.fontStyle&&(r.fontStyle&M.Underline||r.fontStyle&M.Strikethrough);!i&&!l&&o===a?s.content+=r.content:n.push({...r})}return n})}const jl=ol;function Ul(t,e,n){const r={meta:{},options:n,codeToHast:(o,a)=>ot(t,o,a),codeToTokens:(o,a)=>st(t,o,a)};let s=jl(ot(t,e,n,r));for(const o of nt(n))s=o.postprocess?.call(r,s,n)||s;return s}const Jn={light:"#333333",dark:"#bbbbbb"},er={light:"#fffffe",dark:"#1e1e1e"},tr="__shiki_resolved";function hn(t){if(t?.[tr])return t;const e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:n,fg:r}=e;if(!n||!r){const i=e.settings?e.settings.find(l=>!l.name&&!l.scope):void 0;i?.settings?.foreground&&(r=i.settings.foreground),i?.settings?.background&&(n=i.settings.background),!r&&e?.colors?.["editor.foreground"]&&(r=e.colors["editor.foreground"]),!n&&e?.colors?.["editor.background"]&&(n=e.colors["editor.background"]),r||(r=e.type==="light"?Jn.light:Jn.dark),n||(n=e.type==="light"?er.light:er.dark),e.fg=r,e.bg=n}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 l=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return e.colorReplacements?.[`#${l}`]?a(i):(o.set(i,l),l)}e.settings=e.settings.map(i=>{const l=i.settings?.foreground&&!i.settings.foreground.startsWith("#"),c=i.settings?.background&&!i.settings.background.startsWith("#");if(!l&&!c)return i;const u={...i,settings:{...i.settings}};if(l){const h=a(i.settings.foreground);e.colorReplacements[h]=i.settings.foreground,u.settings.foreground=h}if(c){const h=a(i.settings.background);e.colorReplacements[h]=i.settings.background,u.settings.background=h}return u});for(const i of Object.keys(e.colors||{}))if((i==="editor.foreground"||i==="editor.background"||i.startsWith("terminal.ansi"))&&!e.colors[i]?.startsWith("#")){const l=a(e.colors[i]);e.colorReplacements[l]=e.colors[i],e.colors[i]=l}return Object.defineProperty(e,tr,{enumerable:!1,writable:!1,value:!0}),e}async function zl(t){return Array.from(new Set((await Promise.all(t.filter(e=>!cl(e)).map(async e=>await cs(e).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function Wl(t){return(await Promise.all(t.map(async n=>ul(n)?null:hn(await cs(n))))).filter(n=>!!n)}class fe extends Error{constructor(e){super(e),this.name="ShikiError"}}function ps(t,e){if(!e)return t;if(e[t]){const n=new Set([t]);for(;e[t];){if(t=e[t],n.has(t))throw new fe(`Circular alias \`${Array.from(n).join(" -> ")} -> ${t}\``);n.add(t)}}return t}class ql extends qa{constructor(e,n,r,s={}){super(e),this._resolver=e,this._themes=n,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 n=hn(e);return n.name&&(this._resolvedThemes.set(n.name,n),this._loadedThemesCache=null),n}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let n=this._textmateThemeCache.get(e);n||(n=Ke.createFromRawTheme(e),this._textmateThemeCache.set(e,n)),this._syncRegistry.setTheme(n)}getGrammar(e){return e=ps(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const n=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,n.size)for(const o of n)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 n=Array.from(this._langGraph.entries()),r=n.filter(([s,o])=>!o);if(r.length){const s=n.filter(([o,a])=>a?(a.embeddedLanguages||a.embeddedLangs)?.some(l=>r.map(([c])=>c).includes(l)):!1).filter(o=>!r.includes(o));throw new fe(`Missing languages ${r.map(([o])=>`\`${o}\``).join(", ")}, required by ${s.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[s,o]of n)this._resolver.addLanguage(o);for(const[s,o]of n)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);const n=e.embeddedLanguages??e.embeddedLangs;if(n)for(const r of n)this._langGraph.set(r,this._langMap.get(r))}}class Hl{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,n){this._onigLib={createOnigScanner:r=>e.createScanner(r),createOnigString:r=>e.createString(r)},n.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(n=>{this._langs.set(n,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(e.scopeName)})}getInjections(e){const n=e.split(".");let r=[];for(let s=1;s<=n.length;s++){const o=n.slice(0,s).join(".");r=[...r,...this._injections.get(o)||[]]}return r}}let Se=0;function Vl(t){Se+=1,t.warnings!==!1&&Se>=10&&Se%10===0&&console.warn(`[Shiki] ${Se} 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(!t.engine)throw new fe("`engine` option is required for synchronous mode");const n=(t.langs||[]).flat(1),r=(t.themes||[]).flat(1).map(hn),s=new Hl(t.engine,n),o=new ql(s,r,n,t.langAlias);let a;function i(m){return ps(m,t.langAlias)}function l(m){g();const _=o.getGrammar(typeof m=="string"?m:m.name);if(!_)throw new fe(`Language \`${m}\` not found, you may need to load it first`);return _}function c(m){if(m==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};g();const _=o.getTheme(m);if(!_)throw new fe(`Theme \`${m}\` not found, you may need to load it first`);return _}function u(m){g();const _=c(m);a!==m&&(o.setTheme(_),a=m);const S=o.getColorMap();return{theme:_,colorMap:S}}function h(){return g(),o.getLoadedThemes()}function f(){return g(),o.getLoadedLanguages()}function d(...m){g(),o.loadLanguages(m.flat(1))}async function p(...m){return d(await zl(m))}function w(...m){g();for(const _ of m.flat(1))o.loadTheme(_)}async function C(...m){return g(),w(await Wl(m))}function g(){if(e)throw new fe("Shiki instance has been disposed")}function y(){e||(e=!0,o.dispose(),Se-=1)}return{setTheme:u,getTheme:c,getLanguage:l,getLoadedThemes:h,getLoadedLanguages:f,resolveLangAlias:i,loadLanguage:p,loadLanguageSync:d,loadTheme:C,loadThemeSync:w,dispose:y,[Symbol.dispose]:y}}function Xl(t){const e=Vl(t);return{getLastGrammarState:(...n)=>Nl(e,...n),codeToTokensBase:(n,r)=>un(e,n,r),codeToTokensWithThemes:(n,r)=>ds(e,n,r),codeToTokens:(n,r)=>st(e,n,r),codeToHast:(n,r)=>ot(e,n,r),codeToHtml:(n,r)=>Ul(e,n,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...e,getInternalContext:()=>e}}class gs{diff(e,n,r={}){let s;typeof r=="function"?(s=r,r={}):"callback"in r&&(s=r.callback);const o=this.castInput(e,r),a=this.castInput(n,r),i=this.removeEmpty(this.tokenize(o,r)),l=this.removeEmpty(this.tokenize(a,r));return this.diffWithOptionsObj(i,l,r,s)}diffWithOptionsObj(e,n,r,s){var o;const a=y=>{if(y=this.postProcess(y,r),s){setTimeout(function(){s(y)},0);return}else return y},i=n.length,l=e.length;let c=1,u=i+l;r.maxEditLength!=null&&(u=Math.min(u,r.maxEditLength));const h=(o=r.timeout)!==null&&o!==void 0?o:1/0,f=Date.now()+h,d=[{oldPos:-1,lastComponent:void 0}];let p=this.extractCommon(d[0],n,e,0,r);if(d[0].oldPos+1>=l&&p+1>=i)return a(this.buildValues(d[0].lastComponent,n,e));let w=-1/0,C=1/0;const g=()=>{for(let y=Math.max(w,-c);y<=Math.min(C,c);y+=2){let m;const _=d[y-1],S=d[y+1];_&&(d[y-1]=void 0);let E=!1;if(S){const B=S.oldPos-y;E=S&&0<=B&&B<i}const L=_&&_.oldPos+1<l;if(!E&&!L){d[y]=void 0;continue}if(!L||E&&_.oldPos<S.oldPos?m=this.addToPath(S,!0,!1,0,r):m=this.addToPath(_,!1,!0,1,r),p=this.extractCommon(m,n,e,y,r),m.oldPos+1>=l&&p+1>=i)return a(this.buildValues(m.lastComponent,n,e))||!0;d[y]=m,m.oldPos+1>=l&&(C=Math.min(C,y-1)),p+1>=i&&(w=Math.max(w,y+1))}c++};if(s)(function y(){setTimeout(function(){if(c>u||Date.now()>f)return s(void 0);g()||y()},0)})();else for(;c<=u&&Date.now()<=f;){const y=g();if(y)return y}}addToPath(e,n,r,s,o){const a=e.lastComponent;return a&&!o.oneChangePerToken&&a.added===n&&a.removed===r?{oldPos:e.oldPos+s,lastComponent:{count:a.count+1,added:n,removed:r,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:n,removed:r,previousComponent:a}}}extractCommon(e,n,r,s,o){const a=n.length,i=r.length;let l=e.oldPos,c=l-s,u=0;for(;c+1<a&&l+1<i&&this.equals(r[l+1],n[c+1],o);)c++,l++,u++,o.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!o.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const s=[];let o;for(;e;)s.push(e),o=e.previousComponent,delete e.previousComponent,e=o;s.reverse();const a=s.length;let i=0,l=0,c=0;for(;i<a;i++){const u=s[i];if(u.removed)u.value=this.join(r.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let h=n.slice(l,l+u.count);h=h.map(function(f,d){const p=r[c+d];return p.length>f.length?p:f}),u.value=this.join(h)}else u.value=this.join(n.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return s}}class Kl extends gs{}const Zl=new Kl;function Ql(t,e,n){return Zl.diff(t,e,n)}const nr="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class Yl extends gs{tokenize(e){const n=new RegExp(`(\\r?\\n)|[${nr}]+|[^\\S\\n\\r]+|[^${nr}]`,"ug");return e.match(n)||[]}}const Jl=new Yl;function ec(t,e,n){return Jl.diff(t,e,n)}function tc(t={}){const{classPrefix:e="__shiki_",classSuffix:n="",classReplacer:r=i=>i}=t,s=new Map;function o(i){return Object.entries(i).map(([l,c])=>`${l}:${c}`).join(";")}function a(i){const l=typeof i=="string"?i:o(i);let c=e+nc(l)+n;return c=r(c),s.has(c)||s.set(c,typeof i=="string"?i:{...i}),c}return{name:"@shikijs/transformers:style-to-class",pre(i){if(!i.properties.style)return;const l=a(i.properties.style);delete i.properties.style,this.addClassToHast(i,l)},tokens(i){for(const l of i)for(const c of l){if(!c.htmlStyle)continue;const u=a(c.htmlStyle);c.htmlStyle={},c.htmlAttrs||={},c.htmlAttrs.class?c.htmlAttrs.class+=` ${u}`:c.htmlAttrs.class=u}},getClassRegistry(){return s},getCSS(){let i="";for(const[l,c]of s.entries())i+=`.${l}{${typeof c=="string"?c:o(c)}}`;return i},clearRegistry(){s.clear()}}}function nc(t,e=0){let n=3735928559^e,r=1103547991^e;for(let s=0,o;s<t.length;s++)o=t.charCodeAt(s),n=Math.imul(n^o,2654435761),r=Math.imul(r^o,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}const Oe={dark:"pierre-dark",light:"pierre-light"},rr=new Map,sr=new Set;function fn(t,e){t=Array.isArray(t)?t:[t];for(const n of t){if(sr.has(n.name))continue;let r=rr.get(n.name);r==null&&(r=n,rr.set(n.name,r)),sr.add(r.name),e.loadLanguageSync(r.data)}}const It=new Map,or=new Set;function ms(t,e){t=Array.isArray(t)?t:[t];for(let n of t){let r;if(typeof n=="string"){if(r=It.get(n),r==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else r=n,n=n.name,It.has(n)||It.set(n,r);or.has(n)||(or.add(n),e.loadThemeSync(r))}}function Pe(t){return t.replace(/\n$|\r\n$/,"")}function rc(t){return{type:"text",value:t}}function Rt({tagName:t,children:e=[],properties:n={}}){return{type:"element",tagName:t,properties:n,children:e}}function sc(t){let e=t.children[0];for(;e!=null;){if(e.type==="element"&&e.tagName==="code")return e;"children"in e?e=e.children[0]:e=null}}function oc(t,e,n){const r=typeof n.lineInfo=="function"?n.lineInfo(e):n.lineInfo[e];if(r==null)throw console.error({node:t,line:e,state:n}),new Error(`processLine: line ${e}, contains no state.lineInfo`);return t.tagName="span",t.properties["data-column-content"]="",t.children.length===0&&t.children.push(rc(`
153
- `)),Rt({tagName:"div",children:[Rt({tagName:"span",children:[Rt({tagName:"span",children:[{type:"text",value:`${r.lineNumber}`}],properties:{"data-line-number-content":""}})],properties:{"data-column-number":""}}),t],properties:{"data-line":r.lineNumber,"data-alt-line":r.altLineNumber,"data-line-type":r.type,"data-line-index":r.lineIndex}})}function ys(t=!1){const e={lineInfo:{}},n=[{line(r){return delete r.properties.class,r},pre(r){const s=sc(r),o=[];if(s!=null){let a=1;for(const i of s.children)i.type==="element"&&(o.push(oc(i,a,e)),a++);s.children=o}return r}}];return t&&n.push(ac,ar),{state:e,transformers:n,toClass:ar}}const ar=tc({classPrefix:"hl-"}),ac={name:"token-style-normalizer",tokens(t){for(const e of t)for(const n of e){if(n.htmlStyle!=null)continue;const r={};n.color!=null&&(r.color=n.color),n.bgColor!=null&&(r["background-color"]=n.bgColor),n.fontStyle!=null&&n.fontStyle!==0&&((n.fontStyle&1)!==0&&(r["font-style"]="italic"),(n.fontStyle&2)!==0&&(r["font-weight"]="bold"),(n.fontStyle&4)!==0&&(r["text-decoration"]="underline")),Object.keys(r).length>0&&(n.htmlStyle=r)}}};function D(t="diffs"){return`--${t}-`}const ke={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function Kt(t){if(ke[t]!=null)return ke[t];const e=t.match(/\.([^/\\]+\.[^/\\]+)$/);return e!=null&&ke[e[1]]!=null?ke[e[1]]??"text":ke[t.match(/\.([^.]+)$/)?.[1]??""]??"text"}function bs({theme:t=Oe,highlighter:e,prefix:n}){let r="";if(typeof t=="string"){const s=e.getTheme(t);r+=`color:${s.fg};`,r+=`background-color:${s.bg};`,r+=`${D(n)}fg:${s.fg};`,r+=`${D(n)}bg:${s.bg};`,r+=Nt(s,n)}else{let s=e.getTheme(t.dark);r+=`${D(n)}dark:${s.fg};`,r+=`${D(n)}dark-bg:${s.bg};`,r+=Nt(s,n,"dark"),s=e.getTheme(t.light),r+=`${D(n)}light:${s.fg};`,r+=`${D(n)}light-bg:${s.bg};`,r+=Nt(s,n,"light")}return r}function Nt(t,e,n){n=n!=null?`${n}-`:"";let r="";const s=t.colors?.["gitDecoration.addedResourceForeground"]??t.colors?.["terminal.ansiGreen"];s!=null&&(r+=`${D(e)}${n}addition-color:${s};`);const o=t.colors?.["gitDecoration.deletedResourceForeground"]??t.colors?.["terminal.ansiRed"];o!=null&&(r+=`${D(e)}${n}deletion-color:${o};`);const a=t.colors?.["gitDecoration.modifiedResourceForeground"]??t.colors?.["terminal.ansiBlue"];return a!=null&&(r+=`${D(e)}${n}modified-color:${a};`),r}function Zt(t){let e=t.children[0];for(;e!=null;){if(e.type==="element"&&e.tagName==="code")return e.children;"children"in e?e=e.children[0]:e=null}throw console.error(t),new Error("getLineNodes: Unable to find children")}function ir({line:t,spanStart:e,spanLength:n}){return{start:{line:t,character:e},end:{line:t,character:e+n},properties:{"data-diff-span":""},alwaysWrap:!0}}function We({item:t,arr:e,enableJoin:n,isNeutral:r=!1,isLastItem:s=!1}){const o=e[e.length-1];if(o==null||s||!n){e.push([r?0:1,t.value]);return}const a=o[0]===0;if(r===a||r&&t.value.length===1&&!a){o[1]+=t.value;return}e.push([r?0:1,t.value])}function ic(t,e,n,r=!1){const s=(()=>{const c=n.theme??Oe;if(typeof c=="string")return e.getTheme(c).type})(),o=bs({theme:n.theme,highlighter:e});if(t.newLines!=null&&t.oldLines!=null){const{oldContent:c,newContent:u,oldInfo:h,newInfo:f,oldDecorations:d,newDecorations:p}=lr({hunks:t.hunks,oldLines:t.oldLines,newLines:t.newLines,lineDiffType:n.lineDiffType});return{code:cr({oldFile:{name:t.prevName??t.name,contents:c},oldInfo:h,oldDecorations:d,newFile:{name:t.name,contents:u},newInfo:f,newDecorations:p,highlighter:e,options:n,languageOverride:r?"text":t.lang}),themeStyles:o,baseThemeType:s}}const a=[];let i=0,l=0;for(const c of t.hunks){const{oldContent:u,newContent:h,oldInfo:f,newInfo:d,oldDecorations:p,newDecorations:w,splitLineIndex:C,unifiedLineIndex:g}=lr({hunks:[c],splitLineIndex:i,unifiedLineIndex:l,lineDiffType:n.lineDiffType}),y={name:t.prevName??t.name,contents:u},m={name:t.name,contents:h};a.push(cr({oldFile:y,oldInfo:f,oldDecorations:p,newFile:m,newInfo:d,newDecorations:w,highlighter:e,options:n,languageOverride:r?"text":t.lang})),i=C,l=g}return{code:(()=>{if(a.length<=1){const c=a[0]??{oldLines:[],newLines:[]};if(c.newLines.length===0||c.oldLines.length===0)return c}return{hunks:a}})(),themeStyles:o,baseThemeType:s}}function lc({oldLine:t,newLine:e,oldLineIndex:n,newLineIndex:r,oldDecorations:s,newDecorations:o,lineDiffType:a}){if(t==null||e==null||a==="none")return;t=Pe(t),e=Pe(e);const i=a==="char"?Ql(t,e):ec(t,e),l=[],c=[],u=a==="word-alt";for(const f of i){const d=f===i[i.length-1];!f.added&&!f.removed?(We({item:f,arr:l,enableJoin:u,isNeutral:!0,isLastItem:d}),We({item:f,arr:c,enableJoin:u,isNeutral:!0,isLastItem:d})):f.removed?We({item:f,arr:l,enableJoin:u,isLastItem:d}):We({item:f,arr:c,enableJoin:u,isLastItem:d})}let h=0;for(const f of l)f[0]===1&&s.push(ir({line:n-1,spanStart:h,spanLength:f[1].length})),h+=f[1].length;h=0;for(const f of c)f[0]===1&&o.push(ir({line:r-1,spanStart:h,spanLength:f[1].length})),h+=f[1].length}function lr({hunks:t,oldLines:e,newLines:n,splitLineIndex:r=0,unifiedLineIndex:s=0,lineDiffType:o}){const a={},i={},l=[],c=[];let u=1,h=1,f=1,d=1,p="",w="";for(const C of t){for(;e!=null&&n!=null&&u<C.additionStart&&h<C.deletionStart;)a[h]={type:"context-expanded",lineNumber:d,altLineNumber:f,lineIndex:`${s},${r}`},i[u]={type:"context-expanded",lineNumber:f,altLineNumber:d,lineIndex:`${s},${r}`},p+=e[h-1],w+=n[u-1],h++,u++,d++,f++,r++,s++;d=C.deletionStart,f=C.additionStart;for(const g of C.hunkContent)if(g.type==="context")for(const y of g.lines)a[h]={type:"context",lineNumber:d,altLineNumber:f,lineIndex:`${s},${r}`},i[u]={type:"context",lineNumber:f,altLineNumber:d,lineIndex:`${s},${r}`},p+=y,w+=y,h++,u++,f++,d++,r++,s++;else{const y=Math.max(g.additions.length,g.deletions.length);let m=0,_=s;for(;m<y;){const S=g.deletions[m],E=g.additions[m];lc({newLine:E,oldLine:S,oldLineIndex:h,newLineIndex:u,oldDecorations:l,newDecorations:c,lineDiffType:o}),S!=null&&(a[h]={type:"change-deletion",lineNumber:d,lineIndex:`${_},${r}`},p+=S,h++,d++),E!=null&&(i[u]={type:"change-addition",lineNumber:f,lineIndex:`${_+g.deletions.length},${r}`},w+=E,u++,f++),r++,_++,m++}s+=g.additions.length+g.deletions.length}if(!(e==null||n==null||C!==t[t.length-1]))for(;h<=e.length||u<=e.length;){const g=e[h-1],y=n[u-1];if(g==null&&y==null)break;g!=null&&(a[h]={type:"context-expanded",lineNumber:d,altLineNumber:f,lineIndex:`${s},${r}`},p+=g,h++,d++),y!=null&&(i[u]={type:"context-expanded",lineNumber:f,altLineNumber:d,lineIndex:`${s},${r}`},w+=y,u++,f++),r++,s++}}return{oldContent:Pe(p),newContent:Pe(w),oldInfo:a,newInfo:i,oldDecorations:l,newDecorations:c,splitLineIndex:r,unifiedLineIndex:s}}function cr({oldFile:t,newFile:e,oldInfo:n,newInfo:r,highlighter:s,oldDecorations:o,newDecorations:a,languageOverride:i,options:{theme:l=Oe,...c}}){const u=i??Kt(t.name),h=i??Kt(e.name),{state:f,transformers:d}=ys(),p=typeof l=="string"?{...c,lang:"text",theme:l,transformers:d,decorations:void 0,defaultColor:!1,cssVariablePrefix:D()}:{...c,lang:"text",themes:l,transformers:d,decorations:void 0,defaultColor:!1,cssVariablePrefix:D()};return{oldLines:t.contents===""?[]:(p.lang=u,f.lineInfo=n,p.decorations=o,Zt(s.codeToHast(t.contents,p))),newLines:e.contents===""?[]:(p.lang=h,p.decorations=a,f.lineInfo=r,Zt(s.codeToHast(e.contents,p)))}}function cc(t,e,{theme:n=Oe,tokenizeMaxLineLength:r},s=!1){const{state:o,transformers:a}=ys(),i=s?"text":t.lang??Kt(t.name),l=(()=>{if(typeof n=="string")return e.getTheme(n).type})(),c=bs({theme:n,highlighter:e});o.lineInfo=h=>({type:"context",lineIndex:h-1,lineNumber:h});const u=typeof n=="string"?{lang:i,theme:n,transformers:a,defaultColor:!1,cssVariablePrefix:D(),tokenizeMaxLineLength:r}:{lang:i,themes:n,transformers:a,defaultColor:!1,cssVariablePrefix:D(),tokenizeMaxLineLength:r};return{code:Zt(e.codeToHast(Pe(t.contents),u)),themeStyles:c,baseThemeType:l}}let ur,me={theme:Oe,tokenizeMaxLineLength:1e3,lineDiffType:"word-alt"};self.addEventListener("error",t=>{console.error("[Shiki Worker] Unhandled error:",t.error)});self.addEventListener("message",t=>{const e=t.data;try{switch(e.type){case"initialize":uc(e);break;case"set-render-options":hc(e);break;case"file":fc(e);break;case"diff":dc(e);break;default:throw new Error(`Unknown request type: ${e.type}`)}}catch(n){console.error("Worker error:",n),mc(e.id,n)}});function uc({id:t,renderOptions:e,resolvedThemes:n,resolvedLanguages:r}){const s=ht();ms(n,s),r!=null&&fn(r,s),me=e,postMessage({type:"success",id:t,requestType:"initialize",sentAt:Date.now()})}function hc({id:t,renderOptions:e,resolvedThemes:n}){ms(n,ht()),me=e,postMessage({type:"success",id:t,requestType:"set-render-options",sentAt:Date.now()})}function fc({id:t,file:e,resolvedLanguages:n}){const r=ht();n!=null&&fn(n,r);const s={theme:me.theme,tokenizeMaxLineLength:me.tokenizeMaxLineLength};pc(t,cc(e,r,s),s)}function dc({id:t,diff:e,resolvedLanguages:n}){const r=ht();n!=null&&fn(n,r),gc(t,ic(e,r,me),me)}function ht(){return ur??=Xl({themes:[],langs:[],engine:oa()}),ur}function pc(t,e,n){postMessage({type:"success",requestType:"file",id:t,result:e,options:n,sentAt:Date.now()})}function gc(t,e,n){postMessage({type:"success",requestType:"diff",id:t,result:e,options:n,sentAt:Date.now()})}function mc(t,e){const n={type:"error",id:t,error:e instanceof Error?e.message:String(e),stack:e instanceof Error?e.stack:void 0};postMessage(n)}
153
+ `)),Rt({tagName:"div",children:[Rt({tagName:"span",children:[Rt({tagName:"span",children:[{type:"text",value:`${r.lineNumber}`}],properties:{"data-line-number-content":""}})],properties:{"data-column-number":""}}),t],properties:{"data-line":r.lineNumber,"data-alt-line":r.altLineNumber,"data-line-type":r.type,"data-line-index":r.lineIndex}})}function ys(t=!1){const e={lineInfo:{}},n=[{line(r){return delete r.properties.class,r},pre(r){const s=sc(r),o=[];if(s!=null){let a=1;for(const i of s.children)i.type==="element"&&(o.push(oc(i,a,e)),a++);s.children=o}return r}}];return t&&n.push(ac,ar),{state:e,transformers:n,toClass:ar}}const ar=tc({classPrefix:"hl-"}),ac={name:"token-style-normalizer",tokens(t){for(const e of t)for(const n of e){if(n.htmlStyle!=null)continue;const r={};n.color!=null&&(r.color=n.color),n.bgColor!=null&&(r["background-color"]=n.bgColor),n.fontStyle!=null&&n.fontStyle!==0&&((n.fontStyle&1)!==0&&(r["font-style"]="italic"),(n.fontStyle&2)!==0&&(r["font-weight"]="bold"),(n.fontStyle&4)!==0&&(r["text-decoration"]="underline")),Object.keys(r).length>0&&(n.htmlStyle=r)}}};function D(t="diffs"){return`--${t}-`}const ke={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function Kt(t){if(ke[t]!=null)return ke[t];const e=t.match(/\.([^/\\]+\.[^/\\]+)$/);return e!=null&&ke[e[1]]!=null?ke[e[1]]??"text":ke[t.match(/\.([^.]+)$/)?.[1]??""]??"text"}function bs({theme:t=Oe,highlighter:e,prefix:n}){let r="";if(typeof t=="string"){const s=e.getTheme(t);r+=`color:${s.fg};`,r+=`background-color:${s.bg};`,r+=`${D(n)}fg:${s.fg};`,r+=`${D(n)}bg:${s.bg};`,r+=Nt(s,n)}else{let s=e.getTheme(t.dark);r+=`${D(n)}dark:${s.fg};`,r+=`${D(n)}dark-bg:${s.bg};`,r+=Nt(s,n,"dark"),s=e.getTheme(t.light),r+=`${D(n)}light:${s.fg};`,r+=`${D(n)}light-bg:${s.bg};`,r+=Nt(s,n,"light")}return r}function Nt(t,e,n){n=n!=null?`${n}-`:"";let r="";const s=t.colors?.["gitDecoration.addedResourceForeground"]??t.colors?.["terminal.ansiGreen"];s!=null&&(r+=`${D(e)}${n}addition-color:${s};`);const o=t.colors?.["gitDecoration.deletedResourceForeground"]??t.colors?.["terminal.ansiRed"];o!=null&&(r+=`${D(e)}${n}deletion-color:${o};`);const a=t.colors?.["gitDecoration.modifiedResourceForeground"]??t.colors?.["terminal.ansiBlue"];return a!=null&&(r+=`${D(e)}${n}modified-color:${a};`),r}function Zt(t){let e=t.children[0];for(;e!=null;){if(e.type==="element"&&e.tagName==="code")return e.children;"children"in e?e=e.children[0]:e=null}throw console.error(t),new Error("getLineNodes: Unable to find children")}function ir({line:t,spanStart:e,spanLength:n}){return{start:{line:t,character:e},end:{line:t,character:e+n},properties:{"data-diff-span":""},alwaysWrap:!0}}function We({item:t,arr:e,enableJoin:n,isNeutral:r=!1,isLastItem:s=!1}){const o=e[e.length-1];if(o==null||s||!n){e.push([r?0:1,t.value]);return}const a=o[0]===0;if(r===a||r&&t.value.length===1&&!a){o[1]+=t.value;return}e.push([r?0:1,t.value])}function ic(t,e,n,r=!1){const s=(()=>{const c=n.theme??Oe;if(typeof c=="string")return e.getTheme(c).type})(),o=bs({theme:n.theme,highlighter:e});if(t.newLines!=null&&t.oldLines!=null){const{oldContent:c,newContent:u,oldInfo:h,newInfo:f,oldDecorations:d,newDecorations:p}=lr({hunks:t.hunks,oldLines:t.oldLines,newLines:t.newLines,lineDiffType:n.lineDiffType});return{code:cr({oldFile:{name:t.prevName??t.name,contents:c},oldInfo:h,oldDecorations:d,newFile:{name:t.name,contents:u},newInfo:f,newDecorations:p,highlighter:e,options:n,languageOverride:r?"text":t.lang}),themeStyles:o,baseThemeType:s}}const a=[];let i=0,l=0;for(const c of t.hunks){const{oldContent:u,newContent:h,oldInfo:f,newInfo:d,oldDecorations:p,newDecorations:w,splitLineIndex:C,unifiedLineIndex:g}=lr({hunks:[c],splitLineIndex:i,unifiedLineIndex:l,lineDiffType:n.lineDiffType}),y={name:t.prevName??t.name,contents:u},m={name:t.name,contents:h};a.push(cr({oldFile:y,oldInfo:f,oldDecorations:p,newFile:m,newInfo:d,newDecorations:w,highlighter:e,options:n,languageOverride:r?"text":t.lang})),i=C,l=g}return{code:(()=>{if(a.length<=1){const c=a[0]??{oldLines:[],newLines:[]};if(c.newLines.length===0||c.oldLines.length===0)return c}return{hunks:a}})(),themeStyles:o,baseThemeType:s}}function lc({oldLine:t,newLine:e,oldLineIndex:n,newLineIndex:r,oldDecorations:s,newDecorations:o,lineDiffType:a}){if(t==null||e==null||a==="none")return;t=Pe(t),e=Pe(e);const i=a==="char"?Ql(t,e):ec(t,e),l=[],c=[],u=a==="word-alt";for(const f of i){const d=f===i[i.length-1];!f.added&&!f.removed?(We({item:f,arr:l,enableJoin:u,isNeutral:!0,isLastItem:d}),We({item:f,arr:c,enableJoin:u,isNeutral:!0,isLastItem:d})):f.removed?We({item:f,arr:l,enableJoin:u,isLastItem:d}):We({item:f,arr:c,enableJoin:u,isLastItem:d})}let h=0;for(const f of l)f[0]===1&&s.push(ir({line:n-1,spanStart:h,spanLength:f[1].length})),h+=f[1].length;h=0;for(const f of c)f[0]===1&&o.push(ir({line:r-1,spanStart:h,spanLength:f[1].length})),h+=f[1].length}function lr({hunks:t,oldLines:e,newLines:n,splitLineIndex:r=0,unifiedLineIndex:s=0,lineDiffType:o}){const a={},i={},l=[],c=[];let u=1,h=1,f=1,d=1,p="",w="";for(const C of t){for(;e!=null&&n!=null&&u<C.additionStart&&h<C.deletionStart;)a[h]={type:"context-expanded",lineNumber:d,altLineNumber:f,lineIndex:`${s},${r}`},i[u]={type:"context-expanded",lineNumber:f,altLineNumber:d,lineIndex:`${s},${r}`},p+=e[h-1],w+=n[u-1],h++,u++,d++,f++,r++,s++;d=C.deletionStart,f=C.additionStart;for(const g of C.hunkContent)if(g.type==="context")for(const y of g.lines)a[h]={type:"context",lineNumber:d,altLineNumber:f,lineIndex:`${s},${r}`},i[u]={type:"context",lineNumber:f,altLineNumber:d,lineIndex:`${s},${r}`},p+=y,w+=y,h++,u++,f++,d++,r++,s++;else{const y=Math.max(g.additions.length,g.deletions.length);let m=0,_=s;for(;m<y;){const S=g.deletions[m],E=g.additions[m];lc({newLine:E,oldLine:S,oldLineIndex:h,newLineIndex:u,oldDecorations:l,newDecorations:c,lineDiffType:o}),S!=null&&(a[h]={type:"change-deletion",lineNumber:d,lineIndex:`${_},${r}`},p+=S,h++,d++),E!=null&&(i[u]={type:"change-addition",lineNumber:f,lineIndex:`${_+g.deletions.length},${r}`},w+=E,u++,f++),r++,_++,m++}s+=g.additions.length+g.deletions.length}if(!(e==null||n==null||C!==t[t.length-1]))for(;h<=e.length||u<=e.length;){const g=e[h-1],y=n[u-1];if(g==null&&y==null)break;g!=null&&(a[h]={type:"context-expanded",lineNumber:d,altLineNumber:f,lineIndex:`${s},${r}`},p+=g,h++,d++),y!=null&&(i[u]={type:"context-expanded",lineNumber:f,altLineNumber:d,lineIndex:`${s},${r}`},w+=y,u++,f++),r++,s++}}return{oldContent:p,newContent:w,oldInfo:a,newInfo:i,oldDecorations:l,newDecorations:c,splitLineIndex:r,unifiedLineIndex:s}}function cr({oldFile:t,newFile:e,oldInfo:n,newInfo:r,highlighter:s,oldDecorations:o,newDecorations:a,languageOverride:i,options:{theme:l=Oe,...c}}){const u=i??Kt(t.name),h=i??Kt(e.name),{state:f,transformers:d}=ys(),p=typeof l=="string"?{...c,lang:"text",theme:l,transformers:d,decorations:void 0,defaultColor:!1,cssVariablePrefix:D()}:{...c,lang:"text",themes:l,transformers:d,decorations:void 0,defaultColor:!1,cssVariablePrefix:D()};return{oldLines:t.contents===""?[]:(p.lang=u,f.lineInfo=n,p.decorations=o,Zt(s.codeToHast(Pe(t.contents),p))),newLines:e.contents===""?[]:(p.lang=h,p.decorations=a,f.lineInfo=r,Zt(s.codeToHast(Pe(e.contents),p)))}}function cc(t,e,{theme:n=Oe,tokenizeMaxLineLength:r},s=!1){const{state:o,transformers:a}=ys(),i=s?"text":t.lang??Kt(t.name),l=(()=>{if(typeof n=="string")return e.getTheme(n).type})(),c=bs({theme:n,highlighter:e});o.lineInfo=h=>({type:"context",lineIndex:h-1,lineNumber:h});const u=typeof n=="string"?{lang:i,theme:n,transformers:a,defaultColor:!1,cssVariablePrefix:D(),tokenizeMaxLineLength:r}:{lang:i,themes:n,transformers:a,defaultColor:!1,cssVariablePrefix:D(),tokenizeMaxLineLength:r};return{code:Zt(e.codeToHast(Pe(t.contents),u)),themeStyles:c,baseThemeType:l}}let ur,me={theme:Oe,tokenizeMaxLineLength:1e3,lineDiffType:"word-alt"};self.addEventListener("error",t=>{console.error("[Shiki Worker] Unhandled error:",t.error)});self.addEventListener("message",t=>{const e=t.data;try{switch(e.type){case"initialize":uc(e);break;case"set-render-options":hc(e);break;case"file":fc(e);break;case"diff":dc(e);break;default:throw new Error(`Unknown request type: ${e.type}`)}}catch(n){console.error("Worker error:",n),mc(e.id,n)}});function uc({id:t,renderOptions:e,resolvedThemes:n,resolvedLanguages:r}){const s=ht();ms(n,s),r!=null&&fn(r,s),me=e,postMessage({type:"success",id:t,requestType:"initialize",sentAt:Date.now()})}function hc({id:t,renderOptions:e,resolvedThemes:n}){ms(n,ht()),me=e,postMessage({type:"success",id:t,requestType:"set-render-options",sentAt:Date.now()})}function fc({id:t,file:e,resolvedLanguages:n}){const r=ht();n!=null&&fn(n,r);const s={theme:me.theme,tokenizeMaxLineLength:me.tokenizeMaxLineLength};pc(t,cc(e,r,s),s)}function dc({id:t,diff:e,resolvedLanguages:n}){const r=ht();n!=null&&fn(n,r),gc(t,ic(e,r,me),me)}function ht(){return ur??=Xl({themes:[],langs:[],engine:oa()}),ur}function pc(t,e,n){postMessage({type:"success",requestType:"file",id:t,result:e,options:n,sentAt:Date.now()})}function gc(t,e,n){postMessage({type:"success",requestType:"diff",id:t,result:e,options:n,sentAt:Date.now()})}function mc(t,e){const n={type:"error",id:t,error:e instanceof Error?e.message:String(e),stack:e instanceof Error?e.stack:void 0};postMessage(n)}
package/dist/index.html CHANGED
@@ -15,6 +15,12 @@
15
15
  <link rel="apple-touch-icon" sizes="167x167" href="/apple-touch-icon-167x167.png" />
16
16
  <link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png" />
17
17
 
18
+ <!-- Preload Nerd Fonts for terminal icon display -->
19
+ <link rel="preload" href="https://cdn.jsdelivr.net/gh/mshaugh/nerdfont-webfonts@v3.3.0/build/fonts/JetBrainsMonoNerdFont-Regular.woff2"
20
+ as="font" type="font/woff2" crossorigin="anonymous">
21
+ <link rel="preload" href="https://cdn.jsdelivr.net/gh/mshaugh/nerdfont-webfonts@v3.3.0/build/fonts/FiraCodeNerdFont-Regular.woff2"
22
+ as="font" type="font/woff2" crossorigin="anonymous">
23
+
18
24
  <!-- Web app manifest (data URL to avoid nginx auth issues) -->
19
25
  <script>
20
26
  const baseUrl = location.origin;
@@ -119,8 +125,33 @@
119
125
  <meta name="application-name" content="OpenChamber" />
120
126
  <meta name="apple-mobile-web-app-title" content="OpenChamber" />
121
127
 
122
- <!-- Inline CSS for loading screen (before Tailwind loads) -->
128
+ <!-- Inline CSS for loading screen and Nerd Fonts (before Tailwind loads) -->
123
129
  <style>
130
+ /* Nerd Font @font-face declarations for terminal icon support */
131
+ @font-face {
132
+ font-family: 'JetBrainsMono Nerd Font';
133
+ src:
134
+ local('JetBrainsMono Nerd Font'),
135
+ url('https://cdn.jsdelivr.net/gh/mshaugh/nerdfont-webfonts@v3.3.0/build/fonts/JetBrainsMonoNerdFont-Regular.woff2') format('woff2'),
136
+ url('https://cdn.jsdelivr.net/gh/mshaugh/nerdfont-webfonts@v3.3.0/build/fonts/JetBrainsMonoNerdFont-Regular.woff') format('woff');
137
+ font-weight: normal;
138
+ font-style: normal;
139
+ font-display: swap;
140
+ unicode-range: U+E000-F8FF, U+F0000-FFFFF;
141
+ }
142
+
143
+ @font-face {
144
+ font-family: 'FiraCode Nerd Font';
145
+ src:
146
+ local('FiraCode Nerd Font'),
147
+ url('https://cdn.jsdelivr.net/gh/mshaugh/nerdfont-webfonts@v3.3.0/build/fonts/FiraCodeNerdFont-Regular.woff2') format('woff2'),
148
+ url('https://cdn.jsdelivr.net/gh/mshaugh/nerdfont-webfonts@v3.3.0/build/fonts/FiraCodeNerdFont-Regular.woff') format('woff');
149
+ font-weight: normal;
150
+ font-style: normal;
151
+ font-display: swap;
152
+ unicode-range: U+E000-F8FF, U+F0000-FFFFF;
153
+ }
154
+
124
155
  :root {
125
156
  --splash-background: #151313;
126
157
  --splash-stroke: white;
@@ -160,10 +191,10 @@
160
191
  pointer-events: none;
161
192
  }
162
193
  </style>
163
- <script type="module" crossorigin src="/assets/index-BqCwlsig.js"></script>
164
- <link rel="modulepreload" crossorigin href="/assets/vendor-.bun-C07YQe9X.js">
194
+ <script type="module" crossorigin src="/assets/index-hhW6FfkZ.js"></script>
195
+ <link rel="modulepreload" crossorigin href="/assets/vendor-.bun-1E5mTZCK.js">
165
196
  <link rel="stylesheet" crossorigin href="/assets/vendor--Jn2c0Clh.css">
166
- <link rel="stylesheet" crossorigin href="/assets/index-CFHNKWvn.css">
197
+ <link rel="stylesheet" crossorigin href="/assets/index-Xx_yi155.css">
167
198
  </head>
168
199
  <body class="h-full bg-background text-foreground">
169
200
  <div id="root" class="h-full">
@@ -243,6 +274,34 @@
243
274
  }, 10000);
244
275
  </script>
245
276
 
277
+ <!-- CSS Font Loading API for reliable Nerd Font loading -->
278
+ <script>
279
+ (function() {
280
+ const fonts = [
281
+ {
282
+ name: 'JetBrainsMono Nerd Font',
283
+ url: 'https://cdn.jsdelivr.net/gh/mshaugh/nerdfont-webfonts@v3.3.0/build/fonts/JetBrainsMonoNerdFont-Regular.woff2'
284
+ },
285
+ {
286
+ name: 'FiraCode Nerd Font',
287
+ url: 'https://cdn.jsdelivr.net/gh/mshaugh/nerdfont-webfonts@v3.3.0/build/fonts/FiraCodeNerdFont-Regular.woff2'
288
+ }
289
+ ];
290
+
291
+ const fontPromises = fonts.map(font => {
292
+ const fontFace = new FontFace(font.name, `url(${font.url}) format('woff2')`);
293
+ document.fonts.add(fontFace);
294
+ return fontFace.load().catch(err => {
295
+ console.warn(`Failed to load font: ${font.name}`, err);
296
+ });
297
+ });
298
+
299
+ Promise.allSettled(fontPromises).then(() => {
300
+ document.documentElement.classList.add('fonts-loaded');
301
+ });
302
+ })();
303
+ </script>
304
+
246
305
  <!-- Polyfill for process before loading React -->
247
306
  <script>
248
307
  if (typeof process === 'undefined') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openchamber/web",
3
- "version": "1.4.7",
3
+ "version": "1.4.9",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./server/index.js",
@@ -25,7 +25,7 @@
25
25
  "@fontsource/ibm-plex-mono": "^5.2.7",
26
26
  "@fontsource/ibm-plex-sans": "^5.1.1",
27
27
  "@ibm/plex": "^6.4.1",
28
- "@opencode-ai/sdk": "^1.1.8",
28
+ "@opencode-ai/sdk": "^1.1.19",
29
29
  "@radix-ui/react-collapsible": "^1.1.12",
30
30
  "@radix-ui/react-dialog": "^1.1.15",
31
31
  "@radix-ui/react-dropdown-menu": "^2.1.16",