@algochad/archcoder 2.0.2
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 +113 -0
- package/bin/cli-entry.js +55 -0
- package/bin/cli-output.js +145 -0
- package/bin/cli.js +5108 -0
- package/bin/cli.test.js +56 -0
- package/dist/apple-touch-icon-120x120.png +0 -0
- package/dist/apple-touch-icon-152x152.png +0 -0
- package/dist/apple-touch-icon-167x167.png +0 -0
- package/dist/apple-touch-icon-180x180.png +0 -0
- package/dist/apple-touch-icon.png +0 -0
- package/dist/apple-touch-icon.svg +67 -0
- package/dist/assets/MultiRunWindow-BZp3MjJP.js +1 -0
- package/dist/assets/SettingsWindow-DoGYXpX7.js +1 -0
- package/dist/assets/TerminalView-BN7BR5Ff.js +3 -0
- package/dist/assets/TimelineDialog-ZQ33oVQR.js +1 -0
- package/dist/assets/ToolOutputDialog-Blv3pnug.js +16 -0
- package/dist/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- package/dist/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
- package/dist/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
- package/dist/assets/ibm-plex-sans-latin-400-normal-CDDApCn2.woff2 +0 -0
- package/dist/assets/ibm-plex-sans-latin-400-normal-CYLoc0-x.woff +0 -0
- package/dist/assets/ibm-plex-sans-latin-500-normal-6ng42L7E.woff2 +0 -0
- package/dist/assets/ibm-plex-sans-latin-500-normal-BgVn5rGT.woff +0 -0
- package/dist/assets/ibm-plex-sans-latin-600-normal-Cu4Hd6ag.woff +0 -0
- package/dist/assets/ibm-plex-sans-latin-600-normal-CuJfVYMP.woff2 +0 -0
- package/dist/assets/index-CtCEGYrr.css +1 -0
- package/dist/assets/index-o_d2wtWC.js +48 -0
- package/dist/assets/main-5QGBtzdq.css +1 -0
- package/dist/assets/main-B6oiMU86.js +8033 -0
- package/dist/assets/vendor--DbVqbJpV.css +1 -0
- package/dist/assets/vendor-.bun-HTKwyaEM.js +10086 -0
- package/dist/assets/wasm-CG6Dc4jp.js +1 -0
- package/dist/assets/worker-bqd4RMrj.js +155 -0
- package/dist/favicon-16.png +0 -0
- package/dist/favicon-32.png +0 -0
- package/dist/favicon.png +0 -0
- package/dist/favicon.svg +67 -0
- package/dist/index.html +533 -0
- package/dist/logo-dark-192x192.png +0 -0
- package/dist/logo-dark-512x512.svg +16 -0
- package/dist/logo-light-192x192.png +0 -0
- package/dist/logo-light-512x512.svg +16 -0
- package/dist/pwa-192.png +0 -0
- package/dist/pwa-512.png +0 -0
- package/dist/pwa-maskable-192.png +0 -0
- package/dist/pwa-maskable-512.png +0 -0
- package/dist/site.webmanifest +22 -0
- package/dist/sw.js +1 -0
- package/package.json +107 -0
- package/public/apple-touch-icon-120x120.png +0 -0
- package/public/apple-touch-icon-152x152.png +0 -0
- package/public/apple-touch-icon-167x167.png +0 -0
- package/public/apple-touch-icon-180x180.png +0 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/apple-touch-icon.svg +67 -0
- package/public/favicon-16.png +0 -0
- package/public/favicon-32.png +0 -0
- package/public/favicon.png +0 -0
- package/public/favicon.svg +67 -0
- package/public/logo-dark-192x192.png +0 -0
- package/public/logo-dark-512x512.svg +16 -0
- package/public/logo-light-192x192.png +0 -0
- package/public/logo-light-512x512.svg +16 -0
- package/public/pwa-192.png +0 -0
- package/public/pwa-512.png +0 -0
- package/public/pwa-maskable-192.png +0 -0
- package/public/pwa-maskable-512.png +0 -0
- package/public/site.webmanifest +22 -0
- package/server/TERMINAL_INPUT_WS_PROTOCOL.md +44 -0
- package/server/index.d.ts +37 -0
- package/server/index.js +14694 -0
- package/server/lib/cloudflare-tunnel.js +650 -0
- package/server/lib/git/DOCUMENTATION.md +146 -0
- package/server/lib/git/credentials.js +74 -0
- package/server/lib/git/identity-storage.js +110 -0
- package/server/lib/git/index.js +6 -0
- package/server/lib/git/service.js +3117 -0
- package/server/lib/github/DOCUMENTATION.md +170 -0
- package/server/lib/github/auth.js +307 -0
- package/server/lib/github/device-flow.js +50 -0
- package/server/lib/github/index.js +24 -0
- package/server/lib/github/octokit.js +10 -0
- package/server/lib/github/pr-status.js +478 -0
- package/server/lib/github/repo/index.js +55 -0
- package/server/lib/installer/desktop.js +289 -0
- package/server/lib/installer/download.js +208 -0
- package/server/lib/installer/index.js +45 -0
- package/server/lib/installer/platform.js +100 -0
- package/server/lib/notifications/DOCUMENTATION.md +61 -0
- package/server/lib/notifications/index.js +1 -0
- package/server/lib/notifications/message.js +49 -0
- package/server/lib/notifications/message.test.js +59 -0
- package/server/lib/opencode/DOCUMENTATION.md +59 -0
- package/server/lib/opencode/agents.js +634 -0
- package/server/lib/opencode/auth.js +81 -0
- package/server/lib/opencode/commands.js +339 -0
- package/server/lib/opencode/index.js +66 -0
- package/server/lib/opencode/mcp.js +206 -0
- package/server/lib/opencode/providers.js +96 -0
- package/server/lib/opencode/shared.js +527 -0
- package/server/lib/opencode/skills.js +480 -0
- package/server/lib/opencode/tunnel-auth.js +591 -0
- package/server/lib/opencode/ui-auth.js +510 -0
- package/server/lib/package-manager.js +505 -0
- package/server/lib/quota/DOCUMENTATION.md +55 -0
- package/server/lib/quota/index.js +24 -0
- package/server/lib/quota/providers/claude.js +107 -0
- package/server/lib/quota/providers/codex.js +113 -0
- package/server/lib/quota/providers/copilot.js +165 -0
- package/server/lib/quota/providers/google/api.js +92 -0
- package/server/lib/quota/providers/google/auth.js +108 -0
- package/server/lib/quota/providers/google/index.js +124 -0
- package/server/lib/quota/providers/google/transforms.js +109 -0
- package/server/lib/quota/providers/index.js +152 -0
- package/server/lib/quota/providers/interface.js +55 -0
- package/server/lib/quota/providers/kimi.js +108 -0
- package/server/lib/quota/providers/minimax-cn-coding-plan.js +15 -0
- package/server/lib/quota/providers/minimax-coding-plan.js +15 -0
- package/server/lib/quota/providers/minimax-shared.js +136 -0
- package/server/lib/quota/providers/nanogpt.js +124 -0
- package/server/lib/quota/providers/ollama-cloud.js +112 -0
- package/server/lib/quota/providers/openai.js +91 -0
- package/server/lib/quota/providers/openrouter.js +92 -0
- package/server/lib/quota/providers/zai.js +91 -0
- package/server/lib/quota/utils/auth.js +46 -0
- package/server/lib/quota/utils/formatters.js +76 -0
- package/server/lib/quota/utils/index.js +10 -0
- package/server/lib/quota/utils/transformers.js +55 -0
- package/server/lib/skills-catalog/DOCUMENTATION.md +178 -0
- package/server/lib/skills-catalog/cache.js +32 -0
- package/server/lib/skills-catalog/clawdhub/api.js +158 -0
- package/server/lib/skills-catalog/clawdhub/index.js +30 -0
- package/server/lib/skills-catalog/clawdhub/install.js +238 -0
- package/server/lib/skills-catalog/clawdhub/scan.js +113 -0
- package/server/lib/skills-catalog/curated-sources.js +21 -0
- package/server/lib/skills-catalog/git.js +77 -0
- package/server/lib/skills-catalog/index.js +42 -0
- package/server/lib/skills-catalog/install.js +294 -0
- package/server/lib/skills-catalog/scan.js +221 -0
- package/server/lib/skills-catalog/source.js +85 -0
- package/server/lib/terminal/DOCUMENTATION.md +114 -0
- package/server/lib/terminal/index.js +12 -0
- package/server/lib/terminal/input-ws-protocol.js +66 -0
- package/server/lib/terminal/input-ws-protocol.test.js +138 -0
- package/server/lib/tts/DOCUMENTATION.md +134 -0
- package/server/lib/tts/index.js +16 -0
- package/server/lib/tts/service.js +162 -0
- package/server/lib/tts/summarization.js +171 -0
- package/server/lib/tunnels/index.js +166 -0
- package/server/lib/tunnels/providers/cloudflare.js +260 -0
- package/server/lib/tunnels/registry.js +51 -0
- package/server/lib/tunnels/types.js +219 -0
- package/server/lib/utils/lru.js +107 -0
- package/server/lib/utils/sse.js +121 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
let G=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Rs(t){return sn(t)}function sn(t){return Array.isArray(t)?Ns(t):t instanceof RegExp?t:typeof t=="object"?Ps(t):t}function Ns(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=sn(t[n]);return e}function Ps(t){let e={};for(let n in t)e[n]=sn(t[n]);return e}function br(t,...e){return e.forEach(n=>{for(let r in n)t[r]=n[r]}),t}function wr(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?wr(t.substring(0,t.length-1)):t.substr(~e+1)}var _t=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,ze=class{static hasCaptures(t){return t===null?!1:(_t.lastIndex=0,_t.test(t))}static replaceCaptures(t,e,n){return t.replace(_t,(r,s,o,i)=>{let a=n[parseInt(s||o,10)];if(a){let l=e.substring(a.start,a.end);for(;l[0]===".";)l=l.substring(1);switch(i){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return r})}};function Cr(t,e){return t<e?-1:t>e?1:0}function _r(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let s=0;s<n;s++){let o=Cr(t[s],e[s]);if(o!==0)return o}return 0}return n-r}function Sn(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function Sr(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var kr=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},tt=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Ms(t),e)}static createFromParsedTheme(t,e){return Ds(t,e)}_cachedMatchRoot=new kr(t=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,r=this._cachedMatchRoot.get(e).find(s=>$s(t.parent,s.parentScopes));return r?new xr(r.fontStyle,r.foreground,r.background):null}},St=class Ye{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const r of n)e=new Ye(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new Ye(n,e[r]);return n}push(e){return new Ye(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push(r.scopeName),r=r.parent;return r===e?n.reverse():void 0}};function $s(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let r=e[n],s=!1;if(r===">"){if(n===e.length-1)return!1;r=e[++n],s=!0}for(;t&&!Ts(t.scopeName,r);){if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Ts(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var xr=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Ms(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],r=0;for(let s=0,o=e.length;s<o;s++){let i=e[s];if(!i.settings)continue;let a;if(typeof i.scope=="string"){let f=i.scope;f=f.replace(/^[,]+/,""),f=f.replace(/[,]+$/,""),a=f.split(",")}else Array.isArray(i.scope)?a=i.scope:a=[""];let l=-1;if(typeof i.settings.fontStyle=="string"){l=0;let f=i.settings.fontStyle.split(" ");for(let h=0,d=f.length;h<d;h++)switch(f[h]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let c=null;typeof i.settings.foreground=="string"&&Sn(i.settings.foreground)&&(c=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&Sn(i.settings.background)&&(u=i.settings.background);for(let f=0,h=a.length;f<h;f++){let p=a[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 Os(b,w,s,l,c,u)}}return n}var Os=class{constructor(t,e,n,r,s,o){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=s,this.background=o}},j=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(j||{});function Ds(t,e){t.sort((l,c)=>{let u=Cr(l.scope,c.scope);return u!==0||(u=_r(l.parentScopes,c.parentScopes),u!==0)?u:l.index-c.index});let n=0,r="#000000",s="#ffffff";for(;t.length>=1&&t[0].scope==="";){let l=t.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(r=l.foreground),l.background!==null&&(s=l.background)}let o=new Gs(e),i=new xr(n,o.getId(r),o.getId(s)),a=new Fs(new Gt(0,null,-1,0,0),[]);for(let l=0,c=t.length;l<c;l++){let u=t[l];a.insert(0,u.scope,u.parentScopes,u.fontStyle,o.getId(u.foreground),o.getId(u.background))}return new tt(o,i,a)}var Gs=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},Bs=Object.freeze([]),Gt=class vr{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,r,s,o){this.scopeDepth=e,this.parentScopes=n||Bs,this.fontStyle=r,this.foreground=s,this.background=o}clone(){return new vr(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let r=0,s=e.length;r<s;r++)n[r]=e[r].clone();return n}acceptOverwrite(e,n,r,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},Fs=class Bt{constructor(e,n=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,s=0;for(;e.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=e.parentScopes.length||s>=n.parentScopes.length);){const o=n.parentScopes[s].length-e.parentScopes[r].length;if(o!==0)return o;r++,s++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,o;if(r===-1?(s=e,o=""):(s=e.substring(0,r),o=e.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Bt._cmpBySpecificity),n}insert(e,n,r,s,o,i){if(n===""){this._doInsertHere(e,r,s,o,i);return}let a=n.indexOf("."),l,c;a===-1?(l=n,c=""):(l=n.substring(0,a),c=n.substring(a+1));let u;this._children.hasOwnProperty(l)?u=this._children[l]:(u=new Bt(this._mainRule.clone(),Gt.cloneArr(this._rulesWithParentScopes)),this._children[l]=u),u.insert(e+1,c,r,s,o,i)}_doInsertHere(e,n,r,s,o){if(n===null){this._mainRule.acceptOverwrite(e,r,s,o);return}for(let i=0,a=this._rulesWithParentScopes.length;i<a;i++){let l=this._rulesWithParentScopes[i];if(_r(l.parentScopes,n)===0){l.acceptOverwrite(e,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 Gt(e,n,r,s,o))}},ke=class q{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=q.getLanguageId(e),r=q.getTokenType(e),s=q.getFontStyle(e),o=q.getForeground(e),i=q.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:o,background:i})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,r,s,o,i,a){let l=q.getLanguageId(e),c=q.getTokenType(e),u=q.containsBalancedBrackets(e)?1:0,f=q.getFontStyle(e),h=q.getForeground(e),d=q.getBackground(e);return n!==0&&(l=n),r!==8&&(c=r),s!==null&&(u=s?1:0),o!==-1&&(f=o),i!==0&&(h=i),a!==0&&(d=a),(l<<0|c<<8|u<<10|f<<11|h<<15|d<<24)>>>0}};function nt(t,e){const n=[],r=Us(t);let s=r.next();for(;s!==null;){let l=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let c=i();if(n.push({matcher:c,priority:l}),s!==",")break;s=r.next()}return n;function o(){if(s==="-"){s=r.next();const l=o();return c=>!!l&&!l(c)}if(s==="("){s=r.next();const l=a();return s===")"&&(s=r.next()),l}if(kn(s)){const l=[];do l.push(s),s=r.next();while(kn(s));return c=>e(l,c)}return null}function i(){const l=[];let c=o();for(;c;)l.push(c),c=o();return u=>l.every(f=>f(u))}function a(){const l=[];let c=i();for(;c&&(l.push(c),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");c=i()}return u=>l.some(f=>f(u))}}function kn(t){return!!t&&!!t.match(/[\w\.:]+/)}function Us(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const r=n[0];return n=e.exec(t),r}}}function Ir(t){typeof t.dispose=="function"&&t.dispose()}var Te=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},js=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},Ws=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},zs=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Te(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new Ws;for(const n of t)Hs(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof Te){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 Hs(t,e,n,r){const s=n.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const o=n.lookup(e);t instanceof Te?Je({baseGrammar:o,selfGrammar:s},r):Ft(t.ruleName,{baseGrammar:o,selfGrammar:s,repository:s.repository},r);const i=n.injections(t.scopeName);if(i)for(const a of i)r.add(new Te(a))}function Ft(t,e,n){if(e.repository&&e.repository[t]){const r=e.repository[t];rt([r],e,n)}}function Je(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&rt(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&rt(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function rt(t,e,n){for(const r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?br({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&rt(r.patterns,{...e,repository:s},n);const o=r.include;if(!o)continue;const i=Er(o);switch(i.kind){case 0:Je({...e,selfGrammar:e.baseGrammar},n);break;case 1:Je(e,n);break;case 2:Ft(i.ruleName,{...e,repository:s},n);break;case 3:case 4:const a=i.scopeName===e.selfGrammar.scopeName?e.selfGrammar:i.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(a){const l={baseGrammar:e.baseGrammar,selfGrammar:a,repository:s};i.kind===4?Ft(i.ruleName,l,n):Je(l,n)}else i.kind===4?n.add(new js(i.scopeName,i.ruleName)):n.add(new Te(i.scopeName));break}}}var qs=class{kind=0},Vs=class{kind=1},Xs=class{constructor(t){this.ruleName=t}kind=2},Ks=class{constructor(t){this.scopeName=t}kind=3},Zs=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function Er(t){if(t==="$base")return new qs;if(t==="$self")return new Vs;const e=t.indexOf("#");if(e===-1)return new Ks(t);if(e===0)return new Xs(t.substring(1));{const n=t.substring(0,e),r=t.substring(e+1);return new Zs(n,r)}}var Qs=/\\(\d+)/,xn=/\\(\d+)/g,Ys=-1,Ar=-2;var Fe=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,r){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=ze.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=ze.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${wr(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:ze.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:ze.replaceCaptures(this._contentName,t,e)}},Js=class extends Fe{retokenizeCapturedWithRuleId;constructor(t,e,n,r,s){super(t,e,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,r){throw new Error("Not supported!")}},eo=class extends Fe{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,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(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Oe,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},vn=class extends Fe{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Oe,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ut=class extends Fe{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s,o,i,a,l,c){super(t,e,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=a,this.applyEndPatternLast=l||!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(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,r)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Oe;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},st=class extends Fe{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,s,o,i,a,l){super(t,e,n,r),this._begin=new Me(s,this.id),this.beginCaptures=o,this.whileCaptures=a,this._while=new Me(i,Ar),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Oe;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,r){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,r)}_getCachedCompiledWhilePatterns(t,e){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,e||""),this._cachedCompiledWhilePatterns}},Lr=class U{static createCaptureRule(e,n,r,s,o){return e.registerRule(i=>new Js(n,i,r,s,o))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(s=>{if(e.id=s,e.match)return new eo(e.$vscodeTextmateLocation,e.id,e.name,e.match,U._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=br({},r,e.repository));let o=e.patterns;return typeof o>"u"&&e.include&&(o=[{include:e.include}]),new vn(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,U._compilePatterns(o,n,r))}return e.while?new st(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,U._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,U._compileCaptures(e.whileCaptures||e.captures,n,r),U._compilePatterns(e.patterns,n,r)):new Ut(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,U._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,U._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,U._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let s=[];if(e){let o=0;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);a>o&&(o=a)}for(let i=0;i<=o;i++)s[i]=null;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);let l=0;e[i].patterns&&(l=U.getCompiledRuleId(e[i],n,r)),s[a]=U.createCaptureRule(n,e[i].$vscodeTextmateLocation,e[i].name,e[i].contentName,l)}}return s}static _compilePatterns(e,n,r){let s=[];if(e)for(let o=0,i=e.length;o<i;o++){const a=e[o];let l=-1;if(a.include){const c=Er(a.include);switch(c.kind){case 0:case 1:l=U.getCompiledRuleId(r[a.include],n,r);break;case 2:let u=r[c.ruleName];u&&(l=U.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&&(l=U.getCompiledRuleId(p,n,d.repository))}else l=U.getCompiledRuleId(d.repository.$self,n,d.repository);break}}else l=U.getCompiledRuleId(a,n,r);if(l!==-1){const c=n.getRule(l);let u=!1;if((c instanceof vn||c instanceof Ut||c instanceof st)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;s.push(l)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},Me=class Rr{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const r=e.length;let s=0,o=[],i=!1;for(let a=0;a<r;a++)if(e.charAt(a)==="\\"&&a+1<r){const c=e.charAt(a+1);c==="z"?(o.push(e.substring(s,a)),o.push("$(?!\\n)(?<!\\n)"),s=a+2):(c==="A"||c==="G")&&(i=!0),a++}this.hasAnchor=i,s===0?this.source=e:(o.push(e.substring(s,r)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=Qs.test(this.source):this.hasBackReferences=!1}clone(){return new Rr(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(s=>e.substring(s.start,s.end));return xn.lastIndex=0,this.source.replace(xn,(s,o)=>Sr(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 e=[],n=[],r=[],s=[],o,i,a,l;for(o=0,i=this.source.length;o<i;o++)a=this.source.charAt(o),e[o]=a,n[o]=a,r[o]=a,s[o]=a,a==="\\"&&o+1<i&&(l=this.source.charAt(o+1),l==="A"?(e[o+1]="",n[o+1]="",r[o+1]="A",s[o+1]="A"):l==="G"?(e[o+1]="",n[o+1]="G",r[o+1]="",s[o+1]="G"):(e[o+1]=l,n[o+1]=l,r[o+1]=l,s[o+1]=l),o++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},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(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new In(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let r=this._items.map(s=>s.resolveAnchors(e,n));return new In(t,r,this._items.map(s=>s.ruleId))}},In=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
|
|
2
|
+
`)}findNextMatchSync(t,e,n){const r=this.scanner.findNextMatchSync(t,e,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},kt=class{constructor(t,e){this.languageId=t,this.tokenType=e}},to=class jt{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new kt(e,8),this._embeddedLanguagesMatcher=new no(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?jt._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new kt(0,0);_getBasicScopeAttributes=new kr(e=>{const n=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new kt(n,r)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.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/},no=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([n,r])=>Sr(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},En=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function Nr(t,e,n,r,s,o,i,a){const l=e.content.length;let c=!1,u=-1;if(i){const d=ro(t,e,n,r,s,o);s=d.stack,r=d.linePos,n=d.isFirstLine,u=d.anchorPosition}const f=Date.now();for(;!c;){if(a!==0&&Date.now()-f>a)return new En(s,!0);h()}return new En(s,!1);function h(){const d=so(t,e,n,r,s,u);if(!d){o.produce(s,l),c=!0;return}const p=d.captureIndices,b=d.matchedRuleId,w=p&&p.length>0?p[0].end>r:!1;if(b===Ys){const y=s.getRule(t);o.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),Ne(t,e,n,s,o,y.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,l),c=!0;return}}else{const y=t.getRule(b);o.produce(s,p[0].start);const m=s,g=y.getName(e.content,p),S=s.contentNameScopesList.pushAttributed(g,t);if(s=s.push(b,r,u,p[0].end===l,null,S,S),y instanceof Ut){const k=y;Ne(t,e,n,s,o,k.beginCaptures,p),o.produce(s,p[0].end),u=p[0].end;const _=k.getContentName(e.content,p),x=S.pushAttributed(_,t);if(s=s.withContentNameScopesList(x),k.endHasBackReferences&&(s=s.withEndRule(k.getEndWithResolvedBackReferences(e.content,p))),!w&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,l),c=!0;return}}else if(y instanceof st){const k=y;Ne(t,e,n,s,o,k.beginCaptures,p),o.produce(s,p[0].end),u=p[0].end;const _=k.getContentName(e.content,p),x=S.pushAttributed(_,t);if(s=s.withContentNameScopesList(x),k.whileHasBackReferences&&(s=s.withEndRule(k.getWhileWithResolvedBackReferences(e.content,p))),!w&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,l),c=!0;return}}else if(Ne(t,e,n,s,o,y.captures,p),o.produce(s,p[0].end),s=s.pop(),!w){s=s.safePop(),o.produce(s,l),c=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function ro(t,e,n,r,s,o){let i=s.beginRuleCapturedEOL?0:-1;const a=[];for(let l=s;l;l=l.pop()){const c=l.getRule(t);c instanceof st&&a.push({rule:c,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:c,findOptions:u}=ao(l.rule,t,l.stack.endRule,n,r===i),f=c.findNextMatchSync(e,r,u);if(f){if(f.ruleId!==Ar){s=l.stack.pop();break}f.captureIndices&&f.captureIndices.length&&(o.produce(l.stack,f.captureIndices[0].start),Ne(t,e,n,l.stack,o,l.rule.whileCaptures,f.captureIndices),o.produce(l.stack,f.captureIndices[0].end),i=f.captureIndices[0].end,f.captureIndices[0].end>r&&(r=f.captureIndices[0].end,n=!1))}else{s=l.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:i,isFirstLine:n}}function so(t,e,n,r,s,o){const i=oo(t,e,n,r,s,o),a=t.getInjections();if(a.length===0)return i;const l=io(a,t,e,n,r,s,o);if(!l)return i;if(!i)return l;const c=i.captureIndices[0].start,u=l.captureIndices[0].start;return u<c||l.priorityMatch&&u===c?l:i}function oo(t,e,n,r,s,o){const i=s.getRule(t),{ruleScanner:a,findOptions:l}=Pr(i,t,s.endRule,n,r===o),c=a.findNextMatchSync(e,r,l);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function io(t,e,n,r,s,o,i){let a=Number.MAX_VALUE,l=null,c,u=0;const f=o.contentNameScopesList.getScopeNames();for(let h=0,d=t.length;h<d;h++){const p=t[h];if(!p.matcher(f))continue;const b=e.getRule(p.ruleId),{ruleScanner:w,findOptions:y}=Pr(b,e,null,r,s===i),m=w.findNextMatchSync(n,s,y);if(!m)continue;const g=m.captureIndices[0].start;if(!(g>=a)&&(a=g,l=m.captureIndices,c=m.ruleId,u=p.priority,a===s))break}return l?{priorityMatch:u===-1,captureIndices:l,matchedRuleId:c}:null}function Pr(t,e,n,r,s){return{ruleScanner:t.compileAG(e,n,r,s),findOptions:0}}function ao(t,e,n,r,s){return{ruleScanner:t.compileWhileAG(e,n,r,s),findOptions:0}}function Ne(t,e,n,r,s,o,i){if(o.length===0)return;const a=e.content,l=Math.min(o.length,i.length),c=[],u=i[0].end;for(let f=0;f<l;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(a,i),w=r.contentNameScopesList.pushAttributed(b,t),y=h.getContentName(a,i),m=w.pushAttributed(y,t),g=r.push(h.retokenizeCapturedWithRuleId,d.start,-1,!1,null,w,m),S=t.createOnigString(a.substring(0,d.end));Nr(t,S,n&&d.start===0,d.start,g,s,!1,0),Ir(S);continue}const p=h.getName(a,i);if(p!==null){const w=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(p,t);c.push(new lo(w,d.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var lo=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function co(t,e,n,r,s,o,i,a){return new fo(t,e,n,r,s,o,i,a)}function An(t,e,n,r,s){const o=nt(e,ot),i=Lr.getCompiledRuleId(n,r,s.repository);for(const a of o)t.push({debugSelector:e,matcher:a.matcher,ruleId:i,grammar:s,priority:a.priority})}function ot(t,e){if(e.length<t.length)return!1;let n=0;return t.every(r=>{for(let s=n;s<e.length;s++)if(uo(e[s],r))return n=s+1,!0;return!1})}function uo(t,e){if(!t)return!1;if(t===e)return!0;const n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var fo=class{constructor(t,e,n,r,s,o,i,a){if(this._rootScopeName=t,this.balancedBracketSelectors=o,this._onigLib=a,this._basicScopeAttributesProvider=new to(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=Ln(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const l of Object.keys(s)){const c=nt(l,ot);for(const u of c)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[l]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const t of this._ruleId2desc)t&&t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){const t={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},e=[],n=this._rootScopeName,r=t.lookup(n);if(r){const s=r.injections;if(s)for(let i in s)An(e,i,s[i],this,r);const o=this._grammarRepository.injections(n);o&&o.forEach(i=>{const a=this.getExternalGrammar(i);if(a){const l=a.injectionSelector;l&&An(e,l,a,this,a)}})}return e.sort((s,o)=>s.priority-o.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(t){const e=++this._lastRuleId,n=t(e);return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=Ln(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const r=this._tokenize(t,e,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(t,e,n=0){const r=this._tokenize(t,e,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(t,e,n,r){this._rootId===-1&&(this._rootId=Lr.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===Wt.NULL){s=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),f=ke.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=Pe.createRootAndLookUpScopeName(h,f,this):d=Pe.createRoot("unknown",f),e=new Wt(null,this._rootId,-1,-1,!1,null,d,d)}else s=!1,e.reset();t=t+`
|
|
3
|
+
`;const o=this.createOnigString(t),i=o.content.length,a=new po(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),l=Nr(this,o,s,0,e,a,!0,r);return Ir(o),{lineLength:i,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function Ln(t,e){return t=Rs(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var Pe=class Q{constructor(e,n,r){this.parent=e,this.scopePath=n,this.tokenAttributes=r}static fromExtension(e,n){let r=e,s=e?.scopePath??null;for(const o of n)s=St.push(s,o.scopeNames),r=new Q(r,s,o.encodedTokenAttributes);return r}static createRoot(e,n){return new Q(null,new St(null,e),n)}static createRootAndLookUpScopeName(e,n,r){const s=r.getMetadataForScope(e),o=new St(null,e),i=r.themeProvider.themeMatch(o),a=Q.mergeAttributes(n,s,i);return new Q(null,o,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return Q.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,r){let s=-1,o=0,i=0;return r!==null&&(s=r.fontStyle,o=r.foregroundId,i=r.backgroundId),ke.set(e,n.languageId,n.tokenType,null,s,o,i)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return Q._pushAttributed(this,e,n);const r=e.split(/ /g);let s=this;for(const o of r)s=Q._pushAttributed(s,o,n);return s}static _pushAttributed(e,n,r){const s=r.getMetadataForScope(n),o=e.scopePath.push(n),i=r.themeProvider.themeMatch(o),a=Q.mergeAttributes(e.tokenAttributes,s,i);return new Q(e,o,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?n.reverse():void 0}},Wt=class le{constructor(e,n,r,s,o,i,a,l){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=a,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new le(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:le._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?Pe.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){le._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,r,s,o,i,a){return new le(this,e,n,r,s,o,i,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,n){return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new le(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(e,n){const r=Pe.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new le(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Pe.fromExtension(r,n.contentNameScopesList))}},ho=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):nt(n,ot).map(r=>r.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>nt(n,ot).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(const e of this.unbalancedBracketScopes)if(e(t))return!1;for(const e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},po=class{constructor(t,e,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let r=t?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=t?.getScopeNames()??[];for(const i of this._tokenTypeOverrides)i.matcher(o)&&(r=ke.set(r,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(o))}if(s&&(r=ke.set(r,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=e;return}const n=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},go=class{constructor(t,e){this._onigLib=e,this._theme=t}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){this._rawGrammars.set(t.scopeName,t),e&&this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,n,r,s){if(!this._grammars.has(t)){let o=this._rawGrammars.get(t);if(!o)return null;this._grammars.set(t,co(t,o,e,n,r,s,this,this._onigLib))}return this._grammars.get(t)}},mo=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new go(tt.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,n){this._syncRegistry.setTheme(tt.createFromRawTheme(e,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,n,r){return this.loadGrammarWithConfiguration(e,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(e,n,r){return this._loadGrammar(e,n,r.embeddedLanguages,r.tokenTypes,new ho(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,n,r,s,o){const i=new zs(this._syncRegistry,e);for(;i.Q.length>0;)i.Q.map(a=>this._loadSingleGrammar(a.scopeName)),i.processQueue();return this._grammarForScopeName(e,n,r,s,o)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const n=this._options.loadGrammar(e);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(e,n=[],r=0,s=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,r,s)}_grammarForScopeName(e,n=0,r=null,s=null,o=null){return this._syncRegistry.grammarForScopeName(e,n,r,s,o)}},zt=Wt.NULL;const yo=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class Ue{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Ue.prototype.normal={};Ue.prototype.property={};Ue.prototype.space=void 0;function $r(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new Ue(n,r,e)}function Ht(t){return t.toLowerCase()}class W{constructor(e,n){this.attribute=n,this.property=e}}W.prototype.attribute="";W.prototype.booleanish=!1;W.prototype.boolean=!1;W.prototype.commaOrSpaceSeparated=!1;W.prototype.commaSeparated=!1;W.prototype.defined=!1;W.prototype.mustUseProperty=!1;W.prototype.number=!1;W.prototype.overloadedBoolean=!1;W.prototype.property="";W.prototype.spaceSeparated=!1;W.prototype.space=void 0;let bo=0;const E=de(),$=de(),qt=de(),C=de(),R=de(),_e=de(),z=de();function de(){return 2**++bo}var Vt=Object.freeze({__proto__:null,boolean:E,booleanish:$,commaOrSpaceSeparated:z,commaSeparated:_e,number:C,overloadedBoolean:qt,spaceSeparated:R});const xt=Object.keys(Vt);class on extends W{constructor(e,n,r,s){let o=-1;if(super(e,n),Rn(this,"space",s),typeof r=="number")for(;++o<xt.length;){const i=xt[o];Rn(this,xt[o],(r&Vt[i])===Vt[i])}}}on.prototype.defined=!0;function Rn(t,e,n){n&&(t[e]=n)}function ve(t){const e={},n={};for(const[r,s]of Object.entries(t.properties)){const o=new on(r,t.transform(t.attributes||{},r),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),e[r]=o,n[Ht(r)]=r,n[Ht(o.attribute)]=r}return new Ue(e,n,t.space)}const Tr=ve({properties:{ariaActiveDescendant:null,ariaAtomic:$,ariaAutoComplete:null,ariaBusy:$,ariaChecked:$,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:R,ariaCurrent:null,ariaDescribedBy:R,ariaDetails:null,ariaDisabled:$,ariaDropEffect:R,ariaErrorMessage:null,ariaExpanded:$,ariaFlowTo:R,ariaGrabbed:$,ariaHasPopup:null,ariaHidden:$,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:R,ariaLevel:C,ariaLive:null,ariaModal:$,ariaMultiLine:$,ariaMultiSelectable:$,ariaOrientation:null,ariaOwns:R,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:$,ariaReadOnly:$,ariaRelevant:null,ariaRequired:$,ariaRoleDescription:R,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:$,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function Mr(t,e){return e in t?t[e]:e}function Or(t,e){return Mr(t,e.toLowerCase())}const wo=ve({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:_e,acceptCharset:R,accessKey:R,action:null,allow:null,allowFullScreen:E,allowPaymentRequest:E,allowUserMedia:E,alt:null,as:null,async:E,autoCapitalize:null,autoComplete:R,autoFocus:E,autoPlay:E,blocking:R,capture:null,charSet:null,checked:E,cite:null,className:R,cols:C,colSpan:null,content:null,contentEditable:$,controls:E,controlsList:R,coords:C|_e,crossOrigin:null,data:null,dateTime:null,decoding:null,default:E,defer:E,dir:null,dirName:null,disabled:E,download:qt,draggable:$,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:E,formTarget:null,headers:R,height:C,hidden:qt,high:C,href:null,hrefLang:null,htmlFor:R,httpEquiv:R,id:null,imageSizes:null,imageSrcSet:null,inert:E,inputMode:null,integrity:null,is:null,isMap:E,itemId:null,itemProp:R,itemRef:R,itemScope:E,itemType:R,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:R,placeholder:null,playsInline:E,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:E,referrerPolicy:null,rel:R,required:E,reversed:E,rows:C,rowSpan:C,sandbox:R,scope:null,scoped:E,seamless:E,selected:E,shadowRootClonable:E,shadowRootDelegatesFocus:E,shadowRootMode:null,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:$,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:$,width:C,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:R,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:$,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:E,disableRemotePlayback:E,prefix:null,property:null,results:C,security:null,unselectable:null},space:"html",transform:Or}),Co=ve({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",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:z,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:R,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:_e,g2:_e,glyphName:_e,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:z,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,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:R,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:z,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:z,rev:z,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:z,requiredFeatures:z,requiredFonts:z,requiredFormats:z,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:z,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:z,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:z,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:Mr}),Dr=ve({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),Gr=ve({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Or}),Br=ve({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),_o=/[A-Z]/g,Nn=/-[a-z]/g,So=/^data[-\w.:]+$/i;function ko(t,e){const n=Ht(e);let r=e,s=W;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&So.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(Nn,vo);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!Nn.test(o)){let i=o.replace(_o,xo);i.charAt(0)!=="-"&&(i="-"+i),e="data"+i}}s=on}return new s(r,e)}function xo(t){return"-"+t.toLowerCase()}function vo(t){return t.charAt(1).toUpperCase()}const Io=$r([Tr,wo,Dr,Gr,Br],"html"),Fr=$r([Tr,Co,Dr,Gr,Br],"svg"),Pn={}.hasOwnProperty;function Eo(t,e){const n=e||{};function r(s,...o){let i=r.invalid;const a=r.handlers;if(s&&Pn.call(s,t)){const l=String(s[t]);i=Pn.call(a,l)?a[l]: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 Ao=/["&'<>`]/g,Lo=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Ro=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,No=/[|\\{}()[\]^$+*?.]/g,$n=new WeakMap;function Po(t,e){if(t=t.replace(e.subset?$o(e.subset):Ao,r),e.subset||e.escapeOnly)return t;return t.replace(Lo,n).replace(Ro,r);function n(s,o,i){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,i.charCodeAt(o+2),e)}function r(s,o,i){return e.format(s.charCodeAt(0),i.charCodeAt(o+1),e)}}function $o(t){let e=$n.get(t);return e||(e=To(t),$n.set(t,e)),e}function To(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(No,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const Mo=/[\dA-Fa-f]/;function Oo(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!Mo.test(String.fromCharCode(e))?r:r+";"}const Do=/\d/;function Go(t,e,n){const r="&#"+String(t);return n&&e&&!Do.test(String.fromCharCode(e))?r:r+";"}const Bo=["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"],vt={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:"€"},Fo=["cent","copy","divide","gt","lt","not","para","times"],Ur={}.hasOwnProperty,Xt={};let He;for(He in vt)Ur.call(vt,He)&&(Xt[vt[He]]=He);const Uo=/[^\dA-Za-z]/;function jo(t,e,n,r){const s=String.fromCharCode(t);if(Ur.call(Xt,s)){const o=Xt[s],i="&"+o;return n&&Bo.includes(o)&&!Fo.includes(o)&&(!r||e&&e!==61&&Uo.test(String.fromCharCode(e)))?i:i+";"}return""}function Wo(t,e,n){let r=Oo(t,e,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=jo(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const o=Go(t,e,n.omitOptionalSemicolons);o.length<r.length&&(r=o)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function Se(t,e){return Po(t,Object.assign({format:Wo},e))}const zo=/^>|^->|<!--|-->|--!>|<!-$/g,Ho=[">"],qo=["<",">"];function Vo(t,e,n,r){return r.settings.bogusComments?"<?"+Se(t.value,Object.assign({},r.settings.characterReferences,{subset:Ho}))+">":"<!--"+t.value.replace(zo,s)+"-->";function s(o){return Se(o,Object.assign({},r.settings.characterReferences,{subset:qo}))}}function Xo(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}function Tn(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function Ko(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function Zo(t){return t.join(" ").trim()}const Qo=/[ \t\n\f\r]/g;function an(t){return typeof t=="object"?t.type==="text"?Mn(t.value):!1:Mn(t)}function Mn(t){return t.replace(Qo,"")===""}const O=Wr(1),jr=Wr(-1),Yo=[];function Wr(t){return e;function e(n,r,s){const o=n?n.children:Yo;let i=(r||0)+t,a=o[i];if(!s)for(;a&&an(a);)i+=t,a=o[i];return a}}const Jo={}.hasOwnProperty;function zr(t){return e;function e(n,r,s){return Jo.call(t,n.tagName)&&t[n.tagName](n,r,s)}}const ln=zr({body:ti,caption:It,colgroup:It,dd:oi,dt:si,head:It,html:ei,li:ri,optgroup:ii,option:ai,p:ni,rp:On,rt:On,tbody:ci,td:Dn,tfoot:ui,th:Dn,thead:li,tr:fi});function It(t,e,n){const r=O(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&an(r.value.charAt(0)))}function ei(t,e,n){const r=O(n,e);return!r||r.type!=="comment"}function ti(t,e,n){const r=O(n,e);return!r||r.type!=="comment"}function ni(t,e,n){const r=O(n,e);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 ri(t,e,n){const r=O(n,e);return!r||r.type==="element"&&r.tagName==="li"}function si(t,e,n){const r=O(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function oi(t,e,n){const r=O(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function On(t,e,n){const r=O(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function ii(t,e,n){const r=O(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function ai(t,e,n){const r=O(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function li(t,e,n){const r=O(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function ci(t,e,n){const r=O(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function ui(t,e,n){return!O(n,e)}function fi(t,e,n){const r=O(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function Dn(t,e,n){const r=O(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const hi=zr({body:gi,colgroup:mi,head:pi,html:di,tbody:yi});function di(t){const e=O(t,-1);return!e||e.type!=="comment"}function pi(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function gi(t){const e=O(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&an(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function mi(t,e,n){const r=jr(n,e),s=O(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&ln(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function yi(t,e,n){const r=jr(n,e),s=O(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&ln(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const qe={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 bi(t,e,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(t.tagName.toLowerCase());const a=[];let l;s.space==="html"&&t.tagName==="svg"&&(r.schema=Fr);const c=wi(r,t.properties),u=r.all(s.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=s,u&&(i=!1),(c||!o||!hi(t,e,n))&&(a.push("<",t.tagName,c?" "+c:""),i&&(s.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!i&&(!o||!ln(t,e,n))&&a.push("</"+t.tagName+">"),a.join("")}function wi(t,e){const n=[];let r=-1,s;if(e){for(s in e)if(e[s]!==null&&e[s]!==void 0){const o=Ci(t,s,e[s]);o&&n.push(o)}}for(;++r<n.length;){const o=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&o!=='"'&&o!=="'"&&(n[r]+=" ")}return n.join("")}function Ci(t,e,n){const r=ko(t.schema,e),s=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,o=t.settings.allowDangerousCharacters?0:1;let i=t.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=Se(r.attribute,Object.assign({},t.settings.characterReferences,{subset:qe.name[s][o]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Ko:Zo)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?l:(t.settings.preferUnquoted&&(a=Se(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:qe.unquoted[s][o]}))),a!==n&&(t.settings.quoteSmart&&Tn(n,i)>Tn(n,t.alternative)&&(i=t.alternative),a=i+Se(n,Object.assign({},t.settings.characterReferences,{subset:(i==="'"?qe.single:qe.double)[s][o],attribute:!0}))+i),l+(a&&"="+a))}const _i=["<","&"];function Hr(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:Se(t.value,Object.assign({},r.settings.characterReferences,{subset:_i}))}function Si(t,e,n,r){return r.settings.allowDangerousHtml?t.value:Hr(t,e,n,r)}function ki(t,e,n,r){return r.all(t)}const xi=Eo("type",{invalid:vi,unknown:Ii,handlers:{comment:Vo,doctype:Xo,element:bi,raw:Si,root:ki,text:Hr}});function vi(t){throw new Error("Expected node, not `"+t+"`")}function Ii(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const Ei={},Ai={},Li=[];function Ri(t,e){const n=e||Ei,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Ni,all:Pi,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||yo,characterReferences:n.characterReferences||Ai,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Fr:Io,quote:r,alternative:s}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function Ni(t,e,n){return xi(t,e,n,this)}function Pi(t){const e=[],n=t&&t.children||Li;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}function it(t,e){const n=typeof t=="string"?{}:{...t.colorReplacements},r=typeof t=="string"?t:t.name;for(const[s,o]of Object.entries(e?.colorReplacements||{}))typeof o=="string"?n[s]=o:s===r&&Object.assign(n,o);return n}function ie(t,e){return t&&(e?.[t?.toLowerCase()]||t)}function $i(t){return Array.isArray(t)?t:[t]}async function qr(t){return Promise.resolve(typeof t=="function"?t():t).then(e=>e.default||e)}function cn(t){return!t||["plaintext","txt","text","plain"].includes(t)}function Ti(t){return t==="ansi"||cn(t)}function un(t){return t==="none"}function Mi(t){return un(t)}function Vr(t,e){if(!e)return t;t.properties||={},t.properties.class||=[],typeof t.properties.class=="string"&&(t.properties.class=t.properties.class.split(/\s+/g)),Array.isArray(t.properties.class)||(t.properties.class=[]);const n=Array.isArray(e)?e:e.split(/\s+/g);for(const r of n)r&&!t.properties.class.includes(r)&&t.properties.class.push(r);return t}function ht(t,e=!1){if(t.length===0)return[["",0]];const n=t.split(/(\r?\n)/g);let r=0;const s=[];for(let o=0;o<n.length;o+=2){const i=e?n[o]+(n[o+1]||""):n[o];s.push([i,r]),r+=n[o].length,r+=n[o+1]?.length||0}return s}function Oi(t){const e=ht(t,!0).map(([s])=>s);function n(s){if(s===t.length)return{line:e.length-1,character:e[e.length-1].length};let o=s,i=0;for(const a of e){if(o<a.length)break;o-=a.length,i++}return{line:i,character:o}}function r(s,o){let i=0;for(let a=0;a<s;a++)i+=e[a].length;return i+=o,i}return{lines:e,indexToPos:n,posToIndex:r}}const fn="light-dark()",Di=["color","background-color"];function Gi(t,e){let n=0;const r=[];for(const s of e)s>n&&r.push({...t,content:t.content.slice(n,s),offset:t.offset+n}),n=s;return n<t.content.length&&r.push({...t,content:t.content.slice(n),offset:t.offset+n}),r}function Bi(t,e){const n=Array.from(e instanceof Set?e:new Set(e)).sort((r,s)=>r-s);return n.length?t.map(r=>r.flatMap(s=>{const o=n.filter(i=>s.offset<i&&i<s.offset+s.content.length).map(i=>i-s.offset).sort((i,a)=>i-a);return o.length?Gi(s,o):s})):t}function Fi(t,e,n,r,s="css-vars"){const o={content:t.content,explanation:t.explanation,offset:t.offset},i=e.map(u=>at(t.variants[u])),a=new Set(i.flatMap(u=>Object.keys(u))),l={},c=(u,f)=>{const h=f==="color"?"":f==="background-color"?"-bg":`-${f}`;return n+e[u]+(f==="color"?"":h)};return i.forEach((u,f)=>{for(const h of a){const d=u[h]||"inherit";if(f===0&&r&&Di.includes(h))if(r===fn&&i.length>1){const p=e.findIndex(m=>m==="light"),b=e.findIndex(m=>m==="dark");if(p===-1||b===-1)throw new G('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const w=i[p][h]||"inherit",y=i[b][h]||"inherit";l[h]=`light-dark(${w}, ${y})`,s==="css-vars"&&(l[c(f,h)]=d)}else l[h]=d;else s==="css-vars"&&(l[c(f,h)]=d)}}),o.htmlStyle=l,o}function at(t){const e={};if(t.color&&(e.color=t.color),t.bgColor&&(e["background-color"]=t.bgColor),t.fontStyle){t.fontStyle&j.Italic&&(e["font-style"]="italic"),t.fontStyle&j.Bold&&(e["font-weight"]="bold");const n=[];t.fontStyle&j.Underline&&n.push("underline"),t.fontStyle&j.Strikethrough&&n.push("line-through"),n.length&&(e["text-decoration"]=n.join(" "))}return e}function Kt(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}const Xr=new WeakMap;function dt(t,e){Xr.set(t,e)}function De(t){return Xr.get(t)}class Ie{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,n){return new Ie(Object.fromEntries($i(n).map(r=>[r,zt])),e)}constructor(...e){if(e.length===2){const[n,r]=e;this.lang=r,this._stacks=n}else{const[n,r,s]=e;this.lang=r,this._stacks={[s]:n}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return Ui(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function Ui(t){const e=[],n=new Set;function r(s){if(n.has(s))return;n.add(s);const o=s?.nameScopesList?.scopeName;o&&e.push(o),s.parent&&r(s.parent)}return r(t),e}function ji(t,e){if(!(t instanceof Ie))throw new G("Invalid grammar state");return t.getInternalStack(e)}function Wi(){const t=new WeakMap;function e(n){if(!t.has(n.meta)){let r=function(i){if(typeof i=="number"){if(i<0||i>n.source.length)throw new G(`Invalid decoration offset: ${i}. Code length: ${n.source.length}`);return{...s.indexToPos(i),offset:i}}else{const a=s.lines[i.line];if(a===void 0)throw new G(`Invalid decoration position ${JSON.stringify(i)}. Lines length: ${s.lines.length}`);let l=i.character;if(l<0&&(l=a.length+l),l<0||l>a.length)throw new G(`Invalid decoration position ${JSON.stringify(i)}. Line ${i.line} length: ${a.length}`);return{...i,character:l,offset:s.posToIndex(i.line,l)}}};const s=Oi(n.source),o=(n.options.decorations||[]).map(i=>({...i,start:r(i.start),end:r(i.end)}));zi(o),t.set(n.meta,{decorations:o,converter:s,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(!this.options.decorations?.length)return;const s=e(this).decorations.flatMap(i=>[i.start.offset,i.end.offset]);return Bi(n,s)},code(n){if(!this.options.decorations?.length)return;const r=e(this),s=Array.from(n.children).filter(u=>u.type==="element"&&u.tagName==="span");if(s.length!==r.converter.lines.length)throw new G(`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,y=-1;if(f===0&&(w=0),h===0&&(y=0),h===Number.POSITIVE_INFINITY&&(y=p.children.length),w===-1||y===-1)for(let g=0;g<p.children.length;g++)b+=Kr(p.children[g]),w===-1&&b.length===f&&(w=g+1),y===-1&&b.length===h&&(y=g+1);if(w===-1)throw new G(`Failed to find start index for decoration ${JSON.stringify(d.start)}`);if(y===-1)throw new G(`Failed to find end index for decoration ${JSON.stringify(d.end)}`);const m=p.children.slice(w,y);if(!d.alwaysWrap&&m.length===p.children.length)a(p,d,"line");else if(!d.alwaysWrap&&m.length===1&&m[0].type==="element")a(m[0],d,"token");else{const g={type:"element",tagName:"span",properties:{},children:m};a(g,d,"wrapper"),p.children.splice(w,m.length,g)}}function i(u,f){s[u]=a(s[u],f,"line")}function a(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&&Vr(u,f.properties.class),u=p(u,h)||u,u}const l=[],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++)l.unshift(()=>i(d,u));o(h.line,0,h.character,u)}}l.forEach(u=>u())}}}function zi(t){for(let e=0;e<t.length;e++){const n=t[e];if(n.start.offset>n.end.offset)throw new G(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=e+1;r<t.length;r++){const s=t[r],o=n.start.offset<=s.start.offset&&s.start.offset<n.end.offset,i=n.start.offset<s.end.offset&&s.end.offset<=n.end.offset,a=s.start.offset<=n.start.offset&&n.start.offset<s.end.offset,l=s.start.offset<n.end.offset&&n.end.offset<=s.end.offset;if(o||i||a||l){if(o&&i||a&&l||a&&n.start.offset===n.end.offset||i&&s.start.offset===s.end.offset)continue;throw new G(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function Kr(t){return t.type==="text"?t.value:t.type==="element"?t.children.map(Kr).join(""):""}const Hi=[Wi()];function lt(t){const e=qi(t.transformers||[]);return[...e.pre,...e.normal,...e.post,...Hi]}function qi(t){const e=[],n=[],r=[];for(const s of t)switch(s.enforce){case"pre":e.push(s);break;case"post":n.push(s);break;default:r.push(s)}return{pre:e,post:n,normal:r}}var ue=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Et={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Vi(t,e){const n=t.indexOf("\x1B",e);if(n!==-1&&t[n+1]==="["){const r=t.indexOf("m",n);if(r!==-1)return{sequence:t.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:t.length}}function Gn(t){const e=t.shift();if(e==="2"){const n=t.splice(0,3).map(r=>Number.parseInt(r));return n.length!==3||n.some(r=>Number.isNaN(r))?void 0:{type:"rgb",rgb:n}}else if(e==="5"){const n=t.shift();if(n)return{type:"table",index:Number(n)}}}function Xi(t){const e=[];for(;t.length>0;){const n=t.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)e.push({type:"resetAll"});else if(r<=9)Et[r]&&e.push({type:"setDecoration",value:Et[r]});else if(r<=29){const s=Et[r-20];s&&(e.push({type:"resetDecoration",value:s}),s==="dim"&&e.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)e.push({type:"setForegroundColor",value:{type:"named",name:ue[r-30]}});else if(r===38){const s=Gn(t);s&&e.push({type:"setForegroundColor",value:s})}else if(r===39)e.push({type:"resetForegroundColor"});else if(r<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:ue[r-40]}});else if(r===48){const s=Gn(t);s&&e.push({type:"setBackgroundColor",value:s})}else r===49?e.push({type:"resetBackgroundColor"}):r===53?e.push({type:"setDecoration",value:"overline"}):r===55?e.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?e.push({type:"setForegroundColor",value:{type:"named",name:ue[r-90+8]}}):r>=100&&r<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:ue[r-100+8]}})}return e}function Ki(){let t=null,e=null,n=new Set;return{parse(r){const s=[];let o=0;do{const i=Vi(r,o),a=i.sequence?r.substring(o,i.startPosition):r.substring(o);if(a.length>0&&s.push({value:a,foreground:t,background:e,decorations:new Set(n)}),i.sequence){const l=Xi(i.sequence);for(const c of l)c.type==="resetAll"?(t=null,e=null,n.clear()):c.type==="resetForegroundColor"?t=null:c.type==="resetBackgroundColor"?e=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of l)c.type==="setForegroundColor"?t=c.value:c.type==="setBackgroundColor"?e=c.value:c.type==="setDecoration"&&n.add(c.value)}o=i.position}while(o<r.length);return s}}}var Zi={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 Qi(t=Zi){function e(a){return t[a]}function n(a){return`#${a.map(l=>Math.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let c=0;c<ue.length;c++)r.push(e(ue[c]));let a=[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([a[c],a[u],a[f]]));let l=8;for(let c=0;c<24;c++,l+=10)r.push(n([l,l,l]));return r}function o(a){return s()[a]}function i(a){switch(a.type){case"named":return e(a.name);case"rgb":return n(a.rgb);case"table":return o(a.index)}}return{value:i}}const Yi={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 Ji(t,e,n){const r=it(t,n),s=ht(e),o=Object.fromEntries(ue.map(l=>{const c=`terminal.ansi${l[0].toUpperCase()}${l.substring(1)}`,u=t.colors?.[c];return[l,u||Yi[l]]})),i=Qi(o),a=Ki();return s.map(l=>a.parse(l[0]).map(c=>{let u,f;c.decorations.has("reverse")?(u=c.background?i.value(c.background):t.bg,f=c.foreground?i.value(c.foreground):t.fg):(u=c.foreground?i.value(c.foreground):t.fg,f=c.background?i.value(c.background):void 0),u=ie(u,r),f=ie(f,r),c.decorations.has("dim")&&(u=ea(u));let h=j.None;return c.decorations.has("bold")&&(h|=j.Bold),c.decorations.has("italic")&&(h|=j.Italic),c.decorations.has("underline")&&(h|=j.Underline),c.decorations.has("strikethrough")&&(h|=j.Strikethrough),{content:c.value,offset:l[1],color:u,bgColor:f,fontStyle:h}}))}function ea(t){const e=t.match(/#([0-9a-f]{3,8})/i);if(e){const r=e[1];if(r.length===8){const s=Math.round(Number.parseInt(r.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${r.slice(0,6)}${s}`}else{if(r.length===6)return`#${r}80`;if(r.length===4){const s=r[0],o=r[1],i=r[2],a=r[3],l=Math.round(Number.parseInt(`${a}${a}`,16)/2).toString(16).padStart(2,"0");return`#${s}${s}${o}${o}${i}${i}${l}`}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=t.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:t}function hn(t,e,n={}){const{theme:r=t.getLoadedThemes()[0]}=n,s=t.resolveLangAlias(n.lang||"text");if(cn(s)||un(r))return ht(e).map(l=>[{content:l[0],offset:l[1]}]);const{theme:o,colorMap:i}=t.setTheme(r);if(s==="ansi")return Ji(o,e,n);const a=t.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==a.name)throw new G(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(o.name))throw new G(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return na(e,a,o,i,n)}function ta(...t){if(t.length===2)return De(t[1]);const[e,n,r={}]=t,{lang:s="text",theme:o=e.getLoadedThemes()[0]}=r;if(cn(s)||un(o))throw new G("Plain language does not have grammar state");if(s==="ansi")throw new G("ANSI language does not have grammar state");const{theme:i,colorMap:a}=e.setTheme(o),l=e.getLanguage(s);return new Ie(dn(n,l,i,a,r).stateStack,l.name,i.name)}function na(t,e,n,r,s){const o=dn(t,e,n,r,s),i=new Ie(o.stateStack,e.name,n.name);return dt(o.tokens,i),o.tokens}function dn(t,e,n,r,s){const o=it(n,s),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:a=500}=s,l=ht(t);let c=s.grammarState?ji(s.grammarState,n.name)??zt:s.grammarContextCode!=null?dn(s.grammarContextCode,e,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:zt,u=[];const f=[];for(let h=0,d=l.length;h<d;h++){const[p,b]=l[h];if(p===""){u=[],f.push([]);continue}if(i>0&&p.length>=i){u=[],f.push([{content:p,offset:b,color:"",fontStyle:0}]);continue}let w,y,m;s.includeExplanation&&(w=e.tokenizeLine(p,c,a),y=w.tokens,m=0);const g=e.tokenizeLine2(p,c,a),S=g.tokens.length/2;for(let k=0;k<S;k++){const _=g.tokens[2*k],x=k+1<S?g.tokens[2*k+2]:p.length;if(_===x)continue;const v=g.tokens[2*k+1],N=ie(r[ke.getForeground(v)],o),L=ke.getFontStyle(v),F={content:p.substring(_,x),offset:b+_,color:N,fontStyle:L};if(s.includeExplanation){const A=[];if(s.includeExplanation!=="scopeName")for(const K of n.settings){let pe;switch(typeof K.scope){case"string":pe=K.scope.split(/,/).map(Ct=>Ct.trim());break;case"object":pe=K.scope;break;default:continue}A.push({settings:K,selectors:pe.map(Ct=>Ct.split(/ /))})}F.explanation=[];let re=0;for(;_+re<x;){const K=y[m],pe=p.substring(K.startIndex,K.endIndex);re+=pe.length,F.explanation.push({content:pe,scopes:s.includeExplanation==="scopeName"?ra(K.scopes):sa(A,K.scopes)}),m+=1}}u.push(F)}f.push(u),u=[],c=g.ruleStack}return{tokens:f,stateStack:c}}function ra(t){return t.map(e=>({scopeName:e}))}function sa(t,e){const n=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];n[r]={scopeName:o,themeMatches:ia(t,o,e.slice(0,r))}}return n}function Bn(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function oa(t,e,n){if(!Bn(t[t.length-1],e))return!1;let r=t.length-2,s=n.length-1;for(;r>=0&&s>=0;)Bn(t[r],n[s])&&(r-=1),s-=1;return r===-1}function ia(t,e,n){const r=[];for(const{selectors:s,settings:o}of t)for(const i of s)if(oa(i,e,n)){r.push(o);break}return r}function Zr(t,e,n){const r=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),s=r.map(l=>{const c=hn(t,e,{...n,theme:l.theme}),u=De(c),f=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:u,theme:f}}),o=aa(...s.map(l=>l.tokens)),i=o[0].map((l,c)=>l.map((u,f)=>{const h={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in n&&n.includeExplanation&&(h.explanation=u.explanation),o.forEach((d,p)=>{const{content:b,explanation:w,offset:y,...m}=d[c][f];h.variants[r[p].color]=m}),h})),a=s[0].state?new Ie(Object.fromEntries(s.map(l=>[l.theme,l.state?.getInternalStack(l.theme)])),s[0].state.lang):void 0;return a&&dt(i,a),i}function aa(...t){const e=t.map(()=>[]),n=t.length;for(let r=0;r<t[0].length;r++){const s=t.map(l=>l[r]),o=e.map(()=>[]);e.forEach((l,c)=>l.push(o[c]));const i=s.map(()=>0),a=s.map(l=>l[0]);for(;a.every(l=>l);){const l=Math.min(...a.map(c=>c.content.length));for(let c=0;c<n;c++){const u=a[c];u.content.length===l?(o[c].push(u),i[c]+=1,a[c]=s[c][i[c]]):(o[c].push({...u,content:u.content.slice(0,l)}),a[c]={...u,content:u.content.slice(l),offset:u.offset+l})}}}return e}function ct(t,e,n){let r,s,o,i,a,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-",colorsRendering:f="css-vars"}=n,h=Object.entries(n.themes).filter(y=>y[1]).map(y=>({color:y[0],theme:y[1]})).sort((y,m)=>y.color===c?-1:m.color===c?1:0);if(h.length===0)throw new G("`themes` option must not be empty");const d=Zr(t,e,n);if(l=De(d),c&&fn!==c&&!h.find(y=>y.color===c))throw new G(`\`themes\` option must contain the defaultColor key \`${c}\``);const p=h.map(y=>t.getTheme(y.theme)),b=h.map(y=>y.color);o=d.map(y=>y.map(m=>Fi(m,b,u,c,f))),l&&dt(o,l);const w=h.map(y=>it(y.theme,n));s=Fn(h,p,w,u,c,"fg",f),r=Fn(h,p,w,u,c,"bg",f),i=`shiki-themes ${p.map(y=>y.name).join(" ")}`,a=c?void 0:[s,r].join(";")}else if("theme"in n){const c=it(n.theme,n);o=hn(t,e,n);const u=t.getTheme(n.theme);r=ie(u.bg,c),s=ie(u.fg,c),i=u.name,l=De(o)}else throw new G("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:s,bg:r,themeName:i,rootStyle:a,grammarState:l}}function Fn(t,e,n,r,s,o,i){return t.map((a,l)=>{const c=ie(e[l][o],n[l])||"inherit",u=`${r+a.color}${o==="bg"?"-bg":""}:${c}`;if(l===0&&s){if(s===fn&&t.length>1){const f=t.findIndex(b=>b.color==="light"),h=t.findIndex(b=>b.color==="dark");if(f===-1||h===-1)throw new G('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const d=ie(e[f][o],n[f])||"inherit",p=ie(e[h][o],n[h])||"inherit";return`light-dark(${d}, ${p});${u}`}return c}return i==="css-vars"?u:null}).filter(a=>!!a).join(";")}function ut(t,e,n,r={meta:{},options:n,codeToHast:(s,o)=>ut(t,s,o),codeToTokens:(s,o)=>ct(t,s,o)}){let s=e;for(const p of lt(n))s=p.preprocess?.call(r,s,n)||s;let{tokens:o,fg:i,bg:a,themeName:l,rootStyle:c,grammarState:u}=ct(t,s,n);const{mergeWhitespaces:f=!0,mergeSameStyleTokens:h=!1}=n;f===!0?o=ca(o):f==="never"&&(o=ua(o)),h&&(o=fa(o));const d={...r,get source(){return s}};for(const p of lt(n))o=p.tokens?.call(d,o)||o;return la(o,{...n,fg:i,bg:a,themeName:l,rootStyle:n.rootStyle===!1?!1:n.rootStyle??c},d,u)}function la(t,e,n,r=De(t)){const s=lt(e),o=[],i={type:"root",children:[]},{structure:a="classic",tabindex:l="0"}=e,c={class:`shiki ${e.themeName||""}`};e.rootStyle!==!1&&(e.rootStyle!=null?c.style=e.rootStyle:c.style=`background-color:${e.bg};color:${e.fg}`),l!==!1&&l!=null&&(c.tabindex=l.toString());for(const[b,w]of Object.entries(e.meta||{}))b.startsWith("_")||(c[b]=w);let u={type:"element",tagName:"pre",properties:c,children:[],data:e.data},f={type:"element",tagName:"code",properties:{},children:o};const h=[],d={...n,structure:a,addClassToHast:Vr,get source(){return n.source},get tokens(){return t},get options(){return e},get root(){return i},get pre(){return u},get code(){return f},get lines(){return h}};if(t.forEach((b,w)=>{w&&(a==="inline"?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&o.push({type:"text",value:`
|
|
12
|
+
`}));let y={type:"element",tagName:"span",properties:{class:"line"},children:[]},m=0;for(const g of b){let S={type:"element",tagName:"span",properties:{...g.htmlAttrs},children:[{type:"text",value:g.content}]};const k=Kt(g.htmlStyle||at(g));k&&(S.properties.style=k);for(const _ of s)S=_?.span?.call(d,S,w+1,m,y,g)||S;a==="inline"?i.children.push(S):a==="classic"&&y.children.push(S),m+=g.content.length}if(a==="classic"){for(const g of s)y=g?.line?.call(d,y,w+1)||y;h.push(y),o.push(y)}else a==="inline"&&h.push(y)}),a==="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(a==="inline"){const b=[];let w={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const g of i.children)g.type==="element"&&g.tagName==="br"?(b.push(w),w={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(g.type==="element"||g.type==="text")&&w.children.push(g);b.push(w);let m={type:"element",tagName:"code",properties:{},children:b};for(const g of s)m=g?.code?.call(d,m)||m;i.children=[];for(let g=0;g<m.children.length;g++){g>0&&i.children.push({type:"element",tagName:"br",properties:{},children:[]});const S=m.children[g];S.type==="element"&&i.children.push(...S.children)}}let p=i;for(const b of s)p=b?.root?.call(d,p)||p;return r&&dt(p,r),p}function ca(t){return t.map(e=>{const n=[];let r="",s;return e.forEach((o,i)=>{const l=!(o.fontStyle&&(o.fontStyle&j.Underline||o.fontStyle&j.Strikethrough));l&&o.content.match(/^\s+$/)&&e[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 ua(t){return t.map(e=>e.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,s,o,i]=r;if(!s&&!i)return n;const a=[{...n,offset:n.offset+s.length,content:o}];return s&&a.unshift({content:s,offset:n.offset}),i&&a.push({content:i,offset:n.offset+s.length+o.length}),a}))}function fa(t){return t.map(e=>{const n=[];for(const r of e){if(n.length===0){n.push({...r});continue}const s=n[n.length-1],o=Kt(s.htmlStyle||at(s)),i=Kt(r.htmlStyle||at(r)),a=s.fontStyle&&(s.fontStyle&j.Underline||s.fontStyle&j.Strikethrough),l=r.fontStyle&&(r.fontStyle&j.Underline||r.fontStyle&j.Strikethrough);!a&&!l&&o===i?s.content+=r.content:n.push({...r})}return n})}const ha=Ri;function da(t,e,n){const r={meta:{},options:n,codeToHast:(o,i)=>ut(t,o,i),codeToTokens:(o,i)=>ct(t,o,i)};let s=ha(ut(t,e,n,r));for(const o of lt(n))s=o.postprocess?.call(r,s,n)||s;return s}const Un={light:"#333333",dark:"#bbbbbb"},jn={light:"#fffffe",dark:"#1e1e1e"},Wn="__shiki_resolved";function pn(t){if(t?.[Wn])return t;const e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:n,fg:r}=e;if(!n||!r){const a=e.settings?e.settings.find(l=>!l.name&&!l.scope):void 0;a?.settings?.foreground&&(r=a.settings.foreground),a?.settings?.background&&(n=a.settings.background),!r&&e?.colors?.["editor.foreground"]&&(r=e.colors["editor.foreground"]),!n&&e?.colors?.["editor.background"]&&(n=e.colors["editor.background"]),r||(r=e.type==="light"?Un.light:Un.dark),n||(n=e.type==="light"?jn.light:jn.dark),e.fg=r,e.bg=n}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let s=0;const o=new Map;function i(a){if(o.has(a))return o.get(a);s+=1;const l=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return e.colorReplacements?.[`#${l}`]?i(a):(o.set(a,l),l)}e.settings=e.settings.map(a=>{const l=a.settings?.foreground&&!a.settings.foreground.startsWith("#"),c=a.settings?.background&&!a.settings.background.startsWith("#");if(!l&&!c)return a;const u={...a,settings:{...a.settings}};if(l){const f=i(a.settings.foreground);e.colorReplacements[f]=a.settings.foreground,u.settings.foreground=f}if(c){const f=i(a.settings.background);e.colorReplacements[f]=a.settings.background,u.settings.background=f}return u});for(const a of Object.keys(e.colors||{}))if((a==="editor.foreground"||a==="editor.background"||a.startsWith("terminal.ansi"))&&!e.colors[a]?.startsWith("#")){const l=i(e.colors[a]);e.colorReplacements[l]=e.colors[a],e.colors[a]=l}return Object.defineProperty(e,Wn,{enumerable:!1,writable:!1,value:!0}),e}async function Qr(t){return Array.from(new Set((await Promise.all(t.filter(e=>!Ti(e)).map(async e=>await qr(e).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function Yr(t){return(await Promise.all(t.map(async n=>Mi(n)?null:pn(await qr(n))))).filter(n=>!!n)}let pa=3;function ga(t,e=3){e>pa||console.trace(`[SHIKI DEPRECATE]: ${t}`)}let Ce=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Jr(t,e){if(!e)return t;if(e[t]){const n=new Set([t]);for(;e[t];){if(t=e[t],n.has(t))throw new Ce(`Circular alias \`${Array.from(n).join(" -> ")} -> ${t}\``);n.add(t)}}return t}class ma extends mo{constructor(e,n,r,s={}){super(e),this._resolver=e,this._themes=n,this._langs=r,this._alias=s,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const n=pn(e);return n.name&&(this._resolvedThemes.set(n.name,n),this._loadedThemesCache=null),n}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let n=this._textmateThemeCache.get(e);n||(n=tt.createFromRawTheme(e),this._textmateThemeCache.set(e,n)),this._syncRegistry.setTheme(n)}getGrammar(e){return e=Jr(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const n=new Set([...this._langMap.values()].filter(o=>o.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const r={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const s=this.loadGrammarWithConfiguration(e.scopeName,1,r);if(s.name=e.name,this._resolvedGrammars.set(e.name,s),e.aliases&&e.aliases.forEach(o=>{this._alias[o]=e.name}),this._loadedLanguagesCache=null,n.size)for(const o of n)this._resolvedGrammars.delete(o.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(o.scopeName),this._syncRegistry?._grammars?.delete(o.scopeName),this.loadLanguage(this._langMap.get(o.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const s of e)this.resolveEmbeddedLanguages(s);const n=Array.from(this._langGraph.entries()),r=n.filter(([s,o])=>!o);if(r.length){const s=n.filter(([o,i])=>i?(i.embeddedLanguages||i.embeddedLangs)?.some(l=>r.map(([c])=>c).includes(l)):!1).filter(o=>!r.includes(o));throw new Ce(`Missing languages ${r.map(([o])=>`\`${o}\``).join(", ")}, required by ${s.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[s,o]of n)this._resolver.addLanguage(o);for(const[s,o]of n)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);const n=e.embeddedLanguages??e.embeddedLangs;if(n)for(const r of n)this._langGraph.set(r,this._langMap.get(r))}}class ya{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,n){this._onigLib={createOnigScanner:r=>e.createScanner(r),createOnigString:r=>e.createString(r)},n.forEach(r=>this.addLanguage(r))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(n=>{this._langs.set(n,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(e.scopeName)})}getInjections(e){const n=e.split(".");let r=[];for(let s=1;s<=n.length;s++){const o=n.slice(0,s).join(".");r=[...r,...this._injections.get(o)||[]]}return r}}let Le=0;function ba(t){Le+=1,t.warnings!==!1&&Le>=10&&Le%10===0&&console.warn(`[Shiki] ${Le} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let e=!1;if(!t.engine)throw new Ce("`engine` option is required for synchronous mode");const n=(t.langs||[]).flat(1),r=(t.themes||[]).flat(1).map(pn),s=new ya(t.engine,n),o=new ma(s,r,n,t.langAlias);let i;function a(g){return Jr(g,t.langAlias)}function l(g){y();const S=o.getGrammar(typeof g=="string"?g:g.name);if(!S)throw new Ce(`Language \`${g}\` not found, you may need to load it first`);return S}function c(g){if(g==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};y();const S=o.getTheme(g);if(!S)throw new Ce(`Theme \`${g}\` not found, you may need to load it first`);return S}function u(g){y();const S=c(g);i!==g&&(o.setTheme(S),i=g);const k=o.getColorMap();return{theme:S,colorMap:k}}function f(){return y(),o.getLoadedThemes()}function h(){return y(),o.getLoadedLanguages()}function d(...g){y(),o.loadLanguages(g.flat(1))}async function p(...g){return d(await Qr(g))}function b(...g){y();for(const S of g.flat(1))o.loadTheme(S)}async function w(...g){return y(),b(await Yr(g))}function y(){if(e)throw new Ce("Shiki instance has been disposed")}function m(){e||(e=!0,o.dispose(),Le-=1)}return{setTheme:u,getTheme:c,getLanguage:l,getLoadedThemes:f,getLoadedLanguages:h,resolveLangAlias:a,loadLanguage:p,loadLanguageSync:d,loadTheme:w,loadThemeSync:b,dispose:m,[Symbol.dispose]:m}}async function wa(t){t.engine||ga("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[e,n,r]=await Promise.all([Yr(t.themes||[]),Qr(t.langs||[]),t.engine]);return ba({...t,themes:e,langs:n,engine:r})}async function Ca(t){const e=await wa(t);return{getLastGrammarState:(...n)=>ta(e,...n),codeToTokensBase:(n,r)=>hn(e,n,r),codeToTokensWithThemes:(n,r)=>Zr(e,n,r),codeToTokens:(n,r)=>ct(e,n,r),codeToHast:(n,r)=>ut(e,n,r),codeToHtml:(n,r)=>da(e,n,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...e,getInternalContext:()=>e}}function Ee(t){if([...t].length!==1)throw new Error(`Expected "${t}" to be a single code point`);return t.codePointAt(0)}function _a(t,e,n){return t.has(e)||t.set(e,n),t.get(e)}const gn=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),B=String.raw;function Ae(t,e){if(t==null)throw new Error(e??"Value expected");return t}const es=B`\[\^?`,ts=`c.? | C(?:-.?)?|${B`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${B`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${B`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${B`o\{[^\}]*\}?`}|${B`\d{1,3}`}`,mn=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Ve=new RegExp(B`
|
|
13
|
+
\\ (?:
|
|
14
|
+
${ts}
|
|
15
|
+
| [gk]<[^>]*>?
|
|
16
|
+
| [gk]'[^']*'?
|
|
17
|
+
| .
|
|
18
|
+
)
|
|
19
|
+
| \( (?:
|
|
20
|
+
\? (?:
|
|
21
|
+
[:=!>({]
|
|
22
|
+
| <[=!]
|
|
23
|
+
| <[^>]*>
|
|
24
|
+
| '[^']*'
|
|
25
|
+
| ~\|?
|
|
26
|
+
| #(?:[^)\\]|\\.?)*
|
|
27
|
+
| [^:)]*[:)]
|
|
28
|
+
)?
|
|
29
|
+
| \*[^\)]*\)?
|
|
30
|
+
)?
|
|
31
|
+
| (?:${mn.source})+
|
|
32
|
+
| ${es}
|
|
33
|
+
| .
|
|
34
|
+
`.replace(/\s+/g,""),"gsu"),At=new RegExp(B`
|
|
35
|
+
\\ (?:
|
|
36
|
+
${ts}
|
|
37
|
+
| .
|
|
38
|
+
)
|
|
39
|
+
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
40
|
+
| ${es}
|
|
41
|
+
| &&
|
|
42
|
+
| .
|
|
43
|
+
`.replace(/\s+/g,""),"gsu");function Sa(t,e={}){const n={flags:"",...e,rules:{captureGroup:!1,singleline:!1,...e.rules}};if(typeof t!="string")throw new Error("String expected as pattern");const r=Ua(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=[],a;for(Ve.lastIndex=0;a=Ve.exec(t);){const f=ka(o,t,a[0],Ve.lastIndex);f.tokens?i.push(...f.tokens):f.token&&i.push(f.token),f.lastIndex!==void 0&&(Ve.lastIndex=f.lastIndex)}const l=[];let c=0;i.filter(f=>f.type==="GroupOpen").forEach(f=>{f.kind==="capturing"?f.number=++c:f.raw==="("&&l.push(f)}),c||l.forEach((f,h)=>{f.kind="capturing",f.number=h+1});const u=c||l.length;return{tokens:i.map(f=>f.type==="EscapedNumber"?Wa(f,u):f).flat(),flags:r}}function ka(t,e,n,r){const[s,o]=n;if(n==="["||n==="[^"){const i=xa(e,n,r);return{tokens:i.tokens,lastIndex:i.lastIndex}}if(s==="\\"){if("AbBGyYzZ".includes(o))return{token:zn(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:Ta(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:rs(n)}}if(o==="K")return{token:ss("keep",n)};if(o==="N"||o==="R")return{token:fe("newline",n,{negate:o==="N"})};if(o==="O")return{token:fe("any",n)};if(o==="X")return{token:fe("text_segment",n)};const i=ns(n,{inCharClass:!1});return Array.isArray(i)?{tokens:i}:{token:i}}if(s==="("){if(o==="*")return{token:Ga(n)};if(n==="(?{")throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(e[r]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:Da(n,t)};if(t.pushModX(t.getCurrentModX()),t.numOpenGroups++,n==="("&&!t.captureGroup||n==="(?:")return{token:be("group",n)};if(n==="(?>")return{token:be("atomic",n)};if(n==="(?="||n==="(?!"||n==="(?<="||n==="(?<!")return{token:be(n[2]==="<"?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if(n==="("&&t.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:be("capturing",n,{...n!=="("&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if(n==="(?~|")throw new Error(`Unsupported absence function kind "${n}"`);return{token:be("absence_repeater",n)}}throw n==="(?("?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(n===")"){if(t.popModX(),t.numOpenGroups--,t.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:Na(n)}}if(t.getCurrentModX()){if(n==="#"){const i=e.indexOf(`
|
|
44
|
+
`,r);return{lastIndex:i===-1?e.length:i}}if(/^\s$/.test(n)){const i=/\s+/y;return i.lastIndex=r,{lastIndex:i.exec(e)?i.lastIndex:r}}}if(n===".")return{token:fe("dot",n)};if(n==="^"||n==="$"){const i=t.singleline?{"^":B`\A`,$:B`\Z`}[n]:n;return{token:zn(i,n)}}return n==="|"?{token:Ia(n)}:mn.test(n)?{tokens:za(n)}:{token:te(Ee(n),n)}}function xa(t,e,n){const r=[Hn(e[1]==="^",e)];let s=1,o;for(At.lastIndex=n;o=At.exec(t);){const i=o[0];if(i[0]==="["&&i[1]!==":")s++,r.push(Hn(i[1]==="^",i));else if(i==="]"){if(r.at(-1).type==="CharacterClassOpen")r.push(te(93,i));else if(s--,r.push(Ea(i)),!s)break}else{const a=va(i);Array.isArray(a)?r.push(...a):r.push(a)}}return{tokens:r,lastIndex:At.lastIndex||t.length}}function va(t){if(t[0]==="\\")return ns(t,{inCharClass:!0});if(t[0]==="["){const e=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(t);if(!e||!gn.has(e.groups.name))throw new Error(`Invalid POSIX class "${t}"`);return fe("posix",t,{value:e.groups.name,negate:!!e.groups.negate})}return t==="-"?Aa(t):t==="&&"?La(t):te(Ee(t),t)}function ns(t,{inCharClass:e}){const n=t[1];if(n==="c"||n==="C")return Oa(t);if("dDhHsSwW".includes(n))return Ba(t);if(t.startsWith(B`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${t}"`);if(/^\\[pP]\{/.test(t)){if(t.length===3)throw new Error(`Incomplete or invalid Unicode property "${t}"`);return Fa(t)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(t))try{const r=t.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 a=[...o.encode(i)].map(l=>`\\x${l.toString(16)}`).join("");return te(Ee(i),a)})}catch{throw new Error(`Multibyte code "${t}" incomplete or invalid in Oniguruma`)}if(n==="u"||n==="x")return te(ja(t),t);if(qn.has(n))return te(qn.get(n),t);if(/\d/.test(n))return Ra(e,t);if(t==="\\")throw new Error(B`Incomplete escape "\"`);if(n==="M")throw new Error(`Unsupported meta "${t}"`);if([...t].length===2)return te(t.codePointAt(1),t);throw new Error(`Unexpected escape "${t}"`)}function Ia(t){return{type:"Alternator",raw:t}}function zn(t,e){return{type:"Assertion",kind:t,raw:e}}function rs(t){return{type:"Backreference",raw:t}}function te(t,e){return{type:"Character",value:t,raw:e}}function Ea(t){return{type:"CharacterClassClose",raw:t}}function Aa(t){return{type:"CharacterClassHyphen",raw:t}}function La(t){return{type:"CharacterClassIntersector",raw:t}}function Hn(t,e){return{type:"CharacterClassOpen",negate:t,raw:e}}function fe(t,e,n={}){return{type:"CharacterSet",kind:t,...n,raw:e}}function ss(t,e,n={}){return t==="keep"?{type:"Directive",kind:t,raw:e}:{type:"Directive",kind:t,flags:Ae(n.flags),raw:e}}function Ra(t,e){return{type:"EscapedNumber",inCharClass:t,raw:e}}function Na(t){return{type:"GroupClose",raw:t}}function be(t,e,n={}){return{type:"GroupOpen",kind:t,...n,raw:e}}function Pa(t,e,n,r){return{type:"NamedCallout",kind:t,tag:e,arguments:n,raw:r}}function $a(t,e,n,r){return{type:"Quantifier",kind:t,min:e,max:n,raw:r}}function Ta(t){return{type:"Subroutine",raw:t}}const Ma=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),qn=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function Oa(t){const e=t[1]==="c"?t[2]:t[3];if(!e||!/[A-Za-z]/.test(e))throw new Error(`Unsupported control character "${t}"`);return te(Ee(e.toUpperCase())-64,t)}function Da(t,e){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(t).groups;r??="";const s=(e.getCurrentModX()||n.includes("x"))&&!r.includes("x"),o=Xn(n),i=Xn(r),a={};if(o&&(a.enable=o),i&&(a.disable=i),t.endsWith(")"))return e.replaceCurrentModX(s),ss("flags",t,{flags:a});if(t.endsWith(":"))return e.pushModX(s),e.numOpenGroups++,be("group",t,{...(o||i)&&{flags:a}});throw new Error(`Unexpected flag modifier "${t}"`)}function Ga(t){const e=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(t);if(!e)throw new Error(`Incomplete or invalid named callout "${t}"`);const{name:n,tag:r,args:s}=e.groups;if(!n)throw new Error(`Invalid named callout "${t}"`);if(r==="")throw new Error(`Named callout tag with empty value not allowed "${t}"`);const o=s?s.split(",").filter(u=>u!=="").map(u=>/^[+-]?\d+$/.test(u)?+u:u):[],[i,a,l]=o,c=Ma.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 a=="number"||!/^[<>X]$/.test(a)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${a}"`);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 a=="number"||!/^(?:[<>!=]=|[<>])$/.test(a))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${a}"`);if(typeof l=="string"&&!/^[A-Za-z_]\w*$/.test(l))throw new Error(`Named callout argument three must be a tag or number "${l}"`);break;case"custom":throw new Error(`Undefined callout name "${n}"`);default:throw new Error(`Unexpected named callout kind "${c}"`)}return Pa(c,r??null,s?.split(",")??null,t)}function Vn(t){let e=null,n,r;if(t[0]==="{"){const{minStr:s,maxStr:o}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(t).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&&(e="possessive",[n,r]=[r,n]),t.endsWith("?")){if(e==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');e="lazy"}else e||(e="greedy")}else n=t[0]==="+"?1:0,r=t[0]==="?"?1:1/0,e=t[1]==="+"?"possessive":t[1]==="?"?"lazy":"greedy";return $a(e,n,r,t)}function Ba(t){const e=t[1].toLowerCase();return fe({d:"digit",h:"hex",s:"space",w:"word"}[e],t,{negate:t[1]!==e})}function Fa(t){const{p:e,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(t).groups;return fe("property",t,{value:r,negate:e==="P"&&!n||e==="p"&&!!n})}function Xn(t){const e={};return t.includes("i")&&(e.ignoreCase=!0),t.includes("m")&&(e.dotAll=!0),t.includes("x")&&(e.extended=!0),Object.keys(e).length?e:null}function Ua(t){const e={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<t.length;n++){const r=t[n];if(!"imxDPSWy".includes(r))throw new Error(`Invalid flag "${r}"`);if(r==="y"){if(!/^y{[gw]}/.test(t.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');e.textSegmentMode=t[n+2]==="g"?"grapheme":"word",n+=3;continue}e[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[r]]=!0}return e}function ja(t){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(t))throw new Error(`Incomplete or invalid escape "${t}"`);const e=t[2]==="{"?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(t).groups.hex:t.slice(2);return parseInt(e,16)}function Wa(t,e){const{raw:n,inCharClass:r}=t,s=n.slice(1);if(!r&&(s!=="0"&&s.length===1||s[0]!=="0"&&+s<=e))return[rs(n)];const o=[],i=s.match(/^[0-7]+|\d/g);for(let a=0;a<i.length;a++){const l=i[a];let c;if(a===0&&l!=="8"&&l!=="9"){if(c=parseInt(l,8),c>127)throw new Error(B`Octal encoded byte above 177 unsupported "${n}"`)}else c=Ee(l);o.push(te(c,(a===0?"\\":"")+l))}return o}function za(t){const e=[],n=new RegExp(mn,"gy");let r;for(;r=n.exec(t);){const s=r[0];if(s[0]==="{"){const o=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(s);if(o){const{min:i,max:a}=o.groups;if(+i>+a&&s.endsWith("?")){n.lastIndex--,e.push(Vn(s.slice(0,-1)));continue}}}e.push(Vn(s))}return e}function os(t,e){if(!Array.isArray(t.body))throw new Error("Expected node with body array");if(t.body.length!==1)return!1;const n=t.body[0];return!e||Object.keys(e).every(r=>e[r]===n[r])}function Ha(t){return qa.has(t.type)}const qa=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function is(t,e={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e,rules:{captureGroup:!1,singleline:!1,...e.rules}},r=Sa(t,{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 he();case"Assertion":return Va(p);case"Backreference":return Xa(p,o);case"Character":return pt(p.value,{useLastValid:!!d.isCheckingRangeEnd});case"CharacterClassHyphen":return Ka(p,o,d);case"CharacterClassOpen":return Za(p,o,d);case"CharacterSet":return Qa(p,o);case"Directive":return rl(p.kind,{flags:p.flags});case"GroupOpen":return Ya(p,o,d);case"NamedCallout":return ol(p.kind,p.tag,p.arguments);case"Quantifier":return Ja(p,o);case"Subroutine":return el(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=al(sl(r.flags));let a=i.body[0];for(;o.nextIndex<r.tokens.length;){const h=s(a,{});h.type==="Alternative"?(i.body.push(h),a=h):a.body.push(h)}const{capturingGroups:l,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>l.length)throw new Error("Subroutine uses a group number that's not defined");h&&(l[h-1].isSubroutined=!0)}else if(u.has(h)){if(u.get(h).length>1)throw new Error(B`Subroutine uses a duplicate group name "\g<${h}>"`);u.get(h)[0].isSubroutined=!0}else throw new Error(B`Subroutine uses a group name that's not defined "\g<${h}>"`);return i}function Va({kind:t}){return Zt(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"}[t],`Unexpected assertion kind "${t}"`),{negate:t===B`\B`||t===B`\Y`})}function Xa({raw:t},e){const n=/^\\k[<']/.test(t),r=n?t.slice(3,-1):t.slice(1),s=(o,i=!1)=>{const a=e.capturingGroups.length;let l=!1;if(o>a)if(e.skipBackrefValidation)l=!0;else throw new Error(`Not enough capturing groups defined to the left "${t}"`);return e.hasNumberedRef=!0,Qt(i?a+1-o:o,{orphan:l})};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 "${t}"`);if(!e.namedGroupsByName.has(r))throw new Error(`Group name not defined to the left "${t}"`);return Qt(r)}return s(+r)}function Ka(t,e,n){const{tokens:r,walk:s}=e,o=e.parent,i=o.body.at(-1),a=r[e.nextIndex];if(!n.isCheckingRangeEnd&&i&&i.type!=="CharacterClass"&&i.type!=="CharacterClassRange"&&a&&a.type!=="CharacterClassOpen"&&a.type!=="CharacterClassClose"&&a.type!=="CharacterClassIntersector"){const l=s(o,{...n,isCheckingRangeEnd:!0});if(i.type==="Character"&&l.type==="Character")return o.body.pop(),nl(i,l);throw new Error("Invalid character class range")}return pt(Ee("-"))}function Za({negate:t},e,n){const{tokens:r,walk:s}=e,o=r[e.nextIndex],i=[et()];let a=Qn(o);for(;a.type!=="CharacterClassClose";){if(a.type==="CharacterClassIntersector")i.push(et()),e.nextIndex++;else{const c=i.at(-1);c.body.push(s(c,n))}a=Qn(r[e.nextIndex],o)}const l=et({negate:t});return i.length===1?l.body=i[0].body:(l.kind="intersection",l.body=i.map(c=>c.body.length===1?c.body[0]:c)),e.nextIndex++,l}function Qa({kind:t,negate:e,value:n},r){const{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i}=r;if(t==="property"){const a=gt(n);if(gn.has(a)&&!i?.has(a))t="posix",n=a;else return we(n,{negate:e,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i})}return t==="posix"?il(n,{negate:e}):Yt(t,{negate:e})}function Ya(t,e,n){const{tokens:r,capturingGroups:s,namedGroupsByName:o,skipLookbehindValidation:i,walk:a}=e,l=ll(t),c=l.type==="AbsenceFunction",u=Zn(l),f=u&&l.negate;if(l.type==="CapturingGroup"&&(s.push(l),l.name&&_a(o,l.name,[]).push(l)),c&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let h=Yn(r[e.nextIndex]);for(;h.type!=="GroupClose";){if(h.type==="Alternator")l.body.push(he()),e.nextIndex++;else{const d=l.body.at(-1),p=a(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(Kn(p)||p.type==="CapturingGroup")throw new Error(b)}else if(Kn(p)||Zn(p)&&p.negate)throw new Error(b)}}h=Yn(r[e.nextIndex])}return e.nextIndex++,l}function Ja({kind:t,min:e,max:n},r){const s=r.parent,o=s.body.at(-1);if(!o||!Ha(o))throw new Error("Quantifier requires a repeatable token");const i=ls(t,e,n,o);return s.body.pop(),i}function el({raw:t},e){const{capturingGroups:n,subroutines:r}=e;let s=t.slice(3,-1);const o=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);if(o){const a=+o.groups.num,l=n.length;if(e.hasNumberedRef=!0,s={"":a,"+":l+a,"-":l+1-a}[o.groups.sign],s<1)throw new Error("Invalid subroutine number")}else s==="0"&&(s=0);const i=cs(s);return r.push(i),i}function tl(t,e){return{type:"AbsenceFunction",kind:t,body:je(e?.body)}}function he(t){return{type:"Alternative",body:us(t?.body)}}function Zt(t,e){const n={type:"Assertion",kind:t};return(t==="word_boundary"||t==="text_segment_boundary")&&(n.negate=!!e?.negate),n}function Qt(t,e){const n=!!e?.orphan;return{type:"Backreference",ref:t,...n&&{orphan:n}}}function as(t,e){const n={name:void 0,isSubroutined:!1,...e};if(n.name!==void 0&&!cl(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:t,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:je(e?.body)}}function pt(t,e){const n={useLastValid:!1,...e};if(t>1114111){const r=t.toString(16);if(n.useLastValid)t=1114111;else throw t>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:t}}function et(t){const e={kind:"union",negate:!1,...t};return{type:"CharacterClass",kind:e.kind,negate:e.negate,body:us(t?.body)}}function nl(t,e){if(e.value<t.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:t,max:e}}function Yt(t,e){const n=!!e?.negate,r={type:"CharacterSet",kind:t};return(t==="digit"||t==="hex"||t==="newline"||t==="space"||t==="word")&&(r.negate=n),(t==="text_segment"||t==="newline"&&!n)&&(r.variableLength=!0),r}function rl(t,e={}){if(t==="keep")return{type:"Directive",kind:t};if(t==="flags")return{type:"Directive",kind:t,flags:Ae(e.flags)};throw new Error(`Unexpected directive kind "${t}"`)}function sl(t){return{type:"Flags",...t}}function Z(t){const e=t?.atomic,n=t?.flags;if(e&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...e&&{atomic:e},...n&&{flags:n},body:je(t?.body)}}function ce(t){const e={behind:!1,negate:!1,...t};return{type:"LookaroundAssertion",kind:e.behind?"lookbehind":"lookahead",negate:e.negate,body:je(t?.body)}}function ol(t,e,n){return{type:"NamedCallout",kind:t,tag:e,arguments:n}}function il(t,e){const n=!!e?.negate;if(!gn.has(t))throw new Error(`Invalid POSIX class "${t}"`);return{type:"CharacterSet",kind:"posix",value:t,negate:n}}function ls(t,e,n,r){if(e>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:t,min:e,max:n,body:r}}function al(t,e){return{type:"Regex",body:je(e?.body),flags:t}}function cs(t){return{type:"Subroutine",ref:t}}function we(t,e){const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e};let r=n.unicodePropertyMap?.get(gt(t));if(!r){if(n.normalizeUnknownPropertyNames)r=ul(t);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(B`Invalid Unicode property "\p{${t}}"`)}return{type:"CharacterSet",kind:"property",value:r??t,negate:n.negate}}function ll({flags:t,kind:e,name:n,negate:r,number:s}){switch(e){case"absence_repeater":return tl("repeater");case"atomic":return Z({atomic:!0});case"capturing":return as(s,{name:n});case"group":return Z({flags:t});case"lookahead":case"lookbehind":return ce({behind:e==="lookbehind",negate:r});default:throw new Error(`Unexpected group kind "${e}"`)}}function je(t){if(t===void 0)t=[he()];else if(!Array.isArray(t)||!t.length||!t.every(e=>e.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return t}function us(t){if(t===void 0)t=[];else if(!Array.isArray(t)||!t.every(e=>!!e.type))throw new Error("Invalid body; expected array of nodes");return t}function Kn(t){return t.type==="LookaroundAssertion"&&t.kind==="lookahead"}function Zn(t){return t.type==="LookaroundAssertion"&&t.kind==="lookbehind"}function cl(t){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(t)}function ul(t){return t.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function gt(t){return t.replace(/[- _]+/g,"").toLowerCase()}function Qn(t,e){return Ae(t,`${e?.type==="Character"&&e.value===93?"Empty":"Unclosed"} character class`)}function Yn(t){return Ae(t,"Unclosed group")}function $e(t,e,n=null){function r(o,i){for(let a=0;a<o.length;a++){const l=s(o[a],i,a,o);a=Math.max(-1,a+l)}}function s(o,i=null,a=null,l=null){let c=0,u=!1;const f={node:o,parent:i,key:a,container:l,root:t,remove(){Xe(l).splice(Math.max(0,ge(a)+c),1),c--,u=!0},removeAllNextSiblings(){return Xe(l).splice(ge(a)+1)},removeAllPrevSiblings(){const y=ge(a)+c;return c-=y,Xe(l).splice(0,Math.max(0,y))},replaceWith(y,m={}){const g=!!m.traverse;l?l[Math.max(0,ge(a)+c)]=y:Ae(i,"Can't replace root node")[a]=y,g&&s(y,i,a,l),u=!0},replaceWithMultiple(y,m={}){const g=!!m.traverse;if(Xe(l).splice(Math.max(0,ge(a)+c),1,...y),c+=y.length-1,g){let S=0;for(let k=0;k<y.length;k++)S+=s(y[k],i,ge(a)+k+S,l)}u=!0},skip(){u=!0}},{type:h}=o,d=e["*"],p=e[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"CapturingGroup":case"Group":r(o.body,o);break;case"Alternative":case"CharacterClass":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"LookaroundAssertion":r(o.body,o);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(t),t}function Xe(t){if(!Array.isArray(t))throw new Error("Container expected");return t}function ge(t){if(typeof t!="number")throw new Error("Numeric key expected");return t}const fl=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function hl(t,e){for(let n=0;n<t.length;n++)t[n]>=e&&t[n]++}function dl(t,e,n,r){return t.slice(0,e)+r+t.slice(e+n.length)}const X=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function yn(t,e,n,r){const s=new RegExp(String.raw`${e}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1];let i=0,a="";for(const l of t.matchAll(s)){const{0:c,groups:{$skip:u}}=l;if(!u&&(!r||r===X.DEFAULT==!i)){n instanceof Function?a+=n(l,{context:i?X.CHAR_CLASS:X.DEFAULT,negated:o[o.length-1]}):a+=n;continue}c[0]==="["?(i++,o.push(c[1]==="^")):c==="]"&&i&&(i--,o.pop()),a+=c}return a}function fs(t,e,n,r){yn(t,e,n,r)}function pl(t,e,n=0,r){if(!new RegExp(e,"su").test(t))return null;const s=new RegExp(`${e}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=n;let o=0,i;for(;i=s.exec(t);){const{0:a,groups:{$skip:l}}=i;if(!l&&(!r||r===X.DEFAULT==!o))return i;a==="["?o++:a==="]"&&o&&o--,s.lastIndex==i.index&&s.lastIndex++}return null}function Ke(t,e,n){return!!pl(t,e,0,n)}function gl(t,e){const n=/\\?./gsu;n.lastIndex=e;let r=t.length,s=0,o=1,i;for(;i=n.exec(t);){const[a]=i;if(a==="[")s++;else if(s)a==="]"&&s--;else if(a==="(")o++;else if(a===")"&&(o--,!o)){r=i.index;break}}return t.slice(e,r)}const Jn=new RegExp(String.raw`(?<noncapturingStart>${fl})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function ml(t,e){const n=e?.hiddenCaptures??[];let r=e?.captureTransfers??new Map;if(!/\(\?>/.test(t))return{pattern:t,captureTransfers:r,hiddenCaptures:n};const s="(?>",o="(?:(?=(",i=[0],a=[];let l=0,c=0,u=NaN,f;do{f=!1;let h=0,d=0,p=!1,b;for(Jn.lastIndex=Number.isNaN(u)?0:u+o.length;b=Jn.exec(t);){const{0:w,index:y,groups:{capturingStart:m,noncapturingStart:g}}=b;if(w==="[")h++;else if(h)w==="]"&&h--;else if(w===s&&!p)u=y,p=!0;else if(p&&g)d++;else if(m)p?d++:(l++,i.push(l+c));else if(w===")"&&p){if(!d){c++;const S=l+c;if(t=`${t.slice(0,u)}${o}${t.slice(u+s.length,y)}))<$$${S}>)${t.slice(y+1)}`,f=!0,a.push(S),hl(n,S),r.size){const k=new Map;r.forEach((_,x)=>{k.set(x>=S?x+1:x,_.map(v=>v>=S?v+1:v))}),r=k}break}d--}}}while(f);return n.push(...a),t=yn(t,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}`},X.DEFAULT),{pattern:t,captureTransfers:r,hiddenCaptures:n}}const hs=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Lt=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>${hs})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
58
|
+
| \\?.
|
|
59
|
+
`.replace(/\s+/g,""),"gsu");function yl(t){if(!new RegExp(`${hs}\\+`).test(t))return{pattern:t};const e=[];let n=null,r=null,s="",o=0,i;for(Lt.lastIndex=0;i=Lt.exec(t);){const{0:a,index:l,groups:{qBase:c,qMod:u,invalidQ:f}}=i;if(a==="[")o||(r=l),o++;else if(a==="]")o?o--:r=null;else if(!o)if(u==="+"&&s&&!s.startsWith("(")){if(f)throw new Error(`Invalid quantifier "${a}"`);let h=-1;if(/^\{\d+\}$/.test(c))t=dl(t,l+c.length,u,"");else{if(s===")"||s==="]"){const d=s===")"?n:r;if(d===null)throw new Error(`Invalid unmatched "${s}"`);t=`${t.slice(0,d)}(?>${t.slice(d,l)}${c})${t.slice(l+a.length)}`}else t=`${t.slice(0,l-s.length)}(?>${s}${c})${t.slice(l+a.length)}`;h+=4}Lt.lastIndex+=h}else a[0]==="("?e.push(l):a===")"&&(n=e.length?e.pop():null);s=a}return{pattern:t}}const V=String.raw,bl=V`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,Jt=V`\(\?R=(?<rDepth>[^\)]+)\)|${bl}`,mt=V`\(\?<(?![=!])(?<captureName>[^>]+)>`,ds=V`${mt}|(?<unnamed>\()(?!\?)`,ae=new RegExp(V`${mt}|${Jt}|\(\?|\\?.`,"gsu"),Rt="Cannot use multiple overlapping recursions";function wl(t,e){const{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:"plugin",...e};let s=e?.captureTransfers??new Map;if(!new RegExp(Jt,"su").test(t))return{pattern:t,captureTransfers:s,hiddenCaptures:n};if(r==="plugin"&&Ke(t,V`\(\?\(DEFINE\)`,X.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const o=[],i=Ke(t,V`\\[1-9]`,X.DEFAULT),a=new Map,l=[];let c=!1,u=0,f=0,h;for(ae.lastIndex=0;h=ae.exec(t);){const{0:d,groups:{captureName:p,rDepth:b,gRNameOrNum:w,gRDepth:y}}=h;if(d==="[")u++;else if(u)d==="]"&&u--;else if(b){if(er(b),c)throw new Error(Rt);if(i)throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);const m=t.slice(0,h.index),g=t.slice(ae.lastIndex);if(Ke(g,Jt,X.DEFAULT))throw new Error(Rt);const S=+b-1;t=tr(m,g,S,!1,n,o,f),s=rr(s,m,S,o.length,0,f);break}else if(w){er(y);let m=!1;for(const A of l)if(A.name===w||A.num===+w){if(m=!0,A.hasRecursedWithin)throw new Error(Rt);break}if(!m)throw new Error(V`Recursive \g cannot be used outside the referenced group "${r==="external"?w:V`\g<${w}&R=${y}>`}"`);const g=a.get(w),S=gl(t,g);if(i&&Ke(S,V`${mt}|\((?!\?)`,X.DEFAULT))throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);const k=t.slice(g,h.index),_=S.slice(k.length+d.length),x=o.length,v=+y-1,N=tr(k,_,v,!0,n,o,f);s=rr(s,k,v,o.length-x,x,f);const L=t.slice(0,g),F=t.slice(g+S.length);t=`${L}${N}${F}`,ae.lastIndex+=N.length-d.length-k.length-_.length,l.forEach(A=>A.hasRecursedWithin=!0),c=!0}else if(p)f++,a.set(String(f),ae.lastIndex),a.set(p,ae.lastIndex),l.push({num:f,name:p});else if(d[0]==="("){const m=d==="(";m&&(f++,a.set(String(f),ae.lastIndex)),l.push(m?{num:f}:{})}else d===")"&&l.pop()}return n.push(...o),{pattern:t,captureTransfers:s,hiddenCaptures:n}}function er(t){const e=`Max depth must be integer between 2 and 100; used ${t}`;if(!/^[1-9]\d*$/.test(t))throw new Error(e);if(t=+t,t<2||t>100)throw new Error(e)}function tr(t,e,n,r,s,o,i){const a=new Set;r&&fs(t+e,mt,({groups:{captureName:c}})=>{a.add(c)},X.DEFAULT);const l=[n,r?a:null,s,o,i];return`${t}${nr(`(?:${t}`,"forward",...l)}(?:)${nr(`${e})`,"backward",...l)}${e}`}function nr(t,e,n,r,s,o,i){const l=u=>e==="forward"?u+2:n-u+2-1;let c="";for(let u=0;u<n;u++){const f=l(u);c+=yn(t,V`${ds}|\\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 y=i+o.length+1;return o.push(y),Cl(s,y),p?h:`(?<${d}${w}>`}return V`\k<${b}${w}>`},X.DEFAULT)}return c}function Cl(t,e){for(let n=0;n<t.length;n++)t[n]>=e&&t[n]++}function rr(t,e,n,r,s,o){if(t.size&&r){let i=0;fs(e,ds,()=>i++,X.DEFAULT);const a=o-i+s,l=new Map;return t.forEach((c,u)=>{const f=(r-i*n)/n,h=i*n,d=u>a+i?u+r:u,p=[];for(const b of c)if(b<=a)p.push(b);else if(b>a+i+f)p.push(b+r);else if(b<=a+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);l.set(d,p)}),l}return t}var T=String.fromCodePoint,I=String.raw,ne={flagGroups:(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),unicodeSets:(()=>{try{new RegExp("[[]]","v")}catch{return!1}return!0})()};ne.bugFlagVLiteralHyphenIsRange=ne.unicodeSets?(()=>{try{new RegExp(I`[\d\-a]`,"v")}catch{return!0}return!1})():!1;ne.bugNestedClassIgnoresNegation=ne.unicodeSets&&new RegExp("[[^a]]","v").test("a");function ft(t,{enable:e,disable:n}){return{dotAll:!n?.dotAll&&!!(e?.dotAll||t.dotAll),ignoreCase:!n?.ignoreCase&&!!(e?.ignoreCase||t.ignoreCase)}}function Ge(t,e,n){return t.has(e)||t.set(e,n),t.get(e)}function en(t,e){return sr[t]>=sr[e]}function _l(t,e){if(t==null)throw new Error(e??"Value expected");return t}var sr={ES2025:2025,ES2024:2024,ES2018:2018},Sl={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function ps(t={}){if({}.toString.call(t)!=="[object Object]")throw new Error("Unexpected options");if(t.target!==void 0&&!Sl[t.target])throw new Error(`Unexpected target "${t.target}"`);const e={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...t,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...t.rules}};return e.target==="auto"&&(e.target=ne.flagGroups?"ES2025":ne.unicodeSets?"ES2024":"ES2018"),e}var kl="[ -\r ]",xl=new Set([T(304),T(305)]),J=I`[\p{L}\p{M}\p{N}\p{Pc}]`;function gs(t){if(xl.has(t))return[t];const e=new Set,n=t.toLowerCase(),r=n.toUpperCase(),s=El.get(n),o=vl.get(n),i=Il.get(n);return[...r].length===1&&e.add(r),i&&e.add(i),s&&e.add(s),e.add(n),o&&e.add(o),[...e]}var bn=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(t=>[gt(t),t])),vl=new Map([["s",T(383)],[T(383),"s"]]),Il=new Map([[T(223),T(7838)],[T(107),T(8490)],[T(229),T(8491)],[T(969),T(8486)]]),El=new Map([se(453),se(456),se(459),se(498),...Nt(8072,8079),...Nt(8088,8095),...Nt(8104,8111),se(8124),se(8140),se(8188)]),Al=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 Ll(t,e){const n=[];for(let r=t;r<=e;r++)n.push(r);return n}function se(t){const e=T(t);return[e.toLowerCase(),e]}function Nt(t,e){return Ll(t,e).map(n=>se(n))}var ms=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function Rl(t,e){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...e};ys(t);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:en(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:t.flags.digitIsAscii,spaceIsAscii:t.flags.spaceIsAscii,wordIsAscii:t.flags.wordIsAscii};$e(t,Nl,r);const s={dotAll:t.flags.dotAll,ignoreCase:t.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};$e(t,Pl,o);const i={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return $e(t,$l,i),t._originMap=o.groupOriginByCopy,t._strategy=r.strategy,t}var Nl={AbsenceFunction({node:t,parent:e,replaceWith:n}){const{body:r,kind:s}=t;if(s==="repeater"){const o=Z();o.body[0].body.push(ce({negate:!0,body:r}),we("Any"));const i=Z();i.body[0].body.push(ls("greedy",0,1/0,o)),n(P(i,e),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:t,parent:e,key:n},{flagDirectivesByAlt:r}){const s=t.body.filter(o=>o.kind==="flags");for(let o=n+1;o<e.body.length;o++){const i=e.body[o];Ge(r,i,[]).push(...s)}},exit({node:t},{flagDirectivesByAlt:e}){if(e.get(t)?.length){const n=ws(e.get(t));if(n){const r=Z({flags:n});r.body[0].body=t.body,t.body=[P(r,t)]}}}},Assertion({node:t,parent:e,key:n,container:r,root:s,remove:o,replaceWith:i},a){const{kind:l,negate:c}=t,{asciiWordBoundaries:u,avoidSubclass:f,supportedGNodes:h,wordIsAscii:d}=a;if(l==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${c?"Y":"y"}"`);if(l==="line_end")i(P(ce({body:[he({body:[Zt("string_end")]}),he({body:[pt(10)]})]}),e));else if(l==="line_start")i(P(ee(I`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),e));else if(l==="search_start")if(h.has(t))s.flags.sticky=!0,o();else{const p=r[n-1];if(p&&Bl(p))i(P(ce({negate:!0}),e));else{if(f)throw new Error(I`Uses "\G" in a way that requires a subclass`);i(oe(Zt("string_start"),e)),a.strategy="clip_search"}}else if(!(l==="string_end"||l==="string_start"))if(l==="string_end_newline")i(P(ee(I`(?=\n?\z)`),e));else if(l==="word_boundary"){if(!d&&!u){const p=`(?:(?<=${J})(?!${J})|(?<!${J})(?=${J}))`,b=`(?:(?<=${J})(?=${J})|(?<!${J})(?!${J}))`;i(P(ee(c?b:p),e))}}else throw new Error(`Unexpected assertion kind "${l}"`)},Backreference({node:t},{jsGroupNameMap:e}){let{ref:n}=t;typeof n=="string"&&!$t(n)&&(n=Pt(n,e),t.ref=n)},CapturingGroup({node:t},{jsGroupNameMap:e,subroutineRefMap:n}){let{name:r}=t;r&&!$t(r)&&(r=Pt(r,e),t.name=r),n.set(t.number,t),r&&n.set(r,t)},CharacterClassRange({node:t,parent:e,replaceWith:n}){if(e.kind==="intersection"){const r=et({body:[t]});n(P(r,e),{traverse:!0})}},CharacterSet({node:t,parent:e,replaceWith:n},{accuracy:r,minTargetEs2024:s,digitIsAscii:o,spaceIsAscii:i,wordIsAscii:a}){const{kind:l,negate:c,value:u}=t;if(o&&(l==="digit"||u==="digit")){n(oe(Yt("digit",{negate:c}),e));return}if(i&&(l==="space"||u==="space")){n(P(Tt(ee(kl),c),e));return}if(a&&(l==="word"||u==="word")){n(oe(Yt("word",{negate:c}),e));return}if(l==="any")n(oe(we("Any"),e));else if(l==="digit")n(oe(we("Nd",{negate:c}),e));else if(l!=="dot")if(l==="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(P(ee(I`(?>\r\n|${s?I`\p{RGI_Emoji}`:h}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),e))}else if(l==="hex")n(oe(we("AHex",{negate:c}),e));else if(l==="newline")n(P(ee(c?`[^
|
|
150
|
+
]`:`(?>\r
|
|
151
|
+
?|[
|
|
152
|
+
\v\f
\u2028\u2029])`),e));else if(l==="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-${T(f.codePointAt(0)-1)}${T(f.codePointAt(2)+1)}-`),n(P(ee(`[${f}]`),e))}else n(P(Tt(ee(Al.get(u)),c),e));else if(l==="property")bn.has(gt(u))||(t.key="sc");else if(l==="space")n(oe(we("space",{negate:c}),e));else if(l==="word")n(P(Tt(ee(J),c),e));else throw new Error(`Unexpected character set kind "${l}"`)},Directive({node:t,parent:e,root:n,remove:r,replaceWith:s,removeAllPrevSiblings:o,removeAllNextSiblings:i}){const{kind:a,flags:l}=t;if(a==="flags")if(!l.enable&&!l.disable)r();else{const c=Z({flags:l});c.body[0].body=i(),s(P(c,e),{traverse:!0})}else if(a==="keep"){const c=n.body[0],f=n.body.length===1&&os(c,{type:"Group"})&&c.body[0].body.length===1?c.body[0]:n;if(e.parent!==f||f.body.length>1)throw new Error(I`Uses "\K" in a way that's unsupported`);const h=ce({behind:!0});h.body[0].body=o(),s(P(h,e))}else throw new Error(`Unexpected directive kind "${a}"`)},Flags({node:t,parent:e}){if(t.posixIsAscii)throw new Error('Unsupported flag "P"');if(t.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(n=>delete t[n]),Object.assign(t,{global:!1,hasIndices:!1,multiline:!1,sticky:t.sticky??!1}),e.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:t}){if(!t.flags)return;const{enable:e,disable:n}=t.flags;e?.extended&&delete e.extended,n?.extended&&delete n.extended,e?.dotAll&&n?.dotAll&&delete e.dotAll,e?.ignoreCase&&n?.ignoreCase&&delete e.ignoreCase,e&&!Object.keys(e).length&&delete t.flags.enable,n&&!Object.keys(n).length&&delete t.flags.disable,!t.flags.enable&&!t.flags.disable&&delete t.flags},LookaroundAssertion({node:t},e){const{kind:n}=t;n==="lookbehind"&&(e.passedLookbehind=!0)},NamedCallout({node:t,parent:e,replaceWith:n}){const{kind:r}=t;if(r==="fail")n(P(ce({negate:!0}),e));else throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:t}){if(t.body.type==="Quantifier"){const e=Z();e.body[0].body.push(t.body),t.body=P(e,t)}},Regex:{enter({node:t},{supportedGNodes:e}){const n=[];let r=!1,s=!1;for(const o of t.body)if(o.body.length===1&&o.body[0].kind==="search_start")o.body.pop();else{const i=_s(o.body);i?(r=!0,Array.isArray(i)?n.push(...i):n.push(i)):s=!0}r&&!s&&n.forEach(o=>e.add(o))},exit(t,{accuracy:e,passedLookbehind:n,strategy:r}){if(e==="strict"&&n&&r)throw new Error(I`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:t},{jsGroupNameMap:e}){let{ref:n}=t;typeof n=="string"&&!$t(n)&&(n=Pt(n,e),t.ref=n)}},Pl={Backreference({node:t},{multiplexCapturesToLeftByRef:e,reffedNodesByReferencer:n}){const{orphan:r,ref:s}=t;r||n.set(t,[...e.get(s).map(({node:o})=>o)])},CapturingGroup:{enter({node:t,parent:e,replaceWith:n,skip:r},{groupOriginByCopy:s,groupsByName:o,multiplexCapturesToLeftByRef:i,openRefs:a,reffedNodesByReferencer:l}){const c=s.get(t);if(c&&a.has(t.number)){const f=oe(or(t.number),e);l.set(f,a.get(t.number)),n(f);return}a.set(t.number,t),i.set(t.number,[]),t.name&&Ge(i,t.name,[]);const u=i.get(t.name??t.number);for(let f=0;f<u.length;f++){const h=u[f];if(c===h.node||c&&c===h.origin||t===h.origin){u.splice(f,1);break}}if(i.get(t.number).push({node:t,origin:c}),t.name&&i.get(t.name).push({node:t,origin:c}),t.name){const f=Ge(o,t.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(t.name).set(t,{node:t,hasDuplicateNameToRemove:h})}},exit({node:t},{openRefs:e}){e.delete(t.number)}},Group:{enter({node:t},e){e.prevFlags=e.currentFlags,t.flags&&(e.currentFlags=ft(e.currentFlags,t.flags))},exit(t,e){e.currentFlags=e.prevFlags}},Subroutine({node:t,parent:e,replaceWith:n},r){const{isRecursive:s,ref:o}=t;if(s){let u=e;for(;(u=u.parent)&&!(u.type==="CapturingGroup"&&(u.name===o||u.number===o)););r.reffedNodesByReferencer.set(t,u);return}const i=r.subroutineRefMap.get(o),a=o===0,l=a?or(0):bs(i,r.groupOriginByCopy,null);let c=l;if(!a){const u=ws(Ol(i,h=>h.type==="Group"&&!!h.flags)),f=u?ft(r.globalFlags,u):r.globalFlags;Tl(f,r.currentFlags)||(c=Z({flags:Dl(f)}),c.body[0].body.push(l))}n(P(c,e),{traverse:!a})}},$l={Backreference({node:t,parent:e,replaceWith:n},r){if(t.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,t.ref);return}const o=r.reffedNodesByReferencer.get(t).filter(i=>Ml(i,t));if(!o.length)n(P(ce({negate:!0}),e));else if(o.length>1){const i=Z({atomic:!0,body:o.reverse().map(a=>he({body:[Qt(a.number)]}))});n(P(i,e))}else t.ref=o[0].number},CapturingGroup({node:t},e){t.number=++e.numCapturesToLeft,t.name&&e.groupsByName.get(t.name).get(t).hasDuplicateNameToRemove&&delete t.name},Regex:{exit({node:t},e){const n=Math.max(e.highestOrphanBackref-e.numCapturesToLeft,0);for(let r=0;r<n;r++){const s=as();t.body.at(-1).body.push(s)}}},Subroutine({node:t},e){!t.isRecursive||t.ref===0||(t.ref=e.reffedNodesByReferencer.get(t).number)}};function ys(t){$e(t,{"*"({node:e,parent:n}){e.parent=n}})}function Tl(t,e){return t.dotAll===e.dotAll&&t.ignoreCase===e.ignoreCase}function Ml(t,e){let n=e;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===t)return!1;const r=Cs(n.parent);for(const s of r){if(s===n)break;if(s===t||Ss(s,t))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function bs(t,e,n,r){const s=Array.isArray(t)?[]:{};for(const[o,i]of Object.entries(t))o==="parent"?s.parent=Array.isArray(n)?r:n:i&&typeof i=="object"?s[o]=bs(i,e,s,n):(o==="type"&&i==="CapturingGroup"&&e.set(s,e.get(t)??t),s[o]=i);return s}function or(t){const e=cs(t);return e.isRecursive=!0,e}function Ol(t,e){const n=[];for(;t=t.parent;)(!e||e(t))&&n.push(t);return n}function Pt(t,e){if(e.has(t))return e.get(t);const n=`$${e.size}_${t.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return e.set(t,n),n}function ws(t){const e=["dotAll","ignoreCase"],n={enable:{},disable:{}};return t.forEach(({flags:r})=>{e.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 Dl({dotAll:t,ignoreCase:e}){const n={};return(t||e)&&(n.enable={},t&&(n.enable.dotAll=!0),e&&(n.enable.ignoreCase=!0)),(!t||!e)&&(n.disable={},!t&&(n.disable.dotAll=!0),!e&&(n.disable.ignoreCase=!0)),n}function Cs(t){if(!t)throw new Error("Node expected");const{body:e}=t;return Array.isArray(e)?e:e?[e]:null}function _s(t){const e=t.find(n=>n.kind==="search_start"||Fl(n,{negate:!1})||!Gl(n));if(!e)return null;if(e.kind==="search_start")return e;if(e.type==="LookaroundAssertion")return e.body[0].body[0];if(e.type==="CapturingGroup"||e.type==="Group"){const n=[];for(const r of e.body){const s=_s(r.body);if(!s)return null;Array.isArray(s)?n.push(...s):n.push(s)}return n}return null}function Ss(t,e){const n=Cs(t)??[];for(const r of n)if(r===e||Ss(r,e))return!0;return!1}function Gl({type:t}){return t==="Assertion"||t==="Directive"||t==="LookaroundAssertion"}function Bl(t){const e=["Character","CharacterClass","CharacterSet"];return e.includes(t.type)||t.type==="Quantifier"&&t.min&&e.includes(t.body.type)}function Fl(t,e){const n={negate:null,...e};return t.type==="LookaroundAssertion"&&(n.negate===null||t.negate===n.negate)&&t.body.length===1&&os(t.body[0],{type:"Assertion",kind:"search_start"})}function $t(t){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(t)}function ee(t,e){const r=is(t,{...e,unicodePropertyMap:bn}).body;return r.length>1||r[0].body.length>1?Z({body:r}):r[0].body[0]}function Tt(t,e){return t.negate=e,t}function oe(t,e){return t.parent=e,t}function P(t,e){return ys(t),t.parent=e,t}function Ul(t,e){const n=ps(e),r=en(n.target,"ES2024"),s=en(n.target,"ES2025"),o=n.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw new Error("Invalid recursionLimit; use 2-20");let i=null,a=null;if(!s){const d=[t.flags.ignoreCase];$e(t,jl,{getCurrentModI:()=>d.at(-1),popModI(){d.pop()},pushModI(p){d.push(p)},setHasCasedChar(){d.at(-1)?i=!0:a=!0}})}const l={dotAll:t.flags.dotAll,ignoreCase:!!((t.flags.ignoreCase||i)&&!a)};let c=t;const u={accuracy:n.accuracy,appliedGlobalFlags:l,captureMap:new Map,currentFlags:{dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},inCharClass:!1,lastNode:c,originMap:t._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!s&&i&&a),useFlagMods:s,useFlagV:r,verbose:n.verbose};function f(d){return u.lastNode=c,c=d,_l(Wl[d.type],`Unexpected node type "${d.type}"`)(d,u,f)}const h={pattern:t.body.map(f).join("|"),flags:f(t.flags),options:{...t.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&&Ge(h._captureTransfers,d.transferTo,[]).push(p)}),h}var jl={"*":{enter({node:t},e){if(ar(t)){const n=e.getCurrentModI();e.pushModI(t.flags?ft({ignoreCase:n},t.flags).ignoreCase:n)}},exit({node:t},e){ar(t)&&e.popModI()}},Backreference(t,e){e.setHasCasedChar()},Character({node:t},e){wn(T(t.value))&&e.setHasCasedChar()},CharacterClassRange({node:t,skip:e},n){e(),ks(t,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:t},e){t.kind==="property"&&ms.has(t.value)&&e.setHasCasedChar()}},Wl={Alternative({body:t},e,n){return t.map(n).join("")},Assertion({kind:t,negate:e}){if(t==="string_end")return"$";if(t==="string_start")return"^";if(t==="word_boundary")return e?I`\B`:I`\b`;throw new Error(`Unexpected assertion kind "${t}"`)},Backreference({ref:t},e){if(typeof t!="number")throw new Error("Unexpected named backref in transformed AST");if(!e.useFlagMods&&e.accuracy==="strict"&&e.currentFlags.ignoreCase&&!e.captureMap.get(t).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+t},CapturingGroup(t,e,n){const{body:r,name:s,number:o}=t,i={ignoreCase:e.currentFlags.ignoreCase},a=e.originMap.get(t);return a&&(i.hidden=!0,o>a.number&&(i.transferTo=a.number)),e.captureMap.set(o,i),`(${s?`?<${s}>`:""}${r.map(n).join("|")})`},Character({value:t},e){const n=T(t),r=me(t,{escDigit:e.lastNode.type==="Backreference",inCharClass:e.inCharClass,useFlagV:e.useFlagV});if(r!==n)return r;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase&&wn(n)){const s=gs(n);return e.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return n},CharacterClass(t,e,n){const{kind:r,negate:s,parent:o}=t;let{body:i}=t;if(r==="intersection"&&!e.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");ne.bugFlagVLiteralHyphenIsRange&&e.useFlagV&&i.some(lr)&&(i=[pt(45),...i.filter(c=>!lr(c))]);const a=()=>`[${s?"^":""}${i.map(n).join(r==="intersection"?"&&":"")}]`;if(!e.inCharClass){if((!e.useFlagV||ne.bugNestedClassIgnoresNegation)&&!s){const u=i.filter(f=>f.type==="CharacterClass"&&f.kind==="union"&&f.negate);if(u.length){const f=Z(),h=f.body[0];return f.parent=o,h.parent=f,i=i.filter(d=>!u.includes(d)),t.body=i,i.length?(t.parent=h,h.body.push(t)):f.body.pop(),u.forEach(d=>{const p=he({body:[d]});d.parent=p,p.parent=f,f.body.push(p)}),n(f)}}e.inCharClass=!0;const c=a();return e.inCharClass=!1,c}const l=i[0];if(r==="union"&&!s&&l&&((!e.useFlagV||!e.verbose)&&o.kind==="union"&&!(ne.bugFlagVLiteralHyphenIsRange&&e.useFlagV)||!e.verbose&&o.kind==="intersection"&&i.length===1&&l.type!=="CharacterClassRange"))return i.map(n).join("");if(!e.useFlagV&&o.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return a()},CharacterClassRange(t,e){const n=t.min.value,r=t.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:e.useFlagV},o=me(n,s),i=me(r,s),a=new Set;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase){const l=ks(t);Xl(l).forEach(u=>{a.add(Array.isArray(u)?`${me(u[0],s)}-${me(u[1],s)}`:me(u,s))})}return`${o}-${i}${[...a].join("")}`},CharacterSet({kind:t,negate:e,value:n,key:r},s){if(t==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":I`[^\n]`;if(t==="digit")return e?I`\D`:I`\d`;if(t==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&ms.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${e?I`\P`:I`\p`}{${r?`${r}=`:""}${n}}`}if(t==="word")return e?I`\W`:I`\w`;throw new Error(`Unexpected character set kind "${t}"`)},Flags(t,e){return(e.appliedGlobalFlags.ignoreCase?"i":"")+(t.dotAll?"s":"")+(t.sticky?"y":"")},Group({atomic:t,body:e,flags:n,parent:r},s,o){const i=s.currentFlags;n&&(s.currentFlags=ft(i,n));const a=e.map(o).join("|"),l=!s.verbose&&e.length===1&&r.type!=="Quantifier"&&!t&&(!s.useFlagMods||!n)?a:`(?${Kl(t,n,s.useFlagMods)}${a})`;return s.currentFlags=i,l},LookaroundAssertion({body:t,kind:e,negate:n},r,s){return`(?${`${e==="lookahead"?"":"<"}${n?"!":"="}`}${t.map(s).join("|")})`},Quantifier(t,e,n){return n(t.body)+Zl(t)},Subroutine({isRecursive:t,ref:e},n){if(!t)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return e===0?`(?R=${r})`:I`\g<${e}&R=${r}>`}},zl=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),Hl=new Set(["-","\\","]","^","["]),ql=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),ir=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`]]),Vl=/^\p{Cased}$/u;function wn(t){return Vl.test(t)}function ks(t,e){const n=!!e?.firstOnly,r=t.min.value,s=t.max.value,o=[];if(r<65&&(s===65535||s>=131071)||r===65536&&s>=131071)return o;for(let i=r;i<=s;i++){const a=T(i);if(!wn(a))continue;const l=gs(a).filter(c=>{const u=c.codePointAt(0);return u<r||u>s});if(l.length&&(o.push(...l),n))break}return o}function me(t,{escDigit:e,inCharClass:n,useFlagV:r}){if(ir.has(t))return ir.get(t);if(t<32||t>126&&t<160||t>262143||e&&Ql(t))return t>255?`\\u{${t.toString(16).toUpperCase()}}`:`\\x${t.toString(16).toUpperCase().padStart(2,"0")}`;const s=n?r?ql:Hl:zl,o=T(t);return(s.has(o)?"\\":"")+o}function Xl(t){const e=t.map(s=>s.codePointAt(0)).sort((s,o)=>s-o),n=[];let r=null;for(let s=0;s<e.length;s++)e[s+1]===e[s]+1?r??=e[s]:r===null?n.push(e[s]):(n.push([r,e[s]]),r=null);return n}function Kl(t,e,n){if(t)return">";let r="";if(e&&n){const{enable:s,disable:o}=e;r=(s?.ignoreCase?"i":"")+(s?.dotAll?"s":"")+(o?"-":"")+(o?.ignoreCase?"i":"")+(o?.dotAll?"s":"")}return`${r}:`}function Zl({kind:t,max:e,min:n}){let r;return!n&&e===1?r="?":!n&&e===1/0?r="*":n===1&&e===1/0?r="+":n===e?r=`{${n}}`:r=`{${n},${e===1/0?"":e}}`,r+{greedy:"",lazy:"?",possessive:"+"}[t]}function ar({type:t}){return t==="CapturingGroup"||t==="Group"||t==="LookaroundAssertion"}function Ql(t){return t>47&&t<58}function lr({type:t,value:e}){return t==="Character"&&e===45}var Yl=class tn extends RegExp{#t=new Map;#e=null;#r;#n=null;#s=null;rawOptions={};get source(){return this.#r||"(?:)"}constructor(e,n,r){const s=!!r?.lazyCompile;if(e instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");const o=e;super(o,n),this.#r=o.source,o instanceof tn&&(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?"":e,n),this.#r=e,this.#t=ec(o.hiddenCaptures,o.transfers),this.#s=o.strategy,this.rawOptions=r??{}}s||(this.#e=this)}exec(e){if(!this.#e){const{lazyCompile:s,...o}=this.rawOptions;this.#e=new tn(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(e.slice(r));return s&&(Jl(s,r,e,this.hasIndices),this.lastIndex+=r),s}return this.#o(e)}#o(e){this.#e.lastIndex=this.lastIndex;const n=super.exec.call(this.#e,e);if(this.lastIndex=this.#e.lastIndex,!n||!this.#t.size)return n;const r=[...n];n.length=1;let s;this.hasIndices&&(s=[...n.indices],n.indices.length=1);const o=[0];for(let i=1;i<r.length;i++){const{hidden:a,transferTo:l}=this.#t.get(i)??{};if(a?o.push(null):(o.push(n.length),n.push(r[i]),this.hasIndices&&n.indices.push(s[i])),l&&r[i]!==void 0){const c=o[l];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=tc(this.source));const u=this.#n.get(l);u&&(n.groups[u]=r[i],this.hasIndices&&(n.indices.groups[u]=s[i]))}}}return n}};function Jl(t,e,n,r){if(t.index+=e,t.input=n,r){const s=t.indices;for(let i=0;i<s.length;i++){const a=s[i];a&&(s[i]=[a[0]+e,a[1]+e])}const o=s.groups;o&&Object.keys(o).forEach(i=>{const a=o[i];a&&(o[i]=[a[0]+e,a[1]+e])})}}function ec(t,e){const n=new Map;for(const r of t)n.set(r,{hidden:!0});for(const[r,s]of e)for(const o of s)Ge(n,o,{}).transferTo=r;return n}function tc(t){const e=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r=0,s=0,o;for(;o=e.exec(t);){const{0:i,groups:{capture:a,name:l}}=o;i==="["?r++:r?i==="]"&&r--:a&&(s++,l&&n.set(s,l))}return n}function nc(t,e){const n=rc(t,e);return n.options?new Yl(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function rc(t,e){const n=ps(e),r=is(t,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:bn}),s=Rl(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),o=Ul(s,n),i=wl(o.pattern,{captureTransfers:o._captureTransfers,hiddenCaptures:o._hiddenCaptures,mode:"external"}),a=yl(i.pattern),l=ml(a.pattern,{captureTransfers:i.captureTransfers,hiddenCaptures:i.hiddenCaptures}),c={pattern:l.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=l.hiddenCaptures.sort((p,b)=>p-b),f=Array.from(l.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}const cr=4294967295;class sc{constructor(e,n={}){this.patterns=e,this.options=n;const{forgiving:r=!1,cache:s,regexConstructor:o}=n;if(!o)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(i=>{if(typeof i!="string")return i;const a=s?.get(i);if(a){if(a instanceof RegExp)return a;if(r)return null;throw a}try{const l=o(i);return s?.set(i,l),l}catch(l){if(s?.set(i,l),r)return null;throw l}})}regexps;findNextMatchSync(e,n,r){const s=typeof e=="string"?e:e.content,o=[];function i(a,l,c=0){return{index:a,captureIndices:l.indices.map(u=>u==null?{start:cr,end:cr,length:0}:{start:u[0]+c,end:u[1]+c,length:u[1]-u[0]})}}for(let a=0;a<this.regexps.length;a++){const l=this.regexps[a];if(l)try{l.lastIndex=n;const c=l.exec(s);if(!c)continue;if(c.index===n)return i(a,c,0);o.push([a,c,0])}catch(c){if(this.options.forgiving)continue;throw c}}if(o.length){const a=Math.min(...o.map(l=>l[1].index));for(const[l,c,u]of o)if(c.index===a)return i(l,c,u)}return null}}function oc(t,e){return nc(t,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...e})}function ic(t={}){const e=Object.assign({target:"auto",cache:new Map},t);return e.regexConstructor||=n=>oc(n,{target:e.target}),{createScanner(n){return new sc(n,e)},createString(n){return{content:n}}}}class Cn extends Error{constructor(e){super(e),this.name="ShikiError"}}function ac(){return 2147483648}function lc(){return typeof performance<"u"?performance.now():Date.now()}const cc=(t,e)=>t+(e-t%e)%e;async function uc(t){let e,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 e.grow(d-n.byteLength+65535>>>16),s(e.buffer),1}catch{}}function a(d){const p=r.HEAPU8.length;d=d>>>0;const b=ac();if(d>b)return!1;for(let w=1;w<=4;w*=2){let y=p*(1+.2/w);y=Math.min(y,d+100663296);const m=Math.min(b,cc(Math.max(d,y),65536));if(i(m))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(d,p,b=1024){const w=p+b;let y=p;for(;d[y]&&!(y>=w);)++y;if(y-p>16&&d.buffer&&l)return l.decode(d.subarray(p,y));let m="";for(;p<y;){let g=d[p++];if(!(g&128)){m+=String.fromCharCode(g);continue}const S=d[p++]&63;if((g&224)===192){m+=String.fromCharCode((g&31)<<6|S);continue}const k=d[p++]&63;if((g&240)===224?g=(g&15)<<12|S<<6|k:g=(g&7)<<18|S<<12|k<<6|d[p++]&63,g<65536)m+=String.fromCharCode(g);else{const _=g-65536;m+=String.fromCharCode(55296|_>>10,56320|_&1023)}}return m}function u(d,p){return d?c(r.HEAPU8,d,p):""}const f={emscripten_get_now:lc,emscripten_memcpy_big:o,emscripten_resize_heap:a,fd_write:()=>0};async function h(){const p=await t({env:f,wasi_snapshot_preview1:f});e=p.memory,s(e.buffer),Object.assign(r,p),r.UTF8ToString=u}return await h(),r}var fc=Object.defineProperty,hc=(t,e,n)=>e in t?fc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,M=(t,e,n)=>hc(t,typeof e!="symbol"?e+"":e,n);let D=null;function dc(t){throw new Cn(t.UTF8ToString(t.getLastOnigError()))}class yt{constructor(e){M(this,"utf16Length"),M(this,"utf8Length"),M(this,"utf16Value"),M(this,"utf8Value"),M(this,"utf16OffsetToUtf8"),M(this,"utf8OffsetToUtf16");const n=e.length,r=yt._utf8ByteLength(e),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 a=new Uint8Array(r);let l=0;for(let c=0;c<n;c++){const u=e.charCodeAt(c);let f=u,h=!1;if(u>=55296&&u<=56319&&c+1<n){const d=e.charCodeAt(c+1);d>=56320&&d<=57343&&(f=(u-55296<<10)+65536|d-56320,h=!0)}s&&(o[c]=l,h&&(o[c+1]=l),f<=127?i[l+0]=c:f<=2047?(i[l+0]=c,i[l+1]=c):f<=65535?(i[l+0]=c,i[l+1]=c,i[l+2]=c):(i[l+0]=c,i[l+1]=c,i[l+2]=c,i[l+3]=c)),f<=127?a[l++]=f:f<=2047?(a[l++]=192|(f&1984)>>>6,a[l++]=128|(f&63)>>>0):f<=65535?(a[l++]=224|(f&61440)>>>12,a[l++]=128|(f&4032)>>>6,a[l++]=128|(f&63)>>>0):(a[l++]=240|(f&1835008)>>>18,a[l++]=128|(f&258048)>>>12,a[l++]=128|(f&4032)>>>6,a[l++]=128|(f&63)>>>0),h&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=e,this.utf8Value=a,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=i}static _utf8ByteLength(e){let n=0;for(let r=0,s=e.length;r<s;r++){const o=e.charCodeAt(r);let i=o,a=!1;if(o>=55296&&o<=56319&&r+1<s){const l=e.charCodeAt(r+1);l>=56320&&l<=57343&&(i=(o-55296<<10)+65536|l-56320,a=!0)}i<=127?n+=1:i<=2047?n+=2:i<=65535?n+=3:n+=4,a&&r++}return n}createString(e){const n=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,n),n}}const bt=class Y{constructor(e){if(M(this,"id",++Y.LAST_ID),M(this,"_onigBinding"),M(this,"content"),M(this,"utf16Length"),M(this,"utf8Length"),M(this,"utf16OffsetToUtf8"),M(this,"utf8OffsetToUtf16"),M(this,"ptr"),!D)throw new Cn("Must invoke loadWasm first.");this._onigBinding=D,this.content=e;const n=new yt(e);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!Y._sharedPtrInUse?(Y._sharedPtr||(Y._sharedPtr=D.omalloc(1e4)),Y._sharedPtrInUse=!0,D.HEAPU8.set(n.utf8Value,Y._sharedPtr),this.ptr=Y._sharedPtr):this.ptr=n.createString(D)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===Y._sharedPtr?Y._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};M(bt,"LAST_ID",0);M(bt,"_sharedPtr",0);M(bt,"_sharedPtrInUse",!1);let xs=bt;class pc{constructor(e){if(M(this,"_onigBinding"),M(this,"_ptr"),!D)throw new Cn("Must invoke loadWasm first.");const n=[],r=[];for(let a=0,l=e.length;a<l;a++){const c=new yt(e[a]);n[a]=c.createString(D),r[a]=c.utf8Length}const s=D.omalloc(4*e.length);D.HEAPU32.set(n,s/4);const o=D.omalloc(4*e.length);D.HEAPU32.set(r,o/4);const i=D.createOnigScanner(s,o,e.length);for(let a=0,l=e.length;a<l;a++)D.ofree(n[a]);D.ofree(o),D.ofree(s),i===0&&dc(D),this._onigBinding=D,this._ptr=i}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,n,r){let s=0;if(typeof r=="number"&&(s=r),typeof e=="string"){e=new xs(e);const o=this._findNextMatchSync(e,n,!1,s);return e.dispose(),o}return this._findNextMatchSync(e,n,!1,s)}_findNextMatchSync(e,n,r,s){const o=this._onigBinding,i=o.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(n),s);if(i===0)return null;const a=o.HEAPU32;let l=i/4;const c=a[l++],u=a[l++],f=[];for(let h=0;h<u;h++){const d=e.convertUtf8OffsetToUtf16(a[l++]),p=e.convertUtf8OffsetToUtf16(a[l++]);f[h]={start:d,end:p,length:p-d}}return{index:c,captureIndices:f}}}function gc(t){return typeof t.instantiator=="function"}function mc(t){return typeof t.default=="function"}function yc(t){return typeof t.data<"u"}function bc(t){return typeof Response<"u"&&t instanceof Response}function wc(t){return typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||ArrayBuffer.isView(t))||typeof Buffer<"u"&&Buffer.isBuffer?.(t)||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&t instanceof Uint32Array}let Ze;function Cc(t){if(Ze)return Ze;async function e(){D=await uc(async n=>{let r=t;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),gc(r)?r=await r.instantiator(n):mc(r)?r=await r.default(n):(yc(r)&&(r=r.data),bc(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await _c(r)(n):r=await Sc(r)(n):wc(r)?r=await Mt(r)(n):r instanceof WebAssembly.Module?r=await Mt(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await Mt(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Ze=e(),Ze}function Mt(t){return e=>WebAssembly.instantiate(t,e)}function _c(t){return e=>WebAssembly.instantiateStreaming(t,e)}function Sc(t){return async e=>{const n=await t.arrayBuffer();return WebAssembly.instantiate(n,e)}}async function kc(t){return t&&await Cc(t),{createScanner(e){return new pc(e.map(n=>typeof n=="string"?n:n.source))},createString(e){return new xs(e)}}}class vs{diff(e,n,r={}){let s;typeof r=="function"?(s=r,r={}):"callback"in r&&(s=r.callback);const o=this.castInput(e,r),i=this.castInput(n,r),a=this.removeEmpty(this.tokenize(o,r)),l=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(a,l,r,s)}diffWithOptionsObj(e,n,r,s){var o;const i=m=>{if(m=this.postProcess(m,r),s){setTimeout(function(){s(m)},0);return}else return m},a=n.length,l=e.length;let c=1,u=a+l;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,e,0,r);if(d[0].oldPos+1>=l&&p+1>=a)return i(this.buildValues(d[0].lastComponent,n,e));let b=-1/0,w=1/0;const y=()=>{for(let m=Math.max(b,-c);m<=Math.min(w,c);m+=2){let g;const S=d[m-1],k=d[m+1];S&&(d[m-1]=void 0);let _=!1;if(k){const v=k.oldPos-m;_=k&&0<=v&&v<a}const x=S&&S.oldPos+1<l;if(!_&&!x){d[m]=void 0;continue}if(!x||_&&S.oldPos<k.oldPos?g=this.addToPath(k,!0,!1,0,r):g=this.addToPath(S,!1,!0,1,r),p=this.extractCommon(g,n,e,m,r),g.oldPos+1>=l&&p+1>=a)return i(this.buildValues(g.lastComponent,n,e))||!0;d[m]=g,g.oldPos+1>=l&&(w=Math.min(w,m-1)),p+1>=a&&(b=Math.max(b,m+1))}c++};if(s)(function m(){setTimeout(function(){if(c>u||Date.now()>h)return s(void 0);y()||m()},0)})();else for(;c<=u&&Date.now()<=h;){const m=y();if(m)return m}}addToPath(e,n,r,s,o){const i=e.lastComponent;return i&&!o.oneChangePerToken&&i.added===n&&i.removed===r?{oldPos:e.oldPos+s,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}}extractCommon(e,n,r,s,o){const i=n.length,a=r.length;let l=e.oldPos,c=l-s,u=0;for(;c+1<i&&l+1<a&&this.equals(r[l+1],n[c+1],o);)c++,l++,u++,o.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!o.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const s=[];let o;for(;e;)s.push(e),o=e.previousComponent,delete e.previousComponent,e=o;s.reverse();const i=s.length;let a=0,l=0,c=0;for(;a<i;a++){const u=s[a];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(l,l+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(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return s}}class xc extends vs{}const vc=new xc;function Ic(t,e,n){return vc.diff(t,e,n)}const ur="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 Ec extends vs{tokenize(e){const n=new RegExp(`(\\r?\\n)|[${ur}]+|[^\\S\\n\\r]+|[^${ur}]`,"ug");return e.match(n)||[]}}const Ac=new Ec;function Lc(t,e,n){return Ac.diff(t,e,n)}function Rc(t={}){const{classPrefix:e="__shiki_",classSuffix:n="",classReplacer:r=a=>a}=t,s=new Map;function o(a){return Object.entries(a).map(([l,c])=>`${l}:${c}`).join(";")}function i(a){const l=typeof a=="string"?a:o(a);let c=e+Nc(l)+n;return c=r(c),s.has(c)||s.set(c,typeof a=="string"?a:{...a}),c}return{name:"@shikijs/transformers:style-to-class",pre(a){if(!a.properties.style)return;const l=i(a.properties.style);delete a.properties.style,this.addClassToHast(a,l)},tokens(a){for(const l of a)for(const c of l){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 a="";for(const[l,c]of s.entries())a+=`.${l}{${typeof c=="string"?c:o(c)}}`;return a},clearRegistry(){s.clear()}}}function Nc(t,e=0){let n=3735928559^e,r=1103547991^e;for(let s=0,o;s<t.length;s++)o=t.charCodeAt(s),n=Math.imul(n^o,2654435761),r=Math.imul(r^o,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}const Pc=/(?<=\n)/,We={dark:"pierre-dark",light:"pierre-light"},Is=1,fr=new Map,hr=new Set;function _n(t,e){t=Array.isArray(t)?t:[t];for(const n of t){if(hr.has(n.name))continue;let r=fr.get(n.name);r==null&&(r=n,fr.set(n.name,r)),hr.add(r.name),e.loadLanguageSync(r.data)}}const Ot=new Map,dr=new Set;function Es(t,e){t=Array.isArray(t)?t:[t];for(let n of t){let r;if(typeof n=="string"){if(r=Ot.get(n),r==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else r=n,n=n.name,Ot.has(n)||Ot.set(n,r);dr.has(n)||(dr.add(n),e.loadThemeSync(r))}}function Be(t){return t.replace(/\n$|\r\n$/,"")}function $c(t){return{type:"text",value:t}}function Tc(t){let e=t.children[0];for(;e!=null;){if(e.type==="element"&&e.tagName==="code")return e;"children"in e?e=e.children[0]:e=null}}function Mc(t,e,n){const r=typeof n.lineInfo=="function"?n.lineInfo(e):n.lineInfo[e-1];if(r==null){const s=`processLine: line ${e}, contains no state.lineInfo`;throw console.error(s,{node:t,line:e,state:n}),new Error(s)}return t.tagName="div",t.properties["data-line"]=r.lineNumber,t.properties["data-alt-line"]=r.altLineNumber,t.properties["data-line-type"]=r.type,t.properties["data-line-index"]=r.lineIndex,t.children.length===0&&t.children.push($c(`
|
|
153
|
+
`)),t}function As(t=!1){const e={lineInfo:[]},n=[{line(r){return delete r.properties.class,r},pre(r){const s=Tc(r),o=[];if(s!=null){let i=1;for(const a of s.children)a.type==="element"&&(o.push(Mc(a,i,e)),i++);s.children=o}return r}}];return t&&n.push(Oc,pr),{state:e,transformers:n,toClass:pr}}const pr=Rc({classPrefix:"hl-"}),Oc={name:"token-style-normalizer",tokens(t){for(const e of t)for(const n of e){if(n.htmlStyle!=null)continue;const r={};n.color!=null&&(r.color=n.color),n.bgColor!=null&&(r["background-color"]=n.bgColor),n.fontStyle!=null&&n.fontStyle!==0&&((n.fontStyle&1)!==0&&(r["font-style"]="italic"),(n.fontStyle&2)!==0&&(r["font-weight"]="bold"),(n.fontStyle&4)!==0&&(r["text-decoration"]="underline")),Object.keys(r).length>0&&(n.htmlStyle=r)}}};function H(t){return`--${t==="token"?"diffs-token":"diffs"}-`}const ye=new Map,Re={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function nn(t){if(ye.has(t))return ye.get(t)??"text";if(Re[t]!=null)return Re[t];const e=t.match(/\.([^/\\]+\.[^/\\]+)$/);if(e!=null){if(ye.has(e[1]))return ye.get(e[1])??"text";if(Re[e[1]]!=null)return Re[e[1]]??"text"}const n=t.match(/\.([^.]+)$/)?.[1]??"";return ye.has(n)?ye.get(n)??"text":Re[n]??"text"}function Ls({theme:t=We,highlighter:e,prefix:n}){let r="";if(typeof t=="string"){const s=e.getTheme(t);r+=`color:${s.fg};`,r+=`background-color:${s.bg};`,r+=`${H("global")}fg:${s.fg};`,r+=`${H("global")}bg:${s.bg};`,r+=Dt(s,n)}else{let s=e.getTheme(t.dark);r+=`${H("global")}dark:${s.fg};`,r+=`${H("global")}dark-bg:${s.bg};`,r+=Dt(s,"dark"),s=e.getTheme(t.light),r+=`${H("global")}light:${s.fg};`,r+=`${H("global")}light-bg:${s.bg};`,r+=Dt(s,"light")}return r}function Dt(t,e){e=e!=null?`${e}-`:"";let n="";const r=t.colors?.["gitDecoration.addedResourceForeground"]??t.colors?.["terminal.ansiGreen"];r!=null&&(n+=`${H("global")}${e}addition-color:${r};`);const s=t.colors?.["gitDecoration.deletedResourceForeground"]??t.colors?.["terminal.ansiRed"];s!=null&&(n+=`${H("global")}${e}deletion-color:${s};`);const o=t.colors?.["gitDecoration.modifiedResourceForeground"]??t.colors?.["terminal.ansiBlue"];return o!=null&&(n+=`${H("global")}${e}modified-color:${o};`),n}function rn(t){let e=t.children[0];for(;e!=null;){if(e.type==="element"&&e.tagName==="code")return e.children;"children"in e?e=e.children[0]:e=null}throw console.error(t),new Error("getLineNodes: Unable to find children")}function Dc({diff:t,diffStyle:e,startingLine:n=0,totalLines:r=1/0,expandedHunks:s,collapsedContextThreshold:o=Is,callback:i}){const a={finalHunk:t.hunks.at(-1),viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:0,unifiedCount:0,shouldBreak(){if(!a.isWindowedHighlight)return!1;const l=a.unifiedCount>=n+r,c=a.splitCount>=n+r;return l&&c},shouldSkip(l,c){if(!a.isWindowedHighlight)return!1;const u=a.unifiedCount+l<n,f=a.splitCount+c<n;return u&&f},incrementCounts(l,c){a.unifiedCount+=l,a.splitCount+=c},isInWindow(l,c){if(!a.isWindowedHighlight)return!0;const u=a.isInUnifiedWindow(l),f=a.isInSplitWindow(c);return u||f},isInUnifiedWindow(l){return!a.isWindowedHighlight||a.unifiedCount>=n-l&&a.unifiedCount<n+r},isInSplitWindow(l){return!a.isWindowedHighlight||a.splitCount>=n-l&&a.splitCount<n+r},emit(l,c=!1){return c||a.incrementCounts(1,1),i(l)??!1}};e:for(const[l,c]of t.hunks.entries()){let u=function(_,x){return d==null||d.collapsedLines<=0||d.fromStart+d.fromEnd>0?0:x===c.splitLineStart+c.splitLineCount-1?d.collapsedLines:0},f=function(){if(h.collapsedLines===0)return 0;const _=h.collapsedLines;return h.collapsedLines=0,_};if(a.shouldBreak())break;const h=gr(t.isPartial,c.collapsedBefore,s,l,o),d=(()=>{if(c!==a.finalHunk||!Gc(t))return;const _=t.additionLines.length-(c.additionLineIndex+c.additionCount),x=t.deletionLines.length-(c.deletionLineIndex+c.deletionCount);if(_!==x)throw new Error(`iterateOverDiff: trailing context mismatch (additions=${_}, deletions=${x}) for ${t.name}`);const v=Math.min(_,x);return gr(t.isPartial,v,s,t.hunks.length,o)})(),p=h.fromStart+h.fromEnd;if(a.shouldSkip(p,p))a.incrementCounts(p,p),f();else{let _=c.unifiedLineStart-h.rangeSize,x=c.splitLineStart-h.rangeSize,v=c.deletionLineIndex-h.rangeSize,N=c.additionLineIndex-h.rangeSize,L=c.deletionStart-h.rangeSize,F=c.additionStart-h.rangeSize,A=0;for(;A<h.fromStart;){if(a.isInWindow(0,0)){if(a.emit({hunkIndex:l,hunk:c,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:L+A,lineIndex:v+A,noEOFCR:!1,unifiedLineIndex:_+A,splitLineIndex:x+A},additionLine:{unifiedLineIndex:_+A,splitLineIndex:x+A,lineIndex:N+A,lineNumber:F+A,noEOFCR:!1}}))break e}else a.incrementCounts(1,1);A++}for(_=c.unifiedLineStart-h.fromEnd,x=c.splitLineStart-h.fromEnd,v=c.deletionLineIndex-h.fromEnd,N=c.additionLineIndex-h.fromEnd,L=c.deletionStart-h.fromEnd,F=c.additionStart-h.fromEnd,A=0;A<h.fromEnd;){if(a.isInWindow(0,0)){if(a.emit({hunkIndex:l,hunk:c,collapsedBefore:f(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:L+A,lineIndex:v+A,noEOFCR:!1,unifiedLineIndex:_+A,splitLineIndex:x+A},additionLine:{unifiedLineIndex:_+A,splitLineIndex:x+A,lineIndex:N+A,lineNumber:F+A,noEOFCR:!1}}))break e}else a.incrementCounts(1,1);A++}}let b=c.unifiedLineStart,w=c.splitLineStart,y=c.deletionLineIndex,m=c.additionLineIndex,g=c.deletionStart,S=c.additionStart;const k=c.hunkContent.at(-1);for(const _ of c.hunkContent){if(a.shouldBreak())break e;const x=_===k;if(_.type==="context"){if(a.shouldSkip(_.lines,_.lines))a.incrementCounts(_.lines,_.lines),f();else{let v=0;for(;v<_.lines;){if(a.isInWindow(0,0)){const N=x&&v===_.lines-1,L=b+v,F=w+v;if(a.emit({hunkIndex:l,hunk:c,collapsedBefore:f(),collapsedAfter:u(L,F),type:"context",deletionLine:{lineNumber:g+v,lineIndex:y+v,noEOFCR:N&&c.noEOFCRDeletions,unifiedLineIndex:L,splitLineIndex:F},additionLine:{unifiedLineIndex:L,splitLineIndex:F,lineIndex:m+v,lineNumber:S+v,noEOFCR:N&&c.noEOFCRAdditions}}))break e}else a.incrementCounts(1,1);v++}}b+=_.lines,w+=_.lines,y+=_.lines,m+=_.lines,g+=_.lines,S+=_.lines}else{const v=Math.max(_.deletions,_.additions),N=_.deletions+_.additions;if(!a.shouldSkip(N,v)){const L=Bc(a,_);for(const[F,A]of L)for(let re=F;re<A;re++){const K=u(b+re,w+re);if(a.emit(Fc({hunkIndex:l,hunk:c,collapsedBefore:f(),collapsedAfter:K,diffStyle:e,index:re,unifiedLineIndex:b,splitLineIndex:w,additionLineIndex:m,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:g,content:_,isLastContent:x,unifiedCount:N,splitCount:v}),!0))break e}}f(),a.incrementCounts(N,v),b+=N,w+=v,y+=_.deletions,m+=_.additions,g+=_.deletions,S+=_.additions}}if(d!=null){const{collapsedLines:_,fromStart:x,fromEnd:v}=d,N=x+v;let L=0;for(;L<N;){if(a.shouldBreak())break e;if(a.isInWindow(0,0)){const F=L===N-1;if(a.emit({hunkIndex:t.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:F?_:0,type:"context-expanded",deletionLine:{lineNumber:g+L,lineIndex:y+L,noEOFCR:!1,unifiedLineIndex:b+L,splitLineIndex:w+L},additionLine:{unifiedLineIndex:b+L,splitLineIndex:w+L,lineIndex:m+L,lineNumber:S+L,noEOFCR:!1}}))break e}else a.incrementCounts(1,1);L++}}}}function gr(t,e,n,r,s){if(e=Math.max(e,0),e===0||t)return{fromStart:0,fromEnd:0,rangeSize:e,collapsedLines:Math.max(e,0)};if(n===!0||e<=s)return{fromStart:e,fromEnd:0,rangeSize:e,collapsedLines:0};const o=n?.get(r),i=Math.min(Math.max(o?.fromStart??0,0),e),a=Math.min(Math.max(o?.fromEnd??0,0),e),l=i+a,c=l>=e;return{fromStart:c?e:i,fromEnd:c?0:a,rangeSize:e,collapsedLines:Math.max(e-l,0)}}function Gc(t){const e=t.hunks.at(-1);return e==null||t.isPartial||t.additionLines.length===0||t.deletionLines.length===0?!1:e.additionLineIndex+e.additionCount<t.additionLines.length||e.deletionLineIndex+e.deletionCount<t.deletionLines.length}function Bc(t,e,n){if(!t.isWindowedHighlight)return[[0,Math.max(e.deletions,e.additions)]];const r=[];function s(l,c){if(l+c<=t.viewportStart||l>=t.viewportEnd)return;const u=Math.max(0,t.viewportStart-l),f=Math.min(c,t.viewportEnd-l);return f>u?[u,f]:void 0}function o(l,c){return l}function i(l,c){if(l==null)return;const[u,f]=o(l);f>u&&r.push([u,f])}if(i(s(t.unifiedCount,e.deletions)),i(s(t.unifiedCount+e.deletions,e.additions)),i(s(t.splitCount,e.deletions)),i(s(t.splitCount,e.additions)),r.length===0)return r;r.sort((l,c)=>l[0]-c[0]);const a=[r[0]];for(const[l,c]of r.slice(1)){const u=a[a.length-1];l<=u[1]?u[1]=Math.max(u[1],c):a.push([l,c])}return a}function Fc({hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,diffStyle:s,index:o,unifiedLineIndex:i,splitLineIndex:a,additionLineIndex:l,deletionLineIndex:c,additionLineNumber:u,deletionLineNumber:f,content:h,isLastContent:d,unifiedCount:p,splitCount:b}){const w=o<h.deletions?i+o:void 0,y=o<h.additions?i+h.deletions+o:void 0,m=a+o,g=o<h.deletions?c+o:void 0,S=o<h.deletions?f+o:void 0,k=o<h.additions?l+o:void 0,_=o<h.additions?u+o:void 0,x=d&&o===b-1&&e.noEOFCRDeletions,v=d&&o===b-1&&e.noEOFCRAdditions,N=g!=null&&S!=null&&w!=null?{lineNumber:S,lineIndex:g,noEOFCR:x,unifiedLineIndex:w,splitLineIndex:m}:void 0,L=k!=null&&_!=null&&y!=null?{unifiedLineIndex:y,splitLineIndex:m,lineIndex:k,lineNumber:_,noEOFCR:v}:void 0;if(N==null&&L!=null)return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:L};if(N!=null&&L==null)return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:N,additionLine:void 0};if(N==null||L==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:N,additionLine:L}}function mr({line:t,spanStart:e,spanLength:n}){return{start:{line:t,character:e},end:{line:t,character:e+n},properties:{"data-diff-span":""},alwaysWrap:!0}}function Qe({item:t,arr:e,enableJoin:n,isNeutral:r=!1,isLastItem:s=!1}){const o=e[e.length-1];if(o==null||s||!n){e.push([r?0:1,t.value]);return}const i=o[0]===0;if(r===i||r&&t.value.length===1&&!i){o[1]+=t.value;return}e.push([r?0:1,t.value])}const Uc={forcePlainText:!1};function jc(t,e,n,{forcePlainText:r,startingLine:s,totalLines:o,expandedHunks:i,collapsedContextThreshold:a=Is}=Uc){r?(s??=0,o??=1/0):(s=0,o=1/0);const l=s>0||o<1/0,c=(()=>{const m=n.theme??We;if(typeof m=="string")return e.getTheme(m).type})(),u=Ls({theme:n.theme,highlighter:e}),f=r&&!l&&(t.unifiedLineCount>1e3||t.splitLineCount>1e3)?"none":n.lineDiffType,h={deletionLines:[],additionLines:[]},d=!r&&!t.isPartial,p=r?i:void 0,b=new Map;function w(m){const g=d?0:m,S=b.get(g)??zc();return b.set(g,S),S}function y(m,g,S,k){if(l){let _=S.at(-1);(_==null||_.targetIndex+_.count!==g)&&(_={targetIndex:g,originalOffset:k.length,count:0},S.push(_)),_.count++}k.push(m)}Dc({diff:t,diffStyle:"both",startingLine:s,totalLines:o,expandedHunks:l?p:!0,collapsedContextThreshold:a,callback:({hunkIndex:m,additionLine:g,deletionLine:S,type:k})=>{const _=w(m),x=g!=null?g.splitLineIndex:S.splitLineIndex;k==="change"&&g!=null&&S!=null&&Wc({additionLine:t.additionLines[g.lineIndex],deletionLine:t.deletionLines[S.lineIndex],deletionLineIndex:_.deletionContent.length,additionLineIndex:_.additionContent.length,deletionDecorations:_.deletionDecorations,additionDecorations:_.additionDecorations,lineDiffType:f}),S!=null&&(y(t.deletionLines[S.lineIndex],S.lineIndex,_.deletionSegments,_.deletionContent),_.deletionInfo.push({type:k==="change"?"change-deletion":k,lineNumber:S.lineNumber,altLineNumber:k==="change"?void 0:g.lineNumber??void 0,lineIndex:`${S.unifiedLineIndex},${x}`})),g!=null&&(y(t.additionLines[g.lineIndex],g.lineIndex,_.additionSegments,_.additionContent),_.additionInfo.push({type:k==="change"?"change-addition":k,lineNumber:g.lineNumber,altLineNumber:k==="change"?void 0:S.lineNumber??void 0,lineIndex:`${g.unifiedLineIndex},${x}`}))}});for(const m of b.values()){if(m.deletionContent.length===0&&m.additionContent.length===0)continue;const g={name:t.prevName??t.name,contents:m.deletionContent.value},S={name:t.name,contents:m.additionContent.value},{deletionLines:k,additionLines:_}=Hc({deletionFile:g,deletionInfo:m.deletionInfo,deletionDecorations:m.deletionDecorations,additionFile:S,additionInfo:m.additionInfo,additionDecorations:m.additionDecorations,highlighter:e,options:n,languageOverride:r?"text":t.lang});if(d){h.deletionLines=k,h.additionLines=_;continue}if(m.deletionSegments.length>0)for(const x of m.deletionSegments)for(let v=0;v<x.count;v++)h.deletionLines[x.targetIndex+v]=k[x.originalOffset+v];else h.deletionLines.push(...k);if(m.additionSegments.length>0)for(const x of m.additionSegments)for(let v=0;v<x.count;v++)h.additionLines[x.targetIndex+v]=_[x.originalOffset+v];else h.additionLines.push(..._)}return{code:h,themeStyles:u,baseThemeType:c}}function Wc({deletionLine:t,additionLine:e,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:s,additionDecorations:o,lineDiffType:i}){if(t==null||e==null||i==="none")return;t=Be(t),e=Be(e);const a=i==="char"?Ic(t,e):Lc(t,e),l=[],c=[],u=i==="word-alt",f=a.at(-1);for(const d of a){const p=d===f;!d.added&&!d.removed?(Qe({item:d,arr:l,enableJoin:u,isNeutral:!0,isLastItem:p}),Qe({item:d,arr:c,enableJoin:u,isNeutral:!0,isLastItem:p})):d.removed?Qe({item:d,arr:l,enableJoin:u,isLastItem:p}):Qe({item:d,arr:c,enableJoin:u,isLastItem:p})}let h=0;for(const d of l)d[0]===1&&s.push(mr({line:n,spanStart:h,spanLength:d[1].length})),h+=d[1].length;h=0;for(const d of c)d[0]===1&&o.push(mr({line:r,spanStart:h,spanLength:d[1].length})),h+=d[1].length}function zc(){return{deletionContent:{push(t){this.value+=t,this.length++},value:"",length:0},additionContent:{push(t){this.value+=t,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Hc({deletionFile:t,additionFile:e,deletionInfo:n,additionInfo:r,highlighter:s,deletionDecorations:o,additionDecorations:i,languageOverride:a,options:{theme:l=We,...c}}){const u=a??nn(t.name),f=a??nn(e.name),{state:h,transformers:d}=As(),p=typeof l=="string"?{...c,lang:"text",theme:l,transformers:d,decorations:void 0,defaultColor:!1,cssVariablePrefix:H("token")}:{...c,lang:"text",themes:l,transformers:d,decorations:void 0,defaultColor:!1,cssVariablePrefix:H("token")};return{deletionLines:t.contents===""?[]:(p.lang=u,h.lineInfo=n,p.decorations=o,rn(s.codeToHast(Be(t.contents),p))),additionLines:e.contents===""?[]:(p.lang=f,p.decorations=i,h.lineInfo=r,rn(s.codeToHast(Be(e.contents),p)))}}function qc({lines:t,startingLine:e=0,totalLines:n=1/0,callback:r}){const s=Math.min(e+n,t.length),o=(()=>{const i=t.at(-1);return i===""||i===`
|
|
154
|
+
`||i===`\r
|
|
155
|
+
`||i==="\r"?Math.max(0,t.length-2):t.length-1})();for(let i=e;i<s;i++){const a=i===o;if(r({lineIndex:i,lineNumber:i+1,content:t[i],isLastLine:a})===!0||a)break}}function Vc(t){return t!==""?t.split(Pc):[]}const Xc={forcePlainText:!1};function Kc(t,e,{theme:n=We,tokenizeMaxLineLength:r},{forcePlainText:s,startingLine:o,totalLines:i,lines:a}=Xc){s?(o??=0,i??=1/0):(o=0,i=1/0);const l=o>0||i<1/0,{state:c,transformers:u}=As(),f=s?"text":t.lang??nn(t.name),h=(()=>{if(typeof n=="string")return e.getTheme(n).type})(),d=Ls({theme:n,highlighter:e});c.lineInfo=y=>({type:"context",lineIndex:y-1+o,lineNumber:y+o});const p=typeof n=="string"?{lang:f,theme:n,transformers:u,defaultColor:!1,cssVariablePrefix:H("token"),tokenizeMaxLineLength:r}:{lang:f,themes:n,transformers:u,defaultColor:!1,cssVariablePrefix:H("token"),tokenizeMaxLineLength:r},b=rn(e.codeToHast(l?Zc(a??Vc(t.contents),o,i):Be(t.contents),p)),w=l?new Array(o):b;return l&&w.push(...b),{code:w,themeStyles:d,baseThemeType:h}}function Zc(t,e,n){let r="";return qc({lines:t,startingLine:e,totalLines:n,callback({content:s}){r+=s}}),r}let yr,xe={theme:We,tokenizeMaxLineLength:1e3,lineDiffType:"word-alt"};self.addEventListener("error",t=>{console.error("[Shiki Worker] Unhandled error:",t.error)});self.addEventListener("message",t=>{Qc(t.data)});async function Qc(t){try{switch(t.type){case"initialize":await Yc(t);break;case"set-render-options":await Jc(t);break;case"file":await eu(t);break;case"diff":await tu(t);break;default:throw new Error(`Unknown request type: ${t.type}`)}}catch(e){console.error("Worker error:",e),su(t.id,e)}}async function Yc({id:t,renderOptions:e,preferredHighlighter:n,resolvedThemes:r,resolvedLanguages:s}){let o=wt(n);"then"in o&&(o=await o),Es(r,o),s!=null&&_n(s,o),xe=e,postMessage({type:"success",id:t,requestType:"initialize",sentAt:Date.now()})}async function Jc({id:t,renderOptions:e,resolvedThemes:n}){let r=wt();"then"in r&&(r=await r),Es(n,r),xe=e,postMessage({type:"success",id:t,requestType:"set-render-options",sentAt:Date.now()})}async function eu({id:t,file:e,resolvedLanguages:n}){let r=wt();"then"in r&&(r=await r),n!=null&&_n(n,r);const s={theme:xe.theme,tokenizeMaxLineLength:xe.tokenizeMaxLineLength};nu(t,Kc(e,r,s),s)}async function tu({id:t,diff:e,resolvedLanguages:n}){let r=wt();"then"in r&&(r=await r),n!=null&&_n(n,r),ru(t,jc(e,r,xe),xe)}function wt(t="shiki-js"){return yr??=Ca({themes:[],langs:[],engine:t==="shiki-wasm"?kc(import("./wasm-CG6Dc4jp.js")):ic()}),yr}function nu(t,e,n){postMessage({type:"success",requestType:"file",id:t,result:e,options:n,sentAt:Date.now()})}function ru(t,e,n){postMessage({type:"success",requestType:"diff",id:t,result:e,options:n,sentAt:Date.now()})}function su(t,e){const n={type:"error",id:t,error:e instanceof Error?e.message:String(e),stack:e instanceof Error?e.stack:void 0};postMessage(n)}
|