diffs-pane 0.2.0 → 0.4.0
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 +33 -5
- package/dist/cli/index.js +61 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/daemon/edits.js +179 -0
- package/dist/daemon/edits.js.map +1 -0
- package/dist/daemon/security.js +2 -2
- package/dist/daemon/security.js.map +1 -1
- package/dist/daemon/server.js +50 -2
- package/dist/daemon/server.js.map +1 -1
- package/dist/daemon/session.js +24 -1
- package/dist/daemon/session.js.map +1 -1
- package/dist/shared/patch.js +94 -3
- package/dist/shared/patch.js.map +1 -1
- package/dist/shared/themes.js +62 -0
- package/dist/shared/themes.js.map +1 -0
- package/dist/ui/assets/index-C3xEfNP_.js +518 -0
- package/dist/ui/assets/index-DUH6QCUZ.css +1 -0
- package/dist/ui/assets/index-Dtx8mcCv.js +2832 -0
- package/dist/ui/assets/worker-O63gxiV6.js +156 -0
- package/dist/ui/index.html +2 -2
- package/dist/vcs/git.js +65 -1
- package/dist/vcs/git.js.map +1 -1
- package/dist/vcs/jj.js +13 -1
- package/dist/vcs/jj.js.map +1 -1
- package/dist/vcs/types.js +3 -1
- package/dist/vcs/types.js.map +1 -1
- package/package.json +12 -12
- package/skills/diffs-pane/SKILL.md +2 -0
- package/dist/ui/assets/index-BQk-ERmu.css +0 -1
- package/dist/ui/assets/index-CzSq0MRa.js +0 -2904
- package/dist/ui/assets/worker-DLF4drjM.js +0 -155
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
var T=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function Hs(e){return yn(e)}function yn(e){return Array.isArray(e)?qs(e):e instanceof RegExp?e:typeof e=="object"?Vs(e):e}function qs(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=yn(e[n]);return t}function Vs(e){let t={};for(let n in e)t[n]=yn(e[n]);return t}function Lr(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function Nr(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?Nr(e.substring(0,e.length-1)):e.substr(~t+1)}var At=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,We=class{static hasCaptures(e){return e===null?!1:(At.lastIndex=0,At.test(e))}static replaceCaptures(e,t,n){return e.replace(At,(r,s,o,i)=>{let l=n[parseInt(s||o,10)];if(l){let a=t.substring(l.start,l.end);for(;a[0]===".";)a=a.substring(1);switch(i){case"downcase":return a.toLowerCase();case"upcase":return a.toUpperCase();default:return a}}else return r})}};function Tr(e,t){return e<t?-1:e>t?1:0}function Pr(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=Tr(e[s],t[s]);if(o!==0)return o}return 0}return n-r}function Nn(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 $r(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Mr=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}},rt=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Zs(e),t)}static createFromParsedTheme(e,t){return Ys(e,t)}_cachedMatchRoot=new Mr(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=>Xs(e.parent,s.parentScopes));return r?new Or(r.fontStyle,r.foreground,r.background):null}},Rt=class Je{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Je(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new Je(n,t[r]);return n}push(t){return new Je(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 Xs(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&&!Ks(e.scopeName,r);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Ks(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Or=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Zs(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 l;if(typeof i.scope=="string"){let f=i.scope;f=f.replace(/^[,]+/,""),f=f.replace(/[,]+$/,""),l=f.split(",")}else Array.isArray(i.scope)?l=i.scope:l=[""];let a=-1;if(typeof i.settings.fontStyle=="string"){a=0;let f=i.settings.fontStyle.split(" ");for(let h=0,d=f.length;h<d;h++)switch(f[h]){case"italic":a=a|1;break;case"bold":a=a|2;break;case"underline":a=a|4;break;case"strikethrough":a=a|8;break}}let c=null;typeof i.settings.foreground=="string"&&Nn(i.settings.foreground)&&(c=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&Nn(i.settings.background)&&(u=i.settings.background);for(let f=0,h=l.length;f<h;f++){let p=l[f].trim().split(" "),b=p[p.length-1],w=null;p.length>1&&(w=p.slice(0,p.length-1),w.reverse()),n[r++]=new Qs(b,w,s,a,c,u)}}return n}var Qs=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}},W=(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))(W||{});function Ys(e,t){e.sort((a,c)=>{let u=Tr(a.scope,c.scope);return u!==0||(u=Pr(a.parentScopes,c.parentScopes),u!==0)?u:a.index-c.index});let n=0,r="#000000",s="#ffffff";for(;e.length>=1&&e[0].scope==="";){let a=e.shift();a.fontStyle!==-1&&(n=a.fontStyle),a.foreground!==null&&(r=a.foreground),a.background!==null&&(s=a.background)}let o=new Js(t),i=new Or(n,o.getId(r),o.getId(s)),l=new to(new Kt(0,null,-1,0,0),[]);for(let a=0,c=e.length;a<c;a++){let u=e[a];l.insert(0,u.scope,u.parentScopes,u.fontStyle,o.getId(u.foreground),o.getId(u.background))}return new rt(o,i,l)}var Js=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)}},eo=Object.freeze([]),Kt=class Dr{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(t,n,r,s,o){this.scopeDepth=t,this.parentScopes=n||eo,this.fontStyle=r,this.foreground=s,this.background=o}clone(){return new Dr(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)}},to=class Zt{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(Zt._cmpBySpecificity),n}insert(t,n,r,s,o,i){if(n===""){this._doInsertHere(t,r,s,o,i);return}let l=n.indexOf("."),a,c;l===-1?(a=n,c=""):(a=n.substring(0,l),c=n.substring(l+1));let u;this._children.hasOwnProperty(a)?u=this._children[a]:(u=new Zt(this._mainRule.clone(),Kt.cloneArr(this._rulesWithParentScopes)),this._children[a]=u),u.insert(t+1,c,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,l=this._rulesWithParentScopes.length;i<l;i++){let a=this._rulesWithParentScopes[i];if(Pr(a.parentScopes,n)===0){a.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 Kt(t,n,r,s,o))}},me=class K{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=K.getLanguageId(t),r=K.getTokenType(t),s=K.getFontStyle(t),o=K.getForeground(t),i=K.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,l){let a=K.getLanguageId(t),c=K.getTokenType(t),u=K.containsBalancedBrackets(t)?1:0,f=K.getFontStyle(t),h=K.getForeground(t),d=K.getBackground(t);return n!==0&&(a=n),r!==8&&(c=r),s!==null&&(u=s?1:0),o!==-1&&(f=o),i!==0&&(h=i),l!==0&&(d=l),(a<<0|c<<8|u<<10|f<<11|h<<15|d<<24)>>>0}};function st(e,t){const n=[],r=no(e);let s=r.next();for(;s!==null;){let a=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":a=1;break;case"L":a=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let c=i();if(n.push({matcher:c,priority:a}),s!==",")break;s=r.next()}return n;function o(){if(s==="-"){s=r.next();const a=o();return c=>!!a&&!a(c)}if(s==="("){s=r.next();const a=l();return s===")"&&(s=r.next()),a}if(Tn(s)){const a=[];do a.push(s),s=r.next();while(Tn(s));return c=>t(a,c)}return null}function i(){const a=[];let c=o();for(;c;)a.push(c),c=o();return u=>a.every(f=>f(u))}function l(){const a=[];let c=i();for(;c&&(a.push(c),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");c=i()}return u=>a.some(f=>f(u))}}function Tn(e){return!!e&&!!e.match(/[\w\.:]+/)}function no(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 Br(e){typeof e.dispose=="function"&&e.dispose()}var $e=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},ro=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},so=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))}},oo=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new $e(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new so;for(const n of e)io(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof $e){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 io(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 $e?et({baseGrammar:o,selfGrammar:s},r):Qt(e.ruleName,{baseGrammar:o,selfGrammar:s,repository:s.repository},r);const i=n.injections(e.scopeName);if(i)for(const l of i)r.add(new $e(l))}function Qt(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];ot([r],t,n)}}function et(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&ot(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&ot(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function ot(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?Lr({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&ot(r.patterns,{...t,repository:s},n);const o=r.include;if(!o)continue;const i=Gr(o);switch(i.kind){case 0:et({...t,selfGrammar:t.baseGrammar},n);break;case 1:et(t,n);break;case 2:Qt(i.ruleName,{...t,repository:s},n);break;case 3:case 4:const l=i.scopeName===t.selfGrammar.scopeName?t.selfGrammar:i.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(l){const a={baseGrammar:t.baseGrammar,selfGrammar:l,repository:s};i.kind===4?Qt(i.ruleName,a,n):et(a,n)}else i.kind===4?n.add(new ro(i.scopeName,i.ruleName)):n.add(new $e(i.scopeName));break}}}var ao=class{kind=0},lo=class{kind=1},co=class{constructor(e){this.ruleName=e}kind=2},uo=class{constructor(e){this.scopeName=e}kind=3},fo=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Gr(e){if(e==="$base")return new ao;if(e==="$self")return new lo;const t=e.indexOf("#");if(t===-1)return new uo(e);if(t===0)return new co(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new fo(n,r)}}var ho=/\\(\d+)/,Pn=/\\(\d+)/g,po=-1,Fr=-2;var Fe=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?`${Nr(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)}},go=class extends Fe{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!")}},mo=class extends Fe{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,null),this._match=new Me(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 Oe,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},$n=class extends Fe{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 Oe,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Yt=class extends Fe{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,s,o,i,l,a,c){super(e,t,n,r),this._begin=new Me(s,this.id),this.beginCaptures=o,this._end=new Me(i||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=a||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.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 Oe;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}},it=class extends Fe{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,s,o,i,l,a){super(e,t,n,r),this._begin=new Me(s,this.id),this.beginCaptures=o,this.whileCaptures=l,this._while=new Me(i,Fr),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=a.patterns,this.hasMissingPatterns=a.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 Oe;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 Oe,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||""),this._cachedCompiledWhilePatterns}},Ur=class j{static createCaptureRule(t,n,r,s,o){return t.registerRule(i=>new go(n,i,r,s,o))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(s=>{if(t.id=s,t.match)return new mo(t.$vscodeTextmateLocation,t.id,t.name,t.match,j._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=Lr({},r,t.repository));let o=t.patterns;return typeof o>"u"&&t.include&&(o=[{include:t.include}]),new $n(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,j._compilePatterns(o,n,r))}return t.while?new it(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,j._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,j._compileCaptures(t.whileCaptures||t.captures,n,r),j._compilePatterns(t.patterns,n,r)):new Yt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,j._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,j._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,j._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 l=parseInt(i,10);l>o&&(o=l)}for(let i=0;i<=o;i++)s[i]=null;for(const i in t){if(i==="$vscodeTextmateLocation")continue;const l=parseInt(i,10);let a=0;t[i].patterns&&(a=j.getCompiledRuleId(t[i],n,r)),s[l]=j.createCaptureRule(n,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,a)}}return s}static _compilePatterns(t,n,r){let s=[];if(t)for(let o=0,i=t.length;o<i;o++){const l=t[o];let a=-1;if(l.include){const c=Gr(l.include);switch(c.kind){case 0:case 1:a=j.getCompiledRuleId(r[l.include],n,r);break;case 2:let u=r[c.ruleName];u&&(a=j.getCompiledRuleId(u,n,r));break;case 3:case 4:const f=c.scopeName,h=c.kind===4?c.ruleName:null,d=n.getExternalGrammar(f,r);if(d)if(h){let p=d.repository[h];p&&(a=j.getCompiledRuleId(p,n,d.repository))}else a=j.getCompiledRuleId(d.repository.$self,n,d.repository);break}}else a=j.getCompiledRuleId(l,n,r);if(a!==-1){const c=n.getRule(a);let u=!1;if((c instanceof $n||c instanceof Yt||c instanceof it)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;s.push(a)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},Me=class jr{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 l=0;l<r;l++)if(t.charAt(l)==="\\"&&l+1<r){const c=t.charAt(l+1);c==="z"?(o.push(t.substring(s,l)),o.push("$(?!\\n)(?<!\\n)"),s=l+2):(c==="A"||c==="G")&&(i=!0),l++}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=ho.test(this.source):this.hasBackReferences=!1}clone(){return new jr(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 Pn.lastIndex=0,this.source.replace(Pn,(s,o)=>$r(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,l,a;for(o=0,i=this.source.length;o<i;o++)l=this.source.charAt(o),t[o]=l,n[o]=l,r[o]=l,s[o]=l,l==="\\"&&o+1<i&&(a=this.source.charAt(o+1),a==="A"?(t[o+1]="",n[o+1]="",r[o+1]="A",s[o+1]="A"):a==="G"?(t[o+1]="",n[o+1]="G",r[o+1]="",s[o+1]="G"):(t[o+1]=a,n[o+1]=a,r[o+1]=a,s[o+1]=a),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}},Oe=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 Mn(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 Mn(e,r,this._items.map(s=>s.ruleId))}},Mn=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
|
-
`)}findNextMatchSync(e,t,n){const r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Lt=class{constructor(e,t){this.languageId=e,this.tokenType=t}},yo=class Jt{_defaultAttributes;_embeddedLanguagesMatcher;constructor(t,n){this._defaultAttributes=new Lt(t,8),this._embeddedLanguagesMatcher=new bo(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?Jt._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new Lt(0,0);_getBasicScopeAttributes=new Mr(t=>{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new Lt(n,r)});_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(Jt.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/},bo=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])=>$r(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])}},On=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Wr(e,t,n,r,s,o,i,l){const a=t.content.length;let c=!1,u=-1;if(i){const d=wo(e,t,n,r,s,o);s=d.stack,r=d.linePos,n=d.isFirstLine,u=d.anchorPosition}const f=Date.now();for(;!c;){if(l!==0&&Date.now()-f>l)return new On(s,!0);h()}return new On(s,!1);function h(){const d=Co(e,t,n,r,s,u);if(!d){o.produce(s,a),c=!0;return}const p=d.captureIndices,b=d.matchedRuleId,w=p&&p.length>0?p[0].end>r:!1;if(b===po){const g=s.getRule(e);o.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),Ne(e,t,n,s,o,g.endCaptures,p),o.produce(s,p[0].end);const m=s;if(s=s.parent,u=m.getAnchorPos(),!w&&m.getEnterPos()===r){s=m,o.produce(s,a),c=!0;return}}else{const g=e.getRule(b);o.produce(s,p[0].start);const m=s,y=g.getName(t.content,p),_=s.contentNameScopesList.pushAttributed(y,e);if(s=s.push(b,r,u,p[0].end===a,null,_,_),g instanceof Yt){const S=g;Ne(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),x=_.pushAttributed(v,e);if(s=s.withContentNameScopesList(x),S.endHasBackReferences&&(s=s.withEndRule(S.getEndWithResolvedBackReferences(t.content,p))),!w&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,a),c=!0;return}}else if(g instanceof it){const S=g;Ne(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),x=_.pushAttributed(v,e);if(s=s.withContentNameScopesList(x),S.whileHasBackReferences&&(s=s.withEndRule(S.getWhileWithResolvedBackReferences(t.content,p))),!w&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,a),c=!0;return}}else if(Ne(e,t,n,s,o,g.captures,p),o.produce(s,p[0].end),s=s.pop(),!w){s=s.safePop(),o.produce(s,a),c=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function wo(e,t,n,r,s,o){let i=s.beginRuleCapturedEOL?0:-1;const l=[];for(let a=s;a;a=a.pop()){const c=a.getRule(e);c instanceof it&&l.push({rule:c,stack:a})}for(let a=l.pop();a;a=l.pop()){const{ruleScanner:c,findOptions:u}=ko(a.rule,e,a.stack.endRule,n,r===i),f=c.findNextMatchSync(t,r,u);if(f){if(f.ruleId!==Fr){s=a.stack.pop();break}f.captureIndices&&f.captureIndices.length&&(o.produce(a.stack,f.captureIndices[0].start),Ne(e,t,n,a.stack,o,a.rule.whileCaptures,f.captureIndices),o.produce(a.stack,f.captureIndices[0].end),i=f.captureIndices[0].end,f.captureIndices[0].end>r&&(r=f.captureIndices[0].end,n=!1))}else{s=a.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:i,isFirstLine:n}}function Co(e,t,n,r,s,o){const i=_o(e,t,n,r,s,o),l=e.getInjections();if(l.length===0)return i;const a=So(l,e,t,n,r,s,o);if(!a)return i;if(!i)return a;const c=i.captureIndices[0].start,u=a.captureIndices[0].start;return u<c||a.priorityMatch&&u===c?a:i}function _o(e,t,n,r,s,o){const i=s.getRule(e),{ruleScanner:l,findOptions:a}=zr(i,e,s.endRule,n,r===o),c=l.findNextMatchSync(t,r,a);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function So(e,t,n,r,s,o,i){let l=Number.MAX_VALUE,a=null,c,u=0;const f=o.contentNameScopesList.getScopeNames();for(let h=0,d=e.length;h<d;h++){const p=e[h];if(!p.matcher(f))continue;const b=t.getRule(p.ruleId),{ruleScanner:w,findOptions:g}=zr(b,t,null,r,s===i),m=w.findNextMatchSync(n,s,g);if(!m)continue;const y=m.captureIndices[0].start;if(!(y>=l)&&(l=y,a=m.captureIndices,c=m.ruleId,u=p.priority,l===s))break}return a?{priorityMatch:u===-1,captureIndices:a,matchedRuleId:c}:null}function zr(e,t,n,r,s){return{ruleScanner:e.compileAG(t,n,r,s),findOptions:0}}function ko(e,t,n,r,s){return{ruleScanner:e.compileWhileAG(t,n,r,s),findOptions:0}}function Ne(e,t,n,r,s,o,i){if(o.length===0)return;const l=t.content,a=Math.min(o.length,i.length),c=[],u=i[0].end;for(let f=0;f<a;f++){const h=o[f];if(h===null)continue;const d=i[f];if(d.length===0)continue;if(d.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=d.start;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?s.produceFromScopes(c[c.length-1].scopes,d.start):s.produce(r,d.start),h.retokenizeCapturedWithRuleId){const b=h.getName(l,i),w=r.contentNameScopesList.pushAttributed(b,e),g=h.getContentName(l,i),m=w.pushAttributed(g,e),y=r.push(h.retokenizeCapturedWithRuleId,d.start,-1,!1,null,w,m),_=e.createOnigString(l.substring(0,d.end));Wr(e,_,n&&d.start===0,d.start,y,s,!1,0),Br(_);continue}const p=h.getName(l,i);if(p!==null){const w=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(p,e);c.push(new vo(w,d.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var vo=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function xo(e,t,n,r,s,o,i,l){return new Io(e,t,n,r,s,o,i,l)}function Dn(e,t,n,r,s){const o=st(t,at),i=Ur.getCompiledRuleId(n,r,s.repository);for(const l of o)e.push({debugSelector:t,matcher:l.matcher,ruleId:i,grammar:s,priority:l.priority})}function at(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(Eo(t[s],r))return n=s+1,!0;return!1})}function Eo(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 Io=class{constructor(e,t,n,r,s,o,i,l){if(this._rootScopeName=e,this.balancedBracketSelectors=o,this._onigLib=l,this._basicScopeAttributesProvider=new yo(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=Bn(t,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const a of Object.keys(s)){const c=st(a,at);for(const u of c)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[a]})}}_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)Dn(t,i,s[i],this,r);const o=this._grammarRepository.injections(n);o&&o.forEach(i=>{const l=this.getExternalGrammar(i);if(l){const a=l.injectionSelector;a&&Dn(t,a,l,this,l)}})}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]=Bn(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=Ur.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!t||t===en.NULL){s=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),f=me.set(0,c.languageId,c.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),h=this.getRule(this._rootId).getName(null,null);let d;h?d=Te.createRootAndLookUpScopeName(h,f,this):d=Te.createRoot("unknown",f),t=new en(null,this._rootId,-1,-1,!1,null,d,d)}else s=!1,t.reset();e=e+`
|
|
3
|
-
`;const o=this.createOnigString(e),i=o.content.length,l=new Ro(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),a=Wr(this,o,s,0,t,l,!0,r);return Br(o),{lineLength:i,lineTokens:l,ruleStack:a.stack,stoppedEarly:a.stoppedEarly}}};function Bn(e,t){return e=Hs(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 Te=class te{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=Rt.push(s,o.scopeNames),r=new te(r,s,o.encodedTokenAttributes);return r}static createRoot(t,n){return new te(null,new Rt(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const s=r.getMetadataForScope(t),o=new Rt(null,t),i=r.themeProvider.themeMatch(o),l=te.mergeAttributes(n,s,i);return new te(null,o,l)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return te.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),me.set(t,n.languageId,n.tokenType,null,s,o,i)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return te._pushAttributed(this,t,n);const r=t.split(/ /g);let s=this;for(const o of r)s=te._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),l=te.mergeAttributes(t.tokenAttributes,s,i);return new te(t,o,l)}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}},en=class he{constructor(t,n,r,s,o,i,l,a){this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=l,this.contentNameScopesList=a,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new he(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:he._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Te.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(){he._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,s,o,i,l){return new he(this,t,n,r,s,o,i,l)}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 he(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=Te.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new he(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Te.fromExtension(r,n.contentNameScopesList))}},Ao=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):st(n,at).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>st(n,at).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}},Ro=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=me.set(r,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(o))}if(s&&(r=me.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}},Lo=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,xo(e,o,t,n,r,s,this,this._onigLib))}return this._grammars.get(e)}},No=class{_options;_syncRegistry;_ensureGrammarCache;constructor(t){this._options=t,this._syncRegistry=new Lo(rt.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(rt.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 Ao(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,r,s,o){const i=new oo(this._syncRegistry,t);for(;i.Q.length>0;)i.Q.map(l=>this._loadSingleGrammar(l.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)}},tn=en.NULL;function lt(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 ue(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function To(e){return Array.isArray(e)?e:[e]}async function Hr(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function pt(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Po(e){return e==="ansi"||pt(e)}function gt(e){return e==="none"}function $o(e){return gt(e)}const Mo=/(\r?\n)/g;function mt(e,t=!1){if(e.length===0)return[["",0]];const n=e.split(Mo);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 Gn={light:"#333333",dark:"#bbbbbb"},Fn={light:"#fffffe",dark:"#1e1e1e"},Un="__shiki_resolved";function bn(e){if(e?.[Un])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 l=t.settings?t.settings.find(a=>!a.name&&!a.scope):void 0;l?.settings?.foreground&&(r=l.settings.foreground),l?.settings?.background&&(n=l.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"?Gn.light:Gn.dark),n||(n=t.type==="light"?Fn.light:Fn.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(l){if(o.has(l))return o.get(l);s+=1;const a=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${a}`]?i(l):(o.set(l,a),a)}t.settings=t.settings.map(l=>{const a=l.settings?.foreground&&!l.settings.foreground.startsWith("#"),c=l.settings?.background&&!l.settings.background.startsWith("#");if(!a&&!c)return l;const u={...l,settings:{...l.settings}};if(a){const f=i(l.settings.foreground);t.colorReplacements[f]=l.settings.foreground,u.settings.foreground=f}if(c){const f=i(l.settings.background);t.colorReplacements[f]=l.settings.background,u.settings.background=f}return u});for(const l of Object.keys(t.colors||{}))if((l==="editor.foreground"||l==="editor.background"||l.startsWith("terminal.ansi"))&&!t.colors[l]?.startsWith("#")){const a=i(t.colors[l]);t.colorReplacements[a]=t.colors[l],t.colors[l]=a}return Object.defineProperty(t,Un,{enumerable:!1,writable:!1,value:!0}),t}async function qr(e){return[...new Set((await Promise.all(e.filter(t=>!Po(t)).map(async t=>await Hr(t).then(n=>Array.isArray(n)?n:[n])))).flat())]}async function Vr(e){return(await Promise.all(e.map(async t=>$o(t)?null:bn(await Hr(t))))).filter(t=>!!t)}function Xr(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 T(`Circular alias \`${[...n].join(" -> ")} -> ${e}\``);n.add(e)}}return e}var Oo=class extends No{_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=bn(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=rt.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=Xr(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(([l])=>l).includes(i)):!1).filter(s=>!n.includes(s));throw new T(`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))}},Do=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 Re=0;function Bo(e){Re+=1,e.warnings!==!1&&Re>=10&&Re%10===0&&console.warn(`[Shiki] ${Re} 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 T("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(bn),s=new Oo(new Do(e.engine,n),r,n,e.langAlias);let o;function i(m){return Xr(m,e.langAlias)}function l(m){w();const y=s.getGrammar(typeof m=="string"?m:m.name);if(!y)throw new T(`Language \`${m}\` not found, you may need to load it first`);return y}function a(m){if(m==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};w();const y=s.getTheme(m);if(!y)throw new T(`Theme \`${m}\` not found, you may need to load it first`);return y}function c(m){w();const y=a(m);return o!==m&&(s.setTheme(y),o=m),{theme:y,colorMap:s.getColorMap()}}function u(){return w(),s.getLoadedThemes()}function f(){return w(),s.getLoadedLanguages()}function h(...m){w(),s.loadLanguages(m.flat(1))}async function d(...m){return h(await qr(m))}function p(...m){w();for(const y of m.flat(1))s.loadTheme(y)}async function b(...m){return w(),p(await Vr(m))}function w(){if(t)throw new T("Shiki instance has been disposed")}function g(){t||(t=!0,s.dispose(),Re-=1)}return{setTheme:c,getTheme:a,getLanguage:l,getLoadedThemes:u,getLoadedLanguages:f,resolveLangAlias:i,loadLanguage:d,loadLanguageSync:h,loadTheme:b,loadThemeSync:p,dispose:g,[Symbol.dispose]:g}}async function Go(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,r]=await Promise.all([Vr(e.themes||[]),qr(e.langs||[]),e.engine]);return Bo({...e,themes:t,langs:n,engine:r})}const Kr=new WeakMap;function yt(e,t){Kr.set(e,t)}function De(e){return Kr.get(e)}var bt=class Zr{_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 Zr(Object.fromEntries(To(n).map(r=>[r,tn])),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 Fo(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Fo(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 Uo(e,t){if(!(e instanceof bt))throw new T("Invalid grammar state");return e.getInternalStack(t)}const jo=/,/,Wo=/ /;function Qr(e,t,n={}){const{theme:r=e.getLoadedThemes()[0]}=n;if(pt(e.resolveLangAlias(n.lang||"text"))||gt(r))return mt(t).map(l=>[{content:l[0],offset:l[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 T(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${i.name}"`);if(!n.grammarState.themes.includes(s.name))throw new T(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${s.name}"`)}return Ho(t,i,s,o,n)}function zo(...e){if(e.length===2)return De(e[1]);const[t,n,r={}]=e,{lang:s="text",theme:o=t.getLoadedThemes()[0]}=r;if(pt(s)||gt(o))throw new T("Plain language does not have grammar state");if(s==="ansi")throw new T("ANSI language does not have grammar state");const{theme:i,colorMap:l}=t.setTheme(o),a=t.getLanguage(s);return new bt(wn(n,a,i,l,r).stateStack,a.name,i.name)}function Ho(e,t,n,r,s){const o=wn(e,t,n,r,s),i=new bt(o.stateStack,t.name,n.name);return yt(o.tokens,i),o.tokens}function wn(e,t,n,r,s){const o=lt(n,s),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:l=500,includeExplanation:a=!1}=s,c=mt(e);let u=s.grammarState?Uo(s.grammarState,n.name)??tn:s.grammarContextCode!=null?wn(s.grammarContextCode,t,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:tn,f=[];const h=[];for(let d=0,p=c.length;d<p;d++){const[b,w]=c[d];if(b===""){f=[],h.push([]);continue}if(i>0&&b.length>=i){f=[],h.push([{content:b,offset:w,color:"",fontStyle:0}]);continue}let g,m,y;a&&a!=="tokenType"&&(g=t.tokenizeLine(b,u,l),m=g.tokens,y=0);const _=t.tokenizeLine2(b,u,l),S=_.tokens.length/2;for(let v=0;v<S;v++){const x=_.tokens[2*v],k=v+1<S?_.tokens[2*v+2]:b.length;if(x===k)continue;const A=_.tokens[2*v+1],L=ue(r[me.getForeground(A)],o),G=me.getFontStyle(A),R={content:b.substring(x,k),offset:w+x,color:L,fontStyle:G};if(a==="tokenType")R.type=me.getTokenType(A);else if(a){const H=[];if(a!=="scopeName")for(const z of n.settings){let ie;switch(typeof z.scope){case"string":ie=z.scope.split(jo).map(It=>It.trim());break;case"object":ie=z.scope;break;default:continue}H.push({settings:z,selectors:ie.map(It=>It.split(Wo))})}R.explanation=[];let P=0;for(;x+P<k;){const z=m[y],ie=b.substring(z.startIndex,z.endIndex);P+=ie.length,R.explanation.push({content:ie,scopes:a==="scopeName"?qo(z.scopes):Vo(H,z.scopes)}),y+=1}}f.push(R)}h.push(f),f=[],u=_.ruleStack}return{tokens:h,stateStack:u}}function qo(e){return e.map(t=>({scopeName:t}))}function Vo(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const o=t[r];n[r]={scopeName:o,themeMatches:Ko(e,o,t.slice(0,r))}}return n}function jn(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function Xo(e,t,n){if(!jn(e.at(-1),t))return!1;let r=e.length-2,s=n.length-1;for(;r>=0&&s>=0;)jn(e[r],n[s])&&(r-=1),s-=1;return r===-1}function Ko(e,t,n){const r=[];for(const{selectors:s,settings:o}of e)for(const i of s)if(Xo(i,t,n)){r.push(o);break}return r}function Yr(e,t,n,r=Qr){const s=Object.entries(n.themes).filter(c=>c[1]).map(c=>({color:c[0],theme:c[1]})),o=s.map(c=>{const u=r(e,t,{...n,theme:c.theme});return{tokens:u,state:De(u),theme:typeof c.theme=="string"?c.theme:c.theme.name}}),i=Zo(...o.map(c=>c.tokens)),l=i[0].map((c,u)=>c.map((f,h)=>{const d={content:f.content,variants:{},offset:f.offset};return"includeExplanation"in n&&n.includeExplanation&&(d.explanation=f.explanation),i.forEach((p,b)=>{const{content:w,explanation:g,offset:m,...y}=p[u][h];d.variants[s[b].color]=y}),d})),a=o[0].state?new bt(Object.fromEntries(o.map(c=>[c.theme,c.state?.getInternalStack(c.theme)])),o[0].state.lang):void 0;return a&&yt(l,a),l}function Zo(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const s=e.map(a=>a[r]),o=t.map(()=>[]);t.forEach((a,c)=>a.push(o[c]));const i=s.map(()=>0),l=s.map(a=>a[0]);for(;l.every(a=>a);){const a=Math.min(...l.map(c=>c.content.length));for(let c=0;c<n;c++){const u=l[c];u.content.length===a?(o[c].push(u),i[c]+=1,l[c]=s[c][i[c]]):(o[c].push({...u,content:u.content.slice(0,a)}),l[c]={...u,content:u.content.slice(a),offset:u.offset+a})}}}return t}const Qo=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class Ue{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ue.prototype.normal={};Ue.prototype.property={};Ue.prototype.space=void 0;function Jr(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Ue(n,r,t)}function nn(e){return e.toLowerCase()}class q{constructor(t,n){this.attribute=n,this.property=t}}q.prototype.attribute="";q.prototype.booleanish=!1;q.prototype.boolean=!1;q.prototype.commaOrSpaceSeparated=!1;q.prototype.commaSeparated=!1;q.prototype.defined=!1;q.prototype.mustUseProperty=!1;q.prototype.number=!1;q.prototype.overloadedBoolean=!1;q.prototype.property="";q.prototype.spaceSeparated=!1;q.prototype.space=void 0;let Yo=0;const E=Ce(),M=Ce(),rn=Ce(),C=Ce(),N=Ce(),ye=Ce(),V=Ce();function Ce(){return 2**++Yo}var sn=Object.freeze({__proto__:null,boolean:E,booleanish:M,commaOrSpaceSeparated:V,commaSeparated:ye,number:C,overloadedBoolean:rn,spaceSeparated:N});const Nt=Object.keys(sn);class Cn extends q{constructor(t,n,r,s){let o=-1;if(super(t,n),Wn(this,"space",s),typeof r=="number")for(;++o<Nt.length;){const i=Nt[o];Wn(this,Nt[o],(r&sn[i])===sn[i])}}}Cn.prototype.defined=!0;function Wn(e,t,n){n&&(e[t]=n)}function Ee(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const o=new Cn(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[nn(r)]=r,n[nn(o.attribute)]=r}return new Ue(t,n,e.space)}const es=Ee({properties:{ariaActiveDescendant:null,ariaAtomic:M,ariaAutoComplete:null,ariaBusy:M,ariaChecked:M,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:N,ariaCurrent:null,ariaDescribedBy:N,ariaDetails:null,ariaDisabled:M,ariaDropEffect:N,ariaErrorMessage:null,ariaExpanded:M,ariaFlowTo:N,ariaGrabbed:M,ariaHasPopup:null,ariaHidden:M,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:N,ariaLevel:C,ariaLive:null,ariaModal:M,ariaMultiLine:M,ariaMultiSelectable:M,ariaOrientation:null,ariaOwns:N,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:M,ariaReadOnly:M,ariaRelevant:null,ariaRequired:M,ariaRoleDescription:N,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:M,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ts(e,t){return t in e?e[t]:t}function ns(e,t){return ts(e,t.toLowerCase())}const Jo=Ee({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ye,acceptCharset:N,accessKey:N,action:null,allow:null,allowFullScreen:E,allowPaymentRequest:E,allowUserMedia:E,alpha:E,alt:null,as:null,async:E,autoCapitalize:null,autoComplete:N,autoFocus:E,autoPlay:E,blocking:N,capture:null,charSet:null,checked:E,cite:null,className:N,closedBy:null,colorSpace:null,cols:C,colSpan:C,command:null,commandFor:null,content:null,contentEditable:M,controls:E,controlsList:N,coords:C|ye,crossOrigin:null,data:null,dateTime:null,decoding:null,default:E,defer:E,dir:null,dirName:null,disabled:E,download:rn,draggable:M,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:E,formTarget:null,headers:N,height:C,hidden:rn,high:C,href:null,hrefLang:null,htmlFor:N,httpEquiv:N,id:null,imageSizes:null,imageSrcSet:null,inert:E,inputMode:null,integrity:null,is:null,isMap:E,itemId:null,itemProp:N,itemRef:N,itemScope:E,itemType:N,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:E,low:C,manifest:null,max:null,maxLength:C,media:null,method:null,min:null,minLength:C,multiple:E,muted:E,name:null,nonce:null,noModule:E,noValidate:E,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:E,optimum:C,pattern:null,ping:N,placeholder:null,playsInline:E,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:E,referrerPolicy:null,rel:N,required:E,reversed:E,rows:C,rowSpan:C,sandbox:N,scope:null,scoped:E,seamless:E,selected:E,shadowRootClonable:E,shadowRootCustomElementRegistry:E,shadowRootDelegatesFocus:E,shadowRootMode:null,shadowRootSerializable:E,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:M,src:null,srcDoc:null,srcLang:null,srcSet:null,start:C,step:null,style:null,tabIndex:C,target:null,title:null,translate:null,type:null,typeMustMatch:E,useMap:null,value:M,width:C,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:N,axis:null,background:null,bgColor:null,border:C,borderColor:null,bottomMargin:C,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:E,declare:E,event:null,face:null,frame:null,frameBorder:null,hSpace:C,leftMargin:C,link:null,longDesc:null,lowSrc:null,marginHeight:C,marginWidth:C,noResize:E,noHref:E,noShade:E,noWrap:E,object:null,profile:null,prompt:null,rev:null,rightMargin:C,rules:null,scheme:null,scrolling:M,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:E,disablePictureInPicture:E,disableRemotePlayback:E,exportParts:ye,part:N,prefix:null,property:null,results:C,security:null,unselectable:null},space:"html",transform:ns}),ei=Ee({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:V,accentHeight:C,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:C,amplitude:C,arabicForm:null,ascent:C,attributeName:null,attributeType:null,azimuth:C,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:C,by:null,calcMode:null,capHeight:C,className:N,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:C,diffuseConstant:C,direction:null,display:null,dur:null,divisor:C,dominantBaseline:null,download:E,dx:null,dy:null,edgeMode:null,editable:null,elevation:C,enableBackground:null,end:null,event:null,exponent:C,externalResourcesRequired:null,fill:null,fillOpacity:C,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ye,g2:ye,glyphName:ye,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:C,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:C,horizOriginX:C,horizOriginY:C,id:null,ideographic:C,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:C,k:C,k1:C,k2:C,k3:C,k4:C,kernelMatrix:V,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:C,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:C,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:C,overlineThickness:C,paintOrder:null,panose1:null,path:null,pathLength:C,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:N,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:V,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:V,rev:V,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:V,requiredFeatures:V,requiredFonts:V,requiredFormats:V,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:C,specularExponent:C,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:C,strikethroughThickness:C,string:null,stroke:null,strokeDashArray:V,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:C,strokeOpacity:C,strokeWidth:null,style:null,surfaceScale:C,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:V,tabIndex:C,tableValues:null,target:null,targetX:C,targetY:C,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:V,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:C,underlineThickness:C,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:C,values:null,vAlphabetic:C,vMathematical:C,vectorEffect:null,vHanging:C,vIdeographic:C,version:null,vertAdvY:C,vertOriginX:C,vertOriginY:C,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:C,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ts}),rs=Ee({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),ss=Ee({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ns}),os=Ee({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),ti=/[A-Z]/g,zn=/-[a-z]/g,ni=/^data[-\w.:]+$/i;function ri(e,t){const n=nn(t);let r=t,s=q;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ni.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(zn,oi);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!zn.test(o)){let i=o.replace(ti,si);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}s=Cn}return new s(r,t)}function si(e){return"-"+e.toLowerCase()}function oi(e){return e.charAt(1).toUpperCase()}const ii=Jr([es,Jo,rs,ss,os],"html"),is=Jr([es,ei,rs,ss,os],"svg"),Hn={}.hasOwnProperty;function ai(e,t){const n=t||{};function r(s,...o){let i=r.invalid;const l=r.handlers;if(s&&Hn.call(s,e)){const a=String(s[e]);i=Hn.call(l,a)?l[a]:r.unknown}if(i)return i.call(this,s,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const li=/["&'<>`]/g,ci=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ui=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,fi=/[|\\{}()[\]^$+*?.]/g,qn=new WeakMap;function hi(e,t){if(e=e.replace(t.subset?di(t.subset):li,r),t.subset||t.escapeOnly)return e;return e.replace(ci,n).replace(ui,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 di(e){let t=qn.get(e);return t||(t=pi(e),qn.set(e,t)),t}function pi(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(fi,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const gi=/[\dA-Fa-f]/;function mi(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!gi.test(String.fromCharCode(t))?r:r+";"}const yi=/\d/;function bi(e,t,n){const r="&#"+String(e);return n&&t&&!yi.test(String.fromCharCode(t))?r:r+";"}const wi=["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:"€"},Ci=["cent","copy","divide","gt","lt","not","para","times"],as={}.hasOwnProperty,on={};let ze;for(ze in Tt)as.call(Tt,ze)&&(on[Tt[ze]]=ze);const _i=/[^\dA-Za-z]/;function Si(e,t,n,r){const s=String.fromCharCode(e);if(as.call(on,s)){const o=on[s],i="&"+o;return n&&wi.includes(o)&&!Ci.includes(o)&&(!r||t&&t!==61&&_i.test(String.fromCharCode(t)))?i:i+";"}return""}function ki(e,t,n){let r=mi(e,t,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=Si(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const o=bi(e,t,n.omitOptionalSemicolons);o.length<r.length&&(r=o)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function xe(e,t){return hi(e,Object.assign({format:ki},t))}const vi=/^>|^->|<!--|-->|--!>|<!-$/g,xi=[">"],Ei=["<",">"];function Ii(e,t,n,r){return r.settings.bogusComments?"<?"+xe(e.value,Object.assign({},r.settings.characterReferences,{subset:xi}))+">":"<!--"+e.value.replace(vi,s)+"-->";function s(o){return xe(o,Object.assign({},r.settings.characterReferences,{subset:Ei}))}}function Ai(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}function Vn(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function Ri(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function Li(e){return e.join(" ").trim()}const Ni=/[ \t\n\f\r]/g;function _n(e){return typeof e=="object"?e.type==="text"?Xn(e.value):!1:Xn(e)}function Xn(e){return e.replace(Ni,"")===""}const B=cs(1),ls=cs(-1),Ti=[];function cs(e){return t;function t(n,r,s){const o=n?n.children:Ti;let i=(r||0)+e,l=o[i];if(!s)for(;l&&_n(l);)i+=e,l=o[i];return l}}const Pi={}.hasOwnProperty;function us(e){return t;function t(n,r,s){return Pi.call(e,n.tagName)&&e[n.tagName](n,r,s)}}const Sn=us({body:Mi,caption:Pt,colgroup:Pt,dd:Gi,dt:Bi,head:Pt,html:$i,li:Di,optgroup:Fi,option:Ui,p:Oi,rp:Kn,rt:Kn,tbody:Wi,td:Zn,tfoot:zi,th:Zn,thead:ji,tr:Hi});function Pt(e,t,n){const r=B(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&_n(r.value.charAt(0)))}function $i(e,t,n){const r=B(n,t);return!r||r.type!=="comment"}function Mi(e,t,n){const r=B(n,t);return!r||r.type!=="comment"}function Oi(e,t,n){const r=B(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 Di(e,t,n){const r=B(n,t);return!r||r.type==="element"&&r.tagName==="li"}function Bi(e,t,n){const r=B(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Gi(e,t,n){const r=B(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function Kn(e,t,n){const r=B(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Fi(e,t,n){const r=B(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function Ui(e,t,n){const r=B(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function ji(e,t,n){const r=B(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Wi(e,t,n){const r=B(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function zi(e,t,n){return!B(n,t)}function Hi(e,t,n){const r=B(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function Zn(e,t,n){const r=B(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const qi=us({body:Ki,colgroup:Zi,head:Xi,html:Vi,tbody:Qi});function Vi(e){const t=B(e,-1);return!t||t.type!=="comment"}function Xi(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 Ki(e){const t=B(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&_n(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function Zi(e,t,n){const r=ls(n,t),s=B(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&Sn(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function Qi(e,t,n){const r=ls(n,t),s=B(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Sn(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const He={name:[[`
|
|
4
|
-
\f\r &/=>`.split(""),`
|
|
5
|
-
\f\r "&'/=>\``.split("")],[`\0
|
|
6
|
-
\f\r "&'/<=>`.split(""),`\0
|
|
7
|
-
\f\r "&'/<=>\``.split("")]],unquoted:[[`
|
|
8
|
-
\f\r &>`.split(""),`\0
|
|
9
|
-
\f\r "&'<=>\``.split("")],[`\0
|
|
10
|
-
\f\r "&'<=>\``.split(""),`\0
|
|
11
|
-
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Yi(e,t,n,r){const s=r.schema,o=s.space==="svg"?!1:r.settings.omitOptionalTags;let i=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const l=[];let a;s.space==="html"&&e.tagName==="svg"&&(r.schema=is);const c=Ji(r,e.properties),u=r.all(s.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=s,u&&(i=!1),(c||!o||!qi(e,t,n))&&(l.push("<",e.tagName,c?" "+c:""),i&&(s.space==="svg"||r.settings.closeSelfClosing)&&(a=c.charAt(c.length-1),(!r.settings.tightSelfClosing||a==="/"||a&&a!=='"'&&a!=="'")&&l.push(" "),l.push("/")),l.push(">")),l.push(u),!i&&(!o||!Sn(e,t,n))&&l.push("</"+e.tagName+">"),l.join("")}function Ji(e,t){const n=[];let r=-1,s;if(t){for(s in t)if(t[s]!==null&&t[s]!==void 0){const o=ea(e,s,t[s]);o&&n.push(o)}}for(;++r<n.length;){const o=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&o!=='"'&&o!=="'"&&(n[r]+=" ")}return n.join("")}function ea(e,t,n){const r=ri(e.schema,t),s=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,o=e.settings.allowDangerousCharacters?0:1;let i=e.quote,l;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const a=xe(r.attribute,Object.assign({},e.settings.characterReferences,{subset:He.name[s][o]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Ri:Li)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?a:(e.settings.preferUnquoted&&(l=xe(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:He.unquoted[s][o]}))),l!==n&&(e.settings.quoteSmart&&Vn(n,i)>Vn(n,e.alternative)&&(i=e.alternative),l=i+xe(n,Object.assign({},e.settings.characterReferences,{subset:(i==="'"?He.single:He.double)[s][o],attribute:!0}))+i),a+(l&&"="+l))}const ta=["<","&"];function fs(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:xe(e.value,Object.assign({},r.settings.characterReferences,{subset:ta}))}function na(e,t,n,r){return r.settings.allowDangerousHtml?e.value:fs(e,t,n,r)}function ra(e,t,n,r){return r.all(e)}const sa=ai("type",{invalid:oa,unknown:ia,handlers:{comment:Ii,doctype:Ai,element:Yi,raw:na,root:ra,text:fs}});function oa(e){throw new Error("Expected node, not `"+e+"`")}function ia(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const aa={},la={},ca=[];function ua(e,t){const n=t||aa,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:fa,all:ha,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Qo,characterReferences:n.characterReferences||la,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?is:ii,quote:r,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function fa(e,t,n){return sa(e,t,n,this)}function ha(e){const t=[],n=e&&e.children||ca;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}const Qn=/\s+/g;function hs(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(Qn)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(Qn);for(const r of n)r&&!e.properties.class.includes(r)&&e.properties.class.push(r);return e}function da(e){const t=mt(e,!0).map(([s])=>s);function n(s){if(s===e.length)return{line:t.length-1,character:t.at(-1).length};let o=s,i=0;for(const l of t){if(o<l.length)break;o-=l.length,i++}return{line:i,character:o}}function r(s,o){let i=0;for(let l=0;l<s;l++)i+=t[l].length;return i+=o,i}return{lines:t,indexToPos:n,posToIndex:r}}const pa=["color","background-color"];function ga(e,t){let n=0;const r=[];for(const s of t)s>n&&r.push({...e,content:e.content.slice(n,s),offset:e.offset+n}),n=s;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function ma(e,t){const n=[...t instanceof Set?t:new Set(t)].sort((r,s)=>r-s);return n.length?e.map(r=>r.flatMap(s=>{const o=n.filter(i=>s.offset<i&&i<s.offset+s.content.length).map(i=>i-s.offset).sort((i,l)=>i-l);return o.length?ga(s,o):s})):e}function ya(e,t,n,r,s="css-vars"){const o={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(u=>ct(e.variants[u])),l=new Set(i.flatMap(u=>Object.keys(u))),a={},c=(u,f)=>{const h=f==="color"?"":f==="background-color"?"-bg":`-${f}`;return n+t[u]+(f==="color"?"":h)};return i.forEach((u,f)=>{for(const h of l){const d=u[h]||"inherit";if(f===0&&r&&pa.includes(h))if(r==="light-dark()"&&i.length>1){const p=t.findIndex(w=>w==="light"),b=t.findIndex(w=>w==="dark");if(p===-1||b===-1)throw new T('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');a[h]=`light-dark(${i[p][h]||"inherit"}, ${i[b][h]||"inherit"})`,s==="css-vars"&&(a[c(f,h)]=d)}else a[h]=d;else s==="css-vars"&&(a[c(f,h)]=d)}}),o.htmlStyle=a,o}function ct(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&W.Italic&&(t["font-style"]="italic"),e.fontStyle&W.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&W.Underline&&n.push("underline"),e.fontStyle&W.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function an(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function ba(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let o=function(l){if(typeof l=="number"){if(l<0||l>n.source.length)throw new T(`Invalid decoration offset: ${l}. Code length: ${n.source.length}`);return{...s.indexToPos(l),offset:l}}else{const a=s.lines[l.line];if(a===void 0)throw new T(`Invalid decoration position ${JSON.stringify(l)}. Lines length: ${s.lines.length}`);let c=l.character;if(c<0&&(c=a.length+c),c<0||c>a.length)throw new T(`Invalid decoration position ${JSON.stringify(l)}. Line ${l.line} length: ${a.length}`);return{...l,character:c,offset:s.posToIndex(l.line,c)}}};var r=o;const s=da(n.source),i=(n.options.decorations||[]).map(l=>({...l,start:o(l.start),end:o(l.end)}));wa(i),e.set(n.meta,{decorations:i,converter:s,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(this.options.decorations?.length)return ma(n,t(this).decorations.flatMap(r=>[r.start.offset,r.end.offset]))},code(n){if(!this.options.decorations?.length)return;const r=t(this),s=[...n.children].filter(u=>u.type==="element"&&u.tagName==="span");if(s.length!==r.converter.lines.length)throw new T(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function o(u,f,h,d){const p=s[u];let b="",w=-1,g=-1;if(f===0&&(w=0),h===0&&(g=0),h===Number.POSITIVE_INFINITY&&(g=p.children.length),w===-1||g===-1)for(let y=0;y<p.children.length;y++)b+=ds(p.children[y]),w===-1&&b.length===f&&(w=y+1),g===-1&&b.length===h&&(g=y+1);if(w===-1)throw new T(`Failed to find start index for decoration ${JSON.stringify(d.start)}`);if(g===-1)throw new T(`Failed to find end index for decoration ${JSON.stringify(d.end)}`);const m=p.children.slice(w,g);if(!d.alwaysWrap&&m.length===p.children.length)l(p,d,"line");else if(!d.alwaysWrap&&m.length===1&&m[0].type==="element")l(m[0],d,"token");else{const y={type:"element",tagName:"span",properties:{},children:m};l(y,d,"wrapper"),p.children.splice(w,m.length,y)}}function i(u,f){s[u]=l(s[u],f,"line")}function l(u,f,h){const d=f.properties||{},p=f.transform||(b=>b);return u.tagName=f.tagName||"span",u.properties={...u.properties,...d,class:u.properties.class},f.properties?.class&&hs(u,f.properties.class),u=p(u,h)||u,u}const a=[],c=r.decorations.sort((u,f)=>f.start.offset-u.start.offset||u.end.offset-f.end.offset);for(const u of c){const{start:f,end:h}=u;if(f.line===h.line)o(f.line,f.character,h.character,u);else if(f.line<h.line){o(f.line,f.character,Number.POSITIVE_INFINITY,u);for(let d=f.line+1;d<h.line;d++)a.unshift(()=>i(d,u));o(h.line,0,h.character,u)}}a.forEach(u=>u())}}}function wa(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new T(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const s=e[r],o=n.start.offset<=s.start.offset&&s.start.offset<n.end.offset,i=n.start.offset<s.end.offset&&s.end.offset<=n.end.offset,l=s.start.offset<=n.start.offset&&n.start.offset<s.end.offset,a=s.start.offset<n.end.offset&&n.end.offset<=s.end.offset;if(o||i||l||a){if(o&&i||l&&a||l&&n.start.offset===n.end.offset||i&&s.start.offset===s.end.offset)continue;throw new T(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function ds(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(ds).join(""):""}const Ca=[ba()];function ut(e){const t=_a(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...Ca]}function _a(e){const t=[],n=[],r=[];for(const s of e)switch(s.enforce){case"pre":t.push(s);break;case"post":n.push(s);break;default:r.push(s)}return{pre:t,post:n,normal:r}}var pe=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],$t={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Sa(e,t){const n=e.indexOf("\x1B",t);if(n!==-1&&e[n+1]==="["){const r=e.indexOf("m",n);if(r!==-1)return{sequence:e.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:e.length}}function Yn(e){const t=e.shift();if(t==="2"){const n=e.splice(0,3).map(r=>Number.parseInt(r));return n.length!==3||n.some(r=>Number.isNaN(r))?void 0:{type:"rgb",rgb:n}}else if(t==="5"){const n=e.shift();if(n)return{type:"table",index:Number(n)}}}function ka(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)t.push({type:"resetAll"});else if(r<=9)$t[r]&&t.push({type:"setDecoration",value:$t[r]});else if(r<=29){const s=$t[r-20];s&&(t.push({type:"resetDecoration",value:s}),s==="dim"&&t.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:pe[r-30]}});else if(r===38){const s=Yn(e);s&&t.push({type:"setForegroundColor",value:s})}else if(r===39)t.push({type:"resetForegroundColor"});else if(r<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:pe[r-40]}});else if(r===48){const s=Yn(e);s&&t.push({type:"setBackgroundColor",value:s})}else r===49?t.push({type:"resetBackgroundColor"}):r===53?t.push({type:"setDecoration",value:"overline"}):r===55?t.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?t.push({type:"setForegroundColor",value:{type:"named",name:pe[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:pe[r-100+8]}})}return t}function va(){let e=null,t=null,n=new Set;return{parse(r){const s=[];let o=0;do{const i=Sa(r,o),l=i.sequence?r.substring(o,i.startPosition):r.substring(o);if(l.length>0&&s.push({value:l,foreground:e,background:t,decorations:new Set(n)}),i.sequence){const a=ka(i.sequence);for(const c of a)c.type==="resetAll"?(e=null,t=null,n.clear()):c.type==="resetForegroundColor"?e=null:c.type==="resetBackgroundColor"?t=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of a)c.type==="setForegroundColor"?e=c.value:c.type==="setBackgroundColor"?t=c.value:c.type==="setDecoration"&&n.add(c.value)}o=i.position}while(o<r.length);return s}}}var xa={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function Ea(e=xa){function t(l){return e[l]}function n(l){return`#${l.map(a=>Math.max(0,Math.min(a,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let c=0;c<pe.length;c++)r.push(t(pe[c]));let l=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let u=0;u<6;u++)for(let f=0;f<6;f++)r.push(n([l[c],l[u],l[f]]));let a=8;for(let c=0;c<24;c++,a+=10)r.push(n([a,a,a]));return r}function o(l){return s()[l]}function i(l){switch(l.type){case"named":return t(l.name);case"rgb":return n(l.rgb);case"table":return o(l.index)}}return{value:i}}const Ia=/#([0-9a-f]{3,8})/i,Aa=/var\((--[\w-]+-ansi-[\w-]+)\)/,Ra={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function La(e,t,n){const r=lt(e,n),s=mt(t),o=Ea(Object.fromEntries(pe.map(l=>{const a=`terminal.ansi${l[0].toUpperCase()}${l.substring(1)}`;return[l,e.colors?.[a]||Ra[l]]}))),i=va();return s.map(l=>i.parse(l[0]).map(a=>{let c,u;a.decorations.has("reverse")?(c=a.background?o.value(a.background):e.bg,u=a.foreground?o.value(a.foreground):e.fg):(c=a.foreground?o.value(a.foreground):e.fg,u=a.background?o.value(a.background):void 0),c=ue(c,r),u=ue(u,r),a.decorations.has("dim")&&(c=Na(c));let f=W.None;return a.decorations.has("bold")&&(f|=W.Bold),a.decorations.has("italic")&&(f|=W.Italic),a.decorations.has("underline")&&(f|=W.Underline),a.decorations.has("strikethrough")&&(f|=W.Strikethrough),{content:a.value,offset:l[1],color:c,bgColor:u,fontStyle:f}}))}function Na(e){const t=e.match(Ia);if(t){const r=t[1];if(r.length===8){const s=Math.round(Number.parseInt(r.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${r.slice(0,6)}${s}`}else{if(r.length===6)return`#${r}80`;if(r.length===4){const s=r[0],o=r[1],i=r[2],l=r[3];return`#${s}${s}${o}${o}${i}${i}${Math.round(Number.parseInt(`${l}${l}`,16)/2).toString(16).padStart(2,"0")}`}else if(r.length===3){const s=r[0],o=r[1],i=r[2];return`#${s}${s}${o}${o}${i}${i}80`}}}const n=e.match(Aa);return n?`var(${n[1]}-dim)`:e}function ln(e,t,n={}){const r=e.resolveLangAlias(n.lang||"text"),{theme:s=e.getLoadedThemes()[0]}=n;if(!pt(r)&&!gt(s)&&r==="ansi"){const{theme:o}=e.setTheme(s);return La(o,t,n)}return Qr(e,t,n)}function ft(e,t,n){let r,s,o,i,l,a;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-",colorsRendering:f="css-vars"}=n,h=Object.entries(n.themes).filter(g=>g[1]).map(g=>({color:g[0],theme:g[1]})).sort((g,m)=>g.color===c?-1:m.color===c?1:0);if(h.length===0)throw new T("`themes` option must not be empty");const d=Yr(e,t,n,ln);if(a=De(d),c&&c!=="light-dark()"&&!h.some(g=>g.color===c))throw new T(`\`themes\` option must contain the defaultColor key \`${c}\``);const p=h.map(g=>e.getTheme(g.theme)),b=h.map(g=>g.color);o=d.map(g=>g.map(m=>ya(m,b,u,c,f))),a&&yt(o,a);const w=h.map(g=>lt(g.theme,n));s=Jn(h,p,w,u,c,"fg",f),r=Jn(h,p,w,u,c,"bg",f),i=`shiki-themes ${p.map(g=>g.name).join(" ")}`,l=c?void 0:[s,r].join(";")}else if("theme"in n){const c=lt(n.theme,n);o=ln(e,t,n);const u=e.getTheme(n.theme);r=ue(u.bg,c),s=ue(u.fg,c),i=u.name,a=De(o)}else throw new T("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:s,bg:r,themeName:i,rootStyle:l,grammarState:a}}function Jn(e,t,n,r,s,o,i){return e.map((l,a)=>{const c=ue(t[a][o],n[a])||"inherit",u=`${r+l.color}${o==="bg"?"-bg":""}:${c}`;if(a===0&&s){if(s==="light-dark()"&&e.length>1){const f=e.findIndex(d=>d.color==="light"),h=e.findIndex(d=>d.color==="dark");if(f===-1||h===-1)throw new T('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${ue(t[f][o],n[f])||"inherit"}, ${ue(t[h][o],n[h])||"inherit"});${u}`}return c}return i==="css-vars"?u:null}).filter(l=>!!l).join(";")}const ps=/^\s+$/,Ta=/^(\s*)(.*?)(\s*)$/;function ht(e,t,n,r={meta:{},options:n,codeToHast:(s,o)=>ht(e,s,o),codeToTokens:(s,o)=>ft(e,s,o)}){let s=t;for(const p of ut(n))s=p.preprocess?.call(r,s,n)||s;let{tokens:o,fg:i,bg:l,themeName:a,rootStyle:c,grammarState:u}=ft(e,s,n);const{mergeWhitespaces:f=!0,mergeSameStyleTokens:h=!1}=n;f===!0?o=$a(o):f==="never"&&(o=Ma(o)),h&&(o=Oa(o));const d={...r,get source(){return s}};for(const p of ut(n))o=p.tokens?.call(d,o)||o;return Pa(o,{...n,fg:i,bg:l,themeName:a,rootStyle:n.rootStyle===!1?!1:n.rootStyle??c},d,u)}function Pa(e,t,n,r=De(e)){const s=ut(t),o=[],i={type:"root",children:[]},{structure:l="classic",tabindex:a="0"}=t,c={class:`shiki ${t.themeName||""}`};t.rootStyle!==!1&&(t.rootStyle!=null?c.style=t.rootStyle:c.style=`background-color:${t.bg};color:${t.fg}`),a!==!1&&a!=null&&(c.tabindex=a.toString());for(const[b,w]of Object.entries(t.meta||{}))b.startsWith("_")||(c[b]=w);let u={type:"element",tagName:"pre",properties:c,children:[],data:t.data},f={type:"element",tagName:"code",properties:{},children:o};const h=[],d={...n,structure:l,addClassToHast:hs,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return i},get pre(){return u},get code(){return f},get lines(){return h}};if(e.forEach((b,w)=>{w&&(l==="inline"?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):l==="classic"&&o.push({type:"text",value:`
|
|
12
|
-
`}));let g={type:"element",tagName:"span",properties:{class:"line"},children:[]},m=0;for(const y of b){let _={type:"element",tagName:"span",properties:{...y.htmlAttrs},children:[{type:"text",value:y.content}]};const S=an(y.htmlStyle||ct(y));S&&(_.properties.style=S);for(const v of s)_=v?.span?.call(d,_,w+1,m,g,y)||_;l==="inline"?i.children.push(_):l==="classic"&&g.children.push(_),m+=y.content.length}if(l==="classic"){for(const y of s)g=y?.line?.call(d,g,w+1)||g;h.push(g),o.push(g)}else l==="inline"&&h.push(g)}),l==="classic"){for(const b of s)f=b?.code?.call(d,f)||f;u.children.push(f);for(const b of s)u=b?.pre?.call(d,u)||u;i.children.push(u)}else if(l==="inline"){const b=[];let w={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const m of i.children)m.type==="element"&&m.tagName==="br"?(b.push(w),w={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(m.type==="element"||m.type==="text")&&w.children.push(m);b.push(w);let g={type:"element",tagName:"code",properties:{},children:b};for(const m of s)g=m?.code?.call(d,g)||g;i.children=[];for(let m=0;m<g.children.length;m++){m>0&&i.children.push({type:"element",tagName:"br",properties:{},children:[]});const y=g.children[m];y.type==="element"&&i.children.push(...y.children)}}let p=i;for(const b of s)p=b?.root?.call(d,p)||p;return r&&yt(p,r),p}function $a(e){return e.map(t=>{const n=[];let r="",s;return t.forEach((o,i)=>{const l=!(o.fontStyle&&(o.fontStyle&W.Underline||o.fontStyle&W.Strikethrough));l&&ps.test(o.content)&&t[i+1]?(s===void 0&&(s=o.offset),r+=o.content):r?(l?n.push({...o,offset:s,content:r+o.content}):n.push({content:r,offset:s},o),s=void 0,r=""):n.push(o)}),n})}function Ma(e){return e.map(t=>t.flatMap(n=>{if(ps.test(n.content))return n;const r=n.content.match(Ta);if(!r)return n;const[,s,o,i]=r;if(!s&&!i)return n;const l=[{...n,offset:n.offset+s.length,content:o}];return s&&l.unshift({content:s,offset:n.offset}),i&&l.push({content:i,offset:n.offset+s.length+o.length}),l}))}function Oa(e){return e.map(t=>{const n=[];for(const r of t){if(n.length===0){n.push({...r});continue}const s=n.at(-1),o=an(s.htmlStyle||ct(s)),i=an(r.htmlStyle||ct(r)),l=s.fontStyle&&(s.fontStyle&W.Underline||s.fontStyle&W.Strikethrough),a=r.fontStyle&&(r.fontStyle&W.Underline||r.fontStyle&W.Strikethrough);!l&&!a&&o===i?s.content+=r.content:n.push({...r})}return n})}const Da=ua;function Ba(e,t,n){const r={meta:{},options:n,codeToHast:(o,i)=>ht(e,o,i),codeToTokens:(o,i)=>ft(e,o,i)};let s=Da(ht(e,t,n,r));for(const o of ut(n))s=o.postprocess?.call(r,s,n)||s;return s}async function Ga(e){const t=await Go(e);return{getLastGrammarState:(...n)=>zo(t,...n),codeToTokensBase:(n,r)=>ln(t,n,r),codeToTokensWithThemes:(n,r)=>Yr(t,n,r),codeToTokens:(n,r)=>ft(t,n,r),codeToHast:(n,r)=>ht(t,n,r),codeToHtml:(n,r)=>Ba(t,n,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}const er=4294967295;var Fa=class{patterns;options;regexps;constructor(e,t={}){this.patterns=e,this.options=t;const{forgiving:n=!1,cache:r,regexConstructor:s}=t;if(!s)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(o=>{if(typeof o!="string")return o;const i=r?.get(o);if(i){if(i instanceof RegExp)return i;if(n)return null;throw i}try{const l=s(o);return r?.set(o,l),l}catch(l){if(r?.set(o,l),n)return null;throw l}})}findNextMatchSync(e,t,n){const r=typeof e=="string"?e:e.content,s=[];function o(i,l,a=0){return{index:i,captureIndices:l.indices.map(c=>c==null?{start:er,end:er,length:0}:{start:c[0]+a,end:c[1]+a,length:c[1]-c[0]})}}for(let i=0;i<this.regexps.length;i++){const l=this.regexps[i];if(l)try{l.lastIndex=t;const a=l.exec(r);if(!a)continue;if(a.index===t)return o(i,a,0);s.push([i,a,0])}catch(a){if(this.options.forgiving)continue;throw a}}if(s.length){const i=Math.min(...s.map(l=>l[1].index));for(const[l,a,c]of s)if(a.index===i)return o(l,a,c)}return null}};function Ie(e){if([...e].length!==1)throw new Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function Ua(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}const kn=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),U=String.raw;function Ae(e,t){if(e==null)throw new Error(t??"Value expected");return e}const gs=U`\[\^?`,ms=`c.? | C(?:-.?)?|${U`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${U`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${U`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${U`o\{[^\}]*\}?`}|${U`\d{1,3}`}`,vn=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,qe=new RegExp(U`
|
|
13
|
-
\\ (?:
|
|
14
|
-
${ms}
|
|
15
|
-
| [gk]<[^>]*>?
|
|
16
|
-
| [gk]'[^']*'?
|
|
17
|
-
| .
|
|
18
|
-
)
|
|
19
|
-
| \( (?:
|
|
20
|
-
\? (?:
|
|
21
|
-
[:=!>({]
|
|
22
|
-
| <[=!]
|
|
23
|
-
| <[^>]*>
|
|
24
|
-
| '[^']*'
|
|
25
|
-
| ~\|?
|
|
26
|
-
| #(?:[^)\\]|\\.?)*
|
|
27
|
-
| [^:)]*[:)]
|
|
28
|
-
)?
|
|
29
|
-
| \*[^\)]*\)?
|
|
30
|
-
)?
|
|
31
|
-
| (?:${vn.source})+
|
|
32
|
-
| ${gs}
|
|
33
|
-
| .
|
|
34
|
-
`.replace(/\s+/g,""),"gsu"),Mt=new RegExp(U`
|
|
35
|
-
\\ (?:
|
|
36
|
-
${ms}
|
|
37
|
-
| .
|
|
38
|
-
)
|
|
39
|
-
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
40
|
-
| ${gs}
|
|
41
|
-
| &&
|
|
42
|
-
| .
|
|
43
|
-
`.replace(/\s+/g,""),"gsu");function ja(e,t={}){const n={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!="string")throw new Error("String expected as pattern");const r=al(n.flags),s=[r.extended],o={captureGroup:n.rules.captureGroup,getCurrentModX(){return s.at(-1)},numOpenGroups:0,popModX(){s.pop()},pushModX(f){s.push(f)},replaceCurrentModX(f){s[s.length-1]=f},singleline:n.rules.singleline};let i=[],l;for(qe.lastIndex=0;l=qe.exec(e);){const f=Wa(o,e,l[0],qe.lastIndex);f.tokens?i.push(...f.tokens):f.token&&i.push(f.token),f.lastIndex!==void 0&&(qe.lastIndex=f.lastIndex)}const a=[];let c=0;i.filter(f=>f.type==="GroupOpen").forEach(f=>{f.kind==="capturing"?f.number=++c:f.raw==="("&&a.push(f)}),c||a.forEach((f,h)=>{f.kind="capturing",f.number=h+1});const u=c||a.length;return{tokens:i.map(f=>f.type==="EscapedNumber"?cl(f,u):f).flat(),flags:r}}function Wa(e,t,n,r){const[s,o]=n;if(n==="["||n==="[^"){const i=za(t,n,r);return{tokens:i.tokens,lastIndex:i.lastIndex}}if(s==="\\"){if("AbBGyYzZ".includes(o))return{token:tr(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:el(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:bs(n)}}if(o==="K")return{token:ws("keep",n)};if(o==="N"||o==="R")return{token:ge("newline",n,{negate:o==="N"})};if(o==="O")return{token:ge("any",n)};if(o==="X")return{token:ge("text_segment",n)};const i=ys(n,{inCharClass:!1});return Array.isArray(i)?{tokens:i}:{token:i}}if(s==="("){if(o==="*")return{token:sl(n)};if(n==="(?{")throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(t[r]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:rl(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n==="("&&!e.captureGroup||n==="(?:")return{token:ke("group",n)};if(n==="(?>")return{token:ke("atomic",n)};if(n==="(?="||n==="(?!"||n==="(?<="||n==="(?<!")return{token:ke(n[2]==="<"?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if(n==="("&&e.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:ke("capturing",n,{...n!=="("&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if(n==="(?~|")throw new Error(`Unsupported absence function kind "${n}"`);return{token:ke("absence_repeater",n)}}throw n==="(?("?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(n===")"){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:Qa(n)}}if(e.getCurrentModX()){if(n==="#"){const i=t.indexOf(`
|
|
44
|
-
`,r);return{lastIndex:i===-1?t.length:i}}if(/^\s$/.test(n)){const i=/\s+/y;return i.lastIndex=r,{lastIndex:i.exec(t)?i.lastIndex:r}}}if(n===".")return{token:ge("dot",n)};if(n==="^"||n==="$"){const i=e.singleline?{"^":U`\A`,$:U`\Z`}[n]:n;return{token:tr(i,n)}}return n==="|"?{token:qa(n)}:vn.test(n)?{tokens:ul(n)}:{token:oe(Ie(n),n)}}function za(e,t,n){const r=[nr(t[1]==="^",t)];let s=1,o;for(Mt.lastIndex=n;o=Mt.exec(e);){const i=o[0];if(i[0]==="["&&i[1]!==":")s++,r.push(nr(i[1]==="^",i));else if(i==="]"){if(r.at(-1).type==="CharacterClassOpen")r.push(oe(93,i));else if(s--,r.push(Va(i)),!s)break}else{const l=Ha(i);Array.isArray(l)?r.push(...l):r.push(l)}}return{tokens:r,lastIndex:Mt.lastIndex||e.length}}function Ha(e){if(e[0]==="\\")return ys(e,{inCharClass:!0});if(e[0]==="["){const t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!kn.has(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return ge("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return e==="-"?Xa(e):e==="&&"?Ka(e):oe(Ie(e),e)}function ys(e,{inCharClass:t}){const n=e[1];if(n==="c"||n==="C")return nl(e);if("dDhHsSwW".includes(n))return ol(e);if(e.startsWith(U`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw new Error(`Incomplete or invalid Unicode property "${e}"`);return il(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{const r=e.split(/\\x/).slice(1).map(i=>parseInt(i,16)),s=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(r)),o=new TextEncoder;return[...s].map(i=>{const l=[...o.encode(i)].map(a=>`\\x${a.toString(16)}`).join("");return oe(Ie(i),l)})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n==="u"||n==="x")return oe(ll(e),e);if(rr.has(n))return oe(rr.get(n),e);if(/\d/.test(n))return Za(t,e);if(e==="\\")throw new Error(U`Incomplete escape "\"`);if(n==="M")throw new Error(`Unsupported meta "${e}"`);if([...e].length===2)return oe(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function qa(e){return{type:"Alternator",raw:e}}function tr(e,t){return{type:"Assertion",kind:e,raw:t}}function bs(e){return{type:"Backreference",raw:e}}function oe(e,t){return{type:"Character",value:e,raw:t}}function Va(e){return{type:"CharacterClassClose",raw:e}}function Xa(e){return{type:"CharacterClassHyphen",raw:e}}function Ka(e){return{type:"CharacterClassIntersector",raw:e}}function nr(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function ge(e,t,n={}){return{type:"CharacterSet",kind:e,...n,raw:t}}function ws(e,t,n={}){return e==="keep"?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:Ae(n.flags),raw:t}}function Za(e,t){return{type:"EscapedNumber",inCharClass:e,raw:t}}function Qa(e){return{type:"GroupClose",raw:e}}function ke(e,t,n={}){return{type:"GroupOpen",kind:e,...n,raw:t}}function Ya(e,t,n,r){return{type:"NamedCallout",kind:e,tag:t,arguments:n,raw:r}}function Ja(e,t,n,r){return{type:"Quantifier",kind:e,min:t,max:n,raw:r}}function el(e){return{type:"Subroutine",raw:e}}const tl=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),rr=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function nl(e){const t=e[1]==="c"?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw new Error(`Unsupported control character "${e}"`);return oe(Ie(t.toUpperCase())-64,e)}function rl(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??="";const s=(t.getCurrentModX()||n.includes("x"))&&!r.includes("x"),o=or(n),i=or(r),l={};if(o&&(l.enable=o),i&&(l.disable=i),e.endsWith(")"))return t.replaceCurrentModX(s),ws("flags",e,{flags:l});if(e.endsWith(":"))return t.pushModX(s),t.numOpenGroups++,ke("group",e,{...(o||i)&&{flags:l}});throw new Error(`Unexpected flag modifier "${e}"`)}function sl(e){const t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw new Error(`Incomplete or invalid named callout "${e}"`);const{name:n,tag:r,args:s}=t.groups;if(!n)throw new Error(`Invalid named callout "${e}"`);if(r==="")throw new Error(`Named callout tag with empty value not allowed "${e}"`);const o=s?s.split(",").filter(u=>u!=="").map(u=>/^[+-]?\d+$/.test(u)?+u:u):[],[i,l,a]=o,c=tl.has(n)?n.toLowerCase():"custom";switch(c){case"fail":case"mismatch":case"skip":if(o.length>0)throw new Error(`Named callout arguments not allowed "${o}"`);break;case"error":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(typeof i=="string")throw new Error(`Named callout argument must be a number "${i}"`);break;case"max":if(!o.length||o.length>2)throw new Error(`Named callout must have one or two arguments "${o}"`);if(typeof i=="string"&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if(o.length===2&&(typeof l=="number"||!/^[<>X]$/.test(l)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${l}"`);break;case"count":case"total_count":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(o.length===1&&(typeof i=="number"||!/^[<>X]$/.test(i)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${i}"`);break;case"cmp":if(o.length!==3)throw new Error(`Named callout must have three arguments "${o}"`);if(typeof i=="string"&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if(typeof l=="number"||!/^(?:[<>!=]=|[<>])$/.test(l))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${l}"`);if(typeof a=="string"&&!/^[A-Za-z_]\w*$/.test(a))throw new Error(`Named callout argument three must be a tag or number "${a}"`);break;case"custom":throw new Error(`Undefined callout name "${n}"`);default:throw new Error(`Unexpected named callout kind "${c}"`)}return Ya(c,r??null,s?.split(",")??null,e)}function sr(e){let t=null,n,r;if(e[0]==="{"){const{minStr:s,maxStr:o}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,i=1e5;if(+s>i||o&&+o>i)throw new Error("Quantifier value unsupported in Oniguruma");if(n=+s,r=o===void 0?+s:o===""?1/0:+o,n>r&&(t="possessive",[n,r]=[r,n]),e.endsWith("?")){if(t==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');t="lazy"}else t||(t="greedy")}else n=e[0]==="+"?1:0,r=e[0]==="?"?1:1/0,t=e[1]==="+"?"possessive":e[1]==="?"?"lazy":"greedy";return Ja(t,n,r,e)}function ol(e){const t=e[1].toLowerCase();return ge({d:"digit",h:"hex",s:"space",w:"word"}[t],e,{negate:e[1]!==t})}function il(e){const{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return ge("property",e,{value:r,negate:t==="P"&&!n||t==="p"&&!!n})}function or(e){const t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function al(e){const t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){const r=e[n];if(!"imxDPSWy".includes(r))throw new Error(`Invalid flag "${r}"`);if(r==="y"){if(!/^y{[gw]}/.test(e.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');t.textSegmentMode=e[n+2]==="g"?"grapheme":"word",n+=3;continue}t[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[r]]=!0}return t}function ll(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw new Error(`Incomplete or invalid escape "${e}"`);const t=e[2]==="{"?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function cl(e,t){const{raw:n,inCharClass:r}=e,s=n.slice(1);if(!r&&(s!=="0"&&s.length===1||s[0]!=="0"&&+s<=t))return[bs(n)];const o=[],i=s.match(/^[0-7]+|\d/g);for(let l=0;l<i.length;l++){const a=i[l];let c;if(l===0&&a!=="8"&&a!=="9"){if(c=parseInt(a,8),c>127)throw new Error(U`Octal encoded byte above 177 unsupported "${n}"`)}else c=Ie(a);o.push(oe(c,(l===0?"\\":"")+a))}return o}function ul(e){const t=[],n=new RegExp(vn,"gy");let r;for(;r=n.exec(e);){const s=r[0];if(s[0]==="{"){const o=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(s);if(o){const{min:i,max:l}=o.groups;if(+i>+l&&s.endsWith("?")){n.lastIndex--,t.push(sr(s.slice(0,-1)));continue}}}t.push(sr(s))}return t}function Cs(e,t){if(!Array.isArray(e.body))throw new Error("Expected node with body array");if(e.body.length!==1)return!1;const n=e.body[0];return!t||Object.keys(t).every(r=>t[r]===n[r])}function fl(e){return hl.has(e.type)}const hl=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function _s(e,t={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=ja(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),s=(h,d)=>{const p=r.tokens[o.nextIndex];switch(o.parent=h,o.nextIndex++,p.type){case"Alternator":return we();case"Assertion":return dl(p);case"Backreference":return pl(p,o);case"Character":return wt(p.value,{useLastValid:!!d.isCheckingRangeEnd});case"CharacterClassHyphen":return gl(p,o,d);case"CharacterClassOpen":return ml(p,o,d);case"CharacterSet":return yl(p,o);case"Directive":return kl(p.kind,{flags:p.flags});case"GroupOpen":return bl(p,o,d);case"NamedCallout":return xl(p.kind,p.tag,p.arguments);case"Quantifier":return wl(p,o);case"Subroutine":return Cl(p,o);default:throw new Error(`Unexpected token type "${p.type}"`)}},o={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:s},i=Il(vl(r.flags));let l=i.body[0];for(;o.nextIndex<r.tokens.length;){const h=s(l,{});h.type==="Alternative"?(i.body.push(h),l=h):l.body.push(h)}const{capturingGroups:a,hasNumberedRef:c,namedGroupsByName:u,subroutines:f}=o;if(c&&u.size&&!n.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:h}of f)if(typeof h=="number"){if(h>a.length)throw new Error("Subroutine uses a group number that's not defined");h&&(a[h-1].isSubroutined=!0)}else if(u.has(h)){if(u.get(h).length>1)throw new Error(U`Subroutine uses a duplicate group name "\g<${h}>"`);u.get(h)[0].isSubroutined=!0}else throw new Error(U`Subroutine uses a group name that's not defined "\g<${h}>"`);return i}function dl({kind:e}){return cn(Ae({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[e],`Unexpected assertion kind "${e}"`),{negate:e===U`\B`||e===U`\Y`})}function pl({raw:e},t){const n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),s=(o,i=!1)=>{const l=t.capturingGroups.length;let a=!1;if(o>l)if(t.skipBackrefValidation)a=!0;else throw new Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,un(i?l+1-o:o,{orphan:a})};if(n){const o=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(o)return s(+o.groups.num,!!o.groups.sign);if(/[-+]/.test(r))throw new Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw new Error(`Group name not defined to the left "${e}"`);return un(r)}return s(+r)}function gl(e,t,n){const{tokens:r,walk:s}=t,o=t.parent,i=o.body.at(-1),l=r[t.nextIndex];if(!n.isCheckingRangeEnd&&i&&i.type!=="CharacterClass"&&i.type!=="CharacterClassRange"&&l&&l.type!=="CharacterClassOpen"&&l.type!=="CharacterClassClose"&&l.type!=="CharacterClassIntersector"){const a=s(o,{...n,isCheckingRangeEnd:!0});if(i.type==="Character"&&a.type==="Character")return o.body.pop(),Sl(i,a);throw new Error("Invalid character class range")}return wt(Ie("-"))}function ml({negate:e},t,n){const{tokens:r,walk:s}=t,o=[tt()],i=r[t.nextIndex];let l=lr(i);for(;l.type!=="CharacterClassClose";){if(l.type==="CharacterClassIntersector")o.push(tt()),t.nextIndex++;else{const c=o.at(-1);c.body.push(s(c,n))}l=lr(r[t.nextIndex],i)}const a=tt({negate:e});return o.length===1?a.body=o[0].body:(a.kind="intersection",a.body=o.map(c=>c.body.length===1?c.body[0]:c)),t.nextIndex++,a}function yl({kind:e,negate:t,value:n},r){const{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i}=r;if(e==="property"){const l=Ct(n);if(kn.has(l)&&!i?.has(l))e="posix",n=l;else return ve(n,{negate:t,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i})}return e==="posix"?El(n,{negate:t}):fn(e,{negate:t})}function bl(e,t,n){const{tokens:r,capturingGroups:s,namedGroupsByName:o,skipLookbehindValidation:i,walk:l}=t,a=Al(e),c=a.type==="AbsenceFunction",u=ar(a),f=u&&a.negate;if(a.type==="CapturingGroup"&&(s.push(a),a.name&&Ua(o,a.name,[]).push(a)),c&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let h=cr(r[t.nextIndex]);for(;h.type!=="GroupClose";){if(h.type==="Alternator")a.body.push(we()),t.nextIndex++;else{const d=a.body.at(-1),p=l(d,{...n,isInAbsenceFunction:n.isInAbsenceFunction||c,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||f});if(d.body.push(p),(u||n.isInLookbehind)&&!i){const b="Lookbehind includes a pattern not allowed by Oniguruma";if(f||n.isInNegLookbehind){if(ir(p)||p.type==="CapturingGroup")throw new Error(b)}else if(ir(p)||ar(p)&&p.negate)throw new Error(b)}}h=cr(r[t.nextIndex])}return t.nextIndex++,a}function wl({kind:e,min:t,max:n},r){const s=r.parent,o=s.body.at(-1);if(!o||!fl(o))throw new Error("Quantifier requires a repeatable token");const i=ks(e,t,n,o);return s.body.pop(),i}function Cl({raw:e},t){const{capturingGroups:n,subroutines:r}=t;let s=e.slice(3,-1);const o=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);if(o){const l=+o.groups.num,a=n.length;if(t.hasNumberedRef=!0,s={"":l,"+":a+l,"-":a+1-l}[o.groups.sign],s<1)throw new Error("Invalid subroutine number")}else s==="0"&&(s=0);const i=vs(s);return r.push(i),i}function _l(e,t){return{type:"AbsenceFunction",kind:e,body:je(t?.body)}}function we(e){return{type:"Alternative",body:xs(e?.body)}}function cn(e,t){const n={type:"Assertion",kind:e};return(e==="word_boundary"||e==="text_segment_boundary")&&(n.negate=!!t?.negate),n}function un(e,t){const n=!!t?.orphan;return{type:"Backreference",ref:e,...n&&{orphan:n}}}function Ss(e,t){const n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!Rl(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:je(t?.body)}}function wt(e,t){const n={useLastValid:!1,...t};if(e>1114111){const r=e.toString(16);if(n.useLastValid)e=1114111;else throw e>1310719?new Error(`Invalid code point out of range "\\x{${r}}"`):new Error(`Invalid code point out of range in JS "\\x{${r}}"`)}return{type:"Character",value:e}}function tt(e){const t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:xs(e?.body)}}function Sl(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}function fn(e,t){const n=!!t?.negate,r={type:"CharacterSet",kind:e};return(e==="digit"||e==="hex"||e==="newline"||e==="space"||e==="word")&&(r.negate=n),(e==="text_segment"||e==="newline"&&!n)&&(r.variableLength=!0),r}function kl(e,t={}){if(e==="keep")return{type:"Directive",kind:e};if(e==="flags")return{type:"Directive",kind:e,flags:Ae(t.flags)};throw new Error(`Unexpected directive kind "${e}"`)}function vl(e){return{type:"Flags",...e}}function Y(e){const t=e?.atomic,n=e?.flags;if(t&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...n&&{flags:n},body:je(e?.body)}}function de(e){const t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:je(e?.body)}}function xl(e,t,n){return{type:"NamedCallout",kind:e,tag:t,arguments:n}}function El(e,t){const n=!!t?.negate;if(!kn.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:n}}function ks(e,t,n,r){if(t>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:n,body:r}}function Il(e,t){return{type:"Regex",body:je(t?.body),flags:e}}function vs(e){return{type:"Subroutine",ref:e}}function ve(e,t){const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t};let r=n.unicodePropertyMap?.get(Ct(e));if(!r){if(n.normalizeUnknownPropertyNames)r=Ll(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(U`Invalid Unicode property "\p{${e}}"`)}return{type:"CharacterSet",kind:"property",value:r??e,negate:n.negate}}function Al({flags:e,kind:t,name:n,negate:r,number:s}){switch(t){case"absence_repeater":return _l("repeater");case"atomic":return Y({atomic:!0});case"capturing":return Ss(s,{name:n});case"group":return Y({flags:e});case"lookahead":case"lookbehind":return de({behind:t==="lookbehind",negate:r});default:throw new Error(`Unexpected group kind "${t}"`)}}function je(e){if(e===void 0)e=[we()];else if(!Array.isArray(e)||!e.length||!e.every(t=>t.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return e}function xs(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(t=>!!t.type))throw new Error("Invalid body; expected array of nodes");return e}function ir(e){return e.type==="LookaroundAssertion"&&e.kind==="lookahead"}function ar(e){return e.type==="LookaroundAssertion"&&e.kind==="lookbehind"}function Rl(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function Ll(e){return e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,t=>t[0].toUpperCase()+t.slice(1).toLowerCase())}function Ct(e){return e.replace(/[- _]+/g,"").toLowerCase()}function lr(e,t){const n=t;return Ae(e,`Unclosed character class${n?.type==="Character"&&n.value===93&&n.raw==="]"?' (started with "]")':""}`)}function cr(e){return Ae(e,"Unclosed group")}function Pe(e,t,n=null){function r(o,i){for(let l=0;l<o.length;l++){const a=s(o[l],i,l,o);l=Math.max(-1,l+a)}}function s(o,i=null,l=null,a=null){let c=0,u=!1;const f={node:o,parent:i,key:l,container:a,root:e,remove(){Ve(a).splice(Math.max(0,_e(l)+c),1),c--,u=!0},removeAllNextSiblings(){return Ve(a).splice(_e(l)+1)},removeAllPrevSiblings(){const g=_e(l)+c;return c-=g,Ve(a).splice(0,Math.max(0,g))},replaceWith(g,m={}){const y=!!m.traverse;a?a[Math.max(0,_e(l)+c)]=g:Ae(i,"Can't replace root node")[l]=g,y&&s(g,i,l,a),u=!0},replaceWithMultiple(g,m={}){const y=!!m.traverse;if(Ve(a).splice(Math.max(0,_e(l)+c),1,...g),c+=g.length-1,y){let _=0;for(let S=0;S<g.length;S++)_+=s(g[S],i,_e(l)+S+_,a)}u=!0},skip(){u=!0}},{type:h}=o,d=t["*"],p=t[h],b=typeof d=="function"?d:d?.enter,w=typeof p=="function"?p:p?.enter;if(b?.(f,n),w?.(f,n),!u)switch(h){case"AbsenceFunction":case"Alternative":case"CapturingGroup":case"CharacterClass":case"Group":case"LookaroundAssertion":r(o.body,o);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":s(o.min,o,"min"),s(o.max,o,"max");break;case"Quantifier":s(o.body,o,"body");break;case"Regex":r(o.body,o),s(o.flags,o,"flags");break;default:throw new Error(`Unexpected node type "${h}"`)}return p?.exit?.(f,n),d?.exit?.(f,n),c}return s(e),e}function Ve(e){if(!Array.isArray(e))throw new Error("Container expected");return e}function _e(e){if(typeof e!="number")throw new Error("Numeric key expected");return e}const Nl=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Tl(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Pl(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}const Q=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function xn(e,t,n,r){const s=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1];let i=0,l="";for(const a of e.matchAll(s)){const{0:c,groups:{$skip:u}}=a;if(!u&&(!r||r===Q.DEFAULT==!i)){n instanceof Function?l+=n(a,{context:i?Q.CHAR_CLASS:Q.DEFAULT,negated:o[o.length-1]}):l+=n;continue}c[0]==="["?(i++,o.push(c[1]==="^")):c==="]"&&i&&(i--,o.pop()),l+=c}return l}function Es(e,t,n,r){xn(e,t,n,r)}function $l(e,t,n=0,r){if(!new RegExp(t,"su").test(e))return null;const s=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=n;let o=0,i;for(;i=s.exec(e);){const{0:l,groups:{$skip:a}}=i;if(!a&&(!r||r===Q.DEFAULT==!o))return i;l==="["?o++:l==="]"&&o&&o--,s.lastIndex==i.index&&s.lastIndex++}return null}function Xe(e,t,n){return!!$l(e,t,0,n)}function Ml(e,t){const n=/\\?./gsu;n.lastIndex=t;let r=e.length,s=0,o=1,i;for(;i=n.exec(e);){const[l]=i;if(l==="[")s++;else if(s)l==="]"&&s--;else if(l==="(")o++;else if(l===")"&&(o--,!o)){r=i.index;break}}return e.slice(t,r)}const ur=new RegExp(String.raw`(?<noncapturingStart>${Nl})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function Ol(e,t){const n=t?.hiddenCaptures??[];let r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};const s="(?>",o="(?:(?=(",i=[0],l=[];let a=0,c=0,u=NaN,f;do{f=!1;let h=0,d=0,p=!1,b;for(ur.lastIndex=Number.isNaN(u)?0:u+o.length;b=ur.exec(e);){const{0:w,index:g,groups:{capturingStart:m,noncapturingStart:y}}=b;if(w==="[")h++;else if(h)w==="]"&&h--;else if(w===s&&!p)u=g,p=!0;else if(p&&y)d++;else if(m)p?d++:(a++,i.push(a+c));else if(w===")"&&p){if(!d){c++;const _=a+c;if(e=`${e.slice(0,u)}${o}${e.slice(u+s.length,g)}))<$$${_}>)${e.slice(g+1)}`,f=!0,l.push(_),Tl(n,_),r.size){const S=new Map;r.forEach((v,x)=>{S.set(x>=_?x+1:x,v.map(k=>k>=_?k+1:k))}),r=S}break}d--}}}while(f);return n.push(...l),e=xn(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:h,groups:{backrefNum:d,wrappedBackrefNum:p}})=>{if(d){const b=+d;if(b>i.length-1)throw new Error(`Backref "${h}" greater than number of captures`);return`\\${i[b]}`}return`\\${p}`},Q.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}const Is=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Ot=new RegExp(String.raw`
|
|
45
|
-
\\(?: \d+
|
|
46
|
-
| c[A-Za-z]
|
|
47
|
-
| [gk]<[^>]+>
|
|
48
|
-
| [pPu]\{[^\}]+\}
|
|
49
|
-
| u[A-Fa-f\d]{4}
|
|
50
|
-
| x[A-Fa-f\d]{2}
|
|
51
|
-
)
|
|
52
|
-
| \((?: \? (?: [:=!>]
|
|
53
|
-
| <(?:[=!]|[^>]+>)
|
|
54
|
-
| [A-Za-z\-]+:
|
|
55
|
-
| \(DEFINE\)
|
|
56
|
-
))?
|
|
57
|
-
| (?<qBase>${Is})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
58
|
-
| \\?.
|
|
59
|
-
`.replace(/\s+/g,""),"gsu");function Dl(e){if(!new RegExp(`${Is}\\+`).test(e))return{pattern:e};const t=[];let n=null,r=null,s="",o=0,i;for(Ot.lastIndex=0;i=Ot.exec(e);){const{0:l,index:a,groups:{qBase:c,qMod:u,invalidQ:f}}=i;if(l==="[")o||(r=a),o++;else if(l==="]")o?o--:r=null;else if(!o)if(u==="+"&&s&&!s.startsWith("(")){if(f)throw new Error(`Invalid quantifier "${l}"`);let h=-1;if(/^\{\d+\}$/.test(c))e=Pl(e,a+c.length,u,"");else{if(s===")"||s==="]"){const d=s===")"?n:r;if(d===null)throw new Error(`Invalid unmatched "${s}"`);e=`${e.slice(0,d)}(?>${e.slice(d,a)}${c})${e.slice(a+l.length)}`}else e=`${e.slice(0,a-s.length)}(?>${s}${c})${e.slice(a+l.length)}`;h+=4}Ot.lastIndex+=h}else l[0]==="("?t.push(a):l===")"&&(n=t.length?t.pop():null);s=l}return{pattern:e}}const Z=String.raw,Bl=Z`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,hn=Z`\(\?R=(?<rDepth>[^\)]+)\)|${Bl}`,_t=Z`\(\?<(?![=!])(?<captureName>[^>]+)>`,As=Z`${_t}|(?<unnamed>\()(?!\?)`,fe=new RegExp(Z`${_t}|${hn}|\(\?|\\?.`,"gsu"),Dt="Cannot use multiple overlapping recursions";function Gl(e,t){const{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:"plugin",...t};let s=t?.captureTransfers??new Map;if(!new RegExp(hn,"su").test(e))return{pattern:e,captureTransfers:s,hiddenCaptures:n};if(r==="plugin"&&Xe(e,Z`\(\?\(DEFINE\)`,Q.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const o=[],i=Xe(e,Z`\\[1-9]`,Q.DEFAULT),l=new Map,a=[];let c=!1,u=0,f=0,h;for(fe.lastIndex=0;h=fe.exec(e);){const{0:d,groups:{captureName:p,rDepth:b,gRNameOrNum:w,gRDepth:g}}=h;if(d==="[")u++;else if(u)d==="]"&&u--;else if(b){if(fr(b),c)throw new Error(Dt);if(i)throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);const m=e.slice(0,h.index),y=e.slice(fe.lastIndex);if(Xe(y,hn,Q.DEFAULT))throw new Error(Dt);const _=+b-1;e=hr(m,y,_,!1,n,o,f),s=pr(s,m,_,o.length,0,f);break}else if(w){fr(g);let m=!1;for(const R of a)if(R.name===w||R.num===+w){if(m=!0,R.hasRecursedWithin)throw new Error(Dt);break}if(!m)throw new Error(Z`Recursive \g cannot be used outside the referenced group "${r==="external"?w:Z`\g<${w}&R=${g}>`}"`);const y=l.get(w),_=Ml(e,y);if(i&&Xe(_,Z`${_t}|\((?!\?)`,Q.DEFAULT))throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);const S=e.slice(y,h.index),v=_.slice(S.length+d.length),x=o.length,k=+g-1,A=hr(S,v,k,!0,n,o,f);s=pr(s,S,k,o.length-x,x,f);const L=e.slice(0,y),G=e.slice(y+_.length);e=`${L}${A}${G}`,fe.lastIndex+=A.length-d.length-S.length-v.length,a.forEach(R=>R.hasRecursedWithin=!0),c=!0}else if(p)f++,l.set(String(f),fe.lastIndex),l.set(p,fe.lastIndex),a.push({num:f,name:p});else if(d[0]==="("){const m=d==="(";m&&(f++,l.set(String(f),fe.lastIndex)),a.push(m?{num:f}:{})}else d===")"&&a.pop()}return n.push(...o),{pattern:e,captureTransfers:s,hiddenCaptures:n}}function fr(e){const t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e))throw new Error(t);if(e=+e,e<2||e>100)throw new Error(t)}function hr(e,t,n,r,s,o,i){const l=new Set;r&&Es(e+t,_t,({groups:{captureName:c}})=>{l.add(c)},Q.DEFAULT);const a=[n,r?l:null,s,o,i];return`${e}${dr(`(?:${e}`,"forward",...a)}(?:)${dr(`${t})`,"backward",...a)}${t}`}function dr(e,t,n,r,s,o,i){const a=u=>t==="forward"?u+2:n-u+2-1;let c="";for(let u=0;u<n;u++){const f=a(u);c+=xn(e,Z`${As}|\\k<(?<backref>[^>]+)>`,({0:h,groups:{captureName:d,unnamed:p,backref:b}})=>{if(b&&r&&!r.has(b))return h;const w=`_$${f}`;if(p||d){const g=i+o.length+1;return o.push(g),Fl(s,g),p?h:`(?<${d}${w}>`}return Z`\k<${b}${w}>`},Q.DEFAULT)}return c}function Fl(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function pr(e,t,n,r,s,o){if(e.size&&r){let i=0;Es(t,As,()=>i++,Q.DEFAULT);const l=o-i+s,a=new Map;return e.forEach((c,u)=>{const f=(r-i*n)/n,h=i*n,d=u>l+i?u+r:u,p=[];for(const b of c)if(b<=l)p.push(b);else if(b>l+i+f)p.push(b+r);else if(b<=l+i)for(let w=0;w<=n;w++)p.push(b+i*w);else for(let w=0;w<=n;w++)p.push(b+h+f*w);a.set(d,p)}),a}return e}var O=String.fromCodePoint,I=String.raw,J={},St=globalThis.RegExp;J.flagGroups=(()=>{try{new St("(?i:)")}catch{return!1}return!0})();J.unicodeSets=(()=>{try{new St("[[]]","v")}catch{return!1}return!0})();J.bugFlagVLiteralHyphenIsRange=J.unicodeSets?(()=>{try{new St(I`[\d\-a]`,"v")}catch{return!0}return!1})():!1;J.bugNestedClassIgnoresNegation=J.unicodeSets&&new St("[[^a]]","v").test("a");function dt(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function Be(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function dn(e,t){return gr[e]>=gr[t]}function Ul(e,t){if(e==null)throw new Error(t??"Value expected");return e}var gr={ES2025:2025,ES2024:2024,ES2018:2018},jl={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function Rs(e={}){if({}.toString.call(e)!=="[object Object]")throw new Error("Unexpected options");if(e.target!==void 0&&!jl[e.target])throw new Error(`Unexpected target "${e.target}"`);const t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target==="auto"&&(t.target=J.flagGroups?"ES2025":J.unicodeSets?"ES2024":"ES2018"),t}var Wl="[ -\r ]",zl=new Set([O(304),O(305)]),re=I`[\p{L}\p{M}\p{N}\p{Pc}]`;function Ls(e){if(zl.has(e))return[e];const t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),s=Vl.get(n),o=Hl.get(n),i=ql.get(n);return[...r].length===1&&t.add(r),i&&t.add(i),s&&t.add(s),t.add(n),o&&t.add(o),[...t]}var En=new Map(`C Other
|
|
60
|
-
Cc Control cntrl
|
|
61
|
-
Cf Format
|
|
62
|
-
Cn Unassigned
|
|
63
|
-
Co Private_Use
|
|
64
|
-
Cs Surrogate
|
|
65
|
-
L Letter
|
|
66
|
-
LC Cased_Letter
|
|
67
|
-
Ll Lowercase_Letter
|
|
68
|
-
Lm Modifier_Letter
|
|
69
|
-
Lo Other_Letter
|
|
70
|
-
Lt Titlecase_Letter
|
|
71
|
-
Lu Uppercase_Letter
|
|
72
|
-
M Mark Combining_Mark
|
|
73
|
-
Mc Spacing_Mark
|
|
74
|
-
Me Enclosing_Mark
|
|
75
|
-
Mn Nonspacing_Mark
|
|
76
|
-
N Number
|
|
77
|
-
Nd Decimal_Number digit
|
|
78
|
-
Nl Letter_Number
|
|
79
|
-
No Other_Number
|
|
80
|
-
P Punctuation punct
|
|
81
|
-
Pc Connector_Punctuation
|
|
82
|
-
Pd Dash_Punctuation
|
|
83
|
-
Pe Close_Punctuation
|
|
84
|
-
Pf Final_Punctuation
|
|
85
|
-
Pi Initial_Punctuation
|
|
86
|
-
Po Other_Punctuation
|
|
87
|
-
Ps Open_Punctuation
|
|
88
|
-
S Symbol
|
|
89
|
-
Sc Currency_Symbol
|
|
90
|
-
Sk Modifier_Symbol
|
|
91
|
-
Sm Math_Symbol
|
|
92
|
-
So Other_Symbol
|
|
93
|
-
Z Separator
|
|
94
|
-
Zl Line_Separator
|
|
95
|
-
Zp Paragraph_Separator
|
|
96
|
-
Zs Space_Separator
|
|
97
|
-
ASCII
|
|
98
|
-
ASCII_Hex_Digit AHex
|
|
99
|
-
Alphabetic Alpha
|
|
100
|
-
Any
|
|
101
|
-
Assigned
|
|
102
|
-
Bidi_Control Bidi_C
|
|
103
|
-
Bidi_Mirrored Bidi_M
|
|
104
|
-
Case_Ignorable CI
|
|
105
|
-
Cased
|
|
106
|
-
Changes_When_Casefolded CWCF
|
|
107
|
-
Changes_When_Casemapped CWCM
|
|
108
|
-
Changes_When_Lowercased CWL
|
|
109
|
-
Changes_When_NFKC_Casefolded CWKCF
|
|
110
|
-
Changes_When_Titlecased CWT
|
|
111
|
-
Changes_When_Uppercased CWU
|
|
112
|
-
Dash
|
|
113
|
-
Default_Ignorable_Code_Point DI
|
|
114
|
-
Deprecated Dep
|
|
115
|
-
Diacritic Dia
|
|
116
|
-
Emoji
|
|
117
|
-
Emoji_Component EComp
|
|
118
|
-
Emoji_Modifier EMod
|
|
119
|
-
Emoji_Modifier_Base EBase
|
|
120
|
-
Emoji_Presentation EPres
|
|
121
|
-
Extended_Pictographic ExtPict
|
|
122
|
-
Extender Ext
|
|
123
|
-
Grapheme_Base Gr_Base
|
|
124
|
-
Grapheme_Extend Gr_Ext
|
|
125
|
-
Hex_Digit Hex
|
|
126
|
-
IDS_Binary_Operator IDSB
|
|
127
|
-
IDS_Trinary_Operator IDST
|
|
128
|
-
ID_Continue IDC
|
|
129
|
-
ID_Start IDS
|
|
130
|
-
Ideographic Ideo
|
|
131
|
-
Join_Control Join_C
|
|
132
|
-
Logical_Order_Exception LOE
|
|
133
|
-
Lowercase Lower
|
|
134
|
-
Math
|
|
135
|
-
Noncharacter_Code_Point NChar
|
|
136
|
-
Pattern_Syntax Pat_Syn
|
|
137
|
-
Pattern_White_Space Pat_WS
|
|
138
|
-
Quotation_Mark QMark
|
|
139
|
-
Radical
|
|
140
|
-
Regional_Indicator RI
|
|
141
|
-
Sentence_Terminal STerm
|
|
142
|
-
Soft_Dotted SD
|
|
143
|
-
Terminal_Punctuation Term
|
|
144
|
-
Unified_Ideograph UIdeo
|
|
145
|
-
Uppercase Upper
|
|
146
|
-
Variation_Selector VS
|
|
147
|
-
White_Space space
|
|
148
|
-
XID_Continue XIDC
|
|
149
|
-
XID_Start XIDS`.split(/\s/).map(e=>[Ct(e),e])),Hl=new Map([["s",O(383)],[O(383),"s"]]),ql=new Map([[O(223),O(7838)],[O(107),O(8490)],[O(229),O(8491)],[O(969),O(8486)]]),Vl=new Map([ae(453),ae(456),ae(459),ae(498),...Bt(8072,8079),...Bt(8088,8095),...Bt(8104,8111),ae(8124),ae(8140),ae(8188)]),Xl=new Map([["alnum",I`[\p{Alpha}\p{Nd}]`],["alpha",I`\p{Alpha}`],["ascii",I`\p{ASCII}`],["blank",I`[\p{Zs}\t]`],["cntrl",I`\p{Cc}`],["digit",I`\p{Nd}`],["graph",I`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",I`\p{Lower}`],["print",I`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",I`[\p{P}\p{S}]`],["space",I`\p{space}`],["upper",I`\p{Upper}`],["word",I`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",I`\p{AHex}`]]);function Kl(e,t){const n=[];for(let r=e;r<=t;r++)n.push(r);return n}function ae(e){const t=O(e);return[t.toLowerCase(),t]}function Bt(e,t){return Kl(e,t).map(n=>ae(n))}var Ns=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function Zl(e,t){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};Ts(e);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:dn(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};Pe(e,Ql,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};Pe(e,Yl,o);const i={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return Pe(e,Jl,i),e._originMap=o.groupOriginByCopy,e._strategy=r.strategy,e}var Ql={AbsenceFunction({node:e,parent:t,replaceWith:n}){const{body:r,kind:s}=e;if(s==="repeater"){const o=Y();o.body[0].body.push(de({negate:!0,body:r}),ve("Any"));const i=Y();i.body[0].body.push(ks("greedy",0,1/0,o)),n($(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];Be(r,i,[]).push(...s)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){const n=$s(t.get(e));if(n){const r=Y({flags:n});r.body[0].body=e.body,e.body=[$(r,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:s,remove:o,replaceWith:i},l){const{kind:a,negate:c}=e,{asciiWordBoundaries:u,avoidSubclass:f,supportedGNodes:h,wordIsAscii:d}=l;if(a==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${c?"Y":"y"}"`);if(a==="line_end")i($(de({body:[we({body:[cn("string_end")]}),we({body:[wt(10)]})]}),t));else if(a==="line_start")i($(se(I`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(a==="search_start")if(h.has(e))s.flags.sticky=!0,o();else{const p=r[n-1];if(p&&oc(p))i($(de({negate:!0}),t));else{if(f)throw new Error(I`Uses "\G" in a way that requires a subclass`);i(le(cn("string_start"),t)),l.strategy="clip_search"}}else if(!(a==="string_end"||a==="string_start"))if(a==="string_end_newline")i($(se(I`(?=\n?\z)`),t));else if(a==="word_boundary"){if(!d&&!u){const p=`(?:(?<=${re})(?!${re})|(?<!${re})(?=${re}))`,b=`(?:(?<=${re})(?=${re})|(?<!${re})(?!${re}))`;i($(se(c?b:p),t))}}else throw new Error(`Unexpected assertion kind "${a}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!Ft(n)&&(n=Gt(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!Ft(r)&&(r=Gt(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=tt({body:[e]});n($(r,t),{traverse:!0})}},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:s,digitIsAscii:o,spaceIsAscii:i,wordIsAscii:l}){const{kind:a,negate:c,value:u}=e;if(o&&(a==="digit"||u==="digit")){n(le(fn("digit",{negate:c}),t));return}if(i&&(a==="space"||u==="space")){n($(Ut(se(Wl),c),t));return}if(l&&(a==="word"||u==="word")){n(le(fn("word",{negate:c}),t));return}if(a==="any")n(le(ve("Any"),t));else if(a==="digit")n(le(ve("Nd",{negate:c}),t));else if(a!=="dot")if(a==="text_segment"){if(r==="strict")throw new Error(I`Use of "\X" requires non-strict accuracy`);const f="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",h=I`\p{RI}{2}|${f}(?:\u200D${f})*`;n($(se(I`(?>\r\n|${s?I`\p{RGI_Emoji}`:h}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(a==="hex")n(le(ve("AHex",{negate:c}),t));else if(a==="newline")n($(se(c?`[^
|
|
150
|
-
]`:`(?>\r
|
|
151
|
-
?|[
|
|
152
|
-
\v\f
\u2028\u2029])`),t));else if(a==="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 f={graph:"!-~",print:" -~"}[u];c&&(f=`\0-${O(f.codePointAt(0)-1)}${O(f.codePointAt(2)+1)}-`),n($(se(`[${f}]`),t))}else n($(Ut(se(Xl.get(u)),c),t));else if(a==="property")En.has(Ct(u))||(e.key="sc");else if(a==="space")n(le(ve("space",{negate:c}),t));else if(a==="word")n($(Ut(se(re),c),t));else throw new Error(`Unexpected character set kind "${a}"`)},Directive({node:e,parent:t,root:n,remove:r,replaceWith:s,removeAllPrevSiblings:o,removeAllNextSiblings:i}){const{kind:l,flags:a}=e;if(l==="flags")if(!a.enable&&!a.disable)r();else{const c=Y({flags:a});c.body[0].body=i(),s($(c,t),{traverse:!0})}else if(l==="keep"){const c=n.body[0],f=n.body.length===1&&Cs(c,{type:"Group"})&&c.body[0].body.length===1?c.body[0]:n;if(t.parent!==f||f.body.length>1)throw new Error(I`Uses "\K" in a way that's unsupported`);const h=de({behind:!0});h.body[0].body=o(),s($(h,t))}else throw new Error(`Unexpected directive kind "${l}"`)},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($(de({negate:!0}),t));else throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type==="Quantifier"){const t=Y();t.body[0].body.push(e.body),e.body=$(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=Os(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(I`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!Ft(n)&&(n=Gt(n,t),e.ref=n)}},Yl={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:l,reffedNodesByReferencer:a}){const c=s.get(e);if(c&&l.has(e.number)){const f=le(mr(e.number),t);a.set(f,l.get(e.number)),n(f);return}l.set(e.number,e),i.set(e.number,[]),e.name&&Be(i,e.name,[]);const u=i.get(e.name??e.number);for(let f=0;f<u.length;f++){const h=u[f];if(c===h.node||c&&c===h.origin||e===h.origin){u.splice(f,1);break}}if(i.get(e.number).push({node:e,origin:c}),e.name&&i.get(e.name).push({node:e,origin:c}),e.name){const f=Be(o,e.name,new Map);let h=!1;if(c)h=!0;else for(const d of f.values())if(!d.hasDuplicateNameToRemove){h=!0;break}o.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:h})}},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=dt(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),l=o===0,a=l?mr(0):Ps(i,r.groupOriginByCopy,null);let c=a;if(!l){const u=$s(nc(i,h=>h.type==="Group"&&!!h.flags)),f=u?dt(r.globalFlags,u):r.globalFlags;ec(f,r.currentFlags)||(c=Y({flags:rc(f)}),c.body[0].body.push(a))}n($(c,t),{traverse:!l})}},Jl={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=>tc(i,e));if(!o.length)n($(de({negate:!0}),t));else if(o.length>1){const i=Y({atomic:!0,body:o.reverse().map(l=>we({body:[un(l.number)]}))});n($(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=Ss();e.body.at(-1).body.push(s)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function Ts(e){Pe(e,{"*"({node:t,parent:n}){t.parent=n}})}function ec(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function tc(e,t){let n=t;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===e)return!1;const r=Ms(n.parent);for(const s of r){if(s===n)break;if(s===e||Ds(s,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function Ps(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]=Ps(i,t,s,n):(o==="type"&&i==="CapturingGroup"&&t.set(s,t.get(e)??e),s[o]=i);return s}function mr(e){const t=vs(e);return t.isRecursive=!0,t}function nc(e,t){const n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function Gt(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 $s(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 rc({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 Ms(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function Os(e){const t=e.find(n=>n.kind==="search_start"||ic(n,{negate:!1})||!sc(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=Os(r.body);if(!s)return null;Array.isArray(s)?n.push(...s):n.push(s)}return n}return null}function Ds(e,t){const n=Ms(e)??[];for(const r of n)if(r===t||Ds(r,t))return!0;return!1}function sc({type:e}){return e==="Assertion"||e==="Directive"||e==="LookaroundAssertion"}function oc(e){const t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||e.type==="Quantifier"&&e.min&&t.includes(e.body.type)}function ic(e,t){const n={negate:null,...t};return e.type==="LookaroundAssertion"&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&Cs(e.body[0],{type:"Assertion",kind:"search_start"})}function Ft(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function se(e,t){const r=_s(e,{...t,unicodePropertyMap:En}).body;return r.length>1||r[0].body.length>1?Y({body:r}):r[0].body[0]}function Ut(e,t){return e.negate=t,e}function le(e,t){return e.parent=t,e}function $(e,t){return Ts(e),e.parent=t,e}function ac(e,t){const n=Rs(t),r=dn(n.target,"ES2024"),s=dn(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,l=null;if(!s){const d=[e.flags.ignoreCase];Pe(e,lc,{getCurrentModI:()=>d.at(-1),popModI(){d.pop()},pushModI(p){d.push(p)},setHasCasedChar(){d.at(-1)?i=!0:l=!0}})}const a={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||i)&&!l)};let c=e;const u={accuracy:n.accuracy,appliedGlobalFlags:a,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:c,originMap:e._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!s&&i&&l),useFlagMods:s,useFlagV:r,verbose:n.verbose};function f(d){return u.lastNode=c,c=d,Ul(cc[d.type],`Unexpected node type "${d.type}"`)(d,u,f)}const h={pattern:e.body.map(f).join("|"),flags:f(e.flags),options:{...e.options}};return r||(delete h.options.force.v,h.options.disable.v=!0,h.options.unicodeSetsPlugin=null),h._captureTransfers=new Map,h._hiddenCaptures=[],u.captureMap.forEach((d,p)=>{d.hidden&&h._hiddenCaptures.push(p),d.transferTo&&Be(h._captureTransfers,d.transferTo,[]).push(p)}),h}var lc={"*":{enter({node:e},t){if(br(e)){const n=t.getCurrentModI();t.pushModI(e.flags?dt({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){br(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){In(O(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),Bs(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind==="property"&&Ns.has(e.value)&&t.setHasCasedChar()}},cc={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?I`\B`:I`\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},l=t.originMap.get(e);return l&&(i.hidden=!0,o>l.number&&(i.transferTo=l.number)),t.captureMap.set(o,i),`(${s?`?<${s}>`:""}${r.map(n).join("|")})`},Character({value:e},t){const n=O(e),r=Se(e,{escDigit:t.lastNode.type==="Backreference",inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&In(n)){const s=Ls(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");J.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&i.some(wr)&&(i=[wt(45),...i.filter(c=>!wr(c))]);const l=()=>`[${s?"^":""}${i.map(n).join(r==="intersection"?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||J.bugNestedClassIgnoresNegation)&&!s){const u=i.filter(f=>f.type==="CharacterClass"&&f.kind==="union"&&f.negate);if(u.length){const f=Y(),h=f.body[0];return f.parent=o,h.parent=f,i=i.filter(d=>!u.includes(d)),e.body=i,i.length?(e.parent=h,h.body.push(e)):f.body.pop(),u.forEach(d=>{const p=we({body:[d]});d.parent=p,p.parent=f,f.body.push(p)}),n(f)}}t.inCharClass=!0;const c=l();return t.inCharClass=!1,c}const a=i[0];if(r==="union"&&!s&&a&&((!t.useFlagV||!t.verbose)&&o.kind==="union"&&!(J.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&o.kind==="intersection"&&i.length===1&&a.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 l()},CharacterClassRange(e,t){const n=e.min.value,r=e.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},o=Se(n,s),i=Se(r,s),l=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){const a=Bs(e);pc(a).forEach(u=>{l.add(Array.isArray(u)?`${Se(u[0],s)}-${Se(u[1],s)}`:Se(u,s))})}return`${o}-${i}${[...l].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:r},s){if(e==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":I`[^\n]`;if(e==="digit")return t?I`\D`:I`\d`;if(e==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&Ns.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?I`\P`:I`\p`}{${r?`${r}=`:""}${n}}`}if(e==="word")return t?I`\W`:I`\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=dt(i,n));const l=t.map(o).join("|"),a=!s.verbose&&t.length===1&&r.type!=="Quantifier"&&!e&&(!s.useFlagMods||!n)?l:`(?${gc(e,n,s.useFlagMods)}${l})`;return s.currentFlags=i,a},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)+mc(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})`:I`\g<${t}&R=${r}>`}},uc=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),fc=new Set(["-","\\","]","^","["]),hc=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),yr=new Map([[9,I`\t`],[10,I`\n`],[11,I`\v`],[12,I`\f`],[13,I`\r`],[8232,I`\u2028`],[8233,I`\u2029`],[65279,I`\uFEFF`]]),dc=/^\p{Cased}$/u;function In(e){return dc.test(e)}function Bs(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 l=O(i);if(!In(l))continue;const a=Ls(l).filter(c=>{const u=c.codePointAt(0);return u<r||u>s});if(a.length&&(o.push(...a),n))break}return o}function Se(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(yr.has(e))return yr.get(e);if(e<32||e>126&&e<160||e>262143||t&&yc(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;const s=n?r?hc:fc:uc,o=O(e);return(s.has(o)?"\\":"")+o}function pc(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 gc(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 mc({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 br({type:e}){return e==="CapturingGroup"||e==="Group"||e==="LookaroundAssertion"}function yc(e){return e>47&&e<58}function wr({type:e,value:t}){return e==="Character"&&t===45}var bc=class pn 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 pn&&(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=Cc(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 pn(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&&(wc(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:l,transferTo:a}=this.#t.get(i)??{};if(l?o.push(null):(o.push(n.length),n.push(r[i]),this.hasIndices&&n.indices.push(s[i])),a&&r[i]!==void 0){const c=o[a];if(!c)throw new Error(`Invalid capture transfer to "${c}"`);if(n[c]=r[i],this.hasIndices&&(n.indices[c]=s[i]),n.groups){this.#n||(this.#n=_c(this.source));const u=this.#n.get(a);u&&(n.groups[u]=r[i],this.hasIndices&&(n.indices.groups[u]=s[i]))}}}return n}};function wc(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 l=s[i];l&&(s[i]=[l[0]+t,l[1]+t])}const o=s.groups;o&&Object.keys(o).forEach(i=>{const l=o[i];l&&(o[i]=[l[0]+t,l[1]+t])})}}function Cc(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)Be(n,o,{}).transferTo=r;return n}function _c(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:l,name:a}}=o;i==="["?r++:r?i==="]"&&r--:l&&(s++,a&&n.set(s,a))}return n}function Sc(e,t){const n=kc(e,t);return n.options?new bc(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function kc(e,t){const n=Rs(t),r=_s(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:En}),s=Zl(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),o=ac(s,n),i=Gl(o.pattern,{captureTransfers:o._captureTransfers,hiddenCaptures:o._hiddenCaptures,mode:"external"}),l=Dl(i.pattern),a=Ol(l.pattern,{captureTransfers:i.captureTransfers,hiddenCaptures:i.hiddenCaptures}),c={pattern:a.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=a.hiddenCaptures.sort((p,b)=>p-b),f=Array.from(a.captureTransfers),h=s._strategy,d=c.pattern.length>=n.lazyCompileLength;(u.length||f.length||h||d)&&(c.options={...u.length&&{hiddenCaptures:u},...f.length&&{transfers:f},...h&&{strategy:h},...d&&{lazyCompile:d}})}return c}function vc(e,t){return Sc(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function xc(e={}){const t={target:"auto",cache:new Map,...e};return t.regexConstructor||=n=>vc(n,{target:t.target}),{createScanner(n){return new Fa(n,t)},createString(n){return{content:n}}}}var An=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Ec(){return 2147483648}function Ic(){return typeof performance<"u"?performance.now():Date.now()}const Ac=(e,t)=>e+(t-e%t)%t;async function Rc(e){let t,n;const r={};function s(d){n=d,r.HEAPU8=new Uint8Array(d),r.HEAPU32=new Uint32Array(d)}function o(d,p,b){r.HEAPU8.copyWithin(d,p,p+b)}function i(d){try{return t.grow(d-n.byteLength+65535>>>16),s(t.buffer),1}catch{}}function l(d){const p=r.HEAPU8.length;d=d>>>0;const b=Ec();if(d>b)return!1;for(let w=1;w<=4;w*=2){let g=p*(1+.2/w);g=Math.min(g,d+100663296);const m=Math.min(b,Ac(Math.max(d,g),65536));if(i(m))return!0}return!1}const a=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(d,p,b=1024){const w=p+b;let g=p;for(;d[g]&&!(g>=w);)++g;if(g-p>16&&d.buffer&&a)return a.decode(d.subarray(p,g));let m="";for(;p<g;){let y=d[p++];if(!(y&128)){m+=String.fromCharCode(y);continue}const _=d[p++]&63;if((y&224)===192){m+=String.fromCharCode((y&31)<<6|_);continue}const S=d[p++]&63;if((y&240)===224?y=(y&15)<<12|_<<6|S:y=(y&7)<<18|_<<12|S<<6|d[p++]&63,y<65536)m+=String.fromCharCode(y);else{const v=y-65536;m+=String.fromCharCode(55296|v>>10,56320|v&1023)}}return m}function u(d,p){return d?c(r.HEAPU8,d,p):""}const f={emscripten_get_now:Ic,emscripten_memcpy_big:o,emscripten_resize_heap:l,fd_write:()=>0};async function h(){const p=await e({env:f,wasi_snapshot_preview1:f});t=p.memory,s(t.buffer),Object.assign(r,p),r.UTF8ToString=u}return await h(),r}var Lc=Object.defineProperty,Nc=(e,t,n)=>t in e?Lc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,D=(e,t,n)=>Nc(e,typeof t!="symbol"?t+"":t,n);let F=null;function Tc(e){throw new An(e.UTF8ToString(e.getLastOnigError()))}class kt{constructor(t){D(this,"utf16Length"),D(this,"utf8Length"),D(this,"utf16Value"),D(this,"utf8Value"),D(this,"utf16OffsetToUtf8"),D(this,"utf8OffsetToUtf16");const n=t.length,r=kt._utf8ByteLength(t),s=r!==n,o=s?new Uint32Array(n+1):null;s&&(o[n]=r);const i=s?new Uint32Array(r+1):null;s&&(i[r]=n);const l=new Uint8Array(r);let a=0;for(let c=0;c<n;c++){const u=t.charCodeAt(c);let f=u,h=!1;if(u>=55296&&u<=56319&&c+1<n){const d=t.charCodeAt(c+1);d>=56320&&d<=57343&&(f=(u-55296<<10)+65536|d-56320,h=!0)}s&&(o[c]=a,h&&(o[c+1]=a),f<=127?i[a+0]=c:f<=2047?(i[a+0]=c,i[a+1]=c):f<=65535?(i[a+0]=c,i[a+1]=c,i[a+2]=c):(i[a+0]=c,i[a+1]=c,i[a+2]=c,i[a+3]=c)),f<=127?l[a++]=f:f<=2047?(l[a++]=192|(f&1984)>>>6,l[a++]=128|(f&63)>>>0):f<=65535?(l[a++]=224|(f&61440)>>>12,l[a++]=128|(f&4032)>>>6,l[a++]=128|(f&63)>>>0):(l[a++]=240|(f&1835008)>>>18,l[a++]=128|(f&258048)>>>12,l[a++]=128|(f&4032)>>>6,l[a++]=128|(f&63)>>>0),h&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=l,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=i}static _utf8ByteLength(t){let n=0;for(let r=0,s=t.length;r<s;r++){const o=t.charCodeAt(r);let i=o,l=!1;if(o>=55296&&o<=56319&&r+1<s){const a=t.charCodeAt(r+1);a>=56320&&a<=57343&&(i=(o-55296<<10)+65536|a-56320,l=!0)}i<=127?n+=1:i<=2047?n+=2:i<=65535?n+=3:n+=4,l&&r++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const vt=class ne{constructor(t){if(D(this,"id",++ne.LAST_ID),D(this,"_onigBinding"),D(this,"content"),D(this,"utf16Length"),D(this,"utf8Length"),D(this,"utf16OffsetToUtf8"),D(this,"utf8OffsetToUtf16"),D(this,"ptr"),!F)throw new An("Must invoke loadWasm first.");this._onigBinding=F,this.content=t;const n=new kt(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!ne._sharedPtrInUse?(ne._sharedPtr||(ne._sharedPtr=F.omalloc(1e4)),ne._sharedPtrInUse=!0,F.HEAPU8.set(n.utf8Value,ne._sharedPtr),this.ptr=ne._sharedPtr):this.ptr=n.createString(F)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===ne._sharedPtr?ne._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};D(vt,"LAST_ID",0);D(vt,"_sharedPtr",0);D(vt,"_sharedPtrInUse",!1);let Gs=vt;class Pc{constructor(t){if(D(this,"_onigBinding"),D(this,"_ptr"),!F)throw new An("Must invoke loadWasm first.");const n=[],r=[];for(let l=0,a=t.length;l<a;l++){const c=new kt(t[l]);n[l]=c.createString(F),r[l]=c.utf8Length}const s=F.omalloc(4*t.length);F.HEAPU32.set(n,s/4);const o=F.omalloc(4*t.length);F.HEAPU32.set(r,o/4);const i=F.createOnigScanner(s,o,t.length);for(let l=0,a=t.length;l<a;l++)F.ofree(n[l]);F.ofree(o),F.ofree(s),i===0&&Tc(F),this._onigBinding=F,this._ptr=i}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,r){let s=0;if(typeof r=="number"&&(s=r),typeof t=="string"){t=new Gs(t);const o=this._findNextMatchSync(t,n,!1,s);return t.dispose(),o}return this._findNextMatchSync(t,n,!1,s)}_findNextMatchSync(t,n,r,s){const o=this._onigBinding,i=o.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),s);if(i===0)return null;const l=o.HEAPU32;let a=i/4;const c=l[a++],u=l[a++],f=[];for(let h=0;h<u;h++){const d=t.convertUtf8OffsetToUtf16(l[a++]),p=t.convertUtf8OffsetToUtf16(l[a++]);f[h]={start:d,end:p,length:p-d}}return{index:c,captureIndices:f}}}function $c(e){return typeof e.instantiator=="function"}function Mc(e){return typeof e.default=="function"}function Oc(e){return typeof e.data<"u"}function Dc(e){return typeof Response<"u"&&e instanceof Response}function Bc(e){return typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<"u"&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&e instanceof Uint32Array}let Ke;function Gc(e){if(Ke)return Ke;async function t(){F=await Rc(async n=>{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),$c(r)?r=await r.instantiator(n):Mc(r)?r=await r.default(n):(Oc(r)&&(r=r.data),Dc(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await Fc(r)(n):r=await Uc(r)(n):Bc(r)?r=await jt(r)(n):r instanceof WebAssembly.Module?r=await jt(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await jt(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Ke=t(),Ke}function jt(e){return t=>WebAssembly.instantiate(e,t)}function Fc(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Uc(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}async function jc(e){return e&&await Gc(e),{createScanner(t){return new Pc(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new Gs(t)}}}function Wc(e){return e!==null&&typeof e=="object"&&"default"in e?e.default:e}var zc=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name="DuplicateThemeError"}},Hc=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name="UnregisteredThemeError"}},qc=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name="UnresolvedThemeError"}};function Vc(){const e=new Map,t=new Map,n=new Map;let r=0;function s(g,m){if(e.has(g))throw new zc(g);e.set(g,m)}function o(g,m){return e.has(g)?!1:(e.set(g,m),!0)}function i(g){return e.has(g)}function l(g){const m=t.get(g);if(m!==void 0)return Promise.resolve(m);const y=n.get(g);if(y!==void 0)return y;const _=e.get(g);if(_===void 0)return Promise.reject(new Hc(g));const S=r,v=_().then(x=>{const k=Wc(x);return S===r&&t.set(g,k),n.get(g)===v&&n.delete(g),k}).catch(x=>{throw n.get(g)===v&&n.delete(g),x});return n.set(g,v),v}function a(g){return Promise.all(g.map(m=>l(m)))}function c(g,m){t.set(g,m)}function u(g){for(const[m,y]of g)c(m,y)}function f(g){return t.get(g)}function h(g){const m=[];for(const y of g){const _=t.get(y);if(_===void 0)throw new qc(y);m.push(_)}return m}function d(g){return t.has(g)}function p(g){for(const m of g)if(!t.has(m))return!1;return!0}function b(g){const m=t.get(g);return m!==void 0?m:l(g)}function w(){r++,t.clear(),n.clear()}return{clearResolvedThemes:w,getResolvedOrResolveTheme:b,getResolvedTheme:f,getResolvedThemes:h,hasRegisteredTheme:i,hasResolvedTheme:d,hasResolvedThemes:p,registerTheme:s,registerThemeIfAbsent:o,resolveTheme:l,resolveThemes:a,seedResolvedTheme:c,seedResolvedThemes:u}}class Fs{diff(t,n,r={}){let s;typeof r=="function"?(s=r,r={}):"callback"in r&&(s=r.callback);const o=this.castInput(t,r),i=this.castInput(n,r),l=this.removeEmpty(this.tokenize(o,r)),a=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(l,a,r,s)}diffWithOptionsObj(t,n,r,s){var o;const i=m=>{if(m=this.postProcess(m,r),s){setTimeout(function(){s(m)},0);return}else return m},l=n.length,a=t.length;let c=1,u=l+a;r.maxEditLength!=null&&(u=Math.min(u,r.maxEditLength));const f=(o=r.timeout)!==null&&o!==void 0?o:1/0,h=Date.now()+f,d=[{oldPos:-1,lastComponent:void 0}];let p=this.extractCommon(d[0],n,t,0,r);if(d[0].oldPos+1>=a&&p+1>=l)return i(this.buildValues(d[0].lastComponent,n,t));let b=-1/0,w=1/0;const g=()=>{for(let m=Math.max(b,-c);m<=Math.min(w,c);m+=2){let y;const _=d[m-1],S=d[m+1];_&&(d[m-1]=void 0);let v=!1;if(S){const k=S.oldPos-m;v=S&&0<=k&&k<l}const x=_&&_.oldPos+1<a;if(!v&&!x){d[m]=void 0;continue}if(!x||v&&_.oldPos<S.oldPos?y=this.addToPath(S,!0,!1,0,r):y=this.addToPath(_,!1,!0,1,r),p=this.extractCommon(y,n,t,m,r),y.oldPos+1>=a&&p+1>=l)return i(this.buildValues(y.lastComponent,n,t))||!0;d[m]=y,y.oldPos+1>=a&&(w=Math.min(w,m-1)),p+1>=l&&(b=Math.max(b,m+1))}c++};if(s)(function m(){setTimeout(function(){if(c>u||Date.now()>h)return s(void 0);g()||m()},0)})();else for(;c<=u&&Date.now()<=h;){const m=g();if(m)return m}}addToPath(t,n,r,s,o){const i=t.lastComponent;return i&&!o.oneChangePerToken&&i.added===n&&i.removed===r?{oldPos:t.oldPos+s,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:t.oldPos+s,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}}extractCommon(t,n,r,s,o){const i=n.length,l=r.length;let a=t.oldPos,c=a-s,u=0;for(;c+1<i&&a+1<l&&this.equals(r[a+1],n[c+1],o);)c++,a++,u++,o.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return u&&!o.oneChangePerToken&&(t.lastComponent={count:u,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=a,c}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const s=[];let o;for(;t;)s.push(t),o=t.previousComponent,delete t.previousComponent,t=o;s.reverse();const i=s.length;let l=0,a=0,c=0;for(;l<i;l++){const u=s[l];if(u.removed)u.value=this.join(r.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=n.slice(a,a+u.count);f=f.map(function(h,d){const p=r[c+d];return p.length>h.length?p:h}),u.value=this.join(f)}else u.value=this.join(n.slice(a,a+u.count));a+=u.count,u.added||(c+=u.count)}}return s}}class Xc extends Fs{}const Kc=new Xc;function Zc(e,t,n){return Kc.diff(e,t,n)}const Cr="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class Qc extends Fs{tokenize(t){const n=new RegExp(`(\\r?\\n)|[${Cr}]+|[^\\S\\n\\r]+|[^${Cr}]`,"ug");return t.match(n)||[]}}const Yc=new Qc;function Jc(e,t,n){return Yc.diff(e,t,n)}function eu(e={}){const{classPrefix:t="__shiki_",classSuffix:n="",classReplacer:r=l=>l}=e,s=new Map;function o(l){return Object.entries(l).map(([a,c])=>`${a}:${c}`).join(";")}function i(l){let a=t+tu(typeof l=="string"?l:o(l))+n;return a=r(a),s.has(a)||s.set(a,typeof l=="string"?l:{...l}),a}return{name:"@shikijs/transformers:style-to-class",pre(l){if(!l.properties.style)return;const a=i(l.properties.style);delete l.properties.style,this.addClassToHast(l,a)},tokens(l){for(const a of l)for(const c of a){if(!c.htmlStyle)continue;const u=i(c.htmlStyle);c.htmlStyle={},c.htmlAttrs||={},c.htmlAttrs.class?c.htmlAttrs.class+=` ${u}`:c.htmlAttrs.class=u}},getClassRegistry(){return s},getCSS(){let l="";for(const[a,c]of s.entries())l+=`.${a}{${typeof c=="string"?c:o(c)}}`;return l},clearRegistry(){s.clear()}}}function tu(e,t=0){let n=3735928559^t,r=1103547991^t;for(let s=0,o;s<e.length;s++)o=e.charCodeAt(s),n=Math.imul(n^o,2654435761),r=Math.imul(r^o,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}const nu=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,ru=/^0(?:\.0+)?%?$/;function su(e){const t=e.indexOf("(");if(t<=0||!e.endsWith(")"))return;const n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;const r=e.slice(t+1,-1).trim();if(r.length===0)return;const s=r.lastIndexOf("/");if(s!==-1)return r.slice(s+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){const o=r.split(",");if(o.length===4)return o[3]?.trim()}}function ou(e){const t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;const n=t[1];let r,s=1;return n.length===3?r=n.split("").map(o=>o+o).join(""):n.length===6?r=n:(r=n.slice(0,6),s=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),s]}function Wt(e){if(e==null)return null;const t=ou(e);if(t==null)return null;const n=t[0]/255,r=t[1]/255,s=t[2]/255,o=i=>i<=.03928?i/12.92:((i+.055)/1.055)**2.4;return .2126*o(n)+.7152*o(r)+.0722*o(s)}function _r(e){if(e==null)return!1;const t=e.trim().toLowerCase();if(t==="transparent"||nu.test(t))return!0;const n=su(t);return n!=null&&ru.test(n)}function iu(e,t,n){if(t==null||n==null)return!1;const r=Wt(e),s=Wt(t),o=Wt(n);return r==null||s==null||o==null?!1:Math.abs(r-o)<Math.abs(r-s)}const Sr=new WeakMap;function zt(e){const t=Sr.get(e);if(t!=null)return t;const n=e.colors??{},r={...n},s=n["editor.background"]??e.bg,o=n["editor.foreground"]??e.fg,i=n["sideBar.background"]??s,l=n["sideBar.foreground"]??o;ee(r,"editor.background",s),ee(r,"editor.foreground",o),ee(r,"sideBar.background",i),ee(r,"sideBar.foreground",l),ee(r,"input.background",n["input.background"]??i),ee(r,"sideBarSectionHeader.foreground",n["sideBarSectionHeader.foreground"]??l),ee(r,"list.activeSelectionForeground",n["list.activeSelectionForeground"]??l),ee(r,"gitDecoration.addedResourceForeground",Ht(n["gitDecoration.addedResourceForeground"],n["terminal.ansiGreen"],n["editorGutter.addedBackground"])),ee(r,"gitDecoration.modifiedResourceForeground",Ht(n["gitDecoration.modifiedResourceForeground"],n["terminal.ansiBlue"],n["editorGutter.modifiedBackground"])),ee(r,"gitDecoration.deletedResourceForeground",Ht(n["gitDecoration.deletedResourceForeground"],n["terminal.ansiRed"],n["editorGutter.deletedBackground"]));const a=(_r(n["list.focusOutline"])?void 0:n["list.focusOutline"])??(_r(n.focusBorder)?void 0:n.focusBorder);a!=null?r["list.focusOutline"]=a:delete r["list.focusOutline"];const c=n["list.hoverBackground"];c!=null&&(au(c,i)||iu(c,i,l))&&delete r["list.hoverBackground"];const u=Object.freeze({...e,colors:Object.freeze(r)});return Sr.set(e,u),u}function ee(e,t,n){n!=null&&n!==""&&(e[t]=n)}function Ht(...e){for(const t of e)if(t!=null&&t!=="")return t}function au(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}(()=>{try{return!1}catch{return!1}})();const lu=/(?<=\n)/,xt={dark:"pierre-dark",light:"pierre-light"},kr=new Map,vr=new Set;function Rn(e,t){e=Array.isArray(e)?e:[e];for(const n of e){if(vr.has(n.name))continue;let r=kr.get(n.name);r==null&&(r=n,kr.set(n.name,r)),vr.add(r.name),t.loadLanguageSync(r.data)}}const xr=new Set,qt=Vc();function Us(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let r;if(typeof n=="string"){if(r=qt.getResolvedTheme(n),r==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else r=n,n=n.name,qt.getResolvedTheme(n)==null&&qt.seedResolvedTheme(n,r);xr.has(n)||(xr.add(n),t.loadThemeSync(r))}}const ce=new Map;let Er=0;const Le={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function gn(e){if(ce.has(e))return ce.get(e)??"text";if(Le[e]!=null)return Le[e];const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(ce.has(t[1]))return ce.get(t[1])??"text";if(Le[t[1]]!=null)return Le[t[1]]??"text"}const n=e.match(/\.([^.]+)$/)?.[1]??"";return ce.has(n)?ce.get(n)??"text":Le[n]??"text"}function cu(e,t){if(e<=Er)return!1;ce.clear();for(const n in t){const r=t[n];r!=null&&ce.set(n,r)}return Er=e,!0}function Ge(e){return e.replace(/\n$|\r\n$/,"")}function uu(e){return{type:"text",value:e}}function fu({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function hu(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t;"children"in t?t=t.children[0]:t=null}}function du(e,t,n){const r=typeof n.lineInfo=="function"?n.lineInfo(t):n.lineInfo[t-1];if(r==null){const s=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(s,{node:e,line:t,state:n}),new Error(s)}return e.tagName="div",e.properties["data-line"]=r.lineNumber,e.properties["data-alt-line"]=r.altLineNumber,e.properties["data-line-type"]=r.type,e.properties["data-line-index"]=r.lineIndex,e.children.length===0&&e.children.push(uu(`
|
|
153
|
-
`)),e}const Ze=Symbol("no-token"),Vt=Symbol("multiple-tokens");function js(e){const t=pu(e);if(t!=null)return t;let n=Ze;const r=[];let s=[],o;const i=()=>{if(s.length===0||o==null){s=[],o=void 0;return}if(s.length===1){const a=s[0];if(a?.type==="element"){gu(a,o);for(const c of a.children)nt(c)}else nt(a);r.push(a),s=[],o=void 0;return}for(const a of s)nt(a);r.push(fu({tagName:"span",properties:{"data-char":o},children:s})),s=[],o=void 0},l=a=>{if(a!==Ze){if(a===Vt){n=Vt;return}if(n===Ze){n=a;return}n!==a&&(n=Vt)}};for(const a of e.children){const c=a.type==="element"?js(a):Ze;if(l(c),typeof c!="number"){i(),r.push(a);continue}o!=null&&o!==c&&i(),o??=c,s.push(a)}return i(),e.children=r,n}function pu(e){const t=e.properties["data-char"];if(typeof t=="number")return t}function nt(e){if(e.type==="element"){e.properties["data-char"]=void 0;for(const t of e.children)nt(t)}}function gu(e,t){e.properties["data-char"]=t}function Ws(e=!1,t=!1){const n={lineInfo:[]},r=[{line(s){return delete s.properties.class,s},pre(s){const o=hu(s),i=[];if(o!=null){let l=1;for(const a of o.children)a.type==="element"&&(e&&js(a),i.push(du(a,l,n)),l++);o.children=i}return s},...e?{tokens(s){for(const o of s){let i=0;for(const l of o){const a=l;a.__lineChar??=i,i+=l.content.length}}},preprocess(s,o){o.mergeWhitespaces="never"},span(s,o,i,l,a){if(a?.offset!=null&&a.content!=null){const c=a.__lineChar;return c!=null&&(s.properties["data-char"]=c),s}return s}}:null}];return t&&r.push(mu,Ir),{state:n,transformers:r,toClass:Ir}}const Ir=eu({classPrefix:"hl-"}),mu={name:"token-style-normalizer",tokens(e){for(const t of e)for(const n of t){if(n.htmlStyle!=null)continue;const r={};n.color!=null&&(r.color=n.color),n.bgColor!=null&&(r["background-color"]=n.bgColor),n.fontStyle!=null&&n.fontStyle!==0&&((n.fontStyle&1)!==0&&(r["font-style"]="italic"),(n.fontStyle&2)!==0&&(r["font-weight"]="bold"),(n.fontStyle&4)!==0&&(r["text-decoration"]="underline")),Object.keys(r).length>0&&(n.htmlStyle=r)}}};function X(e){return`--${e==="token"?"diffs-token":"diffs"}-`}function zs({theme:e=xt,highlighter:t,prefix:n}){let r="";if(typeof e=="string"){const s=t.getTheme(e),o=zt(s);r+=`color:${o.fg};`,r+=`background-color:${o.bg};`,r+=`${X("global")}fg:${o.fg};`,r+=`${X("global")}bg:${o.bg};`,r+=Xt(s,n)}else{let s=t.getTheme(e.dark),o=zt(s);r+=`${X("global")}dark:${o.fg};`,r+=`${X("global")}dark-bg:${o.bg};`,r+=Xt(s,"dark"),s=t.getTheme(e.light),o=zt(s),r+=`${X("global")}light:${o.fg};`,r+=`${X("global")}light-bg:${o.bg};`,r+=Xt(s,"light")}return r}function Xt(e,t){t=t!=null?`${t}-`:"";let n="";const r=e.colors?.["gitDecoration.addedResourceForeground"]??e.colors?.["terminal.ansiGreen"];r!=null&&(n+=`${X("global")}${t}addition-color:${r};`);const s=e.colors?.["gitDecoration.deletedResourceForeground"]??e.colors?.["terminal.ansiRed"];s!=null&&(n+=`${X("global")}${t}deletion-color:${s};`);const o=e.colors?.["gitDecoration.modifiedResourceForeground"]??e.colors?.["terminal.ansiBlue"];return o!=null&&(n+=`${X("global")}${t}modified-color:${o};`),n}function mn(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t.children;"children"in t?t=t.children[0]:t=null}throw console.error(e),new Error("getLineNodes: Unable to find children")}function yu({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:s}){const o=Math.max(t,0);if(o===0||e)return{fromStart:0,fromEnd:0,rangeSize:o,collapsedLines:o,renderAll:!1};if(n===!0||o<=s)return{fromStart:o,fromEnd:0,rangeSize:o,collapsedLines:0,renderAll:!0};const i=n?.get(r),l=Math.min(Math.max(i?.fromStart??0,0),o),a=Math.min(Math.max(i?.fromEnd??0,0),o),c=l+a,u=c>=o;return{fromStart:u?o:l,fromEnd:u?0:a,rangeSize:o,collapsedLines:Math.max(o-c,0),renderAll:u}}function bu({fileDiff:e,errorPrefix:t}){const n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;const r=e.additionLines.length-(n.additionLineIndex+n.additionCount),s=e.deletionLines.length-(n.deletionLineIndex+n.deletionCount);if(r<=0&&s<=0)return 0;if(r!==s)throw new Error(`${t}: trailing context mismatch (additions=${r}, deletions=${s}) for ${e.name}`);return Math.min(r,s)}function wu({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:s}){if(t!==e.hunks.length-1)return;const o=bu({fileDiff:e,errorPrefix:s});if(o<=0)return;if(n===!0||o<=r)return{fromStart:o,fromEnd:0,rangeSize:o,collapsedLines:0,renderAll:!0};const i=n?.get(e.hunks.length),l=Math.min(Math.max(i?.fromStart??0,0),o);return{fromStart:l,fromEnd:0,rangeSize:o,collapsedLines:o-l,renderAll:l>=o}}function Cu({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:s,collapsedContextThreshold:o=1,callback:i}){const l=_u({diff:e,diffStyle:t,startingLine:n,expandedHunks:s,collapsedContextThreshold:o}),a={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:l.splitCount,unifiedCount:l.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!a.isWindowedHighlight)return!1;const c=a.unifiedCount>=n+r,u=a.splitCount>=n+r;return c&&u},shouldSkip(c,u){if(!a.isWindowedHighlight)return!1;const f=a.unifiedCount+c<n,h=a.splitCount+u<n;return f&&h},incrementCounts(c,u){a.unifiedCount+=c,a.splitCount+=u},isInWindow(c,u){if(!a.isWindowedHighlight)return!0;const f=a.isInUnifiedWindow(c),h=a.isInSplitWindow(u);return f||h},isInUnifiedWindow(c){return!a.isWindowedHighlight||a.unifiedCount>=n-c&&a.unifiedCount<n+r},isInSplitWindow(c){return!a.isWindowedHighlight||a.splitCount>=n-c&&a.splitCount<n+r},emit(c,u=!1){return u||a.incrementCounts(1,1),i(c)??!1}};e:for(let c=l.hunkIndex;c<e.hunks.length;c++){let u=function(k,A){return p==null||p.collapsedLines<=0||p.fromStart+p.fromEnd>0?0:A===h.splitLineStart+h.splitLineCount-1?p.collapsedLines:0},f=function(){return w?0:(w=!0,d.collapsedLines)};const h=e.hunks[c];if(h==null)throw new Error("iterateOverDiff: invalid hunk index");if(a.shouldBreak())break;const d=yu({isPartial:e.isPartial,rangeSize:h.collapsedBefore,expandedHunks:s,hunkIndex:c,collapsedContextThreshold:o}),p=c===a.finalHunkIndex?wu({fileDiff:e,hunkIndex:c,expandedHunks:s,collapsedContextThreshold:o,errorPrefix:"iterateOverDiff"}):void 0,b=d.fromStart+d.fromEnd;let w=d.collapsedLines===0;if(a.shouldSkip(b,b))a.incrementCounts(b,b),f();else{let k=h.unifiedLineStart-d.rangeSize,A=h.splitLineStart-d.rangeSize,L=h.deletionLineIndex-d.rangeSize,G=h.additionLineIndex-d.rangeSize,R=h.deletionStart-d.rangeSize,H=h.additionStart-d.rangeSize;if(Qe(a,d.fromStart,t,P=>a.emit({hunkIndex:c,hunk:h,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:R+P,lineIndex:L+P,noEOFCR:!1,unifiedLineIndex:k+P,splitLineIndex:A+P},additionLine:{unifiedLineIndex:k+P,splitLineIndex:A+P,lineIndex:G+P,lineNumber:H+P,noEOFCR:!1}}))||(k=h.unifiedLineStart-d.fromEnd,A=h.splitLineStart-d.fromEnd,L=h.deletionLineIndex-d.fromEnd,G=h.additionLineIndex-d.fromEnd,R=h.deletionStart-d.fromEnd,H=h.additionStart-d.fromEnd,Qe(a,d.fromEnd,t,P=>a.emit({hunkIndex:c,hunk:h,collapsedBefore:f(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:R+P,lineIndex:L+P,noEOFCR:!1,unifiedLineIndex:k+P,splitLineIndex:A+P},additionLine:{unifiedLineIndex:k+P,splitLineIndex:A+P,lineIndex:G+P,lineNumber:H+P,noEOFCR:!1}}),()=>{f()})))break e}let g=h.unifiedLineStart,m=h.splitLineStart,y=h.deletionLineIndex,_=h.additionLineIndex,S=h.deletionStart,v=h.additionStart;const x=h.hunkContent.at(-1);for(const k of h.hunkContent){if(a.shouldBreak())break e;const A=k===x;if(k.type==="context"){if(a.shouldSkip(k.lines,k.lines))a.incrementCounts(k.lines,k.lines),f();else if(Qe(a,k.lines,t,L=>{const G=A&&L===k.lines-1,R=g+L,H=m+L;return a.emit({hunkIndex:c,hunk:h,collapsedBefore:f(),collapsedAfter:u(R,H),type:"context",deletionLine:{lineNumber:S+L,lineIndex:y+L,noEOFCR:G&&h.noEOFCRDeletions,unifiedLineIndex:R,splitLineIndex:H},additionLine:{unifiedLineIndex:R,splitLineIndex:H,lineIndex:_+L,lineNumber:v+L,noEOFCR:G&&h.noEOFCRAdditions}})},()=>{f()}))break e;g+=k.lines,m+=k.lines,y+=k.lines,_+=k.lines,S+=k.lines,v+=k.lines}else{const L=Math.max(k.deletions,k.additions),G=k.deletions+k.additions;if(!a.shouldSkip(G,L)){const R=ku(a,k);(R[0]?.[0]??0)>0&&f();for(const[H,P]of R)for(let z=H;z<P;z++){const ie=u(g+z,m+z);if(a.emit(vu({hunkIndex:c,hunk:h,collapsedBefore:f(),collapsedAfter:ie,diffStyle:t,index:z,unifiedLineIndex:g,splitLineIndex:m,additionLineIndex:_,deletionLineIndex:y,additionLineNumber:v,deletionLineNumber:S,content:k,isLastContent:A,unifiedCount:G,splitCount:L}),!0))break e}}f(),a.incrementCounts(G,L),g+=G,m+=L,y+=k.deletions,_+=k.additions,S+=k.deletions,v+=k.additions}}if(p!=null){const{collapsedLines:k,fromStart:A,fromEnd:L}=p,G=A+L;if(Qe(a,G,t,R=>{const H=R===G-1;return a.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:H?k:0,type:"context-expanded",deletionLine:{lineNumber:S+R,lineIndex:y+R,noEOFCR:!1,unifiedLineIndex:g+R,splitLineIndex:m+R},additionLine:{unifiedLineIndex:g+R,splitLineIndex:m+R,lineIndex:_+R,lineNumber:v+R,noEOFCR:!1}})},void 0,()=>a.shouldBreak()))break e}}}function _u({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:s}){return{hunkIndex:0,splitCount:0,unifiedCount:0}}function Su(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];const r=[];function s(l){const a=Math.max(0,e.viewportStart-l),c=Math.min(t,e.viewportEnd-l);c>a&&r.push([a,c])}if(s(e.unifiedCount),s(e.splitCount),r.length===0)return[0,0];let o=r[0][0],i=r[0][1];for(let l=1;l<r.length;l++){const a=r[l];o=Math.min(o,a[0]),i=Math.max(i,a[1])}return[o,i]}function Qe(e,t,n,r,s,o){const[i,l]=Su(e,t);i>0&&(e.incrementCounts(i,i),s?.());let a=i;for(;a<t;){if(o?.()===!0)return!0;if(a>=l){e.incrementCounts(t-a,t-a);break}if(e.isInWindow(0,0)){if(r(a)===!0)return!0}else e.incrementCounts(1,1);a++}return!1}function ku(e,t,n){if(!e.isWindowedHighlight)return[[0,Math.max(t.deletions,t.additions)]];const r=[];function s(a,c){if(a+c<=e.viewportStart||a>=e.viewportEnd)return;const u=Math.max(0,e.viewportStart-a),f=Math.min(c,e.viewportEnd-a);return f>u?[u,f]:void 0}function o(a,c){return a}function i(a,c){if(a==null)return;const[u,f]=o(a);f>u&&r.push([u,f])}if(i(s(e.unifiedCount,t.deletions)),i(s(e.unifiedCount+t.deletions,t.additions)),i(s(e.splitCount,t.deletions)),i(s(e.splitCount,t.additions)),r.length===0)return r;r.sort((a,c)=>a[0]-c[0]);const l=[r[0]];for(const[a,c]of r.slice(1)){const u=l[l.length-1];a<=u[1]?u[1]=Math.max(u[1],c):l.push([a,c])}return l}function vu({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:s,index:o,unifiedLineIndex:i,splitLineIndex:l,additionLineIndex:a,deletionLineIndex:c,additionLineNumber:u,deletionLineNumber:f,content:h,isLastContent:d,unifiedCount:p,splitCount:b}){const w=o<h.deletions?i+o:void 0,g=s==="unified"?o>=h.deletions?i+o:void 0:o<h.additions?i+h.deletions+o:void 0,m=s==="unified"?l+(o<h.deletions?o:o-h.deletions):l+o,y=o<h.deletions?c+o:void 0,_=o<h.deletions?f+o:void 0,S=s==="unified"?o>=h.deletions?a+(o-h.deletions):void 0:o<h.additions?a+o:void 0,v=s==="unified"?o>=h.deletions?u+(o-h.deletions):void 0:o<h.additions?u+o:void 0,x=s==="unified"?d&&o===h.deletions-1&&t.noEOFCRDeletions:d&&o===b-1&&t.noEOFCRDeletions,k=s==="unified"?d&&o===p-1&&t.noEOFCRAdditions:d&&o===b-1&&t.noEOFCRAdditions,A=y!=null&&_!=null&&w!=null?{lineNumber:_,lineIndex:y,noEOFCR:x,unifiedLineIndex:w,splitLineIndex:m}:void 0,L=S!=null&&v!=null&&g!=null?{unifiedLineIndex:g,splitLineIndex:m,lineIndex:S,lineNumber:v,noEOFCR:k}:void 0;if(A==null&&L!=null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:L};if(A!=null&&L==null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:A,additionLine:void 0};if(A==null||L==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:A,additionLine:L}}function Ar({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":""},alwaysWrap:!0}}function Ye({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:s=!1}){const o=t[t.length-1];if(o==null||s||!n){t.push([r?0:1,e.value]);return}const i=o[0]===0;if(r===i||r&&e.value.length===1&&!i){o[1]+=e.value;return}t.push([r?0:1,e.value])}const xu={forcePlainText:!1};function Eu(e,t,n,{forcePlainText:r,startingLine:s,totalLines:o,expandedHunks:i,collapsedContextThreshold:l=1}=xu){r?(s??=0,o??=1/0):(s=0,o=1/0);const a=s>0||o<1/0,c=typeof n.theme=="string"?t.getTheme(n.theme).type:void 0,u=zs({theme:n.theme,highlighter:t}),f=r&&!a&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?"none":n.lineDiffType,h={deletionLines:[],additionLines:[]},{maxLineDiffLength:d}=n,p=!r&&!e.isPartial,b=r?i:void 0,w=new Map;function g(y){const _=p?0:y,S=w.get(_)??Au();return w.set(_,S),S}function m(y,_,S,v){if(a){let x=S.at(-1);(x==null||x.targetIndex+x.count!==_)&&(x={targetIndex:_,originalOffset:v.length,count:0},S.push(x)),x.count++}v.push(y)}Cu({diff:e,diffStyle:"both",startingLine:s,totalLines:o,expandedHunks:a?b:!0,collapsedContextThreshold:l,callback:({hunkIndex:y,additionLine:_,deletionLine:S,type:v})=>{const x=g(y),k=_!=null?_.splitLineIndex:S.splitLineIndex;v==="change"&&_!=null&&S!=null&&Iu({additionLine:e.additionLines[_.lineIndex],deletionLine:e.deletionLines[S.lineIndex],deletionLineIndex:x.deletionContent.length,additionLineIndex:x.additionContent.length,deletionDecorations:x.deletionDecorations,additionDecorations:x.additionDecorations,lineDiffType:f,maxLineDiffLength:d}),S!=null&&(m(e.deletionLines[S.lineIndex],S.lineIndex,x.deletionSegments,x.deletionContent),x.deletionInfo.push({type:v==="change"?"change-deletion":v,lineNumber:S.lineNumber,altLineNumber:v==="change"?void 0:_.lineNumber??void 0,lineIndex:`${S.unifiedLineIndex},${k}`})),_!=null&&(m(e.additionLines[_.lineIndex],_.lineIndex,x.additionSegments,x.additionContent),x.additionInfo.push({type:v==="change"?"change-addition":v,lineNumber:_.lineNumber,altLineNumber:v==="change"?void 0:S.lineNumber??void 0,lineIndex:`${_.unifiedLineIndex},${k}`}))}});for(const y of w.values()){if(y.deletionContent.length===0&&y.additionContent.length===0)continue;const _={name:e.prevName??e.name,contents:y.deletionContent.value},S={name:e.name,contents:y.additionContent.value},{deletionLines:v,additionLines:x}=Ru({deletionFile:_,deletionInfo:y.deletionInfo,deletionDecorations:y.deletionDecorations,additionFile:S,additionInfo:y.additionInfo,additionDecorations:y.additionDecorations,highlighter:t,options:n,languageOverride:r?"text":e.lang});if(p){h.deletionLines=v,h.additionLines=x;continue}if(y.deletionSegments.length>0)for(const k of y.deletionSegments)for(let A=0;A<k.count;A++)h.deletionLines[k.targetIndex+A]=v[k.originalOffset+A];else h.deletionLines.push(...v);if(y.additionSegments.length>0)for(const k of y.additionSegments)for(let A=0;A<k.count;A++)h.additionLines[k.targetIndex+A]=x[k.originalOffset+A];else h.additionLines.push(...x)}return{code:h,themeStyles:u,baseThemeType:c}}function Iu({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:s,additionDecorations:o,lineDiffType:i,maxLineDiffLength:l}){if(e==null||t==null||i==="none"||(e=Ge(e),t=Ge(t),e.length>l||t.length>l))return;const a=i==="char"?Zc(e,t):Jc(e,t),c=[],u=[],f=i==="word-alt",h=a.at(-1);for(const p of a){const b=p===h;!p.added&&!p.removed?(Ye({item:p,arr:c,enableJoin:f,isNeutral:!0,isLastItem:b}),Ye({item:p,arr:u,enableJoin:f,isNeutral:!0,isLastItem:b})):p.removed?Ye({item:p,arr:c,enableJoin:f,isLastItem:b}):Ye({item:p,arr:u,enableJoin:f,isLastItem:b})}let d=0;for(const p of c)p[0]===1&&s.push(Ar({line:n,spanStart:d,spanLength:p[1].length})),d+=p[1].length;d=0;for(const p of u)p[0]===1&&o.push(Ar({line:r,spanStart:d,spanLength:p[1].length})),d+=p[1].length}function Au(){return{deletionContent:{push(e){this.value+=e,this.length++},value:"",length:0},additionContent:{push(e){this.value+=e,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Ru({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:s,deletionDecorations:o,additionDecorations:i,languageOverride:l,options:{theme:a=xt,...c}}){const u=l??gn(e.name),f=l??gn(t.name),{state:h,transformers:d}=Ws(c.useTokenTransformer),p=typeof a=="string"?{...c,lang:"text",theme:a,transformers:d,decorations:void 0,defaultColor:!1,cssVariablePrefix:X("token"),tokenizeTimeLimit:0}:{...c,lang:"text",themes:a,transformers:d,decorations:void 0,defaultColor:!1,cssVariablePrefix:X("token"),tokenizeTimeLimit:0};return{deletionLines:e.contents===""?[]:(p.lang=u,h.lineInfo=n,p.decorations=o,mn(s.codeToHast(Ge(e.contents),p))),additionLines:t.contents===""?[]:(p.lang=f,p.decorations=i,h.lineInfo=r,mn(s.codeToHast(Ge(t.contents),p)))}}function Lu({lines:e,startingLine:t=0,totalLines:n=1/0,callback:r}){const s=Math.min(t+n,e.length),o=(()=>{const i=e.at(-1);return i===""||i===`
|
|
154
|
-
`||i===`\r
|
|
155
|
-
`||i==="\r"?Math.max(0,e.length-2):e.length-1})();for(let i=t;i<s;i++){const l=i===o;if(r({lineIndex:i,lineNumber:i+1,content:e[i],isLastLine:l})===!0||l)break}}function Nu(e){return e!==""?e.split(lu):[]}const Tu={forcePlainText:!1};function Pu(e,t,{theme:n=xt,tokenizeMaxLineLength:r,useTokenTransformer:s},{forcePlainText:o,startingLine:i,totalLines:l,lines:a}=Tu){o?(i??=0,l??=1/0):(i=0,l=1/0);const c=i>0||l<1/0,{state:u,transformers:f}=Ws(s),h=o?"text":e.lang??gn(e.name),d=typeof n=="string"?t.getTheme(n).type:void 0,p=zs({theme:n,highlighter:t});u.lineInfo=m=>({type:"context",lineIndex:m-1+i,lineNumber:m+i});const b=typeof n=="string"?{lang:h,theme:n,transformers:f,defaultColor:!1,cssVariablePrefix:X("token"),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:h,themes:n,transformers:f,defaultColor:!1,cssVariablePrefix:X("token"),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},w=mn(t.codeToHast(c?$u(a??Nu(e.contents),i,l):Ge(e.contents),b)),g=c?new Array(i):w;return c&&g.push(...w),{code:g,themeStyles:p,baseThemeType:d}}function $u(e,t,n){let r="";return Lu({lines:e,startingLine:t,totalLines:n,callback({content:s}){r+=s}}),r}let Rr,be={theme:xt,useTokenTransformer:!1,tokenizeMaxLineLength:1e3,lineDiffType:"word-alt",maxLineDiffLength:1e3};self.addEventListener("error",e=>{console.error("[Shiki Worker] Unhandled error:",e.error)});self.addEventListener("message",e=>{Mu(e.data)});async function Mu(e){try{switch(e.type){case"initialize":await Ou(e);break;case"set-render-options":await Du(e);break;case"file":await Bu(e);break;case"diff":await Gu(e);break;default:throw new Error(`Unknown request type: ${e.type}`)}}catch(t){console.error("Worker error:",t),ju(e.id,t)}finally{}}async function Ou({id:e,renderOptions:t,preferredHighlighter:n,resolvedThemes:r,resolvedLanguages:s,customExtensionsVersion:o,customExtensionMap:i}){let l=Et(n);"then"in l&&(l=await l),Ln({customExtensionsVersion:o,customExtensionMap:i}),Us(r,l),s!=null&&Rn(s,l),be=t,postMessage({type:"success",id:e,requestType:"initialize",sentAt:Date.now()})}async function Du({id:e,renderOptions:t,resolvedThemes:n}){let r=Et();"then"in r&&(r=await r),Us(n,r),be=t,postMessage({type:"success",id:e,requestType:"set-render-options",sentAt:Date.now()})}async function Bu({id:e,file:t,resolvedLanguages:n,customExtensionsVersion:r,customExtensionMap:s}){let o=Et();"then"in o&&(o=await o),Ln({customExtensionsVersion:r,customExtensionMap:s}),n!=null&&Rn(n,o);const i={theme:be.theme,useTokenTransformer:be.useTokenTransformer,tokenizeMaxLineLength:be.tokenizeMaxLineLength};Fu(e,Pu(t,o,i),i)}async function Gu({id:e,diff:t,resolvedLanguages:n,customExtensionsVersion:r,customExtensionMap:s}){let o=Et();"then"in o&&(o=await o),Ln({customExtensionsVersion:r,customExtensionMap:s}),n!=null&&Rn(n,o),Uu(e,Eu(t,o,be),be)}function Et(e="shiki-js"){return Rr??=Ga({themes:[],langs:[],engine:e==="shiki-wasm"?jc(import("./wasm-CG6Dc4jp.js")):xc()}),Rr}function Ln({customExtensionsVersion:e,customExtensionMap:t}){if(!(e==null&&t==null)){if(e==null||t==null)throw new Error("Worker request must include both customExtensionsVersion and customExtensionMap");cu(e,t)}}function Fu(e,t,n){postMessage({type:"success",requestType:"file",id:e,result:t,options:n,sentAt:Date.now()})}function Uu(e,t,n){postMessage({type:"success",requestType:"diff",id:e,result:t,options:n,sentAt:Date.now()})}function ju(e,t){const n={type:"error",id:e,error:t instanceof Error?t.message:String(t),stack:t instanceof Error?t.stack:void 0};postMessage(n)}
|