@prismshadow/penguin-server 0.2.10 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/api/types.d.ts +1014 -12
- package/dist/api/types.js +7 -0
- package/dist/auth-token.js +6 -4
- package/dist/auth-token.js.map +1 -1
- package/dist/{chunk-Q65VPAQS.js → chunk-3I2XOPJB.js} +102 -55
- package/dist/chunk-3I2XOPJB.js.map +1 -0
- package/dist/{chunk-ADZJYDNC.js → chunk-A3QANMU5.js} +293 -3
- package/dist/chunk-A3QANMU5.js.map +1 -0
- package/dist/chunk-B5IP37ZQ.js +56 -0
- package/dist/chunk-L2H3K4DT.js +7 -0
- package/dist/chunk-L2H3K4DT.js.map +1 -0
- package/dist/chunk-LPPVGHYD.js +83 -0
- package/dist/chunk-LPPVGHYD.js.map +1 -0
- package/dist/{chunk-TTGGJDNA.js → chunk-S3BI6R7I.js} +2 -2
- package/dist/{chunk-HOS3W3UP.js → chunk-TOOTEEM4.js} +50 -8
- package/dist/chunk-TOOTEEM4.js.map +1 -0
- package/dist/hmr/manifest.d.ts +1 -77
- package/dist/hmr/manifest.js +6 -1
- package/dist/index.js +50757 -20174
- package/dist/index.js.map +1 -1
- package/dist/initial-password.js +1 -0
- package/dist/lock.js +1 -0
- package/dist/machine-status.js +2 -1
- package/dist/machine-status.js.map +1 -1
- package/dist/plugin/index.d.ts +2595 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/reset-admin-password.js +7 -5
- package/dist/reset-admin-password.js.map +1 -1
- package/dist/secret-file.js +2 -0
- package/dist/secret-file.js.map +1 -1
- package/dist/version-report.js +3 -2
- package/package.json +11 -9
- package/web-dist/assets/{addon-clipboard-1cARCaK9.js → addon-clipboard-DrZY90Ks.js} +1 -1
- package/web-dist/assets/{addon-fit-BWdzl8Er.js → addon-fit-CtEAdAax.js} +1 -1
- package/web-dist/assets/{addon-web-links-DjXuvn4Z.js → addon-web-links-DJL13cYY.js} +1 -1
- package/web-dist/assets/c-BG-tZi7o.js +1 -0
- package/web-dist/assets/cpp-CaeG3uDQ.js +1 -0
- package/web-dist/assets/css-Br67jR8j.js +1 -0
- package/web-dist/assets/diff-jW5kmiru.js +1 -0
- package/web-dist/assets/github-dark-BQV5ugrc.js +1 -0
- package/web-dist/assets/github-light-Rcb2q3L5.js +1 -0
- package/web-dist/assets/go-B7VTfpnm.js +1 -0
- package/web-dist/assets/highlighter-CUb4XKtQ.js +2 -0
- package/web-dist/assets/{highlighter-Cu43iYr8.js → highlighter-core-CrBdruEx.js} +2 -2
- package/web-dist/assets/highlighter.worker-CL6f9Fzw.js +152 -0
- package/web-dist/assets/html-BW_6VhB7.js +1 -0
- package/web-dist/assets/index-CmfumtXy.js +570 -0
- package/web-dist/assets/index-Ywc2uM5u.css +1 -0
- package/web-dist/assets/ini-Dix3pTmg.js +1 -0
- package/web-dist/assets/java-BTDmaRNO.js +1 -0
- package/web-dist/assets/javascript-WyGyM1wV.js +1 -0
- package/web-dist/assets/json-B8JryHcM.js +1 -0
- package/web-dist/assets/jsx-8cLv2Six.js +1 -0
- package/web-dist/assets/log-CcaF_xNv.js +1 -0
- package/web-dist/assets/markdown-DX-TNHnc.js +1 -0
- package/web-dist/assets/php-CNeTOyEV.js +1 -0
- package/web-dist/assets/python-B6Ihcp-E.js +1 -0
- package/web-dist/assets/ruby-CYiNE6ps.js +1 -0
- package/web-dist/assets/rust-CxuBE0J8.js +1 -0
- package/web-dist/assets/shellscript-DgJyDXW6.js +1 -0
- package/web-dist/assets/sql-Dq2MiB0T.js +1 -0
- package/web-dist/assets/toml-Ms459DBw.js +1 -0
- package/web-dist/assets/tsx-D6116Ycy.js +1 -0
- package/web-dist/assets/typescript-BqvgUolh.js +1 -0
- package/web-dist/assets/xml-BkAJuBCc.js +1 -0
- package/web-dist/assets/{xterm-DKcY6q-I.js → xterm-B2oS8Mg8.js} +1 -1
- package/web-dist/assets/yaml-Bopit2L3.js +1 -0
- package/web-dist/index.html +2 -2
- package/dist/chunk-4SXGU7RO.js +0 -50
- package/dist/chunk-4SXGU7RO.js.map +0 -1
- package/dist/chunk-ADZJYDNC.js.map +0 -1
- package/dist/chunk-HOS3W3UP.js.map +0 -1
- package/dist/chunk-Q65VPAQS.js.map +0 -1
- package/dist/extension/index.d.ts +0 -212
- package/web-dist/assets/index-Bm9n7ZV-.js +0 -457
- package/web-dist/assets/index-DR4PrRzS.css +0 -1
- /package/dist/{extension/index.js.map → chunk-B5IP37ZQ.js.map} +0 -0
- /package/dist/{chunk-TTGGJDNA.js.map → chunk-S3BI6R7I.js.map} +0 -0
- /package/dist/{extension → plugin}/index.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{w as vt,s as Nn,f as $r,a as Lr,b as Pr,c as Dt,h as Tr,r as Gr,i as Mr,L as Or,_ as jt}from"./index-Bm9n7ZV-.js";const Ut={}.hasOwnProperty;function Br(e,t){const n=t||{};function r(s,...o){let i=r.invalid;const a=r.handlers;if(s&&Ut.call(s,e)){const c=String(s[e]);i=Ut.call(a,c)?a[c]:r.unknown}if(i)return i.call(this,s,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var k=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Fr(e){return Nt(e)}function Nt(e){return Array.isArray(e)?Dr(e):e instanceof RegExp?e:typeof e=="object"?jr(e):e}function Dr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Nt(e[n]);return t}function jr(e){let t={};for(let n in e)t[n]=Nt(e[n]);return t}function Rn(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function $n(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?$n(e.substring(0,e.length-1)):e.substr(~t+1)}var Je=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,we=class{static hasCaptures(e){return e===null?!1:(Je.lastIndex=0,Je.test(e))}static replaceCaptures(e,t,n){return e.replace(Je,(r,s,o,i)=>{let a=n[parseInt(s||o,10)];if(a){let c=t.substring(a.start,a.end);for(;c[0]===".";)c=c.substring(1);switch(i){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function Ln(e,t){return e<t?-1:e>t?1:0}function Pn(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let s=0;s<n;s++){let o=Ln(e[s],t[s]);if(o!==0)return o}return 0}return n-r}function Wt(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Tn(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Gn=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},Ne=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(zr(e),t)}static createFromParsedTheme(e,t){return qr(e,t)}_cachedMatchRoot=new Gn(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(s=>Ur(e.parent,s.parentScopes));return r?new Mn(r.fontStyle,r.foreground,r.background):null}},Ye=class Ee{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Ee(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new Ee(n,t[r]);return n}push(t){return new Ee(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function Ur(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],s=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],s=!0}for(;e&&!Wr(e.scopeName,r);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Wr(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Mn=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function zr(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let s=0,o=t.length;s<o;s++){let i=t[s];if(!i.settings)continue;let a;if(typeof i.scope=="string"){let h=i.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),a=h.split(",")}else Array.isArray(i.scope)?a=i.scope:a=[""];let c=-1;if(typeof i.settings.fontStyle=="string"){c=0;let h=i.settings.fontStyle.split(" ");for(let f=0,d=h.length;f<d;f++)switch(h[f]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let l=null;typeof i.settings.foreground=="string"&&Wt(i.settings.foreground)&&(l=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&Wt(i.settings.background)&&(u=i.settings.background);for(let h=0,f=a.length;h<f;h++){let p=a[h].trim().split(" "),y=p[p.length-1],b=null;p.length>1&&(b=p.slice(0,p.length-1),b.reverse()),n[r++]=new Hr(y,b,s,c,l,u)}}return n}var Hr=class{constructor(e,t,n,r,s,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=s,this.background=o}},R=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(R||{});function qr(e,t){e.sort((c,l)=>{let u=Ln(c.scope,l.scope);return u!==0||(u=Pn(c.parentScopes,l.parentScopes),u!==0)?u:c.index-l.index});let n=0,r="#000000",s="#ffffff";for(;e.length>=1&&e[0].scope==="";){let c=e.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(r=c.foreground),c.background!==null&&(s=c.background)}let o=new Vr(t),i=new Mn(n,o.getId(r),o.getId(s)),a=new Qr(new ft(0,null,-1,0,0),[]);for(let c=0,l=e.length;c<l;c++){let u=e[c];a.insert(0,u.scope,u.parentScopes,u.fontStyle,o.getId(u.foreground),o.getId(u.background))}return new Ne(o,i,a)}var Vr=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Xr=Object.freeze([]),ft=class On{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(t,n,r,s,o){this.scopeDepth=t,this.parentScopes=n||Xr,this.fontStyle=r,this.foreground=s,this.background=o}clone(){return new On(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,s=t.length;r<s;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,s){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},Qr=class dt{constructor(t,n=[],r={}){this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,s=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=t.parentScopes.length||s>=n.parentScopes.length);){const o=n.parentScopes[s].length-t.parentScopes[r].length;if(o!==0)return o;r++,s++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),s,o;if(r===-1?(s=t,o=""):(s=t.substring(0,r),o=t.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(dt._cmpBySpecificity),n}insert(t,n,r,s,o,i){if(n===""){this._doInsertHere(t,r,s,o,i);return}let a=n.indexOf("."),c,l;a===-1?(c=n,l=""):(c=n.substring(0,a),l=n.substring(a+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new dt(this._mainRule.clone(),ft.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,s,o,i)}_doInsertHere(t,n,r,s,o){if(n===null){this._mainRule.acceptOverwrite(t,r,s,o);return}for(let i=0,a=this._rulesWithParentScopes.length;i<a;i++){let c=this._rulesWithParentScopes[i];if(Pn(c.parentScopes,n)===0){c.acceptOverwrite(t,r,s,o);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new ft(t,n,r,s,o))}},J=class L{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=L.getLanguageId(t),r=L.getTokenType(t),s=L.getFontStyle(t),o=L.getForeground(t),i=L.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:o,background:i})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,s,o,i,a){let c=L.getLanguageId(t),l=L.getTokenType(t),u=L.containsBalancedBrackets(t)?1:0,h=L.getFontStyle(t),f=L.getForeground(t),d=L.getBackground(t);return n!==0&&(c=n),r!==8&&(l=r),s!==null&&(u=s?1:0),o!==-1&&(h=o),i!==0&&(f=i),a!==0&&(d=a),(c<<0|l<<8|u<<10|h<<11|f<<15|d<<24)>>>0}};function Re(e,t){const n=[],r=Kr(e);let s=r.next();for(;s!==null;){let c=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let l=i();if(n.push({matcher:l,priority:c}),s!==",")break;s=r.next()}return n;function o(){if(s==="-"){s=r.next();const c=o();return l=>!!c&&!c(l)}if(s==="("){s=r.next();const c=a();return s===")"&&(s=r.next()),c}if(zt(s)){const c=[];do c.push(s),s=r.next();while(zt(s));return l=>t(c,l)}return null}function i(){const c=[];let l=o();for(;l;)c.push(l),l=o();return u=>c.every(h=>h(u))}function a(){const c=[];let l=i();for(;l&&(c.push(l),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");l=i()}return u=>c.some(h=>h(u))}}function zt(e){return!!e&&!!e.match(/[\w\.:]+/)}function Kr(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function Bn(e){typeof e.dispose=="function"&&e.dispose()}var de=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Zr=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Jr=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Yr=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new de(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new Jr;for(const n of e)es(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof de){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function es(e,t,n,r){const s=n.lookup(e.scopeName);if(!s){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=n.lookup(t);e instanceof de?Ie({baseGrammar:o,selfGrammar:s},r):pt(e.ruleName,{baseGrammar:o,selfGrammar:s,repository:s.repository},r);const i=n.injections(e.scopeName);if(i)for(const a of i)r.add(new de(a))}function pt(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];$e([r],t,n)}}function Ie(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&$e(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&$e(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function $e(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?Rn({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&$e(r.patterns,{...t,repository:s},n);const o=r.include;if(!o)continue;const i=Fn(o);switch(i.kind){case 0:Ie({...t,selfGrammar:t.baseGrammar},n);break;case 1:Ie(t,n);break;case 2:pt(i.ruleName,{...t,repository:s},n);break;case 3:case 4:const a=i.scopeName===t.selfGrammar.scopeName?t.selfGrammar:i.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){const c={baseGrammar:t.baseGrammar,selfGrammar:a,repository:s};i.kind===4?pt(i.ruleName,c,n):Ie(c,n)}else i.kind===4?n.add(new Zr(i.scopeName,i.ruleName)):n.add(new de(i.scopeName));break}}}var ts=class{kind=0},ns=class{kind=1},rs=class{constructor(e){this.ruleName=e}kind=2},ss=class{constructor(e){this.scopeName=e}kind=3},os=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Fn(e){if(e==="$base")return new ts;if(e==="$self")return new ns;const t=e.indexOf("#");if(t===-1)return new ss(e);if(t===0)return new rs(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new os(n,r)}}var is=/\\(\d+)/,Ht=/\\(\d+)/g,as=-1,Dn=-2;var be=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=we.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=we.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${$n(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:we.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:we.replaceCaptures(this._contentName,e,t)}},cs=class extends be{retokenizeCapturedWithRuleId;constructor(e,t,n,r,s){super(e,t,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,r){throw new Error("Not supported!")}},ls=class extends be{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,null),this._match=new pe(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ge,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},qt=class extends be{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ge,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},gt=class extends be{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,s,o,i,a,c,l){super(e,t,n,r),this._begin=new pe(s,this.id),this.beginCaptures=o,this._end=new pe(i||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ge;for(const n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Le=class extends be{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,s,o,i,a,c){super(e,t,n,r),this._begin=new pe(s,this.id),this.beginCaptures=o,this.whileCaptures=a,this._while=new pe(i,Dn),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ge;for(const t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new ge,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||""),this._cachedCompiledWhilePatterns}},jn=class N{static createCaptureRule(t,n,r,s,o){return t.registerRule(i=>new cs(n,i,r,s,o))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(s=>{if(t.id=s,t.match)return new ls(t.$vscodeTextmateLocation,t.id,t.name,t.match,N._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=Rn({},r,t.repository));let o=t.patterns;return typeof o>"u"&&t.include&&(o=[{include:t.include}]),new qt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,N._compilePatterns(o,n,r))}return t.while?new Le(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,N._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,N._compileCaptures(t.whileCaptures||t.captures,n,r),N._compilePatterns(t.patterns,n,r)):new gt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,N._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,N._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,N._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let s=[];if(t){let o=0;for(const i in t){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);a>o&&(o=a)}for(let i=0;i<=o;i++)s[i]=null;for(const i in t){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);let c=0;t[i].patterns&&(c=N.getCompiledRuleId(t[i],n,r)),s[a]=N.createCaptureRule(n,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,c)}}return s}static _compilePatterns(t,n,r){let s=[];if(t)for(let o=0,i=t.length;o<i;o++){const a=t[o];let c=-1;if(a.include){const l=Fn(a.include);switch(l.kind){case 0:case 1:c=N.getCompiledRuleId(r[a.include],n,r);break;case 2:let u=r[l.ruleName];u&&(c=N.getCompiledRuleId(u,n,r));break;case 3:case 4:const h=l.scopeName,f=l.kind===4?l.ruleName:null,d=n.getExternalGrammar(h,r);if(d)if(f){let p=d.repository[f];p&&(c=N.getCompiledRuleId(p,n,d.repository))}else c=N.getCompiledRuleId(d.repository.$self,n,d.repository);break}}else c=N.getCompiledRuleId(a,n,r);if(c!==-1){const l=n.getRule(c);let u=!1;if((l instanceof qt||l instanceof gt||l instanceof Le)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;s.push(c)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},pe=class Un{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(t,n){if(t&&typeof t=="string"){const r=t.length;let s=0,o=[],i=!1;for(let a=0;a<r;a++)if(t.charAt(a)==="\\"&&a+1<r){const l=t.charAt(a+1);l==="z"?(o.push(t.substring(s,a)),o.push("$(?!\\n)(?<!\\n)"),s=a+2):(l==="A"||l==="G")&&(i=!0),a++}this.hasAnchor=i,s===0?this.source=t:(o.push(t.substring(s,r)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=is.test(this.source):this.hasBackReferences=!1}clone(){return new Un(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(s=>t.substring(s.start,s.end));return Ht.lastIndex=0,this.source.replace(Ht,(s,o)=>Tn(r[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],s=[],o,i,a,c;for(o=0,i=this.source.length;o<i;o++)a=this.source.charAt(o),t[o]=a,n[o]=a,r[o]=a,s[o]=a,a==="\\"&&o+1<i&&(c=this.source.charAt(o+1),c==="A"?(t[o+1]="",n[o+1]="",r[o+1]="A",s[o+1]="A"):c==="G"?(t[o+1]="",n[o+1]="G",r[o+1]="",s[o+1]="G"):(t[o+1]=c,n[o+1]=c,r[o+1]=c,s[o+1]=c),o++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},ge=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new Vt(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(s=>s.resolveAnchors(t,n));return new Vt(e,r,this._items.map(s=>s.ruleId))}},Vt=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
|
|
1
|
+
import{w as vt,s as Nn,f as $r,a as Lr,b as Pr,c as Dt,h as Tr,r as Gr,i as Mr,L as Or,_ as jt}from"./index-CmfumtXy.js";const Ut={}.hasOwnProperty;function Br(e,t){const n=t||{};function r(s,...o){let i=r.invalid;const a=r.handlers;if(s&&Ut.call(s,e)){const c=String(s[e]);i=Ut.call(a,c)?a[c]:r.unknown}if(i)return i.call(this,s,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var k=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Fr(e){return Nt(e)}function Nt(e){return Array.isArray(e)?Dr(e):e instanceof RegExp?e:typeof e=="object"?jr(e):e}function Dr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Nt(e[n]);return t}function jr(e){let t={};for(let n in e)t[n]=Nt(e[n]);return t}function Rn(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function $n(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?$n(e.substring(0,e.length-1)):e.substr(~t+1)}var Je=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,we=class{static hasCaptures(e){return e===null?!1:(Je.lastIndex=0,Je.test(e))}static replaceCaptures(e,t,n){return e.replace(Je,(r,s,o,i)=>{let a=n[parseInt(s||o,10)];if(a){let c=t.substring(a.start,a.end);for(;c[0]===".";)c=c.substring(1);switch(i){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function Ln(e,t){return e<t?-1:e>t?1:0}function Pn(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let s=0;s<n;s++){let o=Ln(e[s],t[s]);if(o!==0)return o}return 0}return n-r}function Wt(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Tn(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Gn=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},Ne=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(zr(e),t)}static createFromParsedTheme(e,t){return qr(e,t)}_cachedMatchRoot=new Gn(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(s=>Ur(e.parent,s.parentScopes));return r?new Mn(r.fontStyle,r.foreground,r.background):null}},Ye=class Ee{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Ee(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new Ee(n,t[r]);return n}push(t){return new Ee(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function Ur(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],s=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],s=!0}for(;e&&!Wr(e.scopeName,r);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Wr(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Mn=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function zr(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let s=0,o=t.length;s<o;s++){let i=t[s];if(!i.settings)continue;let a;if(typeof i.scope=="string"){let h=i.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),a=h.split(",")}else Array.isArray(i.scope)?a=i.scope:a=[""];let c=-1;if(typeof i.settings.fontStyle=="string"){c=0;let h=i.settings.fontStyle.split(" ");for(let f=0,d=h.length;f<d;f++)switch(h[f]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let l=null;typeof i.settings.foreground=="string"&&Wt(i.settings.foreground)&&(l=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&Wt(i.settings.background)&&(u=i.settings.background);for(let h=0,f=a.length;h<f;h++){let p=a[h].trim().split(" "),y=p[p.length-1],b=null;p.length>1&&(b=p.slice(0,p.length-1),b.reverse()),n[r++]=new Hr(y,b,s,c,l,u)}}return n}var Hr=class{constructor(e,t,n,r,s,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=s,this.background=o}},R=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(R||{});function qr(e,t){e.sort((c,l)=>{let u=Ln(c.scope,l.scope);return u!==0||(u=Pn(c.parentScopes,l.parentScopes),u!==0)?u:c.index-l.index});let n=0,r="#000000",s="#ffffff";for(;e.length>=1&&e[0].scope==="";){let c=e.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(r=c.foreground),c.background!==null&&(s=c.background)}let o=new Vr(t),i=new Mn(n,o.getId(r),o.getId(s)),a=new Qr(new ft(0,null,-1,0,0),[]);for(let c=0,l=e.length;c<l;c++){let u=e[c];a.insert(0,u.scope,u.parentScopes,u.fontStyle,o.getId(u.foreground),o.getId(u.background))}return new Ne(o,i,a)}var Vr=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Xr=Object.freeze([]),ft=class On{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(t,n,r,s,o){this.scopeDepth=t,this.parentScopes=n||Xr,this.fontStyle=r,this.foreground=s,this.background=o}clone(){return new On(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,s=t.length;r<s;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,s){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},Qr=class dt{constructor(t,n=[],r={}){this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,s=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=t.parentScopes.length||s>=n.parentScopes.length);){const o=n.parentScopes[s].length-t.parentScopes[r].length;if(o!==0)return o;r++,s++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),s,o;if(r===-1?(s=t,o=""):(s=t.substring(0,r),o=t.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(dt._cmpBySpecificity),n}insert(t,n,r,s,o,i){if(n===""){this._doInsertHere(t,r,s,o,i);return}let a=n.indexOf("."),c,l;a===-1?(c=n,l=""):(c=n.substring(0,a),l=n.substring(a+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new dt(this._mainRule.clone(),ft.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,s,o,i)}_doInsertHere(t,n,r,s,o){if(n===null){this._mainRule.acceptOverwrite(t,r,s,o);return}for(let i=0,a=this._rulesWithParentScopes.length;i<a;i++){let c=this._rulesWithParentScopes[i];if(Pn(c.parentScopes,n)===0){c.acceptOverwrite(t,r,s,o);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new ft(t,n,r,s,o))}},J=class L{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=L.getLanguageId(t),r=L.getTokenType(t),s=L.getFontStyle(t),o=L.getForeground(t),i=L.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:o,background:i})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,s,o,i,a){let c=L.getLanguageId(t),l=L.getTokenType(t),u=L.containsBalancedBrackets(t)?1:0,h=L.getFontStyle(t),f=L.getForeground(t),d=L.getBackground(t);return n!==0&&(c=n),r!==8&&(l=r),s!==null&&(u=s?1:0),o!==-1&&(h=o),i!==0&&(f=i),a!==0&&(d=a),(c<<0|l<<8|u<<10|h<<11|f<<15|d<<24)>>>0}};function Re(e,t){const n=[],r=Kr(e);let s=r.next();for(;s!==null;){let c=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let l=i();if(n.push({matcher:l,priority:c}),s!==",")break;s=r.next()}return n;function o(){if(s==="-"){s=r.next();const c=o();return l=>!!c&&!c(l)}if(s==="("){s=r.next();const c=a();return s===")"&&(s=r.next()),c}if(zt(s)){const c=[];do c.push(s),s=r.next();while(zt(s));return l=>t(c,l)}return null}function i(){const c=[];let l=o();for(;l;)c.push(l),l=o();return u=>c.every(h=>h(u))}function a(){const c=[];let l=i();for(;l&&(c.push(l),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");l=i()}return u=>c.some(h=>h(u))}}function zt(e){return!!e&&!!e.match(/[\w\.:]+/)}function Kr(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function Bn(e){typeof e.dispose=="function"&&e.dispose()}var de=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Zr=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Jr=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Yr=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new de(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new Jr;for(const n of e)es(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof de){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function es(e,t,n,r){const s=n.lookup(e.scopeName);if(!s){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=n.lookup(t);e instanceof de?Ie({baseGrammar:o,selfGrammar:s},r):pt(e.ruleName,{baseGrammar:o,selfGrammar:s,repository:s.repository},r);const i=n.injections(e.scopeName);if(i)for(const a of i)r.add(new de(a))}function pt(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];$e([r],t,n)}}function Ie(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&$e(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&$e(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function $e(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?Rn({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&$e(r.patterns,{...t,repository:s},n);const o=r.include;if(!o)continue;const i=Fn(o);switch(i.kind){case 0:Ie({...t,selfGrammar:t.baseGrammar},n);break;case 1:Ie(t,n);break;case 2:pt(i.ruleName,{...t,repository:s},n);break;case 3:case 4:const a=i.scopeName===t.selfGrammar.scopeName?t.selfGrammar:i.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){const c={baseGrammar:t.baseGrammar,selfGrammar:a,repository:s};i.kind===4?pt(i.ruleName,c,n):Ie(c,n)}else i.kind===4?n.add(new Zr(i.scopeName,i.ruleName)):n.add(new de(i.scopeName));break}}}var ts=class{kind=0},ns=class{kind=1},rs=class{constructor(e){this.ruleName=e}kind=2},ss=class{constructor(e){this.scopeName=e}kind=3},os=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Fn(e){if(e==="$base")return new ts;if(e==="$self")return new ns;const t=e.indexOf("#");if(t===-1)return new ss(e);if(t===0)return new rs(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new os(n,r)}}var is=/\\(\d+)/,Ht=/\\(\d+)/g,as=-1,Dn=-2;var be=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=we.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=we.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${$n(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:we.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:we.replaceCaptures(this._contentName,e,t)}},cs=class extends be{retokenizeCapturedWithRuleId;constructor(e,t,n,r,s){super(e,t,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,r){throw new Error("Not supported!")}},ls=class extends be{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,null),this._match=new pe(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ge,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},qt=class extends be{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ge,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},gt=class extends be{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,s,o,i,a,c,l){super(e,t,n,r),this._begin=new pe(s,this.id),this.beginCaptures=o,this._end=new pe(i||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ge;for(const n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Le=class extends be{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,s,o,i,a,c){super(e,t,n,r),this._begin=new pe(s,this.id),this.beginCaptures=o,this.whileCaptures=a,this._while=new pe(i,Dn),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ge;for(const t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new ge,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||""),this._cachedCompiledWhilePatterns}},jn=class N{static createCaptureRule(t,n,r,s,o){return t.registerRule(i=>new cs(n,i,r,s,o))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(s=>{if(t.id=s,t.match)return new ls(t.$vscodeTextmateLocation,t.id,t.name,t.match,N._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=Rn({},r,t.repository));let o=t.patterns;return typeof o>"u"&&t.include&&(o=[{include:t.include}]),new qt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,N._compilePatterns(o,n,r))}return t.while?new Le(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,N._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,N._compileCaptures(t.whileCaptures||t.captures,n,r),N._compilePatterns(t.patterns,n,r)):new gt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,N._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,N._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,N._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let s=[];if(t){let o=0;for(const i in t){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);a>o&&(o=a)}for(let i=0;i<=o;i++)s[i]=null;for(const i in t){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);let c=0;t[i].patterns&&(c=N.getCompiledRuleId(t[i],n,r)),s[a]=N.createCaptureRule(n,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,c)}}return s}static _compilePatterns(t,n,r){let s=[];if(t)for(let o=0,i=t.length;o<i;o++){const a=t[o];let c=-1;if(a.include){const l=Fn(a.include);switch(l.kind){case 0:case 1:c=N.getCompiledRuleId(r[a.include],n,r);break;case 2:let u=r[l.ruleName];u&&(c=N.getCompiledRuleId(u,n,r));break;case 3:case 4:const h=l.scopeName,f=l.kind===4?l.ruleName:null,d=n.getExternalGrammar(h,r);if(d)if(f){let p=d.repository[f];p&&(c=N.getCompiledRuleId(p,n,d.repository))}else c=N.getCompiledRuleId(d.repository.$self,n,d.repository);break}}else c=N.getCompiledRuleId(a,n,r);if(c!==-1){const l=n.getRule(c);let u=!1;if((l instanceof qt||l instanceof gt||l instanceof Le)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;s.push(c)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},pe=class Un{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(t,n){if(t&&typeof t=="string"){const r=t.length;let s=0,o=[],i=!1;for(let a=0;a<r;a++)if(t.charAt(a)==="\\"&&a+1<r){const l=t.charAt(a+1);l==="z"?(o.push(t.substring(s,a)),o.push("$(?!\\n)(?<!\\n)"),s=a+2):(l==="A"||l==="G")&&(i=!0),a++}this.hasAnchor=i,s===0?this.source=t:(o.push(t.substring(s,r)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=is.test(this.source):this.hasBackReferences=!1}clone(){return new Un(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(s=>t.substring(s.start,s.end));return Ht.lastIndex=0,this.source.replace(Ht,(s,o)=>Tn(r[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],s=[],o,i,a,c;for(o=0,i=this.source.length;o<i;o++)a=this.source.charAt(o),t[o]=a,n[o]=a,r[o]=a,s[o]=a,a==="\\"&&o+1<i&&(c=this.source.charAt(o+1),c==="A"?(t[o+1]="",n[o+1]="",r[o+1]="A",s[o+1]="A"):c==="G"?(t[o+1]="",n[o+1]="G",r[o+1]="",s[o+1]="G"):(t[o+1]=c,n[o+1]=c,r[o+1]=c,s[o+1]=c),o++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},ge=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new Vt(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(s=>s.resolveAnchors(t,n));return new Vt(e,r,this._items.map(s=>s.ruleId))}},Vt=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
|
|
2
2
|
`)}findNextMatchSync(e,t,n){const r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},et=class{constructor(e,t){this.languageId=e,this.tokenType=t}},us=class mt{_defaultAttributes;_embeddedLanguagesMatcher;constructor(t,n){this._defaultAttributes=new et(t,8),this._embeddedLanguagesMatcher=new hs(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?mt._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new et(0,0);_getBasicScopeAttributes=new Gn(t=>{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new et(n,r)});_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(mt.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},hs=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,r])=>Tn(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},Xt=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Wn(e,t,n,r,s,o,i,a){const c=t.content.length;let l=!1,u=-1;if(i){const d=fs(e,t,n,r,s,o);s=d.stack,r=d.linePos,n=d.isFirstLine,u=d.anchorPosition}const h=Date.now();for(;!l;){if(a!==0&&Date.now()-h>a)return new Xt(s,!0);f()}return new Xt(s,!1);function f(){const d=ds(e,t,n,r,s,u);if(!d){o.produce(s,c),l=!0;return}const p=d.captureIndices,y=d.matchedRuleId,b=p&&p.length>0?p[0].end>r:!1;if(y===as){const g=s.getRule(e);o.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),ue(e,t,n,s,o,g.endCaptures,p),o.produce(s,p[0].end);const m=s;if(s=s.parent,u=m.getAnchorPos(),!b&&m.getEnterPos()===r){s=m,o.produce(s,c),l=!0;return}}else{const g=e.getRule(y);o.produce(s,p[0].start);const m=s,_=g.getName(t.content,p),C=s.contentNameScopesList.pushAttributed(_,e);if(s=s.push(y,r,u,p[0].end===c,null,C,C),g instanceof gt){const S=g;ue(e,t,n,s,o,S.beginCaptures,p),o.produce(s,p[0].end),u=p[0].end;const v=S.getContentName(t.content,p),$=C.pushAttributed(v,e);if(s=s.withContentNameScopesList($),S.endHasBackReferences&&(s=s.withEndRule(S.getEndWithResolvedBackReferences(t.content,p))),!b&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,c),l=!0;return}}else if(g instanceof Le){const S=g;ue(e,t,n,s,o,S.beginCaptures,p),o.produce(s,p[0].end),u=p[0].end;const v=S.getContentName(t.content,p),$=C.pushAttributed(v,e);if(s=s.withContentNameScopesList($),S.whileHasBackReferences&&(s=s.withEndRule(S.getWhileWithResolvedBackReferences(t.content,p))),!b&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,c),l=!0;return}}else if(ue(e,t,n,s,o,g.captures,p),o.produce(s,p[0].end),s=s.pop(),!b){s=s.safePop(),o.produce(s,c),l=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function fs(e,t,n,r,s,o){let i=s.beginRuleCapturedEOL?0:-1;const a=[];for(let c=s;c;c=c.pop()){const l=c.getRule(e);l instanceof Le&&a.push({rule:l,stack:c})}for(let c=a.pop();c;c=a.pop()){const{ruleScanner:l,findOptions:u}=ms(c.rule,e,c.stack.endRule,n,r===i),h=l.findNextMatchSync(t,r,u);if(h){if(h.ruleId!==Dn){s=c.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(o.produce(c.stack,h.captureIndices[0].start),ue(e,t,n,c.stack,o,c.rule.whileCaptures,h.captureIndices),o.produce(c.stack,h.captureIndices[0].end),i=h.captureIndices[0].end,h.captureIndices[0].end>r&&(r=h.captureIndices[0].end,n=!1))}else{s=c.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:i,isFirstLine:n}}function ds(e,t,n,r,s,o){const i=ps(e,t,n,r,s,o),a=e.getInjections();if(a.length===0)return i;const c=gs(a,e,t,n,r,s,o);if(!c)return i;if(!i)return c;const l=i.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:i}function ps(e,t,n,r,s,o){const i=s.getRule(e),{ruleScanner:a,findOptions:c}=zn(i,e,s.endRule,n,r===o),l=a.findNextMatchSync(t,r,c);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function gs(e,t,n,r,s,o,i){let a=Number.MAX_VALUE,c=null,l,u=0;const h=o.contentNameScopesList.getScopeNames();for(let f=0,d=e.length;f<d;f++){const p=e[f];if(!p.matcher(h))continue;const y=t.getRule(p.ruleId),{ruleScanner:b,findOptions:g}=zn(y,t,null,r,s===i),m=b.findNextMatchSync(n,s,g);if(!m)continue;const _=m.captureIndices[0].start;if(!(_>=a)&&(a=_,c=m.captureIndices,l=m.ruleId,u=p.priority,a===s))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function zn(e,t,n,r,s){return{ruleScanner:e.compileAG(t,n,r,s),findOptions:0}}function ms(e,t,n,r,s){return{ruleScanner:e.compileWhileAG(t,n,r,s),findOptions:0}}function ue(e,t,n,r,s,o,i){if(o.length===0)return;const a=t.content,c=Math.min(o.length,i.length),l=[],u=i[0].end;for(let h=0;h<c;h++){const f=o[h];if(f===null)continue;const d=i[h];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?s.produceFromScopes(l[l.length-1].scopes,d.start):s.produce(r,d.start),f.retokenizeCapturedWithRuleId){const y=f.getName(a,i),b=r.contentNameScopesList.pushAttributed(y,e),g=f.getContentName(a,i),m=b.pushAttributed(g,e),_=r.push(f.retokenizeCapturedWithRuleId,d.start,-1,!1,null,b,m),C=e.createOnigString(a.substring(0,d.end));Wn(e,C,n&&d.start===0,d.start,_,s,!1,0),Bn(C);continue}const p=f.getName(a,i);if(p!==null){const b=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(p,e);l.push(new ys(b,d.end))}}for(;l.length>0;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var ys=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function bs(e,t,n,r,s,o,i,a){return new ws(e,t,n,r,s,o,i,a)}function Qt(e,t,n,r,s){const o=Re(t,Pe),i=jn.getCompiledRuleId(n,r,s.repository);for(const a of o)e.push({debugSelector:t,matcher:a.matcher,ruleId:i,grammar:s,priority:a.priority})}function Pe(e,t){if(t.length<e.length)return!1;let n=0;return e.every(r=>{for(let s=n;s<t.length;s++)if(_s(t[s],r))return n=s+1,!0;return!1})}function _s(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]==="."}var ws=class{constructor(e,t,n,r,s,o,i,a){if(this._rootScopeName=e,this.balancedBracketSelectors=o,this._onigLib=a,this._basicScopeAttributesProvider=new us(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=Kt(t,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const c of Object.keys(s)){const l=Re(c,Pe);for(const u of l)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[c]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){const s=r.injections;if(s)for(let i in s)Qt(t,i,s[i],this,r);const o=this._grammarRepository.injections(n);o&&o.forEach(i=>{const a=this.getExternalGrammar(i);if(a){const c=a.injectionSelector;c&&Qt(t,c,a,this,a)}})}return t.sort((s,o)=>s.priority-o.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Kt(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){const r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=jn.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!t||t===yt.NULL){s=!0;const l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),h=J.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),f=this.getRule(this._rootId).getName(null,null);let d;f?d=he.createRootAndLookUpScopeName(f,h,this):d=he.createRoot("unknown",h),t=new yt(null,this._rootId,-1,-1,!1,null,d,d)}else s=!1,t.reset();e=e+`
|
|
3
3
|
`;const o=this.createOnigString(e),i=o.content.length,a=new Ss(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Wn(this,o,s,0,t,a,!0,r);return Bn(o),{lineLength:i,lineTokens:a,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Kt(e,t){return e=Fr(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var he=class F{constructor(t,n,r){this.parent=t,this.scopePath=n,this.tokenAttributes=r}static fromExtension(t,n){let r=t,s=t?.scopePath??null;for(const o of n)s=Ye.push(s,o.scopeNames),r=new F(r,s,o.encodedTokenAttributes);return r}static createRoot(t,n){return new F(null,new Ye(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const s=r.getMetadataForScope(t),o=new Ye(null,t),i=r.themeProvider.themeMatch(o),a=F.mergeAttributes(n,s,i);return new F(null,o,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return F.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,r){let s=-1,o=0,i=0;return r!==null&&(s=r.fontStyle,o=r.foregroundId,i=r.backgroundId),J.set(t,n.languageId,n.tokenType,null,s,o,i)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return F._pushAttributed(this,t,n);const r=t.split(/ /g);let s=this;for(const o of r)s=F._pushAttributed(s,o,n);return s}static _pushAttributed(t,n,r){const s=r.getMetadataForScope(n),o=t.scopePath.push(n),i=r.themeProvider.themeMatch(o),a=F.mergeAttributes(t.tokenAttributes,s,i);return new F(t,o,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===t?n.reverse():void 0}},yt=class X{constructor(t,n,r,s,o,i,a,c){this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=a,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new X(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:X._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?he.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){X._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,s,o,i,a){return new X(this,t,n,r,s,o,i,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new X(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){const r=he.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new X(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,he.fromExtension(r,n.contentNameScopesList))}},Cs=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Re(n,Pe).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>Re(n,Pe).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},Ss=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let r=e?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=e?.getScopeNames()??[];for(const i of this._tokenTypeOverrides)i.matcher(o)&&(r=J.set(r,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(o))}if(s&&(r=J.set(r,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=t;return}const n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},ks=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,s){if(!this._grammars.has(e)){let o=this._rawGrammars.get(e);if(!o)return null;this._grammars.set(e,bs(e,o,t,n,r,s,this,this._onigLib))}return this._grammars.get(e)}},xs=class{_options;_syncRegistry;_ensureGrammarCache;constructor(t){this._options=t,this._syncRegistry=new ks(Ne.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(Ne.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,r){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(t,n,r){return this._loadGrammar(t,n,r.embeddedLanguages,r.tokenTypes,new Cs(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,r,s,o){const i=new Yr(this._syncRegistry,t);for(;i.Q.length>0;)i.Q.map(a=>this._loadSingleGrammar(a.scopeName)),i.processQueue();return this._grammarForScopeName(t,n,r,s,o)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(t,n=[],r=0,s=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,r,s)}_grammarForScopeName(t,n=0,r=null,s=null,o=null){return this._syncRegistry.grammarForScopeName(t,n,r,s,o)}},bt=yt.NULL;function Te(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},r=typeof e=="string"?e:e.name;for(const[s,o]of Object.entries(t?.colorReplacements||{}))typeof o=="string"?n[s]=o:s===r&&Object.assign(n,o);return n}function q(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function As(e){return Array.isArray(e)?e:[e]}async function Hn(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function De(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Es(e){return e==="ansi"||De(e)}function je(e){return e==="none"}function Is(e){return je(e)}const vs=/(\r?\n)/g;function Ue(e,t=!1){if(e.length===0)return[["",0]];const n=e.split(vs);let r=0;const s=[];for(let o=0;o<n.length;o+=2){const i=t?n[o]+(n[o+1]||""):n[o];s.push([i,r]),r+=n[o].length,r+=n[o+1]?.length||0}return s}const Zt={light:"#333333",dark:"#bbbbbb"},Jt={light:"#fffffe",dark:"#1e1e1e"},Yt="__shiki_resolved";function Rt(e){if(e?.[Yt])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){const a=t.settings?t.settings.find(c=>!c.name&&!c.scope):void 0;a?.settings?.foreground&&(r=a.settings.foreground),a?.settings?.background&&(n=a.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?Zt.light:Zt.dark),n||(n=t.type==="light"?Jt.light:Jt.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let s=0;const o=new Map;function i(a){if(o.has(a))return o.get(a);s+=1;const c=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${c}`]?i(a):(o.set(a,c),c)}t.settings=t.settings.map(a=>{const c=a.settings?.foreground&&!a.settings.foreground.startsWith("#"),l=a.settings?.background&&!a.settings.background.startsWith("#");if(!c&&!l)return a;const u={...a,settings:{...a.settings}};if(c){const h=i(a.settings.foreground);t.colorReplacements[h]=a.settings.foreground,u.settings.foreground=h}if(l){const h=i(a.settings.background);t.colorReplacements[h]=a.settings.background,u.settings.background=h}return u});for(const a of Object.keys(t.colors||{}))if((a==="editor.foreground"||a==="editor.background"||a.startsWith("terminal.ansi"))&&!t.colors[a]?.startsWith("#")){const c=i(t.colors[a]);t.colorReplacements[c]=t.colors[a],t.colors[a]=c}return Object.defineProperty(t,Yt,{enumerable:!1,writable:!1,value:!0}),t}async function qn(e){return[...new Set((await Promise.all(e.filter(t=>!Es(t)).map(async t=>await Hn(t).then(n=>Array.isArray(n)?n:[n])))).flat())]}async function Vn(e){return(await Promise.all(e.map(async t=>Is(t)?null:Rt(await Hn(t))))).filter(t=>!!t)}function Xn(e,t){if(!t)return e;if(t[e]){const n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new k(`Circular alias \`${[...n].join(" -> ")} -> ${e}\``);n.add(e)}}return e}var Ns=class extends xs{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(s=>this.loadTheme(s)),this.loadLanguages(this._langs)}getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const t=Rt(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=Ne.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=Xn(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const t=new Set([...this._langMap.values()].filter(s=>s.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const n={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(s=>{this._alias[s]=e.name}),this._loadedLanguagesCache=null,t.size)for(const s of t)this._resolvedGrammars.delete(s.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(s.scopeName),this._syncRegistry?._grammars?.delete(s.scopeName),this.loadLanguage(this._langMap.get(s.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const r of e)this.resolveEmbeddedLanguages(r);const t=[...this._langGraph.entries()],n=t.filter(([r,s])=>!s);if(n.length){const r=t.filter(([s,o])=>o?(o.embeddedLanguages||o.embeddedLangs)?.some(i=>n.map(([a])=>a).includes(i)):!1).filter(s=>!n.includes(s));throw new k(`Missing languages ${n.map(([s])=>`\`${s}\``).join(", ")}, required by ${r.map(([s])=>`\`${s}\``).join(", ")}`)}for(const[r,s]of t)this._resolver.addLanguage(s);for(const[r,s]of t)this.loadLanguage(s)}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 t=e.embeddedLanguages??e.embeddedLangs;if(t)for(const n of t)this._langGraph.set(n,this._langMap.get(n))}},Rs=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:n=>e.createScanner(n),createOnigString:n=>e.createString(n)},t.forEach(n=>this.addLanguage(n))}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 n=[];for(let r=1;r<=t.length;r++){const s=t.slice(0,r).join(".");n=[...n,...this._injections.get(s)||[]]}return n}};let le=0;function $s(e){le+=1,e.warnings!==!1&&le>=10&&le%10===0&&console.warn(`[Shiki] ${le} 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 t=!1;if(!e.engine)throw new k("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Rt),s=new Ns(new Rs(e.engine,n),r,n,e.langAlias);let o;function i(m){return Xn(m,e.langAlias)}function a(m){b();const _=s.getGrammar(typeof m=="string"?m:m.name);if(!_)throw new k(`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"};b();const _=s.getTheme(m);if(!_)throw new k(`Theme \`${m}\` not found, you may need to load it first`);return _}function l(m){b();const _=c(m);return o!==m&&(s.setTheme(_),o=m),{theme:_,colorMap:s.getColorMap()}}function u(){return b(),s.getLoadedThemes()}function h(){return b(),s.getLoadedLanguages()}function f(...m){b(),s.loadLanguages(m.flat(1))}async function d(...m){return f(await qn(m))}function p(...m){b();for(const _ of m.flat(1))s.loadTheme(_)}async function y(...m){return b(),p(await Vn(m))}function b(){if(t)throw new k("Shiki instance has been disposed")}function g(){t||(t=!0,s.dispose(),le-=1)}return{setTheme:l,getTheme:c,getLanguage:a,getLoadedThemes:u,getLoadedLanguages:h,resolveLangAlias:i,loadLanguage:d,loadLanguageSync:f,loadTheme:y,loadThemeSync:p,dispose:g,[Symbol.dispose]:g}}async function Ls(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,r]=await Promise.all([Vn(e.themes||[]),qn(e.langs||[]),e.engine]);return $s({...e,themes:t,langs:n,engine:r})}const Qn=new WeakMap;function We(e,t){Qn.set(e,t)}function me(e){return Qn.get(e)}var ze=class Kn{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new Kn(Object.fromEntries(As(n).map(r=>[r,bt])),t)}constructor(...t){if(t.length===2){const[n,r]=t;this.lang=r,this._stacks=n}else{const[n,r,s]=t;this.lang=r,this._stacks={[s]:n}}}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return Ps(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Ps(e){const t=[],n=new Set;function r(s){if(n.has(s))return;n.add(s);const o=s?.nameScopesList?.scopeName;o&&t.push(o),s.parent&&r(s.parent)}return r(e),t}function Ts(e,t){if(!(e instanceof ze))throw new k("Invalid grammar state");return e.getInternalStack(t)}const Gs=/,/,Ms=/ /;function Zn(e,t,n={}){const{theme:r=e.getLoadedThemes()[0]}=n;if(De(e.resolveLangAlias(n.lang||"text"))||je(r))return Ue(t).map(a=>[{content:a[0],offset:a[1]}]);const{theme:s,colorMap:o}=e.setTheme(r),i=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==i.name)throw new k(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${i.name}"`);if(!n.grammarState.themes.includes(s.name))throw new k(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${s.name}"`)}return Bs(t,i,s,o,n)}function Os(...e){if(e.length===2)return me(e[1]);const[t,n,r={}]=e,{lang:s="text",theme:o=t.getLoadedThemes()[0]}=r;if(De(s)||je(o))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:i,colorMap:a}=t.setTheme(o),c=t.getLanguage(s);return new ze($t(n,c,i,a,r).stateStack,c.name,i.name)}function Bs(e,t,n,r,s){const o=$t(e,t,n,r,s),i=new ze(o.stateStack,t.name,n.name);return We(o.tokens,i),o.tokens}function $t(e,t,n,r,s){const o=Te(n,s),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:a=500,includeExplanation:c=!1}=s,l=Ue(e);let u=s.grammarState?Ts(s.grammarState,n.name)??bt:s.grammarContextCode!=null?$t(s.grammarContextCode,t,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:bt,h=[];const f=[];for(let d=0,p=l.length;d<p;d++){const[y,b]=l[d];if(y===""){h=[],f.push([]);continue}if(i>0&&y.length>=i){h=[],f.push([{content:y,offset:b,color:"",fontStyle:0}]);continue}let g,m,_;c&&c!=="tokenType"&&(g=t.tokenizeLine(y,u,a),m=g.tokens,_=0);const C=t.tokenizeLine2(y,u,a),S=C.tokens.length/2;for(let v=0;v<S;v++){const $=C.tokens[2*v],O=v+1<S?C.tokens[2*v+2]:y.length;if($===O)continue;const ee=C.tokens[2*v+1],Qe=q(r[J.getForeground(ee)],o),Ke=J.getFontStyle(ee),B={content:y.substring($,O),offset:b+$,color:Qe,fontStyle:Ke};if(c==="tokenType")B.type=J.getTokenType(ee);else if(c){const Bt=[];if(c!=="scopeName")for(const D of n.settings){let te;switch(typeof D.scope){case"string":te=D.scope.split(Gs).map(Ze=>Ze.trim());break;case"object":te=D.scope;break;default:continue}Bt.push({settings:D,selectors:te.map(Ze=>Ze.split(Ms))})}B.explanation=[];let Ft=0;for(;$+Ft<O;){const D=m[_],te=y.substring(D.startIndex,D.endIndex);Ft+=te.length,B.explanation.push({content:te,scopes:c==="scopeName"?Fs(D.scopes):Ds(Bt,D.scopes)}),_+=1}}h.push(B)}f.push(h),h=[],u=C.ruleStack}return{tokens:f,stateStack:u}}function Fs(e){return e.map(t=>({scopeName:t}))}function Ds(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const o=t[r];n[r]={scopeName:o,themeMatches:Us(e,o,t.slice(0,r))}}return n}function en(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function js(e,t,n){if(!en(e.at(-1),t))return!1;let r=e.length-2,s=n.length-1;for(;r>=0&&s>=0;)en(e[r],n[s])&&(r-=1),s-=1;return r===-1}function Us(e,t,n){const r=[];for(const{selectors:s,settings:o}of e)for(const i of s)if(js(i,t,n)){r.push(o);break}return r}function Jn(e,t,n,r=Zn){const s=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),o=s.map(l=>{const u=r(e,t,{...n,theme:l.theme});return{tokens:u,state:me(u),theme:typeof l.theme=="string"?l.theme:l.theme.name}}),i=Ws(...o.map(l=>l.tokens)),a=i[0].map((l,u)=>l.map((h,f)=>{const d={content:h.content,variants:{},offset:h.offset};return"includeExplanation"in n&&n.includeExplanation&&(d.explanation=h.explanation),i.forEach((p,y)=>{const{content:b,explanation:g,offset:m,..._}=p[u][f];d.variants[s[y].color]=_}),d})),c=o[0].state?new ze(Object.fromEntries(o.map(l=>[l.theme,l.state?.getInternalStack(l.theme)])),o[0].state.lang):void 0;return c&&We(a,c),a}function Ws(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const s=e.map(c=>c[r]),o=t.map(()=>[]);t.forEach((c,l)=>c.push(o[l]));const i=s.map(()=>0),a=s.map(c=>c[0]);for(;a.every(c=>c);){const c=Math.min(...a.map(l=>l.content.length));for(let l=0;l<n;l++){const u=a[l];u.content.length===c?(o[l].push(u),i[l]+=1,a[l]=s[l][i[l]]):(o[l].push({...u,content:u.content.slice(0,c)}),a[l]={...u,content:u.content.slice(c),offset:u.offset+c})}}}return t}const zs=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Hs=/["&'<>`]/g,qs=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Vs=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Xs=/[|\\{}()[\]^$+*?.]/g,tn=new WeakMap;function Qs(e,t){if(e=e.replace(t.subset?Ks(t.subset):Hs,r),t.subset||t.escapeOnly)return e;return e.replace(qs,n).replace(Vs,r);function n(s,o,i){return t.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,i.charCodeAt(o+2),t)}function r(s,o,i){return t.format(s.charCodeAt(0),i.charCodeAt(o+1),t)}}function Ks(e){let t=tn.get(e);return t||(t=Zs(e),tn.set(e,t)),t}function Zs(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(Xs,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const Js=/[\dA-Fa-f]/;function Ys(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!Js.test(String.fromCharCode(t))?r:r+";"}const eo=/\d/;function to(e,t,n){const r="&#"+String(e);return n&&t&&!eo.test(String.fromCharCode(t))?r:r+";"}const no=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],tt={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},ro=["cent","copy","divide","gt","lt","not","para","times"],Yn={}.hasOwnProperty,_t={};let Ce;for(Ce in tt)Yn.call(tt,Ce)&&(_t[tt[Ce]]=Ce);const so=/[^\dA-Za-z]/;function oo(e,t,n,r){const s=String.fromCharCode(e);if(Yn.call(_t,s)){const o=_t[s],i="&"+o;return n&&no.includes(o)&&!ro.includes(o)&&(!r||t&&t!==61&&so.test(String.fromCharCode(t)))?i:i+";"}return""}function io(e,t,n){let r=Ys(e,t,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=oo(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const o=to(e,t,n.omitOptionalSemicolons);o.length<r.length&&(r=o)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function ie(e,t){return Qs(e,Object.assign({format:io},t))}const ao=/^>|^->|<!--|-->|--!>|<!-$/g,co=[">"],lo=["<",">"];function uo(e,t,n,r){return r.settings.bogusComments?"<?"+ie(e.value,Object.assign({},r.settings.characterReferences,{subset:co}))+">":"<!--"+e.value.replace(ao,s)+"-->";function s(o){return ie(o,Object.assign({},r.settings.characterReferences,{subset:lo}))}}function ho(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const E=tr(1),er=tr(-1),fo=[];function tr(e){return t;function t(n,r,s){const o=n?n.children:fo;let i=(r||0)+e,a=o[i];if(!s)for(;a&&vt(a);)i+=e,a=o[i];return a}}const po={}.hasOwnProperty;function nr(e){return t;function t(n,r,s){return po.call(e,n.tagName)&&e[n.tagName](n,r,s)}}const Lt=nr({body:mo,caption:nt,colgroup:nt,dd:wo,dt:_o,head:nt,html:go,li:bo,optgroup:Co,option:So,p:yo,rp:nn,rt:nn,tbody:xo,td:rn,tfoot:Ao,th:rn,thead:ko,tr:Eo});function nt(e,t,n){const r=E(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&vt(r.value.charAt(0)))}function go(e,t,n){const r=E(n,t);return!r||r.type!=="comment"}function mo(e,t,n){const r=E(n,t);return!r||r.type!=="comment"}function yo(e,t,n){const r=E(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function bo(e,t,n){const r=E(n,t);return!r||r.type==="element"&&r.tagName==="li"}function _o(e,t,n){const r=E(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function wo(e,t,n){const r=E(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function nn(e,t,n){const r=E(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Co(e,t,n){const r=E(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function So(e,t,n){const r=E(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function ko(e,t,n){const r=E(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function xo(e,t,n){const r=E(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Ao(e,t,n){return!E(n,t)}function Eo(e,t,n){const r=E(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function rn(e,t,n){const r=E(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Io=nr({body:Ro,colgroup:$o,head:No,html:vo,tbody:Lo});function vo(e){const t=E(e,-1);return!t||t.type!=="comment"}function No(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function Ro(e){const t=E(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&vt(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function $o(e,t,n){const r=er(n,t),s=E(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&Lt(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function Lo(e,t,n){const r=er(n,t),s=E(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Lt(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const Se={name:[[`
|
|
4
4
|
\f\r &/=>`.split(""),`
|
|
@@ -149,4 +149,4 @@ XID_Continue XIDC
|
|
|
149
149
|
XID_Start XIDS`.split(/\s/).map(e=>[qe(e),e])),Ea=new Map([["s",A(383)],[A(383),"s"]]),Ia=new Map([[A(223),A(7838)],[A(107),A(8490)],[A(229),A(8491)],[A(969),A(8486)]]),va=new Map([z(453),z(456),z(459),z(498),...at(8072,8079),...at(8088,8095),...at(8104,8111),z(8124),z(8140),z(8188)]),Na=new Map([["alnum",w`[\p{Alpha}\p{Nd}]`],["alpha",w`\p{Alpha}`],["ascii",w`\p{ASCII}`],["blank",w`[\p{Zs}\t]`],["cntrl",w`\p{Cc}`],["digit",w`\p{Nd}`],["graph",w`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",w`\p{Lower}`],["print",w`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",w`[\p{P}\p{S}]`],["space",w`\p{space}`],["upper",w`\p{Upper}`],["word",w`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",w`\p{AHex}`]]);function Ra(e,t){const n=[];for(let r=e;r<=t;r++)n.push(r);return n}function z(e){const t=A(e);return[t.toLowerCase(),t]}function at(e,t){return Ra(e,t).map(n=>z(n))}var kr=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function $a(e,t){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};xr(e);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:Et(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};fe(e,La,r);const s={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},o={currentFlags:s,prevFlags:null,globalFlags:s,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};fe(e,Pa,o);const i={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return fe(e,Ta,i),e._originMap=o.groupOriginByCopy,e._strategy=r.strategy,e}var La={AbsenceFunction({node:e,parent:t,replaceWith:n}){const{body:r,kind:s}=e;if(s==="repeater"){const o=G();o.body[0].body.push(Q({negate:!0,body:r}),oe("Any"));const i=G();i.body[0].body.push(gr("greedy",0,1/0,o)),n(x(i,t),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){const s=e.body.filter(o=>o.kind==="flags");for(let o=n+1;o<t.body.length;o++){const i=t.body[o];ye(r,i,[]).push(...s)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){const n=Er(t.get(e));if(n){const r=G({flags:n});r.body[0].body=e.body,e.body=[x(r,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:s,remove:o,replaceWith:i},a){const{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:h,supportedGNodes:f,wordIsAscii:d}=a;if(c==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${l?"Y":"y"}"`);if(c==="line_end")i(x(Q({body:[Y({body:[St("string_end")]}),Y({body:[He(10)]})]}),t));else if(c==="line_start")i(x(U(w`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c==="search_start")if(f.has(e))s.flags.sticky=!0,o();else{const p=r[n-1];if(p&&Da(p))i(x(Q({negate:!0}),t));else{if(h)throw new Error(w`Uses "\G" in a way that requires a subclass`);i(H(St("string_start"),t)),a.strategy="clip_search"}}else if(!(c==="string_end"||c==="string_start"))if(c==="string_end_newline")i(x(U(w`(?=\n?\z)`),t));else if(c==="word_boundary"){if(!d&&!u){const p=`(?:(?<=${j})(?!${j})|(?<!${j})(?=${j}))`,y=`(?:(?<=${j})(?=${j})|(?<!${j})(?!${j}))`;i(x(U(l?y:p),t))}}else throw new Error(`Unexpected assertion kind "${c}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!lt(n)&&(n=ct(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!lt(r)&&(r=ct(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){if(t.kind==="intersection"){const r=ve({body:[e]});n(x(r,t),{traverse:!0})}},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:s,digitIsAscii:o,spaceIsAscii:i,wordIsAscii:a}){const{kind:c,negate:l,value:u}=e;if(o&&(c==="digit"||u==="digit")){n(H(xt("digit",{negate:l}),t));return}if(i&&(c==="space"||u==="space")){n(x(ut(U(xa),l),t));return}if(a&&(c==="word"||u==="word")){n(H(xt("word",{negate:l}),t));return}if(c==="any")n(H(oe("Any"),t));else if(c==="digit")n(H(oe("Nd",{negate:l}),t));else if(c!=="dot")if(c==="text_segment"){if(r==="strict")throw new Error(w`Use of "\X" requires non-strict accuracy`);const h="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",f=w`\p{RI}{2}|${h}(?:\u200D${h})*`;n(x(U(w`(?>\r\n|${s?w`\p{RGI_Emoji}`:f}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c==="hex")n(H(oe("AHex",{negate:l}),t));else if(c==="newline")n(x(U(l?`[^
|
|
150
150
|
]`:`(?>\r
|
|
151
151
|
?|[
|
|
152
|
-
\v\f
\u2028\u2029])`),t));else if(c==="posix")if(!s&&(u==="graph"||u==="print")){if(r==="strict")throw new Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let h={graph:"!-~",print:" -~"}[u];l&&(h=`\0-${A(h.codePointAt(0)-1)}${A(h.codePointAt(2)+1)}-`),n(x(U(`[${h}]`),t))}else n(x(ut(U(Na.get(u)),l),t));else if(c==="property")Mt.has(qe(u))||(e.key="sc");else if(c==="space")n(H(oe("space",{negate:l}),t));else if(c==="word")n(x(ut(U(j),l),t));else throw new Error(`Unexpected character set kind "${c}"`)},Directive({node:e,parent:t,root:n,remove:r,replaceWith:s,removeAllPrevSiblings:o,removeAllNextSiblings:i}){const{kind:a,flags:c}=e;if(a==="flags")if(!c.enable&&!c.disable)r();else{const l=G({flags:c});l.body[0].body=i(),s(x(l,t),{traverse:!0})}else if(a==="keep"){const l=n.body[0],h=n.body.length===1&&fr(l,{type:"Group"})&&l.body[0].body.length===1?l.body[0]:n;if(t.parent!==h||h.body.length>1)throw new Error(w`Uses "\K" in a way that's unsupported`);const f=Q({behind:!0});f.body[0].body=o(),s(x(f,t))}else throw new Error(`Unexpected directive kind "${a}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if(e.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(n=>delete e[n]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;const{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){const{kind:n}=e;n==="lookbehind"&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){const{kind:r}=e;if(r==="fail")n(x(Q({negate:!0}),t));else throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type==="Quantifier"){const t=G();t.body[0].body.push(e.body),e.body=x(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){const n=[];let r=!1,s=!1;for(const o of e.body)if(o.body.length===1&&o.body[0].kind==="search_start")o.body.pop();else{const i=vr(o.body);i?(r=!0,Array.isArray(i)?n.push(...i):n.push(i)):s=!0}r&&!s&&n.forEach(o=>t.add(o))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t==="strict"&&n&&r)throw new Error(w`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!lt(n)&&(n=ct(n,t),e.ref=n)}},Pa={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){const{orphan:r,ref:s}=e;r||n.set(e,[...t.get(s).map(({node:o})=>o)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:s,groupsByName:o,multiplexCapturesToLeftByRef:i,openRefs:a,reffedNodesByReferencer:c}){const l=s.get(e);if(l&&a.has(e.number)){const h=H(xn(e.number),t);c.set(h,a.get(e.number)),n(h);return}a.set(e.number,e),i.set(e.number,[]),e.name&&ye(i,e.name,[]);const u=i.get(e.name??e.number);for(let h=0;h<u.length;h++){const f=u[h];if(l===f.node||l&&l===f.origin||e===f.origin){u.splice(h,1);break}}if(i.get(e.number).push({node:e,origin:l}),e.name&&i.get(e.name).push({node:e,origin:l}),e.name){const h=ye(o,e.name,new Map);let f=!1;if(l)f=!0;else for(const d of h.values())if(!d.hasDuplicateNameToRemove){f=!0;break}o.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:f})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=Fe(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){const{isRecursive:s,ref:o}=e;if(s){let u=t;for(;(u=u.parent)&&!(u.type==="CapturingGroup"&&(u.name===o||u.number===o)););r.reffedNodesByReferencer.set(e,u);return}const i=r.subroutineRefMap.get(o),a=o===0,c=a?xn(0):Ar(i,r.groupOriginByCopy,null);let l=c;if(!a){const u=Er(Oa(i,f=>f.type==="Group"&&!!f.flags)),h=u?Fe(r.globalFlags,u):r.globalFlags;Ga(h,r.currentFlags)||(l=G({flags:Ba(h)}),l.body[0].body.push(c))}n(x(l,t),{traverse:!a})}},Ta={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}const o=r.reffedNodesByReferencer.get(e).filter(i=>Ma(i,e));if(!o.length)n(x(Q({negate:!0}),t));else if(o.length>1){const i=G({atomic:!0,body:o.reverse().map(a=>Y({body:[kt(a.number)]}))});n(x(i,t))}else e.ref=o[0].number},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){const n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let r=0;r<n;r++){const s=pr();e.body.at(-1).body.push(s)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function xr(e){fe(e,{"*"({node:t,parent:n}){t.parent=n}})}function Ga(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function Ma(e,t){let n=t;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===e)return!1;const r=Ir(n.parent);for(const s of r){if(s===n)break;if(s===e||Nr(s,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function Ar(e,t,n,r){const s=Array.isArray(e)?[]:{};for(const[o,i]of Object.entries(e))o==="parent"?s.parent=Array.isArray(n)?r:n:i&&typeof i=="object"?s[o]=Ar(i,t,s,n):(o==="type"&&i==="CapturingGroup"&&t.set(s,t.get(e)??e),s[o]=i);return s}function xn(e){const t=mr(e);return t.isRecursive=!0,t}function Oa(e,t){const n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function ct(e,t){if(t.has(e))return t.get(e);const n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,n),n}function Er(e){const t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return e.forEach(({flags:r})=>{t.forEach(s=>{r.enable?.[s]&&(delete n.disable[s],n.enable[s]=!0),r.disable?.[s]&&(n.disable[s]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function Ba({dotAll:e,ignoreCase:t}){const n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function Ir(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function vr(e){const t=e.find(n=>n.kind==="search_start"||ja(n,{negate:!1})||!Fa(n));if(!t)return null;if(t.kind==="search_start")return t;if(t.type==="LookaroundAssertion")return t.body[0].body[0];if(t.type==="CapturingGroup"||t.type==="Group"){const n=[];for(const r of t.body){const s=vr(r.body);if(!s)return null;Array.isArray(s)?n.push(...s):n.push(s)}return n}return null}function Nr(e,t){const n=Ir(e)??[];for(const r of n)if(r===t||Nr(r,t))return!0;return!1}function Fa({type:e}){return e==="Assertion"||e==="Directive"||e==="LookaroundAssertion"}function Da(e){const t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||e.type==="Quantifier"&&e.min&&t.includes(e.body.type)}function ja(e,t){const n={negate:null,...t};return e.type==="LookaroundAssertion"&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&fr(e.body[0],{type:"Assertion",kind:"search_start"})}function lt(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function U(e,t){const r=dr(e,{...t,unicodePropertyMap:Mt}).body;return r.length>1||r[0].body.length>1?G({body:r}):r[0].body[0]}function ut(e,t){return e.negate=t,e}function H(e,t){return e.parent=t,e}function x(e,t){return xr(e),e.parent=t,e}function Ua(e,t){const n=Cr(t),r=Et(n.target,"ES2024"),s=Et(n.target,"ES2025"),o=n.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw new Error("Invalid recursionLimit; use 2-20");let i=null,a=null;if(!s){const d=[e.flags.ignoreCase];fe(e,Wa,{getCurrentModI:()=>d.at(-1),popModI(){d.pop()},pushModI(p){d.push(p)},setHasCasedChar(){d.at(-1)?i=!0:a=!0}})}const c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||i)&&!a)};let l=e;const u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!s&&i&&a),useFlagMods:s,useFlagV:r,verbose:n.verbose};function h(d){return u.lastNode=l,l=d,Sa(za[d.type],`Unexpected node type "${d.type}"`)(d,u,h)}const f={pattern:e.body.map(h).join("|"),flags:h(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((d,p)=>{d.hidden&&f._hiddenCaptures.push(p),d.transferTo&&ye(f._captureTransfers,d.transferTo,[]).push(p)}),f}var Wa={"*":{enter({node:e},t){if(En(e)){const n=t.getCurrentModI();t.pushModI(e.flags?Fe({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){En(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){Ot(A(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),Rr(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind==="property"&&kr.has(e.value)&&t.setHasCasedChar()}},za={Alternative({body:e},t,n){return e.map(n).join("")},Assertion({kind:e,negate:t}){if(e==="string_end")return"$";if(e==="string_start")return"^";if(e==="word_boundary")return t?w`\B`:w`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!="number")throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&t.accuracy==="strict"&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){const{body:r,name:s,number:o}=e,i={ignoreCase:t.currentFlags.ignoreCase},a=t.originMap.get(e);return a&&(i.hidden=!0,o>a.number&&(i.transferTo=a.number)),t.captureMap.set(o,i),`(${s?`?<${s}>`:""}${r.map(n).join("|")})`},Character({value:e},t){const n=A(e),r=re(e,{escDigit:t.lastNode.type==="Backreference",inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Ot(n)){const s=Sr(n);return t.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return n},CharacterClass(e,t,n){const{kind:r,negate:s,parent:o}=e;let{body:i}=e;if(r==="intersection"&&!t.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");M.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&i.some(In)&&(i=[He(45),...i.filter(l=>!In(l))]);const a=()=>`[${s?"^":""}${i.map(n).join(r==="intersection"?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||M.bugNestedClassIgnoresNegation)&&!s){const u=i.filter(h=>h.type==="CharacterClass"&&h.kind==="union"&&h.negate);if(u.length){const h=G(),f=h.body[0];return h.parent=o,f.parent=h,i=i.filter(d=>!u.includes(d)),e.body=i,i.length?(e.parent=f,f.body.push(e)):h.body.pop(),u.forEach(d=>{const p=Y({body:[d]});d.parent=p,p.parent=h,h.body.push(p)}),n(h)}}t.inCharClass=!0;const l=a();return t.inCharClass=!1,l}const c=i[0];if(r==="union"&&!s&&c&&((!t.useFlagV||!t.verbose)&&o.kind==="union"&&!(M.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&o.kind==="intersection"&&i.length===1&&c.type!=="CharacterClassRange"))return i.map(n).join("");if(!t.useFlagV&&o.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return a()},CharacterClassRange(e,t){const n=e.min.value,r=e.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},o=re(n,s),i=re(r,s),a=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){const c=Rr(e);Qa(c).forEach(u=>{a.add(Array.isArray(u)?`${re(u[0],s)}-${re(u[1],s)}`:re(u,s))})}return`${o}-${i}${[...a].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:r},s){if(e==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":w`[^\n]`;if(e==="digit")return t?w`\D`:w`\d`;if(e==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&kr.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?w`\P`:w`\p`}{${r?`${r}=`:""}${n}}`}if(e==="word")return t?w`\W`:w`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")},Group({atomic:e,body:t,flags:n,parent:r},s,o){const i=s.currentFlags;n&&(s.currentFlags=Fe(i,n));const a=t.map(o).join("|"),c=!s.verbose&&t.length===1&&r.type!=="Quantifier"&&!e&&(!s.useFlagMods||!n)?a:`(?${Ka(e,n,s.useFlagMods)}${a})`;return s.currentFlags=i,c},LookaroundAssertion({body:e,kind:t,negate:n},r,s){return`(?${`${t==="lookahead"?"":"<"}${n?"!":"="}`}${e.map(s).join("|")})`},Quantifier(e,t,n){return n(e.body)+Za(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return t===0?`(?R=${r})`:w`\g<${t}&R=${r}>`}},Ha=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),qa=new Set(["-","\\","]","^","["]),Va=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),An=new Map([[9,w`\t`],[10,w`\n`],[11,w`\v`],[12,w`\f`],[13,w`\r`],[8232,w`\u2028`],[8233,w`\u2029`],[65279,w`\uFEFF`]]),Xa=new RegExp("^\\p{Cased}$","u");function Ot(e){return Xa.test(e)}function Rr(e,t){const n=!!t?.firstOnly,r=e.min.value,s=e.max.value,o=[];if(r<65&&(s===65535||s>=131071)||r===65536&&s>=131071)return o;for(let i=r;i<=s;i++){const a=A(i);if(!Ot(a))continue;const c=Sr(a).filter(l=>{const u=l.codePointAt(0);return u<r||u>s});if(c.length&&(o.push(...c),n))break}return o}function re(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(An.has(e))return An.get(e);if(e<32||e>126&&e<160||e>262143||t&&Ja(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;const s=n?r?Va:qa:Ha,o=A(e);return(s.has(o)?"\\":"")+o}function Qa(e){const t=e.map(s=>s.codePointAt(0)).sort((s,o)=>s-o),n=[];let r=null;for(let s=0;s<t.length;s++)t[s+1]===t[s]+1?r??=t[s]:r===null?n.push(t[s]):(n.push([r,t[s]]),r=null);return n}function Ka(e,t,n){if(e)return">";let r="";if(t&&n){const{enable:s,disable:o}=t;r=(s?.ignoreCase?"i":"")+(s?.dotAll?"s":"")+(o?"-":"")+(o?.ignoreCase?"i":"")+(o?.dotAll?"s":"")}return`${r}:`}function Za({kind:e,max:t,min:n}){let r;return!n&&t===1?r="?":!n&&t===1/0?r="*":n===1&&t===1/0?r="+":n===t?r=`{${n}}`:r=`{${n},${t===1/0?"":t}}`,r+{greedy:"",lazy:"?",possessive:"+"}[e]}function En({type:e}){return e==="CapturingGroup"||e==="Group"||e==="LookaroundAssertion"}function Ja(e){return e>47&&e<58}function In({type:e,value:t}){return e==="Character"&&t===45}var Ya=class It extends RegExp{#t=new Map;#e=null;#r;#n=null;#s=null;rawOptions={};get source(){return this.#r||"(?:)"}constructor(t,n,r){const s=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");const o=t;super(o,n),this.#r=o.source,o instanceof It&&(this.#t=o.#t,this.#n=o.#n,this.#s=o.#s,this.rawOptions=o.rawOptions)}else{const o={hiddenCaptures:[],strategy:null,transfers:[],...r};super(s?"":t,n),this.#r=t,this.#t=tc(o.hiddenCaptures,o.transfers),this.#s=o.strategy,this.rawOptions=r??{}}s||(this.#e=this)}exec(t){if(!this.#e){const{lazyCompile:s,...o}=this.rawOptions;this.#e=new It(this.#r,this.flags,o)}const n=this.global||this.sticky,r=this.lastIndex;if(this.#s==="clip_search"&&n&&r){this.lastIndex=0;const s=this.#o(t.slice(r));return s&&(ec(s,r,t,this.hasIndices),this.lastIndex+=r),s}return this.#o(t)}#o(t){this.#e.lastIndex=this.lastIndex;const n=super.exec.call(this.#e,t);if(this.lastIndex=this.#e.lastIndex,!n||!this.#t.size)return n;const r=[...n];n.length=1;let s;this.hasIndices&&(s=[...n.indices],n.indices.length=1);const o=[0];for(let i=1;i<r.length;i++){const{hidden:a,transferTo:c}=this.#t.get(i)??{};if(a?o.push(null):(o.push(n.length),n.push(r[i]),this.hasIndices&&n.indices.push(s[i])),c&&r[i]!==void 0){const l=o[c];if(!l)throw new Error(`Invalid capture transfer to "${l}"`);if(n[l]=r[i],this.hasIndices&&(n.indices[l]=s[i]),n.groups){this.#n||(this.#n=nc(this.source));const u=this.#n.get(c);u&&(n.groups[u]=r[i],this.hasIndices&&(n.indices.groups[u]=s[i]))}}}return n}};function ec(e,t,n,r){if(e.index+=t,e.input=n,r){const s=e.indices;for(let i=0;i<s.length;i++){const a=s[i];a&&(s[i]=[a[0]+t,a[1]+t])}const o=s.groups;o&&Object.keys(o).forEach(i=>{const a=o[i];a&&(o[i]=[a[0]+t,a[1]+t])})}}function tc(e,t){const n=new Map;for(const r of e)n.set(r,{hidden:!0});for(const[r,s]of t)for(const o of s)ye(n,o,{}).transferTo=r;return n}function nc(e){const t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r=0,s=0,o;for(;o=t.exec(e);){const{0:i,groups:{capture:a,name:c}}=o;i==="["?r++:r?i==="]"&&r--:a&&(s++,c&&n.set(s,c))}return n}function rc(e,t){const n=sc(e,t);return n.options?new Ya(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function sc(e,t){const n=Cr(t),r=dr(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Mt}),s=$a(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),o=Ua(s,n),i=wa(o.pattern,{captureTransfers:o._captureTransfers,hiddenCaptures:o._hiddenCaptures,mode:"external"}),a=ba(i.pattern),c=ya(a.pattern,{captureTransfers:i.captureTransfers,hiddenCaptures:i.hiddenCaptures}),l={pattern:c.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${o.flags}${o.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const u=c.hiddenCaptures.sort((p,y)=>p-y),h=Array.from(c.captureTransfers),f=s._strategy,d=l.pattern.length>=n.lazyCompileLength;(u.length||h.length||f||d)&&(l.options={...u.length&&{hiddenCaptures:u},...h.length&&{transfers:h},...f&&{strategy:f},...d&&{lazyCompile:d}})}return l}function oc(e,t){return rc(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function ic(e={}){const t={target:"auto",cache:new Map,...e};return t.regexConstructor||=n=>oc(n,{target:t.target}),{createScanner(n){return new Ci(n,t)},createString(n){return{content:n}}}}let vn;const ht=new Map;function ac(){return vn??=wi({themes:[jt(()=>import("./github-light-DAi9KRSo.js"),[]),jt(()=>import("./github-dark-DHJKELXO.js"),[])],langs:[],engine:ic()}),vn}function cc(e,t,n){let r=ht.get(t);return r||(r=n().then(s=>e.loadLanguage(s.default)).then(()=>{}).catch(s=>{throw ht.delete(t),s}),ht.set(t,r)),r}async function hc(e,t){const n=Gr(t);if(!n)return;const r=await ac(),s=Mr(n)?void 0:Or.get(n);return s&&await cc(r,n,s),r.codeToHtml(e,{lang:n,themes:{light:"github-light",dark:"github-dark"}})}export{hc as highlightToHtml};
|
|
152
|
+
\v\f
\u2028\u2029])`),t));else if(c==="posix")if(!s&&(u==="graph"||u==="print")){if(r==="strict")throw new Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let h={graph:"!-~",print:" -~"}[u];l&&(h=`\0-${A(h.codePointAt(0)-1)}${A(h.codePointAt(2)+1)}-`),n(x(U(`[${h}]`),t))}else n(x(ut(U(Na.get(u)),l),t));else if(c==="property")Mt.has(qe(u))||(e.key="sc");else if(c==="space")n(H(oe("space",{negate:l}),t));else if(c==="word")n(x(ut(U(j),l),t));else throw new Error(`Unexpected character set kind "${c}"`)},Directive({node:e,parent:t,root:n,remove:r,replaceWith:s,removeAllPrevSiblings:o,removeAllNextSiblings:i}){const{kind:a,flags:c}=e;if(a==="flags")if(!c.enable&&!c.disable)r();else{const l=G({flags:c});l.body[0].body=i(),s(x(l,t),{traverse:!0})}else if(a==="keep"){const l=n.body[0],h=n.body.length===1&&fr(l,{type:"Group"})&&l.body[0].body.length===1?l.body[0]:n;if(t.parent!==h||h.body.length>1)throw new Error(w`Uses "\K" in a way that's unsupported`);const f=Q({behind:!0});f.body[0].body=o(),s(x(f,t))}else throw new Error(`Unexpected directive kind "${a}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if(e.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(n=>delete e[n]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;const{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){const{kind:n}=e;n==="lookbehind"&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){const{kind:r}=e;if(r==="fail")n(x(Q({negate:!0}),t));else throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type==="Quantifier"){const t=G();t.body[0].body.push(e.body),e.body=x(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){const n=[];let r=!1,s=!1;for(const o of e.body)if(o.body.length===1&&o.body[0].kind==="search_start")o.body.pop();else{const i=vr(o.body);i?(r=!0,Array.isArray(i)?n.push(...i):n.push(i)):s=!0}r&&!s&&n.forEach(o=>t.add(o))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t==="strict"&&n&&r)throw new Error(w`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!lt(n)&&(n=ct(n,t),e.ref=n)}},Pa={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){const{orphan:r,ref:s}=e;r||n.set(e,[...t.get(s).map(({node:o})=>o)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:s,groupsByName:o,multiplexCapturesToLeftByRef:i,openRefs:a,reffedNodesByReferencer:c}){const l=s.get(e);if(l&&a.has(e.number)){const h=H(xn(e.number),t);c.set(h,a.get(e.number)),n(h);return}a.set(e.number,e),i.set(e.number,[]),e.name&&ye(i,e.name,[]);const u=i.get(e.name??e.number);for(let h=0;h<u.length;h++){const f=u[h];if(l===f.node||l&&l===f.origin||e===f.origin){u.splice(h,1);break}}if(i.get(e.number).push({node:e,origin:l}),e.name&&i.get(e.name).push({node:e,origin:l}),e.name){const h=ye(o,e.name,new Map);let f=!1;if(l)f=!0;else for(const d of h.values())if(!d.hasDuplicateNameToRemove){f=!0;break}o.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:f})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=Fe(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){const{isRecursive:s,ref:o}=e;if(s){let u=t;for(;(u=u.parent)&&!(u.type==="CapturingGroup"&&(u.name===o||u.number===o)););r.reffedNodesByReferencer.set(e,u);return}const i=r.subroutineRefMap.get(o),a=o===0,c=a?xn(0):Ar(i,r.groupOriginByCopy,null);let l=c;if(!a){const u=Er(Oa(i,f=>f.type==="Group"&&!!f.flags)),h=u?Fe(r.globalFlags,u):r.globalFlags;Ga(h,r.currentFlags)||(l=G({flags:Ba(h)}),l.body[0].body.push(c))}n(x(l,t),{traverse:!a})}},Ta={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}const o=r.reffedNodesByReferencer.get(e).filter(i=>Ma(i,e));if(!o.length)n(x(Q({negate:!0}),t));else if(o.length>1){const i=G({atomic:!0,body:o.reverse().map(a=>Y({body:[kt(a.number)]}))});n(x(i,t))}else e.ref=o[0].number},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){const n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let r=0;r<n;r++){const s=pr();e.body.at(-1).body.push(s)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function xr(e){fe(e,{"*"({node:t,parent:n}){t.parent=n}})}function Ga(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function Ma(e,t){let n=t;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===e)return!1;const r=Ir(n.parent);for(const s of r){if(s===n)break;if(s===e||Nr(s,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function Ar(e,t,n,r){const s=Array.isArray(e)?[]:{};for(const[o,i]of Object.entries(e))o==="parent"?s.parent=Array.isArray(n)?r:n:i&&typeof i=="object"?s[o]=Ar(i,t,s,n):(o==="type"&&i==="CapturingGroup"&&t.set(s,t.get(e)??e),s[o]=i);return s}function xn(e){const t=mr(e);return t.isRecursive=!0,t}function Oa(e,t){const n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function ct(e,t){if(t.has(e))return t.get(e);const n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,n),n}function Er(e){const t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return e.forEach(({flags:r})=>{t.forEach(s=>{r.enable?.[s]&&(delete n.disable[s],n.enable[s]=!0),r.disable?.[s]&&(n.disable[s]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function Ba({dotAll:e,ignoreCase:t}){const n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function Ir(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function vr(e){const t=e.find(n=>n.kind==="search_start"||ja(n,{negate:!1})||!Fa(n));if(!t)return null;if(t.kind==="search_start")return t;if(t.type==="LookaroundAssertion")return t.body[0].body[0];if(t.type==="CapturingGroup"||t.type==="Group"){const n=[];for(const r of t.body){const s=vr(r.body);if(!s)return null;Array.isArray(s)?n.push(...s):n.push(s)}return n}return null}function Nr(e,t){const n=Ir(e)??[];for(const r of n)if(r===t||Nr(r,t))return!0;return!1}function Fa({type:e}){return e==="Assertion"||e==="Directive"||e==="LookaroundAssertion"}function Da(e){const t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||e.type==="Quantifier"&&e.min&&t.includes(e.body.type)}function ja(e,t){const n={negate:null,...t};return e.type==="LookaroundAssertion"&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&fr(e.body[0],{type:"Assertion",kind:"search_start"})}function lt(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function U(e,t){const r=dr(e,{...t,unicodePropertyMap:Mt}).body;return r.length>1||r[0].body.length>1?G({body:r}):r[0].body[0]}function ut(e,t){return e.negate=t,e}function H(e,t){return e.parent=t,e}function x(e,t){return xr(e),e.parent=t,e}function Ua(e,t){const n=Cr(t),r=Et(n.target,"ES2024"),s=Et(n.target,"ES2025"),o=n.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw new Error("Invalid recursionLimit; use 2-20");let i=null,a=null;if(!s){const d=[e.flags.ignoreCase];fe(e,Wa,{getCurrentModI:()=>d.at(-1),popModI(){d.pop()},pushModI(p){d.push(p)},setHasCasedChar(){d.at(-1)?i=!0:a=!0}})}const c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||i)&&!a)};let l=e;const u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!s&&i&&a),useFlagMods:s,useFlagV:r,verbose:n.verbose};function h(d){return u.lastNode=l,l=d,Sa(za[d.type],`Unexpected node type "${d.type}"`)(d,u,h)}const f={pattern:e.body.map(h).join("|"),flags:h(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((d,p)=>{d.hidden&&f._hiddenCaptures.push(p),d.transferTo&&ye(f._captureTransfers,d.transferTo,[]).push(p)}),f}var Wa={"*":{enter({node:e},t){if(En(e)){const n=t.getCurrentModI();t.pushModI(e.flags?Fe({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){En(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){Ot(A(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),Rr(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind==="property"&&kr.has(e.value)&&t.setHasCasedChar()}},za={Alternative({body:e},t,n){return e.map(n).join("")},Assertion({kind:e,negate:t}){if(e==="string_end")return"$";if(e==="string_start")return"^";if(e==="word_boundary")return t?w`\B`:w`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!="number")throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&t.accuracy==="strict"&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){const{body:r,name:s,number:o}=e,i={ignoreCase:t.currentFlags.ignoreCase},a=t.originMap.get(e);return a&&(i.hidden=!0,o>a.number&&(i.transferTo=a.number)),t.captureMap.set(o,i),`(${s?`?<${s}>`:""}${r.map(n).join("|")})`},Character({value:e},t){const n=A(e),r=re(e,{escDigit:t.lastNode.type==="Backreference",inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Ot(n)){const s=Sr(n);return t.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return n},CharacterClass(e,t,n){const{kind:r,negate:s,parent:o}=e;let{body:i}=e;if(r==="intersection"&&!t.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");M.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&i.some(In)&&(i=[He(45),...i.filter(l=>!In(l))]);const a=()=>`[${s?"^":""}${i.map(n).join(r==="intersection"?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||M.bugNestedClassIgnoresNegation)&&!s){const u=i.filter(h=>h.type==="CharacterClass"&&h.kind==="union"&&h.negate);if(u.length){const h=G(),f=h.body[0];return h.parent=o,f.parent=h,i=i.filter(d=>!u.includes(d)),e.body=i,i.length?(e.parent=f,f.body.push(e)):h.body.pop(),u.forEach(d=>{const p=Y({body:[d]});d.parent=p,p.parent=h,h.body.push(p)}),n(h)}}t.inCharClass=!0;const l=a();return t.inCharClass=!1,l}const c=i[0];if(r==="union"&&!s&&c&&((!t.useFlagV||!t.verbose)&&o.kind==="union"&&!(M.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&o.kind==="intersection"&&i.length===1&&c.type!=="CharacterClassRange"))return i.map(n).join("");if(!t.useFlagV&&o.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return a()},CharacterClassRange(e,t){const n=e.min.value,r=e.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},o=re(n,s),i=re(r,s),a=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){const c=Rr(e);Qa(c).forEach(u=>{a.add(Array.isArray(u)?`${re(u[0],s)}-${re(u[1],s)}`:re(u,s))})}return`${o}-${i}${[...a].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:r},s){if(e==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":w`[^\n]`;if(e==="digit")return t?w`\D`:w`\d`;if(e==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&kr.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?w`\P`:w`\p`}{${r?`${r}=`:""}${n}}`}if(e==="word")return t?w`\W`:w`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")},Group({atomic:e,body:t,flags:n,parent:r},s,o){const i=s.currentFlags;n&&(s.currentFlags=Fe(i,n));const a=t.map(o).join("|"),c=!s.verbose&&t.length===1&&r.type!=="Quantifier"&&!e&&(!s.useFlagMods||!n)?a:`(?${Ka(e,n,s.useFlagMods)}${a})`;return s.currentFlags=i,c},LookaroundAssertion({body:e,kind:t,negate:n},r,s){return`(?${`${t==="lookahead"?"":"<"}${n?"!":"="}`}${e.map(s).join("|")})`},Quantifier(e,t,n){return n(e.body)+Za(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return t===0?`(?R=${r})`:w`\g<${t}&R=${r}>`}},Ha=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),qa=new Set(["-","\\","]","^","["]),Va=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),An=new Map([[9,w`\t`],[10,w`\n`],[11,w`\v`],[12,w`\f`],[13,w`\r`],[8232,w`\u2028`],[8233,w`\u2029`],[65279,w`\uFEFF`]]),Xa=new RegExp("^\\p{Cased}$","u");function Ot(e){return Xa.test(e)}function Rr(e,t){const n=!!t?.firstOnly,r=e.min.value,s=e.max.value,o=[];if(r<65&&(s===65535||s>=131071)||r===65536&&s>=131071)return o;for(let i=r;i<=s;i++){const a=A(i);if(!Ot(a))continue;const c=Sr(a).filter(l=>{const u=l.codePointAt(0);return u<r||u>s});if(c.length&&(o.push(...c),n))break}return o}function re(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(An.has(e))return An.get(e);if(e<32||e>126&&e<160||e>262143||t&&Ja(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;const s=n?r?Va:qa:Ha,o=A(e);return(s.has(o)?"\\":"")+o}function Qa(e){const t=e.map(s=>s.codePointAt(0)).sort((s,o)=>s-o),n=[];let r=null;for(let s=0;s<t.length;s++)t[s+1]===t[s]+1?r??=t[s]:r===null?n.push(t[s]):(n.push([r,t[s]]),r=null);return n}function Ka(e,t,n){if(e)return">";let r="";if(t&&n){const{enable:s,disable:o}=t;r=(s?.ignoreCase?"i":"")+(s?.dotAll?"s":"")+(o?"-":"")+(o?.ignoreCase?"i":"")+(o?.dotAll?"s":"")}return`${r}:`}function Za({kind:e,max:t,min:n}){let r;return!n&&t===1?r="?":!n&&t===1/0?r="*":n===1&&t===1/0?r="+":n===t?r=`{${n}}`:r=`{${n},${t===1/0?"":t}}`,r+{greedy:"",lazy:"?",possessive:"+"}[e]}function En({type:e}){return e==="CapturingGroup"||e==="Group"||e==="LookaroundAssertion"}function Ja(e){return e>47&&e<58}function In({type:e,value:t}){return e==="Character"&&t===45}var Ya=class It extends RegExp{#t=new Map;#e=null;#r;#n=null;#s=null;rawOptions={};get source(){return this.#r||"(?:)"}constructor(t,n,r){const s=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");const o=t;super(o,n),this.#r=o.source,o instanceof It&&(this.#t=o.#t,this.#n=o.#n,this.#s=o.#s,this.rawOptions=o.rawOptions)}else{const o={hiddenCaptures:[],strategy:null,transfers:[],...r};super(s?"":t,n),this.#r=t,this.#t=tc(o.hiddenCaptures,o.transfers),this.#s=o.strategy,this.rawOptions=r??{}}s||(this.#e=this)}exec(t){if(!this.#e){const{lazyCompile:s,...o}=this.rawOptions;this.#e=new It(this.#r,this.flags,o)}const n=this.global||this.sticky,r=this.lastIndex;if(this.#s==="clip_search"&&n&&r){this.lastIndex=0;const s=this.#o(t.slice(r));return s&&(ec(s,r,t,this.hasIndices),this.lastIndex+=r),s}return this.#o(t)}#o(t){this.#e.lastIndex=this.lastIndex;const n=super.exec.call(this.#e,t);if(this.lastIndex=this.#e.lastIndex,!n||!this.#t.size)return n;const r=[...n];n.length=1;let s;this.hasIndices&&(s=[...n.indices],n.indices.length=1);const o=[0];for(let i=1;i<r.length;i++){const{hidden:a,transferTo:c}=this.#t.get(i)??{};if(a?o.push(null):(o.push(n.length),n.push(r[i]),this.hasIndices&&n.indices.push(s[i])),c&&r[i]!==void 0){const l=o[c];if(!l)throw new Error(`Invalid capture transfer to "${l}"`);if(n[l]=r[i],this.hasIndices&&(n.indices[l]=s[i]),n.groups){this.#n||(this.#n=nc(this.source));const u=this.#n.get(c);u&&(n.groups[u]=r[i],this.hasIndices&&(n.indices.groups[u]=s[i]))}}}return n}};function ec(e,t,n,r){if(e.index+=t,e.input=n,r){const s=e.indices;for(let i=0;i<s.length;i++){const a=s[i];a&&(s[i]=[a[0]+t,a[1]+t])}const o=s.groups;o&&Object.keys(o).forEach(i=>{const a=o[i];a&&(o[i]=[a[0]+t,a[1]+t])})}}function tc(e,t){const n=new Map;for(const r of e)n.set(r,{hidden:!0});for(const[r,s]of t)for(const o of s)ye(n,o,{}).transferTo=r;return n}function nc(e){const t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r=0,s=0,o;for(;o=t.exec(e);){const{0:i,groups:{capture:a,name:c}}=o;i==="["?r++:r?i==="]"&&r--:a&&(s++,c&&n.set(s,c))}return n}function rc(e,t){const n=sc(e,t);return n.options?new Ya(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function sc(e,t){const n=Cr(t),r=dr(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Mt}),s=$a(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),o=Ua(s,n),i=wa(o.pattern,{captureTransfers:o._captureTransfers,hiddenCaptures:o._hiddenCaptures,mode:"external"}),a=ba(i.pattern),c=ya(a.pattern,{captureTransfers:i.captureTransfers,hiddenCaptures:i.hiddenCaptures}),l={pattern:c.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${o.flags}${o.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const u=c.hiddenCaptures.sort((p,y)=>p-y),h=Array.from(c.captureTransfers),f=s._strategy,d=l.pattern.length>=n.lazyCompileLength;(u.length||h.length||f||d)&&(l.options={...u.length&&{hiddenCaptures:u},...h.length&&{transfers:h},...f&&{strategy:f},...d&&{lazyCompile:d}})}return l}function oc(e,t){return rc(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function ic(e={}){const t={target:"auto",cache:new Map,...e};return t.regexConstructor||=n=>oc(n,{target:t.target}),{createScanner(n){return new Ci(n,t)},createString(n){return{content:n}}}}let vn;const ht=new Map;function ac(){return vn??=wi({themes:[jt(()=>import("./github-light-DAi9KRSo.js"),[]),jt(()=>import("./github-dark-DHJKELXO.js"),[])],langs:[],engine:ic()}),vn}function cc(e,t,n){let r=ht.get(t);return r||(r=n().then(s=>e.loadLanguage(s.default)).then(()=>{}).catch(s=>{throw ht.delete(t),s}),ht.set(t,r)),r}const lc={code(e){e.children=e.children.filter(t=>t.type!=="text")}};async function fc(e,t,n){const r=Gr(t);if(!r)return;const s=await ac(),o=Mr(r)?void 0:Or.get(r);return o&&await cc(s,r,o),s.codeToHtml(e,{lang:r,themes:{light:"github-light",dark:"github-dark"},...n?{transformers:[lc]}:{}})}export{fc as highlight};
|